igel-qe-core 1.0.3 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +638 -54
- package/dist/cli/platform.js +115 -72
- package/dist/mcp/server.js +258 -17
- package/package.json +4 -4
- package/src/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/__pycache__/__init__.cpython-313.pyc +0 -0
- package/src/__pycache__/__init__.cpython-314.pyc +0 -0
- package/src/agents/__init__.py +3 -0
- package/src/agents/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/agents/__pycache__/__init__.cpython-313.pyc +0 -0
- package/src/agents/__pycache__/__init__.cpython-314.pyc +0 -0
- package/src/agents/__pycache__/automation_design_agent.cpython-311.pyc +0 -0
- package/src/agents/__pycache__/automation_design_agent.cpython-313.pyc +0 -0
- package/src/agents/__pycache__/automation_design_agent.cpython-314.pyc +0 -0
- package/src/agents/__pycache__/code_intelligence_agent.cpython-311.pyc +0 -0
- package/src/agents/__pycache__/code_intelligence_agent.cpython-313.pyc +0 -0
- package/src/agents/__pycache__/confidence_agent.cpython-311.pyc +0 -0
- package/src/agents/__pycache__/confidence_agent.cpython-313.pyc +0 -0
- package/src/agents/__pycache__/confidence_agent.cpython-314.pyc +0 -0
- package/src/agents/__pycache__/execution_validation_agent.cpython-311.pyc +0 -0
- package/src/agents/__pycache__/execution_validation_agent.cpython-313.pyc +0 -0
- package/src/agents/__pycache__/execution_validation_agent.cpython-314.pyc +0 -0
- package/src/agents/__pycache__/framework_analyzer_agent.cpython-311.pyc +0 -0
- package/src/agents/__pycache__/framework_analyzer_agent.cpython-313.pyc +0 -0
- package/src/agents/__pycache__/fusion_agent.cpython-314.pyc +0 -0
- package/src/agents/__pycache__/graph.cpython-314.pyc +0 -0
- package/src/agents/__pycache__/intent_agent.cpython-313.pyc +0 -0
- package/src/agents/__pycache__/intent_agent.cpython-314.pyc +0 -0
- package/src/agents/__pycache__/kg_agent.cpython-314.pyc +0 -0
- package/src/agents/__pycache__/memory_agent.cpython-314.pyc +0 -0
- package/src/agents/__pycache__/reflection_agent.cpython-314.pyc +0 -0
- package/src/agents/__pycache__/regression_agent.cpython-311.pyc +0 -0
- package/src/agents/__pycache__/regression_agent.cpython-313.pyc +0 -0
- package/src/agents/__pycache__/requirement_agent.cpython-311.pyc +0 -0
- package/src/agents/__pycache__/requirement_agent.cpython-313.pyc +0 -0
- package/src/agents/__pycache__/requirement_agent.cpython-314.pyc +0 -0
- package/src/agents/__pycache__/retrieval_agent.cpython-314.pyc +0 -0
- package/src/agents/__pycache__/scenario_agent.cpython-311.pyc +0 -0
- package/src/agents/__pycache__/scenario_agent.cpython-313.pyc +0 -0
- package/src/agents/__pycache__/scenario_agent.cpython-314.pyc +0 -0
- package/src/agents/__pycache__/script_agent.cpython-314.pyc +0 -0
- package/src/agents/__pycache__/script_generator_agent.cpython-311.pyc +0 -0
- package/src/agents/__pycache__/script_generator_agent.cpython-313.pyc +0 -0
- package/src/agents/__pycache__/script_generator_agent.cpython-314.pyc +0 -0
- package/src/agents/__pycache__/state.cpython-314.pyc +0 -0
- package/src/agents/__pycache__/temporal_agent.cpython-314.pyc +0 -0
- package/src/agents/__pycache__/testcase_agent.cpython-311.pyc +0 -0
- package/src/agents/__pycache__/testcase_agent.cpython-313.pyc +0 -0
- package/src/agents/__pycache__/testcase_agent.cpython-314.pyc +0 -0
- package/src/agents/__pycache__/validation_agent.cpython-311.pyc +0 -0
- package/src/agents/__pycache__/validation_agent.cpython-313.pyc +0 -0
- package/src/agents/__pycache__/validation_agent.cpython-314.pyc +0 -0
- package/src/agents/__pycache__/workflow_engine.cpython-311.pyc +0 -0
- package/src/agents/__pycache__/workflow_engine.cpython-313.pyc +0 -0
- package/src/agents/__pycache__/workflow_engine.cpython-314.pyc +0 -0
- package/{knowledge_base → src}/agents/automation_design_agent.py +14 -17
- package/{knowledge_base → src}/agents/code_intelligence_agent.py +2 -2
- package/src/agents/confidence_agent.py +114 -0
- package/{knowledge_base → src}/agents/execution_validation_agent.py +1 -1
- package/src/agents/feedback_agent.py +89 -0
- package/src/agents/framework_analyzer_agent.py +43 -0
- package/{knowledge_base → src}/agents/fusion_agent.py +3 -3
- package/{knowledge_base → src}/agents/graph.py +10 -10
- package/{knowledge_base → src}/agents/healing_agent.py +4 -4
- package/src/agents/intent_agent.py +30 -0
- package/src/agents/internal/__init__.py +3 -0
- package/src/agents/internal/__pycache__/__init__.cpython-313.pyc +0 -0
- package/src/agents/internal/__pycache__/approval_manager.cpython-313.pyc +0 -0
- package/src/agents/internal/__pycache__/question_engine.cpython-313.pyc +0 -0
- package/src/agents/internal/approval_manager.py +111 -0
- package/src/agents/internal/question_engine.py +111 -0
- package/src/agents/internal/workflow_engine.py +28 -0
- package/{knowledge_base → src}/agents/kg_agent.py +3 -3
- package/{knowledge_base → src}/agents/memory_agent.py +4 -4
- package/src/agents/orchestrator/__init__.py +3 -0
- package/src/agents/orchestrator/__pycache__/__init__.cpython-313.pyc +0 -0
- package/src/agents/orchestrator/__pycache__/orchestrator.cpython-313.pyc +0 -0
- package/src/agents/orchestrator/orchestrator.py +63 -0
- package/{knowledge_base → src}/agents/rca_agent.py +4 -4
- package/{knowledge_base → src}/agents/reflection_agent.py +1 -1
- package/{knowledge_base → src}/agents/regression_agent.py +2 -2
- package/src/agents/requirement_agent.py +97 -0
- package/{knowledge_base → src}/agents/retrieval_agent.py +2 -2
- package/{knowledge_base → src}/agents/scenario_agent.py +11 -17
- package/{knowledge_base → src}/agents/script_agent.py +6 -6
- package/{knowledge_base → src}/agents/script_generator_agent.py +12 -10
- package/{knowledge_base → src}/agents/temporal_agent.py +3 -3
- package/src/agents/testcase_agent.py +163 -0
- package/{knowledge_base → src}/agents/validation_agent.py +1 -1
- package/src/agents/workflow_engine.py +109 -0
- package/{knowledge_base → src}/alembic/README.md +4 -4
- package/{knowledge_base → src}/alembic/env.py +1 -1
- package/{knowledge_base → src}/alembic/script.py.mako +1 -1
- package/{knowledge_base → src}/api/middleware.py +3 -3
- package/{knowledge_base → src}/api/server.py +28 -28
- package/{knowledge_base → src}/chunking/chunker.py +3 -3
- package/src/cli/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/cli/__pycache__/__init__.cpython-313.pyc +0 -0
- package/src/cli/__pycache__/__init__.cpython-314.pyc +0 -0
- package/src/cli/__pycache__/workflow_cli.cpython-311.pyc +0 -0
- package/src/cli/__pycache__/workflow_cli.cpython-313.pyc +0 -0
- package/src/cli/__pycache__/workflow_cli.cpython-314.pyc +0 -0
- package/{knowledge_base → src}/cli/feedback_cli.py +10 -10
- package/{knowledge_base → src}/cli/generate.py +11 -11
- package/src/cli/index.ts +704 -0
- package/src/cli/platform.ts +147 -0
- package/src/cli/workflow_cli.py +930 -0
- package/{knowledge_base → src}/config/__init__.py +1 -1
- package/src/config/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/config/__pycache__/__init__.cpython-313.pyc +0 -0
- package/src/config/__pycache__/__init__.cpython-314.pyc +0 -0
- package/src/config/__pycache__/policy_config.cpython-311.pyc +0 -0
- package/src/config/__pycache__/policy_config.cpython-313.pyc +0 -0
- package/src/config/__pycache__/settings.cpython-311.pyc +0 -0
- package/src/config/__pycache__/settings.cpython-313.pyc +0 -0
- package/src/config/__pycache__/settings.cpython-314.pyc +0 -0
- package/src/config/policy_config.py +85 -0
- package/src/config/policy_rules.yaml +50 -0
- package/{knowledge_base → src}/config/settings.py +51 -6
- package/{knowledge_base → src}/connectors/__init__.py +1 -1
- package/src/connectors/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/connectors/__pycache__/__init__.cpython-313.pyc +0 -0
- package/src/connectors/__pycache__/__init__.cpython-314.pyc +0 -0
- package/src/connectors/__pycache__/base.cpython-311.pyc +0 -0
- package/src/connectors/__pycache__/base.cpython-313.pyc +0 -0
- package/src/connectors/__pycache__/base.cpython-314.pyc +0 -0
- package/src/connectors/__pycache__/jira_connector.cpython-311.pyc +0 -0
- package/src/connectors/__pycache__/jira_connector.cpython-313.pyc +0 -0
- package/src/connectors/__pycache__/jira_connector.cpython-314.pyc +0 -0
- package/src/connectors/__pycache__/query_bridge.cpython-313.pyc +0 -0
- package/src/connectors/__pycache__/query_bridge.cpython-314.pyc +0 -0
- package/src/connectors/bitbucket_connector.py +334 -0
- package/{knowledge_base → src}/connectors/community_connector.py +6 -6
- package/{knowledge_base → src}/connectors/confluence_connector.py +4 -4
- package/{knowledge_base → src}/connectors/jira_connector.py +7 -11
- package/{knowledge_base → src}/connectors/kb_igel_connector.py +6 -6
- package/{knowledge_base → src}/connectors/query_bridge.py +11 -11
- package/{knowledge_base → src}/connectors/search_backends.py +1 -1
- package/{knowledge_base → src}/connectors/serviceNow_connector.py +2 -2
- package/{knowledge_base → src}/connectors/sync_scheduler.py +12 -10
- package/{knowledge_base → src}/connectors/teamcity_connector.py +2 -2
- package/{knowledge_base → src}/connectors/testRail_connector.py +2 -2
- package/{knowledge_base → src}/connectors/web_fetcher.py +1 -1
- package/src/connectors/xray_connector.py +337 -0
- package/{knowledge_base → src}/core/__init__.py +1 -1
- package/src/core/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/core/__pycache__/__init__.cpython-313.pyc +0 -0
- package/src/core/__pycache__/__init__.cpython-314.pyc +0 -0
- package/src/core/__pycache__/circuit_breaker.cpython-313.pyc +0 -0
- package/src/core/__pycache__/circuit_breaker.cpython-314.pyc +0 -0
- package/src/core/__pycache__/confidence.cpython-311.pyc +0 -0
- package/src/core/__pycache__/confidence.cpython-313.pyc +0 -0
- package/src/core/__pycache__/confidence.cpython-314.pyc +0 -0
- package/src/core/__pycache__/context_engine.cpython-311.pyc +0 -0
- package/src/core/__pycache__/context_engine.cpython-313.pyc +0 -0
- package/src/core/__pycache__/evidence_resolver.cpython-311.pyc +0 -0
- package/src/core/__pycache__/evidence_resolver.cpython-313.pyc +0 -0
- package/src/core/__pycache__/guardrails.cpython-311.pyc +0 -0
- package/src/core/__pycache__/guardrails.cpython-313.pyc +0 -0
- package/src/core/__pycache__/hooks.cpython-311.pyc +0 -0
- package/src/core/__pycache__/hooks.cpython-313.pyc +0 -0
- package/src/core/__pycache__/intent_service.cpython-313.pyc +0 -0
- package/src/core/__pycache__/llm_executor.cpython-311.pyc +0 -0
- package/src/core/__pycache__/llm_executor.cpython-313.pyc +0 -0
- package/src/core/__pycache__/model_router.cpython-311.pyc +0 -0
- package/src/core/__pycache__/model_router.cpython-313.pyc +0 -0
- package/src/core/__pycache__/orchestration_contracts.cpython-311.pyc +0 -0
- package/src/core/__pycache__/orchestration_contracts.cpython-313.pyc +0 -0
- package/src/core/__pycache__/precedence.cpython-311.pyc +0 -0
- package/src/core/__pycache__/precedence.cpython-313.pyc +0 -0
- package/src/core/__pycache__/prompt_builder.cpython-311.pyc +0 -0
- package/src/core/__pycache__/prompt_builder.cpython-313.pyc +0 -0
- package/src/core/__pycache__/prompt_policy_engine.cpython-311.pyc +0 -0
- package/src/core/__pycache__/prompt_policy_engine.cpython-313.pyc +0 -0
- package/{knowledge_base → src}/core/cache.py +2 -2
- package/{knowledge_base → src}/core/confidence.py +2 -2
- package/src/core/context_engine.py +138 -0
- package/src/core/evidence_resolver.py +72 -0
- package/src/core/guardrails.py +22 -0
- package/src/core/hooks.py +57 -0
- package/src/core/intent_service.py +74 -0
- package/src/core/llm_executor.py +138 -0
- package/{knowledge_base → src}/core/logging_setup.py +1 -1
- package/src/core/model_router.py +246 -0
- package/src/core/orchestration_contracts.py +66 -0
- package/src/core/persistence_engine.py +159 -0
- package/src/core/prompt_builder.py +49 -0
- package/src/core/prompt_policy_engine.py +35 -0
- package/src/core/traceability_engine.py +56 -0
- package/src/db/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/db/__pycache__/__init__.cpython-313.pyc +0 -0
- package/src/db/__pycache__/__init__.cpython-314.pyc +0 -0
- package/src/db/__pycache__/client.cpython-311.pyc +0 -0
- package/src/db/__pycache__/client.cpython-313.pyc +0 -0
- package/src/db/__pycache__/client.cpython-314.pyc +0 -0
- package/src/db/__pycache__/igel_schema.cpython-311.pyc +0 -0
- package/src/db/__pycache__/igel_schema.cpython-313.pyc +0 -0
- package/src/db/__pycache__/igel_schema.cpython-314.pyc +0 -0
- package/src/db/__pycache__/kg_introspect.cpython-311.pyc +0 -0
- package/src/db/__pycache__/kg_introspect.cpython-313.pyc +0 -0
- package/{knowledge_base → src}/db/__pycache__/kg_introspect.cpython-314.pyc +0 -0
- package/{knowledge_base → src}/db/client.py +1 -1
- package/{knowledge_base → src}/db/connector_sync.py +1 -1
- package/{knowledge_base → src}/db/feedback_schema.py +2 -2
- package/{knowledge_base → src}/db/igel_schema.py +29 -4
- package/{knowledge_base → src}/db/kg_introspect.py +1 -1
- package/src/db/migrations.py +237 -0
- package/{knowledge_base → src}/db/schema.py +6 -6
- package/{knowledge_base → src}/deploy/Dockerfile +3 -3
- package/{knowledge_base → src}/deploy/feedback_automation.sh +3 -3
- package/{knowledge_base → src}/deploy/firecrawl-docker.sh +4 -4
- package/{knowledge_base → src}/deploy/igel-testgen.service +2 -2
- package/{knowledge_base → src}/deploy/install_reranker.sh +1 -1
- package/{knowledge_base → src}/deploy/requirements.txt +1 -2
- package/{knowledge_base → src}/deploy/run_server.sh +1 -1
- package/{knowledge_base → src}/docs/TEST_GENERATION_GUIDE.md +15 -15
- package/src/embeddings/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/embeddings/__pycache__/__init__.cpython-313.pyc +0 -0
- package/src/embeddings/__pycache__/__init__.cpython-314.pyc +0 -0
- package/src/embeddings/__pycache__/azure_embedder.cpython-311.pyc +0 -0
- package/src/embeddings/__pycache__/azure_embedder.cpython-313.pyc +0 -0
- package/{knowledge_base → src}/embeddings/__pycache__/azure_embedder.cpython-314.pyc +0 -0
- package/{knowledge_base → src}/embeddings/azure_embedder.py +10 -1
- package/{knowledge_base → src}/eval/__init__.py +3 -3
- package/{knowledge_base → src}/eval/__main__.py +7 -7
- package/src/eval/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/eval/__pycache__/__init__.cpython-313.pyc +0 -0
- package/src/eval/__pycache__/__init__.cpython-314.pyc +0 -0
- package/src/eval/__pycache__/baseline.cpython-311.pyc +0 -0
- package/src/eval/__pycache__/baseline.cpython-313.pyc +0 -0
- package/src/eval/__pycache__/baseline.cpython-314.pyc +0 -0
- package/src/eval/__pycache__/harness.cpython-311.pyc +0 -0
- package/src/eval/__pycache__/harness.cpython-313.pyc +0 -0
- package/src/eval/__pycache__/harness.cpython-314.pyc +0 -0
- package/src/eval/__pycache__/scorers.cpython-311.pyc +0 -0
- package/src/eval/__pycache__/scorers.cpython-313.pyc +0 -0
- package/src/eval/__pycache__/scorers.cpython-314.pyc +0 -0
- package/{knowledge_base → src}/eval/harness.py +6 -6
- package/{knowledge_base → src}/feedback/__init__.py +1 -1
- package/{knowledge_base → src}/feedback/analytics.py +1 -1
- package/{knowledge_base → src}/feedback/applier.py +4 -4
- package/{knowledge_base → src}/feedback/curator.py +2 -2
- package/{knowledge_base → src}/feedback/handler.py +1 -1
- package/src/generation/__pycache__/__init__.cpython-313.pyc +0 -0
- package/src/generation/__pycache__/__init__.cpython-314.pyc +0 -0
- package/src/generation/__pycache__/input_classifier.cpython-313.pyc +0 -0
- package/src/generation/__pycache__/manual_tc_parser.cpython-313.pyc +0 -0
- package/src/generation/__pycache__/prompts.cpython-313.pyc +0 -0
- package/src/generation/__pycache__/prompts.cpython-314.pyc +0 -0
- package/src/generation/__pycache__/test_generator.cpython-313.pyc +0 -0
- package/src/generation/__pycache__/test_generator.cpython-314.pyc +0 -0
- package/{knowledge_base → src}/generation/input_classifier.py +1 -1
- package/{knowledge_base → src}/generation/prompts.py +1 -1
- package/{knowledge_base → src}/generation/tc_transformer.py +10 -10
- package/{knowledge_base → src}/generation/test_generator.py +56 -10
- package/{knowledge_base → src}/graph_db/__init__.py +1 -1
- package/{knowledge_base → src}/graph_db/graphiti_client.py +2 -2
- package/{knowledge_base → src}/graph_db/kg_traversal.py +3 -3
- package/{knowledge_base → src}/graph_db/migrate_kg.py +4 -4
- package/{knowledge_base → src}/graph_db/neo4j_client.py +1 -1
- package/{knowledge_base → src}/graph_db/temporal_ingest.py +1 -1
- package/{knowledge_base → src}/ingestion/kg_extractor.py +6 -6
- package/{knowledge_base → src}/ingestion/web_ingest.py +6 -6
- package/src/intelligence/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/intelligence/__pycache__/__init__.cpython-313.pyc +0 -0
- package/src/intelligence/__pycache__/diff_analyzer.cpython-311.pyc +0 -0
- package/src/intelligence/__pycache__/diff_analyzer.cpython-313.pyc +0 -0
- package/src/intelligence/__pycache__/routing_engine.cpython-311.pyc +0 -0
- package/src/intelligence/__pycache__/routing_engine.cpython-313.pyc +0 -0
- package/src/intelligence/diff_analyzer.py +109 -0
- package/{knowledge_base → src}/intelligence/execution_ingest.py +3 -3
- package/src/intelligence/routing_engine.py +74 -0
- package/src/mcp/server.ts +384 -0
- package/src/memory/__init__.py +6 -0
- package/src/memory/__pycache__/__init__.cpython-314.pyc +0 -0
- package/src/memory/__pycache__/cognee_client.cpython-314.pyc +0 -0
- package/src/memory/__pycache__/memory_types.cpython-314.pyc +0 -0
- package/{knowledge_base → src}/memory/cognee_client.py +3 -3
- package/src/models/__pycache__/test_requirement.cpython-311.pyc +0 -0
- package/src/models/__pycache__/test_requirement.cpython-313.pyc +0 -0
- package/src/models/__pycache__/test_requirement.cpython-314.pyc +0 -0
- package/{knowledge_base → src}/models/test_requirement.py +12 -7
- package/{knowledge_base → src}/parsers/csv_parser.py +1 -1
- package/{knowledge_base → src}/parsers/doc_parser.py +1 -1
- package/{knowledge_base → src}/parsers/html_parser.py +1 -1
- package/{knowledge_base → src}/parsers/pdf_parser.py +1 -1
- package/src/project/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/project/__pycache__/__init__.cpython-313.pyc +0 -0
- package/src/project/__pycache__/ai_folder.cpython-311.pyc +0 -0
- package/src/project/__pycache__/ai_folder.cpython-313.pyc +0 -0
- package/src/project/__pycache__/context_enricher.cpython-313.pyc +0 -0
- package/src/project/__pycache__/context_projection_builder.cpython-311.pyc +0 -0
- package/src/project/__pycache__/context_projection_builder.cpython-313.pyc +0 -0
- package/src/project/__pycache__/context_requirement_sync.cpython-311.pyc +0 -0
- package/src/project/__pycache__/context_requirement_sync.cpython-313.pyc +0 -0
- package/src/project/ai_folder.py +602 -0
- package/src/project/context_enricher.py +333 -0
- package/src/project/context_projection_builder.py +167 -0
- package/src/project/context_requirement_sync.py +205 -0
- package/src/project/init_check.py +214 -0
- package/src/prompts/__pycache__/prompt_loader.cpython-313.pyc +0 -0
- package/src/prompts/automation_design.md +12 -0
- package/src/prompts/policies/automation_generation_policy.md +11 -0
- package/src/prompts/policies/generation_instructions.md +24 -0
- package/src/prompts/policies/guardrails.md +6 -0
- package/src/prompts/policies/traceability_policy.md +9 -0
- package/src/prompts/prompt_loader.py +56 -0
- package/src/prompts/requirement_understanding.md +17 -0
- package/src/prompts/scenario_generator.md +17 -0
- package/src/prompts/script_generator.md +13 -0
- package/src/prompts/test_case_generator.md +23 -0
- package/src/retrieval/__pycache__/__init__.cpython-311.pyc +0 -0
- package/src/retrieval/__pycache__/__init__.cpython-313.pyc +0 -0
- package/src/retrieval/__pycache__/__init__.cpython-314.pyc +0 -0
- package/src/retrieval/__pycache__/knowledge_graph.cpython-311.pyc +0 -0
- package/src/retrieval/__pycache__/knowledge_graph.cpython-313.pyc +0 -0
- package/src/retrieval/__pycache__/knowledge_graph.cpython-314.pyc +0 -0
- package/src/retrieval/__pycache__/retriever.cpython-311.pyc +0 -0
- package/src/retrieval/__pycache__/retriever.cpython-313.pyc +0 -0
- package/src/retrieval/__pycache__/retriever.cpython-314.pyc +0 -0
- package/src/retrieval/__pycache__/unified_query.cpython-313.pyc +0 -0
- package/src/retrieval/__pycache__/unified_query.cpython-314.pyc +0 -0
- package/{knowledge_base → src}/retrieval/context_fusion.py +3 -3
- package/{knowledge_base → src}/retrieval/knowledge_graph.py +4 -4
- package/{knowledge_base → src}/retrieval/reranker.py +2 -2
- package/{knowledge_base → src}/retrieval/retriever.py +11 -11
- package/{knowledge_base → src}/retrieval/unified_query.py +7 -7
- package/{knowledge_base → src}/retrieval/web_retriever.py +6 -6
- package/{knowledge_base → src}/validators/step_fidelity.py +1 -1
- package/src/vision/__init__.py +0 -0
- package/{knowledge_base → src}/vision/image_describer.py +1 -1
- package/knowledge_base/__pycache__/__init__.cpython-314.pyc +0 -0
- package/knowledge_base/agents/__init__.py +0 -6
- package/knowledge_base/agents/confidence_agent.py +0 -94
- package/knowledge_base/agents/feedback_agent.py +0 -56
- package/knowledge_base/agents/intent_agent.py +0 -76
- package/knowledge_base/agents/requirement_agent.py +0 -71
- package/knowledge_base/agents/testcase_agent.py +0 -111
- package/knowledge_base/agents/workflow_engine.py +0 -87
- package/knowledge_base/cli/generate_qcapps134.py +0 -391
- package/knowledge_base/cli/workflow_cli.py +0 -93
- package/knowledge_base/config/.env +0 -100
- package/knowledge_base/config/.env.example +0 -75
- package/knowledge_base/connectors/bitbucket_connector.py +0 -25
- package/knowledge_base/db/__pycache__/__init__.cpython-314.pyc +0 -0
- package/knowledge_base/db/__pycache__/client.cpython-314.pyc +0 -0
- package/knowledge_base/db/migrations.py +0 -22
- package/knowledge_base/embeddings/__pycache__/__init__.cpython-314.pyc +0 -0
- package/knowledge_base/ingestion/ingest.py +0 -346
- package/knowledge_base/ingestion/ingest_images.py +0 -330
- package/knowledge_base/memory/__init__.py +0 -6
- package/knowledge_base/memory/ingest_memory.py +0 -60
- /package/{knowledge_base → src}/__init__.py +0 -0
- /package/{knowledge_base → src}/__pycache__/__init__.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/__init__.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/confidence.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/config.cpython-314.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/config.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/config.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/context_fusion.cpython-314.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/context_fusion.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/feedback_analytics.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/feedback_applier.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/feedback_cli.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/feedback_curator.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/feedback_handler.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/generate.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/generate_qcapps134.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/input_classifier.cpython-314.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/input_classifier.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/kg_extractor.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/knowledge_graph.cpython-314.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/knowledge_graph.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/manual_tc_parser.cpython-314.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/manual_tc_parser.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/precedence.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/prompts.cpython-314.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/prompts.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/reranker.cpython-314.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/reranker.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/retrieval_debug.cpython-314.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/retrieval_debug.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/retriever.cpython-314.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/retriever.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/server.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/tc_transformer.cpython-314.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/tc_transformer.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/test_generator.cpython-314.pyc +0 -0
- /package/{knowledge_base → src}/__pycache__/test_generator.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/__init__.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/__init__.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/fusion_agent.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/fusion_agent.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/graph.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/graph.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/healing_agent.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/intent_agent.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/intent_agent.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/kg_agent.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/kg_agent.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/memory_agent.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/memory_agent.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/rca_agent.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/reflection_agent.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/reflection_agent.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/regression_agent.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/retrieval_agent.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/retrieval_agent.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/script_agent.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/script_agent.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/state.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/state.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/temporal_agent.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/temporal_agent.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/validation_agent.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/agents/__pycache__/validation_agent.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/agents/state.py +0 -0
- /package/{knowledge_base → src}/alembic/__pycache__/env.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/alembic/__pycache__/env.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/alembic/versions/.gitkeep +0 -0
- /package/{knowledge_base → src}/alembic/versions/001_phase0_feedback.py +0 -0
- /package/{knowledge_base → src}/alembic/versions/002_feedback_promotions.py +0 -0
- /package/{knowledge_base → src}/alembic/versions/003_enterprise_hardening.py +0 -0
- /package/{knowledge_base → src}/alembic/versions/__pycache__/001_phase0_feedback.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/alembic/versions/__pycache__/001_phase0_feedback.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/alembic/versions/__pycache__/002_feedback_promotions.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/alembic/versions/__pycache__/002_feedback_promotions.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/api/__init__.py +0 -0
- /package/{knowledge_base → src}/api/__pycache__/__init__.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/api/__pycache__/__init__.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/api/__pycache__/middleware.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/api/__pycache__/server.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/api/__pycache__/server.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/chunking/__init__.py +0 -0
- /package/{knowledge_base → src}/chunking/__pycache__/__init__.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/chunking/__pycache__/__init__.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/chunking/__pycache__/chunker.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/chunking/__pycache__/chunker.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/chunking/__pycache__/validators.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/chunking/__pycache__/validators.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/chunking/validators.py +0 -0
- /package/{knowledge_base → src}/cli/__init__.py +0 -0
- /package/{knowledge_base → src}/cli/__pycache__/__init__.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/cli/__pycache__/__init__.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/cli/__pycache__/feedback_cli.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/cli/__pycache__/feedback_cli.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/cli/__pycache__/generate.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/cli/__pycache__/generate.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/cli/__pycache__/generate_qcapps134.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/config/__pycache__/__init__.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/config/__pycache__/__init__.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/config/__pycache__/settings.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/config/__pycache__/settings.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/__init__.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/__init__.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/base.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/base.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/bitbucket_connector.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/bitbucket_connector.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/community_connector.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/confluence_connector.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/confluence_connector.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/jira_connector.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/jira_connector.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/kb_igel_connector.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/playwright_fetcher.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/query_bridge.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/search_backends.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/serviceNow_connector.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/serviceNow_connector.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/sync_scheduler.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/sync_scheduler.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/teamcity_connector.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/teamcity_connector.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/testRail_connector.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/testRail_connector.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/connectors/__pycache__/web_fetcher.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/connectors/base.py +0 -0
- /package/{knowledge_base → src}/connectors/playwright_fetcher.py +0 -0
- /package/{knowledge_base → src}/core/__pycache__/__init__.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/core/__pycache__/__init__.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/core/__pycache__/cache.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/core/__pycache__/circuit_breaker.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/core/__pycache__/confidence.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/core/__pycache__/confidence.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/core/__pycache__/logging_setup.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/core/__pycache__/metrics.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/core/__pycache__/precedence.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/core/__pycache__/precedence.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/core/__pycache__/request_context.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/core/circuit_breaker.py +0 -0
- /package/{knowledge_base → src}/core/metrics.py +0 -0
- /package/{knowledge_base → src}/core/precedence.py +0 -0
- /package/{knowledge_base → src}/core/request_context.py +0 -0
- /package/{knowledge_base → src}/db/__init__.py +0 -0
- /package/{knowledge_base → src}/db/__pycache__/__init__.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/db/__pycache__/__init__.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/db/__pycache__/client.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/db/__pycache__/client.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/db/__pycache__/connector_sync.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/db/__pycache__/feedback_schema.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/db/__pycache__/feedback_schema.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/db/__pycache__/kg_introspect.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/db/__pycache__/kg_introspect.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/db/__pycache__/schema.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/db/__pycache__/schema.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/embeddings/__init__.py +0 -0
- /package/{knowledge_base → src}/embeddings/__pycache__/__init__.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/embeddings/__pycache__/__init__.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/embeddings/__pycache__/azure_embedder.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/embeddings/__pycache__/azure_embedder.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/eval/__pycache__/__init__.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/eval/__pycache__/__init__.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/eval/__pycache__/__main__.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/eval/__pycache__/baseline.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/eval/__pycache__/baseline.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/eval/__pycache__/harness.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/eval/__pycache__/harness.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/eval/__pycache__/scorers.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/eval/__pycache__/scorers.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/eval/baseline.py +0 -0
- /package/{knowledge_base → src}/eval/queries_50.json +0 -0
- /package/{knowledge_base → src}/eval/scorers.py +0 -0
- /package/{knowledge_base → src}/exemplars/README.md +0 -0
- /package/{knowledge_base → src}/exemplars/__pycache__/pytest_reference_snippet.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/exemplars/gold_manual_concise_snippet.md +0 -0
- /package/{knowledge_base → src}/exemplars/gold_manual_detailed_snippet.md +0 -0
- /package/{knowledge_base → src}/exemplars/pytest_reference_snippet.py +0 -0
- /package/{knowledge_base → src}/feedback/__pycache__/__init__.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/feedback/__pycache__/__init__.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/feedback/__pycache__/analytics.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/feedback/__pycache__/analytics.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/feedback/__pycache__/applier.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/feedback/__pycache__/applier.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/feedback/__pycache__/curator.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/feedback/__pycache__/curator.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/feedback/__pycache__/handler.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/feedback/__pycache__/handler.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/generation/__init__.py +0 -0
- /package/{knowledge_base → src}/generation/__pycache__/__init__.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/generation/__pycache__/__init__.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/generation/__pycache__/input_classifier.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/generation/__pycache__/input_classifier.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/generation/__pycache__/manual_tc_parser.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/generation/__pycache__/manual_tc_parser.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/generation/__pycache__/prompts.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/generation/__pycache__/prompts.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/generation/__pycache__/tc_transformer.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/generation/__pycache__/test_generator.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/generation/__pycache__/test_generator.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/generation/manual_tc_parser.py +0 -0
- /package/{knowledge_base → src}/graph_db/__pycache__/__init__.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/graph_db/__pycache__/__init__.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/graph_db/__pycache__/graphiti_client.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/graph_db/__pycache__/kg_traversal.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/graph_db/__pycache__/migrate_kg.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/graph_db/__pycache__/neo4j_client.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/graph_db/__pycache__/neo4j_client.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/graph_db/__pycache__/schema.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/graph_db/__pycache__/temporal_ingest.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/graph_db/schema.py +0 -0
- /package/{knowledge_base → src}/ingestion/__init__.py +0 -0
- /package/{knowledge_base → src}/ingestion/__pycache__/__init__.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/ingestion/__pycache__/__init__.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/ingestion/__pycache__/ingest.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/ingestion/__pycache__/ingest.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/ingestion/__pycache__/ingest_images.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/ingestion/__pycache__/ingest_images.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/ingestion/__pycache__/kg_extractor.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/ingestion/__pycache__/kg_extractor.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/ingestion/__pycache__/web_ingest.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/intelligence/__init__.py +0 -0
- /package/{knowledge_base → src}/intelligence/__pycache__/__init__.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/intelligence/__pycache__/execution_ingest.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/intelligence/__pycache__/predictive_engine.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/intelligence/__pycache__/risk_scorer.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/intelligence/predictive_engine.py +0 -0
- /package/{knowledge_base → src}/intelligence/risk_scorer.py +0 -0
- /package/{knowledge_base → src}/memory/__pycache__/__init__.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/memory/__pycache__/__init__.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/memory/__pycache__/cognee_client.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/memory/__pycache__/cognee_client.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/memory/__pycache__/ingest_memory.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/memory/__pycache__/memory_types.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/memory/__pycache__/memory_types.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/memory/memory_types.py +0 -0
- /package/{knowledge_base → src}/parsers/__init__.py +0 -0
- /package/{knowledge_base → src}/parsers/__pycache__/__init__.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/parsers/__pycache__/__init__.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/parsers/__pycache__/csv_parser.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/parsers/__pycache__/csv_parser.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/parsers/__pycache__/doc_parser.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/parsers/__pycache__/doc_parser.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/parsers/__pycache__/html_parser.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/parsers/__pycache__/image_extractor.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/parsers/__pycache__/image_extractor.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/parsers/__pycache__/markdown_parser.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/parsers/__pycache__/markdown_parser.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/parsers/__pycache__/pdf_parser.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/parsers/__pycache__/pdf_parser.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/parsers/image_extractor.py +0 -0
- /package/{knowledge_base → src}/parsers/markdown_parser.py +0 -0
- /package/{knowledge_base/vision → src/project}/__init__.py +0 -0
- /package/{knowledge_base → src}/retrieval/__init__.py +0 -0
- /package/{knowledge_base → src}/retrieval/__pycache__/__init__.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/retrieval/__pycache__/__init__.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/retrieval/__pycache__/context_fusion.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/retrieval/__pycache__/context_fusion.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/retrieval/__pycache__/knowledge_graph.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/retrieval/__pycache__/knowledge_graph.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/retrieval/__pycache__/reranker.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/retrieval/__pycache__/reranker.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/retrieval/__pycache__/retrieval_debug.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/retrieval/__pycache__/retrieval_debug.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/retrieval/__pycache__/retriever.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/retrieval/__pycache__/retriever.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/retrieval/__pycache__/unified_query.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/retrieval/__pycache__/web_retriever.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/retrieval/retrieval_debug.py +0 -0
- /package/{knowledge_base → src}/validators/__init__.py +0 -0
- /package/{knowledge_base → src}/validators/__pycache__/__init__.cpython-314.pyc +0 -0
- /package/{knowledge_base → src}/validators/__pycache__/__init__.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/validators/__pycache__/step_fidelity.cpython-314.pyc +0 -0
- /package/{knowledge_base → src}/validators/__pycache__/step_fidelity.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/vision/__pycache__/__init__.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/vision/__pycache__/__init__.cpython-38.pyc +0 -0
- /package/{knowledge_base → src}/vision/__pycache__/image_describer.cpython-37.pyc +0 -0
- /package/{knowledge_base → src}/vision/__pycache__/image_describer.cpython-38.pyc +0 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
"""model_router.py — Task-aware Azure OpenAI model selection.
|
|
2
|
+
|
|
3
|
+
Design:
|
|
4
|
+
- Each task type maps to a default ModelConfig defined at module load.
|
|
5
|
+
- At runtime the router reads igel_generation_history from DB to find the
|
|
6
|
+
model with the highest average quality_score for that task type.
|
|
7
|
+
- DB preferences are used as a "learned override" only when >= MIN_SAMPLES
|
|
8
|
+
observations are present for that task+model combination AND the learned
|
|
9
|
+
model's avg_quality exceeds the default model's assumed quality floor.
|
|
10
|
+
- On ANY error (DB unavailable, missing key) the router falls back to
|
|
11
|
+
cfg.AZURE_DEPLOYMENT silently.
|
|
12
|
+
- The router intentionally does NOT read .ai/system/model_preferences.json;
|
|
13
|
+
the DB is always authoritative. model_preferences.json is only a display cache.
|
|
14
|
+
|
|
15
|
+
Canary deployment:
|
|
16
|
+
Only TestCaseAgent wires into this router in the first sprint.
|
|
17
|
+
Other agents keep using cfg.AZURE_DEPLOYMENT directly until quality_score
|
|
18
|
+
data is confirmed stable.
|
|
19
|
+
"""
|
|
20
|
+
from __future__ import annotations
|
|
21
|
+
|
|
22
|
+
import logging
|
|
23
|
+
from dataclasses import dataclass, field
|
|
24
|
+
from typing import Optional
|
|
25
|
+
|
|
26
|
+
from src.config import cfg
|
|
27
|
+
|
|
28
|
+
logger = logging.getLogger(__name__)
|
|
29
|
+
|
|
30
|
+
# Minimum sample count before a learned preference overrides the default
|
|
31
|
+
MIN_SAMPLES = 10
|
|
32
|
+
# Minimum quality score improvement required to switch from the default model
|
|
33
|
+
MIN_QUALITY_LIFT = 0.05
|
|
34
|
+
# Quality floor assumed for the default model when no history is present
|
|
35
|
+
DEFAULT_QUALITY_FLOOR = 0.70
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@dataclass
|
|
39
|
+
class ModelConfig:
|
|
40
|
+
deployment: str
|
|
41
|
+
api_version: str
|
|
42
|
+
max_tokens: int
|
|
43
|
+
temperature: float
|
|
44
|
+
task_type: str = ""
|
|
45
|
+
|
|
46
|
+
def to_dict(self) -> dict:
|
|
47
|
+
return {
|
|
48
|
+
"deployment": self.deployment,
|
|
49
|
+
"api_version": self.api_version,
|
|
50
|
+
"max_tokens": self.max_tokens,
|
|
51
|
+
"temperature": self.temperature,
|
|
52
|
+
"task_type": self.task_type,
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
# ── task-type registry ────────────────────────────────────────────────────────
|
|
57
|
+
# Values here are applied when no learned preference exists in the DB.
|
|
58
|
+
# All use cfg.AZURE_DEPLOYMENT so the default tracks the operator's configured model.
|
|
59
|
+
|
|
60
|
+
def _default_configs() -> dict[str, ModelConfig]:
|
|
61
|
+
base = cfg.AZURE_DEPLOYMENT
|
|
62
|
+
ver = getattr(cfg, "AZURE_API_VERSION", "2024-02-01")
|
|
63
|
+
return {
|
|
64
|
+
"requirement_understanding": ModelConfig(
|
|
65
|
+
deployment=base, api_version=ver,
|
|
66
|
+
max_tokens=2048, temperature=0.2,
|
|
67
|
+
task_type="requirement_understanding",
|
|
68
|
+
),
|
|
69
|
+
"scenario_generation": ModelConfig(
|
|
70
|
+
deployment=base, api_version=ver,
|
|
71
|
+
max_tokens=4096, temperature=0.4,
|
|
72
|
+
task_type="scenario_generation",
|
|
73
|
+
),
|
|
74
|
+
"testcase_generation": ModelConfig(
|
|
75
|
+
deployment=base, api_version=ver,
|
|
76
|
+
max_tokens=4096, temperature=0.3,
|
|
77
|
+
task_type="testcase_generation",
|
|
78
|
+
),
|
|
79
|
+
"script_generation": ModelConfig(
|
|
80
|
+
deployment=base, api_version=ver,
|
|
81
|
+
max_tokens=8192, temperature=0.2,
|
|
82
|
+
task_type="script_generation",
|
|
83
|
+
),
|
|
84
|
+
"rca": ModelConfig(
|
|
85
|
+
deployment=base, api_version=ver,
|
|
86
|
+
max_tokens=2048, temperature=0.1,
|
|
87
|
+
task_type="rca",
|
|
88
|
+
),
|
|
89
|
+
"healing": ModelConfig(
|
|
90
|
+
deployment=base, api_version=ver,
|
|
91
|
+
max_tokens=4096, temperature=0.2,
|
|
92
|
+
task_type="healing",
|
|
93
|
+
),
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
# ── router ────────────────────────────────────────────────────────────────────
|
|
98
|
+
|
|
99
|
+
class ModelRouter:
|
|
100
|
+
"""Route a task to the best available Azure OpenAI deployment.
|
|
101
|
+
|
|
102
|
+
Usage (TestCaseAgent example):
|
|
103
|
+
router = ModelRouter()
|
|
104
|
+
config = router.route("testcase_generation", context_size=3200, token_budget=4096)
|
|
105
|
+
response = azure_client.complete(deployment=config.deployment, max_tokens=config.max_tokens, ...)
|
|
106
|
+
"""
|
|
107
|
+
|
|
108
|
+
def __init__(self) -> None:
|
|
109
|
+
self._defaults = _default_configs()
|
|
110
|
+
self._learned: dict[str, dict] = {} # loaded lazily
|
|
111
|
+
|
|
112
|
+
# public API ──────────────────────────────────────────────────────────────
|
|
113
|
+
|
|
114
|
+
def route(
|
|
115
|
+
self,
|
|
116
|
+
task_type: str,
|
|
117
|
+
context_size: int = 0,
|
|
118
|
+
token_budget: Optional[int] = None,
|
|
119
|
+
) -> ModelConfig:
|
|
120
|
+
"""Return the best ModelConfig for the given task.
|
|
121
|
+
|
|
122
|
+
Falls back to cfg.AZURE_DEPLOYMENT on any error.
|
|
123
|
+
context_size and token_budget are currently informational (logged for
|
|
124
|
+
future dynamic selection but do not change the routing decision yet).
|
|
125
|
+
"""
|
|
126
|
+
try:
|
|
127
|
+
return self._resolve(task_type, context_size, token_budget)
|
|
128
|
+
except Exception as e:
|
|
129
|
+
logger.warning("ModelRouter.route error for %s: %s — using default", task_type, e)
|
|
130
|
+
return self._fallback(task_type)
|
|
131
|
+
|
|
132
|
+
def record(
|
|
133
|
+
self,
|
|
134
|
+
jira_key: str,
|
|
135
|
+
action: str,
|
|
136
|
+
model_used: str,
|
|
137
|
+
task_type: str,
|
|
138
|
+
tokens_in: int,
|
|
139
|
+
tokens_out: int,
|
|
140
|
+
duration_ms: int,
|
|
141
|
+
quality_score: Optional[float],
|
|
142
|
+
routed_by: str = "router",
|
|
143
|
+
) -> None:
|
|
144
|
+
"""Insert a row into igel_generation_history.
|
|
145
|
+
|
|
146
|
+
Non-fatal: errors are logged but never raised.
|
|
147
|
+
"""
|
|
148
|
+
try:
|
|
149
|
+
from src.db.client import get_conn
|
|
150
|
+
with get_conn() as conn:
|
|
151
|
+
with conn.cursor() as cur:
|
|
152
|
+
cur.execute(
|
|
153
|
+
"""
|
|
154
|
+
INSERT INTO igel_generation_history
|
|
155
|
+
(jira_key, action, model_used, task_type,
|
|
156
|
+
tokens_in, tokens_out, duration_ms, quality_score, routed_by)
|
|
157
|
+
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)
|
|
158
|
+
""",
|
|
159
|
+
(jira_key, action, model_used, task_type,
|
|
160
|
+
tokens_in, tokens_out, duration_ms, quality_score, routed_by),
|
|
161
|
+
)
|
|
162
|
+
conn.commit()
|
|
163
|
+
except Exception as e:
|
|
164
|
+
logger.debug("ModelRouter.record failed (non-fatal): %s", e)
|
|
165
|
+
|
|
166
|
+
# internal ────────────────────────────────────────────────────────────────
|
|
167
|
+
|
|
168
|
+
def _resolve(self, task_type: str, context_size: int, token_budget: Optional[int]) -> ModelConfig:
|
|
169
|
+
base = self._defaults.get(task_type) or self._fallback(task_type)
|
|
170
|
+
|
|
171
|
+
# Attempt to find a learned improvement from the DB
|
|
172
|
+
learned = self._get_learned(task_type)
|
|
173
|
+
if learned:
|
|
174
|
+
learned_model = learned.get("recommended_model")
|
|
175
|
+
avg_quality = learned.get("avg_quality") or 0.0
|
|
176
|
+
call_count = learned.get("call_count") or 0
|
|
177
|
+
|
|
178
|
+
if (
|
|
179
|
+
learned_model
|
|
180
|
+
and learned_model != base.deployment
|
|
181
|
+
and call_count >= MIN_SAMPLES
|
|
182
|
+
and avg_quality >= DEFAULT_QUALITY_FLOOR + MIN_QUALITY_LIFT
|
|
183
|
+
):
|
|
184
|
+
logger.info(
|
|
185
|
+
"ModelRouter: task=%s → learned model=%s (avg_quality=%.3f, n=%d)",
|
|
186
|
+
task_type, learned_model, avg_quality, call_count,
|
|
187
|
+
)
|
|
188
|
+
ver = getattr(cfg, "AZURE_API_VERSION", "2024-02-01")
|
|
189
|
+
return ModelConfig(
|
|
190
|
+
deployment=learned_model,
|
|
191
|
+
api_version=ver,
|
|
192
|
+
max_tokens=base.max_tokens,
|
|
193
|
+
temperature=base.temperature,
|
|
194
|
+
task_type=task_type,
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
if context_size:
|
|
198
|
+
logger.debug("ModelRouter: task=%s context_size=%d → %s", task_type, context_size, base.deployment)
|
|
199
|
+
return base
|
|
200
|
+
|
|
201
|
+
def _get_learned(self, task_type: str) -> Optional[dict]:
|
|
202
|
+
"""Load (and cache) the best model for task_type from DB."""
|
|
203
|
+
if task_type in self._learned:
|
|
204
|
+
return self._learned[task_type]
|
|
205
|
+
try:
|
|
206
|
+
from src.db.client import get_conn
|
|
207
|
+
with get_conn() as conn:
|
|
208
|
+
with conn.cursor() as cur:
|
|
209
|
+
cur.execute(
|
|
210
|
+
"""
|
|
211
|
+
SELECT model_used,
|
|
212
|
+
AVG(quality_score) AS avg_quality,
|
|
213
|
+
COUNT(*) AS call_count
|
|
214
|
+
FROM igel_generation_history
|
|
215
|
+
WHERE task_type = %s AND quality_score IS NOT NULL
|
|
216
|
+
GROUP BY model_used
|
|
217
|
+
ORDER BY avg_quality DESC
|
|
218
|
+
LIMIT 1
|
|
219
|
+
""",
|
|
220
|
+
(task_type,),
|
|
221
|
+
)
|
|
222
|
+
row = cur.fetchone()
|
|
223
|
+
if row:
|
|
224
|
+
self._learned[task_type] = {
|
|
225
|
+
"recommended_model": row[0],
|
|
226
|
+
"avg_quality": float(row[1]) if row[1] is not None else None,
|
|
227
|
+
"call_count": row[2],
|
|
228
|
+
}
|
|
229
|
+
return self._learned[task_type]
|
|
230
|
+
except Exception as e:
|
|
231
|
+
logger.debug("ModelRouter: could not load learned prefs for %s: %s", task_type, e)
|
|
232
|
+
return None
|
|
233
|
+
|
|
234
|
+
def _fallback(self, task_type: str) -> ModelConfig:
|
|
235
|
+
ver = getattr(cfg, "AZURE_API_VERSION", "2024-02-01")
|
|
236
|
+
return ModelConfig(
|
|
237
|
+
deployment=cfg.AZURE_DEPLOYMENT,
|
|
238
|
+
api_version=ver,
|
|
239
|
+
max_tokens=4096,
|
|
240
|
+
temperature=0.3,
|
|
241
|
+
task_type=task_type,
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
def invalidate_cache(self) -> None:
|
|
245
|
+
"""Force next route() call to re-query DB preferences."""
|
|
246
|
+
self._learned.clear()
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""Core contracts for AI orchestration runtime."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
from typing import Any, Literal
|
|
6
|
+
|
|
7
|
+
GateVerdict = Literal["allow", "review", "reject"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@dataclass
|
|
11
|
+
class GenerationContext:
|
|
12
|
+
jira_key: str | None = None
|
|
13
|
+
test_reqid: str | None = None
|
|
14
|
+
task_type: str = "general"
|
|
15
|
+
agent_name: str = "unknown"
|
|
16
|
+
query: str = ""
|
|
17
|
+
intent: str = "synthesize"
|
|
18
|
+
feature_area: str = "Unknown"
|
|
19
|
+
version_scope: str = "unspecified"
|
|
20
|
+
query_categories: list[str] = field(default_factory=list)
|
|
21
|
+
metadata: dict[str, Any] = field(default_factory=dict)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@dataclass
|
|
25
|
+
class PolicyDecision:
|
|
26
|
+
verdict: GateVerdict
|
|
27
|
+
reason: str
|
|
28
|
+
details: dict[str, Any] = field(default_factory=dict)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@dataclass
|
|
32
|
+
class GuardrailDecision:
|
|
33
|
+
verdict: GateVerdict
|
|
34
|
+
reason: str
|
|
35
|
+
details: dict[str, Any] = field(default_factory=dict)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@dataclass
|
|
39
|
+
class HookTrace:
|
|
40
|
+
stage: str
|
|
41
|
+
name: str
|
|
42
|
+
status: Literal["ok", "warn", "error"]
|
|
43
|
+
message: str = ""
|
|
44
|
+
details: dict[str, Any] = field(default_factory=dict)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@dataclass
|
|
48
|
+
class LLMRequest:
|
|
49
|
+
system_prompt: str
|
|
50
|
+
user_prompt: str
|
|
51
|
+
task_type: str
|
|
52
|
+
agent_name: str
|
|
53
|
+
temperature: float = 0.2
|
|
54
|
+
max_tokens: int = 4096
|
|
55
|
+
deployment: str | None = None
|
|
56
|
+
response_format: dict[str, Any] | None = None
|
|
57
|
+
context: GenerationContext = field(default_factory=GenerationContext)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@dataclass
|
|
61
|
+
class LLMResult:
|
|
62
|
+
content: str
|
|
63
|
+
model: str
|
|
64
|
+
traces: list[HookTrace] = field(default_factory=list)
|
|
65
|
+
policy: PolicyDecision | None = None
|
|
66
|
+
guardrail: GuardrailDecision | None = None
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
import json
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from src.models.test_requirement import TestCaseWithConfidence
|
|
9
|
+
from src.core.traceability_engine import TraceabilityRecord
|
|
10
|
+
from src.config.policy_config import PolicyConfig
|
|
11
|
+
from src.db.client import get_conn
|
|
12
|
+
|
|
13
|
+
logger = logging.getLogger(__name__)
|
|
14
|
+
|
|
15
|
+
@dataclass
|
|
16
|
+
class PersistenceResult:
|
|
17
|
+
success: bool
|
|
18
|
+
file_path: str
|
|
19
|
+
message: str
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class PersistenceEngine:
|
|
23
|
+
"""Handles saving generated artifacts and tracking Execution Memory in Postgres."""
|
|
24
|
+
|
|
25
|
+
def save_test_case(
|
|
26
|
+
self,
|
|
27
|
+
tc_with_conf: TestCaseWithConfidence,
|
|
28
|
+
traceability: TraceabilityRecord,
|
|
29
|
+
output_root: Path,
|
|
30
|
+
policy: PolicyConfig
|
|
31
|
+
) -> PersistenceResult:
|
|
32
|
+
|
|
33
|
+
tc = tc_with_conf.test_case
|
|
34
|
+
jira_key = traceability.jira_key
|
|
35
|
+
tc_ref = tc.tc_reference
|
|
36
|
+
folder = Path(policy.test_case_folder)
|
|
37
|
+
|
|
38
|
+
# 1. Write File
|
|
39
|
+
try:
|
|
40
|
+
target_dir = output_root / folder
|
|
41
|
+
target_dir.mkdir(parents=True, exist_ok=True)
|
|
42
|
+
|
|
43
|
+
# Use safe filename
|
|
44
|
+
safe_jira = jira_key.replace("-", "_").lower()
|
|
45
|
+
file_name = f"test_{safe_jira}_{tc_ref}.md"
|
|
46
|
+
target_path = target_dir / file_name
|
|
47
|
+
|
|
48
|
+
# Format markdown
|
|
49
|
+
content = self._format_testcase_markdown(tc_with_conf, traceability)
|
|
50
|
+
with open(target_path, "w", encoding="utf-8") as f:
|
|
51
|
+
f.write(content)
|
|
52
|
+
except Exception as e:
|
|
53
|
+
logger.error(f"Failed to write test case file: {e}")
|
|
54
|
+
return PersistenceResult(False, "", f"File write error: {e}")
|
|
55
|
+
|
|
56
|
+
# 2. Update Execution Memory (Postgres)
|
|
57
|
+
try:
|
|
58
|
+
with get_conn() as conn:
|
|
59
|
+
with conn.cursor() as cur:
|
|
60
|
+
# Upsert generation_record
|
|
61
|
+
cur.execute(
|
|
62
|
+
"""
|
|
63
|
+
INSERT INTO igel_generation_records
|
|
64
|
+
(jira_key, tc_reference, generated_at, context_hash, confidence_score, status, artifact_path, metrics)
|
|
65
|
+
VALUES (%s, %s, %s, %s, %s, %s, %s, %s)
|
|
66
|
+
ON CONFLICT (jira_key, tc_reference)
|
|
67
|
+
DO UPDATE SET
|
|
68
|
+
generated_at = EXCLUDED.generated_at,
|
|
69
|
+
context_hash = EXCLUDED.context_hash,
|
|
70
|
+
confidence_score = EXCLUDED.confidence_score,
|
|
71
|
+
status = EXCLUDED.status,
|
|
72
|
+
metrics = EXCLUDED.metrics
|
|
73
|
+
""",
|
|
74
|
+
(
|
|
75
|
+
jira_key,
|
|
76
|
+
tc_ref,
|
|
77
|
+
traceability.generated_at,
|
|
78
|
+
traceability.context_hash,
|
|
79
|
+
tc.confidence_score,
|
|
80
|
+
"pending_review" if not tc_with_conf.is_approved else "auto_approved",
|
|
81
|
+
str(target_path),
|
|
82
|
+
json.dumps(tc.confidence_metrics)
|
|
83
|
+
)
|
|
84
|
+
)
|
|
85
|
+
conn.commit()
|
|
86
|
+
except Exception as e:
|
|
87
|
+
logger.warning(f"Failed to update Execution Memory in DB (non-fatal): {e}")
|
|
88
|
+
|
|
89
|
+
return PersistenceResult(True, str(target_path), "Saved successfully")
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def save_automation_script(
|
|
93
|
+
self,
|
|
94
|
+
code: str,
|
|
95
|
+
target_path: Path,
|
|
96
|
+
traceability: TraceabilityRecord,
|
|
97
|
+
policy: PolicyConfig
|
|
98
|
+
) -> PersistenceResult:
|
|
99
|
+
|
|
100
|
+
try:
|
|
101
|
+
target_path.parent.mkdir(parents=True, exist_ok=True)
|
|
102
|
+
with open(target_path, "w", encoding="utf-8") as f:
|
|
103
|
+
f.write(code)
|
|
104
|
+
except Exception as e:
|
|
105
|
+
logger.error(f"Failed to write automation script: {e}")
|
|
106
|
+
return PersistenceResult(False, "", f"File write error: {e}")
|
|
107
|
+
|
|
108
|
+
try:
|
|
109
|
+
with get_conn() as conn:
|
|
110
|
+
with conn.cursor() as cur:
|
|
111
|
+
cur.execute(
|
|
112
|
+
"""
|
|
113
|
+
INSERT INTO igel_automation_scripts
|
|
114
|
+
(jira_key, tc_reference, script_path, generated_at)
|
|
115
|
+
VALUES (%s, %s, %s, %s)
|
|
116
|
+
ON CONFLICT (jira_key, tc_reference)
|
|
117
|
+
DO UPDATE SET
|
|
118
|
+
script_path = EXCLUDED.script_path,
|
|
119
|
+
generated_at = EXCLUDED.generated_at
|
|
120
|
+
""",
|
|
121
|
+
(traceability.jira_key, traceability.tc_reference, str(target_path), traceability.generated_at)
|
|
122
|
+
)
|
|
123
|
+
conn.commit()
|
|
124
|
+
except Exception as e:
|
|
125
|
+
logger.warning(f"Failed to update script history in DB (non-fatal): {e}")
|
|
126
|
+
|
|
127
|
+
return PersistenceResult(True, str(target_path), "Script saved successfully")
|
|
128
|
+
|
|
129
|
+
def _format_testcase_markdown(self, tc_with_conf: TestCaseWithConfidence, trace: TraceabilityRecord) -> str:
|
|
130
|
+
tc = tc_with_conf.test_case
|
|
131
|
+
lines = [
|
|
132
|
+
f"# Test Case: {tc.title}",
|
|
133
|
+
f"**Reference:** {tc.tc_reference} ",
|
|
134
|
+
f"**Jira Key:** {trace.jira_key} ",
|
|
135
|
+
f"**Priority:** {tc.priority.capitalize()} ",
|
|
136
|
+
f"**Type:** {tc.test_type.capitalize()} ",
|
|
137
|
+
f"**Approval Status:** {'✅ Auto-Approved' if tc_with_conf.is_approved else '⚠️ Pending Review'} ",
|
|
138
|
+
"",
|
|
139
|
+
"## Confidence & Traceability",
|
|
140
|
+
f"- **Overall Confidence:** {tc.confidence_score * 100:.1f}%",
|
|
141
|
+
f"- **Context Sources:** {', '.join(trace.source_report.conflicts) if trace.source_report.conflicts else 'Verified'}",
|
|
142
|
+
"",
|
|
143
|
+
"## Preconditions"
|
|
144
|
+
]
|
|
145
|
+
|
|
146
|
+
for pre in tc.preconditions:
|
|
147
|
+
lines.append(f"- {pre}")
|
|
148
|
+
|
|
149
|
+
lines.append("\n## Steps")
|
|
150
|
+
lines.append("| Step | Action | Data | Expected Result |")
|
|
151
|
+
lines.append("|---|---|---|---|")
|
|
152
|
+
|
|
153
|
+
for step in tc.steps:
|
|
154
|
+
action = step.action.replace('\n', ' ')
|
|
155
|
+
data = step.data.replace('\n', ' ') if step.data else "N/A"
|
|
156
|
+
expected = step.expected_result.replace('\n', ' ')
|
|
157
|
+
lines.append(f"| {step.step_number} | {action} | {data} | {expected} |")
|
|
158
|
+
|
|
159
|
+
return "\n".join(lines)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from typing import Dict, Any, Optional
|
|
3
|
+
|
|
4
|
+
class PromptBuilder:
|
|
5
|
+
"""
|
|
6
|
+
Constructs the final prompt by assembling minimal behavioral instructions,
|
|
7
|
+
templates, and the unified context package.
|
|
8
|
+
|
|
9
|
+
This replaces the V1 anti-pattern of passing 50k tokens of static
|
|
10
|
+
procedural rules to the LLM. Procedural rules belong in the Python runtime.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
@staticmethod
|
|
14
|
+
def build(
|
|
15
|
+
role: str,
|
|
16
|
+
behavioral_instructions: str,
|
|
17
|
+
template: str,
|
|
18
|
+
context_package: Dict[str, Any]
|
|
19
|
+
) -> str:
|
|
20
|
+
"""
|
|
21
|
+
Builds the final system prompt.
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
role: The Persona (e.g., "You are a Senior IGEL QA Engineer.")
|
|
25
|
+
behavioral_instructions: Minimal rules (e.g., "Do not invent APIs", "Assume no IGEL knowledge")
|
|
26
|
+
template: The required output schema or structure.
|
|
27
|
+
context_package: The resolved, unified context to be used.
|
|
28
|
+
|
|
29
|
+
Returns:
|
|
30
|
+
The assembled prompt string.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
prompt_parts = []
|
|
34
|
+
|
|
35
|
+
# 1. Role
|
|
36
|
+
prompt_parts.append(f"# Role\n{role}")
|
|
37
|
+
|
|
38
|
+
# 2. Behavioral Instructions
|
|
39
|
+
prompt_parts.append(f"# Instructions\n{behavioral_instructions}")
|
|
40
|
+
|
|
41
|
+
# 3. Output Template
|
|
42
|
+
prompt_parts.append(f"# Required Format\n{template}")
|
|
43
|
+
|
|
44
|
+
# 4. Context Package
|
|
45
|
+
prompt_parts.append("# Context Package")
|
|
46
|
+
prompt_parts.append("Use the following context strictly. Do not hallucinate outside of this context:")
|
|
47
|
+
prompt_parts.append(json.dumps(context_package, indent=2))
|
|
48
|
+
|
|
49
|
+
return "\n\n".join(prompt_parts)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Prompt policy engine applied before LLM dispatch.
|
|
2
|
+
|
|
3
|
+
Phase bootstrap behavior:
|
|
4
|
+
- If no project policy profile exists, safe built-in defaults are enforced.
|
|
5
|
+
- Project profile support can be layered without disabling defaults.
|
|
6
|
+
"""
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import re
|
|
10
|
+
|
|
11
|
+
from src.core.orchestration_contracts import LLMRequest, PolicyDecision
|
|
12
|
+
from src.config.policy_config import get_policy
|
|
13
|
+
|
|
14
|
+
class PromptPolicyEngine:
|
|
15
|
+
def evaluate(self, request: LLMRequest) -> PolicyDecision:
|
|
16
|
+
policy = get_policy()
|
|
17
|
+
|
|
18
|
+
if len(request.system_prompt) + len(request.user_prompt) > policy.max_prompt_chars:
|
|
19
|
+
return PolicyDecision(
|
|
20
|
+
verdict="reject",
|
|
21
|
+
reason="Prompt length exceeds policy limit",
|
|
22
|
+
details={"limit": policy.max_prompt_chars},
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
blob = f"{request.system_prompt}\n{request.user_prompt}"
|
|
26
|
+
for pattern_str in policy.blocked_patterns:
|
|
27
|
+
p = re.compile(pattern_str, re.IGNORECASE)
|
|
28
|
+
if p.search(blob):
|
|
29
|
+
return PolicyDecision(
|
|
30
|
+
verdict="reject",
|
|
31
|
+
reason="Prompt violates blocked-pattern policy",
|
|
32
|
+
details={"pattern": p.pattern},
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
return PolicyDecision(verdict="allow", reason="Policy checks passed")
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
import hashlib
|
|
5
|
+
from datetime import datetime, timezone
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
|
|
8
|
+
from src.core.context_engine import UnifiedContext, SourceReport
|
|
9
|
+
|
|
10
|
+
logger = logging.getLogger(__name__)
|
|
11
|
+
|
|
12
|
+
@dataclass
|
|
13
|
+
class TraceabilityRecord:
|
|
14
|
+
tc_reference: str
|
|
15
|
+
jira_key: str
|
|
16
|
+
source_chunk_ids: list[str]
|
|
17
|
+
business_rules_used: list[str]
|
|
18
|
+
source_attribution: dict
|
|
19
|
+
source_report: SourceReport
|
|
20
|
+
generated_at: datetime
|
|
21
|
+
context_hash: str
|
|
22
|
+
os_version: str = "OS12"
|
|
23
|
+
|
|
24
|
+
class TraceabilityEngine:
|
|
25
|
+
def build_matrix(
|
|
26
|
+
self,
|
|
27
|
+
tc_reference: str,
|
|
28
|
+
unified_context: UnifiedContext,
|
|
29
|
+
business_rules: list[str]
|
|
30
|
+
) -> TraceabilityRecord:
|
|
31
|
+
"""
|
|
32
|
+
Pure Python, no LLM. Maps steps to chunks that were actually in context.
|
|
33
|
+
"""
|
|
34
|
+
# Collect chunk IDs
|
|
35
|
+
source_chunk_ids = [str(getattr(rc.chunk, 'id', '')) for rc in unified_context.ranked_chunks if hasattr(rc.chunk, 'id')]
|
|
36
|
+
|
|
37
|
+
# Build reproducible hash of context
|
|
38
|
+
hasher = hashlib.sha256()
|
|
39
|
+
for rc in unified_context.ranked_chunks:
|
|
40
|
+
hasher.update(rc.content.encode('utf-8'))
|
|
41
|
+
context_hash = hasher.hexdigest()
|
|
42
|
+
|
|
43
|
+
record = TraceabilityRecord(
|
|
44
|
+
tc_reference=tc_reference,
|
|
45
|
+
jira_key=unified_context.jira_key,
|
|
46
|
+
source_chunk_ids=source_chunk_ids,
|
|
47
|
+
business_rules_used=business_rules,
|
|
48
|
+
source_attribution=unified_context.source_attribution,
|
|
49
|
+
source_report=unified_context.source_report,
|
|
50
|
+
generated_at=datetime.now(timezone.utc),
|
|
51
|
+
context_hash=context_hash,
|
|
52
|
+
os_version=unified_context.os_version
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
logger.info(f"Generated TraceabilityRecord for {tc_reference}")
|
|
56
|
+
return record
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -12,8 +12,8 @@ Never auto-edit based on raw feedback — human curation is mandatory gate.
|
|
|
12
12
|
"""
|
|
13
13
|
from __future__ import annotations
|
|
14
14
|
|
|
15
|
-
from
|
|
16
|
-
from
|
|
15
|
+
from src.config import cfg
|
|
16
|
+
from src.db.client import get_conn
|
|
17
17
|
|
|
18
18
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
19
19
|
# Feedback Events Table
|