@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,114 +0,0 @@
1
- "use strict";
2
- /**
3
- * Create Memory Ingestion Pipeline Tool - Creates a new memory ingestion pipeline
4
- */
5
- var __importDefault = (this && this.__importDefault) || function (mod) {
6
- return (mod && mod.__esModule) ? mod : { "default": mod };
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.CreateMemoryIngestionPipelineTool = void 0;
10
- const base_tool_1 = require("../base-tool");
11
- const memoryIngestion_1 = __importDefault(require("../../modules/memoryIngestion"));
12
- class CreateMemoryIngestionPipelineInvocation extends base_tool_1.BaseToolInvocation {
13
- constructor(params) {
14
- super(params);
15
- }
16
- toolLocations() {
17
- return [];
18
- }
19
- async execute() {
20
- try {
21
- const response = await memoryIngestion_1.default.create({
22
- pipelineId: this.params.pipelineId,
23
- label: this.params.label,
24
- description: this.params.description,
25
- source: this.params.source,
26
- processors: this.params.processors,
27
- });
28
- if (!response.success || !response.pipeline) {
29
- return {
30
- llmContent: `Error creating memory ingestion pipeline: ${response.error || 'Unknown error'}`,
31
- returnDisplay: `Error creating memory ingestion pipeline: ${response.error || 'Unknown error'}`,
32
- error: {
33
- message: response.error || 'Unknown error',
34
- type: 'unknown',
35
- },
36
- };
37
- }
38
- const pipeline = response.pipeline;
39
- const content = `Memory ingestion pipeline created successfully:\n` +
40
- `ID: ${pipeline.id}\n` +
41
- `Label: ${pipeline.label}\n` +
42
- `Status: ${pipeline.status}`;
43
- return {
44
- llmContent: content,
45
- returnDisplay: content,
46
- };
47
- }
48
- catch (error) {
49
- return {
50
- llmContent: `Error creating memory ingestion pipeline: ${error}`,
51
- returnDisplay: `Error creating memory ingestion pipeline: ${error}`,
52
- error: {
53
- message: String(error),
54
- type: 'unknown',
55
- },
56
- };
57
- }
58
- }
59
- }
60
- class CreateMemoryIngestionPipelineTool extends base_tool_1.BaseDeclarativeTool {
61
- constructor() {
62
- super('memoryIngestion_create', 'Create a new memory ingestion pipeline for processing data into memory', {
63
- type: 'object',
64
- properties: {
65
- pipelineId: {
66
- type: 'string',
67
- description: 'Pipeline ID',
68
- },
69
- label: {
70
- type: 'string',
71
- description: 'Pipeline label/name',
72
- },
73
- description: {
74
- type: 'string',
75
- description: 'Pipeline description',
76
- },
77
- source: {
78
- type: 'object',
79
- description: 'Source configuration',
80
- properties: {
81
- type: {
82
- type: 'string',
83
- description: 'Source type',
84
- },
85
- },
86
- required: ['type'],
87
- },
88
- processors: {
89
- type: 'array',
90
- description: 'Processors configuration',
91
- items: {
92
- type: 'object',
93
- properties: {
94
- type: {
95
- type: 'string',
96
- description: 'Processor type',
97
- },
98
- },
99
- required: ['type'],
100
- },
101
- },
102
- explanation: {
103
- type: 'string',
104
- description: 'One sentence explanation of why this tool is being used',
105
- },
106
- },
107
- required: ['pipelineId', 'label', 'source', 'processors'],
108
- });
109
- }
110
- createInvocation(params, invocationId) {
111
- return new CreateMemoryIngestionPipelineInvocation(params);
112
- }
113
- }
114
- exports.CreateMemoryIngestionPipelineTool = CreateMemoryIngestionPipelineTool;
@@ -1,22 +0,0 @@
1
- /**
2
- * List Memory Ingestion Pipelines Tool - Lists memory ingestion pipelines
3
- */
4
- import type { ToolInvocation, ToolResult } from '../types';
5
- import { BaseDeclarativeTool } from '../base-tool';
6
- /**
7
- * Parameters for the ListMemoryIngestionPipelines tool
8
- */
9
- export interface ListMemoryIngestionPipelinesParams {
10
- /**
11
- * Optional status filter
12
- */
13
- status?: string;
14
- /**
15
- * One sentence explanation of why this tool is being used
16
- */
17
- explanation?: string;
18
- }
19
- export declare class ListMemoryIngestionPipelinesTool extends BaseDeclarativeTool<ListMemoryIngestionPipelinesParams, ToolResult> {
20
- constructor();
21
- createInvocation(params: ListMemoryIngestionPipelinesParams, invocationId: string): ToolInvocation;
22
- }
@@ -1,66 +0,0 @@
1
- "use strict";
2
- /**
3
- * List Memory Ingestion Pipelines Tool - Lists memory ingestion pipelines
4
- */
5
- var __importDefault = (this && this.__importDefault) || function (mod) {
6
- return (mod && mod.__esModule) ? mod : { "default": mod };
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.ListMemoryIngestionPipelinesTool = void 0;
10
- const base_tool_1 = require("../base-tool");
11
- const memoryIngestion_1 = __importDefault(require("../../modules/memoryIngestion"));
12
- class ListMemoryIngestionPipelinesInvocation extends base_tool_1.BaseToolInvocation {
13
- constructor(params) {
14
- super(params);
15
- }
16
- toolLocations() {
17
- return [];
18
- }
19
- async execute() {
20
- try {
21
- const filters = {};
22
- if (this.params.status) {
23
- filters.status = this.params.status;
24
- }
25
- const response = await memoryIngestion_1.default.list(filters);
26
- const pipelines = response.pipelines || [];
27
- const content = `Found ${pipelines.length} memory ingestion pipeline(s):\n` +
28
- pipelines.map((p) => `- ${p.id}: ${p.label} (${p.status})${p.description ? ' - ' + p.description : ''}`).join('\n');
29
- return {
30
- llmContent: content,
31
- returnDisplay: content,
32
- };
33
- }
34
- catch (error) {
35
- return {
36
- llmContent: `Error listing memory ingestion pipelines: ${error}`,
37
- returnDisplay: `Error listing memory ingestion pipelines: ${error}`,
38
- error: {
39
- message: String(error),
40
- type: 'unknown',
41
- },
42
- };
43
- }
44
- }
45
- }
46
- class ListMemoryIngestionPipelinesTool extends base_tool_1.BaseDeclarativeTool {
47
- constructor() {
48
- super('memoryIngestion_list', 'List all memory ingestion pipelines with optional status filter', {
49
- type: 'object',
50
- properties: {
51
- status: {
52
- type: 'string',
53
- description: 'Optional status filter',
54
- },
55
- explanation: {
56
- type: 'string',
57
- description: 'One sentence explanation of why this tool is being used',
58
- },
59
- },
60
- });
61
- }
62
- createInvocation(params, invocationId) {
63
- return new ListMemoryIngestionPipelinesInvocation(params);
64
- }
65
- }
66
- exports.ListMemoryIngestionPipelinesTool = ListMemoryIngestionPipelinesTool;
@@ -1,15 +0,0 @@
1
- /**
2
- * Agent Details Tool - Gets details of specific agents
3
- * Wraps the SDK's codeboltAgent.getAgentsDetail() method
4
- */
5
- import type { ToolInvocation, ToolResult } from '../types';
6
- import { BaseDeclarativeTool } from '../base-tool';
7
- export interface AgentDetailsParams {
8
- /** List of agent IDs to get details for */
9
- agent_list?: string[];
10
- }
11
- export declare class AgentDetailsTool extends BaseDeclarativeTool<AgentDetailsParams, ToolResult> {
12
- static readonly Name: string;
13
- constructor();
14
- protected createInvocation(params: AgentDetailsParams): ToolInvocation<AgentDetailsParams, ToolResult>;
15
- }
@@ -1,98 +0,0 @@
1
- "use strict";
2
- /**
3
- * Agent Details Tool - Gets details of specific agents
4
- * Wraps the SDK's codeboltAgent.getAgentsDetail() 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.AgentDetailsTool = 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 AgentDetailsInvocation extends base_tool_1.BaseToolInvocation {
15
- constructor(params) {
16
- super(params);
17
- }
18
- async execute() {
19
- var _a;
20
- try {
21
- const response = await agent_1.default.getAgentsDetail(this.params.agent_list || []);
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 details failed';
28
- return {
29
- llmContent: `Agent details 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 = 'Retrieved agent details';
38
- const agents = (_a = response.payload) === null || _a === void 0 ? void 0 : _a.agents;
39
- if (agents && Array.isArray(agents)) {
40
- output += `\n\nAgent Details:\n`;
41
- for (const agent of agents) {
42
- if (agent && typeof agent === 'object') {
43
- const agentId = ('id' in agent || 'name' in agent)
44
- ? String(agent.id || agent.name)
45
- : 'Unknown';
46
- output += `\n--- ${agentId} ---\n`;
47
- const agentDesc = ('description' in agent)
48
- ? String(agent.description || 'N/A')
49
- : 'N/A';
50
- output += `Description: ${agentDesc}\n`;
51
- if ('capabilities' in agent && Array.isArray(agent.capabilities)) {
52
- const capabilities = agent.capabilities;
53
- output += `Capabilities: ${capabilities.map(c => String(c)).join(', ')}\n`;
54
- }
55
- if ('status' in agent) {
56
- output += `Status: ${String(agent.status)}\n`;
57
- }
58
- }
59
- }
60
- }
61
- return {
62
- llmContent: output,
63
- returnDisplay: 'Retrieved agent details',
64
- };
65
- }
66
- catch (error) {
67
- const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
68
- return {
69
- llmContent: `Error getting agent details: ${errorMessage}`,
70
- returnDisplay: `Error: ${errorMessage}`,
71
- error: {
72
- message: errorMessage,
73
- type: types_1.ToolErrorType.EXECUTION_FAILED,
74
- },
75
- };
76
- }
77
- }
78
- }
79
- class AgentDetailsTool extends base_tool_1.BaseDeclarativeTool {
80
- constructor() {
81
- super(AgentDetailsTool.Name, 'AgentDetails', 'Retrieves details of specific agents.', types_1.Kind.Read, {
82
- properties: {
83
- agent_list: {
84
- description: 'List of agent IDs to get details for.',
85
- type: 'array',
86
- items: { type: 'string' },
87
- },
88
- },
89
- required: [],
90
- type: 'object',
91
- });
92
- }
93
- createInvocation(params) {
94
- return new AgentDetailsInvocation(params);
95
- }
96
- }
97
- exports.AgentDetailsTool = AgentDetailsTool;
98
- AgentDetailsTool.Name = 'agent_details';
@@ -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
- }