codehere 0.3.0 → 0.5.0-alpha.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/README.md +230 -42
- package/dist/application/agents/documentation-agent.d.ts +24 -0
- package/dist/application/agents/documentation-agent.d.ts.map +1 -0
- package/dist/application/agents/documentation-agent.js +399 -0
- package/dist/application/agents/documentation-agent.js.map +1 -0
- package/dist/application/agents/execution-agent.d.ts +11 -0
- package/dist/application/agents/execution-agent.d.ts.map +1 -1
- package/dist/application/agents/execution-agent.js +289 -80
- package/dist/application/agents/execution-agent.js.map +1 -1
- package/dist/application/agents/multi-agent-orchestrator.d.ts +3 -0
- package/dist/application/agents/multi-agent-orchestrator.d.ts.map +1 -1
- package/dist/application/agents/multi-agent-orchestrator.js +86 -0
- package/dist/application/agents/multi-agent-orchestrator.js.map +1 -1
- package/dist/application/agents/planning-agent.d.ts +3 -0
- package/dist/application/agents/planning-agent.d.ts.map +1 -1
- package/dist/application/agents/planning-agent.js +146 -70
- package/dist/application/agents/planning-agent.js.map +1 -1
- package/dist/application/agents/product-requirements-agent.d.ts +21 -0
- package/dist/application/agents/product-requirements-agent.d.ts.map +1 -0
- package/dist/application/agents/product-requirements-agent.js +247 -0
- package/dist/application/agents/product-requirements-agent.js.map +1 -0
- package/dist/application/agents/validation-agent.d.ts +5 -1
- package/dist/application/agents/validation-agent.d.ts.map +1 -1
- package/dist/application/agents/validation-agent.js +156 -21
- package/dist/application/agents/validation-agent.js.map +1 -1
- package/dist/application/services/dependency-container.d.ts +46 -2
- package/dist/application/services/dependency-container.d.ts.map +1 -1
- package/dist/application/services/dependency-container.js +177 -7
- package/dist/application/services/dependency-container.js.map +1 -1
- package/dist/application/services/intelligent-router.d.ts +13 -0
- package/dist/application/services/intelligent-router.d.ts.map +1 -1
- package/dist/application/services/intelligent-router.js +306 -90
- package/dist/application/services/intelligent-router.js.map +1 -1
- package/dist/application/use-cases/ask-question-use-case.d.ts +19 -0
- package/dist/application/use-cases/ask-question-use-case.d.ts.map +1 -1
- package/dist/application/use-cases/ask-question-use-case.js +125 -46
- package/dist/application/use-cases/ask-question-use-case.js.map +1 -1
- package/dist/application/use-cases/edit-file-use-case.d.ts.map +1 -1
- package/dist/application/use-cases/edit-file-use-case.js +16 -1
- package/dist/application/use-cases/edit-file-use-case.js.map +1 -1
- package/dist/domain/entities/documentation.d.ts +35 -0
- package/dist/domain/entities/documentation.d.ts.map +1 -0
- package/dist/domain/entities/documentation.js +6 -0
- package/dist/domain/entities/documentation.js.map +1 -0
- package/dist/domain/entities/product-requirements.d.ts +50 -0
- package/dist/domain/entities/product-requirements.d.ts.map +1 -0
- package/dist/domain/entities/product-requirements.js +6 -0
- package/dist/domain/entities/product-requirements.js.map +1 -0
- package/dist/domain/entities/task.d.ts +152 -0
- package/dist/domain/entities/task.d.ts.map +1 -0
- package/dist/domain/entities/task.js +61 -0
- package/dist/domain/entities/task.js.map +1 -0
- package/dist/domain/errors/embeddings-not-found-error.d.ts +9 -0
- package/dist/domain/errors/embeddings-not-found-error.d.ts.map +1 -0
- package/dist/domain/errors/embeddings-not-found-error.js +13 -0
- package/dist/domain/errors/embeddings-not-found-error.js.map +1 -0
- package/dist/domain/interfaces/agent.interface.d.ts +15 -0
- package/dist/domain/interfaces/agent.interface.d.ts.map +1 -0
- package/dist/domain/interfaces/agent.interface.js +6 -0
- package/dist/domain/interfaces/agent.interface.js.map +1 -0
- package/dist/domain/interfaces/embedding-repository.interface.d.ts +5 -0
- package/dist/domain/interfaces/embedding-repository.interface.d.ts.map +1 -1
- package/dist/domain/services/environment-mode-manager.d.ts +12 -0
- package/dist/domain/services/environment-mode-manager.d.ts.map +1 -0
- package/dist/domain/services/environment-mode-manager.js +22 -0
- package/dist/domain/services/environment-mode-manager.js.map +1 -0
- package/dist/domain/services/risk-tier-detector.d.ts +17 -0
- package/dist/domain/services/risk-tier-detector.d.ts.map +1 -0
- package/dist/domain/services/risk-tier-detector.js +78 -0
- package/dist/domain/services/risk-tier-detector.js.map +1 -0
- package/dist/embed.d.ts.map +1 -1
- package/dist/embed.js +18 -8
- package/dist/embed.js.map +1 -1
- package/dist/formatter.d.ts.map +1 -1
- package/dist/formatter.js +10 -3
- package/dist/formatter.js.map +1 -1
- package/dist/index.js +398 -164
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/ai/cohere-ai-service.d.ts.map +1 -1
- package/dist/infrastructure/ai/cohere-ai-service.js +18 -5
- package/dist/infrastructure/ai/cohere-ai-service.js.map +1 -1
- package/dist/infrastructure/ai/fake-ai-service.d.ts +22 -0
- package/dist/infrastructure/ai/fake-ai-service.d.ts.map +1 -0
- package/dist/infrastructure/ai/fake-ai-service.js +59 -0
- package/dist/infrastructure/ai/fake-ai-service.js.map +1 -0
- package/dist/infrastructure/ai/provider-ai-service.d.ts +59 -0
- package/dist/infrastructure/ai/provider-ai-service.d.ts.map +1 -0
- package/dist/infrastructure/ai/provider-ai-service.js +477 -0
- package/dist/infrastructure/ai/provider-ai-service.js.map +1 -0
- package/dist/infrastructure/cache/embedding-cache.d.ts +13 -1
- package/dist/infrastructure/cache/embedding-cache.d.ts.map +1 -1
- package/dist/infrastructure/cache/embedding-cache.js +80 -9
- package/dist/infrastructure/cache/embedding-cache.js.map +1 -1
- package/dist/infrastructure/cache/query-result-cache.d.ts +14 -55
- package/dist/infrastructure/cache/query-result-cache.d.ts.map +1 -1
- package/dist/infrastructure/cache/query-result-cache.js +40 -112
- package/dist/infrastructure/cache/query-result-cache.js.map +1 -1
- package/dist/infrastructure/cache/response-cache.d.ts +18 -0
- package/dist/infrastructure/cache/response-cache.d.ts.map +1 -0
- package/dist/infrastructure/cache/response-cache.js +48 -0
- package/dist/infrastructure/cache/response-cache.js.map +1 -0
- package/dist/infrastructure/cache/security-scan-cache.d.ts +8 -49
- package/dist/infrastructure/cache/security-scan-cache.d.ts.map +1 -1
- package/dist/infrastructure/cache/security-scan-cache.js +25 -102
- package/dist/infrastructure/cache/security-scan-cache.js.map +1 -1
- package/dist/infrastructure/completion/bash-completion.d.ts +2 -3
- package/dist/infrastructure/completion/bash-completion.d.ts.map +1 -1
- package/dist/infrastructure/completion/bash-completion.js +11 -87
- package/dist/infrastructure/completion/bash-completion.js.map +1 -1
- package/dist/infrastructure/completion/fish-completion.d.ts +2 -3
- package/dist/infrastructure/completion/fish-completion.d.ts.map +1 -1
- package/dist/infrastructure/completion/fish-completion.js +15 -58
- package/dist/infrastructure/completion/fish-completion.js.map +1 -1
- package/dist/infrastructure/completion/zsh-completion.d.ts +2 -3
- package/dist/infrastructure/completion/zsh-completion.d.ts.map +1 -1
- package/dist/infrastructure/completion/zsh-completion.js +18 -73
- package/dist/infrastructure/completion/zsh-completion.js.map +1 -1
- package/dist/infrastructure/config/config-manager.js +2 -2
- package/dist/infrastructure/config/config-manager.js.map +1 -1
- package/dist/infrastructure/context/conversation-context.d.ts +54 -0
- package/dist/infrastructure/context/conversation-context.d.ts.map +1 -0
- package/dist/infrastructure/context/conversation-context.js +128 -0
- package/dist/infrastructure/context/conversation-context.js.map +1 -0
- package/dist/infrastructure/context/session-manager.d.ts +42 -0
- package/dist/infrastructure/context/session-manager.d.ts.map +1 -0
- package/dist/infrastructure/context/session-manager.js +94 -0
- package/dist/infrastructure/context/session-manager.js.map +1 -0
- package/dist/infrastructure/cost/cost-tracker.d.ts +1 -0
- package/dist/infrastructure/cost/cost-tracker.d.ts.map +1 -1
- package/dist/infrastructure/cost/cost-tracker.js +12 -5
- package/dist/infrastructure/cost/cost-tracker.js.map +1 -1
- package/dist/infrastructure/governance/nist-ai-rmf.d.ts +6 -8
- package/dist/infrastructure/governance/nist-ai-rmf.d.ts.map +1 -1
- package/dist/infrastructure/governance/nist-ai-rmf.js +6 -8
- package/dist/infrastructure/governance/nist-ai-rmf.js.map +1 -1
- package/dist/infrastructure/governance/policy-as-code.d.ts +6 -8
- package/dist/infrastructure/governance/policy-as-code.d.ts.map +1 -1
- package/dist/infrastructure/governance/policy-as-code.js +6 -8
- package/dist/infrastructure/governance/policy-as-code.js.map +1 -1
- package/dist/infrastructure/governance/prompt-to-code-lineage.d.ts +7 -9
- package/dist/infrastructure/governance/prompt-to-code-lineage.d.ts.map +1 -1
- package/dist/infrastructure/governance/prompt-to-code-lineage.js +7 -9
- package/dist/infrastructure/governance/prompt-to-code-lineage.js.map +1 -1
- package/dist/infrastructure/providers/cohere-provider.d.ts +39 -0
- package/dist/infrastructure/providers/cohere-provider.d.ts.map +1 -0
- package/dist/infrastructure/providers/cohere-provider.js +444 -0
- package/dist/infrastructure/providers/cohere-provider.js.map +1 -0
- package/dist/infrastructure/providers/fake-provider.d.ts +43 -0
- package/dist/infrastructure/providers/fake-provider.d.ts.map +1 -0
- package/dist/infrastructure/providers/fake-provider.js +130 -0
- package/dist/infrastructure/providers/fake-provider.js.map +1 -0
- package/dist/infrastructure/providers/local-llm-provider.d.ts +49 -0
- package/dist/infrastructure/providers/local-llm-provider.d.ts.map +1 -0
- package/dist/infrastructure/providers/local-llm-provider.js +330 -0
- package/dist/infrastructure/providers/local-llm-provider.js.map +1 -0
- package/dist/infrastructure/providers/model-config.types.d.ts +70 -0
- package/dist/infrastructure/providers/model-config.types.d.ts.map +1 -0
- package/dist/infrastructure/providers/model-config.types.js +9 -0
- package/dist/infrastructure/providers/model-config.types.js.map +1 -0
- package/dist/infrastructure/providers/model-provider.interface.d.ts +113 -0
- package/dist/infrastructure/providers/model-provider.interface.d.ts.map +1 -0
- package/dist/infrastructure/providers/model-provider.interface.js +8 -0
- package/dist/infrastructure/providers/model-provider.interface.js.map +1 -0
- package/dist/infrastructure/providers/openai-provider.d.ts +38 -0
- package/dist/infrastructure/providers/openai-provider.d.ts.map +1 -0
- package/dist/infrastructure/providers/openai-provider.js +413 -0
- package/dist/infrastructure/providers/openai-provider.js.map +1 -0
- package/dist/infrastructure/providers/openrouter-provider.d.ts +42 -0
- package/dist/infrastructure/providers/openrouter-provider.d.ts.map +1 -0
- package/dist/infrastructure/providers/openrouter-provider.js +399 -0
- package/dist/infrastructure/providers/openrouter-provider.js.map +1 -0
- package/dist/infrastructure/providers/operation-provider-resolver.d.ts +48 -0
- package/dist/infrastructure/providers/operation-provider-resolver.d.ts.map +1 -0
- package/dist/infrastructure/providers/operation-provider-resolver.js +105 -0
- package/dist/infrastructure/providers/operation-provider-resolver.js.map +1 -0
- package/dist/infrastructure/providers/provider-config-loader.d.ts +37 -0
- package/dist/infrastructure/providers/provider-config-loader.d.ts.map +1 -0
- package/dist/infrastructure/providers/provider-config-loader.js +120 -0
- package/dist/infrastructure/providers/provider-config-loader.js.map +1 -0
- package/dist/infrastructure/providers/provider-registry.d.ts +53 -0
- package/dist/infrastructure/providers/provider-registry.d.ts.map +1 -0
- package/dist/infrastructure/providers/provider-registry.js +88 -0
- package/dist/infrastructure/providers/provider-registry.js.map +1 -0
- package/dist/infrastructure/serialization/toon-serializer.d.ts +45 -0
- package/dist/infrastructure/serialization/toon-serializer.d.ts.map +1 -0
- package/dist/infrastructure/serialization/toon-serializer.js +119 -0
- package/dist/infrastructure/serialization/toon-serializer.js.map +1 -0
- package/dist/infrastructure/storage/embeddings-path.d.ts +18 -0
- package/dist/infrastructure/storage/embeddings-path.d.ts.map +1 -0
- package/dist/infrastructure/storage/embeddings-path.js +37 -0
- package/dist/infrastructure/storage/embeddings-path.js.map +1 -0
- package/dist/infrastructure/storage/plan-repository.d.ts +2 -0
- package/dist/infrastructure/storage/plan-repository.d.ts.map +1 -1
- package/dist/infrastructure/storage/plan-repository.js +36 -73
- package/dist/infrastructure/storage/plan-repository.js.map +1 -1
- package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts +10 -1
- package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts.map +1 -1
- package/dist/infrastructure/storage/sqlite-embedding-repository.js +37 -3
- package/dist/infrastructure/storage/sqlite-embedding-repository.js.map +1 -1
- package/dist/infrastructure/storage/task-helpers.d.ts +69 -0
- package/dist/infrastructure/storage/task-helpers.d.ts.map +1 -0
- package/dist/infrastructure/storage/task-helpers.js +197 -0
- package/dist/infrastructure/storage/task-helpers.js.map +1 -0
- package/dist/infrastructure/storage/task-repository.d.ts +67 -0
- package/dist/infrastructure/storage/task-repository.d.ts.map +1 -0
- package/dist/infrastructure/storage/task-repository.js +205 -0
- package/dist/infrastructure/storage/task-repository.js.map +1 -0
- package/dist/infrastructure/ux/bi-directional-learning.d.ts +22 -0
- package/dist/infrastructure/ux/bi-directional-learning.d.ts.map +1 -1
- package/dist/infrastructure/ux/bi-directional-learning.js +144 -7
- package/dist/infrastructure/ux/bi-directional-learning.js.map +1 -1
- package/dist/infrastructure/ux/capability-boundaries.d.ts +22 -0
- package/dist/infrastructure/ux/capability-boundaries.d.ts.map +1 -0
- package/dist/infrastructure/ux/capability-boundaries.js +42 -0
- package/dist/infrastructure/ux/capability-boundaries.js.map +1 -0
- package/dist/infrastructure/ux/comprehensive-formatter.d.ts +21 -0
- package/dist/infrastructure/ux/comprehensive-formatter.d.ts.map +1 -0
- package/dist/infrastructure/ux/comprehensive-formatter.js +117 -0
- package/dist/infrastructure/ux/comprehensive-formatter.js.map +1 -0
- package/dist/infrastructure/ux/contextual-feature-discovery.d.ts +5 -18
- package/dist/infrastructure/ux/contextual-feature-discovery.d.ts.map +1 -1
- package/dist/infrastructure/ux/contextual-feature-discovery.js +5 -139
- package/dist/infrastructure/ux/contextual-feature-discovery.js.map +1 -1
- package/dist/infrastructure/ux/feature-discovery.d.ts +3 -33
- package/dist/infrastructure/ux/feature-discovery.d.ts.map +1 -1
- package/dist/infrastructure/ux/feature-discovery.js +5 -181
- package/dist/infrastructure/ux/feature-discovery.js.map +1 -1
- package/dist/infrastructure/ux/feedback-prompt.d.ts +26 -0
- package/dist/infrastructure/ux/feedback-prompt.d.ts.map +1 -0
- package/dist/infrastructure/ux/feedback-prompt.js +45 -0
- package/dist/infrastructure/ux/feedback-prompt.js.map +1 -0
- package/dist/infrastructure/ux/hitl-review-portal.d.ts.map +1 -1
- package/dist/infrastructure/ux/hitl-review-portal.js +4 -1
- package/dist/infrastructure/ux/hitl-review-portal.js.map +1 -1
- package/dist/infrastructure/ux/hitl-validation.d.ts +35 -0
- package/dist/infrastructure/ux/hitl-validation.d.ts.map +1 -1
- package/dist/infrastructure/ux/hitl-validation.js +86 -0
- package/dist/infrastructure/ux/hitl-validation.js.map +1 -1
- package/dist/infrastructure/ux/progress-indicator.d.ts +4 -5
- package/dist/infrastructure/ux/progress-indicator.d.ts.map +1 -1
- package/dist/infrastructure/ux/progress-indicator.js +35 -40
- package/dist/infrastructure/ux/progress-indicator.js.map +1 -1
- package/dist/infrastructure/ux/proportional-friction.d.ts +73 -0
- package/dist/infrastructure/ux/proportional-friction.d.ts.map +1 -0
- package/dist/infrastructure/ux/proportional-friction.js +200 -0
- package/dist/infrastructure/ux/proportional-friction.js.map +1 -0
- package/dist/infrastructure/ux/review-checkpoint.d.ts +3 -1
- package/dist/infrastructure/ux/review-checkpoint.d.ts.map +1 -1
- package/dist/infrastructure/ux/review-checkpoint.js +33 -80
- package/dist/infrastructure/ux/review-checkpoint.js.map +1 -1
- package/dist/infrastructure/ux/staged-feature-intro.d.ts +14 -39
- package/dist/infrastructure/ux/staged-feature-intro.d.ts.map +1 -1
- package/dist/infrastructure/ux/staged-feature-intro.js +12 -132
- package/dist/infrastructure/ux/staged-feature-intro.js.map +1 -1
- package/dist/infrastructure/ux/syntax-highlighter.d.ts +1 -2
- package/dist/infrastructure/ux/syntax-highlighter.d.ts.map +1 -1
- package/dist/infrastructure/ux/syntax-highlighter.js +67 -148
- package/dist/infrastructure/ux/syntax-highlighter.js.map +1 -1
- package/dist/infrastructure/validation/agent-feedback.d.ts +51 -0
- package/dist/infrastructure/validation/agent-feedback.d.ts.map +1 -0
- package/dist/infrastructure/validation/agent-feedback.js +55 -0
- package/dist/infrastructure/validation/agent-feedback.js.map +1 -0
- package/dist/infrastructure/validation/agent-validation-helper.d.ts +75 -0
- package/dist/infrastructure/validation/agent-validation-helper.d.ts.map +1 -0
- package/dist/infrastructure/validation/agent-validation-helper.js +137 -0
- package/dist/infrastructure/validation/agent-validation-helper.js.map +1 -0
- package/dist/infrastructure/validation/feedback-stats.d.ts +99 -0
- package/dist/infrastructure/validation/feedback-stats.d.ts.map +1 -0
- package/dist/infrastructure/validation/feedback-stats.js +173 -0
- package/dist/infrastructure/validation/feedback-stats.js.map +1 -0
- package/dist/infrastructure/validation/review-handler.d.ts +26 -0
- package/dist/infrastructure/validation/review-handler.d.ts.map +1 -0
- package/dist/infrastructure/validation/review-handler.js +40 -0
- package/dist/infrastructure/validation/review-handler.js.map +1 -0
- package/dist/infrastructure/validation/summary-aggregator.d.ts +45 -0
- package/dist/infrastructure/validation/summary-aggregator.d.ts.map +1 -0
- package/dist/infrastructure/validation/summary-aggregator.js +70 -0
- package/dist/infrastructure/validation/summary-aggregator.js.map +1 -0
- package/dist/infrastructure/validation/summary-extractor.d.ts +24 -0
- package/dist/infrastructure/validation/summary-extractor.d.ts.map +1 -0
- package/dist/infrastructure/validation/summary-extractor.js +45 -0
- package/dist/infrastructure/validation/summary-extractor.js.map +1 -0
- package/dist/infrastructure/validation/trace-summary.d.ts +45 -0
- package/dist/infrastructure/validation/trace-summary.d.ts.map +1 -0
- package/dist/infrastructure/validation/trace-summary.js +52 -0
- package/dist/infrastructure/validation/trace-summary.js.map +1 -0
- package/dist/infrastructure/validation/trust-config.d.ts +27 -0
- package/dist/infrastructure/validation/trust-config.d.ts.map +1 -0
- package/dist/infrastructure/validation/trust-config.js +113 -0
- package/dist/infrastructure/validation/trust-config.js.map +1 -0
- package/dist/infrastructure/xai/attention-visualizer.d.ts +6 -8
- package/dist/infrastructure/xai/attention-visualizer.d.ts.map +1 -1
- package/dist/infrastructure/xai/attention-visualizer.js +6 -8
- package/dist/infrastructure/xai/attention-visualizer.js.map +1 -1
- package/dist/infrastructure/xai/cot-visualizer.d.ts +6 -9
- package/dist/infrastructure/xai/cot-visualizer.d.ts.map +1 -1
- package/dist/infrastructure/xai/cot-visualizer.js +6 -9
- package/dist/infrastructure/xai/cot-visualizer.js.map +1 -1
- package/dist/infrastructure/xai/decision-tree-log.d.ts +6 -10
- package/dist/infrastructure/xai/decision-tree-log.d.ts.map +1 -1
- package/dist/infrastructure/xai/decision-tree-log.js +6 -10
- package/dist/infrastructure/xai/decision-tree-log.js.map +1 -1
- package/dist/infrastructure/xai/interactive-xai.d.ts +6 -8
- package/dist/infrastructure/xai/interactive-xai.d.ts.map +1 -1
- package/dist/infrastructure/xai/interactive-xai.js +6 -8
- package/dist/infrastructure/xai/interactive-xai.js.map +1 -1
- package/dist/infrastructure/xai/uncertainty-quantifier.d.ts +6 -9
- package/dist/infrastructure/xai/uncertainty-quantifier.d.ts.map +1 -1
- package/dist/infrastructure/xai/uncertainty-quantifier.js +6 -9
- package/dist/infrastructure/xai/uncertainty-quantifier.js.map +1 -1
- package/dist/monitoring.d.ts +1 -1
- package/dist/monitoring.d.ts.map +1 -1
- package/dist/monitoring.js +12 -9
- package/dist/monitoring.js.map +1 -1
- package/dist/parallel-processor.d.ts.map +1 -1
- package/dist/parallel-processor.js +124 -45
- package/dist/parallel-processor.js.map +1 -1
- package/dist/presentation/cli/commands/ask-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/ask-command.js +225 -86
- package/dist/presentation/cli/commands/ask-command.js.map +1 -1
- package/dist/presentation/cli/commands/config-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/config-command.js +8 -6
- package/dist/presentation/cli/commands/config-command.js.map +1 -1
- package/dist/presentation/cli/commands/docs-command.d.ts +14 -0
- package/dist/presentation/cli/commands/docs-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/docs-command.js +25 -0
- package/dist/presentation/cli/commands/docs-command.js.map +1 -0
- package/dist/presentation/cli/commands/fix-command.d.ts +10 -0
- package/dist/presentation/cli/commands/fix-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/fix-command.js +53 -0
- package/dist/presentation/cli/commands/fix-command.js.map +1 -0
- package/dist/presentation/cli/commands/help-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/help-command.js +2 -0
- package/dist/presentation/cli/commands/help-command.js.map +1 -1
- package/dist/presentation/cli/commands/models-command.d.ts +13 -0
- package/dist/presentation/cli/commands/models-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/models-command.js +194 -0
- package/dist/presentation/cli/commands/models-command.js.map +1 -0
- package/dist/presentation/cli/commands/orchestrate-command.d.ts +1 -0
- package/dist/presentation/cli/commands/orchestrate-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/orchestrate-command.js +68 -7
- package/dist/presentation/cli/commands/orchestrate-command.js.map +1 -1
- package/dist/presentation/cli/commands/plan-command.d.ts +1 -0
- package/dist/presentation/cli/commands/plan-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/plan-command.js +88 -8
- package/dist/presentation/cli/commands/plan-command.js.map +1 -1
- package/dist/presentation/cli/commands/product-command.d.ts +14 -0
- package/dist/presentation/cli/commands/product-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/product-command.js +22 -0
- package/dist/presentation/cli/commands/product-command.js.map +1 -0
- package/dist/presentation/cli/commands/react-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/react-command.js +3 -1
- package/dist/presentation/cli/commands/react-command.js.map +1 -1
- package/dist/presentation/cli/commands/review-command.d.ts +14 -0
- package/dist/presentation/cli/commands/review-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/review-command.js +154 -0
- package/dist/presentation/cli/commands/review-command.js.map +1 -0
- package/dist/presentation/cli/commands/run-command.d.ts +13 -0
- package/dist/presentation/cli/commands/run-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/run-command.js +188 -0
- package/dist/presentation/cli/commands/run-command.js.map +1 -0
- package/dist/presentation/cli/commands/setup-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/setup-command.js +15 -0
- package/dist/presentation/cli/commands/setup-command.js.map +1 -1
- package/dist/presentation/cli/commands/smart-command.d.ts +3 -1
- package/dist/presentation/cli/commands/smart-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/smart-command.js +92 -6
- package/dist/presentation/cli/commands/smart-command.js.map +1 -1
- package/dist/presentation/cli/commands/status-command.d.ts +14 -0
- package/dist/presentation/cli/commands/status-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/status-command.js +167 -0
- package/dist/presentation/cli/commands/status-command.js.map +1 -0
- package/dist/presentation/cli/commands/suggest-command.d.ts +11 -0
- package/dist/presentation/cli/commands/suggest-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/suggest-command.js +138 -0
- package/dist/presentation/cli/commands/suggest-command.js.map +1 -0
- package/dist/presentation/cli/error-display.d.ts.map +1 -1
- package/dist/presentation/cli/error-display.js +43 -0
- package/dist/presentation/cli/error-display.js.map +1 -1
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +6 -1
- package/dist/search.js.map +1 -1
- package/dist/session.js +19 -2
- package/dist/session.js.map +1 -1
- package/dist/ui.d.ts +6 -0
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +43 -6
- package/dist/ui.js.map +1 -1
- package/package.json +16 -3
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider Layer: OpenRouterProvider
|
|
3
|
+
* Implements IModelProvider for OpenRouter API
|
|
4
|
+
*
|
|
5
|
+
* Phase 4D: OpenRouter Provider Implementation
|
|
6
|
+
*
|
|
7
|
+
* OpenRouter provides unified access to 400+ AI models through a single API.
|
|
8
|
+
* Supports GPT-4, Claude, Llama, Mistral, and many more models.
|
|
9
|
+
*
|
|
10
|
+
* Uses OpenRouter REST API directly (no SDK dependency) to keep dependencies minimal.
|
|
11
|
+
*/
|
|
12
|
+
import { config } from 'dotenv';
|
|
13
|
+
import { join, dirname } from 'path';
|
|
14
|
+
import { fileURLToPath } from 'url';
|
|
15
|
+
import { encoding_for_model } from 'tiktoken';
|
|
16
|
+
import { retryWithBackoff } from '../../error-handler.js';
|
|
17
|
+
// Load .env (same pattern as other providers)
|
|
18
|
+
try {
|
|
19
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
20
|
+
const __dirname = dirname(__filename);
|
|
21
|
+
const agentDir = join(__dirname, '../../../..');
|
|
22
|
+
config({ path: join(agentDir, '.env') });
|
|
23
|
+
}
|
|
24
|
+
catch { }
|
|
25
|
+
config();
|
|
26
|
+
// Token counting (using tiktoken - OpenAI's tokenizer, works for most models)
|
|
27
|
+
let tokenEncoder = null;
|
|
28
|
+
function getTokenEncoder() {
|
|
29
|
+
if (!tokenEncoder) {
|
|
30
|
+
try {
|
|
31
|
+
tokenEncoder = encoding_for_model('gpt-3.5-turbo');
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
tokenEncoder = encoding_for_model('gpt-4');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return tokenEncoder;
|
|
38
|
+
}
|
|
39
|
+
function countTokens(text) {
|
|
40
|
+
try {
|
|
41
|
+
const encoder = getTokenEncoder();
|
|
42
|
+
return encoder.encode(text).length;
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
console.warn('Warning: tiktoken failed, using character-based estimate (less accurate)');
|
|
46
|
+
return Math.ceil(text.length / 4);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* OpenRouter Provider
|
|
51
|
+
* Implements IModelProvider using OpenRouter REST API
|
|
52
|
+
*/
|
|
53
|
+
export class OpenRouterProvider {
|
|
54
|
+
id = 'openrouter';
|
|
55
|
+
name = 'OpenRouter';
|
|
56
|
+
capabilities = {
|
|
57
|
+
chat: true,
|
|
58
|
+
streaming: true,
|
|
59
|
+
embedding: false, // OpenRouter routes to model-specific endpoints (TBD)
|
|
60
|
+
embeddingQuery: false,
|
|
61
|
+
rerank: false, // OpenRouter doesn't have unified rerank API
|
|
62
|
+
toolCalling: true, // Many models support tool calling
|
|
63
|
+
};
|
|
64
|
+
apiKey;
|
|
65
|
+
baseUrl;
|
|
66
|
+
defaultChatModel;
|
|
67
|
+
constructor(apiKey) {
|
|
68
|
+
const key = apiKey || process.env.OPENROUTER_API_KEY;
|
|
69
|
+
if (!key) {
|
|
70
|
+
throw new Error('OPENROUTER_API_KEY not found in environment');
|
|
71
|
+
}
|
|
72
|
+
this.apiKey = key;
|
|
73
|
+
this.baseUrl = process.env.OPENROUTER_BASE_URL || 'https://openrouter.ai/api/v1';
|
|
74
|
+
this.defaultChatModel = process.env.CODEHERE_OPENROUTER_CHAT_MODEL || 'openai/gpt-4o-mini';
|
|
75
|
+
}
|
|
76
|
+
async getModels() {
|
|
77
|
+
// Fetch models from OpenRouter API
|
|
78
|
+
try {
|
|
79
|
+
const response = await fetch(`${this.baseUrl}/models`, {
|
|
80
|
+
method: 'GET',
|
|
81
|
+
headers: {
|
|
82
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
83
|
+
'HTTP-Referer': 'https://github.com/muhammadegaa/codehere', // Optional: for analytics
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
if (!response.ok) {
|
|
87
|
+
// Fallback to known models if API call fails
|
|
88
|
+
return this.getDefaultModels();
|
|
89
|
+
}
|
|
90
|
+
const data = await response.json();
|
|
91
|
+
const models = data.data || [];
|
|
92
|
+
// Transform OpenRouter model format to ModelInfo
|
|
93
|
+
return models
|
|
94
|
+
.filter((model) => model.id && model.name)
|
|
95
|
+
.map((model) => ({
|
|
96
|
+
id: model.id,
|
|
97
|
+
name: model.name || model.id,
|
|
98
|
+
providerId: 'openrouter',
|
|
99
|
+
providerModelId: model.id,
|
|
100
|
+
contextWindow: model.context_length || 8192,
|
|
101
|
+
capabilities: {
|
|
102
|
+
chat: model.top_provider?.supports_chat !== false,
|
|
103
|
+
streaming: true,
|
|
104
|
+
embedding: false, // OpenRouter embeddings TBD
|
|
105
|
+
embeddingQuery: false,
|
|
106
|
+
rerank: false,
|
|
107
|
+
toolCalling: model.top_provider?.supports_function_calling === true,
|
|
108
|
+
},
|
|
109
|
+
}))
|
|
110
|
+
.slice(0, 100); // Limit to top 100 models
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
// Fallback to known models on error
|
|
114
|
+
console.warn('[OpenRouterProvider] Failed to fetch models, using defaults:', error instanceof Error ? error.message : String(error));
|
|
115
|
+
return this.getDefaultModels();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Get default models (fallback if API call fails)
|
|
120
|
+
*/
|
|
121
|
+
getDefaultModels() {
|
|
122
|
+
return [
|
|
123
|
+
{
|
|
124
|
+
id: 'openai/gpt-4o',
|
|
125
|
+
name: 'GPT-4o (via OpenRouter)',
|
|
126
|
+
providerId: 'openrouter',
|
|
127
|
+
providerModelId: 'openai/gpt-4o',
|
|
128
|
+
contextWindow: 128000,
|
|
129
|
+
capabilities: {
|
|
130
|
+
chat: true,
|
|
131
|
+
streaming: true,
|
|
132
|
+
embedding: false,
|
|
133
|
+
embeddingQuery: false,
|
|
134
|
+
rerank: false,
|
|
135
|
+
toolCalling: true,
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
id: 'openai/gpt-4o-mini',
|
|
140
|
+
name: 'GPT-4o Mini (via OpenRouter)',
|
|
141
|
+
providerId: 'openrouter',
|
|
142
|
+
providerModelId: 'openai/gpt-4o-mini',
|
|
143
|
+
contextWindow: 128000,
|
|
144
|
+
capabilities: {
|
|
145
|
+
chat: true,
|
|
146
|
+
streaming: true,
|
|
147
|
+
embedding: false,
|
|
148
|
+
embeddingQuery: false,
|
|
149
|
+
rerank: false,
|
|
150
|
+
toolCalling: true,
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: 'anthropic/claude-3.5-sonnet',
|
|
155
|
+
name: 'Claude 3.5 Sonnet (via OpenRouter)',
|
|
156
|
+
providerId: 'openrouter',
|
|
157
|
+
providerModelId: 'anthropic/claude-3.5-sonnet',
|
|
158
|
+
contextWindow: 200000,
|
|
159
|
+
capabilities: {
|
|
160
|
+
chat: true,
|
|
161
|
+
streaming: true,
|
|
162
|
+
embedding: false,
|
|
163
|
+
embeddingQuery: false,
|
|
164
|
+
rerank: false,
|
|
165
|
+
toolCalling: true,
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: 'meta-llama/llama-3.1-70b-instruct',
|
|
170
|
+
name: 'Llama 3.1 70B (via OpenRouter)',
|
|
171
|
+
providerId: 'openrouter',
|
|
172
|
+
providerModelId: 'meta-llama/llama-3.1-70b-instruct',
|
|
173
|
+
contextWindow: 131072,
|
|
174
|
+
capabilities: {
|
|
175
|
+
chat: true,
|
|
176
|
+
streaming: true,
|
|
177
|
+
embedding: false,
|
|
178
|
+
embeddingQuery: false,
|
|
179
|
+
rerank: false,
|
|
180
|
+
toolCalling: false,
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
];
|
|
184
|
+
}
|
|
185
|
+
getDefaultModel() {
|
|
186
|
+
return this.defaultChatModel;
|
|
187
|
+
}
|
|
188
|
+
async chat(prompt, options) {
|
|
189
|
+
const model = options?.model || this.defaultChatModel;
|
|
190
|
+
return await retryWithBackoff(async () => {
|
|
191
|
+
const response = await fetch(`${this.baseUrl}/chat/completions`, {
|
|
192
|
+
method: 'POST',
|
|
193
|
+
headers: {
|
|
194
|
+
'Content-Type': 'application/json',
|
|
195
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
196
|
+
'HTTP-Referer': 'https://github.com/muhammadegaa/codehere', // Optional: for analytics
|
|
197
|
+
'X-Title': 'Codehere CLI', // Optional: for analytics
|
|
198
|
+
},
|
|
199
|
+
body: JSON.stringify({
|
|
200
|
+
model,
|
|
201
|
+
messages: [
|
|
202
|
+
{
|
|
203
|
+
role: 'user',
|
|
204
|
+
content: prompt,
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
temperature: options?.temperature ?? 0.7,
|
|
208
|
+
max_tokens: options?.maxTokens,
|
|
209
|
+
}),
|
|
210
|
+
});
|
|
211
|
+
if (!response.ok) {
|
|
212
|
+
const errorText = await response.text();
|
|
213
|
+
let errorMessage = `OpenRouter API error: ${response.status} ${response.statusText}`;
|
|
214
|
+
try {
|
|
215
|
+
const errorJson = JSON.parse(errorText);
|
|
216
|
+
errorMessage = errorJson.error?.message || errorMessage;
|
|
217
|
+
}
|
|
218
|
+
catch {
|
|
219
|
+
errorMessage = errorText || errorMessage;
|
|
220
|
+
}
|
|
221
|
+
throw new Error(errorMessage);
|
|
222
|
+
}
|
|
223
|
+
const data = await response.json();
|
|
224
|
+
const text = data.choices?.[0]?.message?.content || 'No response generated';
|
|
225
|
+
const usage = data.usage || {};
|
|
226
|
+
return {
|
|
227
|
+
text,
|
|
228
|
+
model: data.model || model,
|
|
229
|
+
usage: {
|
|
230
|
+
inputTokens: usage.prompt_tokens || countTokens(prompt),
|
|
231
|
+
outputTokens: usage.completion_tokens || countTokens(text),
|
|
232
|
+
},
|
|
233
|
+
finishReason: data.choices?.[0]?.finish_reason,
|
|
234
|
+
};
|
|
235
|
+
}, {
|
|
236
|
+
maxRetries: 5,
|
|
237
|
+
baseDelay: 2000,
|
|
238
|
+
maxDelay: 60000,
|
|
239
|
+
operationName: 'openrouter-provider-chat',
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
async chatStream(prompt, options, onEvent) {
|
|
243
|
+
const model = options?.model || this.defaultChatModel;
|
|
244
|
+
let fullText = '';
|
|
245
|
+
try {
|
|
246
|
+
if (onEvent) {
|
|
247
|
+
onEvent({ type: 'start' });
|
|
248
|
+
}
|
|
249
|
+
const response = await fetch(`${this.baseUrl}/chat/completions`, {
|
|
250
|
+
method: 'POST',
|
|
251
|
+
headers: {
|
|
252
|
+
'Content-Type': 'application/json',
|
|
253
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
254
|
+
'HTTP-Referer': 'https://github.com/muhammadegaa/codehere',
|
|
255
|
+
'X-Title': 'Codehere CLI',
|
|
256
|
+
},
|
|
257
|
+
body: JSON.stringify({
|
|
258
|
+
model,
|
|
259
|
+
messages: [
|
|
260
|
+
{
|
|
261
|
+
role: 'user',
|
|
262
|
+
content: prompt,
|
|
263
|
+
},
|
|
264
|
+
],
|
|
265
|
+
temperature: options?.temperature ?? 0.7,
|
|
266
|
+
max_tokens: options?.maxTokens,
|
|
267
|
+
stream: true,
|
|
268
|
+
}),
|
|
269
|
+
});
|
|
270
|
+
if (!response.ok) {
|
|
271
|
+
const errorText = await response.text();
|
|
272
|
+
throw new Error(`OpenRouter API error: ${response.status} ${errorText}`);
|
|
273
|
+
}
|
|
274
|
+
if (!response.body) {
|
|
275
|
+
throw new Error('No response body for streaming');
|
|
276
|
+
}
|
|
277
|
+
const reader = response.body.getReader();
|
|
278
|
+
const decoder = new TextDecoder();
|
|
279
|
+
while (true) {
|
|
280
|
+
const { done, value } = await reader.read();
|
|
281
|
+
if (done)
|
|
282
|
+
break;
|
|
283
|
+
const chunk = decoder.decode(value, { stream: true });
|
|
284
|
+
const lines = chunk.split('\n').filter(line => line.trim() !== '');
|
|
285
|
+
for (const line of lines) {
|
|
286
|
+
if (line.startsWith('data: ')) {
|
|
287
|
+
const data = line.slice(6);
|
|
288
|
+
if (data === '[DONE]') {
|
|
289
|
+
if (onEvent) {
|
|
290
|
+
onEvent({ type: 'complete', text: fullText });
|
|
291
|
+
}
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
try {
|
|
295
|
+
const json = JSON.parse(data);
|
|
296
|
+
const delta = json.choices?.[0]?.delta?.content;
|
|
297
|
+
if (delta) {
|
|
298
|
+
fullText += delta;
|
|
299
|
+
if (onEvent) {
|
|
300
|
+
onEvent({ type: 'delta', text: delta });
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
catch (e) {
|
|
305
|
+
// Skip invalid JSON chunks
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
if (onEvent && !fullText) {
|
|
311
|
+
onEvent({ type: 'complete', text: fullText });
|
|
312
|
+
}
|
|
313
|
+
const inputTokens = countTokens(prompt);
|
|
314
|
+
const outputTokens = countTokens(fullText);
|
|
315
|
+
return {
|
|
316
|
+
text: fullText,
|
|
317
|
+
model: model || 'default',
|
|
318
|
+
usage: {
|
|
319
|
+
inputTokens,
|
|
320
|
+
outputTokens,
|
|
321
|
+
},
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
catch (error) {
|
|
325
|
+
if (onEvent) {
|
|
326
|
+
onEvent({
|
|
327
|
+
type: 'error',
|
|
328
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
throw error;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
async embed(_text) {
|
|
335
|
+
// OpenRouter embeddings support TBD - will route to model-specific endpoints
|
|
336
|
+
throw new Error('Embeddings not yet supported via OpenRouter. Use direct provider (Cohere/OpenAI) for embeddings.');
|
|
337
|
+
}
|
|
338
|
+
async countTokens(text, _model) {
|
|
339
|
+
return Promise.resolve(countTokens(text));
|
|
340
|
+
}
|
|
341
|
+
async isAvailable() {
|
|
342
|
+
try {
|
|
343
|
+
// Simple availability check - try a minimal API call
|
|
344
|
+
const response = await fetch(`${this.baseUrl}/models`, {
|
|
345
|
+
method: 'GET',
|
|
346
|
+
headers: {
|
|
347
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
348
|
+
},
|
|
349
|
+
});
|
|
350
|
+
return response.ok;
|
|
351
|
+
}
|
|
352
|
+
catch {
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
handleError(error) {
|
|
357
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
358
|
+
const lowerMessage = errorMessage.toLowerCase();
|
|
359
|
+
// Rate limiting (429)
|
|
360
|
+
if (errorMessage.includes('429') || lowerMessage.includes('rate limit') || lowerMessage.includes('rate_limit')) {
|
|
361
|
+
return {
|
|
362
|
+
type: 'rate_limit',
|
|
363
|
+
retryable: true, // OpenRouter may have retry logic
|
|
364
|
+
message: 'Rate limit exceeded',
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
// Authentication errors (401)
|
|
368
|
+
if (errorMessage.includes('401') || errorMessage.includes('Unauthorized') || lowerMessage.includes('no api key')) {
|
|
369
|
+
return {
|
|
370
|
+
type: 'auth_error',
|
|
371
|
+
retryable: false,
|
|
372
|
+
message: 'Authentication failed - check OPENROUTER_API_KEY',
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
// Quota exceeded
|
|
376
|
+
if (errorMessage.includes('quota') || errorMessage.includes('insufficient_quota') || lowerMessage.includes('insufficient credits')) {
|
|
377
|
+
return {
|
|
378
|
+
type: 'quota_exceeded',
|
|
379
|
+
retryable: false,
|
|
380
|
+
message: 'OpenRouter credits insufficient',
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
// Network errors
|
|
384
|
+
if (errorMessage.includes('network') || errorMessage.includes('timeout') || errorMessage.includes('ECONNREFUSED')) {
|
|
385
|
+
return {
|
|
386
|
+
type: 'network_error',
|
|
387
|
+
retryable: true,
|
|
388
|
+
message: errorMessage,
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
// Default to retryable
|
|
392
|
+
return {
|
|
393
|
+
type: 'unknown',
|
|
394
|
+
retryable: true,
|
|
395
|
+
message: errorMessage,
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
//# sourceMappingURL=openrouter-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openrouter-provider.js","sourceRoot":"","sources":["../../../src/infrastructure/providers/openrouter-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO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;gBAClB,SAAS,EAAE,IAAI,EAAE,kCAAkC;gBACnD,OAAO,EAAE,qBAAqB;aAC/B,CAAC;QACJ,CAAC;QAED,8BAA8B;QAC9B,IAAI,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;YACjH,OAAO;gBACL,IAAI,EAAE,YAAY;gBAClB,SAAS,EAAE,KAAK;gBAChB,OAAO,EAAE,kDAAkD;aAC5D,CAAC;QACJ,CAAC;QAED,iBAAiB;QACjB,IAAI,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,oBAAoB,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,CAAC;YACnI,OAAO;gBACL,IAAI,EAAE,gBAAgB;gBACtB,SAAS,EAAE,KAAK;gBAChB,OAAO,EAAE,iCAAiC;aAC3C,CAAC;QACJ,CAAC;QAED,iBAAiB;QACjB,IAAI,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;YAClH,OAAO;gBACL,IAAI,EAAE,eAAe;gBACrB,SAAS,EAAE,IAAI;gBACf,OAAO,EAAE,YAAY;aACtB,CAAC;QACJ,CAAC;QAED,uBAAuB;QACvB,OAAO;YACL,IAAI,EAAE,SAAS;YACf,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,YAAY;SACtB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider Layer: Operation Provider Resolver
|
|
3
|
+
* Resolves which provider to use for a given operation
|
|
4
|
+
*
|
|
5
|
+
* Phase 4F: Per-Operation Provider Selection
|
|
6
|
+
* Internal-only routing logic (no user-facing config yet)
|
|
7
|
+
*/
|
|
8
|
+
import type { IModelProvider } from './model-provider.interface.js';
|
|
9
|
+
import type { OperationProviderConfig } from './model-config.types.js';
|
|
10
|
+
import { ProviderRegistry } from './provider-registry.js';
|
|
11
|
+
/**
|
|
12
|
+
* Operation types that can have provider-specific routing
|
|
13
|
+
*/
|
|
14
|
+
export type OperationType = 'chat' | 'embedding' | 'rerank';
|
|
15
|
+
/**
|
|
16
|
+
* Operation Provider Resolver
|
|
17
|
+
* Resolves which provider to use for a given operation based on precedence rules
|
|
18
|
+
*
|
|
19
|
+
* Precedence (highest to lowest):
|
|
20
|
+
* 1. CODEHERE_FAKE_AI=1 → FakeProvider always wins
|
|
21
|
+
* 2. Config file:
|
|
22
|
+
* - Operation-level override from config (if present)
|
|
23
|
+
* - Config default provider (if set)
|
|
24
|
+
* 3. Global provider env choice (CODEHERE_AI_PROVIDER)
|
|
25
|
+
* 4. Registry default provider
|
|
26
|
+
*/
|
|
27
|
+
export declare class OperationProviderResolver {
|
|
28
|
+
private operationConfig;
|
|
29
|
+
private configDefault;
|
|
30
|
+
private registry;
|
|
31
|
+
constructor(registry: ProviderRegistry, operationConfig?: OperationProviderConfig | null, configDefaultProvider?: string | null);
|
|
32
|
+
/**
|
|
33
|
+
* Resolve provider for a given operation
|
|
34
|
+
*
|
|
35
|
+
* @param operation - The operation type (chat, embedding, rerank)
|
|
36
|
+
* @returns The IModelProvider to use for this operation
|
|
37
|
+
*/
|
|
38
|
+
resolveProvider(operation: OperationType): IModelProvider;
|
|
39
|
+
/**
|
|
40
|
+
* Set operation-level configuration (for testing or future config file support)
|
|
41
|
+
*/
|
|
42
|
+
setOperationConfig(config: OperationProviderConfig | null): void;
|
|
43
|
+
/**
|
|
44
|
+
* Get current operation configuration
|
|
45
|
+
*/
|
|
46
|
+
getOperationConfig(): OperationProviderConfig | null;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=operation-provider-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-provider-resolver.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/providers/operation-provider-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE5D;;;;;;;;;;;GAWG;AACH,qBAAa,yBAAyB;IACpC,OAAO,CAAC,eAAe,CAAwC;IAC/D,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,QAAQ,CAAmB;gBAGjC,QAAQ,EAAE,gBAAgB,EAC1B,eAAe,CAAC,EAAE,uBAAuB,GAAG,IAAI,EAChD,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI;IAOvC;;;;;OAKG;IACH,eAAe,CAAC,SAAS,EAAE,aAAa,GAAG,cAAc;IAiEzD;;OAEG;IACH,kBAAkB,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI,GAAG,IAAI;IAIhE;;OAEG;IACH,kBAAkB,IAAI,uBAAuB,GAAG,IAAI;CAGrD"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider Layer: Operation Provider Resolver
|
|
3
|
+
* Resolves which provider to use for a given operation
|
|
4
|
+
*
|
|
5
|
+
* Phase 4F: Per-Operation Provider Selection
|
|
6
|
+
* Internal-only routing logic (no user-facing config yet)
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Operation Provider Resolver
|
|
10
|
+
* Resolves which provider to use for a given operation based on precedence rules
|
|
11
|
+
*
|
|
12
|
+
* Precedence (highest to lowest):
|
|
13
|
+
* 1. CODEHERE_FAKE_AI=1 → FakeProvider always wins
|
|
14
|
+
* 2. Config file:
|
|
15
|
+
* - Operation-level override from config (if present)
|
|
16
|
+
* - Config default provider (if set)
|
|
17
|
+
* 3. Global provider env choice (CODEHERE_AI_PROVIDER)
|
|
18
|
+
* 4. Registry default provider
|
|
19
|
+
*/
|
|
20
|
+
export class OperationProviderResolver {
|
|
21
|
+
operationConfig = null;
|
|
22
|
+
configDefault = null;
|
|
23
|
+
registry;
|
|
24
|
+
constructor(registry, operationConfig, configDefaultProvider) {
|
|
25
|
+
this.registry = registry;
|
|
26
|
+
this.operationConfig = operationConfig || null;
|
|
27
|
+
this.configDefault = configDefaultProvider || null;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Resolve provider for a given operation
|
|
31
|
+
*
|
|
32
|
+
* @param operation - The operation type (chat, embedding, rerank)
|
|
33
|
+
* @returns The IModelProvider to use for this operation
|
|
34
|
+
*/
|
|
35
|
+
resolveProvider(operation) {
|
|
36
|
+
// Precedence 1: FakeProvider always wins if CODEHERE_FAKE_AI=1
|
|
37
|
+
if (process.env.CODEHERE_FAKE_AI === '1') {
|
|
38
|
+
const fakeProvider = this.registry.get('fake');
|
|
39
|
+
if (fakeProvider) {
|
|
40
|
+
return fakeProvider;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// Precedence 2: Operation-level override (if configured)
|
|
44
|
+
if (this.operationConfig) {
|
|
45
|
+
let providerId;
|
|
46
|
+
switch (operation) {
|
|
47
|
+
case 'chat':
|
|
48
|
+
providerId = this.operationConfig.chat;
|
|
49
|
+
break;
|
|
50
|
+
case 'embedding':
|
|
51
|
+
providerId = this.operationConfig.embedding;
|
|
52
|
+
break;
|
|
53
|
+
case 'rerank':
|
|
54
|
+
providerId = this.operationConfig.rerank;
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
// If operation-specific provider is set, use it
|
|
58
|
+
if (providerId) {
|
|
59
|
+
const provider = this.registry.get(providerId);
|
|
60
|
+
if (provider) {
|
|
61
|
+
return provider;
|
|
62
|
+
}
|
|
63
|
+
// If operation provider is misconfigured, fall through to next precedence
|
|
64
|
+
console.warn(`[OperationProviderResolver] Provider '${providerId}' not found for operation '${operation}', falling back to default`);
|
|
65
|
+
}
|
|
66
|
+
// Check for default in operation config
|
|
67
|
+
if (this.operationConfig.default) {
|
|
68
|
+
const provider = this.registry.get(this.operationConfig.default);
|
|
69
|
+
if (provider) {
|
|
70
|
+
return provider;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// Precedence 2b: Config default provider (if no operation override)
|
|
75
|
+
if (this.configDefault) {
|
|
76
|
+
const provider = this.registry.get(this.configDefault);
|
|
77
|
+
if (provider) {
|
|
78
|
+
return provider;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// Precedence 3: Global provider env choice (CODEHERE_AI_PROVIDER)
|
|
82
|
+
const requestedProvider = process.env.CODEHERE_AI_PROVIDER?.toLowerCase();
|
|
83
|
+
if (requestedProvider) {
|
|
84
|
+
const provider = this.registry.get(requestedProvider);
|
|
85
|
+
if (provider) {
|
|
86
|
+
return provider;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// Precedence 4: Registry default provider (fallback)
|
|
90
|
+
return this.registry.getDefault();
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Set operation-level configuration (for testing or future config file support)
|
|
94
|
+
*/
|
|
95
|
+
setOperationConfig(config) {
|
|
96
|
+
this.operationConfig = config;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Get current operation configuration
|
|
100
|
+
*/
|
|
101
|
+
getOperationConfig() {
|
|
102
|
+
return this.operationConfig;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=operation-provider-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-provider-resolver.js","sourceRoot":"","sources":["../../../src/infrastructure/providers/operation-provider-resolver.ts"],"names":[],"mappings":"AA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* Loads user-facing provider configuration from JSON files
|
|
4
|
+
*
|
|
5
|
+
* Phase 4G: User-facing provider config files
|
|
6
|
+
*/
|
|
7
|
+
import type { OperationProviderConfig } from './model-config.types.js';
|
|
8
|
+
/**
|
|
9
|
+
* User-facing provider configuration
|
|
10
|
+
* Simple JSON schema for provider selection
|
|
11
|
+
*/
|
|
12
|
+
export interface ProviderConfig {
|
|
13
|
+
/** Default provider ID for all operations */
|
|
14
|
+
default?: string;
|
|
15
|
+
/** Operation-specific provider selection */
|
|
16
|
+
operations?: {
|
|
17
|
+
chat?: string;
|
|
18
|
+
embedding?: string;
|
|
19
|
+
rerank?: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Load provider configuration from file
|
|
24
|
+
*
|
|
25
|
+
* @param options - Optional configuration
|
|
26
|
+
* @param options.cwd - Working directory (defaults to process.cwd())
|
|
27
|
+
* @returns ProviderConfig if file exists and is valid, undefined otherwise
|
|
28
|
+
*/
|
|
29
|
+
export declare function loadProviderConfig(options?: {
|
|
30
|
+
cwd?: string;
|
|
31
|
+
}): ProviderConfig | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Convert ProviderConfig to OperationProviderConfig
|
|
34
|
+
* Used to pass config to OperationProviderResolver
|
|
35
|
+
*/
|
|
36
|
+
export declare function configToOperationConfig(config: ProviderConfig): OperationProviderConfig;
|
|
37
|
+
//# sourceMappingURL=provider-config-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-config-loader.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/providers/provider-config-loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEvE;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,4CAA4C;IAC5C,UAAU,CAAC,EAAE;QACX,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,cAAc,GAAG,SAAS,CAuCzF;AAoDD;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,cAAc,GAAG,uBAAuB,CAsBvF"}
|