@adcp/sdk 16.2.0 → 16.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.
- package/AGENTS.md +2 -0
- package/dist/lib/adapters/version/3.1/assignments.d.mts +12 -0
- package/dist/lib/adapters/version/3.1/assignments.d.ts +12 -0
- package/dist/lib/adapters/version/3.1/assignments.js +67 -0
- package/dist/lib/adapters/version/3.1/assignments.mjs +43 -0
- package/dist/lib/adapters/version/3.1/bidding.d.mts +3 -0
- package/dist/lib/adapters/version/3.1/bidding.d.ts +3 -0
- package/dist/lib/adapters/version/3.1/bidding.js +115 -0
- package/dist/lib/adapters/version/3.1/bidding.mjs +90 -0
- package/dist/lib/adapters/version/3.1/delivery.d.mts +7 -0
- package/dist/lib/adapters/version/3.1/delivery.d.ts +7 -0
- package/dist/lib/adapters/version/3.1/delivery.js +78 -0
- package/dist/lib/adapters/version/3.1/delivery.mjs +54 -0
- package/dist/lib/adapters/version/3.1/index.d.mts +3 -0
- package/dist/lib/adapters/version/3.1/index.d.ts +3 -0
- package/dist/lib/adapters/version/3.1/index.js +36 -0
- package/dist/lib/adapters/version/3.1/index.mjs +12 -0
- package/dist/lib/adapters/version/index.d.mts +59 -7
- package/dist/lib/adapters/version/index.d.ts +59 -7
- package/dist/lib/adapters/version/index.js +51 -2
- package/dist/lib/adapters/version/index.mjs +49 -1
- package/dist/lib/adapters/version/negotiate.d.mts +71 -0
- package/dist/lib/adapters/version/negotiate.d.ts +71 -0
- package/dist/lib/adapters/version/negotiate.js +101 -0
- package/dist/lib/adapters/version/negotiate.mjs +73 -0
- package/dist/lib/adapters/version/schema-projection.d.mts +33 -0
- package/dist/lib/adapters/version/schema-projection.d.ts +33 -0
- package/dist/lib/adapters/version/schema-projection.js +294 -0
- package/dist/lib/adapters/version/schema-projection.mjs +269 -0
- package/dist/lib/adapters/version/translate.d.mts +122 -0
- package/dist/lib/adapters/version/translate.d.ts +122 -0
- package/dist/lib/adapters/version/translate.js +169 -0
- package/dist/lib/adapters/version/translate.mjs +141 -0
- package/dist/lib/adapters/version/types.d.mts +51 -10
- package/dist/lib/adapters/version/types.d.ts +51 -10
- package/dist/lib/core/AgentClient.d.mts +1 -1
- package/dist/lib/core/AgentClient.d.ts +1 -1
- package/dist/lib/core/AgentClient.js +17 -1
- package/dist/lib/core/AgentClient.mjs +17 -1
- package/dist/lib/core/ConversationTypes.d.mts +7 -0
- package/dist/lib/core/ConversationTypes.d.ts +7 -0
- package/dist/lib/core/SingleAgentClient.d.mts +82 -0
- package/dist/lib/core/SingleAgentClient.d.ts +82 -0
- package/dist/lib/core/SingleAgentClient.js +336 -15
- package/dist/lib/core/SingleAgentClient.mjs +350 -17
- package/dist/lib/core/TaskExecutor.d.mts +1 -1
- package/dist/lib/core/TaskExecutor.d.ts +1 -1
- package/dist/lib/core/TaskExecutor.js +182 -31
- package/dist/lib/core/TaskExecutor.mjs +183 -32
- package/dist/lib/core/account-reduction.d.mts +36 -0
- package/dist/lib/core/account-reduction.d.ts +36 -0
- package/dist/lib/core/account-reduction.js +127 -0
- package/dist/lib/core/account-reduction.mjs +98 -0
- package/dist/lib/core/buyer-account-registry.d.mts +52 -0
- package/dist/lib/core/buyer-account-registry.d.ts +52 -0
- package/dist/lib/core/buyer-account-registry.js +142 -6
- package/dist/lib/core/buyer-account-registry.mjs +142 -6
- package/dist/lib/errors/index.d.mts +34 -0
- package/dist/lib/errors/index.d.ts +34 -0
- package/dist/lib/errors/index.js +11 -0
- package/dist/lib/errors/index.mjs +10 -0
- package/dist/lib/index.d.mts +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +2 -0
- package/dist/lib/index.mjs +2 -0
- package/dist/lib/media-buy/action-contracts.js +4 -4
- package/dist/lib/media-buy/action-contracts.mjs +4 -4
- package/dist/lib/media-buy/action-types.d.mts +3 -2
- package/dist/lib/media-buy/action-types.d.ts +3 -2
- package/dist/lib/media-buy/compatibility.d.mts +1 -0
- package/dist/lib/media-buy/compatibility.d.ts +1 -0
- package/dist/lib/media-buy/compatibility.js +33 -10
- package/dist/lib/media-buy/compatibility.mjs +32 -14
- package/dist/lib/media-buy/update-fields.generated.d.mts +3 -2
- package/dist/lib/media-buy/update-fields.generated.d.ts +3 -2
- package/dist/lib/negotiation/buyer.js +11 -5
- package/dist/lib/negotiation/buyer.mjs +11 -5
- package/dist/lib/negotiation/types.d.mts +4 -2
- package/dist/lib/negotiation/types.d.ts +4 -2
- package/dist/lib/negotiation/verification.d.mts +15 -6
- package/dist/lib/negotiation/verification.d.ts +15 -6
- package/dist/lib/negotiation/verification.js +146 -27
- package/dist/lib/negotiation/verification.mjs +146 -28
- package/dist/lib/negotiation/version.d.mts +6 -0
- package/dist/lib/negotiation/version.d.ts +6 -0
- package/dist/lib/negotiation/version.js +60 -0
- package/dist/lib/negotiation/version.mjs +33 -0
- package/dist/lib/registry/types.generated.d.mts +1 -1
- package/dist/lib/registry/types.generated.d.ts +1 -1
- package/dist/lib/server/create-adcp-server.d.mts +21 -0
- package/dist/lib/server/create-adcp-server.d.ts +21 -0
- package/dist/lib/server/create-adcp-server.js +98 -16
- package/dist/lib/server/create-adcp-server.mjs +84 -2
- package/dist/lib/server/error-arm-tools.d.mts +10 -10
- package/dist/lib/server/error-arm-tools.d.ts +10 -10
- package/dist/lib/server/error-arm-tools.js +22 -58
- package/dist/lib/server/error-arm-tools.mjs +30 -65
- package/dist/lib/server/index.d.mts +1 -1
- package/dist/lib/server/index.d.ts +1 -1
- package/dist/lib/storage/interfaces.d.mts +2 -0
- package/dist/lib/storage/interfaces.d.ts +2 -0
- package/dist/lib/testing/compliance/comply.js +17 -0
- package/dist/lib/testing/compliance/comply.mjs +17 -0
- package/dist/lib/testing/index.d.mts +3 -0
- package/dist/lib/testing/index.d.ts +3 -0
- package/dist/lib/testing/index.js +44 -2
- package/dist/lib/testing/index.mjs +42 -0
- package/dist/lib/testing/storyboard/collection-selection.d.mts +259 -0
- package/dist/lib/testing/storyboard/collection-selection.d.ts +259 -0
- package/dist/lib/testing/storyboard/collection-selection.js +384 -0
- package/dist/lib/testing/storyboard/collection-selection.mjs +348 -0
- package/dist/lib/testing/storyboard/context.js +12 -6
- package/dist/lib/testing/storyboard/context.mjs +12 -6
- package/dist/lib/testing/storyboard/fixture-resolution.d.mts +39 -1
- package/dist/lib/testing/storyboard/fixture-resolution.d.ts +39 -1
- package/dist/lib/testing/storyboard/fixture-resolution.js +216 -12
- package/dist/lib/testing/storyboard/fixture-resolution.mjs +218 -12
- package/dist/lib/testing/storyboard/index.d.mts +9 -2
- package/dist/lib/testing/storyboard/index.d.ts +9 -2
- package/dist/lib/testing/storyboard/index.js +51 -2
- package/dist/lib/testing/storyboard/index.mjs +49 -1
- package/dist/lib/testing/storyboard/prepared-fixtures.d.mts +471 -0
- package/dist/lib/testing/storyboard/prepared-fixtures.d.ts +471 -0
- package/dist/lib/testing/storyboard/prepared-fixtures.js +434 -0
- package/dist/lib/testing/storyboard/prepared-fixtures.mjs +389 -0
- package/dist/lib/testing/storyboard/protected-context.d.mts +127 -0
- package/dist/lib/testing/storyboard/protected-context.d.ts +127 -0
- package/dist/lib/testing/storyboard/protected-context.js +301 -0
- package/dist/lib/testing/storyboard/protected-context.mjs +267 -0
- package/dist/lib/testing/storyboard/rejection-hints.js +13 -4
- package/dist/lib/testing/storyboard/rejection-hints.mjs +13 -4
- package/dist/lib/testing/storyboard/runner.d.mts +24 -0
- package/dist/lib/testing/storyboard/runner.d.ts +24 -0
- package/dist/lib/testing/storyboard/runner.js +1061 -105
- package/dist/lib/testing/storyboard/runner.mjs +1075 -106
- package/dist/lib/testing/storyboard/seeding.d.mts +15 -1
- package/dist/lib/testing/storyboard/seeding.d.ts +15 -1
- package/dist/lib/testing/storyboard/seeding.js +272 -12
- package/dist/lib/testing/storyboard/seeding.mjs +274 -13
- package/dist/lib/testing/storyboard/types.d.mts +207 -10
- package/dist/lib/testing/storyboard/types.d.ts +207 -10
- package/dist/lib/testing/storyboard/types.js +1 -1
- package/dist/lib/testing/storyboard/types.mjs +1 -1
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/testing/storyboard/validations.js +95 -0
- package/dist/lib/testing/storyboard/validations.mjs +95 -0
- package/dist/lib/validation/bundled-schema-store.js +5 -0
- package/dist/lib/validation/bundled-schema-store.mjs +4 -0
- package/dist/lib/validation/schema-loader.js +19 -2
- package/dist/lib/validation/schema-loader.mjs +22 -3
- 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.mjs +3 -3
- package/docs/TYPE-SUMMARY.md +2 -2
- package/docs/guides/COLLECTION-FIXTURE-FOUNDATION.md +850 -0
- package/docs/guides/PROPOSAL-TERMS-VERIFICATION.md +66 -0
- package/docs/llms.txt +4 -3
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/package.json +1 -1
|
@@ -5,6 +5,8 @@ import {
|
|
|
5
5
|
import { assertNativeRequestProposalsTask, guardNativeRequestProposalsCompletion } from "./request-proposals-guard.mjs";
|
|
6
6
|
import { buildRefineProposalsRequest } from "../negotiation/buyer.mjs";
|
|
7
7
|
import { assertRefineProposalsResponse } from "../negotiation/verification.mjs";
|
|
8
|
+
import { applicableRefinementServedVersion } from "../negotiation/version.mjs";
|
|
9
|
+
import { toReleasePrecisionVersion } from "../version.mjs";
|
|
8
10
|
function stripRefineProposalsSdkAnnotations(data) {
|
|
9
11
|
const canonical = { ...data };
|
|
10
12
|
delete canonical.success;
|
|
@@ -147,6 +149,10 @@ class AgentClient {
|
|
|
147
149
|
getAdcpVersion() {
|
|
148
150
|
return this.client.getAdcpVersion();
|
|
149
151
|
}
|
|
152
|
+
/** @internal Original envelope pin, separate from the validation schema pin. */
|
|
153
|
+
getWireAdcpVersion() {
|
|
154
|
+
return this.client.getWireAdcpVersion();
|
|
155
|
+
}
|
|
150
156
|
/**
|
|
151
157
|
* Negotiate one compact-first media-buy facade for this seller.
|
|
152
158
|
*
|
|
@@ -480,7 +486,17 @@ class AgentClient {
|
|
|
480
486
|
this.retainSession(result);
|
|
481
487
|
if (result.success && result.status === "completed") {
|
|
482
488
|
const data = stripRefineProposalsSdkAnnotations(result.data);
|
|
483
|
-
|
|
489
|
+
const cachedServedVersion = this.client.getCachedServedAdcpVersion(taskOptions);
|
|
490
|
+
assertRefineProposalsResponse(request, data, {
|
|
491
|
+
adcpVersion: this.client.getAdcpVersion(),
|
|
492
|
+
// Task metadata repeats the response echo. Independently discovered
|
|
493
|
+
// actual served evidence must constrain that seller-controlled value.
|
|
494
|
+
servedAdcpVersion: applicableRefinementServedVersion(
|
|
495
|
+
cachedServedVersion,
|
|
496
|
+
request.adcp_version,
|
|
497
|
+
toReleasePrecisionVersion(this.client.getWireAdcpVersion())
|
|
498
|
+
) ?? result.metadata.adcpVersion
|
|
499
|
+
});
|
|
484
500
|
return { ...result, data };
|
|
485
501
|
}
|
|
486
502
|
return result;
|
|
@@ -503,6 +503,13 @@ export interface TaskResultMetadata {
|
|
|
503
503
|
* configuration pin, when detecting same-major downshift.
|
|
504
504
|
*/
|
|
505
505
|
adcpVersion?: string;
|
|
506
|
+
/**
|
|
507
|
+
* Older AdCP release negotiated with the seller for this call. Present only
|
|
508
|
+
* when it differs from the client's release: the request was converted down
|
|
509
|
+
* to it and the response converted back up (see `debug_logs` for every
|
|
510
|
+
* field the conversion removed or moved).
|
|
511
|
+
*/
|
|
512
|
+
negotiatedAdcpVersion?: string;
|
|
506
513
|
/** Seller wire generation used for this request after capability discovery. */
|
|
507
514
|
serverVersion?: 'v2' | 'v3';
|
|
508
515
|
/** True when {@link serverVersion} came from the SDK's synthetic fallback. */
|
|
@@ -503,6 +503,13 @@ export interface TaskResultMetadata {
|
|
|
503
503
|
* configuration pin, when detecting same-major downshift.
|
|
504
504
|
*/
|
|
505
505
|
adcpVersion?: string;
|
|
506
|
+
/**
|
|
507
|
+
* Older AdCP release negotiated with the seller for this call. Present only
|
|
508
|
+
* when it differs from the client's release: the request was converted down
|
|
509
|
+
* to it and the response converted back up (see `debug_logs` for every
|
|
510
|
+
* field the conversion removed or moved).
|
|
511
|
+
*/
|
|
512
|
+
negotiatedAdcpVersion?: string;
|
|
506
513
|
/** Seller wire generation used for this request after capability discovery. */
|
|
507
514
|
serverVersion?: 'v2' | 'v3';
|
|
508
515
|
/** True when {@link serverVersion} came from the SDK's synthetic fallback. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ListProductsResponseWithSupplyPath, type ProductSupplyPathOptions } from '../supply-path/products.mjs';
|
|
2
2
|
import type { AccountReference, AgentConfig } from '../types/index.mjs';
|
|
3
3
|
import { type AdcpVersion } from '../version.mjs';
|
|
4
|
+
import { type AccountIdentityDowngrade } from '../adapters/version/index.mjs';
|
|
4
5
|
import type { GetProductsRequest, GetProductsResponse, ListProductsRequest, ListCreativeFormatsRequest, ListCreativeFormatsResponse, ListTransformersRequest, ListTransformersResponse, CreateMediaBuyRequest, CreateMediaBuyResponse, UpdateMediaBuyRequest, UpdateMediaBuyResponse, SyncCreativesRequest, SyncCreativesResponse, ListCreativesRequest, ListCreativesResponse, GetMediaBuysRequest, GetMediaBuysResponse, GetMediaBuyDeliveryRequest, GetMediaBuyDeliveryResponse, GetCreativeDeliveryRequest, GetCreativeDeliveryResponse, ProvidePerformanceFeedbackRequest, ProvidePerformanceFeedbackResponse, GetSignalsRequest, GetSignalsResponse, ActivateSignalRequest, ActivateSignalResponse, PreviewCreativeRequest, PreviewCreativeResponse, BuildCreativeRequest, BuildCreativeResponse, Format, GetAdCPCapabilitiesRequest, GetAdCPCapabilitiesResponse, ListAccountChangesRequest, ListAccountChangesResponse, ListAccountsRequest, ListAccountsResponse, SyncAccountsRequest, SyncAccountsResponse, SyncAudiencesRequest, SyncAudiencesResponse, CreatePropertyListRequest, CreatePropertyListResponse, GetPropertyListRequest, GetPropertyListResponse, UpdatePropertyListRequest, UpdatePropertyListResponse, ListPropertyListsRequest, ListPropertyListsResponse, DeletePropertyListRequest, DeletePropertyListResponse, ListContentStandardsRequest, ListContentStandardsResponse, GetContentStandardsRequest, GetContentStandardsResponse, CalibrateContentRequest, CalibrateContentResponse, ValidateContentDeliveryRequest, ValidateContentDeliveryResponse, SIGetOfferingRequest, SIGetOfferingResponse, SIInitiateSessionRequest, SIInitiateSessionResponse, SISendMessageRequest, SISendMessageResponse, SITerminateSessionRequest, SITerminateSessionResponse, SyncPlansRequest, SyncPlansResponse, GetPlanAuditLogsRequest, GetPlanAuditLogsResponse, GetPrincipalRequest, SyncPrincipalRequest, SyncPrincipalResponse, OutcomeType } from '../types/tools.generated.mjs';
|
|
5
6
|
import { type MutatingRequestInput } from '../utils/idempotency.mjs';
|
|
6
7
|
import type { MCPWebhookPayload, TaskStatus } from '../types/core.generated.mjs';
|
|
@@ -382,6 +383,29 @@ export interface SingleAgentClientConfig extends ConversationConfig {
|
|
|
382
383
|
validateFeatures?: boolean;
|
|
383
384
|
/** Require release compatibility and the declared idempotency replay TTL before mutations. */
|
|
384
385
|
requireV3ForMutations?: boolean;
|
|
386
|
+
/**
|
|
387
|
+
* What to do when a request reaches a seller on an older AdCP release and
|
|
388
|
+
* its account key uses fields that release cannot express. AdCP 3.2 added
|
|
389
|
+
* `operator_unit`, `currency` and `timezone` to the account natural key and
|
|
390
|
+
* `countries` to brand references; a 3.1 seller's key has none of them.
|
|
391
|
+
*
|
|
392
|
+
* - `'refuse'` (default): fail the call before it is sent with
|
|
393
|
+
* `ProtocolFeatureUnsupportedError`.
|
|
394
|
+
* - `'reduce'`: send the older key when that is unambiguous, and refuse when
|
|
395
|
+
* it would merge accounts. Each reduced key is claimed for the one buyer
|
|
396
|
+
* key it came from (a key sent unreduced claims itself), and a second
|
|
397
|
+
* buyer key that would reach the same seller account fails with
|
|
398
|
+
* `account_identity_collision` before sending, so no two buyer accounts
|
|
399
|
+
* share one seller account. Each reduction is reported in `debug_logs` as
|
|
400
|
+
* an `account_identity_reduced` entry. Requires `accountStorage` with
|
|
401
|
+
* `compareAndSet`, so the claims hold across instances and restarts.
|
|
402
|
+
*
|
|
403
|
+
* The rule is proposed for the spec as adcontextprotocol/adcp DR-0032
|
|
404
|
+
* (#8373); the default may change to `'reduce'` once it is ratified.
|
|
405
|
+
*
|
|
406
|
+
* @default 'refuse'
|
|
407
|
+
*/
|
|
408
|
+
accountIdentityDowngrade?: AccountIdentityDowngrade;
|
|
385
409
|
/**
|
|
386
410
|
* Runtime schema validation options
|
|
387
411
|
*/
|
|
@@ -556,6 +580,8 @@ export declare class SingleAgentClient {
|
|
|
556
580
|
private cachedCapabilities?;
|
|
557
581
|
private runAgentInfo?;
|
|
558
582
|
private cachedToolSchemas?;
|
|
583
|
+
/** Release negotiated per operation, for converting webhook completions up. */
|
|
584
|
+
private readonly negotiatedReleaseByOperation;
|
|
559
585
|
private primedCapabilitiesExpiresAt?;
|
|
560
586
|
private capabilityEvidenceScopeKey;
|
|
561
587
|
private capabilityEvidenceAuthMaterial?;
|
|
@@ -907,6 +933,62 @@ export declare class SingleAgentClient {
|
|
|
907
933
|
private productPolicyRequestParamsForWebhook;
|
|
908
934
|
private productPolicyRequestParamsForKey;
|
|
909
935
|
private applyProductPropertyPolicyToWebhookResult;
|
|
936
|
+
private get accountIdentityDowngrade();
|
|
937
|
+
/**
|
|
938
|
+
* Negotiate the AdCP release to speak with this seller for one call: the
|
|
939
|
+
* highest release both sides support. Returns `undefined` when the call
|
|
940
|
+
* keeps its configured wire version: an explicit `wireAdcpVersion`
|
|
941
|
+
* override, a governed payload that must reach the seller byte-for-byte,
|
|
942
|
+
* the identity 3.3 experiment, or no authoritative seller release
|
|
943
|
+
* (synthetic capabilities, no release in common, or no release metadata at
|
|
944
|
+
* all: AdCP 3.1 does not require `supported_versions`, so its absence does
|
|
945
|
+
* not prove a 3.0 seller, and such sellers keep the 3.0 request adapters).
|
|
946
|
+
*/
|
|
947
|
+
private negotiateCallRelease;
|
|
948
|
+
/**
|
|
949
|
+
* Per-call options carrying the negotiated release to the executor, which
|
|
950
|
+
* stamps it on the version envelope and validates the response against it.
|
|
951
|
+
*/
|
|
952
|
+
private withNegotiatedRelease;
|
|
953
|
+
/**
|
|
954
|
+
* Refuse a tool the negotiated release does not define (a 3.2-only task
|
|
955
|
+
* sent to a 3.1 seller) with a typed error instead of a seller-side schema
|
|
956
|
+
* or unknown-tool failure. Sellers that list the tool anyway are called.
|
|
957
|
+
*/
|
|
958
|
+
private assertToolAvailableAtRelease;
|
|
959
|
+
/**
|
|
960
|
+
* Account-key bookkeeping for `accountIdentityDowngrade: 'reduce'`.
|
|
961
|
+
*
|
|
962
|
+
* Converting down to an older seller release: claim each reduced key for
|
|
963
|
+
* the buyer key it came from, and refuse the request when the reduced key
|
|
964
|
+
* (or an unreduced key the request sends as is) already belongs to a
|
|
965
|
+
* different buyer key. Without this, two buyer accounts would silently
|
|
966
|
+
* share one seller account, with merged settings, spend and reads.
|
|
967
|
+
*
|
|
968
|
+
* Seller on the client's release: a buyer key that earlier reached this
|
|
969
|
+
* seller reduced is still addressed by its reduced key, which is the key
|
|
970
|
+
* the seller's account has, until the caller moves the account to the full
|
|
971
|
+
* key and calls `client.accounts.clearReduction(key)`.
|
|
972
|
+
*
|
|
973
|
+
* Runs only once the account registry is in use or under `'reduce'`.
|
|
974
|
+
*/
|
|
975
|
+
private reconcileAccountKeyReductions;
|
|
976
|
+
private throwAccountKeyCollision;
|
|
977
|
+
private throwFieldsUnsupportedAtRelease;
|
|
978
|
+
private throwAccountIdentityUnsupported;
|
|
979
|
+
private rememberNegotiatedRelease;
|
|
980
|
+
/**
|
|
981
|
+
* Webhook completions bypass task finalization, so convert their result up
|
|
982
|
+
* here. The seller's own `adcp_version` names the release it served; an
|
|
983
|
+
* AdCP 3.0 seller sends none, so fall back to the release this client
|
|
984
|
+
* negotiated for the operation.
|
|
985
|
+
*/
|
|
986
|
+
private convertWebhookResultToClientRelease;
|
|
987
|
+
/**
|
|
988
|
+
* Convert a response served at the negotiated release up to the client's
|
|
989
|
+
* release. Returns drift entries for each conversion applied.
|
|
990
|
+
*/
|
|
991
|
+
private convertResponseToClientRelease;
|
|
910
992
|
/**
|
|
911
993
|
* Adapt a request for the detected server wire version and the seller's
|
|
912
994
|
* AdCP protocol version. Applies protocol-version adapters (e.g. stripping
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ListProductsResponseWithSupplyPath, type ProductSupplyPathOptions } from '../supply-path/products';
|
|
2
2
|
import type { AccountReference, AgentConfig } from '../types';
|
|
3
3
|
import { type AdcpVersion } from '../version';
|
|
4
|
+
import { type AccountIdentityDowngrade } from '../adapters/version';
|
|
4
5
|
import type { GetProductsRequest, GetProductsResponse, ListProductsRequest, ListCreativeFormatsRequest, ListCreativeFormatsResponse, ListTransformersRequest, ListTransformersResponse, CreateMediaBuyRequest, CreateMediaBuyResponse, UpdateMediaBuyRequest, UpdateMediaBuyResponse, SyncCreativesRequest, SyncCreativesResponse, ListCreativesRequest, ListCreativesResponse, GetMediaBuysRequest, GetMediaBuysResponse, GetMediaBuyDeliveryRequest, GetMediaBuyDeliveryResponse, GetCreativeDeliveryRequest, GetCreativeDeliveryResponse, ProvidePerformanceFeedbackRequest, ProvidePerformanceFeedbackResponse, GetSignalsRequest, GetSignalsResponse, ActivateSignalRequest, ActivateSignalResponse, PreviewCreativeRequest, PreviewCreativeResponse, BuildCreativeRequest, BuildCreativeResponse, Format, GetAdCPCapabilitiesRequest, GetAdCPCapabilitiesResponse, ListAccountChangesRequest, ListAccountChangesResponse, ListAccountsRequest, ListAccountsResponse, SyncAccountsRequest, SyncAccountsResponse, SyncAudiencesRequest, SyncAudiencesResponse, CreatePropertyListRequest, CreatePropertyListResponse, GetPropertyListRequest, GetPropertyListResponse, UpdatePropertyListRequest, UpdatePropertyListResponse, ListPropertyListsRequest, ListPropertyListsResponse, DeletePropertyListRequest, DeletePropertyListResponse, ListContentStandardsRequest, ListContentStandardsResponse, GetContentStandardsRequest, GetContentStandardsResponse, CalibrateContentRequest, CalibrateContentResponse, ValidateContentDeliveryRequest, ValidateContentDeliveryResponse, SIGetOfferingRequest, SIGetOfferingResponse, SIInitiateSessionRequest, SIInitiateSessionResponse, SISendMessageRequest, SISendMessageResponse, SITerminateSessionRequest, SITerminateSessionResponse, SyncPlansRequest, SyncPlansResponse, GetPlanAuditLogsRequest, GetPlanAuditLogsResponse, GetPrincipalRequest, SyncPrincipalRequest, SyncPrincipalResponse, OutcomeType } from '../types/tools.generated';
|
|
5
6
|
import { type MutatingRequestInput } from '../utils/idempotency';
|
|
6
7
|
import type { MCPWebhookPayload, TaskStatus } from '../types/core.generated';
|
|
@@ -382,6 +383,29 @@ export interface SingleAgentClientConfig extends ConversationConfig {
|
|
|
382
383
|
validateFeatures?: boolean;
|
|
383
384
|
/** Require release compatibility and the declared idempotency replay TTL before mutations. */
|
|
384
385
|
requireV3ForMutations?: boolean;
|
|
386
|
+
/**
|
|
387
|
+
* What to do when a request reaches a seller on an older AdCP release and
|
|
388
|
+
* its account key uses fields that release cannot express. AdCP 3.2 added
|
|
389
|
+
* `operator_unit`, `currency` and `timezone` to the account natural key and
|
|
390
|
+
* `countries` to brand references; a 3.1 seller's key has none of them.
|
|
391
|
+
*
|
|
392
|
+
* - `'refuse'` (default): fail the call before it is sent with
|
|
393
|
+
* `ProtocolFeatureUnsupportedError`.
|
|
394
|
+
* - `'reduce'`: send the older key when that is unambiguous, and refuse when
|
|
395
|
+
* it would merge accounts. Each reduced key is claimed for the one buyer
|
|
396
|
+
* key it came from (a key sent unreduced claims itself), and a second
|
|
397
|
+
* buyer key that would reach the same seller account fails with
|
|
398
|
+
* `account_identity_collision` before sending, so no two buyer accounts
|
|
399
|
+
* share one seller account. Each reduction is reported in `debug_logs` as
|
|
400
|
+
* an `account_identity_reduced` entry. Requires `accountStorage` with
|
|
401
|
+
* `compareAndSet`, so the claims hold across instances and restarts.
|
|
402
|
+
*
|
|
403
|
+
* The rule is proposed for the spec as adcontextprotocol/adcp DR-0032
|
|
404
|
+
* (#8373); the default may change to `'reduce'` once it is ratified.
|
|
405
|
+
*
|
|
406
|
+
* @default 'refuse'
|
|
407
|
+
*/
|
|
408
|
+
accountIdentityDowngrade?: AccountIdentityDowngrade;
|
|
385
409
|
/**
|
|
386
410
|
* Runtime schema validation options
|
|
387
411
|
*/
|
|
@@ -556,6 +580,8 @@ export declare class SingleAgentClient {
|
|
|
556
580
|
private cachedCapabilities?;
|
|
557
581
|
private runAgentInfo?;
|
|
558
582
|
private cachedToolSchemas?;
|
|
583
|
+
/** Release negotiated per operation, for converting webhook completions up. */
|
|
584
|
+
private readonly negotiatedReleaseByOperation;
|
|
559
585
|
private primedCapabilitiesExpiresAt?;
|
|
560
586
|
private capabilityEvidenceScopeKey;
|
|
561
587
|
private capabilityEvidenceAuthMaterial?;
|
|
@@ -907,6 +933,62 @@ export declare class SingleAgentClient {
|
|
|
907
933
|
private productPolicyRequestParamsForWebhook;
|
|
908
934
|
private productPolicyRequestParamsForKey;
|
|
909
935
|
private applyProductPropertyPolicyToWebhookResult;
|
|
936
|
+
private get accountIdentityDowngrade();
|
|
937
|
+
/**
|
|
938
|
+
* Negotiate the AdCP release to speak with this seller for one call: the
|
|
939
|
+
* highest release both sides support. Returns `undefined` when the call
|
|
940
|
+
* keeps its configured wire version: an explicit `wireAdcpVersion`
|
|
941
|
+
* override, a governed payload that must reach the seller byte-for-byte,
|
|
942
|
+
* the identity 3.3 experiment, or no authoritative seller release
|
|
943
|
+
* (synthetic capabilities, no release in common, or no release metadata at
|
|
944
|
+
* all: AdCP 3.1 does not require `supported_versions`, so its absence does
|
|
945
|
+
* not prove a 3.0 seller, and such sellers keep the 3.0 request adapters).
|
|
946
|
+
*/
|
|
947
|
+
private negotiateCallRelease;
|
|
948
|
+
/**
|
|
949
|
+
* Per-call options carrying the negotiated release to the executor, which
|
|
950
|
+
* stamps it on the version envelope and validates the response against it.
|
|
951
|
+
*/
|
|
952
|
+
private withNegotiatedRelease;
|
|
953
|
+
/**
|
|
954
|
+
* Refuse a tool the negotiated release does not define (a 3.2-only task
|
|
955
|
+
* sent to a 3.1 seller) with a typed error instead of a seller-side schema
|
|
956
|
+
* or unknown-tool failure. Sellers that list the tool anyway are called.
|
|
957
|
+
*/
|
|
958
|
+
private assertToolAvailableAtRelease;
|
|
959
|
+
/**
|
|
960
|
+
* Account-key bookkeeping for `accountIdentityDowngrade: 'reduce'`.
|
|
961
|
+
*
|
|
962
|
+
* Converting down to an older seller release: claim each reduced key for
|
|
963
|
+
* the buyer key it came from, and refuse the request when the reduced key
|
|
964
|
+
* (or an unreduced key the request sends as is) already belongs to a
|
|
965
|
+
* different buyer key. Without this, two buyer accounts would silently
|
|
966
|
+
* share one seller account, with merged settings, spend and reads.
|
|
967
|
+
*
|
|
968
|
+
* Seller on the client's release: a buyer key that earlier reached this
|
|
969
|
+
* seller reduced is still addressed by its reduced key, which is the key
|
|
970
|
+
* the seller's account has, until the caller moves the account to the full
|
|
971
|
+
* key and calls `client.accounts.clearReduction(key)`.
|
|
972
|
+
*
|
|
973
|
+
* Runs only once the account registry is in use or under `'reduce'`.
|
|
974
|
+
*/
|
|
975
|
+
private reconcileAccountKeyReductions;
|
|
976
|
+
private throwAccountKeyCollision;
|
|
977
|
+
private throwFieldsUnsupportedAtRelease;
|
|
978
|
+
private throwAccountIdentityUnsupported;
|
|
979
|
+
private rememberNegotiatedRelease;
|
|
980
|
+
/**
|
|
981
|
+
* Webhook completions bypass task finalization, so convert their result up
|
|
982
|
+
* here. The seller's own `adcp_version` names the release it served; an
|
|
983
|
+
* AdCP 3.0 seller sends none, so fall back to the release this client
|
|
984
|
+
* negotiated for the operation.
|
|
985
|
+
*/
|
|
986
|
+
private convertWebhookResultToClientRelease;
|
|
987
|
+
/**
|
|
988
|
+
* Convert a response served at the negotiated release up to the client's
|
|
989
|
+
* release. Returns drift entries for each conversion applied.
|
|
990
|
+
*/
|
|
991
|
+
private convertResponseToClientRelease;
|
|
910
992
|
/**
|
|
911
993
|
* Adapt a request for the detected server wire version and the seller's
|
|
912
994
|
* AdCP protocol version. Applies protocol-version adapters (e.g. stripping
|