kynjal-cli 3.1.3 → 4.0.0
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/.claude/agents/core/coder.md +1 -1
- package/.claude/agents/core/planner.md +2 -2
- package/.claude/agents/core/researcher.md +1 -1
- package/.claude/agents/core/reviewer.md +1 -1
- package/.claude/agents/core/tester.md +1 -1
- package/.claude/agents/data/data-ml-model.md +4 -4
- package/.claude/agents/development/dev-backend-api.md +4 -4
- package/.claude/agents/documentation/docs-api-openapi.md +4 -4
- package/.claude/agents/github/code-review-swarm.md +2 -2
- package/.claude/agents/github/issue-tracker.md +2 -2
- package/.claude/agents/github/pr-manager.md +2 -2
- package/.claude/agents/github/release-manager.md +2 -2
- package/.claude/agents/github/workflow-automation.md +2 -2
- package/.claude/agents/sparc/architecture.md +3 -3
- package/.claude/agents/sparc/pseudocode.md +2 -2
- package/.claude/agents/sparc/refinement.md +3 -3
- package/.claude/agents/sparc/specification.md +2 -2
- package/.claude/agents/swarm/adaptive-coordinator.md +1 -1
- package/.claude/agents/swarm/hierarchical-coordinator.md +1 -1
- package/.claude/agents/swarm/mesh-coordinator.md +1 -1
- package/.claude/agents/templates/base-template-generator.md +25 -4
- package/.claude/agents/templates/sparc-coordinator.md +3 -3
- package/.claude/helpers/auto-commit.sh +1 -1
- package/.claude/helpers/auto-memory-hook.mjs +27 -9
- package/.claude/helpers/hook-handler.cjs +58 -18
- package/.claude/helpers/statusline.cjs +14 -33
- package/.claude/helpers/statusline.js +3 -3
- package/.claude/settings.json +9 -9
- package/.claude/skills/reasoningbank-intelligence/SKILL.md +2 -2
- package/.claude/skills/swarm-orchestration/SKILL.md +1 -1
- package/README.md +383 -170
- package/bin/cli.js +6 -6
- package/bin/mcp-server.js +1 -1
- package/bin/preinstall.cjs +2 -0
- package/dist/src/appliance/gguf-engine.js +664 -0
- package/dist/src/appliance/gguf-engine.js.map +1 -0
- package/dist/src/appliance/ruvllm-bridge.js +492 -0
- package/dist/src/appliance/ruvllm-bridge.js.map +1 -0
- package/dist/src/appliance/rvfa-builder.js +383 -0
- package/dist/src/appliance/rvfa-builder.js.map +1 -0
- package/dist/src/appliance/rvfa-distribution.js +533 -0
- package/dist/src/appliance/rvfa-distribution.js.map +1 -0
- package/dist/src/appliance/rvfa-format.js +465 -0
- package/dist/src/appliance/rvfa-format.js.map +1 -0
- package/dist/src/appliance/rvfa-runner.js +373 -0
- package/dist/src/appliance/rvfa-runner.js.map +1 -0
- package/dist/src/appliance/rvfa-signing.js +469 -0
- package/dist/src/appliance/rvfa-signing.js.map +1 -0
- package/dist/src/benchmarks/pretrain/index.js +542 -331
- package/dist/src/benchmarks/pretrain/index.js.map +1 -1
- package/dist/src/commands/agent.d.ts.map +1 -1
- package/dist/src/commands/agent.js +725 -502
- package/dist/src/commands/agent.js.map +1 -1
- package/dist/src/commands/analyze.js +1548 -1218
- package/dist/src/commands/analyze.js.map +1 -1
- package/dist/src/commands/appliance-advanced.d.ts +9 -0
- package/dist/src/commands/appliance-advanced.d.ts.map +1 -0
- package/dist/src/commands/appliance-advanced.js +324 -0
- package/dist/src/commands/appliance-advanced.js.map +1 -0
- package/dist/src/commands/appliance.d.ts +8 -0
- package/dist/src/commands/appliance.d.ts.map +1 -0
- package/dist/src/commands/appliance.js +581 -0
- package/dist/src/commands/appliance.js.map +1 -0
- package/dist/src/commands/benchmark.js +523 -372
- package/dist/src/commands/benchmark.js.map +1 -1
- package/dist/src/commands/claims.js +364 -274
- package/dist/src/commands/claims.js.map +1 -1
- package/dist/src/commands/cleanup.d.ts +13 -0
- package/dist/src/commands/cleanup.d.ts.map +1 -0
- package/dist/src/commands/cleanup.js +262 -0
- package/dist/src/commands/cleanup.js.map +1 -0
- package/dist/src/commands/completions.js +118 -477
- package/dist/src/commands/completions.js.map +1 -1
- package/dist/src/commands/config.js +303 -237
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/daemon.d.ts.map +1 -1
- package/dist/src/commands/daemon.js +597 -425
- package/dist/src/commands/daemon.js.map +1 -1
- package/dist/src/commands/deployment.js +275 -194
- package/dist/src/commands/deployment.js.map +1 -1
- package/dist/src/commands/doctor.d.ts.map +1 -1
- package/dist/src/commands/doctor.js +690 -460
- package/dist/src/commands/doctor.js.map +1 -1
- package/dist/src/commands/embeddings.js +1543 -1293
- package/dist/src/commands/embeddings.js.map +1 -1
- package/dist/src/commands/guidance.js +596 -449
- package/dist/src/commands/guidance.js.map +1 -1
- package/dist/src/commands/hive-mind.js +938 -854
- package/dist/src/commands/hive-mind.js.map +1 -1
- package/dist/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +3677 -2570
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/index.js +322 -122
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/init.d.ts +1 -1
- package/dist/src/commands/init.d.ts.map +1 -1
- package/dist/src/commands/init.js +943 -787
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/issues.js +558 -383
- package/dist/src/commands/issues.js.map +1 -1
- package/dist/src/commands/mcp.d.ts.map +1 -1
- package/dist/src/commands/mcp.js +605 -475
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/commands/memory.d.ts.map +1 -1
- package/dist/src/commands/memory.js +1031 -814
- package/dist/src/commands/memory.js.map +1 -1
- package/dist/src/commands/migrate.js +347 -282
- package/dist/src/commands/migrate.js.map +1 -1
- package/dist/src/commands/neural.d.ts.map +1 -1
- package/dist/src/commands/neural.js +1563 -1283
- package/dist/src/commands/neural.js.map +1 -1
- package/dist/src/commands/performance.js +643 -497
- package/dist/src/commands/performance.js.map +1 -1
- package/dist/src/commands/plugins.js +841 -668
- package/dist/src/commands/plugins.js.map +1 -1
- package/dist/src/commands/process.js +447 -392
- package/dist/src/commands/process.js.map +1 -1
- package/dist/src/commands/progress.js +256 -162
- package/dist/src/commands/progress.js.map +1 -1
- package/dist/src/commands/providers.js +220 -150
- package/dist/src/commands/providers.js.map +1 -1
- package/dist/src/commands/route.js +665 -520
- package/dist/src/commands/route.js.map +1 -1
- package/dist/src/commands/ruvector/backup.js +651 -505
- package/dist/src/commands/ruvector/backup.js.map +1 -1
- package/dist/src/commands/ruvector/benchmark.js +401 -349
- package/dist/src/commands/ruvector/benchmark.js.map +1 -1
- package/dist/src/commands/ruvector/import.js +267 -225
- package/dist/src/commands/ruvector/import.js.map +1 -1
- package/dist/src/commands/ruvector/index.js +75 -37
- package/dist/src/commands/ruvector/index.js.map +1 -1
- package/dist/src/commands/ruvector/init.js +359 -336
- package/dist/src/commands/ruvector/init.js.map +1 -1
- package/dist/src/commands/ruvector/migrate.js +322 -335
- package/dist/src/commands/ruvector/migrate.js.map +1 -1
- package/dist/src/commands/ruvector/optimize.js +431 -375
- package/dist/src/commands/ruvector/optimize.js.map +1 -1
- package/dist/src/commands/ruvector/setup.js +117 -703
- package/dist/src/commands/ruvector/setup.js.map +1 -1
- package/dist/src/commands/ruvector/status.js +419 -364
- package/dist/src/commands/ruvector/status.js.map +1 -1
- package/dist/src/commands/security.d.ts.map +1 -1
- package/dist/src/commands/security.js +610 -456
- package/dist/src/commands/security.js.map +1 -1
- package/dist/src/commands/session.d.ts +1 -1
- package/dist/src/commands/session.js +627 -505
- package/dist/src/commands/session.js.map +1 -1
- package/dist/src/commands/start.d.ts +1 -1
- package/dist/src/commands/start.js +368 -271
- package/dist/src/commands/start.js.map +1 -1
- package/dist/src/commands/status.d.ts +1 -1
- package/dist/src/commands/status.d.ts.map +1 -1
- package/dist/src/commands/status.js +492 -379
- package/dist/src/commands/status.js.map +1 -1
- package/dist/src/commands/swarm.js +488 -408
- package/dist/src/commands/swarm.js.map +1 -1
- package/dist/src/commands/task.d.ts +1 -1
- package/dist/src/commands/task.js +539 -424
- package/dist/src/commands/task.js.map +1 -1
- package/dist/src/commands/transfer-store.js +412 -322
- package/dist/src/commands/transfer-store.js.map +1 -1
- package/dist/src/commands/update.js +291 -196
- package/dist/src/commands/update.js.map +1 -1
- package/dist/src/commands/workflow.js +486 -386
- package/dist/src/commands/workflow.js.map +1 -1
- package/dist/src/config-adapter.js +40 -39
- package/dist/src/config-adapter.js.map +1 -1
- package/dist/src/index.js +416 -312
- package/dist/src/index.js.map +1 -1
- package/dist/src/infrastructure/in-memory-repositories.js +507 -246
- package/dist/src/infrastructure/in-memory-repositories.js.map +1 -1
- package/dist/src/init/claudemd-generator.js +78 -368
- package/dist/src/init/claudemd-generator.js.map +1 -1
- package/dist/src/init/executor.js +1019 -1345
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/init/helpers-generator.js +60 -635
- 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.d.ts +0 -1
- package/dist/src/init/mcp-generator.d.ts.map +1 -1
- package/dist/src/init/mcp-generator.js +62 -42
- package/dist/src/init/mcp-generator.js.map +1 -1
- package/dist/src/init/settings-generator.d.ts.map +1 -1
- package/dist/src/init/settings-generator.js +167 -100
- package/dist/src/init/settings-generator.js.map +1 -1
- package/dist/src/init/statusline-generator.d.ts +16 -8
- package/dist/src/init/statusline-generator.d.ts.map +1 -1
- package/dist/src/init/statusline-generator.js +20 -1300
- package/dist/src/init/statusline-generator.js.map +1 -1
- package/dist/src/init/types.d.ts +15 -5
- package/dist/src/init/types.d.ts.map +1 -1
- package/dist/src/init/types.js +66 -76
- package/dist/src/init/types.js.map +1 -1
- package/dist/src/mcp-client.js +130 -76
- package/dist/src/mcp-client.js.map +1 -1
- package/dist/src/mcp-server.js +758 -445
- package/dist/src/mcp-server.js.map +1 -1
- package/dist/src/mcp-tools/agent-tools.js +492 -391
- package/dist/src/mcp-tools/agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/agentdb-tools.d.ts +30 -0
- package/dist/src/mcp-tools/agentdb-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/agentdb-tools.js +758 -0
- package/dist/src/mcp-tools/agentdb-tools.js.map +1 -0
- package/dist/src/mcp-tools/analyze-tools.js +236 -172
- package/dist/src/mcp-tools/analyze-tools.js.map +1 -1
- package/dist/src/mcp-tools/auto-install.js +142 -80
- package/dist/src/mcp-tools/auto-install.js.map +1 -1
- package/dist/src/mcp-tools/browser-tools.js +375 -252
- package/dist/src/mcp-tools/browser-tools.js.map +1 -1
- package/dist/src/mcp-tools/claims-tools.js +565 -473
- package/dist/src/mcp-tools/claims-tools.js.map +1 -1
- package/dist/src/mcp-tools/config-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/config-tools.js +284 -190
- package/dist/src/mcp-tools/config-tools.js.map +1 -1
- package/dist/src/mcp-tools/coordination-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/coordination-tools.js +600 -349
- package/dist/src/mcp-tools/coordination-tools.js.map +1 -1
- package/dist/src/mcp-tools/daa-tools.js +367 -289
- package/dist/src/mcp-tools/daa-tools.js.map +1 -1
- package/dist/src/mcp-tools/embeddings-tools.js +693 -582
- package/dist/src/mcp-tools/embeddings-tools.js.map +1 -1
- package/dist/src/mcp-tools/github-tools.js +312 -261
- package/dist/src/mcp-tools/github-tools.js.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.js +718 -423
- package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.js +2726 -1978
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
- package/dist/src/mcp-tools/index.d.ts +2 -0
- package/dist/src/mcp-tools/index.d.ts.map +1 -1
- package/dist/src/mcp-tools/index.js +2 -0
- package/dist/src/mcp-tools/index.js.map +1 -1
- package/dist/src/mcp-tools/memory-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/memory-tools.js +514 -329
- package/dist/src/mcp-tools/memory-tools.js.map +1 -1
- package/dist/src/mcp-tools/neural-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/neural-tools.js +428 -326
- package/dist/src/mcp-tools/neural-tools.js.map +1 -1
- package/dist/src/mcp-tools/performance-tools.js +480 -420
- package/dist/src/mcp-tools/performance-tools.js.map +1 -1
- package/dist/src/mcp-tools/progress-tools.js +278 -204
- package/dist/src/mcp-tools/progress-tools.js.map +1 -1
- package/dist/src/mcp-tools/ruvllm-tools.d.ts +9 -0
- package/dist/src/mcp-tools/ruvllm-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/ruvllm-tools.js +399 -0
- package/dist/src/mcp-tools/ruvllm-tools.js.map +1 -0
- package/dist/src/mcp-tools/security-tools.js +429 -297
- package/dist/src/mcp-tools/security-tools.js.map +1 -1
- package/dist/src/mcp-tools/session-tools.js +234 -185
- package/dist/src/mcp-tools/session-tools.js.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.d.ts +2 -1
- package/dist/src/mcp-tools/swarm-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.js +303 -64
- package/dist/src/mcp-tools/swarm-tools.js.map +1 -1
- package/dist/src/mcp-tools/system-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/system-tools.js +352 -200
- package/dist/src/mcp-tools/system-tools.js.map +1 -1
- package/dist/src/mcp-tools/task-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/task-tools.js +357 -189
- package/dist/src/mcp-tools/task-tools.js.map +1 -1
- package/dist/src/mcp-tools/terminal-tools.js +196 -148
- package/dist/src/mcp-tools/terminal-tools.js.map +1 -1
- package/dist/src/mcp-tools/transfer-tools.js +333 -186
- package/dist/src/mcp-tools/transfer-tools.js.map +1 -1
- package/dist/src/mcp-tools/wasm-agent-tools.d.ts +9 -0
- package/dist/src/mcp-tools/wasm-agent-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/wasm-agent-tools.js +377 -0
- package/dist/src/mcp-tools/wasm-agent-tools.js.map +1 -0
- package/dist/src/mcp-tools/workflow-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/workflow-tools.js +471 -335
- package/dist/src/mcp-tools/workflow-tools.js.map +1 -1
- package/dist/src/memory/ewc-consolidation.js +345 -173
- package/dist/src/memory/ewc-consolidation.js.map +1 -1
- package/dist/src/memory/intelligence.js +841 -359
- package/dist/src/memory/intelligence.js.map +1 -1
- package/dist/src/memory/memory-bridge.js +1964 -0
- package/dist/src/memory/memory-bridge.js.map +1 -0
- package/dist/src/memory/memory-initializer.js +1895 -1602
- package/dist/src/memory/memory-initializer.js.map +1 -1
- package/dist/src/memory/sona-optimizer.js +329 -199
- 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 +273 -242
- package/dist/src/output.js.map +1 -1
- package/dist/src/parser.js +217 -124
- package/dist/src/parser.js.map +1 -1
- package/dist/src/plugins/manager.js +531 -278
- package/dist/src/plugins/manager.js.map +1 -1
- package/dist/src/plugins/store/discovery.js +362 -275
- package/dist/src/plugins/store/discovery.js.map +1 -1
- package/dist/src/plugins/store/index.js +105 -48
- package/dist/src/plugins/store/index.js.map +1 -1
- package/dist/src/plugins/store/search.js +107 -69
- package/dist/src/plugins/store/search.js.map +1 -1
- package/dist/src/plugins/tests/demo-plugin-store.js +160 -113
- package/dist/src/plugins/tests/demo-plugin-store.js.map +1 -1
- package/dist/src/plugins/tests/standalone-test.js +223 -172
- package/dist/src/plugins/tests/standalone-test.js.map +1 -1
- package/dist/src/plugins/tests/test-plugin-store.js +228 -190
- package/dist/src/plugins/tests/test-plugin-store.js.map +1 -1
- package/dist/src/production/circuit-breaker.js +126 -62
- package/dist/src/production/circuit-breaker.js.map +1 -1
- package/dist/src/production/error-handler.js +156 -86
- package/dist/src/production/error-handler.js.map +1 -1
- package/dist/src/production/monitoring.js +220 -139
- package/dist/src/production/monitoring.js.map +1 -1
- package/dist/src/production/rate-limiter.js +93 -74
- package/dist/src/production/rate-limiter.js.map +1 -1
- package/dist/src/production/retry.js +167 -75
- package/dist/src/production/retry.js.map +1 -1
- package/dist/src/prompt.js +560 -436
- package/dist/src/prompt.js.map +1 -1
- package/dist/src/runtime/headless.js +289 -200
- package/dist/src/runtime/headless.js.map +1 -1
- package/dist/src/ruvector/agent-wasm.js +511 -0
- package/dist/src/ruvector/agent-wasm.js.map +1 -0
- package/dist/src/ruvector/ast-analyzer.js +232 -145
- package/dist/src/ruvector/ast-analyzer.js.map +1 -1
- package/dist/src/ruvector/coverage-router.js +419 -287
- package/dist/src/ruvector/coverage-router.js.map +1 -1
- package/dist/src/ruvector/coverage-tools.js +101 -56
- package/dist/src/ruvector/coverage-tools.js.map +1 -1
- package/dist/src/ruvector/diff-classifier.js +451 -324
- package/dist/src/ruvector/diff-classifier.js.map +1 -1
- package/dist/src/ruvector/enhanced-model-router.js +337 -251
- package/dist/src/ruvector/enhanced-model-router.js.map +1 -1
- package/dist/src/ruvector/flash-attention.js +254 -223
- package/dist/src/ruvector/flash-attention.js.map +1 -1
- package/dist/src/ruvector/graph-analyzer.js +680 -486
- package/dist/src/ruvector/graph-analyzer.js.map +1 -1
- package/dist/src/ruvector/index.js +113 -27
- package/dist/src/ruvector/index.js.map +1 -1
- package/dist/src/ruvector/lora-adapter.js +248 -155
- package/dist/src/ruvector/lora-adapter.js.map +1 -1
- package/dist/src/ruvector/model-router.js +248 -175
- package/dist/src/ruvector/model-router.js.map +1 -1
- package/dist/src/ruvector/moe-router.js +286 -228
- package/dist/src/ruvector/moe-router.js.map +1 -1
- package/dist/src/ruvector/q-learning-router.js +338 -257
- package/dist/src/ruvector/q-learning-router.js.map +1 -1
- package/dist/src/ruvector/ruvllm-wasm.js +527 -0
- package/dist/src/ruvector/ruvllm-wasm.js.map +1 -0
- package/dist/src/ruvector/semantic-router.js +67 -60
- package/dist/src/ruvector/semantic-router.js.map +1 -1
- package/dist/src/ruvector/vector-db.js +205 -119
- package/dist/src/ruvector/vector-db.js.map +1 -1
- package/dist/src/services/agentic-flow-bridge.js +168 -0
- package/dist/src/services/agentic-flow-bridge.js.map +1 -0
- package/dist/src/services/claim-service.js +940 -615
- package/dist/src/services/claim-service.js.map +1 -1
- package/dist/src/services/container-worker-pool.js +669 -399
- package/dist/src/services/container-worker-pool.js.map +1 -1
- package/dist/src/services/headless-worker-executor.js +467 -441
- package/dist/src/services/headless-worker-executor.js.map +1 -1
- package/dist/src/services/index.d.ts +5 -5
- 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.js +201 -93
- package/dist/src/services/registry-api.js.map +1 -1
- package/dist/src/services/ruvector-training.js +414 -144
- package/dist/src/services/ruvector-training.js.map +1 -1
- package/dist/src/services/worker-daemon.js +928 -531
- package/dist/src/services/worker-daemon.js.map +1 -1
- package/dist/src/services/worker-queue.js +550 -331
- package/dist/src/services/worker-queue.js.map +1 -1
- package/dist/src/suggest.js +55 -45
- package/dist/src/suggest.js.map +1 -1
- package/dist/src/transfer/anonymization/index.js +37 -29
- package/dist/src/transfer/anonymization/index.js.map +1 -1
- package/dist/src/transfer/deploy-seraphine.d.ts +1 -1
- package/dist/src/transfer/deploy-seraphine.js +156 -129
- package/dist/src/transfer/deploy-seraphine.js.map +1 -1
- package/dist/src/transfer/export.js +142 -84
- 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 +2 -0
- package/dist/src/transfer/index.js.map +1 -1
- package/dist/src/transfer/ipfs/client.js +337 -179
- package/dist/src/transfer/ipfs/client.js.map +1 -1
- package/dist/src/transfer/ipfs/upload.js +434 -290
- package/dist/src/transfer/ipfs/upload.js.map +1 -1
- package/dist/src/transfer/models/seraphine.js +58 -58
- package/dist/src/transfer/models/seraphine.js.map +1 -1
- package/dist/src/transfer/serialization/cfp.js +37 -33
- package/dist/src/transfer/serialization/cfp.js.map +1 -1
- package/dist/src/transfer/storage/gcs.js +248 -139
- package/dist/src/transfer/storage/gcs.js.map +1 -1
- package/dist/src/transfer/store/discovery.js +353 -243
- package/dist/src/transfer/store/discovery.js.map +1 -1
- package/dist/src/transfer/store/download.js +365 -243
- package/dist/src/transfer/store/download.js.map +1 -1
- package/dist/src/transfer/store/index.js +130 -63
- package/dist/src/transfer/store/index.js.map +1 -1
- package/dist/src/transfer/store/publish.js +258 -184
- package/dist/src/transfer/store/publish.js.map +1 -1
- package/dist/src/transfer/store/registry.js +73 -51
- package/dist/src/transfer/store/registry.js.map +1 -1
- package/dist/src/transfer/store/search.js +96 -64
- package/dist/src/transfer/store/search.js.map +1 -1
- package/dist/src/transfer/store/tests/standalone-test.js +231 -174
- package/dist/src/transfer/store/tests/standalone-test.js.map +1 -1
- package/dist/src/transfer/test-seraphine.js +130 -95
- package/dist/src/transfer/test-seraphine.js.map +1 -1
- package/dist/src/transfer/tests/test-store.js +239 -194
- package/dist/src/transfer/tests/test-store.js.map +1 -1
- package/dist/src/types.js +56 -27
- package/dist/src/types.js.map +1 -1
- package/dist/src/update/checker.js +183 -106
- package/dist/src/update/checker.js.map +1 -1
- package/dist/src/update/executor.js +198 -135
- package/dist/src/update/executor.js.map +1 -1
- package/dist/src/update/index.js +85 -38
- package/dist/src/update/index.js.map +1 -1
- package/dist/src/update/rate-limiter.js +31 -19
- package/dist/src/update/rate-limiter.js.map +1 -1
- package/dist/src/update/validator.js +64 -38
- package/dist/src/update/validator.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -10
- package/.claude/agents/custom/accessibility-auditor.yaml +0 -56
- package/.claude/agents/custom/design-architect.yaml +0 -48
- package/.claude/agents/custom/ui-developer.yaml +0 -46
- package/.claude/agents/custom/ux-researcher.yaml +0 -60
- package/dist/src/benchmarks/pretrain/index.d.ts +0 -58
- package/dist/src/benchmarks/pretrain/index.d.ts.map +0 -1
- package/dist/src/commands/index.d.ts +0 -108
- package/dist/src/commands/index.d.ts.map +0 -1
- package/dist/src/config-adapter.d.ts +0 -15
- package/dist/src/config-adapter.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -76
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/infrastructure/in-memory-repositories.d.ts +0 -68
- package/dist/src/infrastructure/in-memory-repositories.d.ts.map +0 -1
- package/dist/src/init/claudemd-generator.d.ts +0 -25
- package/dist/src/init/claudemd-generator.d.ts.map +0 -1
- package/dist/src/init/executor.d.ts +0 -41
- package/dist/src/init/executor.d.ts.map +0 -1
- package/dist/src/init/helpers-generator.d.ts +0 -60
- package/dist/src/init/helpers-generator.d.ts.map +0 -1
- package/dist/src/mcp-client.d.ts +0 -92
- package/dist/src/mcp-client.d.ts.map +0 -1
- package/dist/src/mcp-server.d.ts +0 -161
- package/dist/src/mcp-server.d.ts.map +0 -1
- package/dist/src/mcp-tools/auto-install.d.ts +0 -83
- package/dist/src/mcp-tools/auto-install.d.ts.map +0 -1
- package/dist/src/mcp-tools/types.d.ts +0 -31
- package/dist/src/mcp-tools/types.d.ts.map +0 -1
- package/dist/src/memory/ewc-consolidation.d.ts +0 -271
- package/dist/src/memory/ewc-consolidation.d.ts.map +0 -1
- package/dist/src/memory/intelligence.d.ts +0 -285
- package/dist/src/memory/intelligence.d.ts.map +0 -1
- package/dist/src/memory/memory-initializer.d.ts +0 -396
- package/dist/src/memory/memory-initializer.d.ts.map +0 -1
- package/dist/src/memory/sona-optimizer.d.ts +0 -227
- package/dist/src/memory/sona-optimizer.d.ts.map +0 -1
- package/dist/src/parser.d.ts +0 -41
- package/dist/src/parser.d.ts.map +0 -1
- package/dist/src/plugins/manager.d.ts +0 -133
- package/dist/src/plugins/manager.d.ts.map +0 -1
- package/dist/src/plugins/store/discovery.d.ts +0 -88
- package/dist/src/plugins/store/discovery.d.ts.map +0 -1
- package/dist/src/plugins/store/index.d.ts +0 -76
- package/dist/src/plugins/store/index.d.ts.map +0 -1
- package/dist/src/plugins/store/search.d.ts +0 -46
- package/dist/src/plugins/store/search.d.ts.map +0 -1
- package/dist/src/plugins/store/types.d.ts +0 -274
- package/dist/src/plugins/store/types.d.ts.map +0 -1
- package/dist/src/production/circuit-breaker.d.ts +0 -101
- package/dist/src/production/circuit-breaker.d.ts.map +0 -1
- package/dist/src/production/error-handler.d.ts +0 -92
- package/dist/src/production/error-handler.d.ts.map +0 -1
- package/dist/src/production/monitoring.d.ts +0 -161
- package/dist/src/production/monitoring.d.ts.map +0 -1
- package/dist/src/production/rate-limiter.d.ts +0 -80
- package/dist/src/production/rate-limiter.d.ts.map +0 -1
- package/dist/src/production/retry.d.ts +0 -48
- package/dist/src/production/retry.d.ts.map +0 -1
- package/dist/src/prompt.d.ts +0 -44
- package/dist/src/prompt.d.ts.map +0 -1
- package/dist/src/runtime/headless.d.ts +0 -60
- package/dist/src/runtime/headless.d.ts.map +0 -1
- package/dist/src/ruvector/ast-analyzer.d.ts +0 -67
- package/dist/src/ruvector/ast-analyzer.d.ts.map +0 -1
- package/dist/src/ruvector/coverage-router.d.ts +0 -160
- package/dist/src/ruvector/coverage-router.d.ts.map +0 -1
- package/dist/src/ruvector/diff-classifier.d.ts +0 -175
- package/dist/src/ruvector/diff-classifier.d.ts.map +0 -1
- package/dist/src/ruvector/enhanced-model-router.d.ts +0 -146
- package/dist/src/ruvector/enhanced-model-router.d.ts.map +0 -1
- package/dist/src/ruvector/flash-attention.d.ts +0 -195
- package/dist/src/ruvector/flash-attention.d.ts.map +0 -1
- package/dist/src/ruvector/graph-analyzer.d.ts +0 -187
- package/dist/src/ruvector/graph-analyzer.d.ts.map +0 -1
- package/dist/src/ruvector/index.d.ts +0 -34
- package/dist/src/ruvector/index.d.ts.map +0 -1
- package/dist/src/ruvector/lora-adapter.d.ts +0 -218
- package/dist/src/ruvector/lora-adapter.d.ts.map +0 -1
- package/dist/src/ruvector/model-router.d.ts +0 -220
- package/dist/src/ruvector/model-router.d.ts.map +0 -1
- package/dist/src/ruvector/moe-router.d.ts +0 -206
- package/dist/src/ruvector/moe-router.d.ts.map +0 -1
- package/dist/src/ruvector/q-learning-router.d.ts +0 -211
- package/dist/src/ruvector/q-learning-router.d.ts.map +0 -1
- package/dist/src/ruvector/semantic-router.d.ts +0 -77
- package/dist/src/ruvector/semantic-router.d.ts.map +0 -1
- package/dist/src/ruvector/vector-db.d.ts +0 -69
- package/dist/src/ruvector/vector-db.d.ts.map +0 -1
- package/dist/src/services/claim-service.d.ts +0 -204
- package/dist/src/services/claim-service.d.ts.map +0 -1
- package/dist/src/services/container-worker-pool.d.ts +0 -197
- package/dist/src/services/container-worker-pool.d.ts.map +0 -1
- package/dist/src/services/headless-worker-executor.d.ts +0 -304
- package/dist/src/services/headless-worker-executor.d.ts.map +0 -1
- package/dist/src/services/registry-api.d.ts +0 -58
- package/dist/src/services/registry-api.d.ts.map +0 -1
- package/dist/src/services/ruvector-training.d.ts +0 -213
- package/dist/src/services/ruvector-training.d.ts.map +0 -1
- package/dist/src/services/worker-daemon.d.ts +0 -203
- package/dist/src/services/worker-daemon.d.ts.map +0 -1
- package/dist/src/services/worker-queue.d.ts +0 -194
- package/dist/src/services/worker-queue.d.ts.map +0 -1
- package/dist/src/suggest.d.ts +0 -53
- package/dist/src/suggest.d.ts.map +0 -1
- package/dist/src/transfer/export.d.ts +0 -25
- package/dist/src/transfer/export.d.ts.map +0 -1
- package/dist/src/transfer/ipfs/client.d.ts +0 -109
- package/dist/src/transfer/ipfs/client.d.ts.map +0 -1
- package/dist/src/transfer/ipfs/upload.d.ts +0 -95
- package/dist/src/transfer/ipfs/upload.d.ts.map +0 -1
- package/dist/src/transfer/models/seraphine.d.ts +0 -72
- package/dist/src/transfer/models/seraphine.d.ts.map +0 -1
- package/dist/src/transfer/serialization/cfp.d.ts +0 -49
- package/dist/src/transfer/serialization/cfp.d.ts.map +0 -1
- package/dist/src/transfer/storage/gcs.d.ts +0 -82
- package/dist/src/transfer/storage/gcs.d.ts.map +0 -1
- package/dist/src/transfer/store/discovery.d.ts +0 -84
- package/dist/src/transfer/store/discovery.d.ts.map +0 -1
- package/dist/src/transfer/store/download.d.ts +0 -70
- package/dist/src/transfer/store/download.d.ts.map +0 -1
- package/dist/src/transfer/store/index.d.ts +0 -84
- package/dist/src/transfer/store/index.d.ts.map +0 -1
- package/dist/src/transfer/store/publish.d.ts +0 -76
- package/dist/src/transfer/store/publish.d.ts.map +0 -1
- package/dist/src/transfer/store/search.d.ts +0 -54
- package/dist/src/transfer/store/search.d.ts.map +0 -1
- package/dist/src/transfer/types.d.ts +0 -245
- package/dist/src/transfer/types.d.ts.map +0 -1
- package/dist/src/types.d.ts +0 -198
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/update/checker.d.ts +0 -34
- package/dist/src/update/checker.d.ts.map +0 -1
- package/dist/src/update/executor.d.ts +0 -32
- package/dist/src/update/executor.d.ts.map +0 -1
- package/dist/src/update/index.d.ts +0 -33
- package/dist/src/update/index.d.ts.map +0 -1
- package/dist/src/update/rate-limiter.d.ts +0 -20
- package/dist/src/update/rate-limiter.d.ts.map +0 -1
- package/dist/src/update/validator.d.ts +0 -17
- package/dist/src/update/validator.d.ts.map +0 -1
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Flash Attention Implementation for RuVector Intelligence System
|
|
3
|
-
*
|
|
4
|
-
* Implements block-wise attention computation for faster similarity calculations.
|
|
5
|
-
* Achieves O(N) memory instead of O(N^2) through tiling strategy.
|
|
6
|
-
*
|
|
7
|
-
* Key optimizations:
|
|
8
|
-
* - Block-wise computation to fit in L1 cache
|
|
9
|
-
* - Fused softmax-matmul operations
|
|
10
|
-
* - Float32Array for all operations
|
|
11
|
-
* - Online softmax for numerical stability
|
|
12
|
-
*
|
|
13
|
-
* Target: 2-5x speedup on CPU vs naive attention
|
|
14
|
-
*
|
|
15
|
-
* Created with love by ruv.io
|
|
16
|
-
*/
|
|
17
|
-
export interface FlashAttentionConfig {
|
|
18
|
-
/** Block size for tiling (32-64 optimal for CPU L1 cache) */
|
|
19
|
-
blockSize: number;
|
|
20
|
-
/** Number of dimensions in embedding vectors */
|
|
21
|
-
dimensions: number;
|
|
22
|
-
/** Temperature for softmax scaling */
|
|
23
|
-
temperature: number;
|
|
24
|
-
/** Enable numerical stability optimizations */
|
|
25
|
-
useStableMode: boolean;
|
|
26
|
-
/** Use optimized CPU path (default: true) */
|
|
27
|
-
useCPUOptimizations: boolean;
|
|
28
|
-
}
|
|
29
|
-
export interface AttentionResult {
|
|
30
|
-
/** Output vectors after attention */
|
|
31
|
-
output: Float32Array[];
|
|
32
|
-
/** Attention weights (optional, for debugging) */
|
|
33
|
-
weights?: Float32Array[];
|
|
34
|
-
/** Computation time in milliseconds */
|
|
35
|
-
computeTimeMs: number;
|
|
36
|
-
}
|
|
37
|
-
export interface BenchmarkResult {
|
|
38
|
-
/** Naive attention time in milliseconds */
|
|
39
|
-
naiveTimeMs: number;
|
|
40
|
-
/** Flash attention time in milliseconds */
|
|
41
|
-
flashTimeMs: number;
|
|
42
|
-
/** Speedup factor (naive / flash) */
|
|
43
|
-
speedup: number;
|
|
44
|
-
/** Number of vectors benchmarked */
|
|
45
|
-
numVectors: number;
|
|
46
|
-
/** Dimensions of vectors */
|
|
47
|
-
dimensions: number;
|
|
48
|
-
/** Memory usage estimate for naive (bytes) */
|
|
49
|
-
naiveMemoryBytes: number;
|
|
50
|
-
/** Memory usage estimate for flash (bytes) */
|
|
51
|
-
flashMemoryBytes: number;
|
|
52
|
-
/** Memory reduction factor */
|
|
53
|
-
memoryReduction: number;
|
|
54
|
-
}
|
|
55
|
-
export declare class FlashAttention {
|
|
56
|
-
private config;
|
|
57
|
-
private lastSpeedup;
|
|
58
|
-
private benchmarkHistory;
|
|
59
|
-
private scoreBuffer;
|
|
60
|
-
private expBuffer;
|
|
61
|
-
private accumBuffer;
|
|
62
|
-
constructor(config?: Partial<FlashAttentionConfig>);
|
|
63
|
-
/**
|
|
64
|
-
* Main attention computation using Flash Attention algorithm
|
|
65
|
-
*
|
|
66
|
-
* @param queries - Query vectors [N x D]
|
|
67
|
-
* @param keys - Key vectors [M x D]
|
|
68
|
-
* @param values - Value vectors [M x D]
|
|
69
|
-
* @returns Attention output [N x D]
|
|
70
|
-
*/
|
|
71
|
-
attention(queries: Float32Array[], keys: Float32Array[], values: Float32Array[]): AttentionResult;
|
|
72
|
-
/**
|
|
73
|
-
* CPU-optimized attention with aggressive optimizations
|
|
74
|
-
*
|
|
75
|
-
* Key optimizations:
|
|
76
|
-
* - Blocked score computation (better cache utilization)
|
|
77
|
-
* - Top-K sparse attention (only use most relevant keys)
|
|
78
|
-
* - Pre-allocated buffers to avoid GC pressure
|
|
79
|
-
* - 8x loop unrolling for dot products
|
|
80
|
-
* - Fused max-finding during score computation
|
|
81
|
-
*/
|
|
82
|
-
private cpuOptimizedAttention;
|
|
83
|
-
/**
|
|
84
|
-
* Partial dot product using only first N dimensions (for screening)
|
|
85
|
-
*/
|
|
86
|
-
private partialDotProduct;
|
|
87
|
-
/**
|
|
88
|
-
* Partial sort to get top-K elements (QuickSelect-like)
|
|
89
|
-
* Only ensures first K elements are the largest, not sorted
|
|
90
|
-
*/
|
|
91
|
-
private partialSort;
|
|
92
|
-
/**
|
|
93
|
-
* Swap two indices in array
|
|
94
|
-
*/
|
|
95
|
-
private swapIndices;
|
|
96
|
-
/**
|
|
97
|
-
* Fast dot product with 8x unrolling
|
|
98
|
-
*/
|
|
99
|
-
private fastDotProduct;
|
|
100
|
-
/**
|
|
101
|
-
* Block-wise attention computation (Flash Attention core algorithm)
|
|
102
|
-
*
|
|
103
|
-
* Algorithm:
|
|
104
|
-
* For each block of queries Q_b:
|
|
105
|
-
* For each block of keys K_b:
|
|
106
|
-
* S_b = Q_b @ K_b.T / sqrt(d) // Block scores
|
|
107
|
-
* P_b = softmax(S_b) // Block attention
|
|
108
|
-
* O_b += P_b @ V_b // Accumulate output
|
|
109
|
-
*
|
|
110
|
-
* @param Q - Query vectors
|
|
111
|
-
* @param K - Key vectors
|
|
112
|
-
* @param V - Value vectors
|
|
113
|
-
* @param blockSize - Block size for tiling
|
|
114
|
-
*/
|
|
115
|
-
blockAttention(Q: Float32Array[], K: Float32Array[], V: Float32Array[], blockSize: number): Float32Array[];
|
|
116
|
-
/**
|
|
117
|
-
* Get the speedup factor from the last benchmark
|
|
118
|
-
*/
|
|
119
|
-
getSpeedup(): number;
|
|
120
|
-
/**
|
|
121
|
-
* Run benchmark comparing naive vs CPU-optimized attention
|
|
122
|
-
*
|
|
123
|
-
* @param numVectors - Number of vectors to test
|
|
124
|
-
* @param dimensions - Dimensions per vector
|
|
125
|
-
* @param iterations - Number of iterations for averaging
|
|
126
|
-
*/
|
|
127
|
-
benchmark(numVectors?: number, dimensions?: number, iterations?: number): BenchmarkResult;
|
|
128
|
-
/**
|
|
129
|
-
* Get benchmark history
|
|
130
|
-
*/
|
|
131
|
-
getBenchmarkHistory(): BenchmarkResult[];
|
|
132
|
-
/**
|
|
133
|
-
* Get configuration
|
|
134
|
-
*/
|
|
135
|
-
getConfig(): FlashAttentionConfig;
|
|
136
|
-
/**
|
|
137
|
-
* Update configuration
|
|
138
|
-
*/
|
|
139
|
-
setConfig(config: Partial<FlashAttentionConfig>): void;
|
|
140
|
-
/**
|
|
141
|
-
* Naive O(N^2) attention implementation for comparison
|
|
142
|
-
*/
|
|
143
|
-
private naiveAttention;
|
|
144
|
-
/**
|
|
145
|
-
* Compute block of attention scores
|
|
146
|
-
*/
|
|
147
|
-
private computeBlockScores;
|
|
148
|
-
/**
|
|
149
|
-
* Online softmax with output accumulation (key to Flash Attention)
|
|
150
|
-
*
|
|
151
|
-
* Uses the online softmax trick to maintain numerical stability
|
|
152
|
-
* while processing blocks incrementally.
|
|
153
|
-
*/
|
|
154
|
-
private onlineSoftmaxAccumulate;
|
|
155
|
-
/**
|
|
156
|
-
* Compute dot product of two vectors
|
|
157
|
-
*/
|
|
158
|
-
private dotProduct;
|
|
159
|
-
/**
|
|
160
|
-
* Stable softmax implementation
|
|
161
|
-
*/
|
|
162
|
-
private softmax;
|
|
163
|
-
/**
|
|
164
|
-
* Generate random vectors for benchmarking
|
|
165
|
-
*/
|
|
166
|
-
private generateRandomVectors;
|
|
167
|
-
/**
|
|
168
|
-
* Validate input arrays
|
|
169
|
-
*/
|
|
170
|
-
private validateInputs;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Get singleton FlashAttention instance
|
|
174
|
-
*
|
|
175
|
-
* @param config - Optional configuration (only used on first call)
|
|
176
|
-
* @returns FlashAttention instance
|
|
177
|
-
*/
|
|
178
|
-
export declare function getFlashAttention(config?: Partial<FlashAttentionConfig>): FlashAttention;
|
|
179
|
-
/**
|
|
180
|
-
* Reset singleton (for testing)
|
|
181
|
-
*/
|
|
182
|
-
export declare function resetFlashAttention(): void;
|
|
183
|
-
/**
|
|
184
|
-
* Compute attention using Flash Attention
|
|
185
|
-
*/
|
|
186
|
-
export declare function computeAttention(queries: Float32Array[], keys: Float32Array[], values: Float32Array[], config?: Partial<FlashAttentionConfig>): AttentionResult;
|
|
187
|
-
/**
|
|
188
|
-
* Run Flash Attention benchmark
|
|
189
|
-
*/
|
|
190
|
-
export declare function benchmarkFlashAttention(numVectors?: number, dimensions?: number, iterations?: number): BenchmarkResult;
|
|
191
|
-
/**
|
|
192
|
-
* Get current speedup from last benchmark
|
|
193
|
-
*/
|
|
194
|
-
export declare function getFlashAttentionSpeedup(): number;
|
|
195
|
-
//# sourceMappingURL=flash-attention.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flash-attention.d.ts","sourceRoot":"","sources":["../../../src/ruvector/flash-attention.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,MAAM,WAAW,oBAAoB;IACnC,6DAA6D;IAC7D,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,aAAa,EA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AE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,GAClB,eAAe,CAEjB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAEjD"}
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Graph Analyzer Module
|
|
3
|
-
*
|
|
4
|
-
* Provides code dependency graph analysis using ruvector's graph algorithms:
|
|
5
|
-
* - MinCut for code boundary detection (refactoring suggestions)
|
|
6
|
-
* - Louvain for module/community detection
|
|
7
|
-
* - Circular dependency detection
|
|
8
|
-
* - DOT format export for visualization
|
|
9
|
-
*
|
|
10
|
-
* Falls back to built-in implementations when @ruvector/wasm is not available.
|
|
11
|
-
*
|
|
12
|
-
* @module @claude-flow/cli/ruvector/graph-analyzer
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* Clear all graph caches
|
|
16
|
-
*/
|
|
17
|
-
export declare function clearGraphCaches(): void;
|
|
18
|
-
/**
|
|
19
|
-
* Get cache statistics
|
|
20
|
-
*/
|
|
21
|
-
export declare function getGraphCacheStats(): {
|
|
22
|
-
graphCacheSize: number;
|
|
23
|
-
analysisCacheSize: number;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Node in the dependency graph
|
|
27
|
-
*/
|
|
28
|
-
export interface GraphNode {
|
|
29
|
-
id: string;
|
|
30
|
-
path: string;
|
|
31
|
-
name: string;
|
|
32
|
-
type: 'file' | 'module' | 'package';
|
|
33
|
-
imports: string[];
|
|
34
|
-
exports: string[];
|
|
35
|
-
size: number;
|
|
36
|
-
complexity?: number;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Edge in the dependency graph
|
|
40
|
-
*/
|
|
41
|
-
export interface GraphEdge {
|
|
42
|
-
source: string;
|
|
43
|
-
target: string;
|
|
44
|
-
type: 'import' | 'require' | 'dynamic' | 're-export';
|
|
45
|
-
weight: number;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Dependency graph representation
|
|
49
|
-
*/
|
|
50
|
-
export interface DependencyGraph {
|
|
51
|
-
nodes: Map<string, GraphNode>;
|
|
52
|
-
edges: GraphEdge[];
|
|
53
|
-
metadata: {
|
|
54
|
-
rootDir: string;
|
|
55
|
-
totalFiles: number;
|
|
56
|
-
totalEdges: number;
|
|
57
|
-
buildTime: number;
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* MinCut result representing a natural boundary in the codebase
|
|
62
|
-
*/
|
|
63
|
-
export interface MinCutBoundary {
|
|
64
|
-
cutValue: number;
|
|
65
|
-
partition1: string[];
|
|
66
|
-
partition2: string[];
|
|
67
|
-
cutEdges: GraphEdge[];
|
|
68
|
-
suggestion: string;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Community/module detection result
|
|
72
|
-
*/
|
|
73
|
-
export interface ModuleCommunity {
|
|
74
|
-
id: number;
|
|
75
|
-
members: string[];
|
|
76
|
-
cohesion: number;
|
|
77
|
-
centralNode?: string;
|
|
78
|
-
suggestedName?: string;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Circular dependency info
|
|
82
|
-
*/
|
|
83
|
-
export interface CircularDependency {
|
|
84
|
-
cycle: string[];
|
|
85
|
-
severity: 'low' | 'medium' | 'high';
|
|
86
|
-
suggestion: string;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Analysis result
|
|
90
|
-
*/
|
|
91
|
-
export interface GraphAnalysisResult {
|
|
92
|
-
graph: DependencyGraph;
|
|
93
|
-
boundaries?: MinCutBoundary[];
|
|
94
|
-
communities?: ModuleCommunity[];
|
|
95
|
-
circularDependencies: CircularDependency[];
|
|
96
|
-
statistics: {
|
|
97
|
-
nodeCount: number;
|
|
98
|
-
edgeCount: number;
|
|
99
|
-
avgDegree: number;
|
|
100
|
-
maxDegree: number;
|
|
101
|
-
density: number;
|
|
102
|
-
componentCount: number;
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Interface for ruvector graph operations
|
|
107
|
-
*/
|
|
108
|
-
interface IRuVectorGraph {
|
|
109
|
-
mincut(nodes: string[], edges: Array<[string, string, number]>): {
|
|
110
|
-
cutValue: number;
|
|
111
|
-
partition1: string[];
|
|
112
|
-
partition2: string[];
|
|
113
|
-
cutEdges: Array<[string, string]>;
|
|
114
|
-
};
|
|
115
|
-
louvain(nodes: string[], edges: Array<[string, string, number]>): {
|
|
116
|
-
communities: Array<{
|
|
117
|
-
id: number;
|
|
118
|
-
members: string[];
|
|
119
|
-
}>;
|
|
120
|
-
modularity: number;
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Attempt to load ruvector graph algorithms
|
|
125
|
-
*/
|
|
126
|
-
declare function loadRuVector(): Promise<IRuVectorGraph | null>;
|
|
127
|
-
/**
|
|
128
|
-
* Build dependency graph from source directory (with caching)
|
|
129
|
-
*/
|
|
130
|
-
export declare function buildDependencyGraph(rootDir: string, options?: {
|
|
131
|
-
include?: string[];
|
|
132
|
-
exclude?: string[];
|
|
133
|
-
maxDepth?: number;
|
|
134
|
-
skipCache?: boolean;
|
|
135
|
-
}): Promise<DependencyGraph>;
|
|
136
|
-
/**
|
|
137
|
-
* Stoer-Wagner MinCut algorithm (fallback when ruvector not available)
|
|
138
|
-
* Finds minimum cut with deterministic result
|
|
139
|
-
*/
|
|
140
|
-
declare function fallbackMinCut(nodes: string[], edges: Array<[string, string, number]>): {
|
|
141
|
-
cutValue: number;
|
|
142
|
-
partition1: string[];
|
|
143
|
-
partition2: string[];
|
|
144
|
-
cutEdges: Array<[string, string]>;
|
|
145
|
-
};
|
|
146
|
-
/**
|
|
147
|
-
* Louvain community detection algorithm (fallback when ruvector not available)
|
|
148
|
-
* Greedy modularity optimization
|
|
149
|
-
*/
|
|
150
|
-
declare function fallbackLouvain(nodes: string[], edges: Array<[string, string, number]>): {
|
|
151
|
-
communities: Array<{
|
|
152
|
-
id: number;
|
|
153
|
-
members: string[];
|
|
154
|
-
}>;
|
|
155
|
-
modularity: number;
|
|
156
|
-
};
|
|
157
|
-
/**
|
|
158
|
-
* Detect circular dependencies using DFS
|
|
159
|
-
*/
|
|
160
|
-
export declare function detectCircularDependencies(graph: DependencyGraph): CircularDependency[];
|
|
161
|
-
/**
|
|
162
|
-
* Analyze graph boundaries using MinCut algorithm
|
|
163
|
-
*/
|
|
164
|
-
export declare function analyzeMinCutBoundaries(graph: DependencyGraph, numPartitions?: number): Promise<MinCutBoundary[]>;
|
|
165
|
-
/**
|
|
166
|
-
* Analyze module communities using Louvain algorithm
|
|
167
|
-
*/
|
|
168
|
-
export declare function analyzeModuleCommunities(graph: DependencyGraph): Promise<ModuleCommunity[]>;
|
|
169
|
-
/**
|
|
170
|
-
* Full graph analysis (with caching)
|
|
171
|
-
*/
|
|
172
|
-
export declare function analyzeGraph(rootDir: string, options?: {
|
|
173
|
-
includeBoundaries?: boolean;
|
|
174
|
-
includeModules?: boolean;
|
|
175
|
-
numPartitions?: number;
|
|
176
|
-
skipCache?: boolean;
|
|
177
|
-
}): Promise<GraphAnalysisResult>;
|
|
178
|
-
/**
|
|
179
|
-
* Export graph to DOT format for visualization
|
|
180
|
-
*/
|
|
181
|
-
export declare function exportToDot(result: GraphAnalysisResult, options?: {
|
|
182
|
-
includeLabels?: boolean;
|
|
183
|
-
colorByCommunity?: boolean;
|
|
184
|
-
highlightCycles?: boolean;
|
|
185
|
-
}): string;
|
|
186
|
-
export { loadRuVector, fallbackMinCut, fallbackLouvain, };
|
|
187
|
-
//# sourceMappingURL=graph-analyzer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graph-analyzer.d.ts","sourceRoot":"","sources":["../../../src/ruvector/graph-analyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAqBH;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAGvC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI;I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AAC,cAAc,EAAE,CAAC,CAoD3B;AAsBD;;GAEG;AACH,wBAAsB,wBAAwB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CA8CjG;AAqBD;;GAEG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;IACP,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;CAChB,GACL,OAAO,CAAC,mBAAmB,CAAC,CAuF9B;AAMD;;GAEG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,mBAAmB,EAC3B,OAAO,GAAE;IACP,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAC;CACtB,GACL,MAAM,CAwFR;AAMD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,eAAe,GAChB,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RuVector Integration Module for KynjalFlow CLI
|
|
3
|
-
*
|
|
4
|
-
* Provides integration with @ruvector packages for:
|
|
5
|
-
* - Q-Learning based task routing
|
|
6
|
-
* - Mixture of Experts (MoE) routing
|
|
7
|
-
* - AST code analysis
|
|
8
|
-
* - Diff classification
|
|
9
|
-
* - Coverage-based routing
|
|
10
|
-
* - Graph boundary analysis
|
|
11
|
-
* - Flash Attention for faster similarity computations
|
|
12
|
-
*
|
|
13
|
-
* @module @claude-flow/cli/ruvector
|
|
14
|
-
*/
|
|
15
|
-
export { QLearningRouter, createQLearningRouter, type QLearningRouterConfig, type RouteDecision } from './q-learning-router.js';
|
|
16
|
-
export { MoERouter, getMoERouter, resetMoERouter, createMoERouter, EXPERT_NAMES, NUM_EXPERTS, INPUT_DIM, HIDDEN_DIM, type ExpertType, type MoERouterConfig, type RoutingResult, type LoadBalanceStats, } from './moe-router.js';
|
|
17
|
-
export { ASTAnalyzer, createASTAnalyzer, type ASTAnalysis, type ASTNode, type ASTAnalyzerConfig } from './ast-analyzer.js';
|
|
18
|
-
export { DiffClassifier, createDiffClassifier, analyzeDiff, analyzeDiffSync, assessFileRisk, assessOverallRisk, classifyDiff, suggestReviewers, getGitDiffNumstat, getGitDiffNumstatAsync, clearDiffCache, clearAllDiffCaches, type DiffClassification, type DiffHunk, type DiffChange, type FileDiff, type DiffAnalysis, type DiffClassifierConfig, type DiffFile, type RiskLevel, type FileRisk, type OverallRisk, type DiffAnalysisResult, } from './diff-classifier.js';
|
|
19
|
-
export { CoverageRouter, createCoverageRouter, coverageRoute, coverageSuggest, coverageGaps, clearCoverageCache, getCoverageCacheStats, type CoverageRouterConfig, type FileCoverage, type CoverageReport, type CoverageRouteResult, type CoverageSuggestResult, type CoverageGapsResult, type CoverageRouteOptions, type CoverageSuggestOptions, type CoverageGapsOptions, } from './coverage-router.js';
|
|
20
|
-
export { coverageRouterTools, hooksCoverageRoute, hooksCoverageSuggest, hooksCoverageGaps } from './coverage-tools.js';
|
|
21
|
-
export { buildDependencyGraph, analyzeGraph, analyzeMinCutBoundaries, analyzeModuleCommunities, detectCircularDependencies, exportToDot, loadRuVector, fallbackMinCut, fallbackLouvain, clearGraphCaches, getGraphCacheStats, type GraphNode, type GraphEdge, type DependencyGraph, type MinCutBoundary, type ModuleCommunity, type CircularDependency, type GraphAnalysisResult, } from './graph-analyzer.js';
|
|
22
|
-
export { FlashAttention, getFlashAttention, resetFlashAttention, computeAttention, benchmarkFlashAttention, getFlashAttentionSpeedup, type FlashAttentionConfig, type AttentionResult, type BenchmarkResult, } from './flash-attention.js';
|
|
23
|
-
export { LoRAAdapter, getLoRAAdapter, resetLoRAAdapter, createLoRAAdapter, adaptEmbedding, trainLoRA, getLoRAStats, DEFAULT_RANK, DEFAULT_ALPHA, INPUT_DIM as LORA_INPUT_DIM, OUTPUT_DIM as LORA_OUTPUT_DIM, type LoRAConfig, type LoRAWeights, type AdaptationResult, type LoRAStats, } from './lora-adapter.js';
|
|
24
|
-
export { ModelRouter, getModelRouter, resetModelRouter, createModelRouter, routeToModel, routeToModelFull, analyzeTaskComplexity, getModelRouterStats, recordModelOutcome, MODEL_CAPABILITIES, COMPLEXITY_INDICATORS, type ClaudeModel, type ModelRouterConfig, type ModelRoutingResult, type ComplexityAnalysis, } from './model-router.js';
|
|
25
|
-
export { SemanticRouter, createSemanticRouter, type Intent, type RouteResult, type RouterConfig, } from './semantic-router.js';
|
|
26
|
-
/**
|
|
27
|
-
* Check if ruvector packages are available
|
|
28
|
-
*/
|
|
29
|
-
export declare function isRuvectorAvailable(): Promise<boolean>;
|
|
30
|
-
/**
|
|
31
|
-
* Get ruvector version if available
|
|
32
|
-
*/
|
|
33
|
-
export declare function getRuvectorVersion(): Promise<string | null>;
|
|
34
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ruvector/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,KAAK,qBAAqB,EAAE,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAChI,OAAO,EACL,SAAS,EACT,YAAY,EACZ,cAAc,EACd,eAAe,EACf,YAAY,EACZ,WAAW,EACX,SAAS,EACT,UAAU,EACV,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,KAAK,WAAW,EAAE,KAAK,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3H,OAAO,EACL,cAAc,EACd,oBAAoB,EAEpB,WAAW,EACX,eAAe,EACf,cAAc,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AO,EACL,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,SAAS,IAAI,cAAc,EAC3B,UAAU,IAAI,eAAe,EAC7B,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,SAAS,GACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,YAAY,GAClB,MAAM,sBAAsB,CAAC;AAE9B;;GAEG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC,CAO5D;AAED;;GAEG;AACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAOjE"}
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LoRA (Low-Rank Adaptation) Implementation
|
|
3
|
-
*
|
|
4
|
-
* Enables efficient fine-tuning by decomposing weight updates into low-rank matrices.
|
|
5
|
-
* Dramatically reduces memory requirements while maintaining adaptation quality.
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - Rank decomposition (r << d) for memory efficiency
|
|
9
|
-
* - Additive weight updates: W' = W + BA (where B ∈ R^{d×r}, A ∈ R^{r×k})
|
|
10
|
-
* - Support for multiple adaptation heads
|
|
11
|
-
* - Persistence to .swarm/lora-weights.json
|
|
12
|
-
*
|
|
13
|
-
* Memory savings:
|
|
14
|
-
* - Original: d × k parameters
|
|
15
|
-
* - LoRA: r × (d + k) parameters
|
|
16
|
-
* - For d=384, k=384, r=8: 786,432 → 6,144 (128x reduction)
|
|
17
|
-
*
|
|
18
|
-
* @module lora-adapter
|
|
19
|
-
*/
|
|
20
|
-
/**
|
|
21
|
-
* Default LoRA rank (determines memory/quality tradeoff)
|
|
22
|
-
*/
|
|
23
|
-
export declare const DEFAULT_RANK = 8;
|
|
24
|
-
/**
|
|
25
|
-
* Input dimension (384 from ONNX MiniLM-L6-v2)
|
|
26
|
-
*/
|
|
27
|
-
export declare const INPUT_DIM = 384;
|
|
28
|
-
/**
|
|
29
|
-
* Default output dimension (same as input for adapter)
|
|
30
|
-
*/
|
|
31
|
-
export declare const OUTPUT_DIM = 384;
|
|
32
|
-
/**
|
|
33
|
-
* Default alpha scaling factor
|
|
34
|
-
*/
|
|
35
|
-
export declare const DEFAULT_ALPHA = 16;
|
|
36
|
-
/**
|
|
37
|
-
* LoRA configuration
|
|
38
|
-
*/
|
|
39
|
-
export interface LoRAConfig {
|
|
40
|
-
/** Rank of decomposition (lower = more compression) */
|
|
41
|
-
rank: number;
|
|
42
|
-
/** Alpha scaling factor for output */
|
|
43
|
-
alpha: number;
|
|
44
|
-
/** Input dimension */
|
|
45
|
-
inputDim: number;
|
|
46
|
-
/** Output dimension */
|
|
47
|
-
outputDim: number;
|
|
48
|
-
/** Learning rate for updates */
|
|
49
|
-
learningRate: number;
|
|
50
|
-
/** Path for weight persistence */
|
|
51
|
-
weightsPath: string;
|
|
52
|
-
/** Enable dropout for regularization */
|
|
53
|
-
enableDropout: boolean;
|
|
54
|
-
/** Dropout probability */
|
|
55
|
-
dropoutProb: number;
|
|
56
|
-
/** Auto-save interval in updates */
|
|
57
|
-
autoSaveInterval: number;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* LoRA adapter weights
|
|
61
|
-
*/
|
|
62
|
-
export interface LoRAWeights {
|
|
63
|
-
/** A matrix (rank × inputDim) - down projection */
|
|
64
|
-
A: Float32Array;
|
|
65
|
-
/** B matrix (outputDim × rank) - up projection */
|
|
66
|
-
B: Float32Array;
|
|
67
|
-
/** Scaling factor (alpha / rank) */
|
|
68
|
-
scaling: number;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Adaptation result
|
|
72
|
-
*/
|
|
73
|
-
export interface AdaptationResult {
|
|
74
|
-
/** Adapted embedding */
|
|
75
|
-
adapted: Float32Array;
|
|
76
|
-
/** Magnitude of adaptation */
|
|
77
|
-
adaptationNorm: number;
|
|
78
|
-
/** Time taken in ms */
|
|
79
|
-
timeMs: number;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* LoRA statistics
|
|
83
|
-
*/
|
|
84
|
-
export interface LoRAStats {
|
|
85
|
-
/** Total adaptations performed */
|
|
86
|
-
totalAdaptations: number;
|
|
87
|
-
/** Total training updates */
|
|
88
|
-
totalUpdates: number;
|
|
89
|
-
/** Current rank */
|
|
90
|
-
rank: number;
|
|
91
|
-
/** Memory savings ratio */
|
|
92
|
-
compressionRatio: number;
|
|
93
|
-
/** Average adaptation norm */
|
|
94
|
-
avgAdaptationNorm: number;
|
|
95
|
-
/** Last update timestamp */
|
|
96
|
-
lastUpdate: number | null;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Low-Rank Adaptation module for efficient embedding fine-tuning
|
|
100
|
-
*/
|
|
101
|
-
export declare class LoRAAdapter {
|
|
102
|
-
private config;
|
|
103
|
-
private weights;
|
|
104
|
-
private totalAdaptations;
|
|
105
|
-
private totalUpdates;
|
|
106
|
-
private adaptationNormSum;
|
|
107
|
-
private lastUpdate;
|
|
108
|
-
private updatesSinceLastSave;
|
|
109
|
-
constructor(config?: Partial<LoRAConfig>);
|
|
110
|
-
/**
|
|
111
|
-
* Initialize weights with Kaiming/He initialization
|
|
112
|
-
*/
|
|
113
|
-
private initializeWeights;
|
|
114
|
-
/**
|
|
115
|
-
* Box-Muller transform for Gaussian random numbers
|
|
116
|
-
*/
|
|
117
|
-
private gaussianRandom;
|
|
118
|
-
/**
|
|
119
|
-
* Initialize adapter and load persisted weights
|
|
120
|
-
*/
|
|
121
|
-
initialize(): Promise<{
|
|
122
|
-
success: boolean;
|
|
123
|
-
weightsLoaded: boolean;
|
|
124
|
-
}>;
|
|
125
|
-
/**
|
|
126
|
-
* Apply LoRA adaptation to an embedding
|
|
127
|
-
* output = input + scaling * (B @ A @ input)
|
|
128
|
-
*/
|
|
129
|
-
adapt(input: Float32Array): AdaptationResult;
|
|
130
|
-
/**
|
|
131
|
-
* Train the adapter with a gradient signal
|
|
132
|
-
* Uses simplified update: A += lr * hidden^T @ grad, B += lr * grad @ hidden^T
|
|
133
|
-
*/
|
|
134
|
-
train(input: Float32Array, gradOutput: Float32Array, reward?: number): {
|
|
135
|
-
updated: boolean;
|
|
136
|
-
loss: number;
|
|
137
|
-
};
|
|
138
|
-
/**
|
|
139
|
-
* Merge LoRA weights into base weights (for deployment)
|
|
140
|
-
* Returns: W' = W + scaling * B @ A
|
|
141
|
-
*/
|
|
142
|
-
merge(baseWeights: Float32Array): Float32Array;
|
|
143
|
-
/**
|
|
144
|
-
* Get current statistics
|
|
145
|
-
*/
|
|
146
|
-
getStats(): LoRAStats;
|
|
147
|
-
/**
|
|
148
|
-
* Reset adapter to initial state
|
|
149
|
-
*/
|
|
150
|
-
reset(): void;
|
|
151
|
-
/**
|
|
152
|
-
* Save weights to disk
|
|
153
|
-
*/
|
|
154
|
-
saveWeights(): boolean;
|
|
155
|
-
/**
|
|
156
|
-
* Load weights from disk
|
|
157
|
-
*/
|
|
158
|
-
loadWeights(): boolean;
|
|
159
|
-
/**
|
|
160
|
-
* Export weights as JSON
|
|
161
|
-
*/
|
|
162
|
-
exportWeights(): {
|
|
163
|
-
A: number[];
|
|
164
|
-
B: number[];
|
|
165
|
-
scaling: number;
|
|
166
|
-
config: Partial<LoRAConfig>;
|
|
167
|
-
};
|
|
168
|
-
/**
|
|
169
|
-
* Import weights from JSON
|
|
170
|
-
*/
|
|
171
|
-
importWeights(data: {
|
|
172
|
-
A: number[];
|
|
173
|
-
B: number[];
|
|
174
|
-
scaling: number;
|
|
175
|
-
}): boolean;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Get or create singleton LoRA adapter instance
|
|
179
|
-
*/
|
|
180
|
-
export declare function getLoRAAdapter(): Promise<LoRAAdapter>;
|
|
181
|
-
/**
|
|
182
|
-
* Reset singleton instance (for testing)
|
|
183
|
-
*/
|
|
184
|
-
export declare function resetLoRAAdapter(): void;
|
|
185
|
-
/**
|
|
186
|
-
* Create new LoRA adapter instance (factory)
|
|
187
|
-
*/
|
|
188
|
-
export declare function createLoRAAdapter(config?: Partial<LoRAConfig>): LoRAAdapter;
|
|
189
|
-
/**
|
|
190
|
-
* Quick adaptation (convenience function)
|
|
191
|
-
*/
|
|
192
|
-
export declare function adaptEmbedding(input: Float32Array): Promise<AdaptationResult>;
|
|
193
|
-
/**
|
|
194
|
-
* Quick training (convenience function)
|
|
195
|
-
*/
|
|
196
|
-
export declare function trainLoRA(input: Float32Array, gradOutput: Float32Array, reward?: number): Promise<{
|
|
197
|
-
updated: boolean;
|
|
198
|
-
loss: number;
|
|
199
|
-
}>;
|
|
200
|
-
/**
|
|
201
|
-
* Get LoRA statistics (convenience function)
|
|
202
|
-
*/
|
|
203
|
-
export declare function getLoRAStats(): Promise<LoRAStats>;
|
|
204
|
-
declare const _default: {
|
|
205
|
-
LoRAAdapter: typeof LoRAAdapter;
|
|
206
|
-
getLoRAAdapter: typeof getLoRAAdapter;
|
|
207
|
-
resetLoRAAdapter: typeof resetLoRAAdapter;
|
|
208
|
-
createLoRAAdapter: typeof createLoRAAdapter;
|
|
209
|
-
adaptEmbedding: typeof adaptEmbedding;
|
|
210
|
-
trainLoRA: typeof trainLoRA;
|
|
211
|
-
getLoRAStats: typeof getLoRAStats;
|
|
212
|
-
DEFAULT_RANK: number;
|
|
213
|
-
DEFAULT_ALPHA: number;
|
|
214
|
-
INPUT_DIM: number;
|
|
215
|
-
OUTPUT_DIM: number;
|
|
216
|
-
};
|
|
217
|
-
export default _default;
|
|
218
|
-
//# sourceMappingURL=lora-adapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lora-adapter.d.ts","sourceRoot":"","sources":["../../../src/ruvector/lora-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AASH;;GAEG;AACH,eAAO,MAAM,YAAY,IAAI,CAAC;AAE9B;;GAEG;AACH,eAAO,MAAM,SAAS,MAAM,CAAC;AAE7B;;GAEG;AACH,eAAO,MAAM,UAAU,MAAM,CAAC;AAE9B;;GAEG;AACH,eAAO,MAAM,aAAa,KAAK,CAAC;AAEhC;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,sBAAsB;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,uBAAuB;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,wCAAwC;IACxC,aAAa,EAAE,OAAO,CAAC;IACvB,0BAA0B;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,mDAAmD;IACnD,CAAC,EAAE,YAAY,CAAC;IAChB,kDAAkD;IAClD,CAAC,EAAE,YAAY,CAAC;IAChB,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,wBAAwB;IACxB,OAAO,EAAE,YAAY,CAAC;IACtB,8BAA8B;IAC9B,cAAc,EAAE,MAAM,CAAC;I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