code-puppy 0.0.347__py3-none-any.whl → 0.0.349__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.
@@ -21,6 +21,7 @@ from code_puppy.config import (
21
21
  DATA_DIR,
22
22
  get_message_limit,
23
23
  get_use_dbos,
24
+ get_value,
24
25
  )
25
26
  from code_puppy.messaging import (
26
27
  SubAgentInvocationMessage,
@@ -471,39 +472,90 @@ def register_invoke_agent(agent):
471
472
  subagent_name = f"temp-invoke-agent-{session_id}"
472
473
  model_settings = make_model_settings(model_name)
473
474
 
474
- temp_agent = Agent(
475
- model=model,
476
- instructions=instructions,
477
- output_type=str,
478
- retries=3,
479
- history_processors=[agent_config.message_history_accumulator],
480
- model_settings=model_settings,
481
- )
475
+ # Get MCP servers for sub-agents (same as main agent)
476
+ from code_puppy.mcp_ import get_mcp_manager
482
477
 
483
- # Register the tools that the agent needs
484
- from code_puppy.tools import register_tools_for_agent
478
+ mcp_servers = []
479
+ mcp_disabled = get_value("disable_mcp_servers")
480
+ if not (
481
+ mcp_disabled and str(mcp_disabled).lower() in ("1", "true", "yes", "on")
482
+ ):
483
+ manager = get_mcp_manager()
484
+ mcp_servers = manager.get_servers_for_agent()
485
485
 
486
- agent_tools = agent_config.get_available_tools()
487
- register_tools_for_agent(temp_agent, agent_tools)
486
+ # Get the event_stream_handler for streaming output
487
+ from code_puppy.agents.event_stream_handler import event_stream_handler
488
488
 
489
489
  if get_use_dbos():
490
490
  from pydantic_ai.durable_exec.dbos import DBOSAgent
491
491
 
492
- dbos_agent = DBOSAgent(temp_agent, name=subagent_name)
492
+ # For DBOS, create agent without MCP servers (to avoid serialization issues)
493
+ # and add them at runtime
494
+ temp_agent = Agent(
495
+ model=model,
496
+ instructions=instructions,
497
+ output_type=str,
498
+ retries=3,
499
+ toolsets=[], # MCP servers added separately for DBOS
500
+ history_processors=[agent_config.message_history_accumulator],
501
+ model_settings=model_settings,
502
+ )
503
+
504
+ # Register the tools that the agent needs
505
+ from code_puppy.tools import register_tools_for_agent
506
+
507
+ agent_tools = agent_config.get_available_tools()
508
+ register_tools_for_agent(temp_agent, agent_tools)
509
+
510
+ # Wrap with DBOS - pass event_stream_handler for streaming output
511
+ dbos_agent = DBOSAgent(
512
+ temp_agent,
513
+ name=subagent_name,
514
+ event_stream_handler=event_stream_handler,
515
+ )
493
516
  temp_agent = dbos_agent
494
517
 
518
+ # Store MCP servers to add at runtime
519
+ subagent_mcp_servers = mcp_servers
520
+ else:
521
+ # Non-DBOS path - include MCP servers directly in the agent
522
+ temp_agent = Agent(
523
+ model=model,
524
+ instructions=instructions,
525
+ output_type=str,
526
+ retries=3,
527
+ toolsets=mcp_servers,
528
+ history_processors=[agent_config.message_history_accumulator],
529
+ model_settings=model_settings,
530
+ )
531
+
532
+ # Register the tools that the agent needs
533
+ from code_puppy.tools import register_tools_for_agent
534
+
535
+ agent_tools = agent_config.get_available_tools()
536
+ register_tools_for_agent(temp_agent, agent_tools)
537
+
538
+ subagent_mcp_servers = None
539
+
495
540
  # Run the temporary agent with the provided prompt as an asyncio task
496
541
  # Pass the message_history from the session to continue the conversation
497
542
  workflow_id = None # Track for potential cancellation
498
543
  if get_use_dbos():
499
544
  # Generate a unique workflow ID for DBOS - ensures no collisions in back-to-back calls
500
545
  workflow_id = _generate_dbos_workflow_id(group_id)
546
+
547
+ # Add MCP servers to the DBOS agent's toolsets
548
+ # (temp_agent is discarded after this invocation, so no need to restore)
549
+ if subagent_mcp_servers:
550
+ temp_agent._toolsets = temp_agent._toolsets + subagent_mcp_servers
551
+
501
552
  with SetWorkflowID(workflow_id):
502
553
  task = asyncio.create_task(
503
554
  temp_agent.run(
504
555
  prompt,
505
556
  message_history=message_history,
506
557
  usage_limits=UsageLimits(request_limit=get_message_limit()),
558
+ event_stream_handler=event_stream_handler,
507
559
  )
508
560
  )
509
561
  _active_subagent_tasks.add(task)
@@ -513,6 +565,7 @@ def register_invoke_agent(agent):
513
565
  prompt,
514
566
  message_history=message_history,
515
567
  usage_limits=UsageLimits(request_limit=get_message_limit()),
568
+ event_stream_handler=event_stream_handler,
516
569
  )
517
570
  )
518
571
  _active_subagent_tasks.add(task)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code-puppy
3
- Version: 0.0.347
3
+ Version: 0.0.349
4
4
  Summary: Code generation agent
5
5
  Project-URL: repository, https://github.com/mpfaffenberger/code_puppy
6
6
  Project-URL: HomePage, https://github.com/mpfaffenberger/code_puppy
@@ -35,7 +35,7 @@ Requires-Dist: rich>=13.4.2
35
35
  Requires-Dist: ripgrep==14.1.0
36
36
  Requires-Dist: ruff>=0.11.11
37
37
  Requires-Dist: tenacity>=8.2.0
38
- Requires-Dist: termflow-md>=0.1.6
38
+ Requires-Dist: termflow-md>=0.1.8
39
39
  Requires-Dist: uvicorn>=0.30.0
40
40
  Description-Content-Type: text/markdown
41
41
 
@@ -159,7 +159,7 @@ code_puppy/plugins/shell_safety/command_cache.py,sha256=adYtSPNVOZfW_6dQdtEihO6E
159
159
  code_puppy/plugins/shell_safety/register_callbacks.py,sha256=W3v664RR48Fdbbbltf_NnX22_Ahw2AvAOtvXvWc7KxQ,7322
160
160
  code_puppy/prompts/codex_system_prompt.md,sha256=hEFTCziroLqZmqNle5kG34A8kvTteOWezCiVrAEKhE0,24400
161
161
  code_puppy/tools/__init__.py,sha256=BVTZ85jLHgDANwOnUSOz3UDlp8VQDq4DoGF23BRlyWw,6032
162
- code_puppy/tools/agent_tools.py,sha256=snBI6FlFtR03CbYKXwu53R48c_fRSuDIwcNdVUruLcA,21020
162
+ code_puppy/tools/agent_tools.py,sha256=pRIzGH8jJjlg1XiMrQn_kn0OzUfsCq4EWTuISD2D6hQ,23393
163
163
  code_puppy/tools/command_runner.py,sha256=3qXVnVTaBPia6y2D29As47_TRKgpyCj82yMFK-8UUYc,44954
164
164
  code_puppy/tools/common.py,sha256=IYf-KOcP5eN2MwTlpULSXNATn7GzloAKl7_M1Uyfe4Y,40360
165
165
  code_puppy/tools/file_modifications.py,sha256=vz9n7R0AGDSdLUArZr_55yJLkyI30M8zreAppxIx02M,29380
@@ -175,10 +175,10 @@ code_puppy/tools/browser/browser_scripts.py,sha256=sNb8eLEyzhasy5hV4B9OjM8yIVMLV
175
175
  code_puppy/tools/browser/browser_workflows.py,sha256=nitW42vCf0ieTX1gLabozTugNQ8phtoFzZbiAhw1V90,6491
176
176
  code_puppy/tools/browser/camoufox_manager.py,sha256=RZjGOEftE5sI_tsercUyXFSZI2wpStXf-q0PdYh2G3I,8680
177
177
  code_puppy/tools/browser/vqa_agent.py,sha256=DBn9HKloILqJSTSdNZzH_PYWT0B2h9VwmY6akFQI_uU,2913
178
- code_puppy-0.0.347.data/data/code_puppy/models.json,sha256=FMQdE_yvP_8y0xxt3K918UkFL9cZMYAqW1SfXcQkU_k,3105
179
- code_puppy-0.0.347.data/data/code_puppy/models_dev_api.json,sha256=wHjkj-IM_fx1oHki6-GqtOoCrRMR0ScK0f-Iz0UEcy8,548187
180
- code_puppy-0.0.347.dist-info/METADATA,sha256=NoIXPPBnCAxJFAbT5QA7KxxPGor_fP_zQs2mvT5zAd8,27550
181
- code_puppy-0.0.347.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
182
- code_puppy-0.0.347.dist-info/entry_points.txt,sha256=Tp4eQC99WY3HOKd3sdvb22vZODRq0XkZVNpXOag_KdI,91
183
- code_puppy-0.0.347.dist-info/licenses/LICENSE,sha256=31u8x0SPgdOq3izJX41kgFazWsM43zPEF9eskzqbJMY,1075
184
- code_puppy-0.0.347.dist-info/RECORD,,
178
+ code_puppy-0.0.349.data/data/code_puppy/models.json,sha256=FMQdE_yvP_8y0xxt3K918UkFL9cZMYAqW1SfXcQkU_k,3105
179
+ code_puppy-0.0.349.data/data/code_puppy/models_dev_api.json,sha256=wHjkj-IM_fx1oHki6-GqtOoCrRMR0ScK0f-Iz0UEcy8,548187
180
+ code_puppy-0.0.349.dist-info/METADATA,sha256=Yd81chLCrLzPcY4EmuipfkCp9qUCwK0a95QXe7i5-68,27550
181
+ code_puppy-0.0.349.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
182
+ code_puppy-0.0.349.dist-info/entry_points.txt,sha256=Tp4eQC99WY3HOKd3sdvb22vZODRq0XkZVNpXOag_KdI,91
183
+ code_puppy-0.0.349.dist-info/licenses/LICENSE,sha256=31u8x0SPgdOq3izJX41kgFazWsM43zPEF9eskzqbJMY,1075
184
+ code_puppy-0.0.349.dist-info/RECORD,,