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,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lazy Loading System for Erosolar CLI
|
|
3
|
+
*
|
|
4
|
+
* Optimizes performance by deferring expensive operations until needed.
|
|
5
|
+
* This prevents slow startup times for simple commands.
|
|
6
|
+
*/
|
|
7
|
+
export class LazyLoader {
|
|
8
|
+
name;
|
|
9
|
+
loader;
|
|
10
|
+
timeoutMs;
|
|
11
|
+
onLoad;
|
|
12
|
+
onError;
|
|
13
|
+
value = null;
|
|
14
|
+
loading = false;
|
|
15
|
+
loadPromise = null;
|
|
16
|
+
lastLoadTime = 0;
|
|
17
|
+
loadCount = 0;
|
|
18
|
+
constructor(options) {
|
|
19
|
+
this.name = options.name;
|
|
20
|
+
this.loader = options.loader;
|
|
21
|
+
this.timeoutMs = options.timeoutMs ?? 30000; // 30 second default
|
|
22
|
+
this.onLoad = options.onLoad;
|
|
23
|
+
this.onError = options.onError;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Get the value, loading it if necessary
|
|
27
|
+
*/
|
|
28
|
+
async get() {
|
|
29
|
+
// Return cached value if available
|
|
30
|
+
if (this.value !== null) {
|
|
31
|
+
return this.value;
|
|
32
|
+
}
|
|
33
|
+
// Return existing load promise if loading
|
|
34
|
+
if (this.loadPromise !== null) {
|
|
35
|
+
return this.loadPromise;
|
|
36
|
+
}
|
|
37
|
+
// Start loading
|
|
38
|
+
this.loading = true;
|
|
39
|
+
this.loadPromise = this.loadWithTimeout();
|
|
40
|
+
try {
|
|
41
|
+
this.value = await this.loadPromise;
|
|
42
|
+
this.loadCount++;
|
|
43
|
+
this.lastLoadTime = Date.now();
|
|
44
|
+
if (this.onLoad) {
|
|
45
|
+
this.onLoad(this.value);
|
|
46
|
+
}
|
|
47
|
+
return this.value;
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
if (this.onError) {
|
|
51
|
+
this.onError(error);
|
|
52
|
+
}
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
finally {
|
|
56
|
+
this.loading = false;
|
|
57
|
+
this.loadPromise = null;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Check if the value is loaded
|
|
62
|
+
*/
|
|
63
|
+
isLoaded() {
|
|
64
|
+
return this.value !== null;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Check if currently loading
|
|
68
|
+
*/
|
|
69
|
+
isLoading() {
|
|
70
|
+
return this.loading;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get the cached value without loading
|
|
74
|
+
*/
|
|
75
|
+
getCached() {
|
|
76
|
+
return this.value;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Force reload the value
|
|
80
|
+
*/
|
|
81
|
+
async reload() {
|
|
82
|
+
this.value = null;
|
|
83
|
+
this.loadPromise = null;
|
|
84
|
+
return this.get();
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Clear the cached value
|
|
88
|
+
*/
|
|
89
|
+
clear() {
|
|
90
|
+
this.value = null;
|
|
91
|
+
this.loadPromise = null;
|
|
92
|
+
this.loading = false;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Get loader statistics
|
|
96
|
+
*/
|
|
97
|
+
getStats() {
|
|
98
|
+
return {
|
|
99
|
+
name: this.name,
|
|
100
|
+
isLoaded: this.isLoaded(),
|
|
101
|
+
isLoading: this.isLoading(),
|
|
102
|
+
loadCount: this.loadCount,
|
|
103
|
+
lastLoadTime: this.lastLoadTime,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
async loadWithTimeout() {
|
|
107
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
108
|
+
setTimeout(() => {
|
|
109
|
+
reject(new Error(`LazyLoader timeout: ${this.name} took longer than ${this.timeoutMs}ms`));
|
|
110
|
+
}, this.timeoutMs);
|
|
111
|
+
});
|
|
112
|
+
return Promise.race([this.loader(), timeoutPromise]);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Global lazy loader registry
|
|
117
|
+
*/
|
|
118
|
+
export class LazyLoaderRegistry {
|
|
119
|
+
static instance;
|
|
120
|
+
loaders = new Map();
|
|
121
|
+
constructor() { }
|
|
122
|
+
static getInstance() {
|
|
123
|
+
if (!LazyLoaderRegistry.instance) {
|
|
124
|
+
LazyLoaderRegistry.instance = new LazyLoaderRegistry();
|
|
125
|
+
}
|
|
126
|
+
return LazyLoaderRegistry.instance;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Register a lazy loader
|
|
130
|
+
*/
|
|
131
|
+
register(name, loader) {
|
|
132
|
+
this.loaders.set(name, loader);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Get a lazy loader
|
|
136
|
+
*/
|
|
137
|
+
get(name) {
|
|
138
|
+
return this.loaders.get(name);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Get all loader statistics
|
|
142
|
+
*/
|
|
143
|
+
getStats() {
|
|
144
|
+
const stats = {};
|
|
145
|
+
for (const [name, loader] of this.loaders) {
|
|
146
|
+
stats[name] = loader.getStats();
|
|
147
|
+
}
|
|
148
|
+
return stats;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Preload specific loaders
|
|
152
|
+
*/
|
|
153
|
+
async preload(names) {
|
|
154
|
+
const promises = names.map(name => {
|
|
155
|
+
const loader = this.loaders.get(name);
|
|
156
|
+
return loader ? loader.get().catch(() => { }) : Promise.resolve();
|
|
157
|
+
});
|
|
158
|
+
await Promise.all(promises);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Clear all loaders
|
|
162
|
+
*/
|
|
163
|
+
clearAll() {
|
|
164
|
+
for (const loader of this.loaders.values()) {
|
|
165
|
+
loader.clear();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Convenience function to create a lazy loader
|
|
171
|
+
*/
|
|
172
|
+
export function createLazyLoader(options) {
|
|
173
|
+
return new LazyLoader(options);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Pre-configured lazy loaders for common Erosolar components
|
|
177
|
+
*/
|
|
178
|
+
export const ErosolarLazyLoaders = {
|
|
179
|
+
/**
|
|
180
|
+
* Create lazy loader for tool capabilities
|
|
181
|
+
*/
|
|
182
|
+
tools: () => createLazyLoader({
|
|
183
|
+
name: 'tools',
|
|
184
|
+
loader: async () => {
|
|
185
|
+
const { getToolManifest } = await import('../capabilities/toolManifest.js');
|
|
186
|
+
const { buildEnabledToolSet } = await import('../capabilities/toolRegistry.js');
|
|
187
|
+
return {
|
|
188
|
+
manifest: getToolManifest(),
|
|
189
|
+
enabledTools: buildEnabledToolSet(null),
|
|
190
|
+
};
|
|
191
|
+
},
|
|
192
|
+
timeoutMs: 10000,
|
|
193
|
+
}),
|
|
194
|
+
/**
|
|
195
|
+
* Create lazy loader for AI providers
|
|
196
|
+
*/
|
|
197
|
+
providers: () => createLazyLoader({
|
|
198
|
+
name: 'providers',
|
|
199
|
+
loader: async () => {
|
|
200
|
+
const { quickCheckProviders } = await import('./modelDiscovery.js');
|
|
201
|
+
return await quickCheckProviders();
|
|
202
|
+
},
|
|
203
|
+
timeoutMs: 15000,
|
|
204
|
+
}),
|
|
205
|
+
/**
|
|
206
|
+
* Create lazy loader for workspace context
|
|
207
|
+
*/
|
|
208
|
+
workspace: (root = process.cwd()) => createLazyLoader({
|
|
209
|
+
name: 'workspace',
|
|
210
|
+
loader: async () => {
|
|
211
|
+
const { buildWorkspaceContext } = await import('../workspace.js');
|
|
212
|
+
return buildWorkspaceContext(root, {});
|
|
213
|
+
},
|
|
214
|
+
timeoutMs: 5000,
|
|
215
|
+
}),
|
|
216
|
+
/**
|
|
217
|
+
* Create lazy loader for agent profiles
|
|
218
|
+
*/
|
|
219
|
+
profiles: () => createLazyLoader({
|
|
220
|
+
name: 'profiles',
|
|
221
|
+
loader: async () => {
|
|
222
|
+
const { listAgentProfiles } = await import('./agentProfiles.js');
|
|
223
|
+
return listAgentProfiles();
|
|
224
|
+
},
|
|
225
|
+
timeoutMs: 3000,
|
|
226
|
+
}),
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* Initialize the global lazy loader registry with common components
|
|
230
|
+
*/
|
|
231
|
+
export function initializeLazyLoaders() {
|
|
232
|
+
const registry = LazyLoaderRegistry.getInstance();
|
|
233
|
+
// Register common loaders
|
|
234
|
+
registry.register('tools', ErosolarLazyLoaders.tools());
|
|
235
|
+
registry.register('providers', ErosolarLazyLoaders.providers());
|
|
236
|
+
registry.register('workspace', ErosolarLazyLoaders.workspace());
|
|
237
|
+
registry.register('profiles', ErosolarLazyLoaders.profiles());
|
|
238
|
+
console.log('🧠 Lazy loader system initialized');
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=LazyLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LazyLoader.js","sourceRoot":"","sources":["../../src/core/LazyLoader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,MAAM,OAAO,UAAU;IACJ,IAAI,CAAS;IACb,MAAM,CAAmB;IACzB,SAAS,CAAS;IAClB,MAAM,CAAuB;IAC7B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E9D,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Intelligence-Grade Security Tools
|
|
3
|
+
*
|
|
4
|
+
* Advanced capabilities for intelligence operations and security testing.
|
|
5
|
+
* These tools provide sophisticated techniques used by intelligence agencies.
|
|
6
|
+
*
|
|
7
|
+
* LEGAL NOTICE: For authorized security research and testing only.
|
|
8
|
+
*/
|
|
9
|
+
import type { ToolDefinition } from './toolRuntime.js';
|
|
10
|
+
export interface IntelligenceToolsOptions {
|
|
11
|
+
enableAdvancedTechniques?: boolean;
|
|
12
|
+
requireAuthorization?: boolean;
|
|
13
|
+
stealthMode?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Create intelligence-grade security tools
|
|
17
|
+
*/
|
|
18
|
+
export declare function createIntelligenceTools(workingDir: string, options?: IntelligenceToolsOptions): ToolDefinition[];
|
|
19
|
+
//# sourceMappingURL=intelligenceTools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intelligenceTools.d.ts","sourceRoot":"","sources":["../../src/core/intelligenceTools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAMvD,MAAM,WAAW,wBAAwB;IACvC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,wBAA6B,GACrC,cAAc,EAAE,CAkClB"}
|