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
devin/devin_eval.py
ADDED
|
@@ -0,0 +1,677 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
import shutil
|
|
6
|
+
import signal
|
|
7
|
+
from dataclasses import dataclass
|
|
8
|
+
from datetime import UTC, datetime
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from typing import Any, Literal
|
|
11
|
+
|
|
12
|
+
from pydantic import BaseModel, Field
|
|
13
|
+
|
|
14
|
+
from devflow_engine.agentic_prompts import load_agentic_prompt_lines
|
|
15
|
+
from devflow_engine.agentic_runtime import run_agent_step
|
|
16
|
+
from devin.dag import run_devin_chat_dag
|
|
17
|
+
from devflow_engine.stores.execution_store import ExecutionStore
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class DevinEvalScenario(BaseModel):
|
|
21
|
+
scenario_id: str = Field(min_length=1)
|
|
22
|
+
scenario_family: Literal[
|
|
23
|
+
"basic_new_idea",
|
|
24
|
+
"extend_existing_codebase",
|
|
25
|
+
"drive_devflow_commands",
|
|
26
|
+
"inform_current_codebase",
|
|
27
|
+
"diagnose_devflow_issue",
|
|
28
|
+
]
|
|
29
|
+
persona: str | None = None
|
|
30
|
+
mode: Literal["single_turn"] = "single_turn"
|
|
31
|
+
doctrine_tags: list[str] = Field(default_factory=list)
|
|
32
|
+
expected_judgment_focus: list[str] = Field(default_factory=list)
|
|
33
|
+
user_input: str = Field(min_length=1)
|
|
34
|
+
idea_id: str = Field(min_length=1)
|
|
35
|
+
max_stories: int = 0
|
|
36
|
+
planes: list[str] = Field(default_factory=list)
|
|
37
|
+
preloaded_history: list[dict[str, Any]] = Field(default_factory=list)
|
|
38
|
+
contract: dict[str, Any] = Field(default_factory=dict)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class DevinResponseAssessment(BaseModel):
|
|
42
|
+
usefulness: float = Field(ge=0.0, le=1.0)
|
|
43
|
+
supportiveness: float = Field(ge=0.0, le=1.0)
|
|
44
|
+
forward_progress: float = Field(ge=0.0, le=1.0)
|
|
45
|
+
request_relevance: float = Field(ge=0.0, le=1.0)
|
|
46
|
+
human_style: float = Field(ge=0.0, le=1.0)
|
|
47
|
+
conciseness: float = Field(ge=0.0, le=1.0)
|
|
48
|
+
non_overload: float = Field(ge=0.0, le=1.0)
|
|
49
|
+
command_accuracy: float = Field(ge=0.0, le=1.0, default=0.0)
|
|
50
|
+
codebase_accuracy: float = Field(ge=0.0, le=1.0, default=0.0)
|
|
51
|
+
process_diagnosis_accuracy: float = Field(ge=0.0, le=1.0, default=0.0)
|
|
52
|
+
must_mention_coverage: float = Field(ge=0.0, le=1.0)
|
|
53
|
+
must_not_violation_free: float = Field(ge=0.0, le=1.0)
|
|
54
|
+
contract_satisfaction: float = Field(ge=0.0, le=1.0)
|
|
55
|
+
notes: list[str] = Field(default_factory=list)
|
|
56
|
+
strengths: list[str] = Field(default_factory=list)
|
|
57
|
+
weaknesses: list[str] = Field(default_factory=list)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@dataclass(frozen=True)
|
|
61
|
+
class DevinEvalResult:
|
|
62
|
+
run_id: str
|
|
63
|
+
started_at: str
|
|
64
|
+
eval_root: Path
|
|
65
|
+
payload: dict[str, Any]
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class DevinChatEvalCatalog(BaseModel):
|
|
69
|
+
schema_version: str = Field(min_length=1)
|
|
70
|
+
doctrine_sources: list[str] = Field(default_factory=list)
|
|
71
|
+
design_notes: list[str] = Field(default_factory=list)
|
|
72
|
+
single_turn: list[DevinEvalScenario] = Field(default_factory=list)
|
|
73
|
+
multi_turn: list["DevinMultiTurnEvalScenario"] = Field(default_factory=list)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
DEVIN_CHAT_SCENARIO_CATALOG_PATH = Path(__file__).with_name("devin_chat_scenario_catalog.json")
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def load_devin_chat_eval_catalog(path: Path | None = None) -> DevinChatEvalCatalog:
|
|
80
|
+
catalog_path = (path or DEVIN_CHAT_SCENARIO_CATALOG_PATH).expanduser().resolve()
|
|
81
|
+
payload = json.loads(catalog_path.read_text(encoding="utf-8"))
|
|
82
|
+
return DevinChatEvalCatalog.model_validate(payload)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def _require_real_eval_runtime() -> None:
|
|
86
|
+
if os.environ.get("DEVFLOW_REAL_LLM_EVAL") != "1":
|
|
87
|
+
raise RuntimeError("Devin eval requires DEVFLOW_REAL_LLM_EVAL=1. Mocked/stub eval runs are forbidden.")
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def _now_run_id() -> tuple[str, str]:
|
|
91
|
+
started_at = datetime.now(UTC).replace(microsecond=0).isoformat().replace("+00:00", "Z")
|
|
92
|
+
run_id = started_at.replace("-", "").replace(":", "")
|
|
93
|
+
return run_id, started_at
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def _write_json(path: Path, payload: dict[str, Any]) -> None:
|
|
97
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
98
|
+
path.write_text(json.dumps(payload, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def _load_json(path: Path) -> dict[str, Any]:
|
|
102
|
+
return json.loads(path.read_text(encoding="utf-8"))
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def _copy_if_exists(src: Path, dst: Path) -> bool:
|
|
106
|
+
if not src.exists():
|
|
107
|
+
return False
|
|
108
|
+
dst.parent.mkdir(parents=True, exist_ok=True)
|
|
109
|
+
shutil.copy2(src, dst)
|
|
110
|
+
return True
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def _mean(values: list[float]) -> float:
|
|
114
|
+
if not values:
|
|
115
|
+
return 0.0
|
|
116
|
+
return round(sum(values) / len(values), 6)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def _seed_history(*, store: ExecutionStore, repo_root: Path, project_id: str, scenario: DevinEvalScenario) -> None:
|
|
120
|
+
if not scenario.preloaded_history:
|
|
121
|
+
return
|
|
122
|
+
run = store.start_run(kind="devin.eval.history_seed", repo_root=repo_root, args={"project_id": project_id, "scenario_id": scenario.scenario_id})
|
|
123
|
+
for idx, row in enumerate(scenario.preloaded_history, start=1):
|
|
124
|
+
store.add_event(run_id=run.run_id, level="INFO", message=f"seed_history_{idx}", payload=row)
|
|
125
|
+
store.mark_run_finished(run_id=run.run_id, status="succeeded")
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
ASSESSMENT_GUIDANCE = load_agentic_prompt_lines("devin_eval_assessment")
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def _assess_response(*, repo_root: Path, scenario: DevinEvalScenario, response_payload: dict[str, Any], context_payload: dict[str, Any]) -> DevinResponseAssessment:
|
|
132
|
+
model, _ = run_agent_step(
|
|
133
|
+
repo_root=repo_root,
|
|
134
|
+
stage_name=f"devin_eval_assess_{scenario.scenario_id}",
|
|
135
|
+
output_model=DevinResponseAssessment,
|
|
136
|
+
context_payload={
|
|
137
|
+
"scenario": scenario.model_dump(),
|
|
138
|
+
"response_payload": response_payload,
|
|
139
|
+
"context_payload": context_payload,
|
|
140
|
+
},
|
|
141
|
+
guidance=ASSESSMENT_GUIDANCE,
|
|
142
|
+
timeout_seconds=90,
|
|
143
|
+
)
|
|
144
|
+
return model
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def run_devin_response_eval(
|
|
148
|
+
*,
|
|
149
|
+
repo_root: Path,
|
|
150
|
+
scenario: DevinEvalScenario,
|
|
151
|
+
evals_root: Path | None = None,
|
|
152
|
+
project_id: str = "devin_eval_project",
|
|
153
|
+
) -> DevinEvalResult:
|
|
154
|
+
_require_real_eval_runtime()
|
|
155
|
+
run_id, started_at = _now_run_id()
|
|
156
|
+
eval_root = (evals_root or (repo_root / "evals" / "devin")) / run_id / scenario.scenario_id
|
|
157
|
+
store = ExecutionStore(repo_root / ".devflow" / "execution.sqlite")
|
|
158
|
+
_seed_history(store=store, repo_root=repo_root, project_id=project_id, scenario=scenario)
|
|
159
|
+
|
|
160
|
+
dag_result = run_devin_chat_dag(
|
|
161
|
+
repo_root=repo_root,
|
|
162
|
+
store=store,
|
|
163
|
+
idea_id=scenario.idea_id,
|
|
164
|
+
text=scenario.user_input,
|
|
165
|
+
source_path=None,
|
|
166
|
+
max_stories=scenario.max_stories,
|
|
167
|
+
planes=list(scenario.planes),
|
|
168
|
+
)
|
|
169
|
+
pipeline_dir = dag_result.pipeline_dir
|
|
170
|
+
response_payload = _load_json(pipeline_dir / "devin_response.json")
|
|
171
|
+
context_payload = _load_json(pipeline_dir / "idea_context_resolution.json") if (pipeline_dir / "idea_context_resolution.json").exists() else {}
|
|
172
|
+
intake_payload = _load_json(pipeline_dir / "devin_intake.json") if (pipeline_dir / "devin_intake.json").exists() else {}
|
|
173
|
+
terminal_payload = _load_json(pipeline_dir / "devin_agent_loop_terminal.json") if (pipeline_dir / "devin_agent_loop_terminal.json").exists() else {}
|
|
174
|
+
response_post = _load_json(pipeline_dir / "devin_response_post.json") if (pipeline_dir / "devin_response_post.json").exists() else {}
|
|
175
|
+
|
|
176
|
+
assessment = _assess_response(
|
|
177
|
+
repo_root=repo_root,
|
|
178
|
+
scenario=scenario,
|
|
179
|
+
response_payload=response_payload,
|
|
180
|
+
context_payload={
|
|
181
|
+
"idea_context_resolution": context_payload,
|
|
182
|
+
"devin_intake": intake_payload,
|
|
183
|
+
"terminal_payload": terminal_payload,
|
|
184
|
+
"response_post": response_post,
|
|
185
|
+
},
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
artifact_map = {
|
|
189
|
+
"devin_response": "artifacts/devin_response.json",
|
|
190
|
+
"idea_context_resolution": "artifacts/idea_context_resolution.json",
|
|
191
|
+
"devin_intake": "artifacts/devin_intake.json",
|
|
192
|
+
"devin_terminal": "artifacts/devin_agent_loop_terminal.json",
|
|
193
|
+
"devin_response_post": "artifacts/devin_response_post.json",
|
|
194
|
+
}
|
|
195
|
+
_copy_if_exists(pipeline_dir / "devin_response.json", eval_root / artifact_map["devin_response"])
|
|
196
|
+
_copy_if_exists(pipeline_dir / "idea_context_resolution.json", eval_root / artifact_map["idea_context_resolution"])
|
|
197
|
+
_copy_if_exists(pipeline_dir / "devin_intake.json", eval_root / artifact_map["devin_intake"])
|
|
198
|
+
_copy_if_exists(pipeline_dir / "devin_agent_loop_terminal.json", eval_root / artifact_map["devin_terminal"])
|
|
199
|
+
_copy_if_exists(pipeline_dir / "devin_response_post.json", eval_root / artifact_map["devin_response_post"])
|
|
200
|
+
|
|
201
|
+
score_payload = assessment.model_dump()
|
|
202
|
+
score_payload.update(
|
|
203
|
+
{
|
|
204
|
+
"assistant_quality": _mean([
|
|
205
|
+
assessment.usefulness,
|
|
206
|
+
assessment.supportiveness,
|
|
207
|
+
assessment.forward_progress,
|
|
208
|
+
assessment.request_relevance,
|
|
209
|
+
assessment.human_style,
|
|
210
|
+
]),
|
|
211
|
+
"style_quality": _mean([
|
|
212
|
+
assessment.human_style,
|
|
213
|
+
assessment.conciseness,
|
|
214
|
+
assessment.non_overload,
|
|
215
|
+
]),
|
|
216
|
+
}
|
|
217
|
+
)
|
|
218
|
+
_write_json(eval_root / "metrics" / "scores.json", score_payload)
|
|
219
|
+
|
|
220
|
+
manifest = {
|
|
221
|
+
"run_id": run_id,
|
|
222
|
+
"started_at": started_at,
|
|
223
|
+
"scenario": scenario.model_dump(),
|
|
224
|
+
"repo_root": str(repo_root),
|
|
225
|
+
"eval_root": str(eval_root),
|
|
226
|
+
"dag_run_id": dag_result.run_id,
|
|
227
|
+
"dag_pipeline_dir": str(dag_result.pipeline_dir),
|
|
228
|
+
"dag_exit_code": dag_result.exit_code,
|
|
229
|
+
"response_kind": response_payload.get("response_kind"),
|
|
230
|
+
"real_llm_eval": True,
|
|
231
|
+
"artifacts": artifact_map,
|
|
232
|
+
"metrics": {
|
|
233
|
+
"scores": "metrics/scores.json",
|
|
234
|
+
},
|
|
235
|
+
}
|
|
236
|
+
_write_json(eval_root / "eval_manifest.json", manifest)
|
|
237
|
+
return DevinEvalResult(run_id=run_id, started_at=started_at, eval_root=eval_root, payload=manifest)
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
def run_devin_eval_suite(
|
|
241
|
+
*,
|
|
242
|
+
repo_root: Path,
|
|
243
|
+
scenarios: list[DevinEvalScenario] | None = None,
|
|
244
|
+
evals_root: Path | None = None,
|
|
245
|
+
project_id: str = "devin_eval_project",
|
|
246
|
+
) -> DevinEvalResult:
|
|
247
|
+
_require_real_eval_runtime()
|
|
248
|
+
run_id, started_at = _now_run_id()
|
|
249
|
+
suite_root = (evals_root or (repo_root / "evals" / "devin")) / run_id
|
|
250
|
+
results: list[dict[str, Any]] = []
|
|
251
|
+
chosen = scenarios or list(DEFAULT_SCENARIOS)
|
|
252
|
+
for scenario in chosen:
|
|
253
|
+
result = run_devin_response_eval(
|
|
254
|
+
repo_root=repo_root,
|
|
255
|
+
scenario=scenario,
|
|
256
|
+
evals_root=suite_root,
|
|
257
|
+
project_id=project_id,
|
|
258
|
+
)
|
|
259
|
+
scores = _load_json(result.eval_root / "metrics" / "scores.json")
|
|
260
|
+
results.append(
|
|
261
|
+
{
|
|
262
|
+
"scenario_id": scenario.scenario_id,
|
|
263
|
+
"scenario_family": scenario.scenario_family,
|
|
264
|
+
"eval_root": str(result.eval_root),
|
|
265
|
+
"assistant_quality": scores.get("assistant_quality", 0.0),
|
|
266
|
+
"style_quality": scores.get("style_quality", 0.0),
|
|
267
|
+
"contract_satisfaction": scores.get("contract_satisfaction", 0.0),
|
|
268
|
+
"response_kind": result.payload.get("response_kind"),
|
|
269
|
+
}
|
|
270
|
+
)
|
|
271
|
+
summary = {
|
|
272
|
+
"run_id": run_id,
|
|
273
|
+
"started_at": started_at,
|
|
274
|
+
"scenario_count": len(results),
|
|
275
|
+
"assistant_quality": _mean([float(item["assistant_quality"]) for item in results]),
|
|
276
|
+
"style_quality": _mean([float(item["style_quality"]) for item in results]),
|
|
277
|
+
"contract_satisfaction": _mean([float(item["contract_satisfaction"]) for item in results]),
|
|
278
|
+
"scenarios": results,
|
|
279
|
+
"real_llm_eval": True,
|
|
280
|
+
}
|
|
281
|
+
_write_json(suite_root / "suite_summary.json", summary)
|
|
282
|
+
_write_json(suite_root / "eval_manifest.json", summary)
|
|
283
|
+
return DevinEvalResult(run_id=run_id, started_at=started_at, eval_root=suite_root, payload=summary)
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
class DevinMultiTurnEvalTurn(BaseModel):
|
|
288
|
+
turn_id: str = Field(min_length=1)
|
|
289
|
+
user_input: str = Field(min_length=1)
|
|
290
|
+
max_stories: int = 0
|
|
291
|
+
planes: list[str] = Field(default_factory=list)
|
|
292
|
+
expect_route_arm: Literal["ideation", "insight", "neither"] | None = None
|
|
293
|
+
expect_status: str | None = None
|
|
294
|
+
expect_response_kind: str | None = None
|
|
295
|
+
expect_activation: bool | None = None
|
|
296
|
+
must_mention: list[str] = Field(default_factory=list)
|
|
297
|
+
must_not: list[str] = Field(default_factory=list)
|
|
298
|
+
judgment_focus: list[str] = Field(default_factory=list)
|
|
299
|
+
decision_point_label: str | None = None
|
|
300
|
+
max_follow_up_questions: int | None = None
|
|
301
|
+
require_suggested_next_step: bool | None = None
|
|
302
|
+
forbid_internal_orchestration_terms: bool = False
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
class DevinMultiTurnEvalScenario(BaseModel):
|
|
306
|
+
scenario_id: str = Field(min_length=1)
|
|
307
|
+
persona: str | None = None
|
|
308
|
+
mode: Literal["multi_turn"] = "multi_turn"
|
|
309
|
+
doctrine_tags: list[str] = Field(default_factory=list)
|
|
310
|
+
expected_judgment_focus: list[str] = Field(default_factory=list)
|
|
311
|
+
description: str = Field(min_length=1)
|
|
312
|
+
idea_id_seed: str = Field(min_length=1)
|
|
313
|
+
turns: list[DevinMultiTurnEvalTurn] = Field(min_length=1)
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
DevinChatEvalCatalog.model_rebuild()
|
|
317
|
+
_CHAT_EVAL_CATALOG = load_devin_chat_eval_catalog()
|
|
318
|
+
DEFAULT_SCENARIOS: tuple[DevinEvalScenario, ...] = tuple(_CHAT_EVAL_CATALOG.single_turn)
|
|
319
|
+
DEFAULT_MULTI_TURN_SCENARIOS: tuple[DevinMultiTurnEvalScenario, ...] = tuple(_CHAT_EVAL_CATALOG.multi_turn)
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
def _normalize_text(value: Any) -> str:
|
|
323
|
+
return str(value or "").strip()
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
_INTERNAL_ORCHESTRATION_TERMS = (
|
|
327
|
+
"dag",
|
|
328
|
+
"routernode",
|
|
329
|
+
"agentnode",
|
|
330
|
+
"dag handoff",
|
|
331
|
+
"pipeline handoff",
|
|
332
|
+
)
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
def _text_contains_all(text: str, needles: list[str]) -> bool:
|
|
336
|
+
hay = text.lower()
|
|
337
|
+
return all(str(item).strip().lower() in hay for item in needles if str(item).strip())
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
def _text_contains_any(text: str, needles: list[str]) -> bool:
|
|
341
|
+
hay = text.lower()
|
|
342
|
+
return any(str(item).strip().lower() in hay for item in needles if str(item).strip())
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
def _load_optional_json(path: Path) -> dict[str, Any]:
|
|
346
|
+
if not path.exists():
|
|
347
|
+
return {}
|
|
348
|
+
return _load_json(path)
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
def _copy_turn_artifacts(*, pipeline_dir: Path, turn_root: Path) -> dict[str, str]:
|
|
352
|
+
artifact_map = {
|
|
353
|
+
"route": "artifacts/route.json",
|
|
354
|
+
"idea_readiness_contract": "artifacts/idea_readiness_contract.json",
|
|
355
|
+
"idea_assumption_completion": "artifacts/idea_assumption_completion.json",
|
|
356
|
+
"idea_activation_decision": "artifacts/idea_activation_decision.json",
|
|
357
|
+
"devin_response": "artifacts/devin_response.json",
|
|
358
|
+
"devin_response_post": "artifacts/devin_response_post.json",
|
|
359
|
+
"devin_intake": "artifacts/devin_intake.json",
|
|
360
|
+
"idea_context_resolution": "artifacts/idea_context_resolution.json",
|
|
361
|
+
"devin_agent_loop_terminal": "artifacts/devin_agent_loop_terminal.json",
|
|
362
|
+
}
|
|
363
|
+
copied: dict[str, str] = {}
|
|
364
|
+
for kind, rel_path in artifact_map.items():
|
|
365
|
+
if _copy_if_exists(pipeline_dir / f"{kind}.json", turn_root / rel_path):
|
|
366
|
+
copied[kind] = rel_path
|
|
367
|
+
return copied
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
def _response_message_from_payloads(*, response_payload: dict[str, Any], response_post: dict[str, Any], dag_result: Any) -> str:
|
|
371
|
+
candidates = [
|
|
372
|
+
response_payload.get("response_message"),
|
|
373
|
+
((response_payload.get("response_guidance") or {}).get("response_message") if isinstance(response_payload.get("response_guidance"), dict) else None),
|
|
374
|
+
((response_post.get("request") or {}).get("message") if isinstance(response_post.get("request"), dict) else None),
|
|
375
|
+
getattr(dag_result, "message", None),
|
|
376
|
+
]
|
|
377
|
+
for item in candidates:
|
|
378
|
+
text = _normalize_text(item)
|
|
379
|
+
if text:
|
|
380
|
+
return text
|
|
381
|
+
return ""
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
def _follow_up_questions_from_payloads(*, response_payload: dict[str, Any], response_post: dict[str, Any]) -> list[str]:
|
|
385
|
+
candidates = [
|
|
386
|
+
response_payload.get("follow_up_questions"),
|
|
387
|
+
((response_payload.get("response_guidance") or {}).get("follow_up_questions") if isinstance(response_payload.get("response_guidance"), dict) else None),
|
|
388
|
+
(((response_post.get("request") or {}).get("metadata") or {}).get("follow_up_questions") if isinstance((response_post.get("request") or {}).get("metadata"), dict) else None),
|
|
389
|
+
]
|
|
390
|
+
for item in candidates:
|
|
391
|
+
if isinstance(item, list):
|
|
392
|
+
return [str(entry).strip() for entry in item if str(entry).strip()]
|
|
393
|
+
return []
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
def _suggested_next_step_from_payloads(*, response_payload: dict[str, Any], response_post: dict[str, Any]) -> str:
|
|
397
|
+
candidates = [
|
|
398
|
+
response_payload.get("suggested_next_step"),
|
|
399
|
+
((response_payload.get("response_guidance") or {}).get("suggested_next_step") if isinstance(response_payload.get("response_guidance"), dict) else None),
|
|
400
|
+
(((response_post.get("request") or {}).get("metadata") or {}).get("suggested_next_step") if isinstance((response_post.get("request") or {}).get("metadata"), dict) else None),
|
|
401
|
+
]
|
|
402
|
+
for item in candidates:
|
|
403
|
+
text = _normalize_text(item)
|
|
404
|
+
if text:
|
|
405
|
+
return text
|
|
406
|
+
return ""
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
def _evaluate_turn_expectations(*, turn: DevinMultiTurnEvalTurn, observed: dict[str, Any]) -> dict[str, Any]:
|
|
410
|
+
message = _normalize_text(observed.get("message"))
|
|
411
|
+
follow_up_count = len(list(observed.get("follow_up_questions") or []))
|
|
412
|
+
suggested_next_step = _normalize_text(observed.get("suggested_next_step"))
|
|
413
|
+
checks = {
|
|
414
|
+
"route_arm": turn.expect_route_arm is None or observed.get("route_arm") == turn.expect_route_arm,
|
|
415
|
+
"status": turn.expect_status is None or observed.get("status") == turn.expect_status,
|
|
416
|
+
"response_kind": turn.expect_response_kind is None or observed.get("response_kind") == turn.expect_response_kind,
|
|
417
|
+
"activation": turn.expect_activation is None or bool(observed.get("activation_detected")) is bool(turn.expect_activation),
|
|
418
|
+
"must_mention": _text_contains_all(message, turn.must_mention),
|
|
419
|
+
"must_not": not _text_contains_any(message, turn.must_not),
|
|
420
|
+
"follow_up_question_count": turn.max_follow_up_questions is None or follow_up_count <= turn.max_follow_up_questions,
|
|
421
|
+
"suggested_next_step": turn.require_suggested_next_step is None or bool(suggested_next_step) is bool(turn.require_suggested_next_step),
|
|
422
|
+
"internal_orchestration": (not turn.forbid_internal_orchestration_terms) or (not _text_contains_any(message, list(_INTERNAL_ORCHESTRATION_TERMS))),
|
|
423
|
+
}
|
|
424
|
+
return {
|
|
425
|
+
"passed": all(checks.values()),
|
|
426
|
+
"checks": checks,
|
|
427
|
+
"follow_up_question_count": follow_up_count,
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
def _summarize_behavior(results: list[dict[str, Any]]) -> dict[str, Any]:
|
|
432
|
+
ideation_turns = [item for item in results if item.get("route_arm") == "ideation"]
|
|
433
|
+
preapproval_turns = [
|
|
434
|
+
item
|
|
435
|
+
for item in ideation_turns
|
|
436
|
+
if item.get("expected_activation") is False
|
|
437
|
+
]
|
|
438
|
+
approval_turns = [
|
|
439
|
+
item
|
|
440
|
+
for item in ideation_turns
|
|
441
|
+
if item.get("expected_activation") is True
|
|
442
|
+
]
|
|
443
|
+
detour_seen = any(item.get("route_arm") in {"insight", "neither"} for item in results)
|
|
444
|
+
later_ideation_after_detour = False
|
|
445
|
+
saw_detour = False
|
|
446
|
+
for item in results:
|
|
447
|
+
if item.get("route_arm") in {"insight", "neither"}:
|
|
448
|
+
saw_detour = True
|
|
449
|
+
continue
|
|
450
|
+
if saw_detour and item.get("route_arm") == "ideation":
|
|
451
|
+
later_ideation_after_detour = True
|
|
452
|
+
break
|
|
453
|
+
ideation_without_premature_handoff = bool(preapproval_turns) and all(
|
|
454
|
+
item.get("status") == "ideation_contract_response"
|
|
455
|
+
and item.get("response_kind") == "ideation_contract_response"
|
|
456
|
+
and not bool(item.get("activation_detected"))
|
|
457
|
+
for item in preapproval_turns
|
|
458
|
+
)
|
|
459
|
+
approval_handoff_ready = (not approval_turns) or all(
|
|
460
|
+
item.get("status") == "queued"
|
|
461
|
+
and item.get("response_kind") == "ready_for_downstream"
|
|
462
|
+
and bool(item.get("activation_detected"))
|
|
463
|
+
for item in approval_turns
|
|
464
|
+
)
|
|
465
|
+
single_question_discipline = all(
|
|
466
|
+
bool((item.get("expectation") or {}).get("checks", {}).get("follow_up_question_count", True))
|
|
467
|
+
for item in results
|
|
468
|
+
)
|
|
469
|
+
abstracted_orchestration_visibility = all(
|
|
470
|
+
bool((item.get("expectation") or {}).get("checks", {}).get("internal_orchestration", True))
|
|
471
|
+
for item in results
|
|
472
|
+
)
|
|
473
|
+
momentum_preserved = all(
|
|
474
|
+
bool(item.get("activation_detected"))
|
|
475
|
+
or bool(_normalize_text(item.get("suggested_next_step")))
|
|
476
|
+
for item in ideation_turns
|
|
477
|
+
) if ideation_turns else False
|
|
478
|
+
attention_discipline = (not detour_seen) or later_ideation_after_detour
|
|
479
|
+
return {
|
|
480
|
+
"ideation_without_premature_handoff": ideation_without_premature_handoff,
|
|
481
|
+
"approval_handoff_ready": approval_handoff_ready,
|
|
482
|
+
"ideation_insight_ideation_continuity": attention_discipline,
|
|
483
|
+
"all_three_arms_interplay": {"ideation", "insight", "neither"}.issubset({str(item.get("route_arm") or "") for item in results}),
|
|
484
|
+
"single_question_discipline": single_question_discipline,
|
|
485
|
+
"abstracted_orchestration_visibility": abstracted_orchestration_visibility,
|
|
486
|
+
"momentum_preserved": momentum_preserved,
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
class DevinLiveTurnTimeout(RuntimeError):
|
|
491
|
+
pass
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
def _latest_pipeline_dir_for_idea(*, repo_root: Path, idea_id: str) -> Path | None:
|
|
495
|
+
root = repo_root / ".devflow" / "ideas" / idea_id / "pipelines" / "devin_chat_dag"
|
|
496
|
+
if not root.exists():
|
|
497
|
+
return None
|
|
498
|
+
candidates = [path for path in root.iterdir() if path.is_dir()]
|
|
499
|
+
if not candidates:
|
|
500
|
+
return None
|
|
501
|
+
return max(candidates, key=lambda path: path.stat().st_mtime)
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
def _run_turn_with_timeout(*, timeout_seconds: int, func):
|
|
505
|
+
if timeout_seconds <= 0 or not hasattr(signal, "SIGALRM"):
|
|
506
|
+
return func()
|
|
507
|
+
previous = signal.getsignal(signal.SIGALRM)
|
|
508
|
+
|
|
509
|
+
def _raise_timeout(signum, frame):
|
|
510
|
+
raise DevinLiveTurnTimeout(f"live turn exceeded timeout_seconds={timeout_seconds}")
|
|
511
|
+
|
|
512
|
+
signal.signal(signal.SIGALRM, _raise_timeout)
|
|
513
|
+
signal.setitimer(signal.ITIMER_REAL, timeout_seconds)
|
|
514
|
+
try:
|
|
515
|
+
return func()
|
|
516
|
+
finally:
|
|
517
|
+
signal.setitimer(signal.ITIMER_REAL, 0)
|
|
518
|
+
signal.signal(signal.SIGALRM, previous)
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
def run_devin_multi_turn_eval(
|
|
522
|
+
*,
|
|
523
|
+
codebase_repo_root: Path,
|
|
524
|
+
target_repo_root: Path,
|
|
525
|
+
scenario: DevinMultiTurnEvalScenario,
|
|
526
|
+
evals_root: Path | None = None,
|
|
527
|
+
idea_id_prefix: str = "devin_live_eval",
|
|
528
|
+
turn_timeout_seconds: int = 180,
|
|
529
|
+
) -> DevinEvalResult:
|
|
530
|
+
_require_real_eval_runtime()
|
|
531
|
+
run_id, started_at = _now_run_id()
|
|
532
|
+
target_repo_root = target_repo_root.expanduser().resolve()
|
|
533
|
+
suite_root = (evals_root or (target_repo_root / "evals" / "devin_multi_turn")) / run_id / scenario.scenario_id
|
|
534
|
+
idea_id = f"{idea_id_prefix}_{scenario.idea_id_seed}_{run_id[-6:].lower()}"
|
|
535
|
+
store = ExecutionStore(target_repo_root / ".devflow" / "execution.sqlite")
|
|
536
|
+
llm_config_path = Path(os.environ.get("DEVFLOW_HOME") or Path.home()).expanduser() / ".devflow" / "config.toml"
|
|
537
|
+
turn_results: list[dict[str, Any]] = []
|
|
538
|
+
|
|
539
|
+
for idx, turn in enumerate(scenario.turns, start=1):
|
|
540
|
+
dag_result = None
|
|
541
|
+
turn_error = None
|
|
542
|
+
try:
|
|
543
|
+
dag_result = _run_turn_with_timeout(
|
|
544
|
+
timeout_seconds=turn_timeout_seconds,
|
|
545
|
+
func=lambda: run_devin_chat_dag(
|
|
546
|
+
repo_root=target_repo_root,
|
|
547
|
+
store=store,
|
|
548
|
+
idea_id=idea_id,
|
|
549
|
+
text=turn.user_input,
|
|
550
|
+
source_path=None,
|
|
551
|
+
max_stories=turn.max_stories,
|
|
552
|
+
planes=list(turn.planes),
|
|
553
|
+
),
|
|
554
|
+
)
|
|
555
|
+
pipeline_dir = dag_result.pipeline_dir
|
|
556
|
+
except Exception as exc:
|
|
557
|
+
turn_error = f"{type(exc).__name__}: {exc}"
|
|
558
|
+
pipeline_dir = _latest_pipeline_dir_for_idea(repo_root=target_repo_root, idea_id=idea_id) or (suite_root / f"turn_{idx:02d}_{turn.turn_id}" / "missing_pipeline")
|
|
559
|
+
route_payload = _load_optional_json(pipeline_dir / "route.json")
|
|
560
|
+
contract_payload = _load_optional_json(pipeline_dir / "idea_readiness_contract.json")
|
|
561
|
+
activation_payload = _load_optional_json(pipeline_dir / "idea_activation_decision.json")
|
|
562
|
+
terminal_payload = _load_optional_json(pipeline_dir / "devin_agent_loop_terminal.json")
|
|
563
|
+
response_payload = _load_optional_json(pipeline_dir / "devin_response.json")
|
|
564
|
+
response_post = _load_optional_json(pipeline_dir / "devin_response_post.json")
|
|
565
|
+
idea_state = _load_optional_json(target_repo_root / ".devflow" / "ideas" / idea_id / "idea.json")
|
|
566
|
+
response_message = turn_error or _response_message_from_payloads(
|
|
567
|
+
response_payload=response_payload,
|
|
568
|
+
response_post=response_post,
|
|
569
|
+
dag_result=dag_result,
|
|
570
|
+
)
|
|
571
|
+
follow_up_questions = [] if turn_error else _follow_up_questions_from_payloads(
|
|
572
|
+
response_payload=response_payload,
|
|
573
|
+
response_post=response_post,
|
|
574
|
+
)
|
|
575
|
+
suggested_next_step = "" if turn_error else _suggested_next_step_from_payloads(
|
|
576
|
+
response_payload=response_payload,
|
|
577
|
+
response_post=response_post,
|
|
578
|
+
)
|
|
579
|
+
observed = {
|
|
580
|
+
"turn_index": idx,
|
|
581
|
+
"turn_id": turn.turn_id,
|
|
582
|
+
"user_input": turn.user_input,
|
|
583
|
+
"pipeline_dir": str(pipeline_dir),
|
|
584
|
+
"dag_run_id": None if dag_result is None else dag_result.run_id,
|
|
585
|
+
"exit_code": 1 if dag_result is None else dag_result.exit_code,
|
|
586
|
+
"route_arm": route_payload.get("route_arm"),
|
|
587
|
+
"status": turn_error or (dag_result.outcome.get("status") if dag_result is not None else None),
|
|
588
|
+
"response_kind": None if dag_result is None else (dag_result.outcome.get("response_kind") or ((dag_result.outcome.get("response_guidance") or {}).get("response_kind"))),
|
|
589
|
+
"message": response_message,
|
|
590
|
+
"follow_up_questions": follow_up_questions,
|
|
591
|
+
"suggested_next_step": suggested_next_step,
|
|
592
|
+
"expected_activation": turn.expect_activation,
|
|
593
|
+
"contract_status": contract_payload.get("status"),
|
|
594
|
+
"activation_detected": bool(activation_payload.get("activation_detected")),
|
|
595
|
+
"history_message_count": ((terminal_payload.get("history_grounding") or {}).get("history_message_count")),
|
|
596
|
+
"included_history_message_count": ((terminal_payload.get("history_grounding") or {}).get("included_history_message_count")),
|
|
597
|
+
"latest_message": idea_state.get("latest_message"),
|
|
598
|
+
"message_log_count": len(list(idea_state.get("message_log") or [])),
|
|
599
|
+
"response_payload": response_payload,
|
|
600
|
+
"response_post": response_post,
|
|
601
|
+
}
|
|
602
|
+
expectation = _evaluate_turn_expectations(turn=turn, observed=observed)
|
|
603
|
+
turn_root = suite_root / f"turn_{idx:02d}_{turn.turn_id}"
|
|
604
|
+
copied = _copy_turn_artifacts(pipeline_dir=pipeline_dir, turn_root=turn_root)
|
|
605
|
+
turn_record = {**observed, "expectation": expectation, "artifacts": copied}
|
|
606
|
+
turn_results.append(turn_record)
|
|
607
|
+
_write_json(turn_root / "turn_result.json", turn_record)
|
|
608
|
+
|
|
609
|
+
behavior = _summarize_behavior(turn_results)
|
|
610
|
+
summary = {
|
|
611
|
+
"run_id": run_id,
|
|
612
|
+
"started_at": started_at,
|
|
613
|
+
"scenario": scenario.model_dump(),
|
|
614
|
+
"real_llm_eval": True,
|
|
615
|
+
"live_workflow": True,
|
|
616
|
+
"codebase_repo_root": str(codebase_repo_root.expanduser().resolve()),
|
|
617
|
+
"target_repo_root": str(target_repo_root),
|
|
618
|
+
"idea_id": idea_id,
|
|
619
|
+
"llm_config_path": str(llm_config_path),
|
|
620
|
+
"llm_cli_configured": llm_config_path.exists(),
|
|
621
|
+
"behavior_summary": behavior,
|
|
622
|
+
"turn_timeout_seconds": turn_timeout_seconds,
|
|
623
|
+
"all_turn_expectations_passed": all(bool(item.get("expectation", {}).get("passed")) for item in turn_results),
|
|
624
|
+
"turns": turn_results,
|
|
625
|
+
}
|
|
626
|
+
_write_json(suite_root / "eval_manifest.json", summary)
|
|
627
|
+
return DevinEvalResult(run_id=run_id, started_at=started_at, eval_root=suite_root, payload=summary)
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
def run_devin_multi_turn_eval_suite(
|
|
631
|
+
*,
|
|
632
|
+
codebase_repo_root: Path,
|
|
633
|
+
target_repo_root: Path,
|
|
634
|
+
scenarios: list[DevinMultiTurnEvalScenario] | None = None,
|
|
635
|
+
evals_root: Path | None = None,
|
|
636
|
+
idea_id_prefix: str = "devin_live_eval",
|
|
637
|
+
turn_timeout_seconds: int = 180,
|
|
638
|
+
) -> DevinEvalResult:
|
|
639
|
+
_require_real_eval_runtime()
|
|
640
|
+
run_id, started_at = _now_run_id()
|
|
641
|
+
suite_root = (evals_root or (target_repo_root.expanduser().resolve() / "evals" / "devin_multi_turn")) / run_id
|
|
642
|
+
chosen = scenarios or list(DEFAULT_MULTI_TURN_SCENARIOS)
|
|
643
|
+
scenario_results: list[dict[str, Any]] = []
|
|
644
|
+
for scenario in chosen:
|
|
645
|
+
result = run_devin_multi_turn_eval(
|
|
646
|
+
codebase_repo_root=codebase_repo_root,
|
|
647
|
+
target_repo_root=target_repo_root,
|
|
648
|
+
scenario=scenario,
|
|
649
|
+
evals_root=suite_root,
|
|
650
|
+
idea_id_prefix=idea_id_prefix,
|
|
651
|
+
turn_timeout_seconds=turn_timeout_seconds,
|
|
652
|
+
)
|
|
653
|
+
manifest = _load_json(result.eval_root / "eval_manifest.json")
|
|
654
|
+
scenario_results.append(
|
|
655
|
+
{
|
|
656
|
+
"scenario_id": scenario.scenario_id,
|
|
657
|
+
"persona": scenario.persona,
|
|
658
|
+
"eval_root": str(result.eval_root),
|
|
659
|
+
"all_turn_expectations_passed": bool(manifest.get("all_turn_expectations_passed")),
|
|
660
|
+
"behavior_summary": manifest.get("behavior_summary") or {},
|
|
661
|
+
}
|
|
662
|
+
)
|
|
663
|
+
summary = {
|
|
664
|
+
"run_id": run_id,
|
|
665
|
+
"started_at": started_at,
|
|
666
|
+
"scenario_count": len(scenario_results),
|
|
667
|
+
"real_llm_eval": True,
|
|
668
|
+
"live_workflow": True,
|
|
669
|
+
"codebase_repo_root": str(codebase_repo_root.expanduser().resolve()),
|
|
670
|
+
"target_repo_root": str(target_repo_root.expanduser().resolve()),
|
|
671
|
+
"scenarios": scenario_results,
|
|
672
|
+
"turn_timeout_seconds": turn_timeout_seconds,
|
|
673
|
+
"all_scenarios_passed": all(bool(item.get("all_turn_expectations_passed")) for item in scenario_results),
|
|
674
|
+
}
|
|
675
|
+
_write_json(suite_root / "suite_summary.json", summary)
|
|
676
|
+
_write_json(suite_root / "eval_manifest.json", summary)
|
|
677
|
+
return DevinEvalResult(run_id=run_id, started_at=started_at, eval_root=suite_root, payload=summary)
|
devin/nodes/__init__.py
ADDED
|
File without changes
|
|
File without changes
|