agentfootprint 11.4.0 → 11.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/CAPABILITIES.md +2 -1
- package/dist/adapters/mcp/agentcoreRuntime/invoke.js +7 -6
- package/dist/adapters/mcp/agentcoreRuntime/invoke.js.map +1 -1
- package/dist/adapters/mcp/agentcoreRuntime/sessionBusy.js +36 -2
- package/dist/adapters/mcp/agentcoreRuntime/sessionBusy.js.map +1 -1
- package/dist/adapters/mcp/agentcoreRuntime/transport.js +3 -1
- package/dist/adapters/mcp/agentcoreRuntime/transport.js.map +1 -1
- package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.d.ts +7 -6
- package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.js +7 -6
- package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.js.map +1 -1
- package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts +32 -1
- package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.js +35 -1
- package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.js.map +1 -1
- package/dist/esm/adapters/mcp/agentcoreRuntime/transport.js +4 -2
- package/dist/esm/adapters/mcp/agentcoreRuntime/transport.js.map +1 -1
- package/dist/esm/events/payloads.d.ts +128 -27
- package/dist/esm/mcp/callLifetime.d.ts +57 -14
- package/dist/esm/mcp/callLifetime.js +67 -19
- package/dist/esm/mcp/callLifetime.js.map +1 -1
- package/dist/esm/mcp/callMarker.d.ts +43 -0
- package/dist/esm/mcp/callMarker.js +69 -0
- package/dist/esm/mcp/callMarker.js.map +1 -0
- package/dist/esm/mcp/connectionRefusals.js +7 -0
- package/dist/esm/mcp/connectionRefusals.js.map +1 -1
- package/dist/esm/mcp/index.d.ts +2 -0
- package/dist/esm/mcp/index.js +3 -0
- package/dist/esm/mcp/index.js.map +1 -1
- package/dist/esm/mcp/mcpClient.js +93 -26
- package/dist/esm/mcp/mcpClient.js.map +1 -1
- package/dist/esm/mcp/replay.d.ts +283 -0
- package/dist/esm/mcp/replay.js +401 -0
- package/dist/esm/mcp/replay.js.map +1 -0
- package/dist/esm/mcp/replayUnavailable.d.ts +55 -0
- package/dist/esm/mcp/replayUnavailable.js +74 -0
- package/dist/esm/mcp/replayUnavailable.js.map +1 -0
- package/dist/esm/mcp/requestLedger.d.ts +115 -32
- package/dist/esm/mcp/requestLedger.js +193 -52
- package/dist/esm/mcp/requestLedger.js.map +1 -1
- package/dist/esm/mcp/seriesEvidence.d.ts +73 -15
- package/dist/esm/mcp/seriesEvidence.js +114 -21
- package/dist/esm/mcp/seriesEvidence.js.map +1 -1
- package/dist/esm/mcp/throttleRetry.d.ts +86 -42
- package/dist/esm/mcp/throttleRetry.js +158 -50
- package/dist/esm/mcp/throttleRetry.js.map +1 -1
- package/dist/esm/mcp/toolResult.d.ts +6 -0
- package/dist/esm/mcp/toolResult.js +15 -0
- package/dist/esm/mcp/toolResult.js.map +1 -1
- package/dist/esm/mcp/types.d.ts +70 -8
- package/dist/esm/redaction/knownStrings.js +13 -0
- package/dist/esm/redaction/knownStrings.js.map +1 -1
- package/dist/esm/tool-providers/index.d.ts +2 -2
- package/dist/esm/tool-providers/index.js +4 -0
- package/dist/esm/tool-providers/index.js.map +1 -1
- package/dist/esm/tools/requestEvidence.js +60 -0
- package/dist/esm/tools/requestEvidence.js.map +1 -1
- package/dist/mcp/callLifetime.js +66 -18
- package/dist/mcp/callLifetime.js.map +1 -1
- package/dist/mcp/callMarker.js +74 -0
- package/dist/mcp/callMarker.js.map +1 -0
- package/dist/mcp/connectionRefusals.js +7 -0
- package/dist/mcp/connectionRefusals.js.map +1 -1
- package/dist/mcp/index.js +5 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/mcpClient.js +91 -24
- package/dist/mcp/mcpClient.js.map +1 -1
- package/dist/mcp/replay.js +411 -0
- package/dist/mcp/replay.js.map +1 -0
- package/dist/mcp/replayUnavailable.js +79 -0
- package/dist/mcp/replayUnavailable.js.map +1 -0
- package/dist/mcp/requestLedger.js +193 -52
- package/dist/mcp/requestLedger.js.map +1 -1
- package/dist/mcp/seriesEvidence.js +116 -22
- package/dist/mcp/seriesEvidence.js.map +1 -1
- package/dist/mcp/throttleRetry.js +160 -51
- package/dist/mcp/throttleRetry.js.map +1 -1
- package/dist/mcp/toolResult.js +17 -1
- package/dist/mcp/toolResult.js.map +1 -1
- package/dist/redaction/knownStrings.js +13 -0
- package/dist/redaction/knownStrings.js.map +1 -1
- package/dist/tool-providers/index.js +5 -1
- package/dist/tool-providers/index.js.map +1 -1
- package/dist/tools/requestEvidence.js +60 -0
- package/dist/tools/requestEvidence.js.map +1 -1
- package/dist/types/adapters/mcp/agentcoreRuntime/invoke.d.ts +7 -6
- package/dist/types/adapters/mcp/agentcoreRuntime/invoke.d.ts.map +1 -1
- package/dist/types/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts +32 -1
- package/dist/types/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts.map +1 -1
- package/dist/types/adapters/mcp/agentcoreRuntime/transport.d.ts.map +1 -1
- package/dist/types/events/payloads.d.ts +128 -27
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/mcp/callLifetime.d.ts +57 -14
- package/dist/types/mcp/callLifetime.d.ts.map +1 -1
- package/dist/types/mcp/callMarker.d.ts +44 -0
- package/dist/types/mcp/callMarker.d.ts.map +1 -0
- package/dist/types/mcp/index.d.ts +2 -0
- package/dist/types/mcp/index.d.ts.map +1 -1
- package/dist/types/mcp/mcpClient.d.ts.map +1 -1
- package/dist/types/mcp/replay.d.ts +284 -0
- package/dist/types/mcp/replay.d.ts.map +1 -0
- package/dist/types/mcp/replayUnavailable.d.ts +56 -0
- package/dist/types/mcp/replayUnavailable.d.ts.map +1 -0
- package/dist/types/mcp/requestLedger.d.ts +115 -32
- package/dist/types/mcp/requestLedger.d.ts.map +1 -1
- package/dist/types/mcp/seriesEvidence.d.ts +73 -15
- package/dist/types/mcp/seriesEvidence.d.ts.map +1 -1
- package/dist/types/mcp/throttleRetry.d.ts +86 -42
- package/dist/types/mcp/throttleRetry.d.ts.map +1 -1
- package/dist/types/mcp/toolResult.d.ts +6 -0
- package/dist/types/mcp/toolResult.d.ts.map +1 -1
- package/dist/types/mcp/types.d.ts +70 -8
- package/dist/types/mcp/types.d.ts.map +1 -1
- package/dist/types/redaction/knownStrings.d.ts.map +1 -1
- package/dist/types/tool-providers/index.d.ts +2 -2
- package/dist/types/tool-providers/index.d.ts.map +1 -1
- package/dist/types/tools/requestEvidence.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,48 +1,73 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* requestLedger — which dispatched tool call an MCP request belongs to, so the
|
|
3
|
-
* retry series that sends it files its attempts into THAT call's run;
|
|
4
|
-
*
|
|
3
|
+
* retry series that sends it files its attempts into THAT call's run; when the
|
|
4
|
+
* MCP SDK cancels a request, so the series sending it stops; and whether the
|
|
5
|
+
* request's JSON-RPC answer arrived.
|
|
5
6
|
*
|
|
6
7
|
* Pattern: a per-connection ledger + the SDK transport's `send`, watched in place.
|
|
7
8
|
* Role: The middle of the evidence seam (`tools/requestEvidence.ts` is its
|
|
8
9
|
* door). The retry series runs inside the transport's `fetch`, which
|
|
9
10
|
* the MCP SDK calls with a serialized body and nothing else — no tool
|
|
10
|
-
* call, no run. Three hops carry the call down to it
|
|
11
|
-
* identity the hop already holds:
|
|
11
|
+
* call, no run. Three hops carry the call down to it:
|
|
12
12
|
*
|
|
13
|
-
* 1. call →
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* 2.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
13
|
+
* 1. call → marker `issue`: the MCP tool gets a library-private marker and
|
|
14
|
+
* puts it in its request's `_meta` (`callMarker.ts`). It
|
|
15
|
+
* survives an SDK that copies the params.
|
|
16
|
+
* 2. marker → id the watched `send` takes the marker out of the message
|
|
17
|
+
* — the server receives the bytes it always did — and
|
|
18
|
+
* keys the call by the JSON-RPC `id` the SDK assigned.
|
|
19
19
|
* 3. id → series `claim`: the series reads the `id` back out of the body
|
|
20
20
|
* it is about to send.
|
|
21
21
|
*
|
|
22
22
|
* CANCELLATION DOES NOT WAIT ON ATTRIBUTION. Every `tools/call` in flight gets
|
|
23
|
-
* an entry,
|
|
24
|
-
* `notifications/cancelled` naming the request's id — on its own
|
|
25
|
-
* when the call's signal fires — through this same `send`. The
|
|
26
|
-
* that request's series there and then, so a request nobody waits
|
|
27
|
-
* asked again, even when
|
|
23
|
+
* an entry, matched or not, and the SDK says when it gives a request up: it
|
|
24
|
+
* sends `notifications/cancelled` naming the request's id — on its own
|
|
25
|
+
* timeout, or when the call's signal fires — through this same `send`. The
|
|
26
|
+
* ledger aborts that request's series there and then, so a request nobody waits
|
|
27
|
+
* for is never asked again, even when it could not be matched to a call.
|
|
28
28
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
29
|
+
* Under `'app-authorized'` (`strict`), two more things hold:
|
|
30
|
+
* - A `tools/call` that reaches `send` without a marker this ledger issued
|
|
31
|
+
* and has not used is REFUSED there (`replayUnavailable.ts`,
|
|
32
|
+
* `'request-unmatched'`): its answer could not be tied to any call, so it
|
|
33
|
+
* is never sent rather than guessed at.
|
|
34
|
+
* - Each matched request's answer is AWAITED, by its id: the connection's
|
|
35
|
+
* incoming messages are observed for the JSON-RPC response to it. A 202, or
|
|
36
|
+
* a stream, is not that answer. The watch ends when the answer arrives,
|
|
37
|
+
* when the SDK cancels the request, when the call settles (found by its
|
|
38
|
+
* marker, never by its params object) or when the connection closes —
|
|
39
|
+
* never when only the HTTP send finished, since a 202 or a stream can still
|
|
40
|
+
* carry the answer later.
|
|
41
|
+
*
|
|
42
|
+
* Whether the answers are observed at all is established once, at
|
|
43
|
+
* initialization: the `initialize` answer must pass the observer
|
|
44
|
+
* (`answersObserved`). An SDK whose `connect` replaces the transport's
|
|
45
|
+
* `onmessage` instead of keeping it leaves the observer out, and a call under
|
|
46
|
+
* `'app-authorized'` is then refused before it is sent (`replayUnavailable.ts`).
|
|
47
|
+
*
|
|
48
|
+
* Ids are the client's, one ledger per connection, so concurrent calls — and
|
|
49
|
+
* concurrent runs sharing one client — can never claim each other's request. A
|
|
50
|
+
* request that is not a `tools/call` (a `tools/list`, a notification, a
|
|
51
|
+
* response) claims nothing.
|
|
35
52
|
*
|
|
36
53
|
* `send` is installed as an OWN property of the transport instance — the same
|
|
37
54
|
* object, its own `send` bound to it, so a transport class with `#private`
|
|
38
55
|
* fields works as it always did. Assigning `send` again afterwards THROWS: a
|
|
39
56
|
* send that bypassed the ledger would quietly lose every call's attempts.
|
|
40
57
|
*
|
|
58
|
+
* Each matched `tools/call` also gets ONE `RequestReplay` (`replay.ts`), the
|
|
59
|
+
* facts its series, this ledger and its call share: the series' claim hands it
|
|
60
|
+
* over by the request's id, the call reads it from the entry it was issued
|
|
61
|
+
* (`IssuedCall`), which outlives the connection's close. The
|
|
62
|
+
* series writes what HTTP showed; this ledger writes whether the JSON-RPC
|
|
63
|
+
* answer arrived; the call writes how it settled.
|
|
64
|
+
*
|
|
41
65
|
* What it does NOT do: retry, wait, or decide anything. The series is the one
|
|
42
66
|
* retry owner; this only tells it whose attempts it is making, and when the SDK
|
|
43
67
|
* has stopped waiting for them.
|
|
44
68
|
*/
|
|
45
69
|
import type { RequestEvidenceSink } from '../tools/requestEvidence.js';
|
|
70
|
+
import { RequestReplay } from './replay.js';
|
|
46
71
|
/** One call's claim on the request it sends. */
|
|
47
72
|
export interface RequestTicket {
|
|
48
73
|
/** Where the request's attempts are filed. */
|
|
@@ -56,23 +81,71 @@ export interface ClaimedRequest {
|
|
|
56
81
|
readonly ticket?: RequestTicket;
|
|
57
82
|
/** Fires when the MCP SDK cancels this request (`notifications/cancelled`). */
|
|
58
83
|
readonly cancelled: AbortSignal;
|
|
84
|
+
/** What this request's series and its call share (`replay.ts` · `RequestReplay`). */
|
|
85
|
+
readonly replay: RequestReplay;
|
|
86
|
+
}
|
|
87
|
+
/** How a connection's ledger is set up. */
|
|
88
|
+
export interface RequestLedgerOptions {
|
|
89
|
+
/** The client's name, which a refusal names. */
|
|
90
|
+
readonly server: string;
|
|
91
|
+
/** The `'app-authorized'` policy is in force: see the module note. */
|
|
92
|
+
readonly strict: boolean;
|
|
59
93
|
}
|
|
60
|
-
|
|
94
|
+
type JsonRpcId = string | number;
|
|
95
|
+
/** The request a call's marker was matched to. */
|
|
96
|
+
export interface MatchedRequest {
|
|
97
|
+
readonly id: JsonRpcId;
|
|
98
|
+
readonly replay: RequestReplay;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* One call, from `issue` until it settles: the marker it sends, and the
|
|
102
|
+
* request matched to it once one was. The call holds this entry itself, so
|
|
103
|
+
* what it reads does not depend on the ledger still holding it.
|
|
104
|
+
*/
|
|
105
|
+
export interface IssuedCall {
|
|
106
|
+
readonly marker: string;
|
|
107
|
+
readonly ticket?: RequestTicket;
|
|
108
|
+
/** Set once, by the watched `send`: a marker matches ONE request. */
|
|
109
|
+
readonly request?: MatchedRequest;
|
|
110
|
+
}
|
|
111
|
+
/** Per connection: the calls issued and not yet settled, the requests being sent, the answers awaited. */
|
|
61
112
|
export declare class RequestLedger {
|
|
62
|
-
|
|
113
|
+
private readonly options;
|
|
114
|
+
/** Every call issued and not yet settled — keyed by its marker. */
|
|
63
115
|
private readonly issued;
|
|
64
|
-
/** Tickets a request was bound to. */
|
|
65
|
-
private readonly bound;
|
|
66
116
|
/** Every `tools/call` sent and not yet settled — keyed by its JSON-RPC id. */
|
|
67
117
|
private readonly sending;
|
|
118
|
+
/** Matched requests whose JSON-RPC answer is awaited (`strict` only) — by id. */
|
|
119
|
+
private readonly awaiting;
|
|
120
|
+
private initializeId;
|
|
121
|
+
private initializeAnswered;
|
|
122
|
+
private markers;
|
|
68
123
|
private calls;
|
|
69
124
|
private unboundNamed;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
125
|
+
constructor(options?: RequestLedgerOptions);
|
|
126
|
+
/**
|
|
127
|
+
* A call is about to send its request: its entry, whose `marker` the call
|
|
128
|
+
* puts in the request's `_meta` (`callMarker.ts` · `markParams`). `ticket`
|
|
129
|
+
* is where its attempts are filed, when the call carries the run's evidence
|
|
130
|
+
* port.
|
|
131
|
+
*/
|
|
132
|
+
issue(ticket?: RequestTicket): IssuedCall;
|
|
133
|
+
/** `call` settled: forget it, and stop awaiting its request's answer. */
|
|
134
|
+
settle(call: IssuedCall): void;
|
|
135
|
+
/** The connection closed: nothing it sent is awaited, and no call is pending, any more. */
|
|
136
|
+
close(): void;
|
|
137
|
+
/**
|
|
138
|
+
* Whether this connection's answers pass the observer: the `initialize`
|
|
139
|
+
* answer did. Read once the connection is initialized.
|
|
140
|
+
*/
|
|
141
|
+
get answersObserved(): boolean;
|
|
74
142
|
/** How many `tools/call` requests the watched transport has sent — matched to a call or not. */
|
|
75
143
|
get toolCallsSent(): number;
|
|
144
|
+
/**
|
|
145
|
+
* @internal How many entries the ledger holds: calls issued and not settled,
|
|
146
|
+
* requests being sent, answers awaited. Zero once every call settled.
|
|
147
|
+
*/
|
|
148
|
+
get retained(): number;
|
|
76
149
|
/** `true` the first time it is asked, then never again: an unmatched request is named once per connection. */
|
|
77
150
|
firstUnbound(): boolean;
|
|
78
151
|
/**
|
|
@@ -80,8 +153,17 @@ export declare class RequestLedger {
|
|
|
80
153
|
* original bound to the instance itself. Returns the SAME object — or
|
|
81
154
|
* `undefined` when it has no `send` to watch or refuses the property, and
|
|
82
155
|
* then nothing is watched and no call should expect its attempts filed.
|
|
156
|
+
*
|
|
157
|
+
* Its incoming messages are watched too: an `onmessage` set before the
|
|
158
|
+
* client connects, which the current MCP SDK's `Protocol.connect` keeps and
|
|
159
|
+
* calls before its own dispatch. Whether it was kept is known once the
|
|
160
|
+
* `initialize` answer has, or has not, passed it (`answersObserved`).
|
|
83
161
|
*/
|
|
84
162
|
watch<T extends object>(transport: T): T | undefined;
|
|
163
|
+
/** Observe incoming messages before whatever handled them already — never instead of it. */
|
|
164
|
+
private watchMessages;
|
|
165
|
+
/** One incoming message: the `initialize` answer, or the answer to an awaited request. */
|
|
166
|
+
private observe;
|
|
85
167
|
/**
|
|
86
168
|
* The `tools/call` request `body` carries, while its send runs — its ticket
|
|
87
169
|
* when a call issued one, and the signal its cancellation fires. `undefined`
|
|
@@ -90,8 +172,9 @@ export declare class RequestLedger {
|
|
|
90
172
|
claim(body: unknown): ClaimedRequest | undefined;
|
|
91
173
|
/** One message through the watched transport. */
|
|
92
174
|
private send;
|
|
93
|
-
/**
|
|
94
|
-
private
|
|
95
|
-
/** The SDK gave a request up: stop the series still sending it. */
|
|
175
|
+
/** The `initialize` request: its answer is the one that proves the observer is in place. */
|
|
176
|
+
private noteInitialize;
|
|
177
|
+
/** The SDK gave a request up: stop the series still sending it, and stop awaiting its answer. */
|
|
96
178
|
private cancelIfAsked;
|
|
97
179
|
}
|
|
180
|
+
export {};
|
|
@@ -1,73 +1,146 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* requestLedger — which dispatched tool call an MCP request belongs to, so the
|
|
3
|
-
* retry series that sends it files its attempts into THAT call's run;
|
|
4
|
-
*
|
|
3
|
+
* retry series that sends it files its attempts into THAT call's run; when the
|
|
4
|
+
* MCP SDK cancels a request, so the series sending it stops; and whether the
|
|
5
|
+
* request's JSON-RPC answer arrived.
|
|
5
6
|
*
|
|
6
7
|
* Pattern: a per-connection ledger + the SDK transport's `send`, watched in place.
|
|
7
8
|
* Role: The middle of the evidence seam (`tools/requestEvidence.ts` is its
|
|
8
9
|
* door). The retry series runs inside the transport's `fetch`, which
|
|
9
10
|
* the MCP SDK calls with a serialized body and nothing else — no tool
|
|
10
|
-
* call, no run. Three hops carry the call down to it
|
|
11
|
-
* identity the hop already holds:
|
|
11
|
+
* call, no run. Three hops carry the call down to it:
|
|
12
12
|
*
|
|
13
|
-
* 1. call →
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* 2.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
13
|
+
* 1. call → marker `issue`: the MCP tool gets a library-private marker and
|
|
14
|
+
* puts it in its request's `_meta` (`callMarker.ts`). It
|
|
15
|
+
* survives an SDK that copies the params.
|
|
16
|
+
* 2. marker → id the watched `send` takes the marker out of the message
|
|
17
|
+
* — the server receives the bytes it always did — and
|
|
18
|
+
* keys the call by the JSON-RPC `id` the SDK assigned.
|
|
19
19
|
* 3. id → series `claim`: the series reads the `id` back out of the body
|
|
20
20
|
* it is about to send.
|
|
21
21
|
*
|
|
22
22
|
* CANCELLATION DOES NOT WAIT ON ATTRIBUTION. Every `tools/call` in flight gets
|
|
23
|
-
* an entry,
|
|
24
|
-
* `notifications/cancelled` naming the request's id — on its own
|
|
25
|
-
* when the call's signal fires — through this same `send`. The
|
|
26
|
-
* that request's series there and then, so a request nobody waits
|
|
27
|
-
* asked again, even when
|
|
23
|
+
* an entry, matched or not, and the SDK says when it gives a request up: it
|
|
24
|
+
* sends `notifications/cancelled` naming the request's id — on its own
|
|
25
|
+
* timeout, or when the call's signal fires — through this same `send`. The
|
|
26
|
+
* ledger aborts that request's series there and then, so a request nobody waits
|
|
27
|
+
* for is never asked again, even when it could not be matched to a call.
|
|
28
28
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
29
|
+
* Under `'app-authorized'` (`strict`), two more things hold:
|
|
30
|
+
* - A `tools/call` that reaches `send` without a marker this ledger issued
|
|
31
|
+
* and has not used is REFUSED there (`replayUnavailable.ts`,
|
|
32
|
+
* `'request-unmatched'`): its answer could not be tied to any call, so it
|
|
33
|
+
* is never sent rather than guessed at.
|
|
34
|
+
* - Each matched request's answer is AWAITED, by its id: the connection's
|
|
35
|
+
* incoming messages are observed for the JSON-RPC response to it. A 202, or
|
|
36
|
+
* a stream, is not that answer. The watch ends when the answer arrives,
|
|
37
|
+
* when the SDK cancels the request, when the call settles (found by its
|
|
38
|
+
* marker, never by its params object) or when the connection closes —
|
|
39
|
+
* never when only the HTTP send finished, since a 202 or a stream can still
|
|
40
|
+
* carry the answer later.
|
|
41
|
+
*
|
|
42
|
+
* Whether the answers are observed at all is established once, at
|
|
43
|
+
* initialization: the `initialize` answer must pass the observer
|
|
44
|
+
* (`answersObserved`). An SDK whose `connect` replaces the transport's
|
|
45
|
+
* `onmessage` instead of keeping it leaves the observer out, and a call under
|
|
46
|
+
* `'app-authorized'` is then refused before it is sent (`replayUnavailable.ts`).
|
|
47
|
+
*
|
|
48
|
+
* Ids are the client's, one ledger per connection, so concurrent calls — and
|
|
49
|
+
* concurrent runs sharing one client — can never claim each other's request. A
|
|
50
|
+
* request that is not a `tools/call` (a `tools/list`, a notification, a
|
|
51
|
+
* response) claims nothing.
|
|
35
52
|
*
|
|
36
53
|
* `send` is installed as an OWN property of the transport instance — the same
|
|
37
54
|
* object, its own `send` bound to it, so a transport class with `#private`
|
|
38
55
|
* fields works as it always did. Assigning `send` again afterwards THROWS: a
|
|
39
56
|
* send that bypassed the ledger would quietly lose every call's attempts.
|
|
40
57
|
*
|
|
58
|
+
* Each matched `tools/call` also gets ONE `RequestReplay` (`replay.ts`), the
|
|
59
|
+
* facts its series, this ledger and its call share: the series' claim hands it
|
|
60
|
+
* over by the request's id, the call reads it from the entry it was issued
|
|
61
|
+
* (`IssuedCall`), which outlives the connection's close. The
|
|
62
|
+
* series writes what HTTP showed; this ledger writes whether the JSON-RPC
|
|
63
|
+
* answer arrived; the call writes how it settled.
|
|
64
|
+
*
|
|
41
65
|
* What it does NOT do: retry, wait, or decide anything. The series is the one
|
|
42
66
|
* retry owner; this only tells it whose attempts it is making, and when the SDK
|
|
43
67
|
* has stopped waiting for them.
|
|
44
68
|
*/
|
|
45
|
-
|
|
69
|
+
import { takeMarker } from './callMarker.js';
|
|
70
|
+
import { RequestReplay } from './replay.js';
|
|
71
|
+
import { McpReplayUnavailableError } from './replayUnavailable.js';
|
|
72
|
+
/** The method whose requests a tool call issues markers for. */
|
|
46
73
|
const TOOLS_CALL = 'tools/call';
|
|
47
74
|
/** The notification the SDK sends when it gives up one of its own requests. */
|
|
48
75
|
const CANCELLED = 'notifications/cancelled';
|
|
49
|
-
/**
|
|
76
|
+
/** The request whose answer proves the observer sees this connection's answers. */
|
|
77
|
+
const INITIALIZE = 'initialize';
|
|
78
|
+
const LENIENT = { server: 'mcp', strict: false };
|
|
79
|
+
/** Per connection: the calls issued and not yet settled, the requests being sent, the answers awaited. */
|
|
50
80
|
export class RequestLedger {
|
|
51
|
-
|
|
52
|
-
issued
|
|
53
|
-
|
|
54
|
-
bound = new WeakSet();
|
|
81
|
+
options;
|
|
82
|
+
/** Every call issued and not yet settled — keyed by its marker. */
|
|
83
|
+
issued = new Map();
|
|
55
84
|
/** Every `tools/call` sent and not yet settled — keyed by its JSON-RPC id. */
|
|
56
85
|
sending = new Map();
|
|
86
|
+
/** Matched requests whose JSON-RPC answer is awaited (`strict` only) — by id. */
|
|
87
|
+
awaiting = new Map();
|
|
88
|
+
initializeId;
|
|
89
|
+
initializeAnswered = false;
|
|
90
|
+
markers = 0;
|
|
57
91
|
calls = 0;
|
|
58
92
|
unboundNamed = false;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
this.issued.set(params, ticket);
|
|
93
|
+
constructor(options = LENIENT) {
|
|
94
|
+
this.options = options;
|
|
62
95
|
}
|
|
63
|
-
/**
|
|
64
|
-
|
|
65
|
-
|
|
96
|
+
/**
|
|
97
|
+
* A call is about to send its request: its entry, whose `marker` the call
|
|
98
|
+
* puts in the request's `_meta` (`callMarker.ts` · `markParams`). `ticket`
|
|
99
|
+
* is where its attempts are filed, when the call carries the run's evidence
|
|
100
|
+
* port.
|
|
101
|
+
*/
|
|
102
|
+
issue(ticket) {
|
|
103
|
+
this.markers += 1;
|
|
104
|
+
const call = {
|
|
105
|
+
marker: `call-${this.markers}`,
|
|
106
|
+
...(ticket !== undefined && { ticket }),
|
|
107
|
+
};
|
|
108
|
+
this.issued.set(call.marker, call);
|
|
109
|
+
return call;
|
|
110
|
+
}
|
|
111
|
+
/** `call` settled: forget it, and stop awaiting its request's answer. */
|
|
112
|
+
settle(call) {
|
|
113
|
+
if (this.issued.get(call.marker) === call)
|
|
114
|
+
this.issued.delete(call.marker);
|
|
115
|
+
const request = call.request;
|
|
116
|
+
if (request !== undefined && this.awaiting.get(request.id) === request.replay) {
|
|
117
|
+
this.awaiting.delete(request.id);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/** The connection closed: nothing it sent is awaited, and no call is pending, any more. */
|
|
121
|
+
close() {
|
|
122
|
+
this.issued.clear();
|
|
123
|
+
this.sending.clear();
|
|
124
|
+
this.awaiting.clear();
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Whether this connection's answers pass the observer: the `initialize`
|
|
128
|
+
* answer did. Read once the connection is initialized.
|
|
129
|
+
*/
|
|
130
|
+
get answersObserved() {
|
|
131
|
+
return this.initializeAnswered;
|
|
66
132
|
}
|
|
67
133
|
/** How many `tools/call` requests the watched transport has sent — matched to a call or not. */
|
|
68
134
|
get toolCallsSent() {
|
|
69
135
|
return this.calls;
|
|
70
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* @internal How many entries the ledger holds: calls issued and not settled,
|
|
139
|
+
* requests being sent, answers awaited. Zero once every call settled.
|
|
140
|
+
*/
|
|
141
|
+
get retained() {
|
|
142
|
+
return this.issued.size + this.sending.size + this.awaiting.size;
|
|
143
|
+
}
|
|
71
144
|
/** `true` the first time it is asked, then never again: an unmatched request is named once per connection. */
|
|
72
145
|
firstUnbound() {
|
|
73
146
|
if (this.unboundNamed)
|
|
@@ -80,6 +153,11 @@ export class RequestLedger {
|
|
|
80
153
|
* original bound to the instance itself. Returns the SAME object — or
|
|
81
154
|
* `undefined` when it has no `send` to watch or refuses the property, and
|
|
82
155
|
* then nothing is watched and no call should expect its attempts filed.
|
|
156
|
+
*
|
|
157
|
+
* Its incoming messages are watched too: an `onmessage` set before the
|
|
158
|
+
* client connects, which the current MCP SDK's `Protocol.connect` keeps and
|
|
159
|
+
* calls before its own dispatch. Whether it was kept is known once the
|
|
160
|
+
* `initialize` answer has, or has not, passed it (`answersObserved`).
|
|
83
161
|
*/
|
|
84
162
|
watch(transport) {
|
|
85
163
|
const send = Reflect.get(transport, 'send');
|
|
@@ -102,8 +180,37 @@ export class RequestLedger {
|
|
|
102
180
|
catch {
|
|
103
181
|
return undefined;
|
|
104
182
|
}
|
|
183
|
+
this.watchMessages(transport);
|
|
105
184
|
return transport;
|
|
106
185
|
}
|
|
186
|
+
/** Observe incoming messages before whatever handled them already — never instead of it. */
|
|
187
|
+
watchMessages(transport) {
|
|
188
|
+
try {
|
|
189
|
+
const before = Reflect.get(transport, 'onmessage');
|
|
190
|
+
const handled = typeof before === 'function' ? before : undefined;
|
|
191
|
+
const observing = (message, extra) => {
|
|
192
|
+
this.observe(message);
|
|
193
|
+
handled?.(message, extra);
|
|
194
|
+
};
|
|
195
|
+
Reflect.set(transport, 'onmessage', observing);
|
|
196
|
+
}
|
|
197
|
+
catch {
|
|
198
|
+
// A transport that refuses it is never observed: `answersObserved` stays false.
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/** One incoming message: the `initialize` answer, or the answer to an awaited request. */
|
|
202
|
+
observe(message) {
|
|
203
|
+
const id = responseIdOf(message);
|
|
204
|
+
if (id === undefined)
|
|
205
|
+
return;
|
|
206
|
+
if (id === this.initializeId)
|
|
207
|
+
this.initializeAnswered = true;
|
|
208
|
+
const replay = this.awaiting.get(id);
|
|
209
|
+
if (replay === undefined)
|
|
210
|
+
return;
|
|
211
|
+
this.awaiting.delete(id);
|
|
212
|
+
replay.answered();
|
|
213
|
+
}
|
|
107
214
|
/**
|
|
108
215
|
* The `tools/call` request `body` carries, while its send runs — its ticket
|
|
109
216
|
* when a call issued one, and the signal its cancellation fires. `undefined`
|
|
@@ -126,44 +233,60 @@ export class RequestLedger {
|
|
|
126
233
|
return {
|
|
127
234
|
...(entry.ticket !== undefined && { ticket: entry.ticket }),
|
|
128
235
|
cancelled: entry.cut.signal,
|
|
236
|
+
replay: entry.replay,
|
|
129
237
|
};
|
|
130
238
|
}
|
|
131
239
|
/** One message through the watched transport. */
|
|
132
240
|
send(original, message, options) {
|
|
133
241
|
this.cancelIfAsked(message);
|
|
134
|
-
|
|
242
|
+
this.noteInitialize(message);
|
|
243
|
+
const id = requestIdOf(message);
|
|
135
244
|
if (id === undefined)
|
|
136
245
|
return original(message, options);
|
|
137
|
-
|
|
246
|
+
// The marker comes out before anything else: the server never sees it.
|
|
247
|
+
const taken = takeMarker(message);
|
|
248
|
+
const call = taken.marker === undefined ? undefined : this.issued.get(taken.marker);
|
|
249
|
+
// One request per marker: a second message carrying it is not this call's.
|
|
250
|
+
const matched = call !== undefined && call.request === undefined ? call : undefined;
|
|
251
|
+
if (matched === undefined && this.options.strict) {
|
|
252
|
+
return Promise.reject(new McpReplayUnavailableError('request-unmatched', this.options.server, toolNameOf(message)));
|
|
253
|
+
}
|
|
254
|
+
this.calls += 1;
|
|
255
|
+
const replay = new RequestReplay(id, this.initializeAnswered);
|
|
256
|
+
if (matched !== undefined) {
|
|
257
|
+
matched.request = { id, replay };
|
|
258
|
+
if (this.options.strict)
|
|
259
|
+
this.awaiting.set(id, replay);
|
|
260
|
+
}
|
|
261
|
+
const entry = {
|
|
262
|
+
...(matched?.ticket !== undefined && { ticket: matched.ticket }),
|
|
263
|
+
cut: new AbortController(),
|
|
264
|
+
replay,
|
|
265
|
+
};
|
|
266
|
+
this.sending.set(id, entry);
|
|
138
267
|
const release = () => {
|
|
139
268
|
if (this.sending.get(id) === entry)
|
|
140
269
|
this.sending.delete(id);
|
|
141
270
|
};
|
|
142
271
|
try {
|
|
143
|
-
return Promise.resolve(original(message, options)).finally(release);
|
|
272
|
+
return Promise.resolve(original(taken.message, options)).finally(release);
|
|
144
273
|
}
|
|
145
274
|
catch (err) {
|
|
146
275
|
release();
|
|
147
276
|
throw err;
|
|
148
277
|
}
|
|
149
278
|
}
|
|
150
|
-
/**
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
// One request per ticket: a second message reusing these params is not this call's.
|
|
160
|
-
this.issued.delete(params);
|
|
161
|
-
this.bound.add(ticket);
|
|
162
|
-
}
|
|
163
|
-
this.sending.set(id, { ...(ticket !== undefined && { ticket }), cut: new AbortController() });
|
|
164
|
-
return id;
|
|
279
|
+
/** The `initialize` request: its answer is the one that proves the observer is in place. */
|
|
280
|
+
noteInitialize(message) {
|
|
281
|
+
if (message === null || typeof message !== 'object' || Array.isArray(message))
|
|
282
|
+
return;
|
|
283
|
+
const { method, id } = message;
|
|
284
|
+
if (method !== INITIALIZE || (typeof id !== 'string' && typeof id !== 'number'))
|
|
285
|
+
return;
|
|
286
|
+
this.initializeId = id;
|
|
287
|
+
this.initializeAnswered = false;
|
|
165
288
|
}
|
|
166
|
-
/** The SDK gave a request up: stop the series still sending it. */
|
|
289
|
+
/** The SDK gave a request up: stop the series still sending it, and stop awaiting its answer. */
|
|
167
290
|
cancelIfAsked(message) {
|
|
168
291
|
if (message === null || typeof message !== 'object' || Array.isArray(message))
|
|
169
292
|
return;
|
|
@@ -174,12 +297,30 @@ export class RequestLedger {
|
|
|
174
297
|
if (typeof requestId !== 'string' && typeof requestId !== 'number')
|
|
175
298
|
return;
|
|
176
299
|
this.sending.get(requestId)?.cut.abort(sdkCancelled());
|
|
300
|
+
this.awaiting.delete(requestId);
|
|
177
301
|
}
|
|
178
302
|
}
|
|
179
303
|
/** The reason a series stops when the SDK cancelled its request — a fixed sentence. */
|
|
180
304
|
function sdkCancelled() {
|
|
181
305
|
return Object.assign(new Error('The MCP SDK cancelled this request.'), { name: 'AbortError' });
|
|
182
306
|
}
|
|
307
|
+
/** The tool a `tools/call` names — what a refusal names. Never its arguments. */
|
|
308
|
+
function toolNameOf(message) {
|
|
309
|
+
const params = message.params;
|
|
310
|
+
const name = params !== null && typeof params === 'object'
|
|
311
|
+
? params.name
|
|
312
|
+
: undefined;
|
|
313
|
+
return typeof name === 'string' ? name : 'tools/call';
|
|
314
|
+
}
|
|
315
|
+
/** The id of a JSON-RPC RESPONSE — a result or an error, never a request or a notification. */
|
|
316
|
+
function responseIdOf(message) {
|
|
317
|
+
if (message === null || typeof message !== 'object' || Array.isArray(message))
|
|
318
|
+
return undefined;
|
|
319
|
+
const fields = message;
|
|
320
|
+
if (fields.method !== undefined || !('result' in fields || 'error' in fields))
|
|
321
|
+
return undefined;
|
|
322
|
+
return typeof fields.id === 'string' || typeof fields.id === 'number' ? fields.id : undefined;
|
|
323
|
+
}
|
|
183
324
|
/** The id of a `tools/call` REQUEST — a response or a notification has none to claim. */
|
|
184
325
|
function requestIdOf(message) {
|
|
185
326
|
if (message === null || typeof message !== 'object' || Array.isArray(message))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestLedger.js","sourceRoot":"","sources":["../../../src/mcp/requestLedger.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"requestLedger.js","sourceRoot":"","sources":["../../../src/mcp/requestLedger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AA4DnE,gEAAgE;AAChE,MAAM,UAAU,GAAG,YAAY,CAAC;AAChC,+EAA+E;AAC/E,MAAM,SAAS,GAAG,yBAAyB,CAAC;AAC5C,mFAAmF;AACnF,MAAM,UAAU,GAAG,YAAY,CAAC;AAEhC,MAAM,OAAO,GAA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