@adcp/sdk 14.0.0-beta.14 → 14.0.0-beta.15

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.
Files changed (127) hide show
  1. package/dist/lib/auth/oauth/authorization-required.d.mts +25 -11
  2. package/dist/lib/auth/oauth/authorization-required.d.ts +25 -11
  3. package/dist/lib/auth/oauth/authorization-required.js +18 -4
  4. package/dist/lib/auth/oauth/authorization-required.mjs +17 -4
  5. package/dist/lib/auth/oauth/index.d.mts +1 -1
  6. package/dist/lib/auth/oauth/index.d.ts +1 -1
  7. package/dist/lib/auth/oauth/index.js +2 -0
  8. package/dist/lib/auth/oauth/index.mjs +2 -0
  9. package/dist/lib/auth/oauth/resource-url.d.mts +8 -0
  10. package/dist/lib/auth/oauth/resource-url.d.ts +8 -0
  11. package/dist/lib/auth/oauth/resource-url.js +42 -0
  12. package/dist/lib/auth/oauth/resource-url.mjs +40 -0
  13. package/dist/lib/core/ConversationTypes.d.mts +10 -0
  14. package/dist/lib/core/ConversationTypes.d.ts +10 -0
  15. package/dist/lib/core/SingleAgentClient.d.mts +5 -2
  16. package/dist/lib/core/SingleAgentClient.d.ts +5 -2
  17. package/dist/lib/core/SingleAgentClient.js +133 -28
  18. package/dist/lib/core/SingleAgentClient.mjs +138 -29
  19. package/dist/lib/core/TaskExecutor.d.mts +1 -0
  20. package/dist/lib/core/TaskExecutor.d.ts +1 -0
  21. package/dist/lib/core/TaskExecutor.js +7 -1
  22. package/dist/lib/core/TaskExecutor.mjs +7 -1
  23. package/dist/lib/core/webhook-registration.d.mts +8 -1
  24. package/dist/lib/core/webhook-registration.d.ts +8 -1
  25. package/dist/lib/core/webhook-registration.js +65 -5
  26. package/dist/lib/core/webhook-registration.mjs +61 -4
  27. package/dist/lib/errors/index.d.mts +9 -0
  28. package/dist/lib/errors/index.d.ts +9 -0
  29. package/dist/lib/errors/index.js +33 -0
  30. package/dist/lib/errors/index.mjs +32 -0
  31. package/dist/lib/index.d.mts +3 -2
  32. package/dist/lib/index.d.ts +3 -2
  33. package/dist/lib/index.js +4 -0
  34. package/dist/lib/index.mjs +4 -0
  35. package/dist/lib/media-buy/compatibility.js +14 -2
  36. package/dist/lib/media-buy/compatibility.mjs +14 -2
  37. package/dist/lib/protocols/index.js +23 -7
  38. package/dist/lib/protocols/index.mjs +24 -8
  39. package/dist/lib/protocols/mcp.js +8 -6
  40. package/dist/lib/protocols/mcp.mjs +9 -7
  41. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  42. package/dist/lib/server/decisioning/async-outcome.d.mts +11 -0
  43. package/dist/lib/server/decisioning/async-outcome.d.ts +11 -0
  44. package/dist/lib/server/decisioning/context.d.mts +11 -1
  45. package/dist/lib/server/decisioning/context.d.ts +11 -1
  46. package/dist/lib/server/decisioning/index.d.mts +3 -2
  47. package/dist/lib/server/decisioning/index.d.ts +3 -2
  48. package/dist/lib/server/decisioning/index.js +9 -0
  49. package/dist/lib/server/decisioning/index.mjs +10 -0
  50. package/dist/lib/server/decisioning/runtime/from-platform.d.mts +5 -2
  51. package/dist/lib/server/decisioning/runtime/from-platform.d.ts +5 -2
  52. package/dist/lib/server/decisioning/runtime/from-platform.js +40 -8
  53. package/dist/lib/server/decisioning/runtime/from-platform.mjs +40 -8
  54. package/dist/lib/server/decisioning/runtime/postgres-task-registry.d.mts +8 -1
  55. package/dist/lib/server/decisioning/runtime/postgres-task-registry.d.ts +8 -1
  56. package/dist/lib/server/decisioning/runtime/postgres-task-registry.js +10 -1
  57. package/dist/lib/server/decisioning/runtime/postgres-task-registry.mjs +9 -1
  58. package/dist/lib/server/decisioning/runtime/postgres-task-settlement.d.mts +79 -0
  59. package/dist/lib/server/decisioning/runtime/postgres-task-settlement.d.ts +79 -0
  60. package/dist/lib/server/decisioning/runtime/postgres-task-settlement.js +391 -0
  61. package/dist/lib/server/decisioning/runtime/postgres-task-settlement.mjs +369 -0
  62. package/dist/lib/server/decisioning/runtime/task-registry.d.mts +2 -0
  63. package/dist/lib/server/decisioning/runtime/task-registry.d.ts +2 -0
  64. package/dist/lib/server/decisioning/runtime/task-registry.js +2 -1
  65. package/dist/lib/server/decisioning/runtime/task-registry.mjs +2 -1
  66. package/dist/lib/server/decisioning/runtime/to-context.js +15 -11
  67. package/dist/lib/server/decisioning/runtime/to-context.mjs +15 -11
  68. package/dist/lib/server/index.d.mts +2 -2
  69. package/dist/lib/server/index.d.ts +2 -2
  70. package/dist/lib/server/index.js +4 -0
  71. package/dist/lib/server/index.mjs +4 -0
  72. package/dist/lib/server/webhook-delivery/index.d.mts +2 -2
  73. package/dist/lib/server/webhook-delivery/index.d.ts +2 -2
  74. package/dist/lib/server/webhook-delivery/index.js +4 -0
  75. package/dist/lib/server/webhook-delivery/index.mjs +5 -1
  76. package/dist/lib/server/webhook-delivery/pg.d.mts +3 -1
  77. package/dist/lib/server/webhook-delivery/pg.d.ts +3 -1
  78. package/dist/lib/server/webhook-delivery/pg.js +25 -2
  79. package/dist/lib/server/webhook-delivery/pg.mjs +25 -2
  80. package/dist/lib/server/webhook-delivery/recovery.d.mts +44 -0
  81. package/dist/lib/server/webhook-delivery/recovery.d.ts +44 -0
  82. package/dist/lib/server/webhook-delivery/recovery.js +146 -43
  83. package/dist/lib/server/webhook-delivery/recovery.mjs +144 -43
  84. package/dist/lib/signing/agent-resolver/index.d.mts +1 -1
  85. package/dist/lib/signing/agent-resolver/index.d.ts +1 -1
  86. package/dist/lib/signing/agent-resolver/resolve-agent.d.mts +9 -0
  87. package/dist/lib/signing/agent-resolver/resolve-agent.d.ts +9 -0
  88. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.mts +4 -1
  89. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.ts +4 -1
  90. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.js +17 -4
  91. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.mjs +17 -4
  92. package/dist/lib/signing/jwks.d.mts +7 -0
  93. package/dist/lib/signing/jwks.d.ts +7 -0
  94. package/dist/lib/signing/server.d.mts +2 -2
  95. package/dist/lib/signing/server.d.ts +2 -2
  96. package/dist/lib/signing/webhook-verifier.d.mts +6 -0
  97. package/dist/lib/signing/webhook-verifier.d.ts +6 -0
  98. package/dist/lib/signing/webhook-verifier.js +38 -4
  99. package/dist/lib/signing/webhook-verifier.mjs +38 -4
  100. package/dist/lib/testing/client.d.mts +1 -0
  101. package/dist/lib/testing/client.d.ts +1 -0
  102. package/dist/lib/testing/client.js +6 -2
  103. package/dist/lib/testing/client.mjs +6 -2
  104. package/dist/lib/testing/compliance/comply.d.mts +2 -2
  105. package/dist/lib/testing/compliance/comply.d.ts +2 -2
  106. package/dist/lib/testing/compliance/comply.js +41 -31
  107. package/dist/lib/testing/compliance/comply.mjs +44 -21
  108. package/dist/lib/testing/storyboard/oauth-metadata-graph/grader.d.mts +1 -7
  109. package/dist/lib/testing/storyboard/oauth-metadata-graph/grader.d.ts +1 -7
  110. package/dist/lib/testing/storyboard/oauth-metadata-graph/grader.js +6 -42
  111. package/dist/lib/testing/storyboard/oauth-metadata-graph/grader.mjs +10 -40
  112. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  113. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  114. package/dist/lib/utils/adcp-version-config.d.mts +2 -0
  115. package/dist/lib/utils/adcp-version-config.d.ts +2 -0
  116. package/dist/lib/utils/adcp-version-config.js +5 -0
  117. package/dist/lib/utils/adcp-version-config.mjs +4 -0
  118. package/dist/lib/version.d.mts +3 -3
  119. package/dist/lib/version.d.ts +3 -3
  120. package/dist/lib/version.js +3 -3
  121. package/dist/lib/version.mjs +3 -3
  122. package/docs/llms.txt +3 -1
  123. package/docs/migration-12-to-14.md +6 -5
  124. package/docs/migration-13-to-14.md +48 -7
  125. package/docs/migration-task-registry-scoping.md +164 -11
  126. package/package.json +1 -1
  127. package/skills/build-decisioning-platform/advanced/REFERENCE.md +1 -1
@@ -1,3 +1,4 @@
1
+ import type { DelegatedOperatorAuthorizationContext } from '../signing/agent-resolver/resolve-agent.mjs';
1
2
  export type WebhookAuthenticationMode = 'hmac-sha256' | 'rfc9421';
2
3
  /**
3
4
  * Trusted provenance for an outbound task-status webhook registration.
@@ -15,6 +16,10 @@ export interface WebhookRegistration {
15
16
  callbackUrl: string;
16
17
  method: 'POST';
17
18
  mode: WebhookAuthenticationMode;
19
+ /** Versioned marker distinguishing tuple-aware registrations from legacy rows. */
20
+ authorizationContextVersion?: 1;
21
+ /** Trusted local tuple used to re-authorize delegated seller keys after restart. */
22
+ delegatedOperatorAuthorization?: Readonly<DelegatedOperatorAuthorizationContext>;
18
23
  /** Originating preview API, persisted so async routing survives races and restarts. */
19
24
  previewMode?: 'canonical' | 'legacy';
20
25
  /** Callback must fail closed unless a durable mutation-settlement route is recoverable. */
@@ -29,7 +34,9 @@ export interface WebhookRegistrationStore {
29
34
  get(agentId: string, operationId: string): Promise<Readonly<WebhookRegistration> | undefined>;
30
35
  /**
31
36
  * Atomically create a registration. An identical retry is idempotent; a
32
- * conflicting live registration for the same key MUST reject.
37
+ * conflicting live registration for the same key MUST reject. A successful
38
+ * return MUST provide immediate read-your-writes consistency through `get()`
39
+ * so the SDK can verify trusted authorization provenance before dispatch.
33
40
  */
34
41
  putIfAbsent(registration: WebhookRegistration): Promise<void>;
35
42
  /** Atomically mark a live registration as requiring durable mutation settlement. */
@@ -1,3 +1,4 @@
1
+ import type { DelegatedOperatorAuthorizationContext } from '../signing/agent-resolver/resolve-agent';
1
2
  export type WebhookAuthenticationMode = 'hmac-sha256' | 'rfc9421';
2
3
  /**
3
4
  * Trusted provenance for an outbound task-status webhook registration.
@@ -15,6 +16,10 @@ export interface WebhookRegistration {
15
16
  callbackUrl: string;
16
17
  method: 'POST';
17
18
  mode: WebhookAuthenticationMode;
19
+ /** Versioned marker distinguishing tuple-aware registrations from legacy rows. */
20
+ authorizationContextVersion?: 1;
21
+ /** Trusted local tuple used to re-authorize delegated seller keys after restart. */
22
+ delegatedOperatorAuthorization?: Readonly<DelegatedOperatorAuthorizationContext>;
18
23
  /** Originating preview API, persisted so async routing survives races and restarts. */
19
24
  previewMode?: 'canonical' | 'legacy';
20
25
  /** Callback must fail closed unless a durable mutation-settlement route is recoverable. */
@@ -29,7 +34,9 @@ export interface WebhookRegistrationStore {
29
34
  get(agentId: string, operationId: string): Promise<Readonly<WebhookRegistration> | undefined>;
30
35
  /**
31
36
  * Atomically create a registration. An identical retry is idempotent; a
32
- * conflicting live registration for the same key MUST reject.
37
+ * conflicting live registration for the same key MUST reject. A successful
38
+ * return MUST provide immediate read-your-writes consistency through `get()`
39
+ * so the SDK can verify trusted authorization provenance before dispatch.
33
40
  */
34
41
  putIfAbsent(registration: WebhookRegistration): Promise<void>;
35
42
  /** Atomically mark a live registration as requiring durable mutation settlement. */
@@ -18,7 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var webhook_registration_exports = {};
20
20
  __export(webhook_registration_exports, {
21
- InMemoryWebhookRegistrationStore: () => InMemoryWebhookRegistrationStore
21
+ InMemoryWebhookRegistrationStore: () => InMemoryWebhookRegistrationStore,
22
+ canonicalDelegatedOperatorAuthorization: () => canonicalDelegatedOperatorAuthorization,
23
+ validateDelegatedOperatorAuthorizationContext: () => validateDelegatedOperatorAuthorizationContext,
24
+ validateWebhookRegistrationAuthorization: () => validateWebhookRegistrationAuthorization
22
25
  });
23
26
  module.exports = __toCommonJS(webhook_registration_exports);
24
27
  var import_errors = require('../errors/index.js');
@@ -59,7 +62,7 @@ class InMemoryWebhookRegistrationStore {
59
62
  if (this.entries.size >= this.maxEntries) {
60
63
  throw new Error("Webhook registration store capacity reached; refusing to dispatch an untracked callback.");
61
64
  }
62
- this.entries.set(key, Object.freeze({ ...registration }));
65
+ this.entries.set(key, freezeRegistration(registration));
63
66
  }
64
67
  async delete(agentId, operationId) {
65
68
  this.entries.delete(registrationKey(agentId, operationId));
@@ -71,7 +74,7 @@ class InMemoryWebhookRegistrationStore {
71
74
  this.entries.delete(key);
72
75
  throw new Error("Cannot mark a missing or expired webhook registration for durable settlement.");
73
76
  }
74
- this.entries.set(key, Object.freeze({ ...registration, requiresDurableSettlement: true }));
77
+ this.entries.set(key, freezeRegistration({ ...registration, requiresDurableSettlement: true }));
75
78
  }
76
79
  pruneExpired() {
77
80
  const now = this.now();
@@ -93,6 +96,7 @@ function validateRegistration(registration) {
93
96
  if (registration.previewMode !== void 0 && !["canonical", "legacy"].includes(registration.previewMode)) {
94
97
  throw new TypeError("Webhook registration previewMode must be canonical or legacy.");
95
98
  }
99
+ validateWebhookRegistrationAuthorization(registration);
96
100
  const callback = new URL(registration.callbackUrl);
97
101
  if (callback.username || callback.password || callback.hash) {
98
102
  throw new TypeError("Webhook callbackUrl cannot contain userinfo or a fragment.");
@@ -108,10 +112,66 @@ function validateRegistration(registration) {
108
112
  throw new TypeError("Webhook registration expiresAt must be later than createdAt.");
109
113
  }
110
114
  }
115
+ const AUTHORIZED_OPERATOR_SCOPES = /* @__PURE__ */ new Set([
116
+ "media_buying",
117
+ "creative_generation",
118
+ "rights_clearance",
119
+ "governance",
120
+ "measurement",
121
+ "agent_operations"
122
+ ]);
123
+ function validateDelegatedOperatorAuthorizationContext(value) {
124
+ if (value === void 0) return;
125
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
126
+ throw new TypeError("delegatedOperatorAuthorization must be an object.");
127
+ }
128
+ const unknown = Object.keys(value).filter((key) => !["brand", "scope", "country"].includes(key));
129
+ if (unknown.length > 0) {
130
+ throw new TypeError("delegatedOperatorAuthorization contains unsupported fields.");
131
+ }
132
+ if (value.brand !== void 0 && (typeof value.brand !== "string" || !/^[a-z0-9_]+$/.test(value.brand))) {
133
+ throw new TypeError("delegatedOperatorAuthorization.brand must be a protocol brand id.");
134
+ }
135
+ if (value.scope !== void 0 && (typeof value.scope !== "string" || !AUTHORIZED_OPERATOR_SCOPES.has(value.scope))) {
136
+ throw new TypeError("delegatedOperatorAuthorization.scope is not an authorized-operator scope.");
137
+ }
138
+ if (value.country !== void 0 && (typeof value.country !== "string" || !/^[A-Z]{2}$/.test(value.country))) {
139
+ throw new TypeError("delegatedOperatorAuthorization.country must be an uppercase ISO alpha-2 code.");
140
+ }
141
+ if (value.brand === void 0 && value.scope === void 0 && value.country === void 0) {
142
+ throw new TypeError("delegatedOperatorAuthorization must select at least one authorization dimension.");
143
+ }
144
+ }
145
+ function validateWebhookRegistrationAuthorization(registration) {
146
+ if (registration.authorizationContextVersion !== void 0 && registration.authorizationContextVersion !== 1) {
147
+ throw new TypeError("Webhook registration authorizationContextVersion must be 1 when present.");
148
+ }
149
+ if (registration.delegatedOperatorAuthorization !== void 0 && registration.authorizationContextVersion !== 1) {
150
+ throw new TypeError("Webhook registration delegatedOperatorAuthorization requires authorizationContextVersion 1.");
151
+ }
152
+ validateDelegatedOperatorAuthorizationContext(registration.delegatedOperatorAuthorization);
153
+ }
154
+ function canonicalDelegatedOperatorAuthorization(value) {
155
+ if (value === void 0) return "";
156
+ validateDelegatedOperatorAuthorizationContext(value);
157
+ return JSON.stringify([value.brand ?? null, value.scope ?? null, value.country ?? null]);
158
+ }
159
+ function freezeRegistration(registration) {
160
+ const delegatedOperatorAuthorization = registration.delegatedOperatorAuthorization;
161
+ return Object.freeze({
162
+ ...registration,
163
+ ...delegatedOperatorAuthorization !== void 0 && {
164
+ delegatedOperatorAuthorization: Object.freeze({ ...delegatedOperatorAuthorization })
165
+ }
166
+ });
167
+ }
111
168
  function sameRegistration(a, b) {
112
- return a.agentId === b.agentId && a.agentUrl === b.agentUrl && a.protocol === b.protocol && a.operationId === b.operationId && a.taskType === b.taskType && a.callbackUrl === b.callbackUrl && a.method === b.method && a.mode === b.mode && a.previewMode === b.previewMode;
169
+ return a.agentId === b.agentId && a.agentUrl === b.agentUrl && a.protocol === b.protocol && a.operationId === b.operationId && a.taskType === b.taskType && a.callbackUrl === b.callbackUrl && a.method === b.method && a.mode === b.mode && a.previewMode === b.previewMode && a.authorizationContextVersion === b.authorizationContextVersion && canonicalDelegatedOperatorAuthorization(a.delegatedOperatorAuthorization) === canonicalDelegatedOperatorAuthorization(b.delegatedOperatorAuthorization);
113
170
  }
114
171
  // Annotate the CommonJS export names for ESM import in node:
115
172
  0 && (module.exports = {
116
- InMemoryWebhookRegistrationStore
173
+ InMemoryWebhookRegistrationStore,
174
+ canonicalDelegatedOperatorAuthorization,
175
+ validateDelegatedOperatorAuthorizationContext,
176
+ validateWebhookRegistrationAuthorization
117
177
  });
@@ -36,7 +36,7 @@ class InMemoryWebhookRegistrationStore {
36
36
  if (this.entries.size >= this.maxEntries) {
37
37
  throw new Error("Webhook registration store capacity reached; refusing to dispatch an untracked callback.");
38
38
  }
39
- this.entries.set(key, Object.freeze({ ...registration }));
39
+ this.entries.set(key, freezeRegistration(registration));
40
40
  }
41
41
  async delete(agentId, operationId) {
42
42
  this.entries.delete(registrationKey(agentId, operationId));
@@ -48,7 +48,7 @@ class InMemoryWebhookRegistrationStore {
48
48
  this.entries.delete(key);
49
49
  throw new Error("Cannot mark a missing or expired webhook registration for durable settlement.");
50
50
  }
51
- this.entries.set(key, Object.freeze({ ...registration, requiresDurableSettlement: true }));
51
+ this.entries.set(key, freezeRegistration({ ...registration, requiresDurableSettlement: true }));
52
52
  }
53
53
  pruneExpired() {
54
54
  const now = this.now();
@@ -70,6 +70,7 @@ function validateRegistration(registration) {
70
70
  if (registration.previewMode !== void 0 && !["canonical", "legacy"].includes(registration.previewMode)) {
71
71
  throw new TypeError("Webhook registration previewMode must be canonical or legacy.");
72
72
  }
73
+ validateWebhookRegistrationAuthorization(registration);
73
74
  const callback = new URL(registration.callbackUrl);
74
75
  if (callback.username || callback.password || callback.hash) {
75
76
  throw new TypeError("Webhook callbackUrl cannot contain userinfo or a fragment.");
@@ -85,9 +86,65 @@ function validateRegistration(registration) {
85
86
  throw new TypeError("Webhook registration expiresAt must be later than createdAt.");
86
87
  }
87
88
  }
89
+ const AUTHORIZED_OPERATOR_SCOPES = /* @__PURE__ */ new Set([
90
+ "media_buying",
91
+ "creative_generation",
92
+ "rights_clearance",
93
+ "governance",
94
+ "measurement",
95
+ "agent_operations"
96
+ ]);
97
+ function validateDelegatedOperatorAuthorizationContext(value) {
98
+ if (value === void 0) return;
99
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
100
+ throw new TypeError("delegatedOperatorAuthorization must be an object.");
101
+ }
102
+ const unknown = Object.keys(value).filter((key) => !["brand", "scope", "country"].includes(key));
103
+ if (unknown.length > 0) {
104
+ throw new TypeError("delegatedOperatorAuthorization contains unsupported fields.");
105
+ }
106
+ if (value.brand !== void 0 && (typeof value.brand !== "string" || !/^[a-z0-9_]+$/.test(value.brand))) {
107
+ throw new TypeError("delegatedOperatorAuthorization.brand must be a protocol brand id.");
108
+ }
109
+ if (value.scope !== void 0 && (typeof value.scope !== "string" || !AUTHORIZED_OPERATOR_SCOPES.has(value.scope))) {
110
+ throw new TypeError("delegatedOperatorAuthorization.scope is not an authorized-operator scope.");
111
+ }
112
+ if (value.country !== void 0 && (typeof value.country !== "string" || !/^[A-Z]{2}$/.test(value.country))) {
113
+ throw new TypeError("delegatedOperatorAuthorization.country must be an uppercase ISO alpha-2 code.");
114
+ }
115
+ if (value.brand === void 0 && value.scope === void 0 && value.country === void 0) {
116
+ throw new TypeError("delegatedOperatorAuthorization must select at least one authorization dimension.");
117
+ }
118
+ }
119
+ function validateWebhookRegistrationAuthorization(registration) {
120
+ if (registration.authorizationContextVersion !== void 0 && registration.authorizationContextVersion !== 1) {
121
+ throw new TypeError("Webhook registration authorizationContextVersion must be 1 when present.");
122
+ }
123
+ if (registration.delegatedOperatorAuthorization !== void 0 && registration.authorizationContextVersion !== 1) {
124
+ throw new TypeError("Webhook registration delegatedOperatorAuthorization requires authorizationContextVersion 1.");
125
+ }
126
+ validateDelegatedOperatorAuthorizationContext(registration.delegatedOperatorAuthorization);
127
+ }
128
+ function canonicalDelegatedOperatorAuthorization(value) {
129
+ if (value === void 0) return "";
130
+ validateDelegatedOperatorAuthorizationContext(value);
131
+ return JSON.stringify([value.brand ?? null, value.scope ?? null, value.country ?? null]);
132
+ }
133
+ function freezeRegistration(registration) {
134
+ const delegatedOperatorAuthorization = registration.delegatedOperatorAuthorization;
135
+ return Object.freeze({
136
+ ...registration,
137
+ ...delegatedOperatorAuthorization !== void 0 && {
138
+ delegatedOperatorAuthorization: Object.freeze({ ...delegatedOperatorAuthorization })
139
+ }
140
+ });
141
+ }
88
142
  function sameRegistration(a, b) {
89
- return a.agentId === b.agentId && a.agentUrl === b.agentUrl && a.protocol === b.protocol && a.operationId === b.operationId && a.taskType === b.taskType && a.callbackUrl === b.callbackUrl && a.method === b.method && a.mode === b.mode && a.previewMode === b.previewMode;
143
+ return a.agentId === b.agentId && a.agentUrl === b.agentUrl && a.protocol === b.protocol && a.operationId === b.operationId && a.taskType === b.taskType && a.callbackUrl === b.callbackUrl && a.method === b.method && a.mode === b.mode && a.previewMode === b.previewMode && a.authorizationContextVersion === b.authorizationContextVersion && canonicalDelegatedOperatorAuthorization(a.delegatedOperatorAuthorization) === canonicalDelegatedOperatorAuthorization(b.delegatedOperatorAuthorization);
90
144
  }
91
145
  export {
92
- InMemoryWebhookRegistrationStore
146
+ InMemoryWebhookRegistrationStore,
147
+ canonicalDelegatedOperatorAuthorization,
148
+ validateDelegatedOperatorAuthorizationContext,
149
+ validateWebhookRegistrationAuthorization
93
150
  };
@@ -204,6 +204,15 @@ export declare class AuthenticationRequiredError extends ADCPError {
204
204
  */
205
205
  get suggestedScheme(): string | undefined;
206
206
  }
207
+ /**
208
+ * A configured non-interactive credential reached the agent and was rejected.
209
+ * The transport error is retained as a non-enumerable cause so reflected
210
+ * credential material from an untrusted 401 body cannot enter JSON reports.
211
+ */
212
+ export declare class AuthenticationCredentialsRejectedError extends AuthenticationRequiredError {
213
+ readonly subCode: "credentials_rejected";
214
+ constructor(agentUrl: string, cause?: unknown);
215
+ }
207
216
  /**
208
217
  * Error thrown when a request reused an `idempotency_key` with a different
209
218
  * canonical payload within the seller's replay window.
@@ -204,6 +204,15 @@ export declare class AuthenticationRequiredError extends ADCPError {
204
204
  */
205
205
  get suggestedScheme(): string | undefined;
206
206
  }
207
+ /**
208
+ * A configured non-interactive credential reached the agent and was rejected.
209
+ * The transport error is retained as a non-enumerable cause so reflected
210
+ * credential material from an untrusted 401 body cannot enter JSON reports.
211
+ */
212
+ export declare class AuthenticationCredentialsRejectedError extends AuthenticationRequiredError {
213
+ readonly subCode: "credentials_rejected";
214
+ constructor(agentUrl: string, cause?: unknown);
215
+ }
207
216
  /**
208
217
  * Error thrown when a request reused an `idempotency_key` with a different
209
218
  * canonical payload within the seller's replay window.
@@ -21,6 +21,7 @@ __export(errors_exports, {
21
21
  ADCPError: () => ADCPError,
22
22
  ActionNotAllowedError: () => ActionNotAllowedError,
23
23
  AgentNotFoundError: () => AgentNotFoundError,
24
+ AuthenticationCredentialsRejectedError: () => AuthenticationCredentialsRejectedError,
24
25
  AuthenticationRequiredError: () => AuthenticationRequiredError,
25
26
  ConfigurationError: () => ConfigurationError,
26
27
  DeferredTaskError: () => DeferredTaskError,
@@ -216,6 +217,37 @@ class AuthenticationRequiredError extends ADCPError {
216
217
  return this.challenge?.scheme;
217
218
  }
218
219
  }
220
+ class AuthenticationCredentialsRejectedError extends AuthenticationRequiredError {
221
+ subCode = "credentials_rejected";
222
+ constructor(agentUrl, cause) {
223
+ const safeAgentUrl = sanitizeAgentUrlForError(agentUrl);
224
+ super(
225
+ safeAgentUrl,
226
+ void 0,
227
+ "The agent rejected the configured credential with HTTP 401. Verify or replace the saved credential and retry."
228
+ );
229
+ this.name = "AuthenticationCredentialsRejectedError";
230
+ if (cause !== void 0) {
231
+ Object.defineProperty(this, "cause", {
232
+ value: cause,
233
+ enumerable: false,
234
+ configurable: true
235
+ });
236
+ }
237
+ }
238
+ }
239
+ function sanitizeAgentUrlForError(value) {
240
+ try {
241
+ const url = new URL(value);
242
+ url.username = "";
243
+ url.password = "";
244
+ url.search = "";
245
+ url.hash = "";
246
+ return url.toString();
247
+ } catch {
248
+ return "invalid_url";
249
+ }
250
+ }
219
251
  function buildAuthRequiredMessage(agentUrl, oauthMetadata, challenge) {
220
252
  if (challenge && challenge.scheme !== "bearer") {
221
253
  if (challenge.scheme === "basic") {
@@ -508,6 +540,7 @@ function extractErrorInfo(error) {
508
540
  ADCPError,
509
541
  ActionNotAllowedError,
510
542
  AgentNotFoundError,
543
+ AuthenticationCredentialsRejectedError,
511
544
  AuthenticationRequiredError,
512
545
  ConfigurationError,
513
546
  DeferredTaskError,
@@ -166,6 +166,37 @@ class AuthenticationRequiredError extends ADCPError {
166
166
  return this.challenge?.scheme;
167
167
  }
168
168
  }
169
+ class AuthenticationCredentialsRejectedError extends AuthenticationRequiredError {
170
+ subCode = "credentials_rejected";
171
+ constructor(agentUrl, cause) {
172
+ const safeAgentUrl = sanitizeAgentUrlForError(agentUrl);
173
+ super(
174
+ safeAgentUrl,
175
+ void 0,
176
+ "The agent rejected the configured credential with HTTP 401. Verify or replace the saved credential and retry."
177
+ );
178
+ this.name = "AuthenticationCredentialsRejectedError";
179
+ if (cause !== void 0) {
180
+ Object.defineProperty(this, "cause", {
181
+ value: cause,
182
+ enumerable: false,
183
+ configurable: true
184
+ });
185
+ }
186
+ }
187
+ }
188
+ function sanitizeAgentUrlForError(value) {
189
+ try {
190
+ const url = new URL(value);
191
+ url.username = "";
192
+ url.password = "";
193
+ url.search = "";
194
+ url.hash = "";
195
+ return url.toString();
196
+ } catch {
197
+ return "invalid_url";
198
+ }
199
+ }
169
200
  function buildAuthRequiredMessage(agentUrl, oauthMetadata, challenge) {
170
201
  if (challenge && challenge.scheme !== "bearer") {
171
202
  if (challenge.scheme === "basic") {
@@ -457,6 +488,7 @@ export {
457
488
  ADCPError,
458
489
  ActionNotAllowedError,
459
490
  AgentNotFoundError,
491
+ AuthenticationCredentialsRejectedError,
460
492
  AuthenticationRequiredError,
461
493
  ConfigurationError,
462
494
  DeferredTaskError,
@@ -16,6 +16,7 @@ export { validateAdAgents, parseManagerDomain, type DiscoveryMethod, type AdAgen
16
16
  export { SingleAgentClient, WebhookDispatchError, createSingleAgentClient, UnsupportedFeatureError, } from './core/SingleAgentClient.mjs';
17
17
  export type { ClientProductPropertyPolicy, CreativeDeliveryTaskOptions, SingleAgentClientConfig, SyncCreativesTaskOptions, VerifyAndParseWebhookOptions, WebhookHandlerAdapter, WebhookHandlerRequest, WebhookParseErrorCode, WebhookParseFailure, WebhookParseResult, WebhookParseSuccess, WebhookVerificationConfig, } from './core/SingleAgentClient.mjs';
18
18
  export { InMemoryWebhookRegistrationStore, type InMemoryWebhookRegistrationStoreOptions, type WebhookAuthenticationMode, type WebhookRegistration, type WebhookRegistrationStore, } from './core/webhook-registration.mjs';
19
+ export type { DelegatedOperatorAuthorizationContext } from './signing/agent-resolver/index.mjs';
19
20
  export { AgentClient, type CanonicalGetProductsResponse, type CanonicalProjectionTaskOptions, type ProposalRefinementTaskOptions, type TaskResponseTypeMap, type TaskRequestTypeMap, type TaskRequestFor, type AdcpTaskName, type InProcessAgentClientConfig, } from './core/AgentClient.mjs';
20
21
  export { MediaBuyLifecycleCoordinator, MediaBuyLifecycleCompatibilityError, LegacyPurchaseContinuationError, negotiateMediaBuyLifecycle, type CompatibleDeclineProposalsResponse, type CompatibleDeclineProposalsWireResponse, type CompatibleDeclineResult, type CompatibleProductsResponse, type CompatibleProductsWireResponse, type CompatibleProduct, type CompatibleProposal, type CompatibleProposalResponse, type CompatibleProjectedDeclineResult, type CompatibleRefinementResult, type CompatibleRefineProposalsResponse, type CompatibleRefineProposalsWireResponse, type CompatibleRequestProposalsResponse, type CompatibleRequestProposalsWireResponse, type CompatibleAcceptProposalRequest, type CompatibilityDeferredContinuation, type CompatibilitySubmittedContinuation, type CompatibilityTaskResult, type EstablishedProductsWireResponse, type EstablishedProposalAcceptanceFallback, type EstablishedProposalTaskReconciliationInput, type MediaBuyCompatibility, type MediaBuyCompatibilityLoss, type MediaBuyCompatibilityReport, type MediaBuyLifecycle, type MediaBuyLifecycleCoordinatorOptions, type LegacyPurchaseContinuationErrorCode, } from './media-buy/compatibility.mjs';
21
22
  export { InMemoryLegacyPurchaseContinuationStore, createInMemoryLegacyPurchaseContinuationStore, LEGACY_PURCHASE_PUBLICATION_PROOF_RETENTION_MS, legacyPurchaseSettlementFingerprint, type InMemoryLegacyPurchaseContinuationStoreOptions, type LegacyPurchaseBinding, type LegacyPurchaseClaim, type LegacyPurchaseClaimRequest, type LegacyPurchaseClaimResult, type LegacyPurchaseCompleteResult, type LegacyPurchaseContinuationRecord, type LegacyPurchaseContinuationStore, type LegacyPurchaseCreateResult, type LegacyPurchaseLoss, type LegacyPurchaseOperation, type LegacyPurchasePendingSettlement, type LegacyPurchasePendingSettlementResult, type LegacyPurchasePublicationLease, type LegacyPurchaseReconciliationResult, type LegacyPurchaseSourceVersion, type LegacyPurchaseTerminalResult, type ReconcileLegacyPurchase, } from './media-buy/legacy-purchase-continuation.mjs';
@@ -47,7 +48,7 @@ export * from './handlers/types.mjs';
47
48
  export type { Storage, AtomicTakeStorage, DeferredTaskStorage, BatchStorage, PatternStorage, AgentCapabilities, ConversationState, DeferredTaskState, StorageConfig, StorageFactory, StorageMiddleware, } from './storage/interfaces.mjs';
48
49
  export { MemoryStorage, createMemoryStorage, createMemoryStorageConfig } from './storage/MemoryStorage.mjs';
49
50
  export { ADCPError, TaskTimeoutError, MaxClarificationError, DeferredTaskError, TaskAbortedError, AgentNotFoundError, UnsupportedTaskError, ProtocolError, ValidationError as ADCPValidationError, // Rename to avoid conflict
50
- MissingInputHandlerError, InvalidContextError, ConfigurationError, AuthenticationRequiredError, FeatureUnsupportedError, ProtocolFeatureUnsupportedError, SDK_ERROR_TO_PROTOCOL_ERROR_CODE, VersionUnsupportedError, IdempotencyConflictError, IdempotencyExpiredError, ResponseTooLargeError, ActionNotAllowedError, adcpErrorToTypedError, getClientPreflightAdcpError, isADCPError, isErrorOfType, extractErrorInfo, is401Error, mapSdkErrorCodeToProtocolErrorCode, } from './errors/index.mjs';
51
+ MissingInputHandlerError, InvalidContextError, ConfigurationError, AuthenticationCredentialsRejectedError, AuthenticationRequiredError, FeatureUnsupportedError, ProtocolFeatureUnsupportedError, SDK_ERROR_TO_PROTOCOL_ERROR_CODE, VersionUnsupportedError, IdempotencyConflictError, IdempotencyExpiredError, ResponseTooLargeError, ActionNotAllowedError, adcpErrorToTypedError, getClientPreflightAdcpError, isADCPError, isErrorOfType, extractErrorInfo, is401Error, mapSdkErrorCodeToProtocolErrorCode, } from './errors/index.mjs';
51
52
  export type { OAuthMetadataInfo, ClientPreflightAdcpErrorInfo, ClientPreflightAdcpErrorRecovery, FeatureUnsupportedErrorOptions, ProtocolFeatureUnsupportedErrorOptions, ActionNotAllowedErrorDetails, ActionNotAllowedReasonValue, ActionNotAllowedAttemptedAction, ActionNotAllowedAvailableAction, ActionNotAllowedRecovery, } from './errors/index.mjs';
52
53
  export type { ActionNotAllowedDetails, ActionNotAllowedReason, AvailableActionsResult, AvailableActionsSource, DecomposedUpdateMediaBuy, DecomposedUpdateMediaBuyMutation, LegacyCoarseAction, MediaBuyActionContext, MediaBuyActionMode, MediaBuyAvailableAction, MediaBuyMutationDirection, MediaBuyMutationScope, MediaBuyValidAction, ModeMismatchRecovery, PreflightAllowed, PreflightDenial, PreflightDenied, BuyerPropertyPolicy, NormalizedPolicyDomain, ProductPolicyProductLike, ProductPropertyPolicyDiagnostic, ProductPropertyPolicyDiagnosticCode, ProductPropertyPolicyDiagnosticSeverity, ProductPropertyPolicyMode, ProductPropertyPolicySelectorBehavior, ProductPropertyPolicyValidationResult, PreflightResult, ResolvedAction, SLAWindow, SlaWindow, ValidateProductsAgainstPropertyPolicyOptions, UpdateFieldEntry, UpdateMediaBuyRequestLike, } from './media-buy/index.mjs';
53
54
  export { ACTIONS_BY_FIELD, LEGACY_COARSE_ACTIONS, UPDATE_FIELDS_BY_ACTION, 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';
@@ -176,7 +177,7 @@ export * from './types/enum-compat.mjs';
176
177
  export { getAuthToken, createAdCPHeaders, createMCPAuthHeaders, createAuthenticatedFetch } from './auth/index.mjs';
177
178
  export { parseWWWAuthenticate, decodeAccessTokenClaims, validateTokenAudience, type WWWAuthenticateChallenge, type DecodedJWTHeader, type DecodedJWTClaims, type DecodedAccessToken, type TokenAudienceResult, InvalidTokenError, InsufficientScopeError, } from './auth/oauth/index.mjs';
178
179
  export { runAuthDiagnosis, AUTH_DIAGNOSIS_SCHEMA_VERSION, type DiagnoseOptions, type HttpCapture as DiagnosisHttpCapture, type DiagnosisStep, type Hypothesis as DiagnosisHypothesis, type HypothesisVerdict as DiagnosisHypothesisVerdict, type AuthDiagnosisReport, } from './auth/oauth/index.mjs';
179
- export { NeedsAuthorizationError, discoverAuthorizationRequirements, createFileOAuthStorage, bindAgentStorage, getAgentStorage, unbindAgentStorage, type AuthorizationRequirements, type DiscoverAuthorizationOptions, type FileOAuthStorageOptions, } from './auth/oauth/index.mjs';
180
+ export { NeedsAuthorizationError, discoverAuthorizationRequirements, hasValidatedMcpAuthorizationRequirements, createFileOAuthStorage, bindAgentStorage, getAgentStorage, unbindAgentStorage, type AuthorizationRequirements, type DiscoverAuthorizationOptions, type FileOAuthStorageOptions, } from './auth/oauth/index.mjs';
180
181
  export { exchangeClientCredentials, ensureClientCredentialsTokens, ClientCredentialsExchangeError, MissingEnvSecretError, resolveSecret, isEnvSecretReference, toEnvSecretReference, extractEnvSecretName, type ExchangeClientCredentialsOptions, type EnsureClientCredentialsOptions, type AgentOAuthClientCredentials, } from './auth/oauth/index.mjs';
181
182
  export { validateAgentUrl, validateAdCPResponse, getExpectedSchema, handleAdCPResponse } from './validation/index.mjs';
182
183
  export { ProtocolClient, callMCPTool, callA2ATool, createMCPClient, createA2AClient, closeMCPConnections, closeOAuthConnections, bundleSupportsAdcpVersionField, sanitizeTransportHeaders, sanitizeTransportUrl, } from './protocols/index.mjs';
@@ -16,6 +16,7 @@ export { validateAdAgents, parseManagerDomain, type DiscoveryMethod, type AdAgen
16
16
  export { SingleAgentClient, WebhookDispatchError, createSingleAgentClient, UnsupportedFeatureError, } from './core/SingleAgentClient';
17
17
  export type { ClientProductPropertyPolicy, CreativeDeliveryTaskOptions, SingleAgentClientConfig, SyncCreativesTaskOptions, VerifyAndParseWebhookOptions, WebhookHandlerAdapter, WebhookHandlerRequest, WebhookParseErrorCode, WebhookParseFailure, WebhookParseResult, WebhookParseSuccess, WebhookVerificationConfig, } from './core/SingleAgentClient';
18
18
  export { InMemoryWebhookRegistrationStore, type InMemoryWebhookRegistrationStoreOptions, type WebhookAuthenticationMode, type WebhookRegistration, type WebhookRegistrationStore, } from './core/webhook-registration';
19
+ export type { DelegatedOperatorAuthorizationContext } from './signing/agent-resolver';
19
20
  export { AgentClient, type CanonicalGetProductsResponse, type CanonicalProjectionTaskOptions, type ProposalRefinementTaskOptions, type TaskResponseTypeMap, type TaskRequestTypeMap, type TaskRequestFor, type AdcpTaskName, type InProcessAgentClientConfig, } from './core/AgentClient';
20
21
  export { MediaBuyLifecycleCoordinator, MediaBuyLifecycleCompatibilityError, LegacyPurchaseContinuationError, negotiateMediaBuyLifecycle, type CompatibleDeclineProposalsResponse, type CompatibleDeclineProposalsWireResponse, type CompatibleDeclineResult, type CompatibleProductsResponse, type CompatibleProductsWireResponse, type CompatibleProduct, type CompatibleProposal, type CompatibleProposalResponse, type CompatibleProjectedDeclineResult, type CompatibleRefinementResult, type CompatibleRefineProposalsResponse, type CompatibleRefineProposalsWireResponse, type CompatibleRequestProposalsResponse, type CompatibleRequestProposalsWireResponse, type CompatibleAcceptProposalRequest, type CompatibilityDeferredContinuation, type CompatibilitySubmittedContinuation, type CompatibilityTaskResult, type EstablishedProductsWireResponse, type EstablishedProposalAcceptanceFallback, type EstablishedProposalTaskReconciliationInput, type MediaBuyCompatibility, type MediaBuyCompatibilityLoss, type MediaBuyCompatibilityReport, type MediaBuyLifecycle, type MediaBuyLifecycleCoordinatorOptions, type LegacyPurchaseContinuationErrorCode, } from './media-buy/compatibility';
21
22
  export { InMemoryLegacyPurchaseContinuationStore, createInMemoryLegacyPurchaseContinuationStore, LEGACY_PURCHASE_PUBLICATION_PROOF_RETENTION_MS, legacyPurchaseSettlementFingerprint, type InMemoryLegacyPurchaseContinuationStoreOptions, type LegacyPurchaseBinding, type LegacyPurchaseClaim, type LegacyPurchaseClaimRequest, type LegacyPurchaseClaimResult, type LegacyPurchaseCompleteResult, type LegacyPurchaseContinuationRecord, type LegacyPurchaseContinuationStore, type LegacyPurchaseCreateResult, type LegacyPurchaseLoss, type LegacyPurchaseOperation, type LegacyPurchasePendingSettlement, type LegacyPurchasePendingSettlementResult, type LegacyPurchasePublicationLease, type LegacyPurchaseReconciliationResult, type LegacyPurchaseSourceVersion, type LegacyPurchaseTerminalResult, type ReconcileLegacyPurchase, } from './media-buy/legacy-purchase-continuation';
@@ -47,7 +48,7 @@ export * from './handlers/types';
47
48
  export type { Storage, AtomicTakeStorage, DeferredTaskStorage, BatchStorage, PatternStorage, AgentCapabilities, ConversationState, DeferredTaskState, StorageConfig, StorageFactory, StorageMiddleware, } from './storage/interfaces';
48
49
  export { MemoryStorage, createMemoryStorage, createMemoryStorageConfig } from './storage/MemoryStorage';
49
50
  export { ADCPError, TaskTimeoutError, MaxClarificationError, DeferredTaskError, TaskAbortedError, AgentNotFoundError, UnsupportedTaskError, ProtocolError, ValidationError as ADCPValidationError, // Rename to avoid conflict
50
- MissingInputHandlerError, InvalidContextError, ConfigurationError, AuthenticationRequiredError, FeatureUnsupportedError, ProtocolFeatureUnsupportedError, SDK_ERROR_TO_PROTOCOL_ERROR_CODE, VersionUnsupportedError, IdempotencyConflictError, IdempotencyExpiredError, ResponseTooLargeError, ActionNotAllowedError, adcpErrorToTypedError, getClientPreflightAdcpError, isADCPError, isErrorOfType, extractErrorInfo, is401Error, mapSdkErrorCodeToProtocolErrorCode, } from './errors';
51
+ MissingInputHandlerError, InvalidContextError, ConfigurationError, AuthenticationCredentialsRejectedError, AuthenticationRequiredError, FeatureUnsupportedError, ProtocolFeatureUnsupportedError, SDK_ERROR_TO_PROTOCOL_ERROR_CODE, VersionUnsupportedError, IdempotencyConflictError, IdempotencyExpiredError, ResponseTooLargeError, ActionNotAllowedError, adcpErrorToTypedError, getClientPreflightAdcpError, isADCPError, isErrorOfType, extractErrorInfo, is401Error, mapSdkErrorCodeToProtocolErrorCode, } from './errors';
51
52
  export type { OAuthMetadataInfo, ClientPreflightAdcpErrorInfo, ClientPreflightAdcpErrorRecovery, FeatureUnsupportedErrorOptions, ProtocolFeatureUnsupportedErrorOptions, ActionNotAllowedErrorDetails, ActionNotAllowedReasonValue, ActionNotAllowedAttemptedAction, ActionNotAllowedAvailableAction, ActionNotAllowedRecovery, } from './errors';
52
53
  export type { ActionNotAllowedDetails, ActionNotAllowedReason, AvailableActionsResult, AvailableActionsSource, DecomposedUpdateMediaBuy, DecomposedUpdateMediaBuyMutation, LegacyCoarseAction, MediaBuyActionContext, MediaBuyActionMode, MediaBuyAvailableAction, MediaBuyMutationDirection, MediaBuyMutationScope, MediaBuyValidAction, ModeMismatchRecovery, PreflightAllowed, PreflightDenial, PreflightDenied, BuyerPropertyPolicy, NormalizedPolicyDomain, ProductPolicyProductLike, ProductPropertyPolicyDiagnostic, ProductPropertyPolicyDiagnosticCode, ProductPropertyPolicyDiagnosticSeverity, ProductPropertyPolicyMode, ProductPropertyPolicySelectorBehavior, ProductPropertyPolicyValidationResult, PreflightResult, ResolvedAction, SLAWindow, SlaWindow, ValidateProductsAgainstPropertyPolicyOptions, UpdateFieldEntry, UpdateMediaBuyRequestLike, } from './media-buy';
53
54
  export { ACTIONS_BY_FIELD, LEGACY_COARSE_ACTIONS, UPDATE_FIELDS_BY_ACTION, 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';
@@ -176,7 +177,7 @@ export * from './types/enum-compat';
176
177
  export { getAuthToken, createAdCPHeaders, createMCPAuthHeaders, createAuthenticatedFetch } from './auth';
177
178
  export { parseWWWAuthenticate, decodeAccessTokenClaims, validateTokenAudience, type WWWAuthenticateChallenge, type DecodedJWTHeader, type DecodedJWTClaims, type DecodedAccessToken, type TokenAudienceResult, InvalidTokenError, InsufficientScopeError, } from './auth/oauth';
178
179
  export { runAuthDiagnosis, AUTH_DIAGNOSIS_SCHEMA_VERSION, type DiagnoseOptions, type HttpCapture as DiagnosisHttpCapture, type DiagnosisStep, type Hypothesis as DiagnosisHypothesis, type HypothesisVerdict as DiagnosisHypothesisVerdict, type AuthDiagnosisReport, } from './auth/oauth';
179
- export { NeedsAuthorizationError, discoverAuthorizationRequirements, createFileOAuthStorage, bindAgentStorage, getAgentStorage, unbindAgentStorage, type AuthorizationRequirements, type DiscoverAuthorizationOptions, type FileOAuthStorageOptions, } from './auth/oauth';
180
+ export { NeedsAuthorizationError, discoverAuthorizationRequirements, hasValidatedMcpAuthorizationRequirements, createFileOAuthStorage, bindAgentStorage, getAgentStorage, unbindAgentStorage, type AuthorizationRequirements, type DiscoverAuthorizationOptions, type FileOAuthStorageOptions, } from './auth/oauth';
180
181
  export { exchangeClientCredentials, ensureClientCredentialsTokens, ClientCredentialsExchangeError, MissingEnvSecretError, resolveSecret, isEnvSecretReference, toEnvSecretReference, extractEnvSecretName, type ExchangeClientCredentialsOptions, type EnsureClientCredentialsOptions, type AgentOAuthClientCredentials, } from './auth/oauth';
181
182
  export { validateAgentUrl, validateAdCPResponse, getExpectedSchema, handleAdCPResponse } from './validation';
182
183
  export { ProtocolClient, callMCPTool, callA2ATool, createMCPClient, createA2AClient, closeMCPConnections, closeOAuthConnections, bundleSupportsAdcpVersionField, sanitizeTransportHeaders, sanitizeTransportUrl, } from './protocols';
package/dist/lib/index.js CHANGED
@@ -42,6 +42,7 @@ __export(index_exports, {
42
42
  AgentNotFoundError: () => import_errors.AgentNotFoundError,
43
43
  Asset: () => import_asset_builders.Asset,
44
44
  AsyncHandler: () => import_AsyncHandler.AsyncHandler,
45
+ AuthenticationCredentialsRejectedError: () => import_errors.AuthenticationCredentialsRejectedError,
45
46
  AuthenticationRequiredError: () => import_errors.AuthenticationRequiredError,
46
47
  BRAND_RIGHTS_TOOLS: () => import_capabilities.BRAND_RIGHTS_TOOLS,
47
48
  BrandJsonSchema: () => import_wellknown_schemas.BrandJsonSchema,
@@ -403,6 +404,7 @@ __export(index_exports, {
403
404
  hasAdvisorySuccessPayload: () => import_utils.hasAdvisorySuccessPayload,
404
405
  hasAssets: () => import_format_assets.hasAssets,
405
406
  hasBrandRightsTools: () => import_testing.hasBrandRightsTools,
407
+ hasValidatedMcpAuthorizationRequirements: () => import_oauth3.hasValidatedMcpAuthorizationRequirements,
406
408
  hashPayload: () => import_server.hashPayload,
407
409
  hostname: () => import_server.hostname,
408
410
  htmlAsset: () => import_asset_builders.htmlAsset,
@@ -819,6 +821,7 @@ function createAdCPClientFromEnv() {
819
821
  AgentNotFoundError,
820
822
  Asset,
821
823
  AsyncHandler,
824
+ AuthenticationCredentialsRejectedError,
822
825
  AuthenticationRequiredError,
823
826
  BRAND_RIGHTS_TOOLS,
824
827
  BrandJsonSchema,
@@ -1180,6 +1183,7 @@ function createAdCPClientFromEnv() {
1180
1183
  hasAdvisorySuccessPayload,
1181
1184
  hasAssets,
1182
1185
  hasBrandRightsTools,
1186
+ hasValidatedMcpAuthorizationRequirements,
1183
1187
  hashPayload,
1184
1188
  hostname,
1185
1189
  htmlAsset,
@@ -187,6 +187,7 @@ import {
187
187
  MissingInputHandlerError,
188
188
  InvalidContextError,
189
189
  ConfigurationError,
190
+ AuthenticationCredentialsRejectedError,
190
191
  AuthenticationRequiredError,
191
192
  FeatureUnsupportedError,
192
193
  ProtocolFeatureUnsupportedError,
@@ -388,6 +389,7 @@ import {
388
389
  import {
389
390
  NeedsAuthorizationError,
390
391
  discoverAuthorizationRequirements,
392
+ hasValidatedMcpAuthorizationRequirements,
391
393
  createFileOAuthStorage,
392
394
  bindAgentStorage,
393
395
  getAgentStorage,
@@ -775,6 +777,7 @@ export {
775
777
  AgentNotFoundError,
776
778
  Asset,
777
779
  AsyncHandler,
780
+ AuthenticationCredentialsRejectedError,
778
781
  AuthenticationRequiredError,
779
782
  BRAND_RIGHTS_TOOLS,
780
783
  BrandJsonSchema,
@@ -1136,6 +1139,7 @@ export {
1136
1139
  hasAdvisorySuccessPayload,
1137
1140
  hasAssets,
1138
1141
  hasBrandRightsTools,
1142
+ hasValidatedMcpAuthorizationRequirements,
1139
1143
  hashPayload,
1140
1144
  hostname,
1141
1145
  htmlAsset,
@@ -426,11 +426,14 @@ function requestFingerprint(value) {
426
426
  return (0, import_node_crypto.createHash)("sha256").update((0, import_jcs.canonicalize)(value)).digest("base64url");
427
427
  }
428
428
  function snapshotCompatibilityTaskOptions(options) {
429
- if (!options) return void 0;
429
+ if (!options) return options;
430
430
  return {
431
431
  ...options,
432
432
  ...options.transport !== void 0 && { transport: { ...options.transport } },
433
- ...options.metadata !== void 0 && { metadata: structuredClone(options.metadata) }
433
+ ...options.metadata !== void 0 && { metadata: structuredClone(options.metadata) },
434
+ ...options.delegatedOperatorAuthorization !== void 0 && {
435
+ delegatedOperatorAuthorization: { ...options.delegatedOperatorAuthorization }
436
+ }
434
437
  };
435
438
  }
436
439
  function stripWebhookAuthenticationCredential(value) {
@@ -3763,6 +3766,7 @@ class MediaBuyLifecycleCoordinator {
3763
3766
  return adapt(result);
3764
3767
  }
3765
3768
  async listProducts(params, inputHandler, options) {
3769
+ options = snapshotCompatibilityTaskOptions(options);
3766
3770
  this.assertActive("listProducts");
3767
3771
  const input = record(params);
3768
3772
  const lifecycle = this.selectLifecycle("list_products");
@@ -3835,6 +3839,7 @@ class MediaBuyLifecycleCoordinator {
3835
3839
  );
3836
3840
  }
3837
3841
  async requestProposals(params, inputHandler, options) {
3842
+ options = snapshotCompatibilityTaskOptions(options);
3838
3843
  this.assertActive("requestProposals");
3839
3844
  const input = record(params);
3840
3845
  const lifecycle = this.selectLifecycle("request_proposals");
@@ -6268,6 +6273,7 @@ class MediaBuyLifecycleCoordinator {
6268
6273
  return (0, import_match.attachMatch)(result);
6269
6274
  }
6270
6275
  async refineProposals(params, inputHandler, options) {
6276
+ options = snapshotCompatibilityTaskOptions(options);
6271
6277
  this.assertActive("refineProposals");
6272
6278
  const lifecycle = this.selectLifecycle("refine_proposals");
6273
6279
  this.assertBeta6ReportingRequest("refineProposals", "refine_proposals", params);
@@ -6563,6 +6569,7 @@ class MediaBuyLifecycleCoordinator {
6563
6569
  }
6564
6570
  }
6565
6571
  async declineProposals(params, inputHandler, options) {
6572
+ options = snapshotCompatibilityTaskOptions(options);
6566
6573
  this.assertActive("declineProposals");
6567
6574
  const input = record(params);
6568
6575
  const lifecycle = this.selectLifecycle("decline_proposals");
@@ -6787,6 +6794,7 @@ class MediaBuyLifecycleCoordinator {
6787
6794
  }
6788
6795
  }
6789
6796
  async buyProducts(params, inputHandler, options) {
6797
+ options = snapshotCompatibilityTaskOptions(options);
6790
6798
  this.assertActive("buyProducts");
6791
6799
  const input = record(params);
6792
6800
  const lifecycle = this.selectLifecycle("buy_products");
@@ -6926,6 +6934,7 @@ class MediaBuyLifecycleCoordinator {
6926
6934
  );
6927
6935
  }
6928
6936
  async acceptProposal(params, inputHandler, options) {
6937
+ options = snapshotCompatibilityTaskOptions(options);
6929
6938
  this.assertActive("acceptProposal");
6930
6939
  const input = record(params);
6931
6940
  const lifecycle = this.selectLifecycle("accept_proposal");
@@ -7404,6 +7413,7 @@ class MediaBuyLifecycleCoordinator {
7404
7413
  return this.attachEstablishedMutationTransitions(adapted, durableMutation);
7405
7414
  }
7406
7415
  async controlMediaBuy(params, inputHandler, options) {
7416
+ options = snapshotCompatibilityTaskOptions(options);
7407
7417
  this.assertActive("controlMediaBuy");
7408
7418
  const input = record(params);
7409
7419
  const lifecycle = this.selectLifecycle("control_media_buy");
@@ -7690,6 +7700,7 @@ class MediaBuyLifecycleCoordinator {
7690
7700
  );
7691
7701
  }
7692
7702
  async getMediaBuys(params, inputHandler, options) {
7703
+ options = snapshotCompatibilityTaskOptions(options);
7693
7704
  this.assertActive("getMediaBuys");
7694
7705
  if (compareRelease(this.negotiated_version, "3.0") < 0) {
7695
7706
  throw this.unsupported(
@@ -7711,6 +7722,7 @@ class MediaBuyLifecycleCoordinator {
7711
7722
  return this.adaptProjectedResult(result, this.makeReport(this.lifecycle, ["get_media_buys"], []), (data) => data);
7712
7723
  }
7713
7724
  async getMediaBuyDelivery(params, inputHandler, options) {
7725
+ options = snapshotCompatibilityTaskOptions(options);
7714
7726
  this.assertActive("getMediaBuyDelivery");
7715
7727
  if (compareRelease(this.negotiated_version, "3.0") < 0) {
7716
7728
  throw this.unsupported(