dandy 3.0.0a4__tar.gz → 3.0.0a5__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.
- {dandy-3.0.0a4 → dandy-3.0.0a5}/PKG-INFO +9 -3
- {dandy-3.0.0a4 → dandy-3.0.0a5}/README.md +7 -1
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/__init__.py +15 -5
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/agent.py +78 -11
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/cli/cli_agent.py +12 -3
- dandy-3.0.0a5/dandy/application/agent/cli/environment.py +105 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/cli/intelligence/bots/coding_bot.py +10 -10
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/cli/intelligence/bots/init_bot.py +1 -1
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/cli/intelligence/bots/session_naming_bot.py +2 -2
- dandy-3.0.0a5/dandy/application/agent/cli/intelligence/prompts/coding_prompts.py +70 -0
- dandy-3.0.0a5/dandy/application/agent/cli/intelligence/prompts/init_prompts.py +79 -0
- dandy-3.0.0a5/dandy/application/agent/cli/intelligence/prompts/narration_prompt.py +15 -0
- dandy-3.0.0a5/dandy/application/agent/cli/intelligence/prompts/path_prompt.py +9 -0
- dandy-3.0.0a5/dandy/application/agent/cli/intelligence/prompts/session_name_prompt.py +25 -0
- dandy-3.0.0a5/dandy/application/agent/cli/intelligence/prompts/tool_calling_prompt.py +17 -0
- dandy-3.0.0a5/dandy/application/agent/exceptions.py +9 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/intelligence/tools/__init__.py +10 -1
- dandy-3.0.0a5/dandy/application/agent/intelligence/tools/clock/__init__.py +6 -0
- dandy-3.0.0a5/dandy/application/agent/intelligence/tools/clock/clock_tool.py +34 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/intelligence/tools/command/command_tool.py +2 -1
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/intelligence/tools/file/edit_file_tool.py +1 -2
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/intelligence/tools/file/read_file_tool.py +1 -1
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/intelligence/tools/git/git_status_tool.py +4 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/session.py +1 -12
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/session_store.py +44 -4
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/bot/bot.py +3 -7
- dandy-3.0.0a5/dandy/application/bot/exceptions.py +5 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/decision/decision.py +26 -14
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/diligence/second_pass/diligence.py +5 -5
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/diligence/stop_word_removal/diligence.py +3 -6
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/diligence/vowel_removal/diligence.py +2 -6
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/llm/service.py +6 -5
- dandy-3.0.0a5/dandy/application/skill/loader.py +162 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/skill/service.py +6 -6
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/tool/service.py +21 -16
- dandy-3.0.0a5/dandy/domain/decision/exceptions.py +17 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/decision/prompts.py +6 -2
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/guard/__init__.py +2 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/guard/context_guard.py +4 -0
- dandy-3.0.0a5/dandy/domain/guard/defaults.py +15 -0
- dandy-3.0.0a5/dandy/domain/guard/guard.py +241 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/guard/repeat_guard.py +4 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/intel/annotation.py +6 -4
- dandy-3.0.0a5/dandy/domain/intel/exceptions.py +5 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/intel/factory.py +6 -4
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/intel/intel.py +30 -13
- dandy-3.0.0a5/dandy/domain/request/exceptions.py +9 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/request/options.py +4 -4
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/request/prompts.py +7 -2
- dandy-3.0.0a5/dandy/domain/skill/exceptions.py +5 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/skill/skill.py +4 -4
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/tool/beat.py +7 -3
- dandy-3.0.0a5/dandy/domain/tool/exceptions.py +5 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/tool/tool.py +11 -3
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/cache/decorators.py +3 -1
- dandy-3.0.0a5/dandy/infrastructure/cache/exceptions.py +5 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/cache/key.py +2 -2
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/cache/sqlite/cache.py +13 -5
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/cache/sqlite/connection.py +7 -1
- dandy-3.0.0a5/dandy/infrastructure/future/exceptions.py +9 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/future/future.py +9 -6
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/http/connector.py +2 -2
- dandy-3.0.0a5/dandy/infrastructure/http/exceptions.py +5 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/llm/config.py +30 -12
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/llm/connector.py +25 -17
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/recorder/events.py +2 -1
- dandy-3.0.0a5/dandy/infrastructure/recorder/exceptions.py +5 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/recorder/recorder.py +4 -4
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/recorder/recording.py +7 -7
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/interfaces/cli/cli.py +76 -48
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/interfaces/cli/commands.py +11 -4
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/interfaces/cli/main.py +14 -13
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/interfaces/cli/one_shot.py +13 -26
- dandy-3.0.0a5/dandy/interfaces/cli/thinking_phrases.py +230 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/interfaces/cli/tui/banner.py +24 -2
- dandy-3.0.0a5/dandy/interfaces/cli/tui/notify.py +144 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/interfaces/cli/tui/printer.py +19 -15
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/interfaces/cli/tui/story_progress.py +50 -8
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/interfaces/cli/tui/tui.py +6 -2
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/interfaces/cli/usage.py +7 -4
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/interfaces/cli/utils.py +13 -4
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/shared/constants.py +3 -1
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/shared/exceptions.py +13 -7
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/shared/files.py +7 -7
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/shared/media.py +9 -9
- dandy-3.0.0a5/dandy/shared/notifications.py +46 -0
- dandy-3.0.0a5/dandy/shared/service/exceptions.py +5 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/shared/service/mixin.py +2 -2
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/shared/settings/default_settings.py +7 -1
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/shared/settings/load.py +39 -3
- dandy-3.0.0a5/dandy/shared/settings/settings.py +113 -0
- dandy-3.0.0a5/dandy/shared/typing/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/shared/typing/constants.py +0 -2
- dandy-3.0.0a5/dandy/shared/typing/exceptions.py +5 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/shared/typing/signature.py +4 -4
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/shared/typing/typed_kwargs.py +6 -3
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/shared/utils.py +0 -4
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy.egg-info/PKG-INFO +9 -3
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy.egg-info/SOURCES.txt +14 -2
- {dandy-3.0.0a4 → dandy-3.0.0a5}/pyproject.toml +1 -1
- {dandy-3.0.0a4 → dandy-3.0.0a5}/tests/test_dandy.py +4 -2
- dandy-3.0.0a4/dandy/application/agent/cli/intelligence/prompts.py +0 -183
- dandy-3.0.0a4/dandy/application/agent/exceptions.py +0 -9
- dandy-3.0.0a4/dandy/application/bot/exceptions.py +0 -9
- dandy-3.0.0a4/dandy/domain/decision/exceptions.py +0 -17
- dandy-3.0.0a4/dandy/domain/guard/guard.py +0 -136
- dandy-3.0.0a4/dandy/domain/intel/exceptions.py +0 -9
- dandy-3.0.0a4/dandy/domain/request/exceptions.py +0 -14
- dandy-3.0.0a4/dandy/domain/skill/exceptions.py +0 -5
- dandy-3.0.0a4/dandy/domain/tool/exceptions.py +0 -5
- dandy-3.0.0a4/dandy/infrastructure/cache/exceptions.py +0 -9
- dandy-3.0.0a4/dandy/infrastructure/future/exceptions.py +0 -9
- dandy-3.0.0a4/dandy/infrastructure/http/exceptions.py +0 -9
- dandy-3.0.0a4/dandy/infrastructure/recorder/exceptions.py +0 -9
- dandy-3.0.0a4/dandy/interfaces/cli/thinking_phrases.py +0 -315
- dandy-3.0.0a4/dandy/shared/connector/exceptions.py +0 -9
- dandy-3.0.0a4/dandy/shared/service/exceptions.py +0 -9
- dandy-3.0.0a4/dandy/shared/settings/settings.py +0 -88
- dandy-3.0.0a4/dandy/shared/typing/exceptions.py +0 -9
- {dandy-3.0.0a4 → dandy-3.0.0a5}/LICENSE.md +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/cli/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/cli/agents_md.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/cli/intelligence/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/cli/intelligence/bots/__init__.py +0 -0
- {dandy-3.0.0a4/dandy/application/agent/intelligence → dandy-3.0.0a5/dandy/application/agent/cli/intelligence/prompts}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/intel.py +0 -0
- {dandy-3.0.0a4/dandy/application/bot → dandy-3.0.0a5/dandy/application/agent/intelligence}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/intelligence/tools/command/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/intelligence/tools/file/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/intelligence/tools/file/create_directory_tool.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/intelligence/tools/file/delete_file_tool.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/intelligence/tools/file/list_directory_tool.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/intelligence/tools/file/search_tool.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/intelligence/tools/file/write_file_tool.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/intelligence/tools/git/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/intelligence/tools/git/git_diff_tool.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/intelligence/tools/paths.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/intelligence/tools/question/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/intelligence/tools/question/question_tool.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/intelligence/tools/tool_errors.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/prompts.py +0 -0
- {dandy-3.0.0a4/dandy/application/decision → dandy-3.0.0a5/dandy/application/bot}/__init__.py +0 -0
- {dandy-3.0.0a4/dandy/application/diligence → dandy-3.0.0a5/dandy/application/decision}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/decision/mixin.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/decision/service.py +0 -0
- {dandy-3.0.0a4/dandy/application/diligence/second_pass → dandy-3.0.0a5/dandy/application/diligence}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/diligence/diligence.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/diligence/handler.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/diligence/mixin.py +0 -0
- {dandy-3.0.0a4/dandy/application/diligence/stop_word_removal → dandy-3.0.0a5/dandy/application/diligence/second_pass}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/diligence/service.py +0 -0
- {dandy-3.0.0a4/dandy/application/diligence/vowel_removal → dandy-3.0.0a5/dandy/application/diligence/stop_word_removal}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/diligence/stop_word_removal/constants.py +0 -0
- {dandy-3.0.0a4/dandy/application/llm → dandy-3.0.0a5/dandy/application/diligence/vowel_removal}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/diligence/vowel_removal/constants.py +0 -0
- {dandy-3.0.0a4/dandy/application/skill → dandy-3.0.0a5/dandy/application/llm}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/llm/mixin.py +0 -0
- {dandy-3.0.0a4/dandy/application/tool → dandy-3.0.0a5/dandy/application/skill}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/skill/mixin.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/skill/tools.py +0 -0
- {dandy-3.0.0a4/dandy/domain → dandy-3.0.0a5/dandy/application/tool}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/tool/mixin.py +0 -0
- {dandy-3.0.0a4/dandy/domain/decision → dandy-3.0.0a5/dandy/domain}/__init__.py +0 -0
- {dandy-3.0.0a4/dandy/domain/intel → dandy-3.0.0a5/dandy/domain/decision}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/decision/intel.py +0 -0
- {dandy-3.0.0a4/dandy/domain/message → dandy-3.0.0a5/dandy/domain/intel}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/intel/mixin.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/intel/service.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/intel/typing.py +0 -0
- {dandy-3.0.0a4/dandy/domain/prompt → dandy-3.0.0a5/dandy/domain/message}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/message/compaction.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/message/message.py +0 -0
- {dandy-3.0.0a4/dandy/domain/request → dandy-3.0.0a5/dandy/domain/prompt}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/prompt/prompt.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/prompt/snippet.py +0 -0
- {dandy-3.0.0a4/dandy/domain/tokens → dandy-3.0.0a5/dandy/domain/request}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/request/request.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/skill/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/skill/prompts.py +0 -0
- {dandy-3.0.0a4/dandy/infrastructure → dandy-3.0.0a5/dandy/domain/tokens}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/tokens/estimate.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/tool/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/domain/tool/intel.py +0 -0
- {dandy-3.0.0a4/dandy/infrastructure/cache → dandy-3.0.0a5/dandy/infrastructure}/__init__.py +0 -0
- {dandy-3.0.0a4/dandy/infrastructure/cache/memory → dandy-3.0.0a5/dandy/infrastructure/cache}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/cache/cache.py +0 -0
- {dandy-3.0.0a4/dandy/infrastructure/cache/sqlite → dandy-3.0.0a5/dandy/infrastructure/cache/memory}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/cache/memory/cache.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/cache/memory/decorators.py +0 -0
- {dandy-3.0.0a4/dandy/infrastructure/file → dandy-3.0.0a5/dandy/infrastructure/cache/sqlite}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/cache/sqlite/decorators.py +0 -0
- {dandy-3.0.0a4/dandy/infrastructure/future → dandy-3.0.0a5/dandy/infrastructure/file}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/file/mixin.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/file/service.py +0 -0
- {dandy-3.0.0a4/dandy/infrastructure/http → dandy-3.0.0a5/dandy/infrastructure/future}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/future/process.py +0 -0
- {dandy-3.0.0a4/dandy/infrastructure/llm → dandy-3.0.0a5/dandy/infrastructure/http}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/http/intel.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/http/mixin.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/http/service.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/http/url.py +0 -0
- {dandy-3.0.0a4/dandy/infrastructure/recorder → dandy-3.0.0a5/dandy/infrastructure/llm}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/llm/fenced_json.py +0 -0
- {dandy-3.0.0a4/dandy/infrastructure/recorder/renderer → dandy-3.0.0a5/dandy/infrastructure/recorder}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/recorder/bot_events.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/recorder/decision_events.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/recorder/decorators.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/recorder/diligence_events.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/recorder/llm_events.py +0 -0
- {dandy-3.0.0a4/dandy/interfaces → dandy-3.0.0a5/dandy/infrastructure/recorder/renderer}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/recorder/renderer/html.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/recorder/renderer/html_templates/base_event_template.html +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/recorder/renderer/html_templates/base_recording_output_template.html +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/recorder/renderer/json.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/recorder/renderer/markdown.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/recorder/renderer/renderer.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/recorder/tool_events.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/infrastructure/recorder/utils.py +0 -0
- {dandy-3.0.0a4/dandy/interfaces/cli → dandy-3.0.0a5/dandy/interfaces}/__init__.py +0 -0
- {dandy-3.0.0a4/dandy/interfaces/cli/tui → dandy-3.0.0a5/dandy/interfaces/cli}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/interfaces/cli/error_log.py +0 -0
- {dandy-3.0.0a4/dandy/shared → dandy-3.0.0a5/dandy/interfaces/cli/tui}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/interfaces/cli/tui/ascii.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/interfaces/cli/tui/markdown.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/interfaces/cli/tui/text.py +0 -0
- {dandy-3.0.0a4/dandy/shared/connector → dandy-3.0.0a5/dandy/shared}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/shared/cancellation.py +0 -0
- {dandy-3.0.0a4/dandy/shared/service → dandy-3.0.0a5/dandy/shared/connector}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/shared/connector/connector.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/shared/debug.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/shared/hashing.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/shared/interaction.py +0 -0
- {dandy-3.0.0a4/dandy/shared/typing → dandy-3.0.0a5/dandy/shared/service}/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/shared/service/service.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/shared/settings/__init__.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/shared/singleton.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/shared/subprocess.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/shared/typing/registry.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/shared/typing/typing.py +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy.egg-info/dependency_links.txt +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy.egg-info/entry_points.txt +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy.egg-info/requires.txt +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/dandy.egg-info/top_level.txt +0 -0
- {dandy-3.0.0a4 → dandy-3.0.0a5}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dandy
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.0a5
|
|
4
4
|
Summary: Python Artificial Intelligence Framework
|
|
5
5
|
Author-email: Nathan Johnson <nathanj@stratusadv.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -9,7 +9,7 @@ Project-URL: Documentation, https://dandysoftware.com
|
|
|
9
9
|
Project-URL: Repository, https://github.com/stratusadv/dandy
|
|
10
10
|
Project-URL: Changelog, https://dandysoftware.com/changelog/changelog/
|
|
11
11
|
Keywords: dandy,ai,cli,llm,agent,prompt,gpt,bot,workflow,automation,artificial intelligence
|
|
12
|
-
Classifier: Development Status ::
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
13
|
Classifier: Operating System :: OS Independent
|
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
@@ -72,10 +72,16 @@ The `dandy` command runs the coding assistant against the current project. Run i
|
|
|
72
72
|
```bash
|
|
73
73
|
dandy # start an interactive agentic loop
|
|
74
74
|
dandy "fix the failing tests" # run one request, then exit
|
|
75
|
+
dandy -r "one more fix" # run one request inside the latest session
|
|
76
|
+
dandy -s my-session "resume me" # run one request inside a named session
|
|
77
|
+
dandy -n new-name # start a fresh, pre-named conversation
|
|
78
|
+
dandy --sessions # list saved sessions
|
|
79
|
+
dandy --init # create or refresh the project AGENTS.md
|
|
80
|
+
dandy -d old-session # delete a saved session
|
|
75
81
|
dandy -h # show usage
|
|
76
82
|
```
|
|
77
83
|
|
|
78
|
-
Inside the interactive session every message goes to the coding agent. `/
|
|
84
|
+
Inside the interactive session every message goes to the coding agent. `/new` (or `/n`) starts a fresh conversation, `/sessions` (or `/s`) lists or resumes saved sessions, and pressing `escape` twice (or `/quit`) exits the loop. Use the one-shot form when you only want a single answer without entering the REPL.
|
|
79
85
|
|
|
80
86
|
The CLI's model is set with `CLI_CONFIG` in `dandy_settings.py`, e.g. `CLI_CONFIG = {'CODING': 'DEFAULT'}` points the coding agent at the `DEFAULT` entry in `LLM_CONFIGS`.
|
|
81
87
|
|
|
@@ -28,10 +28,16 @@ The `dandy` command runs the coding assistant against the current project. Run i
|
|
|
28
28
|
```bash
|
|
29
29
|
dandy # start an interactive agentic loop
|
|
30
30
|
dandy "fix the failing tests" # run one request, then exit
|
|
31
|
+
dandy -r "one more fix" # run one request inside the latest session
|
|
32
|
+
dandy -s my-session "resume me" # run one request inside a named session
|
|
33
|
+
dandy -n new-name # start a fresh, pre-named conversation
|
|
34
|
+
dandy --sessions # list saved sessions
|
|
35
|
+
dandy --init # create or refresh the project AGENTS.md
|
|
36
|
+
dandy -d old-session # delete a saved session
|
|
31
37
|
dandy -h # show usage
|
|
32
38
|
```
|
|
33
39
|
|
|
34
|
-
Inside the interactive session every message goes to the coding agent. `/
|
|
40
|
+
Inside the interactive session every message goes to the coding agent. `/new` (or `/n`) starts a fresh conversation, `/sessions` (or `/s`) lists or resumes saved sessions, and pressing `escape` twice (or `/quit`) exits the loop. Use the one-shot form when you only want a single answer without entering the REPL.
|
|
35
41
|
|
|
36
42
|
The CLI's model is set with `CLI_CONFIG` in `dandy_settings.py`, e.g. `CLI_CONFIG = {'CODING': 'DEFAULT'}` points the coding agent at the `DEFAULT` entry in `LLM_CONFIGS`.
|
|
37
43
|
|
|
@@ -6,7 +6,13 @@ from dandy.infrastructure.cache.memory.decorators import cache_to_memory
|
|
|
6
6
|
from dandy.infrastructure.cache.sqlite.cache import SqliteCache
|
|
7
7
|
from dandy.infrastructure.cache.sqlite.decorators import cache_to_sqlite
|
|
8
8
|
from dandy.infrastructure.cache.key import generate_cache_key
|
|
9
|
-
from dandy.shared.exceptions import
|
|
9
|
+
from dandy.shared.exceptions import (
|
|
10
|
+
DandyConfigurationError,
|
|
11
|
+
DandyError,
|
|
12
|
+
DandyExternalError,
|
|
13
|
+
DandyFlowError,
|
|
14
|
+
DandyUsageError,
|
|
15
|
+
)
|
|
10
16
|
from dandy.shared.hashing import HashMixin
|
|
11
17
|
from dandy.infrastructure.future.process import process_to_future
|
|
12
18
|
from dandy.domain.intel.intel import BaseIntel, BaseListIntel, DefaultIntel
|
|
@@ -31,9 +37,11 @@ __all__ = [
|
|
|
31
37
|
'BaseTool',
|
|
32
38
|
'Bot',
|
|
33
39
|
'Dandy',
|
|
34
|
-
'
|
|
40
|
+
'DandyConfigurationError',
|
|
35
41
|
'DandyError',
|
|
36
|
-
'
|
|
42
|
+
'DandyExternalError',
|
|
43
|
+
'DandyFlowError',
|
|
44
|
+
'DandyUsageError',
|
|
37
45
|
'Decision',
|
|
38
46
|
'DefaultIntel',
|
|
39
47
|
'HashMixin',
|
|
@@ -70,9 +78,11 @@ class Dandy:
|
|
|
70
78
|
BaseSkill = BaseSkill
|
|
71
79
|
BaseTool = BaseTool
|
|
72
80
|
Bot = Bot
|
|
73
|
-
|
|
81
|
+
DandyConfigurationError = DandyConfigurationError
|
|
74
82
|
DandyError = DandyError
|
|
75
|
-
|
|
83
|
+
DandyExternalError = DandyExternalError
|
|
84
|
+
DandyFlowError = DandyFlowError
|
|
85
|
+
DandyUsageError = DandyUsageError
|
|
76
86
|
Decision = Decision
|
|
77
87
|
DefaultIntel = DefaultIntel
|
|
78
88
|
HashMixin = HashMixin
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from typing import TYPE_CHECKING, Callable
|
|
3
|
+
from typing import TYPE_CHECKING, Callable, Sequence
|
|
4
4
|
|
|
5
5
|
from pydantic import ValidationError
|
|
6
6
|
|
|
7
|
-
from dandy.application.agent.exceptions import
|
|
7
|
+
from dandy.application.agent.exceptions import AgentUsageError, AgentExternalError
|
|
8
8
|
from dandy.application.agent.intel import AgentSession, AgentTurnIntel
|
|
9
9
|
from dandy.application.agent.prompts import continuation_prompt
|
|
10
10
|
from dandy.shared.cancellation import stop_signal
|
|
11
11
|
from dandy.shared.exceptions import RUN_STOPPED_MESSAGE, RunStoppedError
|
|
12
|
+
from dandy.domain.guard.guard import GuardChain
|
|
12
13
|
from dandy.domain.message.compaction import (
|
|
13
14
|
COMPACTION_TARGET_RATIO,
|
|
14
15
|
COMPACTION_TRIGGER_RATIO,
|
|
@@ -18,6 +19,7 @@ from dandy.domain.message.compaction import (
|
|
|
18
19
|
)
|
|
19
20
|
from dandy.domain.message.message import MessageHistory
|
|
20
21
|
from dandy.domain.prompt.prompt import Prompt
|
|
22
|
+
from dandy.domain.request.exceptions import LlmExternalError
|
|
21
23
|
from dandy.domain.skill.skill import to_skill_instances
|
|
22
24
|
from dandy.domain.tokens.estimate import get_estimated_token_count_for_string
|
|
23
25
|
from dandy.domain.tool.beat import StoryBeat
|
|
@@ -25,6 +27,7 @@ from dandy.domain.tool.beat import StoryBeat
|
|
|
25
27
|
if TYPE_CHECKING:
|
|
26
28
|
from dandy.application.bot.bot import Bot
|
|
27
29
|
from dandy.application.llm.service import LlmService
|
|
30
|
+
from dandy.domain.guard.guard import Guard
|
|
28
31
|
from dandy.domain.intel.typing import IntelType
|
|
29
32
|
from dandy.domain.skill.skill import SkillType
|
|
30
33
|
from dandy.domain.tool.tool import ToolType
|
|
@@ -55,6 +58,7 @@ class Agent:
|
|
|
55
58
|
max_turns: int | None = None,
|
|
56
59
|
max_tool_rounds: int | None = AGENT_MAX_TOOL_ROUNDS_DEFAULT,
|
|
57
60
|
intel_class: type[IntelType] | None = None,
|
|
61
|
+
guards: Sequence[Guard] | None = None,
|
|
58
62
|
) -> None:
|
|
59
63
|
self.bot = bot
|
|
60
64
|
self.tools = tools
|
|
@@ -62,9 +66,13 @@ class Agent:
|
|
|
62
66
|
self.max_turns = max_turns
|
|
63
67
|
self.max_tool_rounds = max_tool_rounds
|
|
64
68
|
self.intel_class = intel_class or AgentTurnIntel
|
|
69
|
+
self.guards = list(guards) if guards is not None else None
|
|
65
70
|
self.history = MessageHistory()
|
|
66
71
|
self.max_context_tokens = self._resolve_context_size()
|
|
67
72
|
self.last_request: str | None = None
|
|
73
|
+
self._guard_chain = GuardChain(self.guards or [])
|
|
74
|
+
self._turn_count = 0
|
|
75
|
+
self._pending_turn_note: str | None = None
|
|
68
76
|
|
|
69
77
|
if self.skills:
|
|
70
78
|
self.bot.llm.skills.register(self.skills)
|
|
@@ -90,18 +98,23 @@ class Agent:
|
|
|
90
98
|
|
|
91
99
|
The conversation accumulates in ``self.history`` across turns. When
|
|
92
100
|
``tool_call_callback`` is given, it is called once per executed tool
|
|
93
|
-
call with the tool name and its validated keyword arguments.
|
|
101
|
+
call with the tool name and its validated keyword arguments. The
|
|
102
|
+
agent's guards (when given) watch the turn boundaries: a turn-start
|
|
103
|
+
failure stops the turn before any LLM spend, and a combined
|
|
104
|
+
turn-end ``note`` is appended to the next ``run()`` continuation.
|
|
94
105
|
"""
|
|
95
106
|
if stop_signal.is_set():
|
|
96
107
|
raise RunStoppedError(RUN_STOPPED_MESSAGE)
|
|
97
108
|
|
|
109
|
+
self._turn_count += 1
|
|
98
110
|
self.last_request = self._message_as_str(message)
|
|
99
111
|
self.max_context_tokens = self._resolve_context_size()
|
|
100
112
|
message = self._prepare_message(message, progress_callback, verbose_callback)
|
|
113
|
+
self._watch_turn_start(message, verbose_callback)
|
|
101
114
|
self._compact_history_for_next_message(message, progress_callback)
|
|
102
115
|
self._ensure_history_fits(message)
|
|
103
116
|
|
|
104
|
-
|
|
117
|
+
result = self.bot.llm.tools.prompt_to_intel(
|
|
105
118
|
prompt=message,
|
|
106
119
|
tools=self.tools,
|
|
107
120
|
intel_class=self.intel_class,
|
|
@@ -111,8 +124,13 @@ class Agent:
|
|
|
111
124
|
verbose_callback=verbose_callback,
|
|
112
125
|
tool_call_callback=tool_call_callback,
|
|
113
126
|
max_tool_iterations=self.max_tool_rounds,
|
|
127
|
+
guards=self.guards,
|
|
114
128
|
)
|
|
115
129
|
|
|
130
|
+
self._watch_turn_end(result, verbose_callback)
|
|
131
|
+
|
|
132
|
+
return result
|
|
133
|
+
|
|
116
134
|
def _prepare_message(
|
|
117
135
|
self,
|
|
118
136
|
message: Prompt | str | None,
|
|
@@ -122,6 +140,48 @@ class Agent:
|
|
|
122
140
|
"""Subclass hook to shape the incoming message before it goes to the bot."""
|
|
123
141
|
return message
|
|
124
142
|
|
|
143
|
+
def _watch_turn_start(
|
|
144
|
+
self, message: Prompt | str | None, verbose_callback: Callable[[str], None] | None
|
|
145
|
+
) -> None:
|
|
146
|
+
"""Run the turn-start guards; a failure stops the turn before any LLM spend."""
|
|
147
|
+
try:
|
|
148
|
+
self._guard_chain.on_turn_start(
|
|
149
|
+
turn_number=self._turn_count,
|
|
150
|
+
message=message,
|
|
151
|
+
history_token_count=self.history.estimated_token_count,
|
|
152
|
+
context_window=self.max_context_tokens,
|
|
153
|
+
verbose_callback=verbose_callback,
|
|
154
|
+
)
|
|
155
|
+
except LlmExternalError as error:
|
|
156
|
+
raise AgentExternalError(str(error)) from error
|
|
157
|
+
|
|
158
|
+
def _watch_turn_end(
|
|
159
|
+
self, result: IntelType, verbose_callback: Callable[[str], None] | None
|
|
160
|
+
) -> None:
|
|
161
|
+
"""Run the turn-end guards; a combined note steers the next run() continuation."""
|
|
162
|
+
try:
|
|
163
|
+
outcome = self._guard_chain.on_turn_end(
|
|
164
|
+
turn_number=self._turn_count,
|
|
165
|
+
result=result,
|
|
166
|
+
history_token_count=self.history.estimated_token_count,
|
|
167
|
+
context_window=self.max_context_tokens,
|
|
168
|
+
verbose_callback=verbose_callback,
|
|
169
|
+
)
|
|
170
|
+
except LlmExternalError as error:
|
|
171
|
+
raise AgentExternalError(str(error)) from error
|
|
172
|
+
|
|
173
|
+
if outcome.note is not None:
|
|
174
|
+
self._pending_turn_note = outcome.note
|
|
175
|
+
|
|
176
|
+
def _continuation_with_pending_note(self) -> Prompt:
|
|
177
|
+
continuation = continuation_prompt()
|
|
178
|
+
|
|
179
|
+
if self._pending_turn_note is not None:
|
|
180
|
+
continuation.text(self._pending_turn_note)
|
|
181
|
+
self._pending_turn_note = None
|
|
182
|
+
|
|
183
|
+
return continuation
|
|
184
|
+
|
|
125
185
|
def _ensure_history_fits(self, message: Prompt | str | None) -> None:
|
|
126
186
|
"""Fail clearly when compaction could not bring the conversation under the window.
|
|
127
187
|
|
|
@@ -141,7 +201,7 @@ class Agent:
|
|
|
141
201
|
'after dropping everything droppable. Clear the conversation and retry, '
|
|
142
202
|
'with a shorter message if possible.'
|
|
143
203
|
)
|
|
144
|
-
raise
|
|
204
|
+
raise AgentExternalError(error_message)
|
|
145
205
|
|
|
146
206
|
def run(
|
|
147
207
|
self,
|
|
@@ -163,7 +223,9 @@ class Agent:
|
|
|
163
223
|
f'{self.intel_class.__name__} has no `done` field and no `is_done` '
|
|
164
224
|
f'callback was given.'
|
|
165
225
|
)
|
|
166
|
-
raise
|
|
226
|
+
raise AgentUsageError(message)
|
|
227
|
+
|
|
228
|
+
self._pending_turn_note = None
|
|
167
229
|
|
|
168
230
|
result = self.turn(
|
|
169
231
|
request,
|
|
@@ -182,10 +244,10 @@ class Agent:
|
|
|
182
244
|
f'Agent gave up after {self.max_turns} turns without the request '
|
|
183
245
|
f'being complete.'
|
|
184
246
|
)
|
|
185
|
-
raise
|
|
247
|
+
raise AgentExternalError(message)
|
|
186
248
|
|
|
187
249
|
result = self.turn(
|
|
188
|
-
|
|
250
|
+
self._continuation_with_pending_note(),
|
|
189
251
|
progress_callback=progress_callback,
|
|
190
252
|
verbose_callback=verbose_callback,
|
|
191
253
|
tool_call_callback=tool_call_callback,
|
|
@@ -195,10 +257,15 @@ class Agent:
|
|
|
195
257
|
return result
|
|
196
258
|
|
|
197
259
|
def clear(self) -> None:
|
|
198
|
-
"""Reset the conversation history and the
|
|
260
|
+
"""Reset the conversation history, the bot, and the guard state."""
|
|
199
261
|
self.history = MessageHistory()
|
|
200
262
|
self.last_request = None
|
|
201
263
|
self.bot.reset()
|
|
264
|
+
self._turn_count = 0
|
|
265
|
+
self._pending_turn_note = None
|
|
266
|
+
|
|
267
|
+
for guard in self.guards or []:
|
|
268
|
+
guard.reset()
|
|
202
269
|
|
|
203
270
|
def save_session(self) -> AgentSession:
|
|
204
271
|
"""Snapshot the conversation and LLM context for later loading.
|
|
@@ -234,7 +301,7 @@ class Agent:
|
|
|
234
301
|
session = AgentSession.model_validate_json(session_json)
|
|
235
302
|
except ValidationError:
|
|
236
303
|
message = 'The session JSON is not a valid agent session snapshot.'
|
|
237
|
-
raise
|
|
304
|
+
raise AgentExternalError(message) from None
|
|
238
305
|
|
|
239
306
|
self.load_session(session)
|
|
240
307
|
|
|
@@ -292,7 +359,7 @@ class Agent:
|
|
|
292
359
|
if progress_callback is not None:
|
|
293
360
|
progress_callback(
|
|
294
361
|
StoryBeat(
|
|
295
|
-
description='Compacting my thoughts into a more manageable size',
|
|
362
|
+
description='... Compacting my thoughts into a more manageable size',
|
|
296
363
|
kind='compaction',
|
|
297
364
|
)
|
|
298
365
|
)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from typing import TYPE_CHECKING, Callable
|
|
3
|
+
from typing import TYPE_CHECKING, Callable, Sequence
|
|
4
4
|
|
|
5
5
|
from dandy.application.agent.agent import AGENT_MAX_TOOL_ROUNDS_DEFAULT, Agent
|
|
6
6
|
from dandy.application.agent.cli.agents_md import read_agents_md
|
|
7
7
|
from dandy.application.agent.cli.intelligence.bots.coding_bot import CodingBot
|
|
8
8
|
from dandy.application.agent.cli.intelligence.bots.init_bot import InitBot
|
|
9
|
-
from dandy.application.agent.cli.intelligence.prompts import init_prompt
|
|
9
|
+
from dandy.application.agent.cli.intelligence.prompts.init_prompts import init_prompt
|
|
10
10
|
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
|
|
@@ -14,17 +14,26 @@ from dandy.domain.intel.intel import DefaultIntel
|
|
|
14
14
|
from dandy.domain.message.message import MessageContent
|
|
15
15
|
|
|
16
16
|
if TYPE_CHECKING:
|
|
17
|
+
from dandy.domain.guard.guard import Guard
|
|
18
|
+
from dandy.domain.skill.skill import SkillType
|
|
17
19
|
from dandy.domain.tool.beat import StoryBeat
|
|
18
20
|
|
|
19
21
|
|
|
20
22
|
class CliAgent(Agent):
|
|
21
23
|
"""Multi-turn coding agent that keeps the conversation across turns."""
|
|
22
24
|
|
|
23
|
-
def __init__(
|
|
25
|
+
def __init__(
|
|
26
|
+
self,
|
|
27
|
+
ask_user: QuestionHandler | None = None,
|
|
28
|
+
skills: list[SkillType] | None = None,
|
|
29
|
+
guards: Sequence[Guard] | None = None,
|
|
30
|
+
) -> None:
|
|
24
31
|
super().__init__(
|
|
25
32
|
bot=CodingBot(),
|
|
26
33
|
tools=[*AGENT_TOOLS, QuestionTool(ask_user=ask_user)],
|
|
34
|
+
skills=skills,
|
|
27
35
|
intel_class=DefaultIntel,
|
|
36
|
+
guards=guards,
|
|
28
37
|
)
|
|
29
38
|
|
|
30
39
|
def reload_agents_md(self) -> str:
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import platform
|
|
3
|
+
import shutil
|
|
4
|
+
import subprocess
|
|
5
|
+
import sys
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from dandy.application.agent.session import session
|
|
9
|
+
from dandy.domain.prompt.prompt import Prompt
|
|
10
|
+
|
|
11
|
+
_HIDDEN_TOP_LEVEL_NAMES = {'.git', '.dandy', '.venv', 'node_modules', '__pycache__', '.hypothesis'}
|
|
12
|
+
_GIT_COMMAND_TIMEOUT_SECONDS = 5
|
|
13
|
+
_MAX_TOP_LEVEL_ENTRIES = 50
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _git_project_info(project_base_path: Path) -> tuple[str, str] | None:
|
|
17
|
+
"""(branch, short dirty status) for the project repo, or None when unavailable."""
|
|
18
|
+
if not (project_base_path / '.git').exists() or shutil.which('git') is None:
|
|
19
|
+
return None
|
|
20
|
+
|
|
21
|
+
git = shutil.which('git')
|
|
22
|
+
|
|
23
|
+
def run_git(*arguments: str) -> subprocess.CompletedProcess[str]:
|
|
24
|
+
return subprocess.run(
|
|
25
|
+
[git, *arguments],
|
|
26
|
+
cwd=project_base_path,
|
|
27
|
+
capture_output=True,
|
|
28
|
+
text=True,
|
|
29
|
+
check=False,
|
|
30
|
+
timeout=_GIT_COMMAND_TIMEOUT_SECONDS,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
try:
|
|
34
|
+
branch_result = run_git('rev-parse', '--abbrev-ref', 'HEAD')
|
|
35
|
+
status_result = run_git('status', '--porcelain')
|
|
36
|
+
except (OSError, subprocess.TimeoutExpired):
|
|
37
|
+
return None
|
|
38
|
+
|
|
39
|
+
if branch_result.returncode != 0 or not branch_result.stdout.strip():
|
|
40
|
+
return None
|
|
41
|
+
|
|
42
|
+
changed_count = len([line for line in status_result.stdout.splitlines() if line.strip()])
|
|
43
|
+
status = 'clean' if changed_count == 0 else f'{changed_count} changed'
|
|
44
|
+
|
|
45
|
+
return branch_result.stdout.strip(), status
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _top_level_listing(project_base_path: Path) -> str:
|
|
49
|
+
try:
|
|
50
|
+
entries = sorted(project_base_path.iterdir(), key=lambda entry: entry.name.lower())
|
|
51
|
+
except OSError:
|
|
52
|
+
return 'unavailable'
|
|
53
|
+
|
|
54
|
+
names = [entry.name + '/' if entry.is_dir() else entry.name for entry in entries]
|
|
55
|
+
names = [name for name in names if name.split('/')[0] not in _HIDDEN_TOP_LEVEL_NAMES]
|
|
56
|
+
|
|
57
|
+
if len(names) > _MAX_TOP_LEVEL_ENTRIES:
|
|
58
|
+
hidden_count = len(names) - _MAX_TOP_LEVEL_ENTRIES
|
|
59
|
+
names = [*names[:_MAX_TOP_LEVEL_ENTRIES], f'... ({hidden_count} more)']
|
|
60
|
+
|
|
61
|
+
return ', '.join(names) if names else '(empty)'
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def collect_environment() -> dict[str, str]:
|
|
65
|
+
"""A snapshot of the host and project environment, for the coding agent prompt.
|
|
66
|
+
|
|
67
|
+
Every lookup is bounded and failure-tolerant: a missing git repo or a
|
|
68
|
+
vanished project root degrades the corresponding line instead of raising.
|
|
69
|
+
"""
|
|
70
|
+
environment: dict[str, str] = {}
|
|
71
|
+
|
|
72
|
+
environment['OS'] = platform.platform()
|
|
73
|
+
environment['User'] = os.environ.get('USER') or os.environ.get('USERNAME') or 'unknown'
|
|
74
|
+
environment['Python'] = platform.python_version()
|
|
75
|
+
|
|
76
|
+
if sys.prefix != sys.base_prefix:
|
|
77
|
+
environment['Python'] += f' (virtualenv: {sys.prefix})'
|
|
78
|
+
|
|
79
|
+
environment['Project root'] = str(session.project_base_path)
|
|
80
|
+
environment['Top level'] = _top_level_listing(session.project_base_path)
|
|
81
|
+
|
|
82
|
+
for manifest_name in ('justfile', 'Justfile', 'makefile', 'Makefile'):
|
|
83
|
+
if (session.project_base_path / manifest_name).is_file():
|
|
84
|
+
environment['Build tooling'] = manifest_name
|
|
85
|
+
break
|
|
86
|
+
|
|
87
|
+
git_info = _git_project_info(session.project_base_path)
|
|
88
|
+
|
|
89
|
+
if git_info:
|
|
90
|
+
branch, status = git_info
|
|
91
|
+
environment['Git'] = f'branch {branch}, {status}'
|
|
92
|
+
else:
|
|
93
|
+
environment['Git'] = 'not a git repository'
|
|
94
|
+
|
|
95
|
+
return environment
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def environment_section() -> Prompt:
|
|
99
|
+
"""The collected environment as a compact Environment section for agent guidelines."""
|
|
100
|
+
return (
|
|
101
|
+
Prompt()
|
|
102
|
+
.sub_heading('Environment')
|
|
103
|
+
.text('Snapshot of the working environment, captured when this conversation started.')
|
|
104
|
+
.list([f'{key}: {value}' for key, value in collect_environment().items()])
|
|
105
|
+
)
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
from dandy.application.agent.cli.agents_md import agents_md_section, read_agents_md
|
|
2
|
-
from dandy.application.agent.cli.
|
|
2
|
+
from dandy.application.agent.cli.environment import environment_section
|
|
3
|
+
from dandy.application.agent.cli.intelligence.prompts.coding_prompts import (
|
|
4
|
+
coding_task_prompt,
|
|
5
|
+
coding_guidelines_prompt,
|
|
6
|
+
)
|
|
3
7
|
from dandy.application.agent.session import session
|
|
4
8
|
from dandy.application.agent.intelligence.tools import AGENT_TOOLS
|
|
5
9
|
from dandy.application.bot.bot import Bot
|
|
@@ -9,15 +13,17 @@ from dandy.domain.prompt.prompt import Prompt
|
|
|
9
13
|
|
|
10
14
|
|
|
11
15
|
class CodingBot(Bot):
|
|
12
|
-
role = '
|
|
16
|
+
role = 'Advanced Coding Assistant'
|
|
17
|
+
task = coding_task_prompt()
|
|
13
18
|
|
|
14
19
|
def __post_init__(self) -> None:
|
|
15
20
|
super().__post_init__()
|
|
16
21
|
self.llm_config = get_cli_llm_config('CODING')
|
|
17
22
|
self.guidelines = self.build_guidelines()
|
|
18
23
|
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
@staticmethod
|
|
25
|
+
def build_guidelines() -> Prompt:
|
|
26
|
+
guidelines = coding_guidelines_prompt(environment=environment_section())
|
|
21
27
|
agents_md = read_agents_md(session.agents_md_path)
|
|
22
28
|
|
|
23
29
|
if agents_md is not None:
|
|
@@ -25,11 +31,5 @@ class CodingBot(Bot):
|
|
|
25
31
|
|
|
26
32
|
return guidelines
|
|
27
33
|
|
|
28
|
-
task = (
|
|
29
|
-
'Implement the user coding request by editing the project. '
|
|
30
|
-
'Use the available tools to explore and modify the code, '
|
|
31
|
-
'then give a short summary of what you changed and why.'
|
|
32
|
-
)
|
|
33
|
-
|
|
34
34
|
def process(self, user_input: Prompt | str) -> DefaultIntel:
|
|
35
35
|
return self.llm.tools.prompt_to_intel(prompt=user_input, tools=AGENT_TOOLS)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from dandy.application.agent.cli.intelligence.prompts import init_guidelines_prompt
|
|
1
|
+
from dandy.application.agent.cli.intelligence.prompts.init_prompts import init_guidelines_prompt
|
|
2
2
|
from dandy.application.agent.intelligence.tools import AGENT_TOOLS
|
|
3
3
|
from dandy.application.bot.bot import Bot
|
|
4
4
|
from dandy.shared.settings.load import get_cli_llm_config
|
{dandy-3.0.0a4 → dandy-3.0.0a5}/dandy/application/agent/cli/intelligence/bots/session_naming_bot.py
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from dandy.application.agent.intel import SessionNameIntel
|
|
2
|
-
from dandy.application.agent.cli.intelligence.prompts import session_name_prompt
|
|
2
|
+
from dandy.application.agent.cli.intelligence.prompts.session_name_prompt import session_name_prompt
|
|
3
3
|
from dandy.application.bot.bot import Bot
|
|
4
4
|
from dandy.shared.settings.load import get_cli_llm_config
|
|
5
5
|
from dandy.domain.prompt.prompt import Prompt
|
|
@@ -29,7 +29,7 @@ class SessionNamingBot(Bot):
|
|
|
29
29
|
)
|
|
30
30
|
|
|
31
31
|
task = (
|
|
32
|
-
|
|
32
|
+
"Create a short title for the user's coding request: 6 to 10 words, "
|
|
33
33
|
'title case, plain words only.'
|
|
34
34
|
)
|
|
35
35
|
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
from dandy.application.agent.cli.intelligence.prompts.narration_prompt import _narration_section
|
|
2
|
+
from dandy.application.agent.cli.intelligence.prompts.path_prompt import _paths_section
|
|
3
|
+
from dandy.application.agent.cli.intelligence.prompts.tool_calling_prompt import (
|
|
4
|
+
_tool_calling_section,
|
|
5
|
+
)
|
|
6
|
+
from dandy.domain.prompt.prompt import Prompt
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def coding_task_prompt() -> Prompt:
|
|
10
|
+
return Prompt(
|
|
11
|
+
'Implement the user coding request by editing the project. '
|
|
12
|
+
'Write understandable quality code, '
|
|
13
|
+
'improve code structure, '
|
|
14
|
+
'consider edge cases, '
|
|
15
|
+
'validate your changes, '
|
|
16
|
+
'and look for existing solutions in the project.'
|
|
17
|
+
'Use the available tools to explore and modify the code, '
|
|
18
|
+
'then give a short summary of what you changed and why.'
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def coding_guidelines_prompt(environment: Prompt | None = None) -> Prompt:
|
|
23
|
+
guidelines = _paths_section()
|
|
24
|
+
|
|
25
|
+
if environment is not None:
|
|
26
|
+
guidelines = guidelines.prompt(environment)
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
guidelines.sub_heading('Editing Code')
|
|
30
|
+
.list(
|
|
31
|
+
[
|
|
32
|
+
'Read a file before editing it so you can match the exact text.',
|
|
33
|
+
(
|
|
34
|
+
'Prefer edit_file for small targeted changes over rewriting the '
|
|
35
|
+
'whole file with write_file.'
|
|
36
|
+
),
|
|
37
|
+
'When choosing the old_string for edit_file, match the whitespace exactly.',
|
|
38
|
+
'After making changes, verify them by reading the affected files again.',
|
|
39
|
+
(
|
|
40
|
+
'Use search_files to locate code instead of guessing or reading '
|
|
41
|
+
'many files blindly.'
|
|
42
|
+
),
|
|
43
|
+
'Use git_status and git_diff to check what has changed before and after editing.',
|
|
44
|
+
(
|
|
45
|
+
'To run tests, linters, or other commands use run_command, '
|
|
46
|
+
'but only when it is actually needed.'
|
|
47
|
+
),
|
|
48
|
+
(
|
|
49
|
+
'Once the request is complete, stop calling tools and respond with '
|
|
50
|
+
'your final answer as plain text, never as a tool call.'
|
|
51
|
+
),
|
|
52
|
+
]
|
|
53
|
+
)
|
|
54
|
+
.prompt(
|
|
55
|
+
_narration_section(
|
|
56
|
+
examples=[
|
|
57
|
+
'"Let me check the current git status."',
|
|
58
|
+
'"Reading the test file to understand it."',
|
|
59
|
+
]
|
|
60
|
+
)
|
|
61
|
+
)
|
|
62
|
+
.prompt(
|
|
63
|
+
_tool_calling_section(
|
|
64
|
+
never_paste_text=(
|
|
65
|
+
'Never paste tool arguments or your answer as a javascript or JSON '
|
|
66
|
+
'code block in your message text.'
|
|
67
|
+
)
|
|
68
|
+
)
|
|
69
|
+
)
|
|
70
|
+
)
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
from dandy.domain.prompt.prompt import Prompt
|
|
2
|
+
from dandy.application.agent.cli.intelligence.prompts.path_prompt import _paths_section
|
|
3
|
+
from dandy.application.agent.cli.intelligence.prompts.tool_calling_prompt import (
|
|
4
|
+
_tool_calling_section,
|
|
5
|
+
)
|
|
6
|
+
from dandy.application.agent.cli.intelligence.prompts.narration_prompt import _narration_section
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def init_guidelines_prompt() -> Prompt:
|
|
10
|
+
return (
|
|
11
|
+
_paths_section()
|
|
12
|
+
.sub_heading('Exploring the Project')
|
|
13
|
+
.list(
|
|
14
|
+
[
|
|
15
|
+
'Start with list_directory on the project root to see the layout.',
|
|
16
|
+
(
|
|
17
|
+
'Read the files that define how the project is built, run, and tested: '
|
|
18
|
+
'the manifest (pyproject.toml, package.json, go.mod, Cargo.toml, ...), '
|
|
19
|
+
'README, task runners (justfile, Makefile), CI config, and the test layout.'
|
|
20
|
+
),
|
|
21
|
+
(
|
|
22
|
+
'Read entry points and a sample of the main modules to understand the '
|
|
23
|
+
'structure, but do not read every file -- be targeted.'
|
|
24
|
+
),
|
|
25
|
+
'Use search_files to find where things live instead of guessing.',
|
|
26
|
+
]
|
|
27
|
+
)
|
|
28
|
+
.sub_heading('Writing AGENTS.md')
|
|
29
|
+
.list(
|
|
30
|
+
[
|
|
31
|
+
(
|
|
32
|
+
'Write the complete final file to AGENTS.md (the project root) with one '
|
|
33
|
+
'write_file call; do not build it up with edit_file.'
|
|
34
|
+
),
|
|
35
|
+
(
|
|
36
|
+
'Cover what an AI coding agent needs to work in this repository: '
|
|
37
|
+
'orientation (what the project is and where things live), essential '
|
|
38
|
+
'commands (build, test, lint, run), structure and conventions, and '
|
|
39
|
+
'non-obvious gotchas.'
|
|
40
|
+
),
|
|
41
|
+
'Only document what you verified in the project; do not invent commands or paths.',
|
|
42
|
+
'Keep it concise and factual -- no placeholders, no TODOs, no filler.',
|
|
43
|
+
'Never include secrets, API keys, or credentials.',
|
|
44
|
+
]
|
|
45
|
+
)
|
|
46
|
+
.prompt(_narration_section(examples=['"Scanning the project layout to see what exists."']))
|
|
47
|
+
.prompt(
|
|
48
|
+
_tool_calling_section(
|
|
49
|
+
never_paste_text=(
|
|
50
|
+
'Never paste file content or tool arguments as a javascript or JSON '
|
|
51
|
+
'code block in your message text.'
|
|
52
|
+
)
|
|
53
|
+
)
|
|
54
|
+
)
|
|
55
|
+
.sub_heading('Response Format')
|
|
56
|
+
.list(['When you are done, give a short plain-text summary of what AGENTS.md covers.'])
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def init_prompt(existing_agents_md: str | None) -> Prompt:
|
|
61
|
+
prompt = Prompt().text(
|
|
62
|
+
'Create the project AGENTS.md file: concise, factual instructions for AI '
|
|
63
|
+
'coding agents working in this repository.'
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
if existing_agents_md is not None:
|
|
67
|
+
prompt = (
|
|
68
|
+
prompt.text(
|
|
69
|
+
'AGENTS.md already exists. Refresh it: keep what is still true, correct '
|
|
70
|
+
'what is stale, drop what no longer applies, and add what is missing. '
|
|
71
|
+
'Verify every kept claim against the project before writing.'
|
|
72
|
+
)
|
|
73
|
+
.text('The current AGENTS.md content is between the delimiter lines below.')
|
|
74
|
+
.text('--- BEGIN CURRENT AGENTS.md ---')
|
|
75
|
+
.text(existing_agents_md)
|
|
76
|
+
.text('--- END CURRENT AGENTS.md ---')
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
return prompt
|