@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,18 +0,0 @@
1
- /**
2
- * Agent Find Tool - Finds agents for a task
3
- * Wraps the SDK's codeboltAgent.findAgent() method
4
- */
5
- import type { ToolInvocation, ToolResult } from '../types';
6
- import { BaseDeclarativeTool } from '../base-tool';
7
- export interface AgentFindParams {
8
- /** Task description to find agents for */
9
- task: string;
10
- /** Maximum number of results */
11
- max_results?: number;
12
- }
13
- export declare class AgentFindTool extends BaseDeclarativeTool<AgentFindParams, ToolResult> {
14
- static readonly Name: string;
15
- constructor();
16
- protected validateToolParamValues(params: AgentFindParams): string | null;
17
- protected createInvocation(params: AgentFindParams): ToolInvocation<AgentFindParams, ToolResult>;
18
- }
@@ -1,125 +0,0 @@
1
- "use strict";
2
- /**
3
- * Agent Find Tool - Finds agents for a task
4
- * Wraps the SDK's codeboltAgent.findAgent() 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.AgentFindTool = void 0;
11
- const types_1 = require("../types");
12
- const base_tool_1 = require("../base-tool");
13
- const agent_1 = __importDefault(require("../../modules/agent"));
14
- const enum_1 = require("@codebolt/types/enum");
15
- class AgentFindInvocation extends base_tool_1.BaseToolInvocation {
16
- constructor(params) {
17
- super(params);
18
- }
19
- async execute() {
20
- try {
21
- const response = await agent_1.default.findAgent(this.params.task, this.params.max_results || 3, [], enum_1.AgentLocation.ALL, enum_1.FilterUsing.USE_VECTOR_DB);
22
- if (response && response.success === false) {
23
- const errorMsg = typeof response.error === 'string'
24
- ? response.error
25
- : (response.error && typeof response.error === 'object' && 'message' in response.error)
26
- ? String(response.error.message)
27
- : 'Agent find failed';
28
- return {
29
- llmContent: `Agent find failed: ${errorMsg}`,
30
- returnDisplay: `Error: ${errorMsg}`,
31
- error: {
32
- message: errorMsg,
33
- type: types_1.ToolErrorType.AGENT_NOT_FOUND,
34
- },
35
- };
36
- }
37
- let output = `Found agents for task: ${this.params.task}`;
38
- if (response.agents && Array.isArray(response.agents)) {
39
- output += `\n\nMatching Agents (${response.agents.length}):\n`;
40
- for (const agent of response.agents) {
41
- const agentId = this.getAgentId(agent);
42
- const agentDesc = this.getAgentDescription(agent);
43
- output += `- ${agentId}: ${agentDesc}\n`;
44
- if (agent && typeof agent === 'object' && 'score' in agent && typeof agent.score === 'number') {
45
- output += ` Score: ${(agent.score).toFixed(2)}\n`;
46
- }
47
- }
48
- }
49
- return {
50
- llmContent: output,
51
- returnDisplay: `Found agents for task: ${this.params.task}`,
52
- };
53
- }
54
- catch (error) {
55
- const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
56
- return {
57
- llmContent: `Error finding agents: ${errorMessage}`,
58
- returnDisplay: `Error: ${errorMessage}`,
59
- error: {
60
- message: errorMessage,
61
- type: types_1.ToolErrorType.EXECUTION_FAILED,
62
- },
63
- };
64
- }
65
- }
66
- getAgentId(agent) {
67
- if (this.isAgentToolFunctionDescriptor(agent)) {
68
- return agent.function.name;
69
- }
70
- if (agent && typeof agent === 'object' && ('id' in agent || 'name' in agent)) {
71
- return String(agent.id || agent.name);
72
- }
73
- return 'Unknown';
74
- }
75
- getAgentDescription(agent) {
76
- if (this.isAgentToolFunctionDescriptor(agent)) {
77
- return agent.function.description || 'No description';
78
- }
79
- if (agent && typeof agent === 'object' && 'description' in agent) {
80
- return String(agent.description || 'No description');
81
- }
82
- return 'No description';
83
- }
84
- isAgentToolFunctionDescriptor(x) {
85
- if (!x || typeof x !== 'object')
86
- return false;
87
- const maybe = x;
88
- if (maybe.type !== 'function')
89
- return false;
90
- const fn = maybe.function;
91
- if (!fn || typeof fn !== 'object')
92
- return false;
93
- const fnRec = fn;
94
- return typeof fnRec.name === 'string';
95
- }
96
- }
97
- class AgentFindTool extends base_tool_1.BaseDeclarativeTool {
98
- constructor() {
99
- super(AgentFindTool.Name, 'AgentFind', 'Finds agents suitable for a given task.', types_1.Kind.Read, {
100
- properties: {
101
- task: {
102
- description: 'The task description to find agents for.',
103
- type: 'string',
104
- },
105
- max_results: {
106
- description: 'Maximum number of results (default: 3).',
107
- type: 'number',
108
- },
109
- },
110
- required: ['task'],
111
- type: 'object',
112
- });
113
- }
114
- validateToolParamValues(params) {
115
- if (!params.task || params.task.trim() === '') {
116
- return "'task' is required for agent find";
117
- }
118
- return null;
119
- }
120
- createInvocation(params) {
121
- return new AgentFindInvocation(params);
122
- }
123
- }
124
- exports.AgentFindTool = AgentFindTool;
125
- AgentFindTool.Name = 'agent_find';
@@ -1,13 +0,0 @@
1
- /**
2
- * Agent List Tool - Lists all available agents
3
- * Wraps the SDK's codeboltAgent.getAgentsList() method
4
- */
5
- import type { ToolInvocation, ToolResult } from '../types';
6
- import { BaseDeclarativeTool } from '../base-tool';
7
- export interface AgentListParams {
8
- }
9
- export declare class AgentListTool extends BaseDeclarativeTool<AgentListParams, ToolResult> {
10
- static readonly Name: string;
11
- constructor();
12
- protected createInvocation(params: AgentListParams): ToolInvocation<AgentListParams, ToolResult>;
13
- }
@@ -1,106 +0,0 @@
1
- "use strict";
2
- /**
3
- * Agent List Tool - Lists all available agents
4
- * Wraps the SDK's codeboltAgent.getAgentsList() 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.AgentListTool = void 0;
11
- const types_1 = require("../types");
12
- const base_tool_1 = require("../base-tool");
13
- const agent_1 = __importDefault(require("../../modules/agent"));
14
- class AgentListInvocation extends base_tool_1.BaseToolInvocation {
15
- constructor(params) {
16
- super(params);
17
- }
18
- async execute() {
19
- try {
20
- const response = await agent_1.default.getAgentsList();
21
- if (response && response.success === false) {
22
- const errorMsg = typeof response.error === 'string'
23
- ? response.error
24
- : (response.error && typeof response.error === 'object' && 'message' in response.error)
25
- ? String(response.error.message)
26
- : 'Agent list failed';
27
- return {
28
- llmContent: `Agent list failed: ${errorMsg}`,
29
- returnDisplay: `Error: ${errorMsg}`,
30
- error: {
31
- message: errorMsg,
32
- type: types_1.ToolErrorType.EXECUTION_FAILED,
33
- },
34
- };
35
- }
36
- let output = 'Retrieved agent list';
37
- if (response.agents && Array.isArray(response.agents)) {
38
- output += `\n\nAvailable Agents (${response.agents.length}):\n`;
39
- for (const agent of response.agents) {
40
- const agentId = this.getAgentId(agent);
41
- const agentDesc = this.getAgentDescription(agent);
42
- output += `- ${agentId}: ${agentDesc}\n`;
43
- }
44
- }
45
- return {
46
- llmContent: output,
47
- returnDisplay: 'Retrieved agent list',
48
- };
49
- }
50
- catch (error) {
51
- const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
52
- return {
53
- llmContent: `Error listing agents: ${errorMessage}`,
54
- returnDisplay: `Error: ${errorMessage}`,
55
- error: {
56
- message: errorMessage,
57
- type: types_1.ToolErrorType.EXECUTION_FAILED,
58
- },
59
- };
60
- }
61
- }
62
- getAgentId(agent) {
63
- if (this.isAgentToolFunctionDescriptor(agent)) {
64
- return agent.function.name;
65
- }
66
- if (agent && typeof agent === 'object' && ('id' in agent || 'name' in agent)) {
67
- return String(agent.id || agent.name);
68
- }
69
- return 'Unknown';
70
- }
71
- getAgentDescription(agent) {
72
- if (this.isAgentToolFunctionDescriptor(agent)) {
73
- return agent.function.description || 'No description';
74
- }
75
- if (agent && typeof agent === 'object' && 'description' in agent) {
76
- return String(agent.description || 'No description');
77
- }
78
- return 'No description';
79
- }
80
- isAgentToolFunctionDescriptor(x) {
81
- if (!x || typeof x !== 'object')
82
- return false;
83
- const maybe = x;
84
- if (maybe.type !== 'function')
85
- return false;
86
- const fn = maybe.function;
87
- if (!fn || typeof fn !== 'object')
88
- return false;
89
- const fnRec = fn;
90
- return typeof fnRec.name === 'string';
91
- }
92
- }
93
- class AgentListTool extends base_tool_1.BaseDeclarativeTool {
94
- constructor() {
95
- super(AgentListTool.Name, 'AgentList', 'Lists all available agents.', types_1.Kind.Read, {
96
- properties: {},
97
- required: [],
98
- type: 'object',
99
- });
100
- }
101
- createInvocation(params) {
102
- return new AgentListInvocation(params);
103
- }
104
- }
105
- exports.AgentListTool = AgentListTool;
106
- AgentListTool.Name = 'agent_list';
@@ -1,44 +0,0 @@
1
- /**
2
- * Agent Management Tool - Manages agents
3
- * Wraps the SDK's codeboltAgent methods
4
- */
5
- import type { ToolInvocation, ToolResult } from '../types';
6
- import { BaseDeclarativeTool } from '../base-tool';
7
- /**
8
- * Supported agent actions
9
- */
10
- export type AgentActionType = 'find' | 'start' | 'list' | 'details';
11
- /**
12
- * Parameters for the AgentManagement tool
13
- */
14
- export interface AgentManagementToolParams {
15
- /**
16
- * The agent action to perform
17
- */
18
- action: AgentActionType;
19
- /**
20
- * Task description (for find/start)
21
- */
22
- task?: string;
23
- /**
24
- * Agent ID (for start)
25
- */
26
- agent_id?: string;
27
- /**
28
- * List of agent IDs (for details)
29
- */
30
- agent_list?: string[];
31
- /**
32
- * Maximum results (for find)
33
- */
34
- max_results?: number;
35
- }
36
- /**
37
- * Implementation of the AgentManagement tool logic
38
- */
39
- export declare class AgentManagementTool extends BaseDeclarativeTool<AgentManagementToolParams, ToolResult> {
40
- static readonly Name: string;
41
- constructor();
42
- protected validateToolParamValues(params: AgentManagementToolParams): string | null;
43
- protected createInvocation(params: AgentManagementToolParams): ToolInvocation<AgentManagementToolParams, ToolResult>;
44
- }
@@ -1,250 +0,0 @@
1
- "use strict";
2
- /**
3
- * Agent Management Tool - Manages agents
4
- * Wraps the SDK's codeboltAgent methods
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.AgentManagementTool = void 0;
11
- const types_1 = require("../types");
12
- const base_tool_1 = require("../base-tool");
13
- const agent_1 = __importDefault(require("../../modules/agent"));
14
- const enum_1 = require("@codebolt/types/enum");
15
- function isAgentToolFunctionDescriptor(x) {
16
- if (!x || typeof x !== 'object')
17
- return false;
18
- const maybe = x;
19
- if (maybe.type !== 'function')
20
- return false;
21
- const fn = maybe.function;
22
- if (!fn || typeof fn !== 'object')
23
- return false;
24
- const fnRec = fn;
25
- return typeof fnRec.name === 'string';
26
- }
27
- class AgentManagementToolInvocation extends base_tool_1.BaseToolInvocation {
28
- constructor(params) {
29
- super(params);
30
- }
31
- async execute() {
32
- var _a;
33
- try {
34
- const action = this.params.action;
35
- let response;
36
- let successMessage;
37
- switch (action) {
38
- case 'find':
39
- if (!this.params.task) {
40
- return this.createError("'task' is required for find action");
41
- }
42
- // findAgent requires all 5 arguments
43
- response = await agent_1.default.findAgent(this.params.task, this.params.max_results || 3, [], // agents filter
44
- enum_1.AgentLocation.ALL, enum_1.FilterUsing.USE_VECTOR_DB);
45
- successMessage = `Found agents for task: ${this.params.task}`;
46
- break;
47
- case 'start':
48
- if (!this.params.agent_id) {
49
- return this.createError("'agent_id' is required for start action");
50
- }
51
- if (!this.params.task) {
52
- return this.createError("'task' is required for start action");
53
- }
54
- response = await agent_1.default.startAgent(this.params.agent_id, this.params.task);
55
- successMessage = `Started agent ${this.params.agent_id} with task`;
56
- break;
57
- case 'list':
58
- response = await agent_1.default.getAgentsList();
59
- successMessage = 'Retrieved agent list';
60
- break;
61
- case 'details':
62
- response = await agent_1.default.getAgentsDetail(this.params.agent_list || []);
63
- successMessage = 'Retrieved agent details';
64
- break;
65
- default:
66
- return this.createError(`Unknown action: ${action}`);
67
- }
68
- // Check for errors with strict type checking
69
- if (response && response.success === false) {
70
- const errorMsg = typeof response.error === 'string'
71
- ? response.error
72
- : (response.error && typeof response.error === 'object' && 'message' in response.error)
73
- ? String(response.error.message)
74
- : 'Agent operation failed';
75
- return {
76
- llmContent: `Agent ${action} failed: ${errorMsg}`,
77
- returnDisplay: `Error: ${errorMsg}`,
78
- error: {
79
- message: errorMsg,
80
- type: types_1.ToolErrorType.AGENT_NOT_FOUND,
81
- },
82
- };
83
- }
84
- // Format output with strict type checking
85
- let output = successMessage;
86
- if (action === 'find') {
87
- const findResponse = response;
88
- if (findResponse.agents && Array.isArray(findResponse.agents)) {
89
- output += `\n\nMatching Agents (${findResponse.agents.length}):\n`;
90
- for (const agent of findResponse.agents) {
91
- // findAgent commonly returns the same tool/function descriptor shape as listAgents
92
- const agentId = isAgentToolFunctionDescriptor(agent)
93
- ? agent.function.name
94
- : (agent && typeof agent === 'object' && ('id' in agent || 'name' in agent))
95
- ? String(agent.id || agent.name)
96
- : 'Unknown';
97
- const agentDesc = isAgentToolFunctionDescriptor(agent)
98
- ? (agent.function.description || 'No description')
99
- : (agent && typeof agent === 'object' && 'description' in agent)
100
- ? String(agent.description || 'No description')
101
- : 'No description';
102
- output += `- ${agentId}: ${agentDesc}\n`;
103
- if (agent && typeof agent === 'object' && 'score' in agent && typeof agent.score === 'number') {
104
- output += ` Score: ${(agent.score).toFixed(2)}\n`;
105
- }
106
- }
107
- }
108
- }
109
- else if (action === 'list') {
110
- const listResponse = response;
111
- if (listResponse.agents && Array.isArray(listResponse.agents)) {
112
- output += `\n\nAvailable Agents (${listResponse.agents.length}):\n`;
113
- for (const agent of listResponse.agents) {
114
- const agentId = isAgentToolFunctionDescriptor(agent)
115
- ? agent.function.name
116
- : (agent && typeof agent === 'object' && ('id' in agent || 'name' in agent))
117
- ? String(agent.id || agent.name)
118
- : 'Unknown';
119
- const agentDesc = isAgentToolFunctionDescriptor(agent)
120
- ? (agent.function.description || 'No description')
121
- : (agent && typeof agent === 'object' && 'description' in agent)
122
- ? String(agent.description || 'No description')
123
- : 'No description';
124
- output += `- ${agentId}: ${agentDesc}\n`;
125
- }
126
- }
127
- }
128
- else if (action === 'details') {
129
- const detailResponse = response;
130
- const agents = (_a = detailResponse.payload) === null || _a === void 0 ? void 0 : _a.agents;
131
- if (agents && Array.isArray(agents)) {
132
- output += `\n\nAgent Details:\n`;
133
- for (const agent of agents) {
134
- if (agent && typeof agent === 'object') {
135
- const agentId = ('id' in agent || 'name' in agent)
136
- ? String(agent.id || agent.name)
137
- : 'Unknown';
138
- output += `\n--- ${agentId} ---\n`;
139
- const agentDesc = ('description' in agent)
140
- ? String(agent.description || 'N/A')
141
- : 'N/A';
142
- output += `Description: ${agentDesc}\n`;
143
- if ('capabilities' in agent && Array.isArray(agent.capabilities)) {
144
- const capabilities = agent.capabilities;
145
- output += `Capabilities: ${capabilities.map(c => String(c)).join(', ')}\n`;
146
- }
147
- if ('status' in agent) {
148
- output += `Status: ${String(agent.status)}\n`;
149
- }
150
- }
151
- }
152
- }
153
- }
154
- else if (action === 'start') {
155
- const startResponse = response;
156
- output += `\n\nAgent started successfully.`;
157
- if (startResponse.result !== undefined) {
158
- output += `\nResult: ${typeof startResponse.result === 'string' ? startResponse.result : JSON.stringify(startResponse.result, null, 2)}`;
159
- }
160
- }
161
- return {
162
- llmContent: output,
163
- returnDisplay: successMessage,
164
- };
165
- }
166
- catch (error) {
167
- const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
168
- return {
169
- llmContent: `Error executing agent ${this.params.action}: ${errorMessage}`,
170
- returnDisplay: `Error: ${errorMessage}`,
171
- error: {
172
- message: errorMessage,
173
- type: types_1.ToolErrorType.EXECUTION_FAILED,
174
- },
175
- };
176
- }
177
- }
178
- createError(message) {
179
- return {
180
- llmContent: `Error: ${message}`,
181
- returnDisplay: `Error: ${message}`,
182
- error: {
183
- message,
184
- type: types_1.ToolErrorType.INVALID_TOOL_PARAMS,
185
- },
186
- };
187
- }
188
- }
189
- /**
190
- * Implementation of the AgentManagement tool logic
191
- */
192
- class AgentManagementTool extends base_tool_1.BaseDeclarativeTool {
193
- constructor() {
194
- super(AgentManagementTool.Name, 'AgentManagement', `Manages agents - find agents for tasks, start agents, list available agents, and get agent details. Use this for multi-agent coordination.`, types_1.Kind.Other, {
195
- properties: {
196
- action: {
197
- description: "The agent action: 'find', 'start', 'list', or 'details'.",
198
- type: 'string',
199
- enum: ['find', 'start', 'list', 'details'],
200
- },
201
- task: {
202
- description: 'Task description (required for find/start).',
203
- type: 'string',
204
- },
205
- agent_id: {
206
- description: 'Agent ID (required for start).',
207
- type: 'string',
208
- },
209
- agent_list: {
210
- description: 'List of agent IDs (for details).',
211
- type: 'array',
212
- items: { type: 'string' },
213
- },
214
- max_results: {
215
- description: 'Maximum number of results (for find, default: 3).',
216
- type: 'number',
217
- },
218
- },
219
- required: ['action'],
220
- type: 'object',
221
- });
222
- }
223
- validateToolParamValues(params) {
224
- const validActions = ['find', 'start', 'list', 'details'];
225
- if (!validActions.includes(params.action)) {
226
- return `Invalid action: ${params.action}. Must be one of: ${validActions.join(', ')}`;
227
- }
228
- switch (params.action) {
229
- case 'find':
230
- if (!params.task) {
231
- return "'task' is required for find action";
232
- }
233
- break;
234
- case 'start':
235
- if (!params.agent_id) {
236
- return "'agent_id' is required for start action";
237
- }
238
- if (!params.task) {
239
- return "'task' is required for start action";
240
- }
241
- break;
242
- }
243
- return null;
244
- }
245
- createInvocation(params) {
246
- return new AgentManagementToolInvocation(params);
247
- }
248
- }
249
- exports.AgentManagementTool = AgentManagementTool;
250
- AgentManagementTool.Name = 'agent_management';
@@ -1,18 +0,0 @@
1
- /**
2
- * Agent Start Tool - Starts an agent with a task
3
- * Wraps the SDK's codeboltAgent.startAgent() method
4
- */
5
- import type { ToolInvocation, ToolResult } from '../types';
6
- import { BaseDeclarativeTool } from '../base-tool';
7
- export interface AgentStartParams {
8
- /** The agent ID to start */
9
- agent_id: string;
10
- /** The task for the agent */
11
- task: string;
12
- }
13
- export declare class AgentStartTool extends BaseDeclarativeTool<AgentStartParams, ToolResult> {
14
- static readonly Name: string;
15
- constructor();
16
- protected validateToolParamValues(params: AgentStartParams): string | null;
17
- protected createInvocation(params: AgentStartParams): ToolInvocation<AgentStartParams, ToolResult>;
18
- }
@@ -1,90 +0,0 @@
1
- "use strict";
2
- /**
3
- * Agent Start Tool - Starts an agent with a task
4
- * Wraps the SDK's codeboltAgent.startAgent() 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.AgentStartTool = void 0;
11
- const types_1 = require("../types");
12
- const base_tool_1 = require("../base-tool");
13
- const agent_1 = __importDefault(require("../../modules/agent"));
14
- class AgentStartInvocation extends base_tool_1.BaseToolInvocation {
15
- constructor(params) {
16
- super(params);
17
- }
18
- async execute() {
19
- try {
20
- const response = await agent_1.default.startAgent(this.params.agent_id, this.params.task);
21
- if (response && response.success === false) {
22
- const errorMsg = typeof response.error === 'string'
23
- ? response.error
24
- : (response.error && typeof response.error === 'object' && 'message' in response.error)
25
- ? String(response.error.message)
26
- : 'Agent start failed';
27
- return {
28
- llmContent: `Agent start failed: ${errorMsg}`,
29
- returnDisplay: `Error: ${errorMsg}`,
30
- error: {
31
- message: errorMsg,
32
- type: types_1.ToolErrorType.AGENT_NOT_FOUND,
33
- },
34
- };
35
- }
36
- let output = `Started agent ${this.params.agent_id} with task`;
37
- output += `\n\nAgent started successfully.`;
38
- if (response.result !== undefined) {
39
- output += `\nResult: ${typeof response.result === 'string' ? response.result : JSON.stringify(response.result, null, 2)}`;
40
- }
41
- return {
42
- llmContent: output,
43
- returnDisplay: `Started agent ${this.params.agent_id} with task`,
44
- };
45
- }
46
- catch (error) {
47
- const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
48
- return {
49
- llmContent: `Error starting agent: ${errorMessage}`,
50
- returnDisplay: `Error: ${errorMessage}`,
51
- error: {
52
- message: errorMessage,
53
- type: types_1.ToolErrorType.EXECUTION_FAILED,
54
- },
55
- };
56
- }
57
- }
58
- }
59
- class AgentStartTool extends base_tool_1.BaseDeclarativeTool {
60
- constructor() {
61
- super(AgentStartTool.Name, 'AgentStart', 'Starts an agent with a specific task.', types_1.Kind.Execute, {
62
- properties: {
63
- agent_id: {
64
- description: 'The ID of the agent to start.',
65
- type: 'string',
66
- },
67
- task: {
68
- description: 'The task for the agent to execute.',
69
- type: 'string',
70
- },
71
- },
72
- required: ['agent_id', 'task'],
73
- type: 'object',
74
- });
75
- }
76
- validateToolParamValues(params) {
77
- if (!params.agent_id || params.agent_id.trim() === '') {
78
- return "'agent_id' is required for agent start";
79
- }
80
- if (!params.task || params.task.trim() === '') {
81
- return "'task' is required for agent start";
82
- }
83
- return null;
84
- }
85
- createInvocation(params) {
86
- return new AgentStartInvocation(params);
87
- }
88
- }
89
- exports.AgentStartTool = AgentStartTool;
90
- AgentStartTool.Name = 'agent_start';