agentfootprint 9.30.0 → 9.32.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/AGENTS.md +1 -1
- package/CLAUDE.md +6 -2
- package/ai-instructions/claude-code/SKILL.md +1 -1
- package/dist/adapters/identity/jwks.js +18 -0
- package/dist/adapters/identity/jwks.js.map +1 -1
- package/dist/adapters/llm/BrowserOpenAIProvider.js +5 -3
- package/dist/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
- package/dist/adapters/llm/OpenAIProvider.js +74 -2
- package/dist/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/adapters/llm/azureUrl.js +48 -0
- package/dist/adapters/llm/azureUrl.js.map +1 -0
- package/dist/adapters/llm/createProvider.js +25 -6
- package/dist/adapters/llm/createProvider.js.map +1 -1
- package/dist/adapters/types.js.map +1 -1
- package/dist/artifacts/gcsArtifacts.js +20 -0
- package/dist/artifacts/gcsArtifacts.js.map +1 -1
- package/dist/esm/adapters/identity/jwks.d.ts +18 -0
- package/dist/esm/adapters/identity/jwks.js +18 -0
- package/dist/esm/adapters/identity/jwks.js.map +1 -1
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.js +5 -3
- package/dist/esm/adapters/llm/BrowserOpenAIProvider.js.map +1 -1
- package/dist/esm/adapters/llm/OpenAIProvider.d.ts +15 -2
- package/dist/esm/adapters/llm/OpenAIProvider.js +74 -2
- package/dist/esm/adapters/llm/OpenAIProvider.js.map +1 -1
- package/dist/esm/adapters/llm/azureUrl.d.ts +36 -0
- package/dist/esm/adapters/llm/azureUrl.js +43 -0
- package/dist/esm/adapters/llm/azureUrl.js.map +1 -0
- package/dist/esm/adapters/llm/createProvider.d.ts +5 -1
- package/dist/esm/adapters/llm/createProvider.js +25 -6
- package/dist/esm/adapters/llm/createProvider.js.map +1 -1
- package/dist/esm/adapters/types.d.ts +30 -2
- package/dist/esm/adapters/types.js.map +1 -1
- package/dist/esm/artifacts/gcsArtifacts.d.ts +20 -0
- package/dist/esm/artifacts/gcsArtifacts.js +20 -0
- package/dist/esm/artifacts/gcsArtifacts.js.map +1 -1
- package/dist/esm/events/payloads.d.ts +36 -0
- package/dist/esm/events/registry.d.ts +3 -1
- package/dist/esm/events/registry.js +2 -0
- package/dist/esm/events/registry.js.map +1 -1
- package/dist/esm/hosting/admission.d.ts +25 -0
- package/dist/esm/hosting/admission.js +25 -0
- package/dist/esm/hosting/admission.js.map +1 -1
- package/dist/esm/hosting/envelope.d.ts +10 -0
- package/dist/esm/hosting/envelope.js +10 -0
- package/dist/esm/hosting/envelope.js.map +1 -1
- package/dist/esm/hosting/index.d.ts +1 -0
- package/dist/esm/hosting/index.js.map +1 -1
- package/dist/esm/hosting/ingressRecord.d.ts +177 -0
- package/dist/esm/hosting/ingressRecord.js +246 -0
- package/dist/esm/hosting/ingressRecord.js.map +1 -0
- package/dist/esm/hosting/standingAgent.js +50 -1
- package/dist/esm/hosting/standingAgent.js.map +1 -1
- package/dist/esm/hosting/types.d.ts +31 -0
- package/dist/esm/hosting/types.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillExamples.d.ts +168 -0
- package/dist/esm/lib/injection-engine/skillExamples.js +435 -0
- package/dist/esm/lib/injection-engine/skillExamples.js.map +1 -0
- package/dist/esm/lib/injection-engine/skillGraph.d.ts +63 -0
- package/dist/esm/lib/injection-engine/skillGraph.js +40 -2
- package/dist/esm/lib/injection-engine/skillGraph.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillGraphCheckup.d.ts +25 -2
- package/dist/esm/lib/injection-engine/skillGraphCheckup.js +11 -2
- package/dist/esm/lib/injection-engine/skillGraphCheckup.js.map +1 -1
- package/dist/esm/lib/injection-engine/skillMatch.d.ts +7 -0
- package/dist/esm/lib/injection-engine/skillMatch.js +9 -4
- package/dist/esm/lib/injection-engine/skillMatch.js.map +1 -1
- package/dist/esm/lib/mcp/gatewayTransport.d.ts +52 -0
- package/dist/esm/lib/mcp/gatewayTransport.js +1 -0
- package/dist/esm/lib/mcp/gatewayTransport.js.map +1 -1
- package/dist/esm/lib/mcp/mcpClient.js +8 -1
- package/dist/esm/lib/mcp/mcpClient.js.map +1 -1
- package/dist/esm/lib/mcp/types.d.ts +10 -0
- package/dist/esm/observe.js +2 -1
- package/dist/esm/observe.js.map +1 -1
- package/dist/esm/recorders/core/ResilienceRecorder.d.ts +8 -7
- package/dist/esm/recorders/core/ResilienceRecorder.js +9 -7
- package/dist/esm/recorders/core/ResilienceRecorder.js.map +1 -1
- package/dist/esm/recorders/core/resilienceHooks.d.ts +1 -0
- package/dist/esm/recorders/core/resilienceHooks.js +13 -0
- package/dist/esm/recorders/core/resilienceHooks.js.map +1 -1
- package/dist/esm/resilience/withCircuitBreaker.d.ts +27 -7
- package/dist/esm/resilience/withCircuitBreaker.js +53 -19
- package/dist/esm/resilience/withCircuitBreaker.js.map +1 -1
- package/dist/esm/resilience/withFallback.d.ts +11 -0
- package/dist/esm/resilience/withFallback.js +11 -0
- package/dist/esm/resilience/withFallback.js.map +1 -1
- package/dist/esm/resilience/withRetry.d.ts +12 -0
- package/dist/esm/resilience/withRetry.js +12 -0
- package/dist/esm/resilience/withRetry.js.map +1 -1
- package/dist/esm/security/PermissionPolicy.d.ts +22 -0
- package/dist/esm/security/PermissionPolicy.js +22 -0
- package/dist/esm/security/PermissionPolicy.js.map +1 -1
- package/dist/events/registry.js +2 -0
- package/dist/events/registry.js.map +1 -1
- package/dist/hosting/admission.js +25 -0
- package/dist/hosting/admission.js.map +1 -1
- package/dist/hosting/envelope.js +10 -0
- package/dist/hosting/envelope.js.map +1 -1
- package/dist/hosting/index.js.map +1 -1
- package/dist/hosting/ingressRecord.js +250 -0
- package/dist/hosting/ingressRecord.js.map +1 -0
- package/dist/hosting/standingAgent.js +50 -1
- package/dist/hosting/standingAgent.js.map +1 -1
- package/dist/hosting/types.js.map +1 -1
- package/dist/lib/injection-engine/skillExamples.js +440 -0
- package/dist/lib/injection-engine/skillExamples.js.map +1 -0
- package/dist/lib/injection-engine/skillGraph.js +40 -2
- package/dist/lib/injection-engine/skillGraph.js.map +1 -1
- package/dist/lib/injection-engine/skillGraphCheckup.js +11 -2
- package/dist/lib/injection-engine/skillGraphCheckup.js.map +1 -1
- package/dist/lib/injection-engine/skillMatch.js +11 -5
- package/dist/lib/injection-engine/skillMatch.js.map +1 -1
- package/dist/lib/mcp/gatewayTransport.js +1 -0
- package/dist/lib/mcp/gatewayTransport.js.map +1 -1
- package/dist/lib/mcp/mcpClient.js +8 -1
- package/dist/lib/mcp/mcpClient.js.map +1 -1
- package/dist/observe.js +2 -1
- package/dist/observe.js.map +1 -1
- package/dist/recorders/core/ResilienceRecorder.js +9 -7
- package/dist/recorders/core/ResilienceRecorder.js.map +1 -1
- package/dist/recorders/core/resilienceHooks.js +13 -0
- package/dist/recorders/core/resilienceHooks.js.map +1 -1
- package/dist/resilience/withCircuitBreaker.js +53 -19
- package/dist/resilience/withCircuitBreaker.js.map +1 -1
- package/dist/resilience/withFallback.js +11 -0
- package/dist/resilience/withFallback.js.map +1 -1
- package/dist/resilience/withRetry.js +12 -0
- package/dist/resilience/withRetry.js.map +1 -1
- package/dist/security/PermissionPolicy.js +22 -0
- package/dist/security/PermissionPolicy.js.map +1 -1
- package/dist/types/adapters/identity/jwks.d.ts +18 -0
- package/dist/types/adapters/identity/jwks.d.ts.map +1 -1
- package/dist/types/adapters/llm/BrowserOpenAIProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/OpenAIProvider.d.ts +15 -2
- package/dist/types/adapters/llm/OpenAIProvider.d.ts.map +1 -1
- package/dist/types/adapters/llm/azureUrl.d.ts +37 -0
- package/dist/types/adapters/llm/azureUrl.d.ts.map +1 -0
- package/dist/types/adapters/llm/createProvider.d.ts +5 -1
- package/dist/types/adapters/llm/createProvider.d.ts.map +1 -1
- package/dist/types/adapters/types.d.ts +30 -2
- package/dist/types/adapters/types.d.ts.map +1 -1
- package/dist/types/artifacts/gcsArtifacts.d.ts +20 -0
- package/dist/types/artifacts/gcsArtifacts.d.ts.map +1 -1
- package/dist/types/events/payloads.d.ts +36 -0
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/events/registry.d.ts +3 -1
- package/dist/types/events/registry.d.ts.map +1 -1
- package/dist/types/hosting/admission.d.ts +25 -0
- package/dist/types/hosting/admission.d.ts.map +1 -1
- package/dist/types/hosting/envelope.d.ts +10 -0
- package/dist/types/hosting/envelope.d.ts.map +1 -1
- package/dist/types/hosting/index.d.ts +1 -0
- package/dist/types/hosting/index.d.ts.map +1 -1
- package/dist/types/hosting/ingressRecord.d.ts +178 -0
- package/dist/types/hosting/ingressRecord.d.ts.map +1 -0
- package/dist/types/hosting/standingAgent.d.ts.map +1 -1
- package/dist/types/hosting/types.d.ts +31 -0
- package/dist/types/hosting/types.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillExamples.d.ts +169 -0
- package/dist/types/lib/injection-engine/skillExamples.d.ts.map +1 -0
- package/dist/types/lib/injection-engine/skillGraph.d.ts +63 -0
- package/dist/types/lib/injection-engine/skillGraph.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillGraphCheckup.d.ts +25 -2
- package/dist/types/lib/injection-engine/skillGraphCheckup.d.ts.map +1 -1
- package/dist/types/lib/injection-engine/skillMatch.d.ts +7 -0
- package/dist/types/lib/injection-engine/skillMatch.d.ts.map +1 -1
- package/dist/types/lib/mcp/gatewayTransport.d.ts +52 -0
- package/dist/types/lib/mcp/gatewayTransport.d.ts.map +1 -1
- package/dist/types/lib/mcp/types.d.ts +10 -0
- package/dist/types/lib/mcp/types.d.ts.map +1 -1
- package/dist/types/observe.d.ts.map +1 -1
- package/dist/types/recorders/core/ResilienceRecorder.d.ts +8 -7
- package/dist/types/recorders/core/ResilienceRecorder.d.ts.map +1 -1
- package/dist/types/recorders/core/resilienceHooks.d.ts +1 -0
- package/dist/types/recorders/core/resilienceHooks.d.ts.map +1 -1
- package/dist/types/resilience/withCircuitBreaker.d.ts +27 -7
- package/dist/types/resilience/withCircuitBreaker.d.ts.map +1 -1
- package/dist/types/resilience/withFallback.d.ts +11 -0
- package/dist/types/resilience/withFallback.d.ts.map +1 -1
- package/dist/types/resilience/withRetry.d.ts +12 -0
- package/dist/types/resilience/withRetry.d.ts.map +1 -1
- package/dist/types/security/PermissionPolicy.d.ts +22 -0
- package/dist/types/security/PermissionPolicy.d.ts.map +1 -1
- package/package.json +2 -1
|
@@ -56,6 +56,58 @@ export interface GatewayTransportOptions {
|
|
|
56
56
|
* life of the transport, which is what the vended ones exist to avoid.
|
|
57
57
|
*/
|
|
58
58
|
readonly headers?: Readonly<Record<string, string>>;
|
|
59
|
+
/**
|
|
60
|
+
* Your own `fetch`, called UNDERNEATH the per-request vending (9.32.0).
|
|
61
|
+
*
|
|
62
|
+
* ── The gap this closes ──────────────────────────────────────────────────
|
|
63
|
+
* Some gateways do not authenticate with a bearer alone. A managed identity
|
|
64
|
+
* path may want a client certificate (mTLS) or a proof-of-possession
|
|
65
|
+
* signature over the request itself (DPoP) — things computed FROM the
|
|
66
|
+
* request, which no header fixed at construction can express. Until this
|
|
67
|
+
* existed the only workaround was to abandon this transport for the generic
|
|
68
|
+
* `http` one, which has a `fetch` seam and fixes its headers at connect
|
|
69
|
+
* time — so a caller traded away token rotation to get a client certificate.
|
|
70
|
+
* That is a bad trade, and it was the shape an independent field trial
|
|
71
|
+
* reported (2026-08-13): *"exposes bearer-credential, header and scope
|
|
72
|
+
* options, but no certificate, DPoP or custom-fetch seam."*
|
|
73
|
+
*
|
|
74
|
+
* ── The composition, and its order ───────────────────────────────────────
|
|
75
|
+
* The credential is vended FIRST and applied to the request; your function is
|
|
76
|
+
* then called with that request. So a signer sees the final headers and has
|
|
77
|
+
* the last word over the bytes, exactly as it does on the `http` transport —
|
|
78
|
+
* and the vending still happens on every request, so rotation is not lost.
|
|
79
|
+
*
|
|
80
|
+
* **Zero vendor code lives here.** This library ships no signer, no
|
|
81
|
+
* certificate loader and no DPoP implementation; a scheme this repo has never
|
|
82
|
+
* heard of works on the day you write it. Whatever you do inside is between
|
|
83
|
+
* you and the server.
|
|
84
|
+
*
|
|
85
|
+
* ── What the secrecy invariant still guarantees ──────────────────────────
|
|
86
|
+
* Your function sees the request it is asked to send, headers included —
|
|
87
|
+
* which is what makes signing possible and is the whole point of the seam.
|
|
88
|
+
* What is still true is everything this module controls: the vended value is
|
|
89
|
+
* never cached, never stored on the transport, and never enters an event, an
|
|
90
|
+
* error or a log. A `fetch` you inject that logs its own headers is
|
|
91
|
+
* publishing your credential, and that is your decision to make in your code
|
|
92
|
+
* rather than something this library can do behind you.
|
|
93
|
+
*
|
|
94
|
+
* @example mTLS, through an agent you own
|
|
95
|
+
* gatewayTransport({
|
|
96
|
+
* url, credentials, service: 'gateway',
|
|
97
|
+
* fetch: (input, init) => fetch(input, { ...init, dispatcher: mtlsAgent }),
|
|
98
|
+
* })
|
|
99
|
+
*
|
|
100
|
+
* @example Proof-of-possession over the request
|
|
101
|
+
* gatewayTransport({
|
|
102
|
+
* url, credentials,
|
|
103
|
+
* fetch: async (input, init) => {
|
|
104
|
+
* const headers = new Headers(init?.headers);
|
|
105
|
+
* headers.set('dpop', await sign(init?.method ?? 'POST', String(input)));
|
|
106
|
+
* return fetch(input, { ...init, headers });
|
|
107
|
+
* },
|
|
108
|
+
* })
|
|
109
|
+
*/
|
|
110
|
+
readonly fetch?: FetchLike;
|
|
59
111
|
}
|
|
60
112
|
/**
|
|
61
113
|
* Describe an MCP connection whose auth headers are vended per request.
|
|
@@ -65,6 +65,7 @@ export function gatewayTransport(options) {
|
|
|
65
65
|
...(options.scopes !== undefined && { scopes: options.scopes }),
|
|
66
66
|
...(options.mode !== undefined && { mode: options.mode }),
|
|
67
67
|
...(options.headers !== undefined && { headers: options.headers }),
|
|
68
|
+
...(options.fetch !== undefined && { fetch: options.fetch }),
|
|
68
69
|
};
|
|
69
70
|
}
|
|
70
71
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gatewayTransport.js","sourceRoot":"","sources":["../../../../src/lib/mcp/gatewayTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,kBAAkB,EAA2B,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"gatewayTransport.js","sourceRoot":"","sources":["../../../../src/lib/mcp/gatewayTransport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAAE,kBAAkB,EAA2B,MAAM,yBAAyB,CAAC;AA8EtF,MAAM,eAAe,GAAG,SAAS,CAAC;AAElC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgC;IAC/D,IAAI,CAAC,OAAO,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACtE,IAAI,CAAC,OAAO,CAAC,WAAW;QAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IACtF,OAAO;QACL,SAAS,EAAE,SAAS;QACpB,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,eAAe;QAC3C,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;QAC/D,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;QACzD,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;QAClE,GAAG,CAAC,OAAO,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;KAC7D,CAAC;A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CAAC,OAAO,IAAI,EAAE,CAAC;YAAE,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC5F,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC;YACzE,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC1B,CAAC;QAED,yEAAyE;QACzE,kEAAkE;QAClE,OAAO,SAAS,CAAC,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IAChD,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -152,8 +152,15 @@ async function buildTransport(t, retryOnThrottle) {
|
|
|
152
152
|
// transport with no custom fetch still passes none and behaves exactly as it
|
|
153
153
|
// did before 8.11.0.
|
|
154
154
|
if (t.transport === 'gateway') {
|
|
155
|
+
// The consumer's own `fetch` (9.32.0) goes UNDERNEATH the vending, not
|
|
156
|
+
// beside it: `createVendingFetch` resolves the credential, applies it to
|
|
157
|
+
// this one request, and then calls the base fetch — so an mTLS agent or a
|
|
158
|
+
// DPoP signer sees the final headers and has the last word, while the
|
|
159
|
+
// credential is still vended per request. Passing `undefined` is the
|
|
160
|
+
// default global `fetch`, which is byte-identical to every release before
|
|
161
|
+
// the seam existed.
|
|
155
162
|
return new httpMod.StreamableHTTPClientTransport(new URL(t.url), {
|
|
156
|
-
fetch: retryingFetch(createVendingFetch(t), retryOnThrottle),
|
|
163
|
+
fetch: retryingFetch(createVendingFetch(t, t.fetch), retryOnThrottle),
|
|
157
164
|
});
|
|
158
165
|
}
|
|
159
166
|
// Both options ride the SAME SDK transport, and both are forwarded when both
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpClient.js","sourceRoot":"","sources":["../../../../src/lib/mcp/mcpClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;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}
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
import type { Tool } from '../../core/tools.js';
|
|
24
24
|
import type { CredentialProvider } from '../../identity/types.js';
|
|
25
25
|
import type { RetryOnThrottle } from './throttleRetry.js';
|
|
26
|
+
import type { FetchLike } from './gatewayTransport.js';
|
|
26
27
|
/**
|
|
27
28
|
* `stdio` transport — spawns a local subprocess and speaks MCP over
|
|
28
29
|
* its stdin/stdout. Best for development, single-user scenarios, and
|
|
@@ -134,6 +135,15 @@ export interface McpGatewayTransport {
|
|
|
134
135
|
* the property the vended ones exist to avoid.
|
|
135
136
|
*/
|
|
136
137
|
readonly headers?: Readonly<Record<string, string>>;
|
|
138
|
+
/**
|
|
139
|
+
* A `fetch` of your own, called UNDERNEATH the per-request vending (9.32.0)
|
|
140
|
+
* — the seam an mTLS agent or a DPoP signer goes into, so a caller no longer
|
|
141
|
+
* has to abandon this transport (and its token rotation) to get one. The
|
|
142
|
+
* credential is vended and applied FIRST, so your function sees the final
|
|
143
|
+
* headers and has the last word over the bytes. Zero vendor code lives here.
|
|
144
|
+
* See {@link GatewayTransportOptions.fetch} for the full contract.
|
|
145
|
+
*/
|
|
146
|
+
readonly fetch?: FetchLike;
|
|
137
147
|
}
|
|
138
148
|
export type McpTransport = McpStdioTransport | McpHttpTransport | McpGatewayTransport;
|
|
139
149
|
export interface McpClientOptions {
|
package/dist/esm/observe.js
CHANGED
|
@@ -75,7 +75,8 @@ export { embeddingRecorder, } from './recorders/core/EmbeddingRecorder.js';
|
|
|
75
75
|
export { permissionRecorder, } from './recorders/core/PermissionRecorder.js';
|
|
76
76
|
export { skillRecorder } from './recorders/core/SkillRecorder.js';
|
|
77
77
|
// Provider-decorator telemetry (fallback.triggered / error.retried /
|
|
78
|
-
// error.recovered). Attached automatically by
|
|
78
|
+
// error.recovered / error.circuit_changed). Attached automatically by
|
|
79
|
+
// Agent / LLMCall / Parallel;
|
|
79
80
|
// exported so consumers running the public message-api charts on a bare
|
|
80
81
|
// FlowChartExecutor can wire the bridge themselves.
|
|
81
82
|
export { resilienceRecorder, } from './recorders/core/ResilienceRecorder.js';
|
package/dist/esm/observe.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observe.js","sourceRoot":"","sources":["../../src/observe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,4BAA4B;AAC5B,OAAO,EAAE,eAAe,EAA+B,MAAM,qCAAqC,CAAC;AACnG,OAAO,EAAE,cAAc,EAA8B,MAAM,oCAAoC,CAAC;AAEhG,+BAA+B;AAC/B,OAAO,EACL,mBAAmB,GAEpB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,aAAa,EAA6B,MAAM,mCAAmC,CAAC;AAC7F,OAAO,EACL,gBAAgB,EAChB,gBAAgB,GAkBjB,MAAM,+CAA+C,CAAC;AACvD,OAAO,EACL,aAAa,EACb,eAAe,EACf,eAAe,GAQhB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACL,eAAe,EACf,cAAc,EACd,wBAAwB,GAQzB,MAAM,gDAAgD,CAAC;AAExD,yEAAyE;AACzE,6EAA6E;AAC7E,6EAA6E;AAC7E,8EAA8E;AAC9E,OAAO,EACL,SAAS,GAIV,MAAM,wCAAwC,CAAC;AAEhD,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,8EAA8E;AAC9E,4DAA4D;AAC5D,OAAO,EACL,iBAAiB,EACjB,eAAe,GAiBhB,MAAM,2BAA2B,CAAC;AAEnC,gFAAgF;AAChF,6EAA6E;AAC7E,4EAA4E;AAC5E,iCAAiC;AACjC,OAAO,EACL,mBAAmB,EACnB,eAAe,GAEhB,MAAM,+CAA+C,CAAC;AAEvD,8EAA8E;AAC9E,gFAAgF;AAChF,iEAAiE;AACjE,OAAO,EACL,cAAc,EACd,aAAa,EACb,gBAAgB,GAKjB,MAAM,oCAAoC,CAAC;AAE5C,mEAAmE;AACnE,4EAA4E;AA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,wCAAwC,CAAC;AAChD,OAAO,EACL,aAAa,EACb,cAAc,GAIf,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACL,YAAY,GAGb,MAAM,6CAA6C,CAAC;AACrD,4EAA4E;AAC5E,gFAAgF;AAChF,OAAO,EACL,mBAAmB,GAMpB,MAAM,kDAAkD,CAAC;AAC1D,gFAAgF;AAChF,gFAAgF;AAChF,OAAO,EACL,kBAAkB,GAQnB,MAAM,yDAAyD,CAAC;AAEjE,uDAAuD;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE1D,kEAAkE;AAClE,uEAAuE;AACvE,0EAA0E;AAC1E,4EAA4E;AAC5E,6EAA6E;AAC7E,yDAAyD;AACzD,cAAc,YAAY,CAAC;AAC3B,sEAAsE;AACtE,uEAAuE;AACvE,qEAAqE;AACrE,oEAAoE;AACpE,OAAO,EACL,kBAAkB,EAClB,kBAAkB,GAOnB,MAAM,iDAAiD,CAAC;AAEzD,OAAO,EACL,aAAa,EACb,cAAc,GAOf,MAAM,4CAA4C,CAAC;AAEpD,sEAAsE;AACtE,4EAA4E;AAC5E,+CAA+C;AAC/C,OAAO,EACL,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,WAAW,GACZ,MAAM,+BAA+B,CAAC"}
|
|
@@ -3,16 +3,17 @@
|
|
|
3
3
|
* to the dispatcher.
|
|
4
4
|
*
|
|
5
5
|
* Pattern: Factory (GoF) returning an EmitBridge instance.
|
|
6
|
-
* Role: Bridges the
|
|
7
|
-
* (`fallback.triggered` / `error.retried` / `error.recovered
|
|
8
|
-
* emitted in-run by `resilienceHooks`
|
|
9
|
-
* EventDispatcher so typed consumer
|
|
10
|
-
* (`agent.on('agentfootprint.error.retried', …)`)
|
|
11
|
-
* this bridge those emits hit the footprintjs emit
|
|
12
|
-
* never reach the dispatcher.
|
|
6
|
+
* Role: Bridges the four events the resilience decorators source
|
|
7
|
+
* (`fallback.triggered` / `error.retried` / `error.recovered` /
|
|
8
|
+
* `error.circuit_changed`, emitted in-run by `resilienceHooks`
|
|
9
|
+
* via `typedEmit`) to the EventDispatcher so typed consumer
|
|
10
|
+
* listeners (`agent.on('agentfootprint.error.retried', …)`)
|
|
11
|
+
* fire. Without this bridge those emits hit the footprintjs emit
|
|
12
|
+
* channel but never reach the dispatcher.
|
|
13
13
|
* Emits: agentfootprint.fallback.triggered
|
|
14
14
|
* agentfootprint.error.retried
|
|
15
15
|
* agentfootprint.error.recovered
|
|
16
|
+
* agentfootprint.error.circuit_changed (9.32.0)
|
|
16
17
|
*
|
|
17
18
|
* Matched on EXACT full event names rather than the broader
|
|
18
19
|
* `agentfootprint.error.` prefix. `error.fatal` is dispatched directly by
|
|
@@ -3,16 +3,17 @@
|
|
|
3
3
|
* to the dispatcher.
|
|
4
4
|
*
|
|
5
5
|
* Pattern: Factory (GoF) returning an EmitBridge instance.
|
|
6
|
-
* Role: Bridges the
|
|
7
|
-
* (`fallback.triggered` / `error.retried` / `error.recovered
|
|
8
|
-
* emitted in-run by `resilienceHooks`
|
|
9
|
-
* EventDispatcher so typed consumer
|
|
10
|
-
* (`agent.on('agentfootprint.error.retried', …)`)
|
|
11
|
-
* this bridge those emits hit the footprintjs emit
|
|
12
|
-
* never reach the dispatcher.
|
|
6
|
+
* Role: Bridges the four events the resilience decorators source
|
|
7
|
+
* (`fallback.triggered` / `error.retried` / `error.recovered` /
|
|
8
|
+
* `error.circuit_changed`, emitted in-run by `resilienceHooks`
|
|
9
|
+
* via `typedEmit`) to the EventDispatcher so typed consumer
|
|
10
|
+
* listeners (`agent.on('agentfootprint.error.retried', …)`)
|
|
11
|
+
* fire. Without this bridge those emits hit the footprintjs emit
|
|
12
|
+
* channel but never reach the dispatcher.
|
|
13
13
|
* Emits: agentfootprint.fallback.triggered
|
|
14
14
|
* agentfootprint.error.retried
|
|
15
15
|
* agentfootprint.error.recovered
|
|
16
|
+
* agentfootprint.error.circuit_changed (9.32.0)
|
|
16
17
|
*
|
|
17
18
|
* Matched on EXACT full event names rather than the broader
|
|
18
19
|
* `agentfootprint.error.` prefix. `error.fatal` is dispatched directly by
|
|
@@ -33,6 +34,7 @@ export function resilienceRecorder(options) {
|
|
|
33
34
|
'agentfootprint.fallback.triggered',
|
|
34
35
|
'agentfootprint.error.retried',
|
|
35
36
|
'agentfootprint.error.recovered',
|
|
37
|
+
'agentfootprint.error.circuit_changed',
|
|
36
38
|
],
|
|
37
39
|
dispatcher: options.dispatcher,
|
|
38
40
|
getRunContext: options.getRunContext,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResilienceRecorder.js","sourceRoot":"","sources":["../../../../src/recorders/core/ResilienceRecorder.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ResilienceRecorder.js","sourceRoot":"","sources":["../../../../src/recorders/core/ResilienceRecorder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,UAAU,EAA0B,MAAM,iBAAiB,CAAC;AAMrE,MAAM,UAAU,kBAAkB,CAAC,OAAkC;IACnE,OAAO,IAAI,UAAU,CAAC;QACpB,EAAE,EAAE,OAAO,CAAC,EAAE,IAAI,oCAAoC;QACtD,MAAM,EAAE;YACN,mCAAmC;YACnC,8BAA8B;YAC9B,gCAAgC;YAChC,sCAAsC;SACvC;QACD,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,aAAa,EAAE,OAAO,CAAC,aAAa;KACrC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* Emits: agentfootprint.fallback.triggered
|
|
12
12
|
* agentfootprint.error.retried
|
|
13
13
|
* agentfootprint.error.recovered
|
|
14
|
+
* agentfootprint.error.circuit_changed (9.32.0)
|
|
14
15
|
*
|
|
15
16
|
* Why here and not in the decorators: a decorator is constructed by the
|
|
16
17
|
* consumer BEFORE any run exists, so it can never reach a scope. Passing
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* Emits: agentfootprint.fallback.triggered
|
|
12
12
|
* agentfootprint.error.retried
|
|
13
13
|
* agentfootprint.error.recovered
|
|
14
|
+
* agentfootprint.error.circuit_changed (9.32.0)
|
|
14
15
|
*
|
|
15
16
|
* Why here and not in the decorators: a decorator is constructed by the
|
|
16
17
|
* consumer BEFORE any run exists, so it can never reach a scope. Passing
|
|
@@ -63,6 +64,18 @@ export function resilienceHooks(scope) {
|
|
|
63
64
|
totalDurationMs: report.totalDurationMs,
|
|
64
65
|
});
|
|
65
66
|
return;
|
|
67
|
+
case 'circuit-changed':
|
|
68
|
+
// 9.32.0 — the transition happened INSIDE this call, so the ids
|
|
69
|
+
// footprintjs stamped before the stage ran are the right ones and
|
|
70
|
+
// nothing here is synthesized. That is the whole reason the report
|
|
71
|
+
// rides the per-call hooks rather than the breaker's own
|
|
72
|
+
// `onStateChange`, which fires wherever the breaker lives.
|
|
73
|
+
typedEmit(scope, 'agentfootprint.error.circuit_changed', {
|
|
74
|
+
state: report.state,
|
|
75
|
+
reason: report.reason,
|
|
76
|
+
providerName: report.providerName,
|
|
77
|
+
});
|
|
78
|
+
return;
|
|
66
79
|
}
|
|
67
80
|
}
|
|
68
81
|
catch {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resilienceHooks.js","sourceRoot":"","sources":["../../../../src/recorders/core/resilienceHooks.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"resilienceHooks.js","sourceRoot":"","sources":["../../../../src/recorders/core/resilienceHooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EAAE,SAAS,EAAsB,MAAM,gBAAgB,CAAC;AAE/D;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,KAAoB;IAClD,OAAO;QACL,YAAY,CAAC,MAAM;YACjB,+DAA+D;YAC/D,gEAAgE;YAChE,kEAAkE;YAClE,+DAA+D;YAC/D,wDAAwD;YACxD,IAAI,CAAC;gBACH,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;oBACpB,KAAK,WAAW;wBACd,SAAS,CAAC,KAAK,EAAE,mCAAmC,EAAE;4BACpD,IAAI,EAAE,UAAU;4BAChB,OAAO,EAAE,MAAM,CAAC,OAAO;4BACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ;4BACzB,MAAM,EAAE,MAAM,CAAC,MAAM;yBACtB,CAAC,CAAC;wBACH,OAAO;oBACT,KAAK,SAAS;wBACZ,SAAS,CAAC,KAAK,EAAE,8BAA8B,EAAE;4BAC/C,OAAO,EAAE,MAAM,CAAC,OAAO;4BACvB,WAAW,EAAE,MAAM,CAAC,WAAW;4BAC/B,SAAS,EAAE,MAAM,CAAC,SAAS;4BAC3B,SAAS,EAAE,MAAM,CAAC,SAAS;4BAC3B,MAAM,EAAE,MAAM,CAAC,MAAM;yBACtB,CAAC,CAAC;wBACH,OAAO;oBACT,KAAK,WAAW;wBACd,SAAS,CAAC,KAAK,EAAE,gCAAgC,EAAE;4BACjD,OAAO,EAAE,MAAM,CAAC,OAAO;4BACvB,eAAe,EAAE,MAAM,CAAC,eAAe;yBACxC,CAAC,CAAC;wBACH,OAAO;oBACT,KAAK,iBAAiB;wBACpB,gEAAgE;wBAChE,kEAAkE;wBAClE,mEAAmE;wBACnE,yDAAyD;wBACzD,2DAA2D;wBAC3D,SAAS,CAAC,KAAK,EAAE,sCAAsC,EAAE;4BACvD,KAAK,EAAE,MAAM,CAAC,KAAK;4BACnB,MAAM,EAAE,MAAM,CAAC,MAAM;4BACrB,YAAY,EAAE,MAAM,CAAC,YAAY;yBAClC,CAAC,CAAC;wBACH,OAAO;gBACX,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,+CAA+C;YACjD,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -80,6 +80,21 @@
|
|
|
80
80
|
* predicate (the visible-tool list is recomputed every iteration).
|
|
81
81
|
* First-class per-tool breakers (state keyed by tool name; run-scoped
|
|
82
82
|
* vs process-scoped TBD) are a possible future enhancement.
|
|
83
|
+
*
|
|
84
|
+
* **Status: contract-shaped and tested — independently reproduced against a
|
|
85
|
+
* local harness, 2026-08-13.** Somebody who is not this library's author drove
|
|
86
|
+
* this breaker through its whole walk: it opened after two failures, served the
|
|
87
|
+
* next request from a fallback WITHOUT calling the primary, half-opened after
|
|
88
|
+
* cooldown, and closed after two successful probes. The one gap that run named
|
|
89
|
+
* — *"breaker transitions have no typed AgentFootprint event"* — is what 9.32.0
|
|
90
|
+
* closes with the `'circuit-changed'` report below, and the per-process scope
|
|
91
|
+
* stated further down was restated there and is unchanged.
|
|
92
|
+
*
|
|
93
|
+
* The failures were SCRIPTED and the cooldown was a test clock: those tests
|
|
94
|
+
* *"were local and deterministic, so they consumed no GCP credit"*. **No live
|
|
95
|
+
* provider has tripped this breaker from this repository**, so this is not the
|
|
96
|
+
* field-validated rung — a real degradation, with a real vendor's error mix and
|
|
97
|
+
* a real recovery time, remains unexercised.
|
|
83
98
|
*/
|
|
84
99
|
import type { LLMProvider } from '../adapters/types.js';
|
|
85
100
|
export interface WithCircuitBreakerOptions {
|
|
@@ -97,13 +112,18 @@ export interface WithCircuitBreakerOptions {
|
|
|
97
112
|
*/
|
|
98
113
|
readonly shouldCount?: (error: unknown) => boolean;
|
|
99
114
|
/**
|
|
100
|
-
* Hook invoked on every state transition
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
115
|
+
* Hook invoked on every state transition — your own callback, fired
|
|
116
|
+
* whether or not a run is in flight, and therefore the right place
|
|
117
|
+
* for a Redis-backed counter or a cluster-wide coordinator.
|
|
118
|
+
*
|
|
119
|
+
* Since 9.32 it is no longer the ONLY way to see a trip. Every
|
|
120
|
+
* transition is ALSO reported through the per-call `LLMCallHooks`
|
|
121
|
+
* channel as a `'circuit-changed'` `ResilienceReport`, which the
|
|
122
|
+
* in-run call site turns into
|
|
123
|
+
* `agentfootprint.error.circuit_changed` with the run's real
|
|
124
|
+
* correlation ids — the same seam `withFallback` and `withRetry`
|
|
125
|
+
* have always used. The two are complements, not duplicates: this
|
|
126
|
+
* hook fires everywhere, the event fires inside a run.
|
|
107
127
|
*/
|
|
108
128
|
readonly onStateChange?: (state: CircuitState, reason: string) => void;
|
|
109
129
|
}
|
|
@@ -80,6 +80,21 @@
|
|
|
80
80
|
* predicate (the visible-tool list is recomputed every iteration).
|
|
81
81
|
* First-class per-tool breakers (state keyed by tool name; run-scoped
|
|
82
82
|
* vs process-scoped TBD) are a possible future enhancement.
|
|
83
|
+
*
|
|
84
|
+
* **Status: contract-shaped and tested — independently reproduced against a
|
|
85
|
+
* local harness, 2026-08-13.** Somebody who is not this library's author drove
|
|
86
|
+
* this breaker through its whole walk: it opened after two failures, served the
|
|
87
|
+
* next request from a fallback WITHOUT calling the primary, half-opened after
|
|
88
|
+
* cooldown, and closed after two successful probes. The one gap that run named
|
|
89
|
+
* — *"breaker transitions have no typed AgentFootprint event"* — is what 9.32.0
|
|
90
|
+
* closes with the `'circuit-changed'` report below, and the per-process scope
|
|
91
|
+
* stated further down was restated there and is unchanged.
|
|
92
|
+
*
|
|
93
|
+
* The failures were SCRIPTED and the cooldown was a test clock: those tests
|
|
94
|
+
* *"were local and deterministic, so they consumed no GCP credit"*. **No live
|
|
95
|
+
* provider has tripped this breaker from this repository**, so this is not the
|
|
96
|
+
* field-validated rung — a real degradation, with a real vendor's error mix and
|
|
97
|
+
* a real recovery time, remains unexercised.
|
|
83
98
|
*/
|
|
84
99
|
// ─── Public error type ───────────────────────────────────────────────
|
|
85
100
|
/**
|
|
@@ -128,7 +143,20 @@ export function withCircuitBreaker(inner, options = {}) {
|
|
|
128
143
|
openedAt: 0,
|
|
129
144
|
lastError: undefined,
|
|
130
145
|
};
|
|
131
|
-
|
|
146
|
+
/**
|
|
147
|
+
* Move the breaker, and say so on both channels.
|
|
148
|
+
*
|
|
149
|
+
* A no-op re-entry returns before either fires, which is what makes the
|
|
150
|
+
* report stream a record of TRANSITIONS rather than of calls: a hundred
|
|
151
|
+
* requests rejected while the breaker is already open produce zero events.
|
|
152
|
+
*
|
|
153
|
+
* `hooks` is the per-CALL channel, so it is threaded down from whichever
|
|
154
|
+
* `complete`/`stream` invocation caused the move. Every transition happens
|
|
155
|
+
* inside one — including `'cooldown elapsed'`, which is discovered by the
|
|
156
|
+
* next admitted call rather than by a timer — so the event always lands
|
|
157
|
+
* with the run's real correlation ids and nothing is ever synthesized.
|
|
158
|
+
*/
|
|
159
|
+
function transition(next, reason, hooks) {
|
|
132
160
|
if (breaker.state === next)
|
|
133
161
|
return;
|
|
134
162
|
breaker.state = next;
|
|
@@ -144,26 +172,32 @@ export function withCircuitBreaker(inner, options = {}) {
|
|
|
144
172
|
breaker.consecutiveSuccesses = 0;
|
|
145
173
|
breaker.lastError = undefined;
|
|
146
174
|
}
|
|
175
|
+
hooks?.onResilience?.({
|
|
176
|
+
kind: 'circuit-changed',
|
|
177
|
+
state: next,
|
|
178
|
+
reason,
|
|
179
|
+
providerName: inner.name,
|
|
180
|
+
});
|
|
147
181
|
onStateChange?.(next, reason);
|
|
148
182
|
}
|
|
149
183
|
/** Decide whether to admit a call. Mutates state if cooldown
|
|
150
184
|
* elapsed (open → half-open). Returns true to admit, false to
|
|
151
185
|
* reject with CircuitOpenError. */
|
|
152
|
-
function admit() {
|
|
186
|
+
function admit(hooks) {
|
|
153
187
|
if (breaker.state === 'closed' || breaker.state === 'half-open')
|
|
154
188
|
return true;
|
|
155
189
|
// OPEN — check cooldown.
|
|
156
190
|
if (Date.now() - breaker.openedAt >= cooldownMs) {
|
|
157
|
-
transition('half-open', 'cooldown elapsed');
|
|
191
|
+
transition('half-open', 'cooldown elapsed', hooks);
|
|
158
192
|
return true;
|
|
159
193
|
}
|
|
160
194
|
return false;
|
|
161
195
|
}
|
|
162
|
-
function recordSuccess() {
|
|
196
|
+
function recordSuccess(hooks) {
|
|
163
197
|
if (breaker.state === 'half-open') {
|
|
164
198
|
breaker.consecutiveSuccesses += 1;
|
|
165
199
|
if (breaker.consecutiveSuccesses >= halfOpenSuccessThreshold) {
|
|
166
|
-
transition('closed', `${halfOpenSuccessThreshold} probe successes
|
|
200
|
+
transition('closed', `${halfOpenSuccessThreshold} probe successes`, hooks);
|
|
167
201
|
}
|
|
168
202
|
}
|
|
169
203
|
else if (breaker.state === 'closed') {
|
|
@@ -171,24 +205,24 @@ export function withCircuitBreaker(inner, options = {}) {
|
|
|
171
205
|
breaker.consecutiveFailures = 0;
|
|
172
206
|
}
|
|
173
207
|
}
|
|
174
|
-
function recordFailure(err) {
|
|
208
|
+
function recordFailure(err, hooks) {
|
|
175
209
|
if (!shouldCount(err))
|
|
176
210
|
return;
|
|
177
211
|
breaker.lastError = err;
|
|
178
212
|
if (breaker.state === 'half-open') {
|
|
179
213
|
// Probe failed — re-open the breaker.
|
|
180
|
-
transition('open', 'half-open probe failed');
|
|
214
|
+
transition('open', 'half-open probe failed', hooks);
|
|
181
215
|
return;
|
|
182
216
|
}
|
|
183
217
|
if (breaker.state === 'closed') {
|
|
184
218
|
breaker.consecutiveFailures += 1;
|
|
185
219
|
if (breaker.consecutiveFailures >= failureThreshold) {
|
|
186
|
-
transition('open', `${breaker.consecutiveFailures} consecutive failures
|
|
220
|
+
transition('open', `${breaker.consecutiveFailures} consecutive failures`, hooks);
|
|
187
221
|
}
|
|
188
222
|
}
|
|
189
223
|
}
|
|
190
|
-
function rejectFastIfOpen() {
|
|
191
|
-
if (!admit()) {
|
|
224
|
+
function rejectFastIfOpen(hooks) {
|
|
225
|
+
if (!admit(hooks)) {
|
|
192
226
|
throw new CircuitOpenError(inner.name, breaker.lastError, breaker.openedAt + cooldownMs);
|
|
193
227
|
}
|
|
194
228
|
}
|
|
@@ -206,17 +240,17 @@ export function withCircuitBreaker(inner, options = {}) {
|
|
|
206
240
|
carriesForcedToolChoice: inner.carriesForcedToolChoice,
|
|
207
241
|
}),
|
|
208
242
|
async complete(req, hooks) {
|
|
209
|
-
rejectFastIfOpen();
|
|
243
|
+
rejectFastIfOpen(hooks);
|
|
210
244
|
try {
|
|
211
|
-
// Forward `hooks`
|
|
212
|
-
//
|
|
213
|
-
//
|
|
245
|
+
// Forward `hooks` inward as well as using them here: this decorator
|
|
246
|
+
// rebuilds a fresh provider object, so an inner decorator's reports
|
|
247
|
+
// are silently swallowed unless they're passed through.
|
|
214
248
|
const res = await inner.complete(req, hooks);
|
|
215
|
-
recordSuccess();
|
|
249
|
+
recordSuccess(hooks);
|
|
216
250
|
return res;
|
|
217
251
|
}
|
|
218
252
|
catch (err) {
|
|
219
|
-
recordFailure(err);
|
|
253
|
+
recordFailure(err, hooks);
|
|
220
254
|
throw err;
|
|
221
255
|
}
|
|
222
256
|
},
|
|
@@ -226,7 +260,7 @@ export function withCircuitBreaker(inner, options = {}) {
|
|
|
226
260
|
// (`if (provider.stream)`) still works correctly.
|
|
227
261
|
...(inner.stream && {
|
|
228
262
|
async *stream(req, hooks) {
|
|
229
|
-
rejectFastIfOpen();
|
|
263
|
+
rejectFastIfOpen(hooks);
|
|
230
264
|
let yieldedAnyChunk = false;
|
|
231
265
|
try {
|
|
232
266
|
// This stream() method is conditionally defined only when
|
|
@@ -238,7 +272,7 @@ export function withCircuitBreaker(inner, options = {}) {
|
|
|
238
272
|
yieldedAnyChunk = true;
|
|
239
273
|
yield chunk;
|
|
240
274
|
}
|
|
241
|
-
recordSuccess();
|
|
275
|
+
recordSuccess(hooks);
|
|
242
276
|
}
|
|
243
277
|
catch (err) {
|
|
244
278
|
// Only count as a breaker-tripping failure if the stream
|
|
@@ -246,7 +280,7 @@ export function withCircuitBreaker(inner, options = {}) {
|
|
|
246
280
|
// less indicative of vendor health (could be a content-filter
|
|
247
281
|
// trip on this specific request).
|
|
248
282
|
if (!yieldedAnyChunk)
|
|
249
|
-
recordFailure(err);
|
|
283
|
+
recordFailure(err, hooks);
|
|
250
284
|
throw err;
|
|
251
285
|
}
|
|
252
286
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withCircuitBreaker.js","sourceRoot":"","sources":["../../../src/resilience/withCircuitBreaker.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"withCircuitBreaker.js","sourceRoot":"","sources":["../../../src/resilience/withCircuitBreaker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiGG;AA6CH,wEAAwE;AAExE;;;;GAIG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAChC,IAAI,GAAG,kBAA2B,CAAC;IAC5C;+CAC2C;IAClC,KAAK,CAAU;IACxB,gEAAgE;IACvD,UAAU,CAAS;IAC5B,YAAY,YAAoB,EAAE,KAAc,EAAE,UAAkB;QAClE,KAAK,CACH,IAAI,YAAY,2DAA2D,IAAI,IAAI,CACjF,UAAU,CACX,CAAC,WAAW,EAAE,wBACZ,KAA8B,EAAE,OAAO,IAAI,MAAM,CAAC,KAAK,CAC1D,EAAE,CACH,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;CACF;AAYD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAkB,EAClB,UAAqC,EAAE;IAEvC,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,IAAI,CAAC,CAAC;IACvD,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,MAAM,CAAC;IAChD,MAAM,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,IAAI,CAAC,CAAC;IACvE,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,kBAAkB,CAAC;IAC9D,MAAM,aAAa,GAA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I,CAAC;oBACH,0DAA0D;oBAC1D,8DAA8D;oBAC9D,wDAAwD;oBACxD,6DAA6D;oBAC7D,oEAAoE;oBACpE,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,KAAK,CAAC,MAAO,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC;wBACpD,eAAe,GAAG,IAAI,CAAC;wBACvB,MAAM,KAAK,CAAC;oBACd,CAAC;oBACD,aAAa,CAAC,KAAK,CAAC,CAAC;gBACvB,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,yDAAyD;oBACzD,2DAA2D;oBAC3D,8DAA8D;oBAC9D,kCAAkC;oBAClC,IAAI,CAAC,eAAe;wBAAE,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;oBAChD,MAAM,GAAG,CAAC;gBACZ,CAAC;YACH,CAAC;SACF,CAAC;KACH,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,wEAAwE;AAExE,SAAS,kBAAkB,CAAC,KAAc;IACxC,kCAAkC;IAClC,MAAM,CAAC,GAAG,KAAqD,CAAC;IAChE,IAAI,CAAC,EAAE,IAAI,KAAK,YAAY;QAAE,OAAO,KAAK,CAAC;IAC3C,IAAI,CAAC,EAAE,IAAI,KAAK,WAAW;QAAE,OAAO,KAAK,CAAC;IAC1C,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -16,6 +16,17 @@
|
|
|
16
16
|
* yielding any chunks, we restart on the fallback. Once the primary
|
|
17
17
|
* has yielded chunks the stream is committed — fallback would
|
|
18
18
|
* duplicate the partial output.
|
|
19
|
+
*
|
|
20
|
+
* **Status: contract-shaped and tested — independently reproduced against a
|
|
21
|
+
* local harness, 2026-08-13.** Somebody who is not this library's author called
|
|
22
|
+
* a failed primary once and a healthy fallback once, with
|
|
23
|
+
* `agentfootprint.fallback.triggered` on the typed stream; a stream that failed
|
|
24
|
+
* BEFORE its first chunk moved to the fallback, and one that failed AFTER a
|
|
25
|
+
* chunk did not — the stream-pinning law, measured rather than asserted, and
|
|
26
|
+
* the reason no output was duplicated. Both providers were SCRIPTED doubles and
|
|
27
|
+
* the run was deterministic and local (the trial's own words: it *"consumed no
|
|
28
|
+
* GCP credit"*). **No failover between two live providers has been exercised
|
|
29
|
+
* from this repository**, so this is not the field-validated rung.
|
|
19
30
|
*/
|
|
20
31
|
import type { LLMProvider } from '../adapters/types.js';
|
|
21
32
|
export interface WithFallbackOptions {
|
|
@@ -16,6 +16,17 @@
|
|
|
16
16
|
* yielding any chunks, we restart on the fallback. Once the primary
|
|
17
17
|
* has yielded chunks the stream is committed — fallback would
|
|
18
18
|
* duplicate the partial output.
|
|
19
|
+
*
|
|
20
|
+
* **Status: contract-shaped and tested — independently reproduced against a
|
|
21
|
+
* local harness, 2026-08-13.** Somebody who is not this library's author called
|
|
22
|
+
* a failed primary once and a healthy fallback once, with
|
|
23
|
+
* `agentfootprint.fallback.triggered` on the typed stream; a stream that failed
|
|
24
|
+
* BEFORE its first chunk moved to the fallback, and one that failed AFTER a
|
|
25
|
+
* chunk did not — the stream-pinning law, measured rather than asserted, and
|
|
26
|
+
* the reason no output was duplicated. Both providers were SCRIPTED doubles and
|
|
27
|
+
* the run was deterministic and local (the trial's own words: it *"consumed no
|
|
28
|
+
* GCP credit"*). **No failover between two live providers has been exercised
|
|
29
|
+
* from this repository**, so this is not the field-validated rung.
|
|
19
30
|
*/
|
|
20
31
|
import { DEFAULT_CARRIES_IN_MESSAGES } from '../adapters/types.js';
|
|
21
32
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withFallback.js","sourceRoot":"","sources":["../../../src/resilience/withFallback.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"withFallback.js","sourceRoot":"","sources":["../../../src/resilience/withFallback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAUH,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAA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don't
|
|
18
18
|
* benefit from retry) and AbortError; retries 5xx,
|
|
19
19
|
* network errors, and unknown shapes.
|
|
20
|
+
*
|
|
21
|
+
* **Status: contract-shaped and tested — independently reproduced against a
|
|
22
|
+
* local harness, 2026-08-13.** Somebody who is not this library's author ran
|
|
23
|
+
* the behaviour end to end and it held: this decorator absorbed two HTTP
|
|
24
|
+
* 503-shaped failures and recovered on call three, with both
|
|
25
|
+
* `agentfootprint.error.retried` and `agentfootprint.error.recovered` on the
|
|
26
|
+
* typed stream, and it made exactly ONE streaming attempt, the limit as
|
|
27
|
+
* designed. What was exercised was a SCRIPTED failing provider — the trial's
|
|
28
|
+
* own note is that those tests *"were local and deterministic, so they consumed
|
|
29
|
+
* no GCP credit"*. **No live provider outage has been retried from this
|
|
30
|
+
* repository**, so this is not the field-validated rung: a real 503 from a real
|
|
31
|
+
* vendor, with a real Retry-After and real latency, remains unexercised.
|
|
20
32
|
*/
|
|
21
33
|
import type { LLMProvider } from '../adapters/types.js';
|
|
22
34
|
export interface WithRetryOptions {
|