@codebolt/codeboltjs 2.0.12 → 2.0.15
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/Readme.md +138 -4
- package/dist/agentlib/agent.js +3 -7
- package/dist/agentlib/followupquestionbuilder.d.ts +75 -0
- package/dist/agentlib/followupquestionbuilder.js +193 -0
- package/dist/agentlib/llmoutputhandler.d.ts +102 -0
- package/dist/agentlib/llmoutputhandler.js +451 -0
- package/dist/agentlib/promptbuilder.d.ts +171 -17
- package/dist/agentlib/promptbuilder.js +367 -49
- package/dist/agentlib/systemprompt.js +3 -3
- package/dist/agentlib/usermessage.d.ts +1 -1
- package/dist/agentlib/usermessage.js +5 -1
- package/dist/core/Codebolt.d.ts +342 -0
- package/dist/core/Codebolt.js +201 -0
- package/dist/core/websocket.js +2 -1
- package/dist/index.d.ts +4 -300
- package/dist/index.js +11 -137
- package/dist/modules/llm.d.ts +23 -3
- package/dist/modules/llm.js +20 -3
- package/dist/modules/project.d.ts +3 -3
- package/dist/modules/project.js +1 -1
- package/dist/modules/state.d.ts +5 -3
- package/dist/modules/state.js +2 -0
- package/dist/modules/task.d.ts +126 -11
- package/dist/modules/task.js +262 -20
- package/dist/notificationfunctions/agent.d.ts +48 -0
- package/dist/notificationfunctions/agent.js +115 -0
- package/dist/notificationfunctions/browser.d.ts +60 -0
- package/dist/notificationfunctions/browser.js +145 -0
- package/dist/notificationfunctions/chat.d.ts +53 -0
- package/dist/notificationfunctions/chat.js +125 -0
- package/dist/notificationfunctions/codeutils.d.ts +60 -0
- package/dist/notificationfunctions/codeutils.js +145 -0
- package/dist/notificationfunctions/crawler.d.ts +59 -0
- package/dist/notificationfunctions/crawler.js +159 -0
- package/dist/notificationfunctions/dbmemory.d.ts +50 -0
- package/dist/notificationfunctions/dbmemory.js +132 -0
- package/dist/notificationfunctions/fs.d.ts +125 -0
- package/dist/notificationfunctions/fs.js +472 -0
- package/dist/notificationfunctions/git.d.ts +174 -0
- package/dist/notificationfunctions/git.js +521 -0
- package/dist/notificationfunctions/history.d.ts +38 -0
- package/dist/notificationfunctions/history.js +97 -0
- package/dist/notificationfunctions/index.d.ts +79 -0
- package/dist/notificationfunctions/index.js +102 -0
- package/dist/notificationfunctions/llm.d.ts +39 -0
- package/dist/notificationfunctions/llm.js +99 -0
- package/dist/notificationfunctions/mcp.d.ts +67 -0
- package/dist/notificationfunctions/mcp.js +192 -0
- package/dist/notificationfunctions/search.d.ts +50 -0
- package/dist/notificationfunctions/search.js +146 -0
- package/dist/notificationfunctions/system.d.ts +25 -0
- package/dist/notificationfunctions/system.js +59 -0
- package/dist/notificationfunctions/terminal.d.ts +26 -0
- package/dist/notificationfunctions/terminal.js +64 -0
- package/dist/notificationfunctions/todo.d.ts +63 -0
- package/dist/notificationfunctions/todo.js +164 -0
- package/dist/notificationfunctions/utils.d.ts +81 -0
- package/dist/notificationfunctions/utils.js +177 -0
- package/dist/types/InternalTypes.d.ts +1 -0
- package/dist/types/commonTypes.d.ts +26 -3
- package/dist/types/index.d.ts +15 -0
- package/dist/types/index.js +15 -0
- package/dist/types/libFunctionTypes.d.ts +110 -4
- package/dist/types/notificationFunctions/agent.d.ts +8 -0
- package/dist/types/notificationFunctions/agent.js +2 -0
- package/dist/types/notificationFunctions/browser.d.ts +10 -0
- package/dist/types/notificationFunctions/browser.js +2 -0
- package/dist/types/notificationFunctions/chat.d.ts +10 -0
- package/dist/types/notificationFunctions/chat.js +2 -0
- package/dist/types/notificationFunctions/codeutils.d.ts +10 -0
- package/dist/types/notificationFunctions/codeutils.js +2 -0
- package/dist/types/notificationFunctions/crawler.d.ts +10 -0
- package/dist/types/notificationFunctions/crawler.js +2 -0
- package/dist/types/notificationFunctions/dbmemory.d.ts +9 -0
- package/dist/types/notificationFunctions/dbmemory.js +2 -0
- package/dist/types/notificationFunctions/fs.d.ts +27 -0
- package/dist/types/notificationFunctions/fs.js +2 -0
- package/dist/types/notificationFunctions/git.d.ts +29 -0
- package/dist/types/notificationFunctions/git.js +2 -0
- package/dist/types/notificationFunctions/history.d.ts +10 -0
- package/dist/types/notificationFunctions/history.js +2 -0
- package/dist/types/notificationFunctions/index.d.ts +0 -0
- package/dist/types/notificationFunctions/index.js +1 -0
- package/dist/types/notificationFunctions/llm.d.ts +10 -0
- package/dist/types/notificationFunctions/llm.js +2 -0
- package/dist/types/notificationFunctions/mcp.d.ts +16 -0
- package/dist/types/notificationFunctions/mcp.js +2 -0
- package/dist/types/notificationFunctions/search.d.ts +11 -0
- package/dist/types/notificationFunctions/search.js +2 -0
- package/dist/types/notificationFunctions/system.d.ts +7 -0
- package/dist/types/notificationFunctions/system.js +2 -0
- package/dist/types/notificationFunctions/terminal.d.ts +7 -0
- package/dist/types/notificationFunctions/terminal.js +2 -0
- package/dist/types/notificationFunctions/todo.d.ts +11 -0
- package/dist/types/notificationFunctions/todo.js +2 -0
- package/dist/types/notifications/agent.d.ts +31 -0
- package/dist/types/notifications/agent.js +3 -0
- package/dist/types/notifications/browser.d.ts +53 -0
- package/dist/types/notifications/browser.js +3 -0
- package/dist/types/notifications/chat.d.ts +37 -0
- package/dist/types/notifications/chat.js +3 -0
- package/dist/types/notifications/codeutils.d.ts +55 -0
- package/dist/types/notifications/codeutils.js +3 -0
- package/dist/types/notifications/crawler.d.ts +55 -0
- package/dist/types/notifications/crawler.js +3 -0
- package/dist/types/notifications/dbmemory.d.ts +31 -0
- package/dist/types/notifications/dbmemory.js +3 -0
- package/dist/types/notifications/fs.d.ts +180 -0
- package/dist/types/notifications/fs.js +3 -0
- package/dist/types/notifications/git.d.ts +205 -0
- package/dist/types/notifications/git.js +3 -0
- package/dist/types/notifications/history.d.ts +32 -0
- package/dist/types/notifications/history.js +3 -0
- package/dist/types/notifications/llm.d.ts +45 -0
- package/dist/types/notifications/llm.js +2 -0
- package/dist/types/notifications/mcp.d.ts +63 -0
- package/dist/types/notifications/mcp.js +3 -0
- package/dist/types/notifications/search.d.ts +47 -0
- package/dist/types/notifications/search.js +3 -0
- package/dist/types/notifications/system.d.ts +20 -0
- package/dist/types/notifications/system.js +2 -0
- package/dist/types/notifications/terminal.d.ts +17 -0
- package/dist/types/notifications/terminal.js +2 -0
- package/dist/types/notifications/todo.d.ts +60 -0
- package/dist/types/notifications/todo.js +3 -0
- package/dist/types/socketMessageTypes.d.ts +3 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +7 -1
- package/package.json +1 -1
package/dist/modules/task.d.ts
CHANGED
|
@@ -1,23 +1,138 @@
|
|
|
1
|
+
import type { Task, SubTask, TaskResponse, TaskCreateOptions, TaskUpdateOptions, AddSubTaskOptions, UpdateSubTaskOptions, TaskFilterOptions, TaskMarkdownImportOptions, TaskMarkdownExportOptions } from '../types';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* Enhanced task planner with agent-based organization and comprehensive task management.
|
|
3
4
|
*/
|
|
4
5
|
declare const taskplaner: {
|
|
5
6
|
/**
|
|
6
|
-
* Adds a task
|
|
7
|
-
* @param {
|
|
8
|
-
* @returns {Promise<
|
|
7
|
+
* Adds a new task with enhanced parameters.
|
|
8
|
+
* @param {TaskCreateOptions} params - The task parameters including title, agentId, description, etc.
|
|
9
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the add task event.
|
|
9
10
|
*/
|
|
10
|
-
addTask: (
|
|
11
|
+
addTask: (params: TaskCreateOptions) => Promise<TaskResponse>;
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
-
* @
|
|
13
|
+
* Adds a task using simple string parameter (legacy support).
|
|
14
|
+
* @param {string} task - The task title.
|
|
15
|
+
* @param {string} agentId - The agent ID (optional, defaults to 'default-agent').
|
|
16
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the add task event.
|
|
14
17
|
*/
|
|
15
|
-
|
|
18
|
+
addSimpleTask: (task: string, agentId?: string) => Promise<TaskResponse>;
|
|
16
19
|
/**
|
|
17
|
-
*
|
|
20
|
+
* Retrieves all tasks with optional filtering.
|
|
21
|
+
* @param {TaskFilterOptions} filters - Optional filters for agentId, category, phase, etc.
|
|
22
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the get tasks event.
|
|
23
|
+
*/
|
|
24
|
+
getTasks: (filters?: TaskFilterOptions) => Promise<TaskResponse>;
|
|
25
|
+
/**
|
|
26
|
+
* Retrieves tasks for a specific agent.
|
|
27
|
+
* @param {string} agentId - The agent ID.
|
|
28
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with tasks for the specified agent.
|
|
29
|
+
*/
|
|
30
|
+
getTasksByAgent: (agentId: string) => Promise<TaskResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves tasks by category.
|
|
33
|
+
* @param {string} category - The category name.
|
|
34
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with tasks in the specified category.
|
|
35
|
+
*/
|
|
36
|
+
getTasksByCategory: (category: string) => Promise<TaskResponse>;
|
|
37
|
+
/**
|
|
38
|
+
* Retrieves all available agents.
|
|
39
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the list of all agents.
|
|
40
|
+
*/
|
|
41
|
+
getAllAgents: () => Promise<TaskResponse>;
|
|
42
|
+
/**
|
|
43
|
+
* Updates an existing task.
|
|
44
|
+
* @param {TaskUpdateOptions} params - The task update parameters.
|
|
45
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the update task event.
|
|
46
|
+
*/
|
|
47
|
+
updateTask: (params: TaskUpdateOptions) => Promise<TaskResponse>;
|
|
48
|
+
/**
|
|
49
|
+
* Updates an existing task using legacy string parameter.
|
|
50
|
+
* @param {string} taskId - The task ID.
|
|
18
51
|
* @param {string} task - The updated task information.
|
|
19
|
-
* @returns {Promise<
|
|
52
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the update task event.
|
|
53
|
+
*/
|
|
54
|
+
updateSimpleTask: (taskId: string, task: string) => Promise<TaskResponse>;
|
|
55
|
+
/**
|
|
56
|
+
* Deletes a task.
|
|
57
|
+
* @param {string} taskId - The task ID to delete.
|
|
58
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the delete task event.
|
|
59
|
+
*/
|
|
60
|
+
deleteTask: (taskId: string) => Promise<TaskResponse>;
|
|
61
|
+
/**
|
|
62
|
+
* Adds a subtask to an existing task.
|
|
63
|
+
* @param {AddSubTaskOptions} params - The subtask parameters.
|
|
64
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the add subtask event.
|
|
65
|
+
*/
|
|
66
|
+
addSubTask: (params: AddSubTaskOptions) => Promise<TaskResponse>;
|
|
67
|
+
/**
|
|
68
|
+
* Updates an existing subtask.
|
|
69
|
+
* @param {UpdateSubTaskOptions} params - The subtask update parameters.
|
|
70
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the update subtask event.
|
|
71
|
+
*/
|
|
72
|
+
updateSubTask: (params: UpdateSubTaskOptions) => Promise<TaskResponse>;
|
|
73
|
+
/**
|
|
74
|
+
* Deletes a subtask.
|
|
75
|
+
* @param {string} taskId - The parent task ID.
|
|
76
|
+
* @param {string} subtaskId - The subtask ID to delete.
|
|
77
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the delete subtask event.
|
|
78
|
+
*/
|
|
79
|
+
deleteSubTask: (taskId: string, subtaskId: string) => Promise<TaskResponse>;
|
|
80
|
+
/**
|
|
81
|
+
* Creates tasks from markdown content.
|
|
82
|
+
* @param {TaskMarkdownImportOptions} params - The markdown parameters including content, agentId, phase, and category.
|
|
83
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the create tasks from markdown event.
|
|
84
|
+
*/
|
|
85
|
+
createTasksFromMarkdown: (params: TaskMarkdownImportOptions) => Promise<TaskResponse>;
|
|
86
|
+
/**
|
|
87
|
+
* Exports tasks to markdown format.
|
|
88
|
+
* @param {TaskMarkdownExportOptions} params - The export parameters including optional phase, agentId, and category filters.
|
|
89
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the markdown content.
|
|
90
|
+
*/
|
|
91
|
+
exportTasksToMarkdown: (params?: TaskMarkdownExportOptions) => Promise<TaskResponse>;
|
|
92
|
+
/**
|
|
93
|
+
* Utility function to toggle task completion status.
|
|
94
|
+
* @param {string} taskId - The task ID.
|
|
95
|
+
* @param {boolean} completed - The new completion status.
|
|
96
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the update task event.
|
|
97
|
+
*/
|
|
98
|
+
toggleTaskCompletion: (taskId: string, completed: boolean) => Promise<TaskResponse>;
|
|
99
|
+
/**
|
|
100
|
+
* Utility function to toggle subtask completion status.
|
|
101
|
+
* @param {string} taskId - The parent task ID.
|
|
102
|
+
* @param {string} subtaskId - The subtask ID.
|
|
103
|
+
* @param {boolean} completed - The new completion status.
|
|
104
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the update subtask event.
|
|
105
|
+
*/
|
|
106
|
+
toggleSubTaskCompletion: (taskId: string, subtaskId: string, completed: boolean) => Promise<TaskResponse>;
|
|
107
|
+
/**
|
|
108
|
+
* Utility function to move a task to a different agent.
|
|
109
|
+
* @param {string} taskId - The task ID.
|
|
110
|
+
* @param {string} newAgentId - The new agent ID.
|
|
111
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the update task event.
|
|
112
|
+
*/
|
|
113
|
+
moveTaskToAgent: (taskId: string, newAgentId: string) => Promise<TaskResponse>;
|
|
114
|
+
/**
|
|
115
|
+
* Utility function to set task priority.
|
|
116
|
+
* @param {string} taskId - The task ID.
|
|
117
|
+
* @param {'low' | 'medium' | 'high'} priority - The priority level.
|
|
118
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the update task event.
|
|
119
|
+
*/
|
|
120
|
+
setTaskPriority: (taskId: string, priority: 'low' | 'medium' | 'high') => Promise<TaskResponse>;
|
|
121
|
+
/**
|
|
122
|
+
* Utility function to add tags to a task.
|
|
123
|
+
* @param {string} taskId - The task ID.
|
|
124
|
+
* @param {string[]} tags - The tags to add.
|
|
125
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the update task event.
|
|
126
|
+
*/
|
|
127
|
+
addTaskTags: (taskId: string, tags: string[]) => Promise<TaskResponse>;
|
|
128
|
+
/**
|
|
129
|
+
* Utility function to create a quick task with minimal parameters.
|
|
130
|
+
* @param {string} title - The task title.
|
|
131
|
+
* @param {string} agentId - The agent ID (optional, defaults to 'default-agent').
|
|
132
|
+
* @param {string} category - The category (optional).
|
|
133
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the add task event.
|
|
20
134
|
*/
|
|
21
|
-
|
|
135
|
+
createQuickTask: (title: string, agentId?: string, category?: string) => Promise<TaskResponse>;
|
|
22
136
|
};
|
|
137
|
+
export type { Task, SubTask, TaskResponse, TaskCreateOptions, TaskUpdateOptions, AddSubTaskOptions, UpdateSubTaskOptions, TaskFilterOptions, TaskMarkdownImportOptions, TaskMarkdownExportOptions };
|
|
23
138
|
export default taskplaner;
|
package/dist/modules/task.js
CHANGED
|
@@ -5,46 +5,288 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const websocket_1 = __importDefault(require("../core/websocket"));
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Enhanced task planner with agent-based organization and comprehensive task management.
|
|
9
9
|
*/
|
|
10
10
|
const taskplaner = {
|
|
11
11
|
/**
|
|
12
|
-
* Adds a task
|
|
13
|
-
* @param {
|
|
14
|
-
* @returns {Promise<
|
|
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
15
|
*/
|
|
16
|
-
addTask: async (
|
|
16
|
+
addTask: async (params) => {
|
|
17
|
+
const { title, agentId = 'default-agent', description, phase, category, priority, tags } = params;
|
|
17
18
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
type: "taskEvent",
|
|
20
|
+
action: "addTask",
|
|
21
|
+
agentId: agentId,
|
|
20
22
|
message: {
|
|
21
|
-
|
|
23
|
+
title: title,
|
|
24
|
+
description: description,
|
|
25
|
+
phase: phase,
|
|
26
|
+
category: category,
|
|
27
|
+
priority: priority,
|
|
28
|
+
tags: tags
|
|
22
29
|
}
|
|
23
30
|
}, "addTaskResponse");
|
|
24
31
|
},
|
|
25
32
|
/**
|
|
26
|
-
*
|
|
27
|
-
* @
|
|
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.
|
|
28
37
|
*/
|
|
29
|
-
|
|
38
|
+
addSimpleTask: async (task, agentId = 'default-agent') => {
|
|
30
39
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
31
|
-
|
|
32
|
-
|
|
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
|
|
33
58
|
}, "getTasksResponse");
|
|
34
59
|
},
|
|
35
60
|
/**
|
|
36
|
-
*
|
|
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.
|
|
37
117
|
* @param {string} task - The updated task information.
|
|
38
|
-
* @returns {Promise<
|
|
118
|
+
* @returns {Promise<TaskResponse>} A promise that resolves with the response from the update task event.
|
|
39
119
|
*/
|
|
40
|
-
|
|
120
|
+
updateSimpleTask: async (taskId, task) => {
|
|
41
121
|
return websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
42
|
-
|
|
43
|
-
|
|
122
|
+
type: "taskEvent",
|
|
123
|
+
action: "updateTask",
|
|
44
124
|
message: {
|
|
45
|
-
|
|
125
|
+
taskId: taskId,
|
|
126
|
+
task: task
|
|
46
127
|
}
|
|
47
|
-
}, "
|
|
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
|
+
});
|
|
48
290
|
}
|
|
49
291
|
};
|
|
50
292
|
exports.default = taskplaner;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Notification Functions
|
|
3
|
+
*
|
|
4
|
+
* This module provides functions for sending agent-related notifications,
|
|
5
|
+
* including subagent task operations and completions.
|
|
6
|
+
*/
|
|
7
|
+
import { AgentNotifications } from '../types/notificationFunctions/agent';
|
|
8
|
+
/**
|
|
9
|
+
* Sends a request to start a subagent task
|
|
10
|
+
*
|
|
11
|
+
* @param parentAgentId - The parent agent ID
|
|
12
|
+
* @param subagentId - The subagent ID
|
|
13
|
+
* @param task - The task description
|
|
14
|
+
* @param priority - Optional task priority
|
|
15
|
+
* @param dependencies - Optional array of dependencies
|
|
16
|
+
* @param toolUseId - Optional custom toolUseId, will be generated if not provided
|
|
17
|
+
*
|
|
18
|
+
* Requirements: 1.1 - WHEN I call `codebolt.notify.agent.StartSubagentTaskRequestNotify()` THEN the system SHALL send a StartSubagentTaskRequestNotification via WebSocket
|
|
19
|
+
*/
|
|
20
|
+
export declare function StartSubagentTaskRequestNotify(parentAgentId: string, subagentId: string, task: string, priority?: string, dependencies?: string[], toolUseId?: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Sends a response to a subagent task request
|
|
23
|
+
*
|
|
24
|
+
* @param content - The response content (string or any object)
|
|
25
|
+
* @param isError - Whether this is an error response (default: false)
|
|
26
|
+
* @param toolUseId - Optional custom toolUseId, will be generated if not provided
|
|
27
|
+
*
|
|
28
|
+
* Requirements: 1.2 - WHEN I call `codebolt.notify.agent.StartSubagentTaskResponseNotify()` THEN the system SHALL send a StartSubagentTaskResponseNotification via WebSocket
|
|
29
|
+
*/
|
|
30
|
+
export declare function StartSubagentTaskResponseNotify(content: string | any, isError?: boolean, toolUseId?: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* Notifies that a subagent task has been completed
|
|
33
|
+
*
|
|
34
|
+
* @param parentAgentId - The parent agent ID
|
|
35
|
+
* @param subagentId - The subagent ID
|
|
36
|
+
* @param taskId - The task ID
|
|
37
|
+
* @param result - The task result
|
|
38
|
+
* @param status - The task status
|
|
39
|
+
* @param toolUseId - Optional custom toolUseId, will be generated if not provided
|
|
40
|
+
*
|
|
41
|
+
* Requirements: 1.3 - WHEN I call `codebolt.notify.agent.SubagentTaskCompletedNotify()` THEN the system SHALL send a SubagentTaskCompletedNotification via WebSocket
|
|
42
|
+
*/
|
|
43
|
+
export declare function SubagentTaskCompletedNotify(parentAgentId: string, subagentId: string, taskId: string, result: any, status: string, toolUseId?: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* Agent notification functions object
|
|
46
|
+
*/
|
|
47
|
+
export declare const agentNotifications: AgentNotifications;
|
|
48
|
+
export default agentNotifications;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Agent Notification Functions
|
|
4
|
+
*
|
|
5
|
+
* This module provides functions for sending agent-related notifications,
|
|
6
|
+
* including subagent task operations and completions.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.agentNotifications = exports.SubagentTaskCompletedNotify = exports.StartSubagentTaskResponseNotify = exports.StartSubagentTaskRequestNotify = void 0;
|
|
10
|
+
const utils_1 = require("./utils");
|
|
11
|
+
/**
|
|
12
|
+
* Sends a request to start a subagent task
|
|
13
|
+
*
|
|
14
|
+
* @param parentAgentId - The parent agent ID
|
|
15
|
+
* @param subagentId - The subagent ID
|
|
16
|
+
* @param task - The task description
|
|
17
|
+
* @param priority - Optional task priority
|
|
18
|
+
* @param dependencies - Optional array of dependencies
|
|
19
|
+
* @param toolUseId - Optional custom toolUseId, will be generated if not provided
|
|
20
|
+
*
|
|
21
|
+
* Requirements: 1.1 - WHEN I call `codebolt.notify.agent.StartSubagentTaskRequestNotify()` THEN the system SHALL send a StartSubagentTaskRequestNotification via WebSocket
|
|
22
|
+
*/
|
|
23
|
+
function StartSubagentTaskRequestNotify(parentAgentId, subagentId, task, priority, dependencies, toolUseId) {
|
|
24
|
+
// Validate required fields
|
|
25
|
+
if (!(0, utils_1.validateRequiredFields)({ parentAgentId, subagentId, task }, ['parentAgentId', 'subagentId', 'task'], 'agent.StartSubagentTaskRequestNotify')) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
// Create the notification
|
|
29
|
+
const notification = {
|
|
30
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
31
|
+
type: "agentnotify",
|
|
32
|
+
action: "startSubagentTaskRequest",
|
|
33
|
+
data: {
|
|
34
|
+
parentAgentId: parentAgentId,
|
|
35
|
+
subagentId: subagentId,
|
|
36
|
+
task: task,
|
|
37
|
+
priority: priority,
|
|
38
|
+
dependencies: dependencies
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
// Send the notification
|
|
42
|
+
(0, utils_1.sendNotification)(notification, 'agent.StartSubagentTaskRequestNotify');
|
|
43
|
+
}
|
|
44
|
+
exports.StartSubagentTaskRequestNotify = StartSubagentTaskRequestNotify;
|
|
45
|
+
/**
|
|
46
|
+
* Sends a response to a subagent task request
|
|
47
|
+
*
|
|
48
|
+
* @param content - The response content (string or any object)
|
|
49
|
+
* @param isError - Whether this is an error response (default: false)
|
|
50
|
+
* @param toolUseId - Optional custom toolUseId, will be generated if not provided
|
|
51
|
+
*
|
|
52
|
+
* Requirements: 1.2 - WHEN I call `codebolt.notify.agent.StartSubagentTaskResponseNotify()` THEN the system SHALL send a StartSubagentTaskResponseNotification via WebSocket
|
|
53
|
+
*/
|
|
54
|
+
function StartSubagentTaskResponseNotify(content, isError = false, toolUseId) {
|
|
55
|
+
// Validate content is provided
|
|
56
|
+
if (content === null || content === undefined) {
|
|
57
|
+
console.error('[NotificationFunctions] Content is required for agent.StartSubagentTaskResponseNotify');
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
// Create the notification
|
|
61
|
+
const notification = {
|
|
62
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
63
|
+
type: "agentnotify",
|
|
64
|
+
action: "startSubagentTaskResult",
|
|
65
|
+
content: content,
|
|
66
|
+
isError: isError
|
|
67
|
+
};
|
|
68
|
+
// Send the notification
|
|
69
|
+
(0, utils_1.sendNotification)(notification, 'agent.StartSubagentTaskResponseNotify');
|
|
70
|
+
}
|
|
71
|
+
exports.StartSubagentTaskResponseNotify = StartSubagentTaskResponseNotify;
|
|
72
|
+
/**
|
|
73
|
+
* Notifies that a subagent task has been completed
|
|
74
|
+
*
|
|
75
|
+
* @param parentAgentId - The parent agent ID
|
|
76
|
+
* @param subagentId - The subagent ID
|
|
77
|
+
* @param taskId - The task ID
|
|
78
|
+
* @param result - The task result
|
|
79
|
+
* @param status - The task status
|
|
80
|
+
* @param toolUseId - Optional custom toolUseId, will be generated if not provided
|
|
81
|
+
*
|
|
82
|
+
* Requirements: 1.3 - WHEN I call `codebolt.notify.agent.SubagentTaskCompletedNotify()` THEN the system SHALL send a SubagentTaskCompletedNotification via WebSocket
|
|
83
|
+
*/
|
|
84
|
+
function SubagentTaskCompletedNotify(parentAgentId, subagentId, taskId, result, status, toolUseId) {
|
|
85
|
+
// Validate required fields
|
|
86
|
+
if (!(0, utils_1.validateRequiredFields)({ parentAgentId, subagentId, taskId, result, status }, ['parentAgentId', 'subagentId', 'taskId', 'result', 'status'], 'agent.SubagentTaskCompletedNotify')) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
// Create the notification
|
|
90
|
+
const notification = {
|
|
91
|
+
toolUseId: toolUseId || (0, utils_1.generateToolUseId)(),
|
|
92
|
+
type: "agentnotify",
|
|
93
|
+
action: "subagentTaskCompleted",
|
|
94
|
+
data: {
|
|
95
|
+
parentAgentId: parentAgentId,
|
|
96
|
+
subagentId: subagentId,
|
|
97
|
+
taskId: taskId,
|
|
98
|
+
result: result,
|
|
99
|
+
status: status
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
// Send the notification
|
|
103
|
+
(0, utils_1.sendNotification)(notification, 'agent.SubagentTaskCompletedNotify');
|
|
104
|
+
}
|
|
105
|
+
exports.SubagentTaskCompletedNotify = SubagentTaskCompletedNotify;
|
|
106
|
+
/**
|
|
107
|
+
* Agent notification functions object
|
|
108
|
+
*/
|
|
109
|
+
exports.agentNotifications = {
|
|
110
|
+
StartSubagentTaskRequestNotify,
|
|
111
|
+
StartSubagentTaskResponseNotify,
|
|
112
|
+
SubagentTaskCompletedNotify
|
|
113
|
+
};
|
|
114
|
+
// Default export
|
|
115
|
+
exports.default = exports.agentNotifications;
|