@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.
Files changed (80) hide show
  1. package/LICENSE +267 -0
  2. package/README.md +509 -0
  3. package/bin/cli.js +117 -0
  4. package/package.json +94 -0
  5. package/scripts/install-scanners.js +236 -0
  6. package/src/analyzers/CSSAnalyzer.js +297 -0
  7. package/src/analyzers/ConfigValidator.js +690 -0
  8. package/src/analyzers/ESLintAnalyzer.js +320 -0
  9. package/src/analyzers/JavaScriptAnalyzer.js +261 -0
  10. package/src/analyzers/PrettierFormatter.js +247 -0
  11. package/src/analyzers/PythonAnalyzer.js +266 -0
  12. package/src/analyzers/SecurityAnalyzer.js +729 -0
  13. package/src/analyzers/TypeScriptAnalyzer.js +247 -0
  14. package/src/analyzers/codeCloneDetector/analyzer.js +344 -0
  15. package/src/analyzers/codeCloneDetector/detector.js +203 -0
  16. package/src/analyzers/codeCloneDetector/index.js +160 -0
  17. package/src/analyzers/codeCloneDetector/parser.js +199 -0
  18. package/src/analyzers/codeCloneDetector/reporter.js +148 -0
  19. package/src/analyzers/codeCloneDetector/scanner.js +59 -0
  20. package/src/core/agentPool.js +1474 -0
  21. package/src/core/agentScheduler.js +2147 -0
  22. package/src/core/contextManager.js +709 -0
  23. package/src/core/messageProcessor.js +732 -0
  24. package/src/core/orchestrator.js +548 -0
  25. package/src/core/stateManager.js +877 -0
  26. package/src/index.js +631 -0
  27. package/src/interfaces/cli.js +549 -0
  28. package/src/interfaces/webServer.js +2162 -0
  29. package/src/modules/fileExplorer/controller.js +280 -0
  30. package/src/modules/fileExplorer/index.js +37 -0
  31. package/src/modules/fileExplorer/middleware.js +92 -0
  32. package/src/modules/fileExplorer/routes.js +125 -0
  33. package/src/modules/fileExplorer/types.js +44 -0
  34. package/src/services/aiService.js +1232 -0
  35. package/src/services/apiKeyManager.js +164 -0
  36. package/src/services/benchmarkService.js +366 -0
  37. package/src/services/budgetService.js +539 -0
  38. package/src/services/contextInjectionService.js +247 -0
  39. package/src/services/conversationCompactionService.js +637 -0
  40. package/src/services/errorHandler.js +810 -0
  41. package/src/services/fileAttachmentService.js +544 -0
  42. package/src/services/modelRouterService.js +366 -0
  43. package/src/services/modelsService.js +322 -0
  44. package/src/services/qualityInspector.js +796 -0
  45. package/src/services/tokenCountingService.js +536 -0
  46. package/src/tools/agentCommunicationTool.js +1344 -0
  47. package/src/tools/agentDelayTool.js +485 -0
  48. package/src/tools/asyncToolManager.js +604 -0
  49. package/src/tools/baseTool.js +800 -0
  50. package/src/tools/browserTool.js +920 -0
  51. package/src/tools/cloneDetectionTool.js +621 -0
  52. package/src/tools/dependencyResolverTool.js +1215 -0
  53. package/src/tools/fileContentReplaceTool.js +875 -0
  54. package/src/tools/fileSystemTool.js +1107 -0
  55. package/src/tools/fileTreeTool.js +853 -0
  56. package/src/tools/imageTool.js +901 -0
  57. package/src/tools/importAnalyzerTool.js +1060 -0
  58. package/src/tools/jobDoneTool.js +248 -0
  59. package/src/tools/seekTool.js +956 -0
  60. package/src/tools/staticAnalysisTool.js +1778 -0
  61. package/src/tools/taskManagerTool.js +2873 -0
  62. package/src/tools/terminalTool.js +2304 -0
  63. package/src/tools/webTool.js +1430 -0
  64. package/src/types/agent.js +519 -0
  65. package/src/types/contextReference.js +972 -0
  66. package/src/types/conversation.js +730 -0
  67. package/src/types/toolCommand.js +747 -0
  68. package/src/utilities/attachmentValidator.js +292 -0
  69. package/src/utilities/configManager.js +582 -0
  70. package/src/utilities/constants.js +722 -0
  71. package/src/utilities/directoryAccessManager.js +535 -0
  72. package/src/utilities/fileProcessor.js +307 -0
  73. package/src/utilities/logger.js +436 -0
  74. package/src/utilities/tagParser.js +1246 -0
  75. package/src/utilities/toolConstants.js +317 -0
  76. package/web-ui/build/index.html +15 -0
  77. package/web-ui/build/logo.png +0 -0
  78. package/web-ui/build/logo2.png +0 -0
  79. package/web-ui/build/static/index-CjkkcnFA.js +344 -0
  80. package/web-ui/build/static/index-Dy2bYbOa.css +1 -0
@@ -0,0 +1,317 @@
1
+ /**
2
+ * Tool Command Constants
3
+ *
4
+ * Centralized constants for tool command recognition and parsing
5
+ * This ensures consistent tool identification across the system
6
+ */
7
+
8
+ /**
9
+ * Tool IDs - The canonical identifiers for each tool
10
+ */
11
+ export const TOOL_IDS = {
12
+ AGENT_COMMUNICATION: 'agentcommunication',
13
+ TERMINAL: 'terminal',
14
+ FILESYSTEM: 'filesystem',
15
+ BROWSER: 'browser',
16
+ AGENT_DELAY: 'agentdelay',
17
+ JOB_DONE: 'jobdone',
18
+ TASK_MANAGER: 'taskmanager',
19
+ IMPORT_ANALYZER: 'import-analyzer',
20
+ DEPENDENCY_RESOLVER: 'dependency-resolver',
21
+ IMAGE_GEN: 'image-gen',
22
+ CLONE_DETECTION: 'clonedetection'
23
+ };
24
+
25
+ /**
26
+ * Agent Communication Tool Actions
27
+ * These are the valid action types for the agent communication tool
28
+ */
29
+ export const AGENT_COMM_ACTIONS = {
30
+ GET_AVAILABLE: 'get-available-agents',
31
+ SEND_MESSAGE: 'send-message',
32
+ REPLY_MESSAGE: 'reply-to-message',
33
+ GET_UNREPLIED: 'get-unreplied-messages',
34
+ MARK_ENDED: 'mark-conversation-ended'
35
+ };
36
+
37
+ /**
38
+ * Terminal Tool Actions
39
+ */
40
+ export const TERMINAL_ACTIONS = {
41
+ RUN_COMMAND: 'run-command',
42
+ CHANGE_DIR: 'change-directory',
43
+ LIST_DIR: 'list-directory',
44
+ CREATE_DIR: 'create-directory',
45
+ GET_CWD: 'get-working-directory'
46
+ };
47
+
48
+ /**
49
+ * Filesystem Tool Actions
50
+ */
51
+ export const FILESYSTEM_ACTIONS = {
52
+ READ_FILE: 'read-file',
53
+ WRITE_FILE: 'write-file',
54
+ APPEND_FILE: 'append-file',
55
+ DELETE_FILE: 'delete-file',
56
+ LIST_FILES: 'list-files',
57
+ CREATE_DIR: 'fs-create-directory', // Prefixed to avoid conflict with terminal
58
+ DELETE_DIR: 'fs-delete-directory', // Prefixed for consistency
59
+ MOVE_FILE: 'move-file',
60
+ COPY_FILE: 'copy-file',
61
+ GET_INFO: 'get-file-info'
62
+ };
63
+
64
+ /**
65
+ * Browser Tool Actions
66
+ */
67
+ export const BROWSER_ACTIONS = {
68
+ NAVIGATE: 'navigate',
69
+ CLICK: 'click',
70
+ TYPE: 'type',
71
+ SCREENSHOT: 'screenshot',
72
+ GET_TEXT: 'get-text',
73
+ WAIT: 'wait-for-element',
74
+ SCROLL: 'scroll',
75
+ CLOSE: 'close-browser'
76
+ };
77
+
78
+ /**
79
+ * Job Done Tool Actions
80
+ */
81
+ export const JOBDONE_ACTIONS = {
82
+ COMPLETE: 'complete',
83
+ COMPLETE_WITH_RESULT: 'complete-with-result',
84
+ FAIL: 'fail-with-error'
85
+ };
86
+
87
+ /**
88
+ * Agent Delay Tool Actions
89
+ */
90
+ export const DELAY_ACTIONS = {
91
+ DELAY: 'delay',
92
+ PAUSE: 'pause'
93
+ };
94
+
95
+ /**
96
+ * TaskManager Tool Actions
97
+ */
98
+ export const TASK_MANAGER_ACTIONS = {
99
+ CREATE: 'create',
100
+ UPDATE: 'update',
101
+ LIST: 'list',
102
+ COMPLETE: 'complete',
103
+ CANCEL: 'cancel',
104
+ CLEAR: 'clear',
105
+ DEPEND: 'depend',
106
+ RELATE: 'relate',
107
+ SUBTASK: 'subtask',
108
+ PRIORITIZE: 'prioritize',
109
+ TEMPLATE: 'template',
110
+ PROGRESS: 'progress',
111
+ ANALYTICS: 'analytics'
112
+ };
113
+
114
+ /**
115
+ * Clone Detection Tool Actions
116
+ */
117
+ export const CLONE_DETECTION_ACTIONS = {
118
+ DETECT_CLONES: 'detect-clones'
119
+ };
120
+
121
+ /**
122
+ * Tool Command Formats
123
+ * The supported formats for tool commands
124
+ */
125
+ export const COMMAND_FORMATS = {
126
+ XML: 'xml',
127
+ JSON: 'json',
128
+ JSON_PLAIN: 'json-plain',
129
+ BRACKET: 'bracket',
130
+ REDIRECT: 'redirect'
131
+ };
132
+
133
+ /**
134
+ * Tool Recognition Map
135
+ * Maps action types to their corresponding tool IDs
136
+ * This is the single source of truth for tool identification
137
+ */
138
+ export const TOOL_ACTION_MAP = {
139
+ // Agent Communication Tool
140
+ [AGENT_COMM_ACTIONS.GET_AVAILABLE]: TOOL_IDS.AGENT_COMMUNICATION,
141
+ [AGENT_COMM_ACTIONS.SEND_MESSAGE]: TOOL_IDS.AGENT_COMMUNICATION,
142
+ [AGENT_COMM_ACTIONS.REPLY_MESSAGE]: TOOL_IDS.AGENT_COMMUNICATION,
143
+ [AGENT_COMM_ACTIONS.GET_UNREPLIED]: TOOL_IDS.AGENT_COMMUNICATION,
144
+ [AGENT_COMM_ACTIONS.MARK_ENDED]: TOOL_IDS.AGENT_COMMUNICATION,
145
+
146
+ // Terminal Tool
147
+ [TERMINAL_ACTIONS.RUN_COMMAND]: TOOL_IDS.TERMINAL,
148
+ [TERMINAL_ACTIONS.CHANGE_DIR]: TOOL_IDS.TERMINAL,
149
+ [TERMINAL_ACTIONS.LIST_DIR]: TOOL_IDS.TERMINAL,
150
+ [TERMINAL_ACTIONS.CREATE_DIR]: TOOL_IDS.TERMINAL,
151
+ [TERMINAL_ACTIONS.GET_CWD]: TOOL_IDS.TERMINAL,
152
+
153
+ // Filesystem Tool
154
+ [FILESYSTEM_ACTIONS.READ_FILE]: TOOL_IDS.FILESYSTEM,
155
+ [FILESYSTEM_ACTIONS.WRITE_FILE]: TOOL_IDS.FILESYSTEM,
156
+ [FILESYSTEM_ACTIONS.APPEND_FILE]: TOOL_IDS.FILESYSTEM,
157
+ [FILESYSTEM_ACTIONS.DELETE_FILE]: TOOL_IDS.FILESYSTEM,
158
+ [FILESYSTEM_ACTIONS.LIST_FILES]: TOOL_IDS.FILESYSTEM,
159
+ [FILESYSTEM_ACTIONS.CREATE_DIR]: TOOL_IDS.FILESYSTEM,
160
+ [FILESYSTEM_ACTIONS.DELETE_DIR]: TOOL_IDS.FILESYSTEM,
161
+ [FILESYSTEM_ACTIONS.MOVE_FILE]: TOOL_IDS.FILESYSTEM,
162
+ [FILESYSTEM_ACTIONS.COPY_FILE]: TOOL_IDS.FILESYSTEM,
163
+ [FILESYSTEM_ACTIONS.GET_INFO]: TOOL_IDS.FILESYSTEM,
164
+
165
+ // Browser Tool
166
+ [BROWSER_ACTIONS.NAVIGATE]: TOOL_IDS.BROWSER,
167
+ [BROWSER_ACTIONS.CLICK]: TOOL_IDS.BROWSER,
168
+ [BROWSER_ACTIONS.TYPE]: TOOL_IDS.BROWSER,
169
+ [BROWSER_ACTIONS.SCREENSHOT]: TOOL_IDS.BROWSER,
170
+ [BROWSER_ACTIONS.GET_TEXT]: TOOL_IDS.BROWSER,
171
+ [BROWSER_ACTIONS.WAIT]: TOOL_IDS.BROWSER,
172
+ [BROWSER_ACTIONS.SCROLL]: TOOL_IDS.BROWSER,
173
+ [BROWSER_ACTIONS.CLOSE]: TOOL_IDS.BROWSER,
174
+
175
+ // Job Done Tool
176
+ [JOBDONE_ACTIONS.COMPLETE]: TOOL_IDS.JOB_DONE,
177
+ [JOBDONE_ACTIONS.COMPLETE_WITH_RESULT]: TOOL_IDS.JOB_DONE,
178
+ [JOBDONE_ACTIONS.FAIL]: TOOL_IDS.JOB_DONE,
179
+
180
+ // Delay Tool
181
+ [DELAY_ACTIONS.DELAY]: TOOL_IDS.AGENT_DELAY,
182
+ [DELAY_ACTIONS.PAUSE]: TOOL_IDS.AGENT_DELAY,
183
+
184
+ // TaskManager Tool
185
+ [TASK_MANAGER_ACTIONS.CREATE]: TOOL_IDS.TASK_MANAGER,
186
+ [TASK_MANAGER_ACTIONS.UPDATE]: TOOL_IDS.TASK_MANAGER,
187
+ [TASK_MANAGER_ACTIONS.LIST]: TOOL_IDS.TASK_MANAGER,
188
+ [TASK_MANAGER_ACTIONS.COMPLETE]: TOOL_IDS.TASK_MANAGER,
189
+ [TASK_MANAGER_ACTIONS.CANCEL]: TOOL_IDS.TASK_MANAGER,
190
+ [TASK_MANAGER_ACTIONS.CLEAR]: TOOL_IDS.TASK_MANAGER,
191
+ [TASK_MANAGER_ACTIONS.DEPEND]: TOOL_IDS.TASK_MANAGER,
192
+ [TASK_MANAGER_ACTIONS.RELATE]: TOOL_IDS.TASK_MANAGER,
193
+ [TASK_MANAGER_ACTIONS.SUBTASK]: TOOL_IDS.TASK_MANAGER,
194
+ [TASK_MANAGER_ACTIONS.PRIORITIZE]: TOOL_IDS.TASK_MANAGER,
195
+ [TASK_MANAGER_ACTIONS.TEMPLATE]: TOOL_IDS.TASK_MANAGER,
196
+ [TASK_MANAGER_ACTIONS.PROGRESS]: TOOL_IDS.TASK_MANAGER,
197
+ [TASK_MANAGER_ACTIONS.ANALYTICS]: TOOL_IDS.TASK_MANAGER,
198
+
199
+ // Clone Detection Tool
200
+ [CLONE_DETECTION_ACTIONS.DETECT_CLONES]: TOOL_IDS.CLONE_DETECTION
201
+ };
202
+
203
+ /**
204
+ * JSON Command Structure Types
205
+ * Different JSON structures we support
206
+ */
207
+ export const JSON_STRUCTURES = {
208
+ // Standard format: {"toolId": "...", "parameters": {...}}
209
+ STANDARD: 'standard',
210
+
211
+ // Actions format: {"actions": [{"type": "...", ...}]}
212
+ ACTIONS_ARRAY: 'actions-array',
213
+
214
+ // Tool commands format: {"toolCommands": [{...}]}
215
+ TOOL_COMMANDS: 'tool-commands',
216
+
217
+ // Direct action format: {"type": "...", ...}
218
+ DIRECT_ACTION: 'direct-action'
219
+ };
220
+
221
+ /**
222
+ * Identify which JSON structure is being used
223
+ */
224
+ export function identifyJsonStructure(jsonData) {
225
+ if (!jsonData || typeof jsonData !== 'object') {
226
+ return null;
227
+ }
228
+
229
+ if (jsonData.toolId && (jsonData.parameters || jsonData.actions)) {
230
+ return JSON_STRUCTURES.STANDARD;
231
+ }
232
+
233
+ if (jsonData.actions && Array.isArray(jsonData.actions)) {
234
+ return JSON_STRUCTURES.ACTIONS_ARRAY;
235
+ }
236
+
237
+ if (jsonData.toolCommands && Array.isArray(jsonData.toolCommands)) {
238
+ return JSON_STRUCTURES.TOOL_COMMANDS;
239
+ }
240
+
241
+ if (jsonData.type && typeof jsonData.type === 'string') {
242
+ return JSON_STRUCTURES.DIRECT_ACTION;
243
+ }
244
+
245
+ return null;
246
+ }
247
+
248
+ /**
249
+ * Get tool ID from action type
250
+ * This is the primary method for determining which tool to use
251
+ */
252
+ export function getToolIdFromAction(actionType) {
253
+ if (!actionType) return null;
254
+
255
+ // Normalize the action type to handle case variations
256
+ const normalizedAction = actionType.trim();
257
+
258
+ // Direct lookup first (most efficient)
259
+ if (TOOL_ACTION_MAP[normalizedAction]) {
260
+ return TOOL_ACTION_MAP[normalizedAction];
261
+ }
262
+
263
+ // Case-insensitive lookup as fallback
264
+ const lowerAction = normalizedAction.toLowerCase();
265
+ for (const [action, toolId] of Object.entries(TOOL_ACTION_MAP)) {
266
+ if (action.toLowerCase() === lowerAction) {
267
+ return toolId;
268
+ }
269
+ }
270
+
271
+ // Log unrecognized actions for debugging
272
+ console.warn(`Unrecognized action type: "${actionType}"`);
273
+
274
+ return null;
275
+ }
276
+
277
+ /**
278
+ * Validate if a tool ID is valid
279
+ */
280
+ export function isValidToolId(toolId) {
281
+ return Object.values(TOOL_IDS).includes(toolId);
282
+ }
283
+
284
+ /**
285
+ * Get all valid actions for a specific tool
286
+ */
287
+ export function getToolActions(toolId) {
288
+ const actions = [];
289
+ for (const [action, tool] of Object.entries(TOOL_ACTION_MAP)) {
290
+ if (tool === toolId) {
291
+ actions.push(action);
292
+ }
293
+ }
294
+ return actions;
295
+ }
296
+
297
+ /**
298
+ * Export all constants for easy access
299
+ */
300
+ export default {
301
+ TOOL_IDS,
302
+ AGENT_COMM_ACTIONS,
303
+ TERMINAL_ACTIONS,
304
+ FILESYSTEM_ACTIONS,
305
+ BROWSER_ACTIONS,
306
+ JOBDONE_ACTIONS,
307
+ DELAY_ACTIONS,
308
+ TASK_MANAGER_ACTIONS,
309
+ CLONE_DETECTION_ACTIONS,
310
+ COMMAND_FORMATS,
311
+ TOOL_ACTION_MAP,
312
+ JSON_STRUCTURES,
313
+ identifyJsonStructure,
314
+ getToolIdFromAction,
315
+ isValidToolId,
316
+ getToolActions
317
+ };
@@ -0,0 +1,15 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/loxia-icon.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Loxia Autopilot One</title>
8
+ <meta name="description" content="AI Agents System - No-code/vibe-code/companion-coder platform" />
9
+ <script type="module" crossorigin src="/static/index-CjkkcnFA.js"></script>
10
+ <link rel="stylesheet" crossorigin href="/static/index-Dy2bYbOa.css">
11
+ </head>
12
+ <body>
13
+ <div id="root"></div>
14
+ </body>
15
+ </html>
Binary file
Binary file