shotgun-sh 0.4.0.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.
Files changed (135) hide show
  1. shotgun/agents/agent_manager.py +307 -8
  2. shotgun/agents/cancellation.py +103 -0
  3. shotgun/agents/common.py +12 -0
  4. shotgun/agents/config/README.md +0 -1
  5. shotgun/agents/config/manager.py +10 -7
  6. shotgun/agents/config/models.py +5 -27
  7. shotgun/agents/config/provider.py +44 -27
  8. shotgun/agents/conversation/history/token_counting/base.py +51 -9
  9. shotgun/agents/file_read.py +176 -0
  10. shotgun/agents/messages.py +15 -3
  11. shotgun/agents/models.py +24 -1
  12. shotgun/agents/router/models.py +8 -0
  13. shotgun/agents/router/tools/delegation_tools.py +55 -1
  14. shotgun/agents/router/tools/plan_tools.py +88 -7
  15. shotgun/agents/runner.py +17 -2
  16. shotgun/agents/tools/__init__.py +8 -0
  17. shotgun/agents/tools/codebase/directory_lister.py +27 -39
  18. shotgun/agents/tools/codebase/file_read.py +26 -35
  19. shotgun/agents/tools/codebase/query_graph.py +9 -0
  20. shotgun/agents/tools/codebase/retrieve_code.py +9 -0
  21. shotgun/agents/tools/file_management.py +32 -2
  22. shotgun/agents/tools/file_read_tools/__init__.py +7 -0
  23. shotgun/agents/tools/file_read_tools/multimodal_file_read.py +167 -0
  24. shotgun/agents/tools/markdown_tools/__init__.py +62 -0
  25. shotgun/agents/tools/markdown_tools/insert_section.py +148 -0
  26. shotgun/agents/tools/markdown_tools/models.py +86 -0
  27. shotgun/agents/tools/markdown_tools/remove_section.py +114 -0
  28. shotgun/agents/tools/markdown_tools/replace_section.py +119 -0
  29. shotgun/agents/tools/markdown_tools/utils.py +453 -0
  30. shotgun/agents/tools/registry.py +44 -6
  31. shotgun/agents/tools/web_search/openai.py +42 -23
  32. shotgun/attachments/__init__.py +41 -0
  33. shotgun/attachments/errors.py +60 -0
  34. shotgun/attachments/models.py +107 -0
  35. shotgun/attachments/parser.py +257 -0
  36. shotgun/attachments/processor.py +193 -0
  37. shotgun/build_constants.py +4 -7
  38. shotgun/cli/clear.py +2 -2
  39. shotgun/cli/codebase/commands.py +181 -65
  40. shotgun/cli/compact.py +2 -2
  41. shotgun/cli/context.py +2 -2
  42. shotgun/cli/error_handler.py +2 -2
  43. shotgun/cli/run.py +90 -0
  44. shotgun/cli/spec/backup.py +2 -1
  45. shotgun/codebase/__init__.py +2 -0
  46. shotgun/codebase/benchmarks/__init__.py +35 -0
  47. shotgun/codebase/benchmarks/benchmark_runner.py +309 -0
  48. shotgun/codebase/benchmarks/exporters.py +119 -0
  49. shotgun/codebase/benchmarks/formatters/__init__.py +49 -0
  50. shotgun/codebase/benchmarks/formatters/base.py +34 -0
  51. shotgun/codebase/benchmarks/formatters/json_formatter.py +106 -0
  52. shotgun/codebase/benchmarks/formatters/markdown.py +136 -0
  53. shotgun/codebase/benchmarks/models.py +129 -0
  54. shotgun/codebase/core/__init__.py +4 -0
  55. shotgun/codebase/core/call_resolution.py +91 -0
  56. shotgun/codebase/core/change_detector.py +11 -6
  57. shotgun/codebase/core/errors.py +159 -0
  58. shotgun/codebase/core/extractors/__init__.py +23 -0
  59. shotgun/codebase/core/extractors/base.py +138 -0
  60. shotgun/codebase/core/extractors/factory.py +63 -0
  61. shotgun/codebase/core/extractors/go/__init__.py +7 -0
  62. shotgun/codebase/core/extractors/go/extractor.py +122 -0
  63. shotgun/codebase/core/extractors/javascript/__init__.py +7 -0
  64. shotgun/codebase/core/extractors/javascript/extractor.py +132 -0
  65. shotgun/codebase/core/extractors/protocol.py +109 -0
  66. shotgun/codebase/core/extractors/python/__init__.py +7 -0
  67. shotgun/codebase/core/extractors/python/extractor.py +141 -0
  68. shotgun/codebase/core/extractors/rust/__init__.py +7 -0
  69. shotgun/codebase/core/extractors/rust/extractor.py +139 -0
  70. shotgun/codebase/core/extractors/types.py +15 -0
  71. shotgun/codebase/core/extractors/typescript/__init__.py +7 -0
  72. shotgun/codebase/core/extractors/typescript/extractor.py +92 -0
  73. shotgun/codebase/core/gitignore.py +252 -0
  74. shotgun/codebase/core/ingestor.py +644 -354
  75. shotgun/codebase/core/kuzu_compat.py +119 -0
  76. shotgun/codebase/core/language_config.py +239 -0
  77. shotgun/codebase/core/manager.py +256 -46
  78. shotgun/codebase/core/metrics_collector.py +310 -0
  79. shotgun/codebase/core/metrics_types.py +347 -0
  80. shotgun/codebase/core/parallel_executor.py +424 -0
  81. shotgun/codebase/core/work_distributor.py +254 -0
  82. shotgun/codebase/core/worker.py +768 -0
  83. shotgun/codebase/indexing_state.py +86 -0
  84. shotgun/codebase/models.py +94 -0
  85. shotgun/codebase/service.py +13 -0
  86. shotgun/exceptions.py +9 -9
  87. shotgun/main.py +3 -16
  88. shotgun/posthog_telemetry.py +165 -24
  89. shotgun/prompts/agents/file_read.j2 +48 -0
  90. shotgun/prompts/agents/partials/common_agent_system_prompt.j2 +19 -47
  91. shotgun/prompts/agents/partials/content_formatting.j2 +12 -33
  92. shotgun/prompts/agents/partials/interactive_mode.j2 +9 -32
  93. shotgun/prompts/agents/partials/router_delegation_mode.j2 +21 -22
  94. shotgun/prompts/agents/plan.j2 +14 -0
  95. shotgun/prompts/agents/router.j2 +531 -258
  96. shotgun/prompts/agents/specify.j2 +14 -0
  97. shotgun/prompts/agents/state/codebase/codebase_graphs_available.j2 +14 -1
  98. shotgun/prompts/agents/state/system_state.j2 +13 -11
  99. shotgun/prompts/agents/tasks.j2 +14 -0
  100. shotgun/settings.py +49 -10
  101. shotgun/tui/app.py +149 -18
  102. shotgun/tui/commands/__init__.py +9 -1
  103. shotgun/tui/components/attachment_bar.py +87 -0
  104. shotgun/tui/components/prompt_input.py +25 -28
  105. shotgun/tui/components/status_bar.py +14 -7
  106. shotgun/tui/dependencies.py +3 -8
  107. shotgun/tui/protocols.py +18 -0
  108. shotgun/tui/screens/chat/chat.tcss +15 -0
  109. shotgun/tui/screens/chat/chat_screen.py +766 -235
  110. shotgun/tui/screens/chat/codebase_index_prompt_screen.py +8 -4
  111. shotgun/tui/screens/chat_screen/attachment_hint.py +40 -0
  112. shotgun/tui/screens/chat_screen/command_providers.py +0 -10
  113. shotgun/tui/screens/chat_screen/history/chat_history.py +54 -14
  114. shotgun/tui/screens/chat_screen/history/formatters.py +22 -0
  115. shotgun/tui/screens/chat_screen/history/user_question.py +25 -3
  116. shotgun/tui/screens/database_locked_dialog.py +219 -0
  117. shotgun/tui/screens/database_timeout_dialog.py +158 -0
  118. shotgun/tui/screens/kuzu_error_dialog.py +135 -0
  119. shotgun/tui/screens/model_picker.py +1 -3
  120. shotgun/tui/screens/models.py +11 -0
  121. shotgun/tui/state/processing_state.py +19 -0
  122. shotgun/tui/widgets/widget_coordinator.py +18 -0
  123. shotgun/utils/file_system_utils.py +4 -1
  124. {shotgun_sh-0.4.0.dev1.dist-info → shotgun_sh-0.6.2.dist-info}/METADATA +87 -34
  125. {shotgun_sh-0.4.0.dev1.dist-info → shotgun_sh-0.6.2.dist-info}/RECORD +128 -79
  126. shotgun/cli/export.py +0 -81
  127. shotgun/cli/plan.py +0 -73
  128. shotgun/cli/research.py +0 -93
  129. shotgun/cli/specify.py +0 -70
  130. shotgun/cli/tasks.py +0 -78
  131. shotgun/sentry_telemetry.py +0 -232
  132. shotgun/tui/screens/onboarding.py +0 -584
  133. {shotgun_sh-0.4.0.dev1.dist-info → shotgun_sh-0.6.2.dist-info}/WHEEL +0 -0
  134. {shotgun_sh-0.4.0.dev1.dist-info → shotgun_sh-0.6.2.dist-info}/entry_points.txt +0 -0
  135. {shotgun_sh-0.4.0.dev1.dist-info → shotgun_sh-0.6.2.dist-info}/licenses/LICENSE +0 -0
@@ -2,7 +2,7 @@
2
2
 
3
3
  from textual.widget import Widget
4
4
 
5
- from shotgun.tui.protocols import QAStateProvider
5
+ from shotgun.tui.protocols import QAStateProvider, QuitConfirmationProvider
6
6
 
7
7
 
8
8
  class StatusBar(Widget):
@@ -26,7 +26,11 @@ class StatusBar(Widget):
26
26
 
27
27
  def render(self) -> str:
28
28
  """Render the status bar with contextual help text."""
29
- # Check if in Q&A mode first (highest priority)
29
+ # Check if quit confirmation is pending (highest priority)
30
+ if isinstance(self.app, QuitConfirmationProvider) and self.app.quit_pending:
31
+ return "[$foreground-muted][bold $warning]Press Ctrl+C again to quit[/] • [bold $text]esc[/] to cancel[/]"
32
+
33
+ # Check if in Q&A mode
30
34
  if isinstance(self.screen, QAStateProvider) and self.screen.qa_mode:
31
35
  return (
32
36
  "[$foreground-muted][bold $text]esc[/] to exit Q&A mode • "
@@ -36,13 +40,16 @@ class StatusBar(Widget):
36
40
  if self.working:
37
41
  return (
38
42
  "[$foreground-muted][bold $text]esc[/] to stop • "
39
- "[bold $text]enter[/] to send • [bold $text]ctrl+j[/] for newline • "
40
- "[bold $text]ctrl+p[/] command palette • [bold $text]shift+tab[/] toggle mode • "
41
- "/help for commands[/]"
43
+ "[bold $text]enter[/] to send • [bold $text]ctrl+j[/] newline • "
44
+ "[bold $text]/[/] command palette • "
45
+ "[bold $text]shift+tab[/] toggle mode • "
46
+ "[bold $text]ctrl+c[/] copy • [bold $text]ctrl+v[/] paste[/]"
42
47
  )
43
48
  else:
44
49
  return (
45
50
  "[$foreground-muted][bold $text]enter[/] to send • "
46
- "[bold $text]ctrl+j[/] for newline • [bold $text]ctrl+p[/] command palette • "
47
- "[bold $text]shift+tab[/] toggle mode/help for commands[/]"
51
+ "[bold $text]ctrl+j[/] newline • "
52
+ "[bold $text]/[/] command palette • "
53
+ "[bold $text]shift+tab[/] toggle mode • "
54
+ "[bold $text]ctrl+c[/] copy • [bold $text]ctrl+v[/] paste[/]"
48
55
  )
@@ -4,7 +4,7 @@ from typing import Any
4
4
 
5
5
  from pydantic_ai import RunContext
6
6
 
7
- from shotgun.agents.config import get_config_manager, get_provider_model
7
+ from shotgun.agents.config import get_provider_model
8
8
  from shotgun.agents.config.models import ModelConfig
9
9
  from shotgun.agents.models import AgentDeps
10
10
  from shotgun.agents.router.models import RouterDeps, RouterMode
@@ -68,7 +68,7 @@ async def create_default_router_deps() -> RouterDeps:
68
68
 
69
69
  This creates a RouterDeps configuration suitable for interactive
70
70
  TUI usage with:
71
- - Router mode loaded from config (default: PLANNING)
71
+ - Router mode always starts in PLANNING (not persisted)
72
72
  - Interactive mode enabled
73
73
  - TUI context flag set
74
74
  - Filtered codebase service (restricted to CWD)
@@ -79,16 +79,11 @@ async def create_default_router_deps() -> RouterDeps:
79
79
  """
80
80
  model_config, codebase_service = await _get_tui_config()
81
81
 
82
- # Load router mode from config (default to PLANNING)
83
- config_manager = get_config_manager()
84
- config = await config_manager.load()
85
- router_mode = RouterMode(config.router_mode)
86
-
87
82
  return RouterDeps(
88
83
  interactive_mode=True,
89
84
  is_tui_context=True,
90
85
  llm_model=model_config,
91
86
  codebase_service=codebase_service,
92
87
  system_prompt_fn=_placeholder_system_prompt_fn,
93
- router_mode=router_mode,
88
+ router_mode=RouterMode.PLANNING,
94
89
  )
shotgun/tui/protocols.py CHANGED
@@ -80,3 +80,21 @@ class ActiveSubAgentProvider(Protocol):
80
80
  a sub-agent is executing, None if idle.
81
81
  """
82
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
+ ...
@@ -59,4 +59,19 @@ ModeIndicator.mode-drafting {
59
59
 
60
60
  #indexing-job-display {
61
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;
62
77
  }