@adcp/sdk 15.9.1 → 16.0.0-beta.2
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/bin/adcp-identity.js +74 -0
- package/bin/adcp.js +2 -0
- package/dist/lib/adapters/keyed-account-backend.d.mts +37 -0
- package/dist/lib/adapters/keyed-account-backend.d.ts +37 -0
- package/dist/lib/adapters/keyed-account-backend.js +121 -0
- package/dist/lib/adapters/keyed-account-backend.mjs +94 -0
- package/dist/lib/adapters/keyed-account-store.d.mts +28 -0
- package/dist/lib/adapters/keyed-account-store.d.ts +28 -0
- package/dist/lib/adapters/keyed-account-store.js +227 -0
- package/dist/lib/adapters/keyed-account-store.mjs +203 -0
- package/dist/lib/core/SingleAgentClient.d.mts +25 -2
- package/dist/lib/core/SingleAgentClient.d.ts +25 -2
- package/dist/lib/core/SingleAgentClient.js +280 -62
- package/dist/lib/core/SingleAgentClient.mjs +282 -57
- package/dist/lib/core/TaskExecutor.d.mts +6 -0
- package/dist/lib/core/TaskExecutor.d.ts +6 -0
- package/dist/lib/core/TaskExecutor.js +66 -5
- package/dist/lib/core/TaskExecutor.mjs +71 -5
- package/dist/lib/core/postgres-webhook-registration-store.js +32 -5
- package/dist/lib/core/postgres-webhook-registration-store.mjs +32 -5
- package/dist/lib/core/redis-webhook-registration-store.js +23 -1
- package/dist/lib/core/redis-webhook-registration-store.mjs +23 -1
- package/dist/lib/core/webhook-registration.d.mts +7 -1
- package/dist/lib/core/webhook-registration.d.ts +7 -1
- package/dist/lib/core/webhook-registration.js +24 -2
- package/dist/lib/core/webhook-registration.mjs +23 -2
- package/dist/lib/identity-3.3/generated-compat.d.mts +34 -0
- package/dist/lib/identity-3.3/generated-compat.d.ts +34 -0
- package/dist/lib/identity-3.3/generated-compat.js +16 -0
- package/dist/lib/identity-3.3/generated-compat.mjs +0 -0
- package/dist/lib/identity-3.3/index.d.mts +10 -0
- package/dist/lib/identity-3.3/index.d.ts +10 -0
- package/dist/lib/identity-3.3/index.js +79 -0
- package/dist/lib/identity-3.3/index.mjs +50 -0
- package/dist/lib/identity-3.3/lifecycle.d.mts +125 -0
- package/dist/lib/identity-3.3/lifecycle.d.ts +125 -0
- package/dist/lib/identity-3.3/lifecycle.js +294 -0
- package/dist/lib/identity-3.3/lifecycle.mjs +272 -0
- package/dist/lib/identity-3.3/revocation.d.mts +86 -0
- package/dist/lib/identity-3.3/revocation.d.ts +86 -0
- package/dist/lib/identity-3.3/revocation.js +308 -0
- package/dist/lib/identity-3.3/revocation.mjs +286 -0
- package/dist/lib/identity-3.3/schemas.draft.d.mts +2472 -0
- package/dist/lib/identity-3.3/schemas.draft.d.ts +2472 -0
- package/dist/lib/identity-3.3/schemas.draft.js +1448 -0
- package/dist/lib/identity-3.3/schemas.draft.mjs +1428 -0
- package/dist/lib/identity-3.3/server.d.mts +46 -0
- package/dist/lib/identity-3.3/server.d.ts +46 -0
- package/dist/lib/identity-3.3/server.js +279 -0
- package/dist/lib/identity-3.3/server.mjs +260 -0
- package/dist/lib/identity-3.3/store.d.mts +24 -0
- package/dist/lib/identity-3.3/store.d.ts +24 -0
- package/dist/lib/identity-3.3/store.js +191 -0
- package/dist/lib/identity-3.3/store.mjs +169 -0
- package/dist/lib/identity-3.3/trust.d.mts +155 -0
- package/dist/lib/identity-3.3/trust.d.ts +155 -0
- package/dist/lib/identity-3.3/trust.js +383 -0
- package/dist/lib/identity-3.3/trust.mjs +342 -0
- package/dist/lib/identity-3.3/types.d.mts +155 -0
- package/dist/lib/identity-3.3/types.d.ts +155 -0
- package/dist/lib/identity-3.3/types.js +16 -0
- package/dist/lib/identity-3.3/types.mjs +0 -0
- package/dist/lib/identity-3.3/validation.d.mts +2 -0
- package/dist/lib/identity-3.3/validation.d.ts +2 -0
- package/dist/lib/identity-3.3/validation.js +125 -0
- package/dist/lib/identity-3.3/validation.mjs +91 -0
- package/dist/lib/index.d.mts +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +2 -0
- package/dist/lib/index.mjs +2 -0
- package/dist/lib/protocols/index.d.mts +1 -1
- package/dist/lib/protocols/index.d.ts +1 -1
- package/dist/lib/protocols/index.js +2 -2
- package/dist/lib/protocols/index.mjs +2 -2
- package/dist/lib/reporting/azure/index.d.mts +5 -0
- package/dist/lib/reporting/azure/index.d.ts +5 -0
- package/dist/lib/reporting/azure/index.js +26 -7
- package/dist/lib/reporting/azure/index.mjs +26 -7
- package/dist/lib/reporting/bigquery/index.d.mts +39 -5
- package/dist/lib/reporting/bigquery/index.d.ts +39 -5
- package/dist/lib/reporting/bigquery/index.js +26 -20
- package/dist/lib/reporting/bigquery/index.mjs +26 -20
- package/dist/lib/reporting/gcs/adapter.d.mts +8 -1
- package/dist/lib/reporting/gcs/adapter.d.ts +8 -1
- package/dist/lib/reporting/gcs/errors.d.mts +6 -0
- package/dist/lib/reporting/gcs/errors.d.ts +6 -0
- package/dist/lib/reporting/gcs/fence.d.mts +5 -0
- package/dist/lib/reporting/gcs/fence.d.ts +5 -0
- package/dist/lib/reporting/gcs/index.d.mts +9 -0
- package/dist/lib/reporting/gcs/index.d.ts +9 -0
- package/dist/lib/reporting/gcs/reader.d.mts +27 -3
- package/dist/lib/reporting/gcs/reader.d.ts +27 -3
- package/dist/lib/reporting/gcs/row-provider.d.mts +7 -0
- package/dist/lib/reporting/gcs/row-provider.d.ts +7 -0
- package/dist/lib/reporting/gcs/row-provider.js +34 -14
- package/dist/lib/reporting/gcs/row-provider.mjs +34 -14
- package/dist/lib/reporting/ledger/change-feed.d.mts +22 -1
- package/dist/lib/reporting/ledger/change-feed.d.ts +22 -1
- package/dist/lib/reporting/ledger/index.d.mts +11 -0
- package/dist/lib/reporting/ledger/index.d.ts +11 -0
- package/dist/lib/reporting/ledger/managed-postgres.d.mts +8 -0
- package/dist/lib/reporting/ledger/managed-postgres.d.ts +8 -0
- package/dist/lib/reporting/ledger/managed-router.d.mts +27 -2
- package/dist/lib/reporting/ledger/managed-router.d.ts +27 -2
- package/dist/lib/reporting/ledger/managed.d.mts +86 -6
- package/dist/lib/reporting/ledger/managed.d.ts +86 -6
- package/dist/lib/reporting/ledger/notification-activity.d.mts +65 -3
- package/dist/lib/reporting/ledger/notification-activity.d.ts +65 -3
- package/dist/lib/reporting/ledger/object-writes.d.mts +64 -5
- package/dist/lib/reporting/ledger/object-writes.d.ts +64 -5
- package/dist/lib/reporting/ledger/postgres.d.mts +43 -9
- package/dist/lib/reporting/ledger/postgres.d.ts +43 -9
- package/dist/lib/reporting/ledger/postgres.js +43 -27
- package/dist/lib/reporting/ledger/postgres.mjs +43 -27
- package/dist/lib/reporting/ledger/row-encoding.d.mts +92 -6
- package/dist/lib/reporting/ledger/row-encoding.d.ts +92 -6
- package/dist/lib/reporting/ledger/row-encoding.js +8 -4
- package/dist/lib/reporting/ledger/row-encoding.mjs +6 -3
- package/dist/lib/reporting/ledger/row-storage-errors.d.mts +11 -1
- package/dist/lib/reporting/ledger/row-storage-errors.d.ts +11 -1
- package/dist/lib/reporting/ledger/row-storage-migration.d.mts +19 -1
- package/dist/lib/reporting/ledger/row-storage-migration.d.ts +19 -1
- package/dist/lib/reporting/ledger/row-storage-migration.js +133 -18
- package/dist/lib/reporting/ledger/row-storage-migration.mjs +133 -18
- package/dist/lib/reporting/ledger/row-storage-object.d.mts +103 -12
- package/dist/lib/reporting/ledger/row-storage-object.d.ts +103 -12
- package/dist/lib/reporting/ledger/row-storage-object.js +106 -31
- package/dist/lib/reporting/ledger/row-storage-object.mjs +104 -31
- package/dist/lib/reporting/ledger/row-storage.d.mts +87 -20
- package/dist/lib/reporting/ledger/row-storage.d.ts +87 -20
- package/dist/lib/reporting/ledger/row-storage.js +126 -66
- package/dist/lib/reporting/ledger/row-storage.mjs +129 -67
- package/dist/lib/reporting/ledger/schedule.d.mts +13 -0
- package/dist/lib/reporting/ledger/schedule.d.ts +13 -0
- package/dist/lib/reporting/ledger/schedule.js +24 -0
- package/dist/lib/reporting/ledger/schedule.mjs +23 -0
- package/dist/lib/reporting/ledger/types.d.mts +23 -1
- package/dist/lib/reporting/ledger/types.d.ts +23 -1
- package/dist/lib/reporting/s3/index.d.mts +5 -0
- package/dist/lib/reporting/s3/index.d.ts +5 -0
- package/dist/lib/reporting/s3/index.js +37 -14
- package/dist/lib/reporting/s3/index.mjs +37 -14
- package/dist/lib/reporting/service/index.d.mts +10 -0
- package/dist/lib/reporting/service/index.d.ts +10 -0
- package/dist/lib/reporting/service/maintenance.d.mts +28 -2
- package/dist/lib/reporting/service/maintenance.d.ts +28 -2
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/server/account-sync-contract.d.mts +14 -0
- package/dist/lib/server/account-sync-contract.d.ts +14 -0
- package/dist/lib/server/account-sync-contract.js +225 -0
- package/dist/lib/server/account-sync-contract.mjs +197 -0
- package/dist/lib/server/adcp-server.js +5 -0
- package/dist/lib/server/adcp-server.mjs +10 -0
- package/dist/lib/server/auth-signature.d.mts +15 -0
- package/dist/lib/server/auth-signature.d.ts +15 -0
- package/dist/lib/server/auth-signature.js +72 -2
- package/dist/lib/server/auth-signature.mjs +81 -2
- package/dist/lib/server/auth.d.mts +6 -0
- package/dist/lib/server/auth.d.ts +6 -0
- package/dist/lib/server/auth.js +6 -0
- package/dist/lib/server/auth.mjs +6 -0
- package/dist/lib/server/create-adcp-server.d.mts +19 -5
- package/dist/lib/server/create-adcp-server.d.ts +19 -5
- package/dist/lib/server/create-adcp-server.js +259 -19
- package/dist/lib/server/create-adcp-server.mjs +266 -10
- package/dist/lib/server/decisioning/account.d.mts +24 -1
- package/dist/lib/server/decisioning/account.d.ts +24 -1
- package/dist/lib/server/decisioning/index.d.mts +1 -1
- package/dist/lib/server/decisioning/index.d.ts +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.d.mts +0 -50
- package/dist/lib/server/decisioning/runtime/from-platform.d.ts +0 -50
- package/dist/lib/server/decisioning/runtime/from-platform.js +61 -11
- package/dist/lib/server/decisioning/runtime/from-platform.mjs +65 -12
- package/dist/lib/server/index.d.mts +2 -0
- package/dist/lib/server/index.d.ts +2 -0
- package/dist/lib/server/index.js +12 -0
- package/dist/lib/server/index.mjs +12 -0
- package/dist/lib/server/notification-subscriptions/runtime.js +9 -1
- package/dist/lib/server/notification-subscriptions/runtime.mjs +9 -1
- package/dist/lib/server/notification-subscriptions/types.d.mts +5 -0
- package/dist/lib/server/notification-subscriptions/types.d.ts +5 -0
- package/dist/lib/server/principal/types.d.mts +1 -1
- package/dist/lib/server/principal/types.d.ts +1 -1
- package/dist/lib/server/serve.js +5 -0
- package/dist/lib/server/serve.mjs +5 -0
- package/dist/lib/server/webhook-delivery/recovery.d.mts +1 -0
- package/dist/lib/server/webhook-delivery/recovery.d.ts +1 -0
- package/dist/lib/server/webhook-delivery/recovery.js +4 -0
- package/dist/lib/server/webhook-delivery/recovery.mjs +4 -0
- package/dist/lib/server/webhook-emitter.d.mts +10 -0
- package/dist/lib/server/webhook-emitter.d.ts +10 -0
- package/dist/lib/server/webhook-emitter.js +22 -0
- package/dist/lib/server/webhook-emitter.mjs +22 -0
- package/dist/lib/signing/agent-context.d.mts +0 -5
- package/dist/lib/signing/agent-context.d.ts +0 -5
- package/dist/lib/signing/agent-context.js +9 -1
- package/dist/lib/signing/agent-context.mjs +9 -1
- package/dist/lib/signing/agent-fetch.js +27 -2
- package/dist/lib/signing/agent-fetch.mjs +32 -2
- package/dist/lib/signing/agent-resolver/canonicalize.d.mts +10 -15
- package/dist/lib/signing/agent-resolver/canonicalize.d.ts +10 -15
- package/dist/lib/signing/agent-resolver/canonicalize.js +17 -5
- package/dist/lib/signing/agent-resolver/canonicalize.mjs +16 -5
- package/dist/lib/signing/agent-resolver/index.d.mts +1 -0
- package/dist/lib/signing/agent-resolver/index.d.ts +1 -0
- package/dist/lib/signing/agent-resolver/index.js +5 -0
- package/dist/lib/signing/agent-resolver/index.mjs +3 -0
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.mts +3 -2
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.ts +3 -2
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.js +30 -3
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.mjs +30 -3
- package/dist/lib/signing/agent-resolver/strict-json.d.mts +2 -2
- package/dist/lib/signing/agent-resolver/strict-json.d.ts +2 -2
- package/dist/lib/signing/agent-resolver/strict-json.js +5 -3
- package/dist/lib/signing/agent-resolver/strict-json.mjs +5 -3
- package/dist/lib/signing/brand-jwks.d.mts +2 -2
- package/dist/lib/signing/brand-jwks.d.ts +2 -2
- package/dist/lib/signing/brand-jwks.js +4 -4
- package/dist/lib/signing/brand-jwks.mjs +4 -4
- package/dist/lib/signing/client.d.mts +1 -0
- package/dist/lib/signing/client.d.ts +1 -0
- package/dist/lib/signing/client.js +5 -0
- package/dist/lib/signing/client.mjs +3 -0
- package/dist/lib/signing/crypto.js +8 -0
- package/dist/lib/signing/crypto.mjs +9 -1
- package/dist/lib/signing/fetch-async.js +1 -1
- package/dist/lib/signing/fetch-async.mjs +1 -1
- package/dist/lib/signing/fetch.js +1 -1
- package/dist/lib/signing/fetch.mjs +1 -1
- package/dist/lib/signing/jwks-https.d.mts +1 -1
- package/dist/lib/signing/jwks-https.d.ts +1 -1
- package/dist/lib/signing/jwks-https.js +1 -1
- package/dist/lib/signing/jwks-https.mjs +1 -1
- package/dist/lib/signing/jwks.d.mts +11 -3
- package/dist/lib/signing/jwks.d.ts +11 -3
- package/dist/lib/signing/jwks.js +1 -1
- package/dist/lib/signing/jwks.mjs +1 -1
- package/dist/lib/signing/middleware.js +9 -0
- package/dist/lib/signing/middleware.mjs +14 -0
- package/dist/lib/signing/parser.d.mts +9 -6
- package/dist/lib/signing/parser.d.ts +9 -6
- package/dist/lib/signing/parser.js +82 -64
- package/dist/lib/signing/parser.mjs +83 -65
- package/dist/lib/signing/revocation.d.mts +4 -1
- package/dist/lib/signing/revocation.d.ts +4 -1
- package/dist/lib/signing/revocation.js +36 -3
- package/dist/lib/signing/revocation.mjs +34 -2
- package/dist/lib/signing/server.d.mts +1 -1
- package/dist/lib/signing/server.d.ts +1 -1
- package/dist/lib/signing/server.js +4 -0
- package/dist/lib/signing/server.mjs +4 -0
- package/dist/lib/signing/types.d.mts +3 -0
- package/dist/lib/signing/types.d.ts +3 -0
- package/dist/lib/signing/verifier.js +1 -1
- package/dist/lib/signing/verifier.mjs +1 -1
- package/dist/lib/signing/web-bot-auth.d.mts +191 -0
- package/dist/lib/signing/web-bot-auth.d.ts +191 -0
- package/dist/lib/signing/web-bot-auth.js +837 -0
- package/dist/lib/signing/web-bot-auth.mjs +796 -0
- package/dist/lib/signing/webhook-verifier.js +1 -1
- package/dist/lib/signing/webhook-verifier.mjs +1 -1
- package/dist/lib/testing/client.d.mts +1 -4
- package/dist/lib/testing/client.d.ts +1 -4
- package/dist/lib/testing/client.js +141 -20
- package/dist/lib/testing/client.mjs +137 -19
- package/dist/lib/testing/compliance/comply.js +29 -10
- package/dist/lib/testing/compliance/comply.mjs +37 -11
- package/dist/lib/testing/storyboard/account-sync-contract.d.mts +3 -0
- package/dist/lib/testing/storyboard/account-sync-contract.d.ts +3 -0
- package/dist/lib/testing/storyboard/account-sync-contract.js +79 -0
- package/dist/lib/testing/storyboard/account-sync-contract.mjs +55 -0
- package/dist/lib/testing/storyboard/default-invariants.js +2 -0
- package/dist/lib/testing/storyboard/default-invariants.mjs +2 -0
- package/dist/lib/testing/storyboard/runner.js +23 -8
- package/dist/lib/testing/storyboard/runner.mjs +24 -8
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/types/adcp.d.mts +4 -0
- package/dist/lib/types/adcp.d.ts +4 -0
- package/dist/lib/types/schemas.generated.d.ts +6 -6
- package/dist/lib/utils/capabilities.d.mts +1 -0
- package/dist/lib/utils/capabilities.d.ts +1 -0
- package/dist/lib/utils/capabilities.js +5 -0
- package/dist/lib/utils/capabilities.mjs +5 -0
- package/dist/lib/v2/projection/catalog-snapshot.js +3 -1
- package/dist/lib/v2/projection/catalog-snapshot.mjs +3 -1
- package/dist/lib/v2/projection/creative-delivery.d.mts +34 -10
- package/dist/lib/v2/projection/creative-delivery.d.ts +34 -10
- package/dist/lib/v2/projection/creative-delivery.js +26 -10
- package/dist/lib/v2/projection/creative-delivery.mjs +26 -10
- package/dist/lib/v2/projection/index.d.mts +1 -1
- package/dist/lib/v2/projection/index.d.ts +1 -1
- package/dist/lib/v2/projection/index.js +2 -0
- package/dist/lib/v2/projection/index.mjs +2 -0
- package/dist/lib/v2/projection/legacy-routes.d.mts +34 -2
- package/dist/lib/v2/projection/legacy-routes.d.ts +34 -2
- package/dist/lib/v2/projection/legacy-routes.js +35 -2
- package/dist/lib/v2/projection/legacy-routes.mjs +32 -2
- package/dist/lib/validation/schema-loader.d.mts +2 -0
- package/dist/lib/validation/schema-loader.d.ts +2 -0
- package/dist/lib/validation/schema-loader.js +43 -4
- package/dist/lib/validation/schema-loader.mjs +39 -3
- package/dist/lib/version.d.mts +3 -3
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/dist/lib/version.mjs +3 -3
- package/docs/TYPE-SUMMARY.md +2 -2
- package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +4 -0
- package/docs/guides/REPORTING-LEDGER-CUTOVER.md +1 -1
- package/docs/guides/REPORTING-LEDGER.md +99 -29
- package/docs/guides/REPORTING-OPERATIONS.md +29 -13
- package/docs/guides/REPORTING-STABILITY.md +76 -0
- package/docs/guides/account-resolution.md +101 -0
- package/docs/llms.txt +3 -2
- package/docs/migration-12-to-13.md +15 -0
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/docs/migration-agent-identity-3.3.md +494 -0
- package/docs/migration-agent-resolution-3.3.md +5 -0
- package/docs/migration-reporting-row-storage-alignment.md +137 -0
- package/examples/storyboards/account-sync-contract.yaml +57 -0
- package/package.json +17 -1
|
@@ -3,6 +3,15 @@ import { dirname as __adcpDirname } from "node:path";
|
|
|
3
3
|
import { createRequire as __adcpCreateRequire } from "node:module";
|
|
4
4
|
const __dirname = __adcpDirname(__adcpFileURLToPath(import.meta.url));
|
|
5
5
|
const require2 = __adcpCreateRequire(import.meta.url);
|
|
6
|
+
import {
|
|
7
|
+
isIdentity33SchemaScope,
|
|
8
|
+
withIdentity33SchemaScope,
|
|
9
|
+
bindIdentity33SchemaScope
|
|
10
|
+
} from "../validation/schema-loader.mjs";
|
|
11
|
+
function loadWebBotAuth() {
|
|
12
|
+
return require2("../signing/web-bot-auth");
|
|
13
|
+
}
|
|
14
|
+
import { canonicalAgentOrigin } from "../signing/agent-resolver/canonicalize.mjs";
|
|
6
15
|
import {
|
|
7
16
|
annotateProductsSupplyPaths
|
|
8
17
|
} from "../supply-path/products.mjs";
|
|
@@ -74,6 +83,7 @@ import {
|
|
|
74
83
|
canonicalDelegatedOperatorAuthorization,
|
|
75
84
|
InMemoryWebhookRegistrationStore,
|
|
76
85
|
parseWebhookRegistration,
|
|
86
|
+
deliveryWebhookRegistrationId,
|
|
77
87
|
sameWebhookRegistration,
|
|
78
88
|
WebhookRegistrationIntegrityError,
|
|
79
89
|
validateWebhookRegistrationAuthorization
|
|
@@ -168,6 +178,8 @@ import {
|
|
|
168
178
|
} from "../v2/projection/creative-delivery.mjs";
|
|
169
179
|
import {
|
|
170
180
|
formatOptionOriginFromRoutes,
|
|
181
|
+
sameFormatOptionRef,
|
|
182
|
+
sellerDeclaredFormatOptionRefs,
|
|
171
183
|
undeclaredFormatOptionSelector
|
|
172
184
|
} from "../v2/projection/legacy-routes.mjs";
|
|
173
185
|
import {
|
|
@@ -826,6 +838,11 @@ class SingleAgentClient {
|
|
|
826
838
|
constructor(agent, config = {}) {
|
|
827
839
|
this.agent = agent;
|
|
828
840
|
this.config = config;
|
|
841
|
+
if (config.experimentalIdentity33 === true !== isIdentity33SchemaScope())
|
|
842
|
+
return withIdentity33SchemaScope(() => {
|
|
843
|
+
const instance = Reflect.construct(SingleAgentClient, [agent, config], new.target);
|
|
844
|
+
return config.experimentalIdentity33 ? bindIdentity33SchemaScope(instance) : instance;
|
|
845
|
+
}, config.experimentalIdentity33 === true);
|
|
829
846
|
const configuredTransport = config.transport === void 0 ? void 0 : { ...config.transport };
|
|
830
847
|
const configuredWebhookVerification = config.webhookVerification === void 0 ? void 0 : {
|
|
831
848
|
...config.webhookVerification,
|
|
@@ -840,7 +857,9 @@ class SingleAgentClient {
|
|
|
840
857
|
};
|
|
841
858
|
config = this.config;
|
|
842
859
|
validateAgentDiscoveryCacheConfig(config.discoveryCache);
|
|
843
|
-
this.resolvedAdcpVersion = resolveAdcpVersion(
|
|
860
|
+
this.resolvedAdcpVersion = resolveAdcpVersion(
|
|
861
|
+
config.adcpVersion ?? (config.experimentalIdentity33 ? "3.3" : void 0)
|
|
862
|
+
);
|
|
844
863
|
this.webhookRegistrationStore = config.webhookRegistrationStore ?? new InMemoryWebhookRegistrationStore();
|
|
845
864
|
this.webhookReplayStore = config.webhookVerification?.replayStore ?? new InMemoryReplayStore();
|
|
846
865
|
this.webhookRevocationStore = config.webhookVerification?.revocationStore ?? new InMemoryRevocationStore();
|
|
@@ -899,6 +918,10 @@ class SingleAgentClient {
|
|
|
899
918
|
webhookUrlTemplate: config.webhookUrlTemplate,
|
|
900
919
|
agentId: agent.id,
|
|
901
920
|
webhookSecret: config.webhookSecret,
|
|
921
|
+
identity33SchemaExperiment: config.experimentalIdentity33,
|
|
922
|
+
experimentalIdentity33: () => this.config.experimentalIdentity33 === true && this.usesIdentity33Schemas(),
|
|
923
|
+
signedIdentity33Webhooks: () => this.usesSigned33Webhooks(),
|
|
924
|
+
webhookSigningProfile: () => this.selectedWebhookSigningProfile(),
|
|
902
925
|
onWebhookRegistration: (registration) => this.persistWebhookRegistration(registration),
|
|
903
926
|
onDurableSettlementRequired: (operationId) => this.markWebhookDurableSettlementRequired(operationId),
|
|
904
927
|
externalTaskSettlementRetentionMs: registrationTtl * 1e3,
|
|
@@ -1154,6 +1177,7 @@ class SingleAgentClient {
|
|
|
1154
1177
|
// Cache canonical base URL (from agent card or stripped /mcp)
|
|
1155
1178
|
cachedCapabilities;
|
|
1156
1179
|
// Cache detected server capabilities
|
|
1180
|
+
runAgentInfo;
|
|
1157
1181
|
cachedToolSchemas;
|
|
1158
1182
|
// inputSchema.properties per tool name
|
|
1159
1183
|
primedCapabilitiesExpiresAt;
|
|
@@ -1210,18 +1234,18 @@ class SingleAgentClient {
|
|
|
1210
1234
|
persistedAgentUrl.username = "";
|
|
1211
1235
|
persistedAgentUrl.password = "";
|
|
1212
1236
|
persistedAgentUrl.hash = "";
|
|
1213
|
-
const delegatedOperatorAuthorization = this.effectiveDelegatedOperatorAuthorization(
|
|
1214
|
-
args.delegatedOperatorAuthorization
|
|
1215
|
-
);
|
|
1237
|
+
const delegatedOperatorAuthorization = args.deliveryKind ? void 0 : this.effectiveDelegatedOperatorAuthorization(args.delegatedOperatorAuthorization);
|
|
1216
1238
|
const registration = {
|
|
1217
1239
|
agentId: args.agent.id,
|
|
1218
1240
|
agentUrl: persistedAgentUrl.toString(),
|
|
1219
1241
|
protocol: args.agent.protocol,
|
|
1220
1242
|
operationId: args.operationId,
|
|
1221
1243
|
taskType: args.taskType,
|
|
1222
|
-
callbackUrl: args.callbackUrl,
|
|
1244
|
+
callbackUrl: args.deliveryKind ? canonicalTargetUri(args.callbackUrl, "3.2") : args.callbackUrl,
|
|
1223
1245
|
method: "POST",
|
|
1224
1246
|
mode: args.mode,
|
|
1247
|
+
...args.signingProfile && { signingProfile: args.signingProfile },
|
|
1248
|
+
...args.deliveryKind && { deliveryKind: args.deliveryKind },
|
|
1225
1249
|
authorizationContextVersion: 1,
|
|
1226
1250
|
...delegatedOperatorAuthorization !== void 0 && { delegatedOperatorAuthorization },
|
|
1227
1251
|
...previewMode && { previewMode },
|
|
@@ -1230,6 +1254,14 @@ class SingleAgentClient {
|
|
|
1230
1254
|
};
|
|
1231
1255
|
validateWebhookRegistrationAuthorization(registration);
|
|
1232
1256
|
try {
|
|
1257
|
+
if (args.deliveryKind) {
|
|
1258
|
+
const previous = await this.webhookRegistrationStore.get(args.agent.id, args.operationId);
|
|
1259
|
+
if (previous && previous.expiresAt > nowMs && (previous.signingProfile ?? "adcp/webhook-signing/v1") !== (registration.signingProfile ?? "adcp/webhook-signing/v1"))
|
|
1260
|
+
throw new ConfigurationError(
|
|
1261
|
+
`${args.deliveryKind} callback is already registered with ${previous.signingProfile ?? "adcp/webhook-signing/v1"}. Use a new callback URL or delete its old registration after outstanding deliveries finish.`,
|
|
1262
|
+
`${args.deliveryKind}_webhook.signing_profile`
|
|
1263
|
+
);
|
|
1264
|
+
}
|
|
1233
1265
|
await this.webhookRegistrationStore.putIfAbsent(registration);
|
|
1234
1266
|
const persisted = await this.webhookRegistrationStore.get(args.agent.id, args.operationId);
|
|
1235
1267
|
if (!persisted || !sameWebhookRegistration(
|
|
@@ -1241,6 +1273,8 @@ class SingleAgentClient {
|
|
|
1241
1273
|
);
|
|
1242
1274
|
}
|
|
1243
1275
|
} catch (cause) {
|
|
1276
|
+
if (args.deliveryKind && cause instanceof ConfigurationError && cause.configField === `${args.deliveryKind}_webhook.signing_profile`)
|
|
1277
|
+
throw cause;
|
|
1244
1278
|
if (args.mode === "rfc9421" || !RECORDLESS_HMAC_READ_ONLY_TASKS.has(args.taskType)) {
|
|
1245
1279
|
const error = new ConfigurationError("Could not persist trusted webhook registration for this operation.");
|
|
1246
1280
|
Object.defineProperty(error, "cause", { value: cause, configurable: true });
|
|
@@ -1402,7 +1436,7 @@ class SingleAgentClient {
|
|
|
1402
1436
|
return canonicalizeJson([this.canonicalAccountScope(account), "package", packageId]);
|
|
1403
1437
|
}
|
|
1404
1438
|
sameCanonicalOptionRef(left, right) {
|
|
1405
|
-
return
|
|
1439
|
+
return sameFormatOptionRef(left, right);
|
|
1406
1440
|
}
|
|
1407
1441
|
rememberCanonicalLegacyRoute(key, route) {
|
|
1408
1442
|
this.canonicalLegacyRoutes.delete(key);
|
|
@@ -1473,20 +1507,7 @@ class SingleAgentClient {
|
|
|
1473
1507
|
if (!value || typeof value !== "object" || Array.isArray(value)) continue;
|
|
1474
1508
|
const product = value;
|
|
1475
1509
|
if (typeof product.product_id !== "string") continue;
|
|
1476
|
-
|
|
1477
|
-
for (const optionValue of Array.isArray(product.format_options) ? product.format_options : []) {
|
|
1478
|
-
if (!optionValue || typeof optionValue !== "object" || Array.isArray(optionValue)) continue;
|
|
1479
|
-
const option = optionValue;
|
|
1480
|
-
if (typeof option.format_option_id !== "string") continue;
|
|
1481
|
-
refs.push(
|
|
1482
|
-
typeof option.publisher_domain === "string" ? {
|
|
1483
|
-
scope: "publisher",
|
|
1484
|
-
publisher_domain: option.publisher_domain,
|
|
1485
|
-
format_option_id: option.format_option_id
|
|
1486
|
-
} : { scope: "product", format_option_id: option.format_option_id }
|
|
1487
|
-
);
|
|
1488
|
-
}
|
|
1489
|
-
declared.set(product.product_id, refs);
|
|
1510
|
+
declared.set(product.product_id, sellerDeclaredFormatOptionRefs(product));
|
|
1490
1511
|
}
|
|
1491
1512
|
return declared;
|
|
1492
1513
|
}
|
|
@@ -1906,9 +1927,10 @@ class SingleAgentClient {
|
|
|
1906
1927
|
*/
|
|
1907
1928
|
async ensureEndpointDiscovered(options) {
|
|
1908
1929
|
throwIfAborted(options?.signal);
|
|
1930
|
+
if (this.config._reuseConfiguredDiscovery?.()) this.synchronizeCapabilityEvidenceAuthorizationScope();
|
|
1909
1931
|
const needsDiscovery = this.normalizedAgent._needsDiscovery;
|
|
1910
1932
|
const transport = normalizeTransportOptions(options?.transport ?? this.config.transport);
|
|
1911
|
-
const usesScopedFetch =
|
|
1933
|
+
const usesScopedFetch = this.usesScopedDiscoveryTransport(options);
|
|
1912
1934
|
if (!needsDiscovery) {
|
|
1913
1935
|
return this.normalizedAgent;
|
|
1914
1936
|
}
|
|
@@ -2014,7 +2036,7 @@ class SingleAgentClient {
|
|
|
2014
2036
|
throwIfAborted(options?.signal);
|
|
2015
2037
|
const needsCanonicalUrl = this.normalizedAgent._needsCanonicalUrl;
|
|
2016
2038
|
const transport = normalizeTransportOptions(options?.transport ?? this.config.transport);
|
|
2017
|
-
const usesScopedFetch =
|
|
2039
|
+
const usesScopedFetch = this.usesScopedDiscoveryTransport(options);
|
|
2018
2040
|
if (!needsCanonicalUrl) {
|
|
2019
2041
|
return this.normalizedAgent;
|
|
2020
2042
|
}
|
|
@@ -2033,8 +2055,11 @@ class SingleAgentClient {
|
|
|
2033
2055
|
signal: options?.signal
|
|
2034
2056
|
});
|
|
2035
2057
|
}
|
|
2058
|
+
const canonicalEpoch = this.discoveryEpochSnapshot(options);
|
|
2036
2059
|
const canonicalUrl = await this.fetchA2ACanonicalUrl(this.normalizedAgent.agent_uri, options);
|
|
2037
|
-
if (!usesScopedFetch
|
|
2060
|
+
if (!usesScopedFetch && (!canonicalEpoch || this.discoveryEpochIs(canonicalEpoch))) {
|
|
2061
|
+
this.canonicalBaseUrl = canonicalUrl;
|
|
2062
|
+
}
|
|
2038
2063
|
return {
|
|
2039
2064
|
...this.normalizedAgent,
|
|
2040
2065
|
agent_uri: canonicalUrl
|
|
@@ -2159,7 +2184,9 @@ class SingleAgentClient {
|
|
|
2159
2184
|
const { connectMCPWithFallback } = await import("../protocols/mcp.mjs");
|
|
2160
2185
|
const { probeModernMCPConnection } = await import("../protocols/mcp-modern.mjs");
|
|
2161
2186
|
const transport = normalizeTransportOptions(options?.transport ?? this.config.transport);
|
|
2162
|
-
const usesScopedFetch =
|
|
2187
|
+
const usesScopedFetch = this.usesScopedDiscoveryTransport(options);
|
|
2188
|
+
const endpointEpoch = this.discoveryEpochSnapshot(options);
|
|
2189
|
+
const mayRetain = () => !usesScopedFetch && (!endpointEpoch || this.discoveryEpochIs(endpointEpoch));
|
|
2163
2190
|
const authToken = this.normalizedAgent.oauth_client_credentials ? this.normalizedAgent.oauth_tokens?.access_token : this.agent.auth_token;
|
|
2164
2191
|
const agentHeaders = this.agent.headers;
|
|
2165
2192
|
const authHeaders = createMCPRequestHeaders(agentHeaders, authToken);
|
|
@@ -2179,7 +2206,7 @@ class SingleAgentClient {
|
|
|
2179
2206
|
allowPrivateIp: transport?.allowPrivateIp
|
|
2180
2207
|
});
|
|
2181
2208
|
if (modern.connected) {
|
|
2182
|
-
if (
|
|
2209
|
+
if (mayRetain()) {
|
|
2183
2210
|
this.discoveredMcpEra = modern.era;
|
|
2184
2211
|
this.discoveredMcpEraAt = Date.now();
|
|
2185
2212
|
}
|
|
@@ -2198,7 +2225,7 @@ class SingleAgentClient {
|
|
|
2198
2225
|
}
|
|
2199
2226
|
);
|
|
2200
2227
|
await client.close();
|
|
2201
|
-
if (
|
|
2228
|
+
if (mayRetain()) {
|
|
2202
2229
|
this.discoveredMcpEra = "legacy";
|
|
2203
2230
|
this.discoveredMcpEraAt = Date.now();
|
|
2204
2231
|
}
|
|
@@ -2375,7 +2402,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
2375
2402
|
async verifyAndParseWebhook(options) {
|
|
2376
2403
|
const rawBody = options.rawBody ?? rawBodyFromUnknown(options.body);
|
|
2377
2404
|
const authHeaders = inspectWebhookAuthenticationHeaders(options.headers, options.signature, options.timestamp);
|
|
2378
|
-
|
|
2405
|
+
let trustedOperationId = options.operationId && options.operationId !== "unknown" ? options.operationId : void 0;
|
|
2379
2406
|
let registration;
|
|
2380
2407
|
if (trustedOperationId) {
|
|
2381
2408
|
let stored;
|
|
@@ -2416,6 +2443,24 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
2416
2443
|
}
|
|
2417
2444
|
}
|
|
2418
2445
|
}
|
|
2446
|
+
if (!registration && options.requestUrl && ["media_buy_delivery", "artifact_delivery"].includes(options.taskType ?? "")) {
|
|
2447
|
+
const kind = options.taskType === "artifact_delivery" ? "artifact" : "reporting";
|
|
2448
|
+
const routeId = deliveryWebhookRegistrationId(kind, options.requestUrl);
|
|
2449
|
+
try {
|
|
2450
|
+
const stored = await this.webhookRegistrationStore.get(this.agent.id, routeId);
|
|
2451
|
+
if (stored) {
|
|
2452
|
+
registration = parseWebhookRegistration(stored, { agentId: this.agent.id, operationId: routeId });
|
|
2453
|
+
trustedOperationId = routeId;
|
|
2454
|
+
}
|
|
2455
|
+
} catch (cause) {
|
|
2456
|
+
return {
|
|
2457
|
+
ok: false,
|
|
2458
|
+
code: "webhook_registration_store_unavailable",
|
|
2459
|
+
message: "Delivery registration state is unavailable",
|
|
2460
|
+
cause
|
|
2461
|
+
};
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2419
2464
|
if (registration) {
|
|
2420
2465
|
const nowMs = this.config.webhookVerification?.now ? Math.floor(this.config.webhookVerification.now() * 1e3) : Date.now();
|
|
2421
2466
|
if (registration.expiresAt <= nowMs) registration = void 0;
|
|
@@ -2496,6 +2541,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
2496
2541
|
}
|
|
2497
2542
|
}
|
|
2498
2543
|
if (registration?.mode === "rfc9421") {
|
|
2544
|
+
const { verifyWebBotAuth, selectSignatureProfile, WebBotAuthError, WebBotAuthUnavailableError } = loadWebBotAuth();
|
|
2499
2545
|
const requestMethod = options.requestMethod;
|
|
2500
2546
|
const requestUrl = options.requestUrl;
|
|
2501
2547
|
if (rawBody === void 0 || !options.headers || !trustedOperationId || !requestMethod || !requestUrl) {
|
|
@@ -2508,28 +2554,81 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
2508
2554
|
const normalizedHeaders = normalizeRfc9421WebhookHeaders(options.headers);
|
|
2509
2555
|
if (!normalizedHeaders.ok) return normalizedHeaders.failure;
|
|
2510
2556
|
try {
|
|
2511
|
-
const
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2557
|
+
const actualProfile = selectSignatureProfile({ headers: normalizedHeaders.headers });
|
|
2558
|
+
if (registration.signingProfile === "web-bot-auth") {
|
|
2559
|
+
if (registration.delegatedOperatorAuthorization || await this.config.webhookVerification?.publisherPins?.(registration))
|
|
2560
|
+
throw new WebBotAuthError(403, "legacy_webhook_authorization_requires_rfc_profile");
|
|
2561
|
+
const config = this.config.webhookVerification?.webBotAuth;
|
|
2562
|
+
if (!config) throw new WebBotAuthError(403, "webhook_profile_not_configured");
|
|
2563
|
+
const signers = await verifyWebBotAuth(
|
|
2564
|
+
{
|
|
2565
|
+
method: requestMethod,
|
|
2566
|
+
url: requestUrl,
|
|
2567
|
+
headers: normalizedHeaders.headers,
|
|
2568
|
+
body: typeof rawBody === "string" ? rawBody : (
|
|
2569
|
+
// ignoreBOM: Content-Digest covers the exact received bytes.
|
|
2570
|
+
new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(rawBody)
|
|
2571
|
+
)
|
|
2572
|
+
},
|
|
2573
|
+
{
|
|
2574
|
+
directory: config.directory,
|
|
2575
|
+
replayStore: this.webhookReplayStore,
|
|
2576
|
+
...config.isRevoked && !config.revocation && { isRevoked: config.isRevoked },
|
|
2577
|
+
now: this.config.webhookVerification?.now
|
|
2529
2578
|
}
|
|
2530
|
-
|
|
2531
|
-
|
|
2579
|
+
);
|
|
2580
|
+
if (signers.length !== 1 || signers[0].origin !== canonicalAgentOrigin(registration.agentUrl))
|
|
2581
|
+
throw new WebBotAuthError(403, "webhook_signer_mismatch");
|
|
2582
|
+
if (config.revocation) {
|
|
2583
|
+
let status;
|
|
2584
|
+
try {
|
|
2585
|
+
status = await config.revocation.status(signers[0].origin, signers[0].keyid);
|
|
2586
|
+
} catch (error) {
|
|
2587
|
+
throw new WebBotAuthUnavailableError("revocation_persistence_failed", error);
|
|
2588
|
+
}
|
|
2589
|
+
if (status === "revoked") throw new WebBotAuthError(403, "key_revoked");
|
|
2590
|
+
if (status === "unknown") throw new WebBotAuthError(403, "identity_unverified");
|
|
2591
|
+
} else if (!config.isRevoked) throw new WebBotAuthError(403, "webhook_revocation_not_configured");
|
|
2592
|
+
} else {
|
|
2593
|
+
if (actualProfile === "web-bot-auth") throw new WebBotAuthError(403, "webhook_profile_mismatch");
|
|
2594
|
+
const delegatedOperatorAuthorization = this.delegatedOperatorAuthorizationForRegistration(registration);
|
|
2595
|
+
await verifyRfc9421WebhookSignature(
|
|
2596
|
+
{
|
|
2597
|
+
method: requestMethod,
|
|
2598
|
+
url: requestUrl,
|
|
2599
|
+
headers: normalizedHeaders.headers,
|
|
2600
|
+
body: rawBody
|
|
2601
|
+
},
|
|
2602
|
+
{
|
|
2603
|
+
jwks: this.webhookJwksFor(registration),
|
|
2604
|
+
publisherPins: await this.config.webhookVerification?.publisherPins?.(registration),
|
|
2605
|
+
onKeyResolutionError: this.config.webhookVerification?.onKeyResolutionError,
|
|
2606
|
+
replayStore: this.webhookReplayStore,
|
|
2607
|
+
revocationStore: this.webhookRevocationStore,
|
|
2608
|
+
...this.config.webhookVerification?.now && { now: this.config.webhookVerification.now },
|
|
2609
|
+
agentUrlForKeyid: () => registration.agentUrl,
|
|
2610
|
+
...registration.authorizationContextVersion === 1 && {
|
|
2611
|
+
replayScopeBinding: `delegated-operator:v1:${crypto.createHash("sha256").update(canonicalDelegatedOperatorAuthorization(delegatedOperatorAuthorization)).digest("base64url")}`
|
|
2612
|
+
}
|
|
2613
|
+
}
|
|
2614
|
+
);
|
|
2615
|
+
}
|
|
2532
2616
|
} catch (cause) {
|
|
2617
|
+
if (cause instanceof WebBotAuthUnavailableError)
|
|
2618
|
+
return { ok: false, code: "webhook_verification_unavailable", message: cause.message, cause };
|
|
2619
|
+
if (cause instanceof WebBotAuthError)
|
|
2620
|
+
return {
|
|
2621
|
+
ok: false,
|
|
2622
|
+
code: [
|
|
2623
|
+
"directory_unavailable",
|
|
2624
|
+
"directory_fetch_limit",
|
|
2625
|
+
"directory_expired",
|
|
2626
|
+
"identity_unverified",
|
|
2627
|
+
"verification_unavailable"
|
|
2628
|
+
].includes(cause.reason) ? "webhook_verification_unavailable" : "webhook_signature_invalid",
|
|
2629
|
+
message: cause.message,
|
|
2630
|
+
cause
|
|
2631
|
+
};
|
|
2533
2632
|
if (cause instanceof WebhookSignatureError) {
|
|
2534
2633
|
if (cause.retryable)
|
|
2535
2634
|
return {
|
|
@@ -2609,6 +2708,45 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
2609
2708
|
if (!parsedPayload.ok) {
|
|
2610
2709
|
return parsedPayload;
|
|
2611
2710
|
}
|
|
2711
|
+
if (registration?.deliveryKind) {
|
|
2712
|
+
const loader = require2("../validation/schema-loader");
|
|
2713
|
+
const body = parsedPayload.payload;
|
|
2714
|
+
const isReport = registration.deliveryKind === "reporting";
|
|
2715
|
+
const payload = isReport ? body.result : body;
|
|
2716
|
+
const schemaRef = isReport ? "media-buy/media-buy-delivery-webhook-result.json" : "content-standards/artifact-webhook-payload.json";
|
|
2717
|
+
const validator = loader.getSchemaValidatorByRef(schemaRef, this.resolvedAdcpVersion);
|
|
2718
|
+
const envelopeValidator = isReport ? loader.getSchemaValidatorByRef("core/mcp-webhook-payload.json", this.resolvedAdcpVersion) : void 0;
|
|
2719
|
+
if (!validator || !validator(payload) || isReport && (!envelopeValidator || !envelopeValidator(body) || body.task_type !== "media_buy_delivery"))
|
|
2720
|
+
return {
|
|
2721
|
+
ok: false,
|
|
2722
|
+
code: "webhook_envelope_invalid",
|
|
2723
|
+
message: "Authenticated delivery does not match its registered payload kind"
|
|
2724
|
+
};
|
|
2725
|
+
const taskId = isReport && typeof body.task_id === "string" ? body.task_id : typeof body.media_buy_id === "string" ? body.media_buy_id : registration.operationId;
|
|
2726
|
+
const operationId = isReport && typeof body.operation_id === "string" ? body.operation_id : registration.operationId;
|
|
2727
|
+
const status = isReport && isAdcpStatus(body.status) ? body.status : "completed";
|
|
2728
|
+
return {
|
|
2729
|
+
ok: true,
|
|
2730
|
+
protocol: registration.protocol,
|
|
2731
|
+
envelope: isReport ? body : {
|
|
2732
|
+
...body,
|
|
2733
|
+
task_type: registration.taskType,
|
|
2734
|
+
operation_id: operationId,
|
|
2735
|
+
task_id: taskId,
|
|
2736
|
+
status,
|
|
2737
|
+
result: payload
|
|
2738
|
+
},
|
|
2739
|
+
result: payload,
|
|
2740
|
+
metadata: {
|
|
2741
|
+
taskId,
|
|
2742
|
+
taskType: registration.taskType,
|
|
2743
|
+
operationId,
|
|
2744
|
+
status,
|
|
2745
|
+
...typeof body.timestamp === "string" && { timestamp: body.timestamp },
|
|
2746
|
+
...typeof body.idempotency_key === "string" && { idempotencyKey: body.idempotency_key }
|
|
2747
|
+
}
|
|
2748
|
+
};
|
|
2749
|
+
}
|
|
2612
2750
|
const topLevelTaskType = isObjectRecord(parsedPayload.payload) && typeof parsedPayload.payload.task_type === "string" ? parsedPayload.payload.task_type : void 0;
|
|
2613
2751
|
const payloadRecord = isObjectRecord(parsedPayload.payload) ? parsedPayload.payload : void 0;
|
|
2614
2752
|
const signedRoute = extractSignedWebhookRoute(parsedPayload.payload);
|
|
@@ -4798,6 +4936,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4798
4936
|
params.account
|
|
4799
4937
|
);
|
|
4800
4938
|
const hasCreativeFormatData = hasMediaBuyCreativeFormatData(params);
|
|
4939
|
+
if (this.config.experimentalIdentity33) await this.getCapabilities(taskOptions);
|
|
4940
|
+
const signed33Webhooks = this.usesSigned33Webhooks();
|
|
4801
4941
|
if (this.config.webhookUrlTemplate && !options?.disableWebhook) {
|
|
4802
4942
|
const now = /* @__PURE__ */ new Date();
|
|
4803
4943
|
const year = now.getUTCFullYear();
|
|
@@ -4818,12 +4958,17 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4818
4958
|
const consumerAuth = consumerReportingWebhook?.authentication;
|
|
4819
4959
|
const consumerUrl = consumerReportingWebhook?.url;
|
|
4820
4960
|
const consumerFrequency = consumerReportingWebhook?.reporting_frequency;
|
|
4821
|
-
const defaultAuth = this.config.webhookSecret ? { schemes: ["HMAC-SHA256"], credentials: this.config.webhookSecret } : void 0;
|
|
4961
|
+
const defaultAuth = !signed33Webhooks && this.config.webhookSecret ? { schemes: ["HMAC-SHA256"], credentials: this.config.webhookSecret } : void 0;
|
|
4822
4962
|
const resolvedAuth = consumerAuth !== void 0 ? consumerAuth : consumerUrl === void 0 ? defaultAuth : void 0;
|
|
4823
|
-
if (resolvedAuth === void 0 || resolvedAuth === null) {
|
|
4963
|
+
if (!signed33Webhooks && resolvedAuth === void 0 || resolvedAuth === null) {
|
|
4964
|
+
if (consumerReportingWebhook && consumerUrl !== void 0 && consumerAuth === void 0) {
|
|
4965
|
+
throw new Error(
|
|
4966
|
+
"reporting_webhook requires an `authentication` block without positively negotiated 3.3 signed webhooks: a caller-supplied `reporting_webhook.url` must bring its own `reporting_webhook.authentication` (the client never pairs `webhookSecret` with a caller-controlled URL). Omit `url` to use the client's webhookUrlTemplate callback, or remove `reporting_webhook` if you do not need automated delivery reports."
|
|
4967
|
+
);
|
|
4968
|
+
}
|
|
4824
4969
|
if (consumerReportingWebhook) {
|
|
4825
4970
|
throw new Error(
|
|
4826
|
-
"reporting_webhook requires an `authentication` block
|
|
4971
|
+
"reporting_webhook requires an `authentication` block without positively negotiated 3.3 signed webhooks, and no credential is available: set `webhookSecret` on the client, or pass `reporting_webhook.authentication` explicitly. Remove `reporting_webhook` from the request if you do not need automated delivery reports \u2014 the media buy itself does not require it."
|
|
4827
4972
|
);
|
|
4828
4973
|
}
|
|
4829
4974
|
warnReportingWebhookNeedsSecret();
|
|
@@ -4839,9 +4984,20 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
4839
4984
|
...consumerReportingWebhook,
|
|
4840
4985
|
url: consumerUrl !== void 0 ? consumerUrl : deliveryWebhookUrl,
|
|
4841
4986
|
reporting_frequency: consumerFrequency !== void 0 ? consumerFrequency : libraryDefaults.reporting_frequency,
|
|
4842
|
-
authentication: resolvedAuth
|
|
4987
|
+
...resolvedAuth !== void 0 && { authentication: resolvedAuth },
|
|
4988
|
+
...resolvedAuth === void 0 && this.selectedWebhookSigningProfile() && { signing_profile: this.selectedWebhookSigningProfile() }
|
|
4843
4989
|
}
|
|
4844
4990
|
};
|
|
4991
|
+
if (signed33Webhooks && resolvedAuth === void 0 && consumerUrl === void 0) {
|
|
4992
|
+
await this.persistWebhookRegistration({
|
|
4993
|
+
agent: this.normalizedAgent,
|
|
4994
|
+
taskType: "media_buy_delivery",
|
|
4995
|
+
operationId,
|
|
4996
|
+
callbackUrl: deliveryWebhookUrl,
|
|
4997
|
+
mode: "rfc9421",
|
|
4998
|
+
signingProfile: this.selectedWebhookSigningProfile()
|
|
4999
|
+
});
|
|
5000
|
+
}
|
|
4845
5001
|
}
|
|
4846
5002
|
}
|
|
4847
5003
|
}
|
|
@@ -5096,7 +5252,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
5096
5252
|
...options,
|
|
5097
5253
|
[CAPABILITY_DISCOVERY_CONTEXT]: discoveryContext
|
|
5098
5254
|
});
|
|
5099
|
-
const usesScopedFetch =
|
|
5255
|
+
const usesScopedFetch = this.usesScopedDiscoveryTransport(options);
|
|
5100
5256
|
const toolSchemas = discoveryContext.toolSchemas ?? (usesScopedFetch ? void 0 : this.cachedToolSchemas);
|
|
5101
5257
|
const wireRelease = this.config.wireAdcpVersion ?? this.resolvedAdcpVersion;
|
|
5102
5258
|
const declared = resolveCreativeFormatWireMode(capabilities, wireRelease);
|
|
@@ -5411,15 +5567,23 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
5411
5567
|
);
|
|
5412
5568
|
}
|
|
5413
5569
|
async getAdcpCapabilitiesWithinDeadline(params, inputHandler, options) {
|
|
5570
|
+
const scopeKey = this.config._reuseConfiguredDiscovery?.() ? this.getCapabilityEvidenceScope().scopeKey : void 0;
|
|
5414
5571
|
const agent = await this.ensureEndpointDiscovered(options);
|
|
5415
5572
|
this.executor.validateRequest("get_adcp_capabilities", params);
|
|
5416
|
-
|
|
5573
|
+
const result = await this.executor.executeTask(
|
|
5417
5574
|
agent,
|
|
5418
5575
|
"get_adcp_capabilities",
|
|
5419
5576
|
params,
|
|
5420
5577
|
inputHandler,
|
|
5421
5578
|
options
|
|
5422
5579
|
);
|
|
5580
|
+
if (this.config._reuseConfiguredDiscovery?.() && !this.usesScopedDiscoveryTransport(options) && scopeKey === this.getCapabilityEvidenceScope().scopeKey && Object.keys(params).length === 0 && this.runAgentInfo !== void 0 && result.success && result.data && looksLikeV3Capabilities(result.data)) {
|
|
5581
|
+
const capabilities = parseCapabilitiesResponse(structuredClone(result.data));
|
|
5582
|
+
if (!capabilities._synthetic) {
|
|
5583
|
+
this.cachedCapabilities = augmentCapabilitiesFromTools(capabilities, this.runAgentInfo.tools);
|
|
5584
|
+
}
|
|
5585
|
+
}
|
|
5586
|
+
return result;
|
|
5423
5587
|
}
|
|
5424
5588
|
// ====== CREATIVE BUILD TASKS ======
|
|
5425
5589
|
/**
|
|
@@ -6517,6 +6681,25 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
6517
6681
|
* ```
|
|
6518
6682
|
*/
|
|
6519
6683
|
async getAgentInfo(options) {
|
|
6684
|
+
throwIfAborted(options?.signal);
|
|
6685
|
+
const reuse = this.config._reuseConfiguredDiscovery?.() && !this.usesScopedDiscoveryTransport(options);
|
|
6686
|
+
if (!reuse) return this.getAgentInfoLive(options);
|
|
6687
|
+
const scopeKey = this.getCapabilityEvidenceScope().scopeKey;
|
|
6688
|
+
if (this.runAgentInfo) return structuredClone(this.runAgentInfo);
|
|
6689
|
+
const info = await this.getAgentInfoLive(options);
|
|
6690
|
+
if (reuse && scopeKey === this.getCapabilityEvidenceScope().scopeKey) {
|
|
6691
|
+
this.runAgentInfo = structuredClone(info);
|
|
6692
|
+
const documents = new Map(
|
|
6693
|
+
this.runAgentInfo.tools.filter((tool) => tool.inputSchema).map((tool) => [tool.name, tool.inputSchema])
|
|
6694
|
+
);
|
|
6695
|
+
this.cachedToolSchemas = new Map(
|
|
6696
|
+
[...documents].map(([name, schema]) => [name, schema.properties ?? {}])
|
|
6697
|
+
);
|
|
6698
|
+
toolInputSchemasByProperties.set(this.cachedToolSchemas, documents);
|
|
6699
|
+
}
|
|
6700
|
+
return info;
|
|
6701
|
+
}
|
|
6702
|
+
async getAgentInfoLive(options) {
|
|
6520
6703
|
const { withResponseSizeLimit } = await import("../protocols/responseSizeLimit.mjs");
|
|
6521
6704
|
throwIfAborted(options?.signal);
|
|
6522
6705
|
const transport = normalizeTransportOptions(options?.transport ?? this.config.transport);
|
|
@@ -6750,7 +6933,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
6750
6933
|
this.synchronizeCapabilityEvidenceAuthorizationScope();
|
|
6751
6934
|
const discoveryContext = options?.[CAPABILITY_DISCOVERY_CONTEXT];
|
|
6752
6935
|
const transport = normalizeTransportOptions(options?.transport ?? this.config.transport);
|
|
6753
|
-
const usesScopedFetch =
|
|
6936
|
+
const usesScopedFetch = this.usesScopedDiscoveryTransport(options);
|
|
6754
6937
|
if (this.primedCapabilitiesExpiresAt !== void 0 && this.primedCapabilitiesExpiresAt <= Date.now()) {
|
|
6755
6938
|
this.cachedCapabilities = void 0;
|
|
6756
6939
|
this.cachedToolSchemas = void 0;
|
|
@@ -7029,10 +7212,25 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7029
7212
|
}
|
|
7030
7213
|
if (current === this.capabilityEvidenceAuthMaterial) return;
|
|
7031
7214
|
this.capabilityEvidenceAuthMaterial = current;
|
|
7215
|
+
this.discoveryEpoch++;
|
|
7216
|
+
this.runAgentInfo = void 0;
|
|
7032
7217
|
this.cachedCapabilities = void 0;
|
|
7033
7218
|
this.cachedToolSchemas = void 0;
|
|
7034
7219
|
this.primedCapabilitiesExpiresAt = void 0;
|
|
7035
7220
|
this.capabilityEvidenceScopeKey = randomUUID();
|
|
7221
|
+
if (this.config._reuseConfiguredDiscovery?.()) {
|
|
7222
|
+
this.discoveredEndpoint = void 0;
|
|
7223
|
+
this.discoveredAgent = void 0;
|
|
7224
|
+
this.canonicalBaseUrl = void 0;
|
|
7225
|
+
this.discoveredMcpEra = void 0;
|
|
7226
|
+
}
|
|
7227
|
+
}
|
|
7228
|
+
/** A comply() run owns its configured fetch; per-call transport changes still discover separately. */
|
|
7229
|
+
usesScopedDiscoveryTransport(options) {
|
|
7230
|
+
const transport = normalizeTransportOptions(options?.transport ?? this.config.transport);
|
|
7231
|
+
if (!this.config._reuseConfiguredDiscovery?.()) return transport?.trustedFetchFn !== void 0;
|
|
7232
|
+
const configured = normalizeTransportOptions(this.config.transport);
|
|
7233
|
+
return transport?.trustedFetchFn !== configured?.trustedFetchFn || transport?.allowPrivateIp !== configured?.allowPrivateIp || transport?.maxResponseBytes !== configured?.maxResponseBytes || transport?.requestTimeoutMs !== configured?.requestTimeoutMs || transport?.legacyCompat?.enabled !== configured?.legacyCompat?.enabled;
|
|
7036
7234
|
}
|
|
7037
7235
|
/**
|
|
7038
7236
|
* Reuse a fresh capability observation made by the embedding application.
|
|
@@ -7055,7 +7253,7 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7055
7253
|
const hasValidToolSchemas = snapshot?.toolSchemas === void 0 || typeof snapshot.toolSchemas === "object" && snapshot.toolSchemas !== null && Object.values(snapshot.toolSchemas).every(
|
|
7056
7254
|
(properties) => typeof properties === "object" && properties !== null && !Array.isArray(properties)
|
|
7057
7255
|
);
|
|
7058
|
-
const configuredScopedFetch =
|
|
7256
|
+
const configuredScopedFetch = this.usesScopedDiscoveryTransport();
|
|
7059
7257
|
const hasToolEvidence = snapshot?.toolSchemas !== void 0 || Array.isArray(capabilities?.discoveredTools);
|
|
7060
7258
|
if (!matchesScope || !isFresh || !hasCapabilities || !hasValidToolSchemas || !hasToolEvidence || configuredScopedFetch) {
|
|
7061
7259
|
this.cachedCapabilities = void 0;
|
|
@@ -7098,11 +7296,13 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7098
7296
|
/** Epoch of this client's evidence for the call's effective shared key; `undefined` without a shared cache. */
|
|
7099
7297
|
discoveryEpochSnapshot(options) {
|
|
7100
7298
|
const key = this.sharedDiscoveryKey(options);
|
|
7101
|
-
if (!key || !this.config.discoveryCache)
|
|
7299
|
+
if (!key || !this.config.discoveryCache) {
|
|
7300
|
+
return this.config._reuseConfiguredDiscovery?.() ? { local: this.discoveryEpoch, shared: 0, key: "" } : void 0;
|
|
7301
|
+
}
|
|
7102
7302
|
return { local: this.discoveryEpoch, shared: this.sharedInvalidationEpoch(key), key };
|
|
7103
7303
|
}
|
|
7104
7304
|
discoveryEpochIs(epoch) {
|
|
7105
|
-
return epoch.local === this.discoveryEpoch && epoch.shared === this.sharedInvalidationEpoch(epoch.key);
|
|
7305
|
+
return epoch.local === this.discoveryEpoch && (!epoch.key || epoch.shared === this.sharedInvalidationEpoch(epoch.key));
|
|
7106
7306
|
}
|
|
7107
7307
|
/** The latest invalidation that applies to `key`: its own, combined with the cache's floor of forgotten ones. */
|
|
7108
7308
|
sharedInvalidationRecord(key) {
|
|
@@ -7411,6 +7611,8 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7411
7611
|
* seller answers with a version or capability error.
|
|
7412
7612
|
*/
|
|
7413
7613
|
async invalidateDiscoveryCache(options) {
|
|
7614
|
+
this.runAgentInfo = void 0;
|
|
7615
|
+
if (this.config._reuseConfiguredDiscovery?.()) this.canonicalBaseUrl = void 0;
|
|
7414
7616
|
this.cachedCapabilities = void 0;
|
|
7415
7617
|
this.cachedToolSchemas = void 0;
|
|
7416
7618
|
this.primedCapabilitiesExpiresAt = void 0;
|
|
@@ -7958,7 +8160,29 @@ Hint: this usually means agent_uri does not include the MCP endpoint path. The S
|
|
|
7958
8160
|
* injected fields before the adapter gets a chance to clean them up, so
|
|
7959
8161
|
* the two passes have to agree on "extra keys are fine."
|
|
7960
8162
|
*/
|
|
8163
|
+
usesIdentity33Schemas() {
|
|
8164
|
+
return this.config.experimentalIdentity33 === true && this.cachedCapabilities?._synthetic === false && isAdcpVersionAtLeast(this.cachedCapabilities.servedVersion, "3.3.0");
|
|
8165
|
+
}
|
|
8166
|
+
usesSigned33Webhooks() {
|
|
8167
|
+
const capabilities = this.cachedCapabilities;
|
|
8168
|
+
return this.config.experimentalIdentity33 === true && capabilities?._synthetic === false && isAdcpVersionAtLeast(capabilities.servedVersion, "3.3.0") && capabilities._raw?.webhook_signing?.supported === true;
|
|
8169
|
+
}
|
|
8170
|
+
selectedWebhookSigningProfile() {
|
|
8171
|
+
if (!this.usesSigned33Webhooks()) return void 0;
|
|
8172
|
+
const advertisement = this.cachedCapabilities?._raw?.webhook_signing;
|
|
8173
|
+
const profile = this.config.webhookSigningProfile ?? (advertisement?.profile === "web-bot-auth" || advertisement?.profiles?.length === 1 && advertisement.profiles[0] === "web-bot-auth" ? "web-bot-auth" : "adcp/webhook-signing/v1");
|
|
8174
|
+
if (profile === "web-bot-auth" && !advertisement?.profiles?.includes(profile))
|
|
8175
|
+
throw new ConfigurationError(
|
|
8176
|
+
"Seller did not advertise the selected Web Bot Auth webhook profile",
|
|
8177
|
+
"webhookSigningProfile"
|
|
8178
|
+
);
|
|
8179
|
+
return profile;
|
|
8180
|
+
}
|
|
7961
8181
|
validateRequest(taskType, params) {
|
|
8182
|
+
if (this.config.experimentalIdentity33 && this.usesIdentity33Schemas()) {
|
|
8183
|
+
this.executor.validateRequest(taskType, params);
|
|
8184
|
+
return;
|
|
8185
|
+
}
|
|
7962
8186
|
const schema = this.getRequestSchema(taskType);
|
|
7963
8187
|
if (!schema) {
|
|
7964
8188
|
return;
|
|
@@ -8075,6 +8299,7 @@ function normalizeRfc9421WebhookHeaders(headers) {
|
|
|
8075
8299
|
const singletonHeaders = /* @__PURE__ */ new Set([
|
|
8076
8300
|
"signature",
|
|
8077
8301
|
"signature-input",
|
|
8302
|
+
"signature-agent",
|
|
8078
8303
|
"content-digest",
|
|
8079
8304
|
"content-type",
|
|
8080
8305
|
"x-adcp-signature",
|
|
@@ -154,6 +154,10 @@ export declare class TaskExecutor {
|
|
|
154
154
|
agentId?: string;
|
|
155
155
|
/** Webhook secret for legacy HMAC authentication. */
|
|
156
156
|
webhookSecret?: string;
|
|
157
|
+
experimentalIdentity33?: () => boolean;
|
|
158
|
+
signedIdentity33Webhooks?: () => boolean;
|
|
159
|
+
identity33SchemaExperiment?: boolean;
|
|
160
|
+
webhookSigningProfile?: () => 'adcp/webhook-signing/v1' | 'web-bot-auth' | undefined;
|
|
157
161
|
/** Persist sanitized callback mode provenance before dispatch. */
|
|
158
162
|
onWebhookRegistration?: (registration: {
|
|
159
163
|
agent: AgentConfig;
|
|
@@ -161,6 +165,8 @@ export declare class TaskExecutor {
|
|
|
161
165
|
operationId: string;
|
|
162
166
|
callbackUrl: string;
|
|
163
167
|
mode: 'rfc9421' | 'hmac-sha256';
|
|
168
|
+
signingProfile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
|
|
169
|
+
deliveryKind?: 'reporting' | 'artifact';
|
|
164
170
|
delegatedOperatorAuthorization?: TaskOptions['delegatedOperatorAuthorization'];
|
|
165
171
|
}) => void | Promise<void>;
|
|
166
172
|
/** Persist fail-closed routing provenance before a durable mutation claim can run. */
|
|
@@ -154,6 +154,10 @@ export declare class TaskExecutor {
|
|
|
154
154
|
agentId?: string;
|
|
155
155
|
/** Webhook secret for legacy HMAC authentication. */
|
|
156
156
|
webhookSecret?: string;
|
|
157
|
+
experimentalIdentity33?: () => boolean;
|
|
158
|
+
signedIdentity33Webhooks?: () => boolean;
|
|
159
|
+
identity33SchemaExperiment?: boolean;
|
|
160
|
+
webhookSigningProfile?: () => 'adcp/webhook-signing/v1' | 'web-bot-auth' | undefined;
|
|
157
161
|
/** Persist sanitized callback mode provenance before dispatch. */
|
|
158
162
|
onWebhookRegistration?: (registration: {
|
|
159
163
|
agent: AgentConfig;
|
|
@@ -161,6 +165,8 @@ export declare class TaskExecutor {
|
|
|
161
165
|
operationId: string;
|
|
162
166
|
callbackUrl: string;
|
|
163
167
|
mode: 'rfc9421' | 'hmac-sha256';
|
|
168
|
+
signingProfile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
|
|
169
|
+
deliveryKind?: 'reporting' | 'artifact';
|
|
164
170
|
delegatedOperatorAuthorization?: TaskOptions['delegatedOperatorAuthorization'];
|
|
165
171
|
}) => void | Promise<void>;
|
|
166
172
|
/** Persist fail-closed routing provenance before a durable mutation claim can run. */
|