shotgun-sh 0.1.13__py3-none-any.whl → 0.1.14__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.
- shotgun/agents/agent_manager.py +20 -24
- shotgun/codebase/core/manager.py +11 -21
- shotgun/tui/screens/chat.py +2 -21
- {shotgun_sh-0.1.13.dist-info → shotgun_sh-0.1.14.dist-info}/METADATA +1 -1
- {shotgun_sh-0.1.13.dist-info → shotgun_sh-0.1.14.dist-info}/RECORD +8 -8
- {shotgun_sh-0.1.13.dist-info → shotgun_sh-0.1.14.dist-info}/WHEEL +0 -0
- {shotgun_sh-0.1.13.dist-info → shotgun_sh-0.1.14.dist-info}/entry_points.txt +0 -0
- {shotgun_sh-0.1.13.dist-info → shotgun_sh-0.1.14.dist-info}/licenses/LICENSE +0 -0
shotgun/agents/agent_manager.py
CHANGED
|
@@ -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
|
-
|
|
277
|
-
|
|
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
|
|
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 =
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
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
|
-
|
|
699
|
+
|
|
700
|
+
return found_tool
|
|
705
701
|
|
|
706
702
|
|
|
707
703
|
# Re-export AgentType for backward compatibility
|
shotgun/codebase/core/manager.py
CHANGED
|
@@ -1221,26 +1221,11 @@ class CodebaseGraphManager:
|
|
|
1221
1221
|
|
|
1222
1222
|
removed_graphs = []
|
|
1223
1223
|
|
|
1224
|
-
# Find all .kuzu
|
|
1224
|
+
# Find all .kuzu databases (files in v0.11.2, directories in newer versions)
|
|
1225
1225
|
for path in self.storage_dir.glob("*.kuzu"):
|
|
1226
1226
|
graph_id = path.stem
|
|
1227
1227
|
|
|
1228
|
-
#
|
|
1229
|
-
# Valid Kuzu databases are always directories
|
|
1230
|
-
if path.is_file():
|
|
1231
|
-
logger.warning(
|
|
1232
|
-
f"Detected corrupted database file (should be directory) at {path}, removing it"
|
|
1233
|
-
)
|
|
1234
|
-
try:
|
|
1235
|
-
await anyio.to_thread.run_sync(path.unlink)
|
|
1236
|
-
removed_graphs.append(graph_id)
|
|
1237
|
-
logger.info(f"Removed corrupted database file: {graph_id}")
|
|
1238
|
-
except Exception as e:
|
|
1239
|
-
logger.error(
|
|
1240
|
-
f"Failed to remove corrupted database file {graph_id}: {e}"
|
|
1241
|
-
)
|
|
1242
|
-
continue
|
|
1243
|
-
|
|
1228
|
+
# Try to open and validate the database
|
|
1244
1229
|
try:
|
|
1245
1230
|
# Try to open the database with a timeout to prevent hanging
|
|
1246
1231
|
async def try_open_database(
|
|
@@ -1346,7 +1331,7 @@ class CodebaseGraphManager:
|
|
|
1346
1331
|
"""
|
|
1347
1332
|
graphs = []
|
|
1348
1333
|
|
|
1349
|
-
# Find all .kuzu files
|
|
1334
|
+
# Find all .kuzu database files (Kuzu v0.11.2 creates files, not directories)
|
|
1350
1335
|
for path in self.storage_dir.glob("*.kuzu"):
|
|
1351
1336
|
if path.is_file():
|
|
1352
1337
|
graph_id = path.stem
|
|
@@ -1439,6 +1424,8 @@ class CodebaseGraphManager:
|
|
|
1439
1424
|
Args:
|
|
1440
1425
|
graph_id: Graph to delete
|
|
1441
1426
|
"""
|
|
1427
|
+
import shutil
|
|
1428
|
+
|
|
1442
1429
|
# Stop watcher if running
|
|
1443
1430
|
if graph_id in self._watchers:
|
|
1444
1431
|
await self.stop_watcher(graph_id)
|
|
@@ -1453,11 +1440,14 @@ class CodebaseGraphManager:
|
|
|
1453
1440
|
self._databases[graph_id].close()
|
|
1454
1441
|
del self._databases[graph_id]
|
|
1455
1442
|
|
|
1456
|
-
# Delete files
|
|
1443
|
+
# Delete database (files in v0.11.2, directories in newer versions)
|
|
1457
1444
|
graph_path = self.storage_dir / f"{graph_id}.kuzu"
|
|
1458
1445
|
if graph_path.exists():
|
|
1459
|
-
|
|
1460
|
-
|
|
1446
|
+
if graph_path.is_dir():
|
|
1447
|
+
await anyio.to_thread.run_sync(shutil.rmtree, graph_path)
|
|
1448
|
+
else:
|
|
1449
|
+
# File-based database (Kuzu v0.11.2)
|
|
1450
|
+
await anyio.to_thread.run_sync(graph_path.unlink)
|
|
1461
1451
|
|
|
1462
1452
|
# Also delete the WAL file if it exists
|
|
1463
1453
|
wal_path = self.storage_dir / f"{graph_id}.kuzu.wal"
|
shotgun/tui/screens/chat.py
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
|
@@ -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=
|
|
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
|
|
@@ -69,7 +69,7 @@ shotgun/codebase/core/code_retrieval.py,sha256=_JVyyQKHDFm3dxOOua1mw9eIIOHIVz3-I
|
|
|
69
69
|
shotgun/codebase/core/cypher_models.py,sha256=Yfysfa9lLguILftkmtuJCN3kLBFIo7WW7NigM-Zr-W4,1735
|
|
70
70
|
shotgun/codebase/core/ingestor.py,sha256=yh6BEIuUUfXU3dVpP0Llk19SrxA-uo3pdGnfcQsDsSo,63368
|
|
71
71
|
shotgun/codebase/core/language_config.py,sha256=vsqHyuFnumRPRBV1lMOxWKNOIiClO6FyfKQR0fGrtl4,8934
|
|
72
|
-
shotgun/codebase/core/manager.py,sha256=
|
|
72
|
+
shotgun/codebase/core/manager.py,sha256=USGLBdDUoFtq6fMFWRtUu2HBC_FI8d6lWcAV4l6fcvk,66000
|
|
73
73
|
shotgun/codebase/core/nl_query.py,sha256=kPoSJXBlm5rLhzOofZhqPVMJ_Lj3rV2H6sld6BwtMdg,16115
|
|
74
74
|
shotgun/codebase/core/parser_loader.py,sha256=LZRrDS8Sp518jIu3tQW-BxdwJ86lnsTteI478ER9Td8,4278
|
|
75
75
|
shotgun/prompts/__init__.py,sha256=RswUm0HMdfm2m2YKUwUsEdRIwoczdbI7zlucoEvHYRo,132
|
|
@@ -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=
|
|
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.
|
|
130
|
-
shotgun_sh-0.1.
|
|
131
|
-
shotgun_sh-0.1.
|
|
132
|
-
shotgun_sh-0.1.
|
|
133
|
-
shotgun_sh-0.1.
|
|
129
|
+
shotgun_sh-0.1.14.dist-info/METADATA,sha256=r3-C5lO7UudGSk7J0yO7SKvEBn5GW3Rm9_gKhfmkcn4,11192
|
|
130
|
+
shotgun_sh-0.1.14.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
131
|
+
shotgun_sh-0.1.14.dist-info/entry_points.txt,sha256=asZxLU4QILneq0MWW10saVCZc4VWhZfb0wFZvERnzfA,45
|
|
132
|
+
shotgun_sh-0.1.14.dist-info/licenses/LICENSE,sha256=YebsZl590zCHrF_acCU5pmNt0pnAfD2DmAnevJPB1tY,1065
|
|
133
|
+
shotgun_sh-0.1.14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|