@adcp/sdk 14.0.0-beta.12 → 14.0.0-beta.13

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 (175) hide show
  1. package/dist/lib/index.d.mts +3 -3
  2. package/dist/lib/index.d.ts +3 -3
  3. package/dist/lib/index.d.ts.map +1 -1
  4. package/dist/lib/index.js +2 -0
  5. package/dist/lib/index.js.map +1 -1
  6. package/dist/lib/index.mjs +3 -1
  7. package/dist/lib/index.mjs.map +1 -1
  8. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  9. package/dist/lib/server/create-adcp-server.d.mts +2 -2
  10. package/dist/lib/server/create-adcp-server.d.ts +2 -2
  11. package/dist/lib/server/create-adcp-server.d.ts.map +1 -1
  12. package/dist/lib/server/create-adcp-server.js +6 -1
  13. package/dist/lib/server/create-adcp-server.js.map +1 -1
  14. package/dist/lib/server/create-adcp-server.mjs +6 -1
  15. package/dist/lib/server/create-adcp-server.mjs.map +1 -1
  16. package/dist/lib/server/decisioning/index.d.mts +3 -3
  17. package/dist/lib/server/decisioning/index.d.ts +3 -3
  18. package/dist/lib/server/decisioning/index.d.ts.map +1 -1
  19. package/dist/lib/server/decisioning/index.js.map +1 -1
  20. package/dist/lib/server/decisioning/index.mjs.map +1 -1
  21. package/dist/lib/server/decisioning/runtime/from-platform.d.mts +24 -17
  22. package/dist/lib/server/decisioning/runtime/from-platform.d.ts +24 -17
  23. package/dist/lib/server/decisioning/runtime/from-platform.d.ts.map +1 -1
  24. package/dist/lib/server/decisioning/runtime/from-platform.js +71 -42
  25. package/dist/lib/server/decisioning/runtime/from-platform.js.map +1 -1
  26. package/dist/lib/server/decisioning/runtime/from-platform.mjs +75 -43
  27. package/dist/lib/server/decisioning/runtime/from-platform.mjs.map +1 -1
  28. package/dist/lib/server/decisioning/runtime/postgres-task-registry.d.mts +15 -21
  29. package/dist/lib/server/decisioning/runtime/postgres-task-registry.d.ts +15 -21
  30. package/dist/lib/server/decisioning/runtime/postgres-task-registry.d.ts.map +1 -1
  31. package/dist/lib/server/decisioning/runtime/postgres-task-registry.js +100 -30
  32. package/dist/lib/server/decisioning/runtime/postgres-task-registry.js.map +1 -1
  33. package/dist/lib/server/decisioning/runtime/postgres-task-registry.mjs +100 -30
  34. package/dist/lib/server/decisioning/runtime/postgres-task-registry.mjs.map +1 -1
  35. package/dist/lib/server/decisioning/runtime/task-registry.d.mts +30 -16
  36. package/dist/lib/server/decisioning/runtime/task-registry.d.ts +30 -16
  37. package/dist/lib/server/decisioning/runtime/task-registry.d.ts.map +1 -1
  38. package/dist/lib/server/decisioning/runtime/task-registry.js +40 -20
  39. package/dist/lib/server/decisioning/runtime/task-registry.js.map +1 -1
  40. package/dist/lib/server/decisioning/runtime/task-registry.mjs +38 -19
  41. package/dist/lib/server/decisioning/runtime/task-registry.mjs.map +1 -1
  42. package/dist/lib/server/decisioning/runtime/to-context.d.mts +2 -2
  43. package/dist/lib/server/decisioning/runtime/to-context.d.ts +2 -2
  44. package/dist/lib/server/decisioning/runtime/to-context.d.ts.map +1 -1
  45. package/dist/lib/server/decisioning/runtime/to-context.js +2 -2
  46. package/dist/lib/server/decisioning/runtime/to-context.js.map +1 -1
  47. package/dist/lib/server/decisioning/runtime/to-context.mjs +2 -2
  48. package/dist/lib/server/decisioning/runtime/to-context.mjs.map +1 -1
  49. package/dist/lib/server/decisioning/specialisms/creative-ad-server.d.mts +3 -2
  50. package/dist/lib/server/decisioning/specialisms/creative-ad-server.d.ts +3 -2
  51. package/dist/lib/server/decisioning/specialisms/creative-ad-server.d.ts.map +1 -1
  52. package/dist/lib/server/decisioning/specialisms/creative-ad-server.js.map +1 -1
  53. package/dist/lib/server/decisioning/specialisms/creative.d.mts +10 -10
  54. package/dist/lib/server/decisioning/specialisms/creative.d.ts +10 -10
  55. package/dist/lib/server/decisioning/specialisms/creative.d.ts.map +1 -1
  56. package/dist/lib/server/decisioning/specialisms/creative.js.map +1 -1
  57. package/dist/lib/server/index.d.mts +1 -1
  58. package/dist/lib/server/index.d.ts +1 -1
  59. package/dist/lib/server/index.d.ts.map +1 -1
  60. package/dist/lib/server/index.js.map +1 -1
  61. package/dist/lib/server/index.mjs.map +1 -1
  62. package/dist/lib/testing/storyboard/default-invariants.d.ts.map +1 -1
  63. package/dist/lib/testing/storyboard/default-invariants.js +11 -2
  64. package/dist/lib/testing/storyboard/default-invariants.js.map +1 -1
  65. package/dist/lib/testing/storyboard/default-invariants.mjs +11 -2
  66. package/dist/lib/testing/storyboard/default-invariants.mjs.map +1 -1
  67. package/dist/lib/testing/storyboard/index.d.mts +1 -1
  68. package/dist/lib/testing/storyboard/index.d.ts +1 -1
  69. package/dist/lib/testing/storyboard/index.d.ts.map +1 -1
  70. package/dist/lib/testing/storyboard/index.js.map +1 -1
  71. package/dist/lib/testing/storyboard/index.mjs.map +1 -1
  72. package/dist/lib/testing/storyboard/loader.d.ts.map +1 -1
  73. package/dist/lib/testing/storyboard/loader.js +14 -0
  74. package/dist/lib/testing/storyboard/loader.js.map +1 -1
  75. package/dist/lib/testing/storyboard/loader.mjs +14 -0
  76. package/dist/lib/testing/storyboard/loader.mjs.map +1 -1
  77. package/dist/lib/testing/storyboard/phase-condition.d.mts +41 -0
  78. package/dist/lib/testing/storyboard/phase-condition.d.ts +42 -0
  79. package/dist/lib/testing/storyboard/phase-condition.d.ts.map +1 -0
  80. package/dist/lib/testing/storyboard/phase-condition.js +215 -0
  81. package/dist/lib/testing/storyboard/phase-condition.js.map +1 -0
  82. package/dist/lib/testing/storyboard/phase-condition.mjs +189 -0
  83. package/dist/lib/testing/storyboard/phase-condition.mjs.map +1 -0
  84. package/dist/lib/testing/storyboard/request-builder.d.ts.map +1 -1
  85. package/dist/lib/testing/storyboard/request-builder.js +15 -2
  86. package/dist/lib/testing/storyboard/request-builder.js.map +1 -1
  87. package/dist/lib/testing/storyboard/request-builder.mjs +15 -2
  88. package/dist/lib/testing/storyboard/request-builder.mjs.map +1 -1
  89. package/dist/lib/testing/storyboard/runner.d.ts.map +1 -1
  90. package/dist/lib/testing/storyboard/runner.js +57 -23
  91. package/dist/lib/testing/storyboard/runner.js.map +1 -1
  92. package/dist/lib/testing/storyboard/runner.mjs +57 -23
  93. package/dist/lib/testing/storyboard/runner.mjs.map +1 -1
  94. package/dist/lib/testing/storyboard/task-map.d.ts.map +1 -1
  95. package/dist/lib/testing/storyboard/task-map.js +6 -2
  96. package/dist/lib/testing/storyboard/task-map.js.map +1 -1
  97. package/dist/lib/testing/storyboard/task-map.mjs +6 -2
  98. package/dist/lib/testing/storyboard/task-map.mjs.map +1 -1
  99. package/dist/lib/testing/storyboard/types.d.mts +5 -4
  100. package/dist/lib/testing/storyboard/types.d.ts +5 -4
  101. package/dist/lib/testing/storyboard/types.d.ts.map +1 -1
  102. package/dist/lib/testing/storyboard/types.js.map +1 -1
  103. package/dist/lib/testing/storyboard/types.mjs.map +1 -1
  104. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  105. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  106. package/dist/lib/testing/storyboard/webhook-assertions.d.ts.map +1 -1
  107. package/dist/lib/testing/storyboard/webhook-assertions.js +60 -4
  108. package/dist/lib/testing/storyboard/webhook-assertions.js.map +1 -1
  109. package/dist/lib/testing/storyboard/webhook-assertions.mjs +60 -4
  110. package/dist/lib/testing/storyboard/webhook-assertions.mjs.map +1 -1
  111. package/dist/lib/testing/storyboard/webhook-receiver.d.mts +15 -0
  112. package/dist/lib/testing/storyboard/webhook-receiver.d.ts +15 -0
  113. package/dist/lib/testing/storyboard/webhook-receiver.d.ts.map +1 -1
  114. package/dist/lib/testing/storyboard/webhook-receiver.js +57 -6
  115. package/dist/lib/testing/storyboard/webhook-receiver.js.map +1 -1
  116. package/dist/lib/testing/storyboard/webhook-receiver.mjs +57 -6
  117. package/dist/lib/testing/storyboard/webhook-receiver.mjs.map +1 -1
  118. package/dist/lib/testing/types.d.mts +2 -0
  119. package/dist/lib/testing/types.d.ts +2 -0
  120. package/dist/lib/testing/types.d.ts.map +1 -1
  121. package/dist/lib/testing/types.js.map +1 -1
  122. package/dist/lib/types/core.generated.d.mts +5 -2
  123. package/dist/lib/types/core.generated.d.ts +5 -2
  124. package/dist/lib/types/core.generated.d.ts.map +1 -1
  125. package/dist/lib/types/core.generated.js.map +1 -1
  126. package/dist/lib/types/index.d.mts +1 -1
  127. package/dist/lib/types/index.d.ts +1 -1
  128. package/dist/lib/types/index.d.ts.map +1 -1
  129. package/dist/lib/types/index.js.map +1 -1
  130. package/dist/lib/types/index.mjs.map +1 -1
  131. package/dist/lib/types/list-transformers.d.ts +9 -5
  132. package/dist/lib/types/schemas.generated.d.ts +21 -298
  133. package/dist/lib/types/schemas.generated.d.ts.map +1 -1
  134. package/dist/lib/types/schemas.generated.js +5 -2
  135. package/dist/lib/types/schemas.generated.js.map +1 -1
  136. package/dist/lib/types/schemas.generated.mjs +4 -2
  137. package/dist/lib/types/schemas.generated.mjs.map +1 -1
  138. package/dist/lib/types/server-payload-aliases.d.mts +2 -1
  139. package/dist/lib/types/server-payload-aliases.d.ts +2 -1
  140. package/dist/lib/types/server-payload-aliases.d.ts.map +1 -1
  141. package/dist/lib/types/server-payload-aliases.js.map +1 -1
  142. package/dist/lib/types/tools.generated.d.mts +5 -2
  143. package/dist/lib/types/tools.generated.d.ts +5 -2
  144. package/dist/lib/types/tools.generated.d.ts.map +1 -1
  145. package/dist/lib/types/tools.generated.js.map +1 -1
  146. package/dist/lib/utils/build-creative-return-builders.d.mts +5 -1
  147. package/dist/lib/utils/build-creative-return-builders.d.ts +5 -1
  148. package/dist/lib/utils/build-creative-return-builders.d.ts.map +1 -1
  149. package/dist/lib/utils/build-creative-return-builders.js +9 -3
  150. package/dist/lib/utils/build-creative-return-builders.js.map +1 -1
  151. package/dist/lib/utils/build-creative-return-builders.mjs +7 -2
  152. package/dist/lib/utils/build-creative-return-builders.mjs.map +1 -1
  153. package/dist/lib/utils/response-unwrapper.js +1 -1
  154. package/dist/lib/utils/response-unwrapper.js.map +1 -1
  155. package/dist/lib/utils/response-unwrapper.mjs +1 -1
  156. package/dist/lib/utils/response-unwrapper.mjs.map +1 -1
  157. package/dist/lib/validation/schema-loader.d.ts.map +1 -1
  158. package/dist/lib/validation/schema-loader.js +16 -7
  159. package/dist/lib/validation/schema-loader.js.map +1 -1
  160. package/dist/lib/validation/schema-loader.mjs +16 -7
  161. package/dist/lib/validation/schema-loader.mjs.map +1 -1
  162. package/dist/lib/version.d.mts +3 -3
  163. package/dist/lib/version.d.ts +3 -3
  164. package/dist/lib/version.js +3 -3
  165. package/dist/lib/version.js.map +1 -1
  166. package/dist/lib/version.mjs +3 -3
  167. package/dist/lib/version.mjs.map +1 -1
  168. package/docs/llms.txt +2 -2
  169. package/docs/migration-5.x-to-6.x.md +3 -2
  170. package/docs/migration-task-registry-scoping.md +61 -0
  171. package/examples/hello_seller_adapter_guaranteed.ts +1 -1
  172. package/package.json +4 -4
  173. package/skills/build-decisioning-creative-template/SKILL.md +2 -2
  174. package/skills/build-decisioning-platform/SKILL.md +4 -2
  175. package/skills/build-decisioning-platform/advanced/REFERENCE.md +7 -6
@@ -69,6 +69,7 @@ import { readBrandJsonUrl } from "../../signing/agent-resolver/capabilities-type
69
69
  import { selectAgentByUrl } from "../../signing/agent-resolver/select-agent.mjs";
70
70
  import { resolveDeclaredTestKit, selectProbeTask, validateTestKit } from "./test-kit.mjs";
71
71
  import { validateStoryboardShape } from "./loader.mjs";
72
+ import { evaluatePhaseCondition, phaseConditionUsesContext } from "./phase-condition.mjs";
72
73
  import { trustedStoryboardComplianceRoot } from "./provenance.mjs";
73
74
  import { probeRequestSigningVector } from "./request-signing/probe-dispatch.mjs";
74
75
  import { createWebhookReceiver } from "./webhook-receiver.mjs";
@@ -1580,9 +1581,10 @@ async function executeStoryboardPass(agentUrls, storyboard, options, dispatchOff
1580
1581
  storyboard,
1581
1582
  phaseCapabilitySkipDetails
1582
1583
  );
1583
- const capabilitySkippedPhaseIds = /* @__PURE__ */ new Set([
1584
+ const preflightExcludedPhaseIds = /* @__PURE__ */ new Set([
1584
1585
  ...phaseCapabilitySkipDetails.keys(),
1585
- ...storyboard.phases.filter((phase) => shouldSkipPhase(phase, options)).map((phase) => phase.id)
1586
+ ...storyboard.phases.filter((phase) => shouldSkipPhaseBeforeRun(phase, options)).map((phase) => phase.id),
1587
+ ...storyboard.phases.filter((phase) => phaseUsesRuntimeContext(phase)).map((phase) => phase.id)
1586
1588
  ]);
1587
1589
  let creativeAssetFixtureGap = preflightRemainingCreativeAssetDirectives(
1588
1590
  allSteps,
@@ -1605,7 +1607,7 @@ async function executeStoryboardPass(agentUrls, storyboard, options, dispatchOff
1605
1607
  storyboardRequiresRequestSigner: allRequires.includes("request_signer"),
1606
1608
  storyboardRequiresPublisherAuthRunner: storyboard.requires?.includes("trusted_match_publisher_auth_runner") === true
1607
1609
  },
1608
- capabilitySkippedPhaseIds
1610
+ preflightExcludedPhaseIds
1609
1611
  );
1610
1612
  let creativeAssetFixtureGapRecorded = false;
1611
1613
  if (!hasExecutableSteps) {
@@ -1737,7 +1739,7 @@ async function executeStoryboardPass(agentUrls, storyboard, options, dispatchOff
1737
1739
  context,
1738
1740
  options,
1739
1741
  buildExecutionState(),
1740
- capabilitySkippedPhaseIds
1742
+ preflightExcludedPhaseIds
1741
1743
  );
1742
1744
  }
1743
1745
  for (const phase of storyboard.phases) {
@@ -1816,7 +1818,7 @@ async function executeStoryboardPass(agentUrls, storyboard, options, dispatchOff
1816
1818
  const phaseStatefulStepIds = phase.steps.filter((s) => s.stateful).map((s) => s.id);
1817
1819
  let phaseAbsent = false;
1818
1820
  let presenceDetected = false;
1819
- if (shouldSkipPhase(phase, options)) {
1821
+ if (shouldSkipPhase(phase, options, context)) {
1820
1822
  phaseResults.push({
1821
1823
  phase_id: phase.id,
1822
1824
  phase_title: phase.title,
@@ -1827,6 +1829,41 @@ async function executeStoryboardPass(agentUrls, storyboard, options, dispatchOff
1827
1829
  });
1828
1830
  continue;
1829
1831
  }
1832
+ if (phaseUsesRuntimeContext(phase)) {
1833
+ preflightExcludedPhaseIds.delete(phase.id);
1834
+ const firstPhaseStepIndex = allSteps.find((target) => target.phaseId === phase.id)?.globalIndex ?? 0;
1835
+ creativeAssetFixtureGap = preflightRemainingCreativeAssetDirectives(
1836
+ allSteps,
1837
+ firstPhaseStepIndex - 1,
1838
+ context,
1839
+ options,
1840
+ buildExecutionState(),
1841
+ preflightExcludedPhaseIds
1842
+ );
1843
+ if (creativeAssetFixtureGap?.target.phaseId === phase.id) {
1844
+ const gapStep = buildCreativeAssetFixtureUnavailableStep(
1845
+ creativeAssetFixtureGap.target.step,
1846
+ phase.id,
1847
+ context,
1848
+ allSteps,
1849
+ buildExecutionState(),
1850
+ creativeAssetFixtureGap.failure
1851
+ );
1852
+ gapStep.storyboard_id = storyboard.id;
1853
+ priorStepResults.set(gapStep.step_id, gapStep);
1854
+ skippedCount++;
1855
+ creativeAssetFixtureGapRecorded = true;
1856
+ phaseResults.push({
1857
+ phase_id: phase.id,
1858
+ phase_title: phase.title,
1859
+ passed: true,
1860
+ steps: [gapStep],
1861
+ duration_ms: Date.now() - phaseStart
1862
+ });
1863
+ priorPhaseIds.push(phase.id);
1864
+ continue;
1865
+ }
1866
+ }
1830
1867
  if (!phaseAbsent && phaseContainsOauthMetadataProbe(phase) && !agentAdvertisesOauth(profile)) {
1831
1868
  phaseAbsent = true;
1832
1869
  }
@@ -2111,7 +2148,7 @@ async function executeStoryboardPass(agentUrls, storyboard, options, dispatchOff
2111
2148
  context,
2112
2149
  options,
2113
2150
  stepExecutionState,
2114
- capabilitySkippedPhaseIds
2151
+ preflightExcludedPhaseIds
2115
2152
  );
2116
2153
  }
2117
2154
  if (creativeAssetFixtureGap) {
@@ -2325,7 +2362,8 @@ async function runMultiPass(agentUrls, storyboard, options) {
2325
2362
  );
2326
2363
  const preSeedExcludedPhaseIds = /* @__PURE__ */ new Set([
2327
2364
  ...phaseCapabilitySkipDetails.keys(),
2328
- ...storyboard.phases.filter((phase) => shouldSkipPhase(phase, options)).map((phase) => phase.id)
2365
+ ...storyboard.phases.filter((phase) => shouldSkipPhaseBeforeRun(phase, options)).map((phase) => phase.id),
2366
+ ...storyboard.phases.filter((phase) => phaseUsesRuntimeContext(phase)).map((phase) => phase.id)
2329
2367
  ]);
2330
2368
  const preSeedFixtureGap = preflightRemainingCreativeAssetDirectives(
2331
2369
  flattenSteps(storyboard),
@@ -4640,23 +4678,19 @@ function agentAdvertisesOauth(profile) {
4640
4678
  const endpoint = resolveCapabilityPath(rawCaps, "account.authorization_endpoint");
4641
4679
  return typeof endpoint === "string" && endpoint.length > 0;
4642
4680
  }
4643
- function shouldSkipPhase(phase, options) {
4681
+ function shouldSkipPhase(phase, options, context) {
4644
4682
  const expr = phase.skip_if?.trim();
4645
4683
  if (!expr) return false;
4646
- const match = /^(!?)test_kit\.([a-zA-Z0-9_.]+)$/.exec(expr);
4647
- if (!match) return false;
4648
- const negated = match[1] === "!";
4649
- const path = match[2].split(".");
4650
- let value = options.test_kit;
4651
- for (const segment of path) {
4652
- if (value == null || typeof value !== "object") {
4653
- value = void 0;
4654
- break;
4655
- }
4656
- value = value[segment];
4657
- }
4658
- const truthy = Boolean(value);
4659
- return negated ? !truthy : truthy;
4684
+ return evaluatePhaseCondition(expr, { context, test_kit: options.test_kit });
4685
+ }
4686
+ function shouldSkipPhaseBeforeRun(phase, options) {
4687
+ const expr = phase.skip_if?.trim();
4688
+ if (!expr || phaseConditionUsesContext(expr)) return false;
4689
+ return evaluatePhaseCondition(expr, { test_kit: options.test_kit });
4690
+ }
4691
+ function phaseUsesRuntimeContext(phase) {
4692
+ const expr = phase.skip_if?.trim();
4693
+ return expr ? phaseConditionUsesContext(expr) : false;
4660
4694
  }
4661
4695
  function resolveTaskName(step, options) {
4662
4696
  if (!step.task.startsWith("$test_kit.")) return step.task;
@@ -4818,7 +4852,7 @@ function applyBrandInvariant(request, options, taskName, stepFlags) {
4818
4852
  const acct = existingAccount;
4819
4853
  const isNaturalKeyVariant = "brand" in acct || "operator" in acct;
4820
4854
  if (isNaturalKeyVariant) {
4821
- const preserveWholesaleAccountBrand = taskName === "get_products" && request.buying_mode === "wholesale" && acct.brand !== void 0;
4855
+ const preserveWholesaleAccountBrand = (taskName === "get_products" && request.buying_mode === "wholesale" || taskName === "get_signals" && request.discovery_mode === "wholesale") && acct.brand !== void 0;
4822
4856
  const merged = {
4823
4857
  ...acct,
4824
4858
  brand: preserveWholesaleAccountBrand ? acct.brand : brand