erosolar-cli 1.7.55 → 1.7.56

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 (273) hide show
  1. package/package.json +1 -1
  2. package/dist/active-stack-security.d.ts +0 -110
  3. package/dist/active-stack-security.js +0 -313
  4. package/dist/active-stack-security.js.map +0 -1
  5. package/dist/advanced-targeting.d.ts +0 -113
  6. package/dist/advanced-targeting.js +0 -252
  7. package/dist/advanced-targeting.js.map +0 -1
  8. package/dist/bin/adapters/node/index.js +0 -33
  9. package/dist/bin/adapters/types.js +0 -1
  10. package/dist/bin/alpha-zero/agentWrapper.js +0 -165
  11. package/dist/bin/alpha-zero/codeEvaluator.js +0 -272
  12. package/dist/bin/alpha-zero/competitiveRunner.js +0 -219
  13. package/dist/bin/alpha-zero/index.js +0 -98
  14. package/dist/bin/alpha-zero/introspection.js +0 -298
  15. package/dist/bin/alpha-zero/metricsTracker.js +0 -207
  16. package/dist/bin/alpha-zero/security/core.js +0 -269
  17. package/dist/bin/alpha-zero/security/google.js +0 -308
  18. package/dist/bin/alpha-zero/security/googleLoader.js +0 -40
  19. package/dist/bin/alpha-zero/security/index.js +0 -31
  20. package/dist/bin/alpha-zero/security/simulation.js +0 -274
  21. package/dist/bin/alpha-zero/selfModification.js +0 -231
  22. package/dist/bin/alpha-zero/types.js +0 -30
  23. package/dist/bin/bin/erosolar-optimized.js +0 -205
  24. package/dist/bin/capabilities/agentSpawningCapability.js +0 -116
  25. package/dist/bin/capabilities/bashCapability.js +0 -22
  26. package/dist/bin/capabilities/cloudCapability.js +0 -36
  27. package/dist/bin/capabilities/codeAnalysisCapability.js +0 -22
  28. package/dist/bin/capabilities/codeQualityCapability.js +0 -23
  29. package/dist/bin/capabilities/dependencySecurityCapability.js +0 -22
  30. package/dist/bin/capabilities/devCapability.js +0 -22
  31. package/dist/bin/capabilities/editCapability.js +0 -28
  32. package/dist/bin/capabilities/emailCapability.js +0 -20
  33. package/dist/bin/capabilities/enhancedGitCapability.js +0 -221
  34. package/dist/bin/capabilities/filesystemCapability.js +0 -22
  35. package/dist/bin/capabilities/globCapability.js +0 -28
  36. package/dist/bin/capabilities/interactionCapability.js +0 -20
  37. package/dist/bin/capabilities/learnCapability.js +0 -22
  38. package/dist/bin/capabilities/mcpCapability.js +0 -20
  39. package/dist/bin/capabilities/notebookCapability.js +0 -28
  40. package/dist/bin/capabilities/planningCapability.js +0 -27
  41. package/dist/bin/capabilities/refactoringCapability.js +0 -23
  42. package/dist/bin/capabilities/repoChecksCapability.js +0 -22
  43. package/dist/bin/capabilities/searchCapability.js +0 -22
  44. package/dist/bin/capabilities/skillCapability.js +0 -76
  45. package/dist/bin/capabilities/taskManagementCapability.js +0 -20
  46. package/dist/bin/capabilities/testingCapability.js +0 -23
  47. package/dist/bin/capabilities/toolManifest.js +0 -159
  48. package/dist/bin/capabilities/toolRegistry.js +0 -114
  49. package/dist/bin/capabilities/webCapability.js +0 -20
  50. package/dist/bin/config.js +0 -139
  51. package/dist/bin/contracts/v1/agent.js +0 -7
  52. package/dist/bin/contracts/v1/agentProfileManifest.js +0 -8
  53. package/dist/bin/contracts/v1/agentRules.js +0 -9
  54. package/dist/bin/contracts/v1/toolAccess.js +0 -8
  55. package/dist/bin/erosolar-optimized.d.ts +0 -12
  56. package/dist/bin/erosolar-optimized.d.ts.map +0 -1
  57. package/dist/bin/erosolar-optimized.js +0 -239
  58. package/dist/bin/erosolar-optimized.js.map +0 -1
  59. package/dist/bin/headless/headlessApp.js +0 -172
  60. package/dist/bin/mcp/config.js +0 -202
  61. package/dist/bin/mcp/stdioClient.js +0 -172
  62. package/dist/bin/mcp/toolBridge.js +0 -104
  63. package/dist/bin/mcp/types.js +0 -1
  64. package/dist/bin/plugins/index.js +0 -113
  65. package/dist/bin/plugins/providers/anthropic/index.js +0 -25
  66. package/dist/bin/plugins/providers/deepseek/index.js +0 -24
  67. package/dist/bin/plugins/providers/google/index.js +0 -26
  68. package/dist/bin/plugins/providers/index.js +0 -19
  69. package/dist/bin/plugins/providers/ollama/index.js +0 -59
  70. package/dist/bin/plugins/providers/openai/index.js +0 -26
  71. package/dist/bin/plugins/providers/xai/index.js +0 -24
  72. package/dist/bin/plugins/tools/agentSpawning/agentSpawningPlugin.js +0 -8
  73. package/dist/bin/plugins/tools/bash/localBashPlugin.js +0 -13
  74. package/dist/bin/plugins/tools/checks/localRepoChecksPlugin.js +0 -13
  75. package/dist/bin/plugins/tools/cloud/cloudPlugin.js +0 -13
  76. package/dist/bin/plugins/tools/codeAnalysis/codeAnalysisPlugin.js +0 -13
  77. package/dist/bin/plugins/tools/codeQuality/codeQualityPlugin.js +0 -13
  78. package/dist/bin/plugins/tools/dependency/dependencyPlugin.js +0 -11
  79. package/dist/bin/plugins/tools/development/devPlugin.js +0 -13
  80. package/dist/bin/plugins/tools/edit/editPlugin.js +0 -14
  81. package/dist/bin/plugins/tools/email/emailPlugin.js +0 -11
  82. package/dist/bin/plugins/tools/enhancedGit/enhancedGitPlugin.js +0 -8
  83. package/dist/bin/plugins/tools/filesystem/localFilesystemPlugin.js +0 -13
  84. package/dist/bin/plugins/tools/glob/globPlugin.js +0 -14
  85. package/dist/bin/plugins/tools/index.js +0 -2
  86. package/dist/bin/plugins/tools/interaction/interactionPlugin.js +0 -11
  87. package/dist/bin/plugins/tools/learn/learnPlugin.js +0 -13
  88. package/dist/bin/plugins/tools/mcp/mcpPlugin.js +0 -8
  89. package/dist/bin/plugins/tools/nodeDefaults.js +0 -56
  90. package/dist/bin/plugins/tools/notebook/notebookPlugin.js +0 -14
  91. package/dist/bin/plugins/tools/planning/planningPlugin.js +0 -14
  92. package/dist/bin/plugins/tools/refactoring/refactoringPlugin.js +0 -11
  93. package/dist/bin/plugins/tools/registry.js +0 -57
  94. package/dist/bin/plugins/tools/search/localSearchPlugin.js +0 -13
  95. package/dist/bin/plugins/tools/skills/skillPlugin.js +0 -8
  96. package/dist/bin/plugins/tools/taskManagement/taskManagementPlugin.js +0 -11
  97. package/dist/bin/plugins/tools/testing/testingPlugin.js +0 -11
  98. package/dist/bin/plugins/tools/web/webPlugin.js +0 -11
  99. package/dist/bin/providers/anthropicProvider.js +0 -329
  100. package/dist/bin/providers/googleProvider.js +0 -203
  101. package/dist/bin/providers/openaiChatCompletionsProvider.js +0 -208
  102. package/dist/bin/providers/openaiResponsesProvider.js +0 -249
  103. package/dist/bin/providers/providerFactory.js +0 -24
  104. package/dist/bin/runtime/agentController.js +0 -321
  105. package/dist/bin/runtime/agentHost.js +0 -153
  106. package/dist/bin/runtime/agentSession.js +0 -195
  107. package/dist/bin/runtime/node.js +0 -10
  108. package/dist/bin/runtime/universal.js +0 -28
  109. package/dist/bin/skills/skillRepository.js +0 -236
  110. package/dist/bin/skills/types.js +0 -1
  111. package/dist/bin/subagents/taskRunner.js +0 -269
  112. package/dist/bin/tools/backgroundBashTools.js +0 -211
  113. package/dist/bin/tools/bashTools.js +0 -159
  114. package/dist/bin/tools/cloudTools.js +0 -864
  115. package/dist/bin/tools/codeAnalysisTools.js +0 -641
  116. package/dist/bin/tools/codeQualityTools.js +0 -294
  117. package/dist/bin/tools/dependencyTools.js +0 -282
  118. package/dist/bin/tools/devTools.js +0 -238
  119. package/dist/bin/tools/diffUtils.js +0 -137
  120. package/dist/bin/tools/editTools.js +0 -134
  121. package/dist/bin/tools/emailTools.js +0 -448
  122. package/dist/bin/tools/fileTools.js +0 -282
  123. package/dist/bin/tools/globTools.js +0 -173
  124. package/dist/bin/tools/grepTools.js +0 -332
  125. package/dist/bin/tools/interactionTools.js +0 -170
  126. package/dist/bin/tools/learnTools.js +0 -1818
  127. package/dist/bin/tools/notebookEditTools.js +0 -196
  128. package/dist/bin/tools/planningTools.js +0 -46
  129. package/dist/bin/tools/refactoringTools.js +0 -293
  130. package/dist/bin/tools/repoChecksTools.js +0 -160
  131. package/dist/bin/tools/searchTools.js +0 -206
  132. package/dist/bin/tools/skillTools.js +0 -177
  133. package/dist/bin/tools/taskManagementTools.js +0 -156
  134. package/dist/bin/tools/testingTools.js +0 -232
  135. package/dist/bin/tools/webTools.js +0 -480
  136. package/dist/bin/workspace.js +0 -106
  137. package/dist/bin/workspace.validator.js +0 -213
  138. package/dist/capabilities/offensiveSecurityCapability.d.ts +0 -26
  139. package/dist/capabilities/offensiveSecurityCapability.d.ts.map +0 -1
  140. package/dist/capabilities/offensiveSecurityCapability.js +0 -58
  141. package/dist/capabilities/offensiveSecurityCapability.js.map +0 -1
  142. package/dist/capabilities/realSecurityCapability.d.ts +0 -26
  143. package/dist/capabilities/realSecurityCapability.d.ts.map +0 -1
  144. package/dist/capabilities/realSecurityCapability.js +0 -53
  145. package/dist/capabilities/realSecurityCapability.js.map +0 -1
  146. package/dist/capabilities/securityCapability.d.ts +0 -32
  147. package/dist/capabilities/securityCapability.d.ts.map +0 -1
  148. package/dist/capabilities/securityCapability.js +0 -57
  149. package/dist/capabilities/securityCapability.js.map +0 -1
  150. package/dist/capabilities/ultimateSecurityCapability.d.ts +0 -42
  151. package/dist/capabilities/ultimateSecurityCapability.d.ts.map +0 -1
  152. package/dist/capabilities/ultimateSecurityCapability.js +0 -96
  153. package/dist/capabilities/ultimateSecurityCapability.js.map +0 -1
  154. package/dist/core/designThoughtCheck.d.ts +0 -196
  155. package/dist/core/designThoughtCheck.d.ts.map +0 -1
  156. package/dist/core/designThoughtCheck.js +0 -287
  157. package/dist/core/designThoughtCheck.js.map +0 -1
  158. package/dist/core/designThoughtCheckEngine.d.ts +0 -58
  159. package/dist/core/designThoughtCheckEngine.d.ts.map +0 -1
  160. package/dist/core/designThoughtCheckEngine.js +0 -358
  161. package/dist/core/designThoughtCheckEngine.js.map +0 -1
  162. package/dist/core/designThoughtCheckIntegration.d.ts +0 -103
  163. package/dist/core/designThoughtCheckIntegration.d.ts.map +0 -1
  164. package/dist/core/designThoughtCheckIntegration.js +0 -207
  165. package/dist/core/designThoughtCheckIntegration.js.map +0 -1
  166. package/dist/core/intelligenceTools.d.ts +0 -19
  167. package/dist/core/intelligenceTools.d.ts.map +0 -1
  168. package/dist/core/intelligenceTools.js +0 -453
  169. package/dist/core/intelligenceTools.js.map +0 -1
  170. package/dist/core/operationalTools.d.ts +0 -19
  171. package/dist/core/operationalTools.d.ts.map +0 -1
  172. package/dist/core/operationalTools.js +0 -467
  173. package/dist/core/operationalTools.js.map +0 -1
  174. package/dist/offensive/core/offensive-engine.d.ts +0 -171
  175. package/dist/offensive/core/offensive-engine.d.ts.map +0 -1
  176. package/dist/offensive/core/offensive-engine.js +0 -345
  177. package/dist/offensive/core/offensive-engine.js.map +0 -1
  178. package/dist/offensive/core/offensive-integration.d.ts +0 -129
  179. package/dist/offensive/core/offensive-integration.d.ts.map +0 -1
  180. package/dist/offensive/core/offensive-integration.js +0 -364
  181. package/dist/offensive/core/offensive-integration.js.map +0 -1
  182. package/dist/offensive/core/offensive-tools.d.ts +0 -55
  183. package/dist/offensive/core/offensive-tools.d.ts.map +0 -1
  184. package/dist/offensive/core/offensive-tools.js +0 -438
  185. package/dist/offensive/core/offensive-tools.js.map +0 -1
  186. package/dist/offensive/offensive-cli.d.ts +0 -48
  187. package/dist/offensive/offensive-cli.d.ts.map +0 -1
  188. package/dist/offensive/offensive-cli.js +0 -233
  189. package/dist/offensive/offensive-cli.js.map +0 -1
  190. package/dist/security/apt-simulation-cli.d.ts +0 -57
  191. package/dist/security/apt-simulation-cli.d.ts.map +0 -1
  192. package/dist/security/apt-simulation-cli.js +0 -278
  193. package/dist/security/apt-simulation-cli.js.map +0 -1
  194. package/dist/security/apt-simulation-engine-complete.d.ts +0 -97
  195. package/dist/security/apt-simulation-engine-complete.d.ts.map +0 -1
  196. package/dist/security/apt-simulation-engine-complete.js +0 -441
  197. package/dist/security/apt-simulation-engine-complete.js.map +0 -1
  198. package/dist/security/apt-simulation-engine.d.ts +0 -97
  199. package/dist/security/apt-simulation-engine.d.ts.map +0 -1
  200. package/dist/security/apt-simulation-engine.js +0 -441
  201. package/dist/security/apt-simulation-engine.js.map +0 -1
  202. package/dist/security/authorization.d.ts +0 -45
  203. package/dist/security/authorization.d.ts.map +0 -1
  204. package/dist/security/authorization.js +0 -128
  205. package/dist/security/authorization.js.map +0 -1
  206. package/dist/security/comprehensive-security-research.d.ts +0 -84
  207. package/dist/security/comprehensive-security-research.d.ts.map +0 -1
  208. package/dist/security/comprehensive-security-research.js +0 -211
  209. package/dist/security/comprehensive-security-research.js.map +0 -1
  210. package/dist/security/offensive/exploitationEngine.d.ts +0 -54
  211. package/dist/security/offensive/exploitationEngine.d.ts.map +0 -1
  212. package/dist/security/offensive/exploitationEngine.js +0 -263
  213. package/dist/security/offensive/exploitationEngine.js.map +0 -1
  214. package/dist/security/real/networkExploitation.d.ts +0 -92
  215. package/dist/security/real/networkExploitation.d.ts.map +0 -1
  216. package/dist/security/real/networkExploitation.js +0 -316
  217. package/dist/security/real/networkExploitation.js.map +0 -1
  218. package/dist/security/real/persistenceImplementation.d.ts +0 -62
  219. package/dist/security/real/persistenceImplementation.d.ts.map +0 -1
  220. package/dist/security/real/persistenceImplementation.js +0 -323
  221. package/dist/security/real/persistenceImplementation.js.map +0 -1
  222. package/dist/security/real/vulnerabilityScanner.d.ts +0 -73
  223. package/dist/security/real/vulnerabilityScanner.d.ts.map +0 -1
  224. package/dist/security/real/vulnerabilityScanner.js +0 -341
  225. package/dist/security/real/vulnerabilityScanner.js.map +0 -1
  226. package/dist/shell/capturePastePatch.d.ts +0 -9
  227. package/dist/shell/capturePastePatch.d.ts.map +0 -1
  228. package/dist/shell/capturePastePatch.js +0 -98
  229. package/dist/shell/capturePastePatch.js.map +0 -1
  230. package/dist/shell/enhancedInteractiveShell.d.ts +0 -90
  231. package/dist/shell/enhancedInteractiveShell.d.ts.map +0 -1
  232. package/dist/shell/enhancedInteractiveShell.js +0 -248
  233. package/dist/shell/enhancedInteractiveShell.js.map +0 -1
  234. package/dist/shell/inputProcessor.d.ts +0 -56
  235. package/dist/shell/inputProcessor.d.ts.map +0 -1
  236. package/dist/shell/inputProcessor.js +0 -172
  237. package/dist/shell/inputProcessor.js.map +0 -1
  238. package/dist/shell/interactiveShell-patch.d.ts +0 -27
  239. package/dist/shell/interactiveShell-patch.d.ts.map +0 -1
  240. package/dist/shell/interactiveShell-patch.js +0 -38
  241. package/dist/shell/interactiveShell-patch.js.map +0 -1
  242. package/dist/shell/interactiveShell-robust.d.ts +0 -26
  243. package/dist/shell/interactiveShell-robust.d.ts.map +0 -1
  244. package/dist/shell/interactiveShell-robust.js +0 -34
  245. package/dist/shell/interactiveShell-robust.js.map +0 -1
  246. package/dist/shell/multiLinePasteManager.d.ts +0 -106
  247. package/dist/shell/multiLinePasteManager.d.ts.map +0 -1
  248. package/dist/shell/multiLinePasteManager.js +0 -308
  249. package/dist/shell/multiLinePasteManager.js.map +0 -1
  250. package/dist/shell/processInputBlockPatch.d.ts +0 -8
  251. package/dist/shell/processInputBlockPatch.d.ts.map +0 -1
  252. package/dist/shell/processInputBlockPatch.js +0 -133
  253. package/dist/shell/processInputBlockPatch.js.map +0 -1
  254. package/dist/shell/unifiedInputProcessor.d.ts +0 -23
  255. package/dist/shell/unifiedInputProcessor.d.ts.map +0 -1
  256. package/dist/shell/unifiedInputProcessor.js +0 -92
  257. package/dist/shell/unifiedInputProcessor.js.map +0 -1
  258. package/dist/tools/enhancedSecurityTools.d.ts +0 -19
  259. package/dist/tools/enhancedSecurityTools.d.ts.map +0 -1
  260. package/dist/tools/enhancedSecurityTools.js +0 -215
  261. package/dist/tools/enhancedSecurityTools.js.map +0 -1
  262. package/dist/tools/offensiveSecurityTools.d.ts +0 -16
  263. package/dist/tools/offensiveSecurityTools.d.ts.map +0 -1
  264. package/dist/tools/offensiveSecurityTools.js +0 -285
  265. package/dist/tools/offensiveSecurityTools.js.map +0 -1
  266. package/dist/tools/realSecurityTools.d.ts +0 -18
  267. package/dist/tools/realSecurityTools.d.ts.map +0 -1
  268. package/dist/tools/realSecurityTools.js +0 -468
  269. package/dist/tools/realSecurityTools.js.map +0 -1
  270. package/dist/tools/securityTools.d.ts +0 -20
  271. package/dist/tools/securityTools.d.ts.map +0 -1
  272. package/dist/tools/securityTools.js +0 -449
  273. package/dist/tools/securityTools.js.map +0 -1
@@ -1,172 +0,0 @@
1
- import { spawn } from 'node:child_process';
2
- import { once } from 'node:events';
3
- export class McpStdioClient {
4
- constructor(config, workingDir) {
5
- this.pending = new Map();
6
- this.buffer = Buffer.alloc(0);
7
- this.nextId = 1;
8
- this.disposed = false;
9
- this.stderrLog = [];
10
- this.id = config.id;
11
- this.description = config.description;
12
- this.process = spawn(config.command, config.args, {
13
- cwd: config.cwd ?? workingDir,
14
- env: { ...process.env, ...config.env },
15
- stdio: ['pipe', 'pipe', 'pipe'],
16
- });
17
- this.process.stdout.on('data', (chunk) => this.handleStdout(chunk));
18
- this.process.stderr.on('data', (chunk) => this.handleStderr(chunk));
19
- this.process.on('exit', (code, signal) => {
20
- if (!this.disposed) {
21
- const message = signal
22
- ? `MCP server "${this.id}" exited via signal ${signal}.`
23
- : `MCP server "${this.id}" exited with code ${code}.`;
24
- this.rejectAll(new Error(message));
25
- }
26
- });
27
- this.ready = this.initialize();
28
- }
29
- async listTools() {
30
- await this.ready;
31
- const response = (await this.sendRequest('tools/list', {}));
32
- return response?.tools ?? [];
33
- }
34
- async callTool(toolName, args) {
35
- await this.ready;
36
- const response = (await this.sendRequest('tools/call', {
37
- name: toolName,
38
- arguments: args ?? {},
39
- }));
40
- return response;
41
- }
42
- async dispose() {
43
- if (this.disposed) {
44
- return;
45
- }
46
- this.disposed = true;
47
- this.rejectAll(new Error(`MCP server "${this.id}" disposed.`));
48
- this.process.kill();
49
- await once(this.process, 'close').catch(() => { });
50
- }
51
- async initialize() {
52
- await this.sendRequest('initialize', {
53
- protocolVersion: '2024-11-05',
54
- capabilities: {
55
- tools: {
56
- listChanged: true,
57
- },
58
- },
59
- clientInfo: {
60
- name: 'Erosolar CLI',
61
- version: process.env['EROSOLAR_VERSION'] ?? 'dev',
62
- },
63
- });
64
- await this.sendNotification('notifications/initialized', {});
65
- }
66
- async sendRequest(method, params) {
67
- if (this.disposed) {
68
- throw new Error(`MCP server "${this.id}" is not running.`);
69
- }
70
- const id = this.nextId++;
71
- const payload = {
72
- jsonrpc: '2.0',
73
- id,
74
- method,
75
- params,
76
- };
77
- const serialized = JSON.stringify(payload);
78
- this.process.stdin.write(`Content-Length: ${Buffer.byteLength(serialized, 'utf8')}\r\n\r\n${serialized}`);
79
- return await new Promise((resolve, reject) => {
80
- const timer = setTimeout(() => {
81
- if (this.pending.has(id)) {
82
- this.pending.delete(id);
83
- reject(new Error(`Timed out waiting for "${method}" from MCP server "${this.id}".`));
84
- }
85
- }, 60000);
86
- this.pending.set(id, { resolve, reject, method, timer });
87
- });
88
- }
89
- async sendNotification(method, params) {
90
- if (this.disposed) {
91
- return;
92
- }
93
- const payload = {
94
- jsonrpc: '2.0',
95
- method,
96
- params,
97
- };
98
- const serialized = JSON.stringify(payload);
99
- this.process.stdin.write(`Content-Length: ${Buffer.byteLength(serialized, 'utf8')}\r\n\r\n${serialized}`);
100
- }
101
- handleStdout(chunk) {
102
- this.buffer = Buffer.concat([this.buffer, chunk]);
103
- while (true) {
104
- let headerIndex = this.buffer.indexOf('\r\n\r\n');
105
- let delimiterLength = 4;
106
- if (headerIndex === -1) {
107
- headerIndex = this.buffer.indexOf('\n\n');
108
- delimiterLength = 2;
109
- }
110
- if (headerIndex === -1) {
111
- break;
112
- }
113
- const header = this.buffer.slice(0, headerIndex).toString('utf8');
114
- const lengthMatch = header.match(/Content-Length:\s*(\d+)/i);
115
- if (!lengthMatch) {
116
- this.buffer = this.buffer.slice(headerIndex + 4);
117
- continue;
118
- }
119
- const bodyLength = Number(lengthMatch[1]);
120
- const totalLength = headerIndex + delimiterLength + bodyLength;
121
- if (this.buffer.length < totalLength) {
122
- break;
123
- }
124
- const body = this.buffer.slice(headerIndex + delimiterLength, totalLength).toString('utf8');
125
- this.buffer = this.buffer.slice(totalLength);
126
- this.handleMessage(body);
127
- }
128
- }
129
- handleStderr(chunk) {
130
- const text = chunk.toString('utf8').trim();
131
- if (!text) {
132
- return;
133
- }
134
- this.stderrLog.push(text);
135
- if (this.stderrLog.length > 5) {
136
- this.stderrLog.shift();
137
- }
138
- }
139
- handleMessage(payload) {
140
- try {
141
- const message = JSON.parse(payload);
142
- if (typeof message.id === 'number' && this.pending.has(message.id)) {
143
- const pending = this.pending.get(message.id);
144
- this.pending.delete(message.id);
145
- clearTimeout(pending.timer);
146
- if (message.error) {
147
- const errorMessage = message.error.message || `MCP server "${this.id}" returned an error.`;
148
- const details = this.stderrLog.length ? `\n${this.stderrLog.join('\n')}` : '';
149
- pending.reject(new Error(`${errorMessage}${details}`));
150
- }
151
- else {
152
- pending.resolve(message.result);
153
- }
154
- return;
155
- }
156
- if (message.method === 'notifications/tools/list_changed') {
157
- // Tool list changed notification; callers can refresh by calling listTools again.
158
- return;
159
- }
160
- }
161
- catch {
162
- // Ignore malformed messages.
163
- }
164
- }
165
- rejectAll(error) {
166
- for (const pending of this.pending.values()) {
167
- clearTimeout(pending.timer);
168
- pending.reject(error);
169
- }
170
- this.pending.clear();
171
- }
172
- }
@@ -1,104 +0,0 @@
1
- import { loadMcpServers } from './config.js';
2
- import { McpStdioClient } from './stdioClient.js';
3
- export class McpToolBridge {
4
- constructor(context) {
5
- this.servers = [];
6
- this.context = context;
7
- }
8
- async initialize() {
9
- const configs = await loadMcpServers({
10
- workingDir: this.context.workingDir,
11
- env: this.context.env,
12
- });
13
- if (!configs.length) {
14
- return [];
15
- }
16
- const suites = [];
17
- for (const config of configs) {
18
- try {
19
- const client = new McpStdioClient(config, this.context.workingDir);
20
- const tools = await client.listTools();
21
- if (!tools.length) {
22
- await client.dispose();
23
- continue;
24
- }
25
- this.servers.push({ config, client, tools });
26
- suites.push({
27
- id: `mcp.${config.id}`,
28
- description: `MCP server at ${config.description ?? config.command}`,
29
- tools: tools.map((tool) => this.buildToolDefinition(config.id, client, tool)),
30
- });
31
- }
32
- catch (error) {
33
- // eslint-disable-next-line no-console
34
- console.warn(`Failed to load MCP server "${config.id}" (${config.source}): ${error instanceof Error ? error.message : String(error)}`);
35
- }
36
- }
37
- return suites;
38
- }
39
- async dispose() {
40
- await Promise.allSettled(this.servers.map((entry) => entry.client.dispose()));
41
- this.servers = [];
42
- }
43
- buildToolDefinition(serverId, client, tool) {
44
- const name = buildToolName(serverId, tool.name);
45
- const description = tool.description
46
- ? `[${serverId}] ${tool.description}`
47
- : `MCP tool "${tool.name}" from ${serverId}`;
48
- return {
49
- name,
50
- description,
51
- parameters: normalizeSchema(tool.inputSchema),
52
- handler: async (args) => {
53
- const response = await client.callTool(tool.name, args);
54
- return formatToolResponse(response);
55
- },
56
- };
57
- }
58
- }
59
- function buildToolName(serverId, toolName) {
60
- const safeServer = serverId.replace(/[^a-z0-9_-]/gi, '_');
61
- const safeTool = toolName.replace(/[^a-z0-9_-]/gi, '_');
62
- return `mcp__${safeServer}__${safeTool}`;
63
- }
64
- function normalizeSchema(schema) {
65
- if (schema && typeof schema === 'object') {
66
- return schema;
67
- }
68
- return {
69
- type: 'object',
70
- additionalProperties: true,
71
- properties: {},
72
- };
73
- }
74
- function formatToolResponse(result) {
75
- const blocks = Array.isArray(result?.content) ? result.content : [];
76
- if (!blocks.length) {
77
- return 'MCP tool completed without returning content.';
78
- }
79
- return blocks.map(formatContentBlock).join('\n\n');
80
- }
81
- function formatContentBlock(block) {
82
- switch (block.type) {
83
- case 'text':
84
- return getStringField(block, 'text') ?? '';
85
- case 'markdown':
86
- return getStringField(block, 'markdown') ?? '';
87
- case 'json': {
88
- const jsonValue = block['json'];
89
- return jsonValue !== undefined ? JSON.stringify(jsonValue, null, 2) : '';
90
- }
91
- case 'resource': {
92
- const uri = getStringField(block, 'uri') ?? '(unknown uri)';
93
- const description = getStringField(block, 'description');
94
- return `Resource: ${uri}${description ? `\n${description}` : ''}`;
95
- }
96
- default:
97
- return JSON.stringify(block, null, 2);
98
- }
99
- }
100
- function getStringField(block, key) {
101
- const record = block;
102
- const value = record[key];
103
- return typeof value === 'string' ? value : null;
104
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,113 +0,0 @@
1
- /**
2
- * Plugin System - Root Index
3
- *
4
- * Aggregates all plugin functionality for easy import.
5
- *
6
- * Principal Investigator: Bo Shang
7
- * Framework: erosolar-cli
8
- */
9
- // Re-export tool plugin system
10
- export { registerToolPlugin, unregisterToolPlugin, listRegisteredToolPlugins, instantiateToolPlugins, } from './tools/index.js';
11
- export { registerDefaultNodeToolPlugins } from './tools/nodeDefaults.js';
12
- // Track loaded plugins
13
- const loadedPlugins = new Map();
14
- /**
15
- * Register a plugin as loaded
16
- */
17
- export function markPluginLoaded(plugin) {
18
- loadedPlugins.set(plugin.id, plugin);
19
- }
20
- /**
21
- * Get a loaded plugin by ID
22
- */
23
- export function getLoadedPlugin(id) {
24
- return loadedPlugins.get(id);
25
- }
26
- /**
27
- * List all loaded plugins
28
- */
29
- export function listLoadedPlugins() {
30
- return Array.from(loadedPlugins.values());
31
- }
32
- /**
33
- * List available plugins (combines loaded + builtin)
34
- */
35
- export function listAvailablePlugins() {
36
- const available = new Set();
37
- for (const id of BUILTIN_PLUGINS) {
38
- available.add(id);
39
- }
40
- for (const id of loadedPlugins.keys()) {
41
- available.add(id);
42
- }
43
- return Array.from(available);
44
- }
45
- /**
46
- * Get all plugin tool suites
47
- */
48
- export function getAllPluginToolSuites() {
49
- return listLoadedPlugins().filter((p) => p.enabled);
50
- }
51
- /**
52
- * Load a plugin by ID
53
- */
54
- export async function loadPlugin(id) {
55
- // Check if already loaded
56
- const existing = loadedPlugins.get(id);
57
- if (existing) {
58
- return existing;
59
- }
60
- // Check if it's a builtin plugin
61
- if (!BUILTIN_PLUGINS.includes(id)) {
62
- return null;
63
- }
64
- // Create a loaded plugin entry
65
- const plugin = {
66
- id,
67
- name: id.replace(/-/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase()),
68
- version: '1.0.0',
69
- enabled: true,
70
- };
71
- loadedPlugins.set(id, plugin);
72
- return plugin;
73
- }
74
- /**
75
- * Get plugin IDs from command line flags
76
- */
77
- export function getPluginIdsFromFlags(flags) {
78
- const ids = [];
79
- for (const [flag, enabled] of Object.entries(flags)) {
80
- if (enabled && BUILTIN_PLUGINS.includes(flag)) {
81
- ids.push(flag);
82
- }
83
- }
84
- return ids;
85
- }
86
- /**
87
- * Builtin plugin identifiers
88
- */
89
- export const BUILTIN_PLUGINS = [
90
- 'local-filesystem',
91
- 'local-bash',
92
- 'local-search',
93
- 'edit',
94
- 'glob',
95
- 'web',
96
- 'mcp',
97
- 'code-analysis',
98
- 'code-quality',
99
- 'dependency',
100
- 'development',
101
- 'enhanced-git',
102
- 'interaction',
103
- 'notebook',
104
- 'planning',
105
- 'refactoring',
106
- 'skills',
107
- 'task-management',
108
- 'testing',
109
- 'agent-spawning',
110
- 'local-repo-checks',
111
- 'cloud',
112
- 'email',
113
- ];
@@ -1,25 +0,0 @@
1
- import { AnthropicMessagesProvider } from '../../../providers/anthropicProvider.js';
2
- import { registerProvider } from '../../../providers/providerFactory.js';
3
- let registered = false;
4
- export function registerAnthropicProviderPlugin() {
5
- if (registered) {
6
- return;
7
- }
8
- registerProvider('anthropic', (config) => {
9
- const options = {
10
- apiKey: requireEnv('ANTHROPIC_API_KEY'),
11
- model: config.model,
12
- ...(typeof config.temperature === 'number' ? { temperature: config.temperature } : {}),
13
- ...(typeof config.maxTokens === 'number' ? { maxTokens: config.maxTokens } : {}),
14
- };
15
- return new AnthropicMessagesProvider(options);
16
- });
17
- registered = true;
18
- }
19
- function requireEnv(name) {
20
- const value = process.env[name];
21
- if (!value) {
22
- throw new Error(`Missing required environment variable ${name}.`);
23
- }
24
- return value;
25
- }
@@ -1,24 +0,0 @@
1
- import { OpenAIChatCompletionsProvider } from '../../../providers/openaiChatCompletionsProvider.js';
2
- import { registerProvider } from '../../../providers/providerFactory.js';
3
- let registered = false;
4
- export function registerDeepSeekProviderPlugin() {
5
- if (registered) {
6
- return;
7
- }
8
- registerProvider('deepseek', (config) => {
9
- return new OpenAIChatCompletionsProvider({
10
- apiKey: requireEnv('DEEPSEEK_API_KEY'),
11
- model: config.model,
12
- baseURL: 'https://api.deepseek.com',
13
- providerId: 'deepseek',
14
- });
15
- });
16
- registered = true;
17
- }
18
- function requireEnv(name) {
19
- const value = process.env[name];
20
- if (!value) {
21
- throw new Error(`Missing required environment variable ${name}.`);
22
- }
23
- return value;
24
- }
@@ -1,26 +0,0 @@
1
- import { GoogleGenAIProvider } from '../../../providers/googleProvider.js';
2
- import { registerProvider } from '../../../providers/providerFactory.js';
3
- let registered = false;
4
- export function registerGoogleProviderPlugin() {
5
- if (registered) {
6
- return;
7
- }
8
- registerProvider('google', (config) => {
9
- const options = {
10
- apiKey: requireEnv('GEMINI_API_KEY'),
11
- model: config.model,
12
- providerId: 'google',
13
- ...(typeof config.temperature === 'number' ? { temperature: config.temperature } : {}),
14
- ...(typeof config.maxTokens === 'number' ? { maxOutputTokens: config.maxTokens } : {}),
15
- };
16
- return new GoogleGenAIProvider(options);
17
- });
18
- registered = true;
19
- }
20
- function requireEnv(name) {
21
- const value = process.env[name];
22
- if (!value) {
23
- throw new Error(`Missing required environment variable ${name}.`);
24
- }
25
- return value;
26
- }
@@ -1,19 +0,0 @@
1
- import { registerOpenAIProviderPlugin } from './openai/index.js';
2
- import { registerAnthropicProviderPlugin } from './anthropic/index.js';
3
- import { registerDeepSeekProviderPlugin } from './deepseek/index.js';
4
- import { registerXaiProviderPlugin } from './xai/index.js';
5
- import { registerGoogleProviderPlugin } from './google/index.js';
6
- import { registerOllamaProviderPlugin } from './ollama/index.js';
7
- let defaultsRegistered = false;
8
- export function registerDefaultProviderPlugins() {
9
- if (defaultsRegistered) {
10
- return;
11
- }
12
- registerOpenAIProviderPlugin();
13
- registerAnthropicProviderPlugin();
14
- registerDeepSeekProviderPlugin();
15
- registerXaiProviderPlugin();
16
- registerGoogleProviderPlugin();
17
- registerOllamaProviderPlugin();
18
- defaultsRegistered = true;
19
- }
@@ -1,59 +0,0 @@
1
- import { OpenAIChatCompletionsProvider } from '../../../providers/openaiChatCompletionsProvider.js';
2
- import { registerProvider } from '../../../providers/providerFactory.js';
3
- let registered = false;
4
- /**
5
- * Register Ollama provider plugin.
6
- *
7
- * Ollama provides an OpenAI-compatible API, so we can reuse the OpenAI provider
8
- * with a custom base URL. By default, Ollama runs on http://localhost:11434.
9
- */
10
- export function registerOllamaProviderPlugin() {
11
- if (registered) {
12
- return;
13
- }
14
- registerProvider('ollama', (config) => {
15
- const baseURL = process.env['OLLAMA_BASE_URL'] || 'http://localhost:11434/v1';
16
- const options = {
17
- apiKey: 'ollama', // Ollama doesn't require an API key for local instances
18
- model: config.model,
19
- providerId: 'ollama',
20
- baseURL,
21
- ...(typeof config.temperature === 'number' ? { temperature: config.temperature } : {}),
22
- ...(typeof config.maxTokens === 'number' ? { maxTokens: config.maxTokens } : {}),
23
- };
24
- return new OpenAIChatCompletionsProvider(options);
25
- });
26
- registered = true;
27
- }
28
- /**
29
- * Query available models from local Ollama instance.
30
- * Returns an array of model names that are currently available.
31
- */
32
- export async function getAvailableOllamaModels(baseURL = 'http://localhost:11434') {
33
- try {
34
- const response = await fetch(`${baseURL}/api/tags`);
35
- if (!response.ok) {
36
- return [];
37
- }
38
- const data = (await response.json());
39
- return data.models?.map((m) => m.name) ?? [];
40
- }
41
- catch {
42
- return [];
43
- }
44
- }
45
- /**
46
- * Check if Ollama is running and accessible.
47
- */
48
- export async function isOllamaAvailable(baseURL = 'http://localhost:11434') {
49
- try {
50
- const response = await fetch(`${baseURL}/api/tags`, {
51
- method: 'GET',
52
- signal: AbortSignal.timeout(2000), // 2 second timeout
53
- });
54
- return response.ok;
55
- }
56
- catch {
57
- return false;
58
- }
59
- }
@@ -1,26 +0,0 @@
1
- import { OpenAIResponsesProvider } from '../../../providers/openaiResponsesProvider.js';
2
- import { registerProvider } from '../../../providers/providerFactory.js';
3
- let registered = false;
4
- export function registerOpenAIProviderPlugin(providerId = 'openai') {
5
- if (registered) {
6
- return;
7
- }
8
- registerProvider(providerId, (config) => {
9
- const options = {
10
- apiKey: requireEnv('OPENAI_API_KEY'),
11
- model: config.model,
12
- providerId,
13
- ...(config.reasoningEffort ? { reasoningEffort: config.reasoningEffort } : {}),
14
- ...(config.textVerbosity ? { textVerbosity: config.textVerbosity } : {}),
15
- };
16
- return new OpenAIResponsesProvider(options);
17
- });
18
- registered = true;
19
- }
20
- function requireEnv(name) {
21
- const value = process.env[name];
22
- if (!value) {
23
- throw new Error(`Missing required environment variable ${name}.`);
24
- }
25
- return value;
26
- }
@@ -1,24 +0,0 @@
1
- import { OpenAIChatCompletionsProvider } from '../../../providers/openaiChatCompletionsProvider.js';
2
- import { registerProvider } from '../../../providers/providerFactory.js';
3
- let registered = false;
4
- export function registerXaiProviderPlugin() {
5
- if (registered) {
6
- return;
7
- }
8
- registerProvider('xai', (config) => {
9
- return new OpenAIChatCompletionsProvider({
10
- apiKey: requireEnv('XAI_API_KEY'),
11
- model: config.model,
12
- baseURL: 'https://api.x.ai/v1',
13
- providerId: 'xai',
14
- });
15
- });
16
- registered = true;
17
- }
18
- function requireEnv(name) {
19
- const value = process.env[name];
20
- if (!value) {
21
- throw new Error(`Missing required environment variable ${name}.`);
22
- }
23
- return value;
24
- }
@@ -1,8 +0,0 @@
1
- import { AgentSpawningCapabilityModule } from '../../../capabilities/agentSpawningCapability.js';
2
- export function createAgentSpawningToolPlugin() {
3
- return {
4
- id: 'tool.agent-spawning',
5
- targets: ['node', 'cloud'],
6
- create: () => new AgentSpawningCapabilityModule(),
7
- };
8
- }
@@ -1,13 +0,0 @@
1
- import { BashCapabilityModule } from '../../../capabilities/bashCapability.js';
2
- export function createLocalBashToolPlugin() {
3
- return {
4
- id: 'tool.bash.local',
5
- description: 'Local bash execution with sandbox awareness.',
6
- targets: ['node', 'cloud'],
7
- create: (context) => {
8
- return new BashCapabilityModule({
9
- workingDir: context.workingDir,
10
- });
11
- },
12
- };
13
- }
@@ -1,13 +0,0 @@
1
- import { RepoChecksCapabilityModule } from '../../../capabilities/repoChecksCapability.js';
2
- export function createLocalRepoChecksPlugin() {
3
- return {
4
- id: 'tool.repo-checks.local',
5
- description: 'Run npm-based repo checks (test/build/lint) in the sandboxed workspace.',
6
- targets: ['node', 'cloud'],
7
- create: (context) => {
8
- return new RepoChecksCapabilityModule({
9
- workingDir: context.workingDir,
10
- });
11
- },
12
- };
13
- }
@@ -1,13 +0,0 @@
1
- import { CloudCapabilityModule } from '../../../capabilities/cloudCapability.js';
2
- export function createCloudToolPlugin() {
3
- return {
4
- id: 'tool.cloud.deployment',
5
- description: 'Multi-cloud deployment tools with auto-detection and auto-fix for Firebase, Aliyun, AWS, GCP, Azure, Vercel, Netlify, Cloudflare, and more.',
6
- targets: ['node', 'cloud'],
7
- create: (context) => {
8
- return new CloudCapabilityModule({
9
- workingDir: context.workingDir,
10
- });
11
- },
12
- };
13
- }
@@ -1,13 +0,0 @@
1
- import { CodeAnalysisCapabilityModule } from '../../../capabilities/codeAnalysisCapability.js';
2
- export function createCodeAnalysisToolPlugin() {
3
- return {
4
- id: 'tool.code-analysis.structural',
5
- description: 'Advanced code structure analysis, dependency tracking, and complexity metrics.',
6
- targets: ['node'],
7
- create: async (context) => {
8
- return new CodeAnalysisCapabilityModule({
9
- workingDir: context.workingDir,
10
- });
11
- },
12
- };
13
- }