teddy-cli 0.2.3.dev1532__tar.gz → 0.2.3.dev1534__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.dev1532 → teddy_cli-0.2.3.dev1534}/PKG-INFO +14 -1
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/README.md +13 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/pyproject.toml +1 -1
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/inbound/session_cli_handlers.py +25 -14
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/outbound/litellm_adapter.py +25 -18
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/domain/models/config_schema.py +86 -1
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/inbound/get_context_use_case.py +4 -1
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/outbound/llm_client.py +4 -1
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/context_service.py +18 -4
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/planning_service.py +59 -26
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/session_orchestrator.py +20 -2
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/session_service.py +4 -1
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/resources/config/config.yaml +12 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/.gitignore +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/LICENSE +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/__main__.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/inbound/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/inbound/cli_formatter.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/inbound/cli_helpers.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/inbound/textual_plan_reviewer.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/inbound/textual_plan_reviewer_app.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/inbound/textual_plan_reviewer_editor.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/inbound/textual_plan_reviewer_execution.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/inbound/textual_plan_reviewer_helpers.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/inbound/textual_plan_reviewer_logic.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/inbound/textual_plan_reviewer_previews.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/inbound/textual_plan_reviewer_widgets.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/outbound/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/outbound/console_interactor.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/outbound/console_interactor_ask_loop.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/outbound/console_interactor_helpers.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/outbound/console_tooling.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/outbound/filesystem_helpers.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/outbound/local_file_system_adapter.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/outbound/local_repo_tree_generator.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/outbound/openrouter_hydrator.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/outbound/shell_adapter.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/outbound/shell_command_builder.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/outbound/suppressed_logging.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/outbound/system_environment_adapter.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/outbound/system_environment_inspector.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/outbound/system_time_adapter.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/outbound/terminal_quit_key_listener.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/outbound/web_scraper_adapter.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/outbound/web_searcher_adapter.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/adapters/outbound/yaml_config_adapter.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/container.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/domain/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/domain/models/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/domain/models/action_ports.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/domain/models/change_set.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/domain/models/drift_report.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/domain/models/exceptions.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/domain/models/execution_report.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/domain/models/orchestrator_ports.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/domain/models/plan.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/domain/models/planning_ports.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/domain/models/project_context.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/domain/models/report_assembly_data.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/domain/models/session.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/domain/models/shell_output.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/domain/models/web_search_results.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/inbound/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/inbound/edit_simulator.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/inbound/init.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/inbound/plan_parser.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/inbound/plan_reviewer.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/inbound/plan_validator.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/inbound/planning_use_case.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/inbound/run_plan_use_case.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/outbound/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/outbound/config_service.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/outbound/environment_inspector.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/outbound/execution_report_assembler.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/outbound/file_system_manager.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/outbound/markdown_report_formatter.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/outbound/prompt_manager.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/outbound/quit_key_listener.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/outbound/repo_tree_generator.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/outbound/session_loop_guard.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/outbound/session_manager.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/outbound/session_repository.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/outbound/shell_executor.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/outbound/system_environment.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/outbound/time_service.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/outbound/user_interactor.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/outbound/web_scraper.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/ports/outbound/web_searcher.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/action_changeset_builder.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/action_diff_manager.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/action_dispatcher.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/action_executor.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/action_factory.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/action_parser_complex.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/action_parser_strategies.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/edit_simulator.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/execution_orchestrator.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/execution_report_assembler.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/init_service.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/markdown_plan_parser.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/markdown_report_formatter.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/parser_infrastructure.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/parser_metadata.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/parser_reporting.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/plan_validator.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/prompt_manager.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/session_lifecycle_manager.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/session_loop_guard.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/session_planner.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/session_pruning_service.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/session_replanner.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/session_repository.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/templates/execution_report.md.j2 +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/update_checker.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/validation_rules/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/validation_rules/edit.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/validation_rules/edit_matcher.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/validation_rules/edit_matcher_heuristics.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/validation_rules/execute.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/validation_rules/filesystem.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/validation_rules/helpers.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/services/validation_rules/message.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/utils/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/utils/diff.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/utils/editor_names.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/utils/interrupt_guard.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/utils/interruptible_call.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/utils/io.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/utils/markdown.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/utils/message_renderer.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/utils/paths.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/utils/serialization.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/utils/session_notices.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/utils/stdin_ownership.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/utils/string.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/core/utils/terminal.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/prompts.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/registries/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/registries/infrastructure.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/registries/reviewer.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/registries/validators.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/resources/MRP.md +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/resources/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/resources/config/__init__.py +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/resources/config/init.context +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/resources/config/prompts/architect.md +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/resources/config/prompts/assistant.md +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/resources/config/prompts/debugger.md +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/resources/config/prompts/developer.md +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/resources/config/prompts/pathfinder.md +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/resources/config/prompts/prototyper.md +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/resources/templates/ARCHITECTURE.md +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/resources/templates/PROJECT.md +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/resources/templates/case-file.md +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/resources/templates/ci.md +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/resources/templates/component-design.md +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/resources/templates/makefile.md +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/resources/templates/milestone.md +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/resources/templates/pre-commit.md +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/resources/templates/specification-document.md +0 -0
- {teddy_cli-0.2.3.dev1532 → teddy_cli-0.2.3.dev1534}/src/teddy_executor/resources/templates/vertical-slice.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: teddy-cli
|
|
3
|
-
Version: 0.2.3.
|
|
3
|
+
Version: 0.2.3.dev1534
|
|
4
4
|
Summary: The local-first, test-driven agentic engineering harness. Because you should own the means of development.
|
|
5
5
|
Author: Raphael Atteritano
|
|
6
6
|
License: AGPL-3.0-only
|
|
@@ -241,6 +241,19 @@ Each subcommand rewrites only the files whose content differs from the bundled d
|
|
|
241
241
|
|
|
242
242
|
The first execution of `teddy start` runs an interactive setup to configure your API key and preferred editor. For deeper customization, edit `.teddy/config.yaml`. All `llm.*` settings pass directly through to [LiteLLM](https://docs.litellm.ai/docs/completion/input), allowing you to route to cloud providers or local endpoints (Ollama, llama.cpp, or any OpenAI-compatible server via `api_base`). The config file also lets you adjust your external editor, command execution timeouts, diff similarity thresholds, and automated context pruning budgets.
|
|
243
243
|
|
|
244
|
+
To route one agent persona to its own model while `llm.*` stays the shared default, add an `agents` block. The effective model resolves from the `--model` flag first, then `agents.<persona>.model`, then `llm.model`, and every key the persona omits still falls back to the global `llm` block. `--model` replaces only the `model` key, so a persona-level `api_key` or `api_base` still applies. The merge is one level deep: a mapping-valued key such as `extra_headers` replaces the global value wholesale rather than merging key by key. An empty or whitespace-only persona model falls back to `llm.model`, and persona names match case-insensitively.
|
|
245
|
+
|
|
246
|
+
```yaml
|
|
247
|
+
llm:
|
|
248
|
+
model: "openai/gpt-4o"
|
|
249
|
+
timeout: 300
|
|
250
|
+
agents:
|
|
251
|
+
architect:
|
|
252
|
+
model: "anthropic/claude-sonnet-4-5"
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
The API-key setup prompt reads only the global `llm.api_key`, so a persona-level `api_key` does not suppress it: when `llm.api_key` is empty the prompt still fires, and validation then reports against the merged key.
|
|
256
|
+
|
|
244
257
|
### Environment Variables
|
|
245
258
|
|
|
246
259
|
TeDDy checks the following process environment variables at startup and during a session.
|
|
@@ -206,6 +206,19 @@ Each subcommand rewrites only the files whose content differs from the bundled d
|
|
|
206
206
|
|
|
207
207
|
The first execution of `teddy start` runs an interactive setup to configure your API key and preferred editor. For deeper customization, edit `.teddy/config.yaml`. All `llm.*` settings pass directly through to [LiteLLM](https://docs.litellm.ai/docs/completion/input), allowing you to route to cloud providers or local endpoints (Ollama, llama.cpp, or any OpenAI-compatible server via `api_base`). The config file also lets you adjust your external editor, command execution timeouts, diff similarity thresholds, and automated context pruning budgets.
|
|
208
208
|
|
|
209
|
+
To route one agent persona to its own model while `llm.*` stays the shared default, add an `agents` block. The effective model resolves from the `--model` flag first, then `agents.<persona>.model`, then `llm.model`, and every key the persona omits still falls back to the global `llm` block. `--model` replaces only the `model` key, so a persona-level `api_key` or `api_base` still applies. The merge is one level deep: a mapping-valued key such as `extra_headers` replaces the global value wholesale rather than merging key by key. An empty or whitespace-only persona model falls back to `llm.model`, and persona names match case-insensitively.
|
|
210
|
+
|
|
211
|
+
```yaml
|
|
212
|
+
llm:
|
|
213
|
+
model: "openai/gpt-4o"
|
|
214
|
+
timeout: 300
|
|
215
|
+
agents:
|
|
216
|
+
architect:
|
|
217
|
+
model: "anthropic/claude-sonnet-4-5"
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
The API-key setup prompt reads only the global `llm.api_key`, so a persona-level `api_key` does not suppress it: when `llm.api_key` is empty the prompt still fires, and validation then reports against the merged key.
|
|
221
|
+
|
|
209
222
|
### Environment Variables
|
|
210
223
|
|
|
211
224
|
TeDDy checks the following process environment variables at startup and during a session.
|
|
@@ -14,6 +14,10 @@ from teddy_executor.core.ports.inbound.init import IInitUseCase
|
|
|
14
14
|
from teddy_executor.core.ports.inbound.run_plan_use_case import IRunPlanUseCase
|
|
15
15
|
from teddy_executor.core.ports.outbound.session_manager import ISessionManager
|
|
16
16
|
from teddy_executor.core.ports.outbound.system_environment import ISystemEnvironment
|
|
17
|
+
from teddy_executor.core.domain.models.config_schema import (
|
|
18
|
+
resolve_agent_llm_overrides,
|
|
19
|
+
resolve_effective_model,
|
|
20
|
+
)
|
|
17
21
|
from teddy_executor.core.domain.models.session import SessionOptions
|
|
18
22
|
from teddy_executor.core.ports.outbound.user_interactor import IUserInteractor
|
|
19
23
|
from teddy_executor.core.ports.outbound.session_loop_guard import ISessionLoopGuard
|
|
@@ -904,13 +908,23 @@ def _echo_config_success(
|
|
|
904
908
|
container: The DI container with resolved services.
|
|
905
909
|
agent: Optional agent name to display.
|
|
906
910
|
model: Optional model override from CLI. If provided, this takes
|
|
907
|
-
precedence over the config file value.
|
|
911
|
+
precedence over the config file value. When omitted, a configured
|
|
912
|
+
``agents.<persona>.model`` wins over ``llm.model``.
|
|
908
913
|
"""
|
|
909
914
|
config_service = container.resolve(IConfigService)
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
915
|
+
persona_model = None
|
|
916
|
+
if agent:
|
|
917
|
+
# Report the same effective model the planner resolves, so the
|
|
918
|
+
# persona's configured model is visible before the first turn.
|
|
919
|
+
overlay = resolve_agent_llm_overrides(
|
|
920
|
+
config_service.get_setting("agents", {}), agent
|
|
921
|
+
)
|
|
922
|
+
persona_model = overlay.get("model")
|
|
923
|
+
# One resolver owns the flag > persona > llm.model order for the banner too,
|
|
924
|
+
# so the display can never drift from the model the planner uses.
|
|
925
|
+
resolved_model = resolve_effective_model(
|
|
926
|
+
model, persona_model, config_service.get_setting("llm.model", "unknown")
|
|
927
|
+
)
|
|
914
928
|
identity_lines: list[str] = []
|
|
915
929
|
if agent:
|
|
916
930
|
identity_lines.append(f"Agent: {canonical_agent_name(agent)}")
|
|
@@ -1481,16 +1495,13 @@ def _sync_and_display_session_meta(
|
|
|
1481
1495
|
model: Optional[str] = None,
|
|
1482
1496
|
agent: Optional[str] = None,
|
|
1483
1497
|
) -> None:
|
|
1484
|
-
"""Reads latest turn meta.yaml,
|
|
1498
|
+
"""Reads latest turn meta.yaml, applies the resume --model override, and clears actual_model.
|
|
1485
1499
|
|
|
1486
1500
|
The identity banner reflects the EFFECTIVE agent: the ``-a/--agent`` override
|
|
1487
1501
|
when one was passed, otherwise the session's persisted ``agent_name``.
|
|
1488
1502
|
"""
|
|
1489
|
-
from teddy_executor.core.ports.outbound.config_service import IConfigService
|
|
1490
|
-
|
|
1491
1503
|
session_manager = container.resolve(ISessionManager)
|
|
1492
1504
|
repository: ISessionRepository = container.resolve(ISessionRepository)
|
|
1493
|
-
config_service: IConfigService = container.resolve(IConfigService)
|
|
1494
1505
|
|
|
1495
1506
|
latest_turn_path = session_manager.get_latest_turn(session_name)
|
|
1496
1507
|
meta = repository.load_meta(latest_turn_path)
|
|
@@ -1504,13 +1515,13 @@ def _sync_and_display_session_meta(
|
|
|
1504
1515
|
|
|
1505
1516
|
_echo_config_success(container, agent=agent or meta.get("agent_name"), model=model)
|
|
1506
1517
|
|
|
1507
|
-
#
|
|
1508
|
-
|
|
1518
|
+
# Only an explicit --model writes metadata. A configuration-derived model
|
|
1519
|
+
# must never be stamped into the per-turn record: resolution reads
|
|
1520
|
+
# ``model_override`` and the persona re-resolves every turn, so a stamped
|
|
1521
|
+
# ``model`` would mask the persona in the telemetry display line.
|
|
1509
1522
|
if model:
|
|
1510
1523
|
meta["model"] = model
|
|
1511
|
-
|
|
1512
|
-
elif config_model != "unknown" and meta.get("model") != config_model:
|
|
1513
|
-
meta["model"] = config_model
|
|
1524
|
+
meta["model_override"] = model
|
|
1514
1525
|
changed = True
|
|
1515
1526
|
if changed:
|
|
1516
1527
|
repository.save_meta(f"{latest_turn_path}/meta.yaml", meta)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import math
|
|
3
|
-
from typing import Any, Dict, List, Optional, Protocol
|
|
3
|
+
from typing import Any, Dict, List, Mapping, Optional, Protocol
|
|
4
4
|
from teddy_executor.core.ports.outbound.config_service import IConfigService
|
|
5
5
|
from teddy_executor.core.domain.models.exceptions import ConfigurationError
|
|
6
6
|
from teddy_executor.core.ports.outbound.llm_client import ILlmClient, LlmApiError
|
|
@@ -112,11 +112,17 @@ class LiteLLMAdapter(ILlmClient):
|
|
|
112
112
|
# Request, retry, and hydration form one linear flow whose branching is
|
|
113
113
|
# inherent to the provider protocol. Extracting it is outside this change.
|
|
114
114
|
def get_completion( # noqa: C901
|
|
115
|
-
self,
|
|
115
|
+
self,
|
|
116
|
+
messages: List[Dict[str, str]],
|
|
117
|
+
model: Optional[str] = None,
|
|
118
|
+
llm_overrides: Optional[Mapping[str, Any]] = None,
|
|
119
|
+
**kwargs: Any,
|
|
116
120
|
) -> Any:
|
|
117
121
|
"""
|
|
118
122
|
Sends a request to an LLM via litellm and returns the raw response object.
|
|
119
123
|
Values in the 'llm' section of the config are passed directly to LiteLLM.
|
|
124
|
+
``llm_overrides`` layers the active persona's settings over that block,
|
|
125
|
+
below the per-call ``model``.
|
|
120
126
|
"""
|
|
121
127
|
litellm = self._get_litellm()
|
|
122
128
|
|
|
@@ -129,20 +135,9 @@ class LiteLLMAdapter(ILlmClient):
|
|
|
129
135
|
raise ConfigurationError(errors[0])
|
|
130
136
|
self._validated = True
|
|
131
137
|
|
|
132
|
-
final_params = self._prepare_completion_params(
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
if not self._validated:
|
|
136
|
-
with self._init_lock:
|
|
137
|
-
if not self._validated:
|
|
138
|
-
from teddy_executor.core.domain.models.exceptions import (
|
|
139
|
-
ConfigurationError as _ConfigError,
|
|
140
|
-
)
|
|
141
|
-
|
|
142
|
-
errors = self.validate_config()
|
|
143
|
-
if errors:
|
|
144
|
-
raise _ConfigError(errors[0])
|
|
145
|
-
self._validated = True
|
|
138
|
+
final_params = self._prepare_completion_params(
|
|
139
|
+
model, llm_overrides=llm_overrides, **kwargs
|
|
140
|
+
)
|
|
146
141
|
|
|
147
142
|
max_attempts_val = final_params.get("max_retries")
|
|
148
143
|
max_attempts = int(max_attempts_val) if max_attempts_val is not None else 3
|
|
@@ -167,9 +162,18 @@ class LiteLLMAdapter(ILlmClient):
|
|
|
167
162
|
raise LlmApiError(f"LLM Completion failed: {final_msg}") from last_exception
|
|
168
163
|
|
|
169
164
|
def _prepare_completion_params(
|
|
170
|
-
self,
|
|
165
|
+
self,
|
|
166
|
+
model: Optional[str] = None,
|
|
167
|
+
llm_overrides: Optional[Mapping[str, Any]] = None,
|
|
168
|
+
**kwargs: Any,
|
|
171
169
|
) -> Dict[str, Any]:
|
|
172
|
-
"""Resolves and layers configuration for the completion request.
|
|
170
|
+
"""Resolves and layers configuration for the completion request.
|
|
171
|
+
|
|
172
|
+
Precedence, lowest first: runtime kwargs, the global ``llm`` block, the
|
|
173
|
+
persona overlay, then the per-call model. The overlay replaces a key's
|
|
174
|
+
complete value (one level deep), so a persona ``extra_headers`` mapping
|
|
175
|
+
supersedes the global one wholesale.
|
|
176
|
+
"""
|
|
173
177
|
from typing import cast
|
|
174
178
|
|
|
175
179
|
params = {**kwargs}
|
|
@@ -177,6 +181,9 @@ class LiteLLMAdapter(ILlmClient):
|
|
|
177
181
|
llm_config = cast(Dict[str, Any], self._config_service.get_setting("llm", {}))
|
|
178
182
|
params.update(llm_config)
|
|
179
183
|
|
|
184
|
+
if llm_overrides:
|
|
185
|
+
params.update(llm_overrides)
|
|
186
|
+
|
|
180
187
|
# Drop an empty/blank api_key so litellm applies the provider's own
|
|
181
188
|
# default (e.g. a dummy key for keyless local models). Forwarding "" is
|
|
182
189
|
# equivalent to a missing key and raises AuthenticationError.
|
|
@@ -276,9 +276,93 @@ _DECLARED_KEY_TARGETS: dict[str, tuple[str | None, str]] = {
|
|
|
276
276
|
_KNOWN_TOP_LEVEL = frozenset(
|
|
277
277
|
{spec.group for spec in _SCHEMA_FIELDS if spec.group is not None}
|
|
278
278
|
| {spec.key for spec in _SCHEMA_FIELDS if spec.group is None}
|
|
279
|
-
| {"llm"}
|
|
279
|
+
| {"llm", "agents"}
|
|
280
280
|
)
|
|
281
281
|
|
|
282
|
+
_AGENTS_GROUP = "agents"
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
def resolve_agent_llm_overrides(agents_block: Any, persona: str) -> dict[str, Any]:
|
|
286
|
+
"""Return the per-persona ``llm`` overlay from the ``agents`` block.
|
|
287
|
+
|
|
288
|
+
The overlay is a copy of the persona entry, so a caller can merge it without
|
|
289
|
+
mutating the lazily interpolated merged configuration. Persona matching is
|
|
290
|
+
case-insensitive, mirroring the prompt resolver's casefold stem rule. A blank
|
|
291
|
+
``model`` is dropped, because an empty model would reach the provider as an
|
|
292
|
+
unresolvable identifier. Any malformed input (a non-mapping block, a
|
|
293
|
+
non-mapping entry) resolves to an empty overlay, so runtime extraction is
|
|
294
|
+
total; ``construct_app_config`` is the raising seam at load time.
|
|
295
|
+
"""
|
|
296
|
+
if not isinstance(agents_block, Mapping):
|
|
297
|
+
return {}
|
|
298
|
+
entry: Any = None
|
|
299
|
+
for key, value in agents_block.items():
|
|
300
|
+
if isinstance(key, str) and key.casefold() == persona.casefold():
|
|
301
|
+
entry = value
|
|
302
|
+
break
|
|
303
|
+
if not isinstance(entry, Mapping):
|
|
304
|
+
return {}
|
|
305
|
+
overlay = dict(entry)
|
|
306
|
+
model = overlay.get("model")
|
|
307
|
+
if isinstance(model, str) and not model.strip():
|
|
308
|
+
del overlay["model"]
|
|
309
|
+
return overlay
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
def resolve_effective_model(
|
|
313
|
+
override: Any, persona_model: Any, global_model: Any
|
|
314
|
+
) -> str:
|
|
315
|
+
"""Resolve the effective model by the slice precedence.
|
|
316
|
+
|
|
317
|
+
The explicit ``--model`` flag override wins, then the persona entry, then the
|
|
318
|
+
global ``llm.model``. A blank or non-string candidate is skipped so an empty
|
|
319
|
+
identifier never propagates to the provider. When every candidate is blank
|
|
320
|
+
the resolver returns an empty string.
|
|
321
|
+
"""
|
|
322
|
+
for candidate in (override, persona_model, global_model):
|
|
323
|
+
if isinstance(candidate, str) and candidate.strip():
|
|
324
|
+
return candidate
|
|
325
|
+
return ""
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
def _validate_agents_block(merged: Mapping[str, Any]) -> None:
|
|
329
|
+
"""Reject an unusable ``agents`` block at load time.
|
|
330
|
+
|
|
331
|
+
A non-mapping block, a non-mapping persona entry, and two persona keys that
|
|
332
|
+
differ only in case each raise a ``ConfigurationError`` naming the offending
|
|
333
|
+
key. The duplicate case fails because case-insensitive matching would
|
|
334
|
+
otherwise make the winning entry depend on YAML key order.
|
|
335
|
+
"""
|
|
336
|
+
if _AGENTS_GROUP not in merged:
|
|
337
|
+
return
|
|
338
|
+
block = merged[_AGENTS_GROUP]
|
|
339
|
+
if block is None:
|
|
340
|
+
return
|
|
341
|
+
if not isinstance(block, Mapping):
|
|
342
|
+
raise ConfigurationError(
|
|
343
|
+
f"Configuration key '{_AGENTS_GROUP}' expected a mapping of persona "
|
|
344
|
+
f"names, got {block!r}."
|
|
345
|
+
)
|
|
346
|
+
seen: set[str] = set()
|
|
347
|
+
for persona, entry in block.items():
|
|
348
|
+
if not isinstance(persona, str):
|
|
349
|
+
raise ConfigurationError(
|
|
350
|
+
f"Configuration key '{_AGENTS_GROUP}' expected string persona "
|
|
351
|
+
f"names, got {persona!r}."
|
|
352
|
+
)
|
|
353
|
+
folded = persona.casefold()
|
|
354
|
+
if folded in seen:
|
|
355
|
+
raise ConfigurationError(
|
|
356
|
+
f"Configuration key '{_AGENTS_GROUP}' declares the persona "
|
|
357
|
+
f"{persona!r} more than once when ignoring case. Keep one spelling."
|
|
358
|
+
)
|
|
359
|
+
seen.add(folded)
|
|
360
|
+
if not isinstance(entry, Mapping):
|
|
361
|
+
raise ConfigurationError(
|
|
362
|
+
f"Configuration key '{_AGENTS_GROUP}.{persona}' expected a mapping "
|
|
363
|
+
f"of llm settings, got {entry!r}."
|
|
364
|
+
)
|
|
365
|
+
|
|
282
366
|
|
|
283
367
|
def is_declared_key(key: str) -> bool:
|
|
284
368
|
"""Report whether ``key`` is a schema-declared configuration key."""
|
|
@@ -345,6 +429,7 @@ def construct_app_config(merged: Mapping[str, Any]) -> AppConfig:
|
|
|
345
429
|
Undeclared top-level groups are ignored so future keys stay forward
|
|
346
430
|
compatible.
|
|
347
431
|
"""
|
|
432
|
+
_validate_agents_block(merged)
|
|
348
433
|
_log_unknown_keys(merged)
|
|
349
434
|
group_overrides: dict[str, dict[str, Any]] = {}
|
|
350
435
|
top_level_overrides: dict[str, Any] = {}
|
|
@@ -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( # noqa: PLR0913 - inbound-port seam; additive
|
|
11
|
+
def get_context( # noqa: PLR0913 - inbound-port seam; additive keywords
|
|
12
12
|
self,
|
|
13
13
|
context_files: Optional[Dict[str, Sequence[str]]] = None,
|
|
14
14
|
include_tokens: bool = True,
|
|
@@ -18,6 +18,7 @@ class IGetContextUseCase(Protocol):
|
|
|
18
18
|
current_turn: Optional[str] = None,
|
|
19
19
|
system_prompt_tokens: int = 0,
|
|
20
20
|
session_root: Optional[str] = None,
|
|
21
|
+
model: Optional[str] = None,
|
|
21
22
|
) -> ProjectContext:
|
|
22
23
|
"""
|
|
23
24
|
Gathers all project context information.
|
|
@@ -28,6 +29,8 @@ class IGetContextUseCase(Protocol):
|
|
|
28
29
|
system_prompt_tokens: Token count of the system prompt (pre-computed).
|
|
29
30
|
session_root: Optional root of the rendering session, used to gate
|
|
30
31
|
session-history classification.
|
|
32
|
+
model: Optional effective model used for token counting. Omitted,
|
|
33
|
+
the provider's configured model is used.
|
|
31
34
|
|
|
32
35
|
Returns:
|
|
33
36
|
ProjectContext: A data object containing the aggregated context.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from abc import ABC, abstractmethod
|
|
2
|
-
from typing import Any, Dict, List, Optional
|
|
2
|
+
from typing import Any, Dict, List, Mapping, Optional
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class LlmApiError(Exception):
|
|
@@ -18,6 +18,7 @@ class ILlmClient(ABC):
|
|
|
18
18
|
self,
|
|
19
19
|
messages: List[Dict[str, str]],
|
|
20
20
|
model: Optional[str] = None,
|
|
21
|
+
llm_overrides: Optional[Mapping[str, Any]] = None,
|
|
21
22
|
**kwargs: Any,
|
|
22
23
|
) -> Any:
|
|
23
24
|
"""
|
|
@@ -26,6 +27,8 @@ class ILlmClient(ABC):
|
|
|
26
27
|
Args:
|
|
27
28
|
messages: A list of message dictionaries (role/content).
|
|
28
29
|
model: Optional identifier for the target model (overrides config).
|
|
30
|
+
llm_overrides: Optional per-persona overlay merged over the global
|
|
31
|
+
``llm`` block, with ``model`` still applied last.
|
|
29
32
|
**kwargs: Additional parameters for the LLM provider.
|
|
30
33
|
|
|
31
34
|
Returns:
|
|
@@ -55,6 +55,7 @@ class ContextService(IGetContextUseCase):
|
|
|
55
55
|
current_turn: Optional[str] = None,
|
|
56
56
|
system_prompt_tokens: int = 0,
|
|
57
57
|
session_root: Optional[str] = None,
|
|
58
|
+
model: Optional[str] = None,
|
|
58
59
|
) -> ProjectContext:
|
|
59
60
|
"""
|
|
60
61
|
Gathers all project context information by orchestrating its dependencies.
|
|
@@ -113,7 +114,7 @@ class ContextService(IGetContextUseCase):
|
|
|
113
114
|
repo_tree, scoped_paths, file_contents, git_status, session_root
|
|
114
115
|
)
|
|
115
116
|
content_tokens = (
|
|
116
|
-
self.
|
|
117
|
+
self._count_text_tokens(content, model) if include_tokens else 0
|
|
117
118
|
)
|
|
118
119
|
|
|
119
120
|
return ProjectContext(
|
|
@@ -122,7 +123,7 @@ class ContextService(IGetContextUseCase):
|
|
|
122
123
|
scoped_paths=scoped_paths,
|
|
123
124
|
git_status=git_status,
|
|
124
125
|
items=self._collect_items(
|
|
125
|
-
scoped_paths, file_contents, git_status, include_tokens
|
|
126
|
+
scoped_paths, file_contents, git_status, include_tokens, model
|
|
126
127
|
),
|
|
127
128
|
agent_name=agent_name,
|
|
128
129
|
total_window=total_window,
|
|
@@ -277,6 +278,7 @@ class ContextService(IGetContextUseCase):
|
|
|
277
278
|
file_contents: Dict[str, Optional[str]],
|
|
278
279
|
git_status: Optional[str],
|
|
279
280
|
include_tokens: bool,
|
|
281
|
+
model: Optional[str] = None,
|
|
280
282
|
) -> List[ContextItem]:
|
|
281
283
|
"""
|
|
282
284
|
Orchestrates the assembly of ContextItem metadata DTOs.
|
|
@@ -284,7 +286,7 @@ class ContextService(IGetContextUseCase):
|
|
|
284
286
|
"""
|
|
285
287
|
parsed_status = self._parse_git_status(git_status)
|
|
286
288
|
path_to_tokens = self._get_path_to_tokens(
|
|
287
|
-
scoped_paths, file_contents, include_tokens
|
|
289
|
+
scoped_paths, file_contents, include_tokens, model
|
|
288
290
|
)
|
|
289
291
|
|
|
290
292
|
# Deduplication map: path -> ContextItem
|
|
@@ -308,11 +310,23 @@ class ContextService(IGetContextUseCase):
|
|
|
308
310
|
|
|
309
311
|
return list(items_map.values())
|
|
310
312
|
|
|
313
|
+
def _count_text_tokens(self, text: str, model: Optional[str]) -> int:
|
|
314
|
+
"""Count tokens with the effective model, preserving the no-model shape.
|
|
315
|
+
|
|
316
|
+
A caller without an effective model issues the same single-argument call
|
|
317
|
+
as before, so existing call-argument assertions and side-effect fakes
|
|
318
|
+
that accept only the text stay valid.
|
|
319
|
+
"""
|
|
320
|
+
if model:
|
|
321
|
+
return self._llm_client.get_text_token_count(text, model=model)
|
|
322
|
+
return self._llm_client.get_text_token_count(text)
|
|
323
|
+
|
|
311
324
|
def _get_path_to_tokens(
|
|
312
325
|
self,
|
|
313
326
|
scoped_paths: Dict[str, List[str]],
|
|
314
327
|
file_contents: Dict[str, Optional[str]],
|
|
315
328
|
include_tokens: bool,
|
|
329
|
+
model: Optional[str] = None,
|
|
316
330
|
) -> Dict[str, int]:
|
|
317
331
|
"""Calculates token counts for all unique files in parallel."""
|
|
318
332
|
if not include_tokens:
|
|
@@ -326,7 +340,7 @@ class ContextService(IGetContextUseCase):
|
|
|
326
340
|
|
|
327
341
|
def get_count(path: str) -> tuple[str, int]:
|
|
328
342
|
content = file_contents.get(path) or ""
|
|
329
|
-
return path, self.
|
|
343
|
+
return path, self._count_text_tokens(content, model)
|
|
330
344
|
|
|
331
345
|
# Parallelize to handle large repositories without stalling the UI.
|
|
332
346
|
# We use a ThreadPoolExecutor as token counting is often offloaded or involves latency.
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
2
|
from typing import Any, Dict, Optional, Sequence
|
|
3
3
|
from teddy_executor.core.domain.models import ProjectContext
|
|
4
|
+
from teddy_executor.core.domain.models.config_schema import (
|
|
5
|
+
resolve_agent_llm_overrides,
|
|
6
|
+
resolve_effective_model,
|
|
7
|
+
)
|
|
4
8
|
from teddy_executor.core.ports.inbound.planning_use_case import IPlanningUseCase
|
|
5
9
|
from teddy_executor.core.utils.interruptible_call import run_interruptible
|
|
6
10
|
|
|
@@ -60,10 +64,21 @@ class PlanningService(IPlanningUseCase):
|
|
|
60
64
|
|
|
61
65
|
system_prompt = self._prompt_manager.fetch_system_prompt(agent_name, turn_path)
|
|
62
66
|
|
|
63
|
-
#
|
|
64
|
-
#
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
# One resolution feeds both the effective model and the completion
|
|
68
|
+
# overlay, so the two can never disagree. An absent persona block yields
|
|
69
|
+
# an empty overlay, leaving the global ``llm`` path unchanged.
|
|
70
|
+
llm_overrides = resolve_agent_llm_overrides(
|
|
71
|
+
self._config_service.get_setting("agents", {}), agent_name
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
# The explicit ``--model`` flag (carried as ``model_override``) wins,
|
|
75
|
+
# then the persona entry, then the global default. The carried ``model``
|
|
76
|
+
# key is display data only and never a resolution input, so a persona
|
|
77
|
+
# switched on resume re-resolves every turn.
|
|
78
|
+
model = resolve_effective_model(
|
|
79
|
+
meta.get("model_override"),
|
|
80
|
+
llm_overrides.get("model"),
|
|
81
|
+
self._config_service.get_setting("llm.model"),
|
|
67
82
|
)
|
|
68
83
|
try:
|
|
69
84
|
system_token_count = self._llm_client.get_text_token_count(
|
|
@@ -80,6 +95,7 @@ class PlanningService(IPlanningUseCase):
|
|
|
80
95
|
system_prompt_tokens=system_token_count,
|
|
81
96
|
cache_dir=session_root,
|
|
82
97
|
session_root=session_root,
|
|
98
|
+
model=model,
|
|
83
99
|
)
|
|
84
100
|
|
|
85
101
|
# Context is purely project state (including initial_request.md via session.context).
|
|
@@ -97,7 +113,7 @@ class PlanningService(IPlanningUseCase):
|
|
|
97
113
|
)
|
|
98
114
|
|
|
99
115
|
response, token_count, plan_content, turn_cost = run_interruptible(
|
|
100
|
-
lambda: self._run_planning_phase(messages, model, meta)
|
|
116
|
+
lambda: self._run_planning_phase(messages, model, meta, llm_overrides)
|
|
101
117
|
)
|
|
102
118
|
|
|
103
119
|
# Persist the explicit recorded-cost signal (Option B): a real price was
|
|
@@ -126,6 +142,7 @@ class PlanningService(IPlanningUseCase):
|
|
|
126
142
|
messages: list[Dict[str, str]],
|
|
127
143
|
model: str,
|
|
128
144
|
meta: Dict[str, Any],
|
|
145
|
+
llm_overrides: Optional[Dict[str, Any]] = None,
|
|
129
146
|
) -> tuple[Any, int, str, float]:
|
|
130
147
|
"""Perform every blocking planning call on the interruptible worker.
|
|
131
148
|
|
|
@@ -140,17 +157,20 @@ class PlanningService(IPlanningUseCase):
|
|
|
140
157
|
self._llm_client.get_context_window(model=model)
|
|
141
158
|
|
|
142
159
|
token_count = int(
|
|
143
|
-
self._safe_float(
|
|
160
|
+
self._safe_float(
|
|
161
|
+
self._llm_client.get_token_count(messages=messages, model=model)
|
|
162
|
+
)
|
|
144
163
|
)
|
|
145
164
|
|
|
146
165
|
if self._user_interactor:
|
|
147
|
-
self._display_telemetry(meta, token_count)
|
|
166
|
+
self._display_telemetry(meta, token_count, model)
|
|
148
167
|
|
|
149
168
|
self._check_context_budget(token_count, model)
|
|
150
169
|
|
|
151
170
|
response, plan_content, turn_cost = self._perform_generation_with_retry(
|
|
152
171
|
messages,
|
|
153
172
|
model=model,
|
|
173
|
+
llm_overrides=llm_overrides,
|
|
154
174
|
)
|
|
155
175
|
return response, token_count, plan_content, turn_cost
|
|
156
176
|
|
|
@@ -158,6 +178,7 @@ class PlanningService(IPlanningUseCase):
|
|
|
158
178
|
self,
|
|
159
179
|
messages: list[Dict[str, str]],
|
|
160
180
|
model: str,
|
|
181
|
+
llm_overrides: Optional[Dict[str, Any]] = None,
|
|
161
182
|
) -> tuple[Any, str, float]:
|
|
162
183
|
"""Implements retry loop for empty LLM content."""
|
|
163
184
|
max_retries_val = self._config_service.get_setting("llm.max_retries")
|
|
@@ -167,7 +188,13 @@ class PlanningService(IPlanningUseCase):
|
|
|
167
188
|
turn_cost = 0.0
|
|
168
189
|
|
|
169
190
|
for attempt in range(max_retries):
|
|
170
|
-
|
|
191
|
+
# The overlay key is added only when the persona configures one, so a
|
|
192
|
+
# project without an ``agents`` block issues the same call shape as
|
|
193
|
+
# before this feature existed.
|
|
194
|
+
completion_kwargs: Dict[str, Any] = {"messages": messages, "model": model}
|
|
195
|
+
if llm_overrides:
|
|
196
|
+
completion_kwargs["llm_overrides"] = llm_overrides
|
|
197
|
+
response = self._llm_client.get_completion(**completion_kwargs)
|
|
171
198
|
plan_content = self._extract_plan_content(response)
|
|
172
199
|
attempt_cost = self._llm_client.get_completion_cost(
|
|
173
200
|
response, model_override=model
|
|
@@ -184,17 +211,14 @@ class PlanningService(IPlanningUseCase):
|
|
|
184
211
|
|
|
185
212
|
return response, plan_content, turn_cost
|
|
186
213
|
|
|
187
|
-
# Class-level cache to ensure remote preflight is performed exactly once per process.
|
|
188
|
-
# This eliminates the 10s timeout lag on subsequent turns in a session.
|
|
189
|
-
_PREFLIGHT_DONE = False
|
|
190
|
-
|
|
191
|
-
@classmethod
|
|
192
|
-
def reset_preflight(cls) -> None:
|
|
193
|
-
"""Resets the preflight cache (used primarily for testing)."""
|
|
194
|
-
cls._PREFLIGHT_DONE = False
|
|
195
|
-
|
|
196
214
|
def _run_preflight_check(self) -> None:
|
|
197
|
-
"""Ensures system is configured before attempting generation.
|
|
215
|
+
"""Ensures system is configured before attempting generation.
|
|
216
|
+
|
|
217
|
+
Validation runs on every turn, so a persona switched mid-session is
|
|
218
|
+
always checked against the active configuration. There is deliberately
|
|
219
|
+
no process-wide preflight cache: a cache keyed on nothing would only
|
|
220
|
+
suppress re-validating a different persona, and the local check is cheap.
|
|
221
|
+
"""
|
|
198
222
|
from teddy_executor.core.domain.models.exceptions import ConfigurationError
|
|
199
223
|
|
|
200
224
|
# Perform local validation only. Remote connectivity is checked lazily
|
|
@@ -202,12 +226,9 @@ class PlanningService(IPlanningUseCase):
|
|
|
202
226
|
# and eliminates redundant remote lag for sessions.
|
|
203
227
|
errors = self._llm_client.validate_config(include_remote=False)
|
|
204
228
|
|
|
205
|
-
if
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
error_msg = f"Configuration Error: {', '.join(errors)}"
|
|
210
|
-
raise ConfigurationError(error_msg)
|
|
229
|
+
if errors:
|
|
230
|
+
error_msg = f"Configuration Error: {', '.join(errors)}"
|
|
231
|
+
raise ConfigurationError(error_msg)
|
|
211
232
|
|
|
212
233
|
def _extract_plan_content(self, response: Any) -> str:
|
|
213
234
|
"""Robustly extracts content from the LLM response object."""
|
|
@@ -215,11 +236,23 @@ class PlanningService(IPlanningUseCase):
|
|
|
215
236
|
return getattr(response.choices[0].message, "content", "") or ""
|
|
216
237
|
return ""
|
|
217
238
|
|
|
218
|
-
def _display_telemetry(
|
|
219
|
-
|
|
239
|
+
def _display_telemetry(
|
|
240
|
+
self,
|
|
241
|
+
meta: Dict[str, Any],
|
|
242
|
+
token_count: int,
|
|
243
|
+
effective_model: Optional[str] = None,
|
|
244
|
+
) -> None:
|
|
245
|
+
"""Displays real-time telemetry about the upcoming LLM call.
|
|
246
|
+
|
|
247
|
+
The served ``actual_model`` wins for an already-answered turn, then the
|
|
248
|
+
carried ``model`` (display data), then the freshly resolved effective
|
|
249
|
+
model. The ordering keeps a fresh turn's banner on the effective model
|
|
250
|
+
without disturbing an existing display value.
|
|
251
|
+
"""
|
|
220
252
|
model = str(
|
|
221
253
|
meta.get("actual_model")
|
|
222
254
|
or meta.get("model")
|
|
255
|
+
or effective_model
|
|
223
256
|
or self._config_service.get_setting("llm.model")
|
|
224
257
|
or "unknown"
|
|
225
258
|
)
|
|
@@ -4,6 +4,10 @@ from dataclasses import is_dataclass, replace
|
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
from typing import Any, Optional, cast
|
|
6
6
|
|
|
7
|
+
from teddy_executor.core.domain.models.config_schema import (
|
|
8
|
+
resolve_agent_llm_overrides,
|
|
9
|
+
resolve_effective_model,
|
|
10
|
+
)
|
|
7
11
|
from teddy_executor.core.domain.models.execution_report import (
|
|
8
12
|
ExecutionReport,
|
|
9
13
|
)
|
|
@@ -453,7 +457,21 @@ class SessionOrchestrator(IRunPlanUseCase):
|
|
|
453
457
|
else "Unknown"
|
|
454
458
|
)
|
|
455
459
|
)
|
|
456
|
-
|
|
460
|
+
# Resolve the effective model exactly as the planner does: the turn's
|
|
461
|
+
# explicit ``model_override``, then the persona entry, then ``llm.model``.
|
|
462
|
+
# The carried ``model`` key is display data and never a resolution input.
|
|
463
|
+
turn_dir = str(Path(plan_path).parent)
|
|
464
|
+
turn_meta = self._session_service.load_turn_meta(turn_dir)
|
|
465
|
+
llm_overrides = resolve_agent_llm_overrides(
|
|
466
|
+
self._config_service.get_setting("agents", {}), agent_name
|
|
467
|
+
)
|
|
468
|
+
model = resolve_effective_model(
|
|
469
|
+
turn_meta.get("model_override"),
|
|
470
|
+
llm_overrides.get("model"),
|
|
471
|
+
self._config_service.get_setting("llm.model"),
|
|
472
|
+
)
|
|
473
|
+
|
|
474
|
+
total_window = self._llm_client.get_context_window(model=model)
|
|
457
475
|
|
|
458
476
|
cache_dir = str(Path(plan_path).parent.parent)
|
|
459
477
|
# Compute system prompt token count BEFORE context construction so the
|
|
@@ -461,7 +479,6 @@ class SessionOrchestrator(IRunPlanUseCase):
|
|
|
461
479
|
system_prompt = self._prompt_manager.fetch_system_prompt(
|
|
462
480
|
agent_name, Path(plan_path).parent
|
|
463
481
|
)
|
|
464
|
-
model = str(self._config_service.get_setting("llm.model") or "")
|
|
465
482
|
try:
|
|
466
483
|
system_token_count = self._llm_client.get_text_token_count(
|
|
467
484
|
system_prompt, model=model
|
|
@@ -476,6 +493,7 @@ class SessionOrchestrator(IRunPlanUseCase):
|
|
|
476
493
|
cache_dir=cache_dir,
|
|
477
494
|
system_prompt_tokens=system_token_count,
|
|
478
495
|
session_root=cache_dir,
|
|
496
|
+
model=model,
|
|
479
497
|
)
|
|
480
498
|
|
|
481
499
|
if is_dataclass(project_context) and agent_name != getattr(
|