code-puppy 0.0.287__py3-none-any.whl → 0.0.323__py3-none-any.whl

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.
Files changed (110) hide show
  1. code_puppy/__init__.py +3 -1
  2. code_puppy/agents/agent_code_puppy.py +5 -4
  3. code_puppy/agents/agent_creator_agent.py +22 -18
  4. code_puppy/agents/agent_manager.py +2 -2
  5. code_puppy/agents/base_agent.py +496 -102
  6. code_puppy/callbacks.py +8 -0
  7. code_puppy/chatgpt_codex_client.py +283 -0
  8. code_puppy/cli_runner.py +795 -0
  9. code_puppy/command_line/add_model_menu.py +19 -16
  10. code_puppy/command_line/attachments.py +10 -5
  11. code_puppy/command_line/autosave_menu.py +269 -41
  12. code_puppy/command_line/colors_menu.py +515 -0
  13. code_puppy/command_line/command_handler.py +10 -24
  14. code_puppy/command_line/config_commands.py +106 -25
  15. code_puppy/command_line/core_commands.py +32 -20
  16. code_puppy/command_line/mcp/add_command.py +3 -16
  17. code_puppy/command_line/mcp/base.py +0 -3
  18. code_puppy/command_line/mcp/catalog_server_installer.py +15 -15
  19. code_puppy/command_line/mcp/custom_server_form.py +66 -5
  20. code_puppy/command_line/mcp/custom_server_installer.py +17 -17
  21. code_puppy/command_line/mcp/edit_command.py +15 -22
  22. code_puppy/command_line/mcp/handler.py +7 -2
  23. code_puppy/command_line/mcp/help_command.py +2 -2
  24. code_puppy/command_line/mcp/install_command.py +10 -14
  25. code_puppy/command_line/mcp/install_menu.py +2 -6
  26. code_puppy/command_line/mcp/list_command.py +2 -2
  27. code_puppy/command_line/mcp/logs_command.py +174 -65
  28. code_puppy/command_line/mcp/remove_command.py +2 -2
  29. code_puppy/command_line/mcp/restart_command.py +7 -2
  30. code_puppy/command_line/mcp/search_command.py +16 -10
  31. code_puppy/command_line/mcp/start_all_command.py +16 -6
  32. code_puppy/command_line/mcp/start_command.py +12 -10
  33. code_puppy/command_line/mcp/status_command.py +4 -5
  34. code_puppy/command_line/mcp/stop_all_command.py +5 -1
  35. code_puppy/command_line/mcp/stop_command.py +6 -4
  36. code_puppy/command_line/mcp/test_command.py +2 -2
  37. code_puppy/command_line/mcp/wizard_utils.py +20 -16
  38. code_puppy/command_line/model_settings_menu.py +53 -7
  39. code_puppy/command_line/motd.py +1 -1
  40. code_puppy/command_line/pin_command_completion.py +82 -7
  41. code_puppy/command_line/prompt_toolkit_completion.py +32 -9
  42. code_puppy/command_line/session_commands.py +11 -4
  43. code_puppy/config.py +217 -53
  44. code_puppy/error_logging.py +118 -0
  45. code_puppy/gemini_code_assist.py +385 -0
  46. code_puppy/keymap.py +126 -0
  47. code_puppy/main.py +5 -745
  48. code_puppy/mcp_/__init__.py +17 -0
  49. code_puppy/mcp_/blocking_startup.py +63 -36
  50. code_puppy/mcp_/captured_stdio_server.py +1 -1
  51. code_puppy/mcp_/config_wizard.py +4 -4
  52. code_puppy/mcp_/dashboard.py +15 -6
  53. code_puppy/mcp_/managed_server.py +25 -5
  54. code_puppy/mcp_/manager.py +65 -0
  55. code_puppy/mcp_/mcp_logs.py +224 -0
  56. code_puppy/mcp_/registry.py +6 -6
  57. code_puppy/messaging/__init__.py +184 -2
  58. code_puppy/messaging/bus.py +610 -0
  59. code_puppy/messaging/commands.py +167 -0
  60. code_puppy/messaging/markdown_patches.py +57 -0
  61. code_puppy/messaging/message_queue.py +3 -3
  62. code_puppy/messaging/messages.py +470 -0
  63. code_puppy/messaging/renderers.py +43 -141
  64. code_puppy/messaging/rich_renderer.py +900 -0
  65. code_puppy/messaging/spinner/console_spinner.py +39 -2
  66. code_puppy/model_factory.py +292 -53
  67. code_puppy/model_utils.py +57 -48
  68. code_puppy/models.json +19 -5
  69. code_puppy/plugins/__init__.py +152 -10
  70. code_puppy/plugins/chatgpt_oauth/config.py +20 -12
  71. code_puppy/plugins/chatgpt_oauth/oauth_flow.py +5 -6
  72. code_puppy/plugins/chatgpt_oauth/register_callbacks.py +3 -3
  73. code_puppy/plugins/chatgpt_oauth/test_plugin.py +30 -13
  74. code_puppy/plugins/chatgpt_oauth/utils.py +180 -65
  75. code_puppy/plugins/claude_code_oauth/config.py +15 -11
  76. code_puppy/plugins/claude_code_oauth/register_callbacks.py +28 -0
  77. code_puppy/plugins/claude_code_oauth/utils.py +6 -1
  78. code_puppy/plugins/example_custom_command/register_callbacks.py +2 -2
  79. code_puppy/plugins/oauth_puppy_html.py +3 -0
  80. code_puppy/plugins/shell_safety/agent_shell_safety.py +1 -134
  81. code_puppy/plugins/shell_safety/command_cache.py +156 -0
  82. code_puppy/plugins/shell_safety/register_callbacks.py +77 -3
  83. code_puppy/prompts/codex_system_prompt.md +310 -0
  84. code_puppy/pydantic_patches.py +131 -0
  85. code_puppy/session_storage.py +2 -1
  86. code_puppy/status_display.py +7 -5
  87. code_puppy/terminal_utils.py +126 -0
  88. code_puppy/tools/agent_tools.py +131 -70
  89. code_puppy/tools/browser/browser_control.py +10 -14
  90. code_puppy/tools/browser/browser_interactions.py +20 -28
  91. code_puppy/tools/browser/browser_locators.py +27 -29
  92. code_puppy/tools/browser/browser_navigation.py +9 -9
  93. code_puppy/tools/browser/browser_screenshot.py +12 -14
  94. code_puppy/tools/browser/browser_scripts.py +17 -29
  95. code_puppy/tools/browser/browser_workflows.py +24 -25
  96. code_puppy/tools/browser/camoufox_manager.py +22 -26
  97. code_puppy/tools/command_runner.py +410 -88
  98. code_puppy/tools/common.py +51 -38
  99. code_puppy/tools/file_modifications.py +98 -24
  100. code_puppy/tools/file_operations.py +113 -202
  101. code_puppy/version_checker.py +28 -13
  102. {code_puppy-0.0.287.data → code_puppy-0.0.323.data}/data/code_puppy/models.json +19 -5
  103. {code_puppy-0.0.287.dist-info → code_puppy-0.0.323.dist-info}/METADATA +3 -8
  104. code_puppy-0.0.323.dist-info/RECORD +168 -0
  105. code_puppy/tui_state.py +0 -55
  106. code_puppy-0.0.287.dist-info/RECORD +0 -153
  107. {code_puppy-0.0.287.data → code_puppy-0.0.323.data}/data/code_puppy/models_dev_api.json +0 -0
  108. {code_puppy-0.0.287.dist-info → code_puppy-0.0.323.dist-info}/WHEEL +0 -0
  109. {code_puppy-0.0.287.dist-info → code_puppy-0.0.323.dist-info}/entry_points.txt +0 -0
  110. {code_puppy-0.0.287.dist-info → code_puppy-0.0.323.dist-info}/licenses/LICENSE +0 -0
code_puppy/__init__.py CHANGED
@@ -2,7 +2,9 @@ import importlib.metadata
2
2
 
3
3
  # Biscuit was here! 🐶
4
4
  try:
5
- __version__ = importlib.metadata.version("code-puppy")
5
+ _detected_version = importlib.metadata.version("code-puppy")
6
+ # Ensure we never end up with None or empty string
7
+ __version__ = _detected_version if _detected_version else "0.0.0-dev"
6
8
  except Exception:
7
9
  # Fallback for dev environments where metadata might not be available
8
10
  __version__ = "0.0.0-dev"
@@ -128,10 +128,11 @@ Reasoning & Explanation:
128
128
 
129
129
  Agent Management:
130
130
  - list_agents(): Use this to list all available sub-agents that can be invoked
131
- - invoke_agent(agent_name: str, prompt: str, session_id: str | None = None): Use this to invoke a specific sub-agent with a given prompt.
132
- The optional session_id (kebab-case with random suffix like "implement-oauth-abc123" or "review-auth-x7k9") should ONLY be reused
133
- when you need the sub-agent to remember previous conversation context. Always append 3-6 random chars/numbers for uniqueness.
134
- For one-off tasks, leave it as None (auto-generates).
131
+ - invoke_agent(agent_name: str, prompt: str, session_id: str | None = None): Use this to invoke a specific sub-agent with a given prompt.
132
+ Returns: {{response, agent_name, session_id, error}} - The session_id in the response is the FULL ID to use for continuation!
133
+ - For NEW sessions: provide a base name like "review-auth" - a SHA1 hash suffix is automatically appended
134
+ - To CONTINUE a session: use the session_id from the previous invocation's response
135
+ - For one-off tasks: leave session_id as None (auto-generates)
135
136
 
136
137
  Important rules:
137
138
  - You MUST use tools to accomplish tasks - DO NOT just output code or descriptions
@@ -223,40 +223,45 @@ Arguments:
223
223
  - agent_name (required): Name of the agent to invoke
224
224
  - user_prompt (required): The prompt to send to the invoked agent
225
225
  - session_id (optional): Kebab-case session identifier for conversation memory
226
- - Format: lowercase, numbers, hyphens only with random suffix (e.g., "implement-oauth-abc123", "review-auth-x7k9")
227
- - **ALWAYS append 3-6 random characters/numbers at the end for uniqueness**
228
- - If None (default): Auto-generates a unique session like "agent-name-session-1"
229
- - **ONLY reuse the same session_id when you need the sub-agent to remember previous context**
230
- - For independent one-off tasks, leave as None or use unique session IDs with random suffixes
226
+ - Format: lowercase, numbers, hyphens only (e.g., "implement-oauth", "review-auth")
227
+ - For NEW sessions: provide a base name - a SHA1 hash suffix is automatically appended for uniqueness
228
+ - To CONTINUE a session: use the session_id from the previous invocation's response
229
+ - If None (default): Auto-generates a unique session like "agent-name-session-a3f2b1"
230
+
231
+ Returns: `{{response, agent_name, session_id, error}}`
232
+ - **session_id in the response is the FULL ID** - use this to continue the conversation!
231
233
 
232
234
  Example usage:
233
235
  ```python
234
236
  # Common case: one-off invocation (no memory needed)
235
- invoke_agent(
237
+ result = invoke_agent(
236
238
  agent_name="python-tutor",
237
239
  user_prompt="Explain how to use list comprehensions"
238
240
  )
241
+ # result.session_id contains the auto-generated full ID
239
242
 
240
- # Multi-turn conversation: start with explicit session_id (note random suffix)
241
- invoke_agent(
243
+ # Multi-turn conversation: start with a base session_id
244
+ result1 = invoke_agent(
242
245
  agent_name="code-reviewer",
243
246
  user_prompt="Review this authentication code",
244
- session_id="auth-code-review-x7k9" # Random suffix for uniqueness
247
+ session_id="auth-code-review" # Hash suffix auto-appended
245
248
  )
249
+ # result1.session_id is now "auth-code-review-a3f2b1" (or similar)
246
250
 
247
- # Continue the SAME conversation (reuse session_id for memory)
248
- invoke_agent(
251
+ # Continue the SAME conversation using session_id from the response
252
+ result2 = invoke_agent(
249
253
  agent_name="code-reviewer",
250
254
  user_prompt="Can you also check the authorization logic?",
251
- session_id="auth-code-review-x7k9" # Same session = remembers previous context
255
+ session_id=result1.session_id # Use session_id from previous response!
252
256
  )
253
257
 
254
- # Independent task (different session = no shared memory)
255
- invoke_agent(
258
+ # Independent task (different base name = different session)
259
+ result3 = invoke_agent(
256
260
  agent_name="code-reviewer",
257
261
  user_prompt="Review the payment processing code",
258
- session_id="payment-review-abc123" # Different session with random suffix
262
+ session_id="payment-review" # Gets its own unique hash suffix
259
263
  )
264
+ # result3.session_id is different from result1.session_id
260
265
  ```
261
266
 
262
267
  Best-practice guidelines for `invoke_agent`:
@@ -266,9 +271,8 @@ Best-practice guidelines for `invoke_agent`:
266
271
  • Avoid circular dependencies (don't invoke yourself!)
267
272
  • **Session management:**
268
273
  - Default behavior (session_id=None): Each invocation is independent with no memory
269
- - Reuse session_id ONLY when multi-turn conversation context is needed
270
- - Use human-readable kebab-case names with random suffix: "review-oauth-x7k9", "implement-payment-abc123"
271
- - ALWAYS append 3-6 random characters/numbers at the end for uniqueness (prevents namespace collisions)
274
+ - For NEW sessions: provide a human-readable base name like "review-oauth" - hash suffix is auto-appended
275
+ - To CONTINUE: use the session_id from the previous response (it contains the full ID with hash)
272
276
  - Most tasks don't need conversational memory - let it auto-generate!
273
277
 
274
278
  ### Important Rules for Agent Creation:
@@ -28,9 +28,9 @@ _SESSION_FILE_LOADED: bool = False
28
28
  # Session persistence file path
29
29
  def _get_session_file_path() -> Path:
30
30
  """Get the path to the terminal sessions file."""
31
- from ..config import CONFIG_DIR
31
+ from ..config import STATE_DIR
32
32
 
33
- return Path(CONFIG_DIR) / "terminal_sessions.json"
33
+ return Path(STATE_DIR) / "terminal_sessions.json"
34
34
 
35
35
 
36
36
  def get_terminal_session_id() -> str: