@adcp/sdk 15.4.0 → 15.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/advanced.d.mts +2 -2
- package/dist/lib/advanced.d.ts +2 -2
- package/dist/lib/advanced.js +8 -2
- package/dist/lib/advanced.mjs +8 -2
- package/dist/lib/core/AgentClient.d.mts +4 -0
- package/dist/lib/core/AgentClient.d.ts +4 -0
- package/dist/lib/core/AgentClient.js +8 -0
- package/dist/lib/core/AgentClient.mjs +8 -0
- package/dist/lib/core/SingleAgentClient.d.mts +154 -0
- package/dist/lib/core/SingleAgentClient.d.ts +154 -0
- package/dist/lib/core/SingleAgentClient.js +661 -23
- package/dist/lib/core/SingleAgentClient.mjs +666 -23
- package/dist/lib/core/agent-discovery-cache.d.mts +103 -0
- package/dist/lib/core/agent-discovery-cache.d.ts +103 -0
- package/dist/lib/core/agent-discovery-cache.js +121 -0
- package/dist/lib/core/agent-discovery-cache.mjs +92 -0
- package/dist/lib/index.d.mts +5 -3
- package/dist/lib/index.d.ts +5 -3
- package/dist/lib/index.js +7 -0
- package/dist/lib/index.mjs +6 -0
- package/dist/lib/protocols/index.d.mts +2 -2
- package/dist/lib/protocols/index.d.ts +2 -2
- package/dist/lib/protocols/index.js +1 -1
- package/dist/lib/protocols/index.mjs +1 -1
- package/dist/lib/protocols/mcp-call-context.d.mts +109 -0
- package/dist/lib/protocols/mcp-call-context.d.ts +109 -0
- package/dist/lib/protocols/mcp-call-context.js +221 -0
- package/dist/lib/protocols/mcp-call-context.mjs +186 -0
- package/dist/lib/protocols/mcp-modern.d.mts +9 -1
- package/dist/lib/protocols/mcp-modern.d.ts +9 -1
- package/dist/lib/protocols/mcp-modern.js +180 -104
- package/dist/lib/protocols/mcp-modern.mjs +193 -104
- package/dist/lib/protocols/mcp-scope.d.mts +15 -0
- package/dist/lib/protocols/mcp-scope.d.ts +15 -0
- package/dist/lib/protocols/mcp.d.mts +4 -2
- package/dist/lib/protocols/mcp.d.ts +4 -2
- package/dist/lib/protocols/mcp.js +178 -154
- package/dist/lib/protocols/mcp.mjs +189 -153
- package/dist/lib/protocols/transportDiagnostics.d.mts +33 -1
- package/dist/lib/protocols/transportDiagnostics.d.ts +33 -1
- package/dist/lib/protocols/transportDiagnostics.js +128 -12
- package/dist/lib/protocols/transportDiagnostics.mjs +128 -12
- package/dist/lib/reporting/gcs/index.d.mts +2 -0
- package/dist/lib/reporting/gcs/index.d.ts +2 -0
- package/dist/lib/reporting/gcs/index.js +3 -0
- package/dist/lib/reporting/gcs/index.mjs +2 -0
- package/dist/lib/reporting/gcs/row-provider.d.mts +32 -0
- package/dist/lib/reporting/gcs/row-provider.d.ts +32 -0
- package/dist/lib/reporting/gcs/row-provider.js +205 -0
- package/dist/lib/reporting/gcs/row-provider.mjs +188 -0
- package/dist/lib/reporting/ledger/change-feed.d.mts +41 -0
- package/dist/lib/reporting/ledger/change-feed.d.ts +41 -0
- package/dist/lib/reporting/ledger/change-feed.js +101 -0
- package/dist/lib/reporting/ledger/change-feed.mjs +74 -0
- package/dist/lib/reporting/ledger/handler.js +22 -8
- package/dist/lib/reporting/ledger/handler.mjs +22 -8
- package/dist/lib/reporting/ledger/index.d.mts +4 -0
- package/dist/lib/reporting/ledger/index.d.ts +4 -0
- package/dist/lib/reporting/ledger/index.js +9 -1
- package/dist/lib/reporting/ledger/index.mjs +4 -0
- package/dist/lib/reporting/ledger/managed-postgres.d.mts +2 -0
- package/dist/lib/reporting/ledger/managed-postgres.d.ts +2 -0
- package/dist/lib/reporting/ledger/managed-postgres.js +21 -1
- package/dist/lib/reporting/ledger/managed-postgres.mjs +21 -1
- package/dist/lib/reporting/ledger/managed.d.mts +9 -0
- package/dist/lib/reporting/ledger/managed.d.ts +9 -0
- package/dist/lib/reporting/ledger/managed.js +18 -0
- package/dist/lib/reporting/ledger/managed.mjs +18 -0
- package/dist/lib/reporting/ledger/postgres.d.mts +175 -0
- package/dist/lib/reporting/ledger/postgres.d.ts +175 -0
- package/dist/lib/reporting/ledger/postgres.js +851 -26
- package/dist/lib/reporting/ledger/postgres.mjs +859 -26
- package/dist/lib/reporting/ledger/producer.js +10 -1
- package/dist/lib/reporting/ledger/producer.mjs +10 -1
- package/dist/lib/reporting/ledger/row-storage-errors.d.mts +7 -0
- package/dist/lib/reporting/ledger/row-storage-errors.d.ts +7 -0
- package/dist/lib/reporting/ledger/row-storage-errors.js +41 -0
- package/dist/lib/reporting/ledger/row-storage-errors.mjs +16 -0
- package/dist/lib/reporting/ledger/row-storage-migration.d.mts +41 -0
- package/dist/lib/reporting/ledger/row-storage-migration.d.ts +41 -0
- package/dist/lib/reporting/ledger/row-storage-migration.js +234 -0
- package/dist/lib/reporting/ledger/row-storage-migration.mjs +208 -0
- package/dist/lib/reporting/ledger/row-storage-object.d.mts +112 -0
- package/dist/lib/reporting/ledger/row-storage-object.d.ts +112 -0
- package/dist/lib/reporting/ledger/row-storage-object.js +281 -0
- package/dist/lib/reporting/ledger/row-storage-object.mjs +239 -0
- package/dist/lib/reporting/ledger/row-storage-provider-io.d.mts +51 -0
- package/dist/lib/reporting/ledger/row-storage-provider-io.d.ts +51 -0
- package/dist/lib/reporting/ledger/row-storage-provider-io.js +152 -0
- package/dist/lib/reporting/ledger/row-storage-provider-io.mjs +119 -0
- package/dist/lib/reporting/ledger/row-storage.d.mts +224 -0
- package/dist/lib/reporting/ledger/row-storage.d.ts +224 -0
- package/dist/lib/reporting/ledger/row-storage.js +692 -0
- package/dist/lib/reporting/ledger/row-storage.mjs +680 -0
- package/dist/lib/reporting/ledger/types.d.mts +8 -0
- package/dist/lib/reporting/ledger/types.d.ts +8 -0
- package/dist/lib/reporting/service/index.d.mts +41 -1
- package/dist/lib/reporting/service/index.d.ts +41 -1
- package/dist/lib/reporting/service/index.js +68 -1
- package/dist/lib/reporting/service/index.mjs +70 -1
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/version.d.mts +3 -3
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/dist/lib/version.mjs +3 -3
- package/docs/README.md +1 -1
- package/docs/TYPE-SUMMARY.md +35 -2
- package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +142 -0
- package/docs/guides/EXISTING-PLATFORM.md +43 -12
- package/docs/guides/REPORTING-LEDGER.md +209 -0
- package/docs/llms.txt +4 -2
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { AdcpCapabilities } from '../utils/capabilities.mjs';
|
|
2
|
+
/** Default freshness window for shared discovery entries. */
|
|
3
|
+
export declare const DEFAULT_AGENT_DISCOVERY_TTL_MS: number;
|
|
4
|
+
/** Upper bound for a configured TTL; shared entries are discovery hints, not durable state. */
|
|
5
|
+
export declare const MAX_AGENT_DISCOVERY_TTL_MS: number;
|
|
6
|
+
/**
|
|
7
|
+
* Endpoint, tool-list and capability evidence for one (agent, caller identity,
|
|
8
|
+
* AdCP version, transport policy) tuple. Entries are plain JSON so a shared
|
|
9
|
+
* cache can live in process memory or an external store.
|
|
10
|
+
*/
|
|
11
|
+
export interface AgentDiscoveryEntry {
|
|
12
|
+
/** MCP endpoint resolved by endpoint discovery (the URL actually serving MCP). */
|
|
13
|
+
endpoint?: {
|
|
14
|
+
agentUri: string;
|
|
15
|
+
mcpEra?: 'legacy' | 'modern';
|
|
16
|
+
/** Epoch milliseconds when this endpoint was observed (may be older than the entry). */
|
|
17
|
+
observedAt?: number;
|
|
18
|
+
};
|
|
19
|
+
/** Capabilities from an authoritative `get_adcp_capabilities` response. Never synthetic. */
|
|
20
|
+
capabilities?: AdcpCapabilities;
|
|
21
|
+
/** `tools/list` input-schema properties keyed by tool name. */
|
|
22
|
+
toolSchemas?: Record<string, Record<string, unknown>>;
|
|
23
|
+
/** Epoch milliseconds when this evidence was observed. */
|
|
24
|
+
observedAt: number;
|
|
25
|
+
/** Epoch milliseconds after which the entry must not be used. Enforced by the SDK on read. */
|
|
26
|
+
expiresAt: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Storage backend for shared discovery entries. Keys are opaque SHA-256
|
|
30
|
+
* digests derived by the SDK; implementations must not interpret them and
|
|
31
|
+
* must return copies (or immutable values) so callers cannot mutate stored
|
|
32
|
+
* entries. Methods may be synchronous or asynchronous.
|
|
33
|
+
*/
|
|
34
|
+
export interface AgentDiscoveryCache {
|
|
35
|
+
get(key: string): AgentDiscoveryEntry | undefined | Promise<AgentDiscoveryEntry | undefined>;
|
|
36
|
+
set(key: string, entry: AgentDiscoveryEntry): void | Promise<void>;
|
|
37
|
+
delete(key: string): void | Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Opt-in sharing of endpoint / `tools/list` / `get_adcp_capabilities`
|
|
41
|
+
* discovery across `SingleAgentClient` instances.
|
|
42
|
+
*
|
|
43
|
+
* Sharing is explicit: nothing is shared unless a client is configured with a
|
|
44
|
+
* cache AND a caller-owned `authIdentity`.
|
|
45
|
+
*/
|
|
46
|
+
export interface AgentDiscoveryCacheConfig {
|
|
47
|
+
/** Shared store. Create one with {@link createInMemoryAgentDiscoveryCache}. */
|
|
48
|
+
cache: AgentDiscoveryCache;
|
|
49
|
+
/**
|
|
50
|
+
* Stable, caller-owned identity of the principal whose credentials these
|
|
51
|
+
* clients use (for example a tenant or buyer-account ID). Required.
|
|
52
|
+
*
|
|
53
|
+
* Entries are only shared between clients that present the same identity, so
|
|
54
|
+
* choose it to be at least as specific as the credential's authorization
|
|
55
|
+
* scope. It is NOT derived from the token: rotating a token for the same
|
|
56
|
+
* principal keeps the entry, and two principals must never share an identity.
|
|
57
|
+
* The identity is hashed into the cache key and never stored in the entry.
|
|
58
|
+
*/
|
|
59
|
+
authIdentity: string;
|
|
60
|
+
/** Freshness window in milliseconds. Defaults to five minutes; capped at 24 hours. */
|
|
61
|
+
ttlMs?: number;
|
|
62
|
+
}
|
|
63
|
+
export interface InMemoryAgentDiscoveryCacheOptions {
|
|
64
|
+
/** Maximum retained entries; least-recently-used entries are evicted. Defaults to 256. */
|
|
65
|
+
maxEntries?: number;
|
|
66
|
+
}
|
|
67
|
+
/** Process-local {@link AgentDiscoveryCache} with LRU eviction and copy-on-read/write. */
|
|
68
|
+
export interface InMemoryAgentDiscoveryCache extends AgentDiscoveryCache {
|
|
69
|
+
get(key: string): AgentDiscoveryEntry | undefined;
|
|
70
|
+
set(key: string, entry: AgentDiscoveryEntry): void;
|
|
71
|
+
delete(key: string): void;
|
|
72
|
+
/** Drop every entry. */
|
|
73
|
+
clear(): void;
|
|
74
|
+
/** Number of retained entries (including entries that have expired but not been read). */
|
|
75
|
+
readonly size: number;
|
|
76
|
+
}
|
|
77
|
+
export declare function createInMemoryAgentDiscoveryCache(options?: InMemoryAgentDiscoveryCacheOptions): InMemoryAgentDiscoveryCache;
|
|
78
|
+
/** Validate a client's shared-discovery configuration at construction time. */
|
|
79
|
+
export declare function validateAgentDiscoveryCacheConfig(config: AgentDiscoveryCacheConfig | undefined): void;
|
|
80
|
+
export declare function resolveAgentDiscoveryTtlMs(ttlMs: number | undefined): number;
|
|
81
|
+
/** Everything that decides which cached discovery evidence a client may reuse. */
|
|
82
|
+
export interface AgentDiscoveryKeyInput {
|
|
83
|
+
protocol: string;
|
|
84
|
+
agentUri: string;
|
|
85
|
+
adcpVersion: string;
|
|
86
|
+
wireAdcpVersion?: string;
|
|
87
|
+
authIdentity: string;
|
|
88
|
+
/** Kind of credential presented (`none`, `bearer`, `oauth`, `header`, ...); never its value. */
|
|
89
|
+
credentialKind?: string;
|
|
90
|
+
/** Request headers the client sends on every call (correlation and credential headers are dropped here). */
|
|
91
|
+
headers?: Record<string, string>;
|
|
92
|
+
/** Non-secret fingerprint of the request-signing identity, when configured. */
|
|
93
|
+
signing?: unknown;
|
|
94
|
+
allowPrivateIp?: boolean;
|
|
95
|
+
maxResponseBytes?: number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Derive the opaque cache key. Correlation headers are excluded (they differ
|
|
99
|
+
* on every request) and so are credential headers (owned by `authIdentity`); every
|
|
100
|
+
* other header — including unknown tenant, routing and policy headers — is part of the key, as are the signing identity and the
|
|
101
|
+
* transport policy that governed how the evidence was collected.
|
|
102
|
+
*/
|
|
103
|
+
export declare function agentDiscoveryCacheKey(input: AgentDiscoveryKeyInput): string;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { AdcpCapabilities } from '../utils/capabilities';
|
|
2
|
+
/** Default freshness window for shared discovery entries. */
|
|
3
|
+
export declare const DEFAULT_AGENT_DISCOVERY_TTL_MS: number;
|
|
4
|
+
/** Upper bound for a configured TTL; shared entries are discovery hints, not durable state. */
|
|
5
|
+
export declare const MAX_AGENT_DISCOVERY_TTL_MS: number;
|
|
6
|
+
/**
|
|
7
|
+
* Endpoint, tool-list and capability evidence for one (agent, caller identity,
|
|
8
|
+
* AdCP version, transport policy) tuple. Entries are plain JSON so a shared
|
|
9
|
+
* cache can live in process memory or an external store.
|
|
10
|
+
*/
|
|
11
|
+
export interface AgentDiscoveryEntry {
|
|
12
|
+
/** MCP endpoint resolved by endpoint discovery (the URL actually serving MCP). */
|
|
13
|
+
endpoint?: {
|
|
14
|
+
agentUri: string;
|
|
15
|
+
mcpEra?: 'legacy' | 'modern';
|
|
16
|
+
/** Epoch milliseconds when this endpoint was observed (may be older than the entry). */
|
|
17
|
+
observedAt?: number;
|
|
18
|
+
};
|
|
19
|
+
/** Capabilities from an authoritative `get_adcp_capabilities` response. Never synthetic. */
|
|
20
|
+
capabilities?: AdcpCapabilities;
|
|
21
|
+
/** `tools/list` input-schema properties keyed by tool name. */
|
|
22
|
+
toolSchemas?: Record<string, Record<string, unknown>>;
|
|
23
|
+
/** Epoch milliseconds when this evidence was observed. */
|
|
24
|
+
observedAt: number;
|
|
25
|
+
/** Epoch milliseconds after which the entry must not be used. Enforced by the SDK on read. */
|
|
26
|
+
expiresAt: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Storage backend for shared discovery entries. Keys are opaque SHA-256
|
|
30
|
+
* digests derived by the SDK; implementations must not interpret them and
|
|
31
|
+
* must return copies (or immutable values) so callers cannot mutate stored
|
|
32
|
+
* entries. Methods may be synchronous or asynchronous.
|
|
33
|
+
*/
|
|
34
|
+
export interface AgentDiscoveryCache {
|
|
35
|
+
get(key: string): AgentDiscoveryEntry | undefined | Promise<AgentDiscoveryEntry | undefined>;
|
|
36
|
+
set(key: string, entry: AgentDiscoveryEntry): void | Promise<void>;
|
|
37
|
+
delete(key: string): void | Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Opt-in sharing of endpoint / `tools/list` / `get_adcp_capabilities`
|
|
41
|
+
* discovery across `SingleAgentClient` instances.
|
|
42
|
+
*
|
|
43
|
+
* Sharing is explicit: nothing is shared unless a client is configured with a
|
|
44
|
+
* cache AND a caller-owned `authIdentity`.
|
|
45
|
+
*/
|
|
46
|
+
export interface AgentDiscoveryCacheConfig {
|
|
47
|
+
/** Shared store. Create one with {@link createInMemoryAgentDiscoveryCache}. */
|
|
48
|
+
cache: AgentDiscoveryCache;
|
|
49
|
+
/**
|
|
50
|
+
* Stable, caller-owned identity of the principal whose credentials these
|
|
51
|
+
* clients use (for example a tenant or buyer-account ID). Required.
|
|
52
|
+
*
|
|
53
|
+
* Entries are only shared between clients that present the same identity, so
|
|
54
|
+
* choose it to be at least as specific as the credential's authorization
|
|
55
|
+
* scope. It is NOT derived from the token: rotating a token for the same
|
|
56
|
+
* principal keeps the entry, and two principals must never share an identity.
|
|
57
|
+
* The identity is hashed into the cache key and never stored in the entry.
|
|
58
|
+
*/
|
|
59
|
+
authIdentity: string;
|
|
60
|
+
/** Freshness window in milliseconds. Defaults to five minutes; capped at 24 hours. */
|
|
61
|
+
ttlMs?: number;
|
|
62
|
+
}
|
|
63
|
+
export interface InMemoryAgentDiscoveryCacheOptions {
|
|
64
|
+
/** Maximum retained entries; least-recently-used entries are evicted. Defaults to 256. */
|
|
65
|
+
maxEntries?: number;
|
|
66
|
+
}
|
|
67
|
+
/** Process-local {@link AgentDiscoveryCache} with LRU eviction and copy-on-read/write. */
|
|
68
|
+
export interface InMemoryAgentDiscoveryCache extends AgentDiscoveryCache {
|
|
69
|
+
get(key: string): AgentDiscoveryEntry | undefined;
|
|
70
|
+
set(key: string, entry: AgentDiscoveryEntry): void;
|
|
71
|
+
delete(key: string): void;
|
|
72
|
+
/** Drop every entry. */
|
|
73
|
+
clear(): void;
|
|
74
|
+
/** Number of retained entries (including entries that have expired but not been read). */
|
|
75
|
+
readonly size: number;
|
|
76
|
+
}
|
|
77
|
+
export declare function createInMemoryAgentDiscoveryCache(options?: InMemoryAgentDiscoveryCacheOptions): InMemoryAgentDiscoveryCache;
|
|
78
|
+
/** Validate a client's shared-discovery configuration at construction time. */
|
|
79
|
+
export declare function validateAgentDiscoveryCacheConfig(config: AgentDiscoveryCacheConfig | undefined): void;
|
|
80
|
+
export declare function resolveAgentDiscoveryTtlMs(ttlMs: number | undefined): number;
|
|
81
|
+
/** Everything that decides which cached discovery evidence a client may reuse. */
|
|
82
|
+
export interface AgentDiscoveryKeyInput {
|
|
83
|
+
protocol: string;
|
|
84
|
+
agentUri: string;
|
|
85
|
+
adcpVersion: string;
|
|
86
|
+
wireAdcpVersion?: string;
|
|
87
|
+
authIdentity: string;
|
|
88
|
+
/** Kind of credential presented (`none`, `bearer`, `oauth`, `header`, ...); never its value. */
|
|
89
|
+
credentialKind?: string;
|
|
90
|
+
/** Request headers the client sends on every call (correlation and credential headers are dropped here). */
|
|
91
|
+
headers?: Record<string, string>;
|
|
92
|
+
/** Non-secret fingerprint of the request-signing identity, when configured. */
|
|
93
|
+
signing?: unknown;
|
|
94
|
+
allowPrivateIp?: boolean;
|
|
95
|
+
maxResponseBytes?: number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Derive the opaque cache key. Correlation headers are excluded (they differ
|
|
99
|
+
* on every request) and so are credential headers (owned by `authIdentity`); every
|
|
100
|
+
* other header — including unknown tenant, routing and policy headers — is part of the key, as are the signing identity and the
|
|
101
|
+
* transport policy that governed how the evidence was collected.
|
|
102
|
+
*/
|
|
103
|
+
export declare function agentDiscoveryCacheKey(input: AgentDiscoveryKeyInput): string;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var agent_discovery_cache_exports = {};
|
|
20
|
+
__export(agent_discovery_cache_exports, {
|
|
21
|
+
DEFAULT_AGENT_DISCOVERY_TTL_MS: () => DEFAULT_AGENT_DISCOVERY_TTL_MS,
|
|
22
|
+
MAX_AGENT_DISCOVERY_TTL_MS: () => MAX_AGENT_DISCOVERY_TTL_MS,
|
|
23
|
+
agentDiscoveryCacheKey: () => agentDiscoveryCacheKey,
|
|
24
|
+
createInMemoryAgentDiscoveryCache: () => createInMemoryAgentDiscoveryCache,
|
|
25
|
+
resolveAgentDiscoveryTtlMs: () => resolveAgentDiscoveryTtlMs,
|
|
26
|
+
validateAgentDiscoveryCacheConfig: () => validateAgentDiscoveryCacheConfig
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(agent_discovery_cache_exports);
|
|
29
|
+
var import_node_crypto = require("node:crypto");
|
|
30
|
+
var import_errors = require('../errors/index.js');
|
|
31
|
+
var import_jcs = require('../utils/jcs.js');
|
|
32
|
+
var import_mcp_call_context = require('../protocols/mcp-call-context.js');
|
|
33
|
+
const DEFAULT_AGENT_DISCOVERY_TTL_MS = 5 * 60 * 1e3;
|
|
34
|
+
const MAX_AGENT_DISCOVERY_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
35
|
+
const DEFAULT_MAX_ENTRIES = 256;
|
|
36
|
+
function createInMemoryAgentDiscoveryCache(options = {}) {
|
|
37
|
+
const maxEntries = options.maxEntries ?? DEFAULT_MAX_ENTRIES;
|
|
38
|
+
if (!Number.isSafeInteger(maxEntries) || maxEntries < 1) {
|
|
39
|
+
throw new import_errors.ConfigurationError("maxEntries must be a positive safe integer.");
|
|
40
|
+
}
|
|
41
|
+
const entries = /* @__PURE__ */ new Map();
|
|
42
|
+
return {
|
|
43
|
+
get(key) {
|
|
44
|
+
const entry = entries.get(key);
|
|
45
|
+
if (!entry) return void 0;
|
|
46
|
+
entries.delete(key);
|
|
47
|
+
entries.set(key, entry);
|
|
48
|
+
return structuredClone(entry);
|
|
49
|
+
},
|
|
50
|
+
set(key, entry) {
|
|
51
|
+
entries.delete(key);
|
|
52
|
+
entries.set(key, structuredClone(entry));
|
|
53
|
+
while (entries.size > maxEntries) {
|
|
54
|
+
const oldest = entries.keys().next().value;
|
|
55
|
+
if (oldest === void 0) break;
|
|
56
|
+
entries.delete(oldest);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
delete(key) {
|
|
60
|
+
entries.delete(key);
|
|
61
|
+
},
|
|
62
|
+
clear() {
|
|
63
|
+
entries.clear();
|
|
64
|
+
},
|
|
65
|
+
get size() {
|
|
66
|
+
return entries.size;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function validateAgentDiscoveryCacheConfig(config) {
|
|
71
|
+
if (config === void 0) return;
|
|
72
|
+
const cache = config.cache;
|
|
73
|
+
if (!cache || typeof cache.get !== "function" || typeof cache.set !== "function" || typeof cache.delete !== "function") {
|
|
74
|
+
throw new import_errors.ConfigurationError("discoveryCache.cache must implement get, set and delete.", "discoveryCache.cache");
|
|
75
|
+
}
|
|
76
|
+
if (typeof config.authIdentity !== "string" || config.authIdentity.length === 0) {
|
|
77
|
+
throw new import_errors.ConfigurationError(
|
|
78
|
+
"discoveryCache.authIdentity is required: supply a stable caller-owned identity for the principal whose credentials this client uses. It is deliberately not derived from the token, so that two principals can never share discovery evidence by accident.",
|
|
79
|
+
"discoveryCache.authIdentity"
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
resolveAgentDiscoveryTtlMs(config.ttlMs);
|
|
83
|
+
}
|
|
84
|
+
function resolveAgentDiscoveryTtlMs(ttlMs) {
|
|
85
|
+
if (ttlMs === void 0) return DEFAULT_AGENT_DISCOVERY_TTL_MS;
|
|
86
|
+
if (!Number.isFinite(ttlMs) || ttlMs <= 0 || ttlMs > MAX_AGENT_DISCOVERY_TTL_MS) {
|
|
87
|
+
throw new import_errors.ConfigurationError(
|
|
88
|
+
`discoveryCache.ttlMs must be a positive number of milliseconds no greater than ${MAX_AGENT_DISCOVERY_TTL_MS}.`,
|
|
89
|
+
"discoveryCache.ttlMs"
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
return ttlMs;
|
|
93
|
+
}
|
|
94
|
+
function agentDiscoveryCacheKey(input) {
|
|
95
|
+
const headers = Object.entries((0, import_mcp_call_context.splitConnectionHeaders)(input.headers).identity).map(([name, value]) => [name.toLowerCase(), value]).filter(([name]) => name !== "authorization" && name !== "x-adcp-auth").sort(([left], [right]) => left.localeCompare(right));
|
|
96
|
+
const digest = (0, import_node_crypto.createHash)("sha256").update(
|
|
97
|
+
(0, import_jcs.canonicalize)({
|
|
98
|
+
v: 1,
|
|
99
|
+
protocol: input.protocol,
|
|
100
|
+
agentUri: input.agentUri,
|
|
101
|
+
adcpVersion: input.adcpVersion,
|
|
102
|
+
wireAdcpVersion: input.wireAdcpVersion ?? null,
|
|
103
|
+
authIdentity: input.authIdentity,
|
|
104
|
+
credentialKind: input.credentialKind ?? null,
|
|
105
|
+
headers,
|
|
106
|
+
signing: input.signing ?? null,
|
|
107
|
+
allowPrivateIp: input.allowPrivateIp ?? null,
|
|
108
|
+
maxResponseBytes: input.maxResponseBytes ?? null
|
|
109
|
+
})
|
|
110
|
+
).digest("hex");
|
|
111
|
+
return `adcp:agent-discovery:v1:${digest}`;
|
|
112
|
+
}
|
|
113
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
114
|
+
0 && (module.exports = {
|
|
115
|
+
DEFAULT_AGENT_DISCOVERY_TTL_MS,
|
|
116
|
+
MAX_AGENT_DISCOVERY_TTL_MS,
|
|
117
|
+
agentDiscoveryCacheKey,
|
|
118
|
+
createInMemoryAgentDiscoveryCache,
|
|
119
|
+
resolveAgentDiscoveryTtlMs,
|
|
120
|
+
validateAgentDiscoveryCacheConfig
|
|
121
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { ConfigurationError } from "../errors/index.mjs";
|
|
3
|
+
import { canonicalize as canonicalizeJson } from "../utils/jcs.mjs";
|
|
4
|
+
import { splitConnectionHeaders } from "../protocols/mcp-call-context.mjs";
|
|
5
|
+
const DEFAULT_AGENT_DISCOVERY_TTL_MS = 5 * 60 * 1e3;
|
|
6
|
+
const MAX_AGENT_DISCOVERY_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
7
|
+
const DEFAULT_MAX_ENTRIES = 256;
|
|
8
|
+
function createInMemoryAgentDiscoveryCache(options = {}) {
|
|
9
|
+
const maxEntries = options.maxEntries ?? DEFAULT_MAX_ENTRIES;
|
|
10
|
+
if (!Number.isSafeInteger(maxEntries) || maxEntries < 1) {
|
|
11
|
+
throw new ConfigurationError("maxEntries must be a positive safe integer.");
|
|
12
|
+
}
|
|
13
|
+
const entries = /* @__PURE__ */ new Map();
|
|
14
|
+
return {
|
|
15
|
+
get(key) {
|
|
16
|
+
const entry = entries.get(key);
|
|
17
|
+
if (!entry) return void 0;
|
|
18
|
+
entries.delete(key);
|
|
19
|
+
entries.set(key, entry);
|
|
20
|
+
return structuredClone(entry);
|
|
21
|
+
},
|
|
22
|
+
set(key, entry) {
|
|
23
|
+
entries.delete(key);
|
|
24
|
+
entries.set(key, structuredClone(entry));
|
|
25
|
+
while (entries.size > maxEntries) {
|
|
26
|
+
const oldest = entries.keys().next().value;
|
|
27
|
+
if (oldest === void 0) break;
|
|
28
|
+
entries.delete(oldest);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
delete(key) {
|
|
32
|
+
entries.delete(key);
|
|
33
|
+
},
|
|
34
|
+
clear() {
|
|
35
|
+
entries.clear();
|
|
36
|
+
},
|
|
37
|
+
get size() {
|
|
38
|
+
return entries.size;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function validateAgentDiscoveryCacheConfig(config) {
|
|
43
|
+
if (config === void 0) return;
|
|
44
|
+
const cache = config.cache;
|
|
45
|
+
if (!cache || typeof cache.get !== "function" || typeof cache.set !== "function" || typeof cache.delete !== "function") {
|
|
46
|
+
throw new ConfigurationError("discoveryCache.cache must implement get, set and delete.", "discoveryCache.cache");
|
|
47
|
+
}
|
|
48
|
+
if (typeof config.authIdentity !== "string" || config.authIdentity.length === 0) {
|
|
49
|
+
throw new ConfigurationError(
|
|
50
|
+
"discoveryCache.authIdentity is required: supply a stable caller-owned identity for the principal whose credentials this client uses. It is deliberately not derived from the token, so that two principals can never share discovery evidence by accident.",
|
|
51
|
+
"discoveryCache.authIdentity"
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
resolveAgentDiscoveryTtlMs(config.ttlMs);
|
|
55
|
+
}
|
|
56
|
+
function resolveAgentDiscoveryTtlMs(ttlMs) {
|
|
57
|
+
if (ttlMs === void 0) return DEFAULT_AGENT_DISCOVERY_TTL_MS;
|
|
58
|
+
if (!Number.isFinite(ttlMs) || ttlMs <= 0 || ttlMs > MAX_AGENT_DISCOVERY_TTL_MS) {
|
|
59
|
+
throw new ConfigurationError(
|
|
60
|
+
`discoveryCache.ttlMs must be a positive number of milliseconds no greater than ${MAX_AGENT_DISCOVERY_TTL_MS}.`,
|
|
61
|
+
"discoveryCache.ttlMs"
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
return ttlMs;
|
|
65
|
+
}
|
|
66
|
+
function agentDiscoveryCacheKey(input) {
|
|
67
|
+
const headers = Object.entries(splitConnectionHeaders(input.headers).identity).map(([name, value]) => [name.toLowerCase(), value]).filter(([name]) => name !== "authorization" && name !== "x-adcp-auth").sort(([left], [right]) => left.localeCompare(right));
|
|
68
|
+
const digest = createHash("sha256").update(
|
|
69
|
+
canonicalizeJson({
|
|
70
|
+
v: 1,
|
|
71
|
+
protocol: input.protocol,
|
|
72
|
+
agentUri: input.agentUri,
|
|
73
|
+
adcpVersion: input.adcpVersion,
|
|
74
|
+
wireAdcpVersion: input.wireAdcpVersion ?? null,
|
|
75
|
+
authIdentity: input.authIdentity,
|
|
76
|
+
credentialKind: input.credentialKind ?? null,
|
|
77
|
+
headers,
|
|
78
|
+
signing: input.signing ?? null,
|
|
79
|
+
allowPrivateIp: input.allowPrivateIp ?? null,
|
|
80
|
+
maxResponseBytes: input.maxResponseBytes ?? null
|
|
81
|
+
})
|
|
82
|
+
).digest("hex");
|
|
83
|
+
return `adcp:agent-discovery:v1:${digest}`;
|
|
84
|
+
}
|
|
85
|
+
export {
|
|
86
|
+
DEFAULT_AGENT_DISCOVERY_TTL_MS,
|
|
87
|
+
MAX_AGENT_DISCOVERY_TTL_MS,
|
|
88
|
+
agentDiscoveryCacheKey,
|
|
89
|
+
createInMemoryAgentDiscoveryCache,
|
|
90
|
+
resolveAgentDiscoveryTtlMs,
|
|
91
|
+
validateAgentDiscoveryCacheConfig
|
|
92
|
+
};
|
package/dist/lib/index.d.mts
CHANGED
|
@@ -14,7 +14,9 @@ export { resolveInlinePublisherProperties, resolveSingularInline, detectInlineFe
|
|
|
14
14
|
export { fetchAgentAuthorizationsFromDirectory, type AgentAuthorizationsIterator, type FetchAgentAuthorizationsOptions, type DirectoryLookupPage, type DirectoryPublisherEntry, type DirectoryDiscoveryMethod, type DirectoryPublisherStatus, } from './discovery/agent-directory.mjs';
|
|
15
15
|
export { validateAdAgents, parseManagerDomain, type DiscoveryMethod, type AdAgentsValidationResult, type ValidateAdAgentsOptions, } from './discovery/validate-adagents.mjs';
|
|
16
16
|
export { SingleAgentClient, WebhookDispatchError, createSingleAgentClient, UnsupportedFeatureError, } from './core/SingleAgentClient.mjs';
|
|
17
|
-
export
|
|
17
|
+
export { createInMemoryAgentDiscoveryCache } from './core/agent-discovery-cache.mjs';
|
|
18
|
+
export type { AgentDiscoveryCache, AgentDiscoveryCacheConfig, AgentDiscoveryEntry, InMemoryAgentDiscoveryCache, InMemoryAgentDiscoveryCacheOptions, } from './core/agent-discovery-cache.mjs';
|
|
19
|
+
export type { AgentDiscoverySeed, CapabilityEvidenceScope, CapabilityEvidenceSnapshot, ClientProductPropertyPolicy, CreativeDeliveryTaskOptions, SingleAgentClientConfig, StatusHandlerErrorContext, SyncCreativesTaskOptions, VerifyAndParseWebhookOptions, WebhookHandlerAdapter, WebhookHandlerRequest, WebhookRequestContext, WebhookParseErrorCode, WebhookParseFailure, WebhookParseResult, WebhookParseSuccess, WebhookVerificationConfig, } from './core/SingleAgentClient.mjs';
|
|
18
20
|
export { InMemoryWebhookRegistrationStore, type InMemoryWebhookRegistrationStoreOptions, type WebhookAuthenticationMode, type WebhookRegistration, type WebhookRegistrationStore, } from './core/webhook-registration.mjs';
|
|
19
21
|
export { pgWebhookRegistrationStore, getWebhookRegistrationMigration, WEBHOOK_REGISTRATION_MIGRATION, cleanupExpiredWebhookRegistrations, type PgWebhookRegistrationStoreOptions, type CleanupExpiredWebhookRegistrationsOptions, } from './core/postgres-webhook-registration-store.mjs';
|
|
20
22
|
export { redisWebhookRegistrationStore, type RedisWebhookRegistrationStoreOptions, } from './core/redis-webhook-registration-store.mjs';
|
|
@@ -188,9 +190,9 @@ export { runAuthDiagnosis, AUTH_DIAGNOSIS_SCHEMA_VERSION, type DiagnoseOptions,
|
|
|
188
190
|
export { NeedsAuthorizationError, discoverAuthorizationRequirements, hasValidatedMcpAuthorizationRequirements, createFileOAuthStorage, bindAgentStorage, getAgentStorage, unbindAgentStorage, type AuthorizationRequirements, type DiscoverAuthorizationOptions, type FileOAuthStorageOptions, } from './auth/oauth/index.mjs';
|
|
189
191
|
export { exchangeClientCredentials, ensureClientCredentialsTokens, ClientCredentialsExchangeError, MissingEnvSecretError, resolveSecret, isEnvSecretReference, toEnvSecretReference, extractEnvSecretName, type ExchangeClientCredentialsOptions, type EnsureClientCredentialsOptions, type AgentOAuthClientCredentials, AgentOAuthClientCredentialsSchema, } from './auth/oauth/index.mjs';
|
|
190
192
|
export { validateAgentUrl, validateAdCPResponse, getExpectedSchema, handleAdCPResponse } from './validation/index.mjs';
|
|
191
|
-
export { ProtocolClient, callMCPTool, callA2ATool, createA2AClientFromCardUrl, createMCPClient, createA2AClient, closeMCPConnections, closeOAuthConnections, bundleSupportsAdcpVersionField, BODY_SNIPPET_TIMEOUT_MS, OBSERVER_FLUSH_TIMEOUT_MS, sanitizeTransportHeaders, sanitizeTransportUrl, } from './protocols/index.mjs';
|
|
193
|
+
export { ProtocolClient, callMCPTool, callA2ATool, createA2AClientFromCardUrl, createMCPClient, createA2AClient, closeMCPConnections, closeOAuthConnections, closeScopedConnections, withMCPConnectionScope, bundleSupportsAdcpVersionField, BODY_SNIPPET_TIMEOUT_MS, OBSERVER_FLUSH_TIMEOUT_MS, sanitizeTransportHeaders, sanitizeTransportUrl, } from './protocols/index.mjs';
|
|
192
194
|
export { toReleasePrecisionWire, validateAdcpVersionWire } from './validation/schema-loader.mjs';
|
|
193
|
-
export type { CallToolOptions, TransportActivity, TransportActivityContext, TransportActivityHandler, TransportOptions, A2ALegacyCompatOptions, } from './protocols/index.mjs';
|
|
195
|
+
export type { CallToolOptions, TransportActivity, TransportActivityContext, TransportActivityHandler, TransportActivityType, TransportResponseOutcome, TransportOptions, A2ALegacyCompatOptions, } from './protocols/index.mjs';
|
|
194
196
|
import { bundleSupportsAdcpVersionField as _isSupported } from './protocols/index.mjs';
|
|
195
197
|
import { toReleasePrecisionWire as _normalize, validateAdcpVersionWire as _validate } from './validation/schema-loader.mjs';
|
|
196
198
|
export declare const wireVersion: {
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -14,7 +14,9 @@ export { resolveInlinePublisherProperties, resolveSingularInline, detectInlineFe
|
|
|
14
14
|
export { fetchAgentAuthorizationsFromDirectory, type AgentAuthorizationsIterator, type FetchAgentAuthorizationsOptions, type DirectoryLookupPage, type DirectoryPublisherEntry, type DirectoryDiscoveryMethod, type DirectoryPublisherStatus, } from './discovery/agent-directory';
|
|
15
15
|
export { validateAdAgents, parseManagerDomain, type DiscoveryMethod, type AdAgentsValidationResult, type ValidateAdAgentsOptions, } from './discovery/validate-adagents';
|
|
16
16
|
export { SingleAgentClient, WebhookDispatchError, createSingleAgentClient, UnsupportedFeatureError, } from './core/SingleAgentClient';
|
|
17
|
-
export
|
|
17
|
+
export { createInMemoryAgentDiscoveryCache } from './core/agent-discovery-cache';
|
|
18
|
+
export type { AgentDiscoveryCache, AgentDiscoveryCacheConfig, AgentDiscoveryEntry, InMemoryAgentDiscoveryCache, InMemoryAgentDiscoveryCacheOptions, } from './core/agent-discovery-cache';
|
|
19
|
+
export type { AgentDiscoverySeed, CapabilityEvidenceScope, CapabilityEvidenceSnapshot, ClientProductPropertyPolicy, CreativeDeliveryTaskOptions, SingleAgentClientConfig, StatusHandlerErrorContext, SyncCreativesTaskOptions, VerifyAndParseWebhookOptions, WebhookHandlerAdapter, WebhookHandlerRequest, WebhookRequestContext, WebhookParseErrorCode, WebhookParseFailure, WebhookParseResult, WebhookParseSuccess, WebhookVerificationConfig, } from './core/SingleAgentClient';
|
|
18
20
|
export { InMemoryWebhookRegistrationStore, type InMemoryWebhookRegistrationStoreOptions, type WebhookAuthenticationMode, type WebhookRegistration, type WebhookRegistrationStore, } from './core/webhook-registration';
|
|
19
21
|
export { pgWebhookRegistrationStore, getWebhookRegistrationMigration, WEBHOOK_REGISTRATION_MIGRATION, cleanupExpiredWebhookRegistrations, type PgWebhookRegistrationStoreOptions, type CleanupExpiredWebhookRegistrationsOptions, } from './core/postgres-webhook-registration-store';
|
|
20
22
|
export { redisWebhookRegistrationStore, type RedisWebhookRegistrationStoreOptions, } from './core/redis-webhook-registration-store';
|
|
@@ -188,9 +190,9 @@ export { runAuthDiagnosis, AUTH_DIAGNOSIS_SCHEMA_VERSION, type DiagnoseOptions,
|
|
|
188
190
|
export { NeedsAuthorizationError, discoverAuthorizationRequirements, hasValidatedMcpAuthorizationRequirements, createFileOAuthStorage, bindAgentStorage, getAgentStorage, unbindAgentStorage, type AuthorizationRequirements, type DiscoverAuthorizationOptions, type FileOAuthStorageOptions, } from './auth/oauth';
|
|
189
191
|
export { exchangeClientCredentials, ensureClientCredentialsTokens, ClientCredentialsExchangeError, MissingEnvSecretError, resolveSecret, isEnvSecretReference, toEnvSecretReference, extractEnvSecretName, type ExchangeClientCredentialsOptions, type EnsureClientCredentialsOptions, type AgentOAuthClientCredentials, AgentOAuthClientCredentialsSchema, } from './auth/oauth';
|
|
190
192
|
export { validateAgentUrl, validateAdCPResponse, getExpectedSchema, handleAdCPResponse } from './validation';
|
|
191
|
-
export { ProtocolClient, callMCPTool, callA2ATool, createA2AClientFromCardUrl, createMCPClient, createA2AClient, closeMCPConnections, closeOAuthConnections, bundleSupportsAdcpVersionField, BODY_SNIPPET_TIMEOUT_MS, OBSERVER_FLUSH_TIMEOUT_MS, sanitizeTransportHeaders, sanitizeTransportUrl, } from './protocols';
|
|
193
|
+
export { ProtocolClient, callMCPTool, callA2ATool, createA2AClientFromCardUrl, createMCPClient, createA2AClient, closeMCPConnections, closeOAuthConnections, closeScopedConnections, withMCPConnectionScope, bundleSupportsAdcpVersionField, BODY_SNIPPET_TIMEOUT_MS, OBSERVER_FLUSH_TIMEOUT_MS, sanitizeTransportHeaders, sanitizeTransportUrl, } from './protocols';
|
|
192
194
|
export { toReleasePrecisionWire, validateAdcpVersionWire } from './validation/schema-loader';
|
|
193
|
-
export type { CallToolOptions, TransportActivity, TransportActivityContext, TransportActivityHandler, TransportOptions, A2ALegacyCompatOptions, } from './protocols';
|
|
195
|
+
export type { CallToolOptions, TransportActivity, TransportActivityContext, TransportActivityHandler, TransportActivityType, TransportResponseOutcome, TransportOptions, A2ALegacyCompatOptions, } from './protocols';
|
|
194
196
|
import { bundleSupportsAdcpVersionField as _isSupported } from './protocols';
|
|
195
197
|
import { toReleasePrecisionWire as _normalize, validateAdcpVersionWire as _validate } from './validation/schema-loader';
|
|
196
198
|
export declare const wireVersion: {
|
package/dist/lib/index.js
CHANGED
|
@@ -296,6 +296,7 @@ __export(index_exports, {
|
|
|
296
296
|
clearPreviewCache: () => import_utils4.clearPreviewCache,
|
|
297
297
|
closeMCPConnections: () => import_protocols.closeMCPConnections,
|
|
298
298
|
closeOAuthConnections: () => import_protocols.closeOAuthConnections,
|
|
299
|
+
closeScopedConnections: () => import_protocols.closeScopedConnections,
|
|
299
300
|
compileUniversalMacroTemplate: () => import_substitution.compileUniversalMacroTemplate,
|
|
300
301
|
computeGovernedPayloadHash: () => import_governance.computeGovernedPayloadHash,
|
|
301
302
|
createA2AAdapter: () => import_server.createA2AAdapter,
|
|
@@ -316,6 +317,7 @@ __export(index_exports, {
|
|
|
316
317
|
createGovernanceAgentJwksResolver: () => import_governance.createGovernanceAgentJwksResolver,
|
|
317
318
|
createGovernanceEnforcementMiddleware: () => import_governance.createGovernanceEnforcementMiddleware,
|
|
318
319
|
createIdempotencyStore: () => import_server.createIdempotencyStore,
|
|
320
|
+
createInMemoryAgentDiscoveryCache: () => import_agent_discovery_cache.createInMemoryAgentDiscoveryCache,
|
|
319
321
|
createInMemoryEstablishedProposalStore: () => import_established_proposal_store.createInMemoryEstablishedProposalStore,
|
|
320
322
|
createInMemoryLegacyPurchaseContinuationStore: () => import_legacy_purchase_continuation.createInMemoryLegacyPurchaseContinuationStore,
|
|
321
323
|
createLazyBackend: () => import_server.createLazyBackend,
|
|
@@ -724,6 +726,7 @@ __export(index_exports, {
|
|
|
724
726
|
windowUpdateMediaBuyDeliveryNotification: () => import_media_buy_delivery_notification_builders.windowUpdateMediaBuyDeliveryNotification,
|
|
725
727
|
wireVersion: () => wireVersion,
|
|
726
728
|
withAdditiveCanonicalFormatOptions: () => import_projection2.withAdditiveCanonicalFormatOptions,
|
|
729
|
+
withMCPConnectionScope: () => import_protocols.withMCPConnectionScope,
|
|
727
730
|
withSpan: () => import_observability.withSpan
|
|
728
731
|
});
|
|
729
732
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -739,6 +742,7 @@ var import_inline_publisher_properties = require('./discovery/inline-publisher-p
|
|
|
739
742
|
var import_agent_directory = require('./discovery/agent-directory.js');
|
|
740
743
|
var import_validate_adagents = require('./discovery/validate-adagents.js');
|
|
741
744
|
var import_SingleAgentClient = require('./core/SingleAgentClient.js');
|
|
745
|
+
var import_agent_discovery_cache = require('./core/agent-discovery-cache.js');
|
|
742
746
|
var import_webhook_registration = require('./core/webhook-registration.js');
|
|
743
747
|
var import_postgres_webhook_registration_store = require('./core/postgres-webhook-registration-store.js');
|
|
744
748
|
var import_redis_webhook_registration_store = require('./core/redis-webhook-registration-store.js');
|
|
@@ -1137,6 +1141,7 @@ function createAdCPClientFromEnv() {
|
|
|
1137
1141
|
clearPreviewCache,
|
|
1138
1142
|
closeMCPConnections,
|
|
1139
1143
|
closeOAuthConnections,
|
|
1144
|
+
closeScopedConnections,
|
|
1140
1145
|
compileUniversalMacroTemplate,
|
|
1141
1146
|
computeGovernedPayloadHash,
|
|
1142
1147
|
createA2AAdapter,
|
|
@@ -1157,6 +1162,7 @@ function createAdCPClientFromEnv() {
|
|
|
1157
1162
|
createGovernanceAgentJwksResolver,
|
|
1158
1163
|
createGovernanceEnforcementMiddleware,
|
|
1159
1164
|
createIdempotencyStore,
|
|
1165
|
+
createInMemoryAgentDiscoveryCache,
|
|
1160
1166
|
createInMemoryEstablishedProposalStore,
|
|
1161
1167
|
createInMemoryLegacyPurchaseContinuationStore,
|
|
1162
1168
|
createLazyBackend,
|
|
@@ -1565,6 +1571,7 @@ function createAdCPClientFromEnv() {
|
|
|
1565
1571
|
windowUpdateMediaBuyDeliveryNotification,
|
|
1566
1572
|
wireVersion,
|
|
1567
1573
|
withAdditiveCanonicalFormatOptions,
|
|
1574
|
+
withMCPConnectionScope,
|
|
1568
1575
|
withSpan,
|
|
1569
1576
|
...require('./principal/index.js'),
|
|
1570
1577
|
...require('./handlers/types.js'),
|
package/dist/lib/index.mjs
CHANGED
|
@@ -75,6 +75,7 @@ import {
|
|
|
75
75
|
createSingleAgentClient,
|
|
76
76
|
UnsupportedFeatureError
|
|
77
77
|
} from "./core/SingleAgentClient.mjs";
|
|
78
|
+
import { createInMemoryAgentDiscoveryCache } from "./core/agent-discovery-cache.mjs";
|
|
78
79
|
import {
|
|
79
80
|
InMemoryWebhookRegistrationStore
|
|
80
81
|
} from "./core/webhook-registration.mjs";
|
|
@@ -458,6 +459,8 @@ import {
|
|
|
458
459
|
createA2AClient,
|
|
459
460
|
closeMCPConnections,
|
|
460
461
|
closeOAuthConnections,
|
|
462
|
+
closeScopedConnections,
|
|
463
|
+
withMCPConnectionScope,
|
|
461
464
|
bundleSupportsAdcpVersionField,
|
|
462
465
|
BODY_SNIPPET_TIMEOUT_MS,
|
|
463
466
|
OBSERVER_FLUSH_TIMEOUT_MS,
|
|
@@ -1096,6 +1099,7 @@ export {
|
|
|
1096
1099
|
clearPreviewCache,
|
|
1097
1100
|
closeMCPConnections,
|
|
1098
1101
|
closeOAuthConnections,
|
|
1102
|
+
closeScopedConnections,
|
|
1099
1103
|
compileUniversalMacroTemplate,
|
|
1100
1104
|
computeGovernedPayloadHash,
|
|
1101
1105
|
createA2AAdapter,
|
|
@@ -1116,6 +1120,7 @@ export {
|
|
|
1116
1120
|
createGovernanceAgentJwksResolver,
|
|
1117
1121
|
createGovernanceEnforcementMiddleware,
|
|
1118
1122
|
createIdempotencyStore,
|
|
1123
|
+
createInMemoryAgentDiscoveryCache,
|
|
1119
1124
|
createInMemoryEstablishedProposalStore,
|
|
1120
1125
|
createInMemoryLegacyPurchaseContinuationStore,
|
|
1121
1126
|
createLazyBackend,
|
|
@@ -1524,5 +1529,6 @@ export {
|
|
|
1524
1529
|
windowUpdateMediaBuyDeliveryNotification,
|
|
1525
1530
|
wireVersion,
|
|
1526
1531
|
withAdditiveCanonicalFormatOptions,
|
|
1532
|
+
withMCPConnectionScope,
|
|
1527
1533
|
withSpan
|
|
1528
1534
|
};
|
|
@@ -5,7 +5,7 @@ import { withMCPConnectionScope } from './mcp-scope.mjs';
|
|
|
5
5
|
* MCP closes persistent HTTP transports; A2A clears the agent-card client cache.
|
|
6
6
|
*/
|
|
7
7
|
export declare function closeConnections(protocol?: 'mcp' | 'a2a'): Promise<void>;
|
|
8
|
-
/** Close
|
|
8
|
+
/** Close the current MCP scope. Without an active MCP scope, leave other callers' sessions open. */
|
|
9
9
|
export declare function closeScopedConnections(protocol?: 'mcp' | 'a2a'): Promise<void>;
|
|
10
10
|
export { withMCPConnectionScope };
|
|
11
11
|
export type { MCPCallOptions, MCPConnectionResult } from './mcp.mjs';
|
|
@@ -16,7 +16,7 @@ import type { AgentConfig, DebugLogEntry } from '../types/index.mjs';
|
|
|
16
16
|
import type { PushNotificationConfig } from '../types/tools.generated.mjs';
|
|
17
17
|
import { type TransportActivityHandler as TransportActivityHandlerFn } from './transportDiagnostics.mjs';
|
|
18
18
|
export { BODY_SNIPPET_TIMEOUT_MS, OBSERVER_FLUSH_TIMEOUT_MS, sanitizeTransportHeaders, sanitizeTransportUrl, withTransportDiagnostics, wrapFetchWithTransportDiagnostics, } from './transportDiagnostics.mjs';
|
|
19
|
-
export type { TransportActivity, TransportActivityContext, TransportActivityHandler } from './transportDiagnostics.mjs';
|
|
19
|
+
export type { TransportActivity, TransportActivityContext, TransportActivityHandler, TransportActivityType, TransportResponseOutcome, } from './transportDiagnostics.mjs';
|
|
20
20
|
export type VersionEnvelopeMode = 'auto' | 'none' | 'major-only';
|
|
21
21
|
/**
|
|
22
22
|
* Returns true when the AdCP release that `bundleKey` identifies declares the
|
|
@@ -5,7 +5,7 @@ import { withMCPConnectionScope } from './mcp-scope';
|
|
|
5
5
|
* MCP closes persistent HTTP transports; A2A clears the agent-card client cache.
|
|
6
6
|
*/
|
|
7
7
|
export declare function closeConnections(protocol?: 'mcp' | 'a2a'): Promise<void>;
|
|
8
|
-
/** Close
|
|
8
|
+
/** Close the current MCP scope. Without an active MCP scope, leave other callers' sessions open. */
|
|
9
9
|
export declare function closeScopedConnections(protocol?: 'mcp' | 'a2a'): Promise<void>;
|
|
10
10
|
export { withMCPConnectionScope };
|
|
11
11
|
export type { MCPCallOptions, MCPConnectionResult } from './mcp';
|
|
@@ -16,7 +16,7 @@ import type { AgentConfig, DebugLogEntry } from '../types';
|
|
|
16
16
|
import type { PushNotificationConfig } from '../types/tools.generated';
|
|
17
17
|
import { type TransportActivityHandler as TransportActivityHandlerFn } from './transportDiagnostics';
|
|
18
18
|
export { BODY_SNIPPET_TIMEOUT_MS, OBSERVER_FLUSH_TIMEOUT_MS, sanitizeTransportHeaders, sanitizeTransportUrl, withTransportDiagnostics, wrapFetchWithTransportDiagnostics, } from './transportDiagnostics';
|
|
19
|
-
export type { TransportActivity, TransportActivityContext, TransportActivityHandler } from './transportDiagnostics';
|
|
19
|
+
export type { TransportActivity, TransportActivityContext, TransportActivityHandler, TransportActivityType, TransportResponseOutcome, } from './transportDiagnostics';
|
|
20
20
|
export type VersionEnvelopeMode = 'auto' | 'none' | 'major-only';
|
|
21
21
|
/**
|
|
22
22
|
* Returns true when the AdCP release that `bundleKey` identifies declares the
|
|
@@ -90,7 +90,7 @@ async function closeConnections(protocol = "mcp") {
|
|
|
90
90
|
}
|
|
91
91
|
async function closeScopedConnections(protocol = "mcp") {
|
|
92
92
|
if (protocol === "mcp") {
|
|
93
|
-
|
|
93
|
+
await (0, import_mcp_scope.closeCurrentMCPConnectionScope)();
|
|
94
94
|
} else {
|
|
95
95
|
(0, import_a2a.closeA2AConnections)();
|
|
96
96
|
}
|
|
@@ -24,7 +24,7 @@ async function closeConnections(protocol = "mcp") {
|
|
|
24
24
|
}
|
|
25
25
|
async function closeScopedConnections(protocol = "mcp") {
|
|
26
26
|
if (protocol === "mcp") {
|
|
27
|
-
|
|
27
|
+
await closeCurrentMCPConnectionScope();
|
|
28
28
|
} else {
|
|
29
29
|
closeA2AConnections();
|
|
30
30
|
}
|