@codebolt/codeboltjs 5.0.7 → 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.
Files changed (154) hide show
  1. package/dist/core/Codebolt.d.ts +331 -303
  2. package/dist/core/Codebolt.js +58 -0
  3. package/dist/core/websocket.js +15 -17
  4. package/dist/index.d.ts +67 -29
  5. package/dist/index.js +124 -9
  6. package/dist/modules/agentDeliberation.d.ts +1 -1
  7. package/dist/modules/agentDeliberation.js +9 -9
  8. package/dist/modules/agentEventQueue.d.ts +3 -3
  9. package/dist/modules/agentEventQueue.js +4 -4
  10. package/dist/modules/autoTesting.d.ts +1 -1
  11. package/dist/modules/autoTesting.js +19 -19
  12. package/dist/modules/backgroundChildThreads.js +22 -4
  13. package/dist/modules/codebaseSearch.d.ts +1 -1
  14. package/dist/modules/codemap.d.ts +1 -1
  15. package/dist/modules/contextAssembly.d.ts +1 -1
  16. package/dist/modules/contextRuleEngine.d.ts +1 -1
  17. package/dist/modules/dynamicPanel.d.ts +106 -0
  18. package/dist/modules/dynamicPanel.js +122 -0
  19. package/dist/modules/eventLog.d.ts +1 -1
  20. package/dist/modules/fileUpdateIntent.d.ts +1 -1
  21. package/dist/modules/groupFeedback.d.ts +2 -2
  22. package/dist/modules/groupFeedback.js +8 -8
  23. package/dist/modules/hook.d.ts +1 -1
  24. package/dist/modules/job.d.ts +1 -1
  25. package/dist/modules/knowledgeGraph.d.ts +1 -1
  26. package/dist/modules/kvStore.d.ts +1 -1
  27. package/dist/modules/mcp.js +6 -3
  28. package/dist/modules/memoryIngestion.d.ts +1 -1
  29. package/dist/modules/orchestrator.js +1 -1
  30. package/dist/modules/persistentMemory.d.ts +1 -1
  31. package/dist/modules/projectStructure.d.ts +1 -1
  32. package/dist/modules/projectStructureUpdateRequest.d.ts +1 -1
  33. package/dist/modules/reviewMergeRequest.d.ts +6 -2
  34. package/dist/modules/roadmap.d.ts +1 -1
  35. package/dist/modules/swarm.d.ts +8 -2
  36. package/dist/modules/swarm.js +14 -0
  37. package/dist/modules/user-message-manager.js +4 -4
  38. package/dist/tools/actionBlock/action-block-start.js +1 -4
  39. package/dist/tools/actionPlan/action-plan-create.js +1 -2
  40. package/dist/tools/completion/attempt-completion.d.ts +25 -0
  41. package/dist/tools/completion/attempt-completion.js +45 -0
  42. package/dist/tools/completion/index.d.ts +3 -0
  43. package/dist/tools/completion/index.js +9 -0
  44. package/dist/tools/index.d.ts +6 -3
  45. package/dist/tools/index.js +59 -57
  46. package/dist/tools/job/index.d.ts +3 -1
  47. package/dist/tools/job/index.js +5 -1
  48. package/dist/tools/job/job-remove-dependency.d.ts +28 -0
  49. package/dist/tools/job/job-remove-dependency.js +86 -0
  50. package/dist/tools/requirementPlan/requirement-plan-add-section.js +1 -1
  51. package/dist/tools/requirementPlan/requirement-plan-review.js +1 -1
  52. package/dist/tools/review/review-create.js +1 -1
  53. package/dist/tools/reviewMergeRequest/rmr-create.js +3 -2
  54. package/dist/tools/thread/thread-create-background.js +1 -1
  55. package/dist/tools/utils/schema-validator.d.ts +1 -0
  56. package/dist/tools/utils/schema-validator.js +13 -1
  57. package/dist/types/job.d.ts +1 -1
  58. package/package.json +2 -2
  59. package/dist/modules/codeboltEvent.d.ts +0 -57
  60. package/dist/modules/codeboltEvent.js +0 -217
  61. package/dist/tools/browser/browser-action.d.ts +0 -56
  62. package/dist/tools/browser/browser-action.js +0 -265
  63. package/dist/tools/codeboltEvent/event-add-running-agent.d.ts +0 -25
  64. package/dist/tools/codeboltEvent/event-add-running-agent.js +0 -69
  65. package/dist/tools/codeboltEvent/event-check-background-agent-completion.d.ts +0 -19
  66. package/dist/tools/codeboltEvent/event-check-background-agent-completion.js +0 -64
  67. package/dist/tools/codeboltEvent/event-get-running-agent-count.d.ts +0 -19
  68. package/dist/tools/codeboltEvent/event-get-running-agent-count.js +0 -55
  69. package/dist/tools/codeboltEvent/event-on-background-agent-completion.d.ts +0 -19
  70. package/dist/tools/codeboltEvent/event-on-background-agent-completion.js +0 -56
  71. package/dist/tools/codeboltEvent/event-wait-for-external-event.d.ts +0 -19
  72. package/dist/tools/codeboltEvent/event-wait-for-external-event.js +0 -55
  73. package/dist/tools/codeboltEvent/index.d.ts +0 -19
  74. package/dist/tools/codeboltEvent/index.js +0 -33
  75. package/dist/tools/event/event-add-running-agent.d.ts +0 -32
  76. package/dist/tools/event/event-add-running-agent.js +0 -77
  77. package/dist/tools/event/event-check-agent-event.d.ts +0 -19
  78. package/dist/tools/event/event-check-agent-event.js +0 -63
  79. package/dist/tools/event/event-check-completion.d.ts +0 -19
  80. package/dist/tools/event/event-check-completion.js +0 -73
  81. package/dist/tools/event/event-check-grouped-completion.d.ts +0 -19
  82. package/dist/tools/event/event-check-grouped-completion.js +0 -63
  83. package/dist/tools/event/event-get-running-count.d.ts +0 -19
  84. package/dist/tools/event/event-get-running-count.js +0 -55
  85. package/dist/tools/event/event-on-agent-event.d.ts +0 -19
  86. package/dist/tools/event/event-on-agent-event.js +0 -63
  87. package/dist/tools/event/event-on-completion.d.ts +0 -19
  88. package/dist/tools/event/event-on-completion.js +0 -73
  89. package/dist/tools/event/event-on-grouped-completion.d.ts +0 -19
  90. package/dist/tools/event/event-on-grouped-completion.js +0 -63
  91. package/dist/tools/event/event-wait-any.d.ts +0 -19
  92. package/dist/tools/event/event-wait-any.js +0 -66
  93. package/dist/tools/event/index.d.ts +0 -25
  94. package/dist/tools/event/index.js +0 -48
  95. package/dist/tools/git/git-action.d.ts +0 -48
  96. package/dist/tools/git/git-action.js +0 -279
  97. package/dist/tools/kvStore/kv-store-create-instance.d.ts +0 -26
  98. package/dist/tools/kvStore/kv-store-create-instance.js +0 -79
  99. package/dist/tools/kvStore/kv-store-get.d.ts +0 -30
  100. package/dist/tools/kvStore/kv-store-get.js +0 -80
  101. package/dist/tools/kvStore/kv-store-set.d.ts +0 -38
  102. package/dist/tools/kvStore/kv-store-set.js +0 -86
  103. package/dist/tools/memoryIngestion/mi-create-pipeline.d.ts +0 -44
  104. package/dist/tools/memoryIngestion/mi-create-pipeline.js +0 -114
  105. package/dist/tools/memoryIngestion/mi-list.d.ts +0 -22
  106. package/dist/tools/memoryIngestion/mi-list.js +0 -66
  107. package/dist/tools/orchestration/agent-details.d.ts +0 -15
  108. package/dist/tools/orchestration/agent-details.js +0 -98
  109. package/dist/tools/orchestration/agent-find.d.ts +0 -18
  110. package/dist/tools/orchestration/agent-find.js +0 -125
  111. package/dist/tools/orchestration/agent-list.d.ts +0 -13
  112. package/dist/tools/orchestration/agent-list.js +0 -106
  113. package/dist/tools/orchestration/agent-management.d.ts +0 -44
  114. package/dist/tools/orchestration/agent-management.js +0 -250
  115. package/dist/tools/orchestration/agent-start.d.ts +0 -18
  116. package/dist/tools/orchestration/agent-start.js +0 -90
  117. package/dist/tools/orchestration/index.d.ts +0 -49
  118. package/dist/tools/orchestration/index.js +0 -102
  119. package/dist/tools/orchestration/task-assign.d.ts +0 -18
  120. package/dist/tools/orchestration/task-assign.js +0 -84
  121. package/dist/tools/orchestration/task-create.d.ts +0 -20
  122. package/dist/tools/orchestration/task-create.js +0 -97
  123. package/dist/tools/orchestration/task-delete.d.ts +0 -16
  124. package/dist/tools/orchestration/task-delete.js +0 -77
  125. package/dist/tools/orchestration/task-execute.d.ts +0 -18
  126. package/dist/tools/orchestration/task-execute.js +0 -84
  127. package/dist/tools/orchestration/task-get.d.ts +0 -16
  128. package/dist/tools/orchestration/task-get.js +0 -89
  129. package/dist/tools/orchestration/task-list.d.ts +0 -13
  130. package/dist/tools/orchestration/task-list.js +0 -74
  131. package/dist/tools/orchestration/task-management.d.ts +0 -52
  132. package/dist/tools/orchestration/task-management.js +0 -231
  133. package/dist/tools/orchestration/task-update.d.ts +0 -22
  134. package/dist/tools/orchestration/task-update.js +0 -96
  135. package/dist/tools/orchestration/thread-create-background.d.ts +0 -18
  136. package/dist/tools/orchestration/thread-create-background.js +0 -94
  137. package/dist/tools/orchestration/thread-create-start.d.ts +0 -16
  138. package/dist/tools/orchestration/thread-create-start.js +0 -85
  139. package/dist/tools/orchestration/thread-create.d.ts +0 -16
  140. package/dist/tools/orchestration/thread-create.js +0 -85
  141. package/dist/tools/orchestration/thread-delete.d.ts +0 -16
  142. package/dist/tools/orchestration/thread-delete.js +0 -77
  143. package/dist/tools/orchestration/thread-get-messages.d.ts +0 -24
  144. package/dist/tools/orchestration/thread-get-messages.js +0 -122
  145. package/dist/tools/orchestration/thread-get.d.ts +0 -16
  146. package/dist/tools/orchestration/thread-get.js +0 -85
  147. package/dist/tools/orchestration/thread-list.d.ts +0 -16
  148. package/dist/tools/orchestration/thread-list.js +0 -85
  149. package/dist/tools/orchestration/thread-start.d.ts +0 -16
  150. package/dist/tools/orchestration/thread-start.js +0 -82
  151. package/dist/tools/orchestration/thread-update-status.d.ts +0 -18
  152. package/dist/tools/orchestration/thread-update-status.js +0 -89
  153. package/dist/tools/orchestration/thread-update.d.ts +0 -18
  154. package/dist/tools/orchestration/thread-update.js +0 -89
@@ -1,89 +0,0 @@
1
- "use strict";
2
- /**
3
- * Task Get Tool - Gets details of a specific task
4
- * Wraps the SDK's taskService.getTaskDetail() 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.TaskGetTool = 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 TaskGetInvocation extends base_tool_1.BaseToolInvocation {
15
- constructor(params) {
16
- super(params);
17
- }
18
- async execute() {
19
- var _a;
20
- try {
21
- const response = await task_1.default.getTaskDetail({ taskId: this.params.task_id });
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) || 'Task retrieval failed';
26
- return {
27
- llmContent: `Task retrieval failed: ${errorMsg}`,
28
- returnDisplay: `Error: ${errorMsg}`,
29
- error: {
30
- message: errorMsg,
31
- type: types_1.ToolErrorType.TASK_NOT_FOUND,
32
- },
33
- };
34
- }
35
- let output = `Retrieved task: ${this.params.task_id}`;
36
- const resp = response;
37
- if (resp.task) {
38
- const task = resp.task;
39
- output += `\n\nTask Details:\n`;
40
- output += `ID: ${task.id}\n`;
41
- output += `Title: ${task.title || task.name || 'N/A'}\n`;
42
- output += `Description: ${task.description || 'N/A'}\n`;
43
- output += `Status: ${task.status || 'pending'}\n`;
44
- if (task.assignedTo)
45
- output += `Assigned To: ${task.assignedTo}\n`;
46
- }
47
- return {
48
- llmContent: output,
49
- returnDisplay: `Retrieved task: ${this.params.task_id}`,
50
- };
51
- }
52
- catch (error) {
53
- const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
54
- return {
55
- llmContent: `Error getting task: ${errorMessage}`,
56
- returnDisplay: `Error: ${errorMessage}`,
57
- error: {
58
- message: errorMessage,
59
- type: types_1.ToolErrorType.EXECUTION_FAILED,
60
- },
61
- };
62
- }
63
- }
64
- }
65
- class TaskGetTool extends base_tool_1.BaseDeclarativeTool {
66
- constructor() {
67
- super(TaskGetTool.Name, 'TaskGet', 'Retrieves details of a specific task.', types_1.Kind.Read, {
68
- properties: {
69
- task_id: {
70
- description: 'The ID of the task to retrieve.',
71
- type: 'string',
72
- },
73
- },
74
- required: ['task_id'],
75
- type: 'object',
76
- });
77
- }
78
- validateToolParamValues(params) {
79
- if (!params.task_id || params.task_id.trim() === '') {
80
- return "'task_id' is required for task get";
81
- }
82
- return null;
83
- }
84
- createInvocation(params) {
85
- return new TaskGetInvocation(params);
86
- }
87
- }
88
- exports.TaskGetTool = TaskGetTool;
89
- TaskGetTool.Name = 'task_get';
@@ -1,13 +0,0 @@
1
- /**
2
- * Task List Tool - Lists all tasks
3
- * Wraps the SDK's taskService.getTaskList() method
4
- */
5
- import type { ToolInvocation, ToolResult } from '../types';
6
- import { BaseDeclarativeTool } from '../base-tool';
7
- export interface TaskListParams {
8
- }
9
- export declare class TaskListTool extends BaseDeclarativeTool<TaskListParams, ToolResult> {
10
- static readonly Name: string;
11
- constructor();
12
- protected createInvocation(params: TaskListParams): ToolInvocation<TaskListParams, ToolResult>;
13
- }
@@ -1,74 +0,0 @@
1
- "use strict";
2
- /**
3
- * Task List Tool - Lists all tasks
4
- * Wraps the SDK's taskService.getTaskList() 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.TaskListTool = 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 TaskListInvocation extends base_tool_1.BaseToolInvocation {
15
- constructor(params) {
16
- super(params);
17
- }
18
- async execute() {
19
- var _a;
20
- try {
21
- const response = await task_1.default.getTaskList({});
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) || 'Task list retrieval failed';
26
- return {
27
- llmContent: `Task list retrieval failed: ${errorMsg}`,
28
- returnDisplay: `Error: ${errorMsg}`,
29
- error: {
30
- message: errorMsg,
31
- type: types_1.ToolErrorType.EXECUTION_FAILED,
32
- },
33
- };
34
- }
35
- let output = 'Retrieved task list';
36
- const resp = response;
37
- if (resp.tasks) {
38
- output += `\n\nTasks (${resp.tasks.length}):\n`;
39
- for (const task of resp.tasks) {
40
- output += `- [${task.status || 'pending'}] ${task.title || task.name || task.id}: ${task.description || ''}\n`;
41
- }
42
- }
43
- return {
44
- llmContent: output,
45
- returnDisplay: 'Retrieved task list',
46
- };
47
- }
48
- catch (error) {
49
- const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
50
- return {
51
- llmContent: `Error listing tasks: ${errorMessage}`,
52
- returnDisplay: `Error: ${errorMessage}`,
53
- error: {
54
- message: errorMessage,
55
- type: types_1.ToolErrorType.EXECUTION_FAILED,
56
- },
57
- };
58
- }
59
- }
60
- }
61
- class TaskListTool extends base_tool_1.BaseDeclarativeTool {
62
- constructor() {
63
- super(TaskListTool.Name, 'TaskList', 'Retrieves a list of all tasks.', types_1.Kind.Read, {
64
- properties: {},
65
- required: [],
66
- type: 'object',
67
- });
68
- }
69
- createInvocation(params) {
70
- return new TaskListInvocation(params);
71
- }
72
- }
73
- exports.TaskListTool = TaskListTool;
74
- TaskListTool.Name = 'task_list';
@@ -1,52 +0,0 @@
1
- /**
2
- * Task Management Tool - Manages tasks
3
- * Wraps the SDK's taskService methods
4
- */
5
- import type { ToolInvocation, ToolResult } from '../types';
6
- import { BaseDeclarativeTool } from '../base-tool';
7
- /**
8
- * Supported task actions
9
- */
10
- export type TaskActionType = 'create' | 'update' | 'delete' | 'list' | 'get' | 'assign_agent' | 'execute';
11
- /**
12
- * Parameters for the TaskManagement tool
13
- */
14
- export interface TaskManagementToolParams {
15
- /**
16
- * The task action to perform
17
- */
18
- action: TaskActionType;
19
- /**
20
- * Task ID (required for update, delete, get, assign_agent, execute)
21
- */
22
- task_id?: string;
23
- /**
24
- * Task title (for create)
25
- */
26
- title?: string;
27
- /**
28
- * Task description (for create/update)
29
- */
30
- description?: string;
31
- /**
32
- * Task status (for update)
33
- */
34
- status?: string;
35
- /**
36
- * Agent ID (for assign_agent/execute)
37
- */
38
- agent_id?: string;
39
- /**
40
- * Thread ID (for create)
41
- */
42
- thread_id?: string;
43
- }
44
- /**
45
- * Implementation of the TaskManagement tool logic
46
- */
47
- export declare class TaskManagementTool extends BaseDeclarativeTool<TaskManagementToolParams, ToolResult> {
48
- static readonly Name: string;
49
- constructor();
50
- protected validateToolParamValues(params: TaskManagementToolParams): string | null;
51
- protected createInvocation(params: TaskManagementToolParams): ToolInvocation<TaskManagementToolParams, ToolResult>;
52
- }
@@ -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
- }