@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
package/dist/core/Codebolt.d.ts
CHANGED
|
@@ -97,19 +97,19 @@ declare class Codebolt {
|
|
|
97
97
|
};
|
|
98
98
|
mail: {
|
|
99
99
|
registerAgent: (params: import("@codebolt/types/sdk").IRegisterAgentParams) => Promise<import("@codebolt/types/sdk").IRegisterAgentResponse>;
|
|
100
|
-
listAgents: () => Promise<import("
|
|
101
|
-
getAgent: (params: import("
|
|
102
|
-
createThread: (params: import("
|
|
103
|
-
findOrCreateThread: (params: import("
|
|
104
|
-
listThreads: (params?: import("
|
|
105
|
-
getThread: (params: import("
|
|
106
|
-
updateThreadStatus: (params: import("
|
|
107
|
-
archiveThread: (params: import("
|
|
100
|
+
listAgents: () => Promise<import("@codebolt/types/sdk").IListAgentsResponse>;
|
|
101
|
+
getAgent: (params: import("@codebolt/types/sdk").IGetAgentParams) => Promise<import("@codebolt/types/sdk").IGetAgentResponse>;
|
|
102
|
+
createThread: (params: import("@codebolt/types/sdk").ICreateThreadParams) => Promise<import("@codebolt/types/sdk").ICreateThreadResponse>;
|
|
103
|
+
findOrCreateThread: (params: import("@codebolt/types/sdk").IFindOrCreateThreadParams) => Promise<import("@codebolt/types/sdk").IFindOrCreateThreadResponse>;
|
|
104
|
+
listThreads: (params?: import("@codebolt/types/sdk").IListThreadsParams) => Promise<import("@codebolt/types/sdk").IListThreadsResponse>;
|
|
105
|
+
getThread: (params: import("@codebolt/types/sdk").IGetThreadParams) => Promise<import("@codebolt/types/sdk").IGetThreadResponse>;
|
|
106
|
+
updateThreadStatus: (params: import("@codebolt/types/sdk").IUpdateThreadStatusParams) => Promise<import("@codebolt/types/sdk").IUpdateThreadStatusResponse>;
|
|
107
|
+
archiveThread: (params: import("@codebolt/types/sdk").IArchiveThreadParams) => Promise<import("@codebolt/types/sdk").IArchiveThreadResponse>;
|
|
108
108
|
fetchInbox: (params: import("@codebolt/types/sdk").IFetchInboxParams) => Promise<import("@codebolt/types/sdk").IFetchInboxResponse>;
|
|
109
109
|
sendMessage: (params: import("@codebolt/types/sdk").ISendMessageParams) => Promise<import("@codebolt/types/sdk").ISendMessageResponse>;
|
|
110
110
|
replyMessage: (params: import("@codebolt/types/sdk").IReplyMessageParams) => Promise<import("@codebolt/types/sdk").IReplyMessageResponse>;
|
|
111
|
-
getMessage: (params: import("
|
|
112
|
-
getMessages: (params: import("
|
|
111
|
+
getMessage: (params: import("@codebolt/types/sdk").IGetMessageParams) => Promise<import("@codebolt/types/sdk").IGetMessageResponse>;
|
|
112
|
+
getMessages: (params: import("@codebolt/types/sdk").IGetMessagesParams) => Promise<import("@codebolt/types/sdk").IGetMessagesResponse>;
|
|
113
113
|
markRead: (params: import("@codebolt/types/sdk").IMarkReadParams) => Promise<import("@codebolt/types/sdk").IMarkReadResponse>;
|
|
114
114
|
acknowledge: (params: import("@codebolt/types/sdk").IAcknowledgeParams) => Promise<import("@codebolt/types/sdk").IAcknowledgeResponse>;
|
|
115
115
|
search: (params: import("@codebolt/types/sdk").ISearchParams) => Promise<import("@codebolt/types/sdk").ISearchResponse>;
|
|
@@ -165,27 +165,21 @@ declare class Codebolt {
|
|
|
165
165
|
instanceId: string;
|
|
166
166
|
}>;
|
|
167
167
|
closeBrowserInstance: (instanceId: string) => Promise<boolean>;
|
|
168
|
-
executeOnInstance: (instanceId: string, operation:
|
|
168
|
+
executeOnInstance: (instanceId: string, operation: import("@codebolt/types/sdk").BrowserOperationType, params: import("@codebolt/types/sdk").BrowserOperationParams) => Promise<import("@codebolt/types/sdk").BrowserOperationResponse>;
|
|
169
169
|
};
|
|
170
170
|
chat: {
|
|
171
171
|
getChatHistory: (threadId: string) => Promise<import("@codebolt/types/sdk").ChatMessage>;
|
|
172
|
-
setRequestHandler: (handler: (request:
|
|
173
|
-
sendMessage: (message: string, payload?:
|
|
172
|
+
setRequestHandler: (handler: (request: import("@codebolt/types/sdk").ChatRequest, response: (data: import("@codebolt/types/sdk").ChatResponseData) => void) => Promise<void> | void) => void;
|
|
173
|
+
sendMessage: (message: string, payload?: object) => void;
|
|
174
174
|
waitforReply: (message: string) => Promise<import("@codebolt/types/sdk").UserMessage>;
|
|
175
|
-
processStarted: (onStopClicked?: (message:
|
|
176
|
-
stopProcess: () => void;
|
|
177
|
-
cleanup: () => void;
|
|
178
|
-
} | {
|
|
179
|
-
stopProcess: () => void;
|
|
180
|
-
cleanup?: undefined;
|
|
181
|
-
};
|
|
175
|
+
processStarted: (onStopClicked?: (message: import("@codebolt/types/sdk").StopProcessMessage) => void) => import("@codebolt/types/sdk").ProcessControl | import("@codebolt/types/sdk").ProcessControlWithCleanup;
|
|
182
176
|
stopProcess: () => void;
|
|
183
177
|
processFinished: () => void;
|
|
184
178
|
sendConfirmationRequest: (confirmationMessage: string, buttons?: string[], withFeedback?: boolean) => Promise<string>;
|
|
185
179
|
askQuestion: (question: string, buttons?: string[], withFeedback?: boolean) => Promise<string>;
|
|
186
180
|
sendNotificationEvent: (notificationMessage: string, type: "debug" | "git" | "planner" | "browser" | "editor" | "terminal" | "preview") => void;
|
|
187
|
-
checkForSteeringMessage: () =>
|
|
188
|
-
onSteeringMessageReceived: () => Promise<
|
|
181
|
+
checkForSteeringMessage: () => import("@codebolt/types/sdk").SteeringMessage | null;
|
|
182
|
+
onSteeringMessageReceived: () => Promise<import("@codebolt/types/sdk").SteeringMessage | null>;
|
|
189
183
|
};
|
|
190
184
|
terminal: {
|
|
191
185
|
eventEmitter: {
|
|
@@ -207,7 +201,7 @@ declare class Codebolt {
|
|
|
207
201
|
prependOnceListener<K>(eventName: string | symbol, listener: (...args: any[]) => void): /*elided*/ any;
|
|
208
202
|
eventNames(): (string | symbol)[];
|
|
209
203
|
};
|
|
210
|
-
executeCommand: (command: string, returnEmptyStringOnSuccess?: boolean) => Promise<
|
|
204
|
+
executeCommand: (command: string, returnEmptyStringOnSuccess?: boolean) => Promise<import("@codebolt/types/sdk").CommandOutput | import("@codebolt/types/sdk").CommandError | import("@codebolt/types/sdk").CommandFinish>;
|
|
211
205
|
executeCommandRunUntilError: (command: string, executeInMain?: boolean) => Promise<import("@codebolt/types/sdk").CommandError>;
|
|
212
206
|
executeCommandRunUntilInterrupt: (command: string, executeInMain?: boolean) => Promise<import("@codebolt/types/sdk").CommandError>;
|
|
213
207
|
sendManualInterrupt(): Promise<import("@codebolt/types/sdk").TerminalInterruptResponse>;
|
|
@@ -296,7 +290,7 @@ declare class Codebolt {
|
|
|
296
290
|
getTaskSummary: (taskId: string) => Promise<string | undefined>;
|
|
297
291
|
};
|
|
298
292
|
thread: {
|
|
299
|
-
createThread: (options:
|
|
293
|
+
createThread: (options: import("@codebolt/types/agent-to-app-ws-schema").CreateThreadOptions) => Promise<import("@codebolt/types/app-to-agent-ws-schema").CreateThreadResponse>;
|
|
300
294
|
createAndStartThread: (options: import("@codebolt/types/agent-to-app-ws-schema").CreateAndStartThreadOptions) => Promise<import("@codebolt/types/app-to-agent-ws-schema").StartThreadResponse>;
|
|
301
295
|
createThreadInBackground: (options: import("@codebolt/types/agent-to-app-ws-schema").CreateAndStartThreadOptions) => Promise<import("@codebolt/types/app-to-agent-ws-schema").ThreadAgentStartedResponse | import("@codebolt/types/app-to-agent-ws-schema").ThreadAgentStartFailedResponse>;
|
|
302
296
|
getThreadList: (options?: import("@codebolt/types/agent-to-app-ws-schema").GetThreadListOptions) => Promise<import("@codebolt/types/app-to-agent-ws-schema").ListThreadsResponse>;
|
|
@@ -306,8 +300,8 @@ declare class Codebolt {
|
|
|
306
300
|
deleteThread: (threadId: string) => Promise<import("@codebolt/types/app-to-agent-ws-schema").DeleteThreadResponse>;
|
|
307
301
|
updateThreadStatus: (threadId: string, status: string) => Promise<import("@codebolt/types/app-to-agent-ws-schema").UpdateThreadStatusResponse>;
|
|
308
302
|
getThreadMessages: (options: import("@codebolt/types/agent-to-app-ws-schema").GetThreadMessagesOptions) => Promise<import("@codebolt/types/app-to-agent-ws-schema").GetThreadMessagesResponse>;
|
|
309
|
-
getThreadFileChanges: (threadId: string) => Promise<
|
|
310
|
-
getThreadFileChangesSummary: (threadId: string) => Promise<
|
|
303
|
+
getThreadFileChanges: (threadId: string) => Promise<import("@codebolt/types/sdk").ThreadFileChangesResponse>;
|
|
304
|
+
getThreadFileChangesSummary: (threadId: string) => Promise<import("@codebolt/types/sdk").ThreadFileChangesSummaryResponse>;
|
|
311
305
|
};
|
|
312
306
|
vectordb: {
|
|
313
307
|
getVector: (key: string) => Promise<import("@codebolt/types/sdk").GetVectorResponse>;
|
|
@@ -390,25 +384,11 @@ declare class Codebolt {
|
|
|
390
384
|
status?: string;
|
|
391
385
|
planId?: string;
|
|
392
386
|
}) => Promise<any>;
|
|
393
|
-
updateActionPlan: (planId: string, updateData:
|
|
394
|
-
addTaskToActionPlan: (planId: string, task:
|
|
395
|
-
|
|
396
|
-
description?: string;
|
|
397
|
-
priority?: string;
|
|
398
|
-
taskType?: string;
|
|
399
|
-
[key: string]: any;
|
|
400
|
-
}) => Promise<any>;
|
|
401
|
-
addGroupToActionPlan: (planId: string, group: {
|
|
402
|
-
type: "parallelGroup" | "loopGroup" | "ifGroup" | "waitUntilGroup";
|
|
403
|
-
name?: string;
|
|
404
|
-
groupItems?: Record<string, any[]>;
|
|
405
|
-
loopTasks?: any[];
|
|
406
|
-
ifTasks?: any[];
|
|
407
|
-
waitTasks?: any[];
|
|
408
|
-
[key: string]: any;
|
|
409
|
-
}) => Promise<any>;
|
|
387
|
+
updateActionPlan: (planId: string, updateData: import("@codebolt/types/sdk").ActionPlanUpdateData) => Promise<any>;
|
|
388
|
+
addTaskToActionPlan: (planId: string, task: import("@codebolt/types/sdk").ActionPlanTask) => Promise<any>;
|
|
389
|
+
addGroupToActionPlan: (planId: string, group: import("@codebolt/types/sdk").ActionPlanGroup) => Promise<any>;
|
|
410
390
|
startTaskStep: (planId: string, taskId: string) => Promise<any>;
|
|
411
|
-
startTaskStepWithListener: (planId: string, taskId: string, onResponse: (response:
|
|
391
|
+
startTaskStepWithListener: (planId: string, taskId: string, onResponse: (response: import("@codebolt/types/sdk").TaskStepResponse) => void) => (() => void);
|
|
412
392
|
};
|
|
413
393
|
todo: {
|
|
414
394
|
addTodo: (params: {
|
|
@@ -433,7 +413,11 @@ declare class Codebolt {
|
|
|
433
413
|
importTodos: (params: {
|
|
434
414
|
data: string;
|
|
435
415
|
format?: "json" | "markdown";
|
|
436
|
-
mergeStrategy
|
|
416
|
+
mergeStrategy? /**
|
|
417
|
+
* @method isReady
|
|
418
|
+
* @description Checks if the Codebolt instance is ready for use.
|
|
419
|
+
* @returns {boolean} True if the instance is ready, false otherwise.
|
|
420
|
+
*/: "replace" | "merge";
|
|
437
421
|
listId?: string;
|
|
438
422
|
}) => Promise<import("@codebolt/types/sdk").ImportTodosResponse>;
|
|
439
423
|
};
|
|
@@ -875,27 +859,43 @@ declare class Codebolt {
|
|
|
875
859
|
}) => Promise<import("@codebolt/types/sdk").UpdateProfileResponse>;
|
|
876
860
|
};
|
|
877
861
|
orchestrator: {
|
|
878
|
-
listOrchestrators: () => Promise<import("
|
|
879
|
-
getOrchestrator: (orchestratorId: string) => Promise<import("
|
|
880
|
-
getOrchestratorSettings: (orchestratorId: string) => Promise<import("
|
|
881
|
-
createOrchestrator: (data: import("
|
|
882
|
-
updateOrchestrator: (orchestratorId: string, data: import("
|
|
883
|
-
updateOrchestratorSettings: (orchestratorId: string, settings: import("
|
|
884
|
-
deleteOrchestrator: (orchestratorId: string) => Promise<import("
|
|
885
|
-
updateOrchestratorStatus: (orchestratorId: string, status: "
|
|
886
|
-
updateCodeboltJs: () => Promise<import("
|
|
862
|
+
listOrchestrators: () => Promise<import("@codebolt/types/sdk").OrchestratorResponse>;
|
|
863
|
+
getOrchestrator: (orchestratorId: string) => Promise<import("@codebolt/types/sdk").OrchestratorResponse>;
|
|
864
|
+
getOrchestratorSettings: (orchestratorId: string) => Promise<import("@codebolt/types/sdk").OrchestratorResponse>;
|
|
865
|
+
createOrchestrator: (data: import("@codebolt/types/sdk").CreateOrchestratorParams) => Promise<import("@codebolt/types/sdk").OrchestratorResponse>;
|
|
866
|
+
updateOrchestrator: (orchestratorId: string, data: import("@codebolt/types/sdk").UpdateOrchestratorParams) => Promise<import("@codebolt/types/sdk").OrchestratorResponse>;
|
|
867
|
+
updateOrchestratorSettings: (orchestratorId: string, settings: import("@codebolt/types/sdk").UpdateOrchestratorSettingsParams) => Promise<import("@codebolt/types/sdk").OrchestratorResponse>;
|
|
868
|
+
deleteOrchestrator: (orchestratorId: string) => Promise<import("@codebolt/types/sdk").OrchestratorResponse>;
|
|
869
|
+
updateOrchestratorStatus: (orchestratorId: string, status: import("@codebolt/types/sdk").OrchestratorStatus) => Promise<import("@codebolt/types/sdk").OrchestratorResponse>;
|
|
870
|
+
updateCodeboltJs: () => Promise<import("@codebolt/types/sdk").OrchestratorResponse>;
|
|
887
871
|
};
|
|
888
872
|
backgroundChildThreads: {
|
|
889
|
-
addRunningAgent: (threadId: string, data:
|
|
873
|
+
addRunningAgent: (threadId: string, data: import("@codebolt/types/sdk").BackgroundAgentData, groupId?: string) => void;
|
|
890
874
|
getRunningAgentCount: () => number;
|
|
891
|
-
checkForBackgroundAgentCompletion: () =>
|
|
892
|
-
onBackgroundAgentCompletion: () => Promise<
|
|
893
|
-
checkForBackgroundGroupedAgentCompletion: () =>
|
|
894
|
-
onBackgroundGroupedAgentCompletion: () => Promise<
|
|
895
|
-
waitForAnyExternalEvent: () => Promise<
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
875
|
+
checkForBackgroundAgentCompletion: () => import("@codebolt/types/sdk").BackgroundAgentCompletion[] | null;
|
|
876
|
+
onBackgroundAgentCompletion: () => Promise<import("@codebolt/types/sdk").BackgroundAgentCompletion[] | null>;
|
|
877
|
+
checkForBackgroundGroupedAgentCompletion: () => import("@codebolt/types/sdk").BackgroundAgentCompletion | null;
|
|
878
|
+
onBackgroundGroupedAgentCompletion: () => Promise<import("@codebolt/types/sdk").BackgroundAgentCompletion | null>;
|
|
879
|
+
waitForAnyExternalEvent: () => Promise<import("@codebolt/types/sdk").BackgroundExternalEvent>;
|
|
880
|
+
};
|
|
881
|
+
agentEventQueue: {
|
|
882
|
+
addEvent: (params: import("../types/agentEventQueue").AddEventInput) => Promise<import("../types/agentEventQueue").AgentEventQueueResponse<import("../types/agentEventQueue").AddEventResponseData>>;
|
|
883
|
+
sendAgentMessage: (params: import("../types/agentEventQueue").SendAgentMessageInput) => Promise<import("../types/agentEventQueue").AgentEventQueueResponse<import("../types/agentEventQueue").AddEventResponseData>>;
|
|
884
|
+
getQueueStats: () => Promise<import("../types/agentEventQueue").AgentEventQueueResponse<import("../types/agentEventQueue").QueueStatsResponseData>>;
|
|
885
|
+
clearQueue: (agentId?: string) => Promise<import("../types/agentEventQueue").AgentEventQueueResponse>;
|
|
886
|
+
_acknowledgeEvent: (eventId: string, success?: boolean, errorMessage?: string) => Promise<import("../types/agentEventQueue").AgentEventQueueResponse>;
|
|
887
|
+
_fetchPendingFromBackend: (params?: import("../types/agentEventQueue").GetPendingEventsInput) => Promise<import("../types/agentEventQueue").AgentEventMessage[]>;
|
|
888
|
+
getPendingQueueEvents: (maxDepth?: number) => Promise<import("../types/agentEventQueue").AgentEventMessage[]>;
|
|
889
|
+
waitForNextQueueEvent: (maxDepth?: number) => Promise<import("../types/agentEventQueue").AgentEventMessage | import("../types/agentEventQueue").AgentEventMessage[]>;
|
|
890
|
+
onQueueEvent: (handler: import("../types/agentEventQueue").QueueEventHandler) => (() => void);
|
|
891
|
+
acknowledgeEvent: (eventId: string, success?: boolean, errorMessage?: string) => Promise<import("../types/agentEventQueue").AgentEventQueueResponse>;
|
|
892
|
+
getLocalCacheSize: () => number;
|
|
893
|
+
peekLocalCache: () => import("../types/agentEventQueue").AgentEventMessage[];
|
|
894
|
+
clearLocalCache: () => void;
|
|
895
|
+
checkForPendingExternalEvent: () => import("../modules/agentEventQueue").UnifiedExternalEvent | null;
|
|
896
|
+
getPendingExternalEvents: () => import("../modules/agentEventQueue").UnifiedExternalEvent[];
|
|
897
|
+
getPendingExternalEventCount: () => number;
|
|
898
|
+
waitForAnyExternalEvent: () => Promise<import("../modules/agentEventQueue").UnifiedExternalEvent>;
|
|
899
899
|
};
|
|
900
900
|
/**
|
|
901
901
|
* User message utilities for accessing current user message and context
|
package/dist/core/Codebolt.js
CHANGED
|
@@ -64,6 +64,7 @@ const contextRuleEngine_1 = __importDefault(require("../modules/contextRuleEngin
|
|
|
64
64
|
const agentPortfolio_1 = __importDefault(require("../modules/agentPortfolio"));
|
|
65
65
|
const orchestrator_1 = __importDefault(require("../modules/orchestrator"));
|
|
66
66
|
const backgroundChildThreads_1 = __importDefault(require("../modules/backgroundChildThreads"));
|
|
67
|
+
const agentEventQueue_1 = __importDefault(require("../modules/agentEventQueue"));
|
|
67
68
|
/**
|
|
68
69
|
* @class Codebolt
|
|
69
70
|
* @description This class provides a unified interface to interact with various modules.
|
|
@@ -137,6 +138,7 @@ class Codebolt {
|
|
|
137
138
|
this.agentPortfolio = agentPortfolio_1.default;
|
|
138
139
|
this.orchestrator = orchestrator_1.default;
|
|
139
140
|
this.backgroundChildThreads = backgroundChildThreads_1.default;
|
|
141
|
+
this.agentEventQueue = agentEventQueue_1.default;
|
|
140
142
|
/**
|
|
141
143
|
* User message utilities for accessing current user message and context
|
|
142
144
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export declare const openNewBrowserInstance: (options?: import("./types/libFunct
|
|
|
37
37
|
instanceId: string;
|
|
38
38
|
}>;
|
|
39
39
|
export declare const closeBrowserInstance: (instanceId: string) => Promise<boolean>;
|
|
40
|
-
export declare const executeOnInstance: (instanceId: string, operation:
|
|
40
|
+
export declare const executeOnInstance: (instanceId: string, operation: import("@codebolt/types/dist/codeboltjstypes/libFunctionTypes/browser").BrowserOperationType, params: import("@codebolt/types/dist/codeboltjstypes/libFunctionTypes/browser").BrowserOperationParams) => Promise<import("@codebolt/types/dist/codeboltjstypes/libFunctionTypes/browser").BrowserOperationResponse>;
|
|
41
41
|
export { agentNotifications, browserNotifications, chatNotifications, codeutilsNotifications, crawlerNotifications, dbmemoryNotifications, fsNotifications, gitNotifications, historyNotifications, llmNotifications, mcpNotifications, searchNotifications, systemNotifications, terminalNotifications, todoNotifications, notificationFunctions, type NotificationFunctions } from './notificationfunctions';
|
|
42
42
|
export { StartSubagentTaskRequestNotify, StartSubagentTaskResponseNotify, SubagentTaskCompletedNotify } from './notificationfunctions/agent';
|
|
43
43
|
export { AgentInitNotify, AgentCompletionNotify } from './notificationfunctions/system';
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ActionPlanUpdateData, ActionPlanTask, ActionPlanGroup, TaskStepResponse } from '@codebolt/types/sdk';
|
|
2
|
+
export type { ActionPlanUpdateData, ActionPlanTask, ActionPlanGroup, TaskStepResponse };
|
|
1
3
|
declare const codeboltActionPlan: {
|
|
2
4
|
/**
|
|
3
5
|
* Get all action plans
|
|
@@ -35,35 +37,21 @@ declare const codeboltActionPlan: {
|
|
|
35
37
|
* @param updateData - Data to update in the action plan
|
|
36
38
|
* @returns Promise with updated action plan
|
|
37
39
|
*/
|
|
38
|
-
updateActionPlan: (planId: string, updateData:
|
|
40
|
+
updateActionPlan: (planId: string, updateData: ActionPlanUpdateData) => Promise<any>;
|
|
39
41
|
/**
|
|
40
42
|
* Add a task to an action plan
|
|
41
43
|
* @param planId - The ID of the action plan
|
|
42
44
|
* @param task - Task data to add (name, description, priority, taskType, etc.)
|
|
43
45
|
* @returns Promise with added task and updated action plan
|
|
44
46
|
*/
|
|
45
|
-
addTaskToActionPlan: (planId: string, task:
|
|
46
|
-
name: string;
|
|
47
|
-
description?: string;
|
|
48
|
-
priority?: string;
|
|
49
|
-
taskType?: string;
|
|
50
|
-
[key: string]: any;
|
|
51
|
-
}) => Promise<any>;
|
|
47
|
+
addTaskToActionPlan: (planId: string, task: ActionPlanTask) => Promise<any>;
|
|
52
48
|
/**
|
|
53
49
|
* Add a group to an action plan
|
|
54
50
|
* @param planId - The ID of the action plan
|
|
55
51
|
* @param group - Group data to add (type, name, groupItems/loopTasks/ifTasks/waitTasks, etc.)
|
|
56
52
|
* @returns Promise with added group and updated action plan
|
|
57
53
|
*/
|
|
58
|
-
addGroupToActionPlan: (planId: string, group:
|
|
59
|
-
type: "parallelGroup" | "loopGroup" | "ifGroup" | "waitUntilGroup";
|
|
60
|
-
name?: string;
|
|
61
|
-
groupItems?: Record<string, any[]>;
|
|
62
|
-
loopTasks?: any[];
|
|
63
|
-
ifTasks?: any[];
|
|
64
|
-
waitTasks?: any[];
|
|
65
|
-
[key: string]: any;
|
|
66
|
-
}) => Promise<any>;
|
|
54
|
+
addGroupToActionPlan: (planId: string, group: ActionPlanGroup) => Promise<any>;
|
|
67
55
|
/**
|
|
68
56
|
* Start/execute a task step in an action plan
|
|
69
57
|
* @param planId - The ID of the action plan
|
|
@@ -78,6 +66,6 @@ declare const codeboltActionPlan: {
|
|
|
78
66
|
* @param onResponse - Callback function that will be called when receiving responses for this task
|
|
79
67
|
* @returns Cleanup function to remove the event listener
|
|
80
68
|
*/
|
|
81
|
-
startTaskStepWithListener: (planId: string, taskId: string, onResponse: (response:
|
|
69
|
+
startTaskStepWithListener: (planId: string, taskId: string, onResponse: (response: TaskStepResponse) => void) => (() => void);
|
|
82
70
|
};
|
|
83
71
|
export default codeboltActionPlan;
|
|
@@ -6,6 +6,17 @@
|
|
|
6
6
|
import type { AgentEventMessage, AddEventInput, SendAgentMessageInput, GetPendingEventsInput, AgentEventQueueResponse, AddEventResponseData, QueueStatsResponseData, QueueEventHandler } from '../types/agentEventQueue';
|
|
7
7
|
export type { AgentEventMessage, AddEventInput, SendAgentMessageInput, AckEventInput, GetPendingEventsInput, AgentEventQueueResponse, AddEventResponseData, GetPendingEventsResponseData, QueueStatsResponseData, QueueEventHandler } from '../types/agentEventQueue';
|
|
8
8
|
export { AgentEventType, AgentEventStatus, AgentEventPriority } from '../types/agentEventQueue';
|
|
9
|
+
/**
|
|
10
|
+
* Types of external events that can be received
|
|
11
|
+
*/
|
|
12
|
+
export type ExternalEventType = 'agentQueueEvent' | 'backgroundAgentCompletion' | 'backgroundGroupedAgentCompletion';
|
|
13
|
+
/**
|
|
14
|
+
* Unified external event structure
|
|
15
|
+
*/
|
|
16
|
+
export interface UnifiedExternalEvent {
|
|
17
|
+
type: ExternalEventType;
|
|
18
|
+
data: any;
|
|
19
|
+
}
|
|
9
20
|
declare const agentEventQueue: {
|
|
10
21
|
/**
|
|
11
22
|
* Add an event to a target agent's queue
|
|
@@ -92,5 +103,36 @@ declare const agentEventQueue: {
|
|
|
92
103
|
* Clear the local event cache (does not affect backend)
|
|
93
104
|
*/
|
|
94
105
|
clearLocalCache: () => void;
|
|
106
|
+
/**
|
|
107
|
+
* Check for any pending external events without waiting.
|
|
108
|
+
* Returns the first pending event or null if none available.
|
|
109
|
+
*
|
|
110
|
+
* @returns {UnifiedExternalEvent | null} The first pending event or null
|
|
111
|
+
*/
|
|
112
|
+
checkForPendingExternalEvent: () => UnifiedExternalEvent | null;
|
|
113
|
+
/**
|
|
114
|
+
* Get all pending external events.
|
|
115
|
+
* Returns all pending events and clears the cache.
|
|
116
|
+
*
|
|
117
|
+
* @returns {UnifiedExternalEvent[]} Array of pending events
|
|
118
|
+
*/
|
|
119
|
+
getPendingExternalEvents: () => UnifiedExternalEvent[];
|
|
120
|
+
/**
|
|
121
|
+
* Get the count of pending external events.
|
|
122
|
+
*
|
|
123
|
+
* @returns {number} Number of pending events
|
|
124
|
+
*/
|
|
125
|
+
getPendingExternalEventCount: () => number;
|
|
126
|
+
/**
|
|
127
|
+
* Waits for any external event from multiple sources:
|
|
128
|
+
* - Agent queue events (from local cache or WebSocket)
|
|
129
|
+
* - Background agent completions
|
|
130
|
+
* - Grouped agent completions
|
|
131
|
+
*
|
|
132
|
+
* Returns the first event that occurs from any source.
|
|
133
|
+
*
|
|
134
|
+
* @returns {Promise<UnifiedExternalEvent>} A promise that resolves with the event type and data
|
|
135
|
+
*/
|
|
136
|
+
waitForAnyExternalEvent: () => Promise<UnifiedExternalEvent>;
|
|
95
137
|
};
|
|
96
138
|
export default agentEventQueue;
|
|
@@ -18,15 +18,17 @@ Object.defineProperty(exports, "AgentEventPriority", { enumerable: true, get: fu
|
|
|
18
18
|
// ============================================================================
|
|
19
19
|
// Local Event Cache
|
|
20
20
|
// ============================================================================
|
|
21
|
-
/** Local cache for events received via WebSocket */
|
|
21
|
+
/** Local cache for agent events received via WebSocket */
|
|
22
22
|
const localEventCache = new Map();
|
|
23
|
+
/** Unified cache for all external events (queue events, background completions, grouped completions) */
|
|
24
|
+
const pendingExternalEvents = [];
|
|
23
25
|
/** Registered event handlers */
|
|
24
26
|
const eventHandlers = new Set();
|
|
25
27
|
/** Event emitter for waiting promises */
|
|
26
28
|
const events_1 = require("events");
|
|
27
29
|
const eventEmitter = new events_1.EventEmitter();
|
|
28
30
|
// ============================================================================
|
|
29
|
-
// WebSocket
|
|
31
|
+
// WebSocket Subscriptions
|
|
30
32
|
// ============================================================================
|
|
31
33
|
// Subscribe to agentEvent messages from WebSocket
|
|
32
34
|
const agentEventSubscription = websocket_1.default.messageManager.subscribe('agentEvent');
|
|
@@ -35,8 +37,11 @@ agentEventSubscription.on('message', (message) => {
|
|
|
35
37
|
if (event && event.eventId) {
|
|
36
38
|
// Store in local cache
|
|
37
39
|
localEventCache.set(event.eventId, event);
|
|
40
|
+
// Also push to unified external events cache
|
|
41
|
+
pendingExternalEvents.push({ type: 'agentQueueEvent', data: event });
|
|
38
42
|
// Notify waiting promises
|
|
39
43
|
eventEmitter.emit('newEvent', event);
|
|
44
|
+
eventEmitter.emit('externalEvent', { type: 'agentQueueEvent', data: event });
|
|
40
45
|
// Call registered handlers
|
|
41
46
|
for (const handler of eventHandlers) {
|
|
42
47
|
try {
|
|
@@ -48,6 +53,33 @@ agentEventSubscription.on('message', (message) => {
|
|
|
48
53
|
}
|
|
49
54
|
}
|
|
50
55
|
});
|
|
56
|
+
// Subscribe to background agent completion messages
|
|
57
|
+
const backgroundAgentSubscription = websocket_1.default.messageManager.subscribe('startThreadResponse');
|
|
58
|
+
backgroundAgentSubscription.on('message', (message) => {
|
|
59
|
+
if (message.threadId) {
|
|
60
|
+
const externalEvent = { type: 'backgroundAgentCompletion', data: message };
|
|
61
|
+
pendingExternalEvents.push(externalEvent);
|
|
62
|
+
eventEmitter.emit('externalEvent', externalEvent);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
// Subscribe to ThreadCompleted as an alternative message type
|
|
66
|
+
const threadCompletedSubscription = websocket_1.default.messageManager.subscribe('ThreadCompleted');
|
|
67
|
+
threadCompletedSubscription.on('message', (message) => {
|
|
68
|
+
if (message.threadId) {
|
|
69
|
+
const externalEvent = { type: 'backgroundAgentCompletion', data: message };
|
|
70
|
+
pendingExternalEvents.push(externalEvent);
|
|
71
|
+
eventEmitter.emit('externalEvent', externalEvent);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
// Subscribe to grouped agent completion messages
|
|
75
|
+
const groupedAgentSubscription = websocket_1.default.messageManager.subscribe('backgroundGroupedAgentCompletion');
|
|
76
|
+
groupedAgentSubscription.on('message', (message) => {
|
|
77
|
+
if (message.threadId) {
|
|
78
|
+
const externalEvent = { type: 'backgroundGroupedAgentCompletion', data: message };
|
|
79
|
+
pendingExternalEvents.push(externalEvent);
|
|
80
|
+
eventEmitter.emit('externalEvent', externalEvent);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
51
83
|
// ============================================================================
|
|
52
84
|
// Agent Event Queue Module
|
|
53
85
|
// ============================================================================
|
|
@@ -66,7 +98,7 @@ const agentEventQueue = {
|
|
|
66
98
|
type: 'agentEventQueue.addEventForAgent',
|
|
67
99
|
requestId,
|
|
68
100
|
params
|
|
69
|
-
}, '
|
|
101
|
+
}, 'agentEventQueue.addEventForAgentResponse');
|
|
70
102
|
},
|
|
71
103
|
/**
|
|
72
104
|
* Send an inter-agent message (convenience wrapper)
|
|
@@ -79,7 +111,7 @@ const agentEventQueue = {
|
|
|
79
111
|
type: 'agentEventQueue.sendAgentMessage',
|
|
80
112
|
requestId,
|
|
81
113
|
params
|
|
82
|
-
}, '
|
|
114
|
+
}, 'agentEventQueue.sendAgentMessageResponse');
|
|
83
115
|
},
|
|
84
116
|
/**
|
|
85
117
|
* Get queue statistics
|
|
@@ -91,7 +123,7 @@ const agentEventQueue = {
|
|
|
91
123
|
type: 'agentEventQueue.getQueueStats',
|
|
92
124
|
requestId,
|
|
93
125
|
params: {}
|
|
94
|
-
}, '
|
|
126
|
+
}, 'agentEventQueue.getQueueStatsResponse');
|
|
95
127
|
},
|
|
96
128
|
/**
|
|
97
129
|
* Clear the queue for an agent
|
|
@@ -104,7 +136,7 @@ const agentEventQueue = {
|
|
|
104
136
|
type: 'agentEventQueue.clearQueue',
|
|
105
137
|
requestId,
|
|
106
138
|
params: { agentId }
|
|
107
|
-
}, '
|
|
139
|
+
}, 'agentEventQueue.clearQueueResponse');
|
|
108
140
|
},
|
|
109
141
|
// ========================================================================
|
|
110
142
|
// Internal Acknowledgement Helper
|
|
@@ -125,7 +157,7 @@ const agentEventQueue = {
|
|
|
125
157
|
success,
|
|
126
158
|
errorMessage
|
|
127
159
|
}
|
|
128
|
-
}, '
|
|
160
|
+
}, 'agentEventQueue.ackEventResponse');
|
|
129
161
|
},
|
|
130
162
|
/**
|
|
131
163
|
* Fetch pending events from backend
|
|
@@ -133,15 +165,37 @@ const agentEventQueue = {
|
|
|
133
165
|
*/
|
|
134
166
|
_fetchPendingFromBackend: async (params = {}) => {
|
|
135
167
|
const requestId = (0, crypto_1.randomUUID)();
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
168
|
+
try {
|
|
169
|
+
const response = await websocket_1.default.messageManager.sendAndWaitForResponse({
|
|
170
|
+
type: 'agentEventQueue.getPendingEvents',
|
|
171
|
+
requestId,
|
|
172
|
+
params
|
|
173
|
+
}, 'agentEventQueue.getPendingEventsResponse');
|
|
174
|
+
console.log('[AgentEventQueue] Backend response:', JSON.stringify(response, null, 2));
|
|
175
|
+
if (response.success && response.data) {
|
|
176
|
+
// Handle case where data itself is the array
|
|
177
|
+
if (Array.isArray(response.data)) {
|
|
178
|
+
return response.data;
|
|
179
|
+
}
|
|
180
|
+
// Handle case where events are nested under data.events
|
|
181
|
+
const events = response.data.events;
|
|
182
|
+
if (Array.isArray(events)) {
|
|
183
|
+
return events;
|
|
184
|
+
}
|
|
185
|
+
console.warn('[AgentEventQueue] response.data.events is not an array:', typeof events, events);
|
|
186
|
+
return [];
|
|
187
|
+
}
|
|
188
|
+
// Handle case where events are at response root level (not nested under data)
|
|
189
|
+
const responseAny = response;
|
|
190
|
+
if (response.success && Array.isArray(responseAny.events)) {
|
|
191
|
+
return responseAny.events;
|
|
192
|
+
}
|
|
193
|
+
return [];
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
console.error('[AgentEventQueue] Error fetching pending events from backend:', error);
|
|
197
|
+
return [];
|
|
143
198
|
}
|
|
144
|
-
return [];
|
|
145
199
|
},
|
|
146
200
|
// ========================================================================
|
|
147
201
|
// Local Event Management Functions
|
|
@@ -157,6 +211,7 @@ const agentEventQueue = {
|
|
|
157
211
|
getPendingQueueEvents: async (maxDepth) => {
|
|
158
212
|
const events = [];
|
|
159
213
|
const eventIds = Array.from(localEventCache.keys());
|
|
214
|
+
console.log('[AgentEventQueue] getPendingQueueEvents - localEventCache size:', localEventCache.size);
|
|
160
215
|
// Determine how many events to process
|
|
161
216
|
const limit = maxDepth !== undefined ? Math.min(maxDepth, eventIds.length) : eventIds.length;
|
|
162
217
|
// Get events from local cache
|
|
@@ -164,16 +219,27 @@ const agentEventQueue = {
|
|
|
164
219
|
const eventId = eventIds[i];
|
|
165
220
|
const event = localEventCache.get(eventId);
|
|
166
221
|
if (event) {
|
|
222
|
+
console.log('[AgentEventQueue] Local cache event:', eventId, 'has eventId field:', !!event.eventId);
|
|
167
223
|
events.push(event);
|
|
168
224
|
}
|
|
169
225
|
}
|
|
170
226
|
// If no local events, try fetching from backend
|
|
171
227
|
if (events.length === 0) {
|
|
172
228
|
const backendEvents = await agentEventQueue._fetchPendingFromBackend({ limit: maxDepth });
|
|
229
|
+
console.log('[AgentEventQueue] getPendingQueueEvents - backendEvents:', Array.isArray(backendEvents) ? `array of ${backendEvents.length}` : typeof backendEvents, JSON.stringify(backendEvents, null, 2));
|
|
230
|
+
// Ensure backendEvents is an array
|
|
231
|
+
if (!Array.isArray(backendEvents)) {
|
|
232
|
+
console.error('[AgentEventQueue] backendEvents is not an array, returning empty array');
|
|
233
|
+
return [];
|
|
234
|
+
}
|
|
173
235
|
// Acknowledge backend events
|
|
174
236
|
for (const event of backendEvents) {
|
|
175
237
|
try {
|
|
176
|
-
await agentEventQueue._acknowledgeEvent(event.eventId, true);
|
|
238
|
+
const ackResponse = await agentEventQueue._acknowledgeEvent(event.eventId, true);
|
|
239
|
+
console.log(`[AgentEventQueue] Ack response for ${event.eventId}:`, JSON.stringify(ackResponse));
|
|
240
|
+
if (!ackResponse.success) {
|
|
241
|
+
console.error(`[AgentEventQueue] Failed to acknowledge event ${event.eventId}:`, ackResponse.message);
|
|
242
|
+
}
|
|
177
243
|
}
|
|
178
244
|
catch (error) {
|
|
179
245
|
console.error(`[AgentEventQueue] Error acknowledging event ${event.eventId}:`, error);
|
|
@@ -283,6 +349,92 @@ const agentEventQueue = {
|
|
|
283
349
|
*/
|
|
284
350
|
clearLocalCache: () => {
|
|
285
351
|
localEventCache.clear();
|
|
352
|
+
},
|
|
353
|
+
// ========================================================================
|
|
354
|
+
// Unified External Event Handling
|
|
355
|
+
// ========================================================================
|
|
356
|
+
/**
|
|
357
|
+
* Check for any pending external events without waiting.
|
|
358
|
+
* Returns the first pending event or null if none available.
|
|
359
|
+
*
|
|
360
|
+
* @returns {UnifiedExternalEvent | null} The first pending event or null
|
|
361
|
+
*/
|
|
362
|
+
checkForPendingExternalEvent: () => {
|
|
363
|
+
if (pendingExternalEvents.length > 0) {
|
|
364
|
+
return pendingExternalEvents.shift() || null;
|
|
365
|
+
}
|
|
366
|
+
return null;
|
|
367
|
+
},
|
|
368
|
+
/**
|
|
369
|
+
* Get all pending external events.
|
|
370
|
+
* Returns all pending events and clears the cache.
|
|
371
|
+
*
|
|
372
|
+
* @returns {UnifiedExternalEvent[]} Array of pending events
|
|
373
|
+
*/
|
|
374
|
+
getPendingExternalEvents: () => {
|
|
375
|
+
const events = [...pendingExternalEvents];
|
|
376
|
+
pendingExternalEvents.length = 0;
|
|
377
|
+
return events;
|
|
378
|
+
},
|
|
379
|
+
/**
|
|
380
|
+
* Get the count of pending external events.
|
|
381
|
+
*
|
|
382
|
+
* @returns {number} Number of pending events
|
|
383
|
+
*/
|
|
384
|
+
getPendingExternalEventCount: () => {
|
|
385
|
+
return pendingExternalEvents.length;
|
|
386
|
+
},
|
|
387
|
+
/**
|
|
388
|
+
* Waits for any external event from multiple sources:
|
|
389
|
+
* - Agent queue events (from local cache or WebSocket)
|
|
390
|
+
* - Background agent completions
|
|
391
|
+
* - Grouped agent completions
|
|
392
|
+
*
|
|
393
|
+
* Returns the first event that occurs from any source.
|
|
394
|
+
*
|
|
395
|
+
* @returns {Promise<UnifiedExternalEvent>} A promise that resolves with the event type and data
|
|
396
|
+
*/
|
|
397
|
+
waitForAnyExternalEvent: async () => {
|
|
398
|
+
var _a;
|
|
399
|
+
// Check if there are already pending events
|
|
400
|
+
if (pendingExternalEvents.length > 0) {
|
|
401
|
+
const event = pendingExternalEvents.shift();
|
|
402
|
+
// If it's an agent queue event, acknowledge it
|
|
403
|
+
if (event.type === 'agentQueueEvent' && ((_a = event.data) === null || _a === void 0 ? void 0 : _a.eventId)) {
|
|
404
|
+
try {
|
|
405
|
+
await agentEventQueue._acknowledgeEvent(event.data.eventId, true);
|
|
406
|
+
localEventCache.delete(event.data.eventId);
|
|
407
|
+
}
|
|
408
|
+
catch (error) {
|
|
409
|
+
console.error(`[AgentEventQueue] Error acknowledging event ${event.data.eventId}:`, error);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
return event;
|
|
413
|
+
}
|
|
414
|
+
// Wait for the next external event
|
|
415
|
+
return new Promise((resolve) => {
|
|
416
|
+
const handler = async (event) => {
|
|
417
|
+
var _a;
|
|
418
|
+
eventEmitter.removeListener('externalEvent', handler);
|
|
419
|
+
// Remove from pending queue (it was added by the subscription)
|
|
420
|
+
const index = pendingExternalEvents.findIndex(e => e === event);
|
|
421
|
+
if (index !== -1) {
|
|
422
|
+
pendingExternalEvents.splice(index, 1);
|
|
423
|
+
}
|
|
424
|
+
// If it's an agent queue event, acknowledge it
|
|
425
|
+
if (event.type === 'agentQueueEvent' && ((_a = event.data) === null || _a === void 0 ? void 0 : _a.eventId)) {
|
|
426
|
+
try {
|
|
427
|
+
await agentEventQueue._acknowledgeEvent(event.data.eventId, true);
|
|
428
|
+
localEventCache.delete(event.data.eventId);
|
|
429
|
+
}
|
|
430
|
+
catch (error) {
|
|
431
|
+
console.error(`[AgentEventQueue] Error acknowledging event ${event.data.eventId}:`, error);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
resolve(event);
|
|
435
|
+
};
|
|
436
|
+
eventEmitter.once('externalEvent', handler);
|
|
437
|
+
});
|
|
286
438
|
}
|
|
287
439
|
};
|
|
288
440
|
exports.default = agentEventQueue;
|