tunacode-cli 0.1.24__tar.gz → 0.1.28__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 tunacode-cli might be problematic. Click here for more details.

Files changed (318) hide show
  1. tunacode_cli-0.1.28/.claude/JOURNAL.md +278 -0
  2. tunacode_cli-0.1.28/.claude/debug_history/list-dir-tool-execution-error.md +55 -0
  3. tunacode_cli-0.1.28/.claude/qa/no-cargo-cult-fixes.md +52 -0
  4. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/.gitignore +2 -0
  5. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/.pre-commit-config.yaml +4 -0
  6. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/CHANGELOG.md +44 -0
  7. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/CLAUDE.md +32 -1
  8. tunacode_cli-0.1.28/CLAUDE_LOCAL.md +72 -0
  9. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/PKG-INFO +12 -8
  10. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/README.md +11 -6
  11. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/MAP.md +0 -1
  12. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/architecture/architecture.md +94 -2
  13. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/modules/INDEX.md +3 -1
  14. tunacode_cli-0.1.28/docs/codebase-map/modules/core-agents.md +217 -0
  15. tunacode_cli-0.1.28/docs/codebase-map/modules/core-compaction.md +163 -0
  16. tunacode_cli-0.1.28/docs/codebase-map/modules/core-limits.md +171 -0
  17. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/modules/core-prompting.md +31 -11
  18. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/modules/tools-overview.md +5 -0
  19. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/modules/utils.md +4 -0
  20. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/state/state.md +7 -7
  21. tunacode_cli-0.1.28/docs/configuration/README.md +90 -0
  22. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/configuration/tunacode.json.example +7 -0
  23. tunacode_cli-0.1.28/docs/configuration/tunacode.local.json.example +34 -0
  24. tunacode_cli-0.1.28/docs/media/agent-response.png +0 -0
  25. tunacode_cli-0.1.28/docs/media/plan-approval.png +0 -0
  26. tunacode_cli-0.1.28/docs/media/read-file-tool.png +0 -0
  27. tunacode_cli-0.1.28/docs/ui/agent_response_panel.md +92 -0
  28. tunacode_cli-0.1.28/docs/ui/tool_renderers.md +249 -0
  29. tunacode_cli-0.1.28/memory-bank/execute/2026-01-07_23-25-00_glob-grep-modelretry.md +121 -0
  30. tunacode_cli-0.1.28/memory-bank/execute/2026-01-08_22-30-00_agent-response-panel.md +55 -0
  31. tunacode_cli-0.1.28/memory-bank/execute/2026-01-09_19-05-00_register-present-plan-tool-222.md +95 -0
  32. tunacode_cli-0.1.28/memory-bank/plan/2026-01-07_16-30-00_renderer-unification.md +156 -0
  33. tunacode_cli-0.1.28/memory-bank/plan/2026-01-07_23-12-56_glob-grep-modelretry.md +165 -0
  34. tunacode_cli-0.1.28/memory-bank/plan/2026-01-08_agent-response-panel.md +211 -0
  35. tunacode_cli-0.1.28/memory-bank/plan/2026-01-09_19-00-00_register-present-plan-tool-222.md +139 -0
  36. tunacode_cli-0.1.28/memory-bank/plan/subplan-renderer-ui.md +139 -0
  37. tunacode_cli-0.1.28/memory-bank/research/2026-01-07_23-10-22_glob-grep-error-strings.md +207 -0
  38. tunacode_cli-0.1.28/memory-bank/research/2026-01-07_panel-architecture-map.md +229 -0
  39. tunacode_cli-0.1.28/memory-bank/research/2026-01-07_pydantic-v2-analysis.md +142 -0
  40. tunacode_cli-0.1.28/memory-bank/research/2026-01-08_14-14-39_local-mode-docs.md +147 -0
  41. tunacode_cli-0.1.28/memory-bank/research/2026-01-08_14-20-00_messages-and-pruning-local-vs-api.md +229 -0
  42. tunacode_cli-0.1.28/memory-bank/research/2026-01-08_23-46-19_plan-permission-keeps-asking.md +150 -0
  43. tunacode_cli-0.1.28/memory-bank/research/2026-01-08_agent-reply-rendering-analysis.md +178 -0
  44. tunacode_cli-0.1.28/memory-bank/research/2026-01-08_raw-code-rendering-gaps.md +255 -0
  45. tunacode_cli-0.1.28/memory-bank/research/2026-01-08_ui-model-selector-logic.md +257 -0
  46. tunacode_cli-0.1.28/memory-bank/research/2026-01-09_11-33-26_grep-read-performance.md +203 -0
  47. tunacode_cli-0.1.28/memory-bank/research/2026-01-09_18-41-11_register-present-plan-tool-222.md +131 -0
  48. tunacode_cli-0.1.28/memory-bank/research/2026-01-09_simple-prompt-evals.md +153 -0
  49. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/pyproject.toml +1 -2
  50. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/scripts/check-file-length.sh +1 -0
  51. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/constants.py +28 -9
  52. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/agents/agent_components/agent_config.py +89 -37
  53. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/agents/agent_components/agent_helpers.py +2 -1
  54. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/agents/agent_components/message_handler.py +2 -2
  55. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/agents/agent_components/node_processor.py +8 -8
  56. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/agents/research_agent.py +3 -1
  57. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/compaction.py +24 -5
  58. tunacode_cli-0.1.28/src/tunacode/core/limits.py +96 -0
  59. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/prompting/__init__.py +2 -0
  60. tunacode_cli-0.1.28/src/tunacode/core/prompting/local_prompt.md +72 -0
  61. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/prompting/templates.py +17 -0
  62. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/state.py +4 -0
  63. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/lsp/__init__.py +0 -2
  64. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/prompts/sections/tool_use.xml +9 -7
  65. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/authorization/context.py +4 -3
  66. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/authorization/factory.py +2 -0
  67. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/authorization/handler.py +9 -2
  68. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/authorization/notifier.py +14 -9
  69. tunacode_cli-0.1.28/src/tunacode/tools/authorization/policy.py +40 -0
  70. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/authorization/rules.py +20 -1
  71. tunacode_cli-0.1.28/src/tunacode/tools/authorization/types.py +18 -0
  72. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/bash.py +3 -2
  73. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/decorators.py +5 -0
  74. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/glob.py +6 -20
  75. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/grep.py +73 -72
  76. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/grep_components/file_filter.py +3 -14
  77. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/list_dir.py +15 -52
  78. tunacode_cli-0.1.28/src/tunacode/tools/present_plan.py +102 -0
  79. tunacode_cli-0.1.28/src/tunacode/tools/prompts/present_plan_prompt.xml +42 -0
  80. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/react.py +3 -3
  81. tunacode_cli-0.1.28/src/tunacode/tools/read_file.py +96 -0
  82. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/todo.py +4 -4
  83. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/utils/ripgrep.py +44 -15
  84. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/types/__init__.py +2 -4
  85. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/types/state.py +18 -4
  86. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/app.py +60 -10
  87. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/commands/__init__.py +54 -1
  88. tunacode_cli-0.1.28/src/tunacode/ui/plan_approval.py +144 -0
  89. tunacode_cli-0.1.28/src/tunacode/ui/renderers/agent_response.py +208 -0
  90. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/renderers/panels.py +0 -8
  91. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/renderers/search.py +1 -2
  92. tunacode_cli-0.1.28/src/tunacode/ui/renderers/tools/__init__.py +73 -0
  93. tunacode_cli-0.1.28/src/tunacode/ui/renderers/tools/base.py +441 -0
  94. tunacode_cli-0.1.28/src/tunacode/ui/renderers/tools/bash.py +242 -0
  95. tunacode_cli-0.1.28/src/tunacode/ui/renderers/tools/glob.py +241 -0
  96. tunacode_cli-0.1.28/src/tunacode/ui/renderers/tools/grep.py +228 -0
  97. tunacode_cli-0.1.28/src/tunacode/ui/renderers/tools/list_dir.py +217 -0
  98. tunacode_cli-0.1.28/src/tunacode/ui/renderers/tools/read_file.py +211 -0
  99. tunacode_cli-0.1.28/src/tunacode/ui/renderers/tools/research.py +284 -0
  100. tunacode_cli-0.1.28/src/tunacode/ui/renderers/tools/syntax_utils.py +225 -0
  101. tunacode_cli-0.1.28/src/tunacode/ui/renderers/tools/update_file.py +268 -0
  102. tunacode_cli-0.1.28/src/tunacode/ui/renderers/tools/web_fetch.py +176 -0
  103. tunacode_cli-0.1.28/src/tunacode/ui/renderers/tools/write_file.py +143 -0
  104. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/repl_support.py +10 -2
  105. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/styles/layout.tcss +4 -4
  106. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/styles/theme-nextstep.tcss +12 -1
  107. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/widgets/resource_bar.py +0 -3
  108. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/utils/config/user_configuration.py +3 -3
  109. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/utils/messaging/__init__.py +1 -2
  110. tunacode_cli-0.1.28/src/tunacode/utils/messaging/token_counter.py +20 -0
  111. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/utils/parsing/command_parser.py +4 -3
  112. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/utils/parsing/retry.py +9 -2
  113. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/utils/parsing/tool_parser.py +3 -2
  114. tunacode_cli-0.1.28/src/tunacode/utils/system/gitignore.py +80 -0
  115. tunacode_cli-0.1.28/src/tunacode/utils/system/ignore_patterns.py +130 -0
  116. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/utils/ui/file_filter.py +2 -21
  117. tunacode_cli-0.1.28/tests/test_base_renderer.py +79 -0
  118. tunacode_cli-0.1.28/tests/test_base_tool_renderer.py +182 -0
  119. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/tests/test_compaction.py +7 -1
  120. tunacode_cli-0.1.28/tests/test_glob_grep_path_validation.py +70 -0
  121. tunacode_cli-0.1.28/tests/test_limits.py +245 -0
  122. tunacode_cli-0.1.28/tests/test_present_plan.py +118 -0
  123. tunacode_cli-0.1.28/tests/test_token_counter.py +79 -0
  124. tunacode_cli-0.1.28/tests/test_tool_performance.py +281 -0
  125. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/tests/test_update_file_renderer.py +4 -3
  126. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/uv.lock +1 -107
  127. tunacode_cli-0.1.24/docs/codebase-map/modules/core-agents.md +0 -110
  128. tunacode_cli-0.1.24/docs/codebase-map/modules/core-compaction.md +0 -68
  129. tunacode_cli-0.1.24/docs/configuration/README.md +0 -20
  130. tunacode_cli-0.1.24/src/tunacode/tools/authorization/policy.py +0 -19
  131. tunacode_cli-0.1.24/src/tunacode/tools/read_file.py +0 -68
  132. tunacode_cli-0.1.24/src/tunacode/ui/renderers/tools/__init__.py +0 -21
  133. tunacode_cli-0.1.24/src/tunacode/ui/renderers/tools/bash.py +0 -247
  134. tunacode_cli-0.1.24/src/tunacode/ui/renderers/tools/glob.py +0 -226
  135. tunacode_cli-0.1.24/src/tunacode/ui/renderers/tools/grep.py +0 -228
  136. tunacode_cli-0.1.24/src/tunacode/ui/renderers/tools/list_dir.py +0 -198
  137. tunacode_cli-0.1.24/src/tunacode/ui/renderers/tools/read_file.py +0 -226
  138. tunacode_cli-0.1.24/src/tunacode/ui/renderers/tools/research.py +0 -294
  139. tunacode_cli-0.1.24/src/tunacode/ui/renderers/tools/update_file.py +0 -237
  140. tunacode_cli-0.1.24/src/tunacode/ui/renderers/tools/web_fetch.py +0 -182
  141. tunacode_cli-0.1.24/src/tunacode/utils/messaging/token_counter.py +0 -77
  142. tunacode_cli-0.1.24/src/tunacode/utils/system/gitignore.py +0 -155
  143. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/.github/pull_request_template.md +0 -0
  144. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/.github/workflows/lint.yml +0 -0
  145. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/.github/workflows/publish-release.yml +0 -0
  146. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/AGENTS.md +0 -0
  147. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/CONTRIBUTING.md +0 -0
  148. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/LICENSE +0 -0
  149. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/MANIFEST.in +0 -0
  150. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/assets/tunacode_example.png +0 -0
  151. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/modules/00-overview.md +0 -0
  152. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/modules/configuration.md +0 -0
  153. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/modules/constants.md +0 -0
  154. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/modules/core-state.md +0 -0
  155. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/modules/exceptions.md +0 -0
  156. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/modules/indexing.md +0 -0
  157. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/modules/lsp.md +0 -0
  158. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/modules/prompts.md +0 -0
  159. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/modules/templates.md +0 -0
  160. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/modules/types.md +0 -0
  161. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/modules/ui-overview.md +0 -0
  162. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/structure/00-root-overview.md +0 -0
  163. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/structure/01-ui-directory.md +0 -0
  164. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/structure/02-core-directory.md +0 -0
  165. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/structure/03-tools-directory.md +0 -0
  166. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/structure/04-configuration-directory.md +0 -0
  167. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/structure/05-cli-directory.md +0 -0
  168. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/structure/06-supporting-modules.md +0 -0
  169. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/structure/ANALYSIS_SUMMARY.md +0 -0
  170. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/structure/README.md +0 -0
  171. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/codebase-map/structure/tree-structure.txt +0 -0
  172. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/images/theme.png +0 -0
  173. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/images/tui-model-setup.png +0 -0
  174. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/images/tui.png +0 -0
  175. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/tools/architecture.md +0 -0
  176. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/ui/design_philosophy.md +0 -0
  177. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/docs/ui/nextstep_panels.md +0 -0
  178. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/pytest.ini +0 -0
  179. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/scripts/download_ripgrep.py +0 -0
  180. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/scripts/install_linux.sh +0 -0
  181. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/scripts/playwright_cache.py +0 -0
  182. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/scripts/run-dead-imports.sh +0 -0
  183. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/scripts/startup_timer.py +0 -0
  184. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/scripts/ui_import_timer.py +0 -0
  185. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/scripts/uninstall.sh +0 -0
  186. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/scripts/update_models_registry.sh +0 -0
  187. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/scripts/utils/vulture_whitelist.py +0 -0
  188. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/__init__.py +0 -0
  189. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/cli/textual_repl.tcss +0 -0
  190. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/configuration/__init__.py +0 -0
  191. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/configuration/defaults.py +0 -0
  192. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/configuration/models.py +0 -0
  193. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/configuration/models_registry.json +0 -0
  194. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/configuration/pricing.py +0 -0
  195. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/configuration/settings.py +0 -0
  196. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/__init__.py +0 -0
  197. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/agents/__init__.py +0 -0
  198. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/agents/agent_components/__init__.py +0 -0
  199. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/agents/agent_components/response_state.py +0 -0
  200. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/agents/agent_components/result_wrapper.py +0 -0
  201. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/agents/agent_components/state_transition.py +0 -0
  202. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/agents/agent_components/streaming.py +0 -0
  203. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/agents/agent_components/task_completion.py +0 -0
  204. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/agents/agent_components/tool_buffer.py +0 -0
  205. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/agents/agent_components/tool_executor.py +0 -0
  206. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/agents/agent_components/truncation_checker.py +0 -0
  207. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/agents/delegation_tools.py +0 -0
  208. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/agents/main.py +0 -0
  209. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/agents/prompts.py +0 -0
  210. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/prompting/loader.py +0 -0
  211. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/prompting/prompting_engine.py +0 -0
  212. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/core/prompting/sections.py +0 -0
  213. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/exceptions.py +0 -0
  214. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/indexing/__init__.py +0 -0
  215. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/indexing/code_index.py +0 -0
  216. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/indexing/constants.py +0 -0
  217. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/lsp/client.py +0 -0
  218. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/lsp/diagnostics.py +0 -0
  219. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/lsp/servers.py +0 -0
  220. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/prompts/default_prompt.md +0 -0
  221. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/prompts/research/sections/agent_role.xml +0 -0
  222. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/prompts/research/sections/constraints.xml +0 -0
  223. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/prompts/research/sections/output_format.xml +0 -0
  224. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/prompts/research/sections/tool_use.xml +0 -0
  225. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/prompts/sections/advanced_patterns.xml +0 -0
  226. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/prompts/sections/agent_role.xml +0 -0
  227. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/prompts/sections/completion.xml +0 -0
  228. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/prompts/sections/critical_rules.xml +0 -0
  229. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/prompts/sections/examples.xml +0 -0
  230. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/prompts/sections/output_style.xml +0 -0
  231. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/prompts/sections/parallel_exec.xml +0 -0
  232. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/prompts/sections/search_pattern.xml +0 -0
  233. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/prompts/sections/system_info.xml +0 -0
  234. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/prompts/sections/user_instructions.xml +0 -0
  235. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/py.typed +0 -0
  236. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/templates/__init__.py +0 -0
  237. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/templates/loader.py +0 -0
  238. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/__init__.py +0 -0
  239. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/authorization/__init__.py +0 -0
  240. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/authorization/requests.py +0 -0
  241. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/grep_components/__init__.py +0 -0
  242. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/grep_components/pattern_matcher.py +0 -0
  243. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/grep_components/result_formatter.py +0 -0
  244. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/grep_components/search_result.py +0 -0
  245. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/prompts/bash_prompt.xml +0 -0
  246. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/prompts/glob_prompt.xml +0 -0
  247. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/prompts/grep_prompt.xml +0 -0
  248. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/prompts/list_dir_prompt.xml +0 -0
  249. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/prompts/read_file_prompt.xml +0 -0
  250. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/prompts/todoclear_prompt.xml +0 -0
  251. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/prompts/todoread_prompt.xml +0 -0
  252. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/prompts/todowrite_prompt.xml +0 -0
  253. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/prompts/update_file_prompt.xml +0 -0
  254. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/prompts/web_fetch_prompt.xml +0 -0
  255. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/prompts/write_file_prompt.xml +0 -0
  256. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/update_file.py +0 -0
  257. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/utils/__init__.py +0 -0
  258. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/utils/text_match.py +0 -0
  259. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/web_fetch.py +0 -0
  260. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/write_file.py +0 -0
  261. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/tools/xml_helper.py +0 -0
  262. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/types/base.py +0 -0
  263. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/types/callbacks.py +0 -0
  264. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/types/dataclasses.py +0 -0
  265. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/types/pydantic_ai.py +0 -0
  266. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/__init__.py +0 -0
  267. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/components/__init__.py +0 -0
  268. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/headless/__init__.py +0 -0
  269. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/headless/output.py +0 -0
  270. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/main.py +0 -0
  271. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/renderers/__init__.py +0 -0
  272. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/renderers/errors.py +0 -0
  273. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/renderers/tools/diagnostics.py +0 -0
  274. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/screens/__init__.py +0 -0
  275. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/screens/model_picker.py +0 -0
  276. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/screens/session_picker.py +0 -0
  277. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/screens/setup.py +0 -0
  278. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/screens/theme_picker.py +0 -0
  279. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/screens/update_confirm.py +0 -0
  280. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/shell_runner.py +0 -0
  281. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/styles/modals.tcss +0 -0
  282. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/styles/panels.tcss +0 -0
  283. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/styles/widgets.tcss +0 -0
  284. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/styles.py +0 -0
  285. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/widgets/__init__.py +0 -0
  286. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/widgets/command_autocomplete.py +0 -0
  287. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/widgets/editor.py +0 -0
  288. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/widgets/file_autocomplete.py +0 -0
  289. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/widgets/messages.py +0 -0
  290. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/ui/widgets/status_bar.py +0 -0
  291. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/utils/__init__.py +0 -0
  292. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/utils/config/__init__.py +0 -0
  293. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/utils/messaging/message_utils.py +0 -0
  294. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/utils/parsing/__init__.py +0 -0
  295. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/utils/parsing/json_utils.py +0 -0
  296. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/utils/security/__init__.py +0 -0
  297. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/utils/security/command.py +0 -0
  298. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/utils/system/__init__.py +0 -0
  299. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/utils/system/paths.py +0 -0
  300. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/utils/ui/__init__.py +0 -0
  301. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/src/tunacode/utils/ui/helpers.py +0 -0
  302. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/tests/__init__.py +0 -0
  303. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/tests/conftest.py +0 -0
  304. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/tests/test_cli_default_command.py +0 -0
  305. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/tests/test_confirmation_preview.py +0 -0
  306. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/tests/test_diagnostics_renderer.py +0 -0
  307. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/tests/test_exceptions.py +0 -0
  308. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/tests/test_headless_cli.py +0 -0
  309. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/tests/test_prompting_engine.py +0 -0
  310. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/tests/test_repl_support.py +0 -0
  311. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/tests/test_shell_command_escape.py +0 -0
  312. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/tests/test_text_match.py +0 -0
  313. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/tests/test_todo_tools.py +0 -0
  314. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/tests/test_tool_conformance.py +0 -0
  315. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/tests/test_tool_decorators.py +0 -0
  316. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/tests/test_tool_parser.py +0 -0
  317. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/tests/test_tool_retry.py +0 -0
  318. {tunacode_cli-0.1.24 → tunacode_cli-0.1.28}/tests/test_web_fetch.py +0 -0
@@ -0,0 +1,278 @@
1
+ # Claude Journal
2
+
3
+ ## 2026-01-07: Renderer Unification
4
+
5
+ Unifying the 8 tool renderers in `src/tunacode/ui/renderers/tools/` to eliminate duplication via a shared base class and registry pattern.
6
+
7
+ ### Completed:
8
+ - Created `base.py` with `BaseToolRenderer[T]` ABC and `ToolRendererProtocol`
9
+ - Extracted shared helpers: `truncate_line`, `truncate_content`, `pad_lines`
10
+ - Added registry pattern: `@tool_renderer`, `get_renderer`, `list_renderers`
11
+ - Migrated `list_dir.py` to use `BaseToolRenderer` (199 -> 149 lines)
12
+ - Created documentation at `docs/ui/tool_renderers.md`
13
+
14
+ ### Architecture Decisions:
15
+ - Module-level singleton renderer instances (not created per-call)
16
+ - Render functions remain the public API (backward compatible)
17
+ - `@tool_renderer` decorator for self-registration
18
+ - Helpers are standalone functions, not methods
19
+
20
+ ---
21
+
22
+ ## 2026-01-07: Local Mode Context Optimization
23
+
24
+ ### Problem:
25
+ - System prompt + tool schemas used ~3.5k tokens before any conversation
26
+ - Each file read could use 2000 lines (~20k tokens)
27
+ - With 10k context, only ~6.5k left for conversation
28
+ - LLM APIs are stateless - system prompt sent every turn
29
+
30
+ ### Solution:
31
+
32
+ **1. Minimal System Prompt**
33
+ - `LOCAL_TEMPLATE` in `templates.py` - only 3 sections: AGENT_ROLE, TOOL_USE, USER_INSTRUCTIONS
34
+ - `local_mode: true` setting triggers minimal template
35
+
36
+ **2. Minimal Tool Schemas**
37
+ - Reduced from 11 tools to 6 (bash, read_file, update_file, write_file, glob, list_dir)
38
+ - 1-word descriptions ("Shell", "Read", "Edit", etc.) - saves ~1k tokens
39
+
40
+ **3. Aggressive Pruning**
41
+ - LOCAL_PRUNE_PROTECT_TOKENS: 2,000 (vs 40,000)
42
+ - LOCAL_PRUNE_MINIMUM_THRESHOLD: 500 (vs 20,000)
43
+
44
+ **4. Tool Output Limits**
45
+ - LOCAL_DEFAULT_READ_LIMIT: 200 lines (vs 2,000)
46
+ - LOCAL_MAX_LINE_LENGTH: 500 chars (vs 2,000)
47
+ - LOCAL_MAX_COMMAND_OUTPUT: 1,500 chars (vs 5,000)
48
+
49
+ **5. Response Limit**
50
+ - local_max_tokens: 1000 - caps model output per turn
51
+
52
+ ### Token Budget (Local Mode):
53
+ | Component | Tokens |
54
+ |-----------|--------|
55
+ | System prompt | ~1,100 |
56
+ | Guide file | ~500 |
57
+ | 6 tools (minimal) | ~575 |
58
+ | **Total base** | **~2,200** |
59
+
60
+ With 10k context: ~7.8k available for conversation.
61
+
62
+ ### Key Insight:
63
+ LLM APIs are stateless. Every request sends: system prompt + tool schemas + full conversation history. Model has no memory - re-reads everything each turn.
64
+
65
+ ### Key Files:
66
+ - `src/tunacode/core/limits.py` - Centralized limit configuration
67
+ - `src/tunacode/core/prompting/templates.py` - LOCAL_TEMPLATE
68
+ - `src/tunacode/core/prompting/local_prompt.md` - Condensed prompt
69
+ - `src/tunacode/core/compaction.py` - Dynamic prune thresholds
70
+ - `src/tunacode/constants.py` - Local mode limit constants
71
+
72
+ ---
73
+
74
+ ## 2026-01-06: Local Model Support
75
+
76
+ ### Task: Add local model support to tunacode
77
+
78
+ ### Completed:
79
+ - Created condensed system prompt at `src/tunacode/prompts/local_model_prompt.txt` (~500 bytes vs 34KB full prompt)
80
+ - Added `local_model: true/false` setting in config defaults
81
+ - Modified `load_system_prompt()` to use condensed prompt when `local_model=true`
82
+ - Added cache invalidation for `local_model` setting in `_compute_agent_version()`
83
+ - Skip AGENTS.md loading for local models to save tokens
84
+ - Created `fallback_executor.py` for models that output tool calls in text (e.g., `<tool_call>` tags)
85
+ - Updated `node_processor.py` to detect and execute fallback tool calls
86
+ - Passed `agent_ctx` through the call chain for result injection
87
+ - Tested with multiple local models via LM Studio/vLLM
88
+
89
+ ### Notes:
90
+ - Qwen2.5-Coder-14B supports native OpenAI tool calling format
91
+ - Smaller models (0.6B-1.7B) output `<tool_call>` tags in content - fallback parser handles this
92
+ - llama.cpp uses KV cache efficiently (LCP similarity) so repeated prompt not re-computed
93
+
94
+ ---
95
+
96
+ ## 2026-01-08: Config Restoration & Local Mode Docs
97
+
98
+ ### Task: Restore pre-local-mode config and document local mode setup
99
+
100
+ ### Completed:
101
+
102
+ **1. Config Backup Discovery**
103
+ Found three config variants in `~/.config/`:
104
+ - `tunacode.json` - was set to local mode (grok-code-fast-1, 10k context)
105
+ - `tunacode.json.bak` - MiniMax-M2.1, 200k context, no local mode
106
+ - `@tunacode.json` - Gemini 3 Pro via OpenRouter
107
+
108
+ **2. Restored Config**
109
+ - Restored `~/.config/tunacode.json` from `.bak` (MiniMax config)
110
+ - Settings: `minimax:MiniMax-M2.1`, 200k context, `guide_file: AGENTS.md`
111
+
112
+ **3. Created Local Mode Example**
113
+ - Created `docs/configuration/tunacode.local.json.example`
114
+ - Documents all local mode settings:
115
+ - `local_mode: true`
116
+ - `local_max_tokens: 1000`
117
+ - `context_window_size: 10000`
118
+ - `OPENAI_BASE_URL: http://127.0.0.1:8080/v1`
119
+ - `guide_file: CLAUDE_LOCAL.md`
120
+
121
+ ### Key Files:
122
+ - `~/.config/tunacode.json` - user config (restored to MiniMax)
123
+ - `docs/configuration/tunacode.json.example` - standard example
124
+ - `docs/configuration/tunacode.local.json.example` - NEW: local mode example
125
+
126
+ ### Notes:
127
+ - Local mode uses condensed prompts and minimal tool schemas for small context windows
128
+ - The `.bak` file preserved the pre-experimentation state - good backup hygiene!
129
+ - User was testing local models, now back to cloud (MiniMax)
130
+
131
+ ---
132
+
133
+ ## 2026-01-08: Syntax Highlighting for Tool Renderers (Branch: ui-model-work)
134
+
135
+ ### The Mission:
136
+ Make tool outputs pretty! All those ugly plain text viewports were a crime against NeXTSTEP aesthetics. Time to add syntax highlighting everywhere.
137
+
138
+ ### Completed (Commit 9db8e92):
139
+
140
+ **1. Created `syntax_utils.py` - The Shared Foundation**
141
+ - `EXTENSION_LEXERS` - 60+ file extension → lexer mappings
142
+ - `get_lexer(filepath)` - Get pygments lexer from file path
143
+ - `syntax_or_text(content, filepath)` - Render highlighted or plain
144
+ - `detect_code_lexer(content)` - Heuristic code detection (shebangs, JSON, Python/JS patterns)
145
+ - `SYNTAX_THEME = "monokai"` - Consistent theme everywhere
146
+
147
+ **2. Created `write_file.py` - New Renderer!**
148
+ - Was missing entirely - now shows syntax-highlighted preview of written content
149
+ - Green "NEW" badge in header, file stats
150
+
151
+ **3. Updated 8 Existing Renderers:**
152
+
153
+ | Renderer | What Changed |
154
+ |----------|-------------|
155
+ | `read_file` | Syntax highlighting by file extension, built-in line numbers from Syntax component |
156
+ | `grep` | Cyan file paths, yellow `reverse` highlighted matches, styled line numbers with `│` |
157
+ | `glob` | Files colored by type: Python=bright_blue, JS=yellow, JSON=green, etc. Dir path dim, filename bold |
158
+ | `list_dir` | Tree chars dim, directories bold cyan, files colored by lexer type |
159
+ | `bash` | Smart detection: `git diff`→diff lexer, JSON commands→json lexer, labeled stdout/stderr |
160
+ | `web_fetch` | URL-based detection (raw.githubusercontent.com, .json, /api/), content heuristics |
161
+ | `research` | New "Code" section with syntax-highlighted examples from `code_examples` field |
162
+ | `update_file` | Already had Syntax("diff") - unchanged, the OG |
163
+
164
+ **4. Updated `__init__.py`:**
165
+ - Added `write_file` renderer to exports
166
+ - Added syntax utility functions to `__all__`
167
+ - Better docstring explaining the 4-zone pattern
168
+
169
+ ### Key Design Decisions:
170
+ - `syntax_or_text()` returns `RenderableType` - graceful fallback to `Text()` for unknown extensions
171
+ - File-type coloring consistent across `glob`, `list_dir`, `grep` (same color = same type)
172
+ - Bash output detection is conservative - only highlights when confident
173
+ - Research viewport prioritizes findings over code (code is supplementary)
174
+
175
+ ### Files Modified:
176
+ ```
177
+ src/tunacode/ui/renderers/tools/
178
+ ├── __init__.py (exports + docstring)
179
+ ├── syntax_utils.py (NEW - shared utilities)
180
+ ├── write_file.py (NEW - renderer)
181
+ ├── read_file.py (syntax highlighting)
182
+ ├── grep.py (styled matches)
183
+ ├── glob.py (colored paths)
184
+ ├── list_dir.py (styled tree)
185
+ ├── bash.py (smart detection)
186
+ ├── web_fetch.py (URL/content detection)
187
+ └── research.py (code examples)
188
+ ```
189
+
190
+ ### What's Left on This Branch:
191
+ - Other UI model work (the branch name suggests more to do)
192
+ - Unstaged: `.claude/JOURNAL.md`, `CLAUDE.md`, research docs, config example
193
+
194
+ ### Commands:
195
+ ```bash
196
+ uv run ruff check src/tunacode/ui/renderers/tools/ # All checks pass
197
+ uv run python -c "from tunacode.ui.renderers.tools import list_renderers; print(list_renderers())"
198
+ # ['bash', 'glob', 'grep', 'list_dir', 'read_file', 'research_codebase', 'update_file', 'web_fetch', 'write_file']
199
+ ```
200
+
201
+ ### Fun Fact:
202
+ We went from 0 syntax-highlighted viewports to 8 in one session. The `update_file` renderer was the lonely pioneer - now it has friends!
203
+
204
+ ---
205
+
206
+ ## 2026-01-08: The Great Panel Width Debugging Adventure (Branch: master)
207
+
208
+ ### The Problem:
209
+ Tool panels were narrower than agent panels. User showed screenshot - `read_file` panel was ~50 chars wide while `agent` panel was full width. Classic NeXTSTEP violation!
210
+
211
+ ### The Red Herring (What We Thought):
212
+ Initially believed the issue was `width=TOOL_PANEL_WIDTH` (50 chars) on `Panel()` calls. Spent time:
213
+ - Removing `width=TOOL_PANEL_WIDTH` from 7 Panel() calls in `panels.py`
214
+ - Removing it from `search.py`, `update_file.py`, `app.py`
215
+ - Cleaning up unused imports
216
+
217
+ But panels were STILL narrow after restart. User called me out: "stop being lazy, dig deeper"
218
+
219
+ ### The Actual Root Cause (The AHA Moment):
220
+
221
+ **Textual's `RichLog.write()` has its OWN `expand` parameter that defaults to `False`!**
222
+
223
+ From `.venv/lib/python3.13/site-packages/textual/widgets/_rich_log.py`:
224
+ ```python
225
+ def write(
226
+ self,
227
+ content: RenderableType | object,
228
+ width: int | None = None,
229
+ expand: bool = False, # <-- THIS IS THE VILLAIN
230
+ shrink: bool = True,
231
+ ...
232
+ )
233
+ ```
234
+
235
+ When `expand=False` (default), RichLog measures the content's minimum width and renders at that width, **completely ignoring** the Panel's own `expand=True` property!
236
+
237
+ The Panel's expand tells Rich "expand to console width", but RichLog overrides the console width to be just the measured content width. Two different expand flags, two different systems!
238
+
239
+ ### The Real Fix:
240
+ Pass `expand=True` to `rich_log.write()`:
241
+
242
+ ```python
243
+ # Before
244
+ self.rich_log.write(panel)
245
+
246
+ # After
247
+ self.rich_log.write(panel, expand=True)
248
+ ```
249
+
250
+ ### Files Modified:
251
+ | File | Change |
252
+ |------|--------|
253
+ | `src/tunacode/ui/app.py` | 3 panel writes → `expand=True` (lines 325, 377, 558) |
254
+ | `src/tunacode/ui/plan_approval.py` | 1 panel write → `expand=True` (line 132) |
255
+ | `src/tunacode/ui/renderers/panels.py` | Removed `width=TOOL_PANEL_WIDTH` (harmless cleanup) |
256
+ | `src/tunacode/ui/renderers/search.py` | Removed unused import |
257
+ | `src/tunacode/ui/renderers/tools/update_file.py` | Removed unused import |
258
+
259
+ ### The Lesson:
260
+ When Rich Panel has `expand=True` but isn't expanding in Textual:
261
+ 1. The Panel's expand is **not** the issue
262
+ 2. Check how the panel is being **written** to the widget
263
+ 3. RichLog.write() has its own expand parameter!
264
+
265
+ ### Status:
266
+ - Changes made, ruff passes
267
+ - NOT COMMITTED YET - user needs to test
268
+ - Previous width removal changes are technically unnecessary but harmless
269
+
270
+ ### Commands:
271
+ ```bash
272
+ git diff --stat # See all changes
273
+ uv run ruff check src/tunacode/ui/ # Verify
274
+ # Restart tunacode and make NEW request to test
275
+ ```
276
+
277
+ ### Philosophical Note:
278
+ This bug was a perfect example of "the abstraction leaked". Panel.expand and RichLog.write(expand=) look like they should be the same thing, but they operate at different levels. Panel tells Rich what to do. RichLog tells Rich what size canvas to give it. The canvas size wins.
@@ -0,0 +1,55 @@
1
+ ---
2
+ title: list_dir halts agent on bad paths
3
+ link: list-dir-tool-execution-error
4
+ type: delta
5
+ path: src/tunacode/tools/list_dir.py
6
+ depth: 0
7
+ seams: [M] module
8
+ ontological_relations:
9
+ - relates_to: [[tools]]
10
+ - affects: [[tool-executor]]
11
+ - fixes: [[agent-halt-on-tool-error]]
12
+ tags:
13
+ - tools
14
+ - error-handling
15
+ - list_dir
16
+ - ModelRetry
17
+ created_at: 2026-01-07T22:54:00-08:00
18
+ updated_at: 2026-01-07T23:15:00-08:00
19
+ uuid: a1b2c3d4-e5f6-7890-abcd-ef1234567890
20
+ ---
21
+
22
+ ## Summary
23
+
24
+ `list_dir` raised `FileNotFoundError` on non-existent directories, which `@base_tool` wrapped as `ToolExecutionError`. Since `ToolExecutionError` is in `NON_RETRYABLE_ERRORS`, the agent halted instead of letting the LLM self-correct with a valid path.
25
+
26
+ ## Context
27
+
28
+ Surfaced when agent called `list_dir("/home/tuna/tunacode/apps")` - a directory that doesn't exist. Agent crashed with `ToolExecutionError` instead of retrying.
29
+
30
+ ## Root Cause
31
+
32
+ Error propagation chain:
33
+ 1. `list_dir` raises `FileNotFoundError`
34
+ 2. `@base_tool` decorator wraps it as `ToolExecutionError`
35
+ 3. `tool_executor.py` has `ToolExecutionError` in `NON_RETRYABLE_ERRORS`
36
+ 4. Non-retryable errors propagate immediately, halting the agent
37
+
38
+ First attempted fix: switch to `@file_tool` decorator. Failed because `@file_tool` expects required `filepath` positional arg, but `list_dir` has optional `directory="."`.
39
+
40
+ ## Changes
41
+
42
+ - Import `ModelRetry` from `pydantic_ai.exceptions`
43
+ - Replace `raise FileNotFoundError(...)` with `raise ModelRetry(...)`
44
+ - Replace `raise NotADirectoryError(...)` with `raise ModelRetry(...)`
45
+ - Keep `@base_tool` decorator (not `@file_tool`)
46
+
47
+ ## Behavioral Impact
48
+
49
+ - Agent no longer halts on bad directory paths
50
+ - LLM receives retry signal with error message, can self-correct
51
+ - No change to valid path behavior
52
+
53
+ ## Related Cards
54
+
55
+ - [[glob-grep-error-strings]] - similar smell: return error strings instead of raising
@@ -0,0 +1,52 @@
1
+ ---
2
+ title: No Cargo Cult Fixes - Question Every Change
3
+ link: no-cargo-cult-fixes
4
+ type: qa
5
+ path: qa/
6
+ depth: 1
7
+ seams: [M]
8
+ ontological_relations:
9
+ - relates_to: [[code-review]]
10
+ - affects: [[all-modules]]
11
+ - fixes: [[scope-creep]]
12
+ tags:
13
+ - discipline
14
+ - shims
15
+ - code-review
16
+ created_at: 2026-01-09T22:15:00Z
17
+ updated_at: 2026-01-09T22:15:00Z
18
+ uuid: 4fa0c1e7-d7d0-415a-91e4-d69b28210ff0
19
+ ---
20
+
21
+ ## Problem
22
+
23
+ When extracting changes from a messy PR, I blindly copied a fix to `retry.py` without questioning whether it was needed.
24
+
25
+ The signature preservation fix was for pydantic-ai tool schema generation. `retry_on_json_error` is a JSON parsing utility - it never gets passed to pydantic-ai's `Tool()`. The fix there was a shim.
26
+
27
+ ## Root Cause
28
+
29
+ Cargo culting. "The original PR had it, so I included it."
30
+
31
+ ## Lesson
32
+
33
+ Before applying any fix, ask: **"Does this code path actually hit the problem?"**
34
+
35
+ For the signature preservation bug specifically:
36
+ - pydantic-ai uses `inspect.signature()` to generate JSON schemas for tools
37
+ - Only wrappers that produce functions passed to `Tool()` need the fix
38
+ - `retry_on_json_error` wraps JSON parsers, not pydantic-ai tools
39
+
40
+ ## Rule
41
+
42
+ If you encounter a shim, fix it. Don't care who made it. Don't propagate it.
43
+
44
+ ## Files That Actually Needed The Fix
45
+
46
+ 1. `research_agent.py` - `ProgressTracker.wrap_tool()` wraps tools for pydantic-ai
47
+ 2. `decorators.py` - `base_tool()` and `file_tool()` wrap tools for pydantic-ai
48
+ 3. `present_plan.py` - `create_present_plan_tool()` creates a pydantic-ai tool
49
+
50
+ ## Files That Did NOT Need The Fix
51
+
52
+ - `retry.py` - wraps JSON parsers, not pydantic-ai tools
@@ -81,3 +81,5 @@ vendor/
81
81
  .beads/
82
82
  .osgrep
83
83
  .osgrep*
84
+ .pre-commit-cache/
85
+ TODO.md
@@ -13,6 +13,9 @@ repos:
13
13
  hooks:
14
14
  - id: trailing-whitespace
15
15
  - id: end-of-file-fixer
16
+ # models_registry.json is auto-generated config; lsp/__init__.py is empty stub
17
+ # trailing newline changes create diff noise
18
+ exclude: (models_registry\.json|lsp/__init__\.py)$
16
19
  - id: check-yaml
17
20
  args: ['--allow-multiple-documents']
18
21
  - id: check-added-large-files
@@ -44,6 +47,7 @@ repos:
44
47
  - id: ruff
45
48
  args: ['--fix', '--show-fixes']
46
49
  - id: ruff-format # Re-enabled - ruff handles linting, ruff-format handles formatting
50
+ exclude: (models_registry\.json|lsp/__init__\.py)$
47
51
 
48
52
  # Type checking with mypy
49
53
  - repo: https://github.com/pre-commit/mirrors-mypy
@@ -1,5 +1,49 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.26] - 2026-01-09
4
+
5
+ ### Added
6
+ - NeXTSTEP agent response panels with streaming support (#218)
7
+
8
+ ## [0.1.25] - 2026-01-08
9
+
10
+ ### Added
11
+ - Local mode for small context window models with configurable tool limits (#215, #216)
12
+ - BaseToolRenderer pattern for compact NeXTSTEP panels (#214)
13
+ - Local mode documentation and README link
14
+
15
+ ### Changed
16
+ - Tool improvements and unified BaseToolRenderer pattern
17
+
18
+ ## [0.1.24] - 2026-01-07
19
+
20
+ ### Added
21
+ - Plan mode feature with gitignore-aware grep (#213)
22
+ - Dynamic provider config from registry, OpenAI-only for non-Anthropic
23
+
24
+ ### Fixed
25
+ - Restore plan mode feature (accidentally deleted in d816ff2)
26
+
27
+ ## [0.1.23] - 2026-01-06
28
+
29
+ ### Fixed
30
+ - Include models_registry.json in wheel distribution
31
+
32
+ ## [0.1.22] - 2026-01-06
33
+
34
+ ### Fixed
35
+ - Use load_models_registry instead of cached version for provider config
36
+ - Resolve async/sync mismatch in _normalize_tool_args
37
+
38
+ ## [0.1.21] - 2026-01-03
39
+
40
+ ### Added
41
+ - Comprehensive codebase map with SEAMS analysis
42
+
43
+ ### Changed
44
+ - Refactor exception formatting
45
+ - Cleanup obsolete memory-bank and audit files
46
+
3
47
  ## [0.1.20] - 2026-01-02
4
48
 
5
49
  ### Added
@@ -1,3 +1,24 @@
1
+ ---
2
+ title: Tunacode Project Guidelines
3
+ link: claude-md
4
+ type: doc
5
+ path: CLAUDE.md
6
+ depth: 0
7
+ seams: [A, M]
8
+ ontological_relations:
9
+ - relates_to: [[tunacode]]
10
+ - affects: [[code-style, workflow, quality-gates]]
11
+ tags:
12
+ - guidelines
13
+ - cheatsheet
14
+ - code-style
15
+ - quality-gates
16
+ - workflow
17
+ created_at: 2025-01-01T00:00:00Z
18
+ updated_at: 2026-01-08T00:00:00Z
19
+ uuid: claude-md-tunacode-001
20
+ ---
21
+
1
22
  ## Tunacode
2
23
 
3
24
  This project is tunacode, much like you! It's a TUI code agent that can be used to code and debug code or general agentic tasks.
@@ -279,7 +300,7 @@ PR #263: "chore: remove unused grep tool"
279
300
 
280
301
  ## KB Directory
281
302
 
282
- Maintain a `.claude/markdown` directory with:
303
+ Maintain a `.claude/` directory with:
283
304
 
284
305
  - **metadata/** — dependency graphs, file classifications, error pattern database
285
306
  - **code_index/** — function call graphs, type relationships, interface mappings
@@ -289,6 +310,8 @@ Maintain a `.claude/markdown` directory with:
289
310
  - **qa/** — solved problems database with reasoning
290
311
  - **delta/** — semantic changelogs explaining changes
291
312
 
313
+ Select the most semantically correct directory and create a card in it.
314
+
292
315
  ### Continuous Learning
293
316
 
294
317
  Dump bugs, smells, issues here as you encounter them. Raw is fine. A skill will organize this into proper kb entries later.
@@ -297,6 +320,14 @@ Format: `[date] [type] description`
297
320
 
298
321
  Types: bug, smell, pattern, lesson, antipattern
299
322
 
323
+ [2026-01-07] [lesson] When there's a type mismatch between A and B, fix where A or B is defined, not every place that uses them. Don't scatter changes across 5+ files when one line at the source fixes everything.
324
+
325
+ [2026-01-08] [pattern] Local mode config: `docs/configuration/tunacode.local.json.example` - use when running local models. Key settings: `local_mode: true`, `local_max_tokens: 1000`, `context_window_size: 10000`, `OPENAI_BASE_URL` for local server.
326
+
327
+ [2026-01-08] [pattern] Syntax highlighting in tool renderers: Use `syntax_utils.py` for `get_lexer(filepath)` and `syntax_or_text(content, filepath)`. Consistent monokai theme. 9 renderers now registered: bash, glob, grep, list_dir, read_file, research_codebase, update_file, web_fetch, write_file. Commit `9db8e92`.
328
+
329
+ [2026-01-08] [lesson] **RichLog.write() has its own expand parameter!** When Panel(expand=True) doesn't expand in Textual, the fix is `rich_log.write(panel, expand=True)`. Panel.expand tells Rich what to do; RichLog.write(expand=) tells Rich what canvas size to use. Two different systems - canvas wins. See JOURNAL.md "The Great Panel Width Debugging Adventure".
330
+
300
331
  ---
301
332
 
302
333
  We are currently in the middle of a large rewrite few test exist and documentation and that is okay. We will build the test and documentation as we go
@@ -0,0 +1,72 @@
1
+ # Tunacode (Local System Prompt)
2
+
3
+ TUI code agent. Structure: `ui/` (TUI), `core/` (agent), `tools/` (system access).
4
+
5
+ ## Architecture
6
+
7
+ Dependencies flow one direction: `ui → core → tools → utils/types`. Never backward.
8
+
9
+ ## Code Rules
10
+
11
+ 1. **Guard clauses** - Return early, flatten nesting
12
+ 2. **Explicit typing** - Use `cast()`, `assert`, avoid `# type: ignore`
13
+ 3. **No magic values** - Use named constants
14
+ 4. **Pass inputs openly** - No hidden state
15
+ 5. **Delete dead code** - VCS remembers
16
+
17
+ ## Error Handling
18
+
19
+ **Fail fast, fail loud.** No silent fallbacks. Raise exceptions with clear messages.
20
+
21
+ ```python
22
+ # Wrong
23
+ if not path.exists():
24
+ return None
25
+
26
+ # Right
27
+ if not path.exists():
28
+ raise FileNotFoundError(f"Not found: {path}")
29
+ ```
30
+
31
+ ## Quality Gates
32
+
33
+ 1. **No shims** - Fix interfaces at root, never patch around them
34
+ 2. **High cohesion** - One module = one responsibility
35
+ 3. **Low coupling** - Modules don't know each other's internals
36
+ 4. **Design by contract** - Preconditions, postconditions, invariants
37
+
38
+ ## Workflow
39
+
40
+ - `uv` for packages, `.venv` for environment
41
+ - `uv run ruff check --fix .` before commits
42
+ - `uv run pytest` for tests
43
+ - Small, focused diffs. Commit frequently.
44
+
45
+ ## Don'ts
46
+
47
+ - Don't add features beyond what's asked
48
+ - Don't create abstractions for one-time operations
49
+ - Don't add comments to unchanged code
50
+ - Don't use `--no-verify` on commits
51
+ - Don't import ui from core or tools
52
+
53
+ ## Example: Fix a bug
54
+
55
+ User: "Fix the typo in greet function"
56
+
57
+ 1. **Read first** - Always read before editing
58
+ ```json
59
+ {"name": "read_file", "arguments": {"filepath": "src/utils.py"}}
60
+ ```
61
+
62
+ 2. **Make targeted edit**
63
+ ```json
64
+ {"name": "update_file", "arguments": {"filepath": "src/utils.py", "old_text": "def greet(naem):", "new_text": "def greet(name):"}}
65
+ ```
66
+
67
+ 3. **Verify** - Run tests
68
+ ```json
69
+ {"name": "bash", "arguments": {"command": "uv run pytest tests/test_utils.py -x"}}
70
+ ```
71
+
72
+ Done. One fix, one commit.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tunacode-cli
3
- Version: 0.1.24
3
+ Version: 0.1.28
4
4
  Summary: Your agentic CLI developer.
5
5
  Project-URL: Homepage, https://tunacode.xyz/
6
6
  Project-URL: Repository, https://github.com/alchemiststudiosDOTai/tunacode
@@ -32,7 +32,6 @@ Requires-Dist: rich<15.0.0,>=14.2.0
32
32
  Requires-Dist: ruff>=0.14.0
33
33
  Requires-Dist: textual-autocomplete>=4.0.6
34
34
  Requires-Dist: textual<5.0.0,>=4.0.0
35
- Requires-Dist: tiktoken<1.0.0,>=0.12.0
36
35
  Requires-Dist: typer>=0.15.0
37
36
  Provides-Extra: dev
38
37
  Requires-Dist: autoflake>=2.0.0; extra == 'dev'
@@ -67,24 +66,27 @@ A TUI code agent.
67
66
 
68
67
  ## Interface
69
68
 
70
- ![TUI Interface](docs/images/tui.png)
71
-
72
69
  The Textual-based terminal user interface provides a clean, interactive environment for AI-assisted coding, with a design heavily inspired by the classic NeXTSTEP user interface.
73
70
 
71
+ ![Agent Response Panel](docs/media/agent-response.png)
72
+ *Agent response panel with formatted output*
73
+
74
+ ![Read File Tool](docs/media/read-file-tool.png)
75
+ *Tool rendering with syntax highlighting*
76
+
77
+ ![Plan Approval](docs/media/plan-approval.png)
78
+ *Structured plan approval workflow*
79
+
74
80
  ## Theme Support
75
81
 
76
82
  The interface supports multiple themes for different preferences and environments.
77
83
 
78
- ![Theme](docs/images/theme.png)
79
-
80
84
  Customize the appearance with built-in themes or create your own color schemes.
81
85
 
82
86
  ## Model Setup
83
87
 
84
88
  Configure your AI models and settings through the provided setup interface.
85
89
 
86
- ![TUI Model Setup](docs/images/tui-model-setup.png)
87
-
88
90
  **Note:** TunaCode has full bash shell access. This tool assumes you know what you're doing. If you're concerned, run it in a sandboxed environment.
89
91
 
90
92
  ## v0.1.1 - Major Rewrite
@@ -129,6 +131,8 @@ export ANTHROPIC_API_KEY="your-key"
129
131
 
130
132
  Config file location: `~/.config/tunacode.json`
131
133
 
134
+ For advanced settings including **local mode** for small context models, see the [Configuration Guide](docs/configuration/README.md).
135
+
132
136
  ## Commands
133
137
 
134
138
  | Command | Description |
@@ -14,24 +14,27 @@ A TUI code agent.
14
14
 
15
15
  ## Interface
16
16
 
17
- ![TUI Interface](docs/images/tui.png)
18
-
19
17
  The Textual-based terminal user interface provides a clean, interactive environment for AI-assisted coding, with a design heavily inspired by the classic NeXTSTEP user interface.
20
18
 
19
+ ![Agent Response Panel](docs/media/agent-response.png)
20
+ *Agent response panel with formatted output*
21
+
22
+ ![Read File Tool](docs/media/read-file-tool.png)
23
+ *Tool rendering with syntax highlighting*
24
+
25
+ ![Plan Approval](docs/media/plan-approval.png)
26
+ *Structured plan approval workflow*
27
+
21
28
  ## Theme Support
22
29
 
23
30
  The interface supports multiple themes for different preferences and environments.
24
31
 
25
- ![Theme](docs/images/theme.png)
26
-
27
32
  Customize the appearance with built-in themes or create your own color schemes.
28
33
 
29
34
  ## Model Setup
30
35
 
31
36
  Configure your AI models and settings through the provided setup interface.
32
37
 
33
- ![TUI Model Setup](docs/images/tui-model-setup.png)
34
-
35
38
  **Note:** TunaCode has full bash shell access. This tool assumes you know what you're doing. If you're concerned, run it in a sandboxed environment.
36
39
 
37
40
  ## v0.1.1 - Major Rewrite
@@ -76,6 +79,8 @@ export ANTHROPIC_API_KEY="your-key"
76
79
 
77
80
  Config file location: `~/.config/tunacode.json`
78
81
 
82
+ For advanced settings including **local mode** for small context models, see the [Configuration Guide](docs/configuration/README.md).
83
+
79
84
  ## Commands
80
85
 
81
86
  | Command | Description |