@codebolt/codeboltjs 5.0.9 → 5.1.12

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 (54) hide show
  1. package/dist/core/Codebolt.d.ts +21 -1
  2. package/dist/core/Codebolt.js +18 -16
  3. package/dist/core/websocket.js +1 -1
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +6 -3
  6. package/dist/modules/agentDeliberation.js +3 -1
  7. package/dist/modules/environment.d.ts +25 -0
  8. package/dist/modules/environment.js +54 -0
  9. package/dist/modules/swarm.d.ts +2 -8
  10. package/dist/modules/swarm.js +0 -14
  11. package/dist/modules/thread.d.ts +6 -0
  12. package/dist/modules/thread.js +6 -0
  13. package/dist/tools/environment/environment-create.d.ts +23 -0
  14. package/dist/tools/environment/environment-create.js +90 -0
  15. package/dist/tools/environment/environment-delete.d.ts +17 -0
  16. package/dist/tools/environment/environment-delete.js +70 -0
  17. package/dist/tools/environment/environment-get.d.ts +17 -0
  18. package/dist/tools/environment/environment-get.js +73 -0
  19. package/dist/tools/environment/environment-list.d.ts +15 -0
  20. package/dist/tools/environment/environment-list.js +72 -0
  21. package/dist/tools/environment/environment-providers.d.ts +24 -0
  22. package/dist/tools/environment/environment-providers.js +130 -0
  23. package/dist/tools/environment/environment-restart.d.ts +17 -0
  24. package/dist/tools/environment/environment-restart.js +70 -0
  25. package/dist/tools/environment/environment-send-message.d.ts +19 -0
  26. package/dist/tools/environment/environment-send-message.js +74 -0
  27. package/dist/tools/environment/environment-start-agent.d.ts +23 -0
  28. package/dist/tools/environment/environment-start-agent.js +83 -0
  29. package/dist/tools/environment/environment-start.d.ts +17 -0
  30. package/dist/tools/environment/environment-start.js +70 -0
  31. package/dist/tools/environment/environment-statistics.d.ts +15 -0
  32. package/dist/tools/environment/environment-statistics.js +69 -0
  33. package/dist/tools/environment/environment-status.d.ts +17 -0
  34. package/dist/tools/environment/environment-status.js +72 -0
  35. package/dist/tools/environment/environment-stop.d.ts +17 -0
  36. package/dist/tools/environment/environment-stop.js +70 -0
  37. package/dist/tools/environment/environment-update.d.ts +19 -0
  38. package/dist/tools/environment/environment-update.js +74 -0
  39. package/dist/tools/environment/index.d.ts +33 -0
  40. package/dist/tools/environment/index.js +65 -0
  41. package/dist/tools/index.d.ts +16 -2
  42. package/dist/tools/index.js +45 -5
  43. package/dist/tools/registry.d.ts +21 -0
  44. package/dist/tools/registry.js +38 -1
  45. package/dist/tools/tool-search.d.ts +49 -0
  46. package/dist/tools/tool-search.js +140 -0
  47. package/dist/tools/toolSearch/index.d.ts +9 -0
  48. package/dist/tools/toolSearch/index.js +15 -0
  49. package/dist/tools/toolSearch/tool-search-tool.d.ts +32 -0
  50. package/dist/tools/toolSearch/tool-search-tool.js +110 -0
  51. package/dist/types/agentDeliberation.d.ts +15 -1
  52. package/dist/types/agentDeliberation.js +2 -0
  53. package/dist/types/job.d.ts +1 -1
  54. package/package.json +20 -19
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Environment Get Tool - Gets an environment by ID
3
+ * Wraps the SDK's cbenvironment.getEnvironment() method
4
+ */
5
+ import type { ToolInvocation, ToolResult } from '../types';
6
+ import { BaseDeclarativeTool } from '../base-tool';
7
+ export interface EnvironmentGetParams {
8
+ /** One sentence explanation of why this tool is being used */
9
+ explanation?: string;
10
+ /** The ID of the environment to retrieve */
11
+ environmentId: string;
12
+ }
13
+ export declare class EnvironmentGetTool extends BaseDeclarativeTool<EnvironmentGetParams, ToolResult> {
14
+ static readonly Name: string;
15
+ constructor();
16
+ protected createInvocation(params: EnvironmentGetParams): ToolInvocation<EnvironmentGetParams, ToolResult>;
17
+ }
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ /**
3
+ * Environment Get Tool - Gets an environment by ID
4
+ * Wraps the SDK's cbenvironment.getEnvironment() 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.EnvironmentGetTool = void 0;
11
+ const types_1 = require("../types");
12
+ const base_tool_1 = require("../base-tool");
13
+ const environment_1 = __importDefault(require("../../modules/environment"));
14
+ const chat_1 = __importDefault(require("../../modules/chat"));
15
+ class EnvironmentGetInvocation extends base_tool_1.BaseToolInvocation {
16
+ constructor(params) {
17
+ super(params);
18
+ }
19
+ async execute() {
20
+ var _a, _b;
21
+ try {
22
+ if (this.params.explanation) {
23
+ chat_1.default.sendMessage(this.params.explanation);
24
+ }
25
+ const response = await environment_1.default.getEnvironment(this.params.environmentId);
26
+ if (response && response.success === false) {
27
+ const errorMsg = response.error || 'Environment not found';
28
+ return {
29
+ llmContent: `Failed to get environment: ${errorMsg}`,
30
+ returnDisplay: `Error: ${errorMsg}`,
31
+ error: { message: errorMsg, type: types_1.ToolErrorType.EXECUTION_FAILED },
32
+ };
33
+ }
34
+ const env = (_a = response.data) === null || _a === void 0 ? void 0 : _a.environment;
35
+ const output = `Environment: ${(env === null || env === void 0 ? void 0 : env.name) || 'N/A'} (ID: ${(env === null || env === void 0 ? void 0 : env.id) || this.params.environmentId})\nProvider: ${((_b = env === null || env === void 0 ? void 0 : env.provider) === null || _b === void 0 ? void 0 : _b.name) || 'N/A'}\n${JSON.stringify(env, null, 2)}`;
36
+ return {
37
+ llmContent: output,
38
+ returnDisplay: `Retrieved environment: ${(env === null || env === void 0 ? void 0 : env.name) || this.params.environmentId}`,
39
+ };
40
+ }
41
+ catch (error) {
42
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
43
+ return {
44
+ llmContent: `Error getting environment: ${errorMessage}`,
45
+ returnDisplay: `Error: ${errorMessage}`,
46
+ error: { message: errorMessage, type: types_1.ToolErrorType.EXECUTION_FAILED },
47
+ };
48
+ }
49
+ }
50
+ }
51
+ class EnvironmentGetTool extends base_tool_1.BaseDeclarativeTool {
52
+ constructor() {
53
+ super(EnvironmentGetTool.Name, 'EnvironmentGet', 'Gets an environment by its ID.', types_1.Kind.Read, {
54
+ properties: {
55
+ explanation: {
56
+ description: "One sentence explanation as to why this tool is being used, and how it contributes to the goal.",
57
+ type: 'string',
58
+ },
59
+ environmentId: {
60
+ description: 'The ID of the environment to retrieve.',
61
+ type: 'string',
62
+ },
63
+ },
64
+ required: ['environmentId'],
65
+ type: 'object',
66
+ });
67
+ }
68
+ createInvocation(params) {
69
+ return new EnvironmentGetInvocation(params);
70
+ }
71
+ }
72
+ exports.EnvironmentGetTool = EnvironmentGetTool;
73
+ EnvironmentGetTool.Name = 'environment_get';
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Environment List Tool - Lists all environments
3
+ * Wraps the SDK's cbenvironment.listEnvironments() method
4
+ */
5
+ import type { ToolInvocation, ToolResult } from '../types';
6
+ import { BaseDeclarativeTool } from '../base-tool';
7
+ export interface EnvironmentListParams {
8
+ /** One sentence explanation of why this tool is being used */
9
+ explanation?: string;
10
+ }
11
+ export declare class EnvironmentListTool extends BaseDeclarativeTool<EnvironmentListParams, ToolResult> {
12
+ static readonly Name: string;
13
+ constructor();
14
+ protected createInvocation(params: EnvironmentListParams): ToolInvocation<EnvironmentListParams, ToolResult>;
15
+ }
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ /**
3
+ * Environment List Tool - Lists all environments
4
+ * Wraps the SDK's cbenvironment.listEnvironments() 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.EnvironmentListTool = void 0;
11
+ const types_1 = require("../types");
12
+ const base_tool_1 = require("../base-tool");
13
+ const environment_1 = __importDefault(require("../../modules/environment"));
14
+ const chat_1 = __importDefault(require("../../modules/chat"));
15
+ class EnvironmentListInvocation extends base_tool_1.BaseToolInvocation {
16
+ constructor(params) {
17
+ super(params);
18
+ }
19
+ async execute() {
20
+ var _a, _b;
21
+ try {
22
+ if (this.params.explanation) {
23
+ chat_1.default.sendMessage(this.params.explanation);
24
+ }
25
+ const response = await environment_1.default.listEnvironments();
26
+ if (response && response.success === false) {
27
+ const errorMsg = response.error || 'Failed to list environments';
28
+ return {
29
+ llmContent: `Failed to list environments: ${errorMsg}`,
30
+ returnDisplay: `Error: ${errorMsg}`,
31
+ error: { message: errorMsg, type: types_1.ToolErrorType.EXECUTION_FAILED },
32
+ };
33
+ }
34
+ const environments = ((_a = response.data) === null || _a === void 0 ? void 0 : _a.environments) || [];
35
+ let output = `Retrieved ${environments.length} environment(s):\n`;
36
+ for (const env of environments) {
37
+ output += `- ${env.id}: ${env.name} (provider: ${((_b = env.provider) === null || _b === void 0 ? void 0 : _b.name) || 'N/A'})\n`;
38
+ }
39
+ return {
40
+ llmContent: output,
41
+ returnDisplay: `Listed ${environments.length} environment(s)`,
42
+ };
43
+ }
44
+ catch (error) {
45
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
46
+ return {
47
+ llmContent: `Error listing environments: ${errorMessage}`,
48
+ returnDisplay: `Error: ${errorMessage}`,
49
+ error: { message: errorMessage, type: types_1.ToolErrorType.EXECUTION_FAILED },
50
+ };
51
+ }
52
+ }
53
+ }
54
+ class EnvironmentListTool extends base_tool_1.BaseDeclarativeTool {
55
+ constructor() {
56
+ super(EnvironmentListTool.Name, 'EnvironmentList', 'Lists all environments.', types_1.Kind.Read, {
57
+ properties: {
58
+ explanation: {
59
+ description: "One sentence explanation as to why this tool is being used, and how it contributes to the goal.",
60
+ type: 'string',
61
+ },
62
+ },
63
+ required: [],
64
+ type: 'object',
65
+ });
66
+ }
67
+ createInvocation(params) {
68
+ return new EnvironmentListInvocation(params);
69
+ }
70
+ }
71
+ exports.EnvironmentListTool = EnvironmentListTool;
72
+ EnvironmentListTool.Name = 'environment_list';
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Environment Provider Tools - Get local and running providers
3
+ * Wraps the SDK's cbenvironment.getLocalProviders() and getRunningProviders() methods
4
+ */
5
+ import type { ToolInvocation, ToolResult } from '../types';
6
+ import { BaseDeclarativeTool } from '../base-tool';
7
+ export interface EnvironmentGetLocalProvidersParams {
8
+ /** One sentence explanation of why this tool is being used */
9
+ explanation?: string;
10
+ }
11
+ export declare class EnvironmentGetLocalProvidersTool extends BaseDeclarativeTool<EnvironmentGetLocalProvidersParams, ToolResult> {
12
+ static readonly Name: string;
13
+ constructor();
14
+ protected createInvocation(params: EnvironmentGetLocalProvidersParams): ToolInvocation<EnvironmentGetLocalProvidersParams, ToolResult>;
15
+ }
16
+ export interface EnvironmentGetRunningProvidersParams {
17
+ /** One sentence explanation of why this tool is being used */
18
+ explanation?: string;
19
+ }
20
+ export declare class EnvironmentGetRunningProvidersTool extends BaseDeclarativeTool<EnvironmentGetRunningProvidersParams, ToolResult> {
21
+ static readonly Name: string;
22
+ constructor();
23
+ protected createInvocation(params: EnvironmentGetRunningProvidersParams): ToolInvocation<EnvironmentGetRunningProvidersParams, ToolResult>;
24
+ }
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ /**
3
+ * Environment Provider Tools - Get local and running providers
4
+ * Wraps the SDK's cbenvironment.getLocalProviders() and getRunningProviders() 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.EnvironmentGetRunningProvidersTool = exports.EnvironmentGetLocalProvidersTool = void 0;
11
+ const types_1 = require("../types");
12
+ const base_tool_1 = require("../base-tool");
13
+ const environment_1 = __importDefault(require("../../modules/environment"));
14
+ const chat_1 = __importDefault(require("../../modules/chat"));
15
+ class EnvironmentGetLocalProvidersInvocation extends base_tool_1.BaseToolInvocation {
16
+ constructor(params) {
17
+ super(params);
18
+ }
19
+ async execute() {
20
+ var _a;
21
+ try {
22
+ if (this.params.explanation) {
23
+ chat_1.default.sendMessage(this.params.explanation);
24
+ }
25
+ const response = await environment_1.default.getLocalProviders();
26
+ if (response && response.success === false) {
27
+ const errorMsg = response.error || 'Failed to get local providers';
28
+ return {
29
+ llmContent: `Failed to get local providers: ${errorMsg}`,
30
+ returnDisplay: `Error: ${errorMsg}`,
31
+ error: { message: errorMsg, type: types_1.ToolErrorType.EXECUTION_FAILED },
32
+ };
33
+ }
34
+ const providers = ((_a = response.data) === null || _a === void 0 ? void 0 : _a.providers) || [];
35
+ let output = `Found ${providers.length} local provider(s):\n`;
36
+ for (const p of providers) {
37
+ output += `- ${p.name || p.unique_id || 'Unknown'} (${p.unique_id || p.providerId || 'N/A'})\n`;
38
+ }
39
+ return {
40
+ llmContent: output,
41
+ returnDisplay: `Found ${providers.length} local provider(s)`,
42
+ };
43
+ }
44
+ catch (error) {
45
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
46
+ return {
47
+ llmContent: `Error getting local providers: ${errorMessage}`,
48
+ returnDisplay: `Error: ${errorMessage}`,
49
+ error: { message: errorMessage, type: types_1.ToolErrorType.EXECUTION_FAILED },
50
+ };
51
+ }
52
+ }
53
+ }
54
+ class EnvironmentGetLocalProvidersTool extends base_tool_1.BaseDeclarativeTool {
55
+ constructor() {
56
+ super(EnvironmentGetLocalProvidersTool.Name, 'EnvironmentGetLocalProviders', 'Gets all available local environment providers.', types_1.Kind.Read, {
57
+ properties: {
58
+ explanation: {
59
+ description: "One sentence explanation as to why this tool is being used, and how it contributes to the goal.",
60
+ type: 'string',
61
+ },
62
+ },
63
+ required: [],
64
+ type: 'object',
65
+ });
66
+ }
67
+ createInvocation(params) {
68
+ return new EnvironmentGetLocalProvidersInvocation(params);
69
+ }
70
+ }
71
+ exports.EnvironmentGetLocalProvidersTool = EnvironmentGetLocalProvidersTool;
72
+ EnvironmentGetLocalProvidersTool.Name = 'environment_get_local_providers';
73
+ class EnvironmentGetRunningProvidersInvocation extends base_tool_1.BaseToolInvocation {
74
+ constructor(params) {
75
+ super(params);
76
+ }
77
+ async execute() {
78
+ var _a;
79
+ try {
80
+ if (this.params.explanation) {
81
+ chat_1.default.sendMessage(this.params.explanation);
82
+ }
83
+ const response = await environment_1.default.getRunningProviders();
84
+ if (response && response.success === false) {
85
+ const errorMsg = response.error || 'Failed to get running providers';
86
+ return {
87
+ llmContent: `Failed to get running providers: ${errorMsg}`,
88
+ returnDisplay: `Error: ${errorMsg}`,
89
+ error: { message: errorMsg, type: types_1.ToolErrorType.EXECUTION_FAILED },
90
+ };
91
+ }
92
+ const providers = ((_a = response.data) === null || _a === void 0 ? void 0 : _a.providers) || [];
93
+ let output = `${providers.length} running provider(s):\n`;
94
+ for (const p of providers) {
95
+ output += `- ${typeof p === 'string' ? p : (p.name || p.id || JSON.stringify(p))}\n`;
96
+ }
97
+ return {
98
+ llmContent: output,
99
+ returnDisplay: `${providers.length} running provider(s)`,
100
+ };
101
+ }
102
+ catch (error) {
103
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
104
+ return {
105
+ llmContent: `Error getting running providers: ${errorMessage}`,
106
+ returnDisplay: `Error: ${errorMessage}`,
107
+ error: { message: errorMessage, type: types_1.ToolErrorType.EXECUTION_FAILED },
108
+ };
109
+ }
110
+ }
111
+ }
112
+ class EnvironmentGetRunningProvidersTool extends base_tool_1.BaseDeclarativeTool {
113
+ constructor() {
114
+ super(EnvironmentGetRunningProvidersTool.Name, 'EnvironmentGetRunningProviders', 'Gets all currently running environment providers.', types_1.Kind.Read, {
115
+ properties: {
116
+ explanation: {
117
+ description: "One sentence explanation as to why this tool is being used, and how it contributes to the goal.",
118
+ type: 'string',
119
+ },
120
+ },
121
+ required: [],
122
+ type: 'object',
123
+ });
124
+ }
125
+ createInvocation(params) {
126
+ return new EnvironmentGetRunningProvidersInvocation(params);
127
+ }
128
+ }
129
+ exports.EnvironmentGetRunningProvidersTool = EnvironmentGetRunningProvidersTool;
130
+ EnvironmentGetRunningProvidersTool.Name = 'environment_get_running_providers';
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Environment Restart Tool - Restarts an environment provider
3
+ * Wraps the SDK's cbenvironment.restartEnvironment() method
4
+ */
5
+ import type { ToolInvocation, ToolResult } from '../types';
6
+ import { BaseDeclarativeTool } from '../base-tool';
7
+ export interface EnvironmentRestartParams {
8
+ /** One sentence explanation of why this tool is being used */
9
+ explanation?: string;
10
+ /** The ID of the environment to restart */
11
+ environmentId: string;
12
+ }
13
+ export declare class EnvironmentRestartTool extends BaseDeclarativeTool<EnvironmentRestartParams, ToolResult> {
14
+ static readonly Name: string;
15
+ constructor();
16
+ protected createInvocation(params: EnvironmentRestartParams): ToolInvocation<EnvironmentRestartParams, ToolResult>;
17
+ }
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ /**
3
+ * Environment Restart Tool - Restarts an environment provider
4
+ * Wraps the SDK's cbenvironment.restartEnvironment() 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.EnvironmentRestartTool = void 0;
11
+ const types_1 = require("../types");
12
+ const base_tool_1 = require("../base-tool");
13
+ const environment_1 = __importDefault(require("../../modules/environment"));
14
+ const chat_1 = __importDefault(require("../../modules/chat"));
15
+ class EnvironmentRestartInvocation extends base_tool_1.BaseToolInvocation {
16
+ constructor(params) {
17
+ super(params);
18
+ }
19
+ async execute() {
20
+ try {
21
+ if (this.params.explanation) {
22
+ chat_1.default.sendMessage(this.params.explanation);
23
+ }
24
+ const response = await environment_1.default.restartEnvironment(this.params.environmentId);
25
+ if (response && response.success === false) {
26
+ const errorMsg = response.error || 'Failed to restart environment';
27
+ return {
28
+ llmContent: `Failed to restart environment: ${errorMsg}`,
29
+ returnDisplay: `Error: ${errorMsg}`,
30
+ error: { message: errorMsg, type: types_1.ToolErrorType.EXECUTION_FAILED },
31
+ };
32
+ }
33
+ return {
34
+ llmContent: `Environment ${this.params.environmentId} restarted successfully. ${response.message || ''}`,
35
+ returnDisplay: `Restarted environment: ${this.params.environmentId}`,
36
+ };
37
+ }
38
+ catch (error) {
39
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
40
+ return {
41
+ llmContent: `Error restarting environment: ${errorMessage}`,
42
+ returnDisplay: `Error: ${errorMessage}`,
43
+ error: { message: errorMessage, type: types_1.ToolErrorType.EXECUTION_FAILED },
44
+ };
45
+ }
46
+ }
47
+ }
48
+ class EnvironmentRestartTool extends base_tool_1.BaseDeclarativeTool {
49
+ constructor() {
50
+ super(EnvironmentRestartTool.Name, 'EnvironmentRestart', 'Restarts an environment by ID (stops then starts the provider).', types_1.Kind.Execute, {
51
+ properties: {
52
+ explanation: {
53
+ description: "One sentence explanation as to why this tool is being used, and how it contributes to the goal.",
54
+ type: 'string',
55
+ },
56
+ environmentId: {
57
+ description: 'The ID of the environment to restart.',
58
+ type: 'string',
59
+ },
60
+ },
61
+ required: ['environmentId'],
62
+ type: 'object',
63
+ });
64
+ }
65
+ createInvocation(params) {
66
+ return new EnvironmentRestartInvocation(params);
67
+ }
68
+ }
69
+ exports.EnvironmentRestartTool = EnvironmentRestartTool;
70
+ EnvironmentRestartTool.Name = 'environment_restart';
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Environment Send Message Tool - Sends a message to an environment provider
3
+ * Wraps the SDK's cbenvironment.sendMessageToEnvironment() method
4
+ */
5
+ import type { ToolInvocation, ToolResult } from '../types';
6
+ import { BaseDeclarativeTool } from '../base-tool';
7
+ export interface EnvironmentSendMessageParams {
8
+ /** One sentence explanation of why this tool is being used */
9
+ explanation?: string;
10
+ /** The ID of the environment to send the message to */
11
+ environmentId: string;
12
+ /** The message to send to the environment provider */
13
+ message: any;
14
+ }
15
+ export declare class EnvironmentSendMessageTool extends BaseDeclarativeTool<EnvironmentSendMessageParams, ToolResult> {
16
+ static readonly Name: string;
17
+ constructor();
18
+ protected createInvocation(params: EnvironmentSendMessageParams): ToolInvocation<EnvironmentSendMessageParams, ToolResult>;
19
+ }
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ /**
3
+ * Environment Send Message Tool - Sends a message to an environment provider
4
+ * Wraps the SDK's cbenvironment.sendMessageToEnvironment() 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.EnvironmentSendMessageTool = void 0;
11
+ const types_1 = require("../types");
12
+ const base_tool_1 = require("../base-tool");
13
+ const environment_1 = __importDefault(require("../../modules/environment"));
14
+ const chat_1 = __importDefault(require("../../modules/chat"));
15
+ class EnvironmentSendMessageInvocation extends base_tool_1.BaseToolInvocation {
16
+ constructor(params) {
17
+ super(params);
18
+ }
19
+ async execute() {
20
+ try {
21
+ if (this.params.explanation) {
22
+ chat_1.default.sendMessage(this.params.explanation);
23
+ }
24
+ const response = await environment_1.default.sendMessageToEnvironment(this.params.environmentId, this.params.message);
25
+ if (response && response.success === false) {
26
+ const errorMsg = response.error || response.message || 'Failed to send message to environment';
27
+ return {
28
+ llmContent: `Failed to send message to environment: ${errorMsg}`,
29
+ returnDisplay: `Error: ${errorMsg}`,
30
+ error: { message: errorMsg, type: types_1.ToolErrorType.EXECUTION_FAILED },
31
+ };
32
+ }
33
+ return {
34
+ llmContent: `Message sent to environment ${this.params.environmentId} successfully.`,
35
+ returnDisplay: `Message sent to environment: ${this.params.environmentId}`,
36
+ };
37
+ }
38
+ catch (error) {
39
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
40
+ return {
41
+ llmContent: `Error sending message to environment: ${errorMessage}`,
42
+ returnDisplay: `Error: ${errorMessage}`,
43
+ error: { message: errorMessage, type: types_1.ToolErrorType.EXECUTION_FAILED },
44
+ };
45
+ }
46
+ }
47
+ }
48
+ class EnvironmentSendMessageTool extends base_tool_1.BaseDeclarativeTool {
49
+ constructor() {
50
+ super(EnvironmentSendMessageTool.Name, 'EnvironmentSendMessage', 'Sends a message to an environment provider.', types_1.Kind.Execute, {
51
+ properties: {
52
+ explanation: {
53
+ description: "One sentence explanation as to why this tool is being used, and how it contributes to the goal.",
54
+ type: 'string',
55
+ },
56
+ environmentId: {
57
+ description: 'The ID of the environment to send the message to.',
58
+ type: 'string',
59
+ },
60
+ message: {
61
+ description: 'The message to send to the environment provider.',
62
+ type: 'object',
63
+ },
64
+ },
65
+ required: ['environmentId', 'message'],
66
+ type: 'object',
67
+ });
68
+ }
69
+ createInvocation(params) {
70
+ return new EnvironmentSendMessageInvocation(params);
71
+ }
72
+ }
73
+ exports.EnvironmentSendMessageTool = EnvironmentSendMessageTool;
74
+ EnvironmentSendMessageTool.Name = 'environment_send_message';
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Environment Start Agent Tool - Starts an agent in an environment
3
+ * Wraps the SDK's cbenvironment.startAgentInEnvironment() method
4
+ */
5
+ import type { ToolInvocation, ToolResult } from '../types';
6
+ import { BaseDeclarativeTool } from '../base-tool';
7
+ export interface EnvironmentStartAgentParams {
8
+ /** One sentence explanation of why this tool is being used */
9
+ explanation?: string;
10
+ /** The ID of the environment to run the agent in */
11
+ environmentId: string;
12
+ /** The ID of the agent to start. If not provided, uses the default agent. */
13
+ agentId?: string;
14
+ /** The task/instruction for the agent */
15
+ task: string;
16
+ /** Optional thread ID for conversation context tracking */
17
+ threadId?: string;
18
+ }
19
+ export declare class EnvironmentStartAgentTool extends BaseDeclarativeTool<EnvironmentStartAgentParams, ToolResult> {
20
+ static readonly Name: string;
21
+ constructor();
22
+ protected createInvocation(params: EnvironmentStartAgentParams): ToolInvocation<EnvironmentStartAgentParams, ToolResult>;
23
+ }
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ /**
3
+ * Environment Start Agent Tool - Starts an agent in an environment
4
+ * Wraps the SDK's cbenvironment.startAgentInEnvironment() 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.EnvironmentStartAgentTool = void 0;
11
+ const types_1 = require("../types");
12
+ const base_tool_1 = require("../base-tool");
13
+ const environment_1 = __importDefault(require("../../modules/environment"));
14
+ const chat_1 = __importDefault(require("../../modules/chat"));
15
+ class EnvironmentStartAgentInvocation extends base_tool_1.BaseToolInvocation {
16
+ constructor(params) {
17
+ super(params);
18
+ }
19
+ async execute() {
20
+ var _a;
21
+ try {
22
+ if (this.params.explanation) {
23
+ chat_1.default.sendMessage(this.params.explanation);
24
+ }
25
+ const response = await environment_1.default.startAgentInEnvironment(this.params.environmentId, this.params.task, (_a = this.params.agentId) !== null && _a !== void 0 ? _a : undefined, this.params.threadId);
26
+ if (response && response.success === false) {
27
+ const errorMsg = response.error || 'Failed to start agent in environment';
28
+ return {
29
+ llmContent: `Failed to start agent in environment: ${errorMsg}`,
30
+ returnDisplay: `Error: ${errorMsg}`,
31
+ error: { message: errorMsg, type: types_1.ToolErrorType.EXECUTION_FAILED },
32
+ };
33
+ }
34
+ return {
35
+ llmContent: `Agent ${this.params.agentId} started in environment ${this.params.environmentId} successfully. ${response.message || ''}`,
36
+ returnDisplay: `Started agent ${this.params.agentId} in environment ${this.params.environmentId}`,
37
+ };
38
+ }
39
+ catch (error) {
40
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
41
+ return {
42
+ llmContent: `Error starting agent in environment: ${errorMessage}`,
43
+ returnDisplay: `Error: ${errorMessage}`,
44
+ error: { message: errorMessage, type: types_1.ToolErrorType.EXECUTION_FAILED },
45
+ };
46
+ }
47
+ }
48
+ }
49
+ class EnvironmentStartAgentTool extends base_tool_1.BaseDeclarativeTool {
50
+ constructor() {
51
+ super(EnvironmentStartAgentTool.Name, 'EnvironmentStartAgent', 'Starts an agent in a specified environment. Sends the task to the environment provider which launches and runs the agent.', types_1.Kind.Execute, {
52
+ properties: {
53
+ explanation: {
54
+ description: "One sentence explanation as to why this tool is being used, and how it contributes to the goal.",
55
+ type: 'string',
56
+ },
57
+ environmentId: {
58
+ description: 'The ID of the environment to run the agent in.',
59
+ type: 'string',
60
+ },
61
+ agentId: {
62
+ description: 'The ID of the agent to start. If not provided, uses the default agent.',
63
+ type: 'string',
64
+ },
65
+ task: {
66
+ description: 'The task or instruction for the agent to execute.',
67
+ type: 'string',
68
+ },
69
+ threadId: {
70
+ description: 'Optional thread ID for tracking conversation context.',
71
+ type: 'string',
72
+ },
73
+ },
74
+ required: ['environmentId', 'task'],
75
+ type: 'object',
76
+ });
77
+ }
78
+ createInvocation(params) {
79
+ return new EnvironmentStartAgentInvocation(params);
80
+ }
81
+ }
82
+ exports.EnvironmentStartAgentTool = EnvironmentStartAgentTool;
83
+ EnvironmentStartAgentTool.Name = 'environment_start_agent';
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Environment Start Tool - Starts an environment provider
3
+ * Wraps the SDK's cbenvironment.startEnvironment() method
4
+ */
5
+ import type { ToolInvocation, ToolResult } from '../types';
6
+ import { BaseDeclarativeTool } from '../base-tool';
7
+ export interface EnvironmentStartParams {
8
+ /** One sentence explanation of why this tool is being used */
9
+ explanation?: string;
10
+ /** The ID of the environment to start */
11
+ environmentId: string;
12
+ }
13
+ export declare class EnvironmentStartTool extends BaseDeclarativeTool<EnvironmentStartParams, ToolResult> {
14
+ static readonly Name: string;
15
+ constructor();
16
+ protected createInvocation(params: EnvironmentStartParams): ToolInvocation<EnvironmentStartParams, ToolResult>;
17
+ }