@adcp/sdk 12.1.0 → 13.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (464) hide show
  1. package/README.md +19 -3
  2. package/bin/adcp-fuzz.js +3 -1
  3. package/dist/lib/adapters/content-standards-adapter.d.mts +9 -9
  4. package/dist/lib/adapters/content-standards-adapter.d.ts +9 -9
  5. package/dist/lib/adapters/content-standards-adapter.d.ts.map +1 -1
  6. package/dist/lib/adapters/content-standards-adapter.js +22 -22
  7. package/dist/lib/adapters/content-standards-adapter.js.map +1 -1
  8. package/dist/lib/adapters/content-standards-adapter.mjs +18 -18
  9. package/dist/lib/adapters/content-standards-adapter.mjs.map +1 -1
  10. package/dist/lib/adapters/index.d.mts +2 -2
  11. package/dist/lib/adapters/index.d.ts +2 -2
  12. package/dist/lib/adapters/index.d.ts.map +1 -1
  13. package/dist/lib/adapters/index.js +10 -10
  14. package/dist/lib/adapters/index.js.map +1 -1
  15. package/dist/lib/adapters/index.mjs +9 -9
  16. package/dist/lib/adapters/index.mjs.map +1 -1
  17. package/dist/lib/auth/oauth/authorization-required.d.mts +3 -0
  18. package/dist/lib/auth/oauth/authorization-required.d.ts +3 -0
  19. package/dist/lib/auth/oauth/authorization-required.d.ts.map +1 -1
  20. package/dist/lib/auth/oauth/authorization-required.js +12 -9
  21. package/dist/lib/auth/oauth/authorization-required.js.map +1 -1
  22. package/dist/lib/auth/oauth/authorization-required.mjs +12 -9
  23. package/dist/lib/auth/oauth/authorization-required.mjs.map +1 -1
  24. package/dist/lib/auth/oauth/provider-cache.d.mts +7 -0
  25. package/dist/lib/auth/oauth/provider-cache.d.ts +8 -0
  26. package/dist/lib/auth/oauth/provider-cache.d.ts.map +1 -0
  27. package/dist/lib/auth/oauth/provider-cache.js +44 -0
  28. package/dist/lib/auth/oauth/provider-cache.js.map +1 -0
  29. package/dist/lib/auth/oauth/provider-cache.mjs +19 -0
  30. package/dist/lib/auth/oauth/provider-cache.mjs.map +1 -0
  31. package/dist/lib/conformance/invariants/uniformError.js +1 -1
  32. package/dist/lib/conformance/invariants/uniformError.js.map +1 -1
  33. package/dist/lib/conformance/invariants/uniformError.mjs +1 -1
  34. package/dist/lib/conformance/invariants/uniformError.mjs.map +1 -1
  35. package/dist/lib/conformance/runners.js +1 -1
  36. package/dist/lib/conformance/runners.js.map +1 -1
  37. package/dist/lib/conformance/runners.mjs +1 -1
  38. package/dist/lib/conformance/runners.mjs.map +1 -1
  39. package/dist/lib/conformance/seeder.js +5 -5
  40. package/dist/lib/conformance/seeder.js.map +1 -1
  41. package/dist/lib/conformance/seeder.mjs +5 -5
  42. package/dist/lib/conformance/seeder.mjs.map +1 -1
  43. package/dist/lib/core/ADCPMultiAgentClient.d.mts +26 -29
  44. package/dist/lib/core/ADCPMultiAgentClient.d.ts +26 -29
  45. package/dist/lib/core/ADCPMultiAgentClient.d.ts.map +1 -1
  46. package/dist/lib/core/ADCPMultiAgentClient.js +27 -19
  47. package/dist/lib/core/ADCPMultiAgentClient.js.map +1 -1
  48. package/dist/lib/core/ADCPMultiAgentClient.mjs +27 -19
  49. package/dist/lib/core/ADCPMultiAgentClient.mjs.map +1 -1
  50. package/dist/lib/core/AgentClient.d.mts +148 -138
  51. package/dist/lib/core/AgentClient.d.ts +148 -138
  52. package/dist/lib/core/AgentClient.d.ts.map +1 -1
  53. package/dist/lib/core/AgentClient.js +174 -85
  54. package/dist/lib/core/AgentClient.js.map +1 -1
  55. package/dist/lib/core/AgentClient.mjs +174 -85
  56. package/dist/lib/core/AgentClient.mjs.map +1 -1
  57. package/dist/lib/core/AsyncHandler.d.mts +18 -16
  58. package/dist/lib/core/AsyncHandler.d.ts +18 -16
  59. package/dist/lib/core/AsyncHandler.d.ts.map +1 -1
  60. package/dist/lib/core/AsyncHandler.js +22 -1
  61. package/dist/lib/core/AsyncHandler.js.map +1 -1
  62. package/dist/lib/core/AsyncHandler.mjs +22 -1
  63. package/dist/lib/core/AsyncHandler.mjs.map +1 -1
  64. package/dist/lib/core/ConversationTypes.d.mts +6 -2
  65. package/dist/lib/core/ConversationTypes.d.ts +6 -2
  66. package/dist/lib/core/ConversationTypes.d.ts.map +1 -1
  67. package/dist/lib/core/ConversationTypes.js.map +1 -1
  68. package/dist/lib/core/CreativeAgentClient.d.mts +41 -17
  69. package/dist/lib/core/CreativeAgentClient.d.ts +41 -17
  70. package/dist/lib/core/CreativeAgentClient.d.ts.map +1 -1
  71. package/dist/lib/core/CreativeAgentClient.js +39 -12
  72. package/dist/lib/core/CreativeAgentClient.js.map +1 -1
  73. package/dist/lib/core/CreativeAgentClient.mjs +39 -12
  74. package/dist/lib/core/CreativeAgentClient.mjs.map +1 -1
  75. package/dist/lib/core/SingleAgentClient.d.mts +129 -52
  76. package/dist/lib/core/SingleAgentClient.d.ts +129 -52
  77. package/dist/lib/core/SingleAgentClient.d.ts.map +1 -1
  78. package/dist/lib/core/SingleAgentClient.js +1748 -218
  79. package/dist/lib/core/SingleAgentClient.js.map +1 -1
  80. package/dist/lib/core/SingleAgentClient.mjs +1758 -218
  81. package/dist/lib/core/SingleAgentClient.mjs.map +1 -1
  82. package/dist/lib/core/TaskExecutor.d.mts +9 -0
  83. package/dist/lib/core/TaskExecutor.d.ts +9 -0
  84. package/dist/lib/core/TaskExecutor.d.ts.map +1 -1
  85. package/dist/lib/core/TaskExecutor.js +137 -44
  86. package/dist/lib/core/TaskExecutor.js.map +1 -1
  87. package/dist/lib/core/TaskExecutor.mjs +137 -44
  88. package/dist/lib/core/TaskExecutor.mjs.map +1 -1
  89. package/dist/lib/index.d.mts +111 -17
  90. package/dist/lib/index.d.ts +111 -17
  91. package/dist/lib/index.d.ts.map +1 -1
  92. package/dist/lib/index.js +94 -94
  93. package/dist/lib/index.js.map +1 -1
  94. package/dist/lib/index.mjs +93 -94
  95. package/dist/lib/index.mjs.map +1 -1
  96. package/dist/lib/net/ssrf-fetch.d.mts +13 -1
  97. package/dist/lib/net/ssrf-fetch.d.ts +13 -1
  98. package/dist/lib/net/ssrf-fetch.d.ts.map +1 -1
  99. package/dist/lib/net/ssrf-fetch.js +14 -7
  100. package/dist/lib/net/ssrf-fetch.js.map +1 -1
  101. package/dist/lib/net/ssrf-fetch.mjs +14 -7
  102. package/dist/lib/net/ssrf-fetch.mjs.map +1 -1
  103. package/dist/lib/protocols/a2a.d.mts +2 -2
  104. package/dist/lib/protocols/a2a.d.ts +2 -2
  105. package/dist/lib/protocols/a2a.d.ts.map +1 -1
  106. package/dist/lib/protocols/a2a.js +14 -9
  107. package/dist/lib/protocols/a2a.js.map +1 -1
  108. package/dist/lib/protocols/a2a.mjs +14 -9
  109. package/dist/lib/protocols/a2a.mjs.map +1 -1
  110. package/dist/lib/protocols/index.d.mts +20 -3
  111. package/dist/lib/protocols/index.d.ts +20 -3
  112. package/dist/lib/protocols/index.d.ts.map +1 -1
  113. package/dist/lib/protocols/index.js +44 -31
  114. package/dist/lib/protocols/index.js.map +1 -1
  115. package/dist/lib/protocols/index.mjs +44 -32
  116. package/dist/lib/protocols/index.mjs.map +1 -1
  117. package/dist/lib/protocols/mcp-modern.d.ts.map +1 -1
  118. package/dist/lib/protocols/mcp-modern.js +87 -12
  119. package/dist/lib/protocols/mcp-modern.js.map +1 -1
  120. package/dist/lib/protocols/mcp-modern.mjs +89 -12
  121. package/dist/lib/protocols/mcp-modern.mjs.map +1 -1
  122. package/dist/lib/protocols/mcp-tasks.d.mts +3 -0
  123. package/dist/lib/protocols/mcp-tasks.d.ts +3 -0
  124. package/dist/lib/protocols/mcp-tasks.d.ts.map +1 -1
  125. package/dist/lib/protocols/mcp-tasks.js +21 -11
  126. package/dist/lib/protocols/mcp-tasks.js.map +1 -1
  127. package/dist/lib/protocols/mcp-tasks.mjs +21 -11
  128. package/dist/lib/protocols/mcp-tasks.mjs.map +1 -1
  129. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  130. package/dist/lib/server/create-adcp-server.d.mts +6 -0
  131. package/dist/lib/server/create-adcp-server.d.ts +6 -0
  132. package/dist/lib/server/create-adcp-server.d.ts.map +1 -1
  133. package/dist/lib/server/create-adcp-server.js +295 -48
  134. package/dist/lib/server/create-adcp-server.js.map +1 -1
  135. package/dist/lib/server/create-adcp-server.mjs +301 -50
  136. package/dist/lib/server/create-adcp-server.mjs.map +1 -1
  137. package/dist/lib/server/decisioning/assembly-helpers.d.mts +27 -13
  138. package/dist/lib/server/decisioning/assembly-helpers.d.ts +27 -13
  139. package/dist/lib/server/decisioning/assembly-helpers.d.ts.map +1 -1
  140. package/dist/lib/server/decisioning/assembly-helpers.js +136 -14
  141. package/dist/lib/server/decisioning/assembly-helpers.js.map +1 -1
  142. package/dist/lib/server/decisioning/assembly-helpers.mjs +134 -13
  143. package/dist/lib/server/decisioning/assembly-helpers.mjs.map +1 -1
  144. package/dist/lib/server/decisioning/index.d.mts +13 -12
  145. package/dist/lib/server/decisioning/index.d.ts +13 -12
  146. package/dist/lib/server/decisioning/index.d.ts.map +1 -1
  147. package/dist/lib/server/decisioning/index.js +6 -0
  148. package/dist/lib/server/decisioning/index.js.map +1 -1
  149. package/dist/lib/server/decisioning/index.mjs +9 -3
  150. package/dist/lib/server/decisioning/index.mjs.map +1 -1
  151. package/dist/lib/server/decisioning/list-helpers.d.mts +13 -3
  152. package/dist/lib/server/decisioning/list-helpers.d.ts +13 -3
  153. package/dist/lib/server/decisioning/list-helpers.d.ts.map +1 -1
  154. package/dist/lib/server/decisioning/list-helpers.js +13 -3
  155. package/dist/lib/server/decisioning/list-helpers.js.map +1 -1
  156. package/dist/lib/server/decisioning/list-helpers.mjs +11 -2
  157. package/dist/lib/server/decisioning/list-helpers.mjs.map +1 -1
  158. package/dist/lib/server/decisioning/manifest-helpers.d.mts +5 -3
  159. package/dist/lib/server/decisioning/manifest-helpers.d.ts +5 -3
  160. package/dist/lib/server/decisioning/manifest-helpers.d.ts.map +1 -1
  161. package/dist/lib/server/decisioning/manifest-helpers.js.map +1 -1
  162. package/dist/lib/server/decisioning/manifest-helpers.mjs.map +1 -1
  163. package/dist/lib/server/decisioning/proposal/dispatch.d.mts +2 -2
  164. package/dist/lib/server/decisioning/proposal/dispatch.d.ts +2 -2
  165. package/dist/lib/server/decisioning/proposal/dispatch.d.ts.map +1 -1
  166. package/dist/lib/server/decisioning/proposal/dispatch.js.map +1 -1
  167. package/dist/lib/server/decisioning/proposal/dispatch.mjs.map +1 -1
  168. package/dist/lib/server/decisioning/proposal/index.d.mts +1 -1
  169. package/dist/lib/server/decisioning/proposal/index.d.ts +1 -1
  170. package/dist/lib/server/decisioning/proposal/index.d.ts.map +1 -1
  171. package/dist/lib/server/decisioning/proposal/index.js.map +1 -1
  172. package/dist/lib/server/decisioning/proposal/index.mjs.map +1 -1
  173. package/dist/lib/server/decisioning/proposal/lifecycle.d.mts +3 -2
  174. package/dist/lib/server/decisioning/proposal/lifecycle.d.ts +3 -2
  175. package/dist/lib/server/decisioning/proposal/lifecycle.d.ts.map +1 -1
  176. package/dist/lib/server/decisioning/proposal/lifecycle.js.map +1 -1
  177. package/dist/lib/server/decisioning/proposal/lifecycle.mjs.map +1 -1
  178. package/dist/lib/server/decisioning/proposal/mock-manager.d.mts +3 -3
  179. package/dist/lib/server/decisioning/proposal/mock-manager.d.ts +3 -3
  180. package/dist/lib/server/decisioning/proposal/mock-manager.d.ts.map +1 -1
  181. package/dist/lib/server/decisioning/proposal/mock-manager.js.map +1 -1
  182. package/dist/lib/server/decisioning/proposal/mock-manager.mjs.map +1 -1
  183. package/dist/lib/server/decisioning/proposal/types.d.mts +10 -6
  184. package/dist/lib/server/decisioning/proposal/types.d.ts +10 -6
  185. package/dist/lib/server/decisioning/proposal/types.d.ts.map +1 -1
  186. package/dist/lib/server/decisioning/proposal/types.js.map +1 -1
  187. package/dist/lib/server/decisioning/proposal/types.mjs.map +1 -1
  188. package/dist/lib/server/decisioning/runtime/from-platform.d.mts +21 -2
  189. package/dist/lib/server/decisioning/runtime/from-platform.d.ts +21 -2
  190. package/dist/lib/server/decisioning/runtime/from-platform.d.ts.map +1 -1
  191. package/dist/lib/server/decisioning/runtime/from-platform.js +754 -81
  192. package/dist/lib/server/decisioning/runtime/from-platform.js.map +1 -1
  193. package/dist/lib/server/decisioning/runtime/from-platform.mjs +763 -81
  194. package/dist/lib/server/decisioning/runtime/from-platform.mjs.map +1 -1
  195. package/dist/lib/server/decisioning/specialisms/brand-rights.d.mts +9 -9
  196. package/dist/lib/server/decisioning/specialisms/brand-rights.d.ts +9 -9
  197. package/dist/lib/server/decisioning/specialisms/brand-rights.d.ts.map +1 -1
  198. package/dist/lib/server/decisioning/specialisms/brand-rights.js.map +1 -1
  199. package/dist/lib/server/decisioning/specialisms/content-standards.d.mts +16 -16
  200. package/dist/lib/server/decisioning/specialisms/content-standards.d.ts +16 -16
  201. package/dist/lib/server/decisioning/specialisms/content-standards.d.ts.map +1 -1
  202. package/dist/lib/server/decisioning/specialisms/content-standards.js.map +1 -1
  203. package/dist/lib/server/decisioning/specialisms/creative-ad-server.d.mts +15 -13
  204. package/dist/lib/server/decisioning/specialisms/creative-ad-server.d.ts +15 -13
  205. package/dist/lib/server/decisioning/specialisms/creative-ad-server.d.ts.map +1 -1
  206. package/dist/lib/server/decisioning/specialisms/creative-ad-server.js.map +1 -1
  207. package/dist/lib/server/decisioning/specialisms/creative.d.mts +12 -11
  208. package/dist/lib/server/decisioning/specialisms/creative.d.ts +12 -11
  209. package/dist/lib/server/decisioning/specialisms/creative.d.ts.map +1 -1
  210. package/dist/lib/server/decisioning/specialisms/creative.js.map +1 -1
  211. package/dist/lib/server/decisioning/specialisms/sales.d.mts +25 -15
  212. package/dist/lib/server/decisioning/specialisms/sales.d.ts +25 -15
  213. package/dist/lib/server/decisioning/specialisms/sales.d.ts.map +1 -1
  214. package/dist/lib/server/decisioning/specialisms/sales.js.map +1 -1
  215. package/dist/lib/server/index.d.mts +3 -3
  216. package/dist/lib/server/index.d.ts +3 -3
  217. package/dist/lib/server/index.d.ts.map +1 -1
  218. package/dist/lib/server/index.js +72 -72
  219. package/dist/lib/server/index.js.map +1 -1
  220. package/dist/lib/server/index.mjs +36 -36
  221. package/dist/lib/server/index.mjs.map +1 -1
  222. package/dist/lib/server/legacy/v5/index.d.mts +1 -0
  223. package/dist/lib/server/legacy/v5/index.d.ts +1 -0
  224. package/dist/lib/server/legacy/v5/index.d.ts.map +1 -1
  225. package/dist/lib/server/legacy/v5/index.js +74 -1
  226. package/dist/lib/server/legacy/v5/index.js.map +1 -1
  227. package/dist/lib/server/legacy/v5/index.mjs +75 -1
  228. package/dist/lib/server/legacy/v5/index.mjs.map +1 -1
  229. package/dist/lib/server/responses.d.mts +2 -2
  230. package/dist/lib/server/responses.d.ts +2 -2
  231. package/dist/lib/server/responses.js.map +1 -1
  232. package/dist/lib/server/responses.mjs.map +1 -1
  233. package/dist/lib/testing/client.d.ts.map +1 -1
  234. package/dist/lib/testing/client.js +13 -5
  235. package/dist/lib/testing/client.js.map +1 -1
  236. package/dist/lib/testing/client.mjs +13 -5
  237. package/dist/lib/testing/client.mjs.map +1 -1
  238. package/dist/lib/testing/compliance/comply.d.mts +1 -1
  239. package/dist/lib/testing/compliance/comply.d.ts +1 -1
  240. package/dist/lib/testing/compliance/comply.d.ts.map +1 -1
  241. package/dist/lib/testing/compliance/comply.js +16 -6
  242. package/dist/lib/testing/compliance/comply.js.map +1 -1
  243. package/dist/lib/testing/compliance/comply.mjs +16 -6
  244. package/dist/lib/testing/compliance/comply.mjs.map +1 -1
  245. package/dist/lib/testing/scenarios/brand-rights.js +6 -6
  246. package/dist/lib/testing/scenarios/brand-rights.js.map +1 -1
  247. package/dist/lib/testing/scenarios/brand-rights.mjs +6 -6
  248. package/dist/lib/testing/scenarios/brand-rights.mjs.map +1 -1
  249. package/dist/lib/testing/scenarios/creative.js +7 -7
  250. package/dist/lib/testing/scenarios/creative.js.map +1 -1
  251. package/dist/lib/testing/scenarios/creative.mjs +7 -7
  252. package/dist/lib/testing/scenarios/creative.mjs.map +1 -1
  253. package/dist/lib/testing/scenarios/discovery.js +2 -2
  254. package/dist/lib/testing/scenarios/discovery.js.map +1 -1
  255. package/dist/lib/testing/scenarios/discovery.mjs +2 -2
  256. package/dist/lib/testing/scenarios/discovery.mjs.map +1 -1
  257. package/dist/lib/testing/scenarios/edge-cases.js +11 -11
  258. package/dist/lib/testing/scenarios/edge-cases.js.map +1 -1
  259. package/dist/lib/testing/scenarios/edge-cases.mjs +11 -11
  260. package/dist/lib/testing/scenarios/edge-cases.mjs.map +1 -1
  261. package/dist/lib/testing/scenarios/governance.d.ts.map +1 -1
  262. package/dist/lib/testing/scenarios/governance.js +16 -22
  263. package/dist/lib/testing/scenarios/governance.js.map +1 -1
  264. package/dist/lib/testing/scenarios/governance.mjs +16 -22
  265. package/dist/lib/testing/scenarios/governance.mjs.map +1 -1
  266. package/dist/lib/testing/scenarios/media-buy.js +5 -5
  267. package/dist/lib/testing/scenarios/media-buy.js.map +1 -1
  268. package/dist/lib/testing/scenarios/media-buy.mjs +5 -5
  269. package/dist/lib/testing/scenarios/media-buy.mjs.map +1 -1
  270. package/dist/lib/testing/scenarios/schema-compliance.js +1 -1
  271. package/dist/lib/testing/scenarios/schema-compliance.js.map +1 -1
  272. package/dist/lib/testing/scenarios/schema-compliance.mjs +1 -1
  273. package/dist/lib/testing/scenarios/schema-compliance.mjs.map +1 -1
  274. package/dist/lib/testing/scenarios/trusted-match.d.ts.map +1 -1
  275. package/dist/lib/testing/scenarios/trusted-match.js +4 -3
  276. package/dist/lib/testing/scenarios/trusted-match.js.map +1 -1
  277. package/dist/lib/testing/scenarios/trusted-match.mjs +4 -3
  278. package/dist/lib/testing/scenarios/trusted-match.mjs.map +1 -1
  279. package/dist/lib/testing/storyboard/probes.d.mts +6 -0
  280. package/dist/lib/testing/storyboard/probes.d.ts +6 -0
  281. package/dist/lib/testing/storyboard/probes.d.ts.map +1 -1
  282. package/dist/lib/testing/storyboard/probes.js +16 -5
  283. package/dist/lib/testing/storyboard/probes.js.map +1 -1
  284. package/dist/lib/testing/storyboard/probes.mjs +16 -5
  285. package/dist/lib/testing/storyboard/probes.mjs.map +1 -1
  286. package/dist/lib/testing/storyboard/runner.d.ts.map +1 -1
  287. package/dist/lib/testing/storyboard/runner.js +6 -2
  288. package/dist/lib/testing/storyboard/runner.js.map +1 -1
  289. package/dist/lib/testing/storyboard/runner.mjs +6 -2
  290. package/dist/lib/testing/storyboard/runner.mjs.map +1 -1
  291. package/dist/lib/testing/storyboard/shape-drift-hints.d.mts +3 -4
  292. package/dist/lib/testing/storyboard/shape-drift-hints.d.ts +3 -4
  293. package/dist/lib/testing/storyboard/shape-drift-hints.d.ts.map +1 -1
  294. package/dist/lib/testing/storyboard/shape-drift-hints.js +27 -27
  295. package/dist/lib/testing/storyboard/shape-drift-hints.js.map +1 -1
  296. package/dist/lib/testing/storyboard/shape-drift-hints.mjs +27 -27
  297. package/dist/lib/testing/storyboard/shape-drift-hints.mjs.map +1 -1
  298. package/dist/lib/testing/storyboard/task-map.d.ts.map +1 -1
  299. package/dist/lib/testing/storyboard/task-map.js +43 -5
  300. package/dist/lib/testing/storyboard/task-map.js.map +1 -1
  301. package/dist/lib/testing/storyboard/task-map.mjs +43 -5
  302. package/dist/lib/testing/storyboard/task-map.mjs.map +1 -1
  303. package/dist/lib/testing/test-helpers.d.mts +2 -2
  304. package/dist/lib/testing/test-helpers.d.ts +2 -2
  305. package/dist/lib/testing/test-helpers.js.map +1 -1
  306. package/dist/lib/testing/test-helpers.mjs.map +1 -1
  307. package/dist/lib/testing/types.d.mts +7 -1
  308. package/dist/lib/testing/types.d.ts +7 -1
  309. package/dist/lib/testing/types.d.ts.map +1 -1
  310. package/dist/lib/testing/types.js.map +1 -1
  311. package/dist/lib/types/adcp.d.mts +14 -14
  312. package/dist/lib/types/adcp.d.ts +14 -14
  313. package/dist/lib/types/adcp.d.ts.map +1 -1
  314. package/dist/lib/types/adcp.js.map +1 -1
  315. package/dist/lib/types/adcp.mjs.map +1 -1
  316. package/dist/lib/types/index.d.mts +2 -2
  317. package/dist/lib/types/index.d.ts +2 -2
  318. package/dist/lib/types/index.d.ts.map +1 -1
  319. package/dist/lib/types/index.js.map +1 -1
  320. package/dist/lib/types/index.mjs.map +1 -1
  321. package/dist/lib/utils/capabilities.d.mts +6 -0
  322. package/dist/lib/utils/capabilities.d.ts +6 -0
  323. package/dist/lib/utils/capabilities.d.ts.map +1 -1
  324. package/dist/lib/utils/capabilities.js +4 -0
  325. package/dist/lib/utils/capabilities.js.map +1 -1
  326. package/dist/lib/utils/capabilities.mjs +4 -0
  327. package/dist/lib/utils/capabilities.mjs.map +1 -1
  328. package/dist/lib/utils/creative-delivery.d.mts +52 -10
  329. package/dist/lib/utils/creative-delivery.d.ts +52 -10
  330. package/dist/lib/utils/creative-delivery.d.ts.map +1 -1
  331. package/dist/lib/utils/creative-delivery.js +104 -9
  332. package/dist/lib/utils/creative-delivery.js.map +1 -1
  333. package/dist/lib/utils/creative-delivery.mjs +104 -8
  334. package/dist/lib/utils/creative-delivery.mjs.map +1 -1
  335. package/dist/lib/utils/format-assets.d.mts +41 -38
  336. package/dist/lib/utils/format-assets.d.ts +41 -38
  337. package/dist/lib/utils/format-assets.d.ts.map +1 -1
  338. package/dist/lib/utils/format-assets.js +3 -1
  339. package/dist/lib/utils/format-assets.js.map +1 -1
  340. package/dist/lib/utils/format-assets.mjs +3 -1
  341. package/dist/lib/utils/format-assets.mjs.map +1 -1
  342. package/dist/lib/utils/index.d.mts +8 -8
  343. package/dist/lib/utils/index.d.ts +8 -8
  344. package/dist/lib/utils/index.d.ts.map +1 -1
  345. package/dist/lib/utils/index.js +11 -9
  346. package/dist/lib/utils/index.js.map +1 -1
  347. package/dist/lib/utils/index.mjs +9 -8
  348. package/dist/lib/utils/index.mjs.map +1 -1
  349. package/dist/lib/utils/preview-utils.d.mts +11 -8
  350. package/dist/lib/utils/preview-utils.d.ts +11 -8
  351. package/dist/lib/utils/preview-utils.d.ts.map +1 -1
  352. package/dist/lib/utils/preview-utils.js +4 -4
  353. package/dist/lib/utils/preview-utils.js.map +1 -1
  354. package/dist/lib/utils/preview-utils.mjs +3 -3
  355. package/dist/lib/utils/preview-utils.mjs.map +1 -1
  356. package/dist/lib/utils/tool-request-schemas.d.mts +2 -2
  357. package/dist/lib/utils/tool-request-schemas.d.ts +2 -2
  358. package/dist/lib/v2/projection/aao-reference-formats.json +492 -0
  359. package/dist/lib/v2/projection/augment-response.d.mts +31 -11
  360. package/dist/lib/v2/projection/augment-response.d.ts +31 -11
  361. package/dist/lib/v2/projection/augment-response.d.ts.map +1 -1
  362. package/dist/lib/v2/projection/augment-response.js +233 -27
  363. package/dist/lib/v2/projection/augment-response.js.map +1 -1
  364. package/dist/lib/v2/projection/augment-response.mjs +232 -27
  365. package/dist/lib/v2/projection/augment-response.mjs.map +1 -1
  366. package/dist/lib/v2/projection/builders.d.mts +7 -6
  367. package/dist/lib/v2/projection/builders.d.ts +7 -6
  368. package/dist/lib/v2/projection/builders.d.ts.map +1 -1
  369. package/dist/lib/v2/projection/builders.js +11 -8
  370. package/dist/lib/v2/projection/builders.js.map +1 -1
  371. package/dist/lib/v2/projection/builders.mjs +9 -6
  372. package/dist/lib/v2/projection/builders.mjs.map +1 -1
  373. package/dist/lib/v2/projection/catalog-snapshot.d.mts +47 -0
  374. package/dist/lib/v2/projection/catalog-snapshot.d.ts +48 -0
  375. package/dist/lib/v2/projection/catalog-snapshot.d.ts.map +1 -0
  376. package/dist/lib/v2/projection/catalog-snapshot.js +291 -0
  377. package/dist/lib/v2/projection/catalog-snapshot.js.map +1 -0
  378. package/dist/lib/v2/projection/catalog-snapshot.mjs +265 -0
  379. package/dist/lib/v2/projection/catalog-snapshot.mjs.map +1 -0
  380. package/dist/lib/v2/projection/catalog.d.mts +23 -2
  381. package/dist/lib/v2/projection/catalog.d.ts +23 -2
  382. package/dist/lib/v2/projection/catalog.d.ts.map +1 -1
  383. package/dist/lib/v2/projection/catalog.js +34 -10
  384. package/dist/lib/v2/projection/catalog.js.map +1 -1
  385. package/dist/lib/v2/projection/catalog.mjs +33 -10
  386. package/dist/lib/v2/projection/catalog.mjs.map +1 -1
  387. package/dist/lib/v2/projection/creative-delivery.d.mts +157 -0
  388. package/dist/lib/v2/projection/creative-delivery.d.ts +158 -0
  389. package/dist/lib/v2/projection/creative-delivery.d.ts.map +1 -0
  390. package/dist/lib/v2/projection/creative-delivery.js +967 -0
  391. package/dist/lib/v2/projection/creative-delivery.js.map +1 -0
  392. package/dist/lib/v2/projection/creative-delivery.mjs +941 -0
  393. package/dist/lib/v2/projection/creative-delivery.mjs.map +1 -0
  394. package/dist/lib/v2/projection/index.d.mts +8 -6
  395. package/dist/lib/v2/projection/index.d.ts +8 -6
  396. package/dist/lib/v2/projection/index.d.ts.map +1 -1
  397. package/dist/lib/v2/projection/index.js +26 -4
  398. package/dist/lib/v2/projection/index.js.map +1 -1
  399. package/dist/lib/v2/projection/index.mjs +28 -4
  400. package/dist/lib/v2/projection/index.mjs.map +1 -1
  401. package/dist/lib/v2/projection/legacy-metadata.d.mts +21 -0
  402. package/dist/lib/v2/projection/legacy-metadata.d.ts +22 -0
  403. package/dist/lib/v2/projection/legacy-metadata.d.ts.map +1 -0
  404. package/dist/lib/v2/projection/legacy-metadata.js +73 -0
  405. package/dist/lib/v2/projection/legacy-metadata.js.map +1 -0
  406. package/dist/lib/v2/projection/legacy-metadata.mjs +45 -0
  407. package/dist/lib/v2/projection/legacy-metadata.mjs.map +1 -0
  408. package/dist/lib/v2/projection/types.d.mts +29 -23
  409. package/dist/lib/v2/projection/types.d.ts +29 -23
  410. package/dist/lib/v2/projection/types.d.ts.map +1 -1
  411. package/dist/lib/v2/projection/types.js.map +1 -1
  412. package/dist/lib/v2/projection/v1-to-v2.d.mts +29 -6
  413. package/dist/lib/v2/projection/v1-to-v2.d.ts +29 -6
  414. package/dist/lib/v2/projection/v1-to-v2.d.ts.map +1 -1
  415. package/dist/lib/v2/projection/v1-to-v2.js +218 -9
  416. package/dist/lib/v2/projection/v1-to-v2.js.map +1 -1
  417. package/dist/lib/v2/projection/v1-to-v2.mjs +219 -10
  418. package/dist/lib/v2/projection/v1-to-v2.mjs.map +1 -1
  419. package/dist/lib/v2/projection/v2-to-v1.d.mts +31 -2
  420. package/dist/lib/v2/projection/v2-to-v1.d.ts +31 -2
  421. package/dist/lib/v2/projection/v2-to-v1.d.ts.map +1 -1
  422. package/dist/lib/v2/projection/v2-to-v1.js +138 -7
  423. package/dist/lib/v2/projection/v2-to-v1.js.map +1 -1
  424. package/dist/lib/v2/projection/v2-to-v1.mjs +135 -6
  425. package/dist/lib/v2/projection/v2-to-v1.mjs.map +1 -1
  426. package/dist/lib/v2/projection/write-side.d.mts +12 -13
  427. package/dist/lib/v2/projection/write-side.d.ts +12 -13
  428. package/dist/lib/v2/projection/write-side.d.ts.map +1 -1
  429. package/dist/lib/v2/projection/write-side.js +16 -12
  430. package/dist/lib/v2/projection/write-side.js.map +1 -1
  431. package/dist/lib/v2/projection/write-side.mjs +16 -12
  432. package/dist/lib/v2/projection/write-side.mjs.map +1 -1
  433. package/dist/lib/version.d.mts +3 -3
  434. package/dist/lib/version.d.ts +3 -3
  435. package/dist/lib/version.d.ts.map +1 -1
  436. package/dist/lib/version.js +3 -3
  437. package/dist/lib/version.js.map +1 -1
  438. package/dist/lib/version.mjs +3 -3
  439. package/dist/lib/version.mjs.map +1 -1
  440. package/docs/guides/BUILD-AN-AGENT.md +7 -2
  441. package/docs/guides/PREVIEW-ASSET-DURABILITY.md +6 -2
  442. package/docs/llms.txt +1 -0
  443. package/examples/README.md +1 -1
  444. package/examples/batch-preview-test.ts +3 -3
  445. package/examples/conversation-client.ts +2 -2
  446. package/examples/debug-preview-response.ts +1 -1
  447. package/examples/decisioning-platform-broadcast-tv.ts +10 -4
  448. package/examples/decisioning-platform-mock-seller.ts +16 -9
  449. package/examples/decisioning-platform-programmatic.ts +18 -7
  450. package/examples/error-compliant-server.ts +26 -16
  451. package/examples/generative-creative-demo.ts +7 -19
  452. package/examples/hello_creative_adapter_ad_server.ts +37 -16
  453. package/examples/hello_creative_adapter_template.ts +12 -10
  454. package/examples/hello_seller_adapter_guaranteed.ts +52 -23
  455. package/examples/hello_seller_adapter_multi_tenant.ts +6 -3
  456. package/examples/hello_seller_adapter_non_guaranteed.ts +54 -26
  457. package/examples/hello_seller_adapter_proposal_mode.ts +40 -14
  458. package/examples/hello_seller_adapter_social.ts +2 -7
  459. package/examples/inspect-card-formats.ts +1 -1
  460. package/examples/simple-getting-started.ts +1 -1
  461. package/examples/test-helpers-demo.ts +1 -1
  462. package/package.json +2 -2
  463. package/skills/build-decisioning-creative-template/SKILL.md +11 -11
  464. package/skills/build-decisioning-platform/advanced/REFERENCE.md +8 -2
@@ -26,10 +26,9 @@ import type { ShapeDriftHint } from './types.mjs';
26
26
  * helper that builds the correct shape.
27
27
  *
28
28
  * Helper names aren't uniformly prefixed — `get_products` uses
29
- * `productsResponse` (no `get` prefix) while `get_media_buys` uses
30
- * `getMediaBuysResponse`. Names match the exports in
31
- * `src/lib/server/responses.ts` verbatim so a developer can grep
32
- * straight from the hint.
29
+ * `legacyProductsResponse` (no `get` prefix) while `get_media_buys` uses
30
+ * `legacyGetMediaBuysResponse`. Names match the explicit compatibility
31
+ * aliases on `@adcp/sdk/server`.
33
32
  */
34
33
  export declare const LIST_WRAPPER_TOOLS: Record<string, {
35
34
  wrapperKey: string;
@@ -26,10 +26,9 @@ import type { ShapeDriftHint } from './types';
26
26
  * helper that builds the correct shape.
27
27
  *
28
28
  * Helper names aren't uniformly prefixed — `get_products` uses
29
- * `productsResponse` (no `get` prefix) while `get_media_buys` uses
30
- * `getMediaBuysResponse`. Names match the exports in
31
- * `src/lib/server/responses.ts` verbatim so a developer can grep
32
- * straight from the hint.
29
+ * `legacyProductsResponse` (no `get` prefix) while `get_media_buys` uses
30
+ * `legacyGetMediaBuysResponse`. Names match the explicit compatibility
31
+ * aliases on `@adcp/sdk/server`.
33
32
  */
34
33
  export declare const LIST_WRAPPER_TOOLS: Record<string, {
35
34
  wrapperKey: string;
@@ -1 +1 @@
1
- {"version":3,"file":"shape-drift-hints.d.ts","sourceRoot":"","sources":["../../../../src/lib/testing/storyboard/shape-drift-hints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AA0C9C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAWrF,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,cAAc,EAAE,CAKnH"}
1
+ {"version":3,"file":"shape-drift-hints.d.ts","sourceRoot":"","sources":["../../../../src/lib/testing/storyboard/shape-drift-hints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AA0C9C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAWrF,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,cAAc,EAAE,CAKnH"}
@@ -23,19 +23,19 @@ __export(shape_drift_hints_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(shape_drift_hints_exports);
25
25
  const HELPER_MIN_VERSION = {
26
- buildCreativeResponse: "5.14.0",
27
- listCreativesResponse: "5.10.0",
28
- listCreativeFormatsResponse: "5.10.0",
29
- listAccountsResponse: "5.10.0",
30
- productsResponse: "5.10.0",
31
- getMediaBuysResponse: "5.10.0",
32
- getSignalsResponse: "5.10.0",
33
- listPropertyListsResponse: "5.10.0",
34
- listCollectionListsResponse: "5.10.0",
35
- listContentStandardsResponse: "5.10.0",
36
- getPlanAuditLogsResponse: "5.10.0",
37
- syncCreativesResponse: "5.10.0",
38
- previewCreativeResponse: "5.10.0"
26
+ legacyBuildCreativeResponse: "13.0.0",
27
+ legacyListCreativesResponse: "13.0.0",
28
+ legacyListCreativeFormatsResponse: "13.0.0",
29
+ legacyListAccountsResponse: "13.0.0",
30
+ legacyProductsResponse: "13.0.0",
31
+ legacyGetMediaBuysResponse: "13.0.0",
32
+ legacyGetSignalsResponse: "13.0.0",
33
+ legacyListPropertyListsResponse: "13.0.0",
34
+ legacyListCollectionListsResponse: "13.0.0",
35
+ legacyListContentStandardsResponse: "13.0.0",
36
+ legacyGetPlanAuditLogsResponse: "13.0.0",
37
+ legacySyncCreativesResponse: "13.0.0",
38
+ legacyPreviewCreativeResponse: "13.0.0"
39
39
  };
40
40
  function semverLessThan(a, b) {
41
41
  const normalize = (v) => v.replace(/^.*@/, "").replace(/-.*$/, "");
@@ -47,16 +47,16 @@ function semverLessThan(a, b) {
47
47
  return aPatch < bPatch;
48
48
  }
49
49
  const LIST_WRAPPER_TOOLS = {
50
- list_creatives: { wrapperKey: "creatives", helper: "listCreativesResponse" },
51
- list_creative_formats: { wrapperKey: "formats", helper: "listCreativeFormatsResponse" },
52
- list_accounts: { wrapperKey: "accounts", helper: "listAccountsResponse" },
53
- get_products: { wrapperKey: "products", helper: "productsResponse" },
54
- get_media_buys: { wrapperKey: "media_buys", helper: "getMediaBuysResponse" },
55
- get_signals: { wrapperKey: "signals", helper: "getSignalsResponse" },
56
- list_property_lists: { wrapperKey: "lists", helper: "listPropertyListsResponse" },
57
- list_collection_lists: { wrapperKey: "lists", helper: "listCollectionListsResponse" },
58
- list_content_standards: { wrapperKey: "standards", helper: "listContentStandardsResponse" },
59
- get_plan_audit_logs: { wrapperKey: "plans", helper: "getPlanAuditLogsResponse" }
50
+ list_creatives: { wrapperKey: "creatives", helper: "legacyListCreativesResponse" },
51
+ list_creative_formats: { wrapperKey: "formats", helper: "legacyListCreativeFormatsResponse" },
52
+ list_accounts: { wrapperKey: "accounts", helper: "legacyListAccountsResponse" },
53
+ get_products: { wrapperKey: "products", helper: "legacyProductsResponse" },
54
+ get_media_buys: { wrapperKey: "media_buys", helper: "legacyGetMediaBuysResponse" },
55
+ get_signals: { wrapperKey: "signals", helper: "legacyGetSignalsResponse" },
56
+ list_property_lists: { wrapperKey: "lists", helper: "legacyListPropertyListsResponse" },
57
+ list_collection_lists: { wrapperKey: "lists", helper: "legacyListCollectionListsResponse" },
58
+ list_content_standards: { wrapperKey: "standards", helper: "legacyListContentStandardsResponse" },
59
+ get_plan_audit_logs: { wrapperKey: "plans", helper: "legacyGetPlanAuditLogsResponse" }
60
60
  };
61
61
  function detectShapeDriftHints(taskName, payload, libraryVersion) {
62
62
  const hint = detect(taskName, payload);
@@ -100,7 +100,7 @@ function detect(taskName, payload) {
100
100
  observed_variant: "platform_native_fields",
101
101
  expected_variant: "{ creative_manifest: { format_id, assets } }",
102
102
  instance_path: "",
103
- message: `build_creative returned platform-native fields at the top level (${platformNativePresent.join(", ")}). Required: { creative_manifest: { format_id, assets } }. Use buildCreativeResponse() from @adcp/sdk/server.`
103
+ message: `build_creative returned platform-native fields at the top level (${platformNativePresent.join(", ")}). Required: { creative_manifest: { format_id, assets } }. Use legacyBuildCreativeResponse() from @adcp/sdk/server.`
104
104
  };
105
105
  }
106
106
  }
@@ -115,7 +115,7 @@ function detect(taskName, payload) {
115
115
  observed_variant: "per_item_shape",
116
116
  expected_variant: "{ creatives: [{ creative_id, action, ... }] }",
117
117
  instance_path: "",
118
- message: `sync_creatives returned a single creative's inner shape at the top level (${perItemPresent.join(", ")}). Required: { creatives: [{ creative_id, action, ... }] } (or { errors: [...] } / { status: 'submitted', task_id }). Use syncCreativesResponse() from @adcp/sdk/server.`
118
+ message: `sync_creatives returned a single creative's inner shape at the top level (${perItemPresent.join(", ")}). Required: { creatives: [{ creative_id, action, ... }] } (or { errors: [...] } / { status: 'submitted', task_id }). Use legacySyncCreativesResponse() from @adcp/sdk/server.`
119
119
  };
120
120
  }
121
121
  const results = p.results;
@@ -129,7 +129,7 @@ function detect(taskName, payload) {
129
129
  observed_variant: "wrong_wrapper_key",
130
130
  expected_variant: "{ creatives: [{ creative_id, action, ... }] }",
131
131
  instance_path: "/results",
132
- message: `sync_creatives returned { results: [...] } instead of { creatives: [...] } \u2014 wrong wrapper key. Required: { creatives: [{ creative_id, action, ... }] }. Use syncCreativesResponse() from @adcp/sdk/server.`
132
+ message: `sync_creatives returned { results: [...] } instead of { creatives: [...] } \u2014 wrong wrapper key. Required: { creatives: [{ creative_id, action, ... }] }. Use legacySyncCreativesResponse() from @adcp/sdk/server.`
133
133
  };
134
134
  }
135
135
  }
@@ -146,7 +146,7 @@ function detect(taskName, payload) {
146
146
  observed_variant: "raw_render_fields",
147
147
  expected_variant: "{ response_type: 'single', previews: [{ renders: [...] }], expires_at }",
148
148
  instance_path: "",
149
- message: `preview_creative returned raw render fields at the top level (${driftSignal.join(", ")}). Required: { response_type: 'single', previews: [{ renders: [{ preview_url | preview_html }] }], expires_at }. Use previewCreativeResponse() from @adcp/sdk/server.`
149
+ message: `preview_creative returned raw render fields at the top level (${driftSignal.join(", ")}). Required: { response_type: 'single', previews: [{ renders: [{ preview_url | preview_html }] }], expires_at }. Use legacyPreviewCreativeResponse() from @adcp/sdk/server.`
150
150
  };
151
151
  }
152
152
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/testing/storyboard/shape-drift-hints.ts"],"sourcesContent":["/**\n * Structured shape-drift hint detection (issue #935).\n *\n * The runner emits one `ShapeDriftHint` per response when it recognizes a\n * common payload-shape mistake — bare arrays from list tools, platform-\n * native fields from `build_creative`, missing wrappers on `sync_creatives`\n * / `preview_creative`. Each hint carries the same prose the legacy\n * `detectShapeDriftHint` returned, plus structured fields (`tool`,\n * `observed_variant`, `expected_variant`, `instance_path`) so renderers\n * (CLI, Addie, JUnit, SARIF) can build per-case fix plans without re-\n * parsing the message.\n *\n * The string-only `detectShapeDriftHint` in `validations.ts` is a thin\n * shim over this detector — kept so existing unit tests and external\n * callers keep working, but the canonical path is structured.\n *\n * Fires unconditionally (regardless of step pass/fail) — same gate as\n * `ValidationResult.warning` carried previously. The caller (`runner.ts`)\n * merges the result into `StoryboardStepResult.hints[]`.\n */\nimport type { ShapeDriftHint } from './types';\n\n/**\n * Minimum @adcp/client version in which each server-side helper first shipped.\n * Used to suffix shape-drift hints when the agent reports an older SDK version.\n * Keys match the helper name referenced in the hint `message`.\n */\nconst HELPER_MIN_VERSION: Record<string, string> = {\n buildCreativeResponse: '5.14.0',\n listCreativesResponse: '5.10.0',\n listCreativeFormatsResponse: '5.10.0',\n listAccountsResponse: '5.10.0',\n productsResponse: '5.10.0',\n getMediaBuysResponse: '5.10.0',\n getSignalsResponse: '5.10.0',\n listPropertyListsResponse: '5.10.0',\n listCollectionListsResponse: '5.10.0',\n listContentStandardsResponse: '5.10.0',\n getPlanAuditLogsResponse: '5.10.0',\n syncCreativesResponse: '5.10.0',\n previewCreativeResponse: '5.10.0',\n};\n\n/**\n * Compare two semver strings using numeric segment ordering.\n * Returns true when `a` is strictly less than `b`.\n * Handles `@adcp/client@X.Y.Z` format by stripping the package prefix.\n */\nfunction semverLessThan(a: string, b: string): boolean {\n // Strip package prefix (e.g. \"@adcp/client@\") and pre-release suffix (e.g. \"-beta.1\")\n const normalize = (v: string) => v.replace(/^.*@/, '').replace(/-.*$/, '');\n const segs = (v: string) =>\n normalize(v)\n .split('.')\n .map(s => parseInt(s, 10) || 0);\n const [aMaj = 0, aMin = 0, aPatch = 0] = segs(a);\n const [bMaj = 0, bMin = 0, bPatch = 0] = segs(b);\n if (aMaj !== bMaj) return aMaj < bMaj;\n if (aMin !== bMin) return aMin < bMin;\n return aPatch < bPatch;\n}\n\n/**\n * List-shaped tools where handlers commonly return the bare inner array\n * (`[{...}]`) at the top level instead of wrapping it in the required\n * object envelope. Each entry names the wrapper key and the response\n * helper that builds the correct shape.\n *\n * Helper names aren't uniformly prefixed — `get_products` uses\n * `productsResponse` (no `get` prefix) while `get_media_buys` uses\n * `getMediaBuysResponse`. Names match the exports in\n * `src/lib/server/responses.ts` verbatim so a developer can grep\n * straight from the hint.\n */\nexport const LIST_WRAPPER_TOOLS: Record<string, { wrapperKey: string; helper: string }> = {\n list_creatives: { wrapperKey: 'creatives', helper: 'listCreativesResponse' },\n list_creative_formats: { wrapperKey: 'formats', helper: 'listCreativeFormatsResponse' },\n list_accounts: { wrapperKey: 'accounts', helper: 'listAccountsResponse' },\n get_products: { wrapperKey: 'products', helper: 'productsResponse' },\n get_media_buys: { wrapperKey: 'media_buys', helper: 'getMediaBuysResponse' },\n get_signals: { wrapperKey: 'signals', helper: 'getSignalsResponse' },\n list_property_lists: { wrapperKey: 'lists', helper: 'listPropertyListsResponse' },\n list_collection_lists: { wrapperKey: 'lists', helper: 'listCollectionListsResponse' },\n list_content_standards: { wrapperKey: 'standards', helper: 'listContentStandardsResponse' },\n get_plan_audit_logs: { wrapperKey: 'plans', helper: 'getPlanAuditLogsResponse' },\n};\n\n/**\n * Detect shape-drift and return the structured hints that apply (zero or\n * one — the detector emits at most one hint per response, but returns an\n * array so callers can spread it into `step.hints[]` without a guard).\n *\n * @param taskName — tool name (snake_case) the storyboard dispatched under\n * @param payload — raw response payload, after the runner's `_message`\n * pre-strip. `unknown` rather than `Record<string, unknown>` so bare-\n * array payloads are recognizable at the top level; object branches\n * guard internally.\n * @param libraryVersion — optional SDK version string the agent self-reported\n * in `get_adcp_capabilities` (e.g. `\"@adcp/client@4.16.2\"`). When present\n * and below the helper's minimum version, the hint message is suffixed with\n * an upgrade note so developers know to update their SDK dep.\n */\nexport function detectShapeDriftHints(taskName: string, payload: unknown, libraryVersion?: string): ShapeDriftHint[] {\n const hint = detect(taskName, payload);\n if (!hint) return [];\n if (libraryVersion) hint.message = appendVersionSuffix(hint.message, libraryVersion);\n return [hint];\n}\n\n/**\n * If the hint message references a helper that requires a minimum SDK\n * version and the agent's reported version is below it, append an upgrade\n * note to the message. Returns the message unchanged if no version data or\n * no match.\n */\nfunction appendVersionSuffix(message: string, libraryVersion: string): string {\n // Skip non-numeric version strings (e.g. \"local-dev\") to avoid spurious suffixes\n const stripped = libraryVersion.replace(/^.*@/, '').replace(/-.*$/, '');\n if (!/^\\d+\\.\\d+/.test(stripped)) return message;\n for (const [helper, minVersion] of Object.entries(HELPER_MIN_VERSION)) {\n if (message.includes(helper) && semverLessThan(libraryVersion, minVersion)) {\n return (\n message +\n ` (Note: your agent reports ${libraryVersion} — ${helper}() ships in @adcp/client ≥${minVersion}. Upgrade your SDK dep.)`\n );\n }\n }\n return message;\n}\n\nfunction detect(taskName: string, payload: unknown): ShapeDriftHint | undefined {\n if (Array.isArray(payload)) {\n const listMeta = LIST_WRAPPER_TOOLS[taskName];\n if (!listMeta) return undefined;\n return {\n kind: 'shape_drift',\n tool: taskName,\n observed_variant: 'bare_array',\n expected_variant: `{ ${listMeta.wrapperKey}: [...] }`,\n instance_path: '',\n message:\n `${taskName} returned a bare array at the top level. ` +\n `Required: { ${listMeta.wrapperKey}: [...] }. ` +\n `Use ${listMeta.helper}() from @adcp/sdk/server.`,\n };\n }\n\n if (typeof payload !== 'object' || payload === null) return undefined;\n const p = payload as Record<string, unknown>;\n\n if (taskName === 'build_creative') {\n const hasManifest = 'creative_manifest' in p || 'creative_manifests' in p;\n const platformNativeKeys = ['tag_url', 'creative_id', 'media_type', 'tag_type'];\n const platformNativePresent = platformNativeKeys.filter(k => k in p);\n if (!hasManifest && platformNativePresent.length > 0) {\n return {\n kind: 'shape_drift',\n tool: taskName,\n observed_variant: 'platform_native_fields',\n expected_variant: '{ creative_manifest: { format_id, assets } }',\n instance_path: '',\n message:\n `build_creative returned platform-native fields at the top level (${platformNativePresent.join(', ')}). ` +\n `Required: { creative_manifest: { format_id, assets } }. ` +\n `Use buildCreativeResponse() from @adcp/sdk/server.`,\n };\n }\n }\n\n if (taskName === 'sync_creatives') {\n const hasValidWrapper = 'creatives' in p || 'errors' in p || 'task_id' in p;\n const perItemKeys = ['creative_id', 'platform_id', 'action'];\n const perItemPresent = perItemKeys.filter(k => k in p);\n if (!hasValidWrapper && perItemPresent.length > 0) {\n return {\n kind: 'shape_drift',\n tool: taskName,\n observed_variant: 'per_item_shape',\n expected_variant: '{ creatives: [{ creative_id, action, ... }] }',\n instance_path: '',\n message:\n `sync_creatives returned a single creative's inner shape at the top level (${perItemPresent.join(', ')}). ` +\n `Required: { creatives: [{ creative_id, action, ... }] } (or { errors: [...] } / { status: 'submitted', task_id }). ` +\n `Use syncCreativesResponse() from @adcp/sdk/server.`,\n };\n }\n\n const results = p.results;\n if (!hasValidWrapper && Array.isArray(results) && results.length > 0) {\n const firstRow = results[0];\n const looksLikeCreativeRow =\n firstRow != null && typeof firstRow === 'object' && ('creative_id' in firstRow || 'action' in firstRow);\n if (looksLikeCreativeRow) {\n return {\n kind: 'shape_drift',\n tool: taskName,\n observed_variant: 'wrong_wrapper_key',\n expected_variant: '{ creatives: [{ creative_id, action, ... }] }',\n instance_path: '/results',\n message:\n `sync_creatives returned { results: [...] } instead of { creatives: [...] } — wrong wrapper key. ` +\n `Required: { creatives: [{ creative_id, action, ... }] }. ` +\n `Use syncCreativesResponse() from @adcp/sdk/server.`,\n };\n }\n }\n }\n\n if (taskName === 'preview_creative') {\n const hasValidWrapper = 'response_type' in p || 'previews' in p || 'results' in p;\n const rawRenderKeys = ['preview_url', 'preview_html', 'interactive_url'];\n const rawRenderPresent = rawRenderKeys.filter(k => k in p);\n const driftSignal = rawRenderPresent.filter(k => k !== 'interactive_url');\n if (!hasValidWrapper && driftSignal.length > 0) {\n return {\n kind: 'shape_drift',\n tool: taskName,\n observed_variant: 'raw_render_fields',\n expected_variant: \"{ response_type: 'single', previews: [{ renders: [...] }], expires_at }\",\n instance_path: '',\n message:\n `preview_creative returned raw render fields at the top level (${driftSignal.join(', ')}). ` +\n `Required: { response_type: 'single', previews: [{ renders: [{ preview_url | preview_html }] }], expires_at }. ` +\n `Use previewCreativeResponse() from @adcp/sdk/server.`,\n };\n }\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BA,MAAM,qBAA6C;AAAA,EACjD,uBAAuB;AAAA,EACvB,uBAAuB;AAAA,EACvB,6BAA6B;AAAA,EAC7B,sBAAsB;AAAA,EACtB,kBAAkB;AAAA,EAClB,sBAAsB;AAAA,EACtB,oBAAoB;AAAA,EACpB,2BAA2B;AAAA,EAC3B,6BAA6B;AAAA,EAC7B,8BAA8B;AAAA,EAC9B,0BAA0B;AAAA,EAC1B,uBAAuB;AAAA,EACvB,yBAAyB;AAC3B;AAOA,SAAS,eAAe,GAAW,GAAoB;AAErD,QAAM,YAAY,CAAC,MAAc,EAAE,QAAQ,QAAQ,EAAE,EAAE,QAAQ,QAAQ,EAAE;AACzE,QAAM,OAAO,CAAC,MACZ,UAAU,CAAC,EACR,MAAM,GAAG,EACT,IAAI,OAAK,SAAS,GAAG,EAAE,KAAK,CAAC;AAClC,QAAM,CAAC,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC,IAAI,KAAK,CAAC;AAC/C,QAAM,CAAC,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC,IAAI,KAAK,CAAC;AAC/C,MAAI,SAAS,KAAM,QAAO,OAAO;AACjC,MAAI,SAAS,KAAM,QAAO,OAAO;AACjC,SAAO,SAAS;AAClB;AAcO,MAAM,qBAA6E;AAAA,EACxF,gBAAgB,EAAE,YAAY,aAAa,QAAQ,wBAAwB;AAAA,EAC3E,uBAAuB,EAAE,YAAY,WAAW,QAAQ,8BAA8B;AAAA,EACtF,eAAe,EAAE,YAAY,YAAY,QAAQ,uBAAuB;AAAA,EACxE,cAAc,EAAE,YAAY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AAA,UAClB,eAAe;AAAA,UACf,SACE;AAAA,QAGJ;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,MAAI,aAAa,oBAAoB;AACnC,UAAM,kBAAkB,mBAAmB,KAAK,cAAc,KAAK,aAAa;AAChF,UAAM,gBAAgB,CAAC,eAAe,gBAAgB,iBAAiB;AACvE,UAAM,mBAAmB,cAAc,OAAO,OAAK,KAAK,CAAC;AACzD,UAAM,cAAc,iBAAiB,OAAO,OAAK,MAAM,iBAAiB;AACxE,QAAI,CAAC,mBAAmB,YAAY,SAAS,GAAG;AAC9C,aAAO;AAAA,QACL,MAAM;AAAA,QACN,MAAM;AAAA,QACN,kBAAkB;AAAA,QAClB,kBAAkB;AAAA,QAClB,eAAe;AAAA,QACf,SACE,iEAAiE,YAAY,KAAK,IAAI,CAAC;AAAA,MAG3F;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../../src/lib/testing/storyboard/shape-drift-hints.ts"],"sourcesContent":["/**\n * Structured shape-drift hint detection (issue #935).\n *\n * The runner emits one `ShapeDriftHint` per response when it recognizes a\n * common payload-shape mistake — bare arrays from list tools, platform-\n * native fields from `build_creative`, missing wrappers on `sync_creatives`\n * / `preview_creative`. Each hint carries the same prose the legacy\n * `detectShapeDriftHint` returned, plus structured fields (`tool`,\n * `observed_variant`, `expected_variant`, `instance_path`) so renderers\n * (CLI, Addie, JUnit, SARIF) can build per-case fix plans without re-\n * parsing the message.\n *\n * The string-only `detectShapeDriftHint` in `validations.ts` is a thin\n * shim over this detector — kept so existing unit tests and external\n * callers keep working, but the canonical path is structured.\n *\n * Fires unconditionally (regardless of step pass/fail) — same gate as\n * `ValidationResult.warning` carried previously. The caller (`runner.ts`)\n * merges the result into `StoryboardStepResult.hints[]`.\n */\nimport type { ShapeDriftHint } from './types';\n\n/**\n * Minimum @adcp/client version in which each server-side helper first shipped.\n * Used to suffix shape-drift hints when the agent reports an older SDK version.\n * Keys match the helper name referenced in the hint `message`.\n */\nconst HELPER_MIN_VERSION: Record<string, string> = {\n legacyBuildCreativeResponse: '13.0.0',\n legacyListCreativesResponse: '13.0.0',\n legacyListCreativeFormatsResponse: '13.0.0',\n legacyListAccountsResponse: '13.0.0',\n legacyProductsResponse: '13.0.0',\n legacyGetMediaBuysResponse: '13.0.0',\n legacyGetSignalsResponse: '13.0.0',\n legacyListPropertyListsResponse: '13.0.0',\n legacyListCollectionListsResponse: '13.0.0',\n legacyListContentStandardsResponse: '13.0.0',\n legacyGetPlanAuditLogsResponse: '13.0.0',\n legacySyncCreativesResponse: '13.0.0',\n legacyPreviewCreativeResponse: '13.0.0',\n};\n\n/**\n * Compare two semver strings using numeric segment ordering.\n * Returns true when `a` is strictly less than `b`.\n * Handles `@adcp/client@X.Y.Z` format by stripping the package prefix.\n */\nfunction semverLessThan(a: string, b: string): boolean {\n // Strip package prefix (e.g. \"@adcp/client@\") and pre-release suffix (e.g. \"-beta.1\")\n const normalize = (v: string) => v.replace(/^.*@/, '').replace(/-.*$/, '');\n const segs = (v: string) =>\n normalize(v)\n .split('.')\n .map(s => parseInt(s, 10) || 0);\n const [aMaj = 0, aMin = 0, aPatch = 0] = segs(a);\n const [bMaj = 0, bMin = 0, bPatch = 0] = segs(b);\n if (aMaj !== bMaj) return aMaj < bMaj;\n if (aMin !== bMin) return aMin < bMin;\n return aPatch < bPatch;\n}\n\n/**\n * List-shaped tools where handlers commonly return the bare inner array\n * (`[{...}]`) at the top level instead of wrapping it in the required\n * object envelope. Each entry names the wrapper key and the response\n * helper that builds the correct shape.\n *\n * Helper names aren't uniformly prefixed — `get_products` uses\n * `legacyProductsResponse` (no `get` prefix) while `get_media_buys` uses\n * `legacyGetMediaBuysResponse`. Names match the explicit compatibility\n * aliases on `@adcp/sdk/server`.\n */\nexport const LIST_WRAPPER_TOOLS: Record<string, { wrapperKey: string; helper: string }> = {\n list_creatives: { wrapperKey: 'creatives', helper: 'legacyListCreativesResponse' },\n list_creative_formats: { wrapperKey: 'formats', helper: 'legacyListCreativeFormatsResponse' },\n list_accounts: { wrapperKey: 'accounts', helper: 'legacyListAccountsResponse' },\n get_products: { wrapperKey: 'products', helper: 'legacyProductsResponse' },\n get_media_buys: { wrapperKey: 'media_buys', helper: 'legacyGetMediaBuysResponse' },\n get_signals: { wrapperKey: 'signals', helper: 'legacyGetSignalsResponse' },\n list_property_lists: { wrapperKey: 'lists', helper: 'legacyListPropertyListsResponse' },\n list_collection_lists: { wrapperKey: 'lists', helper: 'legacyListCollectionListsResponse' },\n list_content_standards: { wrapperKey: 'standards', helper: 'legacyListContentStandardsResponse' },\n get_plan_audit_logs: { wrapperKey: 'plans', helper: 'legacyGetPlanAuditLogsResponse' },\n};\n\n/**\n * Detect shape-drift and return the structured hints that apply (zero or\n * one — the detector emits at most one hint per response, but returns an\n * array so callers can spread it into `step.hints[]` without a guard).\n *\n * @param taskName — tool name (snake_case) the storyboard dispatched under\n * @param payload — raw response payload, after the runner's `_message`\n * pre-strip. `unknown` rather than `Record<string, unknown>` so bare-\n * array payloads are recognizable at the top level; object branches\n * guard internally.\n * @param libraryVersion — optional SDK version string the agent self-reported\n * in `get_adcp_capabilities` (e.g. `\"@adcp/client@4.16.2\"`). When present\n * and below the helper's minimum version, the hint message is suffixed with\n * an upgrade note so developers know to update their SDK dep.\n */\nexport function detectShapeDriftHints(taskName: string, payload: unknown, libraryVersion?: string): ShapeDriftHint[] {\n const hint = detect(taskName, payload);\n if (!hint) return [];\n if (libraryVersion) hint.message = appendVersionSuffix(hint.message, libraryVersion);\n return [hint];\n}\n\n/**\n * If the hint message references a helper that requires a minimum SDK\n * version and the agent's reported version is below it, append an upgrade\n * note to the message. Returns the message unchanged if no version data or\n * no match.\n */\nfunction appendVersionSuffix(message: string, libraryVersion: string): string {\n // Skip non-numeric version strings (e.g. \"local-dev\") to avoid spurious suffixes\n const stripped = libraryVersion.replace(/^.*@/, '').replace(/-.*$/, '');\n if (!/^\\d+\\.\\d+/.test(stripped)) return message;\n for (const [helper, minVersion] of Object.entries(HELPER_MIN_VERSION)) {\n if (message.includes(helper) && semverLessThan(libraryVersion, minVersion)) {\n return (\n message +\n ` (Note: your agent reports ${libraryVersion} — ${helper}() ships in @adcp/client ≥${minVersion}. Upgrade your SDK dep.)`\n );\n }\n }\n return message;\n}\n\nfunction detect(taskName: string, payload: unknown): ShapeDriftHint | undefined {\n if (Array.isArray(payload)) {\n const listMeta = LIST_WRAPPER_TOOLS[taskName];\n if (!listMeta) return undefined;\n return {\n kind: 'shape_drift',\n tool: taskName,\n observed_variant: 'bare_array',\n expected_variant: `{ ${listMeta.wrapperKey}: [...] }`,\n instance_path: '',\n message:\n `${taskName} returned a bare array at the top level. ` +\n `Required: { ${listMeta.wrapperKey}: [...] }. ` +\n `Use ${listMeta.helper}() from @adcp/sdk/server.`,\n };\n }\n\n if (typeof payload !== 'object' || payload === null) return undefined;\n const p = payload as Record<string, unknown>;\n\n if (taskName === 'build_creative') {\n const hasManifest = 'creative_manifest' in p || 'creative_manifests' in p;\n const platformNativeKeys = ['tag_url', 'creative_id', 'media_type', 'tag_type'];\n const platformNativePresent = platformNativeKeys.filter(k => k in p);\n if (!hasManifest && platformNativePresent.length > 0) {\n return {\n kind: 'shape_drift',\n tool: taskName,\n observed_variant: 'platform_native_fields',\n expected_variant: '{ creative_manifest: { format_id, assets } }',\n instance_path: '',\n message:\n `build_creative returned platform-native fields at the top level (${platformNativePresent.join(', ')}). ` +\n `Required: { creative_manifest: { format_id, assets } }. ` +\n `Use legacyBuildCreativeResponse() from @adcp/sdk/server.`,\n };\n }\n }\n\n if (taskName === 'sync_creatives') {\n const hasValidWrapper = 'creatives' in p || 'errors' in p || 'task_id' in p;\n const perItemKeys = ['creative_id', 'platform_id', 'action'];\n const perItemPresent = perItemKeys.filter(k => k in p);\n if (!hasValidWrapper && perItemPresent.length > 0) {\n return {\n kind: 'shape_drift',\n tool: taskName,\n observed_variant: 'per_item_shape',\n expected_variant: '{ creatives: [{ creative_id, action, ... }] }',\n instance_path: '',\n message:\n `sync_creatives returned a single creative's inner shape at the top level (${perItemPresent.join(', ')}). ` +\n `Required: { creatives: [{ creative_id, action, ... }] } (or { errors: [...] } / { status: 'submitted', task_id }). ` +\n `Use legacySyncCreativesResponse() from @adcp/sdk/server.`,\n };\n }\n\n const results = p.results;\n if (!hasValidWrapper && Array.isArray(results) && results.length > 0) {\n const firstRow = results[0];\n const looksLikeCreativeRow =\n firstRow != null && typeof firstRow === 'object' && ('creative_id' in firstRow || 'action' in firstRow);\n if (looksLikeCreativeRow) {\n return {\n kind: 'shape_drift',\n tool: taskName,\n observed_variant: 'wrong_wrapper_key',\n expected_variant: '{ creatives: [{ creative_id, action, ... }] }',\n instance_path: '/results',\n message:\n `sync_creatives returned { results: [...] } instead of { creatives: [...] } — wrong wrapper key. ` +\n `Required: { creatives: [{ creative_id, action, ... }] }. ` +\n `Use legacySyncCreativesResponse() from @adcp/sdk/server.`,\n };\n }\n }\n }\n\n if (taskName === 'preview_creative') {\n const hasValidWrapper = 'response_type' in p || 'previews' in p || 'results' in p;\n const rawRenderKeys = ['preview_url', 'preview_html', 'interactive_url'];\n const rawRenderPresent = rawRenderKeys.filter(k => k in p);\n const driftSignal = rawRenderPresent.filter(k => k !== 'interactive_url');\n if (!hasValidWrapper && driftSignal.length > 0) {\n return {\n kind: 'shape_drift',\n tool: taskName,\n observed_variant: 'raw_render_fields',\n expected_variant: \"{ response_type: 'single', previews: [{ renders: [...] }], expires_at }\",\n instance_path: '',\n message:\n `preview_creative returned raw render fields at the top level (${driftSignal.join(', ')}). ` +\n `Required: { response_type: 'single', previews: [{ renders: [{ preview_url | preview_html }] }], expires_at }. ` +\n `Use legacyPreviewCreativeResponse() from @adcp/sdk/server.`,\n };\n }\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BA,MAAM,qBAA6C;AAAA,EACjD,6BAA6B;AAAA,EAC7B,6BAA6B;AAAA,EA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BAAmB,YAAY,SAAS,GAAG;AAC9C,aAAO;AAAA,QACL,MAAM;AAAA,QACN,MAAM;AAAA,QACN,kBAAkB;AAAA,QAClB,kBAAkB;AAAA,QAClB,eAAe;AAAA,QACf,SACE,iEAAiE,YAAY,KAAK,IAAI,CAAC;AAAA,MAG3F;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -1,17 +1,17 @@
1
1
  const HELPER_MIN_VERSION = {
2
- buildCreativeResponse: "5.14.0",
3
- listCreativesResponse: "5.10.0",
4
- listCreativeFormatsResponse: "5.10.0",
5
- listAccountsResponse: "5.10.0",
6
- productsResponse: "5.10.0",
7
- getMediaBuysResponse: "5.10.0",
8
- getSignalsResponse: "5.10.0",
9
- listPropertyListsResponse: "5.10.0",
10
- listCollectionListsResponse: "5.10.0",
11
- listContentStandardsResponse: "5.10.0",
12
- getPlanAuditLogsResponse: "5.10.0",
13
- syncCreativesResponse: "5.10.0",
14
- previewCreativeResponse: "5.10.0"
2
+ legacyBuildCreativeResponse: "13.0.0",
3
+ legacyListCreativesResponse: "13.0.0",
4
+ legacyListCreativeFormatsResponse: "13.0.0",
5
+ legacyListAccountsResponse: "13.0.0",
6
+ legacyProductsResponse: "13.0.0",
7
+ legacyGetMediaBuysResponse: "13.0.0",
8
+ legacyGetSignalsResponse: "13.0.0",
9
+ legacyListPropertyListsResponse: "13.0.0",
10
+ legacyListCollectionListsResponse: "13.0.0",
11
+ legacyListContentStandardsResponse: "13.0.0",
12
+ legacyGetPlanAuditLogsResponse: "13.0.0",
13
+ legacySyncCreativesResponse: "13.0.0",
14
+ legacyPreviewCreativeResponse: "13.0.0"
15
15
  };
16
16
  function semverLessThan(a, b) {
17
17
  const normalize = (v) => v.replace(/^.*@/, "").replace(/-.*$/, "");
@@ -23,16 +23,16 @@ function semverLessThan(a, b) {
23
23
  return aPatch < bPatch;
24
24
  }
25
25
  const LIST_WRAPPER_TOOLS = {
26
- list_creatives: { wrapperKey: "creatives", helper: "listCreativesResponse" },
27
- list_creative_formats: { wrapperKey: "formats", helper: "listCreativeFormatsResponse" },
28
- list_accounts: { wrapperKey: "accounts", helper: "listAccountsResponse" },
29
- get_products: { wrapperKey: "products", helper: "productsResponse" },
30
- get_media_buys: { wrapperKey: "media_buys", helper: "getMediaBuysResponse" },
31
- get_signals: { wrapperKey: "signals", helper: "getSignalsResponse" },
32
- list_property_lists: { wrapperKey: "lists", helper: "listPropertyListsResponse" },
33
- list_collection_lists: { wrapperKey: "lists", helper: "listCollectionListsResponse" },
34
- list_content_standards: { wrapperKey: "standards", helper: "listContentStandardsResponse" },
35
- get_plan_audit_logs: { wrapperKey: "plans", helper: "getPlanAuditLogsResponse" }
26
+ list_creatives: { wrapperKey: "creatives", helper: "legacyListCreativesResponse" },
27
+ list_creative_formats: { wrapperKey: "formats", helper: "legacyListCreativeFormatsResponse" },
28
+ list_accounts: { wrapperKey: "accounts", helper: "legacyListAccountsResponse" },
29
+ get_products: { wrapperKey: "products", helper: "legacyProductsResponse" },
30
+ get_media_buys: { wrapperKey: "media_buys", helper: "legacyGetMediaBuysResponse" },
31
+ get_signals: { wrapperKey: "signals", helper: "legacyGetSignalsResponse" },
32
+ list_property_lists: { wrapperKey: "lists", helper: "legacyListPropertyListsResponse" },
33
+ list_collection_lists: { wrapperKey: "lists", helper: "legacyListCollectionListsResponse" },
34
+ list_content_standards: { wrapperKey: "standards", helper: "legacyListContentStandardsResponse" },
35
+ get_plan_audit_logs: { wrapperKey: "plans", helper: "legacyGetPlanAuditLogsResponse" }
36
36
  };
37
37
  function detectShapeDriftHints(taskName, payload, libraryVersion) {
38
38
  const hint = detect(taskName, payload);
@@ -76,7 +76,7 @@ function detect(taskName, payload) {
76
76
  observed_variant: "platform_native_fields",
77
77
  expected_variant: "{ creative_manifest: { format_id, assets } }",
78
78
  instance_path: "",
79
- message: `build_creative returned platform-native fields at the top level (${platformNativePresent.join(", ")}). Required: { creative_manifest: { format_id, assets } }. Use buildCreativeResponse() from @adcp/sdk/server.`
79
+ message: `build_creative returned platform-native fields at the top level (${platformNativePresent.join(", ")}). Required: { creative_manifest: { format_id, assets } }. Use legacyBuildCreativeResponse() from @adcp/sdk/server.`
80
80
  };
81
81
  }
82
82
  }
@@ -91,7 +91,7 @@ function detect(taskName, payload) {
91
91
  observed_variant: "per_item_shape",
92
92
  expected_variant: "{ creatives: [{ creative_id, action, ... }] }",
93
93
  instance_path: "",
94
- message: `sync_creatives returned a single creative's inner shape at the top level (${perItemPresent.join(", ")}). Required: { creatives: [{ creative_id, action, ... }] } (or { errors: [...] } / { status: 'submitted', task_id }). Use syncCreativesResponse() from @adcp/sdk/server.`
94
+ message: `sync_creatives returned a single creative's inner shape at the top level (${perItemPresent.join(", ")}). Required: { creatives: [{ creative_id, action, ... }] } (or { errors: [...] } / { status: 'submitted', task_id }). Use legacySyncCreativesResponse() from @adcp/sdk/server.`
95
95
  };
96
96
  }
97
97
  const results = p.results;
@@ -105,7 +105,7 @@ function detect(taskName, payload) {
105
105
  observed_variant: "wrong_wrapper_key",
106
106
  expected_variant: "{ creatives: [{ creative_id, action, ... }] }",
107
107
  instance_path: "/results",
108
- message: `sync_creatives returned { results: [...] } instead of { creatives: [...] } \u2014 wrong wrapper key. Required: { creatives: [{ creative_id, action, ... }] }. Use syncCreativesResponse() from @adcp/sdk/server.`
108
+ message: `sync_creatives returned { results: [...] } instead of { creatives: [...] } \u2014 wrong wrapper key. Required: { creatives: [{ creative_id, action, ... }] }. Use legacySyncCreativesResponse() from @adcp/sdk/server.`
109
109
  };
110
110
  }
111
111
  }
@@ -122,7 +122,7 @@ function detect(taskName, payload) {
122
122
  observed_variant: "raw_render_fields",
123
123
  expected_variant: "{ response_type: 'single', previews: [{ renders: [...] }], expires_at }",
124
124
  instance_path: "",
125
- message: `preview_creative returned raw render fields at the top level (${driftSignal.join(", ")}). Required: { response_type: 'single', previews: [{ renders: [{ preview_url | preview_html }] }], expires_at }. Use previewCreativeResponse() from @adcp/sdk/server.`
125
+ message: `preview_creative returned raw render fields at the top level (${driftSignal.join(", ")}). Required: { response_type: 'single', previews: [{ renders: [{ preview_url | preview_html }] }], expires_at }. Use legacyPreviewCreativeResponse() from @adcp/sdk/server.`
126
126
  };
127
127
  }
128
128
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/testing/storyboard/shape-drift-hints.ts"],"sourcesContent":["/**\n * Structured shape-drift hint detection (issue #935).\n *\n * The runner emits one `ShapeDriftHint` per response when it recognizes a\n * common payload-shape mistake — bare arrays from list tools, platform-\n * native fields from `build_creative`, missing wrappers on `sync_creatives`\n * / `preview_creative`. Each hint carries the same prose the legacy\n * `detectShapeDriftHint` returned, plus structured fields (`tool`,\n * `observed_variant`, `expected_variant`, `instance_path`) so renderers\n * (CLI, Addie, JUnit, SARIF) can build per-case fix plans without re-\n * parsing the message.\n *\n * The string-only `detectShapeDriftHint` in `validations.ts` is a thin\n * shim over this detector — kept so existing unit tests and external\n * callers keep working, but the canonical path is structured.\n *\n * Fires unconditionally (regardless of step pass/fail) — same gate as\n * `ValidationResult.warning` carried previously. The caller (`runner.ts`)\n * merges the result into `StoryboardStepResult.hints[]`.\n */\nimport type { ShapeDriftHint } from './types';\n\n/**\n * Minimum @adcp/client version in which each server-side helper first shipped.\n * Used to suffix shape-drift hints when the agent reports an older SDK version.\n * Keys match the helper name referenced in the hint `message`.\n */\nconst HELPER_MIN_VERSION: Record<string, string> = {\n buildCreativeResponse: '5.14.0',\n listCreativesResponse: '5.10.0',\n listCreativeFormatsResponse: '5.10.0',\n listAccountsResponse: '5.10.0',\n productsResponse: '5.10.0',\n getMediaBuysResponse: '5.10.0',\n getSignalsResponse: '5.10.0',\n listPropertyListsResponse: '5.10.0',\n listCollectionListsResponse: '5.10.0',\n listContentStandardsResponse: '5.10.0',\n getPlanAuditLogsResponse: '5.10.0',\n syncCreativesResponse: '5.10.0',\n previewCreativeResponse: '5.10.0',\n};\n\n/**\n * Compare two semver strings using numeric segment ordering.\n * Returns true when `a` is strictly less than `b`.\n * Handles `@adcp/client@X.Y.Z` format by stripping the package prefix.\n */\nfunction semverLessThan(a: string, b: string): boolean {\n // Strip package prefix (e.g. \"@adcp/client@\") and pre-release suffix (e.g. \"-beta.1\")\n const normalize = (v: string) => v.replace(/^.*@/, '').replace(/-.*$/, '');\n const segs = (v: string) =>\n normalize(v)\n .split('.')\n .map(s => parseInt(s, 10) || 0);\n const [aMaj = 0, aMin = 0, aPatch = 0] = segs(a);\n const [bMaj = 0, bMin = 0, bPatch = 0] = segs(b);\n if (aMaj !== bMaj) return aMaj < bMaj;\n if (aMin !== bMin) return aMin < bMin;\n return aPatch < bPatch;\n}\n\n/**\n * List-shaped tools where handlers commonly return the bare inner array\n * (`[{...}]`) at the top level instead of wrapping it in the required\n * object envelope. Each entry names the wrapper key and the response\n * helper that builds the correct shape.\n *\n * Helper names aren't uniformly prefixed — `get_products` uses\n * `productsResponse` (no `get` prefix) while `get_media_buys` uses\n * `getMediaBuysResponse`. Names match the exports in\n * `src/lib/server/responses.ts` verbatim so a developer can grep\n * straight from the hint.\n */\nexport const LIST_WRAPPER_TOOLS: Record<string, { wrapperKey: string; helper: string }> = {\n list_creatives: { wrapperKey: 'creatives', helper: 'listCreativesResponse' },\n list_creative_formats: { wrapperKey: 'formats', helper: 'listCreativeFormatsResponse' },\n list_accounts: { wrapperKey: 'accounts', helper: 'listAccountsResponse' },\n get_products: { wrapperKey: 'products', helper: 'productsResponse' },\n get_media_buys: { wrapperKey: 'media_buys', helper: 'getMediaBuysResponse' },\n get_signals: { wrapperKey: 'signals', helper: 'getSignalsResponse' },\n list_property_lists: { wrapperKey: 'lists', helper: 'listPropertyListsResponse' },\n list_collection_lists: { wrapperKey: 'lists', helper: 'listCollectionListsResponse' },\n list_content_standards: { wrapperKey: 'standards', helper: 'listContentStandardsResponse' },\n get_plan_audit_logs: { wrapperKey: 'plans', helper: 'getPlanAuditLogsResponse' },\n};\n\n/**\n * Detect shape-drift and return the structured hints that apply (zero or\n * one — the detector emits at most one hint per response, but returns an\n * array so callers can spread it into `step.hints[]` without a guard).\n *\n * @param taskName — tool name (snake_case) the storyboard dispatched under\n * @param payload — raw response payload, after the runner's `_message`\n * pre-strip. `unknown` rather than `Record<string, unknown>` so bare-\n * array payloads are recognizable at the top level; object branches\n * guard internally.\n * @param libraryVersion — optional SDK version string the agent self-reported\n * in `get_adcp_capabilities` (e.g. `\"@adcp/client@4.16.2\"`). When present\n * and below the helper's minimum version, the hint message is suffixed with\n * an upgrade note so developers know to update their SDK dep.\n */\nexport function detectShapeDriftHints(taskName: string, payload: unknown, libraryVersion?: string): ShapeDriftHint[] {\n const hint = detect(taskName, payload);\n if (!hint) return [];\n if (libraryVersion) hint.message = appendVersionSuffix(hint.message, libraryVersion);\n return [hint];\n}\n\n/**\n * If the hint message references a helper that requires a minimum SDK\n * version and the agent's reported version is below it, append an upgrade\n * note to the message. Returns the message unchanged if no version data or\n * no match.\n */\nfunction appendVersionSuffix(message: string, libraryVersion: string): string {\n // Skip non-numeric version strings (e.g. \"local-dev\") to avoid spurious suffixes\n const stripped = libraryVersion.replace(/^.*@/, '').replace(/-.*$/, '');\n if (!/^\\d+\\.\\d+/.test(stripped)) return message;\n for (const [helper, minVersion] of Object.entries(HELPER_MIN_VERSION)) {\n if (message.includes(helper) && semverLessThan(libraryVersion, minVersion)) {\n return (\n message +\n ` (Note: your agent reports ${libraryVersion} — ${helper}() ships in @adcp/client ≥${minVersion}. Upgrade your SDK dep.)`\n );\n }\n }\n return message;\n}\n\nfunction detect(taskName: string, payload: unknown): ShapeDriftHint | undefined {\n if (Array.isArray(payload)) {\n const listMeta = LIST_WRAPPER_TOOLS[taskName];\n if (!listMeta) return undefined;\n return {\n kind: 'shape_drift',\n tool: taskName,\n observed_variant: 'bare_array',\n expected_variant: `{ ${listMeta.wrapperKey}: [...] }`,\n instance_path: '',\n message:\n `${taskName} returned a bare array at the top level. ` +\n `Required: { ${listMeta.wrapperKey}: [...] }. ` +\n `Use ${listMeta.helper}() from @adcp/sdk/server.`,\n };\n }\n\n if (typeof payload !== 'object' || payload === null) return undefined;\n const p = payload as Record<string, unknown>;\n\n if (taskName === 'build_creative') {\n const hasManifest = 'creative_manifest' in p || 'creative_manifests' in p;\n const platformNativeKeys = ['tag_url', 'creative_id', 'media_type', 'tag_type'];\n const platformNativePresent = platformNativeKeys.filter(k => k in p);\n if (!hasManifest && platformNativePresent.length > 0) {\n return {\n kind: 'shape_drift',\n tool: taskName,\n observed_variant: 'platform_native_fields',\n expected_variant: '{ creative_manifest: { format_id, assets } }',\n instance_path: '',\n message:\n `build_creative returned platform-native fields at the top level (${platformNativePresent.join(', ')}). ` +\n `Required: { creative_manifest: { format_id, assets } }. ` +\n `Use buildCreativeResponse() from @adcp/sdk/server.`,\n };\n }\n }\n\n if (taskName === 'sync_creatives') {\n const hasValidWrapper = 'creatives' in p || 'errors' in p || 'task_id' in p;\n const perItemKeys = ['creative_id', 'platform_id', 'action'];\n const perItemPresent = perItemKeys.filter(k => k in p);\n if (!hasValidWrapper && perItemPresent.length > 0) {\n return {\n kind: 'shape_drift',\n tool: taskName,\n observed_variant: 'per_item_shape',\n expected_variant: '{ creatives: [{ creative_id, action, ... }] }',\n instance_path: '',\n message:\n `sync_creatives returned a single creative's inner shape at the top level (${perItemPresent.join(', ')}). ` +\n `Required: { creatives: [{ creative_id, action, ... }] } (or { errors: [...] } / { status: 'submitted', task_id }). ` +\n `Use syncCreativesResponse() from @adcp/sdk/server.`,\n };\n }\n\n const results = p.results;\n if (!hasValidWrapper && Array.isArray(results) && results.length > 0) {\n const firstRow = results[0];\n const looksLikeCreativeRow =\n firstRow != null && typeof firstRow === 'object' && ('creative_id' in firstRow || 'action' in firstRow);\n if (looksLikeCreativeRow) {\n return {\n kind: 'shape_drift',\n tool: taskName,\n observed_variant: 'wrong_wrapper_key',\n expected_variant: '{ creatives: [{ creative_id, action, ... }] }',\n instance_path: '/results',\n message:\n `sync_creatives returned { results: [...] } instead of { creatives: [...] } — wrong wrapper key. ` +\n `Required: { creatives: [{ creative_id, action, ... }] }. ` +\n `Use syncCreativesResponse() from @adcp/sdk/server.`,\n };\n }\n }\n }\n\n if (taskName === 'preview_creative') {\n const hasValidWrapper = 'response_type' in p || 'previews' in p || 'results' in p;\n const rawRenderKeys = ['preview_url', 'preview_html', 'interactive_url'];\n const rawRenderPresent = rawRenderKeys.filter(k => k in p);\n const driftSignal = rawRenderPresent.filter(k => k !== 'interactive_url');\n if (!hasValidWrapper && driftSignal.length > 0) {\n return {\n kind: 'shape_drift',\n tool: taskName,\n observed_variant: 'raw_render_fields',\n expected_variant: \"{ response_type: 'single', previews: [{ renders: [...] }], expires_at }\",\n instance_path: '',\n message:\n `preview_creative returned raw render fields at the top level (${driftSignal.join(', ')}). ` +\n `Required: { response_type: 'single', previews: [{ renders: [{ preview_url | preview_html }] }], expires_at }. ` +\n `Use previewCreativeResponse() from @adcp/sdk/server.`,\n };\n }\n }\n\n return undefined;\n}\n"],"mappings":"AA2BA,MAAM,qBAA6C;AAAA,EACjD,uBAAuB;AAAA,EACvB,uBAAuB;AAAA,EACvB,6BAA6B;AAAA,EAC7B,sBAAsB;AAAA,EACtB,kBAAkB;AAAA,EAClB,sBAAsB;AAAA,EACtB,oBAAoB;AAAA,EACpB,2BAA2B;AAAA,EAC3B,6BAA6B;AAAA,EAC7B,8BAA8B;AAAA,EAC9B,0BAA0B;AAAA,EAC1B,uBAAuB;AAAA,EACvB,yBAAyB;AAC3B;AAOA,SAAS,eAAe,GAAW,GAAoB;AAErD,QAAM,YAAY,CAAC,MAAc,EAAE,QAAQ,QAAQ,EAAE,EAAE,QAAQ,QAAQ,EAAE;AACzE,QAAM,OAAO,CAAC,MACZ,UAAU,CAAC,EACR,MAAM,GAAG,EACT,IAAI,OAAK,SAAS,GAAG,EAAE,KAAK,CAAC;AAClC,QAAM,CAAC,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC,IAAI,KAAK,CAAC;AAC/C,QAAM,CAAC,OAAO,GAAG,OAAO,GAAG,SAAS,CA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AAAA,MAG1G;AAAA,IACF;AAEA,UAAM,UAAU,EAAE;AAClB,QAAI,CAAC,mBAAmB,MAAM,QAAQ,OAAO,KAAK,QAAQ,SAAS,GAAG;AACpE,YAAM,WAAW,QAAQ,CAAC;AAC1B,YAAM,uBACJ,YAAY,QAAQ,OAAO,aAAa,aAAa,iBAAiB,YAAY,YAAY;AAChG,UAAI,sBAAsB;AACxB,eAAO;AAAA,UACL,MAAM;AAAA,UACN,MAAM;AAAA,UACN,kBAAkB;AAAA,UAClB,kBAAkB;AAAA,UAClB,eAAe;AAAA,UACf,SACE;AAAA,QAGJ;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,MAAI,aAAa,oBAAoB;AACnC,UAAM,kBAAkB,mBAAmB,KAAK,cAAc,KAAK,aAAa;AAChF,UAAM,gBAAgB,CAAC,eAAe,gBAAgB,iBAAiB;AACvE,UAAM,mBAAmB,cAAc,OAAO,OAAK,KAAK,CAAC;AACzD,UAAM,cAAc,iBAAiB,OAAO,OAAK,MAAM,iBAAiB;AACxE,QAAI,CAAC,mBAAmB,YAAY,SAAS,GAAG;AAC9C,aAAO;AAAA,QACL,MAAM;AAAA,QACN,MAAM;AAAA,QACN,kBAAkB;AAAA,QAClB,kBAAkB;AAAA,QAClB,eAAe;AAAA,QACf,SACE,iEAAiE,YAAY,KAAK,IAAI,CAAC;AAAA,MAG3F;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../../src/lib/testing/storyboard/shape-drift-hints.ts"],"sourcesContent":["/**\n * Structured shape-drift hint detection (issue #935).\n *\n * The runner emits one `ShapeDriftHint` per response when it recognizes a\n * common payload-shape mistake — bare arrays from list tools, platform-\n * native fields from `build_creative`, missing wrappers on `sync_creatives`\n * / `preview_creative`. Each hint carries the same prose the legacy\n * `detectShapeDriftHint` returned, plus structured fields (`tool`,\n * `observed_variant`, `expected_variant`, `instance_path`) so renderers\n * (CLI, Addie, JUnit, SARIF) can build per-case fix plans without re-\n * parsing the message.\n *\n * The string-only `detectShapeDriftHint` in `validations.ts` is a thin\n * shim over this detector — kept so existing unit tests and external\n * callers keep working, but the canonical path is structured.\n *\n * Fires unconditionally (regardless of step pass/fail) — same gate as\n * `ValidationResult.warning` carried previously. The caller (`runner.ts`)\n * merges the result into `StoryboardStepResult.hints[]`.\n */\nimport type { ShapeDriftHint } from './types';\n\n/**\n * Minimum @adcp/client version in which each server-side helper first shipped.\n * Used to suffix shape-drift hints when the agent reports an older SDK version.\n * Keys match the helper name referenced in the hint `message`.\n */\nconst HELPER_MIN_VERSION: Record<string, string> = {\n legacyBuildCreativeResponse: '13.0.0',\n legacyListCreativesResponse: '13.0.0',\n legacyListCreativeFormatsResponse: '13.0.0',\n legacyListAccountsResponse: '13.0.0',\n legacyProductsResponse: '13.0.0',\n legacyGetMediaBuysResponse: '13.0.0',\n legacyGetSignalsResponse: '13.0.0',\n legacyListPropertyListsResponse: '13.0.0',\n legacyListCollectionListsResponse: '13.0.0',\n legacyListContentStandardsResponse: '13.0.0',\n legacyGetPlanAuditLogsResponse: '13.0.0',\n legacySyncCreativesResponse: '13.0.0',\n legacyPreviewCreativeResponse: '13.0.0',\n};\n\n/**\n * Compare two semver strings using numeric segment ordering.\n * Returns true when `a` is strictly less than `b`.\n * Handles `@adcp/client@X.Y.Z` format by stripping the package prefix.\n */\nfunction semverLessThan(a: string, b: string): boolean {\n // Strip package prefix (e.g. \"@adcp/client@\") and pre-release suffix (e.g. \"-beta.1\")\n const normalize = (v: string) => v.replace(/^.*@/, '').replace(/-.*$/, '');\n const segs = (v: string) =>\n normalize(v)\n .split('.')\n .map(s => parseInt(s, 10) || 0);\n const [aMaj = 0, aMin = 0, aPatch = 0] = segs(a);\n const [bMaj = 0, bMin = 0, bPatch = 0] = segs(b);\n if (aMaj !== bMaj) return aMaj < bMaj;\n if (aMin !== bMin) return aMin < bMin;\n return aPatch < bPatch;\n}\n\n/**\n * List-shaped tools where handlers commonly return the bare inner array\n * (`[{...}]`) at the top level instead of wrapping it in the required\n * object envelope. Each entry names the wrapper key and the response\n * helper that builds the correct shape.\n *\n * Helper names aren't uniformly prefixed — `get_products` uses\n * `legacyProductsResponse` (no `get` prefix) while `get_media_buys` uses\n * `legacyGetMediaBuysResponse`. Names match the explicit compatibility\n * aliases on `@adcp/sdk/server`.\n */\nexport const LIST_WRAPPER_TOOLS: Record<string, { wrapperKey: string; helper: string }> = {\n list_creatives: { wrapperKey: 'creatives', helper: 'legacyListCreativesResponse' },\n list_creative_formats: { wrapperKey: 'formats', helper: 'legacyListCreativeFormatsResponse' },\n list_accounts: { wrapperKey: 'accounts', helper: 'legacyListAccountsResponse' },\n get_products: { wrapperKey: 'products', helper: 'legacyProductsResponse' },\n get_media_buys: { wrapperKey: 'media_buys', helper: 'legacyGetMediaBuysResponse' },\n get_signals: { wrapperKey: 'signals', helper: 'legacyGetSignalsResponse' },\n list_property_lists: { wrapperKey: 'lists', helper: 'legacyListPropertyListsResponse' },\n list_collection_lists: { wrapperKey: 'lists', helper: 'legacyListCollectionListsResponse' },\n list_content_standards: { wrapperKey: 'standards', helper: 'legacyListContentStandardsResponse' },\n get_plan_audit_logs: { wrapperKey: 'plans', helper: 'legacyGetPlanAuditLogsResponse' },\n};\n\n/**\n * Detect shape-drift and return the structured hints that apply (zero or\n * one — the detector emits at most one hint per response, but returns an\n * array so callers can spread it into `step.hints[]` without a guard).\n *\n * @param taskName — tool name (snake_case) the storyboard dispatched under\n * @param payload — raw response payload, after the runner's `_message`\n * pre-strip. `unknown` rather than `Record<string, unknown>` so bare-\n * array payloads are recognizable at the top level; object branches\n * guard internally.\n * @param libraryVersion — optional SDK version string the agent self-reported\n * in `get_adcp_capabilities` (e.g. `\"@adcp/client@4.16.2\"`). When present\n * and below the helper's minimum version, the hint message is suffixed with\n * an upgrade note so developers know to update their SDK dep.\n */\nexport function detectShapeDriftHints(taskName: string, payload: unknown, libraryVersion?: string): ShapeDriftHint[] {\n const hint = detect(taskName, payload);\n if (!hint) return [];\n if (libraryVersion) hint.message = appendVersionSuffix(hint.message, libraryVersion);\n return [hint];\n}\n\n/**\n * If the hint message references a helper that requires a minimum SDK\n * version and the agent's reported version is below it, append an upgrade\n * note to the message. Returns the message unchanged if no version data or\n * no match.\n */\nfunction appendVersionSuffix(message: string, libraryVersion: string): string {\n // Skip non-numeric version strings (e.g. \"local-dev\") to avoid spurious suffixes\n const stripped = libraryVersion.replace(/^.*@/, '').replace(/-.*$/, '');\n if (!/^\\d+\\.\\d+/.test(stripped)) return message;\n for (const [helper, minVersion] of Object.entries(HELPER_MIN_VERSION)) {\n if (message.includes(helper) && semverLessThan(libraryVersion, minVersion)) {\n return (\n message +\n ` (Note: your agent reports ${libraryVersion} — ${helper}() ships in @adcp/client ≥${minVersion}. Upgrade your SDK dep.)`\n );\n }\n }\n return message;\n}\n\nfunction detect(taskName: string, payload: unknown): ShapeDriftHint | undefined {\n if (Array.isArray(payload)) {\n const listMeta = LIST_WRAPPER_TOOLS[taskName];\n if (!listMeta) return undefined;\n return {\n kind: 'shape_drift',\n tool: taskName,\n observed_variant: 'bare_array',\n expected_variant: `{ ${listMeta.wrapperKey}: [...] }`,\n instance_path: '',\n message:\n `${taskName} returned a bare array at the top level. ` +\n `Required: { ${listMeta.wrapperKey}: [...] }. ` +\n `Use ${listMeta.helper}() from @adcp/sdk/server.`,\n };\n }\n\n if (typeof payload !== 'object' || payload === null) return undefined;\n const p = payload as Record<string, unknown>;\n\n if (taskName === 'build_creative') {\n const hasManifest = 'creative_manifest' in p || 'creative_manifests' in p;\n const platformNativeKeys = ['tag_url', 'creative_id', 'media_type', 'tag_type'];\n const platformNativePresent = platformNativeKeys.filter(k => k in p);\n if (!hasManifest && platformNativePresent.length > 0) {\n return {\n kind: 'shape_drift',\n tool: taskName,\n observed_variant: 'platform_native_fields',\n expected_variant: '{ creative_manifest: { format_id, assets } }',\n instance_path: '',\n message:\n `build_creative returned platform-native fields at the top level (${platformNativePresent.join(', ')}). ` +\n `Required: { creative_manifest: { format_id, assets } }. ` +\n `Use legacyBuildCreativeResponse() from @adcp/sdk/server.`,\n };\n }\n }\n\n if (taskName === 'sync_creatives') {\n const hasValidWrapper = 'creatives' in p || 'errors' in p || 'task_id' in p;\n const perItemKeys = ['creative_id', 'platform_id', 'action'];\n const perItemPresent = perItemKeys.filter(k => k in p);\n if (!hasValidWrapper && perItemPresent.length > 0) {\n return {\n kind: 'shape_drift',\n tool: taskName,\n observed_variant: 'per_item_shape',\n expected_variant: '{ creatives: [{ creative_id, action, ... }] }',\n instance_path: '',\n message:\n `sync_creatives returned a single creative's inner shape at the top level (${perItemPresent.join(', ')}). ` +\n `Required: { creatives: [{ creative_id, action, ... }] } (or { errors: [...] } / { status: 'submitted', task_id }). ` +\n `Use legacySyncCreativesResponse() from @adcp/sdk/server.`,\n };\n }\n\n const results = p.results;\n if (!hasValidWrapper && Array.isArray(results) && results.length > 0) {\n const firstRow = results[0];\n const looksLikeCreativeRow =\n firstRow != null && typeof firstRow === 'object' && ('creative_id' in firstRow || 'action' in firstRow);\n if (looksLikeCreativeRow) {\n return {\n kind: 'shape_drift',\n tool: taskName,\n observed_variant: 'wrong_wrapper_key',\n expected_variant: '{ creatives: [{ creative_id, action, ... }] }',\n instance_path: '/results',\n message:\n `sync_creatives returned { results: [...] } instead of { creatives: [...] } — wrong wrapper key. ` +\n `Required: { creatives: [{ creative_id, action, ... }] }. ` +\n `Use legacySyncCreativesResponse() from @adcp/sdk/server.`,\n };\n }\n }\n }\n\n if (taskName === 'preview_creative') {\n const hasValidWrapper = 'response_type' in p || 'previews' in p || 'results' in p;\n const rawRenderKeys = ['preview_url', 'preview_html', 'interactive_url'];\n const rawRenderPresent = rawRenderKeys.filter(k => k in p);\n const driftSignal = rawRenderPresent.filter(k => k !== 'interactive_url');\n if (!hasValidWrapper && driftSignal.length > 0) {\n return {\n kind: 'shape_drift',\n tool: taskName,\n observed_variant: 'raw_render_fields',\n expected_variant: \"{ response_type: 'single', previews: [{ renders: [...] }], expires_at }\",\n instance_path: '',\n message:\n `preview_creative returned raw render fields at the top level (${driftSignal.join(', ')}). ` +\n `Required: { response_type: 'single', previews: [{ renders: [{ preview_url | preview_html }] }], expires_at }. ` +\n `Use legacyPreviewCreativeResponse() from @adcp/sdk/server.`,\n };\n }\n }\n\n return undefined;\n}\n"],"mappings":"AA2BA,MAAM,qBAA6C;AAAA,EACjD,6BAA6B;AAAA,EAC7B,6BAA6B;AAAA,EAC7B,mCAAmC;AAAA,EACnC,4BAA4B;AAAA,EAC5B,wBAAwB;AAAA,EACxB,4BAA4B;AAAA,EAC5B,0BAA0B;AAAA,EAC1B,iCAAiC;AAAA,EACjC,mCAAmC;AAAA,EACnC,oCAAoC;AAAA,EACpC,gCAAgC;AAAA,EAChC,6BAA6B;AAAA,EAC7B,+BAA+B;AACjC;AAOA,SAAS,eAAe,GAAW,GAAoB;AAErD,QAAM,YAAY,CAAC,MAAc,EAAE,QAAQ,QAAQ,EAAE,EAAE,QAAQ,QAAQ,EAAE;AACzE,QAAM,OAAO,CAAC,MACZ,UAAU,CAAC,EACR,MAAM,GAAG,EACT,IAAI,OAAK,SAAS,GAAG,EAAE,KAAK,CAAC;AAClC,QAAM,CAAC,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC,IAAI,KAAK,CAAC;AAC/C,QAAM,CAAC,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC,IAAI,KAAK,CAAC;AAC/C,MAAI,SAAS,KAAM,QAAO,OAAO;AACjC,MAAI,SAAS,KAAM,QAAO,OAAO;AACjC,SAAO,SAAS;AAClB;AAaO,MAAM,qBAA6E;AAAA,EACxF,gBAAgB,EAAE,YAAY,aAAa,QAAQ,8BAA8B;AAAA,EACjF,uBAAuB,EAAE,YAAY,WAAW,QAAQ,oCAAoC;AAAA,EAC5F,eAAe,EAAE,YAAY,YAAY,QAAQ,6BAA6B;AAAA,EAC9E,cAAc,EAAE,YAAY,YAAY,QAAQ,yBAAyB;AAAA,EACzE,gBAAgB,EAAE,YAAY,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AAAA,IACF;AAAA,EACF;AAEA,MAAI,aAAa,oBAAoB;AACnC,UAAM,kBAAkB,mBAAmB,KAAK,cAAc,KAAK,aAAa;AAChF,UAAM,gBAAgB,CAAC,eAAe,gBAAgB,iBAAiB;AACvE,UAAM,mBAAmB,cAAc,OAAO,OAAK,KAAK,CAAC;AACzD,UAAM,cAAc,iBAAiB,OAAO,OAAK,MAAM,iBAAiB;AACxE,QAAI,CAAC,mBAAmB,YAAY,SAAS,GAAG;AAC9C,aAAO;AAAA,QACL,MAAM;AAAA,QACN,MAAM;AAAA,QACN,kBAAkB;AAAA,QAClB,kBAAkB;AAAA,QAClB,eAAe;AAAA,QACf,SACE,iEAAiE,YAAY,KAAK,IAAI,CAAC;AAAA,MAG3F;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"task-map.d.ts","sourceRoot":"","sources":["../../../../src/lib/testing/storyboard/task-map.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAI3C;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAsDjD,CAAC;AAgDF;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CAEzC,MAAM,EAAE,GAAG,EACX,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,IAAI,GAAE;IAAE,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAO,GACxG,OAAO,CAAC,UAAU,CAAC,CAuFrB"}
1
+ {"version":3,"file":"task-map.d.ts","sourceRoot":"","sources":["../../../../src/lib/testing/storyboard/task-map.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAI3C;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAsDjD,CAAC;AAwFF;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CAEzC,MAAM,EAAE,GAAG,EACX,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,IAAI,GAAE;IAAE,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAO,GACxG,OAAO,CAAC,UAAU,CAAC,CA0FrB"}
@@ -37,8 +37,8 @@ const TASK_TO_METHOD = {
37
37
  provide_performance_feedback: "providePerformanceFeedback",
38
38
  // Creative
39
39
  list_creative_formats: "listCreativeFormats",
40
- build_creative: "buildCreative",
41
- preview_creative: "previewCreative",
40
+ build_creative: "buildCreativeLegacy",
41
+ preview_creative: "previewCreativeLegacy",
42
42
  sync_creatives: "syncCreatives",
43
43
  list_creatives: "listCreatives",
44
44
  // Signals
@@ -71,9 +71,45 @@ const TASK_TO_METHOD = {
71
71
  si_send_message: "siSendMessage",
72
72
  si_terminate_session: "siTerminateSession"
73
73
  };
74
+ const LEGACY_CREATIVE_TASK_TO_METHOD = {
75
+ get_products: "getProductsLegacy",
76
+ create_media_buy: "createMediaBuyLegacy",
77
+ update_media_buy: "updateMediaBuyLegacy",
78
+ sync_creatives: "syncCreativesLegacy",
79
+ list_creatives: "listCreativesLegacy"
80
+ };
81
+ function gradesLegacyCreativeWire(client) {
82
+ if (client === null || typeof client !== "object") return false;
83
+ const getAdcpVersion = client.getAdcpVersion;
84
+ if (typeof getAdcpVersion !== "function") return false;
85
+ let version;
86
+ try {
87
+ version = getAdcpVersion.call(client);
88
+ } catch {
89
+ return false;
90
+ }
91
+ if (typeof version !== "string") return false;
92
+ const match = /^v?(\d+)(?:\.(\d+))?/.exec(version.trim());
93
+ if (!match) return false;
94
+ const major = Number(match[1]);
95
+ const minor = Number(match[2] ?? 0);
96
+ return major < 3 || major === 3 && minor < 2;
97
+ }
74
98
  function isRecord(value) {
75
99
  return value !== null && typeof value === "object" && !Array.isArray(value);
76
100
  }
101
+ function withLegacyCreativeWireHint(params) {
102
+ const ext = isRecord(params.ext) ? params.ext : {};
103
+ const adcp = isRecord(ext.adcp) ? ext.adcp : {};
104
+ if (adcp.creative_wire === "legacy" || adcp.creative_wire === "canonical") return params;
105
+ return {
106
+ ...params,
107
+ ext: {
108
+ ...ext,
109
+ adcp: { ...adcp, creative_wire: "legacy" }
110
+ }
111
+ };
112
+ }
77
113
  function readAdcpError(value) {
78
114
  if (!isRecord(value)) return void 0;
79
115
  const error = value.adcp_error;
@@ -108,7 +144,9 @@ function normalizeStoryboardTaskSuccess(result, taskName, terminalDataError, adc
108
144
  return true;
109
145
  }
110
146
  async function executeStoryboardTask(client, taskName, params, opts = {}) {
111
- const methodName = Object.hasOwn(TASK_TO_METHOD, taskName) ? TASK_TO_METHOD[taskName] : void 0;
147
+ const legacyMethodName = gradesLegacyCreativeWire(client) ? LEGACY_CREATIVE_TASK_TO_METHOD[taskName] : void 0;
148
+ const methodName = legacyMethodName ?? (Object.hasOwn(TASK_TO_METHOD, taskName) ? TASK_TO_METHOD[taskName] : void 0);
149
+ const callParams = legacyMethodName ? withLegacyCreativeWireHint(params) : params;
112
150
  const taskOptions = opts.skipIdempotencyAutoInject || opts.skipAccountValidation ? {
113
151
  ...opts.skipIdempotencyAutoInject && { skipIdempotencyAutoInject: true },
114
152
  ...opts.skipAccountValidation && { skipAccountValidation: true }
@@ -116,9 +154,9 @@ async function executeStoryboardTask(client, taskName, params, opts = {}) {
116
154
  let result;
117
155
  const invoke = async () => {
118
156
  if (methodName && typeof client[methodName] === "function") {
119
- return taskOptions ? client[methodName](params, void 0, taskOptions) : client[methodName](params);
157
+ return taskOptions ? client[methodName](callParams, void 0, taskOptions) : client[methodName](callParams);
120
158
  }
121
- return client.executeTask(taskName, params, void 0, taskOptions);
159
+ return client.executeTask(taskName, callParams, void 0, taskOptions);
122
160
  };
123
161
  const MAX_RETRIES = 3;
124
162
  const BASE_DELAY_MS = 2e3;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/testing/storyboard/task-map.ts"],"sourcesContent":["/**\n * Maps AdCP task names (from storyboard YAML) to SingleAgentClient method names.\n *\n * Each storyboard step has a `task` field like \"sync_accounts\" or \"get_products\".\n * This map resolves those to the camelCase method on SingleAgentClient.\n *\n * Tasks without a dedicated method fall through to `executeTask()`.\n */\n\nimport type { TaskResult } from '../types';\nimport type { AdcpErrorInfo } from '../../core/ConversationTypes';\nimport { isTerminalAdcpError, readExtractionPath } from '../../utils/response-unwrapper';\n\n/**\n * Map of AdCP task names to SingleAgentClient method names.\n * Only includes tasks that have dedicated typed methods.\n */\nexport const TASK_TO_METHOD: Record<string, string> = {\n // Account & audience\n sync_accounts: 'syncAccounts',\n list_accounts: 'listAccounts',\n sync_audiences: 'syncAudiences',\n\n // Product discovery & media buy\n get_products: 'getProducts',\n create_media_buy: 'createMediaBuy',\n update_media_buy: 'updateMediaBuy',\n get_media_buys: 'getMediaBuys',\n get_media_buy_delivery: 'getMediaBuyDelivery',\n provide_performance_feedback: 'providePerformanceFeedback',\n\n // Creative\n list_creative_formats: 'listCreativeFormats',\n build_creative: 'buildCreative',\n preview_creative: 'previewCreative',\n sync_creatives: 'syncCreatives',\n list_creatives: 'listCreatives',\n\n // Signals\n get_signals: 'getSignals',\n activate_signal: 'activateSignal',\n\n // Capabilities\n get_adcp_capabilities: 'getAdcpCapabilities',\n\n // Governance\n sync_plans: 'syncPlans',\n check_governance: 'checkGovernance',\n get_plan_audit_logs: 'getPlanAuditLogs',\n create_property_list: 'createPropertyList',\n get_property_list: 'getPropertyList',\n update_property_list: 'updatePropertyList',\n list_property_lists: 'listPropertyLists',\n delete_property_list: 'deletePropertyList',\n list_collection_lists: 'listCollectionLists',\n list_content_standards: 'listContentStandards',\n get_content_standards: 'getContentStandards',\n create_content_standards: 'createContentStandards',\n update_content_standards: 'updateContentStandards',\n calibrate_content: 'calibrateContent',\n validate_content_delivery: 'validateContentDelivery',\n\n // Account\n get_account_financials: 'getAccountFinancials',\n log_event: 'logEvent',\n\n // Sponsored Intelligence\n si_get_offering: 'siGetOffering',\n si_initiate_session: 'siInitiateSession',\n si_send_message: 'siSendMessage',\n si_terminate_session: 'siTerminateSession',\n};\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\nfunction readAdcpError(value: unknown): AdcpErrorInfo | undefined {\n if (!isRecord(value)) return undefined;\n const error = value.adcp_error;\n if (!isRecord(error) || typeof error.code !== 'string') return undefined;\n return error as unknown as AdcpErrorInfo;\n}\n\nfunction readFirstError(value: unknown): AdcpErrorInfo | undefined {\n if (!isRecord(value) || !Array.isArray(value.errors)) return undefined;\n const first = value.errors[0];\n if (!isRecord(first) || typeof first.code !== 'string') return undefined;\n return {\n code: first.code,\n message: typeof first.message === 'string' ? first.message : String(first.code),\n ...(typeof first.recovery === 'string' && { recovery: first.recovery as AdcpErrorInfo['recovery'] }),\n ...(typeof first.field === 'string' && { field: first.field }),\n ...(typeof first.suggestion === 'string' && { suggestion: first.suggestion }),\n ...(typeof first.retry_after === 'number' && { retry_after: first.retry_after }),\n ...(isRecord(first.details) && { details: first.details }),\n };\n}\n\nfunction errorMessageFrom(error: AdcpErrorInfo | undefined, fallback: unknown): string | undefined {\n if (typeof error?.message === 'string' && error.message.length > 0) return error.message;\n if (typeof error?.code === 'string') return error.code;\n return typeof fallback === 'string' && fallback.length > 0 ? fallback : undefined;\n}\n\nfunction normalizeStoryboardTaskSuccess(\n result: unknown,\n taskName: string,\n terminalDataError?: boolean,\n adcpError?: AdcpErrorInfo\n): boolean {\n if (!isRecord(result)) return true;\n if (typeof result.success === 'boolean') return result.success;\n if (result.status === 'failed' || result.status === 'rejected') return false;\n if (adcpError || result.adcpError || result.adcp_error) return false;\n if (terminalDataError ?? isTerminalAdcpError(result.data, taskName)) return false;\n return true;\n}\n\n/**\n * Execute a storyboard task against a SingleAgentClient.\n *\n * Uses the typed method if one exists, otherwise falls back to executeTask().\n * When the agent returns an async status (working/submitted), waits for\n * completion before returning — storyboard steps expect final results.\n */\nexport async function executeStoryboardTask(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- dynamic dispatch requires any\n client: any,\n taskName: string,\n params: Record<string, unknown>,\n opts: { skipIdempotencyAutoInject?: boolean; skipAccountValidation?: boolean; signal?: AbortSignal } = {}\n): Promise<TaskResult> {\n const methodName = Object.hasOwn(TASK_TO_METHOD, taskName) ? TASK_TO_METHOD[taskName] : undefined;\n\n // Only pass TaskOptions when a flag is actually set — avoids changing\n // behavior for the common path that relies on method defaults.\n const taskOptions =\n opts.skipIdempotencyAutoInject || opts.skipAccountValidation\n ? {\n ...(opts.skipIdempotencyAutoInject && { skipIdempotencyAutoInject: true }),\n ...(opts.skipAccountValidation && { skipAccountValidation: true }),\n }\n : undefined;\n\n let result;\n const invoke = async () => {\n if (methodName && typeof client[methodName] === 'function') {\n // Typed methods take (params, inputHandler?, options?). Pass options\n // only when set, otherwise they take their defaults.\n return taskOptions ? client[methodName](params, undefined, taskOptions) : client[methodName](params);\n }\n return client.executeTask(taskName, params, undefined, taskOptions);\n };\n\n // Retry with exponential backoff on rate limit errors\n const MAX_RETRIES = 3;\n const BASE_DELAY_MS = 2000;\n for (let attempt = 0; ; attempt++) {\n try {\n result = await raceWithSignal(invoke(), opts.signal);\n break;\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n const isRateLimit =\n /rate limit/i.test(msg) || (/\"code\":\\s*-32000/.test(msg) && /rate.?limit|too many|throttl/i.test(msg));\n if (isRateLimit && attempt < MAX_RETRIES) {\n const jitter = Math.random() * 1000;\n const delay = BASE_DELAY_MS * 2 ** attempt + jitter;\n await raceWithSignal(new Promise(resolve => setTimeout(resolve, delay)), opts.signal);\n continue;\n }\n throw err;\n }\n }\n\n // If the agent returned an async status but included data in the initial\n // response (common for agents that process synchronously but report as\n // submitted), use that data. Only poll when there's no data at all.\n const hasData = result.data !== undefined && result.data !== null;\n const isAsync = result.status === 'submitted' || result.status === 'working';\n const prePollingDebugLogs = Array.isArray(result.debug_logs) ? [...result.debug_logs] : [];\n let replacedByPolling = false;\n if (!hasData && isAsync && result.submitted?.waitForCompletion) {\n try {\n const timeout = new Promise<never>((_, reject) =>\n setTimeout(() => reject(new Error('Task polling timeout')), 30_000)\n );\n result = await raceWithSignal(\n Promise.race([result.submitted.waitForCompletion(2000, opts.signal), timeout]),\n opts.signal\n );\n replacedByPolling = true;\n } catch (err) {\n if (opts.signal?.aborted) throw err;\n // Polling failed or timed out — return the intermediate result as-is\n }\n }\n\n const terminalDataError = isTerminalAdcpError(result.data, taskName);\n const adcpError =\n result.adcpError ??\n result.adcp_error ??\n readAdcpError(result.data) ??\n (terminalDataError ? readFirstError(result.data) : undefined);\n const data = result.data ?? (adcpError ? { adcp_error: adcpError } : undefined);\n const success = normalizeStoryboardTaskSuccess(result, taskName, terminalDataError, adcpError);\n const error = result.error ?? (!success ? errorMessageFrom(adcpError, undefined) : undefined);\n const extractionPath = readExtractionPath(data);\n const debugLogs = Array.isArray(result.debug_logs) ? result.debug_logs : [];\n const mergedDebugLogs = replacedByPolling ? [...prePollingDebugLogs, ...debugLogs] : debugLogs;\n return {\n success,\n data,\n error,\n ...(adcpError && { adcp_error: adcpError }),\n ...(extractionPath !== undefined && { _extraction_path: extractionPath }),\n ...(mergedDebugLogs.length > 0 && { debug_logs: mergedDebugLogs }),\n };\n}\n\nfunction raceWithSignal<T>(promise: Promise<T>, signal?: AbortSignal): Promise<T> {\n if (!signal) return promise;\n if (signal.aborted) return Promise.reject(signal.reason ?? new Error('aborted'));\n\n return new Promise<T>((resolve, reject) => {\n const onAbort = () => reject(signal.reason ?? new Error('aborted'));\n signal.addEventListener('abort', onAbort, { once: true });\n promise.then(\n value => {\n signal.removeEventListener('abort', onAbort);\n resolve(value);\n },\n err => {\n signal.removeEventListener('abort', onAbort);\n reject(err);\n }\n );\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,gCAAwD;AAMjD,MAAM,iBAAyC;AAAA;AAAA,EAEpD,eAAe;AAAA,EACf,eAAe;AAAA,EACf,gBAAgB;AAAA;AAAA,EAGhB,cAAc;AAAA,EACd,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,wBAAwB;AAAA,EACxB,8BAA8B;AAAA;AAAA,EAG9B,uBAAuB;AAAA,EACvB,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA;AAAA,EAGhB,aAAa;AAAA,EACb,iBAAiB;AAAA;AAAA,EAGjB,uBAAuB;AAAA;AAAA,EAGvB,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,qBAAqB;AAAA,EACrB,sBAAsB;AAAA,EACtB,mBAAmB;AAAA,EACnB,sBAAsB;AAAA,EACtB,qBAAqB;AAAA,EACrB,sBAAsB;AAAA,EACtB,uBAAuB;AAAA,EACvB,wBAAwB;AAAA,EACxB,uBAAuB;AAAA,EACvB,0BAA0B;AAAA,EAC1B,0BAA0B;AAAA,EAC1B,mBAAmB;AAAA,EACnB,2BAA2B;AAAA;AAAA,EAG3B,wBAAwB;AAAA,EACxB,WAAW;AAAA;AAAA,EAGX,iBAAiB;AAAA,EACjB,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,sBAAsB;AACxB;AAEA,SAAS,SAAS,OAAkD;AAClE,SAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,cAAc,OAA2C;AAChE,MAAI,CAAC,SAAS,KAAK,EAAG,QAAO;AAC7B,QAAM,QAAQ,MAAM;AACpB,M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AAEA,SAAS,eAAkB,SAAqB,QAAkC;AAChF,MAAI,CAAC,OAAQ,QAAO;AACpB,MAAI,OAAO,QAAS,QAAO,QAAQ,OAAO,OAAO,UAAU,IAAI,MAAM,SAAS,CAAC;AAE/E,SAAO,IAAI,QAAW,CAAC,SAAS,WAAW;AACzC,UAAM,UAAU,MAAM,OAAO,OAAO,UAAU,IAAI,MAAM,SAAS,CAAC;AAClE,WAAO,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;AACxD,YAAQ;AAAA,MACN,WAAS;AACP,eAAO,oBAAoB,SAAS,OAAO;AAC3C,gBAAQ,KAAK;AAAA,MACf;AAAA,MACA,SAAO;AACL,eAAO,oBAAoB,SAAS,OAAO;AAC3C,eAAO,GAAG;AAAA,MACZ;AAAA,IACF;AAAA,EACF,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../../../../src/lib/testing/storyboard/task-map.ts"],"sourcesContent":["/**\n * Maps AdCP task names (from storyboard YAML) to SingleAgentClient method names.\n *\n * Each storyboard step has a `task` field like \"sync_accounts\" or \"get_products\".\n * This map resolves those to the camelCase method on SingleAgentClient.\n *\n * Tasks without a dedicated method fall through to `executeTask()`.\n */\n\nimport type { TaskResult } from '../types';\nimport type { AdcpErrorInfo } from '../../core/ConversationTypes';\nimport { isTerminalAdcpError, readExtractionPath } from '../../utils/response-unwrapper';\n\n/**\n * Map of AdCP task names to SingleAgentClient method names.\n * Only includes tasks that have dedicated typed methods.\n */\nexport const TASK_TO_METHOD: Record<string, string> = {\n // Account & audience\n sync_accounts: 'syncAccounts',\n list_accounts: 'listAccounts',\n sync_audiences: 'syncAudiences',\n\n // Product discovery & media buy\n get_products: 'getProducts',\n create_media_buy: 'createMediaBuy',\n update_media_buy: 'updateMediaBuy',\n get_media_buys: 'getMediaBuys',\n get_media_buy_delivery: 'getMediaBuyDelivery',\n provide_performance_feedback: 'providePerformanceFeedback',\n\n // Creative\n list_creative_formats: 'listCreativeFormats',\n build_creative: 'buildCreativeLegacy',\n preview_creative: 'previewCreativeLegacy',\n sync_creatives: 'syncCreatives',\n list_creatives: 'listCreatives',\n\n // Signals\n get_signals: 'getSignals',\n activate_signal: 'activateSignal',\n\n // Capabilities\n get_adcp_capabilities: 'getAdcpCapabilities',\n\n // Governance\n sync_plans: 'syncPlans',\n check_governance: 'checkGovernance',\n get_plan_audit_logs: 'getPlanAuditLogs',\n create_property_list: 'createPropertyList',\n get_property_list: 'getPropertyList',\n update_property_list: 'updatePropertyList',\n list_property_lists: 'listPropertyLists',\n delete_property_list: 'deletePropertyList',\n list_collection_lists: 'listCollectionLists',\n list_content_standards: 'listContentStandards',\n get_content_standards: 'getContentStandards',\n create_content_standards: 'createContentStandards',\n update_content_standards: 'updateContentStandards',\n calibrate_content: 'calibrateContent',\n validate_content_delivery: 'validateContentDelivery',\n\n // Account\n get_account_financials: 'getAccountFinancials',\n log_event: 'logEvent',\n\n // Sponsored Intelligence\n si_get_offering: 'siGetOffering',\n si_initiate_session: 'siInitiateSession',\n si_send_message: 'siSendMessage',\n si_terminate_session: 'siTerminateSession',\n};\n\n/** Storyboards grade the selected protocol wire, not the SDK's canonical API. */\nconst LEGACY_CREATIVE_TASK_TO_METHOD: Readonly<Record<string, string>> = {\n get_products: 'getProductsLegacy',\n create_media_buy: 'createMediaBuyLegacy',\n update_media_buy: 'updateMediaBuyLegacy',\n sync_creatives: 'syncCreativesLegacy',\n list_creatives: 'listCreativesLegacy',\n};\n\nfunction gradesLegacyCreativeWire(client: unknown): boolean {\n if (client === null || typeof client !== 'object') return false;\n const getAdcpVersion = (client as { getAdcpVersion?: unknown }).getAdcpVersion;\n if (typeof getAdcpVersion !== 'function') return false;\n let version: unknown;\n try {\n version = getAdcpVersion.call(client);\n } catch {\n return false;\n }\n if (typeof version !== 'string') return false;\n const match = /^v?(\\d+)(?:\\.(\\d+))?/.exec(version.trim());\n if (!match) return false;\n const major = Number(match[1]);\n const minor = Number(match[2] ?? 0);\n return major < 3 || (major === 3 && minor < 2);\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\nfunction withLegacyCreativeWireHint(params: Record<string, unknown>): Record<string, unknown> {\n const ext = isRecord(params.ext) ? params.ext : {};\n const adcp = isRecord(ext.adcp) ? ext.adcp : {};\n if (adcp.creative_wire === 'legacy' || adcp.creative_wire === 'canonical') return params;\n return {\n ...params,\n ext: {\n ...ext,\n adcp: { ...adcp, creative_wire: 'legacy' },\n },\n };\n}\n\nfunction readAdcpError(value: unknown): AdcpErrorInfo | undefined {\n if (!isRecord(value)) return undefined;\n const error = value.adcp_error;\n if (!isRecord(error) || typeof error.code !== 'string') return undefined;\n return error as unknown as AdcpErrorInfo;\n}\n\nfunction readFirstError(value: unknown): AdcpErrorInfo | undefined {\n if (!isRecord(value) || !Array.isArray(value.errors)) return undefined;\n const first = value.errors[0];\n if (!isRecord(first) || typeof first.code !== 'string') return undefined;\n return {\n code: first.code,\n message: typeof first.message === 'string' ? first.message : String(first.code),\n ...(typeof first.recovery === 'string' && { recovery: first.recovery as AdcpErrorInfo['recovery'] }),\n ...(typeof first.field === 'string' && { field: first.field }),\n ...(typeof first.suggestion === 'string' && { suggestion: first.suggestion }),\n ...(typeof first.retry_after === 'number' && { retry_after: first.retry_after }),\n ...(isRecord(first.details) && { details: first.details }),\n };\n}\n\nfunction errorMessageFrom(error: AdcpErrorInfo | undefined, fallback: unknown): string | undefined {\n if (typeof error?.message === 'string' && error.message.length > 0) return error.message;\n if (typeof error?.code === 'string') return error.code;\n return typeof fallback === 'string' && fallback.length > 0 ? fallback : undefined;\n}\n\nfunction normalizeStoryboardTaskSuccess(\n result: unknown,\n taskName: string,\n terminalDataError?: boolean,\n adcpError?: AdcpErrorInfo\n): boolean {\n if (!isRecord(result)) return true;\n if (typeof result.success === 'boolean') return result.success;\n if (result.status === 'failed' || result.status === 'rejected') return false;\n if (adcpError || result.adcpError || result.adcp_error) return false;\n if (terminalDataError ?? isTerminalAdcpError(result.data, taskName)) return false;\n return true;\n}\n\n/**\n * Execute a storyboard task against a SingleAgentClient.\n *\n * Uses the typed method if one exists, otherwise falls back to executeTask().\n * When the agent returns an async status (working/submitted), waits for\n * completion before returning — storyboard steps expect final results.\n */\nexport async function executeStoryboardTask(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- dynamic dispatch requires any\n client: any,\n taskName: string,\n params: Record<string, unknown>,\n opts: { skipIdempotencyAutoInject?: boolean; skipAccountValidation?: boolean; signal?: AbortSignal } = {}\n): Promise<TaskResult> {\n const legacyMethodName = gradesLegacyCreativeWire(client) ? LEGACY_CREATIVE_TASK_TO_METHOD[taskName] : undefined;\n const methodName =\n legacyMethodName ?? (Object.hasOwn(TASK_TO_METHOD, taskName) ? TASK_TO_METHOD[taskName] : undefined);\n const callParams = legacyMethodName ? withLegacyCreativeWireHint(params) : params;\n\n // Only pass TaskOptions when a flag is actually set — avoids changing\n // behavior for the common path that relies on method defaults.\n const taskOptions =\n opts.skipIdempotencyAutoInject || opts.skipAccountValidation\n ? {\n ...(opts.skipIdempotencyAutoInject && { skipIdempotencyAutoInject: true }),\n ...(opts.skipAccountValidation && { skipAccountValidation: true }),\n }\n : undefined;\n\n let result;\n const invoke = async () => {\n if (methodName && typeof client[methodName] === 'function') {\n // Typed methods take (params, inputHandler?, options?). Pass options\n // only when set, otherwise they take their defaults.\n return taskOptions ? client[methodName](callParams, undefined, taskOptions) : client[methodName](callParams);\n }\n return client.executeTask(taskName, callParams, undefined, taskOptions);\n };\n\n // Retry with exponential backoff on rate limit errors\n const MAX_RETRIES = 3;\n const BASE_DELAY_MS = 2000;\n for (let attempt = 0; ; attempt++) {\n try {\n result = await raceWithSignal(invoke(), opts.signal);\n break;\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n const isRateLimit =\n /rate limit/i.test(msg) || (/\"code\":\\s*-32000/.test(msg) && /rate.?limit|too many|throttl/i.test(msg));\n if (isRateLimit && attempt < MAX_RETRIES) {\n const jitter = Math.random() * 1000;\n const delay = BASE_DELAY_MS * 2 ** attempt + jitter;\n await raceWithSignal(new Promise(resolve => setTimeout(resolve, delay)), opts.signal);\n continue;\n }\n throw err;\n }\n }\n\n // If the agent returned an async status but included data in the initial\n // response (common for agents that process synchronously but report as\n // submitted), use that data. Only poll when there's no data at all.\n const hasData = result.data !== undefined && result.data !== null;\n const isAsync = result.status === 'submitted' || result.status === 'working';\n const prePollingDebugLogs = Array.isArray(result.debug_logs) ? [...result.debug_logs] : [];\n let replacedByPolling = false;\n if (!hasData && isAsync && result.submitted?.waitForCompletion) {\n try {\n const timeout = new Promise<never>((_, reject) =>\n setTimeout(() => reject(new Error('Task polling timeout')), 30_000)\n );\n result = await raceWithSignal(\n Promise.race([result.submitted.waitForCompletion(2000, opts.signal), timeout]),\n opts.signal\n );\n replacedByPolling = true;\n } catch (err) {\n if (opts.signal?.aborted) throw err;\n // Polling failed or timed out — return the intermediate result as-is\n }\n }\n\n const terminalDataError = isTerminalAdcpError(result.data, taskName);\n const adcpError =\n result.adcpError ??\n result.adcp_error ??\n readAdcpError(result.data) ??\n (terminalDataError ? readFirstError(result.data) : undefined);\n const data = result.data ?? (adcpError ? { adcp_error: adcpError } : undefined);\n const success = normalizeStoryboardTaskSuccess(result, taskName, terminalDataError, adcpError);\n const error = result.error ?? (!success ? errorMessageFrom(adcpError, undefined) : undefined);\n const extractionPath = readExtractionPath(data);\n const debugLogs = Array.isArray(result.debug_logs) ? result.debug_logs : [];\n const mergedDebugLogs = replacedByPolling ? [...prePollingDebugLogs, ...debugLogs] : debugLogs;\n return {\n success,\n data,\n error,\n ...(adcpError && { adcp_error: adcpError }),\n ...(extractionPath !== undefined && { _extraction_path: extractionPath }),\n ...(mergedDebugLogs.length > 0 && { debug_logs: mergedDebugLogs }),\n };\n}\n\nfunction raceWithSignal<T>(promise: Promise<T>, signal?: AbortSignal): Promise<T> {\n if (!signal) return promise;\n if (signal.aborted) return Promise.reject(signal.reason ?? new Error('aborted'));\n\n return new Promise<T>((resolve, reject) => {\n const onAbort = () => reject(signal.reason ?? new Error('aborted'));\n signal.addEventListener('abort', onAbort, { once: true });\n promise.then(\n value => {\n signal.removeEventListener('abort', onAbort);\n resolve(value);\n },\n err => {\n signal.removeEventListener('abort', onAbort);\n reject(err);\n }\n );\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,gCAAwD;AAMjD,MAAM,iBAAyC;AAAA;AAAA,EAEpD,eAAe;AAAA,EACf,eAAe;AAAA,EACf,gBAAgB;AAAA;AAAA,EAGhB,cAAc;AAAA,EACd,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,wBAAwB;AAAA,EACxB,8BAA8B;AAAA;AAAA,EAG9B,uBAAuB;AAAA,EACvB,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA;AAAA,EAGhB,aAAa;AAAA,EACb,iBAAiB;AAAA;AAAA,EAGjB,uBAAuB;AAAA;AAAA,EAGvB,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,qBAAqB;AAAA,EACrB,sBAAsB;AAAA,EACtB,mBAAmB;AAAA,EACnB,sBAAsB;AAAA,EACtB,qBAAqB;AAAA,EACrB,sBAAsB;AAAA,EACtB,uBAAuB;AAAA,EACvB,wBAAwB;AAAA,EACxB,uBAAuB;AAAA,EACvB,0BAA0B;AAAA,EAC1B,0BAA0B;AAAA,EAC1B,mBAAmB;AAAA,EACnB,2BAA2B;AAAA;AAAA,EAG3B,wBAAwB;AAAA,EACxB,WAAW;AAAA;AAAA,EAGX,iBAAiB;AAAA,EACjB,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,sBAAsB;AACxB;AAGA,MAAM,iCAAmE;AAAA,EACvE,cAAc;AAAA,EACd,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,gBAAg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