@codebolt/codeboltjs 2.2.5 → 4.0.3

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.
@@ -254,6 +254,12 @@ declare class Codebolt {
254
254
  getTasks: (filters?: import("../types/libFunctionTypes").TaskFilterOptions) => Promise<import("node_modules/@codebolt/types/dist/wstypes/app-to-agent-ws/taskServiceResponses").GetTaskListResponse>;
255
255
  getTasksByAgent: (agentId: string) => Promise<import("node_modules/@codebolt/types/dist/wstypes/app-to-agent-ws/taskServiceResponses").GetTaskListResponse>;
256
256
  getTasksByCategory: (category: string) => Promise<import("node_modules/@codebolt/types/dist/wstypes/app-to-agent-ws/taskServiceResponses").GetTaskListResponse>;
257
+ attachJsonMemoryToTask: (taskId: string, memoryId: string) => Promise<any>;
258
+ attachMarktownMemoryJToTask: (taskId: string, memoryId: string) => Promise<any>;
259
+ attachToDoToTask: (taskId: string, todoId: string) => Promise<any>;
260
+ getAttachedTodos: (taskId: string) => Promise<any>;
261
+ getAttachedJsonMemory: (taskId: string) => Promise<any>;
262
+ getAttachedMarkdownMemory: (taskId: string) => Promise<any>;
257
263
  };
258
264
  vectordb: {
259
265
  getVector: (key: string) => Promise<import("@codebolt/types/sdk").GetVectorResponse>;
@@ -299,6 +305,26 @@ declare class Codebolt {
299
305
  editFileAndApplyDiff: (filePath: string, diff: string, diffIdentifier: string, prompt: string, applyModel?: string) => Promise<import("@codebolt/types/sdk").FsEditFileAndApplyDiffResponse>;
300
306
  };
301
307
  notify: NotificationFunctions;
308
+ memory: {
309
+ json: {
310
+ save: (json: any) => Promise<import("../modules/memory").SaveMemoryResponse>;
311
+ update: (memoryId: string, json: any) => Promise<import("../modules/memory").UpdateMemoryResponse>;
312
+ delete: (memoryId: string) => Promise<import("../modules/memory").DeleteMemoryResponse>;
313
+ list: (filters?: Record<string, unknown>) => Promise<import("../modules/memory").ListMemoryResponse>;
314
+ };
315
+ todo: {
316
+ save: (todo: import("@codebolt/types/agent-to-app-ws-schema").TodoData, metadata?: Record<string, unknown>) => Promise<import("../modules/memory").SaveMemoryResponse>;
317
+ update: (memoryId: string, todo: import("@codebolt/types/agent-to-app-ws-schema").TodoItem) => Promise<import("../modules/memory").UpdateMemoryResponse>;
318
+ delete: (memoryId: string) => Promise<import("../modules/memory").DeleteMemoryResponse>;
319
+ list: (filters?: Record<string, unknown>) => Promise<import("../modules/memory").ListMemoryResponse>;
320
+ };
321
+ markdown: {
322
+ save: (markdown: string, metadata?: Record<string, unknown>) => Promise<import("../modules/memory").SaveMemoryResponse>;
323
+ update: (memoryId: string, markdown: string, metadata?: Record<string, unknown>) => Promise<import("../modules/memory").UpdateMemoryResponse>;
324
+ delete: (memoryId: string) => Promise<import("../modules/memory").DeleteMemoryResponse>;
325
+ list: (filters?: Record<string, unknown>) => Promise<import("../modules/memory").ListMemoryResponse>;
326
+ };
327
+ };
302
328
  /**
303
329
  * User message utilities for accessing current user message and context
304
330
  */
@@ -25,6 +25,7 @@ const debug_1 = __importDefault(require("../modules/debug"));
25
25
  const tokenizer_1 = __importDefault(require("../modules/tokenizer"));
26
26
  const history_1 = require("../modules/history");
27
27
  const mcp_1 = __importDefault(require("../modules/mcp"));
28
+ const memory_1 = __importDefault(require("../modules/memory"));
28
29
  const agent_1 = __importDefault(require("../modules/agent"));
29
30
  const utils_1 = __importDefault(require("../modules/utils"));
30
31
  const notificationfunctions_1 = require("../notificationfunctions");
@@ -67,6 +68,7 @@ class Codebolt {
67
68
  this.agent = agent_1.default;
68
69
  this.utils = utils_1.default;
69
70
  this.notify = notificationfunctions_1.notificationFunctions;
71
+ this.memory = memory_1.default;
70
72
  /**
71
73
  * User message utilities for accessing current user message and context
72
74
  */
@@ -0,0 +1,46 @@
1
+ import type { TodoItem, TodoData } from '@codebolt/types/agent-to-app-ws-schema';
2
+ export interface BaseMemoryResponse {
3
+ requestId: string;
4
+ success?: boolean;
5
+ message?: string;
6
+ error?: string;
7
+ }
8
+ export interface SaveMemoryResponse extends BaseMemoryResponse {
9
+ type: 'saveMemoryResponse';
10
+ memoryId?: string;
11
+ data?: unknown;
12
+ }
13
+ export interface UpdateMemoryResponse extends BaseMemoryResponse {
14
+ type: 'updateMemoryResponse';
15
+ memoryId?: string;
16
+ data?: unknown;
17
+ }
18
+ export interface DeleteMemoryResponse extends BaseMemoryResponse {
19
+ type: 'deleteMemoryResponse';
20
+ }
21
+ export interface ListMemoryResponse extends BaseMemoryResponse {
22
+ type: 'listMemoryResponse';
23
+ items?: unknown[];
24
+ }
25
+ export type MemoryServiceResponse = SaveMemoryResponse | UpdateMemoryResponse | DeleteMemoryResponse | ListMemoryResponse;
26
+ declare const cbmemory: {
27
+ json: {
28
+ save: (json: any) => Promise<SaveMemoryResponse>;
29
+ update: (memoryId: string, json: any) => Promise<UpdateMemoryResponse>;
30
+ delete: (memoryId: string) => Promise<DeleteMemoryResponse>;
31
+ list: (filters?: Record<string, unknown>) => Promise<ListMemoryResponse>;
32
+ };
33
+ todo: {
34
+ save: (todo: TodoData, metadata?: Record<string, unknown>) => Promise<SaveMemoryResponse>;
35
+ update: (memoryId: string, todo: TodoItem) => Promise<UpdateMemoryResponse>;
36
+ delete: (memoryId: string) => Promise<DeleteMemoryResponse>;
37
+ list: (filters?: Record<string, unknown>) => Promise<ListMemoryResponse>;
38
+ };
39
+ markdown: {
40
+ save: (markdown: string, metadata?: Record<string, unknown>) => Promise<SaveMemoryResponse>;
41
+ update: (memoryId: string, markdown: string, metadata?: Record<string, unknown>) => Promise<UpdateMemoryResponse>;
42
+ delete: (memoryId: string) => Promise<DeleteMemoryResponse>;
43
+ list: (filters?: Record<string, unknown>) => Promise<ListMemoryResponse>;
44
+ };
45
+ };
46
+ export default cbmemory;
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const websocket_1 = __importDefault(require("../core/websocket"));
7
+ const crypto_1 = require("crypto");
8
+ const cbmemory = {
9
+ json: {
10
+ save: (json) => {
11
+ const event = {
12
+ type: 'memoryEvent',
13
+ action: 'saveMemory',
14
+ requestId: (0, crypto_1.randomUUID)(),
15
+ format: 'json',
16
+ json
17
+ };
18
+ return websocket_1.default.messageManager.sendAndWaitForResponse(event, 'saveMemoryResponse');
19
+ },
20
+ update: (memoryId, json) => {
21
+ const event = {
22
+ type: 'memoryEvent',
23
+ action: 'updateMemory',
24
+ requestId: (0, crypto_1.randomUUID)(),
25
+ format: 'json',
26
+ memoryId,
27
+ json
28
+ };
29
+ return websocket_1.default.messageManager.sendAndWaitForResponse(event, 'updateMemoryResponse');
30
+ },
31
+ delete: (memoryId) => {
32
+ const event = {
33
+ type: 'memoryEvent',
34
+ action: 'deleteMemory',
35
+ requestId: (0, crypto_1.randomUUID)(),
36
+ format: 'json',
37
+ memoryId
38
+ };
39
+ return websocket_1.default.messageManager.sendAndWaitForResponse(event, 'deleteMemoryResponse');
40
+ },
41
+ list: (filters = {}) => {
42
+ const event = {
43
+ type: 'memoryEvent',
44
+ action: 'listMemory',
45
+ requestId: (0, crypto_1.randomUUID)(),
46
+ format: 'json',
47
+ filters
48
+ };
49
+ return websocket_1.default.messageManager.sendAndWaitForResponse(event, 'listMemoryResponse');
50
+ }
51
+ },
52
+ todo: {
53
+ save: (todo, metadata = {}) => {
54
+ const event = {
55
+ type: 'memoryEvent',
56
+ action: 'saveMemory',
57
+ requestId: (0, crypto_1.randomUUID)(),
58
+ format: 'todo',
59
+ todo,
60
+ metadata
61
+ };
62
+ return websocket_1.default.messageManager.sendAndWaitForResponse(event, 'saveMemoryResponse');
63
+ },
64
+ update: (memoryId, todo) => {
65
+ const event = {
66
+ type: 'memoryEvent',
67
+ action: 'updateMemory',
68
+ requestId: (0, crypto_1.randomUUID)(),
69
+ format: 'todo',
70
+ memoryId,
71
+ todo
72
+ };
73
+ return websocket_1.default.messageManager.sendAndWaitForResponse(event, 'updateMemoryResponse');
74
+ },
75
+ delete: (memoryId) => {
76
+ const event = {
77
+ type: 'memoryEvent',
78
+ action: 'deleteMemory',
79
+ requestId: (0, crypto_1.randomUUID)(),
80
+ format: 'todo',
81
+ memoryId
82
+ };
83
+ return websocket_1.default.messageManager.sendAndWaitForResponse(event, 'deleteMemoryResponse');
84
+ },
85
+ list: (filters = {}) => {
86
+ const event = {
87
+ type: 'memoryEvent',
88
+ action: 'listMemory',
89
+ requestId: (0, crypto_1.randomUUID)(),
90
+ format: 'todo',
91
+ filters
92
+ };
93
+ return websocket_1.default.messageManager.sendAndWaitForResponse(event, 'listMemoryResponse');
94
+ }
95
+ },
96
+ markdown: {
97
+ save: (markdown, metadata = {}) => {
98
+ const event = {
99
+ type: 'memoryEvent',
100
+ action: 'saveMemory',
101
+ requestId: (0, crypto_1.randomUUID)(),
102
+ format: 'markdown',
103
+ markdown,
104
+ metadata
105
+ };
106
+ return websocket_1.default.messageManager.sendAndWaitForResponse(event, 'saveMemoryResponse');
107
+ },
108
+ update: (memoryId, markdown, metadata = {}) => {
109
+ const event = {
110
+ type: 'memoryEvent',
111
+ action: 'updateMemory',
112
+ requestId: (0, crypto_1.randomUUID)(),
113
+ format: 'markdown',
114
+ memoryId,
115
+ markdown,
116
+ metadata
117
+ };
118
+ return websocket_1.default.messageManager.sendAndWaitForResponse(event, 'updateMemoryResponse');
119
+ },
120
+ delete: (memoryId) => {
121
+ const event = {
122
+ type: 'memoryEvent',
123
+ action: 'deleteMemory',
124
+ requestId: (0, crypto_1.randomUUID)(),
125
+ format: 'markdown',
126
+ memoryId
127
+ };
128
+ return websocket_1.default.messageManager.sendAndWaitForResponse(event, 'deleteMemoryResponse');
129
+ },
130
+ list: (filters = {}) => {
131
+ const event = {
132
+ type: 'memoryEvent',
133
+ action: 'listMemory',
134
+ requestId: (0, crypto_1.randomUUID)(),
135
+ format: 'markdown',
136
+ filters
137
+ };
138
+ return websocket_1.default.messageManager.sendAndWaitForResponse(event, 'listMemoryResponse');
139
+ }
140
+ }
141
+ };
142
+ exports.default = cbmemory;
@@ -176,6 +176,12 @@ declare const taskService: {
176
176
  * @deprecated Use getTaskList instead
177
177
  */
178
178
  getTasksByCategory: (category: string) => Promise<GetTaskListResponse>;
179
+ attachJsonMemoryToTask: (taskId: string, memoryId: string) => Promise<any>;
180
+ attachMarktownMemoryJToTask: (taskId: string, memoryId: string) => Promise<any>;
181
+ attachToDoToTask: (taskId: string, todoId: string) => Promise<any>;
182
+ getAttachedTodos: (taskId: string) => Promise<any>;
183
+ getAttachedJsonMemory: (taskId: string) => Promise<any>;
184
+ getAttachedMarkdownMemory: (taskId: string) => Promise<any>;
179
185
  };
180
186
  export type { Task, ExtendedTask, Step, ExtendedStep, TaskMessage, MessageData, ResponseMessageData, TaskStats, CreateTaskOptions, UpdateTaskOptions, GetTaskListOptions, AddStepToTaskOptions, GetTaskDetailOptions, GetTaskMessagesOptions, UpdateStepStatusOptions, CompleteStepOptions, SendSteeringMessageOptions, GetAllStepsOptions, GetActiveStepOptions, DeleteTaskOptions, CompleteTaskOptions, StartTaskOptions, CanTaskStartOptions, GetTasksDependentOnOptions, GetTasksReadyToStartOptions, GetTaskDependencyChainOptions, GetTaskStatsOptions, TaskResponse, TaskListResponse, StepResponse, StepListResponse, TaskMessagesResponse, ActiveStepResponse, SendSteeringMessageResponse, DeleteTaskResponse, CanTaskStartResponse, TaskStatsResponse, CreateTaskResponse, GetTaskListResponse, AddStepToTaskResponse, GetTaskDetailResponse, GetTaskMessagesResponse, GetAllStepsResponse, GetCurrentRunningStepResponse, UpdateStepStatusResponse, CompleteStepResponse, UpdateTaskResponse, CompleteTaskResponse, StartTaskResponse, GetTasksDependentOnResponse, GetTasksReadyToStartResponse, GetTaskDependencyChainResponse, GetTaskStatsResponse, Position, FlowData };
181
187
  export type { LegacyTask as Task_Legacy, LegacySubTask as SubTask, LegacyTaskResponse as TaskResponse_Legacy, LegacyTaskCreateOptions as TaskCreateOptions_Legacy, LegacyTaskUpdateOptions as TaskUpdateOptions_Legacy, AddSubTaskOptions, UpdateSubTaskOptions, TaskFilterOptions, TaskMarkdownImportOptions, TaskMarkdownExportOptions };
@@ -436,6 +436,69 @@ const taskService = {
436
436
  // Note: The new API doesn't have category filtering built-in
437
437
  // This would need to be implemented as post-processing
438
438
  return taskService.getTaskList();
439
+ },
440
+ attachJsonMemoryToTask: (taskId, memoryId) => {
441
+ const requestId = (0, crypto_1.randomUUID)();
442
+ const event = {
443
+ type: 'taskEvent',
444
+ action: 'attachJsonMemoryToTask',
445
+ requestId,
446
+ taskId,
447
+ memoryId
448
+ };
449
+ return websocket_1.default.messageManager.sendAndWaitForResponse(event, 'attachJsonMemoryToTaskResponse');
450
+ },
451
+ attachMarktownMemoryJToTask: (taskId, memoryId) => {
452
+ const requestId = (0, crypto_1.randomUUID)();
453
+ const event = {
454
+ type: 'taskEvent',
455
+ action: 'attachMarktownMemoryJToTask',
456
+ requestId,
457
+ taskId,
458
+ memoryId
459
+ };
460
+ return websocket_1.default.messageManager.sendAndWaitForResponse(event, 'attachJsonMemoryToTaskResponse');
461
+ },
462
+ attachToDoToTask: (taskId, todoId) => {
463
+ const requestId = (0, crypto_1.randomUUID)();
464
+ const event = {
465
+ type: 'taskEvent',
466
+ action: 'attachToDoToTask',
467
+ requestId,
468
+ taskId,
469
+ todoId
470
+ };
471
+ return websocket_1.default.messageManager.sendAndWaitForResponse(event, 'attachToDoToTaskResponse');
472
+ },
473
+ getAttachedTodos: (taskId) => {
474
+ const requestId = (0, crypto_1.randomUUID)();
475
+ const event = {
476
+ type: 'taskEvent',
477
+ action: 'attachToDoToTask',
478
+ requestId,
479
+ taskId,
480
+ };
481
+ return websocket_1.default.messageManager.sendAndWaitForResponse(event, 'attachToDoToTaskResponse');
482
+ },
483
+ getAttachedJsonMemory: (taskId) => {
484
+ const requestId = (0, crypto_1.randomUUID)();
485
+ const event = {
486
+ type: 'taskEvent',
487
+ action: 'getAttachedJsonMemory',
488
+ requestId,
489
+ taskId,
490
+ };
491
+ return websocket_1.default.messageManager.sendAndWaitForResponse(event, 'getAttachedJsonMemoryResponse');
492
+ },
493
+ getAttachedMarkdownMemory: (taskId) => {
494
+ const requestId = (0, crypto_1.randomUUID)();
495
+ const event = {
496
+ type: 'taskEvent',
497
+ action: 'getAttachedMarkdownMemory',
498
+ requestId,
499
+ taskId,
500
+ };
501
+ return websocket_1.default.messageManager.sendAndWaitForResponse(event, 'getAttachedMarkdownMemoryResponse');
439
502
  }
440
503
  };
441
504
  exports.default = taskService;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const cbTodo = {
4
+ createTodos: () => {
5
+ },
6
+ getTodos: (taskId) => {
7
+ }
8
+ };
9
+ module.exports = cbTodo;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebolt/codeboltjs",
3
- "version": "2.2.5",
3
+ "version": "4.0.3",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "",
@@ -23,7 +23,6 @@
23
23
  "access": "public"
24
24
  },
25
25
  "dependencies": {
26
- "@codebolt/types": "^1.0.18",
27
26
  "@types/uuid": "^10.0.0",
28
27
  "buffer": "^6.0.3",
29
28
  "execa": "^9.5.2",
@@ -35,7 +34,8 @@
35
34
  "util": "^0.12.5",
36
35
  "uuid": "^11.1.0",
37
36
  "ws": "^8.18.3",
38
- "yargs": "^17.7.2"
37
+ "yargs": "^17.7.2",
38
+ "@codebolt/types": "1.0.22"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/events": "^3.0.3",