teddy-cli 0.2.3.dev1529__tar.gz → 0.2.3.dev1531__tar.gz
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.
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/PKG-INFO +1 -1
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/pyproject.toml +1 -1
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/inbound/session_cli_handlers.py +15 -1
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/inbound/textual_plan_reviewer_helpers.py +21 -10
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/inbound/textual_plan_reviewer_logic.py +2 -1
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/domain/models/project_context.py +2 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/inbound/get_context_use_case.py +4 -1
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/outbound/session_manager.py +5 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/context_service.py +14 -8
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/execution_orchestrator.py +20 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/planning_service.py +3 -1
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/session_lifecycle_manager.py +132 -1
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/session_orchestrator.py +1 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/utils/markdown.py +40 -7
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/.gitignore +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/LICENSE +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/README.md +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/__main__.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/inbound/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/inbound/cli_formatter.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/inbound/cli_helpers.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/inbound/textual_plan_reviewer.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/inbound/textual_plan_reviewer_app.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/inbound/textual_plan_reviewer_editor.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/inbound/textual_plan_reviewer_execution.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/inbound/textual_plan_reviewer_previews.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/inbound/textual_plan_reviewer_widgets.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/outbound/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/outbound/console_interactor.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/outbound/console_interactor_ask_loop.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/outbound/console_interactor_helpers.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/outbound/console_tooling.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/outbound/filesystem_helpers.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/outbound/litellm_adapter.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/outbound/local_file_system_adapter.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/outbound/local_repo_tree_generator.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/outbound/openrouter_hydrator.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/outbound/shell_adapter.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/outbound/shell_command_builder.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/outbound/suppressed_logging.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/outbound/system_environment_adapter.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/outbound/system_environment_inspector.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/outbound/system_time_adapter.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/outbound/terminal_quit_key_listener.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/outbound/web_scraper_adapter.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/outbound/web_searcher_adapter.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/outbound/yaml_config_adapter.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/container.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/domain/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/domain/models/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/domain/models/action_ports.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/domain/models/change_set.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/domain/models/config_schema.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/domain/models/drift_report.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/domain/models/exceptions.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/domain/models/execution_report.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/domain/models/orchestrator_ports.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/domain/models/plan.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/domain/models/planning_ports.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/domain/models/report_assembly_data.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/domain/models/session.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/domain/models/shell_output.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/domain/models/web_search_results.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/inbound/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/inbound/edit_simulator.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/inbound/init.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/inbound/plan_parser.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/inbound/plan_reviewer.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/inbound/plan_validator.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/inbound/planning_use_case.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/inbound/run_plan_use_case.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/outbound/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/outbound/config_service.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/outbound/environment_inspector.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/outbound/execution_report_assembler.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/outbound/file_system_manager.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/outbound/llm_client.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/outbound/markdown_report_formatter.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/outbound/prompt_manager.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/outbound/quit_key_listener.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/outbound/repo_tree_generator.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/outbound/session_loop_guard.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/outbound/session_repository.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/outbound/shell_executor.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/outbound/system_environment.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/outbound/time_service.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/outbound/user_interactor.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/outbound/web_scraper.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/ports/outbound/web_searcher.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/action_changeset_builder.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/action_diff_manager.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/action_dispatcher.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/action_executor.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/action_factory.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/action_parser_complex.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/action_parser_strategies.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/edit_simulator.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/execution_report_assembler.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/init_service.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/markdown_plan_parser.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/markdown_report_formatter.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/parser_infrastructure.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/parser_metadata.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/parser_reporting.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/plan_validator.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/prompt_manager.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/session_loop_guard.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/session_planner.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/session_pruning_service.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/session_replanner.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/session_repository.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/session_service.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/templates/execution_report.md.j2 +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/update_checker.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/validation_rules/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/validation_rules/edit.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/validation_rules/edit_matcher.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/validation_rules/edit_matcher_heuristics.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/validation_rules/execute.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/validation_rules/filesystem.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/validation_rules/helpers.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/services/validation_rules/message.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/utils/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/utils/diff.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/utils/editor_names.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/utils/interrupt_guard.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/utils/interruptible_call.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/utils/io.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/utils/message_renderer.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/utils/paths.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/utils/serialization.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/utils/session_notices.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/utils/stdin_ownership.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/utils/string.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/utils/terminal.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/prompts.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/registries/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/registries/infrastructure.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/registries/reviewer.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/registries/validators.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/resources/MRP.md +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/resources/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/resources/config/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/resources/config/config.yaml +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/resources/config/init.context +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/resources/config/prompts/architect.md +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/resources/config/prompts/assistant.md +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/resources/config/prompts/debugger.md +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/resources/config/prompts/developer.md +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/resources/config/prompts/pathfinder.md +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/resources/config/prompts/prototyper.md +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/resources/templates/ARCHITECTURE.md +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/resources/templates/PROJECT.md +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/resources/templates/case-file.md +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/resources/templates/ci.md +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/resources/templates/component-design.md +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/resources/templates/makefile.md +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/resources/templates/milestone.md +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/resources/templates/pre-commit.md +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/resources/templates/specification-document.md +0 -0
- {teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/resources/templates/vertical-slice.md +0 -0
|
@@ -1401,6 +1401,18 @@ def detect_session_context() -> Optional[Dict[str, Sequence[str]]]:
|
|
|
1401
1401
|
return None
|
|
1402
1402
|
|
|
1403
1403
|
|
|
1404
|
+
def detect_session_root() -> Optional[str]:
|
|
1405
|
+
"""Resolves the current session's root, or None outside a session.
|
|
1406
|
+
|
|
1407
|
+
Derives from `detect_session_context` so the three-file session gate lives
|
|
1408
|
+
in one place. The scope map that function returns must not be reused as a
|
|
1409
|
+
path source, because `--only` and `-c` override it.
|
|
1410
|
+
"""
|
|
1411
|
+
if detect_session_context() is None:
|
|
1412
|
+
return None
|
|
1413
|
+
return str(Path.cwd().parent)
|
|
1414
|
+
|
|
1415
|
+
|
|
1404
1416
|
def _default_context_paths(container: Container) -> list[str]:
|
|
1405
1417
|
"""Resolves the default `.teddy/*.context` entries outside a session."""
|
|
1406
1418
|
file_system_manager = container.resolve(IFileSystemManager)
|
|
@@ -1436,7 +1448,9 @@ def handle_context_gathering(
|
|
|
1436
1448
|
|
|
1437
1449
|
# Performance: Formatting context for Markdown doesn't use tokens, so we skip them.
|
|
1438
1450
|
context_result = context_service.get_context(
|
|
1439
|
-
context_files=context_files,
|
|
1451
|
+
context_files=context_files,
|
|
1452
|
+
include_tokens=False,
|
|
1453
|
+
session_root=detect_session_root(),
|
|
1440
1454
|
)
|
|
1441
1455
|
formatted_context = format_project_context(context_result)
|
|
1442
1456
|
echo_and_copy(formatted_context, no_copy=no_copy)
|
|
@@ -77,18 +77,22 @@ def populate_context_detail(app: "ReviewerApp", pane: Any, data: Any) -> None:
|
|
|
77
77
|
f"{(app.project_context.system_prompt_tokens + system_info_tokens) / 1000.0:.1f}k",
|
|
78
78
|
)
|
|
79
79
|
)
|
|
80
|
+
session_root = app.project_context.session_root
|
|
80
81
|
session_tokens = sum(
|
|
81
82
|
i.token_count
|
|
82
83
|
for i in selected_items
|
|
83
|
-
if i.scope == "Session"
|
|
84
|
+
if i.scope == "Session"
|
|
85
|
+
and not is_session_history_path(i.path, session_root)
|
|
84
86
|
)
|
|
85
87
|
turn_tokens = sum(
|
|
86
88
|
i.token_count
|
|
87
89
|
for i in selected_items
|
|
88
|
-
if i.scope == "Turn" and not is_session_history_path(i.path)
|
|
90
|
+
if i.scope == "Turn" and not is_session_history_path(i.path, session_root)
|
|
89
91
|
)
|
|
90
92
|
history_tokens = sum(
|
|
91
|
-
i.token_count
|
|
93
|
+
i.token_count
|
|
94
|
+
for i in selected_items
|
|
95
|
+
if is_session_history_path(i.path, session_root)
|
|
92
96
|
)
|
|
93
97
|
|
|
94
98
|
pane.append(DetailItem("• Session", f"{session_tokens / 1000.0:.1f}k"))
|
|
@@ -99,7 +103,9 @@ def populate_context_detail(app: "ReviewerApp", pane: Any, data: Any) -> None:
|
|
|
99
103
|
# Editor helpers moved to textual_plan_reviewer_editor.py
|
|
100
104
|
|
|
101
105
|
|
|
102
|
-
def format_context_item_label(
|
|
106
|
+
def format_context_item_label(
|
|
107
|
+
item: "ContextItem", session_root: str | None = None
|
|
108
|
+
) -> str:
|
|
103
109
|
"""Format a context item label according to UI standards."""
|
|
104
110
|
status_colors = {
|
|
105
111
|
"M": "yellow",
|
|
@@ -119,7 +125,7 @@ def format_context_item_label(item: "ContextItem") -> str:
|
|
|
119
125
|
|
|
120
126
|
from teddy_executor.core.utils.markdown import get_session_history_display_name
|
|
121
127
|
|
|
122
|
-
disp_name = get_session_history_display_name(item.path)
|
|
128
|
+
disp_name = get_session_history_display_name(item.path, session_root)
|
|
123
129
|
display_path = disp_name if disp_name else item.path
|
|
124
130
|
|
|
125
131
|
if not item.selected:
|
|
@@ -139,11 +145,12 @@ def build_context_section(app: "ReviewerApp", tree: Any) -> Any:
|
|
|
139
145
|
HISTORY_LABEL,
|
|
140
146
|
)
|
|
141
147
|
from teddy_executor.core.utils.markdown import (
|
|
142
|
-
|
|
148
|
+
is_own_session_path,
|
|
143
149
|
is_session_history_path,
|
|
144
150
|
get_session_history_sort_key,
|
|
145
151
|
)
|
|
146
152
|
|
|
153
|
+
session_root = app.project_context.session_root
|
|
147
154
|
con_root = tree.root.add("[bold]Context[/]", data=CONTEXT_ROOT, expand=False)
|
|
148
155
|
con_root.add_leaf("[#888888 italic]System:[/]", data=SYSTEM_LABEL)
|
|
149
156
|
token_str = f" [#888888]{app.project_context.system_prompt_tokens / 1000.0:.1f}k[/]"
|
|
@@ -161,21 +168,25 @@ def build_context_section(app: "ReviewerApp", tree: Any) -> Any:
|
|
|
161
168
|
con_root.add_leaf(f"[#888888 italic]{scope}:[/]", data=label)
|
|
162
169
|
count = 0
|
|
163
170
|
for item in app.project_context.items:
|
|
164
|
-
if item.scope == scope and not
|
|
165
|
-
con_root.add_leaf(
|
|
171
|
+
if item.scope == scope and not is_own_session_path(item.path, session_root):
|
|
172
|
+
con_root.add_leaf(
|
|
173
|
+
format_context_item_label(item, session_root), data=item
|
|
174
|
+
)
|
|
166
175
|
count += 1
|
|
167
176
|
if count == 0:
|
|
168
177
|
con_root.add_leaf(" [#888888](None)[/]", data=label)
|
|
169
178
|
|
|
170
179
|
# Chronological history turns
|
|
171
180
|
history_items = [
|
|
172
|
-
item
|
|
181
|
+
item
|
|
182
|
+
for item in app.project_context.items
|
|
183
|
+
if is_session_history_path(item.path, session_root)
|
|
173
184
|
]
|
|
174
185
|
if history_items:
|
|
175
186
|
con_root.add_leaf("[#888888 italic]History:[/]", data=HISTORY_LABEL)
|
|
176
187
|
history_items.sort(key=lambda x: get_session_history_sort_key(x.path))
|
|
177
188
|
for item in history_items:
|
|
178
|
-
con_root.add_leaf(format_context_item_label(item), data=item)
|
|
189
|
+
con_root.add_leaf(format_context_item_label(item, session_root), data=item)
|
|
179
190
|
|
|
180
191
|
return con_root
|
|
181
192
|
|
|
@@ -184,7 +184,8 @@ def refresh_node_logic(app: ReviewerApp, node: Any) -> None:
|
|
|
184
184
|
if isinstance(node.data, ActionData):
|
|
185
185
|
node.label = format_node_label(node.data)
|
|
186
186
|
elif isinstance(node.data, ContextItem):
|
|
187
|
-
|
|
187
|
+
session_root = app.project_context.session_root if app.project_context else None
|
|
188
|
+
node.label = format_context_item_label(node.data, session_root)
|
|
188
189
|
|
|
189
190
|
|
|
190
191
|
def on_mount_logic(app: Any) -> None:
|
|
@@ -43,6 +43,7 @@ class ProjectContext:
|
|
|
43
43
|
agent_name: Name of the active agent.
|
|
44
44
|
system_prompt_tokens: Token count of the system prompt.
|
|
45
45
|
total_window: Total context window for the model.
|
|
46
|
+
session_root: Optional root of the session the context was assembled for.
|
|
46
47
|
"""
|
|
47
48
|
|
|
48
49
|
header: str
|
|
@@ -54,3 +55,4 @@ class ProjectContext:
|
|
|
54
55
|
system_prompt_tokens: int = 0
|
|
55
56
|
content_tokens: int = 0
|
|
56
57
|
total_window: int = 0
|
|
58
|
+
session_root: Optional[str] = None
|
|
@@ -8,7 +8,7 @@ class IGetContextUseCase(Protocol):
|
|
|
8
8
|
This defines the contract for the primary entry point for gathering project context.
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
|
-
def get_context(
|
|
11
|
+
def get_context( # noqa: PLR0913 - inbound-port seam; additive keyword
|
|
12
12
|
self,
|
|
13
13
|
context_files: Optional[Dict[str, Sequence[str]]] = None,
|
|
14
14
|
include_tokens: bool = True,
|
|
@@ -17,6 +17,7 @@ class IGetContextUseCase(Protocol):
|
|
|
17
17
|
cache_dir: Optional[str] = None,
|
|
18
18
|
current_turn: Optional[str] = None,
|
|
19
19
|
system_prompt_tokens: int = 0,
|
|
20
|
+
session_root: Optional[str] = None,
|
|
20
21
|
) -> ProjectContext:
|
|
21
22
|
"""
|
|
22
23
|
Gathers all project context information.
|
|
@@ -25,6 +26,8 @@ class IGetContextUseCase(Protocol):
|
|
|
25
26
|
context_files: Optional mapping of scope names to .context files.
|
|
26
27
|
current_turn: Optional 2-digit turn number to include in the header.
|
|
27
28
|
system_prompt_tokens: Token count of the system prompt (pre-computed).
|
|
29
|
+
session_root: Optional root of the rendering session, used to gate
|
|
30
|
+
session-history classification.
|
|
28
31
|
|
|
29
32
|
Returns:
|
|
30
33
|
ProjectContext: A data object containing the aggregated context.
|
|
@@ -5,6 +5,11 @@ from teddy_executor.core.domain.models import ExecutionReport
|
|
|
5
5
|
from teddy_executor.core.domain.models.session import SessionOptions
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
# Marks a session turn that began executing; its presence distinguishes a
|
|
9
|
+
# hard-killed mid-execution turn from a never-dispatched pending turn.
|
|
10
|
+
EXECUTION_STARTED_MARKER = "execution.started"
|
|
11
|
+
|
|
12
|
+
|
|
8
13
|
class SessionState(Enum):
|
|
9
14
|
"""Represents the current state of a session based on its latest turn."""
|
|
10
15
|
|
|
@@ -6,7 +6,8 @@ from teddy_executor.core.domain.models import ProjectContext, ContextItem
|
|
|
6
6
|
from teddy_executor.core.utils.markdown import (
|
|
7
7
|
embed_in_fence,
|
|
8
8
|
get_language_from_path,
|
|
9
|
-
|
|
9
|
+
is_own_session_path,
|
|
10
|
+
is_session_history_path,
|
|
10
11
|
get_session_history_display_name,
|
|
11
12
|
get_session_history_sort_key,
|
|
12
13
|
)
|
|
@@ -53,6 +54,7 @@ class ContextService(IGetContextUseCase):
|
|
|
53
54
|
cache_dir: Optional[str] = None,
|
|
54
55
|
current_turn: Optional[str] = None,
|
|
55
56
|
system_prompt_tokens: int = 0,
|
|
57
|
+
session_root: Optional[str] = None,
|
|
56
58
|
) -> ProjectContext:
|
|
57
59
|
"""
|
|
58
60
|
Gathers all project context information by orchestrating its dependencies.
|
|
@@ -108,7 +110,7 @@ class ContextService(IGetContextUseCase):
|
|
|
108
110
|
web_cache = {}
|
|
109
111
|
|
|
110
112
|
content = self._format_content(
|
|
111
|
-
repo_tree, scoped_paths, file_contents, git_status
|
|
113
|
+
repo_tree, scoped_paths, file_contents, git_status, session_root
|
|
112
114
|
)
|
|
113
115
|
content_tokens = (
|
|
114
116
|
self._llm_client.get_text_token_count(content) if include_tokens else 0
|
|
@@ -126,6 +128,7 @@ class ContextService(IGetContextUseCase):
|
|
|
126
128
|
total_window=total_window,
|
|
127
129
|
system_prompt_tokens=system_prompt_tokens,
|
|
128
130
|
content_tokens=content_tokens,
|
|
131
|
+
session_root=session_root,
|
|
129
132
|
)
|
|
130
133
|
|
|
131
134
|
def _cap_plan_contents(
|
|
@@ -391,6 +394,7 @@ class ContextService(IGetContextUseCase):
|
|
|
391
394
|
scoped_paths: Dict[str, List[str]],
|
|
392
395
|
file_contents: Dict[str, Optional[str]],
|
|
393
396
|
git_status: Optional[str] = None,
|
|
397
|
+
session_root: Optional[str] = None,
|
|
394
398
|
) -> str:
|
|
395
399
|
"""Formats the main content section of the context report."""
|
|
396
400
|
# Gather all unique paths
|
|
@@ -400,9 +404,10 @@ class ContextService(IGetContextUseCase):
|
|
|
400
404
|
if p not in all_paths:
|
|
401
405
|
all_paths.append(p)
|
|
402
406
|
|
|
403
|
-
# Partition
|
|
404
|
-
|
|
405
|
-
session_paths = [p for p in all_paths if
|
|
407
|
+
# Partition this session's own artifacts from ordinary resources. A path
|
|
408
|
+
# read from another session is a resource, not our own history.
|
|
409
|
+
session_paths = [p for p in all_paths if is_own_session_path(p, session_root)]
|
|
410
|
+
workspace_paths = [p for p in all_paths if p not in session_paths]
|
|
406
411
|
|
|
407
412
|
git_status_body = (
|
|
408
413
|
embed_in_fence(git_status, "")
|
|
@@ -424,7 +429,7 @@ class ContextService(IGetContextUseCase):
|
|
|
424
429
|
|
|
425
430
|
# Prepend Session History section first (after header's System Information)
|
|
426
431
|
session_history_parts = self._format_session_history(
|
|
427
|
-
session_paths, file_contents
|
|
432
|
+
session_paths, file_contents, session_root
|
|
428
433
|
)
|
|
429
434
|
if session_history_parts:
|
|
430
435
|
content_parts = session_history_parts + content_parts
|
|
@@ -514,13 +519,14 @@ class ContextService(IGetContextUseCase):
|
|
|
514
519
|
self,
|
|
515
520
|
session_paths: List[str],
|
|
516
521
|
file_contents: Dict[str, Optional[str]],
|
|
522
|
+
session_root: Optional[str] = None,
|
|
517
523
|
) -> List[str]:
|
|
518
524
|
"""Formats the session history section."""
|
|
519
525
|
if not session_paths:
|
|
520
526
|
return []
|
|
521
527
|
|
|
522
528
|
recognized_session_paths = [
|
|
523
|
-
p for p in session_paths if
|
|
529
|
+
p for p in session_paths if is_session_history_path(p, session_root)
|
|
524
530
|
]
|
|
525
531
|
if not recognized_session_paths:
|
|
526
532
|
return []
|
|
@@ -528,7 +534,7 @@ class ContextService(IGetContextUseCase):
|
|
|
528
534
|
recognized_session_paths.sort(key=get_session_history_sort_key)
|
|
529
535
|
parts = ["\n## Session History"]
|
|
530
536
|
for path in recognized_session_paths:
|
|
531
|
-
disp_name = get_session_history_display_name(path)
|
|
537
|
+
disp_name = get_session_history_display_name(path, session_root)
|
|
532
538
|
content = file_contents.get(path) or ""
|
|
533
539
|
content_str = content.strip()
|
|
534
540
|
lang = get_language_from_path(path)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from contextlib import ExitStack
|
|
3
3
|
from datetime import datetime
|
|
4
|
+
from pathlib import Path
|
|
4
5
|
|
|
5
6
|
from typing import Any, Optional
|
|
6
7
|
|
|
@@ -14,6 +15,7 @@ from teddy_executor.core.domain.models import (
|
|
|
14
15
|
)
|
|
15
16
|
from teddy_executor.core.ports.inbound.plan_parser import InvalidPlanError
|
|
16
17
|
from teddy_executor.core.ports.inbound.run_plan_use_case import IRunPlanUseCase
|
|
18
|
+
from teddy_executor.core.ports.outbound.session_manager import EXECUTION_STARTED_MARKER
|
|
17
19
|
from teddy_executor.core.domain.models.orchestrator_ports import OrchestratorPorts
|
|
18
20
|
from teddy_executor.core.utils.interrupt_guard import INTERRUPT_REASON
|
|
19
21
|
|
|
@@ -285,6 +287,21 @@ class ExecutionOrchestrator(IRunPlanUseCase):
|
|
|
285
287
|
report, run_summary=replace(report.run_summary, status=RunStatus.ABORTED)
|
|
286
288
|
)
|
|
287
289
|
|
|
290
|
+
def _write_execution_started_marker(
|
|
291
|
+
self, plan: Plan, plan_path: Optional[str]
|
|
292
|
+
) -> None:
|
|
293
|
+
"""Records durably that this session turn began executing.
|
|
294
|
+
|
|
295
|
+
Written after pre-flight validation and plan review but before the first
|
|
296
|
+
dispatch, so a turn killed mid-execution is distinguishable from a
|
|
297
|
+
never-dispatched one. Only session turns are marked: a stateless run
|
|
298
|
+
leaves no turn directory to recover.
|
|
299
|
+
"""
|
|
300
|
+
marker_source = plan.plan_path or plan_path
|
|
301
|
+
assert marker_source, "A session plan must carry a plan path."
|
|
302
|
+
marker_path = (Path(marker_source).parent / EXECUTION_STARTED_MARKER).as_posix()
|
|
303
|
+
self._file_system_manager.write_file(marker_path, "")
|
|
304
|
+
|
|
288
305
|
def execute( # noqa: PLR0913
|
|
289
306
|
self,
|
|
290
307
|
plan: Optional[Plan] = None,
|
|
@@ -319,6 +336,9 @@ class ExecutionOrchestrator(IRunPlanUseCase):
|
|
|
319
336
|
if reviewed_plan is None:
|
|
320
337
|
return self._handle_aborted_execution(plan, start_time, message)
|
|
321
338
|
|
|
339
|
+
if reviewed_plan.is_session:
|
|
340
|
+
self._write_execution_started_marker(reviewed_plan, plan_path)
|
|
341
|
+
|
|
322
342
|
action_logs = self._process_plan_actions(
|
|
323
343
|
reviewed_plan, require_approval, pipeline
|
|
324
344
|
)
|
|
@@ -72,12 +72,14 @@ class PlanningService(IPlanningUseCase):
|
|
|
72
72
|
except Exception:
|
|
73
73
|
system_token_count = 0
|
|
74
74
|
|
|
75
|
+
session_root = str(Path(turn_dir).parent)
|
|
75
76
|
context = self._context_service.get_context(
|
|
76
77
|
context_files=resolved_context_files,
|
|
77
78
|
agent_name=agent_name,
|
|
78
79
|
current_turn=Path(turn_dir).name,
|
|
79
80
|
system_prompt_tokens=system_token_count,
|
|
80
|
-
cache_dir=
|
|
81
|
+
cache_dir=session_root,
|
|
82
|
+
session_root=session_root,
|
|
81
83
|
)
|
|
82
84
|
|
|
83
85
|
# Context is purely project state (including initial_request.md via session.context).
|
|
@@ -15,7 +15,10 @@ from typing import Sequence
|
|
|
15
15
|
|
|
16
16
|
from teddy_executor.core.ports.inbound.plan_parser import InvalidPlanError
|
|
17
17
|
from teddy_executor.core.ports.inbound.run_plan_use_case import IRunPlanUseCase
|
|
18
|
-
from teddy_executor.core.ports.outbound.session_manager import
|
|
18
|
+
from teddy_executor.core.ports.outbound.session_manager import (
|
|
19
|
+
EXECUTION_STARTED_MARKER,
|
|
20
|
+
SessionState,
|
|
21
|
+
)
|
|
19
22
|
from teddy_executor.core.utils.io import Tee as _Tee
|
|
20
23
|
from teddy_executor.core.utils.markdown import embed_in_fence
|
|
21
24
|
|
|
@@ -108,6 +111,18 @@ class SessionLifecycleManager:
|
|
|
108
111
|
message=message,
|
|
109
112
|
plan=plan,
|
|
110
113
|
)
|
|
114
|
+
interrupted_plan = self._marked_interrupted_plan(turn_path, plan, plan_path)
|
|
115
|
+
if interrupted_plan is not None:
|
|
116
|
+
return self._recover_interrupted_turn(
|
|
117
|
+
turn_path,
|
|
118
|
+
interrupted_plan,
|
|
119
|
+
plan_path,
|
|
120
|
+
orchestrator,
|
|
121
|
+
require_approval,
|
|
122
|
+
project_context=project_context,
|
|
123
|
+
pipeline=pipeline,
|
|
124
|
+
message=message,
|
|
125
|
+
)
|
|
111
126
|
if plan is not None:
|
|
112
127
|
plan.metadata["user_request"] = message
|
|
113
128
|
report = orchestrator.execute(
|
|
@@ -141,6 +156,41 @@ class SessionLifecycleManager:
|
|
|
141
156
|
|
|
142
157
|
return (session_name, None)
|
|
143
158
|
|
|
159
|
+
def _marked_interrupted_plan(
|
|
160
|
+
self, turn_path: str, plan: Optional["Plan"], plan_path: str
|
|
161
|
+
) -> Optional["Plan"]:
|
|
162
|
+
"""Returns the abandoned plan when a hard-killed turn must be recovered.
|
|
163
|
+
|
|
164
|
+
A turn that began executing (``execution.started`` present) but never
|
|
165
|
+
finalized carries no report, so replaying its plan would re-apply
|
|
166
|
+
already-applied actions. Recovery applies only to a non-communication
|
|
167
|
+
plan: a MESSAGE-only turn keeps today's re-dispatch so the message
|
|
168
|
+
re-collects the reply. The plan is reused when the caller already
|
|
169
|
+
parsed it (``-m`` resume) and parsed here for classification on a bare
|
|
170
|
+
resume; an unparseable plan returns ``None`` so the caller falls
|
|
171
|
+
through to the established ``execute -> InvalidPlanError ->
|
|
172
|
+
trigger_replan`` funnel rather than swallowing the failure.
|
|
173
|
+
"""
|
|
174
|
+
marker_path = (Path(plan_path).parent / EXECUTION_STARTED_MARKER).as_posix()
|
|
175
|
+
if not self._file_system_manager.path_exists(marker_path):
|
|
176
|
+
return None
|
|
177
|
+
interrupted_plan = plan
|
|
178
|
+
if interrupted_plan is None:
|
|
179
|
+
try:
|
|
180
|
+
interrupted_plan = self._parse_awaiting_plan(
|
|
181
|
+
turn_path, plan_path=plan_path
|
|
182
|
+
)
|
|
183
|
+
except InvalidPlanError:
|
|
184
|
+
logger.debug(
|
|
185
|
+
"Marked pending plan at %s is unparseable; falling back to "
|
|
186
|
+
"the re-execute path.",
|
|
187
|
+
plan_path,
|
|
188
|
+
)
|
|
189
|
+
return None
|
|
190
|
+
if interrupted_plan.is_communication_turn():
|
|
191
|
+
return None
|
|
192
|
+
return interrupted_plan
|
|
193
|
+
|
|
144
194
|
def _resume_ready_turn( # noqa: PLR0913 # threads the resume state-machine inputs
|
|
145
195
|
self,
|
|
146
196
|
session_name: str,
|
|
@@ -438,6 +488,38 @@ class SessionLifecycleManager:
|
|
|
438
488
|
message=reply,
|
|
439
489
|
)
|
|
440
490
|
|
|
491
|
+
def _recover_interrupted_turn( # noqa: PLR0913 # resume state-machine inputs
|
|
492
|
+
self,
|
|
493
|
+
turn_path: str,
|
|
494
|
+
plan: "Plan",
|
|
495
|
+
plan_path: str,
|
|
496
|
+
orchestrator: IRunPlanUseCase,
|
|
497
|
+
require_approval: bool,
|
|
498
|
+
project_context: Optional[Any] = None,
|
|
499
|
+
pipeline: bool = False,
|
|
500
|
+
message: Optional[str] = None,
|
|
501
|
+
) -> tuple[str, Optional[ExecutionReport]]:
|
|
502
|
+
"""Finalizes a hard-killed turn as INTERRUPTED, then plans the next turn.
|
|
503
|
+
|
|
504
|
+
The abandoned plan is never re-executed: the synthesized INTERRUPTED
|
|
505
|
+
report finalizes the turn (writing ``report.md`` and creating the
|
|
506
|
+
successor), and planning then runs from scratch against the observed
|
|
507
|
+
workspace so the fresh plan sees the already-mutated files. A reply,
|
|
508
|
+
when present, is carried into the interrupted report's ``## User
|
|
509
|
+
Request`` and seeds the successor's planning -- the same tail shape
|
|
510
|
+
``_consume_awaiting_reply`` uses.
|
|
511
|
+
"""
|
|
512
|
+
report = self._synthesize_interrupted_report(plan, message=message)
|
|
513
|
+
next_turn_dir = self.finalize_turn(plan_path, report, plan=plan)
|
|
514
|
+
return self._handle_planning_and_execution(
|
|
515
|
+
next_turn_dir,
|
|
516
|
+
orchestrator,
|
|
517
|
+
require_approval,
|
|
518
|
+
project_context=project_context,
|
|
519
|
+
pipeline=pipeline,
|
|
520
|
+
message=message,
|
|
521
|
+
)
|
|
522
|
+
|
|
441
523
|
def _parse_awaiting_plan(
|
|
442
524
|
self, turn_path: str, plan_path: Optional[str] = None
|
|
443
525
|
) -> "Plan":
|
|
@@ -524,6 +606,55 @@ class SessionLifecycleManager:
|
|
|
524
606
|
)
|
|
525
607
|
)
|
|
526
608
|
|
|
609
|
+
def _synthesize_interrupted_report(
|
|
610
|
+
self, plan: "Plan", message: Optional[str] = None
|
|
611
|
+
) -> ExecutionReport:
|
|
612
|
+
"""Synthesizes an INTERRUPTED report for a hard-killed session turn.
|
|
613
|
+
|
|
614
|
+
A hard kill runs no drain and writes no report, so the turn's outcome
|
|
615
|
+
is unobservable. Every planned action is therefore recorded as
|
|
616
|
+
INTERRUPTED with an explicit "outcome not recorded" note, so a reader
|
|
617
|
+
(and the preservation decision) can tell the turn was abandoned
|
|
618
|
+
mid-flight rather than completed. The injected ``message`` becomes the
|
|
619
|
+
report's ``## User Request`` so the resume reply is preserved on the
|
|
620
|
+
finalized turn; without one the turn follows normal action-turn
|
|
621
|
+
behavior.
|
|
622
|
+
"""
|
|
623
|
+
assert self._time_service is not None, (
|
|
624
|
+
"SessionPorts.time_service must be injected to synthesize the "
|
|
625
|
+
"interrupted turn's report."
|
|
626
|
+
)
|
|
627
|
+
assert self._report_assembler is not None, (
|
|
628
|
+
"SessionPorts.report_assembler must be injected to synthesize the "
|
|
629
|
+
"interrupted turn's report."
|
|
630
|
+
)
|
|
631
|
+
action_logs = []
|
|
632
|
+
for action in plan.actions:
|
|
633
|
+
params = dict(action.params)
|
|
634
|
+
if action.description:
|
|
635
|
+
params["Description"] = action.description
|
|
636
|
+
action_logs.append(
|
|
637
|
+
ActionLog(
|
|
638
|
+
status=ActionStatus.INTERRUPTED,
|
|
639
|
+
action_type=str(getattr(action.type, "value", action.type)),
|
|
640
|
+
params=params,
|
|
641
|
+
details=(
|
|
642
|
+
"Outcome not recorded: the running process was "
|
|
643
|
+
"terminated ungracefully; this action may or may not "
|
|
644
|
+
"have applied."
|
|
645
|
+
),
|
|
646
|
+
)
|
|
647
|
+
)
|
|
648
|
+
return self._report_assembler.assemble(
|
|
649
|
+
ReportAssemblyData(
|
|
650
|
+
plan=plan,
|
|
651
|
+
action_logs=action_logs,
|
|
652
|
+
start_time=self._time_service.now_utc(),
|
|
653
|
+
message=message,
|
|
654
|
+
is_session=True,
|
|
655
|
+
)
|
|
656
|
+
)
|
|
657
|
+
|
|
527
658
|
def _handle_planning_and_execution( # noqa: PLR0913
|
|
528
659
|
self,
|
|
529
660
|
turn_dir: str,
|
{teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/core/utils/markdown.py
RENAMED
|
@@ -229,11 +229,42 @@ def embed_in_fence(content: str, lang: str) -> str:
|
|
|
229
229
|
return f"{fence}{lang}\n{sanitized}\n{fence}"
|
|
230
230
|
|
|
231
231
|
|
|
232
|
-
def
|
|
232
|
+
def _normalize_session_path(path: str) -> str:
|
|
233
|
+
"""Normalize a path to POSIX slashes with any leading './' removed."""
|
|
234
|
+
return path.replace("\\", "/").lstrip("./")
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def _session_directory_name(session_root: str) -> str:
|
|
238
|
+
"""Return the final path component of a session root (its directory name)."""
|
|
239
|
+
return _normalize_session_path(session_root).rstrip("/").rsplit("/", 1)[-1]
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
def is_own_session_path(path: str, session_root: str | None) -> bool:
|
|
243
|
+
"""
|
|
244
|
+
Determines whether ``path`` belongs to the session at ``session_root``.
|
|
245
|
+
|
|
246
|
+
Falls back to the coarse ``is_session_file_path`` test when no root is
|
|
247
|
+
supplied, so legacy callers keep their session-agnostic partition.
|
|
248
|
+
"""
|
|
249
|
+
if not is_session_file_path(path):
|
|
250
|
+
return False
|
|
251
|
+
if not session_root:
|
|
252
|
+
return True
|
|
253
|
+
session_name = _session_directory_name(session_root)
|
|
254
|
+
return session_name in _normalize_session_path(path).split("/")
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def get_session_history_display_name(
|
|
258
|
+
path: str, session_root: str | None = None
|
|
259
|
+
) -> str | None:
|
|
233
260
|
"""
|
|
234
261
|
Returns human-readable display name if it's a recognized session history file.
|
|
262
|
+
|
|
263
|
+
When ``session_root`` is supplied, a path outside that session is not history.
|
|
235
264
|
"""
|
|
236
|
-
|
|
265
|
+
if session_root and not is_own_session_path(path, session_root):
|
|
266
|
+
return None
|
|
267
|
+
clean_path = _normalize_session_path(path)
|
|
237
268
|
if "initial_request.md" in clean_path:
|
|
238
269
|
return "Initial Request"
|
|
239
270
|
plan_match = re.search(r"sessions/[^/]+/(\d+)/plan.md$", clean_path)
|
|
@@ -248,22 +279,24 @@ def get_session_history_display_name(path: str) -> str | None:
|
|
|
248
279
|
def is_session_file_path(path: str) -> bool:
|
|
249
280
|
"""
|
|
250
281
|
Determines if a path is inside .teddy/sessions/.
|
|
282
|
+
|
|
283
|
+
Normalizes backslashes first, so a Windows-style path is recognized too.
|
|
251
284
|
"""
|
|
252
|
-
return "sessions/" in path
|
|
285
|
+
return "sessions/" in _normalize_session_path(path)
|
|
253
286
|
|
|
254
287
|
|
|
255
|
-
def is_session_history_path(path: str) -> bool:
|
|
288
|
+
def is_session_history_path(path: str, session_root: str | None = None) -> bool:
|
|
256
289
|
"""
|
|
257
|
-
Determines if a path is a session history file
|
|
290
|
+
Determines if a path is a session history file for ``session_root``.
|
|
258
291
|
"""
|
|
259
|
-
return get_session_history_display_name(path) is not None
|
|
292
|
+
return get_session_history_display_name(path, session_root) is not None
|
|
260
293
|
|
|
261
294
|
|
|
262
295
|
def get_session_history_sort_key(path: str) -> tuple[int, int]:
|
|
263
296
|
"""
|
|
264
297
|
Sort key for chronological session history: (turn_number, sub_order).
|
|
265
298
|
"""
|
|
266
|
-
clean_path = path
|
|
299
|
+
clean_path = _normalize_session_path(path)
|
|
267
300
|
if "initial_request.md" in clean_path:
|
|
268
301
|
return (0, 0)
|
|
269
302
|
plan_match = re.search(r"sessions/[^/]+/(\d+)/plan.md$", clean_path)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/inbound/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{teddy_cli-0.2.3.dev1529 → teddy_cli-0.2.3.dev1531}/src/teddy_executor/adapters/outbound/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|