tunacode-cli 0.0.35__tar.gz → 0.0.37__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.
Potentially problematic release.
This version of tunacode-cli might be problematic. Click here for more details.
- {tunacode_cli-0.0.35/src/tunacode_cli.egg-info → tunacode_cli-0.0.37}/PKG-INFO +17 -17
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/README.md +16 -14
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/pyproject.toml +24 -7
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/setup.py +1 -1
- tunacode_cli-0.0.37/src/tunacode/cli/commands/__init__.py +62 -0
- tunacode_cli-0.0.37/src/tunacode/cli/commands/base.py +99 -0
- tunacode_cli-0.0.37/src/tunacode/cli/commands/implementations/__init__.py +38 -0
- tunacode_cli-0.0.37/src/tunacode/cli/commands/implementations/conversation.py +115 -0
- tunacode_cli-0.0.37/src/tunacode/cli/commands/implementations/debug.py +189 -0
- tunacode_cli-0.0.37/src/tunacode/cli/commands/implementations/development.py +77 -0
- tunacode_cli-0.0.37/src/tunacode/cli/commands/implementations/model.py +61 -0
- tunacode_cli-0.0.37/src/tunacode/cli/commands/implementations/system.py +216 -0
- tunacode_cli-0.0.37/src/tunacode/cli/commands/registry.py +236 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/cli/repl.py +91 -30
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/configuration/settings.py +9 -2
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/constants.py +1 -1
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/core/agents/main.py +53 -3
- tunacode_cli-0.0.37/src/tunacode/core/agents/utils.py +304 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/core/setup/config_setup.py +0 -1
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/core/state.py +13 -2
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/setup.py +7 -2
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/tools/read_file.py +8 -2
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/tools/read_file_async_poc.py +18 -10
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/tools/run_command.py +11 -4
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/ui/console.py +31 -4
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/ui/output.py +7 -2
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/ui/panels.py +98 -5
- tunacode_cli-0.0.37/src/tunacode/ui/utils.py +3 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/utils/text_utils.py +6 -2
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37/src/tunacode_cli.egg-info}/PKG-INFO +17 -17
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode_cli.egg-info/SOURCES.txt +13 -1
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode_cli.egg-info/requires.txt +1 -3
- tunacode_cli-0.0.37/tests/characterization/agent/__init__.py +1 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/agent/conftest.py +8 -5
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/agent/test_agent_creation.py +84 -66
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/agent/test_json_tool_parsing.py +57 -59
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/agent/test_process_node.py +115 -79
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/agent/test_process_request.py +112 -104
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/agent/test_tool_message_patching.py +59 -54
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/background/test_background_edge_cases.py +18 -2
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/background/test_cleanup.py +11 -2
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/background/test_task_cancellation.py +9 -3
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/background/test_task_creation.py +7 -2
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/background/test_task_execution.py +7 -2
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/code_index/test_cache_management.py +8 -2
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/code_index/test_file_scanning.py +9 -2
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/code_index/test_index_building.py +15 -4
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/code_index/test_search_operations.py +11 -1
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/code_index/test_symbol_extraction.py +11 -5
- tunacode_cli-0.0.37/tests/characterization/commands/__init__.py +1 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/commands/test_init_command.py +63 -67
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/conftest.py +24 -4
- tunacode_cli-0.0.37/tests/characterization/context/__init__.py +1 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/context/test_context_acceptance.py +14 -16
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/context/test_context_integration.py +15 -16
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/context/test_context_loading.py +27 -28
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/context/test_tunacode_logging.py +15 -16
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/repl/test_command_parsing.py +27 -17
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/repl/test_input_handling.py +24 -17
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/repl/test_keyboard_interrupts.py +17 -12
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/repl/test_multiline_input.py +17 -12
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/repl/test_repl_initialization.py +14 -10
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/repl/test_session_flow.py +34 -22
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/services/test_error_recovery.py +13 -4
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/services/test_llm_routing.py +13 -4
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/services/test_mcp_integration.py +13 -4
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/services/test_service_lifecycle.py +13 -4
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/state/test_agent_tracking.py +5 -2
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/state/test_message_history.py +6 -2
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/state/test_permissions.py +5 -3
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/state/test_session_management.py +5 -2
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/state/test_state_initialization.py +7 -3
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/state/test_user_config.py +5 -2
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/test_characterization_commands.py +75 -68
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/ui/test_async_ui.py +7 -2
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/ui/test_console_output.py +7 -5
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/ui/test_diff_display.py +4 -3
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/ui/test_prompt_rendering.py +7 -2
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/ui/test_tool_confirmations.py +6 -4
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/utils/test_file_operations.py +11 -7
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/utils/test_git_commands.py +32 -6
- tunacode_cli-0.0.37/tests/characterization/utils/test_token_counting.py +39 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/characterization/utils/test_utils_edge_cases.py +18 -7
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/conftest.py +109 -52
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/crud/test_core_file_operations.py +87 -71
- tunacode_cli-0.0.37/tests/fixtures/__init__.py +1 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/fixtures/file_operations.py +97 -78
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/integration/test_error_recovery_flow.py +4 -2
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/integration/test_full_session_flow.py +9 -9
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/integration/test_mcp_tool_flow.py +13 -16
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/integration/test_multi_tool_operations.py +4 -5
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/integration/test_performance_scenarios.py +8 -4
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_actual_parallelism.py +72 -65
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_agent_initialization.py +53 -48
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_background_manager.py +5 -4
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_characterization_agent_main.py +15 -10
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_characterization_bash.py +49 -49
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_characterization_commands_system.py +32 -14
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_characterization_glob.py +79 -75
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_characterization_grep.py +83 -68
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_characterization_grep_performance.py +75 -66
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_characterization_iteration_limits.py +25 -29
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_characterization_list_dir.py +62 -56
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_characterization_read_file.py +48 -45
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_characterization_repl_utils.py +15 -10
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_characterization_run_command.py +50 -46
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_characterization_setup_system.py +18 -11
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_characterization_tool_ui_behavior.py +37 -29
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_characterization_update_file.py +64 -101
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_characterization_utilities.py +26 -20
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_characterization_write_file.py +50 -46
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_cli_command_flow.py +102 -119
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_cli_file_operations_integration.py +73 -75
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_config_directory_creation.py +15 -15
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_config_setup_async.py +44 -33
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_enhanced_visual_feedback.py +20 -15
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_fallback_responses.py +13 -5
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_fast_glob_search.py +55 -43
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_file_operations_edge_cases.py +94 -86
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_file_operations_stress.py +81 -77
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_file_reference_context_tracking.py +27 -28
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_file_reference_expansion.py +34 -32
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_grep_fast_glob.py +63 -68
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_grep_legacy_compat.py +6 -7
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_grep_timeout.py +71 -69
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_json_tool_parsing.py +57 -54
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_list_dir.py +27 -26
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_parallel_execution_demo.py +33 -31
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_parallel_execution_freeze_fix.py +28 -27
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_parallel_execution_integration.py +48 -40
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_parallel_read_only_tools.py +90 -64
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_parallel_tool_execution.py +31 -29
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_read_only_confirmation.py +14 -14
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_security.py +49 -45
- tunacode_cli-0.0.37/tests/test_streaming_panel_tool_confirmation.py +176 -0
- tunacode_cli-0.0.37/tests/test_streaming_spinner_conflict.py +129 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_tool_categorization.py +23 -24
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_tool_combinations.py +143 -121
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_tool_handler_ui_messages.py +43 -29
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_update_command.py +6 -5
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/tests/test_visual_parallel_feedback.py +50 -38
- tunacode_cli-0.0.35/src/tunacode/cli/commands.py +0 -893
- tunacode_cli-0.0.35/tests/characterization/agent/__init__.py +0 -1
- tunacode_cli-0.0.35/tests/characterization/commands/__init__.py +0 -1
- tunacode_cli-0.0.35/tests/characterization/context/__init__.py +0 -1
- tunacode_cli-0.0.35/tests/characterization/utils/test_token_counting.py +0 -29
- tunacode_cli-0.0.35/tests/fixtures/__init__.py +0 -1
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/CLAUDE.md +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/LICENSE +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/MANIFEST.in +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/TUNACODE.md +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/setup.cfg +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/__init__.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/cli/__init__.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/cli/main.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/cli/textual_app.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/cli/textual_bridge.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/configuration/__init__.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/configuration/defaults.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/configuration/models.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/context.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/core/__init__.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/core/agents/__init__.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/core/background/__init__.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/core/background/manager.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/core/code_index.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/core/llm/__init__.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/core/setup/__init__.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/core/setup/agent_setup.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/core/setup/base.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/core/setup/coordinator.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/core/setup/environment_setup.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/core/setup/git_safety_setup.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/core/tool_handler.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/exceptions.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/prompts/system.md +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/py.typed +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/services/__init__.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/services/mcp.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/tools/__init__.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/tools/base.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/tools/bash.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/tools/glob.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/tools/grep.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/tools/list_dir.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/tools/update_file.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/tools/write_file.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/types.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/ui/__init__.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/ui/completers.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/ui/constants.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/ui/decorators.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/ui/input.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/ui/keybindings.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/ui/lexers.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/ui/prompt_manager.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/ui/tool_ui.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/ui/validators.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/utils/__init__.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/utils/bm25.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/utils/diff_utils.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/utils/file_utils.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/utils/import_cache.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/utils/ripgrep.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/utils/security.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/utils/system.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/utils/token_counter.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode/utils/user_configuration.py +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode_cli.egg-info/dependency_links.txt +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode_cli.egg-info/entry_points.txt +0 -0
- {tunacode_cli-0.0.35 → tunacode_cli-0.0.37}/src/tunacode_cli.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tunacode-cli
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.37
|
|
4
4
|
Summary: Your agentic CLI developer.
|
|
5
5
|
Author-email: larock22 <noreply@github.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -26,9 +26,7 @@ Requires-Dist: pygments==2.19.1
|
|
|
26
26
|
Requires-Dist: rich==14.0.0
|
|
27
27
|
Provides-Extra: dev
|
|
28
28
|
Requires-Dist: build; extra == "dev"
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
Requires-Dist: flake8; extra == "dev"
|
|
31
|
-
Requires-Dist: isort; extra == "dev"
|
|
29
|
+
Requires-Dist: ruff; extra == "dev"
|
|
32
30
|
Requires-Dist: pytest; extra == "dev"
|
|
33
31
|
Requires-Dist: pytest-cov; extra == "dev"
|
|
34
32
|
Requires-Dist: pytest-asyncio; extra == "dev"
|
|
@@ -70,7 +68,7 @@ Choose your AI provider and set your API key:
|
|
|
70
68
|
# OpenAI
|
|
71
69
|
tunacode --model "openai:gpt-4o" --key "sk-your-openai-key"
|
|
72
70
|
|
|
73
|
-
# Anthropic Claude
|
|
71
|
+
# Anthropic Claude
|
|
74
72
|
tunacode --model "anthropic:claude-3.5-sonnet" --key "sk-ant-your-anthropic-key"
|
|
75
73
|
|
|
76
74
|
# OpenRouter (100+ models)
|
|
@@ -82,13 +80,14 @@ Your config is saved to `~/.config/tunacode.json` (edit directly with `nvim ~/.c
|
|
|
82
80
|
### Recommended Models
|
|
83
81
|
|
|
84
82
|
Based on extensive testing, these models provide the best performance:
|
|
83
|
+
|
|
85
84
|
- `google/gemini-2.5-pro` - Excellent for complex reasoning
|
|
86
85
|
- `openai/gpt-4.1` - Strong general-purpose model
|
|
87
86
|
- `deepseek/deepseek-r1-0528` - Great for code generation
|
|
88
87
|
- `openai/gpt-4.1-mini` - Fast and cost-effective
|
|
89
88
|
- `anthropic/claude-4-sonnet-20250522` - Superior context handling
|
|
90
89
|
|
|
91
|
-
|
|
90
|
+
_Note: Formal evaluations coming soon. Any model can work, but these have shown the best results in practice._
|
|
92
91
|
|
|
93
92
|
## Start Coding
|
|
94
93
|
|
|
@@ -98,16 +97,16 @@ tunacode
|
|
|
98
97
|
|
|
99
98
|
## Basic Commands
|
|
100
99
|
|
|
101
|
-
| Command
|
|
102
|
-
|
|
|
103
|
-
| `/help`
|
|
104
|
-
| `/model <provider:name>` | Switch model
|
|
105
|
-
| `/clear`
|
|
106
|
-
| `/compact`
|
|
107
|
-
| `/branch <name>`
|
|
108
|
-
| `/yolo`
|
|
109
|
-
| `!<command>`
|
|
110
|
-
| `exit`
|
|
100
|
+
| Command | Description |
|
|
101
|
+
| ------------------------ | ---------------------- |
|
|
102
|
+
| `/help` | Show all commands |
|
|
103
|
+
| `/model <provider:name>` | Switch model |
|
|
104
|
+
| `/clear` | Clear message history |
|
|
105
|
+
| `/compact` | Summarize conversation |
|
|
106
|
+
| `/branch <name>` | Create Git branch |
|
|
107
|
+
| `/yolo` | Skip confirmations |
|
|
108
|
+
| `!<command>` | Run shell command |
|
|
109
|
+
| `exit` | Exit TunaCode |
|
|
111
110
|
|
|
112
111
|
## Performance
|
|
113
112
|
|
|
@@ -122,11 +121,12 @@ Multiple file reads, directory listings, and searches execute concurrently using
|
|
|
122
121
|
- **Streaming UI**: Currently working on implementing streaming responses for better user experience
|
|
123
122
|
- **Bug Fixes**: Actively addressing issues - please report any bugs you encounter!
|
|
124
123
|
|
|
125
|
-
|
|
124
|
+
_Note: While the tool is fully functional, we're focusing on stability and core features before optimizing for speed._
|
|
126
125
|
|
|
127
126
|
## Safety First
|
|
128
127
|
|
|
129
128
|
⚠️ **Important**: TunaCode can modify your codebase. Always:
|
|
129
|
+
|
|
130
130
|
- Use Git branches before making changes
|
|
131
131
|
- Review file modifications before confirming
|
|
132
132
|
- Keep backups of important work
|
|
@@ -33,7 +33,7 @@ Choose your AI provider and set your API key:
|
|
|
33
33
|
# OpenAI
|
|
34
34
|
tunacode --model "openai:gpt-4o" --key "sk-your-openai-key"
|
|
35
35
|
|
|
36
|
-
# Anthropic Claude
|
|
36
|
+
# Anthropic Claude
|
|
37
37
|
tunacode --model "anthropic:claude-3.5-sonnet" --key "sk-ant-your-anthropic-key"
|
|
38
38
|
|
|
39
39
|
# OpenRouter (100+ models)
|
|
@@ -45,13 +45,14 @@ Your config is saved to `~/.config/tunacode.json` (edit directly with `nvim ~/.c
|
|
|
45
45
|
### Recommended Models
|
|
46
46
|
|
|
47
47
|
Based on extensive testing, these models provide the best performance:
|
|
48
|
+
|
|
48
49
|
- `google/gemini-2.5-pro` - Excellent for complex reasoning
|
|
49
50
|
- `openai/gpt-4.1` - Strong general-purpose model
|
|
50
51
|
- `deepseek/deepseek-r1-0528` - Great for code generation
|
|
51
52
|
- `openai/gpt-4.1-mini` - Fast and cost-effective
|
|
52
53
|
- `anthropic/claude-4-sonnet-20250522` - Superior context handling
|
|
53
54
|
|
|
54
|
-
|
|
55
|
+
_Note: Formal evaluations coming soon. Any model can work, but these have shown the best results in practice._
|
|
55
56
|
|
|
56
57
|
## Start Coding
|
|
57
58
|
|
|
@@ -61,16 +62,16 @@ tunacode
|
|
|
61
62
|
|
|
62
63
|
## Basic Commands
|
|
63
64
|
|
|
64
|
-
| Command
|
|
65
|
-
|
|
|
66
|
-
| `/help`
|
|
67
|
-
| `/model <provider:name>` | Switch model
|
|
68
|
-
| `/clear`
|
|
69
|
-
| `/compact`
|
|
70
|
-
| `/branch <name>`
|
|
71
|
-
| `/yolo`
|
|
72
|
-
| `!<command>`
|
|
73
|
-
| `exit`
|
|
65
|
+
| Command | Description |
|
|
66
|
+
| ------------------------ | ---------------------- |
|
|
67
|
+
| `/help` | Show all commands |
|
|
68
|
+
| `/model <provider:name>` | Switch model |
|
|
69
|
+
| `/clear` | Clear message history |
|
|
70
|
+
| `/compact` | Summarize conversation |
|
|
71
|
+
| `/branch <name>` | Create Git branch |
|
|
72
|
+
| `/yolo` | Skip confirmations |
|
|
73
|
+
| `!<command>` | Run shell command |
|
|
74
|
+
| `exit` | Exit TunaCode |
|
|
74
75
|
|
|
75
76
|
## Performance
|
|
76
77
|
|
|
@@ -85,11 +86,12 @@ Multiple file reads, directory listings, and searches execute concurrently using
|
|
|
85
86
|
- **Streaming UI**: Currently working on implementing streaming responses for better user experience
|
|
86
87
|
- **Bug Fixes**: Actively addressing issues - please report any bugs you encounter!
|
|
87
88
|
|
|
88
|
-
|
|
89
|
+
_Note: While the tool is fully functional, we're focusing on stability and core features before optimizing for speed._
|
|
89
90
|
|
|
90
91
|
## Safety First
|
|
91
92
|
|
|
92
93
|
⚠️ **Important**: TunaCode can modify your codebase. Always:
|
|
94
|
+
|
|
93
95
|
- Use Git branches before making changes
|
|
94
96
|
- Review file modifications before confirming
|
|
95
97
|
- Keep backups of important work
|
|
@@ -109,4 +111,4 @@ Multiple file reads, directory listings, and searches execute concurrently using
|
|
|
109
111
|
|
|
110
112
|
---
|
|
111
113
|
|
|
112
|
-
MIT License - see [LICENSE](LICENSE) file
|
|
114
|
+
MIT License - see [LICENSE](LICENSE) file
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tunacode-cli"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.37"
|
|
8
8
|
description = "Your agentic CLI developer."
|
|
9
9
|
keywords = ["cli", "agent", "development", "automation"]
|
|
10
10
|
readme = "README.md"
|
|
@@ -38,9 +38,7 @@ tunacode = "tunacode.cli.main:app"
|
|
|
38
38
|
[project.optional-dependencies]
|
|
39
39
|
dev = [
|
|
40
40
|
"build",
|
|
41
|
-
"
|
|
42
|
-
"flake8",
|
|
43
|
-
"isort",
|
|
41
|
+
"ruff",
|
|
44
42
|
"pytest",
|
|
45
43
|
"pytest-cov",
|
|
46
44
|
"pytest-asyncio",
|
|
@@ -51,8 +49,27 @@ dev = [
|
|
|
51
49
|
Homepage = "https://github.com/larock22/tunacode"
|
|
52
50
|
Repository = "https://github.com/larock22/tunacode"
|
|
53
51
|
|
|
54
|
-
[tool.
|
|
52
|
+
[tool.ruff]
|
|
55
53
|
line-length = 100
|
|
56
54
|
|
|
57
|
-
[tool.
|
|
58
|
-
|
|
55
|
+
[tool.ruff.lint]
|
|
56
|
+
extend-select = ["I"]
|
|
57
|
+
ignore = ["E203", "E501"]
|
|
58
|
+
exclude = [
|
|
59
|
+
".bzr",
|
|
60
|
+
".direnv",
|
|
61
|
+
".eggs",
|
|
62
|
+
".git",
|
|
63
|
+
".hg",
|
|
64
|
+
".mypy_cache",
|
|
65
|
+
".nox",
|
|
66
|
+
".pants.d",
|
|
67
|
+
".ruff_cache",
|
|
68
|
+
".svn",
|
|
69
|
+
".tox",
|
|
70
|
+
".venv",
|
|
71
|
+
"__pypackages__",
|
|
72
|
+
"build",
|
|
73
|
+
"dist",
|
|
74
|
+
"venv",
|
|
75
|
+
]
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""Command system for TunaCode CLI.
|
|
2
|
+
|
|
3
|
+
This package provides a modular command system with:
|
|
4
|
+
- Base classes and infrastructure in `base.py`
|
|
5
|
+
- Command registry and factory in `registry.py`
|
|
6
|
+
- Command implementations organized by category in `implementations/`
|
|
7
|
+
|
|
8
|
+
The main public API provides backward compatibility with the original
|
|
9
|
+
commands.py module while enabling better organization and maintainability.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
# Import base classes and infrastructure
|
|
13
|
+
from .base import Command, CommandCategory, CommandSpec, SimpleCommand
|
|
14
|
+
|
|
15
|
+
# Import all command implementations for backward compatibility
|
|
16
|
+
from .implementations import (
|
|
17
|
+
BranchCommand,
|
|
18
|
+
ClearCommand,
|
|
19
|
+
CompactCommand,
|
|
20
|
+
DumpCommand,
|
|
21
|
+
FixCommand,
|
|
22
|
+
HelpCommand,
|
|
23
|
+
InitCommand,
|
|
24
|
+
IterationsCommand,
|
|
25
|
+
ModelCommand,
|
|
26
|
+
ParseToolsCommand,
|
|
27
|
+
RefreshConfigCommand,
|
|
28
|
+
ThoughtsCommand,
|
|
29
|
+
UpdateCommand,
|
|
30
|
+
YoloCommand,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
# Import registry and factory
|
|
34
|
+
from .registry import CommandDependencies, CommandFactory, CommandRegistry
|
|
35
|
+
|
|
36
|
+
# Maintain backward compatibility by exposing the same public API
|
|
37
|
+
__all__ = [
|
|
38
|
+
# Base infrastructure
|
|
39
|
+
"Command",
|
|
40
|
+
"SimpleCommand",
|
|
41
|
+
"CommandSpec",
|
|
42
|
+
"CommandCategory",
|
|
43
|
+
# Registry and factory
|
|
44
|
+
"CommandRegistry",
|
|
45
|
+
"CommandFactory",
|
|
46
|
+
"CommandDependencies",
|
|
47
|
+
# All command classes (imported from implementations)
|
|
48
|
+
"YoloCommand",
|
|
49
|
+
"DumpCommand",
|
|
50
|
+
"ThoughtsCommand",
|
|
51
|
+
"IterationsCommand",
|
|
52
|
+
"ClearCommand",
|
|
53
|
+
"FixCommand",
|
|
54
|
+
"ParseToolsCommand",
|
|
55
|
+
"RefreshConfigCommand",
|
|
56
|
+
"HelpCommand",
|
|
57
|
+
"BranchCommand",
|
|
58
|
+
"CompactCommand",
|
|
59
|
+
"UpdateCommand",
|
|
60
|
+
"ModelCommand",
|
|
61
|
+
"InitCommand",
|
|
62
|
+
]
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"""Base classes and infrastructure for TunaCode CLI commands."""
|
|
2
|
+
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from enum import Enum
|
|
6
|
+
from typing import List
|
|
7
|
+
|
|
8
|
+
from ...types import CommandArgs, CommandContext, CommandResult
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class CommandCategory(Enum):
|
|
12
|
+
"""Categories for organizing commands."""
|
|
13
|
+
|
|
14
|
+
SYSTEM = "system"
|
|
15
|
+
NAVIGATION = "navigation"
|
|
16
|
+
DEVELOPMENT = "development"
|
|
17
|
+
MODEL = "model"
|
|
18
|
+
DEBUG = "debug"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class Command(ABC):
|
|
22
|
+
"""Base class for all commands."""
|
|
23
|
+
|
|
24
|
+
@property
|
|
25
|
+
@abstractmethod
|
|
26
|
+
def name(self) -> str:
|
|
27
|
+
"""The primary name of the command."""
|
|
28
|
+
pass
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
@abstractmethod
|
|
32
|
+
def aliases(self) -> CommandArgs:
|
|
33
|
+
"""Alternative names/aliases for the command."""
|
|
34
|
+
pass
|
|
35
|
+
|
|
36
|
+
@property
|
|
37
|
+
def description(self) -> str:
|
|
38
|
+
"""Description of what the command does."""
|
|
39
|
+
return ""
|
|
40
|
+
|
|
41
|
+
@property
|
|
42
|
+
def category(self) -> CommandCategory:
|
|
43
|
+
"""Category this command belongs to."""
|
|
44
|
+
return CommandCategory.SYSTEM
|
|
45
|
+
|
|
46
|
+
@abstractmethod
|
|
47
|
+
async def execute(self, args: CommandArgs, context: CommandContext) -> CommandResult:
|
|
48
|
+
"""
|
|
49
|
+
Execute the command.
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
args: Command arguments (excluding the command name)
|
|
53
|
+
context: Execution context with state and config
|
|
54
|
+
|
|
55
|
+
Returns:
|
|
56
|
+
Command-specific return value
|
|
57
|
+
"""
|
|
58
|
+
pass
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@dataclass
|
|
62
|
+
class CommandSpec:
|
|
63
|
+
"""Specification for a command's metadata."""
|
|
64
|
+
|
|
65
|
+
name: str
|
|
66
|
+
aliases: List[str]
|
|
67
|
+
description: str
|
|
68
|
+
category: CommandCategory = CommandCategory.SYSTEM
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class SimpleCommand(Command):
|
|
72
|
+
"""Base class for simple commands without complex logic.
|
|
73
|
+
|
|
74
|
+
This class provides a standard implementation for commands that don't
|
|
75
|
+
require special initialization or complex behavior. It reads all
|
|
76
|
+
properties from a class-level CommandSpec attribute.
|
|
77
|
+
"""
|
|
78
|
+
|
|
79
|
+
spec: CommandSpec
|
|
80
|
+
|
|
81
|
+
@property
|
|
82
|
+
def name(self) -> str:
|
|
83
|
+
"""The primary name of the command."""
|
|
84
|
+
return self.__class__.spec.name
|
|
85
|
+
|
|
86
|
+
@property
|
|
87
|
+
def aliases(self) -> CommandArgs:
|
|
88
|
+
"""Alternative names/aliases for the command."""
|
|
89
|
+
return self.__class__.spec.aliases
|
|
90
|
+
|
|
91
|
+
@property
|
|
92
|
+
def description(self) -> str:
|
|
93
|
+
"""Description of what the command does."""
|
|
94
|
+
return self.__class__.spec.description
|
|
95
|
+
|
|
96
|
+
@property
|
|
97
|
+
def category(self) -> CommandCategory:
|
|
98
|
+
"""Category this command belongs to."""
|
|
99
|
+
return self.__class__.spec.category
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""Command implementations for TunaCode CLI."""
|
|
2
|
+
|
|
3
|
+
# Import all command classes for easy access
|
|
4
|
+
from .conversation import CompactCommand
|
|
5
|
+
from .debug import (
|
|
6
|
+
DumpCommand,
|
|
7
|
+
FixCommand,
|
|
8
|
+
IterationsCommand,
|
|
9
|
+
ParseToolsCommand,
|
|
10
|
+
ThoughtsCommand,
|
|
11
|
+
YoloCommand,
|
|
12
|
+
)
|
|
13
|
+
from .development import BranchCommand, InitCommand
|
|
14
|
+
from .model import ModelCommand
|
|
15
|
+
from .system import ClearCommand, HelpCommand, RefreshConfigCommand, StreamingCommand, UpdateCommand
|
|
16
|
+
|
|
17
|
+
__all__ = [
|
|
18
|
+
# System commands
|
|
19
|
+
"HelpCommand",
|
|
20
|
+
"ClearCommand",
|
|
21
|
+
"RefreshConfigCommand",
|
|
22
|
+
"StreamingCommand",
|
|
23
|
+
"UpdateCommand",
|
|
24
|
+
# Debug commands
|
|
25
|
+
"YoloCommand",
|
|
26
|
+
"DumpCommand",
|
|
27
|
+
"ThoughtsCommand",
|
|
28
|
+
"IterationsCommand",
|
|
29
|
+
"FixCommand",
|
|
30
|
+
"ParseToolsCommand",
|
|
31
|
+
# Development commands
|
|
32
|
+
"BranchCommand",
|
|
33
|
+
"InitCommand",
|
|
34
|
+
# Model commands
|
|
35
|
+
"ModelCommand",
|
|
36
|
+
# Conversation commands
|
|
37
|
+
"CompactCommand",
|
|
38
|
+
]
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"""Conversation management commands for TunaCode CLI."""
|
|
2
|
+
|
|
3
|
+
from typing import List, Optional
|
|
4
|
+
|
|
5
|
+
from ....types import CommandContext, ProcessRequestCallback
|
|
6
|
+
from ....ui import console as ui
|
|
7
|
+
from ..base import CommandCategory, CommandSpec, SimpleCommand
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class CompactCommand(SimpleCommand):
|
|
11
|
+
"""Compact conversation context."""
|
|
12
|
+
|
|
13
|
+
spec = CommandSpec(
|
|
14
|
+
name="compact",
|
|
15
|
+
aliases=["/compact"],
|
|
16
|
+
description="Summarize and compact the conversation history",
|
|
17
|
+
category=CommandCategory.SYSTEM,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
def __init__(self, process_request_callback: Optional[ProcessRequestCallback] = None):
|
|
21
|
+
self._process_request = process_request_callback
|
|
22
|
+
|
|
23
|
+
async def execute(self, args: List[str], context: CommandContext) -> None:
|
|
24
|
+
# Use the injected callback or get it from context
|
|
25
|
+
process_request = self._process_request or context.process_request
|
|
26
|
+
|
|
27
|
+
if not process_request:
|
|
28
|
+
await ui.error("Compact command not available - process_request not configured")
|
|
29
|
+
return
|
|
30
|
+
|
|
31
|
+
# Count current messages
|
|
32
|
+
original_count = len(context.state_manager.session.messages)
|
|
33
|
+
|
|
34
|
+
# Generate summary with output captured
|
|
35
|
+
summary_prompt = (
|
|
36
|
+
"Summarize the conversation so far in a concise paragraph, "
|
|
37
|
+
"focusing on the main topics discussed and any important context "
|
|
38
|
+
"that should be preserved."
|
|
39
|
+
)
|
|
40
|
+
result = await process_request(
|
|
41
|
+
summary_prompt,
|
|
42
|
+
context.state_manager,
|
|
43
|
+
output=False, # We'll handle the output ourselves
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
# Extract summary text from result
|
|
47
|
+
summary_text = ""
|
|
48
|
+
|
|
49
|
+
# First try: standard result structure
|
|
50
|
+
if (
|
|
51
|
+
result
|
|
52
|
+
and hasattr(result, "result")
|
|
53
|
+
and result.result
|
|
54
|
+
and hasattr(result.result, "output")
|
|
55
|
+
):
|
|
56
|
+
summary_text = result.result.output
|
|
57
|
+
|
|
58
|
+
# Second try: check messages for assistant response
|
|
59
|
+
if not summary_text:
|
|
60
|
+
messages = context.state_manager.session.messages
|
|
61
|
+
# Look through new messages in reverse order
|
|
62
|
+
for i in range(len(messages) - 1, original_count - 1, -1):
|
|
63
|
+
msg = messages[i]
|
|
64
|
+
# Handle ModelResponse objects
|
|
65
|
+
if hasattr(msg, "parts") and msg.parts:
|
|
66
|
+
for part in msg.parts:
|
|
67
|
+
if hasattr(part, "content") and part.content:
|
|
68
|
+
content = part.content
|
|
69
|
+
# Skip JSON thought objects
|
|
70
|
+
if content.strip().startswith('{"thought"'):
|
|
71
|
+
lines = content.split("\n")
|
|
72
|
+
# Find the actual summary after the JSON
|
|
73
|
+
for i, line in enumerate(lines):
|
|
74
|
+
if (
|
|
75
|
+
line.strip()
|
|
76
|
+
and not line.strip().startswith("{")
|
|
77
|
+
and not line.strip().endswith("}")
|
|
78
|
+
):
|
|
79
|
+
summary_text = "\n".join(lines[i:]).strip()
|
|
80
|
+
break
|
|
81
|
+
else:
|
|
82
|
+
summary_text = content
|
|
83
|
+
if summary_text:
|
|
84
|
+
break
|
|
85
|
+
# Handle dict-style messages
|
|
86
|
+
elif isinstance(msg, dict):
|
|
87
|
+
if msg.get("role") == "assistant" and msg.get("content"):
|
|
88
|
+
summary_text = msg["content"]
|
|
89
|
+
break
|
|
90
|
+
# Handle other message types
|
|
91
|
+
elif hasattr(msg, "content") and hasattr(msg, "role"):
|
|
92
|
+
if getattr(msg, "role", None) == "assistant":
|
|
93
|
+
summary_text = msg.content
|
|
94
|
+
break
|
|
95
|
+
|
|
96
|
+
if summary_text:
|
|
97
|
+
break
|
|
98
|
+
|
|
99
|
+
if not summary_text:
|
|
100
|
+
await ui.error("Failed to generate summary - no assistant response found")
|
|
101
|
+
return
|
|
102
|
+
|
|
103
|
+
# Display summary in a formatted panel
|
|
104
|
+
from tunacode.ui import panels
|
|
105
|
+
|
|
106
|
+
await panels.panel("Conversation Summary", summary_text, border_style="cyan")
|
|
107
|
+
|
|
108
|
+
# Show statistics
|
|
109
|
+
await ui.info(f"Current message count: {original_count}")
|
|
110
|
+
await ui.info("After compaction: 3 (summary + last 2 messages)")
|
|
111
|
+
|
|
112
|
+
# Truncate the conversation history
|
|
113
|
+
context.state_manager.session.messages = context.state_manager.session.messages[-2:]
|
|
114
|
+
|
|
115
|
+
await ui.success("Context history has been summarized and truncated.")
|