@wengine-ai/llms 2.3.2410 → 2.3.2412
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 +2 -2
- package/dist/api/routes.d.ts +18 -0
- package/dist/ccr/usage-store.d.ts +16 -0
- package/dist/cjs/server.cjs +193 -193
- package/dist/cjs/server.cjs.map +4 -4
- package/dist/esm/server.mjs +192 -192
- package/dist/esm/server.mjs.map +4 -4
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/output/temp-file-handler.d.ts +8 -38
- package/dist/plugins/output/temp-file-retention.d.ts +14 -0
- package/dist/plugins/output/types.d.ts +7 -1
- package/dist/plugins/token-speed.d.ts +15 -0
- package/dist/transformer/amd.transformer.d.ts +13 -0
- package/dist/transformer/index.d.ts +2 -0
- package/package.json +2 -2
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,48 +1,18 @@
|
|
|
1
|
-
import { OutputHandler, OutputOptions } from './types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
export interface TempFileOutputConfig {
|
|
6
|
-
/**
|
|
7
|
-
* Subdirectory under system temp directory (default: 'claude-code-router')
|
|
8
|
-
*/
|
|
9
|
-
subdirectory?: string;
|
|
10
|
-
/**
|
|
11
|
-
* File extension (default: 'json')
|
|
12
|
-
*/
|
|
13
|
-
extension?: string;
|
|
14
|
-
/**
|
|
15
|
-
* Whether to include timestamp in filename (default: true)
|
|
16
|
-
*/
|
|
17
|
-
includeTimestamp?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Custom prefix for temp files (default: 'session')
|
|
20
|
-
*/
|
|
21
|
-
prefix?: string;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Temp file output handler
|
|
25
|
-
* Writes data to temporary files in system temp directory
|
|
26
|
-
*/
|
|
1
|
+
import type { OutputHandler, OutputOptions, TempFileOutputConfig } from './types';
|
|
2
|
+
export type { TempFileOutputConfig } from './types';
|
|
3
|
+
/** Writes disposable metrics with exclusive, atomic publication and bounded async retention. */
|
|
27
4
|
export declare class TempFileOutputHandler implements OutputHandler {
|
|
28
5
|
type: "temp-file";
|
|
29
6
|
private config;
|
|
30
7
|
private baseDir;
|
|
8
|
+
private readonly controller;
|
|
9
|
+
private readonly stopSchedule?;
|
|
31
10
|
constructor(config?: TempFileOutputConfig);
|
|
32
|
-
/**
|
|
33
|
-
* Ensure directory exists
|
|
34
|
-
*/
|
|
35
11
|
private ensureDir;
|
|
36
|
-
/**
|
|
37
|
-
* Get file path for temp file
|
|
38
|
-
*/
|
|
39
12
|
private getFilePath;
|
|
40
|
-
/**
|
|
41
|
-
* Output data to temp file
|
|
42
|
-
*/
|
|
43
13
|
output(data: any, options?: OutputOptions): Promise<boolean>;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
14
|
+
pruneOldFiles(signal?: AbortSignal): Promise<number>;
|
|
15
|
+
/** Stop owned scans and release the shared schedule. Does not remove any directory or files. */
|
|
16
|
+
dispose(): void;
|
|
47
17
|
getBaseDir(): string;
|
|
48
18
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Serialize publication/pruning of one path across handler instances, not an entire scan. */
|
|
2
|
+
export declare function withTempFilePathLock<T>(filePath: string, action: () => Promise<T>): Promise<T>;
|
|
3
|
+
/** Prune only files owned by this handler, including abandoned exclusive publication files. */
|
|
4
|
+
export declare function pruneTempFileOutputFiles(baseDir: string, prefix: string, extension: string, retentionMs: number, signal?: AbortSignal): Promise<number>;
|
|
5
|
+
/** Only legacy timestamped metrics in the old root; never touch new files or descend into v2. */
|
|
6
|
+
export declare function pruneLegacyTokenSpeedFiles(baseDir: string, signal?: AbortSignal): Promise<number>;
|
|
7
|
+
/** Shared unrefed schedules; disposal aborts a running pass when the last owner leaves. */
|
|
8
|
+
export declare function scheduleTempFileCleanup(key: string, prune: (signal: AbortSignal) => Promise<number>, firstDelayMs: number): () => void;
|
|
9
|
+
/**
|
|
10
|
+
* Independent of the token-speed plugin's enabled state. No permanent migration marker:
|
|
11
|
+
* concurrently running older versions may keep publishing in the old root.
|
|
12
|
+
* The optional disposer is useful for service shutdown and isolated tests.
|
|
13
|
+
*/
|
|
14
|
+
export declare function startLegacyTokenSpeedCleanup(baseDir?: string): () => void;
|
|
@@ -130,13 +130,19 @@ export interface TempFileOutputConfig {
|
|
|
130
130
|
*/
|
|
131
131
|
extension?: string;
|
|
132
132
|
/**
|
|
133
|
-
* Whether to include timestamp in filename (default:
|
|
133
|
+
* Whether to include timestamp in filename (default: false).
|
|
134
|
+
* Exact-name readers require false; true keeps the explicitly requested timestamped format.
|
|
134
135
|
*/
|
|
135
136
|
includeTimestamp?: boolean;
|
|
136
137
|
/**
|
|
137
138
|
* Custom prefix for temp files (default: 'session')
|
|
138
139
|
*/
|
|
139
140
|
prefix?: string;
|
|
141
|
+
/**
|
|
142
|
+
* File retention in milliseconds (default: 3600000).
|
|
143
|
+
* Non-finite values or values <= 0 disable pruning and cleanup timers.
|
|
144
|
+
*/
|
|
145
|
+
retentionMs?: number;
|
|
140
146
|
}
|
|
141
147
|
/**
|
|
142
148
|
* Output handler registration configuration
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import { CCRPlugin } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Single source of truth for the temp-file handler config the token-speed
|
|
4
|
+
* plugin registers. Both registration paths (plugin-registration.ts and the
|
|
5
|
+
* default-reporter path below) MUST call this factory instead of inlining a
|
|
6
|
+
* copy — divergent copies of this config are exactly what produced the
|
|
7
|
+
* writer/reader drift behind the 3.23M-file temp directory incident.
|
|
8
|
+
* The reader side (usage-store.readTokenSpeedStats, CLI statusline) reconstructs
|
|
9
|
+
* the same path from TOKEN_SPEED_TEMP_SUBDIRECTORY + sanitizeTempFileKey.
|
|
10
|
+
*/
|
|
11
|
+
export declare function tokenSpeedTempFileHandlerConfig(): {
|
|
12
|
+
subdirectory: string;
|
|
13
|
+
extension: string;
|
|
14
|
+
includeTimestamp: false;
|
|
15
|
+
prefix: string;
|
|
16
|
+
};
|
|
2
17
|
/**
|
|
3
18
|
* Token speed measurement plugin
|
|
4
19
|
*/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { UnifiedChatRequest } from "../types/llm";
|
|
2
|
+
import { Transformer } from "../types/transformer";
|
|
3
|
+
/** Adapt AMD chat completions' model-specific effort and reasoning fields. */
|
|
4
|
+
export declare class AmdTransformer implements Transformer {
|
|
5
|
+
static TransformerName: string;
|
|
6
|
+
name: string;
|
|
7
|
+
private resolveEffort;
|
|
8
|
+
transformRequestIn(request: UnifiedChatRequest): Promise<UnifiedChatRequest>;
|
|
9
|
+
transformResponseOut(response: Response): Promise<Response>;
|
|
10
|
+
private liftMessageReasoning;
|
|
11
|
+
/** Lift reasoning per SSE data line without changing event boundaries. */
|
|
12
|
+
private transformStream;
|
|
13
|
+
}
|
|
@@ -22,6 +22,7 @@ import { ForceReasoningTransformer } from "./forcereasoning.transformer";
|
|
|
22
22
|
import { KimiTransformer } from "./kimi.transformer";
|
|
23
23
|
import { OpenCodeTransformer } from "./opencode.transformer";
|
|
24
24
|
import { DefaultThinkingTransformer } from "./defaultthinking.transformer";
|
|
25
|
+
import { AmdTransformer } from "./amd.transformer";
|
|
25
26
|
declare const _default: {
|
|
26
27
|
AnthropicTransformer: typeof AnthropicTransformer;
|
|
27
28
|
GeminiTransformer: typeof GeminiTransformer;
|
|
@@ -47,5 +48,6 @@ declare const _default: {
|
|
|
47
48
|
KimiTransformer: typeof KimiTransformer;
|
|
48
49
|
OpenCodeTransformer: typeof OpenCodeTransformer;
|
|
49
50
|
DefaultThinkingTransformer: typeof DefaultThinkingTransformer;
|
|
51
|
+
AmdTransformer: typeof AmdTransformer;
|
|
50
52
|
};
|
|
51
53
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wengine-ai/llms",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2412",
|
|
4
4
|
"description": "A universal LLM API transformation server",
|
|
5
5
|
"main": "dist/cjs/server.cjs",
|
|
6
6
|
"module": "dist/esm/server.mjs",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"uuid": "^11.1.0",
|
|
65
65
|
"@fastify/multipart": "^9.0.0",
|
|
66
66
|
"@fastify/static": "^8.2.0",
|
|
67
|
-
"@wengine-ai/claude-code-router-shared": "^2.3.
|
|
67
|
+
"@wengine-ai/claude-code-router-shared": "^2.3.2412",
|
|
68
68
|
"adm-zip": "^0.5.16",
|
|
69
69
|
"better-sqlite3": "^12.10.0",
|
|
70
70
|
"rotating-file-stream": "^3.2.7"
|