@cldmv/llm-translator 0.0.0-stage → 0.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/LICENSE +202 -0
- package/README.md +185 -2
- package/dist/api/convert/anthropic/messages/to/openai/chat/request.mjs +17 -0
- package/dist/api/convert/anthropic/messages/to/openai/chat/response.mjs +2 -0
- package/dist/api/convert/anthropic/messages/to/openai/chat/stream.mjs +2 -0
- package/dist/api/convert/openai/chat/to/anthropic/messages/request.mjs +6 -0
- package/dist/api/convert/openai/chat/to/anthropic/messages/response.mjs +2 -0
- package/dist/api/convert/openai/chat/to/anthropic/messages/stream.mjs +2 -0
- package/dist/api/detect.mjs +2 -0
- package/dist/api/driver/anthropic/detect.mjs +2 -0
- package/dist/api/driver/anthropic/info.mjs +2 -0
- package/dist/api/driver/anthropic/model/list.mjs +2 -0
- package/dist/api/driver/anthropic/settings.mjs +2 -0
- package/dist/api/driver/anthropic/token/count.mjs +2 -0
- package/dist/api/driver/compatible/detect.mjs +2 -0
- package/dist/api/driver/compatible/info.mjs +2 -0
- package/dist/api/driver/compatible/model/list.mjs +2 -0
- package/dist/api/driver/compatible/request.mjs +2 -0
- package/dist/api/driver/compatible/settings.mjs +2 -0
- package/dist/api/driver/openai/detect.mjs +2 -0
- package/dist/api/driver/openai/info.mjs +2 -0
- package/dist/api/driver/openai/model/list.mjs +2 -0
- package/dist/api/driver/openai/request.mjs +2 -0
- package/dist/api/driver/openai/settings.mjs +2 -0
- package/dist/api/driver/vllm/detect.mjs +2 -0
- package/dist/api/driver/vllm/error.mjs +2 -0
- package/dist/api/driver/vllm/info.mjs +2 -0
- package/dist/api/driver/vllm/model/list.mjs +2 -0
- package/dist/api/driver/vllm/probe.mjs +2 -0
- package/dist/api/driver/vllm/request.mjs +2 -0
- package/dist/api/driver/vllm/settings.mjs +2 -0
- package/dist/api/driver/vllm/token/count.mjs +2 -0
- package/dist/api/error/build.mjs +2 -0
- package/dist/api/error/error.mjs +2 -0
- package/dist/api/model/list.mjs +2 -0
- package/dist/api/request.mjs +3 -0
- package/dist/api/response.mjs +2 -0
- package/dist/api/send.mjs +2 -0
- package/dist/api/server/plugin.mjs +2 -0
- package/dist/api/server/start.mjs +2 -0
- package/dist/api/server/stop.mjs +2 -0
- package/dist/api/sse/encode.mjs +4 -0
- package/dist/api/sse/parse.mjs +2 -0
- package/dist/api/sse/ping.mjs +2 -0
- package/dist/api/sse/write.mjs +2 -0
- package/dist/api/status.mjs +2 -0
- package/dist/api/stream.mjs +2 -0
- package/dist/api/token/count.mjs +2 -0
- package/dist/bin/llm-translator.mjs +3 -0
- package/dist/index.cjs +44 -0
- package/dist/index.mjs +2 -0
- package/dist/lib/arguments.mjs +2 -0
- package/dist/lib/capture.mjs +2 -0
- package/dist/lib/cli.mjs +29 -0
- package/dist/lib/config.mjs +2 -0
- package/dist/lib/documents.mjs +12 -0
- package/dist/lib/errors.mjs +2 -0
- package/dist/lib/estimate.mjs +2 -0
- package/dist/lib/finish.mjs +2 -0
- package/dist/lib/http.mjs +2 -0
- package/dist/lib/ids.mjs +2 -0
- package/dist/lib/images.mjs +2 -0
- package/dist/lib/models.mjs +2 -0
- package/dist/lib/normalize.mjs +2 -0
- package/dist/lib/passthrough.mjs +2 -0
- package/dist/lib/pdf.mjs +2 -0
- package/dist/lib/ping.mjs +2 -0
- package/dist/lib/route.mjs +2 -0
- package/dist/lib/routes.mjs +2 -0
- package/dist/lib/runtime.mjs +2 -0
- package/dist/lib/schema.mjs +2 -0
- package/dist/lib/settings.mjs +2 -0
- package/dist/lib/source.mjs +2 -0
- package/dist/lib/sse.mjs +10 -0
- package/dist/lib/thinking.mjs +2 -0
- package/dist/lib/transport.mjs +2 -0
- package/dist/lib/upstream-error.mjs +2 -0
- package/dist/lib/warn.mjs +2 -0
- package/package.json +127 -5
- package/types/src/api/convert/anthropic/messages/to/openai/chat/request.d.mts +28 -0
- package/types/src/api/convert/anthropic/messages/to/openai/chat/response.d.mts +24 -0
- package/types/src/api/convert/anthropic/messages/to/openai/chat/stream.d.mts +29 -0
- package/types/src/api/convert/openai/chat/to/anthropic/messages/request.d.mts +30 -0
- package/types/src/api/convert/openai/chat/to/anthropic/messages/response.d.mts +28 -0
- package/types/src/api/convert/openai/chat/to/anthropic/messages/stream.d.mts +38 -0
- package/types/src/api/detect.d.mts +21 -0
- package/types/src/api/driver/anthropic/detect.d.mts +26 -0
- package/types/src/api/driver/anthropic/info.d.mts +30 -0
- package/types/src/api/driver/anthropic/model/list.d.mts +20 -0
- package/types/src/api/driver/anthropic/settings.d.mts +23 -0
- package/types/src/api/driver/anthropic/token/count.d.mts +20 -0
- package/types/src/api/driver/compatible/detect.d.mts +23 -0
- package/types/src/api/driver/compatible/info.d.mts +29 -0
- package/types/src/api/driver/compatible/model/list.d.mts +20 -0
- package/types/src/api/driver/compatible/request.d.mts +20 -0
- package/types/src/api/driver/compatible/settings.d.mts +23 -0
- package/types/src/api/driver/openai/detect.d.mts +26 -0
- package/types/src/api/driver/openai/info.d.mts +29 -0
- package/types/src/api/driver/openai/model/list.d.mts +20 -0
- package/types/src/api/driver/openai/request.d.mts +20 -0
- package/types/src/api/driver/openai/settings.d.mts +23 -0
- package/types/src/api/driver/vllm/detect.d.mts +20 -0
- package/types/src/api/driver/vllm/error.d.mts +28 -0
- package/types/src/api/driver/vllm/info.d.mts +29 -0
- package/types/src/api/driver/vllm/model/list.d.mts +20 -0
- package/types/src/api/driver/vllm/probe.d.mts +39 -0
- package/types/src/api/driver/vllm/request.d.mts +22 -0
- package/types/src/api/driver/vllm/settings.d.mts +22 -0
- package/types/src/api/driver/vllm/token/count.d.mts +20 -0
- package/types/src/api/error/build.d.mts +26 -0
- package/types/src/api/error/error.d.mts +29 -0
- package/types/src/api/model/list.d.mts +21 -0
- package/types/src/api/request.d.mts +35 -0
- package/types/src/api/response.d.mts +22 -0
- package/types/src/api/send.d.mts +32 -0
- package/types/src/api/server/plugin.d.mts +24 -0
- package/types/src/api/server/start.d.mts +26 -0
- package/types/src/api/server/stop.d.mts +19 -0
- package/types/src/api/sse/encode.d.mts +26 -0
- package/types/src/api/sse/parse.d.mts +24 -0
- package/types/src/api/sse/ping.d.mts +30 -0
- package/types/src/api/sse/write.d.mts +26 -0
- package/types/src/api/status.d.mts +22 -0
- package/types/src/api/stream.d.mts +25 -0
- package/types/src/api/token/count.d.mts +24 -0
- package/types/src/index.d.mts +76 -0
- package/types/src/lib/arguments.d.mts +30 -0
- package/types/src/lib/capture.d.mts +28 -0
- package/types/src/lib/cli.d.mts +49 -0
- package/types/src/lib/config.d.mts +65 -0
- package/types/src/lib/documents.d.mts +43 -0
- package/types/src/lib/errors.d.mts +144 -0
- package/types/src/lib/estimate.d.mts +24 -0
- package/types/src/lib/finish.d.mts +73 -0
- package/types/src/lib/http.d.mts +58 -0
- package/types/src/lib/ids.d.mts +55 -0
- package/types/src/lib/images.d.mts +39 -0
- package/types/src/lib/models.d.mts +25 -0
- package/types/src/lib/normalize.d.mts +37 -0
- package/types/src/lib/passthrough.d.mts +22 -0
- package/types/src/lib/pdf.d.mts +67 -0
- package/types/src/lib/ping.d.mts +24 -0
- package/types/src/lib/route.d.mts +38 -0
- package/types/src/lib/routes.d.mts +22 -0
- package/types/src/lib/runtime.d.mts +24 -0
- package/types/src/lib/schema.d.mts +22 -0
- package/types/src/lib/settings.d.mts +175 -0
- package/types/src/lib/source.d.mts +32 -0
- package/types/src/lib/sse.d.mts +72 -0
- package/types/src/lib/thinking.d.mts +60 -0
- package/types/src/lib/transport.d.mts +31 -0
- package/types/src/lib/upstream-error.d.mts +57 -0
- package/types/src/lib/warn.d.mts +26 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @Project: @cldmv/llm-translator
|
|
4
|
+
* @Filename: /src/lib/cli.mjs
|
|
5
|
+
* @Date: 2026-10-25T12:29:36-07:00 (1792956576)
|
|
6
|
+
* @Author: Nate Corcoran <CLDMV>
|
|
7
|
+
* @Email: <Shinrai@users.noreply.github.com>
|
|
8
|
+
* -----
|
|
9
|
+
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
|
|
10
|
+
* @Last modified time: 2026-10-25T12:59:01-07:00 (1792958341)
|
|
11
|
+
* -----
|
|
12
|
+
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Parse the command line.
|
|
17
|
+
* @param {string[]} argv - Arguments without the node and script paths.
|
|
18
|
+
* @returns {any} Parsed values (see `parseArgs`).
|
|
19
|
+
*/
|
|
20
|
+
export declare function parse(argv: string[]): any;
|
|
21
|
+
/**
|
|
22
|
+
* Merge flags, environment and the config file into `{ translator, server }`.
|
|
23
|
+
* @param {any} values - Parsed flags.
|
|
24
|
+
* @param {Record<string,string | undefined>} env - Environment.
|
|
25
|
+
* @param {any} file - Parsed config file ({} when none).
|
|
26
|
+
* @returns {{translator: any, server: any}} Translator config and server options.
|
|
27
|
+
*/
|
|
28
|
+
export declare function merge(values: any, env: Record<string, string | undefined>, file: any): {
|
|
29
|
+
translator: any;
|
|
30
|
+
server: any;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Default I/O bindings for `main`.
|
|
34
|
+
* @type {{out: (text: string) => void, err: (text: string) => void, onSignal: (handler: () => void) => void}}
|
|
35
|
+
*/
|
|
36
|
+
export declare const processIo: {
|
|
37
|
+
out: (text: string) => void;
|
|
38
|
+
err: (text: string) => void;
|
|
39
|
+
onSignal: (handler: () => void) => void;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Run the CLI. Resolves with the exit code once the server stopped (after a signal) or startup failed.
|
|
43
|
+
* @param {string[]} argv - Arguments without the node and script paths.
|
|
44
|
+
* @param {Record<string,string | undefined>} [env] - Environment.
|
|
45
|
+
* @param {typeof processIo} [io] - Output and signal bindings.
|
|
46
|
+
* @param {any} [lib] - Overridable collaborators `{ createTranslator, version }` (loaded lazily when omitted).
|
|
47
|
+
* @returns {Promise<number>} Process exit code.
|
|
48
|
+
*/
|
|
49
|
+
export declare function main(argv: string[], env?: Record<string, string | undefined>, io?: typeof processIo, lib?: any): Promise<number>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @Project: @cldmv/llm-translator
|
|
4
|
+
* @Filename: /src/lib/config.mjs
|
|
5
|
+
* @Date: 2026-10-25T12:29:36-07:00 (1792956576)
|
|
6
|
+
* @Author: Nate Corcoran <CLDMV>
|
|
7
|
+
* @Email: <Shinrai@users.noreply.github.com>
|
|
8
|
+
* -----
|
|
9
|
+
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
|
|
10
|
+
* @Last modified time: 2026-10-25T14:05:38-07:00 (1792962338)
|
|
11
|
+
* -----
|
|
12
|
+
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
export type UpstreamConfig = {
|
|
16
|
+
/**
|
|
17
|
+
* Display name, defaults to `upstream-<index>`.
|
|
18
|
+
*/
|
|
19
|
+
name?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Base URL of the upstream server (`http://host:8000`).
|
|
22
|
+
*/
|
|
23
|
+
url: string;
|
|
24
|
+
/**
|
|
25
|
+
* Key sent to the upstream.
|
|
26
|
+
*/
|
|
27
|
+
apiKey?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Extra headers sent to the upstream.
|
|
30
|
+
*/
|
|
31
|
+
headers?: Record<string, string>;
|
|
32
|
+
/**
|
|
33
|
+
* Driver name, or `"auto"` (default) to detect.
|
|
34
|
+
*/
|
|
35
|
+
backend?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Models this upstream serves (routing).
|
|
38
|
+
*/
|
|
39
|
+
models?: string[];
|
|
40
|
+
/**
|
|
41
|
+
* Marks the fallback upstream.
|
|
42
|
+
*/
|
|
43
|
+
default?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Settings overrides for this upstream.
|
|
46
|
+
*/
|
|
47
|
+
settings?: object;
|
|
48
|
+
/**
|
|
49
|
+
* Server version (skips nothing, but feeds version-mapped driver settings).
|
|
50
|
+
*/
|
|
51
|
+
version?: string;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Normalize one upstream entry into the runtime endpoint record.
|
|
55
|
+
* @param {string | UpstreamConfig} entry - Upstream URL or config object.
|
|
56
|
+
* @param {number} index - Position in the list.
|
|
57
|
+
* @returns {any} Runtime endpoint.
|
|
58
|
+
*/
|
|
59
|
+
export declare function endpoint(entry: string | UpstreamConfig, index: number): any;
|
|
60
|
+
/**
|
|
61
|
+
* Validate and normalize the translator config.
|
|
62
|
+
* @param {any} [config] - Raw config passed to `createTranslator`.
|
|
63
|
+
* @returns {any} Normalized config (a fresh any; the input is not mutated).
|
|
64
|
+
*/
|
|
65
|
+
export declare function normalize(config?: any): any;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @Project: @cldmv/llm-translator
|
|
4
|
+
* @Filename: /src/lib/documents.mjs
|
|
5
|
+
* @Date: 2026-10-25T12:28:19-07:00 (1792956499)
|
|
6
|
+
* @Author: Nate Corcoran <CLDMV>
|
|
7
|
+
* @Email: <Shinrai@users.noreply.github.com>
|
|
8
|
+
* -----
|
|
9
|
+
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
|
|
10
|
+
* @Last modified time: 2026-10-25T12:59:01-07:00 (1792958341)
|
|
11
|
+
* -----
|
|
12
|
+
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
export type DocumentContext = {
|
|
16
|
+
/**
|
|
17
|
+
* - Resolved settings.
|
|
18
|
+
*/
|
|
19
|
+
settings: import("./settings.mjs").Settings;
|
|
20
|
+
/**
|
|
21
|
+
* - `tool_use` inputs by id, to recover file paths.
|
|
22
|
+
*/
|
|
23
|
+
toolInputs: Map<string, any>;
|
|
24
|
+
/**
|
|
25
|
+
* - Id of the tool call whose result contains the document, if any.
|
|
26
|
+
*/
|
|
27
|
+
toolUseId: string | null;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Context for converting documents.
|
|
31
|
+
* @typedef {object} DocumentContext
|
|
32
|
+
* @property {import("./settings.mjs").Settings} settings - Resolved settings.
|
|
33
|
+
* @property {Map<string, any>} toolInputs - `tool_use` inputs by id, to recover file paths.
|
|
34
|
+
* @property {string|null} toolUseId - Id of the tool call whose result contains the document, if any.
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* Convert a document block into Anthropic text/image blocks.
|
|
38
|
+
* @param {any} block - Anthropic `document` block.
|
|
39
|
+
* @param {DocumentContext} ctx - Conversion context.
|
|
40
|
+
* @returns {Promise<any[]>} Content blocks (`text` and `image`).
|
|
41
|
+
* @throws {TranslatorError} When `documents` is `"error"` or a PDF violates the size/page limits.
|
|
42
|
+
*/
|
|
43
|
+
export declare function expand(block: any, ctx: DocumentContext): Promise<any[]>;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @Project: @cldmv/llm-translator
|
|
4
|
+
* @Filename: /src/lib/errors.mjs
|
|
5
|
+
* @Date: 2026-10-25T12:29:30-07:00 (1792956570)
|
|
6
|
+
* @Author: Nate Corcoran <CLDMV>
|
|
7
|
+
* @Email: <Shinrai@users.noreply.github.com>
|
|
8
|
+
* -----
|
|
9
|
+
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
|
|
10
|
+
* @Last modified time: 2026-10-25T13:31:30-07:00 (1792960290)
|
|
11
|
+
* -----
|
|
12
|
+
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* @fileoverview Error type shared by every converter, plus helpers that render an error in either wire protocol.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Error raised for requests or upstream replies the translator cannot (or will not) convert. Carries enough
|
|
20
|
+
* information to be rendered as an Anthropic or an OpenAI error body.
|
|
21
|
+
*/
|
|
22
|
+
export declare class TranslatorError extends Error {
|
|
23
|
+
code: string;
|
|
24
|
+
status: number;
|
|
25
|
+
type: string;
|
|
26
|
+
param: string;
|
|
27
|
+
details: unknown;
|
|
28
|
+
/**
|
|
29
|
+
* @param {string} message - Human readable message (sent to the client).
|
|
30
|
+
* @param {object} [options] - Error metadata.
|
|
31
|
+
* @param {string} [options.code] - Stable machine readable code (for example `"unsupported_field"`).
|
|
32
|
+
* @param {number} [options.status] - HTTP status to answer with.
|
|
33
|
+
* @param {string} [options.type] - Anthropic style error type.
|
|
34
|
+
* @param {string|null} [options.param] - Offending request parameter, when known.
|
|
35
|
+
* @param {unknown} [options.details] - Extra data for logs and tests.
|
|
36
|
+
*/
|
|
37
|
+
constructor(message: string, options?: {
|
|
38
|
+
code?: string;
|
|
39
|
+
status?: number;
|
|
40
|
+
type?: string;
|
|
41
|
+
param?: string | null;
|
|
42
|
+
details?: unknown;
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* Render as an Anthropic error body.
|
|
46
|
+
* @returns {{ type: "error", error: { type: string, message: string } }} Anthropic error body.
|
|
47
|
+
*/
|
|
48
|
+
toAnthropic(): {
|
|
49
|
+
type: "error";
|
|
50
|
+
error: {
|
|
51
|
+
type: string;
|
|
52
|
+
message: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Render as an OpenAI error body.
|
|
57
|
+
* @returns {{ error: { message: string, type: string, param: string|null, code: string|number|null } }} OpenAI error body.
|
|
58
|
+
*/
|
|
59
|
+
toOpenAI(): {
|
|
60
|
+
error: {
|
|
61
|
+
message: string;
|
|
62
|
+
type: string;
|
|
63
|
+
param: string | null;
|
|
64
|
+
code: string | number | null;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Anthropic error type for an HTTP status.
|
|
70
|
+
* @param {number} status - HTTP status code.
|
|
71
|
+
* @returns {string} Anthropic error type.
|
|
72
|
+
*/
|
|
73
|
+
export declare function statusToAnthropicType(status: number): string;
|
|
74
|
+
/**
|
|
75
|
+
* HTTP status for an Anthropic error type.
|
|
76
|
+
* @param {string} type - Anthropic error type.
|
|
77
|
+
* @returns {number} HTTP status code.
|
|
78
|
+
*/
|
|
79
|
+
export declare function anthropicTypeToStatus(type: string): number;
|
|
80
|
+
/**
|
|
81
|
+
* OpenAI style error type for an Anthropic error type.
|
|
82
|
+
* @param {string} type - Anthropic error type.
|
|
83
|
+
* @returns {string} OpenAI error type.
|
|
84
|
+
*/
|
|
85
|
+
export declare function anthropicToOpenAIType(type: string): string;
|
|
86
|
+
/**
|
|
87
|
+
* Anthropic error type for an OpenAI style error object (type and/or numeric code and/or HTTP status).
|
|
88
|
+
* @param {{ type?: string|null, code?: string|number|null }} error - OpenAI error object.
|
|
89
|
+
* @param {number} [status] - HTTP status of the reply, when known.
|
|
90
|
+
* @returns {string} Anthropic error type.
|
|
91
|
+
*/
|
|
92
|
+
export declare function openaiToAnthropicType(error: {
|
|
93
|
+
type?: string | null;
|
|
94
|
+
code?: string | number | null;
|
|
95
|
+
}, status?: number): string;
|
|
96
|
+
/**
|
|
97
|
+
* Build an Anthropic error body.
|
|
98
|
+
* @param {string} type - Anthropic error type.
|
|
99
|
+
* @param {string} message - Error message.
|
|
100
|
+
* @returns {{ type: "error", error: { type: string, message: string } }} Anthropic error body.
|
|
101
|
+
*/
|
|
102
|
+
export declare function anthropicError(type: string, message: string): {
|
|
103
|
+
type: "error";
|
|
104
|
+
error: {
|
|
105
|
+
type: string;
|
|
106
|
+
message: string;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Build an OpenAI error body.
|
|
111
|
+
* @param {string} message - Error message.
|
|
112
|
+
* @param {{ type?: string, param?: string|null, code?: string|number|null }} [fields] - Optional fields.
|
|
113
|
+
* @returns {{ error: { message: string, type: string, param: string|null, code: string|number|null } }} OpenAI error body.
|
|
114
|
+
*/
|
|
115
|
+
export declare function openaiError(message: string, { type, param, code }?: {
|
|
116
|
+
type?: string;
|
|
117
|
+
param?: string | null;
|
|
118
|
+
code?: string | number | null;
|
|
119
|
+
}): {
|
|
120
|
+
error: {
|
|
121
|
+
message: string;
|
|
122
|
+
type: string;
|
|
123
|
+
param: string | null;
|
|
124
|
+
code: string | number | null;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Detect an OpenAI/vLLM "context length exceeded" message and rewrite it in Anthropic's wording
|
|
129
|
+
* (`prompt is too long: <n> tokens > <max> maximum`), which Claude Code recognises and answers with
|
|
130
|
+
* auto-compaction. `n` is the total the request asked for (prompt plus requested completion) when the message
|
|
131
|
+
* reports it, otherwise the prompt size, and `max + 1` when the message gives no size, so `n` always exceeds the maximum.
|
|
132
|
+
* @param {string} message - Upstream error message.
|
|
133
|
+
* @returns {string|null} Rewritten message, or null when the message is not a context overflow.
|
|
134
|
+
*/
|
|
135
|
+
export declare function rewriteContextOverflow(message: string): string | null;
|
|
136
|
+
/**
|
|
137
|
+
* Token counts from a context-overflow message.
|
|
138
|
+
* @param {string} message - Upstream error message.
|
|
139
|
+
* @returns {{ prompt: number, max: number }|null} Counts (`prompt` is the requested total, or the prompt size, or `max + 1`), or null when not an overflow.
|
|
140
|
+
*/
|
|
141
|
+
export declare function contextOverflow(message: string): {
|
|
142
|
+
prompt: number;
|
|
143
|
+
max: number;
|
|
144
|
+
} | null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @Project: @cldmv/llm-translator
|
|
4
|
+
* @Filename: /src/lib/estimate.mjs
|
|
5
|
+
* @Date: 2026-10-25T12:29:36-07:00 (1792956576)
|
|
6
|
+
* @Author: Nate Corcoran <CLDMV>
|
|
7
|
+
* @Email: <Shinrai@users.noreply.github.com>
|
|
8
|
+
* -----
|
|
9
|
+
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
|
|
10
|
+
* @Last modified time: 2026-10-25T12:59:01-07:00 (1792958341)
|
|
11
|
+
* -----
|
|
12
|
+
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* @fileoverview Prompt size estimate for upstreams that cannot count tokens.
|
|
17
|
+
* @module @cldmv/llm-translator/lib/estimate
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Rough prompt size: one token per four characters of the serialized system prompt, messages and tools.
|
|
21
|
+
* @param {any} body - Upstream request body.
|
|
22
|
+
* @returns {number} Estimated tokens.
|
|
23
|
+
*/
|
|
24
|
+
export declare function estimate(body: any): number;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @Project: @cldmv/llm-translator
|
|
4
|
+
* @Filename: /src/lib/finish.mjs
|
|
5
|
+
* @Date: 2026-10-25T12:28:19-07:00 (1792956499)
|
|
6
|
+
* @Author: Nate Corcoran <CLDMV>
|
|
7
|
+
* @Email: <Shinrai@users.noreply.github.com>
|
|
8
|
+
* -----
|
|
9
|
+
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
|
|
10
|
+
* @Last modified time: 2026-10-25T12:59:01-07:00 (1792958341)
|
|
11
|
+
* -----
|
|
12
|
+
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* @fileoverview Stop-reason and usage mapping between the two protocols.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Anthropic stop reason (and stop sequence) for an OpenAI choice.
|
|
20
|
+
* @param {string|null|undefined} finishReason - OpenAI `finish_reason`.
|
|
21
|
+
* @param {{ hasToolCalls: boolean, matchedStop?: unknown, argumentsComplete?: boolean }} info - Whether tool calls were produced, vLLM's `stop_reason` (a string for a matched stop string), and whether the last tool call's arguments are complete. A `length` stop with incomplete arguments is `max_tokens`, not `tool_use`.
|
|
22
|
+
* @returns {{ stop_reason: string, stop_sequence: string|null }} Anthropic stop fields.
|
|
23
|
+
*/
|
|
24
|
+
export declare function toAnthropicStop(finishReason: string | null | undefined, { hasToolCalls, matchedStop, argumentsComplete }: {
|
|
25
|
+
hasToolCalls: boolean;
|
|
26
|
+
matchedStop?: unknown;
|
|
27
|
+
argumentsComplete?: boolean;
|
|
28
|
+
}): {
|
|
29
|
+
stop_reason: string;
|
|
30
|
+
stop_sequence: string | null;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* OpenAI `finish_reason` for an Anthropic stop reason.
|
|
34
|
+
* @param {string|null|undefined} stopReason - Anthropic `stop_reason`.
|
|
35
|
+
* @returns {string} OpenAI finish reason.
|
|
36
|
+
*/
|
|
37
|
+
export declare function toOpenAIFinish(stopReason: string | null | undefined): string;
|
|
38
|
+
/**
|
|
39
|
+
* Anthropic usage from an OpenAI usage object. Cached prompt tokens (reported by vLLM only with prompt-token
|
|
40
|
+
* details enabled) are reported as `cache_read_input_tokens` and subtracted from `input_tokens`.
|
|
41
|
+
* @param {{ prompt_tokens?: number, completion_tokens?: number, prompt_tokens_details?: { cached_tokens?: number }|null }|null|undefined} usage - OpenAI usage.
|
|
42
|
+
* @returns {{ input_tokens: number, output_tokens: number, cache_creation_input_tokens: number, cache_read_input_tokens: number }} Anthropic usage.
|
|
43
|
+
*/
|
|
44
|
+
export declare function toAnthropicUsage(usage: {
|
|
45
|
+
prompt_tokens?: number;
|
|
46
|
+
completion_tokens?: number;
|
|
47
|
+
prompt_tokens_details?: {
|
|
48
|
+
cached_tokens?: number;
|
|
49
|
+
} | null;
|
|
50
|
+
} | null | undefined): {
|
|
51
|
+
input_tokens: number;
|
|
52
|
+
output_tokens: number;
|
|
53
|
+
cache_creation_input_tokens: number;
|
|
54
|
+
cache_read_input_tokens: number;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* OpenAI usage from an Anthropic usage object (cache tokens count as prompt tokens).
|
|
58
|
+
* @param {{ input_tokens?: number, output_tokens?: number, cache_creation_input_tokens?: number|null, cache_read_input_tokens?: number|null }|null|undefined} usage - Anthropic usage.
|
|
59
|
+
* @returns {{ prompt_tokens: number, completion_tokens: number, total_tokens: number, prompt_tokens_details?: { cached_tokens: number } }} OpenAI usage.
|
|
60
|
+
*/
|
|
61
|
+
export declare function toOpenAIUsage(usage: {
|
|
62
|
+
input_tokens?: number;
|
|
63
|
+
output_tokens?: number;
|
|
64
|
+
cache_creation_input_tokens?: number | null;
|
|
65
|
+
cache_read_input_tokens?: number | null;
|
|
66
|
+
} | null | undefined): {
|
|
67
|
+
prompt_tokens: number;
|
|
68
|
+
completion_tokens: number;
|
|
69
|
+
total_tokens: number;
|
|
70
|
+
prompt_tokens_details?: {
|
|
71
|
+
cached_tokens: number;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @Project: @cldmv/llm-translator
|
|
4
|
+
* @Filename: /src/lib/http.mjs
|
|
5
|
+
* @Date: 2026-10-25T12:29:36-07:00 (1792956576)
|
|
6
|
+
* @Author: Nate Corcoran <CLDMV>
|
|
7
|
+
* @Email: <Shinrai@users.noreply.github.com>
|
|
8
|
+
* -----
|
|
9
|
+
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
|
|
10
|
+
* @Last modified time: 2026-10-25T12:59:02-07:00 (1792958342)
|
|
11
|
+
* -----
|
|
12
|
+
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* @fileoverview Small HTTP helpers shared by the api leaves: URL joining, auth headers, JSON requests.
|
|
17
|
+
* @module @cldmv/llm-translator/lib/http
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Join an endpoint base URL and a path.
|
|
21
|
+
* @param {string} base - Base URL without trailing slash.
|
|
22
|
+
* @param {string} path - Path starting with `/`.
|
|
23
|
+
* @returns {string} Absolute URL.
|
|
24
|
+
*/
|
|
25
|
+
export declare function join(base: string, path: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Whether a listen address only accepts connections from this machine.
|
|
28
|
+
* @param {string} host - Host or address.
|
|
29
|
+
* @returns {boolean} True for `localhost`, `127.x.x.x` and `::1`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isLoopback(host: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Build the request headers for an upstream call.
|
|
34
|
+
* @param {any} endpoint - Runtime endpoint.
|
|
35
|
+
* @param {string} [auth] - `"bearer"` (default) or `"x-api-key"`.
|
|
36
|
+
* @param {Record<string,string>} [extra] - Extra headers applied last.
|
|
37
|
+
* @returns {Record<string,string>} Header map.
|
|
38
|
+
*/
|
|
39
|
+
export declare function headers(endpoint: any, auth?: string, extra?: Record<string, string>): Record<string, string>;
|
|
40
|
+
/**
|
|
41
|
+
* Convert a fetch `Headers` object (or plain object) to a lowercase plain object.
|
|
42
|
+
* @param {Headers | Record<string,string> | undefined} source - Header source.
|
|
43
|
+
* @returns {Record<string,string>} Plain header map.
|
|
44
|
+
*/
|
|
45
|
+
export declare function plain(source: Headers | Record<string, string> | undefined): Record<string, string>;
|
|
46
|
+
/**
|
|
47
|
+
* Perform a request and parse the JSON body. Never throws: network failures and non-JSON bodies are reported in the result.
|
|
48
|
+
* @param {Function} transport - fetch-compatible function.
|
|
49
|
+
* @param {string} url - Absolute URL.
|
|
50
|
+
* @param {any} [options] - `{ method, headers, body, signal, timeout }`.
|
|
51
|
+
* @returns {Promise<{ok: boolean, status: number, body: any, error?: Error}>} Outcome.
|
|
52
|
+
*/
|
|
53
|
+
export declare function json(transport: Function, url: string, options?: any): Promise<{
|
|
54
|
+
ok: boolean;
|
|
55
|
+
status: number;
|
|
56
|
+
body: any;
|
|
57
|
+
error?: Error;
|
|
58
|
+
}>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @Project: @cldmv/llm-translator
|
|
4
|
+
* @Filename: /src/lib/ids.mjs
|
|
5
|
+
* @Date: 2026-10-25T12:28:19-07:00 (1792956499)
|
|
6
|
+
* @Author: Nate Corcoran <CLDMV>
|
|
7
|
+
* @Email: <Shinrai@users.noreply.github.com>
|
|
8
|
+
* -----
|
|
9
|
+
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
|
|
10
|
+
* @Last modified time: 2026-10-25T12:59:02-07:00 (1792958342)
|
|
11
|
+
* -----
|
|
12
|
+
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Anthropic style message id.
|
|
17
|
+
* @returns {string} `msg_...` id.
|
|
18
|
+
*/
|
|
19
|
+
export declare function messageId(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Anthropic style tool-use id.
|
|
22
|
+
* @returns {string} `toolu_...` id.
|
|
23
|
+
*/
|
|
24
|
+
export declare function toolUseId(): string;
|
|
25
|
+
/**
|
|
26
|
+
* OpenAI style completion id.
|
|
27
|
+
* @returns {string} `chatcmpl-...` id.
|
|
28
|
+
*/
|
|
29
|
+
export declare function completionId(): string;
|
|
30
|
+
/**
|
|
31
|
+
* Make a tool-call id valid for Anthropic (`[a-zA-Z0-9_-]+`). Valid ids pass through unchanged, invalid characters
|
|
32
|
+
* (for example kimi's `functions.name:0`) become `_`, and a missing or empty id is replaced by a fresh one. The
|
|
33
|
+
* mapping is deterministic so a tool call and its later tool result agree.
|
|
34
|
+
* @param {unknown} id - Upstream id.
|
|
35
|
+
* @returns {string} Anthropic-valid id.
|
|
36
|
+
*/
|
|
37
|
+
export declare function anthropicToolId(id: unknown): string;
|
|
38
|
+
/**
|
|
39
|
+
* Create a tool-name fitter. Names that already satisfy `pattern` and `max` pass through; others are sanitized and,
|
|
40
|
+
* when too long, shortened with a hash suffix. Every changed name is recorded in `map` (`fitted -> original`) so the
|
|
41
|
+
* original can be restored on the way back. Fitted names are kept unique.
|
|
42
|
+
* @param {{ max: number, map?: Record<string, string> }} options - Maximum length and the (JSON-serializable) map to record into.
|
|
43
|
+
* @returns {(name: string) => string} Fitter function.
|
|
44
|
+
*/
|
|
45
|
+
export declare function createNameFitter({ max, map }: {
|
|
46
|
+
max: number;
|
|
47
|
+
map?: Record<string, string>;
|
|
48
|
+
}): (name: string) => string;
|
|
49
|
+
/**
|
|
50
|
+
* Original tool name for a fitted one (names that were never changed map to themselves).
|
|
51
|
+
* @param {Record<string, string>} map - `fitted -> original` map from the conversion state.
|
|
52
|
+
* @param {string} name - Name seen on the wire.
|
|
53
|
+
* @returns {string} Original name.
|
|
54
|
+
*/
|
|
55
|
+
export declare function restoreName(map: Record<string, string>, name: string): string;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @Project: @cldmv/llm-translator
|
|
4
|
+
* @Filename: /src/lib/images.mjs
|
|
5
|
+
* @Date: 2026-10-26T06:00:20-07:00 (1793019620)
|
|
6
|
+
* @Author: Nate Corcoran <CLDMV>
|
|
7
|
+
* @Email: <Shinrai@users.noreply.github.com>
|
|
8
|
+
* -----
|
|
9
|
+
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
|
|
10
|
+
* @Last modified time: 2026-10-26T15:38:55-07:00 (1793054335)
|
|
11
|
+
* -----
|
|
12
|
+
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* @fileoverview Image handling for upstreams that turn out to be text-only: recognising the refusal, finding images in a
|
|
17
|
+
* Chat Completions body and replacing them with a note.
|
|
18
|
+
* @module @cldmv/llm-translator/lib/images
|
|
19
|
+
*/
|
|
20
|
+
/** Text that replaces an image when the model does not accept images. */
|
|
21
|
+
export declare const NOTE = "[An image was omitted because this model does not accept images.]";
|
|
22
|
+
/**
|
|
23
|
+
* Does an upstream error message say the model does not accept images?
|
|
24
|
+
* @param {string} message - Upstream error message.
|
|
25
|
+
* @returns {boolean} True for a known "no image input" wording.
|
|
26
|
+
*/
|
|
27
|
+
export declare function refused(message: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Does a Chat Completions body carry image parts?
|
|
30
|
+
* @param {any} body - Upstream request body.
|
|
31
|
+
* @returns {boolean} True when any message content has an `image_url` part.
|
|
32
|
+
*/
|
|
33
|
+
export declare function carries(body: any): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Copy a Chat Completions body with every image part replaced by a short text note.
|
|
36
|
+
* @param {any} body - Upstream request body.
|
|
37
|
+
* @returns {any} New body; messages without images are shared with the input.
|
|
38
|
+
*/
|
|
39
|
+
export declare function strip(body: any): any;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @Project: @cldmv/llm-translator
|
|
4
|
+
* @Filename: /src/lib/models.mjs
|
|
5
|
+
* @Date: 2026-10-25T12:29:36-07:00 (1792956576)
|
|
6
|
+
* @Author: Nate Corcoran <CLDMV>
|
|
7
|
+
* @Email: <Shinrai@users.noreply.github.com>
|
|
8
|
+
* -----
|
|
9
|
+
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
|
|
10
|
+
* @Last modified time: 2026-10-25T12:59:02-07:00 (1792958342)
|
|
11
|
+
* -----
|
|
12
|
+
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Fetch and normalize the models an upstream reports.
|
|
17
|
+
* @param {any} context - `{ endpoint, transport, signal, timeout, auth, extraHeaders }`.
|
|
18
|
+
* @returns {Promise<{id: string, created?: number, owned_by?: string, max_model_len?: number}[] | null>} Models, or null when the upstream did not answer with a model list.
|
|
19
|
+
*/
|
|
20
|
+
export declare function fetchModels({ endpoint, transport, signal, timeout, auth, extraHeaders }: any): Promise<{
|
|
21
|
+
id: string;
|
|
22
|
+
created?: number;
|
|
23
|
+
owned_by?: string;
|
|
24
|
+
max_model_len?: number;
|
|
25
|
+
}[] | null>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @Project: @cldmv/llm-translator
|
|
4
|
+
* @Filename: /src/lib/normalize.mjs
|
|
5
|
+
* @Date: 2026-10-25T12:29:36-07:00 (1792956576)
|
|
6
|
+
* @Author: Nate Corcoran <CLDMV>
|
|
7
|
+
* @Email: <Shinrai@users.noreply.github.com>
|
|
8
|
+
* -----
|
|
9
|
+
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
|
|
10
|
+
* @Last modified time: 2026-10-25T12:59:02-07:00 (1792958342)
|
|
11
|
+
* -----
|
|
12
|
+
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* @fileoverview Request normalizers shared by the OpenAI-protocol drivers.
|
|
17
|
+
* @module @cldmv/llm-translator/lib/normalize
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Remove tool fields that strict OpenAI-compatible servers reject when no tools are present.
|
|
21
|
+
* @param {any} body - Chat Completions request body (mutated copy is returned).
|
|
22
|
+
* @returns {any} Normalized body.
|
|
23
|
+
*/
|
|
24
|
+
export declare function noEmptyTools(body: any): any;
|
|
25
|
+
/**
|
|
26
|
+
* Parse a server version string (`0.19.0rc1`, `0.32.0+cu126`) into numeric parts.
|
|
27
|
+
* @param {string | undefined} version - Version string.
|
|
28
|
+
* @returns {number[] | null} `[major, minor, patch]`, or null when unparseable.
|
|
29
|
+
*/
|
|
30
|
+
export declare function semver(version: string | undefined): number[] | null;
|
|
31
|
+
/**
|
|
32
|
+
* Is `version` at least `minimum`? An unknown version counts as new (latest behavior).
|
|
33
|
+
* @param {string | undefined} version - Version under test.
|
|
34
|
+
* @param {string} minimum - Minimum version such as `"0.19.0"`.
|
|
35
|
+
* @returns {boolean} True when the version is unknown or >= minimum.
|
|
36
|
+
*/
|
|
37
|
+
export declare function atLeast(version: string | undefined, minimum: string): boolean;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @Project: @cldmv/llm-translator
|
|
4
|
+
* @Filename: /src/lib/passthrough.mjs
|
|
5
|
+
* @Date: 2026-10-25T12:49:46-07:00 (1792957786)
|
|
6
|
+
* @Author: Nate Corcoran <CLDMV>
|
|
7
|
+
* @Email: <Shinrai@users.noreply.github.com>
|
|
8
|
+
* -----
|
|
9
|
+
* @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
|
|
10
|
+
* @Last modified time: 2026-10-25T12:59:02-07:00 (1792958342)
|
|
11
|
+
* -----
|
|
12
|
+
* @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Keep only known Chat Completions and documented vLLM extension fields, so an untrusted client cannot inject server-side
|
|
17
|
+
* controls such as `kv_transfer_params`, `vllm_xargs`, `chat_template`, `cache_salt` or `priority`. `stream_options` is
|
|
18
|
+
* reduced to the usage flags.
|
|
19
|
+
* @param {any} body - Client request body.
|
|
20
|
+
* @returns {any} Filtered copy.
|
|
21
|
+
*/
|
|
22
|
+
export declare function filterChatBody(body: any): any;
|