@codebolt/codeboltjs 2.0.6 → 2.0.11
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 +95 -88
- package/dist/index.js +63 -59
- 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/{modules → utils}/docutils.d.ts +2 -2
- package/dist/{modules → utils}/docutils.js +2 -2
- 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 +2 -1
- package/dist/utils.js +8 -3
- package/package.json +6 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* TypeScript interfaces for WebSocket message types
|
|
4
|
+
*
|
|
5
|
+
* This file contains all types related to WebSocket messages:
|
|
6
|
+
* - Incoming message types (from client to server)
|
|
7
|
+
* - Outgoing response types (from server to client)
|
|
8
|
+
* - WebSocket communication protocols
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.isFsServiceResponse = exports.isGitResponse = exports.isBrowserResponse = exports.isErrorResponse = exports.isFailureResponse = exports.isSuccessResponse = void 0;
|
|
12
|
+
// ================================
|
|
13
|
+
// Type Guards
|
|
14
|
+
// ================================
|
|
15
|
+
function isSuccessResponse(response) {
|
|
16
|
+
return 'success' in response && response.success === true;
|
|
17
|
+
}
|
|
18
|
+
exports.isSuccessResponse = isSuccessResponse;
|
|
19
|
+
function isFailureResponse(response) {
|
|
20
|
+
return 'success' in response && response.success === false;
|
|
21
|
+
}
|
|
22
|
+
exports.isFailureResponse = isFailureResponse;
|
|
23
|
+
function isErrorResponse(response) {
|
|
24
|
+
return response.type === 'error';
|
|
25
|
+
}
|
|
26
|
+
exports.isErrorResponse = isErrorResponse;
|
|
27
|
+
function isBrowserResponse(response) {
|
|
28
|
+
return response.type.includes('browser') || response.type.includes('screenshot') || response.type.includes('Content');
|
|
29
|
+
}
|
|
30
|
+
exports.isBrowserResponse = isBrowserResponse;
|
|
31
|
+
function isGitResponse(response) {
|
|
32
|
+
return response.type.startsWith('git');
|
|
33
|
+
}
|
|
34
|
+
exports.isGitResponse = isGitResponse;
|
|
35
|
+
function isFsServiceResponse(response) {
|
|
36
|
+
return response.type.includes('readFileResponse') ||
|
|
37
|
+
response.type.includes('writeToFileResponse') ||
|
|
38
|
+
response.type.includes('fileListResponse') ||
|
|
39
|
+
response.type.includes('listCodeDefinitionNamesResponse') ||
|
|
40
|
+
response.type.includes('searchFilesResponse') ||
|
|
41
|
+
response.type.includes('grepSearchResponse') ||
|
|
42
|
+
response.type.includes('fileSearchResponse') ||
|
|
43
|
+
response.type.includes('createFileResponse') ||
|
|
44
|
+
response.type.includes('createFolderResponse') ||
|
|
45
|
+
response.type.includes('updateFileResponse') ||
|
|
46
|
+
response.type.includes('deleteFileResponse') ||
|
|
47
|
+
response.type.includes('deleteFolderResponse') ||
|
|
48
|
+
response.type.includes('editFileAndApplyDiffResponse') ||
|
|
49
|
+
response.type.includes('fsExecuteToolResponse');
|
|
50
|
+
}
|
|
51
|
+
exports.isFsServiceResponse = isFsServiceResponse;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
declare const docutils: {
|
|
2
2
|
/**
|
|
3
3
|
* Converts a PDF document to text.
|
|
4
4
|
* @param pdf_path - The file path to the PDF document to be converted.
|
|
@@ -6,4 +6,4 @@ declare const cbdocutils: {
|
|
|
6
6
|
*/
|
|
7
7
|
pdf_to_text: (pdf_path: string) => Promise<string>;
|
|
8
8
|
};
|
|
9
|
-
export default
|
|
9
|
+
export default docutils;
|
|
@@ -31,7 +31,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
31
31
|
*/
|
|
32
32
|
const fs = __importStar(require("fs"));
|
|
33
33
|
const pdf_parse_1 = __importDefault(require("pdf-parse"));
|
|
34
|
-
const
|
|
34
|
+
const docutils = {
|
|
35
35
|
/**
|
|
36
36
|
* Converts a PDF document to text.
|
|
37
37
|
* @param pdf_path - The file path to the PDF document to be converted.
|
|
@@ -66,4 +66,4 @@ const cbdocutils = {
|
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
|
-
exports.default =
|
|
69
|
+
exports.default = docutils;
|
|
@@ -408,7 +408,7 @@ type Authenticate<T> = (request: http.IncomingMessage) => Promise<T>;
|
|
|
408
408
|
* Class representing a toolbox for FastMCP.
|
|
409
409
|
* Manages tools, resources, and prompts for a Model Context Protocol server.
|
|
410
410
|
*/
|
|
411
|
-
export declare class
|
|
411
|
+
export declare class MCPServer<T extends Record<string, unknown> | undefined = undefined> extends FastMCPEventEmitter {
|
|
412
412
|
#private;
|
|
413
413
|
options: ServerOptions<T>;
|
|
414
414
|
/**
|
|
@@ -13,9 +13,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
13
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
|
-
var _FastMCPSession_capabilities, _FastMCPSession_clientCapabilities, _FastMCPSession_loggingLevel, _FastMCPSession_prompts, _FastMCPSession_resources, _FastMCPSession_resourceTemplates, _FastMCPSession_roots, _FastMCPSession_server, _FastMCPSession_auth, _FastMCPSession_pingInterval,
|
|
16
|
+
var _FastMCPSession_capabilities, _FastMCPSession_clientCapabilities, _FastMCPSession_loggingLevel, _FastMCPSession_prompts, _FastMCPSession_resources, _FastMCPSession_resourceTemplates, _FastMCPSession_roots, _FastMCPSession_server, _FastMCPSession_auth, _FastMCPSession_pingInterval, _MCPServer_options, _MCPServer_prompts, _MCPServer_resources, _MCPServer_resourcesTemplates, _MCPServer_sessions, _MCPServer_sseServer, _MCPServer_tools, _MCPServer_authenticate;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
18
|
+
exports.MCPServer = exports.FastMCPSession = exports.UserError = exports.UnexpectedStateError = exports.imageContent = void 0;
|
|
19
19
|
const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
|
|
20
20
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
21
21
|
const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
|
|
@@ -646,7 +646,7 @@ class FastMCPEventEmitter extends FastMCPEventEmitterBase {
|
|
|
646
646
|
* Class representing a toolbox for FastMCP.
|
|
647
647
|
* Manages tools, resources, and prompts for a Model Context Protocol server.
|
|
648
648
|
*/
|
|
649
|
-
class
|
|
649
|
+
class MCPServer extends FastMCPEventEmitter {
|
|
650
650
|
/**
|
|
651
651
|
* Creates a new ToolBox instance.
|
|
652
652
|
*
|
|
@@ -655,22 +655,22 @@ class ToolBox extends FastMCPEventEmitter {
|
|
|
655
655
|
constructor(options) {
|
|
656
656
|
super();
|
|
657
657
|
this.options = options;
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
__classPrivateFieldSet(this,
|
|
667
|
-
__classPrivateFieldSet(this,
|
|
658
|
+
_MCPServer_options.set(this, void 0);
|
|
659
|
+
_MCPServer_prompts.set(this, []);
|
|
660
|
+
_MCPServer_resources.set(this, []);
|
|
661
|
+
_MCPServer_resourcesTemplates.set(this, []);
|
|
662
|
+
_MCPServer_sessions.set(this, []);
|
|
663
|
+
_MCPServer_sseServer.set(this, null);
|
|
664
|
+
_MCPServer_tools.set(this, []);
|
|
665
|
+
_MCPServer_authenticate.set(this, void 0);
|
|
666
|
+
__classPrivateFieldSet(this, _MCPServer_options, options, "f");
|
|
667
|
+
__classPrivateFieldSet(this, _MCPServer_authenticate, options.authenticate, "f");
|
|
668
668
|
}
|
|
669
669
|
/**
|
|
670
670
|
* Gets all active sessions.
|
|
671
671
|
*/
|
|
672
672
|
get sessions() {
|
|
673
|
-
return __classPrivateFieldGet(this,
|
|
673
|
+
return __classPrivateFieldGet(this, _MCPServer_sessions, "f");
|
|
674
674
|
}
|
|
675
675
|
/**
|
|
676
676
|
* Adds a tool to the server.
|
|
@@ -678,7 +678,7 @@ class ToolBox extends FastMCPEventEmitter {
|
|
|
678
678
|
* @param tool - The tool to add
|
|
679
679
|
*/
|
|
680
680
|
addTool(tool) {
|
|
681
|
-
__classPrivateFieldGet(this,
|
|
681
|
+
__classPrivateFieldGet(this, _MCPServer_tools, "f").push(tool);
|
|
682
682
|
}
|
|
683
683
|
/**
|
|
684
684
|
* Adds a resource to the server.
|
|
@@ -686,7 +686,7 @@ class ToolBox extends FastMCPEventEmitter {
|
|
|
686
686
|
* @param resource - The resource to add
|
|
687
687
|
*/
|
|
688
688
|
addResource(resource) {
|
|
689
|
-
__classPrivateFieldGet(this,
|
|
689
|
+
__classPrivateFieldGet(this, _MCPServer_resources, "f").push(resource);
|
|
690
690
|
}
|
|
691
691
|
/**
|
|
692
692
|
* Adds a resource template to the server.
|
|
@@ -694,7 +694,7 @@ class ToolBox extends FastMCPEventEmitter {
|
|
|
694
694
|
* @param resource - The resource template to add
|
|
695
695
|
*/
|
|
696
696
|
addResourceTemplate(resource) {
|
|
697
|
-
__classPrivateFieldGet(this,
|
|
697
|
+
__classPrivateFieldGet(this, _MCPServer_resourcesTemplates, "f").push(resource);
|
|
698
698
|
}
|
|
699
699
|
/**
|
|
700
700
|
* Adds a prompt to the server.
|
|
@@ -702,7 +702,7 @@ class ToolBox extends FastMCPEventEmitter {
|
|
|
702
702
|
* @param prompt - The prompt to add
|
|
703
703
|
*/
|
|
704
704
|
addPrompt(prompt) {
|
|
705
|
-
__classPrivateFieldGet(this,
|
|
705
|
+
__classPrivateFieldGet(this, _MCPServer_prompts, "f").push(prompt);
|
|
706
706
|
}
|
|
707
707
|
/**
|
|
708
708
|
* Starts the server.
|
|
@@ -715,15 +715,15 @@ class ToolBox extends FastMCPEventEmitter {
|
|
|
715
715
|
if (options.transportType === "stdio") {
|
|
716
716
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
717
717
|
const session = new FastMCPSession({
|
|
718
|
-
name: __classPrivateFieldGet(this,
|
|
719
|
-
version: __classPrivateFieldGet(this,
|
|
720
|
-
tools: __classPrivateFieldGet(this,
|
|
721
|
-
resources: __classPrivateFieldGet(this,
|
|
722
|
-
resourcesTemplates: __classPrivateFieldGet(this,
|
|
723
|
-
prompts: __classPrivateFieldGet(this,
|
|
718
|
+
name: __classPrivateFieldGet(this, _MCPServer_options, "f").name,
|
|
719
|
+
version: __classPrivateFieldGet(this, _MCPServer_options, "f").version,
|
|
720
|
+
tools: __classPrivateFieldGet(this, _MCPServer_tools, "f"),
|
|
721
|
+
resources: __classPrivateFieldGet(this, _MCPServer_resources, "f"),
|
|
722
|
+
resourcesTemplates: __classPrivateFieldGet(this, _MCPServer_resourcesTemplates, "f"),
|
|
723
|
+
prompts: __classPrivateFieldGet(this, _MCPServer_prompts, "f"),
|
|
724
724
|
});
|
|
725
725
|
await session.connect(transport);
|
|
726
|
-
__classPrivateFieldGet(this,
|
|
726
|
+
__classPrivateFieldGet(this, _MCPServer_sessions, "f").push(session);
|
|
727
727
|
this.emit("connect", {
|
|
728
728
|
session,
|
|
729
729
|
});
|
|
@@ -738,8 +738,8 @@ class ToolBox extends FastMCPEventEmitter {
|
|
|
738
738
|
* Stops the server.
|
|
739
739
|
*/
|
|
740
740
|
async stop() {
|
|
741
|
-
if (__classPrivateFieldGet(this,
|
|
742
|
-
__classPrivateFieldGet(this,
|
|
741
|
+
if (__classPrivateFieldGet(this, _MCPServer_sseServer, "f")) {
|
|
742
|
+
__classPrivateFieldGet(this, _MCPServer_sseServer, "f").close();
|
|
743
743
|
}
|
|
744
744
|
}
|
|
745
745
|
/**
|
|
@@ -753,15 +753,15 @@ class ToolBox extends FastMCPEventEmitter {
|
|
|
753
753
|
if (options.transportType === "stdio") {
|
|
754
754
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
755
755
|
const session = new FastMCPSession({
|
|
756
|
-
name: __classPrivateFieldGet(this,
|
|
757
|
-
version: __classPrivateFieldGet(this,
|
|
758
|
-
tools: __classPrivateFieldGet(this,
|
|
759
|
-
resources: __classPrivateFieldGet(this,
|
|
760
|
-
resourcesTemplates: __classPrivateFieldGet(this,
|
|
761
|
-
prompts: __classPrivateFieldGet(this,
|
|
756
|
+
name: __classPrivateFieldGet(this, _MCPServer_options, "f").name,
|
|
757
|
+
version: __classPrivateFieldGet(this, _MCPServer_options, "f").version,
|
|
758
|
+
tools: __classPrivateFieldGet(this, _MCPServer_tools, "f"),
|
|
759
|
+
resources: __classPrivateFieldGet(this, _MCPServer_resources, "f"),
|
|
760
|
+
resourcesTemplates: __classPrivateFieldGet(this, _MCPServer_resourcesTemplates, "f"),
|
|
761
|
+
prompts: __classPrivateFieldGet(this, _MCPServer_prompts, "f"),
|
|
762
762
|
});
|
|
763
763
|
await session.connect(transport);
|
|
764
|
-
__classPrivateFieldGet(this,
|
|
764
|
+
__classPrivateFieldGet(this, _MCPServer_sessions, "f").push(session);
|
|
765
765
|
this.emit("connect", {
|
|
766
766
|
session,
|
|
767
767
|
});
|
|
@@ -775,5 +775,5 @@ class ToolBox extends FastMCPEventEmitter {
|
|
|
775
775
|
}
|
|
776
776
|
}
|
|
777
777
|
}
|
|
778
|
-
exports.
|
|
779
|
-
|
|
778
|
+
exports.MCPServer = MCPServer;
|
|
779
|
+
_MCPServer_options = new WeakMap(), _MCPServer_prompts = new WeakMap(), _MCPServer_resources = new WeakMap(), _MCPServer_resourcesTemplates = new WeakMap(), _MCPServer_sessions = new WeakMap(), _MCPServer_sseServer = new WeakMap(), _MCPServer_tools = new WeakMap(), _MCPServer_authenticate = new WeakMap();
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export interface LanguageParser {
|
|
3
|
-
[key: string]: {
|
|
4
|
-
parser: Parser;
|
|
5
|
-
query: Parser.Query;
|
|
6
|
-
};
|
|
7
|
-
}
|
|
1
|
+
import type { LanguageParser } from "../../types/InternalTypes";
|
|
8
2
|
export declare function loadRequiredLanguageParsers(filesToParse: string[]): Promise<LanguageParser>;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { MCPServer } from './utils/mcpServer';
|
|
2
2
|
export { TaskInstruction } from './agentlib/taskInstruction';
|
|
3
3
|
export { UserMessage } from './agentlib/usermessage';
|
|
4
4
|
export { SystemPrompt } from './agentlib/systemprompt';
|
|
5
5
|
export { Agent } from './agentlib/agent';
|
|
6
|
+
export { default as docutils } from './utils/docutils';
|
package/dist/utils.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Agent = exports.SystemPrompt = exports.UserMessage = exports.TaskInstruction = exports.
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "
|
|
6
|
+
exports.docutils = exports.Agent = exports.SystemPrompt = exports.UserMessage = exports.TaskInstruction = exports.MCPServer = void 0;
|
|
7
|
+
var mcpServer_1 = require("./utils/mcpServer");
|
|
8
|
+
Object.defineProperty(exports, "MCPServer", { enumerable: true, get: function () { return mcpServer_1.MCPServer; } });
|
|
6
9
|
var taskInstruction_1 = require("./agentlib/taskInstruction");
|
|
7
10
|
Object.defineProperty(exports, "TaskInstruction", { enumerable: true, get: function () { return taskInstruction_1.TaskInstruction; } });
|
|
8
11
|
var usermessage_1 = require("./agentlib/usermessage");
|
|
@@ -11,3 +14,5 @@ var systemprompt_1 = require("./agentlib/systemprompt");
|
|
|
11
14
|
Object.defineProperty(exports, "SystemPrompt", { enumerable: true, get: function () { return systemprompt_1.SystemPrompt; } });
|
|
12
15
|
var agent_1 = require("./agentlib/agent");
|
|
13
16
|
Object.defineProperty(exports, "Agent", { enumerable: true, get: function () { return agent_1.Agent; } });
|
|
17
|
+
var docutils_1 = require("./utils/docutils");
|
|
18
|
+
Object.defineProperty(exports, "docutils", { enumerable: true, get: function () { return __importDefault(docutils_1).default; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codebolt/codeboltjs",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.11",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "",
|
|
@@ -32,17 +32,22 @@
|
|
|
32
32
|
"@codebolt/types": "^1.0.10",
|
|
33
33
|
"@modelcontextprotocol/sdk": "^1.4.1",
|
|
34
34
|
"@types/pdf-parse": "^1.1.5",
|
|
35
|
+
"buffer": "^6.0.3",
|
|
35
36
|
"execa": "^9.5.2",
|
|
36
37
|
"file-type": "^19.6.0",
|
|
37
38
|
"fuse.js": "^7.0.0",
|
|
38
39
|
"js-yaml": "^4.1.0",
|
|
39
40
|
"load-esm": "^1.0.1",
|
|
40
41
|
"mcp-proxy": "^2.4.0",
|
|
42
|
+
"os-browserify": "^0.3.0",
|
|
43
|
+
"path-browserify": "^1.0.1",
|
|
41
44
|
"pdf-parse": "^1.1.1",
|
|
45
|
+
"stream-browserify": "^3.0.0",
|
|
42
46
|
"strict-event-emitter-types": "^2.0.0",
|
|
43
47
|
"timers": "^0.1.1",
|
|
44
48
|
"undici": "^7.4.0",
|
|
45
49
|
"uri-templates": "^0.2.0",
|
|
50
|
+
"util": "^0.12.5",
|
|
46
51
|
"web-tree-sitter": "^0.24.1",
|
|
47
52
|
"ws": "^8.17.0",
|
|
48
53
|
"yargs": "^17.7.2",
|