@adcp/sdk 15.9.0 → 16.0.0-beta.1
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 +16 -2
- package/dist/lib/core/SingleAgentClient.d.ts +16 -2
- package/dist/lib/core/SingleAgentClient.js +259 -62
- package/dist/lib/core/SingleAgentClient.mjs +261 -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/index.d.mts +10 -0
- package/dist/lib/identity-3.3/index.d.ts +10 -0
- package/dist/lib/identity-3.3/index.js +75 -0
- package/dist/lib/identity-3.3/index.mjs +46 -0
- package/dist/lib/identity-3.3/lifecycle.d.mts +113 -0
- package/dist/lib/identity-3.3/lifecycle.d.ts +113 -0
- package/dist/lib/identity-3.3/lifecycle.js +267 -0
- package/dist/lib/identity-3.3/lifecycle.mjs +240 -0
- package/dist/lib/identity-3.3/revocation.d.mts +50 -0
- package/dist/lib/identity-3.3/revocation.d.ts +50 -0
- package/dist/lib/identity-3.3/revocation.js +238 -0
- package/dist/lib/identity-3.3/revocation.mjs +216 -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 +34 -0
- package/dist/lib/identity-3.3/server.d.ts +34 -0
- package/dist/lib/identity-3.3/server.js +219 -0
- package/dist/lib/identity-3.3/server.mjs +194 -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 +94 -0
- package/dist/lib/identity-3.3/trust.d.ts +94 -0
- package/dist/lib/identity-3.3/trust.js +278 -0
- package/dist/lib/identity-3.3/trust.mjs +239 -0
- package/dist/lib/identity-3.3/types.d.mts +127 -0
- package/dist/lib/identity-3.3/types.d.ts +127 -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/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 +80 -25
- package/dist/lib/reporting/bigquery/index.d.ts +80 -25
- package/dist/lib/reporting/bigquery/index.js +184 -81
- package/dist/lib/reporting/bigquery/index.mjs +182 -80
- 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 +10 -0
- package/dist/lib/server/auth-signature.d.ts +10 -0
- package/dist/lib/server/auth-signature.js +61 -2
- package/dist/lib/server/auth-signature.mjs +65 -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 +238 -19
- package/dist/lib/server/create-adcp-server.mjs +240 -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/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/parser.d.mts +1 -1
- package/dist/lib/signing/parser.d.ts +1 -1
- package/dist/lib/signing/parser.js +5 -3
- package/dist/lib/signing/parser.mjs +6 -4
- package/dist/lib/signing/revocation.d.mts +4 -1
- package/dist/lib/signing/revocation.d.ts +4 -1
- package/dist/lib/signing/revocation.js +33 -3
- package/dist/lib/signing/revocation.mjs +31 -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/web-bot-auth.d.mts +117 -0
- package/dist/lib/signing/web-bot-auth.d.ts +117 -0
- package/dist/lib/signing/web-bot-auth.js +660 -0
- package/dist/lib/signing/web-bot-auth.mjs +624 -0
- 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/creative-delivery.d.mts +3 -1
- package/dist/lib/v2/projection/creative-delivery.d.ts +3 -1
- 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/legacy-routes.d.mts +24 -2
- package/dist/lib/v2/projection/legacy-routes.d.ts +24 -2
- package/dist/lib/v2/projection/legacy-routes.js +28 -2
- package/dist/lib/v2/projection/legacy-routes.mjs +26 -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 +132 -46
- package/docs/guides/REPORTING-OPERATIONS.md +25 -4
- 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 +7 -0
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/docs/migration-agent-identity-3.3.md +355 -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 +15 -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,11 @@ 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
|
+
);
|
|
1422
1436
|
const requiredFor = effectiveRequestSigning.required_for ?? [];
|
|
1423
1437
|
const verifier = (0, import_middleware.createExpressVerifier)({
|
|
1424
1438
|
capability: {
|
|
@@ -1440,6 +1454,53 @@ function buildSignedRequestsPreTransport(signedRequests, effectiveRequestSigning
|
|
|
1440
1454
|
return async function adcpPreTransport(req, res) {
|
|
1441
1455
|
const serveContext = (0, import_auth.getServeRequestContext)(req);
|
|
1442
1456
|
const canonicalPublicUrl = serveContext?.publicUrl ? new URL(serveContext.publicUrl) : void 0;
|
|
1457
|
+
if ((0, import_web_bot_auth2.selectSignatureProfile)({ headers: req.headers }) === "web-bot-auth") {
|
|
1458
|
+
try {
|
|
1459
|
+
if (!signedRequests.webBotAuth || !canonicalPublicUrl) throw new import_web_bot_auth2.WebBotAuthError(403, "profile_disabled");
|
|
1460
|
+
if (req.method !== "GET" && req.rawBody === void 0) throw new import_web_bot_auth2.WebBotAuthError(403, "raw_body_missing");
|
|
1461
|
+
const requestTarget = canonicalPublicUrl.origin + (req.url?.startsWith("/") ? req.url : "/" + (req.url ?? ""));
|
|
1462
|
+
const signers = await (0, import_web_bot_auth2.verifyWebBotAuth)(
|
|
1463
|
+
{ method: req.method ?? "POST", url: requestTarget, headers: req.headers, body: req.rawBody ?? "" },
|
|
1464
|
+
{
|
|
1465
|
+
directory: signedRequests.webBotAuth.directory,
|
|
1466
|
+
deferAuthorizationErrors: typeof (0, import_operation_resolution.resolveRequestOperation)({ rawBody: req.rawBody, method: req.method, url: req.url }) === "string",
|
|
1467
|
+
replayStore: signedRequests.replayStore,
|
|
1468
|
+
isRevoked: signedRequests.webBotAuth.isRevoked,
|
|
1469
|
+
requireFreshRevocation: ![
|
|
1470
|
+
"get_adcp_capabilities",
|
|
1471
|
+
"get_principal",
|
|
1472
|
+
"list_creative_formats",
|
|
1473
|
+
"list_accounts"
|
|
1474
|
+
].includes(String((0, import_operation_resolution.resolveRequestOperation)({ rawBody: req.rawBody, method: req.method, url: req.url })))
|
|
1475
|
+
}
|
|
1476
|
+
);
|
|
1477
|
+
const operation = (0, import_operation_resolution.resolveRequestOperation)({ rawBody: req.rawBody, method: req.method, url: req.url });
|
|
1478
|
+
const principal = await signedRequests.webBotAuth.resolvePrincipal(signers, operation);
|
|
1479
|
+
const signer = signers[signers.length - 1];
|
|
1480
|
+
const failed = signers.find((s) => s.authorizationFailure);
|
|
1481
|
+
const guardedPrincipal = {
|
|
1482
|
+
...principal,
|
|
1483
|
+
extra: {
|
|
1484
|
+
...principal.extra,
|
|
1485
|
+
webBotAuthAuthorization: {
|
|
1486
|
+
signer: failed ?? signer,
|
|
1487
|
+
...failed && { authorizationFailure: failed.authorizationFailure }
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
};
|
|
1491
|
+
attachVerifiedSignerAuth(req, guardedPrincipal, {
|
|
1492
|
+
keyid: signer.keyid,
|
|
1493
|
+
agent_url: signer.origin,
|
|
1494
|
+
verified_at: signer.verified_at
|
|
1495
|
+
});
|
|
1496
|
+
return false;
|
|
1497
|
+
} catch (error) {
|
|
1498
|
+
const rejected = error instanceof import_web_bot_auth2.WebBotAuthError ? error : new import_web_bot_auth2.WebBotAuthError(403, "identity_rejected");
|
|
1499
|
+
res.writeHead(rejected.status, { ...rejected.headers, "Content-Type": "application/json" });
|
|
1500
|
+
res.end(JSON.stringify(rejected.body));
|
|
1501
|
+
return true;
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1443
1504
|
const reqShim = {
|
|
1444
1505
|
method: req.method ?? "POST",
|
|
1445
1506
|
url: req.url ?? "/mcp",
|
|
@@ -1483,6 +1544,7 @@ function buildSignedRequestsPreTransport(signedRequests, effectiveRequestSigning
|
|
|
1483
1544
|
resolve();
|
|
1484
1545
|
};
|
|
1485
1546
|
res.once("finish", () => {
|
|
1547
|
+
verifierCompleted = true;
|
|
1486
1548
|
if (res.writableEnded) handled = true;
|
|
1487
1549
|
done();
|
|
1488
1550
|
});
|
|
@@ -1490,8 +1552,7 @@ function buildSignedRequestsPreTransport(signedRequests, effectiveRequestSigning
|
|
|
1490
1552
|
if (!verifierCompleted) handled = true;
|
|
1491
1553
|
done();
|
|
1492
1554
|
});
|
|
1493
|
-
verifier(reqShim, resShim, (err) => {
|
|
1494
|
-
verifierCompleted = true;
|
|
1555
|
+
verifier(reqShim, resShim, async (err) => {
|
|
1495
1556
|
if (err) {
|
|
1496
1557
|
const errName = err.name || "Error";
|
|
1497
1558
|
const errCode = err.code ?? "unknown";
|
|
@@ -1506,6 +1567,11 @@ function buildSignedRequestsPreTransport(signedRequests, effectiveRequestSigning
|
|
|
1506
1567
|
const verifiedSigner = reqShim.verifiedSigner;
|
|
1507
1568
|
if (!err && verifiedSigner) {
|
|
1508
1569
|
try {
|
|
1570
|
+
if (legacyOriginGate) {
|
|
1571
|
+
if (!verifiedSigner.agent_url)
|
|
1572
|
+
throw new import_auth.AuthError("Legacy signer origin is required for migration fencing");
|
|
1573
|
+
await legacyOriginGate(verifiedSigner.agent_url);
|
|
1574
|
+
}
|
|
1509
1575
|
const principal = (0, import_auth_signature.principalForVerifiedSigner)(verifiedSigner, signedRequests.makePrincipal);
|
|
1510
1576
|
attachVerifiedSignerAuth(req, principal, verifiedSigner);
|
|
1511
1577
|
} catch (identityError) {
|
|
@@ -1525,6 +1591,7 @@ function buildSignedRequestsPreTransport(signedRequests, effectiveRequestSigning
|
|
|
1525
1591
|
handled = true;
|
|
1526
1592
|
}
|
|
1527
1593
|
}
|
|
1594
|
+
verifierCompleted = true;
|
|
1528
1595
|
if (res.writableEnded) handled = true;
|
|
1529
1596
|
done();
|
|
1530
1597
|
});
|
|
@@ -1674,7 +1741,7 @@ function supportedVersionsForTool(toolName, ranges, capConfig, serverPin) {
|
|
|
1674
1741
|
}
|
|
1675
1742
|
const PUSH_OPERATION_ID_PATTERN = /^[A-Za-z0-9_.:-]{1,255}$/;
|
|
1676
1743
|
function releaseRequiresPushOperationId(release) {
|
|
1677
|
-
return (0, import_adcp_version_config.isAdcpVersionAtLeast)((0,
|
|
1744
|
+
return (0, import_adcp_version_config.isAdcpVersionAtLeast)((0, import_schema_loader2.resolveBundleKey)(release), "3.2.0-beta.5");
|
|
1678
1745
|
}
|
|
1679
1746
|
function pushOperationIdError(params, release) {
|
|
1680
1747
|
const config = params.push_notification_config;
|
|
@@ -1744,7 +1811,7 @@ function bundledReleasesForMajors(majors, configured) {
|
|
|
1744
1811
|
const acceptedMajors = new Set(majors);
|
|
1745
1812
|
const releases = /* @__PURE__ */ new Map();
|
|
1746
1813
|
bundledCompatibleReleases ??= import_version.COMPATIBLE_ADCP_VERSIONS.flatMap((version) => {
|
|
1747
|
-
if (!(0,
|
|
1814
|
+
if (!(0, import_schema_loader2.hasSchemaBundle)(version)) return [];
|
|
1748
1815
|
const parsed = parseAdcpRelease(version);
|
|
1749
1816
|
return parsed ? [parsed] : [];
|
|
1750
1817
|
});
|
|
@@ -1828,7 +1895,7 @@ function selectServedAdcpRelease(params, capConfig, serverPin, defaultPin) {
|
|
|
1828
1895
|
return {
|
|
1829
1896
|
validationVersion,
|
|
1830
1897
|
advertisedVersion: selected.exactValue,
|
|
1831
|
-
...(0, import_protocols.bundleSupportsAdcpVersionField)((0,
|
|
1898
|
+
...(0, import_protocols.bundleSupportsAdcpVersionField)((0, import_schema_loader2.resolveBundleKey)(validationVersion)) && { wireVersion: validationVersion }
|
|
1832
1899
|
};
|
|
1833
1900
|
}
|
|
1834
1901
|
const ACCOUNT_VIA_RESOURCE_TOOLS = /* @__PURE__ */ new Set(["refine_proposals", "decline_proposals"]);
|
|
@@ -1857,6 +1924,11 @@ function isAuthDerivedAccountNotFound(err) {
|
|
|
1857
1924
|
return err instanceof import_async_outcome.AdcpError && err.code === "ACCOUNT_NOT_FOUND";
|
|
1858
1925
|
}
|
|
1859
1926
|
function createAdcpServer(config) {
|
|
1927
|
+
if (Boolean(config.identity33) !== (0, import_schema_loader.isIdentity33SchemaScope)())
|
|
1928
|
+
return (0, import_schema_loader.withIdentity33SchemaScope)(() => {
|
|
1929
|
+
const instance = createAdcpServer(config);
|
|
1930
|
+
return config.identity33 ? (0, import_schema_loader.bindIdentity33SchemaScope)(instance) : instance;
|
|
1931
|
+
}, Boolean(config.identity33));
|
|
1860
1932
|
const {
|
|
1861
1933
|
name,
|
|
1862
1934
|
version,
|
|
@@ -1948,7 +2020,7 @@ function createAdcpServer(config) {
|
|
|
1948
2020
|
}
|
|
1949
2021
|
const credentialPolicyPatterns = credentialPolicy === void 0 || typeof credentialPolicy === "string" ? void 0 : credentialPolicy.patterns;
|
|
1950
2022
|
const adcpVersion = (0, import_adcp_version_config.resolveAdcpVersion)(
|
|
1951
|
-
configuredAdcpVersion ?? (config.proposalNegotiation ? import_version2.ADCP_VERSION : void 0)
|
|
2023
|
+
configuredAdcpVersion ?? (config.identity33 ? "3.3" : config.proposalNegotiation ? import_version2.ADCP_VERSION : void 0)
|
|
1952
2024
|
);
|
|
1953
2025
|
const toolVersionRanges = parseToolVersionRanges(config.toolVersions);
|
|
1954
2026
|
const toolAvailableForRelease = (toolName, release) => toolIsAvailableInRelease(toolVersionRanges, toolName, release);
|
|
@@ -2013,14 +2085,31 @@ function createAdcpServer(config) {
|
|
|
2013
2085
|
"createAdcpServer: proposalNegotiation.capabilities.supported_dimensions is required when refineProposals is registered"
|
|
2014
2086
|
);
|
|
2015
2087
|
}
|
|
2016
|
-
const protocolBundleKey = (0,
|
|
2088
|
+
const protocolBundleKey = (0, import_schema_loader2.resolveBundleKey)(adcpVersion);
|
|
2017
2089
|
const frameworkToolMeta = { adcp_version: adcpVersion };
|
|
2018
2090
|
const servedAdcpVersion = (() => {
|
|
2019
|
-
const bundleKey = (0,
|
|
2091
|
+
const bundleKey = (0, import_schema_loader2.resolveBundleKey)(defaultAdcpVersion);
|
|
2020
2092
|
return (0, import_protocols.bundleSupportsAdcpVersionField)(bundleKey) ? bundleKey : void 0;
|
|
2021
2093
|
})();
|
|
2022
2094
|
const protocolTaskRelease = parseAdcpRelease(protocolBundleKey);
|
|
2023
2095
|
const supportsProtocolTaskTools = protocolTaskRelease !== void 0 && (protocolTaskRelease.major > 3 || protocolTaskRelease.major === 3 && protocolTaskRelease.minor >= 1);
|
|
2096
|
+
const identityOnboarding = capConfig?.account?.agent_onboarding ?? capConfig?.account?.agentOnboarding;
|
|
2097
|
+
if (identityOnboarding) {
|
|
2098
|
+
if (!config.identity33) throw new Error("agent_onboarding requires the identity33 experiment");
|
|
2099
|
+
(0, import_lifecycle.validateAgentOnboarding)(
|
|
2100
|
+
identityOnboarding,
|
|
2101
|
+
{ sandbox: capConfig?.account?.sandbox, supported_billing: capConfig?.account?.supportedBilling },
|
|
2102
|
+
capConfig?.overrides?.experimental_features ?? []
|
|
2103
|
+
);
|
|
2104
|
+
}
|
|
2105
|
+
if (signedRequests?.webBotAuth && (!config.identity33 || !(capConfig?.overrides?.request_signing?.profiles ?? capConfig?.request_signing?.profiles)?.includes(
|
|
2106
|
+
"web-bot-auth"
|
|
2107
|
+
)))
|
|
2108
|
+
throw new Error("Web Bot Auth verifier requires identity33 and request_signing.profiles advertisement");
|
|
2109
|
+
if (config.webhooks?.signingProfile === "web-bot-auth")
|
|
2110
|
+
throw new Error("Select Web Bot Auth on each trusted webhook registration, not as a server-wide default");
|
|
2111
|
+
if (config.webhooks?.webBotAuth && !config.identity33)
|
|
2112
|
+
throw new Error("Web Bot Auth webhook signing requires the identity33 experiment");
|
|
2024
2113
|
const toolsWithErrorArm = (0, import_error_arm_tools.getToolsWithErrorArm)(adcpVersion);
|
|
2025
2114
|
const isProduction = process.env.NODE_ENV === "production";
|
|
2026
2115
|
const requestValidationMode = validationConfig?.requests ?? (isProduction ? "off" : "strict");
|
|
@@ -2226,7 +2315,7 @@ function createAdcpServer(config) {
|
|
|
2226
2315
|
const releaseDefinesTool = (toolName, release) => {
|
|
2227
2316
|
if (toolName === "refine_proposals") return true;
|
|
2228
2317
|
try {
|
|
2229
|
-
return (0,
|
|
2318
|
+
return (0, import_schema_loader2.getValidator)(toolName, "request", release.validationVersion) !== void 0;
|
|
2230
2319
|
} catch {
|
|
2231
2320
|
return false;
|
|
2232
2321
|
}
|
|
@@ -2579,6 +2668,10 @@ function createAdcpServer(config) {
|
|
|
2579
2668
|
const hasAccount = "account" in schema.shape;
|
|
2580
2669
|
const wrap = meta?.wrap ?? ((data, summary) => genericResponse(toolName, data, summary));
|
|
2581
2670
|
const toolHandler = async (params, extra) => {
|
|
2671
|
+
const authorizationFailure = (0, import_web_bot_auth2.getWebBotAuthAuthorizationFailure)(extra?.authInfo?.extra);
|
|
2672
|
+
if (authorizationFailure) return (0, import_web_bot_auth2.webBotAuthToolFailure)(authorizationFailure, servedAdcpVersion);
|
|
2673
|
+
if (config.identity33 && !(0, import_schema_loader.isIdentity33SchemaScope)())
|
|
2674
|
+
return (0, import_schema_loader.withIdentity33SchemaScope)(() => toolHandler(params, extra));
|
|
2582
2675
|
const callRequestValidationMode = effectiveRequestValidationMode(extra);
|
|
2583
2676
|
let notificationFailureRows = /* @__PURE__ */ new Map();
|
|
2584
2677
|
const releaseSelection = selectServedAdcpRelease(params, capConfig, adcpVersion, defaultAdcpVersion);
|
|
@@ -2633,6 +2726,22 @@ function createAdcpServer(config) {
|
|
|
2633
2726
|
})
|
|
2634
2727
|
);
|
|
2635
2728
|
}
|
|
2729
|
+
for (const field of ["push_notification_config", "reporting_webhook", "artifact_webhook"]) {
|
|
2730
|
+
const registration = params[field];
|
|
2731
|
+
if (!registration || typeof registration !== "object" || Array.isArray(registration)) continue;
|
|
2732
|
+
const selectedProfile = registration.signing_profile;
|
|
2733
|
+
if (selectedProfile === void 0) continue;
|
|
2734
|
+
const offered = capabilitiesData.webhook_signing?.profiles ?? [
|
|
2735
|
+
"adcp/webhook-signing/v1"
|
|
2736
|
+
];
|
|
2737
|
+
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)
|
|
2738
|
+
return finalize(
|
|
2739
|
+
(0, import_errors2.adcpError)("INVALID_REQUEST", {
|
|
2740
|
+
message: "Unsupported or ambiguous webhook signing profile",
|
|
2741
|
+
field: `${field}.signing_profile`
|
|
2742
|
+
})
|
|
2743
|
+
);
|
|
2744
|
+
}
|
|
2636
2745
|
const operationIdError = pushOperationIdError(params, requestRelease);
|
|
2637
2746
|
if (operationIdError) return finalize(operationIdError);
|
|
2638
2747
|
if (toolName === "list_account_changes" && Object.hasOwn(params, "cursor") && Object.hasOwn(params, "starting_position")) {
|
|
@@ -2812,7 +2921,8 @@ function createAdcpServer(config) {
|
|
|
2812
2921
|
"request",
|
|
2813
2922
|
params,
|
|
2814
2923
|
requestRelease.validationVersion,
|
|
2815
|
-
proposalRefinementCapabilities
|
|
2924
|
+
proposalRefinementCapabilities,
|
|
2925
|
+
!!config.identity33 && (0, import_adcp_version_config.isAdcpVersionAtLeast)(requestRelease.wireVersion, "3.3")
|
|
2816
2926
|
);
|
|
2817
2927
|
if (!outcome.valid) {
|
|
2818
2928
|
if ("refinementError" in outcome && outcome.refinementError?.code === "UNSUPPORTED_FEATURE") {
|
|
@@ -2867,6 +2977,21 @@ function createAdcpServer(config) {
|
|
|
2867
2977
|
}
|
|
2868
2978
|
}
|
|
2869
2979
|
}
|
|
2980
|
+
if (config.identity33) {
|
|
2981
|
+
try {
|
|
2982
|
+
await config.identity33.authorize(ctx, toolName, params);
|
|
2983
|
+
} catch (error) {
|
|
2984
|
+
if (error instanceof import_trust.IdentityAuthorizationError)
|
|
2985
|
+
return finalize(
|
|
2986
|
+
(0, import_errors2.adcpError)("PERMISSION_DENIED", {
|
|
2987
|
+
message: error.message,
|
|
2988
|
+
...error.details && { details: { ...error.details } }
|
|
2989
|
+
})
|
|
2990
|
+
);
|
|
2991
|
+
if (error instanceof import_async_outcome.AdcpError) return finalize(projectThrownAdcpError(error));
|
|
2992
|
+
return finalize((0, import_errors2.adcpError)("PERMISSION_DENIED", { message: "Agent authorization failed" }));
|
|
2993
|
+
}
|
|
2994
|
+
}
|
|
2870
2995
|
let unresolvedAccountPassThrough = false;
|
|
2871
2996
|
const suppliedAccountRef = hasAccount && params.account != null && !(strictAccountReferences && toolName === "list_accounts");
|
|
2872
2997
|
if (suppliedAccountRef && toolName === "list_accounts") {
|
|
@@ -3058,7 +3183,7 @@ function createAdcpServer(config) {
|
|
|
3058
3183
|
);
|
|
3059
3184
|
}
|
|
3060
3185
|
}
|
|
3061
|
-
const callerScopedResolver = toolName === "sync_agent_notification_configs" ? config.protocol?.resolveScope : toolName === "get_principal" || toolName === "sync_principal" ? config.protocol?.resolvePrincipalScope : void 0;
|
|
3186
|
+
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
3187
|
if (callerScopedResolver || toolName === "report_plan_adjustment") {
|
|
3063
3188
|
if (ctx.authInfo === void 0 && ctx.agent === void 0) {
|
|
3064
3189
|
return finalize(
|
|
@@ -3262,7 +3387,18 @@ function createAdcpServer(config) {
|
|
|
3262
3387
|
if (webhookEmitter) {
|
|
3263
3388
|
const tenantScope = webhookTenantScopeForContext(ctx);
|
|
3264
3389
|
const scopedEmitter = tenantScope === void 0 ? configuredWebhookEmitter : webhookEmitter.forTenantScope(tenantScope);
|
|
3265
|
-
|
|
3390
|
+
const profileBindings = ["push_notification_config", "reporting_webhook", "artifact_webhook"].flatMap(
|
|
3391
|
+
(field) => {
|
|
3392
|
+
const value = params[field];
|
|
3393
|
+
return value?.url && value.signing_profile ? [{ url: value.url, profile: value.signing_profile }] : [];
|
|
3394
|
+
}
|
|
3395
|
+
);
|
|
3396
|
+
ctx.emitWebhook = (delivery) => scopedEmitter.emit({
|
|
3397
|
+
...delivery,
|
|
3398
|
+
...delivery.signingProfile === void 0 && profileBindings.some((binding) => binding.url === delivery.url) && {
|
|
3399
|
+
signingProfile: profileBindings.find((binding) => binding.url === delivery.url).profile
|
|
3400
|
+
}
|
|
3401
|
+
});
|
|
3266
3402
|
}
|
|
3267
3403
|
const handlerParams = notificationFailureRows.size === 0 ? params : {
|
|
3268
3404
|
...params,
|
|
@@ -3740,7 +3876,14 @@ function createAdcpServer(config) {
|
|
|
3740
3876
|
}
|
|
3741
3877
|
if (responseValidationMode !== "off" && !isErrorResponse(formatted)) {
|
|
3742
3878
|
const payload = formatted.structuredContent;
|
|
3743
|
-
const outcome = validateFrameworkPayload(
|
|
3879
|
+
const outcome = validateFrameworkPayload(
|
|
3880
|
+
toolName,
|
|
3881
|
+
"response",
|
|
3882
|
+
payload,
|
|
3883
|
+
requestRelease.validationVersion,
|
|
3884
|
+
void 0,
|
|
3885
|
+
!!config.identity33 && (0, import_adcp_version_config.isAdcpVersionAtLeast)(requestRelease.wireVersion, "3.3")
|
|
3886
|
+
);
|
|
3744
3887
|
if (!outcome.valid) {
|
|
3745
3888
|
logger.warn(
|
|
3746
3889
|
`Schema validation warning (response) for ${toolName}: ${(0, import_schema_validator.formatIssues)(outcome.issues, 3, { rootSchemaId: outcome.schemaId })}`,
|
|
@@ -4025,6 +4168,8 @@ function createAdcpServer(config) {
|
|
|
4025
4168
|
_meta: frameworkToolMeta
|
|
4026
4169
|
},
|
|
4027
4170
|
(async (params, extra) => {
|
|
4171
|
+
const identityError = await authorizeAuxiliaryIdentityTool("get_task_status", params, extra);
|
|
4172
|
+
if (identityError) return finalizeProtocolTaskToolResponse("get_task_status", params ?? {}, identityError);
|
|
4028
4173
|
const credentialError = taskToolCredentialPolicyError("get_task_status", params ?? {}, extra);
|
|
4029
4174
|
if (credentialError) {
|
|
4030
4175
|
return finalizeProtocolTaskToolResponse("get_task_status", params ?? {}, credentialError, {
|
|
@@ -4111,6 +4256,8 @@ function createAdcpServer(config) {
|
|
|
4111
4256
|
_meta: frameworkToolMeta
|
|
4112
4257
|
},
|
|
4113
4258
|
(async (params, extra) => {
|
|
4259
|
+
const identityError = await authorizeAuxiliaryIdentityTool("list_tasks", params, extra);
|
|
4260
|
+
if (identityError) return finalizeProtocolTaskToolResponse("list_tasks", params ?? {}, identityError);
|
|
4114
4261
|
const credentialError = taskToolCredentialPolicyError("list_tasks", params ?? {}, extra);
|
|
4115
4262
|
if (credentialError) {
|
|
4116
4263
|
return finalizeProtocolTaskToolResponse("list_tasks", params ?? {}, credentialError, { echoContext: false });
|
|
@@ -4227,6 +4374,8 @@ function createAdcpServer(config) {
|
|
|
4227
4374
|
);
|
|
4228
4375
|
};
|
|
4229
4376
|
const wrappedHandler = (async (...args) => {
|
|
4377
|
+
const identityError = await authorizeAuxiliaryIdentityTool(customName, args[0], args[args.length - 1]);
|
|
4378
|
+
if (identityError) return finalizeCustomResponse(identityError);
|
|
4230
4379
|
const params = isPlainObject(args[0]) ? args[0] : {};
|
|
4231
4380
|
const selectedRelease = selectServedAdcpRelease(params, capConfig, adcpVersion, defaultAdcpVersion);
|
|
4232
4381
|
if (isMcpToolResponse(selectedRelease)) return finalizeCustomResponse(selectedRelease);
|
|
@@ -4345,6 +4494,7 @@ function createAdcpServer(config) {
|
|
|
4345
4494
|
...capConfig.account.defaultBilling && { default_billing: capConfig.account.defaultBilling },
|
|
4346
4495
|
required_for_products: capConfig.account.requiredForProducts ?? false,
|
|
4347
4496
|
sandbox: capConfig.account.sandbox ?? false,
|
|
4497
|
+
...identityOnboarding && { agent_onboarding: identityOnboarding },
|
|
4348
4498
|
...capConfig.account.changeFeed !== void 0 && { change_feed: capConfig.account.changeFeed }
|
|
4349
4499
|
};
|
|
4350
4500
|
}
|
|
@@ -4386,7 +4536,15 @@ function createAdcpServer(config) {
|
|
|
4386
4536
|
...capabilitiesData.webhook_signing,
|
|
4387
4537
|
supported: true,
|
|
4388
4538
|
profile,
|
|
4389
|
-
algorithms: [
|
|
4539
|
+
algorithms: [
|
|
4540
|
+
.../* @__PURE__ */ new Set([
|
|
4541
|
+
algorithm,
|
|
4542
|
+
...webhooks.webBotAuth ? [
|
|
4543
|
+
("privateKey" in webhooks.webBotAuth.key ? webhooks.webBotAuth.key.privateKey.crv : webhooks.webBotAuth.key.publicKey.crv) === "P-256" ? "ecdsa-p256-sha256" : "ed25519"
|
|
4544
|
+
] : []
|
|
4545
|
+
])
|
|
4546
|
+
],
|
|
4547
|
+
...webhooks.webBotAuth && { profiles: ["adcp/webhook-signing/v1", "web-bot-auth"] },
|
|
4390
4548
|
legacy_hmac_fallback: capabilitiesData.webhook_signing?.legacy_hmac_fallback ?? false,
|
|
4391
4549
|
delivery_retry_horizon_seconds: webhooks.deliveryRetryHorizonSeconds ?? 86400
|
|
4392
4550
|
};
|
|
@@ -4432,6 +4590,34 @@ function createAdcpServer(config) {
|
|
|
4432
4590
|
];
|
|
4433
4591
|
}
|
|
4434
4592
|
capabilitiesData.library_version = `@adcp/client@${import_version2.LIBRARY_VERSION}`;
|
|
4593
|
+
async function authorizeAuxiliaryIdentityTool(toolName, params, extra) {
|
|
4594
|
+
const failure = (0, import_web_bot_auth2.getWebBotAuthAuthorizationFailure)(extra?.authInfo?.extra);
|
|
4595
|
+
if (failure) return (0, import_web_bot_auth2.webBotAuthToolFailure)(failure, servedAdcpVersion);
|
|
4596
|
+
if (!config.identity33) return void 0;
|
|
4597
|
+
try {
|
|
4598
|
+
await config.identity33.authorize(
|
|
4599
|
+
withImmutableServedAdcpVersion(
|
|
4600
|
+
{ toolName, stateStore, authInfo: extra?.authInfo, logger },
|
|
4601
|
+
adcpVersion
|
|
4602
|
+
),
|
|
4603
|
+
toolName,
|
|
4604
|
+
params
|
|
4605
|
+
);
|
|
4606
|
+
} catch (error) {
|
|
4607
|
+
if (error instanceof import_trust.IdentityAuthorizationError)
|
|
4608
|
+
return (0, import_errors2.adcpError)("PERMISSION_DENIED", {
|
|
4609
|
+
message: error.message,
|
|
4610
|
+
...error.details && { details: { ...error.details } }
|
|
4611
|
+
});
|
|
4612
|
+
if (error instanceof import_async_outcome.AdcpError) return projectThrownAdcpError(error);
|
|
4613
|
+
return (0, import_errors2.adcpError)("PERMISSION_DENIED", { message: "Agent authorization failed" });
|
|
4614
|
+
}
|
|
4615
|
+
return void 0;
|
|
4616
|
+
}
|
|
4617
|
+
for (const field of ["request_signing", "webhook_signing"]) {
|
|
4618
|
+
const signing = capabilitiesData[field];
|
|
4619
|
+
if (signing?.profiles?.includes("web-bot-auth")) signing.wba_draft_revision = import_web_bot_auth2.WEB_BOT_AUTH_DRAFT_REVISION;
|
|
4620
|
+
}
|
|
4435
4621
|
server.registerTool(
|
|
4436
4622
|
"get_adcp_capabilities",
|
|
4437
4623
|
{
|
|
@@ -4440,6 +4626,10 @@ function createAdcpServer(config) {
|
|
|
4440
4626
|
_meta: frameworkToolMeta
|
|
4441
4627
|
},
|
|
4442
4628
|
(async (params, extra = {}) => {
|
|
4629
|
+
const authorizationFailure = (0, import_web_bot_auth2.getWebBotAuthAuthorizationFailure)(extra.authInfo?.extra);
|
|
4630
|
+
if (authorizationFailure) return (0, import_web_bot_auth2.webBotAuthToolFailure)(authorizationFailure, servedAdcpVersion);
|
|
4631
|
+
const identityError = await authorizeAuxiliaryIdentityTool("get_adcp_capabilities", params, extra);
|
|
4632
|
+
if (identityError) return identityError;
|
|
4443
4633
|
const callRequestValidationMode = effectiveRequestValidationMode(extra);
|
|
4444
4634
|
const requestParams = isPlainObject(params) ? params : {};
|
|
4445
4635
|
const releaseSelection = selectServedAdcpRelease(requestParams, capConfig, adcpVersion, defaultAdcpVersion);
|
|
@@ -4574,7 +4764,12 @@ function createAdcpServer(config) {
|
|
|
4574
4764
|
delete validationPayload.media_buy.proposal_refinement;
|
|
4575
4765
|
delete validationPayload.media_buy.lifecycle_tools;
|
|
4576
4766
|
}
|
|
4577
|
-
const responseOutcome = (0,
|
|
4767
|
+
const responseOutcome = config.identity33 && (0, import_adcp_version_config.isAdcpVersionAtLeast)(release.wireVersion, "3.3") ? (0, import_validation.validateIdentity33Payload)(
|
|
4768
|
+
"get_adcp_capabilities",
|
|
4769
|
+
"response",
|
|
4770
|
+
validationPayload,
|
|
4771
|
+
release.validationVersion
|
|
4772
|
+
) : (0, import_schema_validator.validateResponse)("get_adcp_capabilities", validationPayload, release.validationVersion);
|
|
4578
4773
|
if (!responseOutcome.valid) {
|
|
4579
4774
|
logger.warn(
|
|
4580
4775
|
`Schema validation warning (response) for get_adcp_capabilities: ${(0, import_schema_validator.formatIssues)(responseOutcome.issues, 3, { rootSchemaId: responseOutcome.schemaId })}`,
|
|
@@ -4649,7 +4844,7 @@ function createAdcpServer(config) {
|
|
|
4649
4844
|
if (listMcpToolProfile !== "media-buy") return tool;
|
|
4650
4845
|
const toolName = tool?.name;
|
|
4651
4846
|
if (typeof toolName !== "string") return tool;
|
|
4652
|
-
const inputSchema = (0,
|
|
4847
|
+
const inputSchema = (0, import_schema_loader2.getMcpProfileInputSchema)(toolName, "media-buy", listRelease.validationVersion);
|
|
4653
4848
|
return inputSchema ? { ...tool, inputSchema } : tool;
|
|
4654
4849
|
});
|
|
4655
4850
|
return {
|
|
@@ -4800,6 +4995,30 @@ function createAdcpServer(config) {
|
|
|
4800
4995
|
protocols,
|
|
4801
4996
|
signedRequests: signedRequestsState
|
|
4802
4997
|
});
|
|
4998
|
+
if (config.identity33) {
|
|
4999
|
+
for (const method of [
|
|
5000
|
+
"initialize",
|
|
5001
|
+
"tools/list",
|
|
5002
|
+
"tools/call",
|
|
5003
|
+
"resources/list",
|
|
5004
|
+
"resources/read",
|
|
5005
|
+
"prompts/list",
|
|
5006
|
+
"prompts/get",
|
|
5007
|
+
"tasks/get",
|
|
5008
|
+
"tasks/list",
|
|
5009
|
+
"tasks/cancel",
|
|
5010
|
+
"tasks/result"
|
|
5011
|
+
])
|
|
5012
|
+
(0, import_adcp_server.wrapSdkRequestHandler)(
|
|
5013
|
+
server,
|
|
5014
|
+
method,
|
|
5015
|
+
(original, request, extra) => (0, import_schema_loader.withIdentity33SchemaScope)(() => original(request, extra))
|
|
5016
|
+
);
|
|
5017
|
+
}
|
|
5018
|
+
(0, import_adcp_server.wrapSdkRequestHandler)(server, "tools/call", (original, request, extra) => {
|
|
5019
|
+
const failure = (0, import_web_bot_auth2.getWebBotAuthAuthorizationFailure)(extra?.authInfo?.extra);
|
|
5020
|
+
return failure ? (0, import_web_bot_auth2.webBotAuthToolFailure)(failure, servedAdcpVersion) : original(request, extra);
|
|
5021
|
+
});
|
|
4803
5022
|
return wrapped;
|
|
4804
5023
|
}
|
|
4805
5024
|
// Annotate the CommonJS export names for ESM import in node:
|