codehere 0.1.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -329
- package/dist/application/agents/execution-agent.js +4 -30
- package/dist/application/agents/multi-agent-orchestrator.js +0 -1
- package/dist/application/agents/planning-agent.js +79 -199
- package/dist/application/services/dependency-container.js +9 -20
- package/dist/application/services/intelligent-router.js +56 -64
- package/dist/application/use-cases/ask-question-use-case.js +22 -121
- package/dist/application/use-cases/edit-file-use-case.js +171 -160
- package/dist/application/use-cases/react-orchestration-use-case.js +10 -43
- package/dist/chat.js +130 -54
- package/dist/domain/services/query-intent-classifier.js +3 -36
- package/dist/embed.js +61 -74
- package/dist/index.js +1299 -259
- package/dist/infrastructure/ai/cohere-ai-service.js +9 -78
- package/dist/infrastructure/ai/provider-ai-service.js +18 -121
- package/dist/infrastructure/config/config-manager.js +14 -135
- package/dist/infrastructure/config/product-context.js +66 -0
- package/dist/infrastructure/context/conversation-context.js +1 -86
- package/dist/infrastructure/cost/cost-router.js +104 -0
- package/dist/infrastructure/cost/cost-tracker.js +2 -3
- package/dist/infrastructure/governance/policy-as-code.js +2 -1
- package/dist/infrastructure/hooks/claude-sdk-hook.js +253 -0
- package/dist/infrastructure/hooks/session-analyzer.js +111 -0
- package/dist/infrastructure/observability/execution-tracer.js +7 -180
- package/dist/infrastructure/protocols/mcp-helpers.js +45 -0
- package/dist/infrastructure/protocols/mcp-server-impl.js +286 -0
- package/dist/infrastructure/providers/cohere-provider.js +5 -31
- package/dist/infrastructure/providers/fake-provider.js +0 -8
- package/dist/infrastructure/providers/local-llm-provider.js +2 -8
- package/dist/infrastructure/providers/openai-provider.js +5 -37
- package/dist/infrastructure/providers/openrouter-provider.js +3 -11
- package/dist/infrastructure/safety/pattern-detector.js +133 -0
- package/dist/infrastructure/security/ai-sast-scanner.js +62 -13
- package/dist/infrastructure/security/enhanced-security-gate.js +2 -61
- package/dist/infrastructure/security/input-validator.js +29 -146
- package/dist/infrastructure/security/trust-scorer.js +337 -0
- package/dist/infrastructure/storage/embeddings-path.js +4 -14
- package/dist/infrastructure/storage/plan-repository.js +5 -4
- package/dist/infrastructure/storage/sqlite-decision-repository.js +8 -4
- package/dist/infrastructure/storage/sqlite-embedding-repository.js +11 -23
- package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.js +8 -4
- package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.js +8 -4
- package/dist/infrastructure/storage/sqlite-memory-repository.js +8 -4
- package/dist/infrastructure/storage/sqlite-pattern-repository.js +8 -4
- package/dist/infrastructure/ux/stream-markdown.js +151 -0
- package/dist/infrastructure/ux/transparency.js +71 -0
- package/dist/infrastructure/validation/agent-feedback.js +12 -57
- package/dist/monitoring.js +8 -17
- package/dist/parallel-processor.js +50 -122
- package/dist/presentation/cli/commands/ask-command.js +39 -80
- package/dist/presentation/cli/commands/config-command.js +1 -1
- package/dist/presentation/cli/commands/cost-command.js +6 -6
- package/dist/presentation/cli/commands/decision-command.js +5 -5
- package/dist/presentation/cli/commands/fix-command.js +4 -44
- package/dist/presentation/cli/commands/help-command.js +151 -100
- package/dist/presentation/cli/commands/hook-command.js +272 -0
- package/dist/presentation/cli/commands/knowledge-command.js +4 -4
- package/dist/presentation/cli/commands/learning-dashboard-command.js +3 -3
- package/dist/presentation/cli/commands/orchestrate-command.js +6 -48
- package/dist/presentation/cli/commands/plan-command.js +1 -1
- package/dist/presentation/cli/commands/product-command.js +193 -16
- package/dist/presentation/cli/commands/report-command.js +353 -0
- package/dist/presentation/cli/commands/run-command.js +3 -3
- package/dist/presentation/cli/commands/scan-tool-command.js +65 -0
- package/dist/presentation/cli/commands/setup-command.js +34 -81
- package/dist/presentation/cli/commands/smart-command.js +50 -172
- package/dist/presentation/cli/commands/status-command.js +304 -119
- package/dist/presentation/cli/commands/trust-command.js +267 -274
- package/dist/presentation/cli/commands/undo-command.js +2 -2
- package/dist/search.js +37 -67
- package/dist/session.js +595 -484
- package/dist/task-verification.js +4 -4
- package/dist/token-optimizer.js +1 -6
- package/dist/ui.js +132 -16
- package/dist/utils/check-api-status.js +30 -12
- package/dist/utils/diff-parser.js +18 -48
- package/dist/verification/compiler.js +12 -11
- package/package.json +36 -43
- package/dist/agents/base.d.ts +0 -107
- package/dist/agents/base.d.ts.map +0 -1
- package/dist/agents/base.js.map +0 -1
- package/dist/agents/orchestrator-model-driven.d.ts +0 -41
- package/dist/agents/orchestrator-model-driven.d.ts.map +0 -1
- package/dist/agents/orchestrator-model-driven.js.map +0 -1
- package/dist/agents/react-orchestrator-agent.d.ts +0 -15
- package/dist/agents/react-orchestrator-agent.d.ts.map +0 -1
- package/dist/agents/react-orchestrator-agent.js.map +0 -1
- package/dist/application/agents/execution-agent.d.ts +0 -79
- package/dist/application/agents/execution-agent.d.ts.map +0 -1
- package/dist/application/agents/execution-agent.js.map +0 -1
- package/dist/application/agents/multi-agent-orchestrator.d.ts +0 -69
- package/dist/application/agents/multi-agent-orchestrator.d.ts.map +0 -1
- package/dist/application/agents/multi-agent-orchestrator.js.map +0 -1
- package/dist/application/agents/planning-agent.d.ts +0 -65
- package/dist/application/agents/planning-agent.d.ts.map +0 -1
- package/dist/application/agents/planning-agent.js.map +0 -1
- package/dist/application/agents/validation-agent.d.ts +0 -68
- package/dist/application/agents/validation-agent.d.ts.map +0 -1
- package/dist/application/agents/validation-agent.js.map +0 -1
- package/dist/application/architectures/plan-and-act.d.ts +0 -94
- package/dist/application/architectures/plan-and-act.d.ts.map +0 -1
- package/dist/application/architectures/plan-and-act.js.map +0 -1
- package/dist/application/index.d.ts +0 -12
- package/dist/application/index.d.ts.map +0 -1
- package/dist/application/index.js.map +0 -1
- package/dist/application/services/agent-factory.d.ts +0 -9
- package/dist/application/services/agent-factory.d.ts.map +0 -1
- package/dist/application/services/agent-factory.js.map +0 -1
- package/dist/application/services/context-importer.d.ts +0 -71
- package/dist/application/services/context-importer.d.ts.map +0 -1
- package/dist/application/services/context-importer.js +0 -436
- package/dist/application/services/context-importer.js.map +0 -1
- package/dist/application/services/context-manager.d.ts +0 -132
- package/dist/application/services/context-manager.d.ts.map +0 -1
- package/dist/application/services/context-manager.js +0 -369
- package/dist/application/services/context-manager.js.map +0 -1
- package/dist/application/services/dependency-container.d.ts +0 -187
- package/dist/application/services/dependency-container.d.ts.map +0 -1
- package/dist/application/services/dependency-container.js.map +0 -1
- package/dist/application/services/git-context-service.d.ts +0 -30
- package/dist/application/services/git-context-service.d.ts.map +0 -1
- package/dist/application/services/git-context-service.js.map +0 -1
- package/dist/application/services/intelligent-router.d.ts +0 -90
- package/dist/application/services/intelligent-router.d.ts.map +0 -1
- package/dist/application/services/intelligent-router.js.map +0 -1
- package/dist/application/services/token-counting-service.d.ts +0 -87
- package/dist/application/services/token-counting-service.d.ts.map +0 -1
- package/dist/application/services/token-counting-service.js +0 -196
- package/dist/application/services/token-counting-service.js.map +0 -1
- package/dist/application/services/tool-executor-service.d.ts +0 -14
- package/dist/application/services/tool-executor-service.d.ts.map +0 -1
- package/dist/application/services/tool-executor-service.js.map +0 -1
- package/dist/application/use-cases/ask-question-use-case.d.ts +0 -67
- package/dist/application/use-cases/ask-question-use-case.d.ts.map +0 -1
- package/dist/application/use-cases/ask-question-use-case.js.map +0 -1
- package/dist/application/use-cases/edit-file-use-case.d.ts +0 -92
- package/dist/application/use-cases/edit-file-use-case.d.ts.map +0 -1
- package/dist/application/use-cases/edit-file-use-case.js.map +0 -1
- package/dist/application/use-cases/explain-file-use-case.d.ts +0 -21
- package/dist/application/use-cases/explain-file-use-case.d.ts.map +0 -1
- package/dist/application/use-cases/explain-file-use-case.js.map +0 -1
- package/dist/application/use-cases/index-codebase-use-case.d.ts +0 -46
- package/dist/application/use-cases/index-codebase-use-case.d.ts.map +0 -1
- package/dist/application/use-cases/index-codebase-use-case.js.map +0 -1
- package/dist/application/use-cases/planning-use-case.d.ts +0 -46
- package/dist/application/use-cases/planning-use-case.d.ts.map +0 -1
- package/dist/application/use-cases/planning-use-case.js.map +0 -1
- package/dist/application/use-cases/react-orchestration-use-case.d.ts +0 -51
- package/dist/application/use-cases/react-orchestration-use-case.d.ts.map +0 -1
- package/dist/application/use-cases/react-orchestration-use-case.js.map +0 -1
- package/dist/application/use-cases/reflexion-use-case.d.ts +0 -24
- package/dist/application/use-cases/reflexion-use-case.d.ts.map +0 -1
- package/dist/application/use-cases/reflexion-use-case.js.map +0 -1
- package/dist/application/workflows/deterministic-workflows.d.ts +0 -61
- package/dist/application/workflows/deterministic-workflows.d.ts.map +0 -1
- package/dist/application/workflows/deterministic-workflows.js.map +0 -1
- package/dist/ast-parser.d 2.ts +0 -55
- package/dist/ast-parser.d.ts +0 -55
- package/dist/ast-parser.d.ts.map +0 -1
- package/dist/ast-parser.js.map +0 -1
- package/dist/cache.d.ts +0 -45
- package/dist/cache.d.ts.map +0 -1
- package/dist/cache.js.map +0 -1
- package/dist/chat.d.ts +0 -4
- package/dist/chat.d.ts.map +0 -1
- package/dist/chat.js.map +0 -1
- package/dist/code-analysis 2.js +0 -327
- package/dist/code-analysis.d.ts +0 -50
- package/dist/code-analysis.d.ts.map +0 -1
- package/dist/code-analysis.js.map +0 -1
- package/dist/context.d.ts +0 -44
- package/dist/context.d.ts 2.map +0 -1
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js.map +0 -1
- package/dist/docs.d.ts +0 -21
- package/dist/docs.d.ts.map +0 -1
- package/dist/docs.js.map +0 -1
- package/dist/domain/entities/code-chunk.d.ts +0 -26
- package/dist/domain/entities/code-chunk.d.ts.map +0 -1
- package/dist/domain/entities/code-chunk.js.map +0 -1
- package/dist/domain/entities/conversation-context.d.ts +0 -245
- package/dist/domain/entities/conversation-context.d.ts.map +0 -1
- package/dist/domain/entities/conversation-context.js +0 -50
- package/dist/domain/entities/conversation-context.js.map +0 -1
- package/dist/domain/entities/decision.d.ts +0 -37
- package/dist/domain/entities/decision.d.ts.map +0 -1
- package/dist/domain/entities/decision.js.map +0 -1
- package/dist/domain/entities/edit.d.ts +0 -35
- package/dist/domain/entities/edit.d.ts.map +0 -1
- package/dist/domain/entities/edit.js.map +0 -1
- package/dist/domain/entities/knowledge-node.d.ts +0 -83
- package/dist/domain/entities/knowledge-node.d.ts.map +0 -1
- package/dist/domain/entities/knowledge-node.js.map +0 -1
- package/dist/domain/entities/knowledge-preservation.d.ts +0 -42
- package/dist/domain/entities/knowledge-preservation.d.ts.map +0 -1
- package/dist/domain/entities/knowledge-preservation.js.map +0 -1
- package/dist/domain/entities/memory.d.ts +0 -36
- package/dist/domain/entities/memory.d.ts.map +0 -1
- package/dist/domain/entities/memory.js.map +0 -1
- package/dist/domain/entities/pattern.d.ts +0 -49
- package/dist/domain/entities/pattern.d.ts.map +0 -1
- package/dist/domain/entities/pattern.js.map +0 -1
- package/dist/domain/entities/plan.d.ts +0 -42
- package/dist/domain/entities/plan.d.ts.map +0 -1
- package/dist/domain/entities/plan.js.map +0 -1
- package/dist/domain/entities/query.d.ts +0 -17
- package/dist/domain/entities/query.d.ts.map +0 -1
- package/dist/domain/entities/query.js.map +0 -1
- package/dist/domain/entities/task.d.ts +0 -152
- package/dist/domain/entities/task.d.ts.map +0 -1
- package/dist/domain/entities/task.js.map +0 -1
- package/dist/domain/errors/embeddings-not-found-error.d.ts +0 -9
- package/dist/domain/errors/embeddings-not-found-error.d.ts.map +0 -1
- package/dist/domain/errors/embeddings-not-found-error.js.map +0 -1
- package/dist/domain/index.d.ts +0 -16
- package/dist/domain/index.d.ts.map +0 -1
- package/dist/domain/index.js.map +0 -1
- package/dist/domain/interfaces/ai-service.interface.d.ts +0 -72
- package/dist/domain/interfaces/ai-service.interface.d.ts.map +0 -1
- package/dist/domain/interfaces/ai-service.interface.js.map +0 -1
- package/dist/domain/interfaces/code-analyzer.interface.d.ts +0 -38
- package/dist/domain/interfaces/code-analyzer.interface.d.ts.map +0 -1
- package/dist/domain/interfaces/code-analyzer.interface.js.map +0 -1
- package/dist/domain/interfaces/context-repository.interface.d.ts +0 -71
- package/dist/domain/interfaces/context-repository.interface.d.ts.map +0 -1
- package/dist/domain/interfaces/context-repository.interface.js +0 -10
- package/dist/domain/interfaces/context-repository.interface.js.map +0 -1
- package/dist/domain/interfaces/decision-repository.interface.d.ts +0 -51
- package/dist/domain/interfaces/decision-repository.interface.d.ts.map +0 -1
- package/dist/domain/interfaces/decision-repository.interface.js.map +0 -1
- package/dist/domain/interfaces/embedding-repository.interface.d.ts +0 -33
- package/dist/domain/interfaces/embedding-repository.interface.d.ts.map +0 -1
- package/dist/domain/interfaces/embedding-repository.interface.js.map +0 -1
- package/dist/domain/interfaces/knowledge-graph-repository.interface.d.ts +0 -91
- package/dist/domain/interfaces/knowledge-graph-repository.interface.d.ts.map +0 -1
- package/dist/domain/interfaces/knowledge-graph-repository.interface.js.map +0 -1
- package/dist/domain/interfaces/knowledge-preservation-repository.interface.d.ts +0 -50
- package/dist/domain/interfaces/knowledge-preservation-repository.interface.d.ts.map +0 -1
- package/dist/domain/interfaces/knowledge-preservation-repository.interface.js.map +0 -1
- package/dist/domain/interfaces/memory-repository.interface.d.ts +0 -49
- package/dist/domain/interfaces/memory-repository.interface.d.ts.map +0 -1
- package/dist/domain/interfaces/memory-repository.interface.js.map +0 -1
- package/dist/domain/interfaces/pattern-repository.interface.d.ts +0 -48
- package/dist/domain/interfaces/pattern-repository.interface.d.ts.map +0 -1
- package/dist/domain/interfaces/pattern-repository.interface.js.map +0 -1
- package/dist/domain/interfaces/verification-service.interface.d.ts +0 -20
- package/dist/domain/interfaces/verification-service.interface.d.ts.map +0 -1
- package/dist/domain/interfaces/verification-service.interface.js.map +0 -1
- package/dist/domain/services/codebase-detector.d.ts +0 -18
- package/dist/domain/services/codebase-detector.d.ts.map +0 -1
- package/dist/domain/services/codebase-detector.js.map +0 -1
- package/dist/domain/services/cross-team-pattern-sharing.d.ts +0 -65
- package/dist/domain/services/cross-team-pattern-sharing.d.ts.map +0 -1
- package/dist/domain/services/cross-team-pattern-sharing.js.map +0 -1
- package/dist/domain/services/decision-recorder.d.ts +0 -76
- package/dist/domain/services/decision-recorder.d.ts.map +0 -1
- package/dist/domain/services/decision-recorder.js.map +0 -1
- package/dist/domain/services/decision-retriever.d.ts +0 -75
- package/dist/domain/services/decision-retriever.d.ts.map +0 -1
- package/dist/domain/services/decision-retriever.js.map +0 -1
- package/dist/domain/services/environment-mode-manager.d.ts +0 -12
- package/dist/domain/services/environment-mode-manager.d.ts.map +0 -1
- package/dist/domain/services/environment-mode-manager.js.map +0 -1
- package/dist/domain/services/graded-memory-activation.d.ts +0 -37
- package/dist/domain/services/graded-memory-activation.d.ts.map +0 -1
- package/dist/domain/services/graded-memory-activation.js.map +0 -1
- package/dist/domain/services/knowledge-access.d.ts +0 -63
- package/dist/domain/services/knowledge-access.d.ts.map +0 -1
- package/dist/domain/services/knowledge-access.js.map +0 -1
- package/dist/domain/services/knowledge-extractor.d.ts +0 -54
- package/dist/domain/services/knowledge-extractor.d.ts.map +0 -1
- package/dist/domain/services/knowledge-extractor.js.map +0 -1
- package/dist/domain/services/knowledge-graph-builder.d.ts +0 -70
- package/dist/domain/services/knowledge-graph-builder.d.ts.map +0 -1
- package/dist/domain/services/knowledge-graph-builder.js.map +0 -1
- package/dist/domain/services/knowledge-graph-query.d.ts +0 -69
- package/dist/domain/services/knowledge-graph-query.d.ts.map +0 -1
- package/dist/domain/services/knowledge-graph-query.js.map +0 -1
- package/dist/domain/services/memory-retriever.d.ts +0 -30
- package/dist/domain/services/memory-retriever.d.ts.map +0 -1
- package/dist/domain/services/memory-retriever.js.map +0 -1
- package/dist/domain/services/memory-synthesizer.d.ts +0 -57
- package/dist/domain/services/memory-synthesizer.d.ts.map +0 -1
- package/dist/domain/services/memory-synthesizer.js.map +0 -1
- package/dist/domain/services/pattern-extractor.d.ts +0 -108
- package/dist/domain/services/pattern-extractor.d.ts.map +0 -1
- package/dist/domain/services/pattern-extractor.js.map +0 -1
- package/dist/domain/services/query-intent-classifier.d.ts +0 -16
- package/dist/domain/services/query-intent-classifier.d.ts.map +0 -1
- package/dist/domain/services/query-intent-classifier.js.map +0 -1
- package/dist/domain/services/react-loop.d.ts +0 -52
- package/dist/domain/services/react-loop.d.ts.map +0 -1
- package/dist/domain/services/react-loop.js.map +0 -1
- package/dist/domain/services/risk-tier-detector.d.ts +0 -17
- package/dist/domain/services/risk-tier-detector.d.ts.map +0 -1
- package/dist/domain/services/risk-tier-detector.js.map +0 -1
- package/dist/edit.d.ts +0 -26
- package/dist/edit.d.ts 2.map +0 -1
- package/dist/edit.d.ts.map +0 -1
- package/dist/edit.js.map +0 -1
- package/dist/embed.d 2.ts +0 -14
- package/dist/embed.d.ts +0 -14
- package/dist/embed.d.ts.map +0 -1
- package/dist/embed.js.map +0 -1
- package/dist/error-handler.d 2.ts +0 -77
- package/dist/error-handler.d.ts +0 -77
- package/dist/error-handler.d.ts.map +0 -1
- package/dist/error-handler.js.map +0 -1
- package/dist/formatter 2.js +0 -168
- package/dist/formatter.d.ts +0 -25
- package/dist/formatter.d.ts 2.map +0 -1
- package/dist/formatter.d.ts.map +0 -1
- package/dist/formatter.js.map +0 -1
- package/dist/git 2.js +0 -198
- package/dist/git.d 2.ts +0 -55
- package/dist/git.d.ts +0 -55
- package/dist/git.d.ts.map +0 -1
- package/dist/git.js.map +0 -1
- package/dist/index 2.d.ts +0 -16
- package/dist/index 2.d.ts.map +0 -1
- package/dist/index 2.js +0 -429
- package/dist/index 2.js.map +0 -1
- package/dist/index-backup-before-lazy-loading.d.ts +0 -3
- package/dist/index-backup-before-lazy-loading.d.ts.map +0 -1
- package/dist/index-backup-before-lazy-loading.js +0 -1551
- package/dist/index-backup-before-lazy-loading.js.map +0 -1
- package/dist/index.d.ts +0 -16
- package/dist/index.d.ts 2.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js 2.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/infrastructure/ai/cohere-ai-service.d.ts +0 -71
- package/dist/infrastructure/ai/cohere-ai-service.d.ts.map +0 -1
- package/dist/infrastructure/ai/cohere-ai-service.js.map +0 -1
- package/dist/infrastructure/ai/command-r-evaluation.d.ts +0 -42
- package/dist/infrastructure/ai/command-r-evaluation.d.ts.map +0 -1
- package/dist/infrastructure/ai/command-r-evaluation.js.map +0 -1
- package/dist/infrastructure/ai/model-config.d.ts +0 -47
- package/dist/infrastructure/ai/model-config.d.ts.map +0 -1
- package/dist/infrastructure/ai/model-config.js.map +0 -1
- package/dist/infrastructure/ai/provider-ai-service.d.ts +0 -67
- package/dist/infrastructure/ai/provider-ai-service.d.ts.map +0 -1
- package/dist/infrastructure/ai/provider-ai-service.js.map +0 -1
- package/dist/infrastructure/cache/embedding-cache.d.ts +0 -58
- package/dist/infrastructure/cache/embedding-cache.d.ts.map +0 -1
- package/dist/infrastructure/cache/embedding-cache.js.map +0 -1
- package/dist/infrastructure/cache/query-result-cache.d.ts +0 -27
- package/dist/infrastructure/cache/query-result-cache.d.ts.map +0 -1
- package/dist/infrastructure/cache/query-result-cache.js.map +0 -1
- package/dist/infrastructure/cache/response-cache.d.ts +0 -18
- package/dist/infrastructure/cache/response-cache.d.ts.map +0 -1
- package/dist/infrastructure/cache/response-cache.js.map +0 -1
- package/dist/infrastructure/cache/security-scan-cache.d.ts +0 -16
- package/dist/infrastructure/cache/security-scan-cache.d.ts.map +0 -1
- package/dist/infrastructure/cache/security-scan-cache.js.map +0 -1
- package/dist/infrastructure/chunking/ast-code-chunker.d.ts +0 -12
- package/dist/infrastructure/chunking/ast-code-chunker.d.ts.map +0 -1
- package/dist/infrastructure/chunking/ast-code-chunker.js.map +0 -1
- package/dist/infrastructure/chunking/code-aware-chunker.d.ts +0 -63
- package/dist/infrastructure/chunking/code-aware-chunker.d.ts.map +0 -1
- package/dist/infrastructure/chunking/code-aware-chunker.js.map +0 -1
- package/dist/infrastructure/completion/bash-completion.d.ts +0 -7
- package/dist/infrastructure/completion/bash-completion.d.ts.map +0 -1
- package/dist/infrastructure/completion/bash-completion.js.map +0 -1
- package/dist/infrastructure/completion/fish-completion.d.ts +0 -7
- package/dist/infrastructure/completion/fish-completion.d.ts.map +0 -1
- package/dist/infrastructure/completion/fish-completion.js.map +0 -1
- package/dist/infrastructure/completion/zsh-completion.d.ts +0 -7
- package/dist/infrastructure/completion/zsh-completion.d.ts.map +0 -1
- package/dist/infrastructure/completion/zsh-completion.js.map +0 -1
- package/dist/infrastructure/config/config-manager.d.ts +0 -158
- package/dist/infrastructure/config/config-manager.d.ts.map +0 -1
- package/dist/infrastructure/config/config-manager.js.map +0 -1
- package/dist/infrastructure/context/context-compressor.d.ts +0 -94
- package/dist/infrastructure/context/context-compressor.d.ts.map +0 -1
- package/dist/infrastructure/context/context-compressor.js.map +0 -1
- package/dist/infrastructure/context/conversation-context.d.ts +0 -82
- package/dist/infrastructure/context/conversation-context.d.ts.map +0 -1
- package/dist/infrastructure/context/conversation-context.js.map +0 -1
- package/dist/infrastructure/context/direct-context-provider.d.ts +0 -18
- package/dist/infrastructure/context/direct-context-provider.d.ts.map +0 -1
- package/dist/infrastructure/context/direct-context-provider.js +0 -222
- package/dist/infrastructure/context/direct-context-provider.js.map +0 -1
- package/dist/infrastructure/context/git-context-provider.d.ts +0 -30
- package/dist/infrastructure/context/git-context-provider.d.ts.map +0 -1
- package/dist/infrastructure/context/git-context-provider.js +0 -140
- package/dist/infrastructure/context/git-context-provider.js.map +0 -1
- package/dist/infrastructure/context/project-context-loader.d.ts +0 -35
- package/dist/infrastructure/context/project-context-loader.d.ts.map +0 -1
- package/dist/infrastructure/context/project-context-loader.js +0 -184
- package/dist/infrastructure/context/project-context-loader.js.map +0 -1
- package/dist/infrastructure/context/session-manager.d.ts +0 -42
- package/dist/infrastructure/context/session-manager.d.ts.map +0 -1
- package/dist/infrastructure/context/session-manager.js.map +0 -1
- package/dist/infrastructure/cost/cost-tracker.d.ts +0 -91
- package/dist/infrastructure/cost/cost-tracker.d.ts.map +0 -1
- package/dist/infrastructure/cost/cost-tracker.js.map +0 -1
- package/dist/infrastructure/cost/session-token-tracker.d.ts +0 -68
- package/dist/infrastructure/cost/session-token-tracker.d.ts.map +0 -1
- package/dist/infrastructure/cost/session-token-tracker.js +0 -178
- package/dist/infrastructure/cost/session-token-tracker.js.map +0 -1
- package/dist/infrastructure/cost-calculator.d.ts +0 -34
- package/dist/infrastructure/cost-calculator.d.ts.map +0 -1
- package/dist/infrastructure/cost-calculator.js +0 -145
- package/dist/infrastructure/cost-calculator.js.map +0 -1
- package/dist/infrastructure/cost-estimator.d.ts +0 -48
- package/dist/infrastructure/cost-estimator.d.ts.map +0 -1
- package/dist/infrastructure/cost-estimator.js +0 -201
- package/dist/infrastructure/cost-estimator.js.map +0 -1
- package/dist/infrastructure/file-scanner/file-scanner.d.ts +0 -31
- package/dist/infrastructure/file-scanner/file-scanner.d.ts.map +0 -1
- package/dist/infrastructure/file-scanner/file-scanner.js.map +0 -1
- package/dist/infrastructure/governance/nist-ai-rmf.d.ts +0 -105
- package/dist/infrastructure/governance/nist-ai-rmf.d.ts.map +0 -1
- package/dist/infrastructure/governance/nist-ai-rmf.js.map +0 -1
- package/dist/infrastructure/governance/policy-as-code.d.ts +0 -88
- package/dist/infrastructure/governance/policy-as-code.d.ts.map +0 -1
- package/dist/infrastructure/governance/policy-as-code.js.map +0 -1
- package/dist/infrastructure/governance/prompt-to-code-lineage.d.ts +0 -136
- package/dist/infrastructure/governance/prompt-to-code-lineage.d.ts.map +0 -1
- package/dist/infrastructure/governance/prompt-to-code-lineage.js.map +0 -1
- package/dist/infrastructure/index.d.ts +0 -7
- package/dist/infrastructure/index.d.ts.map +0 -1
- package/dist/infrastructure/index.js.map +0 -1
- package/dist/infrastructure/observability/execution-tracer.d.ts +0 -130
- package/dist/infrastructure/observability/execution-tracer.d.ts.map +0 -1
- package/dist/infrastructure/observability/execution-tracer.js.map +0 -1
- package/dist/infrastructure/observability/prompt-versioner.d.ts +0 -67
- package/dist/infrastructure/observability/prompt-versioner.d.ts.map +0 -1
- package/dist/infrastructure/observability/prompt-versioner.js.map +0 -1
- package/dist/infrastructure/protocols/a2a-metadata.d.ts +0 -278
- package/dist/infrastructure/protocols/a2a-metadata.d.ts.map +0 -1
- package/dist/infrastructure/protocols/a2a-metadata.js.map +0 -1
- package/dist/infrastructure/protocols/a2a-protocol.d.ts +0 -132
- package/dist/infrastructure/protocols/a2a-protocol.d.ts.map +0 -1
- package/dist/infrastructure/protocols/a2a-protocol.js.map +0 -1
- package/dist/infrastructure/protocols/mcp-oauth.d.ts +0 -91
- package/dist/infrastructure/protocols/mcp-oauth.d.ts.map +0 -1
- package/dist/infrastructure/protocols/mcp-oauth.js.map +0 -1
- package/dist/infrastructure/protocols/mcp-server.d.ts +0 -126
- package/dist/infrastructure/protocols/mcp-server.d.ts.map +0 -1
- package/dist/infrastructure/protocols/mcp-server.js.map +0 -1
- package/dist/infrastructure/protocols/streaming-handler.d.ts +0 -57
- package/dist/infrastructure/protocols/streaming-handler.d.ts.map +0 -1
- package/dist/infrastructure/protocols/streaming-handler.js.map +0 -1
- package/dist/infrastructure/providers/cohere-provider.d.ts +0 -39
- package/dist/infrastructure/providers/cohere-provider.d.ts.map +0 -1
- package/dist/infrastructure/providers/cohere-provider.js.map +0 -1
- package/dist/infrastructure/providers/fake-provider.d.ts +0 -43
- package/dist/infrastructure/providers/fake-provider.d.ts.map +0 -1
- package/dist/infrastructure/providers/fake-provider.js.map +0 -1
- package/dist/infrastructure/providers/local-llm-provider.d.ts +0 -49
- package/dist/infrastructure/providers/local-llm-provider.d.ts.map +0 -1
- package/dist/infrastructure/providers/local-llm-provider.js.map +0 -1
- package/dist/infrastructure/providers/model-config.types.d.ts +0 -70
- package/dist/infrastructure/providers/model-config.types.d.ts.map +0 -1
- package/dist/infrastructure/providers/model-config.types.js.map +0 -1
- package/dist/infrastructure/providers/model-provider.interface.d.ts +0 -113
- package/dist/infrastructure/providers/model-provider.interface.d.ts.map +0 -1
- package/dist/infrastructure/providers/model-provider.interface.js.map +0 -1
- package/dist/infrastructure/providers/openai-provider.d.ts +0 -38
- package/dist/infrastructure/providers/openai-provider.d.ts.map +0 -1
- package/dist/infrastructure/providers/openai-provider.js.map +0 -1
- package/dist/infrastructure/providers/openrouter-provider.d.ts +0 -42
- package/dist/infrastructure/providers/openrouter-provider.d.ts.map +0 -1
- package/dist/infrastructure/providers/openrouter-provider.js.map +0 -1
- package/dist/infrastructure/providers/operation-provider-resolver.d.ts +0 -48
- package/dist/infrastructure/providers/operation-provider-resolver.d.ts.map +0 -1
- package/dist/infrastructure/providers/operation-provider-resolver.js.map +0 -1
- package/dist/infrastructure/providers/provider-config-loader.d.ts +0 -37
- package/dist/infrastructure/providers/provider-config-loader.d.ts.map +0 -1
- package/dist/infrastructure/providers/provider-config-loader.js.map +0 -1
- package/dist/infrastructure/providers/provider-registry.d.ts +0 -53
- package/dist/infrastructure/providers/provider-registry.d.ts.map +0 -1
- package/dist/infrastructure/providers/provider-registry.js.map +0 -1
- package/dist/infrastructure/security/ai-sast-scanner.d.ts +0 -59
- package/dist/infrastructure/security/ai-sast-scanner.d.ts.map +0 -1
- package/dist/infrastructure/security/ai-sast-scanner.js.map +0 -1
- package/dist/infrastructure/security/docker-sandbox.d.ts +0 -57
- package/dist/infrastructure/security/docker-sandbox.d.ts.map +0 -1
- package/dist/infrastructure/security/docker-sandbox.js.map +0 -1
- package/dist/infrastructure/security/enhanced-security-gate.d.ts +0 -66
- package/dist/infrastructure/security/enhanced-security-gate.d.ts.map +0 -1
- package/dist/infrastructure/security/enhanced-security-gate.js.map +0 -1
- package/dist/infrastructure/security/input-validator.d.ts +0 -46
- package/dist/infrastructure/security/input-validator.d.ts.map +0 -1
- package/dist/infrastructure/security/input-validator.js.map +0 -1
- package/dist/infrastructure/security/license-scanner.d.ts +0 -55
- package/dist/infrastructure/security/license-scanner.d.ts.map +0 -1
- package/dist/infrastructure/security/license-scanner.js.map +0 -1
- package/dist/infrastructure/security/provider-bias-detector.d.ts +0 -53
- package/dist/infrastructure/security/provider-bias-detector.d.ts.map +0 -1
- package/dist/infrastructure/security/provider-bias-detector.js.map +0 -1
- package/dist/infrastructure/security/sandbox-executor.d.ts +0 -34
- package/dist/infrastructure/security/sandbox-executor.d.ts.map +0 -1
- package/dist/infrastructure/security/sandbox-executor.js.map +0 -1
- package/dist/infrastructure/serialization/toon-serializer.d.ts +0 -45
- package/dist/infrastructure/serialization/toon-serializer.d.ts.map +0 -1
- package/dist/infrastructure/serialization/toon-serializer.js.map +0 -1
- package/dist/infrastructure/storage/embeddings-path.d.ts +0 -18
- package/dist/infrastructure/storage/embeddings-path.d.ts.map +0 -1
- package/dist/infrastructure/storage/embeddings-path.js.map +0 -1
- package/dist/infrastructure/storage/memory-stream-service.d.ts +0 -47
- package/dist/infrastructure/storage/memory-stream-service.d.ts.map +0 -1
- package/dist/infrastructure/storage/memory-stream-service.js.map +0 -1
- package/dist/infrastructure/storage/plan-repository.d.ts +0 -40
- package/dist/infrastructure/storage/plan-repository.d.ts.map +0 -1
- package/dist/infrastructure/storage/plan-repository.js.map +0 -1
- package/dist/infrastructure/storage/sqlite-context-repository.d.ts +0 -95
- package/dist/infrastructure/storage/sqlite-context-repository.d.ts.map +0 -1
- package/dist/infrastructure/storage/sqlite-context-repository.js +0 -467
- package/dist/infrastructure/storage/sqlite-context-repository.js.map +0 -1
- package/dist/infrastructure/storage/sqlite-decision-repository.d.ts +0 -29
- package/dist/infrastructure/storage/sqlite-decision-repository.d.ts.map +0 -1
- package/dist/infrastructure/storage/sqlite-decision-repository.js.map +0 -1
- package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts +0 -47
- package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts.map +0 -1
- package/dist/infrastructure/storage/sqlite-embedding-repository.js.map +0 -1
- package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.d.ts +0 -41
- package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.d.ts.map +0 -1
- package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.js.map +0 -1
- package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.d.ts +0 -29
- package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.d.ts.map +0 -1
- package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.js.map +0 -1
- package/dist/infrastructure/storage/sqlite-memory-repository.d.ts +0 -40
- package/dist/infrastructure/storage/sqlite-memory-repository.d.ts.map +0 -1
- package/dist/infrastructure/storage/sqlite-memory-repository.js.map +0 -1
- package/dist/infrastructure/storage/sqlite-pattern-repository.d.ts +0 -25
- package/dist/infrastructure/storage/sqlite-pattern-repository.d.ts.map +0 -1
- package/dist/infrastructure/storage/sqlite-pattern-repository.js.map +0 -1
- package/dist/infrastructure/storage/task-helpers.d.ts +0 -69
- package/dist/infrastructure/storage/task-helpers.d.ts.map +0 -1
- package/dist/infrastructure/storage/task-helpers.js.map +0 -1
- package/dist/infrastructure/storage/task-repository.d.ts +0 -67
- package/dist/infrastructure/storage/task-repository.d.ts.map +0 -1
- package/dist/infrastructure/storage/task-repository.js.map +0 -1
- package/dist/infrastructure/telemetry/telemetry-service.d.ts +0 -74
- package/dist/infrastructure/telemetry/telemetry-service.d.ts.map +0 -1
- package/dist/infrastructure/telemetry/telemetry-service.js.map +0 -1
- package/dist/infrastructure/ux/appropriate-friction.d.ts +0 -77
- package/dist/infrastructure/ux/appropriate-friction.d.ts.map +0 -1
- package/dist/infrastructure/ux/appropriate-friction.js.map +0 -1
- package/dist/infrastructure/ux/bi-directional-learning.d.ts +0 -131
- package/dist/infrastructure/ux/bi-directional-learning.d.ts.map +0 -1
- package/dist/infrastructure/ux/bi-directional-learning.js.map +0 -1
- package/dist/infrastructure/ux/capability-boundaries.d.ts +0 -22
- package/dist/infrastructure/ux/capability-boundaries.d.ts.map +0 -1
- package/dist/infrastructure/ux/capability-boundaries.js.map +0 -1
- package/dist/infrastructure/ux/cli-style-guide.d.ts +0 -105
- package/dist/infrastructure/ux/cli-style-guide.d.ts.map +0 -1
- package/dist/infrastructure/ux/cli-style-guide.js +0 -220
- package/dist/infrastructure/ux/cli-style-guide.js.map +0 -1
- package/dist/infrastructure/ux/comprehensive-formatter.d.ts +0 -21
- package/dist/infrastructure/ux/comprehensive-formatter.d.ts.map +0 -1
- package/dist/infrastructure/ux/comprehensive-formatter.js.map +0 -1
- package/dist/infrastructure/ux/contextual-feature-discovery.d.ts +0 -11
- package/dist/infrastructure/ux/contextual-feature-discovery.d.ts.map +0 -1
- package/dist/infrastructure/ux/contextual-feature-discovery.js.map +0 -1
- package/dist/infrastructure/ux/expectation-management.d.ts +0 -98
- package/dist/infrastructure/ux/expectation-management.d.ts.map +0 -1
- package/dist/infrastructure/ux/expectation-management.js.map +0 -1
- package/dist/infrastructure/ux/feature-discovery.d.ts +0 -17
- package/dist/infrastructure/ux/feature-discovery.d.ts.map +0 -1
- package/dist/infrastructure/ux/feature-discovery.js.map +0 -1
- package/dist/infrastructure/ux/feedback-prompt.d.ts +0 -26
- package/dist/infrastructure/ux/feedback-prompt.d.ts.map +0 -1
- package/dist/infrastructure/ux/feedback-prompt.js.map +0 -1
- package/dist/infrastructure/ux/hitl-validation.d.ts +0 -139
- package/dist/infrastructure/ux/hitl-validation.d.ts.map +0 -1
- package/dist/infrastructure/ux/hitl-validation.js.map +0 -1
- package/dist/infrastructure/ux/progress-indicator.d.ts +0 -53
- package/dist/infrastructure/ux/progress-indicator.d.ts.map +0 -1
- package/dist/infrastructure/ux/progress-indicator.js.map +0 -1
- package/dist/infrastructure/ux/progressive-disclosure.d.ts +0 -84
- package/dist/infrastructure/ux/progressive-disclosure.d.ts.map +0 -1
- package/dist/infrastructure/ux/progressive-disclosure.js.map +0 -1
- package/dist/infrastructure/ux/review-checkpoint.d.ts +0 -37
- package/dist/infrastructure/ux/review-checkpoint.d.ts.map +0 -1
- package/dist/infrastructure/ux/review-checkpoint.js.map +0 -1
- package/dist/infrastructure/ux/staged-feature-intro.d.ts +0 -22
- package/dist/infrastructure/ux/staged-feature-intro.d.ts.map +0 -1
- package/dist/infrastructure/ux/staged-feature-intro.js.map +0 -1
- package/dist/infrastructure/ux/syntax-highlighter.d.ts +0 -20
- package/dist/infrastructure/ux/syntax-highlighter.d.ts.map +0 -1
- package/dist/infrastructure/ux/syntax-highlighter.js.map +0 -1
- package/dist/infrastructure/ux/team-standards.d.ts +0 -94
- package/dist/infrastructure/ux/team-standards.d.ts.map +0 -1
- package/dist/infrastructure/ux/team-standards.js.map +0 -1
- package/dist/infrastructure/validation/agent-feedback.d.ts +0 -57
- package/dist/infrastructure/validation/agent-feedback.d.ts.map +0 -1
- package/dist/infrastructure/validation/agent-feedback.js.map +0 -1
- package/dist/infrastructure/validation/agent-validation-helper.d.ts +0 -75
- package/dist/infrastructure/validation/agent-validation-helper.d.ts.map +0 -1
- package/dist/infrastructure/validation/agent-validation-helper.js.map +0 -1
- package/dist/infrastructure/validation/hallucination-detector.d.ts +0 -121
- package/dist/infrastructure/validation/hallucination-detector.d.ts.map +0 -1
- package/dist/infrastructure/validation/hallucination-detector.js +0 -388
- package/dist/infrastructure/validation/hallucination-detector.js.map +0 -1
- package/dist/infrastructure/validation/review-handler.d.ts +0 -26
- package/dist/infrastructure/validation/review-handler.d.ts.map +0 -1
- package/dist/infrastructure/validation/review-handler.js.map +0 -1
- package/dist/infrastructure/validation/summary-aggregator.d.ts +0 -45
- package/dist/infrastructure/validation/summary-aggregator.d.ts.map +0 -1
- package/dist/infrastructure/validation/summary-aggregator.js.map +0 -1
- package/dist/infrastructure/validation/summary-extractor.d.ts +0 -24
- package/dist/infrastructure/validation/summary-extractor.d.ts.map +0 -1
- package/dist/infrastructure/validation/summary-extractor.js.map +0 -1
- package/dist/infrastructure/validation/trace-summary.d.ts +0 -45
- package/dist/infrastructure/validation/trace-summary.d.ts.map +0 -1
- package/dist/infrastructure/validation/trace-summary.js.map +0 -1
- package/dist/infrastructure/verification/verification-service.d.ts +0 -12
- package/dist/infrastructure/verification/verification-service.d.ts.map +0 -1
- package/dist/infrastructure/verification/verification-service.js.map +0 -1
- package/dist/infrastructure/xai/attention-visualizer.d.ts +0 -71
- package/dist/infrastructure/xai/attention-visualizer.d.ts.map +0 -1
- package/dist/infrastructure/xai/attention-visualizer.js.map +0 -1
- package/dist/infrastructure/xai/cot-visualizer.d.ts +0 -103
- package/dist/infrastructure/xai/cot-visualizer.d.ts.map +0 -1
- package/dist/infrastructure/xai/cot-visualizer.js.map +0 -1
- package/dist/infrastructure/xai/decision-tree-log.d.ts +0 -100
- package/dist/infrastructure/xai/decision-tree-log.d.ts.map +0 -1
- package/dist/infrastructure/xai/decision-tree-log.js.map +0 -1
- package/dist/infrastructure/xai/interactive-xai.d.ts +0 -104
- package/dist/infrastructure/xai/interactive-xai.d.ts.map +0 -1
- package/dist/infrastructure/xai/interactive-xai.js.map +0 -1
- package/dist/infrastructure/xai/uncertainty-quantifier.d.ts +0 -77
- package/dist/infrastructure/xai/uncertainty-quantifier.d.ts.map +0 -1
- package/dist/infrastructure/xai/uncertainty-quantifier.js.map +0 -1
- package/dist/intelligent-retrieval 2.js +0 -272
- package/dist/intelligent-retrieval.d.ts +0 -41
- package/dist/intelligent-retrieval.d.ts 2.map +0 -1
- package/dist/intelligent-retrieval.d.ts.map +0 -1
- package/dist/intelligent-retrieval.js.map +0 -1
- package/dist/intent/classifier.d.ts +0 -6
- package/dist/intent/classifier.d.ts.map +0 -1
- package/dist/intent/classifier.js.map +0 -1
- package/dist/intent/context.d.ts +0 -4
- package/dist/intent/context.d.ts.map +0 -1
- package/dist/intent/context.js.map +0 -1
- package/dist/iterative-refinement.d.ts +0 -31
- package/dist/iterative-refinement.d.ts.map +0 -1
- package/dist/iterative-refinement.js.map +0 -1
- package/dist/learning.d.ts +0 -69
- package/dist/learning.d.ts.map +0 -1
- package/dist/learning.js.map +0 -1
- package/dist/log.d.ts +0 -4
- package/dist/log.d.ts.map +0 -1
- package/dist/log.js 2.map +0 -1
- package/dist/log.js.map +0 -1
- package/dist/migrate.d.ts +0 -33
- package/dist/migrate.d.ts.map +0 -1
- package/dist/migrate.js 2.map +0 -1
- package/dist/migrate.js.map +0 -1
- package/dist/monitoring.d.ts +0 -75
- package/dist/monitoring.d.ts.map +0 -1
- package/dist/monitoring.js.map +0 -1
- package/dist/parallel-processor.d 2.ts +0 -44
- package/dist/parallel-processor.d.ts +0 -44
- package/dist/parallel-processor.d.ts.map +0 -1
- package/dist/parallel-processor.js.map +0 -1
- package/dist/planner.d.ts +0 -47
- package/dist/planner.d.ts.map +0 -1
- package/dist/planner.js.map +0 -1
- package/dist/policy.d 2.ts +0 -3
- package/dist/policy.d.ts +0 -3
- package/dist/policy.d.ts.map +0 -1
- package/dist/policy.js.map +0 -1
- package/dist/presentation/cli/commands/ask-command.d.ts +0 -9
- package/dist/presentation/cli/commands/ask-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/ask-command.js.map +0 -1
- package/dist/presentation/cli/commands/audit-command.d.ts +0 -13
- package/dist/presentation/cli/commands/audit-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/audit-command.js +0 -96
- package/dist/presentation/cli/commands/audit-command.js.map +0 -1
- package/dist/presentation/cli/commands/config-command.d.ts +0 -9
- package/dist/presentation/cli/commands/config-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/config-command.js.map +0 -1
- package/dist/presentation/cli/commands/context-command.d.ts +0 -32
- package/dist/presentation/cli/commands/context-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/context-command.js +0 -295
- package/dist/presentation/cli/commands/context-command.js.map +0 -1
- package/dist/presentation/cli/commands/context-helper.d.ts +0 -16
- package/dist/presentation/cli/commands/context-helper.d.ts.map +0 -1
- package/dist/presentation/cli/commands/context-helper.js +0 -88
- package/dist/presentation/cli/commands/context-helper.js.map +0 -1
- package/dist/presentation/cli/commands/cost-command.d.ts +0 -8
- package/dist/presentation/cli/commands/cost-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/cost-command.js.map +0 -1
- package/dist/presentation/cli/commands/decision-command.d.ts +0 -12
- package/dist/presentation/cli/commands/decision-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/decision-command.js.map +0 -1
- package/dist/presentation/cli/commands/docs-command.d.ts +0 -14
- package/dist/presentation/cli/commands/docs-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/docs-command.js.map +0 -1
- package/dist/presentation/cli/commands/fix-command.d.ts +0 -15
- package/dist/presentation/cli/commands/fix-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/fix-command.js.map +0 -1
- package/dist/presentation/cli/commands/help-command.d.ts +0 -9
- package/dist/presentation/cli/commands/help-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/help-command.js.map +0 -1
- package/dist/presentation/cli/commands/knowledge-command.d.ts +0 -13
- package/dist/presentation/cli/commands/knowledge-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/knowledge-command.js.map +0 -1
- package/dist/presentation/cli/commands/learning-dashboard-command.d.ts +0 -8
- package/dist/presentation/cli/commands/learning-dashboard-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/learning-dashboard-command.js.map +0 -1
- package/dist/presentation/cli/commands/models-command.d.ts +0 -13
- package/dist/presentation/cli/commands/models-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/models-command.js.map +0 -1
- package/dist/presentation/cli/commands/orchestrate-command.d.ts +0 -10
- package/dist/presentation/cli/commands/orchestrate-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/orchestrate-command.js.map +0 -1
- package/dist/presentation/cli/commands/plan-command.d.ts +0 -9
- package/dist/presentation/cli/commands/plan-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/plan-command.js.map +0 -1
- package/dist/presentation/cli/commands/product-command.d.ts +0 -14
- package/dist/presentation/cli/commands/product-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/product-command.js.map +0 -1
- package/dist/presentation/cli/commands/react-command.d.ts +0 -8
- package/dist/presentation/cli/commands/react-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/react-command.js.map +0 -1
- package/dist/presentation/cli/commands/review-command.d.ts +0 -14
- package/dist/presentation/cli/commands/review-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/review-command.js.map +0 -1
- package/dist/presentation/cli/commands/run-command.d.ts +0 -13
- package/dist/presentation/cli/commands/run-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/run-command.js.map +0 -1
- package/dist/presentation/cli/commands/setup-command.d.ts +0 -10
- package/dist/presentation/cli/commands/setup-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/setup-command.js.map +0 -1
- package/dist/presentation/cli/commands/smart-command.d.ts +0 -11
- package/dist/presentation/cli/commands/smart-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/smart-command.js.map +0 -1
- package/dist/presentation/cli/commands/status-command.d.ts +0 -14
- package/dist/presentation/cli/commands/status-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/status-command.js.map +0 -1
- package/dist/presentation/cli/commands/suggest-command.d.ts +0 -11
- package/dist/presentation/cli/commands/suggest-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/suggest-command.js.map +0 -1
- package/dist/presentation/cli/commands/trace-command.d.ts +0 -8
- package/dist/presentation/cli/commands/trace-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/trace-command.js.map +0 -1
- package/dist/presentation/cli/commands/trust-command.d.ts +0 -28
- package/dist/presentation/cli/commands/trust-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/trust-command.js.map +0 -1
- package/dist/presentation/cli/commands/undo-command.d.ts +0 -8
- package/dist/presentation/cli/commands/undo-command.d.ts.map +0 -1
- package/dist/presentation/cli/commands/undo-command.js.map +0 -1
- package/dist/presentation/cli/error-display.d.ts +0 -25
- package/dist/presentation/cli/error-display.d.ts.map +0 -1
- package/dist/presentation/cli/error-display.js.map +0 -1
- package/dist/query-optimizer.d.ts +0 -32
- package/dist/query-optimizer.d.ts.map +0 -1
- package/dist/query-optimizer.js.map +0 -1
- package/dist/refactor.d.ts +0 -27
- package/dist/refactor.d.ts.map +0 -1
- package/dist/refactor.js.map +0 -1
- package/dist/review 2.js +0 -206
- package/dist/review.d.ts +0 -31
- package/dist/review.d.ts.map +0 -1
- package/dist/review.js.map +0 -1
- package/dist/search.d.ts +0 -19
- package/dist/search.d.ts.map +0 -1
- package/dist/search.js 2.map +0 -1
- package/dist/search.js.map +0 -1
- package/dist/session 2.js +0 -593
- package/dist/session.d.ts +0 -17
- package/dist/session.d.ts 2.map +0 -1
- package/dist/session.d.ts.map +0 -1
- package/dist/session.js.map +0 -1
- package/dist/task-verification 2.js +0 -336
- package/dist/task-verification.d.ts +0 -39
- package/dist/task-verification.d.ts 2.map +0 -1
- package/dist/task-verification.d.ts.map +0 -1
- package/dist/task-verification.js.map +0 -1
- package/dist/test-minimal.d.ts +0 -2
- package/dist/test-minimal.d.ts.map +0 -1
- package/dist/test-minimal.js +0 -2
- package/dist/test-minimal.js.map +0 -1
- package/dist/testgen.d.ts +0 -24
- package/dist/testgen.d.ts.map +0 -1
- package/dist/testgen.js 2.map +0 -1
- package/dist/testgen.js.map +0 -1
- package/dist/token-optimizer.d 2.ts +0 -20
- package/dist/token-optimizer.d.ts +0 -20
- package/dist/token-optimizer.d.ts.map +0 -1
- package/dist/token-optimizer.js.map +0 -1
- package/dist/tools/bash.d.ts +0 -53
- package/dist/tools/bash.d.ts.map +0 -1
- package/dist/tools/bash.js.map +0 -1
- package/dist/tools/edit.d.ts +0 -48
- package/dist/tools/edit.d.ts.map +0 -1
- package/dist/tools/edit.js.map +0 -1
- package/dist/tools/executor.d.ts +0 -29
- package/dist/tools/executor.d.ts.map +0 -1
- package/dist/tools/executor.js.map +0 -1
- package/dist/tools/git-tool.d.ts +0 -87
- package/dist/tools/git-tool.d.ts.map +0 -1
- package/dist/tools/git-tool.js.map +0 -1
- package/dist/tools/parser.d.ts +0 -33
- package/dist/tools/parser.d.ts.map +0 -1
- package/dist/tools/parser.js.map +0 -1
- package/dist/tools/registry.d.ts +0 -74
- package/dist/tools/registry.d.ts.map +0 -1
- package/dist/tools/registry.js.map +0 -1
- package/dist/tools/search.d.ts +0 -41
- package/dist/tools/search.d.ts.map +0 -1
- package/dist/tools/search.js.map +0 -1
- package/dist/types.d.ts +0 -36
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/ui.d.ts +0 -60
- package/dist/ui.d.ts 2.map +0 -1
- package/dist/ui.d.ts.map +0 -1
- package/dist/ui.js.map +0 -1
- package/dist/utils/check-api-status.d.ts +0 -12
- package/dist/utils/check-api-status.d.ts.map +0 -1
- package/dist/utils/check-api-status.js.map +0 -1
- package/dist/utils/debug.d.ts +0 -7
- package/dist/utils/debug.d.ts.map +0 -1
- package/dist/utils/debug.js +0 -24
- package/dist/utils/debug.js.map +0 -1
- package/dist/utils/diff-parser.d.ts +0 -22
- package/dist/utils/diff-parser.d.ts.map +0 -1
- package/dist/utils/diff-parser.js.map +0 -1
- package/dist/utils/provider-check.d.ts +0 -21
- package/dist/utils/provider-check.d.ts.map +0 -1
- package/dist/utils/provider-check.js +0 -124
- package/dist/utils/provider-check.js.map +0 -1
- package/dist/utils/version.d.ts +0 -21
- package/dist/utils/version.d.ts.map +0 -1
- package/dist/utils/version.js.map +0 -1
- package/dist/verification/backup.d.ts +0 -30
- package/dist/verification/backup.d.ts.map +0 -1
- package/dist/verification/backup.js.map +0 -1
- package/dist/verification/compiler.d.ts +0 -20
- package/dist/verification/compiler.d.ts.map +0 -1
- package/dist/verification/compiler.js.map +0 -1
- package/dist/verification/index.d.ts +0 -59
- package/dist/verification/index.d.ts.map +0 -1
- package/dist/verification/index.js.map +0 -1
- package/dist/verification/test-runner.d.ts +0 -27
- package/dist/verification/test-runner.d.ts.map +0 -1
- package/dist/verification/test-runner.js.map +0 -1
- package/dist/verify_db.d.ts +0 -2
- package/dist/verify_db.d.ts.map +0 -1
- package/dist/verify_db.js +0 -52
- package/dist/verify_db.js 2.map +0 -1
- package/dist/verify_db.js.map +0 -1
|
@@ -35,9 +35,8 @@ export class ReActOrchestrationUseCase {
|
|
|
35
35
|
// 2. Get available tools for context
|
|
36
36
|
const { getToolRegistry } = await import('../../tools/registry.js');
|
|
37
37
|
const toolRegistry = getToolRegistry();
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
const availableTools = toolRegistry.getToolList(); // Returns formatted string
|
|
38
|
+
// getToolList() returns a string, getAll() returns Tool[] array
|
|
39
|
+
const availableTools = toolRegistry.getAll().map(tool => tool.name); // Get array of tool names
|
|
41
40
|
// 3. Log goal interpretation (XAI Foundation - Research: Full auditability required)
|
|
42
41
|
const goalId = `goal-${Date.now()}`;
|
|
43
42
|
const goalInterpretation = {
|
|
@@ -99,14 +98,9 @@ export class ReActOrchestrationUseCase {
|
|
|
99
98
|
toolName: action.name,
|
|
100
99
|
parameters: action.parameters || {},
|
|
101
100
|
reasoning: `Tool selected based on thought and available context`,
|
|
102
|
-
alternativeTools:
|
|
103
|
-
?
|
|
104
|
-
:
|
|
105
|
-
? context.availableTools.filter((t) => {
|
|
106
|
-
const toolName = typeof t === 'string' ? t : t.name || t;
|
|
107
|
-
return toolName !== action.name;
|
|
108
|
-
}).slice(0, 3)
|
|
109
|
-
: [],
|
|
101
|
+
alternativeTools: Array.isArray(context.availableTools)
|
|
102
|
+
? context.availableTools.filter((t) => t !== action.name).slice(0, 3)
|
|
103
|
+
: [],
|
|
110
104
|
};
|
|
111
105
|
this.decisionTreeLog.logToolExecution(toolId, toolRationale, context.goalId || goalId);
|
|
112
106
|
// Store tool ID for linking observation
|
|
@@ -130,9 +124,7 @@ export class ReActOrchestrationUseCase {
|
|
|
130
124
|
// Add observation to CoT trajectory (XAI Foundation - Research: CoT visualization)
|
|
131
125
|
if (this.cotVisualizer && cotTrajectory) {
|
|
132
126
|
const obsContent = observation.success
|
|
133
|
-
? (
|
|
134
|
-
? observation.result
|
|
135
|
-
: JSON.stringify(observation.result, null, 2)).substring(0, 500) // Truncate for display
|
|
127
|
+
? String(observation.result).substring(0, 500) // Truncate for display
|
|
136
128
|
: `Error: ${observation.error || 'Failed'}`;
|
|
137
129
|
this.cotVisualizer.addObservation(cotTrajectory, obsContent, {
|
|
138
130
|
success: observation.success,
|
|
@@ -141,29 +133,9 @@ export class ReActOrchestrationUseCase {
|
|
|
141
133
|
}
|
|
142
134
|
// Stream observation result if handler provided
|
|
143
135
|
if (request.streamHandler?.onObservation) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
obsDesc = `✓ ${observation.result}`;
|
|
148
|
-
}
|
|
149
|
-
else if (observation.result === null || observation.result === undefined) {
|
|
150
|
-
obsDesc = '✓ No result';
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
// Try to stringify, but handle circular references and large objects
|
|
154
|
-
try {
|
|
155
|
-
const serialized = JSON.stringify(observation.result, null, 2);
|
|
156
|
-
obsDesc = `✓ ${serialized.substring(0, 200)}${serialized.length > 200 ? '...' : ''}`;
|
|
157
|
-
}
|
|
158
|
-
catch (e) {
|
|
159
|
-
// Fallback for objects that can't be stringified
|
|
160
|
-
obsDesc = `✓ ${String(observation.result).substring(0, 200)}`;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
obsDesc = `✗ ${observation.error || 'Failed'}`;
|
|
166
|
-
}
|
|
136
|
+
const obsDesc = observation.success
|
|
137
|
+
? `✓ ${String(observation.result).substring(0, 100)}`
|
|
138
|
+
: `✗ ${observation.error || 'Failed'}`;
|
|
167
139
|
request.streamHandler.onObservation(obsDesc);
|
|
168
140
|
}
|
|
169
141
|
// Log error if execution failed (XAI Foundation - Research: Error Trace for Fault Attribution)
|
|
@@ -245,12 +217,7 @@ Thought:`;
|
|
|
245
217
|
};
|
|
246
218
|
}
|
|
247
219
|
async generateAction(thought, context) {
|
|
248
|
-
|
|
249
|
-
const availableTools = typeof context.availableTools === 'string'
|
|
250
|
-
? context.availableTools
|
|
251
|
-
: Array.isArray(context.availableTools)
|
|
252
|
-
? context.availableTools.map((t) => `- ${t}: ${typeof t === 'string' ? t : t.name || t}`).join('\n')
|
|
253
|
-
: 'No tools available';
|
|
220
|
+
const availableTools = context.availableTools || 'No tools available';
|
|
254
221
|
const trajectory = context.trajectory || { steps: [] };
|
|
255
222
|
const trajectoryContext = trajectory.steps.length > 0
|
|
256
223
|
? `\n\nPrevious actions:\n${trajectory.steps.map((s, i) => `${i + 1}. ${s.action.type}: ${s.action.name} - ${s.observation.success ? 'Success' : 'Failed: ' + (s.observation.error || 'Unknown')}`).join('\n')}`
|
package/dist/chat.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { config } from 'dotenv';
|
|
2
2
|
import { join, dirname } from 'path';
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
|
-
import { retryWithBackoff,
|
|
4
|
+
import { retryWithBackoff, handleError } from './error-handler.js';
|
|
5
5
|
import { optimizeContext } from './token-optimizer.js';
|
|
6
6
|
import { optimizeQuery } from './query-optimizer.js';
|
|
7
|
-
import { ProviderRegistry } from './infrastructure/providers/provider-registry.js';
|
|
8
|
-
import { OperationProviderResolver } from './infrastructure/providers/operation-provider-resolver.js';
|
|
9
7
|
// Load .env from agent directory
|
|
10
8
|
try {
|
|
11
9
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -17,46 +15,112 @@ catch {
|
|
|
17
15
|
// Fallback
|
|
18
16
|
}
|
|
19
17
|
config(); // Also try current directory
|
|
18
|
+
async function chatCompletion(prompt) {
|
|
19
|
+
// Route to available provider
|
|
20
|
+
if (process.env.ANTHROPIC_API_KEY) {
|
|
21
|
+
const response = await fetch('https://api.anthropic.com/v1/messages', {
|
|
22
|
+
method: 'POST',
|
|
23
|
+
headers: {
|
|
24
|
+
'x-api-key': process.env.ANTHROPIC_API_KEY,
|
|
25
|
+
'anthropic-version': '2023-06-01',
|
|
26
|
+
'content-type': 'application/json',
|
|
27
|
+
},
|
|
28
|
+
body: JSON.stringify({
|
|
29
|
+
model: 'claude-sonnet-4-20250514',
|
|
30
|
+
max_tokens: 4096,
|
|
31
|
+
messages: [{ role: 'user', content: prompt }],
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
34
|
+
if (!response.ok)
|
|
35
|
+
throw new Error(`Anthropic API error: ${response.status}`);
|
|
36
|
+
const data = await response.json();
|
|
37
|
+
return data.content?.[0]?.text || 'No response generated';
|
|
38
|
+
}
|
|
39
|
+
if (process.env.OPENAI_API_KEY) {
|
|
40
|
+
const response = await fetch('https://api.openai.com/v1/chat/completions', {
|
|
41
|
+
method: 'POST',
|
|
42
|
+
headers: {
|
|
43
|
+
'Authorization': `Bearer ${process.env.OPENAI_API_KEY}`,
|
|
44
|
+
'Content-Type': 'application/json',
|
|
45
|
+
},
|
|
46
|
+
body: JSON.stringify({
|
|
47
|
+
model: 'gpt-4o-mini',
|
|
48
|
+
messages: [{ role: 'user', content: prompt }],
|
|
49
|
+
max_tokens: 4096,
|
|
50
|
+
}),
|
|
51
|
+
});
|
|
52
|
+
if (!response.ok)
|
|
53
|
+
throw new Error(`OpenAI API error: ${response.status}`);
|
|
54
|
+
const data = await response.json();
|
|
55
|
+
return data.choices?.[0]?.message?.content || 'No response generated';
|
|
56
|
+
}
|
|
57
|
+
if (process.env.COHERE_API_KEY) {
|
|
58
|
+
const { CohereClient } = require('cohere-ai');
|
|
59
|
+
const cohere = new CohereClient({ token: process.env.COHERE_API_KEY });
|
|
60
|
+
const response = await cohere.chat({ message: prompt });
|
|
61
|
+
return response.text || 'No response generated';
|
|
62
|
+
}
|
|
63
|
+
throw new Error('No API key found. Set ANTHROPIC_API_KEY, OPENAI_API_KEY, or COHERE_API_KEY.');
|
|
64
|
+
}
|
|
20
65
|
/**
|
|
21
|
-
*
|
|
66
|
+
* Streaming chat completion — yields tokens as they arrive
|
|
22
67
|
*/
|
|
23
|
-
async function
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
68
|
+
async function chatCompletionStream(prompt, onToken) {
|
|
69
|
+
if (process.env.ANTHROPIC_API_KEY) {
|
|
70
|
+
const response = await fetch('https://api.anthropic.com/v1/messages', {
|
|
71
|
+
method: 'POST',
|
|
72
|
+
headers: {
|
|
73
|
+
'x-api-key': process.env.ANTHROPIC_API_KEY,
|
|
74
|
+
'anthropic-version': '2023-06-01',
|
|
75
|
+
'content-type': 'application/json',
|
|
76
|
+
},
|
|
77
|
+
body: JSON.stringify({
|
|
78
|
+
model: 'claude-sonnet-4-20250514',
|
|
79
|
+
max_tokens: 4096,
|
|
80
|
+
stream: true,
|
|
81
|
+
messages: [{ role: 'user', content: prompt }],
|
|
82
|
+
}),
|
|
83
|
+
});
|
|
84
|
+
if (!response.ok)
|
|
85
|
+
throw new Error(`Anthropic API error: ${response.status}`);
|
|
86
|
+
let fullText = '';
|
|
87
|
+
const reader = response.body?.getReader();
|
|
88
|
+
if (!reader)
|
|
89
|
+
throw new Error('No response body');
|
|
90
|
+
const decoder = new TextDecoder();
|
|
91
|
+
let buffer = '';
|
|
92
|
+
while (true) {
|
|
93
|
+
const { done, value } = await reader.read();
|
|
94
|
+
if (done)
|
|
95
|
+
break;
|
|
96
|
+
buffer += decoder.decode(value, { stream: true });
|
|
97
|
+
const lines = buffer.split('\n');
|
|
98
|
+
buffer = lines.pop() || '';
|
|
99
|
+
for (const line of lines) {
|
|
100
|
+
if (!line.startsWith('data: '))
|
|
101
|
+
continue;
|
|
102
|
+
const data = line.slice(6);
|
|
103
|
+
if (data === '[DONE]')
|
|
104
|
+
continue;
|
|
105
|
+
try {
|
|
106
|
+
const event = JSON.parse(data);
|
|
107
|
+
if (event.type === 'content_block_delta' && event.delta?.text) {
|
|
108
|
+
const token = event.delta.text;
|
|
109
|
+
fullText += token;
|
|
110
|
+
onToken(token);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
// Skip malformed JSON
|
|
115
|
+
}
|
|
55
116
|
}
|
|
56
117
|
}
|
|
118
|
+
return fullText || 'No response generated';
|
|
57
119
|
}
|
|
58
|
-
|
|
59
|
-
|
|
120
|
+
// Fallback: non-streaming for other providers
|
|
121
|
+
const result = await chatCompletion(prompt);
|
|
122
|
+
onToken(result);
|
|
123
|
+
return result;
|
|
60
124
|
}
|
|
61
125
|
export async function chatWithContext(query, context) {
|
|
62
126
|
// Optimize query to understand intent and select strategy
|
|
@@ -79,14 +143,7 @@ USER QUERY:
|
|
|
79
143
|
|
|
80
144
|
${optimizedQuery}`;
|
|
81
145
|
return await retryWithBackoff(async () => {
|
|
82
|
-
return await
|
|
83
|
-
// Get chat provider (respects CODEHERE_AI_PROVIDER)
|
|
84
|
-
const provider = await getChatProvider();
|
|
85
|
-
const response = await provider.chat(prompt, {
|
|
86
|
-
maxTokens: strategy.maxTokens,
|
|
87
|
-
});
|
|
88
|
-
return response.text || 'No response generated';
|
|
89
|
-
});
|
|
146
|
+
return await chatCompletion(prompt);
|
|
90
147
|
}, {
|
|
91
148
|
maxRetries: 5,
|
|
92
149
|
baseDelay: 2000,
|
|
@@ -107,6 +164,29 @@ ${optimizedQuery}`;
|
|
|
107
164
|
});
|
|
108
165
|
});
|
|
109
166
|
}
|
|
167
|
+
/**
|
|
168
|
+
* Chat with context — streaming version
|
|
169
|
+
* Calls onToken for each token as it arrives from the LLM
|
|
170
|
+
*/
|
|
171
|
+
export async function chatWithContextStream(query, context, onToken) {
|
|
172
|
+
const { optimizedQuery, strategy } = optimizeQuery(query);
|
|
173
|
+
const optimized = optimizeContext(context, optimizedQuery, strategy.maxTokens, strategy.contextStrategy);
|
|
174
|
+
const optimizedChunks = optimized.chunks;
|
|
175
|
+
const contextText = optimizedChunks
|
|
176
|
+
.map((chunk, idx) => `[Chunk ${idx + 1} from ${chunk.filepath}]\n${chunk.content}`)
|
|
177
|
+
.join('\n\n---\n\n');
|
|
178
|
+
const prompt = `You are a strict coding assistant for enterprise environments.
|
|
179
|
+
Use ONLY the provided code context.
|
|
180
|
+
|
|
181
|
+
CONTEXT:
|
|
182
|
+
|
|
183
|
+
${contextText}
|
|
184
|
+
|
|
185
|
+
USER QUERY:
|
|
186
|
+
|
|
187
|
+
${optimizedQuery}`;
|
|
188
|
+
return chatCompletionStream(prompt, onToken);
|
|
189
|
+
}
|
|
110
190
|
export async function generateDiff(fileContent, instruction, filepath) {
|
|
111
191
|
const prompt = `You are a code editor. Generate ONLY a unified diff patch that applies cleanly to the file.
|
|
112
192
|
Do not include any explanation, comments, or markdown formatting.
|
|
@@ -133,13 +213,9 @@ Instruction: ${instruction}
|
|
|
133
213
|
|
|
134
214
|
Return the unified diff patch:`;
|
|
135
215
|
return await retryWithBackoff(async () => {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const response = await provider.chat(prompt, {
|
|
140
|
-
maxTokens: 4000,
|
|
141
|
-
});
|
|
142
|
-
let diffText = response.text || '';
|
|
216
|
+
const responseText = await chatCompletion(prompt);
|
|
217
|
+
return (() => {
|
|
218
|
+
let diffText = responseText;
|
|
143
219
|
// Extract diff if wrapped in markdown code blocks
|
|
144
220
|
const diffMatch = diffText.match(/```(?:diff)?\n([\s\S]*?)```/);
|
|
145
221
|
if (diffMatch) {
|
|
@@ -155,7 +231,7 @@ Return the unified diff patch:`;
|
|
|
155
231
|
}
|
|
156
232
|
}
|
|
157
233
|
return diffText.trim();
|
|
158
|
-
});
|
|
234
|
+
})();
|
|
159
235
|
}, {
|
|
160
236
|
maxRetries: 5,
|
|
161
237
|
baseDelay: 2000,
|
|
@@ -60,30 +60,6 @@ export class QueryIntentClassifier {
|
|
|
60
60
|
return 'multi-file-modify';
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
// EARLY CHECK: Open questions about codebase state (before action intents!)
|
|
64
|
-
// Must come BEFORE modify/debug/implement to catch "what changed?" correctly
|
|
65
|
-
const openQuestionPatterns = [
|
|
66
|
-
/^what\s+(changed|is\s+new|happened|did\s+i|files?\s+changed)/i, // "what changed"
|
|
67
|
-
/what\s+has\s+(changed|happened|been\s+modified)/i, // "what has changed"
|
|
68
|
-
/what\s+are\s+the\s+(recent|latest|new)\s+(changes|updates|modifications)/i,
|
|
69
|
-
/what\s+are\s+the\s+(main|key|important|recent)/i,
|
|
70
|
-
/how\s+does\s+the\s+(project|codebase|system|app)/i,
|
|
71
|
-
/how\s+does\s+(it|this)\s+work/i,
|
|
72
|
-
/tell\s+me\s+about/i,
|
|
73
|
-
/overview\s+of/i,
|
|
74
|
-
/summary\s+of/i,
|
|
75
|
-
/what\s+is\s+this\s+(project|codebase|app|repo)/i,
|
|
76
|
-
/^what\s+is\s+\w+\??$/i, // "What is X?" without file context
|
|
77
|
-
/what\s+is\s+this\??$/i, // "What is this?"
|
|
78
|
-
/show\s+me\s+(recent|latest|new)\s+(changes|updates)/i,
|
|
79
|
-
/what\s+did\s+(i|we)\s+(change|modify|update)/i,
|
|
80
|
-
/recently\s+(changed|modified|updated)/i,
|
|
81
|
-
];
|
|
82
|
-
for (const pattern of openQuestionPatterns) {
|
|
83
|
-
if (pattern.test(query)) {
|
|
84
|
-
return 'understand'; // Route to ask handler for semantic search
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
63
|
// Refactor intent (single-file)
|
|
88
64
|
if (lowerQuery.includes('refactor') || lowerQuery.includes('rename') ||
|
|
89
65
|
lowerQuery.includes('extract') || lowerQuery.includes('move') ||
|
|
@@ -112,21 +88,12 @@ export class QueryIntentClassifier {
|
|
|
112
88
|
lowerQuery.includes('update') || lowerQuery.includes('edit')) {
|
|
113
89
|
return 'modify';
|
|
114
90
|
}
|
|
115
|
-
// Explain intent
|
|
116
|
-
|
|
117
|
-
const hasFileContext = /\.(ts|js|tsx|jsx|py|go|java|rs|cpp|c|h|json|yaml|yml|md)\b/i.test(query) ||
|
|
118
|
-
/function|class|interface|type|const|method|component/i.test(lowerQuery) ||
|
|
119
|
-
/src\/|lib\/|app\/|components\/|utils\/|services\//i.test(query);
|
|
120
|
-
if (hasFileContext && (lowerQuery.includes('how') || lowerQuery.includes('what') ||
|
|
91
|
+
// Explain intent
|
|
92
|
+
if (lowerQuery.includes('how') || lowerQuery.includes('what') ||
|
|
121
93
|
lowerQuery.includes('explain') || lowerQuery.includes('understand') ||
|
|
122
|
-
lowerQuery.includes('does') || lowerQuery.includes('work'))
|
|
94
|
+
lowerQuery.includes('does') || lowerQuery.includes('work')) {
|
|
123
95
|
return 'explain';
|
|
124
96
|
}
|
|
125
|
-
// General understanding questions without file context → ask handler
|
|
126
|
-
if (lowerQuery.includes('how') || lowerQuery.includes('what') ||
|
|
127
|
-
lowerQuery.includes('explain') || lowerQuery.includes('understand')) {
|
|
128
|
-
return 'understand';
|
|
129
|
-
}
|
|
130
97
|
// Review intent
|
|
131
98
|
if (lowerQuery.includes('review') || lowerQuery.includes('check') ||
|
|
132
99
|
lowerQuery.includes('analyze') || lowerQuery.includes('audit')) {
|
package/dist/embed.js
CHANGED
|
@@ -2,6 +2,7 @@ import { readFileSync, readdirSync, statSync, existsSync, writeFileSync, mkdirSy
|
|
|
2
2
|
import { join, relative, dirname } from 'path';
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
4
|
import { config } from 'dotenv';
|
|
5
|
+
// CohereClient is lazy-loaded in getCohereClient() to avoid hard dependency
|
|
5
6
|
import initSqlJs from 'sql.js';
|
|
6
7
|
import { encoding_for_model } from 'tiktoken';
|
|
7
8
|
import { indexParallel } from './parallel-processor.js';
|
|
@@ -17,6 +18,22 @@ catch {
|
|
|
17
18
|
// Fallback
|
|
18
19
|
}
|
|
19
20
|
config(); // Also try current directory
|
|
21
|
+
function detectEmbeddingProvider() {
|
|
22
|
+
if (process.env.OPENAI_API_KEY)
|
|
23
|
+
return 'openai';
|
|
24
|
+
if (process.env.COHERE_API_KEY)
|
|
25
|
+
return 'cohere';
|
|
26
|
+
return 'none';
|
|
27
|
+
}
|
|
28
|
+
// Lazy-init Cohere client only when needed
|
|
29
|
+
let _cohereClient = null;
|
|
30
|
+
function getCohereClient() {
|
|
31
|
+
if (!_cohereClient) {
|
|
32
|
+
const { CohereClient } = require('cohere-ai');
|
|
33
|
+
_cohereClient = new CohereClient({ token: process.env.COHERE_API_KEY || '' });
|
|
34
|
+
}
|
|
35
|
+
return _cohereClient;
|
|
36
|
+
}
|
|
20
37
|
import { getEmbeddingsDbPath } from './infrastructure/storage/embeddings-path.js';
|
|
21
38
|
/**
|
|
22
39
|
* @deprecated Legacy global DB path - use getEmbeddingsDbPath() instead
|
|
@@ -37,14 +54,9 @@ function getLegacyDbPath() {
|
|
|
37
54
|
// Legacy DB_PATH - only used by deprecated indexRepository() function
|
|
38
55
|
// Active CLI uses indexRepositoryParallel() with per-repo paths
|
|
39
56
|
const DB_PATH = getLegacyDbPath();
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
const defaultModel = embedConfig.getModel('default') || embedConfig.getPreference('defaultModel');
|
|
44
|
-
const tiktokenModel = (defaultModel && defaultModel.includes('gpt')) ? defaultModel : 'gpt-3.5-turbo';
|
|
45
|
-
const enc = encoding_for_model(tiktokenModel);
|
|
46
|
-
const CHUNK_SIZE = embedConfig.getChunking('chunkSize') || 300; // target tokens per chunk
|
|
47
|
-
const OVERLAP = embedConfig.getChunking('overlap') || 50; // overlap tokens between chunks
|
|
57
|
+
const CHUNK_SIZE = 300; // target tokens per chunk
|
|
58
|
+
const OVERLAP = 50; // overlap tokens between chunks
|
|
59
|
+
const enc = encoding_for_model('gpt-3.5-turbo');
|
|
48
60
|
function shouldIgnorePath(filepath) {
|
|
49
61
|
const ignorePatterns = [
|
|
50
62
|
'node_modules',
|
|
@@ -115,85 +127,60 @@ function chunkText(text, targetTokens, overlap) {
|
|
|
115
127
|
}
|
|
116
128
|
return chunks;
|
|
117
129
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
if (process.env.COHERE_API_KEY) {
|
|
134
|
-
const { CohereProvider } = await import('./infrastructure/providers/cohere-provider.js');
|
|
135
|
-
registry.register(new CohereProvider());
|
|
136
|
-
}
|
|
137
|
-
if (process.env.CODEHERE_OPENAI_API_KEY || process.env.OPENAI_API_KEY) {
|
|
138
|
-
const { OpenAIProvider } = await import('./infrastructure/providers/openai-provider.js');
|
|
139
|
-
registry.register(new OpenAIProvider());
|
|
140
|
-
}
|
|
141
|
-
if (process.env.OPENROUTER_API_KEY) {
|
|
142
|
-
const { OpenRouterProvider } = await import('./infrastructure/providers/openrouter-provider.js');
|
|
143
|
-
registry.register(new OpenRouterProvider());
|
|
144
|
-
}
|
|
145
|
-
// Set default based on CODEHERE_AI_PROVIDER
|
|
146
|
-
const requestedProvider = process.env.CODEHERE_AI_PROVIDER?.toLowerCase();
|
|
147
|
-
if (requestedProvider && registry.get(requestedProvider)) {
|
|
148
|
-
registry.setDefault(requestedProvider);
|
|
149
|
-
}
|
|
150
|
-
else if (registry.get('openai')) {
|
|
151
|
-
registry.setDefault('openai');
|
|
152
|
-
}
|
|
153
|
-
else if (registry.get('cohere')) {
|
|
154
|
-
registry.setDefault('cohere');
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
const resolver = new OperationProviderResolver(registry);
|
|
159
|
-
// Special handling for OpenRouter: fallback to OpenAI or Cohere for embeddings
|
|
160
|
-
const currentDefault = registry.getDefault();
|
|
161
|
-
if (currentDefault?.id === 'openrouter') {
|
|
162
|
-
if (registry.get('openai')?.capabilities.embedding) {
|
|
163
|
-
return registry.get('openai');
|
|
164
|
-
}
|
|
165
|
-
if (registry.get('cohere')?.capabilities.embedding) {
|
|
166
|
-
return registry.get('cohere');
|
|
167
|
-
}
|
|
168
|
-
throw new Error('OpenRouter doesn\'t support embeddings. Please set up OpenAI or Cohere:\n' +
|
|
169
|
-
' export CODEHERE_OPENAI_API_KEY="sk-..."\n' +
|
|
170
|
-
' or\n' +
|
|
171
|
-
' export COHERE_API_KEY="..."\n');
|
|
130
|
+
async function embedTextOpenAI(text) {
|
|
131
|
+
const response = await fetch('https://api.openai.com/v1/embeddings', {
|
|
132
|
+
method: 'POST',
|
|
133
|
+
headers: {
|
|
134
|
+
'Authorization': `Bearer ${process.env.OPENAI_API_KEY}`,
|
|
135
|
+
'Content-Type': 'application/json',
|
|
136
|
+
},
|
|
137
|
+
body: JSON.stringify({
|
|
138
|
+
input: text,
|
|
139
|
+
model: 'text-embedding-3-small',
|
|
140
|
+
}),
|
|
141
|
+
});
|
|
142
|
+
if (!response.ok) {
|
|
143
|
+
const errText = await response.text();
|
|
144
|
+
throw new Error(`OpenAI embedding error: ${response.status} ${errText}`);
|
|
172
145
|
}
|
|
173
|
-
|
|
146
|
+
const data = await response.json();
|
|
147
|
+
return data.data?.[0]?.embedding || [];
|
|
148
|
+
}
|
|
149
|
+
async function embedTextCohere(text) {
|
|
150
|
+
const cohere = getCohereClient();
|
|
151
|
+
const response = await cohere.embed({
|
|
152
|
+
texts: [text],
|
|
153
|
+
model: 'embed-english-v3.0',
|
|
154
|
+
inputType: 'search_document',
|
|
155
|
+
});
|
|
156
|
+
const embeddings = Array.isArray(response.embeddings)
|
|
157
|
+
? response.embeddings
|
|
158
|
+
: response.embeddings.embeddings || [];
|
|
159
|
+
return embeddings[0] || [];
|
|
174
160
|
}
|
|
175
161
|
async function embedText(text, retries = 3) {
|
|
176
|
-
const provider =
|
|
162
|
+
const provider = detectEmbeddingProvider();
|
|
163
|
+
if (provider === 'none') {
|
|
164
|
+
throw new Error('No embedding API key found. Set OPENAI_API_KEY or COHERE_API_KEY to use index/ask/fix commands.');
|
|
165
|
+
}
|
|
177
166
|
for (let attempt = 0; attempt < retries; attempt++) {
|
|
178
167
|
try {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
return resultVector;
|
|
168
|
+
if (provider === 'openai') {
|
|
169
|
+
return await embedTextOpenAI(text);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
return await embedTextCohere(text);
|
|
173
|
+
}
|
|
186
174
|
}
|
|
187
175
|
catch (error) {
|
|
188
176
|
const isRateLimit = error?.status === 429 || error?.message?.includes('429') || error?.message?.includes('rate limit');
|
|
189
177
|
if (isRateLimit && attempt < retries - 1) {
|
|
190
|
-
// Exponential backoff: wait 2^attempt seconds, with a max of 60 seconds
|
|
191
178
|
const waitTime = Math.min(Math.pow(2, attempt) * 1000, 60000);
|
|
192
|
-
console.log(warning(`Rate limited, waiting ${waitTime / 1000}s before retry
|
|
179
|
+
console.log(warning(`Rate limited, waiting ${waitTime / 1000}s before retry...`));
|
|
193
180
|
await new Promise(resolve => setTimeout(resolve, waitTime));
|
|
194
181
|
continue;
|
|
195
182
|
}
|
|
196
|
-
throw new Error(`Embedding error: ${error instanceof Error ? error.message : String(error)}`);
|
|
183
|
+
throw new Error(`Embedding error (${provider}): ${error instanceof Error ? error.message : String(error)}`);
|
|
197
184
|
}
|
|
198
185
|
}
|
|
199
186
|
throw new Error('Embedding failed after retries');
|