shotgun-sh 0.2.8.dev2__py3-none-any.whl → 0.2.8.dev4__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.

@@ -40,6 +40,7 @@ from pydantic_ai.messages import (
40
40
  SystemPromptPart,
41
41
  ToolCallPart,
42
42
  ToolCallPartDelta,
43
+ UserPromptPart,
43
44
  )
44
45
  from textual.message import Message
45
46
  from textual.widget import Widget
@@ -382,19 +383,11 @@ class AgentManager(Widget):
382
383
  # Clear file tracker before each run to track only this run's operations
383
384
  deps.file_tracker.clear()
384
385
 
385
- # Add user prompt if present (will be shown immediately via post_messages_updated)
386
- if prompt:
387
- user_request = ModelRequest.user_text_prompt(prompt)
388
- self.ui_message_history.append(user_request)
386
+ # Don't manually add the user prompt - Pydantic AI will include it in result.new_messages()
387
+ # This prevents duplicates and confusion with incremental mounting
389
388
 
390
- # Always post update before run to show user message (or current state if no prompt)
391
- self._post_messages_updated()
392
-
393
- # Save history WITHOUT the just-added prompt to avoid duplicates
394
- # (result.new_messages() will include the prompt)
395
- original_messages = (
396
- self.ui_message_history[:-1] if prompt else self.ui_message_history.copy()
397
- )
389
+ # Save current message history before the run
390
+ original_messages = self.ui_message_history.copy()
398
391
 
399
392
  # Start with persistent message history
400
393
  message_history = self.message_history
@@ -562,11 +555,35 @@ class AgentManager(Widget):
562
555
  },
563
556
  )
564
557
 
565
- # Always add the agent's response messages to maintain conversation history
566
- self.ui_message_history = original_messages + cast(
558
+ # Merge agent's response messages, avoiding duplicates
559
+ # The TUI may have already added the user prompt, so check for it
560
+ new_messages = cast(
567
561
  list[ModelRequest | ModelResponse | HintMessage], result.new_messages()
568
562
  )
569
563
 
564
+ # Deduplicate: skip user prompts that are already in original_messages
565
+ deduplicated_new_messages = []
566
+ for msg in new_messages:
567
+ # Check if this is a user prompt that's already in original_messages
568
+ if isinstance(msg, ModelRequest) and any(
569
+ isinstance(part, UserPromptPart) for part in msg.parts
570
+ ):
571
+ # Check if an identical user prompt is already in original_messages
572
+ already_exists = any(
573
+ isinstance(existing, ModelRequest)
574
+ and any(isinstance(p, UserPromptPart) for p in existing.parts)
575
+ and existing.parts == msg.parts
576
+ for existing in original_messages[
577
+ -5:
578
+ ] # Check last 5 messages for efficiency
579
+ )
580
+ if already_exists:
581
+ continue # Skip this duplicate user prompt
582
+
583
+ deduplicated_new_messages.append(msg)
584
+
585
+ self.ui_message_history = original_messages + deduplicated_new_messages
586
+
570
587
  # Get file operations early so we can use them for contextual messages
571
588
  file_operations = deps.file_tracker.operations.copy()
572
589
  self.recently_change_files = file_operations
@@ -690,6 +690,12 @@ class ChatScreen(Screen[None]):
690
690
  # Not a command, process as normal
691
691
  self.history.append(message.text)
692
692
 
693
+ # Add user message to agent_manager's history BEFORE running the agent
694
+ # This ensures immediate visual feedback AND proper deduplication
695
+ user_message = ModelRequest.user_text_prompt(text)
696
+ self.agent_manager.ui_message_history.append(user_message)
697
+ self.messages = self.agent_manager.ui_message_history.copy()
698
+
693
699
  # Clear the input
694
700
  self.value = ""
695
701
  self.run_agent(text) # Use stripped text
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shotgun-sh
3
- Version: 0.2.8.dev2
3
+ Version: 0.2.8.dev4
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
@@ -8,7 +8,7 @@ shotgun/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  shotgun/sentry_telemetry.py,sha256=VD8es-tREfgtRKhDsEVvqpo0_kM_ab6iVm2lkOEmTlI,2950
9
9
  shotgun/telemetry.py,sha256=C8dM7Feo1OxJMwDvgAMaA2RyRDO2rYPvC_8kLBuRUS8,3683
10
10
  shotgun/agents/__init__.py,sha256=8Jzv1YsDuLyNPFJyckSr_qI4ehTVeDyIMDW4omsfPGc,25
11
- shotgun/agents/agent_manager.py,sha256=cdrw96weXEkqaLGgmIPgnA48iMR1fYBLu_05p1eMHtQ,39851
11
+ shotgun/agents/agent_manager.py,sha256=0dIdYUNb8Vp3xcik0_FYKUwYxibpyT65oPQ5kwPmV_g,40638
12
12
  shotgun/agents/common.py,sha256=0F_dwEc72APvbY1b-lqM9VgPYuY1GpfhjSWv5-1pCB0,19032
13
13
  shotgun/agents/conversation_history.py,sha256=c-1PBaG9FXPfSmekWtrD6s6YVT0sd98DdDhzS4a1Hyo,7859
14
14
  shotgun/agents/conversation_manager.py,sha256=X3DWZZIqrv0hS1SUasyoxexnLPBUrZMBg4ZmRAipkBE,4429
@@ -127,7 +127,7 @@ shotgun/tui/components/prompt_input.py,sha256=Ss-htqraHZAPaehGE4x86ij0veMjc4Ugad
127
127
  shotgun/tui/components/spinner.py,sha256=ovTDeaJ6FD6chZx_Aepia6R3UkPOVJ77EKHfRmn39MY,2427
128
128
  shotgun/tui/components/splash.py,sha256=vppy9vEIEvywuUKRXn2y11HwXSRkQZHLYoVjhDVdJeU,1267
129
129
  shotgun/tui/components/vertical_tail.py,sha256=kROwTaRjUwVB7H35dtmNcUVPQqNYvvfq7K2tXBKEb6c,638
130
- shotgun/tui/screens/chat.py,sha256=VAsgX7YiXTXAH7pAwcWaWr2hGu_Ft0i8VpoUETTPsTM,37424
130
+ shotgun/tui/screens/chat.py,sha256=v3MR0RoQOUeZ0e3W-sxBXM7eANq7ve7zCM-tkv386JA,37773
131
131
  shotgun/tui/screens/chat.tcss,sha256=2Yq3E23jxsySYsgZf4G1AYrYVcpX0UDW6kNNI0tDmtM,437
132
132
  shotgun/tui/screens/directory_setup.py,sha256=lIZ1J4A6g5Q2ZBX8epW7BhR96Dmdcg22CyiM5S-I5WU,3237
133
133
  shotgun/tui/screens/feedback.py,sha256=VxpW0PVxMp22ZvSfQkTtgixNrpEOlfWtekjqlVfYEjA,5708
@@ -148,8 +148,8 @@ shotgun/utils/env_utils.py,sha256=ulM3BRi9ZhS7uC-zorGeDQm4SHvsyFuuU9BtVPqdrHY,14
148
148
  shotgun/utils/file_system_utils.py,sha256=l-0p1bEHF34OU19MahnRFdClHufThfGAjQ431teAIp0,1004
149
149
  shotgun/utils/source_detection.py,sha256=Co6Q03R3fT771TF3RzB-70stfjNP2S4F_ArZKibwzm8,454
150
150
  shotgun/utils/update_checker.py,sha256=IgzPHRhS1ETH7PnJR_dIx6lxgr1qHpCkMTgzUxvGjhI,7586
151
- shotgun_sh-0.2.8.dev2.dist-info/METADATA,sha256=8nSxwROnGNuQxNUY8bovpYeFSCwHhnLLx4geGZZVaKo,4299
152
- shotgun_sh-0.2.8.dev2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
153
- shotgun_sh-0.2.8.dev2.dist-info/entry_points.txt,sha256=asZxLU4QILneq0MWW10saVCZc4VWhZfb0wFZvERnzfA,45
154
- shotgun_sh-0.2.8.dev2.dist-info/licenses/LICENSE,sha256=YebsZl590zCHrF_acCU5pmNt0pnAfD2DmAnevJPB1tY,1065
155
- shotgun_sh-0.2.8.dev2.dist-info/RECORD,,
151
+ shotgun_sh-0.2.8.dev4.dist-info/METADATA,sha256=v-t-QSlw3TNyHCqVXVaBmw8QeZFUzPgzn9RUYg7P_IE,4299
152
+ shotgun_sh-0.2.8.dev4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
153
+ shotgun_sh-0.2.8.dev4.dist-info/entry_points.txt,sha256=asZxLU4QILneq0MWW10saVCZc4VWhZfb0wFZvERnzfA,45
154
+ shotgun_sh-0.2.8.dev4.dist-info/licenses/LICENSE,sha256=YebsZl590zCHrF_acCU5pmNt0pnAfD2DmAnevJPB1tY,1065
155
+ shotgun_sh-0.2.8.dev4.dist-info/RECORD,,