@codebolt/codeboltjs 5.0.5 → 5.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/Codebolt.d.ts +63 -63
- package/dist/core/Codebolt.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/modules/actionPlan.d.ts +6 -18
- package/dist/modules/agentEventQueue.d.ts +42 -0
- package/dist/modules/agentEventQueue.js +168 -16
- package/dist/modules/backgroundChildThreads.d.ts +16 -17
- package/dist/modules/backgroundChildThreads.js +17 -12
- package/dist/modules/browser.d.ts +7 -6
- package/dist/modules/browser.js +4 -4
- package/dist/modules/chat.d.ts +10 -14
- package/dist/modules/chat.js +7 -5
- package/dist/modules/mail.d.ts +2 -91
- package/dist/modules/orchestrator.d.ts +3 -43
- package/dist/modules/orchestrator.js +1 -1
- package/dist/modules/terminal.d.ts +2 -2
- package/dist/modules/thread.d.ts +12 -10
- package/dist/modules/thread.js +11 -7
- package/dist/tools/actionPlan/action-plan-add-task.d.ts +3 -2
- package/dist/tools/agentEventQueue/eventqueue-send-message.js +1 -1
- package/dist/tools/chat/chat-send.d.ts +1 -1
- package/dist/tools/planning/plan-add-task.d.ts +2 -22
- package/dist/tools/thread/thread-create-background.d.ts +7 -3
- package/dist/tools/thread/thread-create-background.js +31 -11
- package/package.json +5 -4
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { BackgroundAgentData, BackgroundAgentCompletion, BackgroundExternalEvent } from '@codebolt/types/sdk';
|
|
2
|
+
export type { BackgroundAgentData, BackgroundAgentCompletion, BackgroundExternalEvent };
|
|
1
3
|
/**
|
|
2
4
|
* Background Child Threads module for tracking and managing background agent threads.
|
|
3
5
|
* This module provides APIs for tracking running background agents and their completion.
|
|
@@ -5,11 +7,11 @@
|
|
|
5
7
|
declare const backgroundChildThreads: {
|
|
6
8
|
/**
|
|
7
9
|
* Adds a running background agent to tracking.
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
10
|
+
* @param threadId - The thread ID
|
|
11
|
+
* @param data - The agent data
|
|
12
|
+
* @param groupId - Optional group ID
|
|
11
13
|
*/
|
|
12
|
-
addRunningAgent: (threadId: string, data:
|
|
14
|
+
addRunningAgent: (threadId: string, data: BackgroundAgentData, groupId?: string) => void;
|
|
13
15
|
/**
|
|
14
16
|
* Gets the number of currently running background agents.
|
|
15
17
|
* @returns {number} The count
|
|
@@ -17,32 +19,29 @@ declare const backgroundChildThreads: {
|
|
|
17
19
|
getRunningAgentCount: () => number;
|
|
18
20
|
/**
|
|
19
21
|
* Checks if any background agent has completed.
|
|
20
|
-
* @returns
|
|
22
|
+
* @returns The completion data if available, or null
|
|
21
23
|
*/
|
|
22
|
-
checkForBackgroundAgentCompletion: () =>
|
|
24
|
+
checkForBackgroundAgentCompletion: () => BackgroundAgentCompletion[] | null;
|
|
23
25
|
/**
|
|
24
26
|
* Waits for background agent completion.
|
|
25
|
-
* @returns
|
|
27
|
+
* @returns A promise that resolves with the completion data
|
|
26
28
|
*/
|
|
27
|
-
onBackgroundAgentCompletion: () => Promise<
|
|
29
|
+
onBackgroundAgentCompletion: () => Promise<BackgroundAgentCompletion[] | null>;
|
|
28
30
|
/**
|
|
29
31
|
* Checks if any grouped background agent has completed.
|
|
30
|
-
* @returns
|
|
32
|
+
* @returns The completion data if available, or null
|
|
31
33
|
*/
|
|
32
|
-
checkForBackgroundGroupedAgentCompletion: () =>
|
|
34
|
+
checkForBackgroundGroupedAgentCompletion: () => BackgroundAgentCompletion | null;
|
|
33
35
|
/**
|
|
34
36
|
* Waits for grouped background agent completion.
|
|
35
|
-
* @returns
|
|
37
|
+
* @returns A promise that resolves with the completion data
|
|
36
38
|
*/
|
|
37
|
-
onBackgroundGroupedAgentCompletion: () => Promise<
|
|
39
|
+
onBackgroundGroupedAgentCompletion: () => Promise<BackgroundAgentCompletion | null>;
|
|
38
40
|
/**
|
|
39
41
|
* Waits for any external event (background agent completion, grouped agent completion, or agent event).
|
|
40
42
|
* Returns the first event that occurs.
|
|
41
|
-
* @returns
|
|
43
|
+
* @returns A promise that resolves with the event type and data
|
|
42
44
|
*/
|
|
43
|
-
waitForAnyExternalEvent: () => Promise<
|
|
44
|
-
type: string;
|
|
45
|
-
data: any;
|
|
46
|
-
}>;
|
|
45
|
+
waitForAnyExternalEvent: () => Promise<BackgroundExternalEvent>;
|
|
47
46
|
};
|
|
48
47
|
export default backgroundChildThreads;
|
|
@@ -23,6 +23,8 @@ const cleanupAgentGroup = (threadId) => {
|
|
|
23
23
|
};
|
|
24
24
|
// Handler for background agent completion messages
|
|
25
25
|
const handleBackgroundAgentCompletion = (message) => {
|
|
26
|
+
if (!message.threadId)
|
|
27
|
+
return;
|
|
26
28
|
// Add to completed queue for orchestrator to process
|
|
27
29
|
completedBackgroundAgents.set(message.threadId, message);
|
|
28
30
|
// Remove from running map since agent is now complete
|
|
@@ -37,7 +39,7 @@ backgroundAgentSubscription.on('message', handleBackgroundAgentCompletion);
|
|
|
37
39
|
const threadCompletedSubscription = websocket_1.default.messageManager.subscribe('ThreadCompleted');
|
|
38
40
|
threadCompletedSubscription.on('message', (message) => {
|
|
39
41
|
// Only handle if this thread was a background agent
|
|
40
|
-
if (runningBackgroundAgents.has(message.threadId)) {
|
|
42
|
+
if (message.threadId && runningBackgroundAgents.has(message.threadId)) {
|
|
41
43
|
handleBackgroundAgentCompletion(message);
|
|
42
44
|
// Also emit on the backgroundAgentSubscription for waiters
|
|
43
45
|
backgroundAgentSubscription.emit('message', message);
|
|
@@ -45,7 +47,9 @@ threadCompletedSubscription.on('message', (message) => {
|
|
|
45
47
|
});
|
|
46
48
|
const groupedAgentSubscription = websocket_1.default.messageManager.subscribe('backgroundGroupedAgentCompletion');
|
|
47
49
|
groupedAgentSubscription.on('message', (message) => {
|
|
48
|
-
|
|
50
|
+
if (message.threadId) {
|
|
51
|
+
groupedAgentCompletionMap.set(message.threadId, message);
|
|
52
|
+
}
|
|
49
53
|
});
|
|
50
54
|
/**
|
|
51
55
|
* Background Child Threads module for tracking and managing background agent threads.
|
|
@@ -54,9 +58,9 @@ groupedAgentSubscription.on('message', (message) => {
|
|
|
54
58
|
const backgroundChildThreads = {
|
|
55
59
|
/**
|
|
56
60
|
* Adds a running background agent to tracking.
|
|
57
|
-
* @param
|
|
58
|
-
* @param
|
|
59
|
-
* @param
|
|
61
|
+
* @param threadId - The thread ID
|
|
62
|
+
* @param data - The agent data
|
|
63
|
+
* @param groupId - Optional group ID
|
|
60
64
|
*/
|
|
61
65
|
addRunningAgent: (threadId, data, groupId) => {
|
|
62
66
|
runningBackgroundAgents.set(threadId, data);
|
|
@@ -76,7 +80,7 @@ const backgroundChildThreads = {
|
|
|
76
80
|
},
|
|
77
81
|
/**
|
|
78
82
|
* Checks if any background agent has completed.
|
|
79
|
-
* @returns
|
|
83
|
+
* @returns The completion data if available, or null
|
|
80
84
|
*/
|
|
81
85
|
checkForBackgroundAgentCompletion: () => {
|
|
82
86
|
if (completedBackgroundAgents.size > 0) {
|
|
@@ -88,7 +92,7 @@ const backgroundChildThreads = {
|
|
|
88
92
|
},
|
|
89
93
|
/**
|
|
90
94
|
* Waits for background agent completion.
|
|
91
|
-
* @returns
|
|
95
|
+
* @returns A promise that resolves with the completion data
|
|
92
96
|
*/
|
|
93
97
|
onBackgroundAgentCompletion: async () => {
|
|
94
98
|
const completion = backgroundChildThreads.checkForBackgroundAgentCompletion();
|
|
@@ -103,12 +107,13 @@ const backgroundChildThreads = {
|
|
|
103
107
|
},
|
|
104
108
|
/**
|
|
105
109
|
* Checks if any grouped background agent has completed.
|
|
106
|
-
* @returns
|
|
110
|
+
* @returns The completion data if available, or null
|
|
107
111
|
*/
|
|
108
112
|
checkForBackgroundGroupedAgentCompletion: () => {
|
|
109
113
|
if (groupedAgentCompletionMap.size > 0) {
|
|
110
|
-
const
|
|
111
|
-
if (
|
|
114
|
+
const entry = groupedAgentCompletionMap.entries().next().value;
|
|
115
|
+
if (entry) {
|
|
116
|
+
const [key, value] = entry;
|
|
112
117
|
groupedAgentCompletionMap.delete(key);
|
|
113
118
|
return value;
|
|
114
119
|
}
|
|
@@ -117,7 +122,7 @@ const backgroundChildThreads = {
|
|
|
117
122
|
},
|
|
118
123
|
/**
|
|
119
124
|
* Waits for grouped background agent completion.
|
|
120
|
-
* @returns
|
|
125
|
+
* @returns A promise that resolves with the completion data
|
|
121
126
|
*/
|
|
122
127
|
onBackgroundGroupedAgentCompletion: async () => {
|
|
123
128
|
const completion = backgroundChildThreads.checkForBackgroundGroupedAgentCompletion();
|
|
@@ -133,7 +138,7 @@ const backgroundChildThreads = {
|
|
|
133
138
|
/**
|
|
134
139
|
* Waits for any external event (background agent completion, grouped agent completion, or agent event).
|
|
135
140
|
* Returns the first event that occurs.
|
|
136
|
-
* @returns
|
|
141
|
+
* @returns A promise that resolves with the event type and data
|
|
137
142
|
*/
|
|
138
143
|
waitForAnyExternalEvent: async () => {
|
|
139
144
|
// First check if there are any already completed events
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { GoToPageResponse, UrlResponse, GetMarkdownResponse, HtmlReceived, ExtractTextResponse, GetContentResponse, BrowserActionResponseData, BrowserScreenshotResponse, BrowserInfoResponse, BrowserSnapshotResponse } from '@codebolt/types/sdk';
|
|
1
|
+
import { GoToPageResponse, UrlResponse, GetMarkdownResponse, HtmlReceived, ExtractTextResponse, GetContentResponse, BrowserActionResponseData, BrowserScreenshotResponse, BrowserInfoResponse, BrowserSnapshotResponse, BrowserOperationType, BrowserOperationParams, BrowserOperationResponse } from '@codebolt/types/sdk';
|
|
2
2
|
import type { BrowserInstanceOptions, BrowserOperationOptions, BrowserInstanceInfo, BrowserScreenshotOptions } from '../types/libFunctionTypes';
|
|
3
|
+
export type { BrowserOperationType, BrowserOperationParams, BrowserOperationResponse };
|
|
3
4
|
/**
|
|
4
5
|
* A module for interacting with a browser through WebSockets.
|
|
5
6
|
*/
|
|
@@ -148,12 +149,12 @@ declare const cbbrowser: {
|
|
|
148
149
|
closeBrowserInstance: (instanceId: string) => Promise<boolean>;
|
|
149
150
|
/**
|
|
150
151
|
* Execute action on specific browser instance
|
|
151
|
-
* @param
|
|
152
|
-
* @param
|
|
153
|
-
* @param
|
|
154
|
-
* @returns
|
|
152
|
+
* @param instanceId - The instance ID to execute on
|
|
153
|
+
* @param operation - The operation to execute
|
|
154
|
+
* @param params - Parameters for the operation
|
|
155
|
+
* @returns The operation result
|
|
155
156
|
*/
|
|
156
|
-
executeOnInstance: (instanceId: string, operation:
|
|
157
|
+
executeOnInstance: (instanceId: string, operation: BrowserOperationType, params: BrowserOperationParams) => Promise<BrowserOperationResponse>;
|
|
157
158
|
};
|
|
158
159
|
export default cbbrowser;
|
|
159
160
|
/***
|
package/dist/modules/browser.js
CHANGED
|
@@ -360,10 +360,10 @@ const cbbrowser = {
|
|
|
360
360
|
},
|
|
361
361
|
/**
|
|
362
362
|
* Execute action on specific browser instance
|
|
363
|
-
* @param
|
|
364
|
-
* @param
|
|
365
|
-
* @param
|
|
366
|
-
* @returns
|
|
363
|
+
* @param instanceId - The instance ID to execute on
|
|
364
|
+
* @param operation - The operation to execute
|
|
365
|
+
* @param params - Parameters for the operation
|
|
366
|
+
* @returns The operation result
|
|
367
367
|
*/
|
|
368
368
|
executeOnInstance: async (instanceId, operation, params) => {
|
|
369
369
|
// This will be implemented with proper backend communication
|
package/dist/modules/chat.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ChatMessage, UserMessage } from '@codebolt/types/sdk';
|
|
2
|
-
type
|
|
1
|
+
import { ChatMessage, UserMessage, ChatRequest, ChatResponseData, SteeringMessage, StopProcessMessage, ProcessControl, ProcessControlWithCleanup } from '@codebolt/types/sdk';
|
|
2
|
+
export type { ChatRequest, ChatResponseData, SteeringMessage, StopProcessMessage, ProcessControl, ProcessControlWithCleanup };
|
|
3
|
+
type RequestHandler = (request: ChatRequest, response: (data: ChatResponseData) => void) => Promise<void> | void;
|
|
3
4
|
/**
|
|
4
5
|
* Chat module to interact with the WebSocket server.
|
|
5
6
|
*/
|
|
@@ -17,8 +18,9 @@ declare const cbchat: {
|
|
|
17
18
|
/**
|
|
18
19
|
* Sends a message through the WebSocket connection.
|
|
19
20
|
* @param {string} message - The message to be sent.
|
|
21
|
+
* @param {object} payload - Optional additional payload data.
|
|
20
22
|
*/
|
|
21
|
-
sendMessage: (message: string, payload?:
|
|
23
|
+
sendMessage: (message: string, payload?: object) => void;
|
|
22
24
|
/**
|
|
23
25
|
* Waits for a reply to a sent message.
|
|
24
26
|
* @param {string} message - The message for which a reply is expected.
|
|
@@ -30,13 +32,7 @@ declare const cbchat: {
|
|
|
30
32
|
* @param {Function} onStopClicked - Callback function to handle stop process events.
|
|
31
33
|
* @returns An object containing a stopProcess method.
|
|
32
34
|
*/
|
|
33
|
-
processStarted: (onStopClicked?: (message:
|
|
34
|
-
stopProcess: () => void;
|
|
35
|
-
cleanup: () => void;
|
|
36
|
-
} | {
|
|
37
|
-
stopProcess: () => void;
|
|
38
|
-
cleanup?: undefined;
|
|
39
|
-
};
|
|
35
|
+
processStarted: (onStopClicked?: (message: StopProcessMessage) => void) => ProcessControl | ProcessControlWithCleanup;
|
|
40
36
|
/**
|
|
41
37
|
* Stops the ongoing process.
|
|
42
38
|
* Sends a specific message to the server to stop the process.
|
|
@@ -60,13 +56,13 @@ declare const cbchat: {
|
|
|
60
56
|
sendNotificationEvent: (notificationMessage: string, type: "debug" | "git" | "planner" | "browser" | "editor" | "terminal" | "preview") => void;
|
|
61
57
|
/**
|
|
62
58
|
* Checks if any steering message has been received.
|
|
63
|
-
* @returns
|
|
59
|
+
* @returns The message data if available, or null
|
|
64
60
|
*/
|
|
65
|
-
checkForSteeringMessage: () =>
|
|
61
|
+
checkForSteeringMessage: () => SteeringMessage | null;
|
|
66
62
|
/**
|
|
67
63
|
* Waits for a steering message.
|
|
68
|
-
* @returns
|
|
64
|
+
* @returns A promise that resolves with the message data
|
|
69
65
|
*/
|
|
70
|
-
onSteeringMessageReceived: () => Promise<
|
|
66
|
+
onSteeringMessageReceived: () => Promise<SteeringMessage | null>;
|
|
71
67
|
};
|
|
72
68
|
export default cbchat;
|
package/dist/modules/chat.js
CHANGED
|
@@ -8,7 +8,7 @@ const websocket_1 = __importDefault(require("../core/websocket"));
|
|
|
8
8
|
const crypto_1 = require("crypto");
|
|
9
9
|
const enum_1 = require("@codebolt/types/enum");
|
|
10
10
|
// Steering message state
|
|
11
|
-
|
|
11
|
+
const steeringMessageMap = new Map();
|
|
12
12
|
// Subscribe to steering messages
|
|
13
13
|
const steeringSubscription = websocket_1.default.messageManager.subscribe('steeringMessage');
|
|
14
14
|
steeringSubscription.on('message', (message) => {
|
|
@@ -62,6 +62,7 @@ const cbchat = {
|
|
|
62
62
|
/**
|
|
63
63
|
* Sends a message through the WebSocket connection.
|
|
64
64
|
* @param {string} message - The message to be sent.
|
|
65
|
+
* @param {object} payload - Optional additional payload data.
|
|
65
66
|
*/
|
|
66
67
|
sendMessage: (message, payload) => {
|
|
67
68
|
websocket_1.default.messageManager.send({
|
|
@@ -171,12 +172,13 @@ const cbchat = {
|
|
|
171
172
|
},
|
|
172
173
|
/**
|
|
173
174
|
* Checks if any steering message has been received.
|
|
174
|
-
* @returns
|
|
175
|
+
* @returns The message data if available, or null
|
|
175
176
|
*/
|
|
176
177
|
checkForSteeringMessage: () => {
|
|
177
178
|
if (steeringMessageMap.size > 0) {
|
|
178
|
-
const
|
|
179
|
-
if (
|
|
179
|
+
const entry = steeringMessageMap.entries().next().value;
|
|
180
|
+
if (entry) {
|
|
181
|
+
const [key, value] = entry;
|
|
180
182
|
steeringMessageMap.delete(key);
|
|
181
183
|
return value;
|
|
182
184
|
}
|
|
@@ -185,7 +187,7 @@ const cbchat = {
|
|
|
185
187
|
},
|
|
186
188
|
/**
|
|
187
189
|
* Waits for a steering message.
|
|
188
|
-
* @returns
|
|
190
|
+
* @returns A promise that resolves with the message data
|
|
189
191
|
*/
|
|
190
192
|
onSteeringMessageReceived: async () => {
|
|
191
193
|
const message = cbchat.checkForSteeringMessage();
|
package/dist/modules/mail.d.ts
CHANGED
|
@@ -1,94 +1,5 @@
|
|
|
1
|
-
import { IRegisterAgentParams, IRegisterAgentResponse, IFetchInboxParams, IFetchInboxResponse, ISendMessageParams, ISendMessageResponse, IReplyMessageParams, IReplyMessageResponse, IMarkReadParams, IMarkReadResponse, IAcknowledgeParams, IAcknowledgeResponse, ISearchParams, ISearchResponse, ISummarizeThreadParams, ISummarizeThreadResponse, IReserveFilesParams, IReserveFilesResponse, IReleaseFilesParams, IReleaseFilesResponse, IForceReserveFilesParams, IForceReserveFilesResponse, IListReservationsParams, IListReservationsResponse, ICheckConflictsParams, ICheckConflictsResponse } from '@codebolt/types/sdk';
|
|
2
|
-
export
|
|
3
|
-
success: boolean;
|
|
4
|
-
agents?: any[];
|
|
5
|
-
error?: string;
|
|
6
|
-
}
|
|
7
|
-
export interface IGetAgentParams {
|
|
8
|
-
agentId: string;
|
|
9
|
-
}
|
|
10
|
-
export interface IGetAgentResponse {
|
|
11
|
-
success: boolean;
|
|
12
|
-
agent?: any;
|
|
13
|
-
error?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface ICreateThreadParams {
|
|
16
|
-
subject: string;
|
|
17
|
-
participants: string[];
|
|
18
|
-
type?: 'agent-to-agent' | 'agent-to-user' | 'broadcast';
|
|
19
|
-
metadata?: Record<string, unknown>;
|
|
20
|
-
}
|
|
21
|
-
export interface ICreateThreadResponse {
|
|
22
|
-
success: boolean;
|
|
23
|
-
thread?: any;
|
|
24
|
-
error?: string;
|
|
25
|
-
}
|
|
26
|
-
export interface IFindOrCreateThreadParams {
|
|
27
|
-
subject: string;
|
|
28
|
-
participants: string[];
|
|
29
|
-
type?: 'agent-to-agent' | 'agent-to-user' | 'broadcast';
|
|
30
|
-
metadata?: Record<string, unknown>;
|
|
31
|
-
}
|
|
32
|
-
export interface IFindOrCreateThreadResponse {
|
|
33
|
-
success: boolean;
|
|
34
|
-
thread?: any;
|
|
35
|
-
created?: boolean;
|
|
36
|
-
error?: string;
|
|
37
|
-
}
|
|
38
|
-
export interface IListThreadsParams {
|
|
39
|
-
type?: 'agent-to-agent' | 'agent-to-user' | 'broadcast';
|
|
40
|
-
status?: 'open' | 'closed' | 'archived';
|
|
41
|
-
participant?: string;
|
|
42
|
-
search?: string;
|
|
43
|
-
limit?: number;
|
|
44
|
-
offset?: number;
|
|
45
|
-
}
|
|
46
|
-
export interface IListThreadsResponse {
|
|
47
|
-
success: boolean;
|
|
48
|
-
threads?: any[];
|
|
49
|
-
total?: number;
|
|
50
|
-
error?: string;
|
|
51
|
-
}
|
|
52
|
-
export interface IGetThreadParams {
|
|
53
|
-
threadId: string;
|
|
54
|
-
}
|
|
55
|
-
export interface IGetThreadResponse {
|
|
56
|
-
success: boolean;
|
|
57
|
-
thread?: any;
|
|
58
|
-
error?: string;
|
|
59
|
-
}
|
|
60
|
-
export interface IUpdateThreadStatusParams {
|
|
61
|
-
threadId: string;
|
|
62
|
-
status: 'open' | 'closed' | 'archived';
|
|
63
|
-
}
|
|
64
|
-
export interface IUpdateThreadStatusResponse {
|
|
65
|
-
success: boolean;
|
|
66
|
-
thread?: any;
|
|
67
|
-
error?: string;
|
|
68
|
-
}
|
|
69
|
-
export interface IArchiveThreadParams {
|
|
70
|
-
threadId: string;
|
|
71
|
-
}
|
|
72
|
-
export interface IArchiveThreadResponse {
|
|
73
|
-
success: boolean;
|
|
74
|
-
error?: string;
|
|
75
|
-
}
|
|
76
|
-
export interface IGetMessageParams {
|
|
77
|
-
messageId: string;
|
|
78
|
-
}
|
|
79
|
-
export interface IGetMessageResponse {
|
|
80
|
-
success: boolean;
|
|
81
|
-
message?: any;
|
|
82
|
-
error?: string;
|
|
83
|
-
}
|
|
84
|
-
export interface IGetMessagesParams {
|
|
85
|
-
threadId: string;
|
|
86
|
-
}
|
|
87
|
-
export interface IGetMessagesResponse {
|
|
88
|
-
success: boolean;
|
|
89
|
-
messages?: any[];
|
|
90
|
-
error?: string;
|
|
91
|
-
}
|
|
1
|
+
import { IRegisterAgentParams, IRegisterAgentResponse, IFetchInboxParams, IFetchInboxResponse, ISendMessageParams, ISendMessageResponse, IReplyMessageParams, IReplyMessageResponse, IMarkReadParams, IMarkReadResponse, IAcknowledgeParams, IAcknowledgeResponse, ISearchParams, ISearchResponse, ISummarizeThreadParams, ISummarizeThreadResponse, IReserveFilesParams, IReserveFilesResponse, IReleaseFilesParams, IReleaseFilesResponse, IForceReserveFilesParams, IForceReserveFilesResponse, IListReservationsParams, IListReservationsResponse, ICheckConflictsParams, ICheckConflictsResponse, MailAgentInfo, MailThread, MailMessage, IListAgentsResponse, IGetAgentParams, IGetAgentResponse, ICreateThreadParams, ICreateThreadResponse, IFindOrCreateThreadParams, IFindOrCreateThreadResponse, IListThreadsParams, IListThreadsResponse, IGetThreadParams, IGetThreadResponse, IUpdateThreadStatusParams, IUpdateThreadStatusResponse, IArchiveThreadParams, IArchiveThreadResponse, IGetMessageParams, IGetMessageResponse, IGetMessagesParams, IGetMessagesResponse } from '@codebolt/types/sdk';
|
|
2
|
+
export type { MailAgentInfo, MailThread, MailMessage, IListAgentsResponse, IGetAgentParams, IGetAgentResponse, ICreateThreadParams, ICreateThreadResponse, IFindOrCreateThreadParams, IFindOrCreateThreadResponse, IListThreadsParams, IListThreadsResponse, IGetThreadParams, IGetThreadResponse, IUpdateThreadStatusParams, IUpdateThreadStatusResponse, IArchiveThreadParams, IArchiveThreadResponse, IGetMessageParams, IGetMessageResponse, IGetMessagesParams, IGetMessagesResponse };
|
|
92
3
|
declare const cbmail: {
|
|
93
4
|
registerAgent: (params: IRegisterAgentParams) => Promise<IRegisterAgentResponse>;
|
|
94
5
|
listAgents: () => Promise<IListAgentsResponse>;
|
|
@@ -1,45 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
name: string;
|
|
4
|
-
description: string;
|
|
5
|
-
agentId: string;
|
|
6
|
-
defaultWorkerAgentId?: string | null;
|
|
7
|
-
threadId: string;
|
|
8
|
-
status: 'idle' | 'running' | 'paused';
|
|
9
|
-
metadata?: Record<string, any>;
|
|
10
|
-
createdAt: Date;
|
|
11
|
-
updatedAt: Date;
|
|
12
|
-
}
|
|
13
|
-
export interface OrchestratorResponse {
|
|
14
|
-
success: boolean;
|
|
15
|
-
requestId?: string;
|
|
16
|
-
data?: any;
|
|
17
|
-
error?: {
|
|
18
|
-
code: string;
|
|
19
|
-
message: string;
|
|
20
|
-
details?: any;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export interface CreateOrchestratorParams {
|
|
24
|
-
name: string;
|
|
25
|
-
description: string;
|
|
26
|
-
agentId: string;
|
|
27
|
-
defaultWorkerAgentId?: string;
|
|
28
|
-
metadata?: Record<string, any>;
|
|
29
|
-
}
|
|
30
|
-
export interface UpdateOrchestratorParams {
|
|
31
|
-
name?: string;
|
|
32
|
-
description?: string;
|
|
33
|
-
agentId?: string;
|
|
34
|
-
defaultWorkerAgentId?: string;
|
|
35
|
-
metadata?: Record<string, any>;
|
|
36
|
-
}
|
|
37
|
-
export interface UpdateOrchestratorSettingsParams {
|
|
38
|
-
name?: string;
|
|
39
|
-
description?: string;
|
|
40
|
-
defaultWorkerAgentId?: string;
|
|
41
|
-
metadata?: Record<string, any>;
|
|
42
|
-
}
|
|
1
|
+
import type { OrchestratorEventType, OrchestratorError, OrchestratorInstance, OrchestratorResponse, OrchestratorStatus, CreateOrchestratorParams, UpdateOrchestratorParams, UpdateOrchestratorSettingsParams, ListOrchestratorsResponse, GetOrchestratorResponse, CreateOrchestratorResponse, UpdateOrchestratorResponse, DeleteOrchestratorResponse, UpdateOrchestratorStatusResponse } from '@codebolt/types/sdk';
|
|
2
|
+
export type { OrchestratorEventType, OrchestratorError, OrchestratorInstance, OrchestratorResponse, OrchestratorStatus, CreateOrchestratorParams, UpdateOrchestratorParams, UpdateOrchestratorSettingsParams, ListOrchestratorsResponse, GetOrchestratorResponse, CreateOrchestratorResponse, UpdateOrchestratorResponse, DeleteOrchestratorResponse, UpdateOrchestratorStatusResponse };
|
|
43
3
|
declare const orchestrator: {
|
|
44
4
|
/**
|
|
45
5
|
* Lists all orchestrators
|
|
@@ -72,7 +32,7 @@ declare const orchestrator: {
|
|
|
72
32
|
/**
|
|
73
33
|
* Updates orchestrator status
|
|
74
34
|
*/
|
|
75
|
-
updateOrchestratorStatus: (orchestratorId: string, status:
|
|
35
|
+
updateOrchestratorStatus: (orchestratorId: string, status: OrchestratorStatus) => Promise<OrchestratorResponse>;
|
|
76
36
|
/**
|
|
77
37
|
* Initiates a Codebolt JS update
|
|
78
38
|
*/
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const websocket_1 = __importDefault(require("../core/websocket"));
|
|
7
|
-
// We use a custom event type string for orchestrator events since we can't add to the enum
|
|
7
|
+
// We use a custom event type string for orchestrator events since we can't add to the enum
|
|
8
8
|
// The server parses 'orchestrator.<action>' type strings
|
|
9
9
|
const ORCHESTRATOR_EVENT_PREFIX = 'orchestrator.';
|
|
10
10
|
const orchestrator = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
-
import { CommandError, TerminalInterruptResponse } from '@codebolt/types/sdk';
|
|
2
|
+
import { CommandError, CommandFinish, CommandOutput, TerminalInterruptResponse } from '@codebolt/types/sdk';
|
|
3
3
|
/**
|
|
4
4
|
* CustomEventEmitter class that extends the Node.js EventEmitter class.
|
|
5
5
|
*/
|
|
@@ -19,7 +19,7 @@ declare const cbterminal: {
|
|
|
19
19
|
* @param {string} command - The command to be executed.
|
|
20
20
|
* @returns {Promise<CommandOutput|CommandError>} A promise that resolves with the command's output, error, or finish signal.
|
|
21
21
|
*/
|
|
22
|
-
executeCommand: (command: string, returnEmptyStringOnSuccess?: boolean) => Promise<
|
|
22
|
+
executeCommand: (command: string, returnEmptyStringOnSuccess?: boolean) => Promise<CommandOutput | CommandError | CommandFinish>;
|
|
23
23
|
/**
|
|
24
24
|
* Executes a given command and keeps running until an error occurs.
|
|
25
25
|
* Listens for messages from the WebSocket and resolves the promise when an error is encountered.
|
package/dist/modules/thread.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ThreadFileChange, ThreadFileChangesResponse, ThreadFileChangesSummaryResponse } from '@codebolt/types/sdk';
|
|
2
|
+
import type { CreateThreadOptions, UpdateThreadOptions, GetThreadListOptions, GetThreadDetailOptions, GetThreadMessagesOptions, CreateAndStartThreadOptions } from '@codebolt/types/agent-to-app-ws-schema';
|
|
2
3
|
import type { CreateThreadResponse, ListThreadsResponse, GetThreadResponse, GetThreadMessagesResponse, UpdateThreadResponse, DeleteThreadResponse, StartThreadResponse, UpdateThreadStatusResponse, ThreadAgentStartedResponse, ThreadAgentStartFailedResponse } from '@codebolt/types/app-to-agent-ws-schema';
|
|
4
|
+
export type { ThreadFileChange, ThreadFileChangesResponse, ThreadFileChangesSummaryResponse };
|
|
3
5
|
/**
|
|
4
6
|
* Thread service for managing conversation threads.
|
|
5
7
|
* This module provides a comprehensive API for thread management using thread-specific types.
|
|
@@ -7,10 +9,10 @@ import type { CreateThreadResponse, ListThreadsResponse, GetThreadResponse, GetT
|
|
|
7
9
|
declare const threadService: {
|
|
8
10
|
/**
|
|
9
11
|
* Creates a new thread with comprehensive options.
|
|
10
|
-
* @param
|
|
11
|
-
* @returns
|
|
12
|
+
* @param options - The thread creation parameters
|
|
13
|
+
* @returns A promise that resolves with the thread creation response
|
|
12
14
|
*/
|
|
13
|
-
createThread: (options:
|
|
15
|
+
createThread: (options: CreateThreadOptions) => Promise<CreateThreadResponse>;
|
|
14
16
|
/**
|
|
15
17
|
* Creates and immediately starts a new thread.
|
|
16
18
|
* @param {CreateAndStartThreadOptions} options - The thread creation and start parameters
|
|
@@ -69,16 +71,16 @@ declare const threadService: {
|
|
|
69
71
|
getThreadMessages: (options: GetThreadMessagesOptions) => Promise<GetThreadMessagesResponse>;
|
|
70
72
|
/**
|
|
71
73
|
* Retrieves file changes associated with a specific thread.
|
|
72
|
-
* @param
|
|
73
|
-
* @returns
|
|
74
|
+
* @param threadId - The thread ID
|
|
75
|
+
* @returns A promise that resolves with the file changes
|
|
74
76
|
*/
|
|
75
|
-
getThreadFileChanges: (threadId: string) => Promise<
|
|
77
|
+
getThreadFileChanges: (threadId: string) => Promise<ThreadFileChangesResponse>;
|
|
76
78
|
/**
|
|
77
79
|
* Retrieves file changes summary for ChangesSummaryPanel.
|
|
78
80
|
* Returns data in the format: { title, changes, files }
|
|
79
|
-
* @param
|
|
80
|
-
* @returns
|
|
81
|
+
* @param threadId - The thread ID
|
|
82
|
+
* @returns A promise that resolves with the file changes summary
|
|
81
83
|
*/
|
|
82
|
-
getThreadFileChangesSummary: (threadId: string) => Promise<
|
|
84
|
+
getThreadFileChangesSummary: (threadId: string) => Promise<ThreadFileChangesSummaryResponse>;
|
|
83
85
|
};
|
|
84
86
|
export default threadService;
|
package/dist/modules/thread.js
CHANGED
|
@@ -13,8 +13,8 @@ const backgroundChildThreads_1 = __importDefault(require("./backgroundChildThrea
|
|
|
13
13
|
const threadService = {
|
|
14
14
|
/**
|
|
15
15
|
* Creates a new thread with comprehensive options.
|
|
16
|
-
* @param
|
|
17
|
-
* @returns
|
|
16
|
+
* @param options - The thread creation parameters
|
|
17
|
+
* @returns A promise that resolves with the thread creation response
|
|
18
18
|
*/
|
|
19
19
|
createThread: async (options) => {
|
|
20
20
|
const requestId = (0, crypto_1.randomUUID)();
|
|
@@ -39,7 +39,11 @@ const threadService = {
|
|
|
39
39
|
requestId,
|
|
40
40
|
message: options
|
|
41
41
|
};
|
|
42
|
-
|
|
42
|
+
const response = await websocket_1.default.messageManager.sendAndWaitForResponse(event, 'startThreadResponse');
|
|
43
|
+
if (response.threadId) {
|
|
44
|
+
backgroundChildThreads_1.default.addRunningAgent(response.threadId, response, options.groupId);
|
|
45
|
+
}
|
|
46
|
+
return response;
|
|
43
47
|
},
|
|
44
48
|
/**
|
|
45
49
|
* Creates a thread in the background and resolves when the agent starts or fails.
|
|
@@ -181,8 +185,8 @@ const threadService = {
|
|
|
181
185
|
},
|
|
182
186
|
/**
|
|
183
187
|
* Retrieves file changes associated with a specific thread.
|
|
184
|
-
* @param
|
|
185
|
-
* @returns
|
|
188
|
+
* @param threadId - The thread ID
|
|
189
|
+
* @returns A promise that resolves with the file changes
|
|
186
190
|
*/
|
|
187
191
|
getThreadFileChanges: async (threadId) => {
|
|
188
192
|
const requestId = (0, crypto_1.randomUUID)();
|
|
@@ -199,8 +203,8 @@ const threadService = {
|
|
|
199
203
|
/**
|
|
200
204
|
* Retrieves file changes summary for ChangesSummaryPanel.
|
|
201
205
|
* Returns data in the format: { title, changes, files }
|
|
202
|
-
* @param
|
|
203
|
-
* @returns
|
|
206
|
+
* @param threadId - The thread ID
|
|
207
|
+
* @returns A promise that resolves with the file changes summary
|
|
204
208
|
*/
|
|
205
209
|
getThreadFileChangesSummary: async (threadId) => {
|
|
206
210
|
const requestId = (0, crypto_1.randomUUID)();
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { ToolInvocation, ToolResult } from '../types';
|
|
2
2
|
import { BaseDeclarativeTool } from '../base-tool';
|
|
3
|
+
import type { TaskPriority, TaskStatus } from '@codebolt/types/sdk';
|
|
3
4
|
export interface AddTaskToActionPlanParams {
|
|
4
5
|
planId: string;
|
|
5
6
|
task: {
|
|
6
7
|
name: string;
|
|
7
8
|
description?: string;
|
|
8
|
-
priority?:
|
|
9
|
+
priority?: TaskPriority;
|
|
9
10
|
taskType?: string;
|
|
10
|
-
status?:
|
|
11
|
+
status?: TaskStatus;
|
|
11
12
|
assignedTo?: string;
|
|
12
13
|
estimatedTime?: number;
|
|
13
14
|
dependencies?: string[];
|
|
@@ -94,7 +94,7 @@ class EventQueueSendMessageTool extends base_tool_1.BaseDeclarativeTool {
|
|
|
94
94
|
description: 'Optional event ID this message is replying to'
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
|
-
required: ['targetAgentId', 'content']
|
|
97
|
+
required: ['targetAgentId', 'targetThreadId', 'content']
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
createInvocation(params) {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import type { ToolInvocation, ToolResult } from '../types';
|
|
6
6
|
import { BaseDeclarativeTool } from '../base-tool';
|
|
7
|
+
import type { ActionPlanTask } from '@codebolt/types/sdk';
|
|
7
8
|
/**
|
|
8
9
|
* Parameters for the PlanAddTask tool
|
|
9
10
|
*/
|
|
@@ -15,28 +16,7 @@ export interface PlanAddTaskToolParams {
|
|
|
15
16
|
/**
|
|
16
17
|
* The task to add to the action plan
|
|
17
18
|
*/
|
|
18
|
-
task:
|
|
19
|
-
/**
|
|
20
|
-
* The name/title of the task
|
|
21
|
-
*/
|
|
22
|
-
name: string;
|
|
23
|
-
/**
|
|
24
|
-
* Optional description of the task
|
|
25
|
-
*/
|
|
26
|
-
description?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Optional priority of the task
|
|
29
|
-
*/
|
|
30
|
-
priority?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Optional task type
|
|
33
|
-
*/
|
|
34
|
-
taskType?: string;
|
|
35
|
-
/**
|
|
36
|
-
* Any other task fields
|
|
37
|
-
*/
|
|
38
|
-
[key: string]: any;
|
|
39
|
-
};
|
|
19
|
+
task: ActionPlanTask;
|
|
40
20
|
}
|
|
41
21
|
/**
|
|
42
22
|
* Implementation of the PlanAddTask tool logic
|