opencode-windsurf-codeium 0.1.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 +272 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/src/constants.d.ts +118 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +174 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/plugin/auth.d.ts +71 -0
- package/dist/src/plugin/auth.d.ts.map +1 -0
- package/dist/src/plugin/auth.js +242 -0
- package/dist/src/plugin/auth.js.map +1 -0
- package/dist/src/plugin/cloud-client.d.ts +24 -0
- package/dist/src/plugin/cloud-client.d.ts.map +1 -0
- package/dist/src/plugin/cloud-client.js +359 -0
- package/dist/src/plugin/cloud-client.js.map +1 -0
- package/dist/src/plugin/grpc-client.d.ts +37 -0
- package/dist/src/plugin/grpc-client.d.ts.map +1 -0
- package/dist/src/plugin/grpc-client.js +521 -0
- package/dist/src/plugin/grpc-client.js.map +1 -0
- package/dist/src/plugin/models.d.ts +50 -0
- package/dist/src/plugin/models.d.ts.map +1 -0
- package/dist/src/plugin/models.js +390 -0
- package/dist/src/plugin/models.js.map +1 -0
- package/dist/src/plugin/types.d.ts +414 -0
- package/dist/src/plugin/types.d.ts.map +1 -0
- package/dist/src/plugin/types.js +177 -0
- package/dist/src/plugin/types.js.map +1 -0
- package/dist/src/plugin.d.ts +25 -0
- package/dist/src/plugin.d.ts.map +1 -0
- package/dist/src/plugin.js +242 -0
- package/dist/src/plugin.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Windsurf Credential Discovery Module
|
|
3
|
+
*
|
|
4
|
+
* Automatically discovers credentials from the running Windsurf language server:
|
|
5
|
+
* - CSRF token from process arguments
|
|
6
|
+
* - Port from process arguments (extension_server_port + 2)
|
|
7
|
+
* - API key from VSCode state database (~/Library/Application Support/Windsurf/User/globalStorage/state.vscdb)
|
|
8
|
+
* - Version from process arguments
|
|
9
|
+
*/
|
|
10
|
+
export interface WindsurfCredentials {
|
|
11
|
+
/** CSRF token for authenticating with local language server */
|
|
12
|
+
csrfToken: string;
|
|
13
|
+
/** Port where the language server is listening */
|
|
14
|
+
port: number;
|
|
15
|
+
/** Codeium API key */
|
|
16
|
+
apiKey: string;
|
|
17
|
+
/** Windsurf version string */
|
|
18
|
+
version: string;
|
|
19
|
+
}
|
|
20
|
+
export declare enum WindsurfErrorCode {
|
|
21
|
+
NOT_RUNNING = "NOT_RUNNING",
|
|
22
|
+
CSRF_MISSING = "CSRF_MISSING",
|
|
23
|
+
API_KEY_MISSING = "API_KEY_MISSING",
|
|
24
|
+
CONNECTION_FAILED = "CONNECTION_FAILED",
|
|
25
|
+
AUTH_FAILED = "AUTH_FAILED",
|
|
26
|
+
STREAM_ERROR = "STREAM_ERROR"
|
|
27
|
+
}
|
|
28
|
+
export declare class WindsurfError extends Error {
|
|
29
|
+
code: WindsurfErrorCode;
|
|
30
|
+
details?: unknown;
|
|
31
|
+
constructor(message: string, code: WindsurfErrorCode, details?: unknown);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Extract CSRF token from running Windsurf language server process
|
|
35
|
+
*/
|
|
36
|
+
export declare function getCSRFToken(): string;
|
|
37
|
+
/**
|
|
38
|
+
* Get the language server port from process arguments
|
|
39
|
+
* The actual gRPC port is extension_server_port + 2
|
|
40
|
+
*/
|
|
41
|
+
export declare function getPort(): number;
|
|
42
|
+
/**
|
|
43
|
+
* Read API key from VSCode state database (windsurfAuthStatus)
|
|
44
|
+
*
|
|
45
|
+
* The API key is stored in the SQLite database at:
|
|
46
|
+
* ~/Library/Application Support/Windsurf/User/globalStorage/state.vscdb
|
|
47
|
+
*
|
|
48
|
+
* It's stored in the 'windsurfAuthStatus' key as JSON containing apiKey.
|
|
49
|
+
*/
|
|
50
|
+
export declare function getApiKey(): string;
|
|
51
|
+
/**
|
|
52
|
+
* Get Windsurf version from process arguments
|
|
53
|
+
*/
|
|
54
|
+
export declare function getWindsurfVersion(): string;
|
|
55
|
+
/**
|
|
56
|
+
* Get all credentials needed to communicate with Windsurf
|
|
57
|
+
*/
|
|
58
|
+
export declare function getCredentials(): WindsurfCredentials;
|
|
59
|
+
/**
|
|
60
|
+
* Check if Windsurf is running and accessible
|
|
61
|
+
*/
|
|
62
|
+
export declare function isWindsurfRunning(): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Check if Windsurf is installed (app exists)
|
|
65
|
+
*/
|
|
66
|
+
export declare function isWindsurfInstalled(): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Validate credentials structure
|
|
69
|
+
*/
|
|
70
|
+
export declare function validateCredentials(credentials: Partial<WindsurfCredentials>): credentials is WindsurfCredentials;
|
|
71
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/plugin/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAWH,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,oBAAY,iBAAiB;IAC3B,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;IAC7B,eAAe,oBAAoB;IACnC,iBAAiB,sBAAsB;IACvC,WAAW,gBAAgB;IAC3B,YAAY,iBAAiB;CAC9B;AAED,qBAAa,aAAc,SAAQ,KAAK;IACtC,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;gBAEN,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,OAAO;CAMxE;AA8DD;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAmBrC;AAED;;;GAGG;AACH,wBAAgB,OAAO,IAAI,MAAM,CAsChC;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,IAAI,MAAM,CA+ClC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAc3C;AAMD;;GAEG;AACH,wBAAgB,cAAc,IAAI,mBAAmB,CAOpD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAQ3C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAe7C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,WAAW,IAAI,mBAAmB,CAUjH"}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Windsurf Credential Discovery Module
|
|
3
|
+
*
|
|
4
|
+
* Automatically discovers credentials from the running Windsurf language server:
|
|
5
|
+
* - CSRF token from process arguments
|
|
6
|
+
* - Port from process arguments (extension_server_port + 2)
|
|
7
|
+
* - API key from VSCode state database (~/Library/Application Support/Windsurf/User/globalStorage/state.vscdb)
|
|
8
|
+
* - Version from process arguments
|
|
9
|
+
*/
|
|
10
|
+
import { execSync } from 'child_process';
|
|
11
|
+
import * as fs from 'fs';
|
|
12
|
+
import * as path from 'path';
|
|
13
|
+
import * as os from 'os';
|
|
14
|
+
export var WindsurfErrorCode;
|
|
15
|
+
(function (WindsurfErrorCode) {
|
|
16
|
+
WindsurfErrorCode["NOT_RUNNING"] = "NOT_RUNNING";
|
|
17
|
+
WindsurfErrorCode["CSRF_MISSING"] = "CSRF_MISSING";
|
|
18
|
+
WindsurfErrorCode["API_KEY_MISSING"] = "API_KEY_MISSING";
|
|
19
|
+
WindsurfErrorCode["CONNECTION_FAILED"] = "CONNECTION_FAILED";
|
|
20
|
+
WindsurfErrorCode["AUTH_FAILED"] = "AUTH_FAILED";
|
|
21
|
+
WindsurfErrorCode["STREAM_ERROR"] = "STREAM_ERROR";
|
|
22
|
+
})(WindsurfErrorCode || (WindsurfErrorCode = {}));
|
|
23
|
+
export class WindsurfError extends Error {
|
|
24
|
+
code;
|
|
25
|
+
details;
|
|
26
|
+
constructor(message, code, details) {
|
|
27
|
+
super(message);
|
|
28
|
+
this.name = 'WindsurfError';
|
|
29
|
+
this.code = code;
|
|
30
|
+
this.details = details;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// ============================================================================
|
|
34
|
+
// Config Paths
|
|
35
|
+
// ============================================================================
|
|
36
|
+
// Paths for API key discovery
|
|
37
|
+
const VSCODE_STATE_PATHS = {
|
|
38
|
+
darwin: path.join(os.homedir(), 'Library/Application Support/Windsurf/User/globalStorage/state.vscdb'),
|
|
39
|
+
linux: path.join(os.homedir(), '.config/Windsurf/User/globalStorage/state.vscdb'),
|
|
40
|
+
win32: path.join(os.homedir(), 'AppData/Roaming/Windsurf/User/globalStorage/state.vscdb'),
|
|
41
|
+
};
|
|
42
|
+
// Legacy config path (fallback)
|
|
43
|
+
const LEGACY_CONFIG_PATH = path.join(os.homedir(), '.codeium', 'config.json');
|
|
44
|
+
// Platform-specific process names
|
|
45
|
+
const LANGUAGE_SERVER_PATTERNS = {
|
|
46
|
+
darwin: 'language_server_macos',
|
|
47
|
+
linux: 'language_server_linux',
|
|
48
|
+
win32: 'language_server_windows',
|
|
49
|
+
};
|
|
50
|
+
// ============================================================================
|
|
51
|
+
// Process Discovery
|
|
52
|
+
// ============================================================================
|
|
53
|
+
/**
|
|
54
|
+
* Get the language server process pattern for the current platform
|
|
55
|
+
*/
|
|
56
|
+
function getLanguageServerPattern() {
|
|
57
|
+
const platform = process.platform;
|
|
58
|
+
return LANGUAGE_SERVER_PATTERNS[platform] || 'language_server';
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get process listing for language server
|
|
62
|
+
*/
|
|
63
|
+
function getLanguageServerProcess() {
|
|
64
|
+
const pattern = getLanguageServerPattern();
|
|
65
|
+
try {
|
|
66
|
+
if (process.platform === 'win32') {
|
|
67
|
+
// Windows: use WMIC
|
|
68
|
+
const output = execSync(`wmic process where "name like '%${pattern}%'" get CommandLine /format:list`, { encoding: 'utf8', timeout: 5000 });
|
|
69
|
+
return output;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
// Unix-like: use ps
|
|
73
|
+
const output = execSync(`ps aux | grep ${pattern}`, { encoding: 'utf8', timeout: 5000 });
|
|
74
|
+
return output;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Extract CSRF token from running Windsurf language server process
|
|
83
|
+
*/
|
|
84
|
+
export function getCSRFToken() {
|
|
85
|
+
const processInfo = getLanguageServerProcess();
|
|
86
|
+
if (!processInfo) {
|
|
87
|
+
throw new WindsurfError('Windsurf language server not found. Is Windsurf running?', WindsurfErrorCode.NOT_RUNNING);
|
|
88
|
+
}
|
|
89
|
+
const match = processInfo.match(/--csrf_token\s+([a-f0-9-]+)/);
|
|
90
|
+
if (match?.[1]) {
|
|
91
|
+
return match[1];
|
|
92
|
+
}
|
|
93
|
+
throw new WindsurfError('CSRF token not found in Windsurf process. Is Windsurf running?', WindsurfErrorCode.CSRF_MISSING);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get the language server port from process arguments
|
|
97
|
+
* The actual gRPC port is extension_server_port + 2
|
|
98
|
+
*/
|
|
99
|
+
export function getPort() {
|
|
100
|
+
const processInfo = getLanguageServerProcess();
|
|
101
|
+
if (!processInfo) {
|
|
102
|
+
throw new WindsurfError('Windsurf language server not found. Is Windsurf running?', WindsurfErrorCode.NOT_RUNNING);
|
|
103
|
+
}
|
|
104
|
+
// Try to get extension_server_port from process args
|
|
105
|
+
const portMatch = processInfo.match(/--extension_server_port\s+(\d+)/);
|
|
106
|
+
if (portMatch) {
|
|
107
|
+
// The gRPC port is extension_server_port + 2
|
|
108
|
+
return parseInt(portMatch[1], 10) + 2;
|
|
109
|
+
}
|
|
110
|
+
// Fallback: try to find from lsof
|
|
111
|
+
if (process.platform !== 'win32') {
|
|
112
|
+
try {
|
|
113
|
+
const pattern = getLanguageServerPattern();
|
|
114
|
+
const lsof = execSync(`lsof -c ${pattern.substring(0, 15)} -i -P 2>/dev/null | grep LISTEN`, { encoding: 'utf8', timeout: 15000 });
|
|
115
|
+
const match = lsof.match(/:(\d+)\s+\(LISTEN\)/);
|
|
116
|
+
if (match) {
|
|
117
|
+
return parseInt(match[1], 10);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
// Ignore fallback errors
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
throw new WindsurfError('Windsurf language server port not found. Is Windsurf running?', WindsurfErrorCode.NOT_RUNNING);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Read API key from VSCode state database (windsurfAuthStatus)
|
|
128
|
+
*
|
|
129
|
+
* The API key is stored in the SQLite database at:
|
|
130
|
+
* ~/Library/Application Support/Windsurf/User/globalStorage/state.vscdb
|
|
131
|
+
*
|
|
132
|
+
* It's stored in the 'windsurfAuthStatus' key as JSON containing apiKey.
|
|
133
|
+
*/
|
|
134
|
+
export function getApiKey() {
|
|
135
|
+
const platform = process.platform;
|
|
136
|
+
const statePath = VSCODE_STATE_PATHS[platform];
|
|
137
|
+
if (!statePath) {
|
|
138
|
+
throw new WindsurfError(`Unsupported platform: ${process.platform}`, WindsurfErrorCode.API_KEY_MISSING);
|
|
139
|
+
}
|
|
140
|
+
// Try to get API key from VSCode state database
|
|
141
|
+
if (fs.existsSync(statePath)) {
|
|
142
|
+
try {
|
|
143
|
+
const result = execSync(`sqlite3 "${statePath}" "SELECT value FROM ItemTable WHERE key = 'windsurfAuthStatus';"`, { encoding: 'utf8', timeout: 5000 }).trim();
|
|
144
|
+
if (result) {
|
|
145
|
+
const parsed = JSON.parse(result);
|
|
146
|
+
if (parsed.apiKey) {
|
|
147
|
+
return parsed.apiKey;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
// Fall through to legacy config
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
// Try legacy config file
|
|
156
|
+
if (fs.existsSync(LEGACY_CONFIG_PATH)) {
|
|
157
|
+
try {
|
|
158
|
+
const config = fs.readFileSync(LEGACY_CONFIG_PATH, 'utf8');
|
|
159
|
+
const parsed = JSON.parse(config);
|
|
160
|
+
if (parsed.apiKey) {
|
|
161
|
+
return parsed.apiKey;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
// Fall through
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
throw new WindsurfError('API key not found. Please login to Windsurf first.', WindsurfErrorCode.API_KEY_MISSING);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Get Windsurf version from process arguments
|
|
172
|
+
*/
|
|
173
|
+
export function getWindsurfVersion() {
|
|
174
|
+
const processInfo = getLanguageServerProcess();
|
|
175
|
+
if (processInfo) {
|
|
176
|
+
const match = processInfo.match(/--windsurf_version\s+([^\s]+)/);
|
|
177
|
+
if (match) {
|
|
178
|
+
// Extract just the version number (before + if present)
|
|
179
|
+
const version = match[1].split('+')[0];
|
|
180
|
+
return version;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
// Default fallback version
|
|
184
|
+
return '1.13.104';
|
|
185
|
+
}
|
|
186
|
+
// ============================================================================
|
|
187
|
+
// Public API
|
|
188
|
+
// ============================================================================
|
|
189
|
+
/**
|
|
190
|
+
* Get all credentials needed to communicate with Windsurf
|
|
191
|
+
*/
|
|
192
|
+
export function getCredentials() {
|
|
193
|
+
return {
|
|
194
|
+
csrfToken: getCSRFToken(),
|
|
195
|
+
port: getPort(),
|
|
196
|
+
apiKey: getApiKey(),
|
|
197
|
+
version: getWindsurfVersion(),
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Check if Windsurf is running and accessible
|
|
202
|
+
*/
|
|
203
|
+
export function isWindsurfRunning() {
|
|
204
|
+
try {
|
|
205
|
+
getCSRFToken();
|
|
206
|
+
getPort();
|
|
207
|
+
return true;
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Check if Windsurf is installed (app exists)
|
|
215
|
+
*/
|
|
216
|
+
export function isWindsurfInstalled() {
|
|
217
|
+
if (process.platform === 'darwin') {
|
|
218
|
+
return fs.existsSync('/Applications/Windsurf.app');
|
|
219
|
+
}
|
|
220
|
+
else if (process.platform === 'linux') {
|
|
221
|
+
return (fs.existsSync('/usr/share/windsurf') ||
|
|
222
|
+
fs.existsSync(path.join(os.homedir(), '.local/share/windsurf')));
|
|
223
|
+
}
|
|
224
|
+
else if (process.platform === 'win32') {
|
|
225
|
+
return (fs.existsSync('C:\\Program Files\\Windsurf') ||
|
|
226
|
+
fs.existsSync(path.join(os.homedir(), 'AppData\\Local\\Programs\\Windsurf')));
|
|
227
|
+
}
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Validate credentials structure
|
|
232
|
+
*/
|
|
233
|
+
export function validateCredentials(credentials) {
|
|
234
|
+
return (typeof credentials.csrfToken === 'string' &&
|
|
235
|
+
credentials.csrfToken.length > 0 &&
|
|
236
|
+
typeof credentials.port === 'number' &&
|
|
237
|
+
credentials.port > 0 &&
|
|
238
|
+
typeof credentials.apiKey === 'string' &&
|
|
239
|
+
credentials.apiKey.length > 0 &&
|
|
240
|
+
typeof credentials.version === 'string');
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"au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AU,CAAC,qBAAqB,CAAC;YACpC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,uBAAuB,CAAC,CAAC,CAChE,CAAC;IACJ,CAAC;SAAM,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACxC,OAAO,CACL,EAAE,CAAC,UAAU,CAAC,6BAA6B,CAAC;YAC5C,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,oCAAoC,CAAC,CAAC,CAC7E,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,WAAyC;IAC3E,OAAO,CACL,OAAO,WAAW,CAAC,SAAS,KAAK,QAAQ;QACzC,WAAW,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC;QAChC,OAAO,WAAW,CAAC,IAAI,KAAK,QAAQ;QACpC,WAAW,CAAC,IAAI,GAAG,CAAC;QACpB,OAAO,WAAW,CAAC,MAAM,KAAK,QAAQ;QACtC,WAAW,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;QAC7B,OAAO,WAAW,CAAC,OAAO,KAAK,QAAQ,CACxC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloud API Client for Windsurf/Codeium
|
|
3
|
+
*
|
|
4
|
+
* Communicates directly with server.self-serve.windsurf.com using Connect-RPC protocol.
|
|
5
|
+
* This allows standalone operation without requiring Windsurf IDE to be running.
|
|
6
|
+
*/
|
|
7
|
+
export interface CloudChatMessage {
|
|
8
|
+
role: 'user' | 'assistant' | 'system' | 'tool';
|
|
9
|
+
content: string;
|
|
10
|
+
}
|
|
11
|
+
export interface CloudChatOptions {
|
|
12
|
+
model: string;
|
|
13
|
+
messages: CloudChatMessage[];
|
|
14
|
+
onChunk?: (text: string) => void;
|
|
15
|
+
onComplete?: (fullText: string) => void;
|
|
16
|
+
onError?: (error: Error) => void;
|
|
17
|
+
}
|
|
18
|
+
export interface CloudCredentials {
|
|
19
|
+
apiKey: string;
|
|
20
|
+
version: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function streamChatCloud(credentials: CloudCredentials, options: CloudChatOptions): Promise<string>;
|
|
23
|
+
export declare function streamChatCloudGenerator(credentials: CloudCredentials, options: Pick<CloudChatOptions, 'model' | 'messages'>): AsyncGenerator<string, void, unknown>;
|
|
24
|
+
//# sourceMappingURL=cloud-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloud-client.d.ts","sourceRoot":"","sources":["../../../src/plugin/cloud-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC/C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AA0QD,wBAAsB,eAAe,CACnC,WAAW,EAAE,gBAAgB,EAC7B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,MAAM,CAAC,CAoFjB;AAED,wBAAuB,wBAAwB,CAC7C,WAAW,EAAE,gBAAgB,EAC7B,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,UAAU,CAAC,GACpD,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CA4EvC"}
|