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,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple Planning Strategy
|
|
3
|
+
* Wraps current planning behavior into structured reasoning trace
|
|
4
|
+
* Behaviorally equivalent to current PlanningUseCase, but structured
|
|
5
|
+
*/
|
|
6
|
+
import { randomUUID } from 'crypto';
|
|
7
|
+
export class SimplePlanningStrategy {
|
|
8
|
+
aiService;
|
|
9
|
+
constructor(aiService) {
|
|
10
|
+
this.aiService = aiService;
|
|
11
|
+
}
|
|
12
|
+
async executePlanning(context) {
|
|
13
|
+
const startTime = Date.now();
|
|
14
|
+
const stepId = randomUUID();
|
|
15
|
+
// Build the same prompt as PlanningUseCase.createHierarchicalPlan
|
|
16
|
+
const prompt = this.buildPlanningPrompt(context);
|
|
17
|
+
// Convert memories to CodeChunk[] format expected by aiService.chat
|
|
18
|
+
const codeChunks = [];
|
|
19
|
+
const memories = context.memories?.map(m => {
|
|
20
|
+
const memory = {
|
|
21
|
+
id: randomUUID(),
|
|
22
|
+
type: 'reflection',
|
|
23
|
+
description: m.description,
|
|
24
|
+
embedding: [],
|
|
25
|
+
timestamp: new Date(),
|
|
26
|
+
importance: 5,
|
|
27
|
+
lastAccessed: new Date(),
|
|
28
|
+
};
|
|
29
|
+
// Only add metadata if it has valid MemoryMetadata fields
|
|
30
|
+
if (m && typeof m === 'object') {
|
|
31
|
+
memory.metadata = m;
|
|
32
|
+
}
|
|
33
|
+
return memory;
|
|
34
|
+
}) || [];
|
|
35
|
+
// Call AI service (same as current implementation)
|
|
36
|
+
const response = await this.aiService.chat(prompt, codeChunks, memories);
|
|
37
|
+
const duration = Date.now() - startTime;
|
|
38
|
+
// Try to extract token usage from response if available
|
|
39
|
+
// Note: IAIService.chat() returns string, but provider responses may have usage info
|
|
40
|
+
// For now, we'll estimate tokens (can be enhanced in future to get actual usage)
|
|
41
|
+
const estimatedInputTokens = Math.ceil(prompt.length / 4);
|
|
42
|
+
const estimatedOutputTokens = Math.ceil(response.length / 4);
|
|
43
|
+
// Parse plan from response (same logic as PlanningUseCase)
|
|
44
|
+
const plan = this.parsePlanFromResponse(response, context);
|
|
45
|
+
// Create reasoning step
|
|
46
|
+
const step = {
|
|
47
|
+
id: stepId,
|
|
48
|
+
role: 'planner',
|
|
49
|
+
input: prompt,
|
|
50
|
+
output: response,
|
|
51
|
+
timestamp: startTime,
|
|
52
|
+
duration,
|
|
53
|
+
tokenUsage: {
|
|
54
|
+
inputTokens: estimatedInputTokens,
|
|
55
|
+
outputTokens: estimatedOutputTokens,
|
|
56
|
+
},
|
|
57
|
+
metadata: {
|
|
58
|
+
planningMode: context.planningMode || 'hybrid',
|
|
59
|
+
goal: context.goal,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
// Create reasoning trace
|
|
63
|
+
const trace = {
|
|
64
|
+
id: randomUUID(),
|
|
65
|
+
steps: [step],
|
|
66
|
+
summary: `Generated plan with ${plan.subPlans.length} sub-plans`,
|
|
67
|
+
metadata: {
|
|
68
|
+
totalDuration: duration,
|
|
69
|
+
totalTokens: estimatedInputTokens + estimatedOutputTokens,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
plan,
|
|
74
|
+
trace,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Build planning prompt (reuses logic from PlanningUseCase)
|
|
79
|
+
*/
|
|
80
|
+
buildPlanningPrompt(context) {
|
|
81
|
+
const reflectionContext = context.reflections
|
|
82
|
+
?.map((r, i) => `${i + 1}. ${r}`)
|
|
83
|
+
.join('\n') || 'No specific reflections.';
|
|
84
|
+
const memoryContext = context.memories
|
|
85
|
+
?.slice(0, 20)
|
|
86
|
+
.map((m, i) => `${i + 1}. ${m.description}`)
|
|
87
|
+
.join('\n') || 'No relevant past experiences.';
|
|
88
|
+
const planningMode = context.planningMode || 'hybrid';
|
|
89
|
+
const fileContext = context.context?.files?.length
|
|
90
|
+
? `\nFiles to consider: ${context.context.files.join(', ')}`
|
|
91
|
+
: '';
|
|
92
|
+
const constraintsContext = context.context?.constraints?.length
|
|
93
|
+
? `\nConstraints: ${context.context.constraints.join(', ')}`
|
|
94
|
+
: '';
|
|
95
|
+
return `You are a Planning Agent (Architect) for an AI coding system. Your role is to create detailed, step-by-step modification plans.
|
|
96
|
+
|
|
97
|
+
Goal: "${context.goal}"${fileContext}${constraintsContext}
|
|
98
|
+
|
|
99
|
+
Consider:
|
|
100
|
+
- **Relevant Past Experiences/Memories**:
|
|
101
|
+
${memoryContext}
|
|
102
|
+
- **Synthesized Reflections/Insights**:
|
|
103
|
+
${reflectionContext}
|
|
104
|
+
|
|
105
|
+
Create a detailed plan with:
|
|
106
|
+
1. Clear sub-plans with specific actions
|
|
107
|
+
2. Dependencies between sub-plans
|
|
108
|
+
3. Estimated complexity for each sub-plan
|
|
109
|
+
4. Required tools/resources for each step
|
|
110
|
+
|
|
111
|
+
For each sub-plan, specify:
|
|
112
|
+
- \`id\`: Unique identifier (e.g., "subplan_1")
|
|
113
|
+
- \`description\`: Clear, actionable description WITH filepath if applicable
|
|
114
|
+
- \`type\`: Action type (search, edit, refactor, review, analyze, implement, test, debug)
|
|
115
|
+
- \`dependencies\`: Array of sub-plan IDs that must complete first
|
|
116
|
+
- \`status\`: Always "pending" initially
|
|
117
|
+
- \`estimatedComplexity\`: "low" | "medium" | "high"
|
|
118
|
+
- \`requiredTools\`: Array of tool names needed
|
|
119
|
+
|
|
120
|
+
Planning Mode: ${planningMode}
|
|
121
|
+
|
|
122
|
+
Respond with ONLY a JSON array of sub-plan objects.
|
|
123
|
+
|
|
124
|
+
Example:
|
|
125
|
+
[
|
|
126
|
+
{
|
|
127
|
+
"id": "subplan_1",
|
|
128
|
+
"description": "Search codebase for existing authentication patterns",
|
|
129
|
+
"type": "search",
|
|
130
|
+
"dependencies": [],
|
|
131
|
+
"status": "pending",
|
|
132
|
+
"estimatedComplexity": "low",
|
|
133
|
+
"requiredTools": ["search"]
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
|
|
137
|
+
JSON only, no other text:`;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Parse plan from AI response (reuses logic from PlanningAgent)
|
|
141
|
+
*/
|
|
142
|
+
parsePlanFromResponse(response, context) {
|
|
143
|
+
try {
|
|
144
|
+
// Try to extract JSON array from response
|
|
145
|
+
const jsonMatch = response.match(/\[[\s\S]*\]/);
|
|
146
|
+
if (jsonMatch) {
|
|
147
|
+
const subPlansData = JSON.parse(jsonMatch[0]);
|
|
148
|
+
const subPlans = subPlansData.map((sp, idx) => ({
|
|
149
|
+
id: sp.id || `subplan_${idx + 1}`,
|
|
150
|
+
description: sp.description || '',
|
|
151
|
+
type: (sp.type || 'implement'),
|
|
152
|
+
dependencies: sp.dependencies || [],
|
|
153
|
+
status: 'pending',
|
|
154
|
+
estimatedSteps: sp.estimatedSteps || 1,
|
|
155
|
+
estimatedComplexity: sp.estimatedComplexity || 'medium',
|
|
156
|
+
}));
|
|
157
|
+
// Build dependencies from sub-plan dependencies
|
|
158
|
+
const dependencies = [];
|
|
159
|
+
subPlans.forEach(sp => {
|
|
160
|
+
sp.dependencies.forEach((depId) => {
|
|
161
|
+
dependencies.push({
|
|
162
|
+
from: depId,
|
|
163
|
+
to: sp.id,
|
|
164
|
+
type: 'sequential',
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
return {
|
|
169
|
+
id: randomUUID(),
|
|
170
|
+
goal: context.goal,
|
|
171
|
+
description: `Plan to achieve: ${context.goal}`,
|
|
172
|
+
status: 'draft',
|
|
173
|
+
createdAt: new Date(),
|
|
174
|
+
subPlans,
|
|
175
|
+
dependencies,
|
|
176
|
+
metadata: {
|
|
177
|
+
memoriesUsed: [],
|
|
178
|
+
reflections: [],
|
|
179
|
+
complexity: 'medium',
|
|
180
|
+
priority: 5,
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
catch (error) {
|
|
186
|
+
// Fallback: create a simple plan
|
|
187
|
+
console.warn('[SimplePlanningStrategy] Failed to parse plan, creating fallback:', error);
|
|
188
|
+
}
|
|
189
|
+
// Fallback plan
|
|
190
|
+
return {
|
|
191
|
+
id: randomUUID(),
|
|
192
|
+
goal: context.goal,
|
|
193
|
+
description: `Plan to achieve: ${context.goal}`,
|
|
194
|
+
status: 'draft',
|
|
195
|
+
createdAt: new Date(),
|
|
196
|
+
subPlans: [
|
|
197
|
+
{
|
|
198
|
+
id: 'subplan_1',
|
|
199
|
+
description: context.goal,
|
|
200
|
+
type: 'implement',
|
|
201
|
+
dependencies: [],
|
|
202
|
+
status: 'pending',
|
|
203
|
+
estimatedSteps: 1,
|
|
204
|
+
estimatedComplexity: 'medium',
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
dependencies: [],
|
|
208
|
+
metadata: {
|
|
209
|
+
memoriesUsed: [],
|
|
210
|
+
reflections: [],
|
|
211
|
+
complexity: 'medium',
|
|
212
|
+
priority: 5,
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=simple-planning-strategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simple-planning-strategy.js","sourceRoot":"","sources":["../../../src/application/reasoning/simple-planning-strategy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAQpC,MAAM,OAAO,sBAAsB;IACb;IAApB,YAAoB,SAAqB;QAArB,cAAS,GAAT,SAAS,CAAY;IAAG,CAAC;IAE7C,KAAK,CAAC,eAAe,CAAC,OAA6B;QACjD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;QAE5B,kEAAkE;QAClE,MAAM,MAAM,GAAG,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAEjD,oEAAoE;QACpE,MAAM,UAAU,GAAgB,EAAE,CAAC;QACnC,MAAM,QAAQ,GAAa,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE;YACnD,MAAM,MAAM,GAAW;gBACrB,EAAE,EAAE,UAAU,EAAE;gBAChB,IAAI,EAAE,YAAqB;gBAC3B,WAAW,EAAE,CAAC,CAAC,WAAW;gBAC1B,SAAS,EAAE,EAAE;gBACb,SAAS,EAAE,IAAI,IAAI,EAAE;gBACrB,UAAU,EAAE,CAAC;gBACb,YAAY,EAAE,IAAI,IAAI,EAAE;aACzB,CAAC;YACF,0DAA0D;YAC1D,IAAI,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;gBAC/B,MAAM,CAAC,QAAQ,GAAG,CAAmB,CAAC;YACxC,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,IAAI,EAAE,CAAC;QAET,mDAAmD;QACnD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CA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AE,CAAC;qBACI;iBAClB,CAAC;YACJ,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,iCAAiC;YACjC,OAAO,CAAC,IAAI,CAAC,mEAAmE,EAAE,KAAK,CAAC,CAAC;QAC3F,CAAC;QAED,gBAAgB;QAChB,OAAO;YACL,EAAE,EAAE,UAAU,EAAE;YAChB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,WAAW,EAAE,oBAAoB,OAAO,CAAC,IAAI,EAAE;YAC/C,MAAM,EAAE,OAAgB;YACxB,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,QAAQ,EAAE;gBACR;oBACE,EAAE,EAAE,WAAW;oBACf,WAAW,EAAE,OAAO,CAAC,IAAI;oBACzB,IAAI,EAAE,WAAoB;oBAC1B,YAAY,EAAE,EAAE;oBAChB,MAAM,EAAE,SAAkB;oBAC1B,cAAc,EAAE,CAAC;oBACjB,mBAAmB,EAAE,QAAiB;iBACvC;aACF;YACD,YAAY,EAAE,EAAE;YAChB,QAAQ,EAAE;gBACR,YAAY,EAAE,EAAE;gBAChB,WAAW,EAAE,EAAE;gBACf,UAAU,EAAE,QAAiB;gBAC7B,QAAQ,EAAE,CAAC;aACZ;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reasoning Layer Types
|
|
3
|
+
* Core abstractions for structured reasoning and token optimization
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Reasoning role - defines the purpose of a reasoning step
|
|
7
|
+
*/
|
|
8
|
+
export type ReasoningRole = 'planner' | 'worker' | 'validator' | 'summarizer';
|
|
9
|
+
/**
|
|
10
|
+
* Single reasoning step - atomic unit of reasoning
|
|
11
|
+
*/
|
|
12
|
+
export interface ReasoningStep {
|
|
13
|
+
id: string;
|
|
14
|
+
role: ReasoningRole;
|
|
15
|
+
input: string;
|
|
16
|
+
output: string;
|
|
17
|
+
metadata?: Record<string, unknown>;
|
|
18
|
+
timestamp: number;
|
|
19
|
+
duration?: number;
|
|
20
|
+
tokenUsage?: {
|
|
21
|
+
inputTokens?: number;
|
|
22
|
+
outputTokens?: number;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Reasoning trace - sequence of reasoning steps with summary metadata
|
|
27
|
+
*/
|
|
28
|
+
export interface ReasoningTrace {
|
|
29
|
+
id: string;
|
|
30
|
+
steps: ReasoningStep[];
|
|
31
|
+
summary?: string;
|
|
32
|
+
metadata?: {
|
|
33
|
+
provider?: string;
|
|
34
|
+
model?: string;
|
|
35
|
+
totalTokens?: number;
|
|
36
|
+
totalDuration?: number;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Compressed reasoning - compact representation for later use
|
|
41
|
+
* Can be expanded to use Toon serialization in future phases
|
|
42
|
+
*/
|
|
43
|
+
export interface CompressedReasoning {
|
|
44
|
+
traceId: string;
|
|
45
|
+
compressed: string;
|
|
46
|
+
metadata?: Record<string, unknown>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Planning input context - what the planner needs to generate a plan
|
|
50
|
+
*/
|
|
51
|
+
export interface PlanningInputContext {
|
|
52
|
+
goal: string;
|
|
53
|
+
reflections?: string[];
|
|
54
|
+
memories?: Array<{
|
|
55
|
+
description: string;
|
|
56
|
+
[key: string]: unknown;
|
|
57
|
+
}>;
|
|
58
|
+
context?: {
|
|
59
|
+
files?: string[];
|
|
60
|
+
currentDirectory?: string;
|
|
61
|
+
constraints?: string[];
|
|
62
|
+
};
|
|
63
|
+
planningMode?: 'plan-then-execute' | 'iterative' | 'hybrid';
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/application/reasoning/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,M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E;QACR,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;KACxB,CAAC;IACF,YAAY,CAAC,EAAE,mBAAmB,GAAG,WAAW,GAAG,QAAQ,CAAC;CAC7D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/application/reasoning/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validator Strategy
|
|
3
|
+
* Validates and optionally enriches a plan produced by the planner
|
|
4
|
+
*/
|
|
5
|
+
import type { Plan } from '../../domain/entities/plan.js';
|
|
6
|
+
import type { IAIService } from '../../domain/interfaces/ai-service.interface.js';
|
|
7
|
+
export interface ValidationResult {
|
|
8
|
+
plan: Plan;
|
|
9
|
+
isValid: boolean;
|
|
10
|
+
warnings?: string[];
|
|
11
|
+
risks?: string[];
|
|
12
|
+
suggestions?: string[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Validator strategy interface
|
|
16
|
+
*/
|
|
17
|
+
export interface IValidatorStrategy {
|
|
18
|
+
/**
|
|
19
|
+
* Validate a plan produced by the planner
|
|
20
|
+
*/
|
|
21
|
+
validatePlan(plan: Plan, originalContext: {
|
|
22
|
+
goal: string;
|
|
23
|
+
reflections?: string[];
|
|
24
|
+
memories?: Array<{
|
|
25
|
+
description: string;
|
|
26
|
+
}>;
|
|
27
|
+
context?: {
|
|
28
|
+
files?: string[];
|
|
29
|
+
currentDirectory?: string;
|
|
30
|
+
constraints?: string[];
|
|
31
|
+
};
|
|
32
|
+
}): Promise<ValidationResult>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Simple validator strategy
|
|
36
|
+
* Uses AI to review the plan and identify potential issues
|
|
37
|
+
*/
|
|
38
|
+
export declare class SimpleValidatorStrategy implements IValidatorStrategy {
|
|
39
|
+
private aiService;
|
|
40
|
+
constructor(aiService: IAIService);
|
|
41
|
+
validatePlan(plan: Plan, originalContext: {
|
|
42
|
+
goal: string;
|
|
43
|
+
reflections?: string[];
|
|
44
|
+
memories?: Array<{
|
|
45
|
+
description: string;
|
|
46
|
+
}>;
|
|
47
|
+
context?: {
|
|
48
|
+
files?: string[];
|
|
49
|
+
currentDirectory?: string;
|
|
50
|
+
constraints?: string[];
|
|
51
|
+
};
|
|
52
|
+
}): Promise<ValidationResult>;
|
|
53
|
+
private buildValidationPrompt;
|
|
54
|
+
private parseValidationResponse;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=validator-strategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator-strategy.d.ts","sourceRoot":"","sources":["../../../src/application/reasoning/validator-strategy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAgB,MAAM,+BAA+B,CAAC;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iDAAiD,CAAC;AAIlF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,YAAY,CACV,IAAI,EAAE,IAAI,EACV,eAAe,EAAE;QACf,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,QAAQ,CAAC,EAAE,KAAK,CAAC;YAAE,WAAW,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAC1C,OAAO,CAAC,EAAE;YACR,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;YACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;YAC1B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;SACxB,CAAC;KACH,GACA,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC9B;AAED;;;GAGG;AACH,qBAAa,uBAAwB,YAAW,kBAAkB;IACpD,OAAO,CAAC,SAAS;gBAAT,SAAS,EAAE,UAAU;IAEnC,YAAY,CAChB,IAAI,EAAE,IAAI,EACV,eAAe,EAAE;QACf,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,QAAQ,CAAC,EAAE,KAAK,CAAC;YAAE,WAAW,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAC1C,OAAO,CAAC,EAAE;YACR,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;YACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;YAC1B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;SACxB,CAAC;KACH,GACA,OAAO,CAAC,gBAAgB,CAAC;IAqB5B,OAAO,CAAC,qBAAqB;IA0C7B,OAAO,CAAC,uBAAuB;CAwDhC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validator Strategy
|
|
3
|
+
* Validates and optionally enriches a plan produced by the planner
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Simple validator strategy
|
|
7
|
+
* Uses AI to review the plan and identify potential issues
|
|
8
|
+
*/
|
|
9
|
+
export class SimpleValidatorStrategy {
|
|
10
|
+
aiService;
|
|
11
|
+
constructor(aiService) {
|
|
12
|
+
this.aiService = aiService;
|
|
13
|
+
}
|
|
14
|
+
async validatePlan(plan, originalContext) {
|
|
15
|
+
const prompt = this.buildValidationPrompt(plan, originalContext);
|
|
16
|
+
const codeChunks = [];
|
|
17
|
+
const memories = [];
|
|
18
|
+
try {
|
|
19
|
+
const response = await this.aiService.chat(prompt, codeChunks, memories);
|
|
20
|
+
const validation = this.parseValidationResponse(response, plan);
|
|
21
|
+
return validation;
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
// On validation failure, return plan as-is with warning
|
|
25
|
+
console.warn('[SimpleValidatorStrategy] Validation failed, using plan as-is:', error instanceof Error ? error.message : String(error));
|
|
26
|
+
return {
|
|
27
|
+
plan,
|
|
28
|
+
isValid: true, // Default to valid to not block planning
|
|
29
|
+
warnings: ['Validation step failed, plan used without validation'],
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
buildValidationPrompt(plan, context) {
|
|
34
|
+
const planJson = JSON.stringify(plan, null, 2);
|
|
35
|
+
const constraintsText = context.context?.constraints?.length
|
|
36
|
+
? `\nConstraints: ${context.context.constraints.join(', ')}`
|
|
37
|
+
: '';
|
|
38
|
+
return `You are a Plan Validator for an AI coding system. Review the following plan and identify potential issues, risks, or improvements.
|
|
39
|
+
|
|
40
|
+
Goal: "${context.goal}"${constraintsText}
|
|
41
|
+
|
|
42
|
+
Plan to validate:
|
|
43
|
+
${planJson}
|
|
44
|
+
|
|
45
|
+
Review the plan and provide:
|
|
46
|
+
1. Is the plan valid and feasible? (true/false)
|
|
47
|
+
2. Any warnings about potential issues
|
|
48
|
+
3. Any risks that could cause the plan to fail
|
|
49
|
+
4. Suggestions for improvement (optional)
|
|
50
|
+
|
|
51
|
+
Respond with ONLY a JSON object in this format:
|
|
52
|
+
{
|
|
53
|
+
"isValid": true,
|
|
54
|
+
"warnings": ["warning 1", "warning 2"],
|
|
55
|
+
"risks": ["risk 1"],
|
|
56
|
+
"suggestions": ["suggestion 1"]
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
JSON only, no other text:`;
|
|
60
|
+
}
|
|
61
|
+
parseValidationResponse(response, originalPlan) {
|
|
62
|
+
try {
|
|
63
|
+
const jsonMatch = response.match(/\{[\s\S]*\}/);
|
|
64
|
+
if (jsonMatch) {
|
|
65
|
+
const validation = JSON.parse(jsonMatch[0]);
|
|
66
|
+
// Enrich plan metadata with validation results (internal only)
|
|
67
|
+
// Store in metadata as any to avoid type issues (internal use only)
|
|
68
|
+
const enrichedPlan = {
|
|
69
|
+
...originalPlan,
|
|
70
|
+
metadata: {
|
|
71
|
+
...originalPlan.metadata,
|
|
72
|
+
// Store validation results in metadata (not exposed to users)
|
|
73
|
+
// Using type assertion for internal metadata
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
// Set validation metadata separately to avoid type issues
|
|
77
|
+
enrichedPlan.metadata._validation = {
|
|
78
|
+
isValid: validation.isValid ?? true,
|
|
79
|
+
warnings: validation.warnings || [],
|
|
80
|
+
risks: validation.risks || [],
|
|
81
|
+
suggestions: validation.suggestions || [],
|
|
82
|
+
};
|
|
83
|
+
return {
|
|
84
|
+
plan: enrichedPlan,
|
|
85
|
+
isValid: validation.isValid ?? true,
|
|
86
|
+
warnings: validation.warnings,
|
|
87
|
+
risks: validation.risks,
|
|
88
|
+
suggestions: validation.suggestions,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
console.warn('[SimpleValidatorStrategy] Failed to parse validation response:', error);
|
|
94
|
+
}
|
|
95
|
+
// Fallback: return plan as-is
|
|
96
|
+
return {
|
|
97
|
+
plan: originalPlan,
|
|
98
|
+
isValid: true,
|
|
99
|
+
warnings: ['Could not parse validation response'],
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=validator-strategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator-strategy.js","sourceRoot":"","sources":["../../../src/application/reasoning/validator-strategy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqCH;;;GAGG;AACH,MAAM,OAAO,uBAAuB;IACd;IAApB,YAAoB,SAAqB;QAArB,cAAS,GAAT,SAAS,CAAY;IAAG,CAAC;IAE7C,KAAK,CAAC,YAAY,CAChB,IAAU,EACV,eASC;QAED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|
5
|
+
import type { IAIService } from '../../domain/interfaces/ai-service.interface.js';
|
|
6
6
|
import { SQLiteEmbeddingRepository } from '../../infrastructure/storage/sqlite-embedding-repository.js';
|
|
7
7
|
import { SQLiteMemoryRepository } from '../../infrastructure/storage/sqlite-memory-repository.js';
|
|
8
8
|
import { MemoryStreamService } from '../../infrastructure/storage/memory-stream-service.js';
|
|
@@ -47,8 +47,10 @@ import { SQLiteKnowledgePreservationRepository } from '../../infrastructure/stor
|
|
|
47
47
|
import { KnowledgeExtractor } from '../../domain/services/knowledge-extractor.js';
|
|
48
48
|
import { KnowledgeAccess } from '../../domain/services/knowledge-access.js';
|
|
49
49
|
import { CrossTeamPatternSharing } from '../../domain/services/cross-team-pattern-sharing.js';
|
|
50
|
+
import { ProviderRegistry } from '../../infrastructure/providers/provider-registry.js';
|
|
50
51
|
export declare class DependencyContainer {
|
|
51
52
|
private _aiService;
|
|
53
|
+
private _providerRegistry;
|
|
52
54
|
private _embeddingRepository;
|
|
53
55
|
private _memoryRepository;
|
|
54
56
|
private _memoryStreamService;
|
|
@@ -89,11 +91,53 @@ export declare class DependencyContainer {
|
|
|
89
91
|
private _editFileUseCase;
|
|
90
92
|
private _explainFileUseCase;
|
|
91
93
|
private _planningUseCase;
|
|
92
|
-
|
|
94
|
+
/**
|
|
95
|
+
* Provider Registry
|
|
96
|
+
* Phase 4C: Provider selection via env/config
|
|
97
|
+
*
|
|
98
|
+
* Provider Selection Logic:
|
|
99
|
+
* - Always register CohereProvider (default)
|
|
100
|
+
* - Register OpenAIProvider if CODEHERE_OPENAI_API_KEY is set
|
|
101
|
+
* - Default provider:
|
|
102
|
+
* - If CODEHERE_AI_PROVIDER=openai and OpenAIProvider available → OpenAI
|
|
103
|
+
* - Else → Cohere (backward compatible)
|
|
104
|
+
*/
|
|
105
|
+
get providerRegistry(): ProviderRegistry;
|
|
106
|
+
get aiService(): IAIService;
|
|
107
|
+
/**
|
|
108
|
+
* Get embedding repository for a specific codebase
|
|
109
|
+
* @param cwd - Current working directory for codebase root detection (defaults to process.cwd())
|
|
110
|
+
* @returns SQLiteEmbeddingRepository instance scoped to the codebase
|
|
111
|
+
*/
|
|
112
|
+
getEmbeddingRepository(cwd?: string): SQLiteEmbeddingRepository;
|
|
113
|
+
/**
|
|
114
|
+
* @deprecated Use getEmbeddingRepository(cwd) instead for per-repo isolation
|
|
115
|
+
* Kept for backward compatibility
|
|
116
|
+
*/
|
|
93
117
|
get embeddingRepository(): SQLiteEmbeddingRepository;
|
|
94
118
|
get memoryRepository(): SQLiteMemoryRepository;
|
|
95
119
|
get memoryStreamService(): MemoryStreamService;
|
|
120
|
+
/**
|
|
121
|
+
* Get ask question use case for a specific codebase
|
|
122
|
+
* @param cwd - Current working directory for codebase root detection (defaults to process.cwd())
|
|
123
|
+
* @returns AskQuestionUseCase instance scoped to the codebase
|
|
124
|
+
*/
|
|
125
|
+
getAskQuestionUseCase(cwd?: string): AskQuestionUseCase;
|
|
126
|
+
/**
|
|
127
|
+
* @deprecated Use getAskQuestionUseCase(cwd) instead for per-repo isolation
|
|
128
|
+
* Kept for backward compatibility
|
|
129
|
+
*/
|
|
96
130
|
get askQuestionUseCase(): AskQuestionUseCase;
|
|
131
|
+
/**
|
|
132
|
+
* Get index codebase use case for a specific codebase
|
|
133
|
+
* @param cwd - Current working directory for codebase root detection (defaults to process.cwd())
|
|
134
|
+
* @returns IndexCodebaseUseCase instance scoped to the codebase
|
|
135
|
+
*/
|
|
136
|
+
getIndexCodebaseUseCase(cwd?: string): IndexCodebaseUseCase;
|
|
137
|
+
/**
|
|
138
|
+
* @deprecated Use getIndexCodebaseUseCase(cwd) instead for per-repo isolation
|
|
139
|
+
* Kept for backward compatibility
|
|
140
|
+
*/
|
|
97
141
|
get indexCodebaseUseCase(): IndexCodebaseUseCase;
|
|
98
142
|
get toolExecutorService(): ToolExecutorService;
|
|
99
143
|
get reactOrchestrationUseCase(): ReActOrchestrationUseCase;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependency-container.d.ts","sourceRoot":"","sources":["../../../src/application/services/dependency-container.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"dependency-container.d.ts","sourceRoot":"","sources":["../../../src/application/services/dependency-container.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iDAAiD,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,6DAA6D,CAAC;AACxG,OAAO,EAAE,sBAAsB,EAAE,MAAM,0DAA0D,CAAC;AAClG,OAAO,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AAC5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAwC,MAAM,yCAAyC,CAAC;AACrH,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2DAA2D,CAAC;AAChG,OAAO,EAAE,aAAa,EAAE,MAAM,kDAAkD,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yDAAyD,CAAC;AAC/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,yDAAyD,CAAC;AAC/F,OAAO,EAAE,eAAe,EAAE,MAAM,+CAA+C,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM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