code-puppy 0.0.962__tar.gz → 0.0.963__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.
- {code_puppy-0.0.962 → code_puppy-0.0.963}/PKG-INFO +1 -1
- code_puppy-0.0.963/code_puppy/cli_entry.py +569 -0
- code_puppy-0.0.963/code_puppy/cli_runner.py +99 -0
- code_puppy-0.0.963/code_puppy/interactive_runner.py +600 -0
- code_puppy-0.0.963/code_puppy/interactive_support.py +231 -0
- code_puppy-0.0.963/code_puppy/prompt_runner.py +265 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/pydantic_patches.py +2 -2
- {code_puppy-0.0.962 → code_puppy-0.0.963}/pyproject.toml +1 -1
- code_puppy-0.0.962/code_puppy/cli_runner.py +0 -1668
- {code_puppy-0.0.962 → code_puppy-0.0.963}/.gitignore +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/LICENSE +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/README.md +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/__init__.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/__main__.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/_plugin_i18n_lifecycle.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/_pydantic_tool_helpers.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/_pydantic_video_patch.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agent_completion_inbox.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agent_execution_context.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/__init__.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/_builder.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/_code_mode.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/_code_mode_guidance.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/_code_mode_session.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/_compaction.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/_diagnostics.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/_foreign_thinking.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/_history.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/_key_listeners.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/_mcp.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/_model_message_transform.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/_multimodal_error_hint.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/_non_streaming_render.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/_output_limits.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/_rules.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/_run_signals.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/_runtime.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/_steer_processor.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/_subagent_recursion.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/_token_limit_hint.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/_tty_modes.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/_windows_console.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/_wire_tool_names.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/agent_code_puppy.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/agent_creator_agent.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/agent_helios.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/agent_manager.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/agent_model_judge.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/agent_planning.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/agent_qa_kitten.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/agent_web_retriever.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/base_agent.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/event_stream_handler.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/json_agent.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/retry_checkpoint.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/retry_profiles.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/run_invocation.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/run_stats.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/smooth_stream.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/stream_status.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/subagent_stream_handler.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/agents/thinking_output.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/asyncio_cleanup.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/atomic_io.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/atomic_json.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/ca_bundle.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/callbacks.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/capabilities/__init__.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/capabilities/compaction.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/capabilities/eager_timing.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/chatgpt_codex_client.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/claude_cache_client.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/claude_oauth_transport.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/claude_thinking_display.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/__init__.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/add_model_details.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/add_model_menu.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/add_model_menus.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/add_model_vllm.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/agent_menu.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/attachments.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/autosave_menu.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/autosave_search.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/clipboard.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/colors_menu.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/command_handler.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/command_registry.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/completers.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/completion_cache.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/config_apply.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/config_commands.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/core_commands.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/file_index.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/file_path_completion.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/help_catalog.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/help_overlay.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/image_utils.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/load_context_completion.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/__init__.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/base.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/catalog_server_installer.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/custom_server_form.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/custom_server_installer.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/edit_command.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/handler.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/help_command.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/install_command.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/install_menu.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/list_command.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/logs_command.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/mcp_servers_store.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/remove_command.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/restart_command.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/search_command.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/silence_warning_command.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/start_all_command.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/start_command.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/status_command.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/stop_all_command.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/stop_command.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/trust_command.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/utils.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp/wizard_utils.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp_binding_menu.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/mcp_completion.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/menu_session.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/model_picker_completion.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/model_settings_defs.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/model_settings_menu.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/onboarding_slides.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/onboarding_wizard.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/pagination.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/pin_command_completion.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/refresh_models.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/session_browser.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/session_browser_data.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/session_commands.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/set_menu.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/set_menu_catalog.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/set_menu_schema.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/set_menu_settings.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/set_menu_shims.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/set_menu_values.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/shell_passthrough.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/skills_completion.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/tui_style.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/uc_menu.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/command_line/utils.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/config.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/config_file.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/context_accounting.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/diagnostics.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/early_startup.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/error_format.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/error_hooks.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/error_logging.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/error_policy.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/error_redaction.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/events/__init__.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/events/bridge.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/file_completion_io.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/file_completion_tokens.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/gemini_code_assist.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/gemini_common.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/gemini_model.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/hook_engine/README.md +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/hook_engine/__init__.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/hook_engine/aliases.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/hook_engine/engine.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/hook_engine/executor.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/hook_engine/matcher.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/hook_engine/models.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/hook_engine/registry.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/hook_engine/validator.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/http_retry.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/http_utils.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/httpx2_utils.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/i18n/__init__.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/i18n/audit.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/i18n/catalog.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/i18n/formats.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/i18n/interpolation.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/i18n/locale.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/i18n/locales/en-US.json +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/i18n/locales/es.json +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/i18n/locales/fr-CA.json +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/i18n/plugin_catalog.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/i18n/plurals.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/i18n/pseudo.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/i18n/translate.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/kennel_provider.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/keymap.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/list_filtering.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/main.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/malloc_noise_guard.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_/__init__.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_/agent_bindings.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_/async_lifecycle.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_/blocking_startup.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_/circuit_breaker.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_/config_wizard.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_/dashboard.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_/error_isolation.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_/examples/retry_example.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_/health_monitor.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_/http_auth.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_/managed_server.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_/manager.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_/manager_lifecycle.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_/mcp_logs.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_/project_config.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_/registry.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_/retry_manager.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_/server_registry_catalog.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_/status_tracker.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_/system_tools.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_/tool_arg_coercion.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_/toolset_utils.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_prompts/__init__.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/mcp_prompts/hook_creator.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/__init__.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/bar_painters.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/bar_rendering.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/bottom_bar.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/bus.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/chords.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/commands.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/editor_actions.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/editor_completion.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/editor_display.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/editor_history.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/editor_keys.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/editor_paste.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/editor_queue.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/editor_submission.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/editor_undo.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/external_editor.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/identity_line.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/idle_status.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/inline_bar.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/line_editor.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/markdown_patches.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/menu_lifecycle.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/message_queue.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/messages.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/pause_controller.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/prompt_prefix_style.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/queue_console.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/renderers.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/rich_renderer.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/run_ui.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/run_ui_wiring.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/safe_console.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/safe_stream.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/speculation_line.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/speculation_stats.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/speculation_toggle.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/spinner/__init__.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/status_line.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/subagent_console.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/theme_accent.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/tool_output.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/messaging/transcript_guard.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/model_descriptions.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/model_factory.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/model_switching.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/model_utils.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/models.json +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/models_dev_api.json +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/models_dev_family.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/models_dev_parser.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/observability.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/platform_utils.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/plugins/__init__.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/plugins/config.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/plugins/oauth_pasteback.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/plugins/oauth_puppy_html.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/plugins/prewarm_sdks/__init__.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/plugins/prewarm_sdks/prewarm.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/plugins/prewarm_sdks/register_callbacks.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/plugins/trust.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/plugins/trust_notice.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/private_inference.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/provider_credentials.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/provider_identity.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/reopenable_async_client.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/round_robin_model.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/secret_store.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/secret_store_backends.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/session_format_migration.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/session_lifecycle.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/session_migration.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/session_storage.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/session_surrogate_unpickler.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/shared_credentials.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/skill_provider.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/splash.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/status_display.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/steer_metadata.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/terminal_utils.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/token_usage.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/__init__.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/_browser_registry.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/_lazy.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/agent_tools.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/approval_feedback.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/ask_user_question/__init__.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/ask_user_question/constants.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/ask_user_question/demo_tui.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/ask_user_question/handler.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/ask_user_question/models.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/ask_user_question/registration.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/ask_user_question/renderers.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/ask_user_question/terminal_ui.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/ask_user_question/theme.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/ask_user_question/tui_loop.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/browser/__init__.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/browser/browser_control.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/browser/browser_interactions.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/browser/browser_locator_resolver.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/browser/browser_locators.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/browser/browser_manager.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/browser/browser_navigation.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/browser/browser_page_snapshot.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/browser/browser_screenshot.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/browser/browser_scripts.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/browser/browser_semantic_interactions.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/browser/browser_workflows.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/browser/tool_registry.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/command_runner.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/common.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/display.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/file_modifications.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/file_operations.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/file_permission_state.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/fs_access.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/image_tools.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/io_backends.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/model_tools.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/ripgrep.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/shell_backgrounding.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/skills_tools.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/subagent_context.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/subagent_invocation.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/subagent_usage_metrics.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/tools_content.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/universal_constructor.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/tools/win_shell_io.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/undo_manager.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/universal_constructor_provider.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/version_checker.py +0 -0
- {code_puppy-0.0.962 → code_puppy-0.0.963}/code_puppy/zai_model.py +0 -0
|
@@ -0,0 +1,569 @@
|
|
|
1
|
+
"""Startup/main dispatch: argument parsing, config/renderer setup, and the
|
|
2
|
+
-p/-r vs interactive branch selection, plus --quick-resume resolution.
|
|
3
|
+
|
|
4
|
+
Depends on: interactive_runner.py::interactive_mode();
|
|
5
|
+
prompt_runner.py::execute_single_prompt();
|
|
6
|
+
interactive_support.py::_save_autosave_snapshot().
|
|
7
|
+
|
|
8
|
+
Called by: cli_runner.py (facade calls main() via asyncio.run in
|
|
9
|
+
main_entry()).
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
import argparse
|
|
13
|
+
import os
|
|
14
|
+
import sys
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
|
|
17
|
+
from code_puppy import __version__, callbacks, get_core_plugins_version
|
|
18
|
+
from code_puppy.asyncio_cleanup import install_httpcore2_shutdown_filter
|
|
19
|
+
from code_puppy.config import ensure_config_exists, initialize_command_history_file
|
|
20
|
+
from code_puppy.error_logging import log_error
|
|
21
|
+
from code_puppy.http_utils import find_available_port
|
|
22
|
+
from code_puppy.i18n import t, use_detected_locale
|
|
23
|
+
from code_puppy.interactive_runner import interactive_mode
|
|
24
|
+
from code_puppy.interactive_support import _save_autosave_snapshot
|
|
25
|
+
from code_puppy.keymap import KeymapError, validate_cancel_agent_key
|
|
26
|
+
from code_puppy.platform_utils import startup_banner_text
|
|
27
|
+
from code_puppy.prompt_runner import execute_single_prompt
|
|
28
|
+
from code_puppy.version_checker import default_version_mismatch_behavior
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def apply_quick_resume(args) -> bool:
|
|
32
|
+
"""Resolve ``--quick-resume [PATH]`` into ``args.resume`` so the existing
|
|
33
|
+
resume machinery loads it.
|
|
34
|
+
|
|
35
|
+
Looks up the most recent autosave for PATH (defaulting to cwd), scoped to
|
|
36
|
+
the nearest git worktree root + branch when available, with a no-git
|
|
37
|
+
fallback. No-op when ``--quick-resume`` was not requested or ``--resume`` is
|
|
38
|
+
already set (explicit ``--resume`` always wins). Returns True when a target
|
|
39
|
+
was resolved.
|
|
40
|
+
"""
|
|
41
|
+
existing_resume = getattr(args, "resume", None)
|
|
42
|
+
quick_resume_target = getattr(args, "quick_resume", None)
|
|
43
|
+
if quick_resume_target is None or (
|
|
44
|
+
existing_resume and str(existing_resume).strip()
|
|
45
|
+
):
|
|
46
|
+
return False
|
|
47
|
+
|
|
48
|
+
from code_puppy.config import (
|
|
49
|
+
format_quick_resume_scope,
|
|
50
|
+
get_quick_resume_location,
|
|
51
|
+
resolve_quick_resume_pickle,
|
|
52
|
+
)
|
|
53
|
+
from code_puppy.messaging import emit_info
|
|
54
|
+
|
|
55
|
+
target_path = str(quick_resume_target).strip() or "."
|
|
56
|
+
|
|
57
|
+
# Diagnostic identifies the lookup scope without leaking full local paths.
|
|
58
|
+
cwd, branch = get_quick_resume_location(target_path)
|
|
59
|
+
emit_info(
|
|
60
|
+
t(
|
|
61
|
+
"cli.resume.quick_searching",
|
|
62
|
+
scope=format_quick_resume_scope(cwd, branch),
|
|
63
|
+
)
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
quick_resume_pickle = resolve_quick_resume_pickle(target_path)
|
|
67
|
+
if quick_resume_pickle:
|
|
68
|
+
args.resume = quick_resume_pickle
|
|
69
|
+
return True
|
|
70
|
+
|
|
71
|
+
emit_info(t("cli.resume.none_found"))
|
|
72
|
+
return False
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _initialize_locale():
|
|
76
|
+
"""Select the UI locale before any startup message is translated."""
|
|
77
|
+
from code_puppy.config import get_value
|
|
78
|
+
|
|
79
|
+
use_detected_locale(get_value("locale"))
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
async def main():
|
|
83
|
+
"""Main async entry point for Code Puppy CLI."""
|
|
84
|
+
install_httpcore2_shutdown_filter()
|
|
85
|
+
parser = argparse.ArgumentParser(description="Code Puppy - A code generation agent")
|
|
86
|
+
parser.add_argument(
|
|
87
|
+
"--version",
|
|
88
|
+
"-v",
|
|
89
|
+
action="version",
|
|
90
|
+
version=f"{__version__}",
|
|
91
|
+
help="Show version and exit",
|
|
92
|
+
)
|
|
93
|
+
parser.add_argument(
|
|
94
|
+
"--interactive",
|
|
95
|
+
"-i",
|
|
96
|
+
action="store_true",
|
|
97
|
+
help="Run in interactive mode",
|
|
98
|
+
)
|
|
99
|
+
parser.add_argument(
|
|
100
|
+
"--prompt",
|
|
101
|
+
"-p",
|
|
102
|
+
type=str,
|
|
103
|
+
help="Execute a single prompt and exit (no interactive mode)",
|
|
104
|
+
)
|
|
105
|
+
parser.add_argument(
|
|
106
|
+
"--disable-ask-user-question",
|
|
107
|
+
action="store_true",
|
|
108
|
+
help="Disable only the interactive ask_user_question tool",
|
|
109
|
+
)
|
|
110
|
+
parser.add_argument(
|
|
111
|
+
"--usage-file",
|
|
112
|
+
type=Path,
|
|
113
|
+
metavar="PATH",
|
|
114
|
+
help="Write aggregate headless model usage as JSON",
|
|
115
|
+
)
|
|
116
|
+
parser.add_argument(
|
|
117
|
+
"--agent",
|
|
118
|
+
"-a",
|
|
119
|
+
type=str,
|
|
120
|
+
help="Specify which agent to use (e.g., --agent code-puppy)",
|
|
121
|
+
)
|
|
122
|
+
parser.add_argument(
|
|
123
|
+
"--model",
|
|
124
|
+
"-m",
|
|
125
|
+
type=str,
|
|
126
|
+
help="Specify which model to use (e.g., --model gpt-5)",
|
|
127
|
+
)
|
|
128
|
+
parser.add_argument(
|
|
129
|
+
"--resume",
|
|
130
|
+
"-r",
|
|
131
|
+
type=str,
|
|
132
|
+
metavar="PATH",
|
|
133
|
+
help=(
|
|
134
|
+
"Resume a saved session by name or file path "
|
|
135
|
+
"(.json envelope; legacy .pkl files migrate automatically)"
|
|
136
|
+
),
|
|
137
|
+
)
|
|
138
|
+
parser.add_argument(
|
|
139
|
+
"--cwd",
|
|
140
|
+
action="store_true",
|
|
141
|
+
help=(
|
|
142
|
+
"With --resume, only list/consider sessions scoped to the current "
|
|
143
|
+
"working directory (opt-in; default shows all sessions unfiltered)"
|
|
144
|
+
),
|
|
145
|
+
)
|
|
146
|
+
parser.add_argument(
|
|
147
|
+
"--quick-resume",
|
|
148
|
+
"-qr",
|
|
149
|
+
nargs="?",
|
|
150
|
+
const=".",
|
|
151
|
+
default=None,
|
|
152
|
+
metavar="PATH",
|
|
153
|
+
help=(
|
|
154
|
+
"Resume the most recent session for PATH (defaults to the current "
|
|
155
|
+
"directory; scopes to git root + branch when available)"
|
|
156
|
+
),
|
|
157
|
+
)
|
|
158
|
+
parser.add_argument(
|
|
159
|
+
"--port-base",
|
|
160
|
+
type=str,
|
|
161
|
+
default=None,
|
|
162
|
+
metavar="PORT",
|
|
163
|
+
help=(
|
|
164
|
+
"Starting port for the local HTTP server (searches PORT..PORT+920). "
|
|
165
|
+
"Bump this if 8090 collides with another local dev server. "
|
|
166
|
+
"Falls back to $CODE_PUPPY_PORT_BASE or 'port_base' in puppy.cfg (default 8090). "
|
|
167
|
+
"Invalid values are warned about and ignored -- next source in the "
|
|
168
|
+
"precedence chain is used instead of crashing."
|
|
169
|
+
),
|
|
170
|
+
)
|
|
171
|
+
parser.add_argument(
|
|
172
|
+
"command", nargs="*", help="Run a single command (deprecated, use -p instead)"
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
# Plugins add CLI args via on_register_cli_args (loaded at import time);
|
|
176
|
+
# duplicate option strings raise here = fail fast.
|
|
177
|
+
callbacks.on_register_cli_args(parser)
|
|
178
|
+
|
|
179
|
+
args = parser.parse_args()
|
|
180
|
+
_initialize_locale()
|
|
181
|
+
if args.disable_ask_user_question:
|
|
182
|
+
os.environ["CODE_PUPPY_DISABLE_ASK_USER_QUESTION"] = "1"
|
|
183
|
+
|
|
184
|
+
# Plugins may act on parsed args and short-circuit startup; first dict
|
|
185
|
+
# with handled=True wins (exits with its exit_code).
|
|
186
|
+
for result in callbacks.on_handle_cli_args(args):
|
|
187
|
+
if isinstance(result, dict) and result.get("handled"):
|
|
188
|
+
return result.get("exit_code", 0)
|
|
189
|
+
|
|
190
|
+
from code_puppy.messaging import (
|
|
191
|
+
RichConsoleRenderer,
|
|
192
|
+
SynchronousInteractiveRenderer,
|
|
193
|
+
get_global_queue,
|
|
194
|
+
get_message_bus,
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
from code_puppy.messaging.safe_console import SafeConsole
|
|
198
|
+
|
|
199
|
+
# Create a shared console for both renderers
|
|
200
|
+
display_console = SafeConsole()
|
|
201
|
+
|
|
202
|
+
# Legacy renderer for backward compatibility (emits via get_global_queue)
|
|
203
|
+
message_queue = get_global_queue()
|
|
204
|
+
message_renderer = SynchronousInteractiveRenderer(message_queue, display_console)
|
|
205
|
+
message_renderer.start()
|
|
206
|
+
|
|
207
|
+
# New MessageBus renderer for structured messages (tools emit here)
|
|
208
|
+
message_bus = get_message_bus()
|
|
209
|
+
bus_renderer = RichConsoleRenderer(message_bus, display_console)
|
|
210
|
+
bus_renderer.start()
|
|
211
|
+
|
|
212
|
+
initialize_command_history_file()
|
|
213
|
+
from code_puppy.messaging import emit_error, emit_system_message
|
|
214
|
+
|
|
215
|
+
# Show the logo on entering interactive mode (no -p flag; covers
|
|
216
|
+
# both `code-puppy` and `code-puppy -i`).
|
|
217
|
+
if not args.prompt:
|
|
218
|
+
try:
|
|
219
|
+
import pyfiglet
|
|
220
|
+
|
|
221
|
+
# Width-aware banner: full CODE PUPPY when it fits, PUP when
|
|
222
|
+
# the terminal is too narrow (phones, tight splits).
|
|
223
|
+
banner_columns = display_console.width
|
|
224
|
+
intro_lines = pyfiglet.figlet_format(
|
|
225
|
+
startup_banner_text(banner_columns), font="ansi_shadow"
|
|
226
|
+
).split("\n")
|
|
227
|
+
|
|
228
|
+
# Simple blue to green gradient (top to bottom)
|
|
229
|
+
gradient_colors = ["bright_blue", "bright_cyan", "bright_green"]
|
|
230
|
+
display_console.print("\n")
|
|
231
|
+
|
|
232
|
+
# Left-justified on purpose -- the full-screen splash handles
|
|
233
|
+
# the centered spectacle; this banner tops the scrollback.
|
|
234
|
+
lines = []
|
|
235
|
+
for line_num, line in enumerate(intro_lines):
|
|
236
|
+
if line.strip():
|
|
237
|
+
# Top=blue, middle=cyan, bottom=green by line position
|
|
238
|
+
color_idx = min(line_num // 2, len(gradient_colors) - 1)
|
|
239
|
+
color = gradient_colors[color_idx]
|
|
240
|
+
lines.append(f"[{color}]{line}[/{color}]")
|
|
241
|
+
else:
|
|
242
|
+
lines.append("")
|
|
243
|
+
# Print directly to console to avoid the 'dim' style from emit_system_message
|
|
244
|
+
display_console.print("\n".join(lines))
|
|
245
|
+
except ImportError:
|
|
246
|
+
emit_system_message(t("cli.loading"))
|
|
247
|
+
|
|
248
|
+
# Truecolor warning moved to interactive_mode() so it prints last — max visibility.
|
|
249
|
+
|
|
250
|
+
from code_puppy.config import PORT_PROBE_WIDTH, resolve_port_base
|
|
251
|
+
|
|
252
|
+
port_base = resolve_port_base(cli_value=args.port_base)
|
|
253
|
+
port_end = port_base + PORT_PROBE_WIDTH
|
|
254
|
+
available_port = find_available_port(start_port=port_base, end_port=port_end)
|
|
255
|
+
if available_port is None:
|
|
256
|
+
emit_error(t("cli.error.no_ports", port_base=port_base, port_end=port_end))
|
|
257
|
+
return
|
|
258
|
+
|
|
259
|
+
# Set model early (before ensure_config_exists) so config is set up correctly.
|
|
260
|
+
early_model = None
|
|
261
|
+
if args.model:
|
|
262
|
+
early_model = args.model.strip()
|
|
263
|
+
from code_puppy.config import set_model_name
|
|
264
|
+
|
|
265
|
+
set_model_name(early_model)
|
|
266
|
+
|
|
267
|
+
ensure_config_exists()
|
|
268
|
+
|
|
269
|
+
# Opt-in Logfire observability — a no-op unless enable_logfire (or
|
|
270
|
+
# CODE_PUPPY_ENABLE_LOGFIRE) is set. Must run before agents spin up so
|
|
271
|
+
# pydantic-ai instrumentation catches every run.
|
|
272
|
+
from code_puppy.observability import configure_logfire
|
|
273
|
+
|
|
274
|
+
configure_logfire()
|
|
275
|
+
|
|
276
|
+
# Validate cancel_agent_key configuration early
|
|
277
|
+
try:
|
|
278
|
+
validate_cancel_agent_key()
|
|
279
|
+
except KeymapError as e:
|
|
280
|
+
from code_puppy.messaging import emit_error
|
|
281
|
+
|
|
282
|
+
emit_error(str(e))
|
|
283
|
+
sys.exit(1)
|
|
284
|
+
|
|
285
|
+
# Windows: raw Ctrl+C all session — no console-wide CTRL_C_EVENT (kills
|
|
286
|
+
# wrapper launchers); Ctrl+C arrives as \x03, handled like any keystroke.
|
|
287
|
+
from code_puppy.terminal_utils import (
|
|
288
|
+
disable_windows_ctrl_c,
|
|
289
|
+
set_keep_ctrl_c_disabled,
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
if disable_windows_ctrl_c():
|
|
293
|
+
# Keep the clamp sticky across terminal resets / console mode restores.
|
|
294
|
+
set_keep_ctrl_c_disabled(True)
|
|
295
|
+
|
|
296
|
+
# Load API keys from puppy.cfg into environment variables
|
|
297
|
+
from code_puppy.config import load_api_keys_to_environment
|
|
298
|
+
|
|
299
|
+
load_api_keys_to_environment()
|
|
300
|
+
|
|
301
|
+
# Handle model validation from command line (validation happens here, setting was earlier)
|
|
302
|
+
if args.model:
|
|
303
|
+
from code_puppy.config import _validate_model_exists
|
|
304
|
+
|
|
305
|
+
model_name = args.model.strip()
|
|
306
|
+
try:
|
|
307
|
+
# Validate that the model exists in models.json
|
|
308
|
+
if not _validate_model_exists(model_name):
|
|
309
|
+
from code_puppy.model_factory import ModelFactory
|
|
310
|
+
|
|
311
|
+
models_config = ModelFactory.load_config()
|
|
312
|
+
available_models = list(models_config.keys()) if models_config else []
|
|
313
|
+
|
|
314
|
+
emit_error(t("cli.model.not_found", model=model_name))
|
|
315
|
+
emit_system_message(
|
|
316
|
+
t("cli.model.available", models=", ".join(available_models))
|
|
317
|
+
)
|
|
318
|
+
sys.exit(1)
|
|
319
|
+
|
|
320
|
+
# Model is valid, show confirmation (already set earlier)
|
|
321
|
+
emit_system_message(t("cli.model.using", model=model_name))
|
|
322
|
+
except Exception as e:
|
|
323
|
+
log_error(
|
|
324
|
+
e,
|
|
325
|
+
context="code_puppy.cli_entry::main: startup/model: validate the --model value against models.json",
|
|
326
|
+
)
|
|
327
|
+
emit_error(t("cli.model.validate_error", error=str(e)))
|
|
328
|
+
sys.exit(1)
|
|
329
|
+
|
|
330
|
+
# Handle agent selection from command line
|
|
331
|
+
if args.agent:
|
|
332
|
+
from code_puppy.agents.agent_manager import (
|
|
333
|
+
get_available_agents,
|
|
334
|
+
set_current_agent,
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
agent_name = args.agent.lower()
|
|
338
|
+
try:
|
|
339
|
+
# First check if the agent exists by getting available agents
|
|
340
|
+
available_agents = get_available_agents()
|
|
341
|
+
if agent_name not in available_agents:
|
|
342
|
+
emit_error(t("cli.agent.not_found", agent=agent_name))
|
|
343
|
+
emit_system_message(
|
|
344
|
+
t("cli.agent.available", agents=", ".join(available_agents.keys()))
|
|
345
|
+
)
|
|
346
|
+
sys.exit(1)
|
|
347
|
+
|
|
348
|
+
# Agent exists, set it
|
|
349
|
+
set_current_agent(agent_name)
|
|
350
|
+
emit_system_message(t("cli.agent.using", agent=agent_name))
|
|
351
|
+
except Exception as e:
|
|
352
|
+
log_error(
|
|
353
|
+
e,
|
|
354
|
+
context="code_puppy.cli_entry::main: startup/agent: resolve and set the --agent value",
|
|
355
|
+
)
|
|
356
|
+
emit_error(t("cli.agent.set_error", error=str(e)))
|
|
357
|
+
sys.exit(1)
|
|
358
|
+
|
|
359
|
+
current_version = __version__
|
|
360
|
+
|
|
361
|
+
no_version_update = os.getenv("NO_VERSION_UPDATE", "").lower() in (
|
|
362
|
+
"1",
|
|
363
|
+
"true",
|
|
364
|
+
"yes",
|
|
365
|
+
"on",
|
|
366
|
+
)
|
|
367
|
+
if no_version_update:
|
|
368
|
+
version_msg = t("version.current", version=current_version)
|
|
369
|
+
update_disabled_msg = t("cli.version.update_disabled")
|
|
370
|
+
emit_system_message(version_msg)
|
|
371
|
+
emit_system_message(update_disabled_msg)
|
|
372
|
+
else:
|
|
373
|
+
if len(callbacks.get_callbacks("version_check")):
|
|
374
|
+
await callbacks.on_version_check(current_version)
|
|
375
|
+
else:
|
|
376
|
+
default_version_mismatch_behavior(current_version)
|
|
377
|
+
|
|
378
|
+
core_plugins_version = get_core_plugins_version()
|
|
379
|
+
if core_plugins_version is None:
|
|
380
|
+
core_plugins_message = t("version.core_plugins_unknown")
|
|
381
|
+
else:
|
|
382
|
+
core_plugins_message = t("version.core_plugins", version=core_plugins_version)
|
|
383
|
+
emit_system_message(core_plugins_message)
|
|
384
|
+
|
|
385
|
+
# One-shot sweep of legacy ~/.code_puppy/contexts/ into autosaves/ (idempotent
|
|
386
|
+
# via sentinel). Must run before plugin startup callbacks read AUTOSAVE_DIR and
|
|
387
|
+
# before the -r resume block resolves.
|
|
388
|
+
try:
|
|
389
|
+
from code_puppy.session_migration import sweep_contexts_to_autosaves
|
|
390
|
+
|
|
391
|
+
sweep_contexts_to_autosaves()
|
|
392
|
+
except Exception as exc:
|
|
393
|
+
# Sweep failure must never block startup -- it logs internally.
|
|
394
|
+
log_error(
|
|
395
|
+
exc,
|
|
396
|
+
context="code_puppy.cli_entry::main: startup/session-migration: sweep legacy contexts into autosaves",
|
|
397
|
+
)
|
|
398
|
+
|
|
399
|
+
# One-time format migration: legacy pickle sessions -> versioned JSON
|
|
400
|
+
# envelopes (idempotent via marker file). Runs after the location sweep so
|
|
401
|
+
# freshly-moved contexts/ files are migrated in the same boot.
|
|
402
|
+
try:
|
|
403
|
+
from code_puppy.session_format_migration import sweep_legacy_pickle_sessions
|
|
404
|
+
|
|
405
|
+
sweep_legacy_pickle_sessions()
|
|
406
|
+
except Exception as exc:
|
|
407
|
+
# Never block startup; failures are logged/warned internally.
|
|
408
|
+
log_error(
|
|
409
|
+
exc,
|
|
410
|
+
context="code_puppy.cli_entry::main: startup/session-migration: migrate legacy pickle sessions to versioned JSON",
|
|
411
|
+
)
|
|
412
|
+
|
|
413
|
+
await callbacks.on_startup()
|
|
414
|
+
|
|
415
|
+
# Resolve --quick-resume into --resume for the canonical (git-root + branch) scope.
|
|
416
|
+
apply_quick_resume(args)
|
|
417
|
+
|
|
418
|
+
# Resolved (normalised) session name under -r/--resume so save-back writes the
|
|
419
|
+
# same file the resolver opened — not the raw ``foo.pkl`` / absolute-path input.
|
|
420
|
+
resolved_resume_session: str | None = None
|
|
421
|
+
|
|
422
|
+
if args.resume:
|
|
423
|
+
from code_puppy.agents.agent_manager import get_current_agent
|
|
424
|
+
from code_puppy.config import AUTOSAVE_DIR, pin_current_session_name
|
|
425
|
+
from code_puppy.messaging import emit_error, emit_info, emit_success
|
|
426
|
+
from code_puppy.session_lifecycle import (
|
|
427
|
+
ResumeTargetError,
|
|
428
|
+
resolve_or_create_resume_target,
|
|
429
|
+
)
|
|
430
|
+
from code_puppy.session_storage import (
|
|
431
|
+
compute_scope_key,
|
|
432
|
+
list_sessions,
|
|
433
|
+
load_session,
|
|
434
|
+
)
|
|
435
|
+
|
|
436
|
+
resume_target = args.resume
|
|
437
|
+
sessions_dir = Path(AUTOSAVE_DIR)
|
|
438
|
+
# Opt-in via --cwd: only offer sessions scoped to the current directory.
|
|
439
|
+
# Default (flag absent) keeps the unfiltered listing byte-for-byte.
|
|
440
|
+
resume_scope_key = compute_scope_key(Path.cwd()) if args.cwd else None
|
|
441
|
+
|
|
442
|
+
# Both headless and interactive accept ``-r missing-name`` (empty session);
|
|
443
|
+
# typos still surface via the visible ``Created new session: NAME`` line.
|
|
444
|
+
try:
|
|
445
|
+
session_name, session_dir, lazy_created = resolve_or_create_resume_target(
|
|
446
|
+
resume_target,
|
|
447
|
+
sessions_dir=sessions_dir,
|
|
448
|
+
allow_lazy_create=True,
|
|
449
|
+
)
|
|
450
|
+
except ResumeTargetError as resolve_exc:
|
|
451
|
+
emit_error(resolve_exc.message)
|
|
452
|
+
if resolve_exc.hint:
|
|
453
|
+
emit_info(resolve_exc.hint)
|
|
454
|
+
available = list_sessions(sessions_dir, scope_key=resume_scope_key)
|
|
455
|
+
if available:
|
|
456
|
+
emit_info(
|
|
457
|
+
t(
|
|
458
|
+
"cli.resume.available_sessions",
|
|
459
|
+
sessions=", ".join(available[:10]),
|
|
460
|
+
)
|
|
461
|
+
)
|
|
462
|
+
sys.exit(1)
|
|
463
|
+
|
|
464
|
+
# Announce lazy-create so scripts/users can tell it from a normal resume.
|
|
465
|
+
if lazy_created:
|
|
466
|
+
emit_info(t("cli.resume.created", session=session_name))
|
|
467
|
+
|
|
468
|
+
try:
|
|
469
|
+
history = load_session(session_name, session_dir)
|
|
470
|
+
agent = get_current_agent()
|
|
471
|
+
agent.set_message_history(history)
|
|
472
|
+
total_tokens = sum(agent.estimate_tokens_for_message(m) for m in history)
|
|
473
|
+
|
|
474
|
+
# Pin the singleton so periodic autosave AND headless save-back update
|
|
475
|
+
# this named file (replaces rotate_autosave_id()). Note: absolute-path
|
|
476
|
+
# resumes pin the stem — writes land in AUTOSAVE_DIR for cross-mode consistency.
|
|
477
|
+
pin_current_session_name(session_name)
|
|
478
|
+
|
|
479
|
+
# Record the resolved name for the headless save-back path below.
|
|
480
|
+
resolved_resume_session = session_name
|
|
481
|
+
|
|
482
|
+
if not lazy_created:
|
|
483
|
+
emit_success(
|
|
484
|
+
t(
|
|
485
|
+
"cli.resume.resumed",
|
|
486
|
+
messages=len(history),
|
|
487
|
+
tokens=total_tokens,
|
|
488
|
+
session=session_name,
|
|
489
|
+
)
|
|
490
|
+
)
|
|
491
|
+
# Re-render recent history on interactive resume (matching /load and
|
|
492
|
+
# the autosave picker): -r loaded history but left a blank screen.
|
|
493
|
+
# Skipped headless/non-TTY; honors resume_message_count; best-effort.
|
|
494
|
+
if not args.prompt and sys.stdout.isatty():
|
|
495
|
+
try:
|
|
496
|
+
from code_puppy.command_line.autosave_menu import (
|
|
497
|
+
display_resumed_history,
|
|
498
|
+
)
|
|
499
|
+
|
|
500
|
+
display_resumed_history(history)
|
|
501
|
+
except Exception as render_exc:
|
|
502
|
+
log_error(
|
|
503
|
+
render_exc,
|
|
504
|
+
context="code_puppy.cli_entry::main: startup/resume: re-render resumed session history",
|
|
505
|
+
)
|
|
506
|
+
except Exception as e:
|
|
507
|
+
log_error(
|
|
508
|
+
e,
|
|
509
|
+
context="code_puppy.cli_entry::main: startup/resume: load and apply the resumed session history",
|
|
510
|
+
)
|
|
511
|
+
emit_error(t("cli.resume.failed", target=resume_target, error=e))
|
|
512
|
+
sys.exit(1)
|
|
513
|
+
|
|
514
|
+
global shutdown_flag
|
|
515
|
+
shutdown_flag = False
|
|
516
|
+
try:
|
|
517
|
+
initial_command = None
|
|
518
|
+
prompt_only_mode = False
|
|
519
|
+
|
|
520
|
+
if args.prompt:
|
|
521
|
+
initial_command = args.prompt
|
|
522
|
+
prompt_only_mode = True
|
|
523
|
+
# Headless runs have nobody at the keyboard to answer check-ins,
|
|
524
|
+
# so agency is always EXTREME regardless of config.
|
|
525
|
+
from code_puppy.config import set_headless_mode
|
|
526
|
+
|
|
527
|
+
set_headless_mode(True)
|
|
528
|
+
elif args.command:
|
|
529
|
+
initial_command = " ".join(args.command)
|
|
530
|
+
prompt_only_mode = False
|
|
531
|
+
|
|
532
|
+
if prompt_only_mode:
|
|
533
|
+
await execute_single_prompt(
|
|
534
|
+
initial_command,
|
|
535
|
+
message_renderer,
|
|
536
|
+
session_name=resolved_resume_session,
|
|
537
|
+
usage_file=args.usage_file,
|
|
538
|
+
)
|
|
539
|
+
else:
|
|
540
|
+
# Default to interactive mode (no args = same as -i)
|
|
541
|
+
try:
|
|
542
|
+
await interactive_mode(
|
|
543
|
+
message_renderer, initial_command=initial_command
|
|
544
|
+
)
|
|
545
|
+
finally:
|
|
546
|
+
# Belt-and-braces: Ctrl-D, /exit, or a top-level interrupt must
|
|
547
|
+
# not lose history that a cancelled turn skipped saving.
|
|
548
|
+
# Headless `-p` runs persist themselves in execute_single_prompt's
|
|
549
|
+
# own finally, so this must not run for that branch too.
|
|
550
|
+
_save_autosave_snapshot()
|
|
551
|
+
finally:
|
|
552
|
+
# Tear down the persistent prompt first (restores scroll region, cursor,
|
|
553
|
+
# key listener) so the renderer stops on a sane screen. Idempotent.
|
|
554
|
+
try:
|
|
555
|
+
from code_puppy.messaging.run_ui import stop_persistent_ui
|
|
556
|
+
|
|
557
|
+
stop_persistent_ui()
|
|
558
|
+
except Exception:
|
|
559
|
+
pass
|
|
560
|
+
if message_renderer:
|
|
561
|
+
message_renderer.stop()
|
|
562
|
+
if bus_renderer:
|
|
563
|
+
bus_renderer.stop()
|
|
564
|
+
# session_end fires before shutdown so plugins react while bus state is coherent.
|
|
565
|
+
try:
|
|
566
|
+
await callbacks.on_session_end()
|
|
567
|
+
except Exception:
|
|
568
|
+
pass
|
|
569
|
+
await callbacks.on_shutdown()
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"""CLI runner for Code Puppy: compatibility facade and process entrypoint.
|
|
2
|
+
|
|
3
|
+
The actual implementation lives in ``cli_entry.py`` (startup/main dispatch),
|
|
4
|
+
``interactive_runner.py`` (REPL loop), ``interactive_support.py`` (prompt
|
|
5
|
+
UI/signal/shutdown seams), and ``prompt_runner.py`` (prompt execution +
|
|
6
|
+
headless dispatch). This module re-exports their public entrypoints for
|
|
7
|
+
backwards compatibility and owns ``main_entry()`` -- the installed console
|
|
8
|
+
script's actual entrypoint (see ``code_puppy/main.py``).
|
|
9
|
+
|
|
10
|
+
``__all__`` defines the exported entrypoints and selected legacy private
|
|
11
|
+
aliases. Additional legacy attributes remain importable/patchable outside
|
|
12
|
+
``__all__``; this facade does not preserve every former private helper.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
# Apply pydantic-ai patches BEFORE any pydantic-ai imports
|
|
16
|
+
from code_puppy.pydantic_patches import apply_all_patches
|
|
17
|
+
|
|
18
|
+
apply_all_patches()
|
|
19
|
+
|
|
20
|
+
import asyncio
|
|
21
|
+
import logging
|
|
22
|
+
import sys
|
|
23
|
+
import traceback
|
|
24
|
+
|
|
25
|
+
from code_puppy import plugins
|
|
26
|
+
from code_puppy.cli_entry import apply_quick_resume, main
|
|
27
|
+
from code_puppy.error_hooks import install_error_hooks
|
|
28
|
+
from code_puppy.interactive_runner import interactive_mode
|
|
29
|
+
from code_puppy.interactive_support import (
|
|
30
|
+
_save_autosave_snapshot,
|
|
31
|
+
_use_persistent_prompt,
|
|
32
|
+
)
|
|
33
|
+
from code_puppy.malloc_noise_guard import install_malloc_noise_guard
|
|
34
|
+
from code_puppy.prompt_runner import (
|
|
35
|
+
_HEADLESS_AUTONOMY_PROMPT,
|
|
36
|
+
_write_usage_file,
|
|
37
|
+
execute_single_prompt,
|
|
38
|
+
run_prompt_with_attachments,
|
|
39
|
+
)
|
|
40
|
+
from code_puppy.terminal_utils import reset_unix_terminal
|
|
41
|
+
|
|
42
|
+
logger = logging.getLogger(__name__)
|
|
43
|
+
|
|
44
|
+
plugins.load_plugin_callbacks()
|
|
45
|
+
|
|
46
|
+
__all__ = [
|
|
47
|
+
"_HEADLESS_AUTONOMY_PROMPT",
|
|
48
|
+
"_save_autosave_snapshot",
|
|
49
|
+
"_use_persistent_prompt",
|
|
50
|
+
"_write_usage_file",
|
|
51
|
+
"apply_quick_resume",
|
|
52
|
+
"execute_single_prompt",
|
|
53
|
+
"interactive_mode",
|
|
54
|
+
"main",
|
|
55
|
+
"main_entry",
|
|
56
|
+
"run_prompt_with_attachments",
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _force_utf8_stdio():
|
|
61
|
+
"""Ensure stdout/stderr can encode non-ASCII output (e.g. emoji prompts).
|
|
62
|
+
|
|
63
|
+
On Windows the console often defaults to a legacy code page (e.g. cp1252),
|
|
64
|
+
so writing UTF-8 characters crashes the very first run. Reconfigure the
|
|
65
|
+
streams to UTF-8 where the runtime supports it; no-op otherwise.
|
|
66
|
+
"""
|
|
67
|
+
for stream in (sys.stdout, sys.stderr):
|
|
68
|
+
try:
|
|
69
|
+
stream.reconfigure(encoding="utf-8", errors="replace")
|
|
70
|
+
except Exception:
|
|
71
|
+
logger.debug(
|
|
72
|
+
"code_puppy.cli_runner::_force_utf8_stdio: startup/stdio: reconfigure stdout/stderr to UTF-8",
|
|
73
|
+
exc_info=True,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def main_entry():
|
|
78
|
+
"""Entry point for the installed CLI tool."""
|
|
79
|
+
# Idempotent; covers callers that bypass main.py. Never block startup.
|
|
80
|
+
try:
|
|
81
|
+
install_error_hooks()
|
|
82
|
+
except Exception:
|
|
83
|
+
logger.debug("installing the uncaught-exception hooks failed", exc_info=True)
|
|
84
|
+
_force_utf8_stdio()
|
|
85
|
+
# Before anything spawns: fork children inherit fd 2 (see the module).
|
|
86
|
+
install_malloc_noise_guard()
|
|
87
|
+
try:
|
|
88
|
+
# Capture main()'s return so plugins / normal paths set the exit status
|
|
89
|
+
# (None -> 0 or an int exit code).
|
|
90
|
+
rc = asyncio.run(main())
|
|
91
|
+
except KeyboardInterrupt:
|
|
92
|
+
# Note: Using sys.stderr for crash output - messaging system may not be available
|
|
93
|
+
sys.stderr.write(traceback.format_exc())
|
|
94
|
+
return 0
|
|
95
|
+
finally:
|
|
96
|
+
# Reset terminal on Unix-like systems (not Windows)
|
|
97
|
+
reset_unix_terminal()
|
|
98
|
+
# Guard None -> 0 and propagate to the process exit status.
|
|
99
|
+
sys.exit(rc if rc is not None else 0)
|