agentfootprint 9.66.0 → 9.67.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.
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+ /**
3
+ * adapters/mcp/agentcore — reaching an AWS Bedrock **AgentCore Gateway**.
4
+ *
5
+ * ── What lives here, and why it is one file ──────────────────────────────────
6
+ * A Gateway is an MCP server, and `mcpClient` + `gatewayTransport` already know
7
+ * how to talk to one of those. Neither knows — and neither should learn — the
8
+ * handful of facts that are AgentCore's alone: the hostname its endpoints take,
9
+ * the name of the tool that searches its catalogue, the header that groups a
10
+ * caller's requests into one policy session, and the service name a SigV4
11
+ * signature is computed against. Those four facts are this file, and this file
12
+ * is the only place in the library that holds them.
13
+ *
14
+ * `gatewayTransport` says of itself: *"Nothing here is vendor-specific."* That
15
+ * stays true precisely because this exists next to it.
16
+ *
17
+ * ── What it does NOT do ──────────────────────────────────────────────────────
18
+ * It does not manage a Gateway. Creating one, adding targets, attaching a
19
+ * policy engine, enabling semantic search — all control-plane operations on
20
+ * `bedrock-agentcore-control`, all things an operator does once with the
21
+ * console, the CLI or their IaC. This is the CLIENT side: an agent using a
22
+ * gateway somebody already stood up.
23
+ *
24
+ * @example An agent whose tools come from a Gateway
25
+ * import { mcpClient } from 'agentfootprint/providers';
26
+ * import { agentCoreGatewayTransport } from 'agentfootprint/providers';
27
+ * import { agentCoreIdentity } from 'agentfootprint/security';
28
+ *
29
+ * const gateway = await mcpClient({
30
+ * name: 'gateway',
31
+ * transport: agentCoreGatewayTransport({
32
+ * gatewayId: 'my-gateway-a1b2c3d4e5',
33
+ * region: 'us-east-1',
34
+ * credentials: agentCoreIdentity({ region: 'us-east-1' }),
35
+ * }),
36
+ * });
37
+ * const tools = await gateway.tools();
38
+ */
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.hasGatewaySearch = exports.gatewaySearchTool = exports.agentCoreGatewayTransport = exports.agentCoreGatewayUrl = exports.AGENTCORE_SIGV4_SERVICE = exports.AGENTCORE_POLICY_SESSION_HEADER = exports.AGENTCORE_GATEWAY_SEARCH_TOOL = void 0;
41
+ const gatewayTransport_js_1 = require("../../lib/mcp/gatewayTransport.js");
42
+ /**
43
+ * The Gateway's built-in semantic tool search, by its exact wire name.
44
+ *
45
+ * It is an ordinary MCP tool — `tools/call` with `{ query }` — that returns the
46
+ * catalogue entries closest to a natural-language description. It matters at
47
+ * the scale where listing every tool into a prompt stops being sensible.
48
+ *
49
+ * **It can only be enabled when the Gateway is CREATED**, never afterwards, so
50
+ * its absence from a catalogue is a fact about that gateway rather than a
51
+ * transient condition to retry.
52
+ */
53
+ exports.AGENTCORE_GATEWAY_SEARCH_TOOL = 'x_amz_bedrock_agentcore_search';
54
+ /**
55
+ * The header that groups a caller's requests into ONE policy session.
56
+ *
57
+ * AgentCore's temporal policies decide on SEQUENCES of actions — "not after
58
+ * three refunds", "only once this was approved" — and a sequence needs a
59
+ * boundary. This header is that boundary, and without it every request is its
60
+ * own history of one, which quietly makes every sequence rule unenforceable.
61
+ */
62
+ exports.AGENTCORE_POLICY_SESSION_HEADER = 'x-amzn-bedrock-agentcore-policy-session-id';
63
+ /** The service name a SigV4 signature for a Gateway is computed against. */
64
+ exports.AGENTCORE_SIGV4_SERVICE = 'bedrock-agentcore';
65
+ /**
66
+ * The MCP endpoint of a Gateway.
67
+ *
68
+ * `https://{gatewayId}.gateway.bedrock-agentcore.{region}.amazonaws.com/mcp` —
69
+ * a shape nobody remembers correctly, which is the entire reason it is a
70
+ * function and not a line in a README.
71
+ */
72
+ function agentCoreGatewayUrl(options) {
73
+ const { gatewayId, region } = options;
74
+ if (!gatewayId || !region) {
75
+ throw new TypeError('agentCoreGatewayUrl: both `gatewayId` and `region` are required — the endpoint hostname ' +
76
+ 'is built from the two.');
77
+ }
78
+ return `https://${gatewayId}.gateway.bedrock-agentcore.${region}.amazonaws.com/mcp`;
79
+ }
80
+ exports.agentCoreGatewayUrl = agentCoreGatewayUrl;
81
+ /**
82
+ * An MCP transport pointed at an AgentCore Gateway.
83
+ *
84
+ * A configuration of {@link gatewayTransport}: the endpoint built from your
85
+ * gateway's id and region, and — when you name one — the policy session header
86
+ * stamped on every request. Token vending, the once-and-dropped secrecy rule
87
+ * and the rotation behaviour are all the neutral transport's, unchanged.
88
+ */
89
+ function agentCoreGatewayTransport(options) {
90
+ const { policySessionId, fetch: innerFetch } = options;
91
+ // The header is stamped in the `fetch` seam rather than in `headers` because
92
+ // the seam runs per request. That is what lets the session id come from a
93
+ // function, which is what keeps two people on one transport in two sessions.
94
+ const stampPolicySession = policySessionId === undefined
95
+ ? innerFetch
96
+ : async (input, init) => {
97
+ const id = typeof policySessionId === 'function' ? policySessionId() : policySessionId;
98
+ const next = id === undefined || id === ''
99
+ ? init
100
+ : {
101
+ ...init,
102
+ headers: {
103
+ ...init?.headers,
104
+ [exports.AGENTCORE_POLICY_SESSION_HEADER]: id,
105
+ },
106
+ };
107
+ return innerFetch ? innerFetch(input, next) : globalThis.fetch(input, next);
108
+ };
109
+ return (0, gatewayTransport_js_1.gatewayTransport)({
110
+ url: agentCoreGatewayUrl(options),
111
+ credentials: options.credentials,
112
+ ...(options.service !== undefined && { service: options.service }),
113
+ ...(options.scopes !== undefined && { scopes: options.scopes }),
114
+ ...(options.mode !== undefined && { mode: options.mode }),
115
+ ...(options.headers !== undefined && { headers: options.headers }),
116
+ ...(stampPolicySession !== undefined && { fetch: stampPolicySession }),
117
+ });
118
+ }
119
+ exports.agentCoreGatewayTransport = agentCoreGatewayTransport;
120
+ /**
121
+ * The Gateway's semantic search tool, if this gateway has one.
122
+ *
123
+ * Returns `undefined` rather than throwing, because absence is a legitimate and
124
+ * PERMANENT answer: semantic search is enabled when a Gateway is created and
125
+ * cannot be turned on afterwards, so there is nothing to retry.
126
+ *
127
+ * ── Why this finds the tool instead of calling it ────────────────────────────
128
+ * The obvious convenience would be `search(gateway, 'refund an order')`, and it
129
+ * is deliberately not here. Executing a tool needs a `ToolExecutionContext` —
130
+ * the call id, the iteration, the credential seam, the artifact store — and
131
+ * that object belongs to the agent loop. A helper would have to invent one,
132
+ * and a call made on an invented context is a call that appears in no trace:
133
+ * the model would be handed a shortlist nobody can later explain the origin of,
134
+ * which is the opposite of what this library is for.
135
+ *
136
+ * So the search tool is registered like any other tool, the model calls it when
137
+ * the catalogue is too large to reason about, and that call is an ordinary
138
+ * tool call in the trace — visible, attributable, and replayable.
139
+ *
140
+ * @example Give the model the catalogue's own search
141
+ * const tools = await gateway.tools();
142
+ * const search = gatewaySearchTool(tools);
143
+ * Agent.create({ provider, model })
144
+ * .tools(search ? [search] : tools) // search it, or list it
145
+ * .build();
146
+ */
147
+ function gatewaySearchTool(tools) {
148
+ return tools.find((t) => t.schema.name === exports.AGENTCORE_GATEWAY_SEARCH_TOOL);
149
+ }
150
+ exports.gatewaySearchTool = gatewaySearchTool;
151
+ /** Whether this gateway's catalogue can be searched rather than listed. */
152
+ function hasGatewaySearch(tools) {
153
+ return gatewaySearchTool(tools) !== undefined;
154
+ }
155
+ exports.hasGatewaySearch = hasGatewaySearch;
156
+ //# sourceMappingURL=agentcore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentcore.js","sourceRoot":"","sources":["../../../src/adapters/mcp/agentcore.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;;;AAEH,2EAAqF;AAKrF;;;;;;;;;;GAUG;AACU,QAAA,6BAA6B,GAAG,gCAAgC,CAAC;AAE9E;;;;;;;GAOG;AACU,QAAA,+BAA+B,GAAG,4CAA4C,CAAC;AAE5F,4EAA4E;AAC/D,QAAA,uBAAuB,GAAG,mBAAmB,CAAC;AAS3D;;;;;;GAMG;AACH,SAAgB,mBAAmB,CAAC,OAAmC;IACrE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACtC,IAAI,CAAC,SAAS,IAAI,CAAC,MAAM,EAAE,CAAC;QAC1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AAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;QAC/D,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;QACzD,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;QAClE,GAAG,CAAC,kBAAkB,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC;KACvE,CAAC,CAAC;AACL,CAAC;AAnCD,8DAmCC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,SAAgB,iBAAiB,CAAC,KAAsB;IACtD,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,qCAA6B,CAAC,CAAC;AAC5E,CAAC;AAFD,8CAEC;AAED,2EAA2E;AAC3E,SAAgB,gBAAgB,CAAC,KAAsB;IACrD,OAAO,iBAAiB,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC;AAChD,CAAC;AAFD,4CAEC"}
@@ -0,0 +1,143 @@
1
+ /**
2
+ * adapters/mcp/agentcore — reaching an AWS Bedrock **AgentCore Gateway**.
3
+ *
4
+ * ── What lives here, and why it is one file ──────────────────────────────────
5
+ * A Gateway is an MCP server, and `mcpClient` + `gatewayTransport` already know
6
+ * how to talk to one of those. Neither knows — and neither should learn — the
7
+ * handful of facts that are AgentCore's alone: the hostname its endpoints take,
8
+ * the name of the tool that searches its catalogue, the header that groups a
9
+ * caller's requests into one policy session, and the service name a SigV4
10
+ * signature is computed against. Those four facts are this file, and this file
11
+ * is the only place in the library that holds them.
12
+ *
13
+ * `gatewayTransport` says of itself: *"Nothing here is vendor-specific."* That
14
+ * stays true precisely because this exists next to it.
15
+ *
16
+ * ── What it does NOT do ──────────────────────────────────────────────────────
17
+ * It does not manage a Gateway. Creating one, adding targets, attaching a
18
+ * policy engine, enabling semantic search — all control-plane operations on
19
+ * `bedrock-agentcore-control`, all things an operator does once with the
20
+ * console, the CLI or their IaC. This is the CLIENT side: an agent using a
21
+ * gateway somebody already stood up.
22
+ *
23
+ * @example An agent whose tools come from a Gateway
24
+ * import { mcpClient } from 'agentfootprint/providers';
25
+ * import { agentCoreGatewayTransport } from 'agentfootprint/providers';
26
+ * import { agentCoreIdentity } from 'agentfootprint/security';
27
+ *
28
+ * const gateway = await mcpClient({
29
+ * name: 'gateway',
30
+ * transport: agentCoreGatewayTransport({
31
+ * gatewayId: 'my-gateway-a1b2c3d4e5',
32
+ * region: 'us-east-1',
33
+ * credentials: agentCoreIdentity({ region: 'us-east-1' }),
34
+ * }),
35
+ * });
36
+ * const tools = await gateway.tools();
37
+ */
38
+ import { type FetchLike } from '../../lib/mcp/gatewayTransport.js';
39
+ import type { McpGatewayTransport } from '../../lib/mcp/types.js';
40
+ import type { CredentialProvider } from '../../identity/types.js';
41
+ import type { Tool } from '../../core/tools.js';
42
+ /**
43
+ * The Gateway's built-in semantic tool search, by its exact wire name.
44
+ *
45
+ * It is an ordinary MCP tool — `tools/call` with `{ query }` — that returns the
46
+ * catalogue entries closest to a natural-language description. It matters at
47
+ * the scale where listing every tool into a prompt stops being sensible.
48
+ *
49
+ * **It can only be enabled when the Gateway is CREATED**, never afterwards, so
50
+ * its absence from a catalogue is a fact about that gateway rather than a
51
+ * transient condition to retry.
52
+ */
53
+ export declare const AGENTCORE_GATEWAY_SEARCH_TOOL = "x_amz_bedrock_agentcore_search";
54
+ /**
55
+ * The header that groups a caller's requests into ONE policy session.
56
+ *
57
+ * AgentCore's temporal policies decide on SEQUENCES of actions — "not after
58
+ * three refunds", "only once this was approved" — and a sequence needs a
59
+ * boundary. This header is that boundary, and without it every request is its
60
+ * own history of one, which quietly makes every sequence rule unenforceable.
61
+ */
62
+ export declare const AGENTCORE_POLICY_SESSION_HEADER = "x-amzn-bedrock-agentcore-policy-session-id";
63
+ /** The service name a SigV4 signature for a Gateway is computed against. */
64
+ export declare const AGENTCORE_SIGV4_SERVICE = "bedrock-agentcore";
65
+ export interface AgentCoreGatewayUrlOptions {
66
+ /** The gateway's id, as the console and `CreateGateway`'s response give it. */
67
+ readonly gatewayId: string;
68
+ /** The region it lives in, e.g. `'us-east-1'`. */
69
+ readonly region: string;
70
+ }
71
+ /**
72
+ * The MCP endpoint of a Gateway.
73
+ *
74
+ * `https://{gatewayId}.gateway.bedrock-agentcore.{region}.amazonaws.com/mcp` —
75
+ * a shape nobody remembers correctly, which is the entire reason it is a
76
+ * function and not a line in a README.
77
+ */
78
+ export declare function agentCoreGatewayUrl(options: AgentCoreGatewayUrlOptions): string;
79
+ export interface AgentCoreGatewayTransportOptions extends AgentCoreGatewayUrlOptions {
80
+ /** Who vends the token. `agentCoreIdentity()` is the usual answer. */
81
+ readonly credentials: CredentialProvider;
82
+ /** The downstream service id your provider keys on. Default `'gateway'`. */
83
+ readonly service?: string;
84
+ /** OAuth scopes, when the provider uses them. */
85
+ readonly scopes?: readonly string[];
86
+ /** `machine` (default) or `user`, for a gateway that acts on someone's behalf. */
87
+ readonly mode?: 'machine' | 'user';
88
+ /**
89
+ * The policy session this caller's requests belong to — a string, or a
90
+ * function consulted PER REQUEST.
91
+ *
92
+ * **Prefer the function on any transport more than one person shares.** A
93
+ * fixed string on a shared transport merges every caller's action history
94
+ * into a single policy session, which is not a small mistake: it makes one
95
+ * person's earlier actions count against another person's rule. Passing
96
+ * `() => currentSessionId` keeps the boundary where it belongs, and returning
97
+ * `undefined` sends no header at all.
98
+ */
99
+ readonly policySessionId?: string | (() => string | undefined);
100
+ /** Extra static headers. **No secrets** — these live as long as the transport. */
101
+ readonly headers?: Readonly<Record<string, string>>;
102
+ /** Your own `fetch`, called underneath the per-request vending. */
103
+ readonly fetch?: FetchLike;
104
+ }
105
+ /**
106
+ * An MCP transport pointed at an AgentCore Gateway.
107
+ *
108
+ * A configuration of {@link gatewayTransport}: the endpoint built from your
109
+ * gateway's id and region, and — when you name one — the policy session header
110
+ * stamped on every request. Token vending, the once-and-dropped secrecy rule
111
+ * and the rotation behaviour are all the neutral transport's, unchanged.
112
+ */
113
+ export declare function agentCoreGatewayTransport(options: AgentCoreGatewayTransportOptions): McpGatewayTransport;
114
+ /**
115
+ * The Gateway's semantic search tool, if this gateway has one.
116
+ *
117
+ * Returns `undefined` rather than throwing, because absence is a legitimate and
118
+ * PERMANENT answer: semantic search is enabled when a Gateway is created and
119
+ * cannot be turned on afterwards, so there is nothing to retry.
120
+ *
121
+ * ── Why this finds the tool instead of calling it ────────────────────────────
122
+ * The obvious convenience would be `search(gateway, 'refund an order')`, and it
123
+ * is deliberately not here. Executing a tool needs a `ToolExecutionContext` —
124
+ * the call id, the iteration, the credential seam, the artifact store — and
125
+ * that object belongs to the agent loop. A helper would have to invent one,
126
+ * and a call made on an invented context is a call that appears in no trace:
127
+ * the model would be handed a shortlist nobody can later explain the origin of,
128
+ * which is the opposite of what this library is for.
129
+ *
130
+ * So the search tool is registered like any other tool, the model calls it when
131
+ * the catalogue is too large to reason about, and that call is an ordinary
132
+ * tool call in the trace — visible, attributable, and replayable.
133
+ *
134
+ * @example Give the model the catalogue's own search
135
+ * const tools = await gateway.tools();
136
+ * const search = gatewaySearchTool(tools);
137
+ * Agent.create({ provider, model })
138
+ * .tools(search ? [search] : tools) // search it, or list it
139
+ * .build();
140
+ */
141
+ export declare function gatewaySearchTool(tools: readonly Tool[]): Tool | undefined;
142
+ /** Whether this gateway's catalogue can be searched rather than listed. */
143
+ export declare function hasGatewaySearch(tools: readonly Tool[]): boolean;
@@ -0,0 +1,149 @@
1
+ /**
2
+ * adapters/mcp/agentcore — reaching an AWS Bedrock **AgentCore Gateway**.
3
+ *
4
+ * ── What lives here, and why it is one file ──────────────────────────────────
5
+ * A Gateway is an MCP server, and `mcpClient` + `gatewayTransport` already know
6
+ * how to talk to one of those. Neither knows — and neither should learn — the
7
+ * handful of facts that are AgentCore's alone: the hostname its endpoints take,
8
+ * the name of the tool that searches its catalogue, the header that groups a
9
+ * caller's requests into one policy session, and the service name a SigV4
10
+ * signature is computed against. Those four facts are this file, and this file
11
+ * is the only place in the library that holds them.
12
+ *
13
+ * `gatewayTransport` says of itself: *"Nothing here is vendor-specific."* That
14
+ * stays true precisely because this exists next to it.
15
+ *
16
+ * ── What it does NOT do ──────────────────────────────────────────────────────
17
+ * It does not manage a Gateway. Creating one, adding targets, attaching a
18
+ * policy engine, enabling semantic search — all control-plane operations on
19
+ * `bedrock-agentcore-control`, all things an operator does once with the
20
+ * console, the CLI or their IaC. This is the CLIENT side: an agent using a
21
+ * gateway somebody already stood up.
22
+ *
23
+ * @example An agent whose tools come from a Gateway
24
+ * import { mcpClient } from 'agentfootprint/providers';
25
+ * import { agentCoreGatewayTransport } from 'agentfootprint/providers';
26
+ * import { agentCoreIdentity } from 'agentfootprint/security';
27
+ *
28
+ * const gateway = await mcpClient({
29
+ * name: 'gateway',
30
+ * transport: agentCoreGatewayTransport({
31
+ * gatewayId: 'my-gateway-a1b2c3d4e5',
32
+ * region: 'us-east-1',
33
+ * credentials: agentCoreIdentity({ region: 'us-east-1' }),
34
+ * }),
35
+ * });
36
+ * const tools = await gateway.tools();
37
+ */
38
+ import { gatewayTransport } from '../../lib/mcp/gatewayTransport.js';
39
+ /**
40
+ * The Gateway's built-in semantic tool search, by its exact wire name.
41
+ *
42
+ * It is an ordinary MCP tool — `tools/call` with `{ query }` — that returns the
43
+ * catalogue entries closest to a natural-language description. It matters at
44
+ * the scale where listing every tool into a prompt stops being sensible.
45
+ *
46
+ * **It can only be enabled when the Gateway is CREATED**, never afterwards, so
47
+ * its absence from a catalogue is a fact about that gateway rather than a
48
+ * transient condition to retry.
49
+ */
50
+ export const AGENTCORE_GATEWAY_SEARCH_TOOL = 'x_amz_bedrock_agentcore_search';
51
+ /**
52
+ * The header that groups a caller's requests into ONE policy session.
53
+ *
54
+ * AgentCore's temporal policies decide on SEQUENCES of actions — "not after
55
+ * three refunds", "only once this was approved" — and a sequence needs a
56
+ * boundary. This header is that boundary, and without it every request is its
57
+ * own history of one, which quietly makes every sequence rule unenforceable.
58
+ */
59
+ export const AGENTCORE_POLICY_SESSION_HEADER = 'x-amzn-bedrock-agentcore-policy-session-id';
60
+ /** The service name a SigV4 signature for a Gateway is computed against. */
61
+ export const AGENTCORE_SIGV4_SERVICE = 'bedrock-agentcore';
62
+ /**
63
+ * The MCP endpoint of a Gateway.
64
+ *
65
+ * `https://{gatewayId}.gateway.bedrock-agentcore.{region}.amazonaws.com/mcp` —
66
+ * a shape nobody remembers correctly, which is the entire reason it is a
67
+ * function and not a line in a README.
68
+ */
69
+ export function agentCoreGatewayUrl(options) {
70
+ const { gatewayId, region } = options;
71
+ if (!gatewayId || !region) {
72
+ throw new TypeError('agentCoreGatewayUrl: both `gatewayId` and `region` are required — the endpoint hostname ' +
73
+ 'is built from the two.');
74
+ }
75
+ return `https://${gatewayId}.gateway.bedrock-agentcore.${region}.amazonaws.com/mcp`;
76
+ }
77
+ /**
78
+ * An MCP transport pointed at an AgentCore Gateway.
79
+ *
80
+ * A configuration of {@link gatewayTransport}: the endpoint built from your
81
+ * gateway's id and region, and — when you name one — the policy session header
82
+ * stamped on every request. Token vending, the once-and-dropped secrecy rule
83
+ * and the rotation behaviour are all the neutral transport's, unchanged.
84
+ */
85
+ export function agentCoreGatewayTransport(options) {
86
+ const { policySessionId, fetch: innerFetch } = options;
87
+ // The header is stamped in the `fetch` seam rather than in `headers` because
88
+ // the seam runs per request. That is what lets the session id come from a
89
+ // function, which is what keeps two people on one transport in two sessions.
90
+ const stampPolicySession = policySessionId === undefined
91
+ ? innerFetch
92
+ : async (input, init) => {
93
+ const id = typeof policySessionId === 'function' ? policySessionId() : policySessionId;
94
+ const next = id === undefined || id === ''
95
+ ? init
96
+ : {
97
+ ...init,
98
+ headers: {
99
+ ...init?.headers,
100
+ [AGENTCORE_POLICY_SESSION_HEADER]: id,
101
+ },
102
+ };
103
+ return innerFetch ? innerFetch(input, next) : globalThis.fetch(input, next);
104
+ };
105
+ return gatewayTransport({
106
+ url: agentCoreGatewayUrl(options),
107
+ credentials: options.credentials,
108
+ ...(options.service !== undefined && { service: options.service }),
109
+ ...(options.scopes !== undefined && { scopes: options.scopes }),
110
+ ...(options.mode !== undefined && { mode: options.mode }),
111
+ ...(options.headers !== undefined && { headers: options.headers }),
112
+ ...(stampPolicySession !== undefined && { fetch: stampPolicySession }),
113
+ });
114
+ }
115
+ /**
116
+ * The Gateway's semantic search tool, if this gateway has one.
117
+ *
118
+ * Returns `undefined` rather than throwing, because absence is a legitimate and
119
+ * PERMANENT answer: semantic search is enabled when a Gateway is created and
120
+ * cannot be turned on afterwards, so there is nothing to retry.
121
+ *
122
+ * ── Why this finds the tool instead of calling it ────────────────────────────
123
+ * The obvious convenience would be `search(gateway, 'refund an order')`, and it
124
+ * is deliberately not here. Executing a tool needs a `ToolExecutionContext` —
125
+ * the call id, the iteration, the credential seam, the artifact store — and
126
+ * that object belongs to the agent loop. A helper would have to invent one,
127
+ * and a call made on an invented context is a call that appears in no trace:
128
+ * the model would be handed a shortlist nobody can later explain the origin of,
129
+ * which is the opposite of what this library is for.
130
+ *
131
+ * So the search tool is registered like any other tool, the model calls it when
132
+ * the catalogue is too large to reason about, and that call is an ordinary
133
+ * tool call in the trace — visible, attributable, and replayable.
134
+ *
135
+ * @example Give the model the catalogue's own search
136
+ * const tools = await gateway.tools();
137
+ * const search = gatewaySearchTool(tools);
138
+ * Agent.create({ provider, model })
139
+ * .tools(search ? [search] : tools) // search it, or list it
140
+ * .build();
141
+ */
142
+ export function gatewaySearchTool(tools) {
143
+ return tools.find((t) => t.schema.name === AGENTCORE_GATEWAY_SEARCH_TOOL);
144
+ }
145
+ /** Whether this gateway's catalogue can be searched rather than listed. */
146
+ export function hasGatewaySearch(tools) {
147
+ return gatewaySearchTool(tools) !== undefined;
148
+ }
149
+ //# sourceMappingURL=agentcore.js.map
@@ -0,0 +1 @@
1
+ {"version":3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AAC,KAAK,SAAS,CAAC;AAChD,CAAC"}
@@ -52,4 +52,6 @@ export { gatedTools } from './gatedTools.js';
52
52
  export { skillScopedTools, skillScopedToolsTarget, SKILL_SCOPED_TOOLS_ID_PREFIX, } from './skillScopedTools.js';
53
53
  export type { ToolProvider, ToolDispatchContext, ToolGatePredicate } from './types.js';
54
54
  export { mcpClient, mcpServe, mockMcpClient, gatewayTransport, GatewayAuthorizationRequiredError, } from '../lib/mcp/index.js';
55
+ export { agentCoreGatewayTransport, agentCoreGatewayUrl, gatewaySearchTool, hasGatewaySearch, AGENTCORE_GATEWAY_SEARCH_TOOL, AGENTCORE_POLICY_SESSION_HEADER, AGENTCORE_SIGV4_SERVICE, } from '../adapters/mcp/agentcore.js';
56
+ export type { AgentCoreGatewayTransportOptions, AgentCoreGatewayUrlOptions, } from '../adapters/mcp/agentcore.js';
55
57
  export type { GatewayTransportOptions, McpCallToolResult, McpClient, McpClientOptions, McpSdkClient, McpTransport, McpStdioTransport, McpHttpTransport, McpGatewayTransport, MockMcpClientOptions, MockMcpTool, McpServeOptions, McpServeHandle, McpServeTransport, McpStdioServeTransport, McpHttpServeTransport, McpSdkServer, } from '../lib/mcp/index.js';
@@ -57,4 +57,9 @@ skillScopedToolsTarget, SKILL_SCOPED_TOOLS_ID_PREFIX, } from './skillScopedTools
57
57
  // one place. This subpath is the ONLY place `mcpClient` is public — the
58
58
  // top-level barrel does not re-export it.
59
59
  export { mcpClient, mcpServe, mockMcpClient, gatewayTransport, GatewayAuthorizationRequiredError, } from '../lib/mcp/index.js';
60
+ // Reaching an AWS Bedrock AgentCore Gateway (9.66.0). A configuration of
61
+ // `gatewayTransport` plus the four facts that are AgentCore's alone — kept in
62
+ // the vendor's own file so the transport above stays able to say, truthfully,
63
+ // that nothing in it is vendor-specific.
64
+ export { agentCoreGatewayTransport, agentCoreGatewayUrl, gatewaySearchTool, hasGatewaySearch, AGENTCORE_GATEWAY_SEARCH_TOOL, AGENTCORE_POLICY_SESSION_HEADER, AGENTCORE_SIGV4_SERVICE, } from '../adapters/mcp/agentcore.js';
60
65
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tool-providers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,gBAAgB;AAChB,kFAAkF;AAClF,kFAAkF;AAClF,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,uBAAuB,CAAC;AAG/B,uEAAuE;AACvE,wEAAwE;AACxE,0CAA0C;AAC1C,OAAO,EACL,SAAS,EACT,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,iCAAiC,GAClC,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tool-providers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,gBAAgB;AAChB,kFAAkF;AAClF,kFAAkF;AAClF,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,uBAAuB,CAAC;AAG/B,uEAAuE;AACvE,wEAAwE;AACxE,0CAA0C;AAC1C,OAAO,EACL,SAAS,EACT,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,iCAAiC,GAClC,MAAM,qBAAqB,CAAC;AAC7B,yEAAyE;AACzE,8EAA8E;AAC9E,8EAA8E;AAC9E,yCAAyC;AACzC,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,6BAA6B,EAC7B,+BAA+B,EAC/B,uBAAuB,GACxB,MAAM,8BAA8B,CAAC"}
@@ -49,7 +49,7 @@
49
49
  * symbols, one door. Import from the door.
50
50
  */
51
51
  Object.defineProperty(exports, "__esModule", { value: true });
52
- exports.GatewayAuthorizationRequiredError = exports.gatewayTransport = exports.mockMcpClient = exports.mcpServe = exports.mcpClient = exports.SKILL_SCOPED_TOOLS_ID_PREFIX = exports.skillScopedToolsTarget = exports.skillScopedTools = exports.gatedTools = exports.staticTools = void 0;
52
+ exports.AGENTCORE_SIGV4_SERVICE = exports.AGENTCORE_POLICY_SESSION_HEADER = exports.AGENTCORE_GATEWAY_SEARCH_TOOL = exports.hasGatewaySearch = exports.gatewaySearchTool = exports.agentCoreGatewayUrl = exports.agentCoreGatewayTransport = exports.GatewayAuthorizationRequiredError = exports.gatewayTransport = exports.mockMcpClient = exports.mcpServe = exports.mcpClient = exports.SKILL_SCOPED_TOOLS_ID_PREFIX = exports.skillScopedToolsTarget = exports.skillScopedTools = exports.gatedTools = exports.staticTools = void 0;
53
53
  var staticTools_js_1 = require("./staticTools.js");
54
54
  Object.defineProperty(exports, "staticTools", { enumerable: true, get: function () { return staticTools_js_1.staticTools; } });
55
55
  var gatedTools_js_1 = require("./gatedTools.js");
@@ -69,4 +69,16 @@ Object.defineProperty(exports, "mcpServe", { enumerable: true, get: function ()
69
69
  Object.defineProperty(exports, "mockMcpClient", { enumerable: true, get: function () { return index_js_1.mockMcpClient; } });
70
70
  Object.defineProperty(exports, "gatewayTransport", { enumerable: true, get: function () { return index_js_1.gatewayTransport; } });
71
71
  Object.defineProperty(exports, "GatewayAuthorizationRequiredError", { enumerable: true, get: function () { return index_js_1.GatewayAuthorizationRequiredError; } });
72
+ // Reaching an AWS Bedrock AgentCore Gateway (9.66.0). A configuration of
73
+ // `gatewayTransport` plus the four facts that are AgentCore's alone — kept in
74
+ // the vendor's own file so the transport above stays able to say, truthfully,
75
+ // that nothing in it is vendor-specific.
76
+ var agentcore_js_1 = require("../adapters/mcp/agentcore.js");
77
+ Object.defineProperty(exports, "agentCoreGatewayTransport", { enumerable: true, get: function () { return agentcore_js_1.agentCoreGatewayTransport; } });
78
+ Object.defineProperty(exports, "agentCoreGatewayUrl", { enumerable: true, get: function () { return agentcore_js_1.agentCoreGatewayUrl; } });
79
+ Object.defineProperty(exports, "gatewaySearchTool", { enumerable: true, get: function () { return agentcore_js_1.gatewaySearchTool; } });
80
+ Object.defineProperty(exports, "hasGatewaySearch", { enumerable: true, get: function () { return agentcore_js_1.hasGatewaySearch; } });
81
+ Object.defineProperty(exports, "AGENTCORE_GATEWAY_SEARCH_TOOL", { enumerable: true, get: function () { return agentcore_js_1.AGENTCORE_GATEWAY_SEARCH_TOOL; } });
82
+ Object.defineProperty(exports, "AGENTCORE_POLICY_SESSION_HEADER", { enumerable: true, get: function () { return agentcore_js_1.AGENTCORE_POLICY_SESSION_HEADER; } });
83
+ Object.defineProperty(exports, "AGENTCORE_SIGV4_SERVICE", { enumerable: true, get: function () { return agentcore_js_1.AGENTCORE_SIGV4_SERVICE; } });
72
84
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tool-providers/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;;;AAEH,mDAA+C;AAAtC,6GAAA,WAAW,OAAA;AACpB,iDAA6C;AAApC,2GAAA,UAAU,OAAA;AACnB,6DAM+B;AAL7B,uHAAA,gBAAgB,OAAA;AAChB,kFAAkF;AAClF,kFAAkF;AAClF,6HAAA,sBAAsB,OAAA;AACtB,mIAAA,4BAA4B,OAAA;AAI9B,uEAAuE;AACvE,wEAAwE;AACxE,0CAA0C;AAC1C,gDAM6B;AAL3B,qGAAA,SAAS,OAAA;AACT,oGAAA,QAAQ,OAAA;AACR,yGAAA,aAAa,OAAA;AACb,4GAAA,gBAAgB,OAAA;AAChB,6HAAA,iCAAiC,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tool-providers/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;;;AAEH,mDAA+C;AAAtC,6GAAA,WAAW,OAAA;AACpB,iDAA6C;AAApC,2GAAA,UAAU,OAAA;AACnB,6DAM+B;AAL7B,uHAAA,gBAAgB,OAAA;AAChB,kFAAkF;AAClF,kFAAkF;AAClF,6HAAA,sBAAsB,OAAA;AACtB,mIAAA,4BAA4B,OAAA;AAI9B,uEAAuE;AACvE,wEAAwE;AACxE,0CAA0C;AAC1C,gDAM6B;AAL3B,qGAAA,SAAS,OAAA;AACT,oGAAA,QAAQ,OAAA;AACR,yGAAA,aAAa,OAAA;AACb,4GAAA,gBAAgB,OAAA;AAChB,6HAAA,iCAAiC,OAAA;AAEnC,yEAAyE;AACzE,8EAA8E;AAC9E,8EAA8E;AAC9E,yCAAyC;AACzC,6DAQsC;AAPpC,yHAAA,yBAAyB,OAAA;AACzB,mHAAA,mBAAmB,OAAA;AACnB,iHAAA,iBAAiB,OAAA;AACjB,gHAAA,gBAAgB,OAAA;AAChB,6HAAA,6BAA6B,OAAA;AAC7B,+HAAA,+BAA+B,OAAA;AAC/B,uHAAA,uBAAuB,OAAA"}
@@ -0,0 +1,144 @@
1
+ /**
2
+ * adapters/mcp/agentcore — reaching an AWS Bedrock **AgentCore Gateway**.
3
+ *
4
+ * ── What lives here, and why it is one file ──────────────────────────────────
5
+ * A Gateway is an MCP server, and `mcpClient` + `gatewayTransport` already know
6
+ * how to talk to one of those. Neither knows — and neither should learn — the
7
+ * handful of facts that are AgentCore's alone: the hostname its endpoints take,
8
+ * the name of the tool that searches its catalogue, the header that groups a
9
+ * caller's requests into one policy session, and the service name a SigV4
10
+ * signature is computed against. Those four facts are this file, and this file
11
+ * is the only place in the library that holds them.
12
+ *
13
+ * `gatewayTransport` says of itself: *"Nothing here is vendor-specific."* That
14
+ * stays true precisely because this exists next to it.
15
+ *
16
+ * ── What it does NOT do ──────────────────────────────────────────────────────
17
+ * It does not manage a Gateway. Creating one, adding targets, attaching a
18
+ * policy engine, enabling semantic search — all control-plane operations on
19
+ * `bedrock-agentcore-control`, all things an operator does once with the
20
+ * console, the CLI or their IaC. This is the CLIENT side: an agent using a
21
+ * gateway somebody already stood up.
22
+ *
23
+ * @example An agent whose tools come from a Gateway
24
+ * import { mcpClient } from 'agentfootprint/providers';
25
+ * import { agentCoreGatewayTransport } from 'agentfootprint/providers';
26
+ * import { agentCoreIdentity } from 'agentfootprint/security';
27
+ *
28
+ * const gateway = await mcpClient({
29
+ * name: 'gateway',
30
+ * transport: agentCoreGatewayTransport({
31
+ * gatewayId: 'my-gateway-a1b2c3d4e5',
32
+ * region: 'us-east-1',
33
+ * credentials: agentCoreIdentity({ region: 'us-east-1' }),
34
+ * }),
35
+ * });
36
+ * const tools = await gateway.tools();
37
+ */
38
+ import { type FetchLike } from '../../lib/mcp/gatewayTransport.js';
39
+ import type { McpGatewayTransport } from '../../lib/mcp/types.js';
40
+ import type { CredentialProvider } from '../../identity/types.js';
41
+ import type { Tool } from '../../core/tools.js';
42
+ /**
43
+ * The Gateway's built-in semantic tool search, by its exact wire name.
44
+ *
45
+ * It is an ordinary MCP tool — `tools/call` with `{ query }` — that returns the
46
+ * catalogue entries closest to a natural-language description. It matters at
47
+ * the scale where listing every tool into a prompt stops being sensible.
48
+ *
49
+ * **It can only be enabled when the Gateway is CREATED**, never afterwards, so
50
+ * its absence from a catalogue is a fact about that gateway rather than a
51
+ * transient condition to retry.
52
+ */
53
+ export declare const AGENTCORE_GATEWAY_SEARCH_TOOL = "x_amz_bedrock_agentcore_search";
54
+ /**
55
+ * The header that groups a caller's requests into ONE policy session.
56
+ *
57
+ * AgentCore's temporal policies decide on SEQUENCES of actions — "not after
58
+ * three refunds", "only once this was approved" — and a sequence needs a
59
+ * boundary. This header is that boundary, and without it every request is its
60
+ * own history of one, which quietly makes every sequence rule unenforceable.
61
+ */
62
+ export declare const AGENTCORE_POLICY_SESSION_HEADER = "x-amzn-bedrock-agentcore-policy-session-id";
63
+ /** The service name a SigV4 signature for a Gateway is computed against. */
64
+ export declare const AGENTCORE_SIGV4_SERVICE = "bedrock-agentcore";
65
+ export interface AgentCoreGatewayUrlOptions {
66
+ /** The gateway's id, as the console and `CreateGateway`'s response give it. */
67
+ readonly gatewayId: string;
68
+ /** The region it lives in, e.g. `'us-east-1'`. */
69
+ readonly region: string;
70
+ }
71
+ /**
72
+ * The MCP endpoint of a Gateway.
73
+ *
74
+ * `https://{gatewayId}.gateway.bedrock-agentcore.{region}.amazonaws.com/mcp` —
75
+ * a shape nobody remembers correctly, which is the entire reason it is a
76
+ * function and not a line in a README.
77
+ */
78
+ export declare function agentCoreGatewayUrl(options: AgentCoreGatewayUrlOptions): string;
79
+ export interface AgentCoreGatewayTransportOptions extends AgentCoreGatewayUrlOptions {
80
+ /** Who vends the token. `agentCoreIdentity()` is the usual answer. */
81
+ readonly credentials: CredentialProvider;
82
+ /** The downstream service id your provider keys on. Default `'gateway'`. */
83
+ readonly service?: string;
84
+ /** OAuth scopes, when the provider uses them. */
85
+ readonly scopes?: readonly string[];
86
+ /** `machine` (default) or `user`, for a gateway that acts on someone's behalf. */
87
+ readonly mode?: 'machine' | 'user';
88
+ /**
89
+ * The policy session this caller's requests belong to — a string, or a
90
+ * function consulted PER REQUEST.
91
+ *
92
+ * **Prefer the function on any transport more than one person shares.** A
93
+ * fixed string on a shared transport merges every caller's action history
94
+ * into a single policy session, which is not a small mistake: it makes one
95
+ * person's earlier actions count against another person's rule. Passing
96
+ * `() => currentSessionId` keeps the boundary where it belongs, and returning
97
+ * `undefined` sends no header at all.
98
+ */
99
+ readonly policySessionId?: string | (() => string | undefined);
100
+ /** Extra static headers. **No secrets** — these live as long as the transport. */
101
+ readonly headers?: Readonly<Record<string, string>>;
102
+ /** Your own `fetch`, called underneath the per-request vending. */
103
+ readonly fetch?: FetchLike;
104
+ }
105
+ /**
106
+ * An MCP transport pointed at an AgentCore Gateway.
107
+ *
108
+ * A configuration of {@link gatewayTransport}: the endpoint built from your
109
+ * gateway's id and region, and — when you name one — the policy session header
110
+ * stamped on every request. Token vending, the once-and-dropped secrecy rule
111
+ * and the rotation behaviour are all the neutral transport's, unchanged.
112
+ */
113
+ export declare function agentCoreGatewayTransport(options: AgentCoreGatewayTransportOptions): McpGatewayTransport;
114
+ /**
115
+ * The Gateway's semantic search tool, if this gateway has one.
116
+ *
117
+ * Returns `undefined` rather than throwing, because absence is a legitimate and
118
+ * PERMANENT answer: semantic search is enabled when a Gateway is created and
119
+ * cannot be turned on afterwards, so there is nothing to retry.
120
+ *
121
+ * ── Why this finds the tool instead of calling it ────────────────────────────
122
+ * The obvious convenience would be `search(gateway, 'refund an order')`, and it
123
+ * is deliberately not here. Executing a tool needs a `ToolExecutionContext` —
124
+ * the call id, the iteration, the credential seam, the artifact store — and
125
+ * that object belongs to the agent loop. A helper would have to invent one,
126
+ * and a call made on an invented context is a call that appears in no trace:
127
+ * the model would be handed a shortlist nobody can later explain the origin of,
128
+ * which is the opposite of what this library is for.
129
+ *
130
+ * So the search tool is registered like any other tool, the model calls it when
131
+ * the catalogue is too large to reason about, and that call is an ordinary
132
+ * tool call in the trace — visible, attributable, and replayable.
133
+ *
134
+ * @example Give the model the catalogue's own search
135
+ * const tools = await gateway.tools();
136
+ * const search = gatewaySearchTool(tools);
137
+ * Agent.create({ provider, model })
138
+ * .tools(search ? [search] : tools) // search it, or list it
139
+ * .build();
140
+ */
141
+ export declare function gatewaySearchTool(tools: readonly Tool[]): Tool | undefined;
142
+ /** Whether this gateway's catalogue can be searched rather than listed. */
143
+ export declare function hasGatewaySearch(tools: readonly Tool[]): boolean;
144
+ //# sourceMappingURL=agentcore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentcore.d.ts","sourceRoot":"","sources":["../../../../src/adapters/mcp/agentcore.ts"],"names":[],"mappings":"AA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AAC,CAAC,CAAC;IACpD,mEAAmE;IACnE,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,gCAAgC,GACxC,mBAAmB,CAiCrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,IAAI,GAAG,SAAS,CAE1E;AAED,2EAA2E;AAC3E,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,OAAO,CAEhE"}
@@ -52,5 +52,7 @@ export { gatedTools } from './gatedTools.js';
52
52
  export { skillScopedTools, skillScopedToolsTarget, SKILL_SCOPED_TOOLS_ID_PREFIX, } from './skillScopedTools.js';
53
53
  export type { ToolProvider, ToolDispatchContext, ToolGatePredicate } from './types.js';
54
54
  export { mcpClient, mcpServe, mockMcpClient, gatewayTransport, GatewayAuthorizationRequiredError, } from '../lib/mcp/index.js';
55
+ export { agentCoreGatewayTransport, agentCoreGatewayUrl, gatewaySearchTool, hasGatewaySearch, AGENTCORE_GATEWAY_SEARCH_TOOL, AGENTCORE_POLICY_SESSION_HEADER, AGENTCORE_SIGV4_SERVICE, } from '../adapters/mcp/agentcore.js';
56
+ export type { AgentCoreGatewayTransportOptions, AgentCoreGatewayUrlOptions, } from '../adapters/mcp/agentcore.js';
55
57
  export type { GatewayTransportOptions, McpCallToolResult, McpClient, McpClientOptions, McpSdkClient, McpTransport, McpStdioTransport, McpHttpTransport, McpGatewayTransport, MockMcpClientOptions, MockMcpTool, McpServeOptions, McpServeHandle, McpServeTransport, McpStdioServeTransport, McpHttpServeTransport, McpSdkServer, } from '../lib/mcp/index.js';
56
58
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tool-providers/index.ts"],"names":[],"mappings":"AAAA;;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B,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,6BAA6B,EAC7B,+BAA+B,EAC/B,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,gCAAgC,EAChC,0BAA0B,GAC3B,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACX,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,YAAY,GACb,MAAM,qBAAqB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentfootprint",
3
- "version": "9.66.0",
3
+ "version": "9.67.0",
4
4
  "description": "The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",