@adcp/sdk 13.0.1 → 13.0.3

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 (1411) hide show
  1. package/ADCP_VERSION +1 -1
  2. package/bin/adcp.js +37 -2
  3. package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/index.yaml +5 -1
  4. package/compliance/cache/{3.1.15.previous/protocols → 3.1.20/domains}/media-buy/scenarios/creative_fate_after_cancellation.yaml +5 -1
  5. package/compliance/cache/{3.1.15/protocols → 3.1.20/domains}/media-buy/scenarios/dependency_impairment.yaml +14 -13
  6. package/compliance/cache/{3.1.15/protocols → 3.1.20/domains}/media-buy/scenarios/dependency_impairment_cardinality.yaml +14 -13
  7. package/compliance/cache/3.1.20/domains/media-buy/scenarios/inventory_list_no_match.yaml +229 -0
  8. package/compliance/cache/{3.1.15.previous/protocols → 3.1.20/domains}/media-buy/scenarios/inventory_list_targeting.yaml +44 -61
  9. package/compliance/cache/{3.1.15/protocols → 3.1.20/domains}/media-buy/scenarios/measurement_terms_rejected.yaml +7 -73
  10. package/compliance/cache/{3.1.15.previous → 3.1.20}/domains/media-buy/scenarios/pending_creatives_to_start.yaml +12 -7
  11. package/compliance/cache/{3.1.15.previous → 3.1.20}/domains/media-buy/scenarios/refine_products.yaml +5 -1
  12. package/compliance/cache/{3.1.15 → 3.1.20}/index.json +3 -3
  13. package/compliance/cache/{3.1.15.previous/domains → 3.1.20/protocols}/media-buy/index.yaml +5 -1
  14. package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/creative_fate_after_cancellation.yaml +5 -1
  15. package/compliance/cache/{3.1.15.previous/domains → 3.1.20/protocols}/media-buy/scenarios/dependency_impairment.yaml +14 -13
  16. package/compliance/cache/{3.1.15.previous → 3.1.20}/protocols/media-buy/scenarios/dependency_impairment_cardinality.yaml +14 -13
  17. package/compliance/cache/3.1.20/protocols/media-buy/scenarios/inventory_list_no_match.yaml +229 -0
  18. package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/inventory_list_targeting.yaml +44 -61
  19. package/compliance/cache/{3.1.15.previous → 3.1.20}/protocols/media-buy/scenarios/measurement_terms_rejected.yaml +7 -73
  20. package/compliance/cache/{3.1.15.previous → 3.1.20}/protocols/media-buy/scenarios/pending_creatives_to_start.yaml +12 -7
  21. package/compliance/cache/{3.1.15.previous → 3.1.20}/protocols/media-buy/scenarios/refine_products.yaml +5 -1
  22. package/compliance/cache/{3.1.15.previous → 3.1.20}/specialisms/sales-broadcast-tv/index.yaml +6 -1
  23. package/compliance/cache/{3.1.15.previous → 3.1.20}/specialisms/sales-guaranteed/index.yaml +5 -1
  24. package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/sales-proposal-mode/index.yaml +5 -1
  25. package/compliance/cache/{3.1.15 → 3.1.20}/test-kits/acme-outdoor.yaml +10 -0
  26. package/compliance/cache/{3.1.15.previous → 3.1.20}/universal/pagination-integrity-creative-formats.yaml +2 -2
  27. package/compliance/cache/{3.1.15/protocols → 3.1.20.previous/domains}/media-buy/index.yaml +5 -1
  28. package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/creative_fate_after_cancellation.yaml +5 -1
  29. package/compliance/cache/{3.1.15 → 3.1.20.previous}/domains/media-buy/scenarios/dependency_impairment.yaml +14 -13
  30. package/compliance/cache/{3.1.15 → 3.1.20.previous}/domains/media-buy/scenarios/dependency_impairment_cardinality.yaml +14 -13
  31. package/compliance/cache/3.1.20.previous/domains/media-buy/scenarios/inventory_list_no_match.yaml +229 -0
  32. package/compliance/cache/{3.1.15 → 3.1.20.previous}/domains/media-buy/scenarios/inventory_list_targeting.yaml +44 -61
  33. package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/measurement_terms_rejected.yaml +7 -73
  34. package/compliance/cache/{3.1.15 → 3.1.20.previous}/domains/media-buy/scenarios/pending_creatives_to_start.yaml +12 -7
  35. package/compliance/cache/{3.1.15 → 3.1.20.previous}/domains/media-buy/scenarios/refine_products.yaml +5 -1
  36. package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/index.json +3 -3
  37. package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/index.yaml +5 -1
  38. package/compliance/cache/{3.1.15/domains → 3.1.20.previous/protocols}/media-buy/scenarios/creative_fate_after_cancellation.yaml +5 -1
  39. package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/dependency_impairment.yaml +14 -13
  40. package/compliance/cache/{3.1.15.previous/domains → 3.1.20.previous/protocols}/media-buy/scenarios/dependency_impairment_cardinality.yaml +14 -13
  41. package/compliance/cache/3.1.20.previous/protocols/media-buy/scenarios/inventory_list_no_match.yaml +229 -0
  42. package/compliance/cache/{3.1.15.previous/domains → 3.1.20.previous/protocols}/media-buy/scenarios/inventory_list_targeting.yaml +44 -61
  43. package/compliance/cache/{3.1.15/domains → 3.1.20.previous/protocols}/media-buy/scenarios/measurement_terms_rejected.yaml +7 -73
  44. package/compliance/cache/{3.1.15 → 3.1.20.previous}/protocols/media-buy/scenarios/pending_creatives_to_start.yaml +12 -7
  45. package/compliance/cache/{3.1.15 → 3.1.20.previous}/protocols/media-buy/scenarios/refine_products.yaml +5 -1
  46. package/compliance/cache/{3.1.15 → 3.1.20.previous}/specialisms/sales-broadcast-tv/index.yaml +6 -1
  47. package/compliance/cache/{3.1.15 → 3.1.20.previous}/specialisms/sales-guaranteed/index.yaml +5 -1
  48. package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/sales-proposal-mode/index.yaml +5 -1
  49. package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-kits/acme-outdoor.yaml +10 -0
  50. package/compliance/cache/{3.1.15 → 3.1.20.previous}/universal/pagination-integrity-creative-formats.yaml +2 -2
  51. package/dist/lib/schemas-data/3.1/a2ui/bound-value.json +1 -1
  52. package/dist/lib/schemas-data/3.1/a2ui/component.json +1 -1
  53. package/dist/lib/schemas-data/3.1/a2ui/si-catalog.json +25 -25
  54. package/dist/lib/schemas-data/3.1/a2ui/surface.json +2 -2
  55. package/dist/lib/schemas-data/3.1/a2ui/user-action.json +1 -1
  56. package/dist/lib/schemas-data/3.1/aao/agent-publishers.json +1 -1
  57. package/dist/lib/schemas-data/3.1/account/get-account-financials-request.json +6 -6
  58. package/dist/lib/schemas-data/3.1/account/get-account-financials-response.json +12 -12
  59. package/dist/lib/schemas-data/3.1/account/list-accounts-request.json +6 -6
  60. package/dist/lib/schemas-data/3.1/account/list-accounts-response.json +8 -8
  61. package/dist/lib/schemas-data/3.1/account/report-usage-request.json +6 -6
  62. package/dist/lib/schemas-data/3.1/account/report-usage-response.json +6 -6
  63. package/dist/lib/schemas-data/3.1/account/sync-accounts-request.json +12 -12
  64. package/dist/lib/schemas-data/3.1/account/sync-accounts-response.json +16 -16
  65. package/dist/lib/schemas-data/3.1/account/sync-governance-request.json +6 -6
  66. package/dist/lib/schemas-data/3.1/account/sync-governance-response.json +10 -10
  67. package/dist/lib/schemas-data/3.1/adagents.json +29 -29
  68. package/dist/lib/schemas-data/3.1/brand/acquire-rights-request.json +10 -10
  69. package/dist/lib/schemas-data/3.1/brand/acquire-rights-response.json +16 -16
  70. package/dist/lib/schemas-data/3.1/brand/creative-approval-request.json +5 -5
  71. package/dist/lib/schemas-data/3.1/brand/creative-approval-response.json +12 -12
  72. package/dist/lib/schemas-data/3.1/brand/get-brand-identity-request.json +4 -4
  73. package/dist/lib/schemas-data/3.1/brand/get-brand-identity-response.json +10 -10
  74. package/dist/lib/schemas-data/3.1/brand/get-rights-request.json +8 -8
  75. package/dist/lib/schemas-data/3.1/brand/get-rights-response.json +11 -11
  76. package/dist/lib/schemas-data/3.1/brand/revocation-notification.json +4 -4
  77. package/dist/lib/schemas-data/3.1/brand/rights-pricing-option.json +5 -5
  78. package/dist/lib/schemas-data/3.1/brand/rights-terms.json +3 -3
  79. package/dist/lib/schemas-data/3.1/brand/search-brands-request.json +6 -6
  80. package/dist/lib/schemas-data/3.1/brand/search-brands-response.json +11 -11
  81. package/dist/lib/schemas-data/3.1/brand/update-rights-request.json +6 -6
  82. package/dist/lib/schemas-data/3.1/brand/update-rights-response.json +11 -11
  83. package/dist/lib/schemas-data/3.1/brand/verification-status.json +1 -1
  84. package/dist/lib/schemas-data/3.1/brand/verify-brand-claim-request.json +2 -2
  85. package/dist/lib/schemas-data/3.1/brand/verify-brand-claim-response.json +13 -13
  86. package/dist/lib/schemas-data/3.1/brand/verify-brand-claims-request.json +2 -2
  87. package/dist/lib/schemas-data/3.1/brand/verify-brand-claims-response.json +13 -13
  88. package/dist/lib/schemas-data/3.1/brand.json +21 -21
  89. package/dist/lib/schemas-data/3.1/bundled/content-standards/calibrate-content-request.json +12 -12
  90. package/dist/lib/schemas-data/3.1/bundled/content-standards/calibrate-content-response.json +12 -12
  91. package/dist/lib/schemas-data/3.1/bundled/content-standards/create-content-standards-request.json +16 -16
  92. package/dist/lib/schemas-data/3.1/bundled/content-standards/create-content-standards-response.json +10 -10
  93. package/dist/lib/schemas-data/3.1/bundled/content-standards/get-content-standards-request.json +5 -5
  94. package/dist/lib/schemas-data/3.1/bundled/content-standards/get-content-standards-response.json +23 -23
  95. package/dist/lib/schemas-data/3.1/bundled/content-standards/get-media-buy-artifacts-request.json +16 -16
  96. package/dist/lib/schemas-data/3.1/bundled/content-standards/get-media-buy-artifacts-response.json +18 -18
  97. package/dist/lib/schemas-data/3.1/bundled/content-standards/list-content-standards-request.json +7 -7
  98. package/dist/lib/schemas-data/3.1/bundled/content-standards/list-content-standards-response.json +24 -24
  99. package/dist/lib/schemas-data/3.1/bundled/content-standards/update-content-standards-request.json +16 -16
  100. package/dist/lib/schemas-data/3.1/bundled/content-standards/update-content-standards-response.json +10 -10
  101. package/dist/lib/schemas-data/3.1/bundled/content-standards/validate-content-delivery-request.json +12 -12
  102. package/dist/lib/schemas-data/3.1/bundled/content-standards/validate-content-delivery-response.json +12 -12
  103. package/dist/lib/schemas-data/3.1/bundled/core/tasks-get-request.json +16 -16
  104. package/dist/lib/schemas-data/3.1/bundled/core/tasks-get-response.json +183 -183
  105. package/dist/lib/schemas-data/3.1/bundled/core/tasks-list-request.json +21 -21
  106. package/dist/lib/schemas-data/3.1/bundled/core/tasks-list-response.json +11 -11
  107. package/dist/lib/schemas-data/3.1/bundled/creative/get-creative-delivery-request.json +17 -17
  108. package/dist/lib/schemas-data/3.1/bundled/creative/get-creative-delivery-response.json +56 -56
  109. package/dist/lib/schemas-data/3.1/bundled/creative/get-creative-features-request.json +44 -44
  110. package/dist/lib/schemas-data/3.1/bundled/creative/get-creative-features-response.json +13 -13
  111. package/dist/lib/schemas-data/3.1/bundled/creative/list-creative-formats-request.json +16 -16
  112. package/dist/lib/schemas-data/3.1/bundled/creative/list-creative-formats-response.json +48 -48
  113. package/dist/lib/schemas-data/3.1/bundled/creative/list-creatives-request.json +17 -17
  114. package/dist/lib/schemas-data/3.1/bundled/creative/list-creatives-response.json +58 -58
  115. package/dist/lib/schemas-data/3.1/bundled/creative/list-transformers-request.json +18 -18
  116. package/dist/lib/schemas-data/3.1/bundled/creative/list-transformers-response.json +16 -16
  117. package/dist/lib/schemas-data/3.1/bundled/creative/preview-creative-request.json +44 -44
  118. package/dist/lib/schemas-data/3.1/bundled/creative/preview-creative-response.json +50 -50
  119. package/dist/lib/schemas-data/3.1/bundled/creative/sync-creatives-request.json +46 -46
  120. package/dist/lib/schemas-data/3.1/bundled/creative/sync-creatives-response.json +27 -27
  121. package/dist/lib/schemas-data/3.1/bundled/creative/validate-input-request.json +42 -42
  122. package/dist/lib/schemas-data/3.1/bundled/creative/validate-input-response.json +10 -10
  123. package/dist/lib/schemas-data/3.1/bundled/media-buy/build-creative-request.json +53 -53
  124. package/dist/lib/schemas-data/3.1/bundled/media-buy/build-creative-response.json +54 -54
  125. package/dist/lib/schemas-data/3.1/bundled/media-buy/create-media-buy-request.json +83 -83
  126. package/dist/lib/schemas-data/3.1/bundled/media-buy/create-media-buy-response.json +77 -77
  127. package/dist/lib/schemas-data/3.1/bundled/media-buy/get-media-buy-delivery-request.json +25 -25
  128. package/dist/lib/schemas-data/3.1/bundled/media-buy/get-media-buy-delivery-response.json +40 -40
  129. package/dist/lib/schemas-data/3.1/bundled/media-buy/get-media-buys-request.json +18 -18
  130. package/dist/lib/schemas-data/3.1/bundled/media-buy/get-media-buys-response.json +65 -65
  131. package/dist/lib/schemas-data/3.1/bundled/media-buy/get-products-request.json +50 -50
  132. package/dist/lib/schemas-data/3.1/bundled/media-buy/get-products-response.json +101 -101
  133. package/dist/lib/schemas-data/3.1/bundled/media-buy/list-creative-formats-request.json +12 -12
  134. package/dist/lib/schemas-data/3.1/bundled/media-buy/list-creative-formats-response.json +48 -48
  135. package/dist/lib/schemas-data/3.1/bundled/media-buy/log-event-request.json +13 -13
  136. package/dist/lib/schemas-data/3.1/bundled/media-buy/log-event-response.json +10 -10
  137. package/dist/lib/schemas-data/3.1/bundled/media-buy/package-request.json +79 -79
  138. package/dist/lib/schemas-data/3.1/bundled/media-buy/provide-performance-feedback-request.json +8 -8
  139. package/dist/lib/schemas-data/3.1/bundled/media-buy/provide-performance-feedback-response.json +10 -10
  140. package/dist/lib/schemas-data/3.1/bundled/media-buy/sync-audiences-request.json +19 -19
  141. package/dist/lib/schemas-data/3.1/bundled/media-buy/sync-audiences-response.json +13 -13
  142. package/dist/lib/schemas-data/3.1/bundled/media-buy/sync-catalogs-request.json +26 -26
  143. package/dist/lib/schemas-data/3.1/bundled/media-buy/sync-catalogs-response.json +12 -12
  144. package/dist/lib/schemas-data/3.1/bundled/media-buy/sync-event-sources-request.json +19 -19
  145. package/dist/lib/schemas-data/3.1/bundled/media-buy/sync-event-sources-response.json +16 -16
  146. package/dist/lib/schemas-data/3.1/bundled/media-buy/update-media-buy-request.json +79 -79
  147. package/dist/lib/schemas-data/3.1/bundled/media-buy/update-media-buy-response.json +71 -71
  148. package/dist/lib/schemas-data/3.1/bundled/property/create-property-list-request.json +18 -18
  149. package/dist/lib/schemas-data/3.1/bundled/property/create-property-list-response.json +26 -26
  150. package/dist/lib/schemas-data/3.1/bundled/property/delete-property-list-request.json +16 -16
  151. package/dist/lib/schemas-data/3.1/bundled/property/delete-property-list-response.json +10 -10
  152. package/dist/lib/schemas-data/3.1/bundled/property/get-property-list-request.json +16 -16
  153. package/dist/lib/schemas-data/3.1/bundled/property/get-property-list-response.json +27 -27
  154. package/dist/lib/schemas-data/3.1/bundled/property/list-property-lists-request.json +17 -17
  155. package/dist/lib/schemas-data/3.1/bundled/property/list-property-lists-response.json +27 -27
  156. package/dist/lib/schemas-data/3.1/bundled/property/update-property-list-request.json +18 -18
  157. package/dist/lib/schemas-data/3.1/bundled/property/update-property-list-response.json +26 -26
  158. package/dist/lib/schemas-data/3.1/bundled/property/validate-property-delivery-request.json +19 -19
  159. package/dist/lib/schemas-data/3.1/bundled/property/validate-property-delivery-response.json +15 -15
  160. package/dist/lib/schemas-data/3.1/bundled/protocol/get-adcp-capabilities-request.json +5 -5
  161. package/dist/lib/schemas-data/3.1/bundled/protocol/get-adcp-capabilities-response.json +40 -40
  162. package/dist/lib/schemas-data/3.1/bundled/protocol/get-task-status-request.json +16 -16
  163. package/dist/lib/schemas-data/3.1/bundled/protocol/get-task-status-response.json +183 -183
  164. package/dist/lib/schemas-data/3.1/bundled/protocol/list-tasks-request.json +21 -21
  165. package/dist/lib/schemas-data/3.1/bundled/protocol/list-tasks-response.json +11 -11
  166. package/dist/lib/schemas-data/3.1/bundled/signals/activate-signal-request.json +17 -17
  167. package/dist/lib/schemas-data/3.1/bundled/signals/activate-signal-response.json +12 -12
  168. package/dist/lib/schemas-data/3.1/bundled/signals/get-signals-request.json +24 -24
  169. package/dist/lib/schemas-data/3.1/bundled/signals/get-signals-response.json +53 -53
  170. package/dist/lib/schemas-data/3.1/bundled/sponsored-intelligence/si-get-offering-request.json +5 -5
  171. package/dist/lib/schemas-data/3.1/bundled/sponsored-intelligence/si-get-offering-response.json +23 -23
  172. package/dist/lib/schemas-data/3.1/bundled/sponsored-intelligence/si-initiate-session-request.json +18 -18
  173. package/dist/lib/schemas-data/3.1/bundled/sponsored-intelligence/si-initiate-session-response.json +25 -25
  174. package/dist/lib/schemas-data/3.1/bundled/sponsored-intelligence/si-send-message-request.json +16 -16
  175. package/dist/lib/schemas-data/3.1/bundled/sponsored-intelligence/si-send-message-response.json +26 -26
  176. package/dist/lib/schemas-data/3.1/bundled/sponsored-intelligence/si-terminate-session-request.json +5 -5
  177. package/dist/lib/schemas-data/3.1/bundled/sponsored-intelligence/si-terminate-session-response.json +11 -11
  178. package/dist/lib/schemas-data/3.1/collection/base-collection-source.json +3 -3
  179. package/dist/lib/schemas-data/3.1/collection/collection-list-changed-webhook.json +2 -2
  180. package/dist/lib/schemas-data/3.1/collection/collection-list-filters.json +7 -7
  181. package/dist/lib/schemas-data/3.1/collection/collection-list.json +5 -5
  182. package/dist/lib/schemas-data/3.1/collection/create-collection-list-request.json +8 -8
  183. package/dist/lib/schemas-data/3.1/collection/create-collection-list-response.json +6 -6
  184. package/dist/lib/schemas-data/3.1/collection/delete-collection-list-request.json +5 -5
  185. package/dist/lib/schemas-data/3.1/collection/delete-collection-list-response.json +5 -5
  186. package/dist/lib/schemas-data/3.1/collection/get-collection-list-request.json +5 -5
  187. package/dist/lib/schemas-data/3.1/collection/get-collection-list-response.json +12 -12
  188. package/dist/lib/schemas-data/3.1/collection/list-collection-lists-request.json +6 -6
  189. package/dist/lib/schemas-data/3.1/collection/list-collection-lists-response.json +7 -7
  190. package/dist/lib/schemas-data/3.1/collection/update-collection-list-request.json +8 -8
  191. package/dist/lib/schemas-data/3.1/collection/update-collection-list-response.json +6 -6
  192. package/dist/lib/schemas-data/3.1/content-standards/artifact-webhook-payload.json +3 -3
  193. package/dist/lib/schemas-data/3.1/content-standards/artifact.json +7 -7
  194. package/dist/lib/schemas-data/3.1/content-standards/calibrate-content-request.json +5 -5
  195. package/dist/lib/schemas-data/3.1/content-standards/calibrate-content-response.json +10 -10
  196. package/dist/lib/schemas-data/3.1/content-standards/content-standards.json +7 -7
  197. package/dist/lib/schemas-data/3.1/content-standards/create-content-standards-request.json +8 -8
  198. package/dist/lib/schemas-data/3.1/content-standards/create-content-standards-response.json +8 -8
  199. package/dist/lib/schemas-data/3.1/content-standards/get-content-standards-request.json +4 -4
  200. package/dist/lib/schemas-data/3.1/content-standards/get-content-standards-response.json +9 -9
  201. package/dist/lib/schemas-data/3.1/content-standards/get-media-buy-artifacts-request.json +5 -5
  202. package/dist/lib/schemas-data/3.1/content-standards/get-media-buy-artifacts-response.json +10 -10
  203. package/dist/lib/schemas-data/3.1/content-standards/list-content-standards-request.json +6 -6
  204. package/dist/lib/schemas-data/3.1/content-standards/list-content-standards-response.json +10 -10
  205. package/dist/lib/schemas-data/3.1/content-standards/update-content-standards-request.json +8 -8
  206. package/dist/lib/schemas-data/3.1/content-standards/update-content-standards-response.json +8 -8
  207. package/dist/lib/schemas-data/3.1/content-standards/validate-content-delivery-request.json +5 -5
  208. package/dist/lib/schemas-data/3.1/content-standards/validate-content-delivery-response.json +10 -10
  209. package/dist/lib/schemas-data/3.1/core/account-authorization.json +1 -1
  210. package/dist/lib/schemas-data/3.1/core/account-ref.json +2 -2
  211. package/dist/lib/schemas-data/3.1/core/account-with-authorization.json +3 -3
  212. package/dist/lib/schemas-data/3.1/core/account.json +10 -10
  213. package/dist/lib/schemas-data/3.1/core/activation-key.json +1 -1
  214. package/dist/lib/schemas-data/3.1/core/ad-inventory-config.json +1 -1
  215. package/dist/lib/schemas-data/3.1/core/agent-encryption-key.json +1 -1
  216. package/dist/lib/schemas-data/3.1/core/agent-signing-key.json +1 -1
  217. package/dist/lib/schemas-data/3.1/core/app-item.json +4 -4
  218. package/dist/lib/schemas-data/3.1/core/asset-group-vocabulary.json +1 -1
  219. package/dist/lib/schemas-data/3.1/core/assets/asset-union.json +21 -21
  220. package/dist/lib/schemas-data/3.1/core/assets/audio-asset.json +3 -3
  221. package/dist/lib/schemas-data/3.1/core/assets/brief-asset.json +2 -2
  222. package/dist/lib/schemas-data/3.1/core/assets/card-asset.json +6 -6
  223. package/dist/lib/schemas-data/3.1/core/assets/catalog-asset.json +2 -2
  224. package/dist/lib/schemas-data/3.1/core/assets/css-asset.json +2 -2
  225. package/dist/lib/schemas-data/3.1/core/assets/daast-asset.json +4 -4
  226. package/dist/lib/schemas-data/3.1/core/assets/daast-tracker-asset.json +3 -3
  227. package/dist/lib/schemas-data/3.1/core/assets/html-asset.json +2 -2
  228. package/dist/lib/schemas-data/3.1/core/assets/image-asset.json +2 -2
  229. package/dist/lib/schemas-data/3.1/core/assets/javascript-asset.json +3 -3
  230. package/dist/lib/schemas-data/3.1/core/assets/markdown-asset.json +2 -2
  231. package/dist/lib/schemas-data/3.1/core/assets/pixel-tracker-asset.json +2 -2
  232. package/dist/lib/schemas-data/3.1/core/assets/published-post-asset.json +2 -2
  233. package/dist/lib/schemas-data/3.1/core/assets/text-asset.json +2 -2
  234. package/dist/lib/schemas-data/3.1/core/assets/url-asset.json +3 -3
  235. package/dist/lib/schemas-data/3.1/core/assets/vast-asset.json +4 -4
  236. package/dist/lib/schemas-data/3.1/core/assets/vast-tracker-asset.json +3 -3
  237. package/dist/lib/schemas-data/3.1/core/assets/video-asset.json +7 -7
  238. package/dist/lib/schemas-data/3.1/core/assets/webhook-asset.json +7 -7
  239. package/dist/lib/schemas-data/3.1/core/assets/zip-asset.json +2 -2
  240. package/dist/lib/schemas-data/3.1/core/async-response-data.json +29 -29
  241. package/dist/lib/schemas-data/3.1/core/async-response-refs/creative/sync-creatives-async-response-input-required.json +3 -3
  242. package/dist/lib/schemas-data/3.1/core/async-response-refs/creative/sync-creatives-async-response-submitted.json +4 -4
  243. package/dist/lib/schemas-data/3.1/core/async-response-refs/creative/sync-creatives-async-response-working.json +3 -3
  244. package/dist/lib/schemas-data/3.1/core/async-response-refs/media-buy/build-creative-async-response-input-required.json +4 -4
  245. package/dist/lib/schemas-data/3.1/core/async-response-refs/media-buy/build-creative-async-response-submitted.json +4 -4
  246. package/dist/lib/schemas-data/3.1/core/async-response-refs/media-buy/build-creative-async-response-working.json +3 -3
  247. package/dist/lib/schemas-data/3.1/core/async-response-refs/media-buy/create-media-buy-async-response-input-required.json +4 -4
  248. package/dist/lib/schemas-data/3.1/core/async-response-refs/media-buy/create-media-buy-async-response-submitted.json +4 -4
  249. package/dist/lib/schemas-data/3.1/core/async-response-refs/media-buy/create-media-buy-async-response-working.json +3 -3
  250. package/dist/lib/schemas-data/3.1/core/async-response-refs/media-buy/get-products-async-response-input-required.json +4 -4
  251. package/dist/lib/schemas-data/3.1/core/async-response-refs/media-buy/get-products-async-response-submitted.json +4 -4
  252. package/dist/lib/schemas-data/3.1/core/async-response-refs/media-buy/get-products-async-response-working.json +3 -3
  253. package/dist/lib/schemas-data/3.1/core/async-response-refs/media-buy/sync-catalogs-async-response-input-required.json +3 -3
  254. package/dist/lib/schemas-data/3.1/core/async-response-refs/media-buy/sync-catalogs-async-response-submitted.json +4 -4
  255. package/dist/lib/schemas-data/3.1/core/async-response-refs/media-buy/sync-catalogs-async-response-working.json +3 -3
  256. package/dist/lib/schemas-data/3.1/core/async-response-refs/media-buy/update-media-buy-async-response-input-required.json +3 -3
  257. package/dist/lib/schemas-data/3.1/core/async-response-refs/media-buy/update-media-buy-async-response-submitted.json +4 -4
  258. package/dist/lib/schemas-data/3.1/core/async-response-refs/media-buy/update-media-buy-async-response-working.json +3 -3
  259. package/dist/lib/schemas-data/3.1/core/async-response-refs/signals/get-signals-async-response-submitted.json +4 -4
  260. package/dist/lib/schemas-data/3.1/core/async-response-refs/signals/get-signals-async-response-working.json +3 -3
  261. package/dist/lib/schemas-data/3.1/core/attribution-window.json +4 -4
  262. package/dist/lib/schemas-data/3.1/core/audience-member.json +3 -3
  263. package/dist/lib/schemas-data/3.1/core/audience-selector.json +7 -7
  264. package/dist/lib/schemas-data/3.1/core/authorized-agent-base.json +3 -3
  265. package/dist/lib/schemas-data/3.1/core/brand-id.json +1 -1
  266. package/dist/lib/schemas-data/3.1/core/brand-ref.json +3 -3
  267. package/dist/lib/schemas-data/3.1/core/business-entity.json +2 -2
  268. package/dist/lib/schemas-data/3.1/core/cancellation-policy.json +2 -2
  269. package/dist/lib/schemas-data/3.1/core/canonical-format-kind.json +1 -1
  270. package/dist/lib/schemas-data/3.1/core/canonical-projection-ref.json +3 -3
  271. package/dist/lib/schemas-data/3.1/core/canonical-projection-slot-override.json +1 -1
  272. package/dist/lib/schemas-data/3.1/core/catalog-field-mapping.json +2 -2
  273. package/dist/lib/schemas-data/3.1/core/catalog-item-delivery-metrics.json +3 -3
  274. package/dist/lib/schemas-data/3.1/core/catalog.json +7 -7
  275. package/dist/lib/schemas-data/3.1/core/catchment.json +5 -5
  276. package/dist/lib/schemas-data/3.1/core/collection-distribution.json +2 -2
  277. package/dist/lib/schemas-data/3.1/core/collection-list-ref.json +1 -1
  278. package/dist/lib/schemas-data/3.1/core/collection-selector.json +1 -1
  279. package/dist/lib/schemas-data/3.1/core/collection.json +13 -13
  280. package/dist/lib/schemas-data/3.1/core/committed-metric.json +9 -9
  281. package/dist/lib/schemas-data/3.1/core/content-rating.json +2 -2
  282. package/dist/lib/schemas-data/3.1/core/context.json +1 -1
  283. package/dist/lib/schemas-data/3.1/core/creative-asset.json +10 -10
  284. package/dist/lib/schemas-data/3.1/core/creative-assignment.json +2 -2
  285. package/dist/lib/schemas-data/3.1/core/creative-brief.json +4 -4
  286. package/dist/lib/schemas-data/3.1/core/creative-consumption.json +1 -1
  287. package/dist/lib/schemas-data/3.1/core/creative-delivery-metrics.json +2 -2
  288. package/dist/lib/schemas-data/3.1/core/creative-filters.json +5 -5
  289. package/dist/lib/schemas-data/3.1/core/creative-item.json +1 -1
  290. package/dist/lib/schemas-data/3.1/core/creative-manifest.json +11 -11
  291. package/dist/lib/schemas-data/3.1/core/creative-policy.json +3 -3
  292. package/dist/lib/schemas-data/3.1/core/creative-variable.json +1 -1
  293. package/dist/lib/schemas-data/3.1/core/creative-variant.json +5 -5
  294. package/dist/lib/schemas-data/3.1/core/data-provider-signal-selector.json +1 -1
  295. package/dist/lib/schemas-data/3.1/core/date-range.json +1 -1
  296. package/dist/lib/schemas-data/3.1/core/datetime-range.json +1 -1
  297. package/dist/lib/schemas-data/3.1/core/daypart-target.json +2 -2
  298. package/dist/lib/schemas-data/3.1/core/deadline-policy.json +1 -1
  299. package/dist/lib/schemas-data/3.1/core/delivery-forecast.json +7 -7
  300. package/dist/lib/schemas-data/3.1/core/delivery-metric-aggregate.json +9 -9
  301. package/dist/lib/schemas-data/3.1/core/delivery-metrics.json +8 -8
  302. package/dist/lib/schemas-data/3.1/core/deployment.json +3 -3
  303. package/dist/lib/schemas-data/3.1/core/destination-item.json +4 -4
  304. package/dist/lib/schemas-data/3.1/core/destination.json +1 -1
  305. package/dist/lib/schemas-data/3.1/core/diagnostic-issue.json +1 -1
  306. package/dist/lib/schemas-data/3.1/core/downstream-connection-requirement.json +1 -1
  307. package/dist/lib/schemas-data/3.1/core/duration.json +1 -1
  308. package/dist/lib/schemas-data/3.1/core/education-item.json +4 -4
  309. package/dist/lib/schemas-data/3.1/core/error.json +1 -1
  310. package/dist/lib/schemas-data/3.1/core/evaluator-spec.json +5 -5
  311. package/dist/lib/schemas-data/3.1/core/event-custom-data.json +2 -2
  312. package/dist/lib/schemas-data/3.1/core/event-source-health.json +3 -3
  313. package/dist/lib/schemas-data/3.1/core/event-surface.json +2 -2
  314. package/dist/lib/schemas-data/3.1/core/event.json +8 -8
  315. package/dist/lib/schemas-data/3.1/core/ext.json +1 -1
  316. package/dist/lib/schemas-data/3.1/core/feature-requirement.json +1 -1
  317. package/dist/lib/schemas-data/3.1/core/flight-item.json +4 -4
  318. package/dist/lib/schemas-data/3.1/core/forecast-dimension-audience.json +2 -2
  319. package/dist/lib/schemas-data/3.1/core/forecast-dimension-device-platform.json +2 -2
  320. package/dist/lib/schemas-data/3.1/core/forecast-dimension-device-type.json +2 -2
  321. package/dist/lib/schemas-data/3.1/core/forecast-dimension-geo.json +5 -5
  322. package/dist/lib/schemas-data/3.1/core/forecast-dimension-placement.json +2 -2
  323. package/dist/lib/schemas-data/3.1/core/forecast-dimension-signal.json +2 -2
  324. package/dist/lib/schemas-data/3.1/core/forecast-point-dimensions.json +7 -7
  325. package/dist/lib/schemas-data/3.1/core/forecast-point.json +27 -27
  326. package/dist/lib/schemas-data/3.1/core/forecast-range.json +1 -1
  327. package/dist/lib/schemas-data/3.1/core/forecast-vendor-metric-value.json +5 -5
  328. package/dist/lib/schemas-data/3.1/core/format-id.json +1 -1
  329. package/dist/lib/schemas-data/3.1/core/format-option-ref.json +1 -1
  330. package/dist/lib/schemas-data/3.1/core/format-shape-vocabulary.json +1 -1
  331. package/dist/lib/schemas-data/3.1/core/format.json +44 -44
  332. package/dist/lib/schemas-data/3.1/core/frequency-cap.json +4 -4
  333. package/dist/lib/schemas-data/3.1/core/generation-credential.json +3 -3
  334. package/dist/lib/schemas-data/3.1/core/geo-breakdown-support.json +3 -3
  335. package/dist/lib/schemas-data/3.1/core/geo-delivery-metrics.json +6 -6
  336. package/dist/lib/schemas-data/3.1/core/hotel-item.json +4 -4
  337. package/dist/lib/schemas-data/3.1/core/identifier.json +2 -2
  338. package/dist/lib/schemas-data/3.1/core/impairment.json +3 -3
  339. package/dist/lib/schemas-data/3.1/core/industry-identifier.json +2 -2
  340. package/dist/lib/schemas-data/3.1/core/insertion-order.json +1 -1
  341. package/dist/lib/schemas-data/3.1/core/installment-deadlines.json +2 -2
  342. package/dist/lib/schemas-data/3.1/core/installment.json +9 -9
  343. package/dist/lib/schemas-data/3.1/core/job-item.json +3 -3
  344. package/dist/lib/schemas-data/3.1/core/keyword-delivery-metrics.json +3 -3
  345. package/dist/lib/schemas-data/3.1/core/limited-series.json +1 -1
  346. package/dist/lib/schemas-data/3.1/core/material-deadline.json +1 -1
  347. package/dist/lib/schemas-data/3.1/core/mcp-webhook-payload.json +5 -5
  348. package/dist/lib/schemas-data/3.1/core/measurement-readiness.json +5 -5
  349. package/dist/lib/schemas-data/3.1/core/measurement-terms.json +3 -3
  350. package/dist/lib/schemas-data/3.1/core/measurement-window.json +1 -1
  351. package/dist/lib/schemas-data/3.1/core/media-buy-available-action.json +4 -4
  352. package/dist/lib/schemas-data/3.1/core/media-buy-features.json +2 -2
  353. package/dist/lib/schemas-data/3.1/core/media-buy.json +10 -10
  354. package/dist/lib/schemas-data/3.1/core/missing-metric.json +9 -9
  355. package/dist/lib/schemas-data/3.1/core/notification-config.json +4 -4
  356. package/dist/lib/schemas-data/3.1/core/offering-asset-group.json +16 -16
  357. package/dist/lib/schemas-data/3.1/core/offering.json +5 -5
  358. package/dist/lib/schemas-data/3.1/core/optimization-goal.json +7 -7
  359. package/dist/lib/schemas-data/3.1/core/outcome-measurement.json +2 -2
  360. package/dist/lib/schemas-data/3.1/core/overlay.json +1 -1
  361. package/dist/lib/schemas-data/3.1/core/package-signal-targeting-group.json +2 -2
  362. package/dist/lib/schemas-data/3.1/core/package-signal-targeting-groups.json +2 -2
  363. package/dist/lib/schemas-data/3.1/core/package-signal-targeting.json +3 -3
  364. package/dist/lib/schemas-data/3.1/core/package.json +17 -17
  365. package/dist/lib/schemas-data/3.1/core/pagination-request.json +1 -1
  366. package/dist/lib/schemas-data/3.1/core/pagination-response.json +1 -1
  367. package/dist/lib/schemas-data/3.1/core/performance-feedback.json +12 -12
  368. package/dist/lib/schemas-data/3.1/core/performance-standard.json +4 -4
  369. package/dist/lib/schemas-data/3.1/core/placement-definition.json +10 -10
  370. package/dist/lib/schemas-data/3.1/core/placement-ref.json +1 -1
  371. package/dist/lib/schemas-data/3.1/core/placement.json +7 -7
  372. package/dist/lib/schemas-data/3.1/core/planned-delivery.json +5 -5
  373. package/dist/lib/schemas-data/3.1/core/platform-extension-ref.json +1 -1
  374. package/dist/lib/schemas-data/3.1/core/postal-area-support.json +2 -2
  375. package/dist/lib/schemas-data/3.1/core/postal-area.json +4 -4
  376. package/dist/lib/schemas-data/3.1/core/postal-country-system.json +2 -2
  377. package/dist/lib/schemas-data/3.1/core/price.json +1 -1
  378. package/dist/lib/schemas-data/3.1/core/pricing-option.json +10 -10
  379. package/dist/lib/schemas-data/3.1/core/product-allocation.json +4 -4
  380. package/dist/lib/schemas-data/3.1/core/product-allowed-action.json +5 -5
  381. package/dist/lib/schemas-data/3.1/core/product-filters.json +27 -27
  382. package/dist/lib/schemas-data/3.1/core/product-format-declaration.json +16 -16
  383. package/dist/lib/schemas-data/3.1/core/product-signal-targeting-option.json +3 -3
  384. package/dist/lib/schemas-data/3.1/core/product.json +40 -40
  385. package/dist/lib/schemas-data/3.1/core/property-id.json +1 -1
  386. package/dist/lib/schemas-data/3.1/core/property-list-ref.json +1 -1
  387. package/dist/lib/schemas-data/3.1/core/property-tag.json +1 -1
  388. package/dist/lib/schemas-data/3.1/core/property.json +6 -6
  389. package/dist/lib/schemas-data/3.1/core/proposal.json +6 -6
  390. package/dist/lib/schemas-data/3.1/core/protocol-envelope.json +5 -5
  391. package/dist/lib/schemas-data/3.1/core/provenance.json +9 -9
  392. package/dist/lib/schemas-data/3.1/core/publisher-property-selector.json +3 -3
  393. package/dist/lib/schemas-data/3.1/core/push-notification-config.json +2 -2
  394. package/dist/lib/schemas-data/3.1/core/real-estate-item.json +4 -4
  395. package/dist/lib/schemas-data/3.1/core/reference-asset.json +1 -1
  396. package/dist/lib/schemas-data/3.1/core/registry-event.json +14 -14
  397. package/dist/lib/schemas-data/3.1/core/registry-feed-response.json +2 -2
  398. package/dist/lib/schemas-data/3.1/core/reporting-capabilities.json +8 -8
  399. package/dist/lib/schemas-data/3.1/core/reporting-webhook.json +3 -3
  400. package/dist/lib/schemas-data/3.1/core/requirements/asset-requirements.json +13 -13
  401. package/dist/lib/schemas-data/3.1/core/requirements/audio-asset-requirements.json +1 -1
  402. package/dist/lib/schemas-data/3.1/core/requirements/catalog-field-binding.json +4 -4
  403. package/dist/lib/schemas-data/3.1/core/requirements/catalog-requirements.json +5 -5
  404. package/dist/lib/schemas-data/3.1/core/requirements/css-asset-requirements.json +1 -1
  405. package/dist/lib/schemas-data/3.1/core/requirements/daast-asset-requirements.json +1 -1
  406. package/dist/lib/schemas-data/3.1/core/requirements/html-asset-requirements.json +1 -1
  407. package/dist/lib/schemas-data/3.1/core/requirements/image-asset-requirements.json +2 -2
  408. package/dist/lib/schemas-data/3.1/core/requirements/javascript-asset-requirements.json +1 -1
  409. package/dist/lib/schemas-data/3.1/core/requirements/markdown-asset-requirements.json +1 -1
  410. package/dist/lib/schemas-data/3.1/core/requirements/offering-asset-constraint.json +4 -4
  411. package/dist/lib/schemas-data/3.1/core/requirements/text-asset-requirements.json +1 -1
  412. package/dist/lib/schemas-data/3.1/core/requirements/url-asset-requirements.json +1 -1
  413. package/dist/lib/schemas-data/3.1/core/requirements/vast-asset-requirements.json +1 -1
  414. package/dist/lib/schemas-data/3.1/core/requirements/video-asset-requirements.json +6 -6
  415. package/dist/lib/schemas-data/3.1/core/requirements/webhook-asset-requirements.json +1 -1
  416. package/dist/lib/schemas-data/3.1/core/response-payload-jws-envelope.json +1 -1
  417. package/dist/lib/schemas-data/3.1/core/response.json +1 -1
  418. package/dist/lib/schemas-data/3.1/core/rights-constraint.json +4 -4
  419. package/dist/lib/schemas-data/3.1/core/seller-agent-ref.json +1 -1
  420. package/dist/lib/schemas-data/3.1/core/signal-coverage-forecast.json +5 -5
  421. package/dist/lib/schemas-data/3.1/core/signal-definition-enrichment.json +4 -4
  422. package/dist/lib/schemas-data/3.1/core/signal-definition.json +5 -5
  423. package/dist/lib/schemas-data/3.1/core/signal-filters.json +3 -3
  424. package/dist/lib/schemas-data/3.1/core/signal-id.json +1 -1
  425. package/dist/lib/schemas-data/3.1/core/signal-listing.json +4 -4
  426. package/dist/lib/schemas-data/3.1/core/signal-modeling-disclosure.json +1 -1
  427. package/dist/lib/schemas-data/3.1/core/signal-pricing-option.json +2 -2
  428. package/dist/lib/schemas-data/3.1/core/signal-pricing.json +6 -6
  429. package/dist/lib/schemas-data/3.1/core/signal-ref.json +1 -1
  430. package/dist/lib/schemas-data/3.1/core/signal-selection-group-rule.json +1 -1
  431. package/dist/lib/schemas-data/3.1/core/signal-targeting-expression.json +4 -4
  432. package/dist/lib/schemas-data/3.1/core/signal-targeting-rules.json +2 -2
  433. package/dist/lib/schemas-data/3.1/core/signal-targeting.json +7 -7
  434. package/dist/lib/schemas-data/3.1/core/sla-window.json +1 -1
  435. package/dist/lib/schemas-data/3.1/core/special.json +2 -2
  436. package/dist/lib/schemas-data/3.1/core/start-timing.json +1 -1
  437. package/dist/lib/schemas-data/3.1/core/store-item.json +3 -3
  438. package/dist/lib/schemas-data/3.1/core/talent.json +2 -2
  439. package/dist/lib/schemas-data/3.1/core/targeting.json +22 -22
  440. package/dist/lib/schemas-data/3.1/core/tasks-get-request.json +5 -5
  441. package/dist/lib/schemas-data/3.1/core/tasks-get-response.json +10 -10
  442. package/dist/lib/schemas-data/3.1/core/tasks-list-request.json +13 -13
  443. package/dist/lib/schemas-data/3.1/core/tasks-list-response.json +8 -8
  444. package/dist/lib/schemas-data/3.1/core/transformer-param.json +1 -1
  445. package/dist/lib/schemas-data/3.1/core/transformer.json +5 -5
  446. package/dist/lib/schemas-data/3.1/core/truncation-sentinel.json +1 -1
  447. package/dist/lib/schemas-data/3.1/core/user-match.json +3 -3
  448. package/dist/lib/schemas-data/3.1/core/vehicle-item.json +4 -4
  449. package/dist/lib/schemas-data/3.1/core/vendor-metric-id.json +1 -1
  450. package/dist/lib/schemas-data/3.1/core/vendor-metric-optimization-supported-metric.json +3 -3
  451. package/dist/lib/schemas-data/3.1/core/vendor-metric-optimization.json +2 -2
  452. package/dist/lib/schemas-data/3.1/core/vendor-metric-value.json +3 -3
  453. package/dist/lib/schemas-data/3.1/core/vendor-pricing-option.json +3 -3
  454. package/dist/lib/schemas-data/3.1/core/version-envelope.json +1 -1
  455. package/dist/lib/schemas-data/3.1/core/webhook-activity-record.json +3 -3
  456. package/dist/lib/schemas-data/3.1/core/webhook-challenge-response.json +1 -1
  457. package/dist/lib/schemas-data/3.1/core/webhook-challenge.json +2 -2
  458. package/dist/lib/schemas-data/3.1/core/wholesale-feed-event.json +17 -17
  459. package/dist/lib/schemas-data/3.1/core/wholesale-feed-webhook.json +3 -3
  460. package/dist/lib/schemas-data/3.1/core/x-entity-types.json +1 -1
  461. package/dist/lib/schemas-data/3.1/creative/asset-types/index.json +6 -6
  462. package/dist/lib/schemas-data/3.1/creative/audit-observation.json +2 -2
  463. package/dist/lib/schemas-data/3.1/creative/creative-feature-result.json +2 -2
  464. package/dist/lib/schemas-data/3.1/creative/creative-purged-webhook.json +3 -3
  465. package/dist/lib/schemas-data/3.1/creative/creative-status-changed-webhook.json +4 -4
  466. package/dist/lib/schemas-data/3.1/creative/get-creative-delivery-request.json +6 -6
  467. package/dist/lib/schemas-data/3.1/creative/get-creative-delivery-response.json +9 -9
  468. package/dist/lib/schemas-data/3.1/creative/get-creative-features-request.json +6 -6
  469. package/dist/lib/schemas-data/3.1/creative/get-creative-features-response.json +11 -11
  470. package/dist/lib/schemas-data/3.1/creative/list-creative-formats-request.json +13 -13
  471. package/dist/lib/schemas-data/3.1/creative/list-creative-formats-response.json +9 -9
  472. package/dist/lib/schemas-data/3.1/creative/list-creatives-request.json +9 -9
  473. package/dist/lib/schemas-data/3.1/creative/list-creatives-response.json +21 -21
  474. package/dist/lib/schemas-data/3.1/creative/list-transformers-request.json +8 -8
  475. package/dist/lib/schemas-data/3.1/creative/list-transformers-response.json +8 -8
  476. package/dist/lib/schemas-data/3.1/creative/preview-creative-request.json +12 -12
  477. package/dist/lib/schemas-data/3.1/creative/preview-creative-response.json +14 -14
  478. package/dist/lib/schemas-data/3.1/creative/preview-render.json +1 -1
  479. package/dist/lib/schemas-data/3.1/creative/sync-creatives-async-response-input-required.json +3 -3
  480. package/dist/lib/schemas-data/3.1/creative/sync-creatives-async-response-submitted.json +4 -4
  481. package/dist/lib/schemas-data/3.1/creative/sync-creatives-async-response-working.json +3 -3
  482. package/dist/lib/schemas-data/3.1/creative/sync-creatives-request.json +8 -8
  483. package/dist/lib/schemas-data/3.1/creative/sync-creatives-response.json +15 -15
  484. package/dist/lib/schemas-data/3.1/creative/validate-input-request.json +4 -4
  485. package/dist/lib/schemas-data/3.1/creative/validate-input-response.json +4 -4
  486. package/dist/lib/schemas-data/3.1/creative/validate-input-result.json +1 -1
  487. package/dist/lib/schemas-data/3.1/creative/video-brief.json +1 -1
  488. package/dist/lib/schemas-data/3.1/enums/account-scope.json +1 -1
  489. package/dist/lib/schemas-data/3.1/enums/account-status.json +1 -1
  490. package/dist/lib/schemas-data/3.1/enums/action-not-allowed-reason.json +1 -1
  491. package/dist/lib/schemas-data/3.1/enums/action-source.json +1 -1
  492. package/dist/lib/schemas-data/3.1/enums/adcp-protocol.json +1 -1
  493. package/dist/lib/schemas-data/3.1/enums/adjustment-kind.json +1 -1
  494. package/dist/lib/schemas-data/3.1/enums/advertiser-industry.json +1 -1
  495. package/dist/lib/schemas-data/3.1/enums/age-verification-method.json +1 -1
  496. package/dist/lib/schemas-data/3.1/enums/assessment-status.json +1 -1
  497. package/dist/lib/schemas-data/3.1/enums/asset-content-type.json +1 -1
  498. package/dist/lib/schemas-data/3.1/enums/attestation-claim.json +1 -1
  499. package/dist/lib/schemas-data/3.1/enums/attribution-methodology.json +1 -1
  500. package/dist/lib/schemas-data/3.1/enums/attribution-model.json +1 -1
  501. package/dist/lib/schemas-data/3.1/enums/audience-source.json +1 -1
  502. package/dist/lib/schemas-data/3.1/enums/audience-status.json +1 -1
  503. package/dist/lib/schemas-data/3.1/enums/audio-channel-layout.json +1 -1
  504. package/dist/lib/schemas-data/3.1/enums/audio-distribution-type.json +1 -1
  505. package/dist/lib/schemas-data/3.1/enums/auth-scheme.json +1 -1
  506. package/dist/lib/schemas-data/3.1/enums/available-metric.json +1 -1
  507. package/dist/lib/schemas-data/3.1/enums/billing-party.json +1 -1
  508. package/dist/lib/schemas-data/3.1/enums/binary-verdict.json +1 -1
  509. package/dist/lib/schemas-data/3.1/enums/brand-agent-type.json +1 -1
  510. package/dist/lib/schemas-data/3.1/enums/c2pa-watermark-action.json +1 -1
  511. package/dist/lib/schemas-data/3.1/enums/canceled-by.json +1 -1
  512. package/dist/lib/schemas-data/3.1/enums/catalog-action.json +1 -1
  513. package/dist/lib/schemas-data/3.1/enums/catalog-item-status.json +1 -1
  514. package/dist/lib/schemas-data/3.1/enums/catalog-type.json +1 -1
  515. package/dist/lib/schemas-data/3.1/enums/channels.json +1 -1
  516. package/dist/lib/schemas-data/3.1/enums/cloud-storage-protocol.json +1 -1
  517. package/dist/lib/schemas-data/3.1/enums/co-branding-requirement.json +1 -1
  518. package/dist/lib/schemas-data/3.1/enums/collection-cadence.json +1 -1
  519. package/dist/lib/schemas-data/3.1/enums/collection-kind.json +1 -1
  520. package/dist/lib/schemas-data/3.1/enums/collection-relationship.json +1 -1
  521. package/dist/lib/schemas-data/3.1/enums/collection-status.json +1 -1
  522. package/dist/lib/schemas-data/3.1/enums/completion-source.json +1 -1
  523. package/dist/lib/schemas-data/3.1/enums/consent-basis.json +1 -1
  524. package/dist/lib/schemas-data/3.1/enums/content-id-type.json +1 -1
  525. package/dist/lib/schemas-data/3.1/enums/content-rating-system.json +1 -1
  526. package/dist/lib/schemas-data/3.1/enums/creative-action.json +1 -1
  527. package/dist/lib/schemas-data/3.1/enums/creative-agent-capability.json +1 -1
  528. package/dist/lib/schemas-data/3.1/enums/creative-approval-status.json +1 -1
  529. package/dist/lib/schemas-data/3.1/enums/creative-event-reason-code.json +1 -1
  530. package/dist/lib/schemas-data/3.1/enums/creative-identifier-type.json +1 -1
  531. package/dist/lib/schemas-data/3.1/enums/creative-quality.json +1 -1
  532. package/dist/lib/schemas-data/3.1/enums/creative-selection-strategy.json +1 -1
  533. package/dist/lib/schemas-data/3.1/enums/creative-sort-field.json +1 -1
  534. package/dist/lib/schemas-data/3.1/enums/creative-status.json +1 -1
  535. package/dist/lib/schemas-data/3.1/enums/daast-tracking-event.json +1 -1
  536. package/dist/lib/schemas-data/3.1/enums/daast-version.json +1 -1
  537. package/dist/lib/schemas-data/3.1/enums/day-of-week.json +1 -1
  538. package/dist/lib/schemas-data/3.1/enums/delegation-authority.json +1 -1
  539. package/dist/lib/schemas-data/3.1/enums/delivery-type.json +1 -1
  540. package/dist/lib/schemas-data/3.1/enums/demographic-system.json +1 -1
  541. package/dist/lib/schemas-data/3.1/enums/derivative-type.json +1 -1
  542. package/dist/lib/schemas-data/3.1/enums/device-platform.json +1 -1
  543. package/dist/lib/schemas-data/3.1/enums/device-type.json +1 -1
  544. package/dist/lib/schemas-data/3.1/enums/digital-source-type.json +1 -1
  545. package/dist/lib/schemas-data/3.1/enums/dimension-unit.json +1 -1
  546. package/dist/lib/schemas-data/3.1/enums/disclosure-persistence.json +1 -1
  547. package/dist/lib/schemas-data/3.1/enums/disclosure-position.json +1 -1
  548. package/dist/lib/schemas-data/3.1/enums/distance-unit.json +1 -1
  549. package/dist/lib/schemas-data/3.1/enums/distribution-identifier-type.json +1 -1
  550. package/dist/lib/schemas-data/3.1/enums/embedded-provenance-method.json +1 -1
  551. package/dist/lib/schemas-data/3.1/enums/error-code.json +1 -1
  552. package/dist/lib/schemas-data/3.1/enums/error-scope.json +1 -1
  553. package/dist/lib/schemas-data/3.1/enums/escalation-severity.json +1 -1
  554. package/dist/lib/schemas-data/3.1/enums/event-type.json +1 -1
  555. package/dist/lib/schemas-data/3.1/enums/exclusivity.json +1 -1
  556. package/dist/lib/schemas-data/3.1/enums/feature-check-status.json +1 -1
  557. package/dist/lib/schemas-data/3.1/enums/feed-format.json +1 -1
  558. package/dist/lib/schemas-data/3.1/enums/feedback-source.json +1 -1
  559. package/dist/lib/schemas-data/3.1/enums/forecast-method.json +1 -1
  560. package/dist/lib/schemas-data/3.1/enums/forecast-range-unit.json +1 -1
  561. package/dist/lib/schemas-data/3.1/enums/forecastable-metric.json +1 -1
  562. package/dist/lib/schemas-data/3.1/enums/format-id-parameter.json +1 -1
  563. package/dist/lib/schemas-data/3.1/enums/frame-rate-type.json +1 -1
  564. package/dist/lib/schemas-data/3.1/enums/frequency-cap-scope.json +1 -1
  565. package/dist/lib/schemas-data/3.1/enums/genre-taxonomy.json +3 -3
  566. package/dist/lib/schemas-data/3.1/enums/geo-level.json +1 -1
  567. package/dist/lib/schemas-data/3.1/enums/gop-type.json +1 -1
  568. package/dist/lib/schemas-data/3.1/enums/governance-decision.json +1 -1
  569. package/dist/lib/schemas-data/3.1/enums/governance-domain.json +1 -1
  570. package/dist/lib/schemas-data/3.1/enums/governance-mode.json +1 -1
  571. package/dist/lib/schemas-data/3.1/enums/governance-phase.json +1 -1
  572. package/dist/lib/schemas-data/3.1/enums/history-entry-type.json +1 -1
  573. package/dist/lib/schemas-data/3.1/enums/http-method.json +1 -1
  574. package/dist/lib/schemas-data/3.1/enums/identifier-types.json +1 -1
  575. package/dist/lib/schemas-data/3.1/enums/impairment-offline-state.json +1 -1
  576. package/dist/lib/schemas-data/3.1/enums/impairment-reason-code.json +1 -1
  577. package/dist/lib/schemas-data/3.1/enums/installment-status.json +1 -1
  578. package/dist/lib/schemas-data/3.1/enums/javascript-module-type.json +1 -1
  579. package/dist/lib/schemas-data/3.1/enums/landing-page-requirement.json +1 -1
  580. package/dist/lib/schemas-data/3.1/enums/legacy-postal-system.json +1 -1
  581. package/dist/lib/schemas-data/3.1/enums/lift-dimension.json +1 -1
  582. package/dist/lib/schemas-data/3.1/enums/logo-slot.json +1 -1
  583. package/dist/lib/schemas-data/3.1/enums/makegood-remedy.json +1 -1
  584. package/dist/lib/schemas-data/3.1/enums/markdown-flavor.json +1 -1
  585. package/dist/lib/schemas-data/3.1/enums/match-id-type.json +3 -3
  586. package/dist/lib/schemas-data/3.1/enums/match-type.json +1 -1
  587. package/dist/lib/schemas-data/3.1/enums/media-buy-action-mode.json +1 -1
  588. package/dist/lib/schemas-data/3.1/enums/media-buy-health.json +1 -1
  589. package/dist/lib/schemas-data/3.1/enums/media-buy-status.json +1 -1
  590. package/dist/lib/schemas-data/3.1/enums/media-buy-valid-action.json +1 -1
  591. package/dist/lib/schemas-data/3.1/enums/metric-scope.json +1 -1
  592. package/dist/lib/schemas-data/3.1/enums/metric-type.json +1 -1
  593. package/dist/lib/schemas-data/3.1/enums/metro-system.json +1 -1
  594. package/dist/lib/schemas-data/3.1/enums/moov-atom-position.json +1 -1
  595. package/dist/lib/schemas-data/3.1/enums/notification-type.json +1 -1
  596. package/dist/lib/schemas-data/3.1/enums/offering-availability-status.json +1 -1
  597. package/dist/lib/schemas-data/3.1/enums/outcome-type.json +1 -1
  598. package/dist/lib/schemas-data/3.1/enums/pacing.json +1 -1
  599. package/dist/lib/schemas-data/3.1/enums/payment-terms.json +1 -1
  600. package/dist/lib/schemas-data/3.1/enums/performance-standard-metric.json +1 -1
  601. package/dist/lib/schemas-data/3.1/enums/policy-category.json +1 -1
  602. package/dist/lib/schemas-data/3.1/enums/policy-enforcement.json +1 -1
  603. package/dist/lib/schemas-data/3.1/enums/postal-system.json +1 -1
  604. package/dist/lib/schemas-data/3.1/enums/preview-output-format.json +1 -1
  605. package/dist/lib/schemas-data/3.1/enums/pricing-model.json +1 -1
  606. package/dist/lib/schemas-data/3.1/enums/production-quality.json +1 -1
  607. package/dist/lib/schemas-data/3.1/enums/property-type.json +1 -1
  608. package/dist/lib/schemas-data/3.1/enums/proposal-status.json +1 -1
  609. package/dist/lib/schemas-data/3.1/enums/publisher-identifier-types.json +1 -1
  610. package/dist/lib/schemas-data/3.1/enums/purchase-type.json +1 -1
  611. package/dist/lib/schemas-data/3.1/enums/reach-unit.json +1 -1
  612. package/dist/lib/schemas-data/3.1/enums/reporting-frequency.json +1 -1
  613. package/dist/lib/schemas-data/3.1/enums/response-type.json +1 -1
  614. package/dist/lib/schemas-data/3.1/enums/restricted-attribute.json +1 -1
  615. package/dist/lib/schemas-data/3.1/enums/right-type.json +1 -1
  616. package/dist/lib/schemas-data/3.1/enums/right-use.json +1 -1
  617. package/dist/lib/schemas-data/3.1/enums/rights-billing-period.json +1 -1
  618. package/dist/lib/schemas-data/3.1/enums/scan-type.json +1 -1
  619. package/dist/lib/schemas-data/3.1/enums/si-session-status.json +1 -1
  620. package/dist/lib/schemas-data/3.1/enums/signal-catalog-type.json +1 -1
  621. package/dist/lib/schemas-data/3.1/enums/signal-source.json +1 -1
  622. package/dist/lib/schemas-data/3.1/enums/signal-value-type.json +1 -1
  623. package/dist/lib/schemas-data/3.1/enums/snapshot-unavailable-reason.json +1 -1
  624. package/dist/lib/schemas-data/3.1/enums/social-placement-surface.json +1 -1
  625. package/dist/lib/schemas-data/3.1/enums/sort-direction.json +1 -1
  626. package/dist/lib/schemas-data/3.1/enums/sort-metric.json +1 -1
  627. package/dist/lib/schemas-data/3.1/enums/special-category.json +1 -1
  628. package/dist/lib/schemas-data/3.1/enums/specialism.json +1 -1
  629. package/dist/lib/schemas-data/3.1/enums/sponsored-placement-type.json +1 -1
  630. package/dist/lib/schemas-data/3.1/enums/talent-role.json +1 -1
  631. package/dist/lib/schemas-data/3.1/enums/task-status.json +1 -1
  632. package/dist/lib/schemas-data/3.1/enums/task-type.json +1 -1
  633. package/dist/lib/schemas-data/3.1/enums/transport-mode.json +1 -1
  634. package/dist/lib/schemas-data/3.1/enums/travel-time-unit.json +1 -1
  635. package/dist/lib/schemas-data/3.1/enums/uid-type.json +3 -3
  636. package/dist/lib/schemas-data/3.1/enums/universal-macro.json +1 -1
  637. package/dist/lib/schemas-data/3.1/enums/update-frequency.json +1 -1
  638. package/dist/lib/schemas-data/3.1/enums/url-asset-type.json +1 -1
  639. package/dist/lib/schemas-data/3.1/enums/validation-mode.json +1 -1
  640. package/dist/lib/schemas-data/3.1/enums/vast-tracking-event.json +1 -1
  641. package/dist/lib/schemas-data/3.1/enums/vast-version.json +1 -1
  642. package/dist/lib/schemas-data/3.1/enums/video-placement-type.json +1 -1
  643. package/dist/lib/schemas-data/3.1/enums/viewability-standard.json +1 -1
  644. package/dist/lib/schemas-data/3.1/enums/watermark-media-type.json +1 -1
  645. package/dist/lib/schemas-data/3.1/enums/wcag-level.json +1 -1
  646. package/dist/lib/schemas-data/3.1/enums/webhook-response-type.json +1 -1
  647. package/dist/lib/schemas-data/3.1/enums/webhook-security-method.json +1 -1
  648. package/dist/lib/schemas-data/3.1/error-details/account-setup-required.json +1 -1
  649. package/dist/lib/schemas-data/3.1/error-details/action-not-allowed.json +4 -4
  650. package/dist/lib/schemas-data/3.1/error-details/agent-permission-denied.json +1 -1
  651. package/dist/lib/schemas-data/3.1/error-details/audience-too-small.json +1 -1
  652. package/dist/lib/schemas-data/3.1/error-details/authorization-required.json +3 -3
  653. package/dist/lib/schemas-data/3.1/error-details/billing-not-permitted-for-agent.json +3 -3
  654. package/dist/lib/schemas-data/3.1/error-details/billing-not-supported.json +2 -2
  655. package/dist/lib/schemas-data/3.1/error-details/budget-too-low.json +1 -1
  656. package/dist/lib/schemas-data/3.1/error-details/conflict.json +1 -1
  657. package/dist/lib/schemas-data/3.1/error-details/creative-rejected.json +1 -1
  658. package/dist/lib/schemas-data/3.1/error-details/policy-violation.json +1 -1
  659. package/dist/lib/schemas-data/3.1/error-details/rate-limited.json +1 -1
  660. package/dist/lib/schemas-data/3.1/error-details/stale-response.json +1 -1
  661. package/dist/lib/schemas-data/3.1/error-details/vendor-error-codes.json +1 -1
  662. package/dist/lib/schemas-data/3.1/error-details/version-unsupported.json +2 -2
  663. package/dist/lib/schemas-data/3.1/extensions/extension-meta.json +1 -1
  664. package/dist/lib/schemas-data/3.1/extensions/index.json +2 -2
  665. package/dist/lib/schemas-data/3.1/formats/canonical/_base.json +5 -5
  666. package/dist/lib/schemas-data/3.1/formats/canonical/agent_placement.json +2 -2
  667. package/dist/lib/schemas-data/3.1/formats/canonical/audio_daast.json +2 -2
  668. package/dist/lib/schemas-data/3.1/formats/canonical/audio_hosted.json +2 -2
  669. package/dist/lib/schemas-data/3.1/formats/canonical/display_tag.json +2 -2
  670. package/dist/lib/schemas-data/3.1/formats/canonical/html5.json +2 -2
  671. package/dist/lib/schemas-data/3.1/formats/canonical/image.json +2 -2
  672. package/dist/lib/schemas-data/3.1/formats/canonical/image_carousel.json +2 -2
  673. package/dist/lib/schemas-data/3.1/formats/canonical/native_in_feed.json +2 -2
  674. package/dist/lib/schemas-data/3.1/formats/canonical/responsive_creative.json +2 -2
  675. package/dist/lib/schemas-data/3.1/formats/canonical/sponsored_placement.json +3 -3
  676. package/dist/lib/schemas-data/3.1/formats/canonical/video_hosted.json +2 -2
  677. package/dist/lib/schemas-data/3.1/formats/canonical/video_vast.json +2 -2
  678. package/dist/lib/schemas-data/3.1/governance/attribute-definition.json +1 -1
  679. package/dist/lib/schemas-data/3.1/governance/audience-constraints.json +3 -3
  680. package/dist/lib/schemas-data/3.1/governance/check-governance-request.json +8 -8
  681. package/dist/lib/schemas-data/3.1/governance/check-governance-response.json +7 -7
  682. package/dist/lib/schemas-data/3.1/governance/get-plan-audit-logs-request.json +5 -5
  683. package/dist/lib/schemas-data/3.1/governance/get-plan-audit-logs-response.json +11 -11
  684. package/dist/lib/schemas-data/3.1/governance/policy-category-definition.json +2 -2
  685. package/dist/lib/schemas-data/3.1/governance/policy-entry.json +6 -6
  686. package/dist/lib/schemas-data/3.1/governance/policy-ref.json +1 -1
  687. package/dist/lib/schemas-data/3.1/governance/report-plan-outcome-request.json +7 -7
  688. package/dist/lib/schemas-data/3.1/governance/report-plan-outcome-response.json +5 -5
  689. package/dist/lib/schemas-data/3.1/governance/sync-plans-request.json +14 -14
  690. package/dist/lib/schemas-data/3.1/governance/sync-plans-response.json +6 -6
  691. package/dist/lib/schemas-data/3.1/index.json +443 -443
  692. package/dist/lib/schemas-data/3.1/manifest.json +7 -3
  693. package/dist/lib/schemas-data/3.1/manifest.schema.json +1 -1
  694. package/dist/lib/schemas-data/3.1/media-buy/build-creative-async-response-input-required.json +4 -4
  695. package/dist/lib/schemas-data/3.1/media-buy/build-creative-async-response-submitted.json +4 -4
  696. package/dist/lib/schemas-data/3.1/media-buy/build-creative-async-response-working.json +3 -3
  697. package/dist/lib/schemas-data/3.1/media-buy/build-creative-request.json +16 -16
  698. package/dist/lib/schemas-data/3.1/media-buy/build-creative-response.json +35 -35
  699. package/dist/lib/schemas-data/3.1/media-buy/create-media-buy-async-response-input-required.json +4 -4
  700. package/dist/lib/schemas-data/3.1/media-buy/create-media-buy-async-response-submitted.json +4 -4
  701. package/dist/lib/schemas-data/3.1/media-buy/create-media-buy-async-response-working.json +3 -3
  702. package/dist/lib/schemas-data/3.1/media-buy/create-media-buy-request.json +13 -13
  703. package/dist/lib/schemas-data/3.1/media-buy/create-media-buy-response.json +19 -19
  704. package/dist/lib/schemas-data/3.1/media-buy/get-media-buy-delivery-request.json +23 -23
  705. package/dist/lib/schemas-data/3.1/media-buy/get-media-buy-delivery-response.json +27 -27
  706. package/dist/lib/schemas-data/3.1/media-buy/get-media-buys-request.json +8 -8
  707. package/dist/lib/schemas-data/3.1/media-buy/get-media-buys-response.json +30 -30
  708. package/dist/lib/schemas-data/3.1/media-buy/get-products-async-response-input-required.json +4 -4
  709. package/dist/lib/schemas-data/3.1/media-buy/get-products-async-response-submitted.json +4 -4
  710. package/dist/lib/schemas-data/3.1/media-buy/get-products-async-response-working.json +3 -3
  711. package/dist/lib/schemas-data/3.1/media-buy/get-products-request.json +13 -13
  712. package/dist/lib/schemas-data/3.1/media-buy/get-products-response.json +10 -10
  713. package/dist/lib/schemas-data/3.1/media-buy/list-creative-formats-request.json +13 -13
  714. package/dist/lib/schemas-data/3.1/media-buy/list-creative-formats-response.json +9 -9
  715. package/dist/lib/schemas-data/3.1/media-buy/log-event-request.json +5 -5
  716. package/dist/lib/schemas-data/3.1/media-buy/log-event-response.json +8 -8
  717. package/dist/lib/schemas-data/3.1/media-buy/media-buy-delivery-webhook-result.json +9 -9
  718. package/dist/lib/schemas-data/3.1/media-buy/package-request.json +23 -23
  719. package/dist/lib/schemas-data/3.1/media-buy/package-update.json +13 -13
  720. package/dist/lib/schemas-data/3.1/media-buy/provide-performance-feedback-request.json +7 -7
  721. package/dist/lib/schemas-data/3.1/media-buy/provide-performance-feedback-response.json +8 -8
  722. package/dist/lib/schemas-data/3.1/media-buy/sync-audiences-request.json +8 -8
  723. package/dist/lib/schemas-data/3.1/media-buy/sync-audiences-response.json +14 -14
  724. package/dist/lib/schemas-data/3.1/media-buy/sync-catalogs-async-response-input-required.json +3 -3
  725. package/dist/lib/schemas-data/3.1/media-buy/sync-catalogs-async-response-submitted.json +4 -4
  726. package/dist/lib/schemas-data/3.1/media-buy/sync-catalogs-async-response-working.json +3 -3
  727. package/dist/lib/schemas-data/3.1/media-buy/sync-catalogs-request.json +8 -8
  728. package/dist/lib/schemas-data/3.1/media-buy/sync-catalogs-response.json +14 -14
  729. package/dist/lib/schemas-data/3.1/media-buy/sync-event-sources-request.json +8 -8
  730. package/dist/lib/schemas-data/3.1/media-buy/sync-event-sources-response.json +14 -14
  731. package/dist/lib/schemas-data/3.1/media-buy/update-media-buy-async-response-input-required.json +3 -3
  732. package/dist/lib/schemas-data/3.1/media-buy/update-media-buy-async-response-submitted.json +4 -4
  733. package/dist/lib/schemas-data/3.1/media-buy/update-media-buy-async-response-working.json +3 -3
  734. package/dist/lib/schemas-data/3.1/media-buy/update-media-buy-request.json +11 -11
  735. package/dist/lib/schemas-data/3.1/media-buy/update-media-buy-response.json +17 -17
  736. package/dist/lib/schemas-data/3.1/pricing-options/cpa-option.json +4 -4
  737. package/dist/lib/schemas-data/3.1/pricing-options/cpc-option.json +4 -4
  738. package/dist/lib/schemas-data/3.1/pricing-options/cpcv-option.json +4 -4
  739. package/dist/lib/schemas-data/3.1/pricing-options/cpm-option.json +4 -4
  740. package/dist/lib/schemas-data/3.1/pricing-options/cpp-option.json +5 -5
  741. package/dist/lib/schemas-data/3.1/pricing-options/cpv-option.json +4 -4
  742. package/dist/lib/schemas-data/3.1/pricing-options/flat-rate-option.json +4 -4
  743. package/dist/lib/schemas-data/3.1/pricing-options/price-breakdown.json +2 -2
  744. package/dist/lib/schemas-data/3.1/pricing-options/price-guidance.json +1 -1
  745. package/dist/lib/schemas-data/3.1/pricing-options/time-option.json +4 -4
  746. package/dist/lib/schemas-data/3.1/pricing-options/vcpm-option.json +4 -4
  747. package/dist/lib/schemas-data/3.1/property/authorization-result.json +1 -1
  748. package/dist/lib/schemas-data/3.1/property/base-property-source.json +4 -4
  749. package/dist/lib/schemas-data/3.1/property/create-property-list-request.json +8 -8
  750. package/dist/lib/schemas-data/3.1/property/create-property-list-response.json +6 -6
  751. package/dist/lib/schemas-data/3.1/property/delete-property-list-request.json +5 -5
  752. package/dist/lib/schemas-data/3.1/property/delete-property-list-response.json +5 -5
  753. package/dist/lib/schemas-data/3.1/property/delivery-record.json +3 -3
  754. package/dist/lib/schemas-data/3.1/property/get-property-list-request.json +5 -5
  755. package/dist/lib/schemas-data/3.1/property/get-property-list-response.json +9 -9
  756. package/dist/lib/schemas-data/3.1/property/list-property-lists-request.json +6 -6
  757. package/dist/lib/schemas-data/3.1/property/list-property-lists-response.json +7 -7
  758. package/dist/lib/schemas-data/3.1/property/property-error.json +2 -2
  759. package/dist/lib/schemas-data/3.1/property/property-feature-definition.json +2 -2
  760. package/dist/lib/schemas-data/3.1/property/property-feature-result.json +4 -4
  761. package/dist/lib/schemas-data/3.1/property/property-feature-value.json +2 -2
  762. package/dist/lib/schemas-data/3.1/property/property-feature.json +1 -1
  763. package/dist/lib/schemas-data/3.1/property/property-list-changed-webhook.json +2 -2
  764. package/dist/lib/schemas-data/3.1/property/property-list-filters.json +5 -5
  765. package/dist/lib/schemas-data/3.1/property/property-list.json +6 -6
  766. package/dist/lib/schemas-data/3.1/property/update-property-list-request.json +8 -8
  767. package/dist/lib/schemas-data/3.1/property/update-property-list-response.json +6 -6
  768. package/dist/lib/schemas-data/3.1/property/validate-property-delivery-request.json +6 -6
  769. package/dist/lib/schemas-data/3.1/property/validate-property-delivery-response.json +6 -6
  770. package/dist/lib/schemas-data/3.1/property/validation-result.json +5 -5
  771. package/dist/lib/schemas-data/3.1/protocol/get-adcp-capabilities-request.json +4 -4
  772. package/dist/lib/schemas-data/3.1/protocol/get-adcp-capabilities-response.json +34 -34
  773. package/dist/lib/schemas-data/3.1/protocol/get-task-status-request.json +5 -5
  774. package/dist/lib/schemas-data/3.1/protocol/get-task-status-response.json +10 -10
  775. package/dist/lib/schemas-data/3.1/protocol/list-tasks-request.json +13 -13
  776. package/dist/lib/schemas-data/3.1/protocol/list-tasks-response.json +8 -8
  777. package/dist/lib/schemas-data/3.1/registries/v1-canonical-mapping.json +2 -2
  778. package/dist/lib/schemas-data/3.1/signals/activate-signal-request.json +6 -6
  779. package/dist/lib/schemas-data/3.1/signals/activate-signal-response.json +9 -9
  780. package/dist/lib/schemas-data/3.1/signals/get-signals-async-response-submitted.json +4 -4
  781. package/dist/lib/schemas-data/3.1/signals/get-signals-async-response-working.json +3 -3
  782. package/dist/lib/schemas-data/3.1/signals/get-signals-request.json +11 -11
  783. package/dist/lib/schemas-data/3.1/signals/get-signals-response.json +17 -17
  784. package/dist/lib/schemas-data/3.1/sponsored-intelligence/si-capabilities.json +1 -1
  785. package/dist/lib/schemas-data/3.1/sponsored-intelligence/si-context-use.json +1 -1
  786. package/dist/lib/schemas-data/3.1/sponsored-intelligence/si-get-offering-request.json +4 -4
  787. package/dist/lib/schemas-data/3.1/sponsored-intelligence/si-get-offering-response.json +9 -9
  788. package/dist/lib/schemas-data/3.1/sponsored-intelligence/si-identity.json +1 -1
  789. package/dist/lib/schemas-data/3.1/sponsored-intelligence/si-initiate-session-request.json +7 -7
  790. package/dist/lib/schemas-data/3.1/sponsored-intelligence/si-initiate-session-response.json +10 -10
  791. package/dist/lib/schemas-data/3.1/sponsored-intelligence/si-send-message-request.json +5 -5
  792. package/dist/lib/schemas-data/3.1/sponsored-intelligence/si-send-message-response.json +10 -10
  793. package/dist/lib/schemas-data/3.1/sponsored-intelligence/si-sponsored-context-receipt.json +4 -4
  794. package/dist/lib/schemas-data/3.1/sponsored-intelligence/si-sponsored-context.json +4 -4
  795. package/dist/lib/schemas-data/3.1/sponsored-intelligence/si-terminate-session-request.json +4 -4
  796. package/dist/lib/schemas-data/3.1/sponsored-intelligence/si-terminate-session-response.json +7 -7
  797. package/dist/lib/schemas-data/3.1/sponsored-intelligence/si-ui-element.json +1 -1
  798. package/dist/lib/schemas-data/3.1/trusted-match/available-package.json +4 -4
  799. package/dist/lib/schemas-data/3.1/trusted-match/context-match-request.json +5 -5
  800. package/dist/lib/schemas-data/3.1/trusted-match/context-match-response.json +4 -4
  801. package/dist/lib/schemas-data/3.1/trusted-match/error.json +1 -1
  802. package/dist/lib/schemas-data/3.1/trusted-match/identity-match-request.json +4 -4
  803. package/dist/lib/schemas-data/3.1/trusted-match/identity-match-response.json +4 -4
  804. package/dist/lib/schemas-data/3.1/trusted-match/offer-price.json +1 -1
  805. package/dist/lib/schemas-data/3.1/trusted-match/offer.json +5 -5
  806. package/dist/lib/schemas-data/3.1/trusted-match/provider-identity-match-response.json +4 -4
  807. package/dist/lib/schemas-data/3.1/trusted-match/provider-registration.json +2 -2
  808. package/dist/lib/schemas-data/3.1/trusted-match/publisher-tmpx-config.json +1 -1
  809. package/dist/lib/schemas-data/3.1/trusted-match/tmpx-chunk.json +1 -1
  810. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  811. package/dist/lib/server/decisioning/capabilities.d.mts +5 -5
  812. package/dist/lib/server/decisioning/capabilities.d.ts +5 -5
  813. package/dist/lib/server/decisioning/capabilities.js.map +1 -1
  814. package/dist/lib/server/decisioning/capabilities.mjs.map +1 -1
  815. package/dist/lib/server/decisioning/runtime/entity-hydration.generated.js.map +1 -1
  816. package/dist/lib/server/decisioning/runtime/entity-hydration.generated.mjs.map +1 -1
  817. package/dist/lib/server/wire-spec-fields.generated.d.mts +29 -29
  818. package/dist/lib/server/wire-spec-fields.generated.d.ts +29 -29
  819. package/dist/lib/server/wire-spec-fields.generated.js +29 -29
  820. package/dist/lib/server/wire-spec-fields.generated.js.map +1 -1
  821. package/dist/lib/server/wire-spec-fields.generated.mjs +29 -29
  822. package/dist/lib/server/wire-spec-fields.generated.mjs.map +1 -1
  823. package/dist/lib/testing/client.d.ts.map +1 -1
  824. package/dist/lib/testing/client.js +6 -2
  825. package/dist/lib/testing/client.js.map +1 -1
  826. package/dist/lib/testing/client.mjs +6 -2
  827. package/dist/lib/testing/client.mjs.map +1 -1
  828. package/dist/lib/testing/storyboard/runner.d.ts.map +1 -1
  829. package/dist/lib/testing/storyboard/runner.js +18 -4
  830. package/dist/lib/testing/storyboard/runner.js.map +1 -1
  831. package/dist/lib/testing/storyboard/runner.mjs +18 -4
  832. package/dist/lib/testing/storyboard/runner.mjs.map +1 -1
  833. package/dist/lib/testing/storyboard/types.d.mts +83 -29
  834. package/dist/lib/testing/storyboard/types.d.ts +83 -29
  835. package/dist/lib/testing/storyboard/types.d.ts.map +1 -1
  836. package/dist/lib/testing/storyboard/types.js.map +1 -1
  837. package/dist/lib/testing/storyboard/types.mjs.map +1 -1
  838. package/dist/lib/testing/storyboard/validations.d.mts +3 -1
  839. package/dist/lib/testing/storyboard/validations.d.ts +3 -1
  840. package/dist/lib/testing/storyboard/validations.d.ts.map +1 -1
  841. package/dist/lib/testing/storyboard/validations.js +86 -23
  842. package/dist/lib/testing/storyboard/validations.js.map +1 -1
  843. package/dist/lib/testing/storyboard/validations.mjs +86 -24
  844. package/dist/lib/testing/storyboard/validations.mjs.map +1 -1
  845. package/dist/lib/testing/types.d.mts +11 -0
  846. package/dist/lib/testing/types.d.ts +11 -0
  847. package/dist/lib/testing/types.d.ts.map +1 -1
  848. package/dist/lib/testing/types.js.map +1 -1
  849. package/dist/lib/types/comply-test-controller.d.ts +1 -1
  850. package/dist/lib/types/core.generated.d.mts +2 -2
  851. package/dist/lib/types/core.generated.d.ts +2 -2
  852. package/dist/lib/types/core.generated.js.map +1 -1
  853. package/dist/lib/types/get-adcp-capabilities.d.ts +2 -2
  854. package/dist/lib/types/get-products.d.ts +2 -2
  855. package/dist/lib/types/get-task-status.d.ts +1 -1
  856. package/dist/lib/types/log-event.d.ts +1 -1
  857. package/dist/lib/types/manifest.generated.d.mts +3 -3
  858. package/dist/lib/types/manifest.generated.d.ts +3 -3
  859. package/dist/lib/types/manifest.generated.js.map +1 -1
  860. package/dist/lib/types/manifest.generated.mjs.map +1 -1
  861. package/dist/lib/types/per-tool-index.json +1 -1
  862. package/dist/lib/types/sync-audiences.d.ts +1 -1
  863. package/dist/lib/types/tools.generated.d.mts +2 -2
  864. package/dist/lib/types/tools.generated.d.ts +2 -2
  865. package/dist/lib/types/tools.generated.js.map +1 -1
  866. package/dist/lib/validation/schema-loader.d.ts.map +1 -1
  867. package/dist/lib/validation/schema-loader.js +9 -0
  868. package/dist/lib/validation/schema-loader.js.map +1 -1
  869. package/dist/lib/validation/schema-loader.mjs +8 -0
  870. package/dist/lib/validation/schema-loader.mjs.map +1 -1
  871. package/dist/lib/version.d.mts +7 -7
  872. package/dist/lib/version.d.ts +7 -7
  873. package/dist/lib/version.d.ts.map +1 -1
  874. package/dist/lib/version.js +11 -6
  875. package/dist/lib/version.js.map +1 -1
  876. package/dist/lib/version.mjs +11 -6
  877. package/dist/lib/version.mjs.map +1 -1
  878. package/docs/llms.txt +5 -5
  879. package/package.json +2 -2
  880. package/compliance/cache/3.1.15/domains/media-buy/scenarios/inventory_list_no_match.yaml +0 -148
  881. package/compliance/cache/3.1.15/protocols/media-buy/scenarios/inventory_list_no_match.yaml +0 -148
  882. package/compliance/cache/3.1.15.previous/domains/media-buy/scenarios/inventory_list_no_match.yaml +0 -148
  883. package/compliance/cache/3.1.15.previous/protocols/media-buy/scenarios/inventory_list_no_match.yaml +0 -148
  884. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/brand/index.yaml +0 -0
  885. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/brand/scenarios/distributed_brand_resolution.yaml +0 -0
  886. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/brand/scenarios/single_side_trust_extension.yaml +0 -0
  887. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/creative/index.yaml +0 -0
  888. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/creative/scenarios/billing_out_of_band.yaml +0 -0
  889. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/creative/scenarios/canonical_supported_formats.yaml +0 -0
  890. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/creative/scenarios/creative_lifecycle_webhooks.yaml +0 -0
  891. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/creative/scenarios/evaluator_auth.yaml +0 -0
  892. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/creative/scenarios/native_in_feed.yaml +0 -0
  893. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/governance/index.yaml +0 -0
  894. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/audience_buy_flow.yaml +0 -0
  895. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/available_actions.yaml +0 -0
  896. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/billing_finality_delivery.yaml +0 -0
  897. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/canonical_formats.yaml +0 -0
  898. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/clicks_buy_flow.yaml +0 -0
  899. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/completed_views_buy_flow.yaml +0 -0
  900. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/create_media_buy_async.yaml +0 -0
  901. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/creative_reception.yaml +0 -0
  902. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/delivery_reporting.yaml +0 -0
  903. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/dependency_impairment_audience.yaml +0 -0
  904. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/event_dedup_flow.yaml +0 -0
  905. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/frequency_cap_enforcement.yaml +0 -0
  906. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/get_products_async.yaml +0 -0
  907. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/governance_approved.yaml +0 -0
  908. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/governance_conditions.yaml +0 -0
  909. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/governance_denied.yaml +0 -0
  910. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/governance_denied_recovery.yaml +0 -0
  911. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/inline_creatives_without_sync.yaml +0 -0
  912. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/invalid_transitions.yaml +0 -0
  913. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/measurement_accountability.yaml +0 -0
  914. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/package_correlation_legacy_fallback.yaml +0 -0
  915. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/per_creative_conversion_attribution.yaml +0 -0
  916. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/performance_buy_flow.yaml +0 -0
  917. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/performance_buy_flow_roas.yaml +0 -0
  918. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/pricing_currency_filter.yaml +0 -0
  919. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/product_signal_targeting.yaml +0 -0
  920. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/proposal_finalize.yaml +0 -0
  921. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/proposal_finalize_asap_timing.yaml +0 -0
  922. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/proposal_not_found_errors.yaml +0 -0
  923. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/provenance_audit_observation.yaml +0 -0
  924. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/provenance_enforcement.yaml +0 -0
  925. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/provenance_truth_of_claim.yaml +0 -0
  926. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/reach_buy_flow.yaml +0 -0
  927. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/refine_finalize_exclusivity.yaml +0 -0
  928. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/vendor_metric_accountability.yaml +0 -0
  929. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/vendor_metric_catalog_precondition.yaml +0 -0
  930. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/scenarios/vendor_metric_optimization_flow.yaml +0 -0
  931. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/media-buy/state-machine.yaml +0 -0
  932. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/signals/index.yaml +0 -0
  933. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/signals/scenarios/get_signals_async.yaml +0 -0
  934. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/sponsored-intelligence/index.yaml +0 -0
  935. /package/compliance/cache/{3.1.15 → 3.1.20}/domains/sponsored-intelligence/sponsored-context-accountability.yaml +0 -0
  936. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/brand/index.yaml +0 -0
  937. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/brand/scenarios/distributed_brand_resolution.yaml +0 -0
  938. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/brand/scenarios/single_side_trust_extension.yaml +0 -0
  939. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/creative/index.yaml +0 -0
  940. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/creative/scenarios/billing_out_of_band.yaml +0 -0
  941. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/creative/scenarios/canonical_supported_formats.yaml +0 -0
  942. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/creative/scenarios/creative_lifecycle_webhooks.yaml +0 -0
  943. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/creative/scenarios/evaluator_auth.yaml +0 -0
  944. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/creative/scenarios/native_in_feed.yaml +0 -0
  945. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/governance/index.yaml +0 -0
  946. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/audience_buy_flow.yaml +0 -0
  947. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/available_actions.yaml +0 -0
  948. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/billing_finality_delivery.yaml +0 -0
  949. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/canonical_formats.yaml +0 -0
  950. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/clicks_buy_flow.yaml +0 -0
  951. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/completed_views_buy_flow.yaml +0 -0
  952. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/create_media_buy_async.yaml +0 -0
  953. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/creative_reception.yaml +0 -0
  954. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/delivery_reporting.yaml +0 -0
  955. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/dependency_impairment_audience.yaml +0 -0
  956. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/event_dedup_flow.yaml +0 -0
  957. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/frequency_cap_enforcement.yaml +0 -0
  958. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/get_products_async.yaml +0 -0
  959. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/governance_approved.yaml +0 -0
  960. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/governance_conditions.yaml +0 -0
  961. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/governance_denied.yaml +0 -0
  962. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/governance_denied_recovery.yaml +0 -0
  963. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/inline_creatives_without_sync.yaml +0 -0
  964. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/invalid_transitions.yaml +0 -0
  965. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/measurement_accountability.yaml +0 -0
  966. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/package_correlation_legacy_fallback.yaml +0 -0
  967. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/per_creative_conversion_attribution.yaml +0 -0
  968. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/performance_buy_flow.yaml +0 -0
  969. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/performance_buy_flow_roas.yaml +0 -0
  970. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/pricing_currency_filter.yaml +0 -0
  971. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/product_signal_targeting.yaml +0 -0
  972. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/proposal_finalize.yaml +0 -0
  973. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/proposal_finalize_asap_timing.yaml +0 -0
  974. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/proposal_not_found_errors.yaml +0 -0
  975. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/provenance_audit_observation.yaml +0 -0
  976. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/provenance_enforcement.yaml +0 -0
  977. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/provenance_truth_of_claim.yaml +0 -0
  978. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/reach_buy_flow.yaml +0 -0
  979. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/refine_finalize_exclusivity.yaml +0 -0
  980. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/vendor_metric_accountability.yaml +0 -0
  981. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/vendor_metric_catalog_precondition.yaml +0 -0
  982. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/scenarios/vendor_metric_optimization_flow.yaml +0 -0
  983. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/media-buy/state-machine.yaml +0 -0
  984. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/signals/index.yaml +0 -0
  985. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/signals/scenarios/get_signals_async.yaml +0 -0
  986. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/sponsored-intelligence/index.yaml +0 -0
  987. /package/compliance/cache/{3.1.15 → 3.1.20}/protocols/sponsored-intelligence/sponsored-context-accountability.yaml +0 -0
  988. /package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/audience-sync/index.yaml +0 -0
  989. /package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/brand-rights/index.yaml +0 -0
  990. /package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/brand-rights/scenarios/governance_denied.yaml +0 -0
  991. /package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/collection-lists/index.yaml +0 -0
  992. /package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/content-standards/index.yaml +0 -0
  993. /package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/creative-ad-server/index.yaml +0 -0
  994. /package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/creative-generative/generative-seller.yaml +0 -0
  995. /package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/creative-generative/index.yaml +0 -0
  996. /package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/creative-template/index.yaml +0 -0
  997. /package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/creative-transformers/index.yaml +0 -0
  998. /package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/governance-aware-seller/index.yaml +0 -0
  999. /package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/governance-aware-seller/scenarios/governance_multi_agent_rejected.yaml +0 -0
  1000. /package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/governance-delivery-monitor/index.yaml +0 -0
  1001. /package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/governance-spend-authority/denied.yaml +0 -0
  1002. /package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/governance-spend-authority/index.yaml +0 -0
  1003. /package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/property-lists/index.yaml +0 -0
  1004. /package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/sales-catalog-driven/index.yaml +0 -0
  1005. /package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/sales-non-guaranteed/index.yaml +0 -0
  1006. /package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/sales-social/index.yaml +0 -0
  1007. /package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/signal-marketplace/index.yaml +0 -0
  1008. /package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/signal-marketplace/scenarios/governance_denied.yaml +0 -0
  1009. /package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/signal-owned/index.yaml +0 -0
  1010. /package/compliance/cache/{3.1.15 → 3.1.20}/specialisms/sponsored-intelligence/index.yaml +0 -0
  1011. /package/compliance/cache/{3.1.15 → 3.1.20}/test-kits/acme-outdoor-live.yaml +0 -0
  1012. /package/compliance/cache/{3.1.15 → 3.1.20}/test-kits/billing-gate-runner.yaml +0 -0
  1013. /package/compliance/cache/{3.1.15 → 3.1.20}/test-kits/bistro-oranje.yaml +0 -0
  1014. /package/compliance/cache/{3.1.15 → 3.1.20}/test-kits/distributed-brand-runner.yaml +0 -0
  1015. /package/compliance/cache/{3.1.15 → 3.1.20}/test-kits/nova-motors.yaml +0 -0
  1016. /package/compliance/cache/{3.1.15 → 3.1.20}/test-kits/osei-natural.yaml +0 -0
  1017. /package/compliance/cache/{3.1.15 → 3.1.20}/test-kits/parallel-dispatch-runner.yaml +0 -0
  1018. /package/compliance/cache/{3.1.15 → 3.1.20}/test-kits/rate-limit-trip-runner.yaml +0 -0
  1019. /package/compliance/cache/{3.1.15 → 3.1.20}/test-kits/signed-requests-runner.yaml +0 -0
  1020. /package/compliance/cache/{3.1.15 → 3.1.20}/test-kits/single-side-trust-runner.yaml +0 -0
  1021. /package/compliance/cache/{3.1.15 → 3.1.20}/test-kits/substitution-observer-runner.yaml +0 -0
  1022. /package/compliance/cache/{3.1.15 → 3.1.20}/test-kits/summit-foods.yaml +0 -0
  1023. /package/compliance/cache/{3.1.15 → 3.1.20}/test-kits/webhook-receiver-runner.yaml +0 -0
  1024. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/catalog-macro-substitution.json +0 -0
  1025. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/plan-hash/001-minimal-plan.json +0 -0
  1026. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/plan-hash/002-full-plan.json +0 -0
  1027. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/plan-hash/003-bookkeeping-stripped.json +0 -0
  1028. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/plan-hash/004a-human-review-omitted.json +0 -0
  1029. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/plan-hash/004b-human-review-explicit-null.json +0 -0
  1030. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/plan-hash/005a-policy-categories-order-1.json +0 -0
  1031. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/plan-hash/005b-policy-categories-order-2.json +0 -0
  1032. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/plan-hash/006a-ext-trace-v1.json +0 -0
  1033. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/plan-hash/006b-ext-trace-v2.json +0 -0
  1034. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/plan-hash/007-unicode-objectives.json +0 -0
  1035. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/plan-hash/008-numeric-canonicalization.json +0 -0
  1036. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/README.md +0 -0
  1037. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/canonicalization.json +0 -0
  1038. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/keys.json +0 -0
  1039. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/001-no-signature-header.json +0 -0
  1040. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/002-wrong-tag.json +0 -0
  1041. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/003-expired-signature.json +0 -0
  1042. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/004-window-too-long.json +0 -0
  1043. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/005-alg-not-allowed.json +0 -0
  1044. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/006-missing-covered-component.json +0 -0
  1045. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/007-missing-content-digest.json +0 -0
  1046. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/008-unknown-keyid.json +0 -0
  1047. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/009-key-ops-missing-verify.json +0 -0
  1048. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/010-content-digest-mismatch.json +0 -0
  1049. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/011-malformed-header.json +0 -0
  1050. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/012-missing-expires-param.json +0 -0
  1051. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/013-expires-le-created.json +0 -0
  1052. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/014-missing-nonce-param.json +0 -0
  1053. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/015-signature-invalid.json +0 -0
  1054. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/016-replayed-nonce.json +0 -0
  1055. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/017-key-revoked.json +0 -0
  1056. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/018-digest-covered-when-forbidden.json +0 -0
  1057. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/019-signature-without-signature-input.json +0 -0
  1058. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/020-rate-abuse.json +0 -0
  1059. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/021-duplicate-signature-input-label.json +0 -0
  1060. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/022-multi-valued-content-type.json +0 -0
  1061. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/023-multi-valued-content-digest.json +0 -0
  1062. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/024-unquoted-string-param.json +0 -0
  1063. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/025-jwk-alg-crv-mismatch.json +0 -0
  1064. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/026-non-ascii-host.json +0 -0
  1065. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/027-webhook-registration-authentication-unsigned.json +0 -0
  1066. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/negative/028-unsigned-protocol-method-required.json +0 -0
  1067. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/positive/001-basic-post.json +0 -0
  1068. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/positive/002-post-with-content-digest.json +0 -0
  1069. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/positive/003-es256-post.json +0 -0
  1070. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/positive/004-multiple-signature-labels.json +0 -0
  1071. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/positive/005-default-port-stripped.json +0 -0
  1072. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/positive/006-dot-segment-path.json +0 -0
  1073. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/positive/007-query-byte-preserved.json +0 -0
  1074. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/positive/008-percent-encoded-path.json +0 -0
  1075. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/positive/009-percent-encoded-unreserved-decoded.json +0 -0
  1076. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/positive/010-percent-encoded-slash-preserved.json +0 -0
  1077. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/positive/011-ipv6-authority.json +0 -0
  1078. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/request-signing/positive/012-ipv6-authority-default-port-stripped.json +0 -0
  1079. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-receiver-envelope.json +0 -0
  1080. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/README.md +0 -0
  1081. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/keys.json +0 -0
  1082. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/negative/001-wrong-tag.json +0 -0
  1083. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/negative/002-expired-signature.json +0 -0
  1084. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/negative/003-window-too-long.json +0 -0
  1085. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/negative/004-alg-not-allowed.json +0 -0
  1086. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/negative/005-missing-authority-component.json +0 -0
  1087. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/negative/006-missing-content-digest.json +0 -0
  1088. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/negative/007-unknown-keyid.json +0 -0
  1089. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/negative/008-wrong-adcp-use.json +0 -0
  1090. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/negative/009-content-digest-mismatch.json +0 -0
  1091. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/negative/010-malformed-signature-input.json +0 -0
  1092. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/negative/011-signature-without-input.json +0 -0
  1093. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/negative/012-missing-expires-param.json +0 -0
  1094. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/negative/013-expires-le-created.json +0 -0
  1095. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/negative/014-missing-nonce-param.json +0 -0
  1096. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/negative/015-signature-invalid.json +0 -0
  1097. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/negative/016-replayed-nonce.json +0 -0
  1098. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/negative/017-key-revoked.json +0 -0
  1099. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/negative/018-rate-abuse.json +0 -0
  1100. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/negative/019-revocation-stale.json +0 -0
  1101. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/negative/020-key-ops-missing-verify.json +0 -0
  1102. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/negative/021-base64-alphabet-mixing.json +0 -0
  1103. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/positive/001-basic-post.json +0 -0
  1104. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/positive/002-es256-post.json +0 -0
  1105. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/positive/003-multiple-signature-labels.json +0 -0
  1106. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/positive/004-default-port-stripped.json +0 -0
  1107. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/positive/005-percent-encoded-path.json +0 -0
  1108. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/positive/006-query-byte-preserved.json +0 -0
  1109. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/positive/007-body-without-idempotency-key.json +0 -0
  1110. /package/compliance/cache/{3.1.15 → 3.1.20}/test-vectors/webhook-signing/positive/008-request-signing-key-reuse.json +0 -0
  1111. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/billing-gate-dispatch.yaml +0 -0
  1112. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/canonical-format-validate-input.yaml +0 -0
  1113. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/capability-discovery.yaml +0 -0
  1114. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/collection-lists-pagination-integrity.yaml +0 -0
  1115. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/comply-controller-mode-gate.yaml +0 -0
  1116. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/content-standards-pagination-integrity.yaml +0 -0
  1117. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/deterministic-testing.yaml +0 -0
  1118. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/error-compliance-signals.yaml +0 -0
  1119. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/error-compliance.yaml +0 -0
  1120. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/fictional-entities.yaml +0 -0
  1121. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/get-media-buys-pagination-integrity.yaml +0 -0
  1122. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/get-products-pagination-integrity.yaml +0 -0
  1123. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/get-signals-pagination-integrity.yaml +0 -0
  1124. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/idempotency.yaml +0 -0
  1125. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/notification-config-event-scope.yaml +0 -0
  1126. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/notification-config-lifecycle.yaml +0 -0
  1127. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/notification-config-rejections.yaml +0 -0
  1128. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/pagination-integrity-list-accounts.yaml +0 -0
  1129. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/pagination-integrity.yaml +0 -0
  1130. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/property-lists-pagination-integrity.yaml +0 -0
  1131. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/read-tool-idempotency.yaml +0 -0
  1132. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/runner-output-contract.yaml +0 -0
  1133. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/schema-validation-signals.yaml +0 -0
  1134. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/schema-validation.yaml +0 -0
  1135. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/security.yaml +0 -0
  1136. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/signed-requests.yaml +0 -0
  1137. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/stale-response-advisory.yaml +0 -0
  1138. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/storyboard-schema.yaml +0 -0
  1139. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/v3-envelope-integrity.yaml +0 -0
  1140. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/version-negotiation.yaml +0 -0
  1141. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/webhook-emission.yaml +0 -0
  1142. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/webhook-receiver-envelope.yaml +0 -0
  1143. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/wholesale-feed-bulk-webhooks.yaml +0 -0
  1144. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/wholesale-feed-product-webhooks.yaml +0 -0
  1145. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/wholesale-feed-products.yaml +0 -0
  1146. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/wholesale-feed-signal-webhooks.yaml +0 -0
  1147. /package/compliance/cache/{3.1.15 → 3.1.20}/universal/wholesale-feed-signals.yaml +0 -0
  1148. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/brand/index.yaml +0 -0
  1149. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/brand/scenarios/distributed_brand_resolution.yaml +0 -0
  1150. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/brand/scenarios/single_side_trust_extension.yaml +0 -0
  1151. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/creative/index.yaml +0 -0
  1152. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/creative/scenarios/billing_out_of_band.yaml +0 -0
  1153. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/creative/scenarios/canonical_supported_formats.yaml +0 -0
  1154. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/creative/scenarios/creative_lifecycle_webhooks.yaml +0 -0
  1155. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/creative/scenarios/evaluator_auth.yaml +0 -0
  1156. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/creative/scenarios/native_in_feed.yaml +0 -0
  1157. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/governance/index.yaml +0 -0
  1158. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/audience_buy_flow.yaml +0 -0
  1159. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/available_actions.yaml +0 -0
  1160. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/billing_finality_delivery.yaml +0 -0
  1161. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/canonical_formats.yaml +0 -0
  1162. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/clicks_buy_flow.yaml +0 -0
  1163. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/completed_views_buy_flow.yaml +0 -0
  1164. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/create_media_buy_async.yaml +0 -0
  1165. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/creative_reception.yaml +0 -0
  1166. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/delivery_reporting.yaml +0 -0
  1167. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/dependency_impairment_audience.yaml +0 -0
  1168. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/event_dedup_flow.yaml +0 -0
  1169. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/frequency_cap_enforcement.yaml +0 -0
  1170. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/get_products_async.yaml +0 -0
  1171. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/governance_approved.yaml +0 -0
  1172. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/governance_conditions.yaml +0 -0
  1173. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/governance_denied.yaml +0 -0
  1174. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/governance_denied_recovery.yaml +0 -0
  1175. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/inline_creatives_without_sync.yaml +0 -0
  1176. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/invalid_transitions.yaml +0 -0
  1177. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/measurement_accountability.yaml +0 -0
  1178. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/package_correlation_legacy_fallback.yaml +0 -0
  1179. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/per_creative_conversion_attribution.yaml +0 -0
  1180. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/performance_buy_flow.yaml +0 -0
  1181. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/performance_buy_flow_roas.yaml +0 -0
  1182. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/pricing_currency_filter.yaml +0 -0
  1183. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/product_signal_targeting.yaml +0 -0
  1184. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/proposal_finalize.yaml +0 -0
  1185. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/proposal_finalize_asap_timing.yaml +0 -0
  1186. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/proposal_not_found_errors.yaml +0 -0
  1187. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/provenance_audit_observation.yaml +0 -0
  1188. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/provenance_enforcement.yaml +0 -0
  1189. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/provenance_truth_of_claim.yaml +0 -0
  1190. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/reach_buy_flow.yaml +0 -0
  1191. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/refine_finalize_exclusivity.yaml +0 -0
  1192. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/vendor_metric_accountability.yaml +0 -0
  1193. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/vendor_metric_catalog_precondition.yaml +0 -0
  1194. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/scenarios/vendor_metric_optimization_flow.yaml +0 -0
  1195. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/media-buy/state-machine.yaml +0 -0
  1196. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/signals/index.yaml +0 -0
  1197. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/signals/scenarios/get_signals_async.yaml +0 -0
  1198. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/sponsored-intelligence/index.yaml +0 -0
  1199. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/domains/sponsored-intelligence/sponsored-context-accountability.yaml +0 -0
  1200. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/brand/index.yaml +0 -0
  1201. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/brand/scenarios/distributed_brand_resolution.yaml +0 -0
  1202. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/brand/scenarios/single_side_trust_extension.yaml +0 -0
  1203. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/creative/index.yaml +0 -0
  1204. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/creative/scenarios/billing_out_of_band.yaml +0 -0
  1205. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/creative/scenarios/canonical_supported_formats.yaml +0 -0
  1206. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/creative/scenarios/creative_lifecycle_webhooks.yaml +0 -0
  1207. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/creative/scenarios/evaluator_auth.yaml +0 -0
  1208. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/creative/scenarios/native_in_feed.yaml +0 -0
  1209. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/governance/index.yaml +0 -0
  1210. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/audience_buy_flow.yaml +0 -0
  1211. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/available_actions.yaml +0 -0
  1212. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/billing_finality_delivery.yaml +0 -0
  1213. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/canonical_formats.yaml +0 -0
  1214. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/clicks_buy_flow.yaml +0 -0
  1215. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/completed_views_buy_flow.yaml +0 -0
  1216. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/create_media_buy_async.yaml +0 -0
  1217. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/creative_reception.yaml +0 -0
  1218. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/delivery_reporting.yaml +0 -0
  1219. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/dependency_impairment_audience.yaml +0 -0
  1220. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/event_dedup_flow.yaml +0 -0
  1221. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/frequency_cap_enforcement.yaml +0 -0
  1222. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/get_products_async.yaml +0 -0
  1223. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/governance_approved.yaml +0 -0
  1224. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/governance_conditions.yaml +0 -0
  1225. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/governance_denied.yaml +0 -0
  1226. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/governance_denied_recovery.yaml +0 -0
  1227. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/inline_creatives_without_sync.yaml +0 -0
  1228. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/invalid_transitions.yaml +0 -0
  1229. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/measurement_accountability.yaml +0 -0
  1230. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/package_correlation_legacy_fallback.yaml +0 -0
  1231. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/per_creative_conversion_attribution.yaml +0 -0
  1232. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/performance_buy_flow.yaml +0 -0
  1233. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/performance_buy_flow_roas.yaml +0 -0
  1234. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/pricing_currency_filter.yaml +0 -0
  1235. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/product_signal_targeting.yaml +0 -0
  1236. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/proposal_finalize.yaml +0 -0
  1237. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/proposal_finalize_asap_timing.yaml +0 -0
  1238. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/proposal_not_found_errors.yaml +0 -0
  1239. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/provenance_audit_observation.yaml +0 -0
  1240. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/provenance_enforcement.yaml +0 -0
  1241. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/provenance_truth_of_claim.yaml +0 -0
  1242. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/reach_buy_flow.yaml +0 -0
  1243. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/refine_finalize_exclusivity.yaml +0 -0
  1244. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/vendor_metric_accountability.yaml +0 -0
  1245. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/vendor_metric_catalog_precondition.yaml +0 -0
  1246. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/scenarios/vendor_metric_optimization_flow.yaml +0 -0
  1247. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/media-buy/state-machine.yaml +0 -0
  1248. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/signals/index.yaml +0 -0
  1249. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/signals/scenarios/get_signals_async.yaml +0 -0
  1250. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/sponsored-intelligence/index.yaml +0 -0
  1251. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/protocols/sponsored-intelligence/sponsored-context-accountability.yaml +0 -0
  1252. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/audience-sync/index.yaml +0 -0
  1253. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/brand-rights/index.yaml +0 -0
  1254. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/brand-rights/scenarios/governance_denied.yaml +0 -0
  1255. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/collection-lists/index.yaml +0 -0
  1256. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/content-standards/index.yaml +0 -0
  1257. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/creative-ad-server/index.yaml +0 -0
  1258. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/creative-generative/generative-seller.yaml +0 -0
  1259. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/creative-generative/index.yaml +0 -0
  1260. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/creative-template/index.yaml +0 -0
  1261. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/creative-transformers/index.yaml +0 -0
  1262. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/governance-aware-seller/index.yaml +0 -0
  1263. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/governance-aware-seller/scenarios/governance_multi_agent_rejected.yaml +0 -0
  1264. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/governance-delivery-monitor/index.yaml +0 -0
  1265. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/governance-spend-authority/denied.yaml +0 -0
  1266. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/governance-spend-authority/index.yaml +0 -0
  1267. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/property-lists/index.yaml +0 -0
  1268. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/sales-catalog-driven/index.yaml +0 -0
  1269. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/sales-non-guaranteed/index.yaml +0 -0
  1270. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/sales-social/index.yaml +0 -0
  1271. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/signal-marketplace/index.yaml +0 -0
  1272. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/signal-marketplace/scenarios/governance_denied.yaml +0 -0
  1273. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/signal-owned/index.yaml +0 -0
  1274. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/specialisms/sponsored-intelligence/index.yaml +0 -0
  1275. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-kits/acme-outdoor-live.yaml +0 -0
  1276. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-kits/billing-gate-runner.yaml +0 -0
  1277. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-kits/bistro-oranje.yaml +0 -0
  1278. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-kits/distributed-brand-runner.yaml +0 -0
  1279. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-kits/nova-motors.yaml +0 -0
  1280. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-kits/osei-natural.yaml +0 -0
  1281. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-kits/parallel-dispatch-runner.yaml +0 -0
  1282. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-kits/rate-limit-trip-runner.yaml +0 -0
  1283. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-kits/signed-requests-runner.yaml +0 -0
  1284. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-kits/single-side-trust-runner.yaml +0 -0
  1285. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-kits/substitution-observer-runner.yaml +0 -0
  1286. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-kits/summit-foods.yaml +0 -0
  1287. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-kits/webhook-receiver-runner.yaml +0 -0
  1288. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/catalog-macro-substitution.json +0 -0
  1289. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/plan-hash/001-minimal-plan.json +0 -0
  1290. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/plan-hash/002-full-plan.json +0 -0
  1291. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/plan-hash/003-bookkeeping-stripped.json +0 -0
  1292. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/plan-hash/004a-human-review-omitted.json +0 -0
  1293. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/plan-hash/004b-human-review-explicit-null.json +0 -0
  1294. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/plan-hash/005a-policy-categories-order-1.json +0 -0
  1295. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/plan-hash/005b-policy-categories-order-2.json +0 -0
  1296. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/plan-hash/006a-ext-trace-v1.json +0 -0
  1297. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/plan-hash/006b-ext-trace-v2.json +0 -0
  1298. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/plan-hash/007-unicode-objectives.json +0 -0
  1299. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/plan-hash/008-numeric-canonicalization.json +0 -0
  1300. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/README.md +0 -0
  1301. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/canonicalization.json +0 -0
  1302. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/keys.json +0 -0
  1303. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/001-no-signature-header.json +0 -0
  1304. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/002-wrong-tag.json +0 -0
  1305. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/003-expired-signature.json +0 -0
  1306. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/004-window-too-long.json +0 -0
  1307. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/005-alg-not-allowed.json +0 -0
  1308. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/006-missing-covered-component.json +0 -0
  1309. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/007-missing-content-digest.json +0 -0
  1310. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/008-unknown-keyid.json +0 -0
  1311. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/009-key-ops-missing-verify.json +0 -0
  1312. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/010-content-digest-mismatch.json +0 -0
  1313. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/011-malformed-header.json +0 -0
  1314. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/012-missing-expires-param.json +0 -0
  1315. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/013-expires-le-created.json +0 -0
  1316. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/014-missing-nonce-param.json +0 -0
  1317. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/015-signature-invalid.json +0 -0
  1318. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/016-replayed-nonce.json +0 -0
  1319. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/017-key-revoked.json +0 -0
  1320. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/018-digest-covered-when-forbidden.json +0 -0
  1321. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/019-signature-without-signature-input.json +0 -0
  1322. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/020-rate-abuse.json +0 -0
  1323. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/021-duplicate-signature-input-label.json +0 -0
  1324. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/022-multi-valued-content-type.json +0 -0
  1325. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/023-multi-valued-content-digest.json +0 -0
  1326. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/024-unquoted-string-param.json +0 -0
  1327. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/025-jwk-alg-crv-mismatch.json +0 -0
  1328. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/026-non-ascii-host.json +0 -0
  1329. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/027-webhook-registration-authentication-unsigned.json +0 -0
  1330. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/negative/028-unsigned-protocol-method-required.json +0 -0
  1331. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/positive/001-basic-post.json +0 -0
  1332. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/positive/002-post-with-content-digest.json +0 -0
  1333. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/positive/003-es256-post.json +0 -0
  1334. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/positive/004-multiple-signature-labels.json +0 -0
  1335. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/positive/005-default-port-stripped.json +0 -0
  1336. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/positive/006-dot-segment-path.json +0 -0
  1337. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/positive/007-query-byte-preserved.json +0 -0
  1338. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/positive/008-percent-encoded-path.json +0 -0
  1339. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/positive/009-percent-encoded-unreserved-decoded.json +0 -0
  1340. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/positive/010-percent-encoded-slash-preserved.json +0 -0
  1341. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/positive/011-ipv6-authority.json +0 -0
  1342. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/request-signing/positive/012-ipv6-authority-default-port-stripped.json +0 -0
  1343. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-receiver-envelope.json +0 -0
  1344. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/README.md +0 -0
  1345. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/keys.json +0 -0
  1346. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/negative/001-wrong-tag.json +0 -0
  1347. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/negative/002-expired-signature.json +0 -0
  1348. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/negative/003-window-too-long.json +0 -0
  1349. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/negative/004-alg-not-allowed.json +0 -0
  1350. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/negative/005-missing-authority-component.json +0 -0
  1351. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/negative/006-missing-content-digest.json +0 -0
  1352. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/negative/007-unknown-keyid.json +0 -0
  1353. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/negative/008-wrong-adcp-use.json +0 -0
  1354. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/negative/009-content-digest-mismatch.json +0 -0
  1355. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/negative/010-malformed-signature-input.json +0 -0
  1356. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/negative/011-signature-without-input.json +0 -0
  1357. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/negative/012-missing-expires-param.json +0 -0
  1358. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/negative/013-expires-le-created.json +0 -0
  1359. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/negative/014-missing-nonce-param.json +0 -0
  1360. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/negative/015-signature-invalid.json +0 -0
  1361. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/negative/016-replayed-nonce.json +0 -0
  1362. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/negative/017-key-revoked.json +0 -0
  1363. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/negative/018-rate-abuse.json +0 -0
  1364. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/negative/019-revocation-stale.json +0 -0
  1365. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/negative/020-key-ops-missing-verify.json +0 -0
  1366. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/negative/021-base64-alphabet-mixing.json +0 -0
  1367. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/positive/001-basic-post.json +0 -0
  1368. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/positive/002-es256-post.json +0 -0
  1369. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/positive/003-multiple-signature-labels.json +0 -0
  1370. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/positive/004-default-port-stripped.json +0 -0
  1371. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/positive/005-percent-encoded-path.json +0 -0
  1372. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/positive/006-query-byte-preserved.json +0 -0
  1373. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/positive/007-body-without-idempotency-key.json +0 -0
  1374. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/test-vectors/webhook-signing/positive/008-request-signing-key-reuse.json +0 -0
  1375. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/billing-gate-dispatch.yaml +0 -0
  1376. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/canonical-format-validate-input.yaml +0 -0
  1377. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/capability-discovery.yaml +0 -0
  1378. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/collection-lists-pagination-integrity.yaml +0 -0
  1379. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/comply-controller-mode-gate.yaml +0 -0
  1380. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/content-standards-pagination-integrity.yaml +0 -0
  1381. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/deterministic-testing.yaml +0 -0
  1382. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/error-compliance-signals.yaml +0 -0
  1383. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/error-compliance.yaml +0 -0
  1384. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/fictional-entities.yaml +0 -0
  1385. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/get-media-buys-pagination-integrity.yaml +0 -0
  1386. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/get-products-pagination-integrity.yaml +0 -0
  1387. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/get-signals-pagination-integrity.yaml +0 -0
  1388. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/idempotency.yaml +0 -0
  1389. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/notification-config-event-scope.yaml +0 -0
  1390. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/notification-config-lifecycle.yaml +0 -0
  1391. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/notification-config-rejections.yaml +0 -0
  1392. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/pagination-integrity-list-accounts.yaml +0 -0
  1393. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/pagination-integrity.yaml +0 -0
  1394. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/property-lists-pagination-integrity.yaml +0 -0
  1395. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/read-tool-idempotency.yaml +0 -0
  1396. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/runner-output-contract.yaml +0 -0
  1397. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/schema-validation-signals.yaml +0 -0
  1398. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/schema-validation.yaml +0 -0
  1399. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/security.yaml +0 -0
  1400. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/signed-requests.yaml +0 -0
  1401. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/stale-response-advisory.yaml +0 -0
  1402. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/storyboard-schema.yaml +0 -0
  1403. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/v3-envelope-integrity.yaml +0 -0
  1404. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/version-negotiation.yaml +0 -0
  1405. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/webhook-emission.yaml +0 -0
  1406. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/webhook-receiver-envelope.yaml +0 -0
  1407. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/wholesale-feed-bulk-webhooks.yaml +0 -0
  1408. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/wholesale-feed-product-webhooks.yaml +0 -0
  1409. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/wholesale-feed-products.yaml +0 -0
  1410. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/wholesale-feed-signal-webhooks.yaml +0 -0
  1411. /package/compliance/cache/{3.1.15.previous → 3.1.20.previous}/universal/wholesale-feed-signals.yaml +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/testing/storyboard/runner.ts"],"sourcesContent":["/**\n * Storyboard execution engine.\n *\n * Two entry points:\n * - runStoryboard(): run all phases/steps sequentially\n * - runStoryboardStep(): run a single step (stateless, LLM-friendly)\n */\n\nimport { createHash, createHmac } from 'node:crypto';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { basename, join } from 'node:path';\nimport { getOrCreateClientResolution, getOrDiscoverProfile, runStep, type TestClient } from '../client';\nimport {\n closeScopedConnections,\n normalizeTransportOptions,\n withMCPConnectionScope,\n type VersionEnvelopeMode,\n} from '../../protocols';\nimport { getCapturesFromError, withRawResponseCapture, type RawHttpCapture } from '../../protocols/rawResponseCapture';\nimport { defaultStoryboardResponseProjection, executeStoryboardTask } from './task-map';\nimport {\n extractContextWithProvenance,\n injectContext,\n applyContextOutputsWithProvenance,\n applyContextInputs,\n forwardAliasCache,\n createRunnerVariables,\n type RunnerVariables,\n} from './context';\nimport { detectContextRejectionHints } from './rejection-hints';\nimport { detectShapeDriftHints } from './shape-drift-hints';\nimport { detectStrictValidationHints } from './strict-validation-hints';\nimport {\n runValidations,\n decorateValidationResult,\n validationFailsStep,\n RUNNER_CAPABILITY_VERSION,\n type ValidationContext,\n type CrossResponseSet,\n type UpstreamTrafficValidationContext,\n type UpstreamTrafficQueryResult,\n} from './validations';\nimport { PARALLEL_DISPATCH_CONTRACT, runParallelDispatches, validateParallelDispatchSpec } from './parallel-dispatch';\nimport { resolvePath, resolvePortableIdentifierPathAll, toJsonPointer, validatePortableIdentifierPath } from './path';\nimport {\n RATE_LIMIT_TRIP_CONTRACT,\n RateLimitTripObserver,\n validateRateLimitTripSpec,\n type RateLimitTripObservation,\n} from './rate-limit-trip';\nimport { redactSecrets } from '../../utils/redact-secrets';\nimport { ResponseSchemaValidationError } from '../../utils/response-unwrapper';\nimport { injectLegacyEnvelopeStatus, normalizeLegacyMediaBuyStatusForReturn } from '../../utils/envelope-status-compat';\nimport { queryUpstreamTraffic, type ControllerScenario, type UpstreamTrafficSuccess } from '../test-controller';\nimport { IDENTIFIER_DIGEST_LIMIT } from '../../upstream-recorder/constants';\nimport { enrichRequest, hasRequestEnricher } from './request-builder';\nimport {\n BUILD_ASSETS_FROM_FORMAT_DIRECTIVE,\n expandCreativeAssetDirectivesWithDiagnostics,\n findUnresolvedCreativeAssetDirectives,\n type CreativeAssetExpansionFailure,\n} from './creative-assets';\nimport { resolveAccount, resolveBrand } from '../client';\nimport { isMutatingTask, generateIdempotencyKey } from '../../utils/idempotency';\nimport {\n getSchemaDefaultByPath,\n getSchemaValidatorByRef,\n resolveBundleKey,\n schemaAllowsTopLevelField,\n withExternalSchemaRoot,\n} from '../../validation/schema-loader';\nimport { ADCP_VERSION, parseAdcpMajorVersion } from '../../version';\nimport {\n PROBE_TASKS,\n probeProtectedResourceMetadata,\n probeOauthAuthServerMetadata,\n fetchProbe,\n rawMcpProbe,\n generateRandomInvalidApiKey,\n generateRandomInvalidJwt,\n} from './probes';\nimport { readBrandJsonUrl } from '../../signing/agent-resolver/capabilities-types';\nimport { resolveDeclaredTestKit, validateTestKit } from './test-kit';\nimport { validateStoryboardShape } from './loader';\nimport { trustedStoryboardComplianceRoot } from './provenance';\nimport { probeRequestSigningVector } from './request-signing/probe-dispatch';\nimport { createWebhookReceiver, type WebhookReceiver, type WebhookWaitResult } from './webhook-receiver';\nimport { WEBHOOK_ASSERTION_TASKS, armWebhookAssertions, executeWebhookAssertionStep } from './webhook-assertions';\nimport { runControllerSeeding, type ControllerSeedingResult } from './seeding';\nimport { applyFixtureBindingsToRequest, type FixtureBindingRegistry } from './fixture-resolution';\nimport { getComplianceCacheDir } from './compliance';\nimport { signWebhook, type RequestLike } from '../../signing/client';\nimport { replayTrustedMatchContextVector } from './trusted-match-context-replay';\nimport {\n TRUSTED_MATCH_PUBLISHER_AUTH_TASKS,\n prepareTrustedMatchPublisherAuthProbes,\n probeTrustedMatchPublisherAuth,\n type PreparedTrustedMatchPublisherAuthProbes,\n type TrustedMatchPublisherAuthTask,\n} from './trusted-match-publisher-auth';\nimport {\n gradeOAuthMetadataGraph,\n redactOAuthUrlForOutput,\n redactOAuthUrlsInText,\n type OAuthMetadataGraphGrade,\n} from './oauth-metadata-graph';\n\nconst PREPARED_TRUSTED_MATCH_PUBLISHER_AUTH = Symbol('preparedTrustedMatchPublisherAuth');\ntype InternalStoryboardRunOptions = StoryboardRunOptions & {\n [PREPARED_TRUSTED_MATCH_PUBLISHER_AUTH]?: PreparedTrustedMatchPublisherAuthProbes;\n};\n\nfunction getPreparedTrustedMatchPublisherAuth(\n options: StoryboardRunOptions\n): PreparedTrustedMatchPublisherAuthProbes | undefined {\n return (options as InternalStoryboardRunOptions)[PREPARED_TRUSTED_MATCH_PUBLISHER_AUTH];\n}\n\nfunction withPreparedTrustedMatchPublisherAuth(\n options: StoryboardRunOptions,\n prepared: PreparedTrustedMatchPublisherAuthProbes\n): StoryboardRunOptions {\n return { ...options, [PREPARED_TRUSTED_MATCH_PUBLISHER_AUTH]: prepared } as InternalStoryboardRunOptions;\n}\n\n/**\n * Pre-computed controller-seeding outcome passed into `executeStoryboardPass`.\n * Populated by `runMultiPass` so seeding fires once at the run level instead\n * of once per pass (which would inflate `failed_count`/`skipped_count` when\n * the aggregator sums per-pass counts). `attach: true` on the first pass so\n * the synthetic `__controller_seeding__` phase appears in `phaseResults`\n * exactly once; subsequent passes inherit `allPassed` for cascade-skip\n * semantics but don't double-attach.\n */\ninterface PreSeededInput {\n result: ControllerSeedingResult | null;\n attach: boolean;\n}\nimport type {\n A2ATaskEnvelope,\n AgentEntry,\n AssertionResult,\n BranchSetSpec,\n ContextProvenanceEntry,\n FixtureResolutionCoverageGap,\n FixtureResolutionRecord,\n HttpProbeResult,\n RunnerDetailedSkipReason,\n RunnerExtractionRecord,\n RunnerRequestRecord,\n RunnerResponseRecord,\n RunnerSelectionResult,\n RequirementName,\n RunnerSkipReason,\n RunnerNotice,\n RequiresCapabilityPredicate,\n ResponseNotApplicableGate,\n StepAuthDirective,\n Storyboard,\n StoryboardStep,\n StoryboardPhase,\n StoryboardContext,\n StoryboardRunOptions,\n StoryboardResult,\n StoryboardPassResult,\n StoryboardPhaseResult,\n StoryboardStepResult,\n StoryboardStepPreview,\n StoryboardValidation,\n StrictValidationSummary,\n SchemaValidationError,\n ValidationResult,\n RunnerTransport,\n} from './types';\nimport {\n buildRoutingContext,\n DiscoveryFailure,\n resolveAgentForStep,\n RoutingError,\n type AgentRoutingContext,\n} from './agent-routing';\nimport { DETAILED_SKIP_TO_CANONICAL, KNOWN_REQUIREMENTS } from './types';\nimport type { AgentProfile, TaskResult, TestStepResult } from '../types';\nimport {\n type AssertionContext,\n type AssertionSpec,\n resolveAssertions,\n stepDisablesAssertion,\n validateStepInvariants,\n} from './assertions';\n\n// ────────────────────────────────────────────────────────────\n// Runner-output contract helpers\n// ────────────────────────────────────────────────────────────\n\nconst SKIP_DETAILS: Record<RunnerSkipReason, string> = {\n not_applicable: 'Not applicable: agent did not declare the protocol or specialism this storyboard targets.',\n no_phases: 'Storyboard has no executable phases (placeholder).',\n prerequisite_failed: 'Skipped: a prerequisite step or contract did not pass.',\n missing_tool: 'Skipped: agent did not advertise the required tool.',\n missing_test_controller:\n 'Skipped: deterministic_testing phase requires comply_test_controller, which the agent did not advertise.',\n fixture_unavailable: 'Skipped: the runner test kit cannot synthesize a valid input for the seller-declared contract.',\n unsatisfied_contract: 'Skipped: test-kit contract is out of scope for this grading run.',\n requirement_unmet:\n 'Skipped: a requires: tag named a runtime requirement that is not available on this run (see RunnerSkipResult.requirement).',\n peer_branch_taken: 'Skipped: a peer branch in the same any_of branch set already contributed the aggregation flag.',\n peer_substituted: 'Skipped: a same-phase peer step established equivalent state via `provides_state_for`.',\n};\n\nconst CONTROLLER_SEEDING_FAILED_DETAIL =\n 'Skipped: pre-flight comply_test_controller seeding failed; the agent was not populated with the storyboard fixtures the remaining phases depend on.';\n\nconst FIXTURE_SEED_UNSUPPORTED_DETAIL =\n 'Skipped: pre-flight comply_test_controller seeding requires a seed_* scenario this agent does not implement (`fixture_seed_unsupported`).';\n\nconst OAUTH_NOT_ADVERTISED_DETAIL =\n 'Skipped: agent does not advertise OAuth — /.well-known/oauth-protected-resource returned 404 (RFC 9728 §3). API-key path must carry auth_mechanism_verified for this storyboard to pass.';\n\nexport function applyStoryboardVersionOptions(\n storyboard: Storyboard,\n options: StoryboardRunOptions\n): StoryboardRunOptions {\n const versioned = applyAdcpVersionRunOptions(storyboard.adcp_version, options);\n const mayInheritStoryboardDir = options.adcpVersion === undefined || options.adcpVersion === storyboard.adcp_version;\n const complianceDir =\n versioned.complianceDir ?? (mayInheritStoryboardDir ? trustedStoryboardComplianceRoot(storyboard) : undefined);\n return complianceDir && versioned.complianceDir !== complianceDir ? { ...versioned, complianceDir } : versioned;\n}\n\nexport function applyAdcpVersionRunOptions(\n defaultAdcpVersion: string | undefined,\n options: StoryboardRunOptions\n): StoryboardRunOptions {\n const adcpVersion = options.adcpVersion ?? defaultAdcpVersion;\n if (adcpVersion === undefined) return options;\n\n const versionEnvelope = options.versionEnvelope ?? storyboardVersionEnvelopeMode(adcpVersion);\n\n if (options.adcpVersion === adcpVersion && options.versionEnvelope === versionEnvelope) {\n return options;\n }\n return { ...options, adcpVersion, versionEnvelope };\n}\n\nfunction getRunSchemaRoot(options: StoryboardRunOptions): { adcpVersion: string; schemaRoot: string } | undefined {\n if (!options.schemaRoot) return undefined;\n const adcpVersion = options.adcpVersion ?? options._serverAdcpVersion;\n if (!adcpVersion) {\n throw new Error(\n 'schemaRoot requires an AdCP version. Pass adcpVersion, or run a storyboard/compliance bundle with adcp_version set.'\n );\n }\n return { adcpVersion, schemaRoot: options.schemaRoot };\n}\n\nfunction storyboardVersionEnvelopeMode(adcpVersion: string): VersionEnvelopeMode {\n const bundleKey = resolveBundleKey(adcpVersion);\n const major = parseAdcpMajorVersion(bundleKey);\n if (Number.isFinite(major) && major < 3) return 'none';\n return 'auto';\n}\n\n/**\n * Suffix appended to the skip detail when the sole-stateful-step exemption\n * fires (`not_applicable` / `missing_tool` / `missing_test_controller` on\n * the only stateful step in a phase, no `provides_state_for` rescue\n * declared). Adopters reading the report otherwise have to infer from the\n * absence of cascade-skips that the runner consciously chose not to\n * cascade — this marker makes the decision explicit.\n *\n * Pre-formatted phrase, parameterized only by phase id. Greppable via\n * `sole stateful step exemption applied`.\n */\nfunction soleStatefulExemptionDetail(phaseId: string): string {\n return ` Sole stateful step exemption applied for phase '${phaseId}': no peer could have established substitute state, so downstream phases run without cascade (adcp#4053, adcp-client#1146/#1545).`;\n}\n\n/**\n * Per-reason override strings for detailed skip reasons that want a more\n * specific message than the canonical fallback. Used only when the probe\n * itself didn't emit an error-style detail.\n */\nconst DETAILED_SKIP_DETAILS: Partial<Record<RunnerDetailedSkipReason, string>> = {\n oauth_not_advertised: OAUTH_NOT_ADVERTISED_DETAIL,\n controller_seeding_failed: CONTROLLER_SEEDING_FAILED_DETAIL,\n operator_skip: 'Step was excluded by request_signing.skipVectors.',\n rate_abuse_opt_out: 'Rate-abuse vector was excluded by request_signing.skipRateAbuse.',\n capability_profile_mismatch: 'Vector is outside the agent capability profile selected for this run.',\n transport_ungradable: 'Vector cannot be graded faithfully by the selected transport.',\n rate_limit_not_triggered: 'No RATE_LIMITED response was observed within the configured max_attempts.',\n};\n\n/**\n * Machine-readable detail values required by the AdCP report contract.\n * The probe's human-readable error remains available on the legacy response.\n */\nconst CANONICAL_SKIP_DETAILS: Partial<Record<RunnerDetailedSkipReason, string>> = {\n rate_limit_not_triggered: 'rate_limit_not_triggered',\n};\n\nconst REPLAY_WEBHOOK_VECTOR_TASK = 'replay_webhook_vector';\nconst REPLAY_TRUSTED_MATCH_CONTEXT_VECTOR_TASK = 'replay_trusted_match_context_vector';\nconst WEBHOOK_REPLAY_DEFAULT_TIMEOUT_MS = 10_000;\n\nfunction selectionForProbeSkip(reason: RunnerDetailedSkipReason, detail: string): RunnerSelectionResult | undefined {\n switch (reason) {\n case 'live_side_effect_opt_in_required':\n return { reason: 'run_mode_excluded', detail };\n case 'operator_skip':\n case 'rate_abuse_opt_out':\n return { reason: 'explicit_scope_excluded', detail };\n case 'not_in_only_vectors':\n case 'mcp_mode_flattens_url_edges':\n case 'capability_profile_mismatch':\n case 'transport_ungradable':\n return { reason: 'profile_excluded', detail };\n default:\n return undefined;\n }\n}\n\n/**\n * Walk a dotted key path (e.g. `\"adcp.idempotency.supported\"`) through a\n * nested object. Returns `undefined` when any segment is missing or the\n * intermediate value is not an object.\n *\n * Exported for direct testing. Inline copies of this logic in test code\n * silently drift from the runtime when edge cases (null prototypes,\n * Symbol keys, prototype-chain access) get tightened — testing the real\n * implementation forecloses that class of bug.\n */\nexport function resolveCapabilityPath(raw: unknown, dottedPath: string): unknown {\n const keys = dottedPath.split('.');\n let current: unknown = raw;\n for (const key of keys) {\n if (current === null || typeof current !== 'object') return undefined;\n if (!Object.prototype.hasOwnProperty.call(current, key)) return undefined;\n current = (current as Record<string, unknown>)[key];\n }\n return current;\n}\n\nconst GET_ADCP_CAPABILITIES_RESPONSE_SCHEMA_REF = 'protocol/get-adcp-capabilities-response.json';\n\nfunction resolveCapabilityPathForGate(\n raw: unknown,\n predicate: RequiresCapabilityPredicate,\n adcpVersion?: string\n): unknown {\n const actual = resolveCapabilityPath(raw, predicate.path);\n if (actual !== undefined) return actual;\n // `present:` is an absence-detection matcher — an absent field IS the\n // load-bearing signal. Materializing a schema default would make a defaulted\n // field never read as absent, silently flipping the gate (e.g. a signals\n // seller that omits `signals.discovery_modes`, default `[\"brief\"]`, would run\n // a `present: true`-gated scenario that should skip). Defaults are resolved\n // only for the value matchers (`equals` / `contains` / `not_contains`), where the default's\n // VALUE is what the gate tests.\n if ('present' in predicate) return undefined;\n if (!schemaDefaultShouldApply(raw, predicate.path)) return undefined;\n return getSchemaDefaultByPath(GET_ADCP_CAPABILITIES_RESPONSE_SCHEMA_REF, predicate.path, adcpVersion);\n}\n\nfunction schemaDefaultShouldApply(raw: unknown, dottedPath: string): boolean {\n const keys = dottedPath.split('.');\n if (keys.length <= 1) return raw !== null && typeof raw === 'object';\n\n let current: unknown = raw;\n for (const key of keys.slice(0, -1)) {\n if (current === null || typeof current !== 'object') return false;\n if (!Object.prototype.hasOwnProperty.call(current, key)) return false;\n current = (current as Record<string, unknown>)[key];\n }\n return current !== null && typeof current === 'object';\n}\n\n/**\n * Evaluate a `requires_capability` predicate against the value already\n * resolved from the agent's raw capabilities. Returns `null` when the\n * predicate is satisfied and a human-readable detail string when the\n * storyboard should be skipped.\n *\n * Four matcher forms — see `Storyboard.requires_capability` for full semantics:\n *\n * - `equals: V` — scalar equality. `actual` must be declared and must equal\n * `V`. Absent fields (`undefined`) skip unless the capabilities schema\n * declares a default that the gate materialized before predicate evaluation.\n *\n * - `present: B` — presence is the load-bearing signal. `present: true`\n * skips when the field is absent (treats `undefined` and `null` as absent).\n * `present: false` skips when the field is present. Empty object `{}`\n * counts as present, per the spec's \"presence of this object indicates\n * support\" wording. Note: an explicit `null` on the wire is technically\n * non-conformant for object-typed capabilities (`\"type\": \"object\"` rejects\n * null in JSON Schema), but is coalesced with absent here in the spirit of\n * Postel — agents that misdeclare a not-supported capability as `null`\n * get the same not_applicable skip as agents that omit the field. Schema\n * defaults are deliberately NOT materialized for this matcher: presence is\n * the signal, so a default would defeat the gate (see\n * `resolveCapabilityPathForGate`).\n *\n * - `contains: V` — array-membership. `actual` must be an array that\n * includes `V` (structural JSON equality, no coercion). Empty arrays, non-arrays,\n * and absent fields all skip unless the capabilities schema declares a\n * default that the gate materialized before predicate evaluation.\n *\n * - `not_contains: V` — negative array-membership. `actual` must be an array\n * that does not include `V` (structural JSON equality, no coercion). Missing and\n * non-array values skip; an empty array satisfies the predicate.\n *\n * Exported for direct testing so the predicate semantics are pinned without\n * needing a full runStoryboard() roundtrip.\n */\nexport function evaluateCapabilityPredicate(predicate: RequiresCapabilityPredicate, actual: unknown): string | null {\n if ('present' in predicate) {\n const isPresent = actual !== undefined && actual !== null;\n if (predicate.present && !isPresent) {\n return `Capability predicate \\`${predicate.path}\\` must be present: ` + `agent did not declare it.`;\n }\n if (!predicate.present && isPresent) {\n return (\n `Capability predicate \\`${predicate.path}\\` must be absent: ` + `agent declared ${JSON.stringify(actual)}.`\n );\n }\n return null;\n }\n if ('contains' in predicate) {\n if (!Array.isArray(actual)) {\n return (\n `Capability predicate \\`${predicate.path}\\` must contain ${JSON.stringify(predicate.contains)}: ` +\n `agent declared ${actual === undefined ? 'no value' : JSON.stringify(actual)}.`\n );\n }\n if (!actual.some(value => capabilityValuesEqual(value, predicate.contains))) {\n return (\n `Capability predicate \\`${predicate.path}\\` must contain ${JSON.stringify(predicate.contains)}: ` +\n `agent declared ${JSON.stringify(actual)}.`\n );\n }\n return null;\n }\n if ('not_contains' in predicate) {\n if (!Array.isArray(actual)) {\n return (\n `Capability predicate \\`${predicate.path}\\` must not contain ${JSON.stringify(predicate.not_contains)}: ` +\n `agent declared ${actual === undefined ? 'no value' : JSON.stringify(actual)}.`\n );\n }\n if (actual.some(value => capabilityValuesEqual(value, predicate.not_contains))) {\n return (\n `Capability predicate \\`${predicate.path}\\` must not contain ${JSON.stringify(predicate.not_contains)}: ` +\n `agent declared ${JSON.stringify(actual)}.`\n );\n }\n return null;\n }\n // `equals` form: absence means the agent did not declare the capability or\n // capability variant this storyboard tests, so skip as unsupported.\n if (actual === undefined) {\n return (\n `Capability predicate \\`${predicate.path} === ${JSON.stringify(predicate.equals)}\\` not satisfied: ` +\n `agent did not declare support.`\n );\n }\n if (actual !== undefined && actual !== predicate.equals) {\n return (\n `Capability predicate \\`${predicate.path} === ${JSON.stringify(predicate.equals)}\\` not satisfied: ` +\n `agent declared ${JSON.stringify(actual)}.`\n );\n }\n return null;\n}\n\n/** Key-order-insensitive equality for JSON-valued capability declarations. */\nfunction capabilityValuesEqual(a: unknown, b: unknown): boolean {\n if (a === b) return true;\n if (typeof a !== typeof b || a === null || b === null || typeof a !== 'object') return false;\n if (Array.isArray(a)) {\n if (!Array.isArray(b) || a.length !== b.length) return false;\n return a.every((value, index) => capabilityValuesEqual(value, b[index]));\n }\n if (Array.isArray(b)) return false;\n const aRecord = a as Record<string, unknown>;\n const bRecord = b as Record<string, unknown>;\n const aKeys = Object.keys(aRecord).sort();\n const bKeys = Object.keys(bRecord).sort();\n return (\n aKeys.length === bKeys.length &&\n aKeys.every((key, index) => key === bKeys[index] && capabilityValuesEqual(aRecord[key], bRecord[key]))\n );\n}\n\nfunction evaluateRequiresCapabilityGate(\n predicate: RequiresCapabilityPredicate,\n profile: AgentProfile | undefined,\n agentTools?: readonly string[],\n adcpVersion?: string\n): string | null {\n const rawCaps = profile?.raw_capabilities;\n if (rawCaps !== undefined) {\n const actual = resolveCapabilityPathForGate(rawCaps, predicate, adcpVersion);\n return evaluateCapabilityPredicate(predicate, actual);\n }\n // OAuth 3.2 grading is opt-in on the raw wire declaration. A normalized\n // profile or advertised get_adcp_capabilities tool is not evidence that the\n // agent asserted oauth.supported: true.\n if ('equals' in predicate && predicate.path === 'oauth.supported' && predicate.equals === true) {\n return evaluateCapabilityPredicate(predicate, undefined);\n }\n // The TMP publisher-auth storyboard is selected only by an explicit\n // experimental_features declaration. A normalized profile without the raw\n // capability payload is not evidence of that opt-in.\n if (\n 'contains' in predicate &&\n predicate.path === 'experimental_features' &&\n predicate.contains === 'trusted_match.core'\n ) {\n return evaluateCapabilityPredicate(predicate, undefined);\n }\n const tools = agentTools ?? profile?.tools;\n if ('equals' in predicate && tools !== undefined && !tools.includes('get_adcp_capabilities')) {\n return evaluateCapabilityPredicate(predicate, undefined);\n }\n return null;\n}\n\nfunction collectPhaseCapabilitySkipDetails(\n storyboard: Storyboard,\n profile: AgentProfile | undefined,\n agentTools?: readonly string[],\n adcpVersion?: string\n): Map<string, string> {\n const skipDetails = new Map<string, string>();\n for (const phase of storyboard.phases) {\n if (!phase.requires_capability) continue;\n const unmetDetail = evaluateRequiresCapabilityGate(phase.requires_capability, profile, agentTools, adcpVersion);\n if (unmetDetail !== null) {\n skipDetails.set(phase.id, unmetDetail);\n }\n }\n return skipDetails;\n}\n\nfunction allExecutablePhasesCapabilitySkipped(\n storyboard: Storyboard,\n phaseCapabilitySkipDetails: ReadonlyMap<string, string>\n): boolean {\n const executablePhases = storyboard.phases.filter(phase => phase.steps.length > 0);\n return executablePhases.length > 0 && executablePhases.every(phase => phaseCapabilitySkipDetails.has(phase.id));\n}\n\nfunction buildSkip(reason: RunnerSkipReason, detail?: string): { reason: RunnerSkipReason; detail: string } {\n return { reason, detail: detail ?? SKIP_DETAILS[reason] };\n}\n\ntype CreativeAssetFixtureUnavailableFailure = Extract<CreativeAssetExpansionFailure, { reason: 'fixture_unavailable' }>;\n\nfunction buildCreativeAssetFixtureUnavailableStep(\n step: StoryboardStep,\n phaseId: string,\n context: StoryboardContext,\n allSteps: FlatStep[],\n runState: ExecutionState,\n failure: CreativeAssetFixtureUnavailableFailure,\n task = step.task\n): StoryboardStepResult {\n const detail =\n `creative_asset_fixture_unavailable: slot \"${failure.slotId}\", asset type \"${failure.assetType}\", ` +\n `constraint: ${failure.constraint} (${failure.path})`;\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task,\n passed: true,\n skipped: true,\n skip_reason: 'fixture_unavailable',\n skip: buildSkip('fixture_unavailable', detail),\n duration_ms: 0,\n validations: [],\n context,\n next: getNextStepPreview(step.id, allSteps, context, runState.runnerVars),\n extraction: { path: 'none' },\n };\n}\n\ninterface ResponseDerivedSkip {\n detail: string;\n contextKeys: string[];\n}\n\nfunction detectResponseDerivedNotApplicable(\n step: StoryboardStep,\n request: Record<string, unknown>,\n response: unknown,\n runState?: ExecutionState,\n allSteps?: Array<{ step: StoryboardStep }>\n): ResponseDerivedSkip | null {\n if (response === undefined || response === null) return null;\n const gates = [\n ...normalizeResponseNotApplicableGates(step.not_applicable_if),\n ...inferImplicitResponseNotApplicableGates(step, request, runState, allSteps),\n ];\n for (const gate of gates) {\n if (gate.kind !== 'terminal_page') continue;\n if (!terminalPageGateMatches(gate, request, response)) continue;\n const detail =\n gate.detail ??\n `${gate.reason ?? 'single_page_result'}: ${step.task} response is terminal; cursor-walk not applicable`;\n return {\n detail,\n contextKeys: responseNotApplicableContextKeys(step, gate),\n };\n }\n return null;\n}\n\nfunction normalizeResponseNotApplicableGates(gates: StoryboardStep['not_applicable_if']): ResponseNotApplicableGate[] {\n if (!gates) return [];\n return Array.isArray(gates) ? gates : [gates];\n}\n\nfunction inferImplicitResponseNotApplicableGates(\n step: StoryboardStep,\n request: Record<string, unknown>,\n runState?: ExecutionState,\n allSteps?: Array<{ step: StoryboardStep }>\n): ResponseNotApplicableGate[] {\n // Back-compat for the already-published pagination_integrity_list_accounts\n // storyboard: it expresses the continuation requirement as validations\n // rather than a dedicated response-derived gate. Keep this narrowly scoped\n // to list_accounts so other seeded pagination storyboards do not silently\n // waive fixture/setup mistakes.\n if (step.task !== 'list_accounts') return [];\n const expectsContinuation = step.validations?.some(\n v => v.check === 'field_value' && v.path === 'pagination.has_more' && v.value === true\n );\n const capturesCursor = step.context_outputs?.some(o => o.path === 'pagination.cursor');\n const validatesCursor = step.validations?.some(v => v.check === 'field_present' && v.path === 'pagination.cursor');\n if (!expectsContinuation || (!capturesCursor && !validatesCursor)) return [];\n const maxResults = resolvePath(request, 'pagination.max_results');\n if (\n typeof maxResults === 'number' &&\n Number.isFinite(maxResults) &&\n hasUnrunAccountSeedExceedingPageSize(allSteps, runState, maxResults)\n ) {\n return [];\n }\n const setupAccounts = resolvePath(runState?.priorStepResults.get('sync_three_accounts')?.response, 'accounts');\n if (\n typeof maxResults === 'number' &&\n Number.isFinite(maxResults) &&\n Array.isArray(setupAccounts) &&\n setupAccounts.length > maxResults\n ) {\n return [];\n }\n return [{ kind: 'terminal_page', items_path: 'accounts', reason: 'single_page_result' }];\n}\n\nfunction hasUnrunAccountSeedExceedingPageSize(\n allSteps: Array<{ step: StoryboardStep }> | undefined,\n runState: ExecutionState | undefined,\n maxResults: number\n): boolean {\n return (\n allSteps?.some(({ step }) => {\n if (runState?.priorStepResults.has(step.id)) return false;\n if (step.task !== 'sync_accounts') return false;\n const accounts = resolvePath(step.sample_request, 'accounts');\n return Array.isArray(accounts) && accounts.length > maxResults;\n }) ?? false\n );\n}\n\nfunction terminalPageGateMatches(\n gate: Extract<ResponseNotApplicableGate, { kind: 'terminal_page' }>,\n request: Record<string, unknown>,\n response: unknown\n): boolean {\n const maxResults = resolvePath(request, gate.request_max_results_path ?? 'pagination.max_results');\n if (typeof maxResults !== 'number' || !Number.isFinite(maxResults) || maxResults <= 0) return false;\n\n const items = resolvePath(response, gate.items_path);\n if (!Array.isArray(items)) return false;\n\n const pagination = resolvePath(response, 'pagination');\n if (pagination === undefined || pagination === null) return items.length < maxResults;\n if (typeof pagination !== 'object' || Array.isArray(pagination)) return false;\n\n const p = pagination as Record<string, unknown>;\n if (p.has_more === true) return false;\n if (p.has_more !== false) return false;\n if (typeof p.total_count === 'number' && p.total_count > items.length) return false;\n if (items.length < maxResults) return true;\n return typeof p.total_count === 'number' && p.total_count <= items.length;\n}\n\nfunction responseNotApplicableContextKeys(\n step: StoryboardStep,\n gate: Extract<ResponseNotApplicableGate, { kind: 'terminal_page' }>\n): string[] {\n if (gate.context_keys?.length) return gate.context_keys;\n return (step.context_outputs ?? [])\n .filter(o => o.path === 'pagination.cursor')\n .map(o => o.key)\n .filter((key): key is string => typeof key === 'string' && key.length > 0);\n}\n\nfunction responseDerivedContextResult(\n runState: ExecutionState\n): Pick<StoryboardStepResult, 'response_derived_not_applicable_context_keys'> {\n const entries = runState.responseDerivedNotApplicableContextKeys;\n return entries && entries.size > 0\n ? { response_derived_not_applicable_context_keys: Object.fromEntries(entries) }\n : {};\n}\n\n/**\n * True for skip reasons that imply state genuinely never materialized\n * — no other code path could have established it. The runner trips\n * the cascade immediately on these. `missing_tool` and\n * `missing_test_controller` qualify: the agent doesn't advertise the\n * tool, end of story.\n *\n * `not_applicable` is intentionally NOT in this set even though F6's\n * first cut bundled it in. `not_applicable` means \"this path doesn't\n * apply to this agent\", which is consistent with \"a peer path in the\n * same phase establishes equivalent state\" — e.g. an explicit-mode\n * seller skips `sync_accounts` as not_applicable because\n * `list_accounts` is the canonical alternative for that account\n * shape. Tripping the cascade on the first not_applicable would\n * collapse this distinction and skip the substitute. The runner\n * therefore defers `not_applicable`'s cascade decision to phase end —\n * see `phasePendingNotApplicable` handling in the phase loop.\n */\nfunction isHardMissingStateSkipReason(reason: RunnerSkipReason | RunnerDetailedSkipReason | undefined): boolean {\n return reason === 'missing_tool' || reason === 'missing_test_controller';\n}\n\n/**\n * Resolve each phase's branch-set membership, combining explicit\n * `branch_set: { id, semantics }` declarations with the implicit detection\n * fallback the schema + adcp#2646 mandate: an `optional: true` phase with a\n * step declaring `contributes_to: <flag>` that matches a later\n * `assert_contribution check: any_of, allowed_values: [<flag>]` target is a\n * branch-set member even when the author hasn't migrated to the explicit\n * keyword. Explicit declarations take precedence. Returned map is keyed by\n * phase id; phases outside any branch set are absent from the map.\n *\n * First-match wins: if an optional phase has steps contributing to more\n * than one any_of flag, the earliest matching step (by storyboard\n * declaration order) decides the phase's branch-set membership. Authors\n * wanting a phase in multiple branch sets should declare `branch_set:`\n * explicitly — the implicit path does not synthesize multi-set membership.\n */\nfunction resolveBranchSets(storyboard: Storyboard): Map<string, BranchSetSpec> {\n const resolved = new Map<string, BranchSetSpec>();\n for (const phase of storyboard.phases) {\n if (phase.branch_set) resolved.set(phase.id, phase.branch_set);\n }\n const anyOfFlags = new Set<string>();\n for (const phase of storyboard.phases) {\n for (const step of phase.steps) {\n if (step.task !== 'assert_contribution') continue;\n for (const v of step.validations ?? []) {\n if (v.check !== 'any_of') continue;\n for (const flag of v.allowed_values ?? []) {\n if (typeof flag === 'string') anyOfFlags.add(flag);\n }\n }\n }\n }\n for (const phase of storyboard.phases) {\n if (resolved.has(phase.id)) continue;\n if (!phase.optional) continue;\n for (const step of phase.steps) {\n if (!step.contributes_to) continue;\n if (!anyOfFlags.has(step.contributes_to)) continue;\n resolved.set(phase.id, { id: step.contributes_to, semantics: 'any_of' });\n break;\n }\n }\n return resolved;\n}\n\n/**\n * Re-grade non-contributing branch-set peers per the `any_of` semantics in\n * storyboard-schema.yaml (\"Per-step grading in any_of branch patterns\").\n *\n * Runs after the main phase loop because peer contribution status isn't\n * knowable until all peer phases have executed. For every phase in a\n * branch set (explicit `branch_set:` declaration or implicit detection via\n * `resolveBranchSets`) whose flag was contributed by a different phase,\n * this phase's raw step failures are moot — the agent took the other\n * branch. Each such failed step is rewritten to a skipped result with\n * `skip_reason: 'peer_branch_taken'` and the detail string the\n * runner-output-contract mandates:\n *\n * \"<flag> contributed by <peer_phase_id>.<peer_step_id> — <this_phase_id> is moot\"\n *\n * The `<this_branch_id>` contract placeholder resolves to the non-chosen\n * peer's phase id — `branch_set.id` is shared across peers and could not\n * disambiguate. Only `any_of` semantics drives re-grading today; other\n * (reserved) values are rejected at parse in `validateBranchSet`.\n *\n * `countedAsFailed` names step results the main loop added to `failedCount`\n * as hard failures — either non-optional phases or the `presenceDetected`\n * PRM 2xx path (adcp-client#677: \"an agent that serves PRM MUST serve it\n * correctly\"). These stand: re-grading them would paper over the exact\n * invariants the hard-failure paths exist to enforce. The post-pass only\n * relabels swallowed optional-phase failures, which by construction are not\n * in `countedAsFailed`.\n */\nfunction applyBranchSetGrading(\n phases: StoryboardPhase[],\n phaseResults: StoryboardPhaseResult[],\n branchSetByPhaseId: Map<string, BranchSetSpec>,\n contributions: Set<string>,\n contributionSources: Map<string, { phaseId: string; stepId: string }>,\n countedAsFailed: Set<StoryboardStepResult>\n): { skippedDelta: number } {\n let skippedDelta = 0;\n for (let i = 0; i < phases.length; i++) {\n const phaseDef = phases[i];\n const phaseResult = phaseResults[i];\n if (!phaseDef || !phaseResult) continue;\n const branchSet = branchSetByPhaseId.get(phaseDef.id);\n if (!branchSet) continue;\n if (branchSet.semantics !== 'any_of') continue;\n const flag = branchSet.id;\n if (!contributions.has(flag)) continue;\n const source = contributionSources.get(flag);\n if (!source || source.phaseId === phaseDef.id) continue;\n const detail = `${flag} contributed by ${source.phaseId}.${source.stepId} — ${phaseDef.id} is moot`;\n let regraded = false;\n for (const step of phaseResult.steps) {\n if (step.passed || step.skipped) continue;\n if (countedAsFailed.has(step)) continue;\n step.passed = true;\n step.skipped = true;\n step.skip_reason = 'peer_branch_taken';\n step.skip = { reason: 'peer_branch_taken', detail };\n delete step.error;\n delete step.adcp_error;\n skippedDelta++;\n regraded = true;\n }\n if (regraded) {\n phaseResult.passed = phaseResult.steps.every(s => s.passed || s.skipped);\n }\n }\n return { skippedDelta };\n}\n\n// ────────────────────────────────────────────────────────────\n// task_completion. context_outputs path resolution\n// ────────────────────────────────────────────────────────────\n\n/** Marker prefix on `context_outputs.path` that opts a capture into the\n * poll-tasks-get-for-the-completion-artifact resolution flow. The remainder\n * of the path is resolved against the artifact's `data`, not the immediate\n * submitted envelope. */\nconst TASK_COMPLETION_PATH_PREFIX = 'task_completion.';\n\n/** Hard cap on how long the runner blocks one step waiting for a task to\n * reach terminal state. Long enough to cover most HITL approval flows that\n * are expected to complete inline; short enough that a stuck task surfaces\n * the failure on the step that authored the dependency rather than the\n * storyboard wall-clock budget. Override with `STORYBOARD_TASK_POLL_TIMEOUT_MS`. */\nconst TASK_COMPLETION_DEFAULT_TIMEOUT_MS = 30_000;\n\n/** Per-poll cadence inside `pollTaskCompletion`. Scaled tight enough that\n * short HITL flows complete in a couple of polls; the bound is still the\n * outer timeout race. Override with `STORYBOARD_TASK_POLL_INTERVAL_MS`. */\nconst TASK_COMPLETION_DEFAULT_POLL_INTERVAL_MS = 1_500;\n\n/** Defensive task_id pattern. AdCP doesn't constrain `task_id` shape on the\n * wire, but unbounded strings are an SSRF / log-injection lever — we cap\n * the length and reject control characters before the value reaches the\n * SDK's tasks/get JSON-RPC param. */\nconst TASK_ID_MAX_LEN = 256;\n// eslint-disable-next-line no-control-regex -- intentional: reject control chars in task_id\nconst TASK_ID_CONTROL_CHAR_RE = /[\\x00-\\x1F\\x7F]/;\n\n/** Non-terminal task statuses that carry a `task_id` and warrant polling\n * the artifact for `task_completion.<inner>` captures. Per the AdCP\n * `tasks-get-response.json` enum, all three are explicitly non-terminal:\n * `submitted` (HITL or async-signed-IO), `working` (\"expect completion\n * within 120 seconds\"), and `input-required` (waiting on the buyer to\n * supply additional info — relevant when the storyboard test harness\n * satisfies the input requirement). The 30s default poll timeout still\n * bounds the worst case for storyboards that test these arms directly. */\nconst POLL_ELIGIBLE_STATUSES = new Set(['submitted', 'working', 'input-required']);\n\ninterface PollEligibleEnvelopeShape {\n status: 'submitted' | 'working' | 'input-required';\n task_id: string;\n}\n\n/**\n * Clear retained A2A session state (`contextId`, `pendingTaskId`) on each\n * shared client at the start of a storyboard run. AgentClient is documented\n * as one-instance-per-conversation; `comply()` reuses a single instance\n * across every storyboard for transport caching, so the runner has to\n * re-establish the \"fresh conversation\" boundary per storyboard. Without\n * this, a stale `pendingTaskId` from a prior storyboard's non-terminal\n * step rides into this storyboard's first call and the seller surfaces\n * \"Task <uuid> not found\". See adcp-client#1585.\n *\n * Calls go through a duck-typed `resetContext()` accessor so the helper\n * stays compatible with adapter-built clients that don't subclass\n * AgentClient directly.\n */\nfunction resetClientSessions(clients: readonly TestClient[]): void {\n for (const client of clients) {\n const reset = (client as unknown as { resetContext?: () => void }).resetContext;\n if (typeof reset === 'function') reset.call(client);\n }\n}\n\nfunction isPollEligibleEnvelope(data: unknown): data is PollEligibleEnvelopeShape {\n if (data == null || typeof data !== 'object') return false;\n const obj = data as { status?: unknown; task_id?: unknown };\n return (\n typeof obj.status === 'string' &&\n POLL_ELIGIBLE_STATUSES.has(obj.status) &&\n typeof obj.task_id === 'string' &&\n obj.task_id.length > 0\n );\n}\n\nfunction isValidTaskId(taskId: string): boolean {\n if (taskId.length === 0 || taskId.length > TASK_ID_MAX_LEN) return false;\n if (TASK_ID_CONTROL_CHAR_RE.test(taskId)) return false;\n return true;\n}\n\ninterface TaskCompletionResolution {\n /** Discriminator: was the resolution attempted? `false` short-circuits\n * the runner back to plain extraction against the immediate response. */\n attempted: boolean;\n /** Artifact data resolved by polling. Present (including `undefined`)\n * ONLY when polling succeeded — caller uses `'data' in resolution` to\n * distinguish \"polled and got undefined\" from \"did not poll.\" */\n data?: unknown;\n /** Set when the bounded poll exceeded `pollTimeoutMs`. The runner uses\n * this to flip the synthesized failure check from\n * `capture_path_not_resolvable` to `capture_poll_timeout`. */\n timedOut?: boolean;\n pollTimeoutMs?: number;\n /** Set when polling reached terminal state with `success: false`\n * (failed / canceled / rejected). The runner flips the synthesized\n * failure check to `capture_task_failed` so reports distinguish\n * \"field absent on artifact\" from \"task itself terminally failed.\" */\n taskFailed?: boolean;\n}\n\nfunction remapTaskCompletionOutputs<T extends { path?: string | undefined }>(outputs: readonly T[]): T[] {\n return outputs.map(o => {\n if (typeof o.path === 'string' && o.path.startsWith(TASK_COMPLETION_PATH_PREFIX)) {\n return { ...o, path: o.path.slice(TASK_COMPLETION_PATH_PREFIX.length) };\n }\n return o;\n });\n}\n\nasync function resolveTaskCompletionOutputs(\n taskResult: TaskResult | undefined,\n outputs: readonly { path?: string | undefined }[],\n client: TestClient,\n webhookReceiver: WebhookReceiver | undefined,\n originatingTaskName: string\n): Promise<TaskCompletionResolution> {\n const hasTaskCompletionPath = outputs.some(\n o => typeof o.path === 'string' && o.path.startsWith(TASK_COMPLETION_PATH_PREFIX)\n );\n if (!hasTaskCompletionPath) return { attempted: false };\n if (!taskResult || !isPollEligibleEnvelope(taskResult.data)) return { attempted: false };\n const taskId = taskResult.data.task_id;\n if (!isValidTaskId(taskId)) return { attempted: false };\n\n const timeoutMs = readEnvIntOrDefault(\n process.env['STORYBOARD_TASK_POLL_TIMEOUT_MS'],\n TASK_COMPLETION_DEFAULT_TIMEOUT_MS\n );\n const pollIntervalMs = readEnvIntOrDefault(\n process.env['STORYBOARD_TASK_POLL_INTERVAL_MS'],\n TASK_COMPLETION_DEFAULT_POLL_INTERVAL_MS\n );\n\n // The SDK's `pollTaskCompletion` lives on the executor — accessed via the\n // SingleAgentClient instance the storyboard runner created in\n // `getOrCreateClient`. The runner historically uses `client: any` for\n // dynamic dispatch (see task-map.ts:80) so this cast doesn't widen\n // existing surface.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- dynamic SDK access\n const dynamicClient = client as any;\n const executor = dynamicClient?.executor;\n const agent = dynamicClient?.agent;\n const canPoll = !!(executor?.pollTaskCompletion && agent);\n const canWebhook = !!webhookReceiver;\n if (!canPoll && !canWebhook) return { attempted: false };\n\n type PollWin = { kind: 'poll'; result: TaskResult };\n type WebhookWin = { kind: 'webhook'; result: WebhookWaitResult };\n type TimeoutWin = { kind: 'timeout' };\n type Winner = PollWin | WebhookWin | TimeoutWin;\n\n const racers: Promise<Winner>[] = [];\n\n // Poll path. An AbortSignal tied to the same `timeoutMs` budget is passed\n // to `pollTaskCompletion` so the inner loop exits as soon as the outer race\n // timer fires — no orphaned `tasks/get` requests survive the step boundary.\n // (adcp-client#1612: previously the loop ran indefinitely after the outer\n // timeout resolved, accumulating background A2A calls that consumed the\n // full comply() budget.)\n if (canPoll) {\n const pollSignal = AbortSignal.timeout(timeoutMs);\n racers.push(\n executor.pollTaskCompletion(agent, taskId, pollIntervalMs, undefined, pollSignal).then(\n (result: TaskResult): PollWin => ({\n kind: 'poll',\n result,\n })\n )\n );\n }\n\n // Webhook path. Per `tasks-get-response.json`, sellers MAY use webhook-\n // only HITL completion (no polling). When a `--webhook-receiver` is\n // active, race the receiver's `wait` (filtered by `task_id`) against\n // the poll. The webhook payload's `result` field is the artifact's\n // `data` (per the framework's task webhook payload shape, mirroring\n // the HITL completion shape from `from-platform.ts`).\n //\n // Note: `webhook.wait` keeps an internal `setTimeout(timeout_ms)` that\n // we can't cancel from here. When the poll wins or the outer timeout\n // fires first, that internal timer continues until `timeout_ms`\n // elapses. Acceptable because the receiver is process-scoped (closed\n // on storyboard exit) and runner-owned receivers aren't injected.\n if (webhookReceiver) {\n racers.push(\n webhookReceiver\n .wait({ body: { task_id: taskId } }, timeoutMs)\n .then((result): WebhookWin => ({ kind: 'webhook', result }))\n );\n }\n\n let timer: NodeJS.Timeout | undefined;\n const timeoutRacer = new Promise<TimeoutWin>(resolve => {\n timer = setTimeout(() => resolve({ kind: 'timeout' }), timeoutMs);\n // Don't keep the event loop alive on this handle — the runner's\n // wall-clock budget is already enforced by the storyboard runner\n // shell, and a hung task shouldn't delay process exit by `timeoutMs`.\n timer.unref?.();\n });\n racers.push(timeoutRacer);\n\n try {\n const winner = await Promise.race(racers);\n if (winner.kind === 'timeout') {\n return { attempted: true, timedOut: true, pollTimeoutMs: timeoutMs };\n }\n if (winner.kind === 'poll') {\n const polled = winner.result;\n if (polled.success === false) return { attempted: true, taskFailed: true };\n return { attempted: true, data: normalizeTaskCompletionData(polled.data, originatingTaskName) };\n }\n // Webhook win.\n const waitResult = winner.result;\n if (waitResult.timed_out) {\n return { attempted: true, timedOut: true, pollTimeoutMs: timeoutMs };\n }\n const webhookBody = waitResult.webhook.body as { status?: unknown; result?: unknown } | undefined;\n // Fail-closed on the success path: require `status === 'completed'`.\n // The framework's `buildTaskWebhookPayload` always emits `status`, so a\n // missing or non-completed value means either a malformed webhook or a\n // genuine terminal-failed/canceled/rejected outcome — both should\n // attribute to `capture_task_failed`, not silently fall through to a\n // capture against an undefined `result`.\n if (webhookBody?.status === 'completed') {\n return { attempted: true, data: normalizeTaskCompletionData(webhookBody.result, originatingTaskName) };\n }\n return { attempted: true, taskFailed: true };\n } catch {\n return { attempted: true, taskFailed: true };\n } finally {\n if (timer) clearTimeout(timer);\n }\n}\n\nfunction normalizeTaskCompletionData(data: unknown, taskName: string): unknown {\n if (data == null || typeof data !== 'object' || Array.isArray(data)) return data;\n const original = data as Record<string, unknown>;\n const compat = injectLegacyEnvelopeStatus(original, { toolName: taskName });\n if (!('status' in original) && 'status' in compat) {\n const { status: _status, ...rest } = compat;\n return normalizeLegacyMediaBuyStatusForReturn(rest, { toolName: taskName });\n }\n if (\n (taskName === 'create_media_buy' || taskName === 'update_media_buy') &&\n typeof original.status === 'string' &&\n compat.status === 'completed' &&\n typeof compat.media_buy_status === 'string'\n ) {\n return normalizeLegacyMediaBuyStatusForReturn({ ...compat, status: original.status }, { toolName: taskName });\n }\n return normalizeLegacyMediaBuyStatusForReturn(compat, { toolName: taskName });\n}\n\nfunction readEnvIntOrDefault(value: string | undefined, fallback: number): number {\n if (!value) return fallback;\n const parsed = Number.parseInt(value, 10);\n if (!Number.isFinite(parsed) || parsed <= 0) return fallback;\n return parsed;\n}\n\nfunction extractionFromTaskResult(taskResult: TaskResult | undefined): RunnerExtractionRecord {\n if (!taskResult) return { path: 'none' };\n // Prefer the explicit provenance stamped by the response unwrapper / raw\n // MCP probe. Fall back to inference only when the tag is missing (e.g.,\n // synthetic TaskResults built by validation harnesses).\n if (taskResult._extraction_path !== undefined) return { path: taskResult._extraction_path };\n if (!taskResult.success && taskResult.error) return { path: 'error' };\n return taskResult.data !== undefined && taskResult.data !== null ? { path: 'structured_content' } : { path: 'none' };\n}\n\nexport function __redactSecretsForTest(value: unknown): unknown {\n return redactSecrets(value);\n}\n\nexport function __filterResponseHeadersForTest(\n headers: Record<string, string> | undefined\n): Record<string, string> | undefined {\n return filterResponseHeaders(headers);\n}\n\nexport function __defaultAuthHeadersForRawProbeForTest(\n options: StoryboardRunOptions\n): Record<string, string> | undefined {\n return defaultAuthHeadersForRawProbe(options);\n}\n\n/**\n * Response headers to echo on a RunnerResponseRecord. Everything else is\n * dropped — agents can (and do) include `set-cookie`, echoed `authorization`,\n * reverse-proxy breadcrumbs (`x-amz-*`, `x-azure-*`, `x-internal-*`) that a\n * hostile agent could use to bait us into publishing internal state in a\n * shared compliance report.\n */\nconst RESPONSE_HEADER_ALLOWLIST = new Set([\n 'content-type',\n 'content-length',\n 'content-encoding',\n 'www-authenticate',\n 'location',\n 'retry-after',\n 'x-request-id',\n 'x-correlation-id',\n]);\n\nfunction filterResponseHeaders(headers: Record<string, string> | undefined): Record<string, string> | undefined {\n if (!headers) return undefined;\n const out: Record<string, string> = {};\n for (const [k, v] of Object.entries(headers)) {\n const lower = k.toLowerCase();\n if (RESPONSE_HEADER_ALLOWLIST.has(lower)) {\n out[lower] = lower === 'location' ? redactOAuthUrlForOutput(v) : v;\n }\n }\n return Object.keys(out).length > 0 ? out : undefined;\n}\n\n// ────────────────────────────────────────────────────────────\n// runStoryboard: execute all phases/steps\n// ────────────────────────────────────────────────────────────\n\n/**\n * Run an entire storyboard against an agent.\n *\n * Pass a single URL for the standard single-instance run. Pass an array of\n * URLs to engage multi-instance mode: the runner round-robins each step\n * across the provided URLs so that (brand, account)-scoped state created on\n * one instance must be visible on the next. Sellers whose state lives only\n * in-process will fail this mode — the failure signature is a prior write\n * succeeding on instance A while a subsequent read returns NOT_FOUND or\n * empty on instance B.\n */\nexport async function runStoryboard(\n agentUrlOrUrls: string | string[],\n storyboard: Storyboard,\n options: StoryboardRunOptions = {}\n): Promise<StoryboardResult> {\n return withMCPConnectionScope(\n async () => {\n options = applyStoryboardVersionOptions(storyboard, options);\n // adcp#6735 — a declared prerequisites.test_kit is a loading directive,\n // not decoration: resolve it into options.test_kit (caller-supplied\n // kits win) so from_test_kit / $test_kit.* references get the\n // credential the storyboard was authored against.\n options = resolveDeclaredTestKit(storyboard, options);\n options = { ...options, transport: normalizeTransportOptions(options.transport) };\n const schemaRoot = getRunSchemaRoot(options);\n if (schemaRoot) {\n return await withExternalSchemaRoot(schemaRoot.adcpVersion, schemaRoot.schemaRoot, () =>\n runStoryboardBody(agentUrlOrUrls, storyboard, options)\n );\n }\n return await runStoryboardBody(agentUrlOrUrls, storyboard, options);\n },\n { isolate: true }\n );\n}\n\nasync function runStoryboardBody(\n agentUrlOrUrls: string | string[],\n storyboard: Storyboard,\n options: StoryboardRunOptions\n): Promise<StoryboardResult> {\n validateTestKit(options.test_kit);\n // Enforce authoring-time branch_set invariants regardless of how the\n // storyboard reached us. YAML callers already ran these rules in\n // parseStoryboard; programmatic callers (hand-built Storyboard objects or\n // alternative YAML loaders) reach this point without the loader having\n // fired, and the runtime's grading depends on the invariants holding.\n // `validateStoryboardShape` is idempotent so the double-pass is safe.\n validateStoryboardShape(storyboard);\n\n // Per-specialism routing (#1066). Mutually exclusive with replica-array\n // dispatch and `_client`. Validate the shape of `options.agents` here so\n // misconfigured callers fail fast with a clear error rather than getting\n // silently routed to the first URL or a stale single-agent client.\n if (options.agents !== undefined) {\n validateAgentsMap(agentUrlOrUrls, storyboard, options);\n }\n\n const agentUrls = Array.isArray(agentUrlOrUrls) ? agentUrlOrUrls : [agentUrlOrUrls];\n if (!options.agents && agentUrls.length === 0) {\n throw new Error('runStoryboard: at least one agent URL required');\n }\n\n const isMultiInstance = agentUrls.length > 1;\n if (isMultiInstance && options._client) {\n throw new Error(\n 'runStoryboard: _client override is incompatible with multi-instance mode. ' +\n 'Remove _client (or pass a single agent URL) to use round-robin dispatch.'\n );\n }\n\n // When capabilities are already available, applicability MUST be evaluated\n // before runtime requirements. Without a profile we defer both gates until\n // executeStoryboardPass has completed discovery; reporting a missing runner\n // adapter before learning that the agent never claimed the capability would\n // incorrectly turn not_applicable into requirement_unmet.\n const deferCapabilityAndRequires = storyboard.requires_capability !== undefined && options._profile === undefined;\n if (storyboard.requires_capability && !deferCapabilityAndRequires) {\n const unmetDetail = evaluateRequiresCapabilityGate(\n storyboard.requires_capability,\n options._profile,\n options.agentTools,\n options.adcpVersion\n );\n if (unmetDetail !== null) {\n const resultAgentUrls = options.agents ? Object.values(options.agents).map(e => e.url) : agentUrls;\n return {\n ...buildCapabilityUnsupportedResult(resultAgentUrls, storyboard, unmetDetail),\n notices: collectCapabilityNotices(storyboard, options._profile),\n };\n }\n }\n\n // Runtime gates still run before either multi-instance strategy when they\n // can be evaluated faithfully, so a missing harness remains one whole-\n // storyboard skip instead of being multiplied across passes.\n const allRequires = resolveStoryboardRequires(storyboard, options);\n if (allRequires.length && !deferCapabilityAndRequires) {\n const requirementCheck = await checkRequires(allRequires, storyboard, options, options._profile);\n if ('requirement' in requirementCheck) {\n const resultAgentUrls = options.agents ? Object.values(options.agents).map(e => e.url) : agentUrls;\n return {\n ...buildRequirementUnmetResult(\n resultAgentUrls,\n storyboard,\n requirementCheck.requirement,\n requirementCheck.detail\n ),\n notices: collectCapabilityNotices(storyboard, options._profile),\n };\n }\n if (requirementCheck.preparedPublisherAuthProbes) {\n options = withPreparedTrustedMatchPublisherAuth(options, requirementCheck.preparedPublisherAuthProbes);\n }\n }\n\n const requestedStrategy = options.multi_instance_strategy ?? 'round-robin';\n if (requestedStrategy === 'multi-pass' && isMultiInstance) {\n // Webhook receivers bind a fresh ephemeral port per pass. Each pass would\n // advertise a different URL via `{{runner.webhook_base}}`; agents caching\n // the pass-1 URL would deliver into a dead port in pass 2. Reject rather\n // than silently mis-route. The spec-correct test for webhook retry /\n // idempotency is one pass.\n if (options.webhook_receiver) {\n throw new Error(\n 'runStoryboard: webhook_receiver is incompatible with multi_instance_strategy: \"multi-pass\". ' +\n 'Each pass would bind a fresh receiver URL, so agents caching the pass-1 URL would deliver ' +\n 'to a dead port in pass 2. Use round-robin when the storyboard needs a webhook receiver, ' +\n 'or run multi-pass on a storyboard without webhook observation.'\n );\n }\n return runMultiPass(agentUrls, storyboard, options);\n }\n\n if (options.agents) {\n // Project the agents map's URLs into the legacy `agentUrls` array so\n // downstream signatures (per-step `agent_url:` records, etc.) keep\n // working unchanged. The routing dispatcher inside\n // `executeStoryboardPass` reads `options.agents` directly for the\n // actual per-tool routing.\n const projected = Object.values(options.agents).map(e => e.url);\n return executeStoryboardPass(projected, storyboard, options, 0);\n }\n return executeStoryboardPass(agentUrls, storyboard, options, 0);\n}\n\n/**\n * Validate the shape and consistency of `StoryboardRunOptions.agents` (#1066).\n *\n * Catches the failure modes that would otherwise surface as confusing\n * runtime errors deep inside discovery or dispatch:\n *\n * - empty map\n * - `default_agent` referencing an unknown key\n * - `step.agent` referencing an unknown key\n * - co-existence with `multi_instance_strategy` (replicas, different concept)\n * - co-existence with `_client` (single client cannot serve multiple agents)\n * - first positional arg passed alongside the map (ambiguous routing intent)\n */\nfunction validateAgentsMap(\n agentUrlOrUrls: string | string[],\n storyboard: Storyboard,\n options: StoryboardRunOptions\n): void {\n const agents = options.agents!;\n const keys = Object.keys(agents);\n if (keys.length === 0) {\n throw new Error(\n 'runStoryboard: `agents` is set but contains no entries. ' + 'Either remove the key or supply at least one agent.'\n );\n }\n for (const key of keys) {\n const entry = agents[key];\n if (!entry || typeof entry.url !== 'string' || entry.url === '') {\n throw new Error(\n `runStoryboard: agents['${key}'] missing a non-empty \\`url\\`. ` + 'Each entry must declare its endpoint URL.'\n );\n }\n }\n\n if (options.default_agent !== undefined && !(options.default_agent in agents)) {\n throw new Error(\n `runStoryboard: \\`default_agent\\` \"${options.default_agent}\" is not a key in \\`agents\\`. ` +\n `Available keys: ${keys.join(', ')}.`\n );\n }\n\n // Per-step `agent:` overrides must reference an agent that's actually in\n // the map. Walk the storyboard once at entry so authoring errors surface\n // before the first network call.\n for (const phase of storyboard.phases ?? []) {\n for (const step of phase.steps ?? []) {\n if (step.agent !== undefined && !(step.agent in agents)) {\n throw new Error(\n `runStoryboard: step \"${step.id}\" declares \\`agent: \"${step.agent}\"\\` but ` +\n `that key is not in the agents map. Available keys: ${keys.join(', ')}.`\n );\n }\n }\n }\n\n if (options.multi_instance_strategy !== undefined) {\n throw new Error(\n 'runStoryboard: `agents` (per-specialism routing) is incompatible with ' +\n '`multi_instance_strategy` (replica round-robin). They are different concepts — ' +\n 'replicas test horizontal scaling of one agent, the agents map routes per tool ' +\n 'across different agents. Use one or the other.'\n );\n }\n if (options._client) {\n throw new Error(\n 'runStoryboard: `agents` is incompatible with `_client` override. ' +\n 'A single client cannot serve multiple agents; per-agent clients are ' +\n 'constructed from the map.'\n );\n }\n\n // Controller seeding (`prerequisites.controller_seeding: true`) currently\n // dispatches against the FIRST per-agent client only, which works for\n // single-tenant runs but is the wrong shape under routed mode: a\n // cross-specialism storyboard's `fixtures:` block typically declares\n // seeds owned by different tenants (e.g., `seed_product` for sales,\n // `seed_signal_provider` for signals). Per-tenant seed dispatch is a\n // larger change tracked separately. Until that lands, fail-fast and\n // tell the operator to seed each tenant out-of-band and pass\n // `skip_controller_seeding: true`.\n if (storyboard.prerequisites?.controller_seeding === true && options.skip_controller_seeding !== true) {\n throw new Error(\n 'runStoryboard: `agents` + `prerequisites.controller_seeding: true` is not yet supported. ' +\n 'Controller seeding currently targets a single tenant; cross-tenant seed routing is a ' +\n 'follow-up. Pre-seed each tenant out-of-band and pass `skip_controller_seeding: true` to ' +\n 'opt out of the runner-side seeding loop.'\n );\n }\n\n // First positional arg must be empty when `agents` is set. Allowing a\n // non-empty value is ambiguous: is the map authoritative, or is the\n // positional arg a hidden default? Reject and require the caller to\n // express intent through `agents` + `default_agent`.\n const firstArgEmpty = agentUrlOrUrls === '' || (Array.isArray(agentUrlOrUrls) && agentUrlOrUrls.length === 0);\n if (!firstArgEmpty) {\n throw new Error(\n 'runStoryboard: pass `\"\"` (or `[]`) as the first argument when using ' +\n '`options.agents`. The agents map is authoritative for routing; mixing ' +\n 'a positional URL with the map is ambiguous.'\n );\n }\n}\n\n/**\n * Build a minimal StoryboardResult for a storyboard skipped by a\n * `requires_capability` predicate. The single synthetic step carries\n * `skip_reason: 'capability_unsupported'` so CLI reports and JUnit\n * consumers render it as a skip rather than a pass or failure.\n */\nfunction buildCapabilityUnsupportedResult(\n agentUrls: string[],\n storyboard: Storyboard,\n detail: string\n): StoryboardResult {\n const syntheticStep: StoryboardStepResult = {\n storyboard_id: storyboard.id,\n step_id: 'capability_unsupported',\n phase_id: 'capability_unsupported',\n title: 'Storyboard skipped: capability not supported by this agent',\n task: '',\n passed: true,\n skipped: true,\n skip_reason: 'capability_unsupported',\n skip: { reason: DETAILED_SKIP_TO_CANONICAL.capability_unsupported, detail },\n duration_ms: 0,\n validations: [],\n context: {},\n error: detail,\n extraction: { path: 'none' },\n };\n return {\n storyboard_id: storyboard.id,\n storyboard_title: storyboard.title,\n agent_url: redactOAuthUrlForOutput(agentUrls[0]!),\n overall_passed: true,\n phases: [\n {\n phase_id: 'capability_unsupported',\n phase_title: 'Capability unsupported',\n passed: true,\n steps: [syntheticStep],\n duration_ms: 0,\n },\n ],\n context: {},\n total_duration_ms: 0,\n // This synthetic phase is an applicability gate, not a real passed\n // scenario. `overall_passed: true` preserves non-failing CI semantics,\n // while passed_count stays 0 so rollups do not report unexecuted\n // storyboards as successful coverage.\n passed_count: 0,\n failed_count: 0,\n skipped_count: 1,\n runner_capability_version: RUNNER_CAPABILITY_VERSION,\n tested_at: new Date().toISOString(),\n strict_validation_summary: {\n observable: false,\n checked: 0,\n passed: 0,\n failed: 0,\n strict_only_failures: 0,\n lenient_also_failed: 0,\n },\n notices: [],\n };\n}\n\nfunction buildPhaseCapabilitySkippedSteps(\n storyboard: Storyboard,\n phase: StoryboardPhase,\n detail: string,\n context: StoryboardContext\n): StoryboardStepResult[] {\n return phase.steps.map(step => ({\n storyboard_id: storyboard.id,\n step_id: step.id,\n phase_id: phase.id,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: 'not_applicable',\n skip: { reason: 'not_applicable', detail },\n duration_ms: 0,\n validations: [],\n context,\n error: detail,\n extraction: { path: 'none' },\n }));\n}\n\n/**\n * Map a `requires:` requirement onto the canonical `RunnerSkipReason` to\n * emit when that requirement is unmet. `controller` reuses the existing\n * `missing_test_controller` value so back-compat consumers (skip-cause\n * aggregators, dashboards keyed on the existing string) keep grouping\n * controller-driven skips into the same bucket they already track. Other\n * requirements use the new `requirement_unmet` reason; consumers that\n * want per-requirement granularity read `RunnerSkipResult.requirement`.\n *\n * Spec: adcp-client#1626 (no-rename design — keep existing skip_reason\n * values stable as the back-compat surface; add `requirement_unmet` only\n * for requirement names that have no existing canonical reason).\n */\nconst REQUIREMENT_TO_SKIP_REASON: Record<RequirementName, RunnerSkipReason> = {\n controller: 'missing_test_controller',\n seeded_state: 'requirement_unmet',\n real_wire: 'requirement_unmet',\n webhook_receiver: 'requirement_unmet',\n webhook_replay_receiver: 'not_applicable',\n trusted_match_context_router_runner: 'not_applicable',\n trusted_match_publisher_auth_runner: 'requirement_unmet',\n request_signer: 'not_applicable',\n multi_agent: 'requirement_unmet',\n};\n\nfunction isKnownRequirement(requirement: string): requirement is RequirementName {\n return KNOWN_REQUIREMENTS.has(requirement as RequirementName);\n}\n\n/**\n * Build a minimal StoryboardResult for a storyboard skipped because a\n * `requires:` tag named a requirement that isn't available on this run\n * (e.g. `controller` when the agent doesn't advertise\n * `comply_test_controller`, or `seeded_state` when the operator didn't\n * pass `--asserts-seeded-state`). Mirrors `buildCapabilityUnsupportedResult`\n * but carries the structured `requirement` field so consumers can group\n * not-applicable scenarios by cause. Spec: adcp-client#1626.\n */\nfunction buildRequirementUnmetResult(\n agentUrls: string[],\n storyboard: Storyboard,\n requirement: string,\n detail: string\n): StoryboardResult {\n const reason = isKnownRequirement(requirement) ? REQUIREMENT_TO_SKIP_REASON[requirement] : 'requirement_unmet';\n const syntheticStep: StoryboardStepResult = {\n storyboard_id: storyboard.id,\n step_id: `requirement_unmet:${requirement}`,\n phase_id: 'requirement_unmet',\n title: `Storyboard skipped: requires '${requirement}'`,\n task: '',\n passed: true,\n skipped: true,\n skip_reason: reason,\n skip: { reason, detail, requirement },\n duration_ms: 0,\n validations: [],\n context: {},\n extraction: { path: 'none' },\n };\n return {\n storyboard_id: storyboard.id,\n storyboard_title: storyboard.title,\n agent_url: redactOAuthUrlForOutput(agentUrls[0]!),\n overall_passed: true,\n phases: [\n {\n phase_id: 'requirement_unmet',\n phase_title: `Requirement unmet: ${requirement}`,\n passed: true,\n steps: [syntheticStep],\n duration_ms: 0,\n },\n ],\n context: {},\n total_duration_ms: 0,\n // `required_any_of_tools` unmet is an applicability skip. Keep\n // `overall_passed: true` for CI/non-failing semantics, but do not\n // increment passed_count because no scenario behavior was exercised.\n passed_count: 0,\n failed_count: 0,\n skipped_count: 1,\n runner_capability_version: RUNNER_CAPABILITY_VERSION,\n tested_at: new Date().toISOString(),\n strict_validation_summary: {\n observable: false,\n checked: 0,\n passed: 0,\n failed: 0,\n strict_only_failures: 0,\n lenient_also_failed: 0,\n },\n notices: [],\n };\n}\n\nfunction buildRequiredAnyOfToolsMissingResult(\n agentUrls: string[],\n storyboard: Storyboard,\n detail: string\n): StoryboardResult {\n const syntheticStep: StoryboardStepResult = {\n storyboard_id: storyboard.id,\n step_id: 'missing_required_tool_family',\n phase_id: 'requirement_unmet',\n title: 'Storyboard skipped: required tool family missing',\n task: '',\n passed: true,\n skipped: true,\n skip_reason: 'requirement_unmet',\n skip: { reason: 'requirement_unmet', detail },\n duration_ms: 0,\n validations: [],\n context: {},\n extraction: { path: 'none' },\n };\n return {\n storyboard_id: storyboard.id,\n storyboard_title: storyboard.title,\n agent_url: redactOAuthUrlForOutput(agentUrls[0]!),\n overall_passed: true,\n phases: [\n {\n phase_id: 'requirement_unmet',\n phase_title: 'Requirement unmet: required_any_of_tools',\n passed: true,\n steps: [syntheticStep],\n duration_ms: 0,\n },\n ],\n context: {},\n total_duration_ms: 0,\n passed_count: 0,\n failed_count: 0,\n skipped_count: 1,\n runner_capability_version: RUNNER_CAPABILITY_VERSION,\n tested_at: new Date().toISOString(),\n strict_validation_summary: {\n observable: false,\n checked: 0,\n passed: 0,\n failed: 0,\n strict_only_failures: 0,\n lenient_also_failed: 0,\n },\n notices: [],\n };\n}\n\nfunction normalizeAgentToolNames(tools: unknown): string[] | undefined {\n if (!Array.isArray(tools)) return undefined;\n const names: string[] = [];\n for (const tool of tools) {\n if (typeof tool === 'string') {\n names.push(tool);\n } else if (tool && typeof tool === 'object') {\n const name = (tool as { name?: unknown }).name;\n if (typeof name === 'string') names.push(name);\n }\n }\n return names.length > 0 ? names : undefined;\n}\n\n/**\n * Resolve a storyboard's `requires:` tags against the runtime environment.\n * Returns the first unmet requirement (with a human-readable detail) or\n * `null` when every requirement is available. Spec: adcp-client#1626.\n *\n * Detection rules:\n * - `controller` — agent advertises `comply_test_controller` (read from\n * `options.agentTools`). When `options.agentTools` is undefined the\n * gate is a no-op — the caller accepted responsibility for tool\n * compatibility by reusing an external client.\n * - `seeded_state` — operator passed `assertsSeededState: true`\n * (CLI: `--asserts-seeded-state`).\n * - `real_wire` — always available; the runner is hitting a real wire\n * by definition. The tag is a no-op gate today, reserved for a\n * future `--mock-only` mode.\n * - `webhook_receiver` — operator supplied `options.webhook_receiver`.\n * Autodetected from step `sample_request` token presence (see\n * `detectImplicitRequires`); authors don't write this tag manually.\n * Spec: adcp-client#1678.\n * - `webhook_replay_receiver` — operator supplied a non-empty\n * `options.webhook_replay_receiver.url`. Autodetected from any\n * `replay_webhook_vector` step (see `detectImplicitRequires`); authors\n * don't write this tag manually. Spec: adcp-client#2356.\n * - `trusted_match_context_router_runner` — operator supplied a router URL\n * and registration callback for raw `POST /context` replay. Autodetected\n * from `replay_trusted_match_context_vector`. Spec: adcp-client#2479.\n * - `trusted_match_publisher_auth_runner` — operator supplied exact\n * publisher-facing Context/Identity endpoints plus complete declarative\n * absent/invalid credential states. Spec: adcp-client#2526.\n * - `request_signer` — agent advertises `request_signing.supported: true`\n * in `get_adcp_capabilities`. Autodetected for any storyboard whose\n * id is `'signed_requests'` or that contains a `request_signing_probe`\n * step (see `detectImplicitRequires`); authors don't write this tag\n * manually. Absence-skip semantics are INVERTED from the general\n * `requires_capability` rule: the signed-requests universal\n * storyboard's own gating spec (signed-requests.yaml prerequisites)\n * declares \"agents that do not advertise support are not tested\n * against this storyboard — absence of advertisement is not a\n * failure\". When the runner can't read capabilities (no profile\n * threaded through), the gate is a no-op — the caller accepted\n * responsibility for capability compatibility by reusing an external\n * client. Spec: adcp-client#1702.\n * - `multi_agent` — `options.agents` is set and the storyboard's\n * declared route keys (`default_agent` and step-level `agent:` overrides)\n * resolve to at least two distinct entries in that map. Raw\n * `options.agents` cardinality is not enough; the requirement describes\n * the topology this storyboard actually routes through.\n * Spec: adcp-client#2281.\n */\nasync function checkRequires(\n requires: readonly string[],\n storyboard: Storyboard,\n options: StoryboardRunOptions,\n profile?: AgentProfile\n): Promise<\n { requirement: string; detail: string } | { preparedPublisherAuthProbes?: PreparedTrustedMatchPublisherAuthProbes }\n> {\n let preparedPublisherAuthProbes = getPreparedTrustedMatchPublisherAuth(options);\n for (const requirement of requires) {\n if (!isKnownRequirement(requirement)) {\n return {\n requirement,\n detail:\n `Storyboard requires unknown runtime requirement '${requirement}'. ` +\n `This SDK does not know how to satisfy it, so the requirement is treated as unmet ` +\n `for forward compatibility.`,\n };\n }\n switch (requirement) {\n case 'controller': {\n if (!options.agentTools) continue;\n if (!options.agentTools.includes('comply_test_controller')) {\n return {\n requirement,\n detail:\n `Storyboard requires 'controller'; agent does not advertise comply_test_controller. ` +\n `Agent tools: [${options.agentTools.join(', ')}].`,\n };\n }\n break;\n }\n case 'seeded_state': {\n if (options.assertsSeededState !== true) {\n return {\n requirement,\n detail:\n \"Storyboard requires 'seeded_state'; pass --asserts-seeded-state to declare \" +\n 'that initial state has been provisioned out-of-band.',\n };\n }\n break;\n }\n case 'real_wire':\n // Always available — reserved for a future --mock-only mode.\n break;\n case 'webhook_receiver': {\n if (options.webhook_receiver === undefined) {\n return {\n requirement,\n detail:\n 'Storyboard references `{{runner.webhook_url:…}}` or `{{runner.webhook_base}}` but no ' +\n 'webhook receiver is configured. Pass `webhook_receiver` in StoryboardRunOptions ' +\n '(or `--webhook-receiver` on the CLI) to host a receiver, or omit this storyboard. ' +\n 'Required by the webhook-emission universal: ' +\n 'compliance/{version}/universal/webhook-emission.yaml grades not_applicable when ' +\n 'no receiver is configured (prerequisites section).',\n };\n }\n break;\n }\n case 'webhook_replay_receiver': {\n if (!options.webhook_replay_receiver?.url) {\n return {\n requirement,\n detail:\n 'Storyboard contains a `replay_webhook_vector` step but no webhook replay receiver URL ' +\n 'is configured. Pass `webhook_replay_receiver.url` in StoryboardRunOptions to run ' +\n 'inbound buyer/orchestrator receiver conformance. Seller agents without an inbound ' +\n 'receiver grade not_applicable for this storyboard.',\n };\n }\n break;\n }\n case 'trusted_match_context_router_runner': {\n const runner = options.trusted_match_context_router_runner;\n if (!runner?.router_url || typeof runner.registerProviders !== 'function') {\n return {\n requirement,\n detail:\n 'Storyboard contains a `replay_trusted_match_context_vector` step but no Trusted Match ' +\n 'Context router harness is configured. Pass `trusted_match_context_router_runner` with ' +\n '`router_url` and `registerProviders` to run raw POST /context conformance.',\n };\n }\n break;\n }\n case 'trusted_match_publisher_auth_runner': {\n const runner = options.trusted_match_publisher_auth_runner;\n if (\n !runner ||\n typeof runner.contextEndpoint !== 'string' ||\n typeof runner.identityEndpoint !== 'string' ||\n typeof runner.preparePublisherAuthProbe !== 'function'\n ) {\n return {\n requirement,\n detail:\n 'Storyboard requires `trusted_match_publisher_auth_runner`; configure exact HTTPS ' +\n '`contextEndpoint` and `identityEndpoint` URLs plus `preparePublisherAuthProbe` for ' +\n 'both absent and invalid credential states.',\n };\n }\n if (!preparedPublisherAuthProbes) {\n try {\n preparedPublisherAuthProbes = await prepareTrustedMatchPublisherAuthProbes(runner);\n } catch (error) {\n return {\n requirement,\n detail:\n 'Storyboard requires a complete `trusted_match_publisher_auth_runner` configuration: ' +\n (error instanceof Error ? error.message : String(error)),\n };\n }\n }\n break;\n }\n case 'request_signer': {\n // Gate is a no-op when no profile is threaded through (external\n // `_client` mode). The caller has accepted responsibility for\n // capability compatibility; failing the gate here would surprise\n // them with a skip they can't explain from CLI options alone.\n if (!profile?.raw_capabilities) break;\n const supported = resolveCapabilityPath(profile.raw_capabilities, 'request_signing.supported');\n if (supported === true) break;\n return {\n requirement,\n detail:\n 'Storyboard requires `request_signing.supported: true` in `get_adcp_capabilities`; ' +\n `agent declared ${supported === undefined ? 'no request_signing block' : JSON.stringify(supported)}. ` +\n 'Per compliance/{version}/universal/signed-requests.yaml: \"Agents that do not advertise ' +\n 'support are not tested against this storyboard — absence of advertisement is not a ' +\n 'failure, it is a declaration that the agent does not offer verified signed requests.\" ' +\n 'To opt in, advertise `request_signing.supported: true` and pre-register the runner ' +\n 'compliance test keypair per test-kits/signed-requests-runner.yaml. ' +\n 'Forward-readiness: optional in AdCP 3.0; the schema (request_signing block description) ' +\n 'declares request signing required for spend-committing operations in AdCP 4.0. Sellers ' +\n 'that intend to support spend-committing tools SHOULD advertise the capability and ' +\n 'register the test keypair before the 4.0 cut to avoid a hard compliance failure then.',\n };\n }\n case 'multi_agent': {\n const routeKeys = collectMultiAgentRequirementRouteKeys(storyboard, options);\n if (routeKeys.length >= 2) break;\n const availableKeys = options.agents ? Object.keys(options.agents) : [];\n const routed = routeKeys.length ? routeKeys.join(', ') : '(none)';\n const available = availableKeys.length ? availableKeys.join(', ') : '(none)';\n return {\n requirement,\n detail:\n \"Storyboard requires 'multi_agent'; configure `agents` and route this storyboard \" +\n 'to at least two distinct agent keys via `default_agent` and/or step-level `agent:` overrides. ' +\n `Resolved route keys: [${routed}]. Available agents: [${available}].`,\n };\n }\n }\n }\n return { ...(preparedPublisherAuthProbes && { preparedPublisherAuthProbes }) };\n}\n\nfunction collectMultiAgentRequirementRouteKeys(storyboard: Storyboard, options: StoryboardRunOptions): string[] {\n const agents = options.agents;\n if (!agents) return [];\n\n const routeKeys = new Set<string>();\n if (options.default_agent !== undefined && options.default_agent in agents) {\n routeKeys.add(options.default_agent);\n }\n for (const phase of storyboard.phases ?? []) {\n for (const step of phase.steps ?? []) {\n if (step.agent !== undefined && step.agent in agents) {\n routeKeys.add(step.agent);\n }\n }\n }\n return [...routeKeys];\n}\n\nfunction resolveStoryboardRequires(storyboard: Storyboard, options: StoryboardRunOptions): string[] {\n const declared = storyboard.requires ?? [];\n const implicit = detectImplicitRequires(storyboard, options);\n return [...declared, ...implicit.filter(r => !declared.includes(r))];\n}\n\n/**\n * Webhook-token regex used to autodetect the implicit `webhook_receiver`\n * requirement. Matches `{{runner.webhook_url:<step_id>}}` and the bare\n * `{{runner.webhook_base}}`. Same shape as the `MUSTACHE_TOKEN_RE` in\n * context.ts but scoped to the two webhook-bearing tokens — we only care\n * whether the storyboard needs a receiver, not what substitution it\n * would produce. Single `[^{}]+` body avoids the polynomial-redos\n * backtrack pattern flagged by CodeQL alert #49.\n */\nconst WEBHOOK_TOKEN_RE = /\\{\\{runner\\.(?:webhook_url:[A-Za-z0-9_]+|webhook_base)\\}\\}/;\n\n/**\n * Recursively scan a JSON-like value for any webhook receiver token. The\n * scan only touches strings; objects and arrays are walked structurally\n * so deeply-nested `push_notification_config.url` entries (or any other\n * authoring pattern) are discovered without a hard-coded field list.\n */\nfunction valueContainsWebhookToken(value: unknown): boolean {\n if (typeof value === 'string') {\n return WEBHOOK_TOKEN_RE.test(value);\n }\n if (Array.isArray(value)) {\n return value.some(valueContainsWebhookToken);\n }\n if (value !== null && typeof value === 'object') {\n return Object.values(value as Record<string, unknown>).some(valueContainsWebhookToken);\n }\n return false;\n}\n\n/**\n * Return the implicit requirements a storyboard needs based on its\n * structure (not its declared `requires:` list). Today:\n * - `'webhook_receiver'`, autodetected from `{{runner.webhook_url:…}}`\n * / `{{runner.webhook_base}}` token presence inside any step's\n * `sample_request` or in-scope `rate_limit_trip.trip_target_sample_request`.\n * Token presence is the authoring contract — a storyboard that names\n * the runner's webhook receiver cannot run without one — so authors\n * don't need to remember to add `requires: [webhook_receiver]`\n * separately. Contract-gated synthetic steps only count when their\n * `requires_contract` is configured for this run. Rate-limit trip probes\n * additionally require the exact runner contract and explicit live-side-\n * effect authorization before their target request contributes an\n * implicit webhook requirement. Spec: adcp-client#1678.\n * - `'webhook_replay_receiver'`, autodetected from any\n * `replay_webhook_vector` step. These vectors target an inbound\n * buyer/orchestrator receiver, so without `webhook_replay_receiver.url`\n * the whole storyboard grades not_applicable instead of executing an\n * all-skipped phase that fails the required-phase rollup. Spec:\n * adcp-client#2356.\n * - `'trusted_match_context_router_runner'`, autodetected from any\n * `replay_trusted_match_context_vector` step. Without the operator-owned\n * registration seam the raw router test grades not_applicable and never\n * falls back to an MCP/A2A tool call. Spec: adcp-client#2479.\n * - `'request_signer'`, autodetected from `storyboard.id ===\n * 'signed_requests'` or any step using the synthesized\n * `request_signing_probe` task. The signed-requests universal\n * storyboard's own prerequisites section declares the\n * `request_signing.supported: true` capability gate; the runner\n * enforces it here so adopters don't see false-negative vector\n * failures on bearer-only agents that never claimed signing.\n * Spec: adcp-client#1702.\n */\nfunction detectImplicitRequires(\n storyboard: Storyboard,\n options: Pick<StoryboardRunOptions, 'contracts' | 'allowLiveSideEffects'> = {}\n): RequirementName[] {\n const requires: RequirementName[] = [];\n let needsWebhook = false;\n let needsWebhookReplayReceiver = false;\n let needsTrustedMatchContextRouterRunner = false;\n let needsSigner = storyboard.id === 'signed_requests';\n const contractsInScope = new Set(options.contracts ?? []);\n for (const phase of storyboard.phases) {\n for (const step of phase.steps) {\n const stepContractInScope = !step.requires_contract || contractsInScope.has(step.requires_contract);\n const rateLimitProbeInScope =\n step.task !== 'expect_rate_limit_not_replayed' ||\n (stepContractInScope &&\n contractsInScope.has(RATE_LIMIT_TRIP_CONTRACT) &&\n options.allowLiveSideEffects === true);\n if (\n !needsWebhook &&\n ((step.sample_request && rateLimitProbeInScope && valueContainsWebhookToken(step.sample_request)) ||\n (step.rate_limit_trip?.trip_target_sample_request &&\n stepContractInScope &&\n rateLimitProbeInScope &&\n valueContainsWebhookToken(step.rate_limit_trip.trip_target_sample_request)))\n ) {\n needsWebhook = true;\n }\n if (!needsSigner && step.task === 'request_signing_probe') {\n needsSigner = true;\n }\n if (!needsWebhookReplayReceiver && stepContractInScope && step.task === REPLAY_WEBHOOK_VECTOR_TASK) {\n needsWebhookReplayReceiver = true;\n }\n if (\n !needsTrustedMatchContextRouterRunner &&\n stepContractInScope &&\n step.task === REPLAY_TRUSTED_MATCH_CONTEXT_VECTOR_TASK\n ) {\n needsTrustedMatchContextRouterRunner = true;\n }\n if (needsWebhook && needsWebhookReplayReceiver && needsTrustedMatchContextRouterRunner && needsSigner) break;\n }\n if (needsWebhook && needsWebhookReplayReceiver && needsTrustedMatchContextRouterRunner && needsSigner) break;\n }\n if (needsWebhook) requires.push('webhook_receiver');\n if (needsWebhookReplayReceiver) requires.push('webhook_replay_receiver');\n if (needsTrustedMatchContextRouterRunner) requires.push('trusted_match_context_router_runner');\n if (needsSigner) requires.push('request_signer');\n return requires;\n}\n\n/**\n * Build a hard-failure StoryboardResult for when agent capability\n * discovery (`get_agent_info` / MCP `tools/list`) failed. Surfacing\n * discovery errors as a hard storyboard failure prevents the silent\n * \"X/X clean, 100% skipped\" failure mode where transport / auth\n * misconfiguration produced an empty `agentTools: []` and every step\n * skipped with `missing_tool`.\n *\n * @public — exported for direct testing of the failure-result shape;\n * called from `runStoryboard` when discovery throws.\n */\nexport function buildDiscoveryFailedResult(\n agentUrls: string[],\n storyboard: Storyboard,\n discoveryStep: TestStepResult\n): StoryboardResult {\n const detail = discoveryStep.error ?? 'Discovery failed (no agent tools advertised).';\n const syntheticStep: StoryboardStepResult = {\n storyboard_id: storyboard.id,\n step_id: 'discovery_failed',\n phase_id: 'discovery_failed',\n title: 'Storyboard failed: agent capability discovery did not succeed',\n task: '',\n passed: false,\n skipped: false,\n duration_ms: discoveryStep.duration_ms,\n validations: [],\n context: {},\n error: `Discovery failure: ${detail}. The runner refuses to proceed with empty agentTools — that mode produces silent \"all clean\" reports when the underlying transport / auth / network policy is broken. Fix the discovery error before re-running.`,\n extraction: { path: 'none' },\n };\n return {\n storyboard_id: storyboard.id,\n storyboard_title: storyboard.title,\n agent_url: redactOAuthUrlForOutput(agentUrls[0]!),\n overall_passed: false,\n phases: [\n {\n phase_id: 'discovery_failed',\n phase_title: 'Discovery failed',\n passed: false,\n steps: [syntheticStep],\n duration_ms: discoveryStep.duration_ms,\n },\n ],\n context: {},\n total_duration_ms: discoveryStep.duration_ms,\n passed_count: 0,\n failed_count: 1,\n skipped_count: 0,\n runner_capability_version: RUNNER_CAPABILITY_VERSION,\n tested_at: new Date().toISOString(),\n strict_validation_summary: {\n observable: false,\n checked: 0,\n passed: 0,\n failed: 0,\n strict_only_failures: 0,\n lenient_also_failed: 0,\n },\n notices: [],\n };\n}\n\n/**\n * Build a minimal StoryboardResult for a storyboard skipped because the agent\n * does not advertise any of the tools listed in `required_tools`. The result\n * carries `skip_reason: 'missing_tool'` and `overall_passed: true` so CLI\n * reports and JUnit consumers render it as a skip, not a failure.\n *\n * `missing_tool` (not `not_applicable`) is the correct canonical reason here:\n * the agent declared a compatible protocol/specialism but lacks the specific\n * tools this storyboard exercises — distinct from a protocol/version mismatch.\n */\nfunction buildRequiredToolsMissingResult(\n agentUrls: string[],\n storyboard: Storyboard,\n detail: string\n): StoryboardResult {\n return {\n storyboard_id: storyboard.id,\n storyboard_title: storyboard.title,\n agent_url: redactOAuthUrlForOutput(agentUrls[0]!),\n overall_passed: true,\n phases: [\n {\n phase_id: 'missing_tool',\n phase_title: 'Skipped — required tools not advertised',\n passed: true,\n duration_ms: 0,\n steps: [\n {\n storyboard_id: storyboard.id,\n step_id: 'missing_tool',\n phase_id: 'missing_tool',\n title: `Skipped — ${detail}`,\n task: '',\n passed: true,\n skipped: true,\n skip_reason: 'missing_tool' as const,\n skip: { reason: 'missing_tool' as const, detail },\n duration_ms: 0,\n validations: [],\n context: {},\n extraction: { path: 'none' },\n },\n ],\n },\n ],\n context: {},\n total_duration_ms: 0,\n passed_count: 0,\n failed_count: 0,\n skipped_count: 1,\n runner_capability_version: RUNNER_CAPABILITY_VERSION,\n tested_at: new Date().toISOString(),\n strict_validation_summary: {\n observable: false,\n checked: 0,\n passed: 0,\n failed: 0,\n strict_only_failures: 0,\n lenient_also_failed: 0,\n },\n notices: [],\n };\n}\n\n/**\n * Collect protocol-compliance notices for a storyboard run based on the\n * agent's declared capabilities. Returns an empty array when rawCaps is\n * absent (standalone runner without pre-fetched profile).\n *\n * Currently emits four spec-grounded notices (adcp-client#1704, #2082, #2461):\n *\n * - `capabilities_response_schema_invalid`: one informational notice per\n * schema issue, identified by its RFC 6901 `capability_pointer`.\n *\n * - `signed_requests_specialism_deprecated`: agent claims deprecated\n * `specialisms: ['signed-requests']` alongside `request_signing.supported:\n * true` on the signed_requests storyboard. The enum value is removed in\n * `effective_version: '4.0'`.\n *\n * - `request_signing.required`: `request_signing.supported` is absent or\n * false on the signed_requests storyboard. Signing becomes required for\n * spend-committing operations in `effective_version: '4.0'`.\n *\n * - `webhook_signing.legacy_hmac_fallback.removed`: agent claims\n * `webhook_signing.legacy_hmac_fallback: true`, which is removed in\n * `effective_version: '4.0'`.\n */\nfunction collectCapabilityNotices(storyboard: Storyboard, profile: AgentProfile | undefined): RunnerNotice[] {\n const notices: RunnerNotice[] = (profile?.capabilities_schema_issues ?? []).map(issue => ({\n severity: 'info',\n code: 'capabilities_response_schema_invalid',\n message:\n `The agent's get_adcp_capabilities response failed schema validation at ${issue.pointer || '/'}: ` +\n `${issue.message}. Track results may share this root cause; fix it first, then re-read the failures.`,\n capability_pointer: issue.pointer,\n docs_url: 'https://github.com/adcontextprotocol/adcp/issues/6254',\n storyboard_ids: [storyboard.id],\n }));\n const rawCaps = profile?.raw_capabilities;\n if (!rawCaps || typeof rawCaps !== 'object') return notices;\n const caps = rawCaps as Record<string, unknown>;\n\n // Notice: request_signing required in AdCP 4.0.\n // Fired when this is the signed_requests storyboard and the agent hasn't\n // declared request_signing support. The storyboard is identified by id OR\n // by the presence of a request_signing_probe step (mirrors the implicit-\n // require detection in detectImplicitRequires for PR #1703's gate).\n const isSignedRequestsNoticeStoryboard = storyboard.id === 'signed_requests';\n const isRequestSigningStoryboard =\n isSignedRequestsNoticeStoryboard ||\n storyboard.phases.some(p => p.steps.some(s => s.task === 'request_signing_probe'));\n if (isRequestSigningStoryboard) {\n const requestSigning = caps['request_signing'] as Record<string, unknown> | undefined;\n const specialisms = caps['specialisms'];\n // Canonical deprecation notice standardized by adcontextprotocol/adcp#4796.\n if (\n isSignedRequestsNoticeStoryboard &&\n requestSigning?.['supported'] === true &&\n Array.isArray(specialisms) &&\n specialisms.includes('signed-requests')\n ) {\n notices.push({\n severity: 'deprecation',\n code: 'signed_requests_specialism_deprecated',\n message:\n 'The `signed-requests` specialism claim is deprecated and removed in AdCP 4.0. ' +\n 'Drop it and rely on `request_signing.supported: true` instead.',\n effective_version: '4.0',\n capability_path: 'specialisms',\n docs_url: 'https://adcontextprotocol.org/docs/building/implementation/security#signed-requests-transport-layer',\n storyboard_ids: [storyboard.id],\n });\n }\n\n if (requestSigning?.['supported'] !== true) {\n notices.push({\n severity: 'future_required',\n code: 'request_signing.required',\n message:\n 'RFC 9421 request signing (`request_signing.supported: true`) is not advertised. ' +\n 'Required for spend-committing operations in AdCP 4.0 — declare the capability and ' +\n 'pre-register the runner compliance test keypair before the 4.0 cut.',\n effective_version: '4.0',\n capability_path: 'request_signing.supported',\n docs_url: 'https://adcontextprotocol.org/docs/building/implementation/security#signed-requests-transport-layer',\n storyboard_ids: [storyboard.id],\n });\n }\n }\n\n // Notice: legacy_hmac_fallback removed in AdCP 4.0.\n // Scoped via the WEBHOOK_STEP_TASKS step-task set rather than an id-regex.\n // Step-task presence is the authoring contract — a storyboard that asserts\n // webhook delivery uses one of these tasks. A storyboard id alone (e.g. a\n // hypothetical `webhook_authoring_guide`) shouldn't trigger the notice\n // unless it actually exercises the delivery path.\n const WEBHOOK_STEP_TASKS = new Set([\n 'expect_webhook',\n 'expect_no_webhook',\n 'expect_webhook_retry_keys_stable',\n 'expect_webhook_signature_valid',\n ]);\n const isWebhookRelatedStoryboard = storyboard.phases.some(p => p.steps.some(s => WEBHOOK_STEP_TASKS.has(s.task)));\n if (isWebhookRelatedStoryboard) {\n const webhookSigning = caps['webhook_signing'] as Record<string, unknown> | undefined;\n if (webhookSigning?.['legacy_hmac_fallback'] === true) {\n notices.push({\n severity: 'deprecation',\n code: 'webhook_signing.legacy_hmac_fallback.removed',\n message:\n '`webhook_signing.legacy_hmac_fallback: true` is deprecated and removed in AdCP 4.0. ' +\n 'Migrate webhook signature verification to RFC 9421 before the 4.0 cut.',\n effective_version: '4.0',\n capability_path: 'webhook_signing.legacy_hmac_fallback',\n docs_url: 'https://adcontextprotocol.org/docs/building/implementation/webhooks',\n storyboard_ids: [storyboard.id],\n });\n }\n }\n\n return notices;\n}\n\nfunction collectInputSchemaFieldStripNotices(debugLogs: unknown, storyboardId: string): RunnerNotice[] {\n if (!Array.isArray(debugLogs)) return [];\n const notices: RunnerNotice[] = [];\n const seen = new Set<string>();\n for (const entry of debugLogs) {\n if (!entry || typeof entry !== 'object') continue;\n const details = (entry as { details?: unknown }).details;\n if (!details || typeof details !== 'object') continue;\n const record = details as Record<string, unknown>;\n if (record.code !== 'input_schema_field_stripped') continue;\n const task = typeof record.task === 'string' ? record.task : 'unknown_task';\n const fields = Array.isArray(record.fields)\n ? record.fields.filter((field): field is string => typeof field === 'string')\n : [];\n if (fields.length === 0) continue;\n const key = `${task}\\u0000${fields.join('\\u0000')}`;\n if (seen.has(key)) continue;\n seen.add(key);\n notices.push({\n severity: 'info',\n code: 'input_schema_field_stripped',\n message:\n `Runner stripped request fields not declared by either the agent's tool input schema or the canonical AdCP ` +\n `request schema for ${task}: ${fields.join(', ')}. Check the caller or runner payload before changing the agent schema.`,\n docs_url: 'https://github.com/adcontextprotocol/adcp/issues/6437',\n storyboard_ids: [storyboardId],\n });\n }\n return notices;\n}\n\nfunction mergeRunnerNotices(notices: RunnerNotice[]): RunnerNotice[] {\n const byCode = new Map<string, RunnerNotice>();\n for (const notice of notices) {\n const key = runnerNoticeKey(notice);\n const existing = byCode.get(key);\n if (existing) {\n for (const sid of notice.storyboard_ids) {\n if (!existing.storyboard_ids.includes(sid)) existing.storyboard_ids.push(sid);\n }\n } else {\n byCode.set(key, { ...notice, storyboard_ids: [...notice.storyboard_ids] });\n }\n }\n return [...byCode.values()];\n}\n\nfunction runnerNoticeKey(notice: RunnerNotice): string {\n return notice.capability_pointer === undefined ? notice.code : `${notice.code}\\u0000${notice.capability_pointer}`;\n}\n\nfunction collectStepNotices(phases: StoryboardPhaseResult[]): RunnerNotice[] {\n return phases.flatMap(phase => phase.steps.flatMap(step => step.notices ?? []));\n}\n\n/**\n * Execute a single pass of the storyboard against the supplied replica URLs\n * using round-robin dispatch starting at `dispatchOffset`. Called directly\n * by `runStoryboard` (offset 0) and repeatedly by `runMultiPass` (offsets\n * 0..N-1). Taking the offset as an explicit parameter keeps the dispatcher\n * primitive out of the public `StoryboardRunOptions` type.\n */\nasync function executeStoryboardPass(\n agentUrls: string[],\n storyboard: Storyboard,\n options: StoryboardRunOptions,\n dispatchOffset: number,\n preSeeded?: PreSeededInput\n): Promise<StoryboardResult> {\n const start = Date.now();\n const isMultiInstance = agentUrls.length > 1;\n const useRouting = options.agents !== undefined;\n\n // Per-specialism routing builds its own clients + per-agent discovery; the\n // legacy single/multi-instance path discovers against the first replica.\n let clients: TestClient[];\n let routingContext: AgentRoutingContext | undefined;\n let profile: AgentProfile | undefined;\n let callerOwnsClients = false;\n\n if (useRouting) {\n try {\n routingContext = await buildRoutingContext(storyboard, options);\n } catch (err) {\n const detail = (err as Error)?.message ?? String(err);\n const failedStep: TestStepResult = {\n step:\n err instanceof DiscoveryFailure\n ? `Discover agent capabilities (${err.agentKey})`\n : 'Build agent routing index',\n passed: false,\n duration_ms: 0,\n error: detail,\n };\n await closeScopedConnections(options.protocol);\n return buildDiscoveryFailedResult(agentUrls, storyboard, failedStep);\n }\n clients = [...routingContext.clients.values()];\n // See note on the non-routing branch below: per-storyboard session reset\n // prevents a stale `pendingTaskId` from a prior storyboard's non-terminal\n // step from auto-threading into this storyboard's first call. (#1585)\n resetClientSessions(clients);\n // Pick the first agent's profile as the run-level \"primary\" for gates\n // that are evaluated before a step is routed (`requires_capability`,\n // notices). The dispatcher separately attaches the selected agent's\n // profile to each step assignment for capability-derived execution\n // behavior and per-step library-version hints.\n profile = [...routingContext.profiles.values()][0];\n // For `required_tools` gating, union every agent's advertised tools so\n // a storyboard that needs ≥1 of [sync_governance, activate_signal]\n // passes the gate when any tenant in the map serves either one.\n const unionedTools = new Set<string>();\n for (const p of routingContext.profiles.values()) {\n for (const t of normalizeAgentToolNames(p.tools) ?? []) unionedTools.add(t);\n }\n if (!options.agentTools) {\n options = { ...options, agentTools: [...unionedTools], _profile: profile };\n } else if (profile && !options._profile) {\n options = { ...options, _profile: profile };\n }\n } else {\n // Build one client per URL. In single-URL mode `_client` (from comply()) is\n // honored so the shared MCP transport is reused across storyboards.\n const clientResolutions = agentUrls.map(url => getOrCreateClientResolution(url, options));\n clients = clientResolutions.map(r => r.client);\n callerOwnsClients = clientResolutions.some(r => r.reusedShared);\n\n // Drop any retained A2A session ids before this storyboard's first call.\n // `comply()` shares one client across N storyboards for transport reuse;\n // AgentClient.retainSession holds onto `pendingTaskId` from non-terminal\n // responses (`submitted`/`working`/`input-required`) and auto-threads it\n // into every subsequent `message/send`. Without a per-storyboard reset, a\n // prior storyboard's stale `task_id` rides into the next storyboard's\n // first call (typically `get_products`) and the seller correctly\n // returns \"Task <uuid> not found\" on a buyer-side reference to a task it\n // never opened. (#1585)\n resetClientSessions(clients);\n\n // Discover agent profile against the first instance; all instances are\n // expected to run the same code behind a shared state store, so one probe\n // is sufficient. For multi-instance runs, skipping N-1 redundant\n // get_agent_info calls also keeps CI output clean.\n if (!callerOwnsClients) {\n const discovered = await getOrDiscoverProfile(clients[0]!, options);\n // Discovery failure must surface as a HARD STORYBOARD FAILURE, not a\n // silent empty `agentTools: []` that lets every step skip with\n // `missing_tool`. The latter mode produces \"X/X clean\" summaries with\n // 100% skipped — invisible CI failure when transport setup is broken\n // (auth misconfig, MCP transport-fallback bugs, network policy, etc.).\n // See: https://github.com/adcontextprotocol/adcp-client/issues/...\n if (discovered.step.passed === false) {\n await closeScopedConnections(options.protocol);\n return buildDiscoveryFailedResult(agentUrls, storyboard, discovered.step);\n }\n profile = discovered.profile;\n // Populate agentTools and _profile from discovered profile if not already set.\n // _profile is threaded into executeStep so capability-based skip gates\n // (e.g. account-mode branching) can read raw_capabilities at step time.\n const profileTools = normalizeAgentToolNames(profile?.tools);\n if (!options.agentTools && profileTools) {\n options = { ...options, agentTools: profileTools, _profile: profile };\n } else if (profile && !options._profile) {\n options = { ...options, _profile: profile };\n }\n } else {\n profile = options._profile;\n const profileTools = normalizeAgentToolNames(profile?.tools);\n if (!options.agentTools && profileTools) {\n options = { ...options, agentTools: profileTools, _profile: profile };\n } else if (\n !options.agentTools &&\n typeof (clients[0] as unknown as { getAgentInfo?: unknown })?.getAgentInfo === 'function'\n ) {\n const discovered = await getOrDiscoverProfile(clients[0]!, options);\n if (discovered.step.passed === false) {\n return buildDiscoveryFailedResult(agentUrls, storyboard, discovered.step);\n }\n profile = discovered.profile;\n const discoveredTools = normalizeAgentToolNames(profile?.tools);\n if (discoveredTools) {\n options = { ...options, agentTools: discoveredTools, _profile: profile };\n } else if (profile && !options._profile) {\n options = { ...options, _profile: profile };\n }\n }\n }\n }\n\n // Evaluate `requires` tags before any phase setup. The runner detects\n // which requirements are available on this run; an unmet requirement\n // skips the whole storyboard with `requirement_unmet` rather than\n // producing a cascade of `missing_test_controller` per-step skips.\n // Spec: adcp-client#1626. The default (no `requires` field) is\n // `[real_wire]`, which is always available — untagged storyboards\n // run unchanged.\n //\n // Implicit requirements (adcp-client#1678) are unioned with the\n // declared list: today this means `'webhook_receiver'` is added when\n // any step's `sample_request` references `{{runner.webhook_url:…}}`\n // or `{{runner.webhook_base}}`. Authors do not need to retag those\n // storyboards — the token presence is the declaration. Without the\n // implicit gate, storyboards that name the receiver but run without\n // one would silently ship literal mustache tokens on the wire and\n // get rejected by 3.0-strict sellers as `INVALID_REQUEST: relative URL`.\n // Pre-flight notice collection. Uses options._profile (set by the comply()\n // pipeline before calling runStoryboard) so the notices are available on\n // early-return results (requirement-unmet, capability-unsupported). In the\n // standalone runner path options._profile may be undefined; notices will be\n // collected again from the fully-fetched profile at result-build time.\n const preflightNotices = collectCapabilityNotices(storyboard, options._profile);\n\n // Capability applicability is intentionally first. Optional capability\n // storyboards must grade not_applicable for agents that did not opt in,\n // without inspecting or reporting any missing operator runtime adapter.\n if (storyboard.requires_capability) {\n const unmetDetail = evaluateRequiresCapabilityGate(\n storyboard.requires_capability,\n profile,\n options.agentTools,\n options.adcpVersion\n );\n if (unmetDetail !== null) {\n if (!callerOwnsClients) await closeScopedConnections(options.protocol);\n return {\n ...buildCapabilityUnsupportedResult(agentUrls, storyboard, unmetDetail),\n notices: preflightNotices,\n };\n }\n }\n\n const allRequires = resolveStoryboardRequires(storyboard, options);\n if (allRequires.length) {\n const requirementCheck = await checkRequires(allRequires, storyboard, options, profile);\n if ('requirement' in requirementCheck) {\n if (!callerOwnsClients) await closeScopedConnections(options.protocol);\n return {\n ...buildRequirementUnmetResult(agentUrls, storyboard, requirementCheck.requirement, requirementCheck.detail),\n notices: preflightNotices,\n };\n }\n if (requirementCheck.preparedPublisherAuthProbes) {\n options = withPreparedTrustedMatchPublisherAuth(options, requirementCheck.preparedPublisherAuthProbes);\n }\n }\n\n if (storyboard.required_any_of_tools?.length && options.agentTools) {\n const agentTools = new Set(options.agentTools);\n const missing = storyboard.required_any_of_tools.find(family => !family.tools.some(tool => agentTools.has(tool)));\n if (missing) {\n const detail =\n `missing_required_tool_family: needs ${missing.tools.join(' or ')}` +\n (missing.rationale ? ` (${missing.rationale})` : '');\n if (!callerOwnsClients) await closeScopedConnections(options.protocol);\n return {\n ...buildRequiredAnyOfToolsMissingResult(agentUrls, storyboard, detail),\n notices: preflightNotices,\n };\n }\n }\n\n // Enforce required_tools pre-flight gate: if the storyboard declares tools\n // that make it applicable (at least one must be present) and the agent\n // advertises none of them, skip the whole storyboard instead of producing\n // misleading per-step failures.\n //\n // Gate condition: `options.agentTools` is populated from discovery or\n // `_profile.tools` before this point, including reused-client callers when\n // discovery is available. If a direct `_client` caller supplies neither\n // `agentTools` nor a discoverable profile, this gate remains a no-op and\n // step-level `requires_tool` checks carry the compatibility signal.\n if (storyboard.required_tools?.length && options.agentTools) {\n const hasAnyRequired = storyboard.required_tools.some(t => options.agentTools!.includes(t));\n if (!hasAnyRequired) {\n if (!callerOwnsClients) await closeScopedConnections(options.protocol);\n return {\n ...buildRequiredToolsMissingResult(\n agentUrls,\n storyboard,\n `agent does not advertise any of [${storyboard.required_tools.join(', ')}]`\n ),\n notices: preflightNotices,\n };\n }\n }\n\n let context: StoryboardContext = { ...storyboard.context, ...options.context };\n if (storyboard.context) forwardAliasCache(storyboard.context, context);\n if (options.context) forwardAliasCache(options.context, context);\n const contributions = new Set<string>();\n // First phase/step that contributed each flag. Branch-set post-pass reads\n // this to emit the contract-mandated peer_branch_taken detail string\n // (\"<flag> contributed by <peer_phase_id>.<peer_step_id> — …\"). Only the\n // first contributor is recorded — downstream peers observing the same flag\n // are redundant and the contract calls out a single peer.\n const contributionSources = new Map<string, { phaseId: string; stepId: string }>();\n const priorStepResults = new Map<string, StoryboardStepResult>();\n const priorProbes = new Map<string, HttpProbeResult>();\n const contextProvenance = new Map<string, ContextProvenanceEntry>();\n const priorA2aEnvelopes = new Map<string, A2ATaskEnvelope>();\n const stepRequestStarts = new Map<string, string>();\n const responseDerivedNotApplicableContextKeys = new Map<string, string>();\n const phaseResults: StoryboardPhaseResult[] = [];\n let passedCount = 0;\n let failedCount = 0;\n let skippedCount = 0;\n const phaseCapabilitySkippedIds = new Set<string>();\n // Per-phase stateful-cascade tracking (#1161).\n //\n // Map entry exists iff the phase tripped its stateful cascade — i.e.,\n // a stateful step in the phase failed or skipped for a missing-state\n // reason. Value is the trigger context (skip-step diagnostic) OR null\n // when the trip was a real failure (failure-wins-within-phase rule, so\n // downstream cascade-detail says \"prior stateful step failed\" rather\n // than referencing an earlier benign skip).\n //\n // Replaces the storyboard-scope `statefulFailed` boolean: each phase's\n // stateful steps consult `phase.depends_on` (default: all prior phases)\n // to decide whether any upstream phase tripped. Independent phases\n // (`depends_on: []`) keep running even if other phases tripped.\n //\n // Within-phase cascade is preserved: once any stateful step in a phase\n // trips, subsequent stateful steps in the SAME phase cascade-skip\n // unconditionally (later steps need state from earlier steps in this\n // phase by storyboard authoring intent).\n //\n // `substitution_chain` is set when the trigger came from a\n // deferred-and-unrescued `peer_substitutes_for` declaration (#1144) so\n // the cascade-detail message can name the substitute(s) that didn't\n // pass. Absent for the immediate-trip path and the legacy any-peer\n // not_applicable path.\n type CascadeTrigger = {\n stepId: string;\n reason: RunnerSkipReason | RunnerDetailedSkipReason;\n substitution_chain?: string;\n };\n const phaseStatefulCascades = new Map<string, CascadeTrigger | null>();\n // Phase IDs in declaration order, accumulated as we iterate so the\n // default `depends_on` resolution (\"all prior phases\") doesn't re-scan\n // the storyboard. Phases push their own id at end-of-phase.\n const priorPhaseIds: string[] = [];\n\n // Phase → branch-set membership, resolved once up front so the stateful\n // cascade (and the post-loop branch-set re-grade) can consult it. Phases\n // outside any branch set are absent from the map.\n const branchSetsByPhaseId = resolveBranchSets(storyboard);\n\n // Helpers for per-phase cascade state.\n const effectiveDependsOn = (phase: { depends_on?: string[] }, prior: readonly string[]): readonly string[] =>\n phase.depends_on ?? prior;\n const cascadeForPhase = (\n phase: { id: string; depends_on?: string[] },\n prior: readonly string[]\n ): { tripped: true; trigger: CascadeTrigger | null } | { tripped: false } => {\n // Within-phase cascade always counts — stateful steps later in this\n // phase depend on state from stateful steps earlier in this phase.\n if (phaseStatefulCascades.has(phase.id)) {\n return { tripped: true, trigger: phaseStatefulCascades.get(phase.id) ?? null };\n }\n // Branch-set peers under `any_of` are mutually-exclusive ALTERNATIVES, not\n // a stateful dependency chain: a conformant seller satisfies exactly one\n // peer, so the non-taken peer(s) fail by design (storyboard-schema.yaml,\n // \"Per-step grading in any_of branch patterns\"). A peer's expected\n // failure must NOT cascade-skip a sibling peer — doing so suppresses the\n // only viable contribution and fails the any_of gate even though the\n // seller behaved conformantly. Exclude same-branch-set peers from this\n // phase's cascade dependencies. (adcontextprotocol/adcp-client#2305)\n //\n // Scoped to `any_of` deliberately: `BranchSetSpec.semantics` is typed\n // `string` to leave room for future semantics (e.g. `all_of`/`one_of`)\n // where peers legitimately DO depend on each other and must keep\n // cascading. `all_of` is rejected at load time today, so this is\n // forward-compat hardening rather than live behavior.\n const ownSpec = branchSetsByPhaseId.get(phase.id);\n const ownAnyOfBranchSet = ownSpec?.semantics === 'any_of' ? ownSpec.id : undefined;\n for (const depId of effectiveDependsOn(phase, prior)) {\n if (ownAnyOfBranchSet !== undefined && branchSetsByPhaseId.get(depId)?.id === ownAnyOfBranchSet) {\n continue;\n }\n if (phaseStatefulCascades.has(depId)) {\n return { tripped: true, trigger: phaseStatefulCascades.get(depId) ?? null };\n }\n }\n return { tripped: false };\n };\n // Step results whose failures the main loop added to failedCount. The\n // branch-set post-pass decrements only for entries that were actually\n // counted, so an optional phase that hit `presenceDetected` (a PRM 2xx\n // inside an otherwise-optional phase) has its leak correctly reversed.\n const countedAsFailed = new Set<StoryboardStepResult>();\n\n // Start an ephemeral webhook receiver when the run opts in. The base URL\n // is exposed via `{{runner.webhook_base}}` / `{{runner.webhook_url:<id>}}`\n // substitutions so storyboards can inject per-step URLs into\n // `push_notification_config.url`. See adcontextprotocol/adcp#2431.\n const webhookReceiver = options.webhook_receiver\n ? await createWebhookReceiver({\n ...(options.webhook_receiver.mode && { mode: options.webhook_receiver.mode }),\n ...(options.webhook_receiver.host !== undefined && { host: options.webhook_receiver.host }),\n ...(options.webhook_receiver.port !== undefined && { port: options.webhook_receiver.port }),\n ...(options.webhook_receiver.public_url !== undefined && { public_url: options.webhook_receiver.public_url }),\n })\n : undefined;\n const runnerVars = createRunnerVariables({\n ...(webhookReceiver && { webhookBase: webhookReceiver.base_url }),\n });\n // Pre-arm retry-replay policies for any expect_webhook_retry_keys_stable\n // steps. Ordering matters: the receiver must be rejecting deliveries\n // before the triggering step fires its webhook, otherwise the first\n // delivery succeeds and the sender never retries.\n if (webhookReceiver) armWebhookAssertions(storyboard, runnerVars, webhookReceiver);\n\n // Flatten all steps for next-step preview lookups\n const allSteps = flattenSteps(storyboard);\n // Inner passes always dispatch round-robin; only the outer runMultiPass\n // caller knows about the multi-pass strategy. This keeps createDispatcher's\n // strategy parameter narrow. Per-specialism routing (#1066) takes the\n // routing dispatcher path, which reads `options.agents` directly and\n // ignores `agentUrls` ordering for selection (still uses URL list for\n // result-record `agent_url:` echo).\n const dispatch =\n routingContext && options.agents\n ? createRoutingDispatcher(routingContext, options, options.agents)\n : createDispatcher(agentUrls, clients, 'round-robin', dispatchOffset, profile);\n\n // Resolve cross-step assertions declared on `storyboard.invariants`.\n // `resolveAssertions` throws on unknown ids — fail fast here rather than\n // silently skip, since a missing assertion means unknown conformance gaps.\n const assertions = resolveAssertions(storyboard.invariants);\n // Step-level `invariants.disable` uses the resolved set as its universe:\n // an id is only a valid step-level opt-out if it actually runs on this\n // storyboard. Typos and dead-code references (already disabled run-wide)\n // fail fast here for the same reason.\n validateStepInvariants(storyboard, assertions);\n const assertionContexts = new Map<string, AssertionContext>();\n for (const spec of assertions) {\n assertionContexts.set(spec.id, {\n storyboard,\n agentUrl: agentUrls[0]!,\n options,\n state: {},\n });\n }\n const assertionResults: AssertionResult[] = [];\n let assertionsFailed = false;\n for (const spec of assertions) {\n if (spec.onStart) await spec.onStart(assertionContexts.get(spec.id)!);\n }\n\n // Placeholder storyboards with no executable phases get a distinct skip\n // reason per the runner-output contract. Without this, the overall result\n // would pass vacuously — `passed_count === 0 && failed_count === 0` — and\n // an implementor reading the report can't tell \"nothing tested\" from\n // \"everything passed\".\n const hasExecutableSteps = storyboard.phases.some(p => p.steps.length > 0);\n const phaseCapabilitySkipDetails = collectPhaseCapabilitySkipDetails(\n storyboard,\n profile,\n options.agentTools,\n options.adcpVersion\n );\n const skipControllerSeedingForPhaseGates = allExecutablePhasesCapabilitySkipped(\n storyboard,\n phaseCapabilitySkipDetails\n );\n const capabilitySkippedPhaseIds = new Set([\n ...phaseCapabilitySkipDetails.keys(),\n ...storyboard.phases.filter(phase => shouldSkipPhase(phase, options)).map(phase => phase.id),\n ]);\n let creativeAssetFixtureGap = preflightRemainingCreativeAssetDirectives(\n allSteps,\n -1,\n context,\n options,\n {\n contributions,\n priorStepResults,\n priorProbes,\n agentUrl: agentUrls[0]!,\n webhookReceiver,\n runnerVars,\n contextProvenance,\n priorA2aEnvelopes,\n stepRequestStarts,\n responseDerivedNotApplicableContextKeys,\n agentProfile: profile,\n agentLibraryVersion: profile?.library_version,\n storyboardRequiresRequestSigner: allRequires.includes('request_signer'),\n storyboardRequiresPublisherAuthRunner:\n storyboard.requires?.includes('trusted_match_publisher_auth_runner') === true,\n },\n capabilitySkippedPhaseIds\n );\n let creativeAssetFixtureGapRecorded = false;\n if (!hasExecutableSteps) {\n const isScenarioComposed = (storyboard.requires_scenarios?.length ?? 0) > 0;\n const detail = isScenarioComposed\n ? `Storyboard \"${storyboard.id}\" has no local phases — its test surface is fully composed from the scenarios listed in \\`requires_scenarios\\`.`\n : `Storyboard \"${storyboard.id}\" has no executable phases — populate \\`phases[].steps\\` or remove the storyboard.`;\n const syntheticStep: StoryboardStepResult = {\n storyboard_id: storyboard.id,\n // Synthetic sentinel. Functionally non-colliding because downstream\n // consumers (CLI report, storyboard-tracks) key on `skip_reason`,\n // not `phase_id`/`step_id`. Matches the documented `RunnerSkipReason`\n // vocabulary in storyboard/types.ts.\n step_id: 'no_phases',\n phase_id: 'no_phases',\n title: 'Storyboard has no executable phases',\n task: '',\n passed: true,\n skipped: true,\n skip_reason: 'no_phases',\n skip: buildSkip('no_phases', detail),\n duration_ms: 0,\n validations: [],\n context,\n error: detail,\n extraction: { path: 'none' },\n };\n phaseResults.push({\n phase_id: 'no_phases',\n phase_title: 'No phases',\n passed: true, // skipped step is neutral — phase must not fail\n steps: [syntheticStep],\n duration_ms: 0,\n });\n skippedCount++;\n }\n\n // Pre-flight controller seeding (adcp-client#778). When the storyboard\n // declares `prerequisites.controller_seeding: true` and carries a\n // `fixtures:` block, fire the corresponding `seed_*` scenarios on\n // `comply_test_controller` so the seller's catalog / ledger holds every\n // fixture id the downstream phases reference. On any seed failure we\n // cascade-skip the remaining phases with `controller_seeding_failed` so\n // the report shows \"setup broke\" instead of a thicket of per-step\n // PRODUCT_NOT_FOUND / VALIDATION_ERROR failures. Runs against the first\n // client only: in multi-instance mode the seller is expected to share\n // state across replicas (that is what multi-instance tests exist to\n // verify). Sellers that hold per-replica state must opt out via\n // `skip_controller_seeding`.\n //\n // The seeding phase is held in a sidecar rather than pushed into\n // `phaseResults` up-front so every downstream consumer that indexes\n // `phaseResults[i]` against `storyboard.phases[i]` (branch-set grading,\n // `requiredPhasesPassed`) keeps working. It is spliced to the front of\n // `phaseResults` at the end so the report reads top-to-bottom in the\n // order the runner actually executed things.\n //\n // Multi-pass mode populates `preSeeded` so seeding fires exactly once\n // across all passes — see `runMultiPass`. Without the sidecar, every\n // pass would re-seed and the aggregator's cross-pass sum would inflate\n // `failed_count`/`skipped_count` by N when a single fixture broke.\n let seedingPhaseResult: StoryboardPhaseResult | null = null;\n let seedingFailed = false;\n let seedingMissingController = false;\n let seedingUnsupported = false;\n let fixtureUnsatisfied = false;\n let fixtureBindings: FixtureBindingRegistry | undefined;\n let fixtureResolutionRecords: FixtureResolutionRecord[] | undefined;\n let fixtureCoverageGap: FixtureResolutionCoverageGap | undefined;\n {\n let fixtureSeedClient = clients[0]!;\n let fixtureDiscoveryClient = clients[0]!;\n if (routingContext && options.agents) {\n const fixtureStep = (task: string): StoryboardStep => ({\n id: `__fixture_resolution_${task}__`,\n title: `Fixture resolution via ${task}`,\n task,\n });\n if (options.agentTools?.includes('comply_test_controller')) {\n fixtureSeedClient = dispatch.nextFor(fixtureStep('comply_test_controller')).client;\n }\n if (options.agentTools?.includes('get_products')) {\n fixtureDiscoveryClient = dispatch.nextFor(fixtureStep('get_products')).client;\n }\n }\n const seeding = creativeAssetFixtureGap\n ? null\n : skipControllerSeedingForPhaseGates\n ? null\n : preSeeded !== undefined\n ? preSeeded.result\n : await runControllerSeeding(fixtureSeedClient, storyboard, options, context, fixtureDiscoveryClient);\n if (seeding) {\n const attach = preSeeded === undefined || preSeeded.attach;\n if (attach) {\n seedingPhaseResult = seeding.phase;\n passedCount += seeding.passedCount;\n failedCount += seeding.failedCount;\n if (seeding.missingController || seeding.seedUnsupported || seeding.fixtureUnsatisfied) {\n skippedCount += seeding.phase.steps.filter(step => step.skipped).length;\n }\n }\n fixtureBindings = seeding.bindings;\n fixtureResolutionRecords = seeding.resolutionRecords;\n fixtureUnsatisfied = seeding.fixtureUnsatisfied === true && seeding.failedCount === 0;\n if (fixtureUnsatisfied) {\n // Fixture coverage is the more specific storyboard-level reason when\n // an authored placeholder has no executable phases. Do not retain the\n // generic no_phases sentinel or count both reasons.\n const noPhasesIndex = phaseResults.findIndex(phase => phase.phase_id === 'no_phases');\n if (noPhasesIndex >= 0) {\n skippedCount -= phaseResults[noPhasesIndex]!.steps.filter(step => step.skipped).length;\n phaseResults.splice(noPhasesIndex, 1);\n }\n // Multi-pass attaches/counts pre-flight resolution only on pass one,\n // so the aggregate contains exactly one storyboard-level skip.\n if (attach) skippedCount += 1;\n }\n const hasUnsatisfiedFixtures = fixtureResolutionRecords?.some(record => record.status === 'unsatisfied') === true;\n if (hasUnsatisfiedFixtures && fixtureResolutionRecords) {\n const fixtures = fixtureResolutionRecords\n .filter(record => record.status === 'unsatisfied')\n .map(record => ({\n fixture_type: record.fixture_type,\n handle: record.handle,\n ...(record.product_handle && { product_handle: record.product_handle }),\n requirements: record.requirements,\n }));\n const names = fixtures.map(fixture =>\n fixture.fixture_type === 'pricing_option'\n ? `pricing_option \"${fixture.product_handle}/${fixture.handle}\"`\n : `product \"${fixture.handle}\"`\n );\n fixtureCoverageGap = {\n reason: 'fixture_unsatisfied',\n detail: `fixture_unsatisfied: no seller fixture satisfied ${names.join(', ')}`,\n fixtures,\n };\n }\n if (seeding.missingController) {\n seedingMissingController = true;\n } else if (seeding.seedUnsupported) {\n seedingUnsupported = true;\n } else if (!seeding.allPassed) {\n seedingFailed = true;\n }\n }\n }\n\n const buildExecutionState = (\n agentUrl = agentUrls[0]!,\n agentProfile: AgentProfile | undefined = profile\n ): ExecutionState => ({\n contributions,\n priorStepResults,\n priorProbes,\n agentUrl,\n webhookReceiver,\n runnerVars,\n contextProvenance,\n priorA2aEnvelopes,\n stepRequestStarts,\n responseDerivedNotApplicableContextKeys,\n agentProfile,\n agentLibraryVersion: agentProfile?.library_version,\n storyboardRequiresRequestSigner: allRequires.includes('request_signer'),\n storyboardRequiresPublisherAuthRunner:\n storyboard.requires?.includes('trusted_match_publisher_auth_runner') === true,\n fixtureBindings,\n });\n if (\n !creativeAssetFixtureGap &&\n !seedingMissingController &&\n !seedingUnsupported &&\n !seedingFailed &&\n !fixtureUnsatisfied\n ) {\n creativeAssetFixtureGap = preflightRemainingCreativeAssetDirectives(\n allSteps,\n -1,\n context,\n options,\n buildExecutionState(),\n capabilitySkippedPhaseIds\n );\n }\n\n for (const phase of storyboard.phases) {\n // adcp-client#1612: bail at phase boundaries when comply()'s combined\n // timeout/external signal has aborted. Without this the phase loop runs\n // to completion regardless of the outer budget.\n options.signal?.throwIfAborted();\n const phaseStart = Date.now();\n\n // A pure resolution miss is one storyboard-level skip, not an\n // ordinary-step skip. Short-circuit before capability and other phase\n // gates so no ordinary rows or per-step counts are produced for this run.\n if (fixtureUnsatisfied) {\n phaseResults.push({\n phase_id: phase.id,\n phase_title: phase.title,\n passed: true,\n steps: [],\n duration_ms: 0,\n });\n continue;\n }\n\n // A captured seller format proved that a future creative directive cannot\n // be synthesized. Preserve earlier observations, record the directive\n // step once, and leave every other remaining phase empty: no side effect\n // or prerequisite cascade may occur after this runner-owned coverage gap.\n if (creativeAssetFixtureGap) {\n const gapSteps: StoryboardStepResult[] = [];\n if (!creativeAssetFixtureGapRecorded && creativeAssetFixtureGap.target.phaseId === phase.id) {\n const gapStep = buildCreativeAssetFixtureUnavailableStep(\n creativeAssetFixtureGap.target.step,\n phase.id,\n context,\n allSteps,\n buildExecutionState(),\n creativeAssetFixtureGap.failure\n );\n gapStep.storyboard_id = storyboard.id;\n gapSteps.push(gapStep);\n priorStepResults.set(gapStep.step_id, gapStep);\n skippedCount++;\n creativeAssetFixtureGapRecorded = true;\n }\n phaseResults.push({\n phase_id: phase.id,\n phase_title: phase.title,\n passed: true,\n steps: gapSteps,\n duration_ms: 0,\n });\n priorPhaseIds.push(phase.id);\n continue;\n }\n\n const phaseCapabilitySkipDetail = phaseCapabilitySkipDetails.get(phase.id);\n if (phaseCapabilitySkipDetail !== undefined) {\n const skippedSteps = buildPhaseCapabilitySkippedSteps(storyboard, phase, phaseCapabilitySkipDetail, context);\n phaseResults.push({\n phase_id: phase.id,\n phase_title: phase.title,\n passed: true,\n steps: skippedSteps,\n duration_ms: Date.now() - phaseStart,\n });\n skippedCount += skippedSteps.length;\n phaseCapabilitySkippedIds.add(phase.id);\n priorPhaseIds.push(phase.id);\n continue;\n }\n const stepResults: StoryboardStepResult[] = [];\n let phasePassed = true;\n // `statefulFailed` and `statefulSkipTrigger` live at storyboard\n // scope (declared above the phase loop) so the cascade survives\n // cross-phase setup → assertion patterns. See declaration site for\n // the rationale (signal_marketplace/governance_denied story).\n //\n // Phase-scoped substitution tracking (adcp-client#1005, round-9; #1144).\n //\n // Two deferral paths:\n // 1. `not_applicable` on a stateful step (any-peer rescue) — preserved\n // from the F6 fix. Rescued by ANY passing stateful step in the\n // phase. Backward-compatible with storyboards that haven't adopted\n // explicit substitution declarations.\n // 2. `missing_tool` / `missing_test_controller` on a stateful step\n // WITH a declared substitute peer (`peer_substitutes_for`) in the\n // same phase. Rescued ONLY when the declared substitute actually\n // passes. Without a declaration, hard-missing reasons trip the\n // cascade immediately as before.\n //\n // Path (2) is opt-in via storyboard YAML: a substitute step declares\n // `peer_substitutes_for: <target_step_id>` to assert that its passing\n // establishes equivalent state. Phase membership alone is NOT treated\n // as substitutability — explicit declaration is required.\n let phasePendingNotApplicable: { stepId: string; reason: RunnerSkipReason | RunnerDetailedSkipReason } | null =\n null;\n let phaseEstablishedStatefulState = false;\n // Path (2): index of declared substitutions for this phase. Map keys\n // are target step IDs (the steps being substituted FOR); values are the\n // step IDs that declared the substitution. Built once per phase from\n // each step's `provides_state_for` field (or the deprecated\n // `peer_substitutes_for` synonym; the loader normalizes both onto\n // `provides_state_for` at parse time, so reading either works).\n const phaseSubstitutes = new Map<string, string[]>();\n for (const declaringStep of phase.steps) {\n const decl = declaringStep.provides_state_for ?? declaringStep.peer_substitutes_for;\n if (decl === undefined) continue;\n const targets = Array.isArray(decl) ? decl : [decl];\n for (const target of targets) {\n const arr = phaseSubstitutes.get(target) ?? [];\n arr.push(declaringStep.id);\n phaseSubstitutes.set(target, arr);\n }\n }\n // Path (2) state. `phasePendingMissingTool` is the deferred-cascade\n // trigger for a stateful step that skipped with a hard-missing reason\n // AND has at least one declared substitute in this phase. Only the\n // first such trigger is recorded — the cascade-detail message\n // references the leftmost step.\n let phasePendingMissingTool: {\n stepId: string;\n reason: RunnerSkipReason | RunnerDetailedSkipReason;\n substitutes: string[];\n } | null = null;\n // Targets actually rescued by a passing declared substitute. Populated\n // when a step with `provides_state_for: X` (or the deprecated synonym\n // `peer_substitutes_for: X`) passes — every X in its declaration list\n // lands here.\n const phaseRescuedTargets = new Set<string>();\n // Map from rescued target id → the substitute step id that rescued it.\n // Populated when the substitute passes; consumed at phase end to format\n // the spec-mandated `peer_substituted` detail string. First substitute\n // wins if multiple peers cover the same target.\n const phaseRescueSource = new Map<string, string>();\n // Stateful step IDs in the phase. Used at phase end to decide whether\n // a deferred not_applicable trigger should cascade: if the sole stateful\n // step in the phase returned not_applicable AND there were no peers that\n // could have established substitute state, the cascade should NOT fire —\n // the platform simply doesn't use that pathway, which is valid. Only when\n // peer-stateful steps existed (and none established state) do we promote\n // the pending trigger to a hard cascade. Computed eagerly at phase\n // initialization so it's always available when the resolution block runs.\n const phaseStatefulStepIds = phase.steps.filter(s => s.stateful).map(s => s.id);\n // PRM presence-probe state (adcp-client#677). `phaseAbsent` flips when\n // /.well-known/oauth-protected-resource returns 404 — subsequent steps\n // in this phase cascade-skip instead of failing their http_status:200\n // validations. `presenceDetected` flips when PRM returns a 2xx: the\n // agent IS advertising OAuth, so validation failures in this phase\n // become hard failures regardless of `optional: true`, closing the\n // spoofing path where a broken PRM + valid API key could silently pass.\n let phaseAbsent = false;\n let presenceDetected = false;\n\n if (shouldSkipPhase(phase, options)) {\n phaseResults.push({\n phase_id: phase.id,\n phase_title: phase.title,\n passed: true, // optional phase skipped — neutral\n steps: [],\n duration_ms: 0,\n });\n continue;\n }\n\n // Pre-empt OAuth-metadata probes when the agent's capabilities never\n // advertised OAuth at all (adcp-client#1702). Without this, an\n // API-key-only agent (e.g. Wonderstruck) has its PRM endpoint\n // probed; if the well-known path returns anything other than 404\n // (the existing reactive cascade trigger in `executeProbeStep`),\n // validations fail and `oauth_discovery` produces 5 false-negative\n // step failures even though the phase is `optional: true`. The skip\n // is phase-level — not storyboard-level — so the universal\n // `unauth_rejection` and `mechanism_required` phases still run.\n if (!phaseAbsent && phaseContainsOauthMetadataProbe(phase) && !agentAdvertisesOauth(profile)) {\n phaseAbsent = true;\n }\n\n // Reset alias cache at this phase boundary (#1657). $generate:uuid_v4#alias\n // is designed to be stable within a scenario — the initial call and its\n // idempotency replay share the same UUID — but aliases must NOT bleed across\n // phases. Independent test groups that each start with a \"setup\" step need\n // fresh idempotency keys; otherwise the seller's idempotency cache replays\n // stale state from a prior group into the new one. Creating a new object\n // identity drops the WeakMap entry without losing any $context.* values\n // (those ride as plain properties on the spread result).\n context = { ...context };\n\n // Seeding-cascade skip: the pre-flight seed phase can fail as a setup\n // break, or the agent can be out-of-scope for fixture seeding because it\n // lacks either the controller tool or a required seed_* scenario. Emit\n // full step rows so implementors see which buyer-side operations were\n // elided.\n if (seedingMissingController || seedingUnsupported || seedingFailed) {\n const cascadeSkip: Pick<StoryboardStepResult, 'skip_reason' | 'skip'> = seedingMissingController\n ? {\n skip_reason: 'missing_test_controller',\n skip: { reason: 'missing_test_controller', detail: SKIP_DETAILS.missing_test_controller },\n }\n : seedingUnsupported\n ? {\n skip_reason: 'fixture_seed_unsupported',\n skip: { reason: 'not_applicable', detail: FIXTURE_SEED_UNSUPPORTED_DETAIL },\n }\n : seedingFailed\n ? {\n skip_reason: 'controller_seeding_failed',\n skip: { reason: 'prerequisite_failed', detail: CONTROLLER_SEEDING_FAILED_DETAIL },\n }\n : {\n skip_reason: 'controller_seeding_failed',\n skip: { reason: 'prerequisite_failed', detail: CONTROLLER_SEEDING_FAILED_DETAIL },\n };\n const cascadeSteps: StoryboardStepResult[] = phase.steps.map(step => ({\n storyboard_id: storyboard.id,\n step_id: step.id,\n phase_id: phase.id,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n ...cascadeSkip,\n duration_ms: 0,\n validations: [],\n context,\n extraction: { path: 'none' },\n }));\n phaseResults.push({\n phase_id: phase.id,\n phase_title: phase.title,\n passed: true,\n steps: cascadeSteps,\n duration_ms: 0,\n });\n skippedCount += cascadeSteps.length;\n continue;\n }\n\n for (const step of phase.steps) {\n // adcp-client#1612: per-step abort gate. The dominant comply() cost\n // on a healthy seller is sequential per-tool calls inside a single\n // storyboard's phase — without this check the phase runs to completion\n // even after comply() has already signalled \"give up\".\n options.signal?.throwIfAborted();\n // Cascade-skip when the PRM presence probe declared the phase absent.\n if (phaseAbsent) {\n const cascadeResult: StoryboardStepResult = {\n storyboard_id: storyboard.id,\n step_id: step.id,\n phase_id: phase.id,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: 'oauth_not_advertised',\n skip: { reason: 'not_applicable', detail: OAUTH_NOT_ADVERTISED_DETAIL },\n duration_ms: 0,\n validations: [],\n context,\n extraction: { path: 'none' },\n };\n stepResults.push(cascadeResult);\n priorStepResults.set(step.id, cascadeResult);\n skippedCount++;\n continue;\n }\n\n // Skip remaining steps if a stateful dependency failed (or\n // skipped for a missing-state reason). Before applying the\n // cascade reason, check the step's intrinsic skip-eligibility:\n // if the agent never advertised this step's tool, the correct\n // reason is `missing_tool` (a benign, passed: true skip) —\n // not `prerequisite_failed` (a failed skip). This distinguishes\n // \"this agent has a real setup bug\" from \"this agent doesn't\n // claim this surface, by design\" (adcp-client#1169 / #1171).\n //\n // Uses resolveTaskName so that $test_kit.* steps are checked\n // against the resolved concrete task name, not the template\n // string (which would never be in agentTools).\n //\n // Per-phase cascade scoping (#1161): consults `phase.depends_on`\n // (default: all prior phases) plus the current phase's own\n // within-phase cascade state. Replaces the storyboard-scope\n // `statefulFailed` boolean.\n const cascade = step.stateful ? cascadeForPhase(phase, priorPhaseIds) : { tripped: false };\n if (cascade.tripped && step.stateful) {\n const resolvedTask = resolveTaskName(step, options);\n if (options.agentTools && resolvedTask && !options.agentTools.includes(resolvedTask)) {\n const toolDetail = `Agent did not advertise tool \"${resolvedTask}\"; agent tools: [${options.agentTools.join(', ')}].`;\n const missingToolResult: StoryboardStepResult = {\n storyboard_id: storyboard.id,\n step_id: step.id,\n phase_id: phase.id,\n title: step.title,\n task: resolvedTask,\n passed: true,\n skipped: true,\n skip_reason: 'missing_tool',\n skip: buildSkip('missing_tool', toolDetail),\n duration_ms: 0,\n validations: [],\n context,\n extraction: { path: 'none' },\n };\n stepResults.push(missingToolResult);\n priorStepResults.set(step.id, missingToolResult);\n skippedCount++;\n continue;\n }\n const trigger = (cascade as { tripped: true; trigger: CascadeTrigger | null }).trigger;\n const detail = trigger\n ? trigger.substitution_chain\n ? `Skipped: prior stateful step \"${trigger.stepId}\" skipped (${trigger.reason}); ${trigger.substitution_chain}; state never materialized.`\n : `Skipped: prior stateful step \"${trigger.stepId}\" skipped (${trigger.reason}); state never materialized.`\n : 'Skipped: prior stateful step failed.';\n stepResults.push({\n storyboard_id: storyboard.id,\n step_id: step.id,\n phase_id: phase.id,\n title: step.title,\n task: step.task,\n passed: false,\n skipped: true,\n skip_reason: 'prerequisite_failed',\n skip: buildSkip('prerequisite_failed', detail),\n duration_ms: 0,\n validations: [],\n context,\n error: detail,\n extraction: { path: 'none' },\n });\n skippedCount++;\n phasePassed = false;\n continue;\n }\n\n let assignment;\n try {\n assignment = dispatch.nextFor(step);\n } catch (err) {\n // Routing failures land here when no agent in the map serves a\n // step's tool's protocol. Build-time conflict detection already\n // catches the multi-claim case, so this branch covers genuine\n // coverage gaps (storyboard authored a tool the topology can't\n // serve) and unmapped tools without a `default_agent`. Render as\n // a failed step with the routing error verbatim so the report\n // tells the operator exactly what's missing.\n const detail = err instanceof RoutingError ? err.message : ((err as Error)?.message ?? String(err));\n const failed: StoryboardStepResult = {\n storyboard_id: storyboard.id,\n step_id: step.id,\n phase_id: phase.id,\n title: step.title,\n task: step.task,\n passed: false,\n duration_ms: 0,\n validations: [],\n context,\n error: detail,\n extraction: { path: 'none' },\n };\n stepResults.push(failed);\n priorStepResults.set(step.id, failed);\n failedCount++;\n phasePassed = false;\n continue;\n }\n const stepExecutionState = buildExecutionState(assignment.agentUrl, assignment.profile);\n const rawResult = await executeStep(\n assignment.client,\n step,\n storyboard.id,\n phase.id,\n context,\n allSteps,\n options,\n stepExecutionState\n );\n const result: StoryboardStepResult = { ...rawResult, storyboard_id: storyboard.id };\n if (isMultiInstance || useRouting) {\n // Echo per-step routing on the result so JUnit/CI consumers and\n // bug reports show which agent served which tool. In routed mode\n // every step gets the field; in replica round-robin only when\n // there are 2+ URLs.\n result.agent_url = redactOAuthUrlForOutput(assignment.agentUrl);\n result.agent_index = assignment.instanceIndex + 1;\n }\n stepResults.push(result);\n priorStepResults.set(step.id, result);\n\n // Schema-validation short-circuit (adcp-client#1709). When the\n // response unwrapper rejected the agent's response against the SDK's\n // Zod schema, the step-execution path synthesized a failing\n // `response_schema` ValidationResult on `result.validations`.\n // Running step-scope invariants against a response the SDK has\n // already declared malformed produces noise — the invariants\n // can't meaningfully grade a payload that didn't parse. Worse,\n // before #1709 the invariants' failure entries crowded out the\n // schema-validation entry in `extractFailures`, masking the root\n // cause across BidMachine's 10+ deploys (see adcp#4419). Skip the\n // invariant pass entirely on this step and emit a single skipped\n // `assertion` entry per invariant so consumers can still see WHICH\n // invariants were skipped and why.\n const schemaInvalidResponse = result.validations.some(\n v => v.check === 'response_schema' && validationFailsStep(v)\n );\n\n // Rate-limit exhaustion is a contract-defined applicability result,\n // not a response to grade. Preserve its empty validations array and\n // passing skip status. Step assertions still run and remain visible on\n // the storyboard-level assertions surface, but are not mirrored onto\n // this skipped step or counted as a failed step.\n const rateLimitTripNotApplicable = result.skipped === true && result.skip_reason === 'rate_limit_not_triggered';\n\n // Fire per-step assertions. Each result is appended to the step's\n // `validations[]` under `check: \"assertion\"` so existing UI renders\n // them alongside inline checks, and mirrored into `assertionResults`\n // for the storyboard-level `assertions[]` surface. Any failure flips\n // `result.passed` so the counting below treats it like a validation\n // failure — that's what makes assertions gating, not advisory.\n for (const spec of assertions) {\n if (!spec.onStep) continue;\n // Per-step opt-out: authors use `step.invariants.disable: [id]` to\n // suppress a default invariant on a step that deliberately models\n // behavior the invariant would flag (validated at runner start).\n if (stepDisablesAssertion(step.invariants, spec.id)) continue;\n if (schemaInvalidResponse) {\n // Emit a skipped marker so the report shows the invariant was\n // intentionally bypassed (not silently dropped). `passed: true`\n // keeps it from flipping `result.passed` — the schema-validation\n // failure already did that.\n result.validations.push({\n check: 'assertion',\n passed: true,\n description: `${spec.id}: skipped — response failed schema validation (adcp-client#1709)`,\n });\n continue;\n }\n const raw = await spec.onStep(assertionContexts.get(spec.id)!, result);\n for (const r of raw) {\n const full: AssertionResult = { ...r, assertion_id: spec.id, scope: 'step', step_id: step.id };\n assertionResults.push(full);\n if (!rateLimitTripNotApplicable) {\n result.validations.push({\n check: 'assertion',\n passed: r.passed,\n description: `${spec.id}: ${r.description}`,\n ...(r.error !== undefined && { error: r.error }),\n });\n }\n // Issue #935: assertions can attach a structured hint that the\n // runner mirrors into the owning step's `hints[]`. Producers today\n // include `status.monotonic` (monotonic_violation) and\n // `impairment.coherence` (impairment_coherence_violation); the\n // merge here keeps the taxonomy unified so a single CLI/JUnit/Addie\n // renderer can drive off `step.hints[]` regardless of which\n // subsystem produced it.\n if (r.hint) {\n const existing = result.hints ?? [];\n result.hints = [...existing, r.hint];\n }\n if (!r.passed) {\n if (!rateLimitTripNotApplicable) result.passed = false;\n assertionsFailed = true;\n }\n }\n }\n\n // PRM presence accounting — must happen after the step result lands so\n // both the skipped-404 and 2xx paths are visible.\n if (step.task === 'protected_resource_metadata') {\n if (result.skipped && result.skip_reason === 'oauth_not_advertised') {\n phaseAbsent = true;\n } else {\n const status = (result.response as HttpProbeResult | undefined)?.status;\n if (typeof status === 'number' && status >= 200 && status < 300) {\n presenceDetected = true;\n }\n }\n }\n\n // Record contribution on success, honoring optional contributes_if predicate.\n if (!result.skipped && result.passed && step.contributes_to) {\n if (evalContributesIf(step.contributes_if, priorStepResults)) {\n const flag = step.contributes_to;\n if (!contributions.has(flag)) {\n contributionSources.set(flag, { phaseId: phase.id, stepId: step.id });\n }\n contributions.add(flag);\n }\n }\n\n if (result.skipped) {\n skippedCount++;\n context = result.context;\n // Cascade-skip extension: a stateful step that SKIPS because the\n // agent simply lacks the tool (`missing_tool`,\n // `missing_test_controller`) is equivalent to a failed stateful\n // step — state genuinely never materialized. Trip immediately so\n // downstream stateful steps skip with `prerequisite_failed`\n // instead of running against absent state and surfacing a\n // misleading assertion failure.\n //\n // `not_applicable` is handled separately (adcp-client#1005,\n // round-9). It signals \"this path doesn't apply to this agent\",\n // and the storyboard may have a peer step in the same phase\n // that establishes equivalent state — e.g. an explicit-mode\n // seller's `list_accounts` substituting for `sync_accounts`.\n // We record a pending trigger and let the rest of the phase\n // run; the cascade decision is finalized at phase end based on\n // whether any stateful peer passed.\n //\n // Skips that imply state DID materialize via another path\n // (`peer_branch_taken`, `controller_seeding_failed` — handled\n // by phase-level cascade, `oauth_not_advertised` — phase-absent\n // path) deliberately don't trip the flag.\n if (step.stateful) {\n if (isHardMissingStateSkipReason(result.skip_reason)) {\n // Hard-missing skip on a stateful step. Defer the cascade only\n // when a peer in this phase has declared\n // `peer_substitutes_for: <this_step_id>` — that peer's pass\n // establishes equivalent state. Without a declaration,\n // missing_tool / missing_test_controller trips the cascade\n // immediately (existing behavior).\n const substitutes = phaseSubstitutes.get(step.id);\n if (substitutes && substitutes.length > 0) {\n if (phasePendingMissingTool === null) {\n phasePendingMissingTool = {\n stepId: step.id,\n reason: result.skip_reason ?? 'missing_tool',\n substitutes,\n };\n }\n } else {\n // Sole-stateful-step exemption (adcp-client-python#550):\n // when a hard-missing skip lands on the ONLY stateful step\n // in the phase, no peer could have established substitute\n // state — same shape as #1146's `not_applicable` exemption.\n // The platform legitimately doesn't implement this pathway\n // (e.g., proposal-mode / implicit-account adopters that\n // skip `sync_accounts` because account state materializes\n // on the first `get_products` call). Cascading every\n // downstream phase to `prerequisite_failed` collapses\n // useful coverage; let downstream phases run and fail on\n // their own merits if state genuinely never materialized.\n //\n // The skipping step is always stateful and always in\n // `phaseStatefulStepIds` (built eagerly at phase init), so\n // length > 1 ⇔ a stateful peer exists.\n const hasStatefulPeers = phaseStatefulStepIds.length > 1;\n if (hasStatefulPeers && !phaseStatefulCascades.has(phase.id)) {\n // Multiple stateful steps in the phase but no declared\n // substitute. Trip the cascade. First trip wins —\n // subsequent triggers don't overwrite, since the cascade\n // text references the originating diagnostic (the\n // leftmost missing-state stateful step in the phase).\n phaseStatefulCascades.set(phase.id, {\n stepId: step.id,\n reason: result.skip_reason ?? 'missing_tool',\n });\n } else if (!hasStatefulPeers && result.skip) {\n // Exemption applied. Surface the runner's decision on the\n // step result so adopters reading per-step output don't\n // have to infer it from the absence of downstream skips.\n result.skip = {\n ...result.skip,\n detail: result.skip.detail + soleStatefulExemptionDetail(phase.id),\n };\n }\n }\n } else if (result.skip_reason === 'not_applicable') {\n // Defer cascade decision until end of phase. Applies the\n // same first-wins rule used for `statefulSkipTrigger`: the\n // eventual cascade-detail message references the leftmost\n // not_applicable step in the phase.\n //\n // Scope note: this branch matches the canonical literal\n // `'not_applicable'` only. Detailed-form skip reasons that\n // canonicalize to not_applicable (`probe_skipped`,\n // `not_in_only_vectors`, `grader_skipped`,\n // `mcp_mode_flattens_url_edges`) carry the detailed form\n // on `result.skip_reason` and do NOT enter the deferred\n // path — they preserve the pre-fix behavior of not\n // tripping the cascade. `oauth_not_advertised` is handled\n // by the separate `phaseAbsent` code path before this\n // branch is reached. If a future detailed reason should\n // participate in substitute-aware deferral, extend this\n // condition deliberately rather than assuming canonical\n // mapping is enough.\n if (phasePendingNotApplicable === null) {\n phasePendingNotApplicable = { stepId: step.id, reason: 'not_applicable' };\n }\n }\n }\n } else if (result.passed) {\n context = result.context;\n passedCount++;\n // A passing stateful step counts as the phase establishing\n // state. If a sibling skipped not_applicable earlier (or skips\n // it later in the loop), this pass is the substitute path —\n // the deferred cascade should NOT fire at phase end.\n if (step.stateful) {\n phaseEstablishedStatefulState = true;\n // Path (2) rescue tracking: a passing step that declared\n // `provides_state_for: X` (or the deprecated synonym\n // `peer_substitutes_for`) rescues X. Recorded against every\n // declared target so phase-end resolution sees the target as\n // covered even if its skip arrives later in the loop.\n const decl = step.provides_state_for ?? step.peer_substitutes_for;\n if (decl !== undefined) {\n const targets = Array.isArray(decl) ? decl : [decl];\n for (const target of targets) {\n phaseRescuedTargets.add(target);\n // Track the rescuing substitute's id so phase-end can format\n // the contract-mandated `peer_substituted` detail string.\n if (!phaseRescueSource.has(target)) {\n phaseRescueSource.set(target, step.id);\n }\n }\n }\n }\n } else {\n phasePassed = false;\n // Optional phases normally swallow step failures — the storyboard's\n // final assert_contribution gate decides pass/fail via the \"API key\n // OR OAuth\" logic. Exception: once a PRM presence probe has\n // detected the agent IS advertising OAuth, subsequent validation\n // failures in this phase are hard failures (adcp-client#677). An\n // agent that serves PRM MUST serve it correctly.\n if (!phase.optional || presenceDetected) {\n failedCount++;\n countedAsFailed.add(result);\n }\n if (step.stateful) {\n // Real failure takes precedence over a prior skip-trigger in\n // the cascade detail message — failures are the worse\n // diagnostic, so downstream cascade-skipped steps should\n // reference the failure rather than the earlier benign-ish\n // missing-state skip. `null` trigger encodes \"real failure,\n // detail says 'prior stateful step failed'.\"\n phaseStatefulCascades.set(phase.id, null);\n }\n // In multi-instance mode, annotate the failure with the cross-instance\n // attribution block so CI readers pattern-match it as a deployment bug.\n if (isMultiInstance) {\n annotateMultiInstanceFailure(result, storyboard, stepResults);\n }\n }\n\n if (!result.skipped && result.passed) {\n const currentGlobalIndex = allSteps.find(\n flat => flat.phaseId === phase.id && flat.step.id === step.id\n )?.globalIndex;\n if (currentGlobalIndex !== undefined) {\n creativeAssetFixtureGap = preflightRemainingCreativeAssetDirectives(\n allSteps,\n currentGlobalIndex,\n context,\n options,\n stepExecutionState,\n capabilitySkippedPhaseIds\n );\n }\n if (creativeAssetFixtureGap) {\n if (creativeAssetFixtureGap.target.phaseId === phase.id) {\n const gapStep = buildCreativeAssetFixtureUnavailableStep(\n creativeAssetFixtureGap.target.step,\n phase.id,\n context,\n allSteps,\n stepExecutionState,\n creativeAssetFixtureGap.failure\n );\n gapStep.storyboard_id = storyboard.id;\n stepResults.push(gapStep);\n priorStepResults.set(gapStep.step_id, gapStep);\n skippedCount++;\n creativeAssetFixtureGapRecorded = true;\n }\n break;\n }\n }\n }\n\n // Phase-end cascade resolution for deferred `not_applicable` triggers.\n // If a stateful step skipped not_applicable earlier in this phase and\n // no stateful peer subsequently passed, we MAY promote to a hard cascade\n // so downstream phases skip cleanly instead of running against absent state.\n //\n // Cascade fires ONLY when there was at least one other stateful step in\n // the phase that could have served as a substitute — i.e. the phase had\n // peer steps, but none of them established state (#1146). A peer that\n // passed (e.g. `list_accounts` substituting for an explicit-mode\n // `sync_accounts`) cancels the trigger entirely. A peer that *failed*\n // already tripped this phase's cascade at the failure site with the\n // worse-diagnostic real-failure message; we defer to that and don't\n // overwrite.\n //\n // When the not_applicable step was the SOLE stateful step in the phase\n // (no peers existed at all), the cascade does NOT fire. That platform\n // simply doesn't use this sync pathway — which is valid. Cascading on a\n // sole not_applicable would incorrectly penalise adapters that manage\n // state implicitly and have no list_accounts peer (adcp-client#1146).\n if (phasePendingNotApplicable && !phaseEstablishedStatefulState && !phaseStatefulCascades.has(phase.id)) {\n const hadStatefulPeers = phaseStatefulStepIds.some(id => id !== phasePendingNotApplicable!.stepId);\n if (hadStatefulPeers) {\n phaseStatefulCascades.set(phase.id, phasePendingNotApplicable);\n } else {\n // Sole-stateful-step exemption fired. Mark the not_applicable\n // step result so adopters see the runner's decision explicitly\n // (parity with the missing_tool / missing_test_controller path\n // upstream — both decision sites annotate the skip detail).\n const naResult = stepResults.find(r => r.step_id === phasePendingNotApplicable!.stepId);\n if (naResult?.skip) {\n naResult.skip = {\n ...naResult.skip,\n detail: naResult.skip.detail + soleStatefulExemptionDetail(phase.id),\n };\n }\n }\n }\n\n // Phase-end cascade resolution for deferred `missing_tool` triggers\n // (#1144). A stateful step that skipped with a hard-missing reason\n // and had at least one declared substitute (`provides_state_for`,\n // formerly `peer_substitutes_for`) was deferred above. If none of\n // the declared substitutes passed, the substitution path failed to\n // establish state — promote to a hard cascade with a detail message\n // that names the substitute(s) tried so adopters reading the report\n // see the substitution chain rather than a bare `missing_tool`\n // cascade origin.\n if (\n phasePendingMissingTool &&\n !phaseRescuedTargets.has(phasePendingMissingTool.stepId) &&\n !phaseStatefulCascades.has(phase.id)\n ) {\n const subs = phasePendingMissingTool.substitutes;\n const subsList = subs.length === 1 ? `\"${subs[0]}\"` : subs.map(s => `\"${s}\"`).join(', ');\n phaseStatefulCascades.set(phase.id, {\n stepId: phasePendingMissingTool.stepId,\n reason: phasePendingMissingTool.reason,\n substitution_chain: `declared substitute ${subsList} did not pass`,\n });\n }\n\n // Phase-end re-grading for rescued targets (adcp#3734, AdCP 3.0.3+).\n // When a deferred `missing_tool` / `missing_test_controller` skip was\n // rescued by a passing same-phase substitute, the spec mandates the\n // target be re-graded with `skip_reason: 'peer_substituted'` and the\n // detail string `\"<target_step_id> state provided by <phase_id>.<substitute_step_id>\"`\n // — see `runner-output-contract.yaml` > `skip_result.reasons.peer_substituted`.\n // Without this re-grading the target keeps its original `missing_tool`\n // grade, which is misleading: state DID materialize, just via a\n // declared substitute path. Tracked: adcp-client#1267.\n for (const target of phaseRescuedTargets) {\n const sourceId = phaseRescueSource.get(target);\n if (!sourceId) continue;\n const targetResult = stepResults.find(r => r.step_id === target);\n if (!targetResult || !targetResult.skipped) continue;\n // Only re-grade hard-missing-state skips. Other skip reasons (e.g.\n // `prerequisite_failed`, `peer_branch_taken`) on the target are\n // outside the substitute-rescue contract. Uses the same helper as\n // the deferral path (line ~1269 above) so the two sides stay in\n // lockstep when a future RunnerSkipReason joins the family.\n if (!isHardMissingStateSkipReason(targetResult.skip_reason)) continue;\n const detail = `${target} state provided by ${phase.id}.${sourceId}`;\n targetResult.skip_reason = 'peer_substituted';\n targetResult.skip = { reason: 'peer_substituted', detail };\n }\n\n phaseResults.push({\n phase_id: phase.id,\n phase_title: phase.title,\n passed: phasePassed,\n steps: stepResults,\n duration_ms: Date.now() - phaseStart,\n });\n // Accumulate phase id for default `depends_on` resolution in the next\n // iteration — phases declared later see this one as a prior phase.\n priorPhaseIds.push(phase.id);\n }\n\n // Branch-set post-pass: phases in a branch set (explicit `branch_set:`\n // declaration or implicit detection via shared `contributes_to` + a later\n // any_of `assert_contribution`) whose flag was contributed by a peer have\n // their failed steps re-graded as skipped with `peer_branch_taken`. See\n // storyboard-schema.yaml (lines 205-223) and runner-output-contract.yaml\n // (reasons.peer_branch_taken). Done after all phases run — peer\n // contribution status isn't knowable inside the per-phase loop. Runs\n // before storyboard-scoped assertions so `onEnd` hooks see the finalized\n // per-step grades (a moot peer's \"failure\" should not trip a cross-step\n // invariant). `branchSetsByPhaseId` was resolved before the phase loop so\n // the stateful cascade could consult it (branch-set peers don't cascade\n // onto each other); reuse it here.\n const branchSetDelta = creativeAssetFixtureGap\n ? { skippedDelta: 0 }\n : applyBranchSetGrading(\n storyboard.phases,\n phaseResults,\n branchSetsByPhaseId,\n contributions,\n contributionSources,\n countedAsFailed\n );\n skippedCount += branchSetDelta.skippedDelta;\n\n // Fire storyboard-scoped assertions. These observe the full run and can\n // emit `scope: \"storyboard\"` findings that flip `overall_passed` without\n // being attributable to a single step (e.g. \"saw >1 acquire for the same\n // replayed idempotency_key across the run\").\n if (!creativeAssetFixtureGap) {\n for (const spec of assertions) {\n if (!spec.onEnd) continue;\n const raw = await spec.onEnd(assertionContexts.get(spec.id)!);\n for (const r of raw) {\n assertionResults.push({ ...r, assertion_id: spec.id, scope: 'storyboard' });\n if (!r.passed) assertionsFailed = true;\n }\n }\n }\n\n // Overall pass requires (a) no required-phase failures, (b) either an\n // executed pass or every required phase grading canonically not_applicable,\n // and (c) no assertion failures. Without (b), a storyboard where every phase\n // is optional or every required step is skipped for another reason (for\n // example, missing_tool) would pass vacuously.\n // (c) makes assertions gating — a run with all validations green but a\n // cross-step invariant broken is not conformant.\n // When no phases had executable steps the storyboard result is a skip, not a\n // failure. The index-aligned guard below would hit storyboard.phases[0] ===\n // undefined for an empty-phases storyboard and force requiredPhasesPassed to\n // false, flipping overall_passed to false. Short-circuit to true so the\n // no-phases sentinel produces overall_passed: true (consistent with how\n // buildNotApplicableStoryboardResult shapes its result in comply.ts).\n const requiredPhaseHasExecutedPass = phaseResults.some((p, idx) => {\n const phaseDef = storyboard.phases[idx];\n if (!phaseDef || phaseDef.optional || !p.passed) return false;\n return p.steps.some(s => !s.skipped && s.passed);\n });\n const requiredPhaseDefs = storyboard.phases.filter(phaseDef => !phaseDef.optional);\n const requiredPhasesNotApplicable =\n requiredPhaseDefs.length > 0 &&\n requiredPhaseDefs.every(phaseDef => {\n const phaseResult = phaseResults.find(p => p.phase_id === phaseDef.id);\n return (\n !!phaseResult &&\n phaseResult.passed &&\n phaseResult.steps.length > 0 &&\n phaseResult.steps.every(step => step.skipped && step.skip?.reason === 'not_applicable')\n );\n });\n const requiredPhasesCoveredByCapabilityGates =\n phaseCapabilitySkippedIds.size > 0 &&\n requiredPhaseDefs.length > 0 &&\n requiredPhaseDefs.every(phaseDef => {\n if (phaseCapabilitySkippedIds.has(phaseDef.id)) return true;\n const phaseResult = phaseResults.find(p => p.phase_id === phaseDef.id);\n return !!phaseResult && phaseResult.passed && phaseResult.steps.some(s => !s.skipped && s.passed);\n });\n const requiredPhasesPassed =\n !hasExecutableSteps ||\n requiredPhaseHasExecutedPass ||\n requiredPhasesNotApplicable ||\n (failedCount === 0 && requiredPhasesCoveredByCapabilityGates);\n const storyboardWideFixtureUnavailable =\n (seedingUnsupported || fixtureUnsatisfied || creativeAssetFixtureGap !== undefined) && failedCount === 0;\n // Prepend the pre-flight seeding phase now that every consumer that\n // index-aligns `phaseResults` with `storyboard.phases` has run. Reader\n // order matches execution order.\n if (seedingPhaseResult) phaseResults.unshift(seedingPhaseResult);\n const schemasUsed = collectSchemasUsed(phaseResults);\n const strictSummary = summarizeStrictValidation(phaseResults);\n const validationsNotApplicable = countValidationsNotApplicable(phaseResults);\n const validationsAdvisoryFailed = countValidationsAdvisoryFailed(phaseResults);\n // Use the fully-fetched profile for notice detection; fall back to pre-flight\n // notices (which used options._profile) when profile was not re-fetched in\n // this pass (standalone runner with options._profile pre-set skips the fetch).\n const notices = mergeRunnerNotices([\n ...collectCapabilityNotices(storyboard, profile ?? options._profile),\n ...collectStepNotices(phaseResults),\n ]);\n const result: StoryboardResult = {\n storyboard_id: storyboard.id,\n storyboard_title: storyboard.title,\n agent_url: redactOAuthUrlForOutput(agentUrls[0]!),\n ...(isMultiInstance && { agent_urls: agentUrls.map(redactOAuthUrlForOutput) }),\n // Inner multi-pass passes surface as `round-robin` (that's what they are\n // individually); the aggregating wrapper relabels the top-level result\n // `multi-pass`.\n ...(isMultiInstance && { multi_instance_strategy: 'round-robin' as const }),\n ...(routingContext && {\n agent_map: Object.fromEntries(\n Object.entries(routingContext.agentMap).map(([specialism, url]) => [specialism, redactOAuthUrlForOutput(url)])\n ),\n }),\n overall_passed:\n failedCount === 0 && (requiredPhasesPassed || storyboardWideFixtureUnavailable) && !assertionsFailed,\n phases: phaseResults,\n context,\n total_duration_ms: Date.now() - start,\n passed_count: passedCount,\n failed_count: failedCount,\n skipped_count: skippedCount,\n ...(validationsAdvisoryFailed > 0 ? { validations_advisory_failed: validationsAdvisoryFailed } : {}),\n ...(validationsNotApplicable > 0 ? { validations_not_applicable: validationsNotApplicable } : {}),\n runner_capability_version: RUNNER_CAPABILITY_VERSION,\n tested_at: new Date().toISOString(),\n ...(schemasUsed.length > 0 ? { schemas_used: schemasUsed } : {}),\n ...(assertionResults.length > 0 ? { assertions: assertionResults } : {}),\n strict_validation_summary: strictSummary,\n notices,\n ...(fixtureResolutionRecords && { fixture_resolutions: fixtureResolutionRecords }),\n ...(fixtureCoverageGap && { coverage_gaps: [fixtureCoverageGap] }),\n ...(routingContext && routingContext.discoveryFailures.length > 0\n ? {\n discovery_failures: routingContext.discoveryFailures.map(f => ({\n agent_key: f.agentKey,\n url: redactOAuthUrlForOutput(f.url),\n error: redactOAuthUrlsInText(f.underlying),\n })),\n }\n : {}),\n };\n\n // Close protocol connections when the runner created its own client. The\n // The runner scope tracks every URL used by this storyboard, so one scoped\n // close releases all of its transports without disrupting concurrent runs.\n if (!callerOwnsClients) {\n await closeScopedConnections(options.protocol);\n }\n\n if (webhookReceiver) await webhookReceiver.close();\n\n return result;\n}\n\n/**\n * Run the storyboard N times — once per replica — with the round-robin\n * dispatcher starting at a different replica each pass. Lets each step hit\n * a different replica across passes, so a bug isolated to one replica\n * (stale config, divergent version, local cache miss) surfaces on the pass\n * that sends the relevant step there.\n *\n * Known limitation (follow-up adcontextprotocol/adcp-client#607 option 2):\n * for N=2, offset-shift preserves pair parity — a write→read pair whose\n * dispatch indices differ by an even amount lands same-replica in every\n * pass (the canonical property_lists case: write at step 0, read at step\n * 2). Cross-replica state-persistence testing at N=2 is primarily the job\n * of single-pass round-robin (which catches adjacent write→read pairs);\n * dependency-aware dispatch that reads `context_inputs` and assigns a\n * replica different from the writer of the specific state key being read\n * is the spec-aligned fix for non-adjacent pairs and should be preferred\n * over multi-pass for that purpose.\n *\n * The aggregated result AND-combines `overall_passed` across passes, sums\n * the pass/fail/skip counts, and exposes the per-pass detail via `passes[]`.\n * The top-level `phases` is the first pass's phases so single-pass consumers\n * keep working; richer consumers read `passes[]`.\n */\nasync function runMultiPass(\n agentUrls: string[],\n storyboard: Storyboard,\n options: StoryboardRunOptions\n): Promise<StoryboardResult> {\n const start = Date.now();\n\n // Run pre-flight controller seeding ONCE at the run level (adcp-client#778)\n // so the aggregator doesn't sum N redundant seed batches into\n // `failed_count` / `skipped_count`. Every pass inherits the same outcome;\n // only the first pass attaches the synthetic `__controller_seeding__`\n // phase to its `phaseResults`, so the aggregated top-level counts reflect\n // a single seeding pass across the whole run.\n const preSeedClients = agentUrls.map(url => getOrCreateClientResolution(url, options).client);\n const preSeedContext: StoryboardContext = { ...storyboard.context, ...options.context };\n if (storyboard.context) forwardAliasCache(storyboard.context, preSeedContext);\n if (options.context) forwardAliasCache(options.context, preSeedContext);\n let preSeedProfile = options._profile;\n if (!preSeedProfile) {\n const discovered = await getOrDiscoverProfile(preSeedClients[0]!, options);\n if (discovered.step.passed === false) {\n await closeScopedConnections(options.protocol);\n return buildDiscoveryFailedResult(agentUrls, storyboard, discovered.step);\n }\n preSeedProfile = discovered.profile;\n }\n if (preSeedProfile && (!options._profile || !options.agentTools)) {\n options = {\n ...options,\n _profile: preSeedProfile,\n ...(options.agentTools ? {} : { agentTools: normalizeAgentToolNames(preSeedProfile.tools) }),\n };\n }\n\n // runStoryboardBody cannot evaluate capability-gated requirements until\n // this multi-pass preflight has discovered the profile. Resolve both gates\n // once here so an optional capability remains not_applicable and a missing\n // run-scoped harness remains one storyboard skip rather than N pass skips.\n if (storyboard.requires_capability) {\n const unmetDetail = evaluateRequiresCapabilityGate(\n storyboard.requires_capability,\n preSeedProfile,\n options.agentTools,\n options.adcpVersion\n );\n if (unmetDetail !== null) {\n await closeScopedConnections(options.protocol);\n return {\n ...buildCapabilityUnsupportedResult(agentUrls, storyboard, unmetDetail),\n notices: collectCapabilityNotices(storyboard, preSeedProfile),\n };\n }\n }\n const allRequires = resolveStoryboardRequires(storyboard, options);\n if (allRequires.length > 0) {\n const requirementCheck = await checkRequires(allRequires, storyboard, options, preSeedProfile);\n if ('requirement' in requirementCheck) {\n await closeScopedConnections(options.protocol);\n return {\n ...buildRequirementUnmetResult(agentUrls, storyboard, requirementCheck.requirement, requirementCheck.detail),\n notices: collectCapabilityNotices(storyboard, preSeedProfile),\n };\n }\n if (requirementCheck.preparedPublisherAuthProbes) {\n options = withPreparedTrustedMatchPublisherAuth(options, requirementCheck.preparedPublisherAuthProbes);\n }\n }\n const phaseCapabilitySkipDetails = collectPhaseCapabilitySkipDetails(\n storyboard,\n preSeedProfile,\n options.agentTools,\n options.adcpVersion\n );\n const preSeedExcludedPhaseIds = new Set([\n ...phaseCapabilitySkipDetails.keys(),\n ...storyboard.phases.filter(phase => shouldSkipPhase(phase, options)).map(phase => phase.id),\n ]);\n const preSeedFixtureGap = preflightRemainingCreativeAssetDirectives(\n flattenSteps(storyboard),\n -1,\n preSeedContext,\n options,\n {\n contributions: new Set(),\n priorStepResults: new Map(),\n priorProbes: new Map(),\n agentUrl: agentUrls[0]!,\n },\n preSeedExcludedPhaseIds\n );\n const preSeededResult =\n preSeedFixtureGap || allExecutablePhasesCapabilitySkipped(storyboard, phaseCapabilitySkipDetails)\n ? null\n : await runControllerSeeding(preSeedClients[0]!, storyboard, options, preSeedContext);\n\n const passes: StoryboardPassResult[] = [];\n const passResults: StoryboardResult[] = [];\n for (let passIdx = 0; passIdx < agentUrls.length; passIdx++) {\n const passSeeded: PreSeededInput = { result: preSeededResult, attach: passIdx === 0 };\n const result = await executeStoryboardPass(agentUrls, storyboard, options, passIdx, passSeeded);\n passResults.push(result);\n passes.push({\n pass_index: passIdx + 1,\n dispatch_offset: passIdx,\n overall_passed: result.overall_passed,\n phases: result.phases,\n passed_count: result.passed_count,\n failed_count: result.failed_count,\n skipped_count: result.skipped_count,\n ...(result.validations_advisory_failed\n ? { validations_advisory_failed: result.validations_advisory_failed }\n : {}),\n ...(result.validations_not_applicable ? { validations_not_applicable: result.validations_not_applicable } : {}),\n duration_ms: result.total_duration_ms,\n });\n }\n\n const first = passResults[0]!;\n const overallPassed = passes.every(p => p.overall_passed);\n const passed = passes.reduce((sum, p) => sum + p.passed_count, 0);\n const failed = passes.reduce((sum, p) => sum + p.failed_count, 0);\n const skipped = passes.reduce((sum, p) => sum + p.skipped_count, 0);\n const advisoryFailed = passes.reduce((sum, p) => sum + (p.validations_advisory_failed ?? 0), 0);\n const notApplicable = passes.reduce((sum, p) => sum + (p.validations_not_applicable ?? 0), 0);\n const schemasUsed = passResults.flatMap(r => r.schemas_used ?? []);\n const schemasDedup = [...new Map(schemasUsed.map(s => [s.schema_id, s])).values()];\n // Assertions are scoped per-pass — each pass's runner resolved them\n // independently and reported `assertion_id` identically. Concatenate so\n // readers see a per-pass timeline; de-duplicating would hide a real\n // \"passed on pass 1, failed on pass 2\" divergence.\n const assertionsAgg = passResults.flatMap((r, index) =>\n (r.assertions ?? []).map(assertion => ({ ...assertion, pass_index: index + 1 }))\n );\n // Notices are identical across passes (same agent, same capabilities).\n // Schema-invalid capabilities notices retain one row per RFC 6901 pointer.\n const noticesDedup = [...new Map(passResults.flatMap(r => r.notices).map(n => [runnerNoticeKey(n), n])).values()];\n\n return {\n storyboard_id: storyboard.id,\n storyboard_title: storyboard.title,\n agent_url: redactOAuthUrlForOutput(agentUrls[0]!),\n agent_urls: agentUrls.map(redactOAuthUrlForOutput),\n multi_instance_strategy: 'multi-pass',\n overall_passed: overallPassed,\n phases: first.phases,\n passes,\n context: first.context,\n total_duration_ms: Date.now() - start,\n passed_count: passed,\n failed_count: failed,\n skipped_count: skipped,\n ...(advisoryFailed > 0 ? { validations_advisory_failed: advisoryFailed } : {}),\n ...(notApplicable > 0 ? { validations_not_applicable: notApplicable } : {}),\n runner_capability_version: RUNNER_CAPABILITY_VERSION,\n tested_at: new Date().toISOString(),\n ...(schemasDedup.length > 0 ? { schemas_used: schemasDedup } : {}),\n ...(assertionsAgg.length > 0 ? { assertions: assertionsAgg } : {}),\n ...(first.fixture_resolutions ? { fixture_resolutions: first.fixture_resolutions } : {}),\n ...(first.coverage_gaps ? { coverage_gaps: first.coverage_gaps } : {}),\n notices: noticesDedup,\n };\n}\n\n/**\n * Collect a deduplicated list of schemas applied during this run. Drawn\n * from every validation result with a schema_id; dropping empties keeps\n * the list proportional to what actually ran.\n */\n/**\n * Count validation results graded `not_applicable` across every step. Per\n * runner-output-contract.yaml v2.0.0 these come from the forward-compat\n * default in the validation dispatcher: when a storyboard declares an\n * authored `check` value the runner does not implement, the dispatcher\n * grades it `passed: true, not_applicable: true` rather than failing the\n * step. Surfacing the count separately lets consumers distinguish\n * \"runner is older than the storyboard\" from clean passes.\n */\nfunction countValidationsNotApplicable(phases: StoryboardPhaseResult[]): number {\n let n = 0;\n for (const phase of phases) {\n for (const step of phase.steps) {\n for (const v of step.validations) {\n if (v.not_applicable) n++;\n }\n }\n }\n return n;\n}\n\n/** Count failed, unpromoted advisories without affecting step verdicts. */\nfunction countValidationsAdvisoryFailed(phases: StoryboardPhaseResult[]): number {\n let n = 0;\n for (const phase of phases) {\n for (const step of phase.steps) {\n for (const validation of step.validations) {\n if (!validation.passed && validation.severity === 'advisory') n++;\n }\n }\n }\n return n;\n}\n\nfunction collectSchemasUsed(phases: StoryboardPhaseResult[]): Array<{ schema_id: string; schema_url: string }> {\n const seen = new Set<string>();\n const out: Array<{ schema_id: string; schema_url: string }> = [];\n for (const phase of phases) {\n for (const step of phase.steps) {\n for (const v of step.validations) {\n if (v.schema_id && v.schema_url && !seen.has(v.schema_id)) {\n seen.add(v.schema_id);\n out.push({ schema_id: v.schema_id, schema_url: v.schema_url });\n }\n }\n }\n }\n return out;\n}\n\n/**\n * Walk every response_schema validation and aggregate the strict/lenient\n * delta. Always returns a summary; `observable: false` signals \"run had\n * no strict-eligible checks\" (distinct from strict-clean with zero\n * findings). See issue #820 follow-up.\n *\n * `checked` counts validations with a `strict` verdict attached.\n * `passed` / `failed` partition `checked` by `strict.valid`.\n * `strict_only_failures` = #(lenient-pass ∧ strict-fail) — the agent's\n * production-readiness gap.\n * `lenient_also_failed` = #(lenient-fail ∧ strict-fail) — step already\n * broken, strict-rejection isn't new signal.\n *\n * Exported so callers post-processing a `StoryboardResult` (dashboards,\n * CI formatters) can compute the same summary over a subset of phases\n * without re-running validation.\n */\n/**\n * Flatten every `strict_only_failure` (lenient-pass ∧ strict-fail) into a\n * dashboard-friendly row list. Each row carries the step/phase context\n * needed for triage without re-walking the nested result tree:\n *\n * { phase_id, step_id, task, variant, issues }\n *\n * Exported because the ValidationResult tree is four levels deep\n * (`phases[].steps[].validations[].strict.issues[]`) and a consumer\n * seeing `strict_only_failures: 7` in the summary needs a direct path\n * to the seven offending responses. This is that path.\n *\n * Returns `[]` on runs with no strict-only failures OR no AJV coverage\n * (both cases produce zero rows). Inspect `strict_validation_summary`\n * for the total counts.\n */\nexport function listStrictOnlyFailures(\n phases: StoryboardPhaseResult[]\n): Array<{ phase_id: string; step_id: string; task: string; variant: string; issues: SchemaValidationError[] }> {\n const rows: Array<{\n phase_id: string;\n step_id: string;\n task: string;\n variant: string;\n issues: SchemaValidationError[];\n }> = [];\n for (const phase of phases) {\n for (const step of phase.steps) {\n for (const v of step.validations) {\n if (v.check !== 'response_schema') continue;\n if (v.strict === undefined) continue;\n if (v.strict.valid) continue;\n if (!v.passed) continue; // already counted by lenient path\n rows.push({\n phase_id: phase.phase_id,\n step_id: step.step_id,\n task: step.task,\n variant: v.strict.variant,\n issues: v.strict.issues ?? [],\n });\n }\n }\n }\n return rows;\n}\n\nexport function summarizeStrictValidation(phases: StoryboardPhaseResult[]): StrictValidationSummary {\n let checked = 0;\n let passed = 0;\n let strictOnlyFailures = 0;\n for (const phase of phases) {\n for (const step of phase.steps) {\n for (const v of step.validations) {\n if (v.check !== 'response_schema' || v.strict === undefined) continue;\n checked++;\n if (v.strict.valid) {\n passed++;\n } else if (v.passed) {\n // Lenient Zod accepted this response; strict AJV rejected it.\n // That's the agent's strictness gap — the signal #820 wants.\n strictOnlyFailures++;\n }\n }\n }\n }\n const failed = checked - passed;\n return {\n observable: checked > 0,\n checked,\n passed,\n failed,\n strict_only_failures: strictOnlyFailures,\n lenient_also_failed: failed - strictOnlyFailures,\n };\n}\n\n// ────────────────────────────────────────────────────────────\n// runStoryboardStep: execute a single step (stateless)\n// ────────────────────────────────────────────────────────────\n\n/**\n * Run a single storyboard step.\n *\n * This is the core primitive for stateless, LLM-friendly execution.\n * Context is passed in and returned, enabling step-by-step orchestration.\n */\nexport async function runStoryboardStep(\n agentUrl: string,\n storyboard: Storyboard,\n stepId: string,\n options: StoryboardRunOptions = {}\n): Promise<StoryboardStepResult> {\n return withMCPConnectionScope(\n async () => {\n validateStoryboardShape(storyboard);\n options = applyStoryboardVersionOptions(storyboard, options);\n // adcp#6735 — same declared-kit resolution as runStoryboard, so the\n // printed fix_command path exercises the step with its real credential.\n options = resolveDeclaredTestKit(storyboard, options);\n const schemaRoot = getRunSchemaRoot(options);\n if (schemaRoot) {\n return await withExternalSchemaRoot(schemaRoot.adcpVersion, schemaRoot.schemaRoot, () =>\n runStoryboardStepBody(agentUrl, storyboard, stepId, options)\n );\n }\n return await runStoryboardStepBody(agentUrl, storyboard, stepId, options);\n },\n { isolate: true }\n );\n}\n\nasync function runStoryboardStepBody(\n agentUrl: string,\n storyboard: Storyboard,\n stepId: string,\n options: StoryboardRunOptions\n): Promise<StoryboardStepResult> {\n validateTestKit(options.test_kit);\n const clientResolution = getOrCreateClientResolution(agentUrl, options);\n const client = clientResolution.client;\n\n // Discover agent profile for standalone step execution. Captured so the\n // executeStep call below can thread `library_version` through to\n // shape-drift hint detection (issue #850). Also threads _profile into\n // options so capability-based skip gates in executeStep (e.g. account-mode\n // branching) can read raw_capabilities, mirroring executeStoryboardPass.\n let profile: AgentProfile | undefined;\n if (!clientResolution.reusedShared) {\n const discovered = await getOrDiscoverProfile(client, options);\n profile = discovered.profile;\n if (profile && !options._profile) {\n options = { ...options, _profile: profile };\n }\n } else {\n profile = options._profile;\n }\n\n const context: StoryboardContext = { ...storyboard.context, ...options.context };\n if (storyboard.context) forwardAliasCache(storyboard.context, context);\n if (options.context) forwardAliasCache(options.context, context);\n\n // `_webhookReceiver` is a test-only injection point; production callers\n // pass `webhook_receiver` and the runner constructs the listener.\n const injectedReceiver = options._webhookReceiver;\n const webhookReceiver: WebhookReceiver | undefined =\n injectedReceiver ??\n (options.webhook_receiver\n ? await createWebhookReceiver({\n ...(options.webhook_receiver.mode && { mode: options.webhook_receiver.mode }),\n ...(options.webhook_receiver.host !== undefined && { host: options.webhook_receiver.host }),\n ...(options.webhook_receiver.port !== undefined && { port: options.webhook_receiver.port }),\n ...(options.webhook_receiver.public_url !== undefined && {\n public_url: options.webhook_receiver.public_url,\n }),\n })\n : undefined);\n const ownsWebhookReceiver = !injectedReceiver && !!webhookReceiver;\n const runnerVars = createRunnerVariables({\n ...(webhookReceiver && { webhookBase: webhookReceiver.base_url }),\n });\n if (webhookReceiver) armWebhookAssertions(storyboard, runnerVars, webhookReceiver);\n\n // Find the step\n const allSteps = flattenSteps(storyboard);\n const found = allSteps.find(s => s.step.id === stepId);\n if (!found) {\n if (ownsWebhookReceiver && webhookReceiver) await webhookReceiver.close();\n throw new Error(\n `Step \"${stepId}\" not found in storyboard \"${storyboard.id}\". ` +\n `Available steps: ${allSteps.map(s => s.step.id).join(', ')}`\n );\n }\n\n // Standalone execution must preserve the whole-storyboard ordering:\n // capability applicability comes before the operator runtime requirement.\n // In particular, a non-TMP agent must not be told that it is missing a\n // publisher-auth adapter for a capability it never declared.\n if (storyboard.requires_capability) {\n const unmetDetail = evaluateRequiresCapabilityGate(\n storyboard.requires_capability,\n profile,\n options.agentTools,\n options.adcpVersion\n );\n if (unmetDetail !== null) {\n const result: StoryboardStepResult = {\n storyboard_id: storyboard.id,\n step_id: found.step.id,\n phase_id: found.phaseId,\n title: found.step.title,\n task: found.step.task,\n passed: true,\n skipped: true,\n skip_reason: 'not_applicable',\n skip: { reason: 'not_applicable', detail: unmetDetail },\n duration_ms: 0,\n validations: [],\n context,\n error: unmetDetail,\n extraction: { path: 'none' },\n contributions: Array.from(options.contributions ?? []),\n };\n if (!clientResolution.reusedShared) await closeScopedConnections(options.protocol);\n if (ownsWebhookReceiver && webhookReceiver) await webhookReceiver.close();\n return result;\n }\n }\n\n // Seed provenance from the caller-supplied map (threaded through from a\n // previous step's result). Storyboard-level runs build this internally;\n // here the caller owns accumulation across stateless invocations.\n const contextProvenance = new Map<string, ContextProvenanceEntry>(Object.entries(options.context_provenance ?? {}));\n const responseDerivedNotApplicableContextKeys = new Map<string, string>(\n Object.entries(options.response_derived_not_applicable_context_keys ?? {})\n );\n const contributions = new Set(options.contributions ?? []);\n const result = await executeStep(client, found.step, storyboard.id, found.phaseId, context, allSteps, options, {\n contributions,\n priorStepResults: new Map(),\n priorProbes: new Map(),\n agentUrl,\n webhookReceiver,\n runnerVars,\n contextProvenance,\n priorA2aEnvelopes: new Map(),\n stepRequestStarts: new Map(),\n responseDerivedNotApplicableContextKeys,\n agentProfile: profile,\n agentLibraryVersion: profile?.library_version,\n storyboardRequiresRequestSigner: resolveStoryboardRequires(storyboard, options).includes('request_signer'),\n storyboardRequiresPublisherAuthRunner:\n storyboard.requires?.includes('trusted_match_publisher_auth_runner') === true,\n });\n\n if (!result.skipped && result.passed && found.step.contributes_to) {\n if (evalContributesIf(found.step.contributes_if, new Map())) {\n contributions.add(found.step.contributes_to);\n }\n }\n\n if (!clientResolution.reusedShared) {\n await closeScopedConnections(options.protocol);\n }\n\n if (ownsWebhookReceiver && webhookReceiver) await webhookReceiver.close();\n\n return { ...result, contributions: Array.from(contributions) };\n}\n\n// ────────────────────────────────────────────────────────────\n// Internal: execute a single step\n// ────────────────────────────────────────────────────────────\n\ninterface ExecutionState {\n contributions: Set<string>;\n priorStepResults: Map<string, StoryboardStepResult>;\n priorProbes: Map<string, HttpProbeResult>;\n agentUrl: string;\n /** Run-scoped seller ids selected for authored fixture handles. */\n fixtureBindings?: FixtureBindingRegistry;\n /**\n * ISO timestamps captured immediately before each step's AdCP request\n * dispatch. Threaded into `upstream_traffic` validations as the\n * `since_timestamp` window bound (the step's own start by default; an\n * earlier prior step's start when the validation declares\n * `since: prior_step_id` for a cumulative assertion). Empty when no\n * step in the run has fired a request yet.\n */\n stepRequestStarts?: Map<string, string>;\n /**\n * Context keys whose producer step was response-gated as not_applicable.\n * Consumer steps referencing only these keys should skip as not_applicable\n * rather than prerequisite_failed.\n */\n responseDerivedNotApplicableContextKeys?: Map<string, string>;\n /** Shared ephemeral webhook receiver, when the run has one enabled. */\n webhookReceiver?: WebhookReceiver;\n /** Shared runner-variable bag for `{{runner.*}}` substitution. */\n runnerVars?: RunnerVariables;\n /**\n * Context-key → write-provenance map, accumulated across the run so a\n * later step's rejection can cite the step that wrote the value. Issue\n * #870. Later writes shadow earlier ones under the same key, matching\n * the shallow-merge semantics of the context itself.\n */\n contextProvenance?: Map<string, ContextProvenanceEntry>;\n /**\n * Per-step A2A envelopes captured during the run, keyed by step id.\n * Cross-step A2A validators (`a2a_context_continuity`) read this to\n * compare consecutive `Task.contextId` values. The map is mutated\n * by `executeStep` after each step's capture; reads pick the most\n * recently inserted entry to seed `priorA2aEnvelope` on the\n * ValidationContext for the next step. Issue adcp-client#962.\n *\n * Map shared by reference across `executeStep` invocations — like\n * `priorStepResults`, this is the state that has to live one level\n * up from the per-step `ExecutionState` literal.\n */\n priorA2aEnvelopes?: Map<string, A2ATaskEnvelope>;\n /**\n * Profile for the agent selected to execute this step. In routed runs this\n * must be the selected agent's profile, not the run-level primary profile.\n */\n agentProfile?: AgentProfile;\n /**\n * Agent's reported `@adcp/client@X.Y.Z` library version, captured from\n * the `get_adcp_capabilities` discovery probe. Threaded into shape-drift\n * hints so the runner can suffix recommendations with a version-staleness\n * note when a recommended helper postdates the agent's pinned SDK. Issue\n * #850. Undefined when the agent did not advertise `library_version`.\n */\n agentLibraryVersion?: string;\n /**\n * Whether the storyboard declares or implicitly requires a request signer.\n * Unsigned functional storyboards use this to distinguish an expected\n * signature-required rejection from a failure in a signing test.\n */\n storyboardRequiresRequestSigner?: boolean;\n /** Dedicated TMP raw-HTTP tasks are invalid outside their explicit runner contract. */\n storyboardRequiresPublisherAuthRunner?: boolean;\n}\n\nasync function executeStep(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- client type varies (TestClient)\n client: any,\n step: StoryboardStep,\n storyboardId: string,\n phaseId: string,\n context: StoryboardContext,\n allSteps: FlatStep[],\n options: StoryboardRunOptions,\n state?: ExecutionState\n): Promise<StoryboardStepResult> {\n // Default empty state when this function is called standalone (runStoryboardStep).\n const runState: ExecutionState = state ?? {\n contributions: new Set(),\n priorStepResults: new Map(),\n priorProbes: new Map(),\n agentUrl: '',\n contextProvenance: new Map(),\n stepRequestStarts: new Map(),\n responseDerivedNotApplicableContextKeys: new Map(),\n };\n\n // Recognize the dedicated TMP publisher-auth probes before generic auth\n // overrides, missing-tool checks, or MCP/A2A routing.\n if (TRUSTED_MATCH_PUBLISHER_AUTH_TASKS.has(step.task)) {\n if (runState.storyboardRequiresPublisherAuthRunner !== true) {\n return invalidTrustedMatchPublisherAuthTask(step, phaseId, context, allSteps, runState);\n }\n return executeProbeStep(client, step, phaseId, context, allSteps, options, runState);\n }\n\n // HTTP probe tasks bypass the MCP client entirely.\n if (PROBE_TASKS.has(step.task)) {\n return executeProbeStep(client, step, phaseId, context, allSteps, options, runState);\n }\n\n // Webhook-assertion pseudo-tasks observe the shared receiver instead of\n // driving the agent. They never reach the MCP/A2A transport.\n if (WEBHOOK_ASSERTION_TASKS.has(step.task)) {\n return executeWebhookAssertionStep(step, phaseId, context, allSteps, options, runState);\n }\n\n // Inbound webhook receiver conformance posts canonical vectors to a\n // buyer/orchestrator receiver URL. This is a runner-native HTTP probe, not\n // a seller tool call.\n if (step.task === REPLAY_WEBHOOK_VECTOR_TASK) {\n return executeReplayWebhookVectorStep(step, phaseId, context, allSteps, options, runState);\n }\n\n // Resolve $test_kit.* task references before any downstream dispatch / skip checks.\n // When the reference resolves to nothing, fall back to `task_default`.\n const resolvedTask = resolveTaskName(step, options);\n if (!resolvedTask) {\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: false,\n duration_ms: 0,\n validations: [],\n context,\n error: `Step task \"${step.task}\" references a test-kit field that resolved to nothing and no task_default is set.`,\n extraction: { path: 'none' },\n };\n }\n const effectiveStep: StoryboardStep = resolvedTask === step.task ? step : { ...step, task: resolvedTask };\n\n // Check requires_tool — skip if agent doesn't have it\n if (step.requires_tool && options.agentTools && !options.agentTools.includes(step.requires_tool)) {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const reason: RunnerSkipReason =\n step.requires_tool === 'comply_test_controller' ? 'missing_test_controller' : 'missing_tool';\n const detail =\n reason === 'missing_test_controller'\n ? `Deterministic-testing phase requires comply_test_controller; agent tools: [${(options.agentTools ?? []).join(', ')}].`\n : `Required tool \"${step.requires_tool}\" not advertised; agent tools: [${(options.agentTools ?? []).join(', ')}].`;\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: reason,\n skip: buildSkip(reason, detail),\n duration_ms: 0,\n validations: [],\n context,\n next,\n extraction: { path: 'none' },\n };\n }\n\n // Account-mode capability gate: when the seller declared explicit mode\n // (require_operator_auth: true) and does not advertise sync_accounts,\n // sync_accounts does not apply — grade not_applicable rather than\n // missing_tool so adopters can distinguish \"your capability declaration\n // says this path isn't yours\" from \"you forgot to implement a required\n // tool.\" If the seller explicitly advertises sync_accounts, run it: account\n // discovery mode and account-level write surfaces such as notification\n // config registration are orthogonal.\n //\n // list_accounts is NOT gated here: it appears in audience_sync and other\n // storyboard flows regardless of account mode, so it is always applicable.\n //\n // Requires _profile threaded from the discovery block in\n // executeStoryboardPass or runStoryboardStep.\n if (effectiveStep.task === 'sync_accounts') {\n const rawCaps = options._profile?.raw_capabilities;\n if (rawCaps !== undefined) {\n const requireOperatorAuth = resolveCapabilityPath(rawCaps, 'account.require_operator_auth');\n const syncAccountsAdvertised = options.agentTools?.includes('sync_accounts') === true;\n if (requireOperatorAuth === true && !syncAccountsAdvertised) {\n const detail =\n `Agent declared explicit account mode (require_operator_auth: true); ` +\n `sync_accounts is not applicable — list_accounts is the correct tool for this account shape.`;\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: 'not_applicable',\n skip: buildSkip('not_applicable', detail),\n duration_ms: 0,\n validations: [],\n context,\n next,\n extraction: { path: 'none' },\n };\n }\n }\n }\n\n // Skip if agent doesn't implement the tool this step calls.\n if (options.agentTools && !options.agentTools.includes(effectiveStep.task)) {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const detail = `Agent did not advertise tool \"${effectiveStep.task}\"; agent tools: [${(options.agentTools ?? []).join(', ')}].`;\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: effectiveStep.task,\n passed: true,\n skipped: true,\n skip_reason: 'missing_tool',\n skip: buildSkip('missing_tool', detail),\n duration_ms: 0,\n validations: [],\n context,\n next,\n extraction: { path: 'none' },\n };\n }\n\n // Build request — priority (issue #820, fixture-authoritative):\n // 1. User-provided --request override\n // 2. For expect_error steps: sample_request directly (preserves intentionally invalid input)\n // 3. enrichRequest — fixture is the base, enricher fills gaps (fixture wins conflicts)\n // 4. sample_request with context injection when no enricher is registered\n // 5. Empty object (only reachable for non-mutating tasks with neither fixture nor enricher)\n let request: Record<string, unknown>;\n if (options.request) {\n request = injectContext({ ...options.request }, context, runState.runnerVars);\n } else if (step.expect_error && step.sample_request) {\n request = injectContext({ ...step.sample_request }, context, runState.runnerVars);\n } else if (hasRequestEnricher(effectiveStep.task)) {\n request = enrichRequest(effectiveStep, context, options, runState.runnerVars);\n } else if (step.sample_request) {\n request = injectContext({ ...step.sample_request }, context, runState.runnerVars);\n } else {\n request = {};\n }\n\n // Apply explicit context_inputs on top of whatever request source was used\n if (step.context_inputs?.length) {\n request = applyContextInputs(request, step.context_inputs, context);\n }\n\n // Brand/account is a storyboard-run-scoped invariant: every step in a run\n // targets the same brand, so every outgoing request's brand context must\n // match the options. Enforcing this here (after builder + sample_request)\n // prevents session-key divergence across create/get/update/delete steps\n // when individual builders or sample_request YAML omit brand.\n // `step.omit_account` suppresses account synthesis for schema_validation\n // steps that deliberately test the seller's missing-account rejection path.\n request = applyBrandInvariant(request, options, effectiveStep.task, { omit_account: step.omit_account });\n\n // Per-run sandbox-bypass hint (#841). When the operator passes\n // `--no-sandbox` (or sets `disable_sandbox: true` programmatically), the\n // runner stamps `ext.adcp.disable_sandbox: true` on every outgoing\n // request. Adopters that read this field bypass their internal sandbox\n // routing — env-var fallbacks, brand-domain heuristics, fixture\n // substitutes — and exercise their real adapter path. Agents that\n // don't recognize the field ignore it (per spec, `ext` is accepted\n // without error and not echoed). Gated on the schema check that\n // `applyBrandInvariant` uses for `account` and `brand` so tools whose\n // `additionalProperties: false` schema would reject `ext` aren't broken.\n if (options.disable_sandbox === true) {\n request = applyDisableSandboxHint(request, effectiveStep.task);\n }\n\n // Mutating AdCP requests require idempotency_key per spec. Storyboard\n // yamls generally omit it so authors don't have to remember it on every\n // mutating step — mint one here on the runner's behalf, matching how a\n // real buyer would operate. Suppressed when the step expects a missing-key\n // error (see `testsMissingIdempotencyKey` below) so that compliance\n // surfaces can still exercise the server's required-field check.\n request = applyIdempotencyInvariant(request, effectiveStep.task, step);\n\n // Fixture handles are replaced only at request-schema fields carrying the\n // matching x-entity annotation. This applies equally to ordinary AdCP calls\n // and comply_test_controller force/simulate requests.\n const fixtureBinding = applyFixtureBindingsSafely(request, effectiveStep.task, options, runState);\n if (!fixtureBinding.ok) {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: effectiveStep.task,\n passed: false,\n duration_ms: 0,\n validations: [\n {\n check: 'unresolved_substitution',\n passed: false,\n description: `Fixture handle substitution failed: ${fixtureBinding.error}`,\n json_pointer: null,\n expected: 'an unambiguous fixture handle binding',\n actual: fixtureBinding.error,\n schema_id: null,\n schema_url: null,\n },\n ],\n context,\n error: fixtureBinding.error,\n next,\n extraction: { path: 'none' },\n };\n }\n request = fixtureBinding.request;\n\n // Assemble seller-required creative slots from the selected format and\n // active test kit after all other nested request construction is complete.\n const creativeAssetExpansion = expandCreativeAssetDirectivesWithDiagnostics(request, context, options.test_kit);\n request = creativeAssetExpansion.value as Record<string, unknown>;\n if (!creativeAssetExpansion.ok && creativeAssetExpansion.failure.reason === 'fixture_unavailable') {\n return buildCreativeAssetFixtureUnavailableStep(\n step,\n phaseId,\n context,\n allSteps,\n runState,\n creativeAssetExpansion.failure,\n effectiveStep.task\n );\n }\n\n // Detect unresolved $context placeholders — a prior step likely failed\n // and didn't produce the expected output. Skip rather than sending garbage.\n const unresolvedContextVars = findUnresolvedContextVars(request);\n const unresolvedAssetDirectives = findUnresolvedCreativeAssetDirectives(request).map(path => ({\n key: path,\n token: BUILD_ASSETS_FROM_FORMAT_DIRECTIVE,\n }));\n const unresolvedVars = [...unresolvedContextVars, ...unresolvedAssetDirectives];\n // expect_error steps may intentionally preserve invalid $context tokens, but\n // runner-only creative directives must never cross the wire.\n if (unresolvedAssetDirectives.length > 0 || (unresolvedContextVars.length > 0 && !step.expect_error)) {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const responseDerivedDetails = unresolvedVars\n .map(v => runState.responseDerivedNotApplicableContextKeys?.get(v.key))\n .filter((d): d is string => typeof d === 'string');\n const allResponseDerived =\n responseDerivedDetails.length === unresolvedVars.length && responseDerivedDetails.length > 0;\n const detail = allResponseDerived\n ? [...new Set(responseDerivedDetails)].join('; ')\n : `Skipped: unresolved context variables from prior steps: ${unresolvedVars.map(v => v.key).join(', ')}.`;\n // Normal unresolved substitutions carry one validation result per missing\n // token. Response-derived terminal-page skips are already successful\n // not_applicable rows, so their downstream cursor consumers stay validation\n // empty to avoid inventing a failing-looking check for an expected skip.\n const synthesized: ValidationResult[] = [];\n if (!allResponseDerived) {\n const seenTokens = new Set<string>();\n for (const v of unresolvedVars) {\n if (seenTokens.has(v.token)) continue;\n seenTokens.add(v.token);\n synthesized.push({\n check: 'unresolved_substitution',\n passed: false,\n description:\n v.token === BUILD_ASSETS_FROM_FORMAT_DIRECTIVE\n ? `request directive \"${v.token}\" did not resolve — the test kit could not populate every seller-required asset at ${v.key}`\n : `request token \"${v.token}\" did not resolve — prior step did not populate context.${v.key}`,\n json_pointer: null,\n expected: v.token,\n actual: null,\n schema_id: null,\n schema_url: null,\n });\n }\n }\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: allResponseDerived,\n skipped: true,\n skip_reason: allResponseDerived ? 'not_applicable' : 'prerequisite_failed',\n skip: buildSkip(allResponseDerived ? 'not_applicable' : 'prerequisite_failed', detail),\n duration_ms: 0,\n validations: synthesized,\n context,\n ...responseDerivedContextResult(runState),\n ...(!allResponseDerived && { error: detail }),\n next,\n extraction: { path: 'none' },\n };\n }\n\n const unresolvedRunnerTokens = findUnresolvedRunnerTokens(request);\n if (unresolvedRunnerTokens.length > 0) {\n const isPrerequisiteFailure = hasUnresolvedPriorStepToken(unresolvedRunnerTokens);\n const skipReason = isPrerequisiteFailure ? 'prerequisite_failed' : 'not_applicable';\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const detail =\n 'Skipped: storyboard request references unresolved runner placeholders. ' +\n `Unresolved token(s): ${unresolvedRunnerTokens.join(', ')}.`;\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: effectiveStep.task,\n passed: !isPrerequisiteFailure,\n skipped: true,\n skip_reason: skipReason,\n skip: buildSkip(skipReason, detail),\n duration_ms: 0,\n validations: [],\n context,\n next,\n ...(isPrerequisiteFailure ? { error: detail } : {}),\n request: {\n transport: options.protocol === 'a2a' ? 'a2a' : 'mcp',\n operation: effectiveStep.task,\n payload: redactSecrets(request),\n ...(runState.agentUrl ? { url: redactOAuthUrlForOutput(runState.agentUrl) } : {}),\n },\n extraction: { path: 'none' },\n };\n }\n\n // Execute the task. When the step overrides auth, dispatch via the raw MCP\n // probe so we can (a) strip credentials or send arbitrary Bearer values\n // (which the SDK transport doesn't expose), and (b) capture the HTTP status\n // + `WWW-Authenticate` header for http_* validations.\n //\n // Tests for envelope validation on mutating tasks (e.g., \"missing\n // idempotency_key returns INVALID_REQUEST\") set `step.omit_idempotency_key`\n // to suppress both the runner's `applyIdempotencyInvariant` (above) and the\n // AdCP client's auto-inject — otherwise the SDK helpfully generates a UUID\n // and the server never sees a missing-key request. Paired flags so the two\n // layers agree; see `applyIdempotencyInvariant` for the runner-level skip.\n const testsMissingIdempotencyKey = step.omit_idempotency_key === true && isMutatingTask(effectiveStep.task);\n\n // Analogous to `testsMissingIdempotencyKey`: when a step sets\n // `omit_account: true` the runner has already suppressed account synthesis\n // in `applyBrandInvariant` (above — ordering is load-bearing: this must\n // come after `applyBrandInvariant` so the comment \"above\" stays accurate\n // if either block is reordered). Track the flag here so the SDK call below\n // can also skip client-side account validation/injection before the wire call.\n const testsMissingAccount = step.omit_account === true && effectiveStep.task === 'create_media_buy';\n\n // Raw MCP dispatch is reserved for steps that explicitly override auth.\n // Missing-field vectors stay on the SDK transport with the skip flags below\n // so Streamable HTTP session setup completes before the malformed tool call\n // reaches the seller handler.\n let rawProbeHeaders: Record<string, string> | undefined;\n try {\n rawProbeHeaders = step.auth !== undefined ? authHeadersForStep(step.auth, options) : undefined;\n } catch (err) {\n // adcp#6735 — an unresolvable from_test_kit credential is a step-level\n // configuration failure with an explicit message, never a silent\n // unauthenticated probe (and never a whole-run crash).\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: false,\n duration_ms: 0,\n validations: [],\n context,\n error: `Step auth configuration error: ${err instanceof Error ? err.message : String(err)}`,\n extraction: { path: 'none' },\n };\n }\n const useRawProbe = rawProbeHeaders !== undefined;\n\n let taskResult: TaskResult | undefined;\n let stepResult: { duration_ms: number; error?: string; passed: boolean };\n // Raw caught error from the dispatch fn — preserved as `unknown` so the\n // schema-validation attribution path below can `instanceof` it against\n // `ResponseSchemaValidationError`. Undefined when the step succeeded or\n // failed for a non-typed reason. Spec: adcp-client#1709.\n let caughtError: unknown;\n let httpResult: HttpProbeResult | undefined;\n let responseRecord: RunnerResponseRecord | undefined;\n let a2aEnvelope: A2ATaskEnvelope | undefined;\n let crossResponses: CrossResponseSet | undefined;\n\n // Parallel-dispatch fan-out: when the storyboard step declares\n // `parallel_dispatch`, the runner fires N concurrent dispatches against\n // the same agent with the same idempotency_key (default) and grades the\n // cross-response set instead of a single response. Gated on the\n // `parallel_dispatch_runner` test-kit contract — runners (or runs) without\n // it grade the step `not_applicable` so older runners don't fail on\n // newer storyboard contracts.\n if (step.parallel_dispatch && !useRawProbe) {\n const contractsInScope = new Set(options.contracts ?? []);\n if (!contractsInScope.has(PARALLEL_DISPATCH_CONTRACT)) {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const detail = `Test-kit contract \"${PARALLEL_DISPATCH_CONTRACT}\" is not configured on this runner; concurrent-retry grading requires it.`;\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: 'not_applicable',\n skip: buildSkip('not_applicable', detail),\n duration_ms: 0,\n validations: [],\n context,\n next,\n extraction: { path: 'none' },\n };\n }\n const specError = validateParallelDispatchSpec(step.parallel_dispatch);\n if (specError) {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: false,\n duration_ms: 0,\n validations: [\n {\n check: 'parallel_dispatch_misconfigured',\n passed: false,\n description: specError,\n json_pointer: null,\n expected: 'a well-formed parallel_dispatch spec',\n actual: step.parallel_dispatch,\n schema_id: null,\n schema_url: null,\n },\n ],\n context,\n error: specError,\n next,\n extraction: { path: 'none' },\n };\n }\n if (step.parallel_dispatch.mode === 'distributed') {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const detail =\n 'parallel_dispatch.mode: distributed is not implemented in @adcp/sdk; use process_local for in-process grading.';\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: 'not_applicable',\n skip: buildSkip('not_applicable', detail),\n duration_ms: 0,\n validations: [],\n context,\n next,\n extraction: { path: 'none' },\n };\n }\n }\n\n // Capture the ISO timestamp immediately before the step's AdCP request\n // dispatch. `upstream_traffic` validations use this as the default\n // `since_timestamp` window bound when querying the controller. Recorded\n // on `runState.stepRequestStarts` so a later step's `since: prior_step_id`\n // reference can resolve back to it.\n const requestStartIso = new Date().toISOString();\n if (runState.stepRequestStarts) runState.stepRequestStarts.set(step.id, requestStartIso);\n\n if (useRawProbe) {\n const started = Date.now();\n try {\n const probe = await rawMcpProbe({\n agentUrl: runState.agentUrl,\n toolName: effectiveStep.task,\n args: request,\n headers: rawProbeHeaders,\n allowPrivateIp: options.allow_http === true,\n fetchFn: options.transport?.trustedFetchFn,\n });\n httpResult = probe.httpResult;\n taskResult = probe.taskResult;\n const durationMs = Date.now() - started;\n stepResult = {\n duration_ms: durationMs,\n passed: !httpResult.error,\n error: httpResult.error,\n };\n const filteredHeaders = filterResponseHeaders(httpResult.headers);\n responseRecord = {\n transport: 'mcp',\n payload: redactSecrets(httpResult.body),\n ...(typeof httpResult.status === 'number' ? { status: httpResult.status } : {}),\n ...(filteredHeaders && { headers: filteredHeaders }),\n duration_ms: durationMs,\n };\n } catch (err) {\n stepResult = {\n duration_ms: Date.now() - started,\n passed: false,\n error: err instanceof Error ? err.message : String(err),\n };\n }\n } else {\n // For A2A runs, wrap the SDK dispatch in `withRawResponseCapture`\n // so storyboard validations can assert on the JSON-RPC `Task`\n // envelope the seller emitted (e.g. `a2a_submitted_artifact`\n // checks `Task.state` + `artifact.metadata.adcp_task_id` placement).\n // MCP path stays unwrapped — the SDK envelope is reconstructed from\n // `taskResult` already and capture would only add overhead.\n //\n // Selection note: gate on `options.protocol === 'a2a'` because\n // that's the only signal available at this point — discovery\n // hasn't run yet in `runStoryboardStep` (the runner branches off\n // `agentTools` later). If a future \"auto-detect protocol\" flow\n // lands, key the capture off the negotiated transport instead.\n const captureA2a = options.protocol === 'a2a';\n let a2aCaptures: RawHttpCapture[] | undefined;\n if (step.parallel_dispatch) {\n // Fan out N concurrent dispatches via the SDK client. All dispatches\n // share the runner-minted idempotency_key (default) so the seller\n // sees one logical request and resolves the race deterministically.\n //\n // Known limitation: `dispatchWithBarrier` uses `Promise.race` against a\n // timer; when the barrier wins, the underlying SDK request is NOT\n // aborted — it continues to completion against the seller. The runner\n // reports the dispatch as `timed_out`, but a late-arriving success\n // can still land on the seller's idempotency cache. Storyboard\n // authors writing follow-up steps that observe seller state after a\n // barrier timeout should account for this race.\n const started = Date.now();\n crossResponses = await runParallelDispatches(client, effectiveStep.task, request, {\n spec: step.parallel_dispatch,\n keyMinter: generateIdempotencyKey,\n correlationPrefix: step.id,\n });\n const durationMs = Date.now() - started;\n // Representative TaskResult is ALWAYS `dispatches[0]` — pinning the\n // representative to a fixed index keeps the aggregation loop's `i=1`\n // start aligned (every dispatch graded exactly once). Picking the\n // \"best\" resolved arm would double-count whichever dispatch won and\n // skip dispatches[0] from per-response grading entirely.\n const firstDispatch = crossResponses.dispatches[0];\n const allTimedOut = crossResponses.dispatches.every(d => d.timed_out);\n const barrierTimeoutError = 'parallel_dispatch_barrier_timeout: no dispatch resolved within barrier_timeout_ms';\n taskResult = firstDispatch?.taskResult ?? {\n success: false,\n ...(allTimedOut && { error: barrierTimeoutError }),\n };\n // Pass/fail is derived from the cross-response set rather than any\n // single arm: the step passes when at least one dispatch resolved\n // (cross-response validations then grade the race outcome). All-\n // timed-out is a hard failure regardless of validations.\n stepResult = {\n duration_ms: durationMs,\n passed: !allTimedOut && crossResponses.resolved.length > 0,\n ...(allTimedOut && { error: barrierTimeoutError }),\n };\n if (taskResult) {\n responseRecord = {\n transport: options.protocol === 'a2a' ? 'a2a' : 'mcp',\n payload: redactSecrets(\n taskResult.data ??\n (taskResult.adcp_error ? { adcp_error: taskResult.adcp_error } : undefined) ??\n taskResult.error ??\n null\n ),\n duration_ms: durationMs,\n };\n }\n } else {\n const dispatch = () =>\n executeStoryboardTask(client, effectiveStep.task, request, {\n skipIdempotencyAutoInject: testsMissingIdempotencyKey,\n skipAccountValidation: testsMissingAccount,\n responseProjection:\n effectiveStep.response_projection ??\n defaultStoryboardResponseProjection(effectiveStep.task, effectiveStep.comply_scenario),\n signal: options.signal,\n });\n const run = await runStep(step.title, effectiveStep.task, async () => {\n if (!captureA2a) return dispatch();\n try {\n const { result: dispatchResult, captures } = await withRawResponseCapture(dispatch);\n a2aCaptures = captures;\n return dispatchResult;\n } catch (err) {\n // `withRawResponseCapture` attaches partial captures to the\n // thrown error so we still get the wire-shape envelope when\n // the SDK threw mid-parse (e.g. agent emitted malformed JSON).\n // Bare-throw cases (network errors, no captures attached)\n // leave `a2aCaptures` undefined and the validator self-skips.\n const partial = getCapturesFromError(err);\n if (partial) a2aCaptures = partial;\n throw err;\n }\n });\n taskResult = run.result;\n stepResult = run.step;\n caughtError = run.caughtError;\n if (caughtError !== undefined && options.signal?.aborted) {\n throw caughtError;\n }\n if (captureA2a && a2aCaptures) {\n a2aEnvelope = parseLastA2aMessageSendCapture(a2aCaptures);\n }\n if (taskResult) {\n responseRecord = {\n transport: options.protocol === 'a2a' ? 'a2a' : 'mcp',\n payload: redactSecrets(\n taskResult.data ??\n (taskResult.adcp_error ? { adcp_error: taskResult.adcp_error } : undefined) ??\n taskResult.error ??\n null\n ),\n duration_ms: stepResult.duration_ms,\n };\n }\n }\n }\n\n const requestRecord: RunnerRequestRecord = {\n transport: useRawProbe ? 'mcp' : options.protocol === 'a2a' ? 'a2a' : 'mcp',\n operation: effectiveStep.task,\n payload: redactSecrets(request),\n ...(runState.agentUrl ? { url: redactOAuthUrlForOutput(runState.agentUrl) } : {}),\n };\n const inputSchemaStripNotices = collectInputSchemaFieldStripNotices(\n (taskResult as { debug_logs?: unknown } | undefined)?.debug_logs,\n storyboardId\n );\n\n // Until functional storyboards can sign individual mutating requests,\n // a seller that correctly requires signatures would otherwise receive a\n // false-negative grade. Convert only the capability-declared rejection:\n // the response code, dispatched task, and unsigned-storyboard state must\n // all agree before authored validations are bypassed.\n const requiredForSigning = resolveCapabilityPath(\n runState.agentProfile?.raw_capabilities,\n 'request_signing.required_for'\n );\n if (\n taskResult?.adcp_error?.code === 'request_signature_required' &&\n Array.isArray(requiredForSigning) &&\n requiredForSigning.includes(effectiveStep.task) &&\n runState.storyboardRequiresRequestSigner !== true\n ) {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const detail =\n `Agent declared request_signing.required_for includes \"${effectiveStep.task}\" and rejected the unsigned ` +\n `request with request_signature_required; storyboard \"${storyboardId}\" does not require request_signer.`;\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: 'not_applicable',\n skip: buildSkip('not_applicable', detail),\n duration_ms: stepResult.duration_ms,\n validations: [],\n context,\n response: redactSecrets(taskResult.data),\n next,\n request: requestRecord,\n ...(responseRecord && { response_record: responseRecord }),\n extraction: extractionFromTaskResult(taskResult),\n ...(inputSchemaStripNotices.length > 0 && { notices: inputSchemaStripNotices }),\n };\n }\n\n // AdCP 3.0.12 runner-output-contract `force_scenario_unsupported`: when a\n // comply_test_controller step calls a force_* scenario that the agent\n // advertises the controller for but does not implement, the agent returns\n // `{success: false, error: 'UNKNOWN_SCENARIO'}`. Runners MUST grade the\n // step `not_applicable` with detail `force_scenario_unsupported` BEFORE\n // applying the step's authored validations — without this, the failing\n // pass/fail check would mask the coverage gap as a real agent fault.\n //\n // Companion to `fixture_seed_unsupported` (seeding.ts) — same shape but\n // for force_* in step phases rather than seed_* in the fixtures phase.\n // Spec: compliance/cache/<ver>/universal/runner-output-contract.yaml >\n // skip_result.reasons.force_scenario_unsupported.\n //\n // Spec gate \"comply_test_controller advertised\" is enforced upstream by\n // the phase cascade at the `seedingMissingController` check (~line 1893);\n // by the time per-step grading reaches this detector, the controller has\n // already been confirmed present. The `step.task === 'comply_test_controller'`\n // gate below is the per-step subset — it ensures we don't bleed the skip\n // into other tools that happen to carry a `scenario` argument.\n {\n const controllerData = taskResult?.data as { success?: unknown; error?: unknown } | undefined;\n const requestScenario = (request as { scenario?: unknown }).scenario;\n if (\n effectiveStep.task === 'comply_test_controller' &&\n typeof requestScenario === 'string' &&\n requestScenario.startsWith('force_') &&\n controllerData?.success === false &&\n controllerData.error === 'UNKNOWN_SCENARIO'\n ) {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const detail = `force_scenario_unsupported: agent advertised comply_test_controller but does not implement scenario \"${requestScenario}\"`;\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: 'force_scenario_unsupported',\n skip: { reason: 'not_applicable', detail },\n duration_ms: stepResult.duration_ms,\n validations: [],\n context,\n next,\n extraction: extractionFromTaskResult(taskResult),\n ...(inputSchemaStripNotices.length > 0 && { notices: inputSchemaStripNotices }),\n };\n }\n }\n\n // Feature-unsupported or unknown-tool errors → treat as skip\n const isUnsupported = stepResult.error?.includes('does not support:');\n const isUnknownTool = stepResult.error && /Unknown tool[:\\s]/i.test(stepResult.error);\n if (!taskResult && (isUnsupported || isUnknownTool)) {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const reason: RunnerSkipReason = isUnknownTool ? 'missing_tool' : 'not_applicable';\n const detail = isUnknownTool\n ? `Agent rejected tool \"${effectiveStep.task}\" as unknown: ${stepResult.error}`\n : `Agent reported feature not supported: ${stepResult.error}`;\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: reason,\n skip: buildSkip(reason, detail),\n duration_ms: stepResult.duration_ms,\n validations: [],\n context,\n error: stepResult.error,\n next,\n extraction: { path: 'none' },\n ...(inputSchemaStripNotices.length > 0 && { notices: inputSchemaStripNotices }),\n };\n }\n\n // For expect_error steps where TaskResult has no data but has an error string,\n // wrap the error string so validations have something to check against.\n if (step.expect_error && !taskResult?.data && taskResult?.error) {\n taskResult = { ...taskResult, data: { error: taskResult.error } };\n }\n\n const responseDerivedSkip = detectResponseDerivedNotApplicable(\n effectiveStep,\n request,\n taskResult?.data,\n runState,\n allSteps\n );\n if (responseDerivedSkip && !step.expect_error) {\n for (const key of responseDerivedSkip.contextKeys) {\n runState.responseDerivedNotApplicableContextKeys?.set(key, responseDerivedSkip.detail);\n }\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: 'not_applicable',\n skip: buildSkip('not_applicable', responseDerivedSkip.detail),\n duration_ms: stepResult.duration_ms,\n validations: [],\n context,\n ...responseDerivedContextResult(runState),\n response: redactSecrets(taskResult?.data),\n next,\n request: requestRecord,\n ...(responseRecord && { response_record: responseRecord }),\n extraction: extractionFromTaskResult(taskResult),\n ...(inputSchemaStripNotices.length > 0 && { notices: inputSchemaStripNotices }),\n };\n }\n\n // Determine pass/fail — inverted when expect_error is set\n let passed: boolean;\n if (step.expect_error) {\n // Raw protocol probes can succeed at the transport layer while carrying\n // a controller-level rejection in their structured payload. Treat the\n // payload's explicit failure signal as the expected error; authored\n // validations below still verify that it is the *right* rejection.\n const responsePayload = taskResult?.data as { success?: unknown } | undefined;\n const payloadReportsFailure = responsePayload?.success === false;\n passed = !taskResult?.success || !!stepResult.error || payloadReportsFailure;\n } else if (crossResponses) {\n // Parallel-dispatch step: pass/fail is driven by the cross-response\n // set, not the representative arm. The representative is pinned to\n // `dispatches[0]` (which may itself have failed under the race) so\n // gating on its `.success` would false-fail steps where later arms\n // resolved correctly. Validations grade the actual race outcome.\n passed = stepResult.passed;\n } else {\n passed = stepResult.passed && (taskResult?.success ?? false);\n }\n\n const schemaValidationError = caughtError instanceof ResponseSchemaValidationError ? caughtError : undefined;\n // The response unwrapper preserves the rejected payload on its typed error.\n // Grade every authored validation against that payload even though no normal\n // TaskResult was returned; otherwise an advisory response_schema check could\n // hide a required field validation and false-green the step.\n const validationTaskResult: TaskResult | undefined =\n taskResult ??\n (schemaValidationError\n ? {\n // ResponseSchemaValidationError is thrown while validating a\n // successful response arm. Preserve that terminal state so\n // status_code/error_code checks retain their authored semantics.\n success: true,\n data: schemaValidationError.data,\n }\n : undefined);\n let validations: ValidationResult[] = [];\n // Run validations. Resolve `$context.<key>` placeholders in `value` and\n // `allowed_values` fields so expected values can reference prior steps\n // (e.g., replay tests assert `media_buy_id === $context.initial_media_buy_id`).\n if (step.validations?.length && (validationTaskResult || httpResult)) {\n const resolvedValidations = step.validations.map(v => {\n const resolved = { ...v };\n if (resolved.value !== undefined) {\n resolved.value = injectContext({ __v: resolved.value }, context, runState.runnerVars).__v;\n }\n if (Array.isArray(resolved.allowed_values)) {\n resolved.allowed_values = resolved.allowed_values.map(\n av => injectContext({ __v: av }, context, runState.runnerVars).__v\n );\n }\n return resolved;\n });\n // Pre-fetch upstream_traffic data: any `check: upstream_traffic`\n // validation needs the controller's `query_upstream_traffic` response,\n // but the validation dispatcher is synchronous. Async-fetch here once\n // per unique `since_timestamp` window so the validator can grade\n // synchronously. Adopters who don't advertise the scenario short-\n // circuit to a single `advertised: false` marker and every\n // upstream_traffic check on the step grades not_applicable.\n const upstreamTraffic = await prefetchUpstreamTraffic(\n step.id,\n resolvedValidations,\n client,\n options,\n runState,\n requestStartIso,\n requestRecord.payload,\n step.sample_request\n );\n\n const vctx: ValidationContext = {\n taskName: effectiveStep.task,\n ...(options.adcpVersion && { adcpVersion: options.adcpVersion }),\n ...(options._serverAdcpVersion && { responseAdcpVersion: options._serverAdcpVersion }),\n ...(validationTaskResult && { taskResult: validationTaskResult }),\n ...(httpResult && { httpResult }),\n agentUrl: runState.agentUrl,\n contributions: runState.contributions,\n ...(effectiveStep.response_schema_ref && { responseSchemaRef: effectiveStep.response_schema_ref }),\n request: requestRecord,\n ...(responseRecord && { response: responseRecord }),\n storyboardContext: context,\n ...(a2aEnvelope && { a2aEnvelope }),\n ...(upstreamTraffic && { upstreamTraffic }),\n ...(step.sample_request && { storyboardStep: { sample_request: step.sample_request } }),\n ...(crossResponses && { crossResponses }),\n ...(() => {\n // Walk back through the run's captured A2A envelopes and use\n // the most recent prior step's envelope as the comparison\n // baseline. The map preserves insertion order, so the last\n // entry is the most recent prior step's capture.\n const map = runState.priorA2aEnvelopes;\n if (!map || map.size === 0) return {};\n let priorStepId: string | undefined;\n let priorEnv: A2ATaskEnvelope | undefined;\n for (const [stepId, env] of map) {\n priorStepId = stepId;\n priorEnv = env;\n }\n return {\n ...(priorEnv && { priorA2aEnvelope: priorEnv }),\n ...(priorStepId && { priorA2aStepId: priorStepId }),\n };\n })(),\n };\n validations = runValidations(resolvedValidations, vctx);\n\n // Parallel-dispatch aggregation: per-response checks (`response_schema`,\n // `field_present`, `error_code`, etc.) declared by the storyboard MUST\n // grade against every dispatch's resolved response, not just the\n // representative one. Re-run each non-cross-response validation against\n // each dispatch's TaskResult and append the additional results so the\n // step's overall pass/fail reflects the full fan-out. The first run\n // (above) already covers dispatch[0]; this loop covers dispatches[1..N].\n if (crossResponses && crossResponses.dispatches.length > 1) {\n const perResponseValidations = resolvedValidations.filter(\n v => v.check !== 'cross_response_field_equal' && v.check !== 'cross_response_count_distinct'\n );\n for (let i = 1; i < crossResponses.dispatches.length; i++) {\n const d = crossResponses.dispatches[i];\n if (!d || !d.taskResult) continue;\n const dispatchCtx: ValidationContext = {\n ...vctx,\n taskResult: d.taskResult,\n // Per-dispatch responseRecord stays minimal — the redacted payload\n // captures enough for failure attribution without bloating success.\n ...(responseRecord && {\n response: {\n ...responseRecord,\n payload: redactSecrets(d.taskResult.data ?? d.taskResult.error ?? null),\n duration_ms: d.duration_ms,\n },\n }),\n };\n // Drop crossResponses on the per-dispatch context so cross-response\n // checks don't re-fire here (they already ran once above on the\n // representative dispatch and produced their single result).\n delete dispatchCtx.crossResponses;\n const dispatchResults = runValidations(perResponseValidations, dispatchCtx).map(r => ({\n ...r,\n description: `[dispatch ${d.correlation_id}] ${r.description}`,\n }));\n validations.push(...dispatchResults);\n }\n }\n }\n\n // Schema-validation attribution (adcp-client#1709). When the response\n // unwrapper rejected the agent's response against the SDK's Zod schema\n // for the tool, it threw a typed `ResponseSchemaValidationError` that\n // surfaced on `caughtError`. Without this attribution, the rejection\n // would silently propagate into whichever step-scope invariant (e.g.\n // `context.no_secret_echo`) happened to fire next — the BidMachine\n // misdiagnosis trace from adcp-client#1709 / adcp#4419 ate 10+ deploys\n // chasing the wrong cause.\n //\n // Synthesize a canonical `response_schema` ValidationResult and prepend\n // it so `extractFailures.find(v => !v.passed)` resolves it before any\n // invariant entry. Step-scope invariants downstream of this point will\n // short-circuit on the schema-invalid response (see the invariant\n // dispatch loop in `executeStoryboardPass`).\n let schemaRejectionIsAdvisory = false;\n if (schemaValidationError) {\n const issues = schemaValidationError.issues\n .slice(0, 5)\n .map(i => `${i.path.join('.') || '(root)'}: ${i.message}`)\n .join('; ');\n const firstIssue = schemaValidationError.issues[0];\n const jsonPointer = firstIssue ? '/' + firstIssue.path.map(s => String(s)).join('/') : null;\n const baseSchemaResult: ValidationResult = {\n check: 'response_schema',\n passed: false,\n description: `Response schema validation for ${schemaValidationError.toolName}`,\n error: issues,\n json_pointer: jsonPointer,\n expected: `response schema for ${schemaValidationError.toolName}`,\n actual: schemaValidationError.issues,\n };\n const authoredSchemaValidations = (step.validations ?? []).filter(v => v.check === 'response_schema');\n const schemaValidationContext: ValidationContext = {\n taskName: effectiveStep.task,\n ...(options.adcpVersion && { adcpVersion: options.adcpVersion }),\n ...(options._serverAdcpVersion && { responseAdcpVersion: options._serverAdcpVersion }),\n ...(validationTaskResult && { taskResult: validationTaskResult }),\n agentUrl: runState.agentUrl,\n contributions: runState.contributions,\n request: requestRecord,\n ...(responseRecord && { response: responseRecord }),\n };\n const decoratedCandidates = authoredSchemaValidations.map(validation =>\n decorateValidationResult(baseSchemaResult, schemaValidationContext, validation)\n );\n const schemaResults = decoratedCandidates.length\n ? decoratedCandidates\n : [{ ...baseSchemaResult, severity: 'required' } satisfies ValidationResult];\n schemaRejectionIsAdvisory = schemaResults.every(result => !validationFailsStep(result));\n if (schemaRejectionIsAdvisory && !step.expect_error) passed = true;\n // Prepend so extractFailures picks it up before any inline validation\n // entry that may also be failing (e.g. `field_present` checks that\n // legitimately can't observe their target against an unparsed payload).\n validations = [...schemaResults, ...validations.filter(result => result.check !== 'response_schema')];\n }\n\n // Persist the captured A2A envelope keyed by step id so cross-step\n // validators (`a2a_context_continuity`) on subsequent steps can\n // compare against it. Only fires when this step actually captured\n // an envelope — probe steps, MCP steps, and capture-bypass paths\n // don't insert, so cross-step comparisons walk back to the most\n // recent A2A step automatically via insertion-order iteration.\n if (a2aEnvelope && runState.priorA2aEnvelopes) {\n runState.priorA2aEnvelopes.set(step.id, a2aEnvelope);\n }\n\n // Extract context from responses. Forward the alias cache so\n // `$generate:uuid_v4#<alias>` placeholders in subsequent steps resolve\n // to the same UUID as prior steps with the same alias.\n const updatedContext = { ...context };\n forwardAliasCache(context, updatedContext);\n const hasData = taskResult?.data !== undefined && taskResult?.data !== null;\n\n // Convention-based extraction (for non-error steps, or when expect_error succeeded)\n if (passed && hasData && taskResult) {\n const extracted = extractContextWithProvenance(effectiveStep.task, taskResult.data, step.id);\n Object.assign(updatedContext, extracted.values);\n for (const key of Object.keys(extracted.values)) {\n runState.responseDerivedNotApplicableContextKeys?.delete(key);\n }\n if (runState.contextProvenance) {\n for (const [key, entry] of Object.entries(extracted.provenance)) {\n runState.contextProvenance.set(key, entry);\n }\n }\n }\n\n // Explicit context_outputs. `generate:` entries fire unconditionally —\n // including on failed steps — because the generated ID was already\n // determined (and may already be inline-substituted via $generate:…#<key>)\n // before the request went out. Propagating it even on failure lets the\n // next step use the same ID for a forced-completion or tasks/get follow-up.\n // `path:` entries are gated on a non-null response and skip silently when\n // data is absent. Both paths write into updatedContext and receive\n // updatedContext for alias-cache coherence — forwardAliasCache above\n // ensures the minted value from any same-step $generate:…#<key> inline\n // substitution is visible here.\n if (step.context_outputs?.length) {\n for (const output of step.context_outputs) {\n if (output.key) runState.responseDerivedNotApplicableContextKeys?.delete(output.key);\n }\n // Resolve `task_completion.<path>` outputs against the eventual task\n // artifact rather than the immediate response. When the immediate\n // response is a submitted-arm envelope (HITL / async-signed-IO flows),\n // the seller-assigned IDs only exist on the completion artifact — the\n // sync-shape path resolves to nothing and the storyboard fails on\n // `capture_path_not_resolvable` for a value the seller correctly\n // produces, just on a later message. The `task_completion.` prefix is\n // an explicit author-side opt-in: \"poll tasks/get for terminal status,\n // then resolve the rest of the path against the artifact data.\"\n //\n // Polling failures (timeout, terminal failed/canceled/rejected) emit\n // `capture_poll_timeout` instead of recycling\n // `capture_path_not_resolvable` so the failure-class is distinct from\n // the original \"field absent in immediate response\" diagnostic.\n const taskCompletionResolution = await resolveTaskCompletionOutputs(\n taskResult,\n step.context_outputs,\n client,\n runState.webhookReceiver,\n effectiveStep.task\n );\n // `'data' in resolution` distinguishes \"polled, artifact had no data\"\n // (use undefined → outputs fail with capture_path_not_resolvable) from\n // \"did not poll\" (fall back to the immediate response data).\n const extractionData =\n 'data' in taskCompletionResolution\n ? taskCompletionResolution.data\n : hasData && taskResult\n ? taskResult.data\n : undefined;\n const remappedOutputs = remapTaskCompletionOutputs(step.context_outputs);\n const explicit = applyContextOutputsWithProvenance(\n extractionData,\n remappedOutputs,\n step.id,\n effectiveStep.task,\n updatedContext\n );\n Object.assign(updatedContext, explicit.values);\n for (const key of Object.keys(explicit.values)) {\n runState.responseDerivedNotApplicableContextKeys?.delete(key);\n }\n if (runState.contextProvenance) {\n for (const [key, entry] of Object.entries(explicit.provenance)) {\n runState.contextProvenance.set(key, entry);\n }\n }\n // Per runner-output-contract.yaml v2.0.0, a `context_outputs.path` that\n // resolves to absent / null / \"\" is a producer-side conformance failure\n // on THIS step (capture_path_not_resolvable), not on a downstream\n // consumer. Synthesize a failed validation_result so the failure is\n // attributed where it actually originated. Emitted regardless of whether\n // the step's authored validations passed — a clean response_schema with\n // a failed capture is the exact case adcp#3796 set out to fix.\n if (explicit.failures && explicit.failures.length > 0) {\n for (const failure of explicit.failures) {\n const wasTaskCompletion = step.context_outputs.some(\n o => o.key === failure.key && typeof o.path === 'string' && o.path.startsWith(TASK_COMPLETION_PATH_PREFIX)\n );\n const pollTimedOut = wasTaskCompletion && taskCompletionResolution.timedOut === true;\n const taskFailed = wasTaskCompletion && taskCompletionResolution.taskFailed === true;\n const originalPath = wasTaskCompletion ? `${TASK_COMPLETION_PATH_PREFIX}${failure.path}` : failure.path;\n let check: string;\n let description: string;\n if (pollTimedOut) {\n check = 'capture_poll_timeout';\n description = `context_outputs path \"${originalPath}\" (key \"${failure.key}\") did not resolve before tasks/get poll timed out (${taskCompletionResolution.pollTimeoutMs}ms)`;\n } else if (taskFailed) {\n check = 'capture_task_failed';\n description = `context_outputs path \"${originalPath}\" (key \"${failure.key}\") did not resolve because the task reached a terminal failed/canceled/rejected state`;\n } else {\n check = 'capture_path_not_resolvable';\n description = `context_outputs path \"${originalPath}\" (key \"${failure.key}\") did not resolve to a usable value`;\n }\n const synthetic: ValidationResult = {\n check,\n passed: false,\n description,\n json_pointer: toJsonPointer(failure.path),\n expected: originalPath,\n actual: failure.resolved,\n schema_id: null,\n schema_url: null,\n ...(requestRecord && { request: requestRecord }),\n ...(responseRecord && { response: responseRecord }),\n };\n validations.push(synthetic);\n }\n }\n }\n // Re-evaluate after any synthesized capture-failure validations are\n // appended — the step's overall pass/fail must reflect them.\n const allValidationsPassedFinal = validations.every(v => !validationFailsStep(v));\n\n // Emit context-value-rejected hints when the seller's error lists the\n // values it would have accepted and the rejected request value traces\n // back to a prior-step $context.* write. Non-fatal: doesn't flip\n // pass/fail; collapses \"SDK bug vs seller bug\" triage to one line.\n //\n // Gate fires on any step-level failure — task-level failure OR a\n // validation failure on a 200-OK response. Some sellers return 200 with\n // an advisory `errors[]` + `available:` list (success envelope with\n // warnings), and the hint is most useful on exactly that shape. Before\n // adcp-client#883 the gate was task-level only and missed schema-\n // rejected-but-200 flows.\n //\n // - Normal steps: hints fire whenever the step failed.\n // - `expect_error` steps: `passed` is inverted (true when the task\n // failed), so a genuinely-failing `expect_error` step has\n // `passed && allValidationsPassed === true`, gate stays shut —\n // expected rejections don't chatter hints by design. When the\n // validations DO fail (the caller's assertion about the error\n // shape was wrong), hints fire and can point them at the source\n // step that supplied the rejected value.\n //\n // Hints trace to context that existed BEFORE this step's own writes,\n // since the rejected value can't have come from this step's own\n // extraction.\n const stepFailed = !(passed && allValidationsPassedFinal);\n const contextRejectionHints =\n stepFailed && runState.contextProvenance\n ? detectContextRejectionHints(taskResult, request, context, runState.contextProvenance, effectiveStep.task)\n : [];\n\n // Shape-drift and strict-AJV hints fire on any step that has a parsed\n // payload, regardless of pass/fail — issue #935 widened the gate so\n // these structured diagnostics surface alongside the runner's existing\n // `ValidationResult.warning` prose without depending on Zod rejection.\n // Pre-process identically to validateResponseSchema: bare-array payloads\n // pass through; object payloads have the SDK-internal `_message` field\n // stripped so the detector sees what AJV does.\n const driftPayload = (() => {\n if (!hasData || !taskResult) return undefined;\n const raw = taskResult.data;\n if (Array.isArray(raw)) return raw;\n if (raw && typeof raw === 'object') {\n const { _message, ...rest } = raw as Record<string, unknown>;\n return rest;\n }\n return raw;\n })();\n const shapeDriftHints =\n driftPayload === undefined\n ? []\n : detectShapeDriftHints(effectiveStep.task, driftPayload, runState.agentLibraryVersion);\n const strictHints = detectStrictValidationHints(effectiveStep.task, validations);\n // Same root cause MAY produce both a `shape_drift` hint and a\n // `format_mismatch` (keyword: 'type') hint — e.g. `list_creatives`\n // returning a bare array. That's intentional co-emission, not a bug:\n // shape_drift carries the fix recipe (\"use listCreativesResponse() to\n // wrap\"); format_mismatch carries the structured RFC 6901 pointer +\n // AJV schema_path so renderers can deep-link into the schema.\n // Complementary fix lenses on the same fault.\n const hints = [...contextRejectionHints, ...shapeDriftHints, ...strictHints];\n\n // Build next step preview\n const next = getNextStepPreview(step.id, allSteps, updatedContext, runState.runnerVars);\n\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: passed && allValidationsPassedFinal,\n expect_error: step.expect_error,\n duration_ms: stepResult.duration_ms,\n // Legacy `response` field (new code reads `response_record`).\n // Redact in case a downstream consumer still keys off it; the\n // modern `response_record.payload` path is already redacted.\n response: redactSecrets(taskResult?.data),\n validations,\n context: updatedContext,\n ...(runState.contextProvenance &&\n runState.contextProvenance.size > 0 && {\n context_provenance: Object.fromEntries(runState.contextProvenance),\n }),\n ...responseDerivedContextResult(runState),\n error:\n step.expect_error || schemaRejectionIsAdvisory ? undefined : truncateError(stepResult.error || taskResult?.error),\n ...(!step.expect_error && taskResult?.adcp_error && { adcp_error: taskResult.adcp_error }),\n next,\n request: requestRecord,\n ...(responseRecord && { response_record: responseRecord }),\n extraction: extractionFromTaskResult(taskResult),\n ...(inputSchemaStripNotices.length > 0 && { notices: inputSchemaStripNotices }),\n ...(hints.length > 0 && { hints }),\n };\n}\n\n// ────────────────────────────────────────────────────────────\n// Probe dispatch (raw HTTP tasks)\n// ────────────────────────────────────────────────────────────\n\nfunction invalidTrustedMatchPublisherAuthTask(\n step: StoryboardStep,\n phaseId: string,\n context: StoryboardContext,\n allSteps: FlatStep[],\n runState: ExecutionState\n): StoryboardStepResult {\n const detail =\n `Pseudo-task \"${step.task}\" is valid only in a storyboard declaring ` +\n '`requires: [trusted_match_publisher_auth_runner]`; it was not dispatched over MCP or A2A.';\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: false,\n duration_ms: 0,\n validations: [],\n context,\n error: detail,\n next: getNextStepPreview(step.id, allSteps, context, runState.runnerVars),\n extraction: { path: 'none' },\n };\n}\n\nfunction trustedMatchPublisherAuthRequirementUnmetStep(\n step: StoryboardStep,\n phaseId: string,\n context: StoryboardContext,\n allSteps: FlatStep[],\n runState: ExecutionState,\n detail: string\n): StoryboardStepResult {\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: 'requirement_unmet',\n skip: { reason: 'requirement_unmet', requirement: 'trusted_match_publisher_auth_runner', detail },\n duration_ms: 0,\n validations: [],\n context,\n next: getNextStepPreview(step.id, allSteps, context, runState.runnerVars),\n extraction: { path: 'none', note: 'publisher-auth runner requirement unavailable' },\n };\n}\n\nasync function executeProbeStep(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- client type varies (TestClient)\n client: any,\n step: StoryboardStep,\n phaseId: string,\n context: StoryboardContext,\n allSteps: FlatStep[],\n options: StoryboardRunOptions,\n runState: ExecutionState\n): Promise<StoryboardStepResult> {\n const start = Date.now();\n let httpResult: HttpProbeResult | undefined;\n let oauthMetadataGraph: OAuthMetadataGraphGrade | undefined;\n const probeOpts = {\n allowPrivateIp: options.allow_http === true,\n fetchFn: options.transport?.trustedFetchFn,\n };\n let requestRecordOverride: RunnerRequestRecord | undefined;\n\n const contractsInScope = new Set(options.contracts ?? []);\n if (step.requires_contract) {\n if (!contractsInScope.has(step.requires_contract)) {\n httpResult = {\n url: runState.agentUrl,\n status: 0,\n headers: {},\n body: null,\n skipped: true,\n skip_reason: 'missing_test_kit_contract',\n error: `Test-kit contract \"${step.requires_contract}\" is not configured on this runner.`,\n };\n }\n }\n if (\n !httpResult &&\n step.task === 'expect_rate_limit_not_replayed' &&\n !contractsInScope.has(RATE_LIMIT_TRIP_CONTRACT)\n ) {\n httpResult = {\n url: runState.agentUrl,\n status: 0,\n headers: {},\n body: null,\n skipped: true,\n skip_reason: 'missing_test_kit_contract',\n error: `Test-kit contract \"${RATE_LIMIT_TRIP_CONTRACT}\" is not configured on this runner.`,\n };\n }\n\n if (httpResult) {\n // Contract-gated synthetic probes self-skip before doing any network work.\n } else if (TRUSTED_MATCH_PUBLISHER_AUTH_TASKS.has(step.task)) {\n const task = step.task as TrustedMatchPublisherAuthTask;\n let prepared = getPreparedTrustedMatchPublisherAuth(options);\n if (!prepared) {\n const runner = options.trusted_match_publisher_auth_runner;\n if (!runner) {\n return trustedMatchPublisherAuthRequirementUnmetStep(\n step,\n phaseId,\n context,\n allSteps,\n runState,\n 'No trusted_match_publisher_auth_runner is configured.'\n );\n }\n try {\n prepared = await prepareTrustedMatchPublisherAuthProbes(runner);\n } catch (error) {\n return trustedMatchPublisherAuthRequirementUnmetStep(\n step,\n phaseId,\n context,\n allSteps,\n runState,\n error instanceof Error ? error.message : String(error)\n );\n }\n }\n // These contract-owned raw requests must remain byte-shape faithful to\n // the storyboard. Generic run-level request overrides are intentionally\n // ignored; only authored placeholder substitution is allowed.\n const request = step.sample_request ? injectContext({ ...step.sample_request }, context, runState.runnerVars) : {};\n httpResult = await probeTrustedMatchPublisherAuth(prepared[task], request, {\n allowPrivateIp: options.allow_http === true,\n ...(options.signal && { signal: options.signal }),\n });\n requestRecordOverride = {\n transport: 'http',\n operation: step.task,\n payload: redactSecrets(request),\n url: redactOAuthUrlForOutput(prepared[task].endpoint),\n };\n } else if (step.task === 'protected_resource_metadata') {\n if (step.validations?.some(validation => validation.check === 'oauth_metadata_graph')) {\n oauthMetadataGraph = await gradeOAuthMetadataGraph(runState.agentUrl, {\n allowHttp: options.allow_http === true,\n signal: options.signal,\n trustedFetchFn: options.transport?.trustedFetchFn,\n });\n httpResult = oauthMetadataGraph.protected_resource_result;\n } else {\n httpResult = await probeProtectedResourceMetadata(runState.agentUrl, probeOpts);\n }\n // RFC 9728 presence semantics (adcp-client#677): a 404 means the agent is\n // honestly not advertising OAuth. Convert to a clean step skip so the\n // phase loop can cascade-skip the rest of oauth_discovery instead of\n // failing the http_status:200 validation. Any other status (including\n // 200) runs validations unchanged — an agent that serves PRM MUST serve\n // it correctly, regardless of whether the test kit also declared an\n // API key. Fetch errors (status 0) fall through to the normal failure\n // path since we can't distinguish \"agent down\" from \"misconfigured\".\n if (!oauthMetadataGraph && !httpResult.error && httpResult.status === 404) {\n httpResult.skipped = true;\n httpResult.skip_reason = 'oauth_not_advertised';\n }\n } else if (step.task === 'oauth_auth_server_metadata') {\n const prior = runState.priorProbes.get('protected_resource_metadata') ?? findPriorProbe(runState.priorStepResults);\n httpResult = await probeOauthAuthServerMetadata(prior, probeOpts);\n } else if (step.task === 'assert_contribution') {\n // Synthetic: evaluate only through validations (any_of). No network call.\n httpResult = undefined;\n } else if (step.task === 'request_signing_probe') {\n httpResult = await probeRequestSigningVector(step.id, runState.agentUrl, options);\n } else if (step.task === 'fetch_brand_jwks') {\n httpResult = await probeBrandJwks(options._profile?.raw_capabilities, probeOpts);\n } else if (step.task === 'assert_jwks_purpose') {\n // Webhook delivery is signed with the agent's request-signing key; the\n // deprecated webhook-signing purpose is still accepted (adcontextprotocol/adcp#5555).\n httpResult = assertJwksPurpose(runState.priorProbes.get('fetch_brand_jwks'), [\n 'request-signing',\n 'webhook-signing',\n ]);\n } else if (step.task === 'expect_rate_limit_not_replayed') {\n const specError = validateRateLimitTripSpec(step.rate_limit_trip);\n if (specError) {\n httpResult = {\n url: runState.agentUrl,\n status: 0,\n headers: {},\n body: { attempts: 0, error: 'rate_limit_trip_misconfigured' },\n error: specError,\n };\n } else if (options.allowLiveSideEffects !== true) {\n httpResult = {\n url: runState.agentUrl,\n status: 0,\n headers: {},\n body: null,\n skipped: true,\n skip_reason: 'live_side_effect_opt_in_required',\n error:\n 'The rate-limit trip probe can send hundreds of mutating requests. ' +\n 'Pass allowLiveSideEffects: true to authorize it explicitly.',\n };\n } else {\n const rateLimitTrip = step.rate_limit_trip!;\n const targetStep: StoryboardStep = {\n ...step,\n task: rateLimitTrip.trip_target_task,\n sample_request: rateLimitTrip.trip_target_sample_request,\n omit_idempotency_key: true,\n };\n const targetRequestResult = buildEffectiveStepRequest(targetStep, context, options, runState);\n if (!targetRequestResult.ok) {\n if ('creativeAssetFailure' in targetRequestResult) {\n return buildCreativeAssetFixtureUnavailableStep(\n step,\n phaseId,\n context,\n allSteps,\n runState,\n targetRequestResult.creativeAssetFailure\n );\n }\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: false,\n duration_ms: Date.now() - start,\n validations: [\n {\n check: 'unresolved_substitution',\n passed: false,\n description: `Fixture handle substitution failed: ${targetRequestResult.error}`,\n json_pointer: null,\n expected: 'an unambiguous fixture handle binding',\n actual: targetRequestResult.error,\n schema_id: null,\n schema_url: null,\n },\n ],\n context,\n next,\n extraction: { path: 'none' },\n error: targetRequestResult.error,\n };\n }\n const resolvedTargetRequest = targetRequestResult.request;\n const unresolvedContextVars = findUnresolvedContextVars(resolvedTargetRequest);\n const unresolvedAssetDirectives = findUnresolvedCreativeAssetDirectives(resolvedTargetRequest).map(path => ({\n key: path,\n token: BUILD_ASSETS_FROM_FORMAT_DIRECTIVE,\n }));\n const unresolvedVars = [...unresolvedContextVars, ...unresolvedAssetDirectives];\n if (unresolvedAssetDirectives.length > 0 || (unresolvedContextVars.length > 0 && !targetStep.expect_error)) {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const detail = `Skipped: unresolved context variables from rate_limit_trip.trip_target_sample_request: ${unresolvedVars\n .map(v => v.key)\n .join(', ')}.`;\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: false,\n skipped: true,\n skip_reason: 'prerequisite_failed',\n skip: buildSkip('prerequisite_failed', detail),\n duration_ms: Date.now() - start,\n validations: [],\n context,\n next,\n extraction: { path: 'none' },\n error: detail,\n };\n }\n const unresolvedRunnerTokens = findUnresolvedRunnerTokens(resolvedTargetRequest);\n if (unresolvedRunnerTokens.length > 0) {\n const isPrerequisiteFailure = hasUnresolvedPriorStepToken(unresolvedRunnerTokens);\n const skipReason = isPrerequisiteFailure ? 'prerequisite_failed' : 'not_applicable';\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const detail =\n 'Skipped: rate_limit_trip target request references unresolved runner placeholders. ' +\n `Unresolved token(s): ${unresolvedRunnerTokens.join(', ')}.`;\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: !isPrerequisiteFailure,\n skipped: true,\n skip_reason: skipReason,\n skip: buildSkip(skipReason, detail),\n duration_ms: Date.now() - start,\n validations: [],\n context,\n next,\n extraction: { path: 'none' },\n ...(isPrerequisiteFailure ? { error: detail } : {}),\n };\n }\n const advertisedTools = resolveAdvertisedTools(options);\n if (advertisedTools && !advertisedTools.includes(rateLimitTrip.trip_target_task)) {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const detail = `Agent did not advertise tool \"${rateLimitTrip.trip_target_task}\"; agent tools: [${advertisedTools.join(', ')}].`;\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: 'missing_tool',\n skip: buildSkip('missing_tool', detail),\n duration_ms: Date.now() - start,\n validations: [],\n context,\n next,\n extraction: { path: 'none' },\n };\n }\n const resolvedSpec = {\n ...rateLimitTrip,\n trip_target_sample_request: resolvedTargetRequest,\n };\n const targetTransport: Extract<RunnerTransport, 'mcp' | 'a2a'> = options.protocol === 'a2a' ? 'a2a' : 'mcp';\n const observer = new RateLimitTripObserver(client, {\n keyMinter: generateIdempotencyKey,\n correlationPrefix: step.id,\n transport: targetTransport,\n });\n const observation = await observer.run(resolvedSpec);\n httpResult = rateLimitTripObservationToProbeResult(runState.agentUrl, observation);\n const observedRequest = observation.body.replay_request ?? observation.body.trip_request ?? resolvedTargetRequest;\n requestRecordOverride = {\n transport: targetTransport,\n operation: rateLimitTrip.trip_target_task,\n payload: redactSecrets(observedRequest),\n ...(runState.agentUrl ? { url: redactOAuthUrlForOutput(runState.agentUrl) } : {}),\n };\n }\n } else if (step.task === REPLAY_TRUSTED_MATCH_CONTEXT_VECTOR_TASK) {\n const routerRunner = options.trusted_match_context_router_runner;\n if (!routerRunner?.router_url || typeof routerRunner.registerProviders !== 'function') {\n httpResult = {\n url: routerRunner?.router_url ?? runState.agentUrl,\n status: 0,\n headers: {},\n body: null,\n skipped: true,\n skip_reason: 'grader_skipped',\n error:\n 'No Trusted Match Context router harness configured. Pass trusted_match_context_router_runner ' +\n 'with router_url and registerProviders; the runner will not dispatch this pseudo-task over MCP/A2A.',\n };\n } else {\n const requestOverride = options.request\n ? injectContext({ ...options.request }, context, runState.runnerVars)\n : step.sample_request\n ? injectContext({ ...step.sample_request }, context, runState.runnerVars)\n : undefined;\n const replay = await replayTrustedMatchContextVector(step, routerRunner, {\n ...(requestOverride && { requestOverride }),\n ...(options.adcpVersion && { adcpVersion: options.adcpVersion }),\n ...(options.signal && { signal: options.signal }),\n });\n httpResult = replay.httpResult;\n requestRecordOverride = {\n transport: 'http',\n operation: step.task,\n payload: redactSecrets(replay.request),\n url: redactOAuthUrlForOutput(replay.httpResult.url),\n };\n }\n }\n\n if (httpResult) runState.priorProbes.set(step.task, httpResult);\n\n const duration = Date.now() - start;\n const requestRecord: RunnerRequestRecord = requestRecordOverride ?? {\n transport: 'http',\n operation: step.task,\n payload: null,\n ...(httpResult?.url\n ? { url: redactOAuthUrlForOutput(httpResult.url) }\n : runState.agentUrl\n ? { url: redactOAuthUrlForOutput(runState.agentUrl) }\n : {}),\n };\n const filteredProbeHeaders = filterResponseHeaders(httpResult?.headers);\n const responseTransport = requestRecordOverride?.transport ?? 'http';\n const responseRecord: RunnerResponseRecord | undefined = httpResult\n ? {\n transport: responseTransport,\n payload: redactSecrets(httpResult.body),\n ...(responseTransport === 'http' && { status: httpResult.status }),\n ...(filteredProbeHeaders && { headers: filteredProbeHeaders }),\n duration_ms: duration,\n }\n : undefined;\n const redactedHttpResult = httpResult\n ? {\n ...httpResult,\n url: redactOAuthUrlForOutput(httpResult.url),\n headers: filteredProbeHeaders ?? {},\n body: redactSecrets(httpResult.body),\n ...(httpResult.error && { error: redactOAuthUrlsInText(httpResult.error) }),\n ...(responseTransport !== 'http' && { status: undefined }),\n }\n : undefined;\n\n // Probe may self-skip (request_signing_probe uses this for operator opt-outs\n // and capability-profile mismatches). Surface as a skipped step without\n // running validations — skip ≠ fail. The detailed reason goes on\n // `skip_reason`; the canonical spec reason goes on `skip` so contract\n // consumers see a stable enum.\n if (httpResult?.skipped) {\n const detailedReason = (httpResult.skip_reason ?? 'probe_skipped') as RunnerDetailedSkipReason;\n const canonicalReason = DETAILED_SKIP_TO_CANONICAL[detailedReason] ?? 'not_applicable';\n const detail =\n CANONICAL_SKIP_DETAILS[detailedReason] ??\n httpResult.error ??\n DETAILED_SKIP_DETAILS[detailedReason] ??\n SKIP_DETAILS[canonicalReason];\n const selectionResult = selectionForProbeSkip(detailedReason, detail);\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: detailedReason,\n skip: { reason: canonicalReason, detail },\n ...(selectionResult && { selection_result: selectionResult }),\n duration_ms: duration,\n response: redactedHttpResult,\n validations: [],\n context,\n next: getNextStepPreview(step.id, allSteps, context, runState.runnerVars),\n request: requestRecord,\n ...(responseRecord && { response_record: responseRecord }),\n extraction: { path: 'none', note: 'probe self-skipped' },\n };\n }\n\n const vctx: ValidationContext = {\n taskName: step.task === REPLAY_TRUSTED_MATCH_CONTEXT_VECTOR_TASK ? 'context_match' : step.task,\n ...(options.adcpVersion && { adcpVersion: options.adcpVersion }),\n ...(options._serverAdcpVersion && { responseAdcpVersion: options._serverAdcpVersion }),\n httpResult: redactedHttpResult,\n ...(step.task === REPLAY_TRUSTED_MATCH_CONTEXT_VECTOR_TASK &&\n redactedHttpResult && {\n taskResult: {\n success: !redactedHttpResult.error && redactedHttpResult.status >= 200 && redactedHttpResult.status < 300,\n data: redactedHttpResult.body,\n ...(redactedHttpResult.error && { error: redactedHttpResult.error }),\n },\n }),\n agentUrl: runState.agentUrl,\n contributions: runState.contributions,\n ...(step.response_schema_ref && { responseSchemaRef: step.response_schema_ref }),\n request: requestRecord,\n ...(responseRecord && { response: responseRecord }),\n storyboardContext: context,\n ...(oauthMetadataGraph && { oauthMetadataGraph }),\n };\n const validations = step.validations?.length ? runValidations(step.validations, vctx) : [];\n const allValidationsPassed = validations.every(v => !validationFailsStep(v));\n\n // For probes, the \"task passed\" proxy is: fetch returned without error AND\n // all validations passed. For assert_contribution (no httpResult), we lean\n // on validations alone.\n const fetchOk = httpResult ? !httpResult.error : true;\n const passed = fetchOk && allValidationsPassed;\n\n const extraction: RunnerExtractionRecord = httpResult\n ? httpResult.error\n ? { path: 'error' }\n : { path: 'structured_content', note: 'http-probe body parsed as JSON' }\n : { path: 'none' };\n\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed,\n duration_ms: duration,\n response: redactedHttpResult ?? undefined,\n validations,\n context,\n error: httpResult?.error ?? (passed ? undefined : 'Probe validations failed.'),\n next: getNextStepPreview(step.id, allSteps, context, runState.runnerVars),\n request: requestRecord,\n ...(responseRecord && { response_record: responseRecord }),\n extraction,\n };\n}\n\ntype FixtureBindingApplicationResult = { ok: true; request: Record<string, unknown> } | { ok: false; error: string };\n\ntype EffectiveStepRequestResult =\n | FixtureBindingApplicationResult\n | { ok: false; creativeAssetFailure: CreativeAssetFixtureUnavailableFailure };\n\nfunction applyFixtureBindingsSafely(\n request: Record<string, unknown>,\n task: string,\n options: StoryboardRunOptions,\n runState: ExecutionState\n): FixtureBindingApplicationResult {\n try {\n return {\n ok: true,\n request: applyFixtureBindingsToRequest(\n request,\n task,\n runState.fixtureBindings,\n options.adcpVersion ?? ADCP_VERSION\n ),\n };\n } catch (error) {\n return { ok: false, error: error instanceof Error ? error.message : String(error) };\n }\n}\n\nfunction buildEffectiveStepRequest(\n step: StoryboardStep,\n context: StoryboardContext,\n options: StoryboardRunOptions,\n runState: ExecutionState\n): EffectiveStepRequestResult {\n let request: Record<string, unknown>;\n if (options.request) {\n request = injectContext({ ...options.request }, context, runState.runnerVars);\n } else if (step.expect_error && step.sample_request) {\n request = injectContext({ ...step.sample_request }, context, runState.runnerVars);\n } else if (hasRequestEnricher(step.task)) {\n request = enrichRequest(step, context, options, runState.runnerVars);\n } else if (step.sample_request) {\n request = injectContext({ ...step.sample_request }, context, runState.runnerVars);\n } else {\n request = {};\n }\n if (step.context_inputs?.length) {\n request = applyContextInputs(request, step.context_inputs, context);\n }\n request = applyBrandInvariant(request, options, step.task, { omit_account: step.omit_account });\n if (options.disable_sandbox === true) {\n request = applyDisableSandboxHint(request, step.task);\n }\n request = applyIdempotencyInvariant(request, step.task, step);\n const fixtureBinding = applyFixtureBindingsSafely(request, step.task, options, runState);\n if (!fixtureBinding.ok) return fixtureBinding;\n const creativeAssetExpansion = expandCreativeAssetDirectivesWithDiagnostics(\n fixtureBinding.request,\n context,\n options.test_kit\n );\n if (!creativeAssetExpansion.ok && creativeAssetExpansion.failure.reason === 'fixture_unavailable') {\n return { ok: false, creativeAssetFailure: creativeAssetExpansion.failure };\n }\n return {\n ok: true,\n request: creativeAssetExpansion.value as Record<string, unknown>,\n };\n}\n\ninterface CreativeAssetPreflightGap {\n target: FlatStep;\n failure: CreativeAssetFixtureUnavailableFailure;\n}\n\n/**\n * Preflight future creative directives as soon as their seller format enters\n * context. Missing context and malformed directives stay on their ordinary\n * execution paths; only a proven test-kit coverage gap terminates the run.\n */\nfunction preflightRemainingCreativeAssetDirectives(\n allSteps: FlatStep[],\n afterGlobalIndex: number,\n context: StoryboardContext,\n options: StoryboardRunOptions,\n runState: ExecutionState,\n excludedPhaseIds: ReadonlySet<string> = new Set()\n): CreativeAssetPreflightGap | undefined {\n const contractsInScope = new Set(options.contracts ?? []);\n for (const target of allSteps) {\n if (target.globalIndex <= afterGlobalIndex) continue;\n if (excludedPhaseIds.has(target.phaseId)) continue;\n\n const resolvedTask = resolveTaskName(target.step, options);\n if (!resolvedTask) continue;\n if (target.step.requires_tool && options.agentTools && !options.agentTools.includes(target.step.requires_tool)) {\n continue;\n }\n if (target.step.requires_contract && !contractsInScope.has(target.step.requires_contract)) {\n continue;\n }\n if (\n target.step.task === 'expect_rate_limit_not_replayed' &&\n (!contractsInScope.has(RATE_LIMIT_TRIP_CONTRACT) || options.allowLiveSideEffects !== true)\n ) {\n continue;\n }\n if (!PROBE_TASKS.has(target.step.task) && options.agentTools && !options.agentTools.includes(resolvedTask)) {\n continue;\n }\n let requestStep = resolvedTask === target.step.task ? target.step : { ...target.step, task: resolvedTask };\n\n if (target.step.task === 'expect_rate_limit_not_replayed') {\n const rateLimitTrip = target.step.rate_limit_trip;\n if (validateRateLimitTripSpec(rateLimitTrip) || !rateLimitTrip) continue;\n requestStep = {\n ...target.step,\n task: rateLimitTrip.trip_target_task,\n sample_request: rateLimitTrip.trip_target_sample_request,\n omit_idempotency_key: true,\n };\n }\n\n const request = buildEffectiveStepRequest(requestStep, context, options, runState);\n if (!request.ok && 'creativeAssetFailure' in request) {\n return { target, failure: request.creativeAssetFailure };\n }\n }\n return undefined;\n}\n\ninterface ResolvedWebhookReplayVector {\n id: string;\n description?: string;\n expected: 'accept' | 'reject';\n expected_error?: string;\n same_event_as?: string;\n payload: Record<string, unknown>;\n source: string;\n}\n\nasync function executeReplayWebhookVectorStep(\n step: StoryboardStep,\n phaseId: string,\n context: StoryboardContext,\n allSteps: FlatStep[],\n options: StoryboardRunOptions,\n runState: ExecutionState\n): Promise<StoryboardStepResult> {\n const start = Date.now();\n if (step.requires_contract && !new Set(options.contracts ?? []).has(step.requires_contract)) {\n const detail = `Test-kit contract \"${step.requires_contract}\" is not configured on this runner.`;\n const reason: RunnerDetailedSkipReason = 'missing_test_kit_contract';\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: reason,\n skip: buildSkip(DETAILED_SKIP_TO_CANONICAL[reason], detail),\n duration_ms: Date.now() - start,\n validations: [],\n context,\n next: getNextStepPreview(step.id, allSteps, context, runState.runnerVars),\n extraction: { path: 'none', note: 'test-kit contract not configured' },\n };\n }\n\n const receiver = options.webhook_replay_receiver;\n if (!receiver?.url) {\n const detail =\n 'No webhook replay receiver URL configured. Pass `webhook_replay_receiver.url` in StoryboardRunOptions to run inbound receiver conformance.';\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: 'grader_skipped',\n skip: buildSkip('not_applicable', detail),\n duration_ms: Date.now() - start,\n validations: [],\n context,\n next: getNextStepPreview(step.id, allSteps, context, runState.runnerVars),\n extraction: { path: 'none', note: 'webhook replay receiver not configured' },\n };\n }\n\n const vector = resolveWebhookReplayVector(step, options);\n if ('error' in vector) {\n return failedWebhookReplayStep(step, phaseId, context, allSteps, runState, start, vector.error);\n }\n\n const body = JSON.stringify(vector.payload);\n let headers: Record<string, string>;\n try {\n headers = buildWebhookReplayHeaders(receiver.url, body, receiver);\n } catch (error) {\n return failedWebhookReplayStep(\n step,\n phaseId,\n context,\n allSteps,\n runState,\n start,\n error instanceof Error ? error.message : String(error)\n );\n }\n\n const requestRecord: RunnerRequestRecord = {\n transport: 'http',\n operation: step.task,\n payload: {\n vector_ref: step.vector_ref,\n vector_id: vector.id,\n expected: vector.expected,\n body: redactSecrets(vector.payload),\n },\n url: receiver.url,\n };\n\n let httpResult: HttpProbeResult;\n try {\n httpResult = await postWebhookReplayVector(\n receiver.url,\n body,\n headers,\n receiver.fetchImpl ?? fetch,\n receiver.timeoutMs ?? WEBHOOK_REPLAY_DEFAULT_TIMEOUT_MS,\n options.signal\n );\n } catch (error) {\n httpResult = {\n url: receiver.url,\n status: 0,\n headers: {},\n body: null,\n error: error instanceof Error ? error.message : String(error),\n };\n }\n\n const duration = Date.now() - start;\n const filteredProbeHeaders = filterResponseHeaders(httpResult.headers);\n const responseRecord: RunnerResponseRecord = {\n transport: 'http',\n payload: redactSecrets(httpResult.body),\n status: httpResult.status,\n ...(filteredProbeHeaders && { headers: filteredProbeHeaders }),\n duration_ms: duration,\n };\n const redactedHttpResult: HttpProbeResult = {\n ...httpResult,\n body: redactSecrets(httpResult.body),\n };\n\n const validations = buildWebhookReplayValidations(step, vector, allSteps, options, requestRecord, responseRecord);\n const allValidationsPassed = validations.every(v => !validationFailsStep(v));\n const fetchOk = !httpResult.error;\n const passed = fetchOk && allValidationsPassed;\n\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed,\n expect_error: step.expect_error,\n duration_ms: duration,\n response: redactedHttpResult,\n validations,\n context,\n error: httpResult.error ?? (passed ? undefined : 'Webhook replay validations failed.'),\n next: getNextStepPreview(step.id, allSteps, context, runState.runnerVars),\n request: requestRecord,\n response_record: responseRecord,\n extraction: httpResult.error\n ? { path: 'error' }\n : { path: 'structured_content', note: 'webhook receiver HTTP response parsed' },\n };\n}\n\nfunction failedWebhookReplayStep(\n step: StoryboardStep,\n phaseId: string,\n context: StoryboardContext,\n allSteps: FlatStep[],\n runState: ExecutionState,\n start: number,\n error: string\n): StoryboardStepResult {\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: false,\n duration_ms: Date.now() - start,\n validations: [\n {\n check: 'webhook_replay_vector_resolved',\n passed: false,\n description: 'Resolve webhook replay vector before dispatch.',\n expected: step.vector_ref ?? 'vector_ref',\n actual: null,\n error,\n json_pointer: null,\n },\n ],\n context,\n error,\n next: getNextStepPreview(step.id, allSteps, context, runState.runnerVars),\n extraction: { path: 'none' },\n };\n}\n\nfunction buildWebhookReplayValidations(\n step: StoryboardStep,\n vector: ResolvedWebhookReplayVector,\n allSteps: FlatStep[],\n options: StoryboardRunOptions,\n request: RunnerRequestRecord,\n response: RunnerResponseRecord\n): ValidationResult[] {\n const expectedReject = step.expect_error === true || vector.expected === 'reject';\n const status = typeof response.status === 'number' ? response.status : 0;\n const accepted = status >= 200 && status < 300;\n const validations: ValidationResult[] = [\n {\n check: 'webhook_replay_http_status',\n passed: expectedReject ? !accepted : accepted,\n description: expectedReject\n ? 'Receiver rejects malformed webhook replay vectors with a non-2xx status.'\n : 'Receiver accepts canonical webhook replay vectors with a 2xx status.',\n expected: expectedReject ? 'non-2xx' : '2xx',\n actual: status,\n json_pointer: null,\n request,\n response,\n },\n ];\n\n if (step.webhook_payload_schema_ref) {\n const validator = getSchemaValidatorByRef(step.webhook_payload_schema_ref, options.adcpVersion);\n const schemaValid = validator ? validator(vector.payload) : false;\n validations.push({\n check: 'webhook_replay_payload_schema',\n passed: expectedReject ? !schemaValid : schemaValid,\n description: expectedReject\n ? 'Malformed replay vector is rejected by the webhook payload schema.'\n : 'Canonical replay vector validates against the webhook payload schema.',\n expected: expectedReject ? 'schema invalid' : 'schema valid',\n actual: schemaValid\n ? 'schema valid'\n : validator\n ? validator.errors\n : `schema not found: ${step.webhook_payload_schema_ref}`,\n schema_id: step.webhook_payload_schema_ref,\n schema_url: null,\n json_pointer: null,\n request,\n });\n }\n\n const sameEventAs = step.same_event_as ?? vector.same_event_as;\n if (sameEventAs) {\n const priorStep = findWebhookReplaySameEventStep(allSteps, sameEventAs);\n const priorVector = priorStep ? resolveWebhookReplayVector(priorStep, options) : undefined;\n const currentKey = readStringField(vector.payload, 'idempotency_key');\n const priorKey =\n priorVector && !('error' in priorVector) ? readStringField(priorVector.payload, 'idempotency_key') : undefined;\n validations.push({\n check: 'webhook_replay_same_event_idempotency_key',\n passed: Boolean(currentKey && priorKey && currentKey === priorKey),\n description: 'Retry replay vectors for the same logical event preserve idempotency_key.',\n expected: priorKey ?? `prior vector for step ${sameEventAs}`,\n actual: currentKey ?? null,\n json_pointer: '/idempotency_key',\n request,\n });\n }\n\n return validations;\n}\n\nfunction findWebhookReplaySameEventStep(allSteps: FlatStep[], sameEventAs: string): StoryboardStep | undefined {\n return (\n allSteps.find(item => item.step.id === sameEventAs)?.step ??\n allSteps.find(item => vectorRefId(item.step.vector_ref) === sameEventAs)?.step\n );\n}\n\nfunction vectorRefId(ref: string | undefined): string | undefined {\n return ref ? parseWebhookVectorRef(ref)?.id : undefined;\n}\n\nfunction resolveWebhookReplayVector(\n step: StoryboardStep,\n options: StoryboardRunOptions\n): ResolvedWebhookReplayVector | { error: string } {\n if (!step.vector_ref) {\n return { error: '`replay_webhook_vector` step requires vector_ref.' };\n }\n const parsed = parseWebhookVectorRef(step.vector_ref);\n if (!parsed) {\n return { error: `Invalid webhook vector_ref: ${step.vector_ref}` };\n }\n\n const vectorFile = readWebhookVectorFile(parsed.path, options);\n if ('error' in vectorFile) {\n const fallback = fallbackWebhookReplayVector(parsed, step);\n if (fallback) return fallback;\n return vectorFile;\n }\n\n const selected = selectWebhookReplayVector(vectorFile.body, parsed.section, parsed.id);\n if (!selected) {\n return { error: `Webhook replay vector not found: ${step.vector_ref}` };\n }\n return {\n id: selected.id,\n description: selected.description,\n expected: parsed.section === 'negative' || step.expect_error === true ? 'reject' : 'accept',\n ...(selected.expected_error && { expected_error: selected.expected_error }),\n ...(selected.same_event_as && { same_event_as: selected.same_event_as }),\n payload: selected.payload,\n source: vectorFile.path,\n };\n}\n\nfunction parseWebhookVectorRef(ref: string): { path: string; section: string; id: string } | undefined {\n const [pathPart, fragment] = ref.split('#');\n if (!pathPart || !fragment) return undefined;\n const parts = fragment.split('/').filter(Boolean);\n if (parts.length !== 2) return undefined;\n return { path: pathPart, section: parts[0]!, id: parts[1]! };\n}\n\nfunction readWebhookVectorFile(\n refPath: string,\n options: StoryboardRunOptions\n): { path: string; body: unknown } | { error: string } {\n for (const candidate of webhookVectorFileCandidates(refPath, options)) {\n if (!existsSync(candidate)) continue;\n try {\n return { path: candidate, body: JSON.parse(readFileSync(candidate, 'utf8')) };\n } catch (error) {\n return {\n error: `Failed to read webhook replay vector file ${candidate}: ${error instanceof Error ? error.message : error}`,\n };\n }\n }\n return { error: `Webhook replay vector file not found for ${refPath}` };\n}\n\nfunction webhookVectorFileCandidates(refPath: string, options: StoryboardRunOptions): string[] {\n const withoutStatic = refPath.replace(/^static\\//, '');\n const baseName = basename(refPath);\n const candidates: string[] = [];\n if (options.webhook_replay_receiver?.vectorsRoot) {\n candidates.push(join(options.webhook_replay_receiver.vectorsRoot, refPath));\n candidates.push(join(options.webhook_replay_receiver.vectorsRoot, withoutStatic));\n candidates.push(join(options.webhook_replay_receiver.vectorsRoot, baseName));\n }\n const complianceDir = getComplianceCacheDir({ version: options.adcpVersion });\n candidates.push(join(complianceDir, withoutStatic));\n candidates.push(join(complianceDir, refPath));\n candidates.push(join(process.cwd(), refPath));\n candidates.push(join(process.cwd(), withoutStatic));\n return [...new Set(candidates)];\n}\n\nfunction selectWebhookReplayVector(\n body: unknown,\n section: string,\n id: string\n):\n | {\n id: string;\n description?: string;\n expected_error?: string;\n same_event_as?: string;\n payload: Record<string, unknown>;\n }\n | undefined {\n if (!body || typeof body !== 'object') return undefined;\n const bucket = (body as Record<string, unknown>)[section];\n if (!Array.isArray(bucket)) return undefined;\n for (const item of bucket) {\n if (!item || typeof item !== 'object') continue;\n const rec = item as Record<string, unknown>;\n if (rec.id !== id || !rec.payload || typeof rec.payload !== 'object' || Array.isArray(rec.payload)) continue;\n return {\n id,\n ...(typeof rec.description === 'string' && { description: rec.description }),\n ...(typeof rec.expected_error === 'string' && { expected_error: rec.expected_error }),\n ...(typeof rec.same_event_as === 'string' && { same_event_as: rec.same_event_as }),\n payload: rec.payload as Record<string, unknown>,\n };\n }\n return undefined;\n}\n\nfunction fallbackWebhookReplayVector(\n parsed: { path: string; section: string; id: string },\n step: StoryboardStep\n): ResolvedWebhookReplayVector | undefined {\n if (basename(parsed.path) !== 'webhook-receiver-envelope.json') return undefined;\n const canonical = fallbackWebhookDeliveryEnvelope('whk_20260526_example_000031');\n const byId: Record<string, Record<string, unknown>> = {\n 'mcp-delivery-report-envelope': canonical,\n 'mcp-delivery-report-retry-same-idempotency-key': {\n ...canonical,\n timestamp: '2026-05-26T09:00:45.582Z',\n },\n 'bare-delivery-result': canonical.result as Record<string, unknown>,\n 'missing-idempotency-key': omitKey(canonical, 'idempotency_key'),\n 'unsupported-top-level-status': {\n ...canonical,\n idempotency_key: 'whk_20260526_example_000032',\n task_id: 'delivery_report_67_2026_04_000032',\n status: 'active',\n },\n };\n const payload = byId[parsed.id];\n if (!payload) return undefined;\n return {\n id: parsed.id,\n expected: parsed.section === 'negative' || step.expect_error === true ? 'reject' : 'accept',\n ...(parsed.id === 'mcp-delivery-report-retry-same-idempotency-key' && {\n same_event_as: 'mcp-delivery-report-envelope',\n }),\n ...(parsed.id === 'bare-delivery-result' && { expected_error: 'missing_envelope_fields' }),\n ...(parsed.id === 'missing-idempotency-key' && { expected_error: 'missing_idempotency_key' }),\n ...(parsed.id === 'unsupported-top-level-status' && { expected_error: 'invalid_envelope_status' }),\n payload,\n source: 'built-in:webhook-receiver-envelope',\n };\n}\n\nfunction fallbackWebhookDeliveryEnvelope(idempotencyKey: string): Record<string, unknown> {\n return {\n idempotency_key: idempotencyKey,\n operation_id: 'delivery_report_67_2026_04',\n task_id: 'delivery_report_67_2026_04_000031',\n task_type: 'media_buy_delivery',\n status: 'completed',\n timestamp: '2026-05-26T09:00:44.582Z',\n message: 'Scheduled media buy delivery report available',\n result: {\n notification_type: 'scheduled',\n sequence_number: 31,\n reporting_period: {\n start: '2026-05-25T00:00:00Z',\n end: '2026-05-25T23:59:00Z',\n },\n currency: 'USD',\n media_buy_deliveries: [],\n },\n };\n}\n\nfunction omitKey(input: Record<string, unknown>, key: string): Record<string, unknown> {\n const out = { ...input };\n delete out[key];\n return out;\n}\n\nfunction readStringField(input: Record<string, unknown>, key: string): string | undefined {\n const value = input[key];\n return typeof value === 'string' ? value : undefined;\n}\n\nfunction buildWebhookReplayHeaders(\n receiverUrl: string,\n body: string,\n receiver: NonNullable<StoryboardRunOptions['webhook_replay_receiver']>\n): Record<string, string> {\n const headers: Record<string, string> = {\n 'content-type': 'application/json',\n ...(receiver.headers ?? {}),\n };\n const signing = receiver.signing ?? { mode: 'none' as const };\n if (signing.mode === 'none') return headers;\n if (signing.mode === 'hmac') {\n const timestamp = signing.now ? signing.now() : Math.floor(Date.now() / 1000);\n const hmac = createHmac('sha256', signing.secret);\n hmac.update(String(timestamp), 'utf8');\n hmac.update('.', 'utf8');\n hmac.update(body, 'utf8');\n return {\n ...headers,\n 'x-adcp-timestamp': String(timestamp),\n 'x-adcp-signature': `sha256=${hmac.digest('hex')}`,\n };\n }\n if (!signing.key) {\n throw new Error('webhook_replay_receiver.signing.key is required when signing.mode is \"rfc9421\".');\n }\n const request: RequestLike = {\n method: 'POST',\n url: signing.targetUrl ?? receiverUrl,\n headers,\n body,\n };\n return { ...headers, ...signWebhook(request, signing.key, { now: signing.now }).headers };\n}\n\nasync function postWebhookReplayVector(\n url: string,\n body: string,\n headers: Record<string, string>,\n fetchImpl: typeof fetch,\n timeoutMs: number,\n parentSignal?: AbortSignal\n): Promise<HttpProbeResult> {\n const controller = new AbortController();\n const abort = () => controller.abort(parentSignal?.reason);\n if (parentSignal?.aborted) abort();\n parentSignal?.addEventListener('abort', abort, { once: true });\n const timer = setTimeout(\n () => controller.abort(new Error(`webhook replay timed out after ${timeoutMs}ms`)),\n timeoutMs\n );\n try {\n const response = await fetchImpl(url, {\n method: 'POST',\n headers,\n body,\n signal: controller.signal,\n });\n const responseBody = await readWebhookReplayResponseBody(response);\n return {\n url,\n status: response.status,\n headers: lowerCaseHeaders(response.headers),\n body: responseBody,\n };\n } finally {\n clearTimeout(timer);\n parentSignal?.removeEventListener('abort', abort);\n }\n}\n\nasync function readWebhookReplayResponseBody(response: Response): Promise<unknown> {\n const text = await response.text();\n if (!text) return null;\n const contentType = response.headers.get('content-type') ?? '';\n if (contentType.toLowerCase().includes('application/json')) {\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n }\n return text;\n}\n\nfunction lowerCaseHeaders(headers: Headers): Record<string, string> {\n const out: Record<string, string> = {};\n headers.forEach((value, key) => {\n out[key.toLowerCase()] = value;\n });\n return out;\n}\n\nfunction resolveAdvertisedTools(options: StoryboardRunOptions): string[] | undefined {\n return options.agentTools ?? normalizeAgentToolNames(options._profile?.tools);\n}\n\nfunction rateLimitTripObservationToProbeResult(\n agentUrl: string,\n observation: RateLimitTripObservation\n): HttpProbeResult {\n if (observation.status === 'not_applicable') {\n return {\n url: agentUrl,\n status: 0,\n headers: {},\n body: observation.body,\n skipped: true,\n skip_reason: observation.skip_reason,\n error: observation.message,\n };\n }\n if (observation.status === 'failed') {\n return {\n url: agentUrl,\n status: 0,\n headers: {},\n body: { ...observation.body, error: observation.error },\n error: observation.message,\n };\n }\n return {\n url: agentUrl,\n status: 200,\n headers: {},\n body: observation.body,\n };\n}\n\nasync function probeBrandJwks(\n rawCapabilities: unknown,\n options: { allowPrivateIp?: boolean; fetchFn?: typeof fetch }\n): Promise<HttpProbeResult> {\n const brandJsonUrl = readBrandJsonUrl(rawCapabilities);\n if (!brandJsonUrl) {\n return {\n url: '',\n status: 0,\n headers: {},\n body: null,\n error: 'identity.brand_json_url missing from get_adcp_capabilities; cannot fetch brand JWKS',\n };\n }\n\n const brand = await fetchProbe(brandJsonUrl, options);\n if (brand.error || brand.status < 200 || brand.status >= 300) {\n return {\n ...brand,\n error: brand.error ?? `brand.json fetch returned HTTP ${brand.status}`,\n };\n }\n\n const agents = brand.body && typeof brand.body === 'object' ? (brand.body as { agents?: unknown }).agents : undefined;\n const jwksUri = Array.isArray(agents)\n ? agents\n .map(agent => (agent && typeof agent === 'object' ? (agent as { jwks_uri?: unknown }).jwks_uri : undefined))\n .find((uri): uri is string => typeof uri === 'string' && uri.length > 0)\n : undefined;\n if (!jwksUri) {\n return {\n url: brandJsonUrl,\n status: 0,\n headers: {},\n body: brand.body,\n error: 'brand.json agents[] did not contain a jwks_uri',\n };\n }\n\n const jwks = await fetchProbe(jwksUri, options);\n if (jwks.error || jwks.status < 200 || jwks.status >= 300) {\n return {\n ...jwks,\n error: jwks.error ?? `JWKS fetch returned HTTP ${jwks.status}`,\n };\n }\n return jwks;\n}\n\nfunction assertJwksPurpose(prior: HttpProbeResult | undefined, purposes: string | readonly string[]): HttpProbeResult {\n const accepted = typeof purposes === 'string' ? [purposes] : purposes;\n if (!prior || prior.error) {\n return {\n url: prior?.url ?? '',\n status: prior?.status ?? 0,\n headers: prior?.headers ?? {},\n body: prior?.body ?? null,\n error: prior?.error ?? 'fetch_brand_jwks step missing; cannot assert JWKS purpose',\n };\n }\n const keys = prior.body && typeof prior.body === 'object' ? (prior.body as { keys?: unknown }).keys : undefined;\n if (!Array.isArray(keys)) {\n return {\n url: prior.url,\n status: 0,\n headers: {},\n body: prior.body,\n error: 'JWKS body does not contain keys[]',\n };\n }\n const matching = keys.filter(key => {\n if (!key || typeof key !== 'object') return false;\n const rec = key as { adcp_use?: unknown; status?: unknown; revoked?: unknown };\n return (\n typeof rec.adcp_use === 'string' &&\n accepted.includes(rec.adcp_use) &&\n rec.status !== 'revoked' &&\n rec.revoked !== true\n );\n });\n if (matching.length === 0) {\n return {\n url: prior.url,\n status: 0,\n headers: {},\n body: prior.body,\n error: `JWKS contains no active key with adcp_use in {${accepted.join(', ')}}`,\n };\n }\n return {\n url: prior.url,\n status: 200,\n headers: prior.headers,\n body: { accepted_purposes: accepted, matching_key_count: matching.length },\n };\n}\n\nfunction findPriorProbe(priorStepResults: Map<string, StoryboardStepResult>): HttpProbeResult | undefined {\n // Fallback for runStoryboardStep where priorProbes isn't populated — reach\n // into the step result's response, which we set to the HttpProbeResult above.\n for (const r of priorStepResults.values()) {\n const resp = r.response as HttpProbeResult | undefined;\n if (resp && typeof resp === 'object' && 'url' in resp && 'status' in resp) return resp;\n }\n return undefined;\n}\n\n/**\n * Reduce the captured fetch traffic for an A2A step into the\n * `A2ATaskEnvelope` validations consume. The A2A SDK fires multiple\n * requests per call (`/.well-known/agent-card.json` discovery on\n * fresh clients, then a `message/send` POST), and a single dispatch\n * may also poll `tasks/get` afterwards. We pick the capture whose\n * REQUEST body declares `method: 'message/send'`; if no capture\n * declares the method we fall back to the last POST with a\n * JSON-RPC-shaped body. GET captures and non-JSON bodies are\n * skipped — `undefined` here surfaces as `not_applicable` in the\n * validator, which is more useful than a garbage envelope.\n *\n * Captured response bodies pass through `redactSecrets` before\n * landing in `ValidationContext.a2aEnvelope`. The bearer-token\n * regex in `wrapFetchWithCapture` only catches `Bearer <token>`\n * substrings; AdCP-style secret-shaped fields (`api_key`,\n * `client_secret`, `access_token`) inside a DataPart payload only\n * get redacted here. Failure paths thread the envelope into\n * `ValidationResult.actual.failures[].actual` which lands in\n * persisted compliance reports — redacting at capture parse time\n * keeps that surface consistent with `responseRecord.payload`,\n * which the runner already redacts on the success path.\n */\nfunction parseLastA2aMessageSendCapture(captures: readonly RawHttpCapture[]): A2ATaskEnvelope | undefined {\n let messageSendIdx = -1;\n let lastPostIdx = -1;\n for (let i = captures.length - 1; i >= 0; i--) {\n const cap = captures[i];\n if (!cap || cap.method !== 'POST') continue;\n if (lastPostIdx === -1) lastPostIdx = i;\n // The fetch wrapper doesn't capture the request body, so disambiguate\n // by parsing the response and checking for an A2A `Task` shape on\n // the result. `tasks/get` and `message/send` both return tasks, but\n // only `message/send` is the immediate response we want to assert\n // on for submitted-arm shape checks. When the runner adds polling,\n // we'd need request-body capture to distinguish reliably; for v0\n // the last POST is `message/send` because the SDK doesn't poll\n // synchronously after a Task with terminal state.\n if (messageSendIdx === -1) {\n const env = tryParseJsonRpcEnvelope(cap.body);\n if (env && env.result !== undefined && isTaskShape(env.result)) {\n messageSendIdx = i;\n }\n }\n }\n const idx = messageSendIdx !== -1 ? messageSendIdx : lastPostIdx;\n if (idx === -1) return undefined;\n const cap = captures[idx]!;\n const envelope = tryParseJsonRpcEnvelope(cap.body);\n if (!envelope) return undefined;\n // `envelope.result` mirrors the JSON-RPC envelope as observed —\n // present when the response carried a `result`, absent when it\n // carried `error`. The convenience `result` field at the top level\n // coalesces undefined to `null` so validators reading the typed\n // `A2ATaskEnvelope.result` get a stable shape; the inner\n // `envelope.result` keeps presence-of-key fidelity for validators\n // that need to distinguish \"result was null\" from \"result was\n // omitted\". Both paths run through `redactSecrets`.\n const redactedResult = envelope.result !== undefined ? redactSecrets(envelope.result) : null;\n return {\n result: redactedResult,\n envelope: {\n ...(envelope.jsonrpc !== undefined && { jsonrpc: envelope.jsonrpc }),\n ...(envelope.id !== undefined && { id: envelope.id }),\n ...(envelope.result !== undefined && { result: redactedResult }),\n ...(envelope.error !== undefined && { error: redactSecrets(envelope.error) }),\n },\n http_status: cap.status,\n };\n}\n\nfunction tryParseJsonRpcEnvelope(\n body: string\n): { jsonrpc?: unknown; id?: unknown; result?: unknown; error?: unknown } | undefined {\n let parsed: unknown;\n try {\n parsed = JSON.parse(body);\n } catch {\n return undefined;\n }\n if (parsed == null || typeof parsed !== 'object' || Array.isArray(parsed)) return undefined;\n const envelope = parsed as { jsonrpc?: unknown; id?: unknown; result?: unknown; error?: unknown };\n if (envelope.jsonrpc !== '2.0') return undefined;\n if (envelope.result === undefined && envelope.error === undefined) return undefined;\n return envelope;\n}\n\nfunction isTaskShape(result: unknown): boolean {\n return (\n result != null &&\n typeof result === 'object' &&\n !Array.isArray(result) &&\n (result as { kind?: unknown }).kind === 'task'\n );\n}\n\n// ────────────────────────────────────────────────────────────\n// Phase / step skip predicates\n// ────────────────────────────────────────────────────────────\n\n/**\n * True when the phase contains an OAuth-metadata probe step\n * (`protected_resource_metadata` or `oauth_auth_server_metadata`). Used\n * to pre-emptively trigger the existing `phaseAbsent` cascade when the\n * agent's capabilities never advertised OAuth in the first place, so we\n * don't burn step failures probing a well-known path the agent doesn't\n * claim. Spec: adcp-client#1702.\n */\nfunction phaseContainsOauthMetadataProbe(phase: StoryboardPhase): boolean {\n return phase.steps.some(s => s.task === 'protected_resource_metadata' || s.task === 'oauth_auth_server_metadata');\n}\n\n/**\n * True when the agent's `get_adcp_capabilities` response declares an\n * OAuth issuer (today: `account.authorization_endpoint`). When the\n * profile or its capabilities aren't available — e.g. external\n * `_client` mode — we conservatively return `true` so the runner falls\n * through to the existing reactive cascade (`phaseAbsent` flips on a\n * 404 from the PRM probe). That keeps backward compatibility for\n * callers that haven't threaded a profile through. Spec: adcp-client#1702.\n */\nfunction agentAdvertisesOauth(profile: AgentProfile | undefined): boolean {\n const rawCaps = profile?.raw_capabilities;\n if (rawCaps === undefined) return true;\n const oauthSupported = resolveCapabilityPath(rawCaps, 'oauth.supported');\n if (oauthSupported === true) return true;\n if (oauthSupported === false) return false;\n const endpoint = resolveCapabilityPath(rawCaps, 'account.authorization_endpoint');\n return typeof endpoint === 'string' && endpoint.length > 0;\n}\n\n/**\n * Evaluate a phase's `skip_if` expression against the runtime options. Only\n * a tiny grammar is supported today; unknown expressions fail closed (phase runs).\n */\nfunction shouldSkipPhase(phase: StoryboardPhase, options: StoryboardRunOptions): boolean {\n const expr = phase.skip_if?.trim();\n if (!expr) return false;\n const match = /^(!?)test_kit\\.([a-zA-Z0-9_.]+)$/.exec(expr);\n if (!match) return false; // unknown grammar → run the phase\n const negated = match[1] === '!';\n const path = match[2]!.split('.');\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- dynamic test-kit shape\n let value: any = (options as { test_kit?: unknown }).test_kit;\n for (const segment of path) {\n if (value == null || typeof value !== 'object') {\n value = undefined;\n break;\n }\n value = (value as Record<string, unknown>)[segment];\n }\n const truthy = Boolean(value);\n return negated ? !truthy : truthy;\n}\n\n/**\n * Resolve a `$test_kit.<path>` task reference against the runtime options.\n * Falls back to `step.task_default`. Returns undefined when neither yields a string.\n */\nfunction resolveTaskName(step: StoryboardStep, options: StoryboardRunOptions): string | undefined {\n if (!step.task.startsWith('$test_kit.')) return step.task;\n const path = step.task.slice('$test_kit.'.length).split('.');\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- dynamic test-kit shape\n let value: any = options.test_kit;\n for (const segment of path) {\n if (value == null || typeof value !== 'object') {\n value = undefined;\n break;\n }\n value = (value as Record<string, unknown>)[segment];\n }\n if (typeof value === 'string' && value.length > 0) return value;\n return step.task_default;\n}\n\n/**\n * Build SDK-equivalent default headers for raw MCP probe tests. Runtime raw\n * probe dispatch is reserved for explicit per-step `auth` overrides; ordinary\n * missing-field vectors stay on the SDK path so Streamable HTTP sessions are\n * initialized before the malformed tool call.\n */\nfunction defaultAuthHeadersForRawProbe(options: StoryboardRunOptions): Record<string, string> | undefined {\n const headers: Record<string, string> = {};\n if (options.auth) {\n if (options.auth.type === 'bearer') {\n if (!options.auth.token) throw new Error('options.auth.token is required for bearer auth');\n assertSafeAuthHeaderPart(options.auth.token, 'options.auth.token');\n headers.authorization = `Bearer ${options.auth.token}`;\n } else if (options.auth.type === 'basic') {\n headers.authorization = encodeBasicAuthHeader(options.auth, 'options.auth');\n } else {\n return undefined;\n }\n }\n // Match SDK header casing so a raw-probe request is byte-indistinguishable\n // from an SDK-shaped one at the transport boundary. HTTP is case-insensitive;\n // this is purely for parity with capture/diff tooling.\n if (options.test_session_id) {\n assertSafeAuthHeaderPart(options.test_session_id, 'options.test_session_id');\n headers['X-Test-Session-ID'] = options.test_session_id;\n }\n if (options.userAgent) {\n assertSafeAuthHeaderPart(options.userAgent, 'options.userAgent');\n headers['User-Agent'] = options.userAgent;\n }\n return headers;\n}\n\n/**\n * Translate a `StepAuthDirective` into HTTP headers for the raw MCP probe.\n * - `'none'` returns an empty object and the probe sends no `Authorization`.\n * - `api_key` / `oauth_bearer` resolve the value from `value`, `from_test_kit`,\n * or `value_strategy` — in that order — and produce `Authorization: Bearer <value>`.\n * - `basic` resolves explicit credentials, `from_test_kit`, or\n * `value_strategy: random_invalid` and produces `Authorization: Basic <base64>`.\n */\nfunction authHeadersForStep(directive: StepAuthDirective, options: StoryboardRunOptions): Record<string, string> {\n if (directive === 'none') return {};\n if (directive.type === 'basic') return basicAuthHeadersForStep(directive, options);\n\n let value: string | undefined;\n if ('value' in directive && directive.value) {\n value = directive.value;\n } else if ('from_test_kit' in directive && directive.from_test_kit) {\n value = options.test_kit?.auth?.api_key;\n if (!value) {\n // adcp#6735 — hard-fail instead of silently degrading to an\n // unauthenticated probe: a probe with no credential cannot test a\n // credential-keyed contract, and the resulting 401 grades a\n // conformant agent FAIL.\n throw new Error(\n 'step declares auth.from_test_kit but no test kit with auth.api_key is configured — ' +\n 'declare prerequisites.test_kit and authorize its cache with options.complianceDir ' +\n '(CLI: --compliance-dir), ' +\n 'or pass options.test_kit (CLI: --test-kit).'\n );\n }\n } else if ('value_strategy' in directive && directive.value_strategy) {\n if (directive.value_strategy === 'random_invalid') value = generateRandomInvalidApiKey();\n else if (directive.value_strategy === 'random_invalid_jwt') value = generateRandomInvalidJwt();\n }\n if (!value) return {};\n // Reject CR/LF/NUL and non-printable ASCII — a test-kit key with stray\n // whitespace would otherwise crash undici's header validator and the raw\n // exception (containing the secret) lands in the serialized compliance\n // report. Fail loudly with a non-echoing error instead.\n if (/[\\r\\n\\x00]|[^\\x20-\\x7E]/.test(value)) {\n throw new Error('test_kit.auth.api_key contains invalid characters (control chars or non-printable ASCII)');\n }\n return { authorization: `Bearer ${value}` };\n}\n\nfunction basicAuthHeadersForStep(\n directive: Extract<StepAuthDirective, { type: 'basic' }>,\n options: StoryboardRunOptions\n): Record<string, string> {\n if (directive.value_strategy) {\n if (directive.value_strategy !== 'random_invalid') return {};\n return {\n authorization: encodeBasicAuthHeader(\n {\n username: generateRandomInvalidApiKey(),\n password: generateRandomInvalidApiKey(),\n },\n 'step.auth.basic'\n ),\n };\n }\n\n const usesTestKit =\n directive.from_test_kit === true ||\n (typeof directive.from_test_kit === 'string' && directive.from_test_kit.length > 0);\n const source = usesTestKit\n ? resolveStepBasicFromTestKit(directive.from_test_kit!, options)\n : directive.basic !== undefined\n ? directive.basic\n : directive;\n if (source === undefined) {\n if (usesTestKit) {\n // adcp#6735 — same hard-fail as the api_key arm: never send an\n // unauthenticated probe in place of a declared kit credential.\n throw new Error(\n 'step declares auth.from_test_kit (basic) but no test kit with matching credentials is configured — ' +\n 'declare prerequisites.test_kit and authorize its cache with options.complianceDir ' +\n '(CLI: --compliance-dir), ' +\n 'or pass options.test_kit (CLI: --test-kit).'\n );\n }\n return {};\n }\n return { authorization: encodeBasicAuthHeader(source, 'step.auth.basic') };\n}\n\nfunction resolveStepBasicFromTestKit(\n fromTestKit: string | boolean,\n options: StoryboardRunOptions\n): BasicCredentialInput | undefined {\n const path = typeof fromTestKit === 'string' && fromTestKit.length > 0 ? fromTestKit : 'auth.basic';\n const segments = path.split('.');\n let value: unknown = options.test_kit;\n for (const segment of segments) {\n if (value == null || typeof value !== 'object') return undefined;\n value = (value as Record<string, unknown>)[segment];\n }\n if (value === undefined || value === null) return undefined;\n return value as BasicCredentialInput;\n}\n\ninterface BasicCredentialInput {\n username?: unknown;\n password?: unknown;\n credentials?: unknown;\n}\n\nfunction encodeBasicAuthHeader(input: BasicCredentialInput, fieldPrefix: string): string {\n const userpass = normalizeBasicCredentials(input, fieldPrefix);\n return `Basic ${Buffer.from(userpass).toString('base64')}`;\n}\n\nfunction normalizeBasicCredentials(input: BasicCredentialInput, fieldPrefix: string): string {\n const hasCredentials = input.credentials !== undefined;\n const hasUserPass = input.username !== undefined || input.password !== undefined;\n if (hasCredentials && hasUserPass) {\n throw new Error(`${fieldPrefix} must use either credentials or username/password, not both`);\n }\n if (hasCredentials) {\n if (typeof input.credentials !== 'string' || input.credentials.length === 0) {\n throw new Error(`${fieldPrefix}.credentials must be a non-empty string`);\n }\n assertSafeAuthHeaderPart(input.credentials, `${fieldPrefix}.credentials`);\n const colonIndex = input.credentials.indexOf(':');\n if (colonIndex <= 0) {\n throw new Error(`${fieldPrefix}.credentials must be in unencoded username:password form`);\n }\n return input.credentials;\n }\n if (typeof input.username !== 'string' || input.username.length === 0) {\n throw new Error(`${fieldPrefix}.username must be a non-empty string`);\n }\n if (typeof input.password !== 'string') {\n throw new Error(`${fieldPrefix}.password must be a string`);\n }\n if (input.username.includes(':')) {\n throw new Error(`${fieldPrefix}.username must not contain colon (RFC 7617)`);\n }\n assertSafeAuthHeaderPart(input.username, `${fieldPrefix}.username`);\n assertSafeAuthHeaderPart(input.password, `${fieldPrefix}.password`);\n return `${input.username}:${input.password}`;\n}\n\n// Reject control chars and non-printable ASCII. Without this, undici's header\n// validator throws a message that includes the offending value — landing\n// secrets in logs. Validate raw inputs before encoding so the field name in\n// the error identifies which input to fix without echoing the value.\nfunction assertSafeAuthHeaderPart(value: string, field: string): void {\n if (/[\\r\\n\\x00]|[^\\x20-\\x7E]/.test(value)) {\n throw new Error(`${field} contains invalid characters (control chars or non-printable ASCII)`);\n }\n}\n\n/**\n * Evaluate a step's `contributes_if` expression. Grammar:\n * - `\"prior_step.<step_id>.passed\"` — prior step passed\n * Unknown expressions → false (contribution does NOT fire).\n */\nfunction evalContributesIf(expr: string | undefined, priorStepResults: Map<string, StoryboardStepResult>): boolean {\n if (!expr) return true;\n const match = /^prior_step\\.([A-Za-z0-9_]+)\\.passed$/.exec(expr.trim());\n if (!match) return false;\n const stepId = match[1]!;\n const prior = priorStepResults.get(stepId);\n return !!prior?.passed && !prior.skipped;\n}\n\n// ────────────────────────────────────────────────────────────\n// Brand/account invariant\n// ────────────────────────────────────────────────────────────\n\n/**\n * Force every outgoing request onto the storyboard's brand context.\n *\n * Sellers that scope session state by brand (spec-required for multi-tenant\n * isolation) derive a session key from `brand.domain` — or, when brand is\n * absent, from `account.brand.domain`. If any step in a run targets a\n * different brand, it lands in a different session and can't see state\n * created by earlier steps.\n *\n * This helper runs after builder / sample_request resolution and writes the\n * run-scoped brand into the addressing forms the tool's schema allows:\n *\n * - Top-level `brand` — only when the tool's request schema declares it\n * (e.g. `get_products`, `create_media_buy`, signal tools). Governance\n * tools like `sync_plans` do not declare `brand` at the request root\n * (brand belongs inside each `Plan` object) — injecting it would fail\n * the framework's strict AJV validation (#940).\n * - `account.brand` — merged into an existing `account` object only when\n * it uses the natural-key variant (`{brand, operator, sandbox?}`). The\n * `{account_id}` variant is closed (`additionalProperties: false`); merging\n * `brand` into it produces a payload that matches neither `oneOf` branch\n * and is rejected by AJV strict request validation. Detect the natural-key\n * variant by looking for an existing `brand` or `operator` key.\n * - Synthetic `account` — constructed only when the request has no\n * `account` AND the tool's schema declares `account` (e.g. `get_media_buys`,\n * `list_creatives`). Tools like `sync_plans` that declare neither\n * `brand` nor `account` at the root are left unchanged.\n *\n * When `taskName` is omitted or the schema is unavailable (not synced yet),\n * the function fails open and injects as before. Schema checks use raw JSON\n * reads, not AJV internals.\n */\nexport function applyBrandInvariant(\n request: Record<string, unknown>,\n options: StoryboardRunOptions,\n taskName?: string,\n stepFlags?: { omit_account?: boolean }\n): Record<string, unknown> {\n // Only force the invariant when the caller has actually supplied a brand.\n // Storyboards that don't exercise brand-scoped tools (e.g. security\n // probes) legitimately run without one and should pass through unchanged.\n if (!options.brand && !options.brand_manifest) return request;\n const brand = resolveBrand(options);\n\n // Gate brand/account injection on the tool's request schema. Tools that\n // declare `additionalProperties: false` without listing the field will fail\n // the framework's strict AJV validator if we inject it (#940). Fails open\n // when taskName is absent or the schema isn't available.\n const topBrandOk = !taskName || schemaAllowsTopLevelField(taskName, 'brand');\n const topAccountOk = !taskName || schemaAllowsTopLevelField(taskName, 'account');\n\n const result: Record<string, unknown> = { ...request };\n if (topBrandOk) result.brand = brand;\n\n // When a storyboard step sets `omit_account: true` it is deliberately\n // testing the seller's missing-account rejection path. Skip all account\n // synthesis — both the natural-key-merge branch (existing account on the\n // request) and the synthetic-construction branch (no account on the\n // request) — so the request reaches the wire exactly as authored.\n if (stepFlags?.omit_account) return result;\n\n if ('account' in request) {\n // Caller sent an account — merge brand in only when it's a plain object\n // using AccountReference's natural-key variant (`{brand, operator, sandbox?}`).\n // The `{account_id}` variant is a closed object; merging `brand` would\n // produce a payload that matches neither `oneOf` branch under strict AJV.\n // Leave non-object values (null, array) and `{account_id}`-only payloads\n // alone so intentionally narrow or malformed requests aren't silently\n // \"corrected.\"\n const existingAccount = request.account;\n if (existingAccount && typeof existingAccount === 'object' && !Array.isArray(existingAccount)) {\n const acct = existingAccount as Record<string, unknown>;\n const isNaturalKeyVariant = 'brand' in acct || 'operator' in acct;\n if (isNaturalKeyVariant) {\n const merged: Record<string, unknown> = { ...acct, brand };\n // The natural-key arm of AccountReference requires `operator` (per\n // schemas/cache/{version}/core/account-ref.json). A fixture or earlier\n // context-extraction step that produced `{brand, sandbox}` without\n // operator would otherwise be passed through and rejected by a\n // strict-validating seller. Default operator to brand.domain — same\n // convention `resolveAccount` uses for synthetic refs.\n if (typeof merged.operator !== 'string' && typeof brand.domain === 'string') {\n merged.operator = brand.domain;\n }\n result.account = merged;\n }\n }\n } else if (topAccountOk && taskName !== 'list_accounts') {\n // No account on the request — construct one so tools whose schema\n // declares `account` but not top-level `brand` (e.g. get_media_buys,\n // list_creatives) still carry the run-scoped brand on the wire.\n // list_accounts is deliberately exempt: without an authored account it\n // enumerates the caller's visible accounts. Synthesizing the runner's\n // default natural key would silently narrow pagination and discovery\n // storyboards to one brand.\n result.account = resolveAccount(options);\n }\n return result;\n}\n\n/**\n * Inject `ext.adcp.disable_sandbox: true` into the outgoing request when the\n * operator passed `--no-sandbox` (or `disable_sandbox: true` programmatically).\n * Issue #841.\n *\n * `ext` is the spec-blessed channel for read-by-agent extensions and is\n * accepted-without-error on every tool, so the schema check is conservative\n * — only inject when the tool's request schema permits a top-level `ext`\n * field. Tools with `additionalProperties: false` that don't list `ext`\n * would fail strict AJV validation otherwise.\n *\n * Merging strategy: preserve any existing `ext.adcp` block the storyboard\n * fixture or builder authored (e.g. vendor extensions a future scenario\n * might exercise). The injected `disable_sandbox` flag rides alongside\n * those rather than overwriting them.\n */\nexport function applyDisableSandboxHint(request: Record<string, unknown>, taskName?: string): Record<string, unknown> {\n if (taskName && !schemaAllowsTopLevelField(taskName, 'ext')) return request;\n\n const existingExt = request.ext;\n const existingExtObj =\n existingExt != null && typeof existingExt === 'object' && !Array.isArray(existingExt)\n ? (existingExt as Record<string, unknown>)\n : {};\n\n const existingAdcpExt = existingExtObj.adcp;\n const existingAdcpExtObj =\n existingAdcpExt != null && typeof existingAdcpExt === 'object' && !Array.isArray(existingAdcpExt)\n ? (existingAdcpExt as Record<string, unknown>)\n : {};\n\n return {\n ...request,\n ext: {\n ...existingExtObj,\n adcp: {\n ...existingAdcpExtObj,\n disable_sandbox: true,\n },\n },\n };\n}\n\n/**\n * Mint an `idempotency_key` for mutating storyboard requests when one wasn't\n * supplied. Storyboard `sample_request` blocks generally omit it; the runner\n * fills it in so the server's required-field check doesn't short-circuit the\n * handler under test, including on `expect_error` steps that name specific\n * failure modes (GOVERNANCE_DENIED, UNAUTHORIZED, brand_mismatch, etc.).\n *\n * Skipped when:\n * - `step.omit_idempotency_key === true` — the scenario is explicitly\n * exercising the server's missing-key rejection path.\n * - the task isn't mutating per {@link MUTATING_TASKS}.\n * - the request already carries a key — typically a\n * `$generate:uuid_v4#alias` the context injector has resolved to a\n * concrete UUID for replay scenarios, or a BYOK key supplied inline.\n */\nexport function applyIdempotencyInvariant(\n request: Record<string, unknown>,\n taskName: string,\n step: StoryboardStep\n): Record<string, unknown> {\n if (step.omit_idempotency_key === true) return request;\n if (!isMutatingTask(taskName)) return request;\n if (typeof request.idempotency_key === 'string' && request.idempotency_key.length > 0) return request;\n return { ...request, idempotency_key: generateIdempotencyKey() };\n}\n\n// ────────────────────────────────────────────────────────────\n// Helpers\n// ────────────────────────────────────────────────────────────\n\nconst MAX_ERROR_LENGTH = 2000;\n\nfunction truncateError(error: string | undefined): string | undefined {\n if (!error) return undefined;\n return error.length > MAX_ERROR_LENGTH ? error.slice(0, MAX_ERROR_LENGTH) + '...[truncated]' : error;\n}\n\ninterface FlatStep {\n step: StoryboardStep;\n phaseId: string;\n globalIndex: number;\n}\n\n/**\n * Pre-fetch `query_upstream_traffic` responses for every unique\n * `since_timestamp` window declared by `upstream_traffic` validations on\n * THIS step. The dispatcher is synchronous; the controller call is async\n * — running it once here keeps the validator simple and avoids redundant\n * controller traffic when a step has multiple upstream_traffic checks\n * sharing a window.\n *\n * Returns `undefined` when the step declares no upstream_traffic checks\n * (no work to do), or a context with `advertised: false` when the\n * controller does not advertise `query_upstream_traffic` (every check\n * grades not_applicable per the spec's adopter-opt-in rule).\n */\nasync function prefetchUpstreamTraffic(\n stepId: string,\n resolvedValidations: StoryboardValidation[],\n client: unknown,\n options: StoryboardRunOptions,\n runState: ExecutionState,\n requestStartIso: string,\n requestPayload: unknown,\n sampleRequest: Record<string, unknown> | undefined\n): Promise<UpstreamTrafficValidationContext | undefined> {\n const upstreamChecks = resolvedValidations.filter(v => v.check === 'upstream_traffic');\n if (upstreamChecks.length === 0) return undefined;\n if (upstreamChecks.some(check => (check.identifier_paths ?? []).some(path => validatePortableIdentifierPath(path)))) {\n return undefined;\n }\n\n const advertised =\n options._controllerCapabilities?.detected === true &&\n options._controllerCapabilities.scenarios.includes('query_upstream_traffic' as ControllerScenario);\n if (!advertised) {\n return {\n advertised: false,\n queries: new Map(),\n thisStepSince: requestStartIso,\n };\n }\n\n // Resolve `since: prior_step_id` references against runState's\n // recorded request timestamps. Validations that name an unknown step\n // fall back to this step's own start (matching default behavior).\n const priorStepSinceMap = new Map<string, string>();\n const unresolvedSinceRefs = new Set<string>();\n const sinceTimestamps = new Set<string>([requestStartIso]);\n for (const v of upstreamChecks) {\n if (!v.since) continue;\n const priorStart = runState.stepRequestStarts?.get(v.since);\n if (priorStart) {\n priorStepSinceMap.set(v.since, priorStart);\n sinceTimestamps.add(priorStart);\n } else {\n // Spec PR adcp#3816: a `since: prior_step_id` that doesn't resolve\n // is a storyboard authoring bug — silently masking it as \"use this\n // step's start\" lets misspelled refs pass vacuously. Track and\n // surface as a typed failure on the validation result.\n priorStepSinceMap.set(v.since, requestStartIso);\n unresolvedSinceRefs.add(v.since);\n }\n }\n\n const queries = new Map<string, UpstreamTrafficQueryResult>();\n const identifierDigestCollection = collectUpstreamIdentifierDigests(upstreamChecks, requestPayload, sampleRequest);\n const identifierDigestByValue = identifierDigestCollection.digests;\n const identifier_value_digests = [...identifierDigestByValue.values()];\n const requiresRawAttestation = upstreamChecks.some(\n check => check.attestation_mode_required === 'raw' || (check.payload_must_contain?.length ?? 0) > 0\n );\n const prefersRawAttestation = upstreamChecks.some(check => check.preferred_attestation_mode === 'raw');\n const prefersDigestAttestation = upstreamChecks.some(check => check.preferred_attestation_mode === 'digest');\n const requestedAttestationMode: 'raw' | 'digest' =\n requiresRawAttestation || prefersRawAttestation\n ? 'raw'\n : prefersDigestAttestation || identifier_value_digests.length > 0\n ? 'digest'\n : 'raw';\n for (const sinceTs of sinceTimestamps) {\n // Per spec PR adcp#3816: runners SHOULD subtract a clock-skew tolerance\n // (50ms minimum, 250ms recommended) before sending the bound to the\n // controller, so a recorded call timestamped microseconds before the\n // runner's clock measurement isn't silently excluded. We use 250ms (the\n // spec's recommended value).\n const adjustedSince = new Date(new Date(sinceTs).getTime() - 250).toISOString();\n const params = {\n since_timestamp: adjustedSince,\n limit: 100,\n attestation_mode: requestedAttestationMode,\n ...(identifier_value_digests.length > 0 ? { identifier_value_digests } : {}),\n };\n const requestRecord: RunnerRequestRecord = {\n transport: options.protocol === 'a2a' ? 'a2a' : 'mcp',\n operation: 'comply_test_controller',\n payload: redactSecrets({ scenario: 'query_upstream_traffic', params }),\n ...(runState.agentUrl ? { url: redactOAuthUrlForOutput(runState.agentUrl) } : {}),\n };\n const startMs = Date.now();\n let payload: UpstreamTrafficSuccess | { error: string; error_kind?: string };\n try {\n const result = await queryUpstreamTraffic(client as TestClient, params, options);\n if ('success' in result && result.success === true) {\n payload = result;\n } else {\n const errResult = result as { error?: string; error_detail?: string; context?: unknown; ext?: unknown };\n const message = errResult.error_detail\n ? `${errResult.error ?? 'controller_error'}: ${errResult.error_detail}`\n : (errResult.error ?? 'controller returned a non-success response');\n const errorKind = extractControllerErrorKind(errResult);\n payload = { error: message, ...(errorKind ? { error_kind: errorKind } : {}) };\n }\n } catch (err) {\n payload = { error: err instanceof Error ? err.message : String(err) };\n }\n const responseRecord: RunnerResponseRecord = {\n transport: options.protocol === 'a2a' ? 'a2a' : 'mcp',\n payload: redactSecrets(payload),\n duration_ms: Date.now() - startMs,\n };\n queries.set(sinceTs, { request: requestRecord, response: responseRecord, payload });\n }\n\n return {\n advertised: true,\n queries,\n thisStepSince: requestStartIso,\n ...(identifierDigestByValue.size > 0 ? { identifierDigestByValue } : {}),\n ...(identifierDigestCollection.clipped > 0\n ? {\n identifierDigestLimitExceeded: {\n limit: identifierDigestCollection.limit,\n clipped: identifierDigestCollection.clipped,\n },\n }\n : {}),\n ...(priorStepSinceMap.size > 0 ? { priorStepSinceMap } : {}),\n ...(unresolvedSinceRefs.size > 0 ? { unresolvedSinceRefs } : {}),\n };\n}\n\nfunction extractControllerErrorKind(result: { context?: unknown; ext?: unknown }): string | undefined {\n return readErrorKind(result.context) ?? readErrorKind(result.ext);\n}\n\nfunction readErrorKind(value: unknown): string | undefined {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return undefined;\n const record = value as Record<string, unknown>;\n if (typeof record.error_kind === 'string' && record.error_kind.length > 0) return record.error_kind;\n if (typeof record.kind === 'string' && record.kind.length > 0) return record.kind;\n return undefined;\n}\n\nfunction collectUpstreamIdentifierDigests(\n validations: StoryboardValidation[],\n requestPayload: unknown,\n sampleRequest: Record<string, unknown> | undefined\n): { digests: Map<string, string>; limit: number; clipped: number } {\n const digests = new Map<string, string>();\n let clipped = 0;\n const sample =\n requestPayload && typeof requestPayload === 'object' && !Array.isArray(requestPayload)\n ? (requestPayload as Record<string, unknown>)\n : sampleRequest;\n if (!sample) return { digests, limit: IDENTIFIER_DIGEST_LIMIT, clipped };\n const clippedVectors = new Set<string>();\n for (const validation of validations) {\n for (const path of validation.identifier_paths ?? []) {\n const vectors = resolvePortableIdentifierPathAll(sample, path);\n for (const vector of vectors) {\n if (typeof vector !== 'string') continue;\n if (digests.has(vector)) continue;\n if (digests.size >= IDENTIFIER_DIGEST_LIMIT) {\n if (!clippedVectors.has(vector)) {\n clippedVectors.add(vector);\n clipped++;\n }\n continue;\n }\n digests.set(vector, sha256Hex(vector));\n }\n }\n }\n return { digests, limit: IDENTIFIER_DIGEST_LIMIT, clipped };\n}\n\nfunction sha256Hex(value: string): string {\n return createHash('sha256').update(value, 'utf8').digest('hex');\n}\n\n/**\n * Find any \"$context.xxx\" strings that weren't resolved during injection.\n * Returns one entry per occurrence with both the bare key (for legacy\n * detail-string formatting) and the full token (for the\n * `unresolved_substitution` validation result's `expected` field, per\n * runner-output-contract.yaml v2.0.0).\n */\nfunction findUnresolvedContextVars(obj: unknown): Array<{ key: string; token: string }> {\n const vars: Array<{ key: string; token: string }> = [];\n const walk = (val: unknown) => {\n if (typeof val === 'string') {\n const match = val.match(/^\\$context\\.(\\w+)$/);\n if (match?.[1]) vars.push({ key: match[1], token: val });\n } else if (Array.isArray(val)) {\n val.forEach(walk);\n } else if (val !== null && typeof val === 'object') {\n Object.values(val as Record<string, unknown>).forEach(walk);\n }\n };\n walk(obj);\n return vars;\n}\n\nconst UNRESOLVED_RUNNER_TOKEN_RE =\n /\\{\\{(?:runner\\.(?:webhook_url:[A-Za-z0-9_]+|webhook_base)|prior_step\\.[A-Za-z0-9_]+\\.operation_id)\\}\\}/g;\n\nfunction findUnresolvedRunnerTokens(obj: unknown): string[] {\n const vars: string[] = [];\n const walk = (val: unknown) => {\n if (typeof val === 'string') {\n const matches = val.match(UNRESOLVED_RUNNER_TOKEN_RE);\n if (matches) vars.push(...matches);\n } else if (Array.isArray(val)) {\n val.forEach(walk);\n } else if (val !== null && typeof val === 'object') {\n Object.values(val as Record<string, unknown>).forEach(walk);\n }\n };\n walk(obj);\n return [...new Set(vars)];\n}\n\nfunction hasUnresolvedPriorStepToken(tokens: string[]): boolean {\n return tokens.some(token => token.startsWith('{{prior_step.'));\n}\n\nfunction flattenSteps(storyboard: Storyboard): FlatStep[] {\n const result: FlatStep[] = [];\n let index = 0;\n for (const phase of storyboard.phases) {\n for (const step of phase.steps) {\n result.push({ step, phaseId: phase.id, globalIndex: index++ });\n }\n }\n return result;\n}\n\nfunction getNextStepPreview(\n currentStepId: string,\n allSteps: FlatStep[],\n context: StoryboardContext,\n runnerVars?: RunnerVariables\n): StoryboardStepPreview | undefined {\n const currentIdx = allSteps.findIndex(s => s.step.id === currentStepId);\n if (currentIdx === -1 || currentIdx >= allSteps.length - 1) return undefined;\n\n const nextFlat = allSteps[currentIdx + 1];\n if (!nextFlat) return undefined;\n const nextStep = nextFlat.step;\n\n // Inject context into the next step's sample_request for preview\n const previewRequest = nextStep.sample_request\n ? injectContext({ ...nextStep.sample_request }, context, runnerVars)\n : undefined;\n\n return {\n step_id: nextStep.id,\n phase_id: nextFlat.phaseId,\n title: nextStep.title,\n task: nextStep.task,\n narrative: nextStep.narrative,\n expected: nextStep.expected,\n sample_request: previewRequest,\n };\n}\n\n// ────────────────────────────────────────────────────────────\n// Multi-instance dispatch\n// ────────────────────────────────────────────────────────────\n\ninterface StepAssignment {\n client: TestClient;\n agentUrl: string;\n /** 0-based index into the agent URL list */\n instanceIndex: number;\n /** Profile discovered for the agent selected to execute this step. */\n profile?: AgentProfile;\n}\n\ninterface Dispatcher {\n nextFor(step: StoryboardStep): StepAssignment;\n}\n\n/**\n * Build a dispatcher that picks an (agent URL, client) pair per step.\n *\n * Single-URL runs always return the same assignment. Multi-URL runs use\n * round-robin — step N hits `clients[(N + startOffset) % N_urls]`.\n * Deterministic and reproducible for bug reports.\n *\n * `startOffset` lets the `multi-pass` strategy run the same storyboard with\n * the dispatcher starting at a different replica each pass so write→read\n * pairs separated by an even number of stateful steps get exercised\n * cross-replica on at least one pass.\n */\nfunction createDispatcher(\n agentUrls: string[],\n clients: TestClient[],\n _strategy: 'round-robin',\n startOffset = 0,\n profile?: AgentProfile\n): Dispatcher {\n let counter = startOffset;\n return {\n nextFor(_step: StoryboardStep): StepAssignment {\n const idx = ((counter % agentUrls.length) + agentUrls.length) % agentUrls.length;\n counter++;\n return {\n client: clients[idx]!,\n agentUrl: agentUrls[idx]!,\n instanceIndex: idx,\n profile,\n };\n },\n };\n}\n\n/**\n * Per-specialism routing dispatcher (#1066). Picks the agent that claims\n * each step's tool's protocol via the routing context. Throws\n * `RoutingError` mid-step when no route can be determined; the runner's\n * step loop catches and converts to a synthetic `unroutable_task` skip.\n *\n * `instanceIndex` reflects the agent key's insertion order in the map —\n * deterministic and matches the index used for downstream `agent_urls`\n * exposure on the storyboard result.\n */\nfunction createRoutingDispatcher(\n ctx: AgentRoutingContext,\n options: StoryboardRunOptions,\n agents: Record<string, AgentEntry>\n): Dispatcher {\n const keyOrder = Object.keys(agents);\n const keyToIndex = new Map(keyOrder.map((k, i) => [k, i]));\n return {\n nextFor(step: StoryboardStep): StepAssignment {\n const key = resolveAgentForStep(step, options, ctx);\n const client = ctx.clients.get(key);\n const profile = ctx.profiles.get(key);\n const url = agents[key]?.url;\n if (!client || !url) {\n throw new RoutingError(\n `Internal: resolved agent key \"${key}\" has no client/url. ` +\n `This indicates a bug in routing-context construction.`,\n step.task,\n `key ${key} unbound`\n );\n }\n return {\n client,\n agentUrl: url,\n instanceIndex: keyToIndex.get(key) ?? 0,\n profile,\n };\n },\n };\n}\n\nconst HORIZONTAL_SCALING_DOCS_URL =\n 'https://adcontextprotocol.org/docs/building/validate-your-agent#verifying-cross-instance-state';\nconst NOT_FOUND_PATTERN = /not[_ ]found|not-found|\\b404\\b/i;\n\n// Agent-controlled text (error messages, response payloads) lands in terminal\n// output. Strip C0/C1 control chars so a hostile agent returning\n// `\\x1b[2J\\x1b[H` (clear screen) or `\\r` (overwrite prior line) can't mangle\n// CI logs or forge terminal state. Tabs and newlines are preserved.\n// The cap bounds JSON-stringification cost if an agent returns an enormous\n// or deeply-nested response body.\nconst MAX_ATTRIBUTION_SNIPPET = 512;\nfunction sanitizeAgentText(text: string): string {\n return text.replace(/[\\x00-\\x08\\x0b-\\x1f\\x7f-\\x9f]/g, '').slice(0, MAX_ATTRIBUTION_SNIPPET);\n}\n\n/**\n * Detect the canonical horizontal-scaling failure signature on a step result.\n *\n * Reads structured fields the runner commonly populates (error string,\n * nested response.error/code/message/status) rather than regex-matching the\n * full stringified response — structured lookup is cheaper, resistant to an\n * agent smuggling \"NOT_FOUND\" into an unrelated field to falsely trigger the\n * canonical wording, and doesn't blow up on circular or oversized payloads.\n */\nfunction isNotFoundSignature(result: StoryboardStepResult): boolean {\n const candidates: Array<unknown> = [result.error];\n const resp = result.response as Record<string, unknown> | null | undefined;\n if (resp && typeof resp === 'object' && !Array.isArray(resp)) {\n candidates.push(resp.error, resp.code, resp.message, resp.status, resp.status_code);\n }\n for (const c of candidates) {\n if (typeof c === 'string' && NOT_FOUND_PATTERN.test(c)) return true;\n if (typeof c === 'number' && c === 404) return true;\n }\n return false;\n}\n\n/**\n * Mutate a failed step result to include cross-instance attribution.\n *\n * In multi-instance mode any step failure is worth attributing because the\n * failure signature may not be NOT_FOUND — it can surface as 500, an empty\n * array, PERMISSION_DENIED, or stale status. Attribution always emits:\n * - which replica served this step and the immediate prior stateful write\n * - a replica→step map for pattern-matching in CI logs\n * - a single-replica repro command\n * When the signature matches the canonical horizontal-scaling case (prior\n * write on A, read fails on B with NOT_FOUND), the wording mirrors the\n * protocol docs verbatim so developers pattern-match the page they'll\n * eventually click through to.\n */\nfunction annotateMultiInstanceFailure(\n result: StoryboardStepResult,\n storyboard: Storyboard,\n priorResults: StoryboardStepResult[]\n): void {\n const currentInstance = result.agent_index;\n const currentUrl = result.agent_url;\n if (!currentInstance || !currentUrl) return;\n\n // Lookup stateful flag on step defs — needed to identify \"prior writes\".\n const stepDefs = new Map<string, StoryboardStep>();\n for (const phase of storyboard.phases) {\n for (const s of phase.steps) stepDefs.set(s.id, s);\n }\n\n const priorCrossInstanceWrite = [...priorResults].reverse().find(prior => {\n if (!prior.passed || prior.skipped) return false;\n if (!prior.agent_index || prior.agent_index === currentInstance) return false;\n return stepDefs.get(prior.step_id)?.stateful === true;\n });\n\n const replicaMap = priorResults\n .filter(r => !r.skipped && r.agent_index)\n .map(r => ` [#${r.agent_index}] ${r.step_id} — ${r.passed ? 'ok' : 'FAIL'}`)\n .join('\\n');\n\n const lines: string[] = [];\n\n if (priorCrossInstanceWrite) {\n const writerIdx = priorCrossInstanceWrite.agent_index;\n const writerUrl = priorCrossInstanceWrite.agent_url;\n // Wording deliberately mirrors the failure example in the protocol docs\n // (\"<write> on replica A returned …; <read> on replica B returned NOT_FOUND;\n // → Brand-scoped state is not shared across replicas.\") so CI readers\n // pattern-match the page they'll click through to.\n lines.push(`${priorCrossInstanceWrite.step_id} on replica [#${writerIdx}] (${writerUrl}) succeeded.`);\n lines.push(\n `${result.step_id} on replica [#${currentInstance}] (${currentUrl}) failed${\n isNotFoundSignature(result) ? ' with NOT_FOUND' : ''\n }.`\n );\n lines.push('→ Brand-scoped state is not shared across replicas.');\n lines.push(`See: ${HORIZONTAL_SCALING_DOCS_URL}`);\n } else {\n lines.push(\n `Multi-instance failure on replica [#${currentInstance}] (${currentUrl}). ` +\n `No prior cross-replica stateful write found — the failure may be intrinsic to this replica.`\n );\n }\n\n if (replicaMap) {\n lines.push('Replica → step map:');\n lines.push(replicaMap);\n }\n lines.push(`Reproduce single-replica: adcp storyboard run ${currentUrl} ${storyboard.id}`);\n\n // Agent-controlled text goes in the base line; control chars are stripped\n // so a hostile agent can't forge terminal escape sequences in CI output.\n const base = sanitizeAgentText(result.error ?? 'Step failed');\n result.error = `${base}\\n\\n${lines.join('\\n')}`;\n}\n\n/**\n * Get a preview of the first step in a storyboard (for showing what will happen).\n *\n * `{{runner.*}}` tokens are passed through unchanged since no receiver is\n * bound at preview time. They'll resolve when the step actually runs.\n */\nexport function getFirstStepPreview(\n storyboard: Storyboard,\n context: StoryboardContext = {}\n): StoryboardStepPreview | undefined {\n const firstPhase = storyboard.phases[0];\n if (!firstPhase?.steps[0]) return undefined;\n\n const step = firstPhase.steps[0];\n const previewRequest = step.sample_request ? injectContext({ ...step.sample_request }, context) : undefined;\n\n return {\n step_id: step.id,\n phase_id: firstPhase.id,\n title: step.title,\n task: step.task,\n narrative: step.narrative,\n expected: step.expected,\n sample_request: previewRequest,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,yBAAuC;AACvC,qBAAyC;AACzC,uBAA+B;AAC/B,oBAA4F;AAC5F,uBAKO;AACP,gCAAkF;AAClF,sBAA2E;AAC3E,qBAQO;AACP,6BAA4C;AAC5C,+BAAsC;AACtC,qCAA4C;AAC5C,yBASO;AACP,+BAAgG;AAChG,kBAA6G;AAC7G,6BAKO;AACP,4BAA8B;AAC9B,gCAA8C;AAC9C,oCAAmF;AACnF,6BAA2F;AAC3F,uBAAwC;AACxC,6BAAkD;AAClD,6BAKO;AACP,IAAAA,iBAA6C;AAC7C,yBAAuD;AACvD,2BAMO;AACP,qBAAoD;AACpD,oBAQO;AACP,gCAAiC;AACjC,sBAAwD;AACxD,oBAAwC;AACxC,wBAAgD;AAChD,4BAA0C;AAC1C,8BAAoF;AACpF,gCAA2F;AAC3F,qBAAmE;AACnE,gCAA2E;AAC3E,wBAAsC;AACtC,IAAAA,iBAA8C;AAC9C,0CAAgD;AAChD,0CAMO;AACP,kCAKO;AAqEP,2BAMO;AACP,mBAA+D;AAE/D,wBAMO;AAlFP,MAAM,wCAAwC,uBAAO,mCAAmC;AAKxF,SAAS,qCACP,SACqD;AACrD,SAAQ,QAAyC,qCAAqC;AACxF;AAEA,SAAS,sCACP,SACA,UACsB;AACtB,SAAO,EAAE,GAAG,SAAS,CA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BAAwB;AAK1C,UAAM,KAAK,GAAG,wBAAwB,OAAO,iBAAiB,SAAS,MAAM,SAAS,cAAc;AACpG,UAAM;AAAA,MACJ,GAAG,OAAO,OAAO,iBAAiB,eAAe,MAAM,UAAU,WAC/D,oBAAoB,MAAM,IAAI,oBAAoB,EACpD;AAAA,IACF;AACA,UAAM,KAAK,0DAAqD;AAChE,UAAM,KAAK,QAAQ,2BAA2B,EAAE;AAAA,EAClD,OAAO;AACL,UAAM;AAAA,MACJ,uCAAuC,eAAe,MAAM,UAAU;AAAA,IAExE;AAAA,EACF;AAEA,MAAI,YAAY;AACd,UAAM,KAAK,0BAAqB;AAChC,UAAM,KAAK,UAAU;AAAA,EACvB;AACA,QAAM,KAAK,iDAAiD,UAAU,IAAI,WAAW,EAAE,EAAE;AAIzF,QAAM,OAAO,kBAAkB,OAAO,SAAS,aAAa;AAC5D,SAAO,QAAQ,GAAG,IAAI;AAAA;AAAA,EAAO,MAAM,KAAK,IAAI,CAAC;AAC/C;AAQO,SAAS,oBACd,YACA,UAA6B,CAAC,GACK;AACnC,QAAM,aAAa,WAAW,OAAO,CAAC;AACtC,MAAI,CAAC,YAAY,MAAM,CAAC,EAAG,QAAO;AAElC,QAAM,OAAO,WAAW,MAAM,CAAC;AAC/B,QAAM,iBAAiB,KAAK,qBAAiB,8BAAc,EAAE,GAAG,KAAK,eAAe,GAAG,OAAO,IAAI;AAElG,SAAO;AAAA,IACL,SAAS,KAAK;AAAA,IACd,UAAU,WAAW;AAAA,IACrB,OAAO,KAAK;AAAA,IACZ,MAAM,KAAK;AAAA,IACX,WAAW,KAAK;AAAA,IAChB,UAAU,KAAK;AAAA,IACf,gBAAgB;AAAA,EAClB;AACF;","names":["import_client","result","next","cap"]}
1
+ {"version":3,"sources":["../../../../src/lib/testing/storyboard/runner.ts"],"sourcesContent":["/**\n * Storyboard execution engine.\n *\n * Two entry points:\n * - runStoryboard(): run all phases/steps sequentially\n * - runStoryboardStep(): run a single step (stateless, LLM-friendly)\n */\n\nimport { createHash, createHmac } from 'node:crypto';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { basename, join } from 'node:path';\nimport { getOrCreateClientResolution, getOrDiscoverProfile, runStep, type TestClient } from '../client';\nimport {\n closeScopedConnections,\n normalizeTransportOptions,\n withMCPConnectionScope,\n type VersionEnvelopeMode,\n} from '../../protocols';\nimport { getCapturesFromError, withRawResponseCapture, type RawHttpCapture } from '../../protocols/rawResponseCapture';\nimport { defaultStoryboardResponseProjection, executeStoryboardTask } from './task-map';\nimport {\n extractContextWithProvenance,\n injectContext,\n applyContextOutputsWithProvenance,\n applyContextInputs,\n forwardAliasCache,\n createRunnerVariables,\n type RunnerVariables,\n} from './context';\nimport { detectContextRejectionHints } from './rejection-hints';\nimport { detectShapeDriftHints } from './shape-drift-hints';\nimport { detectStrictValidationHints } from './strict-validation-hints';\nimport {\n runValidations,\n decorateValidationResult,\n validationFailsStep,\n RUNNER_CAPABILITY_VERSION,\n type ValidationContext,\n type CrossResponseSet,\n type UpstreamTrafficValidationContext,\n type UpstreamTrafficQueryResult,\n} from './validations';\nimport { PARALLEL_DISPATCH_CONTRACT, runParallelDispatches, validateParallelDispatchSpec } from './parallel-dispatch';\nimport { resolvePath, resolvePortableIdentifierPathAll, toJsonPointer, validatePortableIdentifierPath } from './path';\nimport {\n RATE_LIMIT_TRIP_CONTRACT,\n RateLimitTripObserver,\n validateRateLimitTripSpec,\n type RateLimitTripObservation,\n} from './rate-limit-trip';\nimport { redactSecrets } from '../../utils/redact-secrets';\nimport { ResponseSchemaValidationError } from '../../utils/response-unwrapper';\nimport { injectLegacyEnvelopeStatus, normalizeLegacyMediaBuyStatusForReturn } from '../../utils/envelope-status-compat';\nimport { queryUpstreamTraffic, type ControllerScenario, type UpstreamTrafficSuccess } from '../test-controller';\nimport { IDENTIFIER_DIGEST_LIMIT } from '../../upstream-recorder/constants';\nimport { enrichRequest, hasRequestEnricher } from './request-builder';\nimport {\n BUILD_ASSETS_FROM_FORMAT_DIRECTIVE,\n expandCreativeAssetDirectivesWithDiagnostics,\n findUnresolvedCreativeAssetDirectives,\n type CreativeAssetExpansionFailure,\n} from './creative-assets';\nimport { resolveAccount, resolveBrand } from '../client';\nimport { isMutatingTask, generateIdempotencyKey } from '../../utils/idempotency';\nimport {\n getSchemaDefaultByPath,\n getSchemaValidatorByRef,\n resolveBundleKey,\n schemaAllowsTopLevelField,\n withExternalSchemaRoot,\n} from '../../validation/schema-loader';\nimport { ADCP_VERSION, parseAdcpMajorVersion } from '../../version';\nimport {\n PROBE_TASKS,\n probeProtectedResourceMetadata,\n probeOauthAuthServerMetadata,\n fetchProbe,\n rawMcpProbe,\n generateRandomInvalidApiKey,\n generateRandomInvalidJwt,\n} from './probes';\nimport { readBrandJsonUrl } from '../../signing/agent-resolver/capabilities-types';\nimport { resolveDeclaredTestKit, validateTestKit } from './test-kit';\nimport { validateStoryboardShape } from './loader';\nimport { trustedStoryboardComplianceRoot } from './provenance';\nimport { probeRequestSigningVector } from './request-signing/probe-dispatch';\nimport { createWebhookReceiver, type WebhookReceiver, type WebhookWaitResult } from './webhook-receiver';\nimport { WEBHOOK_ASSERTION_TASKS, armWebhookAssertions, executeWebhookAssertionStep } from './webhook-assertions';\nimport { runControllerSeeding, type ControllerSeedingResult } from './seeding';\nimport { applyFixtureBindingsToRequest, type FixtureBindingRegistry } from './fixture-resolution';\nimport { getComplianceCacheDir } from './compliance';\nimport { signWebhook, type RequestLike } from '../../signing/client';\nimport { replayTrustedMatchContextVector } from './trusted-match-context-replay';\nimport {\n TRUSTED_MATCH_PUBLISHER_AUTH_TASKS,\n prepareTrustedMatchPublisherAuthProbes,\n probeTrustedMatchPublisherAuth,\n type PreparedTrustedMatchPublisherAuthProbes,\n type TrustedMatchPublisherAuthTask,\n} from './trusted-match-publisher-auth';\nimport {\n gradeOAuthMetadataGraph,\n redactOAuthUrlForOutput,\n redactOAuthUrlsInText,\n type OAuthMetadataGraphGrade,\n} from './oauth-metadata-graph';\n\nconst PREPARED_TRUSTED_MATCH_PUBLISHER_AUTH = Symbol('preparedTrustedMatchPublisherAuth');\ntype InternalStoryboardRunOptions = StoryboardRunOptions & {\n [PREPARED_TRUSTED_MATCH_PUBLISHER_AUTH]?: PreparedTrustedMatchPublisherAuthProbes;\n};\n\nfunction getPreparedTrustedMatchPublisherAuth(\n options: StoryboardRunOptions\n): PreparedTrustedMatchPublisherAuthProbes | undefined {\n return (options as InternalStoryboardRunOptions)[PREPARED_TRUSTED_MATCH_PUBLISHER_AUTH];\n}\n\nfunction withPreparedTrustedMatchPublisherAuth(\n options: StoryboardRunOptions,\n prepared: PreparedTrustedMatchPublisherAuthProbes\n): StoryboardRunOptions {\n return { ...options, [PREPARED_TRUSTED_MATCH_PUBLISHER_AUTH]: prepared } as InternalStoryboardRunOptions;\n}\n\n/**\n * Pre-computed controller-seeding outcome passed into `executeStoryboardPass`.\n * Populated by `runMultiPass` so seeding fires once at the run level instead\n * of once per pass (which would inflate `failed_count`/`skipped_count` when\n * the aggregator sums per-pass counts). `attach: true` on the first pass so\n * the synthetic `__controller_seeding__` phase appears in `phaseResults`\n * exactly once; subsequent passes inherit `allPassed` for cascade-skip\n * semantics but don't double-attach.\n */\ninterface PreSeededInput {\n result: ControllerSeedingResult | null;\n attach: boolean;\n}\nimport type {\n A2ATaskEnvelope,\n AgentEntry,\n AssertionResult,\n BranchSetSpec,\n ContextProvenanceEntry,\n FixtureResolutionCoverageGap,\n FixtureResolutionRecord,\n HttpProbeResult,\n RunnerDetailedSkipReason,\n RunnerExtractionRecord,\n RunnerRequestRecord,\n RunnerResponseRecord,\n RunnerSelectionResult,\n RequirementName,\n RunnerSkipReason,\n RunnerNotice,\n RequiresCapabilityPredicate,\n ResponseNotApplicableGate,\n StepAuthDirective,\n Storyboard,\n StoryboardStep,\n StoryboardPhase,\n StoryboardContext,\n StoryboardRunOptions,\n StoryboardResult,\n StoryboardPassResult,\n StoryboardPhaseResult,\n StoryboardStepResult,\n StoryboardStepPreview,\n StoryboardValidation,\n StrictValidationSummary,\n SchemaValidationError,\n ValidationResult,\n RunnerTransport,\n} from './types';\nimport {\n buildRoutingContext,\n DiscoveryFailure,\n resolveAgentForStep,\n RoutingError,\n type AgentRoutingContext,\n} from './agent-routing';\nimport { DETAILED_SKIP_TO_CANONICAL, KNOWN_REQUIREMENTS } from './types';\nimport type { AgentProfile, TaskResult, TestStepResult } from '../types';\nimport {\n type AssertionContext,\n type AssertionSpec,\n resolveAssertions,\n stepDisablesAssertion,\n validateStepInvariants,\n} from './assertions';\n\n// ────────────────────────────────────────────────────────────\n// Runner-output contract helpers\n// ────────────────────────────────────────────────────────────\n\nconst SKIP_DETAILS: Record<RunnerSkipReason, string> = {\n not_applicable: 'Not applicable: agent did not declare the protocol or specialism this storyboard targets.',\n no_phases: 'Storyboard has no executable phases (placeholder).',\n prerequisite_failed: 'Skipped: a prerequisite step or contract did not pass.',\n missing_tool: 'Skipped: agent did not advertise the required tool.',\n missing_test_controller:\n 'Skipped: deterministic_testing phase requires comply_test_controller, which the agent did not advertise.',\n fixture_unavailable: 'Skipped: the runner test kit cannot synthesize a valid input for the seller-declared contract.',\n unsatisfied_contract: 'Skipped: test-kit contract is out of scope for this grading run.',\n requirement_unmet:\n 'Skipped: a requires: tag named a runtime requirement that is not available on this run (see RunnerSkipResult.requirement).',\n peer_branch_taken: 'Skipped: a peer branch in the same any_of branch set already contributed the aggregation flag.',\n peer_substituted: 'Skipped: a same-phase peer step established equivalent state via `provides_state_for`.',\n};\n\nconst CONTROLLER_SEEDING_FAILED_DETAIL =\n 'Skipped: pre-flight comply_test_controller seeding failed; the agent was not populated with the storyboard fixtures the remaining phases depend on.';\n\nconst FIXTURE_SEED_UNSUPPORTED_DETAIL =\n 'Skipped: pre-flight comply_test_controller seeding requires a seed_* scenario this agent does not implement (`fixture_seed_unsupported`).';\n\nconst OAUTH_NOT_ADVERTISED_DETAIL =\n 'Skipped: agent does not advertise OAuth — /.well-known/oauth-protected-resource returned 404 (RFC 9728 §3). API-key path must carry auth_mechanism_verified for this storyboard to pass.';\n\nexport function applyStoryboardVersionOptions(\n storyboard: Storyboard,\n options: StoryboardRunOptions\n): StoryboardRunOptions {\n const versioned = applyAdcpVersionRunOptions(storyboard.adcp_version, options);\n const mayInheritStoryboardDir = options.adcpVersion === undefined || options.adcpVersion === storyboard.adcp_version;\n const complianceDir =\n versioned.complianceDir ?? (mayInheritStoryboardDir ? trustedStoryboardComplianceRoot(storyboard) : undefined);\n return complianceDir && versioned.complianceDir !== complianceDir ? { ...versioned, complianceDir } : versioned;\n}\n\nexport function applyAdcpVersionRunOptions(\n defaultAdcpVersion: string | undefined,\n options: StoryboardRunOptions\n): StoryboardRunOptions {\n const adcpVersion = options.adcpVersion ?? defaultAdcpVersion;\n if (adcpVersion === undefined) return options;\n\n const versionEnvelope = options.versionEnvelope ?? storyboardVersionEnvelopeMode(adcpVersion);\n\n if (options.adcpVersion === adcpVersion && options.versionEnvelope === versionEnvelope) {\n return options;\n }\n return { ...options, adcpVersion, versionEnvelope };\n}\n\nfunction getRunSchemaRoot(options: StoryboardRunOptions): { adcpVersion: string; schemaRoot: string } | undefined {\n if (!options.schemaRoot) return undefined;\n const adcpVersion = options.adcpVersion ?? options._serverAdcpVersion;\n if (!adcpVersion) {\n throw new Error(\n 'schemaRoot requires an AdCP version. Pass adcpVersion, or run a storyboard/compliance bundle with adcp_version set.'\n );\n }\n return { adcpVersion, schemaRoot: options.schemaRoot };\n}\n\nfunction storyboardVersionEnvelopeMode(adcpVersion: string): VersionEnvelopeMode {\n const bundleKey = resolveBundleKey(adcpVersion);\n const major = parseAdcpMajorVersion(bundleKey);\n if (Number.isFinite(major) && major < 3) return 'none';\n return 'auto';\n}\n\n/**\n * Suffix appended to the skip detail when the sole-stateful-step exemption\n * fires (`not_applicable` / `missing_tool` / `missing_test_controller` on\n * the only stateful step in a phase, no `provides_state_for` rescue\n * declared). Adopters reading the report otherwise have to infer from the\n * absence of cascade-skips that the runner consciously chose not to\n * cascade — this marker makes the decision explicit.\n *\n * Pre-formatted phrase, parameterized only by phase id. Greppable via\n * `sole stateful step exemption applied`.\n */\nfunction soleStatefulExemptionDetail(phaseId: string): string {\n return ` Sole stateful step exemption applied for phase '${phaseId}': no peer could have established substitute state, so downstream phases run without cascade (adcp#4053, adcp-client#1146/#1545).`;\n}\n\n/**\n * Per-reason override strings for detailed skip reasons that want a more\n * specific message than the canonical fallback. Used only when the probe\n * itself didn't emit an error-style detail.\n */\nconst DETAILED_SKIP_DETAILS: Partial<Record<RunnerDetailedSkipReason, string>> = {\n oauth_not_advertised: OAUTH_NOT_ADVERTISED_DETAIL,\n controller_seeding_failed: CONTROLLER_SEEDING_FAILED_DETAIL,\n operator_skip: 'Step was excluded by request_signing.skipVectors.',\n rate_abuse_opt_out: 'Rate-abuse vector was excluded by request_signing.skipRateAbuse.',\n capability_profile_mismatch: 'Vector is outside the agent capability profile selected for this run.',\n transport_ungradable: 'Vector cannot be graded faithfully by the selected transport.',\n rate_limit_not_triggered: 'No RATE_LIMITED response was observed within the configured max_attempts.',\n};\n\n/**\n * Machine-readable detail values required by the AdCP report contract.\n * The probe's human-readable error remains available on the legacy response.\n */\nconst CANONICAL_SKIP_DETAILS: Partial<Record<RunnerDetailedSkipReason, string>> = {\n rate_limit_not_triggered: 'rate_limit_not_triggered',\n};\n\nconst REPLAY_WEBHOOK_VECTOR_TASK = 'replay_webhook_vector';\nconst REPLAY_TRUSTED_MATCH_CONTEXT_VECTOR_TASK = 'replay_trusted_match_context_vector';\nconst WEBHOOK_REPLAY_DEFAULT_TIMEOUT_MS = 10_000;\n\nfunction selectionForProbeSkip(reason: RunnerDetailedSkipReason, detail: string): RunnerSelectionResult | undefined {\n switch (reason) {\n case 'live_side_effect_opt_in_required':\n return { reason: 'run_mode_excluded', detail };\n case 'operator_skip':\n case 'rate_abuse_opt_out':\n return { reason: 'explicit_scope_excluded', detail };\n case 'not_in_only_vectors':\n case 'mcp_mode_flattens_url_edges':\n case 'capability_profile_mismatch':\n case 'transport_ungradable':\n return { reason: 'profile_excluded', detail };\n default:\n return undefined;\n }\n}\n\n/**\n * Walk a dotted key path (e.g. `\"adcp.idempotency.supported\"`) through a\n * nested object. Returns `undefined` when any segment is missing or the\n * intermediate value is not an object.\n *\n * Exported for direct testing. Inline copies of this logic in test code\n * silently drift from the runtime when edge cases (null prototypes,\n * Symbol keys, prototype-chain access) get tightened — testing the real\n * implementation forecloses that class of bug.\n */\nexport function resolveCapabilityPath(raw: unknown, dottedPath: string): unknown {\n const keys = dottedPath.split('.');\n let current: unknown = raw;\n for (const key of keys) {\n if (current === null || typeof current !== 'object') return undefined;\n if (!Object.prototype.hasOwnProperty.call(current, key)) return undefined;\n current = (current as Record<string, unknown>)[key];\n }\n return current;\n}\n\nconst GET_ADCP_CAPABILITIES_RESPONSE_SCHEMA_REF = 'protocol/get-adcp-capabilities-response.json';\n\nfunction resolveCapabilityPathForGate(\n raw: unknown,\n predicate: RequiresCapabilityPredicate,\n adcpVersion?: string\n): unknown {\n const actual = resolveCapabilityPath(raw, predicate.path);\n if (actual !== undefined) return actual;\n // `present:` is an absence-detection matcher — an absent field IS the\n // load-bearing signal. Materializing a schema default would make a defaulted\n // field never read as absent, silently flipping the gate (e.g. a signals\n // seller that omits `signals.discovery_modes`, default `[\"brief\"]`, would run\n // a `present: true`-gated scenario that should skip). Defaults are resolved\n // only for the value matchers (`equals` / `contains` / `not_contains`), where the default's\n // VALUE is what the gate tests.\n if ('present' in predicate) return undefined;\n if (!schemaDefaultShouldApply(raw, predicate.path)) return undefined;\n return getSchemaDefaultByPath(GET_ADCP_CAPABILITIES_RESPONSE_SCHEMA_REF, predicate.path, adcpVersion);\n}\n\nfunction schemaDefaultShouldApply(raw: unknown, dottedPath: string): boolean {\n const keys = dottedPath.split('.');\n if (keys.length <= 1) return raw !== null && typeof raw === 'object';\n\n let current: unknown = raw;\n for (const key of keys.slice(0, -1)) {\n if (current === null || typeof current !== 'object') return false;\n if (!Object.prototype.hasOwnProperty.call(current, key)) return false;\n current = (current as Record<string, unknown>)[key];\n }\n return current !== null && typeof current === 'object';\n}\n\n/**\n * Evaluate a `requires_capability` predicate against the value already\n * resolved from the agent's raw capabilities. Returns `null` when the\n * predicate is satisfied and a human-readable detail string when the\n * storyboard should be skipped.\n *\n * Four matcher forms — see `Storyboard.requires_capability` for full semantics:\n *\n * - `equals: V` — scalar equality. `actual` must be declared and must equal\n * `V`. Absent fields (`undefined`) skip unless the capabilities schema\n * declares a default that the gate materialized before predicate evaluation.\n *\n * - `present: B` — presence is the load-bearing signal. `present: true`\n * skips when the field is absent (treats `undefined` and `null` as absent).\n * `present: false` skips when the field is present. Empty object `{}`\n * counts as present, per the spec's \"presence of this object indicates\n * support\" wording. Note: an explicit `null` on the wire is technically\n * non-conformant for object-typed capabilities (`\"type\": \"object\"` rejects\n * null in JSON Schema), but is coalesced with absent here in the spirit of\n * Postel — agents that misdeclare a not-supported capability as `null`\n * get the same not_applicable skip as agents that omit the field. Schema\n * defaults are deliberately NOT materialized for this matcher: presence is\n * the signal, so a default would defeat the gate (see\n * `resolveCapabilityPathForGate`).\n *\n * - `contains: V` — array-membership. `actual` must be an array that\n * includes `V` (structural JSON equality, no coercion). Empty arrays, non-arrays,\n * and absent fields all skip unless the capabilities schema declares a\n * default that the gate materialized before predicate evaluation.\n *\n * - `not_contains: V` — negative array-membership. `actual` must be an array\n * that does not include `V` (structural JSON equality, no coercion). Missing and\n * non-array values skip; an empty array satisfies the predicate.\n *\n * Exported for direct testing so the predicate semantics are pinned without\n * needing a full runStoryboard() roundtrip.\n */\nexport function evaluateCapabilityPredicate(predicate: RequiresCapabilityPredicate, actual: unknown): string | null {\n if ('present' in predicate) {\n const isPresent = actual !== undefined && actual !== null;\n if (predicate.present && !isPresent) {\n return `Capability predicate \\`${predicate.path}\\` must be present: ` + `agent did not declare it.`;\n }\n if (!predicate.present && isPresent) {\n return (\n `Capability predicate \\`${predicate.path}\\` must be absent: ` + `agent declared ${JSON.stringify(actual)}.`\n );\n }\n return null;\n }\n if ('contains' in predicate) {\n if (!Array.isArray(actual)) {\n return (\n `Capability predicate \\`${predicate.path}\\` must contain ${JSON.stringify(predicate.contains)}: ` +\n `agent declared ${actual === undefined ? 'no value' : JSON.stringify(actual)}.`\n );\n }\n if (!actual.some(value => capabilityValuesEqual(value, predicate.contains))) {\n return (\n `Capability predicate \\`${predicate.path}\\` must contain ${JSON.stringify(predicate.contains)}: ` +\n `agent declared ${JSON.stringify(actual)}.`\n );\n }\n return null;\n }\n if ('not_contains' in predicate) {\n if (!Array.isArray(actual)) {\n return (\n `Capability predicate \\`${predicate.path}\\` must not contain ${JSON.stringify(predicate.not_contains)}: ` +\n `agent declared ${actual === undefined ? 'no value' : JSON.stringify(actual)}.`\n );\n }\n if (actual.some(value => capabilityValuesEqual(value, predicate.not_contains))) {\n return (\n `Capability predicate \\`${predicate.path}\\` must not contain ${JSON.stringify(predicate.not_contains)}: ` +\n `agent declared ${JSON.stringify(actual)}.`\n );\n }\n return null;\n }\n // `equals` form: absence means the agent did not declare the capability or\n // capability variant this storyboard tests, so skip as unsupported.\n if (actual === undefined) {\n return (\n `Capability predicate \\`${predicate.path} === ${JSON.stringify(predicate.equals)}\\` not satisfied: ` +\n `agent did not declare support.`\n );\n }\n if (actual !== undefined && actual !== predicate.equals) {\n return (\n `Capability predicate \\`${predicate.path} === ${JSON.stringify(predicate.equals)}\\` not satisfied: ` +\n `agent declared ${JSON.stringify(actual)}.`\n );\n }\n return null;\n}\n\n/** Key-order-insensitive equality for JSON-valued capability declarations. */\nfunction capabilityValuesEqual(a: unknown, b: unknown): boolean {\n if (a === b) return true;\n if (typeof a !== typeof b || a === null || b === null || typeof a !== 'object') return false;\n if (Array.isArray(a)) {\n if (!Array.isArray(b) || a.length !== b.length) return false;\n return a.every((value, index) => capabilityValuesEqual(value, b[index]));\n }\n if (Array.isArray(b)) return false;\n const aRecord = a as Record<string, unknown>;\n const bRecord = b as Record<string, unknown>;\n const aKeys = Object.keys(aRecord).sort();\n const bKeys = Object.keys(bRecord).sort();\n return (\n aKeys.length === bKeys.length &&\n aKeys.every((key, index) => key === bKeys[index] && capabilityValuesEqual(aRecord[key], bRecord[key]))\n );\n}\n\nfunction evaluateRequiresCapabilityGate(\n predicate: RequiresCapabilityPredicate,\n profile: AgentProfile | undefined,\n agentTools?: readonly string[],\n adcpVersion?: string\n): string | null {\n const rawCaps = profile?.raw_capabilities;\n if (rawCaps !== undefined) {\n const actual = resolveCapabilityPathForGate(rawCaps, predicate, adcpVersion);\n return evaluateCapabilityPredicate(predicate, actual);\n }\n // OAuth 3.2 grading is opt-in on the raw wire declaration. A normalized\n // profile or advertised get_adcp_capabilities tool is not evidence that the\n // agent asserted oauth.supported: true.\n if ('equals' in predicate && predicate.path === 'oauth.supported' && predicate.equals === true) {\n return evaluateCapabilityPredicate(predicate, undefined);\n }\n // The TMP publisher-auth storyboard is selected only by an explicit\n // experimental_features declaration. A normalized profile without the raw\n // capability payload is not evidence of that opt-in.\n if (\n 'contains' in predicate &&\n predicate.path === 'experimental_features' &&\n predicate.contains === 'trusted_match.core'\n ) {\n return evaluateCapabilityPredicate(predicate, undefined);\n }\n const tools = agentTools ?? profile?.tools;\n if ('equals' in predicate && tools !== undefined && !tools.includes('get_adcp_capabilities')) {\n return evaluateCapabilityPredicate(predicate, undefined);\n }\n return null;\n}\n\nfunction collectPhaseCapabilitySkipDetails(\n storyboard: Storyboard,\n profile: AgentProfile | undefined,\n agentTools?: readonly string[],\n adcpVersion?: string\n): Map<string, string> {\n const skipDetails = new Map<string, string>();\n for (const phase of storyboard.phases) {\n if (!phase.requires_capability) continue;\n const unmetDetail = evaluateRequiresCapabilityGate(phase.requires_capability, profile, agentTools, adcpVersion);\n if (unmetDetail !== null) {\n skipDetails.set(phase.id, unmetDetail);\n }\n }\n return skipDetails;\n}\n\nfunction allExecutablePhasesCapabilitySkipped(\n storyboard: Storyboard,\n phaseCapabilitySkipDetails: ReadonlyMap<string, string>\n): boolean {\n const executablePhases = storyboard.phases.filter(phase => phase.steps.length > 0);\n return executablePhases.length > 0 && executablePhases.every(phase => phaseCapabilitySkipDetails.has(phase.id));\n}\n\nfunction buildSkip(reason: RunnerSkipReason, detail?: string): { reason: RunnerSkipReason; detail: string } {\n return { reason, detail: detail ?? SKIP_DETAILS[reason] };\n}\n\ntype CreativeAssetFixtureUnavailableFailure = Extract<CreativeAssetExpansionFailure, { reason: 'fixture_unavailable' }>;\n\nfunction buildCreativeAssetFixtureUnavailableStep(\n step: StoryboardStep,\n phaseId: string,\n context: StoryboardContext,\n allSteps: FlatStep[],\n runState: ExecutionState,\n failure: CreativeAssetFixtureUnavailableFailure,\n task = step.task\n): StoryboardStepResult {\n const detail =\n `creative_asset_fixture_unavailable: slot \"${failure.slotId}\", asset type \"${failure.assetType}\", ` +\n `constraint: ${failure.constraint} (${failure.path})`;\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task,\n passed: true,\n skipped: true,\n skip_reason: 'fixture_unavailable',\n skip: buildSkip('fixture_unavailable', detail),\n duration_ms: 0,\n validations: [],\n context,\n next: getNextStepPreview(step.id, allSteps, context, runState.runnerVars),\n extraction: { path: 'none' },\n };\n}\n\ninterface ResponseDerivedSkip {\n detail: string;\n contextKeys: string[];\n}\n\nfunction detectResponseDerivedNotApplicable(\n step: StoryboardStep,\n request: Record<string, unknown>,\n response: unknown,\n runState?: ExecutionState,\n allSteps?: Array<{ step: StoryboardStep }>\n): ResponseDerivedSkip | null {\n if (response === undefined || response === null) return null;\n const gates = [\n ...normalizeResponseNotApplicableGates(step.not_applicable_if),\n ...inferImplicitResponseNotApplicableGates(step, request, runState, allSteps),\n ];\n for (const gate of gates) {\n if (gate.kind !== 'terminal_page') continue;\n if (!terminalPageGateMatches(gate, request, response)) continue;\n const detail =\n gate.detail ??\n `${gate.reason ?? 'single_page_result'}: ${step.task} response is terminal; cursor-walk not applicable`;\n return {\n detail,\n contextKeys: responseNotApplicableContextKeys(step, gate),\n };\n }\n return null;\n}\n\nfunction normalizeResponseNotApplicableGates(gates: StoryboardStep['not_applicable_if']): ResponseNotApplicableGate[] {\n if (!gates) return [];\n return Array.isArray(gates) ? gates : [gates];\n}\n\nfunction inferImplicitResponseNotApplicableGates(\n step: StoryboardStep,\n request: Record<string, unknown>,\n runState?: ExecutionState,\n allSteps?: Array<{ step: StoryboardStep }>\n): ResponseNotApplicableGate[] {\n // Back-compat for the already-published pagination_integrity_list_accounts\n // storyboard: it expresses the continuation requirement as validations\n // rather than a dedicated response-derived gate. Keep this narrowly scoped\n // to list_accounts so other seeded pagination storyboards do not silently\n // waive fixture/setup mistakes.\n if (step.task !== 'list_accounts') return [];\n const expectsContinuation = step.validations?.some(\n v => v.check === 'field_value' && v.path === 'pagination.has_more' && v.value === true\n );\n const capturesCursor = step.context_outputs?.some(o => o.path === 'pagination.cursor');\n const validatesCursor = step.validations?.some(v => v.check === 'field_present' && v.path === 'pagination.cursor');\n if (!expectsContinuation || (!capturesCursor && !validatesCursor)) return [];\n const maxResults = resolvePath(request, 'pagination.max_results');\n if (\n typeof maxResults === 'number' &&\n Number.isFinite(maxResults) &&\n hasUnrunAccountSeedExceedingPageSize(allSteps, runState, maxResults)\n ) {\n return [];\n }\n const setupAccounts = resolvePath(runState?.priorStepResults.get('sync_three_accounts')?.response, 'accounts');\n if (\n typeof maxResults === 'number' &&\n Number.isFinite(maxResults) &&\n Array.isArray(setupAccounts) &&\n setupAccounts.length > maxResults\n ) {\n return [];\n }\n return [{ kind: 'terminal_page', items_path: 'accounts', reason: 'single_page_result' }];\n}\n\nfunction hasUnrunAccountSeedExceedingPageSize(\n allSteps: Array<{ step: StoryboardStep }> | undefined,\n runState: ExecutionState | undefined,\n maxResults: number\n): boolean {\n return (\n allSteps?.some(({ step }) => {\n if (runState?.priorStepResults.has(step.id)) return false;\n if (step.task !== 'sync_accounts') return false;\n const accounts = resolvePath(step.sample_request, 'accounts');\n return Array.isArray(accounts) && accounts.length > maxResults;\n }) ?? false\n );\n}\n\nfunction terminalPageGateMatches(\n gate: Extract<ResponseNotApplicableGate, { kind: 'terminal_page' }>,\n request: Record<string, unknown>,\n response: unknown\n): boolean {\n const maxResults = resolvePath(request, gate.request_max_results_path ?? 'pagination.max_results');\n if (typeof maxResults !== 'number' || !Number.isFinite(maxResults) || maxResults <= 0) return false;\n\n const items = resolvePath(response, gate.items_path);\n if (!Array.isArray(items)) return false;\n\n const pagination = resolvePath(response, 'pagination');\n if (pagination === undefined || pagination === null) return items.length < maxResults;\n if (typeof pagination !== 'object' || Array.isArray(pagination)) return false;\n\n const p = pagination as Record<string, unknown>;\n if (p.has_more === true) return false;\n if (p.has_more !== false) return false;\n if (typeof p.total_count === 'number' && p.total_count > items.length) return false;\n if (items.length < maxResults) return true;\n return typeof p.total_count === 'number' && p.total_count <= items.length;\n}\n\nfunction responseNotApplicableContextKeys(\n step: StoryboardStep,\n gate: Extract<ResponseNotApplicableGate, { kind: 'terminal_page' }>\n): string[] {\n if (gate.context_keys?.length) return gate.context_keys;\n return (step.context_outputs ?? [])\n .filter(o => o.path === 'pagination.cursor')\n .map(o => o.key)\n .filter((key): key is string => typeof key === 'string' && key.length > 0);\n}\n\nfunction responseDerivedContextResult(\n runState: ExecutionState\n): Pick<StoryboardStepResult, 'response_derived_not_applicable_context_keys'> {\n const entries = runState.responseDerivedNotApplicableContextKeys;\n return entries && entries.size > 0\n ? { response_derived_not_applicable_context_keys: Object.fromEntries(entries) }\n : {};\n}\n\n/**\n * True for skip reasons that imply state genuinely never materialized\n * — no other code path could have established it. The runner trips\n * the cascade immediately on these. `missing_tool` and\n * `missing_test_controller` qualify: the agent doesn't advertise the\n * tool, end of story.\n *\n * `not_applicable` is intentionally NOT in this set even though F6's\n * first cut bundled it in. `not_applicable` means \"this path doesn't\n * apply to this agent\", which is consistent with \"a peer path in the\n * same phase establishes equivalent state\" — e.g. an explicit-mode\n * seller skips `sync_accounts` as not_applicable because\n * `list_accounts` is the canonical alternative for that account\n * shape. Tripping the cascade on the first not_applicable would\n * collapse this distinction and skip the substitute. The runner\n * therefore defers `not_applicable`'s cascade decision to phase end —\n * see `phasePendingNotApplicable` handling in the phase loop.\n */\nfunction isHardMissingStateSkipReason(reason: RunnerSkipReason | RunnerDetailedSkipReason | undefined): boolean {\n return reason === 'missing_tool' || reason === 'missing_test_controller';\n}\n\n/**\n * Resolve each phase's branch-set membership, combining explicit\n * `branch_set: { id, semantics }` declarations with the implicit detection\n * fallback the schema + adcp#2646 mandate: an `optional: true` phase with a\n * step declaring `contributes_to: <flag>` that matches a later\n * `assert_contribution check: any_of, allowed_values: [<flag>]` target is a\n * branch-set member even when the author hasn't migrated to the explicit\n * keyword. Explicit declarations take precedence. Returned map is keyed by\n * phase id; phases outside any branch set are absent from the map.\n *\n * First-match wins: if an optional phase has steps contributing to more\n * than one any_of flag, the earliest matching step (by storyboard\n * declaration order) decides the phase's branch-set membership. Authors\n * wanting a phase in multiple branch sets should declare `branch_set:`\n * explicitly — the implicit path does not synthesize multi-set membership.\n */\nfunction resolveBranchSets(storyboard: Storyboard): Map<string, BranchSetSpec> {\n const resolved = new Map<string, BranchSetSpec>();\n for (const phase of storyboard.phases) {\n if (phase.branch_set) resolved.set(phase.id, phase.branch_set);\n }\n const anyOfFlags = new Set<string>();\n for (const phase of storyboard.phases) {\n for (const step of phase.steps) {\n if (step.task !== 'assert_contribution') continue;\n for (const v of step.validations ?? []) {\n if (v.check !== 'any_of') continue;\n for (const flag of v.allowed_values ?? []) {\n if (typeof flag === 'string') anyOfFlags.add(flag);\n }\n }\n }\n }\n for (const phase of storyboard.phases) {\n if (resolved.has(phase.id)) continue;\n if (!phase.optional) continue;\n for (const step of phase.steps) {\n if (!step.contributes_to) continue;\n if (!anyOfFlags.has(step.contributes_to)) continue;\n resolved.set(phase.id, { id: step.contributes_to, semantics: 'any_of' });\n break;\n }\n }\n return resolved;\n}\n\n/**\n * Re-grade non-contributing branch-set peers per the `any_of` semantics in\n * storyboard-schema.yaml (\"Per-step grading in any_of branch patterns\").\n *\n * Runs after the main phase loop because peer contribution status isn't\n * knowable until all peer phases have executed. For every phase in a\n * branch set (explicit `branch_set:` declaration or implicit detection via\n * `resolveBranchSets`) whose flag was contributed by a different phase,\n * this phase's raw step failures are moot — the agent took the other\n * branch. Each such failed step is rewritten to a skipped result with\n * `skip_reason: 'peer_branch_taken'` and the detail string the\n * runner-output-contract mandates:\n *\n * \"<flag> contributed by <peer_phase_id>.<peer_step_id> — <this_phase_id> is moot\"\n *\n * The `<this_branch_id>` contract placeholder resolves to the non-chosen\n * peer's phase id — `branch_set.id` is shared across peers and could not\n * disambiguate. Only `any_of` semantics drives re-grading today; other\n * (reserved) values are rejected at parse in `validateBranchSet`.\n *\n * `countedAsFailed` names step results the main loop added to `failedCount`\n * as hard failures — either non-optional phases or the `presenceDetected`\n * PRM 2xx path (adcp-client#677: \"an agent that serves PRM MUST serve it\n * correctly\"). These stand: re-grading them would paper over the exact\n * invariants the hard-failure paths exist to enforce. The post-pass only\n * relabels swallowed optional-phase failures, which by construction are not\n * in `countedAsFailed`.\n */\nfunction applyBranchSetGrading(\n phases: StoryboardPhase[],\n phaseResults: StoryboardPhaseResult[],\n branchSetByPhaseId: Map<string, BranchSetSpec>,\n contributions: Set<string>,\n contributionSources: Map<string, { phaseId: string; stepId: string }>,\n countedAsFailed: Set<StoryboardStepResult>\n): { skippedDelta: number } {\n let skippedDelta = 0;\n for (let i = 0; i < phases.length; i++) {\n const phaseDef = phases[i];\n const phaseResult = phaseResults[i];\n if (!phaseDef || !phaseResult) continue;\n const branchSet = branchSetByPhaseId.get(phaseDef.id);\n if (!branchSet) continue;\n if (branchSet.semantics !== 'any_of') continue;\n const flag = branchSet.id;\n if (!contributions.has(flag)) continue;\n const source = contributionSources.get(flag);\n if (!source || source.phaseId === phaseDef.id) continue;\n const detail = `${flag} contributed by ${source.phaseId}.${source.stepId} — ${phaseDef.id} is moot`;\n let regraded = false;\n for (const step of phaseResult.steps) {\n if (step.passed || step.skipped) continue;\n if (countedAsFailed.has(step)) continue;\n step.passed = true;\n step.skipped = true;\n step.skip_reason = 'peer_branch_taken';\n step.skip = { reason: 'peer_branch_taken', detail };\n delete step.error;\n delete step.adcp_error;\n skippedDelta++;\n regraded = true;\n }\n if (regraded) {\n phaseResult.passed = phaseResult.steps.every(s => s.passed || s.skipped);\n }\n }\n return { skippedDelta };\n}\n\n// ────────────────────────────────────────────────────────────\n// task_completion. context_outputs path resolution\n// ────────────────────────────────────────────────────────────\n\n/** Marker prefix on `context_outputs.path` that opts a capture into the\n * poll-tasks-get-for-the-completion-artifact resolution flow. The remainder\n * of the path is resolved against the artifact's `data`, not the immediate\n * submitted envelope. */\nconst TASK_COMPLETION_PATH_PREFIX = 'task_completion.';\n\n/** Hard cap on how long the runner blocks one step waiting for a task to\n * reach terminal state. Long enough to cover most HITL approval flows that\n * are expected to complete inline; short enough that a stuck task surfaces\n * the failure on the step that authored the dependency rather than the\n * storyboard wall-clock budget. Override with `STORYBOARD_TASK_POLL_TIMEOUT_MS`. */\nconst TASK_COMPLETION_DEFAULT_TIMEOUT_MS = 30_000;\n\n/** Per-poll cadence inside `pollTaskCompletion`. Scaled tight enough that\n * short HITL flows complete in a couple of polls; the bound is still the\n * outer timeout race. Override with `STORYBOARD_TASK_POLL_INTERVAL_MS`. */\nconst TASK_COMPLETION_DEFAULT_POLL_INTERVAL_MS = 1_500;\n\n/** Defensive task_id pattern. AdCP doesn't constrain `task_id` shape on the\n * wire, but unbounded strings are an SSRF / log-injection lever — we cap\n * the length and reject control characters before the value reaches the\n * SDK's tasks/get JSON-RPC param. */\nconst TASK_ID_MAX_LEN = 256;\n// eslint-disable-next-line no-control-regex -- intentional: reject control chars in task_id\nconst TASK_ID_CONTROL_CHAR_RE = /[\\x00-\\x1F\\x7F]/;\n\n/** Non-terminal task statuses that carry a `task_id` and warrant polling\n * the artifact for `task_completion.<inner>` captures. Per the AdCP\n * `tasks-get-response.json` enum, all three are explicitly non-terminal:\n * `submitted` (HITL or async-signed-IO), `working` (\"expect completion\n * within 120 seconds\"), and `input-required` (waiting on the buyer to\n * supply additional info — relevant when the storyboard test harness\n * satisfies the input requirement). The 30s default poll timeout still\n * bounds the worst case for storyboards that test these arms directly. */\nconst POLL_ELIGIBLE_STATUSES = new Set(['submitted', 'working', 'input-required']);\n\ninterface PollEligibleEnvelopeShape {\n status: 'submitted' | 'working' | 'input-required';\n task_id: string;\n}\n\n/**\n * Clear retained A2A session state (`contextId`, `pendingTaskId`) on each\n * shared client at the start of a storyboard run. AgentClient is documented\n * as one-instance-per-conversation; `comply()` reuses a single instance\n * across every storyboard for transport caching, so the runner has to\n * re-establish the \"fresh conversation\" boundary per storyboard. Without\n * this, a stale `pendingTaskId` from a prior storyboard's non-terminal\n * step rides into this storyboard's first call and the seller surfaces\n * \"Task <uuid> not found\". See adcp-client#1585.\n *\n * Calls go through a duck-typed `resetContext()` accessor so the helper\n * stays compatible with adapter-built clients that don't subclass\n * AgentClient directly.\n */\nfunction resetClientSessions(clients: readonly TestClient[]): void {\n for (const client of clients) {\n const reset = (client as unknown as { resetContext?: () => void }).resetContext;\n if (typeof reset === 'function') reset.call(client);\n }\n}\n\nfunction isPollEligibleEnvelope(data: unknown): data is PollEligibleEnvelopeShape {\n if (data == null || typeof data !== 'object') return false;\n const obj = data as { status?: unknown; task_id?: unknown };\n return (\n typeof obj.status === 'string' &&\n POLL_ELIGIBLE_STATUSES.has(obj.status) &&\n typeof obj.task_id === 'string' &&\n obj.task_id.length > 0\n );\n}\n\nfunction isValidTaskId(taskId: string): boolean {\n if (taskId.length === 0 || taskId.length > TASK_ID_MAX_LEN) return false;\n if (TASK_ID_CONTROL_CHAR_RE.test(taskId)) return false;\n return true;\n}\n\ninterface TaskCompletionResolution {\n /** Discriminator: was the resolution attempted? `false` short-circuits\n * the runner back to plain extraction against the immediate response. */\n attempted: boolean;\n /** Artifact data resolved by polling. Present (including `undefined`)\n * ONLY when polling succeeded — caller uses `'data' in resolution` to\n * distinguish \"polled and got undefined\" from \"did not poll.\" */\n data?: unknown;\n /** Set when the bounded poll exceeded `pollTimeoutMs`. The runner uses\n * this to flip the synthesized failure check from\n * `capture_path_not_resolvable` to `capture_poll_timeout`. */\n timedOut?: boolean;\n pollTimeoutMs?: number;\n /** Set when polling reached terminal state with `success: false`\n * (failed / canceled / rejected). The runner flips the synthesized\n * failure check to `capture_task_failed` so reports distinguish\n * \"field absent on artifact\" from \"task itself terminally failed.\" */\n taskFailed?: boolean;\n}\n\nfunction remapTaskCompletionOutputs<T extends { path?: string | undefined }>(outputs: readonly T[]): T[] {\n return outputs.map(o => {\n if (typeof o.path === 'string' && o.path.startsWith(TASK_COMPLETION_PATH_PREFIX)) {\n return { ...o, path: o.path.slice(TASK_COMPLETION_PATH_PREFIX.length) };\n }\n return o;\n });\n}\n\nasync function resolveTaskCompletionOutputs(\n taskResult: TaskResult | undefined,\n outputs: readonly { path?: string | undefined }[],\n client: TestClient,\n webhookReceiver: WebhookReceiver | undefined,\n originatingTaskName: string\n): Promise<TaskCompletionResolution> {\n const hasTaskCompletionPath = outputs.some(\n o => typeof o.path === 'string' && o.path.startsWith(TASK_COMPLETION_PATH_PREFIX)\n );\n if (!hasTaskCompletionPath) return { attempted: false };\n if (!taskResult || !isPollEligibleEnvelope(taskResult.data)) return { attempted: false };\n const taskId = taskResult.data.task_id;\n if (!isValidTaskId(taskId)) return { attempted: false };\n\n const timeoutMs = readEnvIntOrDefault(\n process.env['STORYBOARD_TASK_POLL_TIMEOUT_MS'],\n TASK_COMPLETION_DEFAULT_TIMEOUT_MS\n );\n const pollIntervalMs = readEnvIntOrDefault(\n process.env['STORYBOARD_TASK_POLL_INTERVAL_MS'],\n TASK_COMPLETION_DEFAULT_POLL_INTERVAL_MS\n );\n\n // The SDK's `pollTaskCompletion` lives on the executor — accessed via the\n // SingleAgentClient instance the storyboard runner created in\n // `getOrCreateClient`. The runner historically uses `client: any` for\n // dynamic dispatch (see task-map.ts:80) so this cast doesn't widen\n // existing surface.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- dynamic SDK access\n const dynamicClient = client as any;\n const executor = dynamicClient?.executor;\n const agent = dynamicClient?.agent;\n const canPoll = !!(executor?.pollTaskCompletion && agent);\n const canWebhook = !!webhookReceiver;\n if (!canPoll && !canWebhook) return { attempted: false };\n\n type PollWin = { kind: 'poll'; result: TaskResult };\n type WebhookWin = { kind: 'webhook'; result: WebhookWaitResult };\n type TimeoutWin = { kind: 'timeout' };\n type Winner = PollWin | WebhookWin | TimeoutWin;\n\n const racers: Promise<Winner>[] = [];\n\n // Poll path. An AbortSignal tied to the same `timeoutMs` budget is passed\n // to `pollTaskCompletion` so the inner loop exits as soon as the outer race\n // timer fires — no orphaned `tasks/get` requests survive the step boundary.\n // (adcp-client#1612: previously the loop ran indefinitely after the outer\n // timeout resolved, accumulating background A2A calls that consumed the\n // full comply() budget.)\n if (canPoll) {\n const pollSignal = AbortSignal.timeout(timeoutMs);\n racers.push(\n executor.pollTaskCompletion(agent, taskId, pollIntervalMs, undefined, pollSignal).then(\n (result: TaskResult): PollWin => ({\n kind: 'poll',\n result,\n })\n )\n );\n }\n\n // Webhook path. Per `tasks-get-response.json`, sellers MAY use webhook-\n // only HITL completion (no polling). When a `--webhook-receiver` is\n // active, race the receiver's `wait` (filtered by `task_id`) against\n // the poll. The webhook payload's `result` field is the artifact's\n // `data` (per the framework's task webhook payload shape, mirroring\n // the HITL completion shape from `from-platform.ts`).\n //\n // Note: `webhook.wait` keeps an internal `setTimeout(timeout_ms)` that\n // we can't cancel from here. When the poll wins or the outer timeout\n // fires first, that internal timer continues until `timeout_ms`\n // elapses. Acceptable because the receiver is process-scoped (closed\n // on storyboard exit) and runner-owned receivers aren't injected.\n if (webhookReceiver) {\n racers.push(\n webhookReceiver\n .wait({ body: { task_id: taskId } }, timeoutMs)\n .then((result): WebhookWin => ({ kind: 'webhook', result }))\n );\n }\n\n let timer: NodeJS.Timeout | undefined;\n const timeoutRacer = new Promise<TimeoutWin>(resolve => {\n timer = setTimeout(() => resolve({ kind: 'timeout' }), timeoutMs);\n // Don't keep the event loop alive on this handle — the runner's\n // wall-clock budget is already enforced by the storyboard runner\n // shell, and a hung task shouldn't delay process exit by `timeoutMs`.\n timer.unref?.();\n });\n racers.push(timeoutRacer);\n\n try {\n const winner = await Promise.race(racers);\n if (winner.kind === 'timeout') {\n return { attempted: true, timedOut: true, pollTimeoutMs: timeoutMs };\n }\n if (winner.kind === 'poll') {\n const polled = winner.result;\n if (polled.success === false) return { attempted: true, taskFailed: true };\n return { attempted: true, data: normalizeTaskCompletionData(polled.data, originatingTaskName) };\n }\n // Webhook win.\n const waitResult = winner.result;\n if (waitResult.timed_out) {\n return { attempted: true, timedOut: true, pollTimeoutMs: timeoutMs };\n }\n const webhookBody = waitResult.webhook.body as { status?: unknown; result?: unknown } | undefined;\n // Fail-closed on the success path: require `status === 'completed'`.\n // The framework's `buildTaskWebhookPayload` always emits `status`, so a\n // missing or non-completed value means either a malformed webhook or a\n // genuine terminal-failed/canceled/rejected outcome — both should\n // attribute to `capture_task_failed`, not silently fall through to a\n // capture against an undefined `result`.\n if (webhookBody?.status === 'completed') {\n return { attempted: true, data: normalizeTaskCompletionData(webhookBody.result, originatingTaskName) };\n }\n return { attempted: true, taskFailed: true };\n } catch {\n return { attempted: true, taskFailed: true };\n } finally {\n if (timer) clearTimeout(timer);\n }\n}\n\nfunction normalizeTaskCompletionData(data: unknown, taskName: string): unknown {\n if (data == null || typeof data !== 'object' || Array.isArray(data)) return data;\n const original = data as Record<string, unknown>;\n const compat = injectLegacyEnvelopeStatus(original, { toolName: taskName });\n if (!('status' in original) && 'status' in compat) {\n const { status: _status, ...rest } = compat;\n return normalizeLegacyMediaBuyStatusForReturn(rest, { toolName: taskName });\n }\n if (\n (taskName === 'create_media_buy' || taskName === 'update_media_buy') &&\n typeof original.status === 'string' &&\n compat.status === 'completed' &&\n typeof compat.media_buy_status === 'string'\n ) {\n return normalizeLegacyMediaBuyStatusForReturn({ ...compat, status: original.status }, { toolName: taskName });\n }\n return normalizeLegacyMediaBuyStatusForReturn(compat, { toolName: taskName });\n}\n\nfunction readEnvIntOrDefault(value: string | undefined, fallback: number): number {\n if (!value) return fallback;\n const parsed = Number.parseInt(value, 10);\n if (!Number.isFinite(parsed) || parsed <= 0) return fallback;\n return parsed;\n}\n\nfunction extractionFromTaskResult(taskResult: TaskResult | undefined): RunnerExtractionRecord {\n if (!taskResult) return { path: 'none' };\n // Prefer the explicit provenance stamped by the response unwrapper / raw\n // MCP probe. Fall back to inference only when the tag is missing (e.g.,\n // synthetic TaskResults built by validation harnesses).\n if (taskResult._extraction_path !== undefined) return { path: taskResult._extraction_path };\n if (!taskResult.success && taskResult.error) return { path: 'error' };\n return taskResult.data !== undefined && taskResult.data !== null ? { path: 'structured_content' } : { path: 'none' };\n}\n\nexport function __redactSecretsForTest(value: unknown): unknown {\n return redactSecrets(value);\n}\n\nexport function __filterResponseHeadersForTest(\n headers: Record<string, string> | undefined\n): Record<string, string> | undefined {\n return filterResponseHeaders(headers);\n}\n\nexport function __defaultAuthHeadersForRawProbeForTest(\n options: StoryboardRunOptions\n): Record<string, string> | undefined {\n return defaultAuthHeadersForRawProbe(options);\n}\n\n/**\n * Response headers to echo on a RunnerResponseRecord. Everything else is\n * dropped — agents can (and do) include `set-cookie`, echoed `authorization`,\n * reverse-proxy breadcrumbs (`x-amz-*`, `x-azure-*`, `x-internal-*`) that a\n * hostile agent could use to bait us into publishing internal state in a\n * shared compliance report.\n */\nconst RESPONSE_HEADER_ALLOWLIST = new Set([\n 'content-type',\n 'content-length',\n 'content-encoding',\n 'www-authenticate',\n 'location',\n 'retry-after',\n 'x-request-id',\n 'x-correlation-id',\n]);\n\nfunction filterResponseHeaders(headers: Record<string, string> | undefined): Record<string, string> | undefined {\n if (!headers) return undefined;\n const out: Record<string, string> = {};\n for (const [k, v] of Object.entries(headers)) {\n const lower = k.toLowerCase();\n if (RESPONSE_HEADER_ALLOWLIST.has(lower)) {\n out[lower] = lower === 'location' ? redactOAuthUrlForOutput(v) : v;\n }\n }\n return Object.keys(out).length > 0 ? out : undefined;\n}\n\n// ────────────────────────────────────────────────────────────\n// runStoryboard: execute all phases/steps\n// ────────────────────────────────────────────────────────────\n\n/**\n * Run an entire storyboard against an agent.\n *\n * Pass a single URL for the standard single-instance run. Pass an array of\n * URLs to engage multi-instance mode: the runner round-robins each step\n * across the provided URLs so that (brand, account)-scoped state created on\n * one instance must be visible on the next. Sellers whose state lives only\n * in-process will fail this mode — the failure signature is a prior write\n * succeeding on instance A while a subsequent read returns NOT_FOUND or\n * empty on instance B.\n */\nexport async function runStoryboard(\n agentUrlOrUrls: string | string[],\n storyboard: Storyboard,\n options: StoryboardRunOptions = {}\n): Promise<StoryboardResult> {\n return withMCPConnectionScope(\n async () => {\n options = applyStoryboardVersionOptions(storyboard, options);\n // adcp#6735 — a declared prerequisites.test_kit is a loading directive,\n // not decoration: resolve it into options.test_kit (caller-supplied\n // kits win) so from_test_kit / $test_kit.* references get the\n // credential the storyboard was authored against.\n options = resolveDeclaredTestKit(storyboard, options);\n options = { ...options, transport: normalizeTransportOptions(options.transport) };\n const schemaRoot = getRunSchemaRoot(options);\n if (schemaRoot) {\n return await withExternalSchemaRoot(schemaRoot.adcpVersion, schemaRoot.schemaRoot, () =>\n runStoryboardBody(agentUrlOrUrls, storyboard, options)\n );\n }\n return await runStoryboardBody(agentUrlOrUrls, storyboard, options);\n },\n { isolate: true }\n );\n}\n\nasync function runStoryboardBody(\n agentUrlOrUrls: string | string[],\n storyboard: Storyboard,\n options: StoryboardRunOptions\n): Promise<StoryboardResult> {\n validateTestKit(options.test_kit);\n // Enforce authoring-time branch_set invariants regardless of how the\n // storyboard reached us. YAML callers already ran these rules in\n // parseStoryboard; programmatic callers (hand-built Storyboard objects or\n // alternative YAML loaders) reach this point without the loader having\n // fired, and the runtime's grading depends on the invariants holding.\n // `validateStoryboardShape` is idempotent so the double-pass is safe.\n validateStoryboardShape(storyboard);\n\n // Per-specialism routing (#1066). Mutually exclusive with replica-array\n // dispatch and `_client`. Validate the shape of `options.agents` here so\n // misconfigured callers fail fast with a clear error rather than getting\n // silently routed to the first URL or a stale single-agent client.\n if (options.agents !== undefined) {\n validateAgentsMap(agentUrlOrUrls, storyboard, options);\n }\n\n const agentUrls = Array.isArray(agentUrlOrUrls) ? agentUrlOrUrls : [agentUrlOrUrls];\n if (!options.agents && agentUrls.length === 0) {\n throw new Error('runStoryboard: at least one agent URL required');\n }\n\n const isMultiInstance = agentUrls.length > 1;\n if (isMultiInstance && options._client) {\n throw new Error(\n 'runStoryboard: _client override is incompatible with multi-instance mode. ' +\n 'Remove _client (or pass a single agent URL) to use round-robin dispatch.'\n );\n }\n\n // When capabilities are already available, applicability MUST be evaluated\n // before runtime requirements. Without a profile we defer both gates until\n // executeStoryboardPass has completed discovery; reporting a missing runner\n // adapter before learning that the agent never claimed the capability would\n // incorrectly turn not_applicable into requirement_unmet.\n const deferCapabilityAndRequires = storyboard.requires_capability !== undefined && options._profile === undefined;\n if (storyboard.requires_capability && !deferCapabilityAndRequires) {\n const unmetDetail = evaluateRequiresCapabilityGate(\n storyboard.requires_capability,\n options._profile,\n options.agentTools,\n options.adcpVersion\n );\n if (unmetDetail !== null) {\n const resultAgentUrls = options.agents ? Object.values(options.agents).map(e => e.url) : agentUrls;\n return {\n ...buildCapabilityUnsupportedResult(resultAgentUrls, storyboard, unmetDetail),\n notices: collectCapabilityNotices(storyboard, options._profile),\n };\n }\n }\n\n // Runtime gates still run before either multi-instance strategy when they\n // can be evaluated faithfully, so a missing harness remains one whole-\n // storyboard skip instead of being multiplied across passes.\n const allRequires = resolveStoryboardRequires(storyboard, options);\n if (allRequires.length && !deferCapabilityAndRequires) {\n const requirementCheck = await checkRequires(allRequires, storyboard, options, options._profile);\n if ('requirement' in requirementCheck) {\n const resultAgentUrls = options.agents ? Object.values(options.agents).map(e => e.url) : agentUrls;\n return {\n ...buildRequirementUnmetResult(\n resultAgentUrls,\n storyboard,\n requirementCheck.requirement,\n requirementCheck.detail\n ),\n notices: collectCapabilityNotices(storyboard, options._profile),\n };\n }\n if (requirementCheck.preparedPublisherAuthProbes) {\n options = withPreparedTrustedMatchPublisherAuth(options, requirementCheck.preparedPublisherAuthProbes);\n }\n }\n\n const requestedStrategy = options.multi_instance_strategy ?? 'round-robin';\n if (requestedStrategy === 'multi-pass' && isMultiInstance) {\n // Webhook receivers bind a fresh ephemeral port per pass. Each pass would\n // advertise a different URL via `{{runner.webhook_base}}`; agents caching\n // the pass-1 URL would deliver into a dead port in pass 2. Reject rather\n // than silently mis-route. The spec-correct test for webhook retry /\n // idempotency is one pass.\n if (options.webhook_receiver) {\n throw new Error(\n 'runStoryboard: webhook_receiver is incompatible with multi_instance_strategy: \"multi-pass\". ' +\n 'Each pass would bind a fresh receiver URL, so agents caching the pass-1 URL would deliver ' +\n 'to a dead port in pass 2. Use round-robin when the storyboard needs a webhook receiver, ' +\n 'or run multi-pass on a storyboard without webhook observation.'\n );\n }\n return runMultiPass(agentUrls, storyboard, options);\n }\n\n if (options.agents) {\n // Project the agents map's URLs into the legacy `agentUrls` array so\n // downstream signatures (per-step `agent_url:` records, etc.) keep\n // working unchanged. The routing dispatcher inside\n // `executeStoryboardPass` reads `options.agents` directly for the\n // actual per-tool routing.\n const projected = Object.values(options.agents).map(e => e.url);\n return executeStoryboardPass(projected, storyboard, options, 0);\n }\n return executeStoryboardPass(agentUrls, storyboard, options, 0);\n}\n\n/**\n * Validate the shape and consistency of `StoryboardRunOptions.agents` (#1066).\n *\n * Catches the failure modes that would otherwise surface as confusing\n * runtime errors deep inside discovery or dispatch:\n *\n * - empty map\n * - `default_agent` referencing an unknown key\n * - `step.agent` referencing an unknown key\n * - co-existence with `multi_instance_strategy` (replicas, different concept)\n * - co-existence with `_client` (single client cannot serve multiple agents)\n * - first positional arg passed alongside the map (ambiguous routing intent)\n */\nfunction validateAgentsMap(\n agentUrlOrUrls: string | string[],\n storyboard: Storyboard,\n options: StoryboardRunOptions\n): void {\n const agents = options.agents!;\n const keys = Object.keys(agents);\n if (keys.length === 0) {\n throw new Error(\n 'runStoryboard: `agents` is set but contains no entries. ' + 'Either remove the key or supply at least one agent.'\n );\n }\n for (const key of keys) {\n const entry = agents[key];\n if (!entry || typeof entry.url !== 'string' || entry.url === '') {\n throw new Error(\n `runStoryboard: agents['${key}'] missing a non-empty \\`url\\`. ` + 'Each entry must declare its endpoint URL.'\n );\n }\n }\n\n if (options.default_agent !== undefined && !(options.default_agent in agents)) {\n throw new Error(\n `runStoryboard: \\`default_agent\\` \"${options.default_agent}\" is not a key in \\`agents\\`. ` +\n `Available keys: ${keys.join(', ')}.`\n );\n }\n\n // Per-step `agent:` overrides must reference an agent that's actually in\n // the map. Walk the storyboard once at entry so authoring errors surface\n // before the first network call.\n for (const phase of storyboard.phases ?? []) {\n for (const step of phase.steps ?? []) {\n if (step.agent !== undefined && !(step.agent in agents)) {\n throw new Error(\n `runStoryboard: step \"${step.id}\" declares \\`agent: \"${step.agent}\"\\` but ` +\n `that key is not in the agents map. Available keys: ${keys.join(', ')}.`\n );\n }\n }\n }\n\n if (options.multi_instance_strategy !== undefined) {\n throw new Error(\n 'runStoryboard: `agents` (per-specialism routing) is incompatible with ' +\n '`multi_instance_strategy` (replica round-robin). They are different concepts — ' +\n 'replicas test horizontal scaling of one agent, the agents map routes per tool ' +\n 'across different agents. Use one or the other.'\n );\n }\n if (options._client) {\n throw new Error(\n 'runStoryboard: `agents` is incompatible with `_client` override. ' +\n 'A single client cannot serve multiple agents; per-agent clients are ' +\n 'constructed from the map.'\n );\n }\n\n // Controller seeding (`prerequisites.controller_seeding: true`) currently\n // dispatches against the FIRST per-agent client only, which works for\n // single-tenant runs but is the wrong shape under routed mode: a\n // cross-specialism storyboard's `fixtures:` block typically declares\n // seeds owned by different tenants (e.g., `seed_product` for sales,\n // `seed_signal_provider` for signals). Per-tenant seed dispatch is a\n // larger change tracked separately. Until that lands, fail-fast and\n // tell the operator to seed each tenant out-of-band and pass\n // `skip_controller_seeding: true`.\n if (storyboard.prerequisites?.controller_seeding === true && options.skip_controller_seeding !== true) {\n throw new Error(\n 'runStoryboard: `agents` + `prerequisites.controller_seeding: true` is not yet supported. ' +\n 'Controller seeding currently targets a single tenant; cross-tenant seed routing is a ' +\n 'follow-up. Pre-seed each tenant out-of-band and pass `skip_controller_seeding: true` to ' +\n 'opt out of the runner-side seeding loop.'\n );\n }\n\n // First positional arg must be empty when `agents` is set. Allowing a\n // non-empty value is ambiguous: is the map authoritative, or is the\n // positional arg a hidden default? Reject and require the caller to\n // express intent through `agents` + `default_agent`.\n const firstArgEmpty = agentUrlOrUrls === '' || (Array.isArray(agentUrlOrUrls) && agentUrlOrUrls.length === 0);\n if (!firstArgEmpty) {\n throw new Error(\n 'runStoryboard: pass `\"\"` (or `[]`) as the first argument when using ' +\n '`options.agents`. The agents map is authoritative for routing; mixing ' +\n 'a positional URL with the map is ambiguous.'\n );\n }\n}\n\n/**\n * Build a minimal StoryboardResult for a storyboard skipped by a\n * `requires_capability` predicate. The single synthetic step carries\n * `skip_reason: 'capability_unsupported'` so CLI reports and JUnit\n * consumers render it as a skip rather than a pass or failure.\n */\nfunction buildCapabilityUnsupportedResult(\n agentUrls: string[],\n storyboard: Storyboard,\n detail: string\n): StoryboardResult {\n const syntheticStep: StoryboardStepResult = {\n storyboard_id: storyboard.id,\n step_id: 'capability_unsupported',\n phase_id: 'capability_unsupported',\n title: 'Storyboard skipped: capability not supported by this agent',\n task: '',\n passed: true,\n skipped: true,\n skip_reason: 'capability_unsupported',\n skip: { reason: DETAILED_SKIP_TO_CANONICAL.capability_unsupported, detail },\n duration_ms: 0,\n validations: [],\n context: {},\n error: detail,\n extraction: { path: 'none' },\n };\n return {\n storyboard_id: storyboard.id,\n storyboard_title: storyboard.title,\n agent_url: redactOAuthUrlForOutput(agentUrls[0]!),\n overall_passed: true,\n phases: [\n {\n phase_id: 'capability_unsupported',\n phase_title: 'Capability unsupported',\n passed: true,\n steps: [syntheticStep],\n duration_ms: 0,\n },\n ],\n context: {},\n total_duration_ms: 0,\n // This synthetic phase is an applicability gate, not a real passed\n // scenario. `overall_passed: true` preserves non-failing CI semantics,\n // while passed_count stays 0 so rollups do not report unexecuted\n // storyboards as successful coverage.\n passed_count: 0,\n failed_count: 0,\n skipped_count: 1,\n runner_capability_version: RUNNER_CAPABILITY_VERSION,\n tested_at: new Date().toISOString(),\n strict_validation_summary: {\n observable: false,\n checked: 0,\n passed: 0,\n failed: 0,\n strict_only_failures: 0,\n lenient_also_failed: 0,\n },\n notices: [],\n };\n}\n\nfunction buildPhaseCapabilitySkippedSteps(\n storyboard: Storyboard,\n phase: StoryboardPhase,\n detail: string,\n context: StoryboardContext\n): StoryboardStepResult[] {\n return phase.steps.map(step => ({\n storyboard_id: storyboard.id,\n step_id: step.id,\n phase_id: phase.id,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: 'not_applicable',\n skip: { reason: 'not_applicable', detail },\n duration_ms: 0,\n validations: [],\n context,\n error: detail,\n extraction: { path: 'none' },\n }));\n}\n\n/**\n * Map a `requires:` requirement onto the canonical `RunnerSkipReason` to\n * emit when that requirement is unmet. `controller` reuses the existing\n * `missing_test_controller` value so back-compat consumers (skip-cause\n * aggregators, dashboards keyed on the existing string) keep grouping\n * controller-driven skips into the same bucket they already track. Other\n * requirements use the new `requirement_unmet` reason; consumers that\n * want per-requirement granularity read `RunnerSkipResult.requirement`.\n *\n * Spec: adcp-client#1626 (no-rename design — keep existing skip_reason\n * values stable as the back-compat surface; add `requirement_unmet` only\n * for requirement names that have no existing canonical reason).\n */\nconst REQUIREMENT_TO_SKIP_REASON: Record<RequirementName, RunnerSkipReason> = {\n controller: 'missing_test_controller',\n seeded_state: 'requirement_unmet',\n real_wire: 'requirement_unmet',\n webhook_receiver: 'requirement_unmet',\n webhook_replay_receiver: 'not_applicable',\n trusted_match_context_router_runner: 'not_applicable',\n trusted_match_publisher_auth_runner: 'requirement_unmet',\n request_signer: 'not_applicable',\n multi_agent: 'requirement_unmet',\n};\n\nfunction isKnownRequirement(requirement: string): requirement is RequirementName {\n return KNOWN_REQUIREMENTS.has(requirement as RequirementName);\n}\n\n/**\n * Build a minimal StoryboardResult for a storyboard skipped because a\n * `requires:` tag named a requirement that isn't available on this run\n * (e.g. `controller` when the agent doesn't advertise\n * `comply_test_controller`, or `seeded_state` when the operator didn't\n * pass `--asserts-seeded-state`). Mirrors `buildCapabilityUnsupportedResult`\n * but carries the structured `requirement` field so consumers can group\n * not-applicable scenarios by cause. Spec: adcp-client#1626.\n */\nfunction buildRequirementUnmetResult(\n agentUrls: string[],\n storyboard: Storyboard,\n requirement: string,\n detail: string\n): StoryboardResult {\n const reason = isKnownRequirement(requirement) ? REQUIREMENT_TO_SKIP_REASON[requirement] : 'requirement_unmet';\n const syntheticStep: StoryboardStepResult = {\n storyboard_id: storyboard.id,\n step_id: `requirement_unmet:${requirement}`,\n phase_id: 'requirement_unmet',\n title: `Storyboard skipped: requires '${requirement}'`,\n task: '',\n passed: true,\n skipped: true,\n skip_reason: reason,\n skip: { reason, detail, requirement },\n duration_ms: 0,\n validations: [],\n context: {},\n extraction: { path: 'none' },\n };\n return {\n storyboard_id: storyboard.id,\n storyboard_title: storyboard.title,\n agent_url: redactOAuthUrlForOutput(agentUrls[0]!),\n overall_passed: true,\n phases: [\n {\n phase_id: 'requirement_unmet',\n phase_title: `Requirement unmet: ${requirement}`,\n passed: true,\n steps: [syntheticStep],\n duration_ms: 0,\n },\n ],\n context: {},\n total_duration_ms: 0,\n // `required_any_of_tools` unmet is an applicability skip. Keep\n // `overall_passed: true` for CI/non-failing semantics, but do not\n // increment passed_count because no scenario behavior was exercised.\n passed_count: 0,\n failed_count: 0,\n skipped_count: 1,\n runner_capability_version: RUNNER_CAPABILITY_VERSION,\n tested_at: new Date().toISOString(),\n strict_validation_summary: {\n observable: false,\n checked: 0,\n passed: 0,\n failed: 0,\n strict_only_failures: 0,\n lenient_also_failed: 0,\n },\n notices: [],\n };\n}\n\nfunction buildRequiredAnyOfToolsMissingResult(\n agentUrls: string[],\n storyboard: Storyboard,\n detail: string\n): StoryboardResult {\n const syntheticStep: StoryboardStepResult = {\n storyboard_id: storyboard.id,\n step_id: 'missing_required_tool_family',\n phase_id: 'requirement_unmet',\n title: 'Storyboard skipped: required tool family missing',\n task: '',\n passed: true,\n skipped: true,\n skip_reason: 'requirement_unmet',\n skip: { reason: 'requirement_unmet', detail },\n duration_ms: 0,\n validations: [],\n context: {},\n extraction: { path: 'none' },\n };\n return {\n storyboard_id: storyboard.id,\n storyboard_title: storyboard.title,\n agent_url: redactOAuthUrlForOutput(agentUrls[0]!),\n overall_passed: true,\n phases: [\n {\n phase_id: 'requirement_unmet',\n phase_title: 'Requirement unmet: required_any_of_tools',\n passed: true,\n steps: [syntheticStep],\n duration_ms: 0,\n },\n ],\n context: {},\n total_duration_ms: 0,\n passed_count: 0,\n failed_count: 0,\n skipped_count: 1,\n runner_capability_version: RUNNER_CAPABILITY_VERSION,\n tested_at: new Date().toISOString(),\n strict_validation_summary: {\n observable: false,\n checked: 0,\n passed: 0,\n failed: 0,\n strict_only_failures: 0,\n lenient_also_failed: 0,\n },\n notices: [],\n };\n}\n\nfunction normalizeAgentToolNames(tools: unknown): string[] | undefined {\n if (!Array.isArray(tools)) return undefined;\n const names: string[] = [];\n for (const tool of tools) {\n if (typeof tool === 'string') {\n names.push(tool);\n } else if (tool && typeof tool === 'object') {\n const name = (tool as { name?: unknown }).name;\n if (typeof name === 'string') names.push(name);\n }\n }\n return names.length > 0 ? names : undefined;\n}\n\n/**\n * Resolve a storyboard's `requires:` tags against the runtime environment.\n * Returns the first unmet requirement (with a human-readable detail) or\n * `null` when every requirement is available. Spec: adcp-client#1626.\n *\n * Detection rules:\n * - `controller` — agent advertises `comply_test_controller` (read from\n * `options.agentTools`). When `options.agentTools` is undefined the\n * gate is a no-op — the caller accepted responsibility for tool\n * compatibility by reusing an external client.\n * - `seeded_state` — operator passed `assertsSeededState: true`\n * (CLI: `--asserts-seeded-state`).\n * - `real_wire` — always available; the runner is hitting a real wire\n * by definition. The tag is a no-op gate today, reserved for a\n * future `--mock-only` mode.\n * - `webhook_receiver` — operator supplied `options.webhook_receiver`.\n * Autodetected from step `sample_request` token presence (see\n * `detectImplicitRequires`); authors don't write this tag manually.\n * Spec: adcp-client#1678.\n * - `webhook_replay_receiver` — operator supplied a non-empty\n * `options.webhook_replay_receiver.url`. Autodetected from any\n * `replay_webhook_vector` step (see `detectImplicitRequires`); authors\n * don't write this tag manually. Spec: adcp-client#2356.\n * - `trusted_match_context_router_runner` — operator supplied a router URL\n * and registration callback for raw `POST /context` replay. Autodetected\n * from `replay_trusted_match_context_vector`. Spec: adcp-client#2479.\n * - `trusted_match_publisher_auth_runner` — operator supplied exact\n * publisher-facing Context/Identity endpoints plus complete declarative\n * absent/invalid credential states. Spec: adcp-client#2526.\n * - `request_signer` — agent advertises `request_signing.supported: true`\n * in `get_adcp_capabilities`. Autodetected for any storyboard whose\n * id is `'signed_requests'` or that contains a `request_signing_probe`\n * step (see `detectImplicitRequires`); authors don't write this tag\n * manually. Absence-skip semantics are INVERTED from the general\n * `requires_capability` rule: the signed-requests universal\n * storyboard's own gating spec (signed-requests.yaml prerequisites)\n * declares \"agents that do not advertise support are not tested\n * against this storyboard — absence of advertisement is not a\n * failure\". When the runner can't read capabilities (no profile\n * threaded through), the gate is a no-op — the caller accepted\n * responsibility for capability compatibility by reusing an external\n * client. Spec: adcp-client#1702.\n * - `multi_agent` — `options.agents` is set and the storyboard's\n * declared route keys (`default_agent` and step-level `agent:` overrides)\n * resolve to at least two distinct entries in that map. Raw\n * `options.agents` cardinality is not enough; the requirement describes\n * the topology this storyboard actually routes through.\n * Spec: adcp-client#2281.\n */\nasync function checkRequires(\n requires: readonly string[],\n storyboard: Storyboard,\n options: StoryboardRunOptions,\n profile?: AgentProfile\n): Promise<\n { requirement: string; detail: string } | { preparedPublisherAuthProbes?: PreparedTrustedMatchPublisherAuthProbes }\n> {\n let preparedPublisherAuthProbes = getPreparedTrustedMatchPublisherAuth(options);\n for (const requirement of requires) {\n if (!isKnownRequirement(requirement)) {\n return {\n requirement,\n detail:\n `Storyboard requires unknown runtime requirement '${requirement}'. ` +\n `This SDK does not know how to satisfy it, so the requirement is treated as unmet ` +\n `for forward compatibility.`,\n };\n }\n switch (requirement) {\n case 'controller': {\n if (!options.agentTools) continue;\n if (!options.agentTools.includes('comply_test_controller')) {\n return {\n requirement,\n detail:\n `Storyboard requires 'controller'; agent does not advertise comply_test_controller. ` +\n `Agent tools: [${options.agentTools.join(', ')}].`,\n };\n }\n break;\n }\n case 'seeded_state': {\n if (options.assertsSeededState !== true) {\n return {\n requirement,\n detail:\n \"Storyboard requires 'seeded_state'; pass --asserts-seeded-state to declare \" +\n 'that initial state has been provisioned out-of-band.',\n };\n }\n break;\n }\n case 'real_wire':\n // Always available — reserved for a future --mock-only mode.\n break;\n case 'webhook_receiver': {\n if (options.webhook_receiver === undefined) {\n return {\n requirement,\n detail:\n 'Storyboard references `{{runner.webhook_url:…}}` or `{{runner.webhook_base}}` but no ' +\n 'webhook receiver is configured. Pass `webhook_receiver` in StoryboardRunOptions ' +\n '(or `--webhook-receiver` on the CLI) to host a receiver, or omit this storyboard. ' +\n 'Required by the webhook-emission universal: ' +\n 'compliance/{version}/universal/webhook-emission.yaml grades not_applicable when ' +\n 'no receiver is configured (prerequisites section).',\n };\n }\n break;\n }\n case 'webhook_replay_receiver': {\n if (!options.webhook_replay_receiver?.url) {\n return {\n requirement,\n detail:\n 'Storyboard contains a `replay_webhook_vector` step but no webhook replay receiver URL ' +\n 'is configured. Pass `webhook_replay_receiver.url` in StoryboardRunOptions to run ' +\n 'inbound buyer/orchestrator receiver conformance. Seller agents without an inbound ' +\n 'receiver grade not_applicable for this storyboard.',\n };\n }\n break;\n }\n case 'trusted_match_context_router_runner': {\n const runner = options.trusted_match_context_router_runner;\n if (!runner?.router_url || typeof runner.registerProviders !== 'function') {\n return {\n requirement,\n detail:\n 'Storyboard contains a `replay_trusted_match_context_vector` step but no Trusted Match ' +\n 'Context router harness is configured. Pass `trusted_match_context_router_runner` with ' +\n '`router_url` and `registerProviders` to run raw POST /context conformance.',\n };\n }\n break;\n }\n case 'trusted_match_publisher_auth_runner': {\n const runner = options.trusted_match_publisher_auth_runner;\n if (\n !runner ||\n typeof runner.contextEndpoint !== 'string' ||\n typeof runner.identityEndpoint !== 'string' ||\n typeof runner.preparePublisherAuthProbe !== 'function'\n ) {\n return {\n requirement,\n detail:\n 'Storyboard requires `trusted_match_publisher_auth_runner`; configure exact HTTPS ' +\n '`contextEndpoint` and `identityEndpoint` URLs plus `preparePublisherAuthProbe` for ' +\n 'both absent and invalid credential states.',\n };\n }\n if (!preparedPublisherAuthProbes) {\n try {\n preparedPublisherAuthProbes = await prepareTrustedMatchPublisherAuthProbes(runner);\n } catch (error) {\n return {\n requirement,\n detail:\n 'Storyboard requires a complete `trusted_match_publisher_auth_runner` configuration: ' +\n (error instanceof Error ? error.message : String(error)),\n };\n }\n }\n break;\n }\n case 'request_signer': {\n // Gate is a no-op when no profile is threaded through (external\n // `_client` mode). The caller has accepted responsibility for\n // capability compatibility; failing the gate here would surprise\n // them with a skip they can't explain from CLI options alone.\n if (!profile?.raw_capabilities) break;\n const supported = resolveCapabilityPath(profile.raw_capabilities, 'request_signing.supported');\n if (supported === true) break;\n return {\n requirement,\n detail:\n 'Storyboard requires `request_signing.supported: true` in `get_adcp_capabilities`; ' +\n `agent declared ${supported === undefined ? 'no request_signing block' : JSON.stringify(supported)}. ` +\n 'Per compliance/{version}/universal/signed-requests.yaml: \"Agents that do not advertise ' +\n 'support are not tested against this storyboard — absence of advertisement is not a ' +\n 'failure, it is a declaration that the agent does not offer verified signed requests.\" ' +\n 'To opt in, advertise `request_signing.supported: true` and pre-register the runner ' +\n 'compliance test keypair per test-kits/signed-requests-runner.yaml. ' +\n 'Forward-readiness: optional in AdCP 3.0; the schema (request_signing block description) ' +\n 'declares request signing required for spend-committing operations in AdCP 4.0. Sellers ' +\n 'that intend to support spend-committing tools SHOULD advertise the capability and ' +\n 'register the test keypair before the 4.0 cut to avoid a hard compliance failure then.',\n };\n }\n case 'multi_agent': {\n const routeKeys = collectMultiAgentRequirementRouteKeys(storyboard, options);\n if (routeKeys.length >= 2) break;\n const availableKeys = options.agents ? Object.keys(options.agents) : [];\n const routed = routeKeys.length ? routeKeys.join(', ') : '(none)';\n const available = availableKeys.length ? availableKeys.join(', ') : '(none)';\n return {\n requirement,\n detail:\n \"Storyboard requires 'multi_agent'; configure `agents` and route this storyboard \" +\n 'to at least two distinct agent keys via `default_agent` and/or step-level `agent:` overrides. ' +\n `Resolved route keys: [${routed}]. Available agents: [${available}].`,\n };\n }\n }\n }\n return { ...(preparedPublisherAuthProbes && { preparedPublisherAuthProbes }) };\n}\n\nfunction collectMultiAgentRequirementRouteKeys(storyboard: Storyboard, options: StoryboardRunOptions): string[] {\n const agents = options.agents;\n if (!agents) return [];\n\n const routeKeys = new Set<string>();\n if (options.default_agent !== undefined && options.default_agent in agents) {\n routeKeys.add(options.default_agent);\n }\n for (const phase of storyboard.phases ?? []) {\n for (const step of phase.steps ?? []) {\n if (step.agent !== undefined && step.agent in agents) {\n routeKeys.add(step.agent);\n }\n }\n }\n return [...routeKeys];\n}\n\nfunction resolveStoryboardRequires(storyboard: Storyboard, options: StoryboardRunOptions): string[] {\n const declared = storyboard.requires ?? [];\n const implicit = detectImplicitRequires(storyboard, options);\n return [...declared, ...implicit.filter(r => !declared.includes(r))];\n}\n\n/**\n * Webhook-token regex used to autodetect the implicit `webhook_receiver`\n * requirement. Matches `{{runner.webhook_url:<step_id>}}` and the bare\n * `{{runner.webhook_base}}`. Same shape as the `MUSTACHE_TOKEN_RE` in\n * context.ts but scoped to the two webhook-bearing tokens — we only care\n * whether the storyboard needs a receiver, not what substitution it\n * would produce. Single `[^{}]+` body avoids the polynomial-redos\n * backtrack pattern flagged by CodeQL alert #49.\n */\nconst WEBHOOK_TOKEN_RE = /\\{\\{runner\\.(?:webhook_url:[A-Za-z0-9_]+|webhook_base)\\}\\}/;\n\n/**\n * Recursively scan a JSON-like value for any webhook receiver token. The\n * scan only touches strings; objects and arrays are walked structurally\n * so deeply-nested `push_notification_config.url` entries (or any other\n * authoring pattern) are discovered without a hard-coded field list.\n */\nfunction valueContainsWebhookToken(value: unknown): boolean {\n if (typeof value === 'string') {\n return WEBHOOK_TOKEN_RE.test(value);\n }\n if (Array.isArray(value)) {\n return value.some(valueContainsWebhookToken);\n }\n if (value !== null && typeof value === 'object') {\n return Object.values(value as Record<string, unknown>).some(valueContainsWebhookToken);\n }\n return false;\n}\n\n/**\n * Return the implicit requirements a storyboard needs based on its\n * structure (not its declared `requires:` list). Today:\n * - `'webhook_receiver'`, autodetected from `{{runner.webhook_url:…}}`\n * / `{{runner.webhook_base}}` token presence inside any step's\n * `sample_request` or in-scope `rate_limit_trip.trip_target_sample_request`.\n * Token presence is the authoring contract — a storyboard that names\n * the runner's webhook receiver cannot run without one — so authors\n * don't need to remember to add `requires: [webhook_receiver]`\n * separately. Contract-gated synthetic steps only count when their\n * `requires_contract` is configured for this run. Rate-limit trip probes\n * additionally require the exact runner contract and explicit live-side-\n * effect authorization before their target request contributes an\n * implicit webhook requirement. Spec: adcp-client#1678.\n * - `'webhook_replay_receiver'`, autodetected from any\n * `replay_webhook_vector` step. These vectors target an inbound\n * buyer/orchestrator receiver, so without `webhook_replay_receiver.url`\n * the whole storyboard grades not_applicable instead of executing an\n * all-skipped phase that fails the required-phase rollup. Spec:\n * adcp-client#2356.\n * - `'trusted_match_context_router_runner'`, autodetected from any\n * `replay_trusted_match_context_vector` step. Without the operator-owned\n * registration seam the raw router test grades not_applicable and never\n * falls back to an MCP/A2A tool call. Spec: adcp-client#2479.\n * - `'request_signer'`, autodetected from `storyboard.id ===\n * 'signed_requests'` or any step using the synthesized\n * `request_signing_probe` task. The signed-requests universal\n * storyboard's own prerequisites section declares the\n * `request_signing.supported: true` capability gate; the runner\n * enforces it here so adopters don't see false-negative vector\n * failures on bearer-only agents that never claimed signing.\n * Spec: adcp-client#1702.\n */\nfunction detectImplicitRequires(\n storyboard: Storyboard,\n options: Pick<StoryboardRunOptions, 'contracts' | 'allowLiveSideEffects'> = {}\n): RequirementName[] {\n const requires: RequirementName[] = [];\n let needsWebhook = false;\n let needsWebhookReplayReceiver = false;\n let needsTrustedMatchContextRouterRunner = false;\n let needsSigner = storyboard.id === 'signed_requests';\n const contractsInScope = new Set(options.contracts ?? []);\n for (const phase of storyboard.phases) {\n for (const step of phase.steps) {\n const stepContractInScope = !step.requires_contract || contractsInScope.has(step.requires_contract);\n const rateLimitProbeInScope =\n step.task !== 'expect_rate_limit_not_replayed' ||\n (stepContractInScope &&\n contractsInScope.has(RATE_LIMIT_TRIP_CONTRACT) &&\n options.allowLiveSideEffects === true);\n if (\n !needsWebhook &&\n ((step.sample_request && rateLimitProbeInScope && valueContainsWebhookToken(step.sample_request)) ||\n (step.rate_limit_trip?.trip_target_sample_request &&\n stepContractInScope &&\n rateLimitProbeInScope &&\n valueContainsWebhookToken(step.rate_limit_trip.trip_target_sample_request)))\n ) {\n needsWebhook = true;\n }\n if (!needsSigner && step.task === 'request_signing_probe') {\n needsSigner = true;\n }\n if (!needsWebhookReplayReceiver && stepContractInScope && step.task === REPLAY_WEBHOOK_VECTOR_TASK) {\n needsWebhookReplayReceiver = true;\n }\n if (\n !needsTrustedMatchContextRouterRunner &&\n stepContractInScope &&\n step.task === REPLAY_TRUSTED_MATCH_CONTEXT_VECTOR_TASK\n ) {\n needsTrustedMatchContextRouterRunner = true;\n }\n if (needsWebhook && needsWebhookReplayReceiver && needsTrustedMatchContextRouterRunner && needsSigner) break;\n }\n if (needsWebhook && needsWebhookReplayReceiver && needsTrustedMatchContextRouterRunner && needsSigner) break;\n }\n if (needsWebhook) requires.push('webhook_receiver');\n if (needsWebhookReplayReceiver) requires.push('webhook_replay_receiver');\n if (needsTrustedMatchContextRouterRunner) requires.push('trusted_match_context_router_runner');\n if (needsSigner) requires.push('request_signer');\n return requires;\n}\n\n/**\n * Build a hard-failure StoryboardResult for when agent capability\n * discovery (`get_agent_info` / MCP `tools/list`) failed. Surfacing\n * discovery errors as a hard storyboard failure prevents the silent\n * \"X/X clean, 100% skipped\" failure mode where transport / auth\n * misconfiguration produced an empty `agentTools: []` and every step\n * skipped with `missing_tool`.\n *\n * @public — exported for direct testing of the failure-result shape;\n * called from `runStoryboard` when discovery throws.\n */\nexport function buildDiscoveryFailedResult(\n agentUrls: string[],\n storyboard: Storyboard,\n discoveryStep: TestStepResult\n): StoryboardResult {\n const detail = discoveryStep.error ?? 'Discovery failed (no agent tools advertised).';\n const syntheticStep: StoryboardStepResult = {\n storyboard_id: storyboard.id,\n step_id: 'discovery_failed',\n phase_id: 'discovery_failed',\n title: 'Storyboard failed: agent capability discovery did not succeed',\n task: '',\n passed: false,\n skipped: false,\n duration_ms: discoveryStep.duration_ms,\n validations: [],\n context: {},\n error: `Discovery failure: ${detail}. The runner refuses to proceed with empty agentTools — that mode produces silent \"all clean\" reports when the underlying transport / auth / network policy is broken. Fix the discovery error before re-running.`,\n extraction: { path: 'none' },\n };\n return {\n storyboard_id: storyboard.id,\n storyboard_title: storyboard.title,\n agent_url: redactOAuthUrlForOutput(agentUrls[0]!),\n overall_passed: false,\n phases: [\n {\n phase_id: 'discovery_failed',\n phase_title: 'Discovery failed',\n passed: false,\n steps: [syntheticStep],\n duration_ms: discoveryStep.duration_ms,\n },\n ],\n context: {},\n total_duration_ms: discoveryStep.duration_ms,\n passed_count: 0,\n failed_count: 1,\n skipped_count: 0,\n runner_capability_version: RUNNER_CAPABILITY_VERSION,\n tested_at: new Date().toISOString(),\n strict_validation_summary: {\n observable: false,\n checked: 0,\n passed: 0,\n failed: 0,\n strict_only_failures: 0,\n lenient_also_failed: 0,\n },\n notices: [],\n };\n}\n\n/**\n * Build a minimal StoryboardResult for a storyboard skipped because the agent\n * does not advertise any of the tools listed in `required_tools`. The result\n * carries `skip_reason: 'missing_tool'` and `overall_passed: true` so CLI\n * reports and JUnit consumers render it as a skip, not a failure.\n *\n * `missing_tool` (not `not_applicable`) is the correct canonical reason here:\n * the agent declared a compatible protocol/specialism but lacks the specific\n * tools this storyboard exercises — distinct from a protocol/version mismatch.\n */\nfunction buildRequiredToolsMissingResult(\n agentUrls: string[],\n storyboard: Storyboard,\n detail: string\n): StoryboardResult {\n return {\n storyboard_id: storyboard.id,\n storyboard_title: storyboard.title,\n agent_url: redactOAuthUrlForOutput(agentUrls[0]!),\n overall_passed: true,\n phases: [\n {\n phase_id: 'missing_tool',\n phase_title: 'Skipped — required tools not advertised',\n passed: true,\n duration_ms: 0,\n steps: [\n {\n storyboard_id: storyboard.id,\n step_id: 'missing_tool',\n phase_id: 'missing_tool',\n title: `Skipped — ${detail}`,\n task: '',\n passed: true,\n skipped: true,\n skip_reason: 'missing_tool' as const,\n skip: { reason: 'missing_tool' as const, detail },\n duration_ms: 0,\n validations: [],\n context: {},\n extraction: { path: 'none' },\n },\n ],\n },\n ],\n context: {},\n total_duration_ms: 0,\n passed_count: 0,\n failed_count: 0,\n skipped_count: 1,\n runner_capability_version: RUNNER_CAPABILITY_VERSION,\n tested_at: new Date().toISOString(),\n strict_validation_summary: {\n observable: false,\n checked: 0,\n passed: 0,\n failed: 0,\n strict_only_failures: 0,\n lenient_also_failed: 0,\n },\n notices: [],\n };\n}\n\n/**\n * Collect protocol-compliance notices for a storyboard run based on the\n * agent's declared capabilities. Returns an empty array when rawCaps is\n * absent (standalone runner without pre-fetched profile).\n *\n * Currently emits four spec-grounded notices (adcp-client#1704, #2082, #2461):\n *\n * - `capabilities_response_schema_invalid`: one informational notice per\n * schema issue, identified by its RFC 6901 `capability_pointer`.\n *\n * - `signed_requests_specialism_deprecated`: agent claims deprecated\n * `specialisms: ['signed-requests']` alongside `request_signing.supported:\n * true` on the signed_requests storyboard. The enum value is removed in\n * `effective_version: '4.0'`.\n *\n * - `request_signing.required`: `request_signing.supported` is absent or\n * false on the signed_requests storyboard. Signing becomes required for\n * spend-committing operations in `effective_version: '4.0'`.\n *\n * - `webhook_signing.legacy_hmac_fallback.removed`: agent claims\n * `webhook_signing.legacy_hmac_fallback: true`, which is removed in\n * `effective_version: '4.0'`.\n */\nfunction collectCapabilityNotices(storyboard: Storyboard, profile: AgentProfile | undefined): RunnerNotice[] {\n const notices: RunnerNotice[] = (profile?.capabilities_schema_issues ?? []).map(issue => ({\n severity: 'info',\n code: 'capabilities_response_schema_invalid',\n message:\n `The agent's get_adcp_capabilities response failed schema validation at ${issue.pointer || '/'}: ` +\n `${issue.message}. Track results may share this root cause; fix it first, then re-read the failures.`,\n capability_pointer: issue.pointer,\n docs_url: 'https://github.com/adcontextprotocol/adcp/issues/6254',\n storyboard_ids: [storyboard.id],\n }));\n const rawCaps = profile?.raw_capabilities;\n if (!rawCaps || typeof rawCaps !== 'object') return notices;\n const caps = rawCaps as Record<string, unknown>;\n\n // Notice: request_signing required in AdCP 4.0.\n // Fired when this is the signed_requests storyboard and the agent hasn't\n // declared request_signing support. The storyboard is identified by id OR\n // by the presence of a request_signing_probe step (mirrors the implicit-\n // require detection in detectImplicitRequires for PR #1703's gate).\n const isSignedRequestsNoticeStoryboard = storyboard.id === 'signed_requests';\n const isRequestSigningStoryboard =\n isSignedRequestsNoticeStoryboard ||\n storyboard.phases.some(p => p.steps.some(s => s.task === 'request_signing_probe'));\n if (isRequestSigningStoryboard) {\n const requestSigning = caps['request_signing'] as Record<string, unknown> | undefined;\n const specialisms = caps['specialisms'];\n // Canonical deprecation notice standardized by adcontextprotocol/adcp#4796.\n if (\n isSignedRequestsNoticeStoryboard &&\n requestSigning?.['supported'] === true &&\n Array.isArray(specialisms) &&\n specialisms.includes('signed-requests')\n ) {\n notices.push({\n severity: 'deprecation',\n code: 'signed_requests_specialism_deprecated',\n message:\n 'The `signed-requests` specialism claim is deprecated and removed in AdCP 4.0. ' +\n 'Drop it and rely on `request_signing.supported: true` instead.',\n effective_version: '4.0',\n capability_path: 'specialisms',\n docs_url: 'https://adcontextprotocol.org/docs/building/implementation/security#signed-requests-transport-layer',\n storyboard_ids: [storyboard.id],\n });\n }\n\n if (requestSigning?.['supported'] !== true) {\n notices.push({\n severity: 'future_required',\n code: 'request_signing.required',\n message:\n 'RFC 9421 request signing (`request_signing.supported: true`) is not advertised. ' +\n 'Required for spend-committing operations in AdCP 4.0 — declare the capability and ' +\n 'pre-register the runner compliance test keypair before the 4.0 cut.',\n effective_version: '4.0',\n capability_path: 'request_signing.supported',\n docs_url: 'https://adcontextprotocol.org/docs/building/implementation/security#signed-requests-transport-layer',\n storyboard_ids: [storyboard.id],\n });\n }\n }\n\n // Notice: legacy_hmac_fallback removed in AdCP 4.0.\n // Scoped via the WEBHOOK_STEP_TASKS step-task set rather than an id-regex.\n // Step-task presence is the authoring contract — a storyboard that asserts\n // webhook delivery uses one of these tasks. A storyboard id alone (e.g. a\n // hypothetical `webhook_authoring_guide`) shouldn't trigger the notice\n // unless it actually exercises the delivery path.\n const WEBHOOK_STEP_TASKS = new Set([\n 'expect_webhook',\n 'expect_no_webhook',\n 'expect_webhook_retry_keys_stable',\n 'expect_webhook_signature_valid',\n ]);\n const isWebhookRelatedStoryboard = storyboard.phases.some(p => p.steps.some(s => WEBHOOK_STEP_TASKS.has(s.task)));\n if (isWebhookRelatedStoryboard) {\n const webhookSigning = caps['webhook_signing'] as Record<string, unknown> | undefined;\n if (webhookSigning?.['legacy_hmac_fallback'] === true) {\n notices.push({\n severity: 'deprecation',\n code: 'webhook_signing.legacy_hmac_fallback.removed',\n message:\n '`webhook_signing.legacy_hmac_fallback: true` is deprecated and removed in AdCP 4.0. ' +\n 'Migrate webhook signature verification to RFC 9421 before the 4.0 cut.',\n effective_version: '4.0',\n capability_path: 'webhook_signing.legacy_hmac_fallback',\n docs_url: 'https://adcontextprotocol.org/docs/building/implementation/webhooks',\n storyboard_ids: [storyboard.id],\n });\n }\n }\n\n return notices;\n}\n\nfunction collectInputSchemaFieldStripNotices(debugLogs: unknown, storyboardId: string): RunnerNotice[] {\n if (!Array.isArray(debugLogs)) return [];\n const notices: RunnerNotice[] = [];\n const seen = new Set<string>();\n for (const entry of debugLogs) {\n if (!entry || typeof entry !== 'object') continue;\n const details = (entry as { details?: unknown }).details;\n if (!details || typeof details !== 'object') continue;\n const record = details as Record<string, unknown>;\n if (record.code !== 'input_schema_field_stripped') continue;\n const task = typeof record.task === 'string' ? record.task : 'unknown_task';\n const fields = Array.isArray(record.fields)\n ? record.fields.filter((field): field is string => typeof field === 'string')\n : [];\n if (fields.length === 0) continue;\n const key = `${task}\\u0000${fields.join('\\u0000')}`;\n if (seen.has(key)) continue;\n seen.add(key);\n notices.push({\n severity: 'info',\n code: 'input_schema_field_stripped',\n message:\n `Runner stripped request fields not declared by either the agent's tool input schema or the canonical AdCP ` +\n `request schema for ${task}: ${fields.join(', ')}. Check the caller or runner payload before changing the agent schema.`,\n docs_url: 'https://github.com/adcontextprotocol/adcp/issues/6437',\n storyboard_ids: [storyboardId],\n });\n }\n return notices;\n}\n\nfunction mergeRunnerNotices(notices: RunnerNotice[]): RunnerNotice[] {\n const byCode = new Map<string, RunnerNotice>();\n for (const notice of notices) {\n const key = runnerNoticeKey(notice);\n const existing = byCode.get(key);\n if (existing) {\n for (const sid of notice.storyboard_ids) {\n if (!existing.storyboard_ids.includes(sid)) existing.storyboard_ids.push(sid);\n }\n } else {\n byCode.set(key, { ...notice, storyboard_ids: [...notice.storyboard_ids] });\n }\n }\n return [...byCode.values()];\n}\n\nfunction runnerNoticeKey(notice: RunnerNotice): string {\n return notice.capability_pointer === undefined ? notice.code : `${notice.code}\\u0000${notice.capability_pointer}`;\n}\n\nfunction collectStepNotices(phases: StoryboardPhaseResult[]): RunnerNotice[] {\n return phases.flatMap(phase => phase.steps.flatMap(step => step.notices ?? []));\n}\n\n/**\n * Execute a single pass of the storyboard against the supplied replica URLs\n * using round-robin dispatch starting at `dispatchOffset`. Called directly\n * by `runStoryboard` (offset 0) and repeatedly by `runMultiPass` (offsets\n * 0..N-1). Taking the offset as an explicit parameter keeps the dispatcher\n * primitive out of the public `StoryboardRunOptions` type.\n */\nasync function executeStoryboardPass(\n agentUrls: string[],\n storyboard: Storyboard,\n options: StoryboardRunOptions,\n dispatchOffset: number,\n preSeeded?: PreSeededInput\n): Promise<StoryboardResult> {\n const start = Date.now();\n const isMultiInstance = agentUrls.length > 1;\n const useRouting = options.agents !== undefined;\n\n // Per-specialism routing builds its own clients + per-agent discovery; the\n // legacy single/multi-instance path discovers against the first replica.\n let clients: TestClient[];\n let routingContext: AgentRoutingContext | undefined;\n let profile: AgentProfile | undefined;\n let callerOwnsClients = false;\n\n if (useRouting) {\n try {\n routingContext = await buildRoutingContext(storyboard, options);\n } catch (err) {\n const detail = (err as Error)?.message ?? String(err);\n const failedStep: TestStepResult = {\n step:\n err instanceof DiscoveryFailure\n ? `Discover agent capabilities (${err.agentKey})`\n : 'Build agent routing index',\n passed: false,\n duration_ms: 0,\n error: detail,\n };\n await closeScopedConnections(options.protocol);\n return buildDiscoveryFailedResult(agentUrls, storyboard, failedStep);\n }\n clients = [...routingContext.clients.values()];\n // See note on the non-routing branch below: per-storyboard session reset\n // prevents a stale `pendingTaskId` from a prior storyboard's non-terminal\n // step from auto-threading into this storyboard's first call. (#1585)\n resetClientSessions(clients);\n // Pick the first agent's profile as the run-level \"primary\" for gates\n // that are evaluated before a step is routed (`requires_capability`,\n // notices). The dispatcher separately attaches the selected agent's\n // profile to each step assignment for capability-derived execution\n // behavior and per-step library-version hints.\n profile = [...routingContext.profiles.values()][0];\n // For `required_tools` gating, union every agent's advertised tools so\n // a storyboard that needs ≥1 of [sync_governance, activate_signal]\n // passes the gate when any tenant in the map serves either one.\n const unionedTools = new Set<string>();\n for (const p of routingContext.profiles.values()) {\n for (const t of normalizeAgentToolNames(p.tools) ?? []) unionedTools.add(t);\n }\n if (!options.agentTools) {\n options = { ...options, agentTools: [...unionedTools], _profile: profile };\n } else if (profile && !options._profile) {\n options = { ...options, _profile: profile };\n }\n } else {\n // Build one client per URL. In single-URL mode `_client` (from comply()) is\n // honored so the shared MCP transport is reused across storyboards.\n const clientResolutions = agentUrls.map(url => getOrCreateClientResolution(url, options));\n clients = clientResolutions.map(r => r.client);\n callerOwnsClients = clientResolutions.some(r => r.reusedShared);\n\n // Drop any retained A2A session ids before this storyboard's first call.\n // `comply()` shares one client across N storyboards for transport reuse;\n // AgentClient.retainSession holds onto `pendingTaskId` from non-terminal\n // responses (`submitted`/`working`/`input-required`) and auto-threads it\n // into every subsequent `message/send`. Without a per-storyboard reset, a\n // prior storyboard's stale `task_id` rides into the next storyboard's\n // first call (typically `get_products`) and the seller correctly\n // returns \"Task <uuid> not found\" on a buyer-side reference to a task it\n // never opened. (#1585)\n resetClientSessions(clients);\n\n // Discover agent profile against the first instance; all instances are\n // expected to run the same code behind a shared state store, so one probe\n // is sufficient. For multi-instance runs, skipping N-1 redundant\n // get_agent_info calls also keeps CI output clean.\n if (!callerOwnsClients) {\n const discovered = await getOrDiscoverProfile(clients[0]!, options);\n // Discovery failure must surface as a HARD STORYBOARD FAILURE, not a\n // silent empty `agentTools: []` that lets every step skip with\n // `missing_tool`. The latter mode produces \"X/X clean\" summaries with\n // 100% skipped — invisible CI failure when transport setup is broken\n // (auth misconfig, MCP transport-fallback bugs, network policy, etc.).\n // See: https://github.com/adcontextprotocol/adcp-client/issues/...\n if (discovered.step.passed === false) {\n await closeScopedConnections(options.protocol);\n return buildDiscoveryFailedResult(agentUrls, storyboard, discovered.step);\n }\n profile = discovered.profile;\n // Populate agentTools and _profile from discovered profile if not already set.\n // _profile is threaded into executeStep so capability-based skip gates\n // (e.g. account-mode branching) can read raw_capabilities at step time.\n const profileTools = normalizeAgentToolNames(profile?.tools);\n if (!options.agentTools && profileTools) {\n options = { ...options, agentTools: profileTools, _profile: profile };\n } else if (profile && !options._profile) {\n options = { ...options, _profile: profile };\n }\n } else {\n profile = options._profile;\n const profileTools = normalizeAgentToolNames(profile?.tools);\n if (!options.agentTools && profileTools) {\n options = { ...options, agentTools: profileTools, _profile: profile };\n } else if (\n !options.agentTools &&\n typeof (clients[0] as unknown as { getAgentInfo?: unknown })?.getAgentInfo === 'function'\n ) {\n const discovered = await getOrDiscoverProfile(clients[0]!, options);\n if (discovered.step.passed === false) {\n return buildDiscoveryFailedResult(agentUrls, storyboard, discovered.step);\n }\n profile = discovered.profile;\n const discoveredTools = normalizeAgentToolNames(profile?.tools);\n if (discoveredTools) {\n options = { ...options, agentTools: discoveredTools, _profile: profile };\n } else if (profile && !options._profile) {\n options = { ...options, _profile: profile };\n }\n }\n }\n }\n\n // Evaluate `requires` tags before any phase setup. The runner detects\n // which requirements are available on this run; an unmet requirement\n // skips the whole storyboard with `requirement_unmet` rather than\n // producing a cascade of `missing_test_controller` per-step skips.\n // Spec: adcp-client#1626. The default (no `requires` field) is\n // `[real_wire]`, which is always available — untagged storyboards\n // run unchanged.\n //\n // Implicit requirements (adcp-client#1678) are unioned with the\n // declared list: today this means `'webhook_receiver'` is added when\n // any step's `sample_request` references `{{runner.webhook_url:…}}`\n // or `{{runner.webhook_base}}`. Authors do not need to retag those\n // storyboards — the token presence is the declaration. Without the\n // implicit gate, storyboards that name the receiver but run without\n // one would silently ship literal mustache tokens on the wire and\n // get rejected by 3.0-strict sellers as `INVALID_REQUEST: relative URL`.\n // Pre-flight notice collection. Uses options._profile (set by the comply()\n // pipeline before calling runStoryboard) so the notices are available on\n // early-return results (requirement-unmet, capability-unsupported). In the\n // standalone runner path options._profile may be undefined; notices will be\n // collected again from the fully-fetched profile at result-build time.\n const preflightNotices = collectCapabilityNotices(storyboard, options._profile);\n\n // Capability applicability is intentionally first. Optional capability\n // storyboards must grade not_applicable for agents that did not opt in,\n // without inspecting or reporting any missing operator runtime adapter.\n if (storyboard.requires_capability) {\n const unmetDetail = evaluateRequiresCapabilityGate(\n storyboard.requires_capability,\n profile,\n options.agentTools,\n options.adcpVersion\n );\n if (unmetDetail !== null) {\n if (!callerOwnsClients) await closeScopedConnections(options.protocol);\n return {\n ...buildCapabilityUnsupportedResult(agentUrls, storyboard, unmetDetail),\n notices: preflightNotices,\n };\n }\n }\n\n const allRequires = resolveStoryboardRequires(storyboard, options);\n if (allRequires.length) {\n const requirementCheck = await checkRequires(allRequires, storyboard, options, profile);\n if ('requirement' in requirementCheck) {\n if (!callerOwnsClients) await closeScopedConnections(options.protocol);\n return {\n ...buildRequirementUnmetResult(agentUrls, storyboard, requirementCheck.requirement, requirementCheck.detail),\n notices: preflightNotices,\n };\n }\n if (requirementCheck.preparedPublisherAuthProbes) {\n options = withPreparedTrustedMatchPublisherAuth(options, requirementCheck.preparedPublisherAuthProbes);\n }\n }\n\n if (storyboard.required_any_of_tools?.length && options.agentTools) {\n const agentTools = new Set(options.agentTools);\n const missing = storyboard.required_any_of_tools.find(family => !family.tools.some(tool => agentTools.has(tool)));\n if (missing) {\n const detail =\n `missing_required_tool_family: needs ${missing.tools.join(' or ')}` +\n (missing.rationale ? ` (${missing.rationale})` : '');\n if (!callerOwnsClients) await closeScopedConnections(options.protocol);\n return {\n ...buildRequiredAnyOfToolsMissingResult(agentUrls, storyboard, detail),\n notices: preflightNotices,\n };\n }\n }\n\n // Enforce required_tools pre-flight gate: if the storyboard declares tools\n // that make it applicable (at least one must be present) and the agent\n // advertises none of them, skip the whole storyboard instead of producing\n // misleading per-step failures.\n //\n // Gate condition: `options.agentTools` is populated from discovery or\n // `_profile.tools` before this point, including reused-client callers when\n // discovery is available. If a direct `_client` caller supplies neither\n // `agentTools` nor a discoverable profile, this gate remains a no-op and\n // step-level `requires_tool` checks carry the compatibility signal.\n if (storyboard.required_tools?.length && options.agentTools) {\n const hasAnyRequired = storyboard.required_tools.some(t => options.agentTools!.includes(t));\n if (!hasAnyRequired) {\n if (!callerOwnsClients) await closeScopedConnections(options.protocol);\n return {\n ...buildRequiredToolsMissingResult(\n agentUrls,\n storyboard,\n `agent does not advertise any of [${storyboard.required_tools.join(', ')}]`\n ),\n notices: preflightNotices,\n };\n }\n }\n\n let context: StoryboardContext = { ...storyboard.context, ...options.context };\n if (storyboard.context) forwardAliasCache(storyboard.context, context);\n if (options.context) forwardAliasCache(options.context, context);\n const contributions = new Set<string>();\n // First phase/step that contributed each flag. Branch-set post-pass reads\n // this to emit the contract-mandated peer_branch_taken detail string\n // (\"<flag> contributed by <peer_phase_id>.<peer_step_id> — …\"). Only the\n // first contributor is recorded — downstream peers observing the same flag\n // are redundant and the contract calls out a single peer.\n const contributionSources = new Map<string, { phaseId: string; stepId: string }>();\n const priorStepResults = new Map<string, StoryboardStepResult>();\n const priorProbes = new Map<string, HttpProbeResult>();\n const contextProvenance = new Map<string, ContextProvenanceEntry>();\n const priorA2aEnvelopes = new Map<string, A2ATaskEnvelope>();\n const stepRequestStarts = new Map<string, string>();\n const responseDerivedNotApplicableContextKeys = new Map<string, string>();\n const phaseResults: StoryboardPhaseResult[] = [];\n let passedCount = 0;\n let failedCount = 0;\n let skippedCount = 0;\n const phaseCapabilitySkippedIds = new Set<string>();\n // Per-phase stateful-cascade tracking (#1161).\n //\n // Map entry exists iff the phase tripped its stateful cascade — i.e.,\n // a stateful step in the phase failed or skipped for a missing-state\n // reason. Value is the trigger context (skip-step diagnostic) OR null\n // when the trip was a real failure (failure-wins-within-phase rule, so\n // downstream cascade-detail says \"prior stateful step failed\" rather\n // than referencing an earlier benign skip).\n //\n // Replaces the storyboard-scope `statefulFailed` boolean: each phase's\n // stateful steps consult `phase.depends_on` (default: all prior phases)\n // to decide whether any upstream phase tripped. Independent phases\n // (`depends_on: []`) keep running even if other phases tripped.\n //\n // Within-phase cascade is preserved: once any stateful step in a phase\n // trips, subsequent stateful steps in the SAME phase cascade-skip\n // unconditionally (later steps need state from earlier steps in this\n // phase by storyboard authoring intent).\n //\n // `substitution_chain` is set when the trigger came from a\n // deferred-and-unrescued `peer_substitutes_for` declaration (#1144) so\n // the cascade-detail message can name the substitute(s) that didn't\n // pass. Absent for the immediate-trip path and the legacy any-peer\n // not_applicable path.\n type CascadeTrigger = {\n stepId: string;\n reason: RunnerSkipReason | RunnerDetailedSkipReason;\n substitution_chain?: string;\n };\n const phaseStatefulCascades = new Map<string, CascadeTrigger | null>();\n // Phase IDs in declaration order, accumulated as we iterate so the\n // default `depends_on` resolution (\"all prior phases\") doesn't re-scan\n // the storyboard. Phases push their own id at end-of-phase.\n const priorPhaseIds: string[] = [];\n\n // Phase → branch-set membership, resolved once up front so the stateful\n // cascade (and the post-loop branch-set re-grade) can consult it. Phases\n // outside any branch set are absent from the map.\n const branchSetsByPhaseId = resolveBranchSets(storyboard);\n\n // Helpers for per-phase cascade state.\n const effectiveDependsOn = (phase: { depends_on?: string[] }, prior: readonly string[]): readonly string[] =>\n phase.depends_on ?? prior;\n const cascadeForPhase = (\n phase: { id: string; depends_on?: string[] },\n prior: readonly string[]\n ): { tripped: true; trigger: CascadeTrigger | null } | { tripped: false } => {\n // Within-phase cascade always counts — stateful steps later in this\n // phase depend on state from stateful steps earlier in this phase.\n if (phaseStatefulCascades.has(phase.id)) {\n return { tripped: true, trigger: phaseStatefulCascades.get(phase.id) ?? null };\n }\n // Branch-set peers under `any_of` are mutually-exclusive ALTERNATIVES, not\n // a stateful dependency chain: a conformant seller satisfies exactly one\n // peer, so the non-taken peer(s) fail by design (storyboard-schema.yaml,\n // \"Per-step grading in any_of branch patterns\"). A peer's expected\n // failure must NOT cascade-skip a sibling peer — doing so suppresses the\n // only viable contribution and fails the any_of gate even though the\n // seller behaved conformantly. Exclude same-branch-set peers from this\n // phase's cascade dependencies. (adcontextprotocol/adcp-client#2305)\n //\n // Scoped to `any_of` deliberately: `BranchSetSpec.semantics` is typed\n // `string` to leave room for future semantics (e.g. `all_of`/`one_of`)\n // where peers legitimately DO depend on each other and must keep\n // cascading. `all_of` is rejected at load time today, so this is\n // forward-compat hardening rather than live behavior.\n const ownSpec = branchSetsByPhaseId.get(phase.id);\n const ownAnyOfBranchSet = ownSpec?.semantics === 'any_of' ? ownSpec.id : undefined;\n for (const depId of effectiveDependsOn(phase, prior)) {\n if (ownAnyOfBranchSet !== undefined && branchSetsByPhaseId.get(depId)?.id === ownAnyOfBranchSet) {\n continue;\n }\n if (phaseStatefulCascades.has(depId)) {\n return { tripped: true, trigger: phaseStatefulCascades.get(depId) ?? null };\n }\n }\n return { tripped: false };\n };\n // Step results whose failures the main loop added to failedCount. The\n // branch-set post-pass decrements only for entries that were actually\n // counted, so an optional phase that hit `presenceDetected` (a PRM 2xx\n // inside an otherwise-optional phase) has its leak correctly reversed.\n const countedAsFailed = new Set<StoryboardStepResult>();\n\n // Start an ephemeral webhook receiver when the run opts in. The base URL\n // is exposed via `{{runner.webhook_base}}` / `{{runner.webhook_url:<id>}}`\n // substitutions so storyboards can inject per-step URLs into\n // `push_notification_config.url`. See adcontextprotocol/adcp#2431.\n const webhookReceiver = options.webhook_receiver\n ? await createWebhookReceiver({\n ...(options.webhook_receiver.mode && { mode: options.webhook_receiver.mode }),\n ...(options.webhook_receiver.host !== undefined && { host: options.webhook_receiver.host }),\n ...(options.webhook_receiver.port !== undefined && { port: options.webhook_receiver.port }),\n ...(options.webhook_receiver.public_url !== undefined && { public_url: options.webhook_receiver.public_url }),\n })\n : undefined;\n const runnerVars = createRunnerVariables({\n ...(webhookReceiver && { webhookBase: webhookReceiver.base_url }),\n });\n // Pre-arm retry-replay policies for any expect_webhook_retry_keys_stable\n // steps. Ordering matters: the receiver must be rejecting deliveries\n // before the triggering step fires its webhook, otherwise the first\n // delivery succeeds and the sender never retries.\n if (webhookReceiver) armWebhookAssertions(storyboard, runnerVars, webhookReceiver);\n\n // Flatten all steps for next-step preview lookups\n const allSteps = flattenSteps(storyboard);\n // Inner passes always dispatch round-robin; only the outer runMultiPass\n // caller knows about the multi-pass strategy. This keeps createDispatcher's\n // strategy parameter narrow. Per-specialism routing (#1066) takes the\n // routing dispatcher path, which reads `options.agents` directly and\n // ignores `agentUrls` ordering for selection (still uses URL list for\n // result-record `agent_url:` echo).\n const dispatch =\n routingContext && options.agents\n ? createRoutingDispatcher(routingContext, options, options.agents)\n : createDispatcher(agentUrls, clients, 'round-robin', dispatchOffset, profile);\n\n // Resolve cross-step assertions declared on `storyboard.invariants`.\n // `resolveAssertions` throws on unknown ids — fail fast here rather than\n // silently skip, since a missing assertion means unknown conformance gaps.\n const assertions = resolveAssertions(storyboard.invariants);\n // Step-level `invariants.disable` uses the resolved set as its universe:\n // an id is only a valid step-level opt-out if it actually runs on this\n // storyboard. Typos and dead-code references (already disabled run-wide)\n // fail fast here for the same reason.\n validateStepInvariants(storyboard, assertions);\n const assertionContexts = new Map<string, AssertionContext>();\n for (const spec of assertions) {\n assertionContexts.set(spec.id, {\n storyboard,\n agentUrl: agentUrls[0]!,\n options,\n state: {},\n });\n }\n const assertionResults: AssertionResult[] = [];\n let assertionsFailed = false;\n for (const spec of assertions) {\n if (spec.onStart) await spec.onStart(assertionContexts.get(spec.id)!);\n }\n\n // Placeholder storyboards with no executable phases get a distinct skip\n // reason per the runner-output contract. Without this, the overall result\n // would pass vacuously — `passed_count === 0 && failed_count === 0` — and\n // an implementor reading the report can't tell \"nothing tested\" from\n // \"everything passed\".\n const hasExecutableSteps = storyboard.phases.some(p => p.steps.length > 0);\n const phaseCapabilitySkipDetails = collectPhaseCapabilitySkipDetails(\n storyboard,\n profile,\n options.agentTools,\n options.adcpVersion\n );\n const skipControllerSeedingForPhaseGates = allExecutablePhasesCapabilitySkipped(\n storyboard,\n phaseCapabilitySkipDetails\n );\n const capabilitySkippedPhaseIds = new Set([\n ...phaseCapabilitySkipDetails.keys(),\n ...storyboard.phases.filter(phase => shouldSkipPhase(phase, options)).map(phase => phase.id),\n ]);\n let creativeAssetFixtureGap = preflightRemainingCreativeAssetDirectives(\n allSteps,\n -1,\n context,\n options,\n {\n contributions,\n priorStepResults,\n priorProbes,\n agentUrl: agentUrls[0]!,\n webhookReceiver,\n runnerVars,\n contextProvenance,\n priorA2aEnvelopes,\n stepRequestStarts,\n responseDerivedNotApplicableContextKeys,\n agentProfile: profile,\n agentLibraryVersion: profile?.library_version,\n storyboardRequiresRequestSigner: allRequires.includes('request_signer'),\n storyboardRequiresPublisherAuthRunner:\n storyboard.requires?.includes('trusted_match_publisher_auth_runner') === true,\n },\n capabilitySkippedPhaseIds\n );\n let creativeAssetFixtureGapRecorded = false;\n if (!hasExecutableSteps) {\n const isScenarioComposed = (storyboard.requires_scenarios?.length ?? 0) > 0;\n const detail = isScenarioComposed\n ? `Storyboard \"${storyboard.id}\" has no local phases — its test surface is fully composed from the scenarios listed in \\`requires_scenarios\\`.`\n : `Storyboard \"${storyboard.id}\" has no executable phases — populate \\`phases[].steps\\` or remove the storyboard.`;\n const syntheticStep: StoryboardStepResult = {\n storyboard_id: storyboard.id,\n // Synthetic sentinel. Functionally non-colliding because downstream\n // consumers (CLI report, storyboard-tracks) key on `skip_reason`,\n // not `phase_id`/`step_id`. Matches the documented `RunnerSkipReason`\n // vocabulary in storyboard/types.ts.\n step_id: 'no_phases',\n phase_id: 'no_phases',\n title: 'Storyboard has no executable phases',\n task: '',\n passed: true,\n skipped: true,\n skip_reason: 'no_phases',\n skip: buildSkip('no_phases', detail),\n duration_ms: 0,\n validations: [],\n context,\n error: detail,\n extraction: { path: 'none' },\n };\n phaseResults.push({\n phase_id: 'no_phases',\n phase_title: 'No phases',\n passed: true, // skipped step is neutral — phase must not fail\n steps: [syntheticStep],\n duration_ms: 0,\n });\n skippedCount++;\n }\n\n // Pre-flight controller seeding (adcp-client#778). When the storyboard\n // declares `prerequisites.controller_seeding: true` and carries a\n // `fixtures:` block, fire the corresponding `seed_*` scenarios on\n // `comply_test_controller` so the seller's catalog / ledger holds every\n // fixture id the downstream phases reference. On any seed failure we\n // cascade-skip the remaining phases with `controller_seeding_failed` so\n // the report shows \"setup broke\" instead of a thicket of per-step\n // PRODUCT_NOT_FOUND / VALIDATION_ERROR failures. Runs against the first\n // client only: in multi-instance mode the seller is expected to share\n // state across replicas (that is what multi-instance tests exist to\n // verify). Sellers that hold per-replica state must opt out via\n // `skip_controller_seeding`.\n //\n // The seeding phase is held in a sidecar rather than pushed into\n // `phaseResults` up-front so every downstream consumer that indexes\n // `phaseResults[i]` against `storyboard.phases[i]` (branch-set grading,\n // `requiredPhasesPassed`) keeps working. It is spliced to the front of\n // `phaseResults` at the end so the report reads top-to-bottom in the\n // order the runner actually executed things.\n //\n // Multi-pass mode populates `preSeeded` so seeding fires exactly once\n // across all passes — see `runMultiPass`. Without the sidecar, every\n // pass would re-seed and the aggregator's cross-pass sum would inflate\n // `failed_count`/`skipped_count` by N when a single fixture broke.\n let seedingPhaseResult: StoryboardPhaseResult | null = null;\n let seedingFailed = false;\n let seedingMissingController = false;\n let seedingUnsupported = false;\n let fixtureUnsatisfied = false;\n let fixtureBindings: FixtureBindingRegistry | undefined;\n let fixtureResolutionRecords: FixtureResolutionRecord[] | undefined;\n let fixtureCoverageGap: FixtureResolutionCoverageGap | undefined;\n {\n let fixtureSeedClient = clients[0]!;\n let fixtureDiscoveryClient = clients[0]!;\n if (routingContext && options.agents) {\n const fixtureStep = (task: string): StoryboardStep => ({\n id: `__fixture_resolution_${task}__`,\n title: `Fixture resolution via ${task}`,\n task,\n });\n if (options.agentTools?.includes('comply_test_controller')) {\n fixtureSeedClient = dispatch.nextFor(fixtureStep('comply_test_controller')).client;\n }\n if (options.agentTools?.includes('get_products')) {\n fixtureDiscoveryClient = dispatch.nextFor(fixtureStep('get_products')).client;\n }\n }\n const seeding = creativeAssetFixtureGap\n ? null\n : skipControllerSeedingForPhaseGates\n ? null\n : preSeeded !== undefined\n ? preSeeded.result\n : await runControllerSeeding(fixtureSeedClient, storyboard, options, context, fixtureDiscoveryClient);\n if (seeding) {\n const attach = preSeeded === undefined || preSeeded.attach;\n if (attach) {\n seedingPhaseResult = seeding.phase;\n passedCount += seeding.passedCount;\n failedCount += seeding.failedCount;\n if (seeding.missingController || seeding.seedUnsupported || seeding.fixtureUnsatisfied) {\n skippedCount += seeding.phase.steps.filter(step => step.skipped).length;\n }\n }\n fixtureBindings = seeding.bindings;\n fixtureResolutionRecords = seeding.resolutionRecords;\n fixtureUnsatisfied = seeding.fixtureUnsatisfied === true && seeding.failedCount === 0;\n if (fixtureUnsatisfied) {\n // Fixture coverage is the more specific storyboard-level reason when\n // an authored placeholder has no executable phases. Do not retain the\n // generic no_phases sentinel or count both reasons.\n const noPhasesIndex = phaseResults.findIndex(phase => phase.phase_id === 'no_phases');\n if (noPhasesIndex >= 0) {\n skippedCount -= phaseResults[noPhasesIndex]!.steps.filter(step => step.skipped).length;\n phaseResults.splice(noPhasesIndex, 1);\n }\n // Multi-pass attaches/counts pre-flight resolution only on pass one,\n // so the aggregate contains exactly one storyboard-level skip.\n if (attach) skippedCount += 1;\n }\n const hasUnsatisfiedFixtures = fixtureResolutionRecords?.some(record => record.status === 'unsatisfied') === true;\n if (hasUnsatisfiedFixtures && fixtureResolutionRecords) {\n const fixtures = fixtureResolutionRecords\n .filter(record => record.status === 'unsatisfied')\n .map(record => ({\n fixture_type: record.fixture_type,\n handle: record.handle,\n ...(record.product_handle && { product_handle: record.product_handle }),\n requirements: record.requirements,\n }));\n const names = fixtures.map(fixture =>\n fixture.fixture_type === 'pricing_option'\n ? `pricing_option \"${fixture.product_handle}/${fixture.handle}\"`\n : `product \"${fixture.handle}\"`\n );\n fixtureCoverageGap = {\n reason: 'fixture_unsatisfied',\n detail: `fixture_unsatisfied: no seller fixture satisfied ${names.join(', ')}`,\n fixtures,\n };\n }\n if (seeding.missingController) {\n seedingMissingController = true;\n } else if (seeding.seedUnsupported) {\n seedingUnsupported = true;\n } else if (!seeding.allPassed) {\n seedingFailed = true;\n }\n }\n }\n\n const buildExecutionState = (\n agentUrl = agentUrls[0]!,\n agentProfile: AgentProfile | undefined = profile\n ): ExecutionState => ({\n contributions,\n priorStepResults,\n priorProbes,\n agentUrl,\n webhookReceiver,\n runnerVars,\n contextProvenance,\n priorA2aEnvelopes,\n stepRequestStarts,\n responseDerivedNotApplicableContextKeys,\n agentProfile,\n agentLibraryVersion: agentProfile?.library_version,\n storyboardRequiresRequestSigner: allRequires.includes('request_signer'),\n storyboardRequiresPublisherAuthRunner:\n storyboard.requires?.includes('trusted_match_publisher_auth_runner') === true,\n fixtureBindings,\n });\n if (\n !creativeAssetFixtureGap &&\n !seedingMissingController &&\n !seedingUnsupported &&\n !seedingFailed &&\n !fixtureUnsatisfied\n ) {\n creativeAssetFixtureGap = preflightRemainingCreativeAssetDirectives(\n allSteps,\n -1,\n context,\n options,\n buildExecutionState(),\n capabilitySkippedPhaseIds\n );\n }\n\n for (const phase of storyboard.phases) {\n // adcp-client#1612: bail at phase boundaries when comply()'s combined\n // timeout/external signal has aborted. Without this the phase loop runs\n // to completion regardless of the outer budget.\n options.signal?.throwIfAborted();\n const phaseStart = Date.now();\n\n // A pure resolution miss is one storyboard-level skip, not an\n // ordinary-step skip. Short-circuit before capability and other phase\n // gates so no ordinary rows or per-step counts are produced for this run.\n if (fixtureUnsatisfied) {\n phaseResults.push({\n phase_id: phase.id,\n phase_title: phase.title,\n passed: true,\n steps: [],\n duration_ms: 0,\n });\n continue;\n }\n\n // A captured seller format proved that a future creative directive cannot\n // be synthesized. Preserve earlier observations, record the directive\n // step once, and leave every other remaining phase empty: no side effect\n // or prerequisite cascade may occur after this runner-owned coverage gap.\n if (creativeAssetFixtureGap) {\n const gapSteps: StoryboardStepResult[] = [];\n if (!creativeAssetFixtureGapRecorded && creativeAssetFixtureGap.target.phaseId === phase.id) {\n const gapStep = buildCreativeAssetFixtureUnavailableStep(\n creativeAssetFixtureGap.target.step,\n phase.id,\n context,\n allSteps,\n buildExecutionState(),\n creativeAssetFixtureGap.failure\n );\n gapStep.storyboard_id = storyboard.id;\n gapSteps.push(gapStep);\n priorStepResults.set(gapStep.step_id, gapStep);\n skippedCount++;\n creativeAssetFixtureGapRecorded = true;\n }\n phaseResults.push({\n phase_id: phase.id,\n phase_title: phase.title,\n passed: true,\n steps: gapSteps,\n duration_ms: 0,\n });\n priorPhaseIds.push(phase.id);\n continue;\n }\n\n const phaseCapabilitySkipDetail = phaseCapabilitySkipDetails.get(phase.id);\n if (phaseCapabilitySkipDetail !== undefined) {\n const skippedSteps = buildPhaseCapabilitySkippedSteps(storyboard, phase, phaseCapabilitySkipDetail, context);\n phaseResults.push({\n phase_id: phase.id,\n phase_title: phase.title,\n passed: true,\n steps: skippedSteps,\n duration_ms: Date.now() - phaseStart,\n });\n skippedCount += skippedSteps.length;\n phaseCapabilitySkippedIds.add(phase.id);\n priorPhaseIds.push(phase.id);\n continue;\n }\n const stepResults: StoryboardStepResult[] = [];\n let phasePassed = true;\n // `statefulFailed` and `statefulSkipTrigger` live at storyboard\n // scope (declared above the phase loop) so the cascade survives\n // cross-phase setup → assertion patterns. See declaration site for\n // the rationale (signal_marketplace/governance_denied story).\n //\n // Phase-scoped substitution tracking (adcp-client#1005, round-9; #1144).\n //\n // Two deferral paths:\n // 1. `not_applicable` on a stateful step (any-peer rescue) — preserved\n // from the F6 fix. Rescued by ANY passing stateful step in the\n // phase. Backward-compatible with storyboards that haven't adopted\n // explicit substitution declarations.\n // 2. `missing_tool` / `missing_test_controller` on a stateful step\n // WITH a declared substitute peer (`peer_substitutes_for`) in the\n // same phase. Rescued ONLY when the declared substitute actually\n // passes. Without a declaration, hard-missing reasons trip the\n // cascade immediately as before.\n //\n // Path (2) is opt-in via storyboard YAML: a substitute step declares\n // `peer_substitutes_for: <target_step_id>` to assert that its passing\n // establishes equivalent state. Phase membership alone is NOT treated\n // as substitutability — explicit declaration is required.\n let phasePendingNotApplicable: { stepId: string; reason: RunnerSkipReason | RunnerDetailedSkipReason } | null =\n null;\n let phaseEstablishedStatefulState = false;\n // Path (2): index of declared substitutions for this phase. Map keys\n // are target step IDs (the steps being substituted FOR); values are the\n // step IDs that declared the substitution. Built once per phase from\n // each step's `provides_state_for` field (or the deprecated\n // `peer_substitutes_for` synonym; the loader normalizes both onto\n // `provides_state_for` at parse time, so reading either works).\n const phaseSubstitutes = new Map<string, string[]>();\n for (const declaringStep of phase.steps) {\n const decl = declaringStep.provides_state_for ?? declaringStep.peer_substitutes_for;\n if (decl === undefined) continue;\n const targets = Array.isArray(decl) ? decl : [decl];\n for (const target of targets) {\n const arr = phaseSubstitutes.get(target) ?? [];\n arr.push(declaringStep.id);\n phaseSubstitutes.set(target, arr);\n }\n }\n // Path (2) state. `phasePendingMissingTool` is the deferred-cascade\n // trigger for a stateful step that skipped with a hard-missing reason\n // AND has at least one declared substitute in this phase. Only the\n // first such trigger is recorded — the cascade-detail message\n // references the leftmost step.\n let phasePendingMissingTool: {\n stepId: string;\n reason: RunnerSkipReason | RunnerDetailedSkipReason;\n substitutes: string[];\n } | null = null;\n // Targets actually rescued by a passing declared substitute. Populated\n // when a step with `provides_state_for: X` (or the deprecated synonym\n // `peer_substitutes_for: X`) passes — every X in its declaration list\n // lands here.\n const phaseRescuedTargets = new Set<string>();\n // Map from rescued target id → the substitute step id that rescued it.\n // Populated when the substitute passes; consumed at phase end to format\n // the spec-mandated `peer_substituted` detail string. First substitute\n // wins if multiple peers cover the same target.\n const phaseRescueSource = new Map<string, string>();\n // Stateful step IDs in the phase. Used at phase end to decide whether\n // a deferred not_applicable trigger should cascade: if the sole stateful\n // step in the phase returned not_applicable AND there were no peers that\n // could have established substitute state, the cascade should NOT fire —\n // the platform simply doesn't use that pathway, which is valid. Only when\n // peer-stateful steps existed (and none established state) do we promote\n // the pending trigger to a hard cascade. Computed eagerly at phase\n // initialization so it's always available when the resolution block runs.\n const phaseStatefulStepIds = phase.steps.filter(s => s.stateful).map(s => s.id);\n // PRM presence-probe state (adcp-client#677). `phaseAbsent` flips when\n // /.well-known/oauth-protected-resource returns 404 — subsequent steps\n // in this phase cascade-skip instead of failing their http_status:200\n // validations. `presenceDetected` flips when PRM returns a 2xx: the\n // agent IS advertising OAuth, so validation failures in this phase\n // become hard failures regardless of `optional: true`, closing the\n // spoofing path where a broken PRM + valid API key could silently pass.\n let phaseAbsent = false;\n let presenceDetected = false;\n\n if (shouldSkipPhase(phase, options)) {\n phaseResults.push({\n phase_id: phase.id,\n phase_title: phase.title,\n passed: true, // optional phase skipped — neutral\n steps: [],\n duration_ms: 0,\n });\n continue;\n }\n\n // Pre-empt OAuth-metadata probes when the agent's capabilities never\n // advertised OAuth at all (adcp-client#1702). Without this, an\n // API-key-only agent (e.g. Wonderstruck) has its PRM endpoint\n // probed; if the well-known path returns anything other than 404\n // (the existing reactive cascade trigger in `executeProbeStep`),\n // validations fail and `oauth_discovery` produces 5 false-negative\n // step failures even though the phase is `optional: true`. The skip\n // is phase-level — not storyboard-level — so the universal\n // `unauth_rejection` and `mechanism_required` phases still run.\n if (!phaseAbsent && phaseContainsOauthMetadataProbe(phase) && !agentAdvertisesOauth(profile)) {\n phaseAbsent = true;\n }\n\n // Reset alias cache at this phase boundary (#1657). $generate:uuid_v4#alias\n // is designed to be stable within a scenario — the initial call and its\n // idempotency replay share the same UUID — but aliases must NOT bleed across\n // phases. Independent test groups that each start with a \"setup\" step need\n // fresh idempotency keys; otherwise the seller's idempotency cache replays\n // stale state from a prior group into the new one. Creating a new object\n // identity drops the WeakMap entry without losing any $context.* values\n // (those ride as plain properties on the spread result).\n context = { ...context };\n\n // Seeding-cascade skip: the pre-flight seed phase can fail as a setup\n // break, or the agent can be out-of-scope for fixture seeding because it\n // lacks either the controller tool or a required seed_* scenario. Emit\n // full step rows so implementors see which buyer-side operations were\n // elided.\n if (seedingMissingController || seedingUnsupported || seedingFailed) {\n const cascadeSkip: Pick<StoryboardStepResult, 'skip_reason' | 'skip'> = seedingMissingController\n ? {\n skip_reason: 'missing_test_controller',\n skip: { reason: 'missing_test_controller', detail: SKIP_DETAILS.missing_test_controller },\n }\n : seedingUnsupported\n ? {\n skip_reason: 'fixture_seed_unsupported',\n skip: { reason: 'not_applicable', detail: FIXTURE_SEED_UNSUPPORTED_DETAIL },\n }\n : seedingFailed\n ? {\n skip_reason: 'controller_seeding_failed',\n skip: { reason: 'prerequisite_failed', detail: CONTROLLER_SEEDING_FAILED_DETAIL },\n }\n : {\n skip_reason: 'controller_seeding_failed',\n skip: { reason: 'prerequisite_failed', detail: CONTROLLER_SEEDING_FAILED_DETAIL },\n };\n const cascadeSteps: StoryboardStepResult[] = phase.steps.map(step => ({\n storyboard_id: storyboard.id,\n step_id: step.id,\n phase_id: phase.id,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n ...cascadeSkip,\n duration_ms: 0,\n validations: [],\n context,\n extraction: { path: 'none' },\n }));\n phaseResults.push({\n phase_id: phase.id,\n phase_title: phase.title,\n passed: true,\n steps: cascadeSteps,\n duration_ms: 0,\n });\n skippedCount += cascadeSteps.length;\n continue;\n }\n\n for (const step of phase.steps) {\n // adcp-client#1612: per-step abort gate. The dominant comply() cost\n // on a healthy seller is sequential per-tool calls inside a single\n // storyboard's phase — without this check the phase runs to completion\n // even after comply() has already signalled \"give up\".\n options.signal?.throwIfAborted();\n // Cascade-skip when the PRM presence probe declared the phase absent.\n if (phaseAbsent) {\n const cascadeResult: StoryboardStepResult = {\n storyboard_id: storyboard.id,\n step_id: step.id,\n phase_id: phase.id,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: 'oauth_not_advertised',\n skip: { reason: 'not_applicable', detail: OAUTH_NOT_ADVERTISED_DETAIL },\n duration_ms: 0,\n validations: [],\n context,\n extraction: { path: 'none' },\n };\n stepResults.push(cascadeResult);\n priorStepResults.set(step.id, cascadeResult);\n skippedCount++;\n continue;\n }\n\n // Skip remaining steps if a stateful dependency failed (or\n // skipped for a missing-state reason). Before applying the\n // cascade reason, check the step's intrinsic skip-eligibility:\n // if the agent never advertised this step's tool, the correct\n // reason is `missing_tool` (a benign, passed: true skip) —\n // not `prerequisite_failed` (a failed skip). This distinguishes\n // \"this agent has a real setup bug\" from \"this agent doesn't\n // claim this surface, by design\" (adcp-client#1169 / #1171).\n //\n // Uses resolveTaskName so that $test_kit.* steps are checked\n // against the resolved concrete task name, not the template\n // string (which would never be in agentTools).\n //\n // Per-phase cascade scoping (#1161): consults `phase.depends_on`\n // (default: all prior phases) plus the current phase's own\n // within-phase cascade state. Replaces the storyboard-scope\n // `statefulFailed` boolean.\n const cascade = step.stateful ? cascadeForPhase(phase, priorPhaseIds) : { tripped: false };\n if (cascade.tripped && step.stateful) {\n const resolvedTask = resolveTaskName(step, options);\n if (options.agentTools && resolvedTask && !options.agentTools.includes(resolvedTask)) {\n const toolDetail = `Agent did not advertise tool \"${resolvedTask}\"; agent tools: [${options.agentTools.join(', ')}].`;\n const missingToolResult: StoryboardStepResult = {\n storyboard_id: storyboard.id,\n step_id: step.id,\n phase_id: phase.id,\n title: step.title,\n task: resolvedTask,\n passed: true,\n skipped: true,\n skip_reason: 'missing_tool',\n skip: buildSkip('missing_tool', toolDetail),\n duration_ms: 0,\n validations: [],\n context,\n extraction: { path: 'none' },\n };\n stepResults.push(missingToolResult);\n priorStepResults.set(step.id, missingToolResult);\n skippedCount++;\n continue;\n }\n const trigger = (cascade as { tripped: true; trigger: CascadeTrigger | null }).trigger;\n const detail = trigger\n ? trigger.substitution_chain\n ? `Skipped: prior stateful step \"${trigger.stepId}\" skipped (${trigger.reason}); ${trigger.substitution_chain}; state never materialized.`\n : `Skipped: prior stateful step \"${trigger.stepId}\" skipped (${trigger.reason}); state never materialized.`\n : 'Skipped: prior stateful step failed.';\n stepResults.push({\n storyboard_id: storyboard.id,\n step_id: step.id,\n phase_id: phase.id,\n title: step.title,\n task: step.task,\n passed: false,\n skipped: true,\n skip_reason: 'prerequisite_failed',\n skip: buildSkip('prerequisite_failed', detail),\n duration_ms: 0,\n validations: [],\n context,\n error: detail,\n extraction: { path: 'none' },\n });\n skippedCount++;\n phasePassed = false;\n continue;\n }\n\n let assignment;\n try {\n assignment = dispatch.nextFor(step);\n } catch (err) {\n // Routing failures land here when no agent in the map serves a\n // step's tool's protocol. Build-time conflict detection already\n // catches the multi-claim case, so this branch covers genuine\n // coverage gaps (storyboard authored a tool the topology can't\n // serve) and unmapped tools without a `default_agent`. Render as\n // a failed step with the routing error verbatim so the report\n // tells the operator exactly what's missing.\n const detail = err instanceof RoutingError ? err.message : ((err as Error)?.message ?? String(err));\n const failed: StoryboardStepResult = {\n storyboard_id: storyboard.id,\n step_id: step.id,\n phase_id: phase.id,\n title: step.title,\n task: step.task,\n passed: false,\n duration_ms: 0,\n validations: [],\n context,\n error: detail,\n extraction: { path: 'none' },\n };\n stepResults.push(failed);\n priorStepResults.set(step.id, failed);\n failedCount++;\n phasePassed = false;\n continue;\n }\n const stepExecutionState = buildExecutionState(assignment.agentUrl, assignment.profile);\n const rawResult = await executeStep(\n assignment.client,\n step,\n storyboard.id,\n phase.id,\n context,\n allSteps,\n options,\n stepExecutionState\n );\n const result: StoryboardStepResult = { ...rawResult, storyboard_id: storyboard.id };\n if (isMultiInstance || useRouting) {\n // Echo per-step routing on the result so JUnit/CI consumers and\n // bug reports show which agent served which tool. In routed mode\n // every step gets the field; in replica round-robin only when\n // there are 2+ URLs.\n result.agent_url = redactOAuthUrlForOutput(assignment.agentUrl);\n result.agent_index = assignment.instanceIndex + 1;\n }\n stepResults.push(result);\n priorStepResults.set(step.id, result);\n\n // Schema-validation short-circuit (adcp-client#1709). When the\n // response unwrapper rejected the agent's response against the SDK's\n // Zod schema, the step-execution path synthesized a failing\n // `response_schema` ValidationResult on `result.validations`.\n // Running step-scope invariants against a response the SDK has\n // already declared malformed produces noise — the invariants\n // can't meaningfully grade a payload that didn't parse. Worse,\n // before #1709 the invariants' failure entries crowded out the\n // schema-validation entry in `extractFailures`, masking the root\n // cause across BidMachine's 10+ deploys (see adcp#4419). Skip the\n // invariant pass entirely on this step and emit a single skipped\n // `assertion` entry per invariant so consumers can still see WHICH\n // invariants were skipped and why.\n const schemaInvalidResponse = result.validations.some(\n v => v.check === 'response_schema' && validationFailsStep(v)\n );\n\n // Rate-limit exhaustion is a contract-defined applicability result,\n // not a response to grade. Preserve its empty validations array and\n // passing skip status. Step assertions still run and remain visible on\n // the storyboard-level assertions surface, but are not mirrored onto\n // this skipped step or counted as a failed step.\n const rateLimitTripNotApplicable = result.skipped === true && result.skip_reason === 'rate_limit_not_triggered';\n\n // Fire per-step assertions. Each result is appended to the step's\n // `validations[]` under `check: \"assertion\"` so existing UI renders\n // them alongside inline checks, and mirrored into `assertionResults`\n // for the storyboard-level `assertions[]` surface. Any failure flips\n // `result.passed` so the counting below treats it like a validation\n // failure — that's what makes assertions gating, not advisory.\n for (const spec of assertions) {\n if (!spec.onStep) continue;\n // Per-step opt-out: authors use `step.invariants.disable: [id]` to\n // suppress a default invariant on a step that deliberately models\n // behavior the invariant would flag (validated at runner start).\n if (stepDisablesAssertion(step.invariants, spec.id)) continue;\n if (schemaInvalidResponse) {\n // Emit a skipped marker so the report shows the invariant was\n // intentionally bypassed (not silently dropped). `passed: true`\n // keeps it from flipping `result.passed` — the schema-validation\n // failure already did that.\n result.validations.push({\n check: 'assertion',\n passed: true,\n description: `${spec.id}: skipped — response failed schema validation (adcp-client#1709)`,\n });\n continue;\n }\n const raw = await spec.onStep(assertionContexts.get(spec.id)!, result);\n for (const r of raw) {\n const full: AssertionResult = { ...r, assertion_id: spec.id, scope: 'step', step_id: step.id };\n assertionResults.push(full);\n if (!rateLimitTripNotApplicable) {\n result.validations.push({\n check: 'assertion',\n passed: r.passed,\n description: `${spec.id}: ${r.description}`,\n ...(r.error !== undefined && { error: r.error }),\n });\n }\n // Issue #935: assertions can attach a structured hint that the\n // runner mirrors into the owning step's `hints[]`. Producers today\n // include `status.monotonic` (monotonic_violation) and\n // `impairment.coherence` (impairment_coherence_violation); the\n // merge here keeps the taxonomy unified so a single CLI/JUnit/Addie\n // renderer can drive off `step.hints[]` regardless of which\n // subsystem produced it.\n if (r.hint) {\n const existing = result.hints ?? [];\n result.hints = [...existing, r.hint];\n }\n if (!r.passed) {\n if (!rateLimitTripNotApplicable) result.passed = false;\n assertionsFailed = true;\n }\n }\n }\n\n // PRM presence accounting — must happen after the step result lands so\n // both the skipped-404 and 2xx paths are visible.\n if (step.task === 'protected_resource_metadata') {\n if (result.skipped && result.skip_reason === 'oauth_not_advertised') {\n phaseAbsent = true;\n } else {\n const status = (result.response as HttpProbeResult | undefined)?.status;\n if (typeof status === 'number' && status >= 200 && status < 300) {\n presenceDetected = true;\n }\n }\n }\n\n // Record contribution on success, honoring optional contributes_if predicate.\n if (!result.skipped && result.passed && step.contributes_to) {\n if (evalContributesIf(step.contributes_if, priorStepResults)) {\n const flag = step.contributes_to;\n if (!contributions.has(flag)) {\n contributionSources.set(flag, { phaseId: phase.id, stepId: step.id });\n }\n contributions.add(flag);\n }\n }\n\n if (result.skipped) {\n skippedCount++;\n context = result.context;\n // Cascade-skip extension: a stateful step that SKIPS because the\n // agent simply lacks the tool (`missing_tool`,\n // `missing_test_controller`) is equivalent to a failed stateful\n // step — state genuinely never materialized. Trip immediately so\n // downstream stateful steps skip with `prerequisite_failed`\n // instead of running against absent state and surfacing a\n // misleading assertion failure.\n //\n // `not_applicable` is handled separately (adcp-client#1005,\n // round-9). It signals \"this path doesn't apply to this agent\",\n // and the storyboard may have a peer step in the same phase\n // that establishes equivalent state — e.g. an explicit-mode\n // seller's `list_accounts` substituting for `sync_accounts`.\n // We record a pending trigger and let the rest of the phase\n // run; the cascade decision is finalized at phase end based on\n // whether any stateful peer passed.\n //\n // Skips that imply state DID materialize via another path\n // (`peer_branch_taken`, `controller_seeding_failed` — handled\n // by phase-level cascade, `oauth_not_advertised` — phase-absent\n // path) deliberately don't trip the flag.\n if (step.stateful) {\n if (isHardMissingStateSkipReason(result.skip_reason)) {\n // Hard-missing skip on a stateful step. Defer the cascade only\n // when a peer in this phase has declared\n // `peer_substitutes_for: <this_step_id>` — that peer's pass\n // establishes equivalent state. Without a declaration,\n // missing_tool / missing_test_controller trips the cascade\n // immediately (existing behavior).\n const substitutes = phaseSubstitutes.get(step.id);\n if (substitutes && substitutes.length > 0) {\n if (phasePendingMissingTool === null) {\n phasePendingMissingTool = {\n stepId: step.id,\n reason: result.skip_reason ?? 'missing_tool',\n substitutes,\n };\n }\n } else {\n // Sole-stateful-step exemption (adcp-client-python#550):\n // when a hard-missing skip lands on the ONLY stateful step\n // in the phase, no peer could have established substitute\n // state — same shape as #1146's `not_applicable` exemption.\n // The platform legitimately doesn't implement this pathway\n // (e.g., proposal-mode / implicit-account adopters that\n // skip `sync_accounts` because account state materializes\n // on the first `get_products` call). Cascading every\n // downstream phase to `prerequisite_failed` collapses\n // useful coverage; let downstream phases run and fail on\n // their own merits if state genuinely never materialized.\n //\n // The skipping step is always stateful and always in\n // `phaseStatefulStepIds` (built eagerly at phase init), so\n // length > 1 ⇔ a stateful peer exists.\n const hasStatefulPeers = phaseStatefulStepIds.length > 1;\n if (hasStatefulPeers && !phaseStatefulCascades.has(phase.id)) {\n // Multiple stateful steps in the phase but no declared\n // substitute. Trip the cascade. First trip wins —\n // subsequent triggers don't overwrite, since the cascade\n // text references the originating diagnostic (the\n // leftmost missing-state stateful step in the phase).\n phaseStatefulCascades.set(phase.id, {\n stepId: step.id,\n reason: result.skip_reason ?? 'missing_tool',\n });\n } else if (!hasStatefulPeers && result.skip) {\n // Exemption applied. Surface the runner's decision on the\n // step result so adopters reading per-step output don't\n // have to infer it from the absence of downstream skips.\n result.skip = {\n ...result.skip,\n detail: result.skip.detail + soleStatefulExemptionDetail(phase.id),\n };\n }\n }\n } else if (result.skip_reason === 'not_applicable') {\n // Defer cascade decision until end of phase. Applies the\n // same first-wins rule used for `statefulSkipTrigger`: the\n // eventual cascade-detail message references the leftmost\n // not_applicable step in the phase.\n //\n // Scope note: this branch matches the canonical literal\n // `'not_applicable'` only. Detailed-form skip reasons that\n // canonicalize to not_applicable (`probe_skipped`,\n // `not_in_only_vectors`, `grader_skipped`,\n // `mcp_mode_flattens_url_edges`) carry the detailed form\n // on `result.skip_reason` and do NOT enter the deferred\n // path — they preserve the pre-fix behavior of not\n // tripping the cascade. `oauth_not_advertised` is handled\n // by the separate `phaseAbsent` code path before this\n // branch is reached. If a future detailed reason should\n // participate in substitute-aware deferral, extend this\n // condition deliberately rather than assuming canonical\n // mapping is enough.\n if (phasePendingNotApplicable === null) {\n phasePendingNotApplicable = { stepId: step.id, reason: 'not_applicable' };\n }\n }\n }\n } else if (result.passed) {\n context = result.context;\n passedCount++;\n // A passing stateful step counts as the phase establishing\n // state. If a sibling skipped not_applicable earlier (or skips\n // it later in the loop), this pass is the substitute path —\n // the deferred cascade should NOT fire at phase end.\n if (step.stateful) {\n phaseEstablishedStatefulState = true;\n // Path (2) rescue tracking: a passing step that declared\n // `provides_state_for: X` (or the deprecated synonym\n // `peer_substitutes_for`) rescues X. Recorded against every\n // declared target so phase-end resolution sees the target as\n // covered even if its skip arrives later in the loop.\n const decl = step.provides_state_for ?? step.peer_substitutes_for;\n if (decl !== undefined) {\n const targets = Array.isArray(decl) ? decl : [decl];\n for (const target of targets) {\n phaseRescuedTargets.add(target);\n // Track the rescuing substitute's id so phase-end can format\n // the contract-mandated `peer_substituted` detail string.\n if (!phaseRescueSource.has(target)) {\n phaseRescueSource.set(target, step.id);\n }\n }\n }\n }\n } else {\n phasePassed = false;\n // Optional phases normally swallow step failures — the storyboard's\n // final assert_contribution gate decides pass/fail via the \"API key\n // OR OAuth\" logic. Exception: once a PRM presence probe has\n // detected the agent IS advertising OAuth, subsequent validation\n // failures in this phase are hard failures (adcp-client#677). An\n // agent that serves PRM MUST serve it correctly.\n if (!phase.optional || presenceDetected) {\n failedCount++;\n countedAsFailed.add(result);\n }\n if (step.stateful) {\n // Real failure takes precedence over a prior skip-trigger in\n // the cascade detail message — failures are the worse\n // diagnostic, so downstream cascade-skipped steps should\n // reference the failure rather than the earlier benign-ish\n // missing-state skip. `null` trigger encodes \"real failure,\n // detail says 'prior stateful step failed'.\"\n phaseStatefulCascades.set(phase.id, null);\n }\n // In multi-instance mode, annotate the failure with the cross-instance\n // attribution block so CI readers pattern-match it as a deployment bug.\n if (isMultiInstance) {\n annotateMultiInstanceFailure(result, storyboard, stepResults);\n }\n }\n\n if (!result.skipped && result.passed) {\n const currentGlobalIndex = allSteps.find(\n flat => flat.phaseId === phase.id && flat.step.id === step.id\n )?.globalIndex;\n if (currentGlobalIndex !== undefined) {\n creativeAssetFixtureGap = preflightRemainingCreativeAssetDirectives(\n allSteps,\n currentGlobalIndex,\n context,\n options,\n stepExecutionState,\n capabilitySkippedPhaseIds\n );\n }\n if (creativeAssetFixtureGap) {\n if (creativeAssetFixtureGap.target.phaseId === phase.id) {\n const gapStep = buildCreativeAssetFixtureUnavailableStep(\n creativeAssetFixtureGap.target.step,\n phase.id,\n context,\n allSteps,\n stepExecutionState,\n creativeAssetFixtureGap.failure\n );\n gapStep.storyboard_id = storyboard.id;\n stepResults.push(gapStep);\n priorStepResults.set(gapStep.step_id, gapStep);\n skippedCount++;\n creativeAssetFixtureGapRecorded = true;\n }\n break;\n }\n }\n }\n\n // Phase-end cascade resolution for deferred `not_applicable` triggers.\n // If a stateful step skipped not_applicable earlier in this phase and\n // no stateful peer subsequently passed, we MAY promote to a hard cascade\n // so downstream phases skip cleanly instead of running against absent state.\n //\n // Cascade fires ONLY when there was at least one other stateful step in\n // the phase that could have served as a substitute — i.e. the phase had\n // peer steps, but none of them established state (#1146). A peer that\n // passed (e.g. `list_accounts` substituting for an explicit-mode\n // `sync_accounts`) cancels the trigger entirely. A peer that *failed*\n // already tripped this phase's cascade at the failure site with the\n // worse-diagnostic real-failure message; we defer to that and don't\n // overwrite.\n //\n // When the not_applicable step was the SOLE stateful step in the phase\n // (no peers existed at all), the cascade does NOT fire. That platform\n // simply doesn't use this sync pathway — which is valid. Cascading on a\n // sole not_applicable would incorrectly penalise adapters that manage\n // state implicitly and have no list_accounts peer (adcp-client#1146).\n if (phasePendingNotApplicable && !phaseEstablishedStatefulState && !phaseStatefulCascades.has(phase.id)) {\n const hadStatefulPeers = phaseStatefulStepIds.some(id => id !== phasePendingNotApplicable!.stepId);\n if (hadStatefulPeers) {\n phaseStatefulCascades.set(phase.id, phasePendingNotApplicable);\n } else {\n // Sole-stateful-step exemption fired. Mark the not_applicable\n // step result so adopters see the runner's decision explicitly\n // (parity with the missing_tool / missing_test_controller path\n // upstream — both decision sites annotate the skip detail).\n const naResult = stepResults.find(r => r.step_id === phasePendingNotApplicable!.stepId);\n if (naResult?.skip) {\n naResult.skip = {\n ...naResult.skip,\n detail: naResult.skip.detail + soleStatefulExemptionDetail(phase.id),\n };\n }\n }\n }\n\n // Phase-end cascade resolution for deferred `missing_tool` triggers\n // (#1144). A stateful step that skipped with a hard-missing reason\n // and had at least one declared substitute (`provides_state_for`,\n // formerly `peer_substitutes_for`) was deferred above. If none of\n // the declared substitutes passed, the substitution path failed to\n // establish state — promote to a hard cascade with a detail message\n // that names the substitute(s) tried so adopters reading the report\n // see the substitution chain rather than a bare `missing_tool`\n // cascade origin.\n if (\n phasePendingMissingTool &&\n !phaseRescuedTargets.has(phasePendingMissingTool.stepId) &&\n !phaseStatefulCascades.has(phase.id)\n ) {\n const subs = phasePendingMissingTool.substitutes;\n const subsList = subs.length === 1 ? `\"${subs[0]}\"` : subs.map(s => `\"${s}\"`).join(', ');\n phaseStatefulCascades.set(phase.id, {\n stepId: phasePendingMissingTool.stepId,\n reason: phasePendingMissingTool.reason,\n substitution_chain: `declared substitute ${subsList} did not pass`,\n });\n }\n\n // Phase-end re-grading for rescued targets (adcp#3734, AdCP 3.0.3+).\n // When a deferred `missing_tool` / `missing_test_controller` skip was\n // rescued by a passing same-phase substitute, the spec mandates the\n // target be re-graded with `skip_reason: 'peer_substituted'` and the\n // detail string `\"<target_step_id> state provided by <phase_id>.<substitute_step_id>\"`\n // — see `runner-output-contract.yaml` > `skip_result.reasons.peer_substituted`.\n // Without this re-grading the target keeps its original `missing_tool`\n // grade, which is misleading: state DID materialize, just via a\n // declared substitute path. Tracked: adcp-client#1267.\n for (const target of phaseRescuedTargets) {\n const sourceId = phaseRescueSource.get(target);\n if (!sourceId) continue;\n const targetResult = stepResults.find(r => r.step_id === target);\n if (!targetResult || !targetResult.skipped) continue;\n // Only re-grade hard-missing-state skips. Other skip reasons (e.g.\n // `prerequisite_failed`, `peer_branch_taken`) on the target are\n // outside the substitute-rescue contract. Uses the same helper as\n // the deferral path (line ~1269 above) so the two sides stay in\n // lockstep when a future RunnerSkipReason joins the family.\n if (!isHardMissingStateSkipReason(targetResult.skip_reason)) continue;\n const detail = `${target} state provided by ${phase.id}.${sourceId}`;\n targetResult.skip_reason = 'peer_substituted';\n targetResult.skip = { reason: 'peer_substituted', detail };\n }\n\n phaseResults.push({\n phase_id: phase.id,\n phase_title: phase.title,\n passed: phasePassed,\n steps: stepResults,\n duration_ms: Date.now() - phaseStart,\n });\n // Accumulate phase id for default `depends_on` resolution in the next\n // iteration — phases declared later see this one as a prior phase.\n priorPhaseIds.push(phase.id);\n }\n\n // Branch-set post-pass: phases in a branch set (explicit `branch_set:`\n // declaration or implicit detection via shared `contributes_to` + a later\n // any_of `assert_contribution`) whose flag was contributed by a peer have\n // their failed steps re-graded as skipped with `peer_branch_taken`. See\n // storyboard-schema.yaml (lines 205-223) and runner-output-contract.yaml\n // (reasons.peer_branch_taken). Done after all phases run — peer\n // contribution status isn't knowable inside the per-phase loop. Runs\n // before storyboard-scoped assertions so `onEnd` hooks see the finalized\n // per-step grades (a moot peer's \"failure\" should not trip a cross-step\n // invariant). `branchSetsByPhaseId` was resolved before the phase loop so\n // the stateful cascade could consult it (branch-set peers don't cascade\n // onto each other); reuse it here.\n const branchSetDelta = creativeAssetFixtureGap\n ? { skippedDelta: 0 }\n : applyBranchSetGrading(\n storyboard.phases,\n phaseResults,\n branchSetsByPhaseId,\n contributions,\n contributionSources,\n countedAsFailed\n );\n skippedCount += branchSetDelta.skippedDelta;\n\n // Fire storyboard-scoped assertions. These observe the full run and can\n // emit `scope: \"storyboard\"` findings that flip `overall_passed` without\n // being attributable to a single step (e.g. \"saw >1 acquire for the same\n // replayed idempotency_key across the run\").\n if (!creativeAssetFixtureGap) {\n for (const spec of assertions) {\n if (!spec.onEnd) continue;\n const raw = await spec.onEnd(assertionContexts.get(spec.id)!);\n for (const r of raw) {\n assertionResults.push({ ...r, assertion_id: spec.id, scope: 'storyboard' });\n if (!r.passed) assertionsFailed = true;\n }\n }\n }\n\n // Overall pass requires (a) no required-phase failures, (b) either an\n // executed pass or every required phase grading canonically not_applicable,\n // and (c) no assertion failures. Without (b), a storyboard where every phase\n // is optional or every required step is skipped for another reason (for\n // example, missing_tool) would pass vacuously.\n // (c) makes assertions gating — a run with all validations green but a\n // cross-step invariant broken is not conformant.\n // When no phases had executable steps the storyboard result is a skip, not a\n // failure. The index-aligned guard below would hit storyboard.phases[0] ===\n // undefined for an empty-phases storyboard and force requiredPhasesPassed to\n // false, flipping overall_passed to false. Short-circuit to true so the\n // no-phases sentinel produces overall_passed: true (consistent with how\n // buildNotApplicableStoryboardResult shapes its result in comply.ts).\n const requiredPhaseHasExecutedPass = phaseResults.some((p, idx) => {\n const phaseDef = storyboard.phases[idx];\n if (!phaseDef || phaseDef.optional || !p.passed) return false;\n return p.steps.some(s => !s.skipped && s.passed);\n });\n const requiredPhaseDefs = storyboard.phases.filter(phaseDef => !phaseDef.optional);\n const requiredPhasesNotApplicable =\n requiredPhaseDefs.length > 0 &&\n requiredPhaseDefs.every(phaseDef => {\n const phaseResult = phaseResults.find(p => p.phase_id === phaseDef.id);\n return (\n !!phaseResult &&\n phaseResult.passed &&\n phaseResult.steps.length > 0 &&\n phaseResult.steps.every(step => step.skipped && step.skip?.reason === 'not_applicable')\n );\n });\n const requiredPhasesCoveredByCapabilityGates =\n phaseCapabilitySkippedIds.size > 0 &&\n requiredPhaseDefs.length > 0 &&\n requiredPhaseDefs.every(phaseDef => {\n if (phaseCapabilitySkippedIds.has(phaseDef.id)) return true;\n const phaseResult = phaseResults.find(p => p.phase_id === phaseDef.id);\n return !!phaseResult && phaseResult.passed && phaseResult.steps.some(s => !s.skipped && s.passed);\n });\n const requiredPhasesPassed =\n !hasExecutableSteps ||\n requiredPhaseHasExecutedPass ||\n requiredPhasesNotApplicable ||\n (failedCount === 0 && requiredPhasesCoveredByCapabilityGates);\n const storyboardWideFixtureUnavailable =\n (seedingUnsupported || fixtureUnsatisfied || creativeAssetFixtureGap !== undefined) && failedCount === 0;\n // Prepend the pre-flight seeding phase now that every consumer that\n // index-aligns `phaseResults` with `storyboard.phases` has run. Reader\n // order matches execution order.\n if (seedingPhaseResult) phaseResults.unshift(seedingPhaseResult);\n const schemasUsed = collectSchemasUsed(phaseResults);\n const strictSummary = summarizeStrictValidation(phaseResults);\n const validationsNotApplicable = countValidationsNotApplicable(phaseResults);\n const validationsAdvisoryFailed = countValidationsAdvisoryFailed(phaseResults);\n // Use the fully-fetched profile for notice detection; fall back to pre-flight\n // notices (which used options._profile) when profile was not re-fetched in\n // this pass (standalone runner with options._profile pre-set skips the fetch).\n const notices = mergeRunnerNotices([\n ...collectCapabilityNotices(storyboard, profile ?? options._profile),\n ...collectStepNotices(phaseResults),\n ]);\n const result: StoryboardResult = {\n storyboard_id: storyboard.id,\n storyboard_title: storyboard.title,\n agent_url: redactOAuthUrlForOutput(agentUrls[0]!),\n ...(isMultiInstance && { agent_urls: agentUrls.map(redactOAuthUrlForOutput) }),\n // Inner multi-pass passes surface as `round-robin` (that's what they are\n // individually); the aggregating wrapper relabels the top-level result\n // `multi-pass`.\n ...(isMultiInstance && { multi_instance_strategy: 'round-robin' as const }),\n ...(routingContext && {\n agent_map: Object.fromEntries(\n Object.entries(routingContext.agentMap).map(([specialism, url]) => [specialism, redactOAuthUrlForOutput(url)])\n ),\n }),\n overall_passed:\n failedCount === 0 && (requiredPhasesPassed || storyboardWideFixtureUnavailable) && !assertionsFailed,\n phases: phaseResults,\n context,\n total_duration_ms: Date.now() - start,\n passed_count: passedCount,\n failed_count: failedCount,\n skipped_count: skippedCount,\n ...(validationsAdvisoryFailed > 0 ? { validations_advisory_failed: validationsAdvisoryFailed } : {}),\n ...(validationsNotApplicable > 0 ? { validations_not_applicable: validationsNotApplicable } : {}),\n runner_capability_version: RUNNER_CAPABILITY_VERSION,\n tested_at: new Date().toISOString(),\n ...(schemasUsed.length > 0 ? { schemas_used: schemasUsed } : {}),\n ...(assertionResults.length > 0 ? { assertions: assertionResults } : {}),\n strict_validation_summary: strictSummary,\n notices,\n ...(fixtureResolutionRecords && { fixture_resolutions: fixtureResolutionRecords }),\n ...(fixtureCoverageGap && { coverage_gaps: [fixtureCoverageGap] }),\n ...(routingContext && routingContext.discoveryFailures.length > 0\n ? {\n discovery_failures: routingContext.discoveryFailures.map(f => ({\n agent_key: f.agentKey,\n url: redactOAuthUrlForOutput(f.url),\n error: redactOAuthUrlsInText(f.underlying),\n })),\n }\n : {}),\n };\n\n // Close protocol connections when the runner created its own client. The\n // The runner scope tracks every URL used by this storyboard, so one scoped\n // close releases all of its transports without disrupting concurrent runs.\n if (!callerOwnsClients) {\n await closeScopedConnections(options.protocol);\n }\n\n if (webhookReceiver) await webhookReceiver.close();\n\n return result;\n}\n\n/**\n * Run the storyboard N times — once per replica — with the round-robin\n * dispatcher starting at a different replica each pass. Lets each step hit\n * a different replica across passes, so a bug isolated to one replica\n * (stale config, divergent version, local cache miss) surfaces on the pass\n * that sends the relevant step there.\n *\n * Known limitation (follow-up adcontextprotocol/adcp-client#607 option 2):\n * for N=2, offset-shift preserves pair parity — a write→read pair whose\n * dispatch indices differ by an even amount lands same-replica in every\n * pass (the canonical property_lists case: write at step 0, read at step\n * 2). Cross-replica state-persistence testing at N=2 is primarily the job\n * of single-pass round-robin (which catches adjacent write→read pairs);\n * dependency-aware dispatch that reads `context_inputs` and assigns a\n * replica different from the writer of the specific state key being read\n * is the spec-aligned fix for non-adjacent pairs and should be preferred\n * over multi-pass for that purpose.\n *\n * The aggregated result AND-combines `overall_passed` across passes, sums\n * the pass/fail/skip counts, and exposes the per-pass detail via `passes[]`.\n * The top-level `phases` is the first pass's phases so single-pass consumers\n * keep working; richer consumers read `passes[]`.\n */\nasync function runMultiPass(\n agentUrls: string[],\n storyboard: Storyboard,\n options: StoryboardRunOptions\n): Promise<StoryboardResult> {\n const start = Date.now();\n\n // Run pre-flight controller seeding ONCE at the run level (adcp-client#778)\n // so the aggregator doesn't sum N redundant seed batches into\n // `failed_count` / `skipped_count`. Every pass inherits the same outcome;\n // only the first pass attaches the synthetic `__controller_seeding__`\n // phase to its `phaseResults`, so the aggregated top-level counts reflect\n // a single seeding pass across the whole run.\n const preSeedClients = agentUrls.map(url => getOrCreateClientResolution(url, options).client);\n const preSeedContext: StoryboardContext = { ...storyboard.context, ...options.context };\n if (storyboard.context) forwardAliasCache(storyboard.context, preSeedContext);\n if (options.context) forwardAliasCache(options.context, preSeedContext);\n let preSeedProfile = options._profile;\n if (!preSeedProfile) {\n const discovered = await getOrDiscoverProfile(preSeedClients[0]!, options);\n if (discovered.step.passed === false) {\n await closeScopedConnections(options.protocol);\n return buildDiscoveryFailedResult(agentUrls, storyboard, discovered.step);\n }\n preSeedProfile = discovered.profile;\n }\n if (preSeedProfile && (!options._profile || !options.agentTools)) {\n options = {\n ...options,\n _profile: preSeedProfile,\n ...(options.agentTools ? {} : { agentTools: normalizeAgentToolNames(preSeedProfile.tools) }),\n };\n }\n\n // runStoryboardBody cannot evaluate capability-gated requirements until\n // this multi-pass preflight has discovered the profile. Resolve both gates\n // once here so an optional capability remains not_applicable and a missing\n // run-scoped harness remains one storyboard skip rather than N pass skips.\n if (storyboard.requires_capability) {\n const unmetDetail = evaluateRequiresCapabilityGate(\n storyboard.requires_capability,\n preSeedProfile,\n options.agentTools,\n options.adcpVersion\n );\n if (unmetDetail !== null) {\n await closeScopedConnections(options.protocol);\n return {\n ...buildCapabilityUnsupportedResult(agentUrls, storyboard, unmetDetail),\n notices: collectCapabilityNotices(storyboard, preSeedProfile),\n };\n }\n }\n const allRequires = resolveStoryboardRequires(storyboard, options);\n if (allRequires.length > 0) {\n const requirementCheck = await checkRequires(allRequires, storyboard, options, preSeedProfile);\n if ('requirement' in requirementCheck) {\n await closeScopedConnections(options.protocol);\n return {\n ...buildRequirementUnmetResult(agentUrls, storyboard, requirementCheck.requirement, requirementCheck.detail),\n notices: collectCapabilityNotices(storyboard, preSeedProfile),\n };\n }\n if (requirementCheck.preparedPublisherAuthProbes) {\n options = withPreparedTrustedMatchPublisherAuth(options, requirementCheck.preparedPublisherAuthProbes);\n }\n }\n const phaseCapabilitySkipDetails = collectPhaseCapabilitySkipDetails(\n storyboard,\n preSeedProfile,\n options.agentTools,\n options.adcpVersion\n );\n const preSeedExcludedPhaseIds = new Set([\n ...phaseCapabilitySkipDetails.keys(),\n ...storyboard.phases.filter(phase => shouldSkipPhase(phase, options)).map(phase => phase.id),\n ]);\n const preSeedFixtureGap = preflightRemainingCreativeAssetDirectives(\n flattenSteps(storyboard),\n -1,\n preSeedContext,\n options,\n {\n contributions: new Set(),\n priorStepResults: new Map(),\n priorProbes: new Map(),\n agentUrl: agentUrls[0]!,\n },\n preSeedExcludedPhaseIds\n );\n const preSeededResult =\n preSeedFixtureGap || allExecutablePhasesCapabilitySkipped(storyboard, phaseCapabilitySkipDetails)\n ? null\n : await runControllerSeeding(preSeedClients[0]!, storyboard, options, preSeedContext);\n\n const passes: StoryboardPassResult[] = [];\n const passResults: StoryboardResult[] = [];\n for (let passIdx = 0; passIdx < agentUrls.length; passIdx++) {\n const passSeeded: PreSeededInput = { result: preSeededResult, attach: passIdx === 0 };\n const result = await executeStoryboardPass(agentUrls, storyboard, options, passIdx, passSeeded);\n passResults.push(result);\n passes.push({\n pass_index: passIdx + 1,\n dispatch_offset: passIdx,\n overall_passed: result.overall_passed,\n phases: result.phases,\n passed_count: result.passed_count,\n failed_count: result.failed_count,\n skipped_count: result.skipped_count,\n ...(result.validations_advisory_failed\n ? { validations_advisory_failed: result.validations_advisory_failed }\n : {}),\n ...(result.validations_not_applicable ? { validations_not_applicable: result.validations_not_applicable } : {}),\n duration_ms: result.total_duration_ms,\n });\n }\n\n const first = passResults[0]!;\n const overallPassed = passes.every(p => p.overall_passed);\n const passed = passes.reduce((sum, p) => sum + p.passed_count, 0);\n const failed = passes.reduce((sum, p) => sum + p.failed_count, 0);\n const skipped = passes.reduce((sum, p) => sum + p.skipped_count, 0);\n const advisoryFailed = passes.reduce((sum, p) => sum + (p.validations_advisory_failed ?? 0), 0);\n const notApplicable = passes.reduce((sum, p) => sum + (p.validations_not_applicable ?? 0), 0);\n const schemasUsed = passResults.flatMap(r => r.schemas_used ?? []);\n const schemasDedup = [...new Map(schemasUsed.map(s => [s.schema_id, s])).values()];\n // Assertions are scoped per-pass — each pass's runner resolved them\n // independently and reported `assertion_id` identically. Concatenate so\n // readers see a per-pass timeline; de-duplicating would hide a real\n // \"passed on pass 1, failed on pass 2\" divergence.\n const assertionsAgg = passResults.flatMap((r, index) =>\n (r.assertions ?? []).map(assertion => ({ ...assertion, pass_index: index + 1 }))\n );\n // Notices are identical across passes (same agent, same capabilities).\n // Schema-invalid capabilities notices retain one row per RFC 6901 pointer.\n const noticesDedup = [...new Map(passResults.flatMap(r => r.notices).map(n => [runnerNoticeKey(n), n])).values()];\n\n return {\n storyboard_id: storyboard.id,\n storyboard_title: storyboard.title,\n agent_url: redactOAuthUrlForOutput(agentUrls[0]!),\n agent_urls: agentUrls.map(redactOAuthUrlForOutput),\n multi_instance_strategy: 'multi-pass',\n overall_passed: overallPassed,\n phases: first.phases,\n passes,\n context: first.context,\n total_duration_ms: Date.now() - start,\n passed_count: passed,\n failed_count: failed,\n skipped_count: skipped,\n ...(advisoryFailed > 0 ? { validations_advisory_failed: advisoryFailed } : {}),\n ...(notApplicable > 0 ? { validations_not_applicable: notApplicable } : {}),\n runner_capability_version: RUNNER_CAPABILITY_VERSION,\n tested_at: new Date().toISOString(),\n ...(schemasDedup.length > 0 ? { schemas_used: schemasDedup } : {}),\n ...(assertionsAgg.length > 0 ? { assertions: assertionsAgg } : {}),\n ...(first.fixture_resolutions ? { fixture_resolutions: first.fixture_resolutions } : {}),\n ...(first.coverage_gaps ? { coverage_gaps: first.coverage_gaps } : {}),\n notices: noticesDedup,\n };\n}\n\n/**\n * Collect a deduplicated list of schemas applied during this run. Drawn\n * from every validation result with a schema_id; dropping empties keeps\n * the list proportional to what actually ran.\n */\n/**\n * Count validation results graded `not_applicable` across every step. Per\n * runner-output-contract.yaml v2.0.0 these come from the forward-compat\n * default in the validation dispatcher: when a storyboard declares an\n * authored `check` value the runner does not implement, the dispatcher\n * grades it `passed: true, not_applicable: true` rather than failing the\n * step. Surfacing the count separately lets consumers distinguish\n * \"runner is older than the storyboard\" from clean passes.\n */\nfunction countValidationsNotApplicable(phases: StoryboardPhaseResult[]): number {\n let n = 0;\n for (const phase of phases) {\n for (const step of phase.steps) {\n for (const v of step.validations) {\n if (v.not_applicable) n++;\n }\n }\n }\n return n;\n}\n\n/** Count failed, unpromoted advisories without affecting step verdicts. */\nfunction countValidationsAdvisoryFailed(phases: StoryboardPhaseResult[]): number {\n let n = 0;\n for (const phase of phases) {\n for (const step of phase.steps) {\n for (const validation of step.validations) {\n if (!validation.passed && validation.severity === 'advisory') n++;\n }\n }\n }\n return n;\n}\n\nfunction collectSchemasUsed(phases: StoryboardPhaseResult[]): Array<{ schema_id: string; schema_url: string }> {\n const seen = new Set<string>();\n const out: Array<{ schema_id: string; schema_url: string }> = [];\n for (const phase of phases) {\n for (const step of phase.steps) {\n for (const v of step.validations) {\n if (v.schema_id && v.schema_url && !seen.has(v.schema_id)) {\n seen.add(v.schema_id);\n out.push({ schema_id: v.schema_id, schema_url: v.schema_url });\n }\n }\n }\n }\n return out;\n}\n\n/**\n * Walk every response_schema validation and aggregate the strict/lenient\n * delta. Always returns a summary; `observable: false` signals \"run had\n * no strict-eligible checks\" (distinct from strict-clean with zero\n * findings). See issue #820 follow-up.\n *\n * `checked` counts validations with a `strict` verdict attached.\n * `passed` / `failed` partition `checked` by `strict.valid`.\n * `strict_only_failures` = #(lenient-pass ∧ strict-fail) — the agent's\n * production-readiness gap.\n * `lenient_also_failed` = #(lenient-fail ∧ strict-fail) — step already\n * broken, strict-rejection isn't new signal.\n *\n * Exported so callers post-processing a `StoryboardResult` (dashboards,\n * CI formatters) can compute the same summary over a subset of phases\n * without re-running validation.\n */\n/**\n * Flatten every `strict_only_failure` (lenient-pass ∧ strict-fail) into a\n * dashboard-friendly row list. Each row carries the step/phase context\n * needed for triage without re-walking the nested result tree:\n *\n * { phase_id, step_id, task, variant, issues }\n *\n * Exported because the ValidationResult tree is four levels deep\n * (`phases[].steps[].validations[].strict.issues[]`) and a consumer\n * seeing `strict_only_failures: 7` in the summary needs a direct path\n * to the seven offending responses. This is that path.\n *\n * Returns `[]` on runs with no strict-only failures OR no AJV coverage\n * (both cases produce zero rows). Inspect `strict_validation_summary`\n * for the total counts.\n */\nexport function listStrictOnlyFailures(\n phases: StoryboardPhaseResult[]\n): Array<{ phase_id: string; step_id: string; task: string; variant: string; issues: SchemaValidationError[] }> {\n const rows: Array<{\n phase_id: string;\n step_id: string;\n task: string;\n variant: string;\n issues: SchemaValidationError[];\n }> = [];\n for (const phase of phases) {\n for (const step of phase.steps) {\n for (const v of step.validations) {\n if (v.check !== 'response_schema') continue;\n if (v.strict === undefined) continue;\n if (v.strict.valid) continue;\n const lenientAccepted = v.strict.lenient_valid === true || (v.strict.lenient_valid === undefined && v.passed);\n if (!lenientAccepted) continue;\n rows.push({\n phase_id: phase.phase_id,\n step_id: step.step_id,\n task: step.task,\n variant: v.strict.variant,\n issues: v.strict.issues ?? [],\n });\n }\n }\n }\n return rows;\n}\n\nexport function summarizeStrictValidation(phases: StoryboardPhaseResult[]): StrictValidationSummary {\n let checked = 0;\n let passed = 0;\n let strictOnlyFailures = 0;\n let lenientAlsoFailed = 0;\n let lenientUnobserved = 0;\n for (const phase of phases) {\n for (const step of phase.steps) {\n for (const v of step.validations) {\n if (v.check !== 'response_schema' || v.strict === undefined) continue;\n checked++;\n if (v.strict.valid) {\n passed++;\n } else {\n const lenientValid = v.strict.lenient_valid;\n if (lenientValid === true || (lenientValid === undefined && v.passed)) {\n // Lenient Zod accepted this response; strict AJV rejected it.\n // That's the agent's strictness gap — the signal #820 wants.\n strictOnlyFailures++;\n } else if (lenientValid === false || lenientValid === undefined) {\n lenientAlsoFailed++;\n } else {\n lenientUnobserved++;\n }\n }\n }\n }\n }\n const failed = checked - passed;\n return {\n observable: checked > 0,\n checked,\n passed,\n failed,\n strict_only_failures: strictOnlyFailures,\n lenient_also_failed: lenientAlsoFailed,\n ...(lenientUnobserved > 0 && { lenient_unobserved: lenientUnobserved }),\n };\n}\n\n// ────────────────────────────────────────────────────────────\n// runStoryboardStep: execute a single step (stateless)\n// ────────────────────────────────────────────────────────────\n\n/**\n * Run a single storyboard step.\n *\n * This is the core primitive for stateless, LLM-friendly execution.\n * Context is passed in and returned, enabling step-by-step orchestration.\n */\nexport async function runStoryboardStep(\n agentUrl: string,\n storyboard: Storyboard,\n stepId: string,\n options: StoryboardRunOptions = {}\n): Promise<StoryboardStepResult> {\n return withMCPConnectionScope(\n async () => {\n validateStoryboardShape(storyboard);\n options = applyStoryboardVersionOptions(storyboard, options);\n // adcp#6735 — same declared-kit resolution as runStoryboard, so the\n // printed fix_command path exercises the step with its real credential.\n options = resolveDeclaredTestKit(storyboard, options);\n const schemaRoot = getRunSchemaRoot(options);\n if (schemaRoot) {\n return await withExternalSchemaRoot(schemaRoot.adcpVersion, schemaRoot.schemaRoot, () =>\n runStoryboardStepBody(agentUrl, storyboard, stepId, options)\n );\n }\n return await runStoryboardStepBody(agentUrl, storyboard, stepId, options);\n },\n { isolate: true }\n );\n}\n\nasync function runStoryboardStepBody(\n agentUrl: string,\n storyboard: Storyboard,\n stepId: string,\n options: StoryboardRunOptions\n): Promise<StoryboardStepResult> {\n validateTestKit(options.test_kit);\n const clientResolution = getOrCreateClientResolution(agentUrl, options);\n const client = clientResolution.client;\n\n // Discover agent profile for standalone step execution. Captured so the\n // executeStep call below can thread `library_version` through to\n // shape-drift hint detection (issue #850). Also threads _profile into\n // options so capability-based skip gates in executeStep (e.g. account-mode\n // branching) can read raw_capabilities, mirroring executeStoryboardPass.\n let profile: AgentProfile | undefined;\n if (!clientResolution.reusedShared) {\n const discovered = await getOrDiscoverProfile(client, options);\n profile = discovered.profile;\n if (profile && !options._profile) {\n options = { ...options, _profile: profile };\n }\n } else {\n profile = options._profile;\n }\n\n const context: StoryboardContext = { ...storyboard.context, ...options.context };\n if (storyboard.context) forwardAliasCache(storyboard.context, context);\n if (options.context) forwardAliasCache(options.context, context);\n\n // `_webhookReceiver` is a test-only injection point; production callers\n // pass `webhook_receiver` and the runner constructs the listener.\n const injectedReceiver = options._webhookReceiver;\n const webhookReceiver: WebhookReceiver | undefined =\n injectedReceiver ??\n (options.webhook_receiver\n ? await createWebhookReceiver({\n ...(options.webhook_receiver.mode && { mode: options.webhook_receiver.mode }),\n ...(options.webhook_receiver.host !== undefined && { host: options.webhook_receiver.host }),\n ...(options.webhook_receiver.port !== undefined && { port: options.webhook_receiver.port }),\n ...(options.webhook_receiver.public_url !== undefined && {\n public_url: options.webhook_receiver.public_url,\n }),\n })\n : undefined);\n const ownsWebhookReceiver = !injectedReceiver && !!webhookReceiver;\n const runnerVars = createRunnerVariables({\n ...(webhookReceiver && { webhookBase: webhookReceiver.base_url }),\n });\n if (webhookReceiver) armWebhookAssertions(storyboard, runnerVars, webhookReceiver);\n\n // Find the step\n const allSteps = flattenSteps(storyboard);\n const found = allSteps.find(s => s.step.id === stepId);\n if (!found) {\n if (ownsWebhookReceiver && webhookReceiver) await webhookReceiver.close();\n throw new Error(\n `Step \"${stepId}\" not found in storyboard \"${storyboard.id}\". ` +\n `Available steps: ${allSteps.map(s => s.step.id).join(', ')}`\n );\n }\n\n // Standalone execution must preserve the whole-storyboard ordering:\n // capability applicability comes before the operator runtime requirement.\n // In particular, a non-TMP agent must not be told that it is missing a\n // publisher-auth adapter for a capability it never declared.\n if (storyboard.requires_capability) {\n const unmetDetail = evaluateRequiresCapabilityGate(\n storyboard.requires_capability,\n profile,\n options.agentTools,\n options.adcpVersion\n );\n if (unmetDetail !== null) {\n const result: StoryboardStepResult = {\n storyboard_id: storyboard.id,\n step_id: found.step.id,\n phase_id: found.phaseId,\n title: found.step.title,\n task: found.step.task,\n passed: true,\n skipped: true,\n skip_reason: 'not_applicable',\n skip: { reason: 'not_applicable', detail: unmetDetail },\n duration_ms: 0,\n validations: [],\n context,\n error: unmetDetail,\n extraction: { path: 'none' },\n contributions: Array.from(options.contributions ?? []),\n };\n if (!clientResolution.reusedShared) await closeScopedConnections(options.protocol);\n if (ownsWebhookReceiver && webhookReceiver) await webhookReceiver.close();\n return result;\n }\n }\n\n // Seed provenance from the caller-supplied map (threaded through from a\n // previous step's result). Storyboard-level runs build this internally;\n // here the caller owns accumulation across stateless invocations.\n const contextProvenance = new Map<string, ContextProvenanceEntry>(Object.entries(options.context_provenance ?? {}));\n const responseDerivedNotApplicableContextKeys = new Map<string, string>(\n Object.entries(options.response_derived_not_applicable_context_keys ?? {})\n );\n const contributions = new Set(options.contributions ?? []);\n const result = await executeStep(client, found.step, storyboard.id, found.phaseId, context, allSteps, options, {\n contributions,\n priorStepResults: new Map(),\n priorProbes: new Map(),\n agentUrl,\n webhookReceiver,\n runnerVars,\n contextProvenance,\n priorA2aEnvelopes: new Map(),\n stepRequestStarts: new Map(),\n responseDerivedNotApplicableContextKeys,\n agentProfile: profile,\n agentLibraryVersion: profile?.library_version,\n storyboardRequiresRequestSigner: resolveStoryboardRequires(storyboard, options).includes('request_signer'),\n storyboardRequiresPublisherAuthRunner:\n storyboard.requires?.includes('trusted_match_publisher_auth_runner') === true,\n });\n\n if (!result.skipped && result.passed && found.step.contributes_to) {\n if (evalContributesIf(found.step.contributes_if, new Map())) {\n contributions.add(found.step.contributes_to);\n }\n }\n\n if (!clientResolution.reusedShared) {\n await closeScopedConnections(options.protocol);\n }\n\n if (ownsWebhookReceiver && webhookReceiver) await webhookReceiver.close();\n\n return { ...result, contributions: Array.from(contributions) };\n}\n\n// ────────────────────────────────────────────────────────────\n// Internal: execute a single step\n// ────────────────────────────────────────────────────────────\n\ninterface ExecutionState {\n contributions: Set<string>;\n priorStepResults: Map<string, StoryboardStepResult>;\n priorProbes: Map<string, HttpProbeResult>;\n agentUrl: string;\n /** Run-scoped seller ids selected for authored fixture handles. */\n fixtureBindings?: FixtureBindingRegistry;\n /**\n * ISO timestamps captured immediately before each step's AdCP request\n * dispatch. Threaded into `upstream_traffic` validations as the\n * `since_timestamp` window bound (the step's own start by default; an\n * earlier prior step's start when the validation declares\n * `since: prior_step_id` for a cumulative assertion). Empty when no\n * step in the run has fired a request yet.\n */\n stepRequestStarts?: Map<string, string>;\n /**\n * Context keys whose producer step was response-gated as not_applicable.\n * Consumer steps referencing only these keys should skip as not_applicable\n * rather than prerequisite_failed.\n */\n responseDerivedNotApplicableContextKeys?: Map<string, string>;\n /** Shared ephemeral webhook receiver, when the run has one enabled. */\n webhookReceiver?: WebhookReceiver;\n /** Shared runner-variable bag for `{{runner.*}}` substitution. */\n runnerVars?: RunnerVariables;\n /**\n * Context-key → write-provenance map, accumulated across the run so a\n * later step's rejection can cite the step that wrote the value. Issue\n * #870. Later writes shadow earlier ones under the same key, matching\n * the shallow-merge semantics of the context itself.\n */\n contextProvenance?: Map<string, ContextProvenanceEntry>;\n /**\n * Per-step A2A envelopes captured during the run, keyed by step id.\n * Cross-step A2A validators (`a2a_context_continuity`) read this to\n * compare consecutive `Task.contextId` values. The map is mutated\n * by `executeStep` after each step's capture; reads pick the most\n * recently inserted entry to seed `priorA2aEnvelope` on the\n * ValidationContext for the next step. Issue adcp-client#962.\n *\n * Map shared by reference across `executeStep` invocations — like\n * `priorStepResults`, this is the state that has to live one level\n * up from the per-step `ExecutionState` literal.\n */\n priorA2aEnvelopes?: Map<string, A2ATaskEnvelope>;\n /**\n * Profile for the agent selected to execute this step. In routed runs this\n * must be the selected agent's profile, not the run-level primary profile.\n */\n agentProfile?: AgentProfile;\n /**\n * Agent's reported `@adcp/client@X.Y.Z` library version, captured from\n * the `get_adcp_capabilities` discovery probe. Threaded into shape-drift\n * hints so the runner can suffix recommendations with a version-staleness\n * note when a recommended helper postdates the agent's pinned SDK. Issue\n * #850. Undefined when the agent did not advertise `library_version`.\n */\n agentLibraryVersion?: string;\n /**\n * Whether the storyboard declares or implicitly requires a request signer.\n * Unsigned functional storyboards use this to distinguish an expected\n * signature-required rejection from a failure in a signing test.\n */\n storyboardRequiresRequestSigner?: boolean;\n /** Dedicated TMP raw-HTTP tasks are invalid outside their explicit runner contract. */\n storyboardRequiresPublisherAuthRunner?: boolean;\n}\n\nasync function executeStep(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- client type varies (TestClient)\n client: any,\n step: StoryboardStep,\n storyboardId: string,\n phaseId: string,\n context: StoryboardContext,\n allSteps: FlatStep[],\n options: StoryboardRunOptions,\n state?: ExecutionState\n): Promise<StoryboardStepResult> {\n // Default empty state when this function is called standalone (runStoryboardStep).\n const runState: ExecutionState = state ?? {\n contributions: new Set(),\n priorStepResults: new Map(),\n priorProbes: new Map(),\n agentUrl: '',\n contextProvenance: new Map(),\n stepRequestStarts: new Map(),\n responseDerivedNotApplicableContextKeys: new Map(),\n };\n\n // Recognize the dedicated TMP publisher-auth probes before generic auth\n // overrides, missing-tool checks, or MCP/A2A routing.\n if (TRUSTED_MATCH_PUBLISHER_AUTH_TASKS.has(step.task)) {\n if (runState.storyboardRequiresPublisherAuthRunner !== true) {\n return invalidTrustedMatchPublisherAuthTask(step, phaseId, context, allSteps, runState);\n }\n return executeProbeStep(client, step, phaseId, context, allSteps, options, runState);\n }\n\n // HTTP probe tasks bypass the MCP client entirely.\n if (PROBE_TASKS.has(step.task)) {\n return executeProbeStep(client, step, phaseId, context, allSteps, options, runState);\n }\n\n // Webhook-assertion pseudo-tasks observe the shared receiver instead of\n // driving the agent. They never reach the MCP/A2A transport.\n if (WEBHOOK_ASSERTION_TASKS.has(step.task)) {\n return executeWebhookAssertionStep(step, phaseId, context, allSteps, options, runState);\n }\n\n // Inbound webhook receiver conformance posts canonical vectors to a\n // buyer/orchestrator receiver URL. This is a runner-native HTTP probe, not\n // a seller tool call.\n if (step.task === REPLAY_WEBHOOK_VECTOR_TASK) {\n return executeReplayWebhookVectorStep(step, phaseId, context, allSteps, options, runState);\n }\n\n // Resolve $test_kit.* task references before any downstream dispatch / skip checks.\n // When the reference resolves to nothing, fall back to `task_default`.\n const resolvedTask = resolveTaskName(step, options);\n if (!resolvedTask) {\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: false,\n duration_ms: 0,\n validations: [],\n context,\n error: `Step task \"${step.task}\" references a test-kit field that resolved to nothing and no task_default is set.`,\n extraction: { path: 'none' },\n };\n }\n const effectiveStep: StoryboardStep = resolvedTask === step.task ? step : { ...step, task: resolvedTask };\n\n // Check requires_tool — skip if agent doesn't have it\n if (step.requires_tool && options.agentTools && !options.agentTools.includes(step.requires_tool)) {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const reason: RunnerSkipReason =\n step.requires_tool === 'comply_test_controller' ? 'missing_test_controller' : 'missing_tool';\n const detail =\n reason === 'missing_test_controller'\n ? `Deterministic-testing phase requires comply_test_controller; agent tools: [${(options.agentTools ?? []).join(', ')}].`\n : `Required tool \"${step.requires_tool}\" not advertised; agent tools: [${(options.agentTools ?? []).join(', ')}].`;\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: reason,\n skip: buildSkip(reason, detail),\n duration_ms: 0,\n validations: [],\n context,\n next,\n extraction: { path: 'none' },\n };\n }\n\n // Account-mode capability gate: when the seller declared explicit mode\n // (require_operator_auth: true) and does not advertise sync_accounts,\n // sync_accounts does not apply — grade not_applicable rather than\n // missing_tool so adopters can distinguish \"your capability declaration\n // says this path isn't yours\" from \"you forgot to implement a required\n // tool.\" If the seller explicitly advertises sync_accounts, run it: account\n // discovery mode and account-level write surfaces such as notification\n // config registration are orthogonal.\n //\n // list_accounts is NOT gated here: it appears in audience_sync and other\n // storyboard flows regardless of account mode, so it is always applicable.\n //\n // Requires _profile threaded from the discovery block in\n // executeStoryboardPass or runStoryboardStep.\n if (effectiveStep.task === 'sync_accounts') {\n const rawCaps = options._profile?.raw_capabilities;\n if (rawCaps !== undefined) {\n const requireOperatorAuth = resolveCapabilityPath(rawCaps, 'account.require_operator_auth');\n const syncAccountsAdvertised = options.agentTools?.includes('sync_accounts') === true;\n if (requireOperatorAuth === true && !syncAccountsAdvertised) {\n const detail =\n `Agent declared explicit account mode (require_operator_auth: true); ` +\n `sync_accounts is not applicable — list_accounts is the correct tool for this account shape.`;\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: 'not_applicable',\n skip: buildSkip('not_applicable', detail),\n duration_ms: 0,\n validations: [],\n context,\n next,\n extraction: { path: 'none' },\n };\n }\n }\n }\n\n // Skip if agent doesn't implement the tool this step calls.\n if (options.agentTools && !options.agentTools.includes(effectiveStep.task)) {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const detail = `Agent did not advertise tool \"${effectiveStep.task}\"; agent tools: [${(options.agentTools ?? []).join(', ')}].`;\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: effectiveStep.task,\n passed: true,\n skipped: true,\n skip_reason: 'missing_tool',\n skip: buildSkip('missing_tool', detail),\n duration_ms: 0,\n validations: [],\n context,\n next,\n extraction: { path: 'none' },\n };\n }\n\n // Build request — priority (issue #820, fixture-authoritative):\n // 1. User-provided --request override\n // 2. For expect_error steps: sample_request directly (preserves intentionally invalid input)\n // 3. enrichRequest — fixture is the base, enricher fills gaps (fixture wins conflicts)\n // 4. sample_request with context injection when no enricher is registered\n // 5. Empty object (only reachable for non-mutating tasks with neither fixture nor enricher)\n let request: Record<string, unknown>;\n if (options.request) {\n request = injectContext({ ...options.request }, context, runState.runnerVars);\n } else if (step.expect_error && step.sample_request) {\n request = injectContext({ ...step.sample_request }, context, runState.runnerVars);\n } else if (hasRequestEnricher(effectiveStep.task)) {\n request = enrichRequest(effectiveStep, context, options, runState.runnerVars);\n } else if (step.sample_request) {\n request = injectContext({ ...step.sample_request }, context, runState.runnerVars);\n } else {\n request = {};\n }\n\n // Apply explicit context_inputs on top of whatever request source was used\n if (step.context_inputs?.length) {\n request = applyContextInputs(request, step.context_inputs, context);\n }\n\n // Brand/account is a storyboard-run-scoped invariant: every step in a run\n // targets the same brand, so every outgoing request's brand context must\n // match the options. Enforcing this here (after builder + sample_request)\n // prevents session-key divergence across create/get/update/delete steps\n // when individual builders or sample_request YAML omit brand.\n // `step.omit_account` suppresses account synthesis for schema_validation\n // steps that deliberately test the seller's missing-account rejection path.\n request = applyBrandInvariant(request, options, effectiveStep.task, { omit_account: step.omit_account });\n\n // Per-run sandbox-bypass hint (#841). When the operator passes\n // `--no-sandbox` (or sets `disable_sandbox: true` programmatically), the\n // runner stamps `ext.adcp.disable_sandbox: true` on every outgoing\n // request. Adopters that read this field bypass their internal sandbox\n // routing — env-var fallbacks, brand-domain heuristics, fixture\n // substitutes — and exercise their real adapter path. Agents that\n // don't recognize the field ignore it (per spec, `ext` is accepted\n // without error and not echoed). Gated on the schema check that\n // `applyBrandInvariant` uses for `account` and `brand` so tools whose\n // `additionalProperties: false` schema would reject `ext` aren't broken.\n if (options.disable_sandbox === true) {\n request = applyDisableSandboxHint(request, effectiveStep.task);\n }\n\n // Mutating AdCP requests require idempotency_key per spec. Storyboard\n // yamls generally omit it so authors don't have to remember it on every\n // mutating step — mint one here on the runner's behalf, matching how a\n // real buyer would operate. Suppressed when the step expects a missing-key\n // error (see `testsMissingIdempotencyKey` below) so that compliance\n // surfaces can still exercise the server's required-field check.\n request = applyIdempotencyInvariant(request, effectiveStep.task, step);\n\n // Fixture handles are replaced only at request-schema fields carrying the\n // matching x-entity annotation. This applies equally to ordinary AdCP calls\n // and comply_test_controller force/simulate requests.\n const fixtureBinding = applyFixtureBindingsSafely(request, effectiveStep.task, options, runState);\n if (!fixtureBinding.ok) {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: effectiveStep.task,\n passed: false,\n duration_ms: 0,\n validations: [\n {\n check: 'unresolved_substitution',\n passed: false,\n description: `Fixture handle substitution failed: ${fixtureBinding.error}`,\n json_pointer: null,\n expected: 'an unambiguous fixture handle binding',\n actual: fixtureBinding.error,\n schema_id: null,\n schema_url: null,\n },\n ],\n context,\n error: fixtureBinding.error,\n next,\n extraction: { path: 'none' },\n };\n }\n request = fixtureBinding.request;\n\n // Assemble seller-required creative slots from the selected format and\n // active test kit after all other nested request construction is complete.\n const creativeAssetExpansion = expandCreativeAssetDirectivesWithDiagnostics(request, context, options.test_kit);\n request = creativeAssetExpansion.value as Record<string, unknown>;\n if (!creativeAssetExpansion.ok && creativeAssetExpansion.failure.reason === 'fixture_unavailable') {\n return buildCreativeAssetFixtureUnavailableStep(\n step,\n phaseId,\n context,\n allSteps,\n runState,\n creativeAssetExpansion.failure,\n effectiveStep.task\n );\n }\n\n // Detect unresolved $context placeholders — a prior step likely failed\n // and didn't produce the expected output. Skip rather than sending garbage.\n const unresolvedContextVars = findUnresolvedContextVars(request);\n const unresolvedAssetDirectives = findUnresolvedCreativeAssetDirectives(request).map(path => ({\n key: path,\n token: BUILD_ASSETS_FROM_FORMAT_DIRECTIVE,\n }));\n const unresolvedVars = [...unresolvedContextVars, ...unresolvedAssetDirectives];\n // expect_error steps may intentionally preserve invalid $context tokens, but\n // runner-only creative directives must never cross the wire.\n if (unresolvedAssetDirectives.length > 0 || (unresolvedContextVars.length > 0 && !step.expect_error)) {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const responseDerivedDetails = unresolvedVars\n .map(v => runState.responseDerivedNotApplicableContextKeys?.get(v.key))\n .filter((d): d is string => typeof d === 'string');\n const allResponseDerived =\n responseDerivedDetails.length === unresolvedVars.length && responseDerivedDetails.length > 0;\n const detail = allResponseDerived\n ? [...new Set(responseDerivedDetails)].join('; ')\n : `Skipped: unresolved context variables from prior steps: ${unresolvedVars.map(v => v.key).join(', ')}.`;\n // Normal unresolved substitutions carry one validation result per missing\n // token. Response-derived terminal-page skips are already successful\n // not_applicable rows, so their downstream cursor consumers stay validation\n // empty to avoid inventing a failing-looking check for an expected skip.\n const synthesized: ValidationResult[] = [];\n if (!allResponseDerived) {\n const seenTokens = new Set<string>();\n for (const v of unresolvedVars) {\n if (seenTokens.has(v.token)) continue;\n seenTokens.add(v.token);\n synthesized.push({\n check: 'unresolved_substitution',\n passed: false,\n description:\n v.token === BUILD_ASSETS_FROM_FORMAT_DIRECTIVE\n ? `request directive \"${v.token}\" did not resolve — the test kit could not populate every seller-required asset at ${v.key}`\n : `request token \"${v.token}\" did not resolve — prior step did not populate context.${v.key}`,\n json_pointer: null,\n expected: v.token,\n actual: null,\n schema_id: null,\n schema_url: null,\n });\n }\n }\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: allResponseDerived,\n skipped: true,\n skip_reason: allResponseDerived ? 'not_applicable' : 'prerequisite_failed',\n skip: buildSkip(allResponseDerived ? 'not_applicable' : 'prerequisite_failed', detail),\n duration_ms: 0,\n validations: synthesized,\n context,\n ...responseDerivedContextResult(runState),\n ...(!allResponseDerived && { error: detail }),\n next,\n extraction: { path: 'none' },\n };\n }\n\n const unresolvedRunnerTokens = findUnresolvedRunnerTokens(request);\n if (unresolvedRunnerTokens.length > 0) {\n const isPrerequisiteFailure = hasUnresolvedPriorStepToken(unresolvedRunnerTokens);\n const skipReason = isPrerequisiteFailure ? 'prerequisite_failed' : 'not_applicable';\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const detail =\n 'Skipped: storyboard request references unresolved runner placeholders. ' +\n `Unresolved token(s): ${unresolvedRunnerTokens.join(', ')}.`;\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: effectiveStep.task,\n passed: !isPrerequisiteFailure,\n skipped: true,\n skip_reason: skipReason,\n skip: buildSkip(skipReason, detail),\n duration_ms: 0,\n validations: [],\n context,\n next,\n ...(isPrerequisiteFailure ? { error: detail } : {}),\n request: {\n transport: options.protocol === 'a2a' ? 'a2a' : 'mcp',\n operation: effectiveStep.task,\n payload: redactSecrets(request),\n ...(runState.agentUrl ? { url: redactOAuthUrlForOutput(runState.agentUrl) } : {}),\n },\n extraction: { path: 'none' },\n };\n }\n\n // Execute the task. When the step overrides auth, dispatch via the raw MCP\n // probe so we can (a) strip credentials or send arbitrary Bearer values\n // (which the SDK transport doesn't expose), and (b) capture the HTTP status\n // + `WWW-Authenticate` header for http_* validations.\n //\n // Tests for envelope validation on mutating tasks (e.g., \"missing\n // idempotency_key returns INVALID_REQUEST\") set `step.omit_idempotency_key`\n // to suppress both the runner's `applyIdempotencyInvariant` (above) and the\n // AdCP client's auto-inject — otherwise the SDK helpfully generates a UUID\n // and the server never sees a missing-key request. Paired flags so the two\n // layers agree; see `applyIdempotencyInvariant` for the runner-level skip.\n const testsMissingIdempotencyKey = step.omit_idempotency_key === true && isMutatingTask(effectiveStep.task);\n\n // Analogous to `testsMissingIdempotencyKey`: when a step sets\n // `omit_account: true` the runner has already suppressed account synthesis\n // in `applyBrandInvariant` (above — ordering is load-bearing: this must\n // come after `applyBrandInvariant` so the comment \"above\" stays accurate\n // if either block is reordered). Track the flag here so the SDK call below\n // can also skip client-side account validation/injection before the wire call.\n const testsMissingAccount = step.omit_account === true && effectiveStep.task === 'create_media_buy';\n\n // Raw MCP dispatch is reserved for steps that explicitly override auth.\n // Missing-field vectors stay on the SDK transport with the skip flags below\n // so Streamable HTTP session setup completes before the malformed tool call\n // reaches the seller handler.\n let rawProbeHeaders: Record<string, string> | undefined;\n try {\n rawProbeHeaders = step.auth !== undefined ? authHeadersForStep(step.auth, options) : undefined;\n } catch (err) {\n // adcp#6735 — an unresolvable from_test_kit credential is a step-level\n // configuration failure with an explicit message, never a silent\n // unauthenticated probe (and never a whole-run crash).\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: false,\n duration_ms: 0,\n validations: [],\n context,\n error: `Step auth configuration error: ${err instanceof Error ? err.message : String(err)}`,\n extraction: { path: 'none' },\n };\n }\n const useRawProbe = rawProbeHeaders !== undefined;\n\n let taskResult: TaskResult | undefined;\n let stepResult: { duration_ms: number; error?: string; passed: boolean };\n // Raw caught error from the dispatch fn — preserved as `unknown` so the\n // schema-validation attribution path below can `instanceof` it against\n // `ResponseSchemaValidationError`. Undefined when the step succeeded or\n // failed for a non-typed reason. Spec: adcp-client#1709.\n let caughtError: unknown;\n let httpResult: HttpProbeResult | undefined;\n let responseRecord: RunnerResponseRecord | undefined;\n let a2aEnvelope: A2ATaskEnvelope | undefined;\n let crossResponses: CrossResponseSet | undefined;\n\n // Parallel-dispatch fan-out: when the storyboard step declares\n // `parallel_dispatch`, the runner fires N concurrent dispatches against\n // the same agent with the same idempotency_key (default) and grades the\n // cross-response set instead of a single response. Gated on the\n // `parallel_dispatch_runner` test-kit contract — runners (or runs) without\n // it grade the step `not_applicable` so older runners don't fail on\n // newer storyboard contracts.\n if (step.parallel_dispatch && !useRawProbe) {\n const contractsInScope = new Set(options.contracts ?? []);\n if (!contractsInScope.has(PARALLEL_DISPATCH_CONTRACT)) {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const detail = `Test-kit contract \"${PARALLEL_DISPATCH_CONTRACT}\" is not configured on this runner; concurrent-retry grading requires it.`;\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: 'not_applicable',\n skip: buildSkip('not_applicable', detail),\n duration_ms: 0,\n validations: [],\n context,\n next,\n extraction: { path: 'none' },\n };\n }\n const specError = validateParallelDispatchSpec(step.parallel_dispatch);\n if (specError) {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: false,\n duration_ms: 0,\n validations: [\n {\n check: 'parallel_dispatch_misconfigured',\n passed: false,\n description: specError,\n json_pointer: null,\n expected: 'a well-formed parallel_dispatch spec',\n actual: step.parallel_dispatch,\n schema_id: null,\n schema_url: null,\n },\n ],\n context,\n error: specError,\n next,\n extraction: { path: 'none' },\n };\n }\n if (step.parallel_dispatch.mode === 'distributed') {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const detail =\n 'parallel_dispatch.mode: distributed is not implemented in @adcp/sdk; use process_local for in-process grading.';\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: 'not_applicable',\n skip: buildSkip('not_applicable', detail),\n duration_ms: 0,\n validations: [],\n context,\n next,\n extraction: { path: 'none' },\n };\n }\n }\n\n // Capture the ISO timestamp immediately before the step's AdCP request\n // dispatch. `upstream_traffic` validations use this as the default\n // `since_timestamp` window bound when querying the controller. Recorded\n // on `runState.stepRequestStarts` so a later step's `since: prior_step_id`\n // reference can resolve back to it.\n const requestStartIso = new Date().toISOString();\n if (runState.stepRequestStarts) runState.stepRequestStarts.set(step.id, requestStartIso);\n\n if (useRawProbe) {\n const started = Date.now();\n try {\n const probe = await rawMcpProbe({\n agentUrl: runState.agentUrl,\n toolName: effectiveStep.task,\n args: request,\n headers: rawProbeHeaders,\n allowPrivateIp: options.allow_http === true,\n fetchFn: options.transport?.trustedFetchFn,\n });\n httpResult = probe.httpResult;\n taskResult = probe.taskResult;\n const durationMs = Date.now() - started;\n stepResult = {\n duration_ms: durationMs,\n passed: !httpResult.error,\n error: httpResult.error,\n };\n const filteredHeaders = filterResponseHeaders(httpResult.headers);\n responseRecord = {\n transport: 'mcp',\n payload: redactSecrets(httpResult.body),\n ...(typeof httpResult.status === 'number' ? { status: httpResult.status } : {}),\n ...(filteredHeaders && { headers: filteredHeaders }),\n duration_ms: durationMs,\n };\n } catch (err) {\n stepResult = {\n duration_ms: Date.now() - started,\n passed: false,\n error: err instanceof Error ? err.message : String(err),\n };\n }\n } else {\n // For A2A runs, wrap the SDK dispatch in `withRawResponseCapture`\n // so storyboard validations can assert on the JSON-RPC `Task`\n // envelope the seller emitted (e.g. `a2a_submitted_artifact`\n // checks `Task.state` + `artifact.metadata.adcp_task_id` placement).\n // MCP path stays unwrapped — the SDK envelope is reconstructed from\n // `taskResult` already and capture would only add overhead.\n //\n // Selection note: gate on `options.protocol === 'a2a'` because\n // that's the only signal available at this point — discovery\n // hasn't run yet in `runStoryboardStep` (the runner branches off\n // `agentTools` later). If a future \"auto-detect protocol\" flow\n // lands, key the capture off the negotiated transport instead.\n const captureA2a = options.protocol === 'a2a';\n let a2aCaptures: RawHttpCapture[] | undefined;\n if (step.parallel_dispatch) {\n // Fan out N concurrent dispatches via the SDK client. All dispatches\n // share the runner-minted idempotency_key (default) so the seller\n // sees one logical request and resolves the race deterministically.\n //\n // Known limitation: `dispatchWithBarrier` uses `Promise.race` against a\n // timer; when the barrier wins, the underlying SDK request is NOT\n // aborted — it continues to completion against the seller. The runner\n // reports the dispatch as `timed_out`, but a late-arriving success\n // can still land on the seller's idempotency cache. Storyboard\n // authors writing follow-up steps that observe seller state after a\n // barrier timeout should account for this race.\n const started = Date.now();\n crossResponses = await runParallelDispatches(client, effectiveStep.task, request, {\n spec: step.parallel_dispatch,\n keyMinter: generateIdempotencyKey,\n correlationPrefix: step.id,\n });\n const durationMs = Date.now() - started;\n // Representative TaskResult is ALWAYS `dispatches[0]` — pinning the\n // representative to a fixed index keeps the aggregation loop's `i=1`\n // start aligned (every dispatch graded exactly once). Picking the\n // \"best\" resolved arm would double-count whichever dispatch won and\n // skip dispatches[0] from per-response grading entirely.\n const firstDispatch = crossResponses.dispatches[0];\n const allTimedOut = crossResponses.dispatches.every(d => d.timed_out);\n const barrierTimeoutError = 'parallel_dispatch_barrier_timeout: no dispatch resolved within barrier_timeout_ms';\n taskResult = firstDispatch?.taskResult ?? {\n success: false,\n ...(allTimedOut && { error: barrierTimeoutError }),\n };\n // Pass/fail is derived from the cross-response set rather than any\n // single arm: the step passes when at least one dispatch resolved\n // (cross-response validations then grade the race outcome). All-\n // timed-out is a hard failure regardless of validations.\n stepResult = {\n duration_ms: durationMs,\n passed: !allTimedOut && crossResponses.resolved.length > 0,\n ...(allTimedOut && { error: barrierTimeoutError }),\n };\n if (taskResult) {\n responseRecord = {\n transport: options.protocol === 'a2a' ? 'a2a' : 'mcp',\n payload: redactSecrets(\n taskResult.data ??\n (taskResult.adcp_error ? { adcp_error: taskResult.adcp_error } : undefined) ??\n taskResult.error ??\n null\n ),\n duration_ms: durationMs,\n };\n }\n } else {\n const dispatch = () =>\n executeStoryboardTask(client, effectiveStep.task, request, {\n skipIdempotencyAutoInject: testsMissingIdempotencyKey,\n skipAccountValidation: testsMissingAccount,\n responseProjection:\n effectiveStep.response_projection ??\n defaultStoryboardResponseProjection(effectiveStep.task, effectiveStep.comply_scenario),\n signal: options.signal,\n });\n const run = await runStep(step.title, effectiveStep.task, async () => {\n if (!captureA2a) return dispatch();\n try {\n const { result: dispatchResult, captures } = await withRawResponseCapture(dispatch);\n a2aCaptures = captures;\n return dispatchResult;\n } catch (err) {\n // `withRawResponseCapture` attaches partial captures to the\n // thrown error so we still get the wire-shape envelope when\n // the SDK threw mid-parse (e.g. agent emitted malformed JSON).\n // Bare-throw cases (network errors, no captures attached)\n // leave `a2aCaptures` undefined and the validator self-skips.\n const partial = getCapturesFromError(err);\n if (partial) a2aCaptures = partial;\n throw err;\n }\n });\n taskResult = run.result;\n stepResult = run.step;\n caughtError = run.caughtError;\n if (caughtError !== undefined && options.signal?.aborted) {\n throw caughtError;\n }\n if (captureA2a && a2aCaptures) {\n a2aEnvelope = parseLastA2aMessageSendCapture(a2aCaptures);\n }\n if (taskResult) {\n responseRecord = {\n transport: options.protocol === 'a2a' ? 'a2a' : 'mcp',\n payload: redactSecrets(\n taskResult.data ??\n (taskResult.adcp_error ? { adcp_error: taskResult.adcp_error } : undefined) ??\n taskResult.error ??\n null\n ),\n duration_ms: stepResult.duration_ms,\n };\n }\n }\n }\n\n const requestRecord: RunnerRequestRecord = {\n transport: useRawProbe ? 'mcp' : options.protocol === 'a2a' ? 'a2a' : 'mcp',\n operation: effectiveStep.task,\n payload: redactSecrets(request),\n ...(runState.agentUrl ? { url: redactOAuthUrlForOutput(runState.agentUrl) } : {}),\n };\n const inputSchemaStripNotices = collectInputSchemaFieldStripNotices(\n (taskResult as { debug_logs?: unknown } | undefined)?.debug_logs,\n storyboardId\n );\n\n // Until functional storyboards can sign individual mutating requests,\n // a seller that correctly requires signatures would otherwise receive a\n // false-negative grade. Convert only the capability-declared rejection:\n // the response code, dispatched task, and unsigned-storyboard state must\n // all agree before authored validations are bypassed.\n const requiredForSigning = resolveCapabilityPath(\n runState.agentProfile?.raw_capabilities,\n 'request_signing.required_for'\n );\n if (\n taskResult?.adcp_error?.code === 'request_signature_required' &&\n Array.isArray(requiredForSigning) &&\n requiredForSigning.includes(effectiveStep.task) &&\n runState.storyboardRequiresRequestSigner !== true\n ) {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const detail =\n `Agent declared request_signing.required_for includes \"${effectiveStep.task}\" and rejected the unsigned ` +\n `request with request_signature_required; storyboard \"${storyboardId}\" does not require request_signer.`;\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: 'not_applicable',\n skip: buildSkip('not_applicable', detail),\n duration_ms: stepResult.duration_ms,\n validations: [],\n context,\n response: redactSecrets(taskResult.data),\n next,\n request: requestRecord,\n ...(responseRecord && { response_record: responseRecord }),\n extraction: extractionFromTaskResult(taskResult),\n ...(inputSchemaStripNotices.length > 0 && { notices: inputSchemaStripNotices }),\n };\n }\n\n // AdCP 3.0.12 runner-output-contract `force_scenario_unsupported`: when a\n // comply_test_controller step calls a force_* scenario that the agent\n // advertises the controller for but does not implement, the agent returns\n // `{success: false, error: 'UNKNOWN_SCENARIO'}`. Runners MUST grade the\n // step `not_applicable` with detail `force_scenario_unsupported` BEFORE\n // applying the step's authored validations — without this, the failing\n // pass/fail check would mask the coverage gap as a real agent fault.\n //\n // Companion to `fixture_seed_unsupported` (seeding.ts) — same shape but\n // for force_* in step phases rather than seed_* in the fixtures phase.\n // Spec: compliance/cache/<ver>/universal/runner-output-contract.yaml >\n // skip_result.reasons.force_scenario_unsupported.\n //\n // Spec gate \"comply_test_controller advertised\" is enforced upstream by\n // the phase cascade at the `seedingMissingController` check (~line 1893);\n // by the time per-step grading reaches this detector, the controller has\n // already been confirmed present. The `step.task === 'comply_test_controller'`\n // gate below is the per-step subset — it ensures we don't bleed the skip\n // into other tools that happen to carry a `scenario` argument.\n {\n const controllerData = taskResult?.data as { success?: unknown; error?: unknown } | undefined;\n const requestScenario = (request as { scenario?: unknown }).scenario;\n if (\n effectiveStep.task === 'comply_test_controller' &&\n typeof requestScenario === 'string' &&\n requestScenario.startsWith('force_') &&\n controllerData?.success === false &&\n controllerData.error === 'UNKNOWN_SCENARIO'\n ) {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const detail = `force_scenario_unsupported: agent advertised comply_test_controller but does not implement scenario \"${requestScenario}\"`;\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: 'force_scenario_unsupported',\n skip: { reason: 'not_applicable', detail },\n duration_ms: stepResult.duration_ms,\n validations: [],\n context,\n next,\n extraction: extractionFromTaskResult(taskResult),\n ...(inputSchemaStripNotices.length > 0 && { notices: inputSchemaStripNotices }),\n };\n }\n }\n\n // Feature-unsupported or unknown-tool errors → treat as skip\n const isUnsupported = stepResult.error?.includes('does not support:');\n const isUnknownTool = stepResult.error && /Unknown tool[:\\s]/i.test(stepResult.error);\n if (!taskResult && (isUnsupported || isUnknownTool)) {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const reason: RunnerSkipReason = isUnknownTool ? 'missing_tool' : 'not_applicable';\n const detail = isUnknownTool\n ? `Agent rejected tool \"${effectiveStep.task}\" as unknown: ${stepResult.error}`\n : `Agent reported feature not supported: ${stepResult.error}`;\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: reason,\n skip: buildSkip(reason, detail),\n duration_ms: stepResult.duration_ms,\n validations: [],\n context,\n error: stepResult.error,\n next,\n extraction: { path: 'none' },\n ...(inputSchemaStripNotices.length > 0 && { notices: inputSchemaStripNotices }),\n };\n }\n\n // For expect_error steps where TaskResult has no data but has an error string,\n // wrap the error string so validations have something to check against.\n if (step.expect_error && !taskResult?.data && taskResult?.error) {\n taskResult = { ...taskResult, data: { error: taskResult.error } };\n }\n\n const responseDerivedSkip = detectResponseDerivedNotApplicable(\n effectiveStep,\n request,\n taskResult?.data,\n runState,\n allSteps\n );\n if (responseDerivedSkip && !step.expect_error) {\n for (const key of responseDerivedSkip.contextKeys) {\n runState.responseDerivedNotApplicableContextKeys?.set(key, responseDerivedSkip.detail);\n }\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: 'not_applicable',\n skip: buildSkip('not_applicable', responseDerivedSkip.detail),\n duration_ms: stepResult.duration_ms,\n validations: [],\n context,\n ...responseDerivedContextResult(runState),\n response: redactSecrets(taskResult?.data),\n next,\n request: requestRecord,\n ...(responseRecord && { response_record: responseRecord }),\n extraction: extractionFromTaskResult(taskResult),\n ...(inputSchemaStripNotices.length > 0 && { notices: inputSchemaStripNotices }),\n };\n }\n\n // Determine pass/fail — inverted when expect_error is set\n let passed: boolean;\n if (step.expect_error) {\n // Raw protocol probes can succeed at the transport layer while carrying\n // a controller-level rejection in their structured payload. Treat the\n // payload's explicit failure signal as the expected error; authored\n // validations below still verify that it is the *right* rejection.\n const responsePayload = taskResult?.data as { success?: unknown } | undefined;\n const payloadReportsFailure = responsePayload?.success === false;\n passed = !taskResult?.success || !!stepResult.error || payloadReportsFailure;\n } else if (crossResponses) {\n // Parallel-dispatch step: pass/fail is driven by the cross-response\n // set, not the representative arm. The representative is pinned to\n // `dispatches[0]` (which may itself have failed under the race) so\n // gating on its `.success` would false-fail steps where later arms\n // resolved correctly. Validations grade the actual race outcome.\n passed = stepResult.passed;\n } else {\n passed = stepResult.passed && (taskResult?.success ?? false);\n }\n\n const schemaValidationError = caughtError instanceof ResponseSchemaValidationError ? caughtError : undefined;\n // The response unwrapper preserves the rejected payload on its typed error.\n // Grade every authored validation against that payload even though no normal\n // TaskResult was returned; otherwise an advisory response_schema check could\n // hide a required field validation and false-green the step.\n const validationTaskResult: TaskResult | undefined =\n taskResult ??\n (schemaValidationError\n ? {\n // ResponseSchemaValidationError is thrown while validating a\n // successful response arm. Preserve that terminal state so\n // status_code/error_code checks retain their authored semantics.\n success: true,\n data: schemaValidationError.data,\n }\n : undefined);\n let validations: ValidationResult[] = [];\n // Run validations. Resolve `$context.<key>` placeholders in `value` and\n // `allowed_values` fields so expected values can reference prior steps\n // (e.g., replay tests assert `media_buy_id === $context.initial_media_buy_id`).\n if (step.validations?.length && (validationTaskResult || httpResult)) {\n const resolvedValidations = step.validations.map(v => {\n const resolved = { ...v };\n if (resolved.value !== undefined) {\n resolved.value = injectContext({ __v: resolved.value }, context, runState.runnerVars).__v;\n }\n if (Array.isArray(resolved.allowed_values)) {\n resolved.allowed_values = resolved.allowed_values.map(\n av => injectContext({ __v: av }, context, runState.runnerVars).__v\n );\n }\n return resolved;\n });\n // Pre-fetch upstream_traffic data: any `check: upstream_traffic`\n // validation needs the controller's `query_upstream_traffic` response,\n // but the validation dispatcher is synchronous. Async-fetch here once\n // per unique `since_timestamp` window so the validator can grade\n // synchronously. Adopters who don't advertise the scenario short-\n // circuit to a single `advertised: false` marker and every\n // upstream_traffic check on the step grades not_applicable.\n const upstreamTraffic = await prefetchUpstreamTraffic(\n step.id,\n resolvedValidations,\n client,\n options,\n runState,\n requestStartIso,\n requestRecord.payload,\n step.sample_request\n );\n\n const vctx: ValidationContext = {\n taskName: effectiveStep.task,\n ...(options.adcpVersion && { adcpVersion: options.adcpVersion }),\n ...(options._serverAdcpVersion && { responseAdcpVersion: options._serverAdcpVersion }),\n strictResponseSchemaValidation: options.strictResponseSchemaValidation !== false,\n ...(validationTaskResult && { taskResult: validationTaskResult }),\n ...(httpResult && { httpResult }),\n agentUrl: runState.agentUrl,\n contributions: runState.contributions,\n ...(effectiveStep.response_schema_ref && { responseSchemaRef: effectiveStep.response_schema_ref }),\n request: requestRecord,\n ...(responseRecord && { response: responseRecord }),\n storyboardContext: context,\n ...(a2aEnvelope && { a2aEnvelope }),\n ...(upstreamTraffic && { upstreamTraffic }),\n ...(step.sample_request && { storyboardStep: { sample_request: step.sample_request } }),\n ...(crossResponses && { crossResponses }),\n ...(() => {\n // Walk back through the run's captured A2A envelopes and use\n // the most recent prior step's envelope as the comparison\n // baseline. The map preserves insertion order, so the last\n // entry is the most recent prior step's capture.\n const map = runState.priorA2aEnvelopes;\n if (!map || map.size === 0) return {};\n let priorStepId: string | undefined;\n let priorEnv: A2ATaskEnvelope | undefined;\n for (const [stepId, env] of map) {\n priorStepId = stepId;\n priorEnv = env;\n }\n return {\n ...(priorEnv && { priorA2aEnvelope: priorEnv }),\n ...(priorStepId && { priorA2aStepId: priorStepId }),\n };\n })(),\n };\n validations = runValidations(resolvedValidations, vctx);\n\n // Parallel-dispatch aggregation: per-response checks (`response_schema`,\n // `field_present`, `error_code`, etc.) declared by the storyboard MUST\n // grade against every dispatch's resolved response, not just the\n // representative one. Re-run each non-cross-response validation against\n // each dispatch's TaskResult and append the additional results so the\n // step's overall pass/fail reflects the full fan-out. The first run\n // (above) already covers dispatch[0]; this loop covers dispatches[1..N].\n if (crossResponses && crossResponses.dispatches.length > 1) {\n const perResponseValidations = resolvedValidations.filter(\n v => v.check !== 'cross_response_field_equal' && v.check !== 'cross_response_count_distinct'\n );\n for (let i = 1; i < crossResponses.dispatches.length; i++) {\n const d = crossResponses.dispatches[i];\n if (!d || !d.taskResult) continue;\n const dispatchCtx: ValidationContext = {\n ...vctx,\n taskResult: d.taskResult,\n // Per-dispatch responseRecord stays minimal — the redacted payload\n // captures enough for failure attribution without bloating success.\n ...(responseRecord && {\n response: {\n ...responseRecord,\n payload: redactSecrets(d.taskResult.data ?? d.taskResult.error ?? null),\n duration_ms: d.duration_ms,\n },\n }),\n };\n // Drop crossResponses on the per-dispatch context so cross-response\n // checks don't re-fire here (they already ran once above on the\n // representative dispatch and produced their single result).\n delete dispatchCtx.crossResponses;\n const dispatchResults = runValidations(perResponseValidations, dispatchCtx).map(r => ({\n ...r,\n description: `[dispatch ${d.correlation_id}] ${r.description}`,\n }));\n validations.push(...dispatchResults);\n }\n }\n }\n\n // Schema-validation attribution (adcp-client#1709). When the response\n // unwrapper rejected the agent's response against the SDK's Zod schema\n // for the tool, it threw a typed `ResponseSchemaValidationError` that\n // surfaced on `caughtError`. Without this attribution, the rejection\n // would silently propagate into whichever step-scope invariant (e.g.\n // `context.no_secret_echo`) happened to fire next — the BidMachine\n // misdiagnosis trace from adcp-client#1709 / adcp#4419 ate 10+ deploys\n // chasing the wrong cause.\n //\n // Synthesize a canonical `response_schema` ValidationResult and prepend\n // it so `extractFailures.find(v => !v.passed)` resolves it before any\n // invariant entry. Step-scope invariants downstream of this point will\n // short-circuit on the schema-invalid response (see the invariant\n // dispatch loop in `executeStoryboardPass`).\n let schemaRejectionIsAdvisory = false;\n if (schemaValidationError) {\n const issues = schemaValidationError.issues\n .slice(0, 5)\n .map(i => `${i.path.join('.') || '(root)'}: ${i.message}`)\n .join('; ');\n const firstIssue = schemaValidationError.issues[0];\n const jsonPointer = firstIssue ? '/' + firstIssue.path.map(s => String(s)).join('/') : null;\n const baseSchemaResult: ValidationResult = {\n check: 'response_schema',\n passed: false,\n description: `Response schema validation for ${schemaValidationError.toolName}`,\n error: issues,\n json_pointer: jsonPointer,\n expected: `response schema for ${schemaValidationError.toolName}`,\n actual: schemaValidationError.issues,\n };\n const authoredSchemaValidations = (step.validations ?? []).filter(v => v.check === 'response_schema');\n const schemaValidationContext: ValidationContext = {\n taskName: effectiveStep.task,\n ...(options.adcpVersion && { adcpVersion: options.adcpVersion }),\n ...(options._serverAdcpVersion && { responseAdcpVersion: options._serverAdcpVersion }),\n strictResponseSchemaValidation: options.strictResponseSchemaValidation !== false,\n ...(validationTaskResult && { taskResult: validationTaskResult }),\n agentUrl: runState.agentUrl,\n contributions: runState.contributions,\n request: requestRecord,\n ...(responseRecord && { response: responseRecord }),\n };\n const decoratedCandidates = authoredSchemaValidations.map(validation =>\n decorateValidationResult(baseSchemaResult, schemaValidationContext, validation)\n );\n const schemaResults = decoratedCandidates.length\n ? decoratedCandidates\n : [{ ...baseSchemaResult, severity: 'required' } satisfies ValidationResult];\n schemaRejectionIsAdvisory = schemaResults.every(result => !validationFailsStep(result));\n if (schemaRejectionIsAdvisory && !step.expect_error) passed = true;\n // Prepend so extractFailures picks it up before any inline validation\n // entry that may also be failing (e.g. `field_present` checks that\n // legitimately can't observe their target against an unparsed payload).\n validations = [...schemaResults, ...validations.filter(result => result.check !== 'response_schema')];\n }\n\n // Persist the captured A2A envelope keyed by step id so cross-step\n // validators (`a2a_context_continuity`) on subsequent steps can\n // compare against it. Only fires when this step actually captured\n // an envelope — probe steps, MCP steps, and capture-bypass paths\n // don't insert, so cross-step comparisons walk back to the most\n // recent A2A step automatically via insertion-order iteration.\n if (a2aEnvelope && runState.priorA2aEnvelopes) {\n runState.priorA2aEnvelopes.set(step.id, a2aEnvelope);\n }\n\n // Extract context from responses. Forward the alias cache so\n // `$generate:uuid_v4#<alias>` placeholders in subsequent steps resolve\n // to the same UUID as prior steps with the same alias.\n const updatedContext = { ...context };\n forwardAliasCache(context, updatedContext);\n const hasData = taskResult?.data !== undefined && taskResult?.data !== null;\n\n // Convention-based extraction (for non-error steps, or when expect_error succeeded)\n if (passed && hasData && taskResult) {\n const extracted = extractContextWithProvenance(effectiveStep.task, taskResult.data, step.id);\n Object.assign(updatedContext, extracted.values);\n for (const key of Object.keys(extracted.values)) {\n runState.responseDerivedNotApplicableContextKeys?.delete(key);\n }\n if (runState.contextProvenance) {\n for (const [key, entry] of Object.entries(extracted.provenance)) {\n runState.contextProvenance.set(key, entry);\n }\n }\n }\n\n // Explicit context_outputs. `generate:` entries fire unconditionally —\n // including on failed steps — because the generated ID was already\n // determined (and may already be inline-substituted via $generate:…#<key>)\n // before the request went out. Propagating it even on failure lets the\n // next step use the same ID for a forced-completion or tasks/get follow-up.\n // `path:` entries are gated on a non-null response and skip silently when\n // data is absent. Both paths write into updatedContext and receive\n // updatedContext for alias-cache coherence — forwardAliasCache above\n // ensures the minted value from any same-step $generate:…#<key> inline\n // substitution is visible here.\n if (step.context_outputs?.length) {\n for (const output of step.context_outputs) {\n if (output.key) runState.responseDerivedNotApplicableContextKeys?.delete(output.key);\n }\n // Resolve `task_completion.<path>` outputs against the eventual task\n // artifact rather than the immediate response. When the immediate\n // response is a submitted-arm envelope (HITL / async-signed-IO flows),\n // the seller-assigned IDs only exist on the completion artifact — the\n // sync-shape path resolves to nothing and the storyboard fails on\n // `capture_path_not_resolvable` for a value the seller correctly\n // produces, just on a later message. The `task_completion.` prefix is\n // an explicit author-side opt-in: \"poll tasks/get for terminal status,\n // then resolve the rest of the path against the artifact data.\"\n //\n // Polling failures (timeout, terminal failed/canceled/rejected) emit\n // `capture_poll_timeout` instead of recycling\n // `capture_path_not_resolvable` so the failure-class is distinct from\n // the original \"field absent in immediate response\" diagnostic.\n const taskCompletionResolution = await resolveTaskCompletionOutputs(\n taskResult,\n step.context_outputs,\n client,\n runState.webhookReceiver,\n effectiveStep.task\n );\n // `'data' in resolution` distinguishes \"polled, artifact had no data\"\n // (use undefined → outputs fail with capture_path_not_resolvable) from\n // \"did not poll\" (fall back to the immediate response data).\n const extractionData =\n 'data' in taskCompletionResolution\n ? taskCompletionResolution.data\n : hasData && taskResult\n ? taskResult.data\n : undefined;\n const remappedOutputs = remapTaskCompletionOutputs(step.context_outputs);\n const explicit = applyContextOutputsWithProvenance(\n extractionData,\n remappedOutputs,\n step.id,\n effectiveStep.task,\n updatedContext\n );\n Object.assign(updatedContext, explicit.values);\n for (const key of Object.keys(explicit.values)) {\n runState.responseDerivedNotApplicableContextKeys?.delete(key);\n }\n if (runState.contextProvenance) {\n for (const [key, entry] of Object.entries(explicit.provenance)) {\n runState.contextProvenance.set(key, entry);\n }\n }\n // Per runner-output-contract.yaml v2.0.0, a `context_outputs.path` that\n // resolves to absent / null / \"\" is a producer-side conformance failure\n // on THIS step (capture_path_not_resolvable), not on a downstream\n // consumer. Synthesize a failed validation_result so the failure is\n // attributed where it actually originated. Emitted regardless of whether\n // the step's authored validations passed — a clean response_schema with\n // a failed capture is the exact case adcp#3796 set out to fix.\n if (explicit.failures && explicit.failures.length > 0) {\n for (const failure of explicit.failures) {\n const wasTaskCompletion = step.context_outputs.some(\n o => o.key === failure.key && typeof o.path === 'string' && o.path.startsWith(TASK_COMPLETION_PATH_PREFIX)\n );\n const pollTimedOut = wasTaskCompletion && taskCompletionResolution.timedOut === true;\n const taskFailed = wasTaskCompletion && taskCompletionResolution.taskFailed === true;\n const originalPath = wasTaskCompletion ? `${TASK_COMPLETION_PATH_PREFIX}${failure.path}` : failure.path;\n let check: string;\n let description: string;\n if (pollTimedOut) {\n check = 'capture_poll_timeout';\n description = `context_outputs path \"${originalPath}\" (key \"${failure.key}\") did not resolve before tasks/get poll timed out (${taskCompletionResolution.pollTimeoutMs}ms)`;\n } else if (taskFailed) {\n check = 'capture_task_failed';\n description = `context_outputs path \"${originalPath}\" (key \"${failure.key}\") did not resolve because the task reached a terminal failed/canceled/rejected state`;\n } else {\n check = 'capture_path_not_resolvable';\n description = `context_outputs path \"${originalPath}\" (key \"${failure.key}\") did not resolve to a usable value`;\n }\n const synthetic: ValidationResult = {\n check,\n passed: false,\n description,\n json_pointer: toJsonPointer(failure.path),\n expected: originalPath,\n actual: failure.resolved,\n schema_id: null,\n schema_url: null,\n ...(requestRecord && { request: requestRecord }),\n ...(responseRecord && { response: responseRecord }),\n };\n validations.push(synthetic);\n }\n }\n }\n // Re-evaluate after any synthesized capture-failure validations are\n // appended — the step's overall pass/fail must reflect them.\n const allValidationsPassedFinal = validations.every(v => !validationFailsStep(v));\n\n // Emit context-value-rejected hints when the seller's error lists the\n // values it would have accepted and the rejected request value traces\n // back to a prior-step $context.* write. Non-fatal: doesn't flip\n // pass/fail; collapses \"SDK bug vs seller bug\" triage to one line.\n //\n // Gate fires on any step-level failure — task-level failure OR a\n // validation failure on a 200-OK response. Some sellers return 200 with\n // an advisory `errors[]` + `available:` list (success envelope with\n // warnings), and the hint is most useful on exactly that shape. Before\n // adcp-client#883 the gate was task-level only and missed schema-\n // rejected-but-200 flows.\n //\n // - Normal steps: hints fire whenever the step failed.\n // - `expect_error` steps: `passed` is inverted (true when the task\n // failed), so a genuinely-failing `expect_error` step has\n // `passed && allValidationsPassed === true`, gate stays shut —\n // expected rejections don't chatter hints by design. When the\n // validations DO fail (the caller's assertion about the error\n // shape was wrong), hints fire and can point them at the source\n // step that supplied the rejected value.\n //\n // Hints trace to context that existed BEFORE this step's own writes,\n // since the rejected value can't have come from this step's own\n // extraction.\n const stepFailed = !(passed && allValidationsPassedFinal);\n const contextRejectionHints =\n stepFailed && runState.contextProvenance\n ? detectContextRejectionHints(taskResult, request, context, runState.contextProvenance, effectiveStep.task)\n : [];\n\n // Shape-drift and strict-AJV hints fire on any step that has a parsed\n // payload, regardless of pass/fail — issue #935 widened the gate so\n // these structured diagnostics surface alongside the runner's existing\n // `ValidationResult.warning` prose without depending on Zod rejection.\n // Pre-process identically to validateResponseSchema: bare-array payloads\n // pass through; object payloads have the SDK-internal `_message` field\n // stripped so the detector sees what AJV does.\n const driftPayload = (() => {\n if (!hasData || !taskResult) return undefined;\n const raw = taskResult.data;\n if (Array.isArray(raw)) return raw;\n if (raw && typeof raw === 'object') {\n const { _message, ...rest } = raw as Record<string, unknown>;\n return rest;\n }\n return raw;\n })();\n const shapeDriftHints =\n driftPayload === undefined\n ? []\n : detectShapeDriftHints(effectiveStep.task, driftPayload, runState.agentLibraryVersion);\n const strictHints = detectStrictValidationHints(effectiveStep.task, validations);\n // Same root cause MAY produce both a `shape_drift` hint and a\n // `format_mismatch` (keyword: 'type') hint — e.g. `list_creatives`\n // returning a bare array. That's intentional co-emission, not a bug:\n // shape_drift carries the fix recipe (\"use listCreativesResponse() to\n // wrap\"); format_mismatch carries the structured RFC 6901 pointer +\n // AJV schema_path so renderers can deep-link into the schema.\n // Complementary fix lenses on the same fault.\n const hints = [...contextRejectionHints, ...shapeDriftHints, ...strictHints];\n\n // Build next step preview\n const next = getNextStepPreview(step.id, allSteps, updatedContext, runState.runnerVars);\n\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: passed && allValidationsPassedFinal,\n expect_error: step.expect_error,\n duration_ms: stepResult.duration_ms,\n // Legacy `response` field (new code reads `response_record`).\n // Redact in case a downstream consumer still keys off it; the\n // modern `response_record.payload` path is already redacted.\n response: redactSecrets(taskResult?.data),\n validations,\n context: updatedContext,\n ...(runState.contextProvenance &&\n runState.contextProvenance.size > 0 && {\n context_provenance: Object.fromEntries(runState.contextProvenance),\n }),\n ...responseDerivedContextResult(runState),\n error:\n step.expect_error || schemaRejectionIsAdvisory ? undefined : truncateError(stepResult.error || taskResult?.error),\n ...(!step.expect_error && taskResult?.adcp_error && { adcp_error: taskResult.adcp_error }),\n next,\n request: requestRecord,\n ...(responseRecord && { response_record: responseRecord }),\n extraction: extractionFromTaskResult(taskResult),\n ...(inputSchemaStripNotices.length > 0 && { notices: inputSchemaStripNotices }),\n ...(hints.length > 0 && { hints }),\n };\n}\n\n// ────────────────────────────────────────────────────────────\n// Probe dispatch (raw HTTP tasks)\n// ────────────────────────────────────────────────────────────\n\nfunction invalidTrustedMatchPublisherAuthTask(\n step: StoryboardStep,\n phaseId: string,\n context: StoryboardContext,\n allSteps: FlatStep[],\n runState: ExecutionState\n): StoryboardStepResult {\n const detail =\n `Pseudo-task \"${step.task}\" is valid only in a storyboard declaring ` +\n '`requires: [trusted_match_publisher_auth_runner]`; it was not dispatched over MCP or A2A.';\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: false,\n duration_ms: 0,\n validations: [],\n context,\n error: detail,\n next: getNextStepPreview(step.id, allSteps, context, runState.runnerVars),\n extraction: { path: 'none' },\n };\n}\n\nfunction trustedMatchPublisherAuthRequirementUnmetStep(\n step: StoryboardStep,\n phaseId: string,\n context: StoryboardContext,\n allSteps: FlatStep[],\n runState: ExecutionState,\n detail: string\n): StoryboardStepResult {\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: 'requirement_unmet',\n skip: { reason: 'requirement_unmet', requirement: 'trusted_match_publisher_auth_runner', detail },\n duration_ms: 0,\n validations: [],\n context,\n next: getNextStepPreview(step.id, allSteps, context, runState.runnerVars),\n extraction: { path: 'none', note: 'publisher-auth runner requirement unavailable' },\n };\n}\n\nasync function executeProbeStep(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- client type varies (TestClient)\n client: any,\n step: StoryboardStep,\n phaseId: string,\n context: StoryboardContext,\n allSteps: FlatStep[],\n options: StoryboardRunOptions,\n runState: ExecutionState\n): Promise<StoryboardStepResult> {\n const start = Date.now();\n let httpResult: HttpProbeResult | undefined;\n let oauthMetadataGraph: OAuthMetadataGraphGrade | undefined;\n const probeOpts = {\n allowPrivateIp: options.allow_http === true,\n fetchFn: options.transport?.trustedFetchFn,\n };\n let requestRecordOverride: RunnerRequestRecord | undefined;\n\n const contractsInScope = new Set(options.contracts ?? []);\n if (step.requires_contract) {\n if (!contractsInScope.has(step.requires_contract)) {\n httpResult = {\n url: runState.agentUrl,\n status: 0,\n headers: {},\n body: null,\n skipped: true,\n skip_reason: 'missing_test_kit_contract',\n error: `Test-kit contract \"${step.requires_contract}\" is not configured on this runner.`,\n };\n }\n }\n if (\n !httpResult &&\n step.task === 'expect_rate_limit_not_replayed' &&\n !contractsInScope.has(RATE_LIMIT_TRIP_CONTRACT)\n ) {\n httpResult = {\n url: runState.agentUrl,\n status: 0,\n headers: {},\n body: null,\n skipped: true,\n skip_reason: 'missing_test_kit_contract',\n error: `Test-kit contract \"${RATE_LIMIT_TRIP_CONTRACT}\" is not configured on this runner.`,\n };\n }\n\n if (httpResult) {\n // Contract-gated synthetic probes self-skip before doing any network work.\n } else if (TRUSTED_MATCH_PUBLISHER_AUTH_TASKS.has(step.task)) {\n const task = step.task as TrustedMatchPublisherAuthTask;\n let prepared = getPreparedTrustedMatchPublisherAuth(options);\n if (!prepared) {\n const runner = options.trusted_match_publisher_auth_runner;\n if (!runner) {\n return trustedMatchPublisherAuthRequirementUnmetStep(\n step,\n phaseId,\n context,\n allSteps,\n runState,\n 'No trusted_match_publisher_auth_runner is configured.'\n );\n }\n try {\n prepared = await prepareTrustedMatchPublisherAuthProbes(runner);\n } catch (error) {\n return trustedMatchPublisherAuthRequirementUnmetStep(\n step,\n phaseId,\n context,\n allSteps,\n runState,\n error instanceof Error ? error.message : String(error)\n );\n }\n }\n // These contract-owned raw requests must remain byte-shape faithful to\n // the storyboard. Generic run-level request overrides are intentionally\n // ignored; only authored placeholder substitution is allowed.\n const request = step.sample_request ? injectContext({ ...step.sample_request }, context, runState.runnerVars) : {};\n httpResult = await probeTrustedMatchPublisherAuth(prepared[task], request, {\n allowPrivateIp: options.allow_http === true,\n ...(options.signal && { signal: options.signal }),\n });\n requestRecordOverride = {\n transport: 'http',\n operation: step.task,\n payload: redactSecrets(request),\n url: redactOAuthUrlForOutput(prepared[task].endpoint),\n };\n } else if (step.task === 'protected_resource_metadata') {\n if (step.validations?.some(validation => validation.check === 'oauth_metadata_graph')) {\n oauthMetadataGraph = await gradeOAuthMetadataGraph(runState.agentUrl, {\n allowHttp: options.allow_http === true,\n signal: options.signal,\n trustedFetchFn: options.transport?.trustedFetchFn,\n });\n httpResult = oauthMetadataGraph.protected_resource_result;\n } else {\n httpResult = await probeProtectedResourceMetadata(runState.agentUrl, probeOpts);\n }\n // RFC 9728 presence semantics (adcp-client#677): a 404 means the agent is\n // honestly not advertising OAuth. Convert to a clean step skip so the\n // phase loop can cascade-skip the rest of oauth_discovery instead of\n // failing the http_status:200 validation. Any other status (including\n // 200) runs validations unchanged — an agent that serves PRM MUST serve\n // it correctly, regardless of whether the test kit also declared an\n // API key. Fetch errors (status 0) fall through to the normal failure\n // path since we can't distinguish \"agent down\" from \"misconfigured\".\n if (!oauthMetadataGraph && !httpResult.error && httpResult.status === 404) {\n httpResult.skipped = true;\n httpResult.skip_reason = 'oauth_not_advertised';\n }\n } else if (step.task === 'oauth_auth_server_metadata') {\n const prior = runState.priorProbes.get('protected_resource_metadata') ?? findPriorProbe(runState.priorStepResults);\n httpResult = await probeOauthAuthServerMetadata(prior, probeOpts);\n } else if (step.task === 'assert_contribution') {\n // Synthetic: evaluate only through validations (any_of). No network call.\n httpResult = undefined;\n } else if (step.task === 'request_signing_probe') {\n httpResult = await probeRequestSigningVector(step.id, runState.agentUrl, options);\n } else if (step.task === 'fetch_brand_jwks') {\n httpResult = await probeBrandJwks(options._profile?.raw_capabilities, probeOpts);\n } else if (step.task === 'assert_jwks_purpose') {\n // Webhook delivery is signed with the agent's request-signing key; the\n // deprecated webhook-signing purpose is still accepted (adcontextprotocol/adcp#5555).\n httpResult = assertJwksPurpose(runState.priorProbes.get('fetch_brand_jwks'), [\n 'request-signing',\n 'webhook-signing',\n ]);\n } else if (step.task === 'expect_rate_limit_not_replayed') {\n const specError = validateRateLimitTripSpec(step.rate_limit_trip);\n if (specError) {\n httpResult = {\n url: runState.agentUrl,\n status: 0,\n headers: {},\n body: { attempts: 0, error: 'rate_limit_trip_misconfigured' },\n error: specError,\n };\n } else if (options.allowLiveSideEffects !== true) {\n httpResult = {\n url: runState.agentUrl,\n status: 0,\n headers: {},\n body: null,\n skipped: true,\n skip_reason: 'live_side_effect_opt_in_required',\n error:\n 'The rate-limit trip probe can send hundreds of mutating requests. ' +\n 'Pass allowLiveSideEffects: true to authorize it explicitly.',\n };\n } else {\n const rateLimitTrip = step.rate_limit_trip!;\n const targetStep: StoryboardStep = {\n ...step,\n task: rateLimitTrip.trip_target_task,\n sample_request: rateLimitTrip.trip_target_sample_request,\n omit_idempotency_key: true,\n };\n const targetRequestResult = buildEffectiveStepRequest(targetStep, context, options, runState);\n if (!targetRequestResult.ok) {\n if ('creativeAssetFailure' in targetRequestResult) {\n return buildCreativeAssetFixtureUnavailableStep(\n step,\n phaseId,\n context,\n allSteps,\n runState,\n targetRequestResult.creativeAssetFailure\n );\n }\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: false,\n duration_ms: Date.now() - start,\n validations: [\n {\n check: 'unresolved_substitution',\n passed: false,\n description: `Fixture handle substitution failed: ${targetRequestResult.error}`,\n json_pointer: null,\n expected: 'an unambiguous fixture handle binding',\n actual: targetRequestResult.error,\n schema_id: null,\n schema_url: null,\n },\n ],\n context,\n next,\n extraction: { path: 'none' },\n error: targetRequestResult.error,\n };\n }\n const resolvedTargetRequest = targetRequestResult.request;\n const unresolvedContextVars = findUnresolvedContextVars(resolvedTargetRequest);\n const unresolvedAssetDirectives = findUnresolvedCreativeAssetDirectives(resolvedTargetRequest).map(path => ({\n key: path,\n token: BUILD_ASSETS_FROM_FORMAT_DIRECTIVE,\n }));\n const unresolvedVars = [...unresolvedContextVars, ...unresolvedAssetDirectives];\n if (unresolvedAssetDirectives.length > 0 || (unresolvedContextVars.length > 0 && !targetStep.expect_error)) {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const detail = `Skipped: unresolved context variables from rate_limit_trip.trip_target_sample_request: ${unresolvedVars\n .map(v => v.key)\n .join(', ')}.`;\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: false,\n skipped: true,\n skip_reason: 'prerequisite_failed',\n skip: buildSkip('prerequisite_failed', detail),\n duration_ms: Date.now() - start,\n validations: [],\n context,\n next,\n extraction: { path: 'none' },\n error: detail,\n };\n }\n const unresolvedRunnerTokens = findUnresolvedRunnerTokens(resolvedTargetRequest);\n if (unresolvedRunnerTokens.length > 0) {\n const isPrerequisiteFailure = hasUnresolvedPriorStepToken(unresolvedRunnerTokens);\n const skipReason = isPrerequisiteFailure ? 'prerequisite_failed' : 'not_applicable';\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const detail =\n 'Skipped: rate_limit_trip target request references unresolved runner placeholders. ' +\n `Unresolved token(s): ${unresolvedRunnerTokens.join(', ')}.`;\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: !isPrerequisiteFailure,\n skipped: true,\n skip_reason: skipReason,\n skip: buildSkip(skipReason, detail),\n duration_ms: Date.now() - start,\n validations: [],\n context,\n next,\n extraction: { path: 'none' },\n ...(isPrerequisiteFailure ? { error: detail } : {}),\n };\n }\n const advertisedTools = resolveAdvertisedTools(options);\n if (advertisedTools && !advertisedTools.includes(rateLimitTrip.trip_target_task)) {\n const next = getNextStepPreview(step.id, allSteps, context, runState.runnerVars);\n const detail = `Agent did not advertise tool \"${rateLimitTrip.trip_target_task}\"; agent tools: [${advertisedTools.join(', ')}].`;\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: 'missing_tool',\n skip: buildSkip('missing_tool', detail),\n duration_ms: Date.now() - start,\n validations: [],\n context,\n next,\n extraction: { path: 'none' },\n };\n }\n const resolvedSpec = {\n ...rateLimitTrip,\n trip_target_sample_request: resolvedTargetRequest,\n };\n const targetTransport: Extract<RunnerTransport, 'mcp' | 'a2a'> = options.protocol === 'a2a' ? 'a2a' : 'mcp';\n const observer = new RateLimitTripObserver(client, {\n keyMinter: generateIdempotencyKey,\n correlationPrefix: step.id,\n transport: targetTransport,\n });\n const observation = await observer.run(resolvedSpec);\n httpResult = rateLimitTripObservationToProbeResult(runState.agentUrl, observation);\n const observedRequest = observation.body.replay_request ?? observation.body.trip_request ?? resolvedTargetRequest;\n requestRecordOverride = {\n transport: targetTransport,\n operation: rateLimitTrip.trip_target_task,\n payload: redactSecrets(observedRequest),\n ...(runState.agentUrl ? { url: redactOAuthUrlForOutput(runState.agentUrl) } : {}),\n };\n }\n } else if (step.task === REPLAY_TRUSTED_MATCH_CONTEXT_VECTOR_TASK) {\n const routerRunner = options.trusted_match_context_router_runner;\n if (!routerRunner?.router_url || typeof routerRunner.registerProviders !== 'function') {\n httpResult = {\n url: routerRunner?.router_url ?? runState.agentUrl,\n status: 0,\n headers: {},\n body: null,\n skipped: true,\n skip_reason: 'grader_skipped',\n error:\n 'No Trusted Match Context router harness configured. Pass trusted_match_context_router_runner ' +\n 'with router_url and registerProviders; the runner will not dispatch this pseudo-task over MCP/A2A.',\n };\n } else {\n const requestOverride = options.request\n ? injectContext({ ...options.request }, context, runState.runnerVars)\n : step.sample_request\n ? injectContext({ ...step.sample_request }, context, runState.runnerVars)\n : undefined;\n const replay = await replayTrustedMatchContextVector(step, routerRunner, {\n ...(requestOverride && { requestOverride }),\n ...(options.adcpVersion && { adcpVersion: options.adcpVersion }),\n ...(options.signal && { signal: options.signal }),\n });\n httpResult = replay.httpResult;\n requestRecordOverride = {\n transport: 'http',\n operation: step.task,\n payload: redactSecrets(replay.request),\n url: redactOAuthUrlForOutput(replay.httpResult.url),\n };\n }\n }\n\n if (httpResult) runState.priorProbes.set(step.task, httpResult);\n\n const duration = Date.now() - start;\n const requestRecord: RunnerRequestRecord = requestRecordOverride ?? {\n transport: 'http',\n operation: step.task,\n payload: null,\n ...(httpResult?.url\n ? { url: redactOAuthUrlForOutput(httpResult.url) }\n : runState.agentUrl\n ? { url: redactOAuthUrlForOutput(runState.agentUrl) }\n : {}),\n };\n const filteredProbeHeaders = filterResponseHeaders(httpResult?.headers);\n const responseTransport = requestRecordOverride?.transport ?? 'http';\n const responseRecord: RunnerResponseRecord | undefined = httpResult\n ? {\n transport: responseTransport,\n payload: redactSecrets(httpResult.body),\n ...(responseTransport === 'http' && { status: httpResult.status }),\n ...(filteredProbeHeaders && { headers: filteredProbeHeaders }),\n duration_ms: duration,\n }\n : undefined;\n const redactedHttpResult = httpResult\n ? {\n ...httpResult,\n url: redactOAuthUrlForOutput(httpResult.url),\n headers: filteredProbeHeaders ?? {},\n body: redactSecrets(httpResult.body),\n ...(httpResult.error && { error: redactOAuthUrlsInText(httpResult.error) }),\n ...(responseTransport !== 'http' && { status: undefined }),\n }\n : undefined;\n\n // Probe may self-skip (request_signing_probe uses this for operator opt-outs\n // and capability-profile mismatches). Surface as a skipped step without\n // running validations — skip ≠ fail. The detailed reason goes on\n // `skip_reason`; the canonical spec reason goes on `skip` so contract\n // consumers see a stable enum.\n if (httpResult?.skipped) {\n const detailedReason = (httpResult.skip_reason ?? 'probe_skipped') as RunnerDetailedSkipReason;\n const canonicalReason = DETAILED_SKIP_TO_CANONICAL[detailedReason] ?? 'not_applicable';\n const detail =\n CANONICAL_SKIP_DETAILS[detailedReason] ??\n httpResult.error ??\n DETAILED_SKIP_DETAILS[detailedReason] ??\n SKIP_DETAILS[canonicalReason];\n const selectionResult = selectionForProbeSkip(detailedReason, detail);\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: detailedReason,\n skip: { reason: canonicalReason, detail },\n ...(selectionResult && { selection_result: selectionResult }),\n duration_ms: duration,\n response: redactedHttpResult,\n validations: [],\n context,\n next: getNextStepPreview(step.id, allSteps, context, runState.runnerVars),\n request: requestRecord,\n ...(responseRecord && { response_record: responseRecord }),\n extraction: { path: 'none', note: 'probe self-skipped' },\n };\n }\n\n const vctx: ValidationContext = {\n taskName: step.task === REPLAY_TRUSTED_MATCH_CONTEXT_VECTOR_TASK ? 'context_match' : step.task,\n ...(options.adcpVersion && { adcpVersion: options.adcpVersion }),\n ...(options._serverAdcpVersion && { responseAdcpVersion: options._serverAdcpVersion }),\n strictResponseSchemaValidation: options.strictResponseSchemaValidation !== false,\n httpResult: redactedHttpResult,\n ...(step.task === REPLAY_TRUSTED_MATCH_CONTEXT_VECTOR_TASK &&\n redactedHttpResult && {\n taskResult: {\n success: !redactedHttpResult.error && redactedHttpResult.status >= 200 && redactedHttpResult.status < 300,\n data: redactedHttpResult.body,\n ...(redactedHttpResult.error && { error: redactedHttpResult.error }),\n },\n }),\n agentUrl: runState.agentUrl,\n contributions: runState.contributions,\n ...(step.response_schema_ref && { responseSchemaRef: step.response_schema_ref }),\n request: requestRecord,\n ...(responseRecord && { response: responseRecord }),\n storyboardContext: context,\n ...(oauthMetadataGraph && { oauthMetadataGraph }),\n };\n const validations = step.validations?.length ? runValidations(step.validations, vctx) : [];\n const allValidationsPassed = validations.every(v => !validationFailsStep(v));\n\n // For probes, the \"task passed\" proxy is: fetch returned without error AND\n // all validations passed. For assert_contribution (no httpResult), we lean\n // on validations alone.\n const fetchOk = httpResult ? !httpResult.error : true;\n const passed = fetchOk && allValidationsPassed;\n\n const extraction: RunnerExtractionRecord = httpResult\n ? httpResult.error\n ? { path: 'error' }\n : { path: 'structured_content', note: 'http-probe body parsed as JSON' }\n : { path: 'none' };\n\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed,\n duration_ms: duration,\n response: redactedHttpResult ?? undefined,\n validations,\n context,\n error: httpResult?.error ?? (passed ? undefined : 'Probe validations failed.'),\n next: getNextStepPreview(step.id, allSteps, context, runState.runnerVars),\n request: requestRecord,\n ...(responseRecord && { response_record: responseRecord }),\n extraction,\n };\n}\n\ntype FixtureBindingApplicationResult = { ok: true; request: Record<string, unknown> } | { ok: false; error: string };\n\ntype EffectiveStepRequestResult =\n | FixtureBindingApplicationResult\n | { ok: false; creativeAssetFailure: CreativeAssetFixtureUnavailableFailure };\n\nfunction applyFixtureBindingsSafely(\n request: Record<string, unknown>,\n task: string,\n options: StoryboardRunOptions,\n runState: ExecutionState\n): FixtureBindingApplicationResult {\n try {\n return {\n ok: true,\n request: applyFixtureBindingsToRequest(\n request,\n task,\n runState.fixtureBindings,\n options.adcpVersion ?? ADCP_VERSION\n ),\n };\n } catch (error) {\n return { ok: false, error: error instanceof Error ? error.message : String(error) };\n }\n}\n\nfunction buildEffectiveStepRequest(\n step: StoryboardStep,\n context: StoryboardContext,\n options: StoryboardRunOptions,\n runState: ExecutionState\n): EffectiveStepRequestResult {\n let request: Record<string, unknown>;\n if (options.request) {\n request = injectContext({ ...options.request }, context, runState.runnerVars);\n } else if (step.expect_error && step.sample_request) {\n request = injectContext({ ...step.sample_request }, context, runState.runnerVars);\n } else if (hasRequestEnricher(step.task)) {\n request = enrichRequest(step, context, options, runState.runnerVars);\n } else if (step.sample_request) {\n request = injectContext({ ...step.sample_request }, context, runState.runnerVars);\n } else {\n request = {};\n }\n if (step.context_inputs?.length) {\n request = applyContextInputs(request, step.context_inputs, context);\n }\n request = applyBrandInvariant(request, options, step.task, { omit_account: step.omit_account });\n if (options.disable_sandbox === true) {\n request = applyDisableSandboxHint(request, step.task);\n }\n request = applyIdempotencyInvariant(request, step.task, step);\n const fixtureBinding = applyFixtureBindingsSafely(request, step.task, options, runState);\n if (!fixtureBinding.ok) return fixtureBinding;\n const creativeAssetExpansion = expandCreativeAssetDirectivesWithDiagnostics(\n fixtureBinding.request,\n context,\n options.test_kit\n );\n if (!creativeAssetExpansion.ok && creativeAssetExpansion.failure.reason === 'fixture_unavailable') {\n return { ok: false, creativeAssetFailure: creativeAssetExpansion.failure };\n }\n return {\n ok: true,\n request: creativeAssetExpansion.value as Record<string, unknown>,\n };\n}\n\ninterface CreativeAssetPreflightGap {\n target: FlatStep;\n failure: CreativeAssetFixtureUnavailableFailure;\n}\n\n/**\n * Preflight future creative directives as soon as their seller format enters\n * context. Missing context and malformed directives stay on their ordinary\n * execution paths; only a proven test-kit coverage gap terminates the run.\n */\nfunction preflightRemainingCreativeAssetDirectives(\n allSteps: FlatStep[],\n afterGlobalIndex: number,\n context: StoryboardContext,\n options: StoryboardRunOptions,\n runState: ExecutionState,\n excludedPhaseIds: ReadonlySet<string> = new Set()\n): CreativeAssetPreflightGap | undefined {\n const contractsInScope = new Set(options.contracts ?? []);\n for (const target of allSteps) {\n if (target.globalIndex <= afterGlobalIndex) continue;\n if (excludedPhaseIds.has(target.phaseId)) continue;\n\n const resolvedTask = resolveTaskName(target.step, options);\n if (!resolvedTask) continue;\n if (target.step.requires_tool && options.agentTools && !options.agentTools.includes(target.step.requires_tool)) {\n continue;\n }\n if (target.step.requires_contract && !contractsInScope.has(target.step.requires_contract)) {\n continue;\n }\n if (\n target.step.task === 'expect_rate_limit_not_replayed' &&\n (!contractsInScope.has(RATE_LIMIT_TRIP_CONTRACT) || options.allowLiveSideEffects !== true)\n ) {\n continue;\n }\n if (!PROBE_TASKS.has(target.step.task) && options.agentTools && !options.agentTools.includes(resolvedTask)) {\n continue;\n }\n let requestStep = resolvedTask === target.step.task ? target.step : { ...target.step, task: resolvedTask };\n\n if (target.step.task === 'expect_rate_limit_not_replayed') {\n const rateLimitTrip = target.step.rate_limit_trip;\n if (validateRateLimitTripSpec(rateLimitTrip) || !rateLimitTrip) continue;\n requestStep = {\n ...target.step,\n task: rateLimitTrip.trip_target_task,\n sample_request: rateLimitTrip.trip_target_sample_request,\n omit_idempotency_key: true,\n };\n }\n\n const request = buildEffectiveStepRequest(requestStep, context, options, runState);\n if (!request.ok && 'creativeAssetFailure' in request) {\n return { target, failure: request.creativeAssetFailure };\n }\n }\n return undefined;\n}\n\ninterface ResolvedWebhookReplayVector {\n id: string;\n description?: string;\n expected: 'accept' | 'reject';\n expected_error?: string;\n same_event_as?: string;\n payload: Record<string, unknown>;\n source: string;\n}\n\nasync function executeReplayWebhookVectorStep(\n step: StoryboardStep,\n phaseId: string,\n context: StoryboardContext,\n allSteps: FlatStep[],\n options: StoryboardRunOptions,\n runState: ExecutionState\n): Promise<StoryboardStepResult> {\n const start = Date.now();\n if (step.requires_contract && !new Set(options.contracts ?? []).has(step.requires_contract)) {\n const detail = `Test-kit contract \"${step.requires_contract}\" is not configured on this runner.`;\n const reason: RunnerDetailedSkipReason = 'missing_test_kit_contract';\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: reason,\n skip: buildSkip(DETAILED_SKIP_TO_CANONICAL[reason], detail),\n duration_ms: Date.now() - start,\n validations: [],\n context,\n next: getNextStepPreview(step.id, allSteps, context, runState.runnerVars),\n extraction: { path: 'none', note: 'test-kit contract not configured' },\n };\n }\n\n const receiver = options.webhook_replay_receiver;\n if (!receiver?.url) {\n const detail =\n 'No webhook replay receiver URL configured. Pass `webhook_replay_receiver.url` in StoryboardRunOptions to run inbound receiver conformance.';\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: true,\n skipped: true,\n skip_reason: 'grader_skipped',\n skip: buildSkip('not_applicable', detail),\n duration_ms: Date.now() - start,\n validations: [],\n context,\n next: getNextStepPreview(step.id, allSteps, context, runState.runnerVars),\n extraction: { path: 'none', note: 'webhook replay receiver not configured' },\n };\n }\n\n const vector = resolveWebhookReplayVector(step, options);\n if ('error' in vector) {\n return failedWebhookReplayStep(step, phaseId, context, allSteps, runState, start, vector.error);\n }\n\n const body = JSON.stringify(vector.payload);\n let headers: Record<string, string>;\n try {\n headers = buildWebhookReplayHeaders(receiver.url, body, receiver);\n } catch (error) {\n return failedWebhookReplayStep(\n step,\n phaseId,\n context,\n allSteps,\n runState,\n start,\n error instanceof Error ? error.message : String(error)\n );\n }\n\n const requestRecord: RunnerRequestRecord = {\n transport: 'http',\n operation: step.task,\n payload: {\n vector_ref: step.vector_ref,\n vector_id: vector.id,\n expected: vector.expected,\n body: redactSecrets(vector.payload),\n },\n url: receiver.url,\n };\n\n let httpResult: HttpProbeResult;\n try {\n httpResult = await postWebhookReplayVector(\n receiver.url,\n body,\n headers,\n receiver.fetchImpl ?? fetch,\n receiver.timeoutMs ?? WEBHOOK_REPLAY_DEFAULT_TIMEOUT_MS,\n options.signal\n );\n } catch (error) {\n httpResult = {\n url: receiver.url,\n status: 0,\n headers: {},\n body: null,\n error: error instanceof Error ? error.message : String(error),\n };\n }\n\n const duration = Date.now() - start;\n const filteredProbeHeaders = filterResponseHeaders(httpResult.headers);\n const responseRecord: RunnerResponseRecord = {\n transport: 'http',\n payload: redactSecrets(httpResult.body),\n status: httpResult.status,\n ...(filteredProbeHeaders && { headers: filteredProbeHeaders }),\n duration_ms: duration,\n };\n const redactedHttpResult: HttpProbeResult = {\n ...httpResult,\n body: redactSecrets(httpResult.body),\n };\n\n const validations = buildWebhookReplayValidations(step, vector, allSteps, options, requestRecord, responseRecord);\n const allValidationsPassed = validations.every(v => !validationFailsStep(v));\n const fetchOk = !httpResult.error;\n const passed = fetchOk && allValidationsPassed;\n\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed,\n expect_error: step.expect_error,\n duration_ms: duration,\n response: redactedHttpResult,\n validations,\n context,\n error: httpResult.error ?? (passed ? undefined : 'Webhook replay validations failed.'),\n next: getNextStepPreview(step.id, allSteps, context, runState.runnerVars),\n request: requestRecord,\n response_record: responseRecord,\n extraction: httpResult.error\n ? { path: 'error' }\n : { path: 'structured_content', note: 'webhook receiver HTTP response parsed' },\n };\n}\n\nfunction failedWebhookReplayStep(\n step: StoryboardStep,\n phaseId: string,\n context: StoryboardContext,\n allSteps: FlatStep[],\n runState: ExecutionState,\n start: number,\n error: string\n): StoryboardStepResult {\n return {\n step_id: step.id,\n phase_id: phaseId,\n title: step.title,\n task: step.task,\n passed: false,\n duration_ms: Date.now() - start,\n validations: [\n {\n check: 'webhook_replay_vector_resolved',\n passed: false,\n description: 'Resolve webhook replay vector before dispatch.',\n expected: step.vector_ref ?? 'vector_ref',\n actual: null,\n error,\n json_pointer: null,\n },\n ],\n context,\n error,\n next: getNextStepPreview(step.id, allSteps, context, runState.runnerVars),\n extraction: { path: 'none' },\n };\n}\n\nfunction buildWebhookReplayValidations(\n step: StoryboardStep,\n vector: ResolvedWebhookReplayVector,\n allSteps: FlatStep[],\n options: StoryboardRunOptions,\n request: RunnerRequestRecord,\n response: RunnerResponseRecord\n): ValidationResult[] {\n const expectedReject = step.expect_error === true || vector.expected === 'reject';\n const status = typeof response.status === 'number' ? response.status : 0;\n const accepted = status >= 200 && status < 300;\n const validations: ValidationResult[] = [\n {\n check: 'webhook_replay_http_status',\n passed: expectedReject ? !accepted : accepted,\n description: expectedReject\n ? 'Receiver rejects malformed webhook replay vectors with a non-2xx status.'\n : 'Receiver accepts canonical webhook replay vectors with a 2xx status.',\n expected: expectedReject ? 'non-2xx' : '2xx',\n actual: status,\n json_pointer: null,\n request,\n response,\n },\n ];\n\n if (step.webhook_payload_schema_ref) {\n const validator = getSchemaValidatorByRef(step.webhook_payload_schema_ref, options.adcpVersion);\n const schemaValid = validator ? validator(vector.payload) : false;\n validations.push({\n check: 'webhook_replay_payload_schema',\n passed: expectedReject ? !schemaValid : schemaValid,\n description: expectedReject\n ? 'Malformed replay vector is rejected by the webhook payload schema.'\n : 'Canonical replay vector validates against the webhook payload schema.',\n expected: expectedReject ? 'schema invalid' : 'schema valid',\n actual: schemaValid\n ? 'schema valid'\n : validator\n ? validator.errors\n : `schema not found: ${step.webhook_payload_schema_ref}`,\n schema_id: step.webhook_payload_schema_ref,\n schema_url: null,\n json_pointer: null,\n request,\n });\n }\n\n const sameEventAs = step.same_event_as ?? vector.same_event_as;\n if (sameEventAs) {\n const priorStep = findWebhookReplaySameEventStep(allSteps, sameEventAs);\n const priorVector = priorStep ? resolveWebhookReplayVector(priorStep, options) : undefined;\n const currentKey = readStringField(vector.payload, 'idempotency_key');\n const priorKey =\n priorVector && !('error' in priorVector) ? readStringField(priorVector.payload, 'idempotency_key') : undefined;\n validations.push({\n check: 'webhook_replay_same_event_idempotency_key',\n passed: Boolean(currentKey && priorKey && currentKey === priorKey),\n description: 'Retry replay vectors for the same logical event preserve idempotency_key.',\n expected: priorKey ?? `prior vector for step ${sameEventAs}`,\n actual: currentKey ?? null,\n json_pointer: '/idempotency_key',\n request,\n });\n }\n\n return validations;\n}\n\nfunction findWebhookReplaySameEventStep(allSteps: FlatStep[], sameEventAs: string): StoryboardStep | undefined {\n return (\n allSteps.find(item => item.step.id === sameEventAs)?.step ??\n allSteps.find(item => vectorRefId(item.step.vector_ref) === sameEventAs)?.step\n );\n}\n\nfunction vectorRefId(ref: string | undefined): string | undefined {\n return ref ? parseWebhookVectorRef(ref)?.id : undefined;\n}\n\nfunction resolveWebhookReplayVector(\n step: StoryboardStep,\n options: StoryboardRunOptions\n): ResolvedWebhookReplayVector | { error: string } {\n if (!step.vector_ref) {\n return { error: '`replay_webhook_vector` step requires vector_ref.' };\n }\n const parsed = parseWebhookVectorRef(step.vector_ref);\n if (!parsed) {\n return { error: `Invalid webhook vector_ref: ${step.vector_ref}` };\n }\n\n const vectorFile = readWebhookVectorFile(parsed.path, options);\n if ('error' in vectorFile) {\n const fallback = fallbackWebhookReplayVector(parsed, step);\n if (fallback) return fallback;\n return vectorFile;\n }\n\n const selected = selectWebhookReplayVector(vectorFile.body, parsed.section, parsed.id);\n if (!selected) {\n return { error: `Webhook replay vector not found: ${step.vector_ref}` };\n }\n return {\n id: selected.id,\n description: selected.description,\n expected: parsed.section === 'negative' || step.expect_error === true ? 'reject' : 'accept',\n ...(selected.expected_error && { expected_error: selected.expected_error }),\n ...(selected.same_event_as && { same_event_as: selected.same_event_as }),\n payload: selected.payload,\n source: vectorFile.path,\n };\n}\n\nfunction parseWebhookVectorRef(ref: string): { path: string; section: string; id: string } | undefined {\n const [pathPart, fragment] = ref.split('#');\n if (!pathPart || !fragment) return undefined;\n const parts = fragment.split('/').filter(Boolean);\n if (parts.length !== 2) return undefined;\n return { path: pathPart, section: parts[0]!, id: parts[1]! };\n}\n\nfunction readWebhookVectorFile(\n refPath: string,\n options: StoryboardRunOptions\n): { path: string; body: unknown } | { error: string } {\n for (const candidate of webhookVectorFileCandidates(refPath, options)) {\n if (!existsSync(candidate)) continue;\n try {\n return { path: candidate, body: JSON.parse(readFileSync(candidate, 'utf8')) };\n } catch (error) {\n return {\n error: `Failed to read webhook replay vector file ${candidate}: ${error instanceof Error ? error.message : error}`,\n };\n }\n }\n return { error: `Webhook replay vector file not found for ${refPath}` };\n}\n\nfunction webhookVectorFileCandidates(refPath: string, options: StoryboardRunOptions): string[] {\n const withoutStatic = refPath.replace(/^static\\//, '');\n const baseName = basename(refPath);\n const candidates: string[] = [];\n if (options.webhook_replay_receiver?.vectorsRoot) {\n candidates.push(join(options.webhook_replay_receiver.vectorsRoot, refPath));\n candidates.push(join(options.webhook_replay_receiver.vectorsRoot, withoutStatic));\n candidates.push(join(options.webhook_replay_receiver.vectorsRoot, baseName));\n }\n const complianceDir = getComplianceCacheDir({ version: options.adcpVersion });\n candidates.push(join(complianceDir, withoutStatic));\n candidates.push(join(complianceDir, refPath));\n candidates.push(join(process.cwd(), refPath));\n candidates.push(join(process.cwd(), withoutStatic));\n return [...new Set(candidates)];\n}\n\nfunction selectWebhookReplayVector(\n body: unknown,\n section: string,\n id: string\n):\n | {\n id: string;\n description?: string;\n expected_error?: string;\n same_event_as?: string;\n payload: Record<string, unknown>;\n }\n | undefined {\n if (!body || typeof body !== 'object') return undefined;\n const bucket = (body as Record<string, unknown>)[section];\n if (!Array.isArray(bucket)) return undefined;\n for (const item of bucket) {\n if (!item || typeof item !== 'object') continue;\n const rec = item as Record<string, unknown>;\n if (rec.id !== id || !rec.payload || typeof rec.payload !== 'object' || Array.isArray(rec.payload)) continue;\n return {\n id,\n ...(typeof rec.description === 'string' && { description: rec.description }),\n ...(typeof rec.expected_error === 'string' && { expected_error: rec.expected_error }),\n ...(typeof rec.same_event_as === 'string' && { same_event_as: rec.same_event_as }),\n payload: rec.payload as Record<string, unknown>,\n };\n }\n return undefined;\n}\n\nfunction fallbackWebhookReplayVector(\n parsed: { path: string; section: string; id: string },\n step: StoryboardStep\n): ResolvedWebhookReplayVector | undefined {\n if (basename(parsed.path) !== 'webhook-receiver-envelope.json') return undefined;\n const canonical = fallbackWebhookDeliveryEnvelope('whk_20260526_example_000031');\n const byId: Record<string, Record<string, unknown>> = {\n 'mcp-delivery-report-envelope': canonical,\n 'mcp-delivery-report-retry-same-idempotency-key': {\n ...canonical,\n timestamp: '2026-05-26T09:00:45.582Z',\n },\n 'bare-delivery-result': canonical.result as Record<string, unknown>,\n 'missing-idempotency-key': omitKey(canonical, 'idempotency_key'),\n 'unsupported-top-level-status': {\n ...canonical,\n idempotency_key: 'whk_20260526_example_000032',\n task_id: 'delivery_report_67_2026_04_000032',\n status: 'active',\n },\n };\n const payload = byId[parsed.id];\n if (!payload) return undefined;\n return {\n id: parsed.id,\n expected: parsed.section === 'negative' || step.expect_error === true ? 'reject' : 'accept',\n ...(parsed.id === 'mcp-delivery-report-retry-same-idempotency-key' && {\n same_event_as: 'mcp-delivery-report-envelope',\n }),\n ...(parsed.id === 'bare-delivery-result' && { expected_error: 'missing_envelope_fields' }),\n ...(parsed.id === 'missing-idempotency-key' && { expected_error: 'missing_idempotency_key' }),\n ...(parsed.id === 'unsupported-top-level-status' && { expected_error: 'invalid_envelope_status' }),\n payload,\n source: 'built-in:webhook-receiver-envelope',\n };\n}\n\nfunction fallbackWebhookDeliveryEnvelope(idempotencyKey: string): Record<string, unknown> {\n return {\n idempotency_key: idempotencyKey,\n operation_id: 'delivery_report_67_2026_04',\n task_id: 'delivery_report_67_2026_04_000031',\n task_type: 'media_buy_delivery',\n status: 'completed',\n timestamp: '2026-05-26T09:00:44.582Z',\n message: 'Scheduled media buy delivery report available',\n result: {\n notification_type: 'scheduled',\n sequence_number: 31,\n reporting_period: {\n start: '2026-05-25T00:00:00Z',\n end: '2026-05-25T23:59:00Z',\n },\n currency: 'USD',\n media_buy_deliveries: [],\n },\n };\n}\n\nfunction omitKey(input: Record<string, unknown>, key: string): Record<string, unknown> {\n const out = { ...input };\n delete out[key];\n return out;\n}\n\nfunction readStringField(input: Record<string, unknown>, key: string): string | undefined {\n const value = input[key];\n return typeof value === 'string' ? value : undefined;\n}\n\nfunction buildWebhookReplayHeaders(\n receiverUrl: string,\n body: string,\n receiver: NonNullable<StoryboardRunOptions['webhook_replay_receiver']>\n): Record<string, string> {\n const headers: Record<string, string> = {\n 'content-type': 'application/json',\n ...(receiver.headers ?? {}),\n };\n const signing = receiver.signing ?? { mode: 'none' as const };\n if (signing.mode === 'none') return headers;\n if (signing.mode === 'hmac') {\n const timestamp = signing.now ? signing.now() : Math.floor(Date.now() / 1000);\n const hmac = createHmac('sha256', signing.secret);\n hmac.update(String(timestamp), 'utf8');\n hmac.update('.', 'utf8');\n hmac.update(body, 'utf8');\n return {\n ...headers,\n 'x-adcp-timestamp': String(timestamp),\n 'x-adcp-signature': `sha256=${hmac.digest('hex')}`,\n };\n }\n if (!signing.key) {\n throw new Error('webhook_replay_receiver.signing.key is required when signing.mode is \"rfc9421\".');\n }\n const request: RequestLike = {\n method: 'POST',\n url: signing.targetUrl ?? receiverUrl,\n headers,\n body,\n };\n return { ...headers, ...signWebhook(request, signing.key, { now: signing.now }).headers };\n}\n\nasync function postWebhookReplayVector(\n url: string,\n body: string,\n headers: Record<string, string>,\n fetchImpl: typeof fetch,\n timeoutMs: number,\n parentSignal?: AbortSignal\n): Promise<HttpProbeResult> {\n const controller = new AbortController();\n const abort = () => controller.abort(parentSignal?.reason);\n if (parentSignal?.aborted) abort();\n parentSignal?.addEventListener('abort', abort, { once: true });\n const timer = setTimeout(\n () => controller.abort(new Error(`webhook replay timed out after ${timeoutMs}ms`)),\n timeoutMs\n );\n try {\n const response = await fetchImpl(url, {\n method: 'POST',\n headers,\n body,\n signal: controller.signal,\n });\n const responseBody = await readWebhookReplayResponseBody(response);\n return {\n url,\n status: response.status,\n headers: lowerCaseHeaders(response.headers),\n body: responseBody,\n };\n } finally {\n clearTimeout(timer);\n parentSignal?.removeEventListener('abort', abort);\n }\n}\n\nasync function readWebhookReplayResponseBody(response: Response): Promise<unknown> {\n const text = await response.text();\n if (!text) return null;\n const contentType = response.headers.get('content-type') ?? '';\n if (contentType.toLowerCase().includes('application/json')) {\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n }\n return text;\n}\n\nfunction lowerCaseHeaders(headers: Headers): Record<string, string> {\n const out: Record<string, string> = {};\n headers.forEach((value, key) => {\n out[key.toLowerCase()] = value;\n });\n return out;\n}\n\nfunction resolveAdvertisedTools(options: StoryboardRunOptions): string[] | undefined {\n return options.agentTools ?? normalizeAgentToolNames(options._profile?.tools);\n}\n\nfunction rateLimitTripObservationToProbeResult(\n agentUrl: string,\n observation: RateLimitTripObservation\n): HttpProbeResult {\n if (observation.status === 'not_applicable') {\n return {\n url: agentUrl,\n status: 0,\n headers: {},\n body: observation.body,\n skipped: true,\n skip_reason: observation.skip_reason,\n error: observation.message,\n };\n }\n if (observation.status === 'failed') {\n return {\n url: agentUrl,\n status: 0,\n headers: {},\n body: { ...observation.body, error: observation.error },\n error: observation.message,\n };\n }\n return {\n url: agentUrl,\n status: 200,\n headers: {},\n body: observation.body,\n };\n}\n\nasync function probeBrandJwks(\n rawCapabilities: unknown,\n options: { allowPrivateIp?: boolean; fetchFn?: typeof fetch }\n): Promise<HttpProbeResult> {\n const brandJsonUrl = readBrandJsonUrl(rawCapabilities);\n if (!brandJsonUrl) {\n return {\n url: '',\n status: 0,\n headers: {},\n body: null,\n error: 'identity.brand_json_url missing from get_adcp_capabilities; cannot fetch brand JWKS',\n };\n }\n\n const brand = await fetchProbe(brandJsonUrl, options);\n if (brand.error || brand.status < 200 || brand.status >= 300) {\n return {\n ...brand,\n error: brand.error ?? `brand.json fetch returned HTTP ${brand.status}`,\n };\n }\n\n const agents = brand.body && typeof brand.body === 'object' ? (brand.body as { agents?: unknown }).agents : undefined;\n const jwksUri = Array.isArray(agents)\n ? agents\n .map(agent => (agent && typeof agent === 'object' ? (agent as { jwks_uri?: unknown }).jwks_uri : undefined))\n .find((uri): uri is string => typeof uri === 'string' && uri.length > 0)\n : undefined;\n if (!jwksUri) {\n return {\n url: brandJsonUrl,\n status: 0,\n headers: {},\n body: brand.body,\n error: 'brand.json agents[] did not contain a jwks_uri',\n };\n }\n\n const jwks = await fetchProbe(jwksUri, options);\n if (jwks.error || jwks.status < 200 || jwks.status >= 300) {\n return {\n ...jwks,\n error: jwks.error ?? `JWKS fetch returned HTTP ${jwks.status}`,\n };\n }\n return jwks;\n}\n\nfunction assertJwksPurpose(prior: HttpProbeResult | undefined, purposes: string | readonly string[]): HttpProbeResult {\n const accepted = typeof purposes === 'string' ? [purposes] : purposes;\n if (!prior || prior.error) {\n return {\n url: prior?.url ?? '',\n status: prior?.status ?? 0,\n headers: prior?.headers ?? {},\n body: prior?.body ?? null,\n error: prior?.error ?? 'fetch_brand_jwks step missing; cannot assert JWKS purpose',\n };\n }\n const keys = prior.body && typeof prior.body === 'object' ? (prior.body as { keys?: unknown }).keys : undefined;\n if (!Array.isArray(keys)) {\n return {\n url: prior.url,\n status: 0,\n headers: {},\n body: prior.body,\n error: 'JWKS body does not contain keys[]',\n };\n }\n const matching = keys.filter(key => {\n if (!key || typeof key !== 'object') return false;\n const rec = key as { adcp_use?: unknown; status?: unknown; revoked?: unknown };\n return (\n typeof rec.adcp_use === 'string' &&\n accepted.includes(rec.adcp_use) &&\n rec.status !== 'revoked' &&\n rec.revoked !== true\n );\n });\n if (matching.length === 0) {\n return {\n url: prior.url,\n status: 0,\n headers: {},\n body: prior.body,\n error: `JWKS contains no active key with adcp_use in {${accepted.join(', ')}}`,\n };\n }\n return {\n url: prior.url,\n status: 200,\n headers: prior.headers,\n body: { accepted_purposes: accepted, matching_key_count: matching.length },\n };\n}\n\nfunction findPriorProbe(priorStepResults: Map<string, StoryboardStepResult>): HttpProbeResult | undefined {\n // Fallback for runStoryboardStep where priorProbes isn't populated — reach\n // into the step result's response, which we set to the HttpProbeResult above.\n for (const r of priorStepResults.values()) {\n const resp = r.response as HttpProbeResult | undefined;\n if (resp && typeof resp === 'object' && 'url' in resp && 'status' in resp) return resp;\n }\n return undefined;\n}\n\n/**\n * Reduce the captured fetch traffic for an A2A step into the\n * `A2ATaskEnvelope` validations consume. The A2A SDK fires multiple\n * requests per call (`/.well-known/agent-card.json` discovery on\n * fresh clients, then a `message/send` POST), and a single dispatch\n * may also poll `tasks/get` afterwards. We pick the capture whose\n * REQUEST body declares `method: 'message/send'`; if no capture\n * declares the method we fall back to the last POST with a\n * JSON-RPC-shaped body. GET captures and non-JSON bodies are\n * skipped — `undefined` here surfaces as `not_applicable` in the\n * validator, which is more useful than a garbage envelope.\n *\n * Captured response bodies pass through `redactSecrets` before\n * landing in `ValidationContext.a2aEnvelope`. The bearer-token\n * regex in `wrapFetchWithCapture` only catches `Bearer <token>`\n * substrings; AdCP-style secret-shaped fields (`api_key`,\n * `client_secret`, `access_token`) inside a DataPart payload only\n * get redacted here. Failure paths thread the envelope into\n * `ValidationResult.actual.failures[].actual` which lands in\n * persisted compliance reports — redacting at capture parse time\n * keeps that surface consistent with `responseRecord.payload`,\n * which the runner already redacts on the success path.\n */\nfunction parseLastA2aMessageSendCapture(captures: readonly RawHttpCapture[]): A2ATaskEnvelope | undefined {\n let messageSendIdx = -1;\n let lastPostIdx = -1;\n for (let i = captures.length - 1; i >= 0; i--) {\n const cap = captures[i];\n if (!cap || cap.method !== 'POST') continue;\n if (lastPostIdx === -1) lastPostIdx = i;\n // The fetch wrapper doesn't capture the request body, so disambiguate\n // by parsing the response and checking for an A2A `Task` shape on\n // the result. `tasks/get` and `message/send` both return tasks, but\n // only `message/send` is the immediate response we want to assert\n // on for submitted-arm shape checks. When the runner adds polling,\n // we'd need request-body capture to distinguish reliably; for v0\n // the last POST is `message/send` because the SDK doesn't poll\n // synchronously after a Task with terminal state.\n if (messageSendIdx === -1) {\n const env = tryParseJsonRpcEnvelope(cap.body);\n if (env && env.result !== undefined && isTaskShape(env.result)) {\n messageSendIdx = i;\n }\n }\n }\n const idx = messageSendIdx !== -1 ? messageSendIdx : lastPostIdx;\n if (idx === -1) return undefined;\n const cap = captures[idx]!;\n const envelope = tryParseJsonRpcEnvelope(cap.body);\n if (!envelope) return undefined;\n // `envelope.result` mirrors the JSON-RPC envelope as observed —\n // present when the response carried a `result`, absent when it\n // carried `error`. The convenience `result` field at the top level\n // coalesces undefined to `null` so validators reading the typed\n // `A2ATaskEnvelope.result` get a stable shape; the inner\n // `envelope.result` keeps presence-of-key fidelity for validators\n // that need to distinguish \"result was null\" from \"result was\n // omitted\". Both paths run through `redactSecrets`.\n const redactedResult = envelope.result !== undefined ? redactSecrets(envelope.result) : null;\n return {\n result: redactedResult,\n envelope: {\n ...(envelope.jsonrpc !== undefined && { jsonrpc: envelope.jsonrpc }),\n ...(envelope.id !== undefined && { id: envelope.id }),\n ...(envelope.result !== undefined && { result: redactedResult }),\n ...(envelope.error !== undefined && { error: redactSecrets(envelope.error) }),\n },\n http_status: cap.status,\n };\n}\n\nfunction tryParseJsonRpcEnvelope(\n body: string\n): { jsonrpc?: unknown; id?: unknown; result?: unknown; error?: unknown } | undefined {\n let parsed: unknown;\n try {\n parsed = JSON.parse(body);\n } catch {\n return undefined;\n }\n if (parsed == null || typeof parsed !== 'object' || Array.isArray(parsed)) return undefined;\n const envelope = parsed as { jsonrpc?: unknown; id?: unknown; result?: unknown; error?: unknown };\n if (envelope.jsonrpc !== '2.0') return undefined;\n if (envelope.result === undefined && envelope.error === undefined) return undefined;\n return envelope;\n}\n\nfunction isTaskShape(result: unknown): boolean {\n return (\n result != null &&\n typeof result === 'object' &&\n !Array.isArray(result) &&\n (result as { kind?: unknown }).kind === 'task'\n );\n}\n\n// ────────────────────────────────────────────────────────────\n// Phase / step skip predicates\n// ────────────────────────────────────────────────────────────\n\n/**\n * True when the phase contains an OAuth-metadata probe step\n * (`protected_resource_metadata` or `oauth_auth_server_metadata`). Used\n * to pre-emptively trigger the existing `phaseAbsent` cascade when the\n * agent's capabilities never advertised OAuth in the first place, so we\n * don't burn step failures probing a well-known path the agent doesn't\n * claim. Spec: adcp-client#1702.\n */\nfunction phaseContainsOauthMetadataProbe(phase: StoryboardPhase): boolean {\n return phase.steps.some(s => s.task === 'protected_resource_metadata' || s.task === 'oauth_auth_server_metadata');\n}\n\n/**\n * True when the agent's `get_adcp_capabilities` response declares an\n * OAuth issuer (today: `account.authorization_endpoint`). When the\n * profile or its capabilities aren't available — e.g. external\n * `_client` mode — we conservatively return `true` so the runner falls\n * through to the existing reactive cascade (`phaseAbsent` flips on a\n * 404 from the PRM probe). That keeps backward compatibility for\n * callers that haven't threaded a profile through. Spec: adcp-client#1702.\n */\nfunction agentAdvertisesOauth(profile: AgentProfile | undefined): boolean {\n const rawCaps = profile?.raw_capabilities;\n if (rawCaps === undefined) return true;\n const oauthSupported = resolveCapabilityPath(rawCaps, 'oauth.supported');\n if (oauthSupported === true) return true;\n if (oauthSupported === false) return false;\n const endpoint = resolveCapabilityPath(rawCaps, 'account.authorization_endpoint');\n return typeof endpoint === 'string' && endpoint.length > 0;\n}\n\n/**\n * Evaluate a phase's `skip_if` expression against the runtime options. Only\n * a tiny grammar is supported today; unknown expressions fail closed (phase runs).\n */\nfunction shouldSkipPhase(phase: StoryboardPhase, options: StoryboardRunOptions): boolean {\n const expr = phase.skip_if?.trim();\n if (!expr) return false;\n const match = /^(!?)test_kit\\.([a-zA-Z0-9_.]+)$/.exec(expr);\n if (!match) return false; // unknown grammar → run the phase\n const negated = match[1] === '!';\n const path = match[2]!.split('.');\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- dynamic test-kit shape\n let value: any = (options as { test_kit?: unknown }).test_kit;\n for (const segment of path) {\n if (value == null || typeof value !== 'object') {\n value = undefined;\n break;\n }\n value = (value as Record<string, unknown>)[segment];\n }\n const truthy = Boolean(value);\n return negated ? !truthy : truthy;\n}\n\n/**\n * Resolve a `$test_kit.<path>` task reference against the runtime options.\n * Falls back to `step.task_default`. Returns undefined when neither yields a string.\n */\nfunction resolveTaskName(step: StoryboardStep, options: StoryboardRunOptions): string | undefined {\n if (!step.task.startsWith('$test_kit.')) return step.task;\n const path = step.task.slice('$test_kit.'.length).split('.');\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- dynamic test-kit shape\n let value: any = options.test_kit;\n for (const segment of path) {\n if (value == null || typeof value !== 'object') {\n value = undefined;\n break;\n }\n value = (value as Record<string, unknown>)[segment];\n }\n if (typeof value === 'string' && value.length > 0) return value;\n return step.task_default;\n}\n\n/**\n * Build SDK-equivalent default headers for raw MCP probe tests. Runtime raw\n * probe dispatch is reserved for explicit per-step `auth` overrides; ordinary\n * missing-field vectors stay on the SDK path so Streamable HTTP sessions are\n * initialized before the malformed tool call.\n */\nfunction defaultAuthHeadersForRawProbe(options: StoryboardRunOptions): Record<string, string> | undefined {\n const headers: Record<string, string> = {};\n if (options.auth) {\n if (options.auth.type === 'bearer') {\n if (!options.auth.token) throw new Error('options.auth.token is required for bearer auth');\n assertSafeAuthHeaderPart(options.auth.token, 'options.auth.token');\n headers.authorization = `Bearer ${options.auth.token}`;\n } else if (options.auth.type === 'basic') {\n headers.authorization = encodeBasicAuthHeader(options.auth, 'options.auth');\n } else {\n return undefined;\n }\n }\n // Match SDK header casing so a raw-probe request is byte-indistinguishable\n // from an SDK-shaped one at the transport boundary. HTTP is case-insensitive;\n // this is purely for parity with capture/diff tooling.\n if (options.test_session_id) {\n assertSafeAuthHeaderPart(options.test_session_id, 'options.test_session_id');\n headers['X-Test-Session-ID'] = options.test_session_id;\n }\n if (options.userAgent) {\n assertSafeAuthHeaderPart(options.userAgent, 'options.userAgent');\n headers['User-Agent'] = options.userAgent;\n }\n return headers;\n}\n\n/**\n * Translate a `StepAuthDirective` into HTTP headers for the raw MCP probe.\n * - `'none'` returns an empty object and the probe sends no `Authorization`.\n * - `api_key` / `oauth_bearer` resolve the value from `value`, `from_test_kit`,\n * or `value_strategy` — in that order — and produce `Authorization: Bearer <value>`.\n * - `basic` resolves explicit credentials, `from_test_kit`, or\n * `value_strategy: random_invalid` and produces `Authorization: Basic <base64>`.\n */\nfunction authHeadersForStep(directive: StepAuthDirective, options: StoryboardRunOptions): Record<string, string> {\n if (directive === 'none') return {};\n if (directive.type === 'basic') return basicAuthHeadersForStep(directive, options);\n\n let value: string | undefined;\n if ('value' in directive && directive.value) {\n value = directive.value;\n } else if ('from_test_kit' in directive && directive.from_test_kit) {\n value = options.test_kit?.auth?.api_key;\n if (!value) {\n // adcp#6735 — hard-fail instead of silently degrading to an\n // unauthenticated probe: a probe with no credential cannot test a\n // credential-keyed contract, and the resulting 401 grades a\n // conformant agent FAIL.\n throw new Error(\n 'step declares auth.from_test_kit but no test kit with auth.api_key is configured — ' +\n 'declare prerequisites.test_kit and authorize its cache with options.complianceDir ' +\n '(CLI: --compliance-dir), ' +\n 'or pass options.test_kit (CLI: --test-kit).'\n );\n }\n } else if ('value_strategy' in directive && directive.value_strategy) {\n if (directive.value_strategy === 'random_invalid') value = generateRandomInvalidApiKey();\n else if (directive.value_strategy === 'random_invalid_jwt') value = generateRandomInvalidJwt();\n }\n if (!value) return {};\n // Reject CR/LF/NUL and non-printable ASCII — a test-kit key with stray\n // whitespace would otherwise crash undici's header validator and the raw\n // exception (containing the secret) lands in the serialized compliance\n // report. Fail loudly with a non-echoing error instead.\n if (/[\\r\\n\\x00]|[^\\x20-\\x7E]/.test(value)) {\n throw new Error('test_kit.auth.api_key contains invalid characters (control chars or non-printable ASCII)');\n }\n return { authorization: `Bearer ${value}` };\n}\n\nfunction basicAuthHeadersForStep(\n directive: Extract<StepAuthDirective, { type: 'basic' }>,\n options: StoryboardRunOptions\n): Record<string, string> {\n if (directive.value_strategy) {\n if (directive.value_strategy !== 'random_invalid') return {};\n return {\n authorization: encodeBasicAuthHeader(\n {\n username: generateRandomInvalidApiKey(),\n password: generateRandomInvalidApiKey(),\n },\n 'step.auth.basic'\n ),\n };\n }\n\n const usesTestKit =\n directive.from_test_kit === true ||\n (typeof directive.from_test_kit === 'string' && directive.from_test_kit.length > 0);\n const source = usesTestKit\n ? resolveStepBasicFromTestKit(directive.from_test_kit!, options)\n : directive.basic !== undefined\n ? directive.basic\n : directive;\n if (source === undefined) {\n if (usesTestKit) {\n // adcp#6735 — same hard-fail as the api_key arm: never send an\n // unauthenticated probe in place of a declared kit credential.\n throw new Error(\n 'step declares auth.from_test_kit (basic) but no test kit with matching credentials is configured — ' +\n 'declare prerequisites.test_kit and authorize its cache with options.complianceDir ' +\n '(CLI: --compliance-dir), ' +\n 'or pass options.test_kit (CLI: --test-kit).'\n );\n }\n return {};\n }\n return { authorization: encodeBasicAuthHeader(source, 'step.auth.basic') };\n}\n\nfunction resolveStepBasicFromTestKit(\n fromTestKit: string | boolean,\n options: StoryboardRunOptions\n): BasicCredentialInput | undefined {\n const path = typeof fromTestKit === 'string' && fromTestKit.length > 0 ? fromTestKit : 'auth.basic';\n const segments = path.split('.');\n let value: unknown = options.test_kit;\n for (const segment of segments) {\n if (value == null || typeof value !== 'object') return undefined;\n value = (value as Record<string, unknown>)[segment];\n }\n if (value === undefined || value === null) return undefined;\n return value as BasicCredentialInput;\n}\n\ninterface BasicCredentialInput {\n username?: unknown;\n password?: unknown;\n credentials?: unknown;\n}\n\nfunction encodeBasicAuthHeader(input: BasicCredentialInput, fieldPrefix: string): string {\n const userpass = normalizeBasicCredentials(input, fieldPrefix);\n return `Basic ${Buffer.from(userpass).toString('base64')}`;\n}\n\nfunction normalizeBasicCredentials(input: BasicCredentialInput, fieldPrefix: string): string {\n const hasCredentials = input.credentials !== undefined;\n const hasUserPass = input.username !== undefined || input.password !== undefined;\n if (hasCredentials && hasUserPass) {\n throw new Error(`${fieldPrefix} must use either credentials or username/password, not both`);\n }\n if (hasCredentials) {\n if (typeof input.credentials !== 'string' || input.credentials.length === 0) {\n throw new Error(`${fieldPrefix}.credentials must be a non-empty string`);\n }\n assertSafeAuthHeaderPart(input.credentials, `${fieldPrefix}.credentials`);\n const colonIndex = input.credentials.indexOf(':');\n if (colonIndex <= 0) {\n throw new Error(`${fieldPrefix}.credentials must be in unencoded username:password form`);\n }\n return input.credentials;\n }\n if (typeof input.username !== 'string' || input.username.length === 0) {\n throw new Error(`${fieldPrefix}.username must be a non-empty string`);\n }\n if (typeof input.password !== 'string') {\n throw new Error(`${fieldPrefix}.password must be a string`);\n }\n if (input.username.includes(':')) {\n throw new Error(`${fieldPrefix}.username must not contain colon (RFC 7617)`);\n }\n assertSafeAuthHeaderPart(input.username, `${fieldPrefix}.username`);\n assertSafeAuthHeaderPart(input.password, `${fieldPrefix}.password`);\n return `${input.username}:${input.password}`;\n}\n\n// Reject control chars and non-printable ASCII. Without this, undici's header\n// validator throws a message that includes the offending value — landing\n// secrets in logs. Validate raw inputs before encoding so the field name in\n// the error identifies which input to fix without echoing the value.\nfunction assertSafeAuthHeaderPart(value: string, field: string): void {\n if (/[\\r\\n\\x00]|[^\\x20-\\x7E]/.test(value)) {\n throw new Error(`${field} contains invalid characters (control chars or non-printable ASCII)`);\n }\n}\n\n/**\n * Evaluate a step's `contributes_if` expression. Grammar:\n * - `\"prior_step.<step_id>.passed\"` — prior step passed\n * Unknown expressions → false (contribution does NOT fire).\n */\nfunction evalContributesIf(expr: string | undefined, priorStepResults: Map<string, StoryboardStepResult>): boolean {\n if (!expr) return true;\n const match = /^prior_step\\.([A-Za-z0-9_]+)\\.passed$/.exec(expr.trim());\n if (!match) return false;\n const stepId = match[1]!;\n const prior = priorStepResults.get(stepId);\n return !!prior?.passed && !prior.skipped;\n}\n\n// ────────────────────────────────────────────────────────────\n// Brand/account invariant\n// ────────────────────────────────────────────────────────────\n\n/**\n * Force every outgoing request onto the storyboard's brand context.\n *\n * Sellers that scope session state by brand (spec-required for multi-tenant\n * isolation) derive a session key from `brand.domain` — or, when brand is\n * absent, from `account.brand.domain`. If any step in a run targets a\n * different brand, it lands in a different session and can't see state\n * created by earlier steps.\n *\n * This helper runs after builder / sample_request resolution and writes the\n * run-scoped brand into the addressing forms the tool's schema allows:\n *\n * - Top-level `brand` — only when the tool's request schema declares it\n * (e.g. `get_products`, `create_media_buy`, signal tools). Governance\n * tools like `sync_plans` do not declare `brand` at the request root\n * (brand belongs inside each `Plan` object) — injecting it would fail\n * the framework's strict AJV validation (#940).\n * - `account.brand` — merged into an existing `account` object only when\n * it uses the natural-key variant (`{brand, operator, sandbox?}`). The\n * `{account_id}` variant is closed (`additionalProperties: false`); merging\n * `brand` into it produces a payload that matches neither `oneOf` branch\n * and is rejected by AJV strict request validation. Detect the natural-key\n * variant by looking for an existing `brand` or `operator` key.\n * - Synthetic `account` — constructed only when the request has no\n * `account` AND the tool's schema declares `account` (e.g. `get_media_buys`,\n * `list_creatives`). Tools like `sync_plans` that declare neither\n * `brand` nor `account` at the root are left unchanged.\n *\n * When `taskName` is omitted or the schema is unavailable (not synced yet),\n * the function fails open and injects as before. Schema checks use raw JSON\n * reads, not AJV internals.\n */\nexport function applyBrandInvariant(\n request: Record<string, unknown>,\n options: StoryboardRunOptions,\n taskName?: string,\n stepFlags?: { omit_account?: boolean }\n): Record<string, unknown> {\n // Only force the invariant when the caller has actually supplied a brand.\n // Storyboards that don't exercise brand-scoped tools (e.g. security\n // probes) legitimately run without one and should pass through unchanged.\n if (!options.brand && !options.brand_manifest) return request;\n const brand = resolveBrand(options);\n\n // Gate brand/account injection on the tool's request schema. Tools that\n // declare `additionalProperties: false` without listing the field will fail\n // the framework's strict AJV validator if we inject it (#940). Fails open\n // when taskName is absent or the schema isn't available.\n const topBrandOk = !taskName || schemaAllowsTopLevelField(taskName, 'brand');\n const topAccountOk = !taskName || schemaAllowsTopLevelField(taskName, 'account');\n\n const result: Record<string, unknown> = { ...request };\n if (topBrandOk) result.brand = brand;\n\n // When a storyboard step sets `omit_account: true` it is deliberately\n // testing the seller's missing-account rejection path. Skip all account\n // synthesis — both the natural-key-merge branch (existing account on the\n // request) and the synthetic-construction branch (no account on the\n // request) — so the request reaches the wire exactly as authored.\n if (stepFlags?.omit_account) return result;\n\n if ('account' in request) {\n // Caller sent an account — merge brand in only when it's a plain object\n // using AccountReference's natural-key variant (`{brand, operator, sandbox?}`).\n // The `{account_id}` variant is a closed object; merging `brand` would\n // produce a payload that matches neither `oneOf` branch under strict AJV.\n // Leave non-object values (null, array) and `{account_id}`-only payloads\n // alone so intentionally narrow or malformed requests aren't silently\n // \"corrected.\"\n const existingAccount = request.account;\n if (existingAccount && typeof existingAccount === 'object' && !Array.isArray(existingAccount)) {\n const acct = existingAccount as Record<string, unknown>;\n const isNaturalKeyVariant = 'brand' in acct || 'operator' in acct;\n if (isNaturalKeyVariant) {\n const merged: Record<string, unknown> = { ...acct, brand };\n // The natural-key arm of AccountReference requires `operator` (per\n // schemas/cache/{version}/core/account-ref.json). A fixture or earlier\n // context-extraction step that produced `{brand, sandbox}` without\n // operator would otherwise be passed through and rejected by a\n // strict-validating seller. Default operator to brand.domain — same\n // convention `resolveAccount` uses for synthetic refs.\n if (typeof merged.operator !== 'string' && typeof brand.domain === 'string') {\n merged.operator = brand.domain;\n }\n result.account = merged;\n }\n }\n } else if (topAccountOk && taskName !== 'list_accounts') {\n // No account on the request — construct one so tools whose schema\n // declares `account` but not top-level `brand` (e.g. get_media_buys,\n // list_creatives) still carry the run-scoped brand on the wire.\n // list_accounts is deliberately exempt: without an authored account it\n // enumerates the caller's visible accounts. Synthesizing the runner's\n // default natural key would silently narrow pagination and discovery\n // storyboards to one brand.\n result.account = resolveAccount(options);\n }\n return result;\n}\n\n/**\n * Inject `ext.adcp.disable_sandbox: true` into the outgoing request when the\n * operator passed `--no-sandbox` (or `disable_sandbox: true` programmatically).\n * Issue #841.\n *\n * `ext` is the spec-blessed channel for read-by-agent extensions and is\n * accepted-without-error on every tool, so the schema check is conservative\n * — only inject when the tool's request schema permits a top-level `ext`\n * field. Tools with `additionalProperties: false` that don't list `ext`\n * would fail strict AJV validation otherwise.\n *\n * Merging strategy: preserve any existing `ext.adcp` block the storyboard\n * fixture or builder authored (e.g. vendor extensions a future scenario\n * might exercise). The injected `disable_sandbox` flag rides alongside\n * those rather than overwriting them.\n */\nexport function applyDisableSandboxHint(request: Record<string, unknown>, taskName?: string): Record<string, unknown> {\n if (taskName && !schemaAllowsTopLevelField(taskName, 'ext')) return request;\n\n const existingExt = request.ext;\n const existingExtObj =\n existingExt != null && typeof existingExt === 'object' && !Array.isArray(existingExt)\n ? (existingExt as Record<string, unknown>)\n : {};\n\n const existingAdcpExt = existingExtObj.adcp;\n const existingAdcpExtObj =\n existingAdcpExt != null && typeof existingAdcpExt === 'object' && !Array.isArray(existingAdcpExt)\n ? (existingAdcpExt as Record<string, unknown>)\n : {};\n\n return {\n ...request,\n ext: {\n ...existingExtObj,\n adcp: {\n ...existingAdcpExtObj,\n disable_sandbox: true,\n },\n },\n };\n}\n\n/**\n * Mint an `idempotency_key` for mutating storyboard requests when one wasn't\n * supplied. Storyboard `sample_request` blocks generally omit it; the runner\n * fills it in so the server's required-field check doesn't short-circuit the\n * handler under test, including on `expect_error` steps that name specific\n * failure modes (GOVERNANCE_DENIED, UNAUTHORIZED, brand_mismatch, etc.).\n *\n * Skipped when:\n * - `step.omit_idempotency_key === true` — the scenario is explicitly\n * exercising the server's missing-key rejection path.\n * - the task isn't mutating per {@link MUTATING_TASKS}.\n * - the request already carries a key — typically a\n * `$generate:uuid_v4#alias` the context injector has resolved to a\n * concrete UUID for replay scenarios, or a BYOK key supplied inline.\n */\nexport function applyIdempotencyInvariant(\n request: Record<string, unknown>,\n taskName: string,\n step: StoryboardStep\n): Record<string, unknown> {\n if (step.omit_idempotency_key === true) return request;\n if (!isMutatingTask(taskName)) return request;\n if (typeof request.idempotency_key === 'string' && request.idempotency_key.length > 0) return request;\n return { ...request, idempotency_key: generateIdempotencyKey() };\n}\n\n// ────────────────────────────────────────────────────────────\n// Helpers\n// ────────────────────────────────────────────────────────────\n\nconst MAX_ERROR_LENGTH = 2000;\n\nfunction truncateError(error: string | undefined): string | undefined {\n if (!error) return undefined;\n return error.length > MAX_ERROR_LENGTH ? error.slice(0, MAX_ERROR_LENGTH) + '...[truncated]' : error;\n}\n\ninterface FlatStep {\n step: StoryboardStep;\n phaseId: string;\n globalIndex: number;\n}\n\n/**\n * Pre-fetch `query_upstream_traffic` responses for every unique\n * `since_timestamp` window declared by `upstream_traffic` validations on\n * THIS step. The dispatcher is synchronous; the controller call is async\n * — running it once here keeps the validator simple and avoids redundant\n * controller traffic when a step has multiple upstream_traffic checks\n * sharing a window.\n *\n * Returns `undefined` when the step declares no upstream_traffic checks\n * (no work to do), or a context with `advertised: false` when the\n * controller does not advertise `query_upstream_traffic` (every check\n * grades not_applicable per the spec's adopter-opt-in rule).\n */\nasync function prefetchUpstreamTraffic(\n stepId: string,\n resolvedValidations: StoryboardValidation[],\n client: unknown,\n options: StoryboardRunOptions,\n runState: ExecutionState,\n requestStartIso: string,\n requestPayload: unknown,\n sampleRequest: Record<string, unknown> | undefined\n): Promise<UpstreamTrafficValidationContext | undefined> {\n const upstreamChecks = resolvedValidations.filter(v => v.check === 'upstream_traffic');\n if (upstreamChecks.length === 0) return undefined;\n if (upstreamChecks.some(check => (check.identifier_paths ?? []).some(path => validatePortableIdentifierPath(path)))) {\n return undefined;\n }\n\n const advertised =\n options._controllerCapabilities?.detected === true &&\n options._controllerCapabilities.scenarios.includes('query_upstream_traffic' as ControllerScenario);\n if (!advertised) {\n return {\n advertised: false,\n queries: new Map(),\n thisStepSince: requestStartIso,\n };\n }\n\n // Resolve `since: prior_step_id` references against runState's\n // recorded request timestamps. Validations that name an unknown step\n // fall back to this step's own start (matching default behavior).\n const priorStepSinceMap = new Map<string, string>();\n const unresolvedSinceRefs = new Set<string>();\n const sinceTimestamps = new Set<string>([requestStartIso]);\n for (const v of upstreamChecks) {\n if (!v.since) continue;\n const priorStart = runState.stepRequestStarts?.get(v.since);\n if (priorStart) {\n priorStepSinceMap.set(v.since, priorStart);\n sinceTimestamps.add(priorStart);\n } else {\n // Spec PR adcp#3816: a `since: prior_step_id` that doesn't resolve\n // is a storyboard authoring bug — silently masking it as \"use this\n // step's start\" lets misspelled refs pass vacuously. Track and\n // surface as a typed failure on the validation result.\n priorStepSinceMap.set(v.since, requestStartIso);\n unresolvedSinceRefs.add(v.since);\n }\n }\n\n const queries = new Map<string, UpstreamTrafficQueryResult>();\n const identifierDigestCollection = collectUpstreamIdentifierDigests(upstreamChecks, requestPayload, sampleRequest);\n const identifierDigestByValue = identifierDigestCollection.digests;\n const identifier_value_digests = [...identifierDigestByValue.values()];\n const requiresRawAttestation = upstreamChecks.some(\n check => check.attestation_mode_required === 'raw' || (check.payload_must_contain?.length ?? 0) > 0\n );\n const prefersRawAttestation = upstreamChecks.some(check => check.preferred_attestation_mode === 'raw');\n const prefersDigestAttestation = upstreamChecks.some(check => check.preferred_attestation_mode === 'digest');\n const requestedAttestationMode: 'raw' | 'digest' =\n requiresRawAttestation || prefersRawAttestation\n ? 'raw'\n : prefersDigestAttestation || identifier_value_digests.length > 0\n ? 'digest'\n : 'raw';\n for (const sinceTs of sinceTimestamps) {\n // Per spec PR adcp#3816: runners SHOULD subtract a clock-skew tolerance\n // (50ms minimum, 250ms recommended) before sending the bound to the\n // controller, so a recorded call timestamped microseconds before the\n // runner's clock measurement isn't silently excluded. We use 250ms (the\n // spec's recommended value).\n const adjustedSince = new Date(new Date(sinceTs).getTime() - 250).toISOString();\n const params = {\n since_timestamp: adjustedSince,\n limit: 100,\n attestation_mode: requestedAttestationMode,\n ...(identifier_value_digests.length > 0 ? { identifier_value_digests } : {}),\n };\n const requestRecord: RunnerRequestRecord = {\n transport: options.protocol === 'a2a' ? 'a2a' : 'mcp',\n operation: 'comply_test_controller',\n payload: redactSecrets({ scenario: 'query_upstream_traffic', params }),\n ...(runState.agentUrl ? { url: redactOAuthUrlForOutput(runState.agentUrl) } : {}),\n };\n const startMs = Date.now();\n let payload: UpstreamTrafficSuccess | { error: string; error_kind?: string };\n try {\n const result = await queryUpstreamTraffic(client as TestClient, params, options);\n if ('success' in result && result.success === true) {\n payload = result;\n } else {\n const errResult = result as { error?: string; error_detail?: string; context?: unknown; ext?: unknown };\n const message = errResult.error_detail\n ? `${errResult.error ?? 'controller_error'}: ${errResult.error_detail}`\n : (errResult.error ?? 'controller returned a non-success response');\n const errorKind = extractControllerErrorKind(errResult);\n payload = { error: message, ...(errorKind ? { error_kind: errorKind } : {}) };\n }\n } catch (err) {\n payload = { error: err instanceof Error ? err.message : String(err) };\n }\n const responseRecord: RunnerResponseRecord = {\n transport: options.protocol === 'a2a' ? 'a2a' : 'mcp',\n payload: redactSecrets(payload),\n duration_ms: Date.now() - startMs,\n };\n queries.set(sinceTs, { request: requestRecord, response: responseRecord, payload });\n }\n\n return {\n advertised: true,\n queries,\n thisStepSince: requestStartIso,\n ...(identifierDigestByValue.size > 0 ? { identifierDigestByValue } : {}),\n ...(identifierDigestCollection.clipped > 0\n ? {\n identifierDigestLimitExceeded: {\n limit: identifierDigestCollection.limit,\n clipped: identifierDigestCollection.clipped,\n },\n }\n : {}),\n ...(priorStepSinceMap.size > 0 ? { priorStepSinceMap } : {}),\n ...(unresolvedSinceRefs.size > 0 ? { unresolvedSinceRefs } : {}),\n };\n}\n\nfunction extractControllerErrorKind(result: { context?: unknown; ext?: unknown }): string | undefined {\n return readErrorKind(result.context) ?? readErrorKind(result.ext);\n}\n\nfunction readErrorKind(value: unknown): string | undefined {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return undefined;\n const record = value as Record<string, unknown>;\n if (typeof record.error_kind === 'string' && record.error_kind.length > 0) return record.error_kind;\n if (typeof record.kind === 'string' && record.kind.length > 0) return record.kind;\n return undefined;\n}\n\nfunction collectUpstreamIdentifierDigests(\n validations: StoryboardValidation[],\n requestPayload: unknown,\n sampleRequest: Record<string, unknown> | undefined\n): { digests: Map<string, string>; limit: number; clipped: number } {\n const digests = new Map<string, string>();\n let clipped = 0;\n const sample =\n requestPayload && typeof requestPayload === 'object' && !Array.isArray(requestPayload)\n ? (requestPayload as Record<string, unknown>)\n : sampleRequest;\n if (!sample) return { digests, limit: IDENTIFIER_DIGEST_LIMIT, clipped };\n const clippedVectors = new Set<string>();\n for (const validation of validations) {\n for (const path of validation.identifier_paths ?? []) {\n const vectors = resolvePortableIdentifierPathAll(sample, path);\n for (const vector of vectors) {\n if (typeof vector !== 'string') continue;\n if (digests.has(vector)) continue;\n if (digests.size >= IDENTIFIER_DIGEST_LIMIT) {\n if (!clippedVectors.has(vector)) {\n clippedVectors.add(vector);\n clipped++;\n }\n continue;\n }\n digests.set(vector, sha256Hex(vector));\n }\n }\n }\n return { digests, limit: IDENTIFIER_DIGEST_LIMIT, clipped };\n}\n\nfunction sha256Hex(value: string): string {\n return createHash('sha256').update(value, 'utf8').digest('hex');\n}\n\n/**\n * Find any \"$context.xxx\" strings that weren't resolved during injection.\n * Returns one entry per occurrence with both the bare key (for legacy\n * detail-string formatting) and the full token (for the\n * `unresolved_substitution` validation result's `expected` field, per\n * runner-output-contract.yaml v2.0.0).\n */\nfunction findUnresolvedContextVars(obj: unknown): Array<{ key: string; token: string }> {\n const vars: Array<{ key: string; token: string }> = [];\n const walk = (val: unknown) => {\n if (typeof val === 'string') {\n const match = val.match(/^\\$context\\.(\\w+)$/);\n if (match?.[1]) vars.push({ key: match[1], token: val });\n } else if (Array.isArray(val)) {\n val.forEach(walk);\n } else if (val !== null && typeof val === 'object') {\n Object.values(val as Record<string, unknown>).forEach(walk);\n }\n };\n walk(obj);\n return vars;\n}\n\nconst UNRESOLVED_RUNNER_TOKEN_RE =\n /\\{\\{(?:runner\\.(?:webhook_url:[A-Za-z0-9_]+|webhook_base)|prior_step\\.[A-Za-z0-9_]+\\.operation_id)\\}\\}/g;\n\nfunction findUnresolvedRunnerTokens(obj: unknown): string[] {\n const vars: string[] = [];\n const walk = (val: unknown) => {\n if (typeof val === 'string') {\n const matches = val.match(UNRESOLVED_RUNNER_TOKEN_RE);\n if (matches) vars.push(...matches);\n } else if (Array.isArray(val)) {\n val.forEach(walk);\n } else if (val !== null && typeof val === 'object') {\n Object.values(val as Record<string, unknown>).forEach(walk);\n }\n };\n walk(obj);\n return [...new Set(vars)];\n}\n\nfunction hasUnresolvedPriorStepToken(tokens: string[]): boolean {\n return tokens.some(token => token.startsWith('{{prior_step.'));\n}\n\nfunction flattenSteps(storyboard: Storyboard): FlatStep[] {\n const result: FlatStep[] = [];\n let index = 0;\n for (const phase of storyboard.phases) {\n for (const step of phase.steps) {\n result.push({ step, phaseId: phase.id, globalIndex: index++ });\n }\n }\n return result;\n}\n\nfunction getNextStepPreview(\n currentStepId: string,\n allSteps: FlatStep[],\n context: StoryboardContext,\n runnerVars?: RunnerVariables\n): StoryboardStepPreview | undefined {\n const currentIdx = allSteps.findIndex(s => s.step.id === currentStepId);\n if (currentIdx === -1 || currentIdx >= allSteps.length - 1) return undefined;\n\n const nextFlat = allSteps[currentIdx + 1];\n if (!nextFlat) return undefined;\n const nextStep = nextFlat.step;\n\n // Inject context into the next step's sample_request for preview\n const previewRequest = nextStep.sample_request\n ? injectContext({ ...nextStep.sample_request }, context, runnerVars)\n : undefined;\n\n return {\n step_id: nextStep.id,\n phase_id: nextFlat.phaseId,\n title: nextStep.title,\n task: nextStep.task,\n narrative: nextStep.narrative,\n expected: nextStep.expected,\n sample_request: previewRequest,\n };\n}\n\n// ────────────────────────────────────────────────────────────\n// Multi-instance dispatch\n// ────────────────────────────────────────────────────────────\n\ninterface StepAssignment {\n client: TestClient;\n agentUrl: string;\n /** 0-based index into the agent URL list */\n instanceIndex: number;\n /** Profile discovered for the agent selected to execute this step. */\n profile?: AgentProfile;\n}\n\ninterface Dispatcher {\n nextFor(step: StoryboardStep): StepAssignment;\n}\n\n/**\n * Build a dispatcher that picks an (agent URL, client) pair per step.\n *\n * Single-URL runs always return the same assignment. Multi-URL runs use\n * round-robin — step N hits `clients[(N + startOffset) % N_urls]`.\n * Deterministic and reproducible for bug reports.\n *\n * `startOffset` lets the `multi-pass` strategy run the same storyboard with\n * the dispatcher starting at a different replica each pass so write→read\n * pairs separated by an even number of stateful steps get exercised\n * cross-replica on at least one pass.\n */\nfunction createDispatcher(\n agentUrls: string[],\n clients: TestClient[],\n _strategy: 'round-robin',\n startOffset = 0,\n profile?: AgentProfile\n): Dispatcher {\n let counter = startOffset;\n return {\n nextFor(_step: StoryboardStep): StepAssignment {\n const idx = ((counter % agentUrls.length) + agentUrls.length) % agentUrls.length;\n counter++;\n return {\n client: clients[idx]!,\n agentUrl: agentUrls[idx]!,\n instanceIndex: idx,\n profile,\n };\n },\n };\n}\n\n/**\n * Per-specialism routing dispatcher (#1066). Picks the agent that claims\n * each step's tool's protocol via the routing context. Throws\n * `RoutingError` mid-step when no route can be determined; the runner's\n * step loop catches and converts to a synthetic `unroutable_task` skip.\n *\n * `instanceIndex` reflects the agent key's insertion order in the map —\n * deterministic and matches the index used for downstream `agent_urls`\n * exposure on the storyboard result.\n */\nfunction createRoutingDispatcher(\n ctx: AgentRoutingContext,\n options: StoryboardRunOptions,\n agents: Record<string, AgentEntry>\n): Dispatcher {\n const keyOrder = Object.keys(agents);\n const keyToIndex = new Map(keyOrder.map((k, i) => [k, i]));\n return {\n nextFor(step: StoryboardStep): StepAssignment {\n const key = resolveAgentForStep(step, options, ctx);\n const client = ctx.clients.get(key);\n const profile = ctx.profiles.get(key);\n const url = agents[key]?.url;\n if (!client || !url) {\n throw new RoutingError(\n `Internal: resolved agent key \"${key}\" has no client/url. ` +\n `This indicates a bug in routing-context construction.`,\n step.task,\n `key ${key} unbound`\n );\n }\n return {\n client,\n agentUrl: url,\n instanceIndex: keyToIndex.get(key) ?? 0,\n profile,\n };\n },\n };\n}\n\nconst HORIZONTAL_SCALING_DOCS_URL =\n 'https://adcontextprotocol.org/docs/building/validate-your-agent#verifying-cross-instance-state';\nconst NOT_FOUND_PATTERN = /not[_ ]found|not-found|\\b404\\b/i;\n\n// Agent-controlled text (error messages, response payloads) lands in terminal\n// output. Strip C0/C1 control chars so a hostile agent returning\n// `\\x1b[2J\\x1b[H` (clear screen) or `\\r` (overwrite prior line) can't mangle\n// CI logs or forge terminal state. Tabs and newlines are preserved.\n// The cap bounds JSON-stringification cost if an agent returns an enormous\n// or deeply-nested response body.\nconst MAX_ATTRIBUTION_SNIPPET = 512;\nfunction sanitizeAgentText(text: string): string {\n return text.replace(/[\\x00-\\x08\\x0b-\\x1f\\x7f-\\x9f]/g, '').slice(0, MAX_ATTRIBUTION_SNIPPET);\n}\n\n/**\n * Detect the canonical horizontal-scaling failure signature on a step result.\n *\n * Reads structured fields the runner commonly populates (error string,\n * nested response.error/code/message/status) rather than regex-matching the\n * full stringified response — structured lookup is cheaper, resistant to an\n * agent smuggling \"NOT_FOUND\" into an unrelated field to falsely trigger the\n * canonical wording, and doesn't blow up on circular or oversized payloads.\n */\nfunction isNotFoundSignature(result: StoryboardStepResult): boolean {\n const candidates: Array<unknown> = [result.error];\n const resp = result.response as Record<string, unknown> | null | undefined;\n if (resp && typeof resp === 'object' && !Array.isArray(resp)) {\n candidates.push(resp.error, resp.code, resp.message, resp.status, resp.status_code);\n }\n for (const c of candidates) {\n if (typeof c === 'string' && NOT_FOUND_PATTERN.test(c)) return true;\n if (typeof c === 'number' && c === 404) return true;\n }\n return false;\n}\n\n/**\n * Mutate a failed step result to include cross-instance attribution.\n *\n * In multi-instance mode any step failure is worth attributing because the\n * failure signature may not be NOT_FOUND — it can surface as 500, an empty\n * array, PERMISSION_DENIED, or stale status. Attribution always emits:\n * - which replica served this step and the immediate prior stateful write\n * - a replica→step map for pattern-matching in CI logs\n * - a single-replica repro command\n * When the signature matches the canonical horizontal-scaling case (prior\n * write on A, read fails on B with NOT_FOUND), the wording mirrors the\n * protocol docs verbatim so developers pattern-match the page they'll\n * eventually click through to.\n */\nfunction annotateMultiInstanceFailure(\n result: StoryboardStepResult,\n storyboard: Storyboard,\n priorResults: StoryboardStepResult[]\n): void {\n const currentInstance = result.agent_index;\n const currentUrl = result.agent_url;\n if (!currentInstance || !currentUrl) return;\n\n // Lookup stateful flag on step defs — needed to identify \"prior writes\".\n const stepDefs = new Map<string, StoryboardStep>();\n for (const phase of storyboard.phases) {\n for (const s of phase.steps) stepDefs.set(s.id, s);\n }\n\n const priorCrossInstanceWrite = [...priorResults].reverse().find(prior => {\n if (!prior.passed || prior.skipped) return false;\n if (!prior.agent_index || prior.agent_index === currentInstance) return false;\n return stepDefs.get(prior.step_id)?.stateful === true;\n });\n\n const replicaMap = priorResults\n .filter(r => !r.skipped && r.agent_index)\n .map(r => ` [#${r.agent_index}] ${r.step_id} — ${r.passed ? 'ok' : 'FAIL'}`)\n .join('\\n');\n\n const lines: string[] = [];\n\n if (priorCrossInstanceWrite) {\n const writerIdx = priorCrossInstanceWrite.agent_index;\n const writerUrl = priorCrossInstanceWrite.agent_url;\n // Wording deliberately mirrors the failure example in the protocol docs\n // (\"<write> on replica A returned …; <read> on replica B returned NOT_FOUND;\n // → Brand-scoped state is not shared across replicas.\") so CI readers\n // pattern-match the page they'll click through to.\n lines.push(`${priorCrossInstanceWrite.step_id} on replica [#${writerIdx}] (${writerUrl}) succeeded.`);\n lines.push(\n `${result.step_id} on replica [#${currentInstance}] (${currentUrl}) failed${\n isNotFoundSignature(result) ? ' with NOT_FOUND' : ''\n }.`\n );\n lines.push('→ Brand-scoped state is not shared across replicas.');\n lines.push(`See: ${HORIZONTAL_SCALING_DOCS_URL}`);\n } else {\n lines.push(\n `Multi-instance failure on replica [#${currentInstance}] (${currentUrl}). ` +\n `No prior cross-replica stateful write found — the failure may be intrinsic to this replica.`\n );\n }\n\n if (replicaMap) {\n lines.push('Replica → step map:');\n lines.push(replicaMap);\n }\n lines.push(`Reproduce single-replica: adcp storyboard run ${currentUrl} ${storyboard.id}`);\n\n // Agent-controlled text goes in the base line; control chars are stripped\n // so a hostile agent can't forge terminal escape sequences in CI output.\n const base = sanitizeAgentText(result.error ?? 'Step failed');\n result.error = `${base}\\n\\n${lines.join('\\n')}`;\n}\n\n/**\n * Get a preview of the first step in a storyboard (for showing what will happen).\n *\n * `{{runner.*}}` tokens are passed through unchanged since no receiver is\n * bound at preview time. They'll resolve when the step actually runs.\n */\nexport function getFirstStepPreview(\n storyboard: Storyboard,\n context: StoryboardContext = {}\n): StoryboardStepPreview | undefined {\n const firstPhase = storyboard.phases[0];\n if (!firstPhase?.steps[0]) return undefined;\n\n const step = firstPhase.steps[0];\n const previewRequest = step.sample_request ? injectContext({ ...step.sample_request }, context) : undefined;\n\n return {\n step_id: step.id,\n phase_id: firstPhase.id,\n title: step.title,\n task: step.task,\n narrative: step.narrative,\n expected: step.expected,\n sample_request: previewRequest,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,yBAAuC;AACvC,qBAAyC;AACzC,uBAA+B;AAC/B,oBAA4F;AAC5F,uBAKO;AACP,gCAAkF;AAClF,sBAA2E;AAC3E,qBAQO;AACP,6BAA4C;AAC5C,+BAAsC;AACtC,qCAA4C;AAC5C,yBASO;AACP,+BAAgG;AAChG,kBAA6G;AAC7G,6BAKO;AACP,4BAA8B;AAC9B,gCAA8C;AAC9C,oCAAmF;AACnF,6BAA2F;AAC3F,uBAAwC;AACxC,6BAAkD;AAClD,6BAKO;AACP,IAAAA,iBAA6C;AAC7C,yBAAuD;AACvD,2BAMO;AACP,qBAAoD;AACpD,oBAQO;AACP,gCAAiC;AACjC,sBAAwD;AACxD,oBAAwC;AACxC,wBAAgD;AAChD,4BAA0C;AAC1C,8BAAoF;AACpF,gCAA2F;AAC3F,qBAAmE;AACnE,gCAA2E;AAC3E,wBAAsC;AACtC,IAAAA,iBAA8C;AAC9C,0CAAgD;AAChD,0CAMO;AACP,kCAKO;AAqEP,2BAMO;AACP,mBAA+D;AAE/D,wBAMO;AAlFP,MAAM,wCAAwC,uBAAO,mCAAmC;AAKxF,SAAS,qCACP,SACqD;AACrD,SAAQ,QAAyC,qCAAqC;AACxF;AAEA,SAAS,sCACP,SACA,UACsB;AACtB,SAAO,EAAE,GAAG,SAAS,CAAC,qCAAqC,GAAG,SAAS;AACzE;AAwEA,MAAM,eAAiD;AAAA,EACrD,gBAAgB;AAAA,EAChB,WAAW;AAAA,EACX,qBAAqB;AAAA,EACrB,cAAc;AAAA,EACd,yBACE;AAAA,EACF,qBAAqB;AAAA,EACrB,sBAAsB;AAAA,EAC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