erosolar-cli 1.7.335 → 1.7.337

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 (323) hide show
  1. package/README.md +24 -148
  2. package/dist/bin/erosolar.js +5 -21
  3. package/dist/bin/erosolar.js.map +1 -1
  4. package/dist/capabilities/agentSpawningCapability.d.ts.map +1 -1
  5. package/dist/capabilities/agentSpawningCapability.js +56 -31
  6. package/dist/capabilities/agentSpawningCapability.js.map +1 -1
  7. package/dist/contracts/agent-schemas.json +0 -15
  8. package/dist/contracts/tools.schema.json +0 -9
  9. package/dist/core/agent.d.ts +2 -2
  10. package/dist/core/agent.d.ts.map +1 -1
  11. package/dist/core/agent.js.map +1 -1
  12. package/dist/core/customCommands.d.ts +1 -0
  13. package/dist/core/customCommands.d.ts.map +1 -1
  14. package/dist/core/customCommands.js +3 -0
  15. package/dist/core/customCommands.js.map +1 -1
  16. package/dist/core/hooks.d.ts +113 -0
  17. package/dist/core/hooks.d.ts.map +1 -0
  18. package/dist/core/hooks.js +267 -0
  19. package/dist/core/hooks.js.map +1 -0
  20. package/dist/core/metricsTracker.d.ts +122 -0
  21. package/dist/core/metricsTracker.d.ts.map +1 -0
  22. package/dist/{alpha-zero → core}/metricsTracker.js +2 -5
  23. package/dist/core/metricsTracker.js.map +1 -0
  24. package/dist/core/securityAssessment.d.ts +91 -0
  25. package/dist/core/securityAssessment.d.ts.map +1 -0
  26. package/dist/core/securityAssessment.js +580 -0
  27. package/dist/core/securityAssessment.js.map +1 -0
  28. package/dist/core/toolPreconditions.d.ts.map +1 -1
  29. package/dist/core/toolPreconditions.js +0 -14
  30. package/dist/core/toolPreconditions.js.map +1 -1
  31. package/dist/core/toolRuntime.d.ts +22 -1
  32. package/dist/core/toolRuntime.d.ts.map +1 -1
  33. package/dist/core/toolRuntime.js +0 -5
  34. package/dist/core/toolRuntime.js.map +1 -1
  35. package/dist/core/toolValidation.d.ts.map +1 -1
  36. package/dist/core/toolValidation.js +14 -3
  37. package/dist/core/toolValidation.js.map +1 -1
  38. package/dist/core/validationRunner.d.ts +1 -3
  39. package/dist/core/validationRunner.d.ts.map +1 -1
  40. package/dist/core/validationRunner.js.map +1 -1
  41. package/dist/core/verification.d.ts +137 -0
  42. package/dist/core/verification.d.ts.map +1 -0
  43. package/dist/core/verification.js +323 -0
  44. package/dist/core/verification.js.map +1 -0
  45. package/dist/headless/headlessApp.d.ts.map +1 -1
  46. package/dist/headless/headlessApp.js +21 -0
  47. package/dist/headless/headlessApp.js.map +1 -1
  48. package/dist/mcp/sseClient.d.ts.map +1 -1
  49. package/dist/mcp/sseClient.js +9 -18
  50. package/dist/mcp/sseClient.js.map +1 -1
  51. package/dist/plugins/tools/build/buildPlugin.d.ts +0 -6
  52. package/dist/plugins/tools/build/buildPlugin.d.ts.map +1 -1
  53. package/dist/plugins/tools/build/buildPlugin.js +4 -10
  54. package/dist/plugins/tools/build/buildPlugin.js.map +1 -1
  55. package/dist/plugins/tools/nodeDefaults.d.ts.map +1 -1
  56. package/dist/plugins/tools/nodeDefaults.js +0 -2
  57. package/dist/plugins/tools/nodeDefaults.js.map +1 -1
  58. package/dist/runtime/agentSession.d.ts +2 -2
  59. package/dist/runtime/agentSession.d.ts.map +1 -1
  60. package/dist/runtime/agentSession.js +2 -2
  61. package/dist/runtime/agentSession.js.map +1 -1
  62. package/dist/shell/interactiveShell.d.ts +16 -7
  63. package/dist/shell/interactiveShell.d.ts.map +1 -1
  64. package/dist/shell/interactiveShell.js +235 -166
  65. package/dist/shell/interactiveShell.js.map +1 -1
  66. package/dist/shell/shellApp.d.ts +2 -0
  67. package/dist/shell/shellApp.d.ts.map +1 -1
  68. package/dist/shell/shellApp.js +40 -9
  69. package/dist/shell/shellApp.js.map +1 -1
  70. package/dist/shell/systemPrompt.d.ts.map +1 -1
  71. package/dist/shell/systemPrompt.js +1 -4
  72. package/dist/shell/systemPrompt.js.map +1 -1
  73. package/dist/shell/terminalInput.d.ts +149 -118
  74. package/dist/shell/terminalInput.d.ts.map +1 -1
  75. package/dist/shell/terminalInput.js +639 -540
  76. package/dist/shell/terminalInput.js.map +1 -1
  77. package/dist/shell/terminalInputAdapter.d.ts +79 -21
  78. package/dist/shell/terminalInputAdapter.d.ts.map +1 -1
  79. package/dist/shell/terminalInputAdapter.js +99 -30
  80. package/dist/shell/terminalInputAdapter.js.map +1 -1
  81. package/dist/subagents/agentConfig.d.ts +27 -0
  82. package/dist/subagents/agentConfig.d.ts.map +1 -0
  83. package/dist/subagents/agentConfig.js +89 -0
  84. package/dist/subagents/agentConfig.js.map +1 -0
  85. package/dist/subagents/agentRegistry.d.ts +33 -0
  86. package/dist/subagents/agentRegistry.d.ts.map +1 -0
  87. package/dist/subagents/agentRegistry.js +162 -0
  88. package/dist/subagents/agentRegistry.js.map +1 -0
  89. package/dist/subagents/taskRunner.d.ts +7 -1
  90. package/dist/subagents/taskRunner.d.ts.map +1 -1
  91. package/dist/subagents/taskRunner.js +180 -47
  92. package/dist/subagents/taskRunner.js.map +1 -1
  93. package/dist/ui/ShellUIAdapter.d.ts.map +1 -1
  94. package/dist/ui/ShellUIAdapter.js +13 -12
  95. package/dist/ui/ShellUIAdapter.js.map +1 -1
  96. package/dist/ui/display.d.ts +24 -45
  97. package/dist/ui/display.d.ts.map +1 -1
  98. package/dist/ui/display.js +140 -259
  99. package/dist/ui/display.js.map +1 -1
  100. package/dist/ui/theme.d.ts.map +1 -1
  101. package/dist/ui/theme.js +6 -8
  102. package/dist/ui/theme.js.map +1 -1
  103. package/dist/ui/toolDisplay.d.ts +0 -158
  104. package/dist/ui/toolDisplay.d.ts.map +1 -1
  105. package/dist/ui/toolDisplay.js +0 -348
  106. package/dist/ui/toolDisplay.js.map +1 -1
  107. package/dist/ui/unified/layout.d.ts +1 -0
  108. package/dist/ui/unified/layout.d.ts.map +1 -1
  109. package/dist/ui/unified/layout.js +15 -25
  110. package/dist/ui/unified/layout.js.map +1 -1
  111. package/dist/utils/frontmatter.d.ts +10 -0
  112. package/dist/utils/frontmatter.d.ts.map +1 -0
  113. package/dist/utils/frontmatter.js +78 -0
  114. package/dist/utils/frontmatter.js.map +1 -0
  115. package/package.json +4 -4
  116. package/dist/alpha-zero/agentWrapper.d.ts +0 -84
  117. package/dist/alpha-zero/agentWrapper.d.ts.map +0 -1
  118. package/dist/alpha-zero/agentWrapper.js +0 -171
  119. package/dist/alpha-zero/agentWrapper.js.map +0 -1
  120. package/dist/alpha-zero/codeEvaluator.d.ts +0 -25
  121. package/dist/alpha-zero/codeEvaluator.d.ts.map +0 -1
  122. package/dist/alpha-zero/codeEvaluator.js +0 -273
  123. package/dist/alpha-zero/codeEvaluator.js.map +0 -1
  124. package/dist/alpha-zero/competitiveRunner.d.ts +0 -66
  125. package/dist/alpha-zero/competitiveRunner.d.ts.map +0 -1
  126. package/dist/alpha-zero/competitiveRunner.js +0 -224
  127. package/dist/alpha-zero/competitiveRunner.js.map +0 -1
  128. package/dist/alpha-zero/index.d.ts +0 -67
  129. package/dist/alpha-zero/index.d.ts.map +0 -1
  130. package/dist/alpha-zero/index.js +0 -99
  131. package/dist/alpha-zero/index.js.map +0 -1
  132. package/dist/alpha-zero/introspection.d.ts +0 -128
  133. package/dist/alpha-zero/introspection.d.ts.map +0 -1
  134. package/dist/alpha-zero/introspection.js +0 -300
  135. package/dist/alpha-zero/introspection.js.map +0 -1
  136. package/dist/alpha-zero/metricsTracker.d.ts +0 -71
  137. package/dist/alpha-zero/metricsTracker.d.ts.map +0 -1
  138. package/dist/alpha-zero/metricsTracker.js.map +0 -1
  139. package/dist/alpha-zero/security/core.d.ts +0 -125
  140. package/dist/alpha-zero/security/core.d.ts.map +0 -1
  141. package/dist/alpha-zero/security/core.js +0 -271
  142. package/dist/alpha-zero/security/core.js.map +0 -1
  143. package/dist/alpha-zero/security/google.d.ts +0 -125
  144. package/dist/alpha-zero/security/google.d.ts.map +0 -1
  145. package/dist/alpha-zero/security/google.js +0 -311
  146. package/dist/alpha-zero/security/google.js.map +0 -1
  147. package/dist/alpha-zero/security/googleLoader.d.ts +0 -17
  148. package/dist/alpha-zero/security/googleLoader.d.ts.map +0 -1
  149. package/dist/alpha-zero/security/googleLoader.js +0 -41
  150. package/dist/alpha-zero/security/googleLoader.js.map +0 -1
  151. package/dist/alpha-zero/security/index.d.ts +0 -29
  152. package/dist/alpha-zero/security/index.d.ts.map +0 -1
  153. package/dist/alpha-zero/security/index.js +0 -32
  154. package/dist/alpha-zero/security/index.js.map +0 -1
  155. package/dist/alpha-zero/security/simulation.d.ts +0 -124
  156. package/dist/alpha-zero/security/simulation.d.ts.map +0 -1
  157. package/dist/alpha-zero/security/simulation.js +0 -277
  158. package/dist/alpha-zero/security/simulation.js.map +0 -1
  159. package/dist/alpha-zero/selfModification.d.ts +0 -109
  160. package/dist/alpha-zero/selfModification.d.ts.map +0 -1
  161. package/dist/alpha-zero/selfModification.js +0 -233
  162. package/dist/alpha-zero/selfModification.js.map +0 -1
  163. package/dist/alpha-zero/types.d.ts +0 -170
  164. package/dist/alpha-zero/types.d.ts.map +0 -1
  165. package/dist/alpha-zero/types.js +0 -31
  166. package/dist/alpha-zero/types.js.map +0 -1
  167. package/dist/capabilities/securityTestingCapability.d.ts +0 -13
  168. package/dist/capabilities/securityTestingCapability.d.ts.map +0 -1
  169. package/dist/capabilities/securityTestingCapability.js +0 -25
  170. package/dist/capabilities/securityTestingCapability.js.map +0 -1
  171. package/dist/core/aiFlowOptimizer.d.ts +0 -26
  172. package/dist/core/aiFlowOptimizer.d.ts.map +0 -1
  173. package/dist/core/aiFlowOptimizer.js +0 -31
  174. package/dist/core/aiFlowOptimizer.js.map +0 -1
  175. package/dist/core/aiOptimizationEngine.d.ts +0 -158
  176. package/dist/core/aiOptimizationEngine.d.ts.map +0 -1
  177. package/dist/core/aiOptimizationEngine.js +0 -428
  178. package/dist/core/aiOptimizationEngine.js.map +0 -1
  179. package/dist/core/aiOptimizationIntegration.d.ts +0 -93
  180. package/dist/core/aiOptimizationIntegration.d.ts.map +0 -1
  181. package/dist/core/aiOptimizationIntegration.js +0 -250
  182. package/dist/core/aiOptimizationIntegration.js.map +0 -1
  183. package/dist/core/enhancedErrorRecovery.d.ts +0 -100
  184. package/dist/core/enhancedErrorRecovery.d.ts.map +0 -1
  185. package/dist/core/enhancedErrorRecovery.js +0 -345
  186. package/dist/core/enhancedErrorRecovery.js.map +0 -1
  187. package/dist/core/hooksSystem.d.ts +0 -65
  188. package/dist/core/hooksSystem.d.ts.map +0 -1
  189. package/dist/core/hooksSystem.js +0 -273
  190. package/dist/core/hooksSystem.js.map +0 -1
  191. package/dist/core/memorySystem.d.ts +0 -48
  192. package/dist/core/memorySystem.d.ts.map +0 -1
  193. package/dist/core/memorySystem.js +0 -271
  194. package/dist/core/memorySystem.js.map +0 -1
  195. package/dist/core/unified/errors.d.ts +0 -189
  196. package/dist/core/unified/errors.d.ts.map +0 -1
  197. package/dist/core/unified/errors.js +0 -497
  198. package/dist/core/unified/errors.js.map +0 -1
  199. package/dist/core/unified/index.d.ts +0 -19
  200. package/dist/core/unified/index.d.ts.map +0 -1
  201. package/dist/core/unified/index.js +0 -68
  202. package/dist/core/unified/index.js.map +0 -1
  203. package/dist/core/unified/schema.d.ts +0 -101
  204. package/dist/core/unified/schema.d.ts.map +0 -1
  205. package/dist/core/unified/schema.js +0 -350
  206. package/dist/core/unified/schema.js.map +0 -1
  207. package/dist/core/unified/toolRuntime.d.ts +0 -179
  208. package/dist/core/unified/toolRuntime.d.ts.map +0 -1
  209. package/dist/core/unified/toolRuntime.js +0 -517
  210. package/dist/core/unified/toolRuntime.js.map +0 -1
  211. package/dist/core/unified/tools.d.ts +0 -127
  212. package/dist/core/unified/tools.d.ts.map +0 -1
  213. package/dist/core/unified/tools.js +0 -1333
  214. package/dist/core/unified/tools.js.map +0 -1
  215. package/dist/core/unified/types.d.ts +0 -352
  216. package/dist/core/unified/types.d.ts.map +0 -1
  217. package/dist/core/unified/types.js +0 -12
  218. package/dist/core/unified/types.js.map +0 -1
  219. package/dist/core/unified/version.d.ts +0 -209
  220. package/dist/core/unified/version.d.ts.map +0 -1
  221. package/dist/core/unified/version.js +0 -454
  222. package/dist/core/unified/version.js.map +0 -1
  223. package/dist/plugins/tools/security/securityPlugin.d.ts +0 -3
  224. package/dist/plugins/tools/security/securityPlugin.d.ts.map +0 -1
  225. package/dist/plugins/tools/security/securityPlugin.js +0 -12
  226. package/dist/plugins/tools/security/securityPlugin.js.map +0 -1
  227. package/dist/security/active-stack-security.d.ts +0 -112
  228. package/dist/security/active-stack-security.d.ts.map +0 -1
  229. package/dist/security/active-stack-security.js +0 -296
  230. package/dist/security/active-stack-security.js.map +0 -1
  231. package/dist/security/advanced-persistence-research.d.ts +0 -92
  232. package/dist/security/advanced-persistence-research.d.ts.map +0 -1
  233. package/dist/security/advanced-persistence-research.js +0 -195
  234. package/dist/security/advanced-persistence-research.js.map +0 -1
  235. package/dist/security/advanced-targeting.d.ts +0 -119
  236. package/dist/security/advanced-targeting.d.ts.map +0 -1
  237. package/dist/security/advanced-targeting.js +0 -233
  238. package/dist/security/advanced-targeting.js.map +0 -1
  239. package/dist/security/assessment/vulnerabilityAssessment.d.ts +0 -104
  240. package/dist/security/assessment/vulnerabilityAssessment.d.ts.map +0 -1
  241. package/dist/security/assessment/vulnerabilityAssessment.js +0 -315
  242. package/dist/security/assessment/vulnerabilityAssessment.js.map +0 -1
  243. package/dist/security/authorization/securityAuthorization.d.ts +0 -88
  244. package/dist/security/authorization/securityAuthorization.d.ts.map +0 -1
  245. package/dist/security/authorization/securityAuthorization.js +0 -172
  246. package/dist/security/authorization/securityAuthorization.js.map +0 -1
  247. package/dist/security/comprehensive-targeting.d.ts +0 -85
  248. package/dist/security/comprehensive-targeting.d.ts.map +0 -1
  249. package/dist/security/comprehensive-targeting.js +0 -438
  250. package/dist/security/comprehensive-targeting.js.map +0 -1
  251. package/dist/security/global-security-integration.d.ts +0 -91
  252. package/dist/security/global-security-integration.d.ts.map +0 -1
  253. package/dist/security/global-security-integration.js +0 -218
  254. package/dist/security/global-security-integration.js.map +0 -1
  255. package/dist/security/index.d.ts +0 -38
  256. package/dist/security/index.d.ts.map +0 -1
  257. package/dist/security/index.js +0 -47
  258. package/dist/security/index.js.map +0 -1
  259. package/dist/security/persistence-analyzer.d.ts +0 -56
  260. package/dist/security/persistence-analyzer.d.ts.map +0 -1
  261. package/dist/security/persistence-analyzer.js +0 -187
  262. package/dist/security/persistence-analyzer.js.map +0 -1
  263. package/dist/security/persistence-cli.d.ts +0 -36
  264. package/dist/security/persistence-cli.d.ts.map +0 -1
  265. package/dist/security/persistence-cli.js +0 -160
  266. package/dist/security/persistence-cli.js.map +0 -1
  267. package/dist/security/persistence-research.d.ts +0 -92
  268. package/dist/security/persistence-research.d.ts.map +0 -1
  269. package/dist/security/persistence-research.js +0 -364
  270. package/dist/security/persistence-research.js.map +0 -1
  271. package/dist/security/research/persistenceResearch.d.ts +0 -97
  272. package/dist/security/research/persistenceResearch.d.ts.map +0 -1
  273. package/dist/security/research/persistenceResearch.js +0 -282
  274. package/dist/security/research/persistenceResearch.js.map +0 -1
  275. package/dist/security/security-integration.d.ts +0 -74
  276. package/dist/security/security-integration.d.ts.map +0 -1
  277. package/dist/security/security-integration.js +0 -137
  278. package/dist/security/security-integration.js.map +0 -1
  279. package/dist/security/security-testing-framework.d.ts +0 -112
  280. package/dist/security/security-testing-framework.d.ts.map +0 -1
  281. package/dist/security/security-testing-framework.js +0 -364
  282. package/dist/security/security-testing-framework.js.map +0 -1
  283. package/dist/security/simulation/attackSimulation.d.ts +0 -93
  284. package/dist/security/simulation/attackSimulation.d.ts.map +0 -1
  285. package/dist/security/simulation/attackSimulation.js +0 -341
  286. package/dist/security/simulation/attackSimulation.js.map +0 -1
  287. package/dist/security/strategic-operations.d.ts +0 -100
  288. package/dist/security/strategic-operations.d.ts.map +0 -1
  289. package/dist/security/strategic-operations.js +0 -276
  290. package/dist/security/strategic-operations.js.map +0 -1
  291. package/dist/security/tool-security-wrapper.d.ts +0 -58
  292. package/dist/security/tool-security-wrapper.d.ts.map +0 -1
  293. package/dist/security/tool-security-wrapper.js +0 -156
  294. package/dist/security/tool-security-wrapper.js.map +0 -1
  295. package/dist/shell/claudeCodeStreamHandler.d.ts +0 -145
  296. package/dist/shell/claudeCodeStreamHandler.d.ts.map +0 -1
  297. package/dist/shell/claudeCodeStreamHandler.js +0 -322
  298. package/dist/shell/claudeCodeStreamHandler.js.map +0 -1
  299. package/dist/shell/inputQueueManager.d.ts +0 -144
  300. package/dist/shell/inputQueueManager.d.ts.map +0 -1
  301. package/dist/shell/inputQueueManager.js +0 -290
  302. package/dist/shell/inputQueueManager.js.map +0 -1
  303. package/dist/shell/metricsTracker.d.ts +0 -60
  304. package/dist/shell/metricsTracker.d.ts.map +0 -1
  305. package/dist/shell/metricsTracker.js +0 -119
  306. package/dist/shell/metricsTracker.js.map +0 -1
  307. package/dist/shell/streamingOutputManager.d.ts +0 -115
  308. package/dist/shell/streamingOutputManager.d.ts.map +0 -1
  309. package/dist/shell/streamingOutputManager.js +0 -225
  310. package/dist/shell/streamingOutputManager.js.map +0 -1
  311. package/dist/tools/securityTools.d.ts +0 -22
  312. package/dist/tools/securityTools.d.ts.map +0 -1
  313. package/dist/tools/securityTools.js +0 -448
  314. package/dist/tools/securityTools.js.map +0 -1
  315. package/dist/ui/persistentPrompt.d.ts +0 -50
  316. package/dist/ui/persistentPrompt.d.ts.map +0 -1
  317. package/dist/ui/persistentPrompt.js +0 -92
  318. package/dist/ui/persistentPrompt.js.map +0 -1
  319. package/dist/ui/terminalUISchema.d.ts +0 -195
  320. package/dist/ui/terminalUISchema.d.ts.map +0 -1
  321. package/dist/ui/terminalUISchema.js +0 -113
  322. package/dist/ui/terminalUISchema.js.map +0 -1
  323. package/scripts/deploy-security-capabilities.js +0 -178
@@ -1,273 +0,0 @@
1
- /**
2
- * Hooks System - Event-driven automation for tool execution
3
- *
4
- * Implements a Claude Code-style hooks system that runs shell commands
5
- * in response to tool execution events:
6
- *
7
- * - beforeToolExecution: Runs before any tool starts
8
- * - afterToolExecution: Runs after any tool completes
9
- * - beforeFileEdit: Runs before a file is modified
10
- * - afterFileEdit: Runs after a file is modified
11
- * - beforeBashCommand: Runs before a bash command executes
12
- * - afterBashCommand: Runs after a bash command completes
13
- *
14
- * Hooks are configured in EROSOLAR.md or settings.json
15
- */
16
- import { exec } from 'node:child_process';
17
- import { existsSync, readFileSync } from 'node:fs';
18
- import { join } from 'node:path';
19
- import { homedir } from 'node:os';
20
- import { promisify } from 'node:util';
21
- const execAsync = promisify(exec);
22
- const DEFAULT_HOOK_TIMEOUT = 30000; // 30 seconds
23
- /**
24
- * Load hooks from EROSOLAR.md or settings.json
25
- */
26
- export function loadHooks(workingDir) {
27
- const configs = loadHooksConfigs(workingDir);
28
- return configs.flatMap((c) => c.hooks);
29
- }
30
- function loadHooksConfigs(workingDir) {
31
- const configs = [];
32
- // 1. User-level hooks from ~/.erosolar/hooks.json
33
- const userHooksPath = join(homedir(), '.erosolar', 'hooks.json');
34
- if (existsSync(userHooksPath)) {
35
- const hooks = tryLoadHooksJson(userHooksPath);
36
- if (hooks.length > 0) {
37
- configs.push({ hooks, source: userHooksPath });
38
- }
39
- }
40
- // 2. Project-level hooks from .erosolar/hooks.json
41
- const projectHooksPath = join(workingDir, '.erosolar', 'hooks.json');
42
- if (existsSync(projectHooksPath)) {
43
- const hooks = tryLoadHooksJson(projectHooksPath);
44
- if (hooks.length > 0) {
45
- configs.push({ hooks, source: projectHooksPath });
46
- }
47
- }
48
- // 3. Parse hooks from EROSOLAR.md YAML frontmatter
49
- const memoryPaths = [
50
- join(workingDir, 'EROSOLAR.md'),
51
- join(workingDir, '.erosolar', 'EROSOLAR.md'),
52
- ];
53
- for (const memoryPath of memoryPaths) {
54
- if (existsSync(memoryPath)) {
55
- const hooks = tryParseHooksFromMarkdown(memoryPath);
56
- if (hooks.length > 0) {
57
- configs.push({ hooks, source: memoryPath });
58
- }
59
- }
60
- }
61
- return configs;
62
- }
63
- function tryLoadHooksJson(filePath) {
64
- try {
65
- const content = readFileSync(filePath, 'utf-8');
66
- const parsed = JSON.parse(content);
67
- if (Array.isArray(parsed)) {
68
- return parsed.filter(isValidHook);
69
- }
70
- if (parsed.hooks && Array.isArray(parsed.hooks)) {
71
- return parsed.hooks.filter(isValidHook);
72
- }
73
- return [];
74
- }
75
- catch {
76
- return [];
77
- }
78
- }
79
- function tryParseHooksFromMarkdown(filePath) {
80
- try {
81
- const content = readFileSync(filePath, 'utf-8');
82
- // Look for hooks in YAML-like format within the markdown
83
- const hooksMatch = content.match(/```(?:yaml|yml)?\nhooks:\s*\n([\s\S]*?)```/);
84
- if (!hooksMatch) {
85
- return [];
86
- }
87
- // Simple YAML-like parsing for hooks
88
- const hooksYaml = hooksMatch[1] ?? '';
89
- const hooks = [];
90
- let currentHook = null;
91
- let inThenBlock = false;
92
- const thenCommands = [];
93
- for (const line of hooksYaml.split('\n')) {
94
- const trimmed = line.trim();
95
- if (trimmed.startsWith('- when:')) {
96
- // Save previous hook
97
- if (currentHook && currentHook.when) {
98
- if (thenCommands.length > 0) {
99
- currentHook.then = [...thenCommands];
100
- }
101
- if (currentHook.then && currentHook.then.length > 0) {
102
- hooks.push(currentHook);
103
- }
104
- }
105
- // Start new hook
106
- const whenValue = trimmed.replace('- when:', '').trim().replace(/['"]/g, '');
107
- currentHook = { when: whenValue };
108
- thenCommands.length = 0;
109
- inThenBlock = false;
110
- }
111
- else if (trimmed.startsWith('if:') && currentHook) {
112
- currentHook.if = trimmed.replace('if:', '').trim().replace(/['"]/g, '');
113
- }
114
- else if (trimmed.startsWith('then:')) {
115
- inThenBlock = true;
116
- }
117
- else if (inThenBlock && trimmed.startsWith('- ')) {
118
- const cmd = trimmed.slice(2).replace(/['"]/g, '');
119
- thenCommands.push(cmd);
120
- }
121
- else if (trimmed.startsWith('timeout:') && currentHook) {
122
- const timeout = parseInt(trimmed.replace('timeout:', '').trim(), 10);
123
- if (!isNaN(timeout)) {
124
- currentHook.timeout = timeout;
125
- }
126
- }
127
- }
128
- // Save last hook
129
- if (currentHook && currentHook.when) {
130
- if (thenCommands.length > 0) {
131
- currentHook.then = [...thenCommands];
132
- }
133
- if (currentHook.then && currentHook.then.length > 0) {
134
- hooks.push(currentHook);
135
- }
136
- }
137
- return hooks;
138
- }
139
- catch {
140
- return [];
141
- }
142
- }
143
- function isValidHook(hook) {
144
- if (!hook || typeof hook !== 'object') {
145
- return false;
146
- }
147
- const h = hook;
148
- const when = h['when'];
149
- const then = h['then'];
150
- return (typeof when === 'string' &&
151
- Array.isArray(then) &&
152
- then.length > 0 &&
153
- then.every((cmd) => typeof cmd === 'string'));
154
- }
155
- /**
156
- * Match a condition against context
157
- */
158
- function matchCondition(condition, context) {
159
- if (!condition) {
160
- return true; // No condition means always match
161
- }
162
- // Match tool name
163
- if (context.tool && context.tool.toLowerCase().includes(condition.toLowerCase())) {
164
- return true;
165
- }
166
- // Match file pattern (simple glob)
167
- if (context.file) {
168
- if (condition.includes('*')) {
169
- const regex = new RegExp('^' + condition.replace(/\./g, '\\.').replace(/\*\*/g, '.*').replace(/\*/g, '[^/]*') + '$');
170
- return regex.test(context.file);
171
- }
172
- return context.file.includes(condition);
173
- }
174
- // Match command pattern
175
- if (context.command && context.command.includes(condition)) {
176
- return true;
177
- }
178
- return false;
179
- }
180
- /**
181
- * Execute a hook's commands
182
- */
183
- async function executeHookCommands(hook, context) {
184
- const output = [];
185
- const errors = [];
186
- let abort = false;
187
- const timeout = hook.timeout ?? DEFAULT_HOOK_TIMEOUT;
188
- for (const command of hook.then) {
189
- // Handle special commands
190
- if (command.toLowerCase() === 'abort') {
191
- abort = true;
192
- continue;
193
- }
194
- if (command.toLowerCase().startsWith('message:')) {
195
- output.push(command.slice(8).trim());
196
- continue;
197
- }
198
- // Execute shell command
199
- try {
200
- const controller = new AbortController();
201
- const timeoutId = setTimeout(() => controller.abort(), timeout);
202
- const { stdout, stderr } = await execAsync(command, {
203
- cwd: context.workingDir,
204
- timeout,
205
- signal: controller.signal,
206
- env: {
207
- ...process.env,
208
- EROSOLAR_TOOL: context.tool ?? '',
209
- EROSOLAR_FILE: context.file ?? '',
210
- EROSOLAR_COMMAND: context.command ?? '',
211
- },
212
- });
213
- clearTimeout(timeoutId);
214
- if (stdout.trim()) {
215
- output.push(stdout.trim());
216
- }
217
- if (stderr.trim()) {
218
- errors.push(stderr.trim());
219
- }
220
- }
221
- catch (error) {
222
- const errMsg = error instanceof Error ? error.message : String(error);
223
- errors.push(`Hook command failed: ${command}\n${errMsg}`);
224
- }
225
- }
226
- return { output, errors, abort };
227
- }
228
- /**
229
- * Run hooks for a specific trigger
230
- */
231
- export async function runHooks(trigger, context, hooks) {
232
- const allHooks = hooks ?? loadHooks(context.workingDir);
233
- const matchingHooks = allHooks.filter((hook) => hook.when === trigger && matchCondition(hook.if, context));
234
- if (matchingHooks.length === 0) {
235
- return { triggered: false, output: [], errors: [], abort: false };
236
- }
237
- const result = {
238
- triggered: true,
239
- output: [],
240
- errors: [],
241
- abort: false,
242
- };
243
- for (const hook of matchingHooks) {
244
- const { output, errors, abort } = await executeHookCommands(hook, context);
245
- result.output.push(...output);
246
- result.errors.push(...errors);
247
- if (abort) {
248
- result.abort = true;
249
- break; // Stop processing if abort is requested
250
- }
251
- }
252
- return result;
253
- }
254
- /**
255
- * Create a hooks runner bound to a specific working directory
256
- */
257
- export function createHooksRunner(workingDir) {
258
- let cachedHooks = null;
259
- const getHooks = () => {
260
- if (cachedHooks === null) {
261
- cachedHooks = loadHooks(workingDir);
262
- }
263
- return cachedHooks;
264
- };
265
- return {
266
- runBefore: (trigger, context) => runHooks(trigger, { ...context, workingDir }, getHooks()),
267
- runAfter: (trigger, context) => runHooks(trigger, { ...context, workingDir }, getHooks()),
268
- reload: () => {
269
- cachedHooks = null;
270
- },
271
- };
272
- }
273
- //# sourceMappingURL=hooksSystem.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hooksSystem.js","sourceRoot":"","sources":["../../src/core/hooksSystem.ts"],"names":[],"mappings":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W,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;QACtC,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC;IAEF,OAAO;QACL,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAC9B,QAAQ,CAAC,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,CAAC;QAC3D,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAC7B,QAAQ,CAAC,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,CAAC;QAC3D,MAAM,EAAE,GAAG,EAAE;YACX,WAAW,GAAG,IAAI,CAAC;QACrB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,48 +0,0 @@
1
- /**
2
- * Memory System - Hierarchical persistent memory for AI context
3
- *
4
- * Implements a Claude Code-style memory system that loads persistent context
5
- * from markdown files at multiple levels:
6
- *
7
- * 1. Enterprise Policy: /etc/erosolar/EROSOLAR.md (Linux), managed settings
8
- * 2. User Memory: ~/.erosolar/EROSOLAR.md
9
- * 3. Project Memory: ./EROSOLAR.md or ./.erosolar/EROSOLAR.md
10
- *
11
- * Supports @imports for including external files recursively (max 5 levels).
12
- */
13
- interface MemorySource {
14
- level: 'enterprise' | 'user' | 'project' | 'local';
15
- path: string;
16
- content: string;
17
- }
18
- export interface LoadedMemory {
19
- sources: MemorySource[];
20
- combinedContent: string;
21
- importedPaths: string[];
22
- }
23
- /**
24
- * Load all memory from the hierarchy
25
- */
26
- export declare function loadMemory(workingDir: string): LoadedMemory;
27
- /**
28
- * Get memory content formatted for system prompt injection
29
- */
30
- export declare function getMemoryForPrompt(workingDir: string): string;
31
- /**
32
- * List all memory file paths and their status
33
- */
34
- export declare function listMemoryPaths(workingDir: string): Array<{
35
- level: string;
36
- path: string;
37
- exists: boolean;
38
- }>;
39
- /**
40
- * Get the default path for creating a new project memory file
41
- */
42
- export declare function getDefaultProjectMemoryPath(workingDir: string): string;
43
- /**
44
- * Get the user memory path for editing
45
- */
46
- export declare function getUserMemoryEditPath(): string;
47
- export {};
48
- //# sourceMappingURL=memorySystem.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memorySystem.d.ts","sourceRoot":"","sources":["../../src/core/memorySystem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAUH,UAAU,YAAY;IACpB,KAAK,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAmKD;;GAEG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,YAAY,CA6D3D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAc7D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,KAAK,CAAC;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC,CAmCD;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C"}
@@ -1,271 +0,0 @@
1
- /**
2
- * Memory System - Hierarchical persistent memory for AI context
3
- *
4
- * Implements a Claude Code-style memory system that loads persistent context
5
- * from markdown files at multiple levels:
6
- *
7
- * 1. Enterprise Policy: /etc/erosolar/EROSOLAR.md (Linux), managed settings
8
- * 2. User Memory: ~/.erosolar/EROSOLAR.md
9
- * 3. Project Memory: ./EROSOLAR.md or ./.erosolar/EROSOLAR.md
10
- *
11
- * Supports @imports for including external files recursively (max 5 levels).
12
- */
13
- import { existsSync, readFileSync } from 'node:fs';
14
- import { dirname, isAbsolute, join, resolve } from 'node:path';
15
- import { homedir, platform } from 'node:os';
16
- const MAX_IMPORT_DEPTH = 5;
17
- const MEMORY_FILE_NAMES = ['EROSOLAR.md', 'CLAUDE.md'];
18
- const DATA_DIR_NAME = '.erosolar';
19
- /**
20
- * Get the path to the enterprise policy memory file
21
- */
22
- function getEnterprisePolicyPath() {
23
- const plat = platform();
24
- if (plat === 'darwin') {
25
- return '/Library/Application Support/Erosolar/EROSOLAR.md';
26
- }
27
- if (plat === 'linux') {
28
- return '/etc/erosolar/EROSOLAR.md';
29
- }
30
- if (plat === 'win32') {
31
- const programData = process.env['PROGRAMDATA'] || 'C:\\ProgramData';
32
- return join(programData, 'Erosolar', 'EROSOLAR.md');
33
- }
34
- return null;
35
- }
36
- /**
37
- * Get the path to the user memory file
38
- */
39
- function getUserMemoryPath() {
40
- return join(homedir(), DATA_DIR_NAME, 'EROSOLAR.md');
41
- }
42
- /**
43
- * Find project memory file in the workspace
44
- */
45
- function findProjectMemoryPath(workingDir) {
46
- // Check root level first
47
- for (const name of MEMORY_FILE_NAMES) {
48
- const rootPath = join(workingDir, name);
49
- if (existsSync(rootPath)) {
50
- return rootPath;
51
- }
52
- }
53
- // Check .erosolar directory
54
- for (const name of MEMORY_FILE_NAMES) {
55
- const nestedPath = join(workingDir, DATA_DIR_NAME, name);
56
- if (existsSync(nestedPath)) {
57
- return nestedPath;
58
- }
59
- }
60
- // Check .claude directory for compatibility
61
- for (const name of MEMORY_FILE_NAMES) {
62
- const claudePath = join(workingDir, '.claude', name);
63
- if (existsSync(claudePath)) {
64
- return claudePath;
65
- }
66
- }
67
- return null;
68
- }
69
- /**
70
- * Parse @imports from a memory file content
71
- */
72
- function parseImports(content) {
73
- const imports = [];
74
- const lines = content.split('\n');
75
- for (const line of lines) {
76
- const trimmed = line.trim();
77
- // Match @path/to/file.md or @~/path/to/file.md
78
- if (trimmed.startsWith('@') && !trimmed.startsWith('@{')) {
79
- const importPath = trimmed.slice(1).trim();
80
- if (importPath) {
81
- imports.push(importPath);
82
- }
83
- }
84
- }
85
- return imports;
86
- }
87
- /**
88
- * Remove @import lines from content (they're processed, not displayed)
89
- */
90
- function removeImportLines(content) {
91
- return content
92
- .split('\n')
93
- .filter((line) => {
94
- const trimmed = line.trim();
95
- return !trimmed.startsWith('@') || trimmed.startsWith('@{');
96
- })
97
- .join('\n')
98
- .trim();
99
- }
100
- /**
101
- * Resolve an import path relative to the source file
102
- */
103
- function resolveImportPath(importPath, sourceDir) {
104
- // Handle ~ for home directory
105
- if (importPath.startsWith('~/') || importPath.startsWith('~\\')) {
106
- return join(homedir(), importPath.slice(2));
107
- }
108
- // Handle absolute paths
109
- if (isAbsolute(importPath)) {
110
- return importPath;
111
- }
112
- // Relative to source file directory
113
- return resolve(sourceDir, importPath);
114
- }
115
- /**
116
- * Load a memory file and process its imports recursively
117
- */
118
- function loadMemoryFileWithImports(filePath, depth, visitedPaths, importedPaths) {
119
- if (depth > MAX_IMPORT_DEPTH) {
120
- return `<!-- Import depth exceeded (max ${MAX_IMPORT_DEPTH}) for: ${filePath} -->`;
121
- }
122
- const normalizedPath = resolve(filePath);
123
- if (visitedPaths.has(normalizedPath)) {
124
- return `<!-- Circular import detected: ${filePath} -->`;
125
- }
126
- if (!existsSync(filePath)) {
127
- return `<!-- Import not found: ${filePath} -->`;
128
- }
129
- visitedPaths.add(normalizedPath);
130
- importedPaths.push(normalizedPath);
131
- let content;
132
- try {
133
- content = readFileSync(filePath, 'utf-8');
134
- }
135
- catch (error) {
136
- return `<!-- Failed to read: ${filePath} -->`;
137
- }
138
- const sourceDir = dirname(normalizedPath);
139
- const imports = parseImports(content);
140
- // Process imports and replace with their content
141
- let processedContent = removeImportLines(content);
142
- for (const importPath of imports) {
143
- const resolvedPath = resolveImportPath(importPath, sourceDir);
144
- const importedContent = loadMemoryFileWithImports(resolvedPath, depth + 1, visitedPaths, importedPaths);
145
- processedContent += '\n\n' + importedContent;
146
- }
147
- return processedContent.trim();
148
- }
149
- /**
150
- * Load all memory from the hierarchy
151
- */
152
- export function loadMemory(workingDir) {
153
- const sources = [];
154
- const allImportedPaths = [];
155
- const visitedPaths = new Set();
156
- // 1. Enterprise policy (highest priority, but loaded first so it can be overridden)
157
- const enterprisePath = getEnterprisePolicyPath();
158
- if (enterprisePath && existsSync(enterprisePath)) {
159
- const content = loadMemoryFileWithImports(enterprisePath, 0, visitedPaths, allImportedPaths);
160
- if (content.trim()) {
161
- sources.push({
162
- level: 'enterprise',
163
- path: enterprisePath,
164
- content,
165
- });
166
- }
167
- }
168
- // 2. User memory
169
- const userPath = getUserMemoryPath();
170
- if (existsSync(userPath)) {
171
- const content = loadMemoryFileWithImports(userPath, 0, visitedPaths, allImportedPaths);
172
- if (content.trim()) {
173
- sources.push({
174
- level: 'user',
175
- path: userPath,
176
- content,
177
- });
178
- }
179
- }
180
- // 3. Project memory
181
- const projectPath = findProjectMemoryPath(workingDir);
182
- if (projectPath) {
183
- const content = loadMemoryFileWithImports(projectPath, 0, visitedPaths, allImportedPaths);
184
- if (content.trim()) {
185
- sources.push({
186
- level: 'project',
187
- path: projectPath,
188
- content,
189
- });
190
- }
191
- }
192
- // Combine all memory with headers
193
- const sections = [];
194
- for (const source of sources) {
195
- const levelLabel = source.level === 'enterprise'
196
- ? 'Enterprise Policy'
197
- : source.level === 'user'
198
- ? 'User Guidelines'
199
- : 'Project Guidelines';
200
- sections.push(`## ${levelLabel}\n\n${source.content}`);
201
- }
202
- return {
203
- sources,
204
- combinedContent: sections.join('\n\n---\n\n'),
205
- importedPaths: allImportedPaths,
206
- };
207
- }
208
- /**
209
- * Get memory content formatted for system prompt injection
210
- */
211
- export function getMemoryForPrompt(workingDir) {
212
- const memory = loadMemory(workingDir);
213
- if (!memory.combinedContent.trim()) {
214
- return '';
215
- }
216
- return `
217
- <persistent-memory>
218
- The following persistent context has been loaded from memory files.
219
- Follow these guidelines when working in this workspace.
220
-
221
- ${memory.combinedContent}
222
- </persistent-memory>
223
- `;
224
- }
225
- /**
226
- * List all memory file paths and their status
227
- */
228
- export function listMemoryPaths(workingDir) {
229
- const paths = [];
230
- const enterprisePath = getEnterprisePolicyPath();
231
- if (enterprisePath) {
232
- paths.push({
233
- level: 'enterprise',
234
- path: enterprisePath,
235
- exists: existsSync(enterprisePath),
236
- });
237
- }
238
- const userPath = getUserMemoryPath();
239
- paths.push({
240
- level: 'user',
241
- path: userPath,
242
- exists: existsSync(userPath),
243
- });
244
- const projectMemoryLocations = [
245
- join(workingDir, 'EROSOLAR.md'),
246
- join(workingDir, 'CLAUDE.md'),
247
- join(workingDir, DATA_DIR_NAME, 'EROSOLAR.md'),
248
- join(workingDir, '.claude', 'CLAUDE.md'),
249
- ];
250
- for (const path of projectMemoryLocations) {
251
- paths.push({
252
- level: 'project',
253
- path,
254
- exists: existsSync(path),
255
- });
256
- }
257
- return paths;
258
- }
259
- /**
260
- * Get the default path for creating a new project memory file
261
- */
262
- export function getDefaultProjectMemoryPath(workingDir) {
263
- return join(workingDir, 'EROSOLAR.md');
264
- }
265
- /**
266
- * Get the user memory path for editing
267
- */
268
- export function getUserMemoryEditPath() {
269
- return getUserMemoryPath();
270
- }
271
- //# sourceMappingURL=memorySystem.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"memorySystem.js","sourceRoot":"","sources":["../../src/core/memorySystem.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,MAAM,iBAAiB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