@adcp/sdk 6.3.0 → 6.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/AGENTS.md +5 -0
  2. package/dist/lib/adapters/legacy/v2-5/sync_creatives.d.ts +4 -4
  3. package/dist/lib/adapters/legacy/v2-5/sync_creatives.js +4 -4
  4. package/dist/lib/adapters/legacy/v2-5/types.d.ts +1 -1
  5. package/dist/lib/adapters/legacy/v2-5/types.js +1 -1
  6. package/dist/lib/core/ConversationTypes.d.ts +3 -3
  7. package/dist/lib/core/ConversationTypes.d.ts.map +1 -1
  8. package/dist/lib/core/TaskExecutor.d.ts +4 -4
  9. package/dist/lib/core/TaskExecutor.d.ts.map +1 -1
  10. package/dist/lib/core/TaskExecutor.js +13 -13
  11. package/dist/lib/core/TaskExecutor.js.map +1 -1
  12. package/dist/lib/errors/index.d.ts +10 -8
  13. package/dist/lib/errors/index.d.ts.map +1 -1
  14. package/dist/lib/errors/index.js +10 -9
  15. package/dist/lib/errors/index.js.map +1 -1
  16. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  17. package/dist/lib/server/decisioning/tenant-registry.d.ts +40 -12
  18. package/dist/lib/server/decisioning/tenant-registry.d.ts.map +1 -1
  19. package/dist/lib/server/decisioning/tenant-registry.js.map +1 -1
  20. package/dist/lib/testing/storyboard/assertions.d.ts +19 -1
  21. package/dist/lib/testing/storyboard/assertions.d.ts.map +1 -1
  22. package/dist/lib/testing/storyboard/assertions.js.map +1 -1
  23. package/dist/lib/testing/storyboard/runner.d.ts.map +1 -1
  24. package/dist/lib/testing/storyboard/runner.js +50 -4
  25. package/dist/lib/testing/storyboard/runner.js.map +1 -1
  26. package/dist/lib/testing/storyboard/types.d.ts +32 -1
  27. package/dist/lib/testing/storyboard/types.d.ts.map +1 -1
  28. package/dist/lib/testing/storyboard/types.js.map +1 -1
  29. package/dist/lib/testing/storyboard/validations.d.ts.map +1 -1
  30. package/dist/lib/testing/storyboard/validations.js +176 -0
  31. package/dist/lib/testing/storyboard/validations.js.map +1 -1
  32. package/dist/lib/utils/sync-creatives-adapter.d.ts +7 -7
  33. package/dist/lib/utils/sync-creatives-adapter.d.ts.map +1 -1
  34. package/dist/lib/utils/sync-creatives-adapter.js +28 -44
  35. package/dist/lib/utils/sync-creatives-adapter.js.map +1 -1
  36. package/dist/lib/version.d.ts +3 -3
  37. package/dist/lib/version.js +3 -3
  38. package/examples/decisioning-platform-broadcast-tv.ts +2 -8
  39. package/examples/decisioning-platform-mock-seller.ts +2 -4
  40. package/examples/decisioning-platform-programmatic.ts +4 -17
  41. package/package.json +1 -1
  42. package/skills/build-decisioning-platform/SKILL.md +62 -44
@@ -28,6 +28,7 @@
28
28
 
29
29
  import {
30
30
  AdcpError,
31
+ DEFAULT_REPORTING_CAPABILITIES,
31
32
  publishStatusChange,
32
33
  type DecisioningPlatform,
33
34
  type SalesPlatform,
@@ -135,14 +136,7 @@ export class BroadcastTvSeller implements DecisioningPlatform<BroadcastTvConfig,
135
136
  format_ids: [{ id: 'video_30s', agent_url: 'https://example.com/broadcast-creative-agent/mcp' }],
136
137
  delivery_type: 'guaranteed',
137
138
  publisher_properties: [{ publisher_domain: 'broadcast.example.com', selection_type: 'all' }],
138
- reporting_capabilities: {
139
- available_reporting_frequencies: ['daily'],
140
- expected_delay_minutes: 240,
141
- timezone: 'UTC',
142
- supports_webhooks: false,
143
- available_metrics: [],
144
- date_range_support: 'date_range',
145
- },
139
+ reporting_capabilities: DEFAULT_REPORTING_CAPABILITIES,
146
140
  pricing_options: [
147
141
  {
148
142
  pricing_option_id: 'cpm_42_00',
@@ -41,6 +41,7 @@
41
41
  import {
42
42
  AdcpError,
43
43
  createAdcpServerFromPlatform,
44
+ DEFAULT_REPORTING_CAPABILITIES,
44
45
  type DecisioningPlatform,
45
46
  type SalesPlatform,
46
47
  type AccountStore,
@@ -162,12 +163,9 @@ const SHARED_GET_PRODUCTS = async (_req: GetProductsRequest): Promise<GetProduct
162
163
  },
163
164
  ],
164
165
  reporting_capabilities: {
166
+ ...DEFAULT_REPORTING_CAPABILITIES,
165
167
  available_reporting_frequencies: ['hourly', 'daily'],
166
168
  expected_delay_minutes: 30,
167
- timezone: 'UTC',
168
- supports_webhooks: false,
169
- available_metrics: [],
170
- date_range_support: 'date_range',
171
169
  },
172
170
  },
173
171
  ],
@@ -22,12 +22,13 @@
22
22
 
23
23
  import {
24
24
  AdcpError,
25
+ DEFAULT_REPORTING_CAPABILITIES,
25
26
  publishStatusChange,
26
27
  type DecisioningPlatform,
27
28
  type SalesPlatform,
28
29
  type AccountStore,
30
+ type SyncCreativesRow,
29
31
  } from '@adcp/sdk/server';
30
- import type { SyncCreativesRow } from '@adcp/sdk/server';
31
32
  import type {
32
33
  GetProductsRequest,
33
34
  GetProductsResponse,
@@ -104,14 +105,7 @@ export class ProgrammaticSeller implements DecisioningPlatform<ProgrammaticConfi
104
105
  format_ids: [{ id: 'display_300x250', agent_url: 'https://example.com/programmatic-creative-agent/mcp' }],
105
106
  delivery_type: 'non_guaranteed',
106
107
  publisher_properties: [{ publisher_domain: 'programmatic.example.com', selection_type: 'all' }],
107
- reporting_capabilities: {
108
- available_reporting_frequencies: ['daily'],
109
- expected_delay_minutes: 60,
110
- timezone: 'UTC',
111
- supports_webhooks: false,
112
- available_metrics: [],
113
- date_range_support: 'date_range',
114
- },
108
+ reporting_capabilities: { ...DEFAULT_REPORTING_CAPABILITIES, expected_delay_minutes: 60 },
115
109
  pricing_options: [
116
110
  {
117
111
  pricing_option_id: 'cpm_2_50',
@@ -128,14 +122,7 @@ export class ProgrammaticSeller implements DecisioningPlatform<ProgrammaticConfi
128
122
  format_ids: [{ id: 'video_15s', agent_url: 'https://example.com/programmatic-creative-agent/mcp' }],
129
123
  delivery_type: 'non_guaranteed',
130
124
  publisher_properties: [{ publisher_domain: 'programmatic.example.com', selection_type: 'all' }],
131
- reporting_capabilities: {
132
- available_reporting_frequencies: ['daily'],
133
- expected_delay_minutes: 60,
134
- timezone: 'UTC',
135
- supports_webhooks: false,
136
- available_metrics: [],
137
- date_range_support: 'date_range',
138
- },
125
+ reporting_capabilities: { ...DEFAULT_REPORTING_CAPABILITIES, expected_delay_minutes: 60 },
139
126
  pricing_options: [
140
127
  {
141
128
  pricing_option_id: 'cpm_18_00',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adcp/sdk",
3
- "version": "6.3.0",
3
+ "version": "6.4.0",
4
4
  "description": "AdCP SDK — client, server, and compliance harnesses for the AdContext Protocol (MCP + A2A)",
5
5
  "workspaces": [
6
6
  ".",
@@ -18,19 +18,31 @@ For 95% of sales agents, these are the only `@adcp/sdk/server` imports you need:
18
18
  ```ts
19
19
  import {
20
20
  // Server entry + persistence
21
- createAdcpServerFromPlatform, getAllAdcpMigrations, serve,
21
+ createAdcpServerFromPlatform,
22
+ getAllAdcpMigrations,
23
+ serve,
22
24
  // Wire-shape helpers (eliminate 30+ lines of boilerplate per Product)
23
- buildProduct, buildPackage, buildPricingOption,
25
+ buildProduct,
26
+ buildPackage,
27
+ buildPricingOption,
28
+ DEFAULT_REPORTING_CAPABILITIES, // required field; override per-product
24
29
  // Typed errors — pick from this catalog instead of `throw new AdcpError(...)`
25
- PackageNotFoundError, MediaBuyNotFoundError, ProductNotFoundError,
26
- BudgetTooLowError, BackwardsTimeRangeError, InvalidStateError,
27
- RateLimitedError, UnsupportedFeatureError,
30
+ PackageNotFoundError,
31
+ MediaBuyNotFoundError,
32
+ ProductNotFoundError,
33
+ BudgetTooLowError,
34
+ BackwardsTimeRangeError,
35
+ InvalidStateError,
36
+ RateLimitedError,
37
+ UnsupportedFeatureError,
28
38
  // Types
29
- type DecisioningPlatform, type SalesPlatform,
39
+ type DecisioningPlatform,
40
+ type SalesPlatform,
30
41
  } from '@adcp/sdk/server';
31
42
  ```
32
43
 
33
44
  For other agent shapes:
45
+
34
46
  - **Creative agent (template / generative):** swap `SalesPlatform` for `CreativeBuilderPlatform`
35
47
  - **Signals agent:** swap for `SignalsPlatform`
36
48
  - **Brand-rights agent:** swap for `BrandRightsPlatform`
@@ -57,10 +69,17 @@ The full export list is in `@adcp/sdk/server`. Many surfaces are marked `@deprec
57
69
  ```ts
58
70
  import {
59
71
  createAdcpServerFromPlatform,
60
- createCtxMetadataStore, memoryCtxMetadataStore,
61
- PackageNotFoundError, MediaBuyNotFoundError, ProductNotFoundError,
62
- BudgetTooLowError, BackwardsTimeRangeError, InvalidStateError,
63
- type DecisioningPlatform, type SalesPlatform,
72
+ createCtxMetadataStore,
73
+ memoryCtxMetadataStore,
74
+ DEFAULT_REPORTING_CAPABILITIES,
75
+ PackageNotFoundError,
76
+ MediaBuyNotFoundError,
77
+ ProductNotFoundError,
78
+ BudgetTooLowError,
79
+ BackwardsTimeRangeError,
80
+ InvalidStateError,
81
+ type DecisioningPlatform,
82
+ type SalesPlatform,
64
83
  } from '@adcp/sdk/server';
65
84
 
66
85
  class MyPlatform implements DecisioningPlatform {
@@ -68,13 +87,13 @@ class MyPlatform implements DecisioningPlatform {
68
87
  adcp_version: '3.0.0',
69
88
  specialisms: ['sales-non-guaranteed'] as const,
70
89
  pricingModels: ['cpm'] as const,
71
- channels: ['display', 'video'] as const, // strict literal-union — TS catches typos
90
+ channels: ['display', 'video'] as const, // strict literal-union — TS catches typos
72
91
  formats: [{ format_id: 'display_300x250' }],
73
92
  idempotency: { replay_ttl_seconds: 86400 },
74
93
  };
75
94
 
76
95
  accounts = {
77
- resolution: 'derived' as const, // single tenant; framework returns the same Account every call
96
+ resolution: 'derived' as const, // single tenant; framework returns the same Account every call
78
97
  resolve: async () => ({ id: 'pub_main', operator: 'mypub', ctx_metadata: {} }),
79
98
  upsert: async () => ({ ok: true, items: [] }),
80
99
  list: async () => ({ items: [], nextCursor: null }),
@@ -90,8 +109,11 @@ class MyPlatform implements DecisioningPlatform {
90
109
  name: p.name,
91
110
  format_ids: p.formatIds.map(id => ({ id })),
92
111
  delivery_type: 'non_guaranteed',
93
- pricing_options: [{ pricing_option_id: `${p.id}-cpm`, model: 'cpm', floor: { amount: p.floor, currency: 'USD' } }],
94
- ctx_metadata: { gam: { ad_unit_ids: p.adUnitIds } }, // stashed; framework round-trips
112
+ reporting_capabilities: DEFAULT_REPORTING_CAPABILITIES, // required see ReportingCapabilities type for all fields
113
+ pricing_options: [
114
+ { pricing_option_id: `${p.id}-cpm`, model: 'cpm', floor: { amount: p.floor, currency: 'USD' } },
115
+ ],
116
+ ctx_metadata: { gam: { ad_unit_ids: p.adUnitIds } }, // stashed; framework round-trips
95
117
  })),
96
118
  };
97
119
  },
@@ -124,8 +146,8 @@ class MyPlatform implements DecisioningPlatform {
124
146
  // Stash your platform's IDs so subsequent updateMediaBuy can hydrate them too.
125
147
  return {
126
148
  media_buy_id: order.id,
127
- status: 'pending_creatives', // creative state machine — see advanced/STATE-MACHINE.md
128
- ctx_metadata: { gam_order_id: order.gamOrderId }, // SDK persists; subsequent updateMediaBuy gets req.ctx_metadata.gam_order_id
149
+ status: 'pending_creatives', // creative state machine — see advanced/STATE-MACHINE.md
150
+ ctx_metadata: { gam_order_id: order.gamOrderId }, // SDK persists; subsequent updateMediaBuy gets req.ctx_metadata.gam_order_id
129
151
  packages: order.lineItems.map(li => ({
130
152
  package_id: li.id,
131
153
  status: 'pending_creatives',
@@ -180,14 +202,14 @@ class MyPlatform implements DecisioningPlatform {
180
202
  media_buy_id: buy.id,
181
203
  status: this.statusMappers.mediaBuy(buy.nativeStatus),
182
204
  buyer_ref: buy.buyerRef,
183
- total_budget: { amount: buy.budgetAmount, currency: buy.currency }, // REQUIRED on the wire shape
205
+ total_budget: { amount: buy.budgetAmount, currency: buy.currency }, // REQUIRED on the wire shape
184
206
  start_time: buy.startTime,
185
207
  end_time: buy.endTime,
186
208
  packages: buy.lineItems.map(li => ({
187
209
  package_id: li.id,
188
210
  status: this.statusMappers.mediaBuy(li.nativeStatus),
189
211
  buyer_ref: li.buyerRef,
190
- ctx_metadata: { gam_line_item_id: li.gamLineItemId }, // round-trip publisher state
212
+ ctx_metadata: { gam_line_item_id: li.gamLineItemId }, // round-trip publisher state
191
213
  })),
192
214
  ctx_metadata: { gam_order_id: buy.gamOrderId },
193
215
  })),
@@ -208,25 +230,25 @@ That's the agent. Five functions. The framework wires the wire protocol around i
208
230
 
209
231
  ```ts
210
232
  import {
211
- PackageNotFoundError, // wrong package_id on update
212
- MediaBuyNotFoundError, // wrong media_buy_id
213
- ProductNotFoundError, // wrong product_id on create
214
- ProductUnavailableError, // product exists but sold out
215
- CreativeNotFoundError, // wrong creative_id
216
- CreativeRejectedError, // brand-safety failed, etc.
217
- BudgetTooLowError, // under floor (correctable — buyer raises)
218
- BudgetExhaustedError, // pacing burst hit cap
219
- IdempotencyConflictError, // same key, different payload
220
- InvalidRequestError, // generic field-level bad input
221
- InvalidStateError, // illegal transition (paused → archived violations)
222
- BackwardsTimeRangeError, // start_time >= end_time
223
- AuthRequiredError, // need auth, then retry
224
- PermissionDeniedError, // auth present, lacks scope
225
- RateLimitedError, // throttled (clamps retry_after to [1, 3600])
226
- UnsupportedFeatureError, // tool unimplemented
227
- ComplianceUnsatisfiedError, // brand-safety attestation missing
228
- GovernanceDeniedError, // spending authority revoked
229
- PolicyViolationError, // categorical content rejection
233
+ PackageNotFoundError, // wrong package_id on update
234
+ MediaBuyNotFoundError, // wrong media_buy_id
235
+ ProductNotFoundError, // wrong product_id on create
236
+ ProductUnavailableError, // product exists but sold out
237
+ CreativeNotFoundError, // wrong creative_id
238
+ CreativeRejectedError, // brand-safety failed, etc.
239
+ BudgetTooLowError, // under floor (correctable — buyer raises)
240
+ BudgetExhaustedError, // pacing burst hit cap
241
+ IdempotencyConflictError, // same key, different payload
242
+ InvalidRequestError, // generic field-level bad input
243
+ InvalidStateError, // illegal transition (paused → archived violations)
244
+ BackwardsTimeRangeError, // start_time >= end_time
245
+ AuthRequiredError, // need auth, then retry
246
+ PermissionDeniedError, // auth present, lacks scope
247
+ RateLimitedError, // throttled (clamps retry_after to [1, 3600])
248
+ UnsupportedFeatureError, // tool unimplemented
249
+ ComplianceUnsatisfiedError, // brand-safety attestation missing
250
+ GovernanceDeniedError, // spending authority revoked
251
+ PolicyViolationError, // categorical content rejection
230
252
  } from '@adcp/sdk/server';
231
253
  ```
232
254
 
@@ -258,20 +280,16 @@ const meta = await ctx.ctxMetadata?.product(productId);
258
280
 
259
281
  ```ts
260
282
  import { Pool } from 'pg';
261
- import {
262
- createAdcpServerFromPlatform,
263
- getAllAdcpMigrations,
264
- serve,
265
- } from '@adcp/sdk/server';
283
+ import { createAdcpServerFromPlatform, getAllAdcpMigrations, serve } from '@adcp/sdk/server';
266
284
 
267
285
  const pool = new Pool({ connectionString: process.env.DATABASE_URL });
268
- await pool.query(getAllAdcpMigrations()); // one DDL call, all 3 tables
286
+ await pool.query(getAllAdcpMigrations()); // one DDL call, all 3 tables
269
287
 
270
288
  const platform = new MyPlatform(myAdServer);
271
289
  const server = createAdcpServerFromPlatform(platform, {
272
290
  name: 'My Sales Agent',
273
291
  version: '1.0.0',
274
- pool, // wires idempotency + ctxMetadata + taskRegistry
292
+ pool, // wires idempotency + ctxMetadata + taskRegistry
275
293
  });
276
294
 
277
295
  serve(() => server, { port: process.env.PORT });