erosolar-cli 1.7.55 → 1.7.57

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/dist/shell/unifiedInputProcessor.d.ts +15 -12
  2. package/dist/shell/unifiedInputProcessor.d.ts.map +1 -1
  3. package/dist/shell/unifiedInputProcessor.js +45 -72
  4. package/dist/shell/unifiedInputProcessor.js.map +1 -1
  5. package/package.json +4 -4
  6. package/dist/active-stack-security.d.ts +0 -110
  7. package/dist/active-stack-security.js +0 -313
  8. package/dist/active-stack-security.js.map +0 -1
  9. package/dist/advanced-targeting.d.ts +0 -113
  10. package/dist/advanced-targeting.js +0 -252
  11. package/dist/advanced-targeting.js.map +0 -1
  12. package/dist/bin/adapters/node/index.js +0 -33
  13. package/dist/bin/adapters/types.js +0 -1
  14. package/dist/bin/alpha-zero/agentWrapper.js +0 -165
  15. package/dist/bin/alpha-zero/codeEvaluator.js +0 -272
  16. package/dist/bin/alpha-zero/competitiveRunner.js +0 -219
  17. package/dist/bin/alpha-zero/index.js +0 -98
  18. package/dist/bin/alpha-zero/introspection.js +0 -298
  19. package/dist/bin/alpha-zero/metricsTracker.js +0 -207
  20. package/dist/bin/alpha-zero/security/core.js +0 -269
  21. package/dist/bin/alpha-zero/security/google.js +0 -308
  22. package/dist/bin/alpha-zero/security/googleLoader.js +0 -40
  23. package/dist/bin/alpha-zero/security/index.js +0 -31
  24. package/dist/bin/alpha-zero/security/simulation.js +0 -274
  25. package/dist/bin/alpha-zero/selfModification.js +0 -231
  26. package/dist/bin/alpha-zero/types.js +0 -30
  27. package/dist/bin/bin/erosolar-optimized.js +0 -205
  28. package/dist/bin/capabilities/agentSpawningCapability.js +0 -116
  29. package/dist/bin/capabilities/bashCapability.js +0 -22
  30. package/dist/bin/capabilities/cloudCapability.js +0 -36
  31. package/dist/bin/capabilities/codeAnalysisCapability.js +0 -22
  32. package/dist/bin/capabilities/codeQualityCapability.js +0 -23
  33. package/dist/bin/capabilities/dependencySecurityCapability.js +0 -22
  34. package/dist/bin/capabilities/devCapability.js +0 -22
  35. package/dist/bin/capabilities/editCapability.js +0 -28
  36. package/dist/bin/capabilities/emailCapability.js +0 -20
  37. package/dist/bin/capabilities/enhancedGitCapability.js +0 -221
  38. package/dist/bin/capabilities/filesystemCapability.js +0 -22
  39. package/dist/bin/capabilities/globCapability.js +0 -28
  40. package/dist/bin/capabilities/interactionCapability.js +0 -20
  41. package/dist/bin/capabilities/learnCapability.js +0 -22
  42. package/dist/bin/capabilities/mcpCapability.js +0 -20
  43. package/dist/bin/capabilities/notebookCapability.js +0 -28
  44. package/dist/bin/capabilities/planningCapability.js +0 -27
  45. package/dist/bin/capabilities/refactoringCapability.js +0 -23
  46. package/dist/bin/capabilities/repoChecksCapability.js +0 -22
  47. package/dist/bin/capabilities/searchCapability.js +0 -22
  48. package/dist/bin/capabilities/skillCapability.js +0 -76
  49. package/dist/bin/capabilities/taskManagementCapability.js +0 -20
  50. package/dist/bin/capabilities/testingCapability.js +0 -23
  51. package/dist/bin/capabilities/toolManifest.js +0 -159
  52. package/dist/bin/capabilities/toolRegistry.js +0 -114
  53. package/dist/bin/capabilities/webCapability.js +0 -20
  54. package/dist/bin/config.js +0 -139
  55. package/dist/bin/contracts/v1/agent.js +0 -7
  56. package/dist/bin/contracts/v1/agentProfileManifest.js +0 -8
  57. package/dist/bin/contracts/v1/agentRules.js +0 -9
  58. package/dist/bin/contracts/v1/toolAccess.js +0 -8
  59. package/dist/bin/erosolar-optimized.d.ts +0 -12
  60. package/dist/bin/erosolar-optimized.d.ts.map +0 -1
  61. package/dist/bin/erosolar-optimized.js +0 -239
  62. package/dist/bin/erosolar-optimized.js.map +0 -1
  63. package/dist/bin/headless/headlessApp.js +0 -172
  64. package/dist/bin/mcp/config.js +0 -202
  65. package/dist/bin/mcp/stdioClient.js +0 -172
  66. package/dist/bin/mcp/toolBridge.js +0 -104
  67. package/dist/bin/mcp/types.js +0 -1
  68. package/dist/bin/plugins/index.js +0 -113
  69. package/dist/bin/plugins/providers/anthropic/index.js +0 -25
  70. package/dist/bin/plugins/providers/deepseek/index.js +0 -24
  71. package/dist/bin/plugins/providers/google/index.js +0 -26
  72. package/dist/bin/plugins/providers/index.js +0 -19
  73. package/dist/bin/plugins/providers/ollama/index.js +0 -59
  74. package/dist/bin/plugins/providers/openai/index.js +0 -26
  75. package/dist/bin/plugins/providers/xai/index.js +0 -24
  76. package/dist/bin/plugins/tools/agentSpawning/agentSpawningPlugin.js +0 -8
  77. package/dist/bin/plugins/tools/bash/localBashPlugin.js +0 -13
  78. package/dist/bin/plugins/tools/checks/localRepoChecksPlugin.js +0 -13
  79. package/dist/bin/plugins/tools/cloud/cloudPlugin.js +0 -13
  80. package/dist/bin/plugins/tools/codeAnalysis/codeAnalysisPlugin.js +0 -13
  81. package/dist/bin/plugins/tools/codeQuality/codeQualityPlugin.js +0 -13
  82. package/dist/bin/plugins/tools/dependency/dependencyPlugin.js +0 -11
  83. package/dist/bin/plugins/tools/development/devPlugin.js +0 -13
  84. package/dist/bin/plugins/tools/edit/editPlugin.js +0 -14
  85. package/dist/bin/plugins/tools/email/emailPlugin.js +0 -11
  86. package/dist/bin/plugins/tools/enhancedGit/enhancedGitPlugin.js +0 -8
  87. package/dist/bin/plugins/tools/filesystem/localFilesystemPlugin.js +0 -13
  88. package/dist/bin/plugins/tools/glob/globPlugin.js +0 -14
  89. package/dist/bin/plugins/tools/index.js +0 -2
  90. package/dist/bin/plugins/tools/interaction/interactionPlugin.js +0 -11
  91. package/dist/bin/plugins/tools/learn/learnPlugin.js +0 -13
  92. package/dist/bin/plugins/tools/mcp/mcpPlugin.js +0 -8
  93. package/dist/bin/plugins/tools/nodeDefaults.js +0 -56
  94. package/dist/bin/plugins/tools/notebook/notebookPlugin.js +0 -14
  95. package/dist/bin/plugins/tools/planning/planningPlugin.js +0 -14
  96. package/dist/bin/plugins/tools/refactoring/refactoringPlugin.js +0 -11
  97. package/dist/bin/plugins/tools/registry.js +0 -57
  98. package/dist/bin/plugins/tools/search/localSearchPlugin.js +0 -13
  99. package/dist/bin/plugins/tools/skills/skillPlugin.js +0 -8
  100. package/dist/bin/plugins/tools/taskManagement/taskManagementPlugin.js +0 -11
  101. package/dist/bin/plugins/tools/testing/testingPlugin.js +0 -11
  102. package/dist/bin/plugins/tools/web/webPlugin.js +0 -11
  103. package/dist/bin/providers/anthropicProvider.js +0 -329
  104. package/dist/bin/providers/googleProvider.js +0 -203
  105. package/dist/bin/providers/openaiChatCompletionsProvider.js +0 -208
  106. package/dist/bin/providers/openaiResponsesProvider.js +0 -249
  107. package/dist/bin/providers/providerFactory.js +0 -24
  108. package/dist/bin/runtime/agentController.js +0 -321
  109. package/dist/bin/runtime/agentHost.js +0 -153
  110. package/dist/bin/runtime/agentSession.js +0 -195
  111. package/dist/bin/runtime/node.js +0 -10
  112. package/dist/bin/runtime/universal.js +0 -28
  113. package/dist/bin/skills/skillRepository.js +0 -236
  114. package/dist/bin/skills/types.js +0 -1
  115. package/dist/bin/subagents/taskRunner.js +0 -269
  116. package/dist/bin/tools/backgroundBashTools.js +0 -211
  117. package/dist/bin/tools/bashTools.js +0 -159
  118. package/dist/bin/tools/cloudTools.js +0 -864
  119. package/dist/bin/tools/codeAnalysisTools.js +0 -641
  120. package/dist/bin/tools/codeQualityTools.js +0 -294
  121. package/dist/bin/tools/dependencyTools.js +0 -282
  122. package/dist/bin/tools/devTools.js +0 -238
  123. package/dist/bin/tools/diffUtils.js +0 -137
  124. package/dist/bin/tools/editTools.js +0 -134
  125. package/dist/bin/tools/emailTools.js +0 -448
  126. package/dist/bin/tools/fileTools.js +0 -282
  127. package/dist/bin/tools/globTools.js +0 -173
  128. package/dist/bin/tools/grepTools.js +0 -332
  129. package/dist/bin/tools/interactionTools.js +0 -170
  130. package/dist/bin/tools/learnTools.js +0 -1818
  131. package/dist/bin/tools/notebookEditTools.js +0 -196
  132. package/dist/bin/tools/planningTools.js +0 -46
  133. package/dist/bin/tools/refactoringTools.js +0 -293
  134. package/dist/bin/tools/repoChecksTools.js +0 -160
  135. package/dist/bin/tools/searchTools.js +0 -206
  136. package/dist/bin/tools/skillTools.js +0 -177
  137. package/dist/bin/tools/taskManagementTools.js +0 -156
  138. package/dist/bin/tools/testingTools.js +0 -232
  139. package/dist/bin/tools/webTools.js +0 -480
  140. package/dist/bin/workspace.js +0 -106
  141. package/dist/bin/workspace.validator.js +0 -213
  142. package/dist/capabilities/offensiveSecurityCapability.d.ts +0 -26
  143. package/dist/capabilities/offensiveSecurityCapability.d.ts.map +0 -1
  144. package/dist/capabilities/offensiveSecurityCapability.js +0 -58
  145. package/dist/capabilities/offensiveSecurityCapability.js.map +0 -1
  146. package/dist/capabilities/realSecurityCapability.d.ts +0 -26
  147. package/dist/capabilities/realSecurityCapability.d.ts.map +0 -1
  148. package/dist/capabilities/realSecurityCapability.js +0 -53
  149. package/dist/capabilities/realSecurityCapability.js.map +0 -1
  150. package/dist/capabilities/securityCapability.d.ts +0 -32
  151. package/dist/capabilities/securityCapability.d.ts.map +0 -1
  152. package/dist/capabilities/securityCapability.js +0 -57
  153. package/dist/capabilities/securityCapability.js.map +0 -1
  154. package/dist/capabilities/ultimateSecurityCapability.d.ts +0 -42
  155. package/dist/capabilities/ultimateSecurityCapability.d.ts.map +0 -1
  156. package/dist/capabilities/ultimateSecurityCapability.js +0 -96
  157. package/dist/capabilities/ultimateSecurityCapability.js.map +0 -1
  158. package/dist/core/designThoughtCheck.d.ts +0 -196
  159. package/dist/core/designThoughtCheck.d.ts.map +0 -1
  160. package/dist/core/designThoughtCheck.js +0 -287
  161. package/dist/core/designThoughtCheck.js.map +0 -1
  162. package/dist/core/designThoughtCheckEngine.d.ts +0 -58
  163. package/dist/core/designThoughtCheckEngine.d.ts.map +0 -1
  164. package/dist/core/designThoughtCheckEngine.js +0 -358
  165. package/dist/core/designThoughtCheckEngine.js.map +0 -1
  166. package/dist/core/designThoughtCheckIntegration.d.ts +0 -103
  167. package/dist/core/designThoughtCheckIntegration.d.ts.map +0 -1
  168. package/dist/core/designThoughtCheckIntegration.js +0 -207
  169. package/dist/core/designThoughtCheckIntegration.js.map +0 -1
  170. package/dist/core/intelligenceTools.d.ts +0 -19
  171. package/dist/core/intelligenceTools.d.ts.map +0 -1
  172. package/dist/core/intelligenceTools.js +0 -453
  173. package/dist/core/intelligenceTools.js.map +0 -1
  174. package/dist/core/operationalTools.d.ts +0 -19
  175. package/dist/core/operationalTools.d.ts.map +0 -1
  176. package/dist/core/operationalTools.js +0 -467
  177. package/dist/core/operationalTools.js.map +0 -1
  178. package/dist/offensive/core/offensive-engine.d.ts +0 -171
  179. package/dist/offensive/core/offensive-engine.d.ts.map +0 -1
  180. package/dist/offensive/core/offensive-engine.js +0 -345
  181. package/dist/offensive/core/offensive-engine.js.map +0 -1
  182. package/dist/offensive/core/offensive-integration.d.ts +0 -129
  183. package/dist/offensive/core/offensive-integration.d.ts.map +0 -1
  184. package/dist/offensive/core/offensive-integration.js +0 -364
  185. package/dist/offensive/core/offensive-integration.js.map +0 -1
  186. package/dist/offensive/core/offensive-tools.d.ts +0 -55
  187. package/dist/offensive/core/offensive-tools.d.ts.map +0 -1
  188. package/dist/offensive/core/offensive-tools.js +0 -438
  189. package/dist/offensive/core/offensive-tools.js.map +0 -1
  190. package/dist/offensive/offensive-cli.d.ts +0 -48
  191. package/dist/offensive/offensive-cli.d.ts.map +0 -1
  192. package/dist/offensive/offensive-cli.js +0 -233
  193. package/dist/offensive/offensive-cli.js.map +0 -1
  194. package/dist/security/apt-simulation-cli.d.ts +0 -57
  195. package/dist/security/apt-simulation-cli.d.ts.map +0 -1
  196. package/dist/security/apt-simulation-cli.js +0 -278
  197. package/dist/security/apt-simulation-cli.js.map +0 -1
  198. package/dist/security/apt-simulation-engine-complete.d.ts +0 -97
  199. package/dist/security/apt-simulation-engine-complete.d.ts.map +0 -1
  200. package/dist/security/apt-simulation-engine-complete.js +0 -441
  201. package/dist/security/apt-simulation-engine-complete.js.map +0 -1
  202. package/dist/security/apt-simulation-engine.d.ts +0 -97
  203. package/dist/security/apt-simulation-engine.d.ts.map +0 -1
  204. package/dist/security/apt-simulation-engine.js +0 -441
  205. package/dist/security/apt-simulation-engine.js.map +0 -1
  206. package/dist/security/authorization.d.ts +0 -45
  207. package/dist/security/authorization.d.ts.map +0 -1
  208. package/dist/security/authorization.js +0 -128
  209. package/dist/security/authorization.js.map +0 -1
  210. package/dist/security/comprehensive-security-research.d.ts +0 -84
  211. package/dist/security/comprehensive-security-research.d.ts.map +0 -1
  212. package/dist/security/comprehensive-security-research.js +0 -211
  213. package/dist/security/comprehensive-security-research.js.map +0 -1
  214. package/dist/security/offensive/exploitationEngine.d.ts +0 -54
  215. package/dist/security/offensive/exploitationEngine.d.ts.map +0 -1
  216. package/dist/security/offensive/exploitationEngine.js +0 -263
  217. package/dist/security/offensive/exploitationEngine.js.map +0 -1
  218. package/dist/security/real/networkExploitation.d.ts +0 -92
  219. package/dist/security/real/networkExploitation.d.ts.map +0 -1
  220. package/dist/security/real/networkExploitation.js +0 -316
  221. package/dist/security/real/networkExploitation.js.map +0 -1
  222. package/dist/security/real/persistenceImplementation.d.ts +0 -62
  223. package/dist/security/real/persistenceImplementation.d.ts.map +0 -1
  224. package/dist/security/real/persistenceImplementation.js +0 -323
  225. package/dist/security/real/persistenceImplementation.js.map +0 -1
  226. package/dist/security/real/vulnerabilityScanner.d.ts +0 -73
  227. package/dist/security/real/vulnerabilityScanner.d.ts.map +0 -1
  228. package/dist/security/real/vulnerabilityScanner.js +0 -341
  229. package/dist/security/real/vulnerabilityScanner.js.map +0 -1
  230. package/dist/shell/capturePastePatch.d.ts +0 -9
  231. package/dist/shell/capturePastePatch.d.ts.map +0 -1
  232. package/dist/shell/capturePastePatch.js +0 -98
  233. package/dist/shell/capturePastePatch.js.map +0 -1
  234. package/dist/shell/enhancedInteractiveShell.d.ts +0 -90
  235. package/dist/shell/enhancedInteractiveShell.d.ts.map +0 -1
  236. package/dist/shell/enhancedInteractiveShell.js +0 -248
  237. package/dist/shell/enhancedInteractiveShell.js.map +0 -1
  238. package/dist/shell/inputProcessor.d.ts +0 -56
  239. package/dist/shell/inputProcessor.d.ts.map +0 -1
  240. package/dist/shell/inputProcessor.js +0 -172
  241. package/dist/shell/inputProcessor.js.map +0 -1
  242. package/dist/shell/interactiveShell-patch.d.ts +0 -27
  243. package/dist/shell/interactiveShell-patch.d.ts.map +0 -1
  244. package/dist/shell/interactiveShell-patch.js +0 -38
  245. package/dist/shell/interactiveShell-patch.js.map +0 -1
  246. package/dist/shell/interactiveShell-robust.d.ts +0 -26
  247. package/dist/shell/interactiveShell-robust.d.ts.map +0 -1
  248. package/dist/shell/interactiveShell-robust.js +0 -34
  249. package/dist/shell/interactiveShell-robust.js.map +0 -1
  250. package/dist/shell/multiLinePasteManager.d.ts +0 -106
  251. package/dist/shell/multiLinePasteManager.d.ts.map +0 -1
  252. package/dist/shell/multiLinePasteManager.js +0 -308
  253. package/dist/shell/multiLinePasteManager.js.map +0 -1
  254. package/dist/shell/processInputBlockPatch.d.ts +0 -8
  255. package/dist/shell/processInputBlockPatch.d.ts.map +0 -1
  256. package/dist/shell/processInputBlockPatch.js +0 -133
  257. package/dist/shell/processInputBlockPatch.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,28 +0,0 @@
1
- import { AgentHost } from './agentHost.js';
2
- export async function createUniversalRuntime(options) {
3
- const env = options.env ? { ...options.env } : { ...process.env };
4
- const host = new AgentHost({
5
- profile: options.profile,
6
- workspaceContext: options.workspaceContext,
7
- workingDir: options.workingDir,
8
- toolObserver: options.toolObserver,
9
- env,
10
- });
11
- const adapterContext = {
12
- profile: options.profile,
13
- workspaceContext: options.workspaceContext,
14
- workingDir: options.workingDir,
15
- env,
16
- };
17
- const adapterModules = await options.adapter.createCapabilityModules(adapterContext);
18
- const additionalModules = options.additionalModules ?? [];
19
- if (adapterModules.length || additionalModules.length) {
20
- await host.loadModules([...adapterModules, ...additionalModules]);
21
- }
22
- const session = await host.getSession();
23
- return {
24
- host,
25
- session,
26
- adapter: options.adapter,
27
- };
28
- }
@@ -1,236 +0,0 @@
1
- /**
2
- * Skill Repository
3
- *
4
- * Manages skill discovery, loading, and execution.
5
- * Skills are reusable code patterns that can be applied
6
- * across different contexts.
7
- */
8
- import { readFileSync, existsSync, readdirSync, statSync } from 'fs';
9
- import { join, dirname } from 'path';
10
- import { fileURLToPath } from 'url';
11
- // Simple globSync implementation for ESM compatibility
12
- function globSync(_pattern, options) {
13
- const results = [];
14
- function scanDir(dir, relativePath = '') {
15
- try {
16
- const entries = readdirSync(dir);
17
- for (const entry of entries) {
18
- const fullPath = join(dir, entry);
19
- const relPath = relativePath ? `${relativePath}/${entry}` : entry;
20
- try {
21
- const stat = statSync(fullPath);
22
- if (stat.isDirectory()) {
23
- scanDir(fullPath, relPath);
24
- }
25
- else if (entry.endsWith('.skill.json')) {
26
- results.push(relPath);
27
- }
28
- }
29
- catch {
30
- // Skip entries we can't stat
31
- }
32
- }
33
- }
34
- catch {
35
- // Directory doesn't exist or can't be read
36
- }
37
- }
38
- scanDir(options.cwd);
39
- return results;
40
- }
41
- const __filename = fileURLToPath(import.meta.url);
42
- const __dirname = dirname(__filename);
43
- export class SkillRepository {
44
- constructor(_options = {}) {
45
- this.skills = new Map();
46
- this.skillPatterns = new Map();
47
- // Options reserved for future extension (workspace paths, etc.)
48
- this.loadBuiltInSkills();
49
- }
50
- /**
51
- * Load built-in skills from the skills directory
52
- */
53
- loadBuiltInSkills() {
54
- const skillsDir = join(__dirname, '..', '..', 'skills');
55
- if (!existsSync(skillsDir)) {
56
- // Silently skip - skills are optional
57
- return;
58
- }
59
- try {
60
- const skillFiles = globSync('**/*.skill.json', { cwd: skillsDir });
61
- for (const skillFile of skillFiles) {
62
- try {
63
- const skillPath = join(skillsDir, skillFile);
64
- const skillData = JSON.parse(readFileSync(skillPath, 'utf8'));
65
- if (this.validateSkill(skillData)) {
66
- this.skills.set(skillData.id, skillData);
67
- // Compile pattern for matching
68
- if (skillData.implementation.pattern) {
69
- this.skillPatterns.set(skillData.id, new RegExp(skillData.implementation.pattern, 'i'));
70
- }
71
- }
72
- }
73
- catch (error) {
74
- console.warn(`Failed to load skill from ${skillFile}:`, error);
75
- }
76
- }
77
- }
78
- catch (error) {
79
- console.warn('Failed to scan skills directory:', error);
80
- }
81
- }
82
- /**
83
- * Validate skill structure
84
- */
85
- validateSkill(skill) {
86
- return (typeof skill.id === 'string' &&
87
- typeof skill.name === 'string' &&
88
- typeof skill.description === 'string' &&
89
- typeof skill.category === 'string' &&
90
- Array.isArray(skill.tags) &&
91
- Array.isArray(skill.examples) &&
92
- skill.implementation &&
93
- typeof skill.implementation.pattern === 'string');
94
- }
95
- /**
96
- * Get all available skills
97
- */
98
- getAllSkills() {
99
- return Array.from(this.skills.values());
100
- }
101
- /**
102
- * Get skill by ID
103
- */
104
- getSkill(id) {
105
- return this.skills.get(id);
106
- }
107
- /**
108
- * Find skills by category
109
- */
110
- getSkillsByCategory(category) {
111
- return this.getAllSkills().filter(skill => skill.category.toLowerCase() === category.toLowerCase());
112
- }
113
- /**
114
- * Find skills by tag
115
- */
116
- getSkillsByTag(tag) {
117
- return this.getAllSkills().filter(skill => skill.tags.some(t => t.toLowerCase() === tag.toLowerCase()));
118
- }
119
- /**
120
- * Search skills by name or description
121
- */
122
- searchSkills(query) {
123
- const lowerQuery = query.toLowerCase();
124
- return this.getAllSkills().filter(skill => skill.name.toLowerCase().includes(lowerQuery) ||
125
- skill.description.toLowerCase().includes(lowerQuery) ||
126
- skill.tags.some(tag => tag.toLowerCase().includes(lowerQuery)));
127
- }
128
- /**
129
- * Match input against skill patterns
130
- */
131
- matchSkills(input) {
132
- const matches = [];
133
- for (const [skillId, pattern] of this.skillPatterns) {
134
- const skill = this.skills.get(skillId);
135
- if (!skill)
136
- continue;
137
- const match = pattern.exec(input);
138
- if (match) {
139
- // Calculate confidence based on match length and input length
140
- const confidence = Math.min(match[0].length / input.length, 1);
141
- matches.push({ skill, confidence });
142
- }
143
- }
144
- // Sort by confidence (descending)
145
- return matches.sort((a, b) => b.confidence - a.confidence);
146
- }
147
- /**
148
- * Execute a skill
149
- */
150
- async executeSkill(skillId, input) {
151
- const startTime = Date.now();
152
- try {
153
- const skill = this.getSkill(skillId);
154
- if (!skill) {
155
- return {
156
- success: false,
157
- error: `Skill not found: ${skillId}`,
158
- duration: Date.now() - startTime
159
- };
160
- }
161
- let output = input;
162
- // Apply transformation if defined
163
- if (skill.implementation.transform) {
164
- // In a real implementation, this would execute the transformation
165
- // For now, we'll return a placeholder
166
- output = `[Transformed by ${skill.name}] ${JSON.stringify(input)}`;
167
- }
168
- // Apply template if defined
169
- if (skill.implementation.template) {
170
- output = skill.implementation.template.replace('{{input}}', JSON.stringify(input));
171
- }
172
- return {
173
- success: true,
174
- output,
175
- duration: Date.now() - startTime
176
- };
177
- }
178
- catch (error) {
179
- return {
180
- success: false,
181
- error: error instanceof Error ? error.message : String(error),
182
- duration: Date.now() - startTime
183
- };
184
- }
185
- }
186
- /**
187
- * Get skill statistics
188
- */
189
- getStatistics() {
190
- const skills = this.getAllSkills();
191
- const categories = new Set(skills.map(s => s.category));
192
- const tags = new Set(skills.flatMap(s => s.tags));
193
- return {
194
- totalSkills: skills.length,
195
- totalCategories: categories.size,
196
- totalTags: tags.size,
197
- categories: Array.from(categories),
198
- mostCommonTags: this.getMostCommonTags()
199
- };
200
- }
201
- /**
202
- * Get most common tags
203
- */
204
- getMostCommonTags() {
205
- const tagCounts = new Map();
206
- for (const skill of this.getAllSkills()) {
207
- for (const tag of skill.tags) {
208
- tagCounts.set(tag, (tagCounts.get(tag) || 0) + 1);
209
- }
210
- }
211
- return Array.from(tagCounts.entries())
212
- .map(([tag, count]) => ({ tag, count }))
213
- .sort((a, b) => b.count - a.count)
214
- .slice(0, 10);
215
- }
216
- // Compatibility methods for existing tools
217
- listSkills() {
218
- return this.getAllSkills().map(skill => ({
219
- id: skill.id,
220
- name: skill.name,
221
- description: skill.description,
222
- category: skill.category,
223
- tags: skill.tags
224
- }));
225
- }
226
- refresh() {
227
- // Clear and reload skills
228
- this.skills.clear();
229
- this.skillPatterns.clear();
230
- this.loadBuiltInSkills();
231
- }
232
- }
233
- // ============================================================================
234
- // Default Instance
235
- // ============================================================================
236
- export const skillRepository = new SkillRepository();
@@ -1 +0,0 @@
1
- export {};
@@ -1,269 +0,0 @@
1
- import { randomUUID } from 'node:crypto';
2
- import { mkdir, readFile, writeFile } from 'node:fs/promises';
3
- import { homedir } from 'node:os';
4
- import { join } from 'node:path';
5
- import { createNodeRuntime } from '../runtime/node.js';
6
- import { loadToolSettings } from '../core/preferences.js';
7
- import { buildEnabledToolSet, evaluateToolPermissions } from '../capabilities/toolRegistry.js';
8
- const SUBAGENT_DEFINITIONS = {
9
- 'general-purpose': {
10
- id: 'general-purpose',
11
- label: 'General Purpose',
12
- summary: 'complete research, editing, and implementation tasks end-to-end',
13
- instructions: [
14
- 'Own the entire task autonomously. Narrate your plan, gather context with filesystem/search tools, and make changes when necessary.',
15
- 'Always cite the evidence, commands, and files you touched. Include TODOs or risks that need human review.',
16
- ],
17
- defaultModel: 'sonnet',
18
- },
19
- explore: {
20
- id: 'explore',
21
- label: 'Explore',
22
- summary: 'map the codebase, answer architectural questions, and locate patterns quickly',
23
- instructions: [
24
- 'Prioritize read/search/glob tools before editing. Call out every directory or file you investigated.',
25
- 'Return a crisp summary of what you learned plus direct file references so the parent agent can follow up.',
26
- ],
27
- defaultModel: 'haiku',
28
- },
29
- plan: {
30
- id: 'plan',
31
- label: 'Plan',
32
- summary: 'break down complex efforts into actionable steps and identify risks or dependencies',
33
- instructions: [
34
- 'Produce a numbered plan with estimates, dependency notes, and explicit testing checkpoints.',
35
- 'If the task mentions code changes, suggest which files/modules should be edited and why before any implementation occurs.',
36
- ],
37
- defaultModel: 'sonnet',
38
- },
39
- };
40
- const MODEL_ID_LOOKUP = {
41
- sonnet: { provider: 'anthropic', model: 'claude-sonnet-4-5-20250929' },
42
- opus: { provider: 'anthropic', model: 'claude-opus-4.1' },
43
- haiku: { provider: 'anthropic', model: 'claude-haiku-4.5' },
44
- };
45
- const TASK_STORE_DIR = join(homedir(), '.erosolar', 'tasks');
46
- export class TaskRunner {
47
- constructor(context) {
48
- this.snapshots = new TaskSnapshotStore();
49
- this.context = context;
50
- }
51
- async runTask(options) {
52
- const definition = resolveSubAgentDefinition(options.subagentType);
53
- const { allowedPluginIds } = this.resolveToolPermissions();
54
- const adapterOptions = allowedPluginIds.size
55
- ? {
56
- filter: (plugin) => allowedPluginIds.has(plugin.id),
57
- }
58
- : undefined;
59
- const runtime = await createNodeRuntime({
60
- profile: this.context.profile,
61
- workspaceContext: this.context.workspaceContext,
62
- workingDir: this.context.workingDir,
63
- env: this.context.env,
64
- adapterOptions,
65
- });
66
- try {
67
- const session = runtime.session;
68
- const selection = this.buildModelSelection(session.profileConfig, options.model ?? definition.defaultModel);
69
- const systemPrompt = this.composeSystemPrompt(session.profileConfig.systemPrompt, definition, options.description);
70
- let finalMetadata = null;
71
- const agent = session.createAgent({
72
- provider: selection.provider,
73
- model: selection.model,
74
- temperature: selection.temperature,
75
- maxTokens: selection.maxTokens,
76
- systemPrompt,
77
- }, {
78
- onAssistantMessage: (_content, metadata) => {
79
- if (metadata.isFinal) {
80
- finalMetadata = metadata;
81
- }
82
- },
83
- });
84
- const resumeSnapshot = options.resumeId ? await this.snapshots.load(options.resumeId) : null;
85
- if (options.resumeId && !resumeSnapshot) {
86
- throw new Error(`Resume id "${options.resumeId}" was not found. Call Task without resume to start a new agent.`);
87
- }
88
- if (resumeSnapshot) {
89
- agent.loadHistory(resumeSnapshot.history);
90
- }
91
- const startedAt = Date.now();
92
- const reply = await agent.send(options.prompt, false);
93
- const durationMs = Date.now() - startedAt;
94
- const history = agent.getHistory();
95
- const resumeId = options.resumeId ?? this.snapshots.createId();
96
- await this.snapshots.save({
97
- id: resumeId,
98
- profile: this.context.profile,
99
- description: options.description,
100
- subagentType: definition.id,
101
- history,
102
- createdAt: resumeSnapshot?.createdAt ?? new Date().toISOString(),
103
- updatedAt: new Date().toISOString(),
104
- });
105
- const parsed = extractResponseSections(reply);
106
- const usageLine = formatUsage(extractUsage(finalMetadata));
107
- const durationLine = `Duration: ${formatDuration(durationMs)}${usageLine ? ` | ${usageLine}` : ''}`;
108
- const lines = [
109
- `Task "${options.description}" completed by ${definition.label} agent (${selection.model})`,
110
- `${durationLine} | Resume ID: ${resumeId}`,
111
- ];
112
- if (definition.summary) {
113
- lines.push(`Agent focus: ${definition.summary}`);
114
- }
115
- if (parsed.thinking) {
116
- lines.push('', 'Key reasoning:', parsed.thinking);
117
- }
118
- lines.push('', parsed.response || '(no response returned)');
119
- return { output: lines.join('\n').trim() };
120
- }
121
- finally {
122
- await runtime.host.dispose();
123
- }
124
- }
125
- resolveToolPermissions() {
126
- const settings = loadToolSettings();
127
- const selection = buildEnabledToolSet(settings);
128
- const summary = evaluateToolPermissions(selection);
129
- return {
130
- allowedPluginIds: summary.allowedPluginIds,
131
- };
132
- }
133
- buildModelSelection(profile, preferred) {
134
- if (preferred && MODEL_ID_LOOKUP[preferred]) {
135
- const mapping = MODEL_ID_LOOKUP[preferred];
136
- return {
137
- provider: mapping.provider,
138
- model: mapping.model,
139
- temperature: profile.temperature,
140
- maxTokens: profile.maxTokens,
141
- };
142
- }
143
- return {
144
- provider: profile.provider,
145
- model: profile.model,
146
- temperature: profile.temperature,
147
- maxTokens: profile.maxTokens,
148
- };
149
- }
150
- composeSystemPrompt(basePrompt, definition, description) {
151
- const lines = [
152
- basePrompt.trim(),
153
- '',
154
- 'You are an autonomous sub-agent launched via the Task tool. Operate independently and return a single comprehensive report to the parent agent.',
155
- `Task summary: ${description}`,
156
- `Agent specialization: ${definition.summary}`,
157
- '',
158
- 'Execution rules:',
159
- ...definition.instructions.map((line, index) => `${index + 1}. ${line}`),
160
- '',
161
- 'When you finish:',
162
- '- Provide a concise summary with actionable next steps.',
163
- '- Mention any remaining risks, TODOs, or follow-ups.',
164
- '- Include file paths, commands, or test names you touched so the operator can verify your work.',
165
- ];
166
- return lines.join('\n').trim();
167
- }
168
- }
169
- class TaskSnapshotStore {
170
- async load(id) {
171
- try {
172
- const file = join(TASK_STORE_DIR, `${sanitizeId(id)}.json`);
173
- const content = await readFile(file, 'utf8');
174
- const parsed = JSON.parse(content);
175
- if (!parsed || typeof parsed !== 'object') {
176
- return null;
177
- }
178
- return parsed;
179
- }
180
- catch {
181
- return null;
182
- }
183
- }
184
- async save(snapshot) {
185
- await mkdir(TASK_STORE_DIR, { recursive: true });
186
- const normalized = {
187
- ...snapshot,
188
- history: snapshot.history ?? [],
189
- createdAt: snapshot.createdAt,
190
- updatedAt: snapshot.updatedAt,
191
- };
192
- const file = join(TASK_STORE_DIR, `${sanitizeId(snapshot.id)}.json`);
193
- await writeFile(file, JSON.stringify(normalized, null, 2), 'utf8');
194
- }
195
- createId() {
196
- return `task_${randomUUID()}`;
197
- }
198
- }
199
- function resolveSubAgentDefinition(name) {
200
- const normalized = name ? name.trim().toLowerCase() : '';
201
- const candidate = normalized ? SUBAGENT_DEFINITIONS[normalized] : undefined;
202
- if (candidate) {
203
- return candidate;
204
- }
205
- const fallback = SUBAGENT_DEFINITIONS['general-purpose'];
206
- if (!fallback) {
207
- throw new Error('General-purpose subagent definition is missing.');
208
- }
209
- return fallback;
210
- }
211
- function sanitizeId(value) {
212
- return value.replace(/[^a-zA-Z0-9_-]/g, '').slice(0, 64) || 'task';
213
- }
214
- function extractResponseSections(content) {
215
- if (!content) {
216
- return { thinking: null, response: '' };
217
- }
218
- const thinkingMatch = /<thinking>([\s\S]*?)<\/thinking>/i.exec(content);
219
- const responseMatch = /<response>([\s\S]*?)<\/response>/i.exec(content);
220
- const thinking = thinkingMatch?.[1]?.trim() ?? null;
221
- if (responseMatch?.[1]) {
222
- return {
223
- thinking,
224
- response: responseMatch[1].trim(),
225
- };
226
- }
227
- if (thinkingMatch?.[0]) {
228
- const remaining = content.replace(thinkingMatch[0], '').trim();
229
- return {
230
- thinking,
231
- response: remaining,
232
- };
233
- }
234
- return { thinking: null, response: content.trim() };
235
- }
236
- function formatDuration(ms) {
237
- if (!Number.isFinite(ms)) {
238
- return 'unknown duration';
239
- }
240
- if (ms < 1000) {
241
- return `${ms}ms`;
242
- }
243
- const seconds = ms / 1000;
244
- if (seconds < 60) {
245
- return `${seconds.toFixed(1)}s`;
246
- }
247
- const minutes = Math.floor(seconds / 60);
248
- const remaining = Math.round(seconds % 60);
249
- return `${minutes}m ${remaining}s`;
250
- }
251
- function extractUsage(metadata) {
252
- return metadata?.usage ?? null;
253
- }
254
- function formatUsage(usage) {
255
- if (!usage) {
256
- return '';
257
- }
258
- const parts = [];
259
- if (typeof usage.inputTokens === 'number') {
260
- parts.push(`in ${usage.inputTokens}`);
261
- }
262
- if (typeof usage.outputTokens === 'number') {
263
- parts.push(`out ${usage.outputTokens}`);
264
- }
265
- if (!parts.length && typeof usage.totalTokens === 'number') {
266
- parts.push(`total ${usage.totalTokens}`);
267
- }
268
- return parts.length ? `Tokens ${parts.join(' / ')}` : '';
269
- }