codehere 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of codehere might be problematic. Click here for more details.
- package/README.md +51 -25
- package/dist/agents/base.d.ts +107 -0
- package/dist/agents/base.d.ts.map +1 -0
- package/dist/agents/base.js +101 -0
- package/dist/agents/base.js.map +1 -0
- package/dist/agents/orchestrator-model-driven.d.ts +41 -0
- package/dist/agents/orchestrator-model-driven.d.ts.map +1 -0
- package/dist/agents/orchestrator-model-driven.js +141 -0
- package/dist/agents/orchestrator-model-driven.js.map +1 -0
- package/dist/agents/react-orchestrator-agent.d.ts +15 -0
- package/dist/agents/react-orchestrator-agent.d.ts.map +1 -0
- package/dist/agents/react-orchestrator-agent.js +54 -0
- package/dist/agents/react-orchestrator-agent.js.map +1 -0
- package/dist/application/agents/execution-agent.d.ts +68 -0
- package/dist/application/agents/execution-agent.d.ts.map +1 -0
- package/dist/application/agents/execution-agent.js +299 -0
- package/dist/application/agents/execution-agent.js.map +1 -0
- package/dist/application/agents/multi-agent-orchestrator.d.ts +65 -0
- package/dist/application/agents/multi-agent-orchestrator.d.ts.map +1 -0
- package/dist/application/agents/multi-agent-orchestrator.js +209 -0
- package/dist/application/agents/multi-agent-orchestrator.js.map +1 -0
- package/dist/application/agents/planning-agent.d.ts +61 -0
- package/dist/application/agents/planning-agent.d.ts.map +1 -0
- package/dist/application/agents/planning-agent.js +357 -0
- package/dist/application/agents/planning-agent.js.map +1 -0
- package/dist/application/agents/validation-agent.d.ts +64 -0
- package/dist/application/agents/validation-agent.d.ts.map +1 -0
- package/dist/application/agents/validation-agent.js +182 -0
- package/dist/application/agents/validation-agent.js.map +1 -0
- package/dist/application/architectures/plan-and-act.d.ts +94 -0
- package/dist/application/architectures/plan-and-act.d.ts.map +1 -0
- package/dist/application/architectures/plan-and-act.js +242 -0
- package/dist/application/architectures/plan-and-act.js.map +1 -0
- package/dist/application/index.d.ts +12 -0
- package/dist/application/index.d.ts.map +1 -0
- package/dist/application/index.js +12 -0
- package/dist/application/index.js.map +1 -0
- package/dist/application/services/agent-factory.d.ts +9 -0
- package/dist/application/services/agent-factory.d.ts.map +1 -0
- package/dist/application/services/agent-factory.js +28 -0
- package/dist/application/services/agent-factory.js.map +1 -0
- package/dist/application/services/dependency-container.d.ts +143 -0
- package/dist/application/services/dependency-container.d.ts.map +1 -0
- package/dist/application/services/dependency-container.js +426 -0
- package/dist/application/services/dependency-container.js.map +1 -0
- package/dist/application/services/git-context-service.d.ts +30 -0
- package/dist/application/services/git-context-service.d.ts.map +1 -0
- package/dist/application/services/git-context-service.js +83 -0
- package/dist/application/services/git-context-service.js.map +1 -0
- package/dist/application/services/intelligent-router.d.ts +74 -0
- package/dist/application/services/intelligent-router.d.ts.map +1 -0
- package/dist/application/services/intelligent-router.js +711 -0
- package/dist/application/services/intelligent-router.js.map +1 -0
- package/dist/application/services/tool-executor-service.d.ts +14 -0
- package/dist/application/services/tool-executor-service.d.ts.map +1 -0
- package/dist/application/services/tool-executor-service.js +94 -0
- package/dist/application/services/tool-executor-service.js.map +1 -0
- package/dist/application/use-cases/ask-question-use-case.d.ts +48 -0
- package/dist/application/use-cases/ask-question-use-case.d.ts.map +1 -0
- package/dist/application/use-cases/ask-question-use-case.js +270 -0
- package/dist/application/use-cases/ask-question-use-case.js.map +1 -0
- package/dist/application/use-cases/edit-file-use-case.d.ts +76 -0
- package/dist/application/use-cases/edit-file-use-case.d.ts.map +1 -0
- package/dist/application/use-cases/edit-file-use-case.js +752 -0
- package/dist/application/use-cases/edit-file-use-case.js.map +1 -0
- package/dist/application/use-cases/explain-file-use-case.d.ts +21 -0
- package/dist/application/use-cases/explain-file-use-case.d.ts.map +1 -0
- package/dist/application/use-cases/explain-file-use-case.js +50 -0
- package/dist/application/use-cases/explain-file-use-case.js.map +1 -0
- package/dist/application/use-cases/index-codebase-use-case.d.ts +46 -0
- package/dist/application/use-cases/index-codebase-use-case.d.ts.map +1 -0
- package/dist/application/use-cases/index-codebase-use-case.js +113 -0
- package/dist/application/use-cases/index-codebase-use-case.js.map +1 -0
- package/dist/application/use-cases/planning-use-case.d.ts +46 -0
- package/dist/application/use-cases/planning-use-case.d.ts.map +1 -0
- package/dist/application/use-cases/planning-use-case.js +276 -0
- package/dist/application/use-cases/planning-use-case.js.map +1 -0
- package/dist/application/use-cases/react-orchestration-use-case.d.ts +51 -0
- package/dist/application/use-cases/react-orchestration-use-case.d.ts.map +1 -0
- package/dist/application/use-cases/react-orchestration-use-case.js +329 -0
- package/dist/application/use-cases/react-orchestration-use-case.js.map +1 -0
- package/dist/application/use-cases/reflexion-use-case.d.ts +24 -0
- package/dist/application/use-cases/reflexion-use-case.d.ts.map +1 -0
- package/dist/application/use-cases/reflexion-use-case.js +30 -0
- package/dist/application/use-cases/reflexion-use-case.js.map +1 -0
- package/dist/application/workflows/deterministic-workflows.d.ts +61 -0
- package/dist/application/workflows/deterministic-workflows.d.ts.map +1 -0
- package/dist/application/workflows/deterministic-workflows.js +189 -0
- package/dist/application/workflows/deterministic-workflows.js.map +1 -0
- package/dist/cache.d.ts.map +1 -1
- package/dist/cache.js +1 -3
- package/dist/cache.js.map +1 -1
- package/dist/chat.js +10 -10
- package/dist/chat.js.map +1 -1
- package/dist/docs.d.ts.map +1 -1
- package/dist/docs.js +1 -2
- package/dist/docs.js.map +1 -1
- package/dist/domain/entities/code-chunk.d.ts +26 -0
- package/dist/domain/entities/code-chunk.d.ts.map +1 -0
- package/dist/domain/entities/code-chunk.js +6 -0
- package/dist/domain/entities/code-chunk.js.map +1 -0
- package/dist/domain/entities/decision.d.ts +37 -0
- package/dist/domain/entities/decision.d.ts.map +1 -0
- package/dist/domain/entities/decision.js +9 -0
- package/dist/domain/entities/decision.js.map +1 -0
- package/dist/domain/entities/edit.d.ts +35 -0
- package/dist/domain/entities/edit.d.ts.map +1 -0
- package/dist/domain/entities/edit.js +6 -0
- package/dist/domain/entities/edit.js.map +1 -0
- package/dist/domain/entities/knowledge-node.d.ts +83 -0
- package/dist/domain/entities/knowledge-node.d.ts.map +1 -0
- package/dist/domain/entities/knowledge-node.js +9 -0
- package/dist/domain/entities/knowledge-node.js.map +1 -0
- package/dist/domain/entities/knowledge-preservation.d.ts +42 -0
- package/dist/domain/entities/knowledge-preservation.d.ts.map +1 -0
- package/dist/domain/entities/knowledge-preservation.js +10 -0
- package/dist/domain/entities/knowledge-preservation.js.map +1 -0
- package/dist/domain/entities/memory.d.ts +36 -0
- package/dist/domain/entities/memory.d.ts.map +1 -0
- package/dist/domain/entities/memory.js +6 -0
- package/dist/domain/entities/memory.js.map +1 -0
- package/dist/domain/entities/pattern.d.ts +49 -0
- package/dist/domain/entities/pattern.d.ts.map +1 -0
- package/dist/domain/entities/pattern.js +7 -0
- package/dist/domain/entities/pattern.js.map +1 -0
- package/dist/domain/entities/plan.d.ts +42 -0
- package/dist/domain/entities/plan.d.ts.map +1 -0
- package/dist/domain/entities/plan.js +6 -0
- package/dist/domain/entities/plan.js.map +1 -0
- package/dist/domain/entities/query.d.ts +17 -0
- package/dist/domain/entities/query.d.ts.map +1 -0
- package/dist/domain/entities/query.js +6 -0
- package/dist/domain/entities/query.js.map +1 -0
- package/dist/domain/index.d.ts +16 -0
- package/dist/domain/index.d.ts.map +1 -0
- package/dist/domain/index.js +19 -0
- package/dist/domain/index.js.map +1 -0
- package/dist/domain/interfaces/ai-service.interface.d.ts +62 -0
- package/dist/domain/interfaces/ai-service.interface.d.ts.map +1 -0
- package/dist/domain/interfaces/ai-service.interface.js +6 -0
- package/dist/domain/interfaces/ai-service.interface.js.map +1 -0
- package/dist/domain/interfaces/code-analyzer.interface.d.ts +38 -0
- package/dist/domain/interfaces/code-analyzer.interface.d.ts.map +1 -0
- package/dist/domain/interfaces/code-analyzer.interface.js +6 -0
- package/dist/domain/interfaces/code-analyzer.interface.js.map +1 -0
- package/dist/domain/interfaces/decision-repository.interface.d.ts +51 -0
- package/dist/domain/interfaces/decision-repository.interface.d.ts.map +1 -0
- package/dist/domain/interfaces/decision-repository.interface.js +9 -0
- package/dist/domain/interfaces/decision-repository.interface.js.map +1 -0
- package/dist/domain/interfaces/embedding-repository.interface.d.ts +28 -0
- package/dist/domain/interfaces/embedding-repository.interface.d.ts.map +1 -0
- package/dist/domain/interfaces/embedding-repository.interface.js +6 -0
- package/dist/domain/interfaces/embedding-repository.interface.js.map +1 -0
- package/dist/domain/interfaces/knowledge-graph-repository.interface.d.ts +91 -0
- package/dist/domain/interfaces/knowledge-graph-repository.interface.d.ts.map +1 -0
- package/dist/domain/interfaces/knowledge-graph-repository.interface.js +9 -0
- package/dist/domain/interfaces/knowledge-graph-repository.interface.js.map +1 -0
- package/dist/domain/interfaces/knowledge-preservation-repository.interface.d.ts +50 -0
- package/dist/domain/interfaces/knowledge-preservation-repository.interface.d.ts.map +1 -0
- package/dist/domain/interfaces/knowledge-preservation-repository.interface.js +8 -0
- package/dist/domain/interfaces/knowledge-preservation-repository.interface.js.map +1 -0
- package/dist/domain/interfaces/memory-repository.interface.d.ts +49 -0
- package/dist/domain/interfaces/memory-repository.interface.d.ts.map +1 -0
- package/dist/domain/interfaces/memory-repository.interface.js +6 -0
- package/dist/domain/interfaces/memory-repository.interface.js.map +1 -0
- package/dist/domain/interfaces/pattern-repository.interface.d.ts +48 -0
- package/dist/domain/interfaces/pattern-repository.interface.d.ts.map +1 -0
- package/dist/domain/interfaces/pattern-repository.interface.js +6 -0
- package/dist/domain/interfaces/pattern-repository.interface.js.map +1 -0
- package/dist/domain/interfaces/verification-service.interface.d.ts +20 -0
- package/dist/domain/interfaces/verification-service.interface.d.ts.map +1 -0
- package/dist/domain/interfaces/verification-service.interface.js +6 -0
- package/dist/domain/interfaces/verification-service.interface.js.map +1 -0
- package/dist/domain/services/codebase-detector.d.ts +18 -0
- package/dist/domain/services/codebase-detector.d.ts.map +1 -0
- package/dist/domain/services/codebase-detector.js +91 -0
- package/dist/domain/services/codebase-detector.js.map +1 -0
- package/dist/domain/services/cross-team-pattern-sharing.d.ts +65 -0
- package/dist/domain/services/cross-team-pattern-sharing.d.ts.map +1 -0
- package/dist/domain/services/cross-team-pattern-sharing.js +125 -0
- package/dist/domain/services/cross-team-pattern-sharing.js.map +1 -0
- package/dist/domain/services/decision-recorder.d.ts +76 -0
- package/dist/domain/services/decision-recorder.d.ts.map +1 -0
- package/dist/domain/services/decision-recorder.js +223 -0
- package/dist/domain/services/decision-recorder.js.map +1 -0
- package/dist/domain/services/decision-retriever.d.ts +75 -0
- package/dist/domain/services/decision-retriever.d.ts.map +1 -0
- package/dist/domain/services/decision-retriever.js +133 -0
- package/dist/domain/services/decision-retriever.js.map +1 -0
- package/dist/domain/services/graded-memory-activation.d.ts +37 -0
- package/dist/domain/services/graded-memory-activation.d.ts.map +1 -0
- package/dist/domain/services/graded-memory-activation.js +69 -0
- package/dist/domain/services/graded-memory-activation.js.map +1 -0
- package/dist/domain/services/knowledge-access.d.ts +63 -0
- package/dist/domain/services/knowledge-access.d.ts.map +1 -0
- package/dist/domain/services/knowledge-access.js +132 -0
- package/dist/domain/services/knowledge-access.js.map +1 -0
- package/dist/domain/services/knowledge-extractor.d.ts +54 -0
- package/dist/domain/services/knowledge-extractor.d.ts.map +1 -0
- package/dist/domain/services/knowledge-extractor.js +247 -0
- package/dist/domain/services/knowledge-extractor.js.map +1 -0
- package/dist/domain/services/knowledge-graph-builder.d.ts +70 -0
- package/dist/domain/services/knowledge-graph-builder.d.ts.map +1 -0
- package/dist/domain/services/knowledge-graph-builder.js +268 -0
- package/dist/domain/services/knowledge-graph-builder.js.map +1 -0
- package/dist/domain/services/knowledge-graph-query.d.ts +69 -0
- package/dist/domain/services/knowledge-graph-query.d.ts.map +1 -0
- package/dist/domain/services/knowledge-graph-query.js +187 -0
- package/dist/domain/services/knowledge-graph-query.js.map +1 -0
- package/dist/domain/services/memory-retriever.d.ts +30 -0
- package/dist/domain/services/memory-retriever.d.ts.map +1 -0
- package/dist/domain/services/memory-retriever.js +82 -0
- package/dist/domain/services/memory-retriever.js.map +1 -0
- package/dist/domain/services/memory-synthesizer.d.ts +57 -0
- package/dist/domain/services/memory-synthesizer.d.ts.map +1 -0
- package/dist/domain/services/memory-synthesizer.js +91 -0
- package/dist/domain/services/memory-synthesizer.js.map +1 -0
- package/dist/domain/services/pattern-extractor.d.ts +108 -0
- package/dist/domain/services/pattern-extractor.d.ts.map +1 -0
- package/dist/domain/services/pattern-extractor.js +442 -0
- package/dist/domain/services/pattern-extractor.js.map +1 -0
- package/dist/domain/services/query-intent-classifier.d.ts +16 -0
- package/dist/domain/services/query-intent-classifier.d.ts.map +1 -0
- package/dist/domain/services/query-intent-classifier.js +140 -0
- package/dist/domain/services/query-intent-classifier.js.map +1 -0
- package/dist/domain/services/react-loop.d.ts +52 -0
- package/dist/domain/services/react-loop.d.ts.map +1 -0
- package/dist/domain/services/react-loop.js +186 -0
- package/dist/domain/services/react-loop.js.map +1 -0
- package/dist/edit.d.ts +0 -12
- package/dist/edit.d.ts.map +1 -1
- package/dist/edit.js +76 -351
- package/dist/edit.js.map +1 -1
- package/dist/embed.d.ts +0 -4
- package/dist/embed.d.ts.map +1 -1
- package/dist/embed.js +100 -174
- package/dist/embed.js.map +1 -1
- package/dist/error-handler.d.ts +1 -0
- package/dist/error-handler.d.ts.map +1 -1
- package/dist/error-handler.js +46 -3
- package/dist/error-handler.js.map +1 -1
- package/dist/formatter.d.ts +2 -2
- package/dist/formatter.d.ts.map +1 -1
- package/dist/formatter.js +30 -17
- package/dist/formatter.js.map +1 -1
- package/dist/index.js +355 -239
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/ai/cohere-ai-service.d.ts +56 -0
- package/dist/infrastructure/ai/cohere-ai-service.d.ts.map +1 -0
- package/dist/infrastructure/ai/cohere-ai-service.js +594 -0
- package/dist/infrastructure/ai/cohere-ai-service.js.map +1 -0
- package/dist/infrastructure/ai/command-r-evaluation.d.ts +42 -0
- package/dist/infrastructure/ai/command-r-evaluation.d.ts.map +1 -0
- package/dist/infrastructure/ai/command-r-evaluation.js +206 -0
- package/dist/infrastructure/ai/command-r-evaluation.js.map +1 -0
- package/dist/infrastructure/ai/model-config.d.ts +47 -0
- package/dist/infrastructure/ai/model-config.d.ts.map +1 -0
- package/dist/infrastructure/ai/model-config.js +84 -0
- package/dist/infrastructure/ai/model-config.js.map +1 -0
- package/dist/infrastructure/cache/embedding-cache.d.ts +46 -0
- package/dist/infrastructure/cache/embedding-cache.d.ts.map +1 -0
- package/dist/infrastructure/cache/embedding-cache.js +104 -0
- package/dist/infrastructure/cache/embedding-cache.js.map +1 -0
- package/dist/infrastructure/cache/query-result-cache.d.ts +68 -0
- package/dist/infrastructure/cache/query-result-cache.d.ts.map +1 -0
- package/dist/infrastructure/cache/query-result-cache.js +138 -0
- package/dist/infrastructure/cache/query-result-cache.js.map +1 -0
- package/dist/infrastructure/cache/security-scan-cache.d.ts +57 -0
- package/dist/infrastructure/cache/security-scan-cache.d.ts.map +1 -0
- package/dist/infrastructure/cache/security-scan-cache.js +124 -0
- package/dist/infrastructure/cache/security-scan-cache.js.map +1 -0
- package/dist/infrastructure/chunking/ast-code-chunker.d.ts +12 -0
- package/dist/infrastructure/chunking/ast-code-chunker.d.ts.map +1 -0
- package/dist/infrastructure/chunking/ast-code-chunker.js +19 -0
- package/dist/infrastructure/chunking/ast-code-chunker.js.map +1 -0
- package/dist/infrastructure/chunking/code-aware-chunker.d.ts +63 -0
- package/dist/infrastructure/chunking/code-aware-chunker.d.ts.map +1 -0
- package/dist/infrastructure/chunking/code-aware-chunker.js +397 -0
- package/dist/infrastructure/chunking/code-aware-chunker.js.map +1 -0
- package/dist/infrastructure/completion/bash-completion.d.ts +8 -0
- package/dist/infrastructure/completion/bash-completion.d.ts.map +1 -0
- package/dist/infrastructure/completion/bash-completion.js +101 -0
- package/dist/infrastructure/completion/bash-completion.js.map +1 -0
- package/dist/infrastructure/completion/completion-generator.d.ts +42 -0
- package/dist/infrastructure/completion/completion-generator.d.ts.map +1 -0
- package/dist/infrastructure/completion/completion-generator.js +184 -0
- package/dist/infrastructure/completion/completion-generator.js.map +1 -0
- package/dist/infrastructure/completion/fish-completion.d.ts +8 -0
- package/dist/infrastructure/completion/fish-completion.d.ts.map +1 -0
- package/dist/infrastructure/completion/fish-completion.js +65 -0
- package/dist/infrastructure/completion/fish-completion.js.map +1 -0
- package/dist/infrastructure/completion/zsh-completion.d.ts +8 -0
- package/dist/infrastructure/completion/zsh-completion.d.ts.map +1 -0
- package/dist/infrastructure/completion/zsh-completion.js +85 -0
- package/dist/infrastructure/completion/zsh-completion.js.map +1 -0
- package/dist/infrastructure/config/config-manager.d.ts +79 -0
- package/dist/infrastructure/config/config-manager.d.ts.map +1 -0
- package/dist/infrastructure/config/config-manager.js +162 -0
- package/dist/infrastructure/config/config-manager.js.map +1 -0
- package/dist/infrastructure/context/context-compressor.d.ts +94 -0
- package/dist/infrastructure/context/context-compressor.d.ts.map +1 -0
- package/dist/infrastructure/context/context-compressor.js +329 -0
- package/dist/infrastructure/context/context-compressor.js.map +1 -0
- package/dist/infrastructure/cost/cost-tracker.d.ts +90 -0
- package/dist/infrastructure/cost/cost-tracker.d.ts.map +1 -0
- package/dist/infrastructure/cost/cost-tracker.js +353 -0
- package/dist/infrastructure/cost/cost-tracker.js.map +1 -0
- package/dist/infrastructure/file-scanner/file-scanner.d.ts +31 -0
- package/dist/infrastructure/file-scanner/file-scanner.d.ts.map +1 -0
- package/dist/infrastructure/file-scanner/file-scanner.js +106 -0
- package/dist/infrastructure/file-scanner/file-scanner.js.map +1 -0
- package/dist/infrastructure/governance/nist-ai-rmf.d.ts +107 -0
- package/dist/infrastructure/governance/nist-ai-rmf.d.ts.map +1 -0
- package/dist/infrastructure/governance/nist-ai-rmf.js +294 -0
- package/dist/infrastructure/governance/nist-ai-rmf.js.map +1 -0
- package/dist/infrastructure/governance/policy-as-code.d.ts +90 -0
- package/dist/infrastructure/governance/policy-as-code.d.ts.map +1 -0
- package/dist/infrastructure/governance/policy-as-code.js +259 -0
- package/dist/infrastructure/governance/policy-as-code.js.map +1 -0
- package/dist/infrastructure/governance/prompt-to-code-lineage.d.ts +138 -0
- package/dist/infrastructure/governance/prompt-to-code-lineage.d.ts.map +1 -0
- package/dist/infrastructure/governance/prompt-to-code-lineage.js +241 -0
- package/dist/infrastructure/governance/prompt-to-code-lineage.js.map +1 -0
- package/dist/infrastructure/index.d.ts +7 -0
- package/dist/infrastructure/index.d.ts.map +1 -0
- package/dist/infrastructure/index.js +7 -0
- package/dist/infrastructure/index.js.map +1 -0
- package/dist/infrastructure/observability/execution-tracer.d.ts +108 -0
- package/dist/infrastructure/observability/execution-tracer.d.ts.map +1 -0
- package/dist/infrastructure/observability/execution-tracer.js +227 -0
- package/dist/infrastructure/observability/execution-tracer.js.map +1 -0
- package/dist/infrastructure/observability/prompt-versioner.d.ts +67 -0
- package/dist/infrastructure/observability/prompt-versioner.d.ts.map +1 -0
- package/dist/infrastructure/observability/prompt-versioner.js +145 -0
- package/dist/infrastructure/observability/prompt-versioner.js.map +1 -0
- package/dist/infrastructure/protocols/a2a-metadata.d.ts +278 -0
- package/dist/infrastructure/protocols/a2a-metadata.d.ts.map +1 -0
- package/dist/infrastructure/protocols/a2a-metadata.js +137 -0
- package/dist/infrastructure/protocols/a2a-metadata.js.map +1 -0
- package/dist/infrastructure/protocols/a2a-protocol.d.ts +132 -0
- package/dist/infrastructure/protocols/a2a-protocol.d.ts.map +1 -0
- package/dist/infrastructure/protocols/a2a-protocol.js +314 -0
- package/dist/infrastructure/protocols/a2a-protocol.js.map +1 -0
- package/dist/infrastructure/protocols/mcp-oauth.d.ts +91 -0
- package/dist/infrastructure/protocols/mcp-oauth.d.ts.map +1 -0
- package/dist/infrastructure/protocols/mcp-oauth.js +184 -0
- package/dist/infrastructure/protocols/mcp-oauth.js.map +1 -0
- package/dist/infrastructure/protocols/mcp-server.d.ts +126 -0
- package/dist/infrastructure/protocols/mcp-server.d.ts.map +1 -0
- package/dist/infrastructure/protocols/mcp-server.js +333 -0
- package/dist/infrastructure/protocols/mcp-server.js.map +1 -0
- package/dist/infrastructure/protocols/streaming-handler.d.ts +57 -0
- package/dist/infrastructure/protocols/streaming-handler.d.ts.map +1 -0
- package/dist/infrastructure/protocols/streaming-handler.js +103 -0
- package/dist/infrastructure/protocols/streaming-handler.js.map +1 -0
- package/dist/infrastructure/security/ai-sast-scanner.d.ts +59 -0
- package/dist/infrastructure/security/ai-sast-scanner.d.ts.map +1 -0
- package/dist/infrastructure/security/ai-sast-scanner.js +241 -0
- package/dist/infrastructure/security/ai-sast-scanner.js.map +1 -0
- package/dist/infrastructure/security/docker-sandbox.d.ts +57 -0
- package/dist/infrastructure/security/docker-sandbox.d.ts.map +1 -0
- package/dist/infrastructure/security/docker-sandbox.js +178 -0
- package/dist/infrastructure/security/docker-sandbox.js.map +1 -0
- package/dist/infrastructure/security/enhanced-security-gate.d.ts +53 -0
- package/dist/infrastructure/security/enhanced-security-gate.d.ts.map +1 -0
- package/dist/infrastructure/security/enhanced-security-gate.js +151 -0
- package/dist/infrastructure/security/enhanced-security-gate.js.map +1 -0
- package/dist/infrastructure/security/input-validator.d.ts +33 -0
- package/dist/infrastructure/security/input-validator.d.ts.map +1 -0
- package/dist/infrastructure/security/input-validator.js +152 -0
- package/dist/infrastructure/security/input-validator.js.map +1 -0
- package/dist/infrastructure/security/license-scanner.d.ts +55 -0
- package/dist/infrastructure/security/license-scanner.d.ts.map +1 -0
- package/dist/infrastructure/security/license-scanner.js +167 -0
- package/dist/infrastructure/security/license-scanner.js.map +1 -0
- package/dist/infrastructure/security/provider-bias-detector.d.ts +53 -0
- package/dist/infrastructure/security/provider-bias-detector.d.ts.map +1 -0
- package/dist/infrastructure/security/provider-bias-detector.js +164 -0
- package/dist/infrastructure/security/provider-bias-detector.js.map +1 -0
- package/dist/infrastructure/security/sandbox-executor.d.ts +34 -0
- package/dist/infrastructure/security/sandbox-executor.d.ts.map +1 -0
- package/dist/infrastructure/security/sandbox-executor.js +64 -0
- package/dist/infrastructure/security/sandbox-executor.js.map +1 -0
- package/dist/infrastructure/storage/memory-stream-service.d.ts +47 -0
- package/dist/infrastructure/storage/memory-stream-service.d.ts.map +1 -0
- package/dist/infrastructure/storage/memory-stream-service.js +204 -0
- package/dist/infrastructure/storage/memory-stream-service.js.map +1 -0
- package/dist/infrastructure/storage/plan-repository.d.ts +38 -0
- package/dist/infrastructure/storage/plan-repository.d.ts.map +1 -0
- package/dist/infrastructure/storage/plan-repository.js +133 -0
- package/dist/infrastructure/storage/plan-repository.js.map +1 -0
- package/dist/infrastructure/storage/sqlite-decision-repository.d.ts +29 -0
- package/dist/infrastructure/storage/sqlite-decision-repository.d.ts.map +1 -0
- package/dist/infrastructure/storage/sqlite-decision-repository.js +232 -0
- package/dist/infrastructure/storage/sqlite-decision-repository.js.map +1 -0
- package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts +35 -0
- package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts.map +1 -0
- package/dist/infrastructure/storage/sqlite-embedding-repository.js +277 -0
- package/dist/infrastructure/storage/sqlite-embedding-repository.js.map +1 -0
- package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.d.ts +41 -0
- package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.d.ts.map +1 -0
- package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.js +417 -0
- package/dist/infrastructure/storage/sqlite-knowledge-graph-repository.js.map +1 -0
- package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.d.ts +29 -0
- package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.d.ts.map +1 -0
- package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.js +230 -0
- package/dist/infrastructure/storage/sqlite-knowledge-preservation-repository.js.map +1 -0
- package/dist/infrastructure/storage/sqlite-memory-repository.d.ts +40 -0
- package/dist/infrastructure/storage/sqlite-memory-repository.d.ts.map +1 -0
- package/dist/infrastructure/storage/sqlite-memory-repository.js +229 -0
- package/dist/infrastructure/storage/sqlite-memory-repository.js.map +1 -0
- package/dist/infrastructure/storage/sqlite-pattern-repository.d.ts +25 -0
- package/dist/infrastructure/storage/sqlite-pattern-repository.d.ts.map +1 -0
- package/dist/infrastructure/storage/sqlite-pattern-repository.js +249 -0
- package/dist/infrastructure/storage/sqlite-pattern-repository.js.map +1 -0
- package/dist/infrastructure/ux/appropriate-friction.d.ts +77 -0
- package/dist/infrastructure/ux/appropriate-friction.d.ts.map +1 -0
- package/dist/infrastructure/ux/appropriate-friction.js +213 -0
- package/dist/infrastructure/ux/appropriate-friction.js.map +1 -0
- package/dist/infrastructure/ux/bi-directional-learning.d.ts +109 -0
- package/dist/infrastructure/ux/bi-directional-learning.d.ts.map +1 -0
- package/dist/infrastructure/ux/bi-directional-learning.js +200 -0
- package/dist/infrastructure/ux/bi-directional-learning.js.map +1 -0
- package/dist/infrastructure/ux/contextual-feature-discovery.d.ts +24 -0
- package/dist/infrastructure/ux/contextual-feature-discovery.d.ts.map +1 -0
- package/dist/infrastructure/ux/contextual-feature-discovery.js +144 -0
- package/dist/infrastructure/ux/contextual-feature-discovery.js.map +1 -0
- package/dist/infrastructure/ux/expectation-management.d.ts +98 -0
- package/dist/infrastructure/ux/expectation-management.d.ts.map +1 -0
- package/dist/infrastructure/ux/expectation-management.js +327 -0
- package/dist/infrastructure/ux/expectation-management.js.map +1 -0
- package/dist/infrastructure/ux/feature-discovery.d.ts +47 -0
- package/dist/infrastructure/ux/feature-discovery.d.ts.map +1 -0
- package/dist/infrastructure/ux/feature-discovery.js +190 -0
- package/dist/infrastructure/ux/feature-discovery.js.map +1 -0
- package/dist/infrastructure/ux/hitl-review-portal.d.ts +47 -0
- package/dist/infrastructure/ux/hitl-review-portal.d.ts.map +1 -0
- package/dist/infrastructure/ux/hitl-review-portal.js +225 -0
- package/dist/infrastructure/ux/hitl-review-portal.js.map +1 -0
- package/dist/infrastructure/ux/hitl-validation.d.ts +104 -0
- package/dist/infrastructure/ux/hitl-validation.d.ts.map +1 -0
- package/dist/infrastructure/ux/hitl-validation.js +211 -0
- package/dist/infrastructure/ux/hitl-validation.js.map +1 -0
- package/dist/infrastructure/ux/progress-indicator.d.ts +54 -0
- package/dist/infrastructure/ux/progress-indicator.d.ts.map +1 -0
- package/dist/infrastructure/ux/progress-indicator.js +121 -0
- package/dist/infrastructure/ux/progress-indicator.js.map +1 -0
- package/dist/infrastructure/ux/progressive-disclosure.d.ts +84 -0
- package/dist/infrastructure/ux/progressive-disclosure.d.ts.map +1 -0
- package/dist/infrastructure/ux/progressive-disclosure.js +236 -0
- package/dist/infrastructure/ux/progressive-disclosure.js.map +1 -0
- package/dist/infrastructure/ux/review-checkpoint.d.ts +35 -0
- package/dist/infrastructure/ux/review-checkpoint.d.ts.map +1 -0
- package/dist/infrastructure/ux/review-checkpoint.js +119 -0
- package/dist/infrastructure/ux/review-checkpoint.js.map +1 -0
- package/dist/infrastructure/ux/staged-feature-intro.d.ts +47 -0
- package/dist/infrastructure/ux/staged-feature-intro.d.ts.map +1 -0
- package/dist/infrastructure/ux/staged-feature-intro.js +144 -0
- package/dist/infrastructure/ux/staged-feature-intro.js.map +1 -0
- package/dist/infrastructure/ux/syntax-highlighter.d.ts +21 -0
- package/dist/infrastructure/ux/syntax-highlighter.d.ts.map +1 -0
- package/dist/infrastructure/ux/syntax-highlighter.js +172 -0
- package/dist/infrastructure/ux/syntax-highlighter.js.map +1 -0
- package/dist/infrastructure/ux/team-standards.d.ts +94 -0
- package/dist/infrastructure/ux/team-standards.d.ts.map +1 -0
- package/dist/infrastructure/ux/team-standards.js +196 -0
- package/dist/infrastructure/ux/team-standards.js.map +1 -0
- package/dist/infrastructure/verification/verification-service.d.ts +12 -0
- package/dist/infrastructure/verification/verification-service.d.ts.map +1 -0
- package/dist/infrastructure/verification/verification-service.js +47 -0
- package/dist/infrastructure/verification/verification-service.js.map +1 -0
- package/dist/infrastructure/xai/attention-visualizer.d.ts +73 -0
- package/dist/infrastructure/xai/attention-visualizer.d.ts.map +1 -0
- package/dist/infrastructure/xai/attention-visualizer.js +174 -0
- package/dist/infrastructure/xai/attention-visualizer.js.map +1 -0
- package/dist/infrastructure/xai/cot-visualizer.d.ts +106 -0
- package/dist/infrastructure/xai/cot-visualizer.d.ts.map +1 -0
- package/dist/infrastructure/xai/cot-visualizer.js +286 -0
- package/dist/infrastructure/xai/cot-visualizer.js.map +1 -0
- package/dist/infrastructure/xai/decision-tree-log.d.ts +104 -0
- package/dist/infrastructure/xai/decision-tree-log.d.ts.map +1 -0
- package/dist/infrastructure/xai/decision-tree-log.js +216 -0
- package/dist/infrastructure/xai/decision-tree-log.js.map +1 -0
- package/dist/infrastructure/xai/interactive-xai.d.ts +106 -0
- package/dist/infrastructure/xai/interactive-xai.d.ts.map +1 -0
- package/dist/infrastructure/xai/interactive-xai.js +262 -0
- package/dist/infrastructure/xai/interactive-xai.js.map +1 -0
- package/dist/infrastructure/xai/uncertainty-quantifier.d.ts +80 -0
- package/dist/infrastructure/xai/uncertainty-quantifier.d.ts.map +1 -0
- package/dist/infrastructure/xai/uncertainty-quantifier.js +201 -0
- package/dist/infrastructure/xai/uncertainty-quantifier.js.map +1 -0
- package/dist/intelligent-retrieval.d.ts.map +1 -1
- package/dist/intelligent-retrieval.js +8 -1
- package/dist/intelligent-retrieval.js.map +1 -1
- package/dist/intent/classifier.d.ts +6 -0
- package/dist/intent/classifier.d.ts.map +1 -0
- package/dist/intent/classifier.js +2 -0
- package/dist/intent/classifier.js.map +1 -0
- package/dist/intent/context.d.ts +4 -0
- package/dist/intent/context.d.ts.map +1 -0
- package/dist/intent/context.js +2 -0
- package/dist/intent/context.js.map +1 -0
- package/dist/iterative-refinement.d.ts.map +1 -1
- package/dist/iterative-refinement.js +20 -3
- package/dist/iterative-refinement.js.map +1 -1
- package/dist/learning.d.ts.map +1 -1
- package/dist/learning.js +1 -2
- package/dist/learning.js.map +1 -1
- package/dist/monitoring.d.ts.map +1 -1
- package/dist/monitoring.js +1 -2
- package/dist/monitoring.js.map +1 -1
- package/dist/parallel-processor.d.ts +3 -2
- package/dist/parallel-processor.d.ts.map +1 -1
- package/dist/parallel-processor.js +183 -56
- package/dist/parallel-processor.js.map +1 -1
- package/dist/presentation/cli/commands/ask-command.d.ts +8 -0
- package/dist/presentation/cli/commands/ask-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/ask-command.js +190 -0
- package/dist/presentation/cli/commands/ask-command.js.map +1 -0
- package/dist/presentation/cli/commands/config-command.d.ts +9 -0
- package/dist/presentation/cli/commands/config-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/config-command.js +123 -0
- package/dist/presentation/cli/commands/config-command.js.map +1 -0
- package/dist/presentation/cli/commands/cost-command.d.ts +8 -0
- package/dist/presentation/cli/commands/cost-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/cost-command.js +191 -0
- package/dist/presentation/cli/commands/cost-command.js.map +1 -0
- package/dist/presentation/cli/commands/decision-command.d.ts +12 -0
- package/dist/presentation/cli/commands/decision-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/decision-command.js +207 -0
- package/dist/presentation/cli/commands/decision-command.js.map +1 -0
- package/dist/presentation/cli/commands/help-command.d.ts +9 -0
- package/dist/presentation/cli/commands/help-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/help-command.js +281 -0
- package/dist/presentation/cli/commands/help-command.js.map +1 -0
- package/dist/presentation/cli/commands/knowledge-command.d.ts +13 -0
- package/dist/presentation/cli/commands/knowledge-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/knowledge-command.js +129 -0
- package/dist/presentation/cli/commands/knowledge-command.js.map +1 -0
- package/dist/presentation/cli/commands/learning-dashboard-command.d.ts +8 -0
- package/dist/presentation/cli/commands/learning-dashboard-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/learning-dashboard-command.js +183 -0
- package/dist/presentation/cli/commands/learning-dashboard-command.js.map +1 -0
- package/dist/presentation/cli/commands/orchestrate-command.d.ts +9 -0
- package/dist/presentation/cli/commands/orchestrate-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/orchestrate-command.js +146 -0
- package/dist/presentation/cli/commands/orchestrate-command.js.map +1 -0
- package/dist/presentation/cli/commands/plan-command.d.ts +8 -0
- package/dist/presentation/cli/commands/plan-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/plan-command.js +166 -0
- package/dist/presentation/cli/commands/plan-command.js.map +1 -0
- package/dist/presentation/cli/commands/react-command.d.ts +8 -0
- package/dist/presentation/cli/commands/react-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/react-command.js +179 -0
- package/dist/presentation/cli/commands/react-command.js.map +1 -0
- package/dist/presentation/cli/commands/setup-command.d.ts +10 -0
- package/dist/presentation/cli/commands/setup-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/setup-command.js +286 -0
- package/dist/presentation/cli/commands/setup-command.js.map +1 -0
- package/dist/presentation/cli/commands/smart-command.d.ts +6 -0
- package/dist/presentation/cli/commands/smart-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/smart-command.js +330 -0
- package/dist/presentation/cli/commands/smart-command.js.map +1 -0
- package/dist/presentation/cli/commands/trace-command.d.ts +8 -0
- package/dist/presentation/cli/commands/trace-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/trace-command.js +129 -0
- package/dist/presentation/cli/commands/trace-command.js.map +1 -0
- package/dist/presentation/cli/commands/undo-command.d.ts +8 -0
- package/dist/presentation/cli/commands/undo-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/undo-command.js +150 -0
- package/dist/presentation/cli/commands/undo-command.js.map +1 -0
- package/dist/presentation/cli/error-display.d.ts +25 -0
- package/dist/presentation/cli/error-display.d.ts.map +1 -0
- package/dist/presentation/cli/error-display.js +297 -0
- package/dist/presentation/cli/error-display.js.map +1 -0
- package/dist/presentation/cli/keyboard-shortcuts.d.ts +27 -0
- package/dist/presentation/cli/keyboard-shortcuts.d.ts.map +1 -0
- package/dist/presentation/cli/keyboard-shortcuts.js +77 -0
- package/dist/presentation/cli/keyboard-shortcuts.js.map +1 -0
- package/dist/refactor.d.ts.map +1 -1
- package/dist/refactor.js +2 -4
- package/dist/refactor.js.map +1 -1
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +2 -63
- package/dist/search.js.map +1 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +72 -3
- package/dist/session.js.map +1 -1
- package/dist/testgen.d.ts.map +1 -1
- package/dist/testgen.js +1 -2
- package/dist/testgen.js.map +1 -1
- package/dist/tools/bash.d.ts +53 -0
- package/dist/tools/bash.d.ts.map +1 -0
- package/dist/tools/bash.js +213 -0
- package/dist/tools/bash.js.map +1 -0
- package/dist/tools/edit.d.ts +48 -0
- package/dist/tools/edit.d.ts.map +1 -0
- package/dist/tools/edit.js +235 -0
- package/dist/tools/edit.js.map +1 -0
- package/dist/tools/executor.d.ts +29 -0
- package/dist/tools/executor.d.ts.map +1 -0
- package/dist/tools/executor.js +153 -0
- package/dist/tools/executor.js.map +1 -0
- package/dist/tools/git-tool.d.ts +87 -0
- package/dist/tools/git-tool.d.ts.map +1 -0
- package/dist/tools/git-tool.js +292 -0
- package/dist/tools/git-tool.js.map +1 -0
- package/dist/tools/parser.d.ts +33 -0
- package/dist/tools/parser.d.ts.map +1 -0
- package/dist/tools/parser.js +158 -0
- package/dist/tools/parser.js.map +1 -0
- package/dist/tools/registry.d.ts +74 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +302 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/search.d.ts +41 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/search.js +100 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +4 -2
- package/dist/ui.js.map +1 -1
- package/dist/utils/check-api-status.d.ts +12 -0
- package/dist/utils/check-api-status.d.ts.map +1 -0
- package/dist/utils/check-api-status.js +82 -0
- package/dist/utils/check-api-status.js.map +1 -0
- package/dist/utils/diff-parser.d.ts +22 -0
- package/dist/utils/diff-parser.d.ts.map +1 -0
- package/dist/utils/diff-parser.js +160 -0
- package/dist/utils/diff-parser.js.map +1 -0
- package/dist/utils/logger.d.ts +34 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +56 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/version.d.ts +21 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +52 -0
- package/dist/utils/version.js.map +1 -0
- package/dist/verification/backup.d.ts +30 -0
- package/dist/verification/backup.d.ts.map +1 -0
- package/dist/verification/backup.js +259 -0
- package/dist/verification/backup.js.map +1 -0
- package/dist/verification/compiler.d.ts +20 -0
- package/dist/verification/compiler.d.ts.map +1 -0
- package/dist/verification/compiler.js +263 -0
- package/dist/verification/compiler.js.map +1 -0
- package/dist/verification/index.d.ts +59 -0
- package/dist/verification/index.d.ts.map +1 -0
- package/dist/verification/index.js +273 -0
- package/dist/verification/index.js.map +1 -0
- package/dist/verification/test-runner.d.ts +27 -0
- package/dist/verification/test-runner.d.ts.map +1 -0
- package/dist/verification/test-runner.js +379 -0
- package/dist/verification/test-runner.js.map +1 -0
- package/package.json +39 -14
- package/ARCHITECTURE.md +0 -240
- package/CHANGELOG.md +0 -44
- package/CONTRIBUTING.md +0 -171
- package/dist/benchmark.d.ts +0 -39
- package/dist/benchmark.d.ts.map +0 -1
- package/dist/benchmark.js +0 -195
- package/dist/benchmark.js.map +0 -1
- package/dist/scaffold.d.ts +0 -14
- package/dist/scaffold.d.ts.map +0 -1
- package/dist/scaffold.js +0 -85
- package/dist/scaffold.js.map +0 -1
- package/templates/next-page/app/layout.tsx +0 -19
- package/templates/next-page/app/page.tsx +0 -10
- package/templates/next-page/package.json +0 -22
- package/templates/node-api/index.js +0 -57
- package/templates/node-api/package.json +0 -13
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plan Repository
|
|
3
|
+
* Persists and retrieves plans for execution across sessions
|
|
4
|
+
*/
|
|
5
|
+
import { writeFileSync, readFileSync, existsSync, mkdirSync, readdirSync, unlinkSync } from 'fs';
|
|
6
|
+
import { join, dirname } from 'path';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
import { randomUUID } from 'crypto';
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = dirname(__filename);
|
|
11
|
+
export class FilePlanRepository {
|
|
12
|
+
plansDir;
|
|
13
|
+
constructor() {
|
|
14
|
+
// Store plans in agent/data/plans/
|
|
15
|
+
const agentDir = join(__dirname, '../../..');
|
|
16
|
+
this.plansDir = join(agentDir, 'data', 'plans');
|
|
17
|
+
if (!existsSync(this.plansDir)) {
|
|
18
|
+
mkdirSync(this.plansDir, { recursive: true });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Save a plan to disk
|
|
23
|
+
*/
|
|
24
|
+
async save(plan) {
|
|
25
|
+
const planId = plan.id || randomUUID();
|
|
26
|
+
const planWithId = { ...plan, id: planId };
|
|
27
|
+
// Add timestamps if not present
|
|
28
|
+
if (!planWithId.createdAt) {
|
|
29
|
+
planWithId.createdAt = new Date();
|
|
30
|
+
}
|
|
31
|
+
planWithId.updatedAt = new Date();
|
|
32
|
+
const planFilePath = join(this.plansDir, `${planId}.json`);
|
|
33
|
+
writeFileSync(planFilePath, JSON.stringify(planWithId, null, 2), 'utf-8');
|
|
34
|
+
return planId;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get a plan by ID
|
|
38
|
+
*/
|
|
39
|
+
async get(planId) {
|
|
40
|
+
const planFilePath = join(this.plansDir, `${planId}.json`);
|
|
41
|
+
if (!existsSync(planFilePath)) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
const content = readFileSync(planFilePath, 'utf-8');
|
|
46
|
+
const plan = JSON.parse(content);
|
|
47
|
+
// Convert date strings back to Date objects
|
|
48
|
+
plan.createdAt = new Date(plan.createdAt);
|
|
49
|
+
if (plan.updatedAt) {
|
|
50
|
+
plan.updatedAt = new Date(plan.updatedAt);
|
|
51
|
+
}
|
|
52
|
+
if (plan.lastUpdated) {
|
|
53
|
+
plan.lastUpdated = new Date(plan.lastUpdated);
|
|
54
|
+
}
|
|
55
|
+
return plan;
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.error(`Failed to load plan ${planId}:`, error);
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* List recent plans
|
|
64
|
+
*/
|
|
65
|
+
async list(limit = 10) {
|
|
66
|
+
try {
|
|
67
|
+
const files = readdirSync(this.plansDir)
|
|
68
|
+
.filter(f => f.endsWith('.json'))
|
|
69
|
+
.map(f => {
|
|
70
|
+
const planFilePath = join(this.plansDir, f);
|
|
71
|
+
try {
|
|
72
|
+
const content = readFileSync(planFilePath, 'utf-8');
|
|
73
|
+
const plan = JSON.parse(content);
|
|
74
|
+
plan.createdAt = new Date(plan.createdAt);
|
|
75
|
+
if (plan.updatedAt) {
|
|
76
|
+
plan.updatedAt = new Date(plan.updatedAt);
|
|
77
|
+
}
|
|
78
|
+
return plan;
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
.filter((p) => p !== null)
|
|
85
|
+
.sort((a, b) => {
|
|
86
|
+
const aTime = a.updatedAt?.getTime() || a.createdAt.getTime();
|
|
87
|
+
const bTime = b.updatedAt?.getTime() || b.createdAt.getTime();
|
|
88
|
+
return bTime - aTime; // Most recent first
|
|
89
|
+
})
|
|
90
|
+
.slice(0, limit);
|
|
91
|
+
return files;
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
console.error('Failed to list plans:', error);
|
|
95
|
+
return [];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Update a plan
|
|
100
|
+
*/
|
|
101
|
+
async update(planId, updates) {
|
|
102
|
+
const plan = await this.get(planId);
|
|
103
|
+
if (!plan) {
|
|
104
|
+
throw new Error(`Plan ${planId} not found`);
|
|
105
|
+
}
|
|
106
|
+
const updatedPlan = {
|
|
107
|
+
...plan,
|
|
108
|
+
...updates,
|
|
109
|
+
id: planId,
|
|
110
|
+
updatedAt: new Date(),
|
|
111
|
+
};
|
|
112
|
+
const planFilePath = join(this.plansDir, `${planId}.json`);
|
|
113
|
+
writeFileSync(planFilePath, JSON.stringify(updatedPlan, null, 2), 'utf-8');
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Delete a plan
|
|
117
|
+
*/
|
|
118
|
+
async delete(planId) {
|
|
119
|
+
const planFilePath = join(this.plansDir, `${planId}.json`);
|
|
120
|
+
if (existsSync(planFilePath)) {
|
|
121
|
+
unlinkSync(planFilePath);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// Singleton instance
|
|
126
|
+
let planRepositoryInstance = null;
|
|
127
|
+
export function getPlanRepository() {
|
|
128
|
+
if (!planRepositoryInstance) {
|
|
129
|
+
planRepositoryInstance = new FilePlanRepository();
|
|
130
|
+
}
|
|
131
|
+
return planRepositoryInstance;
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=plan-repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-repository.js","sourceRoot":"","sources":["../../../src/infrastructure/storage/plan-repository.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AACjG,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CA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MAAM,YAAY,CAAC,CAAC;QAC9C,CAAC;QAED,MAAM,WAAW,GAAS;YACxB,GAAG,IAAI;YACP,GAAG,OAAO;YACV,EAAE,EAAE,MAAM;YACV,SAAS,EAAE,IAAI,IAAI,EAAE;SACtB,CAAC;QAEF,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,MAAM,OAAO,CAAC,CAAC;QAC3D,aAAa,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC7E,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,MAAc;QACzB,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,MAAM,OAAO,CAAC,CAAC;QAE3D,IAAI,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YAC7B,UAAU,CAAC,YAAY,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;CACF;AAED,qBAAqB;AACrB,IAAI,sBAAsB,GAA2B,IAAI,CAAC;AAE1D,MAAM,UAAU,iBAAiB;IAC/B,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAC5B,sBAAsB,GAAG,IAAI,kBAAkB,EAAE,CAAC;IACpD,CAAC;IACD,OAAO,sBAAsB,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure: SQLiteDecisionRepository
|
|
3
|
+
* SQLite implementation of decision storage
|
|
4
|
+
*
|
|
5
|
+
* Clean Architecture: Infrastructure Layer
|
|
6
|
+
* Pattern: Repository Pattern Implementation
|
|
7
|
+
*/
|
|
8
|
+
import type { IDecisionRepository } from '../../domain/interfaces/decision-repository.interface.js';
|
|
9
|
+
import type { Decision, DecisionType } from '../../domain/entities/decision.js';
|
|
10
|
+
export declare class SQLiteDecisionRepository implements IDecisionRepository {
|
|
11
|
+
private dbPath;
|
|
12
|
+
private db;
|
|
13
|
+
constructor();
|
|
14
|
+
private getDb;
|
|
15
|
+
store(decision: Decision): Promise<void>;
|
|
16
|
+
getById(id: string): Promise<Decision | null>;
|
|
17
|
+
findByCodebase(codebaseId: string, limit?: number): Promise<Decision[]>;
|
|
18
|
+
findByType(codebaseId: string, type: DecisionType, limit?: number): Promise<Decision[]>;
|
|
19
|
+
search(codebaseId: string, query: string, limit?: number): Promise<Decision[]>;
|
|
20
|
+
update(decision: Decision): Promise<void>;
|
|
21
|
+
delete(id: string): Promise<void>;
|
|
22
|
+
getRecent(codebaseId: string, limit?: number): Promise<Decision[]>;
|
|
23
|
+
getByStatus(codebaseId: string, status: 'proposed' | 'accepted' | 'rejected' | 'superseded', limit?: number): Promise<Decision[]>;
|
|
24
|
+
findRelated(decisionId: string, limit?: number): Promise<Decision[]>;
|
|
25
|
+
private mapRowToDecision;
|
|
26
|
+
private executeAndMap;
|
|
27
|
+
private saveDb;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=sqlite-decision-repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite-decision-repository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/storage/sqlite-decision-repository.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC;AACpG,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAYhF,qBAAa,wBAAyB,YAAW,mBAAmB;IAClE,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,EAAE,CAAyB;;YAMrB,KAAK;IA8Cb,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAiCxC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAgB7C,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,GAAE,MAAY,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAa5E,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,GAAE,MAAY,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAa5F,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAE,MAAW,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAelF,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAQzC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQjC,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,GAAE,MAAW,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAatE,WAAW,CACf,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,YAAY,EAC3D,KAAK,GAAE,MAAY,GAClB,OAAO,CAAC,QAAQ,EAAE,CAAC;IAchB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,GAAE,MAAW,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAmB9E,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,MAAM;CAMf"}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure: SQLiteDecisionRepository
|
|
3
|
+
* SQLite implementation of decision storage
|
|
4
|
+
*
|
|
5
|
+
* Clean Architecture: Infrastructure Layer
|
|
6
|
+
* Pattern: Repository Pattern Implementation
|
|
7
|
+
*/
|
|
8
|
+
import { readFileSync, existsSync, mkdirSync, writeFileSync } from 'fs';
|
|
9
|
+
import { join, dirname } from 'path';
|
|
10
|
+
import { fileURLToPath } from 'url';
|
|
11
|
+
import initSqlJs from 'sql.js';
|
|
12
|
+
import { randomUUID } from 'crypto';
|
|
13
|
+
function getDbPath() {
|
|
14
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
15
|
+
const __dirname = dirname(__filename);
|
|
16
|
+
const agentDir = join(__dirname, '../../..');
|
|
17
|
+
if (existsSync(join(agentDir, 'package.json'))) {
|
|
18
|
+
return join(agentDir, 'data', 'decisions.sqlite');
|
|
19
|
+
}
|
|
20
|
+
return join(process.cwd(), 'agent', 'data', 'decisions.sqlite');
|
|
21
|
+
}
|
|
22
|
+
export class SQLiteDecisionRepository {
|
|
23
|
+
dbPath;
|
|
24
|
+
db = null;
|
|
25
|
+
constructor() {
|
|
26
|
+
this.dbPath = getDbPath();
|
|
27
|
+
}
|
|
28
|
+
async getDb() {
|
|
29
|
+
if (this.db)
|
|
30
|
+
return this.db;
|
|
31
|
+
const SQL = await initSqlJs();
|
|
32
|
+
const dbDir = dirname(this.dbPath);
|
|
33
|
+
if (!existsSync(dbDir)) {
|
|
34
|
+
mkdirSync(dbDir, { recursive: true });
|
|
35
|
+
}
|
|
36
|
+
if (existsSync(this.dbPath)) {
|
|
37
|
+
const buffer = readFileSync(this.dbPath);
|
|
38
|
+
this.db = new SQL.Database(buffer);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
this.db = new SQL.Database();
|
|
42
|
+
}
|
|
43
|
+
// Create decisions table
|
|
44
|
+
this.db.run(`
|
|
45
|
+
CREATE TABLE IF NOT EXISTS decisions (
|
|
46
|
+
id TEXT PRIMARY KEY,
|
|
47
|
+
codebaseId TEXT NOT NULL,
|
|
48
|
+
type TEXT NOT NULL,
|
|
49
|
+
title TEXT NOT NULL,
|
|
50
|
+
description TEXT NOT NULL,
|
|
51
|
+
rationale TEXT NOT NULL,
|
|
52
|
+
alternatives TEXT,
|
|
53
|
+
constraints TEXT,
|
|
54
|
+
tradeoffs TEXT,
|
|
55
|
+
consequences TEXT,
|
|
56
|
+
metadata TEXT,
|
|
57
|
+
createdAt INTEGER NOT NULL,
|
|
58
|
+
updatedAt INTEGER,
|
|
59
|
+
author TEXT
|
|
60
|
+
)
|
|
61
|
+
`);
|
|
62
|
+
// Create indexes
|
|
63
|
+
this.db.run(`CREATE INDEX IF NOT EXISTS idx_codebase ON decisions(codebaseId)`);
|
|
64
|
+
this.db.run(`CREATE INDEX IF NOT EXISTS idx_type ON decisions(codebaseId, type)`);
|
|
65
|
+
this.db.run(`CREATE INDEX IF NOT EXISTS idx_created ON decisions(codebaseId, createdAt DESC)`);
|
|
66
|
+
this.db.run(`CREATE INDEX IF NOT EXISTS idx_status ON decisions(codebaseId, json_extract(metadata, '$.status'))`);
|
|
67
|
+
return this.db;
|
|
68
|
+
}
|
|
69
|
+
async store(decision) {
|
|
70
|
+
const db = await this.getDb();
|
|
71
|
+
const id = decision.id || randomUUID();
|
|
72
|
+
const now = Date.now();
|
|
73
|
+
const stmt = db.prepare(`
|
|
74
|
+
INSERT OR REPLACE INTO decisions
|
|
75
|
+
(id, codebaseId, type, title, description, rationale, alternatives, constraints,
|
|
76
|
+
tradeoffs, consequences, metadata, createdAt, updatedAt, author)
|
|
77
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
78
|
+
`);
|
|
79
|
+
stmt.run([
|
|
80
|
+
id,
|
|
81
|
+
decision.codebaseId,
|
|
82
|
+
decision.type,
|
|
83
|
+
decision.title,
|
|
84
|
+
decision.description,
|
|
85
|
+
decision.rationale,
|
|
86
|
+
JSON.stringify(decision.alternatives ?? []),
|
|
87
|
+
JSON.stringify(decision.constraints ?? []),
|
|
88
|
+
JSON.stringify(decision.tradeoffs ?? []),
|
|
89
|
+
JSON.stringify(decision.consequences ?? []),
|
|
90
|
+
JSON.stringify(decision.metadata ?? {}),
|
|
91
|
+
decision.createdAt.getTime(),
|
|
92
|
+
decision.updatedAt?.getTime() ?? now,
|
|
93
|
+
decision.author ?? null,
|
|
94
|
+
]);
|
|
95
|
+
stmt.free();
|
|
96
|
+
this.saveDb();
|
|
97
|
+
}
|
|
98
|
+
async getById(id) {
|
|
99
|
+
const db = await this.getDb();
|
|
100
|
+
const stmt = db.prepare('SELECT * FROM decisions WHERE id = ?');
|
|
101
|
+
stmt.bind([id]);
|
|
102
|
+
if (!stmt.step()) {
|
|
103
|
+
stmt.free();
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
const row = stmt.getAsObject();
|
|
107
|
+
stmt.free();
|
|
108
|
+
return this.mapRowToDecision(row);
|
|
109
|
+
}
|
|
110
|
+
async findByCodebase(codebaseId, limit = 100) {
|
|
111
|
+
const db = await this.getDb();
|
|
112
|
+
const stmt = db.prepare(`
|
|
113
|
+
SELECT * FROM decisions
|
|
114
|
+
WHERE codebaseId = ?
|
|
115
|
+
ORDER BY createdAt DESC
|
|
116
|
+
LIMIT ?
|
|
117
|
+
`);
|
|
118
|
+
stmt.bind([codebaseId, limit]);
|
|
119
|
+
return this.executeAndMap(stmt);
|
|
120
|
+
}
|
|
121
|
+
async findByType(codebaseId, type, limit = 100) {
|
|
122
|
+
const db = await this.getDb();
|
|
123
|
+
const stmt = db.prepare(`
|
|
124
|
+
SELECT * FROM decisions
|
|
125
|
+
WHERE codebaseId = ? AND type = ?
|
|
126
|
+
ORDER BY createdAt DESC
|
|
127
|
+
LIMIT ?
|
|
128
|
+
`);
|
|
129
|
+
stmt.bind([codebaseId, type, limit]);
|
|
130
|
+
return this.executeAndMap(stmt);
|
|
131
|
+
}
|
|
132
|
+
async search(codebaseId, query, limit = 50) {
|
|
133
|
+
const db = await this.getDb();
|
|
134
|
+
const searchTerm = `%${query}%`;
|
|
135
|
+
const stmt = db.prepare(`
|
|
136
|
+
SELECT * FROM decisions
|
|
137
|
+
WHERE codebaseId = ?
|
|
138
|
+
AND (title LIKE ? OR description LIKE ? OR rationale LIKE ?)
|
|
139
|
+
ORDER BY createdAt DESC
|
|
140
|
+
LIMIT ?
|
|
141
|
+
`);
|
|
142
|
+
stmt.bind([codebaseId, searchTerm, searchTerm, searchTerm, limit]);
|
|
143
|
+
return this.executeAndMap(stmt);
|
|
144
|
+
}
|
|
145
|
+
async update(decision) {
|
|
146
|
+
if (!decision.id) {
|
|
147
|
+
throw new Error('Decision ID required for update');
|
|
148
|
+
}
|
|
149
|
+
decision.updatedAt = new Date();
|
|
150
|
+
await this.store(decision); // INSERT OR REPLACE handles update
|
|
151
|
+
}
|
|
152
|
+
async delete(id) {
|
|
153
|
+
const db = await this.getDb();
|
|
154
|
+
const stmt = db.prepare('DELETE FROM decisions WHERE id = ?');
|
|
155
|
+
stmt.run([id]);
|
|
156
|
+
stmt.free();
|
|
157
|
+
this.saveDb();
|
|
158
|
+
}
|
|
159
|
+
async getRecent(codebaseId, limit = 10) {
|
|
160
|
+
const db = await this.getDb();
|
|
161
|
+
const stmt = db.prepare(`
|
|
162
|
+
SELECT * FROM decisions
|
|
163
|
+
WHERE codebaseId = ?
|
|
164
|
+
ORDER BY createdAt DESC
|
|
165
|
+
LIMIT ?
|
|
166
|
+
`);
|
|
167
|
+
stmt.bind([codebaseId, limit]);
|
|
168
|
+
return this.executeAndMap(stmt);
|
|
169
|
+
}
|
|
170
|
+
async getByStatus(codebaseId, status, limit = 100) {
|
|
171
|
+
const db = await this.getDb();
|
|
172
|
+
const stmt = db.prepare(`
|
|
173
|
+
SELECT * FROM decisions
|
|
174
|
+
WHERE codebaseId = ?
|
|
175
|
+
AND json_extract(metadata, '$.status') = ?
|
|
176
|
+
ORDER BY createdAt DESC
|
|
177
|
+
LIMIT ?
|
|
178
|
+
`);
|
|
179
|
+
stmt.bind([codebaseId, status, limit]);
|
|
180
|
+
return this.executeAndMap(stmt);
|
|
181
|
+
}
|
|
182
|
+
async findRelated(decisionId, limit = 10) {
|
|
183
|
+
const decision = await this.getById(decisionId);
|
|
184
|
+
if (!decision || !decision.metadata?.relatedDecisions) {
|
|
185
|
+
return [];
|
|
186
|
+
}
|
|
187
|
+
const relatedIds = decision.metadata.relatedDecisions.slice(0, limit);
|
|
188
|
+
const related = [];
|
|
189
|
+
for (const id of relatedIds) {
|
|
190
|
+
const relatedDecision = await this.getById(id);
|
|
191
|
+
if (relatedDecision) {
|
|
192
|
+
related.push(relatedDecision);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return related;
|
|
196
|
+
}
|
|
197
|
+
mapRowToDecision(row) {
|
|
198
|
+
const metadata = JSON.parse(row.metadata ?? '{}');
|
|
199
|
+
return {
|
|
200
|
+
id: row.id,
|
|
201
|
+
codebaseId: row.codebaseId,
|
|
202
|
+
type: row.type,
|
|
203
|
+
title: row.title,
|
|
204
|
+
description: row.description,
|
|
205
|
+
rationale: row.rationale,
|
|
206
|
+
alternatives: JSON.parse(row.alternatives ?? '[]'),
|
|
207
|
+
constraints: JSON.parse(row.constraints ?? '[]'),
|
|
208
|
+
tradeoffs: JSON.parse(row.tradeoffs ?? '[]'),
|
|
209
|
+
consequences: JSON.parse(row.consequences ?? '[]'),
|
|
210
|
+
metadata: Object.keys(metadata).length > 0 ? metadata : undefined,
|
|
211
|
+
createdAt: new Date(row.createdAt),
|
|
212
|
+
updatedAt: row.updatedAt ? new Date(row.updatedAt) : undefined,
|
|
213
|
+
author: row.author ?? undefined,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
executeAndMap(stmt) {
|
|
217
|
+
const decisions = [];
|
|
218
|
+
while (stmt.step()) {
|
|
219
|
+
decisions.push(this.mapRowToDecision(stmt.getAsObject()));
|
|
220
|
+
}
|
|
221
|
+
stmt.free();
|
|
222
|
+
return decisions;
|
|
223
|
+
}
|
|
224
|
+
saveDb() {
|
|
225
|
+
if (!this.db)
|
|
226
|
+
return;
|
|
227
|
+
const data = this.db.export();
|
|
228
|
+
const buffer = Buffer.from(data);
|
|
229
|
+
writeFileSync(this.dbPath, buffer);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
//# sourceMappingURL=sqlite-decision-repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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AAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;YACjE,SAAS,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC;YAClC,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS;YAC9D,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,SAAS;SAChC,CAAC;IACJ,CAAC;IAEO,aAAa,CAAC,IAAS;QAC7B,MAAM,SAAS,GAAe,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;YACnB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;QAC5D,CAAC;QACD,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,OAAO,SAAS,CAAC;IACnB,CAAC;IAEO,MAAM;QACZ,IAAI,CAAC,IAAI,CAAC,EAAE;YAAE,OAAO;QACrB,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,CAAC;CACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure: SQLiteEmbeddingRepository
|
|
3
|
+
* Implements IEmbeddingRepository using SQLite
|
|
4
|
+
*/
|
|
5
|
+
import type { IEmbeddingRepository } from '../../domain/interfaces/embedding-repository.interface.js';
|
|
6
|
+
import type { CodeChunk } from '../../domain/entities/code-chunk.js';
|
|
7
|
+
export declare class SQLiteEmbeddingRepository implements IEmbeddingRepository {
|
|
8
|
+
private dbPath;
|
|
9
|
+
private db;
|
|
10
|
+
constructor();
|
|
11
|
+
private getDb;
|
|
12
|
+
store(chunks: CodeChunk[]): Promise<void>;
|
|
13
|
+
search(query: string, topK: number): Promise<CodeChunk[]>;
|
|
14
|
+
getByFilepath(filepath: string): Promise<CodeChunk[]>;
|
|
15
|
+
isIndexed(filepath: string): Promise<boolean>;
|
|
16
|
+
clear(): Promise<void>;
|
|
17
|
+
private saveDb;
|
|
18
|
+
/**
|
|
19
|
+
* Search with pre-computed query embedding
|
|
20
|
+
* (Used by application layer to avoid circular dependency)
|
|
21
|
+
*
|
|
22
|
+
* PERFORMANCE OPTIMIZATION:
|
|
23
|
+
* 1. Uses min-heap to maintain only topK results (O(n log k) vs O(n log n))
|
|
24
|
+
* 2. Pre-computes query norm once (avoids redundant calculations)
|
|
25
|
+
* 3. Optimized cosine similarity calculation
|
|
26
|
+
* 4. Result caching (query + topK results) to avoid redundant searches
|
|
27
|
+
* 5. Batch processing with early termination for large datasets
|
|
28
|
+
* 6. Optimized JSON parsing (cache parsed embeddings per row)
|
|
29
|
+
*
|
|
30
|
+
* Note: Cache key should be generated from query string, not embedding
|
|
31
|
+
* This method receives embedding, so caching should be done at call site
|
|
32
|
+
*/
|
|
33
|
+
searchWithEmbedding(queryEmbedding: number[], topK: number): Promise<CodeChunk[]>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=sqlite-embedding-repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqlite-embedding-repository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/storage/sqlite-embedding-repository.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2DAA2D,CAAC;AACtG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AA2CrE,qBAAa,yBAA0B,YAAW,oBAAoB;IACpE,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,EAAE,CAAyB;;YAMrB,KAAK;IAkCb,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BzC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAOzD,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAqBrD,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAU7C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAM5B,OAAO,CAAC,MAAM;IAOd;;;;;;;;;;;;;;OAcG;IACG,mBAAmB,CAAC,cAAc,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;CA4HxF"}
|