agentfootprint 11.1.1 → 11.2.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 +1 -0
- package/dist/adapters/mcp/agentcoreRuntime/sessionBusy.js +35 -4
- package/dist/adapters/mcp/agentcoreRuntime/sessionBusy.js.map +1 -1
- package/dist/adapters/mcp/agentcoreRuntime/transport.js +48 -22
- package/dist/adapters/mcp/agentcoreRuntime/transport.js.map +1 -1
- package/dist/core/RunnerBase.js +20 -1
- package/dist/core/RunnerBase.js.map +1 -1
- package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts +6 -2
- package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.js +35 -4
- package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.js.map +1 -1
- package/dist/esm/adapters/mcp/agentcoreRuntime/transport.d.ts +38 -12
- package/dist/esm/adapters/mcp/agentcoreRuntime/transport.js +47 -21
- package/dist/esm/adapters/mcp/agentcoreRuntime/transport.js.map +1 -1
- package/dist/esm/core/RunnerBase.d.ts +18 -0
- package/dist/esm/core/RunnerBase.js +20 -1
- package/dist/esm/core/RunnerBase.js.map +1 -1
- package/dist/esm/core/runner.d.ts +1 -0
- package/dist/esm/lib/longTimeout.d.ts +34 -0
- package/dist/esm/lib/longTimeout.js +56 -0
- package/dist/esm/lib/longTimeout.js.map +1 -0
- package/dist/esm/lib/sleep.d.ts +2 -0
- package/dist/esm/lib/sleep.js +2 -0
- package/dist/esm/lib/sleep.js.map +1 -1
- package/dist/esm/mcp/backoff.d.ts +81 -0
- package/dist/esm/mcp/backoff.js +158 -0
- package/dist/esm/mcp/backoff.js.map +1 -0
- package/dist/esm/mcp/mcpClient.js +3 -1
- package/dist/esm/mcp/mcpClient.js.map +1 -1
- package/dist/esm/mcp/throttleRetry.d.ts +198 -28
- package/dist/esm/mcp/throttleRetry.js +428 -83
- package/dist/esm/mcp/throttleRetry.js.map +1 -1
- package/dist/esm/mcp/types.d.ts +16 -7
- package/dist/esm/strategies/attach.js +3 -0
- package/dist/esm/strategies/attach.js.map +1 -1
- package/dist/esm/strategies/flushDeadline.d.ts +47 -0
- package/dist/esm/strategies/flushDeadline.js +96 -0
- package/dist/esm/strategies/flushDeadline.js.map +1 -0
- package/dist/lib/longTimeout.js +60 -0
- package/dist/lib/longTimeout.js.map +1 -0
- package/dist/lib/sleep.js +2 -0
- package/dist/lib/sleep.js.map +1 -1
- package/dist/mcp/backoff.js +163 -0
- package/dist/mcp/backoff.js.map +1 -0
- package/dist/mcp/mcpClient.js +3 -1
- package/dist/mcp/mcpClient.js.map +1 -1
- package/dist/mcp/throttleRetry.js +432 -85
- package/dist/mcp/throttleRetry.js.map +1 -1
- package/dist/strategies/attach.js +3 -0
- package/dist/strategies/attach.js.map +1 -1
- package/dist/strategies/flushDeadline.js +102 -0
- package/dist/strategies/flushDeadline.js.map +1 -0
- package/dist/types/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts +6 -2
- package/dist/types/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts.map +1 -1
- package/dist/types/adapters/mcp/agentcoreRuntime/transport.d.ts +38 -12
- package/dist/types/adapters/mcp/agentcoreRuntime/transport.d.ts.map +1 -1
- package/dist/types/core/RunnerBase.d.ts +18 -0
- package/dist/types/core/RunnerBase.d.ts.map +1 -1
- package/dist/types/core/runner.d.ts +1 -0
- package/dist/types/core/runner.d.ts.map +1 -1
- package/dist/types/lib/longTimeout.d.ts +35 -0
- package/dist/types/lib/longTimeout.d.ts.map +1 -0
- package/dist/types/lib/sleep.d.ts +2 -0
- package/dist/types/lib/sleep.d.ts.map +1 -1
- package/dist/types/mcp/backoff.d.ts +82 -0
- package/dist/types/mcp/backoff.d.ts.map +1 -0
- package/dist/types/mcp/throttleRetry.d.ts +198 -28
- package/dist/types/mcp/throttleRetry.d.ts.map +1 -1
- package/dist/types/mcp/types.d.ts +16 -7
- package/dist/types/mcp/types.d.ts.map +1 -1
- package/dist/types/strategies/attach.d.ts.map +1 -1
- package/dist/types/strategies/flushDeadline.d.ts +48 -0
- package/dist/types/strategies/flushDeadline.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* throttleRetry — when an MCP server
|
|
2
|
+
* throttleRetry — when an MCP server refuses a request before running it, wait
|
|
3
|
+
* and ask again.
|
|
3
4
|
*
|
|
4
5
|
* ── Why this exists ──────────────────────────────────────────────────────────
|
|
5
6
|
* Managed MCP gateways enforce per-principal rate limits. A throttled
|
|
@@ -43,6 +44,43 @@
|
|
|
43
44
|
* that would have died during the wait is simply never the one reused. The
|
|
44
45
|
* gateway secrecy invariant is untouched: each attempt vends, applies, drops.
|
|
45
46
|
*
|
|
47
|
+
* ── The loop is footprintjs's attempt runner, one series per call ────────────
|
|
48
|
+
* Each call runs ONE `attempt()` series (footprintjs, used as it ships). Its
|
|
49
|
+
* runner makes an attempt record per try; they stay inside this module for
|
|
50
|
+
* now — only `onRetry`, before each wait, reaches a caller. An attempt sends
|
|
51
|
+
* the request once, and an attempt that got a RESPONSE is not an operation
|
|
52
|
+
* that succeeded: a 503 is delivered as the answer it was, never retried.
|
|
53
|
+
* A response a rule's decision recognises is thrown as a refusal that names
|
|
54
|
+
* its kind, and the policy's `retryOn` accepts those refusals and nothing
|
|
55
|
+
* else — so a 5xx, a dropped connection or a timeout ends the series on the
|
|
56
|
+
* attempt it happened in, as it always did. When the
|
|
57
|
+
* series ends on a refusal (attempts spent, a ceiling reached, no time left),
|
|
58
|
+
* the refusal's response is delivered as the server sent it: the caller sees
|
|
59
|
+
* the 429, never an error of ours.
|
|
60
|
+
*
|
|
61
|
+
* ── A fetch that already retries is JOINED, never wrapped ────────────────────
|
|
62
|
+
* A transport whose own fetch runs a series (AgentCore Runtime's session-busy
|
|
63
|
+
* retry) says how to rebuild itself with one more rule (`joinableRetry`).
|
|
64
|
+
* `retryingFetch` over such a fetch — what `mcpClient` applies to every http
|
|
65
|
+
* transport — adds its 429 rule to THAT series instead of starting a second
|
|
66
|
+
* one around it. One series means one attempt count, one waiting total and one
|
|
67
|
+
* deadline per call, by construction: the layers can never multiply requests.
|
|
68
|
+
* The series' FIRST rule holds the call's budget — its `maxAttempts`,
|
|
69
|
+
* `maxWaitMs` and `maxElapsedMs` bound every attempt and wait, whatever the
|
|
70
|
+
* reason. A rule that joins keeps its own values as limits on its own kind:
|
|
71
|
+
* they can stop its retries sooner, never make the call longer.
|
|
72
|
+
*
|
|
73
|
+
* ── The wait: a stated one wins, whole ───────────────────────────────────────
|
|
74
|
+
* Each retry's wait is `statedWaitFirst(retry-after, exponentialBackoff({ …,
|
|
75
|
+
* maxDelayMs }))`: the server's `Retry-After` when it sent one, else our
|
|
76
|
+
* jittered backoff, whose CEILING is capped at `maxDelayMs` before the draw
|
|
77
|
+
* (so capped waits keep their jitter). The cap is on the SCHEDULE only —
|
|
78
|
+
* never on a stated wait — so the footprintjs policy's `maxBackoffMs`,
|
|
79
|
+
* which would cut every wait and send the request again before the server
|
|
80
|
+
* said it may, is left unset. A stated wait too long for `maxWaitMs` or the
|
|
81
|
+
* deadline is never shortened either: the series stops, and the 429 is
|
|
82
|
+
* delivered as the server sent it.
|
|
83
|
+
*
|
|
46
84
|
* Pattern: Decorator over `fetch`. Role: Layer-3 tool transport.
|
|
47
85
|
*/
|
|
48
86
|
/**
|
|
@@ -54,22 +92,50 @@
|
|
|
54
92
|
* supplies fewer.
|
|
55
93
|
*/
|
|
56
94
|
export type ThrottleFetch = (input: string | URL, init?: RequestInit) => Promise<Response>;
|
|
95
|
+
/**
|
|
96
|
+
* Which refusal a retry answers: HTTP 429 (`'throttle'`), or AgentCore
|
|
97
|
+
* Runtime's "session operation in progress" (`'session-busy'`).
|
|
98
|
+
*/
|
|
99
|
+
export type RetryKind = 'throttle' | 'session-busy';
|
|
57
100
|
/** Reported to {@link ThrottleRetryOptions.onRetry} before each wait. */
|
|
58
101
|
export interface ThrottleRetryInfo {
|
|
102
|
+
/** Which refusal this retry answers. */
|
|
103
|
+
readonly kind: RetryKind;
|
|
59
104
|
/** The attempt about to START. `2` is the first retry. */
|
|
60
105
|
readonly attempt: number;
|
|
61
|
-
/** Ceiling in force for this
|
|
106
|
+
/** Ceiling in force for this refusal, including the first attempt. */
|
|
62
107
|
readonly maxAttempts: number;
|
|
63
108
|
/** How long we are about to wait, in milliseconds. */
|
|
64
109
|
readonly waitMs: number;
|
|
65
110
|
/** What the server's `Retry-After` asked for, when it sent one. Absent
|
|
66
111
|
* means the wait below is our own jittered backoff. */
|
|
67
112
|
readonly retryAfterMs?: number;
|
|
68
|
-
/**
|
|
69
|
-
*
|
|
113
|
+
/**
|
|
114
|
+
* The ORIGIN of the endpoint being retried — scheme, host and port, nothing
|
|
115
|
+
* else. Never its path, user info (`user:pass@`), query or fragment: a
|
|
116
|
+
* token, a credential or a customer id can ride in any of them. The empty
|
|
117
|
+
* string when the URL has no origin (a relative one).
|
|
118
|
+
*/
|
|
70
119
|
readonly url: string;
|
|
120
|
+
/**
|
|
121
|
+
* The {@link ThrottleRetryOptions.endpointLabel} you declared for this
|
|
122
|
+
* endpoint — absent when you declared none. Never derived from the URL.
|
|
123
|
+
*/
|
|
124
|
+
readonly endpoint?: string;
|
|
71
125
|
}
|
|
72
|
-
/**
|
|
126
|
+
/**
|
|
127
|
+
* Fine-tuning for {@link McpClientOptions.retryOnThrottle}, and — with its own
|
|
128
|
+
* defaults — for `agentCoreRuntimeMcpTransport`'s `retry`. The defaults below
|
|
129
|
+
* are `retryOnThrottle`'s.
|
|
130
|
+
*
|
|
131
|
+
* Every limit here is the CALL's — unless this retry joins a series a
|
|
132
|
+
* transport already runs (an AgentCore Runtime transport under `mcpClient`).
|
|
133
|
+
* Then the transport's own values are the call's limits, and these limit only
|
|
134
|
+
* the 429 retries inside them: each can stop a 429 retry sooner (a 429 is
|
|
135
|
+
* retried only while the call has made fewer attempts than `maxAttempts`, has
|
|
136
|
+
* waited less than `maxWaitMs`, …), never make the call longer. The deadline
|
|
137
|
+
* that cuts a request in flight is the transport's `maxElapsedMs`.
|
|
138
|
+
*/
|
|
73
139
|
export interface ThrottleRetryOptions {
|
|
74
140
|
/** Total attempts including the first. Default 3. Minimum 1. */
|
|
75
141
|
readonly maxAttempts?: number;
|
|
@@ -84,15 +150,62 @@ export interface ThrottleRetryOptions {
|
|
|
84
150
|
*/
|
|
85
151
|
readonly maxWaitMs?: number;
|
|
86
152
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
153
|
+
* A deadline for the whole call, in milliseconds from its start — requests
|
|
154
|
+
* included, not just waits. A wait that would end past it is never begun
|
|
155
|
+
* (the refusal is delivered at once), and a request still waiting for its
|
|
156
|
+
* answer when it passes is cut: the call fails with the deadline's error.
|
|
157
|
+
* Default: none — `maxWaitMs` is the default rail.
|
|
158
|
+
*/
|
|
159
|
+
readonly maxElapsedMs?: number;
|
|
160
|
+
/**
|
|
161
|
+
* The ceiling of the first wait our own backoff draws, in milliseconds, when
|
|
162
|
+
* the server stated none. Default 200.
|
|
163
|
+
*/
|
|
164
|
+
readonly baseDelayMs?: number;
|
|
165
|
+
/** How much each backoff ceiling grows over the last. Default 2. At least 1. */
|
|
166
|
+
readonly multiplier?: number;
|
|
167
|
+
/**
|
|
168
|
+
* How a backoff wait is drawn below its ceiling: `'equal'` (the default)
|
|
169
|
+
* waits between half the ceiling and all of it, `'full'` anywhere from zero
|
|
170
|
+
* up to it, `'none'` exactly it. Jitter is what keeps clients refused at the
|
|
171
|
+
* same moment from asking again at the same moment.
|
|
172
|
+
*/
|
|
173
|
+
readonly jitter?: 'none' | 'equal' | 'full';
|
|
174
|
+
/**
|
|
175
|
+
* The most one of OUR backoff waits may last, in milliseconds. Default: none.
|
|
176
|
+
*
|
|
177
|
+
* It caps the scheduled wait's ceiling before the jittered draw, so capped
|
|
178
|
+
* waits still spread between half the cap and the cap. It never caps a
|
|
179
|
+
* server's `Retry-After` — unlike footprintjs's `RetryPolicy.maxBackoffMs`,
|
|
180
|
+
* which caps every wait. A stated wait is waited whole; asking sooner than
|
|
181
|
+
* the server said would only spend an attempt on a refusal it announced.
|
|
182
|
+
*/
|
|
183
|
+
readonly maxDelayMs?: number;
|
|
184
|
+
/**
|
|
185
|
+
* A name for this endpoint, declared by you, that `onRetry` reports as
|
|
186
|
+
* `endpoint` — so a log line can say which server was retried without
|
|
187
|
+
* carrying any part of its URL past the origin. 1–128 characters, none of
|
|
188
|
+
* them control characters. Absent, `onRetry` has no `endpoint` field; the
|
|
189
|
+
* library never makes one up from the URL.
|
|
190
|
+
*/
|
|
191
|
+
readonly endpointLabel?: string;
|
|
192
|
+
/**
|
|
193
|
+
* A notification before each wait — and, today, the ONLY retry report a
|
|
194
|
+
* caller gets. It is told the refusal's kind, the attempt about to start,
|
|
195
|
+
* the wait, the endpoint's origin and the label you declared for it
|
|
196
|
+
* (`endpointLabel`) — never the URL's path, the request's
|
|
197
|
+
* arguments or the server's answer. The series' final outcome and the
|
|
198
|
+
* attempt records footprintjs's runner makes for each try are NOT passed on
|
|
199
|
+
* yet. The contract matches what `withRetry` and `withCredentialRetry`
|
|
200
|
+
* already use: a decorator at a transport boundary reports to its consumer,
|
|
201
|
+
* and emits no events of its own.
|
|
91
202
|
*
|
|
92
203
|
* A retried call is not invisible without this: the wait lands inside the
|
|
93
204
|
* tool's `stream.tool_end` `durationMs`, and an exhausted retry still
|
|
94
205
|
* reaches the model with `error: true`. This hook is what turns "that call
|
|
95
206
|
* was slow" into "that call was throttled twice".
|
|
207
|
+
*
|
|
208
|
+
* A throw from it is isolated: the call goes on as if it had returned.
|
|
96
209
|
*/
|
|
97
210
|
readonly onRetry?: (info: ThrottleRetryInfo) => void;
|
|
98
211
|
}
|
|
@@ -123,12 +236,66 @@ export interface RetryVerdict {
|
|
|
123
236
|
* AgentCore Runtime's documented "session operation in progress" refusal,
|
|
124
237
|
* which lives with that vendor's adapter (`adapters/mcp/agentcoreRuntime/`).
|
|
125
238
|
* Each stays ONE small function, so a retry has exactly one place it is
|
|
126
|
-
* decided — and
|
|
127
|
-
*
|
|
239
|
+
* decided — and each attempt is written down as one footprintjs attempt
|
|
240
|
+
* record.
|
|
241
|
+
*/
|
|
242
|
+
export type RetryDecision = (response: Response,
|
|
243
|
+
/**
|
|
244
|
+
* The request's signal. It fires when the caller cancels or the call's
|
|
245
|
+
* deadline passes; a decision that reads the body must stop reading then,
|
|
246
|
+
* and release what it read from.
|
|
128
247
|
*/
|
|
129
|
-
|
|
248
|
+
signal?: AbortSignal) => RetryVerdict | undefined | Promise<RetryVerdict | undefined>;
|
|
130
249
|
/** HTTP 429, with the server's own `Retry-After` when it sent one. */
|
|
131
250
|
export declare function throttled(response: Response): RetryVerdict | undefined;
|
|
251
|
+
/**
|
|
252
|
+
* @internal What a rule's options fall back to. `Infinity` means none: no
|
|
253
|
+
* deadline (`maxElapsedMs`), no cap on the scheduled wait (`maxDelayMs`).
|
|
254
|
+
*/
|
|
255
|
+
export interface RetryDefaults {
|
|
256
|
+
readonly maxAttempts: number;
|
|
257
|
+
readonly maxWaitMs: number;
|
|
258
|
+
readonly maxElapsedMs: number;
|
|
259
|
+
readonly baseDelayMs: number;
|
|
260
|
+
readonly multiplier: number;
|
|
261
|
+
readonly jitter: 'none' | 'equal' | 'full';
|
|
262
|
+
readonly maxDelayMs: number;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* `retryOnThrottle`'s defaults — unchanged since 8.11.0: 3 attempts, a 200 ms
|
|
266
|
+
* backoff doubling with equal jitter (100–200 ms, then 200–400 ms), never more
|
|
267
|
+
* than 10 s of waiting in total. No deadline and no cap on one wait.
|
|
268
|
+
*/
|
|
269
|
+
export declare const THROTTLE_RETRY_DEFAULTS: RetryDefaults;
|
|
270
|
+
/**
|
|
271
|
+
* @internal One refusal a series may retry: the decision that recognises it,
|
|
272
|
+
* the kind it reports as, and the limits and backoff it retries by.
|
|
273
|
+
*/
|
|
274
|
+
export interface RetryRule {
|
|
275
|
+
readonly kind: RetryKind;
|
|
276
|
+
readonly decide: RetryDecision;
|
|
277
|
+
/** Total attempts while this refusal is the reason to go on. ≥ 1; `Infinity` is no count. */
|
|
278
|
+
readonly maxAttempts: number;
|
|
279
|
+
readonly maxWaitMs: number;
|
|
280
|
+
readonly maxElapsedMs: number;
|
|
281
|
+
readonly maxDelayMs: number;
|
|
282
|
+
readonly baseDelayMs: number;
|
|
283
|
+
readonly multiplier: number;
|
|
284
|
+
readonly jitter: 'none' | 'equal' | 'full';
|
|
285
|
+
/** The caller's own name for the endpoint, reported as `endpoint`. */
|
|
286
|
+
readonly endpointLabel?: string;
|
|
287
|
+
readonly onRetry?: (info: ThrottleRetryInfo) => void;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* @internal A rule from a caller's options — `undefined` when retry is off
|
|
291
|
+
* (`false`). An option field left out, or set to `undefined`, takes its
|
|
292
|
+
* default. `maxAttempts` and `maxWaitMs` keep the clamps they always had (below
|
|
293
|
+
* 1 reads as 1, below 0 as 0).
|
|
294
|
+
*
|
|
295
|
+
* @throws TypeError, when the rule is BUILT, for a value the schedule cannot
|
|
296
|
+
* mean — named by option, never echoing a value that is not a number.
|
|
297
|
+
*/
|
|
298
|
+
export declare function retryRule(kind: RetryKind, decide: RetryDecision, config: RetryOnThrottle | undefined, defaults: RetryDefaults, where: string): RetryRule | undefined;
|
|
132
299
|
/**
|
|
133
300
|
* Wrap a `fetch` so HTTP 429 responses are retried, honouring `Retry-After`.
|
|
134
301
|
*
|
|
@@ -136,6 +303,10 @@ export declare function throttled(response: Response): RetryVerdict | undefined;
|
|
|
136
303
|
* so a transport that passed no custom fetch keeps passing none and its
|
|
137
304
|
* behaviour is byte-identical to before this existed.
|
|
138
305
|
*
|
|
306
|
+
* When `inner` already runs a retry series of its own (an AgentCore Runtime
|
|
307
|
+
* transport's fetch), the 429 rule JOINS that series rather than wrapping it,
|
|
308
|
+
* so the two can never multiply requests — see the module note.
|
|
309
|
+
*
|
|
139
310
|
* ── Why this is public ───────────────────────────────────────────────────────
|
|
140
311
|
* `mcpClient({ transport })` applies it for you, ON by default. `mcpClient({
|
|
141
312
|
* connection })` cannot: the library builds no transport on that arm, so there
|
|
@@ -157,26 +328,25 @@ export declare function throttled(response: Response): RetryVerdict | undefined;
|
|
|
157
328
|
* @param inner the fetch to wrap. `undefined` means the global `fetch`,
|
|
158
329
|
* resolved at CALL time so a later polyfill still wins.
|
|
159
330
|
* @param config `true` / `undefined` for the defaults, `false` to get `inner`
|
|
160
|
-
* back unchanged, or an object to tune the ceilings.
|
|
331
|
+
* back unchanged, or an object to tune the ceilings and the backoff.
|
|
332
|
+
* @throws TypeError when an option is outside its range — here, when the fetch
|
|
333
|
+
* is built, never at the first call.
|
|
161
334
|
*/
|
|
162
335
|
export declare function retryingFetch(inner: ThrottleFetch | undefined, config: RetryOnThrottle | undefined): ThrottleFetch | undefined;
|
|
163
336
|
/**
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
* @internal Public to adapters, not to the door: the decision is the vendor's
|
|
177
|
-
* fact, and each one is reviewed against the license on {@link RetryDecision}.
|
|
337
|
+
* @internal Declare that `fetch` runs its retries in ONE series, and how to
|
|
338
|
+
* rebuild it with one more rule in that same series. `retryingFetch` joins such
|
|
339
|
+
* a fetch instead of wrapping it. A transport whose public fetch wraps its
|
|
340
|
+
* series (a session applied around it, its answers rewritten after it) uses
|
|
341
|
+
* this so the rule lands INSIDE that wrapping.
|
|
342
|
+
*/
|
|
343
|
+
export declare function joinableRetry(fetch: ThrottleFetch, join: (rule: RetryRule) => ThrottleFetch): ThrottleFetch;
|
|
344
|
+
/**
|
|
345
|
+
* @internal The one series per call over `inner`, asking `rules` in order —
|
|
346
|
+
* `inner` itself when there are none. The first rule holds the call's budget;
|
|
347
|
+
* see the module note. The result is joinable.
|
|
178
348
|
*/
|
|
179
|
-
export declare function
|
|
349
|
+
export declare function retryingFetchFor(inner: ThrottleFetch, rules: readonly RetryRule[]): ThrottleFetch;
|
|
180
350
|
/**
|
|
181
351
|
* `Retry-After` in either legal form: delta-seconds (`"2"`) or an HTTP-date
|
|
182
352
|
* (`"Wed, 21 Oct 2026 07:28:00 GMT"`). Anything else is treated as absent so a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"throttleRetry.d.ts","sourceRoot":"","sources":["../../../src/mcp/throttleRetry.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"throttleRetry.d.ts","sourceRoot":"","sources":["../../../src/mcp/throttleRetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AAaH;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAI3F;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,cAAc,CAAC;AAEpD,yEAAyE;AACzE,MAAM,WAAW,iBAAiB;IAChC,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,0DAA0D;IAC1D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,sEAAsE;IACtE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,sDAAsD;IACtD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;4DACwD;IACxD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;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aAAa,EACvB,KAAK,EAAE,MAAM,GACZ,SAAS,GAAG,SAAS,CAqBvB;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,aAAa,GAAG,SAAS,EAChC,MAAM,EAAE,eAAe,GAAG,SAAS,GAClC,aAAa,GAAG,SAAS,CAK3B;AASD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,aAAa,GACvC,aAAa,CAGf;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,SAAS,EAAE,GAAG,aAAa,CAQjG;AAgUD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAOpF"}
|
|
@@ -180,11 +180,13 @@ export interface McpClientOptions {
|
|
|
180
180
|
* What happens when the server says "too many requests" (HTTP 429). New in
|
|
181
181
|
* 8.11.0, and **on by default**.
|
|
182
182
|
*
|
|
183
|
-
* Default:
|
|
184
|
-
*
|
|
185
|
-
* never longer than 10 seconds of waiting in total across one
|
|
186
|
-
* `false` to let a throttled call fail immediately, or pass an
|
|
187
|
-
* tune the ceilings and
|
|
183
|
+
* Default: up to 3 attempts, waiting as long as the server's `Retry-After`
|
|
184
|
+
* header asks (and, when it sends none, a backoff of 200 ms doubling, with
|
|
185
|
+
* equal jitter), never longer than 10 seconds of waiting in total across one
|
|
186
|
+
* call. Set `false` to let a throttled call fail immediately, or pass an
|
|
187
|
+
* object to tune the ceilings and the backoff (`baseDelayMs`, `multiplier`,
|
|
188
|
+
* `jitter`, `maxDelayMs`, a `maxElapsedMs` deadline) and to learn when it
|
|
189
|
+
* happens:
|
|
188
190
|
*
|
|
189
191
|
* ```ts
|
|
190
192
|
* const gateway = await mcpClient({
|
|
@@ -192,12 +194,19 @@ export interface McpClientOptions {
|
|
|
192
194
|
* transport: gatewayTransport({ url, credentials }),
|
|
193
195
|
* retryOnThrottle: {
|
|
194
196
|
* maxAttempts: 5,
|
|
195
|
-
* onRetry: ({ attempt, waitMs, retryAfterMs }) =>
|
|
196
|
-
* log.warn({ attempt, waitMs, retryAfterMs }, 'gateway throttled'),
|
|
197
|
+
* onRetry: ({ kind, attempt, waitMs, retryAfterMs }) =>
|
|
198
|
+
* log.warn({ kind, attempt, waitMs, retryAfterMs }, 'gateway throttled'),
|
|
197
199
|
* },
|
|
198
200
|
* });
|
|
199
201
|
* ```
|
|
200
202
|
*
|
|
203
|
+
* Each call is ONE retry series (footprintjs's attempt runner). When the
|
|
204
|
+
* transport's own fetch already retries — `agentCoreRuntimeMcpTransport`'s
|
|
205
|
+
* session-busy retry — this 429 retry joins that series instead of wrapping
|
|
206
|
+
* it: one attempt count, one waiting total and one deadline per call, with
|
|
207
|
+
* the transport's `retry` values as the call's overall limits and these as
|
|
208
|
+
* limits on the 429 retries inside them.
|
|
209
|
+
*
|
|
201
210
|
* **Why this is on by default.** A 429 is a *pre-execution rejection* — the
|
|
202
211
|
* rate limiter refused the request at the edge and the server never ran the
|
|
203
212
|
* tool, so a retry cannot double-execute anything. That is not true of a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/mcp/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIvD;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ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IAC3C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE;QAChB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;QAC7B,mGAAmG;QACnG,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;KAC1B,CAAC;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attach.d.ts","sourceRoot":"","sources":["../../../src/strategies/attach.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAe,MAAM,yBAAyB,CAAC;AAG5E,OAAO,KAAK,EAEV,qBAAqB,EACrB,YAAY,EAEZ,kBAAkB,EAElB,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EAEf,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"attach.d.ts","sourceRoot":"","sources":["../../../src/strategies/attach.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAe,MAAM,yBAAyB,CAAC;AAG5E,OAAO,KAAK,EAEV,qBAAqB,EACrB,YAAY,EAEZ,kBAAkB,EAElB,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EAEf,MAAM,YAAY,CAAC;AAQpB,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,sDAAsD,CAAC;AA0Z9D,MAAM,WAAW,0BAA2B,SAAQ,qBAAqB;IACvE;;;;;;;;;;;;;;;;;4EAiBwE;IACxE,QAAQ,CAAC,IAAI,CAAC,EAAE,iBAAiB,CAAC;IAClC,QAAQ,CAAC,QAAQ,CAAC,EAAE,qBAAqB,CAAC;CAC3C;AAQD,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,eAAe,EAC3B,IAAI,GAAE,0BAA+B,GACpC,mBAAmB,CAwCrB;AAID,MAAM,WAAW,iBAAkB,SAAQ,qBAAqB;IAC9D,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,eAAe,EAC3B,IAAI,GAAE,iBAAsB,GAC3B,cAAc,CAgEhB;AAID,MAAM,WAAW,uBAAwB,SAAQ,qBAAqB;IACpE,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC;;0CAEsC;IACtC,QAAQ,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC;IACrC,sDAAsD;IACtD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAgBD,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,eAAe,EAC3B,IAAI,EAAE,uBAAuB,GAC5B,cAAc,CAwChB"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* strategies/flushDeadline — flush a handle, stop waiting at a deadline, and
|
|
3
|
+
* name the strategy that did not finish.
|
|
4
|
+
*
|
|
5
|
+
* A sink's `flush()` waits for its own in-flight delivery. One that never
|
|
6
|
+
* settles — a hung network mount under `appendFile`, a network call with no
|
|
7
|
+
* timeout — would hold a shutdown forever, and a slow one for as long as it is
|
|
8
|
+
* slow. The deadline belongs to the caller that must finish,
|
|
9
|
+
* `RunnerBase · shutdown`, never to the sink: nothing can cancel an in-flight
|
|
10
|
+
* write, and pretending otherwise would be worse than saying we stopped
|
|
11
|
+
* waiting (the `withinBound` law in hosting/standingAgent.ts).
|
|
12
|
+
*
|
|
13
|
+
* A missed deadline is REPORTED, through the stuck strategy's own `_onError`
|
|
14
|
+
* (the console when it has none), and names it — the same rule as every
|
|
15
|
+
* delivery failure: telemetry that fails invisibly is indistinguishable from
|
|
16
|
+
* telemetry that works. A deadline cannot tell a slow delivery from a stuck
|
|
17
|
+
* one, so the report says both.
|
|
18
|
+
*/
|
|
19
|
+
import type { BaseStrategy, StrategyHandle } from './types.js';
|
|
20
|
+
/** How long `shutdown()` waits for each handle's flush unless told otherwise:
|
|
21
|
+
* 30 s, the same number footprintjs's `drainObservers` uses as its default. */
|
|
22
|
+
export declare const DEFAULT_SHUTDOWN_TIMEOUT_MS = 30000;
|
|
23
|
+
/** Remember the strategy behind a handle. Called once, where the handle is
|
|
24
|
+
* built (`strategies/attach.ts · makeStrategyHandle`). */
|
|
25
|
+
export declare function rememberStrategyOf(handle: object, strategy: BaseStrategy): void;
|
|
26
|
+
/** The deadline a `shutdown({ timeoutMs })` asked for. Throws a `TypeError`
|
|
27
|
+
* when it is not a positive number of milliseconds — called from the async
|
|
28
|
+
* `shutdown()`, so its caller sees a REJECTED promise, never a sync throw.
|
|
29
|
+
*
|
|
30
|
+
* The refusal names the field and the shape it takes, NEVER the value: a
|
|
31
|
+
* value of the wrong type can be anything a caller had at hand, and an error
|
|
32
|
+
* message is copied into logs, reports and traces. */
|
|
33
|
+
export declare function shutdownTimeoutOf(timeoutMs: number | undefined): number;
|
|
34
|
+
/**
|
|
35
|
+
* Flush one handle, but wait no longer than `timeoutMs`. On a missed deadline
|
|
36
|
+
* the strategy is reported by name and this resolves `'stuck'`; its flush
|
|
37
|
+
* keeps running — it is not, and cannot be, cancelled.
|
|
38
|
+
*
|
|
39
|
+
* The deadline is armed by `lib/longTimeout.ts · setLongTimeout`: `Infinity`
|
|
40
|
+
* arms no timer at all, and a finite deadline of ANY length fires when asked —
|
|
41
|
+
* past the ~24.8 days one host timer holds, it is waited in chained chunks,
|
|
42
|
+
* never dropped and never fired after 1 ms. Whatever is armed is cleared as
|
|
43
|
+
* soon as the flush settles, so a healthy shutdown leaves no timer behind.
|
|
44
|
+
* It is NOT unref'd: it is bounded, and it is what lets the code after
|
|
45
|
+
* `await agent.shutdown()` run when the stuck write holds nothing else open.
|
|
46
|
+
*/
|
|
47
|
+
export declare function flushWithinDeadline(handle: StrategyHandle, timeoutMs: number): Promise<'flushed' | 'stuck'>;
|
|
48
|
+
//# sourceMappingURL=flushDeadline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flushDeadline.d.ts","sourceRoot":"","sources":["../../../src/strategies/flushDeadline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE/D;gFACgF;AAChF,eAAO,MAAM,2BAA2B,QAAS,CAAC;AAMlD;2DAC2D;AAC3D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,IAAI,CAE/E;AAED;;;;;;uDAMuD;AACvD,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAQvE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,cAAc,EACtB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,CAa9B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentfootprint",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.2.0",
|
|
4
4
|
"description": "The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -395,7 +395,7 @@
|
|
|
395
395
|
"@modelcontextprotocol/sdk": "*",
|
|
396
396
|
"@opentelemetry/api": "*",
|
|
397
397
|
"@yarflam/potion-base-8m": "*",
|
|
398
|
-
"footprintjs": "^
|
|
398
|
+
"footprintjs": "^10.6.0",
|
|
399
399
|
"google-auth-library": "*",
|
|
400
400
|
"ioredis": "*",
|
|
401
401
|
"jose": "*",
|