@adcp/sdk 12.0.3 → 12.0.5
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.
- package/dist/lib/advanced.d.mts +2 -1
- package/dist/lib/advanced.d.ts +2 -1
- package/dist/lib/advanced.d.ts.map +1 -1
- package/dist/lib/advanced.js +4 -0
- package/dist/lib/advanced.js.map +1 -1
- package/dist/lib/advanced.mjs +11 -1
- package/dist/lib/advanced.mjs.map +1 -1
- package/dist/lib/protocols/mcp-modern.d.mts +1 -0
- package/dist/lib/protocols/mcp-modern.d.ts +1 -0
- package/dist/lib/protocols/mcp-modern.d.ts.map +1 -1
- package/dist/lib/protocols/mcp-modern.js +22 -5
- package/dist/lib/protocols/mcp-modern.js.map +1 -1
- package/dist/lib/protocols/mcp-modern.mjs +22 -5
- package/dist/lib/protocols/mcp-modern.mjs.map +1 -1
- package/dist/lib/protocols/mcp.d.mts +11 -0
- package/dist/lib/protocols/mcp.d.ts +11 -0
- package/dist/lib/protocols/mcp.d.ts.map +1 -1
- package/dist/lib/protocols/mcp.js +25 -8
- package/dist/lib/protocols/mcp.js.map +1 -1
- package/dist/lib/protocols/mcp.mjs +25 -8
- package/dist/lib/protocols/mcp.mjs.map +1 -1
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/server/decisioning/index.d.mts +1 -1
- package/dist/lib/server/decisioning/index.d.ts +1 -1
- package/dist/lib/server/decisioning/index.d.ts.map +1 -1
- package/dist/lib/server/decisioning/index.js.map +1 -1
- package/dist/lib/server/decisioning/index.mjs.map +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.js +21 -13
- package/dist/lib/server/decisioning/runtime/from-platform.js.map +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.mjs +21 -13
- package/dist/lib/server/decisioning/runtime/from-platform.mjs.map +1 -1
- package/dist/lib/server/decisioning/specialisms/sales.d.mts +8 -2
- package/dist/lib/server/decisioning/specialisms/sales.d.ts +8 -2
- package/dist/lib/server/decisioning/specialisms/sales.d.ts.map +1 -1
- package/dist/lib/server/decisioning/specialisms/sales.js.map +1 -1
- package/dist/lib/version.d.mts +3 -3
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/dist/lib/version.js.map +1 -1
- package/dist/lib/version.mjs +3 -3
- package/dist/lib/version.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -88,6 +88,7 @@ export type SyncEventSourcesPayload = ServerPayload<SyncEventSourcesSuccess>;
|
|
|
88
88
|
export type SyncCreativesRow = SyncCreativesSuccess['creatives'][number];
|
|
89
89
|
export type GetProductsHandlerResult = GetProductsPayload | TaskHandoff<GetProductsPayload>;
|
|
90
90
|
export type CreateMediaBuyHandlerResult = CreateMediaBuyPayload | TaskHandoff<CreateMediaBuyPayload>;
|
|
91
|
+
export type UpdateMediaBuyHandlerResult = UpdateMediaBuyPayload | TaskHandoff<UpdateMediaBuyPayload>;
|
|
91
92
|
export type SyncCreativesHandlerResult = SyncCreativesRow[] | TaskHandoff<SyncCreativesRow[]>;
|
|
92
93
|
export interface SalesPlatform<TCtxMeta = Record<string, unknown>> {
|
|
93
94
|
/** Catalog discovery: return products directly or hand off curated discovery to a background task. */
|
|
@@ -139,8 +140,13 @@ export interface SalesPlatform<TCtxMeta = Record<string, unknown>> {
|
|
|
139
140
|
* ```
|
|
140
141
|
*/
|
|
141
142
|
createMediaBuy?(req: CreateMediaBuyRequest, ctx: Ctx<TCtxMeta>): Promise<CreateMediaBuyHandlerResult>;
|
|
142
|
-
/**
|
|
143
|
-
|
|
143
|
+
/**
|
|
144
|
+
* Update a media buy. Return the patched buy immediately (sync fast path)
|
|
145
|
+
* OR `ctx.handoffToTask(fn)` when the upstream activation or approval flow
|
|
146
|
+
* must continue in the background. The framework owns task registration,
|
|
147
|
+
* caller scoping, polling, and completion webhooks on the handoff path.
|
|
148
|
+
*/
|
|
149
|
+
updateMediaBuy?(buyId: string, patch: UpdateMediaBuyRequest, ctx: Ctx<TCtxMeta>): Promise<UpdateMediaBuyHandlerResult>;
|
|
144
150
|
/**
|
|
145
151
|
* Push creatives. Return the array of wire success rows (sync fast
|
|
146
152
|
* path) OR `ctx.handoffToTask(fn)` to defer to a background task
|
|
@@ -88,6 +88,7 @@ export type SyncEventSourcesPayload = ServerPayload<SyncEventSourcesSuccess>;
|
|
|
88
88
|
export type SyncCreativesRow = SyncCreativesSuccess['creatives'][number];
|
|
89
89
|
export type GetProductsHandlerResult = GetProductsPayload | TaskHandoff<GetProductsPayload>;
|
|
90
90
|
export type CreateMediaBuyHandlerResult = CreateMediaBuyPayload | TaskHandoff<CreateMediaBuyPayload>;
|
|
91
|
+
export type UpdateMediaBuyHandlerResult = UpdateMediaBuyPayload | TaskHandoff<UpdateMediaBuyPayload>;
|
|
91
92
|
export type SyncCreativesHandlerResult = SyncCreativesRow[] | TaskHandoff<SyncCreativesRow[]>;
|
|
92
93
|
export interface SalesPlatform<TCtxMeta = Record<string, unknown>> {
|
|
93
94
|
/** Catalog discovery: return products directly or hand off curated discovery to a background task. */
|
|
@@ -139,8 +140,13 @@ export interface SalesPlatform<TCtxMeta = Record<string, unknown>> {
|
|
|
139
140
|
* ```
|
|
140
141
|
*/
|
|
141
142
|
createMediaBuy?(req: CreateMediaBuyRequest, ctx: Ctx<TCtxMeta>): Promise<CreateMediaBuyHandlerResult>;
|
|
142
|
-
/**
|
|
143
|
-
|
|
143
|
+
/**
|
|
144
|
+
* Update a media buy. Return the patched buy immediately (sync fast path)
|
|
145
|
+
* OR `ctx.handoffToTask(fn)` when the upstream activation or approval flow
|
|
146
|
+
* must continue in the background. The framework owns task registration,
|
|
147
|
+
* caller scoping, polling, and completion webhooks on the handoff path.
|
|
148
|
+
*/
|
|
149
|
+
updateMediaBuy?(buyId: string, patch: UpdateMediaBuyRequest, ctx: Ctx<TCtxMeta>): Promise<UpdateMediaBuyHandlerResult>;
|
|
144
150
|
/**
|
|
145
151
|
* Push creatives. Return the array of wire success rows (sync fast
|
|
146
152
|
* path) OR `ctx.handoffToTask(fn)` to defer to a background task
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sales.d.ts","sourceRoot":"","sources":["../../../../../src/lib/server/decisioning/specialisms/sales.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,6BAA6B,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAClG,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,0BAA0B,EAC1B,2BAA2B,EAC3B,iCAAiC,EACjC,iCAAiC,EACjC,0BAA0B,EAC1B,2BAA2B,EAC3B,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACd,MAAM,gCAAgC,CAAC;AAExC,KAAK,QAAQ,GAAG,aAAa,CAAC;AAC9B,KAAK,GAAG,CAAC,QAAQ,IAAI,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;AAEvD,MAAM,MAAM,kBAAkB,GAAG,6BAA6B,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC,CAAC;AACnG,MAAM,MAAM,qBAAqB,GAAG,aAAa,CAAC,qBAAqB,CAAC,CAAC;AACzE,MAAM,MAAM,qBAAqB,GAAG,aAAa,CAAC,qBAAqB,CAAC,CAAC;AACz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ACrB,eAAe,GACf,4BAA4B,CAC/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/lib/server/decisioning/specialisms/sales.ts"],"sourcesContent":["/**\n * SalesPlatform — sales specialism platform interface.\n *\n * **Unified hybrid shape.** `get_products`, `create_media_buy`, and `sync_creatives` use a\n * single method each. The method returns the wire success arm (sync fast\n * path) OR `ctx.handoffToTask(fn)` to promote the call to a background\n * task (HITL slow path). Branch per-call — the same method handles\n * programmatic remnant, guaranteed inventory, curated discovery, and hybrid\n * sellers. Every other tool is sync-only:\n *\n * - `get_products` — sync OR `ctx.handoffToTask(...)` for curated brief/refine flows.\n * - `create_media_buy` — sync OR `ctx.handoffToTask(...)`.\n * - `update_media_buy` — sync only. Re-approval flows that need HITL run\n * out-of-band; `publishStatusChange` carries the result.\n * - `sync_creatives` — sync OR `ctx.handoffToTask(...)`.\n * - `get_media_buy_delivery` — sync only.\n *\n * Sync-only tools that need long-running semantics use `publishStatusChange`\n * (see `status-changes.ts`) — that's the spec-aligned channel for tools\n * whose wire response unions don't define a Submitted arm.\n *\n * Each method either returns the value or throws `AdcpError` for structured\n * rejection. Generic thrown errors map to `SERVICE_UNAVAILABLE`.\n *\n * **Method groups** — implement the group(s) matching your specialism:\n *\n * | Group | Methods | Claim when |\n * |---|---|---|\n * | Core sales (required) | `getProducts`, `updateMediaBuy`, `getMediaBuyDelivery` | Any `sales-*` specialism |\n * | Core sales (unified hybrid) | `createMediaBuy` | Any `sales-*` specialism |\n * | Core sales (unified hybrid) | `syncCreatives` | Any `sales-*` specialism |\n * | Read / feedback | `getMediaBuys`, `providePerformanceFeedback`, `listCreativeFormats`, `listCreatives` | Most sellers; optional |\n * | Retail-media extensions | `syncCatalogs`, `logEvent`, `syncEventSources` | `sales-catalog-driven`, `sales-retail-media` |\n *\n * New adopters implementing a non-retail seller (GAM, FreeWheel, a social\n * platform) only need the three core-required methods plus `createMediaBuy`\n * and `syncCreatives`. The retail-media extension methods (`syncCatalogs`,\n * `logEvent`, `syncEventSources`) are unnecessary unless you claim\n * `sales-catalog-driven` or `sales-retail-media`.\n *\n * **No-account tools (`providePerformanceFeedback`, `listCreativeFormats`):**\n * the wire requests for these two tools don't carry an `account` field, so\n * `ctx.account` may be `undefined` when `accounts.resolution === 'explicit'`.\n * Three safe patterns:\n *\n * 1. **`'derived'` resolution** — `accounts.resolve(undefined)` returns a\n * singleton; `ctx.account` is always set. Best for single-tenant\n * deployers.\n * 2. **Don't implement the method** — the framework returns\n * `UNSUPPORTED_FEATURE`; buyers using the merge-seam custom handler or\n * external creative agents still receive a response.\n * 3. **Explicit-mode with defensive read** — cast `ctx.account as Account |\n * undefined` and derive the account from the request body (e.g., via a\n * `media_buy_id` lookup), or throw `AdcpError('ACCOUNT_NOT_FOUND')`.\n * Full `resolveAccount(undefined, { authInfo, toolName })` support for\n * explicit-mode lands in rc.1.\n *\n * Status: Preview / 6.0.\n *\n * @public\n */\n\nimport type { Account, NoAccountCtx } from '../account';\nimport type { RequestContext } from '../context';\nimport type { TaskHandoff } from '../async-outcome';\nimport type { RequireCacheScopeWhenProducts, ServerPayload } from '../../../types/server-payload';\nimport type {\n GetProductsRequest,\n GetProductsResponse,\n CreateMediaBuyRequest,\n CreateMediaBuySuccess,\n UpdateMediaBuyRequest,\n UpdateMediaBuySuccess,\n GetMediaBuysRequest,\n GetMediaBuysResponse,\n GetMediaBuyDeliveryRequest,\n GetMediaBuyDeliveryResponse,\n ProvidePerformanceFeedbackRequest,\n ProvidePerformanceFeedbackSuccess,\n ListCreativeFormatsRequest,\n ListCreativeFormatsResponse,\n ListCreativesRequest,\n ListCreativesResponse,\n SyncCatalogsRequest,\n SyncCatalogsSuccess,\n LogEventRequest,\n LogEventSuccess,\n SyncEventSourcesRequest,\n SyncEventSourcesSuccess,\n SyncCreativesError,\n SyncCreativesSuccess,\n CreativeAsset,\n} from '../../../types/tools.generated';\n\ntype Creative = CreativeAsset;\ntype Ctx<TCtxMeta> = RequestContext<Account<TCtxMeta>>;\n\nexport type GetProductsPayload = RequireCacheScopeWhenProducts<ServerPayload<GetProductsResponse>>;\nexport type CreateMediaBuyPayload = ServerPayload<CreateMediaBuySuccess>;\nexport type UpdateMediaBuyPayload = ServerPayload<UpdateMediaBuySuccess>;\nexport type GetMediaBuyDeliveryPayload = ServerPayload<GetMediaBuyDeliveryResponse>;\nexport type GetMediaBuysPayload = ServerPayload<GetMediaBuysResponse>;\nexport type ProvidePerformanceFeedbackPayload = ServerPayload<ProvidePerformanceFeedbackSuccess>;\nexport type ListCreativeFormatsPayload = ServerPayload<ListCreativeFormatsResponse>;\nexport type ListCreativesPayload = ServerPayload<ListCreativesResponse>;\nexport type SyncCreativesSuccessPayload = ServerPayload<SyncCreativesSuccess>;\nexport type SyncCreativesErrorPayload = ServerPayload<SyncCreativesError>;\nexport type SyncCreativesPayload = SyncCreativesSuccessPayload | SyncCreativesErrorPayload;\nexport type SyncCatalogsPayload = ServerPayload<SyncCatalogsSuccess>;\nexport type LogEventPayload = ServerPayload<LogEventSuccess>;\nexport type SyncEventSourcesPayload = ServerPayload<SyncEventSourcesSuccess>;\n\n/**\n * Wire success-row shape for `sync_creatives`. Returning the array of these\n * rows from `syncCreatives` is what adopters write — the framework wraps\n * with `{ creatives: [...] }` to form `SyncCreativesSuccess`.\n */\nexport type SyncCreativesRow = SyncCreativesSuccess['creatives'][number];\nexport type GetProductsHandlerResult = GetProductsPayload | TaskHandoff<GetProductsPayload>;\nexport type CreateMediaBuyHandlerResult = CreateMediaBuyPayload | TaskHandoff<CreateMediaBuyPayload>;\nexport type SyncCreativesHandlerResult = SyncCreativesRow[] | TaskHandoff<SyncCreativesRow[]>;\n\nexport interface SalesPlatform<TCtxMeta = Record<string, unknown>> {\n // **Method shape — all optional, enforced per-specialism.** Every method on\n // `SalesPlatform` is declared optional so the type accommodates non-media-\n // buy walled gardens (sales-social, audience-sync, sales-proposal-mode)\n // that don't accept inbound media buys but compose ingestion methods on\n // this same surface. Compile-time enforcement of \"you claimed\n // sales-non-guaranteed, therefore you MUST implement getProducts /\n // createMediaBuy / updateMediaBuy / getMediaBuyDelivery / getMediaBuys\"\n // moves up to `RequiredPlatformsFor<S>` — see the {@link SalesCorePlatform}\n // type alias and the per-specialism mapping in `platform.ts`. Runtime\n // enforcement is preserved: the dispatcher returns `UNSUPPORTED_FEATURE`\n // for tools whose method is absent, and `validateSpecialismRequiredTools`\n // throws / warns when a specialism's required tools aren't implemented.\n //\n // Adopters who implement the full media-buy surface keep working — their\n // implementation is a superset of every per-specialism requirement.\n // Adopters who only do ingestion (e.g. a Meta CAPI integration claiming\n // `sales-social`) drop the 5 core stubs without compile errors.\n\n // ── get_products: unified hybrid shape ────────────────────────────\n // get_products is a CATALOG LOOKUP — fast read against the seller's\n // existing inventory. rc8 allows curated brief/refine lookups to return a\n // Submitted arm when the seller needs async enrichment. Adopters express\n // that by returning ctx.handoffToTask(fn); the framework owns task_id\n // allocation, polling state, and optional completion webhook delivery.\n //\n // Wholesale catalog dumps remain sync: if the seller cannot serve the\n // full catalog directly, it should maintain an internal cache and return\n // the current catalog view instead of turning wholesale discovery into a\n // long-running operation.\n /** Catalog discovery: return products directly or hand off curated discovery to a background task. */\n getProducts?(req: GetProductsRequest, ctx: Ctx<TCtxMeta>): Promise<GetProductsHandlerResult>;\n\n // ── create_media_buy: unified hybrid shape ──────────────────────────\n\n /**\n * Create a media buy. Return the wire success-arm shape (sync fast path)\n * OR `ctx.handoffToTask(fn)` to promote the call to a background task\n * (HITL slow path). Adopters can branch per-call: hybrid sellers route\n * programmatic remnant sync, guaranteed inventory through HITL, all\n * from the same method.\n *\n * Buyers pattern-match on the wire response shape (`media_buy_id` on\n * the immediate response → sync; `task_id` + `status: 'submitted'` →\n * poll `tasks_get` or receive webhook). Predictable per request,\n * dynamic per call.\n *\n * Status changes flow via `publishStatusChange(...)` regardless of\n * which path was taken.\n *\n * The handoff function's return value is persisted as JSONB in the\n * task registry. Postgres-backed registries cap row size at 4MB —\n * offload large payloads to blob storage and return references.\n *\n * @example Sync-only adopter (no HITL inventory)\n * ```ts\n * createMediaBuy: async (req, ctx) => {\n * return await this.commitSync(req);\n * }\n * ```\n *\n * @example HITL-only adopter (every call goes through trafficker review)\n * ```ts\n * createMediaBuy: async (req, ctx) => {\n * return ctx.handoffToTask(async (taskCtx) => {\n * await taskCtx.update({ message: 'Awaiting trafficker' });\n * return await this.runHITL(req);\n * });\n * }\n * ```\n *\n * @example Hybrid adopter (programmatic + guaranteed in same tenant)\n * ```ts\n * createMediaBuy: async (req, ctx) => {\n * if (this.requiresHITL(req)) {\n * return ctx.handoffToTask(async (taskCtx) => await this.runHITL(req));\n * }\n * return await this.commitSync(req);\n * }\n * ```\n */\n createMediaBuy?(req: CreateMediaBuyRequest, ctx: Ctx<TCtxMeta>): Promise<CreateMediaBuyHandlerResult>;\n\n // ── update_media_buy: sync only (today) ─────────────────────────────\n // Spec inconsistency — same root cause as get_products above. The\n // `UpdateMediaBuyAsyncSubmitted` schema exists, but the per-tool\n // `update-media-buy-response.json` `oneOf` doesn't reference it, so\n // codegen produces `Success | Error` (no Submitted). Tracked as\n // adcontextprotocol/adcp#3392. Until that lands, operator\n // re-approval flows surface eventual transitions via\n // `publishStatusChange` on `resource_type: 'media_buy'` rather than\n // HITL on this tool.\n /** Sync update. Returns the patched buy. */\n updateMediaBuy?(buyId: string, patch: UpdateMediaBuyRequest, ctx: Ctx<TCtxMeta>): Promise<UpdateMediaBuyPayload>;\n\n // ── sync_creatives: unified hybrid shape ────────────────────────────\n\n /**\n * Push creatives. Return the array of wire success rows (sync fast\n * path) OR `ctx.handoffToTask(fn)` to defer to a background task\n * (HITL slow path — manual review, brand-suitability gates, etc.).\n * Hybrid: branch per-batch — auto-approve simple creatives sync,\n * route everything else to HITL.\n *\n * Each row carries `action` (CRUD outcome) and optional `status`\n * (review state). Buyers see mixed `approved` / `pending_review`\n * rows on the sync path; subsequent review changes flow via\n * `publishStatusChange(...)`.\n *\n * @example Hybrid adopter\n * ```ts\n * syncCreatives: async (creatives, ctx) => {\n * if (creatives.some(c => this.needsReview(c))) {\n * return ctx.handoffToTask(async (taskCtx) => {\n * return await this.reviewAndPersist(creatives);\n * });\n * }\n * return creatives.map(c => ({ creative_id: c.creative_id, action: 'created', status: 'approved' }));\n * }\n * ```\n */\n syncCreatives?(creatives: Creative[], ctx: Ctx<TCtxMeta>): Promise<SyncCreativesHandlerResult>;\n\n // ── get_media_buy_delivery: sync only ───────────────────────────────\n\n /**\n * Per-media-buy delivery actuals (impressions, spend, pacing,\n * conversions). Sync — report-running platforms with manual report\n * cycles return the latest cached actuals and emit `delivery_report`\n * status changes via `publishStatusChange` when fresh reports are\n * available.\n *\n * **Multi-id contract.** `filter.media_buy_ids` is an array — buyers\n * routinely request delivery for multiple buys in one call. The\n * platform MUST iterate every id and return one element per id in\n * `media_buy_deliveries[]`. Implementations that read only\n * `media_buy_ids[0]` silently truncate the buyer's request — a\n * correctness bug that has bitten multiple adopters (closes #1342).\n *\n * Pass-through is the framework contract: the platform owns fan-out\n * because `aggregated_totals` requires platform-domain knowledge —\n * `reach` (cross-buy dedup capability), `new_to_brand_rate` (weighted\n * across buys, not a per-buy average), and `frequency` (depends on\n * dedup) cannot be synthesized correctly by a naive framework loop.\n * Sellers that can't compute the cross-buy fields omit them and emit\n * the safely-summable fields (`impressions`, `spend`, `clicks`,\n * `media_buy_count`); buyers fall back to per-buy values when needed.\n *\n * Recommended pattern — prefer the upstream's native multi-id query\n * over a per-id loop. Most reporting APIs (GAM ReportService's\n * `WHERE LINE_ITEM_ID IN (...)`, TTD, DV360, Magnite, PubMatic, retail\n * media) take an id list in one round-trip; iterating one-id-at-a-time\n * is an N-roundtrip pattern that triggers upstream rate limits on\n * 50-buy reports.\n *\n * ```ts\n * getMediaBuyDelivery: async (req, ctx) => {\n * const ids = req.media_buy_ids ?? [];\n * // Native multi-id: one upstream round-trip.\n * const rows = await this.upstream.report({\n * mediaBuyIds: ids,\n * start: req.start_date,\n * end: req.end_date,\n * });\n * return {\n * reporting_period: { start, end },\n * currency: 'USD',\n * media_buy_deliveries: rows,\n * aggregated_totals: this.upstream.aggregate(rows),\n * };\n * }\n * ```\n *\n * **Single-id fallback** — only if your upstream is genuinely single-id:\n *\n * ```ts\n * const deliveries = await Promise.all(ids.map(id => fetchOne(id, ctx)));\n * ```\n *\n * When `media_buy_ids` is omitted, return a paginated set of\n * accessible media buys per the wire schema. `status_filter`\n * defaults to `['active']` when omitted; honor the filter in your\n * iteration.\n */\n getMediaBuyDelivery?(filter: GetMediaBuyDeliveryRequest, ctx: Ctx<TCtxMeta>): Promise<GetMediaBuyDeliveryPayload>;\n\n // ── get_media_buys: sync only — REQUIRED ──────────────────────────────\n // Read tool — buyers fetch a list of their media buys (often filtered by\n // status / time window). Required because:\n // 1. Every seller needs to support reading back what they created.\n // 2. Idempotent retries depend on it (replay safe-by-design).\n // 3. The 6.2 patch-decomposition redesign needs single-id reads;\n // `getMediaBuys` is the foundation.\n // 4. Framework auto-stores returned media buys for hydration on\n // subsequent updateMediaBuy calls (see `hydratePackagesWithProducts`\n // pattern in `from-platform.ts`).\n //\n // Proposal-mode adopters (write-only via push channels) return an empty\n // `media_buys: []` array — that's a valid response.\n /**\n * List media buys this account owns. Filter + pagination per the wire shape.\n *\n * **Multi-id contract.** `req.media_buy_ids` is an array — buyers\n * routinely request a specific set of buys in one call. The platform\n * MUST iterate every id and return one element per id in the response\n * `media_buys[]` array. Reading only `media_buy_ids[0]` silently\n * truncates the buyer's request — same correctness bug that #1342\n * documented for `getMediaBuyDelivery`. Same recommended pattern: prefer\n * an upstream multi-id query (one round-trip), fall back to per-id loop\n * only when the upstream is single-id-only.\n *\n * When `media_buy_ids` is omitted, return a paginated set of accessible\n * buys filtered by `status_filter` (defaults to `['active']`).\n */\n getMediaBuys?(req: GetMediaBuysRequest, ctx: Ctx<TCtxMeta>): Promise<GetMediaBuysPayload>;\n\n // ── provide_performance_feedback: sync only ─────────────────────────\n // Write tool — buyers report aggregate creative-level performance\n // (impressions, clicks, conversions) to help the seller's optimizer learn.\n // Optional because not every sales agent runs an optimizer, but every\n // buyer expects to be able to call it. Framework returns UNSUPPORTED_FEATURE\n // when omitted.\n //\n // ⚠️ NO-ACCOUNT TOOL — `ctx: NoAccountCtx<TCtxMeta>`. The wire request\n // does not carry an `account` field. `ctx.account` may be `undefined` for\n // `'explicit'`-resolution adopters; narrow before reading\n // `ctx.account.ctx_metadata`. See {@link NoAccountCtx} and the\n // `SalesPlatform` JSDoc (\"No-account tools\") for safe patterns.\n /** Accept buyer-side performance signals on a media buy / creative. */\n providePerformanceFeedback?(\n req: ProvidePerformanceFeedbackRequest,\n ctx: NoAccountCtx<TCtxMeta>\n ): Promise<ProvidePerformanceFeedbackPayload>;\n\n // ── list_creative_formats: sync only ────────────────────────────────\n // Discovery tool — buyers query what creative formats this seller\n // accepts. Optional because sellers that delegate to external\n // `creative_agents` (declared in `capabilities.creative_agents[]`) don't\n // own format definitions; framework can resolve from the declared agents.\n // Self-hosted sellers (own creative library) implement this directly.\n //\n // ⚠️ NO-ACCOUNT TOOL — `ctx: NoAccountCtx<TCtxMeta>`. See\n // `providePerformanceFeedback` note above.\n listCreativeFormats?(\n req: ListCreativeFormatsRequest,\n ctx: NoAccountCtx<TCtxMeta>\n ): Promise<ListCreativeFormatsPayload>;\n\n // ── list_creatives: sync only ───────────────────────────────────────\n // Read tool — buyers query the seller's creative library. Optional\n // because most sales adopters delegate creative state to the\n // `creative_agents` declared in capabilities; ad-server-style sales\n // platforms implement directly. Note: also lives on `CreativeAdServerPlatform.listCreatives`\n // for the standalone-creative-agent shape.\n listCreatives?(req: ListCreativesRequest, ctx: Ctx<TCtxMeta>): Promise<ListCreativesPayload>;\n\n // ── sync_catalogs: sync only ────────────────────────────────────────\n // Retail-media catalog sync. Buyers push product catalogs (SKUs, ASINs,\n // store-ids) for `sales-catalog-driven` agents (Amazon, Criteo, Citrusad,\n // Walmart Connect, Shopify ad surfaces). Optional — non-retail sales\n // adopters omit. Idempotent on the buyer's `idempotency_key`.\n syncCatalogs?(req: SyncCatalogsRequest, ctx: Ctx<TCtxMeta>): Promise<SyncCatalogsPayload>;\n\n // ── log_event: sync only ────────────────────────────────────────────\n // Conversion / engagement event logging. Buyers post events tied to\n // a `media_buy_id` for performance attribution. Used by retail-media\n // (post-purchase events) and conversion-tracked sales (Snap pixel,\n // Meta CAPI, LinkedIn conversions API). Optional.\n logEvent?(req: LogEventRequest, ctx: Ctx<TCtxMeta>): Promise<LogEventPayload>;\n\n // ── sync_event_sources: sync only ──────────────────────────────────\n // Register conversion event sources (websites, apps, offline pixel\n // IDs) so subsequent `log_event` calls can be attributed correctly.\n // Optional — adopters who don't expose conversion tracking omit.\n syncEventSources?(req: SyncEventSourcesRequest, ctx: Ctx<TCtxMeta>): Promise<SyncEventSourcesPayload>;\n}\n\n/**\n * Names the **core sales surface** — bidding + media-buy lifecycle. Required\n * for `sales-*` specialisms that own pricing/pacing\n * (`sales-non-guaranteed`, `sales-guaranteed`, `sales-broadcast-tv`,\n * `sales-streaming-tv`, `sales-exchange`, `sales-catalog-driven`,\n * `sales-retail-media`).\n *\n * Walled-garden specialisms whose value surface is asset ingestion\n * (`sales-social`, the `audience-sync` track, pure conversion-tracking\n * adopters) DON'T need to implement these — see {@link SalesIngestionPlatform}.\n *\n * Used by `RequiredPlatformsFor<S>` to pick the right slice of `SalesPlatform`\n * per claimed specialism.\n *\n * @public\n */\nexport type SalesCorePlatform<TCtxMeta = Record<string, unknown>> = Required<\n Pick<\n SalesPlatform<TCtxMeta>,\n 'getProducts' | 'createMediaBuy' | 'updateMediaBuy' | 'getMediaBuyDelivery' | 'getMediaBuys'\n >\n>;\n\n/**\n * Names the **asset-ingestion surface** — sync surfaces for creatives,\n * audiences (via {@link import('./audiences').AudiencePlatform}), catalogs,\n * events, plus the read/feedback tools. Walled-garden specialisms\n * (`sales-social`) live here.\n *\n * Every method is optional individually. Adopters claiming `sales-social`\n * pick whichever ingestion surfaces apply (typically `syncCreatives` +\n * `logEvent` + `syncEventSources`); the rest stay omitted.\n *\n * Used by `RequiredPlatformsFor<S>` so claiming `sales-social` only requires\n * this slice of `SalesPlatform`, not the full {@link SalesCorePlatform}.\n *\n * @public\n */\nexport type SalesIngestionPlatform<TCtxMeta = Record<string, unknown>> = Pick<\n SalesPlatform<TCtxMeta>,\n | 'syncCreatives'\n | 'syncCatalogs'\n | 'syncEventSources'\n | 'logEvent'\n | 'listCreativeFormats'\n | 'listCreatives'\n | 'providePerformanceFeedback'\n>;\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/lib/server/decisioning/specialisms/sales.ts"],"sourcesContent":["/**\n * SalesPlatform — sales specialism platform interface.\n *\n * **Unified hybrid shape.** `get_products`, `create_media_buy`, and `sync_creatives` use a\n * single method each. The method returns the wire success arm (sync fast\n * path) OR `ctx.handoffToTask(fn)` to promote the call to a background\n * task (HITL slow path). Branch per-call — the same method handles\n * programmatic remnant, guaranteed inventory, curated discovery, and hybrid\n * sellers. Every other tool is sync-only:\n *\n * - `get_products` — sync OR `ctx.handoffToTask(...)` for curated brief/refine flows.\n * - `create_media_buy` — sync OR `ctx.handoffToTask(...)`.\n * - `update_media_buy` — sync only. Re-approval flows that need HITL run\n * out-of-band; `publishStatusChange` carries the result.\n * - `sync_creatives` — sync OR `ctx.handoffToTask(...)`.\n * - `get_media_buy_delivery` — sync only.\n *\n * Sync-only tools that need long-running semantics use `publishStatusChange`\n * (see `status-changes.ts`) — that's the spec-aligned channel for tools\n * whose wire response unions don't define a Submitted arm.\n *\n * Each method either returns the value or throws `AdcpError` for structured\n * rejection. Generic thrown errors map to `SERVICE_UNAVAILABLE`.\n *\n * **Method groups** — implement the group(s) matching your specialism:\n *\n * | Group | Methods | Claim when |\n * |---|---|---|\n * | Core sales (required) | `getProducts`, `updateMediaBuy`, `getMediaBuyDelivery` | Any `sales-*` specialism |\n * | Core sales (unified hybrid) | `createMediaBuy` | Any `sales-*` specialism |\n * | Core sales (unified hybrid) | `syncCreatives` | Any `sales-*` specialism |\n * | Read / feedback | `getMediaBuys`, `providePerformanceFeedback`, `listCreativeFormats`, `listCreatives` | Most sellers; optional |\n * | Retail-media extensions | `syncCatalogs`, `logEvent`, `syncEventSources` | `sales-catalog-driven`, `sales-retail-media` |\n *\n * New adopters implementing a non-retail seller (GAM, FreeWheel, a social\n * platform) only need the three core-required methods plus `createMediaBuy`\n * and `syncCreatives`. The retail-media extension methods (`syncCatalogs`,\n * `logEvent`, `syncEventSources`) are unnecessary unless you claim\n * `sales-catalog-driven` or `sales-retail-media`.\n *\n * **No-account tools (`providePerformanceFeedback`, `listCreativeFormats`):**\n * the wire requests for these two tools don't carry an `account` field, so\n * `ctx.account` may be `undefined` when `accounts.resolution === 'explicit'`.\n * Three safe patterns:\n *\n * 1. **`'derived'` resolution** — `accounts.resolve(undefined)` returns a\n * singleton; `ctx.account` is always set. Best for single-tenant\n * deployers.\n * 2. **Don't implement the method** — the framework returns\n * `UNSUPPORTED_FEATURE`; buyers using the merge-seam custom handler or\n * external creative agents still receive a response.\n * 3. **Explicit-mode with defensive read** — cast `ctx.account as Account |\n * undefined` and derive the account from the request body (e.g., via a\n * `media_buy_id` lookup), or throw `AdcpError('ACCOUNT_NOT_FOUND')`.\n * Full `resolveAccount(undefined, { authInfo, toolName })` support for\n * explicit-mode lands in rc.1.\n *\n * Status: Preview / 6.0.\n *\n * @public\n */\n\nimport type { Account, NoAccountCtx } from '../account';\nimport type { RequestContext } from '../context';\nimport type { TaskHandoff } from '../async-outcome';\nimport type { RequireCacheScopeWhenProducts, ServerPayload } from '../../../types/server-payload';\nimport type {\n GetProductsRequest,\n GetProductsResponse,\n CreateMediaBuyRequest,\n CreateMediaBuySuccess,\n UpdateMediaBuyRequest,\n UpdateMediaBuySuccess,\n GetMediaBuysRequest,\n GetMediaBuysResponse,\n GetMediaBuyDeliveryRequest,\n GetMediaBuyDeliveryResponse,\n ProvidePerformanceFeedbackRequest,\n ProvidePerformanceFeedbackSuccess,\n ListCreativeFormatsRequest,\n ListCreativeFormatsResponse,\n ListCreativesRequest,\n ListCreativesResponse,\n SyncCatalogsRequest,\n SyncCatalogsSuccess,\n LogEventRequest,\n LogEventSuccess,\n SyncEventSourcesRequest,\n SyncEventSourcesSuccess,\n SyncCreativesError,\n SyncCreativesSuccess,\n CreativeAsset,\n} from '../../../types/tools.generated';\n\ntype Creative = CreativeAsset;\ntype Ctx<TCtxMeta> = RequestContext<Account<TCtxMeta>>;\n\nexport type GetProductsPayload = RequireCacheScopeWhenProducts<ServerPayload<GetProductsResponse>>;\nexport type CreateMediaBuyPayload = ServerPayload<CreateMediaBuySuccess>;\nexport type UpdateMediaBuyPayload = ServerPayload<UpdateMediaBuySuccess>;\nexport type GetMediaBuyDeliveryPayload = ServerPayload<GetMediaBuyDeliveryResponse>;\nexport type GetMediaBuysPayload = ServerPayload<GetMediaBuysResponse>;\nexport type ProvidePerformanceFeedbackPayload = ServerPayload<ProvidePerformanceFeedbackSuccess>;\nexport type ListCreativeFormatsPayload = ServerPayload<ListCreativeFormatsResponse>;\nexport type ListCreativesPayload = ServerPayload<ListCreativesResponse>;\nexport type SyncCreativesSuccessPayload = ServerPayload<SyncCreativesSuccess>;\nexport type SyncCreativesErrorPayload = ServerPayload<SyncCreativesError>;\nexport type SyncCreativesPayload = SyncCreativesSuccessPayload | SyncCreativesErrorPayload;\nexport type SyncCatalogsPayload = ServerPayload<SyncCatalogsSuccess>;\nexport type LogEventPayload = ServerPayload<LogEventSuccess>;\nexport type SyncEventSourcesPayload = ServerPayload<SyncEventSourcesSuccess>;\n\n/**\n * Wire success-row shape for `sync_creatives`. Returning the array of these\n * rows from `syncCreatives` is what adopters write — the framework wraps\n * with `{ creatives: [...] }` to form `SyncCreativesSuccess`.\n */\nexport type SyncCreativesRow = SyncCreativesSuccess['creatives'][number];\nexport type GetProductsHandlerResult = GetProductsPayload | TaskHandoff<GetProductsPayload>;\nexport type CreateMediaBuyHandlerResult = CreateMediaBuyPayload | TaskHandoff<CreateMediaBuyPayload>;\nexport type UpdateMediaBuyHandlerResult = UpdateMediaBuyPayload | TaskHandoff<UpdateMediaBuyPayload>;\nexport type SyncCreativesHandlerResult = SyncCreativesRow[] | TaskHandoff<SyncCreativesRow[]>;\n\nexport interface SalesPlatform<TCtxMeta = Record<string, unknown>> {\n // **Method shape — all optional, enforced per-specialism.** Every method on\n // `SalesPlatform` is declared optional so the type accommodates non-media-\n // buy walled gardens (sales-social, audience-sync, sales-proposal-mode)\n // that don't accept inbound media buys but compose ingestion methods on\n // this same surface. Compile-time enforcement of \"you claimed\n // sales-non-guaranteed, therefore you MUST implement getProducts /\n // createMediaBuy / updateMediaBuy / getMediaBuyDelivery / getMediaBuys\"\n // moves up to `RequiredPlatformsFor<S>` — see the {@link SalesCorePlatform}\n // type alias and the per-specialism mapping in `platform.ts`. Runtime\n // enforcement is preserved: the dispatcher returns `UNSUPPORTED_FEATURE`\n // for tools whose method is absent, and `validateSpecialismRequiredTools`\n // throws / warns when a specialism's required tools aren't implemented.\n //\n // Adopters who implement the full media-buy surface keep working — their\n // implementation is a superset of every per-specialism requirement.\n // Adopters who only do ingestion (e.g. a Meta CAPI integration claiming\n // `sales-social`) drop the 5 core stubs without compile errors.\n\n // ── get_products: unified hybrid shape ────────────────────────────\n // get_products is a CATALOG LOOKUP — fast read against the seller's\n // existing inventory. rc8 allows curated brief/refine lookups to return a\n // Submitted arm when the seller needs async enrichment. Adopters express\n // that by returning ctx.handoffToTask(fn); the framework owns task_id\n // allocation, polling state, and optional completion webhook delivery.\n //\n // Wholesale catalog dumps remain sync: if the seller cannot serve the\n // full catalog directly, it should maintain an internal cache and return\n // the current catalog view instead of turning wholesale discovery into a\n // long-running operation.\n /** Catalog discovery: return products directly or hand off curated discovery to a background task. */\n getProducts?(req: GetProductsRequest, ctx: Ctx<TCtxMeta>): Promise<GetProductsHandlerResult>;\n\n // ── create_media_buy: unified hybrid shape ──────────────────────────\n\n /**\n * Create a media buy. Return the wire success-arm shape (sync fast path)\n * OR `ctx.handoffToTask(fn)` to promote the call to a background task\n * (HITL slow path). Adopters can branch per-call: hybrid sellers route\n * programmatic remnant sync, guaranteed inventory through HITL, all\n * from the same method.\n *\n * Buyers pattern-match on the wire response shape (`media_buy_id` on\n * the immediate response → sync; `task_id` + `status: 'submitted'` →\n * poll `tasks_get` or receive webhook). Predictable per request,\n * dynamic per call.\n *\n * Status changes flow via `publishStatusChange(...)` regardless of\n * which path was taken.\n *\n * The handoff function's return value is persisted as JSONB in the\n * task registry. Postgres-backed registries cap row size at 4MB —\n * offload large payloads to blob storage and return references.\n *\n * @example Sync-only adopter (no HITL inventory)\n * ```ts\n * createMediaBuy: async (req, ctx) => {\n * return await this.commitSync(req);\n * }\n * ```\n *\n * @example HITL-only adopter (every call goes through trafficker review)\n * ```ts\n * createMediaBuy: async (req, ctx) => {\n * return ctx.handoffToTask(async (taskCtx) => {\n * await taskCtx.update({ message: 'Awaiting trafficker' });\n * return await this.runHITL(req);\n * });\n * }\n * ```\n *\n * @example Hybrid adopter (programmatic + guaranteed in same tenant)\n * ```ts\n * createMediaBuy: async (req, ctx) => {\n * if (this.requiresHITL(req)) {\n * return ctx.handoffToTask(async (taskCtx) => await this.runHITL(req));\n * }\n * return await this.commitSync(req);\n * }\n * ```\n */\n createMediaBuy?(req: CreateMediaBuyRequest, ctx: Ctx<TCtxMeta>): Promise<CreateMediaBuyHandlerResult>;\n\n // ── update_media_buy: unified hybrid shape\n /**\n * Update a media buy. Return the patched buy immediately (sync fast path)\n * OR `ctx.handoffToTask(fn)` when the upstream activation or approval flow\n * must continue in the background. The framework owns task registration,\n * caller scoping, polling, and completion webhooks on the handoff path.\n */\n updateMediaBuy?(\n buyId: string,\n patch: UpdateMediaBuyRequest,\n ctx: Ctx<TCtxMeta>\n ): Promise<UpdateMediaBuyHandlerResult>;\n\n // ── sync_creatives: unified hybrid shape ────────────────────────────\n\n /**\n * Push creatives. Return the array of wire success rows (sync fast\n * path) OR `ctx.handoffToTask(fn)` to defer to a background task\n * (HITL slow path — manual review, brand-suitability gates, etc.).\n * Hybrid: branch per-batch — auto-approve simple creatives sync,\n * route everything else to HITL.\n *\n * Each row carries `action` (CRUD outcome) and optional `status`\n * (review state). Buyers see mixed `approved` / `pending_review`\n * rows on the sync path; subsequent review changes flow via\n * `publishStatusChange(...)`.\n *\n * @example Hybrid adopter\n * ```ts\n * syncCreatives: async (creatives, ctx) => {\n * if (creatives.some(c => this.needsReview(c))) {\n * return ctx.handoffToTask(async (taskCtx) => {\n * return await this.reviewAndPersist(creatives);\n * });\n * }\n * return creatives.map(c => ({ creative_id: c.creative_id, action: 'created', status: 'approved' }));\n * }\n * ```\n */\n syncCreatives?(creatives: Creative[], ctx: Ctx<TCtxMeta>): Promise<SyncCreativesHandlerResult>;\n\n // ── get_media_buy_delivery: sync only ───────────────────────────────\n\n /**\n * Per-media-buy delivery actuals (impressions, spend, pacing,\n * conversions). Sync — report-running platforms with manual report\n * cycles return the latest cached actuals and emit `delivery_report`\n * status changes via `publishStatusChange` when fresh reports are\n * available.\n *\n * **Multi-id contract.** `filter.media_buy_ids` is an array — buyers\n * routinely request delivery for multiple buys in one call. The\n * platform MUST iterate every id and return one element per id in\n * `media_buy_deliveries[]`. Implementations that read only\n * `media_buy_ids[0]` silently truncate the buyer's request — a\n * correctness bug that has bitten multiple adopters (closes #1342).\n *\n * Pass-through is the framework contract: the platform owns fan-out\n * because `aggregated_totals` requires platform-domain knowledge —\n * `reach` (cross-buy dedup capability), `new_to_brand_rate` (weighted\n * across buys, not a per-buy average), and `frequency` (depends on\n * dedup) cannot be synthesized correctly by a naive framework loop.\n * Sellers that can't compute the cross-buy fields omit them and emit\n * the safely-summable fields (`impressions`, `spend`, `clicks`,\n * `media_buy_count`); buyers fall back to per-buy values when needed.\n *\n * Recommended pattern — prefer the upstream's native multi-id query\n * over a per-id loop. Most reporting APIs (GAM ReportService's\n * `WHERE LINE_ITEM_ID IN (...)`, TTD, DV360, Magnite, PubMatic, retail\n * media) take an id list in one round-trip; iterating one-id-at-a-time\n * is an N-roundtrip pattern that triggers upstream rate limits on\n * 50-buy reports.\n *\n * ```ts\n * getMediaBuyDelivery: async (req, ctx) => {\n * const ids = req.media_buy_ids ?? [];\n * // Native multi-id: one upstream round-trip.\n * const rows = await this.upstream.report({\n * mediaBuyIds: ids,\n * start: req.start_date,\n * end: req.end_date,\n * });\n * return {\n * reporting_period: { start, end },\n * currency: 'USD',\n * media_buy_deliveries: rows,\n * aggregated_totals: this.upstream.aggregate(rows),\n * };\n * }\n * ```\n *\n * **Single-id fallback** — only if your upstream is genuinely single-id:\n *\n * ```ts\n * const deliveries = await Promise.all(ids.map(id => fetchOne(id, ctx)));\n * ```\n *\n * When `media_buy_ids` is omitted, return a paginated set of\n * accessible media buys per the wire schema. `status_filter`\n * defaults to `['active']` when omitted; honor the filter in your\n * iteration.\n */\n getMediaBuyDelivery?(filter: GetMediaBuyDeliveryRequest, ctx: Ctx<TCtxMeta>): Promise<GetMediaBuyDeliveryPayload>;\n\n // ── get_media_buys: sync only — REQUIRED ──────────────────────────────\n // Read tool — buyers fetch a list of their media buys (often filtered by\n // status / time window). Required because:\n // 1. Every seller needs to support reading back what they created.\n // 2. Idempotent retries depend on it (replay safe-by-design).\n // 3. The 6.2 patch-decomposition redesign needs single-id reads;\n // `getMediaBuys` is the foundation.\n // 4. Framework auto-stores returned media buys for hydration on\n // subsequent updateMediaBuy calls (see `hydratePackagesWithProducts`\n // pattern in `from-platform.ts`).\n //\n // Proposal-mode adopters (write-only via push channels) return an empty\n // `media_buys: []` array — that's a valid response.\n /**\n * List media buys this account owns. Filter + pagination per the wire shape.\n *\n * **Multi-id contract.** `req.media_buy_ids` is an array — buyers\n * routinely request a specific set of buys in one call. The platform\n * MUST iterate every id and return one element per id in the response\n * `media_buys[]` array. Reading only `media_buy_ids[0]` silently\n * truncates the buyer's request — same correctness bug that #1342\n * documented for `getMediaBuyDelivery`. Same recommended pattern: prefer\n * an upstream multi-id query (one round-trip), fall back to per-id loop\n * only when the upstream is single-id-only.\n *\n * When `media_buy_ids` is omitted, return a paginated set of accessible\n * buys filtered by `status_filter` (defaults to `['active']`).\n */\n getMediaBuys?(req: GetMediaBuysRequest, ctx: Ctx<TCtxMeta>): Promise<GetMediaBuysPayload>;\n\n // ── provide_performance_feedback: sync only ─────────────────────────\n // Write tool — buyers report aggregate creative-level performance\n // (impressions, clicks, conversions) to help the seller's optimizer learn.\n // Optional because not every sales agent runs an optimizer, but every\n // buyer expects to be able to call it. Framework returns UNSUPPORTED_FEATURE\n // when omitted.\n //\n // ⚠️ NO-ACCOUNT TOOL — `ctx: NoAccountCtx<TCtxMeta>`. The wire request\n // does not carry an `account` field. `ctx.account` may be `undefined` for\n // `'explicit'`-resolution adopters; narrow before reading\n // `ctx.account.ctx_metadata`. See {@link NoAccountCtx} and the\n // `SalesPlatform` JSDoc (\"No-account tools\") for safe patterns.\n /** Accept buyer-side performance signals on a media buy / creative. */\n providePerformanceFeedback?(\n req: ProvidePerformanceFeedbackRequest,\n ctx: NoAccountCtx<TCtxMeta>\n ): Promise<ProvidePerformanceFeedbackPayload>;\n\n // ── list_creative_formats: sync only ────────────────────────────────\n // Discovery tool — buyers query what creative formats this seller\n // accepts. Optional because sellers that delegate to external\n // `creative_agents` (declared in `capabilities.creative_agents[]`) don't\n // own format definitions; framework can resolve from the declared agents.\n // Self-hosted sellers (own creative library) implement this directly.\n //\n // ⚠️ NO-ACCOUNT TOOL — `ctx: NoAccountCtx<TCtxMeta>`. See\n // `providePerformanceFeedback` note above.\n listCreativeFormats?(\n req: ListCreativeFormatsRequest,\n ctx: NoAccountCtx<TCtxMeta>\n ): Promise<ListCreativeFormatsPayload>;\n\n // ── list_creatives: sync only ───────────────────────────────────────\n // Read tool — buyers query the seller's creative library. Optional\n // because most sales adopters delegate creative state to the\n // `creative_agents` declared in capabilities; ad-server-style sales\n // platforms implement directly. Note: also lives on `CreativeAdServerPlatform.listCreatives`\n // for the standalone-creative-agent shape.\n listCreatives?(req: ListCreativesRequest, ctx: Ctx<TCtxMeta>): Promise<ListCreativesPayload>;\n\n // ── sync_catalogs: sync only ────────────────────────────────────────\n // Retail-media catalog sync. Buyers push product catalogs (SKUs, ASINs,\n // store-ids) for `sales-catalog-driven` agents (Amazon, Criteo, Citrusad,\n // Walmart Connect, Shopify ad surfaces). Optional — non-retail sales\n // adopters omit. Idempotent on the buyer's `idempotency_key`.\n syncCatalogs?(req: SyncCatalogsRequest, ctx: Ctx<TCtxMeta>): Promise<SyncCatalogsPayload>;\n\n // ── log_event: sync only ────────────────────────────────────────────\n // Conversion / engagement event logging. Buyers post events tied to\n // a `media_buy_id` for performance attribution. Used by retail-media\n // (post-purchase events) and conversion-tracked sales (Snap pixel,\n // Meta CAPI, LinkedIn conversions API). Optional.\n logEvent?(req: LogEventRequest, ctx: Ctx<TCtxMeta>): Promise<LogEventPayload>;\n\n // ── sync_event_sources: sync only ──────────────────────────────────\n // Register conversion event sources (websites, apps, offline pixel\n // IDs) so subsequent `log_event` calls can be attributed correctly.\n // Optional — adopters who don't expose conversion tracking omit.\n syncEventSources?(req: SyncEventSourcesRequest, ctx: Ctx<TCtxMeta>): Promise<SyncEventSourcesPayload>;\n}\n\n/**\n * Names the **core sales surface** — bidding + media-buy lifecycle. Required\n * for `sales-*` specialisms that own pricing/pacing\n * (`sales-non-guaranteed`, `sales-guaranteed`, `sales-broadcast-tv`,\n * `sales-streaming-tv`, `sales-exchange`, `sales-catalog-driven`,\n * `sales-retail-media`).\n *\n * Walled-garden specialisms whose value surface is asset ingestion\n * (`sales-social`, the `audience-sync` track, pure conversion-tracking\n * adopters) DON'T need to implement these — see {@link SalesIngestionPlatform}.\n *\n * Used by `RequiredPlatformsFor<S>` to pick the right slice of `SalesPlatform`\n * per claimed specialism.\n *\n * @public\n */\nexport type SalesCorePlatform<TCtxMeta = Record<string, unknown>> = Required<\n Pick<\n SalesPlatform<TCtxMeta>,\n 'getProducts' | 'createMediaBuy' | 'updateMediaBuy' | 'getMediaBuyDelivery' | 'getMediaBuys'\n >\n>;\n\n/**\n * Names the **asset-ingestion surface** — sync surfaces for creatives,\n * audiences (via {@link import('./audiences').AudiencePlatform}), catalogs,\n * events, plus the read/feedback tools. Walled-garden specialisms\n * (`sales-social`) live here.\n *\n * Every method is optional individually. Adopters claiming `sales-social`\n * pick whichever ingestion surfaces apply (typically `syncCreatives` +\n * `logEvent` + `syncEventSources`); the rest stay omitted.\n *\n * Used by `RequiredPlatformsFor<S>` so claiming `sales-social` only requires\n * this slice of `SalesPlatform`, not the full {@link SalesCorePlatform}.\n *\n * @public\n */\nexport type SalesIngestionPlatform<TCtxMeta = Record<string, unknown>> = Pick<\n SalesPlatform<TCtxMeta>,\n | 'syncCreatives'\n | 'syncCatalogs'\n | 'syncEventSources'\n | 'logEvent'\n | 'listCreativeFormats'\n | 'listCreatives'\n | 'providePerformanceFeedback'\n>;\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/dist/lib/version.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AdCP SDK library version
|
|
3
3
|
*/
|
|
4
|
-
export declare const LIBRARY_VERSION = "12.0.
|
|
4
|
+
export declare const LIBRARY_VERSION = "12.0.5";
|
|
5
5
|
/**
|
|
6
6
|
* AdCP specification version this library is built for
|
|
7
7
|
*/
|
|
@@ -33,10 +33,10 @@ export type AdcpVersion = (typeof COMPATIBLE_ADCP_VERSIONS)[number];
|
|
|
33
33
|
* Full version information
|
|
34
34
|
*/
|
|
35
35
|
export declare const VERSION_INFO: {
|
|
36
|
-
readonly library: "12.0.
|
|
36
|
+
readonly library: "12.0.5";
|
|
37
37
|
readonly adcp: "3.1.2";
|
|
38
38
|
readonly compatibleVersions: readonly ["v2.5", "v2.6", "v3", "3.0.0-beta.1", "3.0-beta.1", "3.0-beta", "3.0.0-beta.3", "3.0-beta.3", "3.0.0", "3.0", "3.0.1", "3.0.2", "3.0.3", "3.0.4", "3.0.5", "3.0.6", "3.0.7", "3.0.8", "3.0.9", "3.0.10", "3.0.11", "3.0.12", "3.1.0", "3.1", "3.1.1", "3.1.2"];
|
|
39
|
-
readonly generatedAt: "2026-07-
|
|
39
|
+
readonly generatedAt: "2026-07-23T00:10:47.630Z";
|
|
40
40
|
};
|
|
41
41
|
/**
|
|
42
42
|
* Get the AdCP specification version this library is built for
|
package/dist/lib/version.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AdCP SDK library version
|
|
3
3
|
*/
|
|
4
|
-
export declare const LIBRARY_VERSION = "12.0.
|
|
4
|
+
export declare const LIBRARY_VERSION = "12.0.5";
|
|
5
5
|
/**
|
|
6
6
|
* AdCP specification version this library is built for
|
|
7
7
|
*/
|
|
@@ -33,10 +33,10 @@ export type AdcpVersion = (typeof COMPATIBLE_ADCP_VERSIONS)[number];
|
|
|
33
33
|
* Full version information
|
|
34
34
|
*/
|
|
35
35
|
export declare const VERSION_INFO: {
|
|
36
|
-
readonly library: "12.0.
|
|
36
|
+
readonly library: "12.0.5";
|
|
37
37
|
readonly adcp: "3.1.2";
|
|
38
38
|
readonly compatibleVersions: readonly ["v2.5", "v2.6", "v3", "3.0.0-beta.1", "3.0-beta.1", "3.0-beta", "3.0.0-beta.3", "3.0-beta.3", "3.0.0", "3.0", "3.0.1", "3.0.2", "3.0.3", "3.0.4", "3.0.5", "3.0.6", "3.0.7", "3.0.8", "3.0.9", "3.0.10", "3.0.11", "3.0.12", "3.1.0", "3.1", "3.1.1", "3.1.2"];
|
|
39
|
-
readonly generatedAt: "2026-07-
|
|
39
|
+
readonly generatedAt: "2026-07-23T00:10:47.630Z";
|
|
40
40
|
};
|
|
41
41
|
/**
|
|
42
42
|
* Get the AdCP specification version this library is built for
|
package/dist/lib/version.js
CHANGED
|
@@ -31,7 +31,7 @@ __export(version_exports, {
|
|
|
31
31
|
toReleasePrecisionVersion: () => toReleasePrecisionVersion
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(version_exports);
|
|
34
|
-
const LIBRARY_VERSION = "12.0.
|
|
34
|
+
const LIBRARY_VERSION = "12.0.5";
|
|
35
35
|
const ADCP_VERSION = "3.1.2";
|
|
36
36
|
const ADCP_MAJOR_VERSION = 3;
|
|
37
37
|
const COMPATIBLE_ADCP_VERSIONS = [
|
|
@@ -63,10 +63,10 @@ const COMPATIBLE_ADCP_VERSIONS = [
|
|
|
63
63
|
"3.1.2"
|
|
64
64
|
];
|
|
65
65
|
const VERSION_INFO = {
|
|
66
|
-
library: "12.0.
|
|
66
|
+
library: "12.0.5",
|
|
67
67
|
adcp: "3.1.2",
|
|
68
68
|
compatibleVersions: COMPATIBLE_ADCP_VERSIONS,
|
|
69
|
-
generatedAt: "2026-07-
|
|
69
|
+
generatedAt: "2026-07-23T00:10:47.630Z"
|
|
70
70
|
};
|
|
71
71
|
function getAdcpVersion() {
|
|
72
72
|
return ADCP_VERSION;
|
package/dist/lib/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/version.ts"],"sourcesContent":["// Generated version information\n// This file is auto-generated by sync-version.ts\n\n/**\n * AdCP SDK library version\n */\nexport const LIBRARY_VERSION = '12.0.
|
|
1
|
+
{"version":3,"sources":["../../src/lib/version.ts"],"sourcesContent":["// Generated version information\n// This file is auto-generated by sync-version.ts\n\n/**\n * AdCP SDK library version\n */\nexport const LIBRARY_VERSION = '12.0.5';\n\n/**\n * AdCP specification version this library is built for\n */\nexport const ADCP_VERSION = '3.1.2';\n\n/**\n * AdCP major version sent with every request (adcp_major_version field).\n * Sellers validate this against their supported versions and return\n * VERSION_UNSUPPORTED if the version is not in range.\n */\nexport const ADCP_MAJOR_VERSION = 3;\n\n/**\n * AdCP versions this library maintains backward compatibility with.\n *\n * Auto-derived from `ADCP_VERSION` by scripts/sync-version.ts. Do not edit\n * this list by hand; bumping the AdCP pin via `npm run sync-version`\n * extends it.\n */\nexport const COMPATIBLE_ADCP_VERSIONS = [\n 'v2.5',\n 'v2.6',\n 'v3',\n '3.0.0-beta.1',\n '3.0-beta.1',\n '3.0-beta',\n '3.0.0-beta.3',\n '3.0-beta.3',\n '3.0.0',\n '3.0',\n '3.0.1',\n '3.0.2',\n '3.0.3',\n '3.0.4',\n '3.0.5',\n '3.0.6',\n '3.0.7',\n '3.0.8',\n '3.0.9',\n '3.0.10',\n '3.0.11',\n '3.0.12',\n '3.1.0',\n '3.1',\n '3.1.1',\n '3.1.2',\n] as const;\n\n/**\n * String literal union of every AdCP version the SDK formally supports.\n *\n * Used by the per-instance `adcpVersion` constructor option to give callers\n * autocomplete in editors. The intersection with `(string & {})` in the\n * config type preserves the escape hatch — any string is still accepted at\n * the type level — while the literal union surfaces canonical values first.\n */\nexport type AdcpVersion = (typeof COMPATIBLE_ADCP_VERSIONS)[number];\n\n/**\n * Full version information\n */\nexport const VERSION_INFO = {\n library: '12.0.5',\n adcp: '3.1.2',\n compatibleVersions: COMPATIBLE_ADCP_VERSIONS,\n generatedAt: '2026-07-23T00:10:47.630Z',\n} as const;\n\n/**\n * Get the AdCP specification version this library is built for\n */\nexport function getAdcpVersion(): string {\n return ADCP_VERSION;\n}\n\n/**\n * Get the library version\n */\nexport function getLibraryVersion(): string {\n return LIBRARY_VERSION;\n}\n\n/**\n * Check if this library version is compatible with a given AdCP version\n */\nexport function isCompatibleWith(adcpVersion: string): boolean {\n return (COMPATIBLE_ADCP_VERSIONS as readonly string[]).includes(adcpVersion);\n}\n\n/**\n * Get all AdCP versions this library is compatible with\n */\nexport function getCompatibleVersions(): readonly string[] {\n return COMPATIBLE_ADCP_VERSIONS;\n}\n\n/**\n * Extract the major version number from an AdCP version string.\n *\n * Accepts:\n * - Semver: '3.0.0', '3.0.1', '3.1.0-beta.1' → 3\n * - Legacy aliases: 'v3' → 3, 'v2.5' / 'v2.6' → 2\n *\n * Returns NaN for unrecognized strings — callers should validate before passing.\n */\nexport function parseAdcpMajorVersion(version: string): number {\n const trimmed = version.trim();\n const semverLike = trimmed.startsWith('v') ? trimmed.slice(1) : trimmed;\n const major = parseInt(semverLike.split('.')[0] ?? '', 10);\n return Number.isFinite(major) ? major : NaN;\n}\n\n/**\n * Normalize a full-semver AdCP version (`MAJOR.MINOR.PATCH[-prerelease]`) to\n * the release-precision form that AdCP 3.1+ requires on the wire:\n * `MAJOR.MINOR[-prerelease]` — the patch digit is dropped.\n *\n * Per the spec note on `adcp_version`: \"SDKs that read full-semver values\n * from bundle metadata (e.g. `ComplianceIndex.published_version =\n * \"3.1.0-beta.1\"`) MUST normalize to release-precision (`\"3.1-beta.1\"`)\n * before emitting on the wire — meta-field values are NOT valid wire\n * values.\" The wire regex (`^\\d+\\.\\d+(-[a-zA-Z0-9.-]+)?$`) rejects strings\n * with a patch digit.\n *\n * Behavior:\n * - `\"3.1.0-beta.7\"` → `\"3.1-beta.7\"`\n * - `\"3.1.0\"` → `\"3.1\"`\n * - `\"3.0.12\"` → `\"3.0\"`\n * - Already-release-precision input (`\"3.1\"`, `\"3.1-beta.7\"`) passes through\n * - Legacy aliases (`\"v2.5\"`, `\"v3\"`) pass through unchanged — the wire\n * regex doesn't accept them anyway; the v2.5 path uses\n * `adcp_major_version` instead of `adcp_version` for transport.\n * - Unrecognized strings pass through unchanged so callers can detect drift\n * via the wire validator rather than have it masked by this helper.\n */\nexport function toReleasePrecisionVersion(version: string): string {\n const trimmed = version.trim();\n // Pre-release form `MAJOR.MINOR.PATCH-prerelease` → `MAJOR.MINOR-prerelease`\n const semverMatch = trimmed.match(/^(\\d+)\\.(\\d+)\\.\\d+(-[A-Za-z0-9.-]+)?$/);\n if (semverMatch) {\n const [, major, minor, pre = ''] = semverMatch;\n return `${major}.${minor}${pre}`;\n }\n // Already release-precision (no patch digit). Includes `3.1`, `3.1-beta.7`.\n if (/^\\d+\\.\\d+(-[A-Za-z0-9.-]+)?$/.test(trimmed)) return trimmed;\n // Legacy aliases (`v3`, `v2.5`, `v2.6`) and anything we don't recognize —\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AACnC,WAAO,GAAG,KAAK,IAAI,KAAK,GAAG,GAAG;AAAA,EAChC;AAEA,MAAI,+BAA+B,KAAK,OAAO,EAAG,QAAO;AAGzD,SAAO;AACT;","names":[]}
|
package/dist/lib/version.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const LIBRARY_VERSION = "12.0.
|
|
1
|
+
const LIBRARY_VERSION = "12.0.5";
|
|
2
2
|
const ADCP_VERSION = "3.1.2";
|
|
3
3
|
const ADCP_MAJOR_VERSION = 3;
|
|
4
4
|
const COMPATIBLE_ADCP_VERSIONS = [
|
|
@@ -30,10 +30,10 @@ const COMPATIBLE_ADCP_VERSIONS = [
|
|
|
30
30
|
"3.1.2"
|
|
31
31
|
];
|
|
32
32
|
const VERSION_INFO = {
|
|
33
|
-
library: "12.0.
|
|
33
|
+
library: "12.0.5",
|
|
34
34
|
adcp: "3.1.2",
|
|
35
35
|
compatibleVersions: COMPATIBLE_ADCP_VERSIONS,
|
|
36
|
-
generatedAt: "2026-07-
|
|
36
|
+
generatedAt: "2026-07-23T00:10:47.630Z"
|
|
37
37
|
};
|
|
38
38
|
function getAdcpVersion() {
|
|
39
39
|
return ADCP_VERSION;
|
package/dist/lib/version.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/version.ts"],"sourcesContent":["// Generated version information\n// This file is auto-generated by sync-version.ts\n\n/**\n * AdCP SDK library version\n */\nexport const LIBRARY_VERSION = '12.0.
|
|
1
|
+
{"version":3,"sources":["../../src/lib/version.ts"],"sourcesContent":["// Generated version information\n// This file is auto-generated by sync-version.ts\n\n/**\n * AdCP SDK library version\n */\nexport const LIBRARY_VERSION = '12.0.5';\n\n/**\n * AdCP specification version this library is built for\n */\nexport const ADCP_VERSION = '3.1.2';\n\n/**\n * AdCP major version sent with every request (adcp_major_version field).\n * Sellers validate this against their supported versions and return\n * VERSION_UNSUPPORTED if the version is not in range.\n */\nexport const ADCP_MAJOR_VERSION = 3;\n\n/**\n * AdCP versions this library maintains backward compatibility with.\n *\n * Auto-derived from `ADCP_VERSION` by scripts/sync-version.ts. Do not edit\n * this list by hand; bumping the AdCP pin via `npm run sync-version`\n * extends it.\n */\nexport const COMPATIBLE_ADCP_VERSIONS = [\n 'v2.5',\n 'v2.6',\n 'v3',\n '3.0.0-beta.1',\n '3.0-beta.1',\n '3.0-beta',\n '3.0.0-beta.3',\n '3.0-beta.3',\n '3.0.0',\n '3.0',\n '3.0.1',\n '3.0.2',\n '3.0.3',\n '3.0.4',\n '3.0.5',\n '3.0.6',\n '3.0.7',\n '3.0.8',\n '3.0.9',\n '3.0.10',\n '3.0.11',\n '3.0.12',\n '3.1.0',\n '3.1',\n '3.1.1',\n '3.1.2',\n] as const;\n\n/**\n * String literal union of every AdCP version the SDK formally supports.\n *\n * Used by the per-instance `adcpVersion` constructor option to give callers\n * autocomplete in editors. The intersection with `(string & {})` in the\n * config type preserves the escape hatch — any string is still accepted at\n * the type level — while the literal union surfaces canonical values first.\n */\nexport type AdcpVersion = (typeof COMPATIBLE_ADCP_VERSIONS)[number];\n\n/**\n * Full version information\n */\nexport const VERSION_INFO = {\n library: '12.0.5',\n adcp: '3.1.2',\n compatibleVersions: COMPATIBLE_ADCP_VERSIONS,\n generatedAt: '2026-07-23T00:10:47.630Z',\n} as const;\n\n/**\n * Get the AdCP specification version this library is built for\n */\nexport function getAdcpVersion(): string {\n return ADCP_VERSION;\n}\n\n/**\n * Get the library version\n */\nexport function getLibraryVersion(): string {\n return LIBRARY_VERSION;\n}\n\n/**\n * Check if this library version is compatible with a given AdCP version\n */\nexport function isCompatibleWith(adcpVersion: string): boolean {\n return (COMPATIBLE_ADCP_VERSIONS as readonly string[]).includes(adcpVersion);\n}\n\n/**\n * Get all AdCP versions this library is compatible with\n */\nexport function getCompatibleVersions(): readonly string[] {\n return COMPATIBLE_ADCP_VERSIONS;\n}\n\n/**\n * Extract the major version number from an AdCP version string.\n *\n * Accepts:\n * - Semver: '3.0.0', '3.0.1', '3.1.0-beta.1' → 3\n * - Legacy aliases: 'v3' → 3, 'v2.5' / 'v2.6' → 2\n *\n * Returns NaN for unrecognized strings — callers should validate before passing.\n */\nexport function parseAdcpMajorVersion(version: string): number {\n const trimmed = version.trim();\n const semverLike = trimmed.startsWith('v') ? trimmed.slice(1) : trimmed;\n const major = parseInt(semverLike.split('.')[0] ?? '', 10);\n return Number.isFinite(major) ? major : NaN;\n}\n\n/**\n * Normalize a full-semver AdCP version (`MAJOR.MINOR.PATCH[-prerelease]`) to\n * the release-precision form that AdCP 3.1+ requires on the wire:\n * `MAJOR.MINOR[-prerelease]` — the patch digit is dropped.\n *\n * Per the spec note on `adcp_version`: \"SDKs that read full-semver values\n * from bundle metadata (e.g. `ComplianceIndex.published_version =\n * \"3.1.0-beta.1\"`) MUST normalize to release-precision (`\"3.1-beta.1\"`)\n * before emitting on the wire — meta-field values are NOT valid wire\n * values.\" The wire regex (`^\\d+\\.\\d+(-[a-zA-Z0-9.-]+)?$`) rejects strings\n * with a patch digit.\n *\n * Behavior:\n * - `\"3.1.0-beta.7\"` → `\"3.1-beta.7\"`\n * - `\"3.1.0\"` → `\"3.1\"`\n * - `\"3.0.12\"` → `\"3.0\"`\n * - Already-release-precision input (`\"3.1\"`, `\"3.1-beta.7\"`) passes through\n * - Legacy aliases (`\"v2.5\"`, `\"v3\"`) pass through unchanged — the wire\n * regex doesn't accept them anyway; the v2.5 path uses\n * `adcp_major_version` instead of `adcp_version` for transport.\n * - Unrecognized strings pass through unchanged so callers can detect drift\n * via the wire validator rather than have it masked by this helper.\n */\nexport function toReleasePrecisionVersion(version: string): string {\n const trimmed = version.trim();\n // Pre-release form `MAJOR.MINOR.PATCH-prerelease` → `MAJOR.MINOR-prerelease`\n const semverMatch = trimmed.match(/^(\\d+)\\.(\\d+)\\.\\d+(-[A-Za-z0-9.-]+)?$/);\n if (semverMatch) {\n const [, major, minor, pre = ''] = semverMatch;\n return `${major}.${minor}${pre}`;\n }\n // Already release-precision (no patch digit). Includes `3.1`, `3.1-beta.7`.\n if (/^\\d+\\.\\d+(-[A-Za-z0-9.-]+)?$/.test(trimmed)) return trimmed;\n // Legacy aliases (`v3`, `v2.5`, `v2.6`) and anything we don't recognize —\n // pass through so the wire validator can flag genuine drift.\n return version;\n}\n"],"mappings":"AAMO,MAAM,kBAAkB;AAKxB,MAAM,eAAe;AAOrB,MAAM,qBAAqB;AAS3B,MAAM,2BAA2B;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAeO,MAAM,eAAe;AAAA,EAC1B,SAAS;AAAA,EACT,MAAM;AAAA,EACN,oBAAoB;AAAA,EACpB,aAAa;AACf;AAKO,SAAS,iBAAyB;AACvC,SAAO;AACT;AAKO,SAAS,oBAA4B;AAC1C,SAAO;AACT;AAKO,SAAS,iBAAiB,aAA8B;AAC7D,SAAQ,yBAA+C,SAAS,WAAW;AAC7E;AAKO,SAAS,wBAA2C;AACzD,SAAO;AACT;AAWO,SAAS,sBAAsB,SAAyB;AAC7D,QAAM,UAAU,QAAQ,KAAK;AAC7B,QAAM,aAAa,QAAQ,WAAW,GAAG,IAAI,QAAQ,MAAM,CAAC,IAAI;AAChE,QAAM,QAAQ,SAAS,WAAW,MAAM,GAAG,EAAE,CAAC,KAAK,IAAI,EAAE;AACzD,SAAO,OAAO,SAAS,KAAK,IAAI,QAAQ;AAC1C;AAyBO,SAAS,0BAA0B,SAAyB;AACjE,QAAM,UAAU,QAAQ,KAAK;AAE7B,QAAM,cAAc,QAAQ,MAAM,uCAAuC;AACzE,MAAI,aAAa;AACf,UAAM,CAAC,EAAE,OAAO,OAAO,MAAM,EAAE,IAAI;AACnC,WAAO,GAAG,KAAK,IAAI,KAAK,GAAG,GAAG;AAAA,EAChC;AAEA,MAAI,+BAA+B,KAAK,OAAO,EAAG,QAAO;AAGzD,SAAO;AACT;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adcp/sdk",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.5",
|
|
4
4
|
"description": "AdCP SDK — client, server, and compliance harnesses for the AdContext Protocol (MCP + A2A)",
|
|
5
5
|
"workspaces": [
|
|
6
6
|
".",
|
|
@@ -625,7 +625,7 @@
|
|
|
625
625
|
"prettier": "^3.6.2",
|
|
626
626
|
"publint": "^0.3.21",
|
|
627
627
|
"redis": "^4.7.0",
|
|
628
|
-
"tar": "^7.5.
|
|
628
|
+
"tar": "^7.5.21",
|
|
629
629
|
"ts-to-zod": "^5.0.1",
|
|
630
630
|
"tsup": "^8.5.1",
|
|
631
631
|
"tsx": "^4.6.0",
|