neotoma 0.22.0 → 0.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions.d.ts +13 -0
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +236 -93
- package/dist/actions.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +11 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/config.d.ts +13 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +90 -0
- package/dist/config.js.map +1 -1
- package/dist/docs/api/rest_api.md +81 -0
- package/dist/docs/developer/getting_started.md +45 -0
- package/dist/docs/developer/mcp/proxy.md +48 -28
- package/dist/docs/developer/npm_scripts.md +10 -4
- package/dist/docs/infrastructure/client_instance_deployment.md +50 -2
- package/dist/docs/operations/configuration.md +44 -1
- package/dist/docs/security/advisories/2026-08-26-jwt-bearer-unverified-fallback-auth-bypass.md +59 -0
- package/dist/docs/security/advisories/README.md +1 -0
- package/dist/docs/security/practices.md +5 -1
- package/dist/docs/subsystems/agent_session_architecture.md +69 -0
- package/dist/docs/subsystems/usage_digest.md +127 -0
- package/dist/docs/testing/automated_test_catalog.md +49 -26
- package/dist/docs/testing/testing_standard.md +1 -1
- package/dist/middleware/aauth_admission.js +1 -1
- package/dist/middleware/aauth_admission.js.map +1 -1
- package/dist/middleware/db_abort_context.d.ts +24 -0
- package/dist/middleware/db_abort_context.d.ts.map +1 -0
- package/dist/middleware/db_abort_context.js +41 -0
- package/dist/middleware/db_abort_context.js.map +1 -0
- package/dist/proxy/mcp_stdio_proxy.d.ts +134 -6
- package/dist/proxy/mcp_stdio_proxy.d.ts.map +1 -1
- package/dist/proxy/mcp_stdio_proxy.js +373 -17
- package/dist/proxy/mcp_stdio_proxy.js.map +1 -1
- package/dist/repositories/sqlite/local_db_adapter.d.ts.map +1 -1
- package/dist/repositories/sqlite/local_db_adapter.js +20 -0
- package/dist/repositories/sqlite/local_db_adapter.js.map +1 -1
- package/dist/repositories/sqlite/sqlite_client.d.ts.map +1 -1
- package/dist/repositories/sqlite/sqlite_client.js +10 -0
- package/dist/repositories/sqlite/sqlite_client.js.map +1 -1
- package/dist/repositories/worker/worker_file_database.d.ts +135 -1
- package/dist/repositories/worker/worker_file_database.d.ts.map +1 -1
- package/dist/repositories/worker/worker_file_database.js +726 -27
- package/dist/repositories/worker/worker_file_database.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +182 -77
- package/dist/server.js.map +1 -1
- package/dist/services/attachment_resolution.d.ts +149 -0
- package/dist/services/attachment_resolution.d.ts.map +1 -0
- package/dist/services/attachment_resolution.js +206 -0
- package/dist/services/attachment_resolution.js.map +1 -0
- package/dist/services/attachment_resolution_sqlite.d.ts +57 -0
- package/dist/services/attachment_resolution_sqlite.d.ts.map +1 -0
- package/dist/services/attachment_resolution_sqlite.js +75 -0
- package/dist/services/attachment_resolution_sqlite.js.map +1 -0
- package/dist/services/entity_queries.d.ts.map +1 -1
- package/dist/services/entity_queries.js +85 -23
- package/dist/services/entity_queries.js.map +1 -1
- package/dist/services/entity_snapshot_at_time.d.ts.map +1 -1
- package/dist/services/entity_snapshot_at_time.js +23 -3
- package/dist/services/entity_snapshot_at_time.js.map +1 -1
- package/dist/services/file_input_diagnostics.d.ts +89 -0
- package/dist/services/file_input_diagnostics.d.ts.map +1 -0
- package/dist/services/file_input_diagnostics.js +174 -0
- package/dist/services/file_input_diagnostics.js.map +1 -0
- package/dist/services/interpretation.d.ts.map +1 -1
- package/dist/services/interpretation.js +22 -8
- package/dist/services/interpretation.js.map +1 -1
- package/dist/services/mcp_auth.d.ts +19 -3
- package/dist/services/mcp_auth.d.ts.map +1 -1
- package/dist/services/mcp_auth.js +23 -33
- package/dist/services/mcp_auth.js.map +1 -1
- package/dist/services/mcp_oauth.d.ts +14 -1
- package/dist/services/mcp_oauth.d.ts.map +1 -1
- package/dist/services/mcp_oauth.js +86 -1
- package/dist/services/mcp_oauth.js.map +1 -1
- package/dist/services/raw_storage.d.ts.map +1 -1
- package/dist/services/raw_storage.js +14 -2
- package/dist/services/raw_storage.js.map +1 -1
- package/dist/services/readiness.d.ts +85 -0
- package/dist/services/readiness.d.ts.map +1 -0
- package/dist/services/readiness.js +93 -0
- package/dist/services/readiness.js.map +1 -0
- package/dist/services/route_shadowing.d.ts +67 -0
- package/dist/services/route_shadowing.d.ts.map +1 -0
- package/dist/services/route_shadowing.js +126 -0
- package/dist/services/route_shadowing.js.map +1 -0
- package/dist/services/schema_definitions.d.ts.map +1 -1
- package/dist/services/schema_definitions.js +171 -0
- package/dist/services/schema_definitions.js.map +1 -1
- package/dist/services/schema_lag_repair.d.ts.map +1 -1
- package/dist/services/schema_lag_repair.js +32 -12
- package/dist/services/schema_lag_repair.js.map +1 -1
- package/dist/services/schema_registry.d.ts.map +1 -1
- package/dist/services/schema_registry.js +12 -5
- package/dist/services/schema_registry.js.map +1 -1
- package/dist/services/snapshot_computation.d.ts.map +1 -1
- package/dist/services/snapshot_computation.js +12 -8
- package/dist/services/snapshot_computation.js.map +1 -1
- package/dist/services/subscriptions/sse_hub.d.ts.map +1 -1
- package/dist/services/subscriptions/sse_hub.js +19 -1
- package/dist/services/subscriptions/sse_hub.js.map +1 -1
- package/dist/shared/action_handlers/entity_handlers.d.ts.map +1 -1
- package/dist/shared/action_handlers/entity_handlers.js +110 -26
- package/dist/shared/action_handlers/entity_handlers.js.map +1 -1
- package/dist/shared/action_schemas.d.ts +6 -6
- package/dist/shared/contract_mappings.d.ts.map +1 -1
- package/dist/shared/contract_mappings.js +8 -1
- package/dist/shared/contract_mappings.js.map +1 -1
- package/dist/shared/openapi_types.d.ts +108 -3
- package/dist/shared/openapi_types.d.ts.map +1 -1
- package/dist/tool_definitions.d.ts.map +1 -1
- package/dist/tool_definitions.js +18 -13
- package/dist/tool_definitions.js.map +1 -1
- package/openapi.yaml +83 -3
- package/package.json +2 -1
- package/skills/status/SKILL.md +0 -1
- package/skills/where/SKILL.md +315 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request-cancellation context for database reads (issue #2217).
|
|
3
|
+
*
|
|
4
|
+
* A client that gives up — an HTTP connection closed, an MCP call cancelled —
|
|
5
|
+
* does not stop the server-side work it started. On the worker-hosted local
|
|
6
|
+
* backend that work is holding a reader-pool slot, and the pool is small: two
|
|
7
|
+
* abandoned reads were enough to make a hosted instance serve nothing while
|
|
8
|
+
* `/health` stayed green, because nothing reclaimed their readers.
|
|
9
|
+
*
|
|
10
|
+
* This middleware binds an AbortSignal that fires when the response closes
|
|
11
|
+
* before it finished, and runs the rest of the request inside
|
|
12
|
+
* {@link withDbAbortSignal}. Reads issued downstream pick the signal up
|
|
13
|
+
* ambiently; when it fires, the reader executing them is terminated and the
|
|
14
|
+
* slot returns to the pool immediately rather than at the query's natural end.
|
|
15
|
+
*
|
|
16
|
+
* Deliberately reads-only. Writes are not abandoned: a caller hanging up
|
|
17
|
+
* mid-write must not leave a half-applied mutation, so `routeWrite` and
|
|
18
|
+
* everything inside a transaction ignore the signal (see
|
|
19
|
+
* `worker_file_database.ts`). Backends other than the worker-hosted one ignore
|
|
20
|
+
* the context entirely, so mounting this is a no-op for them.
|
|
21
|
+
*/
|
|
22
|
+
import type { RequestHandler } from "express";
|
|
23
|
+
export declare function dbAbortContext(): RequestHandler;
|
|
24
|
+
//# sourceMappingURL=db_abort_context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db_abort_context.d.ts","sourceRoot":"","sources":["../../src/middleware/db_abort_context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAyB,cAAc,EAAY,MAAM,SAAS,CAAC;AAG/E,wBAAgB,cAAc,IAAI,cAAc,CAkB/C"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request-cancellation context for database reads (issue #2217).
|
|
3
|
+
*
|
|
4
|
+
* A client that gives up — an HTTP connection closed, an MCP call cancelled —
|
|
5
|
+
* does not stop the server-side work it started. On the worker-hosted local
|
|
6
|
+
* backend that work is holding a reader-pool slot, and the pool is small: two
|
|
7
|
+
* abandoned reads were enough to make a hosted instance serve nothing while
|
|
8
|
+
* `/health` stayed green, because nothing reclaimed their readers.
|
|
9
|
+
*
|
|
10
|
+
* This middleware binds an AbortSignal that fires when the response closes
|
|
11
|
+
* before it finished, and runs the rest of the request inside
|
|
12
|
+
* {@link withDbAbortSignal}. Reads issued downstream pick the signal up
|
|
13
|
+
* ambiently; when it fires, the reader executing them is terminated and the
|
|
14
|
+
* slot returns to the pool immediately rather than at the query's natural end.
|
|
15
|
+
*
|
|
16
|
+
* Deliberately reads-only. Writes are not abandoned: a caller hanging up
|
|
17
|
+
* mid-write must not leave a half-applied mutation, so `routeWrite` and
|
|
18
|
+
* everything inside a transaction ignore the signal (see
|
|
19
|
+
* `worker_file_database.ts`). Backends other than the worker-hosted one ignore
|
|
20
|
+
* the context entirely, so mounting this is a no-op for them.
|
|
21
|
+
*/
|
|
22
|
+
import { withDbAbortSignal } from "../repositories/worker/worker_file_database.js";
|
|
23
|
+
export function dbAbortContext() {
|
|
24
|
+
return (req, res, next) => {
|
|
25
|
+
const controller = new AbortController();
|
|
26
|
+
// `close` fires on both a completed response and an aborted one. Only the
|
|
27
|
+
// latter should cancel: aborting after a normal finish would tear down a
|
|
28
|
+
// reader that is legitimately serving the NEXT request, since the signal
|
|
29
|
+
// is consulted at dispatch time.
|
|
30
|
+
const onClose = () => {
|
|
31
|
+
if (!res.writableEnded)
|
|
32
|
+
controller.abort();
|
|
33
|
+
};
|
|
34
|
+
res.once("close", onClose);
|
|
35
|
+
res.once("finish", () => res.removeListener("close", onClose));
|
|
36
|
+
withDbAbortSignal(controller.signal, () => {
|
|
37
|
+
next();
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=db_abort_context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db_abort_context.js","sourceRoot":"","sources":["../../src/middleware/db_abort_context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAEnF,MAAM,UAAU,cAAc;IAC5B,OAAO,CAAC,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAQ,EAAE;QAC/D,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;QAEzC,0EAA0E;QAC1E,yEAAyE;QACzE,yEAAyE;QACzE,iCAAiC;QACjC,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,IAAI,CAAC,GAAG,CAAC,aAAa;gBAAE,UAAU,CAAC,KAAK,EAAE,CAAC;QAC7C,CAAC,CAAC;QACF,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC3B,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QAE/D,iBAAiB,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,EAAE;YACxC,IAAI,EAAE,CAAC;QACT,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -49,12 +49,83 @@ export declare class SessionState {
|
|
|
49
49
|
clearSession(): void;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
52
|
+
* True when a downstream response means "your MCP session is gone, re-initialize"
|
|
53
|
+
* (neotoma#2312). Exported for unit tests.
|
|
54
|
+
*
|
|
55
|
+
* Keyed on THREE things together, and each one is load-bearing:
|
|
56
|
+
*
|
|
57
|
+
* 1. **Status is 404 or 503.** 404 is the spec-compliant status per MCP Streamable
|
|
58
|
+
* HTTP session management (neotoma#1923); 503 was the prior status and is retained
|
|
59
|
+
* so this proxy still recovers against older/unpatched Neotoma server instances.
|
|
60
|
+
* 401 is deliberately excluded — `src/actions.ts` returns `-32001` on four separate
|
|
61
|
+
* auth failures (invalid/expired bearer, encryption-mode token, unauthenticated POST,
|
|
62
|
+
* invalid connection id). Those are not session loss, and replaying `initialize`
|
|
63
|
+
* against them would spin the retry loop against a credential problem the replay
|
|
64
|
+
* cannot fix, burning `maxAttempts` and masking the real error from the operator.
|
|
65
|
+
*
|
|
66
|
+
* 2. **The body carries JSON-RPC `error.code === -32001`.** This is what distinguishes
|
|
67
|
+
* a session loss from a genuine routing 404 (a missing route, a misconfigured
|
|
68
|
+
* downstream URL), which must surface as an error rather than be retried.
|
|
69
|
+
*
|
|
70
|
+
* 3. **The message says the session is unknown.** The code alone is not sufficient,
|
|
71
|
+
* since `-32001` is reused for auth; the message keeps an unrelated future
|
|
72
|
+
* `-32001` on 404/503 from being read as session loss.
|
|
73
|
+
*
|
|
74
|
+
* A body that is not parseable JSON-RPC (no code recoverable) still qualifies on the
|
|
75
|
+
* message alone, so a server that wraps or strips the envelope does not regress
|
|
76
|
+
* recovery that worked before this change.
|
|
56
77
|
*/
|
|
57
78
|
export declare function isRecoverableMcpSessionLostError(status: number, bodyText: string): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* How an `initialize` failure is classified (neotoma#2321). Exported for tests.
|
|
81
|
+
*
|
|
82
|
+
* The distinction that matters is not "did it fail" but "did anything happen
|
|
83
|
+
* server-side, and can a replay fix it":
|
|
84
|
+
*
|
|
85
|
+
* - `retryable_transport` — the request never reached a server that answered.
|
|
86
|
+
* - `retryable_server` — a server answered and reported its own failure.
|
|
87
|
+
* - `auth_rejected` — a server answered and refused the credential.
|
|
88
|
+
* - `other_terminal` — anything else; retrying is not known to be safe or useful.
|
|
89
|
+
*/
|
|
90
|
+
export type InitializeFailureClass = "retryable_transport" | "retryable_server" | "auth_rejected" | "other_terminal";
|
|
91
|
+
/**
|
|
92
|
+
* Classify a *handshake* failure (neotoma#2321).
|
|
93
|
+
*
|
|
94
|
+
* This is deliberately a separate predicate from {@link isRecoverableMcpSessionLostError},
|
|
95
|
+
* which answers a different question — "was an established session lost" — and
|
|
96
|
+
* must keep answering only that. On the initialize path there is no session yet,
|
|
97
|
+
* so session-loss reasoning does not apply at all.
|
|
98
|
+
*
|
|
99
|
+
* Each class is keyed on more than one signal, following the discipline
|
|
100
|
+
* neotoma#2320 established for the session-loss predicate:
|
|
101
|
+
*
|
|
102
|
+
* 1. **`auth_rejected` is keyed on HTTP 401**, not on `-32001`. `src/actions.ts`
|
|
103
|
+
* returns `-32001` from four separate auth paths (invalid/expired bearer,
|
|
104
|
+
* encryption-mode token, unauthenticated POST, invalid connection id) — and
|
|
105
|
+
* every one of them returns **401**, while the session-loss path returns 404.
|
|
106
|
+
* The status is therefore the reliable discriminator and the shared `-32001`
|
|
107
|
+
* is not. Retrying an auth rejection would hammer a server that is correctly
|
|
108
|
+
* refusing a credential a replay cannot change, so this exclusion is checked
|
|
109
|
+
* FIRST and no later rule can override it.
|
|
110
|
+
*
|
|
111
|
+
* 2. **`retryable_server` requires evidence the server itself failed** — an HTTP
|
|
112
|
+
* 5xx, or a JSON-RPC `-32603`. The `-32603` arm is load-bearing beyond the
|
|
113
|
+
* 5xx one: when the crash happens after response headers are already sent,
|
|
114
|
+
* `src/actions.ts` cannot restate the status, so the internal error rides out
|
|
115
|
+
* through an otherwise-200 response. That is the exact shape of the
|
|
116
|
+
* "DB request aborted by caller" handshake failure in neotoma#2316.
|
|
117
|
+
*
|
|
118
|
+
* 3. **A 4xx that is not 401 is `other_terminal`.** A 400 or a routing 404 is a
|
|
119
|
+
* client/config error; replaying it just burns the budget and hides the cause.
|
|
120
|
+
*
|
|
121
|
+
* Note what is deliberately absent: no rule keys on `-32001` alone. Auth and
|
|
122
|
+
* session loss share that code, so it cannot by itself justify a retry.
|
|
123
|
+
*/
|
|
124
|
+
export declare function classifyInitializeFailure(input: {
|
|
125
|
+
status?: number;
|
|
126
|
+
bodyText?: string;
|
|
127
|
+
networkError?: boolean;
|
|
128
|
+
}): InitializeFailureClass;
|
|
58
129
|
export interface ProxyLoopState {
|
|
59
130
|
session: SessionState;
|
|
60
131
|
/** Last downstream initialize body (JSON), after clientInfo injection — replayed on session loss. */
|
|
@@ -64,6 +135,34 @@ export interface ProxyLoopState {
|
|
|
64
135
|
export declare function createLoopState(): ProxyLoopState;
|
|
65
136
|
export declare function formatDownstreamErrorMessage(status: number, detail: string): string;
|
|
66
137
|
type EmitFn = (payload: unknown) => void;
|
|
138
|
+
/**
|
|
139
|
+
* True when `payload` is a JSON-RPC *response* (it carries `result` or
|
|
140
|
+
* `error`). Server-initiated requests and notifications are not responses and
|
|
141
|
+
* are never correlated against the pending request's id.
|
|
142
|
+
*/
|
|
143
|
+
export declare function isJsonRpcResponse(payload: unknown): payload is {
|
|
144
|
+
id?: unknown;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Guard against neotoma#2272: a response describing a DIFFERENT caller's write.
|
|
148
|
+
*
|
|
149
|
+
* The proxy used to forward whatever envelope downstream returned, so a payload
|
|
150
|
+
* belonging to another in-flight call could be delivered as the answer to this
|
|
151
|
+
* one. That is strictly worse than a failed write: the entire discipline for an
|
|
152
|
+
* append-only store under load is "don't trust a success code, re-read the
|
|
153
|
+
* entity", and that assumes the response at least says WHICH write it
|
|
154
|
+
* describes. An agent that stores the returned `entity_id` would attach
|
|
155
|
+
* subsequent work to the wrong parent, and no idempotency key can detect it —
|
|
156
|
+
* the mismatch is downstream of the write.
|
|
157
|
+
*
|
|
158
|
+
* A response whose id does not match the request is therefore dropped and
|
|
159
|
+
* replaced with an explicit error, so the caller retries or verifies rather
|
|
160
|
+
* than silently adopting another caller's entity id. Notifications and
|
|
161
|
+
* server-initiated requests (no id, no result/error) pass through untouched.
|
|
162
|
+
*
|
|
163
|
+
* Returns the payload to emit, or null to drop it.
|
|
164
|
+
*/
|
|
165
|
+
export declare function correlateResponse(payload: unknown, requestId: unknown): unknown | null;
|
|
67
166
|
/** Default per-request downstream timeout (ms) — below typical harness MCP timeouts so a hang retries rather than surfacing as "unavailable". */
|
|
68
167
|
export declare const DEFAULT_REQUEST_TIMEOUT_MS = 15000;
|
|
69
168
|
/** Default total attempts (initial + retries) to recover a lost MCP session. */
|
|
@@ -76,6 +175,23 @@ export declare function backoffMs(attempt: number): number;
|
|
|
76
175
|
* moved on to a retry, and a late success is harmless.
|
|
77
176
|
*/
|
|
78
177
|
export declare function withTimeout<T>(p: Promise<T>, ms: number): Promise<T>;
|
|
178
|
+
/**
|
|
179
|
+
* Wall-clock ceiling for retrying a failed handshake (neotoma#2321).
|
|
180
|
+
*
|
|
181
|
+
* Attempt count alone is not a sufficient bound here. The proxy is a stdio child
|
|
182
|
+
* and emits nothing until `dispatchCore` resolves, so the client sits blocked on
|
|
183
|
+
* its own `initialize` timeout for the whole retry window — 60s by default in the
|
|
184
|
+
* MCP SDK (`DEFAULT_REQUEST_TIMEOUT_MSEC`). Four attempts that each burn the full
|
|
185
|
+
* 15s request timeout plus backoff would total ~62s and blow past that, turning a
|
|
186
|
+
* recoverable handshake into a client-side abort — the very outcome this retry
|
|
187
|
+
* exists to prevent.
|
|
188
|
+
*
|
|
189
|
+
* 45s leaves headroom under the default client budget while still spanning the
|
|
190
|
+
* fast-failure cases this fix targets (ECONNREFUSED, socket close, 5xx/-32603 all
|
|
191
|
+
* return in well under a second, so the whole window is a couple of seconds of
|
|
192
|
+
* backoff). Overridable via NEOTOMA_MCP_PROXY_HANDSHAKE_BUDGET_MS.
|
|
193
|
+
*/
|
|
194
|
+
export declare const DEFAULT_HANDSHAKE_RETRY_BUDGET_MS = 45000;
|
|
79
195
|
/** Injected transport for {@link dispatchCore}: real impl wraps sendDownstream; tests pass a fake. */
|
|
80
196
|
export interface DispatchDeps {
|
|
81
197
|
send: (headers: Record<string, string>, body: string) => Promise<Response>;
|
|
@@ -83,6 +199,10 @@ export interface DispatchDeps {
|
|
|
83
199
|
sleep: (ms: number) => Promise<void>;
|
|
84
200
|
timeoutMs: number;
|
|
85
201
|
maxAttempts: number;
|
|
202
|
+
/** Wall-clock ceiling for handshake retries. Tests inject a clock; production uses Date.now. */
|
|
203
|
+
now?: () => number;
|
|
204
|
+
/** Total ms the handshake retry loop may span. Defaults to DEFAULT_HANDSHAKE_RETRY_BUDGET_MS. */
|
|
205
|
+
handshakeBudgetMs?: number;
|
|
86
206
|
}
|
|
87
207
|
/**
|
|
88
208
|
* Forward one JSON-RPC message downstream, recovering automatically from a
|
|
@@ -96,8 +216,16 @@ export interface DispatchDeps {
|
|
|
96
216
|
* cached `initialize` is replayed downstream and the message retried, up to
|
|
97
217
|
* `maxAttempts` with exponential backoff. The client's stdout only ever sees
|
|
98
218
|
* the final result, so backend restarts become invisible instead of failing
|
|
99
|
-
* the whole session.
|
|
100
|
-
*
|
|
219
|
+
* the whole session.
|
|
220
|
+
*
|
|
221
|
+
* `initialize` takes a SEPARATE path (neotoma#2321). Session-loss recovery
|
|
222
|
+
* cannot help a handshake that never established — there is no session to
|
|
223
|
+
* recover and no cached handshake to replay — so a failed `initialize` used to
|
|
224
|
+
* be permanent for the life of the client, leaving every session opened during
|
|
225
|
+
* an outage dark long after the backend recovered. It is now retried, but only
|
|
226
|
+
* on a classified failure ({@link classifyInitializeFailure}): a transport
|
|
227
|
+
* failure that never reached a server, or a server that answered with its own
|
|
228
|
+
* internal failure. An `initialize` refused for authentication is never retried.
|
|
101
229
|
*/
|
|
102
230
|
export declare function dispatchCore(deps: DispatchDeps, loopState: ProxyLoopState, config: ProxyConfig, message: Record<string, unknown>): Promise<void>;
|
|
103
231
|
export declare function runProxy(config: ProxyConfig): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp_stdio_proxy.d.ts","sourceRoot":"","sources":["../../src/proxy/mcp_stdio_proxy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,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