@codebolt/codeboltjs 2.0.17 → 2.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.
Files changed (78) hide show
  1. package/dist/core/Codebolt.d.ts +48 -53
  2. package/dist/core/messageManager.d.ts +0 -1
  3. package/dist/modules/chat.d.ts +1 -1
  4. package/dist/modules/codeparsers.js +24 -15
  5. package/dist/modules/codeutils.js +19 -9
  6. package/dist/modules/task.d.ts +1 -1
  7. package/dist/modules/terminal.d.ts +0 -1
  8. package/dist/notificationfunctions/agent.js +4 -4
  9. package/dist/notificationfunctions/browser.js +5 -5
  10. package/dist/notificationfunctions/chat.js +5 -5
  11. package/dist/notificationfunctions/codeutils.js +5 -5
  12. package/dist/notificationfunctions/crawler.js +5 -5
  13. package/dist/notificationfunctions/dbmemory.js +5 -5
  14. package/dist/notificationfunctions/fs.js +23 -23
  15. package/dist/notificationfunctions/git.js +25 -25
  16. package/dist/notificationfunctions/history.js +5 -5
  17. package/dist/notificationfunctions/llm.js +5 -5
  18. package/dist/notificationfunctions/mcp.js +9 -9
  19. package/dist/notificationfunctions/search.js +7 -7
  20. package/dist/notificationfunctions/system.js +3 -3
  21. package/dist/notificationfunctions/terminal.js +3 -3
  22. package/dist/notificationfunctions/todo.js +7 -7
  23. package/dist/notificationfunctions/utils.js +8 -8
  24. package/dist/types/InternalTypes.d.ts +0 -3
  25. package/dist/types/commonTypes.d.ts +2 -2
  26. package/dist/types/socketMessageTypes.d.ts +0 -2
  27. package/dist/types/socketMessageTypes.js +6 -7
  28. package/package.json +20 -26
  29. package/dist/utils/docutils.d.ts +0 -9
  30. package/dist/utils/docutils.js +0 -69
  31. package/dist/utils/mcpServer.d.ts +0 -481
  32. package/dist/utils/mcpServer.js +0 -779
  33. package/dist/utils/parse-source-code/index.d.ts +0 -9
  34. package/dist/utils/parse-source-code/index.js +0 -233
  35. package/dist/utils/parse-source-code/languageParser.d.ts +0 -2
  36. package/dist/utils/parse-source-code/languageParser.js +0 -137
  37. package/dist/utils/parse-source-code/queries/c-sharp.d.ts +0 -2
  38. package/dist/utils/parse-source-code/queries/c-sharp.js +0 -25
  39. package/dist/utils/parse-source-code/queries/c.d.ts +0 -2
  40. package/dist/utils/parse-source-code/queries/c.js +0 -17
  41. package/dist/utils/parse-source-code/queries/cpp.d.ts +0 -2
  42. package/dist/utils/parse-source-code/queries/cpp.js +0 -25
  43. package/dist/utils/parse-source-code/queries/go.d.ts +0 -2
  44. package/dist/utils/parse-source-code/queries/go.js +0 -29
  45. package/dist/utils/parse-source-code/queries/index.d.ts +0 -12
  46. package/dist/utils/parse-source-code/queries/index.js +0 -30
  47. package/dist/utils/parse-source-code/queries/java.d.ts +0 -2
  48. package/dist/utils/parse-source-code/queries/java.js +0 -17
  49. package/dist/utils/parse-source-code/queries/javascript.d.ts +0 -2
  50. package/dist/utils/parse-source-code/queries/javascript.js +0 -67
  51. package/dist/utils/parse-source-code/queries/php.d.ts +0 -2
  52. package/dist/utils/parse-source-code/queries/php.js +0 -17
  53. package/dist/utils/parse-source-code/queries/python.d.ts +0 -2
  54. package/dist/utils/parse-source-code/queries/python.js +0 -13
  55. package/dist/utils/parse-source-code/queries/ruby.d.ts +0 -2
  56. package/dist/utils/parse-source-code/queries/ruby.js +0 -54
  57. package/dist/utils/parse-source-code/queries/rust.d.ts +0 -2
  58. package/dist/utils/parse-source-code/queries/rust.js +0 -18
  59. package/dist/utils/parse-source-code/queries/swift.d.ts +0 -2
  60. package/dist/utils/parse-source-code/queries/swift.js +0 -47
  61. package/dist/utils/parse-source-code/queries/typescript.d.ts +0 -2
  62. package/dist/utils/parse-source-code/queries/typescript.js +0 -34
  63. package/dist/utils/parse-source-code/tree-sitter-c.wasm +0 -0
  64. package/dist/utils/parse-source-code/tree-sitter-c_sharp.wasm +0 -0
  65. package/dist/utils/parse-source-code/tree-sitter-cpp.wasm +0 -0
  66. package/dist/utils/parse-source-code/tree-sitter-go.wasm +0 -0
  67. package/dist/utils/parse-source-code/tree-sitter-java.wasm +0 -0
  68. package/dist/utils/parse-source-code/tree-sitter-javascript.wasm +0 -0
  69. package/dist/utils/parse-source-code/tree-sitter-php.wasm +0 -0
  70. package/dist/utils/parse-source-code/tree-sitter-python.wasm +0 -0
  71. package/dist/utils/parse-source-code/tree-sitter-ruby.wasm +0 -0
  72. package/dist/utils/parse-source-code/tree-sitter-rust.wasm +0 -0
  73. package/dist/utils/parse-source-code/tree-sitter-swift.wasm +0 -0
  74. package/dist/utils/parse-source-code/tree-sitter-tsx.wasm +0 -0
  75. package/dist/utils/parse-source-code/tree-sitter-typescript.wasm +0 -0
  76. package/dist/utils/parse-source-code/tree-sitter.wasm +0 -0
  77. package/dist/utils.d.ts +0 -2
  78. package/dist/utils.js +0 -10
@@ -1,481 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
- /// <reference types="node" />
5
- import { Server } from "@modelcontextprotocol/sdk/server/index.js";
6
- import { ClientCapabilities, CreateMessageRequestSchema, Root } from "@modelcontextprotocol/sdk/types.js";
7
- import { z } from "zod";
8
- import { StrictEventEmitter } from "strict-event-emitter-types";
9
- import { EventEmitter } from "events";
10
- import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
11
- import http from "http";
12
- /**
13
- * Type definition for SSE Server that can be closed.
14
- */
15
- export type SSEServer = {
16
- close: () => Promise<void>;
17
- };
18
- /**
19
- * Event types for the FastMCP event emitter.
20
- */
21
- type FastMCPEvents<T extends FastMCPSessionAuth> = {
22
- connect: (event: {
23
- session: FastMCPSession<T>;
24
- }) => void;
25
- disconnect: (event: {
26
- session: FastMCPSession<T>;
27
- }) => void;
28
- };
29
- /**
30
- * Event types for FastMCPSession event emitter.
31
- */
32
- type FastMCPSessionEvents = {
33
- rootsChanged: (event: {
34
- roots: Root[];
35
- }) => void;
36
- error: (event: {
37
- error: Error;
38
- }) => void;
39
- };
40
- /**
41
- * Generates an image content object from a URL, file path, or buffer.
42
- *
43
- * @param input - The input source for the image (URL, file path, or buffer)
44
- * @returns Promise with the image content object
45
- */
46
- export declare const imageContent: (input: {
47
- url: string;
48
- } | {
49
- path: string;
50
- } | {
51
- buffer: Buffer;
52
- }) => Promise<ImageContent>;
53
- /**
54
- * Base class for FastMCP errors.
55
- */
56
- declare abstract class FastMCPError extends Error {
57
- constructor(message?: string);
58
- }
59
- /**
60
- * Type for extra data in errors.
61
- */
62
- type Extra = unknown;
63
- /**
64
- * Type for a record of extra data.
65
- */
66
- type Extras = Record<string, Extra>;
67
- /**
68
- * Error class for unexpected state conditions.
69
- */
70
- export declare class UnexpectedStateError extends FastMCPError {
71
- /** Additional context for the error */
72
- extras?: Extras;
73
- /**
74
- * Creates a new UnexpectedStateError.
75
- *
76
- * @param message - Error message
77
- * @param extras - Additional context for the error
78
- */
79
- constructor(message: string, extras?: Extras);
80
- }
81
- /**
82
- * Error that is meant to be surfaced to the user.
83
- */
84
- export declare class UserError extends UnexpectedStateError {
85
- }
86
- /**
87
- * Type for tool parameters schema.
88
- */
89
- type ToolParameters = z.ZodTypeAny;
90
- /**
91
- * Type for literal values.
92
- */
93
- type Literal = boolean | null | number | string | undefined;
94
- /**
95
- * Type for serializable values that can be passed around.
96
- */
97
- type SerializableValue = Literal | SerializableValue[] | {
98
- [key: string]: SerializableValue;
99
- };
100
- /**
101
- * Type for reporting progress of operations.
102
- */
103
- type Progress = {
104
- /**
105
- * The progress thus far. This should increase every time progress is made, even if the total is unknown.
106
- */
107
- progress: number;
108
- /**
109
- * Total number of items to process (or total progress required), if known.
110
- */
111
- total?: number;
112
- };
113
- /**
114
- * Context object passed to tool execution functions.
115
- */
116
- type Context<T extends FastMCPSessionAuth> = {
117
- /** The session authentication context */
118
- session: T | undefined;
119
- /** Function to report progress of operations */
120
- reportProgress: (progress: Progress) => Promise<void>;
121
- /** Logging functions */
122
- log: {
123
- debug: (message: string, data?: SerializableValue) => void;
124
- error: (message: string, data?: SerializableValue) => void;
125
- info: (message: string, data?: SerializableValue) => void;
126
- warn: (message: string, data?: SerializableValue) => void;
127
- };
128
- };
129
- /**
130
- * Type for text content in messages.
131
- */
132
- type TextContent = {
133
- /** Always "text" for text content */
134
- type: "text";
135
- /** The text content */
136
- text: string;
137
- };
138
- /**
139
- * Type for image content in messages.
140
- */
141
- type ImageContent = {
142
- /** Always "image" for image content */
143
- type: "image";
144
- /** Base64-encoded image data */
145
- data: string;
146
- /** The MIME type of the image */
147
- mimeType: string;
148
- };
149
- /**
150
- * Union type for content in messages.
151
- */
152
- type Content = TextContent | ImageContent;
153
- /**
154
- * Type for content results from tool executions.
155
- */
156
- type ContentResult = {
157
- /** Array of content blocks */
158
- content: Content[];
159
- /** Whether this result represents an error */
160
- isError?: boolean;
161
- };
162
- /**
163
- * Type for completion results.
164
- */
165
- type Completion = {
166
- /** Array of completion values */
167
- values: string[];
168
- /** The total number of completions available */
169
- total?: number;
170
- /** Whether there are more completions available */
171
- hasMore?: boolean;
172
- };
173
- /**
174
- * Type for a tool that can be executed.
175
- */
176
- type Tool<T extends FastMCPSessionAuth, Params extends ToolParameters = ToolParameters> = {
177
- /** Name of the tool */
178
- name: string;
179
- /** Optional description of the tool's functionality */
180
- description?: string;
181
- /** Optional parameters schema for the tool */
182
- parameters?: Params;
183
- /** Function to execute the tool */
184
- execute: (args: z.infer<Params>, context: Context<T>) => Promise<string | ContentResult | TextContent | ImageContent>;
185
- };
186
- /**
187
- * Type for resource results.
188
- */
189
- type ResourceResult = {
190
- text: string;
191
- } | {
192
- blob: string;
193
- };
194
- /**
195
- * Type for input resource template arguments.
196
- */
197
- type InputResourceTemplateArgument = Readonly<{
198
- name: string;
199
- description?: string;
200
- complete?: ArgumentValueCompleter;
201
- }>;
202
- /**
203
- * Type for resource template arguments.
204
- */
205
- type ResourceTemplateArgument = Readonly<{
206
- name: string;
207
- description?: string;
208
- complete?: ArgumentValueCompleter;
209
- }>;
210
- /**
211
- * Type transformation from argument array to object.
212
- */
213
- type ResourceTemplateArgumentsToObject<T extends {
214
- name: string;
215
- }[]> = {
216
- [K in T[number]["name"]]: string;
217
- };
218
- /**
219
- * Type for input resource templates.
220
- */
221
- type InputResourceTemplate<Arguments extends ResourceTemplateArgument[] = ResourceTemplateArgument[]> = {
222
- /** URI template for the resource */
223
- uriTemplate: string;
224
- /** Name of the template */
225
- name: string;
226
- /** Optional description */
227
- description?: string;
228
- /** Optional MIME type */
229
- mimeType?: string;
230
- /** Arguments for the template */
231
- arguments: Arguments;
232
- /** Function to load the resource */
233
- load: (args: ResourceTemplateArgumentsToObject<Arguments>) => Promise<ResourceResult>;
234
- };
235
- /**
236
- * Type for a resource.
237
- */
238
- type Resource = {
239
- /** URI of the resource */
240
- uri: string;
241
- /** Name of the resource */
242
- name: string;
243
- /** Optional description */
244
- description?: string;
245
- /** Optional MIME type */
246
- mimeType?: string;
247
- /** Function to load the resource */
248
- load: () => Promise<ResourceResult | ResourceResult[]>;
249
- /** Optional completion function */
250
- complete?: (name: string, value: string) => Promise<Completion>;
251
- };
252
- /**
253
- * Type for argument value completion.
254
- */
255
- type ArgumentValueCompleter = (value: string) => Promise<Completion>;
256
- /**
257
- * Type for input prompt arguments.
258
- */
259
- type InputPromptArgument = Readonly<{
260
- /** Name of the argument */
261
- name: string;
262
- /** Optional description */
263
- description?: string;
264
- /** Whether the argument is required */
265
- required?: boolean;
266
- /** Optional completion function */
267
- complete?: ArgumentValueCompleter;
268
- /** Optional enum of possible values */
269
- enum?: string[];
270
- }>;
271
- /**
272
- * Type transformation from prompt arguments to object.
273
- */
274
- type PromptArgumentsToObject<T extends {
275
- name: string;
276
- required?: boolean;
277
- }[]> = {
278
- [K in T[number]["name"]]: Extract<T[number], {
279
- name: K;
280
- }>["required"] extends true ? string : string | undefined;
281
- };
282
- /**
283
- * Type for input prompts.
284
- */
285
- type InputPrompt<Arguments extends InputPromptArgument[] = InputPromptArgument[], Args = PromptArgumentsToObject<Arguments>> = {
286
- /** Name of the prompt */
287
- name: string;
288
- /** Optional description */
289
- description?: string;
290
- /** Optional arguments */
291
- arguments?: InputPromptArgument[];
292
- /** Function to load the prompt */
293
- load: (args: Args) => Promise<string>;
294
- };
295
- /**
296
- * Type for prompt arguments.
297
- */
298
- type PromptArgument = Readonly<{
299
- /** Name of the argument */
300
- name: string;
301
- /** Optional description */
302
- description?: string;
303
- /** Whether the argument is required */
304
- required?: boolean;
305
- /** Optional completion function */
306
- complete?: ArgumentValueCompleter;
307
- /** Optional enum of possible values */
308
- enum?: string[];
309
- }>;
310
- /**
311
- * Type for prompts.
312
- */
313
- type Prompt<Arguments extends PromptArgument[] = PromptArgument[], Args = PromptArgumentsToObject<Arguments>> = {
314
- /** Optional arguments */
315
- arguments?: PromptArgument[];
316
- /** Optional completion function */
317
- complete?: (name: string, value: string) => Promise<Completion>;
318
- /** Optional description */
319
- description?: string;
320
- /** Function to load the prompt */
321
- load: (args: Args) => Promise<string>;
322
- /** Name of the prompt */
323
- name: string;
324
- };
325
- /**
326
- * Type for server options.
327
- */
328
- type ServerOptions<T extends FastMCPSessionAuth> = {
329
- /** Name of the server */
330
- name: string;
331
- /** Version of the server */
332
- version: `${number}.${number}.${number}`;
333
- /** Optional authentication function */
334
- authenticate?: Authenticate<T>;
335
- };
336
- /**
337
- * Type for logging levels.
338
- */
339
- type LoggingLevel = "debug" | "info" | "notice" | "warning" | "error" | "critical" | "alert" | "emergency";
340
- declare const FastMCPSessionEventEmitterBase: {
341
- new (): StrictEventEmitter<EventEmitter, FastMCPSessionEvents>;
342
- };
343
- declare class FastMCPSessionEventEmitter extends FastMCPSessionEventEmitterBase {
344
- }
345
- /**
346
- * Type for sampling responses.
347
- */
348
- type SamplingResponse = {
349
- /** The model used */
350
- model: string;
351
- /** Optional reason for stopping */
352
- stopReason?: "endTurn" | "stopSequence" | "maxTokens" | string;
353
- /** Role of the message */
354
- role: "user" | "assistant";
355
- /** Content of the message */
356
- content: TextContent | ImageContent;
357
- };
358
- /**
359
- * Type for session authentication.
360
- */
361
- type FastMCPSessionAuth = Record<string, unknown> | undefined;
362
- /**
363
- * Class representing a FastMCP session.
364
- * Manages communication between the client and server.
365
- */
366
- export declare class FastMCPSession<T extends FastMCPSessionAuth = FastMCPSessionAuth> extends FastMCPSessionEventEmitter {
367
- #private;
368
- /**
369
- * Creates a new FastMCPSession.
370
- *
371
- * @param options - Configuration options for the session
372
- */
373
- constructor({ auth, name, version, tools, resources, resourcesTemplates, prompts, }: {
374
- auth?: T;
375
- name: string;
376
- version: string;
377
- tools: Tool<T>[];
378
- resources: Resource[];
379
- resourcesTemplates: InputResourceTemplate[];
380
- prompts: Prompt[];
381
- });
382
- private addResource;
383
- private addResourceTemplate;
384
- private addPrompt;
385
- get clientCapabilities(): ClientCapabilities | null;
386
- get server(): Server;
387
- requestSampling(message: z.infer<typeof CreateMessageRequestSchema>["params"]): Promise<SamplingResponse>;
388
- connect(transport: Transport): Promise<void>;
389
- get roots(): Root[];
390
- close(): Promise<void>;
391
- private setupErrorHandling;
392
- get loggingLevel(): LoggingLevel;
393
- private setupCompleteHandlers;
394
- private setupRootsHandlers;
395
- private setupLoggingHandlers;
396
- private setupToolHandlers;
397
- private setupResourceHandlers;
398
- private setupResourceTemplateHandlers;
399
- private setupPromptHandlers;
400
- }
401
- declare const FastMCPEventEmitterBase: {
402
- new (): StrictEventEmitter<EventEmitter, FastMCPEvents<FastMCPSessionAuth>>;
403
- };
404
- declare class FastMCPEventEmitter extends FastMCPEventEmitterBase {
405
- }
406
- type Authenticate<T> = (request: http.IncomingMessage) => Promise<T>;
407
- /**
408
- * Class representing a toolbox for FastMCP.
409
- * Manages tools, resources, and prompts for a Model Context Protocol server.
410
- */
411
- export declare class MCPServer<T extends Record<string, unknown> | undefined = undefined> extends FastMCPEventEmitter {
412
- #private;
413
- options: ServerOptions<T>;
414
- /**
415
- * Creates a new ToolBox instance.
416
- *
417
- * @param options - Configuration options for the toolbox
418
- */
419
- constructor(options: ServerOptions<T>);
420
- /**
421
- * Gets all active sessions.
422
- */
423
- get sessions(): FastMCPSession<T>[];
424
- /**
425
- * Adds a tool to the server.
426
- *
427
- * @param tool - The tool to add
428
- */
429
- addTool<Params extends ToolParameters>(tool: Tool<T, Params>): void;
430
- /**
431
- * Adds a resource to the server.
432
- *
433
- * @param resource - The resource to add
434
- */
435
- addResource(resource: Resource): void;
436
- /**
437
- * Adds a resource template to the server.
438
- *
439
- * @param resource - The resource template to add
440
- */
441
- addResourceTemplate<const Args extends InputResourceTemplateArgument[]>(resource: InputResourceTemplate<Args>): void;
442
- /**
443
- * Adds a prompt to the server.
444
- *
445
- * @param prompt - The prompt to add
446
- */
447
- addPrompt<const Args extends InputPromptArgument[]>(prompt: InputPrompt<Args>): void;
448
- /**
449
- * Starts the server.
450
- *
451
- * @param options - Options for the server transport
452
- */
453
- start(options?: {
454
- transportType: "stdio";
455
- } | {
456
- transportType: "sse";
457
- sse: {
458
- endpoint: `/${string}`;
459
- port: number;
460
- };
461
- }): Promise<void>;
462
- /**
463
- * Stops the server.
464
- */
465
- stop(): Promise<void>;
466
- /**
467
- * Activates the server.
468
- *
469
- * @param options - Options for the server transport
470
- */
471
- activate(options?: {
472
- transportType: "stdio";
473
- } | {
474
- transportType: "sse";
475
- sse: {
476
- endpoint: `/${string}`;
477
- port: number;
478
- };
479
- }): Promise<void>;
480
- }
481
- export {};