@prismshadow/mmsp 0.5.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/README.md +121 -0
- package/dist/ant_messages/client.d.ts +59 -0
- package/dist/ant_messages/client.d.ts.map +1 -0
- package/dist/ant_messages/client.js +419 -0
- package/dist/ant_messages/index.d.ts +2 -0
- package/dist/ant_messages/index.d.ts.map +1 -0
- package/dist/ant_messages/index.js +18 -0
- package/dist/anthropic_official/client.d.ts +63 -0
- package/dist/anthropic_official/client.d.ts.map +1 -0
- package/dist/anthropic_official/client.js +540 -0
- package/dist/anthropic_official/index.d.ts +2 -0
- package/dist/anthropic_official/index.d.ts.map +1 -0
- package/dist/anthropic_official/index.js +18 -0
- package/dist/autoClient.d.ts +96 -0
- package/dist/autoClient.d.ts.map +1 -0
- package/dist/autoClient.js +258 -0
- package/dist/baseClient.d.ts +111 -0
- package/dist/baseClient.d.ts.map +1 -0
- package/dist/baseClient.js +284 -0
- package/dist/deepseek_official/client.d.ts +60 -0
- package/dist/deepseek_official/client.d.ts.map +1 -0
- package/dist/deepseek_official/client.js +407 -0
- package/dist/deepseek_official/index.d.ts +2 -0
- package/dist/deepseek_official/index.d.ts.map +1 -0
- package/dist/deepseek_official/index.js +18 -0
- package/dist/errors.d.ts +84 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +140 -0
- package/dist/gemini_generate_content/client.d.ts +86 -0
- package/dist/gemini_generate_content/client.d.ts.map +1 -0
- package/dist/gemini_generate_content/client.js +809 -0
- package/dist/gemini_generate_content/index.d.ts +2 -0
- package/dist/gemini_generate_content/index.d.ts.map +1 -0
- package/dist/gemini_generate_content/index.js +18 -0
- package/dist/gemini_official/client.d.ts +87 -0
- package/dist/gemini_official/client.d.ts.map +1 -0
- package/dist/gemini_official/client.js +780 -0
- package/dist/gemini_official/index.d.ts +2 -0
- package/dist/gemini_official/index.d.ts.map +1 -0
- package/dist/gemini_official/index.js +18 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/integration/index.d.ts +1 -0
- package/dist/integration/index.d.ts.map +1 -0
- package/dist/integration/index.js +14 -0
- package/dist/integration/playground.d.ts +17 -0
- package/dist/integration/playground.d.ts.map +1 -0
- package/dist/integration/playground.js +3246 -0
- package/dist/integration/tracer.d.ts +188 -0
- package/dist/integration/tracer.d.ts.map +1 -0
- package/dist/integration/tracer.js +1928 -0
- package/dist/legacy.d.ts +13 -0
- package/dist/legacy.d.ts.map +1 -0
- package/dist/legacy.js +59 -0
- package/dist/minimax_official/client.d.ts +43 -0
- package/dist/minimax_official/client.d.ts.map +1 -0
- package/dist/minimax_official/client.js +346 -0
- package/dist/minimax_official/index.d.ts +2 -0
- package/dist/minimax_official/index.d.ts.map +1 -0
- package/dist/minimax_official/index.js +18 -0
- package/dist/moonshot_official/client.d.ts +73 -0
- package/dist/moonshot_official/client.d.ts.map +1 -0
- package/dist/moonshot_official/client.js +477 -0
- package/dist/moonshot_official/index.d.ts +2 -0
- package/dist/moonshot_official/index.d.ts.map +1 -0
- package/dist/moonshot_official/index.js +18 -0
- package/dist/openai_chat/client.d.ts +67 -0
- package/dist/openai_chat/client.d.ts.map +1 -0
- package/dist/openai_chat/client.js +419 -0
- package/dist/openai_chat/index.d.ts +2 -0
- package/dist/openai_chat/index.d.ts.map +1 -0
- package/dist/openai_chat/index.js +18 -0
- package/dist/openai_chat_vllm_adapter/client.d.ts +15 -0
- package/dist/openai_chat_vllm_adapter/client.d.ts.map +1 -0
- package/dist/openai_chat_vllm_adapter/client.js +118 -0
- package/dist/openai_chat_vllm_adapter/index.d.ts +2 -0
- package/dist/openai_chat_vllm_adapter/index.d.ts.map +1 -0
- package/dist/openai_chat_vllm_adapter/index.js +5 -0
- package/dist/openai_embedding/client.d.ts +46 -0
- package/dist/openai_embedding/client.d.ts.map +1 -0
- package/dist/openai_embedding/client.js +124 -0
- package/dist/openai_embedding/index.d.ts +2 -0
- package/dist/openai_embedding/index.d.ts.map +1 -0
- package/dist/openai_embedding/index.js +18 -0
- package/dist/openai_official/client.d.ts +61 -0
- package/dist/openai_official/client.d.ts.map +1 -0
- package/dist/openai_official/client.js +464 -0
- package/dist/openai_official/index.d.ts +2 -0
- package/dist/openai_official/index.d.ts.map +1 -0
- package/dist/openai_official/index.js +18 -0
- package/dist/openai_responses/client.d.ts +61 -0
- package/dist/openai_responses/client.d.ts.map +1 -0
- package/dist/openai_responses/client.js +449 -0
- package/dist/openai_responses/index.d.ts +2 -0
- package/dist/openai_responses/index.d.ts.map +1 -0
- package/dist/openai_responses/index.js +18 -0
- package/dist/registry.d.ts +49 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +798 -0
- package/dist/streamItems.d.ts +36 -0
- package/dist/streamItems.d.ts.map +1 -0
- package/dist/streamItems.js +183 -0
- package/dist/types.d.ts +190 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +37 -0
- package/dist/utils.d.ts +99 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +312 -0
- package/dist/zai_official/client.d.ts +78 -0
- package/dist/zai_official/client.d.ts.map +1 -0
- package/dist/zai_official/client.js +420 -0
- package/dist/zai_official/index.d.ts +2 -0
- package/dist/zai_official/index.d.ts.map +1 -0
- package/dist/zai_official/index.js +18 -0
- package/package.json +68 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { Express } from "express";
|
|
2
|
+
import { UniConfig, UniMessage } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Tracer for saving conversation history to local files.
|
|
5
|
+
*
|
|
6
|
+
* This class handles saving conversation history to files in a cache directory.
|
|
7
|
+
*/
|
|
8
|
+
export declare class Tracer {
|
|
9
|
+
private cacheDir;
|
|
10
|
+
/**
|
|
11
|
+
* Initialize the tracer.
|
|
12
|
+
*
|
|
13
|
+
* @param cacheDir - Directory to store conversation history files
|
|
14
|
+
*/
|
|
15
|
+
constructor(cacheDir?: string);
|
|
16
|
+
/**
|
|
17
|
+
* Ensure directory exists, create if it doesn't.
|
|
18
|
+
*
|
|
19
|
+
* @param dirPath - Directory path to create
|
|
20
|
+
*/
|
|
21
|
+
private _ensureDirectoryExists;
|
|
22
|
+
/**
|
|
23
|
+
* Recursively serialize objects for JSON, converting Buffer to base64.
|
|
24
|
+
*
|
|
25
|
+
* @param obj - Object to serialize
|
|
26
|
+
* @returns JSON-serializable object
|
|
27
|
+
*/
|
|
28
|
+
private _serializeForJson;
|
|
29
|
+
/**
|
|
30
|
+
* Return whether browsers can usually play this MIME type directly.
|
|
31
|
+
*
|
|
32
|
+
* @param mimeType - MIME type to inspect
|
|
33
|
+
* @returns Whether the browser can typically play the audio type
|
|
34
|
+
*/
|
|
35
|
+
private _isBrowserPlayableAudioMimeType;
|
|
36
|
+
/**
|
|
37
|
+
* Decode an inline_data payload to raw bytes.
|
|
38
|
+
*
|
|
39
|
+
* @param item - inline_data content item
|
|
40
|
+
* @returns Raw payload bytes
|
|
41
|
+
*/
|
|
42
|
+
private _decodeInlineData;
|
|
43
|
+
/**
|
|
44
|
+
* Wrap raw PCM bytes in a WAV header using Gemini TTS defaults.
|
|
45
|
+
*
|
|
46
|
+
* @param item - inline_data content item
|
|
47
|
+
* @returns WAV bytes
|
|
48
|
+
*/
|
|
49
|
+
private _buildWaveBytesFromPcm;
|
|
50
|
+
/**
|
|
51
|
+
* Format inline_data metadata without emitting raw payloads.
|
|
52
|
+
*
|
|
53
|
+
* @param item - inline_data content item
|
|
54
|
+
* @returns Human-readable summary of the inline payload
|
|
55
|
+
*/
|
|
56
|
+
private _formatInlineDataSummary;
|
|
57
|
+
private _formatEmbeddingPreview;
|
|
58
|
+
/**
|
|
59
|
+
* Build a data URL for inline_data content.
|
|
60
|
+
*
|
|
61
|
+
* @param item - inline_data content item
|
|
62
|
+
* @returns Data URL string
|
|
63
|
+
*/
|
|
64
|
+
private _inlineDataUrl;
|
|
65
|
+
/**
|
|
66
|
+
* Return whether inline_data should be rendered as audio.
|
|
67
|
+
*
|
|
68
|
+
* @param item - inline_data content item
|
|
69
|
+
* @returns Whether the payload is audio
|
|
70
|
+
*/
|
|
71
|
+
private _inlineDataIsAudio;
|
|
72
|
+
/**
|
|
73
|
+
* Return the browser-facing audio MIME type after any WAV fallback.
|
|
74
|
+
*
|
|
75
|
+
* @param item - inline_data content item
|
|
76
|
+
* @returns Playable audio MIME type
|
|
77
|
+
*/
|
|
78
|
+
private _inlineDataAudioType;
|
|
79
|
+
/**
|
|
80
|
+
* Save conversation history to files.
|
|
81
|
+
*
|
|
82
|
+
* @param history - List of UniMessage objects representing the conversation
|
|
83
|
+
* @param fileId - File identifier without extension (e.g., "agent1/00001")
|
|
84
|
+
* @param config - The UniConfig used for this conversation
|
|
85
|
+
*/
|
|
86
|
+
saveHistory(model: string, history: UniMessage[], fileId: string, config: UniConfig): void;
|
|
87
|
+
/**
|
|
88
|
+
* Format conversation history in a readable text format.
|
|
89
|
+
*
|
|
90
|
+
* @param history - List of UniMessage objects
|
|
91
|
+
* @param config - The UniConfig used for this conversation
|
|
92
|
+
* @returns Formatted string representation of the conversation
|
|
93
|
+
*/
|
|
94
|
+
private _formatHistory;
|
|
95
|
+
/**
|
|
96
|
+
* Create an Express web application for browsing conversation files.
|
|
97
|
+
*
|
|
98
|
+
* @returns Express application instance
|
|
99
|
+
*/
|
|
100
|
+
createWebApp(options?: {
|
|
101
|
+
basePath?: string;
|
|
102
|
+
}): Express;
|
|
103
|
+
/**
|
|
104
|
+
* Normalize the base path used when tracer is mounted inside another app.
|
|
105
|
+
*
|
|
106
|
+
* @param basePath - Optional URL prefix for tracer routes
|
|
107
|
+
* @returns Normalized URL prefix without a trailing slash
|
|
108
|
+
*/
|
|
109
|
+
private _normalizeBasePath;
|
|
110
|
+
/**
|
|
111
|
+
* Prefix an internal tracer URL with the mount path.
|
|
112
|
+
*
|
|
113
|
+
* @param basePath - Normalized tracer mount path
|
|
114
|
+
* @param url - Internal URL beginning with /
|
|
115
|
+
* @returns URL safe to render into tracer links
|
|
116
|
+
*/
|
|
117
|
+
private _prefixUrl;
|
|
118
|
+
/**
|
|
119
|
+
* Format a Unix timestamp in milliseconds as YYYY-MM-DD HH:MM:SS.
|
|
120
|
+
*
|
|
121
|
+
* @param ms - Unix timestamp in milliseconds
|
|
122
|
+
* @returns Formatted date string
|
|
123
|
+
*/
|
|
124
|
+
private _formatTimestamp;
|
|
125
|
+
/**
|
|
126
|
+
* Build the rail that lists the rounds of a trace.
|
|
127
|
+
*
|
|
128
|
+
* @param totalRounds - Total number of rounds
|
|
129
|
+
* @param history - Full message history array
|
|
130
|
+
* @returns HTML string for the rail
|
|
131
|
+
*/
|
|
132
|
+
private _buildSidebarHtml;
|
|
133
|
+
/**
|
|
134
|
+
* Format milliseconds the way the playground does: 840 ms, 2.41 s, 1 min 5 s.
|
|
135
|
+
*
|
|
136
|
+
* @param ms - Duration in milliseconds
|
|
137
|
+
* @returns Formatted duration
|
|
138
|
+
*/
|
|
139
|
+
private _formatDuration;
|
|
140
|
+
/**
|
|
141
|
+
* Group a count's digits by thousands.
|
|
142
|
+
*
|
|
143
|
+
* @param value - Count to format
|
|
144
|
+
* @returns Formatted count
|
|
145
|
+
*/
|
|
146
|
+
private _formatCount;
|
|
147
|
+
/**
|
|
148
|
+
* Build the path from the cache root to the page, every step but the last a link.
|
|
149
|
+
*
|
|
150
|
+
* @param basePath - Normalized tracer mount path
|
|
151
|
+
* @param parts - Path segments below the cache root
|
|
152
|
+
* @returns Breadcrumb HTML
|
|
153
|
+
*/
|
|
154
|
+
private _breadcrumb;
|
|
155
|
+
/**
|
|
156
|
+
* Build the bar that opens a page, as in a file explorer: back, forward and up, then the address.
|
|
157
|
+
*
|
|
158
|
+
* @param breadcrumb - Breadcrumb HTML
|
|
159
|
+
* @param upUrl - The parent the up button leads to, if there is one
|
|
160
|
+
* @param isFile - Whether the page shows a file rather than a folder
|
|
161
|
+
* @returns Navigation bar HTML
|
|
162
|
+
*/
|
|
163
|
+
private _nav;
|
|
164
|
+
/**
|
|
165
|
+
* Wrap a page body in the head, top bar and script every tracer page shares.
|
|
166
|
+
*
|
|
167
|
+
* @param title - Page title
|
|
168
|
+
* @param rootUrl - URL of the cache root
|
|
169
|
+
* @param body - Page body HTML
|
|
170
|
+
* @returns Full HTML page
|
|
171
|
+
*/
|
|
172
|
+
private _page;
|
|
173
|
+
/**
|
|
174
|
+
* Escape HTML special characters.
|
|
175
|
+
*
|
|
176
|
+
* @param text - Text to escape
|
|
177
|
+
* @returns Escaped text
|
|
178
|
+
*/
|
|
179
|
+
private _escapeHtml;
|
|
180
|
+
/**
|
|
181
|
+
* Start the web server for browsing conversation files.
|
|
182
|
+
*
|
|
183
|
+
* @param host - Host address to bind to
|
|
184
|
+
* @param port - Port number to listen on
|
|
185
|
+
*/
|
|
186
|
+
startWebServer(host?: string, port?: number): void;
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=tracer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracer.d.ts","sourceRoot":"","sources":["../../src/integration/tracer.ts"],"names":[],"mappings":"AAuBA,OAAgB,EAAE,OAAO,EAAqB,MAAM,SAAS,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AA+jCjD;;;;GAIG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAS;IAEzB;;;;OAIG;gBACS,QAAQ,CAAC,EAAE,MAAM;IAO7B;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAM9B;;;;;OAKG;IAEH,OAAO,CAAC,iBAAiB;IAiBzB;;;;;OAKG;IACH,OAAO,CAAC,+BAA+B;IAcvC;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAOzB;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IA0B9B;;;;;OAKG;IACH,OAAO,CAAC,wBAAwB;IAmChC,OAAO,CAAC,uBAAuB;IAQ/B;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAmBtB;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB;IAI1B;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IAQ5B;;;;;;OAMG;IACH,WAAW,CACT,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,UAAU,EAAE,EACrB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,SAAS,GAChB,IAAI;IAuBP;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;IAuFtB;;;;OAIG;IACH,YAAY,CAAC,OAAO,GAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO;IAwU1D;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB;IAQ1B;;;;;;OAMG;IACH,OAAO,CAAC,UAAU;IAUlB;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAMxB;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;IA2BzB;;;;;OAKG;IACH,OAAO,CAAC,eAAe;IAUvB;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAIpB;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IAgBnB;;;;;;;OAOG;IACH,OAAO,CAAC,IAAI;IAgBZ;;;;;;;OAOG;IACH,OAAO,CAAC,KAAK;IAuBb;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IASnB;;;;;OAKG;IACH,cAAc,CAAC,IAAI,GAAE,MAAoB,EAAE,IAAI,GAAE,MAAc,GAAG,IAAI;CAOvE"}
|