codehere 0.2.0 → 0.4.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 +223 -42
- package/dist/application/agents/documentation-agent.d.ts +24 -0
- package/dist/application/agents/documentation-agent.d.ts.map +1 -0
- package/dist/application/agents/documentation-agent.js +399 -0
- package/dist/application/agents/documentation-agent.js.map +1 -0
- package/dist/application/agents/execution-agent.d.ts +11 -0
- package/dist/application/agents/execution-agent.d.ts.map +1 -1
- package/dist/application/agents/execution-agent.js +289 -80
- package/dist/application/agents/execution-agent.js.map +1 -1
- package/dist/application/agents/multi-agent-orchestrator.d.ts +4 -0
- package/dist/application/agents/multi-agent-orchestrator.d.ts.map +1 -1
- package/dist/application/agents/multi-agent-orchestrator.js +86 -0
- package/dist/application/agents/multi-agent-orchestrator.js.map +1 -1
- package/dist/application/agents/planning-agent.d.ts +3 -0
- package/dist/application/agents/planning-agent.d.ts.map +1 -1
- package/dist/application/agents/planning-agent.js +132 -64
- package/dist/application/agents/planning-agent.js.map +1 -1
- package/dist/application/agents/product-requirements-agent.d.ts +21 -0
- package/dist/application/agents/product-requirements-agent.d.ts.map +1 -0
- package/dist/application/agents/product-requirements-agent.js +247 -0
- package/dist/application/agents/product-requirements-agent.js.map +1 -0
- package/dist/application/agents/validation-agent.d.ts +5 -1
- package/dist/application/agents/validation-agent.d.ts.map +1 -1
- package/dist/application/agents/validation-agent.js +156 -21
- package/dist/application/agents/validation-agent.js.map +1 -1
- package/dist/application/services/dependency-container.d.ts +25 -2
- package/dist/application/services/dependency-container.d.ts.map +1 -1
- package/dist/application/services/dependency-container.js +163 -1
- package/dist/application/services/dependency-container.js.map +1 -1
- package/dist/application/services/intelligent-router.d.ts +13 -0
- package/dist/application/services/intelligent-router.d.ts.map +1 -1
- package/dist/application/services/intelligent-router.js +300 -87
- package/dist/application/services/intelligent-router.js.map +1 -1
- package/dist/application/use-cases/ask-question-use-case.d.ts +31 -0
- package/dist/application/use-cases/ask-question-use-case.d.ts.map +1 -1
- package/dist/application/use-cases/ask-question-use-case.js +254 -55
- package/dist/application/use-cases/ask-question-use-case.js.map +1 -1
- package/dist/application/use-cases/edit-file-use-case.d.ts.map +1 -1
- package/dist/application/use-cases/edit-file-use-case.js +86 -4
- package/dist/application/use-cases/edit-file-use-case.js.map +1 -1
- package/dist/application/use-cases/planning-use-case.d.ts.map +1 -1
- package/dist/application/use-cases/planning-use-case.js +10 -1
- package/dist/application/use-cases/planning-use-case.js.map +1 -1
- package/dist/application/use-cases/react-orchestration-use-case.d.ts.map +1 -1
- package/dist/application/use-cases/react-orchestration-use-case.js +6 -2
- package/dist/application/use-cases/react-orchestration-use-case.js.map +1 -1
- package/dist/domain/entities/documentation.d.ts +35 -0
- package/dist/domain/entities/documentation.d.ts.map +1 -0
- package/dist/domain/entities/documentation.js +6 -0
- package/dist/domain/entities/documentation.js.map +1 -0
- package/dist/domain/entities/product-requirements.d.ts +50 -0
- package/dist/domain/entities/product-requirements.d.ts.map +1 -0
- package/dist/domain/entities/product-requirements.js +6 -0
- package/dist/domain/entities/product-requirements.js.map +1 -0
- package/dist/domain/entities/task.d.ts +152 -0
- package/dist/domain/entities/task.d.ts.map +1 -0
- package/dist/domain/entities/task.js +61 -0
- package/dist/domain/entities/task.js.map +1 -0
- package/dist/domain/interfaces/agent.interface.d.ts +15 -0
- package/dist/domain/interfaces/agent.interface.d.ts.map +1 -0
- package/dist/domain/interfaces/agent.interface.js +6 -0
- package/dist/domain/interfaces/agent.interface.js.map +1 -0
- package/dist/domain/services/environment-mode-manager.d.ts +18 -0
- package/dist/domain/services/environment-mode-manager.d.ts.map +1 -0
- package/dist/domain/services/environment-mode-manager.js +37 -0
- package/dist/domain/services/environment-mode-manager.js.map +1 -0
- package/dist/domain/services/react-loop.d.ts +8 -0
- package/dist/domain/services/react-loop.d.ts.map +1 -1
- package/dist/domain/services/react-loop.js +82 -6
- package/dist/domain/services/react-loop.js.map +1 -1
- package/dist/domain/services/risk-tier-detector.d.ts +18 -0
- package/dist/domain/services/risk-tier-detector.d.ts.map +1 -0
- package/dist/domain/services/risk-tier-detector.js +65 -0
- package/dist/domain/services/risk-tier-detector.js.map +1 -0
- package/dist/formatter.d.ts +2 -2
- package/dist/formatter.d.ts.map +1 -1
- package/dist/formatter.js +40 -20
- package/dist/formatter.js.map +1 -1
- package/dist/index.js +218 -125
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/ai/cohere-ai-service.d.ts +3 -1
- package/dist/infrastructure/ai/cohere-ai-service.d.ts.map +1 -1
- package/dist/infrastructure/ai/cohere-ai-service.js +65 -5
- package/dist/infrastructure/ai/cohere-ai-service.js.map +1 -1
- package/dist/infrastructure/ai/fake-ai-service.d.ts +22 -0
- package/dist/infrastructure/ai/fake-ai-service.d.ts.map +1 -0
- package/dist/infrastructure/ai/fake-ai-service.js +59 -0
- package/dist/infrastructure/ai/fake-ai-service.js.map +1 -0
- package/dist/infrastructure/ai/provider-ai-service.d.ts +59 -0
- package/dist/infrastructure/ai/provider-ai-service.d.ts.map +1 -0
- package/dist/infrastructure/ai/provider-ai-service.js +477 -0
- package/dist/infrastructure/ai/provider-ai-service.js.map +1 -0
- package/dist/infrastructure/cache/embedding-cache.d.ts +13 -1
- package/dist/infrastructure/cache/embedding-cache.d.ts.map +1 -1
- package/dist/infrastructure/cache/embedding-cache.js +80 -9
- package/dist/infrastructure/cache/embedding-cache.js.map +1 -1
- package/dist/infrastructure/cache/query-result-cache.d.ts +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/response-cache.d.ts +86 -0
- package/dist/infrastructure/cache/response-cache.d.ts.map +1 -0
- package/dist/infrastructure/cache/response-cache.js +224 -0
- package/dist/infrastructure/cache/response-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/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/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/context/conversation-context.d.ts +58 -0
- package/dist/infrastructure/context/conversation-context.d.ts.map +1 -0
- package/dist/infrastructure/context/conversation-context.js +170 -0
- package/dist/infrastructure/context/conversation-context.js.map +1 -0
- package/dist/infrastructure/context/session-manager.d.ts +26 -0
- package/dist/infrastructure/context/session-manager.d.ts.map +1 -0
- package/dist/infrastructure/context/session-manager.js +98 -0
- package/dist/infrastructure/context/session-manager.js.map +1 -0
- package/dist/infrastructure/cost/cost-tracker.d.ts +1 -0
- package/dist/infrastructure/cost/cost-tracker.d.ts.map +1 -1
- package/dist/infrastructure/cost/cost-tracker.js +12 -5
- package/dist/infrastructure/cost/cost-tracker.js.map +1 -1
- package/dist/infrastructure/governance/nist-ai-rmf.d.ts +6 -8
- package/dist/infrastructure/governance/nist-ai-rmf.d.ts.map +1 -1
- package/dist/infrastructure/governance/nist-ai-rmf.js +6 -8
- package/dist/infrastructure/governance/nist-ai-rmf.js.map +1 -1
- package/dist/infrastructure/governance/policy-as-code.d.ts +6 -8
- package/dist/infrastructure/governance/policy-as-code.d.ts.map +1 -1
- package/dist/infrastructure/governance/policy-as-code.js +24 -11
- package/dist/infrastructure/governance/policy-as-code.js.map +1 -1
- package/dist/infrastructure/governance/prompt-to-code-lineage.d.ts +7 -9
- package/dist/infrastructure/governance/prompt-to-code-lineage.d.ts.map +1 -1
- package/dist/infrastructure/governance/prompt-to-code-lineage.js +7 -9
- package/dist/infrastructure/governance/prompt-to-code-lineage.js.map +1 -1
- package/dist/infrastructure/observability/execution-tracer.d.ts +5 -2
- package/dist/infrastructure/observability/execution-tracer.d.ts.map +1 -1
- package/dist/infrastructure/observability/execution-tracer.js +45 -8
- package/dist/infrastructure/observability/execution-tracer.js.map +1 -1
- package/dist/infrastructure/providers/cohere-provider.d.ts +39 -0
- package/dist/infrastructure/providers/cohere-provider.d.ts.map +1 -0
- package/dist/infrastructure/providers/cohere-provider.js +359 -0
- package/dist/infrastructure/providers/cohere-provider.js.map +1 -0
- package/dist/infrastructure/providers/fake-provider.d.ts +43 -0
- package/dist/infrastructure/providers/fake-provider.d.ts.map +1 -0
- package/dist/infrastructure/providers/fake-provider.js +130 -0
- package/dist/infrastructure/providers/fake-provider.js.map +1 -0
- package/dist/infrastructure/providers/local-llm-provider.d.ts +49 -0
- package/dist/infrastructure/providers/local-llm-provider.d.ts.map +1 -0
- package/dist/infrastructure/providers/local-llm-provider.js +330 -0
- package/dist/infrastructure/providers/local-llm-provider.js.map +1 -0
- package/dist/infrastructure/providers/model-config.types.d.ts +70 -0
- package/dist/infrastructure/providers/model-config.types.d.ts.map +1 -0
- package/dist/infrastructure/providers/model-config.types.js +9 -0
- package/dist/infrastructure/providers/model-config.types.js.map +1 -0
- package/dist/infrastructure/providers/model-provider.interface.d.ts +113 -0
- package/dist/infrastructure/providers/model-provider.interface.d.ts.map +1 -0
- package/dist/infrastructure/providers/model-provider.interface.js +8 -0
- package/dist/infrastructure/providers/model-provider.interface.js.map +1 -0
- package/dist/infrastructure/providers/openai-provider.d.ts +38 -0
- package/dist/infrastructure/providers/openai-provider.d.ts.map +1 -0
- package/dist/infrastructure/providers/openai-provider.js +413 -0
- package/dist/infrastructure/providers/openai-provider.js.map +1 -0
- package/dist/infrastructure/providers/operation-provider-resolver.d.ts +48 -0
- package/dist/infrastructure/providers/operation-provider-resolver.d.ts.map +1 -0
- package/dist/infrastructure/providers/operation-provider-resolver.js +105 -0
- package/dist/infrastructure/providers/operation-provider-resolver.js.map +1 -0
- package/dist/infrastructure/providers/provider-config-loader.d.ts +37 -0
- package/dist/infrastructure/providers/provider-config-loader.d.ts.map +1 -0
- package/dist/infrastructure/providers/provider-config-loader.js +120 -0
- package/dist/infrastructure/providers/provider-config-loader.js.map +1 -0
- package/dist/infrastructure/providers/provider-registry.d.ts +53 -0
- package/dist/infrastructure/providers/provider-registry.d.ts.map +1 -0
- package/dist/infrastructure/providers/provider-registry.js +88 -0
- package/dist/infrastructure/providers/provider-registry.js.map +1 -0
- package/dist/infrastructure/security/ai-sast-scanner.d.ts +4 -0
- package/dist/infrastructure/security/ai-sast-scanner.d.ts.map +1 -1
- package/dist/infrastructure/security/ai-sast-scanner.js +82 -4
- package/dist/infrastructure/security/ai-sast-scanner.js.map +1 -1
- package/dist/infrastructure/security/enhanced-security-gate.d.ts +2 -0
- package/dist/infrastructure/security/enhanced-security-gate.d.ts.map +1 -1
- package/dist/infrastructure/security/enhanced-security-gate.js +74 -15
- package/dist/infrastructure/security/enhanced-security-gate.js.map +1 -1
- 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-embedding-repository.d.ts +11 -0
- package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts.map +1 -1
- package/dist/infrastructure/storage/sqlite-embedding-repository.js +121 -6
- package/dist/infrastructure/storage/sqlite-embedding-repository.js.map +1 -1
- package/dist/infrastructure/storage/task-helpers.d.ts +58 -0
- package/dist/infrastructure/storage/task-helpers.d.ts.map +1 -0
- package/dist/infrastructure/storage/task-helpers.js +157 -0
- package/dist/infrastructure/storage/task-helpers.js.map +1 -0
- package/dist/infrastructure/storage/task-repository.d.ts +67 -0
- package/dist/infrastructure/storage/task-repository.d.ts.map +1 -0
- package/dist/infrastructure/storage/task-repository.js +205 -0
- package/dist/infrastructure/storage/task-repository.js.map +1 -0
- package/dist/infrastructure/ux/bi-directional-learning.d.ts +22 -0
- package/dist/infrastructure/ux/bi-directional-learning.d.ts.map +1 -1
- package/dist/infrastructure/ux/bi-directional-learning.js +144 -7
- package/dist/infrastructure/ux/bi-directional-learning.js.map +1 -1
- package/dist/infrastructure/ux/capability-boundaries.d.ts +50 -0
- package/dist/infrastructure/ux/capability-boundaries.d.ts.map +1 -0
- package/dist/infrastructure/ux/capability-boundaries.js +167 -0
- package/dist/infrastructure/ux/capability-boundaries.js.map +1 -0
- package/dist/infrastructure/ux/comprehensive-formatter.d.ts +63 -0
- package/dist/infrastructure/ux/comprehensive-formatter.d.ts.map +1 -0
- package/dist/infrastructure/ux/comprehensive-formatter.js +212 -0
- package/dist/infrastructure/ux/comprehensive-formatter.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 +33 -0
- package/dist/infrastructure/ux/expectation-management.d.ts.map +1 -1
- package/dist/infrastructure/ux/expectation-management.js +138 -4
- package/dist/infrastructure/ux/expectation-management.js.map +1 -1
- 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/feedback-prompt.d.ts +42 -0
- package/dist/infrastructure/ux/feedback-prompt.d.ts.map +1 -0
- package/dist/infrastructure/ux/feedback-prompt.js +181 -0
- package/dist/infrastructure/ux/feedback-prompt.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 +228 -0
- package/dist/infrastructure/ux/hitl-review-portal.js.map +1 -0
- package/dist/infrastructure/ux/hitl-validation.d.ts +35 -0
- package/dist/infrastructure/ux/hitl-validation.d.ts.map +1 -1
- package/dist/infrastructure/ux/hitl-validation.js +86 -0
- package/dist/infrastructure/ux/hitl-validation.js.map +1 -1
- package/dist/infrastructure/ux/progress-indicator.d.ts +55 -0
- package/dist/infrastructure/ux/progress-indicator.d.ts.map +1 -0
- package/dist/infrastructure/ux/progress-indicator.js +131 -0
- package/dist/infrastructure/ux/progress-indicator.js.map +1 -0
- package/dist/infrastructure/ux/progressive-disclosure.d.ts.map +1 -1
- package/dist/infrastructure/ux/progressive-disclosure.js +2 -1
- package/dist/infrastructure/ux/progressive-disclosure.js.map +1 -1
- package/dist/infrastructure/ux/proportional-friction.d.ts +73 -0
- package/dist/infrastructure/ux/proportional-friction.d.ts.map +1 -0
- package/dist/infrastructure/ux/proportional-friction.js +200 -0
- package/dist/infrastructure/ux/proportional-friction.js.map +1 -0
- package/dist/infrastructure/ux/review-checkpoint.d.ts +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/validation/agent-feedback.d.ts +115 -0
- package/dist/infrastructure/validation/agent-feedback.d.ts.map +1 -0
- package/dist/infrastructure/validation/agent-feedback.js +227 -0
- package/dist/infrastructure/validation/agent-feedback.js.map +1 -0
- package/dist/infrastructure/validation/agent-validation-helper.d.ts +75 -0
- package/dist/infrastructure/validation/agent-validation-helper.d.ts.map +1 -0
- package/dist/infrastructure/validation/agent-validation-helper.js +88 -0
- package/dist/infrastructure/validation/agent-validation-helper.js.map +1 -0
- package/dist/infrastructure/validation/feedback-stats.d.ts +99 -0
- package/dist/infrastructure/validation/feedback-stats.d.ts.map +1 -0
- package/dist/infrastructure/validation/feedback-stats.js +173 -0
- package/dist/infrastructure/validation/feedback-stats.js.map +1 -0
- package/dist/infrastructure/validation/review-handler.d.ts +54 -0
- package/dist/infrastructure/validation/review-handler.d.ts.map +1 -0
- package/dist/infrastructure/validation/review-handler.js +206 -0
- package/dist/infrastructure/validation/review-handler.js.map +1 -0
- package/dist/infrastructure/validation/summary-aggregator.d.ts +42 -0
- package/dist/infrastructure/validation/summary-aggregator.d.ts.map +1 -0
- package/dist/infrastructure/validation/summary-aggregator.js +156 -0
- package/dist/infrastructure/validation/summary-aggregator.js.map +1 -0
- package/dist/infrastructure/validation/summary-extractor.d.ts +59 -0
- package/dist/infrastructure/validation/summary-extractor.d.ts.map +1 -0
- package/dist/infrastructure/validation/summary-extractor.js +102 -0
- package/dist/infrastructure/validation/summary-extractor.js.map +1 -0
- package/dist/infrastructure/validation/trace-summary.d.ts +72 -0
- package/dist/infrastructure/validation/trace-summary.d.ts.map +1 -0
- package/dist/infrastructure/validation/trace-summary.js +371 -0
- package/dist/infrastructure/validation/trace-summary.js.map +1 -0
- package/dist/infrastructure/validation/trust-config.d.ts +27 -0
- package/dist/infrastructure/validation/trust-config.d.ts.map +1 -0
- package/dist/infrastructure/validation/trust-config.js +113 -0
- package/dist/infrastructure/validation/trust-config.js.map +1 -0
- package/dist/infrastructure/xai/attention-visualizer.d.ts +6 -8
- package/dist/infrastructure/xai/attention-visualizer.d.ts.map +1 -1
- package/dist/infrastructure/xai/attention-visualizer.js +6 -8
- package/dist/infrastructure/xai/attention-visualizer.js.map +1 -1
- package/dist/infrastructure/xai/cot-visualizer.d.ts +6 -8
- package/dist/infrastructure/xai/cot-visualizer.d.ts.map +1 -1
- package/dist/infrastructure/xai/cot-visualizer.js +62 -18
- package/dist/infrastructure/xai/cot-visualizer.js.map +1 -1
- package/dist/infrastructure/xai/decision-tree-log.d.ts +6 -10
- package/dist/infrastructure/xai/decision-tree-log.d.ts.map +1 -1
- package/dist/infrastructure/xai/decision-tree-log.js +6 -10
- package/dist/infrastructure/xai/decision-tree-log.js.map +1 -1
- package/dist/infrastructure/xai/interactive-xai.d.ts +6 -8
- package/dist/infrastructure/xai/interactive-xai.d.ts.map +1 -1
- package/dist/infrastructure/xai/interactive-xai.js +6 -8
- package/dist/infrastructure/xai/interactive-xai.js.map +1 -1
- package/dist/infrastructure/xai/uncertainty-quantifier.d.ts +6 -9
- package/dist/infrastructure/xai/uncertainty-quantifier.d.ts.map +1 -1
- package/dist/infrastructure/xai/uncertainty-quantifier.js +6 -9
- package/dist/infrastructure/xai/uncertainty-quantifier.js.map +1 -1
- package/dist/presentation/cli/commands/ask-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/ask-command.js +152 -13
- package/dist/presentation/cli/commands/ask-command.js.map +1 -1
- package/dist/presentation/cli/commands/docs-command.d.ts +12 -0
- package/dist/presentation/cli/commands/docs-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/docs-command.js +196 -0
- package/dist/presentation/cli/commands/docs-command.js.map +1 -0
- package/dist/presentation/cli/commands/fix-command.d.ts +8 -0
- package/dist/presentation/cli/commands/fix-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/fix-command.js +309 -0
- package/dist/presentation/cli/commands/fix-command.js.map +1 -0
- package/dist/presentation/cli/commands/help-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/help-command.js +2 -0
- package/dist/presentation/cli/commands/help-command.js.map +1 -1
- package/dist/presentation/cli/commands/orchestrate-command.d.ts +2 -0
- package/dist/presentation/cli/commands/orchestrate-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/orchestrate-command.js +88 -1
- package/dist/presentation/cli/commands/orchestrate-command.js.map +1 -1
- package/dist/presentation/cli/commands/plan-command.d.ts +1 -0
- package/dist/presentation/cli/commands/plan-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/plan-command.js +136 -7
- package/dist/presentation/cli/commands/plan-command.js.map +1 -1
- package/dist/presentation/cli/commands/product-command.d.ts +12 -0
- package/dist/presentation/cli/commands/product-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/product-command.js +188 -0
- package/dist/presentation/cli/commands/product-command.js.map +1 -0
- package/dist/presentation/cli/commands/react-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/react-command.js +98 -16
- package/dist/presentation/cli/commands/react-command.js.map +1 -1
- package/dist/presentation/cli/commands/review-command.d.ts +14 -0
- package/dist/presentation/cli/commands/review-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/review-command.js +22 -0
- package/dist/presentation/cli/commands/review-command.js.map +1 -0
- package/dist/presentation/cli/commands/run-command.d.ts +15 -0
- package/dist/presentation/cli/commands/run-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/run-command.js +29 -0
- package/dist/presentation/cli/commands/run-command.js.map +1 -0
- package/dist/presentation/cli/commands/setup-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/setup-command.js +67 -12
- package/dist/presentation/cli/commands/setup-command.js.map +1 -1
- package/dist/presentation/cli/commands/smart-command.d.ts +3 -1
- package/dist/presentation/cli/commands/smart-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/smart-command.js +227 -23
- package/dist/presentation/cli/commands/smart-command.js.map +1 -1
- package/dist/presentation/cli/commands/status-command.d.ts +11 -0
- package/dist/presentation/cli/commands/status-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/status-command.js +176 -0
- package/dist/presentation/cli/commands/status-command.js.map +1 -0
- package/dist/presentation/cli/commands/suggest-command.d.ts +13 -0
- package/dist/presentation/cli/commands/suggest-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/suggest-command.js +25 -0
- package/dist/presentation/cli/commands/suggest-command.js.map +1 -0
- package/dist/presentation/cli/commands/trace-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/trace-command.js +9 -5
- package/dist/presentation/cli/commands/trace-command.js.map +1 -1
- package/dist/presentation/cli/commands/undo-command.js +15 -6
- package/dist/presentation/cli/commands/undo-command.js.map +1 -1
- package/dist/presentation/cli/error-display.d.ts +2 -0
- package/dist/presentation/cli/error-display.d.ts.map +1 -1
- package/dist/presentation/cli/error-display.js +220 -2
- package/dist/presentation/cli/error-display.js.map +1 -1
- 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/session.d.ts.map +1 -1
- package/dist/session.js +39 -2
- package/dist/session.js.map +1 -1
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +8 -5
- package/dist/ui.js.map +1 -1
- package/dist/utils/version.js +2 -2
- package/dist/verification/backup.d.ts.map +1 -1
- package/dist/verification/backup.js +24 -3
- package/dist/verification/backup.js.map +1 -1
- package/dist/verification/compiler.js +47 -12
- package/dist/verification/compiler.js.map +1 -1
- package/package.json +10 -2
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plan Repository
|
|
3
|
+
* Persists and retrieves plans for execution across sessions
|
|
4
|
+
*/
|
|
5
|
+
import type { Plan } from '../../domain/entities/plan.js';
|
|
6
|
+
export interface IPlanRepository {
|
|
7
|
+
save(plan: Plan): Promise<string>;
|
|
8
|
+
get(planId: string): Promise<Plan | null>;
|
|
9
|
+
list(limit?: number): Promise<Plan[]>;
|
|
10
|
+
update(planId: string, updates: Partial<Plan>): Promise<void>;
|
|
11
|
+
delete(planId: string): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export declare class FilePlanRepository implements IPlanRepository {
|
|
14
|
+
private plansDir;
|
|
15
|
+
constructor();
|
|
16
|
+
/**
|
|
17
|
+
* Save a plan to disk
|
|
18
|
+
*/
|
|
19
|
+
save(plan: Plan): Promise<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Get a plan by ID
|
|
22
|
+
*/
|
|
23
|
+
get(planId: string): Promise<Plan | null>;
|
|
24
|
+
/**
|
|
25
|
+
* List recent plans
|
|
26
|
+
*/
|
|
27
|
+
list(limit?: number): Promise<Plan[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Update a plan
|
|
30
|
+
*/
|
|
31
|
+
update(planId: string, updates: Partial<Plan>): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Delete a plan
|
|
34
|
+
*/
|
|
35
|
+
delete(planId: string): Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
export declare function getPlanRepository(): IPlanRepository;
|
|
38
|
+
//# sourceMappingURL=plan-repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-repository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/storage/plan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
|
|
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,CA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,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,QAAQ,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"}
|
|
@@ -18,6 +18,17 @@ export declare class SQLiteEmbeddingRepository implements IEmbeddingRepository {
|
|
|
18
18
|
/**
|
|
19
19
|
* Search with pre-computed query embedding
|
|
20
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
|
|
21
32
|
*/
|
|
22
33
|
searchWithEmbedding(queryEmbedding: number[], topK: number): Promise<CodeChunk[]>;
|
|
23
34
|
}
|
|
@@ -1 +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;
|
|
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"}
|
|
@@ -6,6 +6,7 @@ import { readFileSync, existsSync, mkdirSync, writeFileSync } from 'fs';
|
|
|
6
6
|
import { join, dirname } from 'path';
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
8
8
|
import initSqlJs from 'sql.js';
|
|
9
|
+
import { getQueryResultCache } from '../cache/query-result-cache.js';
|
|
9
10
|
function getDbPath() {
|
|
10
11
|
const __filename = fileURLToPath(import.meta.url);
|
|
11
12
|
const __dirname = dirname(__filename);
|
|
@@ -29,6 +30,22 @@ function cosineSimilarity(a, b) {
|
|
|
29
30
|
const denominator = Math.sqrt(normA) * Math.sqrt(normB);
|
|
30
31
|
return denominator === 0 ? 0 : dotProduct / denominator;
|
|
31
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Optimized cosine similarity with pre-computed query norm
|
|
35
|
+
* Reduces redundant calculations when comparing same query to multiple embeddings
|
|
36
|
+
*/
|
|
37
|
+
function cosineSimilarityOptimized(queryEmbedding, queryNorm, docEmbedding) {
|
|
38
|
+
if (queryEmbedding.length !== docEmbedding.length)
|
|
39
|
+
return 0;
|
|
40
|
+
let dotProduct = 0;
|
|
41
|
+
let docNorm = 0;
|
|
42
|
+
for (let i = 0; i < docEmbedding.length; i++) {
|
|
43
|
+
dotProduct += queryEmbedding[i] * docEmbedding[i];
|
|
44
|
+
docNorm += docEmbedding[i] * docEmbedding[i];
|
|
45
|
+
}
|
|
46
|
+
const denominator = queryNorm * Math.sqrt(docNorm);
|
|
47
|
+
return denominator === 0 ? 0 : dotProduct / denominator;
|
|
48
|
+
}
|
|
32
49
|
export class SQLiteEmbeddingRepository {
|
|
33
50
|
dbPath;
|
|
34
51
|
db = null;
|
|
@@ -83,6 +100,8 @@ export class SQLiteEmbeddingRepository {
|
|
|
83
100
|
}
|
|
84
101
|
stmt.free();
|
|
85
102
|
this.saveDb();
|
|
103
|
+
// Clear query result cache when codebase is re-indexed
|
|
104
|
+
getQueryResultCache().clear();
|
|
86
105
|
}
|
|
87
106
|
async search(query, topK) {
|
|
88
107
|
// For now, return empty - will implement with query embedding
|
|
@@ -132,16 +151,92 @@ export class SQLiteEmbeddingRepository {
|
|
|
132
151
|
/**
|
|
133
152
|
* Search with pre-computed query embedding
|
|
134
153
|
* (Used by application layer to avoid circular dependency)
|
|
154
|
+
*
|
|
155
|
+
* PERFORMANCE OPTIMIZATION:
|
|
156
|
+
* 1. Uses min-heap to maintain only topK results (O(n log k) vs O(n log n))
|
|
157
|
+
* 2. Pre-computes query norm once (avoids redundant calculations)
|
|
158
|
+
* 3. Optimized cosine similarity calculation
|
|
159
|
+
* 4. Result caching (query + topK results) to avoid redundant searches
|
|
160
|
+
* 5. Batch processing with early termination for large datasets
|
|
161
|
+
* 6. Optimized JSON parsing (cache parsed embeddings per row)
|
|
162
|
+
*
|
|
163
|
+
* Note: Cache key should be generated from query string, not embedding
|
|
164
|
+
* This method receives embedding, so caching should be done at call site
|
|
135
165
|
*/
|
|
136
166
|
async searchWithEmbedding(queryEmbedding, topK) {
|
|
137
167
|
const db = await this.getDb();
|
|
168
|
+
// Pre-compute query norm once (used for all similarity calculations)
|
|
169
|
+
let queryNorm = 0;
|
|
170
|
+
for (let i = 0; i < queryEmbedding.length; i++) {
|
|
171
|
+
queryNorm += queryEmbedding[i] * queryEmbedding[i];
|
|
172
|
+
}
|
|
173
|
+
queryNorm = Math.sqrt(queryNorm);
|
|
174
|
+
// Get total count for optimization decisions
|
|
175
|
+
const countStmt = db.prepare('SELECT COUNT(*) as count FROM embeddings');
|
|
176
|
+
countStmt.step();
|
|
177
|
+
const totalCount = countStmt.getAsObject().count;
|
|
178
|
+
countStmt.free();
|
|
179
|
+
// OPTIMIZATION: Early termination for large datasets
|
|
180
|
+
// Process with early termination if dataset is large
|
|
181
|
+
const USE_EARLY_TERMINATION = totalCount > 500;
|
|
182
|
+
const MAX_PROCESS = USE_EARLY_TERMINATION ? Math.min(totalCount, 1000) : totalCount;
|
|
183
|
+
// Min-heap to maintain topK results (smallest score at root)
|
|
184
|
+
const heap = [];
|
|
185
|
+
const heapInsert = (item) => {
|
|
186
|
+
if (heap.length < topK) {
|
|
187
|
+
heap.push(item);
|
|
188
|
+
// Bubble up
|
|
189
|
+
let i = heap.length - 1;
|
|
190
|
+
while (i > 0) {
|
|
191
|
+
const parent = Math.floor((i - 1) / 2);
|
|
192
|
+
if (heap[parent].score <= heap[i].score)
|
|
193
|
+
break;
|
|
194
|
+
[heap[parent], heap[i]] = [heap[i], heap[parent]];
|
|
195
|
+
i = parent;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
else if (item.score > heap[0].score) {
|
|
199
|
+
// Replace root (smallest) with new item if it's larger
|
|
200
|
+
heap[0] = item;
|
|
201
|
+
// Bubble down
|
|
202
|
+
let i = 0;
|
|
203
|
+
while (true) {
|
|
204
|
+
const left = 2 * i + 1;
|
|
205
|
+
const right = 2 * i + 2;
|
|
206
|
+
let smallest = i;
|
|
207
|
+
if (left < heap.length && heap[left].score < heap[smallest].score) {
|
|
208
|
+
smallest = left;
|
|
209
|
+
}
|
|
210
|
+
if (right < heap.length && heap[right].score < heap[smallest].score) {
|
|
211
|
+
smallest = right;
|
|
212
|
+
}
|
|
213
|
+
if (smallest === i)
|
|
214
|
+
break;
|
|
215
|
+
[heap[i], heap[smallest]] = [heap[smallest], heap[i]];
|
|
216
|
+
i = smallest;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
// Standard query - early termination will handle large datasets
|
|
138
221
|
const stmt = db.prepare('SELECT * FROM embeddings');
|
|
139
|
-
|
|
222
|
+
let processed = 0;
|
|
223
|
+
let consecutiveLowScores = 0;
|
|
224
|
+
const EARLY_TERMINATION_THRESHOLD = USE_EARLY_TERMINATION ? 150 : Infinity; // More aggressive for large datasets
|
|
225
|
+
// Process embeddings in batches with early termination
|
|
140
226
|
while (stmt.step()) {
|
|
141
227
|
const row = stmt.getAsObject();
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
228
|
+
// Parse embedding (try-catch for invalid JSON)
|
|
229
|
+
let embedding;
|
|
230
|
+
try {
|
|
231
|
+
embedding = JSON.parse(row.embedding);
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
continue; // Skip invalid embeddings
|
|
235
|
+
}
|
|
236
|
+
// Compute similarity using optimized function (pre-computed query norm)
|
|
237
|
+
const score = cosineSimilarityOptimized(queryEmbedding, queryNorm, embedding);
|
|
238
|
+
// Insert into heap (maintains topK)
|
|
239
|
+
heapInsert({
|
|
145
240
|
chunk: {
|
|
146
241
|
filepath: row.filepath,
|
|
147
242
|
content: row.content,
|
|
@@ -151,12 +246,32 @@ export class SQLiteEmbeddingRepository {
|
|
|
151
246
|
},
|
|
152
247
|
score,
|
|
153
248
|
});
|
|
249
|
+
processed++;
|
|
250
|
+
// Early termination: If we have topK results and many consecutive low scores,
|
|
251
|
+
// likely we've found the best matches
|
|
252
|
+
if (heap.length >= topK) {
|
|
253
|
+
const minScore = heap[0].score;
|
|
254
|
+
if (score < minScore * 0.8) { // Score significantly lower than current min
|
|
255
|
+
consecutiveLowScores++;
|
|
256
|
+
if (consecutiveLowScores > EARLY_TERMINATION_THRESHOLD) {
|
|
257
|
+
break; // Early termination
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
consecutiveLowScores = 0; // Reset counter
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
// Limit total processing for very large datasets (early termination optimization)
|
|
265
|
+
if (processed >= MAX_PROCESS) {
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
154
268
|
}
|
|
155
269
|
stmt.free();
|
|
156
|
-
|
|
270
|
+
// Extract results from heap and sort descending (highest scores first)
|
|
271
|
+
const results = heap
|
|
157
272
|
.sort((a, b) => b.score - a.score)
|
|
158
|
-
.slice(0, topK)
|
|
159
273
|
.map(r => r.chunk);
|
|
274
|
+
return results;
|
|
160
275
|
}
|
|
161
276
|
}
|
|
162
277
|
//# sourceMappingURL=sqlite-embedding-repository.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-embedding-repository.js","sourceRoot":"","sources":["../../../src/infrastructure/storage/sqlite-embedding-repository.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,SAAuB,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"sqlite-embedding-repository.js","sourceRoot":"","sources":["../../../src/infrastructure/storage/sqlite-embedding-repository.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,SAAuB,MAAM,QAAQ,CAAC;AAG7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE,SAAS,SAAS;IAChB,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAC7C,IAAI,UAAU,C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EH,SAAS,EAAE,CAAC;YAEZ,8EAA8E;YAC9E,sCAAsC;YACtC,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC;gBACxB,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;gBAC/B,IAAI,KAAK,GAAG,QAAQ,GAAG,GAAG,EAAE,CAAC,CAAC,6CAA6C;oBACzE,oBAAoB,EAAE,CAAC;oBACvB,IAAI,oBAAoB,GAAG,2BAA2B,EAAE,CAAC;wBACvD,MAAM,CAAC,oBAAoB;oBAC7B,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,oBAAoB,GAAG,CAAC,CAAC,CAAC,gBAAgB;gBAC5C,CAAC;YACH,CAAC;YAED,kFAAkF;YAClF,IAAI,SAAS,IAAI,WAAW,EAAE,CAAC;gBAC7B,MAAM;YACR,CAAC;QACH,CAAC;QAED,IAAI,CAAC,IAAI,EAAE,CAAC;QAEZ,uEAAuE;QACvE,MAAM,OAAO,GAAG,IAAI;aACjB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;aACjC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAErB,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure: Task Helpers
|
|
3
|
+
* Helper functions for creating and updating tasks (non-breaking)
|
|
4
|
+
*
|
|
5
|
+
* Phase 1: v0.5.0-alpha
|
|
6
|
+
* See: docs/ARCHITECTURE/TASK_MODEL.md
|
|
7
|
+
*/
|
|
8
|
+
import { TaskStatus, ReviewStatus, type CodehereTask } from '../../domain/entities/task.js';
|
|
9
|
+
import type { CodebaseInfo } from '../../domain/services/codebase-detector.js';
|
|
10
|
+
/**
|
|
11
|
+
* Create task for plan command
|
|
12
|
+
* Non-breaking: silent failure, doesn't affect user workflow
|
|
13
|
+
*/
|
|
14
|
+
export declare function createPlanTask(options: {
|
|
15
|
+
goal: string;
|
|
16
|
+
plan: any;
|
|
17
|
+
codebaseInfo: CodebaseInfo | null;
|
|
18
|
+
runId: string;
|
|
19
|
+
}): Promise<string | null>;
|
|
20
|
+
/**
|
|
21
|
+
* Create task for fix/run command
|
|
22
|
+
* Non-breaking: silent failure, doesn't affect user workflow
|
|
23
|
+
*/
|
|
24
|
+
export declare function createRunTask(options: {
|
|
25
|
+
goal: string;
|
|
26
|
+
filePath?: string;
|
|
27
|
+
codebaseInfo: CodebaseInfo | null;
|
|
28
|
+
runId: string;
|
|
29
|
+
files?: string[];
|
|
30
|
+
}): Promise<string | null>;
|
|
31
|
+
/**
|
|
32
|
+
* Update task status
|
|
33
|
+
* Non-breaking: silent failure
|
|
34
|
+
*/
|
|
35
|
+
export declare function updateTaskStatus(taskId: string | null, status: TaskStatus, updates?: Partial<CodehereTask>): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Update task with execution results
|
|
38
|
+
* Non-breaking: silent failure
|
|
39
|
+
*/
|
|
40
|
+
export declare function updateTaskWithResults(taskId: string | null, results: {
|
|
41
|
+
filesChanged?: string[];
|
|
42
|
+
filesCreated?: string[];
|
|
43
|
+
filesDeleted?: string[];
|
|
44
|
+
testResults?: any;
|
|
45
|
+
sastResults?: any;
|
|
46
|
+
error?: any;
|
|
47
|
+
status: TaskStatus;
|
|
48
|
+
executionCompletedAt?: number;
|
|
49
|
+
executionStartedAt?: number;
|
|
50
|
+
agentFeedbackId?: string;
|
|
51
|
+
traceSummaryId?: string;
|
|
52
|
+
}): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Update task review status
|
|
55
|
+
* Non-breaking: silent failure
|
|
56
|
+
*/
|
|
57
|
+
export declare function updateTaskReview(taskId: string | null, reviewStatus: ReviewStatus, reviewedBy?: string, comments?: string): Promise<void>;
|
|
58
|
+
//# sourceMappingURL=task-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-helpers.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/storage/task-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAY,UAAU,EAA6B,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAIjI,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAE/E;;;GAGG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,CAAC;IACV,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA+BzB;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAgCzB;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,MAAM,EAAE,UAAU,EAClB,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAC9B,OAAO,CAAC,IAAI,CAAC,CAiBf;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,OAAO,EAAE;IACP,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,MAAM,EAAE,UAAU,CAAC;IACnB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GACA,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,YAAY,EAAE,YAAY,EAC1B,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CA0Bf"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure: Task Helpers
|
|
3
|
+
* Helper functions for creating and updating tasks (non-breaking)
|
|
4
|
+
*
|
|
5
|
+
* Phase 1: v0.5.0-alpha
|
|
6
|
+
* See: docs/ARCHITECTURE/TASK_MODEL.md
|
|
7
|
+
*/
|
|
8
|
+
import { getTaskRepository } from './task-repository.js';
|
|
9
|
+
import { TaskMode, TaskStatus, ReviewStatus } from '../../domain/entities/task.js';
|
|
10
|
+
import { getCurrentEnvironmentMode } from '../../domain/services/environment-mode-manager.js';
|
|
11
|
+
import { detectRiskTier, detectRiskTierFromPlan } from '../../domain/services/risk-tier-detector.js';
|
|
12
|
+
import { randomUUID } from 'crypto';
|
|
13
|
+
/**
|
|
14
|
+
* Create task for plan command
|
|
15
|
+
* Non-breaking: silent failure, doesn't affect user workflow
|
|
16
|
+
*/
|
|
17
|
+
export async function createPlanTask(options) {
|
|
18
|
+
const { goal, plan, codebaseInfo, runId } = options;
|
|
19
|
+
try {
|
|
20
|
+
const taskRepo = getTaskRepository();
|
|
21
|
+
const environment = getCurrentEnvironmentMode();
|
|
22
|
+
const riskTier = detectRiskTierFromPlan(plan);
|
|
23
|
+
const taskId = `task-${randomUUID()}`;
|
|
24
|
+
await taskRepo.create({
|
|
25
|
+
id: taskId,
|
|
26
|
+
createdAt: Date.now(),
|
|
27
|
+
updatedAt: Date.now(),
|
|
28
|
+
codebaseId: codebaseInfo?.codebaseId || codebaseInfo?.rootPath || process.cwd(),
|
|
29
|
+
cwd: process.cwd(),
|
|
30
|
+
mode: TaskMode.PLAN,
|
|
31
|
+
goal,
|
|
32
|
+
command: 'plan',
|
|
33
|
+
status: TaskStatus.PLANNED,
|
|
34
|
+
riskTier,
|
|
35
|
+
environment,
|
|
36
|
+
planId: plan.id,
|
|
37
|
+
plan: plan, // Store serialized plan
|
|
38
|
+
traceSummaryId: runId,
|
|
39
|
+
});
|
|
40
|
+
return taskId;
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
// Silent failure - task creation is optional
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Create task for fix/run command
|
|
49
|
+
* Non-breaking: silent failure, doesn't affect user workflow
|
|
50
|
+
*/
|
|
51
|
+
export async function createRunTask(options) {
|
|
52
|
+
const { goal, filePath, codebaseInfo, runId, files = [] } = options;
|
|
53
|
+
try {
|
|
54
|
+
const taskRepo = getTaskRepository();
|
|
55
|
+
const environment = getCurrentEnvironmentMode();
|
|
56
|
+
const riskTier = detectRiskTier(files);
|
|
57
|
+
const taskId = `task-${randomUUID()}`;
|
|
58
|
+
const fullGoal = filePath ? `${goal} (file: ${filePath})` : goal;
|
|
59
|
+
await taskRepo.create({
|
|
60
|
+
id: taskId,
|
|
61
|
+
createdAt: Date.now(),
|
|
62
|
+
updatedAt: Date.now(),
|
|
63
|
+
codebaseId: codebaseInfo?.codebaseId || codebaseInfo?.rootPath || process.cwd(),
|
|
64
|
+
cwd: process.cwd(),
|
|
65
|
+
mode: TaskMode.RUN,
|
|
66
|
+
goal: fullGoal,
|
|
67
|
+
command: filePath ? 'fix' : 'run',
|
|
68
|
+
status: TaskStatus.CREATED,
|
|
69
|
+
riskTier,
|
|
70
|
+
environment,
|
|
71
|
+
filesChanged: files.length > 0 ? files : undefined,
|
|
72
|
+
traceSummaryId: runId,
|
|
73
|
+
});
|
|
74
|
+
return taskId;
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
// Silent failure - task creation is optional
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Update task status
|
|
83
|
+
* Non-breaking: silent failure
|
|
84
|
+
*/
|
|
85
|
+
export async function updateTaskStatus(taskId, status, updates) {
|
|
86
|
+
if (!taskId)
|
|
87
|
+
return;
|
|
88
|
+
try {
|
|
89
|
+
const taskRepo = getTaskRepository();
|
|
90
|
+
const existing = await taskRepo.getById(taskId);
|
|
91
|
+
if (!existing)
|
|
92
|
+
return;
|
|
93
|
+
await taskRepo.update({
|
|
94
|
+
...existing,
|
|
95
|
+
...updates,
|
|
96
|
+
status,
|
|
97
|
+
updatedAt: Date.now(),
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
// Silent failure
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Update task with execution results
|
|
106
|
+
* Non-breaking: silent failure
|
|
107
|
+
*/
|
|
108
|
+
export async function updateTaskWithResults(taskId, results) {
|
|
109
|
+
if (!taskId)
|
|
110
|
+
return;
|
|
111
|
+
try {
|
|
112
|
+
const taskRepo = getTaskRepository();
|
|
113
|
+
const existing = await taskRepo.getById(taskId);
|
|
114
|
+
if (!existing)
|
|
115
|
+
return;
|
|
116
|
+
await taskRepo.update({
|
|
117
|
+
...existing,
|
|
118
|
+
...results,
|
|
119
|
+
updatedAt: Date.now(),
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
// Silent failure
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Update task review status
|
|
128
|
+
* Non-breaking: silent failure
|
|
129
|
+
*/
|
|
130
|
+
export async function updateTaskReview(taskId, reviewStatus, reviewedBy, comments) {
|
|
131
|
+
if (!taskId)
|
|
132
|
+
return;
|
|
133
|
+
try {
|
|
134
|
+
const taskRepo = getTaskRepository();
|
|
135
|
+
const existing = await taskRepo.getById(taskId);
|
|
136
|
+
if (!existing)
|
|
137
|
+
return;
|
|
138
|
+
const newStatus = reviewStatus === ReviewStatus.APPROVED
|
|
139
|
+
? TaskStatus.APPROVED
|
|
140
|
+
: reviewStatus === ReviewStatus.REJECTED
|
|
141
|
+
? TaskStatus.REJECTED
|
|
142
|
+
: existing.status;
|
|
143
|
+
await taskRepo.update({
|
|
144
|
+
...existing,
|
|
145
|
+
reviewStatus,
|
|
146
|
+
reviewedAt: Date.now(),
|
|
147
|
+
reviewedBy,
|
|
148
|
+
reviewComments: comments,
|
|
149
|
+
status: newStatus,
|
|
150
|
+
updatedAt: Date.now(),
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
// Silent failure
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=task-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-helpers.js","sourceRoot":"","sources":["../../../src/infrastructure/storage/task-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAA6B,YAAY,EAAqB,MAAM,+BAA+B,CAAC;AACjI,OAAO,EAAE,yBAAyB,EAAE,MAAM,mDAAmD,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrG,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAGpC;;;GAGG;AACH,MAAM,CAAC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