@codebolt/codeboltjs 1.1.76 → 1.1.78

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 (82) hide show
  1. package/docs/modules/_internal_.EventEmitter.html +6 -0
  2. package/docs/modules/_internal_.WebSocket.html +21 -0
  3. package/docs/modules/_internal_._node_stream_consumers_.html +6 -0
  4. package/docs/modules/_internal_._node_stream_promises_.html +3 -0
  5. package/docs/modules/_internal_.html +228 -0
  6. package/docs/modules/_internal_.internal.finished.html +2 -0
  7. package/docs/modules/_internal_.internal.html +36 -0
  8. package/docs/modules/_internal_.internal.pipeline.html +2 -0
  9. package/index.d.ts +254 -0
  10. package/modules/browser.d.ts +108 -0
  11. package/modules/browser.js +331 -0
  12. package/modules/chat.d.ts +64 -0
  13. package/modules/chat.js +190 -0
  14. package/modules/codeparsers.d.ts +23 -0
  15. package/modules/codeparsers.js +30 -0
  16. package/modules/codeutils.d.ts +37 -0
  17. package/modules/codeutils.js +117 -0
  18. package/modules/crawler.d.ts +45 -0
  19. package/modules/crawler.js +123 -0
  20. package/modules/dbmemory.d.ts +20 -0
  21. package/modules/dbmemory.js +54 -0
  22. package/modules/debug.d.ts +23 -0
  23. package/modules/debug.js +64 -0
  24. package/modules/docutils.d.ts +12 -0
  25. package/modules/docutils.js +19 -0
  26. package/modules/fs.d.ts +94 -0
  27. package/modules/fs.js +264 -0
  28. package/modules/git.d.ts +76 -0
  29. package/modules/git.js +240 -0
  30. package/modules/history.d.ts +19 -0
  31. package/modules/history.js +46 -0
  32. package/modules/knowledge.d.ts +2 -0
  33. package/modules/knowledge.js +6 -0
  34. package/modules/llm.d.ts +18 -0
  35. package/modules/llm.js +39 -0
  36. package/modules/mcp.d.ts +8 -0
  37. package/modules/mcp.js +139 -0
  38. package/modules/outputparsers.d.ts +24 -0
  39. package/modules/outputparsers.js +32 -0
  40. package/modules/project.d.ts +21 -0
  41. package/modules/project.js +72 -0
  42. package/modules/rag.d.ts +22 -0
  43. package/modules/rag.js +30 -0
  44. package/modules/search.d.ts +23 -0
  45. package/modules/search.js +37 -0
  46. package/modules/state.d.ts +21 -0
  47. package/modules/state.js +68 -0
  48. package/modules/task.d.ts +23 -0
  49. package/modules/task.js +75 -0
  50. package/modules/terminal.d.ts +46 -0
  51. package/modules/terminal.js +108 -0
  52. package/modules/tokenizer.d.ts +19 -0
  53. package/modules/tokenizer.js +56 -0
  54. package/modules/vectordb.d.ts +33 -0
  55. package/modules/vectordb.js +103 -0
  56. package/modules/websocket.d.ts +27 -0
  57. package/modules/websocket.js +88 -0
  58. package/package.json +1 -1
  59. package/src/modules/browser.ts +352 -0
  60. package/src/modules/chat.ts +193 -0
  61. package/src/modules/codeparsers.ts +30 -0
  62. package/src/modules/codeutils.ts +126 -0
  63. package/src/modules/crawler.ts +121 -0
  64. package/src/modules/dbmemory.ts +52 -0
  65. package/src/modules/debug.ts +68 -0
  66. package/src/modules/docutils.ts +18 -0
  67. package/src/modules/fs.ts +263 -0
  68. package/src/modules/git.ts +237 -0
  69. package/src/modules/history.ts +61 -0
  70. package/src/modules/knowledge.ts +5 -0
  71. package/src/modules/llm.ts +36 -0
  72. package/src/modules/mcp.ts +127 -0
  73. package/src/modules/outputparsers.ts +30 -0
  74. package/src/modules/project.ts +68 -0
  75. package/src/modules/rag.ts +28 -0
  76. package/src/modules/search.ts +35 -0
  77. package/src/modules/state.ts +69 -0
  78. package/src/modules/task.ts +73 -0
  79. package/src/modules/terminal.ts +114 -0
  80. package/src/modules/tokenizer.ts +56 -0
  81. package/src/modules/vectordb.ts +102 -0
  82. package/src/modules/websocket.ts +89 -0
@@ -0,0 +1,237 @@
1
+ import cbws from './websocket';
2
+
3
+ /**
4
+ * A service for interacting with Git operations via WebSocket messages.
5
+ */
6
+ const gitService = {
7
+ /**
8
+ * Initializes a new Git repository at the given path.
9
+ * @param {string} path - The file system path where the Git repository should be initialized.
10
+ * @returns {Promise<any>} A promise that resolves with the response from the init event.
11
+ */
12
+ init: async (path: string): Promise<any> => {
13
+ return new Promise((resolve, reject) => {
14
+ cbws.getWebsocket.send(JSON.stringify({
15
+ "type": "gitEvent",
16
+ "action": "Init",
17
+ "path": path
18
+ }));
19
+ cbws.getWebsocket.on('message', (data: string) => {
20
+ const response = JSON.parse(data);
21
+ if (response.type === "InitResponse") {
22
+ resolve(response);
23
+ }
24
+ });
25
+ });
26
+ },
27
+ /**
28
+ * Clones a Git repository from the given URL to the specified path.
29
+ * @param {string} url - The URL of the Git repository to clone.
30
+ * @param {string} path - The file system path where the repository should be cloned to.
31
+ * @returns {Promise<any>} A promise that resolves with the response from the clone event.
32
+ */
33
+ clone: async (url: string, path: string): Promise<any> => {
34
+ return new Promise((resolve, reject) => {
35
+ cbws.getWebsocket.send(JSON.stringify({
36
+ "type": "gitEvent",
37
+ "action": "Clone",
38
+ "url": url,
39
+ "path": path
40
+ }));
41
+ cbws.getWebsocket.on('message', (data: string) => {
42
+ const response = JSON.parse(data);
43
+ if (response.type === "CloneResponse") {
44
+ resolve(response);
45
+ }
46
+ });
47
+ });
48
+ },
49
+ /**
50
+ * Pulls the latest changes from the remote repository to the local repository at the given path.
51
+ * @param {string} path - The file system path of the local Git repository.
52
+ * @returns {Promise<any>} A promise that resolves with the response from the pull event.
53
+ */
54
+ pull: async (path: string): Promise<any> => {
55
+ return new Promise((resolve, reject) => {
56
+ cbws.getWebsocket.send(JSON.stringify({
57
+ "type": "gitEvent",
58
+ "action": "Pull",
59
+ "path": path
60
+ }));
61
+ cbws.getWebsocket.on('message', (data: string) => {
62
+ const response = JSON.parse(data);
63
+ if (response.type === "PullResponse") {
64
+ resolve(response);
65
+ }
66
+ });
67
+ });
68
+ },
69
+ /**
70
+ * Pushes local repository changes to the remote repository at the given path.
71
+ * @param {string} path - The file system path of the local Git repository.
72
+ * @returns {Promise<any>} A promise that resolves with the response from the push event.
73
+ */
74
+ push: async (path: string): Promise<any> => {
75
+ return new Promise((resolve, reject) => {
76
+ cbws.getWebsocket.send(JSON.stringify({
77
+ "type": "gitEvent",
78
+ "action": "Push",
79
+ "path": path
80
+ }));
81
+ cbws.getWebsocket.on('message', (data: string) => {
82
+ const response = JSON.parse(data);
83
+ if (response.type === "PushResponse") {
84
+ resolve(response);
85
+ }
86
+ });
87
+ });
88
+ },
89
+ /**
90
+ * Retrieves the status of the local repository at the given path.
91
+ * @param {string} path - The file system path of the local Git repository.
92
+ * @returns {Promise<any>} A promise that resolves with the response from the status event.
93
+ */
94
+ status: async (path: string): Promise<any> => {
95
+ return new Promise((resolve, reject) => {
96
+ cbws.getWebsocket.send(JSON.stringify({
97
+ "type": "gitEvent",
98
+ "action": "Status",
99
+ "path": path
100
+ }));
101
+ cbws.getWebsocket.on('message', (data: string) => {
102
+ const response = JSON.parse(data);
103
+ if (response.type === "StatusResponse") {
104
+ resolve(response);
105
+ }
106
+ });
107
+ });
108
+ },
109
+ /**
110
+ * Adds changes in the local repository to the staging area at the given path.
111
+ * @param {string} path - The file system path of the local Git repository.
112
+ * @returns {Promise<any>} A promise that resolves with the response from the add event.
113
+ */
114
+ add: async (path: string): Promise<any> => {
115
+ return new Promise((resolve, reject) => {
116
+ cbws.getWebsocket.send(JSON.stringify({
117
+ "type": "gitEvent",
118
+ "action": "Add",
119
+ "path": path
120
+ }));
121
+ cbws.getWebsocket.on('message', (data: string) => {
122
+ const response = JSON.parse(data);
123
+ if (response.type === "AddResponse") {
124
+ resolve(response);
125
+ }
126
+ });
127
+ });
128
+ },
129
+ /**
130
+ * Commits the staged changes in the local repository with the given commit message.
131
+ * @param {string} message - The commit message to use for the commit.
132
+ * @returns {Promise<any>} A promise that resolves with the response from the commit event.
133
+ */
134
+ commit: async (message: string): Promise<any> => {
135
+ return new Promise((resolve, reject) => {
136
+ cbws.getWebsocket.send(JSON.stringify({
137
+ "type": "gitEvent",
138
+ "action": "Commit",
139
+ "message": message
140
+ }));
141
+ cbws.getWebsocket.on('message', (data: string) => {
142
+ const response = JSON.parse(data);
143
+ if (response.type === "gitCommitResponse") {
144
+ resolve(response);
145
+ }
146
+ });
147
+ });
148
+ },
149
+ /**
150
+ * Checks out a branch or commit in the local repository at the given path.
151
+ * @param {string} path - The file system path of the local Git repository.
152
+ * @param {string} branch - The name of the branch or commit to check out.
153
+ * @returns {Promise<any>} A promise that resolves with the response from the checkout event.
154
+ */
155
+ checkout: async (path: string, branch: string): Promise<any> => {
156
+ return new Promise((resolve, reject) => {
157
+ cbws.getWebsocket.send(JSON.stringify({
158
+ "type": "gitEvent",
159
+ "action": "Checkout",
160
+ "path": path,
161
+ "branch": branch
162
+ }));
163
+ cbws.getWebsocket.on('message', (data: string) => {
164
+ const response = JSON.parse(data);
165
+ if (response.type === "CheckoutResponse") {
166
+ resolve(response);
167
+ }
168
+ });
169
+ });
170
+ },
171
+ /**
172
+ * Creates a new branch in the local repository at the given path.
173
+ * @param {string} path - The file system path of the local Git repository.
174
+ * @param {string} branch - The name of the new branch to create.
175
+ * @returns {Promise<any>} A promise that resolves with the response from the branch event.
176
+ */
177
+ branch: async (path: string, branch: string): Promise<any> => {
178
+ return new Promise((resolve, reject) => {
179
+ cbws.getWebsocket.send(JSON.stringify({
180
+ "type": "gitEvent",
181
+ "action": "Branch",
182
+ "path": path,
183
+ "branch": branch
184
+ }));
185
+ cbws.getWebsocket.on('message', (data: string) => {
186
+ const response = JSON.parse(data);
187
+ if (response.type === "BranchResponse") {
188
+ resolve(response);
189
+ }
190
+ });
191
+ });
192
+ },
193
+ /**
194
+ * Retrieves the commit logs for the local repository at the given path.
195
+ * @param {string} path - The file system path of the local Git repository.
196
+ * @returns {Promise<any>} A promise that resolves with the response from the logs event.
197
+ */
198
+ logs: async (path: string): Promise<any> => {
199
+ return new Promise((resolve, reject) => {
200
+ cbws.getWebsocket.send(JSON.stringify({
201
+ "type": "gitEvent",
202
+ "action": "Logs",
203
+ "path": path
204
+ }));
205
+ cbws.getWebsocket.on('message', (data: string) => {
206
+ const response = JSON.parse(data);
207
+ if (response.type === "LogsResponse") {
208
+ resolve(response);
209
+ }
210
+ });
211
+ });
212
+ },
213
+ /**
214
+ * Retrieves the diff of changes for a specific commit in the local repository.
215
+ * @param {string} commitHash - The hash of the commit to retrieve the diff for.
216
+ * @param {string} path - The file system path of the local Git repository.
217
+ * @returns {Promise<any>} A promise that resolves with the response from the diff event.
218
+ */
219
+ diff: async (commitHash: string, path: string): Promise<any> => {
220
+ return new Promise((resolve, reject) => {
221
+ cbws.getWebsocket.send(JSON.stringify({
222
+ "type": "gitEvent",
223
+ "action": "Diff",
224
+ "path": path,
225
+ "commitHash": commitHash
226
+ }));
227
+ cbws.getWebsocket.on('message', (data: string) => {
228
+ const response = JSON.parse(data);
229
+ if (response.type === "DiffResponse") {
230
+ resolve(response);
231
+ }
232
+ });
233
+ });
234
+ }
235
+ };
236
+
237
+ export default gitService;
@@ -0,0 +1,61 @@
1
+ import cbws from './websocket';
2
+
3
+ export enum logType {
4
+ info = "info",
5
+ error = "error",
6
+ warning = "warning"
7
+ }
8
+
9
+
10
+ export const chatSummary = {
11
+
12
+ summarizeAll: (): Promise<{
13
+ role: string;
14
+ content: string;
15
+ }[]> => {
16
+ return new Promise((resolve, reject) => {
17
+ cbws.getWebsocket.send(JSON.stringify({
18
+ "type": "chatSummaryEvent",
19
+ "action": "summarizeAll",
20
+
21
+ }));
22
+ cbws.getWebsocket.on('message', (data: string) => {
23
+ const response = JSON.parse(data);
24
+ if (response.type === "getSummarizeAllResponse") {
25
+ resolve(response.payload); // Resolve the Promise with the response data
26
+ }
27
+ })
28
+ })
29
+
30
+
31
+ },
32
+ summarize: (messages: {
33
+ role: string;
34
+ content: string;
35
+ }[], depth: number): Promise<{
36
+ role: string;
37
+ content: string;
38
+ }[]> => {
39
+ return new Promise((resolve, reject) => {
40
+ cbws.getWebsocket.send(JSON.stringify({
41
+ "type": "chatSummaryEvent",
42
+ "action": "summarize",
43
+ messages,
44
+ depth
45
+ }));
46
+ cbws.getWebsocket.on('message', (data: string) => {
47
+ const response = JSON.parse(data);
48
+ if (response.type === "getSummarizeResponse") {
49
+ resolve(response.payload); // Resolve the Promise with the response data
50
+ }
51
+ })
52
+ })
53
+
54
+ }
55
+ }
56
+
57
+
58
+ export default chatSummary;
59
+
60
+
61
+
@@ -0,0 +1,5 @@
1
+ const cbKnowledge = {
2
+ // Methods related to knowledge handling can be added here
3
+ };
4
+
5
+ export default cbKnowledge;
@@ -0,0 +1,36 @@
1
+ import cbws from './websocket';
2
+ import {LLMResponse } from '@codebolt/types';
3
+ /**
4
+ * A module for interacting with language learning models (LLMs) via WebSocket.
5
+ */
6
+ const cbllm = {
7
+ /**
8
+ * Sends an inference request to the LLM and returns the model's response.
9
+ * The model is selected based on the provided `llmrole`. If the specific model
10
+ * for the role is not found, it falls back to the default model for the current agent,
11
+ * and ultimately to the default application-wide LLM if necessary.
12
+ *
13
+ * @param {string} message - The input message or prompt to be sent to the LLM.
14
+ * @param {string} llmrole - The role of the LLM to determine which model to use.
15
+ * @returns {Promise<LLMResponse>} A promise that resolves with the LLM's response.
16
+ */
17
+ inference: async (message: string, llmrole: string): Promise<LLMResponse> => {
18
+ return new Promise((resolve, reject) => {
19
+ cbws.getWebsocket.send(JSON.stringify({
20
+ "type": "inference",
21
+ "message": {
22
+ prompt: message,
23
+ llmrole
24
+ },
25
+ }));
26
+ cbws.getWebsocket.on('message', (data: string) => {
27
+ const response = JSON.parse(data);
28
+ if (response.type === "llmResponse") {
29
+ resolve(response); // Resolve the Promise with the response data
30
+ }
31
+ });
32
+ });
33
+ }
34
+ };
35
+
36
+ export default cbllm;
@@ -0,0 +1,127 @@
1
+ import cbws from './websocket';
2
+ const codeboltMCP = {
3
+
4
+ executeTool: ( toolName: string, params: any,mcpServer?: string,): Promise<any> => {
5
+ return new Promise((resolve, reject) => {
6
+ cbws.getWebsocket.send(JSON.stringify({
7
+ "type": "mcpEvent",
8
+ "action": "executeTool",
9
+ "toolName": toolName,
10
+ "params": params
11
+ }));
12
+ cbws.getWebsocket.on('message', (data: string) => {
13
+ try {
14
+ const response = JSON.parse(data);
15
+ if (response.type === "executeToolResponse") {
16
+ resolve(response.data);
17
+ } else {
18
+ reject(new Error("Unexpected response type"));
19
+ }
20
+ } catch (error) {
21
+ reject(new Error("Failed to parse response"));
22
+ }
23
+ });
24
+ cbws.getWebsocket.on('error', (error: Error) => {
25
+ reject(error);
26
+ });
27
+ });
28
+ },
29
+ getMcpTools: (tools: string[]): Promise<any> => {
30
+ return new Promise((resolve, reject) => {
31
+ cbws.getWebsocket.send(JSON.stringify({
32
+ "type": "mcpEvent",
33
+ "action": "getMcpTools",
34
+ "tools": tools
35
+ }));
36
+ cbws.getWebsocket.on('message', (data: string) => {
37
+ try {
38
+ const response = JSON.parse(data);
39
+ if (response.type === "getMcpToolsResponse") {
40
+ resolve(response.data);
41
+ } else {
42
+ reject(new Error("Unexpected response type"));
43
+ }
44
+ } catch (error) {
45
+ reject(new Error("Failed to parse response"));
46
+ }
47
+ });
48
+ cbws.getWebsocket.on('error', (error: Error) => {
49
+ reject(error);
50
+ });
51
+ });
52
+
53
+ },
54
+ getAllMCPTools: (mpcName: string): Promise<any> => {
55
+ return new Promise((resolve, reject) => {
56
+ cbws.getWebsocket.send(JSON.stringify({
57
+ "type": "mcpEvent",
58
+ "action": "getAllMCPTools",
59
+ "mpcName": mpcName
60
+ }));
61
+ cbws.getWebsocket.on('message', (data: string) => {
62
+ try {
63
+ const response = JSON.parse(data);
64
+ if (response.type === "getAllMCPToolsResponse") {
65
+ resolve(response.data);
66
+ } else {
67
+ reject(new Error("Unexpected response type"));
68
+ }
69
+ } catch (error) {
70
+ reject(new Error("Failed to parse response"));
71
+ }
72
+ });
73
+ cbws.getWebsocket.on('error', (error: Error) => {
74
+ reject(error);
75
+ });
76
+ });
77
+ },
78
+ getMCPTool: (name: string): Promise<any> => {
79
+ return new Promise((resolve, reject) => {
80
+ cbws.getWebsocket.send(JSON.stringify({
81
+ "type": "mcpEvent",
82
+ "action": "getMCPTool",
83
+ "mcpName": name
84
+ }));
85
+ cbws.getWebsocket.on('message', (data: string) => {
86
+ try {
87
+ const response = JSON.parse(data);
88
+ if (response.type === "getMCPToolResponse") {
89
+ resolve(response.data);
90
+ } else {
91
+ reject(new Error("Unexpected response type"));
92
+ }
93
+ } catch (error) {
94
+ reject(new Error("Failed to parse response"));
95
+ }
96
+ });
97
+ cbws.getWebsocket.on('error', (error: Error) => {
98
+ reject(error);
99
+ });
100
+ });
101
+ },
102
+ getEnabledMCPS: (): Promise<any> => {
103
+ return new Promise((resolve, reject) => {
104
+ cbws.getWebsocket.send(JSON.stringify({
105
+ "type": "mcpEvent",
106
+ "action": "getEnabledMCPS"
107
+ }));
108
+ cbws.getWebsocket.on('message', (data: string) => {
109
+ try {
110
+ const response = JSON.parse(data);
111
+ if (response.type === "getEnabledMCPSResponse") {
112
+ resolve(response.data);
113
+ } else {
114
+ reject(new Error("Unexpected response type"));
115
+ }
116
+ } catch (error) {
117
+ reject(new Error("Failed to parse response"));
118
+ }
119
+ });
120
+ cbws.getWebsocket.on('error', (error: Error) => {
121
+ reject(error);
122
+ });
123
+ });
124
+ },
125
+ }
126
+
127
+ export default codeboltMCP;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * A module for parsing output messages to identify errors and warnings.
3
+ */
4
+ const cboutputparsers = {
5
+ /**
6
+ * Initializes the output parser module.
7
+ * Currently, this function does not perform any operations.
8
+ * @param {any} output - The output to be initialized.
9
+ */
10
+ init: (output: any) => {
11
+ // Initialization code can be added here if necessary
12
+ },
13
+ /**
14
+ * Parses the given output and returns all the error messages.
15
+ * @param {any} output - The output to parse for error messages.
16
+ * @returns {string[]} An array of error messages.
17
+ */
18
+ parseErrors: (output: any): string[] => {
19
+ return output.split('\n').filter((line: string) => line.includes('Error:'));
20
+ },
21
+ /**
22
+ * Parses the given output and returns all the warning messages.
23
+ * @param {any} output - The output to parse for warning messages.
24
+ * @returns {string[]} An array of warning messages.
25
+ */
26
+ parseWarnings: (output: any): string[] => {
27
+ return output.split('\n').filter((line: string) => line.includes('Warning:'));
28
+ }
29
+ };
30
+ export default cboutputparsers;
@@ -0,0 +1,68 @@
1
+ import cbws from './websocket';
2
+ import { GetProjectPathResponse } from '@codebolt/types';
3
+ /**
4
+ * A module for interacting with project settings and paths.
5
+ */
6
+ const cbproject = {
7
+ /**
8
+ * Placeholder for a method to get project settings.
9
+ * Currently, this method does not perform any operations.
10
+ * @param {any} output - The output where project settings would be stored.
11
+ */
12
+ getProjectSettings: (output: any) => {
13
+ // Implementation for getting project settings will be added here
14
+ },
15
+ /**
16
+ * Retrieves the path of the current project.
17
+ * @returns {Promise<GetProjectPathResponse>} A promise that resolves with the project path response.
18
+ */
19
+ getProjectPath: (): Promise<GetProjectPathResponse> => {
20
+ return new Promise((resolve, reject) => {
21
+ cbws.getWebsocket.send(JSON.stringify({
22
+ "type": "settingEvent",
23
+ "action": "getProjectPath"
24
+ }));
25
+ cbws.getWebsocket.on('message', (data: string) => {
26
+ const response = JSON.parse(data);
27
+ if (response.type === "getProjectPathResponse") {
28
+ resolve(response);
29
+ }
30
+ });
31
+ });
32
+ },
33
+ getRepoMap: (message: any): Promise<GetProjectPathResponse> => {
34
+ return new Promise((resolve, reject) => {
35
+ cbws.getWebsocket.send(JSON.stringify({
36
+ "type": "settingEvent",
37
+ "action": "getRepoMap",
38
+ message
39
+ }));
40
+ cbws.getWebsocket.on('message', (data: string) => {
41
+ const response = JSON.parse(data);
42
+ if (response.type === "getRepoMapResponse") {
43
+ resolve(response);
44
+ }
45
+ });
46
+ });
47
+ },
48
+ runProject: () => {
49
+ cbws.getWebsocket.send(JSON.stringify({
50
+ "type": "runProject"
51
+ }));
52
+ },
53
+ getEditorFileStatus:()=>{
54
+ return new Promise((resolve, reject) => {
55
+ cbws.getWebsocket.send(JSON.stringify({
56
+ "type": "settingEvent",
57
+ "action": "getEditorFileStatus",
58
+ }));
59
+ cbws.getWebsocket.on('message', (data: string) => {
60
+ const response = JSON.parse(data);
61
+ if (response.type === "getEditorFileStatusResponse") {
62
+ resolve(response);
63
+ }
64
+ });
65
+ });
66
+ }
67
+ };
68
+ export default cbproject
@@ -0,0 +1,28 @@
1
+ /**
2
+ * A module for managing files within the CodeBolt File System.
3
+ */
4
+ const cbrag = {
5
+ /**
6
+ * Initializes the CodeBolt File System Module.
7
+ */
8
+ init: () => {
9
+ console.log("Initializing CodeBolt File System Module");
10
+ },
11
+ /**
12
+ * Adds a file to the CodeBolt File System.
13
+ * @param {string} filename - The name of the file to add.
14
+ * @param {string} file_path - The path where the file should be added.
15
+ */
16
+ add_file: (filename: string, file_path: string) => {
17
+ // Implementation for adding a file will be added here
18
+ },
19
+ /**
20
+ * Retrieves related knowledge for a given query and filename.
21
+ * @param {string} query - The query to retrieve related knowledge for.
22
+ * @param {string} filename - The name of the file associated with the query.
23
+ */
24
+ retrieve_related_knowledge: (query: string, filename: string) => {
25
+ // Implementation for retrieving related knowledge will be added here
26
+ },
27
+ };
28
+ export default cbrag;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * A module for handling search operations.
3
+ */
4
+ const cbsearch = {
5
+ /**
6
+ * Initializes the search module with the specified search engine.
7
+ * @param {string} [engine="bing"] - The search engine to use for initializing the module.
8
+ */
9
+ init: (engine: string = "bing"): void => {
10
+ console.log("Initializing Search Module with engine: " + engine);
11
+ },
12
+ /**
13
+ * Performs a search operation for the given query.
14
+ * @param {string} query - The search query.
15
+ * @returns {Promise<string>} A promise that resolves with the search results.
16
+ */
17
+ search: async (query: string): Promise<string> => {
18
+ console.log("Searching for " + query);
19
+ return new Promise((resolve, reject) => {
20
+ resolve("Search Results for " + query);
21
+ });
22
+ },
23
+ /**
24
+ * Retrieves the first link from the search results for the given query.
25
+ * @param {string} query - The search query.
26
+ * @returns {Promise<string>} A promise that resolves with the first link of the search results.
27
+ */
28
+ get_first_link: async (query: string): Promise<string> => {
29
+ console.log("Getting first link for " + query);
30
+ return new Promise((resolve, reject) => {
31
+ resolve("First Link for " + query);
32
+ });
33
+ }
34
+ };
35
+ export default cbsearch;