@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
|
@@ -30,11 +30,18 @@ __export(create_adcp_server_exports, {
|
|
|
30
30
|
requireSessionKey: () => requireSessionKey
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(create_adcp_server_exports);
|
|
33
|
+
var import_web_bot_auth = require('../signing/web-bot-auth.js');
|
|
34
|
+
var import_schema_loader = require('../validation/schema-loader.js');
|
|
35
|
+
var import_lifecycle = require('../identity-3.3/lifecycle.js');
|
|
36
|
+
var import_server = require('../identity-3.3/server.js');
|
|
37
|
+
var import_web_bot_auth2 = require('../signing/web-bot-auth.js');
|
|
38
|
+
var import_validation = require('../identity-3.3/validation.js');
|
|
39
|
+
var import_trust = require('../identity-3.3/trust.js');
|
|
33
40
|
var import_zod = require("zod");
|
|
34
41
|
var import_version = require('../version.js');
|
|
35
42
|
var import_adcp_version_config = require('../utils/adcp-version-config.js');
|
|
36
43
|
var import_errors = require('../errors/index.js');
|
|
37
|
-
var
|
|
44
|
+
var import_schema_loader2 = require('../validation/schema-loader.js');
|
|
38
45
|
var import_schemas = require('../schemas/index.js');
|
|
39
46
|
var import_enums = require('../types/enums.generated.js');
|
|
40
47
|
var import_protocols = require('../protocols/index.js');
|
|
@@ -680,10 +687,12 @@ function restoreSyncAccountEnvelopeErrorIndices(response, acceptedIndices) {
|
|
|
680
687
|
syncContentJsonText(restored, restored.structuredContent, mirrorsStructuredContent);
|
|
681
688
|
return restored;
|
|
682
689
|
}
|
|
683
|
-
function validateFrameworkPayload(toolName, direction, payload, version, proposalCapabilities) {
|
|
690
|
+
function validateFrameworkPayload(toolName, direction, payload, version, proposalCapabilities, identity33 = false) {
|
|
684
691
|
if (toolName === "sync_reporting_status" && direction === "request") {
|
|
685
692
|
return (0, import_sync_reporting_status_envelope.validateSyncReportingStatusEnvelope)(payload, version);
|
|
686
693
|
}
|
|
694
|
+
if (identity33 && toolName !== "refine_proposals" && toolName !== "sync_reporting_status")
|
|
695
|
+
return (0, import_validation.validateIdentity33Payload)(toolName, direction, payload, version);
|
|
687
696
|
if (toolName !== "refine_proposals") {
|
|
688
697
|
return direction === "request" ? (0, import_schema_validator.validateRequest)(toolName, payload, version) : (0, import_schema_validator.validateResponse)(toolName, payload, version);
|
|
689
698
|
}
|
|
@@ -947,7 +956,7 @@ function projectValueToCapabilitySchema(root, schema, value, depth = 0) {
|
|
|
947
956
|
return projectedObject;
|
|
948
957
|
}
|
|
949
958
|
function projectCapabilitiesToVersion(data, version) {
|
|
950
|
-
const validator = (0,
|
|
959
|
+
const validator = (0, import_schema_loader2.getValidator)("get_adcp_capabilities", "sync", version);
|
|
951
960
|
const schema = asProjectionSchema(validator?.schema);
|
|
952
961
|
if (!schema) return data;
|
|
953
962
|
const projected = projectValueToCapabilitySchema(schema, schema, data);
|
|
@@ -1419,6 +1428,15 @@ function resolveEffectiveSignedRequestPolicy(signedRequests, capabilityRequestSi
|
|
|
1419
1428
|
};
|
|
1420
1429
|
}
|
|
1421
1430
|
function buildSignedRequestsPreTransport(signedRequests, effectiveRequestSigning, adcpVersion) {
|
|
1431
|
+
const legacyOriginGate = signedRequests.assertLegacyOriginAllowed ?? (0, import_web_bot_auth.getWebBotAuthLegacyOriginGate)(signedRequests.webBotAuth?.resolvePrincipal);
|
|
1432
|
+
if (signedRequests.webBotAuth && !legacyOriginGate)
|
|
1433
|
+
throw new Error(
|
|
1434
|
+
"Web Bot Auth requires an origin-binding migration fence; use createIdentity33PrincipalResolver or supply assertLegacyOriginAllowed"
|
|
1435
|
+
);
|
|
1436
|
+
if (signedRequests.webBotAuth && !signedRequests.webBotAuth.isRevoked && !(0, import_web_bot_auth2.isWebBotAuthRevocationChecked)(signedRequests.webBotAuth.resolvePrincipal))
|
|
1437
|
+
throw new Error(
|
|
1438
|
+
"Web Bot Auth requires origin revocation: use createIdentity33PrincipalResolver({ revocation }) or supply isRevoked"
|
|
1439
|
+
);
|
|
1422
1440
|
const requiredFor = effectiveRequestSigning.required_for ?? [];
|
|
1423
1441
|
const verifier = (0, import_middleware.createExpressVerifier)({
|
|
1424
1442
|
capability: {
|
|
@@ -1440,6 +1458,66 @@ function buildSignedRequestsPreTransport(signedRequests, effectiveRequestSigning
|
|
|
1440
1458
|
return async function adcpPreTransport(req, res) {
|
|
1441
1459
|
const serveContext = (0, import_auth.getServeRequestContext)(req);
|
|
1442
1460
|
const canonicalPublicUrl = serveContext?.publicUrl ? new URL(serveContext.publicUrl) : void 0;
|
|
1461
|
+
if ((0, import_web_bot_auth2.selectSignatureProfile)({ headers: req.headers }) === "web-bot-auth") {
|
|
1462
|
+
try {
|
|
1463
|
+
if (!signedRequests.webBotAuth || !canonicalPublicUrl) throw new import_web_bot_auth2.WebBotAuthError(403, "profile_disabled");
|
|
1464
|
+
if (req.method !== "GET" && req.rawBody === void 0) throw new import_web_bot_auth2.WebBotAuthError(403, "raw_body_missing");
|
|
1465
|
+
const requestTarget = canonicalPublicUrl.origin + (req.url?.startsWith("/") ? req.url : "/" + (req.url ?? ""));
|
|
1466
|
+
const signers = await (0, import_web_bot_auth2.verifyWebBotAuth)(
|
|
1467
|
+
{ method: req.method ?? "POST", url: requestTarget, headers: req.headers, body: req.rawBody ?? "" },
|
|
1468
|
+
{
|
|
1469
|
+
// Identity verification needs only key discovery and replay state;
|
|
1470
|
+
// revocation and binding belong to the principal resolver.
|
|
1471
|
+
directory: signedRequests.webBotAuth.directory,
|
|
1472
|
+
replayStore: signedRequests.replayStore,
|
|
1473
|
+
...signedRequests.webBotAuth.isRevoked && { isRevoked: signedRequests.webBotAuth.isRevoked }
|
|
1474
|
+
}
|
|
1475
|
+
);
|
|
1476
|
+
const operation = (0, import_operation_resolution.resolveRequestOperation)({ rawBody: req.rawBody, method: req.method, url: req.url });
|
|
1477
|
+
let principal;
|
|
1478
|
+
let deferredFailure;
|
|
1479
|
+
try {
|
|
1480
|
+
principal = await signedRequests.webBotAuth.resolvePrincipal(signers, operation);
|
|
1481
|
+
} catch (error) {
|
|
1482
|
+
if (error instanceof import_web_bot_auth2.WebBotAuthError || error instanceof import_web_bot_auth2.WebBotAuthUnavailableError) throw error;
|
|
1483
|
+
if (typeof operation !== "string") throw (0, import_web_bot_auth2.webBotAuthPrincipalFailureError)(error);
|
|
1484
|
+
const deferred = (0, import_web_bot_auth2.deferWebBotAuthPrincipalFailure)(signers, error);
|
|
1485
|
+
principal = { principal: deferred.principal };
|
|
1486
|
+
deferredFailure = deferred.authorizationFailure;
|
|
1487
|
+
}
|
|
1488
|
+
const signer = signers[signers.length - 1];
|
|
1489
|
+
const failed = signers.find((s) => s.authorizationFailure);
|
|
1490
|
+
const guardedPrincipal = {
|
|
1491
|
+
...principal,
|
|
1492
|
+
extra: {
|
|
1493
|
+
...principal.extra,
|
|
1494
|
+
webBotAuthAuthorization: {
|
|
1495
|
+
signer: failed ?? signer,
|
|
1496
|
+
...(failed?.authorizationFailure ?? deferredFailure) && {
|
|
1497
|
+
authorizationFailure: failed?.authorizationFailure ?? deferredFailure
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
};
|
|
1502
|
+
attachVerifiedSignerAuth(req, guardedPrincipal, {
|
|
1503
|
+
keyid: signer.keyid,
|
|
1504
|
+
agent_url: signer.origin,
|
|
1505
|
+
verified_at: signer.verified_at
|
|
1506
|
+
});
|
|
1507
|
+
return false;
|
|
1508
|
+
} catch (error) {
|
|
1509
|
+
if (error instanceof import_web_bot_auth2.WebBotAuthUnavailableError) {
|
|
1510
|
+
const outage = (0, import_web_bot_auth2.webBotAuthUnavailableResponse)();
|
|
1511
|
+
res.writeHead(outage.status, { ...outage.headers, "Content-Type": "application/json" });
|
|
1512
|
+
res.end(JSON.stringify(outage.body));
|
|
1513
|
+
return true;
|
|
1514
|
+
}
|
|
1515
|
+
const rejected = error instanceof import_web_bot_auth2.WebBotAuthError ? error : new import_web_bot_auth2.WebBotAuthError(403, "identity_rejected");
|
|
1516
|
+
res.writeHead(rejected.status, { ...rejected.headers, "Content-Type": "application/json" });
|
|
1517
|
+
res.end(JSON.stringify(rejected.body));
|
|
1518
|
+
return true;
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1443
1521
|
const reqShim = {
|
|
1444
1522
|
method: req.method ?? "POST",
|
|
1445
1523
|
url: req.url ?? "/mcp",
|
|
@@ -1483,6 +1561,7 @@ function buildSignedRequestsPreTransport(signedRequests, effectiveRequestSigning
|
|
|
1483
1561
|
resolve();
|
|
1484
1562
|
};
|
|
1485
1563
|
res.once("finish", () => {
|
|
1564
|
+
verifierCompleted = true;
|
|
1486
1565
|
if (res.writableEnded) handled = true;
|
|
1487
1566
|
done();
|
|
1488
1567
|
});
|
|
@@ -1490,8 +1569,7 @@ function buildSignedRequestsPreTransport(signedRequests, effectiveRequestSigning
|
|
|
1490
1569
|
if (!verifierCompleted) handled = true;
|
|
1491
1570
|
done();
|
|
1492
1571
|
});
|
|
1493
|
-
verifier(reqShim, resShim, (err) => {
|
|
1494
|
-
verifierCompleted = true;
|
|
1572
|
+
verifier(reqShim, resShim, async (err) => {
|
|
1495
1573
|
if (err) {
|
|
1496
1574
|
const errName = err.name || "Error";
|
|
1497
1575
|
const errCode = err.code ?? "unknown";
|
|
@@ -1506,6 +1584,11 @@ function buildSignedRequestsPreTransport(signedRequests, effectiveRequestSigning
|
|
|
1506
1584
|
const verifiedSigner = reqShim.verifiedSigner;
|
|
1507
1585
|
if (!err && verifiedSigner) {
|
|
1508
1586
|
try {
|
|
1587
|
+
if (legacyOriginGate) {
|
|
1588
|
+
if (!verifiedSigner.agent_url)
|
|
1589
|
+
throw new import_auth.AuthError("Legacy signer origin is required for migration fencing");
|
|
1590
|
+
await legacyOriginGate(verifiedSigner.agent_url);
|
|
1591
|
+
}
|
|
1509
1592
|
const principal = (0, import_auth_signature.principalForVerifiedSigner)(verifiedSigner, signedRequests.makePrincipal);
|
|
1510
1593
|
attachVerifiedSignerAuth(req, principal, verifiedSigner);
|
|
1511
1594
|
} catch (identityError) {
|
|
@@ -1525,6 +1608,7 @@ function buildSignedRequestsPreTransport(signedRequests, effectiveRequestSigning
|
|
|
1525
1608
|
handled = true;
|
|
1526
1609
|
}
|
|
1527
1610
|
}
|
|
1611
|
+
verifierCompleted = true;
|
|
1528
1612
|
if (res.writableEnded) handled = true;
|
|
1529
1613
|
done();
|
|
1530
1614
|
});
|
|
@@ -1674,7 +1758,7 @@ function supportedVersionsForTool(toolName, ranges, capConfig, serverPin) {
|
|
|
1674
1758
|
}
|
|
1675
1759
|
const PUSH_OPERATION_ID_PATTERN = /^[A-Za-z0-9_.:-]{1,255}$/;
|
|
1676
1760
|
function releaseRequiresPushOperationId(release) {
|
|
1677
|
-
return (0, import_adcp_version_config.isAdcpVersionAtLeast)((0,
|
|
1761
|
+
return (0, import_adcp_version_config.isAdcpVersionAtLeast)((0, import_schema_loader2.resolveBundleKey)(release), "3.2.0-beta.5");
|
|
1678
1762
|
}
|
|
1679
1763
|
function pushOperationIdError(params, release) {
|
|
1680
1764
|
const config = params.push_notification_config;
|
|
@@ -1744,7 +1828,7 @@ function bundledReleasesForMajors(majors, configured) {
|
|
|
1744
1828
|
const acceptedMajors = new Set(majors);
|
|
1745
1829
|
const releases = /* @__PURE__ */ new Map();
|
|
1746
1830
|
bundledCompatibleReleases ??= import_version.COMPATIBLE_ADCP_VERSIONS.flatMap((version) => {
|
|
1747
|
-
if (!(0,
|
|
1831
|
+
if (!(0, import_schema_loader2.hasSchemaBundle)(version)) return [];
|
|
1748
1832
|
const parsed = parseAdcpRelease(version);
|
|
1749
1833
|
return parsed ? [parsed] : [];
|
|
1750
1834
|
});
|
|
@@ -1828,7 +1912,7 @@ function selectServedAdcpRelease(params, capConfig, serverPin, defaultPin) {
|
|
|
1828
1912
|
return {
|
|
1829
1913
|
validationVersion,
|
|
1830
1914
|
advertisedVersion: selected.exactValue,
|
|
1831
|
-
...(0, import_protocols.bundleSupportsAdcpVersionField)((0,
|
|
1915
|
+
...(0, import_protocols.bundleSupportsAdcpVersionField)((0, import_schema_loader2.resolveBundleKey)(validationVersion)) && { wireVersion: validationVersion }
|
|
1832
1916
|
};
|
|
1833
1917
|
}
|
|
1834
1918
|
const ACCOUNT_VIA_RESOURCE_TOOLS = /* @__PURE__ */ new Set(["refine_proposals", "decline_proposals"]);
|
|
@@ -1857,6 +1941,11 @@ function isAuthDerivedAccountNotFound(err) {
|
|
|
1857
1941
|
return err instanceof import_async_outcome.AdcpError && err.code === "ACCOUNT_NOT_FOUND";
|
|
1858
1942
|
}
|
|
1859
1943
|
function createAdcpServer(config) {
|
|
1944
|
+
if (Boolean(config.identity33) !== (0, import_schema_loader.isIdentity33SchemaScope)())
|
|
1945
|
+
return (0, import_schema_loader.withIdentity33SchemaScope)(() => {
|
|
1946
|
+
const instance = createAdcpServer(config);
|
|
1947
|
+
return config.identity33 ? (0, import_schema_loader.bindIdentity33SchemaScope)(instance) : instance;
|
|
1948
|
+
}, Boolean(config.identity33));
|
|
1860
1949
|
const {
|
|
1861
1950
|
name,
|
|
1862
1951
|
version,
|
|
@@ -1948,7 +2037,7 @@ function createAdcpServer(config) {
|
|
|
1948
2037
|
}
|
|
1949
2038
|
const credentialPolicyPatterns = credentialPolicy === void 0 || typeof credentialPolicy === "string" ? void 0 : credentialPolicy.patterns;
|
|
1950
2039
|
const adcpVersion = (0, import_adcp_version_config.resolveAdcpVersion)(
|
|
1951
|
-
configuredAdcpVersion ?? (config.proposalNegotiation ? import_version2.ADCP_VERSION : void 0)
|
|
2040
|
+
configuredAdcpVersion ?? (config.identity33 ? "3.3" : config.proposalNegotiation ? import_version2.ADCP_VERSION : void 0)
|
|
1952
2041
|
);
|
|
1953
2042
|
const toolVersionRanges = parseToolVersionRanges(config.toolVersions);
|
|
1954
2043
|
const toolAvailableForRelease = (toolName, release) => toolIsAvailableInRelease(toolVersionRanges, toolName, release);
|
|
@@ -2013,14 +2102,31 @@ function createAdcpServer(config) {
|
|
|
2013
2102
|
"createAdcpServer: proposalNegotiation.capabilities.supported_dimensions is required when refineProposals is registered"
|
|
2014
2103
|
);
|
|
2015
2104
|
}
|
|
2016
|
-
const protocolBundleKey = (0,
|
|
2105
|
+
const protocolBundleKey = (0, import_schema_loader2.resolveBundleKey)(adcpVersion);
|
|
2017
2106
|
const frameworkToolMeta = { adcp_version: adcpVersion };
|
|
2018
2107
|
const servedAdcpVersion = (() => {
|
|
2019
|
-
const bundleKey = (0,
|
|
2108
|
+
const bundleKey = (0, import_schema_loader2.resolveBundleKey)(defaultAdcpVersion);
|
|
2020
2109
|
return (0, import_protocols.bundleSupportsAdcpVersionField)(bundleKey) ? bundleKey : void 0;
|
|
2021
2110
|
})();
|
|
2022
2111
|
const protocolTaskRelease = parseAdcpRelease(protocolBundleKey);
|
|
2023
2112
|
const supportsProtocolTaskTools = protocolTaskRelease !== void 0 && (protocolTaskRelease.major > 3 || protocolTaskRelease.major === 3 && protocolTaskRelease.minor >= 1);
|
|
2113
|
+
const identityOnboarding = capConfig?.account?.agent_onboarding ?? capConfig?.account?.agentOnboarding;
|
|
2114
|
+
if (identityOnboarding) {
|
|
2115
|
+
if (!config.identity33) throw new Error("agent_onboarding requires the identity33 experiment");
|
|
2116
|
+
(0, import_lifecycle.validateAgentOnboarding)(
|
|
2117
|
+
identityOnboarding,
|
|
2118
|
+
{ sandbox: capConfig?.account?.sandbox, supported_billing: capConfig?.account?.supportedBilling },
|
|
2119
|
+
capConfig?.overrides?.experimental_features ?? []
|
|
2120
|
+
);
|
|
2121
|
+
}
|
|
2122
|
+
if (signedRequests?.webBotAuth && (!config.identity33 || !(capConfig?.overrides?.request_signing?.profiles ?? capConfig?.request_signing?.profiles)?.includes(
|
|
2123
|
+
"web-bot-auth"
|
|
2124
|
+
)))
|
|
2125
|
+
throw new Error("Web Bot Auth verifier requires identity33 and request_signing.profiles advertisement");
|
|
2126
|
+
if (config.webhooks?.signingProfile === "web-bot-auth")
|
|
2127
|
+
throw new Error("Select Web Bot Auth on each trusted webhook registration, not as a server-wide default");
|
|
2128
|
+
if (config.webhooks?.webBotAuth && !config.identity33)
|
|
2129
|
+
throw new Error("Web Bot Auth webhook signing requires the identity33 experiment");
|
|
2024
2130
|
const toolsWithErrorArm = (0, import_error_arm_tools.getToolsWithErrorArm)(adcpVersion);
|
|
2025
2131
|
const isProduction = process.env.NODE_ENV === "production";
|
|
2026
2132
|
const requestValidationMode = validationConfig?.requests ?? (isProduction ? "off" : "strict");
|
|
@@ -2226,7 +2332,7 @@ function createAdcpServer(config) {
|
|
|
2226
2332
|
const releaseDefinesTool = (toolName, release) => {
|
|
2227
2333
|
if (toolName === "refine_proposals") return true;
|
|
2228
2334
|
try {
|
|
2229
|
-
return (0,
|
|
2335
|
+
return (0, import_schema_loader2.getValidator)(toolName, "request", release.validationVersion) !== void 0;
|
|
2230
2336
|
} catch {
|
|
2231
2337
|
return false;
|
|
2232
2338
|
}
|
|
@@ -2579,6 +2685,10 @@ function createAdcpServer(config) {
|
|
|
2579
2685
|
const hasAccount = "account" in schema.shape;
|
|
2580
2686
|
const wrap = meta?.wrap ?? ((data, summary) => genericResponse(toolName, data, summary));
|
|
2581
2687
|
const toolHandler = async (params, extra) => {
|
|
2688
|
+
const authorizationFailure = (0, import_web_bot_auth2.getWebBotAuthAuthorizationFailure)(extra?.authInfo?.extra);
|
|
2689
|
+
if (authorizationFailure) return (0, import_web_bot_auth2.webBotAuthToolFailure)(authorizationFailure, servedAdcpVersion);
|
|
2690
|
+
if (config.identity33 && !(0, import_schema_loader.isIdentity33SchemaScope)())
|
|
2691
|
+
return (0, import_schema_loader.withIdentity33SchemaScope)(() => toolHandler(params, extra));
|
|
2582
2692
|
const callRequestValidationMode = effectiveRequestValidationMode(extra);
|
|
2583
2693
|
let notificationFailureRows = /* @__PURE__ */ new Map();
|
|
2584
2694
|
const releaseSelection = selectServedAdcpRelease(params, capConfig, adcpVersion, defaultAdcpVersion);
|
|
@@ -2633,6 +2743,22 @@ function createAdcpServer(config) {
|
|
|
2633
2743
|
})
|
|
2634
2744
|
);
|
|
2635
2745
|
}
|
|
2746
|
+
for (const field of ["push_notification_config", "reporting_webhook", "artifact_webhook"]) {
|
|
2747
|
+
const registration = params[field];
|
|
2748
|
+
if (!registration || typeof registration !== "object" || Array.isArray(registration)) continue;
|
|
2749
|
+
const selectedProfile = registration.signing_profile;
|
|
2750
|
+
if (selectedProfile === void 0) continue;
|
|
2751
|
+
const offered = capabilitiesData.webhook_signing?.profiles ?? [
|
|
2752
|
+
"adcp/webhook-signing/v1"
|
|
2753
|
+
];
|
|
2754
|
+
if (typeof selectedProfile !== "string" || !offered.includes(selectedProfile) || selectedProfile === "web-bot-auth" && (!config.identity33 || !(0, import_adcp_version_config.isAdcpVersionAtLeast)(requestRelease.wireVersion, "3.3")) || selectedProfile === "web-bot-auth" && registration.authentication !== void 0)
|
|
2755
|
+
return finalize(
|
|
2756
|
+
(0, import_errors2.adcpError)("INVALID_REQUEST", {
|
|
2757
|
+
message: "Unsupported or ambiguous webhook signing profile",
|
|
2758
|
+
field: `${field}.signing_profile`
|
|
2759
|
+
})
|
|
2760
|
+
);
|
|
2761
|
+
}
|
|
2636
2762
|
const operationIdError = pushOperationIdError(params, requestRelease);
|
|
2637
2763
|
if (operationIdError) return finalize(operationIdError);
|
|
2638
2764
|
if (toolName === "list_account_changes" && Object.hasOwn(params, "cursor") && Object.hasOwn(params, "starting_position")) {
|
|
@@ -2812,7 +2938,8 @@ function createAdcpServer(config) {
|
|
|
2812
2938
|
"request",
|
|
2813
2939
|
params,
|
|
2814
2940
|
requestRelease.validationVersion,
|
|
2815
|
-
proposalRefinementCapabilities
|
|
2941
|
+
proposalRefinementCapabilities,
|
|
2942
|
+
!!config.identity33 && (0, import_adcp_version_config.isAdcpVersionAtLeast)(requestRelease.wireVersion, "3.3")
|
|
2816
2943
|
);
|
|
2817
2944
|
if (!outcome.valid) {
|
|
2818
2945
|
if ("refinementError" in outcome && outcome.refinementError?.code === "UNSUPPORTED_FEATURE") {
|
|
@@ -2867,6 +2994,23 @@ function createAdcpServer(config) {
|
|
|
2867
2994
|
}
|
|
2868
2995
|
}
|
|
2869
2996
|
}
|
|
2997
|
+
if (config.identity33) {
|
|
2998
|
+
try {
|
|
2999
|
+
await config.identity33.authorize(ctx, toolName, params);
|
|
3000
|
+
} catch (error) {
|
|
3001
|
+
if (error instanceof import_trust.TrustRecordUnavailableError)
|
|
3002
|
+
return finalize((0, import_errors2.adcpError)("SERVICE_UNAVAILABLE", { message: error.message, recovery: "transient" }));
|
|
3003
|
+
if (error instanceof import_trust.IdentityAuthorizationError)
|
|
3004
|
+
return finalize(
|
|
3005
|
+
(0, import_errors2.adcpError)("PERMISSION_DENIED", {
|
|
3006
|
+
message: error.message,
|
|
3007
|
+
...error.details && { details: { ...error.details } }
|
|
3008
|
+
})
|
|
3009
|
+
);
|
|
3010
|
+
if (error instanceof import_async_outcome.AdcpError) return finalize(projectThrownAdcpError(error));
|
|
3011
|
+
return finalize((0, import_errors2.adcpError)("PERMISSION_DENIED", { message: "Agent authorization failed" }));
|
|
3012
|
+
}
|
|
3013
|
+
}
|
|
2870
3014
|
let unresolvedAccountPassThrough = false;
|
|
2871
3015
|
const suppliedAccountRef = hasAccount && params.account != null && !(strictAccountReferences && toolName === "list_accounts");
|
|
2872
3016
|
if (suppliedAccountRef && toolName === "list_accounts") {
|
|
@@ -3058,7 +3202,7 @@ function createAdcpServer(config) {
|
|
|
3058
3202
|
);
|
|
3059
3203
|
}
|
|
3060
3204
|
}
|
|
3061
|
-
const callerScopedResolver = toolName === "sync_agent_notification_configs" ? config.protocol?.resolveScope : toolName === "get_principal" || toolName === "sync_principal" ? config.protocol?.resolvePrincipalScope : void 0;
|
|
3205
|
+
const callerScopedResolver = config.identity33 && (toolName === "get_principal" || toolName === "sync_principal" && params.dry_run === true) && (0, import_server.isIdentity33UnboundContext)(ctx) ? void 0 : toolName === "sync_agent_notification_configs" ? config.protocol?.resolveScope : toolName === "get_principal" || toolName === "sync_principal" ? config.protocol?.resolvePrincipalScope : void 0;
|
|
3062
3206
|
if (callerScopedResolver || toolName === "report_plan_adjustment") {
|
|
3063
3207
|
if (ctx.authInfo === void 0 && ctx.agent === void 0) {
|
|
3064
3208
|
return finalize(
|
|
@@ -3262,7 +3406,18 @@ function createAdcpServer(config) {
|
|
|
3262
3406
|
if (webhookEmitter) {
|
|
3263
3407
|
const tenantScope = webhookTenantScopeForContext(ctx);
|
|
3264
3408
|
const scopedEmitter = tenantScope === void 0 ? configuredWebhookEmitter : webhookEmitter.forTenantScope(tenantScope);
|
|
3265
|
-
|
|
3409
|
+
const profileBindings = ["push_notification_config", "reporting_webhook", "artifact_webhook"].flatMap(
|
|
3410
|
+
(field) => {
|
|
3411
|
+
const value = params[field];
|
|
3412
|
+
return value?.url && value.signing_profile ? [{ url: value.url, profile: value.signing_profile }] : [];
|
|
3413
|
+
}
|
|
3414
|
+
);
|
|
3415
|
+
ctx.emitWebhook = (delivery) => scopedEmitter.emit({
|
|
3416
|
+
...delivery,
|
|
3417
|
+
...delivery.signingProfile === void 0 && profileBindings.some((binding) => binding.url === delivery.url) && {
|
|
3418
|
+
signingProfile: profileBindings.find((binding) => binding.url === delivery.url).profile
|
|
3419
|
+
}
|
|
3420
|
+
});
|
|
3266
3421
|
}
|
|
3267
3422
|
const handlerParams = notificationFailureRows.size === 0 ? params : {
|
|
3268
3423
|
...params,
|
|
@@ -3740,7 +3895,14 @@ function createAdcpServer(config) {
|
|
|
3740
3895
|
}
|
|
3741
3896
|
if (responseValidationMode !== "off" && !isErrorResponse(formatted)) {
|
|
3742
3897
|
const payload = formatted.structuredContent;
|
|
3743
|
-
const outcome = validateFrameworkPayload(
|
|
3898
|
+
const outcome = validateFrameworkPayload(
|
|
3899
|
+
toolName,
|
|
3900
|
+
"response",
|
|
3901
|
+
payload,
|
|
3902
|
+
requestRelease.validationVersion,
|
|
3903
|
+
void 0,
|
|
3904
|
+
!!config.identity33 && (0, import_adcp_version_config.isAdcpVersionAtLeast)(requestRelease.wireVersion, "3.3")
|
|
3905
|
+
);
|
|
3744
3906
|
if (!outcome.valid) {
|
|
3745
3907
|
logger.warn(
|
|
3746
3908
|
`Schema validation warning (response) for ${toolName}: ${(0, import_schema_validator.formatIssues)(outcome.issues, 3, { rootSchemaId: outcome.schemaId })}`,
|
|
@@ -4025,6 +4187,8 @@ function createAdcpServer(config) {
|
|
|
4025
4187
|
_meta: frameworkToolMeta
|
|
4026
4188
|
},
|
|
4027
4189
|
(async (params, extra) => {
|
|
4190
|
+
const identityError = await authorizeAuxiliaryIdentityTool("get_task_status", params, extra);
|
|
4191
|
+
if (identityError) return finalizeProtocolTaskToolResponse("get_task_status", params ?? {}, identityError);
|
|
4028
4192
|
const credentialError = taskToolCredentialPolicyError("get_task_status", params ?? {}, extra);
|
|
4029
4193
|
if (credentialError) {
|
|
4030
4194
|
return finalizeProtocolTaskToolResponse("get_task_status", params ?? {}, credentialError, {
|
|
@@ -4111,6 +4275,8 @@ function createAdcpServer(config) {
|
|
|
4111
4275
|
_meta: frameworkToolMeta
|
|
4112
4276
|
},
|
|
4113
4277
|
(async (params, extra) => {
|
|
4278
|
+
const identityError = await authorizeAuxiliaryIdentityTool("list_tasks", params, extra);
|
|
4279
|
+
if (identityError) return finalizeProtocolTaskToolResponse("list_tasks", params ?? {}, identityError);
|
|
4114
4280
|
const credentialError = taskToolCredentialPolicyError("list_tasks", params ?? {}, extra);
|
|
4115
4281
|
if (credentialError) {
|
|
4116
4282
|
return finalizeProtocolTaskToolResponse("list_tasks", params ?? {}, credentialError, { echoContext: false });
|
|
@@ -4227,6 +4393,8 @@ function createAdcpServer(config) {
|
|
|
4227
4393
|
);
|
|
4228
4394
|
};
|
|
4229
4395
|
const wrappedHandler = (async (...args) => {
|
|
4396
|
+
const identityError = await authorizeAuxiliaryIdentityTool(customName, args[0], args[args.length - 1]);
|
|
4397
|
+
if (identityError) return finalizeCustomResponse(identityError);
|
|
4230
4398
|
const params = isPlainObject(args[0]) ? args[0] : {};
|
|
4231
4399
|
const selectedRelease = selectServedAdcpRelease(params, capConfig, adcpVersion, defaultAdcpVersion);
|
|
4232
4400
|
if (isMcpToolResponse(selectedRelease)) return finalizeCustomResponse(selectedRelease);
|
|
@@ -4345,6 +4513,7 @@ function createAdcpServer(config) {
|
|
|
4345
4513
|
...capConfig.account.defaultBilling && { default_billing: capConfig.account.defaultBilling },
|
|
4346
4514
|
required_for_products: capConfig.account.requiredForProducts ?? false,
|
|
4347
4515
|
sandbox: capConfig.account.sandbox ?? false,
|
|
4516
|
+
...identityOnboarding && { agent_onboarding: identityOnboarding },
|
|
4348
4517
|
...capConfig.account.changeFeed !== void 0 && { change_feed: capConfig.account.changeFeed }
|
|
4349
4518
|
};
|
|
4350
4519
|
}
|
|
@@ -4386,7 +4555,15 @@ function createAdcpServer(config) {
|
|
|
4386
4555
|
...capabilitiesData.webhook_signing,
|
|
4387
4556
|
supported: true,
|
|
4388
4557
|
profile,
|
|
4389
|
-
algorithms: [
|
|
4558
|
+
algorithms: [
|
|
4559
|
+
.../* @__PURE__ */ new Set([
|
|
4560
|
+
algorithm,
|
|
4561
|
+
...webhooks.webBotAuth ? [
|
|
4562
|
+
("privateKey" in webhooks.webBotAuth.key ? webhooks.webBotAuth.key.privateKey.crv : webhooks.webBotAuth.key.publicKey.crv) === "P-256" ? "ecdsa-p256-sha256" : "ed25519"
|
|
4563
|
+
] : []
|
|
4564
|
+
])
|
|
4565
|
+
],
|
|
4566
|
+
...webhooks.webBotAuth && { profiles: ["adcp/webhook-signing/v1", "web-bot-auth"] },
|
|
4390
4567
|
legacy_hmac_fallback: capabilitiesData.webhook_signing?.legacy_hmac_fallback ?? false,
|
|
4391
4568
|
delivery_retry_horizon_seconds: webhooks.deliveryRetryHorizonSeconds ?? 86400
|
|
4392
4569
|
};
|
|
@@ -4432,6 +4609,36 @@ function createAdcpServer(config) {
|
|
|
4432
4609
|
];
|
|
4433
4610
|
}
|
|
4434
4611
|
capabilitiesData.library_version = `@adcp/client@${import_version2.LIBRARY_VERSION}`;
|
|
4612
|
+
async function authorizeAuxiliaryIdentityTool(toolName, params, extra) {
|
|
4613
|
+
const failure = (0, import_web_bot_auth2.getWebBotAuthAuthorizationFailure)(extra?.authInfo?.extra);
|
|
4614
|
+
if (failure) return (0, import_web_bot_auth2.webBotAuthToolFailure)(failure, servedAdcpVersion);
|
|
4615
|
+
if (!config.identity33) return void 0;
|
|
4616
|
+
try {
|
|
4617
|
+
await config.identity33.authorize(
|
|
4618
|
+
withImmutableServedAdcpVersion(
|
|
4619
|
+
{ toolName, stateStore, authInfo: extra?.authInfo, logger },
|
|
4620
|
+
adcpVersion
|
|
4621
|
+
),
|
|
4622
|
+
toolName,
|
|
4623
|
+
params
|
|
4624
|
+
);
|
|
4625
|
+
} catch (error) {
|
|
4626
|
+
if (error instanceof import_trust.TrustRecordUnavailableError)
|
|
4627
|
+
return (0, import_errors2.adcpError)("SERVICE_UNAVAILABLE", { message: error.message, recovery: "transient" });
|
|
4628
|
+
if (error instanceof import_trust.IdentityAuthorizationError)
|
|
4629
|
+
return (0, import_errors2.adcpError)("PERMISSION_DENIED", {
|
|
4630
|
+
message: error.message,
|
|
4631
|
+
...error.details && { details: { ...error.details } }
|
|
4632
|
+
});
|
|
4633
|
+
if (error instanceof import_async_outcome.AdcpError) return projectThrownAdcpError(error);
|
|
4634
|
+
return (0, import_errors2.adcpError)("PERMISSION_DENIED", { message: "Agent authorization failed" });
|
|
4635
|
+
}
|
|
4636
|
+
return void 0;
|
|
4637
|
+
}
|
|
4638
|
+
for (const field of ["request_signing", "webhook_signing"]) {
|
|
4639
|
+
const signing = capabilitiesData[field];
|
|
4640
|
+
if (signing?.profiles?.includes("web-bot-auth")) signing.wba_draft_revision = import_web_bot_auth2.WEB_BOT_AUTH_DRAFT_REVISION;
|
|
4641
|
+
}
|
|
4435
4642
|
server.registerTool(
|
|
4436
4643
|
"get_adcp_capabilities",
|
|
4437
4644
|
{
|
|
@@ -4440,6 +4647,10 @@ function createAdcpServer(config) {
|
|
|
4440
4647
|
_meta: frameworkToolMeta
|
|
4441
4648
|
},
|
|
4442
4649
|
(async (params, extra = {}) => {
|
|
4650
|
+
const authorizationFailure = (0, import_web_bot_auth2.getWebBotAuthAuthorizationFailure)(extra.authInfo?.extra);
|
|
4651
|
+
if (authorizationFailure) return (0, import_web_bot_auth2.webBotAuthToolFailure)(authorizationFailure, servedAdcpVersion);
|
|
4652
|
+
const identityError = await authorizeAuxiliaryIdentityTool("get_adcp_capabilities", params, extra);
|
|
4653
|
+
if (identityError) return identityError;
|
|
4443
4654
|
const callRequestValidationMode = effectiveRequestValidationMode(extra);
|
|
4444
4655
|
const requestParams = isPlainObject(params) ? params : {};
|
|
4445
4656
|
const releaseSelection = selectServedAdcpRelease(requestParams, capConfig, adcpVersion, defaultAdcpVersion);
|
|
@@ -4574,7 +4785,12 @@ function createAdcpServer(config) {
|
|
|
4574
4785
|
delete validationPayload.media_buy.proposal_refinement;
|
|
4575
4786
|
delete validationPayload.media_buy.lifecycle_tools;
|
|
4576
4787
|
}
|
|
4577
|
-
const responseOutcome = (0,
|
|
4788
|
+
const responseOutcome = config.identity33 && (0, import_adcp_version_config.isAdcpVersionAtLeast)(release.wireVersion, "3.3") ? (0, import_validation.validateIdentity33Payload)(
|
|
4789
|
+
"get_adcp_capabilities",
|
|
4790
|
+
"response",
|
|
4791
|
+
validationPayload,
|
|
4792
|
+
release.validationVersion
|
|
4793
|
+
) : (0, import_schema_validator.validateResponse)("get_adcp_capabilities", validationPayload, release.validationVersion);
|
|
4578
4794
|
if (!responseOutcome.valid) {
|
|
4579
4795
|
logger.warn(
|
|
4580
4796
|
`Schema validation warning (response) for get_adcp_capabilities: ${(0, import_schema_validator.formatIssues)(responseOutcome.issues, 3, { rootSchemaId: responseOutcome.schemaId })}`,
|
|
@@ -4649,7 +4865,7 @@ function createAdcpServer(config) {
|
|
|
4649
4865
|
if (listMcpToolProfile !== "media-buy") return tool;
|
|
4650
4866
|
const toolName = tool?.name;
|
|
4651
4867
|
if (typeof toolName !== "string") return tool;
|
|
4652
|
-
const inputSchema = (0,
|
|
4868
|
+
const inputSchema = (0, import_schema_loader2.getMcpProfileInputSchema)(toolName, "media-buy", listRelease.validationVersion);
|
|
4653
4869
|
return inputSchema ? { ...tool, inputSchema } : tool;
|
|
4654
4870
|
});
|
|
4655
4871
|
return {
|
|
@@ -4800,6 +5016,30 @@ function createAdcpServer(config) {
|
|
|
4800
5016
|
protocols,
|
|
4801
5017
|
signedRequests: signedRequestsState
|
|
4802
5018
|
});
|
|
5019
|
+
if (config.identity33) {
|
|
5020
|
+
for (const method of [
|
|
5021
|
+
"initialize",
|
|
5022
|
+
"tools/list",
|
|
5023
|
+
"tools/call",
|
|
5024
|
+
"resources/list",
|
|
5025
|
+
"resources/read",
|
|
5026
|
+
"prompts/list",
|
|
5027
|
+
"prompts/get",
|
|
5028
|
+
"tasks/get",
|
|
5029
|
+
"tasks/list",
|
|
5030
|
+
"tasks/cancel",
|
|
5031
|
+
"tasks/result"
|
|
5032
|
+
])
|
|
5033
|
+
(0, import_adcp_server.wrapSdkRequestHandler)(
|
|
5034
|
+
server,
|
|
5035
|
+
method,
|
|
5036
|
+
(original, request, extra) => (0, import_schema_loader.withIdentity33SchemaScope)(() => original(request, extra))
|
|
5037
|
+
);
|
|
5038
|
+
}
|
|
5039
|
+
(0, import_adcp_server.wrapSdkRequestHandler)(server, "tools/call", (original, request, extra) => {
|
|
5040
|
+
const failure = (0, import_web_bot_auth2.getWebBotAuthAuthorizationFailure)(extra?.authInfo?.extra);
|
|
5041
|
+
return failure ? (0, import_web_bot_auth2.webBotAuthToolFailure)(failure, servedAdcpVersion) : original(request, extra);
|
|
5042
|
+
});
|
|
4803
5043
|
return wrapped;
|
|
4804
5044
|
}
|
|
4805
5045
|
// Annotate the CommonJS export names for ESM import in node:
|