@codebolt/codeboltjs 2.2.1 → 2.2.3

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 (72) hide show
  1. package/Readme.md +3 -0
  2. package/dist/core/Codebolt.d.ts +212 -165
  3. package/dist/core/Codebolt.js +267 -6
  4. package/dist/core/websocket.js +9 -11
  5. package/dist/index.d.ts +1 -1
  6. package/dist/modules/agent.d.ts +2 -16
  7. package/dist/modules/agent.js +15 -33
  8. package/dist/modules/browser.d.ts +1 -1
  9. package/dist/modules/browser.js +52 -51
  10. package/dist/modules/chat.d.ts +2 -2
  11. package/dist/modules/chat.js +20 -18
  12. package/dist/modules/codeutils.d.ts +1 -9
  13. package/dist/modules/codeutils.js +13 -111
  14. package/dist/modules/dbmemory.d.ts +3 -3
  15. package/dist/modules/dbmemory.js +8 -7
  16. package/dist/modules/debug.d.ts +1 -1
  17. package/dist/modules/fs.d.ts +59 -28
  18. package/dist/modules/fs.js +86 -45
  19. package/dist/modules/git.d.ts +1 -1
  20. package/dist/modules/git.js +31 -30
  21. package/dist/modules/history.d.ts +1 -1
  22. package/dist/modules/history.js +7 -6
  23. package/dist/modules/llm.d.ts +13 -20
  24. package/dist/modules/llm.js +16 -15
  25. package/dist/modules/mcp.d.ts +4 -4
  26. package/dist/modules/mcp.js +25 -25
  27. package/dist/modules/outputparsers.d.ts +22 -22
  28. package/dist/modules/outputparsers.js +7 -5
  29. package/dist/modules/project.d.ts +1 -1
  30. package/dist/modules/project.js +15 -13
  31. package/dist/modules/state.d.ts +1 -1
  32. package/dist/modules/state.js +16 -15
  33. package/dist/modules/task.d.ts +136 -92
  34. package/dist/modules/task.js +354 -205
  35. package/dist/modules/terminal.d.ts +1 -1
  36. package/dist/modules/terminal.js +12 -11
  37. package/dist/modules/tokenizer.d.ts +1 -1
  38. package/dist/modules/tokenizer.js +7 -6
  39. package/dist/modules/user-message-manager.d.ts +165 -0
  40. package/dist/modules/user-message-manager.js +308 -0
  41. package/dist/modules/user-message-utilities.d.ts +111 -0
  42. package/dist/modules/user-message-utilities.js +115 -0
  43. package/dist/modules/utils.d.ts +1 -1
  44. package/dist/modules/utils.js +4 -3
  45. package/dist/modules/vectordb.d.ts +1 -1
  46. package/dist/modules/vectordb.js +13 -12
  47. package/dist/notificationfunctions/agent.js +7 -6
  48. package/dist/notificationfunctions/browser.js +9 -8
  49. package/dist/notificationfunctions/chat.js +9 -8
  50. package/dist/notificationfunctions/codeutils.js +9 -8
  51. package/dist/notificationfunctions/crawler.js +9 -8
  52. package/dist/notificationfunctions/dbmemory.js +9 -8
  53. package/dist/notificationfunctions/fs.js +45 -44
  54. package/dist/notificationfunctions/git.d.ts +2 -2
  55. package/dist/notificationfunctions/git.js +111 -51
  56. package/dist/notificationfunctions/history.js +9 -8
  57. package/dist/notificationfunctions/llm.js +9 -8
  58. package/dist/notificationfunctions/mcp.js +17 -16
  59. package/dist/notificationfunctions/search.js +13 -12
  60. package/dist/notificationfunctions/system.js +5 -4
  61. package/dist/notificationfunctions/terminal.js +5 -4
  62. package/dist/notificationfunctions/todo.js +13 -12
  63. package/dist/types/commonTypes.d.ts +4 -0
  64. package/dist/types/index.d.ts +1 -1
  65. package/dist/types/libFunctionTypes.d.ts +918 -29
  66. package/dist/types/libFunctionTypes.js +33 -0
  67. package/dist/types/notificationFunctions/git.d.ts +40 -1
  68. package/dist/types/notificationFunctions/index.d.ts +1 -0
  69. package/dist/types/notificationFunctions/index.js +1 -0
  70. package/package.json +17 -25
  71. package/dist/modules/codeparsers.d.ts +0 -37
  72. package/dist/modules/codeparsers.js +0 -329
@@ -7,6 +7,42 @@
7
7
  * - Configuration options for library functions
8
8
  * - User-facing data structures
9
9
  */
10
+ /**
11
+ * Content block within a message
12
+ */
13
+ export interface MessageContentBlock {
14
+ /** Type of content block */
15
+ type: 'text' | 'image' | 'file' | 'code' | 'error' | 'tool_result';
16
+ /** Text content for text blocks */
17
+ text?: string;
18
+ /** Image URL for image blocks */
19
+ image_url?: string;
20
+ /** File information for file blocks */
21
+ file?: {
22
+ name: string;
23
+ path: string;
24
+ size?: number;
25
+ type?: string;
26
+ };
27
+ /** Code information for code blocks */
28
+ code?: {
29
+ language: string;
30
+ code: string;
31
+ filename?: string;
32
+ };
33
+ /** Error information for error blocks */
34
+ error?: {
35
+ message: string;
36
+ code?: string;
37
+ details?: Record<string, unknown>;
38
+ };
39
+ /** Tool result for tool_result blocks */
40
+ tool_result?: {
41
+ tool_name: string;
42
+ result: unknown;
43
+ success: boolean;
44
+ };
45
+ }
10
46
  /**
11
47
  * Represents a message in the conversation with roles and content.
12
48
  */
@@ -14,13 +50,13 @@ export interface Message {
14
50
  /** The role of the message sender: user, assistant, tool, or system */
15
51
  role: 'user' | 'assistant' | 'tool' | 'system';
16
52
  /** The content of the message, can be an array of content blocks or a string */
17
- content: any[] | string;
53
+ content: MessageContentBlock[] | string;
18
54
  /** Optional ID for tool calls */
19
55
  tool_call_id?: string;
20
56
  /** Optional tool calls for assistant messages */
21
57
  tool_calls?: ToolCall[];
22
58
  /** Additional properties that might be present */
23
- [key: string]: any;
59
+ [key: string]: unknown;
24
60
  }
25
61
  /**
26
62
  * Represents a tool call in OpenAI format
@@ -38,6 +74,33 @@ export interface ToolCall {
38
74
  arguments: string;
39
75
  };
40
76
  }
77
+ /**
78
+ * JSON Schema for tool parameters
79
+ */
80
+ export interface JSONSchema {
81
+ /** Schema type */
82
+ type: 'object' | 'array' | 'string' | 'number' | 'boolean' | 'integer';
83
+ /** Schema description */
84
+ description?: string;
85
+ /** Required properties for objects */
86
+ required?: string[];
87
+ /** Properties for objects */
88
+ properties?: Record<string, JSONSchema>;
89
+ /** Items for arrays */
90
+ items?: JSONSchema;
91
+ /** Enum values */
92
+ enum?: unknown[];
93
+ /** Minimum value for numbers */
94
+ minimum?: number;
95
+ /** Maximum value for numbers */
96
+ maximum?: number;
97
+ /** Pattern for strings */
98
+ pattern?: string;
99
+ /** Format for strings */
100
+ format?: string;
101
+ /** Additional properties allowed */
102
+ additionalProperties?: boolean | JSONSchema;
103
+ }
41
104
  /**
42
105
  * Represents a tool definition in OpenAI format
43
106
  */
@@ -51,7 +114,7 @@ export interface Tool {
51
114
  /** Description of what the function does */
52
115
  description?: string;
53
116
  /** JSON schema for the function parameters */
54
- parameters?: any;
117
+ parameters?: JSONSchema;
55
118
  };
56
119
  }
57
120
  /**
@@ -131,7 +194,7 @@ export interface ConversationEntry {
131
194
  text: string;
132
195
  }>;
133
196
  tool_call_id?: string;
134
- tool_calls?: any[];
197
+ tool_calls?: ToolCall[];
135
198
  }
136
199
  /**
137
200
  * Result from a tool execution
@@ -142,9 +205,9 @@ export interface ToolResult {
142
205
  /** ID that links this result to the original tool call */
143
206
  tool_call_id: string;
144
207
  /** The content returned by the tool */
145
- content: any;
208
+ content: string | Record<string, unknown>;
146
209
  /** Optional user message to be added after tool execution */
147
- userMessage?: any;
210
+ userMessage?: string | Record<string, unknown>;
148
211
  }
149
212
  /**
150
213
  * Details about a tool to be executed
@@ -153,7 +216,7 @@ export interface ToolDetails {
153
216
  /** The name of the tool to execute */
154
217
  toolName: string;
155
218
  /** Input parameters for the tool */
156
- toolInput: any;
219
+ toolInput: Record<string, unknown>;
157
220
  /** Unique ID for this tool use instance */
158
221
  toolUseId: string;
159
222
  }
@@ -196,9 +259,13 @@ export interface UserMessage {
196
259
  /** Thread identifier */
197
260
  threadId: string;
198
261
  /** Any text selection in the editor */
199
- selection?: any;
262
+ selection?: {
263
+ start: number;
264
+ end: number;
265
+ text: string;
266
+ };
200
267
  remixPrompt?: string;
201
- mentionedAgents?: [];
268
+ mentionedAgents?: string[];
202
269
  }
203
270
  /**
204
271
  * Interface for codebolt API functionality
@@ -208,11 +275,11 @@ export interface CodeboltAPI {
208
275
  listMcpFromServers: (servers: string[]) => Promise<{
209
276
  data: OpenAITool[];
210
277
  }>;
211
- getTools: (mcps: any[]) => Promise<{
278
+ getTools: (mcps: string[]) => Promise<{
212
279
  data: OpenAITool[];
213
280
  }>;
214
- executeTool: (toolboxName: string, actualToolName: string, toolInput: any) => Promise<{
215
- data: any;
281
+ executeTool: (toolboxName: string, actualToolName: string, toolInput: Record<string, unknown>) => Promise<{
282
+ data: string | Record<string, unknown>;
216
283
  }>;
217
284
  };
218
285
  fs: {
@@ -228,7 +295,7 @@ export interface CodeboltAPI {
228
295
  }>;
229
296
  };
230
297
  chat: {
231
- sendMessage: (message: string, metadata: any) => Promise<void>;
298
+ sendMessage: (message: string, metadata: Record<string, unknown>) => Promise<void>;
232
299
  };
233
300
  }
234
301
  export interface ReadFileOptions {
@@ -277,6 +344,397 @@ export interface GrepSearchOptions {
277
344
  /** Whether search is case sensitive */
278
345
  caseSensitive?: boolean;
279
346
  }
347
+ /**
348
+ * File information structure
349
+ */
350
+ export interface FileInfo {
351
+ /** File or directory name */
352
+ name: string;
353
+ /** Full path to the file or directory */
354
+ path: string;
355
+ /** Whether this is a directory */
356
+ isDirectory: boolean;
357
+ /** File size in bytes */
358
+ size?: number;
359
+ /** Last modified timestamp */
360
+ modified?: string;
361
+ /** Creation timestamp */
362
+ created?: string;
363
+ /** File permissions */
364
+ permissions?: string;
365
+ /** File extension */
366
+ extension?: string;
367
+ }
368
+ /**
369
+ * Search match information
370
+ */
371
+ export interface SearchMatch {
372
+ /** Line number where match was found */
373
+ line: number;
374
+ /** Content of the line */
375
+ content: string;
376
+ /** Line number (alias for line) */
377
+ lineNumber: number;
378
+ /** Column where match starts */
379
+ column?: number;
380
+ /** Length of the match */
381
+ matchLength?: number;
382
+ }
383
+ /**
384
+ * File search result
385
+ */
386
+ export interface FileSearchResult {
387
+ /** Path to the file */
388
+ path: string;
389
+ /** Matches found in the file */
390
+ matches: SearchMatch[];
391
+ /** Relevance score for fuzzy search */
392
+ score?: number;
393
+ }
394
+ /**
395
+ * Grep search result
396
+ */
397
+ export interface GrepSearchResult {
398
+ /** Path to the file */
399
+ file: string;
400
+ /** Line number where match was found */
401
+ line: number;
402
+ /** Content of the line */
403
+ content: string;
404
+ /** The actual match text */
405
+ match: string;
406
+ /** Column where match starts */
407
+ column?: number;
408
+ /** Context lines before and after */
409
+ context?: {
410
+ before: string[];
411
+ after: string[];
412
+ };
413
+ }
414
+ /**
415
+ * Code definition information
416
+ */
417
+ export interface CodeDefinition {
418
+ /** Name of the definition */
419
+ name: string;
420
+ /** Type of definition (function, class, variable, etc.) */
421
+ type: string;
422
+ /** File path where definition is located */
423
+ file: string;
424
+ /** Line number where definition starts */
425
+ line: number;
426
+ /** Column where definition starts */
427
+ column?: number;
428
+ /** Scope of the definition */
429
+ scope?: string;
430
+ /** Documentation comment if available */
431
+ documentation?: string;
432
+ }
433
+ /**
434
+ * Diff result information
435
+ */
436
+ export interface DiffResult {
437
+ /** Status of the diff operation */
438
+ status: 'success' | 'error' | 'review_started' | 'rejected';
439
+ /** File that was modified */
440
+ file: string;
441
+ /** Result message */
442
+ message: string;
443
+ /** Diff content if available */
444
+ diff?: string;
445
+ /** Applied changes summary */
446
+ changes?: {
447
+ added: number;
448
+ removed: number;
449
+ modified: number;
450
+ };
451
+ }
452
+ /**
453
+ * Base response interface for all FS operations
454
+ */
455
+ export interface BaseFSResponse {
456
+ /** Response type identifier */
457
+ type: string;
458
+ /** Unique request identifier */
459
+ requestId: string;
460
+ /** Whether the operation was successful */
461
+ success?: boolean;
462
+ /** Response message */
463
+ message?: string;
464
+ /** Response data - specific to each operation type */
465
+ data?: FileInfo[] | FileSearchResult[] | GrepSearchResult[] | CodeDefinition[] | DiffResult | string | number | boolean | Record<string, unknown>;
466
+ /** Error message if operation failed */
467
+ error?: string;
468
+ }
469
+ /**
470
+ * Create file response types
471
+ */
472
+ export interface CreateFileSuccessResponse extends BaseFSResponse {
473
+ type: 'createFileResponse';
474
+ success: true;
475
+ }
476
+ export interface CreateFileErrorResponse extends BaseFSResponse {
477
+ type: 'createFileResponse';
478
+ success: false;
479
+ error: string;
480
+ }
481
+ /**
482
+ * Create folder response types
483
+ */
484
+ export interface CreateFolderSuccessResponse extends BaseFSResponse {
485
+ type: 'createFolderResponse';
486
+ success: true;
487
+ }
488
+ export interface CreateFolderErrorResponse extends BaseFSResponse {
489
+ type: 'createFolderResponse';
490
+ success: false;
491
+ error: string;
492
+ }
493
+ /**
494
+ * Read file response types
495
+ */
496
+ export interface ReadFileSuccessResponse extends BaseFSResponse {
497
+ type: 'readFileResponse';
498
+ success: true;
499
+ /** File content */
500
+ content?: string;
501
+ }
502
+ export interface ReadFileErrorResponse extends BaseFSResponse {
503
+ type: 'readFileResponse';
504
+ success: false;
505
+ error: string;
506
+ }
507
+ /**
508
+ * Update file response types
509
+ */
510
+ export interface UpdateFileSuccessResponse extends BaseFSResponse {
511
+ type: 'updateFileResponse';
512
+ success: true;
513
+ }
514
+ export interface UpdateFileErrorResponse extends BaseFSResponse {
515
+ type: 'updateFileResponse';
516
+ success: false;
517
+ error: string;
518
+ }
519
+ /**
520
+ * Delete file response types
521
+ */
522
+ export interface DeleteFileSuccessResponse extends BaseFSResponse {
523
+ type: 'deleteFileResponse';
524
+ success: true;
525
+ }
526
+ export interface DeleteFileErrorResponse extends BaseFSResponse {
527
+ type: 'deleteFileResponse';
528
+ success: false;
529
+ error: string;
530
+ }
531
+ /**
532
+ * Delete folder response types
533
+ */
534
+ export interface DeleteFolderSuccessResponse extends BaseFSResponse {
535
+ type: 'deleteFolderResponse';
536
+ success: true;
537
+ }
538
+ export interface DeleteFolderErrorResponse extends BaseFSResponse {
539
+ type: 'deleteFolderResponse';
540
+ success: false;
541
+ error: string;
542
+ }
543
+ /**
544
+ * File list response types
545
+ */
546
+ export interface FileListSuccessResponse extends BaseFSResponse {
547
+ type: 'fileListResponse';
548
+ success: true;
549
+ /** Array of file information */
550
+ files?: FileInfo[];
551
+ }
552
+ export interface FileListErrorResponse extends BaseFSResponse {
553
+ type: 'fileListResponse';
554
+ success: false;
555
+ error: string;
556
+ }
557
+ /**
558
+ * Search files response types
559
+ */
560
+ export interface SearchFilesSuccessResponse extends BaseFSResponse {
561
+ type: 'searchFilesResponse';
562
+ success: true;
563
+ /** Search results */
564
+ files?: FileSearchResult[];
565
+ }
566
+ export interface SearchFilesErrorResponse extends BaseFSResponse {
567
+ type: 'searchFilesResponse';
568
+ success: false;
569
+ error: string;
570
+ }
571
+ /**
572
+ * Write to file response types
573
+ */
574
+ export interface WriteToFileSuccessResponse extends BaseFSResponse {
575
+ type: 'writeToFileResponse';
576
+ success: true;
577
+ }
578
+ export interface WriteToFileErrorResponse extends BaseFSResponse {
579
+ type: 'writeToFileResponse';
580
+ success: false;
581
+ error: string;
582
+ }
583
+ /**
584
+ * Grep search response types
585
+ */
586
+ export interface GrepSearchSuccessResponse extends BaseFSResponse {
587
+ type: 'grepSearchResponse';
588
+ success: true;
589
+ /** Search results */
590
+ results?: GrepSearchResult[];
591
+ }
592
+ export interface GrepSearchErrorResponse extends BaseFSResponse {
593
+ type: 'grepSearchResponse';
594
+ success: false;
595
+ error: string;
596
+ }
597
+ /**
598
+ * File search response types
599
+ */
600
+ export interface FileSearchSuccessResponse extends BaseFSResponse {
601
+ type: 'fileSearchResponse';
602
+ success: true;
603
+ /** Array of matching file paths */
604
+ files?: string[];
605
+ }
606
+ export interface FileSearchErrorResponse extends BaseFSResponse {
607
+ type: 'fileSearchResponse';
608
+ success: false;
609
+ error: string;
610
+ }
611
+ /**
612
+ * List code definition names response types
613
+ */
614
+ export interface ListCodeDefinitionNamesSuccessResponse extends BaseFSResponse {
615
+ type: 'listCodeDefinitionNamesResponse';
616
+ success: true;
617
+ /** Array of code definition names */
618
+ definitions?: string[];
619
+ /** Detailed code definition information */
620
+ codeDefinitions?: CodeDefinition[];
621
+ }
622
+ export interface ListCodeDefinitionNamesErrorResponse extends BaseFSResponse {
623
+ type: 'listCodeDefinitionNamesResponse';
624
+ success: false;
625
+ error: string;
626
+ }
627
+ /**
628
+ * Edit file with diff response types
629
+ */
630
+ export interface EditFileAndApplyDiffSuccessResponse extends BaseFSResponse {
631
+ type: 'editFileAndApplyDiffResponse';
632
+ success: true;
633
+ /** Diff result information */
634
+ data?: DiffResult;
635
+ }
636
+ export interface EditFileAndApplyDiffErrorResponse extends BaseFSResponse {
637
+ type: 'editFileAndApplyDiffResponse';
638
+ success: false;
639
+ error: string;
640
+ }
641
+ /**
642
+ * Union type for all FS responses
643
+ */
644
+ export type FSResponse = CreateFileSuccessResponse | CreateFileErrorResponse | CreateFolderSuccessResponse | CreateFolderErrorResponse | ReadFileSuccessResponse | ReadFileErrorResponse | UpdateFileSuccessResponse | UpdateFileErrorResponse | DeleteFileSuccessResponse | DeleteFileErrorResponse | DeleteFolderSuccessResponse | DeleteFolderErrorResponse | FileListSuccessResponse | FileListErrorResponse | SearchFilesSuccessResponse | SearchFilesErrorResponse | WriteToFileSuccessResponse | WriteToFileErrorResponse | GrepSearchSuccessResponse | GrepSearchErrorResponse | FileSearchSuccessResponse | FileSearchErrorResponse | ListCodeDefinitionNamesSuccessResponse | ListCodeDefinitionNamesErrorResponse | EditFileAndApplyDiffSuccessResponse | EditFileAndApplyDiffErrorResponse;
645
+ /**
646
+ * File system operation parameters
647
+ */
648
+ export interface CreateFileParams {
649
+ /** File name to create */
650
+ fileName: string;
651
+ /** Source content for the file */
652
+ source: string;
653
+ /** Path where to create the file */
654
+ filePath: string;
655
+ }
656
+ export interface CreateFolderParams {
657
+ /** Folder name to create */
658
+ folderName: string;
659
+ /** Path where to create the folder */
660
+ folderPath: string;
661
+ }
662
+ export interface ReadFileParams {
663
+ /** Path of the file to read */
664
+ filePath: string;
665
+ }
666
+ export interface UpdateFileParams {
667
+ /** Name of the file to update */
668
+ filename: string;
669
+ /** Path of the file to update */
670
+ filePath: string;
671
+ /** New content for the file */
672
+ newContent: string;
673
+ }
674
+ export interface DeleteFileParams {
675
+ /** Name of the file to delete */
676
+ filename: string;
677
+ /** Path of the file to delete */
678
+ filePath: string;
679
+ }
680
+ export interface DeleteFolderParams {
681
+ /** Name of the folder to delete */
682
+ foldername: string;
683
+ /** Path of the folder to delete */
684
+ folderpath: string;
685
+ }
686
+ export interface ListFileParams {
687
+ /** Path to list files from */
688
+ folderPath: string;
689
+ /** Whether to list files recursively */
690
+ isRecursive?: boolean;
691
+ }
692
+ export interface ListCodeDefinitionNamesParams {
693
+ /** Path to search for code definitions */
694
+ path: string;
695
+ }
696
+ export interface SearchFilesParams {
697
+ /** Path to search within */
698
+ path: string;
699
+ /** Regex pattern to search for */
700
+ regex: string;
701
+ /** File pattern to match files */
702
+ filePattern: string;
703
+ }
704
+ export interface WriteToFileParams {
705
+ /** Relative path of the file to write to */
706
+ relPath: string;
707
+ /** New content to write into the file */
708
+ newContent: string;
709
+ }
710
+ export interface GrepSearchParams {
711
+ /** Path to search within */
712
+ path: string;
713
+ /** Query to search for */
714
+ query: string;
715
+ /** Pattern of files to include */
716
+ includePattern?: string;
717
+ /** Pattern of files to exclude */
718
+ excludePattern?: string;
719
+ /** Whether the search is case sensitive */
720
+ caseSensitive?: boolean;
721
+ }
722
+ export interface FileSearchParams {
723
+ /** Query to search for */
724
+ query: string;
725
+ }
726
+ export interface EditFileWithDiffParams {
727
+ /** Target file to edit */
728
+ target_file: string;
729
+ /** Code edit to apply */
730
+ code_edit: string;
731
+ /** Diff identifier */
732
+ diffIdentifier: string;
733
+ /** Prompt for the edit */
734
+ prompt: string;
735
+ /** Model to apply the edit with */
736
+ applyModel?: string;
737
+ }
280
738
  export interface BrowserNavigationOptions {
281
739
  /** URL to navigate to */
282
740
  url: string;
@@ -313,17 +771,410 @@ export interface TerminalExecuteOptions {
313
771
  /** Whether to run in background */
314
772
  background?: boolean;
315
773
  }
316
- export interface GitCommitOptions {
774
+ /**
775
+ * Git file status information
776
+ */
777
+ export interface GitFileStatus {
778
+ /** File path */
779
+ path: string;
780
+ /** Index status (staged changes) */
781
+ index: string;
782
+ /** Working directory status (unstaged changes) */
783
+ working_dir: string;
784
+ }
785
+ /**
786
+ * Git repository status information
787
+ */
788
+ export interface GitStatusResult {
789
+ /** Files not added to git */
790
+ not_added: string[];
791
+ /** Files with conflicts */
792
+ conflicted: string[];
793
+ /** Newly created files */
794
+ created: string[];
795
+ /** Deleted files */
796
+ deleted: string[];
797
+ /** Modified files */
798
+ modified: string[];
799
+ /** Renamed files */
800
+ renamed: string[];
801
+ /** Detailed file status information */
802
+ files: GitFileStatus[];
803
+ /** Staged files */
804
+ staged: string[];
805
+ /** Number of commits ahead of remote */
806
+ ahead: number;
807
+ /** Number of commits behind remote */
808
+ behind: number;
809
+ /** Current branch name */
810
+ current: string | null;
811
+ /** Tracking branch name */
812
+ tracking: string | null;
813
+ /** Whether in detached HEAD state */
814
+ detached: boolean;
815
+ }
816
+ /**
817
+ * Git commit information
818
+ */
819
+ export interface GitCommitSummary {
820
+ /** Commit hash */
821
+ hash: string;
822
+ /** Commit date */
823
+ date: string;
317
824
  /** Commit message */
318
825
  message: string;
826
+ /** Git references (branches, tags) */
827
+ refs: string;
828
+ /** Full commit body */
829
+ body: string;
319
830
  /** Author name */
320
- author?: string;
831
+ author_name: string;
321
832
  /** Author email */
833
+ author_email: string;
834
+ }
835
+ /**
836
+ * Git diff file information
837
+ */
838
+ export interface GitDiffFile {
839
+ /** File path */
840
+ file: string;
841
+ /** Number of changes */
842
+ changes: number;
843
+ /** Number of insertions */
844
+ insertions: number;
845
+ /** Number of deletions */
846
+ deletions: number;
847
+ /** Whether file is binary */
848
+ binary: boolean;
849
+ }
850
+ /**
851
+ * Git diff result information
852
+ */
853
+ export interface GitDiffResult {
854
+ /** Files with changes */
855
+ files: GitDiffFile[];
856
+ /** Total insertions */
857
+ insertions: number;
858
+ /** Total deletions */
859
+ deletions: number;
860
+ /** Total changed files */
861
+ changed: number;
862
+ }
863
+ /**
864
+ * Git pull result information
865
+ */
866
+ export interface GitPullResult {
867
+ /** Number of files updated */
868
+ files: number;
869
+ /** Number of insertions */
870
+ insertions: number;
871
+ /** Number of deletions */
872
+ deletions: number;
873
+ /** Summary message */
874
+ summary: string;
875
+ /** Remote branch information */
876
+ remote?: {
877
+ name: string;
878
+ url: string;
879
+ };
880
+ }
881
+ /**
882
+ * Git push result information
883
+ */
884
+ export interface GitPushResult {
885
+ /** Number of commits pushed */
886
+ commits: number;
887
+ /** Summary message */
888
+ summary: string;
889
+ /** Remote branch information */
890
+ remote?: {
891
+ name: string;
892
+ url: string;
893
+ };
894
+ }
895
+ /**
896
+ * Git commit result information
897
+ */
898
+ export interface GitCommitResult {
899
+ /** Commit hash */
900
+ hash: string;
901
+ /** Commit message */
902
+ message: string;
903
+ /** Number of files committed */
904
+ files: number;
905
+ /** Number of insertions */
906
+ insertions: number;
907
+ /** Number of deletions */
908
+ deletions: number;
909
+ /** Author information */
910
+ author: {
911
+ name: string;
912
+ email: string;
913
+ };
914
+ }
915
+ /**
916
+ * Git branch information
917
+ */
918
+ export interface GitBranchInfo {
919
+ /** Branch name */
920
+ name: string;
921
+ /** Whether this is the current branch */
922
+ current: boolean;
923
+ /** Commit hash at branch tip */
924
+ commit: string;
925
+ /** Last commit message */
926
+ message: string;
927
+ /** Whether branch is remote */
928
+ remote: boolean;
929
+ }
930
+ /**
931
+ * Git checkout result information
932
+ */
933
+ export interface GitCheckoutResult {
934
+ /** Branch or commit checked out */
935
+ target: string;
936
+ /** Previous branch or commit */
937
+ previous?: string;
938
+ /** Whether checkout was successful */
939
+ success: boolean;
940
+ /** Additional information */
941
+ message?: string;
942
+ }
943
+ /**
944
+ * Git add result information
945
+ */
946
+ export interface GitAddResult {
947
+ /** Number of files added */
948
+ files: number;
949
+ /** List of added files */
950
+ added: string[];
951
+ /** Summary message */
952
+ summary: string;
953
+ }
954
+ /**
955
+ * Git init result information
956
+ */
957
+ export interface GitInitResult {
958
+ /** Repository path */
959
+ path: string;
960
+ /** Whether repository was created */
961
+ created: boolean;
962
+ /** Initial branch name */
963
+ branch: string;
964
+ /** Summary message */
965
+ message: string;
966
+ }
967
+ /**
968
+ * Base response interface for all Git operations
969
+ */
970
+ export interface BaseGitResponse {
971
+ /** Response type identifier */
972
+ type: string;
973
+ /** Unique request identifier */
974
+ requestId: string;
975
+ /** Whether the operation was successful */
976
+ success?: boolean;
977
+ /** Response message */
978
+ message?: string;
979
+ /** Response data - specific to each operation type */
980
+ data?: GitInitResult | GitPullResult | GitPushResult | GitStatusResult | GitAddResult | GitCommitResult | GitCheckoutResult | GitBranchInfo[] | GitCommitSummary[] | GitDiffResult | string | number | boolean | Record<string, unknown>;
981
+ /** Error message if operation failed */
982
+ error?: string;
983
+ }
984
+ /**
985
+ * Git init response types
986
+ */
987
+ export interface GitInitSuccessResponse extends BaseGitResponse {
988
+ type: 'gitInitResponse';
989
+ success: true;
990
+ /** Git init result data */
991
+ data?: GitInitResult;
992
+ }
993
+ export interface GitInitErrorResponse extends BaseGitResponse {
994
+ type: 'gitInitResponse';
995
+ success: false;
996
+ error: string;
997
+ }
998
+ /**
999
+ * Git pull response types
1000
+ */
1001
+ export interface GitPullSuccessResponse extends BaseGitResponse {
1002
+ type: 'PullResponse';
1003
+ success: true;
1004
+ /** Git pull result data */
1005
+ data?: GitPullResult;
1006
+ }
1007
+ export interface GitPullErrorResponse extends BaseGitResponse {
1008
+ type: 'PullResponse';
1009
+ success: false;
1010
+ error: string;
1011
+ }
1012
+ /**
1013
+ * Git push response types
1014
+ */
1015
+ export interface GitPushSuccessResponse extends BaseGitResponse {
1016
+ type: 'PushResponse';
1017
+ success: true;
1018
+ /** Git push result data */
1019
+ data?: GitPushResult;
1020
+ }
1021
+ export interface GitPushErrorResponse extends BaseGitResponse {
1022
+ type: 'PushResponse';
1023
+ success: false;
1024
+ error: string;
1025
+ }
1026
+ /**
1027
+ * Git status response types
1028
+ */
1029
+ export interface GitStatusSuccessResponse extends BaseGitResponse {
1030
+ type: 'gitStatusResponse';
1031
+ success: true;
1032
+ /** Git status result data */
1033
+ data?: GitStatusResult;
1034
+ }
1035
+ export interface GitStatusErrorResponse extends BaseGitResponse {
1036
+ type: 'gitStatusResponse';
1037
+ success: false;
1038
+ error: string;
1039
+ }
1040
+ /**
1041
+ * Git add response types
1042
+ */
1043
+ export interface GitAddSuccessResponse extends BaseGitResponse {
1044
+ type: 'AddResponse';
1045
+ success: true;
1046
+ /** Git add result data */
1047
+ data?: GitAddResult;
1048
+ }
1049
+ export interface GitAddErrorResponse extends BaseGitResponse {
1050
+ type: 'AddResponse';
1051
+ success: false;
1052
+ error: string;
1053
+ }
1054
+ /**
1055
+ * Git commit response types
1056
+ */
1057
+ export interface GitCommitSuccessResponse extends BaseGitResponse {
1058
+ type: 'gitCommitResponse';
1059
+ success: true;
1060
+ /** Git commit result data */
1061
+ data?: GitCommitResult;
1062
+ }
1063
+ export interface GitCommitErrorResponse extends BaseGitResponse {
1064
+ type: 'gitCommitResponse';
1065
+ success: false;
1066
+ error: string;
1067
+ }
1068
+ /**
1069
+ * Git checkout response types
1070
+ */
1071
+ export interface GitCheckoutSuccessResponse extends BaseGitResponse {
1072
+ type: 'gitCheckoutResponse';
1073
+ success: true;
1074
+ /** Git checkout result data */
1075
+ data?: GitCheckoutResult;
1076
+ }
1077
+ export interface GitCheckoutErrorResponse extends BaseGitResponse {
1078
+ type: 'gitCheckoutResponse';
1079
+ success: false;
1080
+ error: string;
1081
+ }
1082
+ /**
1083
+ * Git branch response types
1084
+ */
1085
+ export interface GitBranchSuccessResponse extends BaseGitResponse {
1086
+ type: 'gitBranchResponse';
1087
+ success: true;
1088
+ /** Array of branch names */
1089
+ branches?: string[];
1090
+ /** Detailed branch information */
1091
+ data?: GitBranchInfo[];
1092
+ }
1093
+ export interface GitBranchErrorResponse extends BaseGitResponse {
1094
+ type: 'gitBranchResponse';
1095
+ success: false;
1096
+ error: string;
1097
+ }
1098
+ /**
1099
+ * Git logs response types
1100
+ */
1101
+ export interface GitLogsSuccessResponse extends BaseGitResponse {
1102
+ type: 'gitLogsResponse';
1103
+ success: true;
1104
+ /** Array of commit summaries */
1105
+ logs?: GitCommitSummary[];
1106
+ /** Detailed commit information */
1107
+ data?: GitCommitSummary[];
1108
+ }
1109
+ export interface GitLogsErrorResponse extends BaseGitResponse {
1110
+ type: 'gitLogsResponse';
1111
+ success: false;
1112
+ error: string;
1113
+ }
1114
+ /**
1115
+ * Git diff response types
1116
+ */
1117
+ export interface GitDiffSuccessResponse extends BaseGitResponse {
1118
+ type: 'gitDiffResponse';
1119
+ success: true;
1120
+ /** Diff content as string */
1121
+ diff?: string;
1122
+ /** Structured diff result */
1123
+ data?: GitDiffResult;
1124
+ }
1125
+ export interface GitDiffErrorResponse extends BaseGitResponse {
1126
+ type: 'gitDiffResponse';
1127
+ success: false;
1128
+ error: string;
1129
+ }
1130
+ /**
1131
+ * Union type for all Git responses
1132
+ */
1133
+ export type GitResponse = GitInitSuccessResponse | GitInitErrorResponse | GitPullSuccessResponse | GitPullErrorResponse | GitPushSuccessResponse | GitPushErrorResponse | GitStatusSuccessResponse | GitStatusErrorResponse | GitAddSuccessResponse | GitAddErrorResponse | GitCommitSuccessResponse | GitCommitErrorResponse | GitCheckoutSuccessResponse | GitCheckoutErrorResponse | GitBranchSuccessResponse | GitBranchErrorResponse | GitLogsSuccessResponse | GitLogsErrorResponse | GitDiffSuccessResponse | GitDiffErrorResponse;
1134
+ /**
1135
+ * Git operation parameters
1136
+ */
1137
+ export interface GitInitParams {
1138
+ /** Path where to initialize the repository */
1139
+ path: string;
1140
+ }
1141
+ export interface GitPullParams {
1142
+ /** Remote name (optional) */
1143
+ remote?: string;
1144
+ /** Branch name (optional) */
1145
+ branch?: string;
1146
+ }
1147
+ export interface GitPushParams {
1148
+ /** Remote name (optional) */
1149
+ remote?: string;
1150
+ /** Branch name (optional) */
1151
+ branch?: string;
1152
+ }
1153
+ export interface GitCommitParams {
1154
+ /** Commit message */
1155
+ message: string;
1156
+ /** Author name (optional) */
1157
+ author?: string;
1158
+ /** Author email (optional) */
322
1159
  email?: string;
323
- /** Whether to add all files */
1160
+ /** Whether to add all files before commit */
324
1161
  addAll?: boolean;
325
1162
  }
326
- export interface GitLogOptions {
1163
+ export interface GitCheckoutParams {
1164
+ /** Branch or commit to checkout */
1165
+ branch: string;
1166
+ /** Whether to create new branch */
1167
+ create?: boolean;
1168
+ }
1169
+ export interface GitBranchParams {
1170
+ /** Branch name */
1171
+ branch: string;
1172
+ /** Whether to delete the branch */
1173
+ delete?: boolean;
1174
+ /** Whether to force the operation */
1175
+ force?: boolean;
1176
+ }
1177
+ export interface GitLogsParams {
327
1178
  /** Number of commits to retrieve */
328
1179
  maxCount?: number;
329
1180
  /** Starting from commit hash */
@@ -333,6 +1184,14 @@ export interface GitLogOptions {
333
1184
  /** File path to filter logs */
334
1185
  path?: string;
335
1186
  }
1187
+ export interface GitDiffParams {
1188
+ /** Commit hash to diff against */
1189
+ commitHash?: string;
1190
+ /** File path to diff */
1191
+ file?: string;
1192
+ /** Whether to show staged changes */
1193
+ staged?: boolean;
1194
+ }
336
1195
  export interface LLMChatOptions {
337
1196
  /** Messages in the conversation */
338
1197
  messages: Message[];
@@ -386,7 +1245,7 @@ export interface MemorySetOptions {
386
1245
  /** Memory key */
387
1246
  key: string;
388
1247
  /** Memory value */
389
- value: any;
1248
+ value: string | number | boolean | Record<string, unknown> | unknown[];
390
1249
  /** Expiration time in seconds */
391
1250
  ttl?: number;
392
1251
  }
@@ -394,7 +1253,7 @@ export interface MemoryGetOptions {
394
1253
  /** Memory key */
395
1254
  key: string;
396
1255
  /** Default value if key not found */
397
- defaultValue?: any;
1256
+ defaultValue?: string | number | boolean | Record<string, unknown> | unknown[];
398
1257
  }
399
1258
  export interface TaskCreateOptions {
400
1259
  /** Task title */
@@ -508,7 +1367,7 @@ export interface DebugLogOptions {
508
1367
  /** Log level */
509
1368
  level?: 'debug' | 'info' | 'warn' | 'error';
510
1369
  /** Additional metadata */
511
- metadata?: Record<string, any>;
1370
+ metadata?: Record<string, unknown>;
512
1371
  /** Component name */
513
1372
  component?: string;
514
1373
  }
@@ -520,7 +1379,7 @@ export interface ProjectInfo {
520
1379
  /** Project type */
521
1380
  type?: string;
522
1381
  /** Project configuration */
523
- config?: Record<string, any>;
1382
+ config?: Record<string, unknown>;
524
1383
  }
525
1384
  export interface CrawlerOptions {
526
1385
  /** URL to crawl */
@@ -540,7 +1399,7 @@ export interface MCPExecuteOptions {
540
1399
  /** Server name */
541
1400
  serverName?: string;
542
1401
  /** Tool parameters */
543
- params?: Record<string, any>;
1402
+ params?: Record<string, unknown>;
544
1403
  /** Request timeout */
545
1404
  timeout?: number;
546
1405
  }
@@ -548,7 +1407,7 @@ export interface MCPConfigureOptions {
548
1407
  /** Server name */
549
1408
  serverName: string;
550
1409
  /** Configuration data */
551
- config: Record<string, any>;
1410
+ config: Record<string, unknown>;
552
1411
  /** Whether to enable the server */
553
1412
  enabled?: boolean;
554
1413
  }
@@ -556,7 +1415,7 @@ export interface StateUpdateOptions {
556
1415
  /** State key */
557
1416
  key: string;
558
1417
  /** State value */
559
- value: any;
1418
+ value: string | number | boolean | Record<string, unknown> | unknown[];
560
1419
  /** Whether to merge with existing state */
561
1420
  merge?: boolean;
562
1421
  }
@@ -566,7 +1425,7 @@ export interface ChatSendOptions {
566
1425
  /** Conversation ID */
567
1426
  conversationId?: string;
568
1427
  /** Message metadata */
569
- metadata?: Record<string, any>;
1428
+ metadata?: Record<string, unknown>;
570
1429
  /** Mentioned files */
571
1430
  mentionedFiles?: string[];
572
1431
  /** Mentioned agents */
@@ -597,7 +1456,7 @@ export interface NotificationOptions {
597
1456
  /**
598
1457
  * Standard API response wrapper
599
1458
  */
600
- export interface APIResponse<T = any> {
1459
+ export interface APIResponse<T = unknown> {
601
1460
  /** Whether the operation was successful */
602
1461
  success: boolean;
603
1462
  /** Response data */
@@ -607,7 +1466,7 @@ export interface APIResponse<T = any> {
607
1466
  /** Error code if unsuccessful */
608
1467
  code?: string;
609
1468
  /** Additional metadata */
610
- metadata?: Record<string, any>;
1469
+ metadata?: Record<string, unknown>;
611
1470
  }
612
1471
  /**
613
1472
  * Pagination options for list operations
@@ -629,7 +1488,7 @@ export interface FilterOptions {
629
1488
  /** Search query */
630
1489
  query?: string;
631
1490
  /** Field filters */
632
- filters?: Record<string, any>;
1491
+ filters?: Record<string, unknown>;
633
1492
  /** Date range */
634
1493
  dateRange?: {
635
1494
  from?: Date | string;
@@ -656,7 +1515,7 @@ export interface APIEventMap {
656
1515
  connected: () => void;
657
1516
  disconnected: () => void;
658
1517
  error: (error: Error) => void;
659
- message: (message: any) => void;
1518
+ message: (message: Record<string, unknown>) => void;
660
1519
  progress: (progress: number) => void;
661
1520
  }
662
1521
  export interface CodeboltConfig {
@@ -693,3 +1552,33 @@ export type ProgressCallback = (progress: number, message?: string) => void;
693
1552
  export type ErrorCallback = (error: Error) => void;
694
1553
  export type SuccessCallback<T = any> = (result: T) => void;
695
1554
  export type CompletionCallback<T = any> = (error: Error | null, result?: T) => void;
1555
+ /**
1556
+ * This file contains comprehensive TypeScript types for the codeboltjs library API.
1557
+ *
1558
+ * Key sections include:
1559
+ * - Message Types for Library API
1560
+ * - File System API Types and Response Types
1561
+ * - Browser API Types
1562
+ * - Terminal API Types
1563
+ * - Git API Types
1564
+ * - LLM API Types
1565
+ * - Vector Database API Types
1566
+ * - Agent API Types
1567
+ * - Memory API Types
1568
+ * - Task API Types
1569
+ * - Code Utils API Types
1570
+ * - Debug API Types
1571
+ * - Project API Types
1572
+ * - Crawler API Types
1573
+ * - MCP Tools API Types
1574
+ * - State Management API Types
1575
+ * - Chat API Types
1576
+ * - Notification API Types
1577
+ * - Utility Types for API
1578
+ * - Event Types for API
1579
+ * - Configuration Types for Library
1580
+ * - Callback Types
1581
+ *
1582
+ * All types are designed to be user-friendly and provide comprehensive
1583
+ * type safety for the codeboltjs library functions.
1584
+ */