dandy 3.0.0a7__tar.gz → 3.0.0a8__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.
Files changed (243) hide show
  1. {dandy-3.0.0a7 → dandy-3.0.0a8}/PKG-INFO +1 -1
  2. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/agent.py +124 -34
  3. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/cli/cli_agent.py +63 -1
  4. dandy-3.0.0a8/dandy/application/agent/cli/intelligence/prompts/cli_usage_prompt.py +193 -0
  5. dandy-3.0.0a8/dandy/application/agent/cli/intelligence/skills/__init__.py +6 -0
  6. dandy-3.0.0a8/dandy/application/agent/cli/intelligence/skills/cli_usage_skill.py +22 -0
  7. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intel.py +32 -1
  8. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/session_store.py +7 -1
  9. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/skill/loader.py +23 -4
  10. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/message/compaction.py +10 -6
  11. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/http/connector.py +35 -3
  12. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/http/intel.py +38 -11
  13. dandy-3.0.0a8/dandy/infrastructure/http/streaming.py +147 -0
  14. dandy-3.0.0a8/dandy/infrastructure/http/timeout.py +24 -0
  15. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/llm/config.py +3 -1
  16. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/llm/connector.py +1 -0
  17. dandy-3.0.0a8/dandy/infrastructure/recorder/flight.py +46 -0
  18. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/recorder/recorder.py +9 -0
  19. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/interfaces/cli/cli.py +73 -5
  20. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/interfaces/cli/commands.py +8 -0
  21. dandy-3.0.0a8/dandy/interfaces/cli/error_log.py +58 -0
  22. dandy-3.0.0a8/dandy/interfaces/cli/html_templates/dandy.html +1067 -0
  23. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/interfaces/cli/main.py +2 -0
  24. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/interfaces/cli/one_shot.py +3 -0
  25. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/interfaces/cli/tui/tui.py +10 -6
  26. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/interfaces/cli/usage.py +5 -1
  27. dandy-3.0.0a8/dandy/interfaces/cli/webview.py +56 -0
  28. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/cancellation.py +10 -1
  29. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/constants.py +7 -1
  30. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/settings/default_settings.py +18 -1
  31. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy.egg-info/PKG-INFO +1 -1
  32. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy.egg-info/SOURCES.txt +8 -0
  33. {dandy-3.0.0a7 → dandy-3.0.0a8}/pyproject.toml +3 -0
  34. dandy-3.0.0a7/dandy/interfaces/cli/error_log.py +0 -54
  35. {dandy-3.0.0a7 → dandy-3.0.0a8}/LICENSE.md +0 -0
  36. {dandy-3.0.0a7 → dandy-3.0.0a8}/README.md +0 -0
  37. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/__init__.py +0 -0
  38. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/__init__.py +0 -0
  39. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/__init__.py +0 -0
  40. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/attachments.py +0 -0
  41. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/cli/__init__.py +0 -0
  42. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/cli/agents_md.py +0 -0
  43. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/cli/environment.py +0 -0
  44. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/cli/intelligence/__init__.py +0 -0
  45. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/cli/intelligence/bots/__init__.py +0 -0
  46. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/cli/intelligence/bots/coding_bot.py +0 -0
  47. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/cli/intelligence/bots/init_bot.py +0 -0
  48. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/cli/intelligence/bots/session_naming_bot.py +0 -0
  49. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/cli/intelligence/prompts/__init__.py +0 -0
  50. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/cli/intelligence/prompts/coding_prompts.py +0 -0
  51. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/cli/intelligence/prompts/init_prompts.py +0 -0
  52. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/cli/intelligence/prompts/narration_prompt.py +0 -0
  53. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/cli/intelligence/prompts/path_prompt.py +0 -0
  54. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/cli/intelligence/prompts/session_name_prompt.py +0 -0
  55. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/cli/intelligence/prompts/tool_calling_prompt.py +0 -0
  56. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/compaction.py +0 -0
  57. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/exceptions.py +0 -0
  58. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/__init__.py +0 -0
  59. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/bots/__init__.py +0 -0
  60. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/bots/compaction_bot.py +0 -0
  61. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/prompts/__init__.py +0 -0
  62. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/prompts/compaction_prompt.py +0 -0
  63. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/tools/__init__.py +0 -0
  64. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/tools/clock/__init__.py +0 -0
  65. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/tools/clock/clock_tool.py +0 -0
  66. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/tools/command/__init__.py +0 -0
  67. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/tools/command/command_tool.py +0 -0
  68. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/tools/file/__init__.py +0 -0
  69. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/tools/file/create_directory_tool.py +0 -0
  70. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/tools/file/delete_file_tool.py +0 -0
  71. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/tools/file/edit_file_tool.py +0 -0
  72. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/tools/file/list_directory_tool.py +0 -0
  73. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/tools/file/read_file_tool.py +0 -0
  74. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/tools/file/search_tool.py +0 -0
  75. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/tools/file/write_file_tool.py +0 -0
  76. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/tools/git/__init__.py +0 -0
  77. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/tools/git/git_diff_tool.py +0 -0
  78. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/tools/git/git_status_tool.py +0 -0
  79. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/tools/paths.py +0 -0
  80. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/tools/question/__init__.py +0 -0
  81. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/tools/question/question_tool.py +0 -0
  82. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/intelligence/tools/tool_errors.py +0 -0
  83. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/prompts.py +0 -0
  84. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/agent/session.py +0 -0
  85. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/bot/__init__.py +0 -0
  86. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/bot/bot.py +0 -0
  87. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/bot/exceptions.py +0 -0
  88. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/decision/__init__.py +0 -0
  89. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/decision/decision.py +0 -0
  90. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/decision/mixin.py +0 -0
  91. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/decision/service.py +0 -0
  92. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/diligence/__init__.py +0 -0
  93. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/diligence/diligence.py +0 -0
  94. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/diligence/handler.py +0 -0
  95. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/diligence/mixin.py +0 -0
  96. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/diligence/second_pass/__init__.py +0 -0
  97. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/diligence/second_pass/diligence.py +0 -0
  98. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/diligence/service.py +0 -0
  99. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/diligence/stop_word_removal/__init__.py +0 -0
  100. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/diligence/stop_word_removal/constants.py +0 -0
  101. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/diligence/stop_word_removal/diligence.py +0 -0
  102. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/diligence/vowel_removal/__init__.py +0 -0
  103. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/diligence/vowel_removal/constants.py +0 -0
  104. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/diligence/vowel_removal/diligence.py +0 -0
  105. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/llm/__init__.py +0 -0
  106. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/llm/mixin.py +0 -0
  107. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/llm/service.py +0 -0
  108. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/skill/__init__.py +0 -0
  109. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/skill/mixin.py +0 -0
  110. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/skill/service.py +0 -0
  111. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/skill/tools.py +0 -0
  112. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/tool/__init__.py +0 -0
  113. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/tool/mixin.py +0 -0
  114. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/application/tool/service.py +0 -0
  115. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/__init__.py +0 -0
  116. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/decision/__init__.py +0 -0
  117. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/decision/exceptions.py +0 -0
  118. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/decision/intel.py +0 -0
  119. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/decision/prompts.py +0 -0
  120. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/guard/__init__.py +0 -0
  121. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/guard/context_guard.py +0 -0
  122. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/guard/defaults.py +0 -0
  123. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/guard/guard.py +0 -0
  124. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/guard/repeat_guard.py +0 -0
  125. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/intel/__init__.py +0 -0
  126. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/intel/annotation.py +0 -0
  127. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/intel/exceptions.py +0 -0
  128. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/intel/factory.py +0 -0
  129. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/intel/intel.py +0 -0
  130. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/intel/mixin.py +0 -0
  131. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/intel/service.py +0 -0
  132. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/intel/typing.py +0 -0
  133. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/message/__init__.py +0 -0
  134. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/message/message.py +0 -0
  135. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/prompt/__init__.py +0 -0
  136. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/prompt/prompt.py +0 -0
  137. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/prompt/snippet.py +0 -0
  138. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/request/__init__.py +0 -0
  139. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/request/exceptions.py +0 -0
  140. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/request/options.py +0 -0
  141. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/request/prompts.py +0 -0
  142. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/request/request.py +0 -0
  143. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/skill/__init__.py +0 -0
  144. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/skill/exceptions.py +0 -0
  145. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/skill/prompts.py +0 -0
  146. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/skill/skill.py +0 -0
  147. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/tokens/__init__.py +0 -0
  148. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/tokens/estimate.py +0 -0
  149. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/tool/__init__.py +0 -0
  150. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/tool/beat.py +0 -0
  151. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/tool/exceptions.py +0 -0
  152. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/tool/intel.py +0 -0
  153. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/domain/tool/tool.py +0 -0
  154. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/__init__.py +0 -0
  155. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/cache/__init__.py +0 -0
  156. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/cache/cache.py +0 -0
  157. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/cache/decorators.py +0 -0
  158. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/cache/exceptions.py +0 -0
  159. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/cache/key.py +0 -0
  160. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/cache/memory/__init__.py +0 -0
  161. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/cache/memory/cache.py +0 -0
  162. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/cache/memory/decorators.py +0 -0
  163. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/cache/sqlite/__init__.py +0 -0
  164. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/cache/sqlite/cache.py +0 -0
  165. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/cache/sqlite/connection.py +0 -0
  166. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/cache/sqlite/decorators.py +0 -0
  167. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/file/__init__.py +0 -0
  168. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/file/mixin.py +0 -0
  169. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/file/service.py +0 -0
  170. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/future/__init__.py +0 -0
  171. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/future/exceptions.py +0 -0
  172. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/future/future.py +0 -0
  173. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/future/process.py +0 -0
  174. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/http/__init__.py +0 -0
  175. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/http/exceptions.py +0 -0
  176. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/http/mixin.py +0 -0
  177. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/http/service.py +0 -0
  178. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/http/url.py +0 -0
  179. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/llm/__init__.py +0 -0
  180. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/llm/fenced_json.py +0 -0
  181. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/recorder/__init__.py +0 -0
  182. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/recorder/bot_events.py +0 -0
  183. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/recorder/decision_events.py +0 -0
  184. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/recorder/decorators.py +0 -0
  185. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/recorder/diligence_events.py +0 -0
  186. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/recorder/events.py +0 -0
  187. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/recorder/exceptions.py +0 -0
  188. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/recorder/llm_events.py +0 -0
  189. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/recorder/recording.py +0 -0
  190. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/recorder/renderer/__init__.py +0 -0
  191. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/recorder/renderer/html.py +0 -0
  192. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/recorder/renderer/html_templates/base_event_template.html +0 -0
  193. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/recorder/renderer/html_templates/base_recording_output_template.html +0 -0
  194. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/recorder/renderer/json.py +0 -0
  195. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/recorder/renderer/markdown.py +0 -0
  196. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/recorder/renderer/renderer.py +0 -0
  197. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/recorder/tool_events.py +0 -0
  198. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/infrastructure/recorder/utils.py +0 -0
  199. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/interfaces/__init__.py +0 -0
  200. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/interfaces/cli/__init__.py +0 -0
  201. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/interfaces/cli/thinking_phrases.py +0 -0
  202. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/interfaces/cli/tui/__init__.py +0 -0
  203. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/interfaces/cli/tui/ascii.py +0 -0
  204. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/interfaces/cli/tui/banner.py +0 -0
  205. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/interfaces/cli/tui/markdown.py +0 -0
  206. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/interfaces/cli/tui/notify.py +0 -0
  207. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/interfaces/cli/tui/printer.py +0 -0
  208. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/interfaces/cli/tui/story_progress.py +0 -0
  209. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/interfaces/cli/tui/text.py +0 -0
  210. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/interfaces/cli/utils.py +0 -0
  211. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/__init__.py +0 -0
  212. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/connector/__init__.py +0 -0
  213. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/connector/connector.py +0 -0
  214. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/debug.py +0 -0
  215. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/exceptions.py +0 -0
  216. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/files.py +0 -0
  217. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/hashing.py +0 -0
  218. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/interaction.py +0 -0
  219. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/media.py +0 -0
  220. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/notifications.py +0 -0
  221. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/service/__init__.py +0 -0
  222. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/service/exceptions.py +0 -0
  223. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/service/mixin.py +0 -0
  224. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/service/service.py +0 -0
  225. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/settings/__init__.py +0 -0
  226. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/settings/load.py +0 -0
  227. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/settings/settings.py +0 -0
  228. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/singleton.py +0 -0
  229. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/subprocess.py +0 -0
  230. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/typing/__init__.py +0 -0
  231. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/typing/constants.py +0 -0
  232. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/typing/exceptions.py +0 -0
  233. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/typing/registry.py +0 -0
  234. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/typing/signature.py +0 -0
  235. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/typing/typed_kwargs.py +0 -0
  236. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/typing/typing.py +0 -0
  237. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy/shared/utils.py +0 -0
  238. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy.egg-info/dependency_links.txt +0 -0
  239. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy.egg-info/entry_points.txt +0 -0
  240. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy.egg-info/requires.txt +0 -0
  241. {dandy-3.0.0a7 → dandy-3.0.0a8}/dandy.egg-info/top_level.txt +0 -0
  242. {dandy-3.0.0a7 → dandy-3.0.0a8}/setup.cfg +0 -0
  243. {dandy-3.0.0a7 → dandy-3.0.0a8}/tests/test_dandy.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dandy
3
- Version: 3.0.0a7
3
+ Version: 3.0.0a8
4
4
  Summary: Python Artificial Intelligence Framework
5
5
  Author-email: Nathan Johnson <nathanj@stratusadv.com>
6
6
  License-Expression: MIT
@@ -1,5 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import traceback
3
4
  from typing import TYPE_CHECKING, Callable, Sequence
4
5
 
5
6
  from pydantic import ValidationError
@@ -12,10 +13,20 @@ from dandy.application.agent.attachments import (
12
13
  )
13
14
  from dandy.application.agent.compaction import summarize_and_compact_history
14
15
  from dandy.application.agent.exceptions import AgentUsageError, AgentExternalError
15
- from dandy.application.agent.intel import AgentSession, AgentTurnIntel
16
+ from dandy.application.agent.intel import (
17
+ TURN_LOG_ENTRY_LIMIT,
18
+ TURN_OUTCOME_ERROR,
19
+ TURN_OUTCOME_STOPPED,
20
+ TURN_OUTCOME_SUCCESS,
21
+ AgentSession,
22
+ AgentTurnIntel,
23
+ TurnErrorIntel,
24
+ TurnOutcomeIntel,
25
+ )
16
26
  from dandy.application.agent.prompts import continuation_prompt
17
27
  from dandy.shared.cancellation import stop_signal
18
28
  from dandy.shared.exceptions import RUN_STOPPED_MESSAGE, RunStoppedError
29
+ from dandy.shared.utils import truncate_output
19
30
  from dandy.domain.guard.guard import GuardChain
20
31
  from dandy.domain.message.compaction import (
21
32
  COMPACTION_TARGET_RATIO,
@@ -23,7 +34,7 @@ from dandy.domain.message.compaction import (
23
34
  DEFAULT_CONTEXT_WINDOW,
24
35
  drop_incomplete_tool_round,
25
36
  )
26
- from dandy.domain.message.message import MessageHistory
37
+ from dandy.domain.message.message import Message, MessageHistory
27
38
  from dandy.domain.prompt.prompt import Prompt
28
39
  from dandy.domain.request.exceptions import LlmExternalError
29
40
  from dandy.domain.skill.skill import to_skill_instances
@@ -79,6 +90,10 @@ class Agent:
79
90
  self._guard_chain = GuardChain(self.guards or [])
80
91
  self._turn_count = 0
81
92
  self._pending_turn_note: str | None = None
93
+ self.last_turn_outcome: str | None = None
94
+ self.last_turn_error: TurnErrorIntel | None = None
95
+ self.turn_log: list[TurnOutcomeIntel] = []
96
+ self.interrupted_round: list[Message] = []
82
97
 
83
98
  if self.skills:
84
99
  self.bot.llm.skills.register(self.skills)
@@ -93,6 +108,11 @@ class Agent:
93
108
  def llm(self) -> LlmService:
94
109
  return self.bot.llm
95
110
 
111
+ @property
112
+ def turn_count(self) -> int:
113
+ """How many turns this conversation has run (reset by ``clear()``)."""
114
+ return self._turn_count
115
+
96
116
  def turn(
97
117
  self,
98
118
  message: Prompt | str | None = None,
@@ -114,41 +134,93 @@ class Agent:
114
134
  and project-file attachments are named in the message text for the
115
135
  agent to read with its tools.
116
136
  """
117
- if stop_signal.is_set():
118
- raise RunStoppedError(RUN_STOPPED_MESSAGE)
137
+ phase = 'start'
119
138
 
120
- self._turn_count += 1
121
- self.last_request = self._message_as_str(message)
122
- self.max_context_tokens = self._resolve_context_size()
123
- message = self._prepare_message(message, progress_callback, verbose_callback)
124
- self._watch_turn_start(message, verbose_callback)
125
- self._compact_history_for_next_message(message, progress_callback)
126
- self._ensure_history_fits(message, attachments)
127
-
128
- prompt = message
129
- attachments = attachments or []
130
-
131
- if attachments:
132
- self._append_attachment_message(message, attachments)
133
- prompt = None
134
-
135
- result = self.bot.llm.tools.prompt_to_intel(
136
- prompt=prompt,
137
- tools=self.tools,
138
- intel_class=self.intel_class,
139
- message_history=self.history,
140
- replace_message_history=True,
141
- progress_callback=progress_callback,
142
- verbose_callback=verbose_callback,
143
- tool_call_callback=tool_call_callback,
144
- max_tool_iterations=self.max_tool_rounds,
145
- guards=self.guards,
146
- )
139
+ try:
140
+ self._raise_if_stopped()
141
+
142
+ self._turn_count += 1
143
+ self.last_request = self._message_as_str(message)
144
+ self.max_context_tokens = self._resolve_context_size()
145
+ phase = 'prepare'
146
+ message = self._prepare_message(message, progress_callback, verbose_callback)
147
+ phase = 'guard_start'
148
+ self._watch_turn_start(message, verbose_callback)
149
+ phase = 'compaction'
150
+ self._compact_history_for_next_message(message, progress_callback)
151
+ phase = 'context_fit'
152
+ self._ensure_history_fits(message, attachments)
153
+
154
+ prompt = message
155
+ attachments = attachments or []
156
+
157
+ if attachments:
158
+ self._append_attachment_message(message, attachments)
159
+ prompt = None
160
+
161
+ phase = 'tool_loop'
162
+ result = self.bot.llm.tools.prompt_to_intel(
163
+ prompt=prompt,
164
+ tools=self.tools,
165
+ intel_class=self.intel_class,
166
+ message_history=self.history,
167
+ replace_message_history=True,
168
+ progress_callback=progress_callback,
169
+ verbose_callback=verbose_callback,
170
+ tool_call_callback=tool_call_callback,
171
+ max_tool_iterations=self.max_tool_rounds,
172
+ guards=self.guards,
173
+ )
147
174
 
148
- self._watch_turn_end(result, verbose_callback)
175
+ phase = 'guard_end'
176
+ self._watch_turn_end(result, verbose_callback)
177
+ except (RunStoppedError, KeyboardInterrupt) as error:
178
+ self._record_turn_outcome(TURN_OUTCOME_STOPPED, error, phase)
179
+ raise
180
+ except Exception as error:
181
+ self._record_turn_outcome(TURN_OUTCOME_ERROR, error, phase)
182
+ raise
183
+ else:
184
+ self._record_turn_outcome(TURN_OUTCOME_SUCCESS)
149
185
 
150
186
  return result
151
187
 
188
+ @staticmethod
189
+ def _raise_if_stopped() -> None:
190
+ if stop_signal.is_set():
191
+ raise RunStoppedError(RUN_STOPPED_MESSAGE)
192
+
193
+ def _record_turn_outcome(
194
+ self, outcome: str, error: BaseException | None = None, phase: str = ''
195
+ ) -> None:
196
+ """Record how the turn ended so the session snapshot can carry it."""
197
+ self.last_turn_outcome = outcome
198
+ self.last_turn_error = None
199
+
200
+ if error is not None:
201
+ traceback_text = (
202
+ truncate_output(''.join(traceback.format_exception(error)))
203
+ if outcome == TURN_OUTCOME_ERROR
204
+ else ''
205
+ )
206
+ self.last_turn_error = TurnErrorIntel(
207
+ error_type=type(error).__name__,
208
+ message=str(error),
209
+ traceback_text=traceback_text,
210
+ turn_number=self._turn_count,
211
+ phase=phase,
212
+ )
213
+
214
+ self.turn_log.append(
215
+ TurnOutcomeIntel(
216
+ turn_number=self._turn_count,
217
+ outcome=outcome,
218
+ error_type=self.last_turn_error.error_type if self.last_turn_error else None,
219
+ error_message=self.last_turn_error.message if self.last_turn_error else None,
220
+ )
221
+ )
222
+ del self.turn_log[:-TURN_LOG_ENTRY_LIMIT]
223
+
152
224
  def _prepare_message(
153
225
  self,
154
226
  message: Prompt | str | None,
@@ -320,6 +392,10 @@ class Agent:
320
392
  self.bot.reset()
321
393
  self._turn_count = 0
322
394
  self._pending_turn_note = None
395
+ self.last_turn_outcome = None
396
+ self.last_turn_error = None
397
+ self.turn_log = []
398
+ self.interrupted_round = []
323
399
 
324
400
  for guard in self.guards or []:
325
401
  guard.reset()
@@ -330,9 +406,14 @@ class Agent:
330
406
  A crash mid tool round can leave the history ending on a tool-call
331
407
  declaration whose results never arrived; that round is invalid on
332
408
  the wire, so it is dropped from the live history before the snapshot
333
- and the next turn continues from a well-formed conversation.
409
+ and the next turn continues from a well-formed conversation. The
410
+ dropped round is preserved in the snapshot's ``interrupted_round``
411
+ as evidence of the interrupted attempt.
334
412
  """
335
- drop_incomplete_tool_round(self.history)
413
+ dropped_messages = drop_incomplete_tool_round(self.history)
414
+
415
+ if dropped_messages:
416
+ self.interrupted_round = dropped_messages
336
417
 
337
418
  return AgentSession(
338
419
  messages=list(self.history.messages),
@@ -340,12 +421,21 @@ class Agent:
340
421
  model=self.bot.llm.config.model,
341
422
  config=self.bot.llm.config.name,
342
423
  token_count=self.history.estimated_token_count,
424
+ last_turn_outcome=self.last_turn_outcome,
425
+ last_error=self.last_turn_error,
426
+ turn_log=list(self.turn_log),
427
+ interrupted_round=list(self.interrupted_round),
343
428
  )
344
429
 
345
430
  def load_session(self, session: AgentSession) -> None:
346
431
  """Replace the conversation with a saved snapshot and reset the bot."""
347
432
  self.history = MessageHistory(messages=list(session.messages))
348
433
  self.last_request = session.last_request
434
+ self.last_turn_outcome = session.last_turn_outcome
435
+ self.last_turn_error = session.last_error
436
+ self.turn_log = list(session.turn_log)
437
+ self.interrupted_round = list(session.interrupted_round)
438
+ self._turn_count = max((entry.turn_number for entry in self.turn_log), default=0)
349
439
  self.bot.reset()
350
440
 
351
441
  def save_session_json(self) -> str:
@@ -11,7 +11,8 @@ from dandy.application.agent.session import session
11
11
  from dandy.application.agent.intelligence.tools import AGENT_TOOLS
12
12
  from dandy.application.agent.intelligence.tools.question import QuestionHandler, QuestionTool
13
13
  from dandy.domain.intel.intel import DefaultIntel
14
- from dandy.domain.message.message import MessageContent
14
+ from dandy.domain.message.message import Message, MessageContent
15
+ from dandy.domain.prompt.prompt import Prompt
15
16
 
16
17
  if TYPE_CHECKING:
17
18
  from dandy.domain.guard.guard import Guard
@@ -36,6 +37,67 @@ class CliAgent(Agent):
36
37
  guards=guards,
37
38
  )
38
39
 
40
+ def _prepare_message(
41
+ self,
42
+ message: Prompt | str | None,
43
+ _progress_callback: Callable[[StoryBeat], None] | None = None,
44
+ _verbose_callback: Callable[[str], None] | None = None,
45
+ ) -> Prompt | str | None:
46
+ """Tell the model about an interrupted attempt before the next request.
47
+
48
+ When the previous turn died mid tool round, the quarantined round is
49
+ summarized into a one-time note prepended to the incoming message so
50
+ the model knows work may be half-done instead of silently retrying
51
+ from a rewound conversation.
52
+ """
53
+ if not self.interrupted_round:
54
+ return message
55
+
56
+ note = self._interrupted_round_note(self.interrupted_round)
57
+ self.interrupted_round = []
58
+
59
+ if message is None:
60
+ return note
61
+
62
+ message_text = message.to_str() if isinstance(message, Prompt) else message
63
+
64
+ return f'{note}\n\n{message_text}'
65
+
66
+ def _interrupted_round_note(self, interrupted_round: list[Message]) -> str:
67
+ opening = (
68
+ 'The previous turn was interrupted before it finished. '
69
+ 'It had requested these tool calls:'
70
+ )
71
+ lines = [opening]
72
+ call_lines = []
73
+
74
+ for message in interrupted_round:
75
+ for tool_call in message.tool_calls or []:
76
+ function = tool_call.get('function', {})
77
+ arguments = str(function.get('arguments', ''))
78
+
79
+ if len(arguments) > 200:
80
+ arguments = f'{arguments[:200]}...'
81
+
82
+ call_lines.append(f'- {function.get("name", "unknown")}({arguments})')
83
+
84
+ lines.extend(call_lines[:8])
85
+
86
+ if len(call_lines) > 8:
87
+ lines.append(f'- ... and {len(call_lines) - 8} more')
88
+
89
+ if self.last_turn_error is not None:
90
+ lines.append(
91
+ f'It ended with {self.last_turn_error.error_type}: {self.last_turn_error.message}'
92
+ )
93
+
94
+ lines.append(
95
+ 'Some results may be missing and work may be half-done; verify the current '
96
+ 'state before repeating or continuing that work.'
97
+ )
98
+
99
+ return '\n'.join(lines)
100
+
39
101
  def reload_agents_md(self) -> str:
40
102
  """Re-read the project AGENTS.md and sync it into the system prompt.
41
103
 
@@ -0,0 +1,193 @@
1
+ from dandy.domain.prompt.prompt import Prompt
2
+
3
+
4
+ def cli_usage_prompt() -> Prompt:
5
+ """The full usage and configuration guide served by the dandy_cli skill."""
6
+ return (
7
+ Prompt(
8
+ 'You are answering questions about the Dandy CLI itself (the `dandy` '
9
+ 'command the user is talking to right now). Use the guide below; when a '
10
+ 'detail is not covered here, read the relevant source file named in the '
11
+ 'guide rather than guessing.'
12
+ )
13
+ .sub_heading('Running the CLI')
14
+ .list(
15
+ [
16
+ (
17
+ '`dandy` opens the interactive REPL: every message you type goes to '
18
+ 'the coding agent, which answers or edits the project with its tools.'
19
+ ),
20
+ (
21
+ '`dandy "<request>"` runs exactly one agent turn and exits with code 1 '
22
+ 'when the turn failed or was stopped (so scripts can detect it).'
23
+ ),
24
+ (
25
+ 'Press escape twice to leave the REPL; mid-turn the same double-escape '
26
+ 'stops the running turn. `/quit` (`/q`, or `/exit`) also leaves.'
27
+ ),
28
+ (
29
+ 'The agent can ask a question on screen with the `question` tool; type '
30
+ 'the choice number or free text to answer, or double-escape to stop.'
31
+ ),
32
+ (
33
+ 'Each keystroke shows inline `/` command suggestions and tab completes '
34
+ 'the command word.'
35
+ ),
36
+ (
37
+ 'A desktop notification fires when a request completes or a question '
38
+ 'waits (opt out with `DESKTOP_NOTIFICATIONS = False`, or the env var '
39
+ '`DANDY_DESKTOP_NOTIFICATIONS=0`).'
40
+ ),
41
+ ]
42
+ )
43
+ .sub_heading('REPL Commands (each also has a one-letter short)')
44
+ .list(
45
+ [
46
+ (
47
+ '`/init` (`/i`) - explore the project and write (or refresh) the '
48
+ 'AGENTS.md instructions file at the project root.'
49
+ ),
50
+ (
51
+ '`/new [name]` (`/n`) - start a fresh conversation, optionally '
52
+ 'pre-naming the session that will be saved.'
53
+ ),
54
+ (
55
+ '`/sessions [row|name]` (`/s`) - list the 30 most recent saved '
56
+ 'sessions, or resume one by its table row number or name.'
57
+ ),
58
+ (
59
+ '`/session-all [row|name]` (`/a`) - the same table over every saved '
60
+ 'session (REPL only).'
61
+ ),
62
+ (
63
+ '`/resume [row|name]` (`/r`) - resume the most recently saved session '
64
+ '(or one given by row/name).'
65
+ ),
66
+ '`/delete <name>` (`/d`) - delete a saved session.',
67
+ (
68
+ '`/webview` (`/w`) - write `.dandy/dandy.html` and open a browser '
69
+ "viewer for the project's `.dandy` folder (sessions, logs, skills)."
70
+ ),
71
+ (
72
+ '`/paste` (`/p`) - read multi-line text from stdin until Ctrl-D and '
73
+ 'submit it as one message (fallback for terminals without bracketed '
74
+ 'paste; real pastes land as one unit marked `⤶ N lines pasted`).'
75
+ ),
76
+ ]
77
+ )
78
+ .sub_heading('One-Shot Flags')
79
+ .list(
80
+ [
81
+ (
82
+ 'Every command except paste and quit has a long/short flag form: '
83
+ '`dandy --sessions` / `-s` prints the table; `-s <row|name>` opens '
84
+ 'the REPL on that session; `-s <row|name> "<request>"` (or `-r '
85
+ '"<request>"` for the latest) runs one turn inside it and re-saves; '
86
+ '`--new [name]` / `-n` starts fresh; `--delete <name>` / `-d <name>` '
87
+ 'deletes; `--webview` / `-w` opens the browser view; `--init` / `-i` '
88
+ 'runs the AGENTS.md pass and exits 1 when the file was not written.'
89
+ ),
90
+ '`-h`/`--help` prints usage; `-v`/`--version` prints the version.',
91
+ ]
92
+ )
93
+ .sub_heading('Sessions')
94
+ .list(
95
+ [
96
+ (
97
+ 'Every turn auto-saves the conversation to '
98
+ '`<project>/.dandy/agent/sessions/` as one JSON file per session; the '
99
+ 'first turn auto-names it `YYYY-MM-DD-HH-MM-<slug>` from the request.'
100
+ ),
101
+ (
102
+ 'Session files carry the last turn outcome (`success`/`error`/'
103
+ '`stopped`), the last error, a bounded turn log, and any quarantined '
104
+ 'interrupted tool round; `/sessions` marks errored or stopped ones.'
105
+ ),
106
+ '`.dandy/` is added to the project .gitignore automatically.',
107
+ (
108
+ 'A failed turn also appends to `.dandy/logs/errors.log` and dumps the '
109
+ 'recorder flight buffer to `.dandy/logs/flight-*.json`.'
110
+ ),
111
+ ]
112
+ )
113
+ .sub_heading('Settings & Configuration')
114
+ .list(
115
+ [
116
+ (
117
+ 'Config lives in a settings module named by the `DANDY_SETTINGS_MODULE` '
118
+ 'env var (default `dandy_settings.py` in the project root; the CLI '
119
+ 'creates one from its template when missing). It must define '
120
+ '`BASE_PATH`; everything else has defaults.'
121
+ ),
122
+ (
123
+ '`LLM_CONFIGS` is a dict of named configs with a required `DEFAULT`; '
124
+ 'others inherit `HOST`/`PORT`/`API_KEY`/`CONTEXT_SIZE` from it. '
125
+ 'Providers must be OpenAI-compatible chat completions. Keys: `HOST`, '
126
+ '`PORT`, `API_KEY`, `MODEL`, `CONTEXT_SIZE` (the compaction window), '
127
+ '`PROMPT_RETRY_COUNT`, and an `OPTIONS` dict of OpenAI request options '
128
+ '(`temperature`, `reasoning_effort`, `max_completion_tokens`, ...).'
129
+ ),
130
+ (
131
+ '`CLI_CONFIG` maps CLI roles to config names - `CODING` picks the '
132
+ 'model the agent talks to you with right now (the welcome banner '
133
+ '`Config` line shows the resolved name and model).'
134
+ ),
135
+ (
136
+ 'Other settings: `DEBUG = True` prints verbose tool-round tracing; '
137
+ '`LLM_STREAM_RESPONSES` (default True) toggles streaming; '
138
+ '`HTTP_CONNECTION_TIMEOUT_SECONDS` (read gap, default 300), '
139
+ '`HTTP_CONNECTION_CONNECT_TIMEOUT_SECONDS` (default 10), '
140
+ '`HTTP_CONNECTION_RETRY_COUNT`, `ALLOW_RECORDING_TO_FILE`.'
141
+ ),
142
+ (
143
+ 'When no settings module is usable, settings fall back to JSON: first '
144
+ '`.dandy/dandy.json` in the project, then `~/.config/dandy/dandy.json` '
145
+ '(keys like `llm_configs`, `cli_config`, `base_path`).'
146
+ ),
147
+ (
148
+ 'Env is loaded from `dandy.env` / `development.env` / `dev.env` / '
149
+ '`.env` beside the project; `AI_API_HOST`, `AI_API_KEY`, and '
150
+ '`AI_API_MODEL` feed the default template.'
151
+ ),
152
+ ]
153
+ )
154
+ .sub_heading('Skills')
155
+ .list(
156
+ [
157
+ (
158
+ 'Prompt-only skills are folders holding a `SKILL.md` in '
159
+ '`~/.config/dandy/skills/` (global) or `<project>/.dandy/skills/` '
160
+ '(project, which wins by name).'
161
+ ),
162
+ (
163
+ '`SKILL.md` is a `key: value` frontmatter block between `---` fences '
164
+ '(`name` defaulting to the folder, `description`, `active` defaulting '
165
+ 'true) followed by a markdown body that is the skill prompt.'
166
+ ),
167
+ (
168
+ 'Active skills sit in the system prompt; passive ones show only name '
169
+ 'and description until you call the `activate_skill` tool with their '
170
+ 'name, which delivers their full prompt.'
171
+ ),
172
+ (
173
+ 'This guide is itself the built-in passive `dandy_cli` skill; a user '
174
+ 'SKILL.md named `dandy_cli` replaces it.'
175
+ ),
176
+ ]
177
+ )
178
+ .sub_heading('Extras')
179
+ .list(
180
+ [
181
+ (
182
+ 'Any file path mentioned in a message is attached to the turn: images '
183
+ 'and audio go natively into the user message, other files are copied '
184
+ 'to `.dandy/attachments/` for you to read.'
185
+ ),
186
+ (
187
+ 'The project AGENTS.md is folded into your system prompt; `/init` (or '
188
+ 'the file being edited) updates it and the running conversation picks '
189
+ 'the new content up without `/new`.'
190
+ ),
191
+ ]
192
+ )
193
+ )
@@ -0,0 +1,6 @@
1
+ from dandy.application.agent.cli.intelligence.skills.cli_usage_skill import (
2
+ CLI_BUILTIN_SKILLS,
3
+ CliUsageSkill,
4
+ )
5
+
6
+ __all__ = ['CLI_BUILTIN_SKILLS', 'CliUsageSkill']
@@ -0,0 +1,22 @@
1
+ from dandy.application.agent.cli.intelligence.prompts.cli_usage_prompt import cli_usage_prompt
2
+ from dandy.domain.skill.skill import BaseSkill
3
+
4
+
5
+ class CliUsageSkill(BaseSkill):
6
+ """Built-in passive skill teaching the agent how to use and configure the CLI."""
7
+
8
+ name = 'dandy_cli'
9
+ description = (
10
+ 'How to use and configure the Dandy CLI: the REPL slash commands, the '
11
+ 'one-shot flags, session save/resume, settings (LLM_CONFIGS, CLI_CONFIG, '
12
+ 'the dandy.json fallback), skills, attachments, and logs. Use when the '
13
+ 'user asks how the dandy command itself works or how to set it up.'
14
+ )
15
+ active = False
16
+ tools = []
17
+
18
+ def __post_init__(self) -> None:
19
+ self.prompt = cli_usage_prompt().to_str()
20
+
21
+
22
+ CLI_BUILTIN_SKILLS: list[type[BaseSkill]] = [CliUsageSkill]
@@ -1,4 +1,4 @@
1
- from datetime import datetime
1
+ from datetime import UTC, datetime
2
2
 
3
3
  from pydantic import Field
4
4
 
@@ -11,6 +11,33 @@ class AgentTurnIntel(BaseIntel):
11
11
  done: bool = False
12
12
 
13
13
 
14
+ TURN_OUTCOME_SUCCESS = 'success'
15
+ TURN_OUTCOME_ERROR = 'error'
16
+ TURN_OUTCOME_STOPPED = 'stopped'
17
+ TURN_LOG_ENTRY_LIMIT = 50
18
+
19
+
20
+ class TurnErrorIntel(BaseIntel):
21
+ """What went wrong in a turn: the exception, where, and its traceback."""
22
+
23
+ error_type: str
24
+ message: str
25
+ traceback_text: str = ''
26
+ turn_number: int = 0
27
+ phase: str = ''
28
+ occurred_at: datetime = Field(default_factory=lambda: datetime.now(UTC))
29
+
30
+
31
+ class TurnOutcomeIntel(BaseIntel):
32
+ """One entry in a session's bounded audit log of turn outcomes."""
33
+
34
+ turn_number: int
35
+ outcome: str
36
+ occurred_at: datetime = Field(default_factory=lambda: datetime.now(UTC))
37
+ error_type: str | None = None
38
+ error_message: str | None = None
39
+
40
+
14
41
  class AgentSession(BaseIntel):
15
42
  """A snapshot of an agent's conversation and LLM context at one moment."""
16
43
 
@@ -19,6 +46,10 @@ class AgentSession(BaseIntel):
19
46
  model: str | None = None
20
47
  config: str | None = None
21
48
  token_count: int = 0
49
+ last_turn_outcome: str | None = None
50
+ last_error: TurnErrorIntel | None = None
51
+ turn_log: list[TurnOutcomeIntel] = Field(default_factory=list)
52
+ interrupted_round: list[Message] = Field(default_factory=list)
22
53
 
23
54
 
24
55
  class SessionRecord(BaseIntel):
@@ -48,7 +48,13 @@ class SessionStore:
48
48
  session=session,
49
49
  )
50
50
 
51
- write_to_file(record_path, record.model_dump_json(indent=2))
51
+ temporary_path = record_path.with_name(f'{record_path.name}.tmp')
52
+
53
+ try:
54
+ write_to_file(temporary_path, record.model_dump_json(indent=2))
55
+ temporary_path.replace(record_path)
56
+ finally:
57
+ temporary_path.unlink(missing_ok=True)
52
58
 
53
59
  return record
54
60
 
@@ -1,5 +1,6 @@
1
1
  from pathlib import Path
2
2
 
3
+ from dandy.application.agent.cli.intelligence.skills import CLI_BUILTIN_SKILLS
3
4
  from dandy.domain.skill.skill import BaseSkill
4
5
  from dandy.shared.constants import (
5
6
  DANDY_HOME_CONFIG_DIRECTORY_NAME,
@@ -149,14 +150,32 @@ def load_skill_files(directories: list[Path]) -> tuple[list[BaseSkill], list[str
149
150
 
150
151
 
151
152
  def load_cli_skills(project_base_path: Path) -> tuple[list[BaseSkill], list[str]]:
152
- """Load the CLI skill directories: global, then project (project wins).
153
+ """Load the CLI skills: built-ins, then global, then project (user wins).
153
154
 
154
- The global directory is ``~/.config/dandy/skills/`` and the project
155
- directory is ``<project>/.dandy/skills/``.
155
+ The built-in skills (``CLI_BUILTIN_SKILLS``) are code-defined and always
156
+ registered. The global directory is ``~/.config/dandy/skills/`` and the
157
+ project directory is ``<project>/.dandy/skills/``. A user skill sharing a
158
+ built-in's name replaces it and the replacement is reported as an issue.
156
159
  """
157
160
  global_skills_dir = (
158
161
  Path.home() / '.config' / DANDY_HOME_CONFIG_DIRECTORY_NAME / SKILLS_DIRECTORY_NAME
159
162
  )
160
163
  project_skills_dir = Path(project_base_path, DANDY_LOCAL_DIRECTORY_NAME, SKILLS_DIRECTORY_NAME)
161
164
 
162
- return load_skill_files([global_skills_dir, project_skills_dir])
165
+ file_skills, issues = load_skill_files([global_skills_dir, project_skills_dir])
166
+ file_skill_names = {skill.name for skill in file_skills}
167
+
168
+ skills: list[BaseSkill] = []
169
+
170
+ for skill_class in CLI_BUILTIN_SKILLS:
171
+ builtin_skill = skill_class()
172
+
173
+ if builtin_skill.name in file_skill_names:
174
+ issues.append(
175
+ f'built-in skill "{builtin_skill.name}" replaced by a user skill of the same name'
176
+ )
177
+ continue
178
+
179
+ skills.append(builtin_skill)
180
+
181
+ return sorted([*skills, *file_skills], key=lambda skill: skill.name), issues