@adcp/sdk 14.0.0 → 14.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/adapters/implicit-account-store.d.mts +12 -7
- package/dist/lib/adapters/implicit-account-store.d.ts +12 -7
- package/dist/lib/adapters/implicit-account-store.js +69 -15
- package/dist/lib/adapters/implicit-account-store.mjs +69 -15
- package/dist/lib/core/AgentClient.d.mts +1 -0
- package/dist/lib/core/AgentClient.d.ts +1 -0
- package/dist/lib/core/AgentClient.js +3 -0
- package/dist/lib/core/AgentClient.mjs +3 -0
- package/dist/lib/core/SingleAgentClient.d.mts +35 -2
- package/dist/lib/core/SingleAgentClient.d.ts +35 -2
- package/dist/lib/core/SingleAgentClient.js +377 -36
- package/dist/lib/core/SingleAgentClient.mjs +387 -38
- package/dist/lib/core/TaskExecutor.d.mts +3 -1
- package/dist/lib/core/TaskExecutor.d.ts +3 -1
- package/dist/lib/core/TaskExecutor.js +17 -12
- package/dist/lib/core/TaskExecutor.mjs +17 -12
- package/dist/lib/core/account-key.d.mts +3 -0
- package/dist/lib/core/account-key.d.ts +3 -0
- package/dist/lib/core/account-key.js +41 -0
- package/dist/lib/core/account-key.mjs +17 -0
- package/dist/lib/core/account-resolution.d.mts +2 -0
- package/dist/lib/core/account-resolution.d.ts +2 -0
- package/dist/lib/core/buyer-account-registry.d.mts +93 -0
- package/dist/lib/core/buyer-account-registry.d.ts +93 -0
- package/dist/lib/core/buyer-account-registry.js +602 -0
- package/dist/lib/core/buyer-account-registry.mjs +578 -0
- package/dist/lib/core/product-cache.d.mts +18 -0
- package/dist/lib/core/product-cache.d.ts +18 -0
- package/dist/lib/core/product-cache.js +137 -0
- package/dist/lib/core/product-cache.mjs +112 -0
- package/dist/lib/errors/index.d.mts +40 -1
- package/dist/lib/errors/index.d.ts +40 -1
- package/dist/lib/errors/index.js +69 -3
- package/dist/lib/errors/index.mjs +64 -3
- package/dist/lib/governance/authorization.d.mts +17 -1
- package/dist/lib/governance/authorization.d.ts +17 -1
- package/dist/lib/governance/authorization.js +55 -7
- package/dist/lib/governance/authorization.mjs +59 -7
- package/dist/lib/governance/index.d.mts +2 -2
- package/dist/lib/governance/index.d.ts +2 -2
- package/dist/lib/governance/index.js +2 -0
- package/dist/lib/governance/index.mjs +3 -1
- package/dist/lib/index.d.mts +7 -4
- package/dist/lib/index.d.ts +7 -4
- package/dist/lib/index.js +29 -0
- package/dist/lib/index.mjs +31 -1
- package/dist/lib/net/agent-transport-fetch.d.mts +4 -0
- package/dist/lib/net/agent-transport-fetch.d.ts +4 -0
- package/dist/lib/net/agent-transport-fetch.js +18 -5
- package/dist/lib/net/agent-transport-fetch.mjs +17 -5
- package/dist/lib/protocols/a2a.js +9 -1
- package/dist/lib/protocols/a2a.mjs +9 -1
- package/dist/lib/protocols/index.js +9 -2
- package/dist/lib/protocols/index.mjs +9 -2
- package/dist/lib/protocols/mcp-modern.js +2 -1
- package/dist/lib/protocols/mcp-modern.mjs +2 -1
- package/dist/lib/protocols/mcp.js +5 -2
- package/dist/lib/protocols/mcp.mjs +5 -2
- package/dist/lib/protocols/rawResponseCapture.d.mts +6 -0
- package/dist/lib/protocols/rawResponseCapture.d.ts +6 -0
- package/dist/lib/protocols/rawResponseCapture.js +41 -29
- package/dist/lib/protocols/rawResponseCapture.mjs +40 -29
- package/dist/lib/protocols/signedRequestRejection.d.mts +9 -0
- package/dist/lib/protocols/signedRequestRejection.d.ts +9 -0
- package/dist/lib/protocols/signedRequestRejection.js +209 -0
- package/dist/lib/protocols/signedRequestRejection.mjs +189 -0
- package/dist/lib/protocols/transportDiagnostics.d.mts +1 -0
- package/dist/lib/protocols/transportDiagnostics.d.ts +1 -0
- package/dist/lib/protocols/transportDiagnostics.js +2 -0
- package/dist/lib/protocols/transportDiagnostics.mjs +1 -0
- package/dist/lib/registry/types.generated.d.mts +112 -45
- package/dist/lib/registry/types.generated.d.ts +112 -45
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/server/account-provisioning.d.mts +2 -0
- package/dist/lib/server/account-provisioning.d.ts +2 -0
- package/dist/lib/server/account-provisioning.js +30 -0
- package/dist/lib/server/account-provisioning.mjs +6 -0
- package/dist/lib/server/account-reference-warnings.d.mts +12 -0
- package/dist/lib/server/account-reference-warnings.d.ts +12 -0
- package/dist/lib/server/account-reference-warnings.js +48 -0
- package/dist/lib/server/account-reference-warnings.mjs +23 -0
- package/dist/lib/server/auth-signature.js +1 -0
- package/dist/lib/server/auth-signature.mjs +1 -0
- package/dist/lib/server/create-adcp-server.d.mts +34 -0
- package/dist/lib/server/create-adcp-server.d.ts +34 -0
- package/dist/lib/server/create-adcp-server.js +225 -14
- package/dist/lib/server/create-adcp-server.mjs +225 -14
- package/dist/lib/server/decisioning/account.d.mts +2 -0
- package/dist/lib/server/decisioning/account.d.ts +2 -0
- package/dist/lib/server/decisioning/runtime/from-platform.js +49 -10
- package/dist/lib/server/decisioning/runtime/from-platform.mjs +49 -10
- package/dist/lib/server/index.d.mts +2 -2
- package/dist/lib/server/index.d.ts +2 -2
- package/dist/lib/server/index.js +2 -0
- package/dist/lib/server/index.mjs +3 -1
- package/dist/lib/signing/agent-resolver/consistency.d.mts +6 -13
- package/dist/lib/signing/agent-resolver/consistency.d.ts +6 -13
- package/dist/lib/signing/agent-resolver/consistency.js +0 -1
- package/dist/lib/signing/agent-resolver/consistency.mjs +0 -1
- package/dist/lib/signing/agent-resolver/errors.d.mts +3 -1
- package/dist/lib/signing/agent-resolver/errors.d.ts +3 -1
- package/dist/lib/signing/agent-resolver/errors.js +6 -0
- package/dist/lib/signing/agent-resolver/errors.mjs +6 -0
- package/dist/lib/signing/agent-resolver/fetch-helpers.d.mts +11 -0
- package/dist/lib/signing/agent-resolver/fetch-helpers.d.ts +11 -0
- package/dist/lib/signing/agent-resolver/fetch-helpers.js +37 -2
- package/dist/lib/signing/agent-resolver/fetch-helpers.mjs +40 -3
- package/dist/lib/signing/agent-resolver/jwks-set.js +24 -3
- package/dist/lib/signing/agent-resolver/jwks-set.mjs +24 -3
- package/dist/lib/signing/agent-resolver/legacy-brand.d.mts +15 -0
- package/dist/lib/signing/agent-resolver/legacy-brand.d.ts +15 -0
- package/dist/lib/signing/agent-resolver/legacy-brand.js +60 -0
- package/dist/lib/signing/agent-resolver/legacy-brand.mjs +36 -0
- package/dist/lib/signing/agent-resolver/operator-authorization.d.mts +13 -0
- package/dist/lib/signing/agent-resolver/operator-authorization.d.ts +13 -0
- package/dist/lib/signing/agent-resolver/operator-authorization.js +108 -0
- package/dist/lib/signing/agent-resolver/operator-authorization.mjs +84 -0
- package/dist/lib/signing/agent-resolver/resolve-agent.d.mts +14 -4
- package/dist/lib/signing/agent-resolver/resolve-agent.d.ts +14 -4
- package/dist/lib/signing/agent-resolver/resolve-agent.js +148 -137
- package/dist/lib/signing/agent-resolver/resolve-agent.mjs +157 -139
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.mts +7 -1
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.ts +7 -1
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.js +50 -17
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.mjs +50 -17
- package/dist/lib/signing/agent-resolver/select-agent.d.mts +14 -15
- package/dist/lib/signing/agent-resolver/select-agent.d.ts +14 -15
- package/dist/lib/signing/agent-resolver/select-agent.js +98 -13
- package/dist/lib/signing/agent-resolver/select-agent.mjs +95 -13
- package/dist/lib/signing/brand-jwks.d.mts +29 -75
- package/dist/lib/signing/brand-jwks.d.ts +29 -75
- package/dist/lib/signing/brand-jwks.js +120 -182
- package/dist/lib/signing/brand-jwks.mjs +120 -182
- package/dist/lib/signing/errors.d.mts +7 -3
- package/dist/lib/signing/errors.d.ts +7 -3
- package/dist/lib/signing/errors.js +7 -2
- package/dist/lib/signing/errors.mjs +7 -2
- package/dist/lib/signing/jwks-https.d.mts +7 -0
- package/dist/lib/signing/jwks-https.d.ts +7 -0
- package/dist/lib/signing/jwks-https.js +31 -8
- package/dist/lib/signing/jwks-https.mjs +31 -8
- package/dist/lib/signing/jwks.d.mts +8 -0
- package/dist/lib/signing/jwks.d.ts +8 -0
- package/dist/lib/signing/middleware.js +2 -1
- package/dist/lib/signing/middleware.mjs +2 -1
- package/dist/lib/signing/publisher-pins.d.mts +11 -0
- package/dist/lib/signing/publisher-pins.d.ts +11 -0
- package/dist/lib/signing/publisher-pins.js +125 -0
- package/dist/lib/signing/publisher-pins.mjs +101 -0
- package/dist/lib/signing/server.d.mts +1 -0
- package/dist/lib/signing/server.d.ts +1 -0
- package/dist/lib/signing/types.d.mts +5 -0
- package/dist/lib/signing/types.d.ts +5 -0
- package/dist/lib/signing/verifier.js +50 -5
- package/dist/lib/signing/verifier.mjs +50 -5
- package/dist/lib/signing/webhook-verifier.d.mts +7 -2
- package/dist/lib/signing/webhook-verifier.d.ts +7 -2
- package/dist/lib/signing/webhook-verifier.js +42 -2
- package/dist/lib/signing/webhook-verifier.mjs +42 -2
- package/dist/lib/testing/storyboard/account-policy.d.mts +2 -0
- package/dist/lib/testing/storyboard/account-policy.d.ts +2 -0
- package/dist/lib/testing/storyboard/account-policy.js +35 -0
- package/dist/lib/testing/storyboard/account-policy.mjs +11 -0
- package/dist/lib/testing/storyboard/context.js +6 -0
- package/dist/lib/testing/storyboard/context.mjs +6 -0
- package/dist/lib/testing/storyboard/request-builder.js +12 -2
- package/dist/lib/testing/storyboard/request-builder.mjs +12 -2
- package/dist/lib/testing/storyboard/runner.js +3 -2
- package/dist/lib/testing/storyboard/runner.mjs +3 -2
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/types/accept-proposal.d.ts +19 -1
- package/dist/lib/types/buy-products.d.ts +19 -1
- package/dist/lib/types/check-governance.d.ts +19 -1
- package/dist/lib/types/comply-test-controller.d.ts +19 -1
- package/dist/lib/types/control-media-buy.d.ts +19 -1
- package/dist/lib/types/core.generated.d.mts +14 -1
- package/dist/lib/types/core.generated.d.ts +14 -1
- package/dist/lib/types/create-media-buy.d.ts +14 -1
- package/dist/lib/types/get-media-buys.d.ts +14 -1
- package/dist/lib/types/get-products.d.ts +19 -1
- package/dist/lib/types/list-products.d.ts +19 -1
- package/dist/lib/types/refine-proposals.d.ts +19 -1
- package/dist/lib/types/request-proposals.d.ts +19 -1
- package/dist/lib/types/schemas.generated.d.ts +12 -3
- package/dist/lib/types/schemas.generated.js +4 -1
- package/dist/lib/types/schemas.generated.mjs +4 -1
- package/dist/lib/types/tools.generated.d.mts +14 -1
- package/dist/lib/types/tools.generated.d.ts +14 -1
- package/dist/lib/types/update-media-buy.d.ts +14 -1
- package/dist/lib/version.d.mts +3 -3
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/dist/lib/version.mjs +3 -3
- package/dist/lib/webhooks/index.d.mts +24 -0
- package/dist/lib/webhooks/index.d.ts +24 -0
- package/dist/lib/webhooks/index.js +50 -24
- package/dist/lib/webhooks/index.mjs +49 -24
- package/dist/lib/wholesale-feed-sync/index.d.mts +2 -0
- package/dist/lib/wholesale-feed-sync/index.d.ts +2 -0
- package/dist/lib/wholesale-feed-sync/index.js +7 -0
- package/dist/lib/wholesale-feed-sync/index.mjs +4 -0
- package/dist/lib/wholesale-feed-sync/mirror.d.mts +97 -0
- package/dist/lib/wholesale-feed-sync/mirror.d.ts +97 -0
- package/dist/lib/wholesale-feed-sync/mirror.js +350 -0
- package/dist/lib/wholesale-feed-sync/mirror.mjs +322 -0
- package/dist/lib/wholesale-feed-sync/sync.d.mts +13 -29
- package/dist/lib/wholesale-feed-sync/sync.d.ts +13 -29
- package/dist/lib/wholesale-feed-sync/sync.js +208 -281
- package/dist/lib/wholesale-feed-sync/sync.mjs +213 -281
- package/dist/lib/wholesale-feed-sync/types.d.mts +4 -3
- package/dist/lib/wholesale-feed-sync/types.d.ts +4 -3
- package/docs/README.md +6 -0
- package/docs/TYPE-SUMMARY.md +2 -2
- package/docs/guides/BUILD-AN-AGENT.md +2 -2
- package/docs/guides/BUYER-QUICKSTART-3.2.md +2 -0
- package/docs/guides/BUYER-STORAGE.md +3 -0
- package/docs/guides/FIRST-CALL-TO-A-SELLER.md +106 -0
- package/docs/guides/SIGNING-GUIDE.md +16 -7
- package/docs/guides/account-resolution.md +132 -10
- package/docs/llms.txt +3 -2
- package/docs/migration-14.0-to-14.1.md +85 -0
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/docs/migration-4.x-to-5.x.md +1 -0
- package/docs/migration-agent-resolution-3.3.md +125 -0
- package/docs/recipes/verifying-inbound-webhooks.md +60 -15
- package/package.json +3 -2
- package/skills/adcp-brand.previous/SKILL.md +0 -200
- package/skills/adcp-creative.previous/SKILL.md +0 -305
- package/skills/adcp-governance.previous/SKILL.md +0 -566
- package/skills/adcp-measurement.previous/SKILL.md +0 -136
- package/skills/adcp-media-buy.previous/SKILL.md +0 -556
- package/skills/adcp-si.previous/SKILL.md +0 -206
- package/skills/adcp-signals.previous/SKILL.md +0 -204
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var legacy_brand_exports = {};
|
|
20
|
+
__export(legacy_brand_exports, {
|
|
21
|
+
fetchLegacyBrandJson: () => fetchLegacyBrandJson
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(legacy_brand_exports);
|
|
24
|
+
var import_brand_jwks = require('../brand-jwks.js');
|
|
25
|
+
var import_etld = require('./etld.js');
|
|
26
|
+
var import_fetch_helpers = require('./fetch-helpers.js');
|
|
27
|
+
async function fetchLegacyBrandJson(agentUrl, options) {
|
|
28
|
+
const agent = new URL(agentUrl);
|
|
29
|
+
let startUrl = `${agent.origin}/.well-known/brand.json`;
|
|
30
|
+
const fetch = (url) => (0, import_brand_jwks.fetchBrandJson)({ ...options, startUrl: url, domainDerived: true, maxRedirects: 1 });
|
|
31
|
+
let result;
|
|
32
|
+
try {
|
|
33
|
+
try {
|
|
34
|
+
result = await fetch(startUrl);
|
|
35
|
+
} catch (err) {
|
|
36
|
+
if (!(err instanceof import_brand_jwks.BrandJsonResolverError) || err.httpStatus !== 404 && err.httpStatus !== 410) throw err;
|
|
37
|
+
const domain = (0, import_etld.eTldPlusOne)(agentUrl);
|
|
38
|
+
if (domain === agent.hostname) throw err;
|
|
39
|
+
startUrl = `https://${domain}/.well-known/brand.json`;
|
|
40
|
+
result = await fetch(startUrl);
|
|
41
|
+
}
|
|
42
|
+
} catch (err) {
|
|
43
|
+
throw new import_fetch_helpers.SafeFetchError(
|
|
44
|
+
"brand.json",
|
|
45
|
+
(0, import_fetch_helpers.classifyDiscoveryFailure)(err).dns_error,
|
|
46
|
+
err instanceof import_brand_jwks.BrandJsonResolverError && err.code === "invalid_body" ? "brand.json body failed strict-JSON parse" : "Legacy brand.json discovery failed",
|
|
47
|
+
err instanceof import_brand_jwks.BrandJsonResolverError ? err.httpStatus : void 0
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
body: result.data,
|
|
52
|
+
url: result.finalUrl,
|
|
53
|
+
fetchedAt: Math.floor(Date.now() / 1e3),
|
|
54
|
+
headers: { "cache-control": result.cacheControl }
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
fetchLegacyBrandJson
|
|
60
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { fetchBrandJson, BrandJsonResolverError } from "../brand-jwks.mjs";
|
|
2
|
+
import { eTldPlusOne } from "./etld.mjs";
|
|
3
|
+
import { SafeFetchError, classifyDiscoveryFailure } from "./fetch-helpers.mjs";
|
|
4
|
+
async function fetchLegacyBrandJson(agentUrl, options) {
|
|
5
|
+
const agent = new URL(agentUrl);
|
|
6
|
+
let startUrl = `${agent.origin}/.well-known/brand.json`;
|
|
7
|
+
const fetch = (url) => fetchBrandJson({ ...options, startUrl: url, domainDerived: true, maxRedirects: 1 });
|
|
8
|
+
let result;
|
|
9
|
+
try {
|
|
10
|
+
try {
|
|
11
|
+
result = await fetch(startUrl);
|
|
12
|
+
} catch (err) {
|
|
13
|
+
if (!(err instanceof BrandJsonResolverError) || err.httpStatus !== 404 && err.httpStatus !== 410) throw err;
|
|
14
|
+
const domain = eTldPlusOne(agentUrl);
|
|
15
|
+
if (domain === agent.hostname) throw err;
|
|
16
|
+
startUrl = `https://${domain}/.well-known/brand.json`;
|
|
17
|
+
result = await fetch(startUrl);
|
|
18
|
+
}
|
|
19
|
+
} catch (err) {
|
|
20
|
+
throw new SafeFetchError(
|
|
21
|
+
"brand.json",
|
|
22
|
+
classifyDiscoveryFailure(err).dns_error,
|
|
23
|
+
err instanceof BrandJsonResolverError && err.code === "invalid_body" ? "brand.json body failed strict-JSON parse" : "Legacy brand.json discovery failed",
|
|
24
|
+
err instanceof BrandJsonResolverError ? err.httpStatus : void 0
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
body: result.data,
|
|
29
|
+
url: result.finalUrl,
|
|
30
|
+
fetchedAt: Math.floor(Date.now() / 1e3),
|
|
31
|
+
headers: { "cache-control": result.cacheControl }
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
fetchLegacyBrandJson
|
|
36
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Optional receiver account authorization, separate from agent origin binding. */
|
|
2
|
+
import type { ResolveAgentOptions } from './resolve-agent.mjs';
|
|
3
|
+
interface ActiveOperatorDelegation {
|
|
4
|
+
validUntil?: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Evaluate the complete cross-origin delegation tuple. Domain matching is
|
|
8
|
+
* against the exact agent eTLD+1 to match step 3 of the
|
|
9
|
+
* discovery algorithm; brand, activity, country, and time remain independent
|
|
10
|
+
* authorization dimensions and must all match the same entry.
|
|
11
|
+
*/
|
|
12
|
+
export declare function checkDelegatedOperatorAuthorization(brandJson: unknown, agentEtld1: string, now: number, options: Pick<ResolveAgentOptions, 'requiredOperatorBrand' | 'requiredOperatorScope' | 'requiredOperatorCountry' | 'allowPrivateIp'>): ActiveOperatorDelegation | undefined;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Optional receiver account authorization, separate from agent origin binding. */
|
|
2
|
+
import type { ResolveAgentOptions } from './resolve-agent';
|
|
3
|
+
interface ActiveOperatorDelegation {
|
|
4
|
+
validUntil?: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Evaluate the complete cross-origin delegation tuple. Domain matching is
|
|
8
|
+
* against the exact agent eTLD+1 to match step 3 of the
|
|
9
|
+
* discovery algorithm; brand, activity, country, and time remain independent
|
|
10
|
+
* authorization dimensions and must all match the same entry.
|
|
11
|
+
*/
|
|
12
|
+
export declare function checkDelegatedOperatorAuthorization(brandJson: unknown, agentEtld1: string, now: number, options: Pick<ResolveAgentOptions, 'requiredOperatorBrand' | 'requiredOperatorScope' | 'requiredOperatorCountry' | 'allowPrivateIp'>): ActiveOperatorDelegation | undefined;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var operator_authorization_exports = {};
|
|
20
|
+
__export(operator_authorization_exports, {
|
|
21
|
+
checkDelegatedOperatorAuthorization: () => checkDelegatedOperatorAuthorization
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(operator_authorization_exports);
|
|
24
|
+
const AUTHORIZED_OPERATOR_SCOPES = /* @__PURE__ */ new Set([
|
|
25
|
+
"all",
|
|
26
|
+
"media_buying",
|
|
27
|
+
"creative_generation",
|
|
28
|
+
"rights_clearance",
|
|
29
|
+
"governance",
|
|
30
|
+
"measurement",
|
|
31
|
+
"agent_operations"
|
|
32
|
+
]);
|
|
33
|
+
const AUTHORIZED_OPERATOR_DOMAIN = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/;
|
|
34
|
+
function checkDelegatedOperatorAuthorization(brandJson, agentEtld1, now, options) {
|
|
35
|
+
if (!brandJson || typeof brandJson !== "object") return void 0;
|
|
36
|
+
const operators = brandJson.authorized_operators;
|
|
37
|
+
if (!Array.isArray(operators)) return void 0;
|
|
38
|
+
let latestValidUntil;
|
|
39
|
+
let matched = false;
|
|
40
|
+
for (const op of operators) {
|
|
41
|
+
if (!op || typeof op !== "object" || Array.isArray(op)) continue;
|
|
42
|
+
const candidate = op;
|
|
43
|
+
const domain = candidate.domain;
|
|
44
|
+
const brands = candidate.brands;
|
|
45
|
+
if (typeof domain !== "string" || !AUTHORIZED_OPERATOR_DOMAIN.test(domain) || !isValidBrandGrant(brands)) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (domain !== agentEtld1) continue;
|
|
49
|
+
const scopes = candidate.scopes;
|
|
50
|
+
if (scopes !== void 0 && !isValidScopeGrant(scopes)) continue;
|
|
51
|
+
const countries = candidate.countries;
|
|
52
|
+
if (countries !== void 0 && !isValidCountryGrant(countries)) continue;
|
|
53
|
+
const validFrom = parseOptionalRfc3339(candidate.valid_from);
|
|
54
|
+
const validUntil = parseOptionalRfc3339(candidate.valid_until);
|
|
55
|
+
if (validFrom === null || validUntil === null) continue;
|
|
56
|
+
if (validFrom !== void 0 && validUntil !== void 0 && validFrom >= validUntil) continue;
|
|
57
|
+
if (validFrom !== void 0 && now < validFrom) continue;
|
|
58
|
+
if (validUntil !== void 0 && now >= validUntil) continue;
|
|
59
|
+
if (!matchesGrant(brands, options.requiredOperatorBrand, "*")) continue;
|
|
60
|
+
if (scopes !== void 0 && !matchesGrant(scopes, options.requiredOperatorScope, "all")) continue;
|
|
61
|
+
if (countries !== void 0 && !matchesGrant(countries, options.requiredOperatorCountry)) continue;
|
|
62
|
+
matched = true;
|
|
63
|
+
if (validUntil === void 0) return {};
|
|
64
|
+
latestValidUntil = Math.max(latestValidUntil ?? Number.NEGATIVE_INFINITY, validUntil);
|
|
65
|
+
}
|
|
66
|
+
return matched ? { validUntil: latestValidUntil } : void 0;
|
|
67
|
+
}
|
|
68
|
+
function isValidBrandGrant(value) {
|
|
69
|
+
return Array.isArray(value) && value.length > 0 && value.every((item) => typeof item === "string" && (item === "*" || /^[a-z0-9_]+$/.test(item)));
|
|
70
|
+
}
|
|
71
|
+
function isValidScopeGrant(value) {
|
|
72
|
+
return Array.isArray(value) && value.length > 0 && new Set(value).size === value.length && value.every((item) => typeof item === "string" && AUTHORIZED_OPERATOR_SCOPES.has(item));
|
|
73
|
+
}
|
|
74
|
+
function isValidCountryGrant(value) {
|
|
75
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string" && /^[A-Z]{2}$/.test(item));
|
|
76
|
+
}
|
|
77
|
+
function matchesGrant(grants, required, wildcard) {
|
|
78
|
+
if (wildcard !== void 0 && grants.includes(wildcard)) return true;
|
|
79
|
+
return required !== void 0 && grants.includes(required);
|
|
80
|
+
}
|
|
81
|
+
function parseOptionalRfc3339(value) {
|
|
82
|
+
if (value === void 0) return void 0;
|
|
83
|
+
if (typeof value !== "string") return null;
|
|
84
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?([Zz]|([+-])(\d{2}):(\d{2}))$/.exec(
|
|
85
|
+
value
|
|
86
|
+
);
|
|
87
|
+
if (!match) return null;
|
|
88
|
+
const year = Number(match[1]);
|
|
89
|
+
const month = Number(match[2]);
|
|
90
|
+
const day = Number(match[3]);
|
|
91
|
+
const hour = Number(match[4]);
|
|
92
|
+
const minute = Number(match[5]);
|
|
93
|
+
const second = Number(match[6]);
|
|
94
|
+
const offsetHour = match[10] === void 0 ? 0 : Number(match[10]);
|
|
95
|
+
const offsetMinute = match[11] === void 0 ? 0 : Number(match[11]);
|
|
96
|
+
if (month < 1 || month > 12 || day < 1 || day > daysInMonth(year, month) || hour > 23 || minute > 59 || second > 59 || offsetHour > 23 || offsetMinute > 59) {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
const parsed = Date.parse(value) / 1e3;
|
|
100
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
101
|
+
}
|
|
102
|
+
function daysInMonth(year, month) {
|
|
103
|
+
return new Date(Date.UTC(year, month, 0)).getUTCDate();
|
|
104
|
+
}
|
|
105
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
106
|
+
0 && (module.exports = {
|
|
107
|
+
checkDelegatedOperatorAuthorization
|
|
108
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const AUTHORIZED_OPERATOR_SCOPES = /* @__PURE__ */ new Set([
|
|
2
|
+
"all",
|
|
3
|
+
"media_buying",
|
|
4
|
+
"creative_generation",
|
|
5
|
+
"rights_clearance",
|
|
6
|
+
"governance",
|
|
7
|
+
"measurement",
|
|
8
|
+
"agent_operations"
|
|
9
|
+
]);
|
|
10
|
+
const AUTHORIZED_OPERATOR_DOMAIN = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/;
|
|
11
|
+
function checkDelegatedOperatorAuthorization(brandJson, agentEtld1, now, options) {
|
|
12
|
+
if (!brandJson || typeof brandJson !== "object") return void 0;
|
|
13
|
+
const operators = brandJson.authorized_operators;
|
|
14
|
+
if (!Array.isArray(operators)) return void 0;
|
|
15
|
+
let latestValidUntil;
|
|
16
|
+
let matched = false;
|
|
17
|
+
for (const op of operators) {
|
|
18
|
+
if (!op || typeof op !== "object" || Array.isArray(op)) continue;
|
|
19
|
+
const candidate = op;
|
|
20
|
+
const domain = candidate.domain;
|
|
21
|
+
const brands = candidate.brands;
|
|
22
|
+
if (typeof domain !== "string" || !AUTHORIZED_OPERATOR_DOMAIN.test(domain) || !isValidBrandGrant(brands)) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (domain !== agentEtld1) continue;
|
|
26
|
+
const scopes = candidate.scopes;
|
|
27
|
+
if (scopes !== void 0 && !isValidScopeGrant(scopes)) continue;
|
|
28
|
+
const countries = candidate.countries;
|
|
29
|
+
if (countries !== void 0 && !isValidCountryGrant(countries)) continue;
|
|
30
|
+
const validFrom = parseOptionalRfc3339(candidate.valid_from);
|
|
31
|
+
const validUntil = parseOptionalRfc3339(candidate.valid_until);
|
|
32
|
+
if (validFrom === null || validUntil === null) continue;
|
|
33
|
+
if (validFrom !== void 0 && validUntil !== void 0 && validFrom >= validUntil) continue;
|
|
34
|
+
if (validFrom !== void 0 && now < validFrom) continue;
|
|
35
|
+
if (validUntil !== void 0 && now >= validUntil) continue;
|
|
36
|
+
if (!matchesGrant(brands, options.requiredOperatorBrand, "*")) continue;
|
|
37
|
+
if (scopes !== void 0 && !matchesGrant(scopes, options.requiredOperatorScope, "all")) continue;
|
|
38
|
+
if (countries !== void 0 && !matchesGrant(countries, options.requiredOperatorCountry)) continue;
|
|
39
|
+
matched = true;
|
|
40
|
+
if (validUntil === void 0) return {};
|
|
41
|
+
latestValidUntil = Math.max(latestValidUntil ?? Number.NEGATIVE_INFINITY, validUntil);
|
|
42
|
+
}
|
|
43
|
+
return matched ? { validUntil: latestValidUntil } : void 0;
|
|
44
|
+
}
|
|
45
|
+
function isValidBrandGrant(value) {
|
|
46
|
+
return Array.isArray(value) && value.length > 0 && value.every((item) => typeof item === "string" && (item === "*" || /^[a-z0-9_]+$/.test(item)));
|
|
47
|
+
}
|
|
48
|
+
function isValidScopeGrant(value) {
|
|
49
|
+
return Array.isArray(value) && value.length > 0 && new Set(value).size === value.length && value.every((item) => typeof item === "string" && AUTHORIZED_OPERATOR_SCOPES.has(item));
|
|
50
|
+
}
|
|
51
|
+
function isValidCountryGrant(value) {
|
|
52
|
+
return Array.isArray(value) && value.every((item) => typeof item === "string" && /^[A-Z]{2}$/.test(item));
|
|
53
|
+
}
|
|
54
|
+
function matchesGrant(grants, required, wildcard) {
|
|
55
|
+
if (wildcard !== void 0 && grants.includes(wildcard)) return true;
|
|
56
|
+
return required !== void 0 && grants.includes(required);
|
|
57
|
+
}
|
|
58
|
+
function parseOptionalRfc3339(value) {
|
|
59
|
+
if (value === void 0) return void 0;
|
|
60
|
+
if (typeof value !== "string") return null;
|
|
61
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?([Zz]|([+-])(\d{2}):(\d{2}))$/.exec(
|
|
62
|
+
value
|
|
63
|
+
);
|
|
64
|
+
if (!match) return null;
|
|
65
|
+
const year = Number(match[1]);
|
|
66
|
+
const month = Number(match[2]);
|
|
67
|
+
const day = Number(match[3]);
|
|
68
|
+
const hour = Number(match[4]);
|
|
69
|
+
const minute = Number(match[5]);
|
|
70
|
+
const second = Number(match[6]);
|
|
71
|
+
const offsetHour = match[10] === void 0 ? 0 : Number(match[10]);
|
|
72
|
+
const offsetMinute = match[11] === void 0 ? 0 : Number(match[11]);
|
|
73
|
+
if (month < 1 || month > 12 || day < 1 || day > daysInMonth(year, month) || hour > 23 || minute > 59 || second > 59 || offsetHour > 23 || offsetMinute > 59) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
const parsed = Date.parse(value) / 1e3;
|
|
77
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
78
|
+
}
|
|
79
|
+
function daysInMonth(year, month) {
|
|
80
|
+
return new Date(Date.UTC(year, month, 0)).getUTCDate();
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
checkDelegatedOperatorAuthorization
|
|
84
|
+
};
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
* `SsrfRefusedError` carries.
|
|
29
29
|
*/
|
|
30
30
|
import type { IdentityKeyOriginPurpose, IdentityPosture } from './capabilities-types.mjs';
|
|
31
|
+
import { type SsrfDnsLookup } from '../../net/index.mjs';
|
|
31
32
|
import { type ConsistencyResult } from './consistency.mjs';
|
|
32
33
|
import { type AgentResolverErrorDetail } from './errors.mjs';
|
|
33
34
|
import { type AgentEntry } from './select-agent.mjs';
|
|
@@ -48,6 +49,13 @@ export interface FetchCapabilitiesFn {
|
|
|
48
49
|
export interface ResolveAgentOptions {
|
|
49
50
|
/** Default `'mcp'`. Ignored when `fetchCapabilities` is supplied. */
|
|
50
51
|
protocol?: AgentProtocol;
|
|
52
|
+
/** URL matching is mandatory; these filters may only narrow it. */
|
|
53
|
+
expectedBrandJsonUrl?: string;
|
|
54
|
+
agentType?: string;
|
|
55
|
+
agentId?: string;
|
|
56
|
+
/** Enable the 3.x webhook-only fallback when brand_json_url is absent. */
|
|
57
|
+
legacyWebhookFallback?: boolean;
|
|
58
|
+
lookup?: SsrfDnsLookup;
|
|
51
59
|
/**
|
|
52
60
|
* Override the capabilities-fetch step entirely. Tests pass a fake; production
|
|
53
61
|
* callers who already hold a configured protocol client can wire it through
|
|
@@ -85,10 +93,7 @@ export interface ResolveAgentOptions {
|
|
|
85
93
|
*/
|
|
86
94
|
declaredPurposes?: readonly IdentityKeyOriginPurpose[];
|
|
87
95
|
/**
|
|
88
|
-
*
|
|
89
|
-
* `true`, the step-7 origin-consistency check is skipped for the
|
|
90
|
-
* webhook-signing purpose only (operator-side webhook-signing remains
|
|
91
|
-
* checked). Buyer-side / receive-side verifiers MUST leave this unset.
|
|
96
|
+
* @deprecated Publisher pins never skip origin consistency. Ignored.
|
|
92
97
|
*/
|
|
93
98
|
publisherPinned?: {
|
|
94
99
|
webhook_signing?: boolean;
|
|
@@ -126,6 +131,11 @@ export interface TraceStep {
|
|
|
126
131
|
export interface AgentResolution {
|
|
127
132
|
agentUrl: string;
|
|
128
133
|
brandJsonUrl: string;
|
|
134
|
+
/** Exact selected operator record; use it for signed-buyer governance. */
|
|
135
|
+
brandJson?: unknown;
|
|
136
|
+
brandJsonCacheControl?: string;
|
|
137
|
+
/** True only on the explicitly enabled 3.x webhook compatibility path. */
|
|
138
|
+
legacyWebhookFallback?: boolean;
|
|
129
139
|
agentEntry: AgentEntry;
|
|
130
140
|
jwksUri: string;
|
|
131
141
|
jwks: {
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
* `SsrfRefusedError` carries.
|
|
29
29
|
*/
|
|
30
30
|
import type { IdentityKeyOriginPurpose, IdentityPosture } from './capabilities-types';
|
|
31
|
+
import { type SsrfDnsLookup } from '../../net';
|
|
31
32
|
import { type ConsistencyResult } from './consistency';
|
|
32
33
|
import { type AgentResolverErrorDetail } from './errors';
|
|
33
34
|
import { type AgentEntry } from './select-agent';
|
|
@@ -48,6 +49,13 @@ export interface FetchCapabilitiesFn {
|
|
|
48
49
|
export interface ResolveAgentOptions {
|
|
49
50
|
/** Default `'mcp'`. Ignored when `fetchCapabilities` is supplied. */
|
|
50
51
|
protocol?: AgentProtocol;
|
|
52
|
+
/** URL matching is mandatory; these filters may only narrow it. */
|
|
53
|
+
expectedBrandJsonUrl?: string;
|
|
54
|
+
agentType?: string;
|
|
55
|
+
agentId?: string;
|
|
56
|
+
/** Enable the 3.x webhook-only fallback when brand_json_url is absent. */
|
|
57
|
+
legacyWebhookFallback?: boolean;
|
|
58
|
+
lookup?: SsrfDnsLookup;
|
|
51
59
|
/**
|
|
52
60
|
* Override the capabilities-fetch step entirely. Tests pass a fake; production
|
|
53
61
|
* callers who already hold a configured protocol client can wire it through
|
|
@@ -85,10 +93,7 @@ export interface ResolveAgentOptions {
|
|
|
85
93
|
*/
|
|
86
94
|
declaredPurposes?: readonly IdentityKeyOriginPurpose[];
|
|
87
95
|
/**
|
|
88
|
-
*
|
|
89
|
-
* `true`, the step-7 origin-consistency check is skipped for the
|
|
90
|
-
* webhook-signing purpose only (operator-side webhook-signing remains
|
|
91
|
-
* checked). Buyer-side / receive-side verifiers MUST leave this unset.
|
|
96
|
+
* @deprecated Publisher pins never skip origin consistency. Ignored.
|
|
92
97
|
*/
|
|
93
98
|
publisherPinned?: {
|
|
94
99
|
webhook_signing?: boolean;
|
|
@@ -126,6 +131,11 @@ export interface TraceStep {
|
|
|
126
131
|
export interface AgentResolution {
|
|
127
132
|
agentUrl: string;
|
|
128
133
|
brandJsonUrl: string;
|
|
134
|
+
/** Exact selected operator record; use it for signed-buyer governance. */
|
|
135
|
+
brandJson?: unknown;
|
|
136
|
+
brandJsonCacheControl?: string;
|
|
137
|
+
/** True only on the explicitly enabled 3.x webhook compatibility path. */
|
|
138
|
+
legacyWebhookFallback?: boolean;
|
|
129
139
|
agentEntry: AgentEntry;
|
|
130
140
|
jwksUri: string;
|
|
131
141
|
jwks: {
|