@adcp/sdk 14.0.0 → 14.1.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 +31 -1
- package/dist/lib/core/SingleAgentClient.d.ts +31 -1
- package/dist/lib/core/SingleAgentClient.js +355 -35
- package/dist/lib/core/SingleAgentClient.mjs +365 -37
- package/dist/lib/core/TaskExecutor.js +2 -1
- package/dist/lib/core/TaskExecutor.mjs +2 -1
- 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 +65 -0
- package/dist/lib/core/buyer-account-registry.d.ts +65 -0
- package/dist/lib/core/buyer-account-registry.js +518 -0
- package/dist/lib/core/buyer-account-registry.mjs +494 -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 +5 -3
- package/dist/lib/index.d.ts +5 -3
- package/dist/lib/index.js +20 -0
- package/dist/lib/index.mjs +19 -0
- 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 +1 -1
- package/dist/lib/signing/agent-resolver/errors.d.ts +1 -1
- package/dist/lib/signing/agent-resolver/fetch-helpers.d.mts +2 -0
- package/dist/lib/signing/agent-resolver/fetch-helpers.d.ts +2 -0
- package/dist/lib/signing/agent-resolver/fetch-helpers.js +2 -1
- package/dist/lib/signing/agent-resolver/fetch-helpers.mjs +2 -1
- 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 +101 -132
- package/dist/lib/signing/agent-resolver/resolve-agent.mjs +102 -133
- 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 +27 -75
- package/dist/lib/signing/brand-jwks.d.ts +27 -75
- package/dist/lib/signing/brand-jwks.js +112 -182
- package/dist/lib/signing/brand-jwks.mjs +112 -182
- package/dist/lib/signing/errors.d.mts +3 -1
- package/dist/lib/signing/errors.d.ts +3 -1
- package/dist/lib/signing/errors.js +4 -1
- package/dist/lib/signing/errors.mjs +4 -1
- 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 +49 -4
- package/dist/lib/signing/verifier.mjs +49 -4
- 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 +43 -3
- 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/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/wholesale-feed-sync/sync.d.mts +1 -0
- package/dist/lib/wholesale-feed-sync/sync.d.ts +1 -0
- package/dist/lib/wholesale-feed-sync/sync.js +92 -21
- package/dist/lib/wholesale-feed-sync/sync.mjs +92 -21
- package/dist/lib/wholesale-feed-sync/types.d.mts +4 -3
- package/dist/lib/wholesale-feed-sync/types.d.ts +4 -3
- 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/FIRST-CALL-TO-A-SELLER.md +104 -0
- package/docs/guides/SIGNING-GUIDE.md +16 -7
- package/docs/guides/account-resolution.md +86 -0
- package/docs/llms.txt +3 -2
- 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 +123 -0
- package/docs/recipes/verifying-inbound-webhooks.md +56 -15
- package/package.json +2 -2
|
@@ -28,6 +28,7 @@ __export(authorization_exports, {
|
|
|
28
28
|
buildGovernanceIntentRequest: () => buildGovernanceIntentRequest,
|
|
29
29
|
buildGovernanceProposedCommitment: () => buildGovernanceProposedCommitment,
|
|
30
30
|
computeGovernedPayloadHash: () => computeGovernedPayloadHash,
|
|
31
|
+
createGovernanceAgentJwksResolver: () => createGovernanceAgentJwksResolver,
|
|
31
32
|
createGovernanceEnforcementMiddleware: () => createGovernanceEnforcementMiddleware,
|
|
32
33
|
getGovernanceEnforcementTasks: () => getGovernanceEnforcementTasks,
|
|
33
34
|
governancePurchaseTypeForTask: () => governancePurchaseTypeForTask,
|
|
@@ -40,6 +41,8 @@ module.exports = __toCommonJS(authorization_exports);
|
|
|
40
41
|
var import_node_crypto = require("node:crypto");
|
|
41
42
|
var import_jose = require("jose");
|
|
42
43
|
var import_jcs = require('../utils/jcs.js');
|
|
44
|
+
var import_jwks_https = require('../signing/jwks-https.js');
|
|
45
|
+
var import_select_agent = require('../signing/agent-resolver/select-agent.js');
|
|
43
46
|
var import_strict_json = require('../signing/agent-resolver/strict-json.js');
|
|
44
47
|
const GOVERNANCE_AUTHORIZATION_CRITICAL_CLAIMS = Object.freeze([
|
|
45
48
|
"authorized_commitment",
|
|
@@ -99,6 +102,42 @@ class InMemoryGovernanceReplayStore {
|
|
|
99
102
|
return scope;
|
|
100
103
|
}
|
|
101
104
|
}
|
|
105
|
+
const governanceDefaultResolvers = /* @__PURE__ */ new Map();
|
|
106
|
+
const governanceConfiguredResolvers = /* @__PURE__ */ new WeakMap();
|
|
107
|
+
function createGovernanceAgentJwksResolver(issuer, buyer) {
|
|
108
|
+
const record = (0, import_select_agent.relyingPartyAgentRecord)(buyer.brandJson, buyer.brandDomain);
|
|
109
|
+
const entry = (0, import_select_agent.selectAgentByUrl)(record, issuer, { agentType: "governance" });
|
|
110
|
+
const uri = (0, import_select_agent.agentJwksUri)(entry);
|
|
111
|
+
if (buyer.jwksForUri) return buyer.jwksForUri(uri);
|
|
112
|
+
const key = (0, import_select_agent.canonicalAgentUrl)(uri);
|
|
113
|
+
let cache = governanceDefaultResolvers;
|
|
114
|
+
if (buyer.jwksOptions) {
|
|
115
|
+
const existing = governanceConfiguredResolvers.get(buyer.jwksOptions);
|
|
116
|
+
cache = existing ?? /* @__PURE__ */ new Map();
|
|
117
|
+
if (!existing) governanceConfiguredResolvers.set(buyer.jwksOptions, cache);
|
|
118
|
+
}
|
|
119
|
+
let resolver = cache.get(key);
|
|
120
|
+
if (!resolver) {
|
|
121
|
+
const maxAge = buyer.jwksOptions?.maxAgeSeconds ?? 1800;
|
|
122
|
+
const minCooldown = buyer.jwksOptions?.minCooldownSeconds ?? 30;
|
|
123
|
+
if (!Number.isFinite(maxAge) || maxAge <= 0) {
|
|
124
|
+
throw new TypeError("Governance maxAgeSeconds must be a finite positive number");
|
|
125
|
+
}
|
|
126
|
+
if (!Number.isFinite(minCooldown) || minCooldown < 0) {
|
|
127
|
+
throw new TypeError("Governance minCooldownSeconds must be a finite non-negative number");
|
|
128
|
+
}
|
|
129
|
+
resolver = new import_jwks_https.HttpsJwksResolver(uri, {
|
|
130
|
+
...buyer.jwksOptions,
|
|
131
|
+
maxAgeSeconds: Math.min(maxAge, 1800),
|
|
132
|
+
minCooldownSeconds: Math.max(minCooldown, 30),
|
|
133
|
+
minCacheAgeSeconds: 60,
|
|
134
|
+
failClosed: true
|
|
135
|
+
});
|
|
136
|
+
if (cache.size >= 512) cache.delete(cache.keys().next().value);
|
|
137
|
+
cache.set(key, resolver);
|
|
138
|
+
}
|
|
139
|
+
return resolver;
|
|
140
|
+
}
|
|
102
141
|
function buildGovernanceCommitment(amount, currency) {
|
|
103
142
|
if (!Number.isFinite(amount) || amount < 0) {
|
|
104
143
|
throw new TypeError("Governance commitment amount must be finite and non-negative");
|
|
@@ -300,14 +339,21 @@ async function verifyGovernanceAuthorization(options) {
|
|
|
300
339
|
if (decodedClaims.authorized_task === void 0 !== (decodedClaims.authorized_payload_hash === void 0)) {
|
|
301
340
|
return reject("governance_token_invalid", "authorized_task and authorized_payload_hash must appear together");
|
|
302
341
|
}
|
|
303
|
-
|
|
342
|
+
let canonicalIssuer;
|
|
343
|
+
try {
|
|
344
|
+
if (typeof decodedClaims.iss !== "string") throw new TypeError("Missing issuer");
|
|
345
|
+
canonicalIssuer = (0, import_select_agent.canonicalAgentUrl)(decodedClaims.iss);
|
|
346
|
+
if (canonicalIssuer !== (0, import_select_agent.canonicalAgentUrl)(options.expectedIssuer)) throw new TypeError("Issuer mismatch");
|
|
347
|
+
} catch {
|
|
304
348
|
return reject("governance_token_invalid", "Governance token issuer mismatch");
|
|
305
349
|
}
|
|
306
350
|
const kid = typeof protectedHeader.kid === "string" ? protectedHeader.kid : "";
|
|
307
351
|
if (!kid) return reject("governance_key_unknown", "Governance signing kid is missing");
|
|
308
352
|
let jwk;
|
|
309
353
|
try {
|
|
310
|
-
|
|
354
|
+
const resolver = options.buyerIdentity ? createGovernanceAgentJwksResolver(canonicalIssuer, options.buyerIdentity) : options.jwks;
|
|
355
|
+
if (!resolver) return reject("governance_key_unknown", "No governance key resolver or buyer identity configured");
|
|
356
|
+
jwk = await resolver.resolve(kid);
|
|
311
357
|
} catch {
|
|
312
358
|
return reject("governance_key_unknown", "Governance signing key could not be resolved");
|
|
313
359
|
}
|
|
@@ -331,7 +377,7 @@ async function verifyGovernanceAuthorization(options) {
|
|
|
331
377
|
if (options.revocationStore && await options.revocationStore.isRevoked(kid)) {
|
|
332
378
|
return reject("governance_token_revoked", "Governance signing key is revoked");
|
|
333
379
|
}
|
|
334
|
-
if (options.isJtiRevoked && typeof decodedClaims.jti === "string" && await options.isJtiRevoked(
|
|
380
|
+
if (options.isJtiRevoked && typeof decodedClaims.jti === "string" && await options.isJtiRevoked(canonicalIssuer, decodedClaims.jti)) {
|
|
335
381
|
return reject("governance_token_revoked", "Governance token is revoked");
|
|
336
382
|
}
|
|
337
383
|
} catch {
|
|
@@ -401,8 +447,8 @@ async function verifyGovernanceAuthorization(options) {
|
|
|
401
447
|
let hasFreshCombinedRevocation = false;
|
|
402
448
|
if (options.revocationResolver) {
|
|
403
449
|
try {
|
|
404
|
-
const status = await options.revocationResolver.resolve(
|
|
405
|
-
if (status.issuer !==
|
|
450
|
+
const status = await options.revocationResolver.resolve(canonicalIssuer, kid, decodedClaims.jti);
|
|
451
|
+
if ((0, import_select_agent.canonicalAgentUrl)(status.issuer) !== canonicalIssuer || typeof status.keyRevoked !== "boolean" || typeof status.jtiRevoked !== "boolean" || !Number.isFinite(status.nextUpdate) || status.nextUpdate < now) {
|
|
406
452
|
return reject("governance_token_revoked", "Governance revocation status is stale or mismatched");
|
|
407
453
|
}
|
|
408
454
|
if (status.keyRevoked || status.jtiRevoked) {
|
|
@@ -455,7 +501,7 @@ async function verifyGovernanceAuthorization(options) {
|
|
|
455
501
|
try {
|
|
456
502
|
const idempotencyKey = typeof options.payload.idempotency_key === "string" ? options.payload.idempotency_key : void 0;
|
|
457
503
|
replayResult = await options.replayStore.consume(
|
|
458
|
-
|
|
504
|
+
canonicalIssuer,
|
|
459
505
|
decodedClaims.aud,
|
|
460
506
|
decodedClaims.jti,
|
|
461
507
|
decodedClaims.exp + skew,
|
|
@@ -500,7 +546,8 @@ function createGovernanceEnforcementMiddleware(config) {
|
|
|
500
546
|
expectedTask: input.task,
|
|
501
547
|
payload: input.payload,
|
|
502
548
|
actualCommitment: input.actualCommitment,
|
|
503
|
-
expectedPhase: input.expectedPhase
|
|
549
|
+
expectedPhase: input.expectedPhase,
|
|
550
|
+
...input.buyerIdentity !== void 0 && { buyerIdentity: input.buyerIdentity }
|
|
504
551
|
});
|
|
505
552
|
if (!result.ok) throw new GovernanceAuthorizationError(result);
|
|
506
553
|
return next(result);
|
|
@@ -531,6 +578,7 @@ function decodeJsonObject(segment) {
|
|
|
531
578
|
buildGovernanceIntentRequest,
|
|
532
579
|
buildGovernanceProposedCommitment,
|
|
533
580
|
computeGovernedPayloadHash,
|
|
581
|
+
createGovernanceAgentJwksResolver,
|
|
534
582
|
createGovernanceEnforcementMiddleware,
|
|
535
583
|
getGovernanceEnforcementTasks,
|
|
536
584
|
governancePurchaseTypeForTask,
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { compactVerify, importJWK } from "jose";
|
|
3
3
|
import { canonicalize } from "../utils/jcs.mjs";
|
|
4
|
+
import { HttpsJwksResolver } from "../signing/jwks-https.mjs";
|
|
5
|
+
import {
|
|
6
|
+
relyingPartyAgentRecord,
|
|
7
|
+
selectAgentByUrl,
|
|
8
|
+
agentJwksUri,
|
|
9
|
+
canonicalAgentUrl
|
|
10
|
+
} from "../signing/agent-resolver/select-agent.mjs";
|
|
4
11
|
import { parseStrictJson } from "../signing/agent-resolver/strict-json.mjs";
|
|
5
12
|
const GOVERNANCE_AUTHORIZATION_CRITICAL_CLAIMS = Object.freeze([
|
|
6
13
|
"authorized_commitment",
|
|
@@ -60,6 +67,42 @@ class InMemoryGovernanceReplayStore {
|
|
|
60
67
|
return scope;
|
|
61
68
|
}
|
|
62
69
|
}
|
|
70
|
+
const governanceDefaultResolvers = /* @__PURE__ */ new Map();
|
|
71
|
+
const governanceConfiguredResolvers = /* @__PURE__ */ new WeakMap();
|
|
72
|
+
function createGovernanceAgentJwksResolver(issuer, buyer) {
|
|
73
|
+
const record = relyingPartyAgentRecord(buyer.brandJson, buyer.brandDomain);
|
|
74
|
+
const entry = selectAgentByUrl(record, issuer, { agentType: "governance" });
|
|
75
|
+
const uri = agentJwksUri(entry);
|
|
76
|
+
if (buyer.jwksForUri) return buyer.jwksForUri(uri);
|
|
77
|
+
const key = canonicalAgentUrl(uri);
|
|
78
|
+
let cache = governanceDefaultResolvers;
|
|
79
|
+
if (buyer.jwksOptions) {
|
|
80
|
+
const existing = governanceConfiguredResolvers.get(buyer.jwksOptions);
|
|
81
|
+
cache = existing ?? /* @__PURE__ */ new Map();
|
|
82
|
+
if (!existing) governanceConfiguredResolvers.set(buyer.jwksOptions, cache);
|
|
83
|
+
}
|
|
84
|
+
let resolver = cache.get(key);
|
|
85
|
+
if (!resolver) {
|
|
86
|
+
const maxAge = buyer.jwksOptions?.maxAgeSeconds ?? 1800;
|
|
87
|
+
const minCooldown = buyer.jwksOptions?.minCooldownSeconds ?? 30;
|
|
88
|
+
if (!Number.isFinite(maxAge) || maxAge <= 0) {
|
|
89
|
+
throw new TypeError("Governance maxAgeSeconds must be a finite positive number");
|
|
90
|
+
}
|
|
91
|
+
if (!Number.isFinite(minCooldown) || minCooldown < 0) {
|
|
92
|
+
throw new TypeError("Governance minCooldownSeconds must be a finite non-negative number");
|
|
93
|
+
}
|
|
94
|
+
resolver = new HttpsJwksResolver(uri, {
|
|
95
|
+
...buyer.jwksOptions,
|
|
96
|
+
maxAgeSeconds: Math.min(maxAge, 1800),
|
|
97
|
+
minCooldownSeconds: Math.max(minCooldown, 30),
|
|
98
|
+
minCacheAgeSeconds: 60,
|
|
99
|
+
failClosed: true
|
|
100
|
+
});
|
|
101
|
+
if (cache.size >= 512) cache.delete(cache.keys().next().value);
|
|
102
|
+
cache.set(key, resolver);
|
|
103
|
+
}
|
|
104
|
+
return resolver;
|
|
105
|
+
}
|
|
63
106
|
function buildGovernanceCommitment(amount, currency) {
|
|
64
107
|
if (!Number.isFinite(amount) || amount < 0) {
|
|
65
108
|
throw new TypeError("Governance commitment amount must be finite and non-negative");
|
|
@@ -261,14 +304,21 @@ async function verifyGovernanceAuthorization(options) {
|
|
|
261
304
|
if (decodedClaims.authorized_task === void 0 !== (decodedClaims.authorized_payload_hash === void 0)) {
|
|
262
305
|
return reject("governance_token_invalid", "authorized_task and authorized_payload_hash must appear together");
|
|
263
306
|
}
|
|
264
|
-
|
|
307
|
+
let canonicalIssuer;
|
|
308
|
+
try {
|
|
309
|
+
if (typeof decodedClaims.iss !== "string") throw new TypeError("Missing issuer");
|
|
310
|
+
canonicalIssuer = canonicalAgentUrl(decodedClaims.iss);
|
|
311
|
+
if (canonicalIssuer !== canonicalAgentUrl(options.expectedIssuer)) throw new TypeError("Issuer mismatch");
|
|
312
|
+
} catch {
|
|
265
313
|
return reject("governance_token_invalid", "Governance token issuer mismatch");
|
|
266
314
|
}
|
|
267
315
|
const kid = typeof protectedHeader.kid === "string" ? protectedHeader.kid : "";
|
|
268
316
|
if (!kid) return reject("governance_key_unknown", "Governance signing kid is missing");
|
|
269
317
|
let jwk;
|
|
270
318
|
try {
|
|
271
|
-
|
|
319
|
+
const resolver = options.buyerIdentity ? createGovernanceAgentJwksResolver(canonicalIssuer, options.buyerIdentity) : options.jwks;
|
|
320
|
+
if (!resolver) return reject("governance_key_unknown", "No governance key resolver or buyer identity configured");
|
|
321
|
+
jwk = await resolver.resolve(kid);
|
|
272
322
|
} catch {
|
|
273
323
|
return reject("governance_key_unknown", "Governance signing key could not be resolved");
|
|
274
324
|
}
|
|
@@ -292,7 +342,7 @@ async function verifyGovernanceAuthorization(options) {
|
|
|
292
342
|
if (options.revocationStore && await options.revocationStore.isRevoked(kid)) {
|
|
293
343
|
return reject("governance_token_revoked", "Governance signing key is revoked");
|
|
294
344
|
}
|
|
295
|
-
if (options.isJtiRevoked && typeof decodedClaims.jti === "string" && await options.isJtiRevoked(
|
|
345
|
+
if (options.isJtiRevoked && typeof decodedClaims.jti === "string" && await options.isJtiRevoked(canonicalIssuer, decodedClaims.jti)) {
|
|
296
346
|
return reject("governance_token_revoked", "Governance token is revoked");
|
|
297
347
|
}
|
|
298
348
|
} catch {
|
|
@@ -362,8 +412,8 @@ async function verifyGovernanceAuthorization(options) {
|
|
|
362
412
|
let hasFreshCombinedRevocation = false;
|
|
363
413
|
if (options.revocationResolver) {
|
|
364
414
|
try {
|
|
365
|
-
const status = await options.revocationResolver.resolve(
|
|
366
|
-
if (status.issuer !==
|
|
415
|
+
const status = await options.revocationResolver.resolve(canonicalIssuer, kid, decodedClaims.jti);
|
|
416
|
+
if (canonicalAgentUrl(status.issuer) !== canonicalIssuer || typeof status.keyRevoked !== "boolean" || typeof status.jtiRevoked !== "boolean" || !Number.isFinite(status.nextUpdate) || status.nextUpdate < now) {
|
|
367
417
|
return reject("governance_token_revoked", "Governance revocation status is stale or mismatched");
|
|
368
418
|
}
|
|
369
419
|
if (status.keyRevoked || status.jtiRevoked) {
|
|
@@ -416,7 +466,7 @@ async function verifyGovernanceAuthorization(options) {
|
|
|
416
466
|
try {
|
|
417
467
|
const idempotencyKey = typeof options.payload.idempotency_key === "string" ? options.payload.idempotency_key : void 0;
|
|
418
468
|
replayResult = await options.replayStore.consume(
|
|
419
|
-
|
|
469
|
+
canonicalIssuer,
|
|
420
470
|
decodedClaims.aud,
|
|
421
471
|
decodedClaims.jti,
|
|
422
472
|
decodedClaims.exp + skew,
|
|
@@ -461,7 +511,8 @@ function createGovernanceEnforcementMiddleware(config) {
|
|
|
461
511
|
expectedTask: input.task,
|
|
462
512
|
payload: input.payload,
|
|
463
513
|
actualCommitment: input.actualCommitment,
|
|
464
|
-
expectedPhase: input.expectedPhase
|
|
514
|
+
expectedPhase: input.expectedPhase,
|
|
515
|
+
...input.buyerIdentity !== void 0 && { buyerIdentity: input.buyerIdentity }
|
|
465
516
|
});
|
|
466
517
|
if (!result.ok) throw new GovernanceAuthorizationError(result);
|
|
467
518
|
return next(result);
|
|
@@ -491,6 +542,7 @@ export {
|
|
|
491
542
|
buildGovernanceIntentRequest,
|
|
492
543
|
buildGovernanceProposedCommitment,
|
|
493
544
|
computeGovernedPayloadHash,
|
|
545
|
+
createGovernanceAgentJwksResolver,
|
|
494
546
|
createGovernanceEnforcementMiddleware,
|
|
495
547
|
getGovernanceEnforcementTasks,
|
|
496
548
|
governancePurchaseTypeForTask,
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* advisory — the authoritative check happens in the governance agent, which
|
|
14
14
|
* resolves category synonyms and custom policies server-side.
|
|
15
15
|
*/
|
|
16
|
-
export { GOVERNANCE_AUTHORIZATION_CRITICAL_CLAIMS, GovernanceAuthorizationError, GovernanceReplayStoreAdapter, InMemoryGovernanceReplayStore, buildGovernanceCommitment, buildGovernanceExecutionCommitment, buildGovernanceExecutionRequest, buildGovernanceIntentRequest, buildGovernanceProposedCommitment, computeGovernedPayloadHash, createGovernanceEnforcementMiddleware, getGovernanceEnforcementTasks, governancePurchaseTypeForTask, governanceTaskRequiresProposedCommitment, targetDeclaresGovernanceEnforcement, targetDeclaresLegacyGovernanceAwareness, verifyGovernanceAuthorization, } from './authorization.mjs';
|
|
17
|
-
export type { BuildGovernanceExecutionRequestInput, BuildGovernanceIntentRequestInput, GovernanceAuthorizationClaims, GovernanceAuthorizationCriticalClaim, GovernanceAuthorizationErrorCode, GovernanceAuthorizationFailure, GovernanceAuthorizationResult, GovernanceAuthorizationSuccess, GovernanceCommitment, GovernanceEnforcementMiddleware, GovernanceEnforcementMiddlewareConfig, GovernanceEnforcementMiddlewareInput, GovernanceEnforcementMode, GovernanceEnforcementTask, GovernanceReplayStore, GovernanceReplayBinding, GovernanceRevocationResolver, GovernanceRevocationStatus, InMemoryGovernanceReplayStoreOptions, VerifyGovernanceAuthorizationOptions, } from './authorization.mjs';
|
|
16
|
+
export { GOVERNANCE_AUTHORIZATION_CRITICAL_CLAIMS, GovernanceAuthorizationError, GovernanceReplayStoreAdapter, InMemoryGovernanceReplayStore, buildGovernanceCommitment, buildGovernanceExecutionCommitment, buildGovernanceExecutionRequest, buildGovernanceIntentRequest, buildGovernanceProposedCommitment, computeGovernedPayloadHash, createGovernanceEnforcementMiddleware, getGovernanceEnforcementTasks, governancePurchaseTypeForTask, governanceTaskRequiresProposedCommitment, targetDeclaresGovernanceEnforcement, targetDeclaresLegacyGovernanceAwareness, verifyGovernanceAuthorization, createGovernanceAgentJwksResolver, } from './authorization.mjs';
|
|
17
|
+
export type { BuildGovernanceExecutionRequestInput, BuildGovernanceIntentRequestInput, GovernanceAuthorizationClaims, GovernanceAuthorizationCriticalClaim, GovernanceAuthorizationErrorCode, GovernanceAuthorizationFailure, GovernanceAuthorizationResult, GovernanceAuthorizationSuccess, GovernanceCommitment, GovernanceEnforcementMiddleware, GovernanceEnforcementMiddlewareConfig, GovernanceEnforcementMiddlewareInput, GovernanceEnforcementMode, GovernanceEnforcementTask, GovernanceReplayStore, GovernanceReplayBinding, GovernanceRevocationResolver, GovernanceRevocationStatus, InMemoryGovernanceReplayStoreOptions, VerifyGovernanceAuthorizationOptions, GovernanceBuyerIdentity, } from './authorization.mjs';
|
|
18
18
|
/**
|
|
19
19
|
* `policy_categories` values that MUST set `human_review_required: true`
|
|
20
20
|
* under GDPR Art 22 / EU AI Act Annex III. Matches the schema's `if/then`
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* advisory — the authoritative check happens in the governance agent, which
|
|
14
14
|
* resolves category synonyms and custom policies server-side.
|
|
15
15
|
*/
|
|
16
|
-
export { GOVERNANCE_AUTHORIZATION_CRITICAL_CLAIMS, GovernanceAuthorizationError, GovernanceReplayStoreAdapter, InMemoryGovernanceReplayStore, buildGovernanceCommitment, buildGovernanceExecutionCommitment, buildGovernanceExecutionRequest, buildGovernanceIntentRequest, buildGovernanceProposedCommitment, computeGovernedPayloadHash, createGovernanceEnforcementMiddleware, getGovernanceEnforcementTasks, governancePurchaseTypeForTask, governanceTaskRequiresProposedCommitment, targetDeclaresGovernanceEnforcement, targetDeclaresLegacyGovernanceAwareness, verifyGovernanceAuthorization, } from './authorization';
|
|
17
|
-
export type { BuildGovernanceExecutionRequestInput, BuildGovernanceIntentRequestInput, GovernanceAuthorizationClaims, GovernanceAuthorizationCriticalClaim, GovernanceAuthorizationErrorCode, GovernanceAuthorizationFailure, GovernanceAuthorizationResult, GovernanceAuthorizationSuccess, GovernanceCommitment, GovernanceEnforcementMiddleware, GovernanceEnforcementMiddlewareConfig, GovernanceEnforcementMiddlewareInput, GovernanceEnforcementMode, GovernanceEnforcementTask, GovernanceReplayStore, GovernanceReplayBinding, GovernanceRevocationResolver, GovernanceRevocationStatus, InMemoryGovernanceReplayStoreOptions, VerifyGovernanceAuthorizationOptions, } from './authorization';
|
|
16
|
+
export { GOVERNANCE_AUTHORIZATION_CRITICAL_CLAIMS, GovernanceAuthorizationError, GovernanceReplayStoreAdapter, InMemoryGovernanceReplayStore, buildGovernanceCommitment, buildGovernanceExecutionCommitment, buildGovernanceExecutionRequest, buildGovernanceIntentRequest, buildGovernanceProposedCommitment, computeGovernedPayloadHash, createGovernanceEnforcementMiddleware, getGovernanceEnforcementTasks, governancePurchaseTypeForTask, governanceTaskRequiresProposedCommitment, targetDeclaresGovernanceEnforcement, targetDeclaresLegacyGovernanceAwareness, verifyGovernanceAuthorization, createGovernanceAgentJwksResolver, } from './authorization';
|
|
17
|
+
export type { BuildGovernanceExecutionRequestInput, BuildGovernanceIntentRequestInput, GovernanceAuthorizationClaims, GovernanceAuthorizationCriticalClaim, GovernanceAuthorizationErrorCode, GovernanceAuthorizationFailure, GovernanceAuthorizationResult, GovernanceAuthorizationSuccess, GovernanceCommitment, GovernanceEnforcementMiddleware, GovernanceEnforcementMiddlewareConfig, GovernanceEnforcementMiddlewareInput, GovernanceEnforcementMode, GovernanceEnforcementTask, GovernanceReplayStore, GovernanceReplayBinding, GovernanceRevocationResolver, GovernanceRevocationStatus, InMemoryGovernanceReplayStoreOptions, VerifyGovernanceAuthorizationOptions, GovernanceBuyerIdentity, } from './authorization';
|
|
18
18
|
/**
|
|
19
19
|
* `policy_categories` values that MUST set `human_review_required: true`
|
|
20
20
|
* under GDPR Art 22 / EU AI Act Annex III. Matches the schema's `if/then`
|
|
@@ -32,6 +32,7 @@ __export(governance_exports, {
|
|
|
32
32
|
buildHumanOverride: () => buildHumanOverride,
|
|
33
33
|
buildHumanReviewPlan: () => buildHumanReviewPlan,
|
|
34
34
|
computeGovernedPayloadHash: () => import_authorization.computeGovernedPayloadHash,
|
|
35
|
+
createGovernanceAgentJwksResolver: () => import_authorization.createGovernanceAgentJwksResolver,
|
|
35
36
|
createGovernanceEnforcementMiddleware: () => import_authorization.createGovernanceEnforcementMiddleware,
|
|
36
37
|
getGovernanceEnforcementTasks: () => import_authorization.getGovernanceEnforcementTasks,
|
|
37
38
|
governancePurchaseTypeForTask: () => import_authorization.governancePurchaseTypeForTask,
|
|
@@ -156,6 +157,7 @@ function validateGovernancePlan(plan) {
|
|
|
156
157
|
buildHumanOverride,
|
|
157
158
|
buildHumanReviewPlan,
|
|
158
159
|
computeGovernedPayloadHash,
|
|
160
|
+
createGovernanceAgentJwksResolver,
|
|
159
161
|
createGovernanceEnforcementMiddleware,
|
|
160
162
|
getGovernanceEnforcementTasks,
|
|
161
163
|
governancePurchaseTypeForTask,
|
|
@@ -15,7 +15,8 @@ import {
|
|
|
15
15
|
governanceTaskRequiresProposedCommitment,
|
|
16
16
|
targetDeclaresGovernanceEnforcement,
|
|
17
17
|
targetDeclaresLegacyGovernanceAwareness,
|
|
18
|
-
verifyGovernanceAuthorization
|
|
18
|
+
verifyGovernanceAuthorization,
|
|
19
|
+
createGovernanceAgentJwksResolver
|
|
19
20
|
} from "./authorization.mjs";
|
|
20
21
|
const REGULATED_HUMAN_REVIEW_CATEGORIES = Object.freeze([
|
|
21
22
|
"fair_housing",
|
|
@@ -129,6 +130,7 @@ export {
|
|
|
129
130
|
buildHumanOverride,
|
|
130
131
|
buildHumanReviewPlan,
|
|
131
132
|
computeGovernedPayloadHash,
|
|
133
|
+
createGovernanceAgentJwksResolver,
|
|
132
134
|
createGovernanceEnforcementMiddleware,
|
|
133
135
|
getGovernanceEnforcementTasks,
|
|
134
136
|
governancePurchaseTypeForTask,
|
package/dist/lib/index.d.mts
CHANGED
|
@@ -37,12 +37,12 @@ export type { GovernanceConfig, CampaignGovernanceConfig, GovernanceCheckResult,
|
|
|
37
37
|
export { GovernanceMiddleware } from './core/GovernanceMiddleware.mjs';
|
|
38
38
|
export { isGovernanceApproved, isGovernanceConditions, isGovernanceDenied, normalizeGovernanceVerdict, } from './core/GovernanceTypes.mjs';
|
|
39
39
|
export type { GovernanceDebugEntry } from './core/GovernanceMiddleware.mjs';
|
|
40
|
-
export { GOVERNANCE_AUTHORIZATION_CRITICAL_CLAIMS, GovernanceAuthorizationError, GovernanceReplayStoreAdapter, InMemoryGovernanceReplayStore, buildGovernanceCommitment, buildGovernanceExecutionCommitment, buildGovernanceExecutionRequest, buildGovernanceIntentRequest, buildGovernanceProposedCommitment, buildHumanReviewPlan, buildHumanOverride, computeGovernedPayloadHash, createGovernanceEnforcementMiddleware, getGovernanceEnforcementTasks, governancePurchaseTypeForTask, governanceTaskRequiresProposedCommitment, targetDeclaresGovernanceEnforcement, targetDeclaresLegacyGovernanceAwareness, validateGovernancePlan, verifyGovernanceAuthorization, REGULATED_HUMAN_REVIEW_CATEGORIES, ANNEX_III_POLICY_IDS, } from './governance/index.mjs';
|
|
40
|
+
export { GOVERNANCE_AUTHORIZATION_CRITICAL_CLAIMS, GovernanceAuthorizationError, GovernanceReplayStoreAdapter, InMemoryGovernanceReplayStore, buildGovernanceCommitment, buildGovernanceExecutionCommitment, buildGovernanceExecutionRequest, buildGovernanceIntentRequest, buildGovernanceProposedCommitment, buildHumanReviewPlan, buildHumanOverride, computeGovernedPayloadHash, createGovernanceEnforcementMiddleware, getGovernanceEnforcementTasks, governancePurchaseTypeForTask, governanceTaskRequiresProposedCommitment, targetDeclaresGovernanceEnforcement, targetDeclaresLegacyGovernanceAwareness, validateGovernancePlan, verifyGovernanceAuthorization, createGovernanceAgentJwksResolver, REGULATED_HUMAN_REVIEW_CATEGORIES, ANNEX_III_POLICY_IDS, } from './governance/index.mjs';
|
|
41
41
|
export { ssrfSafeFetch, decodeBodyAsJsonOrText, SSRF_TRANSIENT_CODES, SsrfRefusedError, isPrivateIp, isAlwaysBlocked, isLikelyPrivateUrl, type SsrfRefusedCode, type SsrfDnsLookup, type SsrfFetchOptions, type SsrfFetchResult, } from './net/index.mjs';
|
|
42
42
|
export { createCanonicalReferenceCache, createCanonicalReferenceResolver, canonicalReferenceCacheKey, resolveCanonicalReference, resolveFormatSchemaReference, resolvePlatformExtensionsReference, type CanonicalReference, type CanonicalReferenceCache, type CanonicalReferenceCacheOptions, type CanonicalReferenceError, type CanonicalReferenceErrorCode, type CanonicalReferenceFailureResult, type CanonicalReferenceKind, type CanonicalReferenceResolveOptions, type CanonicalReferenceResolvedResult, type CanonicalReferenceResolver, type CanonicalReferenceResolverOptions, type CanonicalReferenceResult, type CanonicalReferenceStatus, type ExternalRefDigestMap, type FormatSchemaReferenceResolvedResult, type FormatSchemaReferenceResult, type PlatformExtensionsReferenceResult, } from './canonical-references/index.mjs';
|
|
43
43
|
export { assessAcceptancePolicy, createAcceptancePolicyCatalogResolver, resolveAcceptancePolicyCatalog, resolveAcceptancePolicyProfiles, resolveVerifiedAcceptancePolicyProfiles, type AcceptancePolicyCatalog, type AcceptancePolicyCatalogErrorCode, type AcceptancePolicyCatalogFailure, type AcceptancePolicyCatalogIssue, type AcceptancePolicyCatalogResolver, type AcceptancePolicyCatalogResult, type AcceptancePolicyCatalogSuccess, type AcceptancePolicyDiscoveryCapability, type AcceptancePolicyProfile, type AcceptancePolicyProfileResolution, type AcceptancePolicyRegistryPolicy, type AcceptancePolicyRegistryResolver, type AcceptancePolicyReference, type AcceptancePolicyRequirement, type AcceptancePolicyRule, type AcceptancePolicySurface, type RegistryAcceptancePolicyProfileReference, type ResolveAcceptancePolicyCatalogOptions, type ResolveVerifiedAcceptancePolicyProfilesOptions, type ResolvedAcceptancePolicyDefault, type VerifiedAcceptancePolicyProfilesResult, type VerifiedAcceptancePolicyProfilesSuccess, } from './acceptance-policy/index.mjs';
|
|
44
44
|
export { type AcceptancePolicyAssessment, type AcceptancePolicyAssessmentDiagnostic, type AcceptancePolicyAssessmentDiagnosticCode, type AcceptancePolicyMatchedRule, type AcceptancePolicyOutcome, type AssessAcceptancePolicyInput, } from './acceptance-policy/evaluator.mjs';
|
|
45
|
-
export type { BuildGovernanceExecutionRequestInput, BuildGovernanceIntentRequestInput, BuildHumanReviewPlanInput, BuildHumanOverrideInput, DataSubjectContestation, GovernanceAuthorizationClaims, GovernanceAuthorizationCriticalClaim, GovernanceAuthorizationErrorCode, GovernanceAuthorizationFailure, GovernanceAuthorizationResult, GovernanceAuthorizationSuccess, GovernanceCommitment, GovernanceEnforcementMiddleware, GovernanceEnforcementMiddlewareConfig, GovernanceEnforcementMiddlewareInput, GovernanceEnforcementMode, GovernanceEnforcementTask, GovernancePlan, GovernanceReplayStore, GovernanceReplayBinding, GovernanceRevocationResolver, GovernanceRevocationStatus, GovernanceValidationIssue, HumanOverride, InMemoryGovernanceReplayStoreOptions, PlanBudget, ReallocationAutonomy, VerifyGovernanceAuthorizationOptions, } from './governance/index.mjs';
|
|
45
|
+
export type { BuildGovernanceExecutionRequestInput, BuildGovernanceIntentRequestInput, BuildHumanReviewPlanInput, BuildHumanOverrideInput, DataSubjectContestation, GovernanceAuthorizationClaims, GovernanceAuthorizationCriticalClaim, GovernanceAuthorizationErrorCode, GovernanceAuthorizationFailure, GovernanceAuthorizationResult, GovernanceAuthorizationSuccess, GovernanceCommitment, GovernanceEnforcementMiddleware, GovernanceEnforcementMiddlewareConfig, GovernanceEnforcementMiddlewareInput, GovernanceEnforcementMode, GovernanceEnforcementTask, GovernancePlan, GovernanceReplayStore, GovernanceReplayBinding, GovernanceRevocationResolver, GovernanceRevocationStatus, GovernanceValidationIssue, HumanOverride, InMemoryGovernanceReplayStoreOptions, PlanBudget, ReallocationAutonomy, VerifyGovernanceAuthorizationOptions, GovernanceBuyerIdentity, } from './governance/index.mjs';
|
|
46
46
|
export type { BaseTaskEvent, ProtocolRequestEvent, ProtocolResponseEvent, TaskStatusEvent, ObjectEvent, TaskEvent, TaskEventCallbacks, } from './core/TaskEventTypes.mjs';
|
|
47
47
|
export { createOperationId } from './core/TaskEventTypes.mjs';
|
|
48
48
|
export type { AsyncHandlerConfig, WebhookMetadata, Activity, NotificationMetadata, MediaBuyDeliveryNotification, CreateMediaBuyStatusChangeHandler, UpdateMediaBuyStatusChangeHandler, SyncCreativesStatusChangeHandler, GetProductsStatusChangeHandler, ListProductsStatusChangeHandler, } from './core/AsyncHandler.mjs';
|
|
@@ -53,7 +53,7 @@ export * from './handlers/types.mjs';
|
|
|
53
53
|
export type { Storage, AtomicTakeStorage, DeferredTaskStorage, BatchStorage, PatternStorage, AgentCapabilities, ConversationState, DeferredTaskState, StorageConfig, StorageFactory, StorageMiddleware, } from './storage/interfaces.mjs';
|
|
54
54
|
export { MemoryStorage, createMemoryStorage, createMemoryStorageConfig } from './storage/MemoryStorage.mjs';
|
|
55
55
|
export { ADCPError, TaskTimeoutError, MaxClarificationError, DeferredTaskError, TaskAbortedError, AgentNotFoundError, UnsupportedTaskError, ProtocolError, ValidationError as ADCPValidationError, // Rename to avoid conflict
|
|
56
|
-
MissingInputHandlerError, InvalidContextError, ConfigurationError, AuthenticationCredentialsRejectedError, AuthenticationRequiredError, FeatureUnsupportedError, ProtocolFeatureUnsupportedError, UnsupportedBuyingModeError, AccountRequiredError, AccountPendingApprovalError, AccountAmbiguousError, SDK_ERROR_TO_PROTOCOL_ERROR_CODE, VersionUnsupportedError, IdempotencyConflictError, IdempotencyExpiredError, ResponseTooLargeError, ActionNotAllowedError, adcpErrorToTypedError, getClientPreflightAdcpError, isADCPError, isErrorOfType, extractErrorInfo, is401Error, mapSdkErrorCodeToProtocolErrorCode, } from './errors/index.mjs';
|
|
56
|
+
MissingInputHandlerError, InvalidContextError, ConfigurationError, AuthenticationCredentialsRejectedError, AuthenticationRequiredError, FeatureUnsupportedError, ProtocolFeatureUnsupportedError, UnsupportedBuyingModeError, AccountRequiredError, AccountPendingApprovalError, AccountAmbiguousError, BuyerSetupError, AccountNotFoundError, AccountSetupRequiredError, AccountPaymentRequiredError, AccountNotProvisionedError, SDK_ERROR_TO_PROTOCOL_ERROR_CODE, VersionUnsupportedError, IdempotencyConflictError, IdempotencyExpiredError, ResponseTooLargeError, ActionNotAllowedError, adcpErrorToTypedError, getClientPreflightAdcpError, isADCPError, isErrorOfType, extractErrorInfo, is401Error, mapSdkErrorCodeToProtocolErrorCode, } from './errors/index.mjs';
|
|
57
57
|
export type { OAuthMetadataInfo, ClientPreflightAdcpErrorInfo, ClientPreflightAdcpErrorRecovery, FeatureUnsupportedErrorOptions, ProtocolFeatureUnsupportedErrorOptions, ActionNotAllowedErrorDetails, ActionNotAllowedReasonValue, ActionNotAllowedAttemptedAction, ActionNotAllowedAvailableAction, ActionNotAllowedRecovery, } from './errors/index.mjs';
|
|
58
58
|
export type { ActionNotAllowedDetails, ActionNotAllowedReason, AvailableActionsResult, AvailableActionsSource, DecomposedUpdateMediaBuy, DecomposedUpdateMediaBuyMutation, LegacyCoarseAction, MediaBuyActionContext, MediaBuyActionId, MediaBuyActionMode, MediaBuyAvailableAction, MediaBuyMutationDirection, MediaBuyMutationScope, MediaBuyUpdateFieldAction, MediaBuyValidAction, ModeMismatchRecovery, PreflightAllowed, PreflightDenial, PreflightDenied, BuyerPropertyPolicy, NormalizedPolicyDomain, ProductPolicyProductLike, ProductPropertyPolicyDiagnostic, ProductPropertyPolicyDiagnosticCode, ProductPropertyPolicyDiagnosticSeverity, ProductPropertyPolicyMode, ProductPropertyPolicySelectorBehavior, ProductPropertyPolicyValidationResult, PreflightResult, ResolvedAction, SLAWindow, SlaWindow, StructuredOnlyMediaBuyAction, ResolvedTargetingInput, TargetingInputFor, ValidateProductsAgainstPropertyPolicyOptions, UpdateFieldEntry, UpdateMediaBuyRequestLike, } from './media-buy/index.mjs';
|
|
59
59
|
export { ACTIONS_BY_FIELD, LEGACY_COARSE_ACTIONS, STRUCTURED_ONLY_MEDIA_BUY_ACTIONS, UPDATE_FIELDS_BY_ACTION, applyTargetingInput, hasTargetingClears, resolveTargetingInput, canAddPackages, canCancel, canDecreaseBudget, canExtendFlight, canIncreaseBudget, canPause, canReallocateBudget, canRemoveCreative, canRemovePackages, canReplaceCreative, canResume, canShortenFlight, canUpdateCreativeAssignments, canUpdateFlightDates, canUpdateFrequencyCaps, canUpdatePacing, canUpdateTargeting, decomposeUpdateMediaBuy, findAvailableAction, getActionForMutation, getAvailableActions, getRollupParent, ProductPropertyPolicyError, normalizeDomainForPropertyPolicy, preflightUpdateMediaBuy, recoveryForModeMismatch, validateProductsAgainstPropertyPolicy, } from './media-buy/index.mjs';
|
|
@@ -272,3 +272,5 @@ export { mediaBuyActionResolver } from './server/media-buy-action-resolver.mjs';
|
|
|
272
272
|
export type { SellerActionDecision, SellerActionResolutionOptions, SellerActionResolution, } from './server/media-buy-action-resolver.mjs';
|
|
273
273
|
export * from './supply-path/index.mjs';
|
|
274
274
|
export type { AuthorizationCollectionSelector, ProductCollectionSelector, CollectionDistribution, DiscoveryCollection, } from './discovery/types.mjs';
|
|
275
|
+
export { BuyerAccountRegistry, type AccountPolicy, type BuyerAccountStorage, type BuyerAccountRegistryOptions, type EnsureAccountOptions, type ProvisionedAccount, } from './core/buyer-account-registry.mjs';
|
|
276
|
+
export { createProductCache, ProductCache, type ProductCacheOptions } from './core/product-cache.mjs';
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -37,12 +37,12 @@ export type { GovernanceConfig, CampaignGovernanceConfig, GovernanceCheckResult,
|
|
|
37
37
|
export { GovernanceMiddleware } from './core/GovernanceMiddleware';
|
|
38
38
|
export { isGovernanceApproved, isGovernanceConditions, isGovernanceDenied, normalizeGovernanceVerdict, } from './core/GovernanceTypes';
|
|
39
39
|
export type { GovernanceDebugEntry } from './core/GovernanceMiddleware';
|
|
40
|
-
export { GOVERNANCE_AUTHORIZATION_CRITICAL_CLAIMS, GovernanceAuthorizationError, GovernanceReplayStoreAdapter, InMemoryGovernanceReplayStore, buildGovernanceCommitment, buildGovernanceExecutionCommitment, buildGovernanceExecutionRequest, buildGovernanceIntentRequest, buildGovernanceProposedCommitment, buildHumanReviewPlan, buildHumanOverride, computeGovernedPayloadHash, createGovernanceEnforcementMiddleware, getGovernanceEnforcementTasks, governancePurchaseTypeForTask, governanceTaskRequiresProposedCommitment, targetDeclaresGovernanceEnforcement, targetDeclaresLegacyGovernanceAwareness, validateGovernancePlan, verifyGovernanceAuthorization, REGULATED_HUMAN_REVIEW_CATEGORIES, ANNEX_III_POLICY_IDS, } from './governance';
|
|
40
|
+
export { GOVERNANCE_AUTHORIZATION_CRITICAL_CLAIMS, GovernanceAuthorizationError, GovernanceReplayStoreAdapter, InMemoryGovernanceReplayStore, buildGovernanceCommitment, buildGovernanceExecutionCommitment, buildGovernanceExecutionRequest, buildGovernanceIntentRequest, buildGovernanceProposedCommitment, buildHumanReviewPlan, buildHumanOverride, computeGovernedPayloadHash, createGovernanceEnforcementMiddleware, getGovernanceEnforcementTasks, governancePurchaseTypeForTask, governanceTaskRequiresProposedCommitment, targetDeclaresGovernanceEnforcement, targetDeclaresLegacyGovernanceAwareness, validateGovernancePlan, verifyGovernanceAuthorization, createGovernanceAgentJwksResolver, REGULATED_HUMAN_REVIEW_CATEGORIES, ANNEX_III_POLICY_IDS, } from './governance';
|
|
41
41
|
export { ssrfSafeFetch, decodeBodyAsJsonOrText, SSRF_TRANSIENT_CODES, SsrfRefusedError, isPrivateIp, isAlwaysBlocked, isLikelyPrivateUrl, type SsrfRefusedCode, type SsrfDnsLookup, type SsrfFetchOptions, type SsrfFetchResult, } from './net';
|
|
42
42
|
export { createCanonicalReferenceCache, createCanonicalReferenceResolver, canonicalReferenceCacheKey, resolveCanonicalReference, resolveFormatSchemaReference, resolvePlatformExtensionsReference, type CanonicalReference, type CanonicalReferenceCache, type CanonicalReferenceCacheOptions, type CanonicalReferenceError, type CanonicalReferenceErrorCode, type CanonicalReferenceFailureResult, type CanonicalReferenceKind, type CanonicalReferenceResolveOptions, type CanonicalReferenceResolvedResult, type CanonicalReferenceResolver, type CanonicalReferenceResolverOptions, type CanonicalReferenceResult, type CanonicalReferenceStatus, type ExternalRefDigestMap, type FormatSchemaReferenceResolvedResult, type FormatSchemaReferenceResult, type PlatformExtensionsReferenceResult, } from './canonical-references';
|
|
43
43
|
export { assessAcceptancePolicy, createAcceptancePolicyCatalogResolver, resolveAcceptancePolicyCatalog, resolveAcceptancePolicyProfiles, resolveVerifiedAcceptancePolicyProfiles, type AcceptancePolicyCatalog, type AcceptancePolicyCatalogErrorCode, type AcceptancePolicyCatalogFailure, type AcceptancePolicyCatalogIssue, type AcceptancePolicyCatalogResolver, type AcceptancePolicyCatalogResult, type AcceptancePolicyCatalogSuccess, type AcceptancePolicyDiscoveryCapability, type AcceptancePolicyProfile, type AcceptancePolicyProfileResolution, type AcceptancePolicyRegistryPolicy, type AcceptancePolicyRegistryResolver, type AcceptancePolicyReference, type AcceptancePolicyRequirement, type AcceptancePolicyRule, type AcceptancePolicySurface, type RegistryAcceptancePolicyProfileReference, type ResolveAcceptancePolicyCatalogOptions, type ResolveVerifiedAcceptancePolicyProfilesOptions, type ResolvedAcceptancePolicyDefault, type VerifiedAcceptancePolicyProfilesResult, type VerifiedAcceptancePolicyProfilesSuccess, } from './acceptance-policy';
|
|
44
44
|
export { type AcceptancePolicyAssessment, type AcceptancePolicyAssessmentDiagnostic, type AcceptancePolicyAssessmentDiagnosticCode, type AcceptancePolicyMatchedRule, type AcceptancePolicyOutcome, type AssessAcceptancePolicyInput, } from './acceptance-policy/evaluator';
|
|
45
|
-
export type { BuildGovernanceExecutionRequestInput, BuildGovernanceIntentRequestInput, BuildHumanReviewPlanInput, BuildHumanOverrideInput, DataSubjectContestation, GovernanceAuthorizationClaims, GovernanceAuthorizationCriticalClaim, GovernanceAuthorizationErrorCode, GovernanceAuthorizationFailure, GovernanceAuthorizationResult, GovernanceAuthorizationSuccess, GovernanceCommitment, GovernanceEnforcementMiddleware, GovernanceEnforcementMiddlewareConfig, GovernanceEnforcementMiddlewareInput, GovernanceEnforcementMode, GovernanceEnforcementTask, GovernancePlan, GovernanceReplayStore, GovernanceReplayBinding, GovernanceRevocationResolver, GovernanceRevocationStatus, GovernanceValidationIssue, HumanOverride, InMemoryGovernanceReplayStoreOptions, PlanBudget, ReallocationAutonomy, VerifyGovernanceAuthorizationOptions, } from './governance';
|
|
45
|
+
export type { BuildGovernanceExecutionRequestInput, BuildGovernanceIntentRequestInput, BuildHumanReviewPlanInput, BuildHumanOverrideInput, DataSubjectContestation, GovernanceAuthorizationClaims, GovernanceAuthorizationCriticalClaim, GovernanceAuthorizationErrorCode, GovernanceAuthorizationFailure, GovernanceAuthorizationResult, GovernanceAuthorizationSuccess, GovernanceCommitment, GovernanceEnforcementMiddleware, GovernanceEnforcementMiddlewareConfig, GovernanceEnforcementMiddlewareInput, GovernanceEnforcementMode, GovernanceEnforcementTask, GovernancePlan, GovernanceReplayStore, GovernanceReplayBinding, GovernanceRevocationResolver, GovernanceRevocationStatus, GovernanceValidationIssue, HumanOverride, InMemoryGovernanceReplayStoreOptions, PlanBudget, ReallocationAutonomy, VerifyGovernanceAuthorizationOptions, GovernanceBuyerIdentity, } from './governance';
|
|
46
46
|
export type { BaseTaskEvent, ProtocolRequestEvent, ProtocolResponseEvent, TaskStatusEvent, ObjectEvent, TaskEvent, TaskEventCallbacks, } from './core/TaskEventTypes';
|
|
47
47
|
export { createOperationId } from './core/TaskEventTypes';
|
|
48
48
|
export type { AsyncHandlerConfig, WebhookMetadata, Activity, NotificationMetadata, MediaBuyDeliveryNotification, CreateMediaBuyStatusChangeHandler, UpdateMediaBuyStatusChangeHandler, SyncCreativesStatusChangeHandler, GetProductsStatusChangeHandler, ListProductsStatusChangeHandler, } from './core/AsyncHandler';
|
|
@@ -53,7 +53,7 @@ export * from './handlers/types';
|
|
|
53
53
|
export type { Storage, AtomicTakeStorage, DeferredTaskStorage, BatchStorage, PatternStorage, AgentCapabilities, ConversationState, DeferredTaskState, StorageConfig, StorageFactory, StorageMiddleware, } from './storage/interfaces';
|
|
54
54
|
export { MemoryStorage, createMemoryStorage, createMemoryStorageConfig } from './storage/MemoryStorage';
|
|
55
55
|
export { ADCPError, TaskTimeoutError, MaxClarificationError, DeferredTaskError, TaskAbortedError, AgentNotFoundError, UnsupportedTaskError, ProtocolError, ValidationError as ADCPValidationError, // Rename to avoid conflict
|
|
56
|
-
MissingInputHandlerError, InvalidContextError, ConfigurationError, AuthenticationCredentialsRejectedError, AuthenticationRequiredError, FeatureUnsupportedError, ProtocolFeatureUnsupportedError, UnsupportedBuyingModeError, AccountRequiredError, AccountPendingApprovalError, AccountAmbiguousError, SDK_ERROR_TO_PROTOCOL_ERROR_CODE, VersionUnsupportedError, IdempotencyConflictError, IdempotencyExpiredError, ResponseTooLargeError, ActionNotAllowedError, adcpErrorToTypedError, getClientPreflightAdcpError, isADCPError, isErrorOfType, extractErrorInfo, is401Error, mapSdkErrorCodeToProtocolErrorCode, } from './errors';
|
|
56
|
+
MissingInputHandlerError, InvalidContextError, ConfigurationError, AuthenticationCredentialsRejectedError, AuthenticationRequiredError, FeatureUnsupportedError, ProtocolFeatureUnsupportedError, UnsupportedBuyingModeError, AccountRequiredError, AccountPendingApprovalError, AccountAmbiguousError, BuyerSetupError, AccountNotFoundError, AccountSetupRequiredError, AccountPaymentRequiredError, AccountNotProvisionedError, SDK_ERROR_TO_PROTOCOL_ERROR_CODE, VersionUnsupportedError, IdempotencyConflictError, IdempotencyExpiredError, ResponseTooLargeError, ActionNotAllowedError, adcpErrorToTypedError, getClientPreflightAdcpError, isADCPError, isErrorOfType, extractErrorInfo, is401Error, mapSdkErrorCodeToProtocolErrorCode, } from './errors';
|
|
57
57
|
export type { OAuthMetadataInfo, ClientPreflightAdcpErrorInfo, ClientPreflightAdcpErrorRecovery, FeatureUnsupportedErrorOptions, ProtocolFeatureUnsupportedErrorOptions, ActionNotAllowedErrorDetails, ActionNotAllowedReasonValue, ActionNotAllowedAttemptedAction, ActionNotAllowedAvailableAction, ActionNotAllowedRecovery, } from './errors';
|
|
58
58
|
export type { ActionNotAllowedDetails, ActionNotAllowedReason, AvailableActionsResult, AvailableActionsSource, DecomposedUpdateMediaBuy, DecomposedUpdateMediaBuyMutation, LegacyCoarseAction, MediaBuyActionContext, MediaBuyActionId, MediaBuyActionMode, MediaBuyAvailableAction, MediaBuyMutationDirection, MediaBuyMutationScope, MediaBuyUpdateFieldAction, MediaBuyValidAction, ModeMismatchRecovery, PreflightAllowed, PreflightDenial, PreflightDenied, BuyerPropertyPolicy, NormalizedPolicyDomain, ProductPolicyProductLike, ProductPropertyPolicyDiagnostic, ProductPropertyPolicyDiagnosticCode, ProductPropertyPolicyDiagnosticSeverity, ProductPropertyPolicyMode, ProductPropertyPolicySelectorBehavior, ProductPropertyPolicyValidationResult, PreflightResult, ResolvedAction, SLAWindow, SlaWindow, StructuredOnlyMediaBuyAction, ResolvedTargetingInput, TargetingInputFor, ValidateProductsAgainstPropertyPolicyOptions, UpdateFieldEntry, UpdateMediaBuyRequestLike, } from './media-buy';
|
|
59
59
|
export { ACTIONS_BY_FIELD, LEGACY_COARSE_ACTIONS, STRUCTURED_ONLY_MEDIA_BUY_ACTIONS, UPDATE_FIELDS_BY_ACTION, applyTargetingInput, hasTargetingClears, resolveTargetingInput, canAddPackages, canCancel, canDecreaseBudget, canExtendFlight, canIncreaseBudget, canPause, canReallocateBudget, canRemoveCreative, canRemovePackages, canReplaceCreative, canResume, canShortenFlight, canUpdateCreativeAssignments, canUpdateFlightDates, canUpdateFrequencyCaps, canUpdatePacing, canUpdateTargeting, decomposeUpdateMediaBuy, findAvailableAction, getActionForMutation, getAvailableActions, getRollupParent, ProductPropertyPolicyError, normalizeDomainForPropertyPolicy, preflightUpdateMediaBuy, recoveryForModeMismatch, validateProductsAgainstPropertyPolicy, } from './media-buy';
|
|
@@ -272,3 +272,5 @@ export { mediaBuyActionResolver } from './server/media-buy-action-resolver';
|
|
|
272
272
|
export type { SellerActionDecision, SellerActionResolutionOptions, SellerActionResolution, } from './server/media-buy-action-resolver';
|
|
273
273
|
export * from './supply-path';
|
|
274
274
|
export type { AuthorizationCollectionSelector, ProductCollectionSelector, CollectionDistribution, DiscoveryCollection, } from './discovery/types';
|
|
275
|
+
export { BuyerAccountRegistry, type AccountPolicy, type BuyerAccountStorage, type BuyerAccountRegistryOptions, type EnsureAccountOptions, type ProvisionedAccount, } from './core/buyer-account-registry';
|
|
276
|
+
export { createProductCache, ProductCache, type ProductCacheOptions } from './core/product-cache';
|
package/dist/lib/index.js
CHANGED
|
@@ -37,8 +37,12 @@ __export(index_exports, {
|
|
|
37
37
|
ANNEX_III_POLICY_IDS: () => import_governance.ANNEX_III_POLICY_IDS,
|
|
38
38
|
AUTH_DIAGNOSIS_SCHEMA_VERSION: () => import_oauth2.AUTH_DIAGNOSIS_SCHEMA_VERSION,
|
|
39
39
|
AccountAmbiguousError: () => import_errors.AccountAmbiguousError,
|
|
40
|
+
AccountNotFoundError: () => import_errors.AccountNotFoundError,
|
|
41
|
+
AccountNotProvisionedError: () => import_errors.AccountNotProvisionedError,
|
|
42
|
+
AccountPaymentRequiredError: () => import_errors.AccountPaymentRequiredError,
|
|
40
43
|
AccountPendingApprovalError: () => import_errors.AccountPendingApprovalError,
|
|
41
44
|
AccountRequiredError: () => import_errors.AccountRequiredError,
|
|
45
|
+
AccountSetupRequiredError: () => import_errors.AccountSetupRequiredError,
|
|
42
46
|
ActionNotAllowedError: () => import_errors.ActionNotAllowedError,
|
|
43
47
|
AdCPClient: () => AdCPClient,
|
|
44
48
|
AdagentsJsonSchema: () => import_wellknown_schemas.AdagentsJsonSchema,
|
|
@@ -52,7 +56,9 @@ __export(index_exports, {
|
|
|
52
56
|
BRAND_RIGHTS_TOOLS: () => import_capabilities.BRAND_RIGHTS_TOOLS,
|
|
53
57
|
BrandDomainValidationError: () => import_brand.BrandDomainValidationError,
|
|
54
58
|
BrandJsonSchema: () => import_wellknown_schemas.BrandJsonSchema,
|
|
59
|
+
BuyerAccountRegistry: () => import_buyer_account_registry.BuyerAccountRegistry,
|
|
55
60
|
BuyerRetryPolicy: () => import_buyer_retry_policy.BuyerRetryPolicy,
|
|
61
|
+
BuyerSetupError: () => import_errors.BuyerSetupError,
|
|
56
62
|
CATALOG_MACRO_VECTORS: () => import_substitution.CATALOG_MACRO_VECTORS,
|
|
57
63
|
COMMON_LOGO_SLOTS: () => import_brand.COMMON_LOGO_SLOTS,
|
|
58
64
|
COMPATIBLE_ADCP_VERSIONS: () => import_version.COMPATIBLE_ADCP_VERSIONS,
|
|
@@ -144,6 +150,7 @@ __export(index_exports, {
|
|
|
144
150
|
PostgresStateStore: () => import_server.PostgresStateStore,
|
|
145
151
|
PostgresTaskStore: () => import_server.PostgresTaskStore,
|
|
146
152
|
PreviewFetchError: () => import_substitution.PreviewFetchError,
|
|
153
|
+
ProductCache: () => import_product_cache.ProductCache,
|
|
147
154
|
ProductPropertyPolicyError: () => import_media_buy.ProductPropertyPolicyError,
|
|
148
155
|
PropertyCrawler: () => import_property_crawler.PropertyCrawler,
|
|
149
156
|
PropertyIndex: () => import_property_index.PropertyIndex,
|
|
@@ -305,6 +312,7 @@ __export(index_exports, {
|
|
|
305
312
|
createCreativeAgentClient: () => import_CreativeAgentClient.createCreativeAgentClient,
|
|
306
313
|
createDerivedAccountStore: () => import_adapters.createDerivedAccountStore,
|
|
307
314
|
createFileOAuthStorage: () => import_oauth3.createFileOAuthStorage,
|
|
315
|
+
createGovernanceAgentJwksResolver: () => import_governance.createGovernanceAgentJwksResolver,
|
|
308
316
|
createGovernanceEnforcementMiddleware: () => import_governance.createGovernanceEnforcementMiddleware,
|
|
309
317
|
createIdempotencyStore: () => import_server.createIdempotencyStore,
|
|
310
318
|
createInMemoryEstablishedProposalStore: () => import_established_proposal_store.createInMemoryEstablishedProposalStore,
|
|
@@ -316,6 +324,7 @@ __export(index_exports, {
|
|
|
316
324
|
createMemoryStorageConfig: () => import_MemoryStorage.createMemoryStorageConfig,
|
|
317
325
|
createOAuthPassthroughResolver: () => import_adapters.createOAuthPassthroughResolver,
|
|
318
326
|
createOperationId: () => import_TaskEventTypes.createOperationId,
|
|
327
|
+
createProductCache: () => import_product_cache.createProductCache,
|
|
319
328
|
createRosterAccountStore: () => import_adapters.createRosterAccountStore,
|
|
320
329
|
createSeedFixtureCache: () => import_server.createSeedFixtureCache,
|
|
321
330
|
createSessionedStore: () => import_server.createSessionedStore,
|
|
@@ -829,6 +838,8 @@ __reExport(index_exports, require('./notifications/account-change-recorded.js'),
|
|
|
829
838
|
__reExport(index_exports, require('./media-buy/actions.js'), module.exports);
|
|
830
839
|
var import_media_buy_action_resolver = require('./server/media-buy-action-resolver.js');
|
|
831
840
|
__reExport(index_exports, require('./supply-path/index.js'), module.exports);
|
|
841
|
+
var import_buyer_account_registry = require('./core/buyer-account-registry.js');
|
|
842
|
+
var import_product_cache = require('./core/product-cache.js');
|
|
832
843
|
const wireVersion = {
|
|
833
844
|
isSupported: import_protocols2.bundleSupportsAdcpVersionField,
|
|
834
845
|
normalize: import_schema_loader2.toReleasePrecisionWire,
|
|
@@ -861,8 +872,12 @@ function createAdCPClientFromEnv() {
|
|
|
861
872
|
ANNEX_III_POLICY_IDS,
|
|
862
873
|
AUTH_DIAGNOSIS_SCHEMA_VERSION,
|
|
863
874
|
AccountAmbiguousError,
|
|
875
|
+
AccountNotFoundError,
|
|
876
|
+
AccountNotProvisionedError,
|
|
877
|
+
AccountPaymentRequiredError,
|
|
864
878
|
AccountPendingApprovalError,
|
|
865
879
|
AccountRequiredError,
|
|
880
|
+
AccountSetupRequiredError,
|
|
866
881
|
ActionNotAllowedError,
|
|
867
882
|
AdCPClient,
|
|
868
883
|
AdagentsJsonSchema,
|
|
@@ -876,7 +891,9 @@ function createAdCPClientFromEnv() {
|
|
|
876
891
|
BRAND_RIGHTS_TOOLS,
|
|
877
892
|
BrandDomainValidationError,
|
|
878
893
|
BrandJsonSchema,
|
|
894
|
+
BuyerAccountRegistry,
|
|
879
895
|
BuyerRetryPolicy,
|
|
896
|
+
BuyerSetupError,
|
|
880
897
|
CATALOG_MACRO_VECTORS,
|
|
881
898
|
COMMON_LOGO_SLOTS,
|
|
882
899
|
COMPATIBLE_ADCP_VERSIONS,
|
|
@@ -968,6 +985,7 @@ function createAdCPClientFromEnv() {
|
|
|
968
985
|
PostgresStateStore,
|
|
969
986
|
PostgresTaskStore,
|
|
970
987
|
PreviewFetchError,
|
|
988
|
+
ProductCache,
|
|
971
989
|
ProductPropertyPolicyError,
|
|
972
990
|
PropertyCrawler,
|
|
973
991
|
PropertyIndex,
|
|
@@ -1129,6 +1147,7 @@ function createAdCPClientFromEnv() {
|
|
|
1129
1147
|
createCreativeAgentClient,
|
|
1130
1148
|
createDerivedAccountStore,
|
|
1131
1149
|
createFileOAuthStorage,
|
|
1150
|
+
createGovernanceAgentJwksResolver,
|
|
1132
1151
|
createGovernanceEnforcementMiddleware,
|
|
1133
1152
|
createIdempotencyStore,
|
|
1134
1153
|
createInMemoryEstablishedProposalStore,
|
|
@@ -1140,6 +1159,7 @@ function createAdCPClientFromEnv() {
|
|
|
1140
1159
|
createMemoryStorageConfig,
|
|
1141
1160
|
createOAuthPassthroughResolver,
|
|
1142
1161
|
createOperationId,
|
|
1162
|
+
createProductCache,
|
|
1143
1163
|
createRosterAccountStore,
|
|
1144
1164
|
createSeedFixtureCache,
|
|
1145
1165
|
createSessionedStore,
|
package/dist/lib/index.mjs
CHANGED
|
@@ -158,6 +158,7 @@ import {
|
|
|
158
158
|
targetDeclaresLegacyGovernanceAwareness,
|
|
159
159
|
validateGovernancePlan,
|
|
160
160
|
verifyGovernanceAuthorization,
|
|
161
|
+
createGovernanceAgentJwksResolver,
|
|
161
162
|
REGULATED_HUMAN_REVIEW_CATEGORIES,
|
|
162
163
|
ANNEX_III_POLICY_IDS
|
|
163
164
|
} from "./governance/index.mjs";
|
|
@@ -220,6 +221,11 @@ import {
|
|
|
220
221
|
AccountRequiredError,
|
|
221
222
|
AccountPendingApprovalError,
|
|
222
223
|
AccountAmbiguousError,
|
|
224
|
+
BuyerSetupError,
|
|
225
|
+
AccountNotFoundError,
|
|
226
|
+
AccountSetupRequiredError,
|
|
227
|
+
AccountPaymentRequiredError,
|
|
228
|
+
AccountNotProvisionedError,
|
|
223
229
|
SDK_ERROR_TO_PROTOCOL_ERROR_CODE,
|
|
224
230
|
VersionUnsupportedError,
|
|
225
231
|
IdempotencyConflictError,
|
|
@@ -800,6 +806,10 @@ export * from "./notifications/account-change-recorded.mjs";
|
|
|
800
806
|
export * from "./media-buy/actions.mjs";
|
|
801
807
|
import { mediaBuyActionResolver } from "./server/media-buy-action-resolver.mjs";
|
|
802
808
|
export * from "./supply-path/index.mjs";
|
|
809
|
+
import {
|
|
810
|
+
BuyerAccountRegistry
|
|
811
|
+
} from "./core/buyer-account-registry.mjs";
|
|
812
|
+
import { createProductCache, ProductCache } from "./core/product-cache.mjs";
|
|
803
813
|
export {
|
|
804
814
|
A2AInvocationError,
|
|
805
815
|
A2A_CARD_PATHS,
|
|
@@ -819,8 +829,12 @@ export {
|
|
|
819
829
|
ANNEX_III_POLICY_IDS,
|
|
820
830
|
AUTH_DIAGNOSIS_SCHEMA_VERSION,
|
|
821
831
|
AccountAmbiguousError,
|
|
832
|
+
AccountNotFoundError,
|
|
833
|
+
AccountNotProvisionedError,
|
|
834
|
+
AccountPaymentRequiredError,
|
|
822
835
|
AccountPendingApprovalError,
|
|
823
836
|
AccountRequiredError,
|
|
837
|
+
AccountSetupRequiredError,
|
|
824
838
|
ActionNotAllowedError,
|
|
825
839
|
AdCPClient,
|
|
826
840
|
AdagentsJsonSchema,
|
|
@@ -834,7 +848,9 @@ export {
|
|
|
834
848
|
BRAND_RIGHTS_TOOLS,
|
|
835
849
|
BrandDomainValidationError,
|
|
836
850
|
BrandJsonSchema,
|
|
851
|
+
BuyerAccountRegistry,
|
|
837
852
|
BuyerRetryPolicy,
|
|
853
|
+
BuyerSetupError,
|
|
838
854
|
CATALOG_MACRO_VECTORS,
|
|
839
855
|
COMMON_LOGO_SLOTS,
|
|
840
856
|
COMPATIBLE_ADCP_VERSIONS,
|
|
@@ -926,6 +942,7 @@ export {
|
|
|
926
942
|
PostgresStateStore,
|
|
927
943
|
PostgresTaskStore,
|
|
928
944
|
PreviewFetchError,
|
|
945
|
+
ProductCache,
|
|
929
946
|
ProductPropertyPolicyError,
|
|
930
947
|
PropertyCrawler,
|
|
931
948
|
PropertyIndex,
|
|
@@ -1087,6 +1104,7 @@ export {
|
|
|
1087
1104
|
createCreativeAgentClient,
|
|
1088
1105
|
createDerivedAccountStore,
|
|
1089
1106
|
createFileOAuthStorage,
|
|
1107
|
+
createGovernanceAgentJwksResolver,
|
|
1090
1108
|
createGovernanceEnforcementMiddleware,
|
|
1091
1109
|
createIdempotencyStore,
|
|
1092
1110
|
createInMemoryEstablishedProposalStore,
|
|
@@ -1098,6 +1116,7 @@ export {
|
|
|
1098
1116
|
createMemoryStorageConfig,
|
|
1099
1117
|
createOAuthPassthroughResolver,
|
|
1100
1118
|
createOperationId,
|
|
1119
|
+
createProductCache,
|
|
1101
1120
|
createRosterAccountStore,
|
|
1102
1121
|
createSeedFixtureCache,
|
|
1103
1122
|
createSessionedStore,
|
|
@@ -39,6 +39,7 @@ var import_fetch = require('../signing/fetch.js');
|
|
|
39
39
|
var import_fetch_async = require('../signing/fetch-async.js');
|
|
40
40
|
var import_redact_args = require('../utils/redact-args.js');
|
|
41
41
|
var import_rawResponseCapture = require('./rawResponseCapture.js');
|
|
42
|
+
var import_signedRequestRejection = require('./signedRequestRejection.js');
|
|
42
43
|
var import_responseSizeLimit = require('./responseSizeLimit.js');
|
|
43
44
|
var import_transportDiagnostics = require('./transportDiagnostics.js');
|
|
44
45
|
var import_abort = require('./abort.js');
|
|
@@ -322,6 +323,7 @@ function buildFetchImpl(authToken, agentUrl) {
|
|
|
322
323
|
const networkFetch = (0, import_transportDiagnostics.wrapFetchWithTransportDiagnostics)(
|
|
323
324
|
(0, import_responseSizeLimit.wrapFetchWithSizeLimit)((input, init) => pinnedFetch(input, init))
|
|
324
325
|
);
|
|
326
|
+
const rejectionFetch = signingContext ? (0, import_signedRequestRejection.wrapFetchWithSignedRequestRejection)(networkFetch, agentUrl) : networkFetch;
|
|
325
327
|
const baseFetch = async (url, options) => {
|
|
326
328
|
const context = callContextStorage.getStore();
|
|
327
329
|
const urlString = typeof url === "string" ? url : url instanceof URL ? url.toString() : url.url;
|
|
@@ -370,7 +372,11 @@ function buildFetchImpl(authToken, agentUrl) {
|
|
|
370
372
|
const response = await (0, import_abort.withAbortSignal)(
|
|
371
373
|
[context?.signal, options?.signal],
|
|
372
374
|
requestTimeoutMs,
|
|
373
|
-
(signal) =>
|
|
375
|
+
(signal) => rejectionFetch(url, {
|
|
376
|
+
...options,
|
|
377
|
+
headers,
|
|
378
|
+
signal
|
|
379
|
+
})
|
|
374
380
|
);
|
|
375
381
|
if (response.status === 401 && context) {
|
|
376
382
|
context.got401Ref.value = true;
|
|
@@ -548,6 +554,8 @@ async function callA2AToolImpl(agentUrl, toolName, parameters, authToken, debugL
|
|
|
548
554
|
message: `A2A: Authentication required for ${agentUrl}`,
|
|
549
555
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
550
556
|
});
|
|
557
|
+
const signedRejection = (0, import_signedRequestRejection.getSignedRequestRejection)(error);
|
|
558
|
+
if (signedRejection) throw signedRejection;
|
|
551
559
|
const challenge = await (0, import_authorization_required.probeAuthChallenge)(agentUrl, {
|
|
552
560
|
fetchFn: context.fetchFn,
|
|
553
561
|
allowPrivateIp: context.allowPrivateIp ?? (0, import_address_guards.isLikelyPrivateUrl)(agentUrl)
|