@codebolt/codeboltjs 5.0.8 → 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 (124) hide show
  1. package/dist/core/Codebolt.d.ts +29 -5
  2. package/dist/core/Codebolt.js +58 -0
  3. package/dist/core/websocket.js +15 -17
  4. package/dist/index.d.ts +2 -0
  5. package/dist/index.js +6 -3
  6. package/dist/modules/dynamicPanel.d.ts +106 -0
  7. package/dist/modules/dynamicPanel.js +122 -0
  8. package/dist/modules/mcp.js +3 -0
  9. package/dist/modules/swarm.d.ts +8 -2
  10. package/dist/modules/swarm.js +14 -0
  11. package/dist/tools/actionBlock/action-block-start.js +1 -4
  12. package/dist/tools/actionPlan/action-plan-create.js +1 -2
  13. package/dist/tools/completion/attempt-completion.d.ts +25 -0
  14. package/dist/tools/completion/attempt-completion.js +45 -0
  15. package/dist/tools/completion/index.d.ts +3 -0
  16. package/dist/tools/completion/index.js +9 -0
  17. package/dist/tools/index.d.ts +6 -3
  18. package/dist/tools/index.js +11 -4
  19. package/dist/tools/job/index.d.ts +3 -1
  20. package/dist/tools/job/index.js +5 -1
  21. package/dist/tools/job/job-remove-dependency.d.ts +28 -0
  22. package/dist/tools/job/job-remove-dependency.js +86 -0
  23. package/dist/tools/requirementPlan/requirement-plan-review.js +1 -1
  24. package/dist/tools/thread/thread-create-background.js +1 -1
  25. package/dist/tools/utils/schema-validator.d.ts +1 -0
  26. package/dist/tools/utils/schema-validator.js +13 -1
  27. package/dist/types/job.d.ts +1 -1
  28. package/package.json +2 -2
  29. package/dist/modules/codeboltEvent.d.ts +0 -57
  30. package/dist/modules/codeboltEvent.js +0 -217
  31. package/dist/tools/browser/browser-action.d.ts +0 -56
  32. package/dist/tools/browser/browser-action.js +0 -265
  33. package/dist/tools/codeboltEvent/event-add-running-agent.d.ts +0 -25
  34. package/dist/tools/codeboltEvent/event-add-running-agent.js +0 -69
  35. package/dist/tools/codeboltEvent/event-check-background-agent-completion.d.ts +0 -19
  36. package/dist/tools/codeboltEvent/event-check-background-agent-completion.js +0 -64
  37. package/dist/tools/codeboltEvent/event-get-running-agent-count.d.ts +0 -19
  38. package/dist/tools/codeboltEvent/event-get-running-agent-count.js +0 -55
  39. package/dist/tools/codeboltEvent/event-on-background-agent-completion.d.ts +0 -19
  40. package/dist/tools/codeboltEvent/event-on-background-agent-completion.js +0 -56
  41. package/dist/tools/codeboltEvent/event-wait-for-external-event.d.ts +0 -19
  42. package/dist/tools/codeboltEvent/event-wait-for-external-event.js +0 -55
  43. package/dist/tools/codeboltEvent/index.d.ts +0 -19
  44. package/dist/tools/codeboltEvent/index.js +0 -33
  45. package/dist/tools/event/event-add-running-agent.d.ts +0 -32
  46. package/dist/tools/event/event-add-running-agent.js +0 -77
  47. package/dist/tools/event/event-check-agent-event.d.ts +0 -19
  48. package/dist/tools/event/event-check-agent-event.js +0 -63
  49. package/dist/tools/event/event-check-completion.d.ts +0 -19
  50. package/dist/tools/event/event-check-completion.js +0 -73
  51. package/dist/tools/event/event-check-grouped-completion.d.ts +0 -19
  52. package/dist/tools/event/event-check-grouped-completion.js +0 -63
  53. package/dist/tools/event/event-get-running-count.d.ts +0 -19
  54. package/dist/tools/event/event-get-running-count.js +0 -55
  55. package/dist/tools/event/event-on-agent-event.d.ts +0 -19
  56. package/dist/tools/event/event-on-agent-event.js +0 -63
  57. package/dist/tools/event/event-on-completion.d.ts +0 -19
  58. package/dist/tools/event/event-on-completion.js +0 -73
  59. package/dist/tools/event/event-on-grouped-completion.d.ts +0 -19
  60. package/dist/tools/event/event-on-grouped-completion.js +0 -63
  61. package/dist/tools/event/event-wait-any.d.ts +0 -19
  62. package/dist/tools/event/event-wait-any.js +0 -66
  63. package/dist/tools/event/index.d.ts +0 -25
  64. package/dist/tools/event/index.js +0 -48
  65. package/dist/tools/git/git-action.d.ts +0 -48
  66. package/dist/tools/git/git-action.js +0 -279
  67. package/dist/tools/kvStore/kv-store-create-instance.d.ts +0 -26
  68. package/dist/tools/kvStore/kv-store-create-instance.js +0 -79
  69. package/dist/tools/kvStore/kv-store-get.d.ts +0 -30
  70. package/dist/tools/kvStore/kv-store-get.js +0 -80
  71. package/dist/tools/kvStore/kv-store-set.d.ts +0 -38
  72. package/dist/tools/kvStore/kv-store-set.js +0 -86
  73. package/dist/tools/memoryIngestion/mi-create-pipeline.d.ts +0 -44
  74. package/dist/tools/memoryIngestion/mi-create-pipeline.js +0 -114
  75. package/dist/tools/memoryIngestion/mi-list.d.ts +0 -22
  76. package/dist/tools/memoryIngestion/mi-list.js +0 -66
  77. package/dist/tools/orchestration/agent-details.d.ts +0 -15
  78. package/dist/tools/orchestration/agent-details.js +0 -98
  79. package/dist/tools/orchestration/agent-find.d.ts +0 -18
  80. package/dist/tools/orchestration/agent-find.js +0 -125
  81. package/dist/tools/orchestration/agent-list.d.ts +0 -13
  82. package/dist/tools/orchestration/agent-list.js +0 -106
  83. package/dist/tools/orchestration/agent-management.d.ts +0 -44
  84. package/dist/tools/orchestration/agent-management.js +0 -250
  85. package/dist/tools/orchestration/agent-start.d.ts +0 -18
  86. package/dist/tools/orchestration/agent-start.js +0 -90
  87. package/dist/tools/orchestration/index.d.ts +0 -49
  88. package/dist/tools/orchestration/index.js +0 -102
  89. package/dist/tools/orchestration/task-assign.d.ts +0 -18
  90. package/dist/tools/orchestration/task-assign.js +0 -84
  91. package/dist/tools/orchestration/task-create.d.ts +0 -20
  92. package/dist/tools/orchestration/task-create.js +0 -97
  93. package/dist/tools/orchestration/task-delete.d.ts +0 -16
  94. package/dist/tools/orchestration/task-delete.js +0 -77
  95. package/dist/tools/orchestration/task-execute.d.ts +0 -18
  96. package/dist/tools/orchestration/task-execute.js +0 -84
  97. package/dist/tools/orchestration/task-get.d.ts +0 -16
  98. package/dist/tools/orchestration/task-get.js +0 -89
  99. package/dist/tools/orchestration/task-list.d.ts +0 -13
  100. package/dist/tools/orchestration/task-list.js +0 -74
  101. package/dist/tools/orchestration/task-management.d.ts +0 -52
  102. package/dist/tools/orchestration/task-management.js +0 -231
  103. package/dist/tools/orchestration/task-update.d.ts +0 -22
  104. package/dist/tools/orchestration/task-update.js +0 -96
  105. package/dist/tools/orchestration/thread-create-background.d.ts +0 -18
  106. package/dist/tools/orchestration/thread-create-background.js +0 -94
  107. package/dist/tools/orchestration/thread-create-start.d.ts +0 -16
  108. package/dist/tools/orchestration/thread-create-start.js +0 -85
  109. package/dist/tools/orchestration/thread-create.d.ts +0 -16
  110. package/dist/tools/orchestration/thread-create.js +0 -85
  111. package/dist/tools/orchestration/thread-delete.d.ts +0 -16
  112. package/dist/tools/orchestration/thread-delete.js +0 -77
  113. package/dist/tools/orchestration/thread-get-messages.d.ts +0 -24
  114. package/dist/tools/orchestration/thread-get-messages.js +0 -122
  115. package/dist/tools/orchestration/thread-get.d.ts +0 -16
  116. package/dist/tools/orchestration/thread-get.js +0 -85
  117. package/dist/tools/orchestration/thread-list.d.ts +0 -16
  118. package/dist/tools/orchestration/thread-list.js +0 -85
  119. package/dist/tools/orchestration/thread-start.d.ts +0 -16
  120. package/dist/tools/orchestration/thread-start.js +0 -82
  121. package/dist/tools/orchestration/thread-update-status.d.ts +0 -18
  122. package/dist/tools/orchestration/thread-update-status.js +0 -89
  123. package/dist/tools/orchestration/thread-update.d.ts +0 -18
  124. package/dist/tools/orchestration/thread-update.js +0 -89
@@ -1,16 +0,0 @@
1
- /**
2
- * Thread Delete Tool - Deletes a thread
3
- * Wraps the SDK's threadService.deleteThread() method
4
- */
5
- import type { ToolInvocation, ToolResult } from '../types';
6
- import { BaseDeclarativeTool } from '../base-tool';
7
- export interface ThreadDeleteParams {
8
- /** The thread ID to delete */
9
- threadId: string;
10
- }
11
- export declare class ThreadDeleteTool extends BaseDeclarativeTool<ThreadDeleteParams, ToolResult> {
12
- static readonly Name: string;
13
- constructor();
14
- protected validateToolParamValues(params: ThreadDeleteParams): string | null;
15
- protected createInvocation(params: ThreadDeleteParams): ToolInvocation<ThreadDeleteParams, ToolResult>;
16
- }
@@ -1,77 +0,0 @@
1
- "use strict";
2
- /**
3
- * Thread Delete Tool - Deletes a thread
4
- * Wraps the SDK's threadService.deleteThread() 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.ThreadDeleteTool = 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 ThreadDeleteInvocation 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.deleteThread(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 deletion failed';
26
- return {
27
- llmContent: `Thread deletion failed: ${errorMsg}`,
28
- returnDisplay: `Error: ${errorMsg}`,
29
- error: {
30
- message: errorMsg,
31
- type: types_1.ToolErrorType.EXECUTION_FAILED,
32
- },
33
- };
34
- }
35
- return {
36
- llmContent: `Deleted thread: ${this.params.threadId}`,
37
- returnDisplay: `Deleted thread: ${this.params.threadId}`,
38
- };
39
- }
40
- catch (error) {
41
- const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
42
- return {
43
- llmContent: `Error deleting thread: ${errorMessage}`,
44
- returnDisplay: `Error: ${errorMessage}`,
45
- error: {
46
- message: errorMessage,
47
- type: types_1.ToolErrorType.EXECUTION_FAILED,
48
- },
49
- };
50
- }
51
- }
52
- }
53
- class ThreadDeleteTool extends base_tool_1.BaseDeclarativeTool {
54
- constructor() {
55
- super(ThreadDeleteTool.Name, 'ThreadDelete', 'Deletes a thread by its ID.', types_1.Kind.Delete, {
56
- properties: {
57
- threadId: {
58
- description: 'The ID of the thread to delete.',
59
- type: 'string',
60
- },
61
- },
62
- required: ['threadId'],
63
- type: 'object',
64
- });
65
- }
66
- validateToolParamValues(params) {
67
- if (!params.threadId || params.threadId.trim() === '') {
68
- return "'threadId' is required";
69
- }
70
- return null;
71
- }
72
- createInvocation(params) {
73
- return new ThreadDeleteInvocation(params);
74
- }
75
- }
76
- exports.ThreadDeleteTool = ThreadDeleteTool;
77
- ThreadDeleteTool.Name = 'thread_delete';
@@ -1,24 +0,0 @@
1
- /**
2
- * Thread Get Messages Tool - Retrieves messages for a specific thread
3
- * Wraps the SDK's threadService.getThreadMessages() method
4
- */
5
- import type { ToolInvocation, ToolResult } from '../types';
6
- import { BaseDeclarativeTool } from '../base-tool';
7
- export interface ThreadGetMessagesParams {
8
- /** The thread ID to get messages for */
9
- threadId: string;
10
- /** Optional limit on number of messages */
11
- limit?: number;
12
- /** Optional offset for pagination */
13
- offset?: number;
14
- /** Optional: include only messages before this timestamp */
15
- before?: string;
16
- /** Optional: include only messages after this timestamp */
17
- after?: string;
18
- }
19
- export declare class ThreadGetMessagesTool extends BaseDeclarativeTool<ThreadGetMessagesParams, ToolResult> {
20
- static readonly Name: string;
21
- constructor();
22
- protected validateToolParamValues(params: ThreadGetMessagesParams): string | null;
23
- protected createInvocation(params: ThreadGetMessagesParams): ToolInvocation<ThreadGetMessagesParams, ToolResult>;
24
- }
@@ -1,122 +0,0 @@
1
- "use strict";
2
- /**
3
- * Thread Get Messages Tool - Retrieves messages for a specific thread
4
- * Wraps the SDK's threadService.getThreadMessages() 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.ThreadGetMessagesTool = 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 ThreadGetMessagesInvocation extends base_tool_1.BaseToolInvocation {
15
- constructor(params) {
16
- super(params);
17
- }
18
- async execute() {
19
- var _a, _b;
20
- try {
21
- const options = {
22
- taskId: this.params.threadId,
23
- };
24
- if (this.params.limit !== undefined) {
25
- options.limit = this.params.limit;
26
- }
27
- if (this.params.offset !== undefined) {
28
- options.offset = this.params.offset;
29
- }
30
- if (this.params.before !== undefined) {
31
- options.before = this.params.before;
32
- }
33
- if (this.params.after !== undefined) {
34
- options.after = this.params.after;
35
- }
36
- const response = await thread_1.default.getThreadMessages(options);
37
- if (response && !response.success && response.success !== undefined) {
38
- const errorMsg = typeof response.error === 'string'
39
- ? response.error
40
- : ((_a = response.error) === null || _a === void 0 ? void 0 : _a.message) || 'Failed to retrieve thread messages';
41
- return {
42
- llmContent: `Failed to retrieve thread messages: ${errorMsg}`,
43
- returnDisplay: `Error: ${errorMsg}`,
44
- error: {
45
- message: errorMsg,
46
- type: types_1.ToolErrorType.EXECUTION_FAILED,
47
- },
48
- };
49
- }
50
- const resp = response;
51
- let output = `Messages for thread: ${this.params.threadId}`;
52
- if (resp.messages) {
53
- output += `\n\nMessages (${resp.messages.length}):\n${JSON.stringify(resp.messages, null, 2)}`;
54
- }
55
- else {
56
- output += `\n\nResponse: ${JSON.stringify(resp, null, 2)}`;
57
- }
58
- return {
59
- llmContent: output,
60
- returnDisplay: `Retrieved ${((_b = resp.messages) === null || _b === void 0 ? void 0 : _b.length) || 0} messages`,
61
- };
62
- }
63
- catch (error) {
64
- const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
65
- return {
66
- llmContent: `Error retrieving thread messages: ${errorMessage}`,
67
- returnDisplay: `Error: ${errorMessage}`,
68
- error: {
69
- message: errorMessage,
70
- type: types_1.ToolErrorType.EXECUTION_FAILED,
71
- },
72
- };
73
- }
74
- }
75
- }
76
- class ThreadGetMessagesTool extends base_tool_1.BaseDeclarativeTool {
77
- constructor() {
78
- super(ThreadGetMessagesTool.Name, 'ThreadGetMessages', 'Retrieves messages for a specific thread with optional pagination.', types_1.Kind.Read, {
79
- properties: {
80
- threadId: {
81
- description: 'The ID of the thread to get messages for.',
82
- type: 'string',
83
- },
84
- limit: {
85
- description: 'Optional limit on number of messages to retrieve.',
86
- type: 'number',
87
- },
88
- offset: {
89
- description: 'Optional offset for pagination.',
90
- type: 'number',
91
- },
92
- before: {
93
- description: 'Optional: include only messages before this timestamp.',
94
- type: 'string',
95
- },
96
- after: {
97
- description: 'Optional: include only messages after this timestamp.',
98
- type: 'string',
99
- },
100
- },
101
- required: ['threadId'],
102
- type: 'object',
103
- });
104
- }
105
- validateToolParamValues(params) {
106
- if (!params.threadId || params.threadId.trim() === '') {
107
- return "'threadId' is required";
108
- }
109
- if (params.limit !== undefined && params.limit < 0) {
110
- return "'limit' must be a non-negative number";
111
- }
112
- if (params.offset !== undefined && params.offset < 0) {
113
- return "'offset' must be a non-negative number";
114
- }
115
- return null;
116
- }
117
- createInvocation(params) {
118
- return new ThreadGetMessagesInvocation(params);
119
- }
120
- }
121
- exports.ThreadGetMessagesTool = ThreadGetMessagesTool;
122
- ThreadGetMessagesTool.Name = 'thread_get_messages';
@@ -1,16 +0,0 @@
1
- /**
2
- * Thread Get Tool - Retrieves detailed information about a specific thread
3
- * Wraps the SDK's threadService.getThreadDetail() method
4
- */
5
- import type { ToolInvocation, ToolResult } from '../types';
6
- import { BaseDeclarativeTool } from '../base-tool';
7
- export interface ThreadGetParams {
8
- /** The thread ID to retrieve */
9
- threadId: string;
10
- }
11
- export declare class ThreadGetTool extends BaseDeclarativeTool<ThreadGetParams, ToolResult> {
12
- static readonly Name: string;
13
- constructor();
14
- protected validateToolParamValues(params: ThreadGetParams): string | null;
15
- protected createInvocation(params: ThreadGetParams): ToolInvocation<ThreadGetParams, ToolResult>;
16
- }
@@ -1,85 +0,0 @@
1
- "use strict";
2
- /**
3
- * Thread Get Tool - Retrieves detailed information about a specific thread
4
- * Wraps the SDK's threadService.getThreadDetail() 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.ThreadGetTool = 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 ThreadGetInvocation 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.getThreadDetail({ taskId: 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) || 'Failed to retrieve thread details';
26
- return {
27
- llmContent: `Failed to retrieve thread details: ${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 details for: ${this.params.threadId}`;
37
- if (resp.thread) {
38
- output += `\n\nThread: ${JSON.stringify(resp.thread, null, 2)}`;
39
- }
40
- else {
41
- output += `\n\nResponse: ${JSON.stringify(resp, null, 2)}`;
42
- }
43
- return {
44
- llmContent: output,
45
- returnDisplay: `Retrieved thread: ${this.params.threadId}`,
46
- };
47
- }
48
- catch (error) {
49
- const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
50
- return {
51
- llmContent: `Error retrieving thread details: ${errorMessage}`,
52
- returnDisplay: `Error: ${errorMessage}`,
53
- error: {
54
- message: errorMessage,
55
- type: types_1.ToolErrorType.EXECUTION_FAILED,
56
- },
57
- };
58
- }
59
- }
60
- }
61
- class ThreadGetTool extends base_tool_1.BaseDeclarativeTool {
62
- constructor() {
63
- super(ThreadGetTool.Name, 'ThreadGet', 'Retrieves detailed information about a specific thread.', types_1.Kind.Read, {
64
- properties: {
65
- threadId: {
66
- description: 'The ID of the thread to retrieve.',
67
- type: 'string',
68
- },
69
- },
70
- required: ['threadId'],
71
- type: 'object',
72
- });
73
- }
74
- validateToolParamValues(params) {
75
- if (!params.threadId || params.threadId.trim() === '') {
76
- return "'threadId' is required";
77
- }
78
- return null;
79
- }
80
- createInvocation(params) {
81
- return new ThreadGetInvocation(params);
82
- }
83
- }
84
- exports.ThreadGetTool = ThreadGetTool;
85
- ThreadGetTool.Name = 'thread_get';
@@ -1,16 +0,0 @@
1
- /**
2
- * Thread List Tool - Retrieves a list of threads
3
- * Wraps the SDK's threadService.getThreadList() method
4
- */
5
- import type { ToolInvocation, ToolResult } from '../types';
6
- import { BaseDeclarativeTool } from '../base-tool';
7
- export interface ThreadListParams {
8
- /** Optional filtering options */
9
- options?: Record<string, any>;
10
- }
11
- export declare class ThreadListTool extends BaseDeclarativeTool<ThreadListParams, ToolResult> {
12
- static readonly Name: string;
13
- constructor();
14
- protected validateToolParamValues(params: ThreadListParams): string | null;
15
- protected createInvocation(params: ThreadListParams): ToolInvocation<ThreadListParams, ToolResult>;
16
- }
@@ -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
- }