@animalabs/agent-framework 0.22.3 → 0.23.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/README.md +105 -3
- package/dist/src/agent.d.ts +36 -10
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +76 -32
- package/dist/src/agent.js.map +1 -1
- package/dist/src/code-execution/index.d.ts +1 -1
- package/dist/src/code-execution/index.d.ts.map +1 -1
- package/dist/src/code-execution/index.js.map +1 -1
- package/dist/src/code-execution/py-runner.d.ts +34 -2
- package/dist/src/code-execution/py-runner.d.ts.map +1 -1
- package/dist/src/code-execution/py-runner.js +72 -16
- package/dist/src/code-execution/py-runner.js.map +1 -1
- package/dist/src/code-execution/runtime-py.d.ts +3 -2
- package/dist/src/code-execution/runtime-py.d.ts.map +1 -1
- package/dist/src/code-execution/runtime-py.js +47 -7
- package/dist/src/code-execution/runtime-py.js.map +1 -1
- package/dist/src/code-execution/tool-definition.d.ts +12 -7
- package/dist/src/code-execution/tool-definition.d.ts.map +1 -1
- package/dist/src/code-execution/tool-definition.js +59 -11
- package/dist/src/code-execution/tool-definition.js.map +1 -1
- package/dist/src/config-checks.d.ts +2 -2
- package/dist/src/config-checks.d.ts.map +1 -1
- package/dist/src/config-checks.js +6 -2
- package/dist/src/config-checks.js.map +1 -1
- package/dist/src/framework.d.ts +744 -120
- package/dist/src/framework.d.ts.map +1 -1
- package/dist/src/framework.js +3546 -906
- package/dist/src/framework.js.map +1 -1
- package/dist/src/gate/event-gate.d.ts.map +1 -1
- package/dist/src/gate/event-gate.js +13 -6
- package/dist/src/gate/event-gate.js.map +1 -1
- package/dist/src/held-writes.d.ts +16 -0
- package/dist/src/held-writes.d.ts.map +1 -0
- package/dist/src/held-writes.js +56 -0
- package/dist/src/held-writes.js.map +1 -0
- package/dist/src/index.d.ts +7 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +8 -4
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcpl/capability-grant.d.ts +4 -0
- package/dist/src/mcpl/capability-grant.d.ts.map +1 -1
- package/dist/src/mcpl/capability-grant.js +1 -1
- package/dist/src/mcpl/capability-grant.js.map +1 -1
- package/dist/src/mcpl/channel-registry.d.ts +95 -18
- package/dist/src/mcpl/channel-registry.d.ts.map +1 -1
- package/dist/src/mcpl/channel-registry.js +578 -150
- package/dist/src/mcpl/channel-registry.js.map +1 -1
- package/dist/src/mcpl/convert-block.d.ts +2 -2
- package/dist/src/mcpl/convert-block.d.ts.map +1 -1
- package/dist/src/mcpl/convert-block.js +6 -7
- package/dist/src/mcpl/convert-block.js.map +1 -1
- package/dist/src/mcpl/index.d.ts +5 -1
- package/dist/src/mcpl/index.d.ts.map +1 -1
- package/dist/src/mcpl/index.js +3 -1
- package/dist/src/mcpl/index.js.map +1 -1
- package/dist/src/mcpl/inference-router.d.ts +4 -2
- package/dist/src/mcpl/inference-router.d.ts.map +1 -1
- package/dist/src/mcpl/inference-router.js +6 -7
- package/dist/src/mcpl/inference-router.js.map +1 -1
- package/dist/src/mcpl/log-value.d.ts +7 -0
- package/dist/src/mcpl/log-value.d.ts.map +1 -1
- package/dist/src/mcpl/log-value.js +9 -0
- package/dist/src/mcpl/log-value.js.map +1 -1
- package/dist/src/mcpl/modern-connection.d.ts +227 -0
- package/dist/src/mcpl/modern-connection.d.ts.map +1 -0
- package/dist/src/mcpl/modern-connection.js +1088 -0
- package/dist/src/mcpl/modern-connection.js.map +1 -0
- package/dist/src/mcpl/prefix-rule.d.ts +18 -0
- package/dist/src/mcpl/prefix-rule.d.ts.map +1 -0
- package/dist/src/mcpl/prefix-rule.js +25 -0
- package/dist/src/mcpl/prefix-rule.js.map +1 -0
- package/dist/src/mcpl/protocol-family.d.ts +179 -0
- package/dist/src/mcpl/protocol-family.d.ts.map +1 -0
- package/dist/src/mcpl/protocol-family.js +697 -0
- package/dist/src/mcpl/protocol-family.js.map +1 -0
- package/dist/src/mcpl/push-coalescer.d.ts +38 -19
- package/dist/src/mcpl/push-coalescer.d.ts.map +1 -1
- package/dist/src/mcpl/push-coalescer.js +52 -23
- package/dist/src/mcpl/push-coalescer.js.map +1 -1
- package/dist/src/mcpl/reference-fetcher.d.ts +66 -15
- package/dist/src/mcpl/reference-fetcher.d.ts.map +1 -1
- package/dist/src/mcpl/reference-fetcher.js +243 -76
- package/dist/src/mcpl/reference-fetcher.js.map +1 -1
- package/dist/src/mcpl/references.d.ts +63 -18
- package/dist/src/mcpl/references.d.ts.map +1 -1
- package/dist/src/mcpl/references.js +117 -32
- package/dist/src/mcpl/references.js.map +1 -1
- package/dist/src/mcpl/server-connection.d.ts +326 -30
- package/dist/src/mcpl/server-connection.d.ts.map +1 -1
- package/dist/src/mcpl/server-connection.js +995 -212
- package/dist/src/mcpl/server-connection.js.map +1 -1
- package/dist/src/mcpl/server-registry.d.ts +25 -5
- package/dist/src/mcpl/server-registry.d.ts.map +1 -1
- package/dist/src/mcpl/server-registry.js +51 -12
- package/dist/src/mcpl/server-registry.js.map +1 -1
- package/dist/src/mcpl/tool-result-normalize.d.ts +54 -0
- package/dist/src/mcpl/tool-result-normalize.d.ts.map +1 -0
- package/dist/src/mcpl/tool-result-normalize.js +232 -0
- package/dist/src/mcpl/tool-result-normalize.js.map +1 -0
- package/dist/src/mcpl/transport.d.ts +56 -13
- package/dist/src/mcpl/transport.d.ts.map +1 -1
- package/dist/src/mcpl/transport.js +206 -70
- package/dist/src/mcpl/transport.js.map +1 -1
- package/dist/src/mcpl/types.d.ts +66 -20
- package/dist/src/mcpl/types.d.ts.map +1 -1
- package/dist/src/mcpl/types.js.map +1 -1
- package/dist/src/mcpl/visible-content.d.ts +2 -1
- package/dist/src/mcpl/visible-content.d.ts.map +1 -1
- package/dist/src/mcpl/visible-content.js +2 -1
- package/dist/src/mcpl/visible-content.js.map +1 -1
- package/dist/src/module-registry.d.ts +16 -6
- package/dist/src/module-registry.d.ts.map +1 -1
- package/dist/src/module-registry.js +65 -6
- package/dist/src/module-registry.js.map +1 -1
- package/dist/src/modules/api/index.d.ts +1 -1
- package/dist/src/modules/api/index.d.ts.map +1 -1
- package/dist/src/modules/api/index.js +3 -2
- package/dist/src/modules/api/index.js.map +1 -1
- package/dist/src/modules/discord/discord-js-client.d.ts +42 -2
- package/dist/src/modules/discord/discord-js-client.d.ts.map +1 -1
- package/dist/src/modules/discord/discord-js-client.js +268 -65
- package/dist/src/modules/discord/discord-js-client.js.map +1 -1
- package/dist/src/modules/discord/index.d.ts +27 -5
- package/dist/src/modules/discord/index.d.ts.map +1 -1
- package/dist/src/modules/discord/index.js +366 -76
- package/dist/src/modules/discord/index.js.map +1 -1
- package/dist/src/modules/discord/refusal.d.ts +14 -0
- package/dist/src/modules/discord/refusal.d.ts.map +1 -0
- package/dist/src/modules/discord/refusal.js +14 -0
- package/dist/src/modules/discord/refusal.js.map +1 -0
- package/dist/src/modules/discord/types.d.ts +17 -7
- package/dist/src/modules/discord/types.d.ts.map +1 -1
- package/dist/src/modules/health/index.d.ts.map +1 -1
- package/dist/src/modules/health/index.js +6 -2
- package/dist/src/modules/health/index.js.map +1 -1
- package/dist/src/modules/index.d.ts +1 -1
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +1 -1
- package/dist/src/modules/index.js.map +1 -1
- package/dist/src/modules/workspace/disk-agreement.d.ts +25 -2
- package/dist/src/modules/workspace/disk-agreement.d.ts.map +1 -1
- package/dist/src/modules/workspace/disk-agreement.js +45 -5
- package/dist/src/modules/workspace/disk-agreement.js.map +1 -1
- package/dist/src/modules/workspace/effects.d.ts +2 -1
- package/dist/src/modules/workspace/effects.d.ts.map +1 -1
- package/dist/src/modules/workspace/effects.js +19 -9
- package/dist/src/modules/workspace/effects.js.map +1 -1
- package/dist/src/modules/workspace/index.d.ts +214 -42
- package/dist/src/modules/workspace/index.d.ts.map +1 -1
- package/dist/src/modules/workspace/index.js +667 -113
- package/dist/src/modules/workspace/index.js.map +1 -1
- package/dist/src/modules/workspace/observe.d.ts +240 -8
- package/dist/src/modules/workspace/observe.d.ts.map +1 -1
- package/dist/src/modules/workspace/observe.js +554 -24
- package/dist/src/modules/workspace/observe.js.map +1 -1
- package/dist/src/modules/workspace/types.d.ts +10 -1
- package/dist/src/modules/workspace/types.d.ts.map +1 -1
- package/dist/src/modules/workspace/types.js.map +1 -1
- package/dist/src/modules/workspace/watcher.d.ts +42 -0
- package/dist/src/modules/workspace/watcher.d.ts.map +1 -1
- package/dist/src/modules/workspace/watcher.js +130 -25
- package/dist/src/modules/workspace/watcher.js.map +1 -1
- package/dist/src/silent-heartbeat.d.ts +112 -39
- package/dist/src/silent-heartbeat.d.ts.map +1 -1
- package/dist/src/silent-heartbeat.js +100 -29
- package/dist/src/silent-heartbeat.js.map +1 -1
- package/dist/src/tool-args.d.ts +40 -0
- package/dist/src/tool-args.d.ts.map +1 -0
- package/dist/src/tool-args.js +207 -0
- package/dist/src/tool-args.js.map +1 -0
- package/dist/src/tool-presentation.d.ts.map +1 -1
- package/dist/src/tool-presentation.js +9 -2
- package/dist/src/tool-presentation.js.map +1 -1
- package/dist/src/types/agent.d.ts +27 -17
- package/dist/src/types/agent.d.ts.map +1 -1
- package/dist/src/types/events.d.ts +8 -0
- package/dist/src/types/events.d.ts.map +1 -1
- package/dist/src/types/framework.d.ts +17 -2
- package/dist/src/types/framework.d.ts.map +1 -1
- package/dist/src/types/module.d.ts +54 -10
- package/dist/src/types/module.d.ts.map +1 -1
- package/dist/src/types/trace.d.ts +2 -2
- package/dist/src/types/trace.d.ts.map +1 -1
- package/package.json +3 -1
- package/src/agent.ts +99 -36
- package/src/code-execution/index.ts +1 -0
- package/src/code-execution/py-runner.ts +104 -17
- package/src/code-execution/runtime-py.ts +47 -7
- package/src/code-execution/tool-definition.ts +65 -11
- package/src/config-checks.ts +4 -2
- package/src/framework.ts +3633 -956
- package/src/gate/event-gate.ts +14 -6
- package/src/held-writes.ts +59 -0
- package/src/index.ts +19 -4
- package/src/mcpl/capability-grant.ts +1 -1
- package/src/mcpl/channel-registry.ts +613 -160
- package/src/mcpl/convert-block.ts +15 -7
- package/src/mcpl/index.ts +14 -1
- package/src/mcpl/inference-router.ts +8 -7
- package/src/mcpl/log-value.ts +10 -0
- package/src/mcpl/modern-connection.ts +1182 -0
- package/src/mcpl/prefix-rule.ts +32 -0
- package/src/mcpl/protocol-family.ts +691 -0
- package/src/mcpl/push-coalescer.ts +67 -29
- package/src/mcpl/reference-fetcher.ts +288 -82
- package/src/mcpl/references.ts +123 -33
- package/src/mcpl/server-connection.ts +1050 -221
- package/src/mcpl/server-registry.ts +50 -12
- package/src/mcpl/tool-result-normalize.ts +294 -0
- package/src/mcpl/transport.ts +204 -62
- package/src/mcpl/types.ts +67 -20
- package/src/mcpl/visible-content.ts +2 -1
- package/src/module-registry.ts +68 -13
- package/src/modules/api/index.ts +3 -2
- package/src/modules/discord/discord-js-client.ts +288 -72
- package/src/modules/discord/index.ts +380 -77
- package/src/modules/discord/refusal.ts +13 -0
- package/src/modules/discord/types.ts +17 -9
- package/src/modules/health/index.ts +6 -2
- package/src/modules/index.ts +1 -1
- package/src/modules/workspace/disk-agreement.ts +46 -5
- package/src/modules/workspace/effects.ts +18 -7
- package/src/modules/workspace/index.ts +722 -124
- package/src/modules/workspace/observe.ts +591 -22
- package/src/modules/workspace/types.ts +10 -1
- package/src/modules/workspace/watcher.ts +126 -25
- package/src/silent-heartbeat.ts +184 -59
- package/src/tool-args.ts +213 -0
- package/src/tool-presentation.ts +9 -2
- package/src/types/agent.ts +27 -17
- package/src/types/events.ts +8 -0
- package/src/types/framework.ts +17 -2
- package/src/types/module.ts +55 -10
- package/src/types/trace.ts +2 -2
|
@@ -41,10 +41,69 @@ export interface McplConnectionCloseInfo {
|
|
|
41
41
|
* handshake's error keeps, when there is one. */
|
|
42
42
|
export declare function stderrTailOf(error: unknown): string | undefined;
|
|
43
43
|
/** For the host's own log line about a failed connect: the server's stderr
|
|
44
|
-
* that the error keeps as `stderrTail`,
|
|
45
|
-
*
|
|
44
|
+
* that the error keeps as `stderrTail`, with the server's credentials
|
|
45
|
+
* taken out by `redact` (its redactServerText), one marked line per line of
|
|
46
|
+
* it, each through log-value, since it's the server's text. '' when there's
|
|
46
47
|
* none. */
|
|
47
|
-
export declare function withStderr(error: unknown): string;
|
|
48
|
+
export declare function withStderr(error: unknown, redact: (text: string) => string): string;
|
|
49
|
+
/**
|
|
50
|
+
* The server and this engine have no protocol revision in common, so the
|
|
51
|
+
* connection was never established. This is a protocol-negotiation fact, not
|
|
52
|
+
* a request outcome. Retrying cannot change it: each engine offers one
|
|
53
|
+
* revision, and only configuration can fix the mismatch. A connection that
|
|
54
|
+
* gets this error does not schedule reconnects. The legacy engine and the
|
|
55
|
+
* modern one (ModernMcpConnection, whose pinned revision the server refused)
|
|
56
|
+
* both throw it, so its readers treat them alike.
|
|
57
|
+
*
|
|
58
|
+
* - `rejected`: the server refused the offered revision: the legacy engine's
|
|
59
|
+
* `initialize` answered with error -32022, or a modern server's discovery
|
|
60
|
+
* or error naming no common revision. `supported` is the server's own list,
|
|
61
|
+
* when it gave one.
|
|
62
|
+
* - `mismatch`: the server answered the legacy engine's `initialize` with a
|
|
63
|
+
* revision other than 2024-11-05, or with none.
|
|
64
|
+
*/
|
|
65
|
+
export declare class McplProtocolVersionError extends Error {
|
|
66
|
+
readonly kind: 'rejected' | 'mismatch';
|
|
67
|
+
/** Revision the server answered with (`mismatch`; null when it gave none). */
|
|
68
|
+
readonly returned: string | null;
|
|
69
|
+
/** Revisions the server says it supports (`rejected`, when stated). */
|
|
70
|
+
readonly supported: readonly string[] | null;
|
|
71
|
+
/** The JSON-RPC error's code and data, verbatim (`rejected`). */
|
|
72
|
+
readonly code?: number | undefined;
|
|
73
|
+
readonly data?: unknown;
|
|
74
|
+
/** The revision this client offered: the legacy engine's, unless a
|
|
75
|
+
* modern connection's. */
|
|
76
|
+
readonly offered: string;
|
|
77
|
+
constructor(message: string, kind: 'rejected' | 'mismatch',
|
|
78
|
+
/** Revision the server answered with (`mismatch`; null when it gave none). */
|
|
79
|
+
returned: string | null,
|
|
80
|
+
/** Revisions the server says it supports (`rejected`, when stated). */
|
|
81
|
+
supported: readonly string[] | null,
|
|
82
|
+
/** The JSON-RPC error's code and data, verbatim (`rejected`). */
|
|
83
|
+
code?: number | undefined, data?: unknown,
|
|
84
|
+
/** The revision this client offered: the legacy engine's, unless a
|
|
85
|
+
* modern connection's. */
|
|
86
|
+
offered?: string);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* A connect that failed, and whose cleanup couldn't confirm that the child
|
|
90
|
+
* exited: it may still be running. `connection` owns that launch, closed and
|
|
91
|
+
* not reconnecting. Its close() retries the reap and resolves once the exit
|
|
92
|
+
* is confirmed, so the caller can still clean up, and should start nothing
|
|
93
|
+
* else for this server until then. connect() and connectWithReconnect()
|
|
94
|
+
* throw this, and the modern engine's ModernMcpConnection.connect() too.
|
|
95
|
+
* `cause` is the connect's own failure.
|
|
96
|
+
*/
|
|
97
|
+
export declare class McplUnreapedLaunchError<Connection extends {
|
|
98
|
+
close(): Promise<void>;
|
|
99
|
+
} = McplServerConnection> extends Error {
|
|
100
|
+
readonly connection: Connection;
|
|
101
|
+
/** The cleanup's own failure: the child it couldn't confirm exited. */
|
|
102
|
+
readonly cleanup: Error;
|
|
103
|
+
constructor(connection: Connection, failure: Error,
|
|
104
|
+
/** The cleanup's own failure: the child it couldn't confirm exited. */
|
|
105
|
+
cleanup: Error);
|
|
106
|
+
}
|
|
48
107
|
/**
|
|
49
108
|
* Why a request to an MCPL server produced no result, as far as the host can
|
|
50
109
|
* know it. Messages are unchanged from plain errors; the `outcome` makes the
|
|
@@ -90,7 +149,12 @@ export declare class McplRequestError extends Error {
|
|
|
90
149
|
* server's stderr when its handshake failed by its transport closing, a
|
|
91
150
|
* transport error or its timeout and it had written any; `error` never
|
|
92
151
|
* carries it.
|
|
93
|
-
* - `'reconnect'` — Background reconnect succeeded
|
|
152
|
+
* - `'reconnect'` — Background reconnect succeeded. The new transport
|
|
153
|
+
* starts with an empty grant and both planes
|
|
154
|
+
* closed, as at initial connect: whoever owns the
|
|
155
|
+
* connection runs the §5.3 policy exchange again,
|
|
156
|
+
* then opens the planes (the framework's listener
|
|
157
|
+
* does).
|
|
94
158
|
*/
|
|
95
159
|
export declare class McplServerConnection extends EventEmitter {
|
|
96
160
|
/** Unique server identifier from config. */
|
|
@@ -106,6 +170,9 @@ export declare class McplServerConnection extends EventEmitter {
|
|
|
106
170
|
/** OUTER standard MCP capabilities.tools was present at handshake (§5.1 —
|
|
107
171
|
* the sole source of the `tools` capability path). */
|
|
108
172
|
mcpToolsAdvertised: boolean;
|
|
173
|
+
/** The MCP revision established by the last successful handshake (always
|
|
174
|
+
* 2024-11-05 for this engine), or null before the first one. */
|
|
175
|
+
protocolVersion: string | null;
|
|
109
176
|
/** Host-owned per-server authority for host/command (config
|
|
110
177
|
* allowHostCommands, default false). No capability path exists and the
|
|
111
178
|
* grant cannot confer it — server params never decide admin authority. */
|
|
@@ -157,6 +224,19 @@ export declare class McplServerConnection extends EventEmitter {
|
|
|
157
224
|
* performs a fresh initialize handshake, so authority from the dead epoch
|
|
158
225
|
* must be revoked before the replacement transport is exposed. */
|
|
159
226
|
private resetPolicyForTransportBoundary;
|
|
227
|
+
/** What of these held items a transport boundary keeps (see
|
|
228
|
+
* resetPolicyForTransportBoundary), in order, each marked `kept`; the
|
|
229
|
+
* rest is logged and dropped. A connection closed for good has no next
|
|
230
|
+
* transport whose grant could admit what the server reported about the
|
|
231
|
+
* world, so that is dropped too. */
|
|
232
|
+
private keepAcrossBoundary;
|
|
233
|
+
/** Hold these items in place of what is held, with heldRequests and
|
|
234
|
+
* keptRequests counting the requests among them: a boundary keeps some of
|
|
235
|
+
* what was held, a flush that crosses one holds the rest of its snapshot
|
|
236
|
+
* again, and a flush starts from nothing held. Notifications need no cap
|
|
237
|
+
* here: hold caps them kept or not, and what this is given never has more
|
|
238
|
+
* than was held. */
|
|
239
|
+
private replaceHeld;
|
|
160
240
|
/** The active transport (stdio child or WebSocket). Null for a disconnected
|
|
161
241
|
* stub awaiting its first background reconnect. */
|
|
162
242
|
private transport;
|
|
@@ -172,9 +252,16 @@ export declare class McplServerConnection extends EventEmitter {
|
|
|
172
252
|
/** Set by `reconnectAfterFailure()` before it closes a live transport, so
|
|
173
253
|
* the transport close handler reports that teardown as `byHost: true`. */
|
|
174
254
|
private hostCloseRequested;
|
|
255
|
+
/** Set by `close()`: this host has stopped the connection, as a removal and
|
|
256
|
+
* a restart both do, so a request after it can't say whether the server
|
|
257
|
+
* comes back. */
|
|
258
|
+
private closedByThisHost;
|
|
259
|
+
/** The host's close attempt: in flight, or done. A failed one is cleared,
|
|
260
|
+
* so the next close() tries again. */
|
|
175
261
|
private closePromise;
|
|
262
|
+
/** The host closed this connection while it was live, and its teardown
|
|
263
|
+
* hasn't completed yet: 'close' is emitted once it has. */
|
|
176
264
|
private closeIncomplete;
|
|
177
|
-
private reconnectPromise;
|
|
178
265
|
/** Per-request timeout in ms (0 disables). See McplServerConfig.requestTimeoutMs. */
|
|
179
266
|
private requestTimeoutMs;
|
|
180
267
|
/** The deadline a channels/publish or channels/open request keeps when
|
|
@@ -186,6 +273,17 @@ export declare class McplServerConnection extends EventEmitter {
|
|
|
186
273
|
/** How many of bufferedEvents are server→host requests, each holding a
|
|
187
274
|
* responder its server waits on. Every change to bufferedEvents keeps it. */
|
|
188
275
|
private heldRequests;
|
|
276
|
+
/** How many of bufferedEvents are requests a transport boundary kept:
|
|
277
|
+
* incoming messages and pushes whose transport has closed. No server waits
|
|
278
|
+
* on them, since their answers can't reach it (sameTransport), so they
|
|
279
|
+
* stay out of the held-request budget, which bounds what a live server
|
|
280
|
+
* waits on: a dead process's backlog must not refuse the next process's
|
|
281
|
+
* registration. They have their own bound at the same size, past which a
|
|
282
|
+
* kept request is dropped and logged, there being no one to refuse. */
|
|
283
|
+
private keptRequests;
|
|
284
|
+
/** Kept requests dropped at their bound since the planes last opened
|
|
285
|
+
* (ready()), so the first of each run of drops is logged. */
|
|
286
|
+
private droppedKeptRequests;
|
|
189
287
|
/** Cap on held notifications (responder-less events) during a plane pause
|
|
190
288
|
* (issue #122), counted apart from requests: past it, the oldest held
|
|
191
289
|
* notification is dropped. */
|
|
@@ -195,7 +293,9 @@ export declare class McplServerConnection extends EventEmitter {
|
|
|
195
293
|
* bounds a server that pipelines requests without waiting for answers. A
|
|
196
294
|
* server that doesn't send a refused request again loses it (discord-mcpl
|
|
197
295
|
* doesn't), so the budget sits far above the notifications' cap, to leave
|
|
198
|
-
* a busy server's long pause room.
|
|
296
|
+
* a busy server's long pause room. Requests a transport boundary kept are
|
|
297
|
+
* counted apart from it (keptRequests), with a bound of the same size past
|
|
298
|
+
* which they're dropped, since no server waits on them. */
|
|
199
299
|
private static readonly MAX_HELD_REQUESTS;
|
|
200
300
|
private droppedBufferedEvents;
|
|
201
301
|
/** Requests refused at the budget since the planes last opened (ready()),
|
|
@@ -210,9 +310,23 @@ export declare class McplServerConnection extends EventEmitter {
|
|
|
210
310
|
/** Consecutive failed connect attempts since the last successful handshake.
|
|
211
311
|
* Drives the exponential backoff and is reported on reconnect events. */
|
|
212
312
|
private reconnectAttempts;
|
|
313
|
+
/** The reconnect attempt in flight, so close() can abort it and wait for
|
|
314
|
+
* its cleanup. */
|
|
315
|
+
private reconnecting;
|
|
316
|
+
/**
|
|
317
|
+
* Launches whose cleanup couldn't confirm that the child exited. While any
|
|
318
|
+
* is held, reconnecting is halted, since another launch could run beside
|
|
319
|
+
* one that's still alive. close() retries their reap.
|
|
320
|
+
*/
|
|
321
|
+
private unreaped;
|
|
213
322
|
/** Whether a background reconnect loop will revive this connection after a
|
|
214
|
-
* drop. False once close() has been called (explicit close stops retrying)
|
|
323
|
+
* drop. False once close() has been called (explicit close stops retrying),
|
|
324
|
+
* after a protocol-version verdict, and while a launch is unreaped. */
|
|
215
325
|
get willReconnect(): boolean;
|
|
326
|
+
/** Whether a child this connection launched couldn't be confirmed exited.
|
|
327
|
+
* While it's true the connection owns that child, so whatever registered
|
|
328
|
+
* it keeps its id held; close() retries the reap. */
|
|
329
|
+
get holdsUnreapedChild(): boolean;
|
|
216
330
|
/** Closed with no reconnect to come: after close(), whether or not its
|
|
217
331
|
* transport close succeeded, or a drop with reconnect off. A connection
|
|
218
332
|
* between retries keeps reconnectEnabled, so it isn't closed for good. */
|
|
@@ -226,27 +340,97 @@ export declare class McplServerConnection extends EventEmitter {
|
|
|
226
340
|
* construction (when setupMessageRouting starts emitting) and now (when
|
|
227
341
|
* the caller has attached listeners via wireMcplEvents).
|
|
228
342
|
*
|
|
229
|
-
*
|
|
230
|
-
* when it closed, so what
|
|
231
|
-
* closed connection sends no response, so nothing it held
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
* it held, such as a reconnect stub's connect-failed,
|
|
235
|
-
* listeners
|
|
343
|
+
* Once the connection is closed for good it readies nothing. Its policy was
|
|
344
|
+
* reset when it closed, so what the server sent that needs a grant would be
|
|
345
|
+
* refused, and a closed connection sends no response, so nothing it held
|
|
346
|
+
* could be answered. It delivers only its own reports of how it ended (see
|
|
347
|
+
* {@link deliverOwnReports}). A connection between retries isn't closed for
|
|
348
|
+
* good: what it held, such as a reconnect stub's connect-failed, reaches
|
|
349
|
+
* its listeners as it does any connection's, except the incoming messages
|
|
350
|
+
* and pushes a transport boundary kept, which wait for the next
|
|
351
|
+
* transport's grant (see {@link flushHeld}).
|
|
236
352
|
*/
|
|
237
353
|
ready(): void;
|
|
354
|
+
/**
|
|
355
|
+
* Re-emit a held snapshot through the admission gate (this.emit), inside
|
|
356
|
+
* the containment boundary every inbound event shares
|
|
357
|
+
* (dispatchInboundEvent), in admission order (admissionOrder). A transport
|
|
358
|
+
* boundary crossed during the flush (a listener that closes the connection,
|
|
359
|
+
* say) leaves the rest of the snapshot to the boundary rule, as if it had
|
|
360
|
+
* still been held: what the server said about its own process is dropped,
|
|
361
|
+
* and the rest is held again, after whatever this flush held.
|
|
362
|
+
*
|
|
363
|
+
* Between transports, the incoming messages and pushes a boundary kept
|
|
364
|
+
* stay held for the next transport's grant: admitted now, they would meet
|
|
365
|
+
* the empty grant the boundary left, with no transport to answer on. The
|
|
366
|
+
* host's own reports about the transport (a stub's connect-failed, say)
|
|
367
|
+
* need no grant and go on.
|
|
368
|
+
*/
|
|
369
|
+
private flushHeld;
|
|
370
|
+
/** Whether the plane an event belongs to is open (lifecycle events always
|
|
371
|
+
* pass), as the admission gate (emit) decides it. */
|
|
372
|
+
private planeReadyFor;
|
|
373
|
+
/**
|
|
374
|
+
* The order a flush admits a held snapshot in: as it was held, except that
|
|
375
|
+
* when it holds items a transport boundary kept, the current transport's
|
|
376
|
+
* channel registrations (`channels-register`, `channels-changed`) go
|
|
377
|
+
* first, each unless it names a channel that something the transport sent
|
|
378
|
+
* before it, and that stays where it was held, also names (below). The
|
|
379
|
+
* registry refuses a message for a channel it doesn't know
|
|
380
|
+
* (§14.5). It keeps a server's channels across a reconnect, but a
|
|
381
|
+
* registration the old process sent that was still held at the boundary
|
|
382
|
+
* was dropped with it (keepAcrossBoundary), so the next process registers
|
|
383
|
+
* that channel anew, behind what was kept: a kept message for it admitted
|
|
384
|
+
* first would be refused, and lost, since a bridge that recorded it as
|
|
385
|
+
* forwarded doesn't send it again.
|
|
386
|
+
* Nothing else moves, so a snapshot with nothing kept is flushed as it was
|
|
387
|
+
* held. A registration also passes whatever its own transport sent before
|
|
388
|
+
* it, which a server that announces its channels first, as a bridge does,
|
|
389
|
+
* never has. A removal stays where it was held, with whatever else it adds
|
|
390
|
+
* or updates, as everything does that isn't a registration. A registration
|
|
391
|
+
* that names a channel which an earlier removal, or an earlier registration
|
|
392
|
+
* that stays, names stays where it was held too, so the writes to one
|
|
393
|
+
* channel keep their order: a channel's removal and its re-registration,
|
|
394
|
+
* and two registrations or updates of it. In a flush that opens both
|
|
395
|
+
* planes, what the transport sent before a removal is admitted before it,
|
|
396
|
+
* its messages for that channel included. A flush that opens only the control
|
|
397
|
+
* plane, as during a quiesce, admits the control traffic, a removal
|
|
398
|
+
* included, and holds the data plane's again until that plane opens, as
|
|
399
|
+
* live traffic is during a quiesce: a message held for a channel a removal
|
|
400
|
+
* took is then refused as the data plane opens.
|
|
401
|
+
*/
|
|
402
|
+
private static admissionOrder;
|
|
403
|
+
/** The channels a held `channels-changed` removes. The registry takes any
|
|
404
|
+
* entry of `removed` as a channel id, by its string form, so a number
|
|
405
|
+
* removes the channel of its digits; an object is left out here, since
|
|
406
|
+
* its string form can throw. */
|
|
407
|
+
private static removedChannelIds;
|
|
408
|
+
/** The channels a held `channels-register` registers, or a held
|
|
409
|
+
* `channels-changed` adds or updates. */
|
|
410
|
+
private static registeredChannelIds;
|
|
238
411
|
/**
|
|
239
412
|
* Release only server-establishment and lifecycle/control traffic. Responses
|
|
240
413
|
* to host requests are never event-buffered, so tools/list and tools/call
|
|
241
414
|
* responses remain live as well. Inference-bearing requests stay queued in
|
|
242
415
|
* their original relative order until {@link ready} is called. Like
|
|
243
|
-
* {@link ready},
|
|
416
|
+
* {@link ready}, once the connection is closed for good it delivers only
|
|
417
|
+
* its own reports of how it ended.
|
|
244
418
|
*/
|
|
245
419
|
readyControlPlane(): void;
|
|
420
|
+
/**
|
|
421
|
+
* A connection closed for good still says how it ended. Its own buffered
|
|
422
|
+
* connect-failed and reconnect-failed, such as the permanent failure of a
|
|
423
|
+
* launch held as unreaped before the first gate released it, are the
|
|
424
|
+
* framework's records of it: they need no grant, and its listeners act on
|
|
425
|
+
* them (a trace, and for a permanent failure an alert and its tools leaving
|
|
426
|
+
* the list). What the server sent stays held.
|
|
427
|
+
*/
|
|
428
|
+
private deliverOwnReports;
|
|
246
429
|
/**
|
|
247
430
|
* Close the data plane synchronously while leaving an already-released
|
|
248
|
-
* control plane live. Used before
|
|
249
|
-
*
|
|
431
|
+
* control plane live. Used before list-change reconciliation so no new
|
|
432
|
+
* inference event can beat barrier installation. A reconnect closes both
|
|
433
|
+
* planes instead.
|
|
250
434
|
*/
|
|
251
435
|
pauseDataPlane(): void;
|
|
252
436
|
/**
|
|
@@ -255,8 +439,20 @@ export declare class McplServerConnection extends EventEmitter {
|
|
|
255
439
|
* new data-plane gate before the fresh transport is exposed.
|
|
256
440
|
*/
|
|
257
441
|
emit(event: string | symbol, ...args: unknown[]): boolean;
|
|
442
|
+
/**
|
|
443
|
+
* Hold an event until its plane opens, `kept` when a transport boundary
|
|
444
|
+
* keeps it for the next transport's grant (afterBoundary).
|
|
445
|
+
*/
|
|
446
|
+
private hold;
|
|
258
447
|
/** A buffered server→host request: it carries a responder its server waits on. */
|
|
259
448
|
private static hasResponder;
|
|
449
|
+
/** Events routed from a server's transport that report the world, which
|
|
450
|
+
* the next process doesn't send again when its bridge records them as
|
|
451
|
+
* forwarded first: kept at a transport boundary while held. */
|
|
452
|
+
private static readonly WORLD_EVENTS;
|
|
453
|
+
/** Events routed from a server's transport that speak for its process, not
|
|
454
|
+
* the world: dropped at a transport boundary while held. */
|
|
455
|
+
private static get PROCESS_EVENTS();
|
|
260
456
|
/** Event-name form of METHOD_TO_REQUIRED_CAPABILITY, for admission-time
|
|
261
457
|
* enforcement in emit(). */
|
|
262
458
|
private static readonly EVENT_TO_REQUIRED_CAPABILITY;
|
|
@@ -267,31 +463,66 @@ export declare class McplServerConnection extends EventEmitter {
|
|
|
267
463
|
* capability negotiation, and return a ready-to-use connection.
|
|
268
464
|
*
|
|
269
465
|
* Works over stdio (spawned child) or WebSocket, selected by `config` (see
|
|
270
|
-
* {@link openTransport}). Throws if the
|
|
271
|
-
*
|
|
466
|
+
* {@link openTransport}). Throws if the configuration can't be used (before
|
|
467
|
+
* anything is spawned or dialed), the transport can't be opened, the server
|
|
468
|
+
* closes/errors before the handshake, or the handshake times out. If the
|
|
469
|
+
* failed launch's cleanup can't confirm its child exited, it throws
|
|
470
|
+
* {@link McplUnreapedLaunchError}, whose connection owns that launch.
|
|
471
|
+
*/
|
|
472
|
+
static connect(config: McplServerConfig, hostCapabilities: McplHostCapabilities, signal?: AbortSignal): Promise<McplServerConnection>;
|
|
473
|
+
/** {@link connect}, for a configuration its caller has already checked
|
|
474
|
+
* (and warned about) once. `signal` ends the connect at once, its launch
|
|
475
|
+
* reaped as for any failed handshake: its caller's stop() or a
|
|
476
|
+
* disconnect of its id. */
|
|
477
|
+
private static connectChecked;
|
|
478
|
+
/**
|
|
479
|
+
* This engine's configuration check, made before anything is spawned or
|
|
480
|
+
* dialed: every problem {@link checkServerConfig} finds, the same check the
|
|
481
|
+
* framework applies, and the modern family, which belongs to
|
|
482
|
+
* ModernMcpConnection (an http(s) url is never dialed as a WebSocket).
|
|
483
|
+
* Every configuration that worked before still passes but the one
|
|
484
|
+
* serverConfigProblems names.
|
|
272
485
|
*/
|
|
273
|
-
static
|
|
486
|
+
private static checkConfig;
|
|
274
487
|
/**
|
|
275
488
|
* Open a fresh transport and run the MCP/MCPL initialize handshake over it,
|
|
276
489
|
* returning the connected transport plus the negotiated capabilities. Shared
|
|
277
490
|
* by {@link connect} and {@link attemptReconnect} so both transports handshake
|
|
278
491
|
* identically. On any failure the transport is closed so a spawned child /
|
|
279
|
-
* open socket never leaks.
|
|
492
|
+
* open socket never leaks. If that close can't confirm the child exited,
|
|
493
|
+
* the failure is a {@link HandshakeCleanupError} carrying the transport, so
|
|
494
|
+
* the caller keeps owning it. `signal` ends a handshake whose connection is
|
|
495
|
+
* closed meanwhile: it cuts a WebSocket dial short, is checked once the
|
|
496
|
+
* transport is open, and races the initialize answer.
|
|
280
497
|
*/
|
|
281
498
|
private static handshake;
|
|
282
499
|
/**
|
|
283
500
|
* Connect with reconnect support.
|
|
284
501
|
* When `config.reconnect` is true and the initial connection fails,
|
|
285
502
|
* resolves immediately with null capabilities and retries in the background.
|
|
503
|
+
* A configuration this engine can't use, or a protocol-version verdict,
|
|
504
|
+
* still throws: retrying can't change either. So does a failed launch that
|
|
505
|
+
* can't be reaped, as in {@link connect}: no retry starts beside a child
|
|
506
|
+
* that may still be running, and the {@link McplUnreapedLaunchError}
|
|
507
|
+
* carries the connection that owns it, whose close() retries the reap.
|
|
286
508
|
* Adapted from Anarchid/agent-framework@mcpl-module-proto.
|
|
287
509
|
*/
|
|
288
|
-
static connectWithReconnect(config: McplServerConfig, hostCapabilities: McplHostCapabilities): Promise<McplServerConnection>;
|
|
510
|
+
static connectWithReconnect(config: McplServerConfig, hostCapabilities: McplHostCapabilities, signal?: AbortSignal): Promise<McplServerConnection>;
|
|
289
511
|
/**
|
|
290
|
-
* Create a disconnected stub connection
|
|
291
|
-
*
|
|
512
|
+
* Create a disconnected stub connection, for a failed initial connect: one
|
|
513
|
+
* that will reconnect in the background (its caller schedules that), or one
|
|
514
|
+
* that owns a launch that couldn't be reaped.
|
|
292
515
|
* @internal
|
|
293
516
|
*/
|
|
294
517
|
private static createDisconnectedStub;
|
|
518
|
+
/**
|
|
519
|
+
* Keep a launch whose cleanup couldn't confirm its child exited, and halt
|
|
520
|
+
* reconnecting: another launch could run beside one that's still alive.
|
|
521
|
+
* close() retries the reap.
|
|
522
|
+
*/
|
|
523
|
+
private holdUnreaped;
|
|
524
|
+
/** The halt, as a reconnect event's failure text. */
|
|
525
|
+
private unreapedFailure;
|
|
295
526
|
/** Send `context/beforeInference` and await result. */
|
|
296
527
|
sendBeforeInference(params: BeforeInferenceParams): Promise<BeforeInferenceResult>;
|
|
297
528
|
/** RFC-006 deferred push rendering; its own timeout bounds context assembly. */
|
|
@@ -309,8 +540,10 @@ export declare class McplServerConnection extends EventEmitter {
|
|
|
309
540
|
* — the caller leaves the grant empty and the connection MCP-only.
|
|
310
541
|
*/
|
|
311
542
|
sendFeatureSetsUpdateRequest(params: FeatureSetsUpdateParams, timeoutMs?: number): Promise<FeatureSetsUpdateResult>;
|
|
312
|
-
/** Send `inference/chunk` notification
|
|
313
|
-
|
|
543
|
+
/** Send `inference/chunk` notification, on the transport `epoch` names: a
|
|
544
|
+
* chunk of a request from a transport that has closed goes nowhere, as
|
|
545
|
+
* that request's answer does. */
|
|
546
|
+
sendInferenceChunk(params: InferenceChunkParams, epoch?: number): void;
|
|
314
547
|
/** Send `inference/lifecycle` notification (§10.5). Best-effort. */
|
|
315
548
|
sendInferenceLifecycle(params: InferenceLifecycleParams): void;
|
|
316
549
|
/** Send `tools/lifecycle` notification (RFC-007). Best-effort. The
|
|
@@ -361,7 +594,16 @@ export declare class McplServerConnection extends EventEmitter {
|
|
|
361
594
|
* `op` defaults to 'start'; pass 'stop' to clear an active indicator
|
|
362
595
|
* immediately rather than waiting for server-side auto-expire. */
|
|
363
596
|
sendChannelsTyping(channelId: string, metadata?: Record<string, unknown>, op?: 'start' | 'stop'): void;
|
|
364
|
-
/**
|
|
597
|
+
/**
|
|
598
|
+
* Send `tools/list` and return the server's complete tool inventory,
|
|
599
|
+
* following `nextCursor` across pages (2024-11-05 pagination). Cursors are
|
|
600
|
+
* opaque strings, `''` included: only an absent or null `nextCursor` ends
|
|
601
|
+
* the inventory (a null one is how some servers say "no more", and main
|
|
602
|
+
* read it as a complete page). A page that isn't well formed (no `tools` array, a cursor
|
|
603
|
+
* that isn't a string), or cursors that don't terminate (a repeat, or more
|
|
604
|
+
* than {@link MAX_TOOL_LIST_PAGES} pages), are errors, never a partial or
|
|
605
|
+
* empty inventory published as complete.
|
|
606
|
+
*/
|
|
365
607
|
sendToolsList(): Promise<{
|
|
366
608
|
tools: McpToolDefinition[];
|
|
367
609
|
}>;
|
|
@@ -376,13 +618,35 @@ export declare class McplServerConnection extends EventEmitter {
|
|
|
376
618
|
* force even when the server's general requestTimeoutMs is configured as 0.
|
|
377
619
|
*/
|
|
378
620
|
sendToolsCallWithDeadline(name: string, args: Record<string, unknown>, timeoutMs: number): Promise<McpToolCallResult>;
|
|
379
|
-
/**
|
|
621
|
+
/** The requests still waiting for an answer, for the operator's log line
|
|
622
|
+
* when the connection goes: their methods and ids. */
|
|
623
|
+
private unansweredRequests;
|
|
624
|
+
/**
|
|
625
|
+
* Close the connection for good: disable reconnect, kill the child
|
|
626
|
+
* process, and clean up resources. At once, as before, reconnecting stops
|
|
627
|
+
* and pending requests fail; a reconnect handshake in flight is aborted.
|
|
628
|
+
*
|
|
629
|
+
* Calls share one attempt: while it is pending, and once it has
|
|
630
|
+
* succeeded, close() returns it. The attempt waits for the aborted
|
|
631
|
+
* reconnect's own cleanup, closes the transport (its close is the reaping
|
|
632
|
+
* verdict) and retries each launch an earlier cleanup couldn't reap. It
|
|
633
|
+
* rejects while any child can't be confirmed exited, with that failure
|
|
634
|
+
* itself, or an AggregateError when there are several. A failed attempt is
|
|
635
|
+
* cleared, so the next close() retries what it couldn't reap. 'close' is
|
|
636
|
+
* emitted once, when the teardown of a connection the host closed while
|
|
637
|
+
* live completes.
|
|
638
|
+
*/
|
|
380
639
|
close(): Promise<void>;
|
|
640
|
+
/** One close attempt. `heldBefore` are the launches earlier cleanups
|
|
641
|
+
* couldn't reap, which it retries. */
|
|
642
|
+
private closeStep;
|
|
381
643
|
/**
|
|
382
644
|
* Tear down a live transport after an awareness-accounting failure without
|
|
383
645
|
* disabling configured auto-reconnect. The normal transport close handler
|
|
384
646
|
* rejects requests, emits lifecycle state, and schedules the next bounded
|
|
385
|
-
* reconnect attempt. With reconnect disabled
|
|
647
|
+
* reconnect attempt. With reconnect disabled the recycle ends the
|
|
648
|
+
* connection for good, as close() does: 'close' comes once the child's
|
|
649
|
+
* exit is confirmed, and a child it can't reap stays owned, holding the id.
|
|
386
650
|
*/
|
|
387
651
|
reconnectAfterFailure(): Promise<void>;
|
|
388
652
|
/** 'close' payload for a host-initiated teardown (no transport close code). */
|
|
@@ -402,9 +666,16 @@ export declare class McplServerConnection extends EventEmitter {
|
|
|
402
666
|
* Attempt to reconnect by opening a fresh transport and performing the
|
|
403
667
|
* handshake, then adopting that transport in place. Unlike the previous
|
|
404
668
|
* approach this builds no throwaway connection instance, so there are no
|
|
405
|
-
* leaked listeners on a dead object.
|
|
669
|
+
* leaked listeners on a dead object. The attempt is close()'s to abort,
|
|
670
|
+
* and it settles only once its own launch is adopted, failed or cleaned up.
|
|
671
|
+
* One attempt at a time: a request that arrives while one is in flight (a
|
|
672
|
+
* recycle, say) starts nothing, since that attempt either adopts its
|
|
673
|
+
* launch or schedules the next retry itself. A second attempt would take
|
|
674
|
+
* close()'s ownership of the first (Iris-1827, room-293 #55410).
|
|
406
675
|
*/
|
|
407
676
|
private attemptReconnect;
|
|
677
|
+
/** One reconnect attempt. It never rejects: each outcome is an event, a
|
|
678
|
+
* scheduled retry, or a launch held as unreaped. */
|
|
408
679
|
private reconnectOnce;
|
|
409
680
|
/**
|
|
410
681
|
* Send a JSON-RPC request and return a promise that resolves with the result
|
|
@@ -456,6 +727,27 @@ export declare class McplServerConnection extends EventEmitter {
|
|
|
456
727
|
private setupMessageRouting;
|
|
457
728
|
/** Contain synchronous dispatch failures; async RPC handlers own their promises. */
|
|
458
729
|
private dispatchMessage;
|
|
730
|
+
/**
|
|
731
|
+
* A request's responder, bound to the transport it came on (`epoch`): an
|
|
732
|
+
* answer, or a streamed inference's chunk, sent after that transport has
|
|
733
|
+
* closed reaches nothing, never a server that didn't ask it.
|
|
734
|
+
*/
|
|
735
|
+
private responderFor;
|
|
736
|
+
/**
|
|
737
|
+
* A request or notification read from a transport after its boundary has
|
|
738
|
+
* passed: the boundary's rule (resetPolicyForTransportBoundary). An
|
|
739
|
+
* incoming message or push is held as kept, for the next transport's
|
|
740
|
+
* grant, and any other is dropped and logged. (A response read then goes to
|
|
741
|
+
* handleResponse, flagged late.) A stdio
|
|
742
|
+
* server's transport closes on the child's 'exit', when its stdout may
|
|
743
|
+
* still be open, as it is while a process the server started holds it, and
|
|
744
|
+
* it is read until the next reconnect attempt closes its reader. No
|
|
745
|
+
* transport serves meanwhile, so what is held waits for the next grant
|
|
746
|
+
* (flushHeld). A connection closed for good, which won't reconnect, reads
|
|
747
|
+
* it while its writer lives, with no grant to come, so it drops and logs
|
|
748
|
+
* all of it; hold's bounds cap what any other keeps.
|
|
749
|
+
*/
|
|
750
|
+
private afterBoundary;
|
|
459
751
|
/** Live delivery and delayed plane flushes share the same containment boundary. */
|
|
460
752
|
private dispatchInboundEvent;
|
|
461
753
|
/** Report a failure the containment boundary caught, naming the event (or
|
|
@@ -481,6 +773,10 @@ export declare class McplServerConnection extends EventEmitter {
|
|
|
481
773
|
* Send a successful JSON-RPC response back to the server.
|
|
482
774
|
*/
|
|
483
775
|
private sendResponse;
|
|
776
|
+
/** Whether a response to a request received on `epoch` may go out now.
|
|
777
|
+
* The id is the server's, so it's logged as a field; `answer`, which the
|
|
778
|
+
* caller has formatted for the log, ends the line. */
|
|
779
|
+
private sameTransport;
|
|
484
780
|
/**
|
|
485
781
|
* Send a JSON-RPC error response back to the server.
|
|
486
782
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-connection.d.ts","sourceRoot":"","sources":["../../../src/mcpl/server-connection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAqC,KAAK,aAAa,EAA2B,MAAM,gBAAgB,CAAC;AAEhH,OAAO,EAAE,eAAe,EAAgC,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"server-connection.d.ts","sourceRoot":"","sources":["../../../src/mcpl/server-connection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAqC,KAAK,aAAa,EAA2B,MAAM,gBAAgB,CAAC;AAEhH,OAAO,EAAE,eAAe,EAAgC,MAAM,uBAAuB,CAAC;AAUtF,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EAGpB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,yBAAyB,EACzB,kBA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