agentic-flow 1.10.0 → 1.10.2
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/CHANGELOG.md +25 -1338
- package/dist/.tsbuildinfo +1 -0
- package/dist/agentdb/index.d.ts +26 -0
- package/dist/agentdb/index.d.ts.map +1 -0
- package/dist/agentdb/index.js +1 -0
- package/dist/agentdb/index.js.map +1 -0
- package/dist/agentdb/validate-frontier.cjs +416 -0
- package/dist/agentdb/validate-frontier.cjs.map +1 -0
- package/dist/agentdb/validate-frontier.d.cts +2 -0
- package/dist/agentdb/validate-frontier.d.cts.map +1 -0
- package/dist/agents/claudeAgent.d.ts +6 -0
- package/dist/agents/claudeAgent.d.ts.map +1 -0
- package/dist/agents/claudeAgent.js +22 -3
- package/dist/agents/claudeAgent.js.map +1 -0
- package/dist/agents/claudeAgentDirect.d.ts +6 -0
- package/dist/agents/claudeAgentDirect.d.ts.map +1 -0
- package/dist/agents/claudeAgentDirect.js +1 -0
- package/dist/agents/claudeAgentDirect.js.map +1 -0
- package/dist/agents/claudeFlowAgent.d.ts +32 -0
- package/dist/agents/claudeFlowAgent.d.ts.map +1 -0
- package/dist/agents/claudeFlowAgent.js +1 -0
- package/dist/agents/claudeFlowAgent.js.map +1 -0
- package/dist/agents/codeReviewAgent.d.ts +4 -0
- package/dist/agents/codeReviewAgent.d.ts.map +1 -0
- package/dist/agents/codeReviewAgent.js +1 -0
- package/dist/agents/codeReviewAgent.js.map +1 -0
- package/dist/agents/dataAgent.d.ts +4 -0
- package/dist/agents/dataAgent.d.ts.map +1 -0
- package/dist/agents/dataAgent.js +1 -0
- package/dist/agents/dataAgent.js.map +1 -0
- package/dist/agents/directApiAgent.d.ts +10 -0
- package/dist/agents/directApiAgent.d.ts.map +1 -0
- package/dist/agents/directApiAgent.js +1 -0
- package/dist/agents/directApiAgent.js.map +1 -0
- package/dist/agents/webResearchAgent.d.ts +4 -0
- package/dist/agents/webResearchAgent.d.ts.map +1 -0
- package/dist/agents/webResearchAgent.js +1 -0
- package/dist/agents/webResearchAgent.js.map +1 -0
- package/dist/cli/agent-manager.d.ts +57 -0
- package/dist/cli/agent-manager.d.ts.map +1 -0
- package/dist/cli/agent-manager.js +1 -0
- package/dist/cli/agent-manager.js.map +1 -0
- package/dist/cli/claude-code-wrapper.d.ts +21 -0
- package/dist/cli/claude-code-wrapper.d.ts.map +1 -0
- package/dist/cli/claude-code-wrapper.js +1 -0
- package/dist/cli/claude-code-wrapper.js.map +1 -0
- package/dist/cli/config-wizard.d.ts +21 -0
- package/dist/cli/config-wizard.d.ts.map +1 -0
- package/dist/cli/config-wizard.js +1 -0
- package/dist/cli/config-wizard.js.map +1 -0
- package/dist/cli/federation-cli.d.ts +1 -0
- package/dist/cli/federation-cli.d.ts.map +1 -0
- package/dist/cli/federation-cli.js +1 -0
- package/dist/cli/federation-cli.js.map +1 -0
- package/dist/cli/mcp-manager.d.ts +12 -0
- package/dist/cli/mcp-manager.d.ts.map +1 -0
- package/dist/cli/mcp-manager.js +1 -0
- package/dist/cli/mcp-manager.js.map +1 -0
- package/dist/cli/mcp.d.ts +11 -0
- package/dist/cli/mcp.d.ts.map +1 -0
- package/dist/cli/mcp.js +1 -0
- package/dist/cli/mcp.js.map +1 -0
- package/dist/cli-proxy.d.ts +7 -0
- package/dist/cli-proxy.d.ts.map +1 -0
- package/dist/cli-proxy.js +1 -0
- package/dist/cli-proxy.js.map +1 -0
- package/dist/cli-standalone-proxy.d.ts +17 -0
- package/dist/cli-standalone-proxy.d.ts.map +1 -0
- package/dist/cli-standalone-proxy.js +1 -0
- package/dist/cli-standalone-proxy.js.map +1 -0
- package/dist/config/claudeFlow.d.ts +33 -0
- package/dist/config/claudeFlow.d.ts.map +1 -0
- package/dist/config/claudeFlow.js +1 -0
- package/dist/config/claudeFlow.js.map +1 -0
- package/dist/config/quic.d.ts +58 -0
- package/dist/config/quic.d.ts.map +1 -0
- package/dist/config/quic.js +1 -0
- package/dist/config/quic.js.map +1 -0
- package/dist/config/tools.d.ts +17 -0
- package/dist/config/tools.d.ts.map +1 -0
- package/dist/config/tools.js +1 -0
- package/dist/config/tools.js.map +1 -0
- package/dist/core/long-running-agent.d.ts +92 -0
- package/dist/core/long-running-agent.d.ts.map +1 -0
- package/dist/core/long-running-agent.js +1 -0
- package/dist/core/long-running-agent.js.map +1 -0
- package/dist/core/provider-manager.d.ts +145 -0
- package/dist/core/provider-manager.d.ts.map +1 -0
- package/dist/core/provider-manager.js +1 -0
- package/dist/core/provider-manager.js.map +1 -0
- package/dist/examples/multi-agent-orchestration.d.ts +3 -0
- package/dist/examples/multi-agent-orchestration.d.ts.map +1 -0
- package/dist/examples/multi-agent-orchestration.js +1 -0
- package/dist/examples/multi-agent-orchestration.js.map +1 -0
- package/dist/examples/use-goal-planner.d.ts +3 -0
- package/dist/examples/use-goal-planner.d.ts.map +1 -0
- package/dist/examples/use-goal-planner.js +1 -0
- package/dist/examples/use-goal-planner.js.map +1 -0
- package/dist/examples/use-provider-fallback.d.ts +13 -0
- package/dist/examples/use-provider-fallback.d.ts.map +1 -0
- package/dist/examples/use-provider-fallback.js +1 -0
- package/dist/examples/use-provider-fallback.js.map +1 -0
- package/dist/federation/EphemeralAgent.d.ts +84 -0
- package/dist/federation/EphemeralAgent.d.ts.map +1 -0
- package/dist/federation/EphemeralAgent.js +1 -0
- package/dist/federation/EphemeralAgent.js.map +1 -0
- package/dist/federation/FederationHub.d.ts +89 -0
- package/dist/federation/FederationHub.d.ts.map +1 -0
- package/dist/federation/FederationHub.js +1 -0
- package/dist/federation/FederationHub.js.map +1 -0
- package/dist/federation/FederationHubClient.d.ts +70 -0
- package/dist/federation/FederationHubClient.d.ts.map +1 -0
- package/dist/federation/FederationHubClient.js +1 -0
- package/dist/federation/FederationHubClient.js.map +1 -0
- package/dist/federation/FederationHubServer.d.ts +100 -0
- package/dist/federation/FederationHubServer.d.ts.map +1 -0
- package/dist/federation/FederationHubServer.js +1 -0
- package/dist/federation/FederationHubServer.js.map +1 -0
- package/dist/federation/SecurityManager.d.ts +80 -0
- package/dist/federation/SecurityManager.d.ts.map +1 -0
- package/dist/federation/SecurityManager.js +1 -0
- package/dist/federation/SecurityManager.js.map +1 -0
- package/dist/federation/debug/agent-debug-stream.d.ts +171 -0
- package/dist/federation/debug/agent-debug-stream.d.ts.map +1 -0
- package/dist/federation/debug/agent-debug-stream.js +1 -0
- package/dist/federation/debug/agent-debug-stream.js.map +1 -0
- package/dist/federation/debug/debug-stream.d.ts +157 -0
- package/dist/federation/debug/debug-stream.d.ts.map +1 -0
- package/dist/federation/debug/debug-stream.js +1 -0
- package/dist/federation/debug/debug-stream.js.map +1 -0
- package/dist/federation/index.d.ts +13 -0
- package/dist/federation/index.d.ts.map +1 -0
- package/dist/federation/index.js +1 -0
- package/dist/federation/index.js.map +1 -0
- package/dist/federation/integrations/realtime-federation.d.ts +144 -0
- package/dist/federation/integrations/realtime-federation.d.ts.map +1 -0
- package/dist/federation/integrations/realtime-federation.js +1 -0
- package/dist/federation/integrations/realtime-federation.js.map +1 -0
- package/dist/federation/integrations/supabase-adapter-debug.d.ts +91 -0
- package/dist/federation/integrations/supabase-adapter-debug.d.ts.map +1 -0
- package/dist/federation/integrations/supabase-adapter-debug.js +1 -0
- package/dist/federation/integrations/supabase-adapter-debug.js.map +1 -0
- package/dist/federation/integrations/supabase-adapter.d.ts +89 -0
- package/dist/federation/integrations/supabase-adapter.d.ts.map +1 -0
- package/dist/federation/integrations/supabase-adapter.js +1 -0
- package/dist/federation/integrations/supabase-adapter.js.map +1 -0
- package/dist/health.d.ts +28 -0
- package/dist/health.d.ts.map +1 -0
- package/dist/health.js +1 -0
- package/dist/health.js.map +1 -0
- package/dist/hooks/parallel-validation.d.ts +51 -0
- package/dist/hooks/parallel-validation.d.ts.map +1 -0
- package/dist/hooks/parallel-validation.js +1 -0
- package/dist/hooks/parallel-validation.js.map +1 -0
- package/dist/hooks/swarm-learning-optimizer.d.ts +89 -0
- package/dist/hooks/swarm-learning-optimizer.d.ts.map +1 -0
- package/dist/hooks/swarm-learning-optimizer.js +1 -0
- package/dist/hooks/swarm-learning-optimizer.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/claudeFlowSdkServer.d.ts +6 -0
- package/dist/mcp/claudeFlowSdkServer.d.ts.map +1 -0
- package/dist/mcp/claudeFlowSdkServer.js +1 -0
- package/dist/mcp/claudeFlowSdkServer.js.map +1 -0
- package/dist/mcp/fastmcp/servers/claude-flow-sdk.d.ts +3 -0
- package/dist/mcp/fastmcp/servers/claude-flow-sdk.d.ts.map +1 -0
- package/dist/mcp/fastmcp/servers/claude-flow-sdk.js +1 -0
- package/dist/mcp/fastmcp/servers/claude-flow-sdk.js.map +1 -0
- package/dist/mcp/fastmcp/servers/http-sse.d.ts +3 -0
- package/dist/mcp/fastmcp/servers/http-sse.d.ts.map +1 -0
- package/dist/mcp/fastmcp/servers/http-sse.js +1 -0
- package/dist/mcp/fastmcp/servers/http-sse.js.map +1 -0
- package/dist/mcp/fastmcp/servers/http-streaming-updated.d.ts +3 -0
- package/dist/mcp/fastmcp/servers/http-streaming-updated.d.ts.map +1 -0
- package/dist/mcp/fastmcp/servers/http-streaming-updated.js +1 -0
- package/dist/mcp/fastmcp/servers/http-streaming-updated.js.map +1 -0
- package/dist/mcp/fastmcp/servers/poc-stdio.d.ts +3 -0
- package/dist/mcp/fastmcp/servers/poc-stdio.d.ts.map +1 -0
- package/dist/mcp/fastmcp/servers/poc-stdio.js +1 -0
- package/dist/mcp/fastmcp/servers/poc-stdio.js.map +1 -0
- package/dist/mcp/fastmcp/servers/stdio-full.d.ts +3 -0
- package/dist/mcp/fastmcp/servers/stdio-full.d.ts.map +1 -0
- package/dist/mcp/fastmcp/servers/stdio-full.js +1 -0
- package/dist/mcp/fastmcp/servers/stdio-full.js.map +1 -0
- package/dist/mcp/fastmcp/tools/agent/add-agent.d.ts +3 -0
- package/dist/mcp/fastmcp/tools/agent/add-agent.d.ts.map +1 -0
- package/dist/mcp/fastmcp/tools/agent/add-agent.js +1 -0
- package/dist/mcp/fastmcp/tools/agent/add-agent.js.map +1 -0
- package/dist/mcp/fastmcp/tools/agent/add-command.d.ts +3 -0
- package/dist/mcp/fastmcp/tools/agent/add-command.d.ts.map +1 -0
- package/dist/mcp/fastmcp/tools/agent/add-command.js +1 -0
- package/dist/mcp/fastmcp/tools/agent/add-command.js.map +1 -0
- package/dist/mcp/fastmcp/tools/agent/execute.d.ts +3 -0
- package/dist/mcp/fastmcp/tools/agent/execute.d.ts.map +1 -0
- package/dist/mcp/fastmcp/tools/agent/execute.js +1 -0
- package/dist/mcp/fastmcp/tools/agent/execute.js.map +1 -0
- package/dist/mcp/fastmcp/tools/agent/list.d.ts +3 -0
- package/dist/mcp/fastmcp/tools/agent/list.d.ts.map +1 -0
- package/dist/mcp/fastmcp/tools/agent/list.js +1 -0
- package/dist/mcp/fastmcp/tools/agent/list.js.map +1 -0
- package/dist/mcp/fastmcp/tools/agent/parallel.d.ts +3 -0
- package/dist/mcp/fastmcp/tools/agent/parallel.d.ts.map +1 -0
- package/dist/mcp/fastmcp/tools/agent/parallel.js +1 -0
- package/dist/mcp/fastmcp/tools/agent/parallel.js.map +1 -0
- package/dist/mcp/fastmcp/tools/swarm/init.d.ts +3 -0
- package/dist/mcp/fastmcp/tools/swarm/init.d.ts.map +1 -0
- package/dist/mcp/fastmcp/tools/swarm/init.js +1 -0
- package/dist/mcp/fastmcp/tools/swarm/init.js.map +1 -0
- package/dist/mcp/fastmcp/tools/swarm/orchestrate.d.ts +3 -0
- package/dist/mcp/fastmcp/tools/swarm/orchestrate.d.ts.map +1 -0
- package/dist/mcp/fastmcp/tools/swarm/orchestrate.js +1 -0
- package/dist/mcp/fastmcp/tools/swarm/orchestrate.js.map +1 -0
- package/dist/mcp/fastmcp/tools/swarm/spawn.d.ts +3 -0
- package/dist/mcp/fastmcp/tools/swarm/spawn.d.ts.map +1 -0
- package/dist/mcp/fastmcp/tools/swarm/spawn.js +1 -0
- package/dist/mcp/fastmcp/tools/swarm/spawn.js.map +1 -0
- package/dist/mcp/fastmcp/types/index.d.ts +33 -0
- package/dist/mcp/fastmcp/types/index.d.ts.map +1 -0
- package/dist/mcp/fastmcp/types/index.js +1 -0
- package/dist/mcp/fastmcp/types/index.js.map +1 -0
- package/dist/mcp/standalone-stdio.d.ts +3 -0
- package/dist/mcp/standalone-stdio.d.ts.map +1 -0
- package/dist/mcp/standalone-stdio.js +1 -0
- package/dist/mcp/standalone-stdio.js.map +1 -0
- package/dist/memory/SharedMemoryPool.d.ts +116 -0
- package/dist/memory/SharedMemoryPool.d.ts.map +1 -0
- package/dist/memory/SharedMemoryPool.js +1 -0
- package/dist/memory/SharedMemoryPool.js.map +1 -0
- package/dist/memory/index.d.ts +8 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +1 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/proxy/adaptive-proxy.d.ts +51 -0
- package/dist/proxy/adaptive-proxy.d.ts.map +1 -0
- package/dist/proxy/adaptive-proxy.js +1 -0
- package/dist/proxy/adaptive-proxy.js.map +1 -0
- package/dist/proxy/anthropic-to-gemini.d.ts +20 -0
- package/dist/proxy/anthropic-to-gemini.d.ts.map +1 -0
- package/dist/proxy/anthropic-to-gemini.js +1 -0
- package/dist/proxy/anthropic-to-gemini.js.map +1 -0
- package/dist/proxy/anthropic-to-onnx.d.ts +17 -0
- package/dist/proxy/anthropic-to-onnx.d.ts.map +1 -0
- package/dist/proxy/anthropic-to-onnx.js +1 -0
- package/dist/proxy/anthropic-to-onnx.js.map +1 -0
- package/dist/proxy/anthropic-to-openrouter.d.ts +28 -0
- package/dist/proxy/anthropic-to-openrouter.d.ts.map +1 -0
- package/dist/proxy/anthropic-to-openrouter.js +1 -0
- package/dist/proxy/anthropic-to-openrouter.js.map +1 -0
- package/dist/proxy/anthropic-to-requesty.d.ts +33 -0
- package/dist/proxy/anthropic-to-requesty.d.ts.map +1 -0
- package/dist/proxy/anthropic-to-requesty.js +1 -0
- package/dist/proxy/anthropic-to-requesty.js.map +1 -0
- package/dist/proxy/http2-proxy-optimized.d.ts +63 -0
- package/dist/proxy/http2-proxy-optimized.d.ts.map +1 -0
- package/dist/proxy/http2-proxy-optimized.js +1 -0
- package/dist/proxy/http2-proxy-optimized.js.map +1 -0
- package/dist/proxy/http2-proxy.d.ts +43 -0
- package/dist/proxy/http2-proxy.d.ts.map +1 -0
- package/dist/proxy/http2-proxy.js +1 -0
- package/dist/proxy/http2-proxy.js.map +1 -0
- package/dist/proxy/http3-proxy.d.ts +18 -0
- package/dist/proxy/http3-proxy.d.ts.map +1 -0
- package/dist/proxy/http3-proxy.js +1 -0
- package/dist/proxy/http3-proxy.js.map +1 -0
- package/dist/proxy/provider-instructions.d.ts +37 -0
- package/dist/proxy/provider-instructions.d.ts.map +1 -0
- package/dist/proxy/provider-instructions.js +1 -0
- package/dist/proxy/provider-instructions.js.map +1 -0
- package/dist/proxy/quic-proxy.d.ts +58 -0
- package/dist/proxy/quic-proxy.d.ts.map +1 -0
- package/dist/proxy/quic-proxy.js +1 -0
- package/dist/proxy/quic-proxy.js.map +1 -0
- package/dist/proxy/tool-emulation.d.ts +121 -0
- package/dist/proxy/tool-emulation.d.ts.map +1 -0
- package/dist/proxy/tool-emulation.js +1 -0
- package/dist/proxy/tool-emulation.js.map +1 -0
- package/dist/proxy/websocket-proxy.d.ts +39 -0
- package/dist/proxy/websocket-proxy.d.ts.map +1 -0
- package/dist/proxy/websocket-proxy.js +1 -0
- package/dist/proxy/websocket-proxy.js.map +1 -0
- package/dist/reasoningbank/AdvancedMemory.d.ts +120 -0
- package/dist/reasoningbank/AdvancedMemory.d.ts.map +1 -0
- package/dist/reasoningbank/AdvancedMemory.js +1 -0
- package/dist/reasoningbank/AdvancedMemory.js.map +1 -0
- package/dist/reasoningbank/HybridBackend.d.ts +99 -0
- package/dist/reasoningbank/HybridBackend.d.ts.map +1 -0
- package/dist/reasoningbank/HybridBackend.js +1 -0
- package/dist/reasoningbank/HybridBackend.js.map +1 -0
- package/dist/reasoningbank/backend-selector.d.ts +79 -0
- package/dist/reasoningbank/backend-selector.d.ts.map +1 -0
- package/dist/reasoningbank/backend-selector.js +1 -0
- package/dist/reasoningbank/backend-selector.js.map +1 -0
- package/dist/reasoningbank/benchmark.d.ts +14 -0
- package/dist/reasoningbank/benchmark.d.ts.map +1 -0
- package/dist/reasoningbank/benchmark.js +1 -0
- package/dist/reasoningbank/benchmark.js.map +1 -0
- package/dist/reasoningbank/config/reasoningbank-types.d.ts +57 -0
- package/dist/reasoningbank/config/reasoningbank-types.d.ts.map +1 -0
- package/dist/reasoningbank/config/reasoningbank-types.js +1 -0
- package/dist/reasoningbank/config/reasoningbank-types.js.map +1 -0
- package/dist/reasoningbank/core/consolidate.d.ts +21 -0
- package/dist/reasoningbank/core/consolidate.d.ts.map +1 -0
- package/dist/reasoningbank/core/consolidate.js +1 -0
- package/dist/reasoningbank/core/consolidate.js.map +1 -0
- package/dist/reasoningbank/core/distill.d.ts +22 -0
- package/dist/reasoningbank/core/distill.d.ts.map +1 -0
- package/dist/reasoningbank/core/distill.js +1 -0
- package/dist/reasoningbank/core/distill.js.map +1 -0
- package/dist/reasoningbank/core/judge.d.ts +17 -0
- package/dist/reasoningbank/core/judge.d.ts.map +1 -0
- package/dist/reasoningbank/core/judge.js +1 -0
- package/dist/reasoningbank/core/judge.js.map +1 -0
- package/dist/reasoningbank/core/matts.d.ts +46 -0
- package/dist/reasoningbank/core/matts.d.ts.map +1 -0
- package/dist/reasoningbank/core/matts.js +1 -0
- package/dist/reasoningbank/core/matts.js.map +1 -0
- package/dist/reasoningbank/core/retrieve.d.ts +35 -0
- package/dist/reasoningbank/core/retrieve.d.ts.map +1 -0
- package/dist/reasoningbank/core/retrieve.js +1 -0
- package/dist/reasoningbank/core/retrieve.js.map +1 -0
- package/dist/reasoningbank/db/queries.d.ts +88 -0
- package/dist/reasoningbank/db/queries.d.ts.map +1 -0
- package/dist/reasoningbank/db/queries.js +1 -0
- package/dist/reasoningbank/db/queries.js.map +1 -0
- package/dist/reasoningbank/db/schema.d.ts +81 -0
- package/dist/reasoningbank/db/schema.d.ts.map +1 -0
- package/dist/reasoningbank/db/schema.js +1 -0
- package/dist/reasoningbank/db/schema.js.map +1 -0
- package/dist/reasoningbank/demo-comparison.d.ts +10 -0
- package/dist/reasoningbank/demo-comparison.d.ts.map +1 -0
- package/dist/reasoningbank/demo-comparison.js +1 -0
- package/dist/reasoningbank/demo-comparison.js.map +1 -0
- package/dist/reasoningbank/hooks/post-task.d.ts +9 -0
- package/dist/reasoningbank/hooks/post-task.d.ts.map +1 -0
- package/dist/reasoningbank/hooks/post-task.js +1 -0
- package/dist/reasoningbank/hooks/post-task.js.map +1 -0
- package/dist/reasoningbank/hooks/pre-task.d.ts +9 -0
- package/dist/reasoningbank/hooks/pre-task.d.ts.map +1 -0
- package/dist/reasoningbank/hooks/pre-task.js +1 -0
- package/dist/reasoningbank/hooks/pre-task.js.map +1 -0
- package/dist/reasoningbank/index-new.d.ts +49 -0
- package/dist/reasoningbank/index-new.d.ts.map +1 -0
- package/dist/reasoningbank/index-new.js +1 -0
- package/dist/reasoningbank/index-new.js.map +1 -0
- package/dist/reasoningbank/index.d.ts +50 -0
- package/dist/reasoningbank/index.d.ts.map +1 -0
- package/dist/reasoningbank/index.js +1 -0
- package/dist/reasoningbank/index.js.map +1 -0
- package/dist/reasoningbank/test-integration.d.ts +7 -0
- package/dist/reasoningbank/test-integration.d.ts.map +1 -0
- package/dist/reasoningbank/test-integration.js +1 -0
- package/dist/reasoningbank/test-integration.js.map +1 -0
- package/dist/reasoningbank/test-retrieval.d.ts +6 -0
- package/dist/reasoningbank/test-retrieval.d.ts.map +1 -0
- package/dist/reasoningbank/test-retrieval.js +1 -0
- package/dist/reasoningbank/test-retrieval.js.map +1 -0
- package/dist/reasoningbank/test-validation.d.ts +7 -0
- package/dist/reasoningbank/test-validation.d.ts.map +1 -0
- package/dist/reasoningbank/test-validation.js +1 -0
- package/dist/reasoningbank/test-validation.js.map +1 -0
- package/dist/reasoningbank/types/index.d.ts +123 -0
- package/dist/reasoningbank/types/index.d.ts.map +1 -0
- package/dist/reasoningbank/types/index.js +1 -0
- package/dist/reasoningbank/types/index.js.map +1 -0
- package/dist/reasoningbank/utils/config.d.ts +61 -0
- package/dist/reasoningbank/utils/config.d.ts.map +1 -0
- package/dist/reasoningbank/utils/config.js +1 -0
- package/dist/reasoningbank/utils/config.js.map +1 -0
- package/dist/reasoningbank/utils/embeddings.d.ts +21 -0
- package/dist/reasoningbank/utils/embeddings.d.ts.map +1 -0
- package/dist/reasoningbank/utils/embeddings.js +1 -0
- package/dist/reasoningbank/utils/embeddings.js.map +1 -0
- package/dist/reasoningbank/utils/mmr.d.ts +23 -0
- package/dist/reasoningbank/utils/mmr.d.ts.map +1 -0
- package/dist/reasoningbank/utils/mmr.js +1 -0
- package/dist/reasoningbank/utils/mmr.js.map +1 -0
- package/dist/reasoningbank/utils/pii-scrubber.d.ts +46 -0
- package/dist/reasoningbank/utils/pii-scrubber.d.ts.map +1 -0
- package/dist/reasoningbank/utils/pii-scrubber.js +1 -0
- package/dist/reasoningbank/utils/pii-scrubber.js.map +1 -0
- package/dist/reasoningbank/wasm-adapter.d.ts +104 -0
- package/dist/reasoningbank/wasm-adapter.d.ts.map +1 -0
- package/dist/reasoningbank/wasm-adapter.js +1 -0
- package/dist/reasoningbank/wasm-adapter.js.map +1 -0
- package/dist/router/model-mapping.d.ts +31 -0
- package/dist/router/model-mapping.d.ts.map +1 -0
- package/dist/router/model-mapping.js +1 -0
- package/dist/router/model-mapping.js.map +1 -0
- package/dist/router/providers/anthropic.d.ts +17 -0
- package/dist/router/providers/anthropic.d.ts.map +1 -0
- package/dist/router/providers/anthropic.js +1 -0
- package/dist/router/providers/anthropic.js.map +1 -0
- package/dist/router/providers/gemini.d.ts +17 -0
- package/dist/router/providers/gemini.d.ts.map +1 -0
- package/dist/router/providers/gemini.js +1 -0
- package/dist/router/providers/gemini.js.map +1 -0
- package/dist/router/providers/onnx-local-optimized.d.ts +71 -0
- package/dist/router/providers/onnx-local-optimized.d.ts.map +1 -0
- package/dist/router/providers/onnx-local-optimized.js +1 -0
- package/dist/router/providers/onnx-local-optimized.js.map +1 -0
- package/dist/router/providers/onnx-local.d.ts +75 -0
- package/dist/router/providers/onnx-local.d.ts.map +1 -0
- package/dist/router/providers/onnx-local.js +1 -0
- package/dist/router/providers/onnx-local.js.map +1 -0
- package/dist/router/providers/onnx-phi4.d.ts +64 -0
- package/dist/router/providers/onnx-phi4.d.ts.map +1 -0
- package/dist/router/providers/onnx-phi4.js +1 -0
- package/dist/router/providers/onnx-phi4.js.map +1 -0
- package/dist/router/providers/onnx.d.ts +65 -0
- package/dist/router/providers/onnx.d.ts.map +1 -0
- package/dist/router/providers/onnx.js +1 -0
- package/dist/router/providers/onnx.js.map +1 -0
- package/dist/router/providers/openrouter.d.ts +21 -0
- package/dist/router/providers/openrouter.d.ts.map +1 -0
- package/dist/router/providers/openrouter.js +1 -0
- package/dist/router/providers/openrouter.js.map +1 -0
- package/dist/router/router.d.ts +26 -0
- package/dist/router/router.d.ts.map +1 -0
- package/dist/router/router.js +1 -0
- package/dist/router/router.js.map +1 -0
- package/dist/router/test-integration.d.ts +13 -0
- package/dist/router/test-integration.d.ts.map +1 -0
- package/dist/router/test-integration.js +1 -0
- package/dist/router/test-integration.js.map +1 -0
- package/dist/router/test-onnx-benchmark.d.ts +7 -0
- package/dist/router/test-onnx-benchmark.d.ts.map +1 -0
- package/dist/router/test-onnx-benchmark.js +1 -0
- package/dist/router/test-onnx-benchmark.js.map +1 -0
- package/dist/router/test-onnx-integration.d.ts +8 -0
- package/dist/router/test-onnx-integration.d.ts.map +1 -0
- package/dist/router/test-onnx-integration.js +1 -0
- package/dist/router/test-onnx-integration.js.map +1 -0
- package/dist/router/test-onnx-local.d.ts +6 -0
- package/dist/router/test-onnx-local.d.ts.map +1 -0
- package/dist/router/test-onnx-local.js +1 -0
- package/dist/router/test-onnx-local.js.map +1 -0
- package/dist/router/test-onnx.d.ts +7 -0
- package/dist/router/test-onnx.d.ts.map +1 -0
- package/dist/router/test-onnx.js +1 -0
- package/dist/router/test-onnx.js.map +1 -0
- package/dist/router/test-openrouter.d.ts +3 -0
- package/dist/router/test-openrouter.d.ts.map +1 -0
- package/dist/router/test-openrouter.js +1 -0
- package/dist/router/test-openrouter.js.map +1 -0
- package/dist/router/test-phi4.d.ts +6 -0
- package/dist/router/test-phi4.d.ts.map +1 -0
- package/dist/router/test-phi4.js +1 -0
- package/dist/router/test-phi4.js.map +1 -0
- package/dist/router/types.d.ts +209 -0
- package/dist/router/types.d.ts.map +1 -0
- package/dist/router/types.js +1 -0
- package/dist/router/types.js.map +1 -0
- package/dist/swarm/index.d.ts +51 -0
- package/dist/swarm/index.d.ts.map +1 -0
- package/dist/swarm/index.js +1 -0
- package/dist/swarm/index.js.map +1 -0
- package/dist/swarm/quic-coordinator.d.ts +149 -0
- package/dist/swarm/quic-coordinator.d.ts.map +1 -0
- package/dist/swarm/quic-coordinator.js +1 -0
- package/dist/swarm/quic-coordinator.js.map +1 -0
- package/dist/swarm/transport-router.d.ts +124 -0
- package/dist/swarm/transport-router.d.ts.map +1 -0
- package/dist/swarm/transport-router.js +1 -0
- package/dist/swarm/transport-router.js.map +1 -0
- package/dist/transport/index.d.ts +2 -0
- package/dist/transport/index.d.ts.map +1 -0
- package/dist/transport/index.js +1 -0
- package/dist/transport/index.js.map +1 -0
- package/dist/transport/quic-handshake.d.ts +66 -0
- package/dist/transport/quic-handshake.d.ts.map +1 -0
- package/dist/transport/quic-handshake.js +1 -0
- package/dist/transport/quic-handshake.js.map +1 -0
- package/dist/transport/quic.d.ts +184 -0
- package/dist/transport/quic.d.ts.map +1 -0
- package/dist/transport/quic.js +1 -0
- package/dist/transport/quic.js.map +1 -0
- package/dist/utils/adaptive-pool-sizing.js +414 -0
- package/dist/utils/agentBoosterPreprocessor.d.ts +72 -0
- package/dist/utils/agentBoosterPreprocessor.d.ts.map +1 -0
- package/dist/utils/agentBoosterPreprocessor.js +1 -0
- package/dist/utils/agentBoosterPreprocessor.js.map +1 -0
- package/dist/utils/agentLoader.d.ts +22 -0
- package/dist/utils/agentLoader.d.ts.map +1 -0
- package/dist/utils/agentLoader.js +1 -0
- package/dist/utils/agentLoader.js.map +1 -0
- package/dist/utils/agentdb-runtime-patch.d.ts +28 -0
- package/dist/utils/agentdb-runtime-patch.d.ts.map +1 -0
- package/dist/utils/agentdb-runtime-patch.js +1 -0
- package/dist/utils/agentdb-runtime-patch.js.map +1 -0
- package/dist/utils/auth.d.ts +13 -0
- package/dist/utils/auth.d.ts.map +1 -0
- package/dist/utils/auth.js +1 -0
- package/dist/utils/auth.js.map +1 -0
- package/dist/utils/circular-rate-limiter.js +391 -0
- package/dist/utils/cli.d.ts +31 -0
- package/dist/utils/cli.d.ts.map +1 -0
- package/dist/utils/cli.js +1 -0
- package/dist/utils/cli.js.map +1 -0
- package/dist/utils/compression-middleware.d.ts +55 -0
- package/dist/utils/compression-middleware.d.ts.map +1 -0
- package/dist/utils/compression-middleware.js +1 -0
- package/dist/utils/compression-middleware.js.map +1 -0
- package/dist/utils/connection-pool.d.ts +30 -0
- package/dist/utils/connection-pool.d.ts.map +1 -0
- package/dist/utils/connection-pool.js +1 -0
- package/dist/utils/connection-pool.js.map +1 -0
- package/dist/utils/dynamic-compression.js +298 -0
- package/dist/utils/http2-multiplexing.js +319 -0
- package/dist/utils/lazy-auth.js +311 -0
- package/dist/utils/logger.d.ts +19 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +1 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/math.d.ts +12 -0
- package/dist/utils/math.d.ts.map +1 -0
- package/dist/utils/math.js +1 -0
- package/dist/utils/math.js.map +1 -0
- package/dist/utils/mcpCommands.d.ts +2 -0
- package/dist/utils/mcpCommands.d.ts.map +1 -0
- package/dist/utils/mcpCommands.js +1 -0
- package/dist/utils/mcpCommands.js.map +1 -0
- package/dist/utils/model-downloader.d.ts +63 -0
- package/dist/utils/model-downloader.d.ts.map +1 -0
- package/dist/utils/model-downloader.js +1 -0
- package/dist/utils/model-downloader.js.map +1 -0
- package/dist/utils/modelCapabilities.d.ts +30 -0
- package/dist/utils/modelCapabilities.d.ts.map +1 -0
- package/dist/utils/modelCapabilities.js +1 -0
- package/dist/utils/modelCapabilities.js.map +1 -0
- package/dist/utils/modelOptimizer.d.ts +207 -0
- package/dist/utils/modelOptimizer.d.ts.map +1 -0
- package/dist/utils/modelOptimizer.js +1 -0
- package/dist/utils/modelOptimizer.js.map +1 -0
- package/dist/utils/rate-limiter.d.ts +17 -0
- package/dist/utils/rate-limiter.d.ts.map +1 -0
- package/dist/utils/rate-limiter.js +1 -0
- package/dist/utils/rate-limiter.js.map +1 -0
- package/dist/utils/reasoningbankCommands.d.ts +6 -0
- package/dist/utils/reasoningbankCommands.d.ts.map +1 -0
- package/dist/utils/reasoningbankCommands.js +1 -0
- package/dist/utils/reasoningbankCommands.js.map +1 -0
- package/dist/utils/response-cache.d.ts +94 -0
- package/dist/utils/response-cache.d.ts.map +1 -0
- package/dist/utils/response-cache.js +1 -0
- package/dist/utils/response-cache.js.map +1 -0
- package/dist/utils/retry.d.ts +9 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +1 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/utils/server-push.js +251 -0
- package/dist/utils/streaming-optimizer.d.ts +37 -0
- package/dist/utils/streaming-optimizer.d.ts.map +1 -0
- package/dist/utils/streaming-optimizer.js +1 -0
- package/dist/utils/streaming-optimizer.js.map +1 -0
- package/dist/utils/zero-copy-buffer.js +286 -0
- package/docs/DOCKER-VERIFICATION.md +207 -0
- package/docs/ISSUE-55-VALIDATION.md +25 -6
- package/docs/NPX_AGENTDB_SETUP.md +175 -0
- package/docs/PUBLISH_GUIDE.md +438 -0
- package/docs/RELEASE-v1.10.0-COMPLETE.md +382 -0
- package/docs/archive/.agentdb-instructions.md +66 -0
- package/docs/archive/AGENT-BOOSTER-STATUS.md +292 -0
- package/docs/archive/CHANGELOG-v1.3.0.md +120 -0
- package/docs/archive/COMPLETION_REPORT_v1.7.1.md +335 -0
- package/docs/archive/IMPLEMENTATION_SUMMARY_v1.7.1.md +241 -0
- package/docs/archive/SUPABASE-INTEGRATION-COMPLETE.md +357 -0
- package/docs/archive/TESTING_QUICK_START.md +223 -0
- package/docs/archive/TOOL-EMULATION-INTEGRATION-ISSUE.md +669 -0
- package/docs/archive/VALIDATION_v1.7.1.md +234 -0
- package/docs/releases/PUBLISH_CHECKLIST_v1.10.0.md +396 -0
- package/docs/releases/PUBLISH_SUMMARY_v1.7.1.md +198 -0
- package/docs/releases/RELEASE_NOTES_v1.10.0.md +464 -0
- package/docs/releases/RELEASE_NOTES_v1.7.0.md +297 -0
- package/docs/releases/RELEASE_v1.7.1.md +327 -0
- package/package.json +1 -1
- package/validation/docker-npm-validation.sh +170 -0
- package/validation/simple-npm-validation.sh +131 -0
- package/validation/test-gemini-models.ts +200 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection-pool.js","sourceRoot":"","sources":["../../src/utils/connection-pool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAgBrC,MAAM,OAAO,cAAc;IACjB,KAAK,GAAoC,IAAI,GAAG,EAAE,CAAC;IACnD,MAAM,CAAa;IACnB,eAAe,CAAiB;IAExC,YAAY,SAA8B,EAAE;QAC1C,IAAI,CAAC,MAAM,GAAG;YACZ,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,EAAE;YAC7B,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,KAAK,EAAE,aAAa;YACvD,cAAc,EAAE,MAAM,CAAC,cAAc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C,gCAAgC,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;IAED,OAAO;QACL,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAEpC,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;YAChD,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;gBACxB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;oBACzB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;gBACvB,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IAC3C,CAAC;IAED,QAAQ;QACN,MAAM,KAAK,GAAkE,EAAE,CAAC;QAEhF,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;YAChD,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;YAC7C,KAAK,CAAC,IAAI,CAAC,GAAG;gBACZ,KAAK,EAAE,IAAI,CAAC,MAAM;gBAClB,IAAI;gBACJ,IAAI,EAAE,IAAI,CAAC,MAAM,GAAG,IAAI;aACzB,CAAC;QACJ,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF","sourcesContent":["/**\n * Connection Pool for HTTP/2 and HTTP/3 Proxies\n * Provides connection reuse to reduce latency by 20-30%\n */\n\nimport http2 from 'http2';\nimport { logger } from './logger.js';\n\nexport interface PoolConfig {\n maxSize: number;\n maxIdleTime: number;\n acquireTimeout: number;\n}\n\ninterface PooledConnection {\n session: http2.ClientHttp2Session;\n host: string;\n busy: boolean;\n createdAt: number;\n lastUsed: number;\n}\n\nexport class ConnectionPool {\n private pools: Map<string, PooledConnection[]> = new Map();\n private config: PoolConfig;\n private cleanupInterval: NodeJS.Timeout;\n\n constructor(config: Partial<PoolConfig> = {}) {\n this.config = {\n maxSize: config.maxSize || 10,\n maxIdleTime: config.maxIdleTime || 60000, // 60 seconds\n acquireTimeout: config.acquireTimeout || 5000 // 5 seconds\n };\n\n // Cleanup expired connections every 30 seconds\n this.cleanupInterval = setInterval(() => {\n this.cleanup();\n }, 30000);\n }\n\n async acquire(host: string): Promise<http2.ClientHttp2Session> {\n const pool = this.pools.get(host) || [];\n const now = Date.now();\n\n // Find idle, non-expired connection\n const idle = pool.find(c =>\n !c.busy &&\n !this.isExpired(c, now) &&\n !c.session.closed &&\n !c.session.destroyed\n );\n\n if (idle) {\n idle.busy = true;\n idle.lastUsed = now;\n logger.debug('Reusing pooled connection', { host, poolSize: pool.length });\n return idle.session;\n }\n\n // Create new if under limit\n if (pool.length < this.config.maxSize) {\n const session = await this.createConnection(host);\n const conn: PooledConnection = {\n session,\n host,\n busy: true,\n createdAt: now,\n lastUsed: now\n };\n\n pool.push(conn);\n this.pools.set(host, pool);\n\n logger.debug('Created new pooled connection', {\n host,\n poolSize: pool.length,\n maxSize: this.config.maxSize\n });\n\n return session;\n }\n\n // Wait for available connection\n logger.debug('Pool full, waiting for connection', { host, poolSize: pool.length });\n return this.waitForConnection(host);\n }\n\n async release(session: http2.ClientHttp2Session, host: string): Promise<void> {\n const pool = this.pools.get(host);\n if (!pool) return;\n\n const conn = pool.find(c => c.session === session);\n if (conn) {\n conn.busy = false;\n conn.lastUsed = Date.now();\n logger.debug('Released pooled connection', { host });\n }\n }\n\n private async createConnection(host: string): Promise<http2.ClientHttp2Session> {\n return new Promise((resolve, reject) => {\n const session = http2.connect(host, {\n maxSessionMemory: 10 // 10MB per session\n });\n\n session.once('connect', () => {\n logger.info('HTTP/2 session connected', { host });\n resolve(session);\n });\n\n session.once('error', (error) => {\n logger.error('HTTP/2 session error', { host, error: error.message });\n reject(error);\n });\n\n // Cleanup on session close\n session.once('close', () => {\n this.removeConnection(session, host);\n });\n });\n }\n\n private async waitForConnection(host: string): Promise<http2.ClientHttp2Session> {\n const startTime = Date.now();\n\n return new Promise((resolve, reject) => {\n const checkInterval = setInterval(() => {\n const pool = this.pools.get(host);\n if (!pool) {\n clearInterval(checkInterval);\n reject(new Error('Pool disappeared'));\n return;\n }\n\n const now = Date.now();\n const available = pool.find(c =>\n !c.busy &&\n !this.isExpired(c, now) &&\n !c.session.closed\n );\n\n if (available) {\n clearInterval(checkInterval);\n available.busy = true;\n available.lastUsed = now;\n resolve(available.session);\n return;\n }\n\n if (now - startTime > this.config.acquireTimeout) {\n clearInterval(checkInterval);\n reject(new Error('Connection acquire timeout'));\n }\n }, 100); // Check every 100ms\n });\n }\n\n private isExpired(conn: PooledConnection, now: number): boolean {\n return (now - conn.lastUsed) > this.config.maxIdleTime;\n }\n\n private removeConnection(session: http2.ClientHttp2Session, host: string): void {\n const pool = this.pools.get(host);\n if (!pool) return;\n\n const index = pool.findIndex(c => c.session === session);\n if (index !== -1) {\n pool.splice(index, 1);\n logger.debug('Removed closed connection from pool', { host, poolSize: pool.length });\n }\n\n if (pool.length === 0) {\n this.pools.delete(host);\n }\n }\n\n private cleanup(): void {\n const now = Date.now();\n let removed = 0;\n\n for (const [host, pool] of this.pools.entries()) {\n const before = pool.length;\n\n // Remove expired and closed connections\n const active = pool.filter(c => {\n if (this.isExpired(c, now) || c.session.closed || c.session.destroyed) {\n if (!c.session.closed) {\n c.session.close();\n }\n return false;\n }\n return true;\n });\n\n removed += before - active.length;\n\n if (active.length === 0) {\n this.pools.delete(host);\n } else {\n this.pools.set(host, active);\n }\n }\n\n if (removed > 0) {\n logger.debug('Cleaned up expired connections', { removed });\n }\n }\n\n destroy(): void {\n clearInterval(this.cleanupInterval);\n\n for (const [host, pool] of this.pools.entries()) {\n for (const conn of pool) {\n if (!conn.session.closed) {\n conn.session.close();\n }\n }\n }\n\n this.pools.clear();\n logger.info('Connection pool destroyed');\n }\n\n getStats(): Record<string, { total: number; busy: number; idle: number }> {\n const stats: Record<string, { total: number; busy: number; idle: number }> = {};\n\n for (const [host, pool] of this.pools.entries()) {\n const busy = pool.filter(c => c.busy).length;\n stats[host] = {\n total: pool.length,\n busy,\n idle: pool.length - busy\n };\n }\n\n return stats;\n }\n}\n"]}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dynamic Compression based on CPU
|
|
3
|
+
* Adaptive compression levels based on CPU availability
|
|
4
|
+
* Phase 3 Optimization
|
|
5
|
+
*/
|
|
6
|
+
import * as zlib from 'zlib';
|
|
7
|
+
import { performance } from 'perf_hooks';
|
|
8
|
+
/**
|
|
9
|
+
* Compression levels with CPU costs
|
|
10
|
+
*/
|
|
11
|
+
export const COMPRESSION_LEVELS = {
|
|
12
|
+
gzip: [
|
|
13
|
+
{ level: 1, name: 'fastest', cpuCost: 1, compressionRatio: 3 },
|
|
14
|
+
{ level: 3, name: 'fast', cpuCost: 3, compressionRatio: 5 },
|
|
15
|
+
{ level: 6, name: 'default', cpuCost: 6, compressionRatio: 7 },
|
|
16
|
+
{ level: 9, name: 'best', cpuCost: 10, compressionRatio: 9 }
|
|
17
|
+
],
|
|
18
|
+
brotli: [
|
|
19
|
+
{ level: 1, name: 'fastest', cpuCost: 2, compressionRatio: 4 },
|
|
20
|
+
{ level: 4, name: 'fast', cpuCost: 4, compressionRatio: 6 },
|
|
21
|
+
{ level: 6, name: 'default', cpuCost: 7, compressionRatio: 8 },
|
|
22
|
+
{ level: 11, name: 'best', cpuCost: 10, compressionRatio: 10 }
|
|
23
|
+
]
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Dynamic Compression Manager
|
|
27
|
+
* Adjusts compression levels based on CPU load
|
|
28
|
+
*/
|
|
29
|
+
export class DynamicCompressionManager {
|
|
30
|
+
config;
|
|
31
|
+
stats;
|
|
32
|
+
currentLevelIndex = 1; // Start with 'fast'
|
|
33
|
+
cpuSamples = [];
|
|
34
|
+
monitorInterval;
|
|
35
|
+
constructor(config) {
|
|
36
|
+
this.config = {
|
|
37
|
+
enabled: config.enabled,
|
|
38
|
+
minSize: config.minSize || 1024,
|
|
39
|
+
algorithm: config.algorithm || 'gzip',
|
|
40
|
+
adaptive: config.adaptive !== false,
|
|
41
|
+
cpuThresholdHigh: config.cpuThresholdHigh || 70,
|
|
42
|
+
cpuThresholdLow: config.cpuThresholdLow || 30,
|
|
43
|
+
checkInterval: config.checkInterval || 5000
|
|
44
|
+
};
|
|
45
|
+
this.stats = {
|
|
46
|
+
totalBytes: 0,
|
|
47
|
+
compressedBytes: 0,
|
|
48
|
+
compressionRatio: 1,
|
|
49
|
+
avgCompressionTime: 0,
|
|
50
|
+
currentLevel: this.getCurrentLevel().level,
|
|
51
|
+
levelChanges: 0,
|
|
52
|
+
cpuAdjustments: 0
|
|
53
|
+
};
|
|
54
|
+
if (this.config.adaptive) {
|
|
55
|
+
this.startCPUMonitoring();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Compress data with adaptive level
|
|
60
|
+
*/
|
|
61
|
+
async compress(data) {
|
|
62
|
+
if (!this.config.enabled || data.length < this.config.minSize) {
|
|
63
|
+
return data;
|
|
64
|
+
}
|
|
65
|
+
const startTime = performance.now();
|
|
66
|
+
const level = this.getCurrentLevel();
|
|
67
|
+
let compressed;
|
|
68
|
+
try {
|
|
69
|
+
if (this.config.algorithm === 'brotli') {
|
|
70
|
+
compressed = await this.compressBrotli(data, level.level);
|
|
71
|
+
}
|
|
72
|
+
else if (this.config.algorithm === 'deflate') {
|
|
73
|
+
compressed = await this.compressDeflate(data, level.level);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
compressed = await this.compressGzip(data, level.level);
|
|
77
|
+
}
|
|
78
|
+
// Update statistics
|
|
79
|
+
const compressionTime = performance.now() - startTime;
|
|
80
|
+
this.updateStats(data.length, compressed.length, compressionTime);
|
|
81
|
+
return compressed;
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
// Fallback to uncompressed
|
|
85
|
+
return data;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Compress with gzip
|
|
90
|
+
*/
|
|
91
|
+
compressGzip(data, level) {
|
|
92
|
+
return new Promise((resolve, reject) => {
|
|
93
|
+
zlib.gzip(data, { level }, (err, result) => {
|
|
94
|
+
if (err)
|
|
95
|
+
reject(err);
|
|
96
|
+
else
|
|
97
|
+
resolve(result);
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Compress with brotli
|
|
103
|
+
*/
|
|
104
|
+
compressBrotli(data, level) {
|
|
105
|
+
return new Promise((resolve, reject) => {
|
|
106
|
+
zlib.brotliCompress(data, {
|
|
107
|
+
params: {
|
|
108
|
+
[zlib.constants.BROTLI_PARAM_QUALITY]: level
|
|
109
|
+
}
|
|
110
|
+
}, (err, result) => {
|
|
111
|
+
if (err)
|
|
112
|
+
reject(err);
|
|
113
|
+
else
|
|
114
|
+
resolve(result);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Compress with deflate
|
|
120
|
+
*/
|
|
121
|
+
compressDeflate(data, level) {
|
|
122
|
+
return new Promise((resolve, reject) => {
|
|
123
|
+
zlib.deflate(data, { level }, (err, result) => {
|
|
124
|
+
if (err)
|
|
125
|
+
reject(err);
|
|
126
|
+
else
|
|
127
|
+
resolve(result);
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Get current compression level
|
|
133
|
+
*/
|
|
134
|
+
getCurrentLevel() {
|
|
135
|
+
const levels = COMPRESSION_LEVELS[this.config.algorithm];
|
|
136
|
+
return levels[this.currentLevelIndex] || levels[1];
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Adjust compression level based on CPU
|
|
140
|
+
*/
|
|
141
|
+
adjustLevel(cpuUsage) {
|
|
142
|
+
const levels = COMPRESSION_LEVELS[this.config.algorithm];
|
|
143
|
+
const oldIndex = this.currentLevelIndex;
|
|
144
|
+
if (cpuUsage > this.config.cpuThresholdHigh && this.currentLevelIndex > 0) {
|
|
145
|
+
// CPU high, reduce compression level
|
|
146
|
+
this.currentLevelIndex--;
|
|
147
|
+
this.stats.cpuAdjustments++;
|
|
148
|
+
}
|
|
149
|
+
else if (cpuUsage < this.config.cpuThresholdLow && this.currentLevelIndex < levels.length - 1) {
|
|
150
|
+
// CPU low, increase compression level
|
|
151
|
+
this.currentLevelIndex++;
|
|
152
|
+
this.stats.cpuAdjustments++;
|
|
153
|
+
}
|
|
154
|
+
if (oldIndex !== this.currentLevelIndex) {
|
|
155
|
+
this.stats.levelChanges++;
|
|
156
|
+
this.stats.currentLevel = this.getCurrentLevel().level;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Start CPU monitoring
|
|
161
|
+
*/
|
|
162
|
+
startCPUMonitoring() {
|
|
163
|
+
this.monitorInterval = setInterval(() => {
|
|
164
|
+
const cpuUsage = this.getCPUUsage();
|
|
165
|
+
this.cpuSamples.push(cpuUsage);
|
|
166
|
+
// Keep last 10 samples
|
|
167
|
+
if (this.cpuSamples.length > 10) {
|
|
168
|
+
this.cpuSamples.shift();
|
|
169
|
+
}
|
|
170
|
+
// Calculate average CPU
|
|
171
|
+
const avgCPU = this.cpuSamples.reduce((a, b) => a + b, 0) / this.cpuSamples.length;
|
|
172
|
+
// Adjust compression level
|
|
173
|
+
this.adjustLevel(avgCPU);
|
|
174
|
+
}, this.config.checkInterval);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Get CPU usage percentage
|
|
178
|
+
*/
|
|
179
|
+
getCPUUsage() {
|
|
180
|
+
const cpus = require('os').cpus();
|
|
181
|
+
let totalIdle = 0;
|
|
182
|
+
let totalTick = 0;
|
|
183
|
+
for (const cpu of cpus) {
|
|
184
|
+
for (const type in cpu.times) {
|
|
185
|
+
totalTick += cpu.times[type];
|
|
186
|
+
}
|
|
187
|
+
totalIdle += cpu.times.idle;
|
|
188
|
+
}
|
|
189
|
+
const idle = totalIdle / cpus.length;
|
|
190
|
+
const total = totalTick / cpus.length;
|
|
191
|
+
const usage = 100 - ~~(100 * idle / total);
|
|
192
|
+
return Math.max(0, Math.min(100, usage));
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Update statistics
|
|
196
|
+
*/
|
|
197
|
+
updateStats(originalSize, compressedSize, time) {
|
|
198
|
+
this.stats.totalBytes += originalSize;
|
|
199
|
+
this.stats.compressedBytes += compressedSize;
|
|
200
|
+
this.stats.compressionRatio = this.stats.totalBytes / this.stats.compressedBytes;
|
|
201
|
+
// Update average compression time
|
|
202
|
+
const totalCompressions = this.stats.totalBytes / (originalSize || 1);
|
|
203
|
+
this.stats.avgCompressionTime =
|
|
204
|
+
(this.stats.avgCompressionTime * (totalCompressions - 1) + time) / totalCompressions;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Get statistics
|
|
208
|
+
*/
|
|
209
|
+
getStats() {
|
|
210
|
+
const level = this.getCurrentLevel();
|
|
211
|
+
const avgCPU = this.cpuSamples.length > 0
|
|
212
|
+
? this.cpuSamples.reduce((a, b) => a + b, 0) / this.cpuSamples.length
|
|
213
|
+
: 0;
|
|
214
|
+
return {
|
|
215
|
+
...this.stats,
|
|
216
|
+
currentLevelName: level.name,
|
|
217
|
+
cpuUsage: avgCPU
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Get compression savings
|
|
222
|
+
*/
|
|
223
|
+
getSavings() {
|
|
224
|
+
const byteSavings = this.stats.totalBytes - this.stats.compressedBytes;
|
|
225
|
+
const percentSavings = (byteSavings / this.stats.totalBytes) * 100;
|
|
226
|
+
const mbSaved = byteSavings / (1024 * 1024);
|
|
227
|
+
return {
|
|
228
|
+
byteSavings,
|
|
229
|
+
percentSavings,
|
|
230
|
+
mbSaved
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Manually set compression level
|
|
235
|
+
*/
|
|
236
|
+
setLevel(levelName) {
|
|
237
|
+
const levels = COMPRESSION_LEVELS[this.config.algorithm];
|
|
238
|
+
const index = levels.findIndex(l => l.name === levelName);
|
|
239
|
+
if (index !== -1) {
|
|
240
|
+
this.currentLevelIndex = index;
|
|
241
|
+
this.stats.currentLevel = levels[index].level;
|
|
242
|
+
this.stats.levelChanges++;
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Reset statistics
|
|
249
|
+
*/
|
|
250
|
+
resetStats() {
|
|
251
|
+
this.stats = {
|
|
252
|
+
totalBytes: 0,
|
|
253
|
+
compressedBytes: 0,
|
|
254
|
+
compressionRatio: 1,
|
|
255
|
+
avgCompressionTime: 0,
|
|
256
|
+
currentLevel: this.getCurrentLevel().level,
|
|
257
|
+
levelChanges: 0,
|
|
258
|
+
cpuAdjustments: 0
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Stop CPU monitoring
|
|
263
|
+
*/
|
|
264
|
+
destroy() {
|
|
265
|
+
if (this.monitorInterval) {
|
|
266
|
+
clearInterval(this.monitorInterval);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Content-type aware compression
|
|
272
|
+
*/
|
|
273
|
+
export function shouldCompress(contentType, size, minSize = 1024) {
|
|
274
|
+
if (size < minSize) {
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
const compressibleTypes = [
|
|
278
|
+
'text/',
|
|
279
|
+
'application/json',
|
|
280
|
+
'application/javascript',
|
|
281
|
+
'application/xml',
|
|
282
|
+
'application/x-www-form-urlencoded'
|
|
283
|
+
];
|
|
284
|
+
return compressibleTypes.some(type => contentType.startsWith(type));
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Calculate compression efficiency
|
|
288
|
+
*/
|
|
289
|
+
export function calculateCompressionEfficiency(stats) {
|
|
290
|
+
const timePerMB = stats.avgCompressionTime / ((stats.totalBytes / (1024 * 1024)) || 1);
|
|
291
|
+
const ratioScore = Math.min(100, (stats.compressionRatio - 1) * 10);
|
|
292
|
+
const efficiency = (ratioScore * 0.7) + ((100 - Math.min(100, timePerMB)) * 0.3);
|
|
293
|
+
return {
|
|
294
|
+
efficiency,
|
|
295
|
+
timePerMB,
|
|
296
|
+
ratioScore
|
|
297
|
+
};
|
|
298
|
+
}
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP/2 Multiplexing Optimization
|
|
3
|
+
* Stream prioritization and flow control for concurrent request optimization
|
|
4
|
+
* Phase 2 Optimization
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* HTTP/2 Multiplexing Manager
|
|
8
|
+
* Manages stream prioritization and concurrent request handling
|
|
9
|
+
*/
|
|
10
|
+
export class HTTP2MultiplexingManager {
|
|
11
|
+
config;
|
|
12
|
+
activeStreams = new Map();
|
|
13
|
+
priorityQueues = new Map();
|
|
14
|
+
stats;
|
|
15
|
+
constructor(config) {
|
|
16
|
+
this.config = {
|
|
17
|
+
enabled: config.enabled,
|
|
18
|
+
maxConcurrentStreams: config.maxConcurrentStreams || 100,
|
|
19
|
+
defaultPriority: config.defaultPriority || 16,
|
|
20
|
+
enableFlowControl: config.enableFlowControl !== false,
|
|
21
|
+
initialWindowSize: config.initialWindowSize || 65535
|
|
22
|
+
};
|
|
23
|
+
this.stats = {
|
|
24
|
+
totalStreams: 0,
|
|
25
|
+
activeStreams: 0,
|
|
26
|
+
completedStreams: 0,
|
|
27
|
+
averageDuration: 0,
|
|
28
|
+
priorityChanges: 0
|
|
29
|
+
};
|
|
30
|
+
this.initializePriorityQueues();
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Initialize priority queues (1-256)
|
|
34
|
+
*/
|
|
35
|
+
initializePriorityQueues() {
|
|
36
|
+
for (let i = 1; i <= 256; i++) {
|
|
37
|
+
this.priorityQueues.set(i, new Set());
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Register a new stream
|
|
42
|
+
*/
|
|
43
|
+
registerStream(stream, priority) {
|
|
44
|
+
if (!this.config.enabled)
|
|
45
|
+
return;
|
|
46
|
+
const streamId = stream.id || 0;
|
|
47
|
+
const streamPriority = priority?.weight || this.config.defaultPriority;
|
|
48
|
+
const info = {
|
|
49
|
+
stream,
|
|
50
|
+
priority: streamPriority,
|
|
51
|
+
bytesReceived: 0,
|
|
52
|
+
bytesSent: 0,
|
|
53
|
+
startTime: Date.now(),
|
|
54
|
+
state: 'open'
|
|
55
|
+
};
|
|
56
|
+
this.activeStreams.set(streamId, info);
|
|
57
|
+
this.priorityQueues.get(streamPriority)?.add(streamId);
|
|
58
|
+
this.stats.totalStreams++;
|
|
59
|
+
this.stats.activeStreams++;
|
|
60
|
+
// Set stream priority
|
|
61
|
+
if (priority) {
|
|
62
|
+
this.setPriority(stream, priority);
|
|
63
|
+
}
|
|
64
|
+
// Setup event handlers
|
|
65
|
+
this.setupStreamHandlers(stream, streamId);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Set stream priority
|
|
69
|
+
*/
|
|
70
|
+
setPriority(stream, priority) {
|
|
71
|
+
try {
|
|
72
|
+
stream.priority(priority);
|
|
73
|
+
const streamId = stream.id || 0;
|
|
74
|
+
const info = this.activeStreams.get(streamId);
|
|
75
|
+
if (info) {
|
|
76
|
+
// Move to new priority queue
|
|
77
|
+
const oldPriority = info.priority;
|
|
78
|
+
const newPriority = priority.weight;
|
|
79
|
+
this.priorityQueues.get(oldPriority)?.delete(streamId);
|
|
80
|
+
info.priority = newPriority;
|
|
81
|
+
this.priorityQueues.get(newPriority)?.add(streamId);
|
|
82
|
+
this.stats.priorityChanges++;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
// Stream may be closed
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Adjust stream priority based on load
|
|
91
|
+
*/
|
|
92
|
+
adjustPriority(streamId, adjustment) {
|
|
93
|
+
const info = this.activeStreams.get(streamId);
|
|
94
|
+
if (!info)
|
|
95
|
+
return;
|
|
96
|
+
const newPriority = Math.max(1, Math.min(256, info.priority + adjustment));
|
|
97
|
+
this.setPriority(info.stream, {
|
|
98
|
+
weight: newPriority,
|
|
99
|
+
exclusive: false
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get next stream to process based on priority
|
|
104
|
+
*/
|
|
105
|
+
getNextStream() {
|
|
106
|
+
// Process highest priority streams first (256 is highest)
|
|
107
|
+
for (let priority = 256; priority >= 1; priority--) {
|
|
108
|
+
const queue = this.priorityQueues.get(priority);
|
|
109
|
+
if (queue && queue.size > 0) {
|
|
110
|
+
const streamId = queue.values().next().value;
|
|
111
|
+
if (streamId !== undefined) {
|
|
112
|
+
const info = this.activeStreams.get(streamId);
|
|
113
|
+
if (info && info.state === 'open') {
|
|
114
|
+
return info.stream;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Setup stream event handlers
|
|
123
|
+
*/
|
|
124
|
+
setupStreamHandlers(stream, streamId) {
|
|
125
|
+
stream.on('data', (chunk) => {
|
|
126
|
+
const info = this.activeStreams.get(streamId);
|
|
127
|
+
if (info) {
|
|
128
|
+
info.bytesReceived += chunk.length;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
stream.on('end', () => {
|
|
132
|
+
this.updateStreamState(streamId, 'half-closed');
|
|
133
|
+
});
|
|
134
|
+
stream.on('close', () => {
|
|
135
|
+
this.handleStreamClose(streamId);
|
|
136
|
+
});
|
|
137
|
+
stream.on('error', () => {
|
|
138
|
+
this.handleStreamClose(streamId);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Update stream state
|
|
143
|
+
*/
|
|
144
|
+
updateStreamState(streamId, state) {
|
|
145
|
+
const info = this.activeStreams.get(streamId);
|
|
146
|
+
if (info) {
|
|
147
|
+
info.state = state;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Handle stream closure
|
|
152
|
+
*/
|
|
153
|
+
handleStreamClose(streamId) {
|
|
154
|
+
const info = this.activeStreams.get(streamId);
|
|
155
|
+
if (!info)
|
|
156
|
+
return;
|
|
157
|
+
// Remove from priority queue
|
|
158
|
+
this.priorityQueues.get(info.priority)?.delete(streamId);
|
|
159
|
+
// Update statistics
|
|
160
|
+
const duration = Date.now() - info.startTime;
|
|
161
|
+
this.updateStats(duration);
|
|
162
|
+
// Remove from active streams
|
|
163
|
+
this.activeStreams.delete(streamId);
|
|
164
|
+
this.stats.activeStreams--;
|
|
165
|
+
this.stats.completedStreams++;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Update statistics
|
|
169
|
+
*/
|
|
170
|
+
updateStats(duration) {
|
|
171
|
+
const currentAvg = this.stats.averageDuration;
|
|
172
|
+
const total = this.stats.completedStreams;
|
|
173
|
+
this.stats.averageDuration = (currentAvg * (total - 1) + duration) / total;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Get stream statistics
|
|
177
|
+
*/
|
|
178
|
+
getStreamStats(streamId) {
|
|
179
|
+
const info = this.activeStreams.get(streamId);
|
|
180
|
+
if (!info)
|
|
181
|
+
return null;
|
|
182
|
+
return {
|
|
183
|
+
streamId,
|
|
184
|
+
priority: info.priority,
|
|
185
|
+
bytesReceived: info.bytesReceived,
|
|
186
|
+
bytesSent: info.bytesSent,
|
|
187
|
+
duration: Date.now() - info.startTime,
|
|
188
|
+
state: info.state
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Get all statistics
|
|
193
|
+
*/
|
|
194
|
+
getStats() {
|
|
195
|
+
const priorityDistribution = new Map();
|
|
196
|
+
for (const [priority, queue] of this.priorityQueues) {
|
|
197
|
+
if (queue.size > 0) {
|
|
198
|
+
priorityDistribution.set(priority, queue.size);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
...this.stats,
|
|
203
|
+
priorityDistribution
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Check if can accept more streams
|
|
208
|
+
*/
|
|
209
|
+
canAcceptStream() {
|
|
210
|
+
return this.stats.activeStreams < this.config.maxConcurrentStreams;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Get load percentage
|
|
214
|
+
*/
|
|
215
|
+
getLoad() {
|
|
216
|
+
return (this.stats.activeStreams / this.config.maxConcurrentStreams) * 100;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Flow Control Manager
|
|
221
|
+
* Manages HTTP/2 flow control for optimal throughput
|
|
222
|
+
*/
|
|
223
|
+
export class FlowControlManager {
|
|
224
|
+
windowSizes = new Map();
|
|
225
|
+
config;
|
|
226
|
+
constructor(config) {
|
|
227
|
+
this.config = {
|
|
228
|
+
initialWindowSize: config?.initialWindowSize || 65535,
|
|
229
|
+
maxWindowSize: config?.maxWindowSize || 16777215, // 16MB
|
|
230
|
+
minWindowSize: config?.minWindowSize || 16384 // 16KB
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Initialize window size for a stream
|
|
235
|
+
*/
|
|
236
|
+
initializeWindow(streamId) {
|
|
237
|
+
this.windowSizes.set(streamId, this.config.initialWindowSize);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Update window size
|
|
241
|
+
*/
|
|
242
|
+
updateWindow(streamId, delta) {
|
|
243
|
+
const current = this.windowSizes.get(streamId) || this.config.initialWindowSize;
|
|
244
|
+
const newSize = Math.max(this.config.minWindowSize, Math.min(this.config.maxWindowSize, current + delta));
|
|
245
|
+
this.windowSizes.set(streamId, newSize);
|
|
246
|
+
return newSize;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Get current window size
|
|
250
|
+
*/
|
|
251
|
+
getWindowSize(streamId) {
|
|
252
|
+
return this.windowSizes.get(streamId) || this.config.initialWindowSize;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Calculate optimal window size based on throughput
|
|
256
|
+
*/
|
|
257
|
+
calculateOptimalWindow(throughputBps, rttMs) {
|
|
258
|
+
// Bandwidth-Delay Product
|
|
259
|
+
const bdp = (throughputBps / 8) * (rttMs / 1000);
|
|
260
|
+
return Math.max(this.config.minWindowSize, Math.min(this.config.maxWindowSize, Math.ceil(bdp * 2)));
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Clean up closed stream
|
|
264
|
+
*/
|
|
265
|
+
cleanup(streamId) {
|
|
266
|
+
this.windowSizes.delete(streamId);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Priority scheduler for optimal stream processing
|
|
271
|
+
*/
|
|
272
|
+
export class PriorityScheduler {
|
|
273
|
+
queues = new Map();
|
|
274
|
+
/**
|
|
275
|
+
* Add stream to priority queue
|
|
276
|
+
*/
|
|
277
|
+
enqueue(streamId, priority) {
|
|
278
|
+
if (!this.queues.has(priority)) {
|
|
279
|
+
this.queues.set(priority, []);
|
|
280
|
+
}
|
|
281
|
+
this.queues.get(priority).push(streamId);
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Get next stream to process
|
|
285
|
+
*/
|
|
286
|
+
dequeue() {
|
|
287
|
+
// Process highest priority first
|
|
288
|
+
for (let priority = 256; priority >= 1; priority--) {
|
|
289
|
+
const queue = this.queues.get(priority);
|
|
290
|
+
if (queue && queue.length > 0) {
|
|
291
|
+
return queue.shift();
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return null;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Remove stream from all queues
|
|
298
|
+
*/
|
|
299
|
+
remove(streamId) {
|
|
300
|
+
for (const queue of this.queues.values()) {
|
|
301
|
+
const index = queue.indexOf(streamId);
|
|
302
|
+
if (index !== -1) {
|
|
303
|
+
queue.splice(index, 1);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Get queue sizes
|
|
309
|
+
*/
|
|
310
|
+
getStats() {
|
|
311
|
+
const stats = new Map();
|
|
312
|
+
for (const [priority, queue] of this.queues) {
|
|
313
|
+
if (queue.length > 0) {
|
|
314
|
+
stats.set(priority, queue.length);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return stats;
|
|
318
|
+
}
|
|
319
|
+
}
|