shotgun-sh 0.3.3.dev1__py3-none-any.whl → 0.6.2__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.
- shotgun/agents/agent_manager.py +497 -30
- shotgun/agents/cancellation.py +103 -0
- shotgun/agents/common.py +90 -77
- shotgun/agents/config/README.md +0 -1
- shotgun/agents/config/manager.py +52 -8
- shotgun/agents/config/models.py +21 -27
- shotgun/agents/config/provider.py +44 -27
- shotgun/agents/conversation/history/file_content_deduplication.py +66 -43
- shotgun/agents/conversation/history/token_counting/base.py +51 -9
- shotgun/agents/export.py +12 -13
- shotgun/agents/file_read.py +176 -0
- shotgun/agents/messages.py +15 -3
- shotgun/agents/models.py +90 -2
- shotgun/agents/plan.py +12 -13
- shotgun/agents/research.py +13 -10
- shotgun/agents/router/__init__.py +47 -0
- shotgun/agents/router/models.py +384 -0
- shotgun/agents/router/router.py +185 -0
- shotgun/agents/router/tools/__init__.py +18 -0
- shotgun/agents/router/tools/delegation_tools.py +557 -0
- shotgun/agents/router/tools/plan_tools.py +403 -0
- shotgun/agents/runner.py +17 -2
- shotgun/agents/specify.py +12 -13
- shotgun/agents/tasks.py +12 -13
- shotgun/agents/tools/__init__.py +8 -0
- shotgun/agents/tools/codebase/directory_lister.py +27 -39
- shotgun/agents/tools/codebase/file_read.py +26 -35
- shotgun/agents/tools/codebase/query_graph.py +9 -0
- shotgun/agents/tools/codebase/retrieve_code.py +9 -0
- shotgun/agents/tools/file_management.py +81 -3
- shotgun/agents/tools/file_read_tools/__init__.py +7 -0
- shotgun/agents/tools/file_read_tools/multimodal_file_read.py +167 -0
- shotgun/agents/tools/markdown_tools/__init__.py +62 -0
- shotgun/agents/tools/markdown_tools/insert_section.py +148 -0
- shotgun/agents/tools/markdown_tools/models.py +86 -0
- shotgun/agents/tools/markdown_tools/remove_section.py +114 -0
- shotgun/agents/tools/markdown_tools/replace_section.py +119 -0
- shotgun/agents/tools/markdown_tools/utils.py +453 -0
- shotgun/agents/tools/registry.py +46 -6
- shotgun/agents/tools/web_search/__init__.py +1 -2
- shotgun/agents/tools/web_search/gemini.py +1 -3
- shotgun/agents/tools/web_search/openai.py +42 -23
- shotgun/attachments/__init__.py +41 -0
- shotgun/attachments/errors.py +60 -0
- shotgun/attachments/models.py +107 -0
- shotgun/attachments/parser.py +257 -0
- shotgun/attachments/processor.py +193 -0
- shotgun/build_constants.py +4 -7
- shotgun/cli/clear.py +2 -2
- shotgun/cli/codebase/commands.py +181 -65
- shotgun/cli/compact.py +2 -2
- shotgun/cli/context.py +2 -2
- shotgun/cli/error_handler.py +2 -2
- shotgun/cli/run.py +90 -0
- shotgun/cli/spec/backup.py +2 -1
- shotgun/codebase/__init__.py +2 -0
- shotgun/codebase/benchmarks/__init__.py +35 -0
- shotgun/codebase/benchmarks/benchmark_runner.py +309 -0
- shotgun/codebase/benchmarks/exporters.py +119 -0
- shotgun/codebase/benchmarks/formatters/__init__.py +49 -0
- shotgun/codebase/benchmarks/formatters/base.py +34 -0
- shotgun/codebase/benchmarks/formatters/json_formatter.py +106 -0
- shotgun/codebase/benchmarks/formatters/markdown.py +136 -0
- shotgun/codebase/benchmarks/models.py +129 -0
- shotgun/codebase/core/__init__.py +4 -0
- shotgun/codebase/core/call_resolution.py +91 -0
- shotgun/codebase/core/change_detector.py +11 -6
- shotgun/codebase/core/errors.py +159 -0
- shotgun/codebase/core/extractors/__init__.py +23 -0
- shotgun/codebase/core/extractors/base.py +138 -0
- shotgun/codebase/core/extractors/factory.py +63 -0
- shotgun/codebase/core/extractors/go/__init__.py +7 -0
- shotgun/codebase/core/extractors/go/extractor.py +122 -0
- shotgun/codebase/core/extractors/javascript/__init__.py +7 -0
- shotgun/codebase/core/extractors/javascript/extractor.py +132 -0
- shotgun/codebase/core/extractors/protocol.py +109 -0
- shotgun/codebase/core/extractors/python/__init__.py +7 -0
- shotgun/codebase/core/extractors/python/extractor.py +141 -0
- shotgun/codebase/core/extractors/rust/__init__.py +7 -0
- shotgun/codebase/core/extractors/rust/extractor.py +139 -0
- shotgun/codebase/core/extractors/types.py +15 -0
- shotgun/codebase/core/extractors/typescript/__init__.py +7 -0
- shotgun/codebase/core/extractors/typescript/extractor.py +92 -0
- shotgun/codebase/core/gitignore.py +252 -0
- shotgun/codebase/core/ingestor.py +644 -354
- shotgun/codebase/core/kuzu_compat.py +119 -0
- shotgun/codebase/core/language_config.py +239 -0
- shotgun/codebase/core/manager.py +256 -46
- shotgun/codebase/core/metrics_collector.py +310 -0
- shotgun/codebase/core/metrics_types.py +347 -0
- shotgun/codebase/core/parallel_executor.py +424 -0
- shotgun/codebase/core/work_distributor.py +254 -0
- shotgun/codebase/core/worker.py +768 -0
- shotgun/codebase/indexing_state.py +86 -0
- shotgun/codebase/models.py +94 -0
- shotgun/codebase/service.py +13 -0
- shotgun/exceptions.py +9 -9
- shotgun/main.py +3 -16
- shotgun/posthog_telemetry.py +165 -24
- shotgun/prompts/agents/export.j2 +2 -0
- shotgun/prompts/agents/file_read.j2 +48 -0
- shotgun/prompts/agents/partials/common_agent_system_prompt.j2 +19 -52
- shotgun/prompts/agents/partials/content_formatting.j2 +12 -33
- shotgun/prompts/agents/partials/interactive_mode.j2 +9 -32
- shotgun/prompts/agents/partials/router_delegation_mode.j2 +35 -0
- shotgun/prompts/agents/plan.j2 +38 -12
- shotgun/prompts/agents/research.j2 +70 -31
- shotgun/prompts/agents/router.j2 +713 -0
- shotgun/prompts/agents/specify.j2 +53 -16
- shotgun/prompts/agents/state/codebase/codebase_graphs_available.j2 +14 -1
- shotgun/prompts/agents/state/system_state.j2 +24 -13
- shotgun/prompts/agents/tasks.j2 +72 -34
- shotgun/settings.py +49 -10
- shotgun/tui/app.py +154 -24
- shotgun/tui/commands/__init__.py +9 -1
- shotgun/tui/components/attachment_bar.py +87 -0
- shotgun/tui/components/mode_indicator.py +120 -25
- shotgun/tui/components/prompt_input.py +25 -28
- shotgun/tui/components/status_bar.py +14 -7
- shotgun/tui/dependencies.py +58 -8
- shotgun/tui/protocols.py +55 -0
- shotgun/tui/screens/chat/chat.tcss +24 -1
- shotgun/tui/screens/chat/chat_screen.py +1376 -213
- shotgun/tui/screens/chat/codebase_index_prompt_screen.py +8 -4
- shotgun/tui/screens/chat_screen/attachment_hint.py +40 -0
- shotgun/tui/screens/chat_screen/command_providers.py +0 -97
- shotgun/tui/screens/chat_screen/history/agent_response.py +7 -3
- shotgun/tui/screens/chat_screen/history/chat_history.py +58 -6
- shotgun/tui/screens/chat_screen/history/formatters.py +75 -15
- shotgun/tui/screens/chat_screen/history/partial_response.py +11 -1
- shotgun/tui/screens/chat_screen/history/user_question.py +25 -3
- shotgun/tui/screens/chat_screen/messages.py +219 -0
- shotgun/tui/screens/database_locked_dialog.py +219 -0
- shotgun/tui/screens/database_timeout_dialog.py +158 -0
- shotgun/tui/screens/kuzu_error_dialog.py +135 -0
- shotgun/tui/screens/model_picker.py +1 -3
- shotgun/tui/screens/models.py +11 -0
- shotgun/tui/state/processing_state.py +19 -0
- shotgun/tui/utils/mode_progress.py +20 -86
- shotgun/tui/widgets/__init__.py +2 -1
- shotgun/tui/widgets/approval_widget.py +152 -0
- shotgun/tui/widgets/cascade_confirmation_widget.py +203 -0
- shotgun/tui/widgets/plan_panel.py +129 -0
- shotgun/tui/widgets/step_checkpoint_widget.py +180 -0
- shotgun/tui/widgets/widget_coordinator.py +18 -0
- shotgun/utils/file_system_utils.py +4 -1
- {shotgun_sh-0.3.3.dev1.dist-info → shotgun_sh-0.6.2.dist-info}/METADATA +88 -35
- shotgun_sh-0.6.2.dist-info/RECORD +291 -0
- shotgun/cli/export.py +0 -81
- shotgun/cli/plan.py +0 -73
- shotgun/cli/research.py +0 -93
- shotgun/cli/specify.py +0 -70
- shotgun/cli/tasks.py +0 -78
- shotgun/sentry_telemetry.py +0 -232
- shotgun/tui/screens/onboarding.py +0 -580
- shotgun_sh-0.3.3.dev1.dist-info/RECORD +0 -229
- {shotgun_sh-0.3.3.dev1.dist-info → shotgun_sh-0.6.2.dist-info}/WHEEL +0 -0
- {shotgun_sh-0.3.3.dev1.dist-info → shotgun_sh-0.6.2.dist-info}/entry_points.txt +0 -0
- {shotgun_sh-0.3.3.dev1.dist-info → shotgun_sh-0.6.2.dist-info}/licenses/LICENSE +0 -0
shotgun/tui/dependencies.py
CHANGED
|
@@ -1,13 +1,44 @@
|
|
|
1
1
|
"""Dependency creation utilities for TUI components."""
|
|
2
2
|
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
3
5
|
from pydantic_ai import RunContext
|
|
4
6
|
|
|
5
7
|
from shotgun.agents.config import get_provider_model
|
|
8
|
+
from shotgun.agents.config.models import ModelConfig
|
|
6
9
|
from shotgun.agents.models import AgentDeps
|
|
10
|
+
from shotgun.agents.router.models import RouterDeps, RouterMode
|
|
11
|
+
from shotgun.codebase.service import CodebaseService
|
|
7
12
|
from shotgun.tui.filtered_codebase_service import FilteredCodebaseService
|
|
8
13
|
from shotgun.utils import get_shotgun_home
|
|
9
14
|
|
|
10
15
|
|
|
16
|
+
async def _get_tui_config() -> tuple[ModelConfig, CodebaseService]:
|
|
17
|
+
"""Get common TUI configuration components.
|
|
18
|
+
|
|
19
|
+
Returns:
|
|
20
|
+
Tuple of (model_config, codebase_service) for TUI deps.
|
|
21
|
+
"""
|
|
22
|
+
model_config = await get_provider_model()
|
|
23
|
+
storage_dir = get_shotgun_home() / "codebases"
|
|
24
|
+
codebase_service = FilteredCodebaseService(storage_dir)
|
|
25
|
+
return model_config, codebase_service
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _placeholder_system_prompt_fn(ctx: RunContext[Any]) -> str:
|
|
29
|
+
"""Placeholder system prompt that should never be called.
|
|
30
|
+
|
|
31
|
+
Agents provide their own system_prompt_fn via their create functions.
|
|
32
|
+
This placeholder exists only to satisfy the AgentDeps requirement.
|
|
33
|
+
|
|
34
|
+
Raises:
|
|
35
|
+
RuntimeError: Always, as this should never be invoked.
|
|
36
|
+
"""
|
|
37
|
+
raise RuntimeError(
|
|
38
|
+
"This should not be called - agents provide their own system_prompt_fn"
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
11
42
|
async def create_default_tui_deps() -> AgentDeps:
|
|
12
43
|
"""Create default AgentDeps for TUI components.
|
|
13
44
|
|
|
@@ -21,14 +52,7 @@ async def create_default_tui_deps() -> AgentDeps:
|
|
|
21
52
|
Returns:
|
|
22
53
|
Configured AgentDeps instance ready for TUI use.
|
|
23
54
|
"""
|
|
24
|
-
model_config = await
|
|
25
|
-
storage_dir = get_shotgun_home() / "codebases"
|
|
26
|
-
codebase_service = FilteredCodebaseService(storage_dir)
|
|
27
|
-
|
|
28
|
-
def _placeholder_system_prompt_fn(ctx: RunContext[AgentDeps]) -> str:
|
|
29
|
-
raise RuntimeError(
|
|
30
|
-
"This should not be called - agents provide their own system_prompt_fn"
|
|
31
|
-
)
|
|
55
|
+
model_config, codebase_service = await _get_tui_config()
|
|
32
56
|
|
|
33
57
|
return AgentDeps(
|
|
34
58
|
interactive_mode=True,
|
|
@@ -37,3 +61,29 @@ async def create_default_tui_deps() -> AgentDeps:
|
|
|
37
61
|
codebase_service=codebase_service,
|
|
38
62
|
system_prompt_fn=_placeholder_system_prompt_fn,
|
|
39
63
|
)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
async def create_default_router_deps() -> RouterDeps:
|
|
67
|
+
"""Create default RouterDeps for TUI components with router mode.
|
|
68
|
+
|
|
69
|
+
This creates a RouterDeps configuration suitable for interactive
|
|
70
|
+
TUI usage with:
|
|
71
|
+
- Router mode always starts in PLANNING (not persisted)
|
|
72
|
+
- Interactive mode enabled
|
|
73
|
+
- TUI context flag set
|
|
74
|
+
- Filtered codebase service (restricted to CWD)
|
|
75
|
+
- Placeholder system prompt (router provides its own)
|
|
76
|
+
|
|
77
|
+
Returns:
|
|
78
|
+
Configured RouterDeps instance ready for TUI use.
|
|
79
|
+
"""
|
|
80
|
+
model_config, codebase_service = await _get_tui_config()
|
|
81
|
+
|
|
82
|
+
return RouterDeps(
|
|
83
|
+
interactive_mode=True,
|
|
84
|
+
is_tui_context=True,
|
|
85
|
+
llm_model=model_config,
|
|
86
|
+
codebase_service=codebase_service,
|
|
87
|
+
system_prompt_fn=_placeholder_system_prompt_fn,
|
|
88
|
+
router_mode=RouterMode.PLANNING,
|
|
89
|
+
)
|
shotgun/tui/protocols.py
CHANGED
|
@@ -43,3 +43,58 @@ class ProcessingStateProvider(Protocol):
|
|
|
43
43
|
True if an agent is processing, False otherwise.
|
|
44
44
|
"""
|
|
45
45
|
...
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@runtime_checkable
|
|
49
|
+
class RouterModeProvider(Protocol):
|
|
50
|
+
"""Protocol for screens that provide router mode state.
|
|
51
|
+
|
|
52
|
+
This protocol allows components to check the current router mode
|
|
53
|
+
(Planning or Drafting) without importing the concrete ChatScreen class.
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
@property
|
|
57
|
+
def router_mode(self) -> str | None:
|
|
58
|
+
"""The current router mode.
|
|
59
|
+
|
|
60
|
+
Returns:
|
|
61
|
+
'planning' or 'drafting' if in router mode, None otherwise.
|
|
62
|
+
"""
|
|
63
|
+
...
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@runtime_checkable
|
|
67
|
+
class ActiveSubAgentProvider(Protocol):
|
|
68
|
+
"""Protocol for screens that provide active sub-agent state.
|
|
69
|
+
|
|
70
|
+
This protocol allows components to check which sub-agent is currently
|
|
71
|
+
executing during router delegation without importing ChatScreen.
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
@property
|
|
75
|
+
def active_sub_agent(self) -> str | None:
|
|
76
|
+
"""The currently executing sub-agent type.
|
|
77
|
+
|
|
78
|
+
Returns:
|
|
79
|
+
The sub-agent type string (e.g., 'research', 'specify') if
|
|
80
|
+
a sub-agent is executing, None if idle.
|
|
81
|
+
"""
|
|
82
|
+
...
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@runtime_checkable
|
|
86
|
+
class QuitConfirmationProvider(Protocol):
|
|
87
|
+
"""Protocol for apps that provide quit confirmation state.
|
|
88
|
+
|
|
89
|
+
This protocol allows components (like StatusBar) to check if a quit
|
|
90
|
+
confirmation is pending without importing the concrete App class.
|
|
91
|
+
"""
|
|
92
|
+
|
|
93
|
+
@property
|
|
94
|
+
def quit_pending(self) -> bool:
|
|
95
|
+
"""Whether a quit confirmation is pending.
|
|
96
|
+
|
|
97
|
+
Returns:
|
|
98
|
+
True if user pressed Ctrl+C and needs to confirm quit.
|
|
99
|
+
"""
|
|
100
|
+
...
|
|
@@ -16,11 +16,19 @@ ModeIndicator {
|
|
|
16
16
|
height: auto;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
ModeIndicator.mode-planning {
|
|
20
|
+
/* Blue/cyan accent for planning mode */
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
ModeIndicator.mode-drafting {
|
|
24
|
+
/* Green accent for drafting mode */
|
|
25
|
+
}
|
|
26
|
+
|
|
19
27
|
#footer {
|
|
20
28
|
dock: bottom;
|
|
21
29
|
height: auto;
|
|
22
30
|
padding: 1 1 1 2;
|
|
23
|
-
max-height:
|
|
31
|
+
max-height: 24;
|
|
24
32
|
}
|
|
25
33
|
|
|
26
34
|
#window {
|
|
@@ -51,4 +59,19 @@ ModeIndicator {
|
|
|
51
59
|
|
|
52
60
|
#indexing-job-display {
|
|
53
61
|
text-align: end;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
AttachmentBar {
|
|
65
|
+
height: auto;
|
|
66
|
+
padding: 0 1;
|
|
67
|
+
background: $secondary-background;
|
|
68
|
+
margin-bottom: 1;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
AttachmentBar.hidden {
|
|
72
|
+
display: none;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
AttachmentBar Static {
|
|
76
|
+
color: $text-accent;
|
|
54
77
|
}
|