codehere 0.3.0 → 0.5.0-alpha
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/LICENSE +1 -1
- package/README.md +329 -65
- 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 +4 -0
- package/dist/application/agents/multi-agent-orchestrator.d.ts.map +1 -1
- package/dist/application/agents/multi-agent-orchestrator.js +95 -2
- 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 +151 -71
- 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/reasoning/multi-model-planning-strategy.d.ts +21 -0
- package/dist/application/reasoning/multi-model-planning-strategy.d.ts.map +1 -0
- package/dist/application/reasoning/multi-model-planning-strategy.js +158 -0
- package/dist/application/reasoning/multi-model-planning-strategy.js.map +1 -0
- package/dist/application/reasoning/reasoning-config.d.ts +15 -0
- package/dist/application/reasoning/reasoning-config.d.ts.map +1 -0
- package/dist/application/reasoning/reasoning-config.js +50 -0
- package/dist/application/reasoning/reasoning-config.js.map +1 -0
- package/dist/application/reasoning/reasoning-orchestrator.d.ts +18 -0
- package/dist/application/reasoning/reasoning-orchestrator.d.ts.map +1 -0
- package/dist/application/reasoning/reasoning-orchestrator.js +170 -0
- package/dist/application/reasoning/reasoning-orchestrator.js.map +1 -0
- package/dist/application/reasoning/reasoning-strategy.interface.d.ts +24 -0
- package/dist/application/reasoning/reasoning-strategy.interface.d.ts.map +1 -0
- package/dist/application/reasoning/reasoning-strategy.interface.js +6 -0
- package/dist/application/reasoning/reasoning-strategy.interface.js.map +1 -0
- package/dist/application/reasoning/role-provider-resolver.d.ts +36 -0
- package/dist/application/reasoning/role-provider-resolver.d.ts.map +1 -0
- package/dist/application/reasoning/role-provider-resolver.js +74 -0
- package/dist/application/reasoning/role-provider-resolver.js.map +1 -0
- package/dist/application/reasoning/simple-planning-strategy.d.ts +22 -0
- package/dist/application/reasoning/simple-planning-strategy.d.ts.map +1 -0
- package/dist/application/reasoning/simple-planning-strategy.js +217 -0
- package/dist/application/reasoning/simple-planning-strategy.js.map +1 -0
- package/dist/application/reasoning/types.d.ts +65 -0
- package/dist/application/reasoning/types.d.ts.map +1 -0
- package/dist/application/reasoning/types.js +6 -0
- package/dist/application/reasoning/types.js.map +1 -0
- package/dist/application/reasoning/validator-strategy.d.ts +56 -0
- package/dist/application/reasoning/validator-strategy.d.ts.map +1 -0
- package/dist/application/reasoning/validator-strategy.js +103 -0
- package/dist/application/reasoning/validator-strategy.js.map +1 -0
- 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 +198 -8
- package/dist/application/services/dependency-container.js.map +1 -1
- package/dist/application/services/intelligent-router.d.ts +19 -0
- package/dist/application/services/intelligent-router.d.ts.map +1 -1
- package/dist/application/services/intelligent-router.js +393 -91
- package/dist/application/services/intelligent-router.js.map +1 -1
- package/dist/application/use-cases/ask-question-use-case.d.ts +20 -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 +129 -49
- 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/application/use-cases/planning-use-case.d.ts +14 -1
- package/dist/application/use-cases/planning-use-case.d.ts.map +1 -1
- package/dist/application/use-cases/planning-use-case.js +109 -2
- package/dist/application/use-cases/planning-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/memory.d.ts.map +1 -1
- 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/query-intent-classifier.d.ts.map +1 -1
- package/dist/domain/services/query-intent-classifier.js +20 -1
- package/dist/domain/services/query-intent-classifier.js.map +1 -1
- 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 +494 -167
- 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 +19 -6
- 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.d.ts +10 -0
- package/dist/infrastructure/config/config-manager.d.ts.map +1 -1
- package/dist/infrastructure/config/config-manager.js +13 -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 +129 -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/protocols/a2a-metadata.js +1 -1
- package/dist/infrastructure/protocols/mcp-oauth.js +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 +401 -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 +131 -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/security/input-validator.d.ts.map +1 -1
- package/dist/infrastructure/security/input-validator.js +19 -6
- package/dist/infrastructure/security/input-validator.js.map +1 -1
- 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 +68 -0
- package/dist/infrastructure/storage/task-repository.d.ts.map +1 -0
- package/dist/infrastructure/storage/task-repository.js +216 -0
- package/dist/infrastructure/storage/task-repository.js.map +1 -0
- package/dist/infrastructure/telemetry/telemetry-service.d.ts +74 -0
- package/dist/infrastructure/telemetry/telemetry-service.d.ts.map +1 -0
- package/dist/infrastructure/telemetry/telemetry-service.js +167 -0
- package/dist/infrastructure/telemetry/telemetry-service.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 +5 -6
- package/dist/infrastructure/ux/progress-indicator.d.ts.map +1 -1
- package/dist/infrastructure/ux/progress-indicator.js +36 -41
- 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 +2 -0
- package/dist/presentation/cli/commands/ask-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/ask-command.js +356 -87
- 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 +22 -8
- package/dist/presentation/cli/commands/config-command.js.map +1 -1
- package/dist/presentation/cli/commands/decision-command.js +23 -6
- package/dist/presentation/cli/commands/decision-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 +94 -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 +23 -1
- package/dist/presentation/cli/commands/help-command.js.map +1 -1
- package/dist/presentation/cli/commands/memory-command.d.ts +17 -0
- package/dist/presentation/cli/commands/memory-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/memory-command.js +252 -0
- package/dist/presentation/cli/commands/memory-command.js.map +1 -0
- 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 +2 -0
- package/dist/presentation/cli/commands/orchestrate-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/orchestrate-command.js +182 -14
- package/dist/presentation/cli/commands/orchestrate-command.js.map +1 -1
- package/dist/presentation/cli/commands/plan-command.d.ts +2 -0
- package/dist/presentation/cli/commands/plan-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/plan-command.js +212 -26
- 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 +8 -2
- 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 +173 -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 +165 -11
- 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 +171 -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 +118 -17
- 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.d.ts +1 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +69 -4
- package/dist/session.js.map +1 -1
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +3 -0
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/git-tool.js +7 -7
- package/dist/tools/git-tool.js.map +1 -1
- package/dist/ui.d.ts +11 -0
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +62 -6
- package/dist/ui.js.map +1 -1
- package/package.json +22 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cohere-provider.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/providers/cohere-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,SAAS,EACT,WAAW,EACX,YAAY,EACZ,WAAW,EACX,cAAc,EAEf,MAAM,+BAA+B,CAAC;AAmCvC;;;GAGG;AACH,qBAAa,cAAe,YAAW,cAAc;IACnD,QAAQ,CAAC,EAAE,YAAY;IACvB,QAAQ,CAAC,IAAI,YAAY;IAEzB,QAAQ,CAAC,YAAY,EAAE,oBAAoB,CAOzC;IAEF,OAAO,CAAC,MAAM,CAAe;gBAEjB,MAAM,CAAC,EAAE,MAAM;IAQrB,SAAS,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAiGvC,eAAe,IAAI,MAAM;IAUnB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IAoClE,UAAU,CACd,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,WAAW,EACrB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,GACrC,OAAO,CAAC,YAAY,CAAC;IAwElB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC;IA6B9D,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAmC5C,MAAM,CACV,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EAAE,EACnB,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAC1C,OAAO,CAAC,cAAc,CAAC;IA2CpB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAM3D,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAoBrC,WAAW,CAAC,CAAC,KAAK,EAAE,OAAO,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;CAmEpF"}
|
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider Layer: CohereProvider
|
|
3
|
+
* Thin wrapper implementing IModelProvider for Cohere API
|
|
4
|
+
*
|
|
5
|
+
* Phase 4A: Foundation Implementation (No Behavior Change)
|
|
6
|
+
*
|
|
7
|
+
* TODO: In Phase 4B, integrate with CohereAIService context compression and prompt building.
|
|
8
|
+
* For now, this is a minimal wrapper that preserves existing Cohere behavior.
|
|
9
|
+
*/
|
|
10
|
+
import { CohereClient } from 'cohere-ai';
|
|
11
|
+
import { config } from 'dotenv';
|
|
12
|
+
import { join, dirname } from 'path';
|
|
13
|
+
import { fileURLToPath } from 'url';
|
|
14
|
+
import { encoding_for_model } from 'tiktoken';
|
|
15
|
+
import { retryWithBackoff, cohereCircuitBreaker } from '../../error-handler.js';
|
|
16
|
+
// Load .env (same pattern as CohereAIService)
|
|
17
|
+
try {
|
|
18
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
19
|
+
const __dirname = dirname(__filename);
|
|
20
|
+
const agentDir = join(__dirname, '../../../..');
|
|
21
|
+
config({ path: join(agentDir, '.env') });
|
|
22
|
+
}
|
|
23
|
+
catch { }
|
|
24
|
+
config();
|
|
25
|
+
// Token counting (same as CohereAIService for consistency)
|
|
26
|
+
let tokenEncoder = null;
|
|
27
|
+
function getTokenEncoder() {
|
|
28
|
+
if (!tokenEncoder) {
|
|
29
|
+
try {
|
|
30
|
+
tokenEncoder = encoding_for_model('gpt-3.5-turbo');
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
tokenEncoder = encoding_for_model('gpt-4');
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return tokenEncoder;
|
|
37
|
+
}
|
|
38
|
+
function countTokens(text) {
|
|
39
|
+
try {
|
|
40
|
+
const encoder = getTokenEncoder();
|
|
41
|
+
return encoder.encode(text).length;
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
console.warn('Warning: tiktoken failed, using character-based estimate (less accurate)');
|
|
45
|
+
return Math.ceil(text.length / 4);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Cohere Provider
|
|
50
|
+
* Minimal wrapper around CohereClient implementing IModelProvider
|
|
51
|
+
*/
|
|
52
|
+
export class CohereProvider {
|
|
53
|
+
id = 'cohere';
|
|
54
|
+
name = 'Cohere';
|
|
55
|
+
capabilities = {
|
|
56
|
+
chat: true,
|
|
57
|
+
streaming: true,
|
|
58
|
+
embedding: true,
|
|
59
|
+
embeddingQuery: true, // Cohere supports separate query embeddings
|
|
60
|
+
rerank: true,
|
|
61
|
+
toolCalling: true, // Cohere supports tool calling
|
|
62
|
+
};
|
|
63
|
+
client;
|
|
64
|
+
constructor(apiKey) {
|
|
65
|
+
const key = apiKey || process.env.COHERE_API_KEY;
|
|
66
|
+
if (!key) {
|
|
67
|
+
throw new Error('COHERE_API_KEY not found in environment');
|
|
68
|
+
}
|
|
69
|
+
this.client = new CohereClient({ token: key });
|
|
70
|
+
}
|
|
71
|
+
async getModels() {
|
|
72
|
+
// TODO: In Phase 4B, fetch available models from Cohere API if possible
|
|
73
|
+
// For now, return known Cohere models (updated Sept 2025 - removed deprecated models)
|
|
74
|
+
return [
|
|
75
|
+
{
|
|
76
|
+
id: 'command-r-08-2024',
|
|
77
|
+
name: 'Command R (08-2024)',
|
|
78
|
+
providerId: 'cohere',
|
|
79
|
+
providerModelId: 'command-r-08-2024',
|
|
80
|
+
contextWindow: 128000,
|
|
81
|
+
capabilities: {
|
|
82
|
+
chat: true,
|
|
83
|
+
streaming: true,
|
|
84
|
+
embedding: false,
|
|
85
|
+
embeddingQuery: false,
|
|
86
|
+
rerank: false,
|
|
87
|
+
toolCalling: true,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: 'command-r-plus-08-2024',
|
|
92
|
+
name: 'Command R+ (08-2024)',
|
|
93
|
+
providerId: 'cohere',
|
|
94
|
+
providerModelId: 'command-r-plus-08-2024',
|
|
95
|
+
contextWindow: 128000,
|
|
96
|
+
capabilities: {
|
|
97
|
+
chat: true,
|
|
98
|
+
streaming: true,
|
|
99
|
+
embedding: false,
|
|
100
|
+
embeddingQuery: false,
|
|
101
|
+
rerank: false,
|
|
102
|
+
toolCalling: true,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: 'command-a-03-2025',
|
|
107
|
+
name: 'Command A (03-2025)',
|
|
108
|
+
providerId: 'cohere',
|
|
109
|
+
providerModelId: 'command-a-03-2025',
|
|
110
|
+
contextWindow: 256000,
|
|
111
|
+
capabilities: {
|
|
112
|
+
chat: true,
|
|
113
|
+
streaming: true,
|
|
114
|
+
embedding: false,
|
|
115
|
+
embeddingQuery: false,
|
|
116
|
+
rerank: false,
|
|
117
|
+
toolCalling: true,
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: 'command-r7b-12-2024',
|
|
122
|
+
name: 'Command R7B (12-2024)',
|
|
123
|
+
providerId: 'cohere',
|
|
124
|
+
providerModelId: 'command-r7b-12-2024',
|
|
125
|
+
contextWindow: 128000,
|
|
126
|
+
capabilities: {
|
|
127
|
+
chat: true,
|
|
128
|
+
streaming: true,
|
|
129
|
+
embedding: false,
|
|
130
|
+
embeddingQuery: false,
|
|
131
|
+
rerank: false,
|
|
132
|
+
toolCalling: true,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: 'embed-english-v3',
|
|
137
|
+
name: 'Embed English v3.0',
|
|
138
|
+
providerId: 'cohere',
|
|
139
|
+
providerModelId: 'embed-english-v3.0',
|
|
140
|
+
contextWindow: 512,
|
|
141
|
+
capabilities: {
|
|
142
|
+
chat: false,
|
|
143
|
+
streaming: false,
|
|
144
|
+
embedding: true,
|
|
145
|
+
embeddingQuery: true,
|
|
146
|
+
rerank: false,
|
|
147
|
+
toolCalling: false,
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
id: 'rerank-english-v3',
|
|
152
|
+
name: 'Rerank English v3.0',
|
|
153
|
+
providerId: 'cohere',
|
|
154
|
+
providerModelId: 'rerank-english-v3.0',
|
|
155
|
+
contextWindow: 4096,
|
|
156
|
+
capabilities: {
|
|
157
|
+
chat: false,
|
|
158
|
+
streaming: false,
|
|
159
|
+
embedding: false,
|
|
160
|
+
embeddingQuery: false,
|
|
161
|
+
rerank: true,
|
|
162
|
+
toolCalling: false,
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
];
|
|
166
|
+
}
|
|
167
|
+
getDefaultModel() {
|
|
168
|
+
// Check for environment variable override
|
|
169
|
+
if (process.env.CODEHERE_COHERE_MODEL) {
|
|
170
|
+
return process.env.CODEHERE_COHERE_MODEL;
|
|
171
|
+
}
|
|
172
|
+
// Use command-r-08-2024 as default (command-r and command-r-plus were deprecated Sept 2025)
|
|
173
|
+
// Available live models: command-r-08-2024, command-r-plus-08-2024, command-a-03-2025, command-r7b-12-2024
|
|
174
|
+
return 'command-r-08-2024';
|
|
175
|
+
}
|
|
176
|
+
async chat(prompt, options) {
|
|
177
|
+
const model = options?.model || this.getDefaultModel();
|
|
178
|
+
return await retryWithBackoff(async () => {
|
|
179
|
+
return await cohereCircuitBreaker.execute(async () => {
|
|
180
|
+
const response = await this.client.chat({
|
|
181
|
+
message: prompt,
|
|
182
|
+
...(model ? { model } : {}),
|
|
183
|
+
temperature: options?.temperature ?? 0.7,
|
|
184
|
+
...(options?.maxTokens ? { maxTokens: options.maxTokens } : {}),
|
|
185
|
+
});
|
|
186
|
+
const text = response.text || 'No response generated';
|
|
187
|
+
const inputTokens = countTokens(prompt);
|
|
188
|
+
const outputTokens = countTokens(text);
|
|
189
|
+
return {
|
|
190
|
+
text,
|
|
191
|
+
model: model || 'default',
|
|
192
|
+
usage: {
|
|
193
|
+
inputTokens,
|
|
194
|
+
outputTokens,
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
});
|
|
198
|
+
}, {
|
|
199
|
+
maxRetries: 5,
|
|
200
|
+
baseDelay: 2000,
|
|
201
|
+
maxDelay: 60000,
|
|
202
|
+
operationName: 'cohere-provider-chat',
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
async chatStream(prompt, options, onEvent) {
|
|
206
|
+
const model = options?.model || this.getDefaultModel();
|
|
207
|
+
let fullText = '';
|
|
208
|
+
try {
|
|
209
|
+
if (onEvent) {
|
|
210
|
+
onEvent({ type: 'start' });
|
|
211
|
+
}
|
|
212
|
+
// Check if Cohere SDK supports streaming
|
|
213
|
+
if (typeof this.client.chatStream === 'function') {
|
|
214
|
+
const stream = await this.client.chatStream({
|
|
215
|
+
message: prompt,
|
|
216
|
+
...(model ? { model } : {}),
|
|
217
|
+
temperature: options?.temperature ?? 0.7,
|
|
218
|
+
});
|
|
219
|
+
for await (const event of stream) {
|
|
220
|
+
if (event.eventType === 'text-generation' || event.type === 'text') {
|
|
221
|
+
const token = event.text || event.delta || '';
|
|
222
|
+
if (token) {
|
|
223
|
+
fullText += token;
|
|
224
|
+
if (onEvent) {
|
|
225
|
+
onEvent({ type: 'delta', text: token });
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
// Fallback: Use regular chat
|
|
233
|
+
const response = await this.chat(prompt, options);
|
|
234
|
+
fullText = response.text;
|
|
235
|
+
// Simulate streaming by sending chunks
|
|
236
|
+
if (onEvent && fullText.length > 0) {
|
|
237
|
+
const chunkSize = 10;
|
|
238
|
+
for (let i = 0; i < fullText.length; i += chunkSize) {
|
|
239
|
+
const chunk = fullText.substring(i, i + chunkSize);
|
|
240
|
+
onEvent({ type: 'delta', text: chunk });
|
|
241
|
+
if (fullText.length > chunkSize * 2) {
|
|
242
|
+
await new Promise(resolve => setTimeout(resolve, 50));
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
if (onEvent) {
|
|
248
|
+
onEvent({ type: 'complete' });
|
|
249
|
+
}
|
|
250
|
+
const inputTokens = countTokens(prompt);
|
|
251
|
+
const outputTokens = countTokens(fullText);
|
|
252
|
+
return {
|
|
253
|
+
text: fullText,
|
|
254
|
+
model: model || 'default',
|
|
255
|
+
usage: {
|
|
256
|
+
inputTokens,
|
|
257
|
+
outputTokens,
|
|
258
|
+
},
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
catch (error) {
|
|
262
|
+
if (onEvent) {
|
|
263
|
+
onEvent({
|
|
264
|
+
type: 'error',
|
|
265
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
throw error;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
async embed(text) {
|
|
272
|
+
const texts = Array.isArray(text) ? text : [text];
|
|
273
|
+
return await retryWithBackoff(async () => {
|
|
274
|
+
return await cohereCircuitBreaker.execute(async () => {
|
|
275
|
+
const response = await this.client.embed({
|
|
276
|
+
texts,
|
|
277
|
+
model: 'embed-english-v3.0',
|
|
278
|
+
inputType: 'search_document',
|
|
279
|
+
});
|
|
280
|
+
const embeddings = response.embeddings;
|
|
281
|
+
if (texts.length === 1) {
|
|
282
|
+
return embeddings[0];
|
|
283
|
+
}
|
|
284
|
+
return embeddings;
|
|
285
|
+
});
|
|
286
|
+
}, {
|
|
287
|
+
maxRetries: 5,
|
|
288
|
+
baseDelay: 2000,
|
|
289
|
+
maxDelay: 60000,
|
|
290
|
+
operationName: 'cohere-provider-embed',
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
async embedQuery(query) {
|
|
294
|
+
return await retryWithBackoff(async () => {
|
|
295
|
+
return await cohereCircuitBreaker.execute(async () => {
|
|
296
|
+
const response = await this.client.embed({
|
|
297
|
+
texts: [query],
|
|
298
|
+
model: 'embed-english-v3.0',
|
|
299
|
+
inputType: 'search_query',
|
|
300
|
+
});
|
|
301
|
+
const embeddings = response.embeddings;
|
|
302
|
+
if (Array.isArray(embeddings)) {
|
|
303
|
+
if (embeddings.length === 0) {
|
|
304
|
+
throw new Error('No embedding returned for query');
|
|
305
|
+
}
|
|
306
|
+
return embeddings[0] || [];
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
const embeddingsArray = embeddings.float || [];
|
|
310
|
+
if (embeddingsArray.length === 0) {
|
|
311
|
+
throw new Error('No embedding returned for query');
|
|
312
|
+
}
|
|
313
|
+
return embeddingsArray[0] || [];
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
}, {
|
|
317
|
+
maxRetries: 5,
|
|
318
|
+
baseDelay: 2000,
|
|
319
|
+
maxDelay: 60000,
|
|
320
|
+
operationName: 'cohere-provider-embed-query',
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
async rerank(query, documents, options) {
|
|
324
|
+
if (documents.length === 0) {
|
|
325
|
+
return {
|
|
326
|
+
results: [],
|
|
327
|
+
model: 'rerank-english-v3.0',
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
// Cohere Rerank API has limits, so we cap at 100 documents
|
|
331
|
+
const documentsToRerank = documents.slice(0, 100);
|
|
332
|
+
const topN = Math.min(options?.topN ?? 10, documentsToRerank.length);
|
|
333
|
+
const model = options?.model || 'rerank-english-v3.0';
|
|
334
|
+
return await retryWithBackoff(async () => {
|
|
335
|
+
return await cohereCircuitBreaker.execute(async () => {
|
|
336
|
+
const response = await this.client.rerank({
|
|
337
|
+
model,
|
|
338
|
+
query,
|
|
339
|
+
documents: documentsToRerank,
|
|
340
|
+
topN,
|
|
341
|
+
});
|
|
342
|
+
const results = (response.results || []).map((result) => ({
|
|
343
|
+
index: result.index,
|
|
344
|
+
relevanceScore: result.relevanceScore || 0,
|
|
345
|
+
}));
|
|
346
|
+
return {
|
|
347
|
+
results,
|
|
348
|
+
model,
|
|
349
|
+
};
|
|
350
|
+
});
|
|
351
|
+
}, {
|
|
352
|
+
maxRetries: 3,
|
|
353
|
+
baseDelay: 2000,
|
|
354
|
+
maxDelay: 30000,
|
|
355
|
+
operationName: 'cohere-provider-rerank',
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
async countTokens(text, _model) {
|
|
359
|
+
// TODO: In Phase 4B, use Cohere-specific tokenizer if available
|
|
360
|
+
// For now, use same tiktoken approach as CohereAIService
|
|
361
|
+
return Promise.resolve(countTokens(text));
|
|
362
|
+
}
|
|
363
|
+
async isAvailable() {
|
|
364
|
+
try {
|
|
365
|
+
// Actually test API connectivity with a minimal API call
|
|
366
|
+
// getModels() doesn't make an API call, so we need to test with a real endpoint
|
|
367
|
+
const response = await this.client.chat({
|
|
368
|
+
message: 'test',
|
|
369
|
+
model: 'command-r-08-2024',
|
|
370
|
+
maxTokens: 1,
|
|
371
|
+
});
|
|
372
|
+
return true;
|
|
373
|
+
}
|
|
374
|
+
catch (error) {
|
|
375
|
+
// Check if it's an auth error (401) - means API is reachable but key is invalid
|
|
376
|
+
if (error?.statusCode === 401 || error?.status === 401) {
|
|
377
|
+
return false; // Invalid key
|
|
378
|
+
}
|
|
379
|
+
// Other errors might be network issues, but we'll be conservative
|
|
380
|
+
return false;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
handleError(error) {
|
|
384
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
385
|
+
const lowerMessage = errorMessage.toLowerCase();
|
|
386
|
+
if (error && typeof error === 'object') {
|
|
387
|
+
const err = error;
|
|
388
|
+
// Check for rate limiting (429) - check both statusCode/status and message
|
|
389
|
+
if (err.statusCode === 429 || err.status === 429 ||
|
|
390
|
+
lowerMessage.includes('429') ||
|
|
391
|
+
lowerMessage.includes('rate limit') ||
|
|
392
|
+
lowerMessage.includes('rate_limit')) {
|
|
393
|
+
return {
|
|
394
|
+
type: 'rate_limit',
|
|
395
|
+
retryable: false,
|
|
396
|
+
message: 'Rate limit exceeded',
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
// Check for authentication errors (401) - check both statusCode/status and message
|
|
400
|
+
if (err.statusCode === 401 || err.status === 401 ||
|
|
401
|
+
lowerMessage.includes('401') ||
|
|
402
|
+
lowerMessage.includes('unauthorized') ||
|
|
403
|
+
lowerMessage.includes('invalid api token') ||
|
|
404
|
+
lowerMessage.includes('invalid api key')) {
|
|
405
|
+
return {
|
|
406
|
+
type: 'auth_error',
|
|
407
|
+
retryable: false,
|
|
408
|
+
message: 'Authentication failed - check API key',
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
// Check for trial key quota
|
|
412
|
+
if (lowerMessage.includes('trial key') && lowerMessage.includes('1000 api calls')) {
|
|
413
|
+
return {
|
|
414
|
+
type: 'quota_exceeded',
|
|
415
|
+
retryable: false,
|
|
416
|
+
message: 'Trial API key has reached monthly limit (1000 calls/month)',
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
// Check for quota exceeded
|
|
420
|
+
if (lowerMessage.includes('quota') || lowerMessage.includes('insufficient_quota')) {
|
|
421
|
+
return {
|
|
422
|
+
type: 'quota_exceeded',
|
|
423
|
+
retryable: false,
|
|
424
|
+
message: 'API quota exceeded',
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
// Network errors
|
|
429
|
+
if (lowerMessage.includes('network') || lowerMessage.includes('timeout') || lowerMessage.includes('econnrefused')) {
|
|
430
|
+
return {
|
|
431
|
+
type: 'network_error',
|
|
432
|
+
retryable: true,
|
|
433
|
+
message: errorMessage,
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
// Default to retryable error
|
|
437
|
+
return {
|
|
438
|
+
type: 'unknown',
|
|
439
|
+
retryable: true,
|
|
440
|
+
message: errorMessage,
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
//# sourceMappingURL=cohere-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cohere-provider.js","sourceRoot":"","sources":["../../../src/infrastructure/providers/cohere-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,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,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAW9C,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEhF,8CAA8C;AAC9C,IAAI,CAAC;IACH,MAAM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AAQ,CAAC,WAAW,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;gBAClF,OAAO;oBACL,IAAI,EAAE,gBAAgB;oBACtB,SAAS,EAAE,KAAK;oBAChB,OAAO,EAAE,4DAA4D;iBACtE,CAAC;YACJ,CAAC;YAED,2BAA2B;YAC3B,IAAI,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAAC;gBAClF,OAAO;oBACL,IAAI,EAAE,gBAAgB;oBACtB,SAAS,EAAE,KAAK;oBAChB,OAAO,EAAE,oBAAoB;iBAC9B,CAAC;YACJ,CAAC;QACH,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,6BAA6B;QAC7B,OAAO;YACL,IAAI,EAAE,SAAS;YACf,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,YAAY;SACtB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider Layer: FakeProvider
|
|
3
|
+
* Deterministic test provider implementing IModelProvider
|
|
4
|
+
*
|
|
5
|
+
* Phase 4D: FakeProvider Implementation
|
|
6
|
+
* Provides deterministic outputs for testing and local demos without external API calls
|
|
7
|
+
*/
|
|
8
|
+
import type { IModelProvider, ProviderCapabilities, ModelInfo, ChatOptions, ChatResponse, StreamEvent, RerankResponse } from './model-provider.interface.js';
|
|
9
|
+
/**
|
|
10
|
+
* FakeProvider
|
|
11
|
+
* Deterministic provider for testing and demos
|
|
12
|
+
*
|
|
13
|
+
* Behavior:
|
|
14
|
+
* - Chat: Returns deterministic responses based on query
|
|
15
|
+
* - Streaming: Simulates streaming by sending words incrementally
|
|
16
|
+
* - Embeddings: Returns fixed-size zero vectors (768 dimensions)
|
|
17
|
+
* - Rerank: Returns documents in original order with fake scores
|
|
18
|
+
* - No external HTTP calls
|
|
19
|
+
*/
|
|
20
|
+
export declare class FakeProvider implements IModelProvider {
|
|
21
|
+
readonly id = "fake";
|
|
22
|
+
readonly name = "Fake Provider";
|
|
23
|
+
readonly capabilities: ProviderCapabilities;
|
|
24
|
+
private defaultModel;
|
|
25
|
+
getModels(): Promise<ModelInfo[]>;
|
|
26
|
+
getDefaultModel(): string;
|
|
27
|
+
chat(prompt: string, options?: ChatOptions): Promise<ChatResponse>;
|
|
28
|
+
chatStream(prompt: string, options?: ChatOptions, onEvent?: (event: StreamEvent) => void): Promise<ChatResponse>;
|
|
29
|
+
embed(text: string | string[]): Promise<number[] | number[][]>;
|
|
30
|
+
embedQuery(query: string): Promise<number[]>;
|
|
31
|
+
rerank(query: string, documents: string[], options?: {
|
|
32
|
+
topN?: number;
|
|
33
|
+
model?: string;
|
|
34
|
+
}): Promise<RerankResponse>;
|
|
35
|
+
countTokens(text: string, _model?: string): Promise<number>;
|
|
36
|
+
isAvailable(): Promise<boolean>;
|
|
37
|
+
handleError?(error: unknown): {
|
|
38
|
+
type: string;
|
|
39
|
+
retryable: boolean;
|
|
40
|
+
message: string;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=fake-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fake-provider.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/providers/fake-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,SAAS,EACT,WAAW,EACX,YAAY,EACZ,WAAW,EACX,cAAc,EAEf,MAAM,+BAA+B,CA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 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider Layer: FakeProvider
|
|
3
|
+
* Deterministic test provider implementing IModelProvider
|
|
4
|
+
*
|
|
5
|
+
* Phase 4D: FakeProvider Implementation
|
|
6
|
+
* Provides deterministic outputs for testing and local demos without external API calls
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* FakeProvider
|
|
10
|
+
* Deterministic provider for testing and demos
|
|
11
|
+
*
|
|
12
|
+
* Behavior:
|
|
13
|
+
* - Chat: Returns deterministic responses based on query
|
|
14
|
+
* - Streaming: Simulates streaming by sending words incrementally
|
|
15
|
+
* - Embeddings: Returns fixed-size zero vectors (768 dimensions)
|
|
16
|
+
* - Rerank: Returns documents in original order with fake scores
|
|
17
|
+
* - No external HTTP calls
|
|
18
|
+
*/
|
|
19
|
+
export class FakeProvider {
|
|
20
|
+
id = 'fake';
|
|
21
|
+
name = 'Fake Provider';
|
|
22
|
+
capabilities = {
|
|
23
|
+
chat: true,
|
|
24
|
+
streaming: true,
|
|
25
|
+
embedding: true,
|
|
26
|
+
embeddingQuery: true,
|
|
27
|
+
rerank: true,
|
|
28
|
+
toolCalling: false,
|
|
29
|
+
};
|
|
30
|
+
defaultModel = 'fake-model-v1';
|
|
31
|
+
async getModels() {
|
|
32
|
+
return [
|
|
33
|
+
{
|
|
34
|
+
id: 'fake-model-v1',
|
|
35
|
+
name: 'Fake Model v1',
|
|
36
|
+
providerId: this.id,
|
|
37
|
+
providerModelId: 'fake-model-v1',
|
|
38
|
+
contextWindow: 4096,
|
|
39
|
+
capabilities: { ...this.capabilities },
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
getDefaultModel() {
|
|
44
|
+
return this.defaultModel;
|
|
45
|
+
}
|
|
46
|
+
async chat(prompt, options) {
|
|
47
|
+
// Deterministic response based on prompt
|
|
48
|
+
// Truncate prompt to first 80 chars for consistency with FakeAIService
|
|
49
|
+
const promptPreview = prompt.length > 80 ? prompt.substring(0, 80) + '...' : prompt;
|
|
50
|
+
const text = `FAKE_RESPONSE: ${promptPreview}`;
|
|
51
|
+
// Simple token counting (character-based estimate)
|
|
52
|
+
const inputTokens = Math.ceil(prompt.length / 4);
|
|
53
|
+
const outputTokens = Math.ceil(text.length / 4);
|
|
54
|
+
return {
|
|
55
|
+
text,
|
|
56
|
+
model: options?.model || this.defaultModel,
|
|
57
|
+
usage: {
|
|
58
|
+
inputTokens,
|
|
59
|
+
outputTokens,
|
|
60
|
+
},
|
|
61
|
+
finishReason: 'stop',
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
async chatStream(prompt, options, onEvent) {
|
|
65
|
+
// Get the full response first
|
|
66
|
+
const response = await this.chat(prompt, options);
|
|
67
|
+
if (onEvent) {
|
|
68
|
+
onEvent({ type: 'start' });
|
|
69
|
+
// Simulate streaming by sending words incrementally
|
|
70
|
+
const words = response.text.split(' ');
|
|
71
|
+
for (let i = 0; i < words.length; i++) {
|
|
72
|
+
const word = words[i];
|
|
73
|
+
const isLast = i === words.length - 1;
|
|
74
|
+
const delta = isLast ? word : word + ' ';
|
|
75
|
+
// Small delay to simulate streaming
|
|
76
|
+
await new Promise(resolve => setTimeout(resolve, 10));
|
|
77
|
+
onEvent({ type: 'delta', text: delta });
|
|
78
|
+
}
|
|
79
|
+
onEvent({ type: 'complete', text: response.text });
|
|
80
|
+
}
|
|
81
|
+
return response;
|
|
82
|
+
}
|
|
83
|
+
async embed(text) {
|
|
84
|
+
// Return deterministic fake embeddings (all zeros, 768 dimensions)
|
|
85
|
+
// Matches FakeAIService behavior
|
|
86
|
+
const embeddingSize = 768;
|
|
87
|
+
if (Array.isArray(text)) {
|
|
88
|
+
return text.map(() => new Array(embeddingSize).fill(0));
|
|
89
|
+
}
|
|
90
|
+
return new Array(embeddingSize).fill(0);
|
|
91
|
+
}
|
|
92
|
+
async embedQuery(query) {
|
|
93
|
+
// Return deterministic fake query embedding (768 dimensions)
|
|
94
|
+
// Matches FakeAIService behavior
|
|
95
|
+
return new Array(768).fill(0);
|
|
96
|
+
}
|
|
97
|
+
async rerank(query, documents, options) {
|
|
98
|
+
// Return documents in original order with fake decreasing scores
|
|
99
|
+
// Matches FakeAIService behavior: 0.9, 0.8, 0.7, ...
|
|
100
|
+
const topN = Math.min(options?.topN || 10, documents.length);
|
|
101
|
+
const results = Array.from({ length: topN }, (_, i) => ({
|
|
102
|
+
index: i,
|
|
103
|
+
relevanceScore: 0.9 - (i * 0.1),
|
|
104
|
+
text: documents[i],
|
|
105
|
+
}));
|
|
106
|
+
return {
|
|
107
|
+
results,
|
|
108
|
+
model: options?.model || this.defaultModel,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
async countTokens(text, _model) {
|
|
112
|
+
// Simple character-based token estimation (4 chars per token)
|
|
113
|
+
// Matches behavior used in other providers
|
|
114
|
+
return Math.ceil(text.length / 4);
|
|
115
|
+
}
|
|
116
|
+
async isAvailable() {
|
|
117
|
+
// Fake provider is always available (no external dependencies)
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
handleError(error) {
|
|
121
|
+
// Fake provider shouldn't have errors, but handle gracefully
|
|
122
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
123
|
+
return {
|
|
124
|
+
type: 'unknown',
|
|
125
|
+
retryable: false,
|
|
126
|
+
message: `FakeProvider error: ${errorMessage}`,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=fake-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fake-provider.js","sourceRoot":"","sources":["../../../src/infrastructure/providers/fake-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH;;;;;;;;;;GAUG;AACH,MAAM,OAAO,YAAY;IACd,EAAE,GAAG,MAAM,CAAC;IACZ,IAAI,GAAG,eAAe,CAAC;IAEvB,YAAY,GAAyB;QAC5C,IAAI,EAAE,IAAI;QACV,SAAS,EAAE,IAAI;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