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.
- code_puppy/__init__.py +3 -1
- code_puppy/agents/agent_code_puppy.py +5 -4
- code_puppy/agents/agent_creator_agent.py +22 -18
- code_puppy/agents/agent_manager.py +2 -2
- code_puppy/agents/base_agent.py +496 -102
- code_puppy/callbacks.py +8 -0
- code_puppy/chatgpt_codex_client.py +283 -0
- code_puppy/cli_runner.py +795 -0
- code_puppy/command_line/add_model_menu.py +19 -16
- code_puppy/command_line/attachments.py +10 -5
- code_puppy/command_line/autosave_menu.py +269 -41
- code_puppy/command_line/colors_menu.py +515 -0
- code_puppy/command_line/command_handler.py +10 -24
- code_puppy/command_line/config_commands.py +106 -25
- code_puppy/command_line/core_commands.py +32 -20
- code_puppy/command_line/mcp/add_command.py +3 -16
- code_puppy/command_line/mcp/base.py +0 -3
- code_puppy/command_line/mcp/catalog_server_installer.py +15 -15
- code_puppy/command_line/mcp/custom_server_form.py +66 -5
- code_puppy/command_line/mcp/custom_server_installer.py +17 -17
- code_puppy/command_line/mcp/edit_command.py +15 -22
- code_puppy/command_line/mcp/handler.py +7 -2
- code_puppy/command_line/mcp/help_command.py +2 -2
- code_puppy/command_line/mcp/install_command.py +10 -14
- code_puppy/command_line/mcp/install_menu.py +2 -6
- code_puppy/command_line/mcp/list_command.py +2 -2
- code_puppy/command_line/mcp/logs_command.py +174 -65
- code_puppy/command_line/mcp/remove_command.py +2 -2
- code_puppy/command_line/mcp/restart_command.py +7 -2
- code_puppy/command_line/mcp/search_command.py +16 -10
- code_puppy/command_line/mcp/start_all_command.py +16 -6
- code_puppy/command_line/mcp/start_command.py +12 -10
- code_puppy/command_line/mcp/status_command.py +4 -5
- code_puppy/command_line/mcp/stop_all_command.py +5 -1
- code_puppy/command_line/mcp/stop_command.py +6 -4
- code_puppy/command_line/mcp/test_command.py +2 -2
- code_puppy/command_line/mcp/wizard_utils.py +20 -16
- code_puppy/command_line/model_settings_menu.py +53 -7
- code_puppy/command_line/motd.py +1 -1
- code_puppy/command_line/pin_command_completion.py +82 -7
- code_puppy/command_line/prompt_toolkit_completion.py +32 -9
- code_puppy/command_line/session_commands.py +11 -4
- code_puppy/config.py +217 -53
- code_puppy/error_logging.py +118 -0
- code_puppy/gemini_code_assist.py +385 -0
- code_puppy/keymap.py +126 -0
- code_puppy/main.py +5 -745
- code_puppy/mcp_/__init__.py +17 -0
- code_puppy/mcp_/blocking_startup.py +63 -36
- code_puppy/mcp_/captured_stdio_server.py +1 -1
- code_puppy/mcp_/config_wizard.py +4 -4
- code_puppy/mcp_/dashboard.py +15 -6
- code_puppy/mcp_/managed_server.py +25 -5
- code_puppy/mcp_/manager.py +65 -0
- code_puppy/mcp_/mcp_logs.py +224 -0
- code_puppy/mcp_/registry.py +6 -6
- code_puppy/messaging/__init__.py +184 -2
- code_puppy/messaging/bus.py +610 -0
- code_puppy/messaging/commands.py +167 -0
- code_puppy/messaging/markdown_patches.py +57 -0
- code_puppy/messaging/message_queue.py +3 -3
- code_puppy/messaging/messages.py +470 -0
- code_puppy/messaging/renderers.py +43 -141
- code_puppy/messaging/rich_renderer.py +900 -0
- code_puppy/messaging/spinner/console_spinner.py +39 -2
- code_puppy/model_factory.py +292 -53
- code_puppy/model_utils.py +57 -48
- code_puppy/models.json +19 -5
- code_puppy/plugins/__init__.py +152 -10
- code_puppy/plugins/chatgpt_oauth/config.py +20 -12
- code_puppy/plugins/chatgpt_oauth/oauth_flow.py +5 -6
- code_puppy/plugins/chatgpt_oauth/register_callbacks.py +3 -3
- code_puppy/plugins/chatgpt_oauth/test_plugin.py +30 -13
- code_puppy/plugins/chatgpt_oauth/utils.py +180 -65
- code_puppy/plugins/claude_code_oauth/config.py +15 -11
- code_puppy/plugins/claude_code_oauth/register_callbacks.py +28 -0
- code_puppy/plugins/claude_code_oauth/utils.py +6 -1
- code_puppy/plugins/example_custom_command/register_callbacks.py +2 -2
- code_puppy/plugins/oauth_puppy_html.py +3 -0
- code_puppy/plugins/shell_safety/agent_shell_safety.py +1 -134
- code_puppy/plugins/shell_safety/command_cache.py +156 -0
- code_puppy/plugins/shell_safety/register_callbacks.py +77 -3
- code_puppy/prompts/codex_system_prompt.md +310 -0
- code_puppy/pydantic_patches.py +131 -0
- code_puppy/session_storage.py +2 -1
- code_puppy/status_display.py +7 -5
- code_puppy/terminal_utils.py +126 -0
- code_puppy/tools/agent_tools.py +131 -70
- code_puppy/tools/browser/browser_control.py +10 -14
- code_puppy/tools/browser/browser_interactions.py +20 -28
- code_puppy/tools/browser/browser_locators.py +27 -29
- code_puppy/tools/browser/browser_navigation.py +9 -9
- code_puppy/tools/browser/browser_screenshot.py +12 -14
- code_puppy/tools/browser/browser_scripts.py +17 -29
- code_puppy/tools/browser/browser_workflows.py +24 -25
- code_puppy/tools/browser/camoufox_manager.py +22 -26
- code_puppy/tools/command_runner.py +410 -88
- code_puppy/tools/common.py +51 -38
- code_puppy/tools/file_modifications.py +98 -24
- code_puppy/tools/file_operations.py +113 -202
- code_puppy/version_checker.py +28 -13
- {code_puppy-0.0.287.data → code_puppy-0.0.323.data}/data/code_puppy/models.json +19 -5
- {code_puppy-0.0.287.dist-info → code_puppy-0.0.323.dist-info}/METADATA +3 -8
- code_puppy-0.0.323.dist-info/RECORD +168 -0
- code_puppy/tui_state.py +0 -55
- code_puppy-0.0.287.dist-info/RECORD +0 -153
- {code_puppy-0.0.287.data → code_puppy-0.0.323.data}/data/code_puppy/models_dev_api.json +0 -0
- {code_puppy-0.0.287.dist-info → code_puppy-0.0.323.dist-info}/WHEEL +0 -0
- {code_puppy-0.0.287.dist-info → code_puppy-0.0.323.dist-info}/entry_points.txt +0 -0
- {code_puppy-0.0.287.dist-info → code_puppy-0.0.323.dist-info}/licenses/LICENSE +0 -0
code_puppy/mcp_/registry.py
CHANGED
|
@@ -12,6 +12,7 @@ import uuid
|
|
|
12
12
|
from pathlib import Path
|
|
13
13
|
from typing import Dict, List, Optional
|
|
14
14
|
|
|
15
|
+
from code_puppy import config
|
|
15
16
|
from .managed_server import ServerConfig
|
|
16
17
|
|
|
17
18
|
# Configure logging
|
|
@@ -23,7 +24,7 @@ class ServerRegistry:
|
|
|
23
24
|
Registry for managing MCP server configurations.
|
|
24
25
|
|
|
25
26
|
Provides CRUD operations for server configurations with thread-safe access,
|
|
26
|
-
validation, and persistent storage to
|
|
27
|
+
validation, and persistent storage to XDG_DATA_HOME/code_puppy/mcp_registry.json.
|
|
27
28
|
|
|
28
29
|
All operations are thread-safe and use JSON serialization for ServerConfig objects.
|
|
29
30
|
Handles file not existing gracefully and validates configurations according to
|
|
@@ -36,13 +37,12 @@ class ServerRegistry:
|
|
|
36
37
|
|
|
37
38
|
Args:
|
|
38
39
|
storage_path: Optional custom path for registry storage.
|
|
39
|
-
Defaults to
|
|
40
|
+
Defaults to XDG_DATA_HOME/code_puppy/mcp_registry.json
|
|
40
41
|
"""
|
|
41
42
|
if storage_path is None:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
self._storage_path = code_puppy_dir / "mcp_registry.json"
|
|
43
|
+
data_dir = Path(config.DATA_DIR)
|
|
44
|
+
data_dir.mkdir(parents=True, exist_ok=True, mode=0o700)
|
|
45
|
+
self._storage_path = data_dir / "mcp_registry.json"
|
|
46
46
|
else:
|
|
47
47
|
self._storage_path = Path(storage_path)
|
|
48
48
|
|
code_puppy/messaging/__init__.py
CHANGED
|
@@ -1,3 +1,71 @@
|
|
|
1
|
+
"""Code Puppy Messaging System.
|
|
2
|
+
|
|
3
|
+
This package provides both the legacy messaging API and the new structured
|
|
4
|
+
messaging system.
|
|
5
|
+
|
|
6
|
+
Legacy API (backward compatible):
|
|
7
|
+
- emit_info(), emit_warning(), emit_error(), etc.
|
|
8
|
+
- MessageQueue, UIMessage, MessageType
|
|
9
|
+
- Used by existing code throughout the codebase
|
|
10
|
+
|
|
11
|
+
New Structured Messaging API:
|
|
12
|
+
- MessageBus for bidirectional Agent <-> UI communication
|
|
13
|
+
- Pydantic message models (TextMessage, DiffMessage, etc.)
|
|
14
|
+
- Command models for UI -> Agent communication
|
|
15
|
+
- RichConsoleRenderer for presentation
|
|
16
|
+
|
|
17
|
+
Example (legacy):
|
|
18
|
+
>>> from code_puppy.messaging import emit_info, emit_error
|
|
19
|
+
>>> emit_info("Operation complete")
|
|
20
|
+
>>> emit_error("Something went wrong")
|
|
21
|
+
|
|
22
|
+
Example (new):
|
|
23
|
+
>>> from code_puppy.messaging import (
|
|
24
|
+
... MessageBus, get_message_bus,
|
|
25
|
+
... TextMessage, MessageLevel,
|
|
26
|
+
... RichConsoleRenderer,
|
|
27
|
+
... )
|
|
28
|
+
>>> bus = get_message_bus()
|
|
29
|
+
>>> bus.emit(TextMessage(level=MessageLevel.INFO, text="Hello"))
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
# =============================================================================
|
|
33
|
+
# Apply Rich Markdown patches (left-justified headers)
|
|
34
|
+
# =============================================================================
|
|
35
|
+
from .markdown_patches import patch_markdown_headings
|
|
36
|
+
|
|
37
|
+
patch_markdown_headings()
|
|
38
|
+
|
|
39
|
+
# =============================================================================
|
|
40
|
+
# Legacy API (backward compatible)
|
|
41
|
+
# =============================================================================
|
|
42
|
+
|
|
43
|
+
# Message bus
|
|
44
|
+
from .bus import (
|
|
45
|
+
MessageBus,
|
|
46
|
+
emit_shell_line,
|
|
47
|
+
get_message_bus,
|
|
48
|
+
get_session_context,
|
|
49
|
+
reset_message_bus,
|
|
50
|
+
set_session_context,
|
|
51
|
+
)
|
|
52
|
+
from .bus import emit as bus_emit # Convenience functions (new API versions)
|
|
53
|
+
from .bus import emit_debug as bus_emit_debug
|
|
54
|
+
from .bus import emit_error as bus_emit_error
|
|
55
|
+
from .bus import emit_info as bus_emit_info
|
|
56
|
+
from .bus import emit_success as bus_emit_success
|
|
57
|
+
from .bus import emit_warning as bus_emit_warning
|
|
58
|
+
|
|
59
|
+
# Command types (UI -> Agent)
|
|
60
|
+
from .commands import ( # Base; Agent control; User interaction responses; Union type
|
|
61
|
+
AnyCommand,
|
|
62
|
+
BaseCommand,
|
|
63
|
+
CancelAgentCommand,
|
|
64
|
+
ConfirmationResponse,
|
|
65
|
+
InterruptShellCommand,
|
|
66
|
+
SelectionResponse,
|
|
67
|
+
UserInputResponse,
|
|
68
|
+
)
|
|
1
69
|
from .message_queue import (
|
|
2
70
|
MessageQueue,
|
|
3
71
|
MessageType,
|
|
@@ -19,14 +87,66 @@ from .message_queue import (
|
|
|
19
87
|
get_global_queue,
|
|
20
88
|
provide_prompt_response,
|
|
21
89
|
)
|
|
90
|
+
|
|
91
|
+
# Message types and enums
|
|
92
|
+
from .messages import ( # Enums, Base, Text, File ops, Diff, Shell, Agent, etc.
|
|
93
|
+
AgentReasoningMessage,
|
|
94
|
+
AgentResponseMessage,
|
|
95
|
+
AnyMessage,
|
|
96
|
+
BaseMessage,
|
|
97
|
+
ConfirmationRequest,
|
|
98
|
+
DiffLine,
|
|
99
|
+
DiffMessage,
|
|
100
|
+
DividerMessage,
|
|
101
|
+
FileContentMessage,
|
|
102
|
+
FileEntry,
|
|
103
|
+
FileListingMessage,
|
|
104
|
+
GrepMatch,
|
|
105
|
+
GrepResultMessage,
|
|
106
|
+
MessageCategory,
|
|
107
|
+
MessageLevel,
|
|
108
|
+
SelectionRequest,
|
|
109
|
+
ShellLineMessage,
|
|
110
|
+
ShellOutputMessage,
|
|
111
|
+
ShellStartMessage,
|
|
112
|
+
SpinnerControl,
|
|
113
|
+
StatusPanelMessage,
|
|
114
|
+
SubAgentInvocationMessage,
|
|
115
|
+
SubAgentResponseMessage,
|
|
116
|
+
TextMessage,
|
|
117
|
+
UserInputRequest,
|
|
118
|
+
VersionCheckMessage,
|
|
119
|
+
)
|
|
22
120
|
from .queue_console import QueueConsole, get_queue_console
|
|
23
|
-
from .renderers import InteractiveRenderer, SynchronousInteractiveRenderer
|
|
121
|
+
from .renderers import InteractiveRenderer, SynchronousInteractiveRenderer
|
|
122
|
+
|
|
123
|
+
# Renderer
|
|
124
|
+
from .rich_renderer import (
|
|
125
|
+
DEFAULT_STYLES,
|
|
126
|
+
DIFF_STYLES,
|
|
127
|
+
RendererProtocol,
|
|
128
|
+
RichConsoleRenderer,
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
# =============================================================================
|
|
132
|
+
# New Structured Messaging API
|
|
133
|
+
# =============================================================================
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
# =============================================================================
|
|
137
|
+
# Export all public symbols
|
|
138
|
+
# =============================================================================
|
|
24
139
|
|
|
25
140
|
__all__ = [
|
|
141
|
+
# -------------------------------------------------------------------------
|
|
142
|
+
# Legacy API (backward compatible)
|
|
143
|
+
# -------------------------------------------------------------------------
|
|
144
|
+
# Message queue
|
|
26
145
|
"MessageQueue",
|
|
27
146
|
"MessageType",
|
|
28
147
|
"UIMessage",
|
|
29
148
|
"get_global_queue",
|
|
149
|
+
# Legacy emit functions
|
|
30
150
|
"emit_message",
|
|
31
151
|
"emit_info",
|
|
32
152
|
"emit_success",
|
|
@@ -42,9 +162,71 @@ __all__ = [
|
|
|
42
162
|
"emit_prompt",
|
|
43
163
|
"provide_prompt_response",
|
|
44
164
|
"get_buffered_startup_messages",
|
|
165
|
+
# Legacy renderers
|
|
45
166
|
"InteractiveRenderer",
|
|
46
|
-
"TUIRenderer",
|
|
47
167
|
"SynchronousInteractiveRenderer",
|
|
48
168
|
"QueueConsole",
|
|
49
169
|
"get_queue_console",
|
|
170
|
+
# -------------------------------------------------------------------------
|
|
171
|
+
# New Structured Messaging API
|
|
172
|
+
# -------------------------------------------------------------------------
|
|
173
|
+
# Enums
|
|
174
|
+
"MessageLevel",
|
|
175
|
+
"MessageCategory",
|
|
176
|
+
# Base classes
|
|
177
|
+
"BaseMessage",
|
|
178
|
+
"BaseCommand",
|
|
179
|
+
# Message types
|
|
180
|
+
"TextMessage",
|
|
181
|
+
"FileEntry",
|
|
182
|
+
"FileListingMessage",
|
|
183
|
+
"FileContentMessage",
|
|
184
|
+
"GrepMatch",
|
|
185
|
+
"GrepResultMessage",
|
|
186
|
+
"DiffLine",
|
|
187
|
+
"DiffMessage",
|
|
188
|
+
"ShellStartMessage",
|
|
189
|
+
"ShellLineMessage",
|
|
190
|
+
"ShellOutputMessage",
|
|
191
|
+
"emit_shell_line",
|
|
192
|
+
"AgentReasoningMessage",
|
|
193
|
+
"AgentResponseMessage",
|
|
194
|
+
"SubAgentInvocationMessage",
|
|
195
|
+
"SubAgentResponseMessage",
|
|
196
|
+
"UserInputRequest",
|
|
197
|
+
"ConfirmationRequest",
|
|
198
|
+
"SelectionRequest",
|
|
199
|
+
"SpinnerControl",
|
|
200
|
+
"DividerMessage",
|
|
201
|
+
"StatusPanelMessage",
|
|
202
|
+
"VersionCheckMessage",
|
|
203
|
+
"AnyMessage",
|
|
204
|
+
# Command types
|
|
205
|
+
"CancelAgentCommand",
|
|
206
|
+
"InterruptShellCommand",
|
|
207
|
+
"UserInputResponse",
|
|
208
|
+
"ConfirmationResponse",
|
|
209
|
+
"SelectionResponse",
|
|
210
|
+
"AnyCommand",
|
|
211
|
+
# Message bus
|
|
212
|
+
"MessageBus",
|
|
213
|
+
"get_message_bus",
|
|
214
|
+
"reset_message_bus",
|
|
215
|
+
# Session context
|
|
216
|
+
"set_session_context",
|
|
217
|
+
"get_session_context",
|
|
218
|
+
# New API convenience functions (prefixed to avoid collision)
|
|
219
|
+
"bus_emit",
|
|
220
|
+
"bus_emit_info",
|
|
221
|
+
"bus_emit_warning",
|
|
222
|
+
"bus_emit_error",
|
|
223
|
+
"bus_emit_success",
|
|
224
|
+
"bus_emit_debug",
|
|
225
|
+
# Renderer
|
|
226
|
+
"RendererProtocol",
|
|
227
|
+
"RichConsoleRenderer",
|
|
228
|
+
"DEFAULT_STYLES",
|
|
229
|
+
"DIFF_STYLES",
|
|
230
|
+
# Markdown patches
|
|
231
|
+
"patch_markdown_headings",
|
|
50
232
|
]
|