@codebolt/codeboltjs 2.0.16 → 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.
- package/dist/core/Codebolt.d.ts +49 -54
- package/dist/core/messageManager.d.ts +0 -1
- package/dist/modules/chat.d.ts +1 -1
- package/dist/modules/codeparsers.js +24 -15
- package/dist/modules/codeutils.js +19 -9
- package/dist/modules/mcp.d.ts +1 -2
- package/dist/modules/mcp.js +2 -0
- package/dist/modules/task.d.ts +1 -1
- package/dist/modules/terminal.d.ts +0 -1
- package/dist/notificationfunctions/agent.js +4 -4
- package/dist/notificationfunctions/browser.js +5 -5
- package/dist/notificationfunctions/chat.js +5 -5
- package/dist/notificationfunctions/codeutils.js +5 -5
- package/dist/notificationfunctions/crawler.js +5 -5
- package/dist/notificationfunctions/dbmemory.js +5 -5
- package/dist/notificationfunctions/fs.js +23 -23
- package/dist/notificationfunctions/git.js +25 -25
- package/dist/notificationfunctions/history.js +5 -5
- package/dist/notificationfunctions/llm.js +5 -5
- package/dist/notificationfunctions/mcp.js +9 -9
- package/dist/notificationfunctions/search.js +7 -7
- package/dist/notificationfunctions/system.js +3 -3
- package/dist/notificationfunctions/terminal.js +3 -3
- package/dist/notificationfunctions/todo.js +7 -7
- package/dist/notificationfunctions/utils.js +8 -8
- package/dist/types/InternalTypes.d.ts +0 -3
- package/dist/types/commonTypes.d.ts +2 -2
- package/dist/types/socketMessageTypes.d.ts +0 -2
- package/dist/types/socketMessageTypes.js +6 -7
- package/package.json +20 -26
- package/dist/agentlib/agent.d.ts +0 -86
- package/dist/agentlib/agent.js +0 -326
- package/dist/agentlib/followupquestionbuilder.d.ts +0 -75
- package/dist/agentlib/followupquestionbuilder.js +0 -193
- package/dist/agentlib/llmoutputhandler.d.ts +0 -102
- package/dist/agentlib/llmoutputhandler.js +0 -451
- package/dist/agentlib/promptbuilder.d.ts +0 -382
- package/dist/agentlib/promptbuilder.js +0 -805
- package/dist/agentlib/systemprompt.d.ts +0 -20
- package/dist/agentlib/systemprompt.js +0 -48
- package/dist/agentlib/taskInstruction.d.ts +0 -37
- package/dist/agentlib/taskInstruction.js +0 -57
- package/dist/agentlib/usermessage.d.ts +0 -70
- package/dist/agentlib/usermessage.js +0 -124
- package/dist/utils/docutils.d.ts +0 -9
- package/dist/utils/docutils.js +0 -69
- package/dist/utils/mcpServer.d.ts +0 -481
- package/dist/utils/mcpServer.js +0 -779
- package/dist/utils/parse-source-code/index.d.ts +0 -9
- package/dist/utils/parse-source-code/index.js +0 -233
- package/dist/utils/parse-source-code/languageParser.d.ts +0 -2
- package/dist/utils/parse-source-code/languageParser.js +0 -137
- package/dist/utils/parse-source-code/queries/c-sharp.d.ts +0 -2
- package/dist/utils/parse-source-code/queries/c-sharp.js +0 -25
- package/dist/utils/parse-source-code/queries/c.d.ts +0 -2
- package/dist/utils/parse-source-code/queries/c.js +0 -17
- package/dist/utils/parse-source-code/queries/cpp.d.ts +0 -2
- package/dist/utils/parse-source-code/queries/cpp.js +0 -25
- package/dist/utils/parse-source-code/queries/go.d.ts +0 -2
- package/dist/utils/parse-source-code/queries/go.js +0 -29
- package/dist/utils/parse-source-code/queries/index.d.ts +0 -12
- package/dist/utils/parse-source-code/queries/index.js +0 -30
- package/dist/utils/parse-source-code/queries/java.d.ts +0 -2
- package/dist/utils/parse-source-code/queries/java.js +0 -17
- package/dist/utils/parse-source-code/queries/javascript.d.ts +0 -2
- package/dist/utils/parse-source-code/queries/javascript.js +0 -67
- package/dist/utils/parse-source-code/queries/php.d.ts +0 -2
- package/dist/utils/parse-source-code/queries/php.js +0 -17
- package/dist/utils/parse-source-code/queries/python.d.ts +0 -2
- package/dist/utils/parse-source-code/queries/python.js +0 -13
- package/dist/utils/parse-source-code/queries/ruby.d.ts +0 -2
- package/dist/utils/parse-source-code/queries/ruby.js +0 -54
- package/dist/utils/parse-source-code/queries/rust.d.ts +0 -2
- package/dist/utils/parse-source-code/queries/rust.js +0 -18
- package/dist/utils/parse-source-code/queries/swift.d.ts +0 -2
- package/dist/utils/parse-source-code/queries/swift.js +0 -47
- package/dist/utils/parse-source-code/queries/typescript.d.ts +0 -2
- package/dist/utils/parse-source-code/queries/typescript.js +0 -34
- package/dist/utils/parse-source-code/tree-sitter-c.wasm +0 -0
- package/dist/utils/parse-source-code/tree-sitter-c_sharp.wasm +0 -0
- package/dist/utils/parse-source-code/tree-sitter-cpp.wasm +0 -0
- package/dist/utils/parse-source-code/tree-sitter-go.wasm +0 -0
- package/dist/utils/parse-source-code/tree-sitter-java.wasm +0 -0
- package/dist/utils/parse-source-code/tree-sitter-javascript.wasm +0 -0
- package/dist/utils/parse-source-code/tree-sitter-php.wasm +0 -0
- package/dist/utils/parse-source-code/tree-sitter-python.wasm +0 -0
- package/dist/utils/parse-source-code/tree-sitter-ruby.wasm +0 -0
- package/dist/utils/parse-source-code/tree-sitter-rust.wasm +0 -0
- package/dist/utils/parse-source-code/tree-sitter-swift.wasm +0 -0
- package/dist/utils/parse-source-code/tree-sitter-tsx.wasm +0 -0
- package/dist/utils/parse-source-code/tree-sitter-typescript.wasm +0 -0
- package/dist/utils/parse-source-code/tree-sitter.wasm +0 -0
- package/dist/utils.d.ts +0 -9
- package/dist/utils.js +0 -24
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* including command execution operations.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.terminalNotifications =
|
|
9
|
+
exports.terminalNotifications = void 0;
|
|
10
|
+
exports.CommandExecutionRequestNotify = CommandExecutionRequestNotify;
|
|
11
|
+
exports.CommandExecutionResponseNotify = CommandExecutionResponseNotify;
|
|
10
12
|
const utils_1 = require("./utils");
|
|
11
13
|
// ===== COMMAND EXECUTION FUNCTIONS =====
|
|
12
14
|
/**
|
|
@@ -33,7 +35,6 @@ function CommandExecutionRequestNotify(command, returnEmptyStringOnSuccess, exec
|
|
|
33
35
|
};
|
|
34
36
|
(0, utils_1.sendNotification)(notification, 'terminal-command-execution');
|
|
35
37
|
}
|
|
36
|
-
exports.CommandExecutionRequestNotify = CommandExecutionRequestNotify;
|
|
37
38
|
/**
|
|
38
39
|
* Sends a command execution response notification
|
|
39
40
|
* @param content - The command execution result or error details
|
|
@@ -54,7 +55,6 @@ function CommandExecutionResponseNotify(content, isError = false, toolUseId) {
|
|
|
54
55
|
};
|
|
55
56
|
(0, utils_1.sendNotification)(notification, 'terminal-command-execution-response');
|
|
56
57
|
}
|
|
57
|
-
exports.CommandExecutionResponseNotify = CommandExecutionResponseNotify;
|
|
58
58
|
/**
|
|
59
59
|
* Terminal notification functions object
|
|
60
60
|
*/
|
|
@@ -6,7 +6,13 @@
|
|
|
6
6
|
* including task operations and lifecycle management.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.todoNotifications =
|
|
9
|
+
exports.todoNotifications = void 0;
|
|
10
|
+
exports.AddTodoRequestNotify = AddTodoRequestNotify;
|
|
11
|
+
exports.AddTodoResponseNotify = AddTodoResponseNotify;
|
|
12
|
+
exports.GetTodoRequestNotify = GetTodoRequestNotify;
|
|
13
|
+
exports.GetTodoResponseNotify = GetTodoResponseNotify;
|
|
14
|
+
exports.EditTodoTaskRequestNotify = EditTodoTaskRequestNotify;
|
|
15
|
+
exports.EditTodoTaskResponseNotify = EditTodoTaskResponseNotify;
|
|
10
16
|
const utils_1 = require("./utils");
|
|
11
17
|
// ===== ADD TODO FUNCTIONS =====
|
|
12
18
|
/**
|
|
@@ -37,7 +43,6 @@ function AddTodoRequestNotify(title, agentId, description, phase, category, prio
|
|
|
37
43
|
};
|
|
38
44
|
(0, utils_1.sendNotification)(notification, 'todo-add-task');
|
|
39
45
|
}
|
|
40
|
-
exports.AddTodoRequestNotify = AddTodoRequestNotify;
|
|
41
46
|
/**
|
|
42
47
|
* Sends an add todo response notification
|
|
43
48
|
* @param content - The response content or error details
|
|
@@ -58,7 +63,6 @@ function AddTodoResponseNotify(content, isError = false, toolUseId) {
|
|
|
58
63
|
};
|
|
59
64
|
(0, utils_1.sendNotification)(notification, 'todo-add-task-response');
|
|
60
65
|
}
|
|
61
|
-
exports.AddTodoResponseNotify = AddTodoResponseNotify;
|
|
62
66
|
// ===== GET TODO FUNCTIONS =====
|
|
63
67
|
/**
|
|
64
68
|
* Sends a get todo request notification
|
|
@@ -76,7 +80,6 @@ function GetTodoRequestNotify(filters, toolUseId) {
|
|
|
76
80
|
};
|
|
77
81
|
(0, utils_1.sendNotification)(notification, 'todo-get-tasks');
|
|
78
82
|
}
|
|
79
|
-
exports.GetTodoRequestNotify = GetTodoRequestNotify;
|
|
80
83
|
/**
|
|
81
84
|
* Sends a get todo response notification
|
|
82
85
|
* @param content - The response content or error details
|
|
@@ -97,7 +100,6 @@ function GetTodoResponseNotify(content, isError = false, toolUseId) {
|
|
|
97
100
|
};
|
|
98
101
|
(0, utils_1.sendNotification)(notification, 'todo-get-tasks-response');
|
|
99
102
|
}
|
|
100
|
-
exports.GetTodoResponseNotify = GetTodoResponseNotify;
|
|
101
103
|
// ===== EDIT TODO TASK FUNCTIONS =====
|
|
102
104
|
/**
|
|
103
105
|
* Sends an edit todo task request notification
|
|
@@ -129,7 +131,6 @@ function EditTodoTaskRequestNotify(taskId, title, description, phase, category,
|
|
|
129
131
|
};
|
|
130
132
|
(0, utils_1.sendNotification)(notification, 'todo-edit-task');
|
|
131
133
|
}
|
|
132
|
-
exports.EditTodoTaskRequestNotify = EditTodoTaskRequestNotify;
|
|
133
134
|
/**
|
|
134
135
|
* Sends an edit todo task response notification
|
|
135
136
|
* @param content - The response content or error details
|
|
@@ -150,7 +151,6 @@ function EditTodoTaskResponseNotify(content, isError = false, toolUseId) {
|
|
|
150
151
|
};
|
|
151
152
|
(0, utils_1.sendNotification)(notification, 'todo-edit-task-response');
|
|
152
153
|
}
|
|
153
|
-
exports.EditTodoTaskResponseNotify = EditTodoTaskResponseNotify;
|
|
154
154
|
/**
|
|
155
155
|
* Todo notification functions object
|
|
156
156
|
*/
|
|
@@ -3,7 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.NotificationErrorCodes = exports.NotificationError = void 0;
|
|
7
|
+
exports.generateToolUseId = generateToolUseId;
|
|
8
|
+
exports.validateNotificationStructure = validateNotificationStructure;
|
|
9
|
+
exports.sendNotification = sendNotification;
|
|
10
|
+
exports.validateRequiredFields = validateRequiredFields;
|
|
11
|
+
exports.createErrorResponse = createErrorResponse;
|
|
12
|
+
exports.createSuccessResponse = createSuccessResponse;
|
|
13
|
+
exports.safeStringify = safeStringify;
|
|
7
14
|
const websocket_1 = __importDefault(require("../core/websocket"));
|
|
8
15
|
/**
|
|
9
16
|
* Error class for notification-related errors
|
|
@@ -38,7 +45,6 @@ function generateToolUseId() {
|
|
|
38
45
|
const randomString = Math.random().toString(36).substr(2, 9);
|
|
39
46
|
return `tool_${timestamp}_${randomString}`;
|
|
40
47
|
}
|
|
41
|
-
exports.generateToolUseId = generateToolUseId;
|
|
42
48
|
/**
|
|
43
49
|
* Validates the basic structure of a notification
|
|
44
50
|
* @param notification The notification to validate
|
|
@@ -60,7 +66,6 @@ function validateNotificationStructure(notification) {
|
|
|
60
66
|
}
|
|
61
67
|
return true;
|
|
62
68
|
}
|
|
63
|
-
exports.validateNotificationStructure = validateNotificationStructure;
|
|
64
69
|
/**
|
|
65
70
|
* Sends a notification through the WebSocket connection
|
|
66
71
|
* This is a fire-and-forget operation that handles errors gracefully
|
|
@@ -101,7 +106,6 @@ function sendNotification(notification, category = 'unknown') {
|
|
|
101
106
|
console.error('[NotificationFunctions]', notificationError.message, notification);
|
|
102
107
|
}
|
|
103
108
|
}
|
|
104
|
-
exports.sendNotification = sendNotification;
|
|
105
109
|
/**
|
|
106
110
|
* Validates that required data fields are present and not empty
|
|
107
111
|
* @param data The data object to validate
|
|
@@ -122,7 +126,6 @@ function validateRequiredFields(data, requiredFields, category = 'unknown') {
|
|
|
122
126
|
}
|
|
123
127
|
return true;
|
|
124
128
|
}
|
|
125
|
-
exports.validateRequiredFields = validateRequiredFields;
|
|
126
129
|
/**
|
|
127
130
|
* Creates a standardized error response notification
|
|
128
131
|
* @param toolUseId The toolUseId to use for the response
|
|
@@ -140,7 +143,6 @@ function createErrorResponse(toolUseId, type, action, error) {
|
|
|
140
143
|
isError: true
|
|
141
144
|
};
|
|
142
145
|
}
|
|
143
|
-
exports.createErrorResponse = createErrorResponse;
|
|
144
146
|
/**
|
|
145
147
|
* Creates a standardized success response notification
|
|
146
148
|
* @param toolUseId The toolUseId to use for the response
|
|
@@ -158,7 +160,6 @@ function createSuccessResponse(toolUseId, type, action, content) {
|
|
|
158
160
|
isError: false
|
|
159
161
|
};
|
|
160
162
|
}
|
|
161
|
-
exports.createSuccessResponse = createSuccessResponse;
|
|
162
163
|
/**
|
|
163
164
|
* Utility function to safely stringify objects for logging
|
|
164
165
|
* @param obj The object to stringify
|
|
@@ -174,4 +175,3 @@ function safeStringify(obj, maxLength = 200) {
|
|
|
174
175
|
return '[Object - could not stringify]';
|
|
175
176
|
}
|
|
176
177
|
}
|
|
177
|
-
exports.safeStringify = safeStringify;
|
|
@@ -8,9 +8,6 @@
|
|
|
8
8
|
* - Module-specific types
|
|
9
9
|
* - WebSocket management types
|
|
10
10
|
*/
|
|
11
|
-
/// <reference types="node" />
|
|
12
|
-
/// <reference types="node" />
|
|
13
|
-
/// <reference types="node" />
|
|
14
11
|
import { EventEmitter } from 'events';
|
|
15
12
|
import WebSocket from 'ws';
|
|
16
13
|
import type { PendingRequest } from './commonTypes';
|
|
@@ -243,8 +243,8 @@ export interface CodeboltError extends Error {
|
|
|
243
243
|
}
|
|
244
244
|
export declare class CodeboltError extends Error {
|
|
245
245
|
code?: string | undefined;
|
|
246
|
-
details?: any;
|
|
247
|
-
constructor(message: string, code?: string | undefined, details?: any);
|
|
246
|
+
details?: any | undefined;
|
|
247
|
+
constructor(message: string, code?: string | undefined, details?: any | undefined);
|
|
248
248
|
}
|
|
249
249
|
export interface FileEntry {
|
|
250
250
|
name: string;
|
|
@@ -8,30 +8,30 @@
|
|
|
8
8
|
* - WebSocket communication protocols
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.
|
|
11
|
+
exports.isSuccessResponse = isSuccessResponse;
|
|
12
|
+
exports.isFailureResponse = isFailureResponse;
|
|
13
|
+
exports.isErrorResponse = isErrorResponse;
|
|
14
|
+
exports.isBrowserResponse = isBrowserResponse;
|
|
15
|
+
exports.isGitResponse = isGitResponse;
|
|
16
|
+
exports.isFsServiceResponse = isFsServiceResponse;
|
|
12
17
|
// ================================
|
|
13
18
|
// Type Guards
|
|
14
19
|
// ================================
|
|
15
20
|
function isSuccessResponse(response) {
|
|
16
21
|
return 'success' in response && response.success === true;
|
|
17
22
|
}
|
|
18
|
-
exports.isSuccessResponse = isSuccessResponse;
|
|
19
23
|
function isFailureResponse(response) {
|
|
20
24
|
return 'success' in response && response.success === false;
|
|
21
25
|
}
|
|
22
|
-
exports.isFailureResponse = isFailureResponse;
|
|
23
26
|
function isErrorResponse(response) {
|
|
24
27
|
return response.type === 'error';
|
|
25
28
|
}
|
|
26
|
-
exports.isErrorResponse = isErrorResponse;
|
|
27
29
|
function isBrowserResponse(response) {
|
|
28
30
|
return response.type.includes('browser') || response.type.includes('screenshot') || response.type.includes('Content');
|
|
29
31
|
}
|
|
30
|
-
exports.isBrowserResponse = isBrowserResponse;
|
|
31
32
|
function isGitResponse(response) {
|
|
32
33
|
return response.type.startsWith('git');
|
|
33
34
|
}
|
|
34
|
-
exports.isGitResponse = isGitResponse;
|
|
35
35
|
function isFsServiceResponse(response) {
|
|
36
36
|
return response.type.includes('readFileResponse') ||
|
|
37
37
|
response.type.includes('writeToFileResponse') ||
|
|
@@ -48,4 +48,3 @@ function isFsServiceResponse(response) {
|
|
|
48
48
|
response.type.includes('editFileAndApplyDiffResponse') ||
|
|
49
49
|
response.type.includes('fsExecuteToolResponse');
|
|
50
50
|
}
|
|
51
|
-
exports.isFsServiceResponse = isFsServiceResponse;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codebolt/codeboltjs",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "",
|
|
@@ -11,50 +11,34 @@
|
|
|
11
11
|
"README.md",
|
|
12
12
|
"LICENSE"
|
|
13
13
|
],
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsc && node script/copy-wasm.js",
|
|
16
|
-
"build:webpack": "webpack",
|
|
17
|
-
"build:all": "npm run build && npm run build:webpack",
|
|
18
|
-
"build:docs": "typedoc --plugin typedoc-plugin-missing-exports",
|
|
19
|
-
"build:jsondocs": "typedoc --plugin typedoc-plugin-missing-exports --json out.json --pretty",
|
|
20
|
-
"test": "jest fs.test.js",
|
|
21
|
-
"clean": "rm -rf dist build",
|
|
22
|
-
"prepublishOnly": "npm run clean && npm run build"
|
|
23
|
-
},
|
|
24
14
|
"repository": {
|
|
25
15
|
"type": "git",
|
|
26
|
-
"url": "git+https://github.com/codeboltai/codeboltjs.git"
|
|
16
|
+
"url": "git+https://github.com/codeboltai/codeboltjs.git",
|
|
17
|
+
"directory": "packages/codeboltjs"
|
|
27
18
|
},
|
|
28
19
|
"license": "MIT",
|
|
29
20
|
"homepage": "https://codeboltai.github.io",
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
30
24
|
"dependencies": {
|
|
31
25
|
"@codebolt/globby": "^1.0.1",
|
|
32
26
|
"@codebolt/types": "^1.0.10",
|
|
33
|
-
"@modelcontextprotocol/sdk": "^1.4.1",
|
|
34
|
-
"@types/pdf-parse": "^1.1.5",
|
|
35
27
|
"@types/uuid": "^10.0.0",
|
|
36
28
|
"buffer": "^6.0.3",
|
|
37
29
|
"execa": "^9.5.2",
|
|
38
|
-
"file-type": "^19.6.0",
|
|
39
|
-
"fuse.js": "^7.0.0",
|
|
40
30
|
"js-yaml": "^4.1.0",
|
|
41
|
-
"load-esm": "^1.0.1",
|
|
42
|
-
"mcp-proxy": "^2.4.0",
|
|
43
31
|
"os-browserify": "^0.3.0",
|
|
44
32
|
"path-browserify": "^1.0.1",
|
|
45
|
-
"pdf-parse": "^1.1.1",
|
|
46
33
|
"stream-browserify": "^3.0.0",
|
|
47
|
-
"strict-event-emitter-types": "^2.0.0",
|
|
48
34
|
"timers": "^0.1.1",
|
|
49
|
-
"undici": "^7.4.0",
|
|
50
|
-
"uri-templates": "^0.2.0",
|
|
51
35
|
"util": "^0.12.5",
|
|
52
36
|
"uuid": "^11.1.0",
|
|
53
|
-
"web-tree-sitter": "^0.24.1",
|
|
54
37
|
"ws": "^8.17.0",
|
|
55
38
|
"yargs": "^17.7.2",
|
|
56
|
-
"
|
|
57
|
-
"
|
|
39
|
+
"@codebolt/codeparser": "1.1.0",
|
|
40
|
+
"@codebolt/mcp": "1.1.0",
|
|
41
|
+
"@codebolt/utils": "1.1.0"
|
|
58
42
|
},
|
|
59
43
|
"devDependencies": {
|
|
60
44
|
"@types/events": "^3.0.3",
|
|
@@ -84,5 +68,15 @@
|
|
|
84
68
|
"types": "./dist/utils.d.ts",
|
|
85
69
|
"default": "./dist/utils.js"
|
|
86
70
|
}
|
|
71
|
+
},
|
|
72
|
+
"scripts": {
|
|
73
|
+
"build": "tsc && node script/copy-wasm.js",
|
|
74
|
+
"build:webpack": "webpack",
|
|
75
|
+
"build:all": "npm run build && npm run build:webpack",
|
|
76
|
+
"build:docs": "typedoc --plugin typedoc-plugin-missing-exports",
|
|
77
|
+
"build:jsondocs": "typedoc --plugin typedoc-plugin-missing-exports --json out.json --pretty",
|
|
78
|
+
"test": "echo \"Integration tests require WebSocket server - skipping for release\" && exit 0",
|
|
79
|
+
"clean": "rm -rf dist build",
|
|
80
|
+
"lint": "tsc --noEmit"
|
|
87
81
|
}
|
|
88
|
-
}
|
|
82
|
+
}
|
package/dist/agentlib/agent.d.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { SystemPrompt } from "./systemprompt";
|
|
2
|
-
import { TaskInstruction } from "./taskInstruction";
|
|
3
|
-
/**
|
|
4
|
-
* Agent class that manages conversations with LLMs and tool executions.
|
|
5
|
-
* Handles the conversation flow, tool calls, and task completions.
|
|
6
|
-
*/
|
|
7
|
-
declare class Agent {
|
|
8
|
-
/** Available tools for the agent to use */
|
|
9
|
-
private tools;
|
|
10
|
-
/** Full conversation history for API calls */
|
|
11
|
-
private apiConversationHistory;
|
|
12
|
-
/** Maximum number of conversation turns (0 means unlimited) */
|
|
13
|
-
private maxRun;
|
|
14
|
-
/** System prompt that provides instructions to the model */
|
|
15
|
-
private systemPrompt;
|
|
16
|
-
/** Messages from the user */
|
|
17
|
-
private userMessage;
|
|
18
|
-
/** The next user message to be added to the conversation */
|
|
19
|
-
private nextUserMessage;
|
|
20
|
-
/**
|
|
21
|
-
* Creates a new Agent instance.
|
|
22
|
-
*
|
|
23
|
-
* @param tools - The tools available to the agent
|
|
24
|
-
* @param systemPrompt - The system prompt providing instructions to the LLM
|
|
25
|
-
* @param maxRun - Maximum number of conversation turns (0 means unlimited)
|
|
26
|
-
*/
|
|
27
|
-
constructor(tools: any, systemPrompt: SystemPrompt, maxRun?: number);
|
|
28
|
-
/**
|
|
29
|
-
* Runs the agent on a specific task until completion or max runs reached.
|
|
30
|
-
*
|
|
31
|
-
* @param task - The task instruction to be executed
|
|
32
|
-
* @param successCondition - Optional function to determine if the task is successful
|
|
33
|
-
* @returns Promise with success status, error (if any), and the last assistant message
|
|
34
|
-
*/
|
|
35
|
-
run(task: TaskInstruction, successCondition?: () => boolean): Promise<{
|
|
36
|
-
success: boolean;
|
|
37
|
-
error: string | null;
|
|
38
|
-
message: string | null;
|
|
39
|
-
}>;
|
|
40
|
-
/**
|
|
41
|
-
* Attempts to make a request to the LLM with conversation history and tools.
|
|
42
|
-
*
|
|
43
|
-
* @param apiConversationHistory - The current conversation history
|
|
44
|
-
* @param tools - The tools available to the LLM
|
|
45
|
-
* @returns Promise with the LLM response
|
|
46
|
-
*/
|
|
47
|
-
private attemptLlmRequest;
|
|
48
|
-
/**
|
|
49
|
-
* Executes a tool with given name and input.
|
|
50
|
-
*
|
|
51
|
-
* @param toolName - The name of the tool to execute
|
|
52
|
-
* @param toolInput - The input parameters for the tool
|
|
53
|
-
* @returns Promise with tuple [userRejected, result]
|
|
54
|
-
*/
|
|
55
|
-
private executeTool;
|
|
56
|
-
/**
|
|
57
|
-
* Starts a sub-agent to handle a specific task.
|
|
58
|
-
*
|
|
59
|
-
* @param agentName - The name of the sub-agent to start
|
|
60
|
-
* @param params - Parameters for the sub-agent
|
|
61
|
-
* @returns Promise with tuple [userRejected, result]
|
|
62
|
-
*/
|
|
63
|
-
private startSubAgent;
|
|
64
|
-
/**
|
|
65
|
-
* Extracts tool details from a tool call object.
|
|
66
|
-
*
|
|
67
|
-
* @param tool - The tool call object from the LLM response
|
|
68
|
-
* @returns ToolDetails object with name, input, and ID
|
|
69
|
-
*/
|
|
70
|
-
private getToolDetail;
|
|
71
|
-
/**
|
|
72
|
-
* Creates a tool result object from the tool execution response.
|
|
73
|
-
*
|
|
74
|
-
* @param tool_call_id - The ID of the tool call
|
|
75
|
-
* @param content - The content returned by the tool
|
|
76
|
-
* @returns ToolResult object
|
|
77
|
-
*/
|
|
78
|
-
private getToolResult;
|
|
79
|
-
/**
|
|
80
|
-
* Fallback method for API requests in case of failures.
|
|
81
|
-
*
|
|
82
|
-
* @throws Error API request fallback not implemented
|
|
83
|
-
*/
|
|
84
|
-
private attemptApiRequest;
|
|
85
|
-
}
|
|
86
|
-
export { Agent };
|