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,430 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AnimationScheduler - Coordinates animations, spinners, progress bars, and elapsed time
|
|
3
|
+
* Provides frame-based animation updates and smooth transitions
|
|
4
|
+
*/
|
|
5
|
+
import { EventEmitter } from 'events';
|
|
6
|
+
import { performance } from 'perf_hooks';
|
|
7
|
+
export class AnimationScheduler extends EventEmitter {
|
|
8
|
+
constructor(targetFPS = 30) {
|
|
9
|
+
super();
|
|
10
|
+
this.animations = new Map();
|
|
11
|
+
this.animationLoop = null;
|
|
12
|
+
this.targetFPS = 30;
|
|
13
|
+
this.lastFrameTime = 0;
|
|
14
|
+
this.isRunning = false;
|
|
15
|
+
this.targetFPS = targetFPS;
|
|
16
|
+
this.frameInterval = 1000 / targetFPS;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create and register a spinner animation
|
|
20
|
+
*/
|
|
21
|
+
createSpinner(id, message, frames = AnimationScheduler.SpinnerFrames.dots) {
|
|
22
|
+
const animation = {
|
|
23
|
+
id,
|
|
24
|
+
type: 'spinner',
|
|
25
|
+
startTime: performance.now(),
|
|
26
|
+
fps: 10, // Spinners typically run at 10 FPS
|
|
27
|
+
frameCount: frames.length,
|
|
28
|
+
currentFrame: 0,
|
|
29
|
+
data: {
|
|
30
|
+
frames,
|
|
31
|
+
message,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
this.register(animation);
|
|
35
|
+
return animation;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Create and register a progress animation
|
|
39
|
+
*/
|
|
40
|
+
createProgress(id, current, total, duration = 500) {
|
|
41
|
+
const animation = {
|
|
42
|
+
id,
|
|
43
|
+
type: 'progress',
|
|
44
|
+
startTime: performance.now(),
|
|
45
|
+
duration,
|
|
46
|
+
fps: 60, // Smooth progress animations at 60 FPS
|
|
47
|
+
frameCount: Math.ceil((duration / 1000) * 60),
|
|
48
|
+
currentFrame: 0,
|
|
49
|
+
data: {
|
|
50
|
+
current,
|
|
51
|
+
target: current,
|
|
52
|
+
total,
|
|
53
|
+
},
|
|
54
|
+
easing: AnimationScheduler.Easing.easeOutQuad,
|
|
55
|
+
};
|
|
56
|
+
this.register(animation);
|
|
57
|
+
return animation;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Update progress animation target
|
|
61
|
+
*/
|
|
62
|
+
updateProgress(id, newTarget) {
|
|
63
|
+
const animation = this.animations.get(id);
|
|
64
|
+
if (!animation || animation.type !== 'progress')
|
|
65
|
+
return;
|
|
66
|
+
animation.data.current = this.getCurrentProgressValue(animation);
|
|
67
|
+
animation.data.target = newTarget;
|
|
68
|
+
animation.startTime = performance.now();
|
|
69
|
+
animation.currentFrame = 0;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Create and register an elapsed time animation
|
|
73
|
+
*/
|
|
74
|
+
createElapsed(id, startTime = Date.now()) {
|
|
75
|
+
const animation = {
|
|
76
|
+
id,
|
|
77
|
+
type: 'elapsed',
|
|
78
|
+
startTime: performance.now(),
|
|
79
|
+
fps: 1, // Update once per second
|
|
80
|
+
frameCount: Infinity,
|
|
81
|
+
currentFrame: 0,
|
|
82
|
+
data: {
|
|
83
|
+
startTime,
|
|
84
|
+
format: this.formatElapsedTime,
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
this.register(animation);
|
|
88
|
+
return animation;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Create and register a transition animation
|
|
92
|
+
*/
|
|
93
|
+
createTransition(id, from, to, property, duration = 300, easing) {
|
|
94
|
+
const animation = {
|
|
95
|
+
id,
|
|
96
|
+
type: 'transition',
|
|
97
|
+
startTime: performance.now(),
|
|
98
|
+
duration,
|
|
99
|
+
fps: 60,
|
|
100
|
+
frameCount: Math.ceil((duration / 1000) * 60),
|
|
101
|
+
currentFrame: 0,
|
|
102
|
+
data: {
|
|
103
|
+
from,
|
|
104
|
+
to,
|
|
105
|
+
property,
|
|
106
|
+
},
|
|
107
|
+
easing: easing || AnimationScheduler.Easing.easeInOutQuad,
|
|
108
|
+
};
|
|
109
|
+
this.register(animation);
|
|
110
|
+
return animation;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Register an animation
|
|
114
|
+
*/
|
|
115
|
+
register(animation) {
|
|
116
|
+
this.animations.set(animation.id, animation);
|
|
117
|
+
// Start the animation loop if not running
|
|
118
|
+
if (!this.isRunning && this.animations.size > 0) {
|
|
119
|
+
this.start();
|
|
120
|
+
}
|
|
121
|
+
this.emit('animation:registered', animation);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Unregister an animation
|
|
125
|
+
*/
|
|
126
|
+
unregister(id) {
|
|
127
|
+
const animation = this.animations.get(id);
|
|
128
|
+
if (animation) {
|
|
129
|
+
this.animations.delete(id);
|
|
130
|
+
this.emit('animation:unregistered', animation);
|
|
131
|
+
// Stop the loop if no animations remain
|
|
132
|
+
if (this.animations.size === 0) {
|
|
133
|
+
this.stop();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Start the animation loop
|
|
139
|
+
*/
|
|
140
|
+
start() {
|
|
141
|
+
if (this.isRunning)
|
|
142
|
+
return;
|
|
143
|
+
this.isRunning = true;
|
|
144
|
+
this.lastFrameTime = performance.now();
|
|
145
|
+
this.animationLoop = setInterval(() => this.tick(), this.frameInterval);
|
|
146
|
+
this.emit('scheduler:start');
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Stop the animation loop
|
|
150
|
+
*/
|
|
151
|
+
stop() {
|
|
152
|
+
if (!this.isRunning)
|
|
153
|
+
return;
|
|
154
|
+
if (this.animationLoop) {
|
|
155
|
+
clearInterval(this.animationLoop);
|
|
156
|
+
this.animationLoop = null;
|
|
157
|
+
}
|
|
158
|
+
this.isRunning = false;
|
|
159
|
+
this.emit('scheduler:stop');
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Main animation tick
|
|
163
|
+
*/
|
|
164
|
+
tick() {
|
|
165
|
+
const now = performance.now();
|
|
166
|
+
const deltaTime = now - this.lastFrameTime;
|
|
167
|
+
// Process each animation
|
|
168
|
+
for (const [, animation] of this.animations) {
|
|
169
|
+
// Check if animation should update based on its FPS
|
|
170
|
+
const animationInterval = 1000 / animation.fps;
|
|
171
|
+
const elapsedTime = now - animation.startTime;
|
|
172
|
+
const expectedFrame = Math.floor(elapsedTime / animationInterval);
|
|
173
|
+
if (expectedFrame > animation.currentFrame) {
|
|
174
|
+
animation.currentFrame = expectedFrame;
|
|
175
|
+
// Check if animation is complete
|
|
176
|
+
if (animation.duration &&
|
|
177
|
+
elapsedTime >= animation.duration &&
|
|
178
|
+
animation.frameCount !== Infinity) {
|
|
179
|
+
this.completeAnimation(animation);
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
// Update animation
|
|
183
|
+
this.updateAnimation(animation, elapsedTime);
|
|
184
|
+
// Call frame callback
|
|
185
|
+
if (animation.onFrame) {
|
|
186
|
+
animation.onFrame(animation);
|
|
187
|
+
}
|
|
188
|
+
this.emit('animation:frame', animation);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
this.lastFrameTime = now;
|
|
192
|
+
this.emit('scheduler:tick', { deltaTime, animationCount: this.animations.size });
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Update animation based on type
|
|
196
|
+
*/
|
|
197
|
+
updateAnimation(animation, elapsedTime) {
|
|
198
|
+
switch (animation.type) {
|
|
199
|
+
case 'spinner':
|
|
200
|
+
this.updateSpinner(animation);
|
|
201
|
+
break;
|
|
202
|
+
case 'progress':
|
|
203
|
+
this.updateProgressAnimation(animation, elapsedTime);
|
|
204
|
+
break;
|
|
205
|
+
case 'elapsed':
|
|
206
|
+
this.updateElapsed(animation);
|
|
207
|
+
break;
|
|
208
|
+
case 'transition':
|
|
209
|
+
this.updateTransition(animation, elapsedTime);
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Update spinner animation
|
|
215
|
+
*/
|
|
216
|
+
updateSpinner(animation) {
|
|
217
|
+
const frameIndex = animation.currentFrame % animation.data.frames.length;
|
|
218
|
+
this.emit('spinner:frame', {
|
|
219
|
+
id: animation.id,
|
|
220
|
+
frame: animation.data.frames[frameIndex],
|
|
221
|
+
message: animation.data.message,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Update progress animation
|
|
226
|
+
*/
|
|
227
|
+
updateProgressAnimation(animation, elapsedTime) {
|
|
228
|
+
if (!animation.duration)
|
|
229
|
+
return;
|
|
230
|
+
const progress = Math.min(elapsedTime / animation.duration, 1);
|
|
231
|
+
const easedProgress = animation.easing ? animation.easing(progress) : progress;
|
|
232
|
+
const { current, target, total } = animation.data;
|
|
233
|
+
const newValue = current + (target - current) * easedProgress;
|
|
234
|
+
const percentage = Math.round((newValue / total) * 100);
|
|
235
|
+
this.emit('progress:update', {
|
|
236
|
+
id: animation.id,
|
|
237
|
+
value: newValue,
|
|
238
|
+
percentage,
|
|
239
|
+
total,
|
|
240
|
+
formatted: animation.data.format
|
|
241
|
+
? animation.data.format(newValue, total)
|
|
242
|
+
: `${percentage}%`,
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Update elapsed time animation
|
|
247
|
+
*/
|
|
248
|
+
updateElapsed(animation) {
|
|
249
|
+
const elapsed = Date.now() - animation.data.startTime;
|
|
250
|
+
const formatted = animation.data.format
|
|
251
|
+
? animation.data.format(elapsed)
|
|
252
|
+
: this.formatElapsedTime(elapsed);
|
|
253
|
+
this.emit('elapsed:update', {
|
|
254
|
+
id: animation.id,
|
|
255
|
+
elapsed,
|
|
256
|
+
formatted,
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Update transition animation
|
|
261
|
+
*/
|
|
262
|
+
updateTransition(animation, elapsedTime) {
|
|
263
|
+
if (!animation.duration)
|
|
264
|
+
return;
|
|
265
|
+
const progress = Math.min(elapsedTime / animation.duration, 1);
|
|
266
|
+
const easedProgress = animation.easing ? animation.easing(progress) : progress;
|
|
267
|
+
const { from, to } = animation.data;
|
|
268
|
+
let value;
|
|
269
|
+
if (typeof from === 'number' && typeof to === 'number') {
|
|
270
|
+
value = from + (to - from) * easedProgress;
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
// For non-numeric values, switch at 50% progress
|
|
274
|
+
value = easedProgress < 0.5 ? from : to;
|
|
275
|
+
}
|
|
276
|
+
this.emit('transition:update', {
|
|
277
|
+
id: animation.id,
|
|
278
|
+
property: animation.data.property,
|
|
279
|
+
value,
|
|
280
|
+
progress: easedProgress,
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Complete an animation
|
|
285
|
+
*/
|
|
286
|
+
completeAnimation(animation) {
|
|
287
|
+
if (animation.onComplete) {
|
|
288
|
+
animation.onComplete(animation);
|
|
289
|
+
}
|
|
290
|
+
this.emit('animation:complete', animation);
|
|
291
|
+
this.unregister(animation.id);
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Get current progress value with easing
|
|
295
|
+
*/
|
|
296
|
+
getCurrentProgressValue(animation) {
|
|
297
|
+
const elapsedTime = performance.now() - animation.startTime;
|
|
298
|
+
if (!animation.duration)
|
|
299
|
+
return animation.data.target;
|
|
300
|
+
const progress = Math.min(elapsedTime / animation.duration, 1);
|
|
301
|
+
const easedProgress = animation.easing ? animation.easing(progress) : progress;
|
|
302
|
+
const { current, target } = animation.data;
|
|
303
|
+
return current + (target - current) * easedProgress;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Format elapsed time
|
|
307
|
+
*/
|
|
308
|
+
formatElapsedTime(elapsedMs) {
|
|
309
|
+
const seconds = Math.floor(elapsedMs / 1000);
|
|
310
|
+
const minutes = Math.floor(seconds / 60);
|
|
311
|
+
const hours = Math.floor(minutes / 60);
|
|
312
|
+
if (hours > 0) {
|
|
313
|
+
return `${hours}h ${minutes % 60}m ${seconds % 60}s`;
|
|
314
|
+
}
|
|
315
|
+
else if (minutes > 0) {
|
|
316
|
+
return `${minutes}m ${seconds % 60}s`;
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
return `${seconds}s`;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Get animation by ID
|
|
324
|
+
*/
|
|
325
|
+
getAnimation(id) {
|
|
326
|
+
return this.animations.get(id);
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Get all active animations
|
|
330
|
+
*/
|
|
331
|
+
getActiveAnimations() {
|
|
332
|
+
return Array.from(this.animations.values());
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Check if scheduler is running
|
|
336
|
+
*/
|
|
337
|
+
isActive() {
|
|
338
|
+
return this.isRunning;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Get target FPS
|
|
342
|
+
*/
|
|
343
|
+
getTargetFPS() {
|
|
344
|
+
return this.targetFPS;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Set target FPS
|
|
348
|
+
*/
|
|
349
|
+
setTargetFPS(fps) {
|
|
350
|
+
this.targetFPS = fps;
|
|
351
|
+
this.frameInterval = 1000 / fps;
|
|
352
|
+
// Restart the loop with new interval if running
|
|
353
|
+
if (this.isRunning) {
|
|
354
|
+
this.stop();
|
|
355
|
+
this.start();
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Clear all animations
|
|
360
|
+
*/
|
|
361
|
+
clearAll() {
|
|
362
|
+
for (const animation of this.animations.values()) {
|
|
363
|
+
if (animation.onComplete) {
|
|
364
|
+
animation.onComplete(animation);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
this.animations.clear();
|
|
368
|
+
this.stop();
|
|
369
|
+
this.emit('scheduler:cleared');
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Dispose of the scheduler
|
|
373
|
+
*/
|
|
374
|
+
dispose() {
|
|
375
|
+
this.clearAll();
|
|
376
|
+
this.removeAllListeners();
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
// Predefined easing functions
|
|
380
|
+
AnimationScheduler.Easing = {
|
|
381
|
+
linear: (t) => t,
|
|
382
|
+
easeInQuad: (t) => t * t,
|
|
383
|
+
easeOutQuad: (t) => t * (2 - t),
|
|
384
|
+
easeInOutQuad: (t) => (t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t),
|
|
385
|
+
easeInCubic: (t) => t * t * t,
|
|
386
|
+
easeOutCubic: (t) => --t * t * t + 1,
|
|
387
|
+
easeInOutCubic: (t) => t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1,
|
|
388
|
+
easeOutElastic: (t) => {
|
|
389
|
+
const p = 0.3;
|
|
390
|
+
return Math.pow(2, -10 * t) * Math.sin((t - p / 4) * (2 * Math.PI) / p) + 1;
|
|
391
|
+
},
|
|
392
|
+
};
|
|
393
|
+
// Predefined spinner frames
|
|
394
|
+
AnimationScheduler.SpinnerFrames = {
|
|
395
|
+
dots: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'],
|
|
396
|
+
dots2: ['⣾', '⣽', '⣻', '⢿', '⡿', '⣟', '⣯', '⣷'],
|
|
397
|
+
dots3: ['⠋', '⠙', '⠚', '⠞', '⠖', '⠦', '⠴', '⠲', '⠳', '⠓'],
|
|
398
|
+
line: ['-', '\\', '|', '/'],
|
|
399
|
+
pipe: ['┤', '┘', '┴', '└', '├', '┌', '┬', '┐'],
|
|
400
|
+
simpleDots: ['. ', '.. ', '...', ' '],
|
|
401
|
+
simpleDotsScrolling: ['. ', '.. ', '...', ' ..', ' .', ' '],
|
|
402
|
+
star: ['✶', '✸', '✹', '✺', '✹', '✷'],
|
|
403
|
+
hamburger: ['☱', '☲', '☴'],
|
|
404
|
+
growVertical: ['▁', '▃', '▄', '▅', '▆', '▇', '▆', '▅', '▄', '▃'],
|
|
405
|
+
growHorizontal: ['▏', '▎', '▍', '▌', '▋', '▊', '▉', '▊', '▋', '▌', '▍', '▎'],
|
|
406
|
+
balloon: [' ', '.', 'o', 'O', '@', '*', ' '],
|
|
407
|
+
noise: ['▓', '▒', '░'],
|
|
408
|
+
bounce: ['⠁', '⠂', '⠄', '⠂'],
|
|
409
|
+
boxBounce: ['▖', '▘', '▝', '▗'],
|
|
410
|
+
circle: ['◜', '◠', '◝', '◞', '◡', '◟'],
|
|
411
|
+
arc: ['◜', '◠', '◝', '◞', '◡', '◟'],
|
|
412
|
+
arrow: ['←', '↖', '↑', '↗', '→', '↘', '↓', '↙'],
|
|
413
|
+
bouncingBar: [
|
|
414
|
+
'[ ]',
|
|
415
|
+
'[= ]',
|
|
416
|
+
'[== ]',
|
|
417
|
+
'[=== ]',
|
|
418
|
+
'[ ===]',
|
|
419
|
+
'[ ==]',
|
|
420
|
+
'[ =]',
|
|
421
|
+
'[ ]',
|
|
422
|
+
'[ =]',
|
|
423
|
+
'[ ==]',
|
|
424
|
+
'[ ===]',
|
|
425
|
+
'[====]',
|
|
426
|
+
'[=== ]',
|
|
427
|
+
'[== ]',
|
|
428
|
+
'[= ]',
|
|
429
|
+
],
|
|
430
|
+
};
|