sagent 0.2.0__tar.gz → 0.2.1__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.
- {sagent-0.2.0 → sagent-0.2.1}/CHANGELOG.md +29 -0
- {sagent-0.2.0 → sagent-0.2.1}/PKG-INFO +55 -2
- {sagent-0.2.0 → sagent-0.2.1}/README.md +54 -1
- {sagent-0.2.0 → sagent-0.2.1}/docs/cli.md +0 -2
- {sagent-0.2.0 → sagent-0.2.1}/pyproject.toml +1 -1
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/agent.py +26 -1
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/agent_test.py +80 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/agents_md.py +77 -32
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/agents_md_test.py +46 -4
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/compactor_test.py +0 -3
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/team.py +214 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/team_test.py +685 -6
- sagent-0.2.1/sagent/layering_test.py +74 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/lib/files/grep.py +32 -126
- {sagent-0.2.0 → sagent-0.2.1}/sagent/lib/files/grep_test.py +39 -158
- sagent-0.2.1/sagent/lib/files/owner_only.py +74 -0
- sagent-0.2.1/sagent/lib/files/owner_only_test.py +92 -0
- sagent-0.2.1/sagent/lib/yaml.py +152 -0
- sagent-0.2.1/sagent/lib/yaml_test.py +136 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/model/capability_test.py +0 -12
- {sagent-0.2.0 → sagent-0.2.1}/sagent/model/cost_test.py +0 -6
- {sagent-0.2.0 → sagent-0.2.1}/sagent/model/scripted.py +2 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/anthropic/anthropic.yaml +5 -1
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/anthropic/api.py +1 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/anthropic/api_test.py +6 -23
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/anthropic/cli.py +24 -6
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/anthropic/cli_test.py +44 -25
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/anthropic/login.py +23 -58
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/anthropic/login_test.py +20 -12
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/anthropic/wire_test.py +24 -34
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/catalog.py +78 -139
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/catalog_test.py +64 -84
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/dashscope/api.py +1 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/google/api.py +1 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/google/api_test.py +0 -15
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/google/cli.py +7 -21
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/google/cli_test.py +2 -15
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/google/wire.py +77 -26
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/google/wire_test.py +44 -23
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/llamacpp/server.py +1 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/llamacpp/server_test.py +12 -18
- sagent-0.2.1/sagent/providers/login.py +644 -0
- sagent-0.2.1/sagent/providers/login_test.py +626 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/minimax/api.py +1 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/moonshot/api.py +1 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/openai/api.py +1 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/openai/chat_test.py +0 -6
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/openai/compat_test.py +0 -9
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/openai/login.py +19 -64
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/openai/login_test.py +45 -84
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/openai/responses_test.py +10 -10
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/openai/sub.py +15 -5
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/openai/sub_test.py +44 -24
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/openai/wire_test.py +0 -12
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/resources_test.py +0 -6
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/selfhosted/server.py +3 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/selfhosted/server_test.py +0 -12
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/table.py +12 -39
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/table_test.py +47 -20
- sagent-0.2.1/sagent/providers/testing.py +91 -0
- sagent-0.2.1/sagent/providers/testing_test.py +44 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/tool_server_test.py +0 -9
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/types.py +12 -3
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/types_test.py +8 -19
- {sagent-0.2.0 → sagent-0.2.1}/sagent/runtime/context_test.py +0 -6
- {sagent-0.2.0 → sagent-0.2.1}/sagent/runtime/runtime.py +45 -3
- {sagent-0.2.0 → sagent-0.2.1}/sagent/runtime/runtime_test.py +13 -100
- {sagent-0.2.0 → sagent-0.2.1}/sagent/runtime/tape_test.py +0 -16
- {sagent-0.2.0 → sagent-0.2.1}/sagent/runtime/types.py +45 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/runtime/types_test.py +19 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/session/jsonl.py +2 -5
- {sagent-0.2.0 → sagent-0.2.1}/sagent/session/legacy_journal_test.py +0 -3
- {sagent-0.2.0 → sagent-0.2.1}/sagent/session/projects.py +2 -1
- {sagent-0.2.0 → sagent-0.2.1}/sagent/session/projects_test.py +0 -15
- sagent-0.2.1/sagent/settings/__init__.py +5 -0
- sagent-0.2.1/sagent/settings/flags.py +135 -0
- sagent-0.2.1/sagent/settings/flags_test.py +139 -0
- {sagent-0.2.0/sagent/tui → sagent-0.2.1/sagent}/settings/harvest.py +1 -1
- {sagent-0.2.0/sagent/tui → sagent-0.2.1/sagent}/settings/harvest_test.py +2 -2
- {sagent-0.2.0/sagent/tui → sagent-0.2.1/sagent}/settings/match.py +1 -1
- {sagent-0.2.0/sagent/tui → sagent-0.2.1/sagent}/settings/match_test.py +2 -2
- {sagent-0.2.0/sagent/tui → sagent-0.2.1/sagent}/settings/types_test.py +1 -1
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/agent_spawn.py +47 -24
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/agent_spawn_test.py +71 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/background_task_test.py +0 -6
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/bash.py +17 -3
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/bash_test.py +94 -66
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/command_analyzer.py +5 -5
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/command_analyzer_test.py +22 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/display.py +46 -50
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/display_test.py +24 -83
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/list_test.py +6 -4
- sagent-0.2.1/sagent/tools/mcp.py +1089 -0
- sagent-0.2.1/sagent/tools/mcp_auth.py +475 -0
- sagent-0.2.1/sagent/tools/mcp_auth_test.py +606 -0
- sagent-0.2.1/sagent/tools/mcp_settings.py +356 -0
- sagent-0.2.1/sagent/tools/mcp_settings_test.py +257 -0
- sagent-0.2.1/sagent/tools/mcp_test.py +993 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/memory.py +31 -6
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/memory_test.py +48 -2
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/skill.py +31 -5
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/skill_test.py +44 -4
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/types.py +15 -1
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/web_fetch_test.py +0 -9
- sagent-0.2.1/sagent/tui/assets/holidays.yaml +929 -0
- sagent-0.2.1/sagent/tui/console.py +566 -0
- sagent-0.2.1/sagent/tui/console_test.py +1044 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/diff.py +48 -33
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/diff_test.py +71 -58
- sagent-0.2.1/sagent/tui/holiday.py +642 -0
- sagent-0.2.1/sagent/tui/holiday_test.py +461 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/main.py +263 -93
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/main_test.py +737 -68
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/markdown.py +123 -7
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/markdown_test.py +72 -5
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/prompt.py +9 -1
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/prompt_test.py +14 -21
- sagent-0.2.1/sagent/tui/recording.py +165 -0
- sagent-0.2.1/sagent/tui/recording_test.py +62 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/render.py +138 -78
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/render_test.py +273 -111
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/replay_test.py +9 -69
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/settings/model.py +7 -4
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/settings/model_test.py +20 -11
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/settings/runtime.py +1 -1
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/settings/runtime_test.py +1 -1
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/settings/screen.py +6 -5
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/settings/screen_test.py +9 -8
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/settings/tool.py +1 -1
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/settings/tool_test.py +2 -2
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/slash.py +174 -62
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/slash_test.py +160 -118
- sagent-0.2.1/sagent/tui/types.py +598 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/types_test.py +36 -13
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/views_test.py +5 -5
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/welcome.py +58 -37
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/welcome_test.py +71 -20
- {sagent-0.2.0 → sagent-0.2.1}/uv.lock +4 -4
- sagent-0.2.0/sagent/providers/listing.py +0 -121
- sagent-0.2.0/sagent/providers/listing_test.py +0 -56
- sagent-0.2.0/sagent/providers/lock.py +0 -64
- sagent-0.2.0/sagent/providers/lock_test.py +0 -84
- sagent-0.2.0/sagent/tui/console.py +0 -385
- sagent-0.2.0/sagent/tui/console_test.py +0 -561
- sagent-0.2.0/sagent/tui/settings/flags.py +0 -70
- sagent-0.2.0/sagent/tui/settings/flags_test.py +0 -63
- sagent-0.2.0/sagent/tui/types.py +0 -411
- {sagent-0.2.0 → sagent-0.2.1}/.gitignore +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/.pre-commit-config.yaml +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/.python-version +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/AI_POLICY.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/CODE_OF_CONDUCT.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/CONTRIBUTING.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/LICENSE +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/RELEASING.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/SECURITY.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/assets/logo-custom.webp +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/conftest.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/docs/api.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/docs/architecture.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/docs/compaction.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/docs/concepts.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/docs/providers.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/docs/security.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/docs/selfhosted.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/docs/sessions.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/docs/showcase.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/docs/streaming.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/docs/tools.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/docs/tutorial.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/__main__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/assets/compactor.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/assets/compactor_continuation.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/assets/compactor_no_tools.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/assets/compactor_no_tools_reminder.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/assets/compactor_partial.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/assets/compactor_session_audit.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/assets/compactor_system.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/assets/system_prompt.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/cache_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/compactor.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/environment.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/environment_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/fold.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/fold_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/pruner.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/pruner_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/scrunch.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/scrunch_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/types.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/agent/types_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/lib/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/lib/files/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/lib/files/glob.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/lib/files/glob_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/lib/files/walk.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/lib/files/walk_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/lib/posix/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/lib/posix/child.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/lib/posix/child_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/lib/posix/pids.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/lib/posix/pids_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/lib/testing/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/lib/testing/resources.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/lib/testing/resources_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/lib/testing/runner.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/lib/testing/runner_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/lib/testing/wheel.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/lib/userdirs.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/lib/userdirs_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/model/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/model/capability.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/model/context.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/model/context_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/model/cost.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/model/exceptions.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/model/exceptions_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/model/image.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/model/image_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/model/scripted_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/model/types.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/model/types_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/anthropic/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/anthropic/wire.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/dashscope/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/dashscope/api_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/dashscope/dashscope.yaml +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/google/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/google/google.yaml +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/llamacpp/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/llamacpp/llamacpp.yaml +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/minimax/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/minimax/api_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/minimax/minimax.yaml +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/moonshot/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/moonshot/api_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/moonshot/moonshot.yaml +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/openai/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/openai/api_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/openai/chat.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/openai/compat.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/openai/lease.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/openai/lease_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/openai/openai.yaml +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/openai/responses.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/openai/token_count.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/openai/token_count_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/openai/wire.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/resources.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/selfhosted/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/selfhosted/calls.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/selfhosted/calls_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/selfhosted/vision.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/selfhosted/vision_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/providers/tool_server.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/runtime/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/runtime/context.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/runtime/exceptions.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/runtime/exceptions_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/runtime/tape.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/scripts/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/scripts/check_wheel.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/scripts/check_wheel_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/scripts/convert_sessions.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/scripts/convert_sessions_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/scripts/swebench.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/scripts/swebench_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/session/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/session/jsonl_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/session/legacy_journal.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/session/recording.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/session/recording_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/session/types.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/session/types_test.py +0 -0
- {sagent-0.2.0/sagent/tui → sagent-0.2.1/sagent}/settings/types.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/skills/watch/SKILL.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/agent_self.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/agent_self_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/agent_send.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/agent_send_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/assets/agentself.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/assets/agentsend.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/assets/agentspawn.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/assets/backgroundtask.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/assets/bash.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/assets/bash.yaml +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/assets/edit.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/assets/glob.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/assets/grep.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/assets/list.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/assets/memory.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/assets/paperauthor.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/assets/paperdetails.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/assets/paperfetch.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/assets/papersearch.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/assets/playaudio.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/assets/read.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/assets/session.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/assets/skill.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/assets/webfetch.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/assets/websearch.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/assets/write.md +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/background_task.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/edit.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/edit_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/function.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/function_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/glob_tool.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/glob_tool_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/grep.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/grep_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/list.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/paper_author.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/paper_author_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/paper_common.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/paper_common_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/paper_details.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/paper_details_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/paper_fetch.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/paper_fetch_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/paper_search.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/paper_search_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/play_audio.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/play_audio_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/read.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/read_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/session.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/session_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/types_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/watch.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/watch_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/web_fetch.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/web_search.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/web_search_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/write.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tools/write_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/replay.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/settings/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/status.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/status_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/tree.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/tree_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/tui/views.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/types.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/sagent/types_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tests/wheel_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/gate/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/gate/__main__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/gate/fakes.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/gate/fakes_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/gate/gate.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/gate/gate_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/gate/spool.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/gate/spool_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/gate/worker_count.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/gate/worker_count_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/testing/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/testing/__main__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/testing/coverage_summary.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/testing/coverage_summary_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/testing/testing.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/testing/testing_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/testing/tiers.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/testing/tiers_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/typecheck/__init__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/typecheck/__main__.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/typecheck/scope.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/typecheck/scope_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/typecheck/typecheck.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/tools/typecheck/typecheck_test.py +0 -0
- {sagent-0.2.0 → sagent-0.2.1}/typings/.gitkeep +0 -0
|
@@ -3,6 +3,35 @@
|
|
|
3
3
|
All notable sagent changes are documented here. This project follows
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
5
5
|
|
|
6
|
+
## 0.2.1 - 2026-10-30
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- The welcome logo becomes a holiday icon around 26 holidays, from the last
|
|
11
|
+
workday before each through its last day; overlapping holidays are picked
|
|
12
|
+
at random. Dates follow US observance: computed for seasons, Lunar New
|
|
13
|
+
Year, Mid-Autumn, Holi, Diwali, Vaisakhi, Easter, Thanksgiving and the
|
|
14
|
+
Hebrew holidays; announced for the Eids and Vesak. Terminals without 256
|
|
15
|
+
colors, or with `NO_COLOR`, keep the logo.
|
|
16
|
+
- `sagent.lib.yaml.parse`, a YAML loader that refuses a key given twice, a
|
|
17
|
+
key that is no string, and an alias unless allowed, naming the line.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- The model catalogs and the Bash read-only policy load through the strict
|
|
22
|
+
YAML loader. The Bash policy, once read by the pure-Python parser, loads
|
|
23
|
+
about nine times faster; the catalogs, already on the C parser, load about
|
|
24
|
+
as fast as before.
|
|
25
|
+
- An AGENTS.md rule or a skill whose frontmatter will not parse is skipped,
|
|
26
|
+
and the session shows which file and line, rather than loading it with its
|
|
27
|
+
`paths:`, name, or description dropped.
|
|
28
|
+
- Memory reads the owner of a memory file whose frontmatter will not parse
|
|
29
|
+
from its `name:` line, so another name cannot overwrite it.
|
|
30
|
+
- Terminal output, tool rows, diffs and tool failures render aligned to the
|
|
31
|
+
active window.
|
|
32
|
+
- Provider accounts and catalogs are discovered together, and a spent login
|
|
33
|
+
falls back to the next one with quota, saying which window was spent.
|
|
34
|
+
|
|
6
35
|
## 0.2.0 - 2026-10-29
|
|
7
36
|
|
|
8
37
|
### Changed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: sagent
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Python-first Coding Agent API and CLI.
|
|
5
5
|
Project-URL: Homepage, https://www.rekursiv.ai
|
|
6
6
|
Project-URL: Repository, https://github.com/rekursiv-ai/sagent
|
|
@@ -276,6 +276,59 @@ endpoint. Point `LLAMA_CPP_SERVER` at a built `llama-server` binary and
|
|
|
276
276
|
|
|
277
277
|
See [Self-hosted Models](https://github.com/rekursiv-ai/sagent/blob/main/docs/selfhosted.md) for options, local snapshot paths, and runtime requirements.
|
|
278
278
|
|
|
279
|
+
## MCP
|
|
280
|
+
|
|
281
|
+
Sagent calls the tools of MCP servers. Manage them with `sagent mcp`, which
|
|
282
|
+
takes the arguments `claude mcp` does; each command has `--help`, and each is
|
|
283
|
+
also `/mcp.COMMAND` at the prompt:
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
sagent mcp add git -- uvx mcp-server-git # a local command
|
|
287
|
+
sagent mcp add -t http linear https://mcp.linear.app/mcp # a remote URL
|
|
288
|
+
sagent mcp add -t http github https://api.githubcopilot.com/mcp/ \
|
|
289
|
+
-H 'Authorization: Bearer ${GITHUB_TOKEN}' # read at connect
|
|
290
|
+
sagent mcp login linear # OAuth sign-in to a remote server; --headless over ssh
|
|
291
|
+
sagent mcp list # each server, and whether it connects
|
|
292
|
+
sagent mcp get linear # one server
|
|
293
|
+
sagent mcp logout linear # forget its sign-in
|
|
294
|
+
sagent mcp remove linear # and the server
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
`add` writes this project's servers; `-s user` writes every project's. A
|
|
298
|
+
session reads the servers it starts with; one already open keeps its own.
|
|
299
|
+
|
|
300
|
+
Each tool becomes `mcp__<server>__<tool>`. An `on_demand` server is one tool,
|
|
301
|
+
`mcp__<server>`, that lists, describes, and runs its tools, so a large server
|
|
302
|
+
costs no tokens until used. Its options beyond `add`'s flags go in with
|
|
303
|
+
`add-json`, as the entry another tool's `mcpServers` JSON holds:
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
sagent mcp add-json linear '{"url": "https://mcp.linear.app/mcp", "loading": "on_demand"}'
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
A remote server that signs users in with OAuth, as Linear and Notion do, needs
|
|
310
|
+
one sign-in before it connects. One that takes a token instead, as GitHub's
|
|
311
|
+
does, reads it from its header. Config copied from Claude Code, Cursor, or Pi
|
|
312
|
+
works as it is: pass the file with `--mcp-config PATH`.
|
|
313
|
+
|
|
314
|
+
In code, open the servers and pass their tools:
|
|
315
|
+
|
|
316
|
+
```python
|
|
317
|
+
from pathlib import Path
|
|
318
|
+
|
|
319
|
+
from sagent import tools
|
|
320
|
+
from sagent.agent import Agent
|
|
321
|
+
from sagent.providers import Google
|
|
322
|
+
from sagent.tools.mcp import McpSession, servers
|
|
323
|
+
|
|
324
|
+
model = Google.from_env().model("gemini-pro-3.1")
|
|
325
|
+
async with McpSession(servers(Path.cwd())) as mcp:
|
|
326
|
+
async with Agent(model=model, tools=[tools.Read(), *mcp.tools()]) as agent:
|
|
327
|
+
...
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
See the `sagent.tools.mcp` docstring for every field.
|
|
331
|
+
|
|
279
332
|
## Security and privacy
|
|
280
333
|
|
|
281
334
|
Sagent is an agent runtime, not a sandbox. Enabled tools run with the current
|
|
@@ -294,7 +347,7 @@ OS/container sandbox when a task needs hard isolation. See
|
|
|
294
347
|
<details>
|
|
295
348
|
<summary>How Sagent compares to aider, LangChain, Claude Code, Codex CLI, Gemini CLI, and other adjacent projects</summary>
|
|
296
349
|
|
|
297
|
-
Not yet in Sagent:
|
|
350
|
+
Not yet in Sagent: LSP, native sandboxing, desktop UI, tree-sitter repo map, hosted service, browser automation.
|
|
298
351
|
|
|
299
352
|
This comparison focuses on the runtime shape rather than every feature
|
|
300
353
|
of each project.
|
|
@@ -219,6 +219,59 @@ endpoint. Point `LLAMA_CPP_SERVER` at a built `llama-server` binary and
|
|
|
219
219
|
|
|
220
220
|
See [Self-hosted Models](https://github.com/rekursiv-ai/sagent/blob/main/docs/selfhosted.md) for options, local snapshot paths, and runtime requirements.
|
|
221
221
|
|
|
222
|
+
## MCP
|
|
223
|
+
|
|
224
|
+
Sagent calls the tools of MCP servers. Manage them with `sagent mcp`, which
|
|
225
|
+
takes the arguments `claude mcp` does; each command has `--help`, and each is
|
|
226
|
+
also `/mcp.COMMAND` at the prompt:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
sagent mcp add git -- uvx mcp-server-git # a local command
|
|
230
|
+
sagent mcp add -t http linear https://mcp.linear.app/mcp # a remote URL
|
|
231
|
+
sagent mcp add -t http github https://api.githubcopilot.com/mcp/ \
|
|
232
|
+
-H 'Authorization: Bearer ${GITHUB_TOKEN}' # read at connect
|
|
233
|
+
sagent mcp login linear # OAuth sign-in to a remote server; --headless over ssh
|
|
234
|
+
sagent mcp list # each server, and whether it connects
|
|
235
|
+
sagent mcp get linear # one server
|
|
236
|
+
sagent mcp logout linear # forget its sign-in
|
|
237
|
+
sagent mcp remove linear # and the server
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
`add` writes this project's servers; `-s user` writes every project's. A
|
|
241
|
+
session reads the servers it starts with; one already open keeps its own.
|
|
242
|
+
|
|
243
|
+
Each tool becomes `mcp__<server>__<tool>`. An `on_demand` server is one tool,
|
|
244
|
+
`mcp__<server>`, that lists, describes, and runs its tools, so a large server
|
|
245
|
+
costs no tokens until used. Its options beyond `add`'s flags go in with
|
|
246
|
+
`add-json`, as the entry another tool's `mcpServers` JSON holds:
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
sagent mcp add-json linear '{"url": "https://mcp.linear.app/mcp", "loading": "on_demand"}'
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
A remote server that signs users in with OAuth, as Linear and Notion do, needs
|
|
253
|
+
one sign-in before it connects. One that takes a token instead, as GitHub's
|
|
254
|
+
does, reads it from its header. Config copied from Claude Code, Cursor, or Pi
|
|
255
|
+
works as it is: pass the file with `--mcp-config PATH`.
|
|
256
|
+
|
|
257
|
+
In code, open the servers and pass their tools:
|
|
258
|
+
|
|
259
|
+
```python
|
|
260
|
+
from pathlib import Path
|
|
261
|
+
|
|
262
|
+
from sagent import tools
|
|
263
|
+
from sagent.agent import Agent
|
|
264
|
+
from sagent.providers import Google
|
|
265
|
+
from sagent.tools.mcp import McpSession, servers
|
|
266
|
+
|
|
267
|
+
model = Google.from_env().model("gemini-pro-3.1")
|
|
268
|
+
async with McpSession(servers(Path.cwd())) as mcp:
|
|
269
|
+
async with Agent(model=model, tools=[tools.Read(), *mcp.tools()]) as agent:
|
|
270
|
+
...
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
See the `sagent.tools.mcp` docstring for every field.
|
|
274
|
+
|
|
222
275
|
## Security and privacy
|
|
223
276
|
|
|
224
277
|
Sagent is an agent runtime, not a sandbox. Enabled tools run with the current
|
|
@@ -237,7 +290,7 @@ OS/container sandbox when a task needs hard isolation. See
|
|
|
237
290
|
<details>
|
|
238
291
|
<summary>How Sagent compares to aider, LangChain, Claude Code, Codex CLI, Gemini CLI, and other adjacent projects</summary>
|
|
239
292
|
|
|
240
|
-
Not yet in Sagent:
|
|
293
|
+
Not yet in Sagent: LSP, native sandboxing, desktop UI, tree-sitter repo map, hosted service, browser automation.
|
|
241
294
|
|
|
242
295
|
This comparison focuses on the runtime shape rather than every feature
|
|
243
296
|
of each project.
|
|
@@ -27,8 +27,6 @@ request and does not verify credentials with the remote service.
|
|
|
27
27
|
The terminal background and body text follow your terminal settings.
|
|
28
28
|
`NO_COLOR=1` disables color. The welcome prints at once, with no animation.
|
|
29
29
|
Narrow, short, dumb, or non-Unicode terminals use a compact SAGENT heading.
|
|
30
|
-
Resumed sessions also use the compact heading to leave room for the saved
|
|
31
|
-
transcript.
|
|
32
30
|
|
|
33
31
|
Welcome layout follows a terminal-cell grid:
|
|
34
32
|
|
|
@@ -52,13 +52,14 @@ from sagent.session.types import (
|
|
|
52
52
|
UncategorizedToolResult,
|
|
53
53
|
UserMessage,
|
|
54
54
|
)
|
|
55
|
-
from sagent.tools.types import Briefing, Reminding, ToolContext
|
|
55
|
+
from sagent.tools.types import Briefing, Reminding, Skipping, ToolContext
|
|
56
56
|
from sagent.types import AsyncResource
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
if TYPE_CHECKING:
|
|
60
60
|
from collections.abc import (
|
|
61
61
|
AsyncIterator,
|
|
62
|
+
Callable,
|
|
62
63
|
Collection,
|
|
63
64
|
Iterable,
|
|
64
65
|
Iterator,
|
|
@@ -172,6 +173,8 @@ class Agent(AsyncResource):
|
|
|
172
173
|
host's details are not for.
|
|
173
174
|
account: The named login ``model``'s provider signs in as; ``None`` for
|
|
174
175
|
its default. Whoever switches the model keeps it current.
|
|
176
|
+
columns: The width a command's output is shown in, as ``COLUMNS``; a
|
|
177
|
+
frontend whose window resizes passes a callable, read per command.
|
|
175
178
|
|
|
176
179
|
Raises:
|
|
177
180
|
ValueError: ``allowed`` names a tool not in ``tools``.
|
|
@@ -197,6 +200,7 @@ class Agent(AsyncResource):
|
|
|
197
200
|
max_result_chars: int | None = None,
|
|
198
201
|
environment: bool = True,
|
|
199
202
|
account: str | None = None,
|
|
203
|
+
columns: int | Callable[[], int] = 80,
|
|
200
204
|
) -> None:
|
|
201
205
|
self.agents_md: AgentsMdConfig = (
|
|
202
206
|
agents_md if agents_md is not None else AgentsMdConfig()
|
|
@@ -210,6 +214,7 @@ class Agent(AsyncResource):
|
|
|
210
214
|
cwd=start,
|
|
211
215
|
root=root if root is not None else start,
|
|
212
216
|
spill_dir=kept.parent if kept is not None else None,
|
|
217
|
+
columns=columns,
|
|
213
218
|
),
|
|
214
219
|
)
|
|
215
220
|
# Named by its journal, which a resume reopens, so vendors see one
|
|
@@ -648,6 +653,7 @@ class RuntimeSession:
|
|
|
648
653
|
self._memory: ModelMemory | None = None
|
|
649
654
|
self._prompt: str | None = None
|
|
650
655
|
self._directives = Directives(root=agent.root, config=agent.agents_md)
|
|
656
|
+
self._told: set[str] = set()
|
|
651
657
|
|
|
652
658
|
# A window's prompt is read once, at its start, and never again until the next:
|
|
653
659
|
# any byte it changed mid-window would rewrite the whole cached conversation. What
|
|
@@ -931,8 +937,27 @@ class RuntimeSession:
|
|
|
931
937
|
),
|
|
932
938
|
)
|
|
933
939
|
out.extend(self._reminders(context))
|
|
940
|
+
self._tell_skipped()
|
|
934
941
|
return out
|
|
935
942
|
|
|
943
|
+
# The prompt is up by now, and logs go to the session's file; the user is told
|
|
944
|
+
# here, once a session, of each file the model was not given.
|
|
945
|
+
def _tell_skipped(self) -> None:
|
|
946
|
+
"""Publish each AGENTS.md file and skill left unread, once."""
|
|
947
|
+
tool_context = self._agent.runtime.tool_context
|
|
948
|
+
for text in (
|
|
949
|
+
*self._directives.skipped,
|
|
950
|
+
*(
|
|
951
|
+
line
|
|
952
|
+
for tool in self._agent.tools.values()
|
|
953
|
+
if isinstance(tool, Skipping)
|
|
954
|
+
for line in tool.skipped(tool_context)
|
|
955
|
+
),
|
|
956
|
+
):
|
|
957
|
+
if text not in self._told:
|
|
958
|
+
self._told.add(text)
|
|
959
|
+
self._agent.runtime.publish(types.Skipped(text=text))
|
|
960
|
+
|
|
936
961
|
# One that empties is withdrawn, so the model stops relying on what it said.
|
|
937
962
|
def _reminders(
|
|
938
963
|
self,
|
|
@@ -24,6 +24,7 @@ from sagent.agent.agent import (
|
|
|
24
24
|
NoShrinker,
|
|
25
25
|
RuntimeSession,
|
|
26
26
|
default_system_prompt,
|
|
27
|
+
spent,
|
|
27
28
|
)
|
|
28
29
|
from sagent.agent.agents_md import AgentsMdConfig, directives
|
|
29
30
|
from sagent.agent.compactor import SummaryCompactor
|
|
@@ -63,6 +64,7 @@ from sagent.session.types import (
|
|
|
63
64
|
record_classes,
|
|
64
65
|
)
|
|
65
66
|
from sagent.tools.display import ToolDisplay
|
|
67
|
+
from sagent.tools.skill import Skill
|
|
66
68
|
|
|
67
69
|
|
|
68
70
|
if TYPE_CHECKING:
|
|
@@ -1304,6 +1306,53 @@ def test_allowing_a_tool_the_agent_lacks_is_refused() -> None:
|
|
|
1304
1306
|
assert agent.allowed is None
|
|
1305
1307
|
|
|
1306
1308
|
|
|
1309
|
+
def test_each_file_skipped_is_told_to_the_user_once(tmp_path: Path) -> None:
|
|
1310
|
+
_ = (tmp_path / "AGENTS.md").write_text("---\na: 1\na: 2\n---\nroot\n")
|
|
1311
|
+
sub = tmp_path / "sub"
|
|
1312
|
+
sub.mkdir()
|
|
1313
|
+
_ = (sub / "AGENTS.md").write_text("---\nb: 1\nb: 2\n---\nsub\n")
|
|
1314
|
+
skill = tmp_path / ".sagent" / "skills" / "twice" / "SKILL.md"
|
|
1315
|
+
skill.parent.mkdir(parents=True)
|
|
1316
|
+
_ = skill.write_text("---\nname: twice\nname: other\n---\nbody\n")
|
|
1317
|
+
agent = Agent(
|
|
1318
|
+
model=ScriptedProvider()["scripted"],
|
|
1319
|
+
tools=[Skill(user_dir=tmp_path / "u", builtin_dir=tmp_path / "b")],
|
|
1320
|
+
cwd=tmp_path,
|
|
1321
|
+
agents_md=_config(tmp_path),
|
|
1322
|
+
)
|
|
1323
|
+
told: list[str] = []
|
|
1324
|
+
agent.runtime.observers.append(
|
|
1325
|
+
lambda e: told.append(e.text) if isinstance(e, types.Skipped) else None,
|
|
1326
|
+
)
|
|
1327
|
+
session = _session(agent)
|
|
1328
|
+
session.append(*session.updates())
|
|
1329
|
+
session.append(*session.updates())
|
|
1330
|
+
at_start = list(told)
|
|
1331
|
+
agent.runtime.tool_context.cwd = sub
|
|
1332
|
+
session.append(*session.updates())
|
|
1333
|
+
|
|
1334
|
+
assert sorted(at_start) == sorted(
|
|
1335
|
+
[
|
|
1336
|
+
(
|
|
1337
|
+
f"Skipping {(tmp_path / 'AGENTS.md').resolve()}: its frontmatter will"
|
|
1338
|
+
f" not parse: {(tmp_path / 'AGENTS.md').resolve()}, line 3: the key"
|
|
1339
|
+
" 'a' is given twice."
|
|
1340
|
+
),
|
|
1341
|
+
(
|
|
1342
|
+
f"Skipping skill {skill}: its frontmatter will not parse: {skill},"
|
|
1343
|
+
" line 3: the key 'name' is given twice."
|
|
1344
|
+
),
|
|
1345
|
+
],
|
|
1346
|
+
)
|
|
1347
|
+
assert told[2:] == [
|
|
1348
|
+
(
|
|
1349
|
+
f"Skipping {(sub / 'AGENTS.md').resolve()}: its frontmatter will not"
|
|
1350
|
+
f" parse: {(sub / 'AGENTS.md').resolve()}, line 3: the key 'b' is given"
|
|
1351
|
+
" twice."
|
|
1352
|
+
),
|
|
1353
|
+
]
|
|
1354
|
+
|
|
1355
|
+
|
|
1307
1356
|
def test_a_rule_is_given_once_when_a_file_it_governs_is_seen(tmp_path: Path) -> None:
|
|
1308
1357
|
rules = tmp_path / ".sagent" / "rules"
|
|
1309
1358
|
rules.mkdir(parents=True)
|
|
@@ -1685,6 +1734,37 @@ async def test_messages_from_other_agents_start_the_round_count_over(
|
|
|
1685
1734
|
assert seen.count(types.Halt) == 0
|
|
1686
1735
|
|
|
1687
1736
|
|
|
1737
|
+
@pytest.mark.parametrize(
|
|
1738
|
+
("records", "usd"),
|
|
1739
|
+
[
|
|
1740
|
+
((), 0.0),
|
|
1741
|
+
((TokenUsage(),), 0.0),
|
|
1742
|
+
((TokenUsage(info={"spend_usd": 0.5}), TokenUsage()), 0.5),
|
|
1743
|
+
((TokenUsage(info={"spend_usd": 0.5}), ContextClear()), 0.0),
|
|
1744
|
+
(
|
|
1745
|
+
(
|
|
1746
|
+
ContextClear(extra={"spend_usd": 2.0}),
|
|
1747
|
+
TokenUsage(info={"spend_usd": 0.5}),
|
|
1748
|
+
),
|
|
1749
|
+
2.5,
|
|
1750
|
+
),
|
|
1751
|
+
],
|
|
1752
|
+
ids=[
|
|
1753
|
+
"nothing",
|
|
1754
|
+
"unpriced",
|
|
1755
|
+
"priced-then-unpriced",
|
|
1756
|
+
"unstated-clear",
|
|
1757
|
+
"clear-then-turn",
|
|
1758
|
+
],
|
|
1759
|
+
)
|
|
1760
|
+
def test_what_a_journal_says_was_spent(
|
|
1761
|
+
records: tuple[SessionRecord, ...],
|
|
1762
|
+
usd: float,
|
|
1763
|
+
) -> None:
|
|
1764
|
+
got = spent(records)
|
|
1765
|
+
assert got == usd
|
|
1766
|
+
|
|
1767
|
+
|
|
1688
1768
|
@pytest.mark.asyncio
|
|
1689
1769
|
@pytest.mark.parametrize("carried", [False, True], ids=["usage", "new-window"])
|
|
1690
1770
|
async def test_a_resumed_session_keeps_what_it_spent(
|
|
@@ -27,6 +27,7 @@ Typical usage example:
|
|
|
27
27
|
from __future__ import annotations
|
|
28
28
|
|
|
29
29
|
from dataclasses import dataclass, field, replace
|
|
30
|
+
from functools import partial
|
|
30
31
|
from pathlib import Path
|
|
31
32
|
from typing import TYPE_CHECKING, Literal
|
|
32
33
|
|
|
@@ -42,6 +43,7 @@ from treekle import ReadError, from_plain
|
|
|
42
43
|
import yaml
|
|
43
44
|
|
|
44
45
|
from sagent.lib.userdirs import data_dir
|
|
46
|
+
from sagent.lib.yaml import split_frontmatter
|
|
45
47
|
from sagent.model.capability import literal_members
|
|
46
48
|
|
|
47
49
|
|
|
@@ -127,7 +129,8 @@ def directives(cwd: Path, *, config: AgentsMdConfig | None = None) -> str:
|
|
|
127
129
|
|
|
128
130
|
"""
|
|
129
131
|
cfg = config if config is not None else AgentsMdConfig()
|
|
130
|
-
|
|
132
|
+
found = _discover(cwd, cfg, set(), skipped=[])
|
|
133
|
+
return _format([f for f in found if not f.globs], cfg.preamble)
|
|
131
134
|
|
|
132
135
|
|
|
133
136
|
@dataclass(slots=True, kw_only=True)
|
|
@@ -158,6 +161,9 @@ class Directives:
|
|
|
158
161
|
_framed: set[str] = field(default_factory=set[str], init=False)
|
|
159
162
|
_read: set[str] = field(default_factory=set[str], init=False)
|
|
160
163
|
|
|
164
|
+
skipped: list[str] = field(default_factory=list[str], init=False)
|
|
165
|
+
"""Why each file left unread was, in the order they were reached."""
|
|
166
|
+
|
|
161
167
|
def start(self) -> str:
|
|
162
168
|
"""Forget the last window; return the root's unconditional files, as one section.
|
|
163
169
|
|
|
@@ -167,7 +173,7 @@ class Directives:
|
|
|
167
173
|
"""
|
|
168
174
|
root = self.root.resolve()
|
|
169
175
|
self._read = set()
|
|
170
|
-
found = _discover(root, self.config, self._read)
|
|
176
|
+
found = _discover(root, self.config, self._read, skipped=self.skipped)
|
|
171
177
|
self._known = [(f, root) for f in found]
|
|
172
178
|
self._checked = {
|
|
173
179
|
root,
|
|
@@ -232,7 +238,7 @@ class Directives:
|
|
|
232
238
|
self._checked.add(d)
|
|
233
239
|
self._known.extend(
|
|
234
240
|
(f, d)
|
|
235
|
-
for f in _read_project(d, self._read, self.config)
|
|
241
|
+
for f in _read_project(d, self._read, self.config, skipped=self.skipped)
|
|
236
242
|
if f.tier in self.config.tiers
|
|
237
243
|
)
|
|
238
244
|
d = d.parent
|
|
@@ -265,27 +271,30 @@ class _File:
|
|
|
265
271
|
)
|
|
266
272
|
|
|
267
273
|
|
|
268
|
-
def frontmatter(raw: str) -> tuple[dict[str, object], str]:
|
|
274
|
+
def frontmatter(raw: str, *, source: str = "") -> tuple[dict[str, object], str]:
|
|
269
275
|
"""Return a Markdown file's YAML frontmatter, and its body without it.
|
|
270
276
|
|
|
271
277
|
Args:
|
|
272
278
|
raw: The file's text; a leading byte-order mark is dropped.
|
|
279
|
+
source: Where ``raw`` came from, named in errors.
|
|
273
280
|
|
|
274
281
|
Returns:
|
|
275
282
|
meta: The frontmatter's mapping; empty when there is none, or it is no
|
|
276
283
|
YAML mapping, such as a list.
|
|
277
284
|
body: The text after the frontmatter.
|
|
278
285
|
|
|
286
|
+
Raises:
|
|
287
|
+
YAMLError: The frontmatter will not parse; the message names the
|
|
288
|
+
file's line, and ``source``.
|
|
289
|
+
|
|
279
290
|
"""
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
body = raw[match.end() :]
|
|
291
|
+
split = split_frontmatter(raw, source=source)
|
|
292
|
+
if split is None:
|
|
293
|
+
return {}, raw.removeprefix("\ufeff")
|
|
294
|
+
parsed, body = split
|
|
285
295
|
try:
|
|
286
|
-
parsed: object = yaml.safe_load(match.group(1))
|
|
287
296
|
return from_plain(parsed, dict[str, object], default={}), body
|
|
288
|
-
except
|
|
297
|
+
except ReadError:
|
|
289
298
|
return {}, body
|
|
290
299
|
|
|
291
300
|
|
|
@@ -392,22 +401,28 @@ def _resolve(ref: str, base: Path) -> Path | None:
|
|
|
392
401
|
return (base / ref).resolve()
|
|
393
402
|
|
|
394
403
|
|
|
395
|
-
def _discover(
|
|
404
|
+
def _discover(
|
|
405
|
+
cwd: Path,
|
|
406
|
+
cfg: AgentsMdConfig,
|
|
407
|
+
seen: set[str],
|
|
408
|
+
*,
|
|
409
|
+
skipped: list[str],
|
|
410
|
+
) -> list[_File]:
|
|
396
411
|
"""Return every directive file not in ``seen``, lowest precedence first; add each."""
|
|
397
412
|
out: list[_File] = []
|
|
413
|
+
read = partial(_read, seen=seen, depth=0, cfg=cfg, skipped=skipped)
|
|
398
414
|
if "Managed" in cfg.tiers:
|
|
399
|
-
out.extend(
|
|
400
|
-
|
|
401
|
-
)
|
|
402
|
-
out.extend(_read_dir(cfg.system_dir / "rules", "Managed", seen, cfg))
|
|
415
|
+
out.extend(read(cfg.system_dir / cfg.filename, "Managed"))
|
|
416
|
+
out.extend(_read_dir(cfg.system_dir / "rules", "Managed", seen, cfg, skipped))
|
|
403
417
|
if "User" in cfg.tiers:
|
|
404
|
-
out.extend(
|
|
405
|
-
out.extend(_read_dir(cfg.user_dir / "rules", "User", seen, cfg))
|
|
418
|
+
out.extend(read(cfg.user_dir / cfg.filename, "User"))
|
|
419
|
+
out.extend(_read_dir(cfg.user_dir / "rules", "User", seen, cfg, skipped))
|
|
406
420
|
if not {"Project", "Local"} & cfg.tiers:
|
|
407
421
|
return out
|
|
408
422
|
resolved = cwd.resolve()
|
|
409
423
|
for d in [*reversed(resolved.parents), resolved, *cfg.additional_dirs]:
|
|
410
|
-
|
|
424
|
+
found = _read_project(d, seen, cfg, skipped=skipped)
|
|
425
|
+
out.extend(f for f in found if f.tier in cfg.tiers)
|
|
411
426
|
return out
|
|
412
427
|
|
|
413
428
|
|
|
@@ -422,20 +437,33 @@ def _format(files: list[_File], preamble: str) -> str:
|
|
|
422
437
|
return "\n\n".join(parts)
|
|
423
438
|
|
|
424
439
|
|
|
425
|
-
def _read_project(
|
|
440
|
+
def _read_project(
|
|
441
|
+
d: Path,
|
|
442
|
+
seen: set[str],
|
|
443
|
+
cfg: AgentsMdConfig,
|
|
444
|
+
*,
|
|
445
|
+
skipped: list[str],
|
|
446
|
+
) -> list[_File]:
|
|
426
447
|
"""Return one directory's project and local files, in their order, each governing ``d``."""
|
|
427
448
|
name = Path(cfg.filename)
|
|
449
|
+
read = partial(_read, seen=seen, depth=0, cfg=cfg, skipped=skipped)
|
|
428
450
|
found = [
|
|
429
|
-
*
|
|
430
|
-
*
|
|
431
|
-
*_read_dir(d / cfg.dot_dir / "rules", "Project", seen, cfg),
|
|
432
|
-
*
|
|
451
|
+
*read(d / cfg.filename, "Project"),
|
|
452
|
+
*read(d / cfg.dot_dir / cfg.filename, "Project"),
|
|
453
|
+
*_read_dir(d / cfg.dot_dir / "rules", "Project", seen, cfg, skipped),
|
|
454
|
+
*read(d / f"{name.stem}.local{name.suffix}", "Local"),
|
|
433
455
|
]
|
|
434
456
|
tree = d.resolve()
|
|
435
457
|
return [replace(f, tree=tree) for f in found]
|
|
436
458
|
|
|
437
459
|
|
|
438
|
-
def _read_dir(
|
|
460
|
+
def _read_dir(
|
|
461
|
+
d: Path,
|
|
462
|
+
tier: Tier,
|
|
463
|
+
seen: set[str],
|
|
464
|
+
cfg: AgentsMdConfig,
|
|
465
|
+
skipped: list[str],
|
|
466
|
+
) -> list[_File]:
|
|
439
467
|
"""Return every ``.md`` file under ``d``, sorted."""
|
|
440
468
|
if not d.is_dir():
|
|
441
469
|
return []
|
|
@@ -443,9 +471,8 @@ def _read_dir(d: Path, tier: Tier, seen: set[str], cfg: AgentsMdConfig) -> list[
|
|
|
443
471
|
found = sorted(d.rglob("*.md"))
|
|
444
472
|
except OSError:
|
|
445
473
|
return []
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
]
|
|
474
|
+
read = partial(_read, seen=seen, depth=0, cfg=cfg, skipped=skipped)
|
|
475
|
+
return [f for p in found if p.is_file() for f in read(p, tier)]
|
|
449
476
|
|
|
450
477
|
|
|
451
478
|
# An included file governs what the file including it does: a rule's include is part of
|
|
@@ -453,13 +480,14 @@ def _read_dir(d: Path, tier: Tier, seen: set[str], cfg: AgentsMdConfig) -> list[
|
|
|
453
480
|
def _read(
|
|
454
481
|
path: Path,
|
|
455
482
|
tier: Tier,
|
|
456
|
-
seen: set[str],
|
|
457
483
|
*,
|
|
484
|
+
seen: set[str],
|
|
458
485
|
depth: int,
|
|
459
486
|
cfg: AgentsMdConfig,
|
|
487
|
+
skipped: list[str],
|
|
460
488
|
globs: tuple[str, ...] = (),
|
|
461
489
|
) -> list[_File]:
|
|
462
|
-
"""Return ``path`` and what it includes, each once."""
|
|
490
|
+
"""Return ``path`` and what it includes, each once; add why to ``skipped`` if not."""
|
|
463
491
|
if depth >= cfg.max_depth:
|
|
464
492
|
return []
|
|
465
493
|
try:
|
|
@@ -473,7 +501,14 @@ def _read(
|
|
|
473
501
|
raw = resolved.read_text(encoding="utf-8")
|
|
474
502
|
except (OSError, UnicodeDecodeError):
|
|
475
503
|
return []
|
|
476
|
-
|
|
504
|
+
# A rule whose ``paths:`` cannot be read would govern every path.
|
|
505
|
+
try:
|
|
506
|
+
meta, body = frontmatter(raw, source=str(resolved))
|
|
507
|
+
except yaml.YAMLError as e:
|
|
508
|
+
why = f"Skipping {resolved}: its frontmatter will not parse: {e}"
|
|
509
|
+
logger.warning(why)
|
|
510
|
+
skipped.append(why)
|
|
511
|
+
return []
|
|
477
512
|
body = _strip_comments(body)
|
|
478
513
|
if not body.strip():
|
|
479
514
|
return []
|
|
@@ -487,5 +522,15 @@ def _read(
|
|
|
487
522
|
own = _globs(meta) or globs
|
|
488
523
|
out = [_File(path=resolved, content=body, tier=tier, globs=own)]
|
|
489
524
|
for include in _includes(body, resolved.parent):
|
|
490
|
-
out.extend(
|
|
525
|
+
out.extend(
|
|
526
|
+
_read(
|
|
527
|
+
include,
|
|
528
|
+
tier,
|
|
529
|
+
seen=seen,
|
|
530
|
+
depth=depth + 1,
|
|
531
|
+
cfg=cfg,
|
|
532
|
+
skipped=skipped,
|
|
533
|
+
globs=own,
|
|
534
|
+
),
|
|
535
|
+
)
|
|
491
536
|
return out
|
|
@@ -246,15 +246,57 @@ def test_frontmatter_and_a_byte_order_mark_are_stripped(
|
|
|
246
246
|
assert "title" not in section
|
|
247
247
|
|
|
248
248
|
|
|
249
|
-
|
|
249
|
+
@pytest.mark.parametrize(
|
|
250
|
+
("meta", "line"),
|
|
251
|
+
[("paths: [unclosed", "line 2"), ("paths: ['src/**']\npaths: ['**']", "line 3")],
|
|
252
|
+
ids=["malformed", "repeated-key"],
|
|
253
|
+
)
|
|
254
|
+
def test_a_file_whose_frontmatter_will_not_parse_is_skipped_with_a_warning(
|
|
250
255
|
tmp_path: Path,
|
|
251
256
|
cfg: AgentsMdConfig,
|
|
257
|
+
caplog: pytest.LogCaptureFixture,
|
|
258
|
+
meta: str,
|
|
259
|
+
line: str,
|
|
252
260
|
) -> None:
|
|
253
|
-
|
|
261
|
+
"""Its ``paths:`` cannot be read, so loading it would apply it everywhere."""
|
|
262
|
+
rule = _write(tmp_path / ".sagent" / "rules" / "r.md", f"---\n{meta}\n---\nbody\n")
|
|
263
|
+
_write(tmp_path / "AGENTS.md", "kept\n")
|
|
264
|
+
|
|
265
|
+
with caplog.at_level(logging.WARNING):
|
|
266
|
+
section = directives(tmp_path, config=cfg)
|
|
267
|
+
found = rules_for(tmp_path, [tmp_path / "a.py"], exclude=set(), config=cfg)
|
|
268
|
+
|
|
269
|
+
assert "body" not in section
|
|
270
|
+
assert "kept" in section
|
|
271
|
+
assert found == ("", set())
|
|
272
|
+
assert str(rule.resolve()) in caplog.text
|
|
273
|
+
assert line in caplog.text
|
|
254
274
|
|
|
255
|
-
section = directives(tmp_path, config=cfg)
|
|
256
275
|
|
|
257
|
-
|
|
276
|
+
def test_a_window_keeps_each_file_it_skipped_where_it_was_reached(
|
|
277
|
+
tmp_path: Path,
|
|
278
|
+
cfg: AgentsMdConfig,
|
|
279
|
+
) -> None:
|
|
280
|
+
root = _write(tmp_path / "AGENTS.md", "---\na: 1\na: 2\n---\nroot\n")
|
|
281
|
+
nested = _write(tmp_path / "sub" / "AGENTS.md", "---\nb: 1\nb: 2\n---\nsub\n")
|
|
282
|
+
window = Directives(root=tmp_path, config=cfg)
|
|
283
|
+
|
|
284
|
+
window.start()
|
|
285
|
+
at_start = list(window.skipped)
|
|
286
|
+
window.found([tmp_path / "sub"], [], given=set())
|
|
287
|
+
|
|
288
|
+
assert at_start == [
|
|
289
|
+
(
|
|
290
|
+
f"Skipping {root.resolve()}: its frontmatter will not parse:"
|
|
291
|
+
f" {root.resolve()}, line 3: the key 'a' is given twice."
|
|
292
|
+
),
|
|
293
|
+
]
|
|
294
|
+
assert window.skipped[1:] == [
|
|
295
|
+
(
|
|
296
|
+
f"Skipping {nested.resolve()}: its frontmatter will not parse:"
|
|
297
|
+
f" {nested.resolve()}, line 3: the key 'b' is given twice."
|
|
298
|
+
),
|
|
299
|
+
]
|
|
258
300
|
|
|
259
301
|
|
|
260
302
|
@pytest.mark.parametrize("meta", ["- a\n- b", "just words", "42"])
|