codehere 0.1.0 → 0.2.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.
Potentially problematic release.
This version of codehere might be problematic. Click here for more details.
- package/README.md +51 -25
- package/dist/agents/base.d.ts +107 -0
- package/dist/agents/base.d.ts.map +1 -0
- package/dist/agents/base.js +101 -0
- package/dist/agents/base.js.map +1 -0
- package/dist/agents/orchestrator-model-driven.d.ts +41 -0
- package/dist/agents/orchestrator-model-driven.d.ts.map +1 -0
- package/dist/agents/orchestrator-model-driven.js +141 -0
- package/dist/agents/orchestrator-model-driven.js.map +1 -0
- package/dist/agents/react-orchestrator-agent.d.ts +15 -0
- package/dist/agents/react-orchestrator-agent.d.ts.map +1 -0
- package/dist/agents/react-orchestrator-agent.js +54 -0
- package/dist/agents/react-orchestrator-agent.js.map +1 -0
- package/dist/application/agents/execution-agent.d.ts +68 -0
- package/dist/application/agents/execution-agent.d.ts.map +1 -0
- package/dist/application/agents/execution-agent.js +299 -0
- package/dist/application/agents/execution-agent.js.map +1 -0
- package/dist/application/agents/multi-agent-orchestrator.d.ts +64 -0
- package/dist/application/agents/multi-agent-orchestrator.d.ts.map +1 -0
- package/dist/application/agents/multi-agent-orchestrator.js +209 -0
- package/dist/application/agents/multi-agent-orchestrator.js.map +1 -0
- package/dist/application/agents/planning-agent.d.ts +61 -0
- package/dist/application/agents/planning-agent.d.ts.map +1 -0
- package/dist/application/agents/planning-agent.js +357 -0
- package/dist/application/agents/planning-agent.js.map +1 -0
- package/dist/application/agents/validation-agent.d.ts +64 -0
- package/dist/application/agents/validation-agent.d.ts.map +1 -0
- package/dist/application/agents/validation-agent.js +182 -0
- package/dist/application/agents/validation-agent.js.map +1 -0
- package/dist/application/architectures/plan-and-act.d.ts +94 -0
- package/dist/application/architectures/plan-and-act.d.ts.map +1 -0
- package/dist/application/architectures/plan-and-act.js +242 -0
- package/dist/application/architectures/plan-and-act.js.map +1 -0
- package/dist/application/index.d.ts +12 -0
- package/dist/application/index.d.ts.map +1 -0
- package/dist/application/index.js +12 -0
- package/dist/application/index.js.map +1 -0
- package/dist/application/services/agent-factory.d.ts +9 -0
- package/dist/application/services/agent-factory.d.ts.map +1 -0
- package/dist/application/services/agent-factory.js +28 -0
- package/dist/application/services/agent-factory.js.map +1 -0
- package/dist/application/services/dependency-container.d.ts +140 -0
- package/dist/application/services/dependency-container.d.ts.map +1 -0
- package/dist/application/services/dependency-container.js +402 -0
- package/dist/application/services/dependency-container.js.map +1 -0
- package/dist/application/services/git-context-service.d.ts +30 -0
- package/dist/application/services/git-context-service.d.ts.map +1 -0
- package/dist/application/services/git-context-service.js +83 -0
- package/dist/application/services/git-context-service.js.map +1 -0
- package/dist/application/services/intelligent-router.d.ts +74 -0
- package/dist/application/services/intelligent-router.d.ts.map +1 -0
- package/dist/application/services/intelligent-router.js +711 -0
- package/dist/application/services/intelligent-router.js.map +1 -0
- package/dist/application/services/tool-executor-service.d.ts +14 -0
- package/dist/application/services/tool-executor-service.d.ts.map +1 -0
- package/dist/application/services/tool-executor-service.js +94 -0
- package/dist/application/services/tool-executor-service.js.map +1 -0
- package/dist/application/use-cases/ask-question-use-case.d.ts +36 -0
- package/dist/application/use-cases/ask-question-use-case.d.ts.map +1 -0
- package/dist/application/use-cases/ask-question-use-case.js +150 -0
- package/dist/application/use-cases/ask-question-use-case.js.map +1 -0
- package/dist/application/use-cases/edit-file-use-case.d.ts +76 -0
- package/dist/application/use-cases/edit-file-use-case.d.ts.map +1 -0
- package/dist/application/use-cases/edit-file-use-case.js +685 -0
- package/dist/application/use-cases/edit-file-use-case.js.map +1 -0
- package/dist/application/use-cases/explain-file-use-case.d.ts +21 -0
- package/dist/application/use-cases/explain-file-use-case.d.ts.map +1 -0
- package/dist/application/use-cases/explain-file-use-case.js +50 -0
- package/dist/application/use-cases/explain-file-use-case.js.map +1 -0
- package/dist/application/use-cases/index-codebase-use-case.d.ts +46 -0
- package/dist/application/use-cases/index-codebase-use-case.d.ts.map +1 -0
- package/dist/application/use-cases/index-codebase-use-case.js +113 -0
- package/dist/application/use-cases/index-codebase-use-case.js.map +1 -0
- package/dist/application/use-cases/planning-use-case.d.ts +46 -0
- package/dist/application/use-cases/planning-use-case.d.ts.map +1 -0
- package/dist/application/use-cases/planning-use-case.js +267 -0
- package/dist/application/use-cases/planning-use-case.js.map +1 -0
- package/dist/application/use-cases/react-orchestration-use-case.d.ts +51 -0
- package/dist/application/use-cases/react-orchestration-use-case.d.ts.map +1 -0
- package/dist/application/use-cases/react-orchestration-use-case.js +325 -0
- package/dist/application/use-cases/react-orchestration-use-case.js.map +1 -0
- package/dist/application/use-cases/reflexion-use-case.d.ts +24 -0
- package/dist/application/use-cases/reflexion-use-case.d.ts.map +1 -0
- package/dist/application/use-cases/reflexion-use-case.js +30 -0
- package/dist/application/use-cases/reflexion-use-case.js.map +1 -0
- package/dist/application/workflows/deterministic-workflows.d.ts +61 -0
- package/dist/application/workflows/deterministic-workflows.d.ts.map +1 -0
- package/dist/application/workflows/deterministic-workflows.js +189 -0
- package/dist/application/workflows/deterministic-workflows.js.map +1 -0
- package/dist/cache.d.ts.map +1 -1
- package/dist/cache.js +1 -3
- package/dist/cache.js.map +1 -1
- package/dist/chat.js +10 -10
- package/dist/chat.js.map +1 -1
- package/dist/docs.d.ts.map +1 -1
- package/dist/docs.js +1 -2
- package/dist/docs.js.map +1 -1
- package/dist/domain/entities/code-chunk.d.ts +26 -0
- package/dist/domain/entities/code-chunk.d.ts.map +1 -0
- package/dist/domain/entities/code-chunk.js +6 -0
- package/dist/domain/entities/code-chunk.js.map +1 -0
- package/dist/domain/entities/decision.d.ts +37 -0
- package/dist/domain/entities/decision.d.ts.map +1 -0
- package/dist/domain/entities/decision.js +9 -0
- package/dist/domain/entities/decision.js.map +1 -0
- package/dist/domain/entities/edit.d.ts +35 -0
- package/dist/domain/entities/edit.d.ts.map +1 -0
- package/dist/domain/entities/edit.js +6 -0
- package/dist/domain/entities/edit.js.map +1 -0
- package/dist/domain/entities/knowledge-node.d.ts +83 -0
- package/dist/domain/entities/knowledge-node.d.ts.map +1 -0
- package/dist/domain/entities/knowledge-node.js +9 -0
- package/dist/domain/entities/knowledge-node.js.map +1 -0
- package/dist/domain/entities/knowledge-preservation.d.ts +42 -0
- package/dist/domain/entities/knowledge-preservation.d.ts.map +1 -0
- package/dist/domain/entities/knowledge-preservation.js +10 -0
- package/dist/domain/entities/knowledge-preservation.js.map +1 -0
- package/dist/domain/entities/memory.d.ts +36 -0
- package/dist/domain/entities/memory.d.ts.map +1 -0
- package/dist/domain/entities/memory.js +6 -0
- package/dist/domain/entities/memory.js.map +1 -0
- package/dist/domain/entities/pattern.d.ts +49 -0
- package/dist/domain/entities/pattern.d.ts.map +1 -0
- package/dist/domain/entities/pattern.js +7 -0
- package/dist/domain/entities/pattern.js.map +1 -0
- package/dist/domain/entities/plan.d.ts +42 -0
- package/dist/domain/entities/plan.d.ts.map +1 -0
- package/dist/domain/entities/plan.js +6 -0
- package/dist/domain/entities/plan.js.map +1 -0
- package/dist/domain/entities/query.d.ts +17 -0
- package/dist/domain/entities/query.d.ts.map +1 -0
- package/dist/domain/entities/query.js +6 -0
- package/dist/domain/entities/query.js.map +1 -0
- package/dist/domain/index.d.ts +16 -0
- package/dist/domain/index.d.ts.map +1 -0
- package/dist/domain/index.js +19 -0
- package/dist/domain/index.js.map +1 -0
- package/dist/domain/interfaces/ai-service.interface.d.ts +62 -0
- package/dist/domain/interfaces/ai-service.interface.d.ts.map +1 -0
- package/dist/domain/interfaces/ai-service.interface.js +6 -0
- package/dist/domain/interfaces/ai-service.interface.js.map +1 -0
- package/dist/domain/interfaces/code-analyzer.interface.d.ts +38 -0
- package/dist/domain/interfaces/code-analyzer.interface.d.ts.map +1 -0
- package/dist/domain/interfaces/code-analyzer.interface.js +6 -0
- package/dist/domain/interfaces/code-analyzer.interface.js.map +1 -0
- package/dist/domain/interfaces/decision-repository.interface.d.ts +51 -0
- package/dist/domain/interfaces/decision-repository.interface.d.ts.map +1 -0
- package/dist/domain/interfaces/decision-repository.interface.js +9 -0
- package/dist/domain/interfaces/decision-repository.interface.js.map +1 -0
- package/dist/domain/interfaces/embedding-repository.interface.d.ts +28 -0
- package/dist/domain/interfaces/embedding-repository.interface.d.ts.map +1 -0
- package/dist/domain/interfaces/embedding-repository.interface.js +6 -0
- package/dist/domain/interfaces/embedding-repository.interface.js.map +1 -0
- package/dist/domain/interfaces/knowledge-graph-repository.interface.d.ts +91 -0
- package/dist/domain/interfaces/knowledge-graph-repository.interface.d.ts.map +1 -0
- package/dist/domain/interfaces/knowledge-graph-repository.interface.js +9 -0
- package/dist/domain/interfaces/knowledge-graph-repository.interface.js.map +1 -0
- package/dist/domain/interfaces/knowledge-preservation-repository.interface.d.ts +50 -0
- package/dist/domain/interfaces/knowledge-preservation-repository.interface.d.ts.map +1 -0
- package/dist/domain/interfaces/knowledge-preservation-repository.interface.js +8 -0
- package/dist/domain/interfaces/knowledge-preservation-repository.interface.js.map +1 -0
- package/dist/domain/interfaces/memory-repository.interface.d.ts +49 -0
- package/dist/domain/interfaces/memory-repository.interface.d.ts.map +1 -0
- package/dist/domain/interfaces/memory-repository.interface.js +6 -0
- package/dist/domain/interfaces/memory-repository.interface.js.map +1 -0
- package/dist/domain/interfaces/pattern-repository.interface.d.ts +48 -0
- package/dist/domain/interfaces/pattern-repository.interface.d.ts.map +1 -0
- package/dist/domain/interfaces/pattern-repository.interface.js +6 -0
- package/dist/domain/interfaces/pattern-repository.interface.js.map +1 -0
- package/dist/domain/interfaces/verification-service.interface.d.ts +20 -0
- package/dist/domain/interfaces/verification-service.interface.d.ts.map +1 -0
- package/dist/domain/interfaces/verification-service.interface.js +6 -0
- package/dist/domain/interfaces/verification-service.interface.js.map +1 -0
- package/dist/domain/services/codebase-detector.d.ts +18 -0
- package/dist/domain/services/codebase-detector.d.ts.map +1 -0
- package/dist/domain/services/codebase-detector.js +91 -0
- package/dist/domain/services/codebase-detector.js.map +1 -0
- package/dist/domain/services/cross-team-pattern-sharing.d.ts +65 -0
- package/dist/domain/services/cross-team-pattern-sharing.d.ts.map +1 -0
- package/dist/domain/services/cross-team-pattern-sharing.js +125 -0
- package/dist/domain/services/cross-team-pattern-sharing.js.map +1 -0
- package/dist/domain/services/decision-recorder.d.ts +76 -0
- package/dist/domain/services/decision-recorder.d.ts.map +1 -0
- package/dist/domain/services/decision-recorder.js +223 -0
- package/dist/domain/services/decision-recorder.js.map +1 -0
- package/dist/domain/services/decision-retriever.d.ts +75 -0
- package/dist/domain/services/decision-retriever.d.ts.map +1 -0
- package/dist/domain/services/decision-retriever.js +133 -0
- package/dist/domain/services/decision-retriever.js.map +1 -0
- package/dist/domain/services/graded-memory-activation.d.ts +37 -0
- package/dist/domain/services/graded-memory-activation.d.ts.map +1 -0
- package/dist/domain/services/graded-memory-activation.js +69 -0
- package/dist/domain/services/graded-memory-activation.js.map +1 -0
- package/dist/domain/services/knowledge-access.d.ts +63 -0
- package/dist/domain/services/knowledge-access.d.ts.map +1 -0
- package/dist/domain/services/knowledge-access.js +132 -0
- package/dist/domain/services/knowledge-access.js.map +1 -0
- package/dist/domain/services/knowledge-extractor.d.ts +54 -0
- package/dist/domain/services/knowledge-extractor.d.ts.map +1 -0
- package/dist/domain/services/knowledge-extractor.js +247 -0
- package/dist/domain/services/knowledge-extractor.js.map +1 -0
- package/dist/domain/services/knowledge-graph-builder.d.ts +70 -0
- package/dist/domain/services/knowledge-graph-builder.d.ts.map +1 -0
- package/dist/domain/services/knowledge-graph-builder.js +268 -0
- package/dist/domain/services/knowledge-graph-builder.js.map +1 -0
- package/dist/domain/services/knowledge-graph-query.d.ts +69 -0
- package/dist/domain/services/knowledge-graph-query.d.ts.map +1 -0
- package/dist/domain/services/knowledge-graph-query.js +187 -0
- package/dist/domain/services/knowledge-graph-query.js.map +1 -0
- package/dist/domain/services/memory-retriever.d.ts +30 -0
- package/dist/domain/services/memory-retriever.d.ts.map +1 -0
- package/dist/domain/services/memory-retriever.js +82 -0
- package/dist/domain/services/memory-retriever.js.map +1 -0
- package/dist/domain/services/memory-synthesizer.d.ts +57 -0
- package/dist/domain/services/memory-synthesizer.d.ts.map +1 -0
- package/dist/domain/services/memory-synthesizer.js +91 -0
- package/dist/domain/services/memory-synthesizer.js.map +1 -0
- package/dist/domain/services/pattern-extractor.d.ts +108 -0
- package/dist/domain/services/pattern-extractor.d.ts.map +1 -0
- package/dist/domain/services/pattern-extractor.js +442 -0
- package/dist/domain/services/pattern-extractor.js.map +1 -0
- package/dist/domain/services/query-intent-classifier.d.ts +16 -0
- package/dist/domain/services/query-intent-classifier.d.ts.map +1 -0
- package/dist/domain/services/query-intent-classifier.js +140 -0
- package/dist/domain/services/query-intent-classifier.js.map +1 -0
- package/dist/domain/services/react-loop.d.ts +44 -0
- package/dist/domain/services/react-loop.d.ts.map +1 -0
- package/dist/domain/services/react-loop.js +110 -0
- package/dist/domain/services/react-loop.js.map +1 -0
- package/dist/edit.d.ts +0 -12
- package/dist/edit.d.ts.map +1 -1
- package/dist/edit.js +76 -351
- package/dist/edit.js.map +1 -1
- package/dist/embed.d.ts +0 -4
- package/dist/embed.d.ts.map +1 -1
- package/dist/embed.js +100 -174
- package/dist/embed.js.map +1 -1
- package/dist/error-handler.d.ts +1 -0
- package/dist/error-handler.d.ts.map +1 -1
- package/dist/error-handler.js +46 -3
- package/dist/error-handler.js.map +1 -1
- package/dist/index.js +228 -231
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/ai/cohere-ai-service.d.ts +54 -0
- package/dist/infrastructure/ai/cohere-ai-service.d.ts.map +1 -0
- package/dist/infrastructure/ai/cohere-ai-service.js +547 -0
- package/dist/infrastructure/ai/cohere-ai-service.js.map +1 -0
- package/dist/infrastructure/ai/command-r-evaluation.d.ts +42 -0
- package/dist/infrastructure/ai/command-r-evaluation.d.ts.map +1 -0
- package/dist/infrastructure/ai/command-r-evaluation.js +206 -0
- package/dist/infrastructure/ai/command-r-evaluation.js.map +1 -0
- package/dist/infrastructure/ai/model-config.d.ts +47 -0
- package/dist/infrastructure/ai/model-config.d.ts.map +1 -0
- package/dist/infrastructure/ai/model-config.js +84 -0
- package/dist/infrastructure/ai/model-config.js.map +1 -0
- package/dist/infrastructure/cache/embedding-cache.d.ts +46 -0
- package/dist/infrastructure/cache/embedding-cache.d.ts.map +1 -0
- package/dist/infrastructure/cache/embedding-cache.js +104 -0
- package/dist/infrastructure/cache/embedding-cache.js.map +1 -0
- package/dist/infrastructure/chunking/ast-code-chunker.d.ts +12 -0
- package/dist/infrastructure/chunking/ast-code-chunker.d.ts.map +1 -0
- package/dist/infrastructure/chunking/ast-code-chunker.js +19 -0
- package/dist/infrastructure/chunking/ast-code-chunker.js.map +1 -0
- package/dist/infrastructure/chunking/code-aware-chunker.d.ts +63 -0
- package/dist/infrastructure/chunking/code-aware-chunker.d.ts.map +1 -0
- package/dist/infrastructure/chunking/code-aware-chunker.js +397 -0
- package/dist/infrastructure/chunking/code-aware-chunker.js.map +1 -0
- package/dist/infrastructure/config/config-manager.d.ts +79 -0
- package/dist/infrastructure/config/config-manager.d.ts.map +1 -0
- package/dist/infrastructure/config/config-manager.js +162 -0
- package/dist/infrastructure/config/config-manager.js.map +1 -0
- package/dist/infrastructure/cost/cost-tracker.d.ts +90 -0
- package/dist/infrastructure/cost/cost-tracker.d.ts.map +1 -0
- package/dist/infrastructure/cost/cost-tracker.js +353 -0
- package/dist/infrastructure/cost/cost-tracker.js.map +1 -0
- package/dist/infrastructure/file-scanner/file-scanner.d.ts +31 -0
- package/dist/infrastructure/file-scanner/file-scanner.d.ts.map +1 -0
- package/dist/infrastructure/file-scanner/file-scanner.js +106 -0
- package/dist/infrastructure/file-scanner/file-scanner.js.map +1 -0
- package/dist/infrastructure/governance/nist-ai-rmf.d.ts +107 -0
- package/dist/infrastructure/governance/nist-ai-rmf.d.ts.map +1 -0
- package/dist/infrastructure/governance/nist-ai-rmf.js +294 -0
- package/dist/infrastructure/governance/nist-ai-rmf.js.map +1 -0
- package/dist/infrastructure/governance/policy-as-code.d.ts +90 -0
- package/dist/infrastructure/governance/policy-as-code.d.ts.map +1 -0
- package/dist/infrastructure/governance/policy-as-code.js +244 -0
- package/dist/infrastructure/governance/policy-as-code.js.map +1 -0
- package/dist/infrastructure/governance/prompt-to-code-lineage.d.ts +138 -0
- package/dist/infrastructure/governance/prompt-to-code-lineage.d.ts.map +1 -0
- package/dist/infrastructure/governance/prompt-to-code-lineage.js +241 -0
- package/dist/infrastructure/governance/prompt-to-code-lineage.js.map +1 -0
- package/dist/infrastructure/index.d.ts +7 -0
- package/dist/infrastructure/index.d.ts.map +1 -0
- package/dist/infrastructure/index.js +7 -0
- package/dist/infrastructure/index.js.map +1 -0
- package/dist/infrastructure/observability/execution-tracer.d.ts +105 -0
- package/dist/infrastructure/observability/execution-tracer.d.ts.map +1 -0
- package/dist/infrastructure/observability/execution-tracer.js +190 -0
- package/dist/infrastructure/observability/execution-tracer.js.map +1 -0
- package/dist/infrastructure/observability/prompt-versioner.d.ts +67 -0
- package/dist/infrastructure/observability/prompt-versioner.d.ts.map +1 -0
- package/dist/infrastructure/observability/prompt-versioner.js +145 -0
- package/dist/infrastructure/observability/prompt-versioner.js.map +1 -0
- package/dist/infrastructure/protocols/a2a-metadata.d.ts +278 -0
- package/dist/infrastructure/protocols/a2a-metadata.d.ts.map +1 -0
- package/dist/infrastructure/protocols/a2a-metadata.js +137 -0
- package/dist/infrastructure/protocols/a2a-metadata.js.map +1 -0
- package/dist/infrastructure/protocols/a2a-protocol.d.ts +132 -0
- package/dist/infrastructure/protocols/a2a-protocol.d.ts.map +1 -0
- package/dist/infrastructure/protocols/a2a-protocol.js +314 -0
- package/dist/infrastructure/protocols/a2a-protocol.js.map +1 -0
- package/dist/infrastructure/protocols/mcp-oauth.d.ts +91 -0
- package/dist/infrastructure/protocols/mcp-oauth.d.ts.map +1 -0
- package/dist/infrastructure/protocols/mcp-oauth.js +184 -0
- package/dist/infrastructure/protocols/mcp-oauth.js.map +1 -0
- package/dist/infrastructure/protocols/mcp-server.d.ts +126 -0
- package/dist/infrastructure/protocols/mcp-server.d.ts.map +1 -0
- package/dist/infrastructure/protocols/mcp-server.js +333 -0
- package/dist/infrastructure/protocols/mcp-server.js.map +1 -0
- package/dist/infrastructure/protocols/streaming-handler.d.ts +57 -0
- package/dist/infrastructure/protocols/streaming-handler.d.ts.map +1 -0
- package/dist/infrastructure/protocols/streaming-handler.js +103 -0
- package/dist/infrastructure/protocols/streaming-handler.js.map +1 -0
- package/dist/infrastructure/security/ai-sast-scanner.d.ts +55 -0
- package/dist/infrastructure/security/ai-sast-scanner.d.ts.map +1 -0
- package/dist/infrastructure/security/ai-sast-scanner.js +163 -0
- package/dist/infrastructure/security/ai-sast-scanner.js.map +1 -0
- package/dist/infrastructure/security/docker-sandbox.d.ts +57 -0
- package/dist/infrastructure/security/docker-sandbox.d.ts.map +1 -0
- package/dist/infrastructure/security/docker-sandbox.js +178 -0
- package/dist/infrastructure/security/docker-sandbox.js.map +1 -0
- package/dist/infrastructure/security/enhanced-security-gate.d.ts +51 -0
- package/dist/infrastructure/security/enhanced-security-gate.d.ts.map +1 -0
- package/dist/infrastructure/security/enhanced-security-gate.js +92 -0
- package/dist/infrastructure/security/enhanced-security-gate.js.map +1 -0
- package/dist/infrastructure/security/input-validator.d.ts +33 -0
- package/dist/infrastructure/security/input-validator.d.ts.map +1 -0
- package/dist/infrastructure/security/input-validator.js +152 -0
- package/dist/infrastructure/security/input-validator.js.map +1 -0
- package/dist/infrastructure/security/license-scanner.d.ts +55 -0
- package/dist/infrastructure/security/license-scanner.d.ts.map +1 -0
- package/dist/infrastructure/security/license-scanner.js +167 -0
- package/dist/infrastructure/security/license-scanner.js.map +1 -0
- package/dist/infrastructure/security/provider-bias-detector.d.ts +53 -0
- package/dist/infrastructure/security/provider-bias-detector.d.ts.map +1 -0
- package/dist/infrastructure/security/provider-bias-detector.js +164 -0
- package/dist/infrastructure/security/provider-bias-detector.js.map +1 -0
- package/dist/infrastructure/security/sandbox-executor.d.ts +34 -0
- package/dist/infrastructure/security/sandbox-executor.d.ts.map +1 -0
- package/dist/infrastructure/security/sandbox-executor.js +64 -0
- package/dist/infrastructure/security/sandbox-executor.js.map +1 -0
- package/dist/infrastructure/storage/memory-stream-service.d.ts +47 -0
- package/dist/infrastructure/storage/memory-stream-service.d.ts.map +1 -0
- package/dist/infrastructure/storage/memory-stream-service.js +204 -0
- package/dist/infrastructure/storage/memory-stream-service.js.map +1 -0
- package/dist/infrastructure/storage/sqlite-decision-repository.d.ts +29 -0
- package/dist/infrastructure/storage/sqlite-decision-repository.d.ts.map +1 -0
- package/dist/infrastructure/storage/sqlite-decision-repository.js +232 -0
- package/dist/infrastructure/storage/sqlite-decision-repository.js.map +1 -0
- package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts +24 -0
- package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts.map +1 -0
- package/dist/infrastructure/storage/sqlite-embedding-repository.js +162 -0
- package/dist/infrastructure/storage/sqlite-embedding-repository.js.map +1 -0
- package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.d.ts +41 -0
- package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.d.ts.map +1 -0
- package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.js +417 -0
- package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.js.map +1 -0
- package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.d.ts +29 -0
- package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.d.ts.map +1 -0
- package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.js +230 -0
- package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.js.map +1 -0
- package/dist/infrastructure/storage/sqlite-memory-repository.d.ts +40 -0
- package/dist/infrastructure/storage/sqlite-memory-repository.d.ts.map +1 -0
- package/dist/infrastructure/storage/sqlite-memory-repository.js +229 -0
- package/dist/infrastructure/storage/sqlite-memory-repository.js.map +1 -0
- package/dist/infrastructure/storage/sqlite-pattern-repository.d.ts +25 -0
- package/dist/infrastructure/storage/sqlite-pattern-repository.d.ts.map +1 -0
- package/dist/infrastructure/storage/sqlite-pattern-repository.js +249 -0
- package/dist/infrastructure/storage/sqlite-pattern-repository.js.map +1 -0
- package/dist/infrastructure/ux/appropriate-friction.d.ts +77 -0
- package/dist/infrastructure/ux/appropriate-friction.d.ts.map +1 -0
- package/dist/infrastructure/ux/appropriate-friction.js +213 -0
- package/dist/infrastructure/ux/appropriate-friction.js.map +1 -0
- package/dist/infrastructure/ux/bi-directional-learning.d.ts +109 -0
- package/dist/infrastructure/ux/bi-directional-learning.d.ts.map +1 -0
- package/dist/infrastructure/ux/bi-directional-learning.js +200 -0
- package/dist/infrastructure/ux/bi-directional-learning.js.map +1 -0
- package/dist/infrastructure/ux/expectation-management.d.ts +65 -0
- package/dist/infrastructure/ux/expectation-management.d.ts.map +1 -0
- package/dist/infrastructure/ux/expectation-management.js +193 -0
- package/dist/infrastructure/ux/expectation-management.js.map +1 -0
- package/dist/infrastructure/ux/hitl-validation.d.ts +104 -0
- package/dist/infrastructure/ux/hitl-validation.d.ts.map +1 -0
- package/dist/infrastructure/ux/hitl-validation.js +211 -0
- package/dist/infrastructure/ux/hitl-validation.js.map +1 -0
- package/dist/infrastructure/ux/progressive-disclosure.d.ts +84 -0
- package/dist/infrastructure/ux/progressive-disclosure.d.ts.map +1 -0
- package/dist/infrastructure/ux/progressive-disclosure.js +235 -0
- package/dist/infrastructure/ux/progressive-disclosure.js.map +1 -0
- package/dist/infrastructure/ux/team-standards.d.ts +94 -0
- package/dist/infrastructure/ux/team-standards.d.ts.map +1 -0
- package/dist/infrastructure/ux/team-standards.js +196 -0
- package/dist/infrastructure/ux/team-standards.js.map +1 -0
- package/dist/infrastructure/verification/verification-service.d.ts +12 -0
- package/dist/infrastructure/verification/verification-service.d.ts.map +1 -0
- package/dist/infrastructure/verification/verification-service.js +47 -0
- package/dist/infrastructure/verification/verification-service.js.map +1 -0
- package/dist/infrastructure/xai/attention-visualizer.d.ts +73 -0
- package/dist/infrastructure/xai/attention-visualizer.d.ts.map +1 -0
- package/dist/infrastructure/xai/attention-visualizer.js +174 -0
- package/dist/infrastructure/xai/attention-visualizer.js.map +1 -0
- package/dist/infrastructure/xai/cot-visualizer.d.ts +105 -0
- package/dist/infrastructure/xai/cot-visualizer.d.ts.map +1 -0
- package/dist/infrastructure/xai/cot-visualizer.js +239 -0
- package/dist/infrastructure/xai/cot-visualizer.js.map +1 -0
- package/dist/infrastructure/xai/decision-tree-log.d.ts +104 -0
- package/dist/infrastructure/xai/decision-tree-log.d.ts.map +1 -0
- package/dist/infrastructure/xai/decision-tree-log.js +216 -0
- package/dist/infrastructure/xai/decision-tree-log.js.map +1 -0
- package/dist/infrastructure/xai/interactive-xai.d.ts +106 -0
- package/dist/infrastructure/xai/interactive-xai.d.ts.map +1 -0
- package/dist/infrastructure/xai/interactive-xai.js +262 -0
- package/dist/infrastructure/xai/interactive-xai.js.map +1 -0
- package/dist/infrastructure/xai/uncertainty-quantifier.d.ts +80 -0
- package/dist/infrastructure/xai/uncertainty-quantifier.d.ts.map +1 -0
- package/dist/infrastructure/xai/uncertainty-quantifier.js +201 -0
- package/dist/infrastructure/xai/uncertainty-quantifier.js.map +1 -0
- package/dist/intelligent-retrieval.d.ts.map +1 -1
- package/dist/intelligent-retrieval.js +8 -1
- package/dist/intelligent-retrieval.js.map +1 -1
- package/dist/intent/classifier.d.ts +6 -0
- package/dist/intent/classifier.d.ts.map +1 -0
- package/dist/intent/classifier.js +2 -0
- package/dist/intent/classifier.js.map +1 -0
- package/dist/intent/context.d.ts +4 -0
- package/dist/intent/context.d.ts.map +1 -0
- package/dist/intent/context.js +2 -0
- package/dist/intent/context.js.map +1 -0
- package/dist/iterative-refinement.d.ts.map +1 -1
- package/dist/iterative-refinement.js +20 -3
- package/dist/iterative-refinement.js.map +1 -1
- package/dist/learning.d.ts.map +1 -1
- package/dist/learning.js +1 -2
- package/dist/learning.js.map +1 -1
- package/dist/monitoring.d.ts.map +1 -1
- package/dist/monitoring.js +1 -2
- package/dist/monitoring.js.map +1 -1
- package/dist/parallel-processor.d.ts +3 -2
- package/dist/parallel-processor.d.ts.map +1 -1
- package/dist/parallel-processor.js +183 -56
- package/dist/parallel-processor.js.map +1 -1
- package/dist/presentation/cli/commands/ask-command.d.ts +8 -0
- package/dist/presentation/cli/commands/ask-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/ask-command.js +133 -0
- package/dist/presentation/cli/commands/ask-command.js.map +1 -0
- package/dist/presentation/cli/commands/config-command.d.ts +9 -0
- package/dist/presentation/cli/commands/config-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/config-command.js +123 -0
- package/dist/presentation/cli/commands/config-command.js.map +1 -0
- package/dist/presentation/cli/commands/cost-command.d.ts +8 -0
- package/dist/presentation/cli/commands/cost-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/cost-command.js +191 -0
- package/dist/presentation/cli/commands/cost-command.js.map +1 -0
- package/dist/presentation/cli/commands/decision-command.d.ts +12 -0
- package/dist/presentation/cli/commands/decision-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/decision-command.js +207 -0
- package/dist/presentation/cli/commands/decision-command.js.map +1 -0
- package/dist/presentation/cli/commands/help-command.d.ts +9 -0
- package/dist/presentation/cli/commands/help-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/help-command.js +281 -0
- package/dist/presentation/cli/commands/help-command.js.map +1 -0
- package/dist/presentation/cli/commands/knowledge-command.d.ts +13 -0
- package/dist/presentation/cli/commands/knowledge-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/knowledge-command.js +129 -0
- package/dist/presentation/cli/commands/knowledge-command.js.map +1 -0
- package/dist/presentation/cli/commands/learning-dashboard-command.d.ts +8 -0
- package/dist/presentation/cli/commands/learning-dashboard-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/learning-dashboard-command.js +183 -0
- package/dist/presentation/cli/commands/learning-dashboard-command.js.map +1 -0
- package/dist/presentation/cli/commands/orchestrate-command.d.ts +8 -0
- package/dist/presentation/cli/commands/orchestrate-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/orchestrate-command.js +112 -0
- package/dist/presentation/cli/commands/orchestrate-command.js.map +1 -0
- package/dist/presentation/cli/commands/plan-command.d.ts +8 -0
- package/dist/presentation/cli/commands/plan-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/plan-command.js +114 -0
- package/dist/presentation/cli/commands/plan-command.js.map +1 -0
- package/dist/presentation/cli/commands/react-command.d.ts +8 -0
- package/dist/presentation/cli/commands/react-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/react-command.js +99 -0
- package/dist/presentation/cli/commands/react-command.js.map +1 -0
- package/dist/presentation/cli/commands/setup-command.d.ts +10 -0
- package/dist/presentation/cli/commands/setup-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/setup-command.js +231 -0
- package/dist/presentation/cli/commands/setup-command.js.map +1 -0
- package/dist/presentation/cli/commands/smart-command.d.ts +6 -0
- package/dist/presentation/cli/commands/smart-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/smart-command.js +212 -0
- package/dist/presentation/cli/commands/smart-command.js.map +1 -0
- package/dist/presentation/cli/commands/trace-command.d.ts +8 -0
- package/dist/presentation/cli/commands/trace-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/trace-command.js +125 -0
- package/dist/presentation/cli/commands/trace-command.js.map +1 -0
- package/dist/presentation/cli/commands/undo-command.d.ts +8 -0
- package/dist/presentation/cli/commands/undo-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/undo-command.js +141 -0
- package/dist/presentation/cli/commands/undo-command.js.map +1 -0
- package/dist/presentation/cli/error-display.d.ts +23 -0
- package/dist/presentation/cli/error-display.d.ts.map +1 -0
- package/dist/presentation/cli/error-display.js +122 -0
- package/dist/presentation/cli/error-display.js.map +1 -0
- package/dist/refactor.d.ts.map +1 -1
- package/dist/refactor.js +2 -4
- package/dist/refactor.js.map +1 -1
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +2 -63
- package/dist/search.js.map +1 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +52 -3
- package/dist/session.js.map +1 -1
- package/dist/testgen.d.ts.map +1 -1
- package/dist/testgen.js +1 -2
- package/dist/testgen.js.map +1 -1
- package/dist/tools/bash.d.ts +53 -0
- package/dist/tools/bash.d.ts.map +1 -0
- package/dist/tools/bash.js +213 -0
- package/dist/tools/bash.js.map +1 -0
- package/dist/tools/edit.d.ts +48 -0
- package/dist/tools/edit.d.ts.map +1 -0
- package/dist/tools/edit.js +235 -0
- package/dist/tools/edit.js.map +1 -0
- package/dist/tools/executor.d.ts +29 -0
- package/dist/tools/executor.d.ts.map +1 -0
- package/dist/tools/executor.js +153 -0
- package/dist/tools/executor.js.map +1 -0
- package/dist/tools/git-tool.d.ts +87 -0
- package/dist/tools/git-tool.d.ts.map +1 -0
- package/dist/tools/git-tool.js +292 -0
- package/dist/tools/git-tool.js.map +1 -0
- package/dist/tools/parser.d.ts +33 -0
- package/dist/tools/parser.d.ts.map +1 -0
- package/dist/tools/parser.js +158 -0
- package/dist/tools/parser.js.map +1 -0
- package/dist/tools/registry.d.ts +74 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +302 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/search.d.ts +41 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/search.js +100 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +4 -2
- package/dist/ui.js.map +1 -1
- package/dist/utils/check-api-status.d.ts +12 -0
- package/dist/utils/check-api-status.d.ts.map +1 -0
- package/dist/utils/check-api-status.js +82 -0
- package/dist/utils/check-api-status.js.map +1 -0
- package/dist/utils/diff-parser.d.ts +22 -0
- package/dist/utils/diff-parser.d.ts.map +1 -0
- package/dist/utils/diff-parser.js +160 -0
- package/dist/utils/diff-parser.js.map +1 -0
- package/dist/utils/logger.d.ts +34 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +56 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/version.d.ts +21 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +52 -0
- package/dist/utils/version.js.map +1 -0
- package/dist/verification/backup.d.ts +30 -0
- package/dist/verification/backup.d.ts.map +1 -0
- package/dist/verification/backup.js +238 -0
- package/dist/verification/backup.js.map +1 -0
- package/dist/verification/compiler.d.ts +20 -0
- package/dist/verification/compiler.d.ts.map +1 -0
- package/dist/verification/compiler.js +228 -0
- package/dist/verification/compiler.js.map +1 -0
- package/dist/verification/index.d.ts +59 -0
- package/dist/verification/index.d.ts.map +1 -0
- package/dist/verification/index.js +273 -0
- package/dist/verification/index.js.map +1 -0
- package/dist/verification/test-runner.d.ts +27 -0
- package/dist/verification/test-runner.d.ts.map +1 -0
- package/dist/verification/test-runner.js +379 -0
- package/dist/verification/test-runner.js.map +1 -0
- package/package.json +39 -14
- package/ARCHITECTURE.md +0 -240
- package/CHANGELOG.md +0 -44
- package/CONTRIBUTING.md +0 -171
- package/dist/benchmark.d.ts +0 -39
- package/dist/benchmark.d.ts.map +0 -1
- package/dist/benchmark.js +0 -195
- package/dist/benchmark.js.map +0 -1
- package/dist/scaffold.d.ts +0 -14
- package/dist/scaffold.d.ts.map +0 -1
- package/dist/scaffold.js +0 -85
- package/dist/scaffold.js.map +0 -1
- package/templates/next-page/app/layout.tsx +0 -19
- package/templates/next-page/app/page.tsx +0 -10
- package/templates/next-page/package.json +0 -22
- package/templates/node-api/index.js +0 -57
- package/templates/node-api/package.json +0 -13
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command R+ / Command A Evaluation Module
|
|
3
|
+
* Evaluates Cohere Command models for migration
|
|
4
|
+
*
|
|
5
|
+
* Based on enterprise architecture requirements and Cohere research:
|
|
6
|
+
* - Command R+: 128k token context window
|
|
7
|
+
* - Command A: 256k token context window (even better!)
|
|
8
|
+
* - Optimized for multi-step tool use
|
|
9
|
+
* - Superior agentic planning
|
|
10
|
+
* - RAG workflow optimization
|
|
11
|
+
*/
|
|
12
|
+
import { CohereClient } from 'cohere-ai';
|
|
13
|
+
export class CommandREvaluator {
|
|
14
|
+
client;
|
|
15
|
+
constructor() {
|
|
16
|
+
const apiKey = process.env.COHERE_API_KEY;
|
|
17
|
+
if (!apiKey) {
|
|
18
|
+
throw new Error('COHERE_API_KEY not found in environment');
|
|
19
|
+
}
|
|
20
|
+
this.client = new CohereClient({ token: apiKey });
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Evaluate Command R+ availability and capabilities
|
|
24
|
+
*/
|
|
25
|
+
async evaluate() {
|
|
26
|
+
const result = {
|
|
27
|
+
available: false,
|
|
28
|
+
modelName: 'unknown',
|
|
29
|
+
contextWindow: 0,
|
|
30
|
+
toolCallingSupported: false,
|
|
31
|
+
modelFamily: 'unknown',
|
|
32
|
+
performance: {
|
|
33
|
+
latency: 0,
|
|
34
|
+
tokenUsage: 0,
|
|
35
|
+
},
|
|
36
|
+
recommendations: [],
|
|
37
|
+
};
|
|
38
|
+
try {
|
|
39
|
+
// Test 1: Check if Command models are available
|
|
40
|
+
// Priority: Command A (256k) > Command A Reasoning > Command R+ (128k)
|
|
41
|
+
const testModels = [
|
|
42
|
+
{ name: 'command-a', family: 'command-a', contextWindow: 256000 },
|
|
43
|
+
{ name: 'command-a-reasoning', family: 'command-a-reasoning', contextWindow: 256000 },
|
|
44
|
+
{ name: 'command-a-08-2024', family: 'command-a', contextWindow: 256000 },
|
|
45
|
+
{ name: 'command-r-plus', family: 'command-r-plus', contextWindow: 128000 },
|
|
46
|
+
{ name: 'command-r', family: 'command-r-plus', contextWindow: 128000 },
|
|
47
|
+
{ name: 'command-r7b-12-2024', family: 'command-r-plus', contextWindow: 128000 },
|
|
48
|
+
{ name: 'command-r-plus-08-2024', family: 'command-r-plus', contextWindow: 128000 },
|
|
49
|
+
];
|
|
50
|
+
let availableModel = null;
|
|
51
|
+
for (const model of testModels) {
|
|
52
|
+
try {
|
|
53
|
+
const startTime = Date.now();
|
|
54
|
+
const response = await this.client.chat({
|
|
55
|
+
model: model.name,
|
|
56
|
+
message: 'Test',
|
|
57
|
+
maxTokens: 10,
|
|
58
|
+
});
|
|
59
|
+
const latency = Date.now() - startTime;
|
|
60
|
+
if (response) {
|
|
61
|
+
availableModel = model;
|
|
62
|
+
result.available = true;
|
|
63
|
+
result.modelName = model.name;
|
|
64
|
+
result.modelFamily = model.family;
|
|
65
|
+
result.contextWindow = model.contextWindow;
|
|
66
|
+
result.performance.latency = latency;
|
|
67
|
+
break; // Use first available model (prioritized by context window)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
// Model not available, try next
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (!availableModel) {
|
|
76
|
+
result.modelFamily = 'unknown';
|
|
77
|
+
result.recommendations.push('Command models (R+, A, A Reasoning) not available. Check Cohere API documentation for latest model names.');
|
|
78
|
+
result.recommendations.push('Fallback: Continue using current chat completion API with enhanced prompts.');
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
// Test 2: Context window already set from model config
|
|
82
|
+
result.recommendations.push(`Command model available: ${availableModel.name} (${availableModel.family})`);
|
|
83
|
+
result.recommendations.push(`Context window: ${result.contextWindow.toLocaleString()} tokens`);
|
|
84
|
+
if (availableModel.family === 'command-a' || availableModel.family === 'command-a-reasoning') {
|
|
85
|
+
result.recommendations.push('✅ Command A has 256k context - excellent for large planning tasks!');
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
result.recommendations.push('⚠️ Command R+ has 128k context - good, but Command A (256k) would be better');
|
|
89
|
+
}
|
|
90
|
+
// Test 3: Test tool calling capabilities
|
|
91
|
+
try {
|
|
92
|
+
const toolCallResponse = await this.client.chat({
|
|
93
|
+
model: availableModel,
|
|
94
|
+
message: 'What tools are available?',
|
|
95
|
+
tools: [
|
|
96
|
+
{
|
|
97
|
+
name: 'search_codebase',
|
|
98
|
+
description: 'Search the codebase',
|
|
99
|
+
parameterDefinitions: {
|
|
100
|
+
query: {
|
|
101
|
+
type: 'string',
|
|
102
|
+
description: 'Search query',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
toolResults: [],
|
|
108
|
+
});
|
|
109
|
+
// Check if response includes tool calls
|
|
110
|
+
if (toolCallResponse.toolCalls && toolCallResponse.toolCalls.length > 0) {
|
|
111
|
+
result.toolCallingSupported = true;
|
|
112
|
+
result.recommendations.push('Tool calling supported - can migrate to Command R+ tool use flow');
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
result.recommendations.push('Tool calling may require different API format - investigate Cohere tool use documentation');
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
result.recommendations.push('Tool calling test failed - may need API key with tool use permissions');
|
|
120
|
+
}
|
|
121
|
+
// Test 4: Performance benchmark
|
|
122
|
+
const benchmarkStart = Date.now();
|
|
123
|
+
const benchmarkResponse = await this.client.chat({
|
|
124
|
+
model: availableModel,
|
|
125
|
+
message: 'Explain the concept of clean architecture in software engineering.',
|
|
126
|
+
maxTokens: 100,
|
|
127
|
+
});
|
|
128
|
+
const benchmarkLatency = Date.now() - benchmarkStart;
|
|
129
|
+
result.performance.latency = benchmarkLatency;
|
|
130
|
+
result.performance.tokenUsage = benchmarkResponse.meta?.tokens?.inputTokens || 0;
|
|
131
|
+
result.recommendations.push(`Performance: ${benchmarkLatency}ms latency, ${result.performance.tokenUsage} input tokens`);
|
|
132
|
+
// Final recommendations
|
|
133
|
+
if (result.available && result.toolCallingSupported) {
|
|
134
|
+
if (result.modelFamily === 'command-a' || result.modelFamily === 'command-a-reasoning') {
|
|
135
|
+
result.recommendations.push('✅ Ready to migrate: Command A available with tool calling support');
|
|
136
|
+
result.recommendations.push('Migration priority: VERY HIGH - 256k context perfect for planning tasks');
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
result.recommendations.push('✅ Ready to migrate: Command R+ available with tool calling support');
|
|
140
|
+
result.recommendations.push('Migration priority: HIGH - Will improve tool correctness and planning');
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
else if (result.available) {
|
|
144
|
+
if (result.modelFamily === 'command-a' || result.modelFamily === 'command-a-reasoning') {
|
|
145
|
+
result.recommendations.push('⚠️ Command A available but tool calling needs investigation');
|
|
146
|
+
result.recommendations.push('Migration priority: HIGH - 256k context is valuable even without native tool calling');
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
result.recommendations.push('⚠️ Command R+ available but tool calling needs investigation');
|
|
150
|
+
result.recommendations.push('Migration priority: MEDIUM - Can migrate for context window benefits');
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
result.recommendations.push('❌ Command models not available - continue with current implementation');
|
|
155
|
+
result.recommendations.push('Migration priority: LOW - Monitor Cohere API updates');
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
result.recommendations.push(`Evaluation error: ${error instanceof Error ? error.message : String(error)}`);
|
|
160
|
+
result.recommendations.push('Fallback: Continue using current chat completion API');
|
|
161
|
+
}
|
|
162
|
+
return result;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Test Command R+ with actual use case
|
|
166
|
+
*/
|
|
167
|
+
async testWithUseCase(query, context) {
|
|
168
|
+
const startTime = Date.now();
|
|
169
|
+
try {
|
|
170
|
+
// Try Command R+ first
|
|
171
|
+
const models = ['command-r-plus', 'command-r', 'command-r7b-12-2024'];
|
|
172
|
+
for (const model of models) {
|
|
173
|
+
try {
|
|
174
|
+
const contextText = context
|
|
175
|
+
.map((chunk, idx) => `[Chunk ${idx + 1} from ${chunk.filepath}]\n${chunk.content}`)
|
|
176
|
+
.join('\n\n---\n\n');
|
|
177
|
+
const response = await this.client.chat({
|
|
178
|
+
model: model,
|
|
179
|
+
message: `${contextText}\n\nUser Query: ${query}`,
|
|
180
|
+
maxTokens: 500,
|
|
181
|
+
});
|
|
182
|
+
const latency = Date.now() - startTime;
|
|
183
|
+
return {
|
|
184
|
+
success: true,
|
|
185
|
+
response: response.text || 'No response',
|
|
186
|
+
toolCalls: response.toolCalls || [],
|
|
187
|
+
latency,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
// Try next model
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
throw new Error('No Command R+ models available');
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
return {
|
|
199
|
+
success: false,
|
|
200
|
+
response: error instanceof Error ? error.message : String(error),
|
|
201
|
+
latency: Date.now() - startTime,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=command-r-evaluation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-r-evaluation.js","sourceRoot":"","sources":["../../../src/infrastructure/ai/command-r-evaluation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAmBzC,MAAM,OAAO,iBAAiB;IACpB,MAAM,CAAe;IAE7B;QACE,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;QAC1C,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC7D,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,IAAI,YAAY,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;IACpD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ;QACZ,MAAM,MAAM,GAA6B;YACvC,SAAS,EAAE,KAAK;YAChB,SAAS,EAAE,SAAS;YACpB,a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,SAAS,EAAE,QAAQ,CAAC,SAAS,IAAI,EAAE;wBACnC,OAAO;qBACR,CAAC;gBACJ,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,iBAAiB;oBACjB,SAAS;gBACX,CAAC;YACH,CAAC;YAED,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACpD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,QAAQ,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;gBAChE,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;aAChC,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model Configuration
|
|
3
|
+
* Manages Command A/R+ model selection based on evaluation results
|
|
4
|
+
*/
|
|
5
|
+
export interface ModelConfig {
|
|
6
|
+
preferredModel?: string;
|
|
7
|
+
modelFamily?: 'command-a' | 'command-a-reasoning' | 'command-r-plus' | 'default';
|
|
8
|
+
contextWindow?: number;
|
|
9
|
+
toolCallingSupported?: boolean;
|
|
10
|
+
lastEvaluated?: string;
|
|
11
|
+
evaluationResults?: {
|
|
12
|
+
available: boolean;
|
|
13
|
+
modelName: string;
|
|
14
|
+
contextWindow: number;
|
|
15
|
+
toolCallingSupported: boolean;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export declare class ModelConfigManager {
|
|
19
|
+
private config;
|
|
20
|
+
constructor();
|
|
21
|
+
/**
|
|
22
|
+
* Load model configuration from file
|
|
23
|
+
*/
|
|
24
|
+
private loadConfig;
|
|
25
|
+
/**
|
|
26
|
+
* Save model configuration to file
|
|
27
|
+
*/
|
|
28
|
+
saveConfig(config: Partial<ModelConfig>): void;
|
|
29
|
+
/**
|
|
30
|
+
* Get preferred model for a use case
|
|
31
|
+
*/
|
|
32
|
+
getPreferredModel(useCase: 'planning' | 'chat' | 'reasoning' | 'default'): string | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Check if Command A/R+ models are available
|
|
35
|
+
*/
|
|
36
|
+
isCommandModelAvailable(): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Get context window size
|
|
39
|
+
*/
|
|
40
|
+
getContextWindow(): number;
|
|
41
|
+
/**
|
|
42
|
+
* Get full configuration
|
|
43
|
+
*/
|
|
44
|
+
getConfig(): ModelConfig;
|
|
45
|
+
}
|
|
46
|
+
export declare function getModelConfigManager(): ModelConfigManager;
|
|
47
|
+
//# sourceMappingURL=model-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-config.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/ai/model-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,MAAM,WAAW,WAAW;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,WAAW,GAAG,qBAAqB,GAAG,gBAAgB,GAAG,SAAS,CAAC;IACjF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE;QAClB,SAAS,EAAE,OAAO,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,MAAM,CAAC;QACtB,oBAAoB,EAAE,OAAO,CAAC;KAC/B,CAAC;CACH;AAID,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAc;;IAM5B;;OAEG;IACH,OAAO,CAAC,UAAU;IAYlB;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI;IAa9C;;OAEG;IACH,iBAAiB,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS;IAY7F;;OAEG;IACH,uBAAuB,IAAI,OAAO;IAIlC;;OAEG;IACH,gBAAgB,IAAI,MAAM;IAI1B;;OAEG;IACH,SAAS,IAAI,WAAW;CAGzB;AAKD,wBAAgB,qBAAqB,IAAI,kBAAkB,CAK1D"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model Configuration
|
|
3
|
+
* Manages Command A/R+ model selection based on evaluation results
|
|
4
|
+
*/
|
|
5
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
|
|
6
|
+
import { join, dirname } from 'path';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = dirname(__filename);
|
|
10
|
+
const CONFIG_FILE = join(__dirname, '../../../data/model-config.json');
|
|
11
|
+
export class ModelConfigManager {
|
|
12
|
+
config;
|
|
13
|
+
constructor() {
|
|
14
|
+
this.config = this.loadConfig();
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Load model configuration from file
|
|
18
|
+
*/
|
|
19
|
+
loadConfig() {
|
|
20
|
+
try {
|
|
21
|
+
if (existsSync(CONFIG_FILE)) {
|
|
22
|
+
const content = readFileSync(CONFIG_FILE, 'utf-8');
|
|
23
|
+
return JSON.parse(content);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
// If file doesn't exist or is invalid, use defaults
|
|
28
|
+
}
|
|
29
|
+
return {};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Save model configuration to file
|
|
33
|
+
*/
|
|
34
|
+
saveConfig(config) {
|
|
35
|
+
this.config = { ...this.config, ...config };
|
|
36
|
+
this.config.lastEvaluated = new Date().toISOString();
|
|
37
|
+
// Ensure data directory exists
|
|
38
|
+
const dataDir = dirname(CONFIG_FILE);
|
|
39
|
+
if (!existsSync(dataDir)) {
|
|
40
|
+
mkdirSync(dataDir, { recursive: true });
|
|
41
|
+
}
|
|
42
|
+
writeFileSync(CONFIG_FILE, JSON.stringify(this.config, null, 2), 'utf-8');
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Get preferred model for a use case
|
|
46
|
+
*/
|
|
47
|
+
getPreferredModel(useCase) {
|
|
48
|
+
// If a preferred model is set, use it for planning and complex tasks
|
|
49
|
+
if (this.config.preferredModel) {
|
|
50
|
+
if (useCase === 'planning' || useCase === 'reasoning') {
|
|
51
|
+
return this.config.preferredModel;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// For chat and default, use default model unless specifically configured
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Check if Command A/R+ models are available
|
|
59
|
+
*/
|
|
60
|
+
isCommandModelAvailable() {
|
|
61
|
+
return this.config.evaluationResults?.available || false;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get context window size
|
|
65
|
+
*/
|
|
66
|
+
getContextWindow() {
|
|
67
|
+
return this.config.contextWindow || 8000; // Default context window
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Get full configuration
|
|
71
|
+
*/
|
|
72
|
+
getConfig() {
|
|
73
|
+
return { ...this.config };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// Singleton instance
|
|
77
|
+
let modelConfigManager = null;
|
|
78
|
+
export function getModelConfigManager() {
|
|
79
|
+
if (!modelConfigManager) {
|
|
80
|
+
modelConfigManager = new ModelConfigManager();
|
|
81
|
+
}
|
|
82
|
+
return modelConfigManager;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=model-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-config.js","sourceRoot":"","sources":["../../../src/infrastructure/ai/model-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,SA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W,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC;IAED;;OAEG;IACH,iBAAiB,CAAC,OAAsD;QACtE,qEAAqE;QACrE,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;YAC/B,IAAI,OAAO,KAAK,UAAU,IAAI,OAAO,KAAK,WAAW,EAAE,CAAC;gBACtD,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;YACpC,CAAC;QACH,CAAC;QAED,yEAAyE;QACzE,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,uBAAuB;QACrB,OAAO,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,SAAS,IAAI,KAAK,CAAC;IAC3D,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,IAAI,CAAC,CAAC,yBAAyB;IACrE,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;IAC5B,CAAC;CACF;AAED,qBAAqB;AACrB,IAAI,kBAAkB,GAA8B,IAAI,CAAC;AAEzD,MAAM,UAAU,qBAAqB;IACnC,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxB,kBAAkB,GAAG,IAAI,kBAAkB,EAAE,CAAC;IAChD,CAAC;IACD,OAAO,kBAAkB,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure: Embedding Cache
|
|
3
|
+
* Caches embeddings to avoid redundant API calls
|
|
4
|
+
*
|
|
5
|
+
* Performance optimization: Reduces API calls by ~30-50% for repeated queries
|
|
6
|
+
*/
|
|
7
|
+
export declare class EmbeddingCache {
|
|
8
|
+
private cache;
|
|
9
|
+
private maxSize;
|
|
10
|
+
private ttl;
|
|
11
|
+
constructor(maxSize?: number, ttl?: number);
|
|
12
|
+
/**
|
|
13
|
+
* Generate cache key from query
|
|
14
|
+
*/
|
|
15
|
+
private getCacheKey;
|
|
16
|
+
/**
|
|
17
|
+
* Get cached embedding if available and not expired
|
|
18
|
+
*/
|
|
19
|
+
get(query: string): number[] | null;
|
|
20
|
+
/**
|
|
21
|
+
* Store embedding in cache
|
|
22
|
+
*/
|
|
23
|
+
set(query: string, embedding: number[]): void;
|
|
24
|
+
/**
|
|
25
|
+
* Evict oldest entries (LRU eviction)
|
|
26
|
+
*/
|
|
27
|
+
private evictOldest;
|
|
28
|
+
/**
|
|
29
|
+
* Clear expired entries
|
|
30
|
+
*/
|
|
31
|
+
clearExpired(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Clear all cache
|
|
34
|
+
*/
|
|
35
|
+
clear(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Get cache statistics
|
|
38
|
+
*/
|
|
39
|
+
getStats(): {
|
|
40
|
+
size: number;
|
|
41
|
+
maxSize: number;
|
|
42
|
+
hitRate?: number;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export declare function getEmbeddingCache(): EmbeddingCache;
|
|
46
|
+
//# sourceMappingURL=embedding-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedding-cache.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/cache/embedding-cache.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,qBAAa,cAAc;IACzB,OAAO,CAAC,KAAK,CAA2C;IACxD,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,GAAG,CAAS;gBAER,OAAO,GAAE,MAAa,EAAE,GAAG,GAAE,MAAgB;IAKzD;;OAEG;IACH,OAAO,CAAC,WAAW;IAMnB;;OAEG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI;IAkBnC;;OAEG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI;IAe7C;;OAEG;IACH,OAAO,CAAC,WAAW;IAYnB;;OAEG;IACH,YAAY,IAAI,IAAI;IASpB;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,QAAQ,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;CAMhE;AAKD,wBAAgB,iBAAiB,IAAI,cAAc,CAKlD"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure: Embedding Cache
|
|
3
|
+
* Caches embeddings to avoid redundant API calls
|
|
4
|
+
*
|
|
5
|
+
* Performance optimization: Reduces API calls by ~30-50% for repeated queries
|
|
6
|
+
*/
|
|
7
|
+
import { createHash } from 'crypto';
|
|
8
|
+
export class EmbeddingCache {
|
|
9
|
+
cache = new Map();
|
|
10
|
+
maxSize;
|
|
11
|
+
ttl; // Time to live in milliseconds
|
|
12
|
+
constructor(maxSize = 1000, ttl = 3600000) {
|
|
13
|
+
this.maxSize = maxSize;
|
|
14
|
+
this.ttl = ttl;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Generate cache key from query
|
|
18
|
+
*/
|
|
19
|
+
getCacheKey(query) {
|
|
20
|
+
// Normalize query (trim, lowercase) for better cache hits
|
|
21
|
+
const normalized = query.trim().toLowerCase();
|
|
22
|
+
return createHash('sha256').update(normalized).digest('hex');
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get cached embedding if available and not expired
|
|
26
|
+
*/
|
|
27
|
+
get(query) {
|
|
28
|
+
const key = this.getCacheKey(query);
|
|
29
|
+
const cached = this.cache.get(key);
|
|
30
|
+
if (!cached) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
// Check if expired
|
|
34
|
+
const now = Date.now();
|
|
35
|
+
if (now - cached.timestamp > this.ttl) {
|
|
36
|
+
this.cache.delete(key);
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return cached.embedding;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Store embedding in cache
|
|
43
|
+
*/
|
|
44
|
+
set(query, embedding) {
|
|
45
|
+
const key = this.getCacheKey(query);
|
|
46
|
+
// Evict oldest entries if cache is full
|
|
47
|
+
if (this.cache.size >= this.maxSize) {
|
|
48
|
+
this.evictOldest();
|
|
49
|
+
}
|
|
50
|
+
this.cache.set(key, {
|
|
51
|
+
embedding,
|
|
52
|
+
timestamp: Date.now(),
|
|
53
|
+
query: query.trim(),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Evict oldest entries (LRU eviction)
|
|
58
|
+
*/
|
|
59
|
+
evictOldest() {
|
|
60
|
+
// Remove 10% of oldest entries
|
|
61
|
+
const entriesToRemove = Math.ceil(this.maxSize * 0.1);
|
|
62
|
+
const entries = Array.from(this.cache.entries())
|
|
63
|
+
.sort((a, b) => a[1].timestamp - b[1].timestamp)
|
|
64
|
+
.slice(0, entriesToRemove);
|
|
65
|
+
for (const [key] of entries) {
|
|
66
|
+
this.cache.delete(key);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Clear expired entries
|
|
71
|
+
*/
|
|
72
|
+
clearExpired() {
|
|
73
|
+
const now = Date.now();
|
|
74
|
+
for (const [key, value] of this.cache.entries()) {
|
|
75
|
+
if (now - value.timestamp > this.ttl) {
|
|
76
|
+
this.cache.delete(key);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Clear all cache
|
|
82
|
+
*/
|
|
83
|
+
clear() {
|
|
84
|
+
this.cache.clear();
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Get cache statistics
|
|
88
|
+
*/
|
|
89
|
+
getStats() {
|
|
90
|
+
return {
|
|
91
|
+
size: this.cache.size,
|
|
92
|
+
maxSize: this.maxSize,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// Singleton instance
|
|
97
|
+
let embeddingCacheInstance = null;
|
|
98
|
+
export function getEmbeddingCache() {
|
|
99
|
+
if (!embeddingCacheInstance) {
|
|
100
|
+
embeddingCacheInstance = new EmbeddingCache();
|
|
101
|
+
}
|
|
102
|
+
return embeddingCacheInstance;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=embedding-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedding-cache.js","sourceRoot":"","sources":["../../../src/infrastructure/cache/embedding-cache.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAQpC,MAAM,OAAO,cAAc;IACjB,KAAK,GAAiC,IAAI,GAAG,EAAE,CAAC;IAChD,OAAO,CAAS;IAChB,GAAG,CAAS,CAAC,+BAA+B;IAEpD,YAAY,UAAkB,IAAI,EAAE,MAAc,OAAO;QACvD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED;;OAEG;IACK,WAAW,CAAC,KAAa;QAC/B,0DAA0D;QAC1D,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAC9C,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,KAAa;QACf,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACpC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAEnC,IAAI,CAAC,MAAM,EAAE,CAAC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;YAC5B,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IAED;;OAEG;IACH,YAAY;QACV,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;YAChD,IAAI,GAAG,GAAG,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;gBACrC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI;YACrB,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC;IACJ,CAAC;CACF;AAED,qBAAqB;AACrB,IAAI,sBAAsB,GAA0B,IAAI,CAAC;AAEzD,MAAM,UAAU,iBAAiB;IAC/B,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAC5B,sBAAsB,GAAG,IAAI,cAAc,EAAE,CAAC;IAChD,CAAC;IACD,OAAO,sBAAsB,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure: AST-Based Code Chunker
|
|
3
|
+
* Implements ICodeChunker using code-aware chunking
|
|
4
|
+
*/
|
|
5
|
+
import type { ICodeChunker } from '../../application/use-cases/index-codebase-use-case.js';
|
|
6
|
+
import type { CodeChunk } from '../../domain/entities/code-chunk.js';
|
|
7
|
+
export declare class ASTCodeChunker implements ICodeChunker {
|
|
8
|
+
private chunker;
|
|
9
|
+
constructor();
|
|
10
|
+
chunk(filepath: string): Promise<CodeChunk[]>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ast-code-chunker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast-code-chunker.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/chunking/ast-code-chunker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wDAAwD,CAAC;AAC3F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAErE,qBAAa,cAAe,YAAW,YAAY;IACjD,OAAO,CAAC,OAAO,CAAmB;;IAM5B,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;CAOpD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure: AST-Based Code Chunker
|
|
3
|
+
* Implements ICodeChunker using code-aware chunking
|
|
4
|
+
*/
|
|
5
|
+
import { CodeAwareChunker } from './code-aware-chunker.js';
|
|
6
|
+
export class ASTCodeChunker {
|
|
7
|
+
chunker;
|
|
8
|
+
constructor() {
|
|
9
|
+
this.chunker = new CodeAwareChunker();
|
|
10
|
+
}
|
|
11
|
+
async chunk(filepath) {
|
|
12
|
+
return await this.chunker.chunk(filepath, {
|
|
13
|
+
preserveSyntax: true,
|
|
14
|
+
hierarchical: true,
|
|
15
|
+
maxChunkSize: 2000, // tokens
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=ast-code-chunker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast-code-chunker.js","sourceRoot":"","sources":["../../../src/infrastructure/chunking/ast-code-chunker.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAI3D,MAAM,OAAO,cAAc;IACjB,OAAO,CAAmB;IAElC;QACE,IAAI,CAAC,OAAO,GAAG,IAAI,gBAAgB,EAAE,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,QAAgB;QAC1B,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE;YACxC,cAAc,EAAE,IAAI;YACpB,YAAY,EAAE,IAAI;YAClB,YAAY,EAAE,IAAI,EAAE,SAAS;SAC9B,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure: Code-Aware Chunker
|
|
3
|
+
* Implements enterprise-grade code chunking that respects code structure
|
|
4
|
+
*
|
|
5
|
+
* Based on enterprise architecture requirements:
|
|
6
|
+
* - Split by logical units (functions, classes, modules)
|
|
7
|
+
* - Preserve syntactic integrity
|
|
8
|
+
* - Hierarchical strategy (high-level docs → functions → lines)
|
|
9
|
+
*/
|
|
10
|
+
import type { CodeChunk } from '../../domain/entities/code-chunk.js';
|
|
11
|
+
export interface ChunkingOptions {
|
|
12
|
+
preserveSyntax?: boolean;
|
|
13
|
+
hierarchical?: boolean;
|
|
14
|
+
maxChunkSize?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare class CodeAwareChunker {
|
|
17
|
+
/**
|
|
18
|
+
* Chunk code file by logical units (functions, classes, modules)
|
|
19
|
+
* Preserves syntactic integrity - all chunks are valid code blocks
|
|
20
|
+
*/
|
|
21
|
+
chunk(filepath: string, options?: ChunkingOptions): Promise<CodeChunk[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Map symbol kind to chunk metadata type
|
|
24
|
+
*/
|
|
25
|
+
private mapSymbolKindToChunkType;
|
|
26
|
+
/**
|
|
27
|
+
* Chunk using AST analysis - most precise method
|
|
28
|
+
*/
|
|
29
|
+
private chunkByAST;
|
|
30
|
+
/**
|
|
31
|
+
* Chunk large class by its methods
|
|
32
|
+
*/
|
|
33
|
+
private chunkLargeClass;
|
|
34
|
+
/**
|
|
35
|
+
* Chunk by function boundaries (fallback method)
|
|
36
|
+
*/
|
|
37
|
+
private chunkByFunctions;
|
|
38
|
+
/**
|
|
39
|
+
* Chunk document files (markdown, text, etc.)
|
|
40
|
+
*/
|
|
41
|
+
private chunkDocument;
|
|
42
|
+
/**
|
|
43
|
+
* Extract content for a symbol from AST
|
|
44
|
+
*/
|
|
45
|
+
private extractSymbolContent;
|
|
46
|
+
/**
|
|
47
|
+
* Find end of symbol (class, function, etc.)
|
|
48
|
+
*/
|
|
49
|
+
private findSymbolEnd;
|
|
50
|
+
/**
|
|
51
|
+
* Find end of class
|
|
52
|
+
*/
|
|
53
|
+
private findClassEnd;
|
|
54
|
+
/**
|
|
55
|
+
* Count braces in line
|
|
56
|
+
*/
|
|
57
|
+
private countBraces;
|
|
58
|
+
/**
|
|
59
|
+
* Check if function is a method of a class
|
|
60
|
+
*/
|
|
61
|
+
private isMethodOfClass;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=code-aware-chunker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-aware-chunker.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/chunking/code-aware-chunker.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAErE,MAAM,WAAW,eAAe;IAC9B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,qBAAa,gBAAgB;IAC3B;;;OAGG;IACG,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAkClF;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAchC;;OAEG;IACH,OAAO,CAAC,UAAU;IAmFlB;;OAEG;IACH,OAAO,CAAC,eAAe;IA+DvB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA+FxB;;OAEG;IACH,OAAO,CAAC,aAAa;IAsDrB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAW5B;;OAEG;IACH,OAAO,CAAC,aAAa;IAuBrB;;OAEG;IACH,OAAO,CAAC,YAAY;IAIpB;;OAEG;IACH,OAAO,CAAC,WAAW;IAInB;;OAEG;IACH,OAAO,CAAC,eAAe;CAiBxB"}
|