shotgun-sh 0.1.13.dev1__py3-none-any.whl → 0.1.14.dev1__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.

Potentially problematic release.


This version of shotgun-sh might be problematic. Click here for more details.

@@ -31,7 +31,6 @@ from pydantic_ai.messages import (
31
31
  SystemPromptPart,
32
32
  ToolCallPart,
33
33
  ToolCallPartDelta,
34
- ToolReturnPart,
35
34
  )
36
35
  from textual.message import Message
37
36
  from textual.widget import Widget
@@ -273,8 +272,15 @@ class AgentManager(Widget):
273
272
  # Use merged deps (shared state + agent-specific system prompt) if not provided
274
273
  if deps is None:
275
274
  deps = self._create_merged_deps(self._current_agent_type)
276
- if not deferred_tool_results:
277
- self.ensure_agent_canecelled_safely()
275
+ ask_user_part = self.get_unanswered_ask_user_part()
276
+ if ask_user_part and prompt:
277
+ if not deferred_tool_results:
278
+ deferred_tool_results = DeferredToolResults()
279
+ deferred_tool_results.calls[ask_user_part.tool_call_id] = UserAnswer(
280
+ answer=prompt,
281
+ tool_call_id=ask_user_part.tool_call_id,
282
+ )
283
+ prompt = None
278
284
 
279
285
  # Ensure deps is not None
280
286
  if deps is None:
@@ -677,31 +683,21 @@ class AgentManager(Widget):
677
683
  self.ui_message_history.append(message)
678
684
  self._post_messages_updated()
679
685
 
680
- def ensure_agent_canecelled_safely(self) -> None:
686
+ def get_unanswered_ask_user_part(self) -> ToolCallPart | None:
681
687
  if not self.message_history:
682
- return
688
+ return None
683
689
  self.last_response = self.message_history[-1]
684
690
  ## we're searching for unanswered ask_user parts
685
- found_tool = None
686
- for part in self.message_history[-1].parts:
687
- if isinstance(part, ToolCallPart) and part.tool_name == "ask_user":
688
- found_tool = part
689
- break
690
- if not found_tool:
691
- return
692
- tool_result = ModelRequest(
693
- parts=[
694
- ToolReturnPart(
695
- tool_call_id=found_tool.tool_call_id,
696
- tool_name=found_tool.tool_name,
697
- content=UserAnswer(
698
- answer="⚠️ Operation cancelled by user",
699
- tool_call_id=found_tool.tool_call_id,
700
- ),
701
- )
702
- ]
691
+ found_tool = next(
692
+ (
693
+ part
694
+ for part in self.message_history[-1].parts
695
+ if isinstance(part, ToolCallPart) and part.tool_name == "ask_user"
696
+ ),
697
+ None,
703
698
  )
704
- self.message_history.append(tool_result)
699
+
700
+ return found_tool
705
701
 
706
702
 
707
703
  # Re-export AgentType for backward compatibility
@@ -4,7 +4,7 @@ from dataclasses import dataclass
4
4
  from pathlib import Path
5
5
  from typing import cast
6
6
 
7
- from pydantic_ai import DeferredToolResults, RunContext
7
+ from pydantic_ai import RunContext
8
8
  from pydantic_ai.messages import (
9
9
  ModelMessage,
10
10
  ModelRequest,
@@ -37,7 +37,6 @@ from shotgun.agents.models import (
37
37
  AgentDeps,
38
38
  AgentType,
39
39
  FileOperationTracker,
40
- UserAnswer,
41
40
  UserQuestion,
42
41
  )
43
42
  from shotgun.codebase.core.manager import CodebaseAlreadyIndexedError
@@ -712,7 +711,6 @@ class ChatScreen(Screen[None]):
712
711
 
713
712
  @work
714
713
  async def run_agent(self, message: str) -> None:
715
- deferred_tool_results = None
716
714
  prompt = None
717
715
  self.working = True
718
716
 
@@ -721,32 +719,15 @@ class ChatScreen(Screen[None]):
721
719
 
722
720
  self._current_worker = get_current_worker()
723
721
 
724
- if self.question:
725
- # This is a response to a question from the agent
726
- self.question.result.set_result(
727
- UserAnswer(answer=message, tool_call_id=self.question.tool_call_id)
728
- )
729
-
730
- deferred_tool_results = DeferredToolResults()
731
-
732
- deferred_tool_results.calls[self.question.tool_call_id] = UserAnswer(
733
- answer=message, tool_call_id=self.question.tool_call_id
734
- )
735
-
736
- self.question = None
737
- else:
738
- # This is a new user prompt
739
- prompt = message
722
+ prompt = message
740
723
 
741
724
  try:
742
725
  await self.agent_manager.run(
743
726
  prompt=prompt,
744
- deferred_tool_results=deferred_tool_results,
745
727
  )
746
728
  except asyncio.CancelledError:
747
729
  # Handle cancellation gracefully - DO NOT re-raise
748
730
  self.mount_hint("⚠️ Operation cancelled by user")
749
- self.agent_manager.ensure_agent_canecelled_safely()
750
731
  finally:
751
732
  self.working = False
752
733
  self._current_worker = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shotgun-sh
3
- Version: 0.1.13.dev1
3
+ Version: 0.1.14.dev1
4
4
  Summary: AI-powered research, planning, and task management CLI tool
5
5
  Project-URL: Homepage, https://shotgun.sh/
6
6
  Project-URL: Repository, https://github.com/shotgun-sh/shotgun
@@ -7,7 +7,7 @@ shotgun/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  shotgun/sentry_telemetry.py,sha256=L7jFMNAnDIENWVeQYSLpyul2nmIm2w3wnOp2kDP_cic,2902
8
8
  shotgun/telemetry.py,sha256=Ves6Ih3hshpKVNVAUUmwRdtW8NkTjFPg8hEqvFKZ0t0,3208
9
9
  shotgun/agents/__init__.py,sha256=8Jzv1YsDuLyNPFJyckSr_qI4ehTVeDyIMDW4omsfPGc,25
10
- shotgun/agents/agent_manager.py,sha256=hmJlcOX98vLn5hYuzjC_cDGpDc89DMjCpQupK-Gq2WU,26393
10
+ shotgun/agents/agent_manager.py,sha256=wXUQCEsSs68FG8edFLryeePBzxxX1GStJZwd1sS5WsE,26245
11
11
  shotgun/agents/common.py,sha256=vt7ECq1rT6GR5Rt63t0whH0R0cydrk7Mty2KyPL8mEg,19045
12
12
  shotgun/agents/conversation_history.py,sha256=5J8_1yxdZiiWTq22aDio88DkBDZ4_Lh_p5Iy5_ENszc,3898
13
13
  shotgun/agents/conversation_manager.py,sha256=fxAvXbEl3Cl2ugJ4N9aWXaqZtkrnfj3QzwjWC4LFXwI,3514
@@ -110,7 +110,7 @@ shotgun/tui/components/prompt_input.py,sha256=Ss-htqraHZAPaehGE4x86ij0veMjc4Ugad
110
110
  shotgun/tui/components/spinner.py,sha256=ovTDeaJ6FD6chZx_Aepia6R3UkPOVJ77EKHfRmn39MY,2427
111
111
  shotgun/tui/components/splash.py,sha256=vppy9vEIEvywuUKRXn2y11HwXSRkQZHLYoVjhDVdJeU,1267
112
112
  shotgun/tui/components/vertical_tail.py,sha256=kROwTaRjUwVB7H35dtmNcUVPQqNYvvfq7K2tXBKEb6c,638
113
- shotgun/tui/screens/chat.py,sha256=1XpiST6yIiFFGDN8VEQis9m4dWPvPdl7Bk_7avSsGUg,30928
113
+ shotgun/tui/screens/chat.py,sha256=HIDnqt8og2KMmtdOok1lL44130M8V7IP6Un_8HcRwsA,30178
114
114
  shotgun/tui/screens/chat.tcss,sha256=2Yq3E23jxsySYsgZf4G1AYrYVcpX0UDW6kNNI0tDmtM,437
115
115
  shotgun/tui/screens/directory_setup.py,sha256=lIZ1J4A6g5Q2ZBX8epW7BhR96Dmdcg22CyiM5S-I5WU,3237
116
116
  shotgun/tui/screens/provider_config.py,sha256=A_tvDHF5KLP5PV60LjMJ_aoOdT3TjI6_g04UIUqGPqM,7126
@@ -126,8 +126,8 @@ shotgun/utils/env_utils.py,sha256=8QK5aw_f_V2AVTleQQlcL0RnD4sPJWXlDG46fsHu0d8,10
126
126
  shotgun/utils/file_system_utils.py,sha256=l-0p1bEHF34OU19MahnRFdClHufThfGAjQ431teAIp0,1004
127
127
  shotgun/utils/source_detection.py,sha256=Co6Q03R3fT771TF3RzB-70stfjNP2S4F_ArZKibwzm8,454
128
128
  shotgun/utils/update_checker.py,sha256=IgzPHRhS1ETH7PnJR_dIx6lxgr1qHpCkMTgzUxvGjhI,7586
129
- shotgun_sh-0.1.13.dev1.dist-info/METADATA,sha256=ghoaqJH6WWZee1-qvat2Ac1RV9Ky6zvQkxJffBLvf_A,11197
130
- shotgun_sh-0.1.13.dev1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
131
- shotgun_sh-0.1.13.dev1.dist-info/entry_points.txt,sha256=asZxLU4QILneq0MWW10saVCZc4VWhZfb0wFZvERnzfA,45
132
- shotgun_sh-0.1.13.dev1.dist-info/licenses/LICENSE,sha256=YebsZl590zCHrF_acCU5pmNt0pnAfD2DmAnevJPB1tY,1065
133
- shotgun_sh-0.1.13.dev1.dist-info/RECORD,,
129
+ shotgun_sh-0.1.14.dev1.dist-info/METADATA,sha256=3x81Mpn8f-zmc9tH8P_FVniZ7GqGV_SeH4nbDPqRIcU,11197
130
+ shotgun_sh-0.1.14.dev1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
131
+ shotgun_sh-0.1.14.dev1.dist-info/entry_points.txt,sha256=asZxLU4QILneq0MWW10saVCZc4VWhZfb0wFZvERnzfA,45
132
+ shotgun_sh-0.1.14.dev1.dist-info/licenses/LICENSE,sha256=YebsZl590zCHrF_acCU5pmNt0pnAfD2DmAnevJPB1tY,1065
133
+ shotgun_sh-0.1.14.dev1.dist-info/RECORD,,