@loxia-labs/loxia-autopilot-one 1.0.1
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.
- package/LICENSE +267 -0
- package/README.md +509 -0
- package/bin/cli.js +117 -0
- package/package.json +94 -0
- package/scripts/install-scanners.js +236 -0
- package/src/analyzers/CSSAnalyzer.js +297 -0
- package/src/analyzers/ConfigValidator.js +690 -0
- package/src/analyzers/ESLintAnalyzer.js +320 -0
- package/src/analyzers/JavaScriptAnalyzer.js +261 -0
- package/src/analyzers/PrettierFormatter.js +247 -0
- package/src/analyzers/PythonAnalyzer.js +266 -0
- package/src/analyzers/SecurityAnalyzer.js +729 -0
- package/src/analyzers/TypeScriptAnalyzer.js +247 -0
- package/src/analyzers/codeCloneDetector/analyzer.js +344 -0
- package/src/analyzers/codeCloneDetector/detector.js +203 -0
- package/src/analyzers/codeCloneDetector/index.js +160 -0
- package/src/analyzers/codeCloneDetector/parser.js +199 -0
- package/src/analyzers/codeCloneDetector/reporter.js +148 -0
- package/src/analyzers/codeCloneDetector/scanner.js +59 -0
- package/src/core/agentPool.js +1474 -0
- package/src/core/agentScheduler.js +2147 -0
- package/src/core/contextManager.js +709 -0
- package/src/core/messageProcessor.js +732 -0
- package/src/core/orchestrator.js +548 -0
- package/src/core/stateManager.js +877 -0
- package/src/index.js +631 -0
- package/src/interfaces/cli.js +549 -0
- package/src/interfaces/webServer.js +2162 -0
- package/src/modules/fileExplorer/controller.js +280 -0
- package/src/modules/fileExplorer/index.js +37 -0
- package/src/modules/fileExplorer/middleware.js +92 -0
- package/src/modules/fileExplorer/routes.js +125 -0
- package/src/modules/fileExplorer/types.js +44 -0
- package/src/services/aiService.js +1232 -0
- package/src/services/apiKeyManager.js +164 -0
- package/src/services/benchmarkService.js +366 -0
- package/src/services/budgetService.js +539 -0
- package/src/services/contextInjectionService.js +247 -0
- package/src/services/conversationCompactionService.js +637 -0
- package/src/services/errorHandler.js +810 -0
- package/src/services/fileAttachmentService.js +544 -0
- package/src/services/modelRouterService.js +366 -0
- package/src/services/modelsService.js +322 -0
- package/src/services/qualityInspector.js +796 -0
- package/src/services/tokenCountingService.js +536 -0
- package/src/tools/agentCommunicationTool.js +1344 -0
- package/src/tools/agentDelayTool.js +485 -0
- package/src/tools/asyncToolManager.js +604 -0
- package/src/tools/baseTool.js +800 -0
- package/src/tools/browserTool.js +920 -0
- package/src/tools/cloneDetectionTool.js +621 -0
- package/src/tools/dependencyResolverTool.js +1215 -0
- package/src/tools/fileContentReplaceTool.js +875 -0
- package/src/tools/fileSystemTool.js +1107 -0
- package/src/tools/fileTreeTool.js +853 -0
- package/src/tools/imageTool.js +901 -0
- package/src/tools/importAnalyzerTool.js +1060 -0
- package/src/tools/jobDoneTool.js +248 -0
- package/src/tools/seekTool.js +956 -0
- package/src/tools/staticAnalysisTool.js +1778 -0
- package/src/tools/taskManagerTool.js +2873 -0
- package/src/tools/terminalTool.js +2304 -0
- package/src/tools/webTool.js +1430 -0
- package/src/types/agent.js +519 -0
- package/src/types/contextReference.js +972 -0
- package/src/types/conversation.js +730 -0
- package/src/types/toolCommand.js +747 -0
- package/src/utilities/attachmentValidator.js +292 -0
- package/src/utilities/configManager.js +582 -0
- package/src/utilities/constants.js +722 -0
- package/src/utilities/directoryAccessManager.js +535 -0
- package/src/utilities/fileProcessor.js +307 -0
- package/src/utilities/logger.js +436 -0
- package/src/utilities/tagParser.js +1246 -0
- package/src/utilities/toolConstants.js +317 -0
- package/web-ui/build/index.html +15 -0
- package/web-ui/build/logo.png +0 -0
- package/web-ui/build/logo2.png +0 -0
- package/web-ui/build/static/index-CjkkcnFA.js +344 -0
- package/web-ui/build/static/index-Dy2bYbOa.css +1 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Job Done Tool - Signals task completion in autonomous mode
|
|
3
|
+
*
|
|
4
|
+
* Purpose:
|
|
5
|
+
* - Allow agents to explicitly signal when a task is complete
|
|
6
|
+
* - Provide completion summary/reason
|
|
7
|
+
* - Gracefully exit autonomous mode
|
|
8
|
+
* - Return to chat mode (unless in locked mode)
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { BaseTool } from './baseTool.js';
|
|
12
|
+
import TagParser from '../utilities/tagParser.js';
|
|
13
|
+
|
|
14
|
+
class JobDoneTool extends BaseTool {
|
|
15
|
+
constructor() {
|
|
16
|
+
super();
|
|
17
|
+
this.id = 'jobdone';
|
|
18
|
+
this.name = 'Job Done';
|
|
19
|
+
this.description = 'Call this tool when you have successfully completed the assigned task, OR if you are stuck/unable to proceed after multiple failed attempts. Provide a summary of what was accomplished or what prevented completion. This will exit autonomous mode and return control to the user.';
|
|
20
|
+
this.version = '1.0.0';
|
|
21
|
+
this.capabilities = ['task-completion', 'mode-control'];
|
|
22
|
+
this.requiresProject = false;
|
|
23
|
+
this.async = false;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Get tool description for LLM consumption
|
|
28
|
+
* @returns {string} Tool description
|
|
29
|
+
*/
|
|
30
|
+
getDescription() {
|
|
31
|
+
return `
|
|
32
|
+
Job Done Tool: Signal task completion in autonomous mode and exit to chat mode.
|
|
33
|
+
|
|
34
|
+
Usage Instructions:
|
|
35
|
+
- Call this tool when you have SUCCESSFULLY completed the assigned task
|
|
36
|
+
- Also call this tool if you are STUCK or UNABLE to proceed after multiple failed attempts
|
|
37
|
+
- Provide a clear summary of what was accomplished OR what prevented completion
|
|
38
|
+
- This will immediately exit autonomous mode and return control to the user
|
|
39
|
+
|
|
40
|
+
Examples:
|
|
41
|
+
- "Created 5 song files successfully with lyrics and melodies"
|
|
42
|
+
- "Unable to proceed: missing API credentials for the service"
|
|
43
|
+
- "Stuck after 3 failed compilation attempts - syntax errors persist"
|
|
44
|
+
- "Task partially complete: implemented 2 of 3 requested features"
|
|
45
|
+
|
|
46
|
+
The tool will format a completion message and gracefully exit autonomous mode.
|
|
47
|
+
`.trim();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Parse parameters from tool command content
|
|
52
|
+
* @param {string} content - Raw tool command content
|
|
53
|
+
* @returns {Object} Parsed parameters object
|
|
54
|
+
*/
|
|
55
|
+
parseParameters(content) {
|
|
56
|
+
try {
|
|
57
|
+
// For JobDoneTool, we expect the content to be structured with tags
|
|
58
|
+
// or we can parse it as a simple completion message
|
|
59
|
+
|
|
60
|
+
// Try to extract structured content first
|
|
61
|
+
const summaryMatches = TagParser.extractContent(content, 'summary');
|
|
62
|
+
const detailsMatches = TagParser.extractContent(content, 'details');
|
|
63
|
+
const successMatches = TagParser.extractContent(content, 'success');
|
|
64
|
+
|
|
65
|
+
let summary = '';
|
|
66
|
+
let details = '';
|
|
67
|
+
let success = true;
|
|
68
|
+
|
|
69
|
+
if (summaryMatches.length > 0) {
|
|
70
|
+
// Structured format with tags
|
|
71
|
+
summary = summaryMatches[0].trim();
|
|
72
|
+
details = detailsMatches.length > 0 ? detailsMatches[0].trim() : '';
|
|
73
|
+
success = successMatches.length > 0 ? (successMatches[0].toLowerCase() !== 'false') : true;
|
|
74
|
+
} else {
|
|
75
|
+
// Fallback: use the entire content as summary
|
|
76
|
+
summary = content.trim() || 'Task completed';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return {
|
|
80
|
+
actions: [{
|
|
81
|
+
action: 'complete',
|
|
82
|
+
summary: summary,
|
|
83
|
+
success: success,
|
|
84
|
+
details: details || undefined
|
|
85
|
+
}]
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
} catch (error) {
|
|
89
|
+
// Fallback to simple parsing
|
|
90
|
+
return {
|
|
91
|
+
actions: [{
|
|
92
|
+
action: 'complete',
|
|
93
|
+
summary: content.trim() || 'Task completed',
|
|
94
|
+
success: true
|
|
95
|
+
}]
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Get tool schema for AI model
|
|
102
|
+
* @returns {Object} Tool schema
|
|
103
|
+
*/
|
|
104
|
+
getSchema() {
|
|
105
|
+
return {
|
|
106
|
+
type: 'object',
|
|
107
|
+
properties: {
|
|
108
|
+
actions: {
|
|
109
|
+
type: 'array',
|
|
110
|
+
items: {
|
|
111
|
+
type: 'object',
|
|
112
|
+
properties: {
|
|
113
|
+
action: {
|
|
114
|
+
type: 'string',
|
|
115
|
+
enum: ['complete'],
|
|
116
|
+
description: 'Mark task as complete - always use "complete"'
|
|
117
|
+
},
|
|
118
|
+
summary: {
|
|
119
|
+
type: 'string',
|
|
120
|
+
description: 'Clear summary of what you accomplished OR what prevented completion (e.g., "Created 5 song files successfully", "Unable to proceed: missing API credentials", "Stuck after 3 failed compilation attempts")'
|
|
121
|
+
},
|
|
122
|
+
success: {
|
|
123
|
+
type: 'boolean',
|
|
124
|
+
default: true,
|
|
125
|
+
description: 'Set to true if task completed successfully, false if stuck/failed or partial completion'
|
|
126
|
+
},
|
|
127
|
+
details: {
|
|
128
|
+
type: 'string',
|
|
129
|
+
description: 'Optional: Additional details about what was done, what failed, any files created, or next steps for the user'
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
required: ['action', 'summary'],
|
|
133
|
+
additionalProperties: false
|
|
134
|
+
},
|
|
135
|
+
minItems: 1,
|
|
136
|
+
maxItems: 1
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
required: ['actions'],
|
|
140
|
+
additionalProperties: false
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Execute job done action
|
|
146
|
+
* @param {Object} parameters - Tool parameters
|
|
147
|
+
* @param {Object} context - Execution context
|
|
148
|
+
* @returns {Promise<Object>} Execution result
|
|
149
|
+
*/
|
|
150
|
+
async execute(parameters, context = {}) {
|
|
151
|
+
try {
|
|
152
|
+
const { actions } = parameters;
|
|
153
|
+
|
|
154
|
+
if (!actions || !Array.isArray(actions) || actions.length === 0) {
|
|
155
|
+
throw new Error('Actions array is required');
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const action = actions[0];
|
|
159
|
+
|
|
160
|
+
if (action.action !== 'complete') {
|
|
161
|
+
throw new Error('Invalid action. Only "complete" is supported');
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (!action.summary) {
|
|
165
|
+
throw new Error('Completion summary is required');
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Get agent information for context
|
|
169
|
+
const agentId = context.agentId;
|
|
170
|
+
let agentInfo = '';
|
|
171
|
+
|
|
172
|
+
if (agentId && context.toolsRegistry) {
|
|
173
|
+
try {
|
|
174
|
+
// Try to get agent info through AgentPool if available
|
|
175
|
+
if (this.agentPool) {
|
|
176
|
+
const agent = await this.agentPool.getAgent(agentId);
|
|
177
|
+
if (agent) {
|
|
178
|
+
agentInfo = ` by agent "${agent.name}"`;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
} catch (error) {
|
|
182
|
+
// Ignore agent info errors
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Format completion message
|
|
187
|
+
const completionMessage = `✅ Task completed${agentInfo}${action.success !== false ? ' successfully' : ' with issues'}
|
|
188
|
+
|
|
189
|
+
**Summary:** ${action.summary}${action.details ? `
|
|
190
|
+
|
|
191
|
+
**Details:** ${action.details}` : ''}
|
|
192
|
+
|
|
193
|
+
*Autonomous mode will now exit.*`;
|
|
194
|
+
|
|
195
|
+
// Return result indicating task completion
|
|
196
|
+
return {
|
|
197
|
+
success: true,
|
|
198
|
+
output: completionMessage,
|
|
199
|
+
taskComplete: true,
|
|
200
|
+
summary: action.summary,
|
|
201
|
+
details: action.details || null,
|
|
202
|
+
successfulCompletion: action.success !== false,
|
|
203
|
+
metadata: {
|
|
204
|
+
toolId: this.id,
|
|
205
|
+
agentId: agentId || 'unknown',
|
|
206
|
+
completedAt: new Date().toISOString(),
|
|
207
|
+
action: action.action
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
} catch (error) {
|
|
212
|
+
return {
|
|
213
|
+
success: false,
|
|
214
|
+
error: error.message,
|
|
215
|
+
output: `Failed to mark task as complete: ${error.message}`,
|
|
216
|
+
taskComplete: false
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Set AgentPool dependency for agent information
|
|
223
|
+
* @param {AgentPool} agentPool - AgentPool instance
|
|
224
|
+
*/
|
|
225
|
+
setAgentPool(agentPool) {
|
|
226
|
+
this.agentPool = agentPool;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Get tool capabilities
|
|
231
|
+
* @returns {Object} Tool capabilities
|
|
232
|
+
*/
|
|
233
|
+
getCapabilities() {
|
|
234
|
+
return {
|
|
235
|
+
id: this.id,
|
|
236
|
+
name: this.name,
|
|
237
|
+
description: this.description,
|
|
238
|
+
version: this.version,
|
|
239
|
+
capabilities: this.capabilities,
|
|
240
|
+
requiresProject: this.requiresProject,
|
|
241
|
+
async: this.async,
|
|
242
|
+
enabled: true,
|
|
243
|
+
schema: this.getSchema()
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export default JobDoneTool;
|