@adcp/sdk 17.0.0-beta.0 → 17.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/adapters/keyed-account-store.js +1 -1
- package/dist/lib/adapters/keyed-account-store.mjs +1 -1
- package/dist/lib/adapters/version/3.0/brand-fields.d.mts +7 -1
- package/dist/lib/adapters/version/3.0/brand-fields.d.ts +7 -1
- package/dist/lib/adapters/version/3.0/brand-fields.js +139 -3
- package/dist/lib/adapters/version/3.0/brand-fields.mjs +136 -2
- package/dist/lib/adapters/version/3.0/index.js +6 -0
- package/dist/lib/adapters/version/3.0/index.mjs +7 -1
- package/dist/lib/adapters/version/3.1/bidding.js +1 -1
- package/dist/lib/adapters/version/3.1/bidding.mjs +1 -1
- package/dist/lib/adapters/version/types.d.mts +5 -0
- package/dist/lib/adapters/version/types.d.ts +5 -0
- package/dist/lib/canonical-references/index.js +2 -0
- package/dist/lib/canonical-references/index.mjs +2 -0
- package/dist/lib/client/account-changes.d.mts +3 -1
- package/dist/lib/client/account-changes.d.ts +3 -1
- package/dist/lib/client/account-changes.js +22 -2
- package/dist/lib/client/account-changes.mjs +22 -2
- package/dist/lib/conformance/oracle.js +3 -2
- package/dist/lib/conformance/oracle.mjs +3 -2
- package/dist/lib/core/AgentClient.d.mts +165 -1
- package/dist/lib/core/AgentClient.d.ts +165 -1
- package/dist/lib/core/AgentClient.js +446 -8
- package/dist/lib/core/AgentClient.mjs +446 -8
- package/dist/lib/core/ConversationTypes.d.mts +8 -0
- package/dist/lib/core/ConversationTypes.d.ts +8 -0
- package/dist/lib/core/ProtocolResponseParser.d.mts +1 -1
- package/dist/lib/core/ProtocolResponseParser.d.ts +1 -1
- package/dist/lib/core/ProtocolResponseParser.js +28 -18
- package/dist/lib/core/ProtocolResponseParser.mjs +11 -1
- package/dist/lib/core/ResponseValidator.js +1 -1
- package/dist/lib/core/ResponseValidator.mjs +1 -1
- package/dist/lib/core/SingleAgentClient.d.mts +122 -7
- package/dist/lib/core/SingleAgentClient.d.ts +122 -7
- package/dist/lib/core/SingleAgentClient.js +601 -96
- package/dist/lib/core/SingleAgentClient.mjs +590 -84
- package/dist/lib/core/TaskExecutor.d.mts +7 -0
- package/dist/lib/core/TaskExecutor.d.ts +7 -0
- package/dist/lib/core/TaskExecutor.js +23 -8
- package/dist/lib/core/TaskExecutor.mjs +23 -8
- package/dist/lib/core/task-status.d.mts +2 -0
- package/dist/lib/core/task-status.d.ts +2 -0
- package/dist/lib/core/task-status.js +11 -2
- package/dist/lib/core/task-status.mjs +9 -1
- package/dist/lib/errors/index.d.mts +22 -0
- package/dist/lib/errors/index.d.ts +22 -0
- package/dist/lib/errors/index.js +43 -0
- package/dist/lib/errors/index.mjs +42 -0
- package/dist/lib/identity-3.3/trust.d.mts +1 -4
- package/dist/lib/identity-3.3/trust.d.ts +1 -4
- package/dist/lib/identity-3.3/trust.js +34 -21
- package/dist/lib/identity-3.3/trust.mjs +34 -21
- package/dist/lib/identity-3.3/validation.js +5 -3
- package/dist/lib/identity-3.3/validation.mjs +6 -4
- package/dist/lib/index.d.mts +7 -53
- package/dist/lib/index.d.ts +7 -53
- package/dist/lib/index.js +13 -0
- package/dist/lib/index.mjs +9 -0
- package/dist/lib/media-buy/compatibility.js +6 -1
- package/dist/lib/media-buy/compatibility.mjs +6 -1
- package/dist/lib/protocols/mcp-modern.d.mts +2 -0
- package/dist/lib/protocols/mcp-modern.d.ts +2 -0
- package/dist/lib/protocols/mcp-modern.js +31 -5
- package/dist/lib/protocols/mcp-modern.mjs +31 -5
- package/dist/lib/protocols/mcp-scope.d.mts +6 -1
- package/dist/lib/protocols/mcp-scope.d.ts +6 -1
- package/dist/lib/protocols/mcp-scope.js +25 -3
- package/dist/lib/protocols/mcp-scope.mjs +24 -3
- package/dist/lib/protocols/mcp.js +12 -6
- package/dist/lib/protocols/mcp.mjs +13 -6
- package/dist/lib/reporting/inspection.js +1 -0
- package/dist/lib/reporting/inspection.mjs +1 -0
- package/dist/lib/reporting/ledger/coverage.d.mts +5 -0
- package/dist/lib/reporting/ledger/coverage.d.ts +5 -0
- package/dist/lib/reporting/ledger/coverage.js +37 -3
- package/dist/lib/reporting/ledger/coverage.mjs +36 -3
- package/dist/lib/reporting/ledger/handler.js +7 -4
- package/dist/lib/reporting/ledger/handler.mjs +7 -4
- package/dist/lib/reporting/ledger/producer.js +215 -69
- package/dist/lib/reporting/ledger/producer.mjs +217 -70
- package/dist/lib/reporting/ledger/schedule.d.mts +2 -2
- package/dist/lib/reporting/ledger/schedule.d.ts +2 -2
- package/dist/lib/reporting/ledger/schedule.js +8 -5
- package/dist/lib/reporting/ledger/schedule.mjs +8 -5
- package/dist/lib/reporting/ledger/status-ingest.d.mts +1 -1
- package/dist/lib/reporting/ledger/status-ingest.d.ts +1 -1
- package/dist/lib/reporting/ledger/status-ingest.js +4 -3
- package/dist/lib/reporting/ledger/status-ingest.mjs +4 -3
- package/dist/lib/reporting/ledger/types.d.mts +36 -1
- package/dist/lib/reporting/ledger/types.d.ts +36 -1
- package/dist/lib/reporting/service/index.d.mts +14 -1
- package/dist/lib/reporting/service/index.d.ts +14 -1
- package/dist/lib/reporting/service/index.js +24 -12
- package/dist/lib/reporting/service/index.mjs +24 -12
- package/dist/lib/schemas/browser.d.mts +2 -0
- package/dist/lib/schemas/browser.d.ts +2 -0
- package/dist/lib/schemas/browser.js +3 -0
- package/dist/lib/schemas/browser.mjs +2 -0
- package/dist/lib/schemas/index.d.mts +5 -3
- package/dist/lib/schemas/index.d.ts +5 -3
- package/dist/lib/schemas/index.js +5 -0
- package/dist/lib/schemas/index.mjs +4 -0
- package/dist/lib/server/account-response-identity.d.mts +17 -0
- package/dist/lib/server/account-response-identity.d.ts +17 -0
- package/dist/lib/server/account-response-identity.js +52 -0
- package/dist/lib/server/account-response-identity.mjs +28 -0
- package/dist/lib/server/account-sync-contract.js +2 -2
- package/dist/lib/server/account-sync-contract.mjs +2 -2
- package/dist/lib/server/create-adcp-server.js +33 -20
- package/dist/lib/server/create-adcp-server.mjs +36 -12
- package/dist/lib/server/decisioning/account.d.mts +36 -10
- package/dist/lib/server/decisioning/account.d.ts +36 -10
- package/dist/lib/server/decisioning/account.js +33 -14
- package/dist/lib/server/decisioning/account.mjs +33 -14
- package/dist/lib/server/decisioning/runtime/from-platform.d.mts +5 -5
- package/dist/lib/server/decisioning/runtime/from-platform.d.ts +5 -5
- package/dist/lib/server/decisioning/runtime/from-platform.js +4 -4
- package/dist/lib/server/decisioning/runtime/from-platform.mjs +4 -4
- package/dist/lib/server/media-buy-store.d.mts +26 -12
- package/dist/lib/server/media-buy-store.d.ts +26 -12
- package/dist/lib/server/media-buy-store.js +69 -21
- package/dist/lib/server/media-buy-store.mjs +69 -21
- package/dist/lib/server/notification-subscriptions/runtime.d.mts +1 -1
- package/dist/lib/server/notification-subscriptions/runtime.d.ts +1 -1
- package/dist/lib/server/notification-subscriptions/runtime.js +4 -0
- package/dist/lib/server/notification-subscriptions/runtime.mjs +4 -0
- package/dist/lib/server/responses.js +9 -1
- package/dist/lib/server/responses.mjs +9 -1
- package/dist/lib/signing/agent-fetch.d.mts +1 -1
- package/dist/lib/signing/agent-fetch.d.ts +1 -1
- package/dist/lib/signing/agent-fetch.js +3 -3
- package/dist/lib/signing/agent-fetch.mjs +3 -3
- package/dist/lib/testing/client.d.mts +1 -0
- package/dist/lib/testing/client.d.ts +1 -0
- package/dist/lib/testing/client.js +6 -5
- package/dist/lib/testing/client.mjs +6 -5
- package/dist/lib/testing/storyboard/agent-routing.d.mts +5 -2
- package/dist/lib/testing/storyboard/agent-routing.d.ts +5 -2
- package/dist/lib/testing/storyboard/agent-routing.js +11 -4
- package/dist/lib/testing/storyboard/agent-routing.mjs +11 -4
- package/dist/lib/testing/storyboard/canonical-format-satisfaction.js +60 -14
- package/dist/lib/testing/storyboard/canonical-format-satisfaction.mjs +60 -14
- package/dist/lib/testing/storyboard/compliance.d.mts +2 -5
- package/dist/lib/testing/storyboard/compliance.d.ts +2 -5
- package/dist/lib/testing/storyboard/compliance.js +62 -13
- package/dist/lib/testing/storyboard/compliance.mjs +63 -14
- package/dist/lib/testing/storyboard/context.d.mts +13 -3
- package/dist/lib/testing/storyboard/context.d.ts +13 -3
- package/dist/lib/testing/storyboard/context.js +15 -10
- package/dist/lib/testing/storyboard/context.mjs +15 -10
- package/dist/lib/testing/storyboard/request-signing/vector-loader.d.mts +2 -0
- package/dist/lib/testing/storyboard/request-signing/vector-loader.d.ts +2 -0
- package/dist/lib/testing/storyboard/request-signing/vector-loader.js +11 -0
- package/dist/lib/testing/storyboard/request-signing/vector-loader.mjs +10 -0
- package/dist/lib/testing/storyboard/runner.js +141 -13
- package/dist/lib/testing/storyboard/runner.mjs +141 -13
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/testing/storyboard/validations.js +4 -1
- package/dist/lib/testing/storyboard/validations.mjs +4 -1
- package/dist/lib/testing/test-controller.js +3 -0
- package/dist/lib/testing/test-controller.mjs +3 -0
- package/dist/lib/types/accept-proposal.d.ts +20 -28
- package/dist/lib/types/asset-instances.d.mts +1 -1
- package/dist/lib/types/asset-instances.d.ts +1 -1
- package/dist/lib/types/buy-products.d.ts +20 -28
- package/dist/lib/types/check-governance.d.ts +20 -28
- package/dist/lib/types/comply-test-controller.d.ts +20 -28
- package/dist/lib/types/control-media-buy.d.ts +20 -28
- package/dist/lib/types/core.generated.d.mts +273 -184
- package/dist/lib/types/core.generated.d.ts +273 -184
- package/dist/lib/types/create-media-buy.d.ts +20 -28
- package/dist/lib/types/get-media-buys.d.ts +20 -28
- package/dist/lib/types/get-products.d.ts +20 -28
- package/dist/lib/types/index.d.mts +6 -1
- package/dist/lib/types/index.d.ts +6 -1
- package/dist/lib/types/index.js +6 -1
- package/dist/lib/types/index.mjs +4 -1
- package/dist/lib/types/inline-enums.generated.d.mts +30 -4
- package/dist/lib/types/inline-enums.generated.d.ts +30 -4
- package/dist/lib/types/inline-enums.generated.js +41 -2
- package/dist/lib/types/inline-enums.generated.mjs +28 -2
- package/dist/lib/types/list-products.d.ts +20 -28
- package/dist/lib/types/list-proposals.d.ts +20 -28
- package/dist/lib/types/media-buy-delivery-report.d.mts +6 -0
- package/dist/lib/types/media-buy-delivery-report.d.ts +6 -0
- package/dist/lib/types/media-buy-delivery-report.js +16 -0
- package/dist/lib/types/media-buy-delivery-report.mjs +0 -0
- package/dist/lib/types/refine-proposals.d.ts +20 -28
- package/dist/lib/types/request-proposals.d.ts +20 -28
- package/dist/lib/types/schemas.generated.d.ts +63113 -127273
- package/dist/lib/types/schemas.generated.js +759 -770
- package/dist/lib/types/schemas.generated.mjs +759 -770
- package/dist/lib/types/targeting-keys.generated.d.mts +4 -0
- package/dist/lib/types/targeting-keys.generated.d.ts +4 -0
- package/dist/lib/types/targeting-keys.generated.js +109 -0
- package/dist/lib/types/targeting-keys.generated.mjs +84 -0
- package/dist/lib/types/tools.generated.d.mts +2 -68
- package/dist/lib/types/tools.generated.d.ts +2 -68
- package/dist/lib/types/update-media-buy.d.ts +20 -28
- package/dist/lib/utils/adcp-version-config.js +5 -2
- package/dist/lib/utils/adcp-version-config.mjs +5 -2
- package/dist/lib/utils/envelope-status-compat.d.mts +18 -1
- package/dist/lib/utils/envelope-status-compat.d.ts +18 -1
- package/dist/lib/utils/envelope-status-compat.js +11 -5
- package/dist/lib/utils/envelope-status-compat.mjs +11 -5
- package/dist/lib/utils/response-unwrapper.js +18 -10
- package/dist/lib/utils/response-unwrapper.mjs +18 -10
- package/dist/lib/v2/format-schema/resolver.js +1 -1
- package/dist/lib/v2/format-schema/resolver.mjs +1 -1
- package/dist/lib/v2/projection/creative-delivery.js +159 -39
- package/dist/lib/v2/projection/creative-delivery.mjs +163 -39
- package/dist/lib/v2/projection/index.d.mts +1 -0
- package/dist/lib/v2/projection/index.d.ts +1 -0
- package/dist/lib/v2/projection/index.js +3 -0
- package/dist/lib/v2/projection/index.mjs +2 -0
- package/dist/lib/v2/projection/legacy-metadata.d.mts +19 -0
- package/dist/lib/v2/projection/legacy-metadata.d.ts +19 -0
- package/dist/lib/v2/projection/legacy-metadata.js +91 -0
- package/dist/lib/v2/projection/legacy-metadata.mjs +86 -0
- package/dist/lib/v2/projection/v1-to-v2.d.mts +1 -1
- package/dist/lib/v2/projection/v1-to-v2.d.ts +1 -1
- package/dist/lib/v2/projection/v1-to-v2.js +12 -9
- package/dist/lib/v2/projection/v1-to-v2.mjs +12 -9
- package/dist/lib/validation/budget-allocation.d.mts +3 -3
- package/dist/lib/validation/budget-allocation.d.ts +3 -3
- package/dist/lib/validation/compact-schema.d.mts +27 -0
- package/dist/lib/validation/compact-schema.d.ts +27 -0
- package/dist/lib/validation/compact-schema.js +276 -0
- package/dist/lib/validation/compact-schema.mjs +250 -0
- package/dist/lib/validation/media-buy-delivery-report.d.mts +8 -0
- package/dist/lib/validation/media-buy-delivery-report.d.ts +8 -0
- package/dist/lib/validation/media-buy-delivery-report.js +31 -0
- package/dist/lib/validation/media-buy-delivery-report.mjs +7 -0
- package/dist/lib/validation/nonempty-array.d.mts +15 -0
- package/dist/lib/validation/nonempty-array.d.ts +15 -0
- package/dist/lib/validation/nonempty-array.js +41 -0
- package/dist/lib/validation/nonempty-array.mjs +7 -0
- package/dist/lib/validation/schema-diagnostic-origins.d.mts +21 -0
- package/dist/lib/validation/schema-diagnostic-origins.d.ts +21 -0
- package/dist/lib/validation/schema-diagnostic-origins.js +193 -0
- package/dist/lib/validation/schema-diagnostic-origins.mjs +169 -0
- package/dist/lib/validation/schema-loader.js +86 -16
- package/dist/lib/validation/schema-loader.mjs +82 -16
- package/dist/lib/validation/schema-validator.d.mts +10 -19
- package/dist/lib/validation/schema-validator.d.ts +10 -19
- package/dist/lib/validation/schema-validator.js +136 -43
- package/dist/lib/validation/schema-validator.mjs +140 -44
- package/dist/lib/validation/sync-creatives.d.mts +22 -22
- package/dist/lib/validation/sync-creatives.d.ts +22 -22
- package/dist/lib/version.d.mts +3 -3
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/dist/lib/version.mjs +3 -3
- package/dist/lib/webhooks/index.d.mts +3 -0
- package/dist/lib/webhooks/index.d.ts +3 -0
- package/dist/lib/webhooks/index.js +3 -0
- package/dist/lib/webhooks/index.mjs +2 -0
- package/dist/lib/webhooks/media-buy-delivery.d.mts +43 -0
- package/dist/lib/webhooks/media-buy-delivery.d.ts +43 -0
- package/dist/lib/webhooks/media-buy-delivery.js +119 -0
- package/dist/lib/webhooks/media-buy-delivery.mjs +94 -0
- package/docs/TYPE-SUMMARY.md +2 -2
- package/docs/guides/COLLECTION-FIXTURE-FOUNDATION.md +11 -0
- package/docs/guides/DELIVERY-WEBHOOK-PARSING.md +142 -0
- package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +27 -1
- package/docs/guides/REPORTING-LEDGER.md +93 -0
- package/docs/guides/REPORTING-STABILITY.md +1 -1
- package/docs/guides/TYPED-CLIENT-TOOLS.md +49 -0
- package/docs/llms.txt +2 -2
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/docs/migration-16-to-17.md +202 -2
- package/docs/migration-6.6-to-6.7.md +14 -0
- package/docs/migration-account-change-feed.md +15 -0
- package/docs/migration-reporting-storage-package.md +1 -1
- package/docs/recipes/verifying-inbound-webhooks.md +18 -2
- package/package.json +2 -2
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { TextDecoder } from "node:util";
|
|
2
|
+
import { assertAccountChangeJsonSize } from "../client/account-change-json.mjs";
|
|
3
|
+
import { ConfigurationError } from "../errors/index.mjs";
|
|
4
|
+
import { isPre31AdcpVersion, resolveAdcpVersion } from "../utils/adcp-version-config.mjs";
|
|
5
|
+
import { getMediaBuyDeliveryEnvelopeValidator, getSchemaValidatorByRef } from "../validation/schema-loader.mjs";
|
|
6
|
+
const MAX_BODY_BYTES = 16 * 1024 * 1024;
|
|
7
|
+
const ENVELOPE_FIELDS = ["result", "task_type", "task_id", "operation_id", "idempotency_key", "timestamp"];
|
|
8
|
+
function prepareMediaBuyDeliveryWebhookValidation(version) {
|
|
9
|
+
const adcpVersion = resolveAdcpVersion(version);
|
|
10
|
+
const validateEnvelope = getMediaBuyDeliveryEnvelopeValidator(adcpVersion);
|
|
11
|
+
const validateResult = getSchemaValidatorByRef(
|
|
12
|
+
isPre31AdcpVersion(adcpVersion) ? "media-buy/get-media-buy-delivery-response.json" : "media-buy/media-buy-delivery-webhook-result.json",
|
|
13
|
+
adcpVersion
|
|
14
|
+
);
|
|
15
|
+
if (!validateEnvelope || !validateResult) {
|
|
16
|
+
throw new ConfigurationError("Bundled delivery webhook schemas are unavailable.", "adcpVersion");
|
|
17
|
+
}
|
|
18
|
+
return { adcpVersion, validateEnvelope, validateResult };
|
|
19
|
+
}
|
|
20
|
+
function parseMediaBuyDeliveryWebhook(body, options = {}) {
|
|
21
|
+
const { adcpVersion, validateEnvelope, validateResult } = prepareMediaBuyDeliveryWebhookValidation(
|
|
22
|
+
options.adcpVersion
|
|
23
|
+
);
|
|
24
|
+
let parsed;
|
|
25
|
+
try {
|
|
26
|
+
if (typeof body === "string" || body instanceof Uint8Array) {
|
|
27
|
+
if ((typeof body === "string" ? Buffer.byteLength(body) : body.byteLength) > MAX_BODY_BYTES) {
|
|
28
|
+
throw new Error("Body is too large");
|
|
29
|
+
}
|
|
30
|
+
parsed = JSON.parse(
|
|
31
|
+
typeof body === "string" ? body : new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(body)
|
|
32
|
+
);
|
|
33
|
+
} else {
|
|
34
|
+
parsed = body;
|
|
35
|
+
}
|
|
36
|
+
assertAccountChangeJsonSize(parsed, MAX_BODY_BYTES);
|
|
37
|
+
parsed = structuredClone(parsed);
|
|
38
|
+
} catch {
|
|
39
|
+
return failure("webhook_envelope_invalid", [
|
|
40
|
+
"Webhook body must be valid JSON within 16 MiB and 64 nesting levels."
|
|
41
|
+
]);
|
|
42
|
+
}
|
|
43
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
44
|
+
return failure("webhook_envelope_invalid", ["Webhook body must be an object."]);
|
|
45
|
+
}
|
|
46
|
+
const envelope = parsed;
|
|
47
|
+
const bare = Object.hasOwn(envelope, "media_buy_deliveries") && !ENVELOPE_FIELDS.some((field) => Object.hasOwn(envelope, field));
|
|
48
|
+
if (bare && options.acceptBareDeliveryReport !== true) {
|
|
49
|
+
return failure("webhook_unsupported_payload", [
|
|
50
|
+
"Bare delivery reports require acceptBareDeliveryReport: true; the default expects an MCP envelope with result."
|
|
51
|
+
]);
|
|
52
|
+
}
|
|
53
|
+
if (!bare) {
|
|
54
|
+
if (typeof envelope.task_type === "string" && envelope.task_type !== "media_buy_delivery") {
|
|
55
|
+
return failure("webhook_unsupported_payload", ["task_type must be media_buy_delivery."]);
|
|
56
|
+
}
|
|
57
|
+
if (!validateEnvelope(envelope)) return failure("webhook_envelope_invalid", diagnostics(validateEnvelope.errors));
|
|
58
|
+
}
|
|
59
|
+
const result = bare ? envelope : envelope.result;
|
|
60
|
+
if (!validateResult(result))
|
|
61
|
+
return failure("webhook_result_invalid", diagnostics(validateResult.errors, bare ? "" : "result"));
|
|
62
|
+
if (bare)
|
|
63
|
+
return { ok: true, wireFormat: "bare_delivery_report", adcpVersion, result };
|
|
64
|
+
return {
|
|
65
|
+
ok: true,
|
|
66
|
+
wireFormat: "mcp_envelope",
|
|
67
|
+
adcpVersion,
|
|
68
|
+
envelope,
|
|
69
|
+
result
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function failure(code, errors) {
|
|
73
|
+
return { ok: false, code, message: errors.join("; "), errors };
|
|
74
|
+
}
|
|
75
|
+
function diagnostics(errors, prefix = "") {
|
|
76
|
+
if (!errors?.length) return [`${prefix || "body"} is invalid`];
|
|
77
|
+
return errors.slice(0, 20).map((error) => {
|
|
78
|
+
const fields = error.instancePath.split("/").slice(1).map((field) => field.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
79
|
+
if (error.keyword === "required" && typeof error.params.missingProperty === "string")
|
|
80
|
+
fields.push(error.params.missingProperty);
|
|
81
|
+
if (error.keyword === "additionalProperties" && typeof error.params.additionalProperty === "string")
|
|
82
|
+
fields.push(error.params.additionalProperty);
|
|
83
|
+
let path = prefix;
|
|
84
|
+
for (const field of fields) {
|
|
85
|
+
const bounded = field.length > 80 ? field.slice(0, 80) + "\u2026" : field;
|
|
86
|
+
path += /^(0|[1-9][0-9]*)$/.test(bounded) ? `[${bounded}]` : /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(bounded) ? `${path ? "." : ""}${bounded}` : `[${JSON.stringify(bounded)}]`;
|
|
87
|
+
}
|
|
88
|
+
return `${path || "body"} ${error.keyword === "required" ? "is required" : error.message ?? "is invalid"}`;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
export {
|
|
92
|
+
parseMediaBuyDeliveryWebhook,
|
|
93
|
+
prepareMediaBuyDeliveryWebhookValidation
|
|
94
|
+
};
|
package/docs/TYPE-SUMMARY.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# AdCP Type Summary
|
|
2
2
|
|
|
3
|
-
> Generated at: 2026-10-
|
|
4
|
-
> @adcp/sdk v17.0.0-beta.
|
|
3
|
+
> Generated at: 2026-10-27
|
|
4
|
+
> @adcp/sdk v17.0.0-beta.2
|
|
5
5
|
|
|
6
6
|
Curated reference of the types that matter for using the AdCP client. For full generated types see `src/lib/types/tools.generated.ts` and `src/lib/types/core.generated.ts`.
|
|
7
7
|
|
|
@@ -562,6 +562,17 @@ guarantees:
|
|
|
562
562
|
retain their host-owned identity. A drift refusal after contact cannot undo
|
|
563
563
|
earlier calls; their evidence goes only to the private audit sink.
|
|
564
564
|
|
|
565
|
+
After authorization and capability discovery, preparation evaluates the same
|
|
566
|
+
root `requires_capability`, `requires_all_capabilities`, `required_any_of_tools`,
|
|
567
|
+
and `required_tools` applicability gates as execution. `required_tools` accepts
|
|
568
|
+
any listed tool; every `required_any_of_tools` family must have a match.
|
|
569
|
+
Routed preparation unions advertised tools across routes. Root capability
|
|
570
|
+
predicates belong to `default_agent` when set; otherwise each selected step
|
|
571
|
+
route is evaluated separately, and preparation skips only when all decline.
|
|
572
|
+
Unmet gates return `status: 'unsupported', reason: 'not_applicable'` with a
|
|
573
|
+
discovery phase before any catalog read or controller seeding. Hosts can pass
|
|
574
|
+
the preparation authorizer directly without doing their own discovery first.
|
|
575
|
+
|
|
565
576
|
The existing `PreparedFixturesLookup.binding` stays required and its gate
|
|
566
577
|
union stays `run | pass | step`. Existing reuse authorizers need no migration.
|
|
567
578
|
A host can explicitly share one implementation between the two options:
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Parsing media-buy delivery webhooks
|
|
2
|
+
|
|
3
|
+
Use `parseMediaBuyDeliveryWebhook` from `@adcp/sdk/webhooks` after your receiver
|
|
4
|
+
has authenticated the original HTTP body and enforced replay protection. It
|
|
5
|
+
validates delivery content without requiring an `AgentClient`, an SDK callback
|
|
6
|
+
registry, or a signature-verification strategy. It performs no authentication
|
|
7
|
+
itself; `ok: true` means the payload is valid, not that its sender is trusted.
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { parseMediaBuyDeliveryWebhook } from '@adcp/sdk/webhooks';
|
|
11
|
+
|
|
12
|
+
// Call only after signature verification. Load the version from the registered
|
|
13
|
+
// seller/buy record, rather than trusting a version claim in the request body.
|
|
14
|
+
function parseAuthenticatedDelivery(verifiedRawBody: Uint8Array, negotiatedVersion: string) {
|
|
15
|
+
const parsed = parseMediaBuyDeliveryWebhook(verifiedRawBody, {
|
|
16
|
+
adcpVersion: negotiatedVersion,
|
|
17
|
+
});
|
|
18
|
+
if (!parsed.ok) {
|
|
19
|
+
// Suitable for a 400 response: paths are readable and omit report values (map key names can appear in paths).
|
|
20
|
+
// e.g. result.media_buy_deliveries[0].by_package is required
|
|
21
|
+
return { status: 400, error: parsed.message, errors: parsed.errors };
|
|
22
|
+
}
|
|
23
|
+
return { status: 200, report: parsed.result };
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Pass the exact bytes you authenticated to avoid parsing a different body from
|
|
28
|
+
JSON middleware. The parser also accepts a parsed JSON object or a JSON string. It returns
|
|
29
|
+
a detached copy of validated data and preserves the seller's fields. It does
|
|
30
|
+
not add a task status, operation ID, currency, package breakdown, or other
|
|
31
|
+
missing data. Bodies are limited to 16 MiB and 64 nesting levels before schema
|
|
32
|
+
validation. Schema diagnostics use fail-fast validation and readable paths.
|
|
33
|
+
Invalid bodies return one of:
|
|
34
|
+
|
|
35
|
+
| Code | Meaning |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| `webhook_envelope_invalid` | Malformed JSON, invalid envelope metadata, or a missing result. |
|
|
38
|
+
| `webhook_result_invalid` | The nested delivery report fails the selected release's schema. |
|
|
39
|
+
| `webhook_unsupported_payload` | Another task type, or an unenveloped report without explicit opt-in. |
|
|
40
|
+
|
|
41
|
+
An invalid or unbundled `adcpVersion` is a caller configuration error and throws
|
|
42
|
+
`ConfigurationError`. Omission selects the SDK's protocol pin. The body does not
|
|
43
|
+
select its own validation release.
|
|
44
|
+
|
|
45
|
+
## Select the release used for the buy
|
|
46
|
+
|
|
47
|
+
A reporting webhook does not provide a trustworthy negotiated-version field.
|
|
48
|
+
Keep that release with the callback/buy registration and supply it for every
|
|
49
|
+
report. Stable patch pins select their bundled minor contract; preview pins
|
|
50
|
+
remain exact.
|
|
51
|
+
|
|
52
|
+
| Release | Report validation | Envelope details |
|
|
53
|
+
| --- | --- | --- |
|
|
54
|
+
| 3.0 | `get-media-buy-delivery-response.json`; report-wide currency is required. | `operation_id` is optional and remains absent when omitted. The parser accepts the documented `media_buy_delivery` discriminator even though the old task enum omits it. |
|
|
55
|
+
| 3.1 | `media-buy-delivery-webhook-result.json`; report-wide currency is required. | `operation_id` is required. |
|
|
56
|
+
| 3.2 | Dedicated webhook-result schema; report-wide currency is optional. | `operation_id` is required. |
|
|
57
|
+
| 3.3 beta | Exact bundled beta webhook-result schema; report-wide currency is optional. | `operation_id` is required. |
|
|
58
|
+
|
|
59
|
+
All releases require `by_package` on each delivery row. The SDK's schema loader
|
|
60
|
+
handles both relative and absolute schema IDs. No external `$ref` traversal or
|
|
61
|
+
network fetch is needed.
|
|
62
|
+
|
|
63
|
+
The registered reporting-delivery branch of `verifyAndParseWebhook` uses this
|
|
64
|
+
same parser after authentication. Its new `adcpVersion` request option selects
|
|
65
|
+
the stored seller/buy release; omission retains the client's configured pin.
|
|
66
|
+
This option changes payload validation only, not signature policy or trusted
|
|
67
|
+
sender/route selection. Schema configuration is prepared before nonce consumption;
|
|
68
|
+
invalid receiver configuration returns `webhook_verification_unavailable`.
|
|
69
|
+
Routing `metadata.operationId` always comes from the trusted registration;
|
|
70
|
+
the seller's original `operation_id` remains in the envelope. Existing legacy task-webhook normalization remains a
|
|
71
|
+
separate compatibility path.
|
|
72
|
+
|
|
73
|
+
## Bare-report compatibility is explicit
|
|
74
|
+
|
|
75
|
+
The default rejects a body with top-level `media_buy_deliveries` and no MCP
|
|
76
|
+
envelope. For a temporary migration, opt in explicitly:
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
const parsed = parseMediaBuyDeliveryWebhook(verifiedRawBody, {
|
|
80
|
+
adcpVersion: savedBuy.adcpVersion,
|
|
81
|
+
acceptBareDeliveryReport: true,
|
|
82
|
+
});
|
|
83
|
+
if (parsed.ok && parsed.wireFormat === 'bare_delivery_report') {
|
|
84
|
+
// Record the seller's protocol violation and repair its callback format.
|
|
85
|
+
// parsed.envelope is undefined; no transport identity has been invented.
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The report still undergoes release-specific validation. A poll-shaped report
|
|
90
|
+
with only a task `status` and no envelope identity is also bare; any such field
|
|
91
|
+
is preserved when the selected report schema permits it. An incomplete or invalid
|
|
92
|
+
envelope never falls back to bare-report acceptance. A normal envelope returns
|
|
93
|
+
`wireFormat: 'mcp_envelope'` and the validated `envelope`. Authentication and
|
|
94
|
+
sender, account, media-buy authorization, and deduplication remain the receiver's
|
|
95
|
+
responsibility in either format.
|
|
96
|
+
|
|
97
|
+
## A shared delivery body for polling and pushing
|
|
98
|
+
|
|
99
|
+
`MediaBuyDeliveryReport` imports from `@adcp/sdk/types` or `@adcp/sdk/webhooks`.
|
|
100
|
+
`MediaBuyDeliveryReportSchema` imports from `@adcp/sdk/schemas` and
|
|
101
|
+
`@adcp/sdk/schemas/browser`. This payload-only shape accepts a polled report or a
|
|
102
|
+
webhook result without requiring a task-level `status`. The shared TypeScript type and these Zod schemas describe
|
|
103
|
+
the SDK's current pin; use the parser above for older release-specific checks.
|
|
104
|
+
|
|
105
|
+
`GetMediaBuyDeliveryResponseSchema` still requires task status through its
|
|
106
|
+
referenced `core/protocol-envelope.json`. The absence of `status` from the
|
|
107
|
+
response document's own `required` list does not remove that inherited
|
|
108
|
+
requirement. Use the shared body schema for ingestion, and the full response
|
|
109
|
+
schema for a poll's protocol envelope. `MediaBuyDeliveryWebhookResultSchema`
|
|
110
|
+
now retains the canonical required row fields, including `by_package`.
|
|
111
|
+
|
|
112
|
+
## Envelope status and notification type are independent
|
|
113
|
+
|
|
114
|
+
The parser accepts the selected release's task-status enum; it does not require
|
|
115
|
+
`completed` for all reporting messages. For example, `notification_type:
|
|
116
|
+
'delayed'` may accompany `status: 'working'` when a valid report is present.
|
|
117
|
+
`delayed` itself is not a task status. A progress-only message without a report
|
|
118
|
+
is not a delivery-data webhook.
|
|
119
|
+
|
|
120
|
+
`notification_type: 'final'` concerns report scheduling; envelope `completed`
|
|
121
|
+
does not mean the media buy has finished. Per-buy state remains in
|
|
122
|
+
`media_buy_deliveries[].status`. This follows the protocol's
|
|
123
|
+
[envelope/result distinction](https://github.com/adcontextprotocol/adcp/blob/v3.3.0-beta.0/docs/building/by-layer/L3/webhooks.mdx#payload-anatomy-envelope-vs-result).
|
|
124
|
+
|
|
125
|
+
The protocol also requires receivers to ignore `aggregated_totals` in pushed
|
|
126
|
+
reports as an authority source. The parser preserves that field for auditing
|
|
127
|
+
when supplied; reconcile authoritative totals through a poll or per-delivery
|
|
128
|
+
rows instead.
|
|
129
|
+
|
|
130
|
+
For offline tooling that needs all raw JSON Schema diagnostics,
|
|
131
|
+
`@adcp/sdk/schemas` also exports `getSchemaValidatorByRef`. Its default is
|
|
132
|
+
fail-fast; complete diagnostics are an explicit option:
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
import { getSchemaValidatorByRef } from '@adcp/sdk/schemas';
|
|
136
|
+
const validate = getSchemaValidatorByRef(
|
|
137
|
+
'media-buy/media-buy-delivery-webhook-result.json',
|
|
138
|
+
'3.1',
|
|
139
|
+
undefined,
|
|
140
|
+
{ allErrors: true },
|
|
141
|
+
);
|
|
142
|
+
```
|
|
@@ -115,7 +115,18 @@ const client = new AgentClient(seller, {
|
|
|
115
115
|
|
|
116
116
|
The partition is local configuration. It is hashed into MCP connection, discovery, and signing-policy cache keys and never sent in headers or tool arguments. Keep it stable for the same authorization scope, and use distinct values for different principals even when they share a seller token. Partitions also separate sessions within a single `withMCPConnectionScope` workflow.
|
|
117
117
|
|
|
118
|
-
Outside a connection scope, calls now open and close their own MCP sessions by default. To retain process-wide reuse, provide a nonempty `connectionPartition`, or set `transport: { connectionReuse: 'process' }` when every caller with the same credentials and routing headers represents one principal.
|
|
118
|
+
Outside a connection scope, calls now open and close their own MCP sessions by default. To retain process-wide reuse, provide a nonempty `connectionPartition`, or set `transport: { connectionReuse: 'process' }` when every caller with the same credentials and routing headers represents one principal. Low-level calls with a supplied `trustedFetchFn` continue to use one-shot sessions outside a scope, including with a partition or process opt-in.
|
|
119
|
+
|
|
120
|
+
High-level `SingleAgentClient` task and discovery methods create a scope for
|
|
121
|
+
one operation when the caller has not configured reuse. Endpoint discovery,
|
|
122
|
+
`tools/list`, capability preflight, and dispatch share that operation's sessions,
|
|
123
|
+
which close when it finishes. Caller-owned scopes and explicit process reuse
|
|
124
|
+
keep their existing lifetimes. A supplied `trustedFetchFn` shares sessions
|
|
125
|
+
within this operation scope, including when a principal partition is set;
|
|
126
|
+
it never enables process-wide session reuse. A cold legacy endpoint still needs one v2 era
|
|
127
|
+
classification handshake and one v1 Tasks-capable session; the credential- and
|
|
128
|
+
policy-scoped classification is cached for five minutes, so later operations
|
|
129
|
+
can go straight to their v1 session. Different credentials remain isolated.
|
|
119
130
|
|
|
120
131
|
Successful calls and ordinary errors terminate one-shot sessions. When a call throws because it was cancelled or timed out, the SDK closes its client without sending DELETE, so it does not terminate work still running on the seller; remaining server session state follows the seller's TTL.
|
|
121
132
|
|
|
@@ -162,6 +173,21 @@ Await every operation before the scope callback returns; the callback owns the s
|
|
|
162
173
|
|
|
163
174
|
Inside a scope the endpoint probe, capability discovery, `tools/list` and tool calls share one negotiated session per identity. `closeScopedConnections()` closes the current MCP scope's sessions early and does nothing when no MCP scope is active (A2A connections are not scoped). Nested `withMCPConnectionScope` calls join the outer scope unless you pass `{ isolate: true }`.
|
|
164
175
|
|
|
176
|
+
An implicit high-level task scope closes local transports without sending session
|
|
177
|
+
`DELETE` when its final result is accepted `submitted`, `working`, `input-required`,
|
|
178
|
+
`auth-required`, or `deferred` work. (`deferred` is a task/HITL result, not an MCP
|
|
179
|
+
wire status.) The owning task's final result decides; an earlier nested result
|
|
180
|
+
cannot change a completed owner's cleanup. Completed tasks keep normal session
|
|
181
|
+
termination.
|
|
182
|
+
|
|
183
|
+
An explicit `withMCPConnectionScope` workflow remains caller-owned: its final
|
|
184
|
+
cleanup terminates its sessions even if a call inside returned `submitted` or
|
|
185
|
+
`working`. End that callback only when you intend to relinquish those sessions.
|
|
186
|
+
Implicit preservation means avoiding termination, not retaining a connection for
|
|
187
|
+
resumption: local clients are closed and evicted, later calls open fresh sessions,
|
|
188
|
+
and the seller owns expiration of its retained sessions. A preserved implicit
|
|
189
|
+
scope can include discovery sessions as well as the dispatch session.
|
|
190
|
+
|
|
165
191
|
### One exception: the first legacy handoff
|
|
166
192
|
|
|
167
193
|
For a seller on the pre-2026 MCP protocol era, the SDK negotiates with the v2 client first and then hands the call to the v1 client so 2025 Tasks keep working. That handoff is a cold cost the SDK cannot avoid: the first scope against such a seller opens one classification handshake plus one shared v1 session. Within the scope everything after that (probe aside) shares the v1 session, including `tools/list`, and the classification is remembered across scopes for five minutes, so a later scope opens only its own session. Modern-era sellers need a single negotiation per scope.
|
|
@@ -116,6 +116,99 @@ returned `sourceScope`, then applies the source contract and existing ledger
|
|
|
116
116
|
immutability checks. Return the resulting secret-free configuration state from
|
|
117
117
|
your `sync_accounts` implementation.
|
|
118
118
|
|
|
119
|
+
### Reporting history before installation
|
|
120
|
+
|
|
121
|
+
Trusted host code can grant an account reporting history independently of when
|
|
122
|
+
its configuration was installed. Supply the entitlement in the install context,
|
|
123
|
+
then extend it when the account upgrades:
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
const installed = await reporting.installConfiguration(declaration, {
|
|
127
|
+
account: ctx.account,
|
|
128
|
+
historyStart: accountEntitlement.historyStart, // ISO instant from trusted commercial state
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
await reporting.extendConfigurationHistory({
|
|
132
|
+
configurationId: installed.configurationId,
|
|
133
|
+
historyStart: upgradedEntitlement.historyStart,
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
await reporting.runCycle({
|
|
137
|
+
accountId: ctx.account.id,
|
|
138
|
+
maxHistorySlicesPerSource: 5,
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Without `historyStart`, ownership still starts at the first scheduled boundary
|
|
143
|
+
at or after `max(anchor, installedAt)`. With it, ownership starts at the first
|
|
144
|
+
boundary **at or after the requested instant**, even when that boundary predates
|
|
145
|
+
the anchor. Source-calendar days use source-local boundaries, including 23- and
|
|
146
|
+
25-hour days. The entire historical span is validated against the source's
|
|
147
|
+
window bounds and calendar rules before ownership is accepted.
|
|
148
|
+
|
|
149
|
+
The requested instant must fall within the source offering's rolling
|
|
150
|
+
`retentionDays` window (`now - retentionDays * 24 hours`) and must not be in the
|
|
151
|
+
future. Out-of-range requests are refused, never silently clamped. Instants
|
|
152
|
+
require a timezone and at most millisecond precision. Extension can move the
|
|
153
|
+
aligned boundary earlier or leave it unchanged; it cannot move it later.
|
|
154
|
+
An unchanged replay remains valid as source retention advances.
|
|
155
|
+
|
|
156
|
+
History changes preserve the configuration ID, version, semantic fingerprint,
|
|
157
|
+
real `installedAt`, frozen calendar rules, and existing obligations and
|
|
158
|
+
publications. Reinstalling without a history option returns the current stored
|
|
159
|
+
ownership. A repeated install requesting a later history start also keeps the
|
|
160
|
+
already owned earlier range, so rolling entitlement timestamps do not shrink
|
|
161
|
+
ownership or break replay. Use `extendConfigurationHistory` for an earlier
|
|
162
|
+
boundary. On a successor version, omit `historyStart`; extend the earliest
|
|
163
|
+
relevant stored generation separately when the entitlement grows. History cannot overlap
|
|
164
|
+
another generation's owned periods: extend the earliest relevant generation to
|
|
165
|
+
recover periods before a successor's handoff. Coverage and status count the
|
|
166
|
+
entire continuous owned range, so unplanned closed history counts as a coverage
|
|
167
|
+
gap just like missing live obligations. Run a cycle after install or extension
|
|
168
|
+
to populate it. Public deadlines remain tied to the historical period:
|
|
169
|
+
unpublished periods past their public recovery deadline report `action_required`
|
|
170
|
+
/ `REPORT_OVERDUE`, including period status notifications, until publication
|
|
171
|
+
satisfies them. Recent historical periods retain the normal waiting/delayed
|
|
172
|
+
progression. The private retry
|
|
173
|
+
window controls execution retries and does not postpone buyer-visible deadlines.
|
|
174
|
+
Pausing history intentionally leaves those obligations outstanding. Source
|
|
175
|
+
retention is checked when history is granted; delayed execution may age beyond
|
|
176
|
+
the source's availability, so schedule the oldest slices promptly and leave
|
|
177
|
+
headroom when choosing entitlement boundaries.
|
|
178
|
+
|
|
179
|
+
Planning visits live periods across all configurations before history. Execution
|
|
180
|
+
also claims live work first, including when history is already queued. Each
|
|
181
|
+
worker pass executes at most `maxHistorySlicesPerSource` historical claims per
|
|
182
|
+
source offering, defaulting to **10**; zero pauses history execution. The same
|
|
183
|
+
option is accepted by `start()`. The optional
|
|
184
|
+
`maxHistoryObligationsPerSource` limits historical planning; by default history
|
|
185
|
+
shares the existing `maxObligations` cap (1,000). Zero pauses historical planning.
|
|
186
|
+
Fully plan historical ownership before a tzdb/ICU runtime upgrade, or retain
|
|
187
|
+
a worker with the generation's pinned runtime rules until planning is complete;
|
|
188
|
+
frozen calendar ownership cannot be silently reinterpreted after an upgrade.
|
|
189
|
+
Both budgets include retries, where applicable, and are shared by configurations
|
|
190
|
+
using the same offering within that pass. Scheduler budgets apply to each
|
|
191
|
+
account cycle, and concurrent workers have separate budgets. The adapter or host
|
|
192
|
+
must coordinate any shared upstream API quota across accounts and workers using
|
|
193
|
+
the source's `rateLimitConstraints`; these limits do not implement a distributed
|
|
194
|
+
rate limiter. Initial history requests use the source contract's `backfill`
|
|
195
|
+
trigger; retries use `retry` and receive a durable private retry window from the
|
|
196
|
+
first execution attempt while public deadlines remain period-based.
|
|
197
|
+
|
|
198
|
+
The low-level producer accepts `installConfiguration(input, { historyStart })`
|
|
199
|
+
and exposes the same extension method. A custom ledger store must persist
|
|
200
|
+
`historyStart` and `historyStartOrdinal`, implement atomic
|
|
201
|
+
`extendConfigurationHistory`, enforce newly owned range overlap checks atomically
|
|
202
|
+
at both install and extension, and honor live priority and
|
|
203
|
+
`excludeHistoryOfferingIds` in `claimObligation`. PostgreSQL supplies these
|
|
204
|
+
operations; reapply `REPORTING_LEDGER_MIGRATION` to add its nullable
|
|
205
|
+
`history_start` audit column (mirroring the configuration JSON) and live-priority
|
|
206
|
+
claim indexes before upgrading the workers. Existing rows retain their original
|
|
207
|
+
ownership. Grant or extend history only after every worker has been upgraded;
|
|
208
|
+
older workers cannot honor the new retry windows and pacing contract. For long feeds using the inline source executor, configure
|
|
209
|
+
`inlineReplayRetention` or supply a durable executor so a year of history does
|
|
210
|
+
not exhaust its default 100-slice lifetime scope limit.
|
|
211
|
+
|
|
119
212
|
For tenant-partitioned jobs, call `runCycle({ accountId })`, or configure
|
|
120
213
|
`start({ accountIds: [...] })`. Every planner and worker call receives that
|
|
121
214
|
same account boundary. A deployment-owned worker must explicitly pass
|
|
@@ -21,7 +21,7 @@ This follows how the AdCP protocol treats experimental surfaces (`x-status: expe
|
|
|
21
21
|
|
|
22
22
|
**The storage interfaces in `@adcp/sdk`.** The contract the package implements stays in the SDK, and it changes together with the package, so it is experimental too: the store, transaction, lease, row-read and revision-metadata interfaces in `@adcp/sdk/reporting/ledger` (`ReportingLedgerStore` and the types it uses), `ReportingReceiptSyncStoreV1`, the store-contract error classes (`ReportingLedgerLeaseLostError`, `ReportingLedgerPeriodRetiredError`, `ReportingLedgerContinuityError`) and the row-storage error types. Their TSDoc carries the `@experimental` tag. A breaking change to one ships as a minor of `@adcp/sdk` together with a matching minor of `@adcp/reporting-storage`, and the changesets say which pair to install.
|
|
23
23
|
|
|
24
|
-
**Storage-facing building blocks in `@adcp/sdk`.** A few exports exist so a store can be written against public API only, and they are covered by the same policy even where their TSDoc is silent: the schedule, instant and evidence helpers on `@adcp/sdk/reporting/ledger` (`compareReportingInstants`, `reportingPeriodDate`, `reportingPeriodSchedule`, `isFrozenCalendarRulesMismatch`, the receipt and verification evidence guards, `isWellFormedUnicodeString`, `getReportingDeliveryOfferingValidatorV1`), and the scheduler primitives and `REPORTING_MANAGED_DELIVERY_COMPOSITION_V1` on `@adcp/sdk/reporting/service`. Application code should not depend on them.
|
|
24
|
+
**Storage-facing building blocks in `@adcp/sdk`.** A few exports exist so a store can be written against public API only, and they are covered by the same policy even where their TSDoc is silent: the schedule, instant and evidence helpers on `@adcp/sdk/reporting/ledger` (`compareReportingInstants`, `reportingPeriodDate`, `reportingPeriodSchedule`, `isFrozenCalendarRulesMismatch`, `assertReportingLedgerHistoryDoesNotOverlap`, the receipt and verification evidence guards, `isWellFormedUnicodeString`, `getReportingDeliveryOfferingValidatorV1`), and the scheduler primitives and `REPORTING_MANAGED_DELIVERY_COMPOSITION_V1` on `@adcp/sdk/reporting/service`. Application code should not depend on them.
|
|
25
25
|
|
|
26
26
|
### Not experimental
|
|
27
27
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Typed client tools
|
|
2
|
+
|
|
3
|
+
`SingleAgentClient` and `AgentClient` expose a camelCase method for every tool
|
|
4
|
+
in the bundled AdCP manifest. Each method uses the normal request validation,
|
|
5
|
+
idempotency-key generation, and per-client version negotiation. `executeTask`
|
|
6
|
+
also has typed request and response mappings for every tool.
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
const result = await client.getTaskStatus({ task_id: sellerTaskId, include_result: true });
|
|
10
|
+
if (result.success) console.log(result.data.status, result.data.result);
|
|
11
|
+
|
|
12
|
+
const tasks = await client.listTasks({}); // Queries the seller's list_tasks tool.
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`getTaskStatus({ task_id })` returns the protocol response inside `TaskResult`.
|
|
16
|
+
The observed task's `status` and `error` remain data: querying a failed or working
|
|
17
|
+
task completes the query without resubmitting or following that task.
|
|
18
|
+
|
|
19
|
+
For compatibility, `getTaskStatus(taskId)` still returns mapped `TaskInfo`, and
|
|
20
|
+
`listTasks()` with no arguments still lists locally tracked tasks. Use
|
|
21
|
+
`trackTask()` or a submitted result's `waitForCompletion()` to observe completion.
|
|
22
|
+
The object overload calls `get_task_status` directly and requires a seller that
|
|
23
|
+
supports that tool. Use the string overload or task tracking for negotiated
|
|
24
|
+
compatibility with older sellers.
|
|
25
|
+
The typed response preserves the seller's `task_id`; callers should compare it
|
|
26
|
+
with the requested ID. The string overload and completion tracking enforce that
|
|
27
|
+
identity check automatically. Discovery and authorization failures are surfaced
|
|
28
|
+
rather than treated as evidence that only the legacy tool is supported.
|
|
29
|
+
|
|
30
|
+
SDK polling chooses `get_task_status` when advertised by the seller, falling back
|
|
31
|
+
to `tasks_get` for MCP or `tasks/get` for A2A otherwise.
|
|
32
|
+
|
|
33
|
+
The supported tools `listCreativeFormats`, `buildCreative`, `listTransformers`,
|
|
34
|
+
`getContentStandards`, `listContentStandards`, `calibrateContent`, and
|
|
35
|
+
`validateContentDelivery` have ordinary typed methods. Their existing `*Legacy`
|
|
36
|
+
aliases remain available. These tool methods return their protocol wire shapes;
|
|
37
|
+
the SDK's canonical creative discovery and delivery helpers remain available too.
|
|
38
|
+
On the SDK 16 line these are the AdCP 3.2 wire shapes, including any legacy
|
|
39
|
+
`format_id` fields the protocol still supports. Generic `preview_creative`
|
|
40
|
+
execution uses the canonical preview helper; use `previewCreativeLegacy` for
|
|
41
|
+
raw named-format requests.
|
|
42
|
+
|
|
43
|
+
Direct `SingleAgentClient.syncPlans` and `getPlanAuditLogs` calls use the
|
|
44
|
+
configured governance agent when present. Without one, the client requires its
|
|
45
|
+
own agent to advertise the governance tool before sending the request.
|
|
46
|
+
|
|
47
|
+
`complyTestController` is typed for conformance testing against a seller that
|
|
48
|
+
advertises it. Its availability does not imply that a production seller enables
|
|
49
|
+
test controls.
|
package/docs/llms.txt
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Ad Context Protocol (AdCP)
|
|
2
2
|
|
|
3
|
-
> Generated at: 2026-10-
|
|
4
|
-
> Library: @adcp/sdk v17.0.0-beta.
|
|
3
|
+
> Generated at: 2026-10-27
|
|
4
|
+
> Library: @adcp/sdk v17.0.0-beta.2
|
|
5
5
|
> AdCP major version: 3
|
|
6
6
|
> Canonical URL: https://adcontextprotocol.github.io/adcp-client/llms.txt
|
|
7
7
|
> Note: the `Library` stamp reflects the package.json version at doc-generation time. The narrative below describes the surface that lands on the next-published minor — including any 6.7 helpers documented here ahead of the release tag.
|
|
@@ -16,8 +16,8 @@ pin using `ADCP_VERSION` inside that tarball.
|
|
|
16
16
|
|
|
17
17
|
| Fact | Value |
|
|
18
18
|
| --- | --- |
|
|
19
|
-
| Checkout `package.json` version | `@adcp/sdk@17.0.0-beta.
|
|
20
|
-
| npm integrity | registry-derived after publication; run `npm view @adcp/sdk@17.0.0-beta.
|
|
19
|
+
| Checkout `package.json` version | `@adcp/sdk@17.0.0-beta.2` |
|
|
20
|
+
| npm integrity | registry-derived after publication; run `npm view @adcp/sdk@17.0.0-beta.2 dist.integrity` |
|
|
21
21
|
| Node.js runtime | `^20.19.0 || >=22.12.0` |
|
|
22
22
|
| Default AdCP wire release | `3.3.0-beta.0` |
|
|
23
23
|
| Maintained wire releases | `v3`, `3.0.0`, `3.0`, `3.0.1`, `3.0.2`, `3.0.3`, `3.0.4`, `3.0.5`, `3.0.6`, `3.0.7`, `3.0.8`, `3.0.9`, `3.0.10`, `3.0.11`, `3.0.12`, `3.0.13`, `3.0.14`, `3.0.15`, `3.0.16`, `3.0.17`, `3.0.18`, `3.0.19`, `3.0.20`, `3.0.21`, `3.0.22`, `3.0.23`, `3.0.24`, `3.0.25`, `3.1.0`, `3.1`, `3.1.1`, `3.1.2`, `3.1.3`, `3.1.4`, `3.1.5`, `3.1.6`, `3.1.7`, `3.1.8`, `3.1.9`, `3.1.10`, `3.1.11`, `3.1.12`, `3.1.13`, `3.1.14`, `3.1.15`, `3.1.16`, `3.1.17`, `3.1.18`, `3.1.19`, `3.1.20`, `3.1.21`, `3.1.22`, `3.1.23`, `3.1.24`, `3.1.25`, `3.1.26`, `3.1.27`, `3.1.28`, `3.1.29`, `3.2.1`, `3.2`, `3.2.2`, `3.2.3`, `3.2.4`, `3.2.5`, `3.2.6`, `3.2.7`, `3.3.0-beta.0`, `3.3-beta.0` |
|
|
@@ -26,8 +26,8 @@ pin using `ADCP_VERSION` inside that tarball.
|
|
|
26
26
|
For a checkout at the published release commit, install the exact package version:
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
-
npm install --save-exact '@adcp/sdk@17.0.0-beta.
|
|
30
|
-
npm view '@adcp/sdk@17.0.0-beta.
|
|
29
|
+
npm install --save-exact '@adcp/sdk@17.0.0-beta.2'
|
|
30
|
+
npm view '@adcp/sdk@17.0.0-beta.2' dist.integrity
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
### Required and optional peers
|