shotgun-sh 0.1.0.dev14__py3-none-any.whl → 0.1.0.dev15__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.

@@ -32,16 +32,23 @@ class AgentType(Enum):
32
32
  class MessageHistoryUpdated(Message):
33
33
  """Event posted when the message history is updated."""
34
34
 
35
- def __init__(self, messages: list[ModelMessage], agent_type: AgentType) -> None:
35
+ def __init__(
36
+ self,
37
+ messages: list[ModelMessage],
38
+ agent_type: AgentType,
39
+ file_operations: list[FileOperation] | None = None,
40
+ ) -> None:
36
41
  """Initialize the message history updated event.
37
42
 
38
43
  Args:
39
44
  messages: The updated message history.
40
45
  agent_type: The type of agent that triggered the update.
46
+ file_operations: List of file operations from this run.
41
47
  """
42
48
  super().__init__()
43
49
  self.messages = messages
44
50
  self.agent_type = agent_type
51
+ self.file_operations = file_operations or []
45
52
 
46
53
 
47
54
  class AgentManager(Widget):
@@ -192,18 +199,22 @@ class AgentManager(Widget):
192
199
  self.message_history = await apply_persistent_compaction(
193
200
  result.all_messages(), deps
194
201
  )
195
- self._post_messages_updated()
196
202
 
197
203
  # Log file operations summary if any files were modified
198
204
  self.recently_change_files = deps.file_tracker.operations.copy()
199
205
 
206
+ self._post_messages_updated(self.recently_change_files)
207
+
200
208
  return result
201
209
 
202
- def _post_messages_updated(self) -> None:
210
+ def _post_messages_updated(
211
+ self, file_operations: list[FileOperation] | None = None
212
+ ) -> None:
203
213
  # Post event to notify listeners of the message history update
204
214
  self.post_message(
205
215
  MessageHistoryUpdated(
206
216
  messages=self.ui_message_history.copy(),
207
217
  agent_type=self._current_agent_type,
218
+ file_operations=file_operations,
208
219
  )
209
220
  )
shotgun/agents/models.py CHANGED
@@ -1,5 +1,6 @@
1
1
  """Pydantic models for agent dependencies and configuration."""
2
2
 
3
+ import os
3
4
  from asyncio import Future, Queue
4
5
  from collections.abc import Callable
5
6
  from datetime import datetime
@@ -187,6 +188,25 @@ class FileOperationTracker(BaseModel):
187
188
 
188
189
  return "\n".join(lines)
189
190
 
191
+ def get_display_path(self) -> str | None:
192
+ """Get a single file path or common parent directory for display.
193
+
194
+ Returns:
195
+ Path string to display, or None if no files were modified
196
+ """
197
+ if not self.operations:
198
+ return None
199
+
200
+ unique_paths = list({op.file_path for op in self.operations})
201
+
202
+ if len(unique_paths) == 1:
203
+ # Single file - return its path
204
+ return unique_paths[0]
205
+
206
+ # Multiple files - find common parent directory
207
+ common_path = os.path.commonpath(unique_paths)
208
+ return common_path
209
+
190
210
 
191
211
  class AgentDeps(AgentRuntimeOptions):
192
212
  """Dependencies passed to all agents for configuration and runtime behavior."""
@@ -23,7 +23,12 @@ from textual.widgets import Markdown
23
23
 
24
24
  from shotgun.agents.agent_manager import AgentManager, AgentType, MessageHistoryUpdated
25
25
  from shotgun.agents.config import get_provider_model
26
- from shotgun.agents.models import AgentDeps, UserAnswer, UserQuestion
26
+ from shotgun.agents.models import (
27
+ AgentDeps,
28
+ FileOperationTracker,
29
+ UserAnswer,
30
+ UserQuestion,
31
+ )
27
32
  from shotgun.sdk.services import get_artifact_service, get_codebase_service
28
33
 
29
34
  from ..components.prompt_input import PromptInput
@@ -412,6 +417,38 @@ class ChatScreen(Screen[None]):
412
417
  """Handle message history updates from the agent manager."""
413
418
  self.messages = event.messages
414
419
 
420
+ # If there are file operations, add a message showing the modified files
421
+ if event.file_operations:
422
+ chat_history = self.query_one(ChatHistory)
423
+ if chat_history.vertical_tail:
424
+ tracker = FileOperationTracker(operations=event.file_operations)
425
+ display_path = tracker.get_display_path()
426
+
427
+ if display_path:
428
+ # Create a simple markdown message with the file path
429
+ # The terminal emulator will make this clickable automatically
430
+ from pathlib import Path
431
+
432
+ path_obj = Path(display_path)
433
+
434
+ if len(event.file_operations) == 1:
435
+ message = f"📝 Modified: `{display_path}`"
436
+ else:
437
+ num_files = len({op.file_path for op in event.file_operations})
438
+ if path_obj.is_dir():
439
+ message = (
440
+ f"📁 Modified {num_files} files in: `{display_path}`"
441
+ )
442
+ else:
443
+ # Common path is a file, show parent directory
444
+ message = (
445
+ f"📁 Modified {num_files} files in: `{path_obj.parent}`"
446
+ )
447
+
448
+ # Add this as a simple markdown widget
449
+ file_info_widget = Markdown(message)
450
+ chat_history.vertical_tail.mount(file_info_widget)
451
+
415
452
  @on(PromptInput.Submitted)
416
453
  async def handle_submit(self, message: PromptInput.Submitted) -> None:
417
454
  self.history.append(message.text)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shotgun-sh
3
- Version: 0.1.0.dev14
3
+ Version: 0.1.0.dev15
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,10 +7,10 @@ shotgun/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  shotgun/sentry_telemetry.py,sha256=3r9on0GQposn9aX6Dkb9mrfaVQl_dIZzhu9BjE838AU,2854
8
8
  shotgun/telemetry.py,sha256=aBwCRFU97oiIK5K13OhT7yYCQUAVQyrvnoG-aX3k2ZE,3109
9
9
  shotgun/agents/__init__.py,sha256=8Jzv1YsDuLyNPFJyckSr_qI4ehTVeDyIMDW4omsfPGc,25
10
- shotgun/agents/agent_manager.py,sha256=aTBqSbrAMfy_oCLw80nOoygStRaZSLBi7qD_4nzUT34,7008
10
+ shotgun/agents/agent_manager.py,sha256=5jSHlDHO4gZjry9z_9RBuf_Rh_7Uz2sYSyAbQ9s9Tdo,7362
11
11
  shotgun/agents/artifact_state.py,sha256=WkspYQe-9CvBS90PapBsX997yvJ5KWH-qtSXIWmfvp0,2121
12
12
  shotgun/agents/common.py,sha256=my-Y7VNNpDDYxDJ4hlRmTs7lIS8tBKFvR9ew7uKxcPE,11369
13
- shotgun/agents/models.py,sha256=I3Mv8nmLUgbdF-I9BvsgZtVEVfD5hPgDs1mc8AlM9Fs,6515
13
+ shotgun/agents/models.py,sha256=6edILmN7caDAmf8x-qgl7lA42tl2b-ZsiC3da8tS3Xw,7127
14
14
  shotgun/agents/plan.py,sha256=mn0S4r-uXWjerMTzfJLJo7n0pweNp_v8TI53wOxMdZ4,2984
15
15
  shotgun/agents/research.py,sha256=tee5gHT0d1Iupr5MI9ogNTh35xqh0j2N71rmb4dUtG0,3224
16
16
  shotgun/agents/specify.py,sha256=E9hYxTTVEOkpym-D-q74FI3L_mwllY6QOu8C3U6SEww,3088
@@ -122,7 +122,7 @@ shotgun/tui/components/prompt_input.py,sha256=Ss-htqraHZAPaehGE4x86ij0veMjc4Ugad
122
122
  shotgun/tui/components/spinner.py,sha256=ovTDeaJ6FD6chZx_Aepia6R3UkPOVJ77EKHfRmn39MY,2427
123
123
  shotgun/tui/components/splash.py,sha256=vppy9vEIEvywuUKRXn2y11HwXSRkQZHLYoVjhDVdJeU,1267
124
124
  shotgun/tui/components/vertical_tail.py,sha256=kkCH0WjAh54jDvRzIaOffRZXUKn_zHFZ_ichfUpgzaE,1071
125
- shotgun/tui/screens/chat.py,sha256=4Vq0_BNFTgyVyBvMUuHY9wOjT27uQN-rIbf2depgtVM,15620
125
+ shotgun/tui/screens/chat.py,sha256=Fh-D0l3OV0w_Zdeo0DOiEbDYCSpDOUSRmcEpAabc_Rs,17201
126
126
  shotgun/tui/screens/chat.tcss,sha256=MV7-HhXSpBxIsSbB57RugNeM0wOpqMpIVke7qCf4-yQ,312
127
127
  shotgun/tui/screens/directory_setup.py,sha256=lIZ1J4A6g5Q2ZBX8epW7BhR96Dmdcg22CyiM5S-I5WU,3237
128
128
  shotgun/tui/screens/provider_config.py,sha256=A_tvDHF5KLP5PV60LjMJ_aoOdT3TjI6_g04UIUqGPqM,7126
@@ -131,8 +131,8 @@ shotgun/utils/__init__.py,sha256=WinIEp9oL2iMrWaDkXz2QX4nYVPAm8C9aBSKTeEwLtE,198
131
131
  shotgun/utils/env_utils.py,sha256=8QK5aw_f_V2AVTleQQlcL0RnD4sPJWXlDG46fsHu0d8,1057
132
132
  shotgun/utils/file_system_utils.py,sha256=l-0p1bEHF34OU19MahnRFdClHufThfGAjQ431teAIp0,1004
133
133
  shotgun/utils/update_checker.py,sha256=Xf-7w3Pos3etzCoT771gJe2HLkA8_V2GrqWy7ni9UqA,11373
134
- shotgun_sh-0.1.0.dev14.dist-info/METADATA,sha256=PeZXTSdfZOzPV3pgQXw5zwykwo6_ya3tzMR07V2sP_M,11271
135
- shotgun_sh-0.1.0.dev14.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
136
- shotgun_sh-0.1.0.dev14.dist-info/entry_points.txt,sha256=asZxLU4QILneq0MWW10saVCZc4VWhZfb0wFZvERnzfA,45
137
- shotgun_sh-0.1.0.dev14.dist-info/licenses/LICENSE,sha256=YebsZl590zCHrF_acCU5pmNt0pnAfD2DmAnevJPB1tY,1065
138
- shotgun_sh-0.1.0.dev14.dist-info/RECORD,,
134
+ shotgun_sh-0.1.0.dev15.dist-info/METADATA,sha256=VpKsQmeuor8Mc27fgdeVfKU4xtMNpQNx9AAfwVcyEC4,11271
135
+ shotgun_sh-0.1.0.dev15.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
136
+ shotgun_sh-0.1.0.dev15.dist-info/entry_points.txt,sha256=asZxLU4QILneq0MWW10saVCZc4VWhZfb0wFZvERnzfA,45
137
+ shotgun_sh-0.1.0.dev15.dist-info/licenses/LICENSE,sha256=YebsZl590zCHrF_acCU5pmNt0pnAfD2DmAnevJPB1tY,1065
138
+ shotgun_sh-0.1.0.dev15.dist-info/RECORD,,