devflow-engine 1.0.0__py3-none-any.whl
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.
- devflow_engine/__init__.py +3 -0
- devflow_engine/agentic_prompts.py +100 -0
- devflow_engine/agentic_runtime.py +398 -0
- devflow_engine/api_key_flow_harness.py +539 -0
- devflow_engine/api_keys.py +357 -0
- devflow_engine/bootstrap/__init__.py +2 -0
- devflow_engine/bootstrap/provision_from_template.py +84 -0
- devflow_engine/cli/__init__.py +0 -0
- devflow_engine/cli/app.py +7270 -0
- devflow_engine/core/__init__.py +0 -0
- devflow_engine/core/config.py +86 -0
- devflow_engine/core/logging.py +29 -0
- devflow_engine/core/paths.py +45 -0
- devflow_engine/core/toml_kv.py +33 -0
- devflow_engine/devflow_event_worker.py +1292 -0
- devflow_engine/devflow_state.py +201 -0
- devflow_engine/devin2/__init__.py +9 -0
- devflow_engine/devin2/agent_definition.py +120 -0
- devflow_engine/devin2/pi_runner.py +204 -0
- devflow_engine/devin_orchestration.py +69 -0
- devflow_engine/docs/prompts/anti-patterns.md +42 -0
- devflow_engine/docs/prompts/devin-agent-prompt.md +55 -0
- devflow_engine/docs/prompts/devin2-agent-prompt.md +81 -0
- devflow_engine/docs/prompts/examples/devin-vapi-clone-reference-exchange.json +85 -0
- devflow_engine/doctor/__init__.py +2 -0
- devflow_engine/doctor/triage.py +140 -0
- devflow_engine/error/__init__.py +0 -0
- devflow_engine/error/remediation.py +21 -0
- devflow_engine/errors/error_solver_dag.py +522 -0
- devflow_engine/errors/runtime_observability.py +67 -0
- devflow_engine/idea/__init__.py +4 -0
- devflow_engine/idea/actors.py +481 -0
- devflow_engine/idea/agentic.py +465 -0
- devflow_engine/idea/analyze.py +93 -0
- devflow_engine/idea/devin_chat_dag.py +1 -0
- devflow_engine/idea/diff.py +99 -0
- devflow_engine/idea/drafts.py +446 -0
- devflow_engine/idea/idea_creation_dag.py +643 -0
- devflow_engine/idea/ideation_enrichment.py +355 -0
- devflow_engine/idea/ideation_enrichment_worker.py +19 -0
- devflow_engine/idea/paths.py +28 -0
- devflow_engine/idea/promote.py +53 -0
- devflow_engine/idea/redaction.py +27 -0
- devflow_engine/idea/repo_tools.py +1277 -0
- devflow_engine/idea/response_mode.py +30 -0
- devflow_engine/idea/story_pipeline.py +1585 -0
- devflow_engine/idea/sufficiency.py +376 -0
- devflow_engine/idea/traditional_stories.py +1257 -0
- devflow_engine/implementation/__init__.py +0 -0
- devflow_engine/implementation/alembic_preflight.py +700 -0
- devflow_engine/implementation/dag.py +8450 -0
- devflow_engine/implementation/green_gate.py +93 -0
- devflow_engine/implementation/prompts.py +108 -0
- devflow_engine/implementation/test_runtime.py +623 -0
- devflow_engine/integration/__init__.py +19 -0
- devflow_engine/integration/agentic.py +66 -0
- devflow_engine/integration/dag.py +3539 -0
- devflow_engine/integration/prompts.py +114 -0
- devflow_engine/integration/supabase_schema.sql +31 -0
- devflow_engine/integration/supabase_sync.py +177 -0
- devflow_engine/llm/__init__.py +1 -0
- devflow_engine/llm/cli_one_shot.py +84 -0
- devflow_engine/llm/cli_stream.py +371 -0
- devflow_engine/llm/execution_context.py +26 -0
- devflow_engine/llm/invoke.py +1322 -0
- devflow_engine/llm/provider_api.py +304 -0
- devflow_engine/llm/repo_knowledge.py +588 -0
- devflow_engine/llm_primitives.py +315 -0
- devflow_engine/orchestration.py +62 -0
- devflow_engine/planning/__init__.py +0 -0
- devflow_engine/planning/analyze_repo.py +92 -0
- devflow_engine/planning/render_drafts.py +133 -0
- devflow_engine/playground/__init__.py +0 -0
- devflow_engine/playground/hooks.py +26 -0
- devflow_engine/playwright_workflow/__init__.py +5 -0
- devflow_engine/playwright_workflow/dag.py +1317 -0
- devflow_engine/process/__init__.py +5 -0
- devflow_engine/process/dag.py +59 -0
- devflow_engine/project_registration/__init__.py +3 -0
- devflow_engine/project_registration/dag.py +1581 -0
- devflow_engine/project_registry.py +109 -0
- devflow_engine/prompts/devin/generic/prompt.md +6 -0
- devflow_engine/prompts/devin/ideation/prompt.md +263 -0
- devflow_engine/prompts/devin/ideation/scenarios.md +5 -0
- devflow_engine/prompts/devin/ideation_loop/prompt.md +6 -0
- devflow_engine/prompts/devin/insight/prompt.md +11 -0
- devflow_engine/prompts/devin/insight/scenarios.md +5 -0
- devflow_engine/prompts/devin/intake/prompt.md +15 -0
- devflow_engine/prompts/devin/iterate/prompt.md +12 -0
- devflow_engine/prompts/devin/shared/eval_doctrine.md +9 -0
- devflow_engine/prompts/devin/shared/principles.md +246 -0
- devflow_engine/prompts/devin_eval/assessment/prompt.md +18 -0
- devflow_engine/prompts/idea/api_ideation_agent/prompt.md +8 -0
- devflow_engine/prompts/idea/api_insight_agent/prompt.md +8 -0
- devflow_engine/prompts/idea/response_doctrine/prompt.md +18 -0
- devflow_engine/prompts/implementation/dependency_assessment/prompt.md +12 -0
- devflow_engine/prompts/implementation/green/green/prompt.md +11 -0
- devflow_engine/prompts/implementation/green/node_config/prompt.md +3 -0
- devflow_engine/prompts/implementation/green_review/outcome_review/prompt.md +5 -0
- devflow_engine/prompts/implementation/green_review/prior_run_review/prompt.md +5 -0
- devflow_engine/prompts/implementation/red/prompt.md +27 -0
- devflow_engine/prompts/implementation/redreview/prompt.md +23 -0
- devflow_engine/prompts/implementation/redreview_repair/prompt.md +16 -0
- devflow_engine/prompts/implementation/setupdoc/prompt.md +10 -0
- devflow_engine/prompts/implementation/story_planning/prompt.md +13 -0
- devflow_engine/prompts/implementation/test_design/prompt.md +27 -0
- devflow_engine/prompts/integration/README.md +185 -0
- devflow_engine/prompts/integration/green/example.md +67 -0
- devflow_engine/prompts/integration/green/green/prompt.md +10 -0
- devflow_engine/prompts/integration/green/node_config/prompt.md +42 -0
- devflow_engine/prompts/integration/green/past_prompts/20260417T212300/green/prompt.md +15 -0
- devflow_engine/prompts/integration/green/past_prompts/20260417T212300/node_config/prompt.md +42 -0
- devflow_engine/prompts/integration/green_enrich/example.md +79 -0
- devflow_engine/prompts/integration/green_enrich/green_enrich/prompt.md +9 -0
- devflow_engine/prompts/integration/green_enrich/node_config/prompt.md +41 -0
- devflow_engine/prompts/integration/green_enrich/past_prompts/20260417T212300/green_enrich/prompt.md +14 -0
- devflow_engine/prompts/integration/green_enrich/past_prompts/20260417T212300/node_config/prompt.md +41 -0
- devflow_engine/prompts/integration/red/code_repair/prompt.md +12 -0
- devflow_engine/prompts/integration/red/example.md +152 -0
- devflow_engine/prompts/integration/red/node_config/prompt.md +86 -0
- devflow_engine/prompts/integration/red/past_prompts/20260417T212300/code_repair/prompt.md +19 -0
- devflow_engine/prompts/integration/red/past_prompts/20260417T212300/node_config/prompt.md +84 -0
- devflow_engine/prompts/integration/red/past_prompts/20260417T212300/red/prompt.md +16 -0
- devflow_engine/prompts/integration/red/past_prompts/20260417T212300/red_repair/prompt.md +15 -0
- devflow_engine/prompts/integration/red/past_prompts/20260417T215032/code_repair/prompt.md +10 -0
- devflow_engine/prompts/integration/red/past_prompts/20260417T215032/node_config/prompt.md +84 -0
- devflow_engine/prompts/integration/red/past_prompts/20260417T215032/red_repair/prompt.md +11 -0
- devflow_engine/prompts/integration/red/red/prompt.md +11 -0
- devflow_engine/prompts/integration/red/red_repair/prompt.md +12 -0
- devflow_engine/prompts/integration/red_review/example.md +71 -0
- devflow_engine/prompts/integration/red_review/node_config/prompt.md +41 -0
- devflow_engine/prompts/integration/red_review/past_prompts/20260417T212300/node_config/prompt.md +41 -0
- devflow_engine/prompts/integration/red_review/past_prompts/20260417T212300/red_review/prompt.md +15 -0
- devflow_engine/prompts/integration/red_review/red_review/prompt.md +9 -0
- devflow_engine/prompts/integration/resolve/example.md +111 -0
- devflow_engine/prompts/integration/resolve/node_config/prompt.md +64 -0
- devflow_engine/prompts/integration/resolve/past_prompts/20260417T212300/node_config/prompt.md +64 -0
- devflow_engine/prompts/integration/resolve/past_prompts/20260417T212300/resolve_implicated_users/prompt.md +15 -0
- devflow_engine/prompts/integration/resolve/past_prompts/20260417T212300/resolve_side_effects/prompt.md +15 -0
- devflow_engine/prompts/integration/resolve/resolve_implicated_users/prompt.md +10 -0
- devflow_engine/prompts/integration/resolve/resolve_side_effects/prompt.md +10 -0
- devflow_engine/prompts/integration/validate/build_idea_acceptance_coverage/prompt.md +12 -0
- devflow_engine/prompts/integration/validate/code_repair/prompt.md +13 -0
- devflow_engine/prompts/integration/validate/example.md +143 -0
- devflow_engine/prompts/integration/validate/node_config/prompt.md +87 -0
- devflow_engine/prompts/integration/validate/past_prompts/20260417T212300/code_repair/prompt.md +19 -0
- devflow_engine/prompts/integration/validate/past_prompts/20260417T212300/node_config/prompt.md +67 -0
- devflow_engine/prompts/integration/validate/past_prompts/20260417T212300/validate_enrich_gate/prompt.md +17 -0
- devflow_engine/prompts/integration/validate/past_prompts/20260417T212300/validate_repair/prompt.md +16 -0
- devflow_engine/prompts/integration/validate/past_prompts/20260417T215032/code_repair/prompt.md +10 -0
- devflow_engine/prompts/integration/validate/past_prompts/20260417T215032/node_config/prompt.md +67 -0
- devflow_engine/prompts/integration/validate/past_prompts/20260417T215032/validate_repair/prompt.md +9 -0
- devflow_engine/prompts/integration/validate/validate_enrich_gate/prompt.md +10 -0
- devflow_engine/prompts/integration/validate/validate_repair/prompt.md +20 -0
- devflow_engine/prompts/integration/write_workflows/example.md +100 -0
- devflow_engine/prompts/integration/write_workflows/node_config/prompt.md +44 -0
- devflow_engine/prompts/integration/write_workflows/past_prompts/20260417T212300/node_config/prompt.md +44 -0
- devflow_engine/prompts/integration/write_workflows/past_prompts/20260417T212300/write_workflows/prompt.md +17 -0
- devflow_engine/prompts/integration/write_workflows/write_workflows/prompt.md +11 -0
- devflow_engine/prompts/iterate/README.md +7 -0
- devflow_engine/prompts/iterate/coder/prompt.md +11 -0
- devflow_engine/prompts/iterate/framer/prompt.md +11 -0
- devflow_engine/prompts/iterate/iterator/prompt.md +13 -0
- devflow_engine/prompts/iterate/observer/prompt.md +11 -0
- devflow_engine/prompts/recovery/diagnosis/prompt.md +7 -0
- devflow_engine/prompts/recovery/execution/prompt.md +8 -0
- devflow_engine/prompts/recovery/execution_verification/prompt.md +7 -0
- devflow_engine/prompts/recovery/failure_investigation/prompt.md +10 -0
- devflow_engine/prompts/recovery/preflight_health_repo_repair/prompt.md +8 -0
- devflow_engine/prompts/recovery/remediation_execution/prompt.md +11 -0
- devflow_engine/prompts/recovery/root_cause_investigation/prompt.md +12 -0
- devflow_engine/prompts/scope_idea/doctrine/prompt.md +7 -0
- devflow_engine/prompts/source_doc_eval/document/prompt.md +6 -0
- devflow_engine/prompts/source_doc_eval/targeted_mutation/prompt.md +9 -0
- devflow_engine/prompts/source_doc_mutation/domain_entities/prompt.md +6 -0
- devflow_engine/prompts/source_doc_mutation/product_brief/prompt.md +6 -0
- devflow_engine/prompts/source_doc_mutation/project_doc_coherence/prompt.md +7 -0
- devflow_engine/prompts/source_doc_mutation/project_doc_render/prompt.md +9 -0
- devflow_engine/prompts/source_doc_mutation/source_doc_coherence/prompt.md +5 -0
- devflow_engine/prompts/source_doc_mutation/source_doc_enrichment_coherence/prompt.md +6 -0
- devflow_engine/prompts/source_doc_mutation/user_workflows/prompt.md +6 -0
- devflow_engine/prompts/source_scope/doctrine/prompt.md +10 -0
- devflow_engine/prompts/ui_grounding/doctrine/prompt.md +7 -0
- devflow_engine/recovery/__init__.py +3 -0
- devflow_engine/recovery/dag.py +2609 -0
- devflow_engine/recovery/models.py +220 -0
- devflow_engine/refactor.py +93 -0
- devflow_engine/registry/__init__.py +1 -0
- devflow_engine/registry/cards.py +238 -0
- devflow_engine/registry/domain_normalize.py +60 -0
- devflow_engine/registry/effects.py +65 -0
- devflow_engine/registry/enforce_report.py +150 -0
- devflow_engine/registry/module_cards_classify.py +164 -0
- devflow_engine/registry/module_cards_draft.py +184 -0
- devflow_engine/registry/module_cards_gate.py +59 -0
- devflow_engine/registry/packages.py +347 -0
- devflow_engine/registry/pathways.py +323 -0
- devflow_engine/review/__init__.py +11 -0
- devflow_engine/review/dag.py +588 -0
- devflow_engine/review/review_story.py +67 -0
- devflow_engine/scope_idea/__init__.py +3 -0
- devflow_engine/scope_idea/agentic.py +39 -0
- devflow_engine/scope_idea/dag.py +1069 -0
- devflow_engine/scope_idea/models.py +175 -0
- devflow_engine/skills/builtins/devflow/queue_failure_investigation/SKILL.md +112 -0
- devflow_engine/skills/builtins/devflow/queue_idea_to_story/SKILL.md +120 -0
- devflow_engine/skills/builtins/devflow/queue_integration/SKILL.md +105 -0
- devflow_engine/skills/builtins/devflow/queue_recovery/SKILL.md +108 -0
- devflow_engine/skills/builtins/devflow/queue_runtime_core/SKILL.md +155 -0
- devflow_engine/skills/builtins/devflow/queue_story_implementation/SKILL.md +122 -0
- devflow_engine/skills/builtins/devin/idea_to_story_handoff/SKILL.md +120 -0
- devflow_engine/skills/builtins/devin/ideation/SKILL.md +168 -0
- devflow_engine/skills/builtins/devin/ideation/state-and-phrasing-reference.md +18 -0
- devflow_engine/skills/builtins/devin/insight/SKILL.md +22 -0
- devflow_engine/skills/registry.example.yaml +42 -0
- devflow_engine/source_doc_assumptions.py +291 -0
- devflow_engine/source_doc_mutation_dag.py +1606 -0
- devflow_engine/source_doc_mutation_eval.py +417 -0
- devflow_engine/source_doc_mutation_worker.py +25 -0
- devflow_engine/source_docs_schema.py +207 -0
- devflow_engine/source_docs_updater.py +309 -0
- devflow_engine/source_scope/__init__.py +15 -0
- devflow_engine/source_scope/agentic.py +45 -0
- devflow_engine/source_scope/dag.py +1626 -0
- devflow_engine/source_scope/models.py +177 -0
- devflow_engine/stores/__init__.py +0 -0
- devflow_engine/stores/execution_store.py +3534 -0
- devflow_engine/story/__init__.py +0 -0
- devflow_engine/story/contracts.py +160 -0
- devflow_engine/story/discovery.py +47 -0
- devflow_engine/story/evidence.py +118 -0
- devflow_engine/story/hashing.py +27 -0
- devflow_engine/story/implemented_queue_purge.py +148 -0
- devflow_engine/story/indexer.py +105 -0
- devflow_engine/story/io.py +20 -0
- devflow_engine/story/markdown_contracts.py +298 -0
- devflow_engine/story/reconciliation.py +408 -0
- devflow_engine/story/validate_stories.py +149 -0
- devflow_engine/story/validate_tests_story.py +512 -0
- devflow_engine/story/validation.py +133 -0
- devflow_engine/ui_grounding/__init__.py +11 -0
- devflow_engine/ui_grounding/agentic.py +31 -0
- devflow_engine/ui_grounding/dag.py +874 -0
- devflow_engine/ui_grounding/models.py +224 -0
- devflow_engine/ui_grounding/pencil_bridge.py +247 -0
- devflow_engine/vendor/__init__.py +0 -0
- devflow_engine/vendor/datalumina_genai/__init__.py +11 -0
- devflow_engine/vendor/datalumina_genai/core/__init__.py +0 -0
- devflow_engine/vendor/datalumina_genai/core/exceptions.py +9 -0
- devflow_engine/vendor/datalumina_genai/core/nodes/__init__.py +0 -0
- devflow_engine/vendor/datalumina_genai/core/nodes/agent.py +48 -0
- devflow_engine/vendor/datalumina_genai/core/nodes/agent_streaming_node.py +26 -0
- devflow_engine/vendor/datalumina_genai/core/nodes/base.py +89 -0
- devflow_engine/vendor/datalumina_genai/core/nodes/concurrent.py +30 -0
- devflow_engine/vendor/datalumina_genai/core/nodes/router.py +69 -0
- devflow_engine/vendor/datalumina_genai/core/schema.py +72 -0
- devflow_engine/vendor/datalumina_genai/core/task.py +52 -0
- devflow_engine/vendor/datalumina_genai/core/validate.py +139 -0
- devflow_engine/vendor/datalumina_genai/core/workflow.py +200 -0
- devflow_engine/worker.py +1086 -0
- devflow_engine/worker_guard.py +233 -0
- devflow_engine-1.0.0.dist-info/METADATA +235 -0
- devflow_engine-1.0.0.dist-info/RECORD +393 -0
- devflow_engine-1.0.0.dist-info/WHEEL +4 -0
- devflow_engine-1.0.0.dist-info/entry_points.txt +3 -0
- devin/__init__.py +6 -0
- devin/dag.py +58 -0
- devin/dag_two_arm.py +138 -0
- devin/devin_chat_scenario_catalog.json +588 -0
- devin/devin_eval.py +677 -0
- devin/nodes/__init__.py +0 -0
- devin/nodes/ideation/__init__.py +0 -0
- devin/nodes/ideation/node.py +195 -0
- devin/nodes/ideation/playground.py +267 -0
- devin/nodes/ideation/prompt.md +65 -0
- devin/nodes/ideation/scenarios/continue_refinement.py +13 -0
- devin/nodes/ideation/scenarios/continue_refinement_evals.py +18 -0
- devin/nodes/ideation/scenarios/idea_fits_existing_patterns.py +17 -0
- devin/nodes/ideation/scenarios/idea_fits_existing_patterns_evals.py +16 -0
- devin/nodes/ideation/scenarios/large_idea_split.py +4 -0
- devin/nodes/ideation/scenarios/large_idea_split_evals.py +17 -0
- devin/nodes/ideation/scenarios/source_documentation_added.py +4 -0
- devin/nodes/ideation/scenarios/source_documentation_added_evals.py +16 -0
- devin/nodes/ideation/scenarios/user_says_create_it.py +30 -0
- devin/nodes/ideation/scenarios/user_says_create_it_evals.py +23 -0
- devin/nodes/ideation/scenarios/vague_idea.py +16 -0
- devin/nodes/ideation/scenarios/vague_idea_evals.py +47 -0
- devin/nodes/ideation/tools.json +312 -0
- devin/nodes/insight/__init__.py +0 -0
- devin/nodes/insight/node.py +49 -0
- devin/nodes/insight/playground.py +154 -0
- devin/nodes/insight/prompt.md +61 -0
- devin/nodes/insight/scenarios/architecture_pattern_query.py +15 -0
- devin/nodes/insight/scenarios/architecture_pattern_query_evals.py +25 -0
- devin/nodes/insight/scenarios/codebase_exploration.py +15 -0
- devin/nodes/insight/scenarios/codebase_exploration_evals.py +23 -0
- devin/nodes/insight/scenarios/devin_ideation_routing.py +19 -0
- devin/nodes/insight/scenarios/devin_ideation_routing_evals.py +39 -0
- devin/nodes/insight/scenarios/devin_insight_routing.py +20 -0
- devin/nodes/insight/scenarios/devin_insight_routing_evals.py +40 -0
- devin/nodes/insight/scenarios/operational_debugging.py +15 -0
- devin/nodes/insight/scenarios/operational_debugging_evals.py +23 -0
- devin/nodes/insight/scenarios/operational_question.py +9 -0
- devin/nodes/insight/scenarios/operational_question_evals.py +8 -0
- devin/nodes/insight/scenarios/queue_status.py +15 -0
- devin/nodes/insight/scenarios/queue_status_evals.py +23 -0
- devin/nodes/insight/scenarios/source_doc_explanation.py +14 -0
- devin/nodes/insight/scenarios/source_doc_explanation_evals.py +21 -0
- devin/nodes/insight/scenarios/worker_state_check.py +15 -0
- devin/nodes/insight/scenarios/worker_state_check_evals.py +22 -0
- devin/nodes/insight/tools.json +126 -0
- devin/nodes/intake/__init__.py +0 -0
- devin/nodes/intake/node.py +27 -0
- devin/nodes/intake/playground.py +47 -0
- devin/nodes/intake/prompt.md +12 -0
- devin/nodes/intake/scenarios/ideation_routing.py +4 -0
- devin/nodes/intake/scenarios/ideation_routing_evals.py +5 -0
- devin/nodes/intake/scenarios/insight_routing.py +4 -0
- devin/nodes/intake/scenarios/insight_routing_evals.py +5 -0
- devin/nodes/iterate/README.md +44 -0
- devin/nodes/iterate/__init__.py +1 -0
- devin/nodes/iterate/_archived_design_stages/01-objectives-requirements.md +112 -0
- devin/nodes/iterate/_archived_design_stages/02-evals.md +131 -0
- devin/nodes/iterate/_archived_design_stages/03-tools-and-boundaries.md +110 -0
- devin/nodes/iterate/_archived_design_stages/04-harness-and-playground.md +32 -0
- devin/nodes/iterate/_archived_design_stages/05-prompt-deferred.md +11 -0
- devin/nodes/iterate/_archived_design_stages/coder_agent_design/01-objectives-requirements.md +20 -0
- devin/nodes/iterate/_archived_design_stages/coder_agent_design/02-evals.md +8 -0
- devin/nodes/iterate/_archived_design_stages/coder_agent_design/03-tools-and-boundaries.md +14 -0
- devin/nodes/iterate/_archived_design_stages/coder_agent_design/04-harness-and-playground.md +12 -0
- devin/nodes/iterate/_archived_design_stages/framer_agent_design/01-objectives-requirements.md +20 -0
- devin/nodes/iterate/_archived_design_stages/framer_agent_design/02-evals.md +8 -0
- devin/nodes/iterate/_archived_design_stages/framer_agent_design/03-tools-and-boundaries.md +13 -0
- devin/nodes/iterate/_archived_design_stages/framer_agent_design/04-harness-and-playground.md +12 -0
- devin/nodes/iterate/_archived_design_stages/iterator_agent_design/01-objectives-requirements.md +25 -0
- devin/nodes/iterate/_archived_design_stages/iterator_agent_design/02-evals.md +9 -0
- devin/nodes/iterate/_archived_design_stages/iterator_agent_design/03-tools-and-boundaries.md +14 -0
- devin/nodes/iterate/_archived_design_stages/iterator_agent_design/04-harness-and-playground.md +12 -0
- devin/nodes/iterate/_archived_design_stages/observer_agent_design/01-objectives-requirements.md +20 -0
- devin/nodes/iterate/_archived_design_stages/observer_agent_design/02-evals.md +8 -0
- devin/nodes/iterate/_archived_design_stages/observer_agent_design/03-tools-and-boundaries.md +14 -0
- devin/nodes/iterate/_archived_design_stages/observer_agent_design/04-harness-and-playground.md +13 -0
- devin/nodes/iterate/agent-roles.md +89 -0
- devin/nodes/iterate/agents/README.md +10 -0
- devin/nodes/iterate/artifacts.md +504 -0
- devin/nodes/iterate/contract.md +100 -0
- devin/nodes/iterate/eval-plan.md +74 -0
- devin/nodes/iterate/node.py +100 -0
- devin/nodes/iterate/pipeline/README.md +13 -0
- devin/nodes/iterate/playground-contract.md +76 -0
- devin/nodes/iterate/prompt.md +11 -0
- devin/nodes/iterate/scenarios/README.md +38 -0
- devin/nodes/iterate/scenarios/artifact-and-loop-scenarios.md +101 -0
- devin/nodes/iterate/scenarios/coder_artifact_alignment.py +32 -0
- devin/nodes/iterate/scenarios/coder_artifact_alignment_evals.py +45 -0
- devin/nodes/iterate/scenarios/coder_bounded_fix.py +27 -0
- devin/nodes/iterate/scenarios/coder_bounded_fix_evals.py +45 -0
- devin/nodes/iterate/scenarios/devin_iterate_routing.py +21 -0
- devin/nodes/iterate/scenarios/devin_iterate_routing_evals.py +36 -0
- devin/nodes/iterate/scenarios/framer_scope_boundary.py +25 -0
- devin/nodes/iterate/scenarios/framer_scope_boundary_evals.py +57 -0
- devin/nodes/iterate/scenarios/framer_task_framing.py +25 -0
- devin/nodes/iterate/scenarios/framer_task_framing_evals.py +58 -0
- devin/nodes/iterate/scenarios/iterate_error_fix.py +21 -0
- devin/nodes/iterate/scenarios/iterate_error_fix_evals.py +39 -0
- devin/nodes/iterate/scenarios/iterate_quick_change.py +21 -0
- devin/nodes/iterate/scenarios/iterate_quick_change_evals.py +35 -0
- devin/nodes/iterate/scenarios/iterate_to_idea_promotion.py +23 -0
- devin/nodes/iterate/scenarios/iterate_to_idea_promotion_evals.py +53 -0
- devin/nodes/iterate/scenarios/iterate_to_insight_reroute.py +23 -0
- devin/nodes/iterate/scenarios/iterate_to_insight_reroute_evals.py +53 -0
- devin/nodes/iterate/scenarios/observer_evidence_seam.py +28 -0
- devin/nodes/iterate/scenarios/observer_evidence_seam_evals.py +55 -0
- devin/nodes/iterate/scenarios/observer_repro_creation.py +28 -0
- devin/nodes/iterate/scenarios/observer_repro_creation_evals.py +45 -0
- devin/nodes/iterate/scenarios/routing-matrix.md +45 -0
- devin/nodes/shared/__init__.py +0 -0
- devin/nodes/shared/filemaker_expert.md +80 -0
- devin/nodes/shared/filemaker_expert.py +354 -0
- devin/nodes/shared/filemaker_expert_eval/runner.py +176 -0
- devin/nodes/shared/filemaker_expert_eval/scenarios.json +65 -0
- devin/nodes/shared/goldilocks_advisor_eval/runner.py +214 -0
- devin/nodes/shared/goldilocks_advisor_eval/scenarios.json +58 -0
- devin/nodes/shared/helpers.py +156 -0
- devin/nodes/shared/idea_compliance_advisor_eval/runner.py +252 -0
- devin/nodes/shared/idea_compliance_advisor_eval/scenarios.json +75 -0
- devin/nodes/shared/models.py +44 -0
- devin/nodes/shared/post.py +40 -0
- devin/nodes/shared/router.py +107 -0
- devin/nodes/shared/tools.py +191 -0
- devin/shared/devin-chat-rubric.md +237 -0
- devin/shared/devin-chat-scenario-suite.md +90 -0
- devin/shared/eval_doctrine.md +9 -0
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import subprocess
|
|
5
|
+
import time
|
|
6
|
+
import uuid
|
|
7
|
+
from dataclasses import dataclass
|
|
8
|
+
from datetime import datetime, timezone
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from typing import Any, Callable, Optional
|
|
11
|
+
|
|
12
|
+
from pydantic import BaseModel
|
|
13
|
+
|
|
14
|
+
from ..stores.execution_store import ExecutionStore
|
|
15
|
+
from ..vendor.datalumina_genai.core.nodes.base import Node
|
|
16
|
+
from ..vendor.datalumina_genai.core.nodes.router import BaseRouter, RouterNode
|
|
17
|
+
from ..vendor.datalumina_genai.core.schema import NodeConfig, WorkflowSchema
|
|
18
|
+
from ..vendor.datalumina_genai.core.task import TaskContext
|
|
19
|
+
from ..vendor.datalumina_genai.core.workflow import Workflow
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class ErrorSolverEvent(BaseModel):
|
|
23
|
+
repo_root: str
|
|
24
|
+
error_task_id: str
|
|
25
|
+
runtime_context: dict[str, Any] | None = None
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
_CURRENT_STORE: ExecutionStore | None = None
|
|
29
|
+
_CURRENT_FUNCS: dict[str, Any] | None = None
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def configure_runtime(*, store: ExecutionStore, funcs: dict[str, Any]) -> None:
|
|
33
|
+
global _CURRENT_STORE, _CURRENT_FUNCS
|
|
34
|
+
_CURRENT_STORE = store
|
|
35
|
+
_CURRENT_FUNCS = funcs
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _runtime() -> tuple[ExecutionStore, dict[str, Any]]:
|
|
39
|
+
if _CURRENT_STORE is None or _CURRENT_FUNCS is None:
|
|
40
|
+
raise RuntimeError("Error solver DAG missing runtime store/functions")
|
|
41
|
+
return _CURRENT_STORE, _CURRENT_FUNCS
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _utc_now_iso() -> str:
|
|
45
|
+
return datetime.now(timezone.utc).isoformat()
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _tail_text(path: Path, *, max_chars: int = 4000) -> str:
|
|
49
|
+
try:
|
|
50
|
+
data = path.read_text(encoding="utf-8")
|
|
51
|
+
except Exception:
|
|
52
|
+
return ""
|
|
53
|
+
return data[-max_chars:]
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _append_error_solver_journal(
|
|
57
|
+
*,
|
|
58
|
+
repo_root: Path,
|
|
59
|
+
error_task_id: str,
|
|
60
|
+
outcome: str,
|
|
61
|
+
title: str | None,
|
|
62
|
+
fingerprint: str | None,
|
|
63
|
+
verification: dict[str, Any] | None,
|
|
64
|
+
reason: str | None,
|
|
65
|
+
context_path: Path,
|
|
66
|
+
runtime_context: dict[str, Any] | None,
|
|
67
|
+
prior_runs: dict[str, Any] | None,
|
|
68
|
+
) -> Path:
|
|
69
|
+
d = repo_root / ".devflow" / "journal"
|
|
70
|
+
d.mkdir(parents=True, exist_ok=True)
|
|
71
|
+
day = datetime.now(timezone.utc).strftime("%Y-%m-%d")
|
|
72
|
+
md = d / f"{day}.md"
|
|
73
|
+
|
|
74
|
+
current_record = runtime_context.get("currentRecord") if isinstance(runtime_context, dict) and isinstance(runtime_context.get("currentRecord"), dict) else {}
|
|
75
|
+
latest_resolved = prior_runs.get("latestResolved") if isinstance(prior_runs, dict) and isinstance(prior_runs.get("latestResolved"), dict) else None
|
|
76
|
+
|
|
77
|
+
lines = [
|
|
78
|
+
f"## Error solver conclusion {uuid.uuid4().hex[:8]}",
|
|
79
|
+
f"- time (UTC): {_utc_now_iso()}",
|
|
80
|
+
f"- repo: `{repo_root}`",
|
|
81
|
+
f"- error_task_id: `{error_task_id}`",
|
|
82
|
+
f"- title: `{title or ''}`",
|
|
83
|
+
f"- fingerprint: `{fingerprint or ''}`",
|
|
84
|
+
f"- outcome: `{outcome}`",
|
|
85
|
+
f"- reason: `{reason or ''}`",
|
|
86
|
+
f"- context: `{context_path}`",
|
|
87
|
+
f"- current_triage_status: `{current_record.get('triage_status') or ''}`",
|
|
88
|
+
f"- previous_resolved_error_task_id: `{(latest_resolved or {}).get('errorTaskId') or ''}`",
|
|
89
|
+
"",
|
|
90
|
+
"Summary:",
|
|
91
|
+
"```",
|
|
92
|
+
json.dumps(
|
|
93
|
+
{
|
|
94
|
+
"verification": verification,
|
|
95
|
+
"current_record": current_record,
|
|
96
|
+
"latest_resolved": latest_resolved,
|
|
97
|
+
},
|
|
98
|
+
indent=2,
|
|
99
|
+
sort_keys=True,
|
|
100
|
+
)[:8000],
|
|
101
|
+
"```",
|
|
102
|
+
"",
|
|
103
|
+
]
|
|
104
|
+
|
|
105
|
+
if md.exists():
|
|
106
|
+
existing = md.read_text(encoding="utf-8")
|
|
107
|
+
if not existing.endswith("\n"):
|
|
108
|
+
existing += "\n"
|
|
109
|
+
md.write_text(existing + "\n".join(lines), encoding="utf-8")
|
|
110
|
+
else:
|
|
111
|
+
md.write_text("# LLM Journal\n\n" + "\n".join(lines), encoding="utf-8")
|
|
112
|
+
|
|
113
|
+
return md
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def _read_recent_journal(repo_root: Path, *, limit_files: int = 3, max_chars: int = 6000) -> dict[str, Any]:
|
|
117
|
+
journal_dir = repo_root / ".devflow" / "journal"
|
|
118
|
+
if not journal_dir.exists():
|
|
119
|
+
return {"entries": [], "summary": ""}
|
|
120
|
+
|
|
121
|
+
files = sorted(journal_dir.glob("*.md"))[-limit_files:]
|
|
122
|
+
entries: list[dict[str, Any]] = []
|
|
123
|
+
chunks: list[str] = []
|
|
124
|
+
for path in files:
|
|
125
|
+
tail = _tail_text(path, max_chars=max_chars // max(1, len(files)))
|
|
126
|
+
entries.append({"path": str(path), "excerpt": tail})
|
|
127
|
+
if tail:
|
|
128
|
+
chunks.append(f"# {path.name}\n{tail}")
|
|
129
|
+
summary = "\n\n".join(chunks)
|
|
130
|
+
return {"entries": entries, "summary": summary[-max_chars:]}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def _git_changes_since(repo_root: Path, *, unix_ts: int | None) -> dict[str, Any]:
|
|
134
|
+
if not unix_ts:
|
|
135
|
+
return {"summary": "", "commits": []}
|
|
136
|
+
cmd = [
|
|
137
|
+
"git",
|
|
138
|
+
"-C",
|
|
139
|
+
str(repo_root),
|
|
140
|
+
"log",
|
|
141
|
+
f"--since=@{int(unix_ts)}",
|
|
142
|
+
"--date=iso",
|
|
143
|
+
"--pretty=format:%H%x09%ad%x09%s",
|
|
144
|
+
"--name-only",
|
|
145
|
+
"--no-merges",
|
|
146
|
+
"-n",
|
|
147
|
+
"20",
|
|
148
|
+
]
|
|
149
|
+
cp = subprocess.run(cmd, text=True, capture_output=True, check=False)
|
|
150
|
+
if cp.returncode != 0:
|
|
151
|
+
return {"summary": "", "commits": [], "error": (cp.stderr or cp.stdout)[-2000:]}
|
|
152
|
+
text = (cp.stdout or "").strip()
|
|
153
|
+
return {"summary": text[-8000:], "commits": []}
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def _load_prior_runs(*, store: ExecutionStore, repo_root: Path, error_task_id: str, fingerprint: str | None) -> dict[str, Any]:
|
|
157
|
+
if not fingerprint:
|
|
158
|
+
return {"resolvedSiblings": [], "latestResolved": None, "gitChangesSinceLatestResolved": {"summary": "", "commits": []}, "devJournal": _read_recent_journal(repo_root)}
|
|
159
|
+
|
|
160
|
+
resolved_rows: list[dict[str, Any]] = []
|
|
161
|
+
with store._connect() as conn:
|
|
162
|
+
rows = conn.execute(
|
|
163
|
+
"SELECT error_task_id, title, message, updated_at, created_at, status FROM error_tasks WHERE fingerprint=? AND error_task_id<>? AND status='resolved' ORDER BY updated_at DESC LIMIT 5",
|
|
164
|
+
(fingerprint, error_task_id),
|
|
165
|
+
).fetchall()
|
|
166
|
+
for row in rows:
|
|
167
|
+
sibling_id = row["error_task_id"]
|
|
168
|
+
context_path = repo_root / ".devflow" / "errors" / "logs" / sibling_id / "context.json"
|
|
169
|
+
sibling_context = None
|
|
170
|
+
fix_summary = None
|
|
171
|
+
if context_path.exists():
|
|
172
|
+
try:
|
|
173
|
+
sibling_context = json.loads(context_path.read_text(encoding="utf-8"))
|
|
174
|
+
except Exception:
|
|
175
|
+
sibling_context = None
|
|
176
|
+
if isinstance(sibling_context, dict):
|
|
177
|
+
first_pass = ((sibling_context.get("FirstPassFix") or {}).get("output")) or {}
|
|
178
|
+
iterative = ((sibling_context.get("IterativeFix") or {}).get("output")) or {}
|
|
179
|
+
verification = ((sibling_context.get("Resolve") or {}).get("output")) or {}
|
|
180
|
+
fix_summary = {
|
|
181
|
+
"firstPass": first_pass,
|
|
182
|
+
"iterative": iterative,
|
|
183
|
+
"resolve": verification,
|
|
184
|
+
}
|
|
185
|
+
resolved_rows.append(
|
|
186
|
+
{
|
|
187
|
+
"errorTaskId": sibling_id,
|
|
188
|
+
"title": row["title"],
|
|
189
|
+
"message": row["message"],
|
|
190
|
+
"updatedAt": row["updated_at"],
|
|
191
|
+
"createdAt": row["created_at"],
|
|
192
|
+
"status": row["status"],
|
|
193
|
+
"contextPath": str(context_path),
|
|
194
|
+
"fixSummary": fix_summary,
|
|
195
|
+
}
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
latest = resolved_rows[0] if resolved_rows else None
|
|
199
|
+
latest_ts = int(latest["updatedAt"]) if latest and latest.get("updatedAt") else None
|
|
200
|
+
return {
|
|
201
|
+
"resolvedSiblings": resolved_rows,
|
|
202
|
+
"latestResolved": latest,
|
|
203
|
+
"gitChangesSinceLatestResolved": _git_changes_since(repo_root, unix_ts=latest_ts),
|
|
204
|
+
"devJournal": _read_recent_journal(repo_root),
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
@dataclass
|
|
209
|
+
class ContextPersistor:
|
|
210
|
+
repo_root: Path
|
|
211
|
+
error_task_id: str
|
|
212
|
+
|
|
213
|
+
def __post_init__(self) -> None:
|
|
214
|
+
self.repo_root = Path(self.repo_root)
|
|
215
|
+
self.logs_dir = self.repo_root / ".devflow" / "errors" / "logs" / self.error_task_id
|
|
216
|
+
self.logs_dir.mkdir(parents=True, exist_ok=True)
|
|
217
|
+
self.context_path = self.logs_dir / "context.json"
|
|
218
|
+
|
|
219
|
+
def init(
|
|
220
|
+
self,
|
|
221
|
+
*,
|
|
222
|
+
title: str | None = None,
|
|
223
|
+
error_type: str | None = None,
|
|
224
|
+
runtime_context: dict[str, Any] | None = None,
|
|
225
|
+
prior_runs: dict[str, Any] | None = None,
|
|
226
|
+
) -> dict[str, Any]:
|
|
227
|
+
now = int(time.time())
|
|
228
|
+
ctx: dict[str, Any] = {
|
|
229
|
+
"metadata": {
|
|
230
|
+
"workflowStarted": now,
|
|
231
|
+
"errorId": self.error_task_id,
|
|
232
|
+
"projectPath": str(self.repo_root),
|
|
233
|
+
"errorType": error_type,
|
|
234
|
+
"priority": None,
|
|
235
|
+
"sessionId": None,
|
|
236
|
+
"title": title,
|
|
237
|
+
"node_order": [],
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
if runtime_context is not None:
|
|
241
|
+
ctx["runtimeContext"] = runtime_context
|
|
242
|
+
if prior_runs is not None:
|
|
243
|
+
ctx["priorRuns"] = prior_runs
|
|
244
|
+
self.context_path.write_text(json.dumps(ctx, sort_keys=True, indent=2) + "\n")
|
|
245
|
+
return ctx
|
|
246
|
+
|
|
247
|
+
def persist(self, *, context: dict[str, Any], node_name: str, output: dict[str, Any]) -> None:
|
|
248
|
+
context.setdefault("metadata", {})
|
|
249
|
+
context["metadata"]["lastUpdated"] = int(time.time())
|
|
250
|
+
context["metadata"].setdefault("node_order", []).append(node_name)
|
|
251
|
+
context[node_name] = {"timestamp": int(time.time()), "output": output}
|
|
252
|
+
self.context_path.write_text(json.dumps(context, sort_keys=True, indent=2) + "\n")
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
class BuildObservabilityNode(Node):
|
|
256
|
+
class OutputType(BaseModel):
|
|
257
|
+
observable: bool = True
|
|
258
|
+
details: dict[str, Any] = {}
|
|
259
|
+
|
|
260
|
+
async def process(self, task_context: TaskContext) -> TaskContext:
|
|
261
|
+
store, funcs = _runtime()
|
|
262
|
+
repo_root = Path(task_context.event.repo_root)
|
|
263
|
+
error_task_id = task_context.event.error_task_id
|
|
264
|
+
|
|
265
|
+
# Ensure we have a persistor + base context
|
|
266
|
+
persistor: ContextPersistor = task_context.metadata.setdefault(
|
|
267
|
+
"context_persistor", ContextPersistor(repo_root=repo_root, error_task_id=error_task_id)
|
|
268
|
+
)
|
|
269
|
+
context: dict[str, Any] = task_context.metadata.get("context_json")
|
|
270
|
+
if context is None:
|
|
271
|
+
db_fingerprint = None
|
|
272
|
+
with store._connect() as conn: # best-effort read
|
|
273
|
+
row = conn.execute(
|
|
274
|
+
"SELECT title, error_type, fingerprint FROM error_tasks WHERE error_task_id=?",
|
|
275
|
+
(error_task_id,),
|
|
276
|
+
).fetchone()
|
|
277
|
+
title = None
|
|
278
|
+
error_type = None
|
|
279
|
+
if row is not None:
|
|
280
|
+
title = row[0]
|
|
281
|
+
error_type = row[1]
|
|
282
|
+
db_fingerprint = row[2]
|
|
283
|
+
runtime_context = task_context.event.runtime_context if isinstance(task_context.event.runtime_context, dict) else None
|
|
284
|
+
prior_runs = _load_prior_runs(
|
|
285
|
+
store=store,
|
|
286
|
+
repo_root=repo_root,
|
|
287
|
+
error_task_id=error_task_id,
|
|
288
|
+
fingerprint=str(db_fingerprint) if isinstance(db_fingerprint, str) and db_fingerprint else None,
|
|
289
|
+
)
|
|
290
|
+
context = persistor.init(
|
|
291
|
+
title=title,
|
|
292
|
+
error_type=error_type,
|
|
293
|
+
runtime_context=runtime_context,
|
|
294
|
+
prior_runs=prior_runs,
|
|
295
|
+
)
|
|
296
|
+
task_context.metadata["context_json"] = context
|
|
297
|
+
|
|
298
|
+
fn: Callable[[dict[str, Any]], dict[str, Any]] = funcs["build_observability_fn"]
|
|
299
|
+
out = fn(context)
|
|
300
|
+
persistor.persist(context=context, node_name="BuildObservability", output=out)
|
|
301
|
+
self.save_output(BuildObservabilityNode.OutputType(**{"observable": bool(out.get("observable", True)), "details": out}))
|
|
302
|
+
return task_context
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
class FirstPassFixNode(Node):
|
|
306
|
+
class OutputType(BaseModel):
|
|
307
|
+
fixed: bool = False
|
|
308
|
+
verification: dict[str, Any] | None = None
|
|
309
|
+
|
|
310
|
+
async def process(self, task_context: TaskContext) -> TaskContext:
|
|
311
|
+
_, funcs = _runtime()
|
|
312
|
+
persistor: ContextPersistor = task_context.metadata["context_persistor"]
|
|
313
|
+
context: dict[str, Any] = task_context.metadata["context_json"]
|
|
314
|
+
|
|
315
|
+
fn: Callable[[dict[str, Any]], dict[str, Any]] = funcs["first_pass_fix_fn"]
|
|
316
|
+
out = fn(context)
|
|
317
|
+
persistor.persist(context=context, node_name="FirstPassFix", output=out)
|
|
318
|
+
self.save_output(
|
|
319
|
+
FirstPassFixNode.OutputType(
|
|
320
|
+
fixed=bool(out.get("fixed")),
|
|
321
|
+
verification=out.get("verification"),
|
|
322
|
+
)
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
task_context.metadata["fixed"] = bool(out.get("fixed"))
|
|
326
|
+
task_context.metadata["verification"] = out.get("verification")
|
|
327
|
+
return task_context
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
class IterativeFixNode(Node):
|
|
331
|
+
class OutputType(BaseModel):
|
|
332
|
+
fixed: bool = False
|
|
333
|
+
details: dict[str, Any] = {}
|
|
334
|
+
|
|
335
|
+
async def process(self, task_context: TaskContext) -> TaskContext:
|
|
336
|
+
_, funcs = _runtime()
|
|
337
|
+
persistor: ContextPersistor = task_context.metadata["context_persistor"]
|
|
338
|
+
context: dict[str, Any] = task_context.metadata["context_json"]
|
|
339
|
+
|
|
340
|
+
# Only run if not already fixed.
|
|
341
|
+
if task_context.metadata.get("fixed"):
|
|
342
|
+
self.save_output(IterativeFixNode.OutputType(fixed=True, details={"skipped": True}))
|
|
343
|
+
return task_context
|
|
344
|
+
|
|
345
|
+
fn: Callable[[dict[str, Any]], dict[str, Any]] = funcs["iterative_fix_fn"]
|
|
346
|
+
out = fn(context)
|
|
347
|
+
persistor.persist(context=context, node_name="IterativeFix", output=out)
|
|
348
|
+
self.save_output(IterativeFixNode.OutputType(fixed=bool(out.get("fixed")), details=out))
|
|
349
|
+
|
|
350
|
+
task_context.metadata["fixed"] = bool(out.get("fixed"))
|
|
351
|
+
if out.get("verification") is not None:
|
|
352
|
+
task_context.metadata["verification"] = out.get("verification")
|
|
353
|
+
return task_context
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
class FinalOutcomeRouteNode(Node):
|
|
357
|
+
class OutputType(BaseModel):
|
|
358
|
+
fixed: bool
|
|
359
|
+
outcome: str
|
|
360
|
+
|
|
361
|
+
async def process(self, task_context: TaskContext) -> TaskContext:
|
|
362
|
+
_, funcs = _runtime()
|
|
363
|
+
persistor: ContextPersistor = task_context.metadata["context_persistor"]
|
|
364
|
+
context: dict[str, Any] = task_context.metadata["context_json"]
|
|
365
|
+
|
|
366
|
+
fixed = bool(task_context.metadata.get("fixed"))
|
|
367
|
+
needs_user_input_fn: Callable[[dict[str, Any]], bool] = funcs["needs_user_input_fn"]
|
|
368
|
+
needs_user_input = bool(needs_user_input_fn(context))
|
|
369
|
+
|
|
370
|
+
outcome = "resolved" if fixed else ("blocked" if needs_user_input else "blocked")
|
|
371
|
+
out = {"fixed": fixed, "needs_user_input": needs_user_input, "outcome": outcome}
|
|
372
|
+
persistor.persist(context=context, node_name="FinalOutcomeRoute", output=out)
|
|
373
|
+
self.save_output(FinalOutcomeRouteNode.OutputType(fixed=fixed, outcome=outcome))
|
|
374
|
+
return task_context
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
class ResolveNode(Node):
|
|
378
|
+
class OutputType(BaseModel):
|
|
379
|
+
verified: bool
|
|
380
|
+
verification: dict[str, Any] | None = None
|
|
381
|
+
|
|
382
|
+
async def process(self, task_context: TaskContext) -> TaskContext:
|
|
383
|
+
store, _ = _runtime()
|
|
384
|
+
persistor: ContextPersistor = task_context.metadata["context_persistor"]
|
|
385
|
+
context: dict[str, Any] = task_context.metadata["context_json"]
|
|
386
|
+
error_task_id = task_context.event.error_task_id
|
|
387
|
+
|
|
388
|
+
verification = task_context.metadata.get("verification")
|
|
389
|
+
verified = bool((verification or {}).get("green_gate"))
|
|
390
|
+
runtime_context = context.get("runtimeContext") if isinstance(context.get("runtimeContext"), dict) else None
|
|
391
|
+
prior_runs = context.get("priorRuns") if isinstance(context.get("priorRuns"), dict) else None
|
|
392
|
+
fingerprint = None
|
|
393
|
+
if isinstance(runtime_context, dict):
|
|
394
|
+
current_record = runtime_context.get("currentRecord") if isinstance(runtime_context.get("currentRecord"), dict) else {}
|
|
395
|
+
fingerprint = runtime_context.get("fingerprint") or current_record.get("fingerprint")
|
|
396
|
+
title = context.get("metadata", {}).get("title") if isinstance(context.get("metadata"), dict) else None
|
|
397
|
+
|
|
398
|
+
persistor.persist(context=context, node_name="Resolve", output={"verification": verification, "verified": verified})
|
|
399
|
+
self.save_output(ResolveNode.OutputType(verified=verified, verification=verification))
|
|
400
|
+
|
|
401
|
+
if verified:
|
|
402
|
+
with store._connect() as conn:
|
|
403
|
+
conn.execute(
|
|
404
|
+
"UPDATE error_tasks SET status='resolved', updated_at=? WHERE error_task_id=?",
|
|
405
|
+
(int(time.time()), error_task_id),
|
|
406
|
+
)
|
|
407
|
+
task_context.metadata["outcome"] = "resolved"
|
|
408
|
+
task_context.metadata["reason"] = None
|
|
409
|
+
else:
|
|
410
|
+
# verification failure: do NOT resolve.
|
|
411
|
+
with store._connect() as conn:
|
|
412
|
+
conn.execute(
|
|
413
|
+
"UPDATE error_tasks SET status='in_progress', updated_at=? WHERE error_task_id=?",
|
|
414
|
+
(int(time.time()), error_task_id),
|
|
415
|
+
)
|
|
416
|
+
task_context.metadata["outcome"] = "in_progress"
|
|
417
|
+
task_context.metadata["reason"] = "verification_failed"
|
|
418
|
+
|
|
419
|
+
_append_error_solver_journal(
|
|
420
|
+
repo_root=persistor.repo_root,
|
|
421
|
+
error_task_id=error_task_id,
|
|
422
|
+
outcome=str(task_context.metadata.get("outcome") or "in_progress"),
|
|
423
|
+
title=str(title) if title is not None else None,
|
|
424
|
+
fingerprint=str(fingerprint) if fingerprint is not None else None,
|
|
425
|
+
verification=verification,
|
|
426
|
+
reason=str(task_context.metadata.get("reason")) if task_context.metadata.get("reason") else None,
|
|
427
|
+
context_path=persistor.context_path,
|
|
428
|
+
runtime_context=runtime_context,
|
|
429
|
+
prior_runs=prior_runs,
|
|
430
|
+
)
|
|
431
|
+
|
|
432
|
+
task_context.stop_workflow()
|
|
433
|
+
return task_context
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
class BlockNode(Node):
|
|
437
|
+
class OutputType(BaseModel):
|
|
438
|
+
reason: str
|
|
439
|
+
|
|
440
|
+
async def process(self, task_context: TaskContext) -> TaskContext:
|
|
441
|
+
store, funcs = _runtime()
|
|
442
|
+
persistor: ContextPersistor = task_context.metadata["context_persistor"]
|
|
443
|
+
context: dict[str, Any] = task_context.metadata["context_json"]
|
|
444
|
+
error_task_id = task_context.event.error_task_id
|
|
445
|
+
|
|
446
|
+
needs_user_input_fn: Callable[[dict[str, Any]], bool] = funcs["needs_user_input_fn"]
|
|
447
|
+
needs_user_input = bool(needs_user_input_fn(context))
|
|
448
|
+
reason = "user_input_required" if needs_user_input else "attempts_exhausted"
|
|
449
|
+
runtime_context = context.get("runtimeContext") if isinstance(context.get("runtimeContext"), dict) else None
|
|
450
|
+
prior_runs = context.get("priorRuns") if isinstance(context.get("priorRuns"), dict) else None
|
|
451
|
+
fingerprint = None
|
|
452
|
+
if isinstance(runtime_context, dict):
|
|
453
|
+
current_record = runtime_context.get("currentRecord") if isinstance(runtime_context.get("currentRecord"), dict) else {}
|
|
454
|
+
fingerprint = runtime_context.get("fingerprint") or current_record.get("fingerprint")
|
|
455
|
+
title = context.get("metadata", {}).get("title") if isinstance(context.get("metadata"), dict) else None
|
|
456
|
+
|
|
457
|
+
persistor.persist(context=context, node_name="Block", output={"reason": reason})
|
|
458
|
+
self.save_output(BlockNode.OutputType(reason=reason))
|
|
459
|
+
|
|
460
|
+
with store._connect() as conn:
|
|
461
|
+
conn.execute(
|
|
462
|
+
"UPDATE error_tasks SET status='blocked', updated_at=? WHERE error_task_id=?",
|
|
463
|
+
(int(time.time()), error_task_id),
|
|
464
|
+
)
|
|
465
|
+
|
|
466
|
+
task_context.metadata["outcome"] = "blocked"
|
|
467
|
+
_append_error_solver_journal(
|
|
468
|
+
repo_root=persistor.repo_root,
|
|
469
|
+
error_task_id=error_task_id,
|
|
470
|
+
outcome="blocked",
|
|
471
|
+
title=str(title) if title is not None else None,
|
|
472
|
+
fingerprint=str(fingerprint) if fingerprint is not None else None,
|
|
473
|
+
verification=task_context.metadata.get("verification"),
|
|
474
|
+
reason=reason,
|
|
475
|
+
context_path=persistor.context_path,
|
|
476
|
+
runtime_context=runtime_context,
|
|
477
|
+
prior_runs=prior_runs,
|
|
478
|
+
)
|
|
479
|
+
task_context.stop_workflow()
|
|
480
|
+
return task_context
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
class _RouteToResolve(RouterNode):
|
|
484
|
+
def determine_next_node(self, task_context: TaskContext) -> Optional[Node]:
|
|
485
|
+
route = task_context.nodes.get(FinalOutcomeRouteNode.__name__)
|
|
486
|
+
fixed = bool(getattr(route, "fixed", None)) if route is not None else bool(task_context.metadata.get("fixed"))
|
|
487
|
+
if fixed:
|
|
488
|
+
return ResolveNode(task_context=task_context)
|
|
489
|
+
return None
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
class _RouteToBlock(RouterNode):
|
|
493
|
+
def determine_next_node(self, task_context: TaskContext) -> Optional[Node]:
|
|
494
|
+
route = task_context.nodes.get(FinalOutcomeRouteNode.__name__)
|
|
495
|
+
fixed = bool(getattr(route, "fixed", None)) if route is not None else bool(task_context.metadata.get("fixed"))
|
|
496
|
+
if not fixed:
|
|
497
|
+
return BlockNode(task_context=task_context)
|
|
498
|
+
return None
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
class FinalOutcomeRouter(BaseRouter):
|
|
502
|
+
def __init__(self) -> None:
|
|
503
|
+
# Router reads from task_context via RouterNode wrappers.
|
|
504
|
+
self.routes = [_RouteToResolve(), _RouteToBlock()]
|
|
505
|
+
self.fallback = BlockNode()
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
class ErrorSolverWorkflow(Workflow):
|
|
509
|
+
workflow_schema: WorkflowSchema = WorkflowSchema(
|
|
510
|
+
description="US-8.5 error solver DAG (Electron parity)",
|
|
511
|
+
event_schema=ErrorSolverEvent,
|
|
512
|
+
start=BuildObservabilityNode,
|
|
513
|
+
nodes=[
|
|
514
|
+
NodeConfig(node=BuildObservabilityNode, connections=[FirstPassFixNode]),
|
|
515
|
+
NodeConfig(node=FirstPassFixNode, connections=[IterativeFixNode]),
|
|
516
|
+
NodeConfig(node=IterativeFixNode, connections=[FinalOutcomeRouteNode]),
|
|
517
|
+
NodeConfig(node=FinalOutcomeRouteNode, connections=[FinalOutcomeRouter]),
|
|
518
|
+
NodeConfig(node=FinalOutcomeRouter, connections=[ResolveNode, BlockNode], is_router=True),
|
|
519
|
+
NodeConfig(node=ResolveNode, connections=[]),
|
|
520
|
+
NodeConfig(node=BlockNode, connections=[]),
|
|
521
|
+
],
|
|
522
|
+
)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"""Runtime observability bundle builder for the error-solver DAG."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import subprocess
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def build_runtime_observability(
|
|
10
|
+
*,
|
|
11
|
+
repo_root: Path,
|
|
12
|
+
runtime_context: dict[str, Any] | None = None,
|
|
13
|
+
repro_command: str | None = None,
|
|
14
|
+
project_id: str | None = None,
|
|
15
|
+
store: Any = None,
|
|
16
|
+
error_task_id: str | None = None,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
"""Gather observable runtime context for the error-solver DAG.
|
|
19
|
+
|
|
20
|
+
Returns a structured evidence bundle that the error-solver DAG passes to
|
|
21
|
+
its build_observability_fn hook so diagnose/fix nodes have environment
|
|
22
|
+
context (git status, recent logs, runtime_context payload, etc.).
|
|
23
|
+
"""
|
|
24
|
+
git_status: str = ""
|
|
25
|
+
git_log: str = ""
|
|
26
|
+
try:
|
|
27
|
+
r = subprocess.run(["git", "status", "--short"], cwd=str(repo_root), capture_output=True, text=True, check=False)
|
|
28
|
+
git_status = r.stdout.strip()
|
|
29
|
+
except Exception:
|
|
30
|
+
pass
|
|
31
|
+
try:
|
|
32
|
+
r = subprocess.run(["git", "log", "--oneline", "-10"], cwd=str(repo_root), capture_output=True, text=True, check=False)
|
|
33
|
+
git_log = r.stdout.strip()
|
|
34
|
+
except Exception:
|
|
35
|
+
pass
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
"artifactVersion": "runtime_evidence_bundle/v1",
|
|
39
|
+
"observable": True,
|
|
40
|
+
"repo_root": str(repo_root),
|
|
41
|
+
"project_id": project_id,
|
|
42
|
+
"error_task_id": error_task_id,
|
|
43
|
+
"runtime_context": runtime_context or {},
|
|
44
|
+
"repro_command": repro_command,
|
|
45
|
+
"git_status": git_status,
|
|
46
|
+
"git_log": git_log,
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def collect_runtime_evidence_bundle(
|
|
51
|
+
*,
|
|
52
|
+
repo_root: Path,
|
|
53
|
+
runtime_context: dict[str, Any] | None = None,
|
|
54
|
+
repro_command: str | None = None,
|
|
55
|
+
project_id: str | None = None,
|
|
56
|
+
store: Any = None,
|
|
57
|
+
error_task_id: str | None = None,
|
|
58
|
+
) -> dict[str, Any]:
|
|
59
|
+
"""Compatibility wrapper for the error-solver DAG import path."""
|
|
60
|
+
return build_runtime_observability(
|
|
61
|
+
repo_root=repo_root,
|
|
62
|
+
runtime_context=runtime_context,
|
|
63
|
+
repro_command=repro_command,
|
|
64
|
+
project_id=project_id,
|
|
65
|
+
store=store,
|
|
66
|
+
error_task_id=error_task_id,
|
|
67
|
+
)
|