codehere 0.1.0 → 0.2.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 +64 -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 +140 -0
- package/dist/application/services/dependency-container.d.ts.map +1 -0
- package/dist/application/services/dependency-container.js +402 -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 +36 -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 +150 -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 +685 -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 +267 -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 +325 -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 +44 -0
- package/dist/domain/services/react-loop.d.ts.map +1 -0
- package/dist/domain/services/react-loop.js +110 -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/index.js +228 -231
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/ai/cohere-ai-service.d.ts +54 -0
- package/dist/infrastructure/ai/cohere-ai-service.d.ts.map +1 -0
- package/dist/infrastructure/ai/cohere-ai-service.js +547 -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/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/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/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 +244 -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 +105 -0
- package/dist/infrastructure/observability/execution-tracer.d.ts.map +1 -0
- package/dist/infrastructure/observability/execution-tracer.js +190 -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 +55 -0
- package/dist/infrastructure/security/ai-sast-scanner.d.ts.map +1 -0
- package/dist/infrastructure/security/ai-sast-scanner.js +163 -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 +51 -0
- package/dist/infrastructure/security/enhanced-security-gate.d.ts.map +1 -0
- package/dist/infrastructure/security/enhanced-security-gate.js +92 -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/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 +24 -0
- package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts.map +1 -0
- package/dist/infrastructure/storage/sqlite-embedding-repository.js +162 -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/expectation-management.d.ts +65 -0
- package/dist/infrastructure/ux/expectation-management.d.ts.map +1 -0
- package/dist/infrastructure/ux/expectation-management.js +193 -0
- package/dist/infrastructure/ux/expectation-management.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/progressive-disclosure.d.ts +84 -0
- package/dist/infrastructure/ux/progressive-disclosure.d.ts.map +1 -0
- package/dist/infrastructure/ux/progressive-disclosure.js +235 -0
- package/dist/infrastructure/ux/progressive-disclosure.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 +105 -0
- package/dist/infrastructure/xai/cot-visualizer.d.ts.map +1 -0
- package/dist/infrastructure/xai/cot-visualizer.js +239 -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 +133 -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 +8 -0
- package/dist/presentation/cli/commands/orchestrate-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/orchestrate-command.js +112 -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 +114 -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 +99 -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 +231 -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 +212 -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 +125 -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 +141 -0
- package/dist/presentation/cli/commands/undo-command.js.map +1 -0
- package/dist/presentation/cli/error-display.d.ts +23 -0
- package/dist/presentation/cli/error-display.d.ts.map +1 -0
- package/dist/presentation/cli/error-display.js +122 -0
- package/dist/presentation/cli/error-display.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 +52 -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 +238 -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 +228 -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 @@
|
|
|
1
|
+
{"version":3,"file":"bi-directional-learning.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/ux/bi-directional-learning.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG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,MAAM,CAAC;KAClB,GACA,YAAY,EAAE;IAyBjB,OAAO,CAAC,iBAAiB;IA2BzB,OAAO,CAAC,iBAAiB;IA4BzB,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,kBAAkB;CAuB3B"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure: Bi-directional Learning System
|
|
3
|
+
*
|
|
4
|
+
* Continuous refinement of AI models based on explicit and implicit user feedback
|
|
5
|
+
* Research: Bi-directional learning from user corrections, adapt to team preferences
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Edit/deletion tracking
|
|
9
|
+
* - Personalization engine
|
|
10
|
+
* - Learning from user corrections
|
|
11
|
+
* - Preference adaptation
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Bi-directional Learning System
|
|
15
|
+
* Learns from user edits, deletions, and explicit feedback
|
|
16
|
+
*/
|
|
17
|
+
export class BiDirectionalLearning {
|
|
18
|
+
feedbackHistory = new Map(); // userId -> feedbacks
|
|
19
|
+
learningPatterns = new Map(); // userId -> patterns
|
|
20
|
+
userPreferences = new Map();
|
|
21
|
+
/**
|
|
22
|
+
* Record user feedback (edit, deletion, etc.)
|
|
23
|
+
*/
|
|
24
|
+
recordFeedback(userId, feedback) {
|
|
25
|
+
const feedbackId = `feedback-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
26
|
+
const fullFeedback = {
|
|
27
|
+
...feedback,
|
|
28
|
+
feedbackId,
|
|
29
|
+
timestamp: Date.now(),
|
|
30
|
+
};
|
|
31
|
+
// Store feedback
|
|
32
|
+
if (!this.feedbackHistory.has(userId)) {
|
|
33
|
+
this.feedbackHistory.set(userId, []);
|
|
34
|
+
}
|
|
35
|
+
this.feedbackHistory.get(userId).push(fullFeedback);
|
|
36
|
+
// Learn from feedback
|
|
37
|
+
this.learnFromFeedback(userId, fullFeedback);
|
|
38
|
+
// Update preferences
|
|
39
|
+
this.updatePreferences(userId, fullFeedback);
|
|
40
|
+
return feedbackId;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Record explicit feedback (thumbs up/down, comments)
|
|
44
|
+
*/
|
|
45
|
+
recordExplicitFeedback(userId, feedback) {
|
|
46
|
+
return this.recordFeedback(userId, {
|
|
47
|
+
type: 'explicit_feedback',
|
|
48
|
+
signal: feedback.signal,
|
|
49
|
+
filepath: feedback.codeExample || 'general',
|
|
50
|
+
context: {
|
|
51
|
+
...feedback.context,
|
|
52
|
+
},
|
|
53
|
+
metadata: {
|
|
54
|
+
explicitFeedback: feedback.message,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Get user preferences
|
|
60
|
+
*/
|
|
61
|
+
getUserPreferences(userId) {
|
|
62
|
+
if (!this.userPreferences.has(userId)) {
|
|
63
|
+
this.userPreferences.set(userId, {
|
|
64
|
+
userId,
|
|
65
|
+
preferences: {},
|
|
66
|
+
learnedAt: Date.now(),
|
|
67
|
+
lastUpdated: Date.now(),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return this.userPreferences.get(userId);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get learned patterns for user
|
|
74
|
+
*/
|
|
75
|
+
getLearnedPatterns(userId) {
|
|
76
|
+
return this.learningPatterns.get(userId) || [];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Apply learned preferences to code generation
|
|
80
|
+
*/
|
|
81
|
+
applyPreferences(userId, code) {
|
|
82
|
+
const preferences = this.getUserPreferences(userId);
|
|
83
|
+
if (!preferences.preferences.codeStyle) {
|
|
84
|
+
return code; // No preferences learned yet
|
|
85
|
+
}
|
|
86
|
+
// Apply basic style preferences (simplified - in production, use AST transformation)
|
|
87
|
+
let modifiedCode = code;
|
|
88
|
+
const style = preferences.preferences.codeStyle;
|
|
89
|
+
// Apply quote preference (basic example)
|
|
90
|
+
if (style.quotes === 'single') {
|
|
91
|
+
modifiedCode = modifiedCode.replace(/"/g, "'");
|
|
92
|
+
}
|
|
93
|
+
else if (style.quotes === 'double') {
|
|
94
|
+
modifiedCode = modifiedCode.replace(/'/g, '"');
|
|
95
|
+
}
|
|
96
|
+
// In production, apply more sophisticated transformations based on preferences
|
|
97
|
+
return modifiedCode;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Get feedback history for user
|
|
101
|
+
*/
|
|
102
|
+
getFeedbackHistory(userId, filter) {
|
|
103
|
+
const feedbacks = this.feedbackHistory.get(userId) || [];
|
|
104
|
+
let filtered = [...feedbacks];
|
|
105
|
+
if (filter?.type) {
|
|
106
|
+
filtered = filtered.filter(f => f.type === filter.type);
|
|
107
|
+
}
|
|
108
|
+
if (filter?.signal) {
|
|
109
|
+
filtered = filtered.filter(f => f.signal === filter.signal);
|
|
110
|
+
}
|
|
111
|
+
if (filter?.startTime) {
|
|
112
|
+
filtered = filtered.filter(f => f.timestamp >= filter.startTime);
|
|
113
|
+
}
|
|
114
|
+
if (filter?.endTime) {
|
|
115
|
+
filtered = filtered.filter(f => f.timestamp <= filter.endTime);
|
|
116
|
+
}
|
|
117
|
+
return filtered.sort((a, b) => b.timestamp - a.timestamp);
|
|
118
|
+
}
|
|
119
|
+
// Private helpers
|
|
120
|
+
learnFromFeedback(userId, feedback) {
|
|
121
|
+
// Learn patterns from edits and deletions
|
|
122
|
+
if (feedback.type === 'edit' && feedback.originalCode && feedback.modifiedCode) {
|
|
123
|
+
const pattern = this.extractPattern(feedback.originalCode, feedback.modifiedCode);
|
|
124
|
+
if (pattern) {
|
|
125
|
+
this.addLearningPattern(userId, {
|
|
126
|
+
type: 'correction',
|
|
127
|
+
pattern: pattern,
|
|
128
|
+
confidence: 0.7,
|
|
129
|
+
occurrences: 1,
|
|
130
|
+
examples: [feedback.modifiedCode],
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// Learn from deletions (what user removes = not wanted)
|
|
135
|
+
if (feedback.type === 'deletion' && feedback.originalCode) {
|
|
136
|
+
this.addLearningPattern(userId, {
|
|
137
|
+
type: 'pattern',
|
|
138
|
+
pattern: `Avoid: ${feedback.originalCode.substring(0, 50)}`,
|
|
139
|
+
confidence: 0.6,
|
|
140
|
+
occurrences: 1,
|
|
141
|
+
examples: [],
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
updatePreferences(userId, feedback) {
|
|
146
|
+
const preferences = this.getUserPreferences(userId);
|
|
147
|
+
// Infer preferences from edits
|
|
148
|
+
if (feedback.type === 'edit' && feedback.originalCode && feedback.modifiedCode) {
|
|
149
|
+
// Infer code style preferences (simplified)
|
|
150
|
+
if (feedback.modifiedCode.includes("'") && !feedback.originalCode.includes("'")) {
|
|
151
|
+
preferences.preferences.codeStyle = preferences.preferences.codeStyle || {};
|
|
152
|
+
preferences.preferences.codeStyle.quotes = 'single';
|
|
153
|
+
}
|
|
154
|
+
else if (feedback.modifiedCode.includes('"') && !feedback.originalCode.includes('"')) {
|
|
155
|
+
preferences.preferences.codeStyle = preferences.preferences.codeStyle || {};
|
|
156
|
+
preferences.preferences.codeStyle.quotes = 'double';
|
|
157
|
+
}
|
|
158
|
+
preferences.lastUpdated = Date.now();
|
|
159
|
+
}
|
|
160
|
+
// Update based on explicit feedback
|
|
161
|
+
if (feedback.type === 'explicit_feedback' && feedback.metadata?.explicitFeedback) {
|
|
162
|
+
// Parse explicit feedback for preferences
|
|
163
|
+
const message = feedback.metadata.explicitFeedback.toLowerCase();
|
|
164
|
+
if (message.includes('style') || message.includes('format')) {
|
|
165
|
+
// Extract style preferences from feedback
|
|
166
|
+
// (In production, use NLP to parse structured preferences)
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
extractPattern(original, modified) {
|
|
171
|
+
// Simple pattern extraction (in production, use AST diffing)
|
|
172
|
+
if (original.length > 0 && modified.length > 0) {
|
|
173
|
+
return `Pattern: ${modified.substring(0, 30)}...`;
|
|
174
|
+
}
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
addLearningPattern(userId, pattern) {
|
|
178
|
+
if (!this.learningPatterns.has(userId)) {
|
|
179
|
+
this.learningPatterns.set(userId, []);
|
|
180
|
+
}
|
|
181
|
+
const patterns = this.learningPatterns.get(userId);
|
|
182
|
+
// Check if similar pattern exists
|
|
183
|
+
const existing = patterns.find(p => p.pattern === pattern.pattern);
|
|
184
|
+
if (existing) {
|
|
185
|
+
existing.occurrences++;
|
|
186
|
+
existing.confidence = Math.min(1.0, existing.confidence + 0.1);
|
|
187
|
+
existing.examples.push(...pattern.examples.slice(0, 3)); // Keep max 3 examples
|
|
188
|
+
existing.lastSeen = Date.now();
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
patterns.push({
|
|
192
|
+
...pattern,
|
|
193
|
+
patternId: `pattern-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,
|
|
194
|
+
createdAt: Date.now(),
|
|
195
|
+
lastSeen: Date.now(),
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=bi-directional-learning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bi-directional-learning.js","sourceRoot":"","sources":["../../../src/infrastructure/ux/bi-directional-learning.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAuDH;;;GAGG;AACH,MAAM,OAAO,qBAAqB;IACxB,eAAe,GAAgC,IAAI,GAAG,EAAE,CAAC,CAAC,sBAAsB;IAChF,gBAAgB,GAAmC,IAAI,GAAG,EAAE,CAAC,CAAC,qBAAqB;IACnF,eAAe,GAAiC,IAAI,GAAG,EAAE,CAAC;IAElE;;OAEG;IACH,cAAc,CAAC,MAAc,EAAE,QAAwD;QACrF,MAAM,UAAU,GAAG,YAAY,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC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CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;QACnE,IAAI,QAAQ,EAAE,CAAC;YACb,QAAQ,CAAC,WAAW,EAAE,CAAC;YACvB,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC;YAC/D,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,sBAAsB;YAC/E,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACjC,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,IAAI,CAAC;gBACZ,GAAG,OAAO;gBACV,SAAS,EAAE,WAAW,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;gBAC7E,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;gBACrB,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE;aACrB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure: Expectation Management System
|
|
3
|
+
*
|
|
4
|
+
* Clearly communicates AI limitations to prevent user frustration
|
|
5
|
+
* Research: Expectation management - clear limitations, "can make mistakes" warnings
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Clear capability communication
|
|
9
|
+
* - Limitation warnings
|
|
10
|
+
* - Contextual disclaimers
|
|
11
|
+
* - Error prevention messaging
|
|
12
|
+
*/
|
|
13
|
+
export type OperationRisk = 'low' | 'medium' | 'high' | 'critical';
|
|
14
|
+
export type CapabilityLevel = 'confident' | 'moderate' | 'uncertain' | 'risky';
|
|
15
|
+
export interface ExpectationMessage {
|
|
16
|
+
type: 'capability' | 'limitation' | 'warning' | 'disclaimer';
|
|
17
|
+
operation: string;
|
|
18
|
+
message: string;
|
|
19
|
+
severity: 'info' | 'warning' | 'error';
|
|
20
|
+
showOnce?: boolean;
|
|
21
|
+
contextual?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface CapabilityAssessment {
|
|
24
|
+
operation: string;
|
|
25
|
+
capability: CapabilityLevel;
|
|
26
|
+
confidence: number;
|
|
27
|
+
limitations: string[];
|
|
28
|
+
warnings: string[];
|
|
29
|
+
canProceed: boolean;
|
|
30
|
+
recommendedApproach?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Expectation Management System
|
|
34
|
+
* Manages user expectations and communicates AI limitations clearly
|
|
35
|
+
*/
|
|
36
|
+
export declare class ExpectationManagement {
|
|
37
|
+
private messages;
|
|
38
|
+
private shownMessages;
|
|
39
|
+
constructor();
|
|
40
|
+
/**
|
|
41
|
+
* Assess capability for an operation
|
|
42
|
+
*/
|
|
43
|
+
assessCapability(operation: string, context: {
|
|
44
|
+
complexity?: 'simple' | 'moderate' | 'complex';
|
|
45
|
+
domain?: string;
|
|
46
|
+
uncertainty?: number;
|
|
47
|
+
riskLevel?: OperationRisk;
|
|
48
|
+
}): CapabilityAssessment;
|
|
49
|
+
/**
|
|
50
|
+
* Get expectation message for operation
|
|
51
|
+
*/
|
|
52
|
+
getExpectationMessage(operation: string, context?: Record<string, any>): ExpectationMessage | null;
|
|
53
|
+
/**
|
|
54
|
+
* Register custom expectation message
|
|
55
|
+
*/
|
|
56
|
+
registerMessage(message: ExpectationMessage): void;
|
|
57
|
+
/**
|
|
58
|
+
* Format capability assessment for display
|
|
59
|
+
*/
|
|
60
|
+
formatAssessment(assessment: CapabilityAssessment): string;
|
|
61
|
+
private initializeDefaultMessages;
|
|
62
|
+
private matchesContext;
|
|
63
|
+
private generateRecommendedApproach;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=expectation-management.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expectation-management.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/ux/expectation-management.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;AACnE,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,GAAG,OAAO,CAAC;AAE/E,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,YAAY,GAAG,YAAY,GAAG,SAAS,GAAG,YAAY,CAAC;IAC7D,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,eAAe,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;GAGG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAA8C;IAC9D,OAAO,CAAC,aAAa,CAA0B;;IAM/C;;OAEG;IACH,gBAAgB,CACd,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;QACP,UAAU,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;QAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,aAAa,CAAC;KAC3B,GACA,oBAAoB;IAyDvB;;OAEG;IACH,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,kBAAkB,GAAG,IAAI;IAuBlG;;OAEG;IACH,eAAe,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAIlD;;OAEG;IACH,gBAAgB,CAAC,UAAU,EAAE,oBAAoB,GAAG,MAAM;IA2C1D,OAAO,CAAC,yBAAyB;IA6BjC,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,2BAA2B;CAcpC"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure: Expectation Management System
|
|
3
|
+
*
|
|
4
|
+
* Clearly communicates AI limitations to prevent user frustration
|
|
5
|
+
* Research: Expectation management - clear limitations, "can make mistakes" warnings
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Clear capability communication
|
|
9
|
+
* - Limitation warnings
|
|
10
|
+
* - Contextual disclaimers
|
|
11
|
+
* - Error prevention messaging
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Expectation Management System
|
|
15
|
+
* Manages user expectations and communicates AI limitations clearly
|
|
16
|
+
*/
|
|
17
|
+
export class ExpectationManagement {
|
|
18
|
+
messages = new Map();
|
|
19
|
+
shownMessages = new Set(); // Track shown messages
|
|
20
|
+
constructor() {
|
|
21
|
+
this.initializeDefaultMessages();
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Assess capability for an operation
|
|
25
|
+
*/
|
|
26
|
+
assessCapability(operation, context) {
|
|
27
|
+
const { complexity = 'moderate', domain, uncertainty = 0.5, riskLevel = 'medium' } = context;
|
|
28
|
+
let capability = 'moderate';
|
|
29
|
+
let confidence = 0.7;
|
|
30
|
+
const limitations = [];
|
|
31
|
+
const warnings = [];
|
|
32
|
+
// Adjust based on complexity
|
|
33
|
+
if (complexity === 'simple') {
|
|
34
|
+
capability = 'confident';
|
|
35
|
+
confidence = 0.9;
|
|
36
|
+
}
|
|
37
|
+
else if (complexity === 'complex') {
|
|
38
|
+
capability = 'uncertain';
|
|
39
|
+
confidence = 0.5;
|
|
40
|
+
limitations.push('Complex operations may require multiple iterations');
|
|
41
|
+
}
|
|
42
|
+
// Adjust based on uncertainty
|
|
43
|
+
if (uncertainty > 0.7) {
|
|
44
|
+
capability = 'risky';
|
|
45
|
+
confidence = 0.3;
|
|
46
|
+
warnings.push('High uncertainty detected - verify output carefully');
|
|
47
|
+
warnings.push('This may indicate hallucination risk');
|
|
48
|
+
}
|
|
49
|
+
// Adjust based on risk level
|
|
50
|
+
if (riskLevel === 'critical') {
|
|
51
|
+
warnings.push('Critical operation - human review recommended');
|
|
52
|
+
capability = 'risky';
|
|
53
|
+
confidence = Math.min(confidence, 0.4);
|
|
54
|
+
}
|
|
55
|
+
else if (riskLevel === 'high') {
|
|
56
|
+
warnings.push('High-risk operation - please review before applying');
|
|
57
|
+
}
|
|
58
|
+
// Domain-specific limitations
|
|
59
|
+
if (domain === 'security') {
|
|
60
|
+
limitations.push('Security-sensitive code requires careful review');
|
|
61
|
+
warnings.push('Always verify security implications manually');
|
|
62
|
+
}
|
|
63
|
+
else if (domain === 'financial') {
|
|
64
|
+
limitations.push('Financial code requires compliance verification');
|
|
65
|
+
warnings.push('Ensure regulatory compliance before deployment');
|
|
66
|
+
}
|
|
67
|
+
const canProceed = capability !== 'risky' || riskLevel !== 'critical';
|
|
68
|
+
return {
|
|
69
|
+
operation,
|
|
70
|
+
capability,
|
|
71
|
+
confidence,
|
|
72
|
+
limitations,
|
|
73
|
+
warnings,
|
|
74
|
+
canProceed,
|
|
75
|
+
recommendedApproach: this.generateRecommendedApproach(capability, complexity, riskLevel),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Get expectation message for operation
|
|
80
|
+
*/
|
|
81
|
+
getExpectationMessage(operation, context) {
|
|
82
|
+
// Check for contextual messages first
|
|
83
|
+
if (context) {
|
|
84
|
+
for (const message of this.messages.values()) {
|
|
85
|
+
if (message.contextual && this.matchesContext(message, context)) {
|
|
86
|
+
return message;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// Check for operation-specific message
|
|
91
|
+
const operationMessage = this.messages.get(operation);
|
|
92
|
+
if (operationMessage) {
|
|
93
|
+
if (operationMessage.showOnce && this.shownMessages.has(operation)) {
|
|
94
|
+
return null; // Already shown
|
|
95
|
+
}
|
|
96
|
+
this.shownMessages.add(operation);
|
|
97
|
+
return operationMessage;
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Register custom expectation message
|
|
103
|
+
*/
|
|
104
|
+
registerMessage(message) {
|
|
105
|
+
this.messages.set(message.operation, message);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Format capability assessment for display
|
|
109
|
+
*/
|
|
110
|
+
formatAssessment(assessment) {
|
|
111
|
+
let output = '';
|
|
112
|
+
// Capability level indicator
|
|
113
|
+
const capabilityIcons = {
|
|
114
|
+
confident: '✓',
|
|
115
|
+
moderate: '◐',
|
|
116
|
+
uncertain: '⚠',
|
|
117
|
+
risky: '⚠⚠',
|
|
118
|
+
};
|
|
119
|
+
output += `${capabilityIcons[assessment.capability]} ${assessment.operation}\n`;
|
|
120
|
+
output += `Confidence: ${(assessment.confidence * 100).toFixed(0)}%\n\n`;
|
|
121
|
+
if (assessment.limitations.length > 0) {
|
|
122
|
+
output += `Limitations:\n`;
|
|
123
|
+
for (const limitation of assessment.limitations) {
|
|
124
|
+
output += ` • ${limitation}\n`;
|
|
125
|
+
}
|
|
126
|
+
output += '\n';
|
|
127
|
+
}
|
|
128
|
+
if (assessment.warnings.length > 0) {
|
|
129
|
+
output += `Warnings:\n`;
|
|
130
|
+
for (const warning of assessment.warnings) {
|
|
131
|
+
output += ` ⚠ ${warning}\n`;
|
|
132
|
+
}
|
|
133
|
+
output += '\n';
|
|
134
|
+
}
|
|
135
|
+
if (assessment.recommendedApproach) {
|
|
136
|
+
output += `Recommended: ${assessment.recommendedApproach}\n`;
|
|
137
|
+
}
|
|
138
|
+
if (!assessment.canProceed) {
|
|
139
|
+
output += `\n⚠️ This operation requires human review before proceeding.\n`;
|
|
140
|
+
}
|
|
141
|
+
return output;
|
|
142
|
+
}
|
|
143
|
+
// Private helpers
|
|
144
|
+
initializeDefaultMessages() {
|
|
145
|
+
// General disclaimer
|
|
146
|
+
this.registerMessage({
|
|
147
|
+
type: 'disclaimer',
|
|
148
|
+
operation: 'general',
|
|
149
|
+
message: 'AI-generated code may contain errors. Please review and test before deploying.',
|
|
150
|
+
severity: 'info',
|
|
151
|
+
showOnce: true,
|
|
152
|
+
});
|
|
153
|
+
// Security operations
|
|
154
|
+
this.registerMessage({
|
|
155
|
+
type: 'warning',
|
|
156
|
+
operation: 'security-sensitive',
|
|
157
|
+
message: 'Security-sensitive operations require careful manual review. The AI may not catch all vulnerabilities.',
|
|
158
|
+
severity: 'warning',
|
|
159
|
+
contextual: true,
|
|
160
|
+
});
|
|
161
|
+
// Critical operations
|
|
162
|
+
this.registerMessage({
|
|
163
|
+
type: 'warning',
|
|
164
|
+
operation: 'critical',
|
|
165
|
+
message: 'This is a high-risk operation. Human review is mandatory before proceeding.',
|
|
166
|
+
severity: 'error',
|
|
167
|
+
contextual: true,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
matchesContext(message, context) {
|
|
171
|
+
// Simple context matching logic
|
|
172
|
+
if (message.operation === 'security-sensitive' && context.domain === 'security') {
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
if (message.operation === 'critical' && context.riskLevel === 'critical') {
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
generateRecommendedApproach(capability, complexity, riskLevel) {
|
|
181
|
+
if (capability === 'risky' || riskLevel === 'critical') {
|
|
182
|
+
return 'Review generated code carefully, test thoroughly, and get human approval before deployment';
|
|
183
|
+
}
|
|
184
|
+
else if (capability === 'uncertain' || complexity === 'complex') {
|
|
185
|
+
return 'Review the generated code and test incrementally';
|
|
186
|
+
}
|
|
187
|
+
else if (capability === 'moderate') {
|
|
188
|
+
return 'Review the code before committing';
|
|
189
|
+
}
|
|
190
|
+
return undefined;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=expectation-management.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expectation-management.js","sourceRoot":"","sources":["../../../src/infrastructure/ux/expectation-management.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAwBH;;;GAGG;AACH,MAAM,OAAO,qBAAqB;IACxB,QAAQ,GAAoC,IAAI,GAAG,EAAE,CAAC;IACtD,aAAa,GAAgB,IAAI,GAAG,EAAE,CAAC,CAAC,uBAAuB;IAEvE;QACE,IAAI,CAAC,yBAAyB,EAAE,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,gBAAgB,CACd,SAAiB,EACjB,OAKC;QAED,MAAM,EAAE,UAAU,GAAG,UAAU,EAAE,MAAM,EAAE,WAAW,GAAG,GAAG,EAAE,SAAS,GAAG,QAAQ,EAAE,GAAG,OAAO,CAAC;QAE7F,IAAI,UAAU,GAAoB,UAAU,CAAC;QAC7C,IAAI,UAAU,GAAG,GAAG,CAAC;QACrB,MAAM,WAAW,GAAa,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAa,EAAE,CAAC;QAE9B,6BAA6B;QAC7B,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;YAC5B,UAAU,GAAG,WAAW,CAAC;YACzB,UAAU,GAAG,GAAG,CAAC;QACnB,CAAC;aAAM,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YACpC,UAAU,GAAG,WAAW,CAAC;YACzB,UAAU,GAAG,GAAG,CAAC;YACjB,WAAW,CAAC,IAAI,CAAC,oDAAoD,CAAC,CA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SAAS;YACf,SAAS,EAAE,UAAU;YACrB,OAAO,EAAE,6EAA6E;YACtF,QAAQ,EAAE,OAAO;YACjB,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;IACL,CAAC;IAEO,cAAc,CAAC,OAA2B,EAAE,OAA4B;QAC9E,gCAAgC;QAChC,IAAI,OAAO,CAAC,SAAS,KAAK,oBAAoB,IAAI,OAAO,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;YAChF,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,OAAO,CAAC,SAAS,KAAK,UAAU,IAAI,OAAO,CAAC,SAAS,KAAK,UAAU,EAAE,CAAC;YACzE,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAEO,2BAA2B,CACjC,UAA2B,EAC3B,UAAkB,EAClB,SAAwB;QAExB,IAAI,UAAU,KAAK,OAAO,IAAI,SAAS,KAAK,UAAU,EAAE,CAAC;YACvD,OAAO,4FAA4F,CAAC;QACtG,CAAC;aAAM,IAAI,UAAU,KAAK,WAAW,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAClE,OAAO,kDAAkD,CAAC;QAC5D,CAAC;aAAM,IAAI,UAAU,KAAK,UAAU,EAAE,CAAC;YACrC,OAAO,mCAAmC,CAAC;QAC7C,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure: Human-in-the-Loop (HITL) Validation System
|
|
3
|
+
*
|
|
4
|
+
* Architecturally embedded human intervention points for supervision and decision-making
|
|
5
|
+
* Research: Human-in-the-Loop (HITL) validation mandatory, prevents automation bias
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Mandatory validation checkpoints
|
|
9
|
+
* - Centralized review hub
|
|
10
|
+
* - Review queue management
|
|
11
|
+
* - Approval workflow
|
|
12
|
+
*/
|
|
13
|
+
export type ReviewStatus = 'pending' | 'approved' | 'rejected' | 'needs_changes' | 'cancelled';
|
|
14
|
+
export type ReviewPriority = 'low' | 'normal' | 'high' | 'critical';
|
|
15
|
+
export interface ReviewCheckpoint {
|
|
16
|
+
checkpointId: string;
|
|
17
|
+
operation: string;
|
|
18
|
+
description: string;
|
|
19
|
+
priority: ReviewPriority;
|
|
20
|
+
status: ReviewStatus;
|
|
21
|
+
createdAt: number;
|
|
22
|
+
reviewedAt?: number;
|
|
23
|
+
reviewedBy?: string;
|
|
24
|
+
changes: {
|
|
25
|
+
type: 'edit' | 'create' | 'delete' | 'move' | 'refactor';
|
|
26
|
+
filepath?: string;
|
|
27
|
+
diff?: string;
|
|
28
|
+
summary: string;
|
|
29
|
+
}[];
|
|
30
|
+
context: {
|
|
31
|
+
query: string;
|
|
32
|
+
riskLevel: 'low' | 'medium' | 'high' | 'critical';
|
|
33
|
+
uncertainty?: number;
|
|
34
|
+
securityFindings?: any[];
|
|
35
|
+
licenseFindings?: any[];
|
|
36
|
+
};
|
|
37
|
+
metadata: {
|
|
38
|
+
sessionId?: string;
|
|
39
|
+
userId?: string;
|
|
40
|
+
decisionTreeId?: string;
|
|
41
|
+
lineageId?: string;
|
|
42
|
+
[key: string]: any;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export interface ReviewDecision {
|
|
46
|
+
checkpointId: string;
|
|
47
|
+
decision: 'approve' | 'reject' | 'request_changes';
|
|
48
|
+
reviewer: string;
|
|
49
|
+
comment?: string;
|
|
50
|
+
timestamp: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Human-in-the-Loop Validation System
|
|
54
|
+
* Manages mandatory validation checkpoints for critical operations
|
|
55
|
+
*/
|
|
56
|
+
export declare class HITLValidation {
|
|
57
|
+
private checkpoints;
|
|
58
|
+
private reviewQueue;
|
|
59
|
+
/**
|
|
60
|
+
* Create review checkpoint
|
|
61
|
+
*/
|
|
62
|
+
createCheckpoint(operation: string, changes: ReviewCheckpoint['changes'], context: ReviewCheckpoint['context'], metadata?: ReviewCheckpoint['metadata']): ReviewCheckpoint;
|
|
63
|
+
/**
|
|
64
|
+
* Check if operation requires HITL validation
|
|
65
|
+
*/
|
|
66
|
+
requiresValidation(context: {
|
|
67
|
+
riskLevel: 'low' | 'medium' | 'high' | 'critical';
|
|
68
|
+
isDestructive?: boolean;
|
|
69
|
+
modifiesSecuritySensitiveCode?: boolean;
|
|
70
|
+
affectsMultipleFiles?: boolean;
|
|
71
|
+
uncertainty?: number;
|
|
72
|
+
}): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Get next checkpoint in review queue
|
|
75
|
+
*/
|
|
76
|
+
getNextCheckpoint(): ReviewCheckpoint | null;
|
|
77
|
+
/**
|
|
78
|
+
* Submit review decision
|
|
79
|
+
*/
|
|
80
|
+
submitDecision(decision: ReviewDecision): void;
|
|
81
|
+
/**
|
|
82
|
+
* Get checkpoint by ID
|
|
83
|
+
*/
|
|
84
|
+
getCheckpoint(checkpointId: string): ReviewCheckpoint | null;
|
|
85
|
+
/**
|
|
86
|
+
* Get all pending checkpoints
|
|
87
|
+
*/
|
|
88
|
+
getPendingCheckpoints(priority?: ReviewPriority): ReviewCheckpoint[];
|
|
89
|
+
/**
|
|
90
|
+
* Get review queue status
|
|
91
|
+
*/
|
|
92
|
+
getReviewQueueStatus(): {
|
|
93
|
+
total: number;
|
|
94
|
+
pending: number;
|
|
95
|
+
byPriority: Record<ReviewPriority, number>;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Format checkpoint for review
|
|
99
|
+
*/
|
|
100
|
+
formatCheckpoint(checkpoint: ReviewCheckpoint): string;
|
|
101
|
+
private addToReviewQueue;
|
|
102
|
+
private generateDescription;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=hitl-validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hitl-validation.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/ux/hitl-validation.ts"],"names":[],"m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