@adcp/sdk 5.25.0 → 6.0.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 (298) hide show
  1. package/README.md +45 -7
  2. package/dist/lib/compliance-fixtures/index.d.ts +1 -1
  3. package/dist/lib/compliance-fixtures/index.js +1 -1
  4. package/dist/lib/conformance/runners.d.ts.map +1 -1
  5. package/dist/lib/conformance/runners.js +13 -1
  6. package/dist/lib/conformance/runners.js.map +1 -1
  7. package/dist/lib/core/AgentClient.d.ts.map +1 -1
  8. package/dist/lib/core/SingleAgentClient.d.ts.map +1 -1
  9. package/dist/lib/core/SingleAgentClient.js +15 -0
  10. package/dist/lib/core/SingleAgentClient.js.map +1 -1
  11. package/dist/lib/core/TaskExecutor.d.ts +7 -0
  12. package/dist/lib/core/TaskExecutor.d.ts.map +1 -1
  13. package/dist/lib/core/TaskExecutor.js +9 -2
  14. package/dist/lib/core/TaskExecutor.js.map +1 -1
  15. package/dist/lib/index.d.ts +1 -1
  16. package/dist/lib/index.d.ts.map +1 -1
  17. package/dist/lib/index.js +7 -8
  18. package/dist/lib/index.js.map +1 -1
  19. package/dist/lib/protocols/index.d.ts +3 -1
  20. package/dist/lib/protocols/index.d.ts.map +1 -1
  21. package/dist/lib/protocols/index.js +23 -14
  22. package/dist/lib/protocols/index.js.map +1 -1
  23. package/dist/lib/schemas/index.d.ts +1 -1
  24. package/dist/lib/schemas/index.js +1 -1
  25. package/dist/lib/server/create-adcp-server.d.ts +142 -11
  26. package/dist/lib/server/create-adcp-server.d.ts.map +1 -1
  27. package/dist/lib/server/create-adcp-server.js +211 -2
  28. package/dist/lib/server/create-adcp-server.js.map +1 -1
  29. package/dist/lib/server/ctx-metadata/backends/memory.d.ts +27 -0
  30. package/dist/lib/server/ctx-metadata/backends/memory.d.ts.map +1 -0
  31. package/dist/lib/server/ctx-metadata/backends/memory.js +72 -0
  32. package/dist/lib/server/ctx-metadata/backends/memory.js.map +1 -0
  33. package/dist/lib/server/ctx-metadata/backends/pg.d.ts +62 -0
  34. package/dist/lib/server/ctx-metadata/backends/pg.d.ts.map +1 -0
  35. package/dist/lib/server/ctx-metadata/backends/pg.js +145 -0
  36. package/dist/lib/server/ctx-metadata/backends/pg.js.map +1 -0
  37. package/dist/lib/server/ctx-metadata/index.d.ts +15 -0
  38. package/dist/lib/server/ctx-metadata/index.d.ts.map +1 -0
  39. package/dist/lib/server/ctx-metadata/index.js +28 -0
  40. package/dist/lib/server/ctx-metadata/index.js.map +1 -0
  41. package/dist/lib/server/ctx-metadata/store.d.ts +177 -0
  42. package/dist/lib/server/ctx-metadata/store.d.ts.map +1 -0
  43. package/dist/lib/server/ctx-metadata/store.js +327 -0
  44. package/dist/lib/server/ctx-metadata/store.js.map +1 -0
  45. package/dist/lib/server/ctx-metadata/wire-shape.d.ts +55 -0
  46. package/dist/lib/server/ctx-metadata/wire-shape.d.ts.map +1 -0
  47. package/dist/lib/server/ctx-metadata/wire-shape.js +121 -0
  48. package/dist/lib/server/ctx-metadata/wire-shape.js.map +1 -0
  49. package/dist/lib/server/decisioning/account.d.ts +309 -0
  50. package/dist/lib/server/decisioning/account.d.ts.map +1 -0
  51. package/dist/lib/server/decisioning/account.js +102 -0
  52. package/dist/lib/server/decisioning/account.js.map +1 -0
  53. package/dist/lib/server/decisioning/admin-router.d.ts +75 -0
  54. package/dist/lib/server/decisioning/admin-router.d.ts.map +1 -0
  55. package/dist/lib/server/decisioning/admin-router.js +120 -0
  56. package/dist/lib/server/decisioning/admin-router.js.map +1 -0
  57. package/dist/lib/server/decisioning/assembly-helpers.d.ts +204 -0
  58. package/dist/lib/server/decisioning/assembly-helpers.d.ts.map +1 -0
  59. package/dist/lib/server/decisioning/assembly-helpers.js +173 -0
  60. package/dist/lib/server/decisioning/assembly-helpers.js.map +1 -0
  61. package/dist/lib/server/decisioning/async-outcome.d.ts +154 -0
  62. package/dist/lib/server/decisioning/async-outcome.d.ts.map +1 -0
  63. package/dist/lib/server/decisioning/async-outcome.js +239 -0
  64. package/dist/lib/server/decisioning/async-outcome.js.map +1 -0
  65. package/dist/lib/server/decisioning/capabilities.d.ts +251 -0
  66. package/dist/lib/server/decisioning/capabilities.d.ts.map +1 -0
  67. package/dist/lib/server/decisioning/capabilities.js +16 -0
  68. package/dist/lib/server/decisioning/capabilities.js.map +1 -0
  69. package/dist/lib/server/decisioning/context.d.ts +212 -0
  70. package/dist/lib/server/decisioning/context.d.ts.map +1 -0
  71. package/dist/lib/server/decisioning/context.js +26 -0
  72. package/dist/lib/server/decisioning/context.js.map +1 -0
  73. package/dist/lib/server/decisioning/errors-typed.d.ts +104 -0
  74. package/dist/lib/server/decisioning/errors-typed.d.ts.map +1 -0
  75. package/dist/lib/server/decisioning/errors-typed.js +304 -0
  76. package/dist/lib/server/decisioning/errors-typed.js.map +1 -0
  77. package/dist/lib/server/decisioning/helpers.d.ts +131 -0
  78. package/dist/lib/server/decisioning/helpers.d.ts.map +1 -0
  79. package/dist/lib/server/decisioning/helpers.js +134 -0
  80. package/dist/lib/server/decisioning/helpers.js.map +1 -0
  81. package/dist/lib/server/decisioning/index.d.ts +46 -0
  82. package/dist/lib/server/decisioning/index.d.ts.map +1 -0
  83. package/dist/lib/server/decisioning/index.js +120 -0
  84. package/dist/lib/server/decisioning/index.js.map +1 -0
  85. package/dist/lib/server/decisioning/list-helpers.d.ts +53 -0
  86. package/dist/lib/server/decisioning/list-helpers.d.ts.map +1 -0
  87. package/dist/lib/server/decisioning/list-helpers.js +96 -0
  88. package/dist/lib/server/decisioning/list-helpers.js.map +1 -0
  89. package/dist/lib/server/decisioning/manifest-helpers.d.ts +56 -0
  90. package/dist/lib/server/decisioning/manifest-helpers.d.ts.map +1 -0
  91. package/dist/lib/server/decisioning/manifest-helpers.js +78 -0
  92. package/dist/lib/server/decisioning/manifest-helpers.js.map +1 -0
  93. package/dist/lib/server/decisioning/pagination.d.ts +21 -0
  94. package/dist/lib/server/decisioning/pagination.d.ts.map +1 -0
  95. package/dist/lib/server/decisioning/pagination.js +12 -0
  96. package/dist/lib/server/decisioning/pagination.js.map +1 -0
  97. package/dist/lib/server/decisioning/platform.d.ts +188 -0
  98. package/dist/lib/server/decisioning/platform.d.ts.map +1 -0
  99. package/dist/lib/server/decisioning/platform.js +19 -0
  100. package/dist/lib/server/decisioning/platform.js.map +1 -0
  101. package/dist/lib/server/decisioning/runtime/from-platform.d.ts +510 -0
  102. package/dist/lib/server/decisioning/runtime/from-platform.d.ts.map +1 -0
  103. package/dist/lib/server/decisioning/runtime/from-platform.js +2196 -0
  104. package/dist/lib/server/decisioning/runtime/from-platform.js.map +1 -0
  105. package/dist/lib/server/decisioning/runtime/postgres-task-registry.d.ts +114 -0
  106. package/dist/lib/server/decisioning/runtime/postgres-task-registry.d.ts.map +1 -0
  107. package/dist/lib/server/decisioning/runtime/postgres-task-registry.js +247 -0
  108. package/dist/lib/server/decisioning/runtime/postgres-task-registry.js.map +1 -0
  109. package/dist/lib/server/decisioning/runtime/protocol-for-tool.d.ts +32 -0
  110. package/dist/lib/server/decisioning/runtime/protocol-for-tool.d.ts.map +1 -0
  111. package/dist/lib/server/decisioning/runtime/protocol-for-tool.js +127 -0
  112. package/dist/lib/server/decisioning/runtime/protocol-for-tool.js.map +1 -0
  113. package/dist/lib/server/decisioning/runtime/task-registry.d.ts +105 -0
  114. package/dist/lib/server/decisioning/runtime/task-registry.d.ts.map +1 -0
  115. package/dist/lib/server/decisioning/runtime/task-registry.js +96 -0
  116. package/dist/lib/server/decisioning/runtime/task-registry.js.map +1 -0
  117. package/dist/lib/server/decisioning/runtime/to-context.d.ts +54 -0
  118. package/dist/lib/server/decisioning/runtime/to-context.d.ts.map +1 -0
  119. package/dist/lib/server/decisioning/runtime/to-context.js +166 -0
  120. package/dist/lib/server/decisioning/runtime/to-context.js.map +1 -0
  121. package/dist/lib/server/decisioning/runtime/validate-platform.d.ts +20 -0
  122. package/dist/lib/server/decisioning/runtime/validate-platform.d.ts.map +1 -0
  123. package/dist/lib/server/decisioning/runtime/validate-platform.js +93 -0
  124. package/dist/lib/server/decisioning/runtime/validate-platform.js.map +1 -0
  125. package/dist/lib/server/decisioning/specialisms/audiences.d.ts +72 -0
  126. package/dist/lib/server/decisioning/specialisms/audiences.d.ts.map +1 -0
  127. package/dist/lib/server/decisioning/specialisms/audiences.js +15 -0
  128. package/dist/lib/server/decisioning/specialisms/audiences.js.map +1 -0
  129. package/dist/lib/server/decisioning/specialisms/brand-rights.d.ts +92 -0
  130. package/dist/lib/server/decisioning/specialisms/brand-rights.d.ts.map +1 -0
  131. package/dist/lib/server/decisioning/specialisms/brand-rights.js +28 -0
  132. package/dist/lib/server/decisioning/specialisms/brand-rights.js.map +1 -0
  133. package/dist/lib/server/decisioning/specialisms/campaign-governance.d.ts +67 -0
  134. package/dist/lib/server/decisioning/specialisms/campaign-governance.d.ts.map +1 -0
  135. package/dist/lib/server/decisioning/specialisms/campaign-governance.js +31 -0
  136. package/dist/lib/server/decisioning/specialisms/campaign-governance.js.map +1 -0
  137. package/dist/lib/server/decisioning/specialisms/content-standards.d.ts +78 -0
  138. package/dist/lib/server/decisioning/specialisms/content-standards.d.ts.map +1 -0
  139. package/dist/lib/server/decisioning/specialisms/content-standards.js +35 -0
  140. package/dist/lib/server/decisioning/specialisms/content-standards.js.map +1 -0
  141. package/dist/lib/server/decisioning/specialisms/creative-ad-server.d.ts +81 -0
  142. package/dist/lib/server/decisioning/specialisms/creative-ad-server.d.ts.map +1 -0
  143. package/dist/lib/server/decisioning/specialisms/creative-ad-server.js +28 -0
  144. package/dist/lib/server/decisioning/specialisms/creative-ad-server.js.map +1 -0
  145. package/dist/lib/server/decisioning/specialisms/creative.d.ts +144 -0
  146. package/dist/lib/server/decisioning/specialisms/creative.d.ts.map +1 -0
  147. package/dist/lib/server/decisioning/specialisms/creative.js +19 -0
  148. package/dist/lib/server/decisioning/specialisms/creative.js.map +1 -0
  149. package/dist/lib/server/decisioning/specialisms/lists.d.ts +61 -0
  150. package/dist/lib/server/decisioning/specialisms/lists.d.ts.map +1 -0
  151. package/dist/lib/server/decisioning/specialisms/lists.js +30 -0
  152. package/dist/lib/server/decisioning/specialisms/lists.js.map +1 -0
  153. package/dist/lib/server/decisioning/specialisms/sales.d.ts +163 -0
  154. package/dist/lib/server/decisioning/specialisms/sales.d.ts.map +1 -0
  155. package/dist/lib/server/decisioning/specialisms/sales.js +64 -0
  156. package/dist/lib/server/decisioning/specialisms/sales.js.map +1 -0
  157. package/dist/lib/server/decisioning/specialisms/signals.d.ts +64 -0
  158. package/dist/lib/server/decisioning/specialisms/signals.d.ts.map +1 -0
  159. package/dist/lib/server/decisioning/specialisms/signals.js +28 -0
  160. package/dist/lib/server/decisioning/specialisms/signals.js.map +1 -0
  161. package/dist/lib/server/decisioning/start-time.d.ts +76 -0
  162. package/dist/lib/server/decisioning/start-time.d.ts.map +1 -0
  163. package/dist/lib/server/decisioning/start-time.js +81 -0
  164. package/dist/lib/server/decisioning/start-time.js.map +1 -0
  165. package/dist/lib/server/decisioning/status-changes.d.ts +165 -0
  166. package/dist/lib/server/decisioning/status-changes.d.ts.map +1 -0
  167. package/dist/lib/server/decisioning/status-changes.js +131 -0
  168. package/dist/lib/server/decisioning/status-changes.js.map +1 -0
  169. package/dist/lib/server/decisioning/status-mappers.d.ts +46 -0
  170. package/dist/lib/server/decisioning/status-mappers.d.ts.map +1 -0
  171. package/dist/lib/server/decisioning/status-mappers.js +46 -0
  172. package/dist/lib/server/decisioning/status-mappers.js.map +1 -0
  173. package/dist/lib/server/decisioning/tenant-registry.d.ts +289 -0
  174. package/dist/lib/server/decisioning/tenant-registry.d.ts.map +1 -0
  175. package/dist/lib/server/decisioning/tenant-registry.js +503 -0
  176. package/dist/lib/server/decisioning/tenant-registry.js.map +1 -0
  177. package/dist/lib/server/express-adapter.d.ts +1 -1
  178. package/dist/lib/server/express-adapter.js +1 -1
  179. package/dist/lib/server/governance.d.ts +1 -1
  180. package/dist/lib/server/governance.js +1 -1
  181. package/dist/lib/server/idempotency/store.d.ts +1 -1
  182. package/dist/lib/server/idempotency/store.js +1 -1
  183. package/dist/lib/server/index.d.ts +9 -2
  184. package/dist/lib/server/index.d.ts.map +1 -1
  185. package/dist/lib/server/index.js +79 -4
  186. package/dist/lib/server/index.js.map +1 -1
  187. package/dist/lib/server/legacy/v5/index.d.ts +38 -0
  188. package/dist/lib/server/legacy/v5/index.d.ts.map +1 -0
  189. package/dist/lib/server/legacy/v5/index.js +60 -0
  190. package/dist/lib/server/legacy/v5/index.js.map +1 -0
  191. package/dist/lib/server/normalize-errors.d.ts +88 -0
  192. package/dist/lib/server/normalize-errors.d.ts.map +1 -0
  193. package/dist/lib/server/normalize-errors.js +146 -0
  194. package/dist/lib/server/normalize-errors.js.map +1 -0
  195. package/dist/lib/server/pick-safe-details.d.ts +90 -0
  196. package/dist/lib/server/pick-safe-details.d.ts.map +1 -0
  197. package/dist/lib/server/pick-safe-details.js +148 -0
  198. package/dist/lib/server/pick-safe-details.js.map +1 -0
  199. package/dist/lib/server/postgres-state-store.d.ts +1 -1
  200. package/dist/lib/server/postgres-state-store.js +1 -1
  201. package/dist/lib/server/responses.d.ts +38 -0
  202. package/dist/lib/server/responses.d.ts.map +1 -1
  203. package/dist/lib/server/responses.js +38 -0
  204. package/dist/lib/server/responses.js.map +1 -1
  205. package/dist/lib/server/state-store.d.ts +1 -1
  206. package/dist/lib/server/state-store.js +1 -1
  207. package/dist/lib/server/test-controller.d.ts +10 -3
  208. package/dist/lib/server/test-controller.d.ts.map +1 -1
  209. package/dist/lib/server/test-controller.js +10 -3
  210. package/dist/lib/server/test-controller.js.map +1 -1
  211. package/dist/lib/testing/comply-controller.d.ts +47 -1
  212. package/dist/lib/testing/comply-controller.d.ts.map +1 -1
  213. package/dist/lib/testing/comply-controller.js +11 -4
  214. package/dist/lib/testing/comply-controller.js.map +1 -1
  215. package/dist/lib/testing/index.d.ts +1 -1
  216. package/dist/lib/testing/index.d.ts.map +1 -1
  217. package/dist/lib/testing/index.js.map +1 -1
  218. package/dist/lib/testing/personas/index.d.ts +143 -0
  219. package/dist/lib/testing/personas/index.d.ts.map +1 -0
  220. package/dist/lib/testing/personas/index.js +190 -0
  221. package/dist/lib/testing/personas/index.js.map +1 -0
  222. package/dist/lib/testing/storyboard/index.d.ts +1 -1
  223. package/dist/lib/testing/storyboard/index.d.ts.map +1 -1
  224. package/dist/lib/testing/storyboard/index.js +3 -2
  225. package/dist/lib/testing/storyboard/index.js.map +1 -1
  226. package/dist/lib/testing/storyboard/runner.d.ts +13 -0
  227. package/dist/lib/testing/storyboard/runner.d.ts.map +1 -1
  228. package/dist/lib/testing/storyboard/runner.js +179 -7
  229. package/dist/lib/testing/storyboard/runner.js.map +1 -1
  230. package/dist/lib/types/adcp.d.ts.map +1 -1
  231. package/dist/lib/types/adcp.js +1 -0
  232. package/dist/lib/types/adcp.js.map +1 -1
  233. package/dist/lib/types/asset-instances.d.ts +1 -0
  234. package/dist/lib/types/asset-instances.d.ts.map +1 -1
  235. package/dist/lib/types/core.generated.d.ts +203 -98
  236. package/dist/lib/types/core.generated.d.ts.map +1 -1
  237. package/dist/lib/types/core.generated.js +1 -1
  238. package/dist/lib/types/index.d.ts +1 -0
  239. package/dist/lib/types/index.d.ts.map +1 -1
  240. package/dist/lib/types/index.js.map +1 -1
  241. package/dist/lib/types/schemas.generated.d.ts +599 -159
  242. package/dist/lib/types/schemas.generated.d.ts.map +1 -1
  243. package/dist/lib/types/schemas.generated.js +175 -94
  244. package/dist/lib/types/schemas.generated.js.map +1 -1
  245. package/dist/lib/types/tools.generated.d.ts +315 -46
  246. package/dist/lib/types/tools.generated.d.ts.map +1 -1
  247. package/dist/lib/utils/capabilities.d.ts +1 -1
  248. package/dist/lib/utils/capabilities.d.ts.map +1 -1
  249. package/dist/lib/utils/capabilities.js +6 -0
  250. package/dist/lib/utils/capabilities.js.map +1 -1
  251. package/dist/lib/validation/schema-validator.d.ts +13 -0
  252. package/dist/lib/validation/schema-validator.d.ts.map +1 -1
  253. package/dist/lib/validation/schema-validator.js +240 -3
  254. package/dist/lib/validation/schema-validator.js.map +1 -1
  255. package/dist/lib/version.d.ts +3 -3
  256. package/dist/lib/version.d.ts.map +1 -1
  257. package/dist/lib/version.js +3 -3
  258. package/dist/lib/version.js.map +1 -1
  259. package/docs/guides/BUILD-AN-AGENT.md +30 -5
  260. package/docs/llms.txt +28 -17
  261. package/examples/README.md +3 -1
  262. package/examples/decisioning-platform-broadcast-tv.ts +300 -0
  263. package/examples/decisioning-platform-identity-graph.ts +214 -0
  264. package/examples/decisioning-platform-mock-seller.ts +332 -0
  265. package/examples/decisioning-platform-multi-tenant.ts +128 -0
  266. package/examples/decisioning-platform-programmatic.ts +254 -0
  267. package/examples/signals-agent.ts +1 -1
  268. package/package.json +13 -2
  269. package/skills/build-brand-rights-agent/SKILL.md +10 -3
  270. package/skills/build-creative-agent/SKILL.md +94 -64
  271. package/skills/build-decisioning-creative-template/SKILL.md +554 -0
  272. package/skills/build-decisioning-platform/SKILL.md +304 -0
  273. package/skills/build-decisioning-platform/advanced/BRAND-RIGHTS.md +25 -0
  274. package/skills/build-decisioning-platform/advanced/COMPLIANCE.md +23 -0
  275. package/skills/build-decisioning-platform/advanced/GOVERNANCE.md +24 -0
  276. package/skills/build-decisioning-platform/advanced/HITL.md +34 -0
  277. package/skills/build-decisioning-platform/advanced/IDEMPOTENCY.md +52 -0
  278. package/skills/build-decisioning-platform/advanced/MULTI-TENANT.md +47 -0
  279. package/skills/build-decisioning-platform/advanced/OAUTH.md +22 -0
  280. package/skills/build-decisioning-platform/advanced/REFERENCE.md +991 -0
  281. package/skills/build-decisioning-platform/advanced/SANDBOX.md +24 -0
  282. package/skills/build-decisioning-platform/advanced/STATE-MACHINE.md +52 -0
  283. package/skills/build-decisioning-signal-marketplace/SKILL.md +269 -0
  284. package/skills/build-generative-seller-agent/SKILL.md +89 -53
  285. package/skills/build-governance-agent/SKILL.md +76 -45
  286. package/skills/build-retail-media-agent/SKILL.md +87 -62
  287. package/skills/build-seller-agent/SKILL.md +384 -255
  288. package/skills/build-seller-agent/deployment.md +5 -3
  289. package/skills/build-seller-agent/specialisms/audience-sync.md +0 -2
  290. package/skills/build-seller-agent/specialisms/sales-broadcast-tv.md +0 -2
  291. package/skills/build-seller-agent/specialisms/sales-guaranteed.md +0 -2
  292. package/skills/build-seller-agent/specialisms/sales-non-guaranteed.md +0 -2
  293. package/skills/build-seller-agent/specialisms/sales-proposal-mode.md +0 -2
  294. package/skills/build-seller-agent/specialisms/sales-social.md +0 -2
  295. package/skills/build-seller-agent/specialisms/signed-requests.md +0 -2
  296. package/skills/build-si-agent/SKILL.md +40 -32
  297. package/skills/build-signals-agent/SKILL.md +139 -92
  298. package/skills/call-adcp-agent.previous/SKILL.md +5 -0
@@ -0,0 +1,510 @@
1
+ /**
2
+ * Build an `AdcpServer` from a `DecisioningPlatform` impl.
3
+ *
4
+ * v6.0 alpha entry point. Translates the per-specialism platform interface
5
+ * into the framework's existing handler-style config and delegates to
6
+ * `createAdcpServer()`. This means every framework primitive — idempotency,
7
+ * RFC 9421 signing, governance, schema validation, state store, MCP/A2A
8
+ * wire mapping, sandbox boundary — applies unchanged. The new code is the
9
+ * adapter shim, not a forked runtime.
10
+ *
11
+ * **Adopter shape (unified hybrid):** each HITL-eligible tool is a single
12
+ * method. The method returns the wire success arm (sync fast path) OR
13
+ * `ctx.handoffToTask(fn)` to promote the call to a background task (HITL
14
+ * slow path). Adopters branch per-call; framework detects the `TaskHandoff`
15
+ * marker and dispatches accordingly:
16
+ *
17
+ * - Sync path: framework awaits the return value in foreground; projects
18
+ * it to the wire success arm. `throw new AdcpError(...)` projects to
19
+ * the wire `adcp_error` envelope.
20
+ * - HITL path: framework detects the `TaskHandoff` marker, allocates
21
+ * `taskId`, returns the submitted envelope to the buyer immediately,
22
+ * then runs the handoff function in background. The function's return
23
+ * value becomes the task's terminal `result`; thrown `AdcpError` becomes
24
+ * the terminal `error`.
25
+ *
26
+ * Generic thrown errors (`Error`, `TypeError`) fall through to the
27
+ * framework's `SERVICE_UNAVAILABLE` mapping.
28
+ *
29
+ * **Wired surface (6.0):** `SalesPlatform` (14 tools — 3 required core +
30
+ * 11 optional; unified hybrid on `create_media_buy` / `sync_creatives`),
31
+ * `CreativeBuilderPlatform` (build_creative / sync_creatives unified
32
+ * hybrid, optional preview_creative sync-only, optional refineCreative),
33
+ * `AudiencePlatform.syncAudiences`, `SignalsPlatform` (activate_signal,
34
+ * list_signals), `AccountStore` (reportUsage, getAccountFinancials),
35
+ * `ContentStandardsPlatform`, `CampaignGovernancePlatform`,
36
+ * `TenantRegistry` (multi-tenant health), `createPostgresTaskRegistry`,
37
+ * `tasks/get` wire handler, per-server + module-level `publishStatusChange`.
38
+ *
39
+ * **Still deferred (rc.1+):** MCP Resources subscription projection for
40
+ * `publishStatusChange`; `resolveAccount(undefined, { authInfo, toolName })`
41
+ * refactor for `provide_performance_feedback` / `list_creative_formats`
42
+ * no-account path in `'explicit'`-mode adopters (see `SalesPlatform` JSDoc).
43
+ *
44
+ * Status: Preview / 6.0. Not yet exported from the public `./server`
45
+ * subpath; reach in via `@adcp/sdk/server/decisioning/runtime` for
46
+ * spike experimentation only.
47
+ *
48
+ * @public
49
+ */
50
+ import type { AdcpServer } from '../../adcp-server';
51
+ import { type AdcpServerConfig, type HandlerContext } from '../../create-adcp-server';
52
+ import type { DecisioningPlatform, RequiredPlatformsFor, RequiredCapabilitiesFor } from '../platform';
53
+ import type { Account } from '../account';
54
+ import { type CtxMetadataStore } from '../../ctx-metadata';
55
+ import type { PgQueryable } from '../../postgres-task-store';
56
+ import { type TaskRegistry, type TaskRecord } from './task-registry';
57
+ import { type StatusChangeBus } from '../status-changes';
58
+ import { type ComplyControllerConfig } from '../../../testing/comply-controller';
59
+ /**
60
+ * Lifecycle observability hooks the v6 runtime fires at well-known points.
61
+ * Each callback is optional; throws are caught and logged via the framework
62
+ * logger so adopter telemetry mistakes never break dispatch.
63
+ *
64
+ * Reach for these to wire DataDog / Prometheus / OpenTelemetry / structured
65
+ * logging without baking any specific backend into the framework. For
66
+ * OpenTelemetry, the `@adcp/sdk/telemetry/otel` peer-dep adapter returns
67
+ * a pre-wired implementation with AdCP-aligned span / metric names.
68
+ *
69
+ * **What's instrumented today (v6.0):**
70
+ * - Task lifecycle (`onTaskCreate`, `onTaskTransition`) — fires from `dispatchHitl`
71
+ * - Webhook delivery (`onWebhookEmit`) — fires after each push-notification post
72
+ * - Status-change events (`onStatusChangePublish`) — wraps the per-server bus
73
+ * - Account resolution (`onAccountResolve`) — fires after every `resolve()` call
74
+ *
75
+ * **Coming in v6.1:**
76
+ * - Per-tool dispatch latency (`onDispatchStart` / `onDispatchEnd`) —
77
+ * requires wrapping every handler entry point; lands when the per-handler
78
+ * instrumentation pass goes through.
79
+ * - Idempotency replay rate (covered at the framework layer when v5 hooks land)
80
+ * - State-store reads (per-handler instrumentation)
81
+ *
82
+ * @public
83
+ */
84
+ export interface DecisioningObservabilityHooks {
85
+ /**
86
+ * Fired after `accounts.resolve` (or `resolveAccountFromAuth`) returns.
87
+ * `resolved: false` means the resolver returned `null` — caller maps to
88
+ * `ACCOUNT_NOT_FOUND`. `fromAuth: true` indicates the auth-derived path
89
+ * (tools without an `account` field on the wire). `accountId` is the
90
+ * resolved tenant id when `resolved: true`, undefined otherwise — useful
91
+ * for dimensioning DD / Prometheus tag sets by tenant.
92
+ *
93
+ * **Cardinality warning:** if you forward `accountId` to a multi-tenant
94
+ * metric backend, pre-bucket or sample — high tenant counts will
95
+ * explode tag cardinality.
96
+ */
97
+ onAccountResolve?(info: {
98
+ tool: string;
99
+ durationMs: number;
100
+ resolved: boolean;
101
+ fromAuth: boolean;
102
+ accountId?: string;
103
+ }): void;
104
+ /**
105
+ * Fired when `dispatchHitl` allocates a new task in the registry.
106
+ * `durationMs` is the registry-create call latency (typically
107
+ * sub-millisecond for in-memory, single-digit ms for Postgres).
108
+ */
109
+ onTaskCreate?(info: {
110
+ tool: string;
111
+ taskId: string;
112
+ accountId: string;
113
+ durationMs: number;
114
+ }): void;
115
+ /**
116
+ * Fired when a task transitions to a terminal state (`completed`,
117
+ * `failed`, or `failed-write` when the registry write itself fails).
118
+ * `durationMs` is from create → terminal. `errorCode` is the structured
119
+ * error code for the failure cases — pre-bucketed for metric tags
120
+ * (matches `ErrorCode` enum + the framework-synthetic
121
+ * `'REGISTRY_WRITE_FAILED'` value).
122
+ */
123
+ onTaskTransition?(info: {
124
+ taskId: string;
125
+ tool: string;
126
+ accountId: string;
127
+ status: 'completed' | 'failed';
128
+ durationMs: number;
129
+ errorCode?: string;
130
+ }): void;
131
+ /**
132
+ * Fired after a push-notification webhook delivery attempt completes
133
+ * (success or all retries exhausted). Adopters wire to per-buyer
134
+ * deliverability dashboards.
135
+ *
136
+ * `errorCode` is a single bucketed value adopters tag metrics with
137
+ * (`'TIMEOUT'`, `'CONNECTION_REFUSED'`, `'HTTP_4XX'`, `'HTTP_5XX'`,
138
+ * `'SIGNATURE_FAILURE'`, `'UNKNOWN'` — derived from the underlying
139
+ * emitter error). `errorMessages` is the raw free-text error list for
140
+ * structured-log adopters; do NOT forward this to metrics tag values.
141
+ */
142
+ onWebhookEmit?(info: {
143
+ taskId: string;
144
+ tool: string;
145
+ status: string;
146
+ url: string;
147
+ success: boolean;
148
+ durationMs: number;
149
+ errorCode?: string;
150
+ errorMessages?: string[];
151
+ }): void;
152
+ /**
153
+ * Fired after each `publishStatusChange(...)` event (per-server bus +
154
+ * module-level singleton routes both go through the wrapped bus). Lets
155
+ * adopters meter event rates per resource type without subscribing.
156
+ */
157
+ onStatusChangePublish?(info: {
158
+ accountId: string;
159
+ resourceType: string;
160
+ resourceId: string;
161
+ }): void;
162
+ }
163
+ export interface CreateAdcpServerFromPlatformOptions extends Omit<AdcpServerConfig, 'resolveAccount' | 'capabilities' | 'name' | 'version'> {
164
+ name: string;
165
+ version: string;
166
+ /**
167
+ * Override the framework's task registry. Useful for tests that want to
168
+ * pre-seed task records or assert on them across multiple servers.
169
+ * Defaults to a fresh `createInMemoryTaskRegistry()` per server instance
170
+ * (gated by NODE_ENV — see `buildDefaultTaskRegistry`).
171
+ */
172
+ taskRegistry?: TaskRegistry;
173
+ /**
174
+ * Override the framework's status-change event bus for this server.
175
+ * Defaults to a fresh per-server `createInMemoryStatusChangeBus()` so
176
+ * tests get isolation without touching the module-level singleton from
177
+ * `publishStatusChange(...)`. Adopters who publish from non-handler code
178
+ * (webhook handlers, crons) typically use the module-level primitive
179
+ * — pass an explicit bus here only when you want a per-server channel.
180
+ */
181
+ statusChangeBus?: StatusChangeBus;
182
+ /**
183
+ * Lifecycle observability hooks. Adopters wire their telemetry backend
184
+ * (DataDog, Prometheus, OpenTelemetry, structured logger, etc.) by
185
+ * supplying any subset of the callbacks below. The framework calls them
186
+ * at well-known dispatch points; throws inside callbacks are caught and
187
+ * logged via `opts.logger.warn` — they never break dispatch.
188
+ *
189
+ * For an out-of-the-box OpenTelemetry binding, `@adcp/sdk/telemetry/otel`
190
+ * (peer-dep, opt-in) returns a pre-wired `DecisioningObservabilityHooks`
191
+ * object. Adopters using DataDog, Prometheus, or hand-rolled metrics
192
+ * implement the callbacks directly.
193
+ */
194
+ observability?: DecisioningObservabilityHooks;
195
+ /**
196
+ * Merge-seam collision behavior. When an adopter-supplied custom handler
197
+ * (e.g. `opts.mediaBuy.getMediaBuys`) collides with a platform-derived
198
+ * handler (e.g. `platform.sales.getMediaBuys`), the platform-derived one
199
+ * wins per-key and the adopter override is silently shadowed.
200
+ *
201
+ * Modes:
202
+ * - `'warn'` (default) — log a warning at every construction that hits a
203
+ * collision. Migration signal without breaking running deployments.
204
+ * - `'log-once'` — log a warning the first time each `(domain, keys)`
205
+ * collision is seen in the process; subsequent constructions with the
206
+ * same shape stay silent. Right default for multi-tenant hosts (one
207
+ * process, N `createAdcpServerFromPlatform` calls) and hot-reload dev
208
+ * (server reconstructed every file change).
209
+ * - `'strict'` — throw `PlatformConfigError`. Recommended for CI / new
210
+ * deployments where the v6 surface is the canonical source.
211
+ * - `'silent'` — skip the check. For adopters who deliberately use the
212
+ * merge seam as an override (e.g., wrapping platform behavior with
213
+ * logging in their custom handler).
214
+ */
215
+ mergeSeam?: MergeSeamMode;
216
+ /**
217
+ * Override the webhook emitter the framework uses to push HITL task
218
+ * completion to the buyer's `push_notification_config.url`. Default: when
219
+ * the host wired `webhooks` on the underlying `AdcpServerConfig`, use
220
+ * `ctx.emitWebhook` from the per-request HandlerContext (the framework
221
+ * binds `webhookEmitter.emit` to it). Pass an explicit emitter here when
222
+ * you want a dedicated webhook delivery path for task completions
223
+ * (different signing key, different retry policy, different fetch impl)
224
+ * separate from your other webhook emissions, or to inject a fake for
225
+ * tests without wiring full RFC 9421 signing.
226
+ *
227
+ * **Signing posture is your responsibility.** When adopters claim
228
+ * `signed-requests` capability, buyers expect RFC 9421-signed webhooks.
229
+ * The default emitter (bound to `serve({ webhooks })`) signs;
230
+ * a custom emitter passed here MUST either delegate to the same signed
231
+ * pipeline or sign itself. Set `unsigned: true` to acknowledge that this
232
+ * emitter intentionally bypasses signing — without that flag, an
233
+ * unsigned emitter wired in production would silently ship unsigned
234
+ * webhooks to buyers expecting signatures. Tests / dev paths set
235
+ * `unsigned: true`.
236
+ */
237
+ taskWebhookEmitter?: {
238
+ emit: NonNullable<HandlerContext<Account>['emitWebhook']>;
239
+ /**
240
+ * Set to `true` to acknowledge this emitter does NOT sign the webhook
241
+ * payload (RFC 9421). Required for tests and development; production
242
+ * deployments with `signed-requests` claimed should leave this
243
+ * unset / `false` and rely on the framework's signing path.
244
+ */
245
+ unsigned?: boolean;
246
+ };
247
+ /**
248
+ * `comply_test_controller` adapter set. When supplied, the framework
249
+ * registers the wire tool automatically by composing `createComplyController`
250
+ * (`@adcp/sdk/testing`) with the adopter's adapters and calling
251
+ * `controller.register(server)` after platform handlers wire up.
252
+ *
253
+ * Adopter declares the scenarios they support — `seed: { product, … }`,
254
+ * `force: { creative_status, … }`, `simulate: { delivery, … }`. The
255
+ * framework auto-derives `capabilities.compliance_testing.scenarios`
256
+ * from which adapters are present, projecting the discovery field to
257
+ * `get_adcp_capabilities` so conformance harnesses see what's
258
+ * supported.
259
+ *
260
+ * **Sandbox gating.** `complyTest.sandboxGate(input)` is the per-request
261
+ * gate; tools/list visibility is controlled by whether you supply
262
+ * `complyTest` at all. Production agents typically gate registration
263
+ * itself on `process.env.ADCP_SANDBOX === '1'` or wrap construction in
264
+ * an environment check; the helper logs a loud warning if registered
265
+ * without a gate AND without an env-flag escape (matches the standalone
266
+ * `createComplyController` warning behavior).
267
+ *
268
+ * **Capability-vs-adapter consistency.** If
269
+ * `capabilities.compliance_testing` is declared but `complyTest` is
270
+ * omitted, construction throws `PlatformConfigError` — the framework
271
+ * refuses to project a discovery block the runtime can't honor.
272
+ *
273
+ * @public
274
+ */
275
+ complyTest?: ComplyControllerConfig;
276
+ /**
277
+ * Single-pool shortcut: pass a `pg.Pool` (or any `PgQueryable`) and the
278
+ * framework wires `idempotency` + `ctxMetadata` + `taskRegistry`
279
+ * internally with sensible defaults. One connection, three concerns.
280
+ *
281
+ * Adopters who pass any of `idempotency` / `ctxMetadata` / `taskRegistry`
282
+ * explicitly keep override priority — the explicit values win, and the
283
+ * pool fills only the unset ones.
284
+ *
285
+ * Run `getAllAdcpMigrations()` once per database to create the three
286
+ * required tables (idempotency cache, ctx-metadata cache, task registry).
287
+ *
288
+ * @example
289
+ * ```ts
290
+ * import { Pool } from 'pg';
291
+ * import {
292
+ * createAdcpServerFromPlatform,
293
+ * getAllAdcpMigrations,
294
+ * } from '@adcp/sdk/server';
295
+ *
296
+ * const pool = new Pool({ connectionString: process.env.DATABASE_URL });
297
+ * await pool.query(getAllAdcpMigrations());
298
+ *
299
+ * const server = createAdcpServerFromPlatform(myPlatform, {
300
+ * name: 'my-agent',
301
+ * version: '1.0.0',
302
+ * pool, // wires all three persistence stores
303
+ * });
304
+ * ```
305
+ *
306
+ * **Memory-only deployment:** omit `pool` entirely. Framework defaults to
307
+ * in-memory backends for all three (fine for dev / single-process; not
308
+ * suitable for cluster).
309
+ */
310
+ pool?: PgQueryable;
311
+ /**
312
+ * Ctx-metadata store. Wire to enable the v6.1 `ctx_metadata` round-trip
313
+ * cache: publishers attach opaque platform-specific blobs to any returned
314
+ * resource (`{ product_id, ctx_metadata: { gam: {...} } }`); the framework
315
+ * persists by `(account.id, kind, id)` and threads back into
316
+ * `ctx.ctxMetadata` on subsequent calls referencing the same ID.
317
+ *
318
+ * Memory backend (`memoryCtxMetadataStore()`) for dev / single-process.
319
+ * Postgres (`pgCtxMetadataStore(pool)`) for cluster — silent ctx_metadata
320
+ * loss after rolling restart on memory backend produces "package not
321
+ * found" errors that look like publisher bugs and run for weeks.
322
+ *
323
+ * @example
324
+ * ```ts
325
+ * import { Pool } from 'pg';
326
+ * import {
327
+ * createAdcpServerFromPlatform,
328
+ * createCtxMetadataStore,
329
+ * pgCtxMetadataStore,
330
+ * getCtxMetadataMigration,
331
+ * } from '@adcp/sdk/server';
332
+ *
333
+ * const pool = new Pool({ connectionString: process.env.DATABASE_URL });
334
+ * await pool.query(getCtxMetadataMigration());
335
+ *
336
+ * const ctxMetadata = createCtxMetadataStore({ backend: pgCtxMetadataStore(pool) });
337
+ *
338
+ * createAdcpServerFromPlatform(myPlatform, {
339
+ * name: 'My Adapter',
340
+ * version: '1.0.0',
341
+ * ctxMetadata,
342
+ * });
343
+ * ```
344
+ *
345
+ * @see docs/proposals/decisioning-platform-v6-1-ctx-metadata.md
346
+ */
347
+ ctxMetadata?: CtxMetadataStore;
348
+ /**
349
+ * Allow `push_notification_config.url` to point at loopback / private-IP
350
+ * destinations. Default is `false` — the framework's request-ingest
351
+ * validator rejects loopback (`localhost`, `127.0.0.0/8`, `::1`),
352
+ * RFC 1918 / CGNAT / link-local ranges, and IPv4-mapped IPv6 forms
353
+ * targeting any of those, since accepting them at production webhook
354
+ * endpoints is a SSRF / cloud-metadata exfiltration path.
355
+ *
356
+ * Set `true` for sandbox / local-testing deployments where
357
+ * adopter-controlled receivers (storyboard webhook receivers, pytest
358
+ * httptest fixtures) bind to `127.0.0.1:<ephemeral>`. The flag bypasses
359
+ * ONLY the private-range branch — malformed-URL, non-http(s) scheme,
360
+ * and the `http://` reject (separately gated by NODE_ENV / the
361
+ * `ADCP_DECISIONING_ALLOW_HTTP_WEBHOOKS` env) all still fire.
362
+ *
363
+ * Adopters typically scope this themselves on `NODE_ENV !== 'production'`
364
+ * or a sandbox env flag — the framework doesn't auto-enable it because
365
+ * the safe default is "reject private destinations." When the flag is
366
+ * `true` AND `NODE_ENV` is unset / `'production'`, the framework emits
367
+ * a one-shot console.warn at construction calling out the relaxation.
368
+ */
369
+ allowPrivateWebhookUrls?: boolean;
370
+ /**
371
+ * Auto-fire a completion webhook on the sync-success arm of mutating
372
+ * tools when the request supplied `push_notification_config.url`.
373
+ * Default is `true` — buyers passing the URL expect notification
374
+ * regardless of whether the seller routed the call sync vs HITL, and
375
+ * v5 adopters routinely wired this manually inside every handler.
376
+ * The framework now does it for them.
377
+ *
378
+ * Webhook payload mirrors the HITL completion shape: top-level
379
+ * `task_type` (the wire tool name), `status: 'completed'`, and
380
+ * `result` carrying the projected sync response. `task_id` is
381
+ * synthesized per call (sync responses don't allocate a registry
382
+ * task); buyers correlate via the resource IDs (`media_buy_id`,
383
+ * `creative_id`, etc.) on `result`.
384
+ *
385
+ * Same `SPEC_WEBHOOK_TASK_TYPES` gate as the HITL path: tools outside
386
+ * the closed wire enum don't emit (adopters use `publishStatusChange`
387
+ * for those). Sync auto-emit and the HITL path share the same
388
+ * `emitWebhook` plumbing — host-wired signing, redelivery, and
389
+ * observability hooks all apply uniformly.
390
+ *
391
+ * Set `false` to suppress the auto-emit for adopters who emit
392
+ * webhooks manually inside their handlers (idempotency duplication
393
+ * concern) or for transitional deployments that don't yet have the
394
+ * webhook receiver path stood up.
395
+ */
396
+ autoEmitCompletionWebhooks?: boolean;
397
+ }
398
+ /**
399
+ * Adcp server returned by `createAdcpServerFromPlatform`. Adds task-state
400
+ * accessors on top of the standard `AdcpServer` so test harnesses (and the
401
+ * forthcoming `tasks/get` wire handler) can inspect lifecycle.
402
+ */
403
+ export interface DecisioningAdcpServer extends AdcpServer {
404
+ /**
405
+ * Read the current lifecycle state for a HITL task. Returns `null` if the
406
+ * `taskId` is unknown OR (when `expectedAccountId` is supplied) the
407
+ * task's owning account doesn't match.
408
+ *
409
+ * **Multi-tenant isolation: pass `expectedAccountId` whenever the caller
410
+ * has a buyer-derived account in scope.** Adopters wrapping this method
411
+ * in a `tasks/get` wire handler MUST pass `ctx.account.id` to scope reads
412
+ * — without it, any caller with a known `task_id` reads any tenant's
413
+ * task lifecycle, including its `result` and `error` payloads. The
414
+ * unscoped form (single-arg) is for ops / test harnesses that hold no
415
+ * buyer account in scope.
416
+ *
417
+ * Async to accommodate storage-backed task registries
418
+ * (`createPostgresTaskRegistry`); the in-memory impl resolves synchronously.
419
+ */
420
+ getTaskState<TResult = unknown>(taskId: string, expectedAccountId?: string): Promise<TaskRecord<TResult> | null>;
421
+ /**
422
+ * Await any in-flight background completion for `taskId` (HITL handoff
423
+ * function still running). Resolves immediately if the task is terminal
424
+ * or has no registered background. Used by tests + the `tasks/get` wire
425
+ * path for deterministic settlement.
426
+ */
427
+ awaitTask(taskId: string): Promise<void>;
428
+ /**
429
+ * Per-server status-change bus. Delegates to the same internal bus the
430
+ * framework uses for MCP Resources subscription projection.
431
+ *
432
+ * Use `server.statusChange.publish(...)` in tests to push events scoped
433
+ * to this specific server instance — avoids contaminating sibling servers
434
+ * that share the module-level `activeBus` when running multiple servers
435
+ * in the same process. Production webhook/cron code that does not hold a
436
+ * server reference keeps calling the module-level `publishStatusChange(...)`.
437
+ *
438
+ * **Projection wiring contract** (rc.1): when the MCP Resources subscription
439
+ * projection commit lands, the projector MUST fan-in from BOTH this
440
+ * per-server bus AND the module-level `activeBus`. Anchoring the subscriber
441
+ * to only one source silently makes the other call site inert in production
442
+ * — adopters who scope to `server.statusChange.publish(...)` for tenant
443
+ * isolation must still reach buyer-facing subscriptions, and webhook/cron
444
+ * code calling module-level `publishStatusChange(...)` must too.
445
+ */
446
+ statusChange: StatusChangeBus;
447
+ }
448
+ export declare function createAdcpServerFromPlatform<P extends DecisioningPlatform<any, any>>(platform: P & RequiredPlatformsFor<P['capabilities']['specialisms'][number]> & RequiredCapabilitiesFor<P['capabilities']['specialisms'][number]>, opts: CreateAdcpServerFromPlatformOptions): DecisioningAdcpServer;
449
+ /**
450
+ * Merge adopter-supplied custom handlers with platform-derived handlers.
451
+ * Platform-derived wins per-key when both define the same handler; adopter
452
+ * handlers fill any gaps. Returns `undefined` when neither side has any
453
+ * handlers (so the framework knows the domain is unrouted and can omit it
454
+ * from `tools/list`).
455
+ *
456
+ * Used to bridge the gap between v6 specialism interfaces (which model the
457
+ * stable v1.0 surface) and adopter codebases that need to dispatch
458
+ * tools the platform shape doesn't cover yet (getMediaBuys,
459
+ * listCreativeFormats, providePerformanceFeedback, reportUsage,
460
+ * sync_event_sources, log_event, content-standards CRUD, etc.).
461
+ *
462
+ * **Collision detection.** When a custom-supplied handler would be
463
+ * shadowed by a platform-derived one (i.e., the framework added native
464
+ * coverage for a tool the adopter previously filled via the merge seam),
465
+ * the resolver logs a warning by default. Tells adopters to migrate the
466
+ * custom logic into the platform method. Adopters who genuinely want
467
+ * the custom logic to win can pass `mergeSeam: 'silent'` to skip the
468
+ * warning, `'strict'` to throw a `PlatformConfigError`, or `'log-once'`
469
+ * to suppress duplicate warnings across multiple server constructions
470
+ * in the same process (multi-tenant deployments, hot-reload dev).
471
+ */
472
+ type MergeSeamMode = 'warn' | 'log-once' | 'silent' | 'strict';
473
+ /**
474
+ * Build the default in-memory task registry, gated by NODE_ENV.
475
+ *
476
+ * The in-memory registry loses task state on process restart — fine for
477
+ * tests and local dev, NOT fine for production. Gate via allowlist:
478
+ * `NODE_ENV` must be `'test'` or `'development'`, OR the operator must
479
+ * explicitly opt in via `ADCP_DECISIONING_ALLOW_INMEMORY_TASKS=1`.
480
+ *
481
+ * Pattern follows `feedback_node_env_allowlist.md`: never compare
482
+ * `=== 'production'` (production may unset NODE_ENV entirely); always
483
+ * allowlist the safe modes.
484
+ */
485
+ /**
486
+ * Combined DDL for all framework persistence tables: idempotency cache,
487
+ * ctx-metadata cache, and decisioning task registry. Run once per database
488
+ * during deployment / boot. Idempotent — safe to re-run.
489
+ *
490
+ * Use with the `pool` shortcut on `createAdcpServerFromPlatform`:
491
+ *
492
+ * ```ts
493
+ * const pool = new Pool({ connectionString: process.env.DATABASE_URL });
494
+ * await pool.query(getAllAdcpMigrations());
495
+ *
496
+ * createAdcpServerFromPlatform(myPlatform, {
497
+ * name: '...', version: '...',
498
+ * pool,
499
+ * });
500
+ * ```
501
+ *
502
+ * Adopters who don't use the `pool` shortcut should call the per-store
503
+ * migration helpers (`getIdempotencyMigration`, `getCtxMetadataMigration`,
504
+ * `getDecisioningTaskRegistryMigration`) only for the stores they wire.
505
+ *
506
+ * @public
507
+ */
508
+ export declare function getAllAdcpMigrations(): string;
509
+ export {};
510
+ //# sourceMappingURL=from-platform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"from-platform.d.ts","sourceRoot":"","sources":["../../../../../src/lib/server/decisioning/runtime/from-platform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAEL,KAAK,gBAAgB,EAQrB,KAAK,cAAc,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtG,OAAO,KAAK,EAAE,OAAO,EAAoB,MAAM,YAAY,CAAC;AAkB5D,OAAO,EACL,KAAK,gBAAgB,EAMtB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAG7D,OAAO,EAA8B,KAAK,YA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