kynjal-cli 4.0.0 → 4.0.1
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/dist/src/appliance/gguf-engine.d.ts +91 -0
- package/dist/src/appliance/gguf-engine.d.ts.map +1 -0
- package/dist/src/appliance/gguf-engine.js +286 -525
- package/dist/src/appliance/gguf-engine.js.map +1 -1
- package/dist/src/appliance/ruvllm-bridge.d.ts +102 -0
- package/dist/src/appliance/ruvllm-bridge.d.ts.map +1 -0
- package/dist/src/appliance/ruvllm-bridge.js +203 -403
- package/dist/src/appliance/ruvllm-bridge.js.map +1 -1
- package/dist/src/appliance/rvfa-builder.d.ts +44 -0
- package/dist/src/appliance/rvfa-builder.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-builder.js +154 -208
- package/dist/src/appliance/rvfa-builder.js.map +1 -1
- package/dist/src/appliance/rvfa-distribution.d.ts +97 -0
- package/dist/src/appliance/rvfa-distribution.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-distribution.js +260 -423
- package/dist/src/appliance/rvfa-distribution.js.map +1 -1
- package/dist/src/appliance/rvfa-format.d.ts +111 -0
- package/dist/src/appliance/rvfa-format.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-format.js +128 -200
- package/dist/src/appliance/rvfa-format.js.map +1 -1
- package/dist/src/appliance/rvfa-runner.d.ts +69 -0
- package/dist/src/appliance/rvfa-runner.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-runner.js +168 -304
- package/dist/src/appliance/rvfa-runner.js.map +1 -1
- package/dist/src/appliance/rvfa-signing.d.ts +123 -0
- package/dist/src/appliance/rvfa-signing.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-signing.js +173 -295
- package/dist/src/appliance/rvfa-signing.js.map +1 -1
- package/dist/src/benchmarks/pretrain/index.d.ts +58 -0
- package/dist/src/benchmarks/pretrain/index.d.ts.map +1 -0
- package/dist/src/benchmarks/pretrain/index.js +331 -542
- package/dist/src/benchmarks/pretrain/index.js.map +1 -1
- package/dist/src/commands/agent.js +574 -697
- package/dist/src/commands/agent.js.map +1 -1
- package/dist/src/commands/analyze.js +1218 -1548
- package/dist/src/commands/analyze.js.map +1 -1
- package/dist/src/commands/appliance-advanced.js +158 -267
- package/dist/src/commands/appliance-advanced.js.map +1 -1
- package/dist/src/commands/appliance.js +318 -493
- package/dist/src/commands/appliance.js.map +1 -1
- package/dist/src/commands/benchmark.js +372 -523
- package/dist/src/commands/benchmark.js.map +1 -1
- package/dist/src/commands/claims.js +274 -364
- package/dist/src/commands/claims.js.map +1 -1
- package/dist/src/commands/cleanup.js +113 -157
- package/dist/src/commands/cleanup.js.map +1 -1
- package/dist/src/commands/completions.js +477 -118
- package/dist/src/commands/completions.js.map +1 -1
- package/dist/src/commands/config.js +237 -303
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/daemon.js +487 -596
- package/dist/src/commands/daemon.js.map +1 -1
- package/dist/src/commands/deployment.js +194 -275
- package/dist/src/commands/deployment.js.map +1 -1
- package/dist/src/commands/doctor.js +504 -686
- package/dist/src/commands/doctor.js.map +1 -1
- package/dist/src/commands/embeddings.js +1293 -1543
- package/dist/src/commands/embeddings.js.map +1 -1
- package/dist/src/commands/guidance.js +449 -596
- package/dist/src/commands/guidance.js.map +1 -1
- package/dist/src/commands/hive-mind.js +854 -938
- package/dist/src/commands/hive-mind.js.map +1 -1
- package/dist/src/commands/hooks.js +3112 -3519
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/index.d.ts +115 -0
- package/dist/src/commands/index.d.ts.map +1 -0
- package/dist/src/commands/index.js +126 -308
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/init.js +788 -940
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/issues.js +383 -558
- package/dist/src/commands/issues.js.map +1 -1
- package/dist/src/commands/mcp.js +493 -605
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/commands/memory.js +833 -1026
- package/dist/src/commands/memory.js.map +1 -1
- package/dist/src/commands/migrate.js +282 -347
- package/dist/src/commands/migrate.js.map +1 -1
- package/dist/src/commands/neural.js +1289 -1563
- package/dist/src/commands/neural.js.map +1 -1
- package/dist/src/commands/performance.js +497 -643
- package/dist/src/commands/performance.js.map +1 -1
- package/dist/src/commands/plugins.js +668 -841
- package/dist/src/commands/plugins.js.map +1 -1
- package/dist/src/commands/process.js +392 -447
- package/dist/src/commands/process.js.map +1 -1
- package/dist/src/commands/progress.js +162 -256
- package/dist/src/commands/progress.js.map +1 -1
- package/dist/src/commands/providers.js +150 -220
- package/dist/src/commands/providers.js.map +1 -1
- package/dist/src/commands/route.js +520 -665
- package/dist/src/commands/route.js.map +1 -1
- package/dist/src/commands/ruvector/backup.js +505 -651
- package/dist/src/commands/ruvector/backup.js.map +1 -1
- package/dist/src/commands/ruvector/benchmark.js +349 -401
- package/dist/src/commands/ruvector/benchmark.js.map +1 -1
- package/dist/src/commands/ruvector/import.js +224 -266
- package/dist/src/commands/ruvector/import.js.map +1 -1
- package/dist/src/commands/ruvector/index.js +37 -75
- package/dist/src/commands/ruvector/index.js.map +1 -1
- package/dist/src/commands/ruvector/init.js +336 -359
- package/dist/src/commands/ruvector/init.js.map +1 -1
- package/dist/src/commands/ruvector/migrate.js +335 -322
- package/dist/src/commands/ruvector/migrate.js.map +1 -1
- package/dist/src/commands/ruvector/optimize.js +375 -431
- package/dist/src/commands/ruvector/optimize.js.map +1 -1
- package/dist/src/commands/ruvector/setup.js +703 -117
- package/dist/src/commands/ruvector/setup.js.map +1 -1
- package/dist/src/commands/ruvector/status.js +364 -419
- package/dist/src/commands/ruvector/status.js.map +1 -1
- package/dist/src/commands/security.js +485 -608
- package/dist/src/commands/security.js.map +1 -1
- package/dist/src/commands/session.js +504 -626
- package/dist/src/commands/session.js.map +1 -1
- package/dist/src/commands/start.js +267 -364
- package/dist/src/commands/start.js.map +1 -1
- package/dist/src/commands/status.js +380 -486
- package/dist/src/commands/status.js.map +1 -1
- package/dist/src/commands/swarm.js +408 -488
- package/dist/src/commands/swarm.js.map +1 -1
- package/dist/src/commands/task.js +423 -538
- package/dist/src/commands/task.js.map +1 -1
- package/dist/src/commands/transfer-store.js +322 -412
- package/dist/src/commands/transfer-store.js.map +1 -1
- package/dist/src/commands/update.js +196 -291
- package/dist/src/commands/update.js.map +1 -1
- package/dist/src/commands/workflow.js +386 -486
- package/dist/src/commands/workflow.js.map +1 -1
- package/dist/src/config-adapter.d.ts +15 -0
- package/dist/src/config-adapter.d.ts.map +1 -0
- package/dist/src/config-adapter.js +38 -39
- package/dist/src/config-adapter.js.map +1 -1
- package/dist/src/index.d.ts +77 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +309 -411
- package/dist/src/index.js.map +1 -1
- package/dist/src/infrastructure/in-memory-repositories.d.ts +68 -0
- package/dist/src/infrastructure/in-memory-repositories.d.ts.map +1 -0
- package/dist/src/infrastructure/in-memory-repositories.js +246 -507
- package/dist/src/infrastructure/in-memory-repositories.js.map +1 -1
- package/dist/src/init/claudemd-generator.d.ts +25 -0
- package/dist/src/init/claudemd-generator.d.ts.map +1 -0
- package/dist/src/init/claudemd-generator.js +368 -78
- package/dist/src/init/claudemd-generator.js.map +1 -1
- package/dist/src/init/executor.d.ts +41 -0
- package/dist/src/init/executor.d.ts.map +1 -0
- package/dist/src/init/executor.js +1307 -996
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/init/helpers-generator.d.ts +60 -0
- package/dist/src/init/helpers-generator.d.ts.map +1 -0
- package/dist/src/init/helpers-generator.js +657 -12
- package/dist/src/init/helpers-generator.js.map +1 -1
- package/dist/src/init/index.d.ts +1 -1
- package/dist/src/init/index.d.ts.map +1 -1
- package/dist/src/init/index.js +1 -1
- package/dist/src/init/index.js.map +1 -1
- package/dist/src/init/mcp-generator.js +33 -37
- package/dist/src/init/mcp-generator.js.map +1 -1
- package/dist/src/init/settings-generator.js +76 -77
- package/dist/src/init/settings-generator.js.map +1 -1
- package/dist/src/init/statusline-generator.js +801 -3
- package/dist/src/init/statusline-generator.js.map +1 -1
- package/dist/src/init/types.d.ts +1 -1
- package/dist/src/init/types.d.ts.map +1 -1
- package/dist/src/init/types.js +76 -59
- package/dist/src/init/types.js.map +1 -1
- package/dist/src/mcp-client.d.ts +92 -0
- package/dist/src/mcp-client.d.ts.map +1 -0
- package/dist/src/mcp-client.js +81 -125
- package/dist/src/mcp-client.js.map +1 -1
- package/dist/src/mcp-server.d.ts +161 -0
- package/dist/src/mcp-server.d.ts.map +1 -0
- package/dist/src/mcp-server.js +470 -757
- package/dist/src/mcp-server.js.map +1 -1
- package/dist/src/mcp-tools/agent-tools.js +391 -492
- package/dist/src/mcp-tools/agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/agentdb-tools.js +332 -533
- package/dist/src/mcp-tools/agentdb-tools.js.map +1 -1
- package/dist/src/mcp-tools/analyze-tools.js +172 -236
- package/dist/src/mcp-tools/analyze-tools.js.map +1 -1
- package/dist/src/mcp-tools/auto-install.d.ts +83 -0
- package/dist/src/mcp-tools/auto-install.d.ts.map +1 -0
- package/dist/src/mcp-tools/auto-install.js +80 -142
- package/dist/src/mcp-tools/auto-install.js.map +1 -1
- package/dist/src/mcp-tools/browser-tools.js +252 -375
- package/dist/src/mcp-tools/browser-tools.js.map +1 -1
- package/dist/src/mcp-tools/claims-tools.js +473 -565
- package/dist/src/mcp-tools/claims-tools.js.map +1 -1
- package/dist/src/mcp-tools/config-tools.js +197 -272
- package/dist/src/mcp-tools/config-tools.js.map +1 -1
- package/dist/src/mcp-tools/coordination-tools.js +500 -572
- package/dist/src/mcp-tools/coordination-tools.js.map +1 -1
- package/dist/src/mcp-tools/daa-tools.js +286 -364
- package/dist/src/mcp-tools/daa-tools.js.map +1 -1
- package/dist/src/mcp-tools/embeddings-tools.js +582 -693
- package/dist/src/mcp-tools/embeddings-tools.js.map +1 -1
- package/dist/src/mcp-tools/github-tools.js +260 -311
- package/dist/src/mcp-tools/github-tools.js.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.js +573 -640
- package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.js +2215 -2648
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
- package/dist/src/mcp-tools/memory-tools.js +350 -505
- package/dist/src/mcp-tools/memory-tools.js.map +1 -1
- package/dist/src/mcp-tools/neural-tools.js +315 -412
- package/dist/src/mcp-tools/neural-tools.js.map +1 -1
- package/dist/src/mcp-tools/performance-tools.js +420 -480
- package/dist/src/mcp-tools/performance-tools.js.map +1 -1
- package/dist/src/mcp-tools/progress-tools.js +204 -278
- package/dist/src/mcp-tools/progress-tools.js.map +1 -1
- package/dist/src/mcp-tools/ruvllm-tools.js +163 -279
- package/dist/src/mcp-tools/ruvllm-tools.js.map +1 -1
- package/dist/src/mcp-tools/security-tools.js +297 -429
- package/dist/src/mcp-tools/security-tools.js.map +1 -1
- package/dist/src/mcp-tools/session-tools.js +185 -234
- package/dist/src/mcp-tools/session-tools.js.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.js +207 -260
- package/dist/src/mcp-tools/swarm-tools.js.map +1 -1
- package/dist/src/mcp-tools/system-tools.js +276 -325
- package/dist/src/mcp-tools/system-tools.js.map +1 -1
- package/dist/src/mcp-tools/task-tools.js +270 -336
- package/dist/src/mcp-tools/task-tools.js.map +1 -1
- package/dist/src/mcp-tools/terminal-tools.js +148 -196
- package/dist/src/mcp-tools/terminal-tools.js.map +1 -1
- package/dist/src/mcp-tools/transfer-tools.js +186 -333
- package/dist/src/mcp-tools/transfer-tools.js.map +1 -1
- package/dist/src/mcp-tools/types.d.ts +31 -0
- package/dist/src/mcp-tools/types.d.ts.map +1 -0
- package/dist/src/mcp-tools/wasm-agent-tools.js +133 -280
- package/dist/src/mcp-tools/wasm-agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/workflow-tools.js +405 -450
- package/dist/src/mcp-tools/workflow-tools.js.map +1 -1
- package/dist/src/memory/ewc-consolidation.d.ts +295 -0
- package/dist/src/memory/ewc-consolidation.d.ts.map +1 -0
- package/dist/src/memory/ewc-consolidation.js +190 -303
- package/dist/src/memory/ewc-consolidation.js.map +1 -1
- package/dist/src/memory/intelligence.d.ts +338 -0
- package/dist/src/memory/intelligence.d.ts.map +1 -0
- package/dist/src/memory/intelligence.js +569 -794
- package/dist/src/memory/intelligence.js.map +1 -1
- package/dist/src/memory/memory-bridge.d.ts +407 -0
- package/dist/src/memory/memory-bridge.d.ts.map +1 -0
- package/dist/src/memory/memory-bridge.js +1170 -1640
- package/dist/src/memory/memory-bridge.js.map +1 -1
- package/dist/src/memory/memory-initializer.d.ts +412 -0
- package/dist/src/memory/memory-initializer.d.ts.map +1 -0
- package/dist/src/memory/memory-initializer.js +1836 -1851
- package/dist/src/memory/memory-initializer.js.map +1 -1
- package/dist/src/memory/sona-optimizer.d.ts +227 -0
- package/dist/src/memory/sona-optimizer.d.ts.map +1 -0
- package/dist/src/memory/sona-optimizer.js +199 -329
- package/dist/src/memory/sona-optimizer.js.map +1 -1
- package/dist/src/output.d.ts +2 -2
- package/dist/src/output.d.ts.map +1 -1
- package/dist/src/output.js +242 -272
- package/dist/src/output.js.map +1 -1
- package/dist/src/parser.d.ts +51 -0
- package/dist/src/parser.d.ts.map +1 -0
- package/dist/src/parser.js +140 -187
- package/dist/src/parser.js.map +1 -1
- package/dist/src/plugins/manager.d.ts +133 -0
- package/dist/src/plugins/manager.d.ts.map +1 -0
- package/dist/src/plugins/manager.js +285 -521
- package/dist/src/plugins/manager.js.map +1 -1
- package/dist/src/plugins/store/discovery.d.ts +88 -0
- package/dist/src/plugins/store/discovery.d.ts.map +1 -0
- package/dist/src/plugins/store/discovery.js +271 -358
- package/dist/src/plugins/store/discovery.js.map +1 -1
- package/dist/src/plugins/store/index.d.ts +76 -0
- package/dist/src/plugins/store/index.d.ts.map +1 -0
- package/dist/src/plugins/store/index.js +48 -105
- package/dist/src/plugins/store/index.js.map +1 -1
- package/dist/src/plugins/store/search.d.ts +46 -0
- package/dist/src/plugins/store/search.d.ts.map +1 -0
- package/dist/src/plugins/store/search.js +69 -107
- package/dist/src/plugins/store/search.js.map +1 -1
- package/dist/src/plugins/store/types.d.ts +274 -0
- package/dist/src/plugins/store/types.d.ts.map +1 -0
- package/dist/src/plugins/tests/demo-plugin-store.js +113 -160
- package/dist/src/plugins/tests/demo-plugin-store.js.map +1 -1
- package/dist/src/plugins/tests/standalone-test.js +172 -223
- package/dist/src/plugins/tests/standalone-test.js.map +1 -1
- package/dist/src/plugins/tests/test-plugin-store.js +190 -228
- package/dist/src/plugins/tests/test-plugin-store.js.map +1 -1
- package/dist/src/production/circuit-breaker.d.ts +101 -0
- package/dist/src/production/circuit-breaker.d.ts.map +1 -0
- package/dist/src/production/circuit-breaker.js +62 -126
- package/dist/src/production/circuit-breaker.js.map +1 -1
- package/dist/src/production/error-handler.d.ts +92 -0
- package/dist/src/production/error-handler.d.ts.map +1 -0
- package/dist/src/production/error-handler.js +86 -156
- package/dist/src/production/error-handler.js.map +1 -1
- package/dist/src/production/monitoring.d.ts +161 -0
- package/dist/src/production/monitoring.d.ts.map +1 -0
- package/dist/src/production/monitoring.js +139 -220
- package/dist/src/production/monitoring.js.map +1 -1
- package/dist/src/production/rate-limiter.d.ts +80 -0
- package/dist/src/production/rate-limiter.d.ts.map +1 -0
- package/dist/src/production/rate-limiter.js +74 -93
- package/dist/src/production/rate-limiter.js.map +1 -1
- package/dist/src/production/retry.d.ts +48 -0
- package/dist/src/production/retry.d.ts.map +1 -0
- package/dist/src/production/retry.js +75 -167
- package/dist/src/production/retry.js.map +1 -1
- package/dist/src/prompt.d.ts +44 -0
- package/dist/src/prompt.d.ts.map +1 -0
- package/dist/src/prompt.js +436 -560
- package/dist/src/prompt.js.map +1 -1
- package/dist/src/runtime/headless.d.ts +60 -0
- package/dist/src/runtime/headless.d.ts.map +1 -0
- package/dist/src/runtime/headless.js +197 -286
- package/dist/src/runtime/headless.js.map +1 -1
- package/dist/src/ruvector/agent-wasm.d.ts +182 -0
- package/dist/src/ruvector/agent-wasm.d.ts.map +1 -0
- package/dist/src/ruvector/agent-wasm.js +156 -351
- package/dist/src/ruvector/agent-wasm.js.map +1 -1
- package/dist/src/ruvector/ast-analyzer.d.ts +67 -0
- package/dist/src/ruvector/ast-analyzer.d.ts.map +1 -0
- package/dist/src/ruvector/ast-analyzer.js +145 -232
- package/dist/src/ruvector/ast-analyzer.js.map +1 -1
- package/dist/src/ruvector/coverage-router.d.ts +160 -0
- package/dist/src/ruvector/coverage-router.d.ts.map +1 -0
- package/dist/src/ruvector/coverage-router.js +287 -419
- package/dist/src/ruvector/coverage-router.js.map +1 -1
- package/dist/src/ruvector/coverage-tools.js +56 -101
- package/dist/src/ruvector/coverage-tools.js.map +1 -1
- package/dist/src/ruvector/diff-classifier.d.ts +175 -0
- package/dist/src/ruvector/diff-classifier.d.ts.map +1 -0
- package/dist/src/ruvector/diff-classifier.js +324 -451
- package/dist/src/ruvector/diff-classifier.js.map +1 -1
- package/dist/src/ruvector/enhanced-model-router.d.ts +146 -0
- package/dist/src/ruvector/enhanced-model-router.d.ts.map +1 -0
- package/dist/src/ruvector/enhanced-model-router.js +260 -336
- package/dist/src/ruvector/enhanced-model-router.js.map +1 -1
- package/dist/src/ruvector/flash-attention.d.ts +195 -0
- package/dist/src/ruvector/flash-attention.d.ts.map +1 -0
- package/dist/src/ruvector/flash-attention.js +223 -254
- package/dist/src/ruvector/flash-attention.js.map +1 -1
- package/dist/src/ruvector/graph-analyzer.d.ts +187 -0
- package/dist/src/ruvector/graph-analyzer.d.ts.map +1 -0
- package/dist/src/ruvector/graph-analyzer.js +486 -680
- package/dist/src/ruvector/graph-analyzer.js.map +1 -1
- package/dist/src/ruvector/index.d.ts +40 -0
- package/dist/src/ruvector/index.d.ts.map +1 -0
- package/dist/src/ruvector/index.js +36 -106
- package/dist/src/ruvector/index.js.map +1 -1
- package/dist/src/ruvector/lora-adapter.d.ts +218 -0
- package/dist/src/ruvector/lora-adapter.d.ts.map +1 -0
- package/dist/src/ruvector/lora-adapter.js +155 -248
- package/dist/src/ruvector/lora-adapter.js.map +1 -1
- package/dist/src/ruvector/model-router.d.ts +220 -0
- package/dist/src/ruvector/model-router.d.ts.map +1 -0
- package/dist/src/ruvector/model-router.js +175 -248
- package/dist/src/ruvector/model-router.js.map +1 -1
- package/dist/src/ruvector/moe-router.d.ts +206 -0
- package/dist/src/ruvector/moe-router.d.ts.map +1 -0
- package/dist/src/ruvector/moe-router.js +228 -286
- package/dist/src/ruvector/moe-router.js.map +1 -1
- package/dist/src/ruvector/q-learning-router.d.ts +211 -0
- package/dist/src/ruvector/q-learning-router.d.ts.map +1 -0
- package/dist/src/ruvector/q-learning-router.js +257 -338
- package/dist/src/ruvector/q-learning-router.js.map +1 -1
- package/dist/src/ruvector/ruvllm-wasm.d.ts +179 -0
- package/dist/src/ruvector/ruvllm-wasm.d.ts.map +1 -0
- package/dist/src/ruvector/ruvllm-wasm.js +270 -434
- package/dist/src/ruvector/ruvllm-wasm.js.map +1 -1
- package/dist/src/ruvector/semantic-router.d.ts +77 -0
- package/dist/src/ruvector/semantic-router.d.ts.map +1 -0
- package/dist/src/ruvector/semantic-router.js +60 -67
- package/dist/src/ruvector/semantic-router.js.map +1 -1
- package/dist/src/ruvector/vector-db.d.ts +69 -0
- package/dist/src/ruvector/vector-db.d.ts.map +1 -0
- package/dist/src/ruvector/vector-db.js +119 -205
- package/dist/src/ruvector/vector-db.js.map +1 -1
- package/dist/src/services/agentic-flow-bridge.d.ts +50 -0
- package/dist/src/services/agentic-flow-bridge.d.ts.map +1 -0
- package/dist/src/services/agentic-flow-bridge.js +32 -105
- package/dist/src/services/agentic-flow-bridge.js.map +1 -1
- package/dist/src/services/claim-service.d.ts +204 -0
- package/dist/src/services/claim-service.d.ts.map +1 -0
- package/dist/src/services/claim-service.js +615 -940
- package/dist/src/services/claim-service.js.map +1 -1
- package/dist/src/services/container-worker-pool.d.ts +197 -0
- package/dist/src/services/container-worker-pool.d.ts.map +1 -0
- package/dist/src/services/container-worker-pool.js +398 -666
- package/dist/src/services/container-worker-pool.js.map +1 -1
- package/dist/src/services/headless-worker-executor.d.ts +304 -0
- package/dist/src/services/headless-worker-executor.d.ts.map +1 -0
- package/dist/src/services/headless-worker-executor.js +441 -467
- package/dist/src/services/headless-worker-executor.js.map +1 -1
- package/dist/src/services/index.d.ts +4 -4
- package/dist/src/services/index.d.ts.map +1 -1
- package/dist/src/services/index.js +4 -4
- package/dist/src/services/index.js.map +1 -1
- package/dist/src/services/registry-api.d.ts +58 -0
- package/dist/src/services/registry-api.d.ts.map +1 -0
- package/dist/src/services/registry-api.js +92 -200
- package/dist/src/services/registry-api.js.map +1 -1
- package/dist/src/services/ruvector-training.d.ts +222 -0
- package/dist/src/services/ruvector-training.d.ts.map +1 -0
- package/dist/src/services/ruvector-training.js +257 -337
- package/dist/src/services/ruvector-training.js.map +1 -1
- package/dist/src/services/worker-daemon.d.ts +228 -0
- package/dist/src/services/worker-daemon.d.ts.map +1 -0
- package/dist/src/services/worker-daemon.js +591 -849
- package/dist/src/services/worker-daemon.js.map +1 -1
- package/dist/src/services/worker-queue.d.ts +194 -0
- package/dist/src/services/worker-queue.d.ts.map +1 -0
- package/dist/src/services/worker-queue.js +331 -548
- package/dist/src/services/worker-queue.js.map +1 -1
- package/dist/src/suggest.d.ts +53 -0
- package/dist/src/suggest.d.ts.map +1 -0
- package/dist/src/suggest.js +45 -55
- package/dist/src/suggest.js.map +1 -1
- package/dist/src/transfer/anonymization/index.js +29 -37
- package/dist/src/transfer/anonymization/index.js.map +1 -1
- package/dist/src/transfer/deploy-seraphine.js +128 -155
- package/dist/src/transfer/deploy-seraphine.js.map +1 -1
- package/dist/src/transfer/export.d.ts +25 -0
- package/dist/src/transfer/export.d.ts.map +1 -0
- package/dist/src/transfer/export.js +84 -142
- package/dist/src/transfer/export.js.map +1 -1
- package/dist/src/transfer/index.d.ts +1 -1
- package/dist/src/transfer/index.d.ts.map +1 -1
- package/dist/src/transfer/index.js +0 -2
- package/dist/src/transfer/index.js.map +1 -1
- package/dist/src/transfer/ipfs/client.d.ts +109 -0
- package/dist/src/transfer/ipfs/client.d.ts.map +1 -0
- package/dist/src/transfer/ipfs/client.js +187 -337
- package/dist/src/transfer/ipfs/client.js.map +1 -1
- package/dist/src/transfer/ipfs/upload.d.ts +95 -0
- package/dist/src/transfer/ipfs/upload.d.ts.map +1 -0
- package/dist/src/transfer/ipfs/upload.js +288 -434
- package/dist/src/transfer/ipfs/upload.js.map +1 -1
- package/dist/src/transfer/models/seraphine.d.ts +72 -0
- package/dist/src/transfer/models/seraphine.d.ts.map +1 -0
- package/dist/src/transfer/models/seraphine.js +55 -55
- package/dist/src/transfer/models/seraphine.js.map +1 -1
- package/dist/src/transfer/serialization/cfp.d.ts +49 -0
- package/dist/src/transfer/serialization/cfp.d.ts.map +1 -0
- package/dist/src/transfer/serialization/cfp.js +30 -31
- package/dist/src/transfer/serialization/cfp.js.map +1 -1
- package/dist/src/transfer/storage/gcs.d.ts +82 -0
- package/dist/src/transfer/storage/gcs.d.ts.map +1 -0
- package/dist/src/transfer/storage/gcs.js +165 -232
- package/dist/src/transfer/storage/gcs.js.map +1 -1
- package/dist/src/transfer/store/discovery.d.ts +84 -0
- package/dist/src/transfer/store/discovery.d.ts.map +1 -0
- package/dist/src/transfer/store/discovery.js +239 -349
- package/dist/src/transfer/store/discovery.js.map +1 -1
- package/dist/src/transfer/store/download.d.ts +70 -0
- package/dist/src/transfer/store/download.d.ts.map +1 -0
- package/dist/src/transfer/store/download.js +243 -365
- package/dist/src/transfer/store/download.js.map +1 -1
- package/dist/src/transfer/store/index.d.ts +84 -0
- package/dist/src/transfer/store/index.d.ts.map +1 -0
- package/dist/src/transfer/store/index.js +63 -130
- package/dist/src/transfer/store/index.js.map +1 -1
- package/dist/src/transfer/store/publish.d.ts +76 -0
- package/dist/src/transfer/store/publish.d.ts.map +1 -0
- package/dist/src/transfer/store/publish.js +184 -258
- package/dist/src/transfer/store/publish.js.map +1 -1
- package/dist/src/transfer/store/registry.js +50 -72
- package/dist/src/transfer/store/registry.js.map +1 -1
- package/dist/src/transfer/store/search.d.ts +54 -0
- package/dist/src/transfer/store/search.d.ts.map +1 -0
- package/dist/src/transfer/store/search.js +64 -96
- package/dist/src/transfer/store/search.js.map +1 -1
- package/dist/src/transfer/store/tests/standalone-test.js +174 -231
- package/dist/src/transfer/store/tests/standalone-test.js.map +1 -1
- package/dist/src/transfer/test-seraphine.js +95 -130
- package/dist/src/transfer/test-seraphine.js.map +1 -1
- package/dist/src/transfer/tests/test-store.js +194 -239
- package/dist/src/transfer/tests/test-store.js.map +1 -1
- package/dist/src/transfer/types.d.ts +245 -0
- package/dist/src/transfer/types.d.ts.map +1 -0
- package/dist/src/types.d.ts +198 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +26 -55
- package/dist/src/types.js.map +1 -1
- package/dist/src/update/checker.d.ts +34 -0
- package/dist/src/update/checker.d.ts.map +1 -0
- package/dist/src/update/checker.js +106 -183
- package/dist/src/update/checker.js.map +1 -1
- package/dist/src/update/executor.d.ts +32 -0
- package/dist/src/update/executor.d.ts.map +1 -0
- package/dist/src/update/executor.js +135 -198
- package/dist/src/update/executor.js.map +1 -1
- package/dist/src/update/index.d.ts +33 -0
- package/dist/src/update/index.d.ts.map +1 -0
- package/dist/src/update/index.js +38 -85
- package/dist/src/update/index.js.map +1 -1
- package/dist/src/update/rate-limiter.d.ts +20 -0
- package/dist/src/update/rate-limiter.d.ts.map +1 -0
- package/dist/src/update/rate-limiter.js +19 -31
- package/dist/src/update/rate-limiter.js.map +1 -1
- package/dist/src/update/validator.d.ts +17 -0
- package/dist/src/update/validator.d.ts.map +1 -0
- package/dist/src/update/validator.js +38 -64
- package/dist/src/update/validator.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Production Rate Limiting
|
|
3
|
+
*
|
|
4
|
+
* Provides token bucket rate limiting with:
|
|
5
|
+
* - Per-operation limits
|
|
6
|
+
* - Per-user/agent limits
|
|
7
|
+
* - Burst allowance
|
|
8
|
+
* - Sliding window tracking
|
|
9
|
+
*
|
|
10
|
+
* @module @claude-flow/cli/production/rate-limiter
|
|
11
|
+
*/
|
|
12
|
+
export interface RateLimiterConfig {
|
|
13
|
+
maxRequests: number;
|
|
14
|
+
windowMs: number;
|
|
15
|
+
burstMultiplier: number;
|
|
16
|
+
whitelist: string[];
|
|
17
|
+
operationLimits: Record<string, {
|
|
18
|
+
maxRequests: number;
|
|
19
|
+
windowMs: number;
|
|
20
|
+
}>;
|
|
21
|
+
perUserLimits: boolean;
|
|
22
|
+
maxTrackedUsers: number;
|
|
23
|
+
}
|
|
24
|
+
export interface RateLimitResult {
|
|
25
|
+
allowed: boolean;
|
|
26
|
+
remaining: number;
|
|
27
|
+
resetAt: number;
|
|
28
|
+
retryAfterMs?: number;
|
|
29
|
+
}
|
|
30
|
+
export declare class RateLimiter {
|
|
31
|
+
private config;
|
|
32
|
+
private buckets;
|
|
33
|
+
private globalBucket;
|
|
34
|
+
constructor(config?: Partial<RateLimiterConfig>);
|
|
35
|
+
/**
|
|
36
|
+
* Check if a request is allowed
|
|
37
|
+
*/
|
|
38
|
+
check(operation: string, userId?: string): RateLimitResult;
|
|
39
|
+
/**
|
|
40
|
+
* Consume a token (use after successful request)
|
|
41
|
+
*/
|
|
42
|
+
consume(operation: string, userId?: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Get current rate limit status
|
|
45
|
+
*/
|
|
46
|
+
getStatus(operation: string, userId?: string): {
|
|
47
|
+
current: number;
|
|
48
|
+
limit: number;
|
|
49
|
+
remaining: number;
|
|
50
|
+
resetAt: number;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Reset limits for a specific key
|
|
54
|
+
*/
|
|
55
|
+
reset(operation: string, userId?: string): void;
|
|
56
|
+
/**
|
|
57
|
+
* Reset all limits
|
|
58
|
+
*/
|
|
59
|
+
resetAll(): void;
|
|
60
|
+
/**
|
|
61
|
+
* Get statistics
|
|
62
|
+
*/
|
|
63
|
+
getStats(): {
|
|
64
|
+
totalBuckets: number;
|
|
65
|
+
activeUsers: number;
|
|
66
|
+
mostLimitedOperations: Array<{
|
|
67
|
+
operation: string;
|
|
68
|
+
requests: number;
|
|
69
|
+
}>;
|
|
70
|
+
};
|
|
71
|
+
private getLimits;
|
|
72
|
+
private createBucket;
|
|
73
|
+
private cleanupBuckets;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Create a rate limiter with default config
|
|
77
|
+
*/
|
|
78
|
+
export declare function createRateLimiter(config?: Partial<RateLimiterConfig>): RateLimiter;
|
|
79
|
+
export default RateLimiter;
|
|
80
|
+
//# sourceMappingURL=rate-limiter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rate-limiter.d.ts","sourceRoot":"","sources":["../../../src/production/rate-limiter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,MAAM,WAAW,iBAAiB;IAEhC,WAAW,EAAE,MAAM,CAAC;IAEpB,QAAQ,EAAE,MAAM,CAAC;IAEjB,eAAe,EAAE,MAAM,CAAC;IAExB,SAAS,EAAE,MAAM,EAAE,CAAC;IAEpB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAE3E,aAAa,EAAE,OAAO,CAAC;IAEvB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAsBD,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,OAAO,CAAuC;IACtD,OAAO,CAAC,YAAY,CAAc;gBAEtB,MAAM,GAAE,OAAO,CAAC,iBAAiB,CAAM;IAKnD;;OAEG;IACH,KAAK,CACH,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GACd,eAAe;IAqDlB;;OAEG;IACH,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO;IAKpD;;OAEG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG;QAC7C,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB;IA+BD;;OAEG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAQ/C;;OAEG;IACH,QAAQ,IAAI,IAAI;IAKhB;;OAEG;IACH,QAAQ,IAAI;QACV,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;QACpB,qBAAqB,EAAE,KAAK,CAAC;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACvE;IA4BD,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,cAAc;CAuBvB;AAMD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,WAAW,CAElF;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -9,72 +9,62 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @module @claude-flow/cli/production/rate-limiter
|
|
11
11
|
*/
|
|
12
|
-
var __assign = (this && this.__assign) || function () {
|
|
13
|
-
__assign = Object.assign || function(t) {
|
|
14
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
15
|
-
s = arguments[i];
|
|
16
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
17
|
-
t[p] = s[p];
|
|
18
|
-
}
|
|
19
|
-
return t;
|
|
20
|
-
};
|
|
21
|
-
return __assign.apply(this, arguments);
|
|
22
|
-
};
|
|
23
12
|
// ============================================================================
|
|
24
13
|
// Rate Limiter
|
|
25
14
|
// ============================================================================
|
|
26
|
-
|
|
15
|
+
const DEFAULT_CONFIG = {
|
|
27
16
|
maxRequests: 100,
|
|
28
|
-
windowMs: 60000,
|
|
17
|
+
windowMs: 60000, // 1 minute
|
|
29
18
|
burstMultiplier: 1.5,
|
|
30
19
|
whitelist: [],
|
|
31
20
|
operationLimits: {},
|
|
32
21
|
perUserLimits: true,
|
|
33
|
-
maxTrackedUsers: 10000
|
|
22
|
+
maxTrackedUsers: 10000,
|
|
34
23
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
export class RateLimiter {
|
|
25
|
+
config;
|
|
26
|
+
buckets = new Map();
|
|
27
|
+
globalBucket;
|
|
28
|
+
constructor(config = {}) {
|
|
29
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
40
30
|
this.globalBucket = this.createBucket();
|
|
41
31
|
}
|
|
42
32
|
/**
|
|
43
33
|
* Check if a request is allowed
|
|
44
34
|
*/
|
|
45
|
-
|
|
35
|
+
check(operation, userId) {
|
|
46
36
|
// Check whitelist
|
|
47
37
|
if (this.config.whitelist.includes(operation)) {
|
|
48
38
|
return { allowed: true, remaining: Infinity, resetAt: 0 };
|
|
49
39
|
}
|
|
50
40
|
// Get limits for this operation
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
const limits = this.getLimits(operation);
|
|
42
|
+
const now = Date.now();
|
|
53
43
|
// Get or create bucket
|
|
54
|
-
|
|
55
|
-
? operation
|
|
56
|
-
:
|
|
57
|
-
|
|
44
|
+
const bucketKey = userId && this.config.perUserLimits
|
|
45
|
+
? `${operation}:${userId}`
|
|
46
|
+
: `global:${operation}`;
|
|
47
|
+
let bucket = this.buckets.get(bucketKey);
|
|
58
48
|
if (!bucket) {
|
|
59
49
|
bucket = this.createBucket();
|
|
60
50
|
this.buckets.set(bucketKey, bucket);
|
|
61
51
|
this.cleanupBuckets();
|
|
62
52
|
}
|
|
63
53
|
// Clean old requests from sliding window
|
|
64
|
-
bucket.requests = bucket.requests.filter(
|
|
54
|
+
bucket.requests = bucket.requests.filter(t => t > now - limits.windowMs);
|
|
65
55
|
// Calculate remaining
|
|
66
|
-
|
|
67
|
-
|
|
56
|
+
const maxWithBurst = Math.floor(limits.maxRequests * this.config.burstMultiplier);
|
|
57
|
+
const remaining = maxWithBurst - bucket.requests.length;
|
|
68
58
|
if (remaining <= 0) {
|
|
69
59
|
// Rate limited
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
60
|
+
const oldestRequest = bucket.requests[0];
|
|
61
|
+
const resetAt = oldestRequest + limits.windowMs;
|
|
62
|
+
const retryAfterMs = resetAt - now;
|
|
73
63
|
return {
|
|
74
64
|
allowed: false,
|
|
75
65
|
remaining: 0,
|
|
76
|
-
resetAt
|
|
77
|
-
retryAfterMs: Math.max(0, retryAfterMs)
|
|
66
|
+
resetAt,
|
|
67
|
+
retryAfterMs: Math.max(0, retryAfterMs),
|
|
78
68
|
};
|
|
79
69
|
}
|
|
80
70
|
// Allow request
|
|
@@ -82,131 +72,122 @@ var RateLimiter = /** @class */ (function () {
|
|
|
82
72
|
return {
|
|
83
73
|
allowed: true,
|
|
84
74
|
remaining: remaining - 1,
|
|
85
|
-
resetAt: now + limits.windowMs
|
|
75
|
+
resetAt: now + limits.windowMs,
|
|
86
76
|
};
|
|
87
|
-
}
|
|
77
|
+
}
|
|
88
78
|
/**
|
|
89
79
|
* Consume a token (use after successful request)
|
|
90
80
|
*/
|
|
91
|
-
|
|
92
|
-
|
|
81
|
+
consume(operation, userId) {
|
|
82
|
+
const result = this.check(operation, userId);
|
|
93
83
|
return result.allowed;
|
|
94
|
-
}
|
|
84
|
+
}
|
|
95
85
|
/**
|
|
96
86
|
* Get current rate limit status
|
|
97
87
|
*/
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
? operation
|
|
102
|
-
:
|
|
103
|
-
|
|
104
|
-
|
|
88
|
+
getStatus(operation, userId) {
|
|
89
|
+
const limits = this.getLimits(operation);
|
|
90
|
+
const bucketKey = userId && this.config.perUserLimits
|
|
91
|
+
? `${operation}:${userId}`
|
|
92
|
+
: `global:${operation}`;
|
|
93
|
+
const bucket = this.buckets.get(bucketKey);
|
|
94
|
+
const now = Date.now();
|
|
105
95
|
if (!bucket) {
|
|
106
96
|
return {
|
|
107
97
|
current: 0,
|
|
108
98
|
limit: limits.maxRequests,
|
|
109
99
|
remaining: limits.maxRequests,
|
|
110
|
-
resetAt: now + limits.windowMs
|
|
100
|
+
resetAt: now + limits.windowMs,
|
|
111
101
|
};
|
|
112
102
|
}
|
|
113
103
|
// Clean old requests
|
|
114
|
-
|
|
104
|
+
const validRequests = bucket.requests.filter(t => t > now - limits.windowMs);
|
|
115
105
|
return {
|
|
116
106
|
current: validRequests.length,
|
|
117
107
|
limit: limits.maxRequests,
|
|
118
108
|
remaining: Math.max(0, limits.maxRequests - validRequests.length),
|
|
119
109
|
resetAt: validRequests.length > 0
|
|
120
110
|
? validRequests[0] + limits.windowMs
|
|
121
|
-
: now + limits.windowMs
|
|
111
|
+
: now + limits.windowMs,
|
|
122
112
|
};
|
|
123
|
-
}
|
|
113
|
+
}
|
|
124
114
|
/**
|
|
125
115
|
* Reset limits for a specific key
|
|
126
116
|
*/
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
? operation
|
|
130
|
-
:
|
|
131
|
-
this.buckets
|
|
132
|
-
}
|
|
117
|
+
reset(operation, userId) {
|
|
118
|
+
const bucketKey = userId && this.config.perUserLimits
|
|
119
|
+
? `${operation}:${userId}`
|
|
120
|
+
: `global:${operation}`;
|
|
121
|
+
this.buckets.delete(bucketKey);
|
|
122
|
+
}
|
|
133
123
|
/**
|
|
134
124
|
* Reset all limits
|
|
135
125
|
*/
|
|
136
|
-
|
|
126
|
+
resetAll() {
|
|
137
127
|
this.buckets.clear();
|
|
138
128
|
this.globalBucket = this.createBucket();
|
|
139
|
-
}
|
|
129
|
+
}
|
|
140
130
|
/**
|
|
141
131
|
* Get statistics
|
|
142
132
|
*/
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
for (
|
|
147
|
-
|
|
148
|
-
var _c = key.split(':'), operation = _c[0], userId = _c[1];
|
|
133
|
+
getStats() {
|
|
134
|
+
const operationCounts = new Map();
|
|
135
|
+
const users = new Set();
|
|
136
|
+
for (const [key, bucket] of this.buckets) {
|
|
137
|
+
const [operation, userId] = key.split(':');
|
|
149
138
|
if (userId)
|
|
150
139
|
users.add(userId);
|
|
151
|
-
|
|
140
|
+
const current = operationCounts.get(operation) || 0;
|
|
152
141
|
operationCounts.set(operation, current + bucket.requests.length);
|
|
153
142
|
}
|
|
154
|
-
|
|
155
|
-
.map(
|
|
156
|
-
|
|
157
|
-
return ({ operation: operation, requests: requests });
|
|
158
|
-
})
|
|
159
|
-
.sort(function (a, b) { return b.requests - a.requests; })
|
|
143
|
+
const mostLimited = Array.from(operationCounts.entries())
|
|
144
|
+
.map(([operation, requests]) => ({ operation, requests }))
|
|
145
|
+
.sort((a, b) => b.requests - a.requests)
|
|
160
146
|
.slice(0, 10);
|
|
161
147
|
return {
|
|
162
148
|
totalBuckets: this.buckets.size,
|
|
163
149
|
activeUsers: users.size,
|
|
164
|
-
mostLimitedOperations: mostLimited
|
|
150
|
+
mostLimitedOperations: mostLimited,
|
|
165
151
|
};
|
|
166
|
-
}
|
|
152
|
+
}
|
|
167
153
|
// ============================================================================
|
|
168
154
|
// Private Methods
|
|
169
155
|
// ============================================================================
|
|
170
|
-
|
|
156
|
+
getLimits(operation) {
|
|
171
157
|
return this.config.operationLimits[operation] || {
|
|
172
158
|
maxRequests: this.config.maxRequests,
|
|
173
|
-
windowMs: this.config.windowMs
|
|
159
|
+
windowMs: this.config.windowMs,
|
|
174
160
|
};
|
|
175
|
-
}
|
|
176
|
-
|
|
161
|
+
}
|
|
162
|
+
createBucket() {
|
|
177
163
|
return {
|
|
178
164
|
tokens: this.config.maxRequests,
|
|
179
165
|
lastRefill: Date.now(),
|
|
180
|
-
requests: []
|
|
166
|
+
requests: [],
|
|
181
167
|
};
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
var _this = this;
|
|
168
|
+
}
|
|
169
|
+
cleanupBuckets() {
|
|
185
170
|
// Limit number of tracked buckets
|
|
186
171
|
if (this.buckets.size > this.config.maxTrackedUsers) {
|
|
187
|
-
|
|
188
|
-
|
|
172
|
+
const now = Date.now();
|
|
173
|
+
const toDelete = [];
|
|
189
174
|
// Find buckets with no recent requests
|
|
190
|
-
for (
|
|
191
|
-
|
|
192
|
-
var recent = bucket.requests.filter(function (t) { return t > now_1 - _this.config.windowMs * 2; });
|
|
175
|
+
for (const [key, bucket] of this.buckets) {
|
|
176
|
+
const recent = bucket.requests.filter(t => t > now - this.config.windowMs * 2);
|
|
193
177
|
if (recent.length === 0) {
|
|
194
178
|
toDelete.push(key);
|
|
195
179
|
}
|
|
196
180
|
}
|
|
197
181
|
// Delete stale buckets
|
|
198
|
-
for (
|
|
199
|
-
|
|
200
|
-
this.buckets["delete"](key);
|
|
182
|
+
for (const key of toDelete) {
|
|
183
|
+
this.buckets.delete(key);
|
|
201
184
|
if (this.buckets.size <= this.config.maxTrackedUsers * 0.8) {
|
|
202
185
|
break;
|
|
203
186
|
}
|
|
204
187
|
}
|
|
205
188
|
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
}());
|
|
209
|
-
export { RateLimiter };
|
|
189
|
+
}
|
|
190
|
+
}
|
|
210
191
|
// ============================================================================
|
|
211
192
|
// Convenience Functions
|
|
212
193
|
// ============================================================================
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rate-limiter.js","sourceRoot":"","sources":["../../../src/production/rate-limiter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG
|
|
1
|
+
{"version":3,"file":"rate-limiter.js","sourceRoot":"","sources":["../../../src/production/rate-limiter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAoCH,+EAA+E;AAC/E,eAAe;AACf,+EAA+E;AAE/E,MAAM,cAAc,GAAsB;IACxC,WAAW,EAAE,GAAG;IAChB,QAAQ,EAAE,KAAK,EAAE,WAAW;IAC5B,eAAe,EAAE,GAAG;IACpB,SAAS,EAAE,EAAE;IACb,eAAe,EAAE,EAAE;IACnB,aAAa,EAAE,IAAI;IACnB,eAAe,EAAE,KAAK;CACvB,CAAC;AAEF,MAAM,OAAO,WAAW;IACd,MAAM,CAAoB;IAC1B,OAAO,GAA6B,IAAI,GAAG,EAAE,CAAC;IAC9C,YAAY,CAAc;IAElC,YAAY,SAAqC,EAAE;QACjD,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,MAAM,EAAE,CAAC;QAC/C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,KAAK,CACH,SAAiB,EACjB,MAAe;QAEf,kBAAkB;QAClB,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YAC9C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;QAC5D,CAAC;QAED,gCAAgC;QAChC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACzC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAEvB,uBAAuB;QACvB,MAAM,SAAS,GAAG,MAAM,IAAI,IAAI,CAAC,MAAM,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BACzC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;gBAC/E,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;oBACxB,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACrB,CAAC;YACH,CAAC;YAED,uBAAuB;YACvB,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;gBAC3B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBACzB,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,GAAG,EAAE,CAAC;oBAC3D,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAED,+EAA+E;AAC/E,wBAAwB;AACxB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAmC;IACnE,OAAO,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Production Retry Mechanisms
|
|
3
|
+
*
|
|
4
|
+
* Provides retry with:
|
|
5
|
+
* - Exponential backoff
|
|
6
|
+
* - Jitter
|
|
7
|
+
* - Per-error-type configuration
|
|
8
|
+
* - Circuit breaker integration
|
|
9
|
+
*
|
|
10
|
+
* @module @claude-flow/cli/production/retry
|
|
11
|
+
*/
|
|
12
|
+
export interface RetryConfig {
|
|
13
|
+
maxAttempts: number;
|
|
14
|
+
initialDelayMs: number;
|
|
15
|
+
maxDelayMs: number;
|
|
16
|
+
backoffMultiplier: number;
|
|
17
|
+
jitter: number;
|
|
18
|
+
nonRetryableErrors: string[];
|
|
19
|
+
shouldRetry?: (error: Error, attempt: number) => boolean;
|
|
20
|
+
onRetry?: (error: Error, attempt: number, delayMs: number) => void;
|
|
21
|
+
}
|
|
22
|
+
export interface RetryResult<T> {
|
|
23
|
+
success: boolean;
|
|
24
|
+
result?: T;
|
|
25
|
+
error?: Error;
|
|
26
|
+
attempts: number;
|
|
27
|
+
totalTimeMs: number;
|
|
28
|
+
retryHistory: Array<{
|
|
29
|
+
attempt: number;
|
|
30
|
+
error: string;
|
|
31
|
+
delayMs: number;
|
|
32
|
+
}>;
|
|
33
|
+
}
|
|
34
|
+
export type RetryStrategy = 'exponential' | 'linear' | 'constant' | 'fibonacci';
|
|
35
|
+
/**
|
|
36
|
+
* Execute a function with retry logic
|
|
37
|
+
*/
|
|
38
|
+
export declare function withRetry<T>(fn: () => Promise<T>, config?: Partial<RetryConfig>, strategy?: RetryStrategy): Promise<RetryResult<T>>;
|
|
39
|
+
/**
|
|
40
|
+
* Create a retryable version of a function
|
|
41
|
+
*/
|
|
42
|
+
export declare function makeRetryable<T extends (...args: unknown[]) => Promise<unknown>>(fn: T, config?: Partial<RetryConfig>, strategy?: RetryStrategy): (...args: Parameters<T>) => Promise<RetryResult<Awaited<ReturnType<T>>>>;
|
|
43
|
+
/**
|
|
44
|
+
* Retry decorator for class methods
|
|
45
|
+
*/
|
|
46
|
+
export declare function Retryable(config?: Partial<RetryConfig>, strategy?: RetryStrategy): (_target: unknown, _propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
47
|
+
export default withRetry;
|
|
48
|
+
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../../src/production/retry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,MAAM,WAAW,WAAW;IAE1B,WAAW,EAAE,MAAM,CAAC;IAEpB,cAAc,EAAE,MAAM,CAAC;IAEvB,UAAU,EAAE,MAAM,CAAC;IAEnB,iBAAiB,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