@codebolt/codeboltjs 5.1.10 → 6.0.0

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 (50) hide show
  1. package/dist/core/Codebolt.d.ts +1 -20
  2. package/dist/core/Codebolt.js +16 -18
  3. package/dist/core/websocket.js +1 -1
  4. package/dist/index.d.ts +0 -1
  5. package/dist/index.js +3 -6
  6. package/dist/modules/agentDeliberation.js +1 -3
  7. package/dist/modules/swarm.d.ts +8 -2
  8. package/dist/modules/swarm.js +14 -0
  9. package/dist/tools/index.d.ts +2 -16
  10. package/dist/tools/index.js +5 -45
  11. package/dist/tools/registry.d.ts +0 -21
  12. package/dist/tools/registry.js +1 -38
  13. package/dist/types/agentDeliberation.d.ts +1 -15
  14. package/dist/types/agentDeliberation.js +0 -2
  15. package/dist/types/job.d.ts +1 -1
  16. package/package.json +19 -20
  17. package/dist/modules/environment.d.ts +0 -24
  18. package/dist/modules/environment.js +0 -51
  19. package/dist/tools/environment/environment-create.d.ts +0 -23
  20. package/dist/tools/environment/environment-create.js +0 -90
  21. package/dist/tools/environment/environment-delete.d.ts +0 -17
  22. package/dist/tools/environment/environment-delete.js +0 -70
  23. package/dist/tools/environment/environment-get.d.ts +0 -17
  24. package/dist/tools/environment/environment-get.js +0 -73
  25. package/dist/tools/environment/environment-list.d.ts +0 -15
  26. package/dist/tools/environment/environment-list.js +0 -72
  27. package/dist/tools/environment/environment-providers.d.ts +0 -24
  28. package/dist/tools/environment/environment-providers.js +0 -130
  29. package/dist/tools/environment/environment-restart.d.ts +0 -17
  30. package/dist/tools/environment/environment-restart.js +0 -70
  31. package/dist/tools/environment/environment-send-message.d.ts +0 -19
  32. package/dist/tools/environment/environment-send-message.js +0 -74
  33. package/dist/tools/environment/environment-start.d.ts +0 -17
  34. package/dist/tools/environment/environment-start.js +0 -70
  35. package/dist/tools/environment/environment-statistics.d.ts +0 -15
  36. package/dist/tools/environment/environment-statistics.js +0 -69
  37. package/dist/tools/environment/environment-status.d.ts +0 -17
  38. package/dist/tools/environment/environment-status.js +0 -72
  39. package/dist/tools/environment/environment-stop.d.ts +0 -17
  40. package/dist/tools/environment/environment-stop.js +0 -70
  41. package/dist/tools/environment/environment-update.d.ts +0 -19
  42. package/dist/tools/environment/environment-update.js +0 -74
  43. package/dist/tools/environment/index.d.ts +0 -31
  44. package/dist/tools/environment/index.js +0 -61
  45. package/dist/tools/tool-search.d.ts +0 -49
  46. package/dist/tools/tool-search.js +0 -140
  47. package/dist/tools/toolSearch/index.d.ts +0 -9
  48. package/dist/tools/toolSearch/index.js +0 -15
  49. package/dist/tools/toolSearch/tool-search-tool.d.ts +0 -32
  50. package/dist/tools/toolSearch/tool-search-tool.js +0 -110
@@ -1,110 +0,0 @@
1
- "use strict";
2
- /**
3
- * Tool Search Tool - An LLM-callable tool that searches for available tools
4
- * Uses MiniSearch for full-text fuzzy search over all registered tools
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.ToolSearchTool = void 0;
8
- const types_1 = require("../types");
9
- const base_tool_1 = require("../base-tool");
10
- const tool_search_1 = require("../tool-search");
11
- // Singleton search engine instance shared across invocations
12
- let searchEngine = null;
13
- let indexedTools = [];
14
- class ToolSearchInvocation extends base_tool_1.BaseToolInvocation {
15
- constructor(params) {
16
- super(params);
17
- }
18
- async execute() {
19
- var _a;
20
- try {
21
- if (!searchEngine) {
22
- return {
23
- llmContent: 'Tool search index not initialized. Call ToolSearchTool.setTools() first.',
24
- returnDisplay: 'Error: search index not initialized',
25
- error: {
26
- message: 'Tool search index not initialized',
27
- type: types_1.ToolErrorType.EXECUTION_FAILED,
28
- },
29
- };
30
- }
31
- const results = searchEngine.search(this.params.query, {
32
- limit: (_a = this.params.limit) !== null && _a !== void 0 ? _a : 10,
33
- kind: this.params.kind,
34
- });
35
- if (results.length === 0) {
36
- return {
37
- llmContent: `No tools found matching "${this.params.query}".`,
38
- returnDisplay: `No tools found for: ${this.params.query}`,
39
- };
40
- }
41
- let output = `Found ${results.length} tool(s) matching "${this.params.query}":\n\n`;
42
- for (const r of results) {
43
- output += `- **${r.name}** (${r.kind}): ${r.description} [score: ${r.score.toFixed(2)}]\n`;
44
- }
45
- return {
46
- llmContent: output,
47
- returnDisplay: `Found ${results.length} tool(s)`,
48
- };
49
- }
50
- catch (error) {
51
- const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
52
- return {
53
- llmContent: `Error searching tools: ${errorMessage}`,
54
- returnDisplay: `Error: ${errorMessage}`,
55
- error: { message: errorMessage, type: types_1.ToolErrorType.EXECUTION_FAILED },
56
- };
57
- }
58
- }
59
- }
60
- class ToolSearchTool extends base_tool_1.BaseDeclarativeTool {
61
- constructor() {
62
- super(ToolSearchTool.Name, 'ToolSearch', 'Searches for available tools by name, description, or functionality using full-text search. Use this to discover which tools are available for a given task.', types_1.Kind.Search, {
63
- properties: {
64
- explanation: {
65
- description: "One sentence explanation as to why this tool is being used, and how it contributes to the goal.",
66
- type: 'string',
67
- },
68
- query: {
69
- description: 'The search query to find relevant tools (e.g. "create environment", "read file", "git commit").',
70
- type: 'string',
71
- },
72
- limit: {
73
- description: 'Maximum number of results to return (default: 10).',
74
- type: 'number',
75
- },
76
- kind: {
77
- description: 'Filter results by tool kind: "read", "edit", "delete", "execute", "search", "fetch", "other".',
78
- type: 'string',
79
- },
80
- },
81
- required: ['query'],
82
- type: 'object',
83
- });
84
- }
85
- /**
86
- * Initialize the search index with a set of tools.
87
- * Call this before using the tool so the search engine knows what tools are available.
88
- * @param tools - Array of tools to index
89
- */
90
- static setTools(tools) {
91
- indexedTools = tools;
92
- searchEngine = new tool_search_1.ToolSearchEngine();
93
- const toolMap = new Map();
94
- for (const tool of tools) {
95
- toolMap.set(tool.name, tool);
96
- }
97
- searchEngine.buildIndex(toolMap);
98
- }
99
- /**
100
- * Get the currently indexed tools
101
- */
102
- static getIndexedTools() {
103
- return indexedTools;
104
- }
105
- createInvocation(params) {
106
- return new ToolSearchInvocation(params);
107
- }
108
- }
109
- exports.ToolSearchTool = ToolSearchTool;
110
- ToolSearchTool.Name = 'tool_search';