shotgun-sh 0.1.16.dev2__tar.gz → 0.2.1.dev2__tar.gz

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 (153) hide show
  1. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/.gitignore +3 -0
  2. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/PKG-INFO +2 -2
  3. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/pyproject.toml +2 -2
  4. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/common.py +4 -5
  5. shotgun_sh-0.2.1.dev2/src/shotgun/agents/config/constants.py +33 -0
  6. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/config/manager.py +149 -57
  7. shotgun_sh-0.2.1.dev2/src/shotgun/agents/config/models.py +166 -0
  8. shotgun_sh-0.2.1.dev2/src/shotgun/agents/config/provider.py +294 -0
  9. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/history/compaction.py +1 -1
  10. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/history/history_processors.py +18 -9
  11. shotgun_sh-0.2.1.dev2/src/shotgun/agents/history/token_counting/__init__.py +31 -0
  12. shotgun_sh-0.2.1.dev2/src/shotgun/agents/history/token_counting/anthropic.py +89 -0
  13. shotgun_sh-0.2.1.dev2/src/shotgun/agents/history/token_counting/base.py +67 -0
  14. shotgun_sh-0.2.1.dev2/src/shotgun/agents/history/token_counting/openai.py +80 -0
  15. shotgun_sh-0.2.1.dev2/src/shotgun/agents/history/token_counting/sentencepiece_counter.py +119 -0
  16. shotgun_sh-0.2.1.dev2/src/shotgun/agents/history/token_counting/tokenizer_cache.py +90 -0
  17. shotgun_sh-0.2.1.dev2/src/shotgun/agents/history/token_counting/utils.py +147 -0
  18. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/history/token_estimation.py +12 -12
  19. shotgun_sh-0.2.1.dev2/src/shotgun/agents/llm.py +62 -0
  20. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/models.py +2 -2
  21. shotgun_sh-0.2.1.dev2/src/shotgun/agents/tools/web_search/__init__.py +87 -0
  22. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/tools/web_search/anthropic.py +54 -50
  23. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/tools/web_search/gemini.py +31 -20
  24. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/tools/web_search/openai.py +4 -4
  25. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/cli/config.py +14 -55
  26. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/cli/models.py +2 -2
  27. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/codebase/models.py +4 -4
  28. shotgun_sh-0.2.1.dev2/src/shotgun/llm_proxy/__init__.py +16 -0
  29. shotgun_sh-0.2.1.dev2/src/shotgun/llm_proxy/clients.py +39 -0
  30. shotgun_sh-0.2.1.dev2/src/shotgun/llm_proxy/constants.py +8 -0
  31. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/main.py +6 -0
  32. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/posthog_telemetry.py +5 -3
  33. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/tui/app.py +2 -0
  34. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/tui/screens/chat_screen/command_providers.py +20 -0
  35. shotgun_sh-0.2.1.dev2/src/shotgun/tui/screens/model_picker.py +215 -0
  36. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/tui/screens/provider_config.py +39 -26
  37. shotgun_sh-0.1.16.dev2/src/shotgun/agents/config/constants.py +0 -17
  38. shotgun_sh-0.1.16.dev2/src/shotgun/agents/config/models.py +0 -185
  39. shotgun_sh-0.1.16.dev2/src/shotgun/agents/config/provider.py +0 -206
  40. shotgun_sh-0.1.16.dev2/src/shotgun/agents/history/token_counting.py +0 -429
  41. shotgun_sh-0.1.16.dev2/src/shotgun/agents/tools/web_search/__init__.py +0 -60
  42. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/LICENSE +0 -0
  43. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/README.md +0 -0
  44. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/hatch_build.py +0 -0
  45. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/__init__.py +0 -0
  46. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/__init__.py +0 -0
  47. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/agent_manager.py +0 -0
  48. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/config/__init__.py +0 -0
  49. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/conversation_history.py +0 -0
  50. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/conversation_manager.py +0 -0
  51. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/export.py +0 -0
  52. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/history/__init__.py +0 -0
  53. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/history/constants.py +0 -0
  54. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/history/context_extraction.py +0 -0
  55. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/history/history_building.py +0 -0
  56. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/history/message_utils.py +0 -0
  57. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/messages.py +0 -0
  58. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/plan.py +0 -0
  59. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/research.py +0 -0
  60. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/specify.py +0 -0
  61. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/tasks.py +0 -0
  62. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/tools/__init__.py +0 -0
  63. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/tools/codebase/__init__.py +0 -0
  64. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/tools/codebase/codebase_shell.py +0 -0
  65. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/tools/codebase/directory_lister.py +0 -0
  66. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/tools/codebase/file_read.py +0 -0
  67. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/tools/codebase/models.py +0 -0
  68. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/tools/codebase/query_graph.py +0 -0
  69. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/tools/codebase/retrieve_code.py +0 -0
  70. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/tools/file_management.py +0 -0
  71. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/tools/user_interaction.py +0 -0
  72. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/tools/web_search/utils.py +0 -0
  73. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/agents/usage_manager.py +0 -0
  74. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/build_constants.py +0 -0
  75. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/cli/__init__.py +0 -0
  76. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/cli/codebase/__init__.py +0 -0
  77. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/cli/codebase/commands.py +0 -0
  78. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/cli/codebase/models.py +0 -0
  79. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/cli/export.py +0 -0
  80. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/cli/feedback.py +0 -0
  81. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/cli/plan.py +0 -0
  82. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/cli/research.py +0 -0
  83. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/cli/specify.py +0 -0
  84. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/cli/tasks.py +0 -0
  85. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/cli/update.py +0 -0
  86. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/cli/utils.py +0 -0
  87. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/codebase/__init__.py +0 -0
  88. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/codebase/core/__init__.py +0 -0
  89. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/codebase/core/change_detector.py +0 -0
  90. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/codebase/core/code_retrieval.py +0 -0
  91. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/codebase/core/cypher_models.py +0 -0
  92. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/codebase/core/ingestor.py +0 -0
  93. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/codebase/core/language_config.py +0 -0
  94. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/codebase/core/manager.py +0 -0
  95. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/codebase/core/nl_query.py +0 -0
  96. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/codebase/core/parser_loader.py +0 -0
  97. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/codebase/service.py +0 -0
  98. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/logging_config.py +0 -0
  99. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/__init__.py +0 -0
  100. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/agents/__init__.py +0 -0
  101. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/agents/export.j2 +0 -0
  102. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/agents/partials/codebase_understanding.j2 +0 -0
  103. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/agents/partials/common_agent_system_prompt.j2 +0 -0
  104. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/agents/partials/content_formatting.j2 +0 -0
  105. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/agents/partials/interactive_mode.j2 +0 -0
  106. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/agents/plan.j2 +0 -0
  107. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/agents/research.j2 +0 -0
  108. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/agents/specify.j2 +0 -0
  109. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/agents/state/codebase/codebase_graphs_available.j2 +0 -0
  110. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/agents/state/system_state.j2 +0 -0
  111. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/agents/tasks.j2 +0 -0
  112. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/codebase/__init__.py +0 -0
  113. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/codebase/cypher_query_patterns.j2 +0 -0
  114. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/codebase/cypher_system.j2 +0 -0
  115. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/codebase/enhanced_query_context.j2 +0 -0
  116. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/codebase/partials/cypher_rules.j2 +0 -0
  117. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/codebase/partials/graph_schema.j2 +0 -0
  118. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/codebase/partials/temporal_context.j2 +0 -0
  119. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/history/__init__.py +0 -0
  120. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/history/incremental_summarization.j2 +0 -0
  121. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/history/summarization.j2 +0 -0
  122. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/prompts/loader.py +0 -0
  123. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/py.typed +0 -0
  124. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/sdk/__init__.py +0 -0
  125. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/sdk/codebase.py +0 -0
  126. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/sdk/exceptions.py +0 -0
  127. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/sdk/models.py +0 -0
  128. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/sdk/services.py +0 -0
  129. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/sentry_telemetry.py +0 -0
  130. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/telemetry.py +0 -0
  131. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/tui/__init__.py +0 -0
  132. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/tui/commands/__init__.py +0 -0
  133. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/tui/components/prompt_input.py +0 -0
  134. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/tui/components/spinner.py +0 -0
  135. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/tui/components/splash.py +0 -0
  136. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/tui/components/vertical_tail.py +0 -0
  137. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/tui/filtered_codebase_service.py +0 -0
  138. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/tui/screens/chat.py +0 -0
  139. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/tui/screens/chat.tcss +0 -0
  140. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/tui/screens/chat_screen/__init__.py +0 -0
  141. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/tui/screens/chat_screen/hint_message.py +0 -0
  142. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/tui/screens/chat_screen/history.py +0 -0
  143. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/tui/screens/directory_setup.py +0 -0
  144. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/tui/screens/feedback.py +0 -0
  145. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/tui/screens/splash.py +0 -0
  146. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/tui/styles.tcss +0 -0
  147. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/tui/utils/__init__.py +0 -0
  148. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/tui/utils/mode_progress.py +0 -0
  149. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/utils/__init__.py +0 -0
  150. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/utils/env_utils.py +0 -0
  151. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/utils/file_system_utils.py +0 -0
  152. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/utils/source_detection.py +0 -0
  153. {shotgun_sh-0.1.16.dev2 → shotgun_sh-0.2.1.dev2}/src/shotgun/utils/update_checker.py +0 -0
@@ -15,6 +15,9 @@ src/shotgun/build_constants.py
15
15
 
16
16
  .DS_Store
17
17
 
18
+ # Tokenizer model files (downloaded on first use)
19
+ *.model
20
+
18
21
  # Created by https://www.toptal.com/developers/gitignore/api/python,visualstudiocode
19
22
  # Edit at https://www.toptal.com/developers/gitignore?templates=python,visualstudiocode
20
23
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shotgun-sh
3
- Version: 0.1.16.dev2
3
+ Version: 0.2.1.dev2
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
@@ -23,7 +23,6 @@ Classifier: Topic :: Utilities
23
23
  Requires-Python: >=3.11
24
24
  Requires-Dist: anthropic>=0.39.0
25
25
  Requires-Dist: genai-prices>=0.0.27
26
- Requires-Dist: google-generativeai>=0.8.5
27
26
  Requires-Dist: httpx>=0.27.0
28
27
  Requires-Dist: jinja2>=3.1.0
29
28
  Requires-Dist: kuzu>=0.7.0
@@ -33,6 +32,7 @@ Requires-Dist: packaging>=23.0
33
32
  Requires-Dist: posthog>=3.0.0
34
33
  Requires-Dist: pydantic-ai>=0.0.14
35
34
  Requires-Dist: rich>=13.0.0
35
+ Requires-Dist: sentencepiece>=0.2.0
36
36
  Requires-Dist: sentry-sdk[pure-eval]>=2.0.0
37
37
  Requires-Dist: textual-dev>=1.7.0
38
38
  Requires-Dist: textual>=6.1.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "shotgun-sh"
3
- version = "0.1.16.dev2"
3
+ version = "0.2.1.dev2"
4
4
  description = "AI-powered research, planning, and task management CLI tool"
5
5
  readme = "README.md"
6
6
  license = { text = "MIT" }
@@ -42,8 +42,8 @@ dependencies = [
42
42
  "watchdog>=4.0.0",
43
43
  "openai>=1.0.0",
44
44
  "anthropic>=0.39.0",
45
- "google-generativeai>=0.8.5",
46
45
  "tiktoken>=0.7.0",
46
+ "sentencepiece>=0.2.0",
47
47
  "packaging>=23.0",
48
48
  "genai-prices>=0.0.27",
49
49
  ]
@@ -18,7 +18,7 @@ from pydantic_ai.messages import (
18
18
  ModelRequest,
19
19
  )
20
20
 
21
- from shotgun.agents.config import ProviderType, get_config_manager, get_provider_model
21
+ from shotgun.agents.config import ProviderType, get_provider_model
22
22
  from shotgun.agents.models import AgentType
23
23
  from shotgun.logging_config import get_logger
24
24
  from shotgun.prompts import PromptLoader
@@ -115,14 +115,13 @@ def create_base_agent(
115
115
  """
116
116
  ensure_shotgun_directory_exists()
117
117
 
118
- # Get configured model or fall back to hardcoded default
118
+ # Get configured model or fall back to first available provider
119
119
  try:
120
120
  model_config = get_provider_model(provider)
121
- config_manager = get_config_manager()
122
- provider_name = provider or config_manager.load().default_provider
121
+ provider_name = model_config.provider
123
122
  logger.debug(
124
123
  "🤖 Creating agent with configured %s model: %s",
125
- provider_name.upper(),
124
+ provider_name.value.upper(),
126
125
  model_config.name,
127
126
  )
128
127
  # Use the Model instance directly (has API key baked in)
@@ -0,0 +1,33 @@
1
+ """Configuration constants for Shotgun agents."""
2
+
3
+ from enum import StrEnum, auto
4
+
5
+ # Field names
6
+ API_KEY_FIELD = "api_key"
7
+ USER_ID_FIELD = "user_id"
8
+ CONFIG_VERSION_FIELD = "config_version"
9
+
10
+
11
+ class ConfigSection(StrEnum):
12
+ """Configuration file section names (JSON keys)."""
13
+
14
+ OPENAI = auto()
15
+ ANTHROPIC = auto()
16
+ GOOGLE = auto()
17
+ SHOTGUN = auto()
18
+
19
+
20
+ # Backwards compatibility - deprecated
21
+ OPENAI_PROVIDER = ConfigSection.OPENAI.value
22
+ ANTHROPIC_PROVIDER = ConfigSection.ANTHROPIC.value
23
+ GOOGLE_PROVIDER = ConfigSection.GOOGLE.value
24
+ SHOTGUN_PROVIDER = ConfigSection.SHOTGUN.value
25
+
26
+ # Environment variable names
27
+ OPENAI_API_KEY_ENV = "OPENAI_API_KEY"
28
+ ANTHROPIC_API_KEY_ENV = "ANTHROPIC_API_KEY"
29
+ GEMINI_API_KEY_ENV = "GEMINI_API_KEY"
30
+ SHOTGUN_API_KEY_ENV = "SHOTGUN_API_KEY"
31
+
32
+ # Token limits
33
+ MEDIUM_TEXT_8K_TOKENS = 8192 # Default max_tokens for web search requests
@@ -1,7 +1,6 @@
1
1
  """Configuration manager for Shotgun CLI."""
2
2
 
3
3
  import json
4
- import os
5
4
  import uuid
6
5
  from pathlib import Path
7
6
  from typing import Any
@@ -12,18 +11,24 @@ from shotgun.logging_config import get_logger
12
11
  from shotgun.utils import get_shotgun_home
13
12
 
14
13
  from .constants import (
15
- ANTHROPIC_API_KEY_ENV,
16
- ANTHROPIC_PROVIDER,
17
14
  API_KEY_FIELD,
18
- GEMINI_API_KEY_ENV,
19
- GOOGLE_PROVIDER,
20
- OPENAI_API_KEY_ENV,
21
- OPENAI_PROVIDER,
15
+ ConfigSection,
16
+ )
17
+ from .models import (
18
+ AnthropicConfig,
19
+ GoogleConfig,
20
+ ModelName,
21
+ OpenAIConfig,
22
+ ProviderType,
23
+ ShotgunAccountConfig,
24
+ ShotgunConfig,
22
25
  )
23
- from .models import ProviderType, ShotgunConfig
24
26
 
25
27
  logger = get_logger(__name__)
26
28
 
29
+ # Type alias for provider configuration objects
30
+ ProviderConfig = OpenAIConfig | AnthropicConfig | GoogleConfig | ShotgunAccountConfig
31
+
27
32
 
28
33
  class ConfigManager:
29
34
  """Manager for Shotgun configuration."""
@@ -69,20 +74,56 @@ class ConfigManager:
69
74
  self._config = ShotgunConfig.model_validate(data)
70
75
  logger.debug("Configuration loaded successfully from %s", self.config_path)
71
76
 
72
- # Check if the default provider has a key, if not find one that does
73
- if not self.has_provider_key(self._config.default_provider):
74
- original_default = self._config.default_provider
75
- # Find first provider with a configured key
76
- for provider in ProviderType:
77
- if self.has_provider_key(provider):
77
+ # Validate selected_model if in BYOK mode (no Shotgun key)
78
+ if not self._provider_has_api_key(self._config.shotgun):
79
+ should_save = False
80
+
81
+ # If selected_model is set, verify its provider has a key
82
+ if self._config.selected_model:
83
+ from .models import MODEL_SPECS
84
+
85
+ if self._config.selected_model in MODEL_SPECS:
86
+ spec = MODEL_SPECS[self._config.selected_model]
87
+ if not self.has_provider_key(spec.provider):
88
+ logger.info(
89
+ "Selected model %s provider has no API key, finding available model",
90
+ self._config.selected_model.value,
91
+ )
92
+ self._config.selected_model = None
93
+ should_save = True
94
+ else:
78
95
  logger.info(
79
- "Default provider %s has no API key, updating to %s",
80
- original_default.value,
81
- provider.value,
96
+ "Selected model %s not found in MODEL_SPECS, resetting",
97
+ self._config.selected_model.value,
82
98
  )
83
- self._config.default_provider = provider
84
- self.save(self._config)
85
- break
99
+ self._config.selected_model = None
100
+ should_save = True
101
+
102
+ # If no selected_model or it was invalid, find first available model
103
+ if not self._config.selected_model:
104
+ for provider in ProviderType:
105
+ if self.has_provider_key(provider):
106
+ # Set to that provider's default model
107
+ from .models import MODEL_SPECS, ModelName
108
+
109
+ # Find default model for this provider
110
+ provider_models = {
111
+ ProviderType.OPENAI: ModelName.GPT_5,
112
+ ProviderType.ANTHROPIC: ModelName.CLAUDE_OPUS_4_1,
113
+ ProviderType.GOOGLE: ModelName.GEMINI_2_5_PRO,
114
+ }
115
+
116
+ if provider in provider_models:
117
+ self._config.selected_model = provider_models[provider]
118
+ logger.info(
119
+ "Set selected_model to %s (first available provider)",
120
+ self._config.selected_model.value,
121
+ )
122
+ should_save = True
123
+ break
124
+
125
+ if should_save:
126
+ self.save(self._config)
86
127
 
87
128
  return self._config
88
129
 
@@ -107,7 +148,6 @@ class ConfigManager:
107
148
  # Create a new config with generated user_id
108
149
  config = ShotgunConfig(
109
150
  user_id=str(uuid.uuid4()),
110
- config_version=1,
111
151
  )
112
152
 
113
153
  # Ensure directory exists
@@ -136,8 +176,13 @@ class ConfigManager:
136
176
  **kwargs: Configuration fields to update (only api_key supported)
137
177
  """
138
178
  config = self.load()
139
- provider_enum = self._ensure_provider_enum(provider)
140
- provider_config = self._get_provider_config(config, provider_enum)
179
+
180
+ # Get provider config and check if it's shotgun
181
+ provider_config, is_shotgun = self._get_provider_config_and_type(
182
+ config, provider
183
+ )
184
+ # For non-shotgun providers, we need the enum for default provider logic
185
+ provider_enum = None if is_shotgun else self._ensure_provider_enum(provider)
141
186
 
142
187
  # Only support api_key updates
143
188
  if API_KEY_FIELD in kwargs:
@@ -152,50 +197,63 @@ class ConfigManager:
152
197
  raise ValueError(f"Unsupported configuration fields: {unsupported_fields}")
153
198
 
154
199
  # If no other providers have keys configured and we just added one,
155
- # set this provider as the default
156
- if API_KEY_FIELD in kwargs and api_key_value is not None:
200
+ # set selected_model to that provider's default model (only for LLM providers, not shotgun)
201
+ if not is_shotgun and API_KEY_FIELD in kwargs and api_key_value is not None:
202
+ # provider_enum is guaranteed to be non-None here since is_shotgun is False
203
+ if provider_enum is None:
204
+ raise RuntimeError("Provider enum should not be None for LLM providers")
157
205
  other_providers = [p for p in ProviderType if p != provider_enum]
158
206
  has_other_keys = any(self.has_provider_key(p) for p in other_providers)
159
207
  if not has_other_keys:
160
- config.default_provider = provider_enum
208
+ # Set selected_model to this provider's default model
209
+ from .models import ModelName
210
+
211
+ provider_models = {
212
+ ProviderType.OPENAI: ModelName.GPT_5,
213
+ ProviderType.ANTHROPIC: ModelName.CLAUDE_OPUS_4_1,
214
+ ProviderType.GOOGLE: ModelName.GEMINI_2_5_PRO,
215
+ }
216
+ if provider_enum in provider_models:
217
+ config.selected_model = provider_models[provider_enum]
161
218
 
162
219
  self.save(config)
163
220
 
164
221
  def clear_provider_key(self, provider: ProviderType | str) -> None:
165
- """Remove the API key for the given provider."""
222
+ """Remove the API key for the given provider (LLM provider or shotgun)."""
166
223
  config = self.load()
167
- provider_enum = self._ensure_provider_enum(provider)
168
- provider_config = self._get_provider_config(config, provider_enum)
224
+
225
+ # Get provider config (shotgun or LLM provider)
226
+ provider_config, _ = self._get_provider_config_and_type(config, provider)
227
+
169
228
  provider_config.api_key = None
170
229
  self.save(config)
171
230
 
231
+ def update_selected_model(self, model_name: "ModelName") -> None:
232
+ """Update the selected model.
233
+
234
+ Args:
235
+ model_name: Model to select
236
+ """
237
+ config = self.load()
238
+ config.selected_model = model_name
239
+ self.save(config)
240
+
172
241
  def has_provider_key(self, provider: ProviderType | str) -> bool:
173
242
  """Check if the given provider has a non-empty API key configured.
174
243
 
175
- This checks both the configuration file and environment variables.
244
+ This checks only the configuration file.
176
245
  """
177
246
  config = self.load()
178
247
  provider_enum = self._ensure_provider_enum(provider)
179
248
  provider_config = self._get_provider_config(config, provider_enum)
180
249
 
181
- # Check config first
182
- if self._provider_has_api_key(provider_config):
183
- return True
184
-
185
- # Check environment variable
186
- if provider_enum == ProviderType.OPENAI:
187
- return bool(os.getenv(OPENAI_API_KEY_ENV))
188
- elif provider_enum == ProviderType.ANTHROPIC:
189
- return bool(os.getenv(ANTHROPIC_API_KEY_ENV))
190
- elif provider_enum == ProviderType.GOOGLE:
191
- return bool(os.getenv(GEMINI_API_KEY_ENV))
192
-
193
- return False
250
+ return self._provider_has_api_key(provider_config)
194
251
 
195
252
  def has_any_provider_key(self) -> bool:
196
253
  """Determine whether any provider has a configured API key."""
197
254
  config = self.load()
198
- return any(
255
+ # Check LLM provider keys (BYOK)
256
+ has_llm_key = any(
199
257
  self._provider_has_api_key(self._get_provider_config(config, provider))
200
258
  for provider in (
201
259
  ProviderType.OPENAI,
@@ -203,6 +261,9 @@ class ConfigManager:
203
261
  ProviderType.GOOGLE,
204
262
  )
205
263
  )
264
+ # Also check Shotgun Account key
265
+ has_shotgun_key = self._provider_has_api_key(config.shotgun)
266
+ return has_llm_key or has_shotgun_key
206
267
 
207
268
  def initialize(self) -> ShotgunConfig:
208
269
  """Initialize configuration with defaults and save to file.
@@ -213,7 +274,6 @@ class ConfigManager:
213
274
  # Generate unique user ID for new config
214
275
  config = ShotgunConfig(
215
276
  user_id=str(uuid.uuid4()),
216
- config_version=1,
217
277
  )
218
278
  self.save(config)
219
279
  logger.info(
@@ -225,26 +285,26 @@ class ConfigManager:
225
285
 
226
286
  def _convert_secrets_to_secretstr(self, data: dict[str, Any]) -> None:
227
287
  """Convert plain text secrets in data to SecretStr objects."""
228
- for provider in [OPENAI_PROVIDER, ANTHROPIC_PROVIDER, GOOGLE_PROVIDER]:
229
- if provider in data and isinstance(data[provider], dict):
288
+ for section in ConfigSection:
289
+ if section.value in data and isinstance(data[section.value], dict):
230
290
  if (
231
- API_KEY_FIELD in data[provider]
232
- and data[provider][API_KEY_FIELD] is not None
291
+ API_KEY_FIELD in data[section.value]
292
+ and data[section.value][API_KEY_FIELD] is not None
233
293
  ):
234
- data[provider][API_KEY_FIELD] = SecretStr(
235
- data[provider][API_KEY_FIELD]
294
+ data[section.value][API_KEY_FIELD] = SecretStr(
295
+ data[section.value][API_KEY_FIELD]
236
296
  )
237
297
 
238
298
  def _convert_secretstr_to_plain(self, data: dict[str, Any]) -> None:
239
299
  """Convert SecretStr objects in data to plain text for JSON serialization."""
240
- for provider in [OPENAI_PROVIDER, ANTHROPIC_PROVIDER, GOOGLE_PROVIDER]:
241
- if provider in data and isinstance(data[provider], dict):
300
+ for section in ConfigSection:
301
+ if section.value in data and isinstance(data[section.value], dict):
242
302
  if (
243
- API_KEY_FIELD in data[provider]
244
- and data[provider][API_KEY_FIELD] is not None
303
+ API_KEY_FIELD in data[section.value]
304
+ and data[section.value][API_KEY_FIELD] is not None
245
305
  ):
246
- if hasattr(data[provider][API_KEY_FIELD], "get_secret_value"):
247
- data[provider][API_KEY_FIELD] = data[provider][
306
+ if hasattr(data[section.value][API_KEY_FIELD], "get_secret_value"):
307
+ data[section.value][API_KEY_FIELD] = data[section.value][
248
308
  API_KEY_FIELD
249
309
  ].get_secret_value()
250
310
 
@@ -279,6 +339,38 @@ class ConfigManager:
279
339
 
280
340
  return bool(value.strip())
281
341
 
342
+ def _is_shotgun_provider(self, provider: ProviderType | str) -> bool:
343
+ """Check if provider string represents Shotgun Account.
344
+
345
+ Args:
346
+ provider: Provider type or string
347
+
348
+ Returns:
349
+ True if provider is shotgun account
350
+ """
351
+ return (
352
+ isinstance(provider, str)
353
+ and provider.lower() == ConfigSection.SHOTGUN.value
354
+ )
355
+
356
+ def _get_provider_config_and_type(
357
+ self, config: ShotgunConfig, provider: ProviderType | str
358
+ ) -> tuple[ProviderConfig, bool]:
359
+ """Get provider config, handling shotgun as special case.
360
+
361
+ Args:
362
+ config: Shotgun configuration
363
+ provider: Provider type or string
364
+
365
+ Returns:
366
+ Tuple of (provider_config, is_shotgun)
367
+ """
368
+ if self._is_shotgun_provider(provider):
369
+ return (config.shotgun, True)
370
+
371
+ provider_enum = self._ensure_provider_enum(provider)
372
+ return (self._get_provider_config(config, provider_enum), False)
373
+
282
374
  def get_user_id(self) -> str:
283
375
  """Get the user ID from configuration.
284
376
 
@@ -0,0 +1,166 @@
1
+ """Pydantic models for configuration."""
2
+
3
+ from enum import StrEnum
4
+
5
+ from pydantic import BaseModel, Field, PrivateAttr, SecretStr
6
+ from pydantic_ai.models import Model
7
+
8
+
9
+ class ProviderType(StrEnum):
10
+ """Provider types for AI services."""
11
+
12
+ OPENAI = "openai"
13
+ ANTHROPIC = "anthropic"
14
+ GOOGLE = "google"
15
+
16
+
17
+ class KeyProvider(StrEnum):
18
+ """Authentication method for accessing AI models."""
19
+
20
+ BYOK = "byok" # Bring Your Own Key (individual provider keys)
21
+ SHOTGUN = "shotgun" # Shotgun Account (unified LiteLLM proxy)
22
+
23
+
24
+ class ModelName(StrEnum):
25
+ """Available AI model names."""
26
+
27
+ GPT_5 = "gpt-5"
28
+ GPT_5_MINI = "gpt-5-mini"
29
+ CLAUDE_OPUS_4_1 = "claude-opus-4-1"
30
+ CLAUDE_SONNET_4_5 = "claude-sonnet-4-5"
31
+ GEMINI_2_5_PRO = "gemini-2.5-pro"
32
+ GEMINI_2_5_FLASH = "gemini-2.5-flash"
33
+
34
+
35
+ class ModelSpec(BaseModel):
36
+ """Static specification for a model - just metadata."""
37
+
38
+ name: ModelName # Model identifier
39
+ provider: ProviderType
40
+ max_input_tokens: int
41
+ max_output_tokens: int
42
+ litellm_proxy_model_name: (
43
+ str # LiteLLM format (e.g., "openai/gpt-5", "gemini/gemini-2-pro")
44
+ )
45
+
46
+
47
+ class ModelConfig(BaseModel):
48
+ """A fully configured model with API key and settings."""
49
+
50
+ name: ModelName # Model identifier
51
+ provider: ProviderType # Actual LLM provider (openai, anthropic, google)
52
+ key_provider: KeyProvider # Authentication method (byok or shotgun)
53
+ max_input_tokens: int
54
+ max_output_tokens: int
55
+ api_key: str
56
+ _model_instance: Model | None = PrivateAttr(default=None)
57
+
58
+ class Config:
59
+ arbitrary_types_allowed = True
60
+
61
+ @property
62
+ def model_instance(self) -> Model:
63
+ """Lazy load the Model instance."""
64
+ if self._model_instance is None:
65
+ from .provider import get_or_create_model
66
+
67
+ self._model_instance = get_or_create_model(
68
+ self.provider, self.key_provider, self.name, self.api_key
69
+ )
70
+ return self._model_instance
71
+
72
+ @property
73
+ def pydantic_model_name(self) -> str:
74
+ """Compute the full Pydantic AI model identifier. For backward compatibility."""
75
+ provider_prefix = {
76
+ ProviderType.OPENAI: "openai",
77
+ ProviderType.ANTHROPIC: "anthropic",
78
+ ProviderType.GOOGLE: "google-gla",
79
+ }
80
+ return f"{provider_prefix[self.provider]}:{self.name}"
81
+
82
+
83
+ # Model specifications registry (static metadata)
84
+ MODEL_SPECS: dict[ModelName, ModelSpec] = {
85
+ ModelName.GPT_5: ModelSpec(
86
+ name=ModelName.GPT_5,
87
+ provider=ProviderType.OPENAI,
88
+ max_input_tokens=400_000,
89
+ max_output_tokens=128_000,
90
+ litellm_proxy_model_name="openai/gpt-5",
91
+ ),
92
+ ModelName.GPT_5_MINI: ModelSpec(
93
+ name=ModelName.GPT_5_MINI,
94
+ provider=ProviderType.OPENAI,
95
+ max_input_tokens=400_000,
96
+ max_output_tokens=128_000,
97
+ litellm_proxy_model_name="openai/gpt-5-mini",
98
+ ),
99
+ ModelName.CLAUDE_OPUS_4_1: ModelSpec(
100
+ name=ModelName.CLAUDE_OPUS_4_1,
101
+ provider=ProviderType.ANTHROPIC,
102
+ max_input_tokens=200_000,
103
+ max_output_tokens=32_000,
104
+ litellm_proxy_model_name="anthropic/claude-opus-4-1",
105
+ ),
106
+ ModelName.CLAUDE_SONNET_4_5: ModelSpec(
107
+ name=ModelName.CLAUDE_SONNET_4_5,
108
+ provider=ProviderType.ANTHROPIC,
109
+ max_input_tokens=200_000,
110
+ max_output_tokens=16_000,
111
+ litellm_proxy_model_name="anthropic/claude-sonnet-4-5",
112
+ ),
113
+ ModelName.GEMINI_2_5_PRO: ModelSpec(
114
+ name=ModelName.GEMINI_2_5_PRO,
115
+ provider=ProviderType.GOOGLE,
116
+ max_input_tokens=1_000_000,
117
+ max_output_tokens=64_000,
118
+ litellm_proxy_model_name="gemini/gemini-2.5-pro",
119
+ ),
120
+ ModelName.GEMINI_2_5_FLASH: ModelSpec(
121
+ name=ModelName.GEMINI_2_5_FLASH,
122
+ provider=ProviderType.GOOGLE,
123
+ max_input_tokens=1_000_000,
124
+ max_output_tokens=64_000,
125
+ litellm_proxy_model_name="gemini/gemini-2.5-flash",
126
+ ),
127
+ }
128
+
129
+
130
+ class OpenAIConfig(BaseModel):
131
+ """Configuration for OpenAI provider."""
132
+
133
+ api_key: SecretStr | None = None
134
+
135
+
136
+ class AnthropicConfig(BaseModel):
137
+ """Configuration for Anthropic provider."""
138
+
139
+ api_key: SecretStr | None = None
140
+
141
+
142
+ class GoogleConfig(BaseModel):
143
+ """Configuration for Google provider."""
144
+
145
+ api_key: SecretStr | None = None
146
+
147
+
148
+ class ShotgunAccountConfig(BaseModel):
149
+ """Configuration for Shotgun Account (LiteLLM proxy)."""
150
+
151
+ api_key: SecretStr | None = None
152
+
153
+
154
+ class ShotgunConfig(BaseModel):
155
+ """Main configuration for Shotgun CLI."""
156
+
157
+ openai: OpenAIConfig = Field(default_factory=OpenAIConfig)
158
+ anthropic: AnthropicConfig = Field(default_factory=AnthropicConfig)
159
+ google: GoogleConfig = Field(default_factory=GoogleConfig)
160
+ shotgun: ShotgunAccountConfig = Field(default_factory=ShotgunAccountConfig)
161
+ selected_model: ModelName | None = Field(
162
+ default=None,
163
+ description="User-selected model",
164
+ )
165
+ user_id: str = Field(description="Unique anonymous user identifier")
166
+ config_version: int = Field(default=2, description="Configuration schema version")