code-puppy 0.0.890__tar.gz → 0.0.892__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.890 → code_puppy-0.0.892}/PKG-INFO +1 -1
- code_puppy-0.0.892/code_puppy/ca_bundle.py +239 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/add_model_vllm.py +68 -15
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/http_utils.py +41 -4
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_/async_lifecycle.py +6 -2
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_/toolset_utils.py +27 -5
- {code_puppy-0.0.890 → code_puppy-0.0.892}/pyproject.toml +3 -1
- {code_puppy-0.0.890 → code_puppy-0.0.892}/.gitignore +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/LICENSE +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/README.md +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/__init__.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/__main__.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/_plugin_i18n_lifecycle.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/_pydantic_tool_helpers.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/_pydantic_video_patch.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agent_completion_inbox.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agent_execution_context.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/__init__.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/_builder.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/_code_mode.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/_code_mode_guidance.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/_compaction.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/_diagnostics.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/_foreign_thinking.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/_history.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/_key_listeners.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/_model_message_transform.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/_non_streaming_render.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/_output_limits.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/_run_signals.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/_runtime.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/_steer_processor.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/_subagent_recursion.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/_windows_console.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/_wire_tool_names.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/agent_code_puppy.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/agent_creator_agent.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/agent_helios.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/agent_manager.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/agent_model_judge.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/agent_planning.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/agent_qa_kitten.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/agent_web_retriever.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/base_agent.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/event_stream_handler.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/json_agent.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/retry_checkpoint.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/retry_profiles.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/run_stats.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/smooth_stream.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/stream_status.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/subagent_stream_handler.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/agents/thinking_output.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/asyncio_cleanup.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/atomic_io.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/atomic_json.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/callbacks.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/capabilities/__init__.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/capabilities/compaction.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/capabilities/eager_timing.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/chatgpt_codex_client.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/claude_cache_client.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/claude_oauth_transport.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/cli_runner.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/__init__.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/add_model_details.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/add_model_menu.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/add_model_menus.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/agent_menu.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/attachments.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/autosave_menu.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/autosave_search.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/clipboard.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/colors_menu.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/command_handler.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/command_registry.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/completers.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/completion_cache.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/config_apply.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/config_commands.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/core_commands.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/file_index.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/file_path_completion.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/help_catalog.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/help_overlay.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/image_utils.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/load_context_completion.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/__init__.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/base.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/catalog_server_installer.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/custom_server_form.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/custom_server_installer.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/edit_command.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/handler.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/help_command.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/install_command.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/install_menu.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/list_command.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/logs_command.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/mcp_servers_store.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/remove_command.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/restart_command.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/search_command.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/silence_warning_command.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/start_all_command.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/start_command.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/status_command.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/stop_all_command.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/stop_command.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/trust_command.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/utils.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp/wizard_utils.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp_binding_menu.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/mcp_completion.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/menu_session.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/model_picker_completion.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/model_settings_defs.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/model_settings_menu.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/onboarding_slides.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/onboarding_wizard.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/pagination.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/pin_command_completion.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/refresh_models.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/session_browser.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/session_browser_data.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/session_commands.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/set_menu.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/set_menu_catalog.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/set_menu_schema.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/set_menu_settings.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/set_menu_shims.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/set_menu_values.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/shell_passthrough.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/skills_completion.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/tui_style.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/uc_menu.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/command_line/utils.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/config.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/config_file.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/diagnostics.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/error_logging.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/events/__init__.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/events/bridge.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/file_completion_io.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/file_completion_tokens.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/gemini_code_assist.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/gemini_common.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/gemini_model.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/hook_engine/README.md +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/hook_engine/__init__.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/hook_engine/aliases.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/hook_engine/engine.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/hook_engine/executor.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/hook_engine/matcher.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/hook_engine/models.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/hook_engine/registry.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/hook_engine/validator.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/http_retry.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/httpx2_utils.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/i18n/__init__.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/i18n/audit.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/i18n/catalog.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/i18n/formats.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/i18n/interpolation.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/i18n/locale.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/i18n/locales/en-US.json +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/i18n/locales/es.json +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/i18n/locales/fr-CA.json +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/i18n/plugin_catalog.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/i18n/plurals.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/i18n/pseudo.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/i18n/translate.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/kennel_provider.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/keymap.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/list_filtering.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/main.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_/__init__.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_/agent_bindings.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_/blocking_startup.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_/circuit_breaker.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_/config_wizard.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_/dashboard.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_/error_isolation.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_/examples/retry_example.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_/health_monitor.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_/http_auth.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_/managed_server.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_/manager.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_/manager_lifecycle.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_/mcp_logs.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_/project_config.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_/registry.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_/retry_manager.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_/server_registry_catalog.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_/status_tracker.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_/system_tools.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_/tool_arg_coercion.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_prompts/__init__.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/mcp_prompts/hook_creator.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/__init__.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/bar_painters.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/bar_rendering.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/bottom_bar.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/bus.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/chords.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/commands.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/editor_actions.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/editor_completion.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/editor_display.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/editor_history.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/editor_keys.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/editor_paste.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/editor_queue.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/editor_submission.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/external_editor.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/identity_line.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/idle_status.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/inline_bar.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/line_editor.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/markdown_patches.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/menu_lifecycle.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/message_queue.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/messages.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/pause_controller.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/prompt_prefix_style.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/queue_console.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/renderers.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/rich_renderer.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/run_ui.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/run_ui_wiring.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/speculation_line.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/speculation_stats.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/speculation_toggle.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/spinner/__init__.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/status_line.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/subagent_console.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/theme_accent.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/tool_output.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/messaging/transcript_guard.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/model_descriptions.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/model_factory.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/model_switching.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/model_utils.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/models.json +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/models_dev_api.json +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/models_dev_parser.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/observability.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/platform_utils.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/plugins/__init__.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/plugins/config.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/plugins/oauth_pasteback.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/plugins/oauth_puppy_html.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/plugins/trust.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/plugins/trust_notice.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/private_inference.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/provider_credentials.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/provider_identity.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/pydantic_patches.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/reopenable_async_client.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/round_robin_model.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/secret_store.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/secret_store_backends.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/session_format_migration.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/session_lifecycle.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/session_migration.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/session_storage.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/session_surrogate_unpickler.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/shared_credentials.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/skill_provider.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/splash.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/status_display.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/steer_metadata.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/terminal_utils.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/token_usage.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/__init__.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/_browser_registry.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/_lazy.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/agent_tools.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/ask_user_question/__init__.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/ask_user_question/constants.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/ask_user_question/demo_tui.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/ask_user_question/handler.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/ask_user_question/models.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/ask_user_question/registration.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/ask_user_question/renderers.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/ask_user_question/terminal_ui.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/ask_user_question/theme.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/ask_user_question/tui_loop.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/browser/__init__.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/browser/browser_control.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/browser/browser_interactions.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/browser/browser_locator_resolver.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/browser/browser_locators.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/browser/browser_manager.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/browser/browser_navigation.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/browser/browser_page_snapshot.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/browser/browser_screenshot.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/browser/browser_scripts.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/browser/browser_semantic_interactions.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/browser/browser_workflows.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/browser/tool_registry.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/command_runner.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/common.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/display.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/file_modifications.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/file_operations.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/file_permission_state.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/fs_access.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/image_tools.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/io_backends.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/model_tools.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/ripgrep.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/shell_backgrounding.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/skills_tools.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/subagent_context.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/subagent_invocation.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/subagent_usage_metrics.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/tools_content.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/tools/universal_constructor.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/undo_manager.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/universal_constructor_provider.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/version_checker.py +0 -0
- {code_puppy-0.0.890 → code_puppy-0.0.892}/code_puppy/zai_model.py +0 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"""Build public + corporate CA trust without disabling verification.
|
|
2
|
+
|
|
3
|
+
In-memory contexts combine environment-independent system trust, certifi, and
|
|
4
|
+
an optional corporate bundle. Exported PEM files contain only the enumerable
|
|
5
|
+
certifi and corporate roots. System ``capath`` entries are intentionally not
|
|
6
|
+
promised in exported files because OpenSSL loads them lazily and cannot
|
|
7
|
+
reliably enumerate them before a handshake. On macOS, OpenSSL contexts also do
|
|
8
|
+
not automatically inherit roots installed only in the system Keychain; callers
|
|
9
|
+
must supply those roots explicitly as ``corporate_bundle``.
|
|
10
|
+
|
|
11
|
+
The module deliberately depends only on the standard library and certifi so it
|
|
12
|
+
is safe to import in early-startup and lightweight client code. The public
|
|
13
|
+
context builders and root-subset check are shared APIs for setup/diagnostic
|
|
14
|
+
plugins: they inspect effective trust without mutating process environment.
|
|
15
|
+
The exporter is the file-based counterpart used by HTTP/MCP runtime clients.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
import hashlib
|
|
21
|
+
import os
|
|
22
|
+
import re
|
|
23
|
+
import ssl
|
|
24
|
+
import stat
|
|
25
|
+
import sys
|
|
26
|
+
import tempfile
|
|
27
|
+
from pathlib import Path
|
|
28
|
+
|
|
29
|
+
import certifi
|
|
30
|
+
|
|
31
|
+
from code_puppy.atomic_io import ContentTooLarge, read_bounded_bytes
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _load_windows_server_auth_roots(context: ssl.SSLContext) -> None:
|
|
35
|
+
"""Load Windows roots with the same server-auth filtering as stdlib SSL."""
|
|
36
|
+
enum_certificates = getattr(ssl, "enum_certificates", None)
|
|
37
|
+
if enum_certificates is None:
|
|
38
|
+
return
|
|
39
|
+
|
|
40
|
+
server_auth_oid = ssl.Purpose.SERVER_AUTH.oid
|
|
41
|
+
for store_name in ("CA", "ROOT"):
|
|
42
|
+
try:
|
|
43
|
+
certificates = enum_certificates(store_name)
|
|
44
|
+
except PermissionError:
|
|
45
|
+
continue
|
|
46
|
+
for certificate, encoding, trust in certificates:
|
|
47
|
+
if encoding != "x509_asn":
|
|
48
|
+
continue
|
|
49
|
+
if trust is not True and server_auth_oid not in trust:
|
|
50
|
+
continue
|
|
51
|
+
try:
|
|
52
|
+
context.load_verify_locations(
|
|
53
|
+
cadata=ssl.DER_cert_to_PEM_cert(certificate)
|
|
54
|
+
)
|
|
55
|
+
except (ssl.SSLError, ValueError):
|
|
56
|
+
continue
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _secure_client_context() -> ssl.SSLContext:
|
|
60
|
+
"""Create a client context matching supported Python runtime policy."""
|
|
61
|
+
context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
|
|
62
|
+
# CPython 3.13 added these to create_default_context(). Mirror them here
|
|
63
|
+
# because calling it without a cafile would read SSL_CERT_* overrides.
|
|
64
|
+
if sys.version_info >= (3, 13):
|
|
65
|
+
context.verify_flags |= ssl.VERIFY_X509_PARTIAL_CHAIN
|
|
66
|
+
context.verify_flags |= ssl.VERIFY_X509_STRICT
|
|
67
|
+
return context
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def explicit_ca_context(cafile: str) -> ssl.SSLContext:
|
|
71
|
+
"""Build default-policy client trust from exactly one explicit CA file."""
|
|
72
|
+
# Passing an explicit cafile prevents create_default_context() from loading
|
|
73
|
+
# environment-selected defaults while preserving the runtime's TLS policy.
|
|
74
|
+
return ssl.create_default_context(cafile=cafile)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def system_trust_context() -> ssl.SSLContext:
|
|
78
|
+
"""Build system trust without consulting CA environment overrides."""
|
|
79
|
+
context = _secure_client_context()
|
|
80
|
+
|
|
81
|
+
# OpenSSL exposes its compiled-in file/directory separately from the env
|
|
82
|
+
# override names. Load only those explicit defaults.
|
|
83
|
+
defaults = ssl.get_default_verify_paths()
|
|
84
|
+
if defaults.openssl_cafile and Path(defaults.openssl_cafile).is_file():
|
|
85
|
+
context.load_verify_locations(cafile=defaults.openssl_cafile)
|
|
86
|
+
if defaults.openssl_capath and Path(defaults.openssl_capath).is_dir():
|
|
87
|
+
context.load_verify_locations(capath=defaults.openssl_capath)
|
|
88
|
+
|
|
89
|
+
# Windows' native roots are not represented by OpenSSL's paths.
|
|
90
|
+
_load_windows_server_auth_roots(context)
|
|
91
|
+
return context
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def public_and_corporate_context(
|
|
95
|
+
corporate_bundle: str | None = None,
|
|
96
|
+
) -> ssl.SSLContext:
|
|
97
|
+
"""Return system + certifi trust, plus ``corporate_bundle``.
|
|
98
|
+
|
|
99
|
+
Trust sources are loaded explicitly so active CA environment overrides do
|
|
100
|
+
not inject arbitrary roots.
|
|
101
|
+
"""
|
|
102
|
+
context = system_trust_context()
|
|
103
|
+
context.load_verify_locations(cafile=certifi.where())
|
|
104
|
+
if corporate_bundle:
|
|
105
|
+
context.load_verify_locations(cafile=corporate_bundle)
|
|
106
|
+
return context
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def _content_addressed_path(destination: str, content: bytes) -> Path:
|
|
110
|
+
"""Return an immutable sibling path derived from ``content``."""
|
|
111
|
+
requested = Path(destination)
|
|
112
|
+
digest = hashlib.sha256(content).hexdigest()
|
|
113
|
+
return requested.with_name(f"{requested.stem}-{digest}{requested.suffix}")
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def _read_regular_file(path: Path, expected_size: int) -> bytes | None:
|
|
117
|
+
"""Read an existing regular file without following symlinks or blocking."""
|
|
118
|
+
try:
|
|
119
|
+
file_info = path.lstat()
|
|
120
|
+
except FileNotFoundError:
|
|
121
|
+
return None
|
|
122
|
+
if not stat.S_ISREG(file_info.st_mode):
|
|
123
|
+
raise OSError(f"CA bundle destination is not a regular file: {path}")
|
|
124
|
+
if file_info.st_size != expected_size:
|
|
125
|
+
raise OSError(f"Content-addressed CA bundle has unexpected size: {path}")
|
|
126
|
+
|
|
127
|
+
flags = os.O_RDONLY | getattr(os, "O_BINARY", 0) | getattr(os, "O_NONBLOCK", 0)
|
|
128
|
+
flags |= getattr(os, "O_NOFOLLOW", 0)
|
|
129
|
+
descriptor = os.open(path, flags)
|
|
130
|
+
with os.fdopen(descriptor, "rb") as existing:
|
|
131
|
+
opened_info = os.fstat(existing.fileno())
|
|
132
|
+
if not stat.S_ISREG(opened_info.st_mode):
|
|
133
|
+
raise OSError(f"CA bundle destination changed file type: {path}")
|
|
134
|
+
return existing.read(expected_size + 1)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def _atomic_write(path: Path, content: bytes) -> None:
|
|
138
|
+
"""Atomically install ``content`` without resolving a destination symlink."""
|
|
139
|
+
# atomic_io resolves realpath(), which would follow destination symlinks.
|
|
140
|
+
# Keep this path-preserving writer and private directory creation here.
|
|
141
|
+
path.parent.mkdir(mode=0o700, parents=True, exist_ok=True)
|
|
142
|
+
descriptor, temporary_name = tempfile.mkstemp(
|
|
143
|
+
dir=path.parent,
|
|
144
|
+
prefix=f".{path.name}-",
|
|
145
|
+
suffix=".tmp",
|
|
146
|
+
)
|
|
147
|
+
try:
|
|
148
|
+
with os.fdopen(descriptor, "wb") as temporary:
|
|
149
|
+
temporary.write(content)
|
|
150
|
+
temporary.flush()
|
|
151
|
+
os.fsync(temporary.fileno())
|
|
152
|
+
os.replace(temporary_name, path)
|
|
153
|
+
except BaseException:
|
|
154
|
+
try:
|
|
155
|
+
os.unlink(temporary_name)
|
|
156
|
+
except OSError:
|
|
157
|
+
pass
|
|
158
|
+
raise
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def write_public_and_corporate_bundle(corporate_bundle: str, destination: str) -> str:
|
|
162
|
+
"""Write trusted roots to an immutable, content-addressed PEM file.
|
|
163
|
+
|
|
164
|
+
``destination`` supplies the parent, stem, and suffix. Its directory must
|
|
165
|
+
be application-private and protected from modification by other principals;
|
|
166
|
+
portable path APIs cannot guarantee immutability inside a hostile directory.
|
|
167
|
+
The returned path includes a SHA-256 digest, so cooperative concurrent
|
|
168
|
+
application versions cannot replace a bundle already exported by another
|
|
169
|
+
running process. Existing final-component special files and unexpected
|
|
170
|
+
content fail closed.
|
|
171
|
+
"""
|
|
172
|
+
# Export only enumerable, explicit sources. OpenSSL capath roots are loaded
|
|
173
|
+
# lazily, so claiming they are faithfully serializable would be fiction.
|
|
174
|
+
# Preserve certificate PEMs rather than enumerating get_ca_certs(), which
|
|
175
|
+
# silently filters pinned CA:FALSE leaves. Export certificates only: a
|
|
176
|
+
# configured file may also contain private keys that must not be copied.
|
|
177
|
+
certificate_blocks = []
|
|
178
|
+
seen_certificates: set[bytes] = set()
|
|
179
|
+
for source in (certifi.where(), corporate_bundle):
|
|
180
|
+
# Validate the original file, not just extracted blocks: malformed PEM
|
|
181
|
+
# trailers must fail rather than being silently sanitized.
|
|
182
|
+
try:
|
|
183
|
+
content = read_bounded_bytes(source)
|
|
184
|
+
except ContentTooLarge as exc:
|
|
185
|
+
raise OSError("CA source exceeds the bounded-read limit") from exc
|
|
186
|
+
explicit_ca_context(source)
|
|
187
|
+
if b"-----BEGIN TRUSTED CERTIFICATE-----" in content:
|
|
188
|
+
# X509_AUX trust/reject metadata must not be lost in a PEM rewrite.
|
|
189
|
+
# Let the resolver fall back to this original OpenSSL trust file.
|
|
190
|
+
raise ssl.SSLError(
|
|
191
|
+
"OpenSSL trusted-certificate metadata requires the original CA file"
|
|
192
|
+
)
|
|
193
|
+
blocks = re.findall(
|
|
194
|
+
rb"-----BEGIN CERTIFICATE-----.*?-----END CERTIFICATE-----",
|
|
195
|
+
content,
|
|
196
|
+
flags=re.DOTALL,
|
|
197
|
+
)
|
|
198
|
+
source_pem = b"\n".join(blocks) + b"\n"
|
|
199
|
+
context = _secure_client_context()
|
|
200
|
+
try:
|
|
201
|
+
context.load_verify_locations(cadata=source_pem.decode("ascii"))
|
|
202
|
+
except (ValueError, UnicodeError) as exc:
|
|
203
|
+
raise ssl.SSLError("CA source contains no valid certificate PEMs") from exc
|
|
204
|
+
for block in blocks:
|
|
205
|
+
# Deduplicate DER payloads despite PEM wrapping differences, while
|
|
206
|
+
# retaining the first block verbatim (including CA:FALSE anchors).
|
|
207
|
+
payload = ssl.PEM_cert_to_DER_cert(block.decode("ascii"))
|
|
208
|
+
if payload not in seen_certificates:
|
|
209
|
+
seen_certificates.add(payload)
|
|
210
|
+
certificate_blocks.append(block + b"\n")
|
|
211
|
+
pem = b"\n".join(certificate_blocks)
|
|
212
|
+
output_path = _content_addressed_path(destination, pem)
|
|
213
|
+
# Do not reap older digests here: callers may have persisted one of those
|
|
214
|
+
# immutable paths in their environment. The files are intentionally small.
|
|
215
|
+
existing = _read_regular_file(output_path, len(pem))
|
|
216
|
+
if existing is None:
|
|
217
|
+
_atomic_write(output_path, pem)
|
|
218
|
+
elif existing != pem:
|
|
219
|
+
raise OSError(
|
|
220
|
+
f"Content-addressed CA bundle has unexpected content: {output_path}"
|
|
221
|
+
)
|
|
222
|
+
return str(output_path)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
def trusts_public_roots(cafile: str) -> bool:
|
|
226
|
+
"""True if roots loaded from ``cafile`` include every certifi root.
|
|
227
|
+
|
|
228
|
+
This checks the file's contents, not a process's complete effective trust;
|
|
229
|
+
OpenSSL capath entries or platform-native stores may add other roots. An
|
|
230
|
+
internal-only file still fails this required public-root subset check.
|
|
231
|
+
"""
|
|
232
|
+
try:
|
|
233
|
+
candidate = explicit_ca_context(cafile)
|
|
234
|
+
except (OSError, ssl.SSLError):
|
|
235
|
+
return False
|
|
236
|
+
public = explicit_ca_context(certifi.where())
|
|
237
|
+
return set(public.get_ca_certs(binary_form=True)) <= set(
|
|
238
|
+
candidate.get_ca_certs(binary_form=True)
|
|
239
|
+
)
|
|
@@ -13,7 +13,7 @@ and TextInput helper via lazy imports to avoid an import cycle.
|
|
|
13
13
|
|
|
14
14
|
from __future__ import annotations
|
|
15
15
|
|
|
16
|
-
from typing import Callable, List, Optional
|
|
16
|
+
from typing import Callable, Dict, List, Optional
|
|
17
17
|
|
|
18
18
|
import httpx
|
|
19
19
|
|
|
@@ -35,6 +35,12 @@ VLLM_API_KEY_ENV = "VLLM_API_KEY"
|
|
|
35
35
|
# placeholder vLLM itself prints in its curl examples.
|
|
36
36
|
VLLM_PLACEHOLDER_API_KEY = "EMPTY"
|
|
37
37
|
|
|
38
|
+
# Context size stamped on persisted vLLM model configs when the server's
|
|
39
|
+
# /v1/models JSON advertises none. vLLM reports ``max_model_len`` per entry
|
|
40
|
+
# when it can; anything without one gets this floor so token accounting and
|
|
41
|
+
# compaction use a realistic window instead of the 128k global fallback.
|
|
42
|
+
VLLM_DEFAULT_CONTEXT_LENGTH = 262_144
|
|
43
|
+
|
|
38
44
|
_FETCH_TIMEOUT_S = 10.0
|
|
39
45
|
_MODEL_SUFFIXES = ("/v1/models", "/models", "/v1")
|
|
40
46
|
|
|
@@ -89,18 +95,18 @@ def resolve_api_key_ref(api_key_ref: str) -> Optional[str]:
|
|
|
89
95
|
return api_key_ref
|
|
90
96
|
|
|
91
97
|
|
|
92
|
-
def
|
|
98
|
+
def _fetch_vllm_entries(
|
|
93
99
|
base_url: str,
|
|
94
100
|
*,
|
|
95
101
|
api_key: Optional[str] = None,
|
|
96
102
|
http_get: Optional[Callable] = None,
|
|
97
|
-
) -> List[
|
|
98
|
-
"""
|
|
103
|
+
) -> List[dict]:
|
|
104
|
+
"""GET ``{base}/v1/models`` and return the entry dicts.
|
|
99
105
|
|
|
100
106
|
``api_key`` is sent as a bearer token when given (servers started with
|
|
101
107
|
``--api-key`` gate the listing too). ``http_get`` is injectable for tests.
|
|
102
108
|
Raises :class:`VllmFetchError` on any transport error, non-2xx status,
|
|
103
|
-
non-JSON body, or unexpected shape.
|
|
109
|
+
non-JSON body, or unexpected shape. Non-dict entries are dropped.
|
|
104
110
|
"""
|
|
105
111
|
url = models_endpoint(base_url)
|
|
106
112
|
getter = http_get or httpx.get
|
|
@@ -117,19 +123,55 @@ def fetch_vllm_model_ids(
|
|
|
117
123
|
data = payload.get("data") if isinstance(payload, dict) else None
|
|
118
124
|
if not isinstance(data, list):
|
|
119
125
|
raise VllmFetchError("response has no 'data' list")
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
126
|
+
return [entry for entry in data if isinstance(entry, dict)]
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def _context_length_from_entry(entry: dict) -> int:
|
|
130
|
+
"""Context size a ``/v1/models`` entry advertises; 0 when it does not.
|
|
131
|
+
|
|
132
|
+
vLLM reports ``max_model_len``; some OpenAI-compatible servers use
|
|
133
|
+
``context_length``. Anything missing or non-positive means "unknown" so
|
|
134
|
+
the caller can fall back to :data:`VLLM_DEFAULT_CONTEXT_LENGTH`.
|
|
135
|
+
"""
|
|
136
|
+
for key in ("max_model_len", "context_length"):
|
|
137
|
+
value = entry.get(key)
|
|
138
|
+
if isinstance(value, int) and not isinstance(value, bool) and value > 0:
|
|
139
|
+
return value
|
|
140
|
+
return 0
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def fetch_vllm_model_contexts(
|
|
144
|
+
base_url: str,
|
|
145
|
+
*,
|
|
146
|
+
api_key: Optional[str] = None,
|
|
147
|
+
http_get: Optional[Callable] = None,
|
|
148
|
+
) -> Dict[str, int]:
|
|
149
|
+
"""Query ``{base}/v1/models`` and map model id -> advertised context.
|
|
150
|
+
|
|
151
|
+
Entries without a usable context size map to 0; the persisted config
|
|
152
|
+
replaces that with :data:`VLLM_DEFAULT_CONTEXT_LENGTH`.
|
|
153
|
+
"""
|
|
154
|
+
contexts: Dict[str, int] = {}
|
|
155
|
+
for entry in _fetch_vllm_entries(base_url, api_key=api_key, http_get=http_get):
|
|
156
|
+
model_id = entry.get("id")
|
|
123
157
|
if isinstance(model_id, str) and model_id.strip():
|
|
124
|
-
|
|
125
|
-
return
|
|
158
|
+
contexts[model_id.strip()] = _context_length_from_entry(entry)
|
|
159
|
+
return contexts
|
|
126
160
|
|
|
127
161
|
|
|
128
|
-
def build_vllm_model_config(
|
|
162
|
+
def build_vllm_model_config(
|
|
163
|
+
model_id: str,
|
|
164
|
+
base_url: str,
|
|
165
|
+
api_key_ref: str,
|
|
166
|
+
context_length: Optional[int] = None,
|
|
167
|
+
) -> dict:
|
|
129
168
|
"""A Code Puppy ``custom_openai`` config for one vLLM model.
|
|
130
169
|
|
|
131
170
|
``api_key_ref`` is either ``$VLLM_API_KEY`` (a real key was supplied) or
|
|
132
171
|
the literal :data:`VLLM_PLACEHOLDER_API_KEY` for an unauthenticated server.
|
|
172
|
+
``context_length`` is what the server's JSON advertised; when it carried
|
|
173
|
+
none (``None``/non-positive) the config gets
|
|
174
|
+
:data:`VLLM_DEFAULT_CONTEXT_LENGTH` so token accounting has a real number.
|
|
133
175
|
"""
|
|
134
176
|
return {
|
|
135
177
|
"type": "custom_openai",
|
|
@@ -139,6 +181,11 @@ def build_vllm_model_config(model_id: str, base_url: str, api_key_ref: str) -> d
|
|
|
139
181
|
"url": openai_endpoint(base_url),
|
|
140
182
|
"api_key": api_key_ref,
|
|
141
183
|
},
|
|
184
|
+
"context_length": (
|
|
185
|
+
context_length
|
|
186
|
+
if context_length and context_length > 0
|
|
187
|
+
else VLLM_DEFAULT_CONTEXT_LENGTH
|
|
188
|
+
),
|
|
142
189
|
"supported_settings": ["temperature", "seed", "top_p"],
|
|
143
190
|
}
|
|
144
191
|
|
|
@@ -343,14 +390,16 @@ def _auth_failure_hint(error_text: str, *, authenticated: bool) -> Optional[str]
|
|
|
343
390
|
def run_vllm_flow(
|
|
344
391
|
*,
|
|
345
392
|
url_prompt: Callable = prompt_for_vllm_url,
|
|
346
|
-
fetch_models: Callable =
|
|
393
|
+
fetch_models: Callable = fetch_vllm_model_contexts,
|
|
347
394
|
models_menu_factory: Callable = build_vllm_models_menu,
|
|
348
395
|
api_key_prompt: Callable = choose_vllm_api_key,
|
|
349
396
|
) -> bool:
|
|
350
397
|
"""URL -> key (none/new/saved) -> /v1/models -> pick -> persist.
|
|
351
398
|
|
|
352
399
|
The key comes *before* the listing because a server started with
|
|
353
|
-
``--api-key`` 401s on ``/v1/models`` too.
|
|
400
|
+
``--api-key`` 401s on ``/v1/models`` too. ``fetch_models`` maps model
|
|
401
|
+
id -> advertised context length (0 when the JSON carries none, which the
|
|
402
|
+
persisted config then defaults to 256k). Collaborators are injectable
|
|
354
403
|
so tests can script every stage.
|
|
355
404
|
"""
|
|
356
405
|
base_url = url_prompt()
|
|
@@ -373,13 +422,14 @@ def run_vllm_flow(
|
|
|
373
422
|
|
|
374
423
|
listing = models_endpoint(base_url)
|
|
375
424
|
try:
|
|
376
|
-
|
|
425
|
+
model_contexts = fetch_models(base_url, api_key=api_key)
|
|
377
426
|
except VllmFetchError as exc:
|
|
378
427
|
emit_error(t("model_menu.vllm.fetch_failed", url=listing, error=exc))
|
|
379
428
|
hint = _auth_failure_hint(str(exc), authenticated=bool(api_key))
|
|
380
429
|
if hint:
|
|
381
430
|
emit_warning(hint)
|
|
382
431
|
return False
|
|
432
|
+
model_ids = list(model_contexts)
|
|
383
433
|
if not model_ids:
|
|
384
434
|
emit_warning(t("model_menu.vllm.no_models", url=listing))
|
|
385
435
|
return False
|
|
@@ -394,5 +444,8 @@ def run_vllm_flow(
|
|
|
394
444
|
|
|
395
445
|
model_key = extra_model_key(VLLM_PROVIDER_ID, model_id)
|
|
396
446
|
return add_config_to_extra_config(
|
|
397
|
-
model_key,
|
|
447
|
+
model_key,
|
|
448
|
+
build_vllm_model_config(
|
|
449
|
+
model_id, base_url, api_key_ref, model_contexts.get(model_id)
|
|
450
|
+
),
|
|
398
451
|
)
|
|
@@ -13,7 +13,8 @@ import httpx
|
|
|
13
13
|
|
|
14
14
|
if TYPE_CHECKING:
|
|
15
15
|
import requests
|
|
16
|
-
from code_puppy.
|
|
16
|
+
from code_puppy.ca_bundle import write_public_and_corporate_bundle
|
|
17
|
+
from code_puppy.config import DATA_DIR, get_http2
|
|
17
18
|
|
|
18
19
|
from .http_retry import RetryingSendMixin
|
|
19
20
|
|
|
@@ -99,9 +100,45 @@ class RetryingAsyncClient(RetryingSendMixin, httpx.AsyncClient):
|
|
|
99
100
|
|
|
100
101
|
|
|
101
102
|
def get_cert_bundle_path() -> str | None:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
"""Return public + configured corporate trust as an exportable CA file.
|
|
104
|
+
|
|
105
|
+
``SSL_CERT_FILE`` may contain only a corporate interception root. Passing
|
|
106
|
+
that file through unchanged makes public HTTPS fail in clients and child
|
|
107
|
+
processes that treat it as their complete file-based trust source. Combine
|
|
108
|
+
it with certifi roots in an immutable per-user file before propagation.
|
|
109
|
+
Sources are checked in SSL_CERT_FILE, REQUESTS_CA_BUNDLE, CURL_CA_BUNDLE
|
|
110
|
+
order. Set CODE_PUPPY_COMBINE_CA_BUNDLE=false to retain restricted file trust.
|
|
111
|
+
"""
|
|
112
|
+
ssl_cert_file = next(
|
|
113
|
+
(
|
|
114
|
+
value
|
|
115
|
+
for name in ("SSL_CERT_FILE", "REQUESTS_CA_BUNDLE", "CURL_CA_BUNDLE")
|
|
116
|
+
if (value := os.environ.get(name)) and os.path.isfile(value)
|
|
117
|
+
),
|
|
118
|
+
None,
|
|
119
|
+
)
|
|
120
|
+
if not ssl_cert_file:
|
|
121
|
+
return None
|
|
122
|
+
# Preserve deliberately restricted/pinned file trust when requested.
|
|
123
|
+
if os.environ.get("CODE_PUPPY_COMBINE_CA_BUNDLE", "true").lower() in (
|
|
124
|
+
"0",
|
|
125
|
+
"false",
|
|
126
|
+
"no",
|
|
127
|
+
):
|
|
128
|
+
return ssl_cert_file
|
|
129
|
+
|
|
130
|
+
destination = os.path.join(
|
|
131
|
+
DATA_DIR,
|
|
132
|
+
"certs",
|
|
133
|
+
"public-and-corporate-ca-bundle.pem",
|
|
134
|
+
)
|
|
135
|
+
try:
|
|
136
|
+
return write_public_and_corporate_bundle(ssl_cert_file, destination)
|
|
137
|
+
except OSError as exc:
|
|
138
|
+
emit_warning(
|
|
139
|
+
f"Could not combine public roots with {ssl_cert_file}; "
|
|
140
|
+
f"using the configured CA file unchanged: {exc}"
|
|
141
|
+
)
|
|
105
142
|
return ssl_cert_file
|
|
106
143
|
|
|
107
144
|
|
|
@@ -14,7 +14,11 @@ from typing import Any, Dict, Optional
|
|
|
14
14
|
|
|
15
15
|
from pydantic_ai.toolsets import AbstractToolset
|
|
16
16
|
|
|
17
|
-
from code_puppy.mcp_.toolset_utils import
|
|
17
|
+
from code_puppy.mcp_.toolset_utils import (
|
|
18
|
+
toolset_init_timeout,
|
|
19
|
+
toolset_is_running,
|
|
20
|
+
unwrap_toolset,
|
|
21
|
+
)
|
|
18
22
|
|
|
19
23
|
logger = logging.getLogger(__name__)
|
|
20
24
|
|
|
@@ -127,7 +131,7 @@ class AsyncServerLifecycleManager:
|
|
|
127
131
|
try:
|
|
128
132
|
# Wrappers need their leaf's timeout. None explicitly disables the
|
|
129
133
|
# deadline; generic toolsets without one retain the 10s fallback.
|
|
130
|
-
timeout =
|
|
134
|
+
timeout = toolset_init_timeout(server, default=10.0)
|
|
131
135
|
async with asyncio.timeout(timeout):
|
|
132
136
|
await context.exit_stack.enter_async_context(server)
|
|
133
137
|
if context.stopping:
|
|
@@ -7,15 +7,20 @@ cached tool definitions) should use these helpers instead of poking at
|
|
|
7
7
|
private attributes on whatever object they happen to hold.
|
|
8
8
|
|
|
9
9
|
Only ``.wrapped`` (public ``WrapperToolset`` API) and ``.prefix`` (public
|
|
10
|
-
``PrefixedToolset`` API) are used for traversal. The
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
``PrefixedToolset`` API) are used for traversal. The private reads left in
|
|
11
|
+
the codebase are quarantined here behind defensive ``getattr``s:
|
|
12
|
+
|
|
13
|
+
* ``MCPToolset._cached_tools`` (``iter_cached_tool_defs``) — pydantic-ai
|
|
14
|
+
exposes no *synchronous* tool-listing API (``list_tools()`` is async and
|
|
15
|
+
performs I/O; token estimation must stay sync + side-effect-free).
|
|
16
|
+
* ``fastmcp.Client._init_timeout`` (``toolset_init_timeout``) — pydantic-ai
|
|
17
|
+
forwards ``init_timeout`` to its fastmcp client without keeping a copy.
|
|
15
18
|
"""
|
|
16
19
|
|
|
17
20
|
from typing import Any, Dict, Iterator, List, Optional, Tuple
|
|
18
21
|
|
|
22
|
+
_MISSING = object()
|
|
23
|
+
|
|
19
24
|
|
|
20
25
|
def unwrap_toolset(toolset: Any) -> Any:
|
|
21
26
|
"""Follow public ``.wrapped`` links down to the leaf toolset."""
|
|
@@ -67,6 +72,23 @@ def tool_input_schema(mcp_tool: Any) -> Optional[Dict[str, Any]]:
|
|
|
67
72
|
return getattr(mcp_tool, "inputSchema", None)
|
|
68
73
|
|
|
69
74
|
|
|
75
|
+
def toolset_init_timeout(toolset: Any, default: Optional[float]) -> Optional[float]:
|
|
76
|
+
"""Seconds the leaf toolset allows for startup; ``None`` means no deadline.
|
|
77
|
+
|
|
78
|
+
``MCPToolset`` has no ``init_timeout`` attribute — it hands the value to
|
|
79
|
+
its fastmcp ``Client``, which stores it (normalized, ``0`` → ``None``) as
|
|
80
|
+
``_init_timeout``. Missing that read silently swapped every configured
|
|
81
|
+
timeout (330s for OAuth, 60s for stdio) for ``default``. A leaf-level
|
|
82
|
+
``init_timeout`` attribute still wins for duck-typed toolsets.
|
|
83
|
+
"""
|
|
84
|
+
leaf = unwrap_toolset(toolset)
|
|
85
|
+
timeout = getattr(leaf, "init_timeout", _MISSING)
|
|
86
|
+
if timeout is _MISSING:
|
|
87
|
+
client = getattr(leaf, "client", None)
|
|
88
|
+
timeout = getattr(client, "_init_timeout", _MISSING)
|
|
89
|
+
return default if timeout is _MISSING else timeout
|
|
90
|
+
|
|
91
|
+
|
|
70
92
|
def toolset_is_running(toolset: Any) -> bool:
|
|
71
93
|
"""Whether the leaf toolset currently holds an open server session."""
|
|
72
94
|
return bool(getattr(unwrap_toolset(toolset), "is_running", False))
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "code-puppy"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.892"
|
|
8
8
|
description = "Code generation agent"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11,<3.15"
|
|
@@ -41,6 +41,7 @@ dependencies = [
|
|
|
41
41
|
"agent-client-protocol>=0.11.0,<0.12",
|
|
42
42
|
]
|
|
43
43
|
dev-dependencies = [
|
|
44
|
+
"cryptography>=44.0.0",
|
|
44
45
|
"pytest>=8.3.4",
|
|
45
46
|
"pytest-cov>=6.1.1",
|
|
46
47
|
"pytest-asyncio>=0.23.1",
|
|
@@ -113,6 +114,7 @@ python-preference = "only-managed"
|
|
|
113
114
|
|
|
114
115
|
[dependency-groups]
|
|
115
116
|
dev = [
|
|
117
|
+
"cryptography>=44.0.0",
|
|
116
118
|
"pytest>=8.3.4",
|
|
117
119
|
"pytest-cov>=6.1.1",
|
|
118
120
|
"pytest-asyncio>=0.23.1",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|