@adcp/sdk 12.0.2 → 12.0.4
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/index.d.mts +2 -2
- package/dist/lib/index.d.ts +2 -2
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +2 -0
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +3 -1
- package/dist/lib/index.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/adcp-server.d.ts.map +1 -1
- package/dist/lib/server/adcp-server.js +18 -0
- package/dist/lib/server/adcp-server.js.map +1 -1
- package/dist/lib/server/adcp-server.mjs +15 -0
- package/dist/lib/server/adcp-server.mjs.map +1 -1
- package/dist/lib/server/create-adcp-server.d.mts +11 -0
- package/dist/lib/server/create-adcp-server.d.ts +11 -0
- package/dist/lib/server/create-adcp-server.d.ts.map +1 -1
- package/dist/lib/server/create-adcp-server.js +21 -0
- package/dist/lib/server/create-adcp-server.js.map +1 -1
- package/dist/lib/server/create-adcp-server.mjs +26 -0
- package/dist/lib/server/create-adcp-server.mjs.map +1 -1
- package/dist/lib/server/index.d.mts +2 -0
- package/dist/lib/server/index.d.ts +2 -0
- package/dist/lib/server/index.d.ts.map +1 -1
- package/dist/lib/server/index.js +3 -0
- package/dist/lib/server/index.js.map +1 -1
- package/dist/lib/server/index.mjs +2 -0
- package/dist/lib/server/index.mjs.map +1 -1
- package/dist/lib/server/mcp-app.d.mts +57 -0
- package/dist/lib/server/mcp-app.d.ts +58 -0
- package/dist/lib/server/mcp-app.d.ts.map +1 -0
- package/dist/lib/server/mcp-app.js +110 -0
- package/dist/lib/server/mcp-app.js.map +1 -0
- package/dist/lib/server/mcp-app.mjs +83 -0
- package/dist/lib/server/mcp-app.mjs.map +1 -0
- package/dist/lib/server/mcp-modern-server.d.ts.map +1 -1
- package/dist/lib/server/mcp-modern-server.js +23 -1
- package/dist/lib/server/mcp-modern-server.js.map +1 -1
- package/dist/lib/server/mcp-modern-server.mjs +24 -1
- package/dist/lib/server/mcp-modern-server.mjs.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/docs/guides/BUILD-AN-AGENT.md +70 -0
- package/package.json +1 -1
package/dist/lib/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/index.ts"],"sourcesContent":["// AdCP Client Library - Main Exports\n// A comprehensive type-safe client library for the AdContext Protocol\n\n// ====== REGISTRY LOOKUPS ======\nexport {\n RegistryClient,\n RegistrySync,\n PropertyRegistry,\n InMemoryCursorStore,\n FileCursorStore,\n buildCommunityMirrorAdagents,\n} from './registry';\nexport type {\n RegistrySyncConfig,\n RegistrySyncState,\n RegistrySyncTransport,\n RegistrySyncEvents,\n AgentFilter,\n RegistrySyncProperty,\n CursorStore,\n PropertyRegistryConfig,\n FeedStreamQuery,\n FeedStreamMessage,\n FeedHeartbeat,\n FeedStreamErrorData,\n OpenFeedStreamOptions,\n FeedFreshness,\n} from './registry';\nexport {\n openFeedStream,\n parseSseStream,\n sanitizeStreamText,\n DEFAULT_MAX_SSE_FRAME_BYTES,\n FeedStreamError,\n FeedStreamUnsupportedError,\n FeedStreamCursorExpiredError,\n FeedStreamHttpError,\n FeedStreamParseError,\n} from './registry';\nexport type {\n ResolvedBrand,\n BrandHierarchyResolution,\n BrandHierarchyBulkResolution,\n ResolveBrandHierarchyOptions,\n ResolvedProperty as ResolvedRegistryProperty,\n PropertyInfo,\n RegistryClientConfig,\n SaveBrandRequest,\n SaveBrandResponse,\n BrandLogoReviewStatus,\n ApprovedBrandLogoAsset,\n PendingBrandLogoAsset,\n ReviewedBrandLogoAsset,\n BrandLogoAsset,\n ListBrandLogosOptions,\n ListBrandLogosResponse,\n SaveBrandLogoInput,\n SaveBrandLogoResponse,\n UploadBrandLogoInput,\n UploadBrandLogoResponse,\n SavePropertyIdentity,\n RegistryPropertyIdentity,\n SavePropertyRequest,\n SavePropertyResponse,\n ResolveIdentifiersRequest,\n ResolveIdentifiersResponse,\n FileCatalogDisputeRequest,\n FileCatalogDisputeResponse,\n GetCatalogDisputeResponse,\n BrandRegistryItem,\n PropertyRegistryItem,\n ValidationResult as RegistryValidationResult,\n FederatedAgentWithDetails,\n FederatedPublisher,\n DomainLookupResult,\n ListBrandsOptions,\n ListBrandsResponse,\n GetBrandJsonResponse,\n ListOptions,\n ListAgentsOptions,\n ListAgentsResponse,\n ListPublishersResponse,\n ValidateAdagentsRequest,\n ValidateAdagentsResponse,\n CreateAdagentsRequest,\n CreateAdagentsResponse,\n AdagentsAuthorizedAgent,\n AdagentsCatalogFormat,\n AdagentsPlacementDefinition,\n AdagentsPlacementFormatReference,\n AdagentsPlacementFormatOption,\n AdagentsPlacementTag,\n CreatedAdagentsJson,\n CommunityMirrorAdagentsConfig,\n CreateCommunityMirrorAdagentsConfig,\n CommunityMirrorAdagentsCatalog,\n PublishCommunityMirrorAdagentsResponse,\n CommunityMirrorAdagentsSummary,\n ListCommunityMirrorAdagentsResponse,\n GetCommunityMirrorAdagentsResponse,\n PublishCommunityMirrorAdagentsRequest,\n PublishCommunityMirrorAdagentsError,\n DeleteCommunityMirrorAdagentsResponse,\n PublisherPropertySelector,\n CompanySearchResult,\n FindCompanyResult,\n ManagerRevalidationRequest,\n ManagerRevalidationResponse,\n ListPoliciesQuery,\n ListPoliciesResponse,\n ResolvePolicyQuery,\n ResolvePolicyResponse,\n ResolvePoliciesBulkRequest,\n ResolvePoliciesBulkResponse,\n GetPolicyHistoryQuery,\n GetPolicyHistoryResponse,\n SavePolicyRequest,\n SavePolicyResponse,\n GetBrandHistoryQuery,\n GetBrandHistoryResponse,\n GetPropertyHistoryQuery,\n GetPropertyHistoryResponse,\n RegistryFeedEvent,\n AgentEventPayload,\n PropertyEventPayload,\n CollectionEventPayload,\n AuthorizationEventPayload,\n PublisherEventPayload,\n BrandEventPayload,\n CatalogBrowseResponse,\n CatalogBrowseEntry,\n CatalogSyncResponse,\n CatalogSyncEntry,\n AgentCompliance,\n AgentComplianceDetail,\n StoryboardStatus,\n OperatorLookupResult,\n PublisherLookupResult,\n ComplianceChangedPayload,\n GetAgentStoryboardStatusResponse,\n GetAgentStoryboardStatusBulkResponse,\n} from './registry';\n\n// ====== BRAND JSON HELPERS ======\nexport {\n COMMON_LOGO_SLOTS,\n applyBrandAssetMappings,\n checkLogoSlotCoverage,\n extractBrandWebsiteAliasDomains,\n extractBrandWebsiteAliases,\n selectLogoForSlot,\n updateBrandJsonFromMappings,\n validateBrandAssetMappings,\n} from './brand';\nexport type {\n AppliedBrandAssetMapping,\n ApplyBrandAssetMappingsOptions,\n ApplyBrandAssetMappingsResult,\n BrandAssetCandidate,\n BrandAssetCropBox,\n BrandAssetExtractionMethod,\n BrandAssetMapping,\n BrandAssetMappingIssue,\n BrandAssetMappingTarget,\n BrandAssetMappingValidationResult,\n BrandAssetReviewStatus,\n BrandWebsiteAlias,\n BrandWebsiteAliasRelationship,\n BrandWebsiteAliasSource,\n BrandJsonRecord,\n BrandLogoBackground,\n BrandLogoOrientation,\n BrandLogoProposal,\n BrandLogoVariant,\n ExtractBrandWebsiteAliasesOptions,\n LogoSelectionOptions,\n LogoSlotCoverage,\n LogoSlotCoverageOptions,\n ResolveBrandAssetUrl,\n SkippedBrandAssetMapping,\n UpdateBrandJsonFromMappingsOptions,\n UpdateBrandJsonFromMappingsResult,\n} from './brand';\n\n// ====== PROPERTY DISCOVERY (AdCP v2.2.0) ======\nexport {\n PropertyIndex,\n getPropertyIndex,\n resetPropertyIndex,\n type PropertyMatch,\n type AgentAuthorization,\n} from './discovery/property-index';\nexport {\n PropertyCrawler,\n type AgentInfo,\n type CrawlResult,\n type PropertyCrawlerConfig,\n} from './discovery/property-crawler';\nexport {\n NetworkConsistencyChecker,\n type NetworkConsistencyCheckerConfig,\n type NetworkCheckReport,\n type CheckSummary,\n type CheckProgress,\n type OrphanedPointer,\n type StalePointer,\n type MissingPointer,\n type SchemaError,\n type AgentHealthResult,\n type DomainDetail,\n type DomainStatus,\n} from './discovery/network-consistency-checker';\nexport type {\n Property,\n PropertyIdentifier,\n PropertyIdentifierType,\n PropertyType,\n AdAgentsJson,\n AuthorizedAgent,\n AuthorizationType,\n // Aliased: the registry types also export a `PublisherPropertySelector`\n // (registry-flat shape with no `selection_type` discriminator). The\n // adagents.json schema's variant is a discriminated union, so we\n // expose it under a distinct name to avoid clobbering the registry\n // type that's been part of the public API longer.\n PublisherPropertySelector as AdAgentsPublisherPropertySelector,\n SinglePublisherPropertySelector,\n CompactPublisherPropertySelector,\n} from './discovery/types';\nexport {\n parsePublisherPropertySelector,\n expandPublisherPropertySelector,\n expandPublisherPropertySelectors,\n isCompactPublisherPropertySelector,\n publisherDomainsCoveredBySelectors,\n PublisherPropertySelectorParseError,\n type PublisherPropertySelectorError,\n} from './discovery/publisher-property-selector';\nexport {\n resolveAgentProperties,\n listAgentPropertyMap,\n getAllProperties,\n canonicalizeAgentUrl,\n type ResolvedAgentScope,\n type ResolveUnresolvableReason,\n} from './discovery/resolve-agent-properties';\nexport {\n resolveInlinePublisherProperties,\n resolveSingularInline,\n detectInlineFederatedDivergence,\n type InlineResolutionResult,\n type InlineFederatedDivergence,\n} from './discovery/inline-publisher-properties';\nexport {\n fetchAgentAuthorizationsFromDirectory,\n type AgentAuthorizationsIterator,\n type FetchAgentAuthorizationsOptions,\n type DirectoryLookupPage,\n type DirectoryPublisherEntry,\n type DirectoryDiscoveryMethod,\n type DirectoryPublisherStatus,\n} from './discovery/agent-directory';\nexport {\n validateAdAgents,\n parseManagerDomain,\n type DiscoveryMethod,\n type AdAgentsValidationResult,\n type ValidateAdAgentsOptions,\n} from './discovery/validate-adagents';\n\n// ====== CORE CONVERSATION-AWARE CLIENTS ======\n// New conversation-aware clients with input handler pattern\nexport {\n SingleAgentClient,\n WebhookDispatchError,\n createSingleAgentClient,\n UnsupportedFeatureError,\n} from './core/SingleAgentClient';\nexport type {\n ClientProductPropertyPolicy,\n SingleAgentClientConfig,\n VerifyAndParseWebhookOptions,\n WebhookParseErrorCode,\n WebhookParseFailure,\n WebhookParseResult,\n WebhookParseSuccess,\n} from './core/SingleAgentClient';\nexport {\n AgentClient,\n type TaskResponseTypeMap,\n type AdcpTaskName,\n type InProcessAgentClientConfig,\n} from './core/AgentClient';\nexport { ADCPMultiAgentClient, createADCPMultiAgentClient } from './core/ADCPMultiAgentClient';\nexport { ConfigurationManager } from './core/ConfigurationManager';\nexport {\n CreativeAgentClient,\n createCreativeAgentClient,\n STANDARD_CREATIVE_AGENTS,\n type CreativeFormat,\n type CreativeAgentClientConfig,\n} from './core/CreativeAgentClient';\nexport { TaskExecutor } from './core/TaskExecutor';\nexport { match, attachMatch } from './core/match';\nexport type { MatchHandlers, PartialMatchHandlers } from './core/match';\nexport { ProtocolResponseParser, responseParser, ADCP_STATUS, type ADCPStatus } from './core/ProtocolResponseParser';\nexport {\n ResponseValidator,\n responseValidator,\n type ValidationResult,\n type ValidationOptions,\n} from './core/ResponseValidator';\n// ====== CONVERSATION TYPES ======\nexport type {\n Message,\n InputRequest,\n InputHandler,\n InputHandlerResponse,\n ConversationContext,\n TaskOptions,\n WebhookToolPredicate,\n WebhookUrlTemplate,\n TaskResult,\n TaskResultCompleted,\n TaskResultIntermediate,\n TaskResultFailure,\n TaskResultMetadata,\n TaskState,\n TaskStatus,\n ConversationConfig,\n AdcpErrorInfo,\n AdcpValidationIssue,\n} from './core/ConversationTypes';\n\n// ====== GOVERNANCE ======\n// Buyer-side: GovernanceConfig + GovernanceMiddleware handle check → execute → report automatically.\n// Seller-side: GovernanceAdapter runs committed checks before executing media buys.\n// Types: GovernanceCheckResult, GovernanceOutcome are attached to TaskResult when governance is active.\n\n// Buyer-side middleware types\nexport type {\n GovernanceConfig,\n CampaignGovernanceConfig,\n GovernanceCheckResult,\n GovernanceOutcome,\n GovernanceFinding,\n GovernanceCondition,\n GovernanceEscalation,\n} from './core/GovernanceTypes';\nexport { GovernanceMiddleware } from './core/GovernanceMiddleware';\nexport type { GovernanceDebugEntry } from './core/GovernanceMiddleware';\n\n// ====== GOVERNANCE PLAN HELPERS ======\n// Invariants the schema encodes via if/then / oneOf that generated types\n// typically drop: budget reallocation autonomy and regulated-vertical\n// human review under GDPR Art 22 / EU AI Act Annex III.\nexport {\n buildHumanReviewPlan,\n buildHumanOverride,\n validateGovernancePlan,\n REGULATED_HUMAN_REVIEW_CATEGORIES,\n ANNEX_III_POLICY_IDS,\n} from './governance';\n\n// ====== NETWORKING / SSRF GUARDS ======\n// Public so adopters can converge on the SDK's DNS-pinning and address\n// classification behavior instead of copying partial guards. Use\n// `ssrfSafeFetch` as the security boundary; address classifiers are advisory\n// helpers and do not protect raw fetches from DNS rebinding.\nexport {\n ssrfSafeFetch,\n decodeBodyAsJsonOrText,\n SSRF_TRANSIENT_CODES,\n SsrfRefusedError,\n isPrivateIp,\n isAlwaysBlocked,\n isLikelyPrivateUrl,\n type SsrfRefusedCode,\n type SsrfFetchOptions,\n type SsrfFetchResult,\n} from './net';\n\n// ====== CANONICAL REFERENCE RESOLUTION ======\n// Safe, structured resolver for AdCP 3.1 `format_schema` and\n// `platform_extensions` URI+SHA-256 references.\nexport {\n createCanonicalReferenceCache,\n createCanonicalReferenceResolver,\n canonicalReferenceCacheKey,\n resolveCanonicalReference,\n resolveFormatSchemaReference,\n resolvePlatformExtensionsReference,\n type CanonicalReference,\n type CanonicalReferenceCache,\n type CanonicalReferenceError,\n type CanonicalReferenceErrorCode,\n type CanonicalReferenceFailureResult,\n type CanonicalReferenceKind,\n type CanonicalReferenceResolveOptions,\n type CanonicalReferenceResolvedResult,\n type CanonicalReferenceResolver,\n type CanonicalReferenceResolverOptions,\n type CanonicalReferenceResult,\n type CanonicalReferenceStatus,\n type ExternalRefDigestMap,\n type FormatSchemaReferenceResolvedResult,\n type FormatSchemaReferenceResult,\n type PlatformExtensionsReferenceResult,\n} from './canonical-references';\nexport type {\n BuildHumanReviewPlanInput,\n BuildHumanOverrideInput,\n DataSubjectContestation,\n GovernancePlan,\n GovernanceValidationIssue,\n HumanOverride,\n PlanBudget,\n ReallocationAutonomy,\n} from './governance';\n\n// ====== TASK EVENT TYPES ======\nexport type {\n BaseTaskEvent,\n ProtocolRequestEvent,\n ProtocolResponseEvent,\n TaskStatusEvent,\n ObjectEvent,\n TaskEvent,\n TaskEventCallbacks,\n} from './core/TaskEventTypes';\nexport { createOperationId } from './core/TaskEventTypes';\n\n// ====== ASYNC HANDLER ======\nexport type {\n AsyncHandlerConfig,\n WebhookMetadata,\n Activity,\n NotificationMetadata,\n MediaBuyDeliveryNotification,\n CreateMediaBuyStatusChangeHandler,\n UpdateMediaBuyStatusChangeHandler,\n SyncCreativesStatusChangeHandler,\n GetProductsStatusChangeHandler,\n} from './core/AsyncHandler';\nexport { AsyncHandler, createAsyncHandler } from './core/AsyncHandler';\n\n// ====== WHOLESALE FEED WEBHOOKS ======\nexport {\n normalizeWholesaleFeedWebhookNotification,\n parseWholesaleFeedWebhookNotification,\n WholesaleFeedWebhookNotificationError,\n} from './wholesale-feed-sync/webhook-notification';\nexport type {\n NormalizedWholesaleFeedWebhookNotification,\n WholesaleFeedWebhookAffectedEntityType,\n WholesaleFeedWebhookCacheScope,\n WholesaleFeedWebhookNotificationErrorCode,\n WholesaleFeedWebhookNotificationErrorDetails,\n WholesaleFeedWebhookNotificationType,\n} from './wholesale-feed-sync/webhook-notification';\n\n// ====== INPUT HANDLERS ======\nexport * from './handlers/types';\n\n// ====== STORAGE INTERFACES ======\nexport type {\n Storage,\n BatchStorage,\n PatternStorage,\n AgentCapabilities,\n ConversationState,\n DeferredTaskState,\n StorageConfig,\n StorageFactory,\n StorageMiddleware,\n} from './storage/interfaces';\nexport { MemoryStorage, createMemoryStorage, createMemoryStorageConfig } from './storage/MemoryStorage';\n\n// ====== ERROR CLASSES ======\nexport {\n ADCPError,\n TaskTimeoutError,\n MaxClarificationError,\n DeferredTaskError,\n TaskAbortedError,\n AgentNotFoundError,\n UnsupportedTaskError,\n ProtocolError,\n ValidationError as ADCPValidationError, // Rename to avoid conflict\n MissingInputHandlerError,\n InvalidContextError,\n ConfigurationError,\n AuthenticationRequiredError,\n FeatureUnsupportedError,\n ProtocolFeatureUnsupportedError,\n SDK_ERROR_TO_PROTOCOL_ERROR_CODE,\n VersionUnsupportedError,\n IdempotencyConflictError,\n IdempotencyExpiredError,\n ResponseTooLargeError,\n ActionNotAllowedError,\n adcpErrorToTypedError,\n getClientPreflightAdcpError,\n isADCPError,\n isErrorOfType,\n extractErrorInfo,\n is401Error,\n mapSdkErrorCodeToProtocolErrorCode,\n} from './errors';\nexport type {\n OAuthMetadataInfo,\n ClientPreflightAdcpErrorInfo,\n ClientPreflightAdcpErrorRecovery,\n FeatureUnsupportedErrorOptions,\n ProtocolFeatureUnsupportedErrorOptions,\n ActionNotAllowedErrorDetails,\n ActionNotAllowedReasonValue,\n ActionNotAllowedAttemptedAction,\n ActionNotAllowedAvailableAction,\n ActionNotAllowedRecovery,\n} from './errors';\n\n// ====== MEDIA BUY ACTIONS (AdCP 3.1 / RFC #4480) ======\n// Wire-shape action types are generated; helper result/context types live in\n// the media-buy helper module.\nexport type {\n ActionNotAllowedDetails,\n ActionNotAllowedReason,\n AvailableActionsResult,\n AvailableActionsSource,\n DecomposedUpdateMediaBuy,\n DecomposedUpdateMediaBuyMutation,\n LegacyCoarseAction,\n MediaBuyActionContext,\n MediaBuyActionMode,\n MediaBuyAvailableAction,\n MediaBuyMutationDirection,\n MediaBuyMutationScope,\n MediaBuyValidAction,\n ModeMismatchRecovery,\n PreflightAllowed,\n PreflightDenial,\n PreflightDenied,\n BuyerPropertyPolicy,\n NormalizedPolicyDomain,\n ProductPolicyProductLike,\n ProductPropertyPolicyDiagnostic,\n ProductPropertyPolicyDiagnosticCode,\n ProductPropertyPolicyDiagnosticSeverity,\n ProductPropertyPolicyMode,\n ProductPropertyPolicySelectorBehavior,\n ProductPropertyPolicyValidationResult,\n PreflightResult,\n ResolvedAction,\n SLAWindow,\n SlaWindow,\n ValidateProductsAgainstPropertyPolicyOptions,\n UpdateFieldEntry,\n UpdateMediaBuyRequestLike,\n} from './media-buy';\nexport {\n ACTIONS_BY_FIELD,\n LEGACY_COARSE_ACTIONS,\n UPDATE_FIELDS_BY_ACTION,\n canAddPackages,\n canCancel,\n canDecreaseBudget,\n canExtendFlight,\n canIncreaseBudget,\n canPause,\n canReallocateBudget,\n canRemoveCreative,\n canRemovePackages,\n canReplaceCreative,\n canResume,\n canShortenFlight,\n canUpdateCreativeAssignments,\n canUpdateFlightDates,\n canUpdateFrequencyCaps,\n canUpdatePacing,\n canUpdateTargeting,\n decomposeUpdateMediaBuy,\n findAvailableAction,\n getActionForMutation,\n getAvailableActions,\n getRollupParent,\n ProductPropertyPolicyError,\n normalizeDomainForPropertyPolicy,\n preflightUpdateMediaBuy,\n recoveryForModeMismatch,\n validateProductsAgainstPropertyPolicy,\n} from './media-buy';\nexport { InputRequiredError } from './core/TaskExecutor';\n\n// ====== IDEMPOTENCY ======\nexport {\n generateIdempotencyKey,\n isMutatingTask,\n isValidIdempotencyKey,\n useIdempotencyKey,\n redactIdempotencyKey,\n IDEMPOTENCY_KEY_PATTERN,\n MUTATING_TASKS,\n} from './utils/idempotency';\nexport type { IdempotencyCapabilities } from './utils/capabilities';\nexport type { MutatingRequestInput } from './utils/idempotency';\nexport { canonicalize, canonicalJsonSha256 } from './utils/jcs';\nexport { rollupOptimizationMetricsFromProducts } from './utils/capability-rollups';\n\n// ====== CORE TYPES ======\nexport * from './types';\n\n// ====== TOOL TYPES ======\n// Request and response types for each AdCP tool.\n//\n// Naming convention:\n// {ToolName}Request -- parameters for a tool call (e.g., CreateMediaBuyRequest)\n// {ToolName}Response -- return value; often a union of {ToolName}Success | {ToolName}Error\n//\n// Nested domain types within requests use a Request suffix when the shape\n// differs from the response version:\n// PackageRequest -- creation-shaped (required: buyer_ref, product_id, budget, pricing_option_id)\n// Package -- response-shaped from core.generated (has package_id, most fields optional)\n//\n// Platform implementors: use Request types to type incoming tool calls,\n// Response types to shape your return values.\n// Runtime Zod schemas live at `@adcp/sdk/schemas` to keep ordinary root\n// imports from loading the generated schema declaration bundle.\nexport type {\n // Media Buy Domain\n GetProductsRequest,\n GetProductsResponse,\n ListCreativeFormatsRequest,\n ListCreativeFormatsResponse,\n CreateMediaBuyRequest,\n CreateMediaBuyResponse,\n CreateMediaBuySuccess,\n CreateMediaBuyError,\n CreateMediaBuySubmitted,\n UpdateMediaBuyRequest,\n UpdateMediaBuyResponse,\n UpdateMediaBuySuccess,\n UpdateMediaBuyError,\n SyncCreativesRequest,\n SyncCreativesResponse,\n SyncCreativesSuccess,\n SyncCreativesError,\n SyncCreativesSubmitted,\n SyncAudiencesRequest,\n SyncAudiencesResponse,\n SyncAudiencesSuccess,\n SyncAudiencesError,\n ListCreativesRequest,\n ListCreativesResponse,\n CreativeFilters,\n GetMediaBuyDeliveryRequest,\n GetMediaBuyDeliveryResponse,\n ProvidePerformanceFeedbackRequest,\n ProvidePerformanceFeedbackResponse,\n ProvidePerformanceFeedbackSuccess,\n ProvidePerformanceFeedbackError,\n // Signals Domain\n GetSignalsRequest,\n GetSignalsResponse,\n ActivateSignalRequest,\n ActivateSignalResponse,\n ActivateSignalSuccess,\n ActivateSignalError,\n CpmPricing,\n PercentOfMediaPricing,\n FlatFeePricing,\n PerUnitPricing,\n CustomPricing,\n VendorPricing,\n VendorPricingOption,\n // Pricing variants for products (publisher rate cards in get_products etc.)\n // PricingOption + CPAPricingOption are exported below near the other tool types.\n CPMPricingOption,\n VCPMPricingOption,\n CPCPricingOption,\n CPCVPricingOption,\n CPVPricingOption,\n CPPPricingOption,\n FlatRatePricingOption,\n TimeBasedPricingOption,\n // Governance Domain - Property Lists\n CreatePropertyListRequest,\n CreatePropertyListResponse,\n UpdatePropertyListRequest,\n UpdatePropertyListResponse,\n GetPropertyListRequest,\n GetPropertyListResponse,\n ListPropertyListsRequest,\n ListPropertyListsResponse,\n DeletePropertyListRequest,\n DeletePropertyListResponse,\n PropertyList,\n PropertyListFilters,\n // Governance Domain - Content Standards\n ListContentStandardsRequest,\n ListContentStandardsResponse,\n GetContentStandardsRequest,\n GetContentStandardsResponse,\n CreateContentStandardsRequest,\n CreateContentStandardsResponse,\n UpdateContentStandardsRequest,\n UpdateContentStandardsResponse,\n UpdateContentStandardsSuccess,\n UpdateContentStandardsError,\n CalibrateContentRequest,\n CalibrateContentResponse,\n ValidateContentDeliveryRequest,\n ValidateContentDeliveryResponse,\n ContentStandards,\n Artifact,\n // Governance Domain - Campaign Governance\n SyncPlansRequest,\n SyncPlansResponse,\n SyncGovernanceRequest,\n SyncGovernanceResponse,\n SyncGovernanceSuccess,\n SyncGovernanceError,\n CheckGovernanceRequest,\n CheckGovernanceResponse,\n ReportPlanOutcomeRequest,\n ReportPlanOutcomeResponse,\n GetPlanAuditLogsRequest,\n GetPlanAuditLogsResponse,\n // Governance Domain - Types & Enums\n PlannedDelivery,\n GovernancePhase,\n EscalationSeverity,\n PolicyEnforcementLevel,\n OutcomeType,\n // Governance Domain - Creative Features\n GetCreativeFeaturesRequest,\n GetCreativeFeaturesResponse,\n // Sponsored Intelligence Domain\n SIGetOfferingRequest,\n SIGetOfferingResponse,\n SIInitiateSessionRequest,\n SIInitiateSessionResponse,\n SISendMessageRequest,\n SISendMessageResponse,\n SITerminateSessionRequest,\n SITerminateSessionResponse,\n SICapabilities,\n SIIdentity,\n // Protocol Domain\n GetAdCPCapabilitiesRequest,\n GetAdCPCapabilitiesResponse,\n // Event Tracking Domain\n SyncEventSourcesRequest,\n SyncEventSourcesResponse,\n SyncEventSourcesSuccess,\n SyncEventSourcesError,\n LogEventRequest,\n LogEventResponse,\n LogEventSuccess,\n LogEventError,\n // Enums\n CanceledBy,\n // Core data structures used within requests and responses\n Format,\n Product,\n Proposal,\n ProductAllocation,\n PackageRequest, // Creation params for packages — not Package (response-shaped, from core.generated)\n CreativeAsset,\n CreativePolicy,\n BrandReference,\n BrandID,\n AccountReference,\n CPAPricingOption,\n EventType,\n ActionSource,\n OptimizationGoal,\n ReachUnit,\n TargetingOverlay,\n // 3.1.0-beta.2 renamed `OutcomeMeasurement` → `OutcomeMeasurementDeprecated`\n // to signal the surface is on the 4.0 removal track. Re-export under both\n // names so adopters' existing `import { OutcomeMeasurement }` keeps working.\n OutcomeMeasurementDeprecated,\n OutcomeMeasurementDeprecated as OutcomeMeasurement,\n Duration,\n DeviceType,\n DigitalSourceType,\n FrequencyCap,\n GeographicBreakdownSupport,\n // Catalog Domain\n Catalog,\n CatalogType,\n FeedFormat,\n UpdateFrequency,\n ContentIDType,\n CatalogFieldMapping,\n SyncCatalogsRequest,\n SyncCatalogsResponse,\n SyncCatalogsSuccess,\n SyncCatalogsError,\n // Format Assets\n Overlay,\n Placement,\n // Creative Agent Domain\n CreativeManifest,\n CreativeVariable,\n BuildCreativeRequest,\n BuildCreativeResponse,\n BuildCreativeSuccess,\n BuildCreativeMultiSuccess,\n BuildCreativeError,\n PreviewCreativeRequest,\n PreviewCreativeResponse,\n GetMediaBuysRequest,\n GetMediaBuysResponse,\n ImageAsset,\n VideoAsset,\n AudioAsset,\n TextAsset,\n URLAsset,\n HTMLAsset,\n VASTAsset,\n DAASTAsset,\n JavaScriptAsset,\n WebhookAsset,\n CSSAsset,\n MarkdownAsset,\n CatalogAsset,\n BriefAsset,\n ReferenceAsset,\n Provenance,\n PreviewOutputFormat,\n DisclosurePosition,\n // Event Tracking\n EventCustomData,\n // Creative Delivery Domain\n GetCreativeDeliveryRequest,\n GetCreativeDeliveryResponse,\n // Account Domain\n Account,\n ListAccountsRequest,\n ListAccountsResponse,\n SyncAccountsRequest,\n SyncAccountsResponse,\n SyncAccountsSuccess,\n SyncAccountsError,\n GetAccountFinancialsRequest,\n GetAccountFinancialsResponse,\n GetAccountFinancialsSuccess,\n GetAccountFinancialsError,\n // Pagination\n PaginationRequest,\n PaginationResponse,\n // Nested domain types used as fields within request/response objects\n PackageUpdate,\n Package,\n Destination,\n SignalFilters,\n PricingOption,\n PriceGuidance,\n} from './types/tools.generated';\nexport type {\n AccountStatus,\n CreativeStatus,\n DelegationAuthority,\n CatalogAction,\n CatalogItemStatus,\n MediaBuyStatus,\n // CreativeBrief is its own top-level schema (creative-brief.json) — emitted\n // in core.generated, no longer transitively pulled into tools.generated now\n // that BriefAsset merges its allOf[$ref] base inline.\n CreativeBrief,\n} from './types/core.generated';\n\n// ====== WELL-KNOWN FILE TYPES ======\n// brand.json / adagents.json shapes inferred from the canonical Zod schemas.\n// Re-exported explicitly here (in addition to the transitive `export * from\n// './types'` above) so the top-level public API contract is visible at the\n// main barrel and not dependent on the sub-barrel's wildcard re-export.\n// Source of truth: schemas/cache/{version}/{brand,adagents}.json — regenerate\n// with `npm run generate-wellknown-schemas` when the spec bumps.\nexport type { BrandJson, AdagentsJson } from './types/wellknown-schemas.generated';\nexport { BrandJsonSchema, AdagentsJsonSchema } from './types/wellknown-schemas.generated';\n\n// ====== ERROR CODES ======\n// Standard error code vocabulary for programmatic error handling\nexport type { Error as TaskErrorDetail } from './types/core.generated';\nexport { STANDARD_ERROR_CODES, isStandardErrorCode, getErrorRecovery } from './types/error-codes';\nexport type { StandardErrorCode, ErrorRecovery } from './types/error-codes';\n\n// ====== SERVER-SIDE HELPERS ======\n// Helpers for building AdCP-compliant MCP servers\nexport {\n adcpError,\n capabilitiesResponse,\n productsResponse,\n mediaBuyResponse,\n deliveryResponse,\n listAccountsResponse,\n listCreativeFormatsResponse,\n updateMediaBuyResponse,\n getMediaBuysResponse,\n performanceFeedbackResponse,\n buildCreativeResponse,\n buildCreativeMultiResponse,\n previewCreativeResponse,\n creativeDeliveryResponse,\n listCreativesResponse,\n listPropertyListsResponse,\n listCollectionListsResponse,\n listContentStandardsResponse,\n getPlanAuditLogsResponse,\n syncCreativesResponse,\n getSignalsResponse,\n activateSignalResponse,\n cancelMediaBuyResponse,\n acquireRightsResponse,\n acquireRightsAcquired,\n acquireRightsPendingApproval,\n acquireRightsRejected,\n syncAccountsResponse,\n syncGovernanceResponse,\n reportUsageResponse,\n validActionsForStatus,\n MEDIA_BUY_TRANSITIONS,\n CREATIVE_ASSET_TRANSITIONS,\n isLegalMediaBuyTransition,\n isLegalCreativeTransition,\n assertMediaBuyTransition,\n assertCreativeTransition,\n getAccountMode,\n isSandboxOrMockAccount,\n assertSandboxAccount,\n taskToolResponse,\n registerAdcpTaskTool,\n createTaskCapableServer,\n InMemoryTaskStore,\n isTerminal,\n serve,\n UnknownHostError,\n hostname,\n resolveHost,\n verifyIntrospection,\n registerTestController,\n handleTestControllerRequest,\n TestControllerError,\n toMcpResponse,\n TOOL_INPUT_SHAPE,\n CONTROLLER_SCENARIOS,\n DISCOVERY_ARM_SCENARIOS,\n SEED_SCENARIOS,\n SESSION_ENTRY_CAP,\n enforceMapCap,\n createSeedFixtureCache,\n PostgresTaskStore,\n cleanupExpiredTasks,\n getMcpTasksMigration,\n MCP_TASKS_MIGRATION,\n ADCP_PRE_TRANSPORT,\n checkGovernance,\n governanceDeniedError,\n DEFAULT_REPORTING_CAPABILITIES,\n InMemoryStateStore,\n PostgresStateStore,\n getAdcpStateMigration,\n ADCP_STATE_MIGRATION,\n StateError,\n PatchConflictError,\n SESSION_KEY_FIELD,\n createSessionedStore,\n scopedStore,\n patchWithRetry,\n isPutIfMatchConflict,\n requireSessionKey,\n structuredSerialize,\n structuredDeserialize,\n createIdempotencyStore,\n memoryBackend,\n pgBackend,\n getIdempotencyMigration,\n IDEMPOTENCY_MIGRATION,\n cleanupExpiredIdempotency,\n redisBackend,\n createLazyBackend,\n hashPayload,\n getServeRequestContext,\n ADCP_SERVE_REQUEST_CONTEXT,\n createA2AAdapter,\n A2AInvocationError,\n} from './server';\nexport type {\n AdcpErrorOptions,\n AdcpErrorResponse,\n McpToolResponse,\n ValidAction,\n CancelMediaBuyInput,\n AdcpTaskToolConfig,\n TaskStore,\n TaskMessageQueue,\n CreateTaskOptions,\n ToolTaskHandler,\n CreateTaskRequestHandlerExtra,\n TaskRequestHandlerExtra,\n CreateTaskResult,\n GetTaskResult,\n Task,\n ServeContext,\n ServeOptions,\n PgQueryable,\n PostgresTaskStoreOptions,\n TestControllerStore,\n TestControllerStoreFactory,\n TestControllerStoreOrFactory,\n ControllerScenario,\n SeedScenario,\n SeedFixtureCache,\n SessionContext,\n OnInstructionsError,\n MaybePromise,\n AdcpServerConfig,\n AdcpToolMap,\n AdcpServerToolName,\n AdcpCapabilitiesConfig,\n AdcpCustomToolConfig,\n McpAppUiMeta,\n McpAppMeta,\n AdcpLogger,\n HandlerContext,\n MediaBuyHandlers,\n SignalsHandlers,\n CreativeHandlers,\n GovernanceHandlers,\n AccountHandlers,\n EventTrackingHandlers,\n SponsoredIntelligenceHandlers,\n SignedRequestsConfig,\n AdcpPreTransport,\n AdcpServer,\n AdcpServerTransport,\n AdcpTestRequest,\n AdcpTestToolsCallRequest,\n AdcpTestResponse,\n CheckGovernanceOptions,\n GovernanceCallResult,\n GovernanceApproved,\n GovernanceDenied,\n GovernanceConditions,\n AdcpStateStore,\n ListOptions as StateListOptions,\n ListResult as StateListResult,\n PostgresStateStoreOptions,\n InMemoryStateStoreOptions,\n VersionedDocument,\n PutIfMatchResult,\n PatchWithRetryOptions,\n StateErrorCode,\n SessionKeyContext,\n IdempotencyStore,\n IdempotencyStoreConfig,\n IdempotencyBackend,\n IdempotencyCacheEntry,\n IdempotencyCheckResult,\n MemoryBackendOptions,\n PgBackendOptions,\n RedisBackendOptions,\n RedisBackendClient,\n RedisLikeClient,\n LazyBackendFactory,\n LazyBackendOptions,\n A2AAdapter,\n A2AAdapterOptions,\n A2AAgentCardOverrides,\n A2AMountOptions,\n ExpressAppLike,\n AccountMode,\n RequireCacheScopeWhenProducts,\n ServerPayload,\n ListCreativeFormatsPayload,\n ListCreativeFormatsResponsePayload,\n ListCreativeFormatsServerPayload,\n SyncCreativesPayload,\n SyncCreativesSuccessPayload,\n SyncCreativesErrorPayload,\n} from './server';\n\n// ====== ERROR HANDLING & RETRY ======\nexport { isRetryable, getRetryDelay } from './utils/retry';\nexport { decideRetry, BuyerRetryPolicy } from './utils/buyer-retry-policy';\nexport type { RetryDecision, RetryContext, RetryDecisionOverride } from './utils/buyer-retry-policy';\n\n// Public API: use these for programmatic error handling\nexport {\n extractAdcpErrorInfo,\n extractCorrelationId,\n resolveRecovery,\n getExpectedAction,\n} from './utils/error-extraction';\n\n// Internal: transport-level extraction (used by SDK internals; prefer result.adcpError instead)\nexport { extractAdcpErrorFromMcp, extractAdcpErrorFromTransport } from './utils/error-extraction';\nexport type { ExtractedAdcpError } from './utils/error-extraction';\nexport { extractVersionUnsupportedDetails } from './utils/error-extraction';\nexport type { VersionUnsupportedDetails } from './utils/error-extraction';\n\n// ====== BACKWARDS COMPATIBILITY ======\n// Deprecated types from past protocol migrations\nexport type {\n BrandManifest,\n BrandManifestReference,\n AssetContentType,\n PromotedProducts,\n PromotedOfferings,\n Measurement,\n} from './types/compat';\nexport { brandManifestToBrandReference, promotedProductsToCatalog, promotedOfferingsToCatalog } from './types/compat';\n\n// Request parameter normalization (deprecated field auto-conversion)\nexport { normalizeRequestParams, normalizePackageParams } from './utils/request-normalizer';\n\n// get_products response cache-scope helpers\nexport {\n ensureGetProductsCacheScope,\n validateGetProductsCacheScope,\n type EnsureGetProductsCacheScopeOptions,\n type GetProductsCacheScope,\n type GetProductsResponseWithCacheScope,\n type GetProductsCacheScopeValidation,\n} from './utils/get-products-cache-scope';\n\n// ====== ENUM VALUE ARRAYS ======\n// `${TypeName}Values` const arrays for every named string-literal union in\n// the spec. Consumers can enumerate or validate against these without\n// duplicating literal lists from the Zod unions.\nexport * from './types/enums.generated';\n\n// `${ParentSchema}_${PropertyName}Values` const arrays for inline\n// anonymous unions inside named schemas — e.g.\n// `ImageAssetRequirements_FormatsValues`,\n// `VideoAssetRequirements_ContainersValues`. Companion to enums.generated;\n// see scripts/generate-inline-enum-arrays.ts for naming + scoping rules.\nexport * from './types/inline-enums.generated';\n\n// PreviewCreativeRequestSchema is now a flat z.object() with request_type discriminant.\n// The old variant exports (PreviewCreativeSingleRequestSchema, etc.) are no longer needed —\n// use PreviewCreativeRequestSchema.shape directly with server.registerTool().\n\n// ====== AUTHENTICATION ======\n// Auth utilities for custom integrations\nexport { getAuthToken, createAdCPHeaders, createMCPAuthHeaders, createAuthenticatedFetch } from './auth';\n\n// OAuth diagnostics utilities (see src/lib/auth/oauth/diagnostics.ts)\nexport {\n parseWWWAuthenticate,\n decodeAccessTokenClaims,\n validateTokenAudience,\n type WWWAuthenticateChallenge,\n type DecodedJWTHeader,\n type DecodedJWTClaims,\n type DecodedAccessToken,\n type TokenAudienceResult,\n InvalidTokenError,\n InsufficientScopeError,\n} from './auth/oauth';\n\n// End-to-end OAuth handshake diagnosis — powers `adcp diagnose-auth`\nexport {\n runAuthDiagnosis,\n AUTH_DIAGNOSIS_SCHEMA_VERSION,\n type DiagnoseOptions,\n type HttpCapture as DiagnosisHttpCapture,\n type DiagnosisStep,\n type Hypothesis as DiagnosisHypothesis,\n type HypothesisVerdict as DiagnosisHypothesisVerdict,\n type AuthDiagnosisReport,\n} from './auth/oauth';\n\n// Zero-config OAuth: actionable error + discovery + file storage + per-agent binding\nexport {\n NeedsAuthorizationError,\n discoverAuthorizationRequirements,\n createFileOAuthStorage,\n bindAgentStorage,\n getAgentStorage,\n unbindAgentStorage,\n type AuthorizationRequirements,\n type DiscoverAuthorizationOptions,\n type FileOAuthStorageOptions,\n} from './auth/oauth';\n\n// OAuth 2.0 client credentials (RFC 6749 §4.4) — machine-to-machine token\n// exchange used by programmatic CC consumers and by the CLI's `--save-auth\n// --oauth-token-url ...` flow. The library call path pre-refreshes before\n// every request automatically when `AgentConfig.oauth_client_credentials`\n// is set; these symbols are exposed for consumers that need explicit\n// control (building custom AgentConfigs, testing, or implementing\n// server-side `save_agent` endpoints like Addie's).\nexport {\n exchangeClientCredentials,\n ensureClientCredentialsTokens,\n ClientCredentialsExchangeError,\n MissingEnvSecretError,\n resolveSecret,\n isEnvSecretReference,\n toEnvSecretReference,\n extractEnvSecretName,\n type ExchangeClientCredentialsOptions,\n type EnsureClientCredentialsOptions,\n type AgentOAuthClientCredentials,\n} from './auth/oauth';\n\n// ====== VALIDATION ======\n// Schema validation for requests/responses\nexport { validateAgentUrl, validateAdCPResponse, getExpectedSchema, handleAdCPResponse } from './validation';\n\n// ====== PROTOCOL CLIENTS ======\n// Low-level protocol clients for MCP and A2A (primarily for testing)\nexport {\n ProtocolClient,\n callMCPTool,\n callA2ATool,\n createMCPClient,\n createA2AClient,\n closeMCPConnections,\n closeOAuthConnections,\n bundleSupportsAdcpVersionField,\n sanitizeTransportHeaders,\n sanitizeTransportUrl,\n} from './protocols';\nexport { toReleasePrecisionWire, validateAdcpVersionWire } from './validation/schema-loader';\nexport type {\n CallToolOptions,\n TransportActivity,\n TransportActivityContext,\n TransportActivityHandler,\n TransportOptions,\n} from './protocols';\n\n// ====== WIRE VERSION HELPERS (NAMESPACE) ======\n// Grouped re-exports of the three AdCP `adcp_version` envelope helpers\n// (spec PR adcontextprotocol/adcp#3493). Prefer this surface over the\n// individual top-level exports — the namespace stays stable as helpers\n// are added (a fourth helper drops in here without churning the barrel).\n// The top-level exports are kept for back-compat and aren't deprecated.\nimport { bundleSupportsAdcpVersionField as _isSupported } from './protocols';\nimport { toReleasePrecisionWire as _normalize, validateAdcpVersionWire as _validate } from './validation/schema-loader';\nexport const wireVersion = {\n isSupported: _isSupported,\n normalize: _normalize,\n validate: _validate,\n} as const;\n\n// ====== RESPONSE UTILITIES ======\n// Public utilities for working with AdCP responses\nexport {\n getStandardFormats,\n unwrapProtocolResponse,\n isAdcpError,\n isAdcpSuccess,\n isTerminalAdcpError,\n hasAdvisorySuccessPayload,\n getAuthoritativeMediaBuyStatus,\n isMediaBuyStatus,\n resolveTaskState,\n} from './utils';\nexport type { EffectiveTaskState, ResolvedTaskState, ResolveTaskStateOptions } from './utils';\nexport { injectLegacyEnvelopeStatus } from './utils/envelope-status-compat';\nexport { extractResult, type ToolCallResultLike } from './utils';\nexport { REQUEST_TIMEOUT, MAX_CONCURRENT, STANDARD_FORMATS } from './utils';\nexport {\n batchPreviewProducts,\n batchPreviewFormats,\n clearPreviewCache,\n type PreviewResult,\n type BatchPreviewOptions,\n type PreviewCacheBackend,\n type PreviewCacheEntry,\n} from './utils';\nexport { detectProtocol, detectProtocolWithTimeout } from './utils';\nexport { A2A_CARD_PATHS, isAgentCardPath, isWellKnownAgentCardUrl, buildCardUrls, stripAgentCardPath } from './utils';\n\n// ====== PRICING UTILITIES ======\n// Pricing adapter for v2/v3 compatibility and CPA detection\nexport { isCPAPricing } from './utils';\n\n// ====== PAGINATION UTILITIES ======\n// Auto-pagination helpers for cursor-based AdCP endpoints\nexport { paginate, paginatePages, type PaginateOptions } from './utils';\n\n// ====== FORMAT ASSET UTILITIES ======\n// Access to format assets (v3 `assets` field)\nexport {\n getFormatAssets,\n getRequiredAssets,\n getOptionalAssets,\n getIndividualAssets,\n getRepeatableGroups,\n usesDeprecatedAssetsField,\n getAssetCount,\n hasAssets,\n} from './utils/format-assets';\n\n// ====== CREATIVE ASSET BUILDERS ======\n// Typed factories that inject the `asset_type` discriminator.\n// `imageAsset({ url, width, height })` returns a valid `ImageAsset`\n// without repeating `asset_type: 'image'` at every call site.\n// Prefer the named exports; use `Asset.image({...})` when constructing\n// several asset types together (assets-by-role manifests).\nexport {\n Asset,\n imageAsset,\n videoAsset,\n audioAsset,\n textAsset,\n urlAsset,\n htmlAsset,\n javascriptAsset,\n cssAsset,\n markdownAsset,\n webhookAsset,\n} from './utils/asset-builders';\n\n// ====== FORMAT ASSET SLOT BUILDERS ======\n// Typed factories for the slot definitions inside `Format.assets[]` — what a\n// seller/publisher declares it accepts. Each builder injects the `item_type`\n// and `asset_type` discriminators, and the `requirements` object is strictly\n// typed per asset_type: misnamed fields (`file_types` vs `formats`) and wrong\n// units (`min_duration_seconds` vs `min_duration_ms`) fail type-check.\n// Use `repeatableGroup({...})` (or `FormatAsset.group(...)`) to wrap assets\n// that repeat — that's the correct home for `min_count` / `max_count`.\nexport {\n FormatAsset,\n imageAssetSlot,\n videoAssetSlot,\n audioAssetSlot,\n textAssetSlot,\n markdownAssetSlot,\n htmlAssetSlot,\n cssAssetSlot,\n javascriptAssetSlot,\n vastAssetSlot,\n daastAssetSlot,\n urlAssetSlot,\n webhookAssetSlot,\n briefAssetSlot,\n catalogAssetSlot,\n repeatableGroup,\n imageGroupAsset,\n videoGroupAsset,\n audioGroupAsset,\n textGroupAsset,\n markdownGroupAsset,\n htmlGroupAsset,\n cssGroupAsset,\n javascriptGroupAsset,\n vastGroupAsset,\n daastGroupAsset,\n urlGroupAsset,\n webhookGroupAsset,\n} from './utils/format-asset-slot-builders';\n\n// ====== PREVIEW RENDER BUILDERS ======\n// Typed factories that inject the `output_format` discriminator on\n// `PreviewRender` objects. `urlRender({ render_id, preview_url, role })`\n// returns a valid url-variant render without repeating\n// `output_format: 'url'` at every call site. Matrix runs consistently\n// saw this drift: Claude emitted renders that omitted the discriminator\n// or its required sibling field.\nexport { Render, urlRender, htmlRender, bothRender } from './utils/render-builders';\n\n// ====== FORMAT RENDER BUILDERS ======\n// Typed factories for `Format.renders[]` entries on format declarations.\n// The item schema's `oneOf` forces a render to satisfy exactly one branch —\n// either `dimensions` (display/video) OR `parameters_from_format_id: true`\n// (audio, template formats). A render with only `{ role }` fails validation.\n// Audio specifically cannot use `{ role, duration_seconds }` — duration is\n// not a recognized `renders[]` field and wouldn't satisfy the oneOf anyway.\n// Use `parameterizedRender({ role })` (or the alias `templateRender`) so\n// format_id parameters carry duration.\n//\n// `FormatRender` below is the grouped namespace (value export). The v3\n// structural interface by the same name is re-exported from\n// `utils/format-renders` further down — TypeScript keeps type and value\n// namespaces separate, so both are available under the single import.\nexport {\n FormatRender,\n displayRender,\n parameterizedRender,\n templateRender,\n type DimensionsRender,\n type ParameterizedRender,\n type RenderItem,\n} from './utils/format-render-builders';\n\n// ====== CANONICAL CREATIVE FORMAT MIGRATION HELPERS ======\n// Author `Product.format_options[]`, v1 `format_id` references, and product\n// cards from one obvious namespace while migrating away from local Format.type\n// and product_card.format_id conventions.\nexport {\n CanonicalFormat,\n type CanonicalFormatDeclaration,\n type CanonicalFormatDeclarationFields,\n type CanonicalFormatKind,\n type CanonicalFormatParams,\n type FormatReferenceInput,\n type ProductCardDetailedFields,\n type ProductCardFields,\n} from './v2/projection';\n\nexport {\n augmentProductWithFormatOptions,\n withFormatOptions,\n toCanonicalOnlyProduct,\n toCanonicalOnlyResponse,\n packageRefsForCapabilities,\n legacyFormatIdsFromOptions,\n tryLegacyFormatIdsFromOptions,\n legacyFormatIdsForCapability,\n canonicalDeclarationFromBareId,\n resolveCanonicalFormatKind,\n CapabilityIdsLookupError,\n type BareFormatIdResolveOptions,\n type CanonicalOnlyProduct,\n type CapabilityIdsLookupErrorCode,\n type PackageFormatRefs,\n type ProjectionDiagnostic,\n type V1FormatId,\n type V1Product,\n type V2AugmentedProduct,\n type V2Product,\n type V2ProductFormatDeclaration,\n} from './v2/projection';\n\n// ====== ACTIVATION KEY BUILDERS ======\n// Typed factories that inject the `type` discriminator on `ActivationKey`.\n// SHAPE-GOTCHAS §1 — `key`/`value` flatten on the activation key itself.\nexport { activationKey, segmentIdActivationKey, keyValueActivationKey } from './utils/activation-key-builders';\n\n// ====== SIGNAL ID BUILDERS AND ACCESSORS ======\n// Typed factories that inject the `source` discriminator on `SignalID`.\n// Used in `signal_ids` filter arrays and as the `signal_id` provenance\n// field on every `Signal` returned by `get_signals`. SHAPE-GOTCHAS §2.\n// To read fields from a received `SignalID`, use `getSignalId` (segment id)\n// and `getSignalIssuer` (data_provider_domain or agent_url).\nexport { signalId, catalogSignalId, agentSignalId, getSignalId, getSignalIssuer } from './utils/signal-id-builders';\nexport {\n buildActivateSignalRequest,\n getSignalActivationId,\n getSignalPricingOptionIds,\n normalizeDiscoveredSignal,\n} from './utils/signal-discovery-helpers';\nexport type {\n BuildActivateSignalRequestOptions,\n DiscoveredSignal,\n NormalizedDiscoveredSignal,\n} from './utils/signal-discovery-helpers';\n\n// ====== BUILD CREATIVE RETURN BUILDERS ======\n// Typed factories for the four return shapes accepted by the framework\n// from `build_creative` handlers. `.single` / `.multi` emit bare manifests\n// the framework auto-wraps; `.singleEnveloped` / `.multiEnveloped` emit\n// the shaped envelope when the handler needs to attach `sandbox` /\n// `expires_at` / `preview`. SHAPE-GOTCHAS §5.\nexport {\n buildCreativeReturn,\n singleBuildCreativeReturn,\n multiBuildCreativeReturn,\n singleEnvelopedBuildCreativeReturn,\n multiEnvelopedBuildCreativeReturn,\n} from './utils/build-creative-return-builders';\n\n// ====== PREVIEW CREATIVE BUILDERS ======\n// Typed factories that inject the `response_type` discriminator on\n// `PreviewCreativeResponse`. Three-way oneOf — `single | batch | variant`.\n// Pair with `urlRender` / `htmlRender` / `bothRender` for the per-render\n// `output_format`. SHAPE-GOTCHAS §4.\nexport {\n previewCreative,\n singlePreviewCreativeResponse,\n batchPreviewCreativeResponse,\n variantPreviewCreativeResponse,\n} from './utils/preview-creative-builders';\n\n// ====== MEDIA BUY DELIVERY NOTIFICATION BUILDERS ======\n// Typed factories that inject the `notification_type` discriminator on\n// `GetMediaBuyDeliveryResponse` for webhook deliveries. Five variants:\n// `scheduled` / `final` / `delayed` / `adjusted` / `window_update`.\nexport {\n mediaBuyDeliveryNotification,\n scheduledMediaBuyDeliveryNotification,\n finalMediaBuyDeliveryNotification,\n delayedMediaBuyDeliveryNotification,\n adjustedMediaBuyDeliveryNotification,\n windowUpdateMediaBuyDeliveryNotification,\n} from './utils/media-buy-delivery-notification-builders';\n\n// ====== V3.0 COMPATIBILITY UTILITIES ======\n// Capabilities detection, version negotiation, and v3 enforcement.\n// See also:\n// - `VersionUnsupportedError` in errors — thrown by requireV3()/requireV3ForMutations\n// - `SyncCreativesItemSchema` in validation — per-item sync_creatives validator\n// - `ADCP_MAJOR_VERSION` / `COMPATIBLE_ADCP_VERSIONS` in version information\n// - `SingleAgentClient#requireV3()` / `AgentClient#requireV3()` — runtime gate\nexport {\n buildSyntheticCapabilities,\n buildSyntheticV3Capabilities,\n parseCapabilitiesResponse,\n supportsV3,\n supportsProtocol,\n supportsPropertyListFiltering,\n supportsContentStandards,\n supportsSyncCreatives,\n requiresOperatorAuth,\n requiresAccountForProducts,\n supportsSandbox,\n supportsExperimentalFeature,\n resolveFeature,\n listDeclaredFeatures,\n MEDIA_BUY_TOOLS,\n SIGNALS_TOOLS,\n GOVERNANCE_TOOLS,\n CREATIVE_TOOLS,\n EVENT_TRACKING_TOOLS,\n ACCOUNT_TOOLS,\n PROTOCOL_TOOLS,\n BRAND_RIGHTS_TOOLS,\n TASK_FEATURE_MAP,\n} from './utils/capabilities';\nexport type {\n AdcpCapabilities,\n AdcpMajorVersion,\n AdcpProtocol,\n AccountCapabilities,\n MediaBuyFeatures,\n ToolInfo,\n FeatureName,\n} from './utils/capabilities';\n\n// Buyer-side creative delivery helpers\nexport { inlineCreativesForPackages } from './utils/creative-delivery';\nexport type {\n InlineCreativeAssignment,\n InlineCreativePackage,\n InlineCreativePackagePatch,\n InlineCreativesForPackagesOptions,\n} from './utils/creative-delivery';\n\n// Creative assignment adapter (v2 creative_ids ↔ v3 creative_assignments)\nexport {\n adaptPackageRequestForV2,\n adaptCreateMediaBuyRequestForV2,\n adaptUpdateMediaBuyRequestForV2,\n normalizePackageResponse,\n normalizeMediaBuyResponse,\n usesV2CreativeIds,\n usesV3CreativeAssignments,\n getCreativeIds,\n getCreativeAssignments,\n} from './utils/creative-adapter';\nexport type { CreativeAssignment } from './utils/creative-adapter';\n\n// Format renders normalizer (v2 dimensions ↔ v3 renders)\nexport {\n normalizeFormatRenders,\n normalizeFormatsResponse,\n getFormatRenders,\n getPrimaryRender,\n getCompanionRenders,\n isMultiRenderFormat,\n usesV2Dimensions,\n usesV3Renders,\n getFormatDimensions,\n} from './utils/format-renders';\n// FormatRender (the v3 structural interface) was renamed to FormatRenderEntry\n// so the `FormatRender` name at the barrel becomes the factory namespace\n// exported from `./utils/format-render-builders` above. The deprecated type\n// alias `FormatRender = FormatRenderEntry` still lives in `utils/format-renders`\n// for callers importing the sub-module directly; it's not re-exported here.\nexport type { FormatRenderEntry, RenderDimensions } from './utils/format-renders';\n\n// Preview response normalizer (v2 output_id ↔ v3 render_id)\nexport {\n normalizePreviewRender,\n normalizePreview,\n normalizePreviewCreativeResponse,\n usesV2RenderFields,\n usesV3RenderFields,\n getRenderId,\n getRenderRole,\n getPrimaryPreviewRender,\n getPreviewUrl,\n getPreviewHtml,\n} from './utils/preview-normalizer';\nexport type { PreviewRenderV3 } from './utils/preview-normalizer';\n\n// ====== TYPE GUARD UTILITIES ======\n// Type guards for automatic TypeScript type narrowing in webhook handlers\nexport {\n // Generic status checks\n isStatusCompleted,\n isStatusWorking,\n isStatusInputRequired,\n isStatusSubmitted,\n isStatusFailed,\n isStatusRejected,\n // GetProducts type guards\n isGetProductsCompleted,\n isGetProductsWorking,\n isGetProductsInputRequired,\n isGetProductsSubmitted,\n isGetProductsFailed,\n // CreateMediaBuy type guards\n isCreateMediaBuyCompleted,\n isCreateMediaBuyWorking,\n isCreateMediaBuyInputRequired,\n isCreateMediaBuySubmitted,\n isCreateMediaBuyFailed,\n // UpdateMediaBuy type guards\n isUpdateMediaBuyCompleted,\n isUpdateMediaBuyWorking,\n isUpdateMediaBuyInputRequired,\n isUpdateMediaBuySubmitted,\n isUpdateMediaBuyFailed,\n // SyncCreatives type guards\n isSyncCreativesCompleted,\n isSyncCreativesWorking,\n isSyncCreativesInputRequired,\n isSyncCreativesSubmitted,\n isSyncCreativesFailed,\n} from './utils/typeGuards';\n\n// ====== VERSION INFORMATION ======\nexport {\n getAdcpVersion,\n getLibraryVersion,\n isCompatibleWith,\n getCompatibleVersions,\n parseAdcpMajorVersion,\n ADCP_VERSION,\n ADCP_MAJOR_VERSION,\n LIBRARY_VERSION,\n COMPATIBLE_ADCP_VERSIONS,\n VERSION_INFO,\n} from './version';\nexport type { AdcpVersion } from './version';\nexport { resolveAdcpVersion } from './utils/adcp-version-config';\n\n// ====== OBSERVABILITY ======\n// OpenTelemetry tracing utilities (no-op if @opentelemetry/api not installed)\nexport {\n getTracer,\n isTracingEnabled,\n injectTraceHeaders,\n withSpan,\n addSpanAttributes,\n recordSpanException,\n} from './observability';\n\n// ====== AGENT CLASSES ======\n// Primary agent interface - returns raw AdCP responses\nexport { Agent, AgentCollection } from './agents/index.generated';\n\n// ====== SERVER-SIDE ADAPTERS ======\n// Adapters for building AdCP servers with customizable business logic\nexport {\n // Content Standards\n ContentStandardsAdapter,\n type IContentStandardsAdapter,\n type ContentEvaluationResult,\n ContentStandardsErrorCodes,\n isContentStandardsError,\n defaultContentStandardsAdapter,\n // Property Lists\n PropertyListAdapter,\n type IPropertyListAdapter,\n type ResolvedProperty,\n PropertyListErrorCodes,\n isPropertyListError,\n defaultPropertyListAdapter,\n // Sponsored Intelligence Sessions\n SISessionManager,\n AISISessionManager,\n type ISISessionManager,\n type SISession,\n SIErrorCodes,\n defaultSISessionManager,\n // Governance (seller-side committed checks)\n GovernanceAdapter,\n defaultGovernanceAdapter,\n type IGovernanceAdapter,\n type GovernanceAdapterConfig,\n type GovernanceAdapterErrorCode,\n type CommittedCheckRequest,\n GovernanceAdapterErrorCodes,\n isGovernanceAdapterError,\n // Implicit Account Store (resolution: 'implicit') — Shape A reference adapter\n InMemoryImplicitAccountStore,\n defaultImplicitKeyFn,\n type ImplicitAccountStoreOptions,\n // OAuth pass-through resolver — Shape B accounts.resolve factory\n createOAuthPassthroughResolver,\n type OAuthPassthroughResolverOptions,\n // Roster-backed AccountStore — Shape C factory for publisher-curated explicit platforms\n createRosterAccountStore,\n type RosterAccountStoreOptions,\n // Derived AccountStore — Shape D factory for single-tenant `resolution: 'derived'` agents\n createDerivedAccountStore,\n type DerivedAccountStoreOptions,\n} from './adapters';\n\n// ====== BACKWARD COMPATIBILITY & ENVIRONMENT LOADING ======\n\nimport type { AgentConfig } from './types';\nimport { ADCPMultiAgentClient } from './core/ADCPMultiAgentClient';\n\n/**\n * Legacy AdCPClient alias for backward compatibility\n * @deprecated Use ADCPMultiAgentClient instead for new code\n */\nexport const AdCPClient = ADCPMultiAgentClient;\n\n// Legacy configuration manager maintained for backward compatibility\n// The enhanced ConfigurationManager is exported above\n\n/**\n * Legacy createAdCPClient function for backward compatibility\n * @deprecated Use new ADCPMultiAgentClient constructor instead\n */\nexport function createAdCPClient(agents?: AgentConfig[]): ADCPMultiAgentClient {\n return new AdCPClient(agents);\n}\n\n/**\n * Load agents from environment and create multi-agent client\n * @deprecated Use ADCPMultiAgentClient.fromEnv() instead\n */\nexport function createAdCPClientFromEnv(): ADCPMultiAgentClient {\n return ADCPMultiAgentClient.fromEnv();\n}\n\n// ====== SUBSTITUTION OBSERVER / ENCODER ======\n// Primitives backing the `substitution-observer-runner` test-kit contract.\n// Runners (conformance graders) import the observer side; sales/retail-\n// media agents implementing the #2620 catalog-item macro encoding rule\n// import `SubstitutionEncoder`. Re-exported here for discoverability;\n// the full surface is also available via `@adcp/sdk/substitution`.\nexport {\n SubstitutionObserver,\n SubstitutionEncoder,\n PreviewFetchError,\n MacroInRawValueError,\n CATALOG_MACRO_VECTORS,\n getCatalogMacroVector,\n extractTrackerUrls,\n matchBindings,\n assertRfc3986Safe,\n assertUnreservedOnly,\n assertNoNestedExpansion,\n assertSchemePreserved,\n DEFAULT_MACRO_PROHIBITED_PATTERN,\n enforceSsrfPolicy,\n enforceSsrfPolicyResolved,\n DEFAULT_SSRF_POLICY,\n encodeUnreserved,\n equalUnderHexCasePolicy,\n isUnreservedOnly,\n divergenceOffset,\n translateUniversalMacros,\n} from './substitution';\nexport type {\n ObserverFetchOptions,\n ObserverDispatcher,\n CatalogMacroVectorName,\n AssertionOptions as SubstitutionAssertionOptions,\n AssertionResult as SubstitutionAssertionResult,\n BindingMatch,\n CatalogBinding,\n CatalogMacroVector,\n PolicyResult as SubstitutionPolicyResult,\n SsrfPolicy,\n TrackerUrlRecord,\n MacroMapping,\n TranslateResult,\n} from './substitution';\n\n// ====== TEST HELPERS ======\n// Re-export test helpers for convenience (also available via @adcp/sdk/testing)\nexport {\n testAgent,\n testAgentA2A,\n testAgentClient,\n createTestAgent,\n TEST_AGENT_TOKEN,\n TEST_AGENT_MCP_CONFIG,\n TEST_AGENT_A2A_CONFIG,\n testAgentNoAuth,\n testAgentNoAuthA2A,\n TEST_AGENT_NO_AUTH_MCP_CONFIG,\n TEST_AGENT_NO_AUTH_A2A_CONFIG,\n creativeAgent,\n testBrandRightsFlow,\n hasBrandRightsTools,\n expectControllerError,\n expectControllerSuccess,\n RateLimitTripObserver,\n RATE_LIMIT_TRIP_CONTRACT,\n RATE_LIMIT_TRIP_DEFAULT_REPLAY_MAX_WAIT_SECONDS,\n RATE_LIMIT_TRIP_MAX_ATTEMPTS_MAX,\n RATE_LIMIT_TRIP_MAX_ATTEMPTS_MIN,\n validateRateLimitTripSpec,\n} from './testing/index';\nexport type {\n ControllerErrorWithDetail,\n TestClient,\n RateLimitTripSpec,\n RateLimitTripClient,\n RateLimitTripFailureCode,\n RateLimitTripObservation,\n RateLimitTripObserverOptions,\n RateLimitTripResponseSnapshot,\n RateLimitTripStructuredResult,\n RateLimitTripTaskOptions,\n} from './testing/index';\n"],"mappings":"AAIA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAiBP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA0GP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAgCP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,OAIK;AACP;AAAA,EACE;AAAA,OAYK;AAkBP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,OAOK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AAIP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAUP;AAAA,EACE;AAAA,OAIK;AACP,SAAS,sBAAsB,kCAAkC;AACjE,SAAS,4BAA4B;AACrC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,oBAAoB;AAC7B,SAAS,OAAO,mBAAmB;AAEnC,SAAS,wBAAwB,gBAAgB,mBAAoC;AACrF;AAAA,EACE;AAAA,EACA;AA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;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EAKA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EAGA;AAAA,EAGA;AAAA,EAGA;AAAA,OAEK;AAKP,SAAS,wBAAAA,6BAA4B;AAM9B,MAAM,aAAaA;AASnB,SAAS,iBAAiB,QAA8C;AAC7E,SAAO,IAAI,WAAW,MAAM;AAC9B;AAMO,SAAS,0BAAgD;AAC9D,SAAOA,sBAAqB,QAAQ;AACtC;AAQA;AAAA,EACE;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,OACK;AAmBP;AAAA,EACE;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,OACK;","names":["ADCPMultiAgentClient"]}
|
|
1
|
+
{"version":3,"sources":["../../src/lib/index.ts"],"sourcesContent":["// AdCP Client Library - Main Exports\n// A comprehensive type-safe client library for the AdContext Protocol\n\n// ====== REGISTRY LOOKUPS ======\nexport {\n RegistryClient,\n RegistrySync,\n PropertyRegistry,\n InMemoryCursorStore,\n FileCursorStore,\n buildCommunityMirrorAdagents,\n} from './registry';\nexport type {\n RegistrySyncConfig,\n RegistrySyncState,\n RegistrySyncTransport,\n RegistrySyncEvents,\n AgentFilter,\n RegistrySyncProperty,\n CursorStore,\n PropertyRegistryConfig,\n FeedStreamQuery,\n FeedStreamMessage,\n FeedHeartbeat,\n FeedStreamErrorData,\n OpenFeedStreamOptions,\n FeedFreshness,\n} from './registry';\nexport {\n openFeedStream,\n parseSseStream,\n sanitizeStreamText,\n DEFAULT_MAX_SSE_FRAME_BYTES,\n FeedStreamError,\n FeedStreamUnsupportedError,\n FeedStreamCursorExpiredError,\n FeedStreamHttpError,\n FeedStreamParseError,\n} from './registry';\nexport type {\n ResolvedBrand,\n BrandHierarchyResolution,\n BrandHierarchyBulkResolution,\n ResolveBrandHierarchyOptions,\n ResolvedProperty as ResolvedRegistryProperty,\n PropertyInfo,\n RegistryClientConfig,\n SaveBrandRequest,\n SaveBrandResponse,\n BrandLogoReviewStatus,\n ApprovedBrandLogoAsset,\n PendingBrandLogoAsset,\n ReviewedBrandLogoAsset,\n BrandLogoAsset,\n ListBrandLogosOptions,\n ListBrandLogosResponse,\n SaveBrandLogoInput,\n SaveBrandLogoResponse,\n UploadBrandLogoInput,\n UploadBrandLogoResponse,\n SavePropertyIdentity,\n RegistryPropertyIdentity,\n SavePropertyRequest,\n SavePropertyResponse,\n ResolveIdentifiersRequest,\n ResolveIdentifiersResponse,\n FileCatalogDisputeRequest,\n FileCatalogDisputeResponse,\n GetCatalogDisputeResponse,\n BrandRegistryItem,\n PropertyRegistryItem,\n ValidationResult as RegistryValidationResult,\n FederatedAgentWithDetails,\n FederatedPublisher,\n DomainLookupResult,\n ListBrandsOptions,\n ListBrandsResponse,\n GetBrandJsonResponse,\n ListOptions,\n ListAgentsOptions,\n ListAgentsResponse,\n ListPublishersResponse,\n ValidateAdagentsRequest,\n ValidateAdagentsResponse,\n CreateAdagentsRequest,\n CreateAdagentsResponse,\n AdagentsAuthorizedAgent,\n AdagentsCatalogFormat,\n AdagentsPlacementDefinition,\n AdagentsPlacementFormatReference,\n AdagentsPlacementFormatOption,\n AdagentsPlacementTag,\n CreatedAdagentsJson,\n CommunityMirrorAdagentsConfig,\n CreateCommunityMirrorAdagentsConfig,\n CommunityMirrorAdagentsCatalog,\n PublishCommunityMirrorAdagentsResponse,\n CommunityMirrorAdagentsSummary,\n ListCommunityMirrorAdagentsResponse,\n GetCommunityMirrorAdagentsResponse,\n PublishCommunityMirrorAdagentsRequest,\n PublishCommunityMirrorAdagentsError,\n DeleteCommunityMirrorAdagentsResponse,\n PublisherPropertySelector,\n CompanySearchResult,\n FindCompanyResult,\n ManagerRevalidationRequest,\n ManagerRevalidationResponse,\n ListPoliciesQuery,\n ListPoliciesResponse,\n ResolvePolicyQuery,\n ResolvePolicyResponse,\n ResolvePoliciesBulkRequest,\n ResolvePoliciesBulkResponse,\n GetPolicyHistoryQuery,\n GetPolicyHistoryResponse,\n SavePolicyRequest,\n SavePolicyResponse,\n GetBrandHistoryQuery,\n GetBrandHistoryResponse,\n GetPropertyHistoryQuery,\n GetPropertyHistoryResponse,\n RegistryFeedEvent,\n AgentEventPayload,\n PropertyEventPayload,\n CollectionEventPayload,\n AuthorizationEventPayload,\n PublisherEventPayload,\n BrandEventPayload,\n CatalogBrowseResponse,\n CatalogBrowseEntry,\n CatalogSyncResponse,\n CatalogSyncEntry,\n AgentCompliance,\n AgentComplianceDetail,\n StoryboardStatus,\n OperatorLookupResult,\n PublisherLookupResult,\n ComplianceChangedPayload,\n GetAgentStoryboardStatusResponse,\n GetAgentStoryboardStatusBulkResponse,\n} from './registry';\n\n// ====== BRAND JSON HELPERS ======\nexport {\n COMMON_LOGO_SLOTS,\n applyBrandAssetMappings,\n checkLogoSlotCoverage,\n extractBrandWebsiteAliasDomains,\n extractBrandWebsiteAliases,\n selectLogoForSlot,\n updateBrandJsonFromMappings,\n validateBrandAssetMappings,\n} from './brand';\nexport type {\n AppliedBrandAssetMapping,\n ApplyBrandAssetMappingsOptions,\n ApplyBrandAssetMappingsResult,\n BrandAssetCandidate,\n BrandAssetCropBox,\n BrandAssetExtractionMethod,\n BrandAssetMapping,\n BrandAssetMappingIssue,\n BrandAssetMappingTarget,\n BrandAssetMappingValidationResult,\n BrandAssetReviewStatus,\n BrandWebsiteAlias,\n BrandWebsiteAliasRelationship,\n BrandWebsiteAliasSource,\n BrandJsonRecord,\n BrandLogoBackground,\n BrandLogoOrientation,\n BrandLogoProposal,\n BrandLogoVariant,\n ExtractBrandWebsiteAliasesOptions,\n LogoSelectionOptions,\n LogoSlotCoverage,\n LogoSlotCoverageOptions,\n ResolveBrandAssetUrl,\n SkippedBrandAssetMapping,\n UpdateBrandJsonFromMappingsOptions,\n UpdateBrandJsonFromMappingsResult,\n} from './brand';\n\n// ====== PROPERTY DISCOVERY (AdCP v2.2.0) ======\nexport {\n PropertyIndex,\n getPropertyIndex,\n resetPropertyIndex,\n type PropertyMatch,\n type AgentAuthorization,\n} from './discovery/property-index';\nexport {\n PropertyCrawler,\n type AgentInfo,\n type CrawlResult,\n type PropertyCrawlerConfig,\n} from './discovery/property-crawler';\nexport {\n NetworkConsistencyChecker,\n type NetworkConsistencyCheckerConfig,\n type NetworkCheckReport,\n type CheckSummary,\n type CheckProgress,\n type OrphanedPointer,\n type StalePointer,\n type MissingPointer,\n type SchemaError,\n type AgentHealthResult,\n type DomainDetail,\n type DomainStatus,\n} from './discovery/network-consistency-checker';\nexport type {\n Property,\n PropertyIdentifier,\n PropertyIdentifierType,\n PropertyType,\n AdAgentsJson,\n AuthorizedAgent,\n AuthorizationType,\n // Aliased: the registry types also export a `PublisherPropertySelector`\n // (registry-flat shape with no `selection_type` discriminator). The\n // adagents.json schema's variant is a discriminated union, so we\n // expose it under a distinct name to avoid clobbering the registry\n // type that's been part of the public API longer.\n PublisherPropertySelector as AdAgentsPublisherPropertySelector,\n SinglePublisherPropertySelector,\n CompactPublisherPropertySelector,\n} from './discovery/types';\nexport {\n parsePublisherPropertySelector,\n expandPublisherPropertySelector,\n expandPublisherPropertySelectors,\n isCompactPublisherPropertySelector,\n publisherDomainsCoveredBySelectors,\n PublisherPropertySelectorParseError,\n type PublisherPropertySelectorError,\n} from './discovery/publisher-property-selector';\nexport {\n resolveAgentProperties,\n listAgentPropertyMap,\n getAllProperties,\n canonicalizeAgentUrl,\n type ResolvedAgentScope,\n type ResolveUnresolvableReason,\n} from './discovery/resolve-agent-properties';\nexport {\n resolveInlinePublisherProperties,\n resolveSingularInline,\n detectInlineFederatedDivergence,\n type InlineResolutionResult,\n type InlineFederatedDivergence,\n} from './discovery/inline-publisher-properties';\nexport {\n fetchAgentAuthorizationsFromDirectory,\n type AgentAuthorizationsIterator,\n type FetchAgentAuthorizationsOptions,\n type DirectoryLookupPage,\n type DirectoryPublisherEntry,\n type DirectoryDiscoveryMethod,\n type DirectoryPublisherStatus,\n} from './discovery/agent-directory';\nexport {\n validateAdAgents,\n parseManagerDomain,\n type DiscoveryMethod,\n type AdAgentsValidationResult,\n type ValidateAdAgentsOptions,\n} from './discovery/validate-adagents';\n\n// ====== CORE CONVERSATION-AWARE CLIENTS ======\n// New conversation-aware clients with input handler pattern\nexport {\n SingleAgentClient,\n WebhookDispatchError,\n createSingleAgentClient,\n UnsupportedFeatureError,\n} from './core/SingleAgentClient';\nexport type {\n ClientProductPropertyPolicy,\n SingleAgentClientConfig,\n VerifyAndParseWebhookOptions,\n WebhookParseErrorCode,\n WebhookParseFailure,\n WebhookParseResult,\n WebhookParseSuccess,\n} from './core/SingleAgentClient';\nexport {\n AgentClient,\n type TaskResponseTypeMap,\n type AdcpTaskName,\n type InProcessAgentClientConfig,\n} from './core/AgentClient';\nexport { ADCPMultiAgentClient, createADCPMultiAgentClient } from './core/ADCPMultiAgentClient';\nexport { ConfigurationManager } from './core/ConfigurationManager';\nexport {\n CreativeAgentClient,\n createCreativeAgentClient,\n STANDARD_CREATIVE_AGENTS,\n type CreativeFormat,\n type CreativeAgentClientConfig,\n} from './core/CreativeAgentClient';\nexport { TaskExecutor } from './core/TaskExecutor';\nexport { match, attachMatch } from './core/match';\nexport type { MatchHandlers, PartialMatchHandlers } from './core/match';\nexport { ProtocolResponseParser, responseParser, ADCP_STATUS, type ADCPStatus } from './core/ProtocolResponseParser';\nexport {\n ResponseValidator,\n responseValidator,\n type ValidationResult,\n type ValidationOptions,\n} from './core/ResponseValidator';\n// ====== CONVERSATION TYPES ======\nexport type {\n Message,\n InputRequest,\n InputHandler,\n InputHandlerResponse,\n ConversationContext,\n TaskOptions,\n WebhookToolPredicate,\n WebhookUrlTemplate,\n TaskResult,\n TaskResultCompleted,\n TaskResultIntermediate,\n TaskResultFailure,\n TaskResultMetadata,\n TaskState,\n TaskStatus,\n ConversationConfig,\n AdcpErrorInfo,\n AdcpValidationIssue,\n} from './core/ConversationTypes';\n\n// ====== GOVERNANCE ======\n// Buyer-side: GovernanceConfig + GovernanceMiddleware handle check → execute → report automatically.\n// Seller-side: GovernanceAdapter runs committed checks before executing media buys.\n// Types: GovernanceCheckResult, GovernanceOutcome are attached to TaskResult when governance is active.\n\n// Buyer-side middleware types\nexport type {\n GovernanceConfig,\n CampaignGovernanceConfig,\n GovernanceCheckResult,\n GovernanceOutcome,\n GovernanceFinding,\n GovernanceCondition,\n GovernanceEscalation,\n} from './core/GovernanceTypes';\nexport { GovernanceMiddleware } from './core/GovernanceMiddleware';\nexport type { GovernanceDebugEntry } from './core/GovernanceMiddleware';\n\n// ====== GOVERNANCE PLAN HELPERS ======\n// Invariants the schema encodes via if/then / oneOf that generated types\n// typically drop: budget reallocation autonomy and regulated-vertical\n// human review under GDPR Art 22 / EU AI Act Annex III.\nexport {\n buildHumanReviewPlan,\n buildHumanOverride,\n validateGovernancePlan,\n REGULATED_HUMAN_REVIEW_CATEGORIES,\n ANNEX_III_POLICY_IDS,\n} from './governance';\n\n// ====== NETWORKING / SSRF GUARDS ======\n// Public so adopters can converge on the SDK's DNS-pinning and address\n// classification behavior instead of copying partial guards. Use\n// `ssrfSafeFetch` as the security boundary; address classifiers are advisory\n// helpers and do not protect raw fetches from DNS rebinding.\nexport {\n ssrfSafeFetch,\n decodeBodyAsJsonOrText,\n SSRF_TRANSIENT_CODES,\n SsrfRefusedError,\n isPrivateIp,\n isAlwaysBlocked,\n isLikelyPrivateUrl,\n type SsrfRefusedCode,\n type SsrfFetchOptions,\n type SsrfFetchResult,\n} from './net';\n\n// ====== CANONICAL REFERENCE RESOLUTION ======\n// Safe, structured resolver for AdCP 3.1 `format_schema` and\n// `platform_extensions` URI+SHA-256 references.\nexport {\n createCanonicalReferenceCache,\n createCanonicalReferenceResolver,\n canonicalReferenceCacheKey,\n resolveCanonicalReference,\n resolveFormatSchemaReference,\n resolvePlatformExtensionsReference,\n type CanonicalReference,\n type CanonicalReferenceCache,\n type CanonicalReferenceError,\n type CanonicalReferenceErrorCode,\n type CanonicalReferenceFailureResult,\n type CanonicalReferenceKind,\n type CanonicalReferenceResolveOptions,\n type CanonicalReferenceResolvedResult,\n type CanonicalReferenceResolver,\n type CanonicalReferenceResolverOptions,\n type CanonicalReferenceResult,\n type CanonicalReferenceStatus,\n type ExternalRefDigestMap,\n type FormatSchemaReferenceResolvedResult,\n type FormatSchemaReferenceResult,\n type PlatformExtensionsReferenceResult,\n} from './canonical-references';\nexport type {\n BuildHumanReviewPlanInput,\n BuildHumanOverrideInput,\n DataSubjectContestation,\n GovernancePlan,\n GovernanceValidationIssue,\n HumanOverride,\n PlanBudget,\n ReallocationAutonomy,\n} from './governance';\n\n// ====== TASK EVENT TYPES ======\nexport type {\n BaseTaskEvent,\n ProtocolRequestEvent,\n ProtocolResponseEvent,\n TaskStatusEvent,\n ObjectEvent,\n TaskEvent,\n TaskEventCallbacks,\n} from './core/TaskEventTypes';\nexport { createOperationId } from './core/TaskEventTypes';\n\n// ====== ASYNC HANDLER ======\nexport type {\n AsyncHandlerConfig,\n WebhookMetadata,\n Activity,\n NotificationMetadata,\n MediaBuyDeliveryNotification,\n CreateMediaBuyStatusChangeHandler,\n UpdateMediaBuyStatusChangeHandler,\n SyncCreativesStatusChangeHandler,\n GetProductsStatusChangeHandler,\n} from './core/AsyncHandler';\nexport { AsyncHandler, createAsyncHandler } from './core/AsyncHandler';\n\n// ====== WHOLESALE FEED WEBHOOKS ======\nexport {\n normalizeWholesaleFeedWebhookNotification,\n parseWholesaleFeedWebhookNotification,\n WholesaleFeedWebhookNotificationError,\n} from './wholesale-feed-sync/webhook-notification';\nexport type {\n NormalizedWholesaleFeedWebhookNotification,\n WholesaleFeedWebhookAffectedEntityType,\n WholesaleFeedWebhookCacheScope,\n WholesaleFeedWebhookNotificationErrorCode,\n WholesaleFeedWebhookNotificationErrorDetails,\n WholesaleFeedWebhookNotificationType,\n} from './wholesale-feed-sync/webhook-notification';\n\n// ====== INPUT HANDLERS ======\nexport * from './handlers/types';\n\n// ====== STORAGE INTERFACES ======\nexport type {\n Storage,\n BatchStorage,\n PatternStorage,\n AgentCapabilities,\n ConversationState,\n DeferredTaskState,\n StorageConfig,\n StorageFactory,\n StorageMiddleware,\n} from './storage/interfaces';\nexport { MemoryStorage, createMemoryStorage, createMemoryStorageConfig } from './storage/MemoryStorage';\n\n// ====== ERROR CLASSES ======\nexport {\n ADCPError,\n TaskTimeoutError,\n MaxClarificationError,\n DeferredTaskError,\n TaskAbortedError,\n AgentNotFoundError,\n UnsupportedTaskError,\n ProtocolError,\n ValidationError as ADCPValidationError, // Rename to avoid conflict\n MissingInputHandlerError,\n InvalidContextError,\n ConfigurationError,\n AuthenticationRequiredError,\n FeatureUnsupportedError,\n ProtocolFeatureUnsupportedError,\n SDK_ERROR_TO_PROTOCOL_ERROR_CODE,\n VersionUnsupportedError,\n IdempotencyConflictError,\n IdempotencyExpiredError,\n ResponseTooLargeError,\n ActionNotAllowedError,\n adcpErrorToTypedError,\n getClientPreflightAdcpError,\n isADCPError,\n isErrorOfType,\n extractErrorInfo,\n is401Error,\n mapSdkErrorCodeToProtocolErrorCode,\n} from './errors';\nexport type {\n OAuthMetadataInfo,\n ClientPreflightAdcpErrorInfo,\n ClientPreflightAdcpErrorRecovery,\n FeatureUnsupportedErrorOptions,\n ProtocolFeatureUnsupportedErrorOptions,\n ActionNotAllowedErrorDetails,\n ActionNotAllowedReasonValue,\n ActionNotAllowedAttemptedAction,\n ActionNotAllowedAvailableAction,\n ActionNotAllowedRecovery,\n} from './errors';\n\n// ====== MEDIA BUY ACTIONS (AdCP 3.1 / RFC #4480) ======\n// Wire-shape action types are generated; helper result/context types live in\n// the media-buy helper module.\nexport type {\n ActionNotAllowedDetails,\n ActionNotAllowedReason,\n AvailableActionsResult,\n AvailableActionsSource,\n DecomposedUpdateMediaBuy,\n DecomposedUpdateMediaBuyMutation,\n LegacyCoarseAction,\n MediaBuyActionContext,\n MediaBuyActionMode,\n MediaBuyAvailableAction,\n MediaBuyMutationDirection,\n MediaBuyMutationScope,\n MediaBuyValidAction,\n ModeMismatchRecovery,\n PreflightAllowed,\n PreflightDenial,\n PreflightDenied,\n BuyerPropertyPolicy,\n NormalizedPolicyDomain,\n ProductPolicyProductLike,\n ProductPropertyPolicyDiagnostic,\n ProductPropertyPolicyDiagnosticCode,\n ProductPropertyPolicyDiagnosticSeverity,\n ProductPropertyPolicyMode,\n ProductPropertyPolicySelectorBehavior,\n ProductPropertyPolicyValidationResult,\n PreflightResult,\n ResolvedAction,\n SLAWindow,\n SlaWindow,\n ValidateProductsAgainstPropertyPolicyOptions,\n UpdateFieldEntry,\n UpdateMediaBuyRequestLike,\n} from './media-buy';\nexport {\n ACTIONS_BY_FIELD,\n LEGACY_COARSE_ACTIONS,\n UPDATE_FIELDS_BY_ACTION,\n canAddPackages,\n canCancel,\n canDecreaseBudget,\n canExtendFlight,\n canIncreaseBudget,\n canPause,\n canReallocateBudget,\n canRemoveCreative,\n canRemovePackages,\n canReplaceCreative,\n canResume,\n canShortenFlight,\n canUpdateCreativeAssignments,\n canUpdateFlightDates,\n canUpdateFrequencyCaps,\n canUpdatePacing,\n canUpdateTargeting,\n decomposeUpdateMediaBuy,\n findAvailableAction,\n getActionForMutation,\n getAvailableActions,\n getRollupParent,\n ProductPropertyPolicyError,\n normalizeDomainForPropertyPolicy,\n preflightUpdateMediaBuy,\n recoveryForModeMismatch,\n validateProductsAgainstPropertyPolicy,\n} from './media-buy';\nexport { InputRequiredError } from './core/TaskExecutor';\n\n// ====== IDEMPOTENCY ======\nexport {\n generateIdempotencyKey,\n isMutatingTask,\n isValidIdempotencyKey,\n useIdempotencyKey,\n redactIdempotencyKey,\n IDEMPOTENCY_KEY_PATTERN,\n MUTATING_TASKS,\n} from './utils/idempotency';\nexport type { IdempotencyCapabilities } from './utils/capabilities';\nexport type { MutatingRequestInput } from './utils/idempotency';\nexport { canonicalize, canonicalJsonSha256 } from './utils/jcs';\nexport { rollupOptimizationMetricsFromProducts } from './utils/capability-rollups';\n\n// ====== CORE TYPES ======\nexport * from './types';\n\n// ====== TOOL TYPES ======\n// Request and response types for each AdCP tool.\n//\n// Naming convention:\n// {ToolName}Request -- parameters for a tool call (e.g., CreateMediaBuyRequest)\n// {ToolName}Response -- return value; often a union of {ToolName}Success | {ToolName}Error\n//\n// Nested domain types within requests use a Request suffix when the shape\n// differs from the response version:\n// PackageRequest -- creation-shaped (required: buyer_ref, product_id, budget, pricing_option_id)\n// Package -- response-shaped from core.generated (has package_id, most fields optional)\n//\n// Platform implementors: use Request types to type incoming tool calls,\n// Response types to shape your return values.\n// Runtime Zod schemas live at `@adcp/sdk/schemas` to keep ordinary root\n// imports from loading the generated schema declaration bundle.\nexport type {\n // Media Buy Domain\n GetProductsRequest,\n GetProductsResponse,\n ListCreativeFormatsRequest,\n ListCreativeFormatsResponse,\n CreateMediaBuyRequest,\n CreateMediaBuyResponse,\n CreateMediaBuySuccess,\n CreateMediaBuyError,\n CreateMediaBuySubmitted,\n UpdateMediaBuyRequest,\n UpdateMediaBuyResponse,\n UpdateMediaBuySuccess,\n UpdateMediaBuyError,\n SyncCreativesRequest,\n SyncCreativesResponse,\n SyncCreativesSuccess,\n SyncCreativesError,\n SyncCreativesSubmitted,\n SyncAudiencesRequest,\n SyncAudiencesResponse,\n SyncAudiencesSuccess,\n SyncAudiencesError,\n ListCreativesRequest,\n ListCreativesResponse,\n CreativeFilters,\n GetMediaBuyDeliveryRequest,\n GetMediaBuyDeliveryResponse,\n ProvidePerformanceFeedbackRequest,\n ProvidePerformanceFeedbackResponse,\n ProvidePerformanceFeedbackSuccess,\n ProvidePerformanceFeedbackError,\n // Signals Domain\n GetSignalsRequest,\n GetSignalsResponse,\n ActivateSignalRequest,\n ActivateSignalResponse,\n ActivateSignalSuccess,\n ActivateSignalError,\n CpmPricing,\n PercentOfMediaPricing,\n FlatFeePricing,\n PerUnitPricing,\n CustomPricing,\n VendorPricing,\n VendorPricingOption,\n // Pricing variants for products (publisher rate cards in get_products etc.)\n // PricingOption + CPAPricingOption are exported below near the other tool types.\n CPMPricingOption,\n VCPMPricingOption,\n CPCPricingOption,\n CPCVPricingOption,\n CPVPricingOption,\n CPPPricingOption,\n FlatRatePricingOption,\n TimeBasedPricingOption,\n // Governance Domain - Property Lists\n CreatePropertyListRequest,\n CreatePropertyListResponse,\n UpdatePropertyListRequest,\n UpdatePropertyListResponse,\n GetPropertyListRequest,\n GetPropertyListResponse,\n ListPropertyListsRequest,\n ListPropertyListsResponse,\n DeletePropertyListRequest,\n DeletePropertyListResponse,\n PropertyList,\n PropertyListFilters,\n // Governance Domain - Content Standards\n ListContentStandardsRequest,\n ListContentStandardsResponse,\n GetContentStandardsRequest,\n GetContentStandardsResponse,\n CreateContentStandardsRequest,\n CreateContentStandardsResponse,\n UpdateContentStandardsRequest,\n UpdateContentStandardsResponse,\n UpdateContentStandardsSuccess,\n UpdateContentStandardsError,\n CalibrateContentRequest,\n CalibrateContentResponse,\n ValidateContentDeliveryRequest,\n ValidateContentDeliveryResponse,\n ContentStandards,\n Artifact,\n // Governance Domain - Campaign Governance\n SyncPlansRequest,\n SyncPlansResponse,\n SyncGovernanceRequest,\n SyncGovernanceResponse,\n SyncGovernanceSuccess,\n SyncGovernanceError,\n CheckGovernanceRequest,\n CheckGovernanceResponse,\n ReportPlanOutcomeRequest,\n ReportPlanOutcomeResponse,\n GetPlanAuditLogsRequest,\n GetPlanAuditLogsResponse,\n // Governance Domain - Types & Enums\n PlannedDelivery,\n GovernancePhase,\n EscalationSeverity,\n PolicyEnforcementLevel,\n OutcomeType,\n // Governance Domain - Creative Features\n GetCreativeFeaturesRequest,\n GetCreativeFeaturesResponse,\n // Sponsored Intelligence Domain\n SIGetOfferingRequest,\n SIGetOfferingResponse,\n SIInitiateSessionRequest,\n SIInitiateSessionResponse,\n SISendMessageRequest,\n SISendMessageResponse,\n SITerminateSessionRequest,\n SITerminateSessionResponse,\n SICapabilities,\n SIIdentity,\n // Protocol Domain\n GetAdCPCapabilitiesRequest,\n GetAdCPCapabilitiesResponse,\n // Event Tracking Domain\n SyncEventSourcesRequest,\n SyncEventSourcesResponse,\n SyncEventSourcesSuccess,\n SyncEventSourcesError,\n LogEventRequest,\n LogEventResponse,\n LogEventSuccess,\n LogEventError,\n // Enums\n CanceledBy,\n // Core data structures used within requests and responses\n Format,\n Product,\n Proposal,\n ProductAllocation,\n PackageRequest, // Creation params for packages — not Package (response-shaped, from core.generated)\n CreativeAsset,\n CreativePolicy,\n BrandReference,\n BrandID,\n AccountReference,\n CPAPricingOption,\n EventType,\n ActionSource,\n OptimizationGoal,\n ReachUnit,\n TargetingOverlay,\n // 3.1.0-beta.2 renamed `OutcomeMeasurement` → `OutcomeMeasurementDeprecated`\n // to signal the surface is on the 4.0 removal track. Re-export under both\n // names so adopters' existing `import { OutcomeMeasurement }` keeps working.\n OutcomeMeasurementDeprecated,\n OutcomeMeasurementDeprecated as OutcomeMeasurement,\n Duration,\n DeviceType,\n DigitalSourceType,\n FrequencyCap,\n GeographicBreakdownSupport,\n // Catalog Domain\n Catalog,\n CatalogType,\n FeedFormat,\n UpdateFrequency,\n ContentIDType,\n CatalogFieldMapping,\n SyncCatalogsRequest,\n SyncCatalogsResponse,\n SyncCatalogsSuccess,\n SyncCatalogsError,\n // Format Assets\n Overlay,\n Placement,\n // Creative Agent Domain\n CreativeManifest,\n CreativeVariable,\n BuildCreativeRequest,\n BuildCreativeResponse,\n BuildCreativeSuccess,\n BuildCreativeMultiSuccess,\n BuildCreativeError,\n PreviewCreativeRequest,\n PreviewCreativeResponse,\n GetMediaBuysRequest,\n GetMediaBuysResponse,\n ImageAsset,\n VideoAsset,\n AudioAsset,\n TextAsset,\n URLAsset,\n HTMLAsset,\n VASTAsset,\n DAASTAsset,\n JavaScriptAsset,\n WebhookAsset,\n CSSAsset,\n MarkdownAsset,\n CatalogAsset,\n BriefAsset,\n ReferenceAsset,\n Provenance,\n PreviewOutputFormat,\n DisclosurePosition,\n // Event Tracking\n EventCustomData,\n // Creative Delivery Domain\n GetCreativeDeliveryRequest,\n GetCreativeDeliveryResponse,\n // Account Domain\n Account,\n ListAccountsRequest,\n ListAccountsResponse,\n SyncAccountsRequest,\n SyncAccountsResponse,\n SyncAccountsSuccess,\n SyncAccountsError,\n GetAccountFinancialsRequest,\n GetAccountFinancialsResponse,\n GetAccountFinancialsSuccess,\n GetAccountFinancialsError,\n // Pagination\n PaginationRequest,\n PaginationResponse,\n // Nested domain types used as fields within request/response objects\n PackageUpdate,\n Package,\n Destination,\n SignalFilters,\n PricingOption,\n PriceGuidance,\n} from './types/tools.generated';\nexport type {\n AccountStatus,\n CreativeStatus,\n DelegationAuthority,\n CatalogAction,\n CatalogItemStatus,\n MediaBuyStatus,\n // CreativeBrief is its own top-level schema (creative-brief.json) — emitted\n // in core.generated, no longer transitively pulled into tools.generated now\n // that BriefAsset merges its allOf[$ref] base inline.\n CreativeBrief,\n} from './types/core.generated';\n\n// ====== WELL-KNOWN FILE TYPES ======\n// brand.json / adagents.json shapes inferred from the canonical Zod schemas.\n// Re-exported explicitly here (in addition to the transitive `export * from\n// './types'` above) so the top-level public API contract is visible at the\n// main barrel and not dependent on the sub-barrel's wildcard re-export.\n// Source of truth: schemas/cache/{version}/{brand,adagents}.json — regenerate\n// with `npm run generate-wellknown-schemas` when the spec bumps.\nexport type { BrandJson, AdagentsJson } from './types/wellknown-schemas.generated';\nexport { BrandJsonSchema, AdagentsJsonSchema } from './types/wellknown-schemas.generated';\n\n// ====== ERROR CODES ======\n// Standard error code vocabulary for programmatic error handling\nexport type { Error as TaskErrorDetail } from './types/core.generated';\nexport { STANDARD_ERROR_CODES, isStandardErrorCode, getErrorRecovery } from './types/error-codes';\nexport type { StandardErrorCode, ErrorRecovery } from './types/error-codes';\n\n// ====== SERVER-SIDE HELPERS ======\n// Helpers for building AdCP-compliant MCP servers\nexport {\n adcpError,\n capabilitiesResponse,\n productsResponse,\n mediaBuyResponse,\n deliveryResponse,\n listAccountsResponse,\n listCreativeFormatsResponse,\n updateMediaBuyResponse,\n getMediaBuysResponse,\n performanceFeedbackResponse,\n buildCreativeResponse,\n buildCreativeMultiResponse,\n previewCreativeResponse,\n creativeDeliveryResponse,\n listCreativesResponse,\n listPropertyListsResponse,\n listCollectionListsResponse,\n listContentStandardsResponse,\n getPlanAuditLogsResponse,\n syncCreativesResponse,\n getSignalsResponse,\n activateSignalResponse,\n cancelMediaBuyResponse,\n acquireRightsResponse,\n acquireRightsAcquired,\n acquireRightsPendingApproval,\n acquireRightsRejected,\n syncAccountsResponse,\n syncGovernanceResponse,\n reportUsageResponse,\n validActionsForStatus,\n MEDIA_BUY_TRANSITIONS,\n CREATIVE_ASSET_TRANSITIONS,\n isLegalMediaBuyTransition,\n isLegalCreativeTransition,\n assertMediaBuyTransition,\n assertCreativeTransition,\n getAccountMode,\n isSandboxOrMockAccount,\n assertSandboxAccount,\n taskToolResponse,\n registerAdcpTaskTool,\n createTaskCapableServer,\n InMemoryTaskStore,\n isTerminal,\n serve,\n UnknownHostError,\n hostname,\n resolveHost,\n verifyIntrospection,\n registerTestController,\n handleTestControllerRequest,\n TestControllerError,\n toMcpResponse,\n TOOL_INPUT_SHAPE,\n CONTROLLER_SCENARIOS,\n DISCOVERY_ARM_SCENARIOS,\n SEED_SCENARIOS,\n SESSION_ENTRY_CAP,\n enforceMapCap,\n createSeedFixtureCache,\n PostgresTaskStore,\n cleanupExpiredTasks,\n getMcpTasksMigration,\n MCP_TASKS_MIGRATION,\n ADCP_PRE_TRANSPORT,\n checkGovernance,\n governanceDeniedError,\n DEFAULT_REPORTING_CAPABILITIES,\n InMemoryStateStore,\n PostgresStateStore,\n getAdcpStateMigration,\n ADCP_STATE_MIGRATION,\n StateError,\n PatchConflictError,\n SESSION_KEY_FIELD,\n createSessionedStore,\n scopedStore,\n patchWithRetry,\n isPutIfMatchConflict,\n requireSessionKey,\n structuredSerialize,\n structuredDeserialize,\n createIdempotencyStore,\n memoryBackend,\n pgBackend,\n getIdempotencyMigration,\n IDEMPOTENCY_MIGRATION,\n cleanupExpiredIdempotency,\n redisBackend,\n createLazyBackend,\n hashPayload,\n getServeRequestContext,\n ADCP_SERVE_REQUEST_CONTEXT,\n createA2AAdapter,\n A2AInvocationError,\n MCP_APP_RESOURCE_MIME_TYPE,\n} from './server';\nexport type {\n AdcpErrorOptions,\n AdcpErrorResponse,\n McpToolResponse,\n ValidAction,\n CancelMediaBuyInput,\n AdcpTaskToolConfig,\n TaskStore,\n TaskMessageQueue,\n CreateTaskOptions,\n ToolTaskHandler,\n CreateTaskRequestHandlerExtra,\n TaskRequestHandlerExtra,\n CreateTaskResult,\n GetTaskResult,\n Task,\n ServeContext,\n ServeOptions,\n PgQueryable,\n PostgresTaskStoreOptions,\n TestControllerStore,\n TestControllerStoreFactory,\n TestControllerStoreOrFactory,\n ControllerScenario,\n SeedScenario,\n SeedFixtureCache,\n SessionContext,\n OnInstructionsError,\n MaybePromise,\n AdcpServerConfig,\n AdcpToolMap,\n AdcpServerToolName,\n AdcpCapabilitiesConfig,\n AdcpCustomToolConfig,\n McpAppUiMeta,\n McpAppMeta,\n AdcpMcpResourceDefinition,\n McpAppResourceCsp,\n McpAppResourcePermissions,\n McpAppResourceUiMeta,\n McpAppResourceMeta,\n McpAppResourceReadContext,\n AdcpLogger,\n HandlerContext,\n MediaBuyHandlers,\n SignalsHandlers,\n CreativeHandlers,\n GovernanceHandlers,\n AccountHandlers,\n EventTrackingHandlers,\n SponsoredIntelligenceHandlers,\n SignedRequestsConfig,\n AdcpPreTransport,\n AdcpServer,\n AdcpServerTransport,\n AdcpTestRequest,\n AdcpTestToolsCallRequest,\n AdcpTestResponse,\n CheckGovernanceOptions,\n GovernanceCallResult,\n GovernanceApproved,\n GovernanceDenied,\n GovernanceConditions,\n AdcpStateStore,\n ListOptions as StateListOptions,\n ListResult as StateListResult,\n PostgresStateStoreOptions,\n InMemoryStateStoreOptions,\n VersionedDocument,\n PutIfMatchResult,\n PatchWithRetryOptions,\n StateErrorCode,\n SessionKeyContext,\n IdempotencyStore,\n IdempotencyStoreConfig,\n IdempotencyBackend,\n IdempotencyCacheEntry,\n IdempotencyCheckResult,\n MemoryBackendOptions,\n PgBackendOptions,\n RedisBackendOptions,\n RedisBackendClient,\n RedisLikeClient,\n LazyBackendFactory,\n LazyBackendOptions,\n A2AAdapter,\n A2AAdapterOptions,\n A2AAgentCardOverrides,\n A2AMountOptions,\n ExpressAppLike,\n AccountMode,\n RequireCacheScopeWhenProducts,\n ServerPayload,\n ListCreativeFormatsPayload,\n ListCreativeFormatsResponsePayload,\n ListCreativeFormatsServerPayload,\n SyncCreativesPayload,\n SyncCreativesSuccessPayload,\n SyncCreativesErrorPayload,\n} from './server';\n\n// ====== ERROR HANDLING & RETRY ======\nexport { isRetryable, getRetryDelay } from './utils/retry';\nexport { decideRetry, BuyerRetryPolicy } from './utils/buyer-retry-policy';\nexport type { RetryDecision, RetryContext, RetryDecisionOverride } from './utils/buyer-retry-policy';\n\n// Public API: use these for programmatic error handling\nexport {\n extractAdcpErrorInfo,\n extractCorrelationId,\n resolveRecovery,\n getExpectedAction,\n} from './utils/error-extraction';\n\n// Internal: transport-level extraction (used by SDK internals; prefer result.adcpError instead)\nexport { extractAdcpErrorFromMcp, extractAdcpErrorFromTransport } from './utils/error-extraction';\nexport type { ExtractedAdcpError } from './utils/error-extraction';\nexport { extractVersionUnsupportedDetails } from './utils/error-extraction';\nexport type { VersionUnsupportedDetails } from './utils/error-extraction';\n\n// ====== BACKWARDS COMPATIBILITY ======\n// Deprecated types from past protocol migrations\nexport type {\n BrandManifest,\n BrandManifestReference,\n AssetContentType,\n PromotedProducts,\n PromotedOfferings,\n Measurement,\n} from './types/compat';\nexport { brandManifestToBrandReference, promotedProductsToCatalog, promotedOfferingsToCatalog } from './types/compat';\n\n// Request parameter normalization (deprecated field auto-conversion)\nexport { normalizeRequestParams, normalizePackageParams } from './utils/request-normalizer';\n\n// get_products response cache-scope helpers\nexport {\n ensureGetProductsCacheScope,\n validateGetProductsCacheScope,\n type EnsureGetProductsCacheScopeOptions,\n type GetProductsCacheScope,\n type GetProductsResponseWithCacheScope,\n type GetProductsCacheScopeValidation,\n} from './utils/get-products-cache-scope';\n\n// ====== ENUM VALUE ARRAYS ======\n// `${TypeName}Values` const arrays for every named string-literal union in\n// the spec. Consumers can enumerate or validate against these without\n// duplicating literal lists from the Zod unions.\nexport * from './types/enums.generated';\n\n// `${ParentSchema}_${PropertyName}Values` const arrays for inline\n// anonymous unions inside named schemas — e.g.\n// `ImageAssetRequirements_FormatsValues`,\n// `VideoAssetRequirements_ContainersValues`. Companion to enums.generated;\n// see scripts/generate-inline-enum-arrays.ts for naming + scoping rules.\nexport * from './types/inline-enums.generated';\n\n// PreviewCreativeRequestSchema is now a flat z.object() with request_type discriminant.\n// The old variant exports (PreviewCreativeSingleRequestSchema, etc.) are no longer needed —\n// use PreviewCreativeRequestSchema.shape directly with server.registerTool().\n\n// ====== AUTHENTICATION ======\n// Auth utilities for custom integrations\nexport { getAuthToken, createAdCPHeaders, createMCPAuthHeaders, createAuthenticatedFetch } from './auth';\n\n// OAuth diagnostics utilities (see src/lib/auth/oauth/diagnostics.ts)\nexport {\n parseWWWAuthenticate,\n decodeAccessTokenClaims,\n validateTokenAudience,\n type WWWAuthenticateChallenge,\n type DecodedJWTHeader,\n type DecodedJWTClaims,\n type DecodedAccessToken,\n type TokenAudienceResult,\n InvalidTokenError,\n InsufficientScopeError,\n} from './auth/oauth';\n\n// End-to-end OAuth handshake diagnosis — powers `adcp diagnose-auth`\nexport {\n runAuthDiagnosis,\n AUTH_DIAGNOSIS_SCHEMA_VERSION,\n type DiagnoseOptions,\n type HttpCapture as DiagnosisHttpCapture,\n type DiagnosisStep,\n type Hypothesis as DiagnosisHypothesis,\n type HypothesisVerdict as DiagnosisHypothesisVerdict,\n type AuthDiagnosisReport,\n} from './auth/oauth';\n\n// Zero-config OAuth: actionable error + discovery + file storage + per-agent binding\nexport {\n NeedsAuthorizationError,\n discoverAuthorizationRequirements,\n createFileOAuthStorage,\n bindAgentStorage,\n getAgentStorage,\n unbindAgentStorage,\n type AuthorizationRequirements,\n type DiscoverAuthorizationOptions,\n type FileOAuthStorageOptions,\n} from './auth/oauth';\n\n// OAuth 2.0 client credentials (RFC 6749 §4.4) — machine-to-machine token\n// exchange used by programmatic CC consumers and by the CLI's `--save-auth\n// --oauth-token-url ...` flow. The library call path pre-refreshes before\n// every request automatically when `AgentConfig.oauth_client_credentials`\n// is set; these symbols are exposed for consumers that need explicit\n// control (building custom AgentConfigs, testing, or implementing\n// server-side `save_agent` endpoints like Addie's).\nexport {\n exchangeClientCredentials,\n ensureClientCredentialsTokens,\n ClientCredentialsExchangeError,\n MissingEnvSecretError,\n resolveSecret,\n isEnvSecretReference,\n toEnvSecretReference,\n extractEnvSecretName,\n type ExchangeClientCredentialsOptions,\n type EnsureClientCredentialsOptions,\n type AgentOAuthClientCredentials,\n} from './auth/oauth';\n\n// ====== VALIDATION ======\n// Schema validation for requests/responses\nexport { validateAgentUrl, validateAdCPResponse, getExpectedSchema, handleAdCPResponse } from './validation';\n\n// ====== PROTOCOL CLIENTS ======\n// Low-level protocol clients for MCP and A2A (primarily for testing)\nexport {\n ProtocolClient,\n callMCPTool,\n callA2ATool,\n createMCPClient,\n createA2AClient,\n closeMCPConnections,\n closeOAuthConnections,\n bundleSupportsAdcpVersionField,\n sanitizeTransportHeaders,\n sanitizeTransportUrl,\n} from './protocols';\nexport { toReleasePrecisionWire, validateAdcpVersionWire } from './validation/schema-loader';\nexport type {\n CallToolOptions,\n TransportActivity,\n TransportActivityContext,\n TransportActivityHandler,\n TransportOptions,\n} from './protocols';\n\n// ====== WIRE VERSION HELPERS (NAMESPACE) ======\n// Grouped re-exports of the three AdCP `adcp_version` envelope helpers\n// (spec PR adcontextprotocol/adcp#3493). Prefer this surface over the\n// individual top-level exports — the namespace stays stable as helpers\n// are added (a fourth helper drops in here without churning the barrel).\n// The top-level exports are kept for back-compat and aren't deprecated.\nimport { bundleSupportsAdcpVersionField as _isSupported } from './protocols';\nimport { toReleasePrecisionWire as _normalize, validateAdcpVersionWire as _validate } from './validation/schema-loader';\nexport const wireVersion = {\n isSupported: _isSupported,\n normalize: _normalize,\n validate: _validate,\n} as const;\n\n// ====== RESPONSE UTILITIES ======\n// Public utilities for working with AdCP responses\nexport {\n getStandardFormats,\n unwrapProtocolResponse,\n isAdcpError,\n isAdcpSuccess,\n isTerminalAdcpError,\n hasAdvisorySuccessPayload,\n getAuthoritativeMediaBuyStatus,\n isMediaBuyStatus,\n resolveTaskState,\n} from './utils';\nexport type { EffectiveTaskState, ResolvedTaskState, ResolveTaskStateOptions } from './utils';\nexport { injectLegacyEnvelopeStatus } from './utils/envelope-status-compat';\nexport { extractResult, type ToolCallResultLike } from './utils';\nexport { REQUEST_TIMEOUT, MAX_CONCURRENT, STANDARD_FORMATS } from './utils';\nexport {\n batchPreviewProducts,\n batchPreviewFormats,\n clearPreviewCache,\n type PreviewResult,\n type BatchPreviewOptions,\n type PreviewCacheBackend,\n type PreviewCacheEntry,\n} from './utils';\nexport { detectProtocol, detectProtocolWithTimeout } from './utils';\nexport { A2A_CARD_PATHS, isAgentCardPath, isWellKnownAgentCardUrl, buildCardUrls, stripAgentCardPath } from './utils';\n\n// ====== PRICING UTILITIES ======\n// Pricing adapter for v2/v3 compatibility and CPA detection\nexport { isCPAPricing } from './utils';\n\n// ====== PAGINATION UTILITIES ======\n// Auto-pagination helpers for cursor-based AdCP endpoints\nexport { paginate, paginatePages, type PaginateOptions } from './utils';\n\n// ====== FORMAT ASSET UTILITIES ======\n// Access to format assets (v3 `assets` field)\nexport {\n getFormatAssets,\n getRequiredAssets,\n getOptionalAssets,\n getIndividualAssets,\n getRepeatableGroups,\n usesDeprecatedAssetsField,\n getAssetCount,\n hasAssets,\n} from './utils/format-assets';\n\n// ====== CREATIVE ASSET BUILDERS ======\n// Typed factories that inject the `asset_type` discriminator.\n// `imageAsset({ url, width, height })` returns a valid `ImageAsset`\n// without repeating `asset_type: 'image'` at every call site.\n// Prefer the named exports; use `Asset.image({...})` when constructing\n// several asset types together (assets-by-role manifests).\nexport {\n Asset,\n imageAsset,\n videoAsset,\n audioAsset,\n textAsset,\n urlAsset,\n htmlAsset,\n javascriptAsset,\n cssAsset,\n markdownAsset,\n webhookAsset,\n} from './utils/asset-builders';\n\n// ====== FORMAT ASSET SLOT BUILDERS ======\n// Typed factories for the slot definitions inside `Format.assets[]` — what a\n// seller/publisher declares it accepts. Each builder injects the `item_type`\n// and `asset_type` discriminators, and the `requirements` object is strictly\n// typed per asset_type: misnamed fields (`file_types` vs `formats`) and wrong\n// units (`min_duration_seconds` vs `min_duration_ms`) fail type-check.\n// Use `repeatableGroup({...})` (or `FormatAsset.group(...)`) to wrap assets\n// that repeat — that's the correct home for `min_count` / `max_count`.\nexport {\n FormatAsset,\n imageAssetSlot,\n videoAssetSlot,\n audioAssetSlot,\n textAssetSlot,\n markdownAssetSlot,\n htmlAssetSlot,\n cssAssetSlot,\n javascriptAssetSlot,\n vastAssetSlot,\n daastAssetSlot,\n urlAssetSlot,\n webhookAssetSlot,\n briefAssetSlot,\n catalogAssetSlot,\n repeatableGroup,\n imageGroupAsset,\n videoGroupAsset,\n audioGroupAsset,\n textGroupAsset,\n markdownGroupAsset,\n htmlGroupAsset,\n cssGroupAsset,\n javascriptGroupAsset,\n vastGroupAsset,\n daastGroupAsset,\n urlGroupAsset,\n webhookGroupAsset,\n} from './utils/format-asset-slot-builders';\n\n// ====== PREVIEW RENDER BUILDERS ======\n// Typed factories that inject the `output_format` discriminator on\n// `PreviewRender` objects. `urlRender({ render_id, preview_url, role })`\n// returns a valid url-variant render without repeating\n// `output_format: 'url'` at every call site. Matrix runs consistently\n// saw this drift: Claude emitted renders that omitted the discriminator\n// or its required sibling field.\nexport { Render, urlRender, htmlRender, bothRender } from './utils/render-builders';\n\n// ====== FORMAT RENDER BUILDERS ======\n// Typed factories for `Format.renders[]` entries on format declarations.\n// The item schema's `oneOf` forces a render to satisfy exactly one branch —\n// either `dimensions` (display/video) OR `parameters_from_format_id: true`\n// (audio, template formats). A render with only `{ role }` fails validation.\n// Audio specifically cannot use `{ role, duration_seconds }` — duration is\n// not a recognized `renders[]` field and wouldn't satisfy the oneOf anyway.\n// Use `parameterizedRender({ role })` (or the alias `templateRender`) so\n// format_id parameters carry duration.\n//\n// `FormatRender` below is the grouped namespace (value export). The v3\n// structural interface by the same name is re-exported from\n// `utils/format-renders` further down — TypeScript keeps type and value\n// namespaces separate, so both are available under the single import.\nexport {\n FormatRender,\n displayRender,\n parameterizedRender,\n templateRender,\n type DimensionsRender,\n type ParameterizedRender,\n type RenderItem,\n} from './utils/format-render-builders';\n\n// ====== CANONICAL CREATIVE FORMAT MIGRATION HELPERS ======\n// Author `Product.format_options[]`, v1 `format_id` references, and product\n// cards from one obvious namespace while migrating away from local Format.type\n// and product_card.format_id conventions.\nexport {\n CanonicalFormat,\n type CanonicalFormatDeclaration,\n type CanonicalFormatDeclarationFields,\n type CanonicalFormatKind,\n type CanonicalFormatParams,\n type FormatReferenceInput,\n type ProductCardDetailedFields,\n type ProductCardFields,\n} from './v2/projection';\n\nexport {\n augmentProductWithFormatOptions,\n withFormatOptions,\n toCanonicalOnlyProduct,\n toCanonicalOnlyResponse,\n packageRefsForCapabilities,\n legacyFormatIdsFromOptions,\n tryLegacyFormatIdsFromOptions,\n legacyFormatIdsForCapability,\n canonicalDeclarationFromBareId,\n resolveCanonicalFormatKind,\n CapabilityIdsLookupError,\n type BareFormatIdResolveOptions,\n type CanonicalOnlyProduct,\n type CapabilityIdsLookupErrorCode,\n type PackageFormatRefs,\n type ProjectionDiagnostic,\n type V1FormatId,\n type V1Product,\n type V2AugmentedProduct,\n type V2Product,\n type V2ProductFormatDeclaration,\n} from './v2/projection';\n\n// ====== ACTIVATION KEY BUILDERS ======\n// Typed factories that inject the `type` discriminator on `ActivationKey`.\n// SHAPE-GOTCHAS §1 — `key`/`value` flatten on the activation key itself.\nexport { activationKey, segmentIdActivationKey, keyValueActivationKey } from './utils/activation-key-builders';\n\n// ====== SIGNAL ID BUILDERS AND ACCESSORS ======\n// Typed factories that inject the `source` discriminator on `SignalID`.\n// Used in `signal_ids` filter arrays and as the `signal_id` provenance\n// field on every `Signal` returned by `get_signals`. SHAPE-GOTCHAS §2.\n// To read fields from a received `SignalID`, use `getSignalId` (segment id)\n// and `getSignalIssuer` (data_provider_domain or agent_url).\nexport { signalId, catalogSignalId, agentSignalId, getSignalId, getSignalIssuer } from './utils/signal-id-builders';\nexport {\n buildActivateSignalRequest,\n getSignalActivationId,\n getSignalPricingOptionIds,\n normalizeDiscoveredSignal,\n} from './utils/signal-discovery-helpers';\nexport type {\n BuildActivateSignalRequestOptions,\n DiscoveredSignal,\n NormalizedDiscoveredSignal,\n} from './utils/signal-discovery-helpers';\n\n// ====== BUILD CREATIVE RETURN BUILDERS ======\n// Typed factories for the four return shapes accepted by the framework\n// from `build_creative` handlers. `.single` / `.multi` emit bare manifests\n// the framework auto-wraps; `.singleEnveloped` / `.multiEnveloped` emit\n// the shaped envelope when the handler needs to attach `sandbox` /\n// `expires_at` / `preview`. SHAPE-GOTCHAS §5.\nexport {\n buildCreativeReturn,\n singleBuildCreativeReturn,\n multiBuildCreativeReturn,\n singleEnvelopedBuildCreativeReturn,\n multiEnvelopedBuildCreativeReturn,\n} from './utils/build-creative-return-builders';\n\n// ====== PREVIEW CREATIVE BUILDERS ======\n// Typed factories that inject the `response_type` discriminator on\n// `PreviewCreativeResponse`. Three-way oneOf — `single | batch | variant`.\n// Pair with `urlRender` / `htmlRender` / `bothRender` for the per-render\n// `output_format`. SHAPE-GOTCHAS §4.\nexport {\n previewCreative,\n singlePreviewCreativeResponse,\n batchPreviewCreativeResponse,\n variantPreviewCreativeResponse,\n} from './utils/preview-creative-builders';\n\n// ====== MEDIA BUY DELIVERY NOTIFICATION BUILDERS ======\n// Typed factories that inject the `notification_type` discriminator on\n// `GetMediaBuyDeliveryResponse` for webhook deliveries. Five variants:\n// `scheduled` / `final` / `delayed` / `adjusted` / `window_update`.\nexport {\n mediaBuyDeliveryNotification,\n scheduledMediaBuyDeliveryNotification,\n finalMediaBuyDeliveryNotification,\n delayedMediaBuyDeliveryNotification,\n adjustedMediaBuyDeliveryNotification,\n windowUpdateMediaBuyDeliveryNotification,\n} from './utils/media-buy-delivery-notification-builders';\n\n// ====== V3.0 COMPATIBILITY UTILITIES ======\n// Capabilities detection, version negotiation, and v3 enforcement.\n// See also:\n// - `VersionUnsupportedError` in errors — thrown by requireV3()/requireV3ForMutations\n// - `SyncCreativesItemSchema` in validation — per-item sync_creatives validator\n// - `ADCP_MAJOR_VERSION` / `COMPATIBLE_ADCP_VERSIONS` in version information\n// - `SingleAgentClient#requireV3()` / `AgentClient#requireV3()` — runtime gate\nexport {\n buildSyntheticCapabilities,\n buildSyntheticV3Capabilities,\n parseCapabilitiesResponse,\n supportsV3,\n supportsProtocol,\n supportsPropertyListFiltering,\n supportsContentStandards,\n supportsSyncCreatives,\n requiresOperatorAuth,\n requiresAccountForProducts,\n supportsSandbox,\n supportsExperimentalFeature,\n resolveFeature,\n listDeclaredFeatures,\n MEDIA_BUY_TOOLS,\n SIGNALS_TOOLS,\n GOVERNANCE_TOOLS,\n CREATIVE_TOOLS,\n EVENT_TRACKING_TOOLS,\n ACCOUNT_TOOLS,\n PROTOCOL_TOOLS,\n BRAND_RIGHTS_TOOLS,\n TASK_FEATURE_MAP,\n} from './utils/capabilities';\nexport type {\n AdcpCapabilities,\n AdcpMajorVersion,\n AdcpProtocol,\n AccountCapabilities,\n MediaBuyFeatures,\n ToolInfo,\n FeatureName,\n} from './utils/capabilities';\n\n// Buyer-side creative delivery helpers\nexport { inlineCreativesForPackages } from './utils/creative-delivery';\nexport type {\n InlineCreativeAssignment,\n InlineCreativePackage,\n InlineCreativePackagePatch,\n InlineCreativesForPackagesOptions,\n} from './utils/creative-delivery';\n\n// Creative assignment adapter (v2 creative_ids ↔ v3 creative_assignments)\nexport {\n adaptPackageRequestForV2,\n adaptCreateMediaBuyRequestForV2,\n adaptUpdateMediaBuyRequestForV2,\n normalizePackageResponse,\n normalizeMediaBuyResponse,\n usesV2CreativeIds,\n usesV3CreativeAssignments,\n getCreativeIds,\n getCreativeAssignments,\n} from './utils/creative-adapter';\nexport type { CreativeAssignment } from './utils/creative-adapter';\n\n// Format renders normalizer (v2 dimensions ↔ v3 renders)\nexport {\n normalizeFormatRenders,\n normalizeFormatsResponse,\n getFormatRenders,\n getPrimaryRender,\n getCompanionRenders,\n isMultiRenderFormat,\n usesV2Dimensions,\n usesV3Renders,\n getFormatDimensions,\n} from './utils/format-renders';\n// FormatRender (the v3 structural interface) was renamed to FormatRenderEntry\n// so the `FormatRender` name at the barrel becomes the factory namespace\n// exported from `./utils/format-render-builders` above. The deprecated type\n// alias `FormatRender = FormatRenderEntry` still lives in `utils/format-renders`\n// for callers importing the sub-module directly; it's not re-exported here.\nexport type { FormatRenderEntry, RenderDimensions } from './utils/format-renders';\n\n// Preview response normalizer (v2 output_id ↔ v3 render_id)\nexport {\n normalizePreviewRender,\n normalizePreview,\n normalizePreviewCreativeResponse,\n usesV2RenderFields,\n usesV3RenderFields,\n getRenderId,\n getRenderRole,\n getPrimaryPreviewRender,\n getPreviewUrl,\n getPreviewHtml,\n} from './utils/preview-normalizer';\nexport type { PreviewRenderV3 } from './utils/preview-normalizer';\n\n// ====== TYPE GUARD UTILITIES ======\n// Type guards for automatic TypeScript type narrowing in webhook handlers\nexport {\n // Generic status checks\n isStatusCompleted,\n isStatusWorking,\n isStatusInputRequired,\n isStatusSubmitted,\n isStatusFailed,\n isStatusRejected,\n // GetProducts type guards\n isGetProductsCompleted,\n isGetProductsWorking,\n isGetProductsInputRequired,\n isGetProductsSubmitted,\n isGetProductsFailed,\n // CreateMediaBuy type guards\n isCreateMediaBuyCompleted,\n isCreateMediaBuyWorking,\n isCreateMediaBuyInputRequired,\n isCreateMediaBuySubmitted,\n isCreateMediaBuyFailed,\n // UpdateMediaBuy type guards\n isUpdateMediaBuyCompleted,\n isUpdateMediaBuyWorking,\n isUpdateMediaBuyInputRequired,\n isUpdateMediaBuySubmitted,\n isUpdateMediaBuyFailed,\n // SyncCreatives type guards\n isSyncCreativesCompleted,\n isSyncCreativesWorking,\n isSyncCreativesInputRequired,\n isSyncCreativesSubmitted,\n isSyncCreativesFailed,\n} from './utils/typeGuards';\n\n// ====== VERSION INFORMATION ======\nexport {\n getAdcpVersion,\n getLibraryVersion,\n isCompatibleWith,\n getCompatibleVersions,\n parseAdcpMajorVersion,\n ADCP_VERSION,\n ADCP_MAJOR_VERSION,\n LIBRARY_VERSION,\n COMPATIBLE_ADCP_VERSIONS,\n VERSION_INFO,\n} from './version';\nexport type { AdcpVersion } from './version';\nexport { resolveAdcpVersion } from './utils/adcp-version-config';\n\n// ====== OBSERVABILITY ======\n// OpenTelemetry tracing utilities (no-op if @opentelemetry/api not installed)\nexport {\n getTracer,\n isTracingEnabled,\n injectTraceHeaders,\n withSpan,\n addSpanAttributes,\n recordSpanException,\n} from './observability';\n\n// ====== AGENT CLASSES ======\n// Primary agent interface - returns raw AdCP responses\nexport { Agent, AgentCollection } from './agents/index.generated';\n\n// ====== SERVER-SIDE ADAPTERS ======\n// Adapters for building AdCP servers with customizable business logic\nexport {\n // Content Standards\n ContentStandardsAdapter,\n type IContentStandardsAdapter,\n type ContentEvaluationResult,\n ContentStandardsErrorCodes,\n isContentStandardsError,\n defaultContentStandardsAdapter,\n // Property Lists\n PropertyListAdapter,\n type IPropertyListAdapter,\n type ResolvedProperty,\n PropertyListErrorCodes,\n isPropertyListError,\n defaultPropertyListAdapter,\n // Sponsored Intelligence Sessions\n SISessionManager,\n AISISessionManager,\n type ISISessionManager,\n type SISession,\n SIErrorCodes,\n defaultSISessionManager,\n // Governance (seller-side committed checks)\n GovernanceAdapter,\n defaultGovernanceAdapter,\n type IGovernanceAdapter,\n type GovernanceAdapterConfig,\n type GovernanceAdapterErrorCode,\n type CommittedCheckRequest,\n GovernanceAdapterErrorCodes,\n isGovernanceAdapterError,\n // Implicit Account Store (resolution: 'implicit') — Shape A reference adapter\n InMemoryImplicitAccountStore,\n defaultImplicitKeyFn,\n type ImplicitAccountStoreOptions,\n // OAuth pass-through resolver — Shape B accounts.resolve factory\n createOAuthPassthroughResolver,\n type OAuthPassthroughResolverOptions,\n // Roster-backed AccountStore — Shape C factory for publisher-curated explicit platforms\n createRosterAccountStore,\n type RosterAccountStoreOptions,\n // Derived AccountStore — Shape D factory for single-tenant `resolution: 'derived'` agents\n createDerivedAccountStore,\n type DerivedAccountStoreOptions,\n} from './adapters';\n\n// ====== BACKWARD COMPATIBILITY & ENVIRONMENT LOADING ======\n\nimport type { AgentConfig } from './types';\nimport { ADCPMultiAgentClient } from './core/ADCPMultiAgentClient';\n\n/**\n * Legacy AdCPClient alias for backward compatibility\n * @deprecated Use ADCPMultiAgentClient instead for new code\n */\nexport const AdCPClient = ADCPMultiAgentClient;\n\n// Legacy configuration manager maintained for backward compatibility\n// The enhanced ConfigurationManager is exported above\n\n/**\n * Legacy createAdCPClient function for backward compatibility\n * @deprecated Use new ADCPMultiAgentClient constructor instead\n */\nexport function createAdCPClient(agents?: AgentConfig[]): ADCPMultiAgentClient {\n return new AdCPClient(agents);\n}\n\n/**\n * Load agents from environment and create multi-agent client\n * @deprecated Use ADCPMultiAgentClient.fromEnv() instead\n */\nexport function createAdCPClientFromEnv(): ADCPMultiAgentClient {\n return ADCPMultiAgentClient.fromEnv();\n}\n\n// ====== SUBSTITUTION OBSERVER / ENCODER ======\n// Primitives backing the `substitution-observer-runner` test-kit contract.\n// Runners (conformance graders) import the observer side; sales/retail-\n// media agents implementing the #2620 catalog-item macro encoding rule\n// import `SubstitutionEncoder`. Re-exported here for discoverability;\n// the full surface is also available via `@adcp/sdk/substitution`.\nexport {\n SubstitutionObserver,\n SubstitutionEncoder,\n PreviewFetchError,\n MacroInRawValueError,\n CATALOG_MACRO_VECTORS,\n getCatalogMacroVector,\n extractTrackerUrls,\n matchBindings,\n assertRfc3986Safe,\n assertUnreservedOnly,\n assertNoNestedExpansion,\n assertSchemePreserved,\n DEFAULT_MACRO_PROHIBITED_PATTERN,\n enforceSsrfPolicy,\n enforceSsrfPolicyResolved,\n DEFAULT_SSRF_POLICY,\n encodeUnreserved,\n equalUnderHexCasePolicy,\n isUnreservedOnly,\n divergenceOffset,\n translateUniversalMacros,\n} from './substitution';\nexport type {\n ObserverFetchOptions,\n ObserverDispatcher,\n CatalogMacroVectorName,\n AssertionOptions as SubstitutionAssertionOptions,\n AssertionResult as SubstitutionAssertionResult,\n BindingMatch,\n CatalogBinding,\n CatalogMacroVector,\n PolicyResult as SubstitutionPolicyResult,\n SsrfPolicy,\n TrackerUrlRecord,\n MacroMapping,\n TranslateResult,\n} from './substitution';\n\n// ====== TEST HELPERS ======\n// Re-export test helpers for convenience (also available via @adcp/sdk/testing)\nexport {\n testAgent,\n testAgentA2A,\n testAgentClient,\n createTestAgent,\n TEST_AGENT_TOKEN,\n TEST_AGENT_MCP_CONFIG,\n TEST_AGENT_A2A_CONFIG,\n testAgentNoAuth,\n testAgentNoAuthA2A,\n TEST_AGENT_NO_AUTH_MCP_CONFIG,\n TEST_AGENT_NO_AUTH_A2A_CONFIG,\n creativeAgent,\n testBrandRightsFlow,\n hasBrandRightsTools,\n expectControllerError,\n expectControllerSuccess,\n RateLimitTripObserver,\n RATE_LIMIT_TRIP_CONTRACT,\n RATE_LIMIT_TRIP_DEFAULT_REPLAY_MAX_WAIT_SECONDS,\n RATE_LIMIT_TRIP_MAX_ATTEMPTS_MAX,\n RATE_LIMIT_TRIP_MAX_ATTEMPTS_MIN,\n validateRateLimitTripSpec,\n} from './testing/index';\nexport type {\n ControllerErrorWithDetail,\n TestClient,\n RateLimitTripSpec,\n RateLimitTripClient,\n RateLimitTripFailureCode,\n RateLimitTripObservation,\n RateLimitTripObserverOptions,\n RateLimitTripResponseSnapshot,\n RateLimitTripStructuredResult,\n RateLimitTripTaskOptions,\n} from './testing/index';\n"],"mappings":"AAIA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAiBP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AA0GP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAgCP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,OAIK;AACP;AAAA,EACE;AAAA,OAYK;AAkBP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP;AAAA,EACE;AAAA,OAOK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AAIP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAUP;AAAA,EACE;AAAA,OAIK;AACP,SAAS,sBAAsB,kCAAkC;AACjE,SAAS,4BAA4B;AACrC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,oBAAoB;AAC7B,SAAS,OAAO,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;AAAA,EACA;AAAA,OACK;AAMP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AASP;AAAA,EACE;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,OACK;AAYP,SAAS,kCAAkC;AAS3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AASP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAKP;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,0BAA0B;AAInC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP,SAAS,OAAO,uBAAuB;AAIvC;AAAA,EAEE;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EAKA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EAGA;AAAA,EAGA;AAAA,EAGA;AAAA,OAEK;AAKP,SAAS,wBAAAA,6BAA4B;AAM9B,MAAM,aAAaA;AASnB,SAAS,iBAAiB,QAA8C;AAC7E,SAAO,IAAI,WAAW,MAAM;AAC9B;AAMO,SAAS,0BAAgD;AAC9D,SAAOA,sBAAqB,QAAQ;AACtC;AAQA;AAAA,EACE;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,OACK;AAmBP;AAAA,EACE;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,OACK;","names":["ADCPMultiAgentClient"]}
|
|
@@ -34,6 +34,7 @@ export interface ModernMCPConnectionOptions {
|
|
|
34
34
|
authProvider?: object;
|
|
35
35
|
signal?: AbortSignal;
|
|
36
36
|
requestTimeoutMs?: number;
|
|
37
|
+
fetchFn?: typeof fetch;
|
|
37
38
|
/** Use the v2 SDK's negotiated legacy client instead of handing off to v1. */
|
|
38
39
|
handleLegacy?: boolean;
|
|
39
40
|
}
|
|
@@ -34,6 +34,7 @@ export interface ModernMCPConnectionOptions {
|
|
|
34
34
|
authProvider?: object;
|
|
35
35
|
signal?: AbortSignal;
|
|
36
36
|
requestTimeoutMs?: number;
|
|
37
|
+
fetchFn?: typeof fetch;
|
|
37
38
|
/** Use the v2 SDK's negotiated legacy client instead of handing off to v1. */
|
|
38
39
|
handleLegacy?: boolean;
|
|
39
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-modern.d.ts","sourceRoot":"","sources":["../../../src/lib/protocols/mcp-modern.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAIL,KAAK,IAAI,EACV,MAAM,8BAA8B,CAAC;AAKtC,OAAO,EAAiD,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC5G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAWnD,KAAK,gBAAgB,GAAG;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjD,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAAE,OAAO,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,gBAAgB,CAAA;CAAE,CAAC;AAClG,MAAM,MAAM,oBAAoB,GAAG;IAAE,OAAO,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,IAAI,EAAE,CAAA;CAAE,CAAC;AAEzF,MAAM,WAAW,0BAA0B;IACzC,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,YAAY,CAAC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AY,CAAC,EAAE,OAAO,CAAC;CACxB;AAiWD;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,SAAS,CAAC,EAAE,MAAM,EAClB,SAAS,GAAE,aAAa,EAAO,EAC/B,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACtC,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,gBAAgB,CAAC,CAqB3B;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,QAAQ,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,EAClB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACtC,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;CAAE,CAAC,CA0B5D;AAED,kGAAkG;AAClG,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM,EAClB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACtC,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,oBAAoB,CAAC,CA+B/B;AAED,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAmB/D"}
|
|
@@ -41,7 +41,9 @@ const knownLegacyConnections = /* @__PURE__ */ new Map();
|
|
|
41
41
|
const MAX_CACHED_CONNECTIONS = 20;
|
|
42
42
|
const LEGACY_CLASSIFICATION_TTL_MS = 5 * 60 * 1e3;
|
|
43
43
|
const modernOAuthProviderIds = /* @__PURE__ */ new WeakMap();
|
|
44
|
+
const modernFetchFnIds = /* @__PURE__ */ new WeakMap();
|
|
44
45
|
let nextModernOAuthProviderId = 0;
|
|
46
|
+
let nextModernFetchFnId = 0;
|
|
45
47
|
let connectionGeneration = 0;
|
|
46
48
|
function cacheDisambiguator(value) {
|
|
47
49
|
return (0, import_node_crypto.createHmac)("sha256", "").update(value).digest("hex");
|
|
@@ -67,12 +69,23 @@ function oauthProviderCacheKey(provider) {
|
|
|
67
69
|
}
|
|
68
70
|
return key;
|
|
69
71
|
}
|
|
70
|
-
function
|
|
72
|
+
function fetchFnCacheKey(fetchFn) {
|
|
73
|
+
if (!fetchFn) return void 0;
|
|
74
|
+
let key = modernFetchFnIds.get(fetchFn);
|
|
75
|
+
if (!key) {
|
|
76
|
+
key = `fetch:${++nextModernFetchFnId}`;
|
|
77
|
+
modernFetchFnIds.set(fetchFn, key);
|
|
78
|
+
}
|
|
79
|
+
return key;
|
|
80
|
+
}
|
|
81
|
+
function connectionCacheKey(agentUrl, headers, signingCacheKey, authProvider, fetchFn) {
|
|
71
82
|
const normalizedHeaders = Object.entries(headers).map(([key, value]) => [key.toLowerCase(), value]).sort(([left], [right]) => left.localeCompare(right));
|
|
72
83
|
const parts = [agentUrl, `headers:${cacheDisambiguator(JSON.stringify(normalizedHeaders))}`];
|
|
73
84
|
if (signingCacheKey) parts.push(signingCacheKey);
|
|
74
85
|
const providerKey = oauthProviderCacheKey(authProvider);
|
|
75
86
|
if (providerKey) parts.push(providerKey);
|
|
87
|
+
const fetchKey = fetchFnCacheKey(fetchFn);
|
|
88
|
+
if (fetchKey) parts.push(fetchKey);
|
|
76
89
|
return parts.join("::");
|
|
77
90
|
}
|
|
78
91
|
function isKnownLegacy(cacheKey) {
|
|
@@ -140,7 +153,7 @@ function evictLeastRecentlyUsed() {
|
|
|
140
153
|
async function createNegotiatedClient(options, authHeaders) {
|
|
141
154
|
const requestTimeoutMs = (0, import_abort.resolveRequestTimeoutMs)(options.requestTimeoutMs);
|
|
142
155
|
const clientRequestTimeoutMs = (0, import_abort.resolveClientRequestTimeoutMs)(options.requestTimeoutMs);
|
|
143
|
-
const rawNetworkFetch = (input, init) => fetch(input, init);
|
|
156
|
+
const rawNetworkFetch = options.fetchFn ?? ((input, init) => fetch(input, init));
|
|
144
157
|
const networkFetch = (input, init) => (0, import_abort.withAbortSignal)(
|
|
145
158
|
[options.signal, init?.signal],
|
|
146
159
|
requestTimeoutMs,
|
|
@@ -224,10 +237,11 @@ async function attemptModernCall(options, toolName, args) {
|
|
|
224
237
|
options.agentUrl,
|
|
225
238
|
authHeaders,
|
|
226
239
|
options.signingContext?.cacheKey,
|
|
227
|
-
options.authProvider
|
|
240
|
+
options.authProvider,
|
|
241
|
+
options.fetchFn
|
|
228
242
|
);
|
|
229
243
|
if (isKnownLegacy(cacheKey)) return { handled: false };
|
|
230
|
-
const guardedConnection = options.signal !== void 0 || options.requestTimeoutMs !== void 0;
|
|
244
|
+
const guardedConnection = options.signal !== void 0 || options.requestTimeoutMs !== void 0 || options.fetchFn !== void 0;
|
|
231
245
|
let client;
|
|
232
246
|
try {
|
|
233
247
|
client = guardedConnection ? await createNegotiatedClient(options, authHeaders) : await getOrCreateModernConnection(cacheKey, options, authHeaders);
|
|
@@ -306,6 +320,7 @@ async function tryCallModernMCPTool(agentUrl, toolName, args, authToken, debugLo
|
|
|
306
320
|
authProvider: options.authProvider,
|
|
307
321
|
signal: options.signal,
|
|
308
322
|
requestTimeoutMs: options.requestTimeoutMs,
|
|
323
|
+
fetchFn: options.fetchFn,
|
|
309
324
|
handleLegacy: options.handleLegacy
|
|
310
325
|
},
|
|
311
326
|
toolName,
|
|
@@ -324,6 +339,7 @@ async function probeModernMCPConnection(agentUrl, authToken, customHeaders, opti
|
|
|
324
339
|
authProvider: options.authProvider,
|
|
325
340
|
signal: options.signal,
|
|
326
341
|
requestTimeoutMs: options.requestTimeoutMs,
|
|
342
|
+
fetchFn: options.fetchFn,
|
|
327
343
|
handleLegacy: options.handleLegacy
|
|
328
344
|
};
|
|
329
345
|
const authHeaders = buildAuthHeaders(authToken, customHeaders, options.authProvider);
|
|
@@ -350,7 +366,8 @@ async function tryListModernMCPTools(agentUrl, authToken, customHeaders, options
|
|
|
350
366
|
signingContext: options.signingContext,
|
|
351
367
|
authProvider: options.authProvider,
|
|
352
368
|
signal: options.signal,
|
|
353
|
-
requestTimeoutMs: options.requestTimeoutMs
|
|
369
|
+
requestTimeoutMs: options.requestTimeoutMs,
|
|
370
|
+
fetchFn: options.fetchFn
|
|
354
371
|
};
|
|
355
372
|
const authHeaders = buildAuthHeaders(authToken, customHeaders, options.authProvider);
|
|
356
373
|
let client;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/protocols/mcp-modern.ts"],"sourcesContent":["/**\n * MCP 2026-07-28 client path.\n *\n * The v2 SDK removed the experimental 2025 Tasks interception API. During the\n * migration window we therefore negotiate with the v2 client first and use it\n * only when the peer selects the modern protocol era. Legacy peers fall back\n * to mcp-tasks.ts, which keeps the existing v1 Tasks behavior intact.\n */\n\nimport {\n Client,\n StreamableHTTPClientTransport,\n type OAuthClientProvider as ModernOAuthClientProvider,\n type Tool,\n} from '@modelcontextprotocol/client';\nimport { createHmac } from 'node:crypto';\nimport { createMCPAuthHeaders } from '../auth';\nimport { is401Error } from '../errors';\nimport { withSpan, injectTraceHeaders } from '../observability/tracing';\nimport { buildAgentSigningFetch, signingContextStorage, type AgentSigningContext } from '../signing/client';\nimport type { DebugLogEntry } from '../types/adcp';\nimport {\n isAbortOrTimeoutError,\n resolveClientRequestTimeoutMs,\n resolveRequestTimeoutMs,\n withAbortSignal,\n} from './abort';\nimport { wrapFetchWithCapture } from './rawResponseCapture';\nimport { wrapFetchWithSizeLimit } from './responseSizeLimit';\nimport { wrapFetchWithTransportDiagnostics } from './transportDiagnostics';\n\ntype CallToolResponse = {\n isError?: boolean;\n content?: Array<{ type: string; text?: string }>;\n [key: string]: unknown;\n};\n\nexport type ModernMCPAttempt = { handled: false } | { handled: true; response: CallToolResponse };\nexport type ModernMCPListAttempt = { handled: false } | { handled: true; tools: Tool[] };\n\nexport interface ModernMCPConnectionOptions {\n signingContext?: AgentSigningContext;\n authProvider?: object;\n signal?: AbortSignal;\n requestTimeoutMs?: number;\n /** Use the v2 SDK's negotiated legacy client instead of handing off to v1. */\n handleLegacy?: boolean;\n}\n\ninterface ModernConnectionOptions {\n agentUrl: string;\n authToken?: string;\n customHeaders?: Record<string, string>;\n debugLogs: DebugLogEntry[];\n signingContext?: AgentSigningContext;\n authProvider?: object;\n signal?: AbortSignal;\n requestTimeoutMs?: number;\n handleLegacy?: boolean;\n}\n\nconst modernConnections = new Map<string, Client>();\nconst legacyConnectionExpiresAt = new Map<string, number>();\nconst pendingModernConnections = new Map<string, Promise<Client>>();\nconst knownLegacyConnections = new Map<string, number>();\nconst MAX_CACHED_CONNECTIONS = 20;\nconst LEGACY_CLASSIFICATION_TTL_MS = 5 * 60 * 1000;\nconst modernOAuthProviderIds = new WeakMap<object, string>();\nlet nextModernOAuthProviderId = 0;\nlet connectionGeneration = 0;\n\nfunction cacheDisambiguator(value: string): string {\n return createHmac('sha256', '').update(value).digest('hex');\n}\n\nfunction buildAuthHeaders(\n authToken: string | undefined,\n customHeaders: Record<string, string> | undefined,\n authProvider?: object\n): Record<string, string> {\n const filteredHeaders =\n authProvider || authToken\n ? Object.fromEntries(\n Object.entries(customHeaders ?? {}).filter(keyValue => {\n const key = keyValue[0].toLowerCase();\n return key !== 'authorization' && key !== 'x-adcp-auth';\n })\n )\n : customHeaders;\n return {\n ...filteredHeaders,\n ...(!authProvider && authToken ? createMCPAuthHeaders(authToken) : {}),\n };\n}\n\nfunction oauthProviderCacheKey(provider: object | undefined): string | undefined {\n if (!provider) return undefined;\n let key = modernOAuthProviderIds.get(provider);\n if (!key) {\n key = `oauth-provider:${++nextModernOAuthProviderId}`;\n modernOAuthProviderIds.set(provider, key);\n }\n return key;\n}\n\nfunction connectionCacheKey(\n agentUrl: string,\n headers: Record<string, string>,\n signingCacheKey?: string,\n authProvider?: object\n): string {\n const normalizedHeaders = Object.entries(headers)\n .map(([key, value]) => [key.toLowerCase(), value] as const)\n .sort(([left], [right]) => left.localeCompare(right));\n const parts = [agentUrl, `headers:${cacheDisambiguator(JSON.stringify(normalizedHeaders))}`];\n if (signingCacheKey) parts.push(signingCacheKey);\n const providerKey = oauthProviderCacheKey(authProvider);\n if (providerKey) parts.push(providerKey);\n return parts.join('::');\n}\n\nfunction isKnownLegacy(cacheKey: string): boolean {\n const classifiedAt = knownLegacyConnections.get(cacheKey);\n if (classifiedAt === undefined) return false;\n if (Date.now() - classifiedAt > LEGACY_CLASSIFICATION_TTL_MS) {\n knownLegacyConnections.delete(cacheKey);\n return false;\n }\n knownLegacyConnections.delete(cacheKey);\n knownLegacyConnections.set(cacheKey, classifiedAt);\n return true;\n}\n\nfunction markKnownLegacy(cacheKey: string): void {\n knownLegacyConnections.delete(cacheKey);\n knownLegacyConnections.set(cacheKey, Date.now());\n while (knownLegacyConnections.size > MAX_CACHED_CONNECTIONS) {\n const oldest = knownLegacyConnections.keys().next().value;\n if (!oldest) break;\n knownLegacyConnections.delete(oldest);\n }\n}\n\nfunction httpStatusOf(error: unknown, depth = 0): number | undefined {\n if (!error || typeof error !== 'object' || depth > 4) return undefined;\n const candidate = error as { status?: unknown; code?: unknown; cause?: unknown; response?: { status?: unknown } };\n if (typeof candidate.status === 'number') return candidate.status;\n if (typeof candidate.response?.status === 'number') return candidate.response.status;\n if (typeof candidate.code === 'number' && candidate.code >= 100 && candidate.code <= 599) return candidate.code;\n return httpStatusOf(candidate.cause, depth + 1);\n}\n\nfunction withPerRequestTraceHeaders(fetchImpl: typeof fetch): typeof fetch {\n return (input, init) => {\n const headers = new Headers(input instanceof Request ? input.headers : undefined);\n new Headers(init?.headers).forEach((value, key) => headers.set(key, value));\n for (const [key, value] of Object.entries(injectTraceHeaders())) headers.set(key, value);\n return fetchImpl(input, { ...init, headers });\n };\n}\n\nfunction getCachedConnection(cacheKey: string): Client | undefined {\n const client = modernConnections.get(cacheKey);\n if (client) {\n const legacyExpiry = legacyConnectionExpiresAt.get(cacheKey);\n if (legacyExpiry !== undefined && legacyExpiry <= Date.now()) {\n modernConnections.delete(cacheKey);\n legacyConnectionExpiresAt.delete(cacheKey);\n void client.close().catch(() => {});\n return undefined;\n }\n modernConnections.delete(cacheKey);\n modernConnections.set(cacheKey, client);\n }\n return client;\n}\n\nfunction evictLeastRecentlyUsed(): void {\n if (modernConnections.size <= MAX_CACHED_CONNECTIONS) return;\n const oldestKey = modernConnections.keys().next().value;\n if (!oldestKey) return;\n const client = modernConnections.get(oldestKey);\n modernConnections.delete(oldestKey);\n legacyConnectionExpiresAt.delete(oldestKey);\n void client?.close().catch(() => {});\n}\n\nasync function createNegotiatedClient(\n options: ModernConnectionOptions,\n authHeaders: Record<string, string>\n): Promise<Client> {\n const requestTimeoutMs = resolveRequestTimeoutMs(options.requestTimeoutMs);\n const clientRequestTimeoutMs = resolveClientRequestTimeoutMs(options.requestTimeoutMs);\n const rawNetworkFetch: typeof fetch = (input, init) => fetch(input, init);\n const networkFetch: typeof fetch = (input, init) =>\n withAbortSignal<Response>([options.signal, init?.signal], requestTimeoutMs, signal =>\n rawNetworkFetch(input, { ...init, signal })\n );\n const diagnosticFetch = wrapFetchWithTransportDiagnostics(wrapFetchWithSizeLimit(networkFetch));\n const signedFetch: typeof fetch = options.signingContext\n ? (buildAgentSigningFetch({\n upstream: diagnosticFetch,\n signing: options.signingContext.signing,\n getCapability: options.signingContext.getCapability,\n }) as typeof fetch)\n : diagnosticFetch;\n const transport = new StreamableHTTPClientTransport(new URL(options.agentUrl), {\n requestInit: { headers: authHeaders, redirect: 'manual' },\n fetch: wrapFetchWithCapture(withPerRequestTraceHeaders(signedFetch)),\n ...(options.authProvider && {\n authProvider: options.authProvider as ModernOAuthClientProvider,\n }),\n });\n const client = new Client(\n { name: 'AdCP-Client', version: '1.0.0' },\n {\n versionNegotiation: {\n mode: 'auto',\n ...(clientRequestTimeoutMs !== undefined && { probe: { timeoutMs: clientRequestTimeoutMs } }),\n },\n }\n );\n\n try {\n await client.connect(transport, {\n ...(options.signal && { signal: options.signal }),\n ...(clientRequestTimeoutMs !== undefined && { timeout: clientRequestTimeoutMs }),\n });\n return client;\n } catch (error) {\n try {\n await client.close();\n } catch {\n /* ignore close errors */\n }\n throw error;\n }\n}\n\nasync function getOrCreateModernConnection(\n cacheKey: string,\n options: ModernConnectionOptions,\n authHeaders: Record<string, string>\n): Promise<Client> {\n const cached = getCachedConnection(cacheKey);\n if (cached) return cached;\n\n const pending = pendingModernConnections.get(cacheKey);\n if (pending) return pending;\n\n const generation = connectionGeneration;\n const promise = createNegotiatedClient(options, authHeaders)\n .then(client => {\n if (\n (client.getProtocolEra() === 'modern' || options.handleLegacy === true) &&\n generation === connectionGeneration\n ) {\n modernConnections.set(cacheKey, client);\n if (client.getProtocolEra() === 'legacy') {\n legacyConnectionExpiresAt.set(cacheKey, Date.now() + LEGACY_CLASSIFICATION_TTL_MS);\n } else {\n legacyConnectionExpiresAt.delete(cacheKey);\n }\n evictLeastRecentlyUsed();\n } else if (generation !== connectionGeneration) {\n void client.close().catch(() => {});\n }\n return client;\n })\n .finally(() => {\n if (pendingModernConnections.get(cacheKey) === promise) pendingModernConnections.delete(cacheKey);\n });\n pendingModernConnections.set(cacheKey, promise);\n return promise;\n}\n\nasync function callOnModernClient(\n client: Client,\n toolName: string,\n args: Record<string, unknown>,\n signal?: AbortSignal,\n requestTimeoutMs?: number\n): Promise<CallToolResponse> {\n const resolvedRequestTimeoutMs = resolveClientRequestTimeoutMs(requestTimeoutMs);\n return (await client.callTool(\n { name: toolName, arguments: args },\n {\n ...(signal && { signal }),\n ...(resolvedRequestTimeoutMs !== undefined && { timeout: resolvedRequestTimeoutMs }),\n }\n )) as CallToolResponse;\n}\n\nasync function attemptModernCall(\n options: ModernConnectionOptions,\n toolName: string,\n args: Record<string, unknown>\n): Promise<ModernMCPAttempt> {\n const authHeaders = buildAuthHeaders(options.authToken, options.customHeaders, options.authProvider);\n const cacheKey = connectionCacheKey(\n options.agentUrl,\n authHeaders,\n options.signingContext?.cacheKey,\n options.authProvider\n );\n if (isKnownLegacy(cacheKey)) return { handled: false };\n\n const guardedConnection = options.signal !== undefined || options.requestTimeoutMs !== undefined;\n let client: Client;\n try {\n client = guardedConnection\n ? await createNegotiatedClient(options, authHeaders)\n : await getOrCreateModernConnection(cacheKey, options, authHeaders);\n } catch (error) {\n const status = httpStatusOf(error);\n if (status === 404 || status === 405) {\n markKnownLegacy(cacheKey);\n options.debugLogs.push({\n type: 'info',\n message: `MCP: Modern Streamable HTTP is unavailable (HTTP ${status}); preserving the v1 transport path`,\n timestamp: new Date().toISOString(),\n });\n return { handled: false };\n }\n throw error;\n }\n\n if (client.getProtocolEra() !== 'modern') {\n if (options.handleLegacy === true) {\n options.debugLogs.push({\n type: 'info',\n message: `MCP: v2 client selected the legacy protocol era for ${toolName}`,\n timestamp: new Date().toISOString(),\n });\n } else {\n markKnownLegacy(cacheKey);\n try {\n await client.close();\n } catch {\n /* ignore close errors */\n }\n options.debugLogs.push({\n type: 'info',\n message: `MCP: Server selected the legacy protocol era for ${toolName}; preserving the v1 Tasks path`,\n timestamp: new Date().toISOString(),\n });\n return { handled: false };\n }\n }\n\n options.debugLogs.push({\n type: 'success',\n message: `MCP: Negotiated protocol ${client.getNegotiatedProtocolVersion()} for ${toolName}`,\n timestamp: new Date().toISOString(),\n });\n\n try {\n const response = await callOnModernClient(client, toolName, args, options.signal, options.requestTimeoutMs);\n return { handled: true, response };\n } catch (error) {\n // A tool request may have reached the server even when its response was\n // lost. Never replay automatically: mutating AdCP tools depend on the\n // caller's explicit idempotency policy, not transport guesswork.\n modernConnections.delete(cacheKey);\n legacyConnectionExpiresAt.delete(cacheKey);\n try {\n await client.close();\n } catch {\n /* ignore close errors */\n }\n throw error;\n } finally {\n if (guardedConnection) {\n try {\n await client.close();\n } catch {\n /* ignore close errors */\n }\n }\n }\n}\n\n/**\n * Try a tool call using the MCP 2026-07-28 protocol era.\n *\n * `handled: false` means the caller must use the existing v1 client. This is\n * deliberately a result rather than an exception because legacy negotiation\n * is normal during the transition window.\n */\nexport async function tryCallModernMCPTool(\n agentUrl: string,\n toolName: string,\n args: Record<string, unknown>,\n authToken?: string,\n debugLogs: DebugLogEntry[] = [],\n customHeaders?: Record<string, string>,\n options: ModernMCPConnectionOptions = {}\n): Promise<ModernMCPAttempt> {\n return withSpan('adcp.mcp.negotiate', { 'adcp.tool': toolName, 'http.url': agentUrl }, () =>\n signingContextStorage.run(options.signingContext, () =>\n attemptModernCall(\n {\n agentUrl,\n authToken,\n customHeaders,\n debugLogs,\n signingContext: options.signingContext,\n authProvider: options.authProvider,\n signal: options.signal,\n requestTimeoutMs: options.requestTimeoutMs,\n handleLegacy: options.handleLegacy,\n },\n toolName,\n args\n )\n )\n );\n}\n\n/**\n * Probe an endpoint with the official v2 client's auto negotiation.\n * `connected: false` lets endpoint discovery retain its v1 SSE fallback.\n */\nexport async function probeModernMCPConnection(\n agentUrl: string,\n authToken?: string,\n customHeaders?: Record<string, string>,\n options: ModernMCPConnectionOptions = {}\n): Promise<{ connected: boolean; era?: 'legacy' | 'modern' }> {\n const connectionOptions: ModernConnectionOptions = {\n agentUrl,\n authToken,\n customHeaders,\n debugLogs: [],\n signingContext: options.signingContext,\n authProvider: options.authProvider,\n signal: options.signal,\n requestTimeoutMs: options.requestTimeoutMs,\n handleLegacy: options.handleLegacy,\n };\n const authHeaders = buildAuthHeaders(authToken, customHeaders, options.authProvider);\n let client: Client | undefined;\n try {\n client = await createNegotiatedClient(connectionOptions, authHeaders);\n return { connected: true, era: client.getProtocolEra() };\n } catch (error) {\n if (is401Error(error) || isAbortOrTimeoutError(error)) throw error;\n const status = httpStatusOf(error);\n if (status === 404 || status === 405) return { connected: false };\n throw error;\n } finally {\n await client?.close().catch(() => {});\n }\n}\n\n/** List tools when the endpoint selected the modern era; otherwise let the v1 caller continue. */\nexport async function tryListModernMCPTools(\n agentUrl: string,\n authToken?: string,\n customHeaders?: Record<string, string>,\n options: ModernMCPConnectionOptions = {}\n): Promise<ModernMCPListAttempt> {\n const connectionOptions: ModernConnectionOptions = {\n agentUrl,\n authToken,\n customHeaders,\n debugLogs: [],\n signingContext: options.signingContext,\n authProvider: options.authProvider,\n signal: options.signal,\n requestTimeoutMs: options.requestTimeoutMs,\n };\n const authHeaders = buildAuthHeaders(authToken, customHeaders, options.authProvider);\n let client: Client | undefined;\n try {\n client = await createNegotiatedClient(connectionOptions, authHeaders);\n if (client.getProtocolEra() !== 'modern') return { handled: false };\n const resolvedRequestTimeoutMs = resolveClientRequestTimeoutMs(options.requestTimeoutMs);\n const result = await client.listTools(undefined, {\n ...(options.signal && { signal: options.signal }),\n ...(resolvedRequestTimeoutMs !== undefined && { timeout: resolvedRequestTimeoutMs }),\n });\n return { handled: true, tools: result.tools };\n } catch (error) {\n if (is401Error(error) || isAbortOrTimeoutError(error)) throw error;\n const status = httpStatusOf(error);\n if (status === 404 || status === 405) return { handled: false };\n throw error;\n } finally {\n await client?.close().catch(() => {});\n }\n}\n\nexport async function closeModernMCPConnections(): Promise<void> {\n connectionGeneration++;\n const pending = [...pendingModernConnections.values()];\n pendingModernConnections.clear();\n const settled = await Promise.allSettled(pending);\n const clients = new Set(modernConnections.values());\n for (const result of settled) {\n if (result.status === 'fulfilled') clients.add(result.value);\n }\n modernConnections.clear();\n legacyConnectionExpiresAt.clear();\n knownLegacyConnections.clear();\n for (const client of clients) {\n try {\n await client.close();\n } catch {\n /* ignore close errors */\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,oBAKO;AACP,yBAA2B;AAC3B,kBAAqC;AACrC,oBAA2B;AAC3B,qBAA6C;AAC7C,IAAAA,iBAAwF;AAExF,mBAKO;AACP,gCAAqC;AACrC,+BAAuC;AACvC,kCAAkD;AAgClD,MAAM,oBAAoB,oBAAI,IAAoB;AAClD,MAAM,4BAA4B,oBAAI,IAAoB;AAC1D,MAAM,2BAA2B,oBAAI,IAA6B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C5B,QAAI,OAAO,WAAW,YAAa,SAAQ,IAAI,OAAO,KAAK;AAAA,EAC7D;AACA,oBAAkB,MAAM;AACxB,4BAA0B,MAAM;AAChC,yBAAuB,MAAM;AAC7B,aAAW,UAAU,SAAS;AAC5B,QAAI;AACF,YAAM,OAAO,MAAM;AAAA,IACrB,QAAQ;AAAA,IAER;AAAA,EACF;AACF;","names":["import_client"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/lib/protocols/mcp-modern.ts"],"sourcesContent":["/**\n * MCP 2026-07-28 client path.\n *\n * The v2 SDK removed the experimental 2025 Tasks interception API. During the\n * migration window we therefore negotiate with the v2 client first and use it\n * only when the peer selects the modern protocol era. Legacy peers fall back\n * to mcp-tasks.ts, which keeps the existing v1 Tasks behavior intact.\n */\n\nimport {\n Client,\n StreamableHTTPClientTransport,\n type OAuthClientProvider as ModernOAuthClientProvider,\n type Tool,\n} from '@modelcontextprotocol/client';\nimport { createHmac } from 'node:crypto';\nimport { createMCPAuthHeaders } from '../auth';\nimport { is401Error } from '../errors';\nimport { withSpan, injectTraceHeaders } from '../observability/tracing';\nimport { buildAgentSigningFetch, signingContextStorage, type AgentSigningContext } from '../signing/client';\nimport type { DebugLogEntry } from '../types/adcp';\nimport {\n isAbortOrTimeoutError,\n resolveClientRequestTimeoutMs,\n resolveRequestTimeoutMs,\n withAbortSignal,\n} from './abort';\nimport { wrapFetchWithCapture } from './rawResponseCapture';\nimport { wrapFetchWithSizeLimit } from './responseSizeLimit';\nimport { wrapFetchWithTransportDiagnostics } from './transportDiagnostics';\n\ntype CallToolResponse = {\n isError?: boolean;\n content?: Array<{ type: string; text?: string }>;\n [key: string]: unknown;\n};\n\nexport type ModernMCPAttempt = { handled: false } | { handled: true; response: CallToolResponse };\nexport type ModernMCPListAttempt = { handled: false } | { handled: true; tools: Tool[] };\n\nexport interface ModernMCPConnectionOptions {\n signingContext?: AgentSigningContext;\n authProvider?: object;\n signal?: AbortSignal;\n requestTimeoutMs?: number;\n fetchFn?: typeof fetch;\n /** Use the v2 SDK's negotiated legacy client instead of handing off to v1. */\n handleLegacy?: boolean;\n}\n\ninterface ModernConnectionOptions {\n agentUrl: string;\n authToken?: string;\n customHeaders?: Record<string, string>;\n debugLogs: DebugLogEntry[];\n signingContext?: AgentSigningContext;\n authProvider?: object;\n signal?: AbortSignal;\n requestTimeoutMs?: number;\n fetchFn?: typeof fetch;\n handleLegacy?: boolean;\n}\n\nconst modernConnections = new Map<string, Client>();\nconst legacyConnectionExpiresAt = new Map<string, number>();\nconst pendingModernConnections = new Map<string, Promise<Client>>();\nconst knownLegacyConnections = new Map<string, number>();\nconst MAX_CACHED_CONNECTIONS = 20;\nconst LEGACY_CLASSIFICATION_TTL_MS = 5 * 60 * 1000;\nconst modernOAuthProviderIds = new WeakMap<object, string>();\nconst modernFetchFnIds = new WeakMap<typeof fetch, string>();\nlet nextModernOAuthProviderId = 0;\nlet nextModernFetchFnId = 0;\nlet connectionGeneration = 0;\n\nfunction cacheDisambiguator(value: string): string {\n return createHmac('sha256', '').update(value).digest('hex');\n}\n\nfunction buildAuthHeaders(\n authToken: string | undefined,\n customHeaders: Record<string, string> | undefined,\n authProvider?: object\n): Record<string, string> {\n const filteredHeaders =\n authProvider || authToken\n ? Object.fromEntries(\n Object.entries(customHeaders ?? {}).filter(keyValue => {\n const key = keyValue[0].toLowerCase();\n return key !== 'authorization' && key !== 'x-adcp-auth';\n })\n )\n : customHeaders;\n return {\n ...filteredHeaders,\n ...(!authProvider && authToken ? createMCPAuthHeaders(authToken) : {}),\n };\n}\n\nfunction oauthProviderCacheKey(provider: object | undefined): string | undefined {\n if (!provider) return undefined;\n let key = modernOAuthProviderIds.get(provider);\n if (!key) {\n key = `oauth-provider:${++nextModernOAuthProviderId}`;\n modernOAuthProviderIds.set(provider, key);\n }\n return key;\n}\n\nfunction fetchFnCacheKey(fetchFn: typeof fetch | undefined): string | undefined {\n if (!fetchFn) return undefined;\n let key = modernFetchFnIds.get(fetchFn);\n if (!key) {\n key = `fetch:${++nextModernFetchFnId}`;\n modernFetchFnIds.set(fetchFn, key);\n }\n return key;\n}\n\nfunction connectionCacheKey(\n agentUrl: string,\n headers: Record<string, string>,\n signingCacheKey?: string,\n authProvider?: object,\n fetchFn?: typeof fetch\n): string {\n const normalizedHeaders = Object.entries(headers)\n .map(([key, value]) => [key.toLowerCase(), value] as const)\n .sort(([left], [right]) => left.localeCompare(right));\n const parts = [agentUrl, `headers:${cacheDisambiguator(JSON.stringify(normalizedHeaders))}`];\n if (signingCacheKey) parts.push(signingCacheKey);\n const providerKey = oauthProviderCacheKey(authProvider);\n if (providerKey) parts.push(providerKey);\n const fetchKey = fetchFnCacheKey(fetchFn);\n if (fetchKey) parts.push(fetchKey);\n return parts.join('::');\n}\n\nfunction isKnownLegacy(cacheKey: string): boolean {\n const classifiedAt = knownLegacyConnections.get(cacheKey);\n if (classifiedAt === undefined) return false;\n if (Date.now() - classifiedAt > LEGACY_CLASSIFICATION_TTL_MS) {\n knownLegacyConnections.delete(cacheKey);\n return false;\n }\n knownLegacyConnections.delete(cacheKey);\n knownLegacyConnections.set(cacheKey, classifiedAt);\n return true;\n}\n\nfunction markKnownLegacy(cacheKey: string): void {\n knownLegacyConnections.delete(cacheKey);\n knownLegacyConnections.set(cacheKey, Date.now());\n while (knownLegacyConnections.size > MAX_CACHED_CONNECTIONS) {\n const oldest = knownLegacyConnections.keys().next().value;\n if (!oldest) break;\n knownLegacyConnections.delete(oldest);\n }\n}\n\nfunction httpStatusOf(error: unknown, depth = 0): number | undefined {\n if (!error || typeof error !== 'object' || depth > 4) return undefined;\n const candidate = error as { status?: unknown; code?: unknown; cause?: unknown; response?: { status?: unknown } };\n if (typeof candidate.status === 'number') return candidate.status;\n if (typeof candidate.response?.status === 'number') return candidate.response.status;\n if (typeof candidate.code === 'number' && candidate.code >= 100 && candidate.code <= 599) return candidate.code;\n return httpStatusOf(candidate.cause, depth + 1);\n}\n\nfunction withPerRequestTraceHeaders(fetchImpl: typeof fetch): typeof fetch {\n return (input, init) => {\n const headers = new Headers(input instanceof Request ? input.headers : undefined);\n new Headers(init?.headers).forEach((value, key) => headers.set(key, value));\n for (const [key, value] of Object.entries(injectTraceHeaders())) headers.set(key, value);\n return fetchImpl(input, { ...init, headers });\n };\n}\n\nfunction getCachedConnection(cacheKey: string): Client | undefined {\n const client = modernConnections.get(cacheKey);\n if (client) {\n const legacyExpiry = legacyConnectionExpiresAt.get(cacheKey);\n if (legacyExpiry !== undefined && legacyExpiry <= Date.now()) {\n modernConnections.delete(cacheKey);\n legacyConnectionExpiresAt.delete(cacheKey);\n void client.close().catch(() => {});\n return undefined;\n }\n modernConnections.delete(cacheKey);\n modernConnections.set(cacheKey, client);\n }\n return client;\n}\n\nfunction evictLeastRecentlyUsed(): void {\n if (modernConnections.size <= MAX_CACHED_CONNECTIONS) return;\n const oldestKey = modernConnections.keys().next().value;\n if (!oldestKey) return;\n const client = modernConnections.get(oldestKey);\n modernConnections.delete(oldestKey);\n legacyConnectionExpiresAt.delete(oldestKey);\n void client?.close().catch(() => {});\n}\n\nasync function createNegotiatedClient(\n options: ModernConnectionOptions,\n authHeaders: Record<string, string>\n): Promise<Client> {\n const requestTimeoutMs = resolveRequestTimeoutMs(options.requestTimeoutMs);\n const clientRequestTimeoutMs = resolveClientRequestTimeoutMs(options.requestTimeoutMs);\n const rawNetworkFetch: typeof fetch = options.fetchFn ?? ((input, init) => fetch(input, init));\n const networkFetch: typeof fetch = (input, init) =>\n withAbortSignal<Response>([options.signal, init?.signal], requestTimeoutMs, signal =>\n rawNetworkFetch(input, { ...init, signal })\n );\n const diagnosticFetch = wrapFetchWithTransportDiagnostics(wrapFetchWithSizeLimit(networkFetch));\n const signedFetch: typeof fetch = options.signingContext\n ? (buildAgentSigningFetch({\n upstream: diagnosticFetch,\n signing: options.signingContext.signing,\n getCapability: options.signingContext.getCapability,\n }) as typeof fetch)\n : diagnosticFetch;\n const transport = new StreamableHTTPClientTransport(new URL(options.agentUrl), {\n requestInit: { headers: authHeaders, redirect: 'manual' },\n fetch: wrapFetchWithCapture(withPerRequestTraceHeaders(signedFetch)),\n ...(options.authProvider && {\n authProvider: options.authProvider as ModernOAuthClientProvider,\n }),\n });\n const client = new Client(\n { name: 'AdCP-Client', version: '1.0.0' },\n {\n versionNegotiation: {\n mode: 'auto',\n ...(clientRequestTimeoutMs !== undefined && { probe: { timeoutMs: clientRequestTimeoutMs } }),\n },\n }\n );\n\n try {\n await client.connect(transport, {\n ...(options.signal && { signal: options.signal }),\n ...(clientRequestTimeoutMs !== undefined && { timeout: clientRequestTimeoutMs }),\n });\n return client;\n } catch (error) {\n try {\n await client.close();\n } catch {\n /* ignore close errors */\n }\n throw error;\n }\n}\n\nasync function getOrCreateModernConnection(\n cacheKey: string,\n options: ModernConnectionOptions,\n authHeaders: Record<string, string>\n): Promise<Client> {\n const cached = getCachedConnection(cacheKey);\n if (cached) return cached;\n\n const pending = pendingModernConnections.get(cacheKey);\n if (pending) return pending;\n\n const generation = connectionGeneration;\n const promise = createNegotiatedClient(options, authHeaders)\n .then(client => {\n if (\n (client.getProtocolEra() === 'modern' || options.handleLegacy === true) &&\n generation === connectionGeneration\n ) {\n modernConnections.set(cacheKey, client);\n if (client.getProtocolEra() === 'legacy') {\n legacyConnectionExpiresAt.set(cacheKey, Date.now() + LEGACY_CLASSIFICATION_TTL_MS);\n } else {\n legacyConnectionExpiresAt.delete(cacheKey);\n }\n evictLeastRecentlyUsed();\n } else if (generation !== connectionGeneration) {\n void client.close().catch(() => {});\n }\n return client;\n })\n .finally(() => {\n if (pendingModernConnections.get(cacheKey) === promise) pendingModernConnections.delete(cacheKey);\n });\n pendingModernConnections.set(cacheKey, promise);\n return promise;\n}\n\nasync function callOnModernClient(\n client: Client,\n toolName: string,\n args: Record<string, unknown>,\n signal?: AbortSignal,\n requestTimeoutMs?: number\n): Promise<CallToolResponse> {\n const resolvedRequestTimeoutMs = resolveClientRequestTimeoutMs(requestTimeoutMs);\n return (await client.callTool(\n { name: toolName, arguments: args },\n {\n ...(signal && { signal }),\n ...(resolvedRequestTimeoutMs !== undefined && { timeout: resolvedRequestTimeoutMs }),\n }\n )) as CallToolResponse;\n}\n\nasync function attemptModernCall(\n options: ModernConnectionOptions,\n toolName: string,\n args: Record<string, unknown>\n): Promise<ModernMCPAttempt> {\n const authHeaders = buildAuthHeaders(options.authToken, options.customHeaders, options.authProvider);\n const cacheKey = connectionCacheKey(\n options.agentUrl,\n authHeaders,\n options.signingContext?.cacheKey,\n options.authProvider,\n options.fetchFn\n );\n if (isKnownLegacy(cacheKey)) return { handled: false };\n\n const guardedConnection =\n options.signal !== undefined || options.requestTimeoutMs !== undefined || options.fetchFn !== undefined;\n let client: Client;\n try {\n client = guardedConnection\n ? await createNegotiatedClient(options, authHeaders)\n : await getOrCreateModernConnection(cacheKey, options, authHeaders);\n } catch (error) {\n const status = httpStatusOf(error);\n if (status === 404 || status === 405) {\n markKnownLegacy(cacheKey);\n options.debugLogs.push({\n type: 'info',\n message: `MCP: Modern Streamable HTTP is unavailable (HTTP ${status}); preserving the v1 transport path`,\n timestamp: new Date().toISOString(),\n });\n return { handled: false };\n }\n throw error;\n }\n\n if (client.getProtocolEra() !== 'modern') {\n if (options.handleLegacy === true) {\n options.debugLogs.push({\n type: 'info',\n message: `MCP: v2 client selected the legacy protocol era for ${toolName}`,\n timestamp: new Date().toISOString(),\n });\n } else {\n markKnownLegacy(cacheKey);\n try {\n await client.close();\n } catch {\n /* ignore close errors */\n }\n options.debugLogs.push({\n type: 'info',\n message: `MCP: Server selected the legacy protocol era for ${toolName}; preserving the v1 Tasks path`,\n timestamp: new Date().toISOString(),\n });\n return { handled: false };\n }\n }\n\n options.debugLogs.push({\n type: 'success',\n message: `MCP: Negotiated protocol ${client.getNegotiatedProtocolVersion()} for ${toolName}`,\n timestamp: new Date().toISOString(),\n });\n\n try {\n const response = await callOnModernClient(client, toolName, args, options.signal, options.requestTimeoutMs);\n return { handled: true, response };\n } catch (error) {\n // A tool request may have reached the server even when its response was\n // lost. Never replay automatically: mutating AdCP tools depend on the\n // caller's explicit idempotency policy, not transport guesswork.\n modernConnections.delete(cacheKey);\n legacyConnectionExpiresAt.delete(cacheKey);\n try {\n await client.close();\n } catch {\n /* ignore close errors */\n }\n throw error;\n } finally {\n if (guardedConnection) {\n try {\n await client.close();\n } catch {\n /* ignore close errors */\n }\n }\n }\n}\n\n/**\n * Try a tool call using the MCP 2026-07-28 protocol era.\n *\n * `handled: false` means the caller must use the existing v1 client. This is\n * deliberately a result rather than an exception because legacy negotiation\n * is normal during the transition window.\n */\nexport async function tryCallModernMCPTool(\n agentUrl: string,\n toolName: string,\n args: Record<string, unknown>,\n authToken?: string,\n debugLogs: DebugLogEntry[] = [],\n customHeaders?: Record<string, string>,\n options: ModernMCPConnectionOptions = {}\n): Promise<ModernMCPAttempt> {\n return withSpan('adcp.mcp.negotiate', { 'adcp.tool': toolName, 'http.url': agentUrl }, () =>\n signingContextStorage.run(options.signingContext, () =>\n attemptModernCall(\n {\n agentUrl,\n authToken,\n customHeaders,\n debugLogs,\n signingContext: options.signingContext,\n authProvider: options.authProvider,\n signal: options.signal,\n requestTimeoutMs: options.requestTimeoutMs,\n fetchFn: options.fetchFn,\n handleLegacy: options.handleLegacy,\n },\n toolName,\n args\n )\n )\n );\n}\n\n/**\n * Probe an endpoint with the official v2 client's auto negotiation.\n * `connected: false` lets endpoint discovery retain its v1 SSE fallback.\n */\nexport async function probeModernMCPConnection(\n agentUrl: string,\n authToken?: string,\n customHeaders?: Record<string, string>,\n options: ModernMCPConnectionOptions = {}\n): Promise<{ connected: boolean; era?: 'legacy' | 'modern' }> {\n const connectionOptions: ModernConnectionOptions = {\n agentUrl,\n authToken,\n customHeaders,\n debugLogs: [],\n signingContext: options.signingContext,\n authProvider: options.authProvider,\n signal: options.signal,\n requestTimeoutMs: options.requestTimeoutMs,\n fetchFn: options.fetchFn,\n handleLegacy: options.handleLegacy,\n };\n const authHeaders = buildAuthHeaders(authToken, customHeaders, options.authProvider);\n let client: Client | undefined;\n try {\n client = await createNegotiatedClient(connectionOptions, authHeaders);\n return { connected: true, era: client.getProtocolEra() };\n } catch (error) {\n if (is401Error(error) || isAbortOrTimeoutError(error)) throw error;\n const status = httpStatusOf(error);\n if (status === 404 || status === 405) return { connected: false };\n throw error;\n } finally {\n await client?.close().catch(() => {});\n }\n}\n\n/** List tools when the endpoint selected the modern era; otherwise let the v1 caller continue. */\nexport async function tryListModernMCPTools(\n agentUrl: string,\n authToken?: string,\n customHeaders?: Record<string, string>,\n options: ModernMCPConnectionOptions = {}\n): Promise<ModernMCPListAttempt> {\n const connectionOptions: ModernConnectionOptions = {\n agentUrl,\n authToken,\n customHeaders,\n debugLogs: [],\n signingContext: options.signingContext,\n authProvider: options.authProvider,\n signal: options.signal,\n requestTimeoutMs: options.requestTimeoutMs,\n fetchFn: options.fetchFn,\n };\n const authHeaders = buildAuthHeaders(authToken, customHeaders, options.authProvider);\n let client: Client | undefined;\n try {\n client = await createNegotiatedClient(connectionOptions, authHeaders);\n if (client.getProtocolEra() !== 'modern') return { handled: false };\n const resolvedRequestTimeoutMs = resolveClientRequestTimeoutMs(options.requestTimeoutMs);\n const result = await client.listTools(undefined, {\n ...(options.signal && { signal: options.signal }),\n ...(resolvedRequestTimeoutMs !== undefined && { timeout: resolvedRequestTimeoutMs }),\n });\n return { handled: true, tools: result.tools };\n } catch (error) {\n if (is401Error(error) || isAbortOrTimeoutError(error)) throw error;\n const status = httpStatusOf(error);\n if (status === 404 || status === 405) return { handled: false };\n throw error;\n } finally {\n await client?.close().catch(() => {});\n }\n}\n\nexport async function closeModernMCPConnections(): Promise<void> {\n connectionGeneration++;\n const pending = [...pendingModernConnections.values()];\n pendingModernConnections.clear();\n const settled = await Promise.allSettled(pending);\n const clients = new Set(modernConnections.values());\n for (const result of settled) {\n if (result.status === 'fulfilled') clients.add(result.value);\n }\n modernConnections.clear();\n legacyConnectionExpiresAt.clear();\n knownLegacyConnections.clear();\n for (const client of clients) {\n try {\n await client.close();\n } catch {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