@adcp/sdk 7.0.0 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/adcp-config.js +10 -1
- package/bin/adcp.js +424 -22
- package/dist/lib/auth/oauth/authorization-required.d.ts +17 -0
- package/dist/lib/auth/oauth/authorization-required.d.ts.map +1 -1
- package/dist/lib/auth/oauth/authorization-required.js +20 -0
- package/dist/lib/auth/oauth/authorization-required.js.map +1 -1
- package/dist/lib/auth/oauth/index.d.ts +1 -1
- package/dist/lib/auth/oauth/index.d.ts.map +1 -1
- package/dist/lib/auth/oauth/index.js +2 -1
- package/dist/lib/auth/oauth/index.js.map +1 -1
- package/dist/lib/core/AgentClient.d.ts.map +1 -1
- package/dist/lib/core/SingleAgentClient.d.ts.map +1 -1
- package/dist/lib/core/SingleAgentClient.js +13 -2
- package/dist/lib/core/SingleAgentClient.js.map +1 -1
- package/dist/lib/discovery/property-crawler.d.ts +13 -1
- package/dist/lib/discovery/property-crawler.d.ts.map +1 -1
- package/dist/lib/discovery/property-crawler.js +40 -14
- package/dist/lib/discovery/property-crawler.js.map +1 -1
- package/dist/lib/discovery/resolve-agent-properties.d.ts +103 -0
- package/dist/lib/discovery/resolve-agent-properties.d.ts.map +1 -0
- package/dist/lib/discovery/resolve-agent-properties.js +182 -0
- package/dist/lib/discovery/resolve-agent-properties.js.map +1 -0
- package/dist/lib/discovery/types.d.ts +41 -2
- package/dist/lib/discovery/types.d.ts.map +1 -1
- package/dist/lib/discovery/types.js +2 -1
- package/dist/lib/discovery/types.js.map +1 -1
- package/dist/lib/discovery/validate-adagents.d.ts +114 -0
- package/dist/lib/discovery/validate-adagents.d.ts.map +1 -0
- package/dist/lib/discovery/validate-adagents.js +417 -0
- package/dist/lib/discovery/validate-adagents.js.map +1 -0
- package/dist/lib/errors/index.d.ts +42 -5
- package/dist/lib/errors/index.d.ts.map +1 -1
- package/dist/lib/errors/index.js +64 -9
- package/dist/lib/errors/index.js.map +1 -1
- package/dist/lib/index.d.ts +3 -1
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +17 -10
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/protocols/a2a.d.ts.map +1 -1
- package/dist/lib/protocols/a2a.js +70 -11
- package/dist/lib/protocols/a2a.js.map +1 -1
- package/dist/lib/protocols/mcp.d.ts.map +1 -1
- package/dist/lib/protocols/mcp.js +61 -5
- package/dist/lib/protocols/mcp.js.map +1 -1
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/signing/fetch-async.d.ts.map +1 -1
- package/dist/lib/signing/fetch-async.js +5 -0
- package/dist/lib/signing/fetch-async.js.map +1 -1
- package/dist/lib/signing/fetch.d.ts.map +1 -1
- package/dist/lib/signing/fetch.js +11 -0
- package/dist/lib/signing/fetch.js.map +1 -1
- package/dist/lib/testing/client.d.ts +16 -2
- 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 +17 -2
- package/dist/lib/testing/compliance/comply.d.ts.map +1 -1
- package/dist/lib/testing/compliance/comply.js +38 -0
- package/dist/lib/testing/compliance/comply.js.map +1 -1
- package/dist/lib/testing/compliance/spec-conformance.d.ts.map +1 -1
- package/dist/lib/testing/compliance/spec-conformance.js +1 -0
- package/dist/lib/testing/compliance/spec-conformance.js.map +1 -1
- package/dist/lib/testing/compliance/types.d.ts +11 -0
- package/dist/lib/testing/compliance/types.d.ts.map +1 -1
- package/dist/lib/testing/index.d.ts +1 -1
- package/dist/lib/testing/index.d.ts.map +1 -1
- package/dist/lib/testing/index.js.map +1 -1
- package/dist/lib/testing/storyboard/default-invariants.js +21 -2
- package/dist/lib/testing/storyboard/default-invariants.js.map +1 -1
- package/dist/lib/testing/storyboard/index.d.ts +1 -1
- package/dist/lib/testing/storyboard/index.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/index.js.map +1 -1
- package/dist/lib/testing/storyboard/runner.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/runner.js +284 -16
- package/dist/lib/testing/storyboard/runner.js.map +1 -1
- package/dist/lib/testing/storyboard/types.d.ts +112 -1
- package/dist/lib/testing/storyboard/types.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/types.js +1 -0
- package/dist/lib/testing/storyboard/types.js.map +1 -1
- package/dist/lib/utils/response-unwrapper.d.ts +33 -0
- package/dist/lib/utils/response-unwrapper.d.ts.map +1 -1
- package/dist/lib/utils/response-unwrapper.js +41 -3
- package/dist/lib/utils/response-unwrapper.js.map +1 -1
- package/dist/lib/version.d.ts +10 -6
- package/dist/lib/version.d.ts.map +1 -1
- package/dist/lib/version.js +11 -4
- package/dist/lib/version.js.map +1 -1
- package/docs/llms.txt +10 -2
- package/package.json +1 -1
- package/skills/call-adcp-agent/SKILL.md +1 -1
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* 4. Building property → agents mapping
|
|
9
9
|
*/
|
|
10
10
|
import { type LogLevel } from '../utils/logger';
|
|
11
|
-
import type { Property } from './types';
|
|
11
|
+
import type { Property, AdAgentsJson } from './types';
|
|
12
12
|
export interface AgentInfo {
|
|
13
13
|
agent_url: string;
|
|
14
14
|
protocol?: 'a2a' | 'mcp';
|
|
@@ -51,6 +51,15 @@ export declare class PropertyCrawler {
|
|
|
51
51
|
*/
|
|
52
52
|
fetchPublisherProperties(domains: string[]): Promise<{
|
|
53
53
|
properties: Record<string, Property[]>;
|
|
54
|
+
/**
|
|
55
|
+
* Raw `AdAgentsJson` per fetched domain. `PropertyCrawler.crawlAgents`
|
|
56
|
+
* needs `authorized_agents[]` (with their per-entry selectors) to do
|
|
57
|
+
* spec-correct per-agent attribution — the `properties` array alone
|
|
58
|
+
* doesn't carry the discriminator. Kept on a side map (instead of
|
|
59
|
+
* widening `properties`) so external callers that only consume
|
|
60
|
+
* `properties` keep the same shape.
|
|
61
|
+
*/
|
|
62
|
+
adAgents: Record<string, AdAgentsJson>;
|
|
54
63
|
warnings: Array<{
|
|
55
64
|
domain: string;
|
|
56
65
|
message: string;
|
|
@@ -77,6 +86,9 @@ export declare class PropertyCrawler {
|
|
|
77
86
|
*/
|
|
78
87
|
fetchAdAgentsJson(domain: string): Promise<{
|
|
79
88
|
properties: Property[];
|
|
89
|
+
/** Raw parsed adagents.json — needed for per-agent property resolution
|
|
90
|
+
* (#1721). Omitted when the response wasn't a parseable adagents.json. */
|
|
91
|
+
adAgents?: AdAgentsJson;
|
|
80
92
|
warning?: string;
|
|
81
93
|
}>;
|
|
82
94
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property-crawler.d.ts","sourceRoot":"","sources":["../../../src/lib/discovery/property-crawler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAK9D,OAAO,KAAK,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"property-crawler.d.ts","sourceRoot":"","sources":["../../../src/lib/discovery/property-crawler.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAK9D,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAYtD,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CA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C;QACxB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IAKF;;;;;;OAMG;YACW,wBAAwB;CAsJvC"}
|
|
@@ -17,6 +17,7 @@ const version_1 = require("../version");
|
|
|
17
17
|
const validate_user_agent_1 = require("../utils/validate-user-agent");
|
|
18
18
|
const ssrf_fetch_1 = require("../net/ssrf-fetch");
|
|
19
19
|
const probe_policy_1 = require("../utils/probe-policy");
|
|
20
|
+
const resolve_agent_properties_1 = require("./resolve-agent-properties");
|
|
20
21
|
/**
|
|
21
22
|
* Cap on a single adagents.json response body. The published advertising
|
|
22
23
|
* networks we've sampled (CNN, Hearst, etc.) all sit well under 64 KiB;
|
|
@@ -79,20 +80,40 @@ class PropertyCrawler {
|
|
|
79
80
|
}
|
|
80
81
|
result.totalPublisherDomains = allPublisherDomains.size;
|
|
81
82
|
// Step 2: Fetch adagents.json from each unique publisher domain
|
|
82
|
-
const { properties: domainProperties, warnings } = await this.fetchPublisherProperties(Array.from(allPublisherDomains));
|
|
83
|
+
const { properties: domainProperties, adAgents: domainAdAgents, warnings, } = await this.fetchPublisherProperties(Array.from(allPublisherDomains));
|
|
83
84
|
result.warnings = warnings;
|
|
84
|
-
// Step 3: Build property → agents index
|
|
85
|
+
// Step 3: Build property → agents index. Per the AdCP schema
|
|
86
|
+
// (`adagents.json` — `authorized_agents[].authorization_type` +
|
|
87
|
+
// selector), which top-level properties an agent gets is a function
|
|
88
|
+
// of its entry in the file, NOT the file's mere presence. We dispatch
|
|
89
|
+
// through `resolveAgentProperties` to honor the per-agent selectors
|
|
90
|
+
// (`property_ids`, `property_tags`, `inline_properties`).
|
|
91
|
+
//
|
|
92
|
+
// Fallback: if the crawler had to infer a default property because
|
|
93
|
+
// the file declared `authorized_agents` but no `properties` array
|
|
94
|
+
// (graceful-degradation branch in `fetchAdAgentsJsonFromUrl`), the
|
|
95
|
+
// raw `AdAgentsJson` is intentionally NOT in `domainAdAgents` — we
|
|
96
|
+
// attribute the inferred property to every claiming agent (pre-#1721
|
|
97
|
+
// behavior). The file simply isn't strict-conformant enough to
|
|
98
|
+
// dispatch on.
|
|
85
99
|
for (const [domain, properties] of Object.entries(domainProperties)) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
100
|
+
const claimingAgents = agents
|
|
101
|
+
.map(a => a.agent_url)
|
|
102
|
+
.filter(agentUrl => {
|
|
103
|
+
const auth = index.getAgentAuthorizations(agentUrl);
|
|
104
|
+
return auth?.publisher_domains.includes(domain);
|
|
105
|
+
});
|
|
106
|
+
const adAgentsFile = domainAdAgents[domain];
|
|
107
|
+
for (const agentUrl of claimingAgents) {
|
|
108
|
+
let attributable;
|
|
109
|
+
if (adAgentsFile) {
|
|
110
|
+
const scope = (0, resolve_agent_properties_1.resolveAgentProperties)(adAgentsFile, agentUrl);
|
|
111
|
+
attributable = scope.properties;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
attributable = properties;
|
|
115
|
+
}
|
|
116
|
+
for (const property of attributable) {
|
|
96
117
|
index.addProperty(property, agentUrl, domain);
|
|
97
118
|
result.totalProperties++;
|
|
98
119
|
}
|
|
@@ -129,13 +150,17 @@ class PropertyCrawler {
|
|
|
129
150
|
*/
|
|
130
151
|
async fetchPublisherProperties(domains) {
|
|
131
152
|
const result = {};
|
|
153
|
+
const adAgents = {};
|
|
132
154
|
const warnings = [];
|
|
133
155
|
await Promise.all(domains.map(async (domain) => {
|
|
134
156
|
try {
|
|
135
|
-
const { properties, warning } = await this.fetchAdAgentsJson(domain);
|
|
157
|
+
const { properties, warning, adAgents: raw } = await this.fetchAdAgentsJson(domain);
|
|
136
158
|
if (properties.length > 0) {
|
|
137
159
|
result[domain] = properties;
|
|
138
160
|
}
|
|
161
|
+
if (raw) {
|
|
162
|
+
adAgents[domain] = raw;
|
|
163
|
+
}
|
|
139
164
|
if (warning) {
|
|
140
165
|
warnings.push({ domain, message: warning });
|
|
141
166
|
}
|
|
@@ -152,7 +177,7 @@ class PropertyCrawler {
|
|
|
152
177
|
}
|
|
153
178
|
}
|
|
154
179
|
}));
|
|
155
|
-
return { properties: result, warnings };
|
|
180
|
+
return { properties: result, adAgents, warnings };
|
|
156
181
|
}
|
|
157
182
|
/**
|
|
158
183
|
* Expected failure patterns for .well-known/adagents.json fetches.
|
|
@@ -297,6 +322,7 @@ class PropertyCrawler {
|
|
|
297
322
|
}
|
|
298
323
|
return {
|
|
299
324
|
properties: normalized,
|
|
325
|
+
adAgents: data,
|
|
300
326
|
...(skipped > 0 && {
|
|
301
327
|
warning: `Skipped ${skipped} ${skipped === 1 ? 'property' : 'properties'} with missing or empty identifiers`,
|
|
302
328
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property-crawler.js","sourceRoot":"","sources":["../../../src/lib/discovery/property-crawler.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,iEAA8D;AAC9D,qDAAoD;AACpD,4CAA8D;AAC9D,wCAA6C;AAC7C,sEAAiE;AACjE,kDAAkH;AAClH,wDAAgE;
|
|
1
|
+
{"version":3,"file":"property-crawler.js","sourceRoot":"","sources":["../../../src/lib/discovery/property-crawler.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,iEAA8D;AAC9D,qDAAoD;AACpD,4CAA8D;AAC9D,wCAA6C;AAC7C,sEAAiE;AACjE,kDAAkH;AAClH,wDAAgE;AAEhE,yEAAoE;AAEpE;;;;;;GAMG;AACH,MAAM,uBAAuB,GAAG,GAAG,GAAG,IAAI,CAAC;AAwB3C,MAAa,eAAe;IAClB,MAAM,CAAkC;IACxC,SAAS,CAAU;IAE3B,YAAY,MAA8B;QACxC,IAAI,CAAC,MAAM,GAAG,IAAA,qBAAY,EAAC;YACzB,KAAK,EAAE,MAAM,EAAE,QAAQ,IAAI,MAAM;SAClC,CAAC,CAAC,KAAK,CAAC,iBA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ACX,CAAC;gBACD,UAAU,CAAC,IAAI,CAAC;oBACd,GAAG,IAAI;oBACP,WAAW,EAAE,gBAAgB;oBAC7B,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,IAAI,cAAc;iBAC1D,CAAC,CAAC;YACL,CAAC;YAED,OAAO;gBACL,UAAU,EAAE,UAAU;gBACtB,QAAQ,EAAE,IAAI;gBACd,GAAG,CAAC,OAAO,GAAG,CAAC,IAAI;oBACjB,OAAO,EAAE,WAAW,OAAO,IAAI,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,oCAAoC;iBAC7G,CAAC;aACH,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,oEAAoE;YACpE,qEAAqE;YACrE,kEAAkE;YAClE,oEAAoE;YACpE,6CAA6C;YAC7C,IAAI,KAAK,YAAY,6BAAgB,IAAI,CAAC,iCAAoB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC/E,MAAM,IAAI,KAAK,CAAC,iDAAiD,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACpF,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,kCAAkC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC9G,CAAC;IACH,CAAC;;AAjYH,0CAkYC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-agent property resolution for `adagents.json` (adcp-client#1721).
|
|
3
|
+
*
|
|
4
|
+
* The schema (`schemas/cache/3.0.11/adagents.json`) requires every
|
|
5
|
+
* `authorized_agents[]` entry to carry `authorization_type` + the matching
|
|
6
|
+
* selector field. Which top-level `properties[]` an agent is authorized
|
|
7
|
+
* for is a function of that discriminator + selector — NOT a property of
|
|
8
|
+
* presence-in-the-list (the pre-#1721 SDK bug).
|
|
9
|
+
*
|
|
10
|
+
* This resolver dispatches on `authorization_type`:
|
|
11
|
+
*
|
|
12
|
+
* - `property_ids` → filter top-level `properties[]` by `property_id`
|
|
13
|
+
* - `property_tags` → filter top-level `properties[]` by tag intersection
|
|
14
|
+
* - `inline_properties` → return the agent entry's own `properties[]`
|
|
15
|
+
* - `publisher_properties` → cross-publisher; returned as `cross_publisher`
|
|
16
|
+
* for the caller to resolve against other publishers' adagents.json
|
|
17
|
+
* - `signal_ids` / `signal_tags` → signals agents; no property output
|
|
18
|
+
*
|
|
19
|
+
* Mirrors the Python SDK's `_resolve_agent_properties` (adcp-client-python).
|
|
20
|
+
* Fails closed: entries without `authorization_type` or with a missing
|
|
21
|
+
* selector return zero properties — matching the Python SDK and the
|
|
22
|
+
* schema's strict-conformance position. The pre-fix TS behavior of
|
|
23
|
+
* attributing every property to every listed agent is gone.
|
|
24
|
+
*/
|
|
25
|
+
import type { AdAgentsJson, AuthorizedAgent, Property, PublisherPropertySelector } from './types';
|
|
26
|
+
/**
|
|
27
|
+
* Result of resolving a single agent's authorization scope against an
|
|
28
|
+
* `adagents.json` file. `properties` are the locally-resolved entries
|
|
29
|
+
* (in-file). `cross_publisher` selectors point at other publishers'
|
|
30
|
+
* files; resolving them to concrete `Property` objects requires
|
|
31
|
+
* fetching those publishers' adagents.json separately. `unresolvable`
|
|
32
|
+
* communicates why the agent's scope is empty when it is.
|
|
33
|
+
*/
|
|
34
|
+
export interface ResolvedAgentScope {
|
|
35
|
+
/** Locally-resolved properties (subset of top-level `properties[]`, or inline). */
|
|
36
|
+
properties: Property[];
|
|
37
|
+
/** Cross-publisher selectors the caller must resolve against other files. */
|
|
38
|
+
cross_publisher: PublisherPropertySelector[];
|
|
39
|
+
/** The matched agent entry, or `undefined` if no entry matched the agent URL. */
|
|
40
|
+
matched_entry?: AuthorizedAgent;
|
|
41
|
+
/** Why the resolution returned an empty result, when it did. */
|
|
42
|
+
unresolvable?: ResolveUnresolvableReason;
|
|
43
|
+
}
|
|
44
|
+
export type ResolveUnresolvableReason =
|
|
45
|
+
/** The agent URL is not listed in `authorized_agents[]` at all. */
|
|
46
|
+
'agent_not_listed'
|
|
47
|
+
/** Entry exists but has no `authorization_type` discriminator. */
|
|
48
|
+
| 'missing_authorization_type'
|
|
49
|
+
/** Entry has an `authorization_type` we do not recognize. */
|
|
50
|
+
| 'unknown_authorization_type'
|
|
51
|
+
/** Entry has a known `authorization_type` but the matching selector is missing/empty. */
|
|
52
|
+
| 'missing_selector'
|
|
53
|
+
/** Selector resolved to no properties (e.g., `property_ids` matched no top-level entry). */
|
|
54
|
+
| 'no_match'
|
|
55
|
+
/** Entry uses a signals authorization type — no property output is appropriate. */
|
|
56
|
+
| 'signals_only';
|
|
57
|
+
/**
|
|
58
|
+
* Canonicalize an agent URL for `authorized_agents[].url` comparison per
|
|
59
|
+
* the AdCP URL canonicalization rules
|
|
60
|
+
* (https://adcontextprotocol.org/docs/reference/url-canonicalization).
|
|
61
|
+
* Returns the canonical string or `null` if the input is unparseable.
|
|
62
|
+
*
|
|
63
|
+
* The full 8-step canonicalization (Punycode, percent-encoding decode,
|
|
64
|
+
* `remove_dot_segments`, etc.) is delegated to Node's WHATWG URL parser
|
|
65
|
+
* for most rules; this helper layers on the SDK-specific bits the parser
|
|
66
|
+
* doesn't do automatically: default-port stripping (already done by
|
|
67
|
+
* `URL.host`), unreserved-char percent-decoding, and fragment strip.
|
|
68
|
+
*
|
|
69
|
+
* Exported for callers building their own per-agent matching outside the
|
|
70
|
+
* resolver — e.g., TMP `seller_agent_url` validation.
|
|
71
|
+
*/
|
|
72
|
+
export declare function canonicalizeAgentUrl(raw: string): string | null;
|
|
73
|
+
/**
|
|
74
|
+
* Resolve `agentUrl`'s authorization scope against an `adagents.json`
|
|
75
|
+
* file. The lookup uses canonicalized URL comparison — two URLs
|
|
76
|
+
* differing only in case, default port, percent-encoding of unreserved
|
|
77
|
+
* chars, or fragment are the same agent.
|
|
78
|
+
*
|
|
79
|
+
* Returns `{ properties: [], cross_publisher: [], unresolvable: '...' }`
|
|
80
|
+
* (never throws) when the agent isn't listed, when its entry is
|
|
81
|
+
* malformed, or when the agent uses a signals authorization type.
|
|
82
|
+
*/
|
|
83
|
+
export declare function resolveAgentProperties(adAgents: AdAgentsJson, agentUrl: string): ResolvedAgentScope;
|
|
84
|
+
/**
|
|
85
|
+
* Convenience: list every locally-resolvable (`agent_url` →
|
|
86
|
+
* `Property[]`) pair from an `adagents.json` file. Agents listed with
|
|
87
|
+
* `signal_ids` / `signal_tags` or with no `authorization_type` are
|
|
88
|
+
* absent from the result. `publisher_properties` cross-references are
|
|
89
|
+
* reported separately so the caller can resolve them against other
|
|
90
|
+
* publishers' files.
|
|
91
|
+
*/
|
|
92
|
+
export declare function listAgentPropertyMap(adAgents: AdAgentsJson): {
|
|
93
|
+
byAgent: Map<string, Property[]>;
|
|
94
|
+
unresolved: Array<{
|
|
95
|
+
agent_url: string;
|
|
96
|
+
reason: ResolveUnresolvableReason;
|
|
97
|
+
}>;
|
|
98
|
+
cross_publisher: Array<{
|
|
99
|
+
agent_url: string;
|
|
100
|
+
selectors: PublisherPropertySelector[];
|
|
101
|
+
}>;
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=resolve-agent-properties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-agent-properties.d.ts","sourceRoot":"","sources":["../../../src/lib/discovery/resolve-agent-properties.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAqB,QAAQ,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAErH;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB;IACjC,mFAAmF;IACnF,UAAU,EAAE,QAAQ,EAAE,CAAC;IACvB,6EAA6E;IAC7E,eAAe,EAAE,yBAAyB,EAAE,CAAC;IAC7C,iFAAiF;IACjF,aAAa,CAAC,EAAE,eAAe,CAAC;IAChC,gEAAgE;IAChE,YAAY,CAAC,EAAE,yBAAyB,CAAC;CAC1C;AAED,MAAM,MAAM,yBAAyB;AACnC,mEAAmE;AACjE,kBAAkB;AACpB,kEAAkE;GAChE,4BAA4B;AAC9B,6DAA6D;GAC3D,4BAA4B;AAC9B,yFAAyF;GACvF,kBAAkB;AACpB,4FAA4F;GAC1F,UAAU;AACZ,mFAAmF;GACjF,cAAc,CAAC;AAEnB;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAmB/D;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,GAAG,kBAAkB,CAkFnG;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,YAAY,GAAG;IAC5D,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IACjC,UAAU,EAAE,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,yBAAyB,CAAA;KAAE,CAAC,CAAC;IAC5E,eAAe,EAAE,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,yBAAyB,EAAE,CAAA;KAAE,CAAC,CAAC;CACvF,CAuBA"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.canonicalizeAgentUrl = canonicalizeAgentUrl;
|
|
4
|
+
exports.resolveAgentProperties = resolveAgentProperties;
|
|
5
|
+
exports.listAgentPropertyMap = listAgentPropertyMap;
|
|
6
|
+
/**
|
|
7
|
+
* Canonicalize an agent URL for `authorized_agents[].url` comparison per
|
|
8
|
+
* the AdCP URL canonicalization rules
|
|
9
|
+
* (https://adcontextprotocol.org/docs/reference/url-canonicalization).
|
|
10
|
+
* Returns the canonical string or `null` if the input is unparseable.
|
|
11
|
+
*
|
|
12
|
+
* The full 8-step canonicalization (Punycode, percent-encoding decode,
|
|
13
|
+
* `remove_dot_segments`, etc.) is delegated to Node's WHATWG URL parser
|
|
14
|
+
* for most rules; this helper layers on the SDK-specific bits the parser
|
|
15
|
+
* doesn't do automatically: default-port stripping (already done by
|
|
16
|
+
* `URL.host`), unreserved-char percent-decoding, and fragment strip.
|
|
17
|
+
*
|
|
18
|
+
* Exported for callers building their own per-agent matching outside the
|
|
19
|
+
* resolver — e.g., TMP `seller_agent_url` validation.
|
|
20
|
+
*/
|
|
21
|
+
function canonicalizeAgentUrl(raw) {
|
|
22
|
+
if (typeof raw !== 'string' || raw.length === 0)
|
|
23
|
+
return null;
|
|
24
|
+
let parsed;
|
|
25
|
+
try {
|
|
26
|
+
parsed = new URL(raw);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
// Reject userinfo per the spec's step 3.
|
|
32
|
+
if (parsed.username || parsed.password)
|
|
33
|
+
return null;
|
|
34
|
+
// Reject non-http(s) schemes — `adagents.json` agent URLs are HTTPS-only
|
|
35
|
+
// in production, but we accept `http://` here so loopback fixtures parse.
|
|
36
|
+
if (parsed.protocol !== 'https:' && parsed.protocol !== 'http:')
|
|
37
|
+
return null;
|
|
38
|
+
// `URL.host` already strips default ports and lowercases the hostname.
|
|
39
|
+
// Use `protocol + host` (NOT `origin`) so the assembled string keeps
|
|
40
|
+
// the IDN-A-label form Node produces.
|
|
41
|
+
const path = decodeUnreservedPercentEncoding(parsed.pathname);
|
|
42
|
+
const query = parsed.search ? decodeUnreservedPercentEncoding(parsed.search) : '';
|
|
43
|
+
return `${parsed.protocol}//${parsed.host}${path}${query}`;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Resolve `agentUrl`'s authorization scope against an `adagents.json`
|
|
47
|
+
* file. The lookup uses canonicalized URL comparison — two URLs
|
|
48
|
+
* differing only in case, default port, percent-encoding of unreserved
|
|
49
|
+
* chars, or fragment are the same agent.
|
|
50
|
+
*
|
|
51
|
+
* Returns `{ properties: [], cross_publisher: [], unresolvable: '...' }`
|
|
52
|
+
* (never throws) when the agent isn't listed, when its entry is
|
|
53
|
+
* malformed, or when the agent uses a signals authorization type.
|
|
54
|
+
*/
|
|
55
|
+
function resolveAgentProperties(adAgents, agentUrl) {
|
|
56
|
+
const wanted = canonicalizeAgentUrl(agentUrl);
|
|
57
|
+
if (!wanted) {
|
|
58
|
+
return { properties: [], cross_publisher: [], unresolvable: 'agent_not_listed' };
|
|
59
|
+
}
|
|
60
|
+
const entries = Array.isArray(adAgents.authorized_agents) ? adAgents.authorized_agents : [];
|
|
61
|
+
const entry = entries.find(e => {
|
|
62
|
+
if (!e || typeof e.url !== 'string')
|
|
63
|
+
return false;
|
|
64
|
+
const canon = canonicalizeAgentUrl(e.url);
|
|
65
|
+
return canon !== null && canon === wanted;
|
|
66
|
+
});
|
|
67
|
+
if (!entry) {
|
|
68
|
+
return { properties: [], cross_publisher: [], unresolvable: 'agent_not_listed' };
|
|
69
|
+
}
|
|
70
|
+
const authType = entry.authorization_type;
|
|
71
|
+
if (!authType) {
|
|
72
|
+
return { properties: [], cross_publisher: [], matched_entry: entry, unresolvable: 'missing_authorization_type' };
|
|
73
|
+
}
|
|
74
|
+
const allProperties = Array.isArray(adAgents.properties) ? adAgents.properties : [];
|
|
75
|
+
switch (authType) {
|
|
76
|
+
case 'property_ids': {
|
|
77
|
+
const ids = entry.property_ids;
|
|
78
|
+
if (!Array.isArray(ids) || ids.length === 0) {
|
|
79
|
+
return { properties: [], cross_publisher: [], matched_entry: entry, unresolvable: 'missing_selector' };
|
|
80
|
+
}
|
|
81
|
+
const idSet = new Set(ids);
|
|
82
|
+
const matched = allProperties.filter(p => p.property_id !== undefined && idSet.has(p.property_id));
|
|
83
|
+
return {
|
|
84
|
+
properties: matched,
|
|
85
|
+
cross_publisher: [],
|
|
86
|
+
matched_entry: entry,
|
|
87
|
+
...(matched.length === 0 ? { unresolvable: 'no_match' } : {}),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
case 'property_tags': {
|
|
91
|
+
const tags = entry.property_tags;
|
|
92
|
+
if (!Array.isArray(tags) || tags.length === 0) {
|
|
93
|
+
return { properties: [], cross_publisher: [], matched_entry: entry, unresolvable: 'missing_selector' };
|
|
94
|
+
}
|
|
95
|
+
const tagSet = new Set(tags);
|
|
96
|
+
const matched = allProperties.filter(p => Array.isArray(p.tags) && p.tags.some(t => tagSet.has(t)));
|
|
97
|
+
return {
|
|
98
|
+
properties: matched,
|
|
99
|
+
cross_publisher: [],
|
|
100
|
+
matched_entry: entry,
|
|
101
|
+
...(matched.length === 0 ? { unresolvable: 'no_match' } : {}),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
case 'inline_properties': {
|
|
105
|
+
const inline = entry.properties;
|
|
106
|
+
if (!Array.isArray(inline) || inline.length === 0) {
|
|
107
|
+
return { properties: [], cross_publisher: [], matched_entry: entry, unresolvable: 'missing_selector' };
|
|
108
|
+
}
|
|
109
|
+
return { properties: inline, cross_publisher: [], matched_entry: entry };
|
|
110
|
+
}
|
|
111
|
+
case 'publisher_properties': {
|
|
112
|
+
const selectors = entry.publisher_properties;
|
|
113
|
+
if (!Array.isArray(selectors) || selectors.length === 0) {
|
|
114
|
+
return { properties: [], cross_publisher: [], matched_entry: entry, unresolvable: 'missing_selector' };
|
|
115
|
+
}
|
|
116
|
+
return { properties: [], cross_publisher: selectors, matched_entry: entry };
|
|
117
|
+
}
|
|
118
|
+
case 'signal_ids':
|
|
119
|
+
case 'signal_tags':
|
|
120
|
+
return { properties: [], cross_publisher: [], matched_entry: entry, unresolvable: 'signals_only' };
|
|
121
|
+
default:
|
|
122
|
+
// Exhaustiveness guard — if a new authorization_type lands on
|
|
123
|
+
// `AuthorizationType` without a branch here, TS won't compile.
|
|
124
|
+
// For runtime files carrying a string we don't recognize, return
|
|
125
|
+
// `unknown_authorization_type`.
|
|
126
|
+
return { properties: [], cross_publisher: [], matched_entry: entry, unresolvable: 'unknown_authorization_type' };
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Convenience: list every locally-resolvable (`agent_url` →
|
|
131
|
+
* `Property[]`) pair from an `adagents.json` file. Agents listed with
|
|
132
|
+
* `signal_ids` / `signal_tags` or with no `authorization_type` are
|
|
133
|
+
* absent from the result. `publisher_properties` cross-references are
|
|
134
|
+
* reported separately so the caller can resolve them against other
|
|
135
|
+
* publishers' files.
|
|
136
|
+
*/
|
|
137
|
+
function listAgentPropertyMap(adAgents) {
|
|
138
|
+
const byAgent = new Map();
|
|
139
|
+
const unresolved = [];
|
|
140
|
+
const cross_publisher = [];
|
|
141
|
+
const entries = Array.isArray(adAgents.authorized_agents) ? adAgents.authorized_agents : [];
|
|
142
|
+
for (const entry of entries) {
|
|
143
|
+
if (!entry || typeof entry.url !== 'string')
|
|
144
|
+
continue;
|
|
145
|
+
const scope = resolveAgentProperties(adAgents, entry.url);
|
|
146
|
+
const canon = canonicalizeAgentUrl(entry.url);
|
|
147
|
+
const key = canon ?? entry.url;
|
|
148
|
+
if (scope.properties.length > 0) {
|
|
149
|
+
byAgent.set(key, scope.properties);
|
|
150
|
+
}
|
|
151
|
+
if (scope.cross_publisher.length > 0) {
|
|
152
|
+
cross_publisher.push({ agent_url: key, selectors: scope.cross_publisher });
|
|
153
|
+
}
|
|
154
|
+
if (scope.unresolvable && scope.properties.length === 0 && scope.cross_publisher.length === 0) {
|
|
155
|
+
unresolved.push({ agent_url: key, reason: scope.unresolvable });
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return { byAgent, unresolved, cross_publisher };
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* RFC 3986 §6.2.2.2: decode percent-encoded triplets that map to
|
|
162
|
+
* unreserved characters (`ALPHA / DIGIT / "-" / "." / "_" / "~"`).
|
|
163
|
+
* Leaves reserved characters and non-unreserved encodings byte-for-byte.
|
|
164
|
+
*
|
|
165
|
+
* Vendored from `src/lib/signing/canonicalize.ts` to keep this file
|
|
166
|
+
* dependency-free of the signing module (which is the source for
|
|
167
|
+
* request-signing canonicalization, not authorization).
|
|
168
|
+
*/
|
|
169
|
+
function decodeUnreservedPercentEncoding(input) {
|
|
170
|
+
return input.replace(/%([0-9a-fA-F]{2})/g, (match, hex) => {
|
|
171
|
+
const code = parseInt(hex, 16);
|
|
172
|
+
const isUnreserved = (code >= 0x41 && code <= 0x5a) || // A–Z
|
|
173
|
+
(code >= 0x61 && code <= 0x7a) || // a–z
|
|
174
|
+
(code >= 0x30 && code <= 0x39) || // 0–9
|
|
175
|
+
code === 0x2d || // '-'
|
|
176
|
+
code === 0x2e || // '.'
|
|
177
|
+
code === 0x5f || // '_'
|
|
178
|
+
code === 0x7e; // '~'
|
|
179
|
+
return isUnreserved ? String.fromCharCode(code) : match.toUpperCase();
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=resolve-agent-properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-agent-properties.js","sourceRoot":"","sources":["../../../src/lib/discovery/resolve-agent-properties.ts"],"names":[],"mappings":";;AA0EA,oDAmBC;AAYD,wDAkFC;AAUD,oDA2BC;AArKD;;;;;;;;;;;;;;GAcG;AACH,SAAgB,oBAAoB,CAAC,GAAW;IAC9C,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7D,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,yCAAyC;IACzC,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,C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E,GAAW,EAAE,EAAE;QAChE,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAC/B,MAAM,YAAY,GAChB,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,MAAM;YACxC,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,MAAM;YACxC,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,MAAM;YACxC,IAAI,KAAK,IAAI,IAAI,MAAM;YACvB,IAAI,KAAK,IAAI,IAAI,MAAM;YACvB,IAAI,KAAK,IAAI,IAAI,MAAM;YACvB,IAAI,KAAK,IAAI,CAAC,CAAC,MAAM;QACvB,OAAO,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;IACxE,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Property Discovery Types
|
|
3
|
-
*
|
|
3
|
+
* Aligned with the AdCP `adagents.json` schema at
|
|
4
|
+
* `schemas/cache/3.0.11/adagents.json`.
|
|
4
5
|
*/
|
|
5
6
|
/** Property identifier types from AdCP spec */
|
|
6
7
|
export type PropertyIdentifierType = 'domain' | 'subdomain' | 'ios_bundle' | 'android_package' | 'apple_app_store_id' | 'google_play_id' | 'amazon_app_store_id' | 'roku_channel_id' | 'samsung_app_id' | 'lg_channel_id' | 'vizio_app_id' | 'fire_tv_app_id' | 'dooh_venue_id' | 'podcast_rss_feed' | 'spotify_show_id' | 'apple_podcast_id' | 'iab_tech_lab_domain_id' | 'custom';
|
|
@@ -20,11 +21,49 @@ export interface Property {
|
|
|
20
21
|
tags?: string[];
|
|
21
22
|
publisher_domain?: string;
|
|
22
23
|
}
|
|
23
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Discriminator for the per-agent authorization scope on each
|
|
26
|
+
* `authorized_agents[]` entry. Drives `resolveAgentProperties()` —
|
|
27
|
+
* see `src/lib/discovery/resolve-agent-properties.ts`.
|
|
28
|
+
*/
|
|
29
|
+
export type AuthorizationType = 'property_ids' | 'property_tags' | 'inline_properties' | 'publisher_properties' | 'signal_ids' | 'signal_tags';
|
|
30
|
+
/**
|
|
31
|
+
* Cross-publisher selector used by `authorization_type: 'publisher_properties'`.
|
|
32
|
+
* Each entry references properties from a different publisher's adagents.json
|
|
33
|
+
* (resolving the actual `Property` objects requires fetching that publisher's
|
|
34
|
+
* file separately).
|
|
35
|
+
*/
|
|
36
|
+
export interface PublisherPropertySelector {
|
|
37
|
+
publisher_domain: string;
|
|
38
|
+
selection_type: 'all' | 'by_id' | 'by_tag';
|
|
39
|
+
property_ids?: string[];
|
|
40
|
+
property_tags?: string[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Entry in `adagents.json` `authorized_agents[]`. The schema requires
|
|
44
|
+
* every entry to carry `authorization_type` plus the matching selector
|
|
45
|
+
* field — see the spec at `schemas/cache/3.0.11/adagents.json`. Files
|
|
46
|
+
* in the wild sometimes omit them, so both fields are typed as optional
|
|
47
|
+
* here. `resolveAgentProperties()` fails closed (returns no properties)
|
|
48
|
+
* when the discriminator or its selector is missing.
|
|
49
|
+
*/
|
|
24
50
|
export interface AuthorizedAgent {
|
|
25
51
|
url: string;
|
|
26
52
|
authorized_for: string;
|
|
53
|
+
/** Discriminator. Required by the schema; absent in pre-schema-3 files. */
|
|
54
|
+
authorization_type?: AuthorizationType;
|
|
55
|
+
/** Selector for `authorization_type: 'property_ids'`. */
|
|
27
56
|
property_ids?: string[];
|
|
57
|
+
/** Selector for `authorization_type: 'property_tags'`. */
|
|
58
|
+
property_tags?: string[];
|
|
59
|
+
/** Selector for `authorization_type: 'inline_properties'`. */
|
|
60
|
+
properties?: Property[];
|
|
61
|
+
/** Selector for `authorization_type: 'publisher_properties'`. */
|
|
62
|
+
publisher_properties?: PublisherPropertySelector[];
|
|
63
|
+
/** Selector for `authorization_type: 'signal_ids'` (signals agents). */
|
|
64
|
+
signal_ids?: string[];
|
|
65
|
+
/** Selector for `authorization_type: 'signal_tags'` (signals agents). */
|
|
66
|
+
signal_tags?: string[];
|
|
28
67
|
}
|
|
29
68
|
/** adagents.json structure */
|
|
30
69
|
export interface AdAgentsJson {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/discovery/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/discovery/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,+CAA+C;AAC/C,MAAM,MAAM,sBAAsB,GAC9B,QAAQ,GACR,WAAW,GACX,YAAY,GACZ,iBAAiB,GACjB,oBAAoB,GACpB,gBAAgB,GAChB,qBAAqB,GACrB,iBAAiB,GACjB,gBAAgB,GAChB,eAAe,GACf,cAAc,GACd,gBAAgB,GAChB,eAAe,GACf,kBAAkB,GAClB,iBAAiB,GACjB,kBAAkB,GAClB,wBAAwB,GACxB,QAAQ,CAAC;AAEb,0BAA0B;AAC1B,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,sBAAsB,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qBAAqB;AACrB,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,iBAAiB,CAAC;AAEnH,yDAAyD;AACzD,MAAM,WAAW,QAAQ;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,YAAY,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,kBAAkB,EAAE,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,gBAAgB,CAAC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
4
|
-
*
|
|
4
|
+
* Aligned with the AdCP `adagents.json` schema at
|
|
5
|
+
* `schemas/cache/3.0.11/adagents.json`.
|
|
5
6
|
*/
|
|
6
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
8
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/discovery/types.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/discovery/types.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
|