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,465 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Any, Literal
|
|
7
|
+
|
|
8
|
+
from pydantic import BaseModel, Field
|
|
9
|
+
|
|
10
|
+
from ..agentic_prompts import load_agentic_prompt_lines, load_agentic_prompt_text
|
|
11
|
+
from ..agentic_runtime import (
|
|
12
|
+
AgentRunEnvelope,
|
|
13
|
+
_build_artifact_reference_prompt,
|
|
14
|
+
_build_prompt,
|
|
15
|
+
_extract_json_hardened,
|
|
16
|
+
_persist_large_context_artifact,
|
|
17
|
+
)
|
|
18
|
+
from devflow_engine.devin2.pi_runner import run_devin2_pi_agent
|
|
19
|
+
from ..llm.invoke import LlmInvocationRequest, invoke_llm
|
|
20
|
+
from .traditional_stories import _global_devflow_dir, _read_toml
|
|
21
|
+
from .response_mode import current_response_mode_label
|
|
22
|
+
from ..llm.provider_api import (
|
|
23
|
+
ANTHROPIC_MODEL_DEFAULT,
|
|
24
|
+
AnthropicApiSettings as _AnthropicSettings,
|
|
25
|
+
anthropic_messages_create as _shared_anthropic_messages_create,
|
|
26
|
+
anthropic_response_text,
|
|
27
|
+
load_anthropic_api_settings,
|
|
28
|
+
read_anthropic_api_key,
|
|
29
|
+
)
|
|
30
|
+
from .repo_tools import (
|
|
31
|
+
INSIGHT_REPO_TOOL_DISPATCH,
|
|
32
|
+
INSIGHT_REPO_TOOL_SPECS,
|
|
33
|
+
REPO_TOOL_DISPATCH,
|
|
34
|
+
REPO_TOOL_SPECS,
|
|
35
|
+
activate_repo_tools,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
IDEATION_RESPONSE_DOCTRINE = load_agentic_prompt_lines("idea_response_doctrine")
|
|
40
|
+
_IDEATION_API_AGENT_SYSTEM_PROMPT = load_agentic_prompt_text("idea_api_ideation_agent")
|
|
41
|
+
_INSIGHT_API_AGENT_SYSTEM_PROMPT = load_agentic_prompt_text("idea_api_insight_agent")
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class IdeationResponseAgentOutput(BaseModel):
|
|
45
|
+
response_message: str = Field(min_length=1)
|
|
46
|
+
response_kind: Literal["redirect", "needs_clarification", "ready_for_downstream", "ideation_contract_response"]
|
|
47
|
+
suggested_next_step: str = Field(min_length=1)
|
|
48
|
+
follow_up_questions: list[str] = Field(default_factory=list)
|
|
49
|
+
style_notes: list[str] = Field(default_factory=list)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class InsightResponseAgentOutput(BaseModel):
|
|
53
|
+
response_message: str = Field(min_length=1)
|
|
54
|
+
response_kind: Literal["redirect", "needs_clarification", "ready_for_downstream", "ideation_contract_response"]
|
|
55
|
+
suggested_next_step: str = Field(min_length=1)
|
|
56
|
+
follow_up_questions: list[str] = Field(default_factory=list)
|
|
57
|
+
style_notes: list[str] = Field(default_factory=list)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
_IDEATION_MODEL = ANTHROPIC_MODEL_DEFAULT
|
|
61
|
+
_MAX_PROMPT_CHARS = 120_000
|
|
62
|
+
_MAX_TOOL_ROUNDS = 8
|
|
63
|
+
_DEVIN2_PI_MODE_LABEL = "devin2_pi"
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _response_mode_label() -> str:
|
|
67
|
+
return current_response_mode_label(env_value=os.environ.get("DEVFLOW_IDEATION_RESPONSE_MODE_LABEL"))
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _use_devin2_pi_harness() -> bool:
|
|
71
|
+
return _response_mode_label() == _DEVIN2_PI_MODE_LABEL
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _read_anthropic_key(*, repo_root: Path) -> str:
|
|
75
|
+
try:
|
|
76
|
+
return read_anthropic_api_key(repo_root=repo_root)
|
|
77
|
+
except RuntimeError as exc:
|
|
78
|
+
if "Anthropic API key not configured." not in str(exc):
|
|
79
|
+
raise
|
|
80
|
+
raise RuntimeError(
|
|
81
|
+
"Anthropic API key not configured for ideation arm. Expected runtime env, macOS keychain entry, or global ~/.devflow/keys/anthropic.json."
|
|
82
|
+
) from exc
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def _ideation_api_settings(*, repo_root: Path) -> _AnthropicSettings:
|
|
86
|
+
return load_anthropic_api_settings(
|
|
87
|
+
repo_root=repo_root,
|
|
88
|
+
model=_IDEATION_MODEL,
|
|
89
|
+
max_tokens=1_200,
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def _tool_input_schema(spec: dict[str, Any]) -> dict[str, Any]:
|
|
94
|
+
properties: dict[str, Any] = {}
|
|
95
|
+
required: list[str] = []
|
|
96
|
+
for name, meta in dict(spec.get("parameters") or {}).items():
|
|
97
|
+
schema: dict[str, Any] = {"type": meta.get("type", "string")}
|
|
98
|
+
description = str(meta.get("description") or "").strip()
|
|
99
|
+
if description:
|
|
100
|
+
schema["description"] = description
|
|
101
|
+
enum_values = meta.get("enum")
|
|
102
|
+
if isinstance(enum_values, list) and enum_values:
|
|
103
|
+
schema["enum"] = list(enum_values)
|
|
104
|
+
properties[name] = schema
|
|
105
|
+
if meta.get("required") is True:
|
|
106
|
+
required.append(name)
|
|
107
|
+
return {
|
|
108
|
+
"type": "object",
|
|
109
|
+
"properties": properties,
|
|
110
|
+
"required": required,
|
|
111
|
+
"additionalProperties": False,
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def _repo_tools_from_specs(tool_specs: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
|
116
|
+
return [
|
|
117
|
+
{
|
|
118
|
+
"name": str(spec["name"]),
|
|
119
|
+
"description": str(spec.get("description") or ""),
|
|
120
|
+
"input_schema": _tool_input_schema(spec),
|
|
121
|
+
}
|
|
122
|
+
for spec in tool_specs
|
|
123
|
+
]
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def _anthropic_messages_create(
|
|
127
|
+
*,
|
|
128
|
+
settings: _AnthropicSettings,
|
|
129
|
+
system_prompt: str,
|
|
130
|
+
messages: list[dict[str, Any]],
|
|
131
|
+
tools: list[dict[str, Any]],
|
|
132
|
+
timeout_seconds: int | None,
|
|
133
|
+
) -> dict[str, Any]:
|
|
134
|
+
try:
|
|
135
|
+
return _shared_anthropic_messages_create(
|
|
136
|
+
settings=settings,
|
|
137
|
+
system_prompt=system_prompt,
|
|
138
|
+
messages=messages,
|
|
139
|
+
tools=tools,
|
|
140
|
+
timeout_seconds=timeout_seconds,
|
|
141
|
+
)
|
|
142
|
+
except RuntimeError as exc:
|
|
143
|
+
message = str(exc)
|
|
144
|
+
if not message.startswith("Anthropic API request failed:"):
|
|
145
|
+
raise
|
|
146
|
+
raise RuntimeError(message.replace("Anthropic API request failed:", "Anthropic ideation API request failed:", 1)) from exc
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def _assistant_text(response: dict[str, Any]) -> str:
|
|
150
|
+
return anthropic_response_text(response)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def _tool_uses(response: dict[str, Any]) -> list[dict[str, Any]]:
|
|
154
|
+
return [dict(block) for block in list(response.get("content") or []) if block.get("type") == "tool_use"]
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def _run_api_agent(
|
|
158
|
+
*,
|
|
159
|
+
repo_root: Path,
|
|
160
|
+
prompt: dict[str, Any],
|
|
161
|
+
output_model: type[BaseModel],
|
|
162
|
+
settings: _AnthropicSettings,
|
|
163
|
+
tools: list[dict[str, Any]],
|
|
164
|
+
tool_dispatch: dict[str, Any],
|
|
165
|
+
system_prompt: str,
|
|
166
|
+
unsupported_tool_message: str,
|
|
167
|
+
no_json_message: str,
|
|
168
|
+
round_limit_message: str,
|
|
169
|
+
timeout_seconds: int | None,
|
|
170
|
+
) -> tuple[BaseModel, AgentRunEnvelope]:
|
|
171
|
+
messages: list[dict[str, Any]] = [{"role": "user", "content": json.dumps(prompt, indent=2, sort_keys=True)}]
|
|
172
|
+
transcript: list[dict[str, Any]] = []
|
|
173
|
+
|
|
174
|
+
with activate_repo_tools(repo_root):
|
|
175
|
+
for _ in range(_MAX_TOOL_ROUNDS):
|
|
176
|
+
response = _anthropic_messages_create(
|
|
177
|
+
settings=settings,
|
|
178
|
+
system_prompt=system_prompt,
|
|
179
|
+
messages=messages,
|
|
180
|
+
tools=tools,
|
|
181
|
+
timeout_seconds=timeout_seconds,
|
|
182
|
+
)
|
|
183
|
+
transcript.append(response)
|
|
184
|
+
tool_calls = _tool_uses(response)
|
|
185
|
+
if not tool_calls:
|
|
186
|
+
raw_text = _assistant_text(response)
|
|
187
|
+
raw_json = _extract_json_hardened(raw_text)
|
|
188
|
+
if raw_json is None:
|
|
189
|
+
raise RuntimeError(no_json_message)
|
|
190
|
+
model = output_model.model_validate_json(raw_json)
|
|
191
|
+
return model, AgentRunEnvelope(
|
|
192
|
+
prompt=prompt,
|
|
193
|
+
response=model.model_dump(),
|
|
194
|
+
raw_stdout=json.dumps({"model": settings.model, "transcript": transcript}, indent=2, sort_keys=True),
|
|
195
|
+
raw_stderr="",
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
messages.append({"role": "assistant", "content": list(response.get("content") or [])})
|
|
199
|
+
tool_results: list[dict[str, Any]] = []
|
|
200
|
+
for tool_call in tool_calls:
|
|
201
|
+
name = str(tool_call.get("name") or "").strip()
|
|
202
|
+
if name not in tool_dispatch:
|
|
203
|
+
raise RuntimeError(unsupported_tool_message.format(name=name))
|
|
204
|
+
tool_fn = tool_dispatch[name]
|
|
205
|
+
tool_input = dict(tool_call.get("input") or {})
|
|
206
|
+
tool_output = tool_fn(**tool_input)
|
|
207
|
+
tool_results.append(
|
|
208
|
+
{
|
|
209
|
+
"type": "tool_result",
|
|
210
|
+
"tool_use_id": str(tool_call.get("id") or ""),
|
|
211
|
+
"content": json.dumps(tool_output, indent=2, sort_keys=True),
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
messages.append({"role": "user", "content": tool_results})
|
|
215
|
+
|
|
216
|
+
raise RuntimeError(round_limit_message)
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def _run_ideation_api_agent(
|
|
220
|
+
*,
|
|
221
|
+
repo_root: Path,
|
|
222
|
+
prompt: dict[str, Any],
|
|
223
|
+
output_model: type[BaseModel],
|
|
224
|
+
timeout_seconds: int | None,
|
|
225
|
+
) -> tuple[BaseModel, AgentRunEnvelope]:
|
|
226
|
+
return _run_api_agent(
|
|
227
|
+
repo_root=repo_root,
|
|
228
|
+
prompt=prompt,
|
|
229
|
+
output_model=output_model,
|
|
230
|
+
settings=_ideation_api_settings(repo_root=repo_root),
|
|
231
|
+
tools=_repo_tools_from_specs(REPO_TOOL_SPECS),
|
|
232
|
+
tool_dispatch=REPO_TOOL_DISPATCH,
|
|
233
|
+
system_prompt=_IDEATION_API_AGENT_SYSTEM_PROMPT,
|
|
234
|
+
unsupported_tool_message="Ideation API agent requested unsupported tool: {name!r}",
|
|
235
|
+
no_json_message="Ideation API agent returned no JSON payload.",
|
|
236
|
+
round_limit_message="Ideation API agent exceeded tool-round limit without returning a final JSON response.",
|
|
237
|
+
timeout_seconds=timeout_seconds,
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
def _run_insight_api_agent(
|
|
242
|
+
*,
|
|
243
|
+
repo_root: Path,
|
|
244
|
+
prompt: dict[str, Any],
|
|
245
|
+
output_model: type[BaseModel],
|
|
246
|
+
timeout_seconds: int | None,
|
|
247
|
+
) -> tuple[BaseModel, AgentRunEnvelope]:
|
|
248
|
+
return _run_api_agent(
|
|
249
|
+
repo_root=repo_root,
|
|
250
|
+
prompt=prompt,
|
|
251
|
+
output_model=output_model,
|
|
252
|
+
settings=_ideation_api_settings(repo_root=repo_root),
|
|
253
|
+
tools=_repo_tools_from_specs(INSIGHT_REPO_TOOL_SPECS),
|
|
254
|
+
tool_dispatch=INSIGHT_REPO_TOOL_DISPATCH,
|
|
255
|
+
system_prompt=_INSIGHT_API_AGENT_SYSTEM_PROMPT,
|
|
256
|
+
unsupported_tool_message="Insight API agent requested unsupported tool: {name!r}",
|
|
257
|
+
no_json_message="Insight API agent returned no JSON payload.",
|
|
258
|
+
round_limit_message="Insight API agent exceeded tool-round limit without returning a final JSON response.",
|
|
259
|
+
timeout_seconds=timeout_seconds,
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
def _request_response_llm_kwargs() -> dict[str, Any]:
|
|
265
|
+
cfg = _read_toml(_global_devflow_dir() / "config.toml")
|
|
266
|
+
llm_mode = str(cfg.get("llm_mode") or "").strip().lower()
|
|
267
|
+
if llm_mode == "api":
|
|
268
|
+
return {
|
|
269
|
+
"transport": "api",
|
|
270
|
+
}
|
|
271
|
+
return {}
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
def _run_request_response_loop_call(
|
|
275
|
+
*,
|
|
276
|
+
repo_root: Path,
|
|
277
|
+
prompt: dict[str, Any],
|
|
278
|
+
output_model: type[BaseModel],
|
|
279
|
+
timeout_seconds: int | None,
|
|
280
|
+
) -> tuple[BaseModel, AgentRunEnvelope]:
|
|
281
|
+
result = invoke_llm(
|
|
282
|
+
LlmInvocationRequest(
|
|
283
|
+
purpose=str(prompt.get("task") or "idea_devin_post_context_response"),
|
|
284
|
+
repo_root=repo_root,
|
|
285
|
+
prompt="",
|
|
286
|
+
prompt_payload=prompt,
|
|
287
|
+
delivery_model="final_only",
|
|
288
|
+
interaction_model="request_response",
|
|
289
|
+
response_contract="json_only",
|
|
290
|
+
timeout_seconds=timeout_seconds,
|
|
291
|
+
strength="light",
|
|
292
|
+
**_request_response_llm_kwargs(),
|
|
293
|
+
)
|
|
294
|
+
)
|
|
295
|
+
if not result.ok:
|
|
296
|
+
raise RuntimeError(result.stderr or result.stdout or "Devin response loop LLM call failed.")
|
|
297
|
+
if not result.contract_ok or result.parsed_json is None:
|
|
298
|
+
raise RuntimeError(result.contract_error or result.stdout or "Devin response loop returned invalid JSON.")
|
|
299
|
+
model = output_model.model_validate(result.parsed_json)
|
|
300
|
+
envelope = AgentRunEnvelope(
|
|
301
|
+
prompt=prompt,
|
|
302
|
+
response=model.model_dump(),
|
|
303
|
+
raw_stdout=json.dumps(
|
|
304
|
+
{
|
|
305
|
+
"transport": result.transport,
|
|
306
|
+
"provider": result.provider,
|
|
307
|
+
"model": result.model,
|
|
308
|
+
"delivery_model": result.delivery_model,
|
|
309
|
+
"interaction_model": result.interaction_model,
|
|
310
|
+
"response_contract": result.response_contract,
|
|
311
|
+
"stdout": result.stdout,
|
|
312
|
+
},
|
|
313
|
+
indent=2,
|
|
314
|
+
sort_keys=True,
|
|
315
|
+
),
|
|
316
|
+
raw_stderr=result.stderr,
|
|
317
|
+
)
|
|
318
|
+
return model, envelope
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
def _run_devin2_pi_loop_call(
|
|
322
|
+
*,
|
|
323
|
+
repo_root: Path,
|
|
324
|
+
route_arm: Literal["ideation", "insight"],
|
|
325
|
+
prompt: dict[str, Any],
|
|
326
|
+
output_model: type[BaseModel],
|
|
327
|
+
timeout_seconds: int | None,
|
|
328
|
+
) -> tuple[BaseModel, AgentRunEnvelope]:
|
|
329
|
+
pi_timeout_seconds = max(int(timeout_seconds or 0), 150) if timeout_seconds is not None else 150
|
|
330
|
+
result = run_devin2_pi_agent(
|
|
331
|
+
repo_root=repo_root,
|
|
332
|
+
stage_name=str(prompt.get("task") or "idea_devin_post_context_response"),
|
|
333
|
+
route_arm=route_arm,
|
|
334
|
+
context_payload=dict(prompt.get("context") or {}),
|
|
335
|
+
operational_guidance=list(prompt.get("guidance") or prompt.get("instructions") or []),
|
|
336
|
+
output_model=output_model,
|
|
337
|
+
timeout_seconds=pi_timeout_seconds,
|
|
338
|
+
)
|
|
339
|
+
model = output_model.model_validate(result.response_model.model_dump())
|
|
340
|
+
desired_response_kind: str | None = None
|
|
341
|
+
for item in list(prompt.get("guidance") or prompt.get("instructions") or []):
|
|
342
|
+
text = str(item or "")
|
|
343
|
+
marker = "Return response_kind='"
|
|
344
|
+
if marker not in text:
|
|
345
|
+
continue
|
|
346
|
+
desired_response_kind = text.split(marker, 1)[1].split("'", 1)[0].strip() or None
|
|
347
|
+
if desired_response_kind:
|
|
348
|
+
break
|
|
349
|
+
if desired_response_kind and hasattr(model, "response_kind"):
|
|
350
|
+
actual_response_kind = str(getattr(model, "response_kind") or "")
|
|
351
|
+
if desired_response_kind == "ideation_contract_response" and actual_response_kind in {
|
|
352
|
+
"needs_clarification",
|
|
353
|
+
"ready_for_downstream",
|
|
354
|
+
}:
|
|
355
|
+
model = model.model_copy(update={"response_kind": desired_response_kind})
|
|
356
|
+
if hasattr(model, "follow_up_questions"):
|
|
357
|
+
questions = list(getattr(model, "follow_up_questions") or [])
|
|
358
|
+
response_kind = str(getattr(model, "response_kind") or "") if hasattr(model, "response_kind") else ""
|
|
359
|
+
if response_kind == "ready_for_downstream":
|
|
360
|
+
model = model.model_copy(update={"follow_up_questions": []})
|
|
361
|
+
elif len(questions) > 1:
|
|
362
|
+
model = model.model_copy(update={"follow_up_questions": questions[:1]})
|
|
363
|
+
envelope = AgentRunEnvelope(
|
|
364
|
+
prompt=result.prompt_payload,
|
|
365
|
+
response=model.model_dump(),
|
|
366
|
+
raw_stdout=json.dumps(
|
|
367
|
+
{
|
|
368
|
+
"transport": result.invocation.transport,
|
|
369
|
+
"provider": result.invocation.provider,
|
|
370
|
+
"model": result.invocation.model,
|
|
371
|
+
"delivery_model": result.invocation.delivery_model,
|
|
372
|
+
"interaction_model": result.invocation.interaction_model,
|
|
373
|
+
"response_contract": result.invocation.response_contract,
|
|
374
|
+
"stdout": result.invocation.stdout,
|
|
375
|
+
},
|
|
376
|
+
indent=2,
|
|
377
|
+
sort_keys=True,
|
|
378
|
+
),
|
|
379
|
+
raw_stderr=result.invocation.stderr,
|
|
380
|
+
)
|
|
381
|
+
return model, envelope
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
def run_ideation_response_agent_step(
|
|
385
|
+
*,
|
|
386
|
+
repo_root: Path,
|
|
387
|
+
context_payload: dict[str, Any],
|
|
388
|
+
guidance: list[str],
|
|
389
|
+
timeout_seconds: int | None = None,
|
|
390
|
+
) -> tuple[IdeationResponseAgentOutput, AgentRunEnvelope]:
|
|
391
|
+
prompt = _build_prompt(
|
|
392
|
+
stage_name="idea_devin_post_context_response",
|
|
393
|
+
context_payload=context_payload,
|
|
394
|
+
guidance=IDEATION_RESPONSE_DOCTRINE + guidance,
|
|
395
|
+
output_model=IdeationResponseAgentOutput,
|
|
396
|
+
)
|
|
397
|
+
if len(json.dumps(prompt)) > _MAX_PROMPT_CHARS:
|
|
398
|
+
artifact_path = _persist_large_context_artifact(
|
|
399
|
+
repo_root=repo_root,
|
|
400
|
+
stage_name="idea_devin_post_context_response",
|
|
401
|
+
context_payload=context_payload,
|
|
402
|
+
)
|
|
403
|
+
prompt = _build_artifact_reference_prompt(
|
|
404
|
+
stage_name="idea_devin_post_context_response",
|
|
405
|
+
output_model=IdeationResponseAgentOutput,
|
|
406
|
+
guidance=IDEATION_RESPONSE_DOCTRINE + guidance,
|
|
407
|
+
artifact_path=artifact_path,
|
|
408
|
+
)
|
|
409
|
+
if _use_devin2_pi_harness():
|
|
410
|
+
return _run_devin2_pi_loop_call(
|
|
411
|
+
repo_root=repo_root,
|
|
412
|
+
route_arm="ideation",
|
|
413
|
+
prompt=prompt,
|
|
414
|
+
output_model=IdeationResponseAgentOutput,
|
|
415
|
+
timeout_seconds=timeout_seconds,
|
|
416
|
+
)
|
|
417
|
+
model, envelope = _run_request_response_loop_call(
|
|
418
|
+
repo_root=repo_root,
|
|
419
|
+
prompt=prompt,
|
|
420
|
+
output_model=IdeationResponseAgentOutput,
|
|
421
|
+
timeout_seconds=timeout_seconds,
|
|
422
|
+
)
|
|
423
|
+
return model, envelope
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
def run_insight_response_agent_step(
|
|
427
|
+
*,
|
|
428
|
+
repo_root: Path,
|
|
429
|
+
context_payload: dict[str, Any],
|
|
430
|
+
guidance: list[str],
|
|
431
|
+
timeout_seconds: int | None = None,
|
|
432
|
+
) -> tuple[InsightResponseAgentOutput, AgentRunEnvelope]:
|
|
433
|
+
prompt = _build_prompt(
|
|
434
|
+
stage_name="idea_devin_post_context_response",
|
|
435
|
+
context_payload=context_payload,
|
|
436
|
+
guidance=IDEATION_RESPONSE_DOCTRINE + guidance,
|
|
437
|
+
output_model=InsightResponseAgentOutput,
|
|
438
|
+
)
|
|
439
|
+
if len(json.dumps(prompt)) > _MAX_PROMPT_CHARS:
|
|
440
|
+
artifact_path = _persist_large_context_artifact(
|
|
441
|
+
repo_root=repo_root,
|
|
442
|
+
stage_name="idea_devin_post_context_response",
|
|
443
|
+
context_payload=context_payload,
|
|
444
|
+
)
|
|
445
|
+
prompt = _build_artifact_reference_prompt(
|
|
446
|
+
stage_name="idea_devin_post_context_response",
|
|
447
|
+
output_model=InsightResponseAgentOutput,
|
|
448
|
+
guidance=IDEATION_RESPONSE_DOCTRINE + guidance,
|
|
449
|
+
artifact_path=artifact_path,
|
|
450
|
+
)
|
|
451
|
+
return _run_devin2_pi_loop_call(
|
|
452
|
+
repo_root=repo_root,
|
|
453
|
+
route_arm="insight",
|
|
454
|
+
prompt=prompt,
|
|
455
|
+
output_model=InsightResponseAgentOutput,
|
|
456
|
+
timeout_seconds=timeout_seconds,
|
|
457
|
+
)
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
def persist_agent_run(*, pipeline_root: Path, node_id: str, envelope: AgentRunEnvelope) -> Path:
|
|
462
|
+
path = pipeline_root / "agent_runs" / f"{node_id}.json"
|
|
463
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
464
|
+
path.write_text(json.dumps(envelope.model_dump(), indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
|
465
|
+
return path
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from datetime import datetime, timezone
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from .paths import get_idea_paths
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True)
|
|
12
|
+
class EvidenceItem:
|
|
13
|
+
anchor: str
|
|
14
|
+
kind: str | None = None
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _iso_now() -> str:
|
|
18
|
+
return datetime.now(timezone.utc).replace(microsecond=0).isoformat().replace("+00:00", "Z")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def collect_evidence(repo_root: Path, *, max_files: int = 50) -> list[EvidenceItem]:
|
|
22
|
+
"""Collect lightweight evidence anchors.
|
|
23
|
+
|
|
24
|
+
We deliberately avoid copying raw file contents into artifacts by default
|
|
25
|
+
to reduce secret leakage risk.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
evidence: list[EvidenceItem] = []
|
|
29
|
+
repo_name = repo_root.name
|
|
30
|
+
|
|
31
|
+
count = 0
|
|
32
|
+
for p in sorted(repo_root.rglob("*")):
|
|
33
|
+
if count >= max_files:
|
|
34
|
+
break
|
|
35
|
+
# Exclude internal/system paths.
|
|
36
|
+
posix = p.as_posix()
|
|
37
|
+
if "/.git/" in posix or "/.devflow/" in posix or p.name.startswith(".venv"):
|
|
38
|
+
continue
|
|
39
|
+
if p.is_dir():
|
|
40
|
+
continue
|
|
41
|
+
rel = p.relative_to(repo_root).as_posix()
|
|
42
|
+
anchor = f"fs:{repo_name}/{rel}"
|
|
43
|
+
kind = None
|
|
44
|
+
if rel.endswith(".md"):
|
|
45
|
+
kind = "docs"
|
|
46
|
+
elif rel.endswith(".py"):
|
|
47
|
+
kind = "python"
|
|
48
|
+
evidence.append(EvidenceItem(anchor=anchor, kind=kind))
|
|
49
|
+
count += 1
|
|
50
|
+
|
|
51
|
+
# Ensure non-empty evidence by falling back to repo root marker.
|
|
52
|
+
if not evidence:
|
|
53
|
+
evidence.append(EvidenceItem(anchor=f"fs:{repo_name}/"))
|
|
54
|
+
|
|
55
|
+
return evidence
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def write_analysis_artifact(
|
|
59
|
+
*,
|
|
60
|
+
repo_root: Path,
|
|
61
|
+
idea_id: str,
|
|
62
|
+
analysis_id: str,
|
|
63
|
+
git_ref: str | None = None,
|
|
64
|
+
) -> Path:
|
|
65
|
+
paths = get_idea_paths(repo_root, idea_id=idea_id)
|
|
66
|
+
artifact_dir = paths.analysis_root / analysis_id
|
|
67
|
+
artifact_dir.mkdir(parents=True, exist_ok=True)
|
|
68
|
+
|
|
69
|
+
evidence = collect_evidence(repo_root)
|
|
70
|
+
analysis = {
|
|
71
|
+
"analysis_id": analysis_id,
|
|
72
|
+
"idea_id": idea_id,
|
|
73
|
+
"repo_root": str(repo_root),
|
|
74
|
+
"git_ref": git_ref,
|
|
75
|
+
"created_at": _iso_now(),
|
|
76
|
+
"evidence": [{"anchor": e.anchor, "kind": e.kind} for e in evidence],
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
(artifact_dir / "analysis.json").write_text(json.dumps(analysis, indent=2, sort_keys=True), encoding="utf-8")
|
|
80
|
+
|
|
81
|
+
report_lines: list[str] = []
|
|
82
|
+
report_lines.append(f"# Analysis {analysis_id}\n")
|
|
83
|
+
report_lines.append("## Provenance\n")
|
|
84
|
+
report_lines.append(f"- idea_id: {idea_id}\n")
|
|
85
|
+
report_lines.append(f"- repo_root: {repo_root}\n")
|
|
86
|
+
report_lines.append("\n## Evidence\n")
|
|
87
|
+
for e in evidence[:25]:
|
|
88
|
+
report_lines.append(f"- anchor: {e.anchor}\n")
|
|
89
|
+
report_lines.append("\n## Redaction\n")
|
|
90
|
+
report_lines.append("Redaction enabled: stored artifacts avoid raw file contents by default.\n")
|
|
91
|
+
|
|
92
|
+
(artifact_dir / "report.md").write_text("".join(report_lines), encoding="utf-8")
|
|
93
|
+
return artifact_dir
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from devin.dag import * # noqa: F401,F403
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
from .drafts import dest_filename_for_draft, parse_locked_header
|
|
8
|
+
from .paths import get_idea_paths
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True)
|
|
12
|
+
class DiffEntry:
|
|
13
|
+
draft_story_id: str
|
|
14
|
+
draft_path: str
|
|
15
|
+
canonical_path: str | None
|
|
16
|
+
status: str # added|modified|unchanged
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _load_manifest(repo_root: Path, *, idea_id: str, draft_set_id: str) -> dict:
|
|
20
|
+
paths = get_idea_paths(repo_root, idea_id=idea_id)
|
|
21
|
+
p = paths.drafts_root / draft_set_id / "manifest.json"
|
|
22
|
+
return json.loads(p.read_text(encoding="utf-8"))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def compute_diff(
|
|
26
|
+
*,
|
|
27
|
+
repo_root: Path,
|
|
28
|
+
idea_id: str,
|
|
29
|
+
draft_set_id: str,
|
|
30
|
+
canonical_root: Path,
|
|
31
|
+
) -> list[DiffEntry]:
|
|
32
|
+
manifest = _load_manifest(repo_root, idea_id=idea_id, draft_set_id=draft_set_id)
|
|
33
|
+
draft_paths = manifest.get("draft_paths") or []
|
|
34
|
+
|
|
35
|
+
entries: list[DiffEntry] = []
|
|
36
|
+
for rel in draft_paths:
|
|
37
|
+
draft_path = repo_root / rel
|
|
38
|
+
text = draft_path.read_text(encoding="utf-8", errors="ignore")
|
|
39
|
+
header = parse_locked_header(text)
|
|
40
|
+
draft_story_id = header.get("draft_story_id") or draft_path.stem
|
|
41
|
+
|
|
42
|
+
dest_name = dest_filename_for_draft(draft_path, header=header)
|
|
43
|
+
canon_path = canonical_root / dest_name
|
|
44
|
+
|
|
45
|
+
if not canon_path.exists():
|
|
46
|
+
status = "added"
|
|
47
|
+
canon = None
|
|
48
|
+
else:
|
|
49
|
+
canon = str(canon_path)
|
|
50
|
+
canon_text = canon_path.read_text(encoding="utf-8", errors="ignore")
|
|
51
|
+
status = "unchanged" if canon_text == text else "modified"
|
|
52
|
+
|
|
53
|
+
entries.append(
|
|
54
|
+
DiffEntry(
|
|
55
|
+
draft_story_id=str(draft_story_id),
|
|
56
|
+
draft_path=str(draft_path),
|
|
57
|
+
canonical_path=canon,
|
|
58
|
+
status=status,
|
|
59
|
+
)
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
entries.sort(key=lambda e: (e.draft_story_id, e.draft_path))
|
|
63
|
+
return entries
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def render_diff_text(entries: list[DiffEntry]) -> str:
|
|
67
|
+
counts = {"added": 0, "modified": 0, "unchanged": 0}
|
|
68
|
+
for e in entries:
|
|
69
|
+
counts[e.status] = counts.get(e.status, 0) + 1
|
|
70
|
+
|
|
71
|
+
lines: list[str] = []
|
|
72
|
+
lines.append("Diff summary")
|
|
73
|
+
lines.append(f"added: {counts.get('added', 0)}")
|
|
74
|
+
lines.append(f"modified: {counts.get('modified', 0)}")
|
|
75
|
+
lines.append(f"unchanged: {counts.get('unchanged', 0)}")
|
|
76
|
+
lines.append("")
|
|
77
|
+
|
|
78
|
+
for e in entries:
|
|
79
|
+
lines.append(f"- {e.draft_story_id}: {e.status}")
|
|
80
|
+
if e.canonical_path:
|
|
81
|
+
lines.append(f" canonical: {e.canonical_path}")
|
|
82
|
+
lines.append(f" draft: {e.draft_path}")
|
|
83
|
+
|
|
84
|
+
return "\n".join(lines) + "\n"
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def render_diff_json(entries: list[DiffEntry]) -> str:
|
|
88
|
+
data = {
|
|
89
|
+
"entries": [
|
|
90
|
+
{
|
|
91
|
+
"draft_story_id": e.draft_story_id,
|
|
92
|
+
"draft_path": e.draft_path,
|
|
93
|
+
"canonical": e.canonical_path,
|
|
94
|
+
"status": e.status,
|
|
95
|
+
}
|
|
96
|
+
for e in entries
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
return json.dumps(data, indent=2, sort_keys=True) + "\n"
|