@codebolt/codeboltjs 5.0.7 → 5.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/dist/core/Codebolt.d.ts +331 -303
  2. package/dist/core/Codebolt.js +58 -0
  3. package/dist/core/websocket.js +15 -17
  4. package/dist/index.d.ts +67 -29
  5. package/dist/index.js +124 -9
  6. package/dist/modules/agentDeliberation.d.ts +1 -1
  7. package/dist/modules/agentDeliberation.js +9 -9
  8. package/dist/modules/agentEventQueue.d.ts +3 -3
  9. package/dist/modules/agentEventQueue.js +4 -4
  10. package/dist/modules/autoTesting.d.ts +1 -1
  11. package/dist/modules/autoTesting.js +19 -19
  12. package/dist/modules/backgroundChildThreads.js +22 -4
  13. package/dist/modules/codebaseSearch.d.ts +1 -1
  14. package/dist/modules/codemap.d.ts +1 -1
  15. package/dist/modules/contextAssembly.d.ts +1 -1
  16. package/dist/modules/contextRuleEngine.d.ts +1 -1
  17. package/dist/modules/dynamicPanel.d.ts +106 -0
  18. package/dist/modules/dynamicPanel.js +122 -0
  19. package/dist/modules/eventLog.d.ts +1 -1
  20. package/dist/modules/fileUpdateIntent.d.ts +1 -1
  21. package/dist/modules/groupFeedback.d.ts +2 -2
  22. package/dist/modules/groupFeedback.js +8 -8
  23. package/dist/modules/hook.d.ts +1 -1
  24. package/dist/modules/job.d.ts +1 -1
  25. package/dist/modules/knowledgeGraph.d.ts +1 -1
  26. package/dist/modules/kvStore.d.ts +1 -1
  27. package/dist/modules/mcp.js +6 -3
  28. package/dist/modules/memoryIngestion.d.ts +1 -1
  29. package/dist/modules/orchestrator.js +1 -1
  30. package/dist/modules/persistentMemory.d.ts +1 -1
  31. package/dist/modules/projectStructure.d.ts +1 -1
  32. package/dist/modules/projectStructureUpdateRequest.d.ts +1 -1
  33. package/dist/modules/reviewMergeRequest.d.ts +6 -2
  34. package/dist/modules/roadmap.d.ts +1 -1
  35. package/dist/modules/swarm.d.ts +8 -2
  36. package/dist/modules/swarm.js +14 -0
  37. package/dist/modules/user-message-manager.js +4 -4
  38. package/dist/tools/actionBlock/action-block-start.js +1 -4
  39. package/dist/tools/actionPlan/action-plan-create.js +1 -2
  40. package/dist/tools/completion/attempt-completion.d.ts +25 -0
  41. package/dist/tools/completion/attempt-completion.js +45 -0
  42. package/dist/tools/completion/index.d.ts +3 -0
  43. package/dist/tools/completion/index.js +9 -0
  44. package/dist/tools/index.d.ts +6 -3
  45. package/dist/tools/index.js +59 -57
  46. package/dist/tools/job/index.d.ts +3 -1
  47. package/dist/tools/job/index.js +5 -1
  48. package/dist/tools/job/job-remove-dependency.d.ts +28 -0
  49. package/dist/tools/job/job-remove-dependency.js +86 -0
  50. package/dist/tools/requirementPlan/requirement-plan-add-section.js +1 -1
  51. package/dist/tools/requirementPlan/requirement-plan-review.js +1 -1
  52. package/dist/tools/review/review-create.js +1 -1
  53. package/dist/tools/reviewMergeRequest/rmr-create.js +3 -2
  54. package/dist/tools/thread/thread-create-background.js +1 -1
  55. package/dist/tools/utils/schema-validator.d.ts +1 -0
  56. package/dist/tools/utils/schema-validator.js +13 -1
  57. package/dist/types/job.d.ts +1 -1
  58. package/package.json +2 -2
  59. package/dist/modules/codeboltEvent.d.ts +0 -57
  60. package/dist/modules/codeboltEvent.js +0 -217
  61. package/dist/tools/browser/browser-action.d.ts +0 -56
  62. package/dist/tools/browser/browser-action.js +0 -265
  63. package/dist/tools/codeboltEvent/event-add-running-agent.d.ts +0 -25
  64. package/dist/tools/codeboltEvent/event-add-running-agent.js +0 -69
  65. package/dist/tools/codeboltEvent/event-check-background-agent-completion.d.ts +0 -19
  66. package/dist/tools/codeboltEvent/event-check-background-agent-completion.js +0 -64
  67. package/dist/tools/codeboltEvent/event-get-running-agent-count.d.ts +0 -19
  68. package/dist/tools/codeboltEvent/event-get-running-agent-count.js +0 -55
  69. package/dist/tools/codeboltEvent/event-on-background-agent-completion.d.ts +0 -19
  70. package/dist/tools/codeboltEvent/event-on-background-agent-completion.js +0 -56
  71. package/dist/tools/codeboltEvent/event-wait-for-external-event.d.ts +0 -19
  72. package/dist/tools/codeboltEvent/event-wait-for-external-event.js +0 -55
  73. package/dist/tools/codeboltEvent/index.d.ts +0 -19
  74. package/dist/tools/codeboltEvent/index.js +0 -33
  75. package/dist/tools/event/event-add-running-agent.d.ts +0 -32
  76. package/dist/tools/event/event-add-running-agent.js +0 -77
  77. package/dist/tools/event/event-check-agent-event.d.ts +0 -19
  78. package/dist/tools/event/event-check-agent-event.js +0 -63
  79. package/dist/tools/event/event-check-completion.d.ts +0 -19
  80. package/dist/tools/event/event-check-completion.js +0 -73
  81. package/dist/tools/event/event-check-grouped-completion.d.ts +0 -19
  82. package/dist/tools/event/event-check-grouped-completion.js +0 -63
  83. package/dist/tools/event/event-get-running-count.d.ts +0 -19
  84. package/dist/tools/event/event-get-running-count.js +0 -55
  85. package/dist/tools/event/event-on-agent-event.d.ts +0 -19
  86. package/dist/tools/event/event-on-agent-event.js +0 -63
  87. package/dist/tools/event/event-on-completion.d.ts +0 -19
  88. package/dist/tools/event/event-on-completion.js +0 -73
  89. package/dist/tools/event/event-on-grouped-completion.d.ts +0 -19
  90. package/dist/tools/event/event-on-grouped-completion.js +0 -63
  91. package/dist/tools/event/event-wait-any.d.ts +0 -19
  92. package/dist/tools/event/event-wait-any.js +0 -66
  93. package/dist/tools/event/index.d.ts +0 -25
  94. package/dist/tools/event/index.js +0 -48
  95. package/dist/tools/git/git-action.d.ts +0 -48
  96. package/dist/tools/git/git-action.js +0 -279
  97. package/dist/tools/kvStore/kv-store-create-instance.d.ts +0 -26
  98. package/dist/tools/kvStore/kv-store-create-instance.js +0 -79
  99. package/dist/tools/kvStore/kv-store-get.d.ts +0 -30
  100. package/dist/tools/kvStore/kv-store-get.js +0 -80
  101. package/dist/tools/kvStore/kv-store-set.d.ts +0 -38
  102. package/dist/tools/kvStore/kv-store-set.js +0 -86
  103. package/dist/tools/memoryIngestion/mi-create-pipeline.d.ts +0 -44
  104. package/dist/tools/memoryIngestion/mi-create-pipeline.js +0 -114
  105. package/dist/tools/memoryIngestion/mi-list.d.ts +0 -22
  106. package/dist/tools/memoryIngestion/mi-list.js +0 -66
  107. package/dist/tools/orchestration/agent-details.d.ts +0 -15
  108. package/dist/tools/orchestration/agent-details.js +0 -98
  109. package/dist/tools/orchestration/agent-find.d.ts +0 -18
  110. package/dist/tools/orchestration/agent-find.js +0 -125
  111. package/dist/tools/orchestration/agent-list.d.ts +0 -13
  112. package/dist/tools/orchestration/agent-list.js +0 -106
  113. package/dist/tools/orchestration/agent-management.d.ts +0 -44
  114. package/dist/tools/orchestration/agent-management.js +0 -250
  115. package/dist/tools/orchestration/agent-start.d.ts +0 -18
  116. package/dist/tools/orchestration/agent-start.js +0 -90
  117. package/dist/tools/orchestration/index.d.ts +0 -49
  118. package/dist/tools/orchestration/index.js +0 -102
  119. package/dist/tools/orchestration/task-assign.d.ts +0 -18
  120. package/dist/tools/orchestration/task-assign.js +0 -84
  121. package/dist/tools/orchestration/task-create.d.ts +0 -20
  122. package/dist/tools/orchestration/task-create.js +0 -97
  123. package/dist/tools/orchestration/task-delete.d.ts +0 -16
  124. package/dist/tools/orchestration/task-delete.js +0 -77
  125. package/dist/tools/orchestration/task-execute.d.ts +0 -18
  126. package/dist/tools/orchestration/task-execute.js +0 -84
  127. package/dist/tools/orchestration/task-get.d.ts +0 -16
  128. package/dist/tools/orchestration/task-get.js +0 -89
  129. package/dist/tools/orchestration/task-list.d.ts +0 -13
  130. package/dist/tools/orchestration/task-list.js +0 -74
  131. package/dist/tools/orchestration/task-management.d.ts +0 -52
  132. package/dist/tools/orchestration/task-management.js +0 -231
  133. package/dist/tools/orchestration/task-update.d.ts +0 -22
  134. package/dist/tools/orchestration/task-update.js +0 -96
  135. package/dist/tools/orchestration/thread-create-background.d.ts +0 -18
  136. package/dist/tools/orchestration/thread-create-background.js +0 -94
  137. package/dist/tools/orchestration/thread-create-start.d.ts +0 -16
  138. package/dist/tools/orchestration/thread-create-start.js +0 -85
  139. package/dist/tools/orchestration/thread-create.d.ts +0 -16
  140. package/dist/tools/orchestration/thread-create.js +0 -85
  141. package/dist/tools/orchestration/thread-delete.d.ts +0 -16
  142. package/dist/tools/orchestration/thread-delete.js +0 -77
  143. package/dist/tools/orchestration/thread-get-messages.d.ts +0 -24
  144. package/dist/tools/orchestration/thread-get-messages.js +0 -122
  145. package/dist/tools/orchestration/thread-get.d.ts +0 -16
  146. package/dist/tools/orchestration/thread-get.js +0 -85
  147. package/dist/tools/orchestration/thread-list.d.ts +0 -16
  148. package/dist/tools/orchestration/thread-list.js +0 -85
  149. package/dist/tools/orchestration/thread-start.d.ts +0 -16
  150. package/dist/tools/orchestration/thread-start.js +0 -82
  151. package/dist/tools/orchestration/thread-update-status.d.ts +0 -18
  152. package/dist/tools/orchestration/thread-update-status.js +0 -89
  153. package/dist/tools/orchestration/thread-update.d.ts +0 -18
  154. package/dist/tools/orchestration/thread-update.js +0 -89
@@ -1,85 +0,0 @@
1
- "use strict";
2
- /**
3
- * Thread List Tool - Retrieves a list of threads
4
- * Wraps the SDK's threadService.getThreadList() method
5
- */
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
- };
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.ThreadListTool = void 0;
11
- const types_1 = require("../types");
12
- const base_tool_1 = require("../base-tool");
13
- const thread_1 = __importDefault(require("../../modules/thread"));
14
- class ThreadListInvocation extends base_tool_1.BaseToolInvocation {
15
- constructor(params) {
16
- super(params);
17
- }
18
- async execute() {
19
- var _a, _b;
20
- try {
21
- const response = await thread_1.default.getThreadList(this.params.options || {});
22
- if (response && !response.success && response.success !== undefined) {
23
- const errorMsg = typeof response.error === 'string'
24
- ? response.error
25
- : ((_a = response.error) === null || _a === void 0 ? void 0 : _a.message) || 'Failed to retrieve thread list';
26
- return {
27
- llmContent: `Failed to retrieve thread list: ${errorMsg}`,
28
- returnDisplay: `Error: ${errorMsg}`,
29
- error: {
30
- message: errorMsg,
31
- type: types_1.ToolErrorType.EXECUTION_FAILED,
32
- },
33
- };
34
- }
35
- const resp = response;
36
- let output = 'Thread list retrieved successfully';
37
- if (resp.threads) {
38
- output += `\n\nThreads (${resp.threads.length}):\n${JSON.stringify(resp.threads, null, 2)}`;
39
- }
40
- else {
41
- output += `\n\nResponse: ${JSON.stringify(resp, null, 2)}`;
42
- }
43
- return {
44
- llmContent: output,
45
- returnDisplay: `Retrieved ${((_b = resp.threads) === null || _b === void 0 ? void 0 : _b.length) || 0} threads`,
46
- };
47
- }
48
- catch (error) {
49
- const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
50
- return {
51
- llmContent: `Error retrieving thread list: ${errorMessage}`,
52
- returnDisplay: `Error: ${errorMessage}`,
53
- error: {
54
- message: errorMessage,
55
- type: types_1.ToolErrorType.EXECUTION_FAILED,
56
- },
57
- };
58
- }
59
- }
60
- }
61
- class ThreadListTool extends base_tool_1.BaseDeclarativeTool {
62
- constructor() {
63
- super(ThreadListTool.Name, 'ThreadList', 'Retrieves a list of threads with optional filtering.', types_1.Kind.Read, {
64
- properties: {
65
- options: {
66
- description: 'Optional filtering options for the thread list.',
67
- type: 'object',
68
- },
69
- },
70
- required: [],
71
- type: 'object',
72
- });
73
- }
74
- validateToolParamValues(params) {
75
- if (params.options !== undefined && typeof params.options !== 'object') {
76
- return "'options' must be an object if provided";
77
- }
78
- return null;
79
- }
80
- createInvocation(params) {
81
- return new ThreadListInvocation(params);
82
- }
83
- }
84
- exports.ThreadListTool = ThreadListTool;
85
- ThreadListTool.Name = 'thread_list';
@@ -1,16 +0,0 @@
1
- /**
2
- * Thread Start Tool - Starts a thread
3
- * Wraps the SDK's threadService.startThread() method
4
- */
5
- import type { ToolInvocation, ToolResult } from '../types';
6
- import { BaseDeclarativeTool } from '../base-tool';
7
- export interface ThreadStartParams {
8
- /** The thread ID to start */
9
- threadId: string;
10
- }
11
- export declare class ThreadStartTool extends BaseDeclarativeTool<ThreadStartParams, ToolResult> {
12
- static readonly Name: string;
13
- constructor();
14
- protected validateToolParamValues(params: ThreadStartParams): string | null;
15
- protected createInvocation(params: ThreadStartParams): ToolInvocation<ThreadStartParams, ToolResult>;
16
- }
@@ -1,82 +0,0 @@
1
- "use strict";
2
- /**
3
- * Thread Start Tool - Starts a thread
4
- * Wraps the SDK's threadService.startThread() method
5
- */
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
- };
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.ThreadStartTool = void 0;
11
- const types_1 = require("../types");
12
- const base_tool_1 = require("../base-tool");
13
- const thread_1 = __importDefault(require("../../modules/thread"));
14
- class ThreadStartInvocation extends base_tool_1.BaseToolInvocation {
15
- constructor(params) {
16
- super(params);
17
- }
18
- async execute() {
19
- var _a;
20
- try {
21
- const response = await thread_1.default.startThread(this.params.threadId);
22
- if (response && !response.success && response.success !== undefined) {
23
- const errorMsg = typeof response.error === 'string'
24
- ? response.error
25
- : ((_a = response.error) === null || _a === void 0 ? void 0 : _a.message) || 'Thread start failed';
26
- return {
27
- llmContent: `Thread start failed: ${errorMsg}`,
28
- returnDisplay: `Error: ${errorMsg}`,
29
- error: {
30
- message: errorMsg,
31
- type: types_1.ToolErrorType.EXECUTION_FAILED,
32
- },
33
- };
34
- }
35
- const resp = response;
36
- let output = `Started thread: ${this.params.threadId}`;
37
- if (resp.thread) {
38
- output += `\n\nThread: ${JSON.stringify(resp.thread, null, 2)}`;
39
- }
40
- return {
41
- llmContent: output,
42
- returnDisplay: `Started thread: ${this.params.threadId}`,
43
- };
44
- }
45
- catch (error) {
46
- const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
47
- return {
48
- llmContent: `Error starting thread: ${errorMessage}`,
49
- returnDisplay: `Error: ${errorMessage}`,
50
- error: {
51
- message: errorMessage,
52
- type: types_1.ToolErrorType.EXECUTION_FAILED,
53
- },
54
- };
55
- }
56
- }
57
- }
58
- class ThreadStartTool extends base_tool_1.BaseDeclarativeTool {
59
- constructor() {
60
- super(ThreadStartTool.Name, 'ThreadStart', 'Starts a thread by its ID.', types_1.Kind.Execute, {
61
- properties: {
62
- threadId: {
63
- description: 'The ID of the thread to start.',
64
- type: 'string',
65
- },
66
- },
67
- required: ['threadId'],
68
- type: 'object',
69
- });
70
- }
71
- validateToolParamValues(params) {
72
- if (!params.threadId || params.threadId.trim() === '') {
73
- return "'threadId' is required";
74
- }
75
- return null;
76
- }
77
- createInvocation(params) {
78
- return new ThreadStartInvocation(params);
79
- }
80
- }
81
- exports.ThreadStartTool = ThreadStartTool;
82
- ThreadStartTool.Name = 'thread_start';
@@ -1,18 +0,0 @@
1
- /**
2
- * Thread Update Status Tool - Updates the status of a thread
3
- * Wraps the SDK's threadService.updateThreadStatus() method
4
- */
5
- import type { ToolInvocation, ToolResult } from '../types';
6
- import { BaseDeclarativeTool } from '../base-tool';
7
- export interface ThreadUpdateStatusParams {
8
- /** The thread ID to update status for */
9
- threadId: string;
10
- /** The new status for the thread */
11
- status: string;
12
- }
13
- export declare class ThreadUpdateStatusTool extends BaseDeclarativeTool<ThreadUpdateStatusParams, ToolResult> {
14
- static readonly Name: string;
15
- constructor();
16
- protected validateToolParamValues(params: ThreadUpdateStatusParams): string | null;
17
- protected createInvocation(params: ThreadUpdateStatusParams): ToolInvocation<ThreadUpdateStatusParams, ToolResult>;
18
- }
@@ -1,89 +0,0 @@
1
- "use strict";
2
- /**
3
- * Thread Update Status Tool - Updates the status of a thread
4
- * Wraps the SDK's threadService.updateThreadStatus() method
5
- */
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
- };
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.ThreadUpdateStatusTool = void 0;
11
- const types_1 = require("../types");
12
- const base_tool_1 = require("../base-tool");
13
- const thread_1 = __importDefault(require("../../modules/thread"));
14
- class ThreadUpdateStatusInvocation extends base_tool_1.BaseToolInvocation {
15
- constructor(params) {
16
- super(params);
17
- }
18
- async execute() {
19
- var _a;
20
- try {
21
- const response = await thread_1.default.updateThreadStatus(this.params.threadId, this.params.status);
22
- if (response && !response.success && response.success !== undefined) {
23
- const errorMsg = typeof response.error === 'string'
24
- ? response.error
25
- : ((_a = response.error) === null || _a === void 0 ? void 0 : _a.message) || 'Thread status update failed';
26
- return {
27
- llmContent: `Thread status update failed: ${errorMsg}`,
28
- returnDisplay: `Error: ${errorMsg}`,
29
- error: {
30
- message: errorMsg,
31
- type: types_1.ToolErrorType.EXECUTION_FAILED,
32
- },
33
- };
34
- }
35
- const resp = response;
36
- let output = `Updated thread status: ${this.params.threadId} -> ${this.params.status}`;
37
- if (resp.thread) {
38
- output += `\n\nThread: ${JSON.stringify(resp.thread, null, 2)}`;
39
- }
40
- return {
41
- llmContent: output,
42
- returnDisplay: `Updated status to: ${this.params.status}`,
43
- };
44
- }
45
- catch (error) {
46
- const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
47
- return {
48
- llmContent: `Error updating thread status: ${errorMessage}`,
49
- returnDisplay: `Error: ${errorMessage}`,
50
- error: {
51
- message: errorMessage,
52
- type: types_1.ToolErrorType.EXECUTION_FAILED,
53
- },
54
- };
55
- }
56
- }
57
- }
58
- class ThreadUpdateStatusTool extends base_tool_1.BaseDeclarativeTool {
59
- constructor() {
60
- super(ThreadUpdateStatusTool.Name, 'ThreadUpdateStatus', 'Updates the status of a thread.', types_1.Kind.Edit, {
61
- properties: {
62
- threadId: {
63
- description: 'The ID of the thread to update status for.',
64
- type: 'string',
65
- },
66
- status: {
67
- description: 'The new status for the thread.',
68
- type: 'string',
69
- },
70
- },
71
- required: ['threadId', 'status'],
72
- type: 'object',
73
- });
74
- }
75
- validateToolParamValues(params) {
76
- if (!params.threadId || params.threadId.trim() === '') {
77
- return "'threadId' is required";
78
- }
79
- if (!params.status || params.status.trim() === '') {
80
- return "'status' is required";
81
- }
82
- return null;
83
- }
84
- createInvocation(params) {
85
- return new ThreadUpdateStatusInvocation(params);
86
- }
87
- }
88
- exports.ThreadUpdateStatusTool = ThreadUpdateStatusTool;
89
- ThreadUpdateStatusTool.Name = 'thread_update_status';
@@ -1,18 +0,0 @@
1
- /**
2
- * Thread Update Tool - Updates an existing thread
3
- * Wraps the SDK's threadService.updateThread() method
4
- */
5
- import type { ToolInvocation, ToolResult } from '../types';
6
- import { BaseDeclarativeTool } from '../base-tool';
7
- export interface ThreadUpdateParams {
8
- /** The thread ID to update */
9
- threadId: string;
10
- /** The updates to apply to the thread */
11
- updates: Record<string, any>;
12
- }
13
- export declare class ThreadUpdateTool extends BaseDeclarativeTool<ThreadUpdateParams, ToolResult> {
14
- static readonly Name: string;
15
- constructor();
16
- protected validateToolParamValues(params: ThreadUpdateParams): string | null;
17
- protected createInvocation(params: ThreadUpdateParams): ToolInvocation<ThreadUpdateParams, ToolResult>;
18
- }
@@ -1,89 +0,0 @@
1
- "use strict";
2
- /**
3
- * Thread Update Tool - Updates an existing thread
4
- * Wraps the SDK's threadService.updateThread() method
5
- */
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
- };
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.ThreadUpdateTool = void 0;
11
- const types_1 = require("../types");
12
- const base_tool_1 = require("../base-tool");
13
- const thread_1 = __importDefault(require("../../modules/thread"));
14
- class ThreadUpdateInvocation extends base_tool_1.BaseToolInvocation {
15
- constructor(params) {
16
- super(params);
17
- }
18
- async execute() {
19
- var _a;
20
- try {
21
- const response = await thread_1.default.updateThread(this.params.threadId, this.params.updates);
22
- if (response && !response.success && response.success !== undefined) {
23
- const errorMsg = typeof response.error === 'string'
24
- ? response.error
25
- : ((_a = response.error) === null || _a === void 0 ? void 0 : _a.message) || 'Thread update failed';
26
- return {
27
- llmContent: `Thread update failed: ${errorMsg}`,
28
- returnDisplay: `Error: ${errorMsg}`,
29
- error: {
30
- message: errorMsg,
31
- type: types_1.ToolErrorType.EXECUTION_FAILED,
32
- },
33
- };
34
- }
35
- const resp = response;
36
- let output = `Updated thread: ${this.params.threadId}`;
37
- if (resp.thread) {
38
- output += `\n\nThread: ${JSON.stringify(resp.thread, null, 2)}`;
39
- }
40
- return {
41
- llmContent: output,
42
- returnDisplay: `Updated thread: ${this.params.threadId}`,
43
- };
44
- }
45
- catch (error) {
46
- const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
47
- return {
48
- llmContent: `Error updating thread: ${errorMessage}`,
49
- returnDisplay: `Error: ${errorMessage}`,
50
- error: {
51
- message: errorMessage,
52
- type: types_1.ToolErrorType.EXECUTION_FAILED,
53
- },
54
- };
55
- }
56
- }
57
- }
58
- class ThreadUpdateTool extends base_tool_1.BaseDeclarativeTool {
59
- constructor() {
60
- super(ThreadUpdateTool.Name, 'ThreadUpdate', 'Updates an existing thread with the specified changes.', types_1.Kind.Edit, {
61
- properties: {
62
- threadId: {
63
- description: 'The ID of the thread to update.',
64
- type: 'string',
65
- },
66
- updates: {
67
- description: 'The updates to apply to the thread.',
68
- type: 'object',
69
- },
70
- },
71
- required: ['threadId', 'updates'],
72
- type: 'object',
73
- });
74
- }
75
- validateToolParamValues(params) {
76
- if (!params.threadId || params.threadId.trim() === '') {
77
- return "'threadId' is required";
78
- }
79
- if (!params.updates || typeof params.updates !== 'object') {
80
- return "'updates' is required and must be an object";
81
- }
82
- return null;
83
- }
84
- createInvocation(params) {
85
- return new ThreadUpdateInvocation(params);
86
- }
87
- }
88
- exports.ThreadUpdateTool = ThreadUpdateTool;
89
- ThreadUpdateTool.Name = 'thread_update';