@adcp/sdk 15.9.0 → 16.0.0-beta.1

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 (295) hide show
  1. package/bin/adcp-identity.js +74 -0
  2. package/bin/adcp.js +2 -0
  3. package/dist/lib/adapters/keyed-account-backend.d.mts +37 -0
  4. package/dist/lib/adapters/keyed-account-backend.d.ts +37 -0
  5. package/dist/lib/adapters/keyed-account-backend.js +121 -0
  6. package/dist/lib/adapters/keyed-account-backend.mjs +94 -0
  7. package/dist/lib/adapters/keyed-account-store.d.mts +28 -0
  8. package/dist/lib/adapters/keyed-account-store.d.ts +28 -0
  9. package/dist/lib/adapters/keyed-account-store.js +227 -0
  10. package/dist/lib/adapters/keyed-account-store.mjs +203 -0
  11. package/dist/lib/core/SingleAgentClient.d.mts +16 -2
  12. package/dist/lib/core/SingleAgentClient.d.ts +16 -2
  13. package/dist/lib/core/SingleAgentClient.js +259 -62
  14. package/dist/lib/core/SingleAgentClient.mjs +261 -57
  15. package/dist/lib/core/TaskExecutor.d.mts +6 -0
  16. package/dist/lib/core/TaskExecutor.d.ts +6 -0
  17. package/dist/lib/core/TaskExecutor.js +66 -5
  18. package/dist/lib/core/TaskExecutor.mjs +71 -5
  19. package/dist/lib/core/postgres-webhook-registration-store.js +32 -5
  20. package/dist/lib/core/postgres-webhook-registration-store.mjs +32 -5
  21. package/dist/lib/core/redis-webhook-registration-store.js +23 -1
  22. package/dist/lib/core/redis-webhook-registration-store.mjs +23 -1
  23. package/dist/lib/core/webhook-registration.d.mts +7 -1
  24. package/dist/lib/core/webhook-registration.d.ts +7 -1
  25. package/dist/lib/core/webhook-registration.js +24 -2
  26. package/dist/lib/core/webhook-registration.mjs +23 -2
  27. package/dist/lib/identity-3.3/index.d.mts +10 -0
  28. package/dist/lib/identity-3.3/index.d.ts +10 -0
  29. package/dist/lib/identity-3.3/index.js +75 -0
  30. package/dist/lib/identity-3.3/index.mjs +46 -0
  31. package/dist/lib/identity-3.3/lifecycle.d.mts +113 -0
  32. package/dist/lib/identity-3.3/lifecycle.d.ts +113 -0
  33. package/dist/lib/identity-3.3/lifecycle.js +267 -0
  34. package/dist/lib/identity-3.3/lifecycle.mjs +240 -0
  35. package/dist/lib/identity-3.3/revocation.d.mts +50 -0
  36. package/dist/lib/identity-3.3/revocation.d.ts +50 -0
  37. package/dist/lib/identity-3.3/revocation.js +238 -0
  38. package/dist/lib/identity-3.3/revocation.mjs +216 -0
  39. package/dist/lib/identity-3.3/schemas.draft.d.mts +2472 -0
  40. package/dist/lib/identity-3.3/schemas.draft.d.ts +2472 -0
  41. package/dist/lib/identity-3.3/schemas.draft.js +1448 -0
  42. package/dist/lib/identity-3.3/schemas.draft.mjs +1428 -0
  43. package/dist/lib/identity-3.3/server.d.mts +34 -0
  44. package/dist/lib/identity-3.3/server.d.ts +34 -0
  45. package/dist/lib/identity-3.3/server.js +219 -0
  46. package/dist/lib/identity-3.3/server.mjs +194 -0
  47. package/dist/lib/identity-3.3/store.d.mts +24 -0
  48. package/dist/lib/identity-3.3/store.d.ts +24 -0
  49. package/dist/lib/identity-3.3/store.js +191 -0
  50. package/dist/lib/identity-3.3/store.mjs +169 -0
  51. package/dist/lib/identity-3.3/trust.d.mts +94 -0
  52. package/dist/lib/identity-3.3/trust.d.ts +94 -0
  53. package/dist/lib/identity-3.3/trust.js +278 -0
  54. package/dist/lib/identity-3.3/trust.mjs +239 -0
  55. package/dist/lib/identity-3.3/types.d.mts +127 -0
  56. package/dist/lib/identity-3.3/types.d.ts +127 -0
  57. package/dist/lib/identity-3.3/types.js +16 -0
  58. package/dist/lib/identity-3.3/types.mjs +0 -0
  59. package/dist/lib/identity-3.3/validation.d.mts +2 -0
  60. package/dist/lib/identity-3.3/validation.d.ts +2 -0
  61. package/dist/lib/identity-3.3/validation.js +125 -0
  62. package/dist/lib/identity-3.3/validation.mjs +91 -0
  63. package/dist/lib/index.d.mts +1 -1
  64. package/dist/lib/index.d.ts +1 -1
  65. package/dist/lib/reporting/azure/index.d.mts +5 -0
  66. package/dist/lib/reporting/azure/index.d.ts +5 -0
  67. package/dist/lib/reporting/azure/index.js +26 -7
  68. package/dist/lib/reporting/azure/index.mjs +26 -7
  69. package/dist/lib/reporting/bigquery/index.d.mts +80 -25
  70. package/dist/lib/reporting/bigquery/index.d.ts +80 -25
  71. package/dist/lib/reporting/bigquery/index.js +184 -81
  72. package/dist/lib/reporting/bigquery/index.mjs +182 -80
  73. package/dist/lib/reporting/gcs/adapter.d.mts +8 -1
  74. package/dist/lib/reporting/gcs/adapter.d.ts +8 -1
  75. package/dist/lib/reporting/gcs/errors.d.mts +6 -0
  76. package/dist/lib/reporting/gcs/errors.d.ts +6 -0
  77. package/dist/lib/reporting/gcs/fence.d.mts +5 -0
  78. package/dist/lib/reporting/gcs/fence.d.ts +5 -0
  79. package/dist/lib/reporting/gcs/index.d.mts +9 -0
  80. package/dist/lib/reporting/gcs/index.d.ts +9 -0
  81. package/dist/lib/reporting/gcs/reader.d.mts +27 -3
  82. package/dist/lib/reporting/gcs/reader.d.ts +27 -3
  83. package/dist/lib/reporting/gcs/row-provider.d.mts +7 -0
  84. package/dist/lib/reporting/gcs/row-provider.d.ts +7 -0
  85. package/dist/lib/reporting/gcs/row-provider.js +34 -14
  86. package/dist/lib/reporting/gcs/row-provider.mjs +34 -14
  87. package/dist/lib/reporting/ledger/change-feed.d.mts +22 -1
  88. package/dist/lib/reporting/ledger/change-feed.d.ts +22 -1
  89. package/dist/lib/reporting/ledger/index.d.mts +11 -0
  90. package/dist/lib/reporting/ledger/index.d.ts +11 -0
  91. package/dist/lib/reporting/ledger/managed-postgres.d.mts +8 -0
  92. package/dist/lib/reporting/ledger/managed-postgres.d.ts +8 -0
  93. package/dist/lib/reporting/ledger/managed-router.d.mts +27 -2
  94. package/dist/lib/reporting/ledger/managed-router.d.ts +27 -2
  95. package/dist/lib/reporting/ledger/managed.d.mts +86 -6
  96. package/dist/lib/reporting/ledger/managed.d.ts +86 -6
  97. package/dist/lib/reporting/ledger/notification-activity.d.mts +65 -3
  98. package/dist/lib/reporting/ledger/notification-activity.d.ts +65 -3
  99. package/dist/lib/reporting/ledger/object-writes.d.mts +64 -5
  100. package/dist/lib/reporting/ledger/object-writes.d.ts +64 -5
  101. package/dist/lib/reporting/ledger/postgres.d.mts +43 -9
  102. package/dist/lib/reporting/ledger/postgres.d.ts +43 -9
  103. package/dist/lib/reporting/ledger/postgres.js +43 -27
  104. package/dist/lib/reporting/ledger/postgres.mjs +43 -27
  105. package/dist/lib/reporting/ledger/row-encoding.d.mts +92 -6
  106. package/dist/lib/reporting/ledger/row-encoding.d.ts +92 -6
  107. package/dist/lib/reporting/ledger/row-encoding.js +8 -4
  108. package/dist/lib/reporting/ledger/row-encoding.mjs +6 -3
  109. package/dist/lib/reporting/ledger/row-storage-errors.d.mts +11 -1
  110. package/dist/lib/reporting/ledger/row-storage-errors.d.ts +11 -1
  111. package/dist/lib/reporting/ledger/row-storage-migration.d.mts +19 -1
  112. package/dist/lib/reporting/ledger/row-storage-migration.d.ts +19 -1
  113. package/dist/lib/reporting/ledger/row-storage-migration.js +133 -18
  114. package/dist/lib/reporting/ledger/row-storage-migration.mjs +133 -18
  115. package/dist/lib/reporting/ledger/row-storage-object.d.mts +103 -12
  116. package/dist/lib/reporting/ledger/row-storage-object.d.ts +103 -12
  117. package/dist/lib/reporting/ledger/row-storage-object.js +106 -31
  118. package/dist/lib/reporting/ledger/row-storage-object.mjs +104 -31
  119. package/dist/lib/reporting/ledger/row-storage.d.mts +87 -20
  120. package/dist/lib/reporting/ledger/row-storage.d.ts +87 -20
  121. package/dist/lib/reporting/ledger/row-storage.js +126 -66
  122. package/dist/lib/reporting/ledger/row-storage.mjs +129 -67
  123. package/dist/lib/reporting/ledger/schedule.d.mts +13 -0
  124. package/dist/lib/reporting/ledger/schedule.d.ts +13 -0
  125. package/dist/lib/reporting/ledger/schedule.js +24 -0
  126. package/dist/lib/reporting/ledger/schedule.mjs +23 -0
  127. package/dist/lib/reporting/ledger/types.d.mts +23 -1
  128. package/dist/lib/reporting/ledger/types.d.ts +23 -1
  129. package/dist/lib/reporting/s3/index.d.mts +5 -0
  130. package/dist/lib/reporting/s3/index.d.ts +5 -0
  131. package/dist/lib/reporting/s3/index.js +37 -14
  132. package/dist/lib/reporting/s3/index.mjs +37 -14
  133. package/dist/lib/reporting/service/index.d.mts +10 -0
  134. package/dist/lib/reporting/service/index.d.ts +10 -0
  135. package/dist/lib/reporting/service/maintenance.d.mts +28 -2
  136. package/dist/lib/reporting/service/maintenance.d.ts +28 -2
  137. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  138. package/dist/lib/server/account-sync-contract.d.mts +14 -0
  139. package/dist/lib/server/account-sync-contract.d.ts +14 -0
  140. package/dist/lib/server/account-sync-contract.js +225 -0
  141. package/dist/lib/server/account-sync-contract.mjs +197 -0
  142. package/dist/lib/server/adcp-server.js +5 -0
  143. package/dist/lib/server/adcp-server.mjs +10 -0
  144. package/dist/lib/server/auth-signature.d.mts +10 -0
  145. package/dist/lib/server/auth-signature.d.ts +10 -0
  146. package/dist/lib/server/auth-signature.js +61 -2
  147. package/dist/lib/server/auth-signature.mjs +65 -2
  148. package/dist/lib/server/auth.d.mts +6 -0
  149. package/dist/lib/server/auth.d.ts +6 -0
  150. package/dist/lib/server/auth.js +6 -0
  151. package/dist/lib/server/auth.mjs +6 -0
  152. package/dist/lib/server/create-adcp-server.d.mts +19 -5
  153. package/dist/lib/server/create-adcp-server.d.ts +19 -5
  154. package/dist/lib/server/create-adcp-server.js +238 -19
  155. package/dist/lib/server/create-adcp-server.mjs +240 -10
  156. package/dist/lib/server/decisioning/account.d.mts +24 -1
  157. package/dist/lib/server/decisioning/account.d.ts +24 -1
  158. package/dist/lib/server/decisioning/index.d.mts +1 -1
  159. package/dist/lib/server/decisioning/index.d.ts +1 -1
  160. package/dist/lib/server/decisioning/runtime/from-platform.d.mts +0 -50
  161. package/dist/lib/server/decisioning/runtime/from-platform.d.ts +0 -50
  162. package/dist/lib/server/decisioning/runtime/from-platform.js +61 -11
  163. package/dist/lib/server/decisioning/runtime/from-platform.mjs +65 -12
  164. package/dist/lib/server/index.d.mts +2 -0
  165. package/dist/lib/server/index.d.ts +2 -0
  166. package/dist/lib/server/index.js +12 -0
  167. package/dist/lib/server/index.mjs +12 -0
  168. package/dist/lib/server/notification-subscriptions/runtime.js +9 -1
  169. package/dist/lib/server/notification-subscriptions/runtime.mjs +9 -1
  170. package/dist/lib/server/notification-subscriptions/types.d.mts +5 -0
  171. package/dist/lib/server/notification-subscriptions/types.d.ts +5 -0
  172. package/dist/lib/server/principal/types.d.mts +1 -1
  173. package/dist/lib/server/principal/types.d.ts +1 -1
  174. package/dist/lib/server/serve.js +5 -0
  175. package/dist/lib/server/serve.mjs +5 -0
  176. package/dist/lib/server/webhook-delivery/recovery.d.mts +1 -0
  177. package/dist/lib/server/webhook-delivery/recovery.d.ts +1 -0
  178. package/dist/lib/server/webhook-delivery/recovery.js +4 -0
  179. package/dist/lib/server/webhook-delivery/recovery.mjs +4 -0
  180. package/dist/lib/server/webhook-emitter.d.mts +10 -0
  181. package/dist/lib/server/webhook-emitter.d.ts +10 -0
  182. package/dist/lib/server/webhook-emitter.js +22 -0
  183. package/dist/lib/server/webhook-emitter.mjs +22 -0
  184. package/dist/lib/signing/agent-context.d.mts +0 -5
  185. package/dist/lib/signing/agent-context.d.ts +0 -5
  186. package/dist/lib/signing/agent-context.js +9 -1
  187. package/dist/lib/signing/agent-context.mjs +9 -1
  188. package/dist/lib/signing/agent-fetch.js +27 -2
  189. package/dist/lib/signing/agent-fetch.mjs +32 -2
  190. package/dist/lib/signing/agent-resolver/canonicalize.d.mts +10 -15
  191. package/dist/lib/signing/agent-resolver/canonicalize.d.ts +10 -15
  192. package/dist/lib/signing/agent-resolver/canonicalize.js +17 -5
  193. package/dist/lib/signing/agent-resolver/canonicalize.mjs +16 -5
  194. package/dist/lib/signing/agent-resolver/index.d.mts +1 -0
  195. package/dist/lib/signing/agent-resolver/index.d.ts +1 -0
  196. package/dist/lib/signing/agent-resolver/index.js +5 -0
  197. package/dist/lib/signing/agent-resolver/index.mjs +3 -0
  198. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.mts +3 -2
  199. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.ts +3 -2
  200. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.js +30 -3
  201. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.mjs +30 -3
  202. package/dist/lib/signing/agent-resolver/strict-json.d.mts +2 -2
  203. package/dist/lib/signing/agent-resolver/strict-json.d.ts +2 -2
  204. package/dist/lib/signing/agent-resolver/strict-json.js +5 -3
  205. package/dist/lib/signing/agent-resolver/strict-json.mjs +5 -3
  206. package/dist/lib/signing/brand-jwks.d.mts +2 -2
  207. package/dist/lib/signing/brand-jwks.d.ts +2 -2
  208. package/dist/lib/signing/brand-jwks.js +4 -4
  209. package/dist/lib/signing/brand-jwks.mjs +4 -4
  210. package/dist/lib/signing/client.d.mts +1 -0
  211. package/dist/lib/signing/client.d.ts +1 -0
  212. package/dist/lib/signing/client.js +5 -0
  213. package/dist/lib/signing/client.mjs +3 -0
  214. package/dist/lib/signing/jwks-https.d.mts +1 -1
  215. package/dist/lib/signing/jwks-https.d.ts +1 -1
  216. package/dist/lib/signing/jwks-https.js +1 -1
  217. package/dist/lib/signing/jwks-https.mjs +1 -1
  218. package/dist/lib/signing/jwks.d.mts +11 -3
  219. package/dist/lib/signing/jwks.d.ts +11 -3
  220. package/dist/lib/signing/jwks.js +1 -1
  221. package/dist/lib/signing/jwks.mjs +1 -1
  222. package/dist/lib/signing/parser.d.mts +1 -1
  223. package/dist/lib/signing/parser.d.ts +1 -1
  224. package/dist/lib/signing/parser.js +5 -3
  225. package/dist/lib/signing/parser.mjs +6 -4
  226. package/dist/lib/signing/revocation.d.mts +4 -1
  227. package/dist/lib/signing/revocation.d.ts +4 -1
  228. package/dist/lib/signing/revocation.js +33 -3
  229. package/dist/lib/signing/revocation.mjs +31 -2
  230. package/dist/lib/signing/server.d.mts +1 -1
  231. package/dist/lib/signing/server.d.ts +1 -1
  232. package/dist/lib/signing/server.js +4 -0
  233. package/dist/lib/signing/server.mjs +4 -0
  234. package/dist/lib/signing/types.d.mts +3 -0
  235. package/dist/lib/signing/types.d.ts +3 -0
  236. package/dist/lib/signing/web-bot-auth.d.mts +117 -0
  237. package/dist/lib/signing/web-bot-auth.d.ts +117 -0
  238. package/dist/lib/signing/web-bot-auth.js +660 -0
  239. package/dist/lib/signing/web-bot-auth.mjs +624 -0
  240. package/dist/lib/testing/client.d.mts +1 -4
  241. package/dist/lib/testing/client.d.ts +1 -4
  242. package/dist/lib/testing/client.js +141 -20
  243. package/dist/lib/testing/client.mjs +137 -19
  244. package/dist/lib/testing/compliance/comply.js +29 -10
  245. package/dist/lib/testing/compliance/comply.mjs +37 -11
  246. package/dist/lib/testing/storyboard/account-sync-contract.d.mts +3 -0
  247. package/dist/lib/testing/storyboard/account-sync-contract.d.ts +3 -0
  248. package/dist/lib/testing/storyboard/account-sync-contract.js +79 -0
  249. package/dist/lib/testing/storyboard/account-sync-contract.mjs +55 -0
  250. package/dist/lib/testing/storyboard/default-invariants.js +2 -0
  251. package/dist/lib/testing/storyboard/default-invariants.mjs +2 -0
  252. package/dist/lib/testing/storyboard/runner.js +23 -8
  253. package/dist/lib/testing/storyboard/runner.mjs +24 -8
  254. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  255. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  256. package/dist/lib/types/adcp.d.mts +4 -0
  257. package/dist/lib/types/adcp.d.ts +4 -0
  258. package/dist/lib/types/schemas.generated.d.ts +6 -6
  259. package/dist/lib/utils/capabilities.d.mts +1 -0
  260. package/dist/lib/utils/capabilities.d.ts +1 -0
  261. package/dist/lib/utils/capabilities.js +5 -0
  262. package/dist/lib/utils/capabilities.mjs +5 -0
  263. package/dist/lib/v2/projection/creative-delivery.d.mts +3 -1
  264. package/dist/lib/v2/projection/creative-delivery.d.ts +3 -1
  265. package/dist/lib/v2/projection/creative-delivery.js +26 -10
  266. package/dist/lib/v2/projection/creative-delivery.mjs +26 -10
  267. package/dist/lib/v2/projection/index.d.mts +1 -1
  268. package/dist/lib/v2/projection/index.d.ts +1 -1
  269. package/dist/lib/v2/projection/legacy-routes.d.mts +24 -2
  270. package/dist/lib/v2/projection/legacy-routes.d.ts +24 -2
  271. package/dist/lib/v2/projection/legacy-routes.js +28 -2
  272. package/dist/lib/v2/projection/legacy-routes.mjs +26 -2
  273. package/dist/lib/validation/schema-loader.d.mts +2 -0
  274. package/dist/lib/validation/schema-loader.d.ts +2 -0
  275. package/dist/lib/validation/schema-loader.js +43 -4
  276. package/dist/lib/validation/schema-loader.mjs +39 -3
  277. package/dist/lib/version.d.mts +3 -3
  278. package/dist/lib/version.d.ts +3 -3
  279. package/dist/lib/version.js +3 -3
  280. package/dist/lib/version.mjs +3 -3
  281. package/docs/TYPE-SUMMARY.md +2 -2
  282. package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +4 -0
  283. package/docs/guides/REPORTING-LEDGER-CUTOVER.md +1 -1
  284. package/docs/guides/REPORTING-LEDGER.md +132 -46
  285. package/docs/guides/REPORTING-OPERATIONS.md +25 -4
  286. package/docs/guides/REPORTING-STABILITY.md +76 -0
  287. package/docs/guides/account-resolution.md +101 -0
  288. package/docs/llms.txt +3 -2
  289. package/docs/migration-12-to-13.md +7 -0
  290. package/docs/migration-14.x-rc-worksheet.md +4 -4
  291. package/docs/migration-agent-identity-3.3.md +355 -0
  292. package/docs/migration-agent-resolution-3.3.md +5 -0
  293. package/docs/migration-reporting-row-storage-alignment.md +137 -0
  294. package/examples/storyboards/account-sync-contract.yaml +57 -0
  295. package/package.json +15 -1
@@ -429,13 +429,18 @@ async function comply(agentUrl, options = {}) {
429
429
  `Refusing to run compliance against a non-HTTPS URL: ${agentUrl}. Production agents MUST terminate TLS. Pass { allow_http: true } (or --allow-http) for local development.`
430
430
  );
431
431
  }
432
- return (0, import_protocols.withMCPConnectionScope)(async () => {
433
- try {
434
- return await complyImpl(agentUrl, options);
435
- } finally {
436
- await (0, import_protocols.closeScopedConnections)(options.protocol);
437
- }
438
- });
432
+ return (0, import_client.withTestClientScope)(
433
+ () => (0, import_protocols.withMCPConnectionScope)(
434
+ async () => {
435
+ try {
436
+ return await complyImpl(agentUrl, options);
437
+ } finally {
438
+ await (0, import_protocols.closeScopedConnections)(options.protocol);
439
+ }
440
+ },
441
+ { isolate: true }
442
+ )
443
+ );
439
444
  }
440
445
  function sanitizeAgentText(text, max = 500) {
441
446
  const cleaned = text.replace(/[\p{C}\u2028\u2029\u202A-\u202E\u2066-\u2069]/gu, "").trim();
@@ -912,6 +917,15 @@ function buildNotApplicableStoryboardResult(agentUrl, na) {
912
917
  };
913
918
  }
914
919
  async function runComplyStoryboard(agentUrl, storyboard, runOptions, profile, routeStoryboard) {
920
+ runOptions = { ...runOptions, _discoveryPass: {} };
921
+ const resolution = (0, import_client.getOrCreateClientResolution)(agentUrl, runOptions);
922
+ const discovered = await (0, import_client.getOrDiscoverProfile)(resolution.client, runOptions);
923
+ if (discovered.step.passed) {
924
+ profile = discovered.profile;
925
+ runOptions = { ...runOptions, _profile: profile, agentTools: profile.tools };
926
+ } else {
927
+ runOptions = { ...runOptions, _profile: void 0, agentTools: void 0 };
928
+ }
915
929
  if (!routeStoryboard || (0, import_runner.storyboardCapabilityGateUnmet)(storyboard, runOptions) !== null) {
916
930
  return (0, import_runner.runStoryboard)(agentUrl, storyboard, runOptions);
917
931
  }
@@ -1371,7 +1385,7 @@ async function complyImpl(agentUrl, options) {
1371
1385
  profile,
1372
1386
  step: profileStep,
1373
1387
  caughtError: profileCaughtError
1374
- } = await (0, import_client.discoverAgentProfile)(discoveryClient, signal, complianceIndex.adcp_version);
1388
+ } = await (0, import_client.getOrDiscoverProfile)(discoveryClient, { ...discoveryOptions, signal }, complianceIndex.adcp_version);
1375
1389
  if (testOptions.versionEnvelope === void 0 && profile.tools.includes("get_adcp_capabilities") && profile.raw_capabilities === void 0 && !profileStep.error?.startsWith("VERSION_UNSUPPORTED:")) {
1376
1390
  const legacyDiscoveryOptions = { ...effectiveOptions, versionEnvelope: "major-only" };
1377
1391
  const legacyDiscoveryClient = (0, import_client.createTestClient)(
@@ -1379,7 +1393,11 @@ async function complyImpl(agentUrl, options) {
1379
1393
  effectiveOptions.protocol ?? "mcp",
1380
1394
  legacyDiscoveryOptions
1381
1395
  );
1382
- const legacyDiscovery = await (0, import_client.discoverAgentProfile)(legacyDiscoveryClient, signal, complianceIndex.adcp_version);
1396
+ const legacyDiscovery = await (0, import_client.getOrDiscoverProfile)(
1397
+ legacyDiscoveryClient,
1398
+ { ...legacyDiscoveryOptions, signal },
1399
+ complianceIndex.adcp_version
1400
+ );
1383
1401
  if (legacyDiscovery.profile.raw_capabilities !== void 0) {
1384
1402
  discoveryOptions = legacyDiscoveryOptions;
1385
1403
  discoveryClient = legacyDiscoveryClient;
@@ -1394,7 +1412,7 @@ async function complyImpl(agentUrl, options) {
1394
1412
  ...testOptions.adcpVersion !== void 0 && { callerAdcpVersion: testOptions.adcpVersion },
1395
1413
  ...testOptions.versionEnvelope !== void 0 && { callerVersionEnvelope: testOptions.versionEnvelope }
1396
1414
  });
1397
- const client = discoveryOptions === effectiveOptions ? discoveryClient : (0, import_client.createTestClient)(agentUrl, effectiveOptions.protocol ?? "mcp", effectiveOptions);
1415
+ const client = discoveryOptions === effectiveOptions ? discoveryClient : (0, import_client.getOrCreateClientResolution)(agentUrl, effectiveOptions).client;
1398
1416
  (0, import_client.seedTestClientSigningCapability)(client, profile, complianceIndex.adcp_version);
1399
1417
  effectiveOptions._client = client;
1400
1418
  effectiveOptions._profile = profile;
@@ -1456,6 +1474,7 @@ async function complyImpl(agentUrl, options) {
1456
1474
  if (runnable.length > 0) {
1457
1475
  allObservations.push(...authCheck.observations);
1458
1476
  effectiveOptions._profile = degraded;
1477
+ (0, import_client.seedAuthRejectedTestClientProfile)(client, degraded, complianceIndex.adcp_version);
1459
1478
  return await runWithDegradedProfile(
1460
1479
  agentUrl,
1461
1480
  degraded,
@@ -1,4 +1,11 @@
1
- import { createTestClient, discoverAgentProfile, seedTestClientSigningCapability } from "../client.mjs";
1
+ import {
2
+ createTestClient,
3
+ getOrCreateClientResolution,
4
+ getOrDiscoverProfile,
5
+ seedTestClientSigningCapability,
6
+ seedAuthRejectedTestClientProfile,
7
+ withTestClientScope
8
+ } from "../client.mjs";
2
9
  import { collectDetachedAssertionFailures, mapStoryboardResultsToTrackResult, TRACK_LABELS } from "./storyboard-tracks.mjs";
3
10
  import {
4
11
  applyAdcpVersionRunOptions,
@@ -412,13 +419,18 @@ async function comply(agentUrl, options = {}) {
412
419
  `Refusing to run compliance against a non-HTTPS URL: ${agentUrl}. Production agents MUST terminate TLS. Pass { allow_http: true } (or --allow-http) for local development.`
413
420
  );
414
421
  }
415
- return withMCPConnectionScope(async () => {
416
- try {
417
- return await complyImpl(agentUrl, options);
418
- } finally {
419
- await closeScopedConnections(options.protocol);
420
- }
421
- });
422
+ return withTestClientScope(
423
+ () => withMCPConnectionScope(
424
+ async () => {
425
+ try {
426
+ return await complyImpl(agentUrl, options);
427
+ } finally {
428
+ await closeScopedConnections(options.protocol);
429
+ }
430
+ },
431
+ { isolate: true }
432
+ )
433
+ );
422
434
  }
423
435
  function sanitizeAgentText(text, max = 500) {
424
436
  const cleaned = text.replace(/[\p{C}\u2028\u2029\u202A-\u202E\u2066-\u2069]/gu, "").trim();
@@ -895,6 +907,15 @@ function buildNotApplicableStoryboardResult(agentUrl, na) {
895
907
  };
896
908
  }
897
909
  async function runComplyStoryboard(agentUrl, storyboard, runOptions, profile, routeStoryboard) {
910
+ runOptions = { ...runOptions, _discoveryPass: {} };
911
+ const resolution = getOrCreateClientResolution(agentUrl, runOptions);
912
+ const discovered = await getOrDiscoverProfile(resolution.client, runOptions);
913
+ if (discovered.step.passed) {
914
+ profile = discovered.profile;
915
+ runOptions = { ...runOptions, _profile: profile, agentTools: profile.tools };
916
+ } else {
917
+ runOptions = { ...runOptions, _profile: void 0, agentTools: void 0 };
918
+ }
898
919
  if (!routeStoryboard || storyboardCapabilityGateUnmet(storyboard, runOptions) !== null) {
899
920
  return runStoryboard(agentUrl, storyboard, runOptions);
900
921
  }
@@ -1354,7 +1375,7 @@ async function complyImpl(agentUrl, options) {
1354
1375
  profile,
1355
1376
  step: profileStep,
1356
1377
  caughtError: profileCaughtError
1357
- } = await discoverAgentProfile(discoveryClient, signal, complianceIndex.adcp_version);
1378
+ } = await getOrDiscoverProfile(discoveryClient, { ...discoveryOptions, signal }, complianceIndex.adcp_version);
1358
1379
  if (testOptions.versionEnvelope === void 0 && profile.tools.includes("get_adcp_capabilities") && profile.raw_capabilities === void 0 && !profileStep.error?.startsWith("VERSION_UNSUPPORTED:")) {
1359
1380
  const legacyDiscoveryOptions = { ...effectiveOptions, versionEnvelope: "major-only" };
1360
1381
  const legacyDiscoveryClient = createTestClient(
@@ -1362,7 +1383,11 @@ async function complyImpl(agentUrl, options) {
1362
1383
  effectiveOptions.protocol ?? "mcp",
1363
1384
  legacyDiscoveryOptions
1364
1385
  );
1365
- const legacyDiscovery = await discoverAgentProfile(legacyDiscoveryClient, signal, complianceIndex.adcp_version);
1386
+ const legacyDiscovery = await getOrDiscoverProfile(
1387
+ legacyDiscoveryClient,
1388
+ { ...legacyDiscoveryOptions, signal },
1389
+ complianceIndex.adcp_version
1390
+ );
1366
1391
  if (legacyDiscovery.profile.raw_capabilities !== void 0) {
1367
1392
  discoveryOptions = legacyDiscoveryOptions;
1368
1393
  discoveryClient = legacyDiscoveryClient;
@@ -1377,7 +1402,7 @@ async function complyImpl(agentUrl, options) {
1377
1402
  ...testOptions.adcpVersion !== void 0 && { callerAdcpVersion: testOptions.adcpVersion },
1378
1403
  ...testOptions.versionEnvelope !== void 0 && { callerVersionEnvelope: testOptions.versionEnvelope }
1379
1404
  });
1380
- const client = discoveryOptions === effectiveOptions ? discoveryClient : createTestClient(agentUrl, effectiveOptions.protocol ?? "mcp", effectiveOptions);
1405
+ const client = discoveryOptions === effectiveOptions ? discoveryClient : getOrCreateClientResolution(agentUrl, effectiveOptions).client;
1381
1406
  seedTestClientSigningCapability(client, profile, complianceIndex.adcp_version);
1382
1407
  effectiveOptions._client = client;
1383
1408
  effectiveOptions._profile = profile;
@@ -1439,6 +1464,7 @@ async function complyImpl(agentUrl, options) {
1439
1464
  if (runnable.length > 0) {
1440
1465
  allObservations.push(...authCheck.observations);
1441
1466
  effectiveOptions._profile = degraded;
1467
+ seedAuthRejectedTestClientProfile(client, degraded, complianceIndex.adcp_version);
1442
1468
  return await runWithDegradedProfile(
1443
1469
  agentUrl,
1444
1470
  degraded,
@@ -0,0 +1,3 @@
1
+ import type { AssertionSpec } from './assertions.mjs';
2
+ /** Opt-in invariant for account provisioning storyboards, including fresh keys. */
3
+ export declare const accountSyncContractAssertion: AssertionSpec;
@@ -0,0 +1,3 @@
1
+ import type { AssertionSpec } from './assertions';
2
+ /** Opt-in invariant for account provisioning storyboards, including fresh keys. */
3
+ export declare const accountSyncContractAssertion: AssertionSpec;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var account_sync_contract_exports = {};
20
+ __export(account_sync_contract_exports, {
21
+ accountSyncContractAssertion: () => accountSyncContractAssertion
22
+ });
23
+ module.exports = __toCommonJS(account_sync_contract_exports);
24
+ var import_account_key = require('../../core/account-key.js');
25
+ const accountSyncContractAssertion = {
26
+ id: "account.sync_contract",
27
+ default: false,
28
+ description: "Natural-key syncs preserve identity, accept or reject terms, and expose agent billing fields.",
29
+ onStep(ctx, step) {
30
+ if (step.skipped || !["sync_accounts", "list_accounts"].includes(step.task)) return [];
31
+ const payload = step.request?.payload;
32
+ const raw = step.response ?? step.response_record?.payload;
33
+ const response = raw?.data ?? raw;
34
+ if (!Array.isArray(response?.accounts)) return [];
35
+ const seen = ctx.state.accounts ??= /* @__PURE__ */ new Map();
36
+ const results = [];
37
+ for (const [index, row] of response.accounts.entries()) {
38
+ if (row.action === "failed" || row.status === "rejected") continue;
39
+ const problems = [];
40
+ const entry = payload?.accounts?.[index];
41
+ if (step.task === "list_accounts" && [...seen.values()].some((prior) => prior.id === row.account_id && prior.billing === "agent") && row.billing === void 0)
42
+ problems.push("known agent-billed account omits billing");
43
+ if (row.billing === "agent" && row.payment_terms === void 0)
44
+ problems.push("agent-billed account omits payment_terms");
45
+ if (step.task === "sync_accounts" && entry) {
46
+ if (entry.billing === "agent" && row.billing === void 0) problems.push("agent-billed sync omits billing");
47
+ if (entry.billing === "agent" && row.billing !== void 0 && row.billing !== "agent")
48
+ problems.push("agent-billed sync changed billing party");
49
+ if (entry.payment_terms !== void 0 && row.status === "active" && row.payment_terms !== entry.payment_terms)
50
+ problems.push("active account did not accept requested payment_terms");
51
+ const ref = entry.account ?? entry;
52
+ if ("brand" in ref && ref.brand && typeof ref.operator === "string" && payload?.dry_run !== true) {
53
+ const key = JSON.stringify([step.agent_url ?? ctx.agentUrl, (0, import_account_key.accountReferenceKey)(ref)]);
54
+ const prior = seen.get(key);
55
+ if (prior && (prior.id !== row.account_id || (payload?.idempotency_key === void 0 || !prior.requestKeys.has(payload.idempotency_key)) && row.action === "created"))
56
+ problems.push("repeat natural-key sync created a different account or reported created");
57
+ const requestKeys = prior?.requestKeys ?? /* @__PURE__ */ new Set();
58
+ requestKeys.add(payload?.idempotency_key);
59
+ seen.set(key, {
60
+ id: prior?.id ?? row.account_id,
61
+ billing: row.billing,
62
+ requestKeys
63
+ });
64
+ }
65
+ }
66
+ results.push({
67
+ passed: problems.length === 0,
68
+ description: `Account contract for ${step.task} row ${index}`,
69
+ step_id: step.step_id,
70
+ ...problems.length && { error: problems.join("; ") }
71
+ });
72
+ }
73
+ return results;
74
+ }
75
+ };
76
+ // Annotate the CommonJS export names for ESM import in node:
77
+ 0 && (module.exports = {
78
+ accountSyncContractAssertion
79
+ });
@@ -0,0 +1,55 @@
1
+ import { accountReferenceKey } from "../../core/account-key.mjs";
2
+ const accountSyncContractAssertion = {
3
+ id: "account.sync_contract",
4
+ default: false,
5
+ description: "Natural-key syncs preserve identity, accept or reject terms, and expose agent billing fields.",
6
+ onStep(ctx, step) {
7
+ if (step.skipped || !["sync_accounts", "list_accounts"].includes(step.task)) return [];
8
+ const payload = step.request?.payload;
9
+ const raw = step.response ?? step.response_record?.payload;
10
+ const response = raw?.data ?? raw;
11
+ if (!Array.isArray(response?.accounts)) return [];
12
+ const seen = ctx.state.accounts ??= /* @__PURE__ */ new Map();
13
+ const results = [];
14
+ for (const [index, row] of response.accounts.entries()) {
15
+ if (row.action === "failed" || row.status === "rejected") continue;
16
+ const problems = [];
17
+ const entry = payload?.accounts?.[index];
18
+ if (step.task === "list_accounts" && [...seen.values()].some((prior) => prior.id === row.account_id && prior.billing === "agent") && row.billing === void 0)
19
+ problems.push("known agent-billed account omits billing");
20
+ if (row.billing === "agent" && row.payment_terms === void 0)
21
+ problems.push("agent-billed account omits payment_terms");
22
+ if (step.task === "sync_accounts" && entry) {
23
+ if (entry.billing === "agent" && row.billing === void 0) problems.push("agent-billed sync omits billing");
24
+ if (entry.billing === "agent" && row.billing !== void 0 && row.billing !== "agent")
25
+ problems.push("agent-billed sync changed billing party");
26
+ if (entry.payment_terms !== void 0 && row.status === "active" && row.payment_terms !== entry.payment_terms)
27
+ problems.push("active account did not accept requested payment_terms");
28
+ const ref = entry.account ?? entry;
29
+ if ("brand" in ref && ref.brand && typeof ref.operator === "string" && payload?.dry_run !== true) {
30
+ const key = JSON.stringify([step.agent_url ?? ctx.agentUrl, accountReferenceKey(ref)]);
31
+ const prior = seen.get(key);
32
+ if (prior && (prior.id !== row.account_id || (payload?.idempotency_key === void 0 || !prior.requestKeys.has(payload.idempotency_key)) && row.action === "created"))
33
+ problems.push("repeat natural-key sync created a different account or reported created");
34
+ const requestKeys = prior?.requestKeys ?? /* @__PURE__ */ new Set();
35
+ requestKeys.add(payload?.idempotency_key);
36
+ seen.set(key, {
37
+ id: prior?.id ?? row.account_id,
38
+ billing: row.billing,
39
+ requestKeys
40
+ });
41
+ }
42
+ }
43
+ results.push({
44
+ passed: problems.length === 0,
45
+ description: `Account contract for ${step.task} row ${index}`,
46
+ step_id: step.step_id,
47
+ ...problems.length && { error: problems.join("; ") }
48
+ });
49
+ }
50
+ return results;
51
+ }
52
+ };
53
+ export {
54
+ accountSyncContractAssertion
55
+ };
@@ -26,6 +26,7 @@ var import_envelope_allowlist = require('../../server/envelope-allowlist.js');
26
26
  var import_error_codes = require('../../types/error-codes.js');
27
27
  var import_state_machine = require('../../server/state-machine.js');
28
28
  var import_assertions = require('./assertions.js');
29
+ var import_account_sync_contract = require('./account-sync-contract.js');
29
30
  const REGISTERED = /* @__PURE__ */ new Set();
30
31
  function registerOnce(id, spec) {
31
32
  if (REGISTERED.has(id)) return;
@@ -33,6 +34,7 @@ function registerOnce(id, spec) {
33
34
  (0, import_assertions.registerAssertion)(spec);
34
35
  }
35
36
  function registerDefaultInvariants() {
37
+ registerOnce(import_account_sync_contract.accountSyncContractAssertion.id, import_account_sync_contract.accountSyncContractAssertion);
36
38
  registerOnce("idempotency.conflict_no_payload_leak", {
37
39
  id: "idempotency.conflict_no_payload_leak",
38
40
  default: true,
@@ -6,6 +6,7 @@ import {
6
6
  MEDIA_BUY_TRANSITIONS as MEDIA_BUY_TRANSITIONS_TYPED
7
7
  } from "../../server/state-machine.mjs";
8
8
  import { registerAssertion } from "./assertions.mjs";
9
+ import { accountSyncContractAssertion } from "./account-sync-contract.mjs";
9
10
  const REGISTERED = /* @__PURE__ */ new Set();
10
11
  function registerOnce(id, spec) {
11
12
  if (REGISTERED.has(id)) return;
@@ -13,6 +14,7 @@ function registerOnce(id, spec) {
13
14
  registerAssertion(spec);
14
15
  }
15
16
  function registerDefaultInvariants() {
17
+ registerOnce(accountSyncContractAssertion.id, accountSyncContractAssertion);
16
18
  registerOnce("idempotency.conflict_no_payload_leak", {
17
19
  id: "idempotency.conflict_no_payload_leak",
18
20
  default: true,
@@ -759,6 +759,7 @@ function filterResponseHeaders(headers) {
759
759
  }
760
760
  async function runStoryboard(agentUrlOrUrls, storyboard, options = {}) {
761
761
  options = applyReusableProfileOptions(options);
762
+ if ((0, import_client.hasTestClientScope)() && !options._discoveryPass) options = { ...options, _discoveryPass: {} };
762
763
  return (0, import_protocols.withMCPConnectionScope)(
763
764
  async () => {
764
765
  options = applyStoryboardVersionOptions(storyboard, options);
@@ -768,6 +769,18 @@ async function runStoryboard(agentUrlOrUrls, storyboard, options = {}) {
768
769
  });
769
770
  options = (0, import_test_kit.resolveDeclaredTestKit)(storyboard, options);
770
771
  options = (0, import_native_a2a_compliance.applyNativeA2AComplianceTransportOptions)(options);
772
+ if ((0, import_client.hasTestClientScope)() && options._client && !options.agents) {
773
+ const resolution = (0, import_client.getOrCreateClientResolution)(
774
+ typeof agentUrlOrUrls === "string" ? agentUrlOrUrls : agentUrlOrUrls[0],
775
+ options
776
+ );
777
+ const discovered = await (0, import_client.getOrDiscoverProfile)(resolution.client, options);
778
+ options = {
779
+ ...options,
780
+ _profile: discovered.step.passed ? discovered.profile : void 0,
781
+ agentTools: discovered.step.passed ? discovered.profile.tools : void 0
782
+ };
783
+ }
771
784
  const schemaRoot = getRunSchemaRoot(options);
772
785
  if (schemaRoot) {
773
786
  return await (0, import_schema_loader.withExternalSchemaRoot)(
@@ -778,7 +791,7 @@ async function runStoryboard(agentUrlOrUrls, storyboard, options = {}) {
778
791
  }
779
792
  return await runStoryboardBody(agentUrlOrUrls, storyboard, options);
780
793
  },
781
- { isolate: true }
794
+ { isolate: !(0, import_client.hasTestClientScope)() }
782
795
  );
783
796
  }
784
797
  async function runStoryboardBody(agentUrlOrUrls, storyboard, options) {
@@ -1529,7 +1542,7 @@ async function executeStoryboardPass(agentUrls, storyboard, options, dispatchOff
1529
1542
  let clients;
1530
1543
  let routingContext;
1531
1544
  let profile;
1532
- let callerOwnsClients = false;
1545
+ let callerOwnsClients = (0, import_client.hasTestClientScope)();
1533
1546
  if (useRouting) {
1534
1547
  try {
1535
1548
  routingContext = await (0, import_agent_routing.buildRoutingContext)(storyboard, options);
@@ -1541,7 +1554,7 @@ async function executeStoryboardPass(agentUrls, storyboard, options, dispatchOff
1541
1554
  duration_ms: 0,
1542
1555
  error: detail
1543
1556
  };
1544
- await (0, import_protocols.closeScopedConnections)(options.protocol);
1557
+ if (!callerOwnsClients) await (0, import_protocols.closeScopedConnections)(options.protocol);
1545
1558
  return buildDiscoveryFailedResult(agentUrls, storyboard, failedStep);
1546
1559
  }
1547
1560
  clients = [...routingContext.clients.values()];
@@ -1555,17 +1568,19 @@ async function executeStoryboardPass(agentUrls, storyboard, options, dispatchOff
1555
1568
  } else {
1556
1569
  const clientResolutions = agentUrls.map((url) => (0, import_client.getOrCreateClientResolution)(url, options));
1557
1570
  clients = clientResolutions.map((r) => r.client);
1558
- callerOwnsClients = clientResolutions.some((r) => r.reusedShared);
1571
+ callerOwnsClients ||= clientResolutions.some((r) => r.reusedShared);
1559
1572
  resetClientSessions(clients);
1560
- if (!callerOwnsClients) {
1573
+ if ((0, import_client.hasTestClientScope)() || !callerOwnsClients) {
1561
1574
  const discovered = await (0, import_client.getOrDiscoverProfile)(clients[0], options);
1562
1575
  if (discovered.step.passed === false) {
1563
- await (0, import_protocols.closeScopedConnections)(options.protocol);
1576
+ if (!callerOwnsClients) await (0, import_protocols.closeScopedConnections)(options.protocol);
1564
1577
  return buildDiscoveryFailedResult(agentUrls, storyboard, discovered.step);
1565
1578
  }
1566
1579
  profile = discovered.profile;
1567
1580
  const profileTools = (0, import_agent_routing.normalizeAgentToolNames)(profile?.tools);
1568
- if (!options.agentTools && profileTools) {
1581
+ if ((0, import_client.hasTestClientScope)() && profileTools) {
1582
+ options = { ...options, agentTools: profileTools, _profile: profile };
1583
+ } else if (!options.agentTools && profileTools) {
1569
1584
  options = { ...options, agentTools: profileTools, _profile: profile };
1570
1585
  } else if (profile && !options._profile) {
1571
1586
  options = { ...options, _profile: profile };
@@ -3108,7 +3123,7 @@ async function runStoryboardStep(agentUrl, storyboard, stepId, options = {}) {
3108
3123
  }
3109
3124
  return await runStoryboardStepBody(agentUrl, storyboard, stepId, options);
3110
3125
  },
3111
- { isolate: true }
3126
+ { isolate: !(0, import_client.hasTestClientScope)() }
3112
3127
  );
3113
3128
  }
3114
3129
  async function runStoryboardStepBody(agentUrl, storyboard, stepId, options) {
@@ -6,6 +6,7 @@ import {
6
6
  createTestClient,
7
7
  getOrCreateClientResolution,
8
8
  getOrDiscoverProfile,
9
+ hasTestClientScope,
9
10
  runStep
10
11
  } from "../client.mjs";
11
12
  import {
@@ -781,6 +782,7 @@ function filterResponseHeaders(headers) {
781
782
  }
782
783
  async function runStoryboard(agentUrlOrUrls, storyboard, options = {}) {
783
784
  options = applyReusableProfileOptions(options);
785
+ if (hasTestClientScope() && !options._discoveryPass) options = { ...options, _discoveryPass: {} };
784
786
  return withMCPConnectionScope(
785
787
  async () => {
786
788
  options = applyStoryboardVersionOptions(storyboard, options);
@@ -790,6 +792,18 @@ async function runStoryboard(agentUrlOrUrls, storyboard, options = {}) {
790
792
  });
791
793
  options = resolveDeclaredTestKit(storyboard, options);
792
794
  options = applyNativeA2AComplianceTransportOptions(options);
795
+ if (hasTestClientScope() && options._client && !options.agents) {
796
+ const resolution = getOrCreateClientResolution(
797
+ typeof agentUrlOrUrls === "string" ? agentUrlOrUrls : agentUrlOrUrls[0],
798
+ options
799
+ );
800
+ const discovered = await getOrDiscoverProfile(resolution.client, options);
801
+ options = {
802
+ ...options,
803
+ _profile: discovered.step.passed ? discovered.profile : void 0,
804
+ agentTools: discovered.step.passed ? discovered.profile.tools : void 0
805
+ };
806
+ }
793
807
  const schemaRoot = getRunSchemaRoot(options);
794
808
  if (schemaRoot) {
795
809
  return await withExternalSchemaRoot(
@@ -800,7 +814,7 @@ async function runStoryboard(agentUrlOrUrls, storyboard, options = {}) {
800
814
  }
801
815
  return await runStoryboardBody(agentUrlOrUrls, storyboard, options);
802
816
  },
803
- { isolate: true }
817
+ { isolate: !hasTestClientScope() }
804
818
  );
805
819
  }
806
820
  async function runStoryboardBody(agentUrlOrUrls, storyboard, options) {
@@ -1551,7 +1565,7 @@ async function executeStoryboardPass(agentUrls, storyboard, options, dispatchOff
1551
1565
  let clients;
1552
1566
  let routingContext;
1553
1567
  let profile;
1554
- let callerOwnsClients = false;
1568
+ let callerOwnsClients = hasTestClientScope();
1555
1569
  if (useRouting) {
1556
1570
  try {
1557
1571
  routingContext = await buildRoutingContext(storyboard, options);
@@ -1563,7 +1577,7 @@ async function executeStoryboardPass(agentUrls, storyboard, options, dispatchOff
1563
1577
  duration_ms: 0,
1564
1578
  error: detail
1565
1579
  };
1566
- await closeScopedConnections(options.protocol);
1580
+ if (!callerOwnsClients) await closeScopedConnections(options.protocol);
1567
1581
  return buildDiscoveryFailedResult(agentUrls, storyboard, failedStep);
1568
1582
  }
1569
1583
  clients = [...routingContext.clients.values()];
@@ -1577,17 +1591,19 @@ async function executeStoryboardPass(agentUrls, storyboard, options, dispatchOff
1577
1591
  } else {
1578
1592
  const clientResolutions = agentUrls.map((url) => getOrCreateClientResolution(url, options));
1579
1593
  clients = clientResolutions.map((r) => r.client);
1580
- callerOwnsClients = clientResolutions.some((r) => r.reusedShared);
1594
+ callerOwnsClients ||= clientResolutions.some((r) => r.reusedShared);
1581
1595
  resetClientSessions(clients);
1582
- if (!callerOwnsClients) {
1596
+ if (hasTestClientScope() || !callerOwnsClients) {
1583
1597
  const discovered = await getOrDiscoverProfile(clients[0], options);
1584
1598
  if (discovered.step.passed === false) {
1585
- await closeScopedConnections(options.protocol);
1599
+ if (!callerOwnsClients) await closeScopedConnections(options.protocol);
1586
1600
  return buildDiscoveryFailedResult(agentUrls, storyboard, discovered.step);
1587
1601
  }
1588
1602
  profile = discovered.profile;
1589
1603
  const profileTools = normalizeAgentToolNames(profile?.tools);
1590
- if (!options.agentTools && profileTools) {
1604
+ if (hasTestClientScope() && profileTools) {
1605
+ options = { ...options, agentTools: profileTools, _profile: profile };
1606
+ } else if (!options.agentTools && profileTools) {
1591
1607
  options = { ...options, agentTools: profileTools, _profile: profile };
1592
1608
  } else if (profile && !options._profile) {
1593
1609
  options = { ...options, _profile: profile };
@@ -3130,7 +3146,7 @@ async function runStoryboardStep(agentUrl, storyboard, stepId, options = {}) {
3130
3146
  }
3131
3147
  return await runStoryboardStepBody(agentUrl, storyboard, stepId, options);
3132
3148
  },
3133
- { isolate: true }
3149
+ { isolate: !hasTestClientScope() }
3134
3150
  );
3135
3151
  }
3136
3152
  async function runStoryboardStepBody(agentUrl, storyboard, stepId, options) {
@@ -197,7 +197,7 @@ export interface UpstreamTrafficQueryResult {
197
197
  */
198
198
  export declare function runValidations(validations: StoryboardValidation[], context: ValidationContext): ValidationResult[];
199
199
  /** Capability semver emitted in run summaries and used for advisory expiry. */
200
- export declare const RUNNER_CAPABILITY_VERSION = "15.9.0";
200
+ export declare const RUNNER_CAPABILITY_VERSION = "16.0.0-beta.1";
201
201
  /** True when a failed validation contributes to the owning step's grade. */
202
202
  export declare function validationFailsStep(result: ValidationResult): boolean;
203
203
  /**
@@ -197,7 +197,7 @@ export interface UpstreamTrafficQueryResult {
197
197
  */
198
198
  export declare function runValidations(validations: StoryboardValidation[], context: ValidationContext): ValidationResult[];
199
199
  /** Capability semver emitted in run summaries and used for advisory expiry. */
200
- export declare const RUNNER_CAPABILITY_VERSION = "15.9.0";
200
+ export declare const RUNNER_CAPABILITY_VERSION = "16.0.0-beta.1";
201
201
  /** True when a failed validation contributes to the owning step's grade. */
202
202
  export declare function validationFailsStep(result: ValidationResult): boolean;
203
203
  /**
@@ -285,6 +285,8 @@ export interface AdcpPrivateJsonWebKey {
285
285
  export type AgentRequestSigningConfig = AgentRequestSigningConfigInline | AgentRequestSigningConfigProvider;
286
286
  /** Operation-list overrides shared by both `request_signing` shapes. */
287
287
  export interface AgentRequestSigningOperationOverrides {
288
+ /** Experimental 3.3 opt-in. Omitted retains the RFC 9421 AdCP profile. */
289
+ profile?: 'rfc9421' | 'web-bot-auth';
288
290
  /**
289
291
  * AdCP operation names to sign regardless of the seller's advertisement.
290
292
  * Useful during pilots before a counterparty flips an op into `required_for`.
@@ -365,6 +367,8 @@ export interface AgentRequestSigningConfigProvider extends AgentRequestSigningOp
365
367
  * KMS adapter.
366
368
  */
367
369
  provider: SigningProvider;
370
+ /** Required for Web Bot Auth: public JWK used to derive the RFC 7638 kid. */
371
+ public_key?: import('../signing/types.mjs').AdcpJsonWebKey;
368
372
  /** Agent base URL — same semantics as the inline shape. */
369
373
  agent_url: string;
370
374
  }
@@ -285,6 +285,8 @@ export interface AdcpPrivateJsonWebKey {
285
285
  export type AgentRequestSigningConfig = AgentRequestSigningConfigInline | AgentRequestSigningConfigProvider;
286
286
  /** Operation-list overrides shared by both `request_signing` shapes. */
287
287
  export interface AgentRequestSigningOperationOverrides {
288
+ /** Experimental 3.3 opt-in. Omitted retains the RFC 9421 AdCP profile. */
289
+ profile?: 'rfc9421' | 'web-bot-auth';
288
290
  /**
289
291
  * AdCP operation names to sign regardless of the seller's advertisement.
290
292
  * Useful during pilots before a counterparty flips an op into `required_for`.
@@ -365,6 +367,8 @@ export interface AgentRequestSigningConfigProvider extends AgentRequestSigningOp
365
367
  * KMS adapter.
366
368
  */
367
369
  provider: SigningProvider;
370
+ /** Required for Web Bot Auth: public JWK used to derive the RFC 7638 kid. */
371
+ public_key?: import('../signing/types').AdcpJsonWebKey;
368
372
  /** Agent base URL — same semantics as the inline shape. */
369
373
  agent_url: string;
370
374
  }
@@ -23522,7 +23522,7 @@ export declare const SyncReportingStatusRequestSchema: z.ZodObject<{
23522
23522
  context: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
23523
23523
  ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
23524
23524
  }, z.core.$loose> & {
23525
- pick: <M extends z.core.util.Mask<"account" | "ext" | "adcp_major_version" | "adcp_version" | "context" | "idempotency_key" | "statuses">>(mask: M & Record<Exclude<keyof M, "account" | "ext" | "adcp_major_version" | "adcp_version" | "context" | "idempotency_key" | "statuses">, never>) => z.ZodObject<Pick<{
23525
+ pick: <M extends z.core.util.Mask<"account" | "ext" | "context" | "adcp_version" | "adcp_major_version" | "idempotency_key" | "statuses">>(mask: M & Record<Exclude<keyof M, "account" | "ext" | "context" | "adcp_version" | "adcp_major_version" | "idempotency_key" | "statuses">, never>) => z.ZodObject<Pick<{
23526
23526
  adcp_version: z.ZodOptional<z.ZodString>;
23527
23527
  adcp_major_version: z.ZodOptional<z.ZodNumber>;
23528
23528
  account: z.ZodUnion<readonly [z.ZodObject<{
@@ -23727,8 +23727,8 @@ export declare const SyncReportingStatusRequestSchema: z.ZodObject<{
23727
23727
  }>;
23728
23728
  context: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
23729
23729
  ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
23730
- }, Extract<"account", keyof M> | Extract<"ext", keyof M> | Extract<"adcp_major_version", keyof M> | Extract<"adcp_version", keyof M> | Extract<"context", keyof M> | Extract<"idempotency_key", keyof M> | Extract<"statuses", keyof M>> extends infer T ? { [k in keyof T]: T[k]; } : never, z.core.$loose>;
23731
- omit: <M extends z.core.util.Mask<"account" | "ext" | "adcp_major_version" | "adcp_version" | "context" | "idempotency_key" | "statuses">>(mask: M & Record<Exclude<keyof M, "account" | "ext" | "adcp_major_version" | "adcp_version" | "context" | "idempotency_key" | "statuses">, never>) => z.ZodObject<Omit<{
23730
+ }, Extract<"account", keyof M> | Extract<"ext", keyof M> | Extract<"context", keyof M> | Extract<"adcp_version", keyof M> | Extract<"adcp_major_version", keyof M> | Extract<"idempotency_key", keyof M> | Extract<"statuses", keyof M>> extends infer T ? { [k in keyof T]: T[k]; } : never, z.core.$loose>;
23731
+ omit: <M extends z.core.util.Mask<"account" | "ext" | "context" | "adcp_version" | "adcp_major_version" | "idempotency_key" | "statuses">>(mask: M & Record<Exclude<keyof M, "account" | "ext" | "context" | "adcp_version" | "adcp_major_version" | "idempotency_key" | "statuses">, never>) => z.ZodObject<Omit<{
23732
23732
  adcp_version: z.ZodOptional<z.ZodString>;
23733
23733
  adcp_major_version: z.ZodOptional<z.ZodNumber>;
23734
23734
  account: z.ZodUnion<readonly [z.ZodObject<{
@@ -23933,8 +23933,8 @@ export declare const SyncReportingStatusRequestSchema: z.ZodObject<{
23933
23933
  }>;
23934
23934
  context: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
23935
23935
  ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
23936
- }, Extract<"account", keyof M> | Extract<"ext", keyof M> | Extract<"adcp_major_version", keyof M> | Extract<"adcp_version", keyof M> | Extract<"context", keyof M> | Extract<"idempotency_key", keyof M> | Extract<"statuses", keyof M>> extends infer T ? { [k in keyof T]: T[k]; } : never, z.core.$loose>;
23937
- extend: <U extends z.core.$ZodLooseShape>(shape: U) => z.ZodObject<(("account" | "ext" | "adcp_major_version" | "adcp_version" | "context" | "idempotency_key" | "statuses") & keyof U extends never ? {
23936
+ }, Extract<"account", keyof M> | Extract<"ext", keyof M> | Extract<"context", keyof M> | Extract<"adcp_version", keyof M> | Extract<"adcp_major_version", keyof M> | Extract<"idempotency_key", keyof M> | Extract<"statuses", keyof M>> extends infer T ? { [k in keyof T]: T[k]; } : never, z.core.$loose>;
23937
+ extend: <U extends z.core.$ZodLooseShape>(shape: U) => z.ZodObject<(("account" | "ext" | "context" | "adcp_version" | "adcp_major_version" | "idempotency_key" | "statuses") & keyof U extends never ? {
23938
23938
  adcp_version: z.ZodOptional<z.ZodString>;
23939
23939
  adcp_major_version: z.ZodOptional<z.ZodNumber>;
23940
23940
  account: z.ZodUnion<readonly [z.ZodObject<{
@@ -24550,7 +24550,7 @@ export declare const SyncReportingStatusRequestSchema: z.ZodObject<{
24550
24550
  }>;
24551
24551
  context: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
24552
24552
  ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
24553
- }, U> & Partial<Record<"account" | "ext" | "adcp_major_version" | "adcp_version" | "context" | "idempotency_key" | "statuses", z.core.SomeType>>) => z.ZodObject<(("account" | "ext" | "adcp_major_version" | "adcp_version" | "context" | "idempotency_key" | "statuses") & keyof U extends never ? {
24553
+ }, U> & Partial<Record<"account" | "ext" | "context" | "adcp_version" | "adcp_major_version" | "idempotency_key" | "statuses", z.core.SomeType>>) => z.ZodObject<(("account" | "ext" | "context" | "adcp_version" | "adcp_major_version" | "idempotency_key" | "statuses") & keyof U extends never ? {
24554
24554
  adcp_version: z.ZodOptional<z.ZodString>;
24555
24555
  adcp_major_version: z.ZodOptional<z.ZodNumber>;
24556
24556
  account: z.ZodUnion<readonly [z.ZodObject<{
@@ -53,6 +53,7 @@ export interface MediaBuyFeatures {
53
53
  * Account management capabilities declared by the seller
54
54
  */
55
55
  export interface AccountCapabilities {
56
+ agentOnboarding?: import('../identity-3.3/types.mjs').AgentOnboarding;
56
57
  /** Seller-issued IDs are stable and accepted wherever an account reference is used. */
57
58
  stableAccountId?: boolean;
58
59
  /** Optional account change feed; absence does not imply support. */