erosolar-cli 1.5.2 → 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/security-deployment.json +54 -0
- package/dist/bin/adapters/node/index.js +33 -0
- package/dist/bin/adapters/types.js +1 -0
- package/dist/bin/alpha-zero/agentWrapper.js +165 -0
- package/dist/bin/alpha-zero/codeEvaluator.js +272 -0
- package/dist/bin/alpha-zero/competitiveRunner.js +219 -0
- package/dist/bin/alpha-zero/index.js +98 -0
- package/dist/bin/alpha-zero/introspection.js +298 -0
- package/dist/bin/alpha-zero/metricsTracker.js +207 -0
- package/dist/bin/alpha-zero/security/core.js +269 -0
- package/dist/bin/alpha-zero/security/google.js +308 -0
- package/dist/bin/alpha-zero/security/googleLoader.js +40 -0
- package/dist/bin/alpha-zero/security/index.js +31 -0
- package/dist/bin/alpha-zero/security/simulation.js +274 -0
- package/dist/bin/alpha-zero/selfModification.js +231 -0
- package/dist/bin/alpha-zero/types.js +30 -0
- package/dist/bin/bin/erosolar-optimized.js +205 -0
- package/dist/bin/capabilities/agentSpawningCapability.js +116 -0
- package/dist/bin/capabilities/bashCapability.js +22 -0
- package/dist/bin/capabilities/cloudCapability.js +36 -0
- package/dist/bin/capabilities/codeAnalysisCapability.js +22 -0
- package/dist/bin/capabilities/codeQualityCapability.js +23 -0
- package/dist/bin/capabilities/dependencySecurityCapability.js +22 -0
- package/dist/bin/capabilities/devCapability.js +22 -0
- package/dist/bin/capabilities/editCapability.js +28 -0
- package/dist/bin/capabilities/emailCapability.js +20 -0
- package/dist/bin/capabilities/enhancedGitCapability.js +221 -0
- package/dist/bin/capabilities/filesystemCapability.js +22 -0
- package/dist/bin/capabilities/globCapability.js +28 -0
- package/dist/bin/capabilities/interactionCapability.js +20 -0
- package/dist/bin/capabilities/learnCapability.js +22 -0
- package/dist/bin/capabilities/mcpCapability.js +20 -0
- package/dist/bin/capabilities/notebookCapability.js +28 -0
- package/dist/bin/capabilities/planningCapability.js +27 -0
- package/dist/bin/capabilities/refactoringCapability.js +23 -0
- package/dist/bin/capabilities/repoChecksCapability.js +22 -0
- package/dist/bin/capabilities/searchCapability.js +22 -0
- package/dist/bin/capabilities/skillCapability.js +76 -0
- package/dist/bin/capabilities/taskManagementCapability.js +20 -0
- package/dist/bin/capabilities/testingCapability.js +23 -0
- package/dist/bin/capabilities/toolManifest.js +159 -0
- package/dist/bin/capabilities/toolRegistry.js +114 -0
- package/dist/bin/capabilities/webCapability.js +20 -0
- package/dist/bin/config.js +139 -0
- package/dist/bin/contracts/v1/agent.js +7 -0
- package/dist/bin/contracts/v1/agentProfileManifest.js +8 -0
- package/dist/bin/contracts/v1/agentRules.js +9 -0
- package/dist/bin/contracts/v1/toolAccess.js +8 -0
- package/dist/bin/core/agent.js +362 -0
- package/dist/bin/core/agentProfileManifest.js +187 -0
- package/dist/bin/core/agentProfiles.js +34 -0
- package/dist/bin/core/agentRulebook.js +135 -0
- package/dist/bin/core/agentSchemaLoader.js +233 -0
- package/dist/bin/core/contextManager.js +412 -0
- package/dist/bin/core/contextWindow.js +122 -0
- package/dist/bin/core/customCommands.js +80 -0
- package/dist/bin/core/errors/apiKeyErrors.js +114 -0
- package/dist/bin/core/errors/errorTypes.js +340 -0
- package/dist/bin/core/errors/safetyValidator.js +304 -0
- package/dist/bin/core/errors.js +32 -0
- package/dist/bin/core/modelDiscovery.js +755 -0
- package/dist/bin/core/preferences.js +224 -0
- package/dist/bin/core/schemaValidator.js +92 -0
- package/dist/bin/core/secretStore.js +199 -0
- package/dist/bin/core/sessionStore.js +187 -0
- package/dist/bin/core/toolRuntime.js +290 -0
- package/dist/bin/core/types.js +1 -0
- package/dist/bin/erosolar-optimized.d.ts +12 -0
- package/dist/bin/erosolar-optimized.d.ts.map +1 -0
- package/dist/bin/erosolar-optimized.js +239 -0
- package/dist/bin/erosolar-optimized.js.map +1 -0
- package/dist/bin/erosolar.js +14 -0
- package/dist/bin/erosolar.js.map +1 -1
- package/dist/bin/headless/headlessApp.js +172 -0
- package/dist/bin/mcp/config.js +202 -0
- package/dist/bin/mcp/stdioClient.js +172 -0
- package/dist/bin/mcp/toolBridge.js +104 -0
- package/dist/bin/mcp/types.js +1 -0
- package/dist/bin/plugins/index.js +113 -0
- package/dist/bin/plugins/providers/anthropic/index.js +25 -0
- package/dist/bin/plugins/providers/deepseek/index.js +24 -0
- package/dist/bin/plugins/providers/google/index.js +26 -0
- package/dist/bin/plugins/providers/index.js +19 -0
- package/dist/bin/plugins/providers/ollama/index.js +59 -0
- package/dist/bin/plugins/providers/openai/index.js +26 -0
- package/dist/bin/plugins/providers/xai/index.js +24 -0
- package/dist/bin/plugins/tools/agentSpawning/agentSpawningPlugin.js +8 -0
- package/dist/bin/plugins/tools/bash/localBashPlugin.js +13 -0
- package/dist/bin/plugins/tools/checks/localRepoChecksPlugin.js +13 -0
- package/dist/bin/plugins/tools/cloud/cloudPlugin.js +13 -0
- package/dist/bin/plugins/tools/codeAnalysis/codeAnalysisPlugin.js +13 -0
- package/dist/bin/plugins/tools/codeQuality/codeQualityPlugin.js +13 -0
- package/dist/bin/plugins/tools/dependency/dependencyPlugin.js +11 -0
- package/dist/bin/plugins/tools/development/devPlugin.js +13 -0
- package/dist/bin/plugins/tools/edit/editPlugin.js +14 -0
- package/dist/bin/plugins/tools/email/emailPlugin.js +11 -0
- package/dist/bin/plugins/tools/enhancedGit/enhancedGitPlugin.js +8 -0
- package/dist/bin/plugins/tools/filesystem/localFilesystemPlugin.js +13 -0
- package/dist/bin/plugins/tools/glob/globPlugin.js +14 -0
- package/dist/bin/plugins/tools/index.js +2 -0
- package/dist/bin/plugins/tools/interaction/interactionPlugin.js +11 -0
- package/dist/bin/plugins/tools/learn/learnPlugin.js +13 -0
- package/dist/bin/plugins/tools/mcp/mcpPlugin.js +8 -0
- package/dist/bin/plugins/tools/nodeDefaults.js +56 -0
- package/dist/bin/plugins/tools/notebook/notebookPlugin.js +14 -0
- package/dist/bin/plugins/tools/planning/planningPlugin.js +14 -0
- package/dist/bin/plugins/tools/refactoring/refactoringPlugin.js +11 -0
- package/dist/bin/plugins/tools/registry.js +57 -0
- package/dist/bin/plugins/tools/search/localSearchPlugin.js +13 -0
- package/dist/bin/plugins/tools/skills/skillPlugin.js +8 -0
- package/dist/bin/plugins/tools/taskManagement/taskManagementPlugin.js +11 -0
- package/dist/bin/plugins/tools/testing/testingPlugin.js +11 -0
- package/dist/bin/plugins/tools/web/webPlugin.js +11 -0
- package/dist/bin/providers/anthropicProvider.js +329 -0
- package/dist/bin/providers/googleProvider.js +203 -0
- package/dist/bin/providers/openaiChatCompletionsProvider.js +208 -0
- package/dist/bin/providers/openaiResponsesProvider.js +249 -0
- package/dist/bin/providers/providerFactory.js +24 -0
- package/dist/bin/runtime/agentController.js +321 -0
- package/dist/bin/runtime/agentHost.js +153 -0
- package/dist/bin/runtime/agentSession.js +195 -0
- package/dist/bin/runtime/node.js +10 -0
- package/dist/bin/runtime/universal.js +28 -0
- package/dist/bin/shell/bracketedPasteManager.js +350 -0
- package/dist/bin/shell/fileChangeTracker.js +65 -0
- package/dist/bin/shell/interactiveShell.js +2908 -0
- package/dist/bin/shell/liveStatus.js +78 -0
- package/dist/bin/shell/shellApp.js +290 -0
- package/dist/bin/shell/systemPrompt.js +60 -0
- package/dist/bin/shell/updateManager.js +108 -0
- package/dist/bin/skills/skillRepository.js +236 -0
- package/dist/bin/skills/types.js +1 -0
- package/dist/bin/subagents/taskRunner.js +269 -0
- package/dist/bin/tools/backgroundBashTools.js +211 -0
- package/dist/bin/tools/bashTools.js +159 -0
- package/dist/bin/tools/cloudTools.js +864 -0
- package/dist/bin/tools/codeAnalysisTools.js +641 -0
- package/dist/bin/tools/codeQualityTools.js +294 -0
- package/dist/bin/tools/dependencyTools.js +282 -0
- package/dist/bin/tools/devTools.js +238 -0
- package/dist/bin/tools/diffUtils.js +137 -0
- package/dist/bin/tools/editTools.js +134 -0
- package/dist/bin/tools/emailTools.js +448 -0
- package/dist/bin/tools/fileTools.js +282 -0
- package/dist/bin/tools/globTools.js +173 -0
- package/dist/bin/tools/grepTools.js +332 -0
- package/dist/bin/tools/interactionTools.js +170 -0
- package/dist/bin/tools/learnTools.js +1818 -0
- package/dist/bin/tools/notebookEditTools.js +196 -0
- package/dist/bin/tools/planningTools.js +46 -0
- package/dist/bin/tools/refactoringTools.js +293 -0
- package/dist/bin/tools/repoChecksTools.js +160 -0
- package/dist/bin/tools/searchTools.js +206 -0
- package/dist/bin/tools/skillTools.js +177 -0
- package/dist/bin/tools/taskManagementTools.js +156 -0
- package/dist/bin/tools/testingTools.js +232 -0
- package/dist/bin/tools/webTools.js +480 -0
- package/dist/bin/ui/ShellUIAdapter.js +459 -0
- package/dist/bin/ui/UnifiedUIController.js +183 -0
- package/dist/bin/ui/animation/AnimationScheduler.js +430 -0
- package/dist/bin/ui/codeHighlighter.js +854 -0
- package/dist/bin/ui/designSystem.js +121 -0
- package/dist/bin/ui/display.js +1222 -0
- package/dist/bin/ui/interrupts/InterruptManager.js +437 -0
- package/dist/bin/ui/layout.js +139 -0
- package/dist/bin/ui/orchestration/StatusOrchestrator.js +403 -0
- package/dist/bin/ui/outputMode.js +38 -0
- package/dist/bin/ui/persistentPrompt.js +183 -0
- package/dist/bin/ui/richText.js +338 -0
- package/dist/bin/ui/shortcutsHelp.js +87 -0
- package/dist/bin/ui/telemetry/UITelemetry.js +443 -0
- package/dist/bin/ui/textHighlighter.js +210 -0
- package/dist/bin/ui/theme.js +116 -0
- package/dist/bin/ui/toolDisplay.js +423 -0
- package/dist/bin/ui/toolDisplayAdapter.js +357 -0
- package/dist/bin/workspace.js +106 -0
- package/dist/bin/workspace.validator.js +213 -0
- package/dist/capabilities/cloudCapability.d.ts +13 -0
- package/dist/capabilities/cloudCapability.d.ts.map +1 -0
- package/dist/capabilities/cloudCapability.js +38 -0
- package/dist/capabilities/cloudCapability.js.map +1 -0
- package/dist/capabilities/index.d.ts +1 -0
- package/dist/capabilities/index.d.ts.map +1 -1
- package/dist/capabilities/index.js +1 -0
- package/dist/capabilities/index.js.map +1 -1
- package/dist/capabilities/offensiveSecurityCapability.d.ts +26 -0
- package/dist/capabilities/offensiveSecurityCapability.d.ts.map +1 -0
- package/dist/capabilities/offensiveSecurityCapability.js +58 -0
- package/dist/capabilities/offensiveSecurityCapability.js.map +1 -0
- package/dist/capabilities/realSecurityCapability.d.ts +26 -0
- package/dist/capabilities/realSecurityCapability.d.ts.map +1 -0
- package/dist/capabilities/realSecurityCapability.js +53 -0
- package/dist/capabilities/realSecurityCapability.js.map +1 -0
- package/dist/capabilities/securityCapability.d.ts +32 -0
- package/dist/capabilities/securityCapability.d.ts.map +1 -0
- package/dist/capabilities/securityCapability.js +57 -0
- package/dist/capabilities/securityCapability.js.map +1 -0
- package/dist/capabilities/ultimateSecurityCapability.d.ts +42 -0
- package/dist/capabilities/ultimateSecurityCapability.d.ts.map +1 -0
- package/dist/capabilities/ultimateSecurityCapability.js +96 -0
- package/dist/capabilities/ultimateSecurityCapability.js.map +1 -0
- package/dist/core/LazyLoader.d.ts +129 -0
- package/dist/core/LazyLoader.d.ts.map +1 -0
- package/dist/core/LazyLoader.js +240 -0
- package/dist/core/LazyLoader.js.map +1 -0
- package/dist/core/intelligenceTools.d.ts +19 -0
- package/dist/core/intelligenceTools.d.ts.map +1 -0
- package/dist/core/intelligenceTools.js +453 -0
- package/dist/core/intelligenceTools.js.map +1 -0
- package/dist/core/operationalTools.d.ts +19 -0
- package/dist/core/operationalTools.d.ts.map +1 -0
- package/dist/core/operationalTools.js +467 -0
- package/dist/core/operationalTools.js.map +1 -0
- package/dist/offensive/core/offensive-engine.d.ts +171 -0
- package/dist/offensive/core/offensive-engine.d.ts.map +1 -0
- package/dist/offensive/core/offensive-engine.js +345 -0
- package/dist/offensive/core/offensive-engine.js.map +1 -0
- package/dist/offensive/core/offensive-integration.d.ts +129 -0
- package/dist/offensive/core/offensive-integration.d.ts.map +1 -0
- package/dist/offensive/core/offensive-integration.js +364 -0
- package/dist/offensive/core/offensive-integration.js.map +1 -0
- package/dist/offensive/core/offensive-tools.d.ts +55 -0
- package/dist/offensive/core/offensive-tools.d.ts.map +1 -0
- package/dist/offensive/core/offensive-tools.js +438 -0
- package/dist/offensive/core/offensive-tools.js.map +1 -0
- package/dist/offensive/offensive-cli.d.ts +48 -0
- package/dist/offensive/offensive-cli.d.ts.map +1 -0
- package/dist/offensive/offensive-cli.js +233 -0
- package/dist/offensive/offensive-cli.js.map +1 -0
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +2 -0
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/tools/cloud/cloudPlugin.d.ts +3 -0
- package/dist/plugins/tools/cloud/cloudPlugin.d.ts.map +1 -0
- package/dist/plugins/tools/cloud/cloudPlugin.js +14 -0
- package/dist/plugins/tools/cloud/cloudPlugin.js.map +1 -0
- package/dist/plugins/tools/nodeDefaults.d.ts.map +1 -1
- package/dist/plugins/tools/nodeDefaults.js +2 -0
- package/dist/plugins/tools/nodeDefaults.js.map +1 -1
- package/dist/security/advanced-persistence-research.d.ts +92 -0
- package/dist/security/advanced-persistence-research.d.ts.map +1 -0
- package/dist/security/advanced-persistence-research.js +195 -0
- package/dist/security/advanced-persistence-research.js.map +1 -0
- package/dist/security/apt-simulation-cli.d.ts +57 -0
- package/dist/security/apt-simulation-cli.d.ts.map +1 -0
- package/dist/security/apt-simulation-cli.js +278 -0
- package/dist/security/apt-simulation-cli.js.map +1 -0
- package/dist/security/apt-simulation-engine-complete.d.ts +97 -0
- package/dist/security/apt-simulation-engine-complete.d.ts.map +1 -0
- package/dist/security/apt-simulation-engine-complete.js +441 -0
- package/dist/security/apt-simulation-engine-complete.js.map +1 -0
- package/dist/security/apt-simulation-engine.d.ts +97 -0
- package/dist/security/apt-simulation-engine.d.ts.map +1 -0
- package/dist/security/apt-simulation-engine.js +441 -0
- package/dist/security/apt-simulation-engine.js.map +1 -0
- package/dist/security/assessment/vulnerabilityAssessment.d.ts +104 -0
- package/dist/security/assessment/vulnerabilityAssessment.d.ts.map +1 -0
- package/dist/security/assessment/vulnerabilityAssessment.js +315 -0
- package/dist/security/assessment/vulnerabilityAssessment.js.map +1 -0
- package/dist/security/authorization/securityAuthorization.d.ts +88 -0
- package/dist/security/authorization/securityAuthorization.d.ts.map +1 -0
- package/dist/security/authorization/securityAuthorization.js +172 -0
- package/dist/security/authorization/securityAuthorization.js.map +1 -0
- package/dist/security/authorization.d.ts +45 -0
- package/dist/security/authorization.d.ts.map +1 -0
- package/dist/security/authorization.js +128 -0
- package/dist/security/authorization.js.map +1 -0
- package/dist/security/comprehensive-security-research.d.ts +84 -0
- package/dist/security/comprehensive-security-research.d.ts.map +1 -0
- package/dist/security/comprehensive-security-research.js +211 -0
- package/dist/security/comprehensive-security-research.js.map +1 -0
- package/dist/security/offensive/exploitationEngine.d.ts +54 -0
- package/dist/security/offensive/exploitationEngine.d.ts.map +1 -0
- package/dist/security/offensive/exploitationEngine.js +263 -0
- package/dist/security/offensive/exploitationEngine.js.map +1 -0
- package/dist/security/persistence-analyzer.d.ts +56 -0
- package/dist/security/persistence-analyzer.d.ts.map +1 -0
- package/dist/security/persistence-analyzer.js +187 -0
- package/dist/security/persistence-analyzer.js.map +1 -0
- package/dist/security/persistence-cli.d.ts +36 -0
- package/dist/security/persistence-cli.d.ts.map +1 -0
- package/dist/security/persistence-cli.js +160 -0
- package/dist/security/persistence-cli.js.map +1 -0
- package/dist/security/persistence-research.d.ts +100 -0
- package/dist/security/persistence-research.d.ts.map +1 -0
- package/dist/security/persistence-research.js +372 -0
- package/dist/security/persistence-research.js.map +1 -0
- package/dist/security/real/networkExploitation.d.ts +92 -0
- package/dist/security/real/networkExploitation.d.ts.map +1 -0
- package/dist/security/real/networkExploitation.js +316 -0
- package/dist/security/real/networkExploitation.js.map +1 -0
- package/dist/security/real/persistenceImplementation.d.ts +62 -0
- package/dist/security/real/persistenceImplementation.d.ts.map +1 -0
- package/dist/security/real/persistenceImplementation.js +323 -0
- package/dist/security/real/persistenceImplementation.js.map +1 -0
- package/dist/security/real/vulnerabilityScanner.d.ts +73 -0
- package/dist/security/real/vulnerabilityScanner.d.ts.map +1 -0
- package/dist/security/real/vulnerabilityScanner.js +341 -0
- package/dist/security/real/vulnerabilityScanner.js.map +1 -0
- package/dist/security/research/persistenceResearch.d.ts +97 -0
- package/dist/security/research/persistenceResearch.d.ts.map +1 -0
- package/dist/security/research/persistenceResearch.js +282 -0
- package/dist/security/research/persistenceResearch.js.map +1 -0
- package/dist/security/security-testing-framework.d.ts +120 -0
- package/dist/security/security-testing-framework.d.ts.map +1 -0
- package/dist/security/security-testing-framework.js +372 -0
- package/dist/security/security-testing-framework.js.map +1 -0
- package/dist/security/simulation/attackSimulation.d.ts +93 -0
- package/dist/security/simulation/attackSimulation.d.ts.map +1 -0
- package/dist/security/simulation/attackSimulation.js +341 -0
- package/dist/security/simulation/attackSimulation.js.map +1 -0
- package/dist/shell/bracketedPasteManager.d.ts +76 -0
- package/dist/shell/bracketedPasteManager.d.ts.map +1 -1
- package/dist/shell/bracketedPasteManager.js +267 -9
- package/dist/shell/bracketedPasteManager.js.map +1 -1
- package/dist/shell/interactiveShell.d.ts +34 -1
- package/dist/shell/interactiveShell.d.ts.map +1 -1
- package/dist/shell/interactiveShell.js +304 -24
- package/dist/shell/interactiveShell.js.map +1 -1
- package/dist/shell/taskCompletionDetector.d.ts +101 -0
- package/dist/shell/taskCompletionDetector.d.ts.map +1 -0
- package/dist/shell/taskCompletionDetector.js +343 -0
- package/dist/shell/taskCompletionDetector.js.map +1 -0
- package/dist/tools/cloudTools.d.ts +57 -0
- package/dist/tools/cloudTools.d.ts.map +1 -0
- package/dist/tools/cloudTools.js +865 -0
- package/dist/tools/cloudTools.js.map +1 -0
- package/dist/tools/enhancedSecurityTools.d.ts +19 -0
- package/dist/tools/enhancedSecurityTools.d.ts.map +1 -0
- package/dist/tools/enhancedSecurityTools.js +215 -0
- package/dist/tools/enhancedSecurityTools.js.map +1 -0
- package/dist/tools/offensiveSecurityTools.d.ts +16 -0
- package/dist/tools/offensiveSecurityTools.d.ts.map +1 -0
- package/dist/tools/offensiveSecurityTools.js +285 -0
- package/dist/tools/offensiveSecurityTools.js.map +1 -0
- package/dist/tools/realSecurityTools.d.ts +18 -0
- package/dist/tools/realSecurityTools.d.ts.map +1 -0
- package/dist/tools/realSecurityTools.js +468 -0
- package/dist/tools/realSecurityTools.js.map +1 -0
- package/dist/tools/securityTools.d.ts +20 -0
- package/dist/tools/securityTools.d.ts.map +1 -0
- package/dist/tools/securityTools.js +449 -0
- package/dist/tools/securityTools.js.map +1 -0
- package/package.json +27 -12
- package/scripts/deploy-security-capabilities.js +178 -0
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { ToolArgumentValidationError, validateToolArguments, } from './schemaValidator.js';
|
|
2
|
+
// Idempotent tools that can be safely cached
|
|
3
|
+
const CACHEABLE_TOOLS = new Set([
|
|
4
|
+
'Read',
|
|
5
|
+
'read_file',
|
|
6
|
+
'Glob',
|
|
7
|
+
'glob_search',
|
|
8
|
+
'Grep',
|
|
9
|
+
'grep_search',
|
|
10
|
+
'find_definition',
|
|
11
|
+
'analyze_code_quality',
|
|
12
|
+
'extract_exports',
|
|
13
|
+
]);
|
|
14
|
+
export class ToolRuntime {
|
|
15
|
+
constructor(baseTools = [], options = {}) {
|
|
16
|
+
this.registry = new Map();
|
|
17
|
+
this.registrationOrder = [];
|
|
18
|
+
this.cache = new Map();
|
|
19
|
+
this.observer = options.observer ?? null;
|
|
20
|
+
this.contextManager = options.contextManager ?? null;
|
|
21
|
+
this.enableCache = options.enableCache ?? true;
|
|
22
|
+
this.cacheTTLMs = options.cacheTTLMs ?? 5 * 60 * 1000; // 5 minutes default
|
|
23
|
+
if (baseTools.length) {
|
|
24
|
+
this.registerSuite({
|
|
25
|
+
id: 'runtime.core',
|
|
26
|
+
description: 'Core runtime metadata tools',
|
|
27
|
+
tools: baseTools,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
registerSuite(suite) {
|
|
32
|
+
if (!suite?.id?.trim()) {
|
|
33
|
+
throw new Error('Tool suite id cannot be blank.');
|
|
34
|
+
}
|
|
35
|
+
this.unregisterSuite(suite.id);
|
|
36
|
+
for (const definition of suite.tools ?? []) {
|
|
37
|
+
this.addTool(definition, suite.id);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
unregisterSuite(id) {
|
|
41
|
+
if (!id?.trim()) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
for (const [name, record] of this.registry.entries()) {
|
|
45
|
+
if (record.suiteId === id) {
|
|
46
|
+
this.registry.delete(name);
|
|
47
|
+
this.removeFromOrder(name);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
listProviderTools() {
|
|
52
|
+
return this.registrationOrder
|
|
53
|
+
.map((name) => this.registry.get(name))
|
|
54
|
+
.filter((record) => Boolean(record))
|
|
55
|
+
.map(({ definition }) => {
|
|
56
|
+
const tool = {
|
|
57
|
+
name: definition.name,
|
|
58
|
+
description: definition.description,
|
|
59
|
+
};
|
|
60
|
+
if (definition.parameters) {
|
|
61
|
+
tool.parameters = definition.parameters;
|
|
62
|
+
}
|
|
63
|
+
return tool;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
async execute(call) {
|
|
67
|
+
const record = this.registry.get(call.name);
|
|
68
|
+
if (!record) {
|
|
69
|
+
const message = `Tool "${call.name}" is not available.`;
|
|
70
|
+
this.observer?.onToolError?.(call, message);
|
|
71
|
+
return message;
|
|
72
|
+
}
|
|
73
|
+
// Check if tool is cacheable
|
|
74
|
+
const isCacheable = record.definition.cacheable ?? CACHEABLE_TOOLS.has(call.name);
|
|
75
|
+
// Try to get from cache
|
|
76
|
+
if (this.enableCache && isCacheable) {
|
|
77
|
+
const cacheKey = this.getCacheKey(call);
|
|
78
|
+
const cached = this.cache.get(cacheKey);
|
|
79
|
+
if (cached && Date.now() - cached.timestamp < this.cacheTTLMs) {
|
|
80
|
+
this.observer?.onCacheHit?.(call);
|
|
81
|
+
this.observer?.onToolResult?.(call, cached.result);
|
|
82
|
+
return cached.result;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
this.observer?.onToolStart?.(call);
|
|
86
|
+
try {
|
|
87
|
+
const args = normalizeToolArguments(call.arguments);
|
|
88
|
+
validateToolArguments(record.definition.name, record.definition.parameters, args);
|
|
89
|
+
const result = await record.definition.handler(args);
|
|
90
|
+
let output = typeof result === 'string' ? result : JSON.stringify(result, null, 2);
|
|
91
|
+
// Truncate output if context manager is available
|
|
92
|
+
if (this.contextManager) {
|
|
93
|
+
const truncated = this.contextManager.truncateToolOutput(output, call.name);
|
|
94
|
+
if (truncated.wasTruncated) {
|
|
95
|
+
output = truncated.content;
|
|
96
|
+
// Log truncation for debugging
|
|
97
|
+
if (process.env['DEBUG_CONTEXT']) {
|
|
98
|
+
console.warn(`[Context Manager] Truncated ${call.name} output: ${truncated.originalLength} -> ${truncated.truncatedLength} chars`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// Cache the result if cacheable
|
|
103
|
+
if (this.enableCache && isCacheable) {
|
|
104
|
+
const cacheKey = this.getCacheKey(call);
|
|
105
|
+
this.cache.set(cacheKey, {
|
|
106
|
+
result: output,
|
|
107
|
+
timestamp: Date.now(),
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
this.observer?.onToolResult?.(call, output);
|
|
111
|
+
return output;
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
let formatted;
|
|
115
|
+
if (error instanceof ToolArgumentValidationError) {
|
|
116
|
+
formatted = error.message;
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
120
|
+
formatted = `Failed to run "${call.name}": ${message}`;
|
|
121
|
+
}
|
|
122
|
+
this.observer?.onToolError?.(call, formatted);
|
|
123
|
+
return formatted;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
getCacheKey(call) {
|
|
127
|
+
return `${call.name}:${JSON.stringify(call.arguments)}`;
|
|
128
|
+
}
|
|
129
|
+
clearCache() {
|
|
130
|
+
this.cache.clear();
|
|
131
|
+
}
|
|
132
|
+
getCacheStats() {
|
|
133
|
+
let totalSize = 0;
|
|
134
|
+
for (const entry of this.cache.values()) {
|
|
135
|
+
totalSize += entry.result.length;
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
size: totalSize,
|
|
139
|
+
entries: this.cache.size,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
addTool(definition, suiteId) {
|
|
143
|
+
if (!definition?.name?.trim()) {
|
|
144
|
+
throw new Error(`Tool names cannot be blank (suite "${suiteId}").`);
|
|
145
|
+
}
|
|
146
|
+
if (this.registry.has(definition.name)) {
|
|
147
|
+
const owner = this.registry.get(definition.name)?.suiteId ?? 'unknown';
|
|
148
|
+
throw new Error(`Tool "${definition.name}" already registered by suite "${owner}".`);
|
|
149
|
+
}
|
|
150
|
+
this.registry.set(definition.name, {
|
|
151
|
+
suiteId,
|
|
152
|
+
definition,
|
|
153
|
+
});
|
|
154
|
+
this.registrationOrder.push(definition.name);
|
|
155
|
+
}
|
|
156
|
+
removeFromOrder(name) {
|
|
157
|
+
const index = this.registrationOrder.indexOf(name);
|
|
158
|
+
if (index >= 0) {
|
|
159
|
+
this.registrationOrder.splice(index, 1);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
export function createDefaultToolRuntime(context, toolSuites = [], options = {}) {
|
|
164
|
+
const runtime = new ToolRuntime([
|
|
165
|
+
buildContextSnapshotTool(context.workspaceContext),
|
|
166
|
+
buildCapabilitiesTool(context),
|
|
167
|
+
buildProfileInspectorTool(context),
|
|
168
|
+
], options);
|
|
169
|
+
for (const suite of toolSuites) {
|
|
170
|
+
runtime.registerSuite(suite);
|
|
171
|
+
}
|
|
172
|
+
return runtime;
|
|
173
|
+
}
|
|
174
|
+
function buildContextSnapshotTool(workspaceContext) {
|
|
175
|
+
return {
|
|
176
|
+
name: 'context_snapshot',
|
|
177
|
+
description: 'Returns a summary of the repository context. NOTE: Full context is already in your system prompt - only use this if you need to refresh or verify the context.',
|
|
178
|
+
parameters: {
|
|
179
|
+
type: 'object',
|
|
180
|
+
properties: {
|
|
181
|
+
format: {
|
|
182
|
+
type: 'string',
|
|
183
|
+
description: 'Use "plain" for raw text or "markdown" for a fenced block.',
|
|
184
|
+
enum: ['plain', 'markdown'],
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
handler: (args) => {
|
|
189
|
+
if (!workspaceContext?.trim()) {
|
|
190
|
+
return 'Workspace context is unavailable.';
|
|
191
|
+
}
|
|
192
|
+
// CRITICAL: Return only summary to prevent context duplication
|
|
193
|
+
// Full context is already in system prompt
|
|
194
|
+
const lines = workspaceContext.trim().split('\n');
|
|
195
|
+
const totalLines = lines.length;
|
|
196
|
+
// Return just first 20 lines + summary
|
|
197
|
+
const preview = lines.slice(0, 20).join('\n');
|
|
198
|
+
const summary = [
|
|
199
|
+
preview,
|
|
200
|
+
'',
|
|
201
|
+
`[Workspace context: ${totalLines} total lines]`,
|
|
202
|
+
`[Full context already available in system prompt - use Read/Glob tools for specific files]`
|
|
203
|
+
].join('\n');
|
|
204
|
+
const format = args['format'] === 'markdown' ? 'markdown' : 'plain';
|
|
205
|
+
if (format === 'markdown') {
|
|
206
|
+
return ['```text', summary, '```'].join('\n');
|
|
207
|
+
}
|
|
208
|
+
return summary;
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function buildCapabilitiesTool(context) {
|
|
213
|
+
return {
|
|
214
|
+
name: 'capabilities_overview',
|
|
215
|
+
description: 'Summarizes the agent runtime capabilities including available tools and features.',
|
|
216
|
+
parameters: {
|
|
217
|
+
type: 'object',
|
|
218
|
+
properties: {
|
|
219
|
+
audience: {
|
|
220
|
+
type: 'string',
|
|
221
|
+
enum: ['developer', 'model'],
|
|
222
|
+
description: 'Tailors the tone of the description.',
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
handler: (args) => {
|
|
227
|
+
const audience = args['audience'];
|
|
228
|
+
const adjective = audience === 'developer' ? 'Operator facing' : 'Model facing';
|
|
229
|
+
return [
|
|
230
|
+
`${adjective} capabilities summary:`,
|
|
231
|
+
'- Full file system access (read, write, list, search).',
|
|
232
|
+
'- Bash command execution for running scripts and tools.',
|
|
233
|
+
'- Advanced code search and pattern matching.',
|
|
234
|
+
'- Deterministic workspace context snapshot appended to the system prompt.',
|
|
235
|
+
'- Tool invocations are logged in realtime for transparency.',
|
|
236
|
+
`- Active provider: ${context.provider} (${context.model}).`,
|
|
237
|
+
].join('\n');
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
function buildProfileInspectorTool(context) {
|
|
242
|
+
return {
|
|
243
|
+
name: 'profile_details',
|
|
244
|
+
description: 'Returns the configuration of the active CLI profile.',
|
|
245
|
+
parameters: {
|
|
246
|
+
type: 'object',
|
|
247
|
+
properties: {
|
|
248
|
+
includeWorkspaceContext: {
|
|
249
|
+
type: 'boolean',
|
|
250
|
+
description: 'Set true to append the workspace context snapshot if available.',
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
additionalProperties: false,
|
|
254
|
+
},
|
|
255
|
+
handler: (args) => {
|
|
256
|
+
const payload = {
|
|
257
|
+
profile: context.profileName,
|
|
258
|
+
provider: context.provider,
|
|
259
|
+
model: context.model,
|
|
260
|
+
workspaceContext: args['includeWorkspaceContext'] ? context.workspaceContext ?? null : null,
|
|
261
|
+
};
|
|
262
|
+
return JSON.stringify(payload, null, 2);
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
function normalizeToolArguments(value) {
|
|
267
|
+
if (value instanceof Map) {
|
|
268
|
+
return Object.fromEntries(value.entries());
|
|
269
|
+
}
|
|
270
|
+
if (isRecord(value)) {
|
|
271
|
+
return value;
|
|
272
|
+
}
|
|
273
|
+
if (typeof value === 'string') {
|
|
274
|
+
const trimmed = value.trim();
|
|
275
|
+
if (!trimmed) {
|
|
276
|
+
return {};
|
|
277
|
+
}
|
|
278
|
+
try {
|
|
279
|
+
const parsed = JSON.parse(trimmed);
|
|
280
|
+
return isRecord(parsed) ? parsed : {};
|
|
281
|
+
}
|
|
282
|
+
catch {
|
|
283
|
+
return {};
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return {};
|
|
287
|
+
}
|
|
288
|
+
function isRecord(value) {
|
|
289
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
290
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Optimized Erosolar CLI Entry Point
|
|
4
|
+
*
|
|
5
|
+
* Features:
|
|
6
|
+
* - Fast-path commands for simple operations
|
|
7
|
+
* - Lazy loading for complex functionality
|
|
8
|
+
* - Performance monitoring
|
|
9
|
+
* - Graceful error handling
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=erosolar-optimized.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erosolar-optimized.d.ts","sourceRoot":"","sources":["../../src/bin/erosolar-optimized.ts"],"names":[],"mappings":";AAEA;;;;;;;;GAQG"}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Optimized Erosolar CLI Entry Point
|
|
4
|
+
*
|
|
5
|
+
* Features:
|
|
6
|
+
* - Fast-path commands for simple operations
|
|
7
|
+
* - Lazy loading for complex functionality
|
|
8
|
+
* - Performance monitoring
|
|
9
|
+
* - Graceful error handling
|
|
10
|
+
*/
|
|
11
|
+
import { readFileSync } from 'node:fs';
|
|
12
|
+
import { dirname, resolve } from 'node:path';
|
|
13
|
+
import { fileURLToPath } from 'node:url';
|
|
14
|
+
import { initializeLazyLoaders, LazyLoaderRegistry } from '../core/LazyLoader.js';
|
|
15
|
+
// Initialize lazy loading system
|
|
16
|
+
initializeLazyLoaders();
|
|
17
|
+
// Fast-path command handling
|
|
18
|
+
function handleFastPathCommand(argv) {
|
|
19
|
+
const command = argv[0];
|
|
20
|
+
switch (command) {
|
|
21
|
+
case '--version':
|
|
22
|
+
case 'version':
|
|
23
|
+
case '-v':
|
|
24
|
+
console.log(`Erosolar CLI v${getPackageVersion()}`);
|
|
25
|
+
return true;
|
|
26
|
+
case '--help':
|
|
27
|
+
case 'help':
|
|
28
|
+
case '-h':
|
|
29
|
+
showFastHelp();
|
|
30
|
+
return true;
|
|
31
|
+
case '--json':
|
|
32
|
+
// Defer to full implementation for JSON mode
|
|
33
|
+
return false;
|
|
34
|
+
case 'health-check':
|
|
35
|
+
// This will be handled in main async function
|
|
36
|
+
return false;
|
|
37
|
+
case 'status':
|
|
38
|
+
showStatus();
|
|
39
|
+
return true;
|
|
40
|
+
case 'performance':
|
|
41
|
+
showPerformanceStats();
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
// Get package version without full initialization
|
|
47
|
+
function getPackageVersion() {
|
|
48
|
+
try {
|
|
49
|
+
const filePath = fileURLToPath(import.meta.url);
|
|
50
|
+
const packagePath = resolve(dirname(filePath), '../../package.json');
|
|
51
|
+
const payload = JSON.parse(readFileSync(packagePath, 'utf8'));
|
|
52
|
+
return typeof payload.version === 'string' ? payload.version : '0.0.0';
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return '0.0.0';
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// Fast help without full initialization
|
|
59
|
+
function showFastHelp() {
|
|
60
|
+
console.log(`
|
|
61
|
+
Erosolar CLI v${getPackageVersion()} - Fast Help
|
|
62
|
+
|
|
63
|
+
Usage:
|
|
64
|
+
erosolar [command] [options]
|
|
65
|
+
|
|
66
|
+
Fast Commands:
|
|
67
|
+
version, -v Show version
|
|
68
|
+
help, -h Show this help
|
|
69
|
+
status Show system status
|
|
70
|
+
performance Show performance statistics
|
|
71
|
+
|
|
72
|
+
Full Commands:
|
|
73
|
+
[interactive] Start interactive shell
|
|
74
|
+
--json <command> Run command in JSON mode
|
|
75
|
+
health-check Run health check
|
|
76
|
+
|
|
77
|
+
Options:
|
|
78
|
+
--provider <name> Specify AI provider
|
|
79
|
+
--model <name> Specify AI model
|
|
80
|
+
--profile <name> Use specific agent profile
|
|
81
|
+
|
|
82
|
+
Examples:
|
|
83
|
+
erosolar version
|
|
84
|
+
erosolar --json "list files"
|
|
85
|
+
erosolar --provider openai --model gpt-4
|
|
86
|
+
`);
|
|
87
|
+
}
|
|
88
|
+
// Run health check without full initialization
|
|
89
|
+
async function runHealthCheck() {
|
|
90
|
+
console.log('🧪 Running fast health check...\n');
|
|
91
|
+
const checks = [
|
|
92
|
+
{ name: 'Node.js version', check: checkNodeVersion },
|
|
93
|
+
{ name: 'Package configuration', check: checkPackageConfig },
|
|
94
|
+
{ name: 'Build directory', check: checkBuildDir },
|
|
95
|
+
{ name: 'Main binary', check: checkMainBinary },
|
|
96
|
+
];
|
|
97
|
+
let passed = 0;
|
|
98
|
+
let failed = 0;
|
|
99
|
+
for (const { name, check } of checks) {
|
|
100
|
+
try {
|
|
101
|
+
await check();
|
|
102
|
+
console.log(`✅ ${name}`);
|
|
103
|
+
passed++;
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
console.log(`❌ ${name}: ${error instanceof Error ? error.message : error}`);
|
|
107
|
+
failed++;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
console.log(`\n📊 Results: ${passed} passed, ${failed} failed`);
|
|
111
|
+
if (failed > 0) {
|
|
112
|
+
process.exit(1);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// Check Node.js version
|
|
116
|
+
function checkNodeVersion() {
|
|
117
|
+
const version = process.version;
|
|
118
|
+
const major = parseInt(version.slice(1).split('.')[0], 10);
|
|
119
|
+
if (major < 20) {
|
|
120
|
+
throw new Error(`Node.js ${version} is too old, requires >=20.0.0`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
// Check package configuration
|
|
124
|
+
function checkPackageConfig() {
|
|
125
|
+
const filePath = fileURLToPath(import.meta.url);
|
|
126
|
+
const packagePath = resolve(dirname(filePath), '../../package.json');
|
|
127
|
+
if (!readFileSync(packagePath, 'utf8')) {
|
|
128
|
+
throw new Error('Package.json not found or empty');
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// Check build directory
|
|
132
|
+
function checkBuildDir() {
|
|
133
|
+
const filePath = fileURLToPath(import.meta.url);
|
|
134
|
+
const buildPath = resolve(dirname(filePath), '../../dist');
|
|
135
|
+
try {
|
|
136
|
+
const stats = readFileSync(buildPath);
|
|
137
|
+
if (!stats) {
|
|
138
|
+
throw new Error('Build directory does not exist');
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
throw new Error('Build directory does not exist');
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// Check main binary
|
|
146
|
+
function checkMainBinary() {
|
|
147
|
+
const filePath = fileURLToPath(import.meta.url);
|
|
148
|
+
const binaryPath = resolve(dirname(filePath), '../../dist/bin/erosolar.js');
|
|
149
|
+
try {
|
|
150
|
+
const stats = readFileSync(binaryPath);
|
|
151
|
+
if (!stats) {
|
|
152
|
+
throw new Error('Main binary does not exist');
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
throw new Error('Main binary does not exist');
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// Show system status
|
|
160
|
+
function showStatus() {
|
|
161
|
+
const registry = LazyLoaderRegistry.getInstance();
|
|
162
|
+
const stats = registry.getStats();
|
|
163
|
+
console.log(`
|
|
164
|
+
Erosolar CLI Status
|
|
165
|
+
───────────────────
|
|
166
|
+
Version: ${getPackageVersion()}
|
|
167
|
+
Node.js: ${process.version}
|
|
168
|
+
Platform: ${process.platform} ${process.arch}
|
|
169
|
+
Working Directory: ${process.cwd()}
|
|
170
|
+
|
|
171
|
+
Lazy Loading Status:
|
|
172
|
+
${Object.entries(stats).map(([name, loaderStats]) => ` ${name}: ${loaderStats.isLoaded ? '✅ Loaded' : loaderStats.isLoading ? '🔄 Loading' : '⏳ Not Loaded'} (${loaderStats.loadCount} loads)`).join('\n')}
|
|
173
|
+
|
|
174
|
+
Fast Commands: ✅ Available
|
|
175
|
+
Full Shell: ⚠️ May be slow to initialize
|
|
176
|
+
Health Check: ✅ Available
|
|
177
|
+
`);
|
|
178
|
+
}
|
|
179
|
+
// Show performance statistics
|
|
180
|
+
function showPerformanceStats() {
|
|
181
|
+
const registry = LazyLoaderRegistry.getInstance();
|
|
182
|
+
const stats = registry.getStats();
|
|
183
|
+
console.log(`
|
|
184
|
+
Erosolar CLI Performance Statistics
|
|
185
|
+
──────────────────────────────────
|
|
186
|
+
|
|
187
|
+
Lazy Loader Status:
|
|
188
|
+
${Object.entries(stats).map(([name, loaderStats]) => ` ${name}:
|
|
189
|
+
Status: ${loaderStats.isLoaded ? '✅ Loaded' : loaderStats.isLoading ? '🔄 Loading' : '⏳ Not Loaded'}
|
|
190
|
+
Load Count: ${loaderStats.loadCount}
|
|
191
|
+
Last Load: ${loaderStats.lastLoadTime ? new Date(loaderStats.lastLoadTime).toISOString() : 'Never'}`).join('\n\n')}
|
|
192
|
+
|
|
193
|
+
Performance Tips:
|
|
194
|
+
• Use fast commands (version, help, status) for instant response
|
|
195
|
+
• Complex commands load components on-demand
|
|
196
|
+
• Lazy loading prevents slow startup for simple operations
|
|
197
|
+
• Cached components improve subsequent command performance
|
|
198
|
+
`);
|
|
199
|
+
}
|
|
200
|
+
// Main execution
|
|
201
|
+
async function main() {
|
|
202
|
+
const argv = process.argv.slice(2);
|
|
203
|
+
// Handle fast-path commands
|
|
204
|
+
if (handleFastPathCommand(argv)) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
// Handle health check (needs to be async)
|
|
208
|
+
if (argv[0] === 'health-check') {
|
|
209
|
+
await runHealthCheck();
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
// Defer to full implementation for complex commands
|
|
213
|
+
console.log('🚀 Starting full Erosolar CLI...');
|
|
214
|
+
console.log('⏳ This may take a moment for complex initialization...\n');
|
|
215
|
+
try {
|
|
216
|
+
if (argv.includes('--json')) {
|
|
217
|
+
const { runHeadlessApp } = await import('../headless/headlessApp.js');
|
|
218
|
+
await runHeadlessApp({ argv });
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
const { launchShell } = await import('../shell/shellApp.js');
|
|
222
|
+
await launchShell('erosolar-code', { enableProfileSelection: true });
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
catch (error) {
|
|
226
|
+
console.error('\n❌ CLI Error:', error instanceof Error ? error.message : error);
|
|
227
|
+
// Provide helpful suggestions
|
|
228
|
+
if (error instanceof Error && error.message.includes('Cannot find module')) {
|
|
229
|
+
console.log('\n💡 Try running: npm run build');
|
|
230
|
+
}
|
|
231
|
+
process.exit(1);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
// Start the application
|
|
235
|
+
main().catch((error) => {
|
|
236
|
+
console.error('Fatal error:', error instanceof Error ? error.message : error);
|
|
237
|
+
process.exit(1);
|
|
238
|
+
});
|
|
239
|
+
//# sourceMappingURL=erosolar-optimized.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erosolar-optimized.js","sourceRoot":"","sources":["../../src/bin/erosolar-optimized.ts"],"names":[],"mappings":";AAEA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAA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A4B,CAAC,CAAC;YACtE,MAAM,cAAc,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,MAAM,CAAC,sBAAsB,CAAC,CAAC;YAC7D,MAAM,WAAW,CAAC,eAAe,EAAE,EAAE,sBAAsB,EAAE,IAAI,EAAE,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAEhF,8BAA8B;QAC9B,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAAC;YAC3E,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;QACjD,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,wBAAwB;AACxB,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC9E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/bin/erosolar.js
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Erosolar CLI - Unified AI Agent Framework
|
|
4
|
+
*
|
|
5
|
+
* @license MIT
|
|
6
|
+
* @author Bo Shang
|
|
7
|
+
*
|
|
8
|
+
* DISCLAIMER: This software is provided for both defensive and offensive security
|
|
9
|
+
* purposes and is open source (available via npm and GitHub) to anyone globally.
|
|
10
|
+
* The creator, Bo Shang, does not solicit or endorse unauthorized attacks.
|
|
11
|
+
* This tool is released with the belief that providing technological freedom
|
|
12
|
+
* globally is the right thing to do. Users are solely responsible for ensuring
|
|
13
|
+
* their use complies with applicable laws and regulations in their jurisdiction.
|
|
14
|
+
* Use responsibly and ethically.
|
|
15
|
+
*/
|
|
2
16
|
import { launchShell } from '../shell/shellApp.js';
|
|
3
17
|
import { runHeadlessApp } from '../headless/headlessApp.js';
|
|
4
18
|
const argv = process.argv.slice(2);
|
package/dist/bin/erosolar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erosolar.js","sourceRoot":"","sources":["../../src/bin/erosolar.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEnC,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;IAC5B,cAAc,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACvC,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC9D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;KAAM,CAAC;IACN,WAAW,CAAC,eAAe,EAAE,EAAE,sBAAsB,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QAC7E,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAA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