mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-11 17:52:31 +03:00
fix(types): align stream failure callback contracts (#9561)
Merge-train validated (tip 6ce4effef8). Vitest failures confirmed as base-red (#9679).
This commit is contained in:
@@ -2778,7 +2778,7 @@ export function createSSETransformStreamWithLogger(
|
||||
body: unknown = null,
|
||||
onComplete: ((payload: StreamCompletePayload) => void) | null = null,
|
||||
apiKeyInfo: unknown = null,
|
||||
onFailure: ((payload: StreamFailurePayload) => void | Promise<void>) | null = null,
|
||||
onFailure: ((payload: StreamFailurePayload) => boolean | void | Promise<void>) | null = null,
|
||||
copilotCompatibleReasoning = false,
|
||||
suppressThinkClose = false,
|
||||
customToolNames: ReadonlySet<string> = new Set(),
|
||||
@@ -2813,7 +2813,7 @@ export function createPassthroughStreamWithLogger(
|
||||
body: unknown = null,
|
||||
onComplete: ((payload: StreamCompletePayload) => void) | null = null,
|
||||
apiKeyInfo: unknown = null,
|
||||
onFailure: ((payload: StreamFailurePayload) => void | Promise<void>) | null = null,
|
||||
onFailure: ((payload: StreamFailurePayload) => boolean | void | Promise<void>) | null = null,
|
||||
clientResponseFormat: string | null = null,
|
||||
requestToolIdentityMap: Map<string, { namespace: string; name: string }> | null = null
|
||||
) {
|
||||
|
||||
@@ -48,13 +48,14 @@ test("createStreamFailureFinalizers: caller classification survives into respons
|
||||
persistFailureUsage: () => {},
|
||||
});
|
||||
|
||||
handleStreamFailure({
|
||||
const handled = handleStreamFailure({
|
||||
status: 502,
|
||||
message: "Upstream stream error",
|
||||
code: "stream_pipeline_error",
|
||||
type: "stream_error",
|
||||
});
|
||||
|
||||
assert.equal(handled, true, "the callback contract reports that the stream failure was handled");
|
||||
const body = captured as { error: { type?: string; code?: string } };
|
||||
assert.equal(body.error.type, "stream_error");
|
||||
assert.equal(body.error.code, "stream_pipeline_error");
|
||||
|
||||
Reference in New Issue
Block a user