@codebolt/codeboltjs 2.2.1 → 2.2.2

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 (70) hide show
  1. package/Readme.md +3 -0
  2. package/dist/core/Codebolt.d.ts +179 -166
  3. package/dist/core/Codebolt.js +224 -7
  4. package/dist/core/websocket.js +9 -11
  5. package/dist/index.d.ts +1 -1
  6. package/dist/modules/agent.d.ts +2 -16
  7. package/dist/modules/agent.js +15 -33
  8. package/dist/modules/browser.d.ts +1 -1
  9. package/dist/modules/browser.js +52 -51
  10. package/dist/modules/chat.d.ts +2 -2
  11. package/dist/modules/chat.js +20 -18
  12. package/dist/modules/codeutils.d.ts +1 -9
  13. package/dist/modules/codeutils.js +13 -111
  14. package/dist/modules/dbmemory.d.ts +3 -3
  15. package/dist/modules/dbmemory.js +8 -7
  16. package/dist/modules/debug.d.ts +1 -1
  17. package/dist/modules/fs.d.ts +59 -28
  18. package/dist/modules/fs.js +86 -45
  19. package/dist/modules/git.d.ts +1 -1
  20. package/dist/modules/git.js +31 -30
  21. package/dist/modules/history.d.ts +1 -1
  22. package/dist/modules/history.js +7 -6
  23. package/dist/modules/llm.d.ts +13 -20
  24. package/dist/modules/llm.js +16 -15
  25. package/dist/modules/mcp.d.ts +4 -4
  26. package/dist/modules/mcp.js +25 -25
  27. package/dist/modules/outputparsers.d.ts +22 -22
  28. package/dist/modules/outputparsers.js +7 -5
  29. package/dist/modules/project.d.ts +1 -1
  30. package/dist/modules/project.js +15 -13
  31. package/dist/modules/state.d.ts +1 -1
  32. package/dist/modules/state.js +16 -15
  33. package/dist/modules/task.d.ts +1 -138
  34. package/dist/modules/task.js +555 -287
  35. package/dist/modules/terminal.d.ts +1 -1
  36. package/dist/modules/terminal.js +12 -11
  37. package/dist/modules/tokenizer.d.ts +1 -1
  38. package/dist/modules/tokenizer.js +7 -6
  39. package/dist/modules/user-message-manager.d.ts +165 -0
  40. package/dist/modules/user-message-manager.js +308 -0
  41. package/dist/modules/user-message-utilities.d.ts +111 -0
  42. package/dist/modules/user-message-utilities.js +115 -0
  43. package/dist/modules/utils.d.ts +1 -1
  44. package/dist/modules/utils.js +4 -3
  45. package/dist/modules/vectordb.d.ts +1 -1
  46. package/dist/modules/vectordb.js +13 -12
  47. package/dist/notificationfunctions/agent.js +7 -6
  48. package/dist/notificationfunctions/browser.js +9 -8
  49. package/dist/notificationfunctions/chat.js +9 -8
  50. package/dist/notificationfunctions/codeutils.js +9 -8
  51. package/dist/notificationfunctions/crawler.js +9 -8
  52. package/dist/notificationfunctions/dbmemory.js +9 -8
  53. package/dist/notificationfunctions/fs.js +45 -44
  54. package/dist/notificationfunctions/git.d.ts +2 -2
  55. package/dist/notificationfunctions/git.js +111 -51
  56. package/dist/notificationfunctions/history.js +9 -8
  57. package/dist/notificationfunctions/llm.js +9 -8
  58. package/dist/notificationfunctions/mcp.js +17 -16
  59. package/dist/notificationfunctions/search.js +13 -12
  60. package/dist/notificationfunctions/system.js +5 -4
  61. package/dist/notificationfunctions/terminal.js +5 -4
  62. package/dist/notificationfunctions/todo.js +13 -12
  63. package/dist/types/commonTypes.d.ts +4 -0
  64. package/dist/types/index.d.ts +1 -1
  65. package/dist/types/libFunctionTypes.d.ts +918 -29
  66. package/dist/types/libFunctionTypes.js +33 -0
  67. package/dist/types/notificationFunctions/git.d.ts +40 -1
  68. package/dist/types/notificationFunctions/index.d.ts +1 -0
  69. package/dist/types/notificationFunctions/index.js +1 -0
  70. package/package.json +4 -12
@@ -1,292 +1,560 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const websocket_1 = __importDefault(require("../core/websocket"));
3
+ // Import new task service types from common/types package
4
+ // import type {
5
+ // // Task event schemas
6
+ // } from '@codebolt/types';
7
+ // // Import response types
8
+ // import type {
9
+ // TaskResponse,
10
+ // TaskListResponse,
11
+ // StepResponse,
12
+ // StepListResponse,
13
+ // TaskMessagesResponse,
14
+ // ActiveStepResponse,
15
+ // SendSteeringMessageResponse,
16
+ // DeleteTaskResponse,
17
+ // CanTaskStartResponse,
18
+ // TaskStatsResponse,
19
+ // CreateTaskResponse,
20
+ // GetTaskListResponse,
21
+ // AddStepToTaskResponse,
22
+ // GetTaskDetailResponse,
23
+ // GetTaskMessagesResponse,
24
+ // GetAllStepsResponse,
25
+ // GetCurrentRunningStepResponse,
26
+ // UpdateStepStatusResponse,
27
+ // CompleteStepResponse,
28
+ // UpdateTaskResponse,
29
+ // CompleteTaskResponse,
30
+ // GetTasksDependentOnResponse,
31
+ // GetTasksReadyToStartResponse,
32
+ // GetTaskDependencyChainResponse,
33
+ // GetTaskStatsResponse,
34
+ // Task,
35
+ // ExtendedTask,
36
+ // ExtendedStep,
37
+ // TaskMessage
38
+ // } from '@codebolt/types/wstypes/app-to-agent-ws/taskServiceResponses';
7
39
  /**
8
- * Enhanced task planner with agent-based organization and comprehensive task management.
40
+ * Enhanced task service with comprehensive task and step management.
41
+ * This module provides a modern API for task management based on the new task service schemas.
9
42
  */
10
- const taskplaner = {
11
- /**
12
- * Adds a new task with enhanced parameters.
13
- * @param {TaskCreateOptions} params - The task parameters including title, agentId, description, etc.
14
- * @returns {Promise<TaskResponse>} A promise that resolves with the response from the add task event.
15
- */
16
- addTask: async (params) => {
17
- const { title, agentId = 'default-agent', description, phase, category, priority, tags } = params;
18
- return websocket_1.default.messageManager.sendAndWaitForResponse({
19
- type: "taskEvent",
20
- action: "addTask",
21
- agentId: agentId,
22
- message: {
23
- title: title,
24
- description: description,
25
- phase: phase,
26
- category: category,
27
- priority: priority,
28
- tags: tags
29
- }
30
- }, "addTaskResponse");
31
- },
32
- /**
33
- * Adds a task using simple string parameter (legacy support).
34
- * @param {string} task - The task title.
35
- * @param {string} agentId - The agent ID (optional, defaults to 'default-agent').
36
- * @returns {Promise<TaskResponse>} A promise that resolves with the response from the add task event.
37
- */
38
- addSimpleTask: async (task, agentId = 'default-agent') => {
39
- return websocket_1.default.messageManager.sendAndWaitForResponse({
40
- type: "taskEvent",
41
- action: "addTask",
42
- agentId: agentId,
43
- message: {
44
- task: task
45
- }
46
- }, "addTaskResponse");
47
- },
48
- /**
49
- * Retrieves all tasks with optional filtering.
50
- * @param {TaskFilterOptions} filters - Optional filters for agentId, category, phase, etc.
51
- * @returns {Promise<TaskResponse>} A promise that resolves with the response from the get tasks event.
52
- */
53
- getTasks: async (filters = {}) => {
54
- return websocket_1.default.messageManager.sendAndWaitForResponse({
55
- type: "taskEvent",
56
- action: "getTasks",
57
- message: filters
58
- }, "getTasksResponse");
59
- },
60
- /**
61
- * Retrieves tasks for a specific agent.
62
- * @param {string} agentId - The agent ID.
63
- * @returns {Promise<TaskResponse>} A promise that resolves with tasks for the specified agent.
64
- */
65
- getTasksByAgent: async (agentId) => {
66
- return websocket_1.default.messageManager.sendAndWaitForResponse({
67
- type: "taskEvent",
68
- action: "getTasksByAgent",
69
- message: {
70
- agentId: agentId
71
- }
72
- }, "getTasksByAgentResponse");
73
- },
74
- /**
75
- * Retrieves tasks by category.
76
- * @param {string} category - The category name.
77
- * @returns {Promise<TaskResponse>} A promise that resolves with tasks in the specified category.
78
- */
79
- getTasksByCategory: async (category) => {
80
- return websocket_1.default.messageManager.sendAndWaitForResponse({
81
- type: "taskEvent",
82
- action: "getTasksByCategory",
83
- message: {
84
- category: category
85
- }
86
- }, "getTasksByCategoryResponse");
87
- },
88
- /**
89
- * Retrieves all available agents.
90
- * @returns {Promise<TaskResponse>} A promise that resolves with the list of all agents.
91
- */
92
- getAllAgents: async () => {
93
- return websocket_1.default.messageManager.sendAndWaitForResponse({
94
- type: "taskEvent",
95
- action: "getAllAgents"
96
- }, "getAllAgentsResponse");
97
- },
98
- /**
99
- * Updates an existing task.
100
- * @param {TaskUpdateOptions} params - The task update parameters.
101
- * @returns {Promise<TaskResponse>} A promise that resolves with the response from the update task event.
102
- */
103
- updateTask: async (params) => {
104
- const { taskId, ...updates } = params;
105
- return websocket_1.default.messageManager.sendAndWaitForResponse({
106
- type: "taskEvent",
107
- action: "updateTask",
108
- message: {
109
- taskId: taskId,
110
- ...updates
111
- }
112
- }, "updateTasksResponse");
113
- },
114
- /**
115
- * Updates an existing task using legacy string parameter.
116
- * @param {string} taskId - The task ID.
117
- * @param {string} task - The updated task information.
118
- * @returns {Promise<TaskResponse>} A promise that resolves with the response from the update task event.
119
- */
120
- updateSimpleTask: async (taskId, task) => {
121
- return websocket_1.default.messageManager.sendAndWaitForResponse({
122
- type: "taskEvent",
123
- action: "updateTask",
124
- message: {
125
- taskId: taskId,
126
- task: task
127
- }
128
- }, "updateTasksResponse");
129
- },
130
- /**
131
- * Deletes a task.
132
- * @param {string} taskId - The task ID to delete.
133
- * @returns {Promise<TaskResponse>} A promise that resolves with the response from the delete task event.
134
- */
135
- deleteTask: async (taskId) => {
136
- return websocket_1.default.messageManager.sendAndWaitForResponse({
137
- type: "taskEvent",
138
- action: "deleteTask",
139
- message: {
140
- taskId: taskId
141
- }
142
- }, "deleteTaskResponse");
143
- },
144
- /**
145
- * Adds a subtask to an existing task.
146
- * @param {AddSubTaskOptions} params - The subtask parameters.
147
- * @returns {Promise<TaskResponse>} A promise that resolves with the response from the add subtask event.
148
- */
149
- addSubTask: async (params) => {
150
- return websocket_1.default.messageManager.sendAndWaitForResponse({
151
- type: "taskEvent",
152
- action: "addSubTask",
153
- message: params
154
- }, "addSubTaskResponse");
155
- },
156
- /**
157
- * Updates an existing subtask.
158
- * @param {UpdateSubTaskOptions} params - The subtask update parameters.
159
- * @returns {Promise<TaskResponse>} A promise that resolves with the response from the update subtask event.
160
- */
161
- updateSubTask: async (params) => {
162
- return websocket_1.default.messageManager.sendAndWaitForResponse({
163
- type: "taskEvent",
164
- action: "updateSubTask",
165
- message: params
166
- }, "updateSubTaskResponse");
167
- },
168
- /**
169
- * Deletes a subtask.
170
- * @param {string} taskId - The parent task ID.
171
- * @param {string} subtaskId - The subtask ID to delete.
172
- * @returns {Promise<TaskResponse>} A promise that resolves with the response from the delete subtask event.
173
- */
174
- deleteSubTask: async (taskId, subtaskId) => {
175
- return websocket_1.default.messageManager.sendAndWaitForResponse({
176
- type: "taskEvent",
177
- action: "deleteSubTask",
178
- message: {
179
- taskId: taskId,
180
- subtaskId: subtaskId
181
- }
182
- }, "deleteSubTaskResponse");
183
- },
184
- /**
185
- * Creates tasks from markdown content.
186
- * @param {TaskMarkdownImportOptions} params - The markdown parameters including content, agentId, phase, and category.
187
- * @returns {Promise<TaskResponse>} A promise that resolves with the response from the create tasks from markdown event.
188
- */
189
- createTasksFromMarkdown: async (params) => {
190
- const { markdown, agentId = 'default-agent', phase, category } = params;
191
- return websocket_1.default.messageManager.sendAndWaitForResponse({
192
- type: "taskEvent",
193
- action: "createTasksFromMarkdown",
194
- agentId: agentId,
195
- message: {
196
- markdown: markdown,
197
- phase: phase,
198
- category: category
199
- }
200
- }, "createTasksFromMarkdownResponse");
201
- },
202
- /**
203
- * Exports tasks to markdown format.
204
- * @param {TaskMarkdownExportOptions} params - The export parameters including optional phase, agentId, and category filters.
205
- * @returns {Promise<TaskResponse>} A promise that resolves with the markdown content.
206
- */
207
- exportTasksToMarkdown: async (params = {}) => {
208
- return websocket_1.default.messageManager.sendAndWaitForResponse({
209
- type: "taskEvent",
210
- action: "exportTasksToMarkdown",
211
- message: params
212
- }, "exportTasksToMarkdownResponse");
213
- },
214
- /**
215
- * Utility function to toggle task completion status.
216
- * @param {string} taskId - The task ID.
217
- * @param {boolean} completed - The new completion status.
218
- * @returns {Promise<TaskResponse>} A promise that resolves with the response from the update task event.
219
- */
220
- toggleTaskCompletion: async (taskId, completed) => {
221
- return taskplaner.updateTask({
222
- taskId: taskId,
223
- completed: completed
224
- });
225
- },
226
- /**
227
- * Utility function to toggle subtask completion status.
228
- * @param {string} taskId - The parent task ID.
229
- * @param {string} subtaskId - The subtask ID.
230
- * @param {boolean} completed - The new completion status.
231
- * @returns {Promise<TaskResponse>} A promise that resolves with the response from the update subtask event.
232
- */
233
- toggleSubTaskCompletion: async (taskId, subtaskId, completed) => {
234
- return taskplaner.updateSubTask({
235
- taskId: taskId,
236
- subtaskId: subtaskId,
237
- completed: completed
238
- });
239
- },
240
- /**
241
- * Utility function to move a task to a different agent.
242
- * @param {string} taskId - The task ID.
243
- * @param {string} newAgentId - The new agent ID.
244
- * @returns {Promise<TaskResponse>} A promise that resolves with the response from the update task event.
245
- */
246
- moveTaskToAgent: async (taskId, newAgentId) => {
247
- return taskplaner.updateTask({
248
- taskId: taskId,
249
- agentId: newAgentId
250
- });
251
- },
252
- /**
253
- * Utility function to set task priority.
254
- * @param {string} taskId - The task ID.
255
- * @param {'low' | 'medium' | 'high'} priority - The priority level.
256
- * @returns {Promise<TaskResponse>} A promise that resolves with the response from the update task event.
257
- */
258
- setTaskPriority: async (taskId, priority) => {
259
- return taskplaner.updateTask({
260
- taskId: taskId,
261
- priority: priority
262
- });
263
- },
264
- /**
265
- * Utility function to add tags to a task.
266
- * @param {string} taskId - The task ID.
267
- * @param {string[]} tags - The tags to add.
268
- * @returns {Promise<TaskResponse>} A promise that resolves with the response from the update task event.
269
- */
270
- addTaskTags: async (taskId, tags) => {
271
- return taskplaner.updateTask({
272
- taskId: taskId,
273
- tags: tags
274
- });
275
- },
276
- /**
277
- * Utility function to create a quick task with minimal parameters.
278
- * @param {string} title - The task title.
279
- * @param {string} agentId - The agent ID (optional, defaults to 'default-agent').
280
- * @param {string} category - The category (optional).
281
- * @returns {Promise<TaskResponse>} A promise that resolves with the response from the add task event.
282
- */
283
- createQuickTask: async (title, agentId = 'default-agent', category) => {
284
- return taskplaner.addTask({
285
- title: title,
286
- agentId: agentId,
287
- category: category,
288
- priority: 'medium'
289
- });
290
- }
43
+ const taskService = {
44
+ // /**
45
+ // * Creates a new task with comprehensive options.
46
+ // * @param {CreateTaskOptions} options - The task creation parameters
47
+ // * @returns {Promise<CreateTaskResponse>} A promise that resolves with the task creation response
48
+ // */
49
+ // createTask: async (options: CreateTaskOptions): Promise<CreateTaskResponse> => {
50
+ // const requestId = randomUUID();
51
+ // const event: CreateTaskEvent = {
52
+ // type: 'taskEvent',
53
+ // action: 'createTask',
54
+ // requestId,
55
+ // agentId: options.threadId, // Using threadId as agentId for now
56
+ // threadId: options.threadId,
57
+ // message: options
58
+ // };
59
+ // return cbws.messageManager.sendAndWaitForResponse(
60
+ // event,
61
+ // 'createTaskResponse'
62
+ // );
63
+ // },
64
+ // /**
65
+ // * Creates a simple task with minimal parameters (legacy compatibility).
66
+ // * @param {string} taskName - The task name
67
+ // * @param {string} threadId - The thread ID (defaults to 'default-thread')
68
+ // * @returns {Promise<CreateTaskResponse>} A promise that resolves with the task creation response
69
+ // */
70
+ // createSimpleTask: async (taskName: string, threadId: string = 'default-thread'): Promise<CreateTaskResponse> => {
71
+ // const options: CreateTaskOptions = {
72
+ // threadId,
73
+ // name: taskName,
74
+ // taskType: 'interactive',
75
+ // executionType: 'manual',
76
+ // environmentType: 'local',
77
+ // startOption: 'manual'
78
+ // };
79
+ // return taskService.createTask(options);
80
+ // },
81
+ // /**
82
+ // * Retrieves a list of tasks with optional filtering.
83
+ // * @param {GetTaskListOptions} options - Optional filters for tasks
84
+ // * @returns {Promise<GetTaskListResponse>} A promise that resolves with the task list response
85
+ // */
86
+ // getTaskList: async (options: GetTaskListOptions = {}): Promise<GetTaskListResponse> => {
87
+ // const requestId = randomUUID();
88
+ // const event: GetTaskListEvent = {
89
+ // type: 'taskEvent',
90
+ // action: 'getTaskList',
91
+ // requestId,
92
+ // message: options
93
+ // };
94
+ // return cbws.messageManager.sendAndWaitForResponse(
95
+ // event,
96
+ // 'getTaskListResponse'
97
+ // );
98
+ // },
99
+ // /**
100
+ // * Retrieves detailed information about a specific task.
101
+ // * @param {GetTaskDetailOptions} options - The task detail options
102
+ // * @returns {Promise<GetTaskDetailResponse>} A promise that resolves with the task detail response
103
+ // */
104
+ // getTaskDetail: async (options: GetTaskDetailOptions): Promise<GetTaskDetailResponse> => {
105
+ // const requestId = randomUUID();
106
+ // const event: GetTaskDetailEvent = {
107
+ // type: 'taskEvent',
108
+ // action: 'getTaskDetail',
109
+ // requestId,
110
+ // message: options
111
+ // };
112
+ // return cbws.messageManager.sendAndWaitForResponse(
113
+ // event,
114
+ // 'getTaskDetailResponse'
115
+ // );
116
+ // },
117
+ // /**
118
+ // * Adds a step to an existing task.
119
+ // * @param {AddStepToTaskOptions} options - The step addition options
120
+ // * @returns {Promise<AddStepToTaskResponse>} A promise that resolves with the step addition response
121
+ // */
122
+ // addStepToTask: async (options: AddStepToTaskOptions): Promise<AddStepToTaskResponse> => {
123
+ // const requestId = randomUUID();
124
+ // const event: AddStepToTaskEvent = {
125
+ // type: 'taskEvent',
126
+ // action: 'addStepToTask',
127
+ // requestId,
128
+ // message: options
129
+ // };
130
+ // return cbws.messageManager.sendAndWaitForResponse(
131
+ // event,
132
+ // 'addStepToTaskResponse'
133
+ // );
134
+ // },
135
+ // /**
136
+ // * Retrieves messages for a specific task.
137
+ // * @param {GetTaskMessagesOptions} options - The task messages options
138
+ // * @returns {Promise<GetTaskMessagesResponse>} A promise that resolves with the task messages response
139
+ // */
140
+ // getTaskMessages: async (options: GetTaskMessagesOptions): Promise<GetTaskMessagesResponse> => {
141
+ // const requestId = randomUUID();
142
+ // const event: GetTaskMessagesEvent = {
143
+ // type: 'taskEvent',
144
+ // action: 'getTaskMessages',
145
+ // requestId,
146
+ // message: options
147
+ // };
148
+ // return cbws.messageManager.sendAndWaitForResponse(
149
+ // event,
150
+ // 'getTaskMessagesResponse'
151
+ // );
152
+ // },
153
+ // /**
154
+ // * Updates an existing task.
155
+ // * @param {string} taskId - The task ID to update
156
+ // * @param {UpdateTaskOptions} updates - The task update parameters
157
+ // * @returns {Promise<UpdateTaskResponse>} A promise that resolves with the task update response
158
+ // */
159
+ // updateTask: async (taskId: string, updates: UpdateTaskOptions): Promise<UpdateTaskResponse> => {
160
+ // const requestId = randomUUID();
161
+ // const event: UpdateTaskEvent = {
162
+ // type: 'taskEvent',
163
+ // action: 'updateTask',
164
+ // requestId,
165
+ // message: {
166
+ // taskId,
167
+ // ...updates
168
+ // }
169
+ // };
170
+ // return cbws.messageManager.sendAndWaitForResponse(
171
+ // event,
172
+ // 'updateTaskResponse'
173
+ // );
174
+ // },
175
+ // /**
176
+ // * Updates a task with simple name change (legacy compatibility).
177
+ // * @param {string} taskId - The task ID
178
+ // * @param {string} taskName - The new task name
179
+ // * @returns {Promise<UpdateTaskResponse>} A promise that resolves with the task update response
180
+ // */
181
+ // updateSimpleTask: async (taskId: string, taskName: string): Promise<UpdateTaskResponse> => {
182
+ // return taskService.updateTask(taskId, {
183
+ // name: taskName
184
+ // });
185
+ // },
186
+ // /**
187
+ // * Deletes a task.
188
+ // * @param {string} taskId - The task ID to delete
189
+ // * @returns {Promise<DeleteTaskResponse>} A promise that resolves with the task deletion response
190
+ // */
191
+ // deleteTask: async (taskId: string): Promise<DeleteTaskResponse> => {
192
+ // const requestId = randomUUID();
193
+ // const event: DeleteTaskEvent = {
194
+ // type: 'taskEvent',
195
+ // action: 'deleteTask',
196
+ // requestId,
197
+ // message: {
198
+ // taskId
199
+ // }
200
+ // };
201
+ // return cbws.messageManager.sendAndWaitForResponse(
202
+ // event,
203
+ // 'deleteTaskResponse'
204
+ // );
205
+ // },
206
+ // /**
207
+ // * Completes a task.
208
+ // * @param {string} taskId - The task ID to complete
209
+ // * @returns {Promise<CompleteTaskResponse>} A promise that resolves with the task completion response
210
+ // */
211
+ // completeTask: async (taskId: string): Promise<CompleteTaskResponse> => {
212
+ // const requestId = randomUUID();
213
+ // const event: CompleteTaskEvent = {
214
+ // type: 'taskEvent',
215
+ // action: 'completeTask',
216
+ // requestId,
217
+ // message: {
218
+ // taskId
219
+ // }
220
+ // };
221
+ // return cbws.messageManager.sendAndWaitForResponse(
222
+ // event,
223
+ // 'completeTaskResponse'
224
+ // );
225
+ // },
226
+ // /**
227
+ // * Retrieves all steps with optional filtering.
228
+ // * @param {GetAllStepsOptions} options - Optional filters for steps
229
+ // * @returns {Promise<GetAllStepsResponse>} A promise that resolves with the steps response
230
+ // */
231
+ // getAllSteps: async (options: GetAllStepsOptions = {}): Promise<GetAllStepsResponse> => {
232
+ // const requestId = randomUUID();
233
+ // const event: GetAllStepsEvent = {
234
+ // type: 'taskEvent',
235
+ // action: 'getAllSteps',
236
+ // requestId,
237
+ // message: options
238
+ // };
239
+ // return cbws.messageManager.sendAndWaitForResponse(
240
+ // event,
241
+ // 'getAllStepsResponse'
242
+ // );
243
+ // },
244
+ // /**
245
+ // * Gets the currently running step for a task or agent.
246
+ // * @param {GetActiveStepOptions} options - Options for getting active step
247
+ // * @returns {Promise<GetCurrentRunningStepResponse>} A promise that resolves with the active step response
248
+ // */
249
+ // getCurrentRunningStep: async (options: GetActiveStepOptions = {}): Promise<GetCurrentRunningStepResponse> => {
250
+ // const requestId = randomUUID();
251
+ // const event: GetCurrentRunningStepEvent = {
252
+ // type: 'taskEvent',
253
+ // action: 'getCurrentRunningStep',
254
+ // requestId,
255
+ // message: options
256
+ // };
257
+ // return cbws.messageManager.sendAndWaitForResponse(
258
+ // event,
259
+ // 'getCurrentRunningStepResponse'
260
+ // );
261
+ // },
262
+ // /**
263
+ // * Updates the status of a specific step.
264
+ // * @param {UpdateStepStatusOptions} options - The step status update options
265
+ // * @returns {Promise<UpdateStepStatusResponse>} A promise that resolves with the step update response
266
+ // */
267
+ // updateStepStatus: async (options: UpdateStepStatusOptions): Promise<UpdateStepStatusResponse> => {
268
+ // const requestId = randomUUID();
269
+ // const event: UpdateStepStatusEvent = {
270
+ // type: 'taskEvent',
271
+ // action: 'updateStepStatus',
272
+ // requestId,
273
+ // message: options
274
+ // };
275
+ // return cbws.messageManager.sendAndWaitForResponse(
276
+ // event,
277
+ // 'updateStepStatusResponse'
278
+ // );
279
+ // },
280
+ // /**
281
+ // * Completes a specific step.
282
+ // * @param {CompleteStepOptions} options - The step completion options
283
+ // * @returns {Promise<CompleteStepResponse>} A promise that resolves with the step completion response
284
+ // */
285
+ // completeStep: async (options: CompleteStepOptions): Promise<CompleteStepResponse> => {
286
+ // const requestId = randomUUID();
287
+ // const event: CompleteStepEvent = {
288
+ // type: 'taskEvent',
289
+ // action: 'completeStep',
290
+ // requestId,
291
+ // message: options
292
+ // };
293
+ // return cbws.messageManager.sendAndWaitForResponse(
294
+ // event,
295
+ // 'completeStepResponse'
296
+ // );
297
+ // },
298
+ // /**
299
+ // * Sends a steering message to a running step.
300
+ // * @param {SendSteeringMessageOptions} options - The steering message options
301
+ // * @returns {Promise<SendSteeringMessageResponse>} A promise that resolves with the steering message response
302
+ // */
303
+ // sendSteeringMessage: async (options: SendSteeringMessageOptions): Promise<SendSteeringMessageResponse> => {
304
+ // const requestId = randomUUID();
305
+ // const event: SendSteeringMessageEvent = {
306
+ // type: 'taskEvent',
307
+ // action: 'sendSteeringMessage',
308
+ // requestId,
309
+ // message: options
310
+ // };
311
+ // return cbws.messageManager.sendAndWaitForResponse(
312
+ // event,
313
+ // 'sendSteeringMessageResponse'
314
+ // );
315
+ // },
316
+ // /**
317
+ // * Checks if a task can start based on its dependencies.
318
+ // * @param {string} taskId - The task ID to check
319
+ // * @returns {Promise<CanTaskStartResponse>} A promise that resolves with the task start capability response
320
+ // */
321
+ // canTaskStart: async (taskId: string): Promise<CanTaskStartResponse> => {
322
+ // const requestId = randomUUID();
323
+ // const event: CanTaskStartEvent = {
324
+ // type: 'taskEvent',
325
+ // action: 'canTaskStart',
326
+ // requestId,
327
+ // message: {
328
+ // taskId
329
+ // }
330
+ // };
331
+ // return cbws.messageManager.sendAndWaitForResponse(
332
+ // event,
333
+ // 'canTaskStartResponse'
334
+ // );
335
+ // },
336
+ // /**
337
+ // * Gets tasks that depend on a specific task.
338
+ // * @param {string} taskId - The task ID to check dependencies for
339
+ // * @returns {Promise<GetTasksDependentOnResponse>} A promise that resolves with the dependent tasks response
340
+ // */
341
+ // getTasksDependentOn: async (taskId: string): Promise<GetTasksDependentOnResponse> => {
342
+ // const requestId = randomUUID();
343
+ // const event: GetTasksDependentOnEvent = {
344
+ // type: 'taskEvent',
345
+ // action: 'getTasksDependentOn',
346
+ // requestId,
347
+ // message: {
348
+ // taskId
349
+ // }
350
+ // };
351
+ // return cbws.messageManager.sendAndWaitForResponse(
352
+ // event,
353
+ // 'getTasksDependentOnResponse'
354
+ // );
355
+ // },
356
+ // /**
357
+ // * Gets tasks that are ready to start.
358
+ // * @param {GetTasksReadyToStartOptions} options - Optional filters for ready tasks
359
+ // * @returns {Promise<GetTasksReadyToStartResponse>} A promise that resolves with the ready tasks response
360
+ // */
361
+ // getTasksReadyToStart: async (options: GetTasksReadyToStartOptions = {}): Promise<GetTasksReadyToStartResponse> => {
362
+ // const requestId = randomUUID();
363
+ // const event: GetTasksReadyToStartEvent = {
364
+ // type: 'taskEvent',
365
+ // action: 'getTasksReadyToStart',
366
+ // requestId,
367
+ // message: options
368
+ // };
369
+ // return cbws.messageManager.sendAndWaitForResponse(
370
+ // event,
371
+ // 'getTasksReadyToStartResponse'
372
+ // );
373
+ // },
374
+ // /**
375
+ // * Gets the dependency chain for a specific task.
376
+ // * @param {string} taskId - The task ID to get dependency chain for
377
+ // * @returns {Promise<GetTaskDependencyChainResponse>} A promise that resolves with the dependency chain response
378
+ // */
379
+ // getTaskDependencyChain: async (taskId: string): Promise<GetTaskDependencyChainResponse> => {
380
+ // const requestId = randomUUID();
381
+ // const event: GetTaskDependencyChainEvent = {
382
+ // type: 'taskEvent',
383
+ // action: 'getTaskDependencyChain',
384
+ // requestId,
385
+ // message: {
386
+ // taskId
387
+ // }
388
+ // };
389
+ // return cbws.messageManager.sendAndWaitForResponse(
390
+ // event,
391
+ // 'getTaskDependencyChainResponse'
392
+ // );
393
+ // },
394
+ // /**
395
+ // * Gets task statistics.
396
+ // * @param {GetTaskStatsOptions} options - Optional filters for task stats
397
+ // * @returns {Promise<GetTaskStatsResponse>} A promise that resolves with the task stats response
398
+ // */
399
+ // getTaskStats: async (options: GetTaskStatsOptions = {}): Promise<GetTaskStatsResponse> => {
400
+ // const requestId = randomUUID();
401
+ // const event: GetTaskStatsEvent = {
402
+ // type: 'taskEvent',
403
+ // action: 'getTaskStats',
404
+ // requestId,
405
+ // message: options
406
+ // };
407
+ // return cbws.messageManager.sendAndWaitForResponse(
408
+ // event,
409
+ // 'getTaskStatsResponse'
410
+ // );
411
+ // },
412
+ // // ================================
413
+ // // Utility Functions
414
+ // // ================================
415
+ // /**
416
+ // * Utility function to toggle task completion status.
417
+ // * @param {string} taskId - The task ID
418
+ // * @param {boolean} completed - The new completion status
419
+ // * @returns {Promise<UpdateTaskResponse>} A promise that resolves with the task update response
420
+ // */
421
+ // toggleTaskCompletion: async (taskId: string, completed: boolean): Promise<UpdateTaskResponse> => {
422
+ // return taskService.updateTask(taskId, {
423
+ // completed: completed
424
+ // });
425
+ // },
426
+ // /**
427
+ // * Utility function to create a quick task with minimal parameters.
428
+ // * @param {string} name - The task name
429
+ // * @param {string} threadId - The thread ID (defaults to 'default-thread')
430
+ // * @returns {Promise<CreateTaskResponse>} A promise that resolves with the task creation response
431
+ // */
432
+ // createQuickTask: async (name: string, threadId: string = 'default-thread'): Promise<CreateTaskResponse> => {
433
+ // return taskService.createTask({
434
+ // threadId,
435
+ // name,
436
+ // taskType: 'interactive',
437
+ // executionType: 'immediate',
438
+ // environmentType: 'local',
439
+ // startOption: 'immediately'
440
+ // });
441
+ // },
442
+ // // ================================
443
+ // // Legacy Compatibility Functions
444
+ // // ================================
445
+ // /**
446
+ // * Legacy function: Adds a task (mapped to createTask)
447
+ // * @deprecated Use createTask instead
448
+ // */
449
+ // addTask: async (params: LegacyTaskCreateOptions): Promise<CreateTaskResponse> => {
450
+ // const options: CreateTaskOptions = {
451
+ // threadId: params.agentId || 'default-thread',
452
+ // name: params.title,
453
+ // taskType: 'interactive',
454
+ // executionType: 'manual',
455
+ // environmentType: 'local',
456
+ // startOption: 'manual'
457
+ // };
458
+ // return taskService.createTask(options);
459
+ // },
460
+ // /**
461
+ // * Legacy function: Gets tasks (mapped to getTaskList)
462
+ // * @deprecated Use getTaskList instead
463
+ // */
464
+ // getTasks: async (filters: TaskFilterOptions = {}): Promise<GetTaskListResponse> => {
465
+ // const options: GetTaskListOptions = {
466
+ // threadId: filters.agentId,
467
+ // status: 'all'
468
+ // };
469
+ // return taskService.getTaskList(options);
470
+ // },
471
+ // /**
472
+ // * Legacy function: Gets tasks by agent (mapped to getTaskList with threadId filter)
473
+ // * @deprecated Use getTaskList with threadId filter instead
474
+ // */
475
+ // getTasksByAgent: async (agentId: string): Promise<GetTaskListResponse> => {
476
+ // return taskService.getTaskList({
477
+ // threadId: agentId
478
+ // });
479
+ // },
480
+ // /**
481
+ // * Legacy function: Gets tasks by category (use getTaskList with custom filtering)
482
+ // * @deprecated Use getTaskList instead
483
+ // */
484
+ // getTasksByCategory: async (category: string): Promise<GetTaskListResponse> => {
485
+ // // Note: The new API doesn't have category filtering built-in
486
+ // // This would need to be implemented as post-processing
487
+ // return taskService.getTaskList();
488
+ // }
291
489
  };
292
- exports.default = taskplaner;
490
+ // // ================================
491
+ // // Type Exports
492
+ // // ================================
493
+ // Export new types
494
+ // export type {
495
+ // // New task service types
496
+ // Task,
497
+ // ExtendedTask,
498
+ // Step,
499
+ // ExtendedStep,
500
+ // TaskMessage,
501
+ // Metadata,
502
+ // CreateTaskOptions,
503
+ // UpdateTaskOptions,
504
+ // GetTaskListOptions,
505
+ // AddStepToTaskOptions,
506
+ // GetTaskDetailOptions,
507
+ // GetTaskMessagesOptions,
508
+ // UpdateStepStatusOptions,
509
+ // CompleteStepOptions,
510
+ // SendSteeringMessageOptions,
511
+ // GetAllStepsOptions,
512
+ // GetActiveStepOptions,
513
+ // DeleteTaskOptions,
514
+ // CompleteTaskOptions,
515
+ // CanTaskStartOptions,
516
+ // GetTasksDependentOnOptions,
517
+ // GetTasksReadyToStartOptions,
518
+ // GetTaskDependencyChainOptions,
519
+ // GetTaskStatsOptions,
520
+ // // Response types
521
+ // TaskResponse,
522
+ // TaskListResponse,
523
+ // StepResponse,
524
+ // StepListResponse,
525
+ // TaskMessagesResponse,
526
+ // ActiveStepResponse,
527
+ // SendSteeringMessageResponse,
528
+ // DeleteTaskResponse,
529
+ // CanTaskStartResponse,
530
+ // TaskStatsResponse,
531
+ // CreateTaskResponse,
532
+ // GetTaskListResponse,
533
+ // AddStepToTaskResponse,
534
+ // GetTaskDetailResponse,
535
+ // GetTaskMessagesResponse,
536
+ // GetAllStepsResponse,
537
+ // GetCurrentRunningStepResponse,
538
+ // UpdateStepStatusResponse,
539
+ // CompleteStepResponse,
540
+ // UpdateTaskResponse,
541
+ // CompleteTaskResponse,
542
+ // GetTasksDependentOnResponse,
543
+ // GetTasksReadyToStartResponse,
544
+ // GetTaskDependencyChainResponse,
545
+ // GetTaskStatsResponse
546
+ // };
547
+ // // Export legacy types for backward compatibility
548
+ // export type {
549
+ // LegacyTask as Task_Legacy,
550
+ // LegacySubTask as SubTask,
551
+ // LegacyTaskResponse as TaskResponse_Legacy,
552
+ // LegacyTaskCreateOptions as TaskCreateOptions_Legacy,
553
+ // LegacyTaskUpdateOptions as TaskUpdateOptions_Legacy,
554
+ // AddSubTaskOptions,
555
+ // UpdateSubTaskOptions,
556
+ // TaskFilterOptions,
557
+ // TaskMarkdownImportOptions,
558
+ // TaskMarkdownExportOptions
559
+ // };
560
+ // export default taskService;