@adcp/sdk 14.0.0-rc.41 → 14.0.0-rc.43

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 (250) hide show
  1. package/CONTRIBUTING.md +7 -1
  2. package/README.md +13 -0
  3. package/bin/adcp-grade.js +4 -3
  4. package/bin/adcp-storyboard-summary.js +1 -1
  5. package/bin/adcp.js +85 -22
  6. package/dist/lib/acceptance-policy/index.d.mts +176 -0
  7. package/dist/lib/acceptance-policy/index.d.ts +176 -0
  8. package/dist/lib/acceptance-policy/index.js +1107 -0
  9. package/dist/lib/acceptance-policy/index.mjs +1080 -0
  10. package/dist/lib/canonical-references/index.d.mts +1 -1
  11. package/dist/lib/canonical-references/index.d.ts +1 -1
  12. package/dist/lib/canonical-references/index.js +60 -2
  13. package/dist/lib/canonical-references/index.mjs +60 -2
  14. package/dist/lib/client/core.d.mts +8 -0
  15. package/dist/lib/client/core.d.ts +8 -0
  16. package/dist/lib/client/core.js +57 -0
  17. package/dist/lib/client/core.mjs +38 -0
  18. package/dist/lib/conformance/index.d.mts +2 -0
  19. package/dist/lib/conformance/index.d.ts +2 -0
  20. package/dist/lib/conformance/index.js +7 -0
  21. package/dist/lib/conformance/index.mjs +8 -0
  22. package/dist/lib/conformance/targeting.d.mts +72 -0
  23. package/dist/lib/conformance/targeting.d.ts +72 -0
  24. package/dist/lib/conformance/targeting.js +163 -0
  25. package/dist/lib/conformance/targeting.mjs +137 -0
  26. package/dist/lib/core/ADCPMultiAgentClient.d.mts +5 -1
  27. package/dist/lib/core/ADCPMultiAgentClient.d.ts +5 -1
  28. package/dist/lib/core/ADCPMultiAgentClient.js +8 -0
  29. package/dist/lib/core/ADCPMultiAgentClient.mjs +8 -0
  30. package/dist/lib/core/AgentClient.d.mts +37 -3
  31. package/dist/lib/core/AgentClient.d.ts +37 -3
  32. package/dist/lib/core/AgentClient.js +69 -4
  33. package/dist/lib/core/AgentClient.mjs +56 -2
  34. package/dist/lib/core/AsyncHandler.d.mts +3 -1
  35. package/dist/lib/core/AsyncHandler.d.ts +3 -1
  36. package/dist/lib/core/AsyncHandler.js +6 -0
  37. package/dist/lib/core/AsyncHandler.mjs +6 -0
  38. package/dist/lib/core/SingleAgentClient.d.mts +5 -1
  39. package/dist/lib/core/SingleAgentClient.d.ts +5 -1
  40. package/dist/lib/core/SingleAgentClient.js +51 -10
  41. package/dist/lib/core/SingleAgentClient.mjs +56 -10
  42. package/dist/lib/errors/index.d.mts +4 -1
  43. package/dist/lib/errors/index.d.ts +4 -1
  44. package/dist/lib/errors/index.js +6 -1
  45. package/dist/lib/errors/index.mjs +6 -1
  46. package/dist/lib/index.d.mts +3 -1
  47. package/dist/lib/index.d.ts +3 -1
  48. package/dist/lib/index.js +13 -0
  49. package/dist/lib/index.mjs +14 -1
  50. package/dist/lib/media-buy/action-assessment.js +7 -0
  51. package/dist/lib/media-buy/action-assessment.mjs +7 -0
  52. package/dist/lib/media-buy/available-actions.d.mts +8 -1
  53. package/dist/lib/media-buy/available-actions.d.ts +8 -1
  54. package/dist/lib/media-buy/available-actions.js +18 -3
  55. package/dist/lib/media-buy/available-actions.mjs +15 -2
  56. package/dist/lib/media-buy/index.d.mts +1 -0
  57. package/dist/lib/media-buy/index.d.ts +1 -0
  58. package/dist/lib/media-buy/preflight.js +23 -12
  59. package/dist/lib/media-buy/preflight.mjs +25 -13
  60. package/dist/lib/net/ssrf-fetch.d.mts +1 -1
  61. package/dist/lib/net/ssrf-fetch.d.ts +1 -1
  62. package/dist/lib/net/ssrf-fetch.js +10 -1
  63. package/dist/lib/net/ssrf-fetch.mjs +10 -1
  64. package/dist/lib/principal/index.d.mts +1 -0
  65. package/dist/lib/principal/index.d.ts +1 -0
  66. package/dist/lib/principal/index.js +32 -0
  67. package/dist/lib/principal/index.mjs +10 -0
  68. package/dist/lib/principal/lifecycle.d.mts +77 -0
  69. package/dist/lib/principal/lifecycle.d.ts +77 -0
  70. package/dist/lib/principal/lifecycle.js +319 -0
  71. package/dist/lib/principal/lifecycle.mjs +293 -0
  72. package/dist/lib/protocols/transportDiagnostics.d.mts +2 -0
  73. package/dist/lib/protocols/transportDiagnostics.d.ts +2 -0
  74. package/dist/lib/protocols/transportDiagnostics.js +60 -20
  75. package/dist/lib/protocols/transportDiagnostics.mjs +61 -21
  76. package/dist/lib/registry/index.d.mts +3 -1
  77. package/dist/lib/registry/index.d.ts +3 -1
  78. package/dist/lib/registry/index.js +16 -3
  79. package/dist/lib/registry/index.mjs +16 -3
  80. package/dist/lib/registry/types.generated.d.mts +54 -20
  81. package/dist/lib/registry/types.generated.d.ts +54 -20
  82. package/dist/lib/reporting/core-reconciliation.d.mts +65 -0
  83. package/dist/lib/reporting/core-reconciliation.d.ts +65 -0
  84. package/dist/lib/reporting/core-reconciliation.js +148 -0
  85. package/dist/lib/reporting/core-reconciliation.mjs +124 -0
  86. package/dist/lib/reporting/index.d.mts +2 -0
  87. package/dist/lib/reporting/index.d.ts +2 -0
  88. package/dist/lib/reporting/index.js +5 -2
  89. package/dist/lib/reporting/index.mjs +3 -1
  90. package/dist/lib/reporting/ledger/handler.js +67 -11
  91. package/dist/lib/reporting/ledger/handler.mjs +69 -12
  92. package/dist/lib/reporting/ledger/health.d.mts +26 -2
  93. package/dist/lib/reporting/ledger/health.d.ts +26 -2
  94. package/dist/lib/reporting/ledger/health.js +3 -5
  95. package/dist/lib/reporting/ledger/health.mjs +3 -5
  96. package/dist/lib/reporting/ledger/producer.js +4 -9
  97. package/dist/lib/reporting/ledger/producer.mjs +4 -9
  98. package/dist/lib/reporting/ledger/status-ingest.js +1 -1
  99. package/dist/lib/reporting/ledger/status-ingest.mjs +1 -1
  100. package/dist/lib/reporting/reconciliation.d.mts +4 -9
  101. package/dist/lib/reporting/reconciliation.d.ts +4 -9
  102. package/dist/lib/reporting/reconciliation.js +5 -5
  103. package/dist/lib/reporting/reconciliation.mjs +5 -5
  104. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  105. package/dist/lib/server/create-adcp-server.d.mts +10 -11
  106. package/dist/lib/server/create-adcp-server.d.ts +10 -11
  107. package/dist/lib/server/create-adcp-server.js +39 -25
  108. package/dist/lib/server/create-adcp-server.mjs +44 -27
  109. package/dist/lib/server/decisioning/runtime/from-platform.js +16 -3
  110. package/dist/lib/server/decisioning/runtime/from-platform.mjs +16 -3
  111. package/dist/lib/server/index.d.mts +4 -1
  112. package/dist/lib/server/index.d.ts +4 -1
  113. package/dist/lib/server/index.js +9 -0
  114. package/dist/lib/server/index.mjs +10 -0
  115. package/dist/lib/server/mcp-app.d.mts +11 -24
  116. package/dist/lib/server/mcp-app.d.ts +11 -24
  117. package/dist/lib/server/mcp-app.js +30 -4
  118. package/dist/lib/server/mcp-app.mjs +30 -3
  119. package/dist/lib/server/mcp-modern-server.js +18 -14
  120. package/dist/lib/server/mcp-modern-server.mjs +25 -15
  121. package/dist/lib/server/media-buy-actions.js +3 -1
  122. package/dist/lib/server/media-buy-actions.mjs +3 -1
  123. package/dist/lib/server/notification-subscriptions/index.d.mts +1 -1
  124. package/dist/lib/server/notification-subscriptions/index.d.ts +1 -1
  125. package/dist/lib/server/notification-subscriptions/runtime.d.mts +3 -1
  126. package/dist/lib/server/notification-subscriptions/runtime.d.ts +3 -1
  127. package/dist/lib/server/notification-subscriptions/runtime.js +108 -64
  128. package/dist/lib/server/notification-subscriptions/runtime.mjs +107 -64
  129. package/dist/lib/server/notification-subscriptions/types.d.mts +41 -0
  130. package/dist/lib/server/notification-subscriptions/types.d.ts +41 -0
  131. package/dist/lib/server/principal/index.d.mts +5 -0
  132. package/dist/lib/server/principal/index.d.ts +5 -0
  133. package/dist/lib/server/principal/index.js +35 -0
  134. package/dist/lib/server/principal/index.mjs +12 -0
  135. package/dist/lib/server/principal/runtime.d.mts +57 -0
  136. package/dist/lib/server/principal/runtime.d.ts +57 -0
  137. package/dist/lib/server/principal/runtime.js +880 -0
  138. package/dist/lib/server/principal/runtime.mjs +861 -0
  139. package/dist/lib/server/principal/store.d.mts +16 -0
  140. package/dist/lib/server/principal/store.d.ts +16 -0
  141. package/dist/lib/server/principal/store.js +248 -0
  142. package/dist/lib/server/principal/store.mjs +223 -0
  143. package/dist/lib/server/principal/types.d.mts +142 -0
  144. package/dist/lib/server/principal/types.d.ts +142 -0
  145. package/dist/lib/server/principal/types.js +16 -0
  146. package/dist/lib/server/principal/types.mjs +0 -0
  147. package/dist/lib/signing/agent-resolver/strict-json.d.mts +11 -0
  148. package/dist/lib/signing/agent-resolver/strict-json.d.ts +11 -0
  149. package/dist/lib/signing/agent-resolver/strict-json.js +6 -4
  150. package/dist/lib/signing/agent-resolver/strict-json.mjs +4 -3
  151. package/dist/lib/testing/compliance/comply.js +44 -0
  152. package/dist/lib/testing/compliance/comply.mjs +43 -0
  153. package/dist/lib/testing/storyboard/agent-routing.d.mts +2 -0
  154. package/dist/lib/testing/storyboard/agent-routing.d.ts +2 -0
  155. package/dist/lib/testing/storyboard/agent-routing.js +31 -4
  156. package/dist/lib/testing/storyboard/agent-routing.mjs +30 -4
  157. package/dist/lib/testing/storyboard/junit.d.mts +1 -1
  158. package/dist/lib/testing/storyboard/junit.d.ts +1 -1
  159. package/dist/lib/testing/storyboard/junit.js +25 -10
  160. package/dist/lib/testing/storyboard/junit.mjs +23 -9
  161. package/dist/lib/testing/storyboard/request-signing/a2a-dispatch.d.mts +118 -0
  162. package/dist/lib/testing/storyboard/request-signing/a2a-dispatch.d.ts +118 -0
  163. package/dist/lib/testing/storyboard/request-signing/a2a-dispatch.js +180 -0
  164. package/dist/lib/testing/storyboard/request-signing/a2a-dispatch.mjs +144 -0
  165. package/dist/lib/testing/storyboard/request-signing/builder.d.mts +21 -1
  166. package/dist/lib/testing/storyboard/request-signing/builder.d.ts +21 -1
  167. package/dist/lib/testing/storyboard/request-signing/builder.js +22 -0
  168. package/dist/lib/testing/storyboard/request-signing/builder.mjs +22 -0
  169. package/dist/lib/testing/storyboard/request-signing/grader.d.mts +5 -6
  170. package/dist/lib/testing/storyboard/request-signing/grader.d.ts +5 -6
  171. package/dist/lib/testing/storyboard/request-signing/grader.js +79 -8
  172. package/dist/lib/testing/storyboard/request-signing/grader.mjs +79 -8
  173. package/dist/lib/testing/storyboard/request-signing/index.d.mts +1 -0
  174. package/dist/lib/testing/storyboard/request-signing/index.d.ts +1 -0
  175. package/dist/lib/testing/storyboard/request-signing/index.js +7 -0
  176. package/dist/lib/testing/storyboard/request-signing/index.mjs +8 -0
  177. package/dist/lib/testing/storyboard/request-signing/probe-dispatch.d.mts +10 -29
  178. package/dist/lib/testing/storyboard/request-signing/probe-dispatch.d.ts +10 -29
  179. package/dist/lib/testing/storyboard/request-signing/probe-dispatch.js +49 -5
  180. package/dist/lib/testing/storyboard/request-signing/probe-dispatch.mjs +39 -5
  181. package/dist/lib/testing/storyboard/runner.js +28 -2
  182. package/dist/lib/testing/storyboard/runner.mjs +18 -2
  183. package/dist/lib/testing/storyboard/types.d.mts +8 -19
  184. package/dist/lib/testing/storyboard/types.d.ts +8 -19
  185. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  186. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  187. package/dist/lib/types/index.d.mts +11 -2
  188. package/dist/lib/types/index.d.ts +11 -2
  189. package/dist/lib/types/schemas.generated.d.ts +8 -8
  190. package/dist/lib/types/schemas.generated.js +17 -0
  191. package/dist/lib/types/schemas.generated.mjs +17 -0
  192. package/dist/lib/utils/idempotency.d.mts +4 -2
  193. package/dist/lib/utils/idempotency.d.ts +4 -2
  194. package/dist/lib/utils/idempotency.js +41 -22
  195. package/dist/lib/utils/idempotency.mjs +41 -22
  196. package/dist/lib/utils/media-buy-status.js +3 -2
  197. package/dist/lib/utils/media-buy-status.mjs +3 -2
  198. package/dist/lib/utils/reporting-status-response.js +2 -2
  199. package/dist/lib/utils/reporting-status-response.mjs +2 -2
  200. package/dist/lib/utils/response-schema-cache.d.mts +3 -0
  201. package/dist/lib/utils/response-schema-cache.d.ts +3 -0
  202. package/dist/lib/utils/response-schema-cache.js +45 -0
  203. package/dist/lib/utils/response-schema-cache.mjs +20 -0
  204. package/dist/lib/utils/response-schemas.js +2 -0
  205. package/dist/lib/utils/response-schemas.mjs +2 -0
  206. package/dist/lib/utils/response-unwrapper.d.mts +1 -1
  207. package/dist/lib/utils/response-unwrapper.d.ts +1 -1
  208. package/dist/lib/utils/response-unwrapper.js +15 -8
  209. package/dist/lib/utils/response-unwrapper.mjs +14 -2
  210. package/dist/lib/v2/projection/v1-to-v2.js +2 -2
  211. package/dist/lib/v2/projection/v1-to-v2.mjs +6 -1
  212. package/dist/lib/validation/schema-loader.js +13 -6
  213. package/dist/lib/validation/schema-loader.mjs +13 -6
  214. package/dist/lib/version.d.mts +3 -3
  215. package/dist/lib/version.d.ts +3 -3
  216. package/dist/lib/version.js +3 -3
  217. package/dist/lib/version.mjs +3 -3
  218. package/dist/lib/wholesale-feed-sync/index.d.mts +3 -1
  219. package/dist/lib/wholesale-feed-sync/index.d.ts +3 -1
  220. package/dist/lib/wholesale-feed-sync/index.js +7 -2
  221. package/dist/lib/wholesale-feed-sync/index.mjs +4 -1
  222. package/dist/lib/wholesale-feed-sync/register.d.mts +49 -0
  223. package/dist/lib/wholesale-feed-sync/register.d.ts +49 -0
  224. package/dist/lib/wholesale-feed-sync/register.js +115 -0
  225. package/dist/lib/wholesale-feed-sync/register.mjs +90 -0
  226. package/dist/lib/wholesale-feed-sync/sync.d.mts +7 -0
  227. package/dist/lib/wholesale-feed-sync/sync.d.ts +7 -0
  228. package/dist/lib/wholesale-feed-sync/sync.js +161 -4
  229. package/dist/lib/wholesale-feed-sync/sync.mjs +161 -4
  230. package/dist/lib/wholesale-feed-sync/types.d.mts +51 -1
  231. package/dist/lib/wholesale-feed-sync/types.d.ts +51 -1
  232. package/docs/TYPE-SUMMARY.md +10 -2
  233. package/docs/guides/ACCEPTANCE-POLICY-DISCOVERY.md +104 -0
  234. package/docs/guides/BUILD-AN-AGENT.md +7 -5
  235. package/docs/guides/EXISTING-PLATFORM.md +61 -33
  236. package/docs/guides/MEDIA-BUY-3.2-COMPATIBILITY.md +27 -1
  237. package/docs/guides/PERSISTENT-NOTIFICATION-RUNTIME.md +7 -7
  238. package/docs/guides/PRINCIPAL-LIFECYCLE.md +236 -0
  239. package/docs/guides/PRODUCTION-DURABILITY.md +4 -0
  240. package/docs/guides/REPORTING-LEDGER.md +3 -1
  241. package/docs/guides/REPORTING-RECONCILIATION.md +96 -1
  242. package/docs/guides/VALIDATE-YOUR-AGENT.md +28 -4
  243. package/docs/llms.txt +3 -3
  244. package/docs/migration-14.x-rc-worksheet.md +4 -4
  245. package/examples/README.md +13 -0
  246. package/examples/existing-platform-thin.ts +29 -1
  247. package/examples/targeting-input-existing-platform.ts +2 -8
  248. package/examples/wholesale-feed-sync.ts +274 -0
  249. package/package.json +17 -1
  250. package/skills/build-seller-agent/specialisms/signed-requests.md +1 -1
package/CONTRIBUTING.md CHANGED
@@ -109,7 +109,13 @@ The Node test runner otherwise derives concurrency from the machine CPU count. T
109
109
  too aggressive on developer workstations because several test files launch their own
110
110
  TypeScript compiler or CLI subprocesses. The repository runner therefore caps local
111
111
  fast suites at two workers and runs the slow group serially. CI keeps its existing
112
- machine-derived concurrency and splits the fast suite into three shards.
112
+ machine-derived concurrency and splits the fast suite into three shards. Those CI
113
+ shards use per-file durations recorded by the latest successful `main` run and a
114
+ deterministic longest-first assignment. A new or renamed test uses the median known
115
+ duration; when no history is available, all files use an equal one-second weight.
116
+ Pull requests may restore this history but cannot publish it, so untrusted or failed
117
+ runs cannot poison future shard assignments. Each shard uploads its assignment
118
+ manifest with the timing artifact for debugging.
113
119
 
114
120
  `npm test` and `npm run test:lib` build the library once before starting their test
115
121
  groups, then every test reads that completed `dist/` tree. Set `TEST_CONCURRENCY=1`
package/README.md CHANGED
@@ -59,6 +59,19 @@ Large workspaces should keep the generated schema surface out of the default typ
59
59
  | Runtime Zod schemas and tool schema maps | `@adcp/sdk/schemas` |
60
60
  | Broad generated protocol type barrel | `@adcp/sdk/types` |
61
61
 
62
+ ### Focused client runtime (`@adcp/sdk/client/core`)
63
+
64
+ Applications that only call AdCP agents can avoid evaluating the SDK's server,
65
+ compliance, testing, and unrelated protocol surfaces:
66
+
67
+ ```ts
68
+ import { ADCPMultiAgentClient, InMemoryWebhookRegistrationStore } from '@adcp/sdk/client/core';
69
+ ```
70
+
71
+ The existing `@adcp/sdk/client` path remains an alias of the package root for
72
+ compatibility. Use `/client/core` when cold import and test-worker startup time
73
+ matter.
74
+
62
75
  For application monorepos, keep `skipLibCheck: true` unless you are intentionally auditing SDK declarations. If a package only needs request/response types for a few tools, prefer the per-tool slices over importing generated types through the root package or the broad `@adcp/sdk/types` barrel.
63
76
 
64
77
  ## Quick Start: AdCP 3.2
package/bin/adcp-grade.js CHANGED
@@ -43,7 +43,8 @@ Options:
43
43
  --transport <mode> \`mcp\` (default) wraps each vector body in a
44
44
  JSON-RPC tools/call envelope and posts to the
45
45
  agent's MCP mount (see #612); \`raw\` posts to
46
- per-operation AdCP endpoints (REST-binding agents).
46
+ per-operation AdCP endpoints (REST-binding agents);
47
+ \`a2a\` signs the official A2A client's request.
47
48
  --timeout <ms> Per-probe timeout (default 10000)
48
49
  --json Emit the full GradeReport as JSON
49
50
  -h, --help Show this help
@@ -199,8 +200,8 @@ async function runRequestSigningGrader(args) {
199
200
  break;
200
201
  case '--transport': {
201
202
  const mode = args[++i];
202
- if (mode !== 'raw' && mode !== 'mcp') {
203
- console.error(`ERROR: --transport must be \"raw\" or \"mcp\", got \"${mode}\"\n`);
203
+ if (mode !== 'raw' && mode !== 'mcp' && mode !== 'a2a') {
204
+ console.error(`ERROR: --transport must be \"raw\", \"mcp\", or \"a2a\", got \"${mode}\"\n`);
204
205
  process.exit(2);
205
206
  }
206
207
  options.transport = mode;
@@ -350,7 +350,7 @@ function formatStepVerdictLines(step, options = {}) {
350
350
  return [`${step?.passed ? '✅ Passed' : '❌ Failed'}${suffix}`];
351
351
  }
352
352
 
353
- const SIGNING_TRANSPORTS = ['raw', 'mcp'];
353
+ const SIGNING_TRANSPORTS = ['raw', 'mcp', 'a2a'];
354
354
 
355
355
  // Tokens only ever passed as a (rejected) value for a boolean flag — no
356
356
  // storyboard id or agent URL looks like these, so treating them as a misuse
package/bin/adcp.js CHANGED
@@ -57,7 +57,10 @@ const {
57
57
  } = require('./adcp-storyboard-summary.js');
58
58
 
59
59
  const { scheduleVersionCheck } = require('./adcp-version-check.js');
60
- const { formatStoryboardResultsAsJUnit } = require('../dist/lib/testing/storyboard/junit.js');
60
+ const {
61
+ formatStoryboardResultsAsJUnit,
62
+ routedStoryboardResultGroup,
63
+ } = require('../dist/lib/testing/storyboard/junit.js');
61
64
  const { ADCP_VERSION, LIBRARY_VERSION } = require('../dist/lib/version.js');
62
65
  const { isAdcpVersionSupported } = require('../dist/lib/utils/adcp-version-config.js');
63
66
  const { appendBuiltInVersionUnsupportedHint } = require('./adcp-version-unsupported-hint.js');
@@ -2180,17 +2183,15 @@ WEBHOOK OPTIONS:
2180
2183
  HTTP-on-the-wire — spec-compliant.
2181
2184
 
2182
2185
  REQUEST-SIGNING VECTOR OPTIONS (signed_requests storyboard):
2183
- --signing-transport raw|mcp How the RFC 9421 conformance vectors are
2186
+ --signing-transport raw|mcp|a2a How the RFC 9421 conformance vectors are
2184
2187
  framed on the wire. NOT the same as
2185
2188
  --transport/--protocol, which selects how the
2186
2189
  storyboard itself talks to the agent. Default:
2187
2190
  inferred from the resolved protocol — an MCP
2188
2191
  run wraps each vector in a tools/call envelope
2189
- (mcp); an A2A run reports the vectors
2190
- signing_transport_unavailable (COVERAGE
2191
- UNAVAILABLE; the track cannot pass) because
2192
- the fixtures have no A2A framing. Pass raw for
2193
- agents that
2192
+ (mcp); an A2A run signs the exact request the
2193
+ official A2A client emits after Agent Card
2194
+ discovery. Pass raw for agents that
2194
2195
  expose AdCP tools as per-operation HTTP
2195
2196
  endpoints. Mirrors
2196
2197
  \`adcp grade request-signing --transport\`.
@@ -2919,7 +2920,7 @@ async function handleStoryboardRun(args) {
2919
2920
  'Usage: adcp storyboard run <agent> [storyboard_id|--file path] [options]\n' +
2920
2921
  ' Local agent: adcp storyboard run --local-agent <module> [storyboard_id|bundle_id]\n' +
2921
2922
  ' Multi-instance: adcp storyboard run --url <url1> --url <url2> <storyboard_id|bundle_id>\n' +
2922
- ' Multi-agent: adcp storyboard run --agents-map ./agents.yaml <storyboard_id|bundle_id>'
2923
+ ' Multi-agent: adcp storyboard run --agents-map ./agents.yaml [storyboard_id|bundle_id]'
2923
2924
  );
2924
2925
  process.exit(2);
2925
2926
  }
@@ -4640,9 +4641,8 @@ async function handleMultiInstanceStoryboardRun(args, opts, urls) {
4640
4641
  * `get_adcp_capabilities`; tools without a unique claimant fall through to
4641
4642
  * `--default-agent`, or fail-fast with `unroutable_task`.
4642
4643
  *
4643
- * Capability-driven full assessment is intentionally not supported here —
4644
- * the assessment dispatches via `comply()` which expects a single agent.
4645
- * Storyboard ID, bundle ID, or `--file` is required.
4644
+ * With no storyboard or file, every tenant is discovered first and the
4645
+ * topology runs the union of capability-applicable storyboards.
4646
4646
  */
4647
4647
  async function handleAgentsRoutedStoryboardRun(args, opts, routing) {
4648
4648
  const { authToken, authScheme, protocolFlag, jsonOutput, dryRun, positionalArgs, file: filePath, format } = opts;
@@ -4671,17 +4671,11 @@ async function handleAgentsRoutedStoryboardRun(args, opts, routing) {
4671
4671
  }
4672
4672
 
4673
4673
  const storyboardId = firstPositional;
4674
+ const capabilityDriven = !filePath && !storyboardId;
4674
4675
  if (filePath && storyboardId) {
4675
4676
  console.error('ERROR: Cannot combine a storyboard ID with --file. Use one or the other.');
4676
4677
  process.exit(2);
4677
4678
  }
4678
- if (!filePath && !storyboardId) {
4679
- console.error(
4680
- 'ERROR: Multi-agent routing requires a storyboard ID, bundle ID, or --file. ' +
4681
- 'Capability-driven full assessment is not yet routing-aware.'
4682
- );
4683
- process.exit(2);
4684
- }
4685
4679
 
4686
4680
  const { loadStoryboardFile, runStoryboard, getComplianceStoryboardById, loadBundleStoryboards, findBundleById } =
4687
4681
  await import('../dist/lib/testing/storyboard/index.js');
@@ -4694,7 +4688,7 @@ async function handleAgentsRoutedStoryboardRun(args, opts, routing) {
4694
4688
  console.error(`Failed to load storyboard from ${filePath}: ${err.message}`);
4695
4689
  process.exit(2);
4696
4690
  }
4697
- } else {
4691
+ } else if (storyboardId) {
4698
4692
  const bundle = findBundleById(storyboardId, resolveOptions);
4699
4693
  if (bundle) {
4700
4694
  const bundleStoryboards = loadBundleStoryboards(bundle);
@@ -4750,6 +4744,49 @@ async function handleAgentsRoutedStoryboardRun(args, opts, routing) {
4750
4744
 
4751
4745
  await loadInvariantModules(args);
4752
4746
 
4747
+ let routedSelection;
4748
+ let routedSelectionSummary;
4749
+ let routingProfiles;
4750
+ if (capabilityDriven) {
4751
+ const { discoverAgentRouting } = await import('../dist/lib/testing/storyboard/agent-routing.js');
4752
+ const { resolveRoutedAssessment } = await import('../dist/lib/testing/compliance/comply.js');
4753
+ const discoveryOptions = {
4754
+ protocol,
4755
+ ...buildResolvedAuthOption({ resolvedAuth: authToken, resolvedAuthScheme: authScheme || 'bearer' }),
4756
+ ...(opts.allowHttp && { allow_http: true }),
4757
+ agents: routing.agents,
4758
+ ...(routing.default_agent ? { default_agent: routing.default_agent } : {}),
4759
+ ...(runComplianceDir && { complianceDir: runComplianceDir }),
4760
+ ...(runAdcpVersion && { adcpVersion: runAdcpVersion }),
4761
+ ...(runSchemaRoot && { schemaRoot: runSchemaRoot }),
4762
+ ...sandboxRunOptions(opts),
4763
+ ...(requestSigningOpts ?? {}),
4764
+ };
4765
+ const restoreDiscoveryLogs = jsonOutput ? captureStdoutLogs() : null;
4766
+ try {
4767
+ if (!jsonOutput) console.error('Discovering routed agent capabilities...');
4768
+ const routingContext = await discoverAgentRouting(discoveryOptions);
4769
+ routingProfiles = routingContext.profiles;
4770
+ routedSelection = resolveRoutedAssessment(routingProfiles, resolveOptions);
4771
+ routedSelectionSummary = {
4772
+ agents: routedSelection.agents,
4773
+ not_applicable: routedSelection.not_applicable,
4774
+ missing_tools: routedSelection.missing_tools,
4775
+ storyboard_ids: routedSelection.storyboards.map(storyboard => storyboard.id),
4776
+ };
4777
+ storyboards.push(...routedSelection.storyboards);
4778
+ } catch (err) {
4779
+ console.error(`ERROR: Failed to resolve routed assessment: ${err.message}`);
4780
+ process.exit(1);
4781
+ } finally {
4782
+ if (restoreDiscoveryLogs) restoreDiscoveryLogs();
4783
+ }
4784
+ if (storyboards.length === 0) {
4785
+ console.error('ERROR: Routed capability discovery selected no runnable storyboards.');
4786
+ process.exit(1);
4787
+ }
4788
+ }
4789
+
4753
4790
  const totalSteps = storyboards.reduce(
4754
4791
  (sum, sb) => sum + sb.phases.reduce((phaseSum, p) => phaseSum + p.steps.length, 0),
4755
4792
  0
@@ -4779,6 +4816,10 @@ async function handleAgentsRoutedStoryboardRun(args, opts, routing) {
4779
4816
  default_agent: routing.default_agent,
4780
4817
  protocol,
4781
4818
  preview: true,
4819
+ ...(capabilityDriven && {
4820
+ assessment_mode: 'capability-driven',
4821
+ selection: routedSelectionSummary,
4822
+ }),
4782
4823
  storyboards: storyboards.map(sb => ({
4783
4824
  storyboard_id: sb.id,
4784
4825
  storyboard_title: sb.title,
@@ -4801,6 +4842,10 @@ async function handleAgentsRoutedStoryboardRun(args, opts, routing) {
4801
4842
  }
4802
4843
  console.log(`\n${totalSteps} step(s) would be routed at run time. Use without --dry-run to execute.`);
4803
4844
  }
4845
+ if (capabilityDriven) {
4846
+ const { closeConnections } = await import('../dist/lib/protocols/index.js');
4847
+ await closeConnections(protocol);
4848
+ }
4804
4849
  return;
4805
4850
  }
4806
4851
 
@@ -4827,6 +4872,7 @@ async function handleAgentsRoutedStoryboardRun(args, opts, routing) {
4827
4872
  }),
4828
4873
  ...(opts.loadedTestKit !== undefined && { test_kit: opts.loadedTestKit }),
4829
4874
  ...(requestSigningOpts ?? {}),
4875
+ ...(routingProfiles && { _routingProfiles: routingProfiles }),
4830
4876
  };
4831
4877
 
4832
4878
  const restoreLogs = jsonOutput ? captureStdoutLogs() : null;
@@ -4844,7 +4890,12 @@ async function handleAgentsRoutedStoryboardRun(args, opts, routing) {
4844
4890
  }
4845
4891
 
4846
4892
  if (format === 'junit') {
4847
- process.stdout.write(formatStoryboardResultsAsJUnit(results));
4893
+ const suiteGroups = capabilityDriven
4894
+ ? Object.fromEntries(results.map(result => [result.storyboard_id, routedStoryboardResultGroup(result)]))
4895
+ : undefined;
4896
+ process.stdout.write(
4897
+ formatStoryboardResultsAsJUnit(results, suiteGroups ? { suite_groups: suiteGroups } : undefined)
4898
+ );
4848
4899
  if (opts.softFail && hadFailure) {
4849
4900
  printSoftFailBlock(
4850
4901
  results.filter(r => !r.overall_passed).map(r => r.storyboard_id),
@@ -4855,13 +4906,25 @@ async function handleAgentsRoutedStoryboardRun(args, opts, routing) {
4855
4906
  }
4856
4907
 
4857
4908
  if (jsonOutput) {
4909
+ const reports = {};
4910
+ if (capabilityDriven) {
4911
+ for (const result of results) {
4912
+ const group = routedStoryboardResultGroup(result);
4913
+ (reports[group] ??= []).push(result);
4914
+ }
4915
+ }
4858
4916
  await writeJsonOutput(
4859
- results.length === 1
4917
+ !capabilityDriven && results.length === 1
4860
4918
  ? results[0]
4861
4919
  : {
4862
4920
  agents: routing.agents,
4863
4921
  default_agent: routing.default_agent,
4864
- storyboards: results,
4922
+ ...(capabilityDriven && {
4923
+ assessment_mode: 'capability-driven',
4924
+ selection: routedSelectionSummary,
4925
+ reports,
4926
+ }),
4927
+ ...(!capabilityDriven && { storyboards: results }),
4865
4928
  overall_passed: !hadFailure,
4866
4929
  }
4867
4930
  );
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Buyer-side resolution of seller acceptance-policy catalogs.
3
+ *
4
+ * Catalog discovery is advisory. A successfully resolved catalog describes
5
+ * likely seller treatment; it never authorizes an exact media-buy request.
6
+ */
7
+ import type { ResolvePolicyResponse } from '../registry/types.mjs';
8
+ export interface AcceptancePolicyDiscoveryCapability {
9
+ catalog_url: string;
10
+ catalog_digest: string;
11
+ default_profile_ids?: readonly string[];
12
+ }
13
+ export interface AcceptancePolicyReference {
14
+ policy_id: string;
15
+ version: string;
16
+ content_digest: string;
17
+ }
18
+ export interface AcceptancePolicyRule {
19
+ rule_id: string;
20
+ subject_category: string;
21
+ jurisdiction_groups?: string[];
22
+ applies_to: string[];
23
+ disposition: 'allowed' | 'conditional' | 'prohibited';
24
+ policy_ids?: string[];
25
+ [key: string]: unknown;
26
+ }
27
+ export interface AcceptancePolicyProfile {
28
+ profile_id: string;
29
+ version: string;
30
+ content_digest: string;
31
+ policy_refs: AcceptancePolicyReference[];
32
+ coverage: 'partial' | 'complete';
33
+ scope?: {
34
+ jurisdiction_groups?: string[];
35
+ [key: string]: unknown;
36
+ };
37
+ region_aliases?: Record<string, string[]>;
38
+ rules: AcceptancePolicyRule[];
39
+ [key: string]: unknown;
40
+ }
41
+ export interface RegistryAcceptancePolicyProfileReference {
42
+ policy_id: string;
43
+ policy_version: string;
44
+ policy_digest: string;
45
+ profile_id: string;
46
+ profile_version: string;
47
+ profile_digest: string;
48
+ }
49
+ export interface AcceptancePolicyCatalog {
50
+ catalog_version: string;
51
+ generated_at?: string;
52
+ profiles?: AcceptancePolicyProfile[];
53
+ registry_profiles?: RegistryAcceptancePolicyProfileReference[];
54
+ ext?: Record<string, unknown>;
55
+ }
56
+ export type ResolvedAcceptancePolicyDefault = {
57
+ source: 'seller';
58
+ resolution: 'resolved';
59
+ profileId: string;
60
+ profile: AcceptancePolicyProfile;
61
+ } | {
62
+ source: 'registry';
63
+ resolution: 'resolved';
64
+ profileId: string;
65
+ profile: AcceptancePolicyProfile;
66
+ ref: RegistryAcceptancePolicyProfileReference;
67
+ } | {
68
+ source: 'registry';
69
+ resolution: 'unresolved';
70
+ profileId: string;
71
+ ref: RegistryAcceptancePolicyProfileReference;
72
+ };
73
+ export type AcceptancePolicyProfileResolution = ResolvedAcceptancePolicyDefault | {
74
+ source: 'catalog';
75
+ resolution: 'missing';
76
+ profileId: string;
77
+ };
78
+ export type AcceptancePolicyCatalogErrorCode = 'invalid_capability' | 'invalid_options' | 'unsafe_url' | 'redirect_blocked' | 'fetch_failed' | 'http_error' | 'body_too_large' | 'digest_mismatch' | 'invalid_json' | 'catalog_document_invalid' | 'schema_unavailable' | 'schema_invalid' | 'duplicate_profile_id' | 'unresolved_profile_id' | 'profile_canonicalization_invalid' | 'profile_digest_mismatch' | 'reference_invalid' | 'registry_fetch_failed' | 'registry_reference_unresolved' | 'registry_policy_mismatch' | 'registry_policy_unverifiable' | 'registry_policy_digest_mismatch' | 'registry_profile_schema_invalid' | 'registry_profile_invalid' | 'registry_profile_mismatch' | 'registry_profile_digest_mismatch' | 'registry_resolution_limit_exceeded' | 'registry_timeout';
79
+ export interface AcceptancePolicyCatalogIssue {
80
+ code: AcceptancePolicyCatalogErrorCode;
81
+ message: string;
82
+ /** JSON Pointer into the capability or catalog. Values are never echoed. */
83
+ pointer: string;
84
+ keyword?: string;
85
+ retryable?: boolean;
86
+ httpStatus?: number;
87
+ }
88
+ export interface AcceptancePolicyCatalogFailure {
89
+ ok: false;
90
+ fromCache: false;
91
+ error: AcceptancePolicyCatalogIssue;
92
+ issues?: AcceptancePolicyCatalogIssue[];
93
+ }
94
+ export interface AcceptancePolicyCatalogSuccess {
95
+ ok: true;
96
+ fromCache: boolean;
97
+ catalog: AcceptancePolicyCatalog;
98
+ defaultProfiles: ResolvedAcceptancePolicyDefault[];
99
+ /** Non-fatal registry diagnostics. Affected profiles remain unresolved. */
100
+ issues?: AcceptancePolicyCatalogIssue[];
101
+ }
102
+ export type AcceptancePolicyCatalogResult = AcceptancePolicyCatalogSuccess | AcceptancePolicyCatalogFailure;
103
+ /** Registry fields covered by acceptance-policy pin verification. */
104
+ export type AcceptancePolicyRegistryPolicy = Pick<ResolvePolicyResponse, 'policy_id' | 'version' | 'content_digest' | 'canonical_content' | 'acceptance_profile'>;
105
+ /** Minimal trusted-registry surface needed to resolve an immutable policy version. */
106
+ export interface AcceptancePolicyRegistryResolver {
107
+ resolvePolicy(params: {
108
+ policy_id: string;
109
+ version?: string;
110
+ signal?: AbortSignal;
111
+ }): Promise<AcceptancePolicyRegistryPolicy | null>;
112
+ }
113
+ export interface ResolveVerifiedAcceptancePolicyProfilesOptions {
114
+ registryResolver: AcceptancePolicyRegistryResolver;
115
+ /** Schema bundle used to validate embedded profiles. Defaults to the SDK pin. */
116
+ adcpVersion?: string;
117
+ /** Overall deadline for all selected registry lookups. Default 5 seconds. */
118
+ timeoutMs?: number;
119
+ /** Maximum distinct registry profiles resolved in one call. Default and maximum 32. */
120
+ maxRegistryProfiles?: number;
121
+ }
122
+ export interface VerifiedAcceptancePolicyProfilesSuccess {
123
+ ok: true;
124
+ profiles: AcceptancePolicyProfileResolution[];
125
+ /** Per-profile failures. Each affected registry profile remains unresolved. */
126
+ issues?: AcceptancePolicyCatalogIssue[];
127
+ }
128
+ export type VerifiedAcceptancePolicyProfilesResult = VerifiedAcceptancePolicyProfilesSuccess | AcceptancePolicyCatalogFailure;
129
+ export interface ResolveAcceptancePolicyCatalogOptions {
130
+ /** Schema bundle used to validate the fetched catalog. Defaults to the SDK pin. */
131
+ adcpVersion?: string;
132
+ /** Overall DNS/connect/body timeout for the catalog fetch. Default 5 seconds. */
133
+ timeoutMs?: number;
134
+ /** Hard response-body cap. Default and maximum 1 MiB; callers may lower it. */
135
+ maxBodyBytes?: number;
136
+ /** Test/dev-only HTTP opt-in; requires allowPrivateNetwork. Production callers must leave false. */
137
+ allowUnsafeHttp?: boolean;
138
+ /** Test/dev-only opt-in for private-network fixtures. Production callers must leave false. */
139
+ allowPrivateNetwork?: boolean;
140
+ /** Trusted AdCP registry client used to resolve and verify registry-backed defaults. */
141
+ registryResolver?: AcceptancePolicyRegistryResolver;
142
+ /** Overall deadline for registry resolution. Default 5 seconds. */
143
+ registryTimeoutMs?: number;
144
+ /** Maximum registry-backed defaults resolved in one call. Default and maximum 32. */
145
+ maxRegistryProfiles?: number;
146
+ }
147
+ export interface AcceptancePolicyCatalogResolver {
148
+ /**
149
+ * Resolve the currently advertised catalog. A capability change atomically
150
+ * invalidates the resolver's single-entry cache before the next fetch.
151
+ */
152
+ resolve(capability: AcceptancePolicyDiscoveryCapability): Promise<AcceptancePolicyCatalogResult>;
153
+ /** Explicit invalidation hook for a capabilities-changed notification. */
154
+ invalidate(): void;
155
+ }
156
+ /**
157
+ * Resolve seller-local profiles and identify registry pins that still require
158
+ * trusted registry resolution. Missing IDs and unresolved registry references
159
+ * are never represented as usable policy rules.
160
+ */
161
+ export declare function resolveAcceptancePolicyProfiles(catalog: AcceptancePolicyCatalog, profileIds: readonly string[]): AcceptancePolicyProfileResolution[];
162
+ /**
163
+ * Resolve selected seller-local and registry-backed profiles from a catalog
164
+ * already obtained through the digest-pinned catalog resolver. Registry
165
+ * content becomes usable only after both immutable policy and embedded profile
166
+ * pins verify; each failed pin remains unresolved with an issue diagnostic.
167
+ */
168
+ export declare function resolveVerifiedAcceptancePolicyProfiles(catalog: AcceptancePolicyCatalog, profileIds: readonly string[], options: ResolveVerifiedAcceptancePolicyProfilesOptions): Promise<VerifiedAcceptancePolicyProfilesResult>;
169
+ /** Resolve once without retaining remote content. */
170
+ export declare function resolveAcceptancePolicyCatalog(capability: AcceptancePolicyDiscoveryCapability, options?: ResolveAcceptancePolicyCatalogOptions): Promise<AcceptancePolicyCatalogResult>;
171
+ /**
172
+ * Create a capability-lifetime resolver. It retains only the current
173
+ * capability's successful catalog and clears that entry whenever any
174
+ * advertised catalog URL, digest, or default profile changes.
175
+ */
176
+ export declare function createAcceptancePolicyCatalogResolver(options?: ResolveAcceptancePolicyCatalogOptions): AcceptancePolicyCatalogResolver;
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Buyer-side resolution of seller acceptance-policy catalogs.
3
+ *
4
+ * Catalog discovery is advisory. A successfully resolved catalog describes
5
+ * likely seller treatment; it never authorizes an exact media-buy request.
6
+ */
7
+ import type { ResolvePolicyResponse } from '../registry/types';
8
+ export interface AcceptancePolicyDiscoveryCapability {
9
+ catalog_url: string;
10
+ catalog_digest: string;
11
+ default_profile_ids?: readonly string[];
12
+ }
13
+ export interface AcceptancePolicyReference {
14
+ policy_id: string;
15
+ version: string;
16
+ content_digest: string;
17
+ }
18
+ export interface AcceptancePolicyRule {
19
+ rule_id: string;
20
+ subject_category: string;
21
+ jurisdiction_groups?: string[];
22
+ applies_to: string[];
23
+ disposition: 'allowed' | 'conditional' | 'prohibited';
24
+ policy_ids?: string[];
25
+ [key: string]: unknown;
26
+ }
27
+ export interface AcceptancePolicyProfile {
28
+ profile_id: string;
29
+ version: string;
30
+ content_digest: string;
31
+ policy_refs: AcceptancePolicyReference[];
32
+ coverage: 'partial' | 'complete';
33
+ scope?: {
34
+ jurisdiction_groups?: string[];
35
+ [key: string]: unknown;
36
+ };
37
+ region_aliases?: Record<string, string[]>;
38
+ rules: AcceptancePolicyRule[];
39
+ [key: string]: unknown;
40
+ }
41
+ export interface RegistryAcceptancePolicyProfileReference {
42
+ policy_id: string;
43
+ policy_version: string;
44
+ policy_digest: string;
45
+ profile_id: string;
46
+ profile_version: string;
47
+ profile_digest: string;
48
+ }
49
+ export interface AcceptancePolicyCatalog {
50
+ catalog_version: string;
51
+ generated_at?: string;
52
+ profiles?: AcceptancePolicyProfile[];
53
+ registry_profiles?: RegistryAcceptancePolicyProfileReference[];
54
+ ext?: Record<string, unknown>;
55
+ }
56
+ export type ResolvedAcceptancePolicyDefault = {
57
+ source: 'seller';
58
+ resolution: 'resolved';
59
+ profileId: string;
60
+ profile: AcceptancePolicyProfile;
61
+ } | {
62
+ source: 'registry';
63
+ resolution: 'resolved';
64
+ profileId: string;
65
+ profile: AcceptancePolicyProfile;
66
+ ref: RegistryAcceptancePolicyProfileReference;
67
+ } | {
68
+ source: 'registry';
69
+ resolution: 'unresolved';
70
+ profileId: string;
71
+ ref: RegistryAcceptancePolicyProfileReference;
72
+ };
73
+ export type AcceptancePolicyProfileResolution = ResolvedAcceptancePolicyDefault | {
74
+ source: 'catalog';
75
+ resolution: 'missing';
76
+ profileId: string;
77
+ };
78
+ export type AcceptancePolicyCatalogErrorCode = 'invalid_capability' | 'invalid_options' | 'unsafe_url' | 'redirect_blocked' | 'fetch_failed' | 'http_error' | 'body_too_large' | 'digest_mismatch' | 'invalid_json' | 'catalog_document_invalid' | 'schema_unavailable' | 'schema_invalid' | 'duplicate_profile_id' | 'unresolved_profile_id' | 'profile_canonicalization_invalid' | 'profile_digest_mismatch' | 'reference_invalid' | 'registry_fetch_failed' | 'registry_reference_unresolved' | 'registry_policy_mismatch' | 'registry_policy_unverifiable' | 'registry_policy_digest_mismatch' | 'registry_profile_schema_invalid' | 'registry_profile_invalid' | 'registry_profile_mismatch' | 'registry_profile_digest_mismatch' | 'registry_resolution_limit_exceeded' | 'registry_timeout';
79
+ export interface AcceptancePolicyCatalogIssue {
80
+ code: AcceptancePolicyCatalogErrorCode;
81
+ message: string;
82
+ /** JSON Pointer into the capability or catalog. Values are never echoed. */
83
+ pointer: string;
84
+ keyword?: string;
85
+ retryable?: boolean;
86
+ httpStatus?: number;
87
+ }
88
+ export interface AcceptancePolicyCatalogFailure {
89
+ ok: false;
90
+ fromCache: false;
91
+ error: AcceptancePolicyCatalogIssue;
92
+ issues?: AcceptancePolicyCatalogIssue[];
93
+ }
94
+ export interface AcceptancePolicyCatalogSuccess {
95
+ ok: true;
96
+ fromCache: boolean;
97
+ catalog: AcceptancePolicyCatalog;
98
+ defaultProfiles: ResolvedAcceptancePolicyDefault[];
99
+ /** Non-fatal registry diagnostics. Affected profiles remain unresolved. */
100
+ issues?: AcceptancePolicyCatalogIssue[];
101
+ }
102
+ export type AcceptancePolicyCatalogResult = AcceptancePolicyCatalogSuccess | AcceptancePolicyCatalogFailure;
103
+ /** Registry fields covered by acceptance-policy pin verification. */
104
+ export type AcceptancePolicyRegistryPolicy = Pick<ResolvePolicyResponse, 'policy_id' | 'version' | 'content_digest' | 'canonical_content' | 'acceptance_profile'>;
105
+ /** Minimal trusted-registry surface needed to resolve an immutable policy version. */
106
+ export interface AcceptancePolicyRegistryResolver {
107
+ resolvePolicy(params: {
108
+ policy_id: string;
109
+ version?: string;
110
+ signal?: AbortSignal;
111
+ }): Promise<AcceptancePolicyRegistryPolicy | null>;
112
+ }
113
+ export interface ResolveVerifiedAcceptancePolicyProfilesOptions {
114
+ registryResolver: AcceptancePolicyRegistryResolver;
115
+ /** Schema bundle used to validate embedded profiles. Defaults to the SDK pin. */
116
+ adcpVersion?: string;
117
+ /** Overall deadline for all selected registry lookups. Default 5 seconds. */
118
+ timeoutMs?: number;
119
+ /** Maximum distinct registry profiles resolved in one call. Default and maximum 32. */
120
+ maxRegistryProfiles?: number;
121
+ }
122
+ export interface VerifiedAcceptancePolicyProfilesSuccess {
123
+ ok: true;
124
+ profiles: AcceptancePolicyProfileResolution[];
125
+ /** Per-profile failures. Each affected registry profile remains unresolved. */
126
+ issues?: AcceptancePolicyCatalogIssue[];
127
+ }
128
+ export type VerifiedAcceptancePolicyProfilesResult = VerifiedAcceptancePolicyProfilesSuccess | AcceptancePolicyCatalogFailure;
129
+ export interface ResolveAcceptancePolicyCatalogOptions {
130
+ /** Schema bundle used to validate the fetched catalog. Defaults to the SDK pin. */
131
+ adcpVersion?: string;
132
+ /** Overall DNS/connect/body timeout for the catalog fetch. Default 5 seconds. */
133
+ timeoutMs?: number;
134
+ /** Hard response-body cap. Default and maximum 1 MiB; callers may lower it. */
135
+ maxBodyBytes?: number;
136
+ /** Test/dev-only HTTP opt-in; requires allowPrivateNetwork. Production callers must leave false. */
137
+ allowUnsafeHttp?: boolean;
138
+ /** Test/dev-only opt-in for private-network fixtures. Production callers must leave false. */
139
+ allowPrivateNetwork?: boolean;
140
+ /** Trusted AdCP registry client used to resolve and verify registry-backed defaults. */
141
+ registryResolver?: AcceptancePolicyRegistryResolver;
142
+ /** Overall deadline for registry resolution. Default 5 seconds. */
143
+ registryTimeoutMs?: number;
144
+ /** Maximum registry-backed defaults resolved in one call. Default and maximum 32. */
145
+ maxRegistryProfiles?: number;
146
+ }
147
+ export interface AcceptancePolicyCatalogResolver {
148
+ /**
149
+ * Resolve the currently advertised catalog. A capability change atomically
150
+ * invalidates the resolver's single-entry cache before the next fetch.
151
+ */
152
+ resolve(capability: AcceptancePolicyDiscoveryCapability): Promise<AcceptancePolicyCatalogResult>;
153
+ /** Explicit invalidation hook for a capabilities-changed notification. */
154
+ invalidate(): void;
155
+ }
156
+ /**
157
+ * Resolve seller-local profiles and identify registry pins that still require
158
+ * trusted registry resolution. Missing IDs and unresolved registry references
159
+ * are never represented as usable policy rules.
160
+ */
161
+ export declare function resolveAcceptancePolicyProfiles(catalog: AcceptancePolicyCatalog, profileIds: readonly string[]): AcceptancePolicyProfileResolution[];
162
+ /**
163
+ * Resolve selected seller-local and registry-backed profiles from a catalog
164
+ * already obtained through the digest-pinned catalog resolver. Registry
165
+ * content becomes usable only after both immutable policy and embedded profile
166
+ * pins verify; each failed pin remains unresolved with an issue diagnostic.
167
+ */
168
+ export declare function resolveVerifiedAcceptancePolicyProfiles(catalog: AcceptancePolicyCatalog, profileIds: readonly string[], options: ResolveVerifiedAcceptancePolicyProfilesOptions): Promise<VerifiedAcceptancePolicyProfilesResult>;
169
+ /** Resolve once without retaining remote content. */
170
+ export declare function resolveAcceptancePolicyCatalog(capability: AcceptancePolicyDiscoveryCapability, options?: ResolveAcceptancePolicyCatalogOptions): Promise<AcceptancePolicyCatalogResult>;
171
+ /**
172
+ * Create a capability-lifetime resolver. It retains only the current
173
+ * capability's successful catalog and clears that entry whenever any
174
+ * advertised catalog URL, digest, or default profile changes.
175
+ */
176
+ export declare function createAcceptancePolicyCatalogResolver(options?: ResolveAcceptancePolicyCatalogOptions): AcceptancePolicyCatalogResolver;