@adcp/client 4.21.0 → 4.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +278 -0
- package/README.md +96 -61
- package/bin/adcp.js +342 -4
- package/dist/lib/agents/index.generated.d.ts +9 -1
- package/dist/lib/agents/index.generated.d.ts.map +1 -1
- package/dist/lib/agents/index.generated.js +12 -0
- package/dist/lib/agents/index.generated.js.map +1 -1
- package/dist/lib/core/AgentClient.d.ts.map +1 -1
- package/dist/lib/core/SingleAgentClient.d.ts +2 -1
- package/dist/lib/core/SingleAgentClient.d.ts.map +1 -1
- package/dist/lib/core/SingleAgentClient.js +10 -1
- package/dist/lib/core/SingleAgentClient.js.map +1 -1
- package/dist/lib/discovery/property-crawler.d.ts +4 -0
- package/dist/lib/discovery/property-crawler.d.ts.map +1 -1
- package/dist/lib/discovery/property-crawler.js +10 -2
- package/dist/lib/discovery/property-crawler.js.map +1 -1
- package/dist/lib/index.d.ts +4 -4
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +6 -4
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/protocols/index.d.ts.map +1 -1
- package/dist/lib/protocols/index.js +8 -6
- package/dist/lib/protocols/index.js.map +1 -1
- package/dist/lib/protocols/mcp.d.ts.map +1 -1
- package/dist/lib/protocols/mcp.js +24 -11
- package/dist/lib/protocols/mcp.js.map +1 -1
- package/dist/lib/server/index.d.ts +2 -0
- package/dist/lib/server/index.d.ts.map +1 -1
- package/dist/lib/server/index.js +3 -1
- package/dist/lib/server/index.js.map +1 -1
- package/dist/lib/server/serve.d.ts +45 -0
- package/dist/lib/server/serve.d.ts.map +1 -0
- package/dist/lib/server/serve.js +86 -0
- package/dist/lib/server/serve.js.map +1 -0
- package/dist/lib/testing/client.d.ts.map +1 -1
- package/dist/lib/testing/client.js +1 -0
- package/dist/lib/testing/client.js.map +1 -1
- package/dist/lib/testing/compliance/comply.d.ts.map +1 -1
- package/dist/lib/testing/compliance/comply.js +48 -63
- package/dist/lib/testing/compliance/comply.js.map +1 -1
- package/dist/lib/testing/compliance/storyboard-tracks.d.ts +24 -0
- package/dist/lib/testing/compliance/storyboard-tracks.d.ts.map +1 -0
- package/dist/lib/testing/compliance/storyboard-tracks.js +157 -0
- package/dist/lib/testing/compliance/storyboard-tracks.js.map +1 -0
- package/dist/lib/testing/compliance/types.d.ts +1 -1
- package/dist/lib/testing/compliance/types.d.ts.map +1 -1
- package/dist/lib/testing/index.d.ts +1 -0
- package/dist/lib/testing/index.d.ts.map +1 -1
- package/dist/lib/testing/index.js +23 -1
- package/dist/lib/testing/index.js.map +1 -1
- package/dist/lib/testing/orchestrator.d.ts +8 -0
- package/dist/lib/testing/orchestrator.d.ts.map +1 -1
- package/dist/lib/testing/orchestrator.js +8 -0
- package/dist/lib/testing/orchestrator.js.map +1 -1
- package/dist/lib/testing/storyboard/context.d.ts +34 -0
- package/dist/lib/testing/storyboard/context.d.ts.map +1 -0
- package/dist/lib/testing/storyboard/context.js +257 -0
- package/dist/lib/testing/storyboard/context.js.map +1 -0
- package/dist/lib/testing/storyboard/index.d.ts +15 -0
- package/dist/lib/testing/storyboard/index.d.ts.map +1 -0
- package/dist/lib/testing/storyboard/index.js +48 -0
- package/dist/lib/testing/storyboard/index.js.map +1 -0
- package/dist/lib/testing/storyboard/loader.d.ts +53 -0
- package/dist/lib/testing/storyboard/loader.d.ts.map +1 -0
- package/dist/lib/testing/storyboard/loader.js +114 -0
- package/dist/lib/testing/storyboard/loader.js.map +1 -0
- package/dist/lib/testing/storyboard/path.d.ts +29 -0
- package/dist/lib/testing/storyboard/path.d.ts.map +1 -0
- package/dist/lib/testing/storyboard/path.js +121 -0
- package/dist/lib/testing/storyboard/path.js.map +1 -0
- package/dist/lib/testing/storyboard/request-builder.d.ts +28 -0
- package/dist/lib/testing/storyboard/request-builder.d.ts.map +1 -0
- package/dist/lib/testing/storyboard/request-builder.js +410 -0
- package/dist/lib/testing/storyboard/request-builder.js.map +1 -0
- package/dist/lib/testing/storyboard/runner.d.ts +24 -0
- package/dist/lib/testing/storyboard/runner.d.ts.map +1 -0
- package/dist/lib/testing/storyboard/runner.js +280 -0
- package/dist/lib/testing/storyboard/runner.js.map +1 -0
- package/dist/lib/testing/storyboard/task-map.d.ts +21 -0
- package/dist/lib/testing/storyboard/task-map.d.ts.map +1 -0
- package/dist/lib/testing/storyboard/task-map.js +84 -0
- package/dist/lib/testing/storyboard/task-map.js.map +1 -0
- package/dist/lib/testing/storyboard/types.d.ts +156 -0
- package/dist/lib/testing/storyboard/types.d.ts.map +1 -0
- package/dist/lib/testing/storyboard/types.js +10 -0
- package/dist/lib/testing/storyboard/types.js.map +1 -0
- package/dist/lib/testing/storyboard/validations.d.ts +17 -0
- package/dist/lib/testing/storyboard/validations.d.ts.map +1 -0
- package/dist/lib/testing/storyboard/validations.js +166 -0
- package/dist/lib/testing/storyboard/validations.js.map +1 -0
- package/dist/lib/testing/types.d.ts +2 -0
- package/dist/lib/testing/types.d.ts.map +1 -1
- package/dist/lib/types/core.generated.d.ts +2 -2
- package/dist/lib/types/core.generated.d.ts.map +1 -1
- package/dist/lib/types/core.generated.js +1 -1
- package/dist/lib/types/schemas.generated.d.ts +193 -34
- package/dist/lib/types/schemas.generated.d.ts.map +1 -1
- package/dist/lib/types/schemas.generated.js +87 -5
- package/dist/lib/types/schemas.generated.js.map +1 -1
- package/dist/lib/types/tools.generated.d.ts +280 -3
- package/dist/lib/types/tools.generated.d.ts.map +1 -1
- package/dist/lib/utils/response-schemas.d.ts.map +1 -1
- package/dist/lib/utils/response-schemas.js +34 -3
- package/dist/lib/utils/response-schemas.js.map +1 -1
- package/dist/lib/utils/validate-user-agent.d.ts +8 -0
- package/dist/lib/utils/validate-user-agent.d.ts.map +1 -0
- package/dist/lib/utils/validate-user-agent.js +15 -0
- package/dist/lib/utils/validate-user-agent.js.map +1 -0
- package/dist/lib/version.d.ts +6 -0
- package/dist/lib/version.d.ts.map +1 -1
- package/dist/lib/version.js +7 -1
- package/dist/lib/version.js.map +1 -1
- package/docs/README.md +42 -0
- package/docs/guides/BUILD-AN-AGENT.md +292 -0
- package/docs/llms.txt +634 -0
- package/examples/README.md +106 -0
- package/examples/adcp.config.json +30 -0
- package/examples/basic-a2a.ts +76 -0
- package/examples/basic-mcp.ts +50 -0
- package/examples/batch-preview-test.ts +266 -0
- package/examples/conversation-client.ts +291 -0
- package/examples/debug-preview-response.ts +73 -0
- package/examples/debug-preview-with-logging.ts +50 -0
- package/examples/easy-config-demo.ts +242 -0
- package/examples/env-config.ts +51 -0
- package/examples/error-compliant-server.ts +237 -0
- package/examples/generative-creative-demo.ts +205 -0
- package/examples/inspect-card-formats.ts +161 -0
- package/examples/logger-usage.ts +165 -0
- package/examples/oauth-cli-example.ts +154 -0
- package/examples/pr78-async-patterns-demo.ts +247 -0
- package/examples/signals-agent.ts +162 -0
- package/examples/simple-getting-started.ts +225 -0
- package/examples/simple-protocol-demo.ts +75 -0
- package/examples/test-helpers-demo.ts +239 -0
- package/examples/zod-validation-example.ts +126 -0
- package/package.json +12 -2
- package/skills/adcp/SKILL.md +13 -2
- package/storyboards/audience_sync.yaml +199 -0
- package/storyboards/behavioral_analysis.yaml +244 -0
- package/storyboards/brand_rights.yaml +131 -0
- package/storyboards/creative_ad_server.yaml +171 -0
- package/storyboards/creative_sales_agent.yaml +169 -0
- package/storyboards/creative_template.yaml +306 -0
- package/storyboards/deterministic_testing.yaml +925 -0
- package/storyboards/error_compliance.yaml +231 -0
- package/storyboards/governance_content_standards.yaml +213 -0
- package/storyboards/governance_property_lists.yaml +372 -0
- package/storyboards/media_buy_catalog_creative.yaml +457 -0
- package/storyboards/media_buy_governance_escalation.yaml +467 -0
- package/storyboards/media_buy_guaranteed_approval.yaml +396 -0
- package/storyboards/media_buy_non_guaranteed.yaml +288 -0
- package/storyboards/media_buy_proposal_mode.yaml +369 -0
- package/storyboards/media_buy_seller.yaml +560 -0
- package/storyboards/media_buy_state_machine.yaml +254 -0
- package/storyboards/schema.yaml +65 -0
- package/storyboards/schema_validation.yaml +166 -0
- package/storyboards/si_session.yaml +384 -0
- package/storyboards/signal_marketplace.yaml +283 -0
- package/storyboards/signal_owned.yaml +211 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-schemas.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/response-schemas.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,qBAAqB,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"response-schemas.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/response-schemas.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,qBAAqB,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAuDpE,CAAC"}
|
|
@@ -42,20 +42,51 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
42
42
|
exports.TOOL_RESPONSE_SCHEMAS = void 0;
|
|
43
43
|
const schemas = __importStar(require("../types/schemas.generated"));
|
|
44
44
|
exports.TOOL_RESPONSE_SCHEMAS = {
|
|
45
|
+
// Product discovery & media buy
|
|
45
46
|
get_products: schemas.GetProductsResponseSchema,
|
|
46
|
-
list_creative_formats: schemas.ListCreativeFormatsResponseSchema,
|
|
47
47
|
create_media_buy: schemas.CreateMediaBuyResponseSchema,
|
|
48
48
|
update_media_buy: schemas.UpdateMediaBuyResponseSchema,
|
|
49
|
-
sync_creatives: schemas.SyncCreativesResponseSchema,
|
|
50
|
-
list_creatives: schemas.ListCreativesResponseSchema,
|
|
51
49
|
get_media_buys: schemas.GetMediaBuysResponseSchema,
|
|
52
50
|
get_media_buy_delivery: schemas.GetMediaBuyDeliveryResponseSchema,
|
|
53
51
|
provide_performance_feedback: schemas.ProvidePerformanceFeedbackResponseSchema,
|
|
52
|
+
// Creative
|
|
53
|
+
list_creative_formats: schemas.ListCreativeFormatsResponseSchema,
|
|
54
54
|
build_creative: schemas.BuildCreativeResponseSchema,
|
|
55
55
|
preview_creative: schemas.PreviewCreativeResponseSchema,
|
|
56
|
+
sync_creatives: schemas.SyncCreativesResponseSchema,
|
|
57
|
+
list_creatives: schemas.ListCreativesResponseSchema,
|
|
58
|
+
get_creative_delivery: schemas.GetCreativeDeliveryResponseSchema,
|
|
59
|
+
// Signals
|
|
56
60
|
get_signals: schemas.GetSignalsResponseSchema,
|
|
57
61
|
activate_signal: schemas.ActivateSignalResponseSchema,
|
|
62
|
+
// Account & audience
|
|
63
|
+
sync_accounts: schemas.SyncAccountsResponseSchema,
|
|
64
|
+
list_accounts: schemas.ListAccountsResponseSchema,
|
|
65
|
+
sync_governance: schemas.SyncGovernanceResponseSchema,
|
|
58
66
|
sync_audiences: schemas.SyncAudiencesResponseSchema,
|
|
67
|
+
// Governance — property lists & content standards
|
|
68
|
+
create_property_list: schemas.CreatePropertyListResponseSchema,
|
|
69
|
+
get_property_list: schemas.GetPropertyListResponseSchema,
|
|
70
|
+
update_property_list: schemas.UpdatePropertyListResponseSchema,
|
|
71
|
+
list_property_lists: schemas.ListPropertyListsResponseSchema,
|
|
72
|
+
delete_property_list: schemas.DeletePropertyListResponseSchema,
|
|
73
|
+
list_content_standards: schemas.ListContentStandardsResponseSchema,
|
|
74
|
+
get_content_standards: schemas.GetContentStandardsResponseSchema,
|
|
75
|
+
calibrate_content: schemas.CalibrateContentResponseSchema,
|
|
76
|
+
validate_content_delivery: schemas.ValidateContentDeliveryResponseSchema,
|
|
77
|
+
// Campaign governance
|
|
78
|
+
sync_plans: schemas.SyncPlansResponseSchema,
|
|
79
|
+
check_governance: schemas.CheckGovernanceResponseSchema,
|
|
80
|
+
report_plan_outcome: schemas.ReportPlanOutcomeResponseSchema,
|
|
81
|
+
get_plan_audit_logs: schemas.GetPlanAuditLogsResponseSchema,
|
|
82
|
+
// Sponsored Intelligence
|
|
83
|
+
si_get_offering: schemas.SIGetOfferingResponseSchema,
|
|
84
|
+
si_initiate_session: schemas.SIInitiateSessionResponseSchema,
|
|
85
|
+
si_send_message: schemas.SISendMessageResponseSchema,
|
|
86
|
+
si_terminate_session: schemas.SITerminateSessionResponseSchema,
|
|
87
|
+
// Capabilities
|
|
88
|
+
get_adcp_capabilities: schemas.GetAdCPCapabilitiesResponseSchema,
|
|
89
|
+
// Test controller
|
|
59
90
|
comply_test_controller: schemas.ComplyTestControllerResponseSchema,
|
|
60
91
|
};
|
|
61
92
|
//# sourceMappingURL=response-schemas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-schemas.js","sourceRoot":"","sources":["../../../src/lib/utils/response-schemas.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,oEAAsD;AAEzC,QAAA,qBAAqB,GAAuC;IACvE,YAAY,EAAE,OAAO,CAAC,yBAAyB;IAC/C,
|
|
1
|
+
{"version":3,"file":"response-schemas.js","sourceRoot":"","sources":["../../../src/lib/utils/response-schemas.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,oEAAsD;AAEzC,QAAA,qBAAqB,GAAuC;IACvE,gCAAgC;IAChC,YAAY,EAAE,OAAO,CAAC,yBAAyB;IAC/C,gBAAgB,EAAE,OAAO,CAAC,4BAA4B;IACtD,gBAAgB,EAAE,OAAO,CAAC,4BAA4B;IACtD,cAAc,EAAE,OAAO,CAAC,0BAA0B;IAClD,sBAAsB,EAAE,OAAO,CAAC,iCAAiC;IACjE,4BAA4B,EAAE,OAAO,CAAC,wCAAwC;IAE9E,WAAW;IACX,qBAAqB,EAAE,OAAO,CAAC,iCAAiC;IAChE,cAAc,EAAE,OAAO,CAAC,2BAA2B;IACnD,gBAAgB,EAAE,OAAO,CAAC,6BAA6B;IACvD,cAAc,EAAE,OAAO,CAAC,2BAA2B;IACnD,cAAc,EAAE,OAAO,CAAC,2BAA2B;IACnD,qBAAqB,EAAE,OAAO,CAAC,iCAAiC;IAEhE,UAAU;IACV,WAAW,EAAE,OAAO,CAAC,wBAAwB;IAC7C,eAAe,EAAE,OAAO,CAAC,4BAA4B;IAErD,qBAAqB;IACrB,aAAa,EAAE,OAAO,CAAC,0BAA0B;IACjD,aAAa,EAAE,OAAO,CAAC,0BAA0B;IACjD,eAAe,EAAE,OAAO,CAAC,4BAA4B;IACrD,cAAc,EAAE,OAAO,CAAC,2BAA2B;IAEnD,kDAAkD;IAClD,oBAAoB,EAAE,OAAO,CAAC,gCAAgC;IAC9D,iBAAiB,EAAE,OAAO,CAAC,6BAA6B;IACxD,oBAAoB,EAAE,OAAO,CAAC,gCAAgC;IAC9D,mBAAmB,EAAE,OAAO,CAAC,+BAA+B;IAC5D,oBAAoB,EAAE,OAAO,CAAC,gCAAgC;IAC9D,sBAAsB,EAAE,OAAO,CAAC,kCAAkC;IAClE,qBAAqB,EAAE,OAAO,CAAC,iCAAiC;IAChE,iBAAiB,EAAE,OAAO,CAAC,8BAA8B;IACzD,yBAAyB,EAAE,OAAO,CAAC,qCAAqC;IAExE,sBAAsB;IACtB,UAAU,EAAE,OAAO,CAAC,uBAAuB;IAC3C,gBAAgB,EAAE,OAAO,CAAC,6BAA6B;IACvD,mBAAmB,EAAE,OAAO,CAAC,+BAA+B;IAC5D,mBAAmB,EAAE,OAAO,CAAC,8BAA8B;IAE3D,yBAAyB;IACzB,eAAe,EAAE,OAAO,CAAC,2BAA2B;IACpD,mBAAmB,EAAE,OAAO,CAAC,+BAA+B;IAC5D,eAAe,EAAE,OAAO,CAAC,2BAA2B;IACpD,oBAAoB,EAAE,OAAO,CAAC,gCAAgC;IAE9D,eAAe;IACf,qBAAqB,EAAE,OAAO,CAAC,iCAAiC;IAEhE,kBAAkB;IAClB,sBAAsB,EAAE,OAAO,CAAC,kCAAkC;CACnE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validate a user-agent string for safe use in HTTP headers.
|
|
3
|
+
* Rejects newlines (CRLF injection) and null bytes (header truncation).
|
|
4
|
+
*
|
|
5
|
+
* @throws {Error} if the value contains forbidden characters
|
|
6
|
+
*/
|
|
7
|
+
export declare function validateUserAgent(value: string): void;
|
|
8
|
+
//# sourceMappingURL=validate-user-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-user-agent.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/validate-user-agent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAIrD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateUserAgent = validateUserAgent;
|
|
4
|
+
/**
|
|
5
|
+
* Validate a user-agent string for safe use in HTTP headers.
|
|
6
|
+
* Rejects newlines (CRLF injection) and null bytes (header truncation).
|
|
7
|
+
*
|
|
8
|
+
* @throws {Error} if the value contains forbidden characters
|
|
9
|
+
*/
|
|
10
|
+
function validateUserAgent(value) {
|
|
11
|
+
if (/[\r\n\x00]/.test(value)) {
|
|
12
|
+
throw new Error('userAgent must not contain newline or null characters');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=validate-user-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-user-agent.js","sourceRoot":"","sources":["../../../src/lib/utils/validate-user-agent.ts"],"names":[],"mappings":";;AAMA,8CAIC;AAVD;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,KAAa;IAC7C,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC"}
|
package/dist/lib/version.d.ts
CHANGED
|
@@ -6,6 +6,12 @@ export declare const LIBRARY_VERSION = "4.20.0";
|
|
|
6
6
|
* AdCP specification version this library is built for
|
|
7
7
|
*/
|
|
8
8
|
export declare const ADCP_VERSION = "latest";
|
|
9
|
+
/**
|
|
10
|
+
* AdCP major version sent with every request (adcp_major_version field).
|
|
11
|
+
* Sellers validate this against their supported versions and return
|
|
12
|
+
* VERSION_UNSUPPORTED if the version is not in range.
|
|
13
|
+
*/
|
|
14
|
+
export declare const ADCP_MAJOR_VERSION = 3;
|
|
9
15
|
/**
|
|
10
16
|
* AdCP versions this library maintains backward compatibility with
|
|
11
17
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/lib/version.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,eAAe,WAAW,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,YAAY,WAAW,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,wBAAwB,iEAAkE,CAAC;AAExG;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;CAKf,CAAC;AAEX;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,SAAS,MAAM,EAAE,CAEzD"}
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/lib/version.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,eAAe,WAAW,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,YAAY,WAAW,CAAC;AAErC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,wBAAwB,iEAAkE,CAAC;AAExG;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;CAKf,CAAC;AAEX;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,SAAS,MAAM,EAAE,CAEzD"}
|
package/dist/lib/version.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Generated version information
|
|
3
3
|
// This file is auto-generated by sync-version.ts
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.VERSION_INFO = exports.COMPATIBLE_ADCP_VERSIONS = exports.ADCP_VERSION = exports.LIBRARY_VERSION = void 0;
|
|
5
|
+
exports.VERSION_INFO = exports.COMPATIBLE_ADCP_VERSIONS = exports.ADCP_MAJOR_VERSION = exports.ADCP_VERSION = exports.LIBRARY_VERSION = void 0;
|
|
6
6
|
exports.getAdcpVersion = getAdcpVersion;
|
|
7
7
|
exports.getLibraryVersion = getLibraryVersion;
|
|
8
8
|
exports.isCompatibleWith = isCompatibleWith;
|
|
@@ -15,6 +15,12 @@ exports.LIBRARY_VERSION = '4.20.0';
|
|
|
15
15
|
* AdCP specification version this library is built for
|
|
16
16
|
*/
|
|
17
17
|
exports.ADCP_VERSION = 'latest';
|
|
18
|
+
/**
|
|
19
|
+
* AdCP major version sent with every request (adcp_major_version field).
|
|
20
|
+
* Sellers validate this against their supported versions and return
|
|
21
|
+
* VERSION_UNSUPPORTED if the version is not in range.
|
|
22
|
+
*/
|
|
23
|
+
exports.ADCP_MAJOR_VERSION = 3;
|
|
18
24
|
/**
|
|
19
25
|
* AdCP versions this library maintains backward compatibility with
|
|
20
26
|
*/
|
package/dist/lib/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/lib/version.ts"],"names":[],"mappings":";AAAA,gCAAgC;AAChC,iDAAiD;;;
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/lib/version.ts"],"names":[],"mappings":";AAAA,gCAAgC;AAChC,iDAAiD;;;AAqCjD,wCAEC;AAKD,8CAEC;AAKD,4CAEC;AAKD,sDAEC;AA1DD;;GAEG;AACU,QAAA,eAAe,GAAG,QAAQ,CAAC;AAExC;;GAEG;AACU,QAAA,YAAY,GAAG,QAAQ,CAAC;AAErC;;;;GAIG;AACU,QAAA,kBAAkB,GAAG,CAAC,CAAC;AAEpC;;GAEG;AACU,QAAA,wBAAwB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,cAAc,CAAU,CAAC;AAExG;;GAEG;AACU,QAAA,YAAY,GAAG;IAC1B,OAAO,EAAE,QAAQ;IACjB,IAAI,EAAE,QAAQ;IACd,kBAAkB,EAAE,gCAAwB;IAC5C,WAAW,EAAE,0BAA0B;CAC/B,CAAC;AAEX;;GAEG;AACH,SAAgB,cAAc;IAC5B,OAAO,oBAAY,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB;IAC/B,OAAO,uBAAe,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,SAAgB,gBAAgB,CAAC,WAAmB;IAClD,OAAQ,gCAA8C,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAC/E,CAAC;AAED;;GAEG;AACH,SAAgB,qBAAqB;IACnC,OAAO,gCAAwB,CAAC;AAClC,CAAC"}
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# ADCP Client Documentation
|
|
2
|
+
|
|
3
|
+
Complete documentation for the `@adcp/client` TypeScript library.
|
|
4
|
+
|
|
5
|
+
## 📚 Getting Started
|
|
6
|
+
|
|
7
|
+
Start here if you're new to ADCP or this library:
|
|
8
|
+
|
|
9
|
+
- **[Getting Started Guide](./guides/getting-started.md)** - Comprehensive tutorial from installation to advanced patterns
|
|
10
|
+
- **[MCP Testing Guide](./guides/MCP_TESTING.md)** - Working with Model Context Protocol agents
|
|
11
|
+
|
|
12
|
+
## 🏗️ Advanced Topics
|
|
13
|
+
|
|
14
|
+
For developers building production applications:
|
|
15
|
+
|
|
16
|
+
- **[Production Deployment](./advanced/PRODUCTION-READY.md)** - Production best practices and configurations
|
|
17
|
+
- **[Deployment Guide](./advanced/DEPLOYMENT.md)** - Deploy testing framework to cloud platforms
|
|
18
|
+
- **[Testing Strategy](./advanced/TESTING-STRATEGY.md)** - Comprehensive testing approaches
|
|
19
|
+
|
|
20
|
+
## 📖 API Reference
|
|
21
|
+
|
|
22
|
+
Detailed technical reference:
|
|
23
|
+
|
|
24
|
+
- **[TypeDoc API Reference](./api/)** - Generated from source code (coming soon)
|
|
25
|
+
- **[Protocol Types](../src/lib/types/)** - TypeScript type definitions
|
|
26
|
+
|
|
27
|
+
## 🤝 Contributing
|
|
28
|
+
|
|
29
|
+
Want to contribute to the library?
|
|
30
|
+
|
|
31
|
+
- **[Contributing Guidelines](../CONTRIBUTING.md)** - How to contribute code, docs, and examples
|
|
32
|
+
- **[Security Policy](../SECURITY.md)** - Security reporting and best practices
|
|
33
|
+
|
|
34
|
+
## 📋 Reference
|
|
35
|
+
|
|
36
|
+
- **[Changelog](../CHANGELOG.md)** - Version history and breaking changes
|
|
37
|
+
- **[AdCP Specification](https://adcontextprotocol.org)** - Official protocol documentation
|
|
38
|
+
- **[Examples](../examples/)** - Real-world usage examples
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
> **Quick Start**: If you just want to get up and running quickly, check the main [README.md](../README.md) for a condensed quick start guide.
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
# Build an AdCP Agent
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This guide walks through building an AdCP agent (server) using `@adcp/client`. While most documentation covers the client side — calling existing agents — this guide covers the server side: implementing an agent that other clients can discover and call.
|
|
6
|
+
|
|
7
|
+
We'll build a **signals agent** that serves audience segments via the `get_signals` tool. The same patterns apply to any AdCP tool (`get_products`, `create_media_buy`, etc.).
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
- Node.js 18+
|
|
12
|
+
- `@adcp/client` installed (`npm install @adcp/client`)
|
|
13
|
+
- `@modelcontextprotocol/sdk` (installed as a dependency of `@adcp/client`)
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
A minimal signals agent in ~20 lines:
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import {
|
|
21
|
+
createTaskCapableServer,
|
|
22
|
+
taskToolResponse,
|
|
23
|
+
serve,
|
|
24
|
+
GetSignalsRequestSchema,
|
|
25
|
+
} from '@adcp/client';
|
|
26
|
+
|
|
27
|
+
function createAgent() {
|
|
28
|
+
const server = createTaskCapableServer('My Signals Agent', '1.0.0');
|
|
29
|
+
|
|
30
|
+
server.tool(
|
|
31
|
+
'get_signals',
|
|
32
|
+
'Discover audience segments.',
|
|
33
|
+
GetSignalsRequestSchema.shape,
|
|
34
|
+
async (args) => {
|
|
35
|
+
const signals = [
|
|
36
|
+
{
|
|
37
|
+
signal_agent_segment_id: 'demo_segment',
|
|
38
|
+
signal_id: { source: 'catalog', data_provider_domain: 'example.com', id: 'demo_segment' },
|
|
39
|
+
name: 'Demo Segment',
|
|
40
|
+
description: 'A demo audience segment.',
|
|
41
|
+
value_type: 'binary',
|
|
42
|
+
signal_type: 'owned',
|
|
43
|
+
data_provider: 'My Agent',
|
|
44
|
+
coverage_percentage: 10,
|
|
45
|
+
deployments: [],
|
|
46
|
+
pricing_options: [
|
|
47
|
+
{ pricing_option_id: 'po_demo', model: 'cpm', currency: 'USD', cpm: 5 },
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
return taskToolResponse({ signals, sandbox: true }, `Found ${signals.length} segment(s)`);
|
|
53
|
+
},
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
return server;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
serve(createAgent); // listening on http://localhost:3001/mcp
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Start it and test immediately:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npx tsx agent.ts
|
|
66
|
+
npx @adcp/client http://localhost:3001/mcp # discover tools
|
|
67
|
+
npx @adcp/client http://localhost:3001/mcp get_signals '{}' # call get_signals
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Key Concepts
|
|
71
|
+
|
|
72
|
+
### createTaskCapableServer
|
|
73
|
+
|
|
74
|
+
Creates an MCP server pre-configured with task support (async operations). This is the recommended way to build AdCP agents — it handles task lifecycle plumbing so you can focus on business logic.
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import { createTaskCapableServer } from '@adcp/client';
|
|
78
|
+
|
|
79
|
+
const server = createTaskCapableServer('Agent Name', '1.0.0', {
|
|
80
|
+
instructions: 'Description of what your agent does.',
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
For sync-only tools, use `server.tool()` directly. For tools that need async processing, use `registerAdcpTaskTool()` which requires explicit `createTask`/`getTask`/`getTaskResult` handlers.
|
|
85
|
+
|
|
86
|
+
### Generated Schemas
|
|
87
|
+
|
|
88
|
+
`@adcp/client` exports Zod schemas for every AdCP tool's input and output. Use these instead of hand-rolling JSON Schema definitions:
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
import {
|
|
92
|
+
GetSignalsRequestSchema, // input validation for get_signals
|
|
93
|
+
GetSignalsResponseSchema, // output validation
|
|
94
|
+
GetProductsRequestSchema, // input validation for get_products
|
|
95
|
+
CreateMediaBuyRequestSchema,
|
|
96
|
+
} from '@adcp/client';
|
|
97
|
+
|
|
98
|
+
// The MCP SDK expects a plain object of Zod fields, not a Zod schema — .shape unwraps it.
|
|
99
|
+
server.tool('get_signals', 'Discover audience segments.', GetSignalsRequestSchema.shape, async (args) => {
|
|
100
|
+
// args is fully typed from the schema
|
|
101
|
+
});
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### taskToolResponse
|
|
105
|
+
|
|
106
|
+
Builds a properly formatted MCP `CallToolResult` from your response data:
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
import { taskToolResponse } from '@adcp/client';
|
|
110
|
+
|
|
111
|
+
// Returns { content: [{ type: 'text', text: '...' }] }
|
|
112
|
+
return taskToolResponse(
|
|
113
|
+
{ signals: [...], sandbox: true },
|
|
114
|
+
'Found 3 audience segment(s)', // summary text
|
|
115
|
+
);
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
For media buy and product tools, dedicated response builders are also available:
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
import { productsResponse, mediaBuyResponse, deliveryResponse, adcpError } from '@adcp/client';
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Task Statuses (Server-Side Contract)
|
|
125
|
+
|
|
126
|
+
When your agent receives a tool call, it returns one of these statuses. The buyer client handles each differently:
|
|
127
|
+
|
|
128
|
+
| Status | When to use | What the buyer client does |
|
|
129
|
+
|--------|------------|---------------------------|
|
|
130
|
+
| `completed` | Request fulfilled synchronously | Reads `result.data` and proceeds |
|
|
131
|
+
| `working` | Processing started, not done yet | Polls `tasks/get` until status changes |
|
|
132
|
+
| `submitted` | Will notify via webhook when done | Waits for webhook delivery at `push_notification_config.url` |
|
|
133
|
+
| `input_required` | Need clarification from buyer | Fires buyer's `InputHandler` callback with the question |
|
|
134
|
+
| `deferred` | Requires human decision | Returns a token; human resumes later via `result.deferred.resume()` |
|
|
135
|
+
|
|
136
|
+
For synchronous tools, use `taskToolResponse()` — it sets `completed` automatically:
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
return taskToolResponse({ signals: [...], sandbox: true }, 'Found 3 segments');
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
For async tools that need background processing, use `registerAdcpTaskTool()`:
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
import { registerAdcpTaskTool, InMemoryTaskStore } from '@adcp/client';
|
|
146
|
+
|
|
147
|
+
const taskStore = new InMemoryTaskStore();
|
|
148
|
+
|
|
149
|
+
registerAdcpTaskTool(server, taskStore, {
|
|
150
|
+
name: 'create_media_buy',
|
|
151
|
+
description: 'Create a media buy.',
|
|
152
|
+
schema: CreateMediaBuyRequestSchema.shape,
|
|
153
|
+
createTask: async (args) => {
|
|
154
|
+
// Start processing, return a task ID
|
|
155
|
+
const taskId = crypto.randomUUID();
|
|
156
|
+
processInBackground(taskId, args); // your async logic
|
|
157
|
+
return { taskId, status: 'submitted' };
|
|
158
|
+
},
|
|
159
|
+
getTask: async (taskId) => taskStore.get(taskId),
|
|
160
|
+
getTaskResult: async (taskId) => taskStore.getResult(taskId),
|
|
161
|
+
});
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**Error responses**: Use `adcpError()` with standard error codes. The buyer agent uses the `recovery` classification to decide retry behavior:
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
import { adcpError } from '@adcp/client';
|
|
168
|
+
|
|
169
|
+
// correctable — buyer should fix params and retry
|
|
170
|
+
return adcpError('BUDGET_TOO_LOW', 'Minimum budget is $1,000');
|
|
171
|
+
|
|
172
|
+
// transient — buyer should retry after delay
|
|
173
|
+
return adcpError('SERVICE_UNAVAILABLE', 'Try again in 30 seconds');
|
|
174
|
+
|
|
175
|
+
// terminal — buyer should stop
|
|
176
|
+
return adcpError('ACCOUNT_SUSPENDED', 'Contact support');
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
See `docs/llms.txt` for the full error code table with recovery classifications.
|
|
180
|
+
|
|
181
|
+
### Storyboards
|
|
182
|
+
|
|
183
|
+
The `storyboards/` directory contains YAML files that define exactly what tool call sequences a buyer agent will make against your server. Each storyboard includes phases, steps, sample requests/responses, and validation rules.
|
|
184
|
+
|
|
185
|
+
Key storyboards for server-side builders:
|
|
186
|
+
- `media_buy_non_guaranteed.yaml` — auction-based buying flow
|
|
187
|
+
- `media_buy_guaranteed_approval.yaml` — guaranteed buying with IO approval
|
|
188
|
+
- `media_buy_proposal_mode.yaml` — proposal-based buying
|
|
189
|
+
- `creative_sales_agent.yaml` — push creative assets to your platform
|
|
190
|
+
- `signal_marketplace.yaml` / `signal_owned.yaml` — signals agent flows
|
|
191
|
+
- `si_session.yaml` — sponsored intelligence sessions
|
|
192
|
+
- `media_buy_governance_escalation.yaml` — governance with human escalation
|
|
193
|
+
|
|
194
|
+
### HTTP Transport
|
|
195
|
+
|
|
196
|
+
The `serve()` helper handles HTTP transport setup. Pass it a factory function that returns a configured `McpServer`:
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
import { serve } from '@adcp/client';
|
|
200
|
+
|
|
201
|
+
serve(createMyAgent); // defaults: port 3001, path /mcp
|
|
202
|
+
serve(createMyAgent, { port: 8080 }); // custom port
|
|
203
|
+
serve(createMyAgent, { path: '/v1/mcp' }); // custom path
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
`serve()` returns the underlying `http.Server` for lifecycle control (e.g., graceful shutdown).
|
|
207
|
+
|
|
208
|
+
For custom routing or middleware, you can wire the transport manually:
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
212
|
+
import { createServer } from 'http';
|
|
213
|
+
|
|
214
|
+
const httpServer = createServer(async (req, res) => {
|
|
215
|
+
if (req.url === '/mcp' || req.url === '/mcp/') {
|
|
216
|
+
const agentServer = createMyAgent();
|
|
217
|
+
const transport = new StreamableHTTPServerTransport({ sessionIdGenerator: undefined });
|
|
218
|
+
try {
|
|
219
|
+
await agentServer.connect(transport);
|
|
220
|
+
await transport.handleRequest(req, res);
|
|
221
|
+
} catch (err) {
|
|
222
|
+
console.error('Server error:', err);
|
|
223
|
+
if (!res.headersSent) {
|
|
224
|
+
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
225
|
+
res.end(JSON.stringify({ error: 'Internal server error' }));
|
|
226
|
+
}
|
|
227
|
+
} finally {
|
|
228
|
+
await agentServer.close();
|
|
229
|
+
}
|
|
230
|
+
} else {
|
|
231
|
+
res.writeHead(404);
|
|
232
|
+
res.end('Not found');
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Testing Your Agent
|
|
238
|
+
|
|
239
|
+
### Tool Discovery
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
npx @adcp/client http://localhost:3001/mcp
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
This lists all tools your agent exposes, their descriptions, and parameters. If `get_signals` appears with the correct schema, your agent is wired up correctly.
|
|
246
|
+
|
|
247
|
+
### Calling Tools
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
# All segments
|
|
251
|
+
npx @adcp/client http://localhost:3001/mcp get_signals '{"signal_spec":"audience segments"}'
|
|
252
|
+
|
|
253
|
+
# Filtered by text
|
|
254
|
+
npx @adcp/client http://localhost:3001/mcp get_signals '{"signal_spec":"shoppers"}'
|
|
255
|
+
|
|
256
|
+
# Filtered by catalog type
|
|
257
|
+
npx @adcp/client http://localhost:3001/mcp get_signals '{"filters":{"catalog_types":["marketplace"]}}'
|
|
258
|
+
|
|
259
|
+
# JSON output for scripting
|
|
260
|
+
npx @adcp/client http://localhost:3001/mcp get_signals '{}' --json
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Compliance Check
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
npx @adcp/client comply http://localhost:3001/mcp
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
This runs a standard validation suite against your agent to check AdCP compliance.
|
|
270
|
+
|
|
271
|
+
## Complete Example
|
|
272
|
+
|
|
273
|
+
See [`examples/signals-agent.ts`](../../examples/signals-agent.ts) for a complete, runnable signals agent with:
|
|
274
|
+
|
|
275
|
+
- Three audience segments (owned, custom, marketplace)
|
|
276
|
+
- Text search via `signal_spec`
|
|
277
|
+
- Filtering by `signal_ids` and `catalog_types`
|
|
278
|
+
- Result limiting via `max_results`
|
|
279
|
+
- Proper HTTP transport setup
|
|
280
|
+
|
|
281
|
+
See [`examples/error-compliant-server.ts`](../../examples/error-compliant-server.ts) for a media buy agent demonstrating:
|
|
282
|
+
|
|
283
|
+
- Multiple tools (`get_products`, `create_media_buy`, `get_media_buy_delivery`)
|
|
284
|
+
- Structured error handling with `adcpError()`
|
|
285
|
+
- Rate limiting
|
|
286
|
+
- Business logic validation
|
|
287
|
+
|
|
288
|
+
## Related
|
|
289
|
+
|
|
290
|
+
- [`registerAdcpTaskTool()`](../../src/lib/server/tasks.ts) — for async tools that need background processing
|
|
291
|
+
- [`examples/error-compliant-server.ts`](../../examples/error-compliant-server.ts) — media buy agent with multiple tools and error handling
|
|
292
|
+
- [AdCP specification](https://adcontextprotocol.org) — full protocol reference
|