@zyraxon-ai/llm 19.0.5 → 19.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +131 -131
- package/dist/cache-policy.js +1 -0
- package/dist/cache-policy.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/llm.js +1 -0
- package/dist/llm.js.map +1 -1
- package/dist/protocols/anthropic-messages.js +1 -0
- package/dist/protocols/anthropic-messages.js.map +1 -1
- package/dist/protocols/bedrock-converse.js +1 -0
- package/dist/protocols/bedrock-converse.js.map +1 -1
- package/dist/protocols/bedrock-event-stream.js +1 -0
- package/dist/protocols/bedrock-event-stream.js.map +1 -1
- package/dist/protocols/gemini.js +1 -0
- package/dist/protocols/gemini.js.map +1 -1
- package/dist/protocols/index.js +1 -0
- package/dist/protocols/index.js.map +1 -1
- package/dist/protocols/openai-chat.js +1 -0
- package/dist/protocols/openai-chat.js.map +1 -1
- package/dist/protocols/openai-compatible-chat.js +1 -0
- package/dist/protocols/openai-compatible-chat.js.map +1 -1
- package/dist/protocols/openai-responses.js +1 -0
- package/dist/protocols/openai-responses.js.map +1 -1
- package/dist/protocols/shared.js +1 -0
- package/dist/protocols/shared.js.map +1 -1
- package/dist/protocols/utils/bedrock-auth.js +1 -0
- package/dist/protocols/utils/bedrock-auth.js.map +1 -1
- package/dist/protocols/utils/bedrock-cache.js +1 -0
- package/dist/protocols/utils/bedrock-cache.js.map +1 -1
- package/dist/protocols/utils/bedrock-media.js +1 -0
- package/dist/protocols/utils/bedrock-media.js.map +1 -1
- package/dist/protocols/utils/cache.js +1 -3
- package/dist/protocols/utils/cache.js.map +1 -1
- package/dist/protocols/utils/gemini-tool-schema.js +1 -0
- package/dist/protocols/utils/gemini-tool-schema.js.map +1 -1
- package/dist/protocols/utils/lifecycle.js +1 -0
- package/dist/protocols/utils/lifecycle.js.map +1 -1
- package/dist/protocols/utils/openai-options.js +1 -0
- package/dist/protocols/utils/openai-options.js.map +1 -1
- package/dist/protocols/utils/tool-schema.js +1 -0
- package/dist/protocols/utils/tool-schema.js.map +1 -1
- package/dist/protocols/utils/tool-stream.js +1 -0
- package/dist/protocols/utils/tool-stream.js.map +1 -1
- package/dist/provider-error.js +1 -0
- package/dist/provider-error.js.map +1 -1
- package/dist/provider.js +1 -0
- package/dist/provider.js.map +1 -1
- package/dist/providers/amazon-bedrock.js +1 -0
- package/dist/providers/amazon-bedrock.js.map +1 -1
- package/dist/providers/anthropic.js +1 -0
- package/dist/providers/anthropic.js.map +1 -1
- package/dist/providers/azure.js +1 -0
- package/dist/providers/azure.js.map +1 -1
- package/dist/providers/cloudflare.js +1 -0
- package/dist/providers/cloudflare.js.map +1 -1
- package/dist/providers/github-copilot.js +1 -0
- package/dist/providers/github-copilot.js.map +1 -1
- package/dist/providers/google.js +1 -0
- package/dist/providers/google.js.map +1 -1
- package/dist/providers/index.js +1 -0
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/openai-compatible-profile.js +1 -0
- package/dist/providers/openai-compatible-profile.js.map +1 -1
- package/dist/providers/openai-compatible.js +1 -0
- package/dist/providers/openai-compatible.js.map +1 -1
- package/dist/providers/openai-options.js +1 -0
- package/dist/providers/openai-options.js.map +1 -1
- package/dist/providers/openai.js +1 -0
- package/dist/providers/openai.js.map +1 -1
- package/dist/providers/openrouter.js +1 -0
- package/dist/providers/openrouter.js.map +1 -1
- package/dist/providers/xai.js +1 -0
- package/dist/providers/xai.js.map +1 -1
- package/dist/route/auth-options.js +1 -0
- package/dist/route/auth-options.js.map +1 -1
- package/dist/route/auth.js +1 -0
- package/dist/route/auth.js.map +1 -1
- package/dist/route/client.js +1 -0
- package/dist/route/client.js.map +1 -1
- package/dist/route/endpoint.js +1 -0
- package/dist/route/endpoint.js.map +1 -1
- package/dist/route/executor.js +1 -0
- package/dist/route/executor.js.map +1 -1
- package/dist/route/framing.js +1 -0
- package/dist/route/framing.js.map +1 -1
- package/dist/route/index.js +1 -0
- package/dist/route/index.js.map +1 -1
- package/dist/route/protocol.js +1 -0
- package/dist/route/protocol.js.map +1 -1
- package/dist/route/transport/http.js +1 -0
- package/dist/route/transport/http.js.map +1 -1
- package/dist/route/transport/index.js +1 -0
- package/dist/route/transport/index.js.map +1 -1
- package/dist/route/transport/websocket.js +1 -0
- package/dist/route/transport/websocket.js.map +1 -1
- package/dist/schema/errors.js +1 -0
- package/dist/schema/errors.js.map +1 -1
- package/dist/schema/events.js +1 -0
- package/dist/schema/events.js.map +1 -1
- package/dist/schema/ids.js +1 -0
- package/dist/schema/ids.js.map +1 -1
- package/dist/schema/index.js +1 -0
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/messages.js +1 -0
- package/dist/schema/messages.js.map +1 -1
- package/dist/schema/options.js +1 -0
- package/dist/schema/options.js.map +1 -1
- package/dist/tool-runtime.js +1 -0
- package/dist/tool-runtime.js.map +1 -1
- package/dist/tool.js +1 -0
- package/dist/tool.js.map +1 -1
- package/dist/utils/record.js +1 -0
- package/dist/utils/record.js.map +1 -1
- package/package.json +107 -21
- package/dist/cache-policy.d.ts +0 -3
- package/dist/cache-policy.d.ts.map +0 -1
- package/dist/index.d.ts +0 -13
- package/dist/index.d.ts.map +0 -1
- package/dist/llm.d.ts +0 -205
- package/dist/llm.d.ts.map +0 -1
- package/dist/protocols/anthropic-messages.d.ts +0 -340
- package/dist/protocols/anthropic-messages.d.ts.map +0 -1
- package/dist/protocols/bedrock-converse.d.ts +0 -472
- package/dist/protocols/bedrock-converse.d.ts.map +0 -1
- package/dist/protocols/bedrock-event-stream.d.ts +0 -10
- package/dist/protocols/bedrock-event-stream.d.ts.map +0 -1
- package/dist/protocols/gemini.d.ts +0 -165
- package/dist/protocols/gemini.d.ts.map +0 -1
- package/dist/protocols/index.d.ts +0 -7
- package/dist/protocols/index.d.ts.map +0 -1
- package/dist/protocols/openai-chat.d.ts +0 -297
- package/dist/protocols/openai-chat.d.ts.map +0 -1
- package/dist/protocols/openai-compatible-chat.d.ts +0 -12
- package/dist/protocols/openai-compatible-chat.d.ts.map +0 -1
- package/dist/protocols/openai-responses.d.ts +0 -615
- package/dist/protocols/openai-responses.d.ts.map +0 -1
- package/dist/protocols/shared.d.ts +0 -193
- package/dist/protocols/shared.d.ts.map +0 -1
- package/dist/protocols/utils/bedrock-auth.d.ts +0 -19
- package/dist/protocols/utils/bedrock-auth.d.ts.map +0 -1
- package/dist/protocols/utils/bedrock-cache.d.ts +0 -16
- package/dist/protocols/utils/bedrock-cache.d.ts.map +0 -1
- package/dist/protocols/utils/bedrock-media.d.ts +0 -50
- package/dist/protocols/utils/bedrock-media.d.ts.map +0 -1
- package/dist/protocols/utils/cache.d.ts +0 -7
- package/dist/protocols/utils/cache.d.ts.map +0 -1
- package/dist/protocols/utils/gemini-tool-schema.d.ts +0 -3
- package/dist/protocols/utils/gemini-tool-schema.d.ts.map +0 -1
- package/dist/protocols/utils/lifecycle.d.ts +0 -20
- package/dist/protocols/utils/lifecycle.d.ts.map +0 -1
- package/dist/protocols/utils/openai-options.d.ts +0 -23
- package/dist/protocols/utils/openai-options.d.ts.map +0 -1
- package/dist/protocols/utils/tool-schema.d.ts +0 -8
- package/dist/protocols/utils/tool-schema.d.ts.map +0 -1
- package/dist/protocols/utils/tool-stream.d.ts +0 -156
- package/dist/protocols/utils/tool-stream.d.ts.map +0 -1
- package/dist/provider-error.d.ts +0 -3
- package/dist/provider-error.d.ts.map +0 -1
- package/dist/provider.d.ts +0 -24
- package/dist/provider.d.ts.map +0 -1
- package/dist/providers/amazon-bedrock.d.ts +0 -142
- package/dist/providers/amazon-bedrock.d.ts.map +0 -1
- package/dist/providers/anthropic.d.ts +0 -24
- package/dist/providers/anthropic.d.ts.map +0 -1
- package/dist/providers/azure.d.ts +0 -36
- package/dist/providers/azure.d.ts.map +0 -1
- package/dist/providers/cloudflare.d.ts +0 -47
- package/dist/providers/cloudflare.d.ts.map +0 -1
- package/dist/providers/github-copilot.d.ts +0 -30
- package/dist/providers/github-copilot.d.ts.map +0 -1
- package/dist/providers/google.d.ts +0 -24
- package/dist/providers/google.d.ts.map +0 -1
- package/dist/providers/index.d.ts +0 -12
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/openai-compatible-profile.d.ts +0 -44
- package/dist/providers/openai-compatible-profile.d.ts.map +0 -1
- package/dist/providers/openai-compatible.d.ts +0 -62
- package/dist/providers/openai-compatible.d.ts.map +0 -1
- package/dist/providers/openai-options.d.ts +0 -31
- package/dist/providers/openai-options.d.ts.map +0 -1
- package/dist/providers/openai.d.ts +0 -116
- package/dist/providers/openai.d.ts.map +0 -1
- package/dist/providers/openrouter.d.ts +0 -199
- package/dist/providers/openrouter.d.ts.map +0 -1
- package/dist/providers/xai.d.ts +0 -32
- package/dist/providers/xai.d.ts.map +0 -1
- package/dist/route/auth-options.d.ts +0 -35
- package/dist/route/auth-options.d.ts.map +0 -1
- package/dist/route/client.d.ts +0 -306
- package/dist/route/client.d.ts.map +0 -1
- package/dist/route/executor.d.ts +0 -13
- package/dist/route/executor.d.ts.map +0 -1
- package/dist/route/index.d.ts +0 -17
- package/dist/route/index.d.ts.map +0 -1
- package/dist/route/protocol.d.ts +0 -77
- package/dist/route/protocol.d.ts.map +0 -1
- package/dist/route/transport/http.d.ts +0 -34
- package/dist/route/transport/http.d.ts.map +0 -1
- package/dist/route/transport/index.d.ts +0 -28
- package/dist/route/transport/index.d.ts.map +0 -1
- package/dist/route/transport/websocket.d.ts +0 -57
- package/dist/route/transport/websocket.d.ts.map +0 -1
- package/dist/schema/errors.d.ts +0 -166
- package/dist/schema/errors.d.ts.map +0 -1
- package/dist/schema/events.d.ts +0 -3821
- package/dist/schema/events.d.ts.map +0 -1
- package/dist/schema/ids.d.ts +0 -31
- package/dist/schema/ids.d.ts.map +0 -1
- package/dist/schema/index.d.ts +0 -6
- package/dist/schema/index.d.ts.map +0 -1
- package/dist/schema/messages.d.ts +0 -294
- package/dist/schema/messages.d.ts.map +0 -1
- package/dist/schema/options.d.ts +0 -144
- package/dist/schema/options.d.ts.map +0 -1
- package/dist/tool-runtime.d.ts +0 -16
- package/dist/tool-runtime.d.ts.map +0 -1
- package/dist/utils/record.d.ts +0 -3
- package/dist/utils/record.d.ts.map +0 -1
package/dist/route/protocol.d.ts
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { Schema, type Effect } from "effect";
|
|
2
|
-
import type { LLMError, LLMEvent, LLMRequest, ProtocolID } from "../schema";
|
|
3
|
-
/**
|
|
4
|
-
* The semantic API contract of one model server family.
|
|
5
|
-
*
|
|
6
|
-
* A `Protocol` owns the parts of a route that are intrinsic to "what does
|
|
7
|
-
* this API look like": how a common `LLMRequest` becomes a provider-native
|
|
8
|
-
* body, what schema that body must satisfy before it is JSON-encoded, and
|
|
9
|
-
* how the streaming response decodes back into common `LLMEvent`s.
|
|
10
|
-
*
|
|
11
|
-
* Examples:
|
|
12
|
-
*
|
|
13
|
-
* - `OpenAIChat.protocol` — chat completions style
|
|
14
|
-
* - `OpenAIResponses.protocol` — responses API
|
|
15
|
-
* - `AnthropicMessages.protocol` — messages API with content blocks
|
|
16
|
-
* - `Gemini.protocol` — generateContent
|
|
17
|
-
* - `BedrockConverse.protocol` — Converse with binary event-stream framing
|
|
18
|
-
*
|
|
19
|
-
* A `Protocol` is **not** a deployment. It does not know which URL, which
|
|
20
|
-
* headers, or which auth scheme to use. Those are deployment concerns owned
|
|
21
|
-
* by `Route.make(...)` along with the chosen `Endpoint`, `Auth`,
|
|
22
|
-
* and `Framing`. This separation is what lets DeepSeek, TogetherAI, Cerebras,
|
|
23
|
-
* etc. all reuse `OpenAIChat.protocol` without forking 300 lines per provider.
|
|
24
|
-
*
|
|
25
|
-
* The four type parameters reflect the pipeline:
|
|
26
|
-
*
|
|
27
|
-
* - `Body` — provider-native request body candidate. `Route.make(...)`
|
|
28
|
-
* validates and JSON-encodes it with `body.schema`.
|
|
29
|
-
* - `Frame` — one unit of the framed response stream. SSE: a JSON data
|
|
30
|
-
* string. AWS event stream: a parsed binary frame.
|
|
31
|
-
* - `Event` — schema-decoded provider event produced from one frame.
|
|
32
|
-
* - `State` — accumulator threaded through `stream.step` to translate event
|
|
33
|
-
* sequences into `LLMEvent` sequences.
|
|
34
|
-
*/
|
|
35
|
-
export interface Protocol<Body, Frame, Event, State> {
|
|
36
|
-
/** Stable id for the wire protocol implementation. */
|
|
37
|
-
readonly id: ProtocolID;
|
|
38
|
-
/** Request side: schema for the provider-native body and how to build it. */
|
|
39
|
-
readonly body: ProtocolBody<Body>;
|
|
40
|
-
/** Response side: streaming state machine. */
|
|
41
|
-
readonly stream: ProtocolStream<Frame, Event, State>;
|
|
42
|
-
}
|
|
43
|
-
export interface ProtocolBody<Body> {
|
|
44
|
-
/** Schema for the validated provider-native body sent as the JSON request. */
|
|
45
|
-
readonly schema: Schema.Codec<Body, unknown>;
|
|
46
|
-
/** Build the provider-native body from a common `LLMRequest`. */
|
|
47
|
-
readonly from: (request: LLMRequest) => Effect.Effect<Body, LLMError>;
|
|
48
|
-
}
|
|
49
|
-
export interface ProtocolStream<Frame, Event, State> {
|
|
50
|
-
/** Schema for one decoded streaming event, decoded from a transport frame. */
|
|
51
|
-
readonly event: Schema.Codec<Event, Frame>;
|
|
52
|
-
/** Initial parser state. Called once per response with the resolved request. */
|
|
53
|
-
readonly initial: (request: LLMRequest) => State;
|
|
54
|
-
/** Translate one event into emitted `LLMEvent`s plus the next state. */
|
|
55
|
-
readonly step: (state: State, event: Event) => Effect.Effect<readonly [State, ReadonlyArray<LLMEvent>], LLMError>;
|
|
56
|
-
/** Optional request-completion signal for transports that do not end naturally. */
|
|
57
|
-
readonly terminal?: (event: Event) => boolean;
|
|
58
|
-
/** Optional flush emitted when the framed stream ends. */
|
|
59
|
-
readonly onHalt?: (state: State) => ReadonlyArray<LLMEvent>;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Construct a `Protocol` from its body and stream pieces:
|
|
63
|
-
*
|
|
64
|
-
* - `body.schema` infers the provider-native request body shape.
|
|
65
|
-
* - `body.from` ties the common `LLMRequest` to the provider body.
|
|
66
|
-
* - `stream.event` infers the decoded streaming event and the wire frame.
|
|
67
|
-
* - `stream.initial`, `stream.step`, and `stream.onHalt` infer the parser state.
|
|
68
|
-
*
|
|
69
|
-
* Provider implementations should usually call `Protocol.make({ ... })`
|
|
70
|
-
* without explicit type arguments; the schemas and parser functions are the
|
|
71
|
-
* source of truth. The constructor remains as the public seam for future
|
|
72
|
-
* cross-cutting concerns such as tracing or instrumentation.
|
|
73
|
-
*/
|
|
74
|
-
export declare const make: <Body, Frame, Event, State>(input: Protocol<Body, Frame, Event, State>) => Protocol<Body, Frame, Event, State>;
|
|
75
|
-
export declare const jsonEvent: <const S extends Schema.Top>(schema: S) => Schema.fromJsonString<S>;
|
|
76
|
-
export * as Protocol from "./protocol";
|
|
77
|
-
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/route/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,WAAW,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;IACjD,sDAAsD;IACtD,QAAQ,CAAC,EAAE,EAAE,UAAU,CAAA;IACvB,6EAA6E;IAC7E,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;IACjC,8CAA8C;IAC9C,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;CACrD;AAED,MAAM,WAAW,YAAY,CAAC,IAAI;IAChC,8EAA8E;IAC9E,QAAQ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A;AAEjG,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAA"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
2
|
-
import { Headers, HttpClientRequest } from "effect/unstable/http";
|
|
3
|
-
import { type Framing as FramingDef } from "../framing";
|
|
4
|
-
import type { Transport, TransportPrepareInput } from "./index";
|
|
5
|
-
export type JsonRequestInput<Body> = TransportPrepareInput<Body>;
|
|
6
|
-
export interface JsonRequestParts<Body = unknown> {
|
|
7
|
-
readonly url: string;
|
|
8
|
-
readonly jsonBody: Body | Record<string, unknown>;
|
|
9
|
-
readonly bodyText: string;
|
|
10
|
-
readonly headers: Headers.Headers;
|
|
11
|
-
}
|
|
12
|
-
export interface HttpPrepared<Frame> {
|
|
13
|
-
readonly request: HttpClientRequest.HttpClientRequest;
|
|
14
|
-
readonly framing: FramingDef<Frame>;
|
|
15
|
-
}
|
|
16
|
-
export declare const jsonRequestParts: <Body>(input: JsonRequestInput<Body>) => Effect.Effect<{
|
|
17
|
-
url: string;
|
|
18
|
-
jsonBody: Record<string, unknown> | Body;
|
|
19
|
-
bodyText: string;
|
|
20
|
-
headers: Headers.Headers;
|
|
21
|
-
}, import("../..").LLMError, never>;
|
|
22
|
-
export interface HttpJsonInput<_Body, Frame> {
|
|
23
|
-
readonly framing: FramingDef<Frame>;
|
|
24
|
-
}
|
|
25
|
-
export type HttpJsonPatch<Body, Frame> = Partial<HttpJsonInput<Body, Frame>>;
|
|
26
|
-
export interface HttpJsonTransport<Body, Frame> extends Transport<Body, HttpPrepared<Frame>, Frame> {
|
|
27
|
-
readonly with: (patch: HttpJsonPatch<Body, Frame>) => HttpJsonTransport<Body, Frame>;
|
|
28
|
-
}
|
|
29
|
-
export declare const httpJson: <Body, Frame>(input: HttpJsonInput<Body, Frame>) => HttpJsonTransport<Body, Frame>;
|
|
30
|
-
export declare const sseJson: {
|
|
31
|
-
readonly id: "http-json/sse";
|
|
32
|
-
readonly with: <Body>() => HttpJsonTrans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AAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAA;AAE5E,MAAM,WAAW,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAE,SAAQ,SAAS,CAAC,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IACjG,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;CACrF;AAED,eAAO,MAAM,QAAQ,GAAI,IAAI,EAAE,KAAK,EAAE,OAAO,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,KAAG,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAgCrG,CAAA;AAEF,eAAO,MAAM,OAAO;;oBAEX,IAAI;CACH,CAAA"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { Effect, Stream } from "effect";
|
|
2
|
-
import type { Endpoint } from "../endpoint";
|
|
3
|
-
import type { Auth } from "../auth";
|
|
4
|
-
import type { Interface as RequestExecutorInterface } from "../executor";
|
|
5
|
-
import type { Interface as WebSocketExecutorInterface } from "./websocket";
|
|
6
|
-
import type { LLMError, LLMRequest } from "../../schema";
|
|
7
|
-
export interface TransportRuntime {
|
|
8
|
-
readonly http: RequestExecutorInterface;
|
|
9
|
-
readonly webSocket?: WebSocketExecutorInterface;
|
|
10
|
-
}
|
|
11
|
-
export interface Transport<Body, Prepared, Frame> {
|
|
12
|
-
readonly id: string;
|
|
13
|
-
readonly prepare: (input: TransportPrepareInput<Body>) => Effect.Effect<Prepared, LLMError>;
|
|
14
|
-
readonly frames: (prepared: Prepared, request: LLMRequest, runtime: TransportRuntime) => Stream.Stream<Frame, LLMError>;
|
|
15
|
-
}
|
|
16
|
-
export interface TransportPrepareInput<Body> {
|
|
17
|
-
readonly body: Body;
|
|
18
|
-
readonly request: LLMRequest;
|
|
19
|
-
readonly endpoint: Endpoint<Body>;
|
|
20
|
-
readonly auth: Auth;
|
|
21
|
-
readonly encodeBody: (body: Body) => string;
|
|
22
|
-
readonly headers?: (input: {
|
|
23
|
-
readonly request: LLMRequest;
|
|
24
|
-
}) => Record<string, string>;
|
|
25
|
-
}
|
|
26
|
-
export * as HttpTransport from "./http";
|
|
27
|
-
export { WebSocketExecutor, WebSocketTransport } from "./websocket";
|
|
28
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/route/transport/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,KAAK,EAAE,SAAS,IAAI,wBAAwB,EAAE,MAAM,aAAa,CAAA;AACxE,OAAO,KAAK,EAAE,SAAS,IAAI,0BAA0B,EAAE,MAAM,aAAa,CAAA;AAC1E,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAExD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAA;IACvC,QAAQ,CAAC,SAAS,CAAC,EAAE,0BAA0B,CAAA;CAChD;AAED,MAAM,WAAW,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK;IAC9C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,qBAAqB,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAC3F,QAAQ,CAAC,MAAM,EAAE,CACf,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,gBAAgB,KACtB,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;CACpC;AAED,MAAM,WAAW,qBAAqB,CAAC,IAAI;IACzC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAA;IAC5B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAA;IACjC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,QAAQ,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAA;IAC3C,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAA;KAAE,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACvF;AAED,OAAO,KAAK,aAAa,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Context, Effect, Layer, Stream } from "effect";
|
|
2
|
-
import { Headers } from "effect/unstable/http";
|
|
3
|
-
import { LLMError } from "../../schema";
|
|
4
|
-
import type { Transport } from "./index";
|
|
5
|
-
export interface WebSocketRequest {
|
|
6
|
-
readonly url: string;
|
|
7
|
-
readonly headers: Headers.Headers;
|
|
8
|
-
}
|
|
9
|
-
export interface WebSocketConnection {
|
|
10
|
-
readonly sendText: (message: string) => Effect.Effect<void, LLMError>;
|
|
11
|
-
readonly messages: Stream.Stream<string | Uint8Array, LLMError>;
|
|
12
|
-
readonly close: Effect.Effect<void, never>;
|
|
13
|
-
}
|
|
14
|
-
export interface Interface {
|
|
15
|
-
readonly open: (input: WebSocketRequest) => Effect.Effect<WebSocketConnection, LLMError>;
|
|
16
|
-
}
|
|
17
|
-
declare const Service_base: Context.ServiceClass<Service, "@zyraxon/LLM/WebSocketExecutor", Interface>;
|
|
18
|
-
export declare class Service extends Service_base {
|
|
19
|
-
}
|
|
20
|
-
export declare const open: (input: WebSocketRequest) => Effect.Effect<WebSocketConnection, LLMError, never>;
|
|
21
|
-
export declare const layer: Layer.Layer<Service>;
|
|
22
|
-
export declare const fromWebSocket: (ws: globalThis.WebSocket, input: WebSocketRequest) => Effect.Effect<WebSocketConnection, LLMError>;
|
|
23
|
-
export declare const messageText: (message: string | Uint8Array, decoder: TextDecoder) => string;
|
|
24
|
-
export interface JsonPrepared {
|
|
25
|
-
readonly url: string;
|
|
26
|
-
readonly headers: Headers.Headers;
|
|
27
|
-
readonly message: string;
|
|
28
|
-
}
|
|
29
|
-
export interface JsonInput<Body, Message> {
|
|
30
|
-
readonly toMessage: (body: Body | Record<string, unknown>) => Effect.Effect<Message, LLMError>;
|
|
31
|
-
readonly encodeMessage: (message: Message) => string;
|
|
32
|
-
}
|
|
33
|
-
export type JsonPatch<Body, Message> = Partial<JsonInput<Body, Message>>;
|
|
34
|
-
export interface JsonTransport<Body, Message> extends Transport<Body, JsonPrepared, string> {
|
|
35
|
-
readonly with: (patch: JsonPatch<Body, Message>) => JsonTransport<Body, Message>;
|
|
36
|
-
}
|
|
37
|
-
export declare const json: <Body, Message>(input: JsonInput<Body, Message>) => JsonTransport<Body, Message>;
|
|
38
|
-
export declare const jsonTransport: {
|
|
39
|
-
readonly id: "websocket-json";
|
|
40
|
-
readonly with: <Body, Message>(input: JsonInput<Body, Message>) => JsonTransport<Body, Message>;
|
|
41
|
-
};
|
|
42
|
-
export declare const WebSocketExecutor: {
|
|
43
|
-
readonly Service: typeof Service;
|
|
44
|
-
readonly layer: Layer.Layer<Service, never, never>;
|
|
45
|
-
readonly open: (input: WebSocketRequest) => Effect.Effect<WebSocketConnection, LLMError, never>;
|
|
46
|
-
readonly fromWebSocket: (ws: globalThis.WebSocket, input: WebSocketRequest) => Effect.Effect<WebSocketConnection, LLMError>;
|
|
47
|
-
readonly messageText: (message: string | Uint8Array, decoder: TextDecoder) => string;
|
|
48
|
-
};
|
|
49
|
-
export declare const WebSocketTransport: {
|
|
50
|
-
readonly json: <Body, Message>(input: JsonInput<Body, Message>) => JsonTransport<Body, Message>;
|
|
51
|
-
readonly jsonTransport: {
|
|
52
|
-
readonly id: "websocket-json";
|
|
53
|
-
readonly with: <Body, Message>(input: JsonInput<Body, Message>) => JsonTransport<Body, Message>;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
export {};
|
|
57
|
-
//# sourceMappingURL=websocket.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"websocket.d.ts","sourceRoot":"","sources":["../../../src/route/transport/websocket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,OAAO,EAAE,MAAM,EAAE,KAAK,EAAS,MAAM,EAAE,MAAM,QAAQ,CAAA;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAmB,MAAM,cAAc,CAAA;AAExD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAExC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAA;CAClC;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;IACrE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,UAAU,EAAE,QAAQ,CAAC,CAAA;IAC/D,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;CAC3C;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,MAAM,CAA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AAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;CACjF;AAED,eAAO,MAAM,IAAI,GAAI,IAAI,EAAE,OAAO,EAAE,OAAO,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,KAAG,aAAa,CAAC,IAAI,EAAE,OAAO,CAoC/F,CAAA;AAEF,eAAO,MAAM,aAAa;;oBAtCL,IAAI,EAAE,OAAO,SAAS,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,KAAG,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC;CAyCxF,CAAA;AAEV,eAAO,MAAM,iBAAiB;;;2BAhJF,gBAAgB;iCActC,UAAU,CAAC,SAAS,SACjB,gBAAgB,KACtB,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE,QAAQ,CAAC;oCAiEV,MAAM,GAAG,UAAU,WAAW,WAAW;CAqEpE,CAAA;AAEV,eAAO,MAAM,kBAAkB;oBAnDV,IAAI,EAAE,OAAO,SAAS,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,KAAG,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC;;;wBAA7E,IAAI,EAAE,OAAO,SAAS,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,KAAG,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC;;CAsDxF,CAAA"}
|
package/dist/schema/errors.d.ts
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
2
|
-
export declare const ProviderFailureClassification: Schema.Literal<"context-overflow">;
|
|
3
|
-
export type ProviderFailureClassification = typeof ProviderFailureClassification.Type;
|
|
4
|
-
declare const HttpRequestDetails_base: Schema.Class<HttpRequestDetails, Schema.Struct<{
|
|
5
|
-
readonly method: Schema.String;
|
|
6
|
-
readonly url: Schema.String;
|
|
7
|
-
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
8
|
-
}>, {}>;
|
|
9
|
-
export declare class HttpRequestDetails extends HttpRequestDetails_base {
|
|
10
|
-
}
|
|
11
|
-
declare const HttpResponseDetails_base: Schema.Class<HttpResponseDetails, Schema.Struct<{
|
|
12
|
-
readonly status: Schema.Number;
|
|
13
|
-
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
14
|
-
}>, {}>;
|
|
15
|
-
export declare class HttpResponseDetails extends HttpResponseDetails_base {
|
|
16
|
-
}
|
|
17
|
-
declare const HttpRateLimitDetails_base: Schema.Class<HttpRateLimitDetails, Schema.Struct<{
|
|
18
|
-
readonly retryAfterMs: Schema.optional<Schema.Number>;
|
|
19
|
-
readonly limit: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
20
|
-
readonly remaining: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
21
|
-
readonly reset: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
22
|
-
}>, {}>;
|
|
23
|
-
export declare class HttpRateLimitDetails extends HttpRateLimitDetails_base {
|
|
24
|
-
}
|
|
25
|
-
declare const HttpContext_base: Schema.Class<HttpContext, Schema.Struct<{
|
|
26
|
-
readonly request: typeof HttpRequestDetails;
|
|
27
|
-
readonly response: Schema.optional<typeof HttpResponseDetails>;
|
|
28
|
-
readonly body: Schema.optional<Schema.String>;
|
|
29
|
-
readonly bodyTruncated: Schema.optional<Schema.Boolean>;
|
|
30
|
-
readonly requestId: Schema.optional<Schema.String>;
|
|
31
|
-
readonly rateLimit: Schema.optional<typeof HttpRateLimitDetails>;
|
|
32
|
-
}>, {}>;
|
|
33
|
-
export declare class HttpContext extends HttpContext_base {
|
|
34
|
-
}
|
|
35
|
-
declare const InvalidRequestReason_base: Schema.Class<InvalidRequestReason, Schema.Struct<{
|
|
36
|
-
readonly _tag: Schema.tag<"InvalidRequest">;
|
|
37
|
-
readonly message: Schema.String;
|
|
38
|
-
readonly parameter: Schema.optional<Schema.String>;
|
|
39
|
-
readonly classification: Schema.optional<Schema.Literal<"context-overflow">>;
|
|
40
|
-
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
41
|
-
readonly http: Schema.optional<typeof HttpContext>;
|
|
42
|
-
}>, {}>;
|
|
43
|
-
export declare class InvalidRequestReason extends InvalidRequestReason_base {
|
|
44
|
-
get retryable(): boolean;
|
|
45
|
-
}
|
|
46
|
-
declare const NoRouteReason_base: Schema.Class<NoRouteReason, Schema.Struct<{
|
|
47
|
-
readonly _tag: Schema.tag<"NoRoute">;
|
|
48
|
-
readonly route: Schema.String;
|
|
49
|
-
readonly provider: Schema.brand<Schema.String, "LLM.ProviderID">;
|
|
50
|
-
readonly model: Schema.brand<Schema.String, "LLM.ModelID">;
|
|
51
|
-
}>, {}>;
|
|
52
|
-
export declare class NoRouteReason extends NoRouteReason_base {
|
|
53
|
-
get retryable(): boolean;
|
|
54
|
-
get message(): string;
|
|
55
|
-
}
|
|
56
|
-
declare const AuthenticationReason_base: Schema.Class<AuthenticationReason, Schema.Struct<{
|
|
57
|
-
readonly _tag: Schema.tag<"Authentication">;
|
|
58
|
-
readonly message: Schema.String;
|
|
59
|
-
readonly kind: Schema.Literals<readonly ["missing", "invalid", "expired", "insufficient-permissions", "unknown"]>;
|
|
60
|
-
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
61
|
-
readonly http: Schema.optional<typeof HttpContext>;
|
|
62
|
-
}>, {}>;
|
|
63
|
-
export declare class AuthenticationReason extends AuthenticationReason_base {
|
|
64
|
-
get retryable(): boolean;
|
|
65
|
-
}
|
|
66
|
-
declare const RateLimitReason_base: Schema.Class<RateLimitReason, Schema.Struct<{
|
|
67
|
-
readonly _tag: Schema.tag<"RateLimit">;
|
|
68
|
-
readonly message: Schema.String;
|
|
69
|
-
readonly retryAfterMs: Schema.optional<Schema.Number>;
|
|
70
|
-
readonly rateLimit: Schema.optional<typeof HttpRateLimitDetails>;
|
|
71
|
-
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
72
|
-
readonly http: Schema.optional<typeof HttpContext>;
|
|
73
|
-
}>, {}>;
|
|
74
|
-
export declare class RateLimitReason extends RateLimitReason_base {
|
|
75
|
-
get retryable(): boolean;
|
|
76
|
-
}
|
|
77
|
-
declare const QuotaExceededReason_base: Schema.Class<QuotaExceededReason, Schema.Struct<{
|
|
78
|
-
readonly _tag: Schema.tag<"QuotaExceeded">;
|
|
79
|
-
readonly message: Schema.String;
|
|
80
|
-
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
81
|
-
readonly http: Schema.optional<typeof HttpContext>;
|
|
82
|
-
}>, {}>;
|
|
83
|
-
export declare class QuotaExceededReason extends QuotaExceededReason_base {
|
|
84
|
-
get retryable(): boolean;
|
|
85
|
-
}
|
|
86
|
-
declare const ContentPolicyReason_base: Schema.Class<ContentPolicyReason, Schema.Struct<{
|
|
87
|
-
readonly _tag: Schema.tag<"ContentPolicy">;
|
|
88
|
-
readonly message: Schema.String;
|
|
89
|
-
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
90
|
-
readonly http: Schema.optional<typeof HttpContext>;
|
|
91
|
-
}>, {}>;
|
|
92
|
-
export declare class ContentPolicyReason extends ContentPolicyReason_base {
|
|
93
|
-
get retryable(): boolean;
|
|
94
|
-
}
|
|
95
|
-
declare const ProviderInternalReason_base: Schema.Class<ProviderInternalReason, Schema.Struct<{
|
|
96
|
-
readonly _tag: Schema.tag<"ProviderInternal">;
|
|
97
|
-
readonly message: Schema.String;
|
|
98
|
-
readonly status: Schema.Number;
|
|
99
|
-
readonly retryAfterMs: Schema.optional<Schema.Number>;
|
|
100
|
-
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
101
|
-
readonly http: Schema.optional<typeof HttpContext>;
|
|
102
|
-
}>, {}>;
|
|
103
|
-
export declare class ProviderInternalReason extends ProviderInternalReason_base {
|
|
104
|
-
get retryable(): boolean;
|
|
105
|
-
}
|
|
106
|
-
declare const TransportReason_base: Schema.Class<TransportReason, Schema.Struct<{
|
|
107
|
-
readonly _tag: Schema.tag<"Transport">;
|
|
108
|
-
readonly message: Schema.String;
|
|
109
|
-
readonly kind: Schema.optional<Schema.String>;
|
|
110
|
-
readonly url: Schema.optional<Schema.String>;
|
|
111
|
-
readonly http: Schema.optional<typeof HttpContext>;
|
|
112
|
-
}>, {}>;
|
|
113
|
-
export declare class TransportReason extends TransportReason_base {
|
|
114
|
-
get retryable(): boolean;
|
|
115
|
-
}
|
|
116
|
-
declare const InvalidProviderOutputReason_base: Schema.Class<InvalidProviderOutputReason, Schema.Struct<{
|
|
117
|
-
readonly _tag: Schema.tag<"InvalidProviderOutput">;
|
|
118
|
-
readonly message: Schema.String;
|
|
119
|
-
readonly route: Schema.optional<Schema.String>;
|
|
120
|
-
readonly raw: Schema.optional<Schema.String>;
|
|
121
|
-
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
122
|
-
}>, {}>;
|
|
123
|
-
export declare class InvalidProviderOutputReason extends InvalidProviderOutputReason_base {
|
|
124
|
-
get retryable(): boolean;
|
|
125
|
-
}
|
|
126
|
-
declare const UnknownProviderReason_base: Schema.Class<UnknownProviderReason, Schema.Struct<{
|
|
127
|
-
readonly _tag: Schema.tag<"UnknownProvider">;
|
|
128
|
-
readonly message: Schema.String;
|
|
129
|
-
readonly status: Schema.optional<Schema.Number>;
|
|
130
|
-
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
131
|
-
readonly http: Schema.optional<typeof HttpContext>;
|
|
132
|
-
}>, {}>;
|
|
133
|
-
export declare class UnknownProviderReason extends UnknownProviderReason_base {
|
|
134
|
-
get retryable(): boolean;
|
|
135
|
-
}
|
|
136
|
-
export declare const LLMErrorReason: Schema.toTaggedUnion<"_tag", readonly [typeof InvalidRequestReason, typeof NoRouteReason, typeof AuthenticationReason, typeof RateLimitReason, typeof QuotaExceededReason, typeof ContentPolicyReason, typeof ProviderInternalReason, typeof TransportReason, typeof InvalidProviderOutputReason, typeof UnknownProviderReason]>;
|
|
137
|
-
export type LLMErrorReason = Schema.Schema.Type<typeof LLMErrorReason>;
|
|
138
|
-
declare const LLMError_base: Schema.Class<LLMError, Schema.TaggedStruct<"LLM.Error", {
|
|
139
|
-
readonly module: Schema.String;
|
|
140
|
-
readonly method: Schema.String;
|
|
141
|
-
readonly reason: Schema.toTaggedUnion<"_tag", readonly [typeof InvalidRequestReason, typeof NoRouteReason, typeof AuthenticationReason, typeof RateLimitReason, typeof QuotaExceededReason, typeof ContentPolicyReason, typeof ProviderInternalReason, typeof TransportReason, typeof InvalidProviderOutputReason, typeof UnknownProviderReason]>;
|
|
142
|
-
}>, import("effect/Cause").YieldableError>;
|
|
143
|
-
export declare class LLMError extends LLMError_base {
|
|
144
|
-
readonly cause: InvalidRequestReason | NoRouteReason | AuthenticationReason | RateLimitReason | QuotaExceededReason | ContentPolicyReason | ProviderInternalReason | TransportReason | InvalidProviderOutputReason | UnknownProviderReason;
|
|
145
|
-
get retryable(): boolean;
|
|
146
|
-
get retryAfterMs(): number;
|
|
147
|
-
get message(): string;
|
|
148
|
-
}
|
|
149
|
-
declare const ToolFailure_base: Schema.Class<ToolFailure, Schema.TaggedStruct<"LLM.ToolFailure", {
|
|
150
|
-
readonly message: Schema.String;
|
|
151
|
-
readonly error: Schema.optional<Schema.Defect>;
|
|
152
|
-
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
153
|
-
}>, import("effect/Cause").YieldableError>;
|
|
154
|
-
/**
|
|
155
|
-
* Failure type for tool execute handlers. Handlers must map their internal
|
|
156
|
-
* errors to this shape; the runtime catches `ToolFailure`s and surfaces them
|
|
157
|
-
* as `tool-error` events plus a `tool-result` of `type: "error"` so the model
|
|
158
|
-
* can self-correct.
|
|
159
|
-
*
|
|
160
|
-
* Anything thrown or yielded by a handler that is not a `ToolFailure` is
|
|
161
|
-
* treated as a defect and fails the stream.
|
|
162
|
-
*/
|
|
163
|
-
export declare class ToolFailure extends ToolFailure_base {
|
|
164
|
-
}
|
|
165
|
-
export {};
|
|
166
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/schema/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAG/B,eAAO,MAAM,6BAA6B,oCAAqC,CAAA;AAC/E,MAAM,MAAM,6BAA6B,GAAG,OAAO,6BAA6B,CAAC,IAAI,CAAA;;;;;;AAErF,qBAAa,kBAAmB,SAAQ,uBAItC;CAAG;;;;;AAEL,qBAAa,mBAAoB,SAAQ,wBAGvC;CAAG;;;;;;;AAEL,qBAAa,oBAAqB,SAAQ,yBAKxC;CAAG;;;;;;;;;AAEL,qBAAa,WAAY,SAAQ,gBAO/B;CAAG;;;;;;;;;AAEL,qBAAa,oBAAqB,SAAQ,yBAOxC;IACA,IAAI,SAAS,YAEZ;CACF;;;;;;;AAED,qBAAa,aAAc,SAAQ,kBAKjC;IACA,IAAI,SAAS,YAEZ;IAED,IAAI,OAAO,WAEV;CACF;;;;;;;;AAED,qBAAa,oBAAqB,SAAQ,yBAMxC;IACA,IAAI,SAAS,YAEZ;CACF;;;;;;;;;AAED,qBAAa,eAAgB,SAAQ,oBAOnC;IACA,IAAI,SAAS,YAEZ;CACF;;;;;;;AAED,qBAAa,mBAAoB,SAAQ,wBAKvC;IACA,IAAI,SAAS,YAEZ;CACF;;;;;;;AAED,qBAAa,mBAAoB,SAAQ,wBAKvC;IACA,IAAI,SAAS,YAEZ;CACF;;;;;;;;;AAED,qBAAa,sBAAuB,SAAQ,2BAO1C;IACA,IAAI,SAAS,YAEZ;CACF;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