@codebolt/codeboltjs 5.0.8 → 5.0.9
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 +29 -5
- package/dist/core/Codebolt.js +58 -0
- package/dist/core/websocket.js +15 -17
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -3
- package/dist/modules/dynamicPanel.d.ts +106 -0
- package/dist/modules/dynamicPanel.js +122 -0
- package/dist/modules/mcp.js +3 -0
- package/dist/modules/swarm.d.ts +8 -2
- package/dist/modules/swarm.js +14 -0
- package/dist/tools/actionBlock/action-block-start.js +1 -4
- package/dist/tools/actionPlan/action-plan-create.js +1 -2
- package/dist/tools/completion/attempt-completion.d.ts +25 -0
- package/dist/tools/completion/attempt-completion.js +45 -0
- package/dist/tools/completion/index.d.ts +3 -0
- package/dist/tools/completion/index.js +9 -0
- package/dist/tools/index.d.ts +6 -3
- package/dist/tools/index.js +11 -4
- package/dist/tools/job/index.d.ts +3 -1
- package/dist/tools/job/index.js +5 -1
- package/dist/tools/job/job-remove-dependency.d.ts +28 -0
- package/dist/tools/job/job-remove-dependency.js +86 -0
- package/dist/tools/requirementPlan/requirement-plan-review.js +1 -1
- package/dist/tools/thread/thread-create-background.js +1 -1
- package/dist/tools/utils/schema-validator.d.ts +1 -0
- package/dist/tools/utils/schema-validator.js +13 -1
- package/dist/types/job.d.ts +1 -1
- package/package.json +2 -2
- package/dist/modules/codeboltEvent.d.ts +0 -57
- package/dist/modules/codeboltEvent.js +0 -217
- package/dist/tools/browser/browser-action.d.ts +0 -56
- package/dist/tools/browser/browser-action.js +0 -265
- package/dist/tools/codeboltEvent/event-add-running-agent.d.ts +0 -25
- package/dist/tools/codeboltEvent/event-add-running-agent.js +0 -69
- package/dist/tools/codeboltEvent/event-check-background-agent-completion.d.ts +0 -19
- package/dist/tools/codeboltEvent/event-check-background-agent-completion.js +0 -64
- package/dist/tools/codeboltEvent/event-get-running-agent-count.d.ts +0 -19
- package/dist/tools/codeboltEvent/event-get-running-agent-count.js +0 -55
- package/dist/tools/codeboltEvent/event-on-background-agent-completion.d.ts +0 -19
- package/dist/tools/codeboltEvent/event-on-background-agent-completion.js +0 -56
- package/dist/tools/codeboltEvent/event-wait-for-external-event.d.ts +0 -19
- package/dist/tools/codeboltEvent/event-wait-for-external-event.js +0 -55
- package/dist/tools/codeboltEvent/index.d.ts +0 -19
- package/dist/tools/codeboltEvent/index.js +0 -33
- package/dist/tools/event/event-add-running-agent.d.ts +0 -32
- package/dist/tools/event/event-add-running-agent.js +0 -77
- package/dist/tools/event/event-check-agent-event.d.ts +0 -19
- package/dist/tools/event/event-check-agent-event.js +0 -63
- package/dist/tools/event/event-check-completion.d.ts +0 -19
- package/dist/tools/event/event-check-completion.js +0 -73
- package/dist/tools/event/event-check-grouped-completion.d.ts +0 -19
- package/dist/tools/event/event-check-grouped-completion.js +0 -63
- package/dist/tools/event/event-get-running-count.d.ts +0 -19
- package/dist/tools/event/event-get-running-count.js +0 -55
- package/dist/tools/event/event-on-agent-event.d.ts +0 -19
- package/dist/tools/event/event-on-agent-event.js +0 -63
- package/dist/tools/event/event-on-completion.d.ts +0 -19
- package/dist/tools/event/event-on-completion.js +0 -73
- package/dist/tools/event/event-on-grouped-completion.d.ts +0 -19
- package/dist/tools/event/event-on-grouped-completion.js +0 -63
- package/dist/tools/event/event-wait-any.d.ts +0 -19
- package/dist/tools/event/event-wait-any.js +0 -66
- package/dist/tools/event/index.d.ts +0 -25
- package/dist/tools/event/index.js +0 -48
- package/dist/tools/git/git-action.d.ts +0 -48
- package/dist/tools/git/git-action.js +0 -279
- package/dist/tools/kvStore/kv-store-create-instance.d.ts +0 -26
- package/dist/tools/kvStore/kv-store-create-instance.js +0 -79
- package/dist/tools/kvStore/kv-store-get.d.ts +0 -30
- package/dist/tools/kvStore/kv-store-get.js +0 -80
- package/dist/tools/kvStore/kv-store-set.d.ts +0 -38
- package/dist/tools/kvStore/kv-store-set.js +0 -86
- package/dist/tools/memoryIngestion/mi-create-pipeline.d.ts +0 -44
- package/dist/tools/memoryIngestion/mi-create-pipeline.js +0 -114
- package/dist/tools/memoryIngestion/mi-list.d.ts +0 -22
- package/dist/tools/memoryIngestion/mi-list.js +0 -66
- package/dist/tools/orchestration/agent-details.d.ts +0 -15
- package/dist/tools/orchestration/agent-details.js +0 -98
- package/dist/tools/orchestration/agent-find.d.ts +0 -18
- package/dist/tools/orchestration/agent-find.js +0 -125
- package/dist/tools/orchestration/agent-list.d.ts +0 -13
- package/dist/tools/orchestration/agent-list.js +0 -106
- package/dist/tools/orchestration/agent-management.d.ts +0 -44
- package/dist/tools/orchestration/agent-management.js +0 -250
- package/dist/tools/orchestration/agent-start.d.ts +0 -18
- package/dist/tools/orchestration/agent-start.js +0 -90
- package/dist/tools/orchestration/index.d.ts +0 -49
- package/dist/tools/orchestration/index.js +0 -102
- package/dist/tools/orchestration/task-assign.d.ts +0 -18
- package/dist/tools/orchestration/task-assign.js +0 -84
- package/dist/tools/orchestration/task-create.d.ts +0 -20
- package/dist/tools/orchestration/task-create.js +0 -97
- package/dist/tools/orchestration/task-delete.d.ts +0 -16
- package/dist/tools/orchestration/task-delete.js +0 -77
- package/dist/tools/orchestration/task-execute.d.ts +0 -18
- package/dist/tools/orchestration/task-execute.js +0 -84
- package/dist/tools/orchestration/task-get.d.ts +0 -16
- package/dist/tools/orchestration/task-get.js +0 -89
- package/dist/tools/orchestration/task-list.d.ts +0 -13
- package/dist/tools/orchestration/task-list.js +0 -74
- package/dist/tools/orchestration/task-management.d.ts +0 -52
- package/dist/tools/orchestration/task-management.js +0 -231
- package/dist/tools/orchestration/task-update.d.ts +0 -22
- package/dist/tools/orchestration/task-update.js +0 -96
- package/dist/tools/orchestration/thread-create-background.d.ts +0 -18
- package/dist/tools/orchestration/thread-create-background.js +0 -94
- package/dist/tools/orchestration/thread-create-start.d.ts +0 -16
- package/dist/tools/orchestration/thread-create-start.js +0 -85
- package/dist/tools/orchestration/thread-create.d.ts +0 -16
- package/dist/tools/orchestration/thread-create.js +0 -85
- package/dist/tools/orchestration/thread-delete.d.ts +0 -16
- package/dist/tools/orchestration/thread-delete.js +0 -77
- package/dist/tools/orchestration/thread-get-messages.d.ts +0 -24
- package/dist/tools/orchestration/thread-get-messages.js +0 -122
- package/dist/tools/orchestration/thread-get.d.ts +0 -16
- package/dist/tools/orchestration/thread-get.js +0 -85
- package/dist/tools/orchestration/thread-list.d.ts +0 -16
- package/dist/tools/orchestration/thread-list.js +0 -85
- package/dist/tools/orchestration/thread-start.d.ts +0 -16
- package/dist/tools/orchestration/thread-start.js +0 -82
- package/dist/tools/orchestration/thread-update-status.d.ts +0 -18
- package/dist/tools/orchestration/thread-update-status.js +0 -89
- package/dist/tools/orchestration/thread-update.d.ts +0 -18
- package/dist/tools/orchestration/thread-update.js +0 -89
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Task Management Tool - Manages tasks
|
|
4
|
-
* Wraps the SDK's taskService methods
|
|
5
|
-
*/
|
|
6
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.TaskManagementTool = void 0;
|
|
11
|
-
const types_1 = require("../types");
|
|
12
|
-
const base_tool_1 = require("../base-tool");
|
|
13
|
-
const task_1 = __importDefault(require("../../modules/task"));
|
|
14
|
-
class TaskManagementToolInvocation extends base_tool_1.BaseToolInvocation {
|
|
15
|
-
constructor(params) {
|
|
16
|
-
super(params);
|
|
17
|
-
}
|
|
18
|
-
async execute() {
|
|
19
|
-
var _a;
|
|
20
|
-
try {
|
|
21
|
-
const action = this.params.action;
|
|
22
|
-
let response;
|
|
23
|
-
let successMessage;
|
|
24
|
-
switch (action) {
|
|
25
|
-
case 'create':
|
|
26
|
-
if (!this.params.title) {
|
|
27
|
-
return this.createError("'title' is required for create action");
|
|
28
|
-
}
|
|
29
|
-
// CreateTaskOptions expects 'name' not 'title'
|
|
30
|
-
response = await task_1.default.createTask({
|
|
31
|
-
name: this.params.title,
|
|
32
|
-
description: this.params.description,
|
|
33
|
-
threadId: this.params.thread_id || '',
|
|
34
|
-
});
|
|
35
|
-
successMessage = `Created task: ${this.params.title}`;
|
|
36
|
-
break;
|
|
37
|
-
case 'update':
|
|
38
|
-
if (!this.params.task_id) {
|
|
39
|
-
return this.createError("'task_id' is required for update action");
|
|
40
|
-
}
|
|
41
|
-
// UpdateTaskOptions uses 'name' and 'completed'
|
|
42
|
-
response = await task_1.default.updateTask(this.params.task_id, {
|
|
43
|
-
name: this.params.description,
|
|
44
|
-
completed: this.params.status === 'completed',
|
|
45
|
-
});
|
|
46
|
-
successMessage = `Updated task: ${this.params.task_id}`;
|
|
47
|
-
break;
|
|
48
|
-
case 'delete':
|
|
49
|
-
if (!this.params.task_id) {
|
|
50
|
-
return this.createError("'task_id' is required for delete action");
|
|
51
|
-
}
|
|
52
|
-
response = await task_1.default.deleteTask(this.params.task_id);
|
|
53
|
-
successMessage = `Deleted task: ${this.params.task_id}`;
|
|
54
|
-
break;
|
|
55
|
-
case 'list':
|
|
56
|
-
response = await task_1.default.getTaskList({});
|
|
57
|
-
successMessage = 'Retrieved task list';
|
|
58
|
-
break;
|
|
59
|
-
case 'get':
|
|
60
|
-
if (!this.params.task_id) {
|
|
61
|
-
return this.createError("'task_id' is required for get action");
|
|
62
|
-
}
|
|
63
|
-
response = await task_1.default.getTaskDetail({ taskId: this.params.task_id });
|
|
64
|
-
successMessage = `Retrieved task: ${this.params.task_id}`;
|
|
65
|
-
break;
|
|
66
|
-
case 'assign_agent':
|
|
67
|
-
if (!this.params.task_id) {
|
|
68
|
-
return this.createError("'task_id' is required for assign_agent action");
|
|
69
|
-
}
|
|
70
|
-
if (!this.params.agent_id) {
|
|
71
|
-
return this.createError("'agent_id' is required for assign_agent action");
|
|
72
|
-
}
|
|
73
|
-
response = await task_1.default.assignAgentToTask(this.params.task_id, this.params.agent_id);
|
|
74
|
-
successMessage = `Assigned agent ${this.params.agent_id} to task ${this.params.task_id}`;
|
|
75
|
-
break;
|
|
76
|
-
case 'execute':
|
|
77
|
-
if (!this.params.task_id) {
|
|
78
|
-
return this.createError("'task_id' is required for execute action");
|
|
79
|
-
}
|
|
80
|
-
if (!this.params.agent_id) {
|
|
81
|
-
return this.createError("'agent_id' is required for execute action");
|
|
82
|
-
}
|
|
83
|
-
response = await task_1.default.executeTaskWithAgent(this.params.task_id, this.params.agent_id);
|
|
84
|
-
successMessage = `Executing task ${this.params.task_id} with agent ${this.params.agent_id}`;
|
|
85
|
-
break;
|
|
86
|
-
default:
|
|
87
|
-
return this.createError(`Unknown action: ${action}`);
|
|
88
|
-
}
|
|
89
|
-
// Check for errors
|
|
90
|
-
if (response && !response.success && response.success !== undefined) {
|
|
91
|
-
const errorMsg = typeof response.error === 'string'
|
|
92
|
-
? response.error
|
|
93
|
-
: ((_a = response.error) === null || _a === void 0 ? void 0 : _a.message) || 'Task operation failed';
|
|
94
|
-
return {
|
|
95
|
-
llmContent: `Task ${action} failed: ${errorMsg}`,
|
|
96
|
-
returnDisplay: `Error: ${errorMsg}`,
|
|
97
|
-
error: {
|
|
98
|
-
message: errorMsg,
|
|
99
|
-
type: types_1.ToolErrorType.TASK_NOT_FOUND,
|
|
100
|
-
},
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
// Format output
|
|
104
|
-
let output = successMessage;
|
|
105
|
-
if (action === 'list' && response.tasks) {
|
|
106
|
-
output += `\n\nTasks (${response.tasks.length}):\n`;
|
|
107
|
-
for (const task of response.tasks) {
|
|
108
|
-
output += `- [${task.status || 'pending'}] ${task.title || task.id}: ${task.description || ''}\n`;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
else if (action === 'get' && response.task) {
|
|
112
|
-
const task = response.task;
|
|
113
|
-
output += `\n\nTask Details:\n`;
|
|
114
|
-
output += `ID: ${task.id}\n`;
|
|
115
|
-
output += `Title: ${task.title}\n`;
|
|
116
|
-
output += `Description: ${task.description || 'N/A'}\n`;
|
|
117
|
-
output += `Status: ${task.status || 'pending'}\n`;
|
|
118
|
-
if (task.assignedTo)
|
|
119
|
-
output += `Assigned To: ${task.assignedTo}\n`;
|
|
120
|
-
}
|
|
121
|
-
else if (response.task) {
|
|
122
|
-
output += `\n\nTask ID: ${response.task.id || response.taskId}`;
|
|
123
|
-
}
|
|
124
|
-
else if (response.taskId) {
|
|
125
|
-
output += `\n\nTask ID: ${response.taskId}`;
|
|
126
|
-
}
|
|
127
|
-
return {
|
|
128
|
-
llmContent: output,
|
|
129
|
-
returnDisplay: successMessage,
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
catch (error) {
|
|
133
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
134
|
-
return {
|
|
135
|
-
llmContent: `Error executing task ${this.params.action}: ${errorMessage}`,
|
|
136
|
-
returnDisplay: `Error: ${errorMessage}`,
|
|
137
|
-
error: {
|
|
138
|
-
message: errorMessage,
|
|
139
|
-
type: types_1.ToolErrorType.EXECUTION_FAILED,
|
|
140
|
-
},
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
createError(message) {
|
|
145
|
-
return {
|
|
146
|
-
llmContent: `Error: ${message}`,
|
|
147
|
-
returnDisplay: `Error: ${message}`,
|
|
148
|
-
error: {
|
|
149
|
-
message,
|
|
150
|
-
type: types_1.ToolErrorType.INVALID_TOOL_PARAMS,
|
|
151
|
-
},
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Implementation of the TaskManagement tool logic
|
|
157
|
-
*/
|
|
158
|
-
class TaskManagementTool extends base_tool_1.BaseDeclarativeTool {
|
|
159
|
-
constructor() {
|
|
160
|
-
super(TaskManagementTool.Name, 'TaskManagement', `Manages tasks - create, update, delete, list, get, assign agents, and execute tasks. Use this for task scheduling and workflow management.`, types_1.Kind.Other, {
|
|
161
|
-
properties: {
|
|
162
|
-
action: {
|
|
163
|
-
description: "The task action: 'create', 'update', 'delete', 'list', 'get', 'assign_agent', or 'execute'.",
|
|
164
|
-
type: 'string',
|
|
165
|
-
enum: ['create', 'update', 'delete', 'list', 'get', 'assign_agent', 'execute'],
|
|
166
|
-
},
|
|
167
|
-
task_id: {
|
|
168
|
-
description: 'Task ID (required for update, delete, get, assign_agent, execute).',
|
|
169
|
-
type: 'string',
|
|
170
|
-
},
|
|
171
|
-
title: {
|
|
172
|
-
description: 'Task title (required for create).',
|
|
173
|
-
type: 'string',
|
|
174
|
-
},
|
|
175
|
-
description: {
|
|
176
|
-
description: 'Task description (for create/update).',
|
|
177
|
-
type: 'string',
|
|
178
|
-
},
|
|
179
|
-
status: {
|
|
180
|
-
description: 'Task status (for update).',
|
|
181
|
-
type: 'string',
|
|
182
|
-
},
|
|
183
|
-
agent_id: {
|
|
184
|
-
description: 'Agent ID (required for assign_agent/execute).',
|
|
185
|
-
type: 'string',
|
|
186
|
-
},
|
|
187
|
-
thread_id: {
|
|
188
|
-
description: 'Thread ID (for create).',
|
|
189
|
-
type: 'string',
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
required: ['action'],
|
|
193
|
-
type: 'object',
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
validateToolParamValues(params) {
|
|
197
|
-
const validActions = ['create', 'update', 'delete', 'list', 'get', 'assign_agent', 'execute'];
|
|
198
|
-
if (!validActions.includes(params.action)) {
|
|
199
|
-
return `Invalid action: ${params.action}. Must be one of: ${validActions.join(', ')}`;
|
|
200
|
-
}
|
|
201
|
-
switch (params.action) {
|
|
202
|
-
case 'create':
|
|
203
|
-
if (!params.title) {
|
|
204
|
-
return "'title' is required for create action";
|
|
205
|
-
}
|
|
206
|
-
break;
|
|
207
|
-
case 'update':
|
|
208
|
-
case 'delete':
|
|
209
|
-
case 'get':
|
|
210
|
-
if (!params.task_id) {
|
|
211
|
-
return `'task_id' is required for ${params.action} action`;
|
|
212
|
-
}
|
|
213
|
-
break;
|
|
214
|
-
case 'assign_agent':
|
|
215
|
-
case 'execute':
|
|
216
|
-
if (!params.task_id) {
|
|
217
|
-
return `'task_id' is required for ${params.action} action`;
|
|
218
|
-
}
|
|
219
|
-
if (!params.agent_id) {
|
|
220
|
-
return `'agent_id' is required for ${params.action} action`;
|
|
221
|
-
}
|
|
222
|
-
break;
|
|
223
|
-
}
|
|
224
|
-
return null;
|
|
225
|
-
}
|
|
226
|
-
createInvocation(params) {
|
|
227
|
-
return new TaskManagementToolInvocation(params);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
exports.TaskManagementTool = TaskManagementTool;
|
|
231
|
-
TaskManagementTool.Name = 'create_task';
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Task Update Tool - Updates an existing task
|
|
3
|
-
* Wraps the SDK's taskService.updateTask() method
|
|
4
|
-
*/
|
|
5
|
-
import type { ToolInvocation, ToolResult } from '../types';
|
|
6
|
-
import { BaseDeclarativeTool } from '../base-tool';
|
|
7
|
-
export interface TaskUpdateParams {
|
|
8
|
-
/** The task ID to update */
|
|
9
|
-
task_id: string;
|
|
10
|
-
/** New name for the task */
|
|
11
|
-
name?: string;
|
|
12
|
-
/** Whether the task is completed */
|
|
13
|
-
completed?: boolean;
|
|
14
|
-
/** Task status */
|
|
15
|
-
status?: string;
|
|
16
|
-
}
|
|
17
|
-
export declare class TaskUpdateTool extends BaseDeclarativeTool<TaskUpdateParams, ToolResult> {
|
|
18
|
-
static readonly Name: string;
|
|
19
|
-
constructor();
|
|
20
|
-
protected validateToolParamValues(params: TaskUpdateParams): string | null;
|
|
21
|
-
protected createInvocation(params: TaskUpdateParams): ToolInvocation<TaskUpdateParams, ToolResult>;
|
|
22
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Task Update Tool - Updates an existing task
|
|
4
|
-
* Wraps the SDK's taskService.updateTask() method
|
|
5
|
-
*/
|
|
6
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.TaskUpdateTool = void 0;
|
|
11
|
-
const types_1 = require("../types");
|
|
12
|
-
const base_tool_1 = require("../base-tool");
|
|
13
|
-
const task_1 = __importDefault(require("../../modules/task"));
|
|
14
|
-
class TaskUpdateInvocation extends base_tool_1.BaseToolInvocation {
|
|
15
|
-
constructor(params) {
|
|
16
|
-
super(params);
|
|
17
|
-
}
|
|
18
|
-
async execute() {
|
|
19
|
-
var _a;
|
|
20
|
-
try {
|
|
21
|
-
const updates = {};
|
|
22
|
-
if (this.params.name !== undefined)
|
|
23
|
-
updates.name = this.params.name;
|
|
24
|
-
if (this.params.completed !== undefined)
|
|
25
|
-
updates.completed = this.params.completed;
|
|
26
|
-
if (this.params.status !== undefined)
|
|
27
|
-
updates.completed = this.params.status === 'completed';
|
|
28
|
-
const response = await task_1.default.updateTask(this.params.task_id, updates);
|
|
29
|
-
if (response && !response.success && response.success !== undefined) {
|
|
30
|
-
const errorMsg = typeof response.error === 'string'
|
|
31
|
-
? response.error
|
|
32
|
-
: ((_a = response.error) === null || _a === void 0 ? void 0 : _a.message) || 'Task update failed';
|
|
33
|
-
return {
|
|
34
|
-
llmContent: `Task update failed: ${errorMsg}`,
|
|
35
|
-
returnDisplay: `Error: ${errorMsg}`,
|
|
36
|
-
error: {
|
|
37
|
-
message: errorMsg,
|
|
38
|
-
type: types_1.ToolErrorType.TASK_NOT_FOUND,
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
return {
|
|
43
|
-
llmContent: `Updated task: ${this.params.task_id}`,
|
|
44
|
-
returnDisplay: `Updated task: ${this.params.task_id}`,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
49
|
-
return {
|
|
50
|
-
llmContent: `Error updating task: ${errorMessage}`,
|
|
51
|
-
returnDisplay: `Error: ${errorMessage}`,
|
|
52
|
-
error: {
|
|
53
|
-
message: errorMessage,
|
|
54
|
-
type: types_1.ToolErrorType.EXECUTION_FAILED,
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
class TaskUpdateTool extends base_tool_1.BaseDeclarativeTool {
|
|
61
|
-
constructor() {
|
|
62
|
-
super(TaskUpdateTool.Name, 'TaskUpdate', 'Updates an existing task.', types_1.Kind.Other, {
|
|
63
|
-
properties: {
|
|
64
|
-
task_id: {
|
|
65
|
-
description: 'The ID of the task to update.',
|
|
66
|
-
type: 'string',
|
|
67
|
-
},
|
|
68
|
-
name: {
|
|
69
|
-
description: 'New name for the task.',
|
|
70
|
-
type: 'string',
|
|
71
|
-
},
|
|
72
|
-
completed: {
|
|
73
|
-
description: 'Whether the task is completed.',
|
|
74
|
-
type: 'boolean',
|
|
75
|
-
},
|
|
76
|
-
status: {
|
|
77
|
-
description: "Task status (e.g., 'completed', 'pending').",
|
|
78
|
-
type: 'string',
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
required: ['task_id'],
|
|
82
|
-
type: 'object',
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
validateToolParamValues(params) {
|
|
86
|
-
if (!params.task_id || params.task_id.trim() === '') {
|
|
87
|
-
return "'task_id' is required for task update";
|
|
88
|
-
}
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
createInvocation(params) {
|
|
92
|
-
return new TaskUpdateInvocation(params);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
exports.TaskUpdateTool = TaskUpdateTool;
|
|
96
|
-
TaskUpdateTool.Name = 'task_update';
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Thread Create Background Tool - Creates a thread in the background
|
|
3
|
-
* Wraps the SDK's threadService.createThreadInBackground() method
|
|
4
|
-
*/
|
|
5
|
-
import type { ToolInvocation, ToolResult } from '../types';
|
|
6
|
-
import { BaseDeclarativeTool } from '../base-tool';
|
|
7
|
-
export interface ThreadCreateBackgroundParams {
|
|
8
|
-
/** Thread creation options */
|
|
9
|
-
options: Record<string, any>;
|
|
10
|
-
/** Optional group ID for the thread */
|
|
11
|
-
groupId?: string;
|
|
12
|
-
}
|
|
13
|
-
export declare class ThreadCreateBackgroundTool extends BaseDeclarativeTool<ThreadCreateBackgroundParams, ToolResult> {
|
|
14
|
-
static readonly Name: string;
|
|
15
|
-
constructor();
|
|
16
|
-
protected validateToolParamValues(params: ThreadCreateBackgroundParams): string | null;
|
|
17
|
-
protected createInvocation(params: ThreadCreateBackgroundParams): ToolInvocation<ThreadCreateBackgroundParams, ToolResult>;
|
|
18
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Thread Create Background Tool - Creates a thread in the background
|
|
4
|
-
* Wraps the SDK's threadService.createThreadInBackground() method
|
|
5
|
-
*/
|
|
6
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.ThreadCreateBackgroundTool = void 0;
|
|
11
|
-
const types_1 = require("../types");
|
|
12
|
-
const base_tool_1 = require("../base-tool");
|
|
13
|
-
const thread_1 = __importDefault(require("../../modules/thread"));
|
|
14
|
-
class ThreadCreateBackgroundInvocation extends base_tool_1.BaseToolInvocation {
|
|
15
|
-
constructor(params) {
|
|
16
|
-
super(params);
|
|
17
|
-
}
|
|
18
|
-
async execute() {
|
|
19
|
-
var _a;
|
|
20
|
-
try {
|
|
21
|
-
// Include groupId in options if provided
|
|
22
|
-
const optionsWithGroup = {
|
|
23
|
-
...this.params.options,
|
|
24
|
-
groupId: this.params.groupId,
|
|
25
|
-
};
|
|
26
|
-
const response = await thread_1.default.createThreadInBackground(optionsWithGroup);
|
|
27
|
-
if (response && !response.success && response.success !== undefined) {
|
|
28
|
-
const errorMsg = typeof response.error === 'string'
|
|
29
|
-
? response.error
|
|
30
|
-
: ((_a = response.error) === null || _a === void 0 ? void 0 : _a.message) || 'Thread creation in background failed';
|
|
31
|
-
return {
|
|
32
|
-
llmContent: `Thread creation in background failed: ${errorMsg}`,
|
|
33
|
-
returnDisplay: `Error: ${errorMsg}`,
|
|
34
|
-
error: {
|
|
35
|
-
message: errorMsg,
|
|
36
|
-
type: types_1.ToolErrorType.EXECUTION_FAILED,
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
const resp = response;
|
|
41
|
-
let output = 'Created thread in background successfully';
|
|
42
|
-
if (resp.threadId) {
|
|
43
|
-
output += `\n\nThread ID: ${resp.threadId}`;
|
|
44
|
-
}
|
|
45
|
-
if (this.params.groupId) {
|
|
46
|
-
output += `\nGroup ID: ${this.params.groupId}`;
|
|
47
|
-
}
|
|
48
|
-
return {
|
|
49
|
-
llmContent: output,
|
|
50
|
-
returnDisplay: 'Thread created in background successfully',
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
catch (error) {
|
|
54
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
55
|
-
return {
|
|
56
|
-
llmContent: `Error creating thread in background: ${errorMessage}`,
|
|
57
|
-
returnDisplay: `Error: ${errorMessage}`,
|
|
58
|
-
error: {
|
|
59
|
-
message: errorMessage,
|
|
60
|
-
type: types_1.ToolErrorType.EXECUTION_FAILED,
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
class ThreadCreateBackgroundTool extends base_tool_1.BaseDeclarativeTool {
|
|
67
|
-
constructor() {
|
|
68
|
-
super(ThreadCreateBackgroundTool.Name, 'ThreadCreateBackground', 'Creates a thread in the background and resolves when the agent starts or fails.', types_1.Kind.Execute, {
|
|
69
|
-
properties: {
|
|
70
|
-
options: {
|
|
71
|
-
description: 'Thread creation options object containing thread parameters.',
|
|
72
|
-
type: 'object',
|
|
73
|
-
},
|
|
74
|
-
groupId: {
|
|
75
|
-
description: 'Optional group ID for organizing threads.',
|
|
76
|
-
type: 'string',
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
required: ['options'],
|
|
80
|
-
type: 'object',
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
validateToolParamValues(params) {
|
|
84
|
-
if (!params.options || typeof params.options !== 'object') {
|
|
85
|
-
return "'options' is required and must be an object";
|
|
86
|
-
}
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
createInvocation(params) {
|
|
90
|
-
return new ThreadCreateBackgroundInvocation(params);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
exports.ThreadCreateBackgroundTool = ThreadCreateBackgroundTool;
|
|
94
|
-
ThreadCreateBackgroundTool.Name = 'thread_create_background';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Thread Create Start Tool - Creates and immediately starts a new thread
|
|
3
|
-
* Wraps the SDK's threadService.createAndStartThread() method
|
|
4
|
-
*/
|
|
5
|
-
import type { ToolInvocation, ToolResult } from '../types';
|
|
6
|
-
import { BaseDeclarativeTool } from '../base-tool';
|
|
7
|
-
export interface ThreadCreateStartParams {
|
|
8
|
-
/** Thread creation and start options */
|
|
9
|
-
options: Record<string, any>;
|
|
10
|
-
}
|
|
11
|
-
export declare class ThreadCreateStartTool extends BaseDeclarativeTool<ThreadCreateStartParams, ToolResult> {
|
|
12
|
-
static readonly Name: string;
|
|
13
|
-
constructor();
|
|
14
|
-
protected validateToolParamValues(params: ThreadCreateStartParams): string | null;
|
|
15
|
-
protected createInvocation(params: ThreadCreateStartParams): ToolInvocation<ThreadCreateStartParams, ToolResult>;
|
|
16
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Thread Create Start Tool - Creates and immediately starts a new thread
|
|
4
|
-
* Wraps the SDK's threadService.createAndStartThread() method
|
|
5
|
-
*/
|
|
6
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.ThreadCreateStartTool = void 0;
|
|
11
|
-
const types_1 = require("../types");
|
|
12
|
-
const base_tool_1 = require("../base-tool");
|
|
13
|
-
const thread_1 = __importDefault(require("../../modules/thread"));
|
|
14
|
-
class ThreadCreateStartInvocation extends base_tool_1.BaseToolInvocation {
|
|
15
|
-
constructor(params) {
|
|
16
|
-
super(params);
|
|
17
|
-
}
|
|
18
|
-
async execute() {
|
|
19
|
-
var _a;
|
|
20
|
-
try {
|
|
21
|
-
const response = await thread_1.default.createAndStartThread(this.params.options);
|
|
22
|
-
if (response && !response.success && response.success !== undefined) {
|
|
23
|
-
const errorMsg = typeof response.error === 'string'
|
|
24
|
-
? response.error
|
|
25
|
-
: ((_a = response.error) === null || _a === void 0 ? void 0 : _a.message) || 'Thread creation and start failed';
|
|
26
|
-
return {
|
|
27
|
-
llmContent: `Thread creation and start failed: ${errorMsg}`,
|
|
28
|
-
returnDisplay: `Error: ${errorMsg}`,
|
|
29
|
-
error: {
|
|
30
|
-
message: errorMsg,
|
|
31
|
-
type: types_1.ToolErrorType.EXECUTION_FAILED,
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
const resp = response;
|
|
36
|
-
let output = 'Created and started thread successfully';
|
|
37
|
-
if (resp.threadId) {
|
|
38
|
-
output += `\n\nThread ID: ${resp.threadId}`;
|
|
39
|
-
}
|
|
40
|
-
if (resp.thread) {
|
|
41
|
-
output += `\n\nThread: ${JSON.stringify(resp.thread, null, 2)}`;
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
llmContent: output,
|
|
45
|
-
returnDisplay: 'Thread created and started successfully',
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
50
|
-
return {
|
|
51
|
-
llmContent: `Error creating and starting thread: ${errorMessage}`,
|
|
52
|
-
returnDisplay: `Error: ${errorMessage}`,
|
|
53
|
-
error: {
|
|
54
|
-
message: errorMessage,
|
|
55
|
-
type: types_1.ToolErrorType.EXECUTION_FAILED,
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
class ThreadCreateStartTool extends base_tool_1.BaseDeclarativeTool {
|
|
62
|
-
constructor() {
|
|
63
|
-
super(ThreadCreateStartTool.Name, 'ThreadCreateStart', 'Creates and immediately starts a new thread with the specified options.', types_1.Kind.Execute, {
|
|
64
|
-
properties: {
|
|
65
|
-
options: {
|
|
66
|
-
description: 'Thread creation and start options object containing thread parameters.',
|
|
67
|
-
type: 'object',
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
required: ['options'],
|
|
71
|
-
type: 'object',
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
validateToolParamValues(params) {
|
|
75
|
-
if (!params.options || typeof params.options !== 'object') {
|
|
76
|
-
return "'options' is required and must be an object";
|
|
77
|
-
}
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
createInvocation(params) {
|
|
81
|
-
return new ThreadCreateStartInvocation(params);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
exports.ThreadCreateStartTool = ThreadCreateStartTool;
|
|
85
|
-
ThreadCreateStartTool.Name = 'thread_create_start';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Thread Create Tool - Creates a new thread
|
|
3
|
-
* Wraps the SDK's threadService.createThread() method
|
|
4
|
-
*/
|
|
5
|
-
import type { ToolInvocation, ToolResult } from '../types';
|
|
6
|
-
import { BaseDeclarativeTool } from '../base-tool';
|
|
7
|
-
export interface ThreadCreateParams {
|
|
8
|
-
/** Thread creation options */
|
|
9
|
-
options: Record<string, any>;
|
|
10
|
-
}
|
|
11
|
-
export declare class ThreadCreateTool extends BaseDeclarativeTool<ThreadCreateParams, ToolResult> {
|
|
12
|
-
static readonly Name: string;
|
|
13
|
-
constructor();
|
|
14
|
-
protected validateToolParamValues(params: ThreadCreateParams): string | null;
|
|
15
|
-
protected createInvocation(params: ThreadCreateParams): ToolInvocation<ThreadCreateParams, ToolResult>;
|
|
16
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Thread Create Tool - Creates a new thread
|
|
4
|
-
* Wraps the SDK's threadService.createThread() method
|
|
5
|
-
*/
|
|
6
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.ThreadCreateTool = void 0;
|
|
11
|
-
const types_1 = require("../types");
|
|
12
|
-
const base_tool_1 = require("../base-tool");
|
|
13
|
-
const thread_1 = __importDefault(require("../../modules/thread"));
|
|
14
|
-
class ThreadCreateInvocation extends base_tool_1.BaseToolInvocation {
|
|
15
|
-
constructor(params) {
|
|
16
|
-
super(params);
|
|
17
|
-
}
|
|
18
|
-
async execute() {
|
|
19
|
-
var _a;
|
|
20
|
-
try {
|
|
21
|
-
const response = await thread_1.default.createThread(this.params.options);
|
|
22
|
-
if (response && !response.success && response.success !== undefined) {
|
|
23
|
-
const errorMsg = typeof response.error === 'string'
|
|
24
|
-
? response.error
|
|
25
|
-
: ((_a = response.error) === null || _a === void 0 ? void 0 : _a.message) || 'Thread creation failed';
|
|
26
|
-
return {
|
|
27
|
-
llmContent: `Thread creation failed: ${errorMsg}`,
|
|
28
|
-
returnDisplay: `Error: ${errorMsg}`,
|
|
29
|
-
error: {
|
|
30
|
-
message: errorMsg,
|
|
31
|
-
type: types_1.ToolErrorType.EXECUTION_FAILED,
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
const resp = response;
|
|
36
|
-
let output = 'Created thread successfully';
|
|
37
|
-
if (resp.threadId) {
|
|
38
|
-
output += `\n\nThread ID: ${resp.threadId}`;
|
|
39
|
-
}
|
|
40
|
-
if (resp.thread) {
|
|
41
|
-
output += `\n\nThread: ${JSON.stringify(resp.thread, null, 2)}`;
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
llmContent: output,
|
|
45
|
-
returnDisplay: 'Thread created successfully',
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
50
|
-
return {
|
|
51
|
-
llmContent: `Error creating thread: ${errorMessage}`,
|
|
52
|
-
returnDisplay: `Error: ${errorMessage}`,
|
|
53
|
-
error: {
|
|
54
|
-
message: errorMessage,
|
|
55
|
-
type: types_1.ToolErrorType.EXECUTION_FAILED,
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
class ThreadCreateTool extends base_tool_1.BaseDeclarativeTool {
|
|
62
|
-
constructor() {
|
|
63
|
-
super(ThreadCreateTool.Name, 'ThreadCreate', 'Creates a new thread with the specified options.', types_1.Kind.Edit, {
|
|
64
|
-
properties: {
|
|
65
|
-
options: {
|
|
66
|
-
description: 'Thread creation options object containing thread parameters.',
|
|
67
|
-
type: 'object',
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
required: ['options'],
|
|
71
|
-
type: 'object',
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
validateToolParamValues(params) {
|
|
75
|
-
if (!params.options || typeof params.options !== 'object') {
|
|
76
|
-
return "'options' is required and must be an object";
|
|
77
|
-
}
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
createInvocation(params) {
|
|
81
|
-
return new ThreadCreateInvocation(params);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
exports.ThreadCreateTool = ThreadCreateTool;
|
|
85
|
-
ThreadCreateTool.Name = 'thread_create';
|