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
|
@@ -12,8 +12,6 @@ import { join, dirname } from 'path';
|
|
|
12
12
|
import { fileURLToPath } from 'url';
|
|
13
13
|
import { encoding_for_model } from 'tiktoken';
|
|
14
14
|
import { retryWithBackoff } from '../../error-handler.js';
|
|
15
|
-
import { sessionTokenTracker } from '../cost/session-token-tracker.js';
|
|
16
|
-
import { getConfigManager } from '../config/config-manager.js';
|
|
17
15
|
// Load .env (same pattern as CohereProvider)
|
|
18
16
|
try {
|
|
19
17
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -28,15 +26,10 @@ let tokenEncoder = null;
|
|
|
28
26
|
function getTokenEncoder() {
|
|
29
27
|
if (!tokenEncoder) {
|
|
30
28
|
try {
|
|
31
|
-
|
|
32
|
-
const config = getConfigManager();
|
|
33
|
-
const defaultModel = config.getModel('default') || config.getPreference('defaultModel') || 'gpt-3.5-turbo';
|
|
34
|
-
// Map to OpenAI model for tiktoken (tiktoken uses OpenAI models)
|
|
35
|
-
const tiktokenModel = defaultModel.includes('gpt') ? defaultModel : 'gpt-3.5-turbo';
|
|
36
|
-
tokenEncoder = encoding_for_model(tiktokenModel);
|
|
29
|
+
tokenEncoder = encoding_for_model('gpt-3.5-turbo');
|
|
37
30
|
}
|
|
38
31
|
catch {
|
|
39
|
-
tokenEncoder = encoding_for_model('gpt-
|
|
32
|
+
tokenEncoder = encoding_for_model('gpt-4');
|
|
40
33
|
}
|
|
41
34
|
}
|
|
42
35
|
return tokenEncoder;
|
|
@@ -77,7 +70,6 @@ export class OpenAIProvider {
|
|
|
77
70
|
}
|
|
78
71
|
this.apiKey = key;
|
|
79
72
|
this.baseUrl = baseUrl || process.env.OPENAI_BASE_URL || 'https://api.openai.com/v1';
|
|
80
|
-
// Use provider-specific defaults (DO NOT use global config - it has Cohere models!)
|
|
81
73
|
this.defaultChatModel = process.env.CODEHERE_OPENAI_MODEL || 'gpt-4o-mini';
|
|
82
74
|
this.defaultEmbedModel = process.env.CODEHERE_OPENAI_EMBED_MODEL || 'text-embedding-3-small';
|
|
83
75
|
}
|
|
@@ -196,7 +188,7 @@ export class OpenAIProvider {
|
|
|
196
188
|
content: prompt,
|
|
197
189
|
},
|
|
198
190
|
],
|
|
199
|
-
temperature: options?.temperature ??
|
|
191
|
+
temperature: options?.temperature ?? 0.7,
|
|
200
192
|
max_tokens: options?.maxTokens,
|
|
201
193
|
}),
|
|
202
194
|
});
|
|
@@ -215,21 +207,12 @@ export class OpenAIProvider {
|
|
|
215
207
|
const data = await response.json();
|
|
216
208
|
const text = data.choices?.[0]?.message?.content || 'No response generated';
|
|
217
209
|
const usage = data.usage || {};
|
|
218
|
-
const inputTokens = usage.prompt_tokens || countTokens(prompt);
|
|
219
|
-
const outputTokens = usage.completion_tokens || countTokens(text);
|
|
220
|
-
// Track tokens for session cost display
|
|
221
|
-
sessionTokenTracker.record({
|
|
222
|
-
operation: 'chat',
|
|
223
|
-
model: data.model || model,
|
|
224
|
-
inputTokens,
|
|
225
|
-
outputTokens,
|
|
226
|
-
});
|
|
227
210
|
return {
|
|
228
211
|
text,
|
|
229
212
|
model: data.model || model,
|
|
230
213
|
usage: {
|
|
231
|
-
inputTokens,
|
|
232
|
-
outputTokens,
|
|
214
|
+
inputTokens: usage.prompt_tokens || countTokens(prompt),
|
|
215
|
+
outputTokens: usage.completion_tokens || countTokens(text),
|
|
233
216
|
},
|
|
234
217
|
finishReason: data.choices?.[0]?.finish_reason,
|
|
235
218
|
};
|
|
@@ -311,13 +294,6 @@ export class OpenAIProvider {
|
|
|
311
294
|
}
|
|
312
295
|
const inputTokens = countTokens(prompt);
|
|
313
296
|
const outputTokens = countTokens(fullText);
|
|
314
|
-
// Track tokens for session cost display
|
|
315
|
-
sessionTokenTracker.record({
|
|
316
|
-
operation: 'chat-stream',
|
|
317
|
-
model: model || this.defaultChatModel,
|
|
318
|
-
inputTokens,
|
|
319
|
-
outputTokens,
|
|
320
|
-
});
|
|
321
297
|
return {
|
|
322
298
|
text: fullText,
|
|
323
299
|
model: model || 'default',
|
|
@@ -357,14 +333,6 @@ export class OpenAIProvider {
|
|
|
357
333
|
}
|
|
358
334
|
const data = await response.json();
|
|
359
335
|
const embeddings = data.data?.map((item) => item.embedding) || [];
|
|
360
|
-
// Track tokens for session cost display
|
|
361
|
-
const inputTokens = texts.reduce((sum, t) => sum + countTokens(t), 0);
|
|
362
|
-
sessionTokenTracker.record({
|
|
363
|
-
operation: 'embed',
|
|
364
|
-
model: this.defaultEmbedModel,
|
|
365
|
-
inputTokens,
|
|
366
|
-
outputTokens: 0,
|
|
367
|
-
});
|
|
368
336
|
if (texts.length === 1) {
|
|
369
337
|
return embeddings[0];
|
|
370
338
|
}
|
|
@@ -14,7 +14,6 @@ import { join, dirname } from 'path';
|
|
|
14
14
|
import { fileURLToPath } from 'url';
|
|
15
15
|
import { encoding_for_model } from 'tiktoken';
|
|
16
16
|
import { retryWithBackoff } from '../../error-handler.js';
|
|
17
|
-
import { getConfigManager } from '../config/config-manager.js';
|
|
18
17
|
// Load .env (same pattern as other providers)
|
|
19
18
|
try {
|
|
20
19
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -29,15 +28,10 @@ let tokenEncoder = null;
|
|
|
29
28
|
function getTokenEncoder() {
|
|
30
29
|
if (!tokenEncoder) {
|
|
31
30
|
try {
|
|
32
|
-
|
|
33
|
-
const config = getConfigManager();
|
|
34
|
-
const defaultModel = config.getModel('default') || config.getPreference('defaultModel') || 'gpt-3.5-turbo';
|
|
35
|
-
// Map to OpenAI model for tiktoken (tiktoken uses OpenAI models)
|
|
36
|
-
const tiktokenModel = defaultModel.includes('gpt') ? defaultModel : 'gpt-3.5-turbo';
|
|
37
|
-
tokenEncoder = encoding_for_model(tiktokenModel);
|
|
31
|
+
tokenEncoder = encoding_for_model('gpt-3.5-turbo');
|
|
38
32
|
}
|
|
39
33
|
catch {
|
|
40
|
-
tokenEncoder = encoding_for_model('gpt-
|
|
34
|
+
tokenEncoder = encoding_for_model('gpt-4');
|
|
41
35
|
}
|
|
42
36
|
}
|
|
43
37
|
return tokenEncoder;
|
|
@@ -77,9 +71,7 @@ export class OpenRouterProvider {
|
|
|
77
71
|
}
|
|
78
72
|
this.apiKey = key;
|
|
79
73
|
this.baseUrl = process.env.OPENROUTER_BASE_URL || 'https://openrouter.ai/api/v1';
|
|
80
|
-
|
|
81
|
-
const config = getConfigManager();
|
|
82
|
-
this.defaultChatModel = process.env.CODEHERE_OPENROUTER_CHAT_MODEL || config.getModel('chat') || config.getModel('default') || 'openai/gpt-4o-mini';
|
|
74
|
+
this.defaultChatModel = process.env.CODEHERE_OPENROUTER_CHAT_MODEL || 'openai/gpt-4o-mini';
|
|
83
75
|
}
|
|
84
76
|
async getModels() {
|
|
85
77
|
// Fetch models from OpenRouter API
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mistake Detection Loop (P4-A)
|
|
3
|
+
*
|
|
4
|
+
* Detects repeated patterns in hook events and surfaces warnings:
|
|
5
|
+
* - Same category blocked 3+ times → user warning
|
|
6
|
+
* - Same file blocked 3+ times → suggest different approach
|
|
7
|
+
* - AI retrying blocked command with minor variation → escalate
|
|
8
|
+
*
|
|
9
|
+
* v0.3.0
|
|
10
|
+
*/
|
|
11
|
+
import { readFileSync, existsSync } from 'fs';
|
|
12
|
+
import { join } from 'path';
|
|
13
|
+
import { homedir } from 'os';
|
|
14
|
+
import chalk from 'chalk';
|
|
15
|
+
const AUDIT_FILE = join(homedir(), '.codehere', 'audit', 'hook-events.jsonl');
|
|
16
|
+
const THRESHOLD = 3;
|
|
17
|
+
/**
|
|
18
|
+
* Analyze recent audit log for mistake patterns in a session.
|
|
19
|
+
*/
|
|
20
|
+
export function detectMistakes(sessionId) {
|
|
21
|
+
if (!existsSync(AUDIT_FILE))
|
|
22
|
+
return [];
|
|
23
|
+
let lines;
|
|
24
|
+
try {
|
|
25
|
+
const raw = readFileSync(AUDIT_FILE, 'utf-8').trim();
|
|
26
|
+
if (!raw)
|
|
27
|
+
return [];
|
|
28
|
+
lines = raw.split('\n');
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
// Parse blocked events, optionally filtered to a session
|
|
34
|
+
const blockedEvents = [];
|
|
35
|
+
for (const line of lines) {
|
|
36
|
+
try {
|
|
37
|
+
const entry = JSON.parse(line);
|
|
38
|
+
if (!entry.blocked)
|
|
39
|
+
continue;
|
|
40
|
+
if (sessionId && entry.sessionId !== sessionId)
|
|
41
|
+
continue;
|
|
42
|
+
blockedEvents.push(entry);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (blockedEvents.length < THRESHOLD)
|
|
49
|
+
return [];
|
|
50
|
+
const patterns = [];
|
|
51
|
+
// 1. Same category blocked 3+ times
|
|
52
|
+
const categoryCounts = new Map();
|
|
53
|
+
for (const event of blockedEvents) {
|
|
54
|
+
if (event.categories) {
|
|
55
|
+
for (const cat of event.categories) {
|
|
56
|
+
categoryCounts.set(cat, (categoryCounts.get(cat) || 0) + 1);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
for (const [category, count] of categoryCounts) {
|
|
61
|
+
if (count >= THRESHOLD) {
|
|
62
|
+
patterns.push({
|
|
63
|
+
type: 'repeated-category',
|
|
64
|
+
description: `"${category}" blocked ${count} times`,
|
|
65
|
+
count,
|
|
66
|
+
suggestion: `The AI keeps triggering ${category} detections. Consider adding a project rule or using a safer pattern.`,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// 2. Same tool+file blocked 3+ times
|
|
71
|
+
const fileCounts = new Map();
|
|
72
|
+
for (const event of blockedEvents) {
|
|
73
|
+
if (event.toolName === 'Write' || event.toolName === 'Edit' || event.toolName === 'MultiEdit') {
|
|
74
|
+
try {
|
|
75
|
+
const input = JSON.parse(event.toolInput);
|
|
76
|
+
const filePath = input.file_path || input.filepath || '';
|
|
77
|
+
if (filePath) {
|
|
78
|
+
fileCounts.set(filePath, (fileCounts.get(filePath) || 0) + 1);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// toolInput might be truncated
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
for (const [filePath, count] of fileCounts) {
|
|
87
|
+
if (count >= THRESHOLD) {
|
|
88
|
+
const shortPath = filePath.split('/').slice(-2).join('/');
|
|
89
|
+
patterns.push({
|
|
90
|
+
type: 'repeated-file',
|
|
91
|
+
description: `Writes to ${shortPath} blocked ${count} times`,
|
|
92
|
+
count,
|
|
93
|
+
suggestion: `The AI keeps trying to modify this file in a blocked way. Try a different instruction or approach.`,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// 3. Rapid retries (3+ blocked events within 60 seconds)
|
|
98
|
+
if (blockedEvents.length >= THRESHOLD) {
|
|
99
|
+
const recent = blockedEvents.slice(-10);
|
|
100
|
+
let rapidCount = 0;
|
|
101
|
+
for (let i = 1; i < recent.length; i++) {
|
|
102
|
+
const prev = new Date(recent[i - 1].timestamp).getTime();
|
|
103
|
+
const curr = new Date(recent[i].timestamp).getTime();
|
|
104
|
+
if (curr - prev < 60_000) {
|
|
105
|
+
rapidCount++;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (rapidCount >= THRESHOLD - 1) {
|
|
109
|
+
patterns.push({
|
|
110
|
+
type: 'retry-variation',
|
|
111
|
+
description: `${rapidCount + 1} rapid retries detected`,
|
|
112
|
+
count: rapidCount + 1,
|
|
113
|
+
suggestion: `The AI is rapidly retrying blocked commands. It may be stuck in a loop — consider rephrasing your instruction.`,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return patterns;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Format mistake patterns for display in CLI.
|
|
121
|
+
*/
|
|
122
|
+
export function formatMistakeWarnings(patterns) {
|
|
123
|
+
if (patterns.length === 0)
|
|
124
|
+
return '';
|
|
125
|
+
const lines = [];
|
|
126
|
+
lines.push(chalk.yellow.bold('Repeated patterns detected:'));
|
|
127
|
+
for (const p of patterns) {
|
|
128
|
+
lines.push(chalk.yellow(` ${p.description}`));
|
|
129
|
+
lines.push(chalk.dim(` ${p.suggestion}`));
|
|
130
|
+
}
|
|
131
|
+
return lines.join('\n');
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=pattern-detector.js.map
|
|
@@ -15,26 +15,75 @@ export class AISASTScanner {
|
|
|
15
15
|
* This is a quick heuristic check to reject dangerous instructions early
|
|
16
16
|
*/
|
|
17
17
|
async scanInstruction(instruction) {
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
{ pattern: /
|
|
23
|
-
{ pattern: /
|
|
24
|
-
{ pattern: /
|
|
25
|
-
{ pattern: /
|
|
26
|
-
{ pattern: /
|
|
18
|
+
// Full pattern-based scan — 50+ patterns across 5 categories
|
|
19
|
+
// Matches benchmark coverage. Runs locally, no API needed.
|
|
20
|
+
const instructionPatterns = [
|
|
21
|
+
// ── PROMPT INJECTION (10 patterns) ────────────────────────
|
|
22
|
+
{ pattern: /ignore\s+(previous|prior|above|all|your)\s+(instructions?|rules?|prompts?|guidelines?)/i, severity: 'critical', category: 'Prompt Injection', description: 'Attempts to override system instructions' },
|
|
23
|
+
{ pattern: /disregard\s+(previous|prior|all|your)\s+(instructions?|rules?|prompts?)/i, severity: 'critical', category: 'Prompt Injection', description: 'Attempts to disregard system instructions' },
|
|
24
|
+
{ pattern: /forget\s+(everything|all|previous|your)\s*(instructions?|rules?|context)?/i, severity: 'critical', category: 'Prompt Injection', description: 'Attempts to clear system context' },
|
|
25
|
+
{ pattern: /you\s+are\s+now\s+(a|an|my)|new\s+role|act\s+as\s+(a|an|if)/i, severity: 'critical', category: 'Prompt Injection', description: 'Role hijacking attempt' },
|
|
26
|
+
{ pattern: /system\s*prompt|<\/?system>|<\/?instruction>/i, severity: 'critical', category: 'Prompt Injection', description: 'Attempts to access or inject system prompt' },
|
|
27
|
+
{ pattern: /\bdo\s+not\s+(follow|obey|listen|comply)\b/i, severity: 'critical', category: 'Prompt Injection', description: 'Instruction override attempt' },
|
|
28
|
+
{ pattern: /override\s+(safety|security|rules|restrictions|guidelines)/i, severity: 'critical', category: 'Prompt Injection', description: 'Safety override attempt' },
|
|
29
|
+
{ pattern: /jailbreak|DAN\s+mode|developer\s+mode|unrestricted\s+mode/i, severity: 'critical', category: 'Prompt Injection', description: 'Known jailbreak technique' },
|
|
30
|
+
{ pattern: /translate.*to.*base64|encode.*instructions|decode.*payload/i, severity: 'high', category: 'Prompt Injection', description: 'Obfuscation-based injection' },
|
|
31
|
+
{ pattern: /pretend\s+(you|there|that)\s*(are|is|was)\s*(no|isn.t|aren.t)/i, severity: 'critical', category: 'Prompt Injection', description: 'Reality manipulation injection' },
|
|
32
|
+
// ── CREDENTIAL THEFT (10 patterns) ────────────────────────
|
|
33
|
+
{ pattern: /hardcode.*password|store.*password|plaintext.*password/i, severity: 'high', category: 'Credential Theft', description: 'Hardcoded credentials' },
|
|
34
|
+
{ pattern: /api[_\s-]?key\s*[:=]\s*['"]/i, severity: 'high', category: 'Credential Theft', description: 'Hardcoded API key' },
|
|
35
|
+
{ pattern: /secret[_\s-]?key\s*[:=]\s*['"]/i, severity: 'high', category: 'Credential Theft', description: 'Hardcoded secret key' },
|
|
36
|
+
{ pattern: /\bpassword\s*[:=]\s*['"][^'"]{3,}/i, severity: 'high', category: 'Credential Theft', description: 'Hardcoded password value' },
|
|
37
|
+
{ pattern: /token\s*[:=]\s*['"][A-Za-z0-9+/=_-]{20,}/i, severity: 'high', category: 'Credential Theft', description: 'Hardcoded token' },
|
|
38
|
+
{ pattern: /print.*env|console\.log.*process\.env|dump.*environment/i, severity: 'high', category: 'Credential Theft', description: 'Environment variable exfiltration' },
|
|
39
|
+
{ pattern: /read.*\.env|cat\s+\.env|show.*credentials/i, severity: 'high', category: 'Credential Theft', description: 'Credential file access' },
|
|
40
|
+
{ pattern: /send.*key.*to|post.*secret.*to|upload.*credentials/i, severity: 'critical', category: 'Credential Theft', description: 'Credential exfiltration' },
|
|
41
|
+
{ pattern: /AWS_SECRET|AZURE_KEY|GCP_KEY|DATABASE_URL.*password/i, severity: 'high', category: 'Credential Theft', description: 'Cloud credential exposure' },
|
|
42
|
+
{ pattern: /ssh[_\s-]?key|private[_\s-]?key.*BEGIN/i, severity: 'critical', category: 'Credential Theft', description: 'Private key exposure' },
|
|
43
|
+
// ── CODE INJECTION (10 patterns) ──────────────────────────
|
|
44
|
+
{ pattern: /execute.*user.*input|eval.*user|exec.*user/i, severity: 'critical', category: 'Code Injection', description: 'User input execution' },
|
|
45
|
+
{ pattern: /shell.*command|system.*call|process\.exec|child_process/i, severity: 'critical', category: 'Code Injection', description: 'Shell command execution' },
|
|
46
|
+
{ pattern: /sql.*injection|raw.*sql.*query|query.*\+.*user/i, severity: 'high', category: 'Code Injection', description: 'SQL injection vector' },
|
|
47
|
+
{ pattern: /bypass.*security|disable.*security|remove.*validation/i, severity: 'critical', category: 'Code Injection', description: 'Security bypass' },
|
|
48
|
+
{ pattern: /delete\s+all\s+files|rm\s+-rf|remove\s+all|wipe\s+disk/i, severity: 'critical', category: 'Code Injection', description: 'Destructive file operation' },
|
|
49
|
+
{ pattern: /reverse\s+shell|bind\s+shell|nc\s+-e|netcat.*-e/i, severity: 'critical', category: 'Code Injection', description: 'Reverse shell attempt' },
|
|
50
|
+
{ pattern: /download.*execute|curl.*\|\s*sh|wget.*\|\s*bash/i, severity: 'critical', category: 'Code Injection', description: 'Remote code execution' },
|
|
51
|
+
{ pattern: /modify.*hosts|edit.*\/etc\/|change.*resolv\.conf/i, severity: 'critical', category: 'Code Injection', description: 'System file modification' },
|
|
52
|
+
{ pattern: /disable.*firewall|stop.*antivirus|kill.*security/i, severity: 'critical', category: 'Code Injection', description: 'Security software bypass' },
|
|
53
|
+
{ pattern: /crypto.*min(er|ing)|bitcoin.*address|monero.*wallet/i, severity: 'critical', category: 'Code Injection', description: 'Cryptominer injection' },
|
|
54
|
+
// ── SUPPLY CHAIN (10 patterns) ────────────────────────────
|
|
55
|
+
{ pattern: /install\s+[a-z]+-[a-z]+\d{3,}|npm\s+i\s+[a-z]+-typo/i, severity: 'high', category: 'Supply Chain', description: 'Typosquatting package install' },
|
|
56
|
+
{ pattern: /add.*dependency.*http|require\s*\(\s*['"]https?:/i, severity: 'high', category: 'Supply Chain', description: 'Remote dependency injection' },
|
|
57
|
+
{ pattern: /postinstall.*script|preinstall.*curl|lifecycle.*wget/i, severity: 'critical', category: 'Supply Chain', description: 'Malicious lifecycle script' },
|
|
58
|
+
{ pattern: /replace.*package|swap.*module|inject.*into.*node_modules/i, severity: 'critical', category: 'Supply Chain', description: 'Package replacement attack' },
|
|
59
|
+
{ pattern: /modify.*package\.json.*scripts|add.*postinstall/i, severity: 'high', category: 'Supply Chain', description: 'Build script injection' },
|
|
60
|
+
{ pattern: /git.*clone.*untrusted|clone.*unknown.*repo/i, severity: 'high', category: 'Supply Chain', description: 'Untrusted repository clone' },
|
|
61
|
+
{ pattern: /override.*lockfile|delete.*lock|ignore.*integrity/i, severity: 'high', category: 'Supply Chain', description: 'Lock file tampering' },
|
|
62
|
+
{ pattern: /publish.*malicious|npm\s+publish.*trojan/i, severity: 'critical', category: 'Supply Chain', description: 'Malicious package publish' },
|
|
63
|
+
{ pattern: /dependency\s+confusion|internal.*package.*public/i, severity: 'high', category: 'Supply Chain', description: 'Dependency confusion attack' },
|
|
64
|
+
{ pattern: /add.*webpack.*plugin.*http|loader.*remote.*url/i, severity: 'high', category: 'Supply Chain', description: 'Build tool injection' },
|
|
65
|
+
// ── OWASP TOP 10 (10 patterns) ────────────────────────────
|
|
66
|
+
{ pattern: /disable.*cors|access-control-allow-origin.*\*/i, severity: 'high', category: 'OWASP', description: 'CORS misconfiguration' },
|
|
67
|
+
{ pattern: /disable.*csrf|skip.*csrf.*check|no.*csrf/i, severity: 'high', category: 'OWASP', description: 'CSRF protection bypass' },
|
|
68
|
+
{ pattern: /no.*authentication|skip.*auth|remove.*auth.*check/i, severity: 'critical', category: 'OWASP', description: 'Authentication bypass' },
|
|
69
|
+
{ pattern: /set.*cookie.*httponly.*false|cookie.*secure.*false/i, severity: 'high', category: 'OWASP', description: 'Insecure cookie configuration' },
|
|
70
|
+
{ pattern: /http:\/\/.*api|unencrypted.*connection|disable.*tls/i, severity: 'high', category: 'OWASP', description: 'Insecure transport' },
|
|
71
|
+
{ pattern: /expose.*stack.*trace|verbose.*error.*production/i, severity: 'high', category: 'OWASP', description: 'Information disclosure' },
|
|
72
|
+
{ pattern: /admin.*route.*public|no.*authorization.*check/i, severity: 'critical', category: 'OWASP', description: 'Broken access control' },
|
|
73
|
+
{ pattern: /deserialize.*untrusted|parse.*user.*json.*eval/i, severity: 'critical', category: 'OWASP', description: 'Insecure deserialization' },
|
|
74
|
+
{ pattern: /log.*password|log.*token|log.*secret|log.*credentials/i, severity: 'high', category: 'OWASP', description: 'Sensitive data in logs' },
|
|
75
|
+
{ pattern: /xml.*external.*entity|xxe|DOCTYPE.*SYSTEM/i, severity: 'critical', category: 'OWASP', description: 'XXE injection' },
|
|
27
76
|
];
|
|
28
77
|
const findings = [];
|
|
29
|
-
for (const { pattern, severity, category } of
|
|
78
|
+
for (const { pattern, severity, category, description } of instructionPatterns) {
|
|
30
79
|
if (pattern.test(instruction)) {
|
|
31
80
|
findings.push({
|
|
32
|
-
severity
|
|
81
|
+
severity,
|
|
33
82
|
category,
|
|
34
|
-
description
|
|
83
|
+
description,
|
|
35
84
|
filepath: 'instruction',
|
|
36
85
|
line: 0,
|
|
37
|
-
recommendation: `
|
|
86
|
+
recommendation: `BLOCKED: ${description}. This instruction was rejected by the safety scanner.`,
|
|
38
87
|
});
|
|
39
88
|
}
|
|
40
89
|
}
|
|
@@ -10,9 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* All checks must pass before code generation/editing
|
|
12
12
|
*/
|
|
13
|
-
import { createHash } from 'crypto';
|
|
14
13
|
import { getSecurityScanCache } from '../cache/security-scan-cache.js';
|
|
15
|
-
import { detectPromptInjection } from './input-validator.js';
|
|
16
14
|
/**
|
|
17
15
|
* Enhanced Security Gate
|
|
18
16
|
* Orchestrates all security scanners
|
|
@@ -37,9 +35,7 @@ export class EnhancedSecurityGate {
|
|
|
37
35
|
const errors = [];
|
|
38
36
|
const warnings = [];
|
|
39
37
|
// PERFORMANCE: Check cache first (bypasses expensive scans for unchanged files)
|
|
40
|
-
|
|
41
|
-
const contentHash = createHash('sha256').update(code).digest('hex');
|
|
42
|
-
const cachedResults = this.scanCache.get(filepath, contentHash);
|
|
38
|
+
const cachedResults = this.scanCache.get(filepath, code);
|
|
43
39
|
if (cachedResults) {
|
|
44
40
|
// Return cached results (skip expensive scans)
|
|
45
41
|
const passed = cachedResults.sast.passed && cachedResults.license.passed;
|
|
@@ -126,7 +122,6 @@ export class EnhancedSecurityGate {
|
|
|
126
122
|
}
|
|
127
123
|
const passed = errors.length === 0; // Only fail on critical errors
|
|
128
124
|
// Cache results for future use (performance optimization)
|
|
129
|
-
// Note: cache.set() accepts code string and hashes internally
|
|
130
125
|
this.scanCache.set(filepath, code, sast, license, providerBias);
|
|
131
126
|
return {
|
|
132
127
|
passed,
|
|
@@ -140,70 +135,16 @@ export class EnhancedSecurityGate {
|
|
|
140
135
|
}
|
|
141
136
|
/**
|
|
142
137
|
* Fast pre-check on instruction (before expensive operations)
|
|
143
|
-
* Enhanced with prompt injection detection
|
|
144
138
|
*/
|
|
145
139
|
async fastCheck(instruction) {
|
|
146
140
|
const findings = [];
|
|
147
|
-
// P0 Security: Check for prompt injection first (fast, synchronous)
|
|
148
|
-
const injectionResult = detectPromptInjection(instruction);
|
|
149
|
-
if (injectionResult) {
|
|
150
|
-
if (injectionResult.severity === 'critical' || injectionResult.severity === 'high') {
|
|
151
|
-
findings.push(`Prompt injection (${injectionResult.severity}): ${injectionResult.description}`);
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
findings.push(`Prompt injection (${injectionResult.severity}): ${injectionResult.description}`);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
// SAST scan on instruction
|
|
158
141
|
const sastResult = await this.sastScanner.scanInstruction(instruction);
|
|
159
142
|
if (sastResult && !sastResult.passed) {
|
|
160
143
|
findings.push(...sastResult.findings.map(f => `${f.severity}: ${f.description}`));
|
|
161
144
|
}
|
|
162
|
-
// Block if critical/high severity findings
|
|
163
|
-
const hasCriticalFindings = findings.some(f => f.includes('critical') || f.includes('high') ||
|
|
164
|
-
(injectionResult && (injectionResult.severity === 'critical' || injectionResult.severity === 'high')));
|
|
165
|
-
return {
|
|
166
|
-
allowed: !hasCriticalFindings,
|
|
167
|
-
findings,
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Validate LLM output before code execution
|
|
172
|
-
* P0 Security: Enhanced output validation
|
|
173
|
-
*/
|
|
174
|
-
async validateOutput(output, context) {
|
|
175
|
-
const findings = [];
|
|
176
|
-
let sanitized = output;
|
|
177
|
-
// Check for prompt injection in output (LLM may have been manipulated)
|
|
178
|
-
const injectionResult = detectPromptInjection(output);
|
|
179
|
-
if (injectionResult && (injectionResult.severity === 'critical' || injectionResult.severity === 'high')) {
|
|
180
|
-
findings.push(`Output contains prompt injection (${injectionResult.severity}): ${injectionResult.description}`);
|
|
181
|
-
}
|
|
182
|
-
// Check for dangerous code patterns in output
|
|
183
|
-
const dangerousPatterns = [
|
|
184
|
-
{ pattern: /eval\s*\(/i, description: 'eval() function detected' },
|
|
185
|
-
{ pattern: /Function\s*\(/i, description: 'Function constructor detected' },
|
|
186
|
-
{ pattern: /exec\s*\(|execSync|spawn|execFile/i, description: 'Process execution detected' },
|
|
187
|
-
{ pattern: /require\s*\([^)]*process/i, description: 'Process module access detected' },
|
|
188
|
-
{ pattern: /child_process/i, description: 'Child process module detected' },
|
|
189
|
-
{ pattern: /fs\.(writeFile|unlink|rmdir|rm)/i, description: 'File system write operation detected' },
|
|
190
|
-
{ pattern: /__dirname|__filename/i, description: 'File system path access detected' },
|
|
191
|
-
];
|
|
192
|
-
for (const { pattern, description } of dangerousPatterns) {
|
|
193
|
-
if (pattern.test(output)) {
|
|
194
|
-
findings.push(`Dangerous pattern: ${description}`);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
// Check for suspicious encoding attempts
|
|
198
|
-
if (/base64|hex|binary|decode/i.test(output) && /eval|exec|Function/i.test(output)) {
|
|
199
|
-
findings.push('Suspicious encoding with code execution detected');
|
|
200
|
-
}
|
|
201
|
-
// If critical findings, don't sanitize - reject entirely
|
|
202
|
-
const hasCriticalFindings = findings.some(f => f.includes('critical') || f.includes('high') || f.includes('Prompt injection'));
|
|
203
145
|
return {
|
|
204
|
-
allowed:
|
|
146
|
+
allowed: findings.length === 0,
|
|
205
147
|
findings,
|
|
206
|
-
sanitized: hasCriticalFindings ? undefined : (sanitized || output),
|
|
207
148
|
};
|
|
208
149
|
}
|
|
209
150
|
}
|