@codebolt/codeboltjs 2.0.7 → 2.0.12
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/dist/agentlib/agent.js +12 -4
- package/dist/agentlib/promptbuilder.d.ts +228 -0
- package/dist/agentlib/promptbuilder.js +487 -0
- package/dist/agentlib/taskInstruction.d.ts +3 -25
- package/dist/agentlib/usermessage.d.ts +13 -43
- package/dist/agentlib/usermessage.js +8 -8
- package/dist/core/messageManager.d.ts +4 -6
- package/dist/core/messageManager.js +24 -17
- package/dist/core/websocket.d.ts +10 -0
- package/dist/core/websocket.js +92 -8
- package/dist/index.d.ts +97 -95
- package/dist/index.js +63 -57
- package/dist/modules/agent.d.ts +9 -8
- package/dist/modules/agent.js +4 -4
- package/dist/modules/browser.d.ts +17 -17
- package/dist/modules/browser.js +7 -7
- package/dist/modules/chat.d.ts +1 -1
- package/dist/modules/codeparsers.d.ts +1 -16
- package/dist/modules/codeutils.d.ts +3 -18
- package/dist/modules/dbmemory.d.ts +1 -1
- package/dist/modules/debug.d.ts +1 -1
- package/dist/modules/fs.d.ts +1 -1
- package/dist/modules/git.d.ts +21 -20
- package/dist/modules/git.js +10 -10
- package/dist/modules/history.d.ts +6 -8
- package/dist/modules/history.js +4 -1
- package/dist/modules/llm.d.ts +13 -5
- package/dist/modules/llm.js +29 -4
- package/dist/modules/{tools.d.ts → mcp.d.ts} +9 -8
- package/dist/modules/{tools.js → mcp.js} +6 -6
- package/dist/modules/project.d.ts +1 -1
- package/dist/modules/state.d.ts +2 -1
- package/dist/modules/task.js +0 -1
- package/dist/modules/terminal.d.ts +1 -1
- package/dist/modules/tokenizer.d.ts +1 -1
- package/dist/modules/utils.d.ts +11 -1
- package/dist/modules/utils.js +9 -0
- package/dist/modules/vectordb.d.ts +1 -1
- package/dist/types/InternalTypes.d.ts +501 -0
- package/dist/types/InternalTypes.js +30 -0
- package/dist/types/commonTypes.d.ts +346 -0
- package/dist/types/commonTypes.js +37 -0
- package/dist/types/libFunctionTypes.d.ts +589 -0
- package/dist/types/libFunctionTypes.js +11 -0
- package/dist/types/socketMessageTypes.d.ts +951 -0
- package/dist/types/socketMessageTypes.js +51 -0
- package/dist/utils/{toolBox.d.ts → mcpServer.d.ts} +1 -1
- package/dist/utils/{toolBox.js → mcpServer.js} +36 -36
- package/dist/utils/parse-source-code/languageParser.d.ts +1 -7
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +3 -3
- package/package.json +7 -2
|
@@ -0,0 +1,589 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript types for the public API functions exported by the codeboltjs library
|
|
3
|
+
*
|
|
4
|
+
* This file contains types for:
|
|
5
|
+
* - Public function parameters and return types
|
|
6
|
+
* - API interfaces exposed to library users
|
|
7
|
+
* - Configuration options for library functions
|
|
8
|
+
* - User-facing data structures
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Represents a message in the conversation with roles and content.
|
|
12
|
+
*/
|
|
13
|
+
export interface Message {
|
|
14
|
+
/** The role of the message sender: user, assistant, tool, or system */
|
|
15
|
+
role: 'user' | 'assistant' | 'tool' | 'system';
|
|
16
|
+
/** The content of the message, can be an array of content blocks or a string */
|
|
17
|
+
content: any[] | string;
|
|
18
|
+
/** Optional ID for tool calls */
|
|
19
|
+
tool_call_id?: string;
|
|
20
|
+
/** Optional tool calls for assistant messages */
|
|
21
|
+
tool_calls?: ToolCall[];
|
|
22
|
+
/** Additional properties that might be present */
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Represents a tool call in OpenAI format
|
|
27
|
+
*/
|
|
28
|
+
export interface ToolCall {
|
|
29
|
+
/** Unique identifier for this tool call */
|
|
30
|
+
id: string;
|
|
31
|
+
/** The type of tool call */
|
|
32
|
+
type: 'function';
|
|
33
|
+
/** Function call details */
|
|
34
|
+
function: {
|
|
35
|
+
/** Name of the function to call */
|
|
36
|
+
name: string;
|
|
37
|
+
/** Arguments for the function call as JSON string */
|
|
38
|
+
arguments: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Represents a tool definition in OpenAI format
|
|
43
|
+
*/
|
|
44
|
+
export interface Tool {
|
|
45
|
+
/** The type of tool */
|
|
46
|
+
type: 'function';
|
|
47
|
+
/** Function definition */
|
|
48
|
+
function: {
|
|
49
|
+
/** Name of the function */
|
|
50
|
+
name: string;
|
|
51
|
+
/** Description of what the function does */
|
|
52
|
+
description?: string;
|
|
53
|
+
/** JSON schema for the function parameters */
|
|
54
|
+
parameters?: any;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* LLM inference request parameters
|
|
59
|
+
*/
|
|
60
|
+
export interface LLMInferenceParams {
|
|
61
|
+
/** Array of messages in the conversation */
|
|
62
|
+
messages: Message[];
|
|
63
|
+
/** Available tools for the model to use */
|
|
64
|
+
tools?: Tool[];
|
|
65
|
+
/** How the model should use tools */
|
|
66
|
+
tool_choice?: 'auto' | 'none' | 'required' | {
|
|
67
|
+
type: 'function';
|
|
68
|
+
function: {
|
|
69
|
+
name: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
/** The LLM role to determine which model to use */
|
|
73
|
+
llmrole: string;
|
|
74
|
+
/** Maximum number of tokens to generate */
|
|
75
|
+
max_tokens?: number;
|
|
76
|
+
/** Temperature for response generation */
|
|
77
|
+
temperature?: number;
|
|
78
|
+
/** Whether to stream the response */
|
|
79
|
+
stream?: boolean;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* OpenAI-compatible message format for conversations
|
|
83
|
+
*/
|
|
84
|
+
export interface OpenAIMessage {
|
|
85
|
+
/** Role of the message sender */
|
|
86
|
+
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
87
|
+
/** Content of the message */
|
|
88
|
+
content: string | Array<{
|
|
89
|
+
type: string;
|
|
90
|
+
text: string;
|
|
91
|
+
}>;
|
|
92
|
+
/** Tool call ID for tool messages */
|
|
93
|
+
tool_call_id?: string;
|
|
94
|
+
/** Tool calls for assistant messages */
|
|
95
|
+
tool_calls?: Array<{
|
|
96
|
+
id: string;
|
|
97
|
+
type: 'function';
|
|
98
|
+
function: {
|
|
99
|
+
name: string;
|
|
100
|
+
arguments: string;
|
|
101
|
+
};
|
|
102
|
+
}>;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* OpenAI-compatible tool format
|
|
106
|
+
*/
|
|
107
|
+
export interface OpenAITool {
|
|
108
|
+
type: 'function';
|
|
109
|
+
function: {
|
|
110
|
+
name: string;
|
|
111
|
+
description: string;
|
|
112
|
+
parameters: {
|
|
113
|
+
type: 'object';
|
|
114
|
+
properties: Record<string, {
|
|
115
|
+
type: string;
|
|
116
|
+
description: string;
|
|
117
|
+
}>;
|
|
118
|
+
required?: string[];
|
|
119
|
+
additionalProperties?: boolean;
|
|
120
|
+
};
|
|
121
|
+
strict?: boolean;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Conversation history entry for agent interactions
|
|
126
|
+
*/
|
|
127
|
+
export interface ConversationEntry {
|
|
128
|
+
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
129
|
+
content: string | Array<{
|
|
130
|
+
type: string;
|
|
131
|
+
text: string;
|
|
132
|
+
}>;
|
|
133
|
+
tool_call_id?: string;
|
|
134
|
+
tool_calls?: any[];
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Result from a tool execution
|
|
138
|
+
*/
|
|
139
|
+
export interface ToolResult {
|
|
140
|
+
/** Always 'tool' for tool execution results */
|
|
141
|
+
role: 'tool';
|
|
142
|
+
/** ID that links this result to the original tool call */
|
|
143
|
+
tool_call_id: string;
|
|
144
|
+
/** The content returned by the tool */
|
|
145
|
+
content: any;
|
|
146
|
+
/** Optional user message to be added after tool execution */
|
|
147
|
+
userMessage?: any;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Details about a tool to be executed
|
|
151
|
+
*/
|
|
152
|
+
export interface ToolDetails {
|
|
153
|
+
/** The name of the tool to execute */
|
|
154
|
+
toolName: string;
|
|
155
|
+
/** Input parameters for the tool */
|
|
156
|
+
toolInput: any;
|
|
157
|
+
/** Unique ID for this tool use instance */
|
|
158
|
+
toolUseId: string;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Content block within a user message
|
|
162
|
+
*/
|
|
163
|
+
export interface UserMessageContent {
|
|
164
|
+
/** Type of content (e.g., "text", "image") */
|
|
165
|
+
type: string;
|
|
166
|
+
/** The text content */
|
|
167
|
+
text: string;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Interface for codebolt API functionality
|
|
171
|
+
*/
|
|
172
|
+
export interface CodeboltAPI {
|
|
173
|
+
mcp: {
|
|
174
|
+
listMcpFromServers: (servers: string[]) => Promise<{
|
|
175
|
+
data: OpenAITool[];
|
|
176
|
+
}>;
|
|
177
|
+
getTools: (mcps: any[]) => Promise<{
|
|
178
|
+
data: OpenAITool[];
|
|
179
|
+
}>;
|
|
180
|
+
};
|
|
181
|
+
fs: {
|
|
182
|
+
readFile: (filepath: string) => Promise<string>;
|
|
183
|
+
listFile: (path: string, recursive: boolean) => Promise<{
|
|
184
|
+
success: boolean;
|
|
185
|
+
result: string;
|
|
186
|
+
}>;
|
|
187
|
+
};
|
|
188
|
+
project: {
|
|
189
|
+
getProjectPath: () => Promise<{
|
|
190
|
+
projectPath: string;
|
|
191
|
+
}>;
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
export interface ReadFileOptions {
|
|
195
|
+
/** File path to read */
|
|
196
|
+
path: string;
|
|
197
|
+
/** Text encoding (default: utf8) */
|
|
198
|
+
encoding?: string;
|
|
199
|
+
/** Whether to ask for permission before reading */
|
|
200
|
+
askForPermission?: boolean;
|
|
201
|
+
}
|
|
202
|
+
export interface WriteFileOptions {
|
|
203
|
+
/** File path to write to */
|
|
204
|
+
path: string;
|
|
205
|
+
/** Content to write */
|
|
206
|
+
content: string;
|
|
207
|
+
/** Text encoding (default: utf8) */
|
|
208
|
+
encoding?: string;
|
|
209
|
+
/** Whether to ask for permission before writing */
|
|
210
|
+
askForPermission?: boolean;
|
|
211
|
+
}
|
|
212
|
+
export interface ListFilesOptions {
|
|
213
|
+
/** Directory path to list */
|
|
214
|
+
path: string;
|
|
215
|
+
/** Whether to list files recursively */
|
|
216
|
+
recursive?: boolean;
|
|
217
|
+
}
|
|
218
|
+
export interface SearchFilesOptions {
|
|
219
|
+
/** Search query/pattern */
|
|
220
|
+
query: string;
|
|
221
|
+
/** Directory to search in */
|
|
222
|
+
path?: string;
|
|
223
|
+
/** File pattern to include (glob) */
|
|
224
|
+
filePattern?: string;
|
|
225
|
+
/** Whether search is case sensitive */
|
|
226
|
+
caseSensitive?: boolean;
|
|
227
|
+
}
|
|
228
|
+
export interface GrepSearchOptions {
|
|
229
|
+
/** Search pattern */
|
|
230
|
+
query: string;
|
|
231
|
+
/** Directory to search in */
|
|
232
|
+
path?: string;
|
|
233
|
+
/** Include pattern (glob) */
|
|
234
|
+
includePattern?: string;
|
|
235
|
+
/** Exclude pattern (glob) */
|
|
236
|
+
excludePattern?: string;
|
|
237
|
+
/** Whether search is case sensitive */
|
|
238
|
+
caseSensitive?: boolean;
|
|
239
|
+
}
|
|
240
|
+
export interface BrowserNavigationOptions {
|
|
241
|
+
/** URL to navigate to */
|
|
242
|
+
url: string;
|
|
243
|
+
/** Wait for page load (default: true) */
|
|
244
|
+
waitForLoad?: boolean;
|
|
245
|
+
/** Timeout in milliseconds */
|
|
246
|
+
timeout?: number;
|
|
247
|
+
}
|
|
248
|
+
export interface BrowserScreenshotOptions {
|
|
249
|
+
/** Take full page screenshot */
|
|
250
|
+
fullPage?: boolean;
|
|
251
|
+
/** Image quality (0-100) */
|
|
252
|
+
quality?: number;
|
|
253
|
+
/** Image format */
|
|
254
|
+
format?: 'png' | 'jpeg';
|
|
255
|
+
}
|
|
256
|
+
export interface BrowserElementSelector {
|
|
257
|
+
/** CSS selector */
|
|
258
|
+
selector: string;
|
|
259
|
+
/** Whether to wait for element */
|
|
260
|
+
waitFor?: boolean;
|
|
261
|
+
/** Timeout for waiting */
|
|
262
|
+
timeout?: number;
|
|
263
|
+
}
|
|
264
|
+
export interface TerminalExecuteOptions {
|
|
265
|
+
/** Command to execute */
|
|
266
|
+
command: string;
|
|
267
|
+
/** Working directory */
|
|
268
|
+
cwd?: string;
|
|
269
|
+
/** Environment variables */
|
|
270
|
+
env?: Record<string, string>;
|
|
271
|
+
/** Timeout in milliseconds */
|
|
272
|
+
timeout?: number;
|
|
273
|
+
/** Whether to run in background */
|
|
274
|
+
background?: boolean;
|
|
275
|
+
}
|
|
276
|
+
export interface GitCommitOptions {
|
|
277
|
+
/** Commit message */
|
|
278
|
+
message: string;
|
|
279
|
+
/** Author name */
|
|
280
|
+
author?: string;
|
|
281
|
+
/** Author email */
|
|
282
|
+
email?: string;
|
|
283
|
+
/** Whether to add all files */
|
|
284
|
+
addAll?: boolean;
|
|
285
|
+
}
|
|
286
|
+
export interface GitLogOptions {
|
|
287
|
+
/** Number of commits to retrieve */
|
|
288
|
+
maxCount?: number;
|
|
289
|
+
/** Starting from commit hash */
|
|
290
|
+
from?: string;
|
|
291
|
+
/** Until commit hash */
|
|
292
|
+
to?: string;
|
|
293
|
+
/** File path to filter logs */
|
|
294
|
+
path?: string;
|
|
295
|
+
}
|
|
296
|
+
export interface LLMChatOptions {
|
|
297
|
+
/** Messages in the conversation */
|
|
298
|
+
messages: Message[];
|
|
299
|
+
/** Model to use */
|
|
300
|
+
model?: string;
|
|
301
|
+
/** Temperature (0-1) */
|
|
302
|
+
temperature?: number;
|
|
303
|
+
/** Maximum tokens to generate */
|
|
304
|
+
maxTokens?: number;
|
|
305
|
+
/** Whether to stream response */
|
|
306
|
+
stream?: boolean;
|
|
307
|
+
/** Available tools */
|
|
308
|
+
tools?: Tool[];
|
|
309
|
+
/** Tool choice strategy */
|
|
310
|
+
toolChoice?: 'auto' | 'none' | 'required';
|
|
311
|
+
}
|
|
312
|
+
export interface VectorAddOptions {
|
|
313
|
+
/** Unique identifier */
|
|
314
|
+
id: string;
|
|
315
|
+
/** Vector data */
|
|
316
|
+
vector: number[];
|
|
317
|
+
/** Associated metadata */
|
|
318
|
+
metadata?: Record<string, any>;
|
|
319
|
+
/** Text content */
|
|
320
|
+
content?: string;
|
|
321
|
+
}
|
|
322
|
+
export interface VectorQueryOptions {
|
|
323
|
+
/** Query vector */
|
|
324
|
+
vector: number[];
|
|
325
|
+
/** Number of results to return */
|
|
326
|
+
topK?: number;
|
|
327
|
+
/** Metadata filters */
|
|
328
|
+
filter?: Record<string, any>;
|
|
329
|
+
/** Minimum similarity score */
|
|
330
|
+
minScore?: number;
|
|
331
|
+
}
|
|
332
|
+
export interface AgentMessageHandler {
|
|
333
|
+
(userMessage: any): void | Promise<void> | any | Promise<any>;
|
|
334
|
+
}
|
|
335
|
+
export interface AgentConfiguration {
|
|
336
|
+
/** Agent name */
|
|
337
|
+
name?: string;
|
|
338
|
+
/** Agent description */
|
|
339
|
+
description?: string;
|
|
340
|
+
/** Available tools */
|
|
341
|
+
tools?: Tool[];
|
|
342
|
+
/** System prompt */
|
|
343
|
+
systemPrompt?: string;
|
|
344
|
+
}
|
|
345
|
+
export interface MemorySetOptions {
|
|
346
|
+
/** Memory key */
|
|
347
|
+
key: string;
|
|
348
|
+
/** Memory value */
|
|
349
|
+
value: any;
|
|
350
|
+
/** Expiration time in seconds */
|
|
351
|
+
ttl?: number;
|
|
352
|
+
}
|
|
353
|
+
export interface MemoryGetOptions {
|
|
354
|
+
/** Memory key */
|
|
355
|
+
key: string;
|
|
356
|
+
/** Default value if key not found */
|
|
357
|
+
defaultValue?: any;
|
|
358
|
+
}
|
|
359
|
+
export interface TaskCreateOptions {
|
|
360
|
+
/** Task title */
|
|
361
|
+
title: string;
|
|
362
|
+
/** Task description */
|
|
363
|
+
description?: string;
|
|
364
|
+
/** Task priority */
|
|
365
|
+
priority?: 'low' | 'medium' | 'high';
|
|
366
|
+
/** Due date */
|
|
367
|
+
dueDate?: Date | string;
|
|
368
|
+
/** Associated tags */
|
|
369
|
+
tags?: string[];
|
|
370
|
+
}
|
|
371
|
+
export interface TaskUpdateOptions {
|
|
372
|
+
/** Task ID */
|
|
373
|
+
id: string;
|
|
374
|
+
/** New title */
|
|
375
|
+
title?: string;
|
|
376
|
+
/** New description */
|
|
377
|
+
description?: string;
|
|
378
|
+
/** Completion status */
|
|
379
|
+
completed?: boolean;
|
|
380
|
+
/** New priority */
|
|
381
|
+
priority?: 'low' | 'medium' | 'high';
|
|
382
|
+
}
|
|
383
|
+
export interface CodeAnalysisOptions {
|
|
384
|
+
/** File or directory path */
|
|
385
|
+
path: string;
|
|
386
|
+
/** Language to analyze */
|
|
387
|
+
language?: string;
|
|
388
|
+
/** Analysis rules to apply */
|
|
389
|
+
rules?: string[];
|
|
390
|
+
}
|
|
391
|
+
export interface CodeParseOptions {
|
|
392
|
+
/** Code content or file path */
|
|
393
|
+
input: string;
|
|
394
|
+
/** Programming language */
|
|
395
|
+
language: string;
|
|
396
|
+
/** Whether input is file path */
|
|
397
|
+
isFilePath?: boolean;
|
|
398
|
+
}
|
|
399
|
+
export interface DebugLogOptions {
|
|
400
|
+
/** Log message */
|
|
401
|
+
message: string;
|
|
402
|
+
/** Log level */
|
|
403
|
+
level?: 'debug' | 'info' | 'warn' | 'error';
|
|
404
|
+
/** Additional metadata */
|
|
405
|
+
metadata?: Record<string, any>;
|
|
406
|
+
/** Component name */
|
|
407
|
+
component?: string;
|
|
408
|
+
}
|
|
409
|
+
export interface ProjectInfo {
|
|
410
|
+
/** Project name */
|
|
411
|
+
name: string;
|
|
412
|
+
/** Project path */
|
|
413
|
+
path: string;
|
|
414
|
+
/** Project type */
|
|
415
|
+
type?: string;
|
|
416
|
+
/** Project configuration */
|
|
417
|
+
config?: Record<string, any>;
|
|
418
|
+
}
|
|
419
|
+
export interface CrawlerOptions {
|
|
420
|
+
/** URL to crawl */
|
|
421
|
+
url: string;
|
|
422
|
+
/** Maximum depth */
|
|
423
|
+
maxDepth?: number;
|
|
424
|
+
/** Follow external links */
|
|
425
|
+
followExternal?: boolean;
|
|
426
|
+
/** Custom headers */
|
|
427
|
+
headers?: Record<string, string>;
|
|
428
|
+
/** Request timeout */
|
|
429
|
+
timeout?: number;
|
|
430
|
+
}
|
|
431
|
+
export interface MCPExecuteOptions {
|
|
432
|
+
/** Tool name */
|
|
433
|
+
toolName: string;
|
|
434
|
+
/** Server name */
|
|
435
|
+
serverName?: string;
|
|
436
|
+
/** Tool parameters */
|
|
437
|
+
params?: Record<string, any>;
|
|
438
|
+
/** Request timeout */
|
|
439
|
+
timeout?: number;
|
|
440
|
+
}
|
|
441
|
+
export interface MCPConfigureOptions {
|
|
442
|
+
/** Server name */
|
|
443
|
+
serverName: string;
|
|
444
|
+
/** Configuration data */
|
|
445
|
+
config: Record<string, any>;
|
|
446
|
+
/** Whether to enable the server */
|
|
447
|
+
enabled?: boolean;
|
|
448
|
+
}
|
|
449
|
+
export interface StateUpdateOptions {
|
|
450
|
+
/** State key */
|
|
451
|
+
key: string;
|
|
452
|
+
/** State value */
|
|
453
|
+
value: any;
|
|
454
|
+
/** Whether to merge with existing state */
|
|
455
|
+
merge?: boolean;
|
|
456
|
+
}
|
|
457
|
+
export interface ChatSendOptions {
|
|
458
|
+
/** Message content */
|
|
459
|
+
message: string;
|
|
460
|
+
/** Conversation ID */
|
|
461
|
+
conversationId?: string;
|
|
462
|
+
/** Message metadata */
|
|
463
|
+
metadata?: Record<string, any>;
|
|
464
|
+
/** Mentioned files */
|
|
465
|
+
mentionedFiles?: string[];
|
|
466
|
+
/** Mentioned agents */
|
|
467
|
+
mentionedAgents?: string[];
|
|
468
|
+
}
|
|
469
|
+
export interface ChatHistoryOptions {
|
|
470
|
+
/** Conversation ID */
|
|
471
|
+
conversationId?: string;
|
|
472
|
+
/** Maximum number of messages */
|
|
473
|
+
limit?: number;
|
|
474
|
+
/** Starting from message ID */
|
|
475
|
+
from?: string;
|
|
476
|
+
/** Include system messages */
|
|
477
|
+
includeSystem?: boolean;
|
|
478
|
+
}
|
|
479
|
+
export interface NotificationOptions {
|
|
480
|
+
/** Notification message */
|
|
481
|
+
message: string;
|
|
482
|
+
/** Notification type */
|
|
483
|
+
type?: 'info' | 'warning' | 'error' | 'success';
|
|
484
|
+
/** Notification title */
|
|
485
|
+
title?: string;
|
|
486
|
+
/** Display duration in milliseconds */
|
|
487
|
+
duration?: number;
|
|
488
|
+
/** Additional metadata */
|
|
489
|
+
metadata?: Record<string, any>;
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Standard API response wrapper
|
|
493
|
+
*/
|
|
494
|
+
export interface APIResponse<T = any> {
|
|
495
|
+
/** Whether the operation was successful */
|
|
496
|
+
success: boolean;
|
|
497
|
+
/** Response data */
|
|
498
|
+
data?: T;
|
|
499
|
+
/** Error message if unsuccessful */
|
|
500
|
+
error?: string;
|
|
501
|
+
/** Error code if unsuccessful */
|
|
502
|
+
code?: string;
|
|
503
|
+
/** Additional metadata */
|
|
504
|
+
metadata?: Record<string, any>;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Pagination options for list operations
|
|
508
|
+
*/
|
|
509
|
+
export interface PaginationOptions {
|
|
510
|
+
/** Page number (1-based) */
|
|
511
|
+
page?: number;
|
|
512
|
+
/** Number of items per page */
|
|
513
|
+
pageSize?: number;
|
|
514
|
+
/** Sort field */
|
|
515
|
+
sortBy?: string;
|
|
516
|
+
/** Sort direction */
|
|
517
|
+
sortOrder?: 'asc' | 'desc';
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Filtering options for list operations
|
|
521
|
+
*/
|
|
522
|
+
export interface FilterOptions {
|
|
523
|
+
/** Search query */
|
|
524
|
+
query?: string;
|
|
525
|
+
/** Field filters */
|
|
526
|
+
filters?: Record<string, any>;
|
|
527
|
+
/** Date range */
|
|
528
|
+
dateRange?: {
|
|
529
|
+
from?: Date | string;
|
|
530
|
+
to?: Date | string;
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Common options for async operations
|
|
535
|
+
*/
|
|
536
|
+
export interface AsyncOperationOptions {
|
|
537
|
+
/** Operation timeout in milliseconds */
|
|
538
|
+
timeout?: number;
|
|
539
|
+
/** Retry configuration */
|
|
540
|
+
retry?: {
|
|
541
|
+
attempts?: number;
|
|
542
|
+
delay?: number;
|
|
543
|
+
};
|
|
544
|
+
/** Progress callback */
|
|
545
|
+
onProgress?: (progress: number) => void;
|
|
546
|
+
/** Cancellation signal */
|
|
547
|
+
signal?: AbortSignal;
|
|
548
|
+
}
|
|
549
|
+
export interface APIEventMap {
|
|
550
|
+
connected: () => void;
|
|
551
|
+
disconnected: () => void;
|
|
552
|
+
error: (error: Error) => void;
|
|
553
|
+
message: (message: any) => void;
|
|
554
|
+
progress: (progress: number) => void;
|
|
555
|
+
}
|
|
556
|
+
export interface CodeboltConfig {
|
|
557
|
+
/** WebSocket configuration */
|
|
558
|
+
websocket?: {
|
|
559
|
+
url?: string;
|
|
560
|
+
timeout?: number;
|
|
561
|
+
reconnectInterval?: number;
|
|
562
|
+
maxReconnectAttempts?: number;
|
|
563
|
+
autoReconnect?: boolean;
|
|
564
|
+
};
|
|
565
|
+
/** Logging configuration */
|
|
566
|
+
logging?: {
|
|
567
|
+
level?: 'debug' | 'info' | 'warn' | 'error';
|
|
568
|
+
enabled?: boolean;
|
|
569
|
+
format?: 'json' | 'text';
|
|
570
|
+
};
|
|
571
|
+
/** Default timeouts for operations */
|
|
572
|
+
timeouts?: {
|
|
573
|
+
default?: number;
|
|
574
|
+
llm?: number;
|
|
575
|
+
browser?: number;
|
|
576
|
+
terminal?: number;
|
|
577
|
+
fileSystem?: number;
|
|
578
|
+
};
|
|
579
|
+
/** Feature flags */
|
|
580
|
+
features?: {
|
|
581
|
+
autoRetry?: boolean;
|
|
582
|
+
caching?: boolean;
|
|
583
|
+
compression?: boolean;
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
export type ProgressCallback = (progress: number, message?: string) => void;
|
|
587
|
+
export type ErrorCallback = (error: Error) => void;
|
|
588
|
+
export type SuccessCallback<T = any> = (result: T) => void;
|
|
589
|
+
export type CompletionCallback<T = any> = (error: Error | null, result?: T) => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* TypeScript types for the public API functions exported by the codeboltjs library
|
|
4
|
+
*
|
|
5
|
+
* This file contains types for:
|
|
6
|
+
* - Public function parameters and return types
|
|
7
|
+
* - API interfaces exposed to library users
|
|
8
|
+
* - Configuration options for library functions
|
|
9
|
+
* - User-facing data structures
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|