@adcp/sdk 14.0.0-rc.39 → 14.0.0-rc.40
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/README.md +2 -0
- package/dist/lib/core/AgentClient.d.mts +4 -3
- package/dist/lib/core/AgentClient.d.ts +4 -3
- package/dist/lib/core/AsyncHandler.d.mts +3 -0
- package/dist/lib/core/AsyncHandler.d.ts +3 -0
- package/dist/lib/core/AsyncHandler.js +3 -0
- package/dist/lib/core/AsyncHandler.mjs +3 -0
- package/dist/lib/core/SingleAgentClient.d.mts +6 -1
- package/dist/lib/core/SingleAgentClient.d.ts +6 -1
- package/dist/lib/core/SingleAgentClient.js +57 -17
- package/dist/lib/core/SingleAgentClient.mjs +59 -17
- package/dist/lib/discovery/adagents-redirects.d.mts +5 -1
- package/dist/lib/discovery/adagents-redirects.d.ts +5 -1
- package/dist/lib/discovery/adagents-redirects.js +10 -3
- package/dist/lib/discovery/adagents-redirects.mjs +10 -3
- package/dist/lib/discovery/types.d.mts +42 -0
- package/dist/lib/discovery/types.d.ts +42 -0
- package/dist/lib/index.d.mts +3 -1
- package/dist/lib/index.d.ts +3 -1
- package/dist/lib/index.js +3 -1
- package/dist/lib/index.mjs +1 -0
- package/dist/lib/net/ssrf-fetch.js +47 -21
- package/dist/lib/net/ssrf-fetch.mjs +47 -21
- package/dist/lib/registry/index.d.mts +3 -0
- package/dist/lib/registry/index.d.ts +3 -0
- package/dist/lib/registry/index.js +8 -0
- package/dist/lib/registry/index.mjs +8 -0
- package/dist/lib/registry/types.d.mts +2 -1
- package/dist/lib/registry/types.d.ts +2 -1
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/supply-path/evaluate.d.mts +17 -0
- package/dist/lib/supply-path/evaluate.d.ts +17 -0
- package/dist/lib/supply-path/evaluate.js +436 -0
- package/dist/lib/supply-path/evaluate.mjs +407 -0
- package/dist/lib/supply-path/fetch-evidence.d.mts +36 -0
- package/dist/lib/supply-path/fetch-evidence.d.ts +36 -0
- package/dist/lib/supply-path/fetch-evidence.js +293 -0
- package/dist/lib/supply-path/fetch-evidence.mjs +268 -0
- package/dist/lib/supply-path/index.d.mts +6 -0
- package/dist/lib/supply-path/index.d.ts +6 -0
- package/dist/lib/supply-path/index.js +49 -0
- package/dist/lib/supply-path/index.mjs +23 -0
- package/dist/lib/supply-path/products.d.mts +41 -0
- package/dist/lib/supply-path/products.d.ts +41 -0
- package/dist/lib/supply-path/products.js +228 -0
- package/dist/lib/supply-path/products.mjs +204 -0
- package/dist/lib/supply-path/revocations.d.mts +55 -0
- package/dist/lib/supply-path/revocations.d.ts +55 -0
- package/dist/lib/supply-path/revocations.js +127 -0
- package/dist/lib/supply-path/revocations.mjs +99 -0
- package/dist/lib/supply-path/types.d.mts +168 -0
- package/dist/lib/supply-path/types.d.ts +168 -0
- package/dist/lib/supply-path/types.js +16 -0
- package/dist/lib/supply-path/types.mjs +0 -0
- package/dist/lib/supply-path/validation.d.mts +10 -0
- package/dist/lib/supply-path/validation.d.ts +10 -0
- package/dist/lib/supply-path/validation.js +152 -0
- package/dist/lib/supply-path/validation.mjs +122 -0
- package/dist/lib/supply-path/verify.d.mts +25 -0
- package/dist/lib/supply-path/verify.d.ts +25 -0
- package/dist/lib/supply-path/verify.js +218 -0
- package/dist/lib/supply-path/verify.mjs +203 -0
- package/dist/lib/testing/storyboard/request-signing/grader.js +19 -9
- package/dist/lib/testing/storyboard/request-signing/grader.mjs +19 -9
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/v2/projection/creative-delivery.d.mts +1 -1
- package/dist/lib/v2/projection/creative-delivery.d.ts +1 -1
- package/dist/lib/validation/schema-loader.js +7 -5
- package/dist/lib/validation/schema-loader.mjs +7 -5
- 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/SUPPLY-PATH-VERIFICATION.md +101 -0
- package/docs/llms.txt +2 -2
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/examples/README.md +2 -0
- package/examples/supply-path-verification.ts +29 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1050,3 +1050,5 @@ Apache 2.0 License - see [LICENSE](LICENSE) file for details.
|
|
|
1050
1050
|
- **Documentation**: [docs.adcontextprotocol.org](https://docs.adcontextprotocol.org)
|
|
1051
1051
|
- **Issues**: [GitHub Issues](https://github.com/adcontextprotocol/adcp-client/issues)
|
|
1052
1052
|
- **Protocol Spec**: [AdCP Specification](https://github.com/adcontextprotocol/adcp)
|
|
1053
|
+
|
|
1054
|
+
Supply-path verification: use `verifySupplyPath` for authoritative evidence or the canonical registry verdict, and opt into external collection discovery annotations. See [the supply-path guide](docs/guides/SUPPLY-PATH-VERIFICATION.md).
|
|
@@ -6,7 +6,8 @@ import { type CanonicalReadTaskOptions, type CreativeDeliveryTaskOptions, type S
|
|
|
6
6
|
import type { InputHandler, TaskOptions, TaskResult, TaskInfo, Message, DirectPauseRecoveryRequest } from './ConversationTypes.mjs';
|
|
7
7
|
import type { AdcpCapabilities } from '../utils/capabilities.mjs';
|
|
8
8
|
import type { WebhookHeaderValue } from '../webhooks/index.mjs';
|
|
9
|
-
import type {
|
|
9
|
+
import type { ListProductsResponseWithSupplyPath } from '../supply-path/index.mjs';
|
|
10
|
+
import type { GetProductsRequest, GetProductsResponse, ListProductsRequest, RequestProposalsRequest, RequestProposalsResponse, DeclineProposalsRequest, DeclineProposalsResponse, BuyProductsRequest, BuyProductsResponse, AcceptProposalRequest, AcceptProposalResponse, ControlMediaBuyRequest, ControlMediaBuyResponse, ListCreativeFormatsRequest, ListCreativeFormatsResponse, CreateMediaBuyRequest, CreateMediaBuyResponse, UpdateMediaBuyRequest, UpdateMediaBuyResponse, SyncCreativesRequest, SyncCreativesResponse, ListCreativesRequest, ListCreativesResponse, GetMediaBuysRequest, GetMediaBuysResponse, GetMediaBuyDeliveryRequest, GetMediaBuyDeliveryResponse, GetReportingStatusRequest, GetReportingStatusResponse, SyncReportingStatusRequest, SyncReportingStatusResponse, SyncReportingReceiptsRequest, SyncReportingReceiptsResponse, GetCreativeDeliveryRequest, GetCreativeDeliveryResponse, ProvidePerformanceFeedbackRequest, ProvidePerformanceFeedbackResponse, GetSignalsRequest, GetSignalsResponse, ActivateSignalRequest, ActivateSignalResponse, GetAdCPCapabilitiesRequest, GetAdCPCapabilitiesResponse, PreviewCreativeRequest, PreviewCreativeResponse, BuildCreativeRequest, BuildCreativeResponse, 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, CheckGovernanceRequest, CheckGovernanceResponse, ReportPlanOutcomeRequest, ReportPlanOutcomeResponse, ReportPlanAdjustmentRequest, ReportPlanAdjustmentResponse, GetPlanAuditLogsRequest, GetPlanAuditLogsResponse, ListTransformersRequest, ListTransformersResponse, SyncAgentNotificationConfigsRequest, SyncAgentNotificationConfigsResponse } from '../types/tools.generated.mjs';
|
|
10
11
|
import type { MutatingRequestInput } from '../utils/idempotency.mjs';
|
|
11
12
|
import { MediaBuyLifecycleCoordinator, type MediaBuyLifecycleCoordinatorOptions } from '../media-buy/compatibility.mjs';
|
|
12
13
|
import type { ProposalRefinementCapabilities, RefineProposalsInput, RefineProposalsResponse } from '../negotiation/types.mjs';
|
|
@@ -45,7 +46,7 @@ export type V2AugmentedGetProductsResponse = CanonicalGetProductsResponse;
|
|
|
45
46
|
*/
|
|
46
47
|
export type TaskResponseTypeMap = {
|
|
47
48
|
get_products: CanonicalGetProductsResponse;
|
|
48
|
-
list_products:
|
|
49
|
+
list_products: ListProductsResponseWithSupplyPath;
|
|
49
50
|
request_proposals: RequestProposalsResponse;
|
|
50
51
|
refine_proposals: RefineProposalsResponse;
|
|
51
52
|
decline_proposals: DeclineProposalsResponse;
|
|
@@ -327,7 +328,7 @@ export declare class AgentClient {
|
|
|
327
328
|
*/
|
|
328
329
|
getProducts(params: CanonicalGetProductsRequest, inputHandler?: InputHandler, options?: CanonicalProjectionTaskOptions): Promise<TaskResult<CanonicalGetProductsResponse>>;
|
|
329
330
|
/** Discover products through the compact AdCP 3.2 catalog task. */
|
|
330
|
-
listProducts(params: ListProductsRequest, inputHandler?: InputHandler, options?: TaskOptions): Promise<TaskResult<
|
|
331
|
+
listProducts(params: ListProductsRequest, inputHandler?: InputHandler, options?: TaskOptions): Promise<TaskResult<ListProductsResponseWithSupplyPath>>;
|
|
331
332
|
/** Request one or more compact AdCP 3.2 proposals. */
|
|
332
333
|
requestProposals(params: MutatingRequestInput<RequestProposalsRequest>, inputHandler?: InputHandler, options?: TaskOptions): Promise<TaskResult<RequestProposalsResponse>>;
|
|
333
334
|
/** Decline outstanding proposals. */
|
|
@@ -6,7 +6,8 @@ import { type CanonicalReadTaskOptions, type CreativeDeliveryTaskOptions, type S
|
|
|
6
6
|
import type { InputHandler, TaskOptions, TaskResult, TaskInfo, Message, DirectPauseRecoveryRequest } from './ConversationTypes';
|
|
7
7
|
import type { AdcpCapabilities } from '../utils/capabilities';
|
|
8
8
|
import type { WebhookHeaderValue } from '../webhooks';
|
|
9
|
-
import type {
|
|
9
|
+
import type { ListProductsResponseWithSupplyPath } from '../supply-path';
|
|
10
|
+
import type { GetProductsRequest, GetProductsResponse, ListProductsRequest, RequestProposalsRequest, RequestProposalsResponse, DeclineProposalsRequest, DeclineProposalsResponse, BuyProductsRequest, BuyProductsResponse, AcceptProposalRequest, AcceptProposalResponse, ControlMediaBuyRequest, ControlMediaBuyResponse, ListCreativeFormatsRequest, ListCreativeFormatsResponse, CreateMediaBuyRequest, CreateMediaBuyResponse, UpdateMediaBuyRequest, UpdateMediaBuyResponse, SyncCreativesRequest, SyncCreativesResponse, ListCreativesRequest, ListCreativesResponse, GetMediaBuysRequest, GetMediaBuysResponse, GetMediaBuyDeliveryRequest, GetMediaBuyDeliveryResponse, GetReportingStatusRequest, GetReportingStatusResponse, SyncReportingStatusRequest, SyncReportingStatusResponse, SyncReportingReceiptsRequest, SyncReportingReceiptsResponse, GetCreativeDeliveryRequest, GetCreativeDeliveryResponse, ProvidePerformanceFeedbackRequest, ProvidePerformanceFeedbackResponse, GetSignalsRequest, GetSignalsResponse, ActivateSignalRequest, ActivateSignalResponse, GetAdCPCapabilitiesRequest, GetAdCPCapabilitiesResponse, PreviewCreativeRequest, PreviewCreativeResponse, BuildCreativeRequest, BuildCreativeResponse, 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, CheckGovernanceRequest, CheckGovernanceResponse, ReportPlanOutcomeRequest, ReportPlanOutcomeResponse, ReportPlanAdjustmentRequest, ReportPlanAdjustmentResponse, GetPlanAuditLogsRequest, GetPlanAuditLogsResponse, ListTransformersRequest, ListTransformersResponse, SyncAgentNotificationConfigsRequest, SyncAgentNotificationConfigsResponse } from '../types/tools.generated';
|
|
10
11
|
import type { MutatingRequestInput } from '../utils/idempotency';
|
|
11
12
|
import { MediaBuyLifecycleCoordinator, type MediaBuyLifecycleCoordinatorOptions } from '../media-buy/compatibility';
|
|
12
13
|
import type { ProposalRefinementCapabilities, RefineProposalsInput, RefineProposalsResponse } from '../negotiation/types';
|
|
@@ -45,7 +46,7 @@ export type V2AugmentedGetProductsResponse = CanonicalGetProductsResponse;
|
|
|
45
46
|
*/
|
|
46
47
|
export type TaskResponseTypeMap = {
|
|
47
48
|
get_products: CanonicalGetProductsResponse;
|
|
48
|
-
list_products:
|
|
49
|
+
list_products: ListProductsResponseWithSupplyPath;
|
|
49
50
|
request_proposals: RequestProposalsResponse;
|
|
50
51
|
refine_proposals: RefineProposalsResponse;
|
|
51
52
|
decline_proposals: DeclineProposalsResponse;
|
|
@@ -327,7 +328,7 @@ export declare class AgentClient {
|
|
|
327
328
|
*/
|
|
328
329
|
getProducts(params: CanonicalGetProductsRequest, inputHandler?: InputHandler, options?: CanonicalProjectionTaskOptions): Promise<TaskResult<CanonicalGetProductsResponse>>;
|
|
329
330
|
/** Discover products through the compact AdCP 3.2 catalog task. */
|
|
330
|
-
listProducts(params: ListProductsRequest, inputHandler?: InputHandler, options?: TaskOptions): Promise<TaskResult<
|
|
331
|
+
listProducts(params: ListProductsRequest, inputHandler?: InputHandler, options?: TaskOptions): Promise<TaskResult<ListProductsResponseWithSupplyPath>>;
|
|
331
332
|
/** Request one or more compact AdCP 3.2 proposals. */
|
|
332
333
|
requestProposals(params: MutatingRequestInput<RequestProposalsRequest>, inputHandler?: InputHandler, options?: TaskOptions): Promise<TaskResult<RequestProposalsResponse>>;
|
|
333
334
|
/** Decline outstanding proposals. */
|
|
@@ -7,6 +7,7 @@ import type { ListCreativeFormatsResponse, PreviewCreativeResponse, BuildCreativ
|
|
|
7
7
|
import type { AdCPAsyncResponseData, CreateMediaBuyAsyncInputRequired, CreateMediaBuyAsyncSubmitted, CreateMediaBuyAsyncWorking, GetProductsAsyncInputRequired, GetProductsAsyncSubmitted, GetProductsAsyncWorking, SyncCreativesAsyncInputRequired, SyncCreativesAsyncSubmitted, SyncCreativesAsyncWorking, UpdateMediaBuyAsyncInputRequired, UpdateMediaBuyAsyncSubmitted, UpdateMediaBuyAsyncWorking } from '../types/core.generated.mjs';
|
|
8
8
|
import type { TaskResultMetadata } from './ConversationTypes.mjs';
|
|
9
9
|
import type { CanonicalCreativeResponse, CanonicalGetProductsResponse, CanonicalListCreativesResponse } from '../v2/projection/creative-delivery.mjs';
|
|
10
|
+
import type { ListProductsResponseWithSupplyPath } from '../supply-path/products.mjs';
|
|
10
11
|
/**
|
|
11
12
|
* Metadata provided with webhook responses
|
|
12
13
|
*/
|
|
@@ -76,6 +77,7 @@ export interface NotificationMetadata extends WebhookMetadata {
|
|
|
76
77
|
next_expected_at?: string;
|
|
77
78
|
}
|
|
78
79
|
export type GetProductsStatusChangeHandler = (response: CanonicalGetProductsResponse | GetProductsAsyncSubmitted | GetProductsAsyncWorking | GetProductsAsyncInputRequired, metadata: WebhookMetadata) => void | Promise<void>;
|
|
80
|
+
export type ListProductsStatusChangeHandler = (response: ListProductsResponseWithSupplyPath, metadata: WebhookMetadata) => void | Promise<void>;
|
|
79
81
|
export type CreateMediaBuyStatusChangeHandler = (response: CanonicalCreativeResponse<CreateMediaBuyResponse | CreateMediaBuyAsyncSubmitted | CreateMediaBuyAsyncWorking | CreateMediaBuyAsyncInputRequired>, metadata: WebhookMetadata) => void | Promise<void>;
|
|
80
82
|
export type UpdateMediaBuyStatusChangeHandler = (response: CanonicalCreativeResponse<UpdateMediaBuyResponse | UpdateMediaBuyAsyncSubmitted | UpdateMediaBuyAsyncWorking | UpdateMediaBuyAsyncInputRequired>, metadata: WebhookMetadata) => void | Promise<void>;
|
|
81
83
|
export type SyncCreativesStatusChangeHandler = (response: CanonicalCreativeResponse<SyncCreativesResponse | SyncCreativesAsyncSubmitted | SyncCreativesAsyncWorking | SyncCreativesAsyncInputRequired>, metadata: WebhookMetadata) => void | Promise<void>;
|
|
@@ -139,6 +141,7 @@ export interface Activity {
|
|
|
139
141
|
*/
|
|
140
142
|
export interface AsyncHandlerConfig {
|
|
141
143
|
onGetProductsStatusChange?: GetProductsStatusChangeHandler;
|
|
144
|
+
onListProductsStatusChange?: ListProductsStatusChangeHandler;
|
|
142
145
|
onListCreativeFormatsLegacyStatusChange?: (data: ListCreativeFormatsResponse, metadata: WebhookMetadata) => void | Promise<void>;
|
|
143
146
|
onCreateMediaBuyStatusChange?: CreateMediaBuyStatusChangeHandler;
|
|
144
147
|
onUpdateMediaBuyStatusChange?: UpdateMediaBuyStatusChangeHandler;
|
|
@@ -7,6 +7,7 @@ import type { ListCreativeFormatsResponse, PreviewCreativeResponse, BuildCreativ
|
|
|
7
7
|
import type { AdCPAsyncResponseData, CreateMediaBuyAsyncInputRequired, CreateMediaBuyAsyncSubmitted, CreateMediaBuyAsyncWorking, GetProductsAsyncInputRequired, GetProductsAsyncSubmitted, GetProductsAsyncWorking, SyncCreativesAsyncInputRequired, SyncCreativesAsyncSubmitted, SyncCreativesAsyncWorking, UpdateMediaBuyAsyncInputRequired, UpdateMediaBuyAsyncSubmitted, UpdateMediaBuyAsyncWorking } from '../types/core.generated';
|
|
8
8
|
import type { TaskResultMetadata } from './ConversationTypes';
|
|
9
9
|
import type { CanonicalCreativeResponse, CanonicalGetProductsResponse, CanonicalListCreativesResponse } from '../v2/projection/creative-delivery';
|
|
10
|
+
import type { ListProductsResponseWithSupplyPath } from '../supply-path/products';
|
|
10
11
|
/**
|
|
11
12
|
* Metadata provided with webhook responses
|
|
12
13
|
*/
|
|
@@ -76,6 +77,7 @@ export interface NotificationMetadata extends WebhookMetadata {
|
|
|
76
77
|
next_expected_at?: string;
|
|
77
78
|
}
|
|
78
79
|
export type GetProductsStatusChangeHandler = (response: CanonicalGetProductsResponse | GetProductsAsyncSubmitted | GetProductsAsyncWorking | GetProductsAsyncInputRequired, metadata: WebhookMetadata) => void | Promise<void>;
|
|
80
|
+
export type ListProductsStatusChangeHandler = (response: ListProductsResponseWithSupplyPath, metadata: WebhookMetadata) => void | Promise<void>;
|
|
79
81
|
export type CreateMediaBuyStatusChangeHandler = (response: CanonicalCreativeResponse<CreateMediaBuyResponse | CreateMediaBuyAsyncSubmitted | CreateMediaBuyAsyncWorking | CreateMediaBuyAsyncInputRequired>, metadata: WebhookMetadata) => void | Promise<void>;
|
|
80
82
|
export type UpdateMediaBuyStatusChangeHandler = (response: CanonicalCreativeResponse<UpdateMediaBuyResponse | UpdateMediaBuyAsyncSubmitted | UpdateMediaBuyAsyncWorking | UpdateMediaBuyAsyncInputRequired>, metadata: WebhookMetadata) => void | Promise<void>;
|
|
81
83
|
export type SyncCreativesStatusChangeHandler = (response: CanonicalCreativeResponse<SyncCreativesResponse | SyncCreativesAsyncSubmitted | SyncCreativesAsyncWorking | SyncCreativesAsyncInputRequired>, metadata: WebhookMetadata) => void | Promise<void>;
|
|
@@ -139,6 +141,7 @@ export interface Activity {
|
|
|
139
141
|
*/
|
|
140
142
|
export interface AsyncHandlerConfig {
|
|
141
143
|
onGetProductsStatusChange?: GetProductsStatusChangeHandler;
|
|
144
|
+
onListProductsStatusChange?: ListProductsStatusChangeHandler;
|
|
142
145
|
onListCreativeFormatsLegacyStatusChange?: (data: ListCreativeFormatsResponse, metadata: WebhookMetadata) => void | Promise<void>;
|
|
143
146
|
onCreateMediaBuyStatusChange?: CreateMediaBuyStatusChangeHandler;
|
|
144
147
|
onUpdateMediaBuyStatusChange?: UpdateMediaBuyStatusChangeHandler;
|
|
@@ -325,6 +325,9 @@ class AsyncHandler {
|
|
|
325
325
|
case "get_products":
|
|
326
326
|
handler = this.config.onGetProductsStatusChange;
|
|
327
327
|
break;
|
|
328
|
+
case "list_products":
|
|
329
|
+
handler = this.config.onListProductsStatusChange;
|
|
330
|
+
break;
|
|
328
331
|
case "list_creative_formats":
|
|
329
332
|
handler = this.config.onListCreativeFormatsLegacyStatusChange;
|
|
330
333
|
break;
|
|
@@ -298,6 +298,9 @@ class AsyncHandler {
|
|
|
298
298
|
case "get_products":
|
|
299
299
|
handler = this.config.onGetProductsStatusChange;
|
|
300
300
|
break;
|
|
301
|
+
case "list_products":
|
|
302
|
+
handler = this.config.onListProductsStatusChange;
|
|
303
|
+
break;
|
|
301
304
|
case "list_creative_formats":
|
|
302
305
|
handler = this.config.onListCreativeFormatsLegacyStatusChange;
|
|
303
306
|
break;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { type ListProductsResponseWithSupplyPath, type ProductSupplyPathOptions } from '../supply-path/products.mjs';
|
|
1
2
|
import type { AgentConfig } from '../types/index.mjs';
|
|
2
3
|
import { type AdcpVersion } from '../version.mjs';
|
|
3
|
-
import type { GetProductsRequest, GetProductsResponse, 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, OutcomeType } from '../types/tools.generated.mjs';
|
|
4
|
+
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, OutcomeType } from '../types/tools.generated.mjs';
|
|
4
5
|
import { type MutatingRequestInput } from '../utils/idempotency.mjs';
|
|
5
6
|
import type { MCPWebhookPayload, TaskStatus } from '../types/core.generated.mjs';
|
|
6
7
|
type A2ATask = Record<string, any>;
|
|
@@ -418,6 +419,8 @@ export interface SingleAgentClientConfig extends ConversationConfig {
|
|
|
418
419
|
* violates an exclusion for `ladbible.com`.
|
|
419
420
|
*/
|
|
420
421
|
productPropertyPolicy?: ClientProductPropertyPolicy | false;
|
|
422
|
+
/** Opt in to computed, evidence-bearing external collection path annotations on product discovery. */
|
|
423
|
+
supplyPathVerification?: ProductSupplyPathOptions;
|
|
421
424
|
};
|
|
422
425
|
/** Governance configuration for buyer-side campaign governance */
|
|
423
426
|
governance?: import('./GovernanceTypes.mjs').GovernanceConfig;
|
|
@@ -835,6 +838,8 @@ export declare class SingleAgentClient {
|
|
|
835
838
|
* ```
|
|
836
839
|
*/
|
|
837
840
|
getProducts(params: CanonicalGetProductsRequest, inputHandler?: InputHandler, options?: CanonicalReadTaskOptions): Promise<TaskResult<CanonicalGetProductsResponse>>;
|
|
841
|
+
/** Discover products through the compact AdCP 3.2 catalog task. */
|
|
842
|
+
listProducts(params: ListProductsRequest, inputHandler?: InputHandler, options?: TaskOptions): Promise<TaskResult<ListProductsResponseWithSupplyPath>>;
|
|
838
843
|
/** @deprecated Explicit raw-wire escape hatch for migration tooling. */
|
|
839
844
|
getProductsLegacy(params: GetProductsRequest, inputHandler?: InputHandler, options?: TaskOptions): Promise<TaskResult<GetProductsResponse>>;
|
|
840
845
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { type ListProductsResponseWithSupplyPath, type ProductSupplyPathOptions } from '../supply-path/products';
|
|
1
2
|
import type { AgentConfig } from '../types';
|
|
2
3
|
import { type AdcpVersion } from '../version';
|
|
3
|
-
import type { GetProductsRequest, GetProductsResponse, 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, OutcomeType } from '../types/tools.generated';
|
|
4
|
+
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, OutcomeType } from '../types/tools.generated';
|
|
4
5
|
import { type MutatingRequestInput } from '../utils/idempotency';
|
|
5
6
|
import type { MCPWebhookPayload, TaskStatus } from '../types/core.generated';
|
|
6
7
|
type A2ATask = Record<string, any>;
|
|
@@ -418,6 +419,8 @@ export interface SingleAgentClientConfig extends ConversationConfig {
|
|
|
418
419
|
* violates an exclusion for `ladbible.com`.
|
|
419
420
|
*/
|
|
420
421
|
productPropertyPolicy?: ClientProductPropertyPolicy | false;
|
|
422
|
+
/** Opt in to computed, evidence-bearing external collection path annotations on product discovery. */
|
|
423
|
+
supplyPathVerification?: ProductSupplyPathOptions;
|
|
421
424
|
};
|
|
422
425
|
/** Governance configuration for buyer-side campaign governance */
|
|
423
426
|
governance?: import('./GovernanceTypes').GovernanceConfig;
|
|
@@ -835,6 +838,8 @@ export declare class SingleAgentClient {
|
|
|
835
838
|
* ```
|
|
836
839
|
*/
|
|
837
840
|
getProducts(params: CanonicalGetProductsRequest, inputHandler?: InputHandler, options?: CanonicalReadTaskOptions): Promise<TaskResult<CanonicalGetProductsResponse>>;
|
|
841
|
+
/** Discover products through the compact AdCP 3.2 catalog task. */
|
|
842
|
+
listProducts(params: ListProductsRequest, inputHandler?: InputHandler, options?: TaskOptions): Promise<TaskResult<ListProductsResponseWithSupplyPath>>;
|
|
838
843
|
/** @deprecated Explicit raw-wire escape hatch for migration tooling. */
|
|
839
844
|
getProductsLegacy(params: GetProductsRequest, inputHandler?: InputHandler, options?: TaskOptions): Promise<TaskResult<GetProductsResponse>>;
|
|
840
845
|
/**
|
|
@@ -34,6 +34,7 @@ __export(SingleAgentClient_exports, {
|
|
|
34
34
|
createSingleAgentClient: () => createSingleAgentClient
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(SingleAgentClient_exports);
|
|
37
|
+
var import_products = require('../supply-path/products.js');
|
|
37
38
|
var import_zod = require("zod");
|
|
38
39
|
var import_node_crypto = require("node:crypto");
|
|
39
40
|
var schemas = __toESM(require('../types/schemas.generated.js'));
|
|
@@ -3037,7 +3038,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3037
3038
|
this.rememberProductPolicyRequestParams(taskType, context.productPolicyRequest, result, resumedOptions);
|
|
3038
3039
|
}
|
|
3039
3040
|
this.rememberLegacyFormatConverter(taskType, finalizerLegacyFormatConverter, result, resumedOptions);
|
|
3040
|
-
result = await this.applyProductPropertyPolicy(result, taskType, context.productPolicyRequest);
|
|
3041
|
+
result = await this.applyProductPropertyPolicy(result, taskType, context.productPolicyRequest, options?.signal);
|
|
3041
3042
|
(0, import_abort2.throwIfAborted)(options?.signal);
|
|
3042
3043
|
if (context.canonical) {
|
|
3043
3044
|
if (result.status === "completed" && result.success && result.data) {
|
|
@@ -3087,13 +3088,21 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3087
3088
|
if (result.submitted && rawSubmittedWaitForCompletion) {
|
|
3088
3089
|
result.submitted = {
|
|
3089
3090
|
...result.submitted,
|
|
3090
|
-
waitForCompletion: async (pollInterval, signal) =>
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3091
|
+
waitForCompletion: async (pollInterval, signal) => {
|
|
3092
|
+
const signals = [options?.signal, signal].filter(
|
|
3093
|
+
(candidate) => candidate !== void 0
|
|
3094
|
+
);
|
|
3095
|
+
const completionSignal = signals.length > 1 ? AbortSignal.any(signals) : signals[0];
|
|
3096
|
+
const completionOptions = { ...options ?? {}, ...completionSignal ? { signal: completionSignal } : {} };
|
|
3097
|
+
const completed = await rawSubmittedWaitForCompletion(pollInterval, signal);
|
|
3098
|
+
return this.finalizeTaskResult(
|
|
3099
|
+
completed,
|
|
3100
|
+
context,
|
|
3101
|
+
completed.success && completed.status === "completed" ? completionOptions : options,
|
|
3102
|
+
transformCompletedResponse,
|
|
3103
|
+
finalizerLegacyFormatConverter
|
|
3104
|
+
);
|
|
3105
|
+
}
|
|
3097
3106
|
};
|
|
3098
3107
|
}
|
|
3099
3108
|
const finalized = (0, import_match.attachMatch)(result);
|
|
@@ -3483,8 +3492,21 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3483
3492
|
];
|
|
3484
3493
|
return result;
|
|
3485
3494
|
}
|
|
3486
|
-
async applyProductPropertyPolicy(result, taskType, requestParams) {
|
|
3495
|
+
async applyProductPropertyPolicy(result, taskType, requestParams, taskSignal) {
|
|
3487
3496
|
result = this.enforceProductPricingOptions(result, taskType);
|
|
3497
|
+
if (this.config.validation?.supplyPathVerification && (taskType === "get_products" || taskType === "list_products") && result.success && result.status === "completed" && result.data) {
|
|
3498
|
+
const data = result.data;
|
|
3499
|
+
if (Array.isArray(data.products)) {
|
|
3500
|
+
const configured = this.config.validation.supplyPathVerification;
|
|
3501
|
+
const signals = [configured.signal, taskSignal].filter((signal2) => signal2 !== void 0);
|
|
3502
|
+
const signal = signals.length > 1 ? AbortSignal.any(signals) : signals[0];
|
|
3503
|
+
const products = await (0, import_products.annotateProductsSupplyPaths)(data.products, this.agent.agent_uri, {
|
|
3504
|
+
...configured,
|
|
3505
|
+
...signal ? { signal } : {}
|
|
3506
|
+
});
|
|
3507
|
+
result = { ...result, data: { ...result.data, products } };
|
|
3508
|
+
}
|
|
3509
|
+
}
|
|
3488
3510
|
const policyConfig = this.config.validation?.productPropertyPolicy;
|
|
3489
3511
|
if (policyConfig === false || taskType !== "get_products") return result;
|
|
3490
3512
|
if (!result.success || result.status !== "completed" || !result.data) return result;
|
|
@@ -3644,7 +3666,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3644
3666
|
);
|
|
3645
3667
|
}
|
|
3646
3668
|
rememberProductPolicyRequestState(taskType, requestState, result, options) {
|
|
3647
|
-
if (taskType !== "get_products")
|
|
3669
|
+
if (taskType !== "get_products" && !(taskType === "list_products" && this.config.validation?.supplyPathVerification))
|
|
3670
|
+
return;
|
|
3648
3671
|
if (result.status !== "submitted" && result.status !== "working") return;
|
|
3649
3672
|
const keys = /* @__PURE__ */ new Set();
|
|
3650
3673
|
if (result.metadata.taskId) keys.add(result.metadata.taskId);
|
|
@@ -3700,7 +3723,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3700
3723
|
}
|
|
3701
3724
|
}
|
|
3702
3725
|
wrapProductPolicySubmittedContinuation(result, taskType, requestParams, options) {
|
|
3703
|
-
if (taskType !== "get_products" || result.status !== "submitted" || !result.submitted)
|
|
3726
|
+
if (taskType !== "get_products" && !(taskType === "list_products" && this.config.validation?.supplyPathVerification) || result.status !== "submitted" || !result.submitted)
|
|
3727
|
+
return result;
|
|
3704
3728
|
const submitted = result.submitted;
|
|
3705
3729
|
const policyState = {
|
|
3706
3730
|
request: productPolicyRequestSnapshot(requestParams)
|
|
@@ -3723,7 +3747,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3723
3747
|
return await this.applyProductPropertyPolicyToTaskInfo(
|
|
3724
3748
|
taskInfo,
|
|
3725
3749
|
taskType,
|
|
3726
|
-
policyState.request ?? {}
|
|
3750
|
+
policyState.request ?? {},
|
|
3751
|
+
options?.signal
|
|
3727
3752
|
);
|
|
3728
3753
|
} finally {
|
|
3729
3754
|
if (terminal) {
|
|
@@ -3742,7 +3767,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3742
3767
|
return await this.applyProductPropertyPolicy(
|
|
3743
3768
|
completed,
|
|
3744
3769
|
taskType,
|
|
3745
|
-
policyState.request ?? {}
|
|
3770
|
+
policyState.request ?? {},
|
|
3771
|
+
signal ?? options?.signal
|
|
3746
3772
|
);
|
|
3747
3773
|
} finally {
|
|
3748
3774
|
if (terminal) {
|
|
@@ -3758,8 +3784,9 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3758
3784
|
};
|
|
3759
3785
|
return result;
|
|
3760
3786
|
}
|
|
3761
|
-
async applyProductPropertyPolicyToTaskInfo(taskInfo, taskType, requestParams) {
|
|
3762
|
-
if (taskType !== "get_products" || taskInfo.status !== "completed" || !taskInfo.result)
|
|
3787
|
+
async applyProductPropertyPolicyToTaskInfo(taskInfo, taskType, requestParams, taskSignal) {
|
|
3788
|
+
if (taskType !== "get_products" && !(taskType === "list_products" && this.config.validation?.supplyPathVerification) || taskInfo.status !== "completed" || !taskInfo.result)
|
|
3789
|
+
return taskInfo;
|
|
3763
3790
|
const policyResult = await this.applyProductPropertyPolicy(
|
|
3764
3791
|
(0, import_match.attachMatch)({
|
|
3765
3792
|
success: true,
|
|
@@ -3777,7 +3804,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3777
3804
|
debug_logs: []
|
|
3778
3805
|
}),
|
|
3779
3806
|
taskType,
|
|
3780
|
-
requestParams
|
|
3807
|
+
requestParams,
|
|
3808
|
+
taskSignal
|
|
3781
3809
|
);
|
|
3782
3810
|
if (policyResult.success) {
|
|
3783
3811
|
return { ...taskInfo, result: policyResult.data };
|
|
@@ -3802,7 +3830,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3802
3830
|
return state.request;
|
|
3803
3831
|
}
|
|
3804
3832
|
async applyProductPropertyPolicyToWebhookResult(result, metadata) {
|
|
3805
|
-
if (metadata.task_type !== "get_products" || metadata.status !== "completed" || !result) {
|
|
3833
|
+
if (metadata.task_type !== "get_products" && !(metadata.task_type === "list_products" && this.config.validation?.supplyPathVerification) || metadata.status !== "completed" || !result) {
|
|
3806
3834
|
return { result, metadata, suppressHandler: false };
|
|
3807
3835
|
}
|
|
3808
3836
|
const policyResult = await this.applyProductPropertyPolicy(
|
|
@@ -4029,6 +4057,16 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4029
4057
|
projectionCatalogs
|
|
4030
4058
|
);
|
|
4031
4059
|
}
|
|
4060
|
+
/** Discover products through the compact AdCP 3.2 catalog task. */
|
|
4061
|
+
async listProducts(params, inputHandler, options) {
|
|
4062
|
+
return this.executeAndHandle(
|
|
4063
|
+
"list_products",
|
|
4064
|
+
"onListProductsStatusChange",
|
|
4065
|
+
params,
|
|
4066
|
+
inputHandler,
|
|
4067
|
+
options
|
|
4068
|
+
);
|
|
4069
|
+
}
|
|
4032
4070
|
/** @deprecated Explicit raw-wire escape hatch for migration tooling. */
|
|
4033
4071
|
async getProductsLegacy(params, inputHandler, options) {
|
|
4034
4072
|
return this.executeTaskUnprojected("get_products", params, inputHandler, options);
|
|
@@ -4884,6 +4922,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4884
4922
|
switch (taskName) {
|
|
4885
4923
|
case "get_products":
|
|
4886
4924
|
return this.getProducts(params, inputHandler, options);
|
|
4925
|
+
case "list_products":
|
|
4926
|
+
return this.listProducts(params, inputHandler, options);
|
|
4887
4927
|
case "create_media_buy":
|
|
4888
4928
|
return await this.createMediaBuy(
|
|
4889
4929
|
params,
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
annotateProductsSupplyPaths
|
|
3
|
+
} from "../supply-path/products.mjs";
|
|
1
4
|
import { z } from "zod";
|
|
2
5
|
import { randomUUID } from "node:crypto";
|
|
3
6
|
import * as schemas from "../types/schemas.generated.mjs";
|
|
@@ -3091,7 +3094,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3091
3094
|
this.rememberProductPolicyRequestParams(taskType, context.productPolicyRequest, result, resumedOptions);
|
|
3092
3095
|
}
|
|
3093
3096
|
this.rememberLegacyFormatConverter(taskType, finalizerLegacyFormatConverter, result, resumedOptions);
|
|
3094
|
-
result = await this.applyProductPropertyPolicy(result, taskType, context.productPolicyRequest);
|
|
3097
|
+
result = await this.applyProductPropertyPolicy(result, taskType, context.productPolicyRequest, options?.signal);
|
|
3095
3098
|
throwIfAborted(options?.signal);
|
|
3096
3099
|
if (context.canonical) {
|
|
3097
3100
|
if (result.status === "completed" && result.success && result.data) {
|
|
@@ -3141,13 +3144,21 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3141
3144
|
if (result.submitted && rawSubmittedWaitForCompletion) {
|
|
3142
3145
|
result.submitted = {
|
|
3143
3146
|
...result.submitted,
|
|
3144
|
-
waitForCompletion: async (pollInterval, signal) =>
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3147
|
+
waitForCompletion: async (pollInterval, signal) => {
|
|
3148
|
+
const signals = [options?.signal, signal].filter(
|
|
3149
|
+
(candidate) => candidate !== void 0
|
|
3150
|
+
);
|
|
3151
|
+
const completionSignal = signals.length > 1 ? AbortSignal.any(signals) : signals[0];
|
|
3152
|
+
const completionOptions = { ...options ?? {}, ...completionSignal ? { signal: completionSignal } : {} };
|
|
3153
|
+
const completed = await rawSubmittedWaitForCompletion(pollInterval, signal);
|
|
3154
|
+
return this.finalizeTaskResult(
|
|
3155
|
+
completed,
|
|
3156
|
+
context,
|
|
3157
|
+
completed.success && completed.status === "completed" ? completionOptions : options,
|
|
3158
|
+
transformCompletedResponse,
|
|
3159
|
+
finalizerLegacyFormatConverter
|
|
3160
|
+
);
|
|
3161
|
+
}
|
|
3151
3162
|
};
|
|
3152
3163
|
}
|
|
3153
3164
|
const finalized = attachMatch(result);
|
|
@@ -3537,8 +3548,21 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3537
3548
|
];
|
|
3538
3549
|
return result;
|
|
3539
3550
|
}
|
|
3540
|
-
async applyProductPropertyPolicy(result, taskType, requestParams) {
|
|
3551
|
+
async applyProductPropertyPolicy(result, taskType, requestParams, taskSignal) {
|
|
3541
3552
|
result = this.enforceProductPricingOptions(result, taskType);
|
|
3553
|
+
if (this.config.validation?.supplyPathVerification && (taskType === "get_products" || taskType === "list_products") && result.success && result.status === "completed" && result.data) {
|
|
3554
|
+
const data = result.data;
|
|
3555
|
+
if (Array.isArray(data.products)) {
|
|
3556
|
+
const configured = this.config.validation.supplyPathVerification;
|
|
3557
|
+
const signals = [configured.signal, taskSignal].filter((signal2) => signal2 !== void 0);
|
|
3558
|
+
const signal = signals.length > 1 ? AbortSignal.any(signals) : signals[0];
|
|
3559
|
+
const products = await annotateProductsSupplyPaths(data.products, this.agent.agent_uri, {
|
|
3560
|
+
...configured,
|
|
3561
|
+
...signal ? { signal } : {}
|
|
3562
|
+
});
|
|
3563
|
+
result = { ...result, data: { ...result.data, products } };
|
|
3564
|
+
}
|
|
3565
|
+
}
|
|
3542
3566
|
const policyConfig = this.config.validation?.productPropertyPolicy;
|
|
3543
3567
|
if (policyConfig === false || taskType !== "get_products") return result;
|
|
3544
3568
|
if (!result.success || result.status !== "completed" || !result.data) return result;
|
|
@@ -3698,7 +3722,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3698
3722
|
);
|
|
3699
3723
|
}
|
|
3700
3724
|
rememberProductPolicyRequestState(taskType, requestState, result, options) {
|
|
3701
|
-
if (taskType !== "get_products")
|
|
3725
|
+
if (taskType !== "get_products" && !(taskType === "list_products" && this.config.validation?.supplyPathVerification))
|
|
3726
|
+
return;
|
|
3702
3727
|
if (result.status !== "submitted" && result.status !== "working") return;
|
|
3703
3728
|
const keys = /* @__PURE__ */ new Set();
|
|
3704
3729
|
if (result.metadata.taskId) keys.add(result.metadata.taskId);
|
|
@@ -3754,7 +3779,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3754
3779
|
}
|
|
3755
3780
|
}
|
|
3756
3781
|
wrapProductPolicySubmittedContinuation(result, taskType, requestParams, options) {
|
|
3757
|
-
if (taskType !== "get_products" || result.status !== "submitted" || !result.submitted)
|
|
3782
|
+
if (taskType !== "get_products" && !(taskType === "list_products" && this.config.validation?.supplyPathVerification) || result.status !== "submitted" || !result.submitted)
|
|
3783
|
+
return result;
|
|
3758
3784
|
const submitted = result.submitted;
|
|
3759
3785
|
const policyState = {
|
|
3760
3786
|
request: productPolicyRequestSnapshot(requestParams)
|
|
@@ -3777,7 +3803,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3777
3803
|
return await this.applyProductPropertyPolicyToTaskInfo(
|
|
3778
3804
|
taskInfo,
|
|
3779
3805
|
taskType,
|
|
3780
|
-
policyState.request ?? {}
|
|
3806
|
+
policyState.request ?? {},
|
|
3807
|
+
options?.signal
|
|
3781
3808
|
);
|
|
3782
3809
|
} finally {
|
|
3783
3810
|
if (terminal) {
|
|
@@ -3796,7 +3823,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3796
3823
|
return await this.applyProductPropertyPolicy(
|
|
3797
3824
|
completed,
|
|
3798
3825
|
taskType,
|
|
3799
|
-
policyState.request ?? {}
|
|
3826
|
+
policyState.request ?? {},
|
|
3827
|
+
signal ?? options?.signal
|
|
3800
3828
|
);
|
|
3801
3829
|
} finally {
|
|
3802
3830
|
if (terminal) {
|
|
@@ -3812,8 +3840,9 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3812
3840
|
};
|
|
3813
3841
|
return result;
|
|
3814
3842
|
}
|
|
3815
|
-
async applyProductPropertyPolicyToTaskInfo(taskInfo, taskType, requestParams) {
|
|
3816
|
-
if (taskType !== "get_products" || taskInfo.status !== "completed" || !taskInfo.result)
|
|
3843
|
+
async applyProductPropertyPolicyToTaskInfo(taskInfo, taskType, requestParams, taskSignal) {
|
|
3844
|
+
if (taskType !== "get_products" && !(taskType === "list_products" && this.config.validation?.supplyPathVerification) || taskInfo.status !== "completed" || !taskInfo.result)
|
|
3845
|
+
return taskInfo;
|
|
3817
3846
|
const policyResult = await this.applyProductPropertyPolicy(
|
|
3818
3847
|
attachMatch({
|
|
3819
3848
|
success: true,
|
|
@@ -3831,7 +3860,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3831
3860
|
debug_logs: []
|
|
3832
3861
|
}),
|
|
3833
3862
|
taskType,
|
|
3834
|
-
requestParams
|
|
3863
|
+
requestParams,
|
|
3864
|
+
taskSignal
|
|
3835
3865
|
);
|
|
3836
3866
|
if (policyResult.success) {
|
|
3837
3867
|
return { ...taskInfo, result: policyResult.data };
|
|
@@ -3856,7 +3886,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
3856
3886
|
return state.request;
|
|
3857
3887
|
}
|
|
3858
3888
|
async applyProductPropertyPolicyToWebhookResult(result, metadata) {
|
|
3859
|
-
if (metadata.task_type !== "get_products" || metadata.status !== "completed" || !result) {
|
|
3889
|
+
if (metadata.task_type !== "get_products" && !(metadata.task_type === "list_products" && this.config.validation?.supplyPathVerification) || metadata.status !== "completed" || !result) {
|
|
3860
3890
|
return { result, metadata, suppressHandler: false };
|
|
3861
3891
|
}
|
|
3862
3892
|
const policyResult = await this.applyProductPropertyPolicy(
|
|
@@ -4083,6 +4113,16 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4083
4113
|
projectionCatalogs
|
|
4084
4114
|
);
|
|
4085
4115
|
}
|
|
4116
|
+
/** Discover products through the compact AdCP 3.2 catalog task. */
|
|
4117
|
+
async listProducts(params, inputHandler, options) {
|
|
4118
|
+
return this.executeAndHandle(
|
|
4119
|
+
"list_products",
|
|
4120
|
+
"onListProductsStatusChange",
|
|
4121
|
+
params,
|
|
4122
|
+
inputHandler,
|
|
4123
|
+
options
|
|
4124
|
+
);
|
|
4125
|
+
}
|
|
4086
4126
|
/** @deprecated Explicit raw-wire escape hatch for migration tooling. */
|
|
4087
4127
|
async getProductsLegacy(params, inputHandler, options) {
|
|
4088
4128
|
return this.executeTaskUnprojected("get_products", params, inputHandler, options);
|
|
@@ -4938,6 +4978,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4938
4978
|
switch (taskName) {
|
|
4939
4979
|
case "get_products":
|
|
4940
4980
|
return this.getProducts(params, inputHandler, options);
|
|
4981
|
+
case "list_products":
|
|
4982
|
+
return this.listProducts(params, inputHandler, options);
|
|
4941
4983
|
case "create_media_buy":
|
|
4942
4984
|
return await this.createMediaBuy(
|
|
4943
4985
|
params,
|
|
@@ -11,11 +11,15 @@ export declare class AdAgentsRedirectRefusedError extends Error {
|
|
|
11
11
|
}
|
|
12
12
|
export type AdAgentsRedirectPolicy = {
|
|
13
13
|
mode: 'none';
|
|
14
|
+
} | {
|
|
15
|
+
mode: 'same-origin';
|
|
16
|
+
originUrl: string;
|
|
17
|
+
maxRedirects?: number;
|
|
14
18
|
} | {
|
|
15
19
|
mode: 'same-registrable-domain';
|
|
16
20
|
originUrl: string;
|
|
17
21
|
maxRedirects?: number;
|
|
18
22
|
};
|
|
19
|
-
export declare function ssrfSafeFetchAdAgents(url: string, options: SsrfFetchOptions, policy: AdAgentsRedirectPolicy): Promise<SsrfFetchResult>;
|
|
23
|
+
export declare function ssrfSafeFetchAdAgents(url: string, options: SsrfFetchOptions, policy: AdAgentsRedirectPolicy, onResponse?: (response: SsrfFetchResult) => void): Promise<SsrfFetchResult>;
|
|
20
24
|
export declare function validateSameRegistrableDomainRedirect(originUrl: string, currentUrl: string, nextUrl: string): void;
|
|
21
25
|
export declare function sameRegistrableDomain(a: URL, b: URL): boolean;
|
|
@@ -11,11 +11,15 @@ export declare class AdAgentsRedirectRefusedError extends Error {
|
|
|
11
11
|
}
|
|
12
12
|
export type AdAgentsRedirectPolicy = {
|
|
13
13
|
mode: 'none';
|
|
14
|
+
} | {
|
|
15
|
+
mode: 'same-origin';
|
|
16
|
+
originUrl: string;
|
|
17
|
+
maxRedirects?: number;
|
|
14
18
|
} | {
|
|
15
19
|
mode: 'same-registrable-domain';
|
|
16
20
|
originUrl: string;
|
|
17
21
|
maxRedirects?: number;
|
|
18
22
|
};
|
|
19
|
-
export declare function ssrfSafeFetchAdAgents(url: string, options: SsrfFetchOptions, policy: AdAgentsRedirectPolicy): Promise<SsrfFetchResult>;
|
|
23
|
+
export declare function ssrfSafeFetchAdAgents(url: string, options: SsrfFetchOptions, policy: AdAgentsRedirectPolicy, onResponse?: (response: SsrfFetchResult) => void): Promise<SsrfFetchResult>;
|
|
20
24
|
export declare function validateSameRegistrableDomainRedirect(originUrl: string, currentUrl: string, nextUrl: string): void;
|
|
21
25
|
export declare function sameRegistrableDomain(a: URL, b: URL): boolean;
|
|
@@ -41,13 +41,14 @@ class AdAgentsRedirectRefusedError extends Error {
|
|
|
41
41
|
this.location = meta.location;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
async function ssrfSafeFetchAdAgents(url, options, policy) {
|
|
44
|
+
async function ssrfSafeFetchAdAgents(url, options, policy, onResponse) {
|
|
45
45
|
let currentUrl = url;
|
|
46
46
|
let redirects = 0;
|
|
47
|
-
const originUrl = policy.mode
|
|
48
|
-
const maxRedirects = policy.mode
|
|
47
|
+
const originUrl = policy.mode !== "none" ? policy.originUrl : url;
|
|
48
|
+
const maxRedirects = policy.mode !== "none" ? policy.maxRedirects ?? DEFAULT_WELL_KNOWN_REDIRECT_HOPS : 0;
|
|
49
49
|
while (true) {
|
|
50
50
|
const result = await (0, import_ssrf_fetch.ssrfSafeFetch)(currentUrl, options);
|
|
51
|
+
onResponse?.(result);
|
|
51
52
|
if (!REDIRECT_STATUSES.has(result.status)) return result;
|
|
52
53
|
const location = result.headers["location"];
|
|
53
54
|
if (!location) {
|
|
@@ -87,6 +88,12 @@ async function ssrfSafeFetchAdAgents(url, options, policy) {
|
|
|
87
88
|
{ url: currentUrl, location: scrubUrl(next) }
|
|
88
89
|
);
|
|
89
90
|
}
|
|
91
|
+
if (policy.mode === "same-origin" && new URL(originUrl).origin !== next.origin) {
|
|
92
|
+
throw new AdAgentsRedirectRefusedError("redirect_refused", "Authoritative evidence redirect changed origin", {
|
|
93
|
+
url: currentUrl,
|
|
94
|
+
location: scrubUrl(next)
|
|
95
|
+
});
|
|
96
|
+
}
|
|
90
97
|
validateSameRegistrableDomainRedirect(originUrl, currentUrl, nextUrl);
|
|
91
98
|
redirects++;
|
|
92
99
|
currentUrl = nextUrl;
|