@loxia-labs/loxia-autopilot-one 1.0.1 → 1.0.3
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/README.md +44 -54
- package/bin/cli.js +1 -115
- package/bin/loxia-terminal-v2.js +3 -0
- package/bin/loxia-terminal.js +3 -0
- package/bin/start-with-terminal.js +3 -0
- package/package.json +14 -15
- package/scripts/install-scanners.js +1 -235
- package/src/analyzers/CSSAnalyzer.js +1 -297
- package/src/analyzers/ConfigValidator.js +1 -690
- package/src/analyzers/ESLintAnalyzer.js +1 -320
- package/src/analyzers/JavaScriptAnalyzer.js +1 -261
- package/src/analyzers/PrettierFormatter.js +1 -247
- package/src/analyzers/PythonAnalyzer.js +1 -266
- package/src/analyzers/SecurityAnalyzer.js +1 -729
- package/src/analyzers/TypeScriptAnalyzer.js +1 -247
- package/src/analyzers/codeCloneDetector/analyzer.js +1 -344
- package/src/analyzers/codeCloneDetector/detector.js +1 -203
- package/src/analyzers/codeCloneDetector/index.js +1 -160
- package/src/analyzers/codeCloneDetector/parser.js +1 -199
- package/src/analyzers/codeCloneDetector/reporter.js +1 -148
- package/src/analyzers/codeCloneDetector/scanner.js +1 -59
- package/src/core/agentPool.js +1 -1474
- package/src/core/agentScheduler.js +1 -2147
- package/src/core/contextManager.js +1 -709
- package/src/core/messageProcessor.js +1 -732
- package/src/core/orchestrator.js +1 -548
- package/src/core/stateManager.js +1 -877
- package/src/index.js +1 -631
- package/src/interfaces/cli.js +1 -549
- package/src/interfaces/terminal/__tests__/smoke/advancedFeatures.test.js +1 -0
- package/src/interfaces/terminal/__tests__/smoke/agentControl.test.js +1 -0
- package/src/interfaces/terminal/__tests__/smoke/agents.test.js +1 -0
- package/src/interfaces/terminal/__tests__/smoke/components.test.js +1 -0
- package/src/interfaces/terminal/__tests__/smoke/connection.test.js +1 -0
- package/src/interfaces/terminal/__tests__/smoke/enhancements.test.js +1 -0
- package/src/interfaces/terminal/__tests__/smoke/imports.test.js +1 -0
- package/src/interfaces/terminal/__tests__/smoke/messages.test.js +1 -0
- package/src/interfaces/terminal/__tests__/smoke/tools.test.js +1 -0
- package/src/interfaces/terminal/api/apiClient.js +1 -0
- package/src/interfaces/terminal/api/messageRouter.js +1 -0
- package/src/interfaces/terminal/api/session.js +1 -0
- package/src/interfaces/terminal/api/websocket.js +1 -0
- package/src/interfaces/terminal/components/AgentCreator.js +1 -0
- package/src/interfaces/terminal/components/AgentEditor.js +1 -0
- package/src/interfaces/terminal/components/AgentSwitcher.js +1 -0
- package/src/interfaces/terminal/components/ErrorBoundary.js +1 -0
- package/src/interfaces/terminal/components/ErrorPanel.js +1 -0
- package/src/interfaces/terminal/components/Header.js +1 -0
- package/src/interfaces/terminal/components/HelpPanel.js +1 -0
- package/src/interfaces/terminal/components/InputBox.js +1 -0
- package/src/interfaces/terminal/components/Layout.js +1 -0
- package/src/interfaces/terminal/components/LoadingSpinner.js +1 -0
- package/src/interfaces/terminal/components/MessageList.js +1 -0
- package/src/interfaces/terminal/components/MultilineTextInput.js +1 -0
- package/src/interfaces/terminal/components/SearchPanel.js +1 -0
- package/src/interfaces/terminal/components/SettingsPanel.js +1 -0
- package/src/interfaces/terminal/components/StatusBar.js +1 -0
- package/src/interfaces/terminal/components/TextInput.js +1 -0
- package/src/interfaces/terminal/config/agentEditorConstants.js +1 -0
- package/src/interfaces/terminal/config/constants.js +1 -0
- package/src/interfaces/terminal/index.js +1 -0
- package/src/interfaces/terminal/state/useAgentControl.js +1 -0
- package/src/interfaces/terminal/state/useAgents.js +1 -0
- package/src/interfaces/terminal/state/useConnection.js +1 -0
- package/src/interfaces/terminal/state/useMessages.js +1 -0
- package/src/interfaces/terminal/state/useTools.js +1 -0
- package/src/interfaces/terminal/utils/debugLogger.js +1 -0
- package/src/interfaces/terminal/utils/settingsStorage.js +1 -0
- package/src/interfaces/terminal/utils/theme.js +1 -0
- package/src/interfaces/webServer.js +1 -2162
- package/src/modules/fileExplorer/controller.js +1 -280
- package/src/modules/fileExplorer/index.js +1 -37
- package/src/modules/fileExplorer/middleware.js +1 -92
- package/src/modules/fileExplorer/routes.js +1 -125
- package/src/modules/fileExplorer/types.js +1 -44
- package/src/services/aiService.js +1 -1232
- package/src/services/apiKeyManager.js +1 -164
- package/src/services/benchmarkService.js +1 -366
- package/src/services/budgetService.js +1 -539
- package/src/services/contextInjectionService.js +1 -247
- package/src/services/conversationCompactionService.js +1 -637
- package/src/services/errorHandler.js +1 -810
- package/src/services/fileAttachmentService.js +1 -544
- package/src/services/modelRouterService.js +1 -366
- package/src/services/modelsService.js +1 -322
- package/src/services/qualityInspector.js +1 -796
- package/src/services/tokenCountingService.js +1 -536
- package/src/tools/agentCommunicationTool.js +1 -1344
- package/src/tools/agentDelayTool.js +1 -485
- package/src/tools/asyncToolManager.js +1 -604
- package/src/tools/baseTool.js +1 -800
- package/src/tools/browserTool.js +1 -920
- package/src/tools/cloneDetectionTool.js +1 -621
- package/src/tools/dependencyResolverTool.js +1 -1215
- package/src/tools/fileContentReplaceTool.js +1 -875
- package/src/tools/fileSystemTool.js +1 -1107
- package/src/tools/fileTreeTool.js +1 -853
- package/src/tools/imageTool.js +1 -901
- package/src/tools/importAnalyzerTool.js +1 -1060
- package/src/tools/jobDoneTool.js +1 -248
- package/src/tools/seekTool.js +1 -956
- package/src/tools/staticAnalysisTool.js +1 -1778
- package/src/tools/taskManagerTool.js +1 -2873
- package/src/tools/terminalTool.js +1 -2304
- package/src/tools/webTool.js +1 -1430
- package/src/types/agent.js +1 -519
- package/src/types/contextReference.js +1 -972
- package/src/types/conversation.js +1 -730
- package/src/types/toolCommand.js +1 -747
- package/src/utilities/attachmentValidator.js +1 -292
- package/src/utilities/configManager.js +1 -582
- package/src/utilities/constants.js +1 -722
- package/src/utilities/directoryAccessManager.js +1 -535
- package/src/utilities/fileProcessor.js +1 -307
- package/src/utilities/logger.js +1 -436
- package/src/utilities/tagParser.js +1 -1246
- package/src/utilities/toolConstants.js +1 -317
- package/web-ui/build/index.html +2 -2
- package/web-ui/build/static/{index-Dy2bYbOa.css → index-CClD1090.css} +1 -1
- package/web-ui/build/static/{index-CjkkcnFA.js → index-lCBai6dX.js} +66 -67
package/src/tools/jobDoneTool.js
CHANGED
|
@@ -1,248 +1 @@
|
|
|
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;
|
|
1
|
+
const a0_0x32cd73=a0_0x1b3d;function a0_0x1b3d(_0x5ba66e,_0x1da952){_0x5ba66e=_0x5ba66e-0xc1;const _0x278e53=a0_0x278e();let _0x1b3dda=_0x278e53[_0x5ba66e];if(a0_0x1b3d['PstEOX']===undefined){var _0x284b89=function(_0x18ebb8){const _0x255bf8='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x50755a='',_0x5c3478='';for(let _0x77ca49=0x0,_0x2f6e9b,_0x4752d8,_0x3fa4d3=0x0;_0x4752d8=_0x18ebb8['charAt'](_0x3fa4d3++);~_0x4752d8&&(_0x2f6e9b=_0x77ca49%0x4?_0x2f6e9b*0x40+_0x4752d8:_0x4752d8,_0x77ca49++%0x4)?_0x50755a+=String['fromCharCode'](0xff&_0x2f6e9b>>(-0x2*_0x77ca49&0x6)):0x0){_0x4752d8=_0x255bf8['indexOf'](_0x4752d8);}for(let _0x3073ed=0x0,_0x2712a6=_0x50755a['length'];_0x3073ed<_0x2712a6;_0x3073ed++){_0x5c3478+='%'+('00'+_0x50755a['charCodeAt'](_0x3073ed)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5c3478);};a0_0x1b3d['xDOgba']=_0x284b89,a0_0x1b3d['sQrZjS']={},a0_0x1b3d['PstEOX']=!![];}const _0x1e0ca4=_0x278e53[0x0],_0x47a853=_0x5ba66e+_0x1e0ca4,_0x6a5aa=a0_0x1b3d['sQrZjS'][_0x47a853];return!_0x6a5aa?(_0x1b3dda=a0_0x1b3d['xDOgba'](_0x1b3dda),a0_0x1b3d['sQrZjS'][_0x47a853]=_0x1b3dda):_0x1b3dda=_0x6a5aa,_0x1b3dda;}(function(_0x2b31d0,_0x1197b8){const _0x191178=a0_0x1b3d,_0x53c8b5=_0x2b31d0();while(!![]){try{const _0x58c7d4=-parseInt(_0x191178(0xd1))/0x1*(-parseInt(_0x191178(0xd2))/0x2)+parseInt(_0x191178(0xc6))/0x3*(parseInt(_0x191178(0xc5))/0x4)+parseInt(_0x191178(0xc2))/0x5*(-parseInt(_0x191178(0xc7))/0x6)+parseInt(_0x191178(0xcb))/0x7+-parseInt(_0x191178(0xe9))/0x8*(parseInt(_0x191178(0xc4))/0x9)+-parseInt(_0x191178(0xd6))/0xa*(parseInt(_0x191178(0xc1))/0xb)+parseInt(_0x191178(0xe6))/0xc;if(_0x58c7d4===_0x1197b8)break;else _0x53c8b5['push'](_0x53c8b5['shift']());}catch(_0x3557ce){_0x53c8b5['push'](_0x53c8b5['shift']());}}}(a0_0x278e,0x72c05));import{BaseTool}from'./baseTool.js';function a0_0x278e(){const _0x2acdb7=['ndu4odu2Be9sEwzl','mtG4mtG0nhj3y0v5ta','m1jlr0DLqG','nJKYmtbZt1PWEuu','zxH0CMfJDenVBNrLBNq','C3vJy2vZCW','BwvZC2fNzq','mtuZnZC5nur5zwPNEG','y2fWywjPBgL0AwvZ','C3rYAw5N','AM9Izg9Uzq','BgvUz3rO','DMvYC2LVBG','nZe5nxzjC3rtEG','ngHjsxfVuW','BMfTzq','z2v0q2fWywjPBgL0AwvZ','4PYfifrHC2SGy29TCgXLDgvK','ndi0nZCWrLrvr1LS','Bw9Kzs1JB250CM9S','q2XLyxiGC3vTBwfYEsbVzIb3Agf0ihLVDsbHy2nVBxbSAxnOzwqGt1iGD2HHDcbWCMv2zw50zwqGy29TCgXLDgLVBIaOzs5NlIWGiKnYzwf0zwqGnsbZB25NigzPBgvZihn1y2nLC3nMDwXSEsiSicjvBMfIBguGDg8GChjVy2vLzdOGBwLZC2LUzYbbueKGy3jLzgvUDgLHBhmIlcaIu3r1y2SGywz0zxiGmYbMywLSzwqGy29TCgLSyxrPB24Gyxr0zw1WDhmIkq','cGOQkKrLDgfPBhm6kIOG','ywDLBNrjza','Dw5RBM93BG','ihDPDgGGAxnZDwvZ','CMvXDwLYzxnqCM9Qzwn0','ms4WlJa','Dg9VBhnszwDPC3rYEq','C3vTBwfYEq','y29TCgXLDgu','ywn0Aw9U','q29TCgXLDgLVBIbZDw1Tyxj5igLZihjLCxvPCMvK','DhjPBq','yxn5BMm','mtm0mZy1mZjPsNbrqwy','zgvZy3jPChrPB24','vgfZAYbJB21WBgv0zwq','mti4tMHsDu9j','cGOQqxv0B25VBw91CYbTB2rLihDPBgWGBM93igv4AxqUkG','sw52ywXPzcbHy3rPB24Uie9UBhKGiMnVBxbSzxrLiIbPCYbZDxbWB3j0zwq','mtfIBg5lyMq','mJe1BNvHtvPz','z2v0u2nOzw1H'];a0_0x278e=function(){return _0x2acdb7;};return a0_0x278e();}import a0_0x50755a from'../utilities/tagParser.js';class JobDoneTool extends BaseTool{constructor(){const _0x3dde9c=a0_0x1b3d;super(),this['id']=_0x3dde9c(0xce),this[_0x3dde9c(0xd3)]='Job\x20Done',this[_0x3dde9c(0xe7)]='Call\x20this\x20tool\x20when\x20you\x20have\x20successfully\x20completed\x20the\x20assigned\x20task,\x20OR\x20if\x20you\x20are\x20stuck/unable\x20to\x20proceed\x20after\x20multiple\x20failed\x20attempts.\x20Provide\x20a\x20summary\x20of\x20what\x20was\x20accomplished\x20or\x20what\x20prevented\x20completion.\x20This\x20will\x20exit\x20autonomous\x20mode\x20and\x20return\x20control\x20to\x20the\x20user.',this['version']=_0x3dde9c(0xde),this['capabilities']=['task-completion',_0x3dde9c(0xd7)],this[_0x3dde9c(0xdd)]=![],this[_0x3dde9c(0xe5)]=![];}['getDescription'](){return'\x0aJob\x20Done\x20Tool:\x20Signal\x20task\x20completion\x20in\x20autonomous\x20mode\x20and\x20exit\x20to\x20chat\x20mode.\x0a\x0aUsage\x20Instructions:\x0a-\x20Call\x20this\x20tool\x20when\x20you\x20have\x20SUCCESSFULLY\x20completed\x20the\x20assigned\x20task\x0a-\x20Also\x20call\x20this\x20tool\x20if\x20you\x20are\x20STUCK\x20or\x20UNABLE\x20to\x20proceed\x20after\x20multiple\x20failed\x20attempts\x0a-\x20Provide\x20a\x20clear\x20summary\x20of\x20what\x20was\x20accomplished\x20OR\x20what\x20prevented\x20completion\x0a-\x20This\x20will\x20immediately\x20exit\x20autonomous\x20mode\x20and\x20return\x20control\x20to\x20the\x20user\x0a\x0aExamples:\x0a-\x20\x22Created\x205\x20song\x20files\x20successfully\x20with\x20lyrics\x20and\x20melodies\x22\x0a-\x20\x22Unable\x20to\x20proceed:\x20missing\x20API\x20credentials\x20for\x20the\x20service\x22\x0a-\x20\x22Stuck\x20after\x203\x20failed\x20compilation\x20attempts\x20-\x20syntax\x20errors\x20persist\x22\x0a-\x20\x22Task\x20partially\x20complete:\x20implemented\x202\x20of\x203\x20requested\x20features\x22\x0a\x0aThe\x20tool\x20will\x20format\x20a\x20completion\x20message\x20and\x20gracefully\x20exit\x20autonomous\x20mode.\x0a\x20\x20\x20\x20'['trim']();}['parseParameters'](_0x5c3478){const _0x48fa0a=a0_0x1b3d;try{const _0x77ca49=a0_0x50755a[_0x48fa0a(0xc8)](_0x5c3478,_0x48fa0a(0xe0)),_0x2f6e9b=a0_0x50755a['extractContent'](_0x5c3478,'details'),_0x4752d8=a0_0x50755a[_0x48fa0a(0xc8)](_0x5c3478,'success');let _0x3fa4d3='',_0x3073ed='',_0x2712a6=!![];return _0x77ca49[_0x48fa0a(0xcf)]>0x0?(_0x3fa4d3=_0x77ca49[0x0]['trim'](),_0x3073ed=_0x2f6e9b[_0x48fa0a(0xcf)]>0x0?_0x2f6e9b[0x0]['trim']():'',_0x2712a6=_0x4752d8['length']>0x0?_0x4752d8[0x0]['toLowerCase']()!=='false':!![]):_0x3fa4d3=_0x5c3478[_0x48fa0a(0xe4)]()||_0x48fa0a(0xe8),{'actions':[{'action':'complete','summary':_0x3fa4d3,'success':_0x2712a6,'details':_0x3073ed||undefined}]};}catch(_0x2f4f3e){return{'actions':[{'action':_0x48fa0a(0xe1),'summary':_0x5c3478['trim']()||_0x48fa0a(0xe8),'success':!![]}]};}}[a0_0x32cd73(0xc3)](){const _0x312838=a0_0x32cd73;return{'type':'object','properties':{'actions':{'type':'array','items':{'type':'object','properties':{'action':{'type':_0x312838(0xcd),'enum':['complete'],'description':'Mark\x20task\x20as\x20complete\x20-\x20always\x20use\x20\x22complete\x22'},'summary':{'type':_0x312838(0xcd),'description':_0x312838(0xd8)},'success':{'type':'boolean','default':!![],'description':'Set\x20to\x20true\x20if\x20task\x20completed\x20successfully,\x20false\x20if\x20stuck/failed\x20or\x20partial\x20completion'},'details':{'type':'string','description':'Optional:\x20Additional\x20details\x20about\x20what\x20was\x20done,\x20what\x20failed,\x20any\x20files\x20created,\x20or\x20next\x20steps\x20for\x20the\x20user'}},'required':[_0x312838(0xe2),'summary'],'additionalProperties':![]},'minItems':0x1,'maxItems':0x1}},'required':['actions'],'additionalProperties':![]};}async['execute'](_0x2e6129,_0x2c1f0e={}){const _0xa7fd1c=a0_0x32cd73;try{const {actions:_0x4db643}=_0x2e6129;if(!_0x4db643||!Array['isArray'](_0x4db643)||_0x4db643['length']===0x0)throw new Error('Actions\x20array\x20is\x20required');const _0x265cc8=_0x4db643[0x0];if(_0x265cc8[_0xa7fd1c(0xe2)]!=='complete')throw new Error(_0xa7fd1c(0xeb));if(!_0x265cc8['summary'])throw new Error(_0xa7fd1c(0xe3));const _0x1c8048=_0x2c1f0e[_0xa7fd1c(0xda)];let _0x177bd4='';if(_0x1c8048&&_0x2c1f0e[_0xa7fd1c(0xdf)])try{if(this['agentPool']){const _0x147bf8=await this['agentPool']['getAgent'](_0x1c8048);_0x147bf8&&(_0x177bd4='\x20by\x20agent\x20\x22'+_0x147bf8['name']+'\x22');}}catch(_0x483dfc){}const _0x10be03=_0xa7fd1c(0xd5)+_0x177bd4+(_0x265cc8[_0xa7fd1c(0xc9)]!==![]?'\x20successfully':_0xa7fd1c(0xdc))+'\x0a\x0a**Summary:**\x20'+_0x265cc8[_0xa7fd1c(0xe0)]+(_0x265cc8['details']?_0xa7fd1c(0xd9)+_0x265cc8['details']:'')+_0xa7fd1c(0xea);return{'success':!![],'output':_0x10be03,'taskComplete':!![],'summary':_0x265cc8[_0xa7fd1c(0xe0)],'details':_0x265cc8['details']||null,'successfulCompletion':_0x265cc8[_0xa7fd1c(0xc9)]!==![],'metadata':{'toolId':this['id'],'agentId':_0x1c8048||_0xa7fd1c(0xdb),'completedAt':new Date()['toISOString'](),'action':_0x265cc8['action']}};}catch(_0x398e8c){return{'success':![],'error':_0x398e8c['message'],'output':'Failed\x20to\x20mark\x20task\x20as\x20complete:\x20'+_0x398e8c[_0xa7fd1c(0xca)],'taskComplete':![]};}}['setAgentPool'](_0x4555e4){this['agentPool']=_0x4555e4;}[a0_0x32cd73(0xd4)](){const _0x21c194=a0_0x32cd73;return{'id':this['id'],'name':this[_0x21c194(0xd3)],'description':this['description'],'version':this[_0x21c194(0xd0)],'capabilities':this[_0x21c194(0xcc)],'requiresProject':this['requiresProject'],'async':this[_0x21c194(0xe5)],'enabled':!![],'schema':this['getSchema']()};}}export default JobDoneTool;
|