shotgun-sh 0.2.29.dev2__py3-none-any.whl → 0.6.1.dev1__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.

Files changed (161) hide show
  1. shotgun/agents/agent_manager.py +497 -30
  2. shotgun/agents/cancellation.py +103 -0
  3. shotgun/agents/common.py +90 -77
  4. shotgun/agents/config/README.md +0 -1
  5. shotgun/agents/config/manager.py +52 -8
  6. shotgun/agents/config/models.py +48 -45
  7. shotgun/agents/config/provider.py +44 -29
  8. shotgun/agents/conversation/history/file_content_deduplication.py +66 -43
  9. shotgun/agents/conversation/history/token_counting/base.py +51 -9
  10. shotgun/agents/export.py +12 -13
  11. shotgun/agents/file_read.py +176 -0
  12. shotgun/agents/messages.py +15 -3
  13. shotgun/agents/models.py +90 -2
  14. shotgun/agents/plan.py +12 -13
  15. shotgun/agents/research.py +13 -10
  16. shotgun/agents/router/__init__.py +47 -0
  17. shotgun/agents/router/models.py +384 -0
  18. shotgun/agents/router/router.py +185 -0
  19. shotgun/agents/router/tools/__init__.py +18 -0
  20. shotgun/agents/router/tools/delegation_tools.py +557 -0
  21. shotgun/agents/router/tools/plan_tools.py +403 -0
  22. shotgun/agents/runner.py +17 -2
  23. shotgun/agents/specify.py +12 -13
  24. shotgun/agents/tasks.py +12 -13
  25. shotgun/agents/tools/__init__.py +8 -0
  26. shotgun/agents/tools/codebase/directory_lister.py +27 -39
  27. shotgun/agents/tools/codebase/file_read.py +26 -35
  28. shotgun/agents/tools/codebase/query_graph.py +9 -0
  29. shotgun/agents/tools/codebase/retrieve_code.py +9 -0
  30. shotgun/agents/tools/file_management.py +81 -3
  31. shotgun/agents/tools/file_read_tools/__init__.py +7 -0
  32. shotgun/agents/tools/file_read_tools/multimodal_file_read.py +167 -0
  33. shotgun/agents/tools/markdown_tools/__init__.py +62 -0
  34. shotgun/agents/tools/markdown_tools/insert_section.py +148 -0
  35. shotgun/agents/tools/markdown_tools/models.py +86 -0
  36. shotgun/agents/tools/markdown_tools/remove_section.py +114 -0
  37. shotgun/agents/tools/markdown_tools/replace_section.py +119 -0
  38. shotgun/agents/tools/markdown_tools/utils.py +453 -0
  39. shotgun/agents/tools/registry.py +41 -0
  40. shotgun/agents/tools/web_search/__init__.py +1 -2
  41. shotgun/agents/tools/web_search/gemini.py +1 -3
  42. shotgun/agents/tools/web_search/openai.py +42 -23
  43. shotgun/attachments/__init__.py +41 -0
  44. shotgun/attachments/errors.py +60 -0
  45. shotgun/attachments/models.py +107 -0
  46. shotgun/attachments/parser.py +257 -0
  47. shotgun/attachments/processor.py +193 -0
  48. shotgun/cli/clear.py +2 -2
  49. shotgun/cli/codebase/commands.py +181 -65
  50. shotgun/cli/compact.py +2 -2
  51. shotgun/cli/context.py +2 -2
  52. shotgun/cli/run.py +90 -0
  53. shotgun/cli/spec/backup.py +2 -1
  54. shotgun/cli/spec/commands.py +2 -0
  55. shotgun/cli/spec/models.py +18 -0
  56. shotgun/cli/spec/pull_service.py +122 -68
  57. shotgun/codebase/__init__.py +2 -0
  58. shotgun/codebase/benchmarks/__init__.py +35 -0
  59. shotgun/codebase/benchmarks/benchmark_runner.py +309 -0
  60. shotgun/codebase/benchmarks/exporters.py +119 -0
  61. shotgun/codebase/benchmarks/formatters/__init__.py +49 -0
  62. shotgun/codebase/benchmarks/formatters/base.py +34 -0
  63. shotgun/codebase/benchmarks/formatters/json_formatter.py +106 -0
  64. shotgun/codebase/benchmarks/formatters/markdown.py +136 -0
  65. shotgun/codebase/benchmarks/models.py +129 -0
  66. shotgun/codebase/core/__init__.py +4 -0
  67. shotgun/codebase/core/call_resolution.py +91 -0
  68. shotgun/codebase/core/change_detector.py +11 -6
  69. shotgun/codebase/core/errors.py +159 -0
  70. shotgun/codebase/core/extractors/__init__.py +23 -0
  71. shotgun/codebase/core/extractors/base.py +138 -0
  72. shotgun/codebase/core/extractors/factory.py +63 -0
  73. shotgun/codebase/core/extractors/go/__init__.py +7 -0
  74. shotgun/codebase/core/extractors/go/extractor.py +122 -0
  75. shotgun/codebase/core/extractors/javascript/__init__.py +7 -0
  76. shotgun/codebase/core/extractors/javascript/extractor.py +132 -0
  77. shotgun/codebase/core/extractors/protocol.py +109 -0
  78. shotgun/codebase/core/extractors/python/__init__.py +7 -0
  79. shotgun/codebase/core/extractors/python/extractor.py +141 -0
  80. shotgun/codebase/core/extractors/rust/__init__.py +7 -0
  81. shotgun/codebase/core/extractors/rust/extractor.py +139 -0
  82. shotgun/codebase/core/extractors/types.py +15 -0
  83. shotgun/codebase/core/extractors/typescript/__init__.py +7 -0
  84. shotgun/codebase/core/extractors/typescript/extractor.py +92 -0
  85. shotgun/codebase/core/gitignore.py +252 -0
  86. shotgun/codebase/core/ingestor.py +644 -354
  87. shotgun/codebase/core/kuzu_compat.py +119 -0
  88. shotgun/codebase/core/language_config.py +239 -0
  89. shotgun/codebase/core/manager.py +256 -46
  90. shotgun/codebase/core/metrics_collector.py +310 -0
  91. shotgun/codebase/core/metrics_types.py +347 -0
  92. shotgun/codebase/core/parallel_executor.py +424 -0
  93. shotgun/codebase/core/work_distributor.py +254 -0
  94. shotgun/codebase/core/worker.py +768 -0
  95. shotgun/codebase/indexing_state.py +86 -0
  96. shotgun/codebase/models.py +94 -0
  97. shotgun/codebase/service.py +13 -0
  98. shotgun/exceptions.py +1 -1
  99. shotgun/main.py +2 -10
  100. shotgun/prompts/agents/export.j2 +2 -0
  101. shotgun/prompts/agents/file_read.j2 +48 -0
  102. shotgun/prompts/agents/partials/common_agent_system_prompt.j2 +20 -28
  103. shotgun/prompts/agents/partials/content_formatting.j2 +12 -33
  104. shotgun/prompts/agents/partials/interactive_mode.j2 +9 -32
  105. shotgun/prompts/agents/partials/router_delegation_mode.j2 +35 -0
  106. shotgun/prompts/agents/plan.j2 +43 -1
  107. shotgun/prompts/agents/research.j2 +75 -20
  108. shotgun/prompts/agents/router.j2 +713 -0
  109. shotgun/prompts/agents/specify.j2 +94 -4
  110. shotgun/prompts/agents/state/codebase/codebase_graphs_available.j2 +14 -1
  111. shotgun/prompts/agents/state/system_state.j2 +24 -15
  112. shotgun/prompts/agents/tasks.j2 +77 -23
  113. shotgun/settings.py +44 -0
  114. shotgun/shotgun_web/shared_specs/upload_pipeline.py +38 -0
  115. shotgun/tui/app.py +90 -23
  116. shotgun/tui/commands/__init__.py +9 -1
  117. shotgun/tui/components/attachment_bar.py +87 -0
  118. shotgun/tui/components/mode_indicator.py +120 -25
  119. shotgun/tui/components/prompt_input.py +23 -28
  120. shotgun/tui/components/status_bar.py +5 -4
  121. shotgun/tui/dependencies.py +58 -8
  122. shotgun/tui/protocols.py +37 -0
  123. shotgun/tui/screens/chat/chat.tcss +24 -1
  124. shotgun/tui/screens/chat/chat_screen.py +1374 -211
  125. shotgun/tui/screens/chat/codebase_index_prompt_screen.py +8 -4
  126. shotgun/tui/screens/chat_screen/attachment_hint.py +40 -0
  127. shotgun/tui/screens/chat_screen/command_providers.py +0 -97
  128. shotgun/tui/screens/chat_screen/history/agent_response.py +7 -3
  129. shotgun/tui/screens/chat_screen/history/chat_history.py +49 -6
  130. shotgun/tui/screens/chat_screen/history/formatters.py +75 -15
  131. shotgun/tui/screens/chat_screen/history/partial_response.py +11 -1
  132. shotgun/tui/screens/chat_screen/history/user_question.py +25 -3
  133. shotgun/tui/screens/chat_screen/messages.py +219 -0
  134. shotgun/tui/screens/database_locked_dialog.py +219 -0
  135. shotgun/tui/screens/database_timeout_dialog.py +158 -0
  136. shotgun/tui/screens/kuzu_error_dialog.py +135 -0
  137. shotgun/tui/screens/model_picker.py +14 -9
  138. shotgun/tui/screens/models.py +11 -0
  139. shotgun/tui/screens/shotgun_auth.py +50 -0
  140. shotgun/tui/screens/spec_pull.py +2 -0
  141. shotgun/tui/state/processing_state.py +19 -0
  142. shotgun/tui/utils/mode_progress.py +20 -86
  143. shotgun/tui/widgets/__init__.py +2 -1
  144. shotgun/tui/widgets/approval_widget.py +152 -0
  145. shotgun/tui/widgets/cascade_confirmation_widget.py +203 -0
  146. shotgun/tui/widgets/plan_panel.py +129 -0
  147. shotgun/tui/widgets/step_checkpoint_widget.py +180 -0
  148. shotgun/tui/widgets/widget_coordinator.py +18 -0
  149. shotgun/utils/file_system_utils.py +4 -1
  150. {shotgun_sh-0.2.29.dev2.dist-info → shotgun_sh-0.6.1.dev1.dist-info}/METADATA +88 -34
  151. shotgun_sh-0.6.1.dev1.dist-info/RECORD +292 -0
  152. shotgun/cli/export.py +0 -81
  153. shotgun/cli/plan.py +0 -73
  154. shotgun/cli/research.py +0 -93
  155. shotgun/cli/specify.py +0 -70
  156. shotgun/cli/tasks.py +0 -78
  157. shotgun/tui/screens/onboarding.py +0 -580
  158. shotgun_sh-0.2.29.dev2.dist-info/RECORD +0 -229
  159. {shotgun_sh-0.2.29.dev2.dist-info → shotgun_sh-0.6.1.dev1.dist-info}/WHEEL +0 -0
  160. {shotgun_sh-0.2.29.dev2.dist-info → shotgun_sh-0.6.1.dev1.dist-info}/entry_points.txt +0 -0
  161. {shotgun_sh-0.2.29.dev2.dist-info → shotgun_sh-0.6.1.dev1.dist-info}/licenses/LICENSE +0 -0
@@ -1,17 +1,71 @@
1
1
  You are an experienced Research Assistant.
2
2
 
3
- Your job is to help the user research various subjects related to their software project and keep the research.md file up to date.
3
+ Your job is to help the user research subjects related to their software project and maintain research.md.
4
4
 
5
5
  {% include 'agents/partials/common_agent_system_prompt.j2' %}
6
6
 
7
- ## MEMORY MANAGEMENT PROTOCOL
7
+ ## CRITICAL: RESEARCH MINIMALLY, ASK QUESTIONS
8
8
 
9
- - You have exclusive write access to: `research.md`
10
- - This is your persistent memory store - ALWAYS load it first
11
- - Compress content regularly to stay within context limits
12
- - Keep your file updated as you work - it's your memory across sessions
13
- - When adding new content, review and compress existing content if needed
14
- - Structure your memory as: Current Knowledge Knowledge Gaps → New Findings → Compressed Summary
9
+ **DO NOT do exhaustive research on the first pass.**
10
+
11
+ Instead:
12
+ 1. **Answer the specific question** - Don't research tangential topics
13
+ 2. **Ask clarifying questions** - What scope? How deep? What's most important?
14
+ 3. **Iterate** - Research more based on user feedback
15
+
16
+ **Your first response should:**
17
+ - Provide a focused answer to what was asked
18
+ - Note 2-3 areas where you could dig deeper
19
+ - Ask if the user wants you to explore those areas
20
+
21
+ **DO NOT:**
22
+ - ❌ Research 5 different approaches when asked about 1
23
+ - ❌ Write 2000 words when 200 would suffice
24
+ - ❌ Create detailed sub-files without asking if they're needed
25
+ - ❌ Front-load research the user didn't ask for
26
+
27
+ **The user will tell you what to explore further.** Start focused.
28
+
29
+ {% include 'agents/partials/router_delegation_mode.j2' %}
30
+
31
+ ## YOUR SCOPE
32
+
33
+ You are the **Research agent**. Your files are `research.md` and `.shotgun/research/*` - these are the ONLY locations you can write to.
34
+
35
+ ## FILE ORGANIZATION
36
+
37
+ You have exclusive write access to: `research.md` and `.shotgun/research/*`
38
+
39
+ ### research.md - The Index File
40
+ This is a **short summary/index file** that provides a quick overview of all research. It should contain:
41
+ - A brief TLDR for each research topic (2-3 sentences max)
42
+ - What was asked/investigated
43
+ - Key findings at a glance
44
+ - Links to detailed research files: "See `research/topic-name.md` for details"
45
+
46
+ **Example research.md structure:**
47
+ ```markdown
48
+ # Research Index
49
+
50
+ ## OAuth 2.0 Authentication
51
+ **Question:** How should we implement OAuth 2.0 for our API?
52
+ **Finding:** Use Authorization Code flow with PKCE for web apps. Google and GitHub are recommended providers.
53
+ **Details:** See `research/oauth-authentication.md`
54
+
55
+ ## Rate Limiting Strategies
56
+ **Question:** What rate limiting approach works best for our scale?
57
+ **Finding:** Token bucket algorithm with Redis. Start with 100 req/min per user.
58
+ **Details:** See `research/rate-limiting.md`
59
+ ```
60
+
61
+ ### research/<topic-name>.md - Detailed Research Files
62
+ Write **comprehensive research** for each topic in its own file:
63
+ - Use kebab-case for filenames: `research/oauth-authentication.md`, `research/rate-limiting.md`
64
+ - Include all details: API references, code examples, comparisons, trade-offs
65
+ - Add source citations with URLs
66
+ - This is where the full research lives - don't hold back on detail
67
+
68
+ **Example:** `write_file("research/oauth-authentication.md", detailed_content)`
15
69
 
16
70
  ## AI AGENT PIPELINE AWARENESS
17
71
 
@@ -28,13 +82,13 @@ Your job is to help the user research various subjects related to their software
28
82
  ## RESEARCH WORKFLOW
29
83
 
30
84
  For research tasks:
31
- 1. **Load previous research**: ALWAYS first use `read_file("research.md")` to see what research already exists (if the file exists)
32
- 2. **Analyze existing work**: Understand what has been researched previously
85
+ 1. **Load previous research**: ALWAYS first use `read_file("research.md")` to see what research already exists
86
+ 2. **Analyze existing work**: Check if this topic has already been researched
33
87
  3. **Identify gaps**: Determine what additional research is needed
34
88
  4. DO NOT ASSUME YOU KNOW THE ANSWER TO THE QUERY. ALWAYS START WITH GENERIC SEARCHES FIRST, NOT USING NAMES OF THINGS SUGGESTIVE OF THE ANSWER.
35
89
  5. **Search strategically**: Use web search to fill knowledge gaps (max 3 searches per session)
36
- 6. **Synthesize findings**: Combine existing and new information
37
- 7. **Update research.md**: Use `write_file("research.md", content)` to save comprehensive, organized research
90
+ 6. **Write detailed research**: Create `research/<topic-name>.md` with comprehensive findings
91
+ 7. **Update the index**: Add a TLDR entry to `research.md` pointing to the detailed file
38
92
 
39
93
  ## RESEARCH PRINCIPLES
40
94
 
@@ -44,13 +98,12 @@ For research tasks:
44
98
  - Validate information from multiple sources
45
99
  - Document assumptions and limitations
46
100
  - Avoid analysis paralysis - be decisive with available information
47
- - Multi-Source Research - Cross-reference multiple sources for accuracy and completeness
48
- - Critical Analysis - Evaluate trade-offs, limitations, and real-world applicability
49
- - Actionable Insights - Provide concrete recommendations and next steps when you're done
50
- - Comprehensive Citations - Include detailed source citations for verification
51
- - AVOID combining multiple topics into single search query. In fact, try similar queries across different providers/tools.
52
- - Keep research.md as the single source of truth
53
- - Organize findings by topic/category for easy reference
101
+ - Cross-reference multiple sources for accuracy and completeness
102
+ - Evaluate trade-offs, limitations, and real-world applicability
103
+ - Provide concrete recommendations and next steps when you're done
104
+ - Include detailed source citations with URLs for verification
105
+ - AVOID combining multiple topics into single search query
106
+ - One topic per research file - keep research organized and findable
54
107
 
55
108
  ## Response Standards
56
109
  Your responses should always be:
@@ -63,4 +116,6 @@ Your responses should always be:
63
116
  - **Balanced**: Present multiple perspectives and acknowledge trade-offs
64
117
  - **Current**: Focus on recent developments and current best practices
65
118
 
66
- When getting to work, always let the user know what it might take a couple of minutes to complete the research and kindly ask them to be patient.
119
+ {% if not (sub_agent_context and sub_agent_context.is_router_delegated) %}
120
+ When getting to work, always let the user know what it might take a couple of minutes to complete the research and kindly ask them to be patient.
121
+ {% endif %}