crow-cli 0.1.50__tar.gz → 0.1.52__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.
- {crow_cli-0.1.50 → crow_cli-0.1.52}/PKG-INFO +10 -7
- crow_cli-0.1.52/PLAN.md +74 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/README.md +8 -5
- crow_cli-0.1.52/TODO.md +37 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/pyproject.toml +2 -2
- crow_cli-0.1.52/sandbox/async-react/streaming_async_react.py +323 -0
- crow_cli-0.1.52/sandbox/async-react/streaming_async_react_with_cancellation.py +296 -0
- crow_cli-0.1.52/scripts/scrub_words.py +232 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent/compact.py +10 -2
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent/llm.py +8 -3
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent/prompt.py +1 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent/session.py +12 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent2/agent.py +16 -11
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent2/emitter.py +24 -1
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent2/llm.py +42 -2
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent2/react.py +1 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent2/sessions.py +20 -5
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent2/tools.py +15 -6
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/cli/install_crow.py +15 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/cli/main.py +25 -62
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/client2/main.py +34 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/config/__init__.py +2 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/config/config.py +34 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/config/default/defaults.py +43 -14
- crow_cli-0.1.52/src/crow_cli/mcp/__init__.py +35 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/mcp/editor/main.py +0 -68
- {crow_cli-0.1.50/src/crow_cli/mcp2 → crow_cli-0.1.52/src/crow_cli/mcp}/execute/main.py +1 -1
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/mcp/memory/main.py +0 -4
- crow_cli-0.1.52/src/crow_cli/mcp/server/app.py +36 -0
- {crow_cli-0.1.50/src/crow_cli/mcp2 → crow_cli-0.1.52/src/crow_cli/mcp/server}/main.py +43 -60
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/timers.py +162 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/tools/__init__.py +3 -0
- crow_cli-0.1.52/src/crow_cli/tools/blender_tool.py +154 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/tools/fs_tool.py +194 -122
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/tools/memory_tool.py +114 -153
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/tools/proc_tool.py +156 -133
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/tools/register.py +2 -2
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/tools/results.py +7 -8
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/tools/rlm_tool.py +4 -4
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/tools/sg_tool.py +2 -2
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/tools/task_tool.py +2 -2
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/tools/vision_tool.py +64 -35
- crow_cli-0.1.52/src/crow_cli/tools/wake_tool.py +218 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/tools/web_tool.py +104 -126
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/conftest.py +30 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/e2e/test_compact_live.py +3 -1
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/e2e/test_custom_compactor_live.py +3 -3
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/e2e/test_execute_acp_client.py +4 -5
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/integration/test_agent2_gate.py +112 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/integration/test_cli_acp2.py +119 -20
- crow_cli-0.1.52/tests/integration/test_compact_stale_restart_repro.py +73 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/integration/test_execute_subtool_emission.py +13 -14
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/integration/test_react_loop_tool_round.py +2 -1
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/integration/test_tools_rlm_live.py +1 -1
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/mcp/test_execute.py +3 -1
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/mcp/test_execute_kernel_timeout.py +28 -17
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/mcp/test_execute_prelude.py +32 -26
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/mcp/test_mcp2_server.py +1 -1
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/mcp/test_read.py +4 -4
- crow_cli-0.1.52/tests/memory/test_scrub_words.py +180 -0
- crow_cli-0.1.52/tests/unit/test_agent2_prefill.py +299 -0
- crow_cli-0.1.52/tests/unit/test_agent_llm.py +27 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_client2_render.py +19 -5
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_compact.py +40 -1
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_tools_facade_names.py +1 -2
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_tools_fs.py +121 -122
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_tools_memory.py +76 -80
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_tools_proc.py +56 -54
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_tools_rlm.py +1 -1
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_tools_task.py +2 -2
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_tools_vision.py +25 -19
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_tools_web.py +72 -70
- {crow_cli-0.1.50 → crow_cli-0.1.52}/uv.lock +5 -5
- crow_cli-0.1.50/src/crow_cli/mcp/__init__.py +0 -63
- crow_cli-0.1.50/src/crow_cli/mcp/execute/kernel.py +0 -262
- crow_cli-0.1.50/src/crow_cli/mcp/execute/main.py +0 -285
- crow_cli-0.1.50/src/crow_cli/mcp/read/__init__.py +0 -0
- crow_cli-0.1.50/src/crow_cli/mcp/read/main.py +0 -128
- crow_cli-0.1.50/src/crow_cli/mcp/server/README.md +0 -0
- crow_cli-0.1.50/src/crow_cli/mcp/server/app.py +0 -41
- crow_cli-0.1.50/src/crow_cli/mcp/server/logger.py +0 -56
- crow_cli-0.1.50/src/crow_cli/mcp/server/main.py +0 -188
- crow_cli-0.1.50/src/crow_cli/mcp/task/__init__.py +0 -0
- crow_cli-0.1.50/src/crow_cli/mcp/task/main.py +0 -301
- crow_cli-0.1.50/src/crow_cli/mcp/terminal/README.md +0 -0
- crow_cli-0.1.50/src/crow_cli/mcp/terminal/__init__.py +0 -3
- crow_cli-0.1.50/src/crow_cli/mcp/terminal/backend.py +0 -289
- crow_cli-0.1.50/src/crow_cli/mcp/terminal/constants.py +0 -37
- crow_cli-0.1.50/src/crow_cli/mcp/terminal/logging_config.py +0 -61
- crow_cli-0.1.50/src/crow_cli/mcp/terminal/main.py +0 -158
- crow_cli-0.1.50/src/crow_cli/mcp/terminal/metadata.py +0 -97
- crow_cli-0.1.50/src/crow_cli/mcp/terminal/session.py +0 -276
- crow_cli-0.1.50/src/crow_cli/mcp/vision/__init__.py +0 -0
- crow_cli-0.1.50/src/crow_cli/mcp/vision/client.py +0 -24
- crow_cli-0.1.50/src/crow_cli/mcp/vision/main.py +0 -105
- crow_cli-0.1.50/src/crow_cli/mcp/web_fetch/README.md +0 -0
- crow_cli-0.1.50/src/crow_cli/mcp/web_fetch/__init__.py +0 -3
- crow_cli-0.1.50/src/crow_cli/mcp/web_fetch/main.py +0 -102
- crow_cli-0.1.50/src/crow_cli/mcp/web_search/README.md +0 -23
- crow_cli-0.1.50/src/crow_cli/mcp/web_search/__init__.py +0 -3
- crow_cli-0.1.50/src/crow_cli/mcp/web_search/main.py +0 -101
- crow_cli-0.1.50/src/crow_cli/mcp/write/README.md +0 -0
- crow_cli-0.1.50/src/crow_cli/mcp/write/__init__.py +0 -0
- crow_cli-0.1.50/src/crow_cli/mcp/write/main.py +0 -41
- crow_cli-0.1.50/src/crow_cli/mcp2/__init__.py +0 -36
- crow_cli-0.1.50/src/crow_cli/mcp2/execute/__init__.py +0 -0
- crow_cli-0.1.50/src/crow_cli/mcp2/server.py +0 -41
- {crow_cli-0.1.50 → crow_cli-0.1.52}/.env.example +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/.github/workflows/build-binaries.yml +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/.github/workflows/publish-crow-cli.yml +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/.gitignore +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/.python-version +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/AGENTS.md +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/LICENSE.md +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/PYINSTALLER_BUILD.md +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/agent.json +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/crow-cli.spec +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/CNAME +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/crow-cli-docs/getting-started/installation.md +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/crow-cli-docs/getting-started/quickstart.md +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/crow-cli-docs/index.md +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/crow-cli-docs/memory-tool-design.md +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/crow-cli-docs/myst.yml +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/crow-cli-docs/styles/purple.css +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/crow-logo.svg +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/get-llamacpp-working.md +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/getting-started/installation.md +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/getting-started/quickstart.md +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/icon.ico +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/img/crow-icon-purple.svg +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/img/crow-logo-crop.png +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/img/icon.svg +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/img/whiteboard_capture.png +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/index.html +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/index.md +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/journal/03May2026.md +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/journal/19Feb2026.md +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/journal/20Feb2026.md +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/journal/22Feb2026.md +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/journal/29Aug2026.md +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/llm-wiki.md +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/myst.yml +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/docs/styles/purple.css +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/examples/custom_agent.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/examples/custom_compactor.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/run_tests.sh +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/scripts/consolidate_history.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/scripts/e2e_compact_live.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/scripts/e2e_image_store_live.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/scripts/e2e_memory_live.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/scripts/e2e_postgres_live.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/scripts/mcp_ram_repro.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/scripts/merge_live_into_migrated.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/scripts/migrate_taskmaster.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/scripts/migrate_v5.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/scripts/migrate_v6.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/skills/crow-cli/SKILL.md +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/__init__.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/acp_helpers.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent/__init__.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent/context.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent/hooks.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent/logger.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent/main.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent/mcp_client.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent/memory.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent/model_routing.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent/react.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent/replay.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent/slash.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent/tools.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent2/__init__.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent2/compaction.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent2/ctx.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent2/deliveries.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent2/driver.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent2/events.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent2/goal.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent2/main.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent2/replay.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent2/slash.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent2/watcher.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agent_runner.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/agents.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/cli/__init__.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/cli/init_cmd.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/cli/install.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/cli/source.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/client/__init__.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/client/main.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/client/pty_spawn.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/client/subagent.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/client/terminal.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/client2/__init__.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/client2/subagent.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/config/default/__init__.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/config/default/searxng_settings.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/discover.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/mcp/editor/README.md +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/mcp/editor/__init__.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/mcp/execute/__init__.py +0 -0
- {crow_cli-0.1.50/src/crow_cli/mcp2 → crow_cli-0.1.52/src/crow_cli/mcp}/execute/kernel.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/mcp/memory/__init__.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/mcp/memory/client.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/mcp/memory/store.py +0 -0
- {crow_cli-0.1.50/src/crow_cli/mcp/read → crow_cli-0.1.52/src/crow_cli/mcp/server}/README.md +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/mcp/server/__init__.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/mcp/server/memtrim.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/mcp_meta.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/memory/__init__.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/memory/db.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/memory/fts.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/memory/ids.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/memory/image_store.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/memory/messages.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/memory/models.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/memory/reads.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/memory/session_tabs.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/memory/writes.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/tools/edit_tool.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/tools/goal_tool.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/tools/write_tool.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/src/crow_cli/wake.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/__init__.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/e2e/custom_compactor_agent.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/e2e/test_agent2_live.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/e2e/test_compact_continues_live.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/e2e/test_execute_live.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/e2e/test_mcp_multi_server.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/e2e/test_react_live.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/e2e/test_session_update_transmission.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/e2e/test_source_first_spawn.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/e2e/test_task_high_priority_preemption.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/e2e/test_task_mcp_launch.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/e2e/test_task_race_regression.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/integration/test_acp2_http.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/integration/test_acp_http.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/integration/test_agent2_task_subtool.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/integration/test_agent2_watcher.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/integration/test_agent_init.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/integration/test_auth_validation.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/integration/test_cli_run_dispatch.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/integration/test_client2_subagent.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/integration/test_goal_driver.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/integration/test_goal_slash.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/integration/test_mcp2_runner.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/integration/test_mcp_tool_selection.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/integration/test_react_loop_cancel_integrity.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/integration/test_react_loop_delegation_hold.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/integration/test_react_loop_execute_tool.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/integration/test_reasoning_effort_react_loop.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/integration/test_slash_commands.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/integration/test_timers_live.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/mcp/conftest.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/mcp/integration/test_server_stdio.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/mcp/test_edit.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/mcp/test_execute_kernel_recovery.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/mcp/test_memory.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/mcp/test_memory_store.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/mcp/test_memtrim.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/mcp/test_server.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/mcp/test_task_tool.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/mcp/test_terminal.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/mcp/test_tool_selection.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/mcp/test_vision.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/mcp/test_web_fetch.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/mcp/test_web_search.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/mcp/test_write.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/memory/test_db.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/memory/test_delete_session.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/memory/test_goal_state.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/memory/test_image_store.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/memory/test_migrate_taskmaster.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/memory/test_migrate_v5.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/memory/test_migrate_v6.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/memory/test_session_mcp_servers.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/memory/test_session_tabs.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/memory/test_store.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/memory/test_task_state.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_agent2_diff.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_agent2_mcp_recovery.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_agent2_mcp_wiring.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_agent2_normalize_prompt.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_agent2_tools_drain.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_agent_delete_session.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_agent_replay.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_agents_registry.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_cli_fork_flags.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_cli_telemetry.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_client_terminal.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_compact_last_messages_list_content.json +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_compact_last_messages_list_content.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_configure.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_discover.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_fork.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_goal_continuation.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_init_postgres.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_init_rustfs.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_init_source.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_install_crow.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_json_repair.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_mcp_client.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_mcp_meta.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_model_override.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_model_routing.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_per_model_compact_threshold.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_prompt.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_pty_spawn.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_react.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_reasoning_effort.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_request_logging.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_session.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_session_mcp_servers_wiring.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_source.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_stream_processing.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_subagent_parse_servers.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_system_prompt_skills.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_task_tool_schema.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_timers.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_tools_edit.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_tools_goal.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_tools_register_db.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_tools_write.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_usage_update.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_uv_project_enforcement.py +0 -0
- {crow_cli-0.1.50 → crow_cli-0.1.52}/tests/unit/test_version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: crow-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.52
|
|
4
4
|
Summary: Add your description here
|
|
5
5
|
Project-URL: Homepage, https://github.com/crow-cli/crow-cli
|
|
6
6
|
Project-URL: Repository, https://github.com/crow-cli/crow-cli
|
|
@@ -9,7 +9,7 @@ Project-URL: Documentation, https://github.com/crow-cli/crow-cli#readme
|
|
|
9
9
|
License-Expression: MIT
|
|
10
10
|
License-File: LICENSE.md
|
|
11
11
|
Requires-Python: >=3.13
|
|
12
|
-
Requires-Dist: agent-client-protocol[http]>=1.0
|
|
12
|
+
Requires-Dist: agent-client-protocol[http]>=1.1.0
|
|
13
13
|
Requires-Dist: aiosqlite>=0.22.1
|
|
14
14
|
Requires-Dist: ast-grep-py>=0.45.3
|
|
15
15
|
Requires-Dist: boto3>=1.40.0
|
|
@@ -72,7 +72,7 @@ Two ideas hold the whole thing together.
|
|
|
72
72
|
|
|
73
73
|
**Persistence is the point.** Every session lives in a SQL database (`~/.agents/crow/crow.db` — sqlite by default, PostgreSQL when you want one store shared across machines) with full-text search over every message. Agents recall past conversations, read each other's sessions and delegate work to one another through that store; there is no bespoke agent-to-agent protocol, just a shared database and a read query. Images are content-addressed files beside the database, hydrated to base64 only when they are actually sent to the LLM. Sessions get memorable coolname ids (`taupe-squirrel-of-splendid-potency`) you can resume, fork, or read from any other agent.
|
|
74
74
|
|
|
75
|
-
**The
|
|
75
|
+
**The agent ships with tools, and merges the client's.** The agent's own supply (config.yaml's `mcpServers` — `crow-mcp` out of the box) is merged with whatever the client hands it at `session/new`, so a fresh install works and a third-party client can layer its own servers on top — see [Tools](#tools-the-agent-ships-with-a-supply). `--no-default-tool` drops the agent's own supply, leaving the session's tools to be exactly what its client sent.
|
|
76
76
|
|
|
77
77
|
## Requirements
|
|
78
78
|
|
|
@@ -200,7 +200,7 @@ Two shapes, and only two:
|
|
|
200
200
|
| crow IDE | VS Code built from source by the `crow` repo's `packages/crow-gui`, with the crow chat extension bundled as a built-in — desktop app and browser server | dials `crowAcp.endpoint`, default `ws://127.0.0.1:2771/acp` | `crow` |
|
|
201
201
|
| any ACP client | Zed and friends, over stdio or WebSocket | the client spawns the command you give it | `crow-cli acp` / `acp2` |
|
|
202
202
|
|
|
203
|
-
**The args, exactly.** `acp --http` serves protocol v1 on **2769**; `acp2 --http` serves v2 on **2771**; `--host` (default `127.0.0.1`) and `--port` move either. One v2 instance is enough for every dialler — the IDE panel's `crowAcp.endpoint` defaults to `ws://127.0.0.1:2771/acp`. A client that only speaks v1 needs `crow-cli acp --http` instead, on 2769.
|
|
203
|
+
**The args, exactly.** `acp --http` serves protocol v1 on **2769**; `acp2 --http` serves v2 on **2771**; `--host` (default `127.0.0.1`) and `--port` move either. One v2 instance is enough for every dialler — the IDE panel's `crowAcp.endpoint` defaults to `ws://127.0.0.1:2771/acp`. A client that only speaks v1 needs `crow-cli acp --http` instead, on 2769. `acp2 --no-default-tool` starts an agent with no tools of its own: config.yaml's `mcpServers` are not merged into a session, so the session's tools are exactly the ones its client sent in `session/new`. That is how a client gives an agent a single purpose — a conductor whose only arm is the three tools it was handed — by construction rather than by asking nicely in a prompt.
|
|
204
204
|
|
|
205
205
|
### `crow-agent` — the terminal client
|
|
206
206
|
|
|
@@ -280,9 +280,9 @@ For [Zed](https://zed.dev/), declare the agent *and* its tool supply — Zed for
|
|
|
280
280
|
}
|
|
281
281
|
```
|
|
282
282
|
|
|
283
|
-
## Tools: the
|
|
283
|
+
## Tools: the agent ships with a supply
|
|
284
284
|
|
|
285
|
-
|
|
285
|
+
The agent is not toolless by default. `mcpServers` in `~/.agents/crow/config.yaml` is the agent's own supply, and `crow-cli init` writes the entry below so a fresh install has tools out of the box:
|
|
286
286
|
|
|
287
287
|
```yaml
|
|
288
288
|
mcpServers:
|
|
@@ -292,7 +292,10 @@ mcpServers:
|
|
|
292
292
|
args: [mcp]
|
|
293
293
|
```
|
|
294
294
|
|
|
295
|
-
|
|
295
|
+
At `session/new` the agent merges this supply with whatever its client sent — a client entry replaces a same-named config entry, everything else lands beside it — so a third-party client can layer its own servers on top of crow's without displacing them. Two switches change who owns the supply:
|
|
296
|
+
|
|
297
|
+
- `--no-default-tool` drops config.yaml's servers from every session, so the session's tools are exactly the ones its client sent. That is what makes an agent generic by construction rather than by prompt: a conductor whose only arm is the MCP server it was handed cannot reach for `execute` and go off script.
|
|
298
|
+
- An `agent_servers` entry may carry its own `mcpServers`, which *replaces* the global supply for that agent only — that is how a v2 agent gets `crow-mcp2` without changing what the v1 sessions on the same box are handed.
|
|
296
299
|
|
|
297
300
|
One binary serves two tool surfaces:
|
|
298
301
|
|
crow_cli-0.1.52/PLAN.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
## **DO NOT ASK USER FOR FEEDBACK — THIS IS THE USER FEEDBACK.**
|
|
2
|
+
## **DO NOT ASK USER FOR NEXT STEPS — THESE ARE THE NEXT STEPS.**
|
|
3
|
+
|
|
4
|
+
# PLAN — v2-preview sprint (master)
|
|
5
|
+
|
|
6
|
+
Build/gates:
|
|
7
|
+
crow-cli: uv --project /home/thomas/.agents/crow/src/crow-cli-v2-preview run pytest tests/unit -q
|
|
8
|
+
uv --project ... run pytest tests/integration/test_acp2_http.py tests/integration/test_cli_acp2.py tests/integration/test_agent2_gate.py -q
|
|
9
|
+
crow Rust: cargo test (from /home/thomas/.agents/crow/src/crow-v2-preview/crates/crow-client)
|
|
10
|
+
crow TS: bun run typecheck && bun test test/unit (from packages/vscode-acp; aui/acp tests via bun test in packages/aui/acp)
|
|
11
|
+
|
|
12
|
+
Trajectory: 1 -> 2 -> 3 -> 4 -> 5 -> 6. Commit at each item boundary,
|
|
13
|
+
trailer Session-Id: economic-urchin-of-easy-pleasure. crow-side mirror of
|
|
14
|
+
items 2-5 lives in ../crow-v2-preview/PLAN.md — mark both when done.
|
|
15
|
+
Principle: behavior-preserving first (migration), then additive preview
|
|
16
|
+
adoption, then the interop gate. Keep v1 paths untouched.
|
|
17
|
+
|
|
18
|
+
## Phase 1 — crow-cli SDK 1.1.0 (worktree crow-cli-v2-preview)
|
|
19
|
+
|
|
20
|
+
- [x] 1.1 Bump pyproject to agent-client-protocol[http]>=1.1.0, uv sync, run unit + acp2 integration gates; fix fallout (validation now raises; module loggers; removed NES/PlanUpdateFile/connect_mcp — none used, verified).
|
|
21
|
+
Verify: gates green; commit.
|
|
22
|
+
- [x] 1.2 availableCommands in new_session/resume_session/fork responses alongside the existing notification.
|
|
23
|
+
Verify: new assertion in integration test; gates green; commit.
|
|
24
|
+
- [x] 1.3 Turn failure after insertion -> idle(stop_reason="error") from the driver failure path (pre-insertion failures stay JSON-RPC errors).
|
|
25
|
+
Verify: new test drives a failing turn and observes idle error; gates green; commit.
|
|
26
|
+
- [x] 1.4 Audit silent-drop reliance + stale docstrings (emitter.usage_model), note findings in TODO.
|
|
27
|
+
Verify: grep audit + gates green; commit if edits.
|
|
28
|
+
|
|
29
|
+
Phase 1 evidence (2026-11-27): commits 09cf9611 (SDK bump), cb4cc229
|
|
30
|
+
(palette responses), 528620a5 (crash-path gate), ce2d26d0 (audit note).
|
|
31
|
+
Unit 940/940; agent2 gate + client2 subagent 74/74; acp2 http/cli gate 45/45.
|
|
32
|
+
|
|
33
|
+
## Phase 2 — crow Rust crate 5.6.1 migration (worktree crow-v2-preview)
|
|
34
|
+
|
|
35
|
+
- [x] 2.1 DONE crow 4d96115: crate 5.6.1, features stdio/process/unstable_protocol_v2/unstable_end_turn_token_usage; dropped unstable_session_compaction (fork not called via typed Rust SDK).
|
|
36
|
+
- [x] 2.2 DONE crow 4d96115: v1::schema/v2::schema; root ErrorCode struct + consts; From<v1::Error>.
|
|
37
|
+
- [x] 2.3 DONE crow 4d96115: (Channel, Option<ConnectionDriver>); non_exhaustive configs; RawJsonRpcId/RawJsonRpcResponse; raw Builder::new guard-free entry.
|
|
38
|
+
Verify (2.1-2.3 together): cargo test green incl. fixtures/layout; commit. No UX change.
|
|
39
|
+
DONE crow 4d96115 (2026-11-27): cargo test -p crow-client -j 2 -> 960 passed,
|
|
40
|
+
0 failed. profile.dev split-debuginfo=unpacked added: beta.4 schema grew test
|
|
41
|
+
DWARF past the 4GiB 32-bit relocation limit (link overflow); split DWARF links
|
|
42
|
+
cleanly, no codegen/runtime change. Build with -j 2 to bound core usage.
|
|
43
|
+
|
|
44
|
+
## Phase 3 — crow Rust beta.4 adoption + alpha.7 tolerance
|
|
45
|
+
|
|
46
|
+
- [x] 3.1 DONE crow c60e32b: palette reads name/description raw, so beta.4 typed command + alpha.7 flat both populate; characterization test.
|
|
47
|
+
- [x] 3.2 DONE crow c60e32b: is_replay_complete closes window; resume-response fallback kept; test.
|
|
48
|
+
- [x] 3.3 DONE crow c60e32b (Error arm in 4d96115): bare word + object -> error notice; unknown/future states never idle; tests.
|
|
49
|
+
- [x] 3.4 DONE crow c60e32b: apply_setup reads availableCommands; compaction patch semantics; paused/background tolerated; tests.
|
|
50
|
+
Verify: cargo test green; commit per item.
|
|
51
|
+
DONE crow c60e32b (2026-11-27): cargo test -p crow-client -j 2 -> 966 passed
|
|
52
|
+
(+6 characterization), 0 failed. Structured ErrorStopReason object rendering
|
|
53
|
+
and background-work methods remain Deferred (python-sdk still alpha.7); the
|
|
54
|
+
client tolerates/parses them without crashing.
|
|
55
|
+
|
|
56
|
+
## Phase 4 — crow TS types beta.4
|
|
57
|
+
|
|
58
|
+
- [x] 4.1 Vendor types.gen.ts from @agentclientprotocol/sdk v2.12.0 into packages/aui/acp/src/v2/; update index.ts header; fix compile fallout behavior-preserving.
|
|
59
|
+
Verify: bun typecheck (aui/acp + chat + vscode-acp) green; existing acp unit tests green; commit. DONE ba3d8f8 (crow): stable schema only, ClientOptions artifact stripped, session.fork read via tolerance cast (beta.4 moved fork to unstable; alpha.7 agents still send it). chat typecheck clean.
|
|
60
|
+
- [x] 4.2 acpThreadState/conversions: error stopReason -> message status error carrying the error text; tolerate replay_complete/unknown/new updates.
|
|
61
|
+
Verify: new/existing unit tests green; commit. DONE ba3d8f8 (crow): AcpStopReason+"error"; settleErrorStatus lifts trailing 'agent error: …' into status.error on idle/run-end/run-handoff; unknown updates already fall through the default arm. 8 new tests, 110/110 chat tests.
|
|
62
|
+
|
|
63
|
+
## Phase 5 — vscode-acp entry + error bubble
|
|
64
|
+
|
|
65
|
+
- [x] 5.1 crowAcp.server paste-able JSON setting (spawn: {command,args,model,port,cwd,mcpServers} | external: {endpoint}); existing per-field settings remain fallback; backend.ts architecture unchanged.
|
|
66
|
+
Verify: new unit tests (parse/merge/fallback); build+typecheck+unit green; commit. DONE fb23db0 (crow): resolveServerEntry (backend.ts, pure) + configError start seam; 6 new tests, unit 70/70, build+typecheck green.
|
|
67
|
+
- [x] 5.2 Red error bubble in chat webview with copy button top right (copies error text), fed by turn errors (v2 error idle + JSON-RPC errors).
|
|
68
|
+
Verify: unit/component test + eyeball via integration or e2e; commit. DONE c4b8646 (crow): message-error.aui.tsx, copy top right, full text; 3 component tests, chat 113/113. Eyeball at Phase 6.
|
|
69
|
+
|
|
70
|
+
## Phase 6 — interop gate (both worktrees together)
|
|
71
|
+
|
|
72
|
+
- [x] 6.1 DONE: beta.4-shaped JSON-RPC client <-> real alpha.7 crow-cli agent (/tmp/interop_probe.py, wire /tmp/interop_wire.jsonl): initialize protocolVersion 2, session/new availableCommands in response, prompt ack(messageId)->running->thought/message chunks->usage_update->idle(end_turn,usage), resume+replay (replayFrom start), error turn idle stopReason="error" + "agent error: …" text. Real crow-agent TUI on PTY spawns worktree crow-cli acp2 (/tmp/tui_interop.py, pane /tmp/tui_pane.txt): prompt echo, thought, PONG, badge crow-cli acp2 · qwen3.8-max. KEY: beta.4 SetSessionConfigOptionRequest.value is serde(flatten) -> wire top-level type+bare value = alpha.7; do NOT nest.
|
|
73
|
+
- [x] 6.2 DONE: web e2e error-bubble test (stub fail() -> running -> "agent error: …" -> idle stopReason error) green 7/7 x3 runs; /tmp/error_bubble.png vision-judged: red destructive bubble, copy button top right, light + dark themes. Fixed bun:test expect (no toContainText) + new-thread composer-remount race (wait for session row).
|
|
74
|
+
- [x] 6.3 DONE: gates re-run (web e2e 7/7; chat/aui/ext unchanged by Phase 6), files marked, commits complete, goal_done + summary.
|
|
@@ -20,7 +20,7 @@ Two ideas hold the whole thing together.
|
|
|
20
20
|
|
|
21
21
|
**Persistence is the point.** Every session lives in a SQL database (`~/.agents/crow/crow.db` — sqlite by default, PostgreSQL when you want one store shared across machines) with full-text search over every message. Agents recall past conversations, read each other's sessions and delegate work to one another through that store; there is no bespoke agent-to-agent protocol, just a shared database and a read query. Images are content-addressed files beside the database, hydrated to base64 only when they are actually sent to the LLM. Sessions get memorable coolname ids (`taupe-squirrel-of-splendid-potency`) you can resume, fork, or read from any other agent.
|
|
22
22
|
|
|
23
|
-
**The
|
|
23
|
+
**The agent ships with tools, and merges the client's.** The agent's own supply (config.yaml's `mcpServers` — `crow-mcp` out of the box) is merged with whatever the client hands it at `session/new`, so a fresh install works and a third-party client can layer its own servers on top — see [Tools](#tools-the-agent-ships-with-a-supply). `--no-default-tool` drops the agent's own supply, leaving the session's tools to be exactly what its client sent.
|
|
24
24
|
|
|
25
25
|
## Requirements
|
|
26
26
|
|
|
@@ -148,7 +148,7 @@ Two shapes, and only two:
|
|
|
148
148
|
| crow IDE | VS Code built from source by the `crow` repo's `packages/crow-gui`, with the crow chat extension bundled as a built-in — desktop app and browser server | dials `crowAcp.endpoint`, default `ws://127.0.0.1:2771/acp` | `crow` |
|
|
149
149
|
| any ACP client | Zed and friends, over stdio or WebSocket | the client spawns the command you give it | `crow-cli acp` / `acp2` |
|
|
150
150
|
|
|
151
|
-
**The args, exactly.** `acp --http` serves protocol v1 on **2769**; `acp2 --http` serves v2 on **2771**; `--host` (default `127.0.0.1`) and `--port` move either. One v2 instance is enough for every dialler — the IDE panel's `crowAcp.endpoint` defaults to `ws://127.0.0.1:2771/acp`. A client that only speaks v1 needs `crow-cli acp --http` instead, on 2769.
|
|
151
|
+
**The args, exactly.** `acp --http` serves protocol v1 on **2769**; `acp2 --http` serves v2 on **2771**; `--host` (default `127.0.0.1`) and `--port` move either. One v2 instance is enough for every dialler — the IDE panel's `crowAcp.endpoint` defaults to `ws://127.0.0.1:2771/acp`. A client that only speaks v1 needs `crow-cli acp --http` instead, on 2769. `acp2 --no-default-tool` starts an agent with no tools of its own: config.yaml's `mcpServers` are not merged into a session, so the session's tools are exactly the ones its client sent in `session/new`. That is how a client gives an agent a single purpose — a conductor whose only arm is the three tools it was handed — by construction rather than by asking nicely in a prompt.
|
|
152
152
|
|
|
153
153
|
### `crow-agent` — the terminal client
|
|
154
154
|
|
|
@@ -228,9 +228,9 @@ For [Zed](https://zed.dev/), declare the agent *and* its tool supply — Zed for
|
|
|
228
228
|
}
|
|
229
229
|
```
|
|
230
230
|
|
|
231
|
-
## Tools: the
|
|
231
|
+
## Tools: the agent ships with a supply
|
|
232
232
|
|
|
233
|
-
|
|
233
|
+
The agent is not toolless by default. `mcpServers` in `~/.agents/crow/config.yaml` is the agent's own supply, and `crow-cli init` writes the entry below so a fresh install has tools out of the box:
|
|
234
234
|
|
|
235
235
|
```yaml
|
|
236
236
|
mcpServers:
|
|
@@ -240,7 +240,10 @@ mcpServers:
|
|
|
240
240
|
args: [mcp]
|
|
241
241
|
```
|
|
242
242
|
|
|
243
|
-
|
|
243
|
+
At `session/new` the agent merges this supply with whatever its client sent — a client entry replaces a same-named config entry, everything else lands beside it — so a third-party client can layer its own servers on top of crow's without displacing them. Two switches change who owns the supply:
|
|
244
|
+
|
|
245
|
+
- `--no-default-tool` drops config.yaml's servers from every session, so the session's tools are exactly the ones its client sent. That is what makes an agent generic by construction rather than by prompt: a conductor whose only arm is the MCP server it was handed cannot reach for `execute` and go off script.
|
|
246
|
+
- An `agent_servers` entry may carry its own `mcpServers`, which *replaces* the global supply for that agent only — that is how a v2 agent gets `crow-mcp2` without changing what the v1 sessions on the same box are handed.
|
|
244
247
|
|
|
245
248
|
One binary serves two tool surfaces:
|
|
246
249
|
|
crow_cli-0.1.52/TODO.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
## **DO NOT ASK USER FOR FEEDBACK — THIS IS THE USER FEEDBACK.**
|
|
2
|
+
## **DO NOT ASK USER FOR NEXT STEPS — THESE ARE THE NEXT STEPS.**
|
|
3
|
+
|
|
4
|
+
# TODO — v2-preview sprint (master; crow-side mirror in ../crow-v2-preview/TODO.md)
|
|
5
|
+
|
|
6
|
+
Worktrees: /home/thomas/.agents/crow/src/crow-cli-v2-preview (branch v2-preview)
|
|
7
|
+
and /home/thomas/.agents/crow/src/crow-v2-preview (branch v2-preview).
|
|
8
|
+
User mandate: implement the ACP v2 Preview upgrade in both, keep behavior as
|
|
9
|
+
close to current as possible, make the two worktrees work together. The
|
|
10
|
+
vscode-acp extension stays backend-owns-state/spawns-agent with a lightweight
|
|
11
|
+
webview; add a paste-able settings entry like an MCP server. Errors render as
|
|
12
|
+
a red bubble with copy-click top right.
|
|
13
|
+
|
|
14
|
+
## Scope
|
|
15
|
+
|
|
16
|
+
- [x] crow-cli: SDK 1.0.0rc3 -> 1.1.0 (v1 schema 1.35.0, v2 exp alpha.7). Gate: unit + acp2 integration suites green.
|
|
17
|
+
- [x] crow-cli: availableCommands in new/resume/fork responses (keep the notification too). Gate: assertion test + suites green.
|
|
18
|
+
- [x] crow-cli: failure after prompt insertion ends as idle(stopReason="error") (alpha.7 open string allows it). Gate: new test + live smoke.
|
|
19
|
+
- [x] crow-cli: audit reliance on silent validation drops (SDK now raises); fix stale usage_model docstring. Gate: audit note + suites green.
|
|
20
|
+
- [x] crow Rust: crate 2.2.0 -> 5.6.1 behavior-preserving migration. DONE crow 4d96115: features stdio/process/unstable_protocol_v2/unstable_end_turn_token_usage (dropped unstable_session_compaction), v1::schema/v2::schema, Option<ConnectionDriver>, Error conversions, StopReason Error arm, Malformed-frame batch scan, raw Builder::new; profile.dev split-debuginfo=unpacked fixes >4GiB DWARF link overflow. cargo test -j 2: 960 passed, no UX change.
|
|
21
|
+
- [x] crow Rust: beta.4 adoption + alpha.7 tolerance. DONE crow c60e32b: replay_complete closes ReplayWindow (response fallback kept), error stopReason string|object -> error, unknown/paused/background states never settle, setup-response availableCommands, compaction status patch (omitted unchanged/null->in_progress), typed+flat palette. 6 characterization tests; cargo test -j 2: 966 passed.
|
|
22
|
+
- [x] crow TS: vendored v2 types alpha.2 -> beta.4 from @agentclientprotocol/sdk 2.12.0; typecheck green; acpThreadState handles error stopReason + tolerates new updates. Gate: bun typecheck + existing acp tests. DONE crow ba3d8f8: stable beta.4 types (fork tolerance cast for alpha.7 peers), error stopReason -> incomplete/error with crash text lifted into status.error; chat typecheck clean, 110/110 (8 new).
|
|
23
|
+
- [x] vscode-acp: crowAcp.server paste-able JSON entry (spawn|external), existing settings remain fallback; backend keeps owning state + spawning. Gate: unit tests for parse/merge; build+typecheck green. DONE crow fb23db0: resolveServerEntry in backend.ts, field-by-field override, configError fails start; 6 new tests, unit 70/70, build+typecheck green.
|
|
24
|
+
- [x] chat webview: red error bubble, copy button top right copies error text; fed by v2 error idle + JSON-RPC errors. Gate: component/unit test + eyeball. DONE crow c4b8646 (message-error.aui.tsx): copy button top right, full text pre-wrap; 3 component tests, chat 113/113. Eyeball DONE Phase 6 (/tmp/error_bubble.png).
|
|
25
|
+
- [x] Interop gate: DONE Phase 6. beta.4 client <-> alpha.7 agent wire (/tmp/interop_wire.jsonl): new/resume+replay/prompt/error turn; real crow-agent TUI PTY spawns worktree crow-cli acp2 (/tmp/tui_pane.txt PONG). Web e2e error bubble 7/7 x3, /tmp/error_bubble.png red bubble + copy top right (light+dark).
|
|
26
|
+
- [x] Commit each coherent unit with Session-Id: economic-urchin-of-easy-pleasure trailer in BOTH worktrees.
|
|
27
|
+
|
|
28
|
+
## Deferred (reason: python-sdk main is still alpha.7; beta.4 agent-side bindings do not exist yet)
|
|
29
|
+
|
|
30
|
+
- replay_complete emission, subagent_update/session_message, background work methods (tool_call/cancel, terminal/cancel, paused, background lists), skill command union + skill content blocks, idempotencyKey, client systemPrompt, terminal size, structured ErrorStopReason object, _meta/cost patch semantics. Client side (Rust+TS) tolerates/renders these when they arrive. Revisit when python-sdk ships beta bindings or we vendor codegen.
|
|
31
|
+
|
|
32
|
+
## Environment facts
|
|
33
|
+
|
|
34
|
+
- Upstream: schema v2.0.0-beta.4 = Preview (Nov 20). Rust crate 5.6.1 = v1.35.0+beta.4. TS SDK 2.12.0 = same. Python SDK 1.1.0 = v1.35.0 + v2 alpha.7 (ceiling).
|
|
35
|
+
- alpha.7 StopReason is an open string; AvailableCommand is flat (no type). beta.4 AvailableCommand is a command|skill union; flat commands must be tolerated client-side.
|
|
36
|
+
- rustc 1.98.1, bun 1.4.2, uv-managed Python 3.13.
|
|
37
|
+
- crow repo's old TODO/PLAN (coordination backend sprint) is fully complete; replaced on this branch.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "crow-cli"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.52"
|
|
4
4
|
description = "Add your description here"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.13"
|
|
7
7
|
license = "MIT"
|
|
8
8
|
dependencies = [
|
|
9
|
-
"agent-client-protocol[http]>=1.0
|
|
9
|
+
"agent-client-protocol[http]>=1.1.0",
|
|
10
10
|
"aiosqlite>=0.22.1",
|
|
11
11
|
"boto3>=1.40.0",
|
|
12
12
|
"click>=8.4.0",
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Minimal streaming react loop: MCP tools, OpenAI chat completions.
|
|
3
|
+
|
|
4
|
+
The whole agent in one file — no ACP, no database, no compaction, no
|
|
5
|
+
cancellation (see ``streaming_async_react_with_cancellation.py`` for that; the
|
|
6
|
+
only difference is the cancel paths). Stream, accumulate, call the tool, append,
|
|
7
|
+
loop. Same general idea as the original sandbox script; the wire details are what
|
|
8
|
+
crow-cli does today (``crow_cli/agent2/llm.py``, ``agent2/tools.py``,
|
|
9
|
+
``agent/session.py``).
|
|
10
|
+
|
|
11
|
+
uv run python sandbox/async-react/streaming_async_react.py
|
|
12
|
+
... --raw dump every request body
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
import asyncio
|
|
16
|
+
import json
|
|
17
|
+
import os
|
|
18
|
+
import sys
|
|
19
|
+
from dataclasses import dataclass, field
|
|
20
|
+
from pathlib import Path
|
|
21
|
+
|
|
22
|
+
import httpx
|
|
23
|
+
from fastmcp import Client
|
|
24
|
+
from mcp.types import ImageContent
|
|
25
|
+
from openai import AsyncOpenAI
|
|
26
|
+
|
|
27
|
+
API_KEY = os.getenv("ALIBABA_API_KEY")
|
|
28
|
+
BASE_URL = os.getenv("ALIBABA_BASE_URL", "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1")
|
|
29
|
+
MODEL = os.getenv("REACT_MODEL", "glm-5.2")
|
|
30
|
+
MAX_TOKENS = 8192
|
|
31
|
+
MCP_CONFIG = {
|
|
32
|
+
"mcpServers": {
|
|
33
|
+
"crow-mcp": {
|
|
34
|
+
"transport": "stdio",
|
|
35
|
+
"command": str(Path.home() / ".agents/crow/src/crow-cli/.venv/bin/crow-cli"),
|
|
36
|
+
"args": ["mcp2"],
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def configure_provider(raw: bool = False) -> AsyncOpenAI:
|
|
43
|
+
async def log_request(request):
|
|
44
|
+
print(f"\n{'=' * 20} RAW REQUEST {'=' * 20}\n{request.read().decode()}\n")
|
|
45
|
+
|
|
46
|
+
hooks = {"request": [log_request]} if raw else None
|
|
47
|
+
return AsyncOpenAI(
|
|
48
|
+
api_key=API_KEY,
|
|
49
|
+
base_url=BASE_URL,
|
|
50
|
+
http_client=httpx.AsyncClient(event_hooks=hooks) if hooks else None,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
async def get_tools(mcp_client: Client) -> list[dict]:
|
|
55
|
+
"""MCP schemas -> OpenAI tool definitions. ``or ""`` because a null
|
|
56
|
+
description is rejected by some providers and many MCP tools omit it."""
|
|
57
|
+
return [
|
|
58
|
+
{
|
|
59
|
+
"type": "function",
|
|
60
|
+
"function": {"name": t.name, "description": t.description or "", "parameters": t.inputSchema},
|
|
61
|
+
}
|
|
62
|
+
for t in await mcp_client.list_tools()
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
async def send_request(lm, messages, model, tools):
|
|
67
|
+
"""Open a streaming completion.
|
|
68
|
+
|
|
69
|
+
``include_usage`` is what makes the last chunk carry token counts — and that
|
|
70
|
+
chunk has ``choices: []``, which is why the accumulator guards the index.
|
|
71
|
+
``parallel_tool_calls`` is not a sampling param and omitting it is NOT false,
|
|
72
|
+
so it is always sent. ``reasoning_effort`` XOR ``temperature``: reasoning
|
|
73
|
+
models reject temperature.
|
|
74
|
+
"""
|
|
75
|
+
return await lm.chat.completions.create(
|
|
76
|
+
model=model,
|
|
77
|
+
messages=messages,
|
|
78
|
+
tools=tools,
|
|
79
|
+
stream=True,
|
|
80
|
+
max_tokens=MAX_TOKENS,
|
|
81
|
+
stream_options={"include_usage": True},
|
|
82
|
+
temperature=0.6,
|
|
83
|
+
parallel_tool_calls=False,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
@dataclass
|
|
88
|
+
class StreamState:
|
|
89
|
+
"""What the stream has produced so far."""
|
|
90
|
+
|
|
91
|
+
thinking: list[str] = field(default_factory=list)
|
|
92
|
+
content: list[str] = field(default_factory=list)
|
|
93
|
+
tool_calls: dict[int, dict] = field(default_factory=dict) # by delta index
|
|
94
|
+
usage: dict | None = None
|
|
95
|
+
|
|
96
|
+
def reset(self) -> None:
|
|
97
|
+
self.thinking.clear()
|
|
98
|
+
self.content.clear()
|
|
99
|
+
self.tool_calls.clear()
|
|
100
|
+
self.usage = None
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def accumulate_chunk(chunk, state: StreamState) -> list[tuple[str, object]]:
|
|
104
|
+
"""Fold one chunk into ``state``; return the new tokens by kind.
|
|
105
|
+
|
|
106
|
+
Reasoning, content and tool calls are three INDEPENDENT checks — one chunk
|
|
107
|
+
can carry reasoning AND content (the transition boundary), and an if/else
|
|
108
|
+
between them silently drops one.
|
|
109
|
+
"""
|
|
110
|
+
if getattr(chunk, "usage", None) is not None:
|
|
111
|
+
state.usage = {
|
|
112
|
+
"prompt_tokens": chunk.usage.prompt_tokens,
|
|
113
|
+
"completion_tokens": chunk.usage.completion_tokens,
|
|
114
|
+
"total_tokens": chunk.usage.total_tokens,
|
|
115
|
+
}
|
|
116
|
+
if not chunk.choices:
|
|
117
|
+
return []
|
|
118
|
+
delta = chunk.choices[0].delta
|
|
119
|
+
tokens: list[tuple[str, object]] = []
|
|
120
|
+
|
|
121
|
+
reasoning = getattr(delta, "reasoning_content", None)
|
|
122
|
+
if reasoning:
|
|
123
|
+
state.thinking.append(reasoning)
|
|
124
|
+
tokens.append(("thinking", reasoning))
|
|
125
|
+
if delta.content:
|
|
126
|
+
state.content.append(delta.content)
|
|
127
|
+
tokens.append(("content", delta.content))
|
|
128
|
+
|
|
129
|
+
for call in delta.tool_calls or ():
|
|
130
|
+
# ``index`` is the only reliable accumulation key: it is on every delta,
|
|
131
|
+
# while id/type/name arrive exactly once, in the first one. Keying by id
|
|
132
|
+
# breaks parallel calls, and breaks on alibaba compatible-mode, which
|
|
133
|
+
# sends id:"" and name:"" on every continuation delta — `is not None`
|
|
134
|
+
# passes, the real values are overwritten, the tool name is gone. Hence
|
|
135
|
+
# truthiness below, not identity.
|
|
136
|
+
slot = state.tool_calls.setdefault(call.index, {"id": "", "function_name": "", "arguments": []})
|
|
137
|
+
if call.id:
|
|
138
|
+
slot["id"] = call.id
|
|
139
|
+
if call.function and call.function.name:
|
|
140
|
+
slot["function_name"] = call.function.name
|
|
141
|
+
tokens.append(("tool_call", (call.function.name, call.function.arguments or "")))
|
|
142
|
+
if call.function and call.function.arguments:
|
|
143
|
+
slot["arguments"].append(call.function.arguments)
|
|
144
|
+
if not any(kind == "tool_call" for kind, _ in tokens):
|
|
145
|
+
tokens.append(("tool_args", call.function.arguments))
|
|
146
|
+
return tokens
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def build_tool_calls(state: StreamState) -> list[dict]:
|
|
150
|
+
"""Deltas -> OpenAI ``tool_calls``, by index, argument JSON repaired.
|
|
151
|
+
|
|
152
|
+
The id is the LLM's and stays the LLM's — the only link between the assistant
|
|
153
|
+
message and its tool results. A provider that never sent one gets "" on both
|
|
154
|
+
sides, never a generated UUID. Repair happens here, before the string enters
|
|
155
|
+
history: a model that truncates its arguments would otherwise poison every
|
|
156
|
+
later request, since the assistant message is re-sent each turn.
|
|
157
|
+
"""
|
|
158
|
+
calls = []
|
|
159
|
+
for _, slot in sorted(state.tool_calls.items()):
|
|
160
|
+
arguments = "".join(slot["arguments"])
|
|
161
|
+
try:
|
|
162
|
+
json.loads(arguments)
|
|
163
|
+
except (json.JSONDecodeError, TypeError, ValueError):
|
|
164
|
+
arguments += "}" * (arguments.count("{") - arguments.count("}"))
|
|
165
|
+
arguments += "]" * (arguments.count("[") - arguments.count("]"))
|
|
166
|
+
try:
|
|
167
|
+
json.loads(arguments)
|
|
168
|
+
except (json.JSONDecodeError, TypeError, ValueError):
|
|
169
|
+
arguments = "{}"
|
|
170
|
+
calls.append(
|
|
171
|
+
dict(id=slot["id"], type="function",
|
|
172
|
+
function=dict(name=slot["function_name"], arguments=arguments))
|
|
173
|
+
)
|
|
174
|
+
return calls
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def deserialize_args(data):
|
|
178
|
+
"""Recursively decode JSON strings nested inside arguments — models
|
|
179
|
+
double-encode constantly, and handing a tool the string '{"a": 1}' where it
|
|
180
|
+
wanted an object is a spurious failure. Only strings starting { or [ are
|
|
181
|
+
attempted, so a bare "1" stays a string. This is the top-level parse too: a
|
|
182
|
+
well-formed call comes back a dict, anything else is malformed."""
|
|
183
|
+
if isinstance(data, str):
|
|
184
|
+
if data.startswith(("{", "[")):
|
|
185
|
+
try:
|
|
186
|
+
return deserialize_args(json.loads(data))
|
|
187
|
+
except (json.JSONDecodeError, TypeError, ValueError):
|
|
188
|
+
pass
|
|
189
|
+
return data
|
|
190
|
+
if isinstance(data, dict):
|
|
191
|
+
return {k: deserialize_args(v) for k, v in data.items()}
|
|
192
|
+
if isinstance(data, list):
|
|
193
|
+
return [deserialize_args(item) for item in data]
|
|
194
|
+
return data
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def mcp_to_llm(mcp_content) -> object:
|
|
198
|
+
"""MCP content blocks -> OpenAI tool-message content: a list only when there
|
|
199
|
+
is something a string cannot carry (an image), otherwise the plain text. The
|
|
200
|
+
obvious ``result.content[0].text`` dies on an empty result and on any
|
|
201
|
+
non-text block."""
|
|
202
|
+
if not mcp_content:
|
|
203
|
+
return ""
|
|
204
|
+
blocks = []
|
|
205
|
+
for item in mcp_content:
|
|
206
|
+
if isinstance(item, ImageContent):
|
|
207
|
+
blocks.append({"type": "image_url", "image_url": {"url": f"data:{item.mimeType};base64,{item.data}"}})
|
|
208
|
+
else:
|
|
209
|
+
blocks.append({"type": "text", "text": str(getattr(item, "text", item))})
|
|
210
|
+
if len(blocks) == 1 and blocks[0]["type"] == "text":
|
|
211
|
+
return blocks[0]["text"]
|
|
212
|
+
return blocks
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
async def execute_tool_calls(mcp_client, tool_call_inputs) -> list[dict]:
|
|
216
|
+
"""Run a batch. A tool that raises is a tool result, not an exception: the
|
|
217
|
+
model gets to see the error and recover, which it cannot do if the turn
|
|
218
|
+
dies."""
|
|
219
|
+
tool_results = []
|
|
220
|
+
for tool_call in tool_call_inputs:
|
|
221
|
+
name = tool_call["function"]["name"]
|
|
222
|
+
raw_args = tool_call["function"]["arguments"]
|
|
223
|
+
args = deserialize_args(raw_args)
|
|
224
|
+
if not isinstance(args, dict):
|
|
225
|
+
tool_call["function"]["arguments"] = "{}" # in place: history is re-sent
|
|
226
|
+
content = (f"Error: malformed arguments for '{name}': {raw_args!r}. "
|
|
227
|
+
"Retry with valid JSON matching the tool schema.")
|
|
228
|
+
else:
|
|
229
|
+
try:
|
|
230
|
+
# call_tool_mcp, not call_tool: the raw protocol result, with
|
|
231
|
+
# isError and every content block, and no raise on tool error.
|
|
232
|
+
result = await mcp_client.call_tool_mcp(name, args)
|
|
233
|
+
content = mcp_to_llm(result.content)
|
|
234
|
+
if result.isError:
|
|
235
|
+
content = f"Error: {content}"
|
|
236
|
+
except Exception as exc:
|
|
237
|
+
content = f"Error: {exc}"
|
|
238
|
+
tool_results.append(dict(role="tool", tool_call_id=tool_call["id"], content=content))
|
|
239
|
+
return tool_results
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
def add_response_to_messages(messages, state, tool_call_inputs, tool_results):
|
|
243
|
+
"""ONE assistant message, then one tool message per call, in that order.
|
|
244
|
+
|
|
245
|
+
Not a content message plus a separate tool_calls message: the tool_calls ride
|
|
246
|
+
on the assistant turn and the results must follow it immediately, each keyed
|
|
247
|
+
by an id from it. ``content`` is always present, possibly "" — an assistant
|
|
248
|
+
message with no content key is another thing providers reject.
|
|
249
|
+
"""
|
|
250
|
+
if not (state.content or state.thinking or tool_call_inputs):
|
|
251
|
+
return messages # an empty completion persists nothing
|
|
252
|
+
thinking = "".join(state.thinking)
|
|
253
|
+
msg = {"role": "assistant", "content": "".join(state.content)}
|
|
254
|
+
if thinking:
|
|
255
|
+
msg["reasoning_content"] = thinking
|
|
256
|
+
if tool_call_inputs:
|
|
257
|
+
msg["tool_calls"] = tool_call_inputs
|
|
258
|
+
messages.append(msg)
|
|
259
|
+
messages.extend(tool_results)
|
|
260
|
+
return messages
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
async def react_loop(messages, mcp_client, lm, model, tools, max_turns=50000):
|
|
264
|
+
"""Stream -> accumulate -> run tools -> append -> loop. Yields
|
|
265
|
+
``{"type", "token"}`` for whoever is rendering; ``messages`` is the caller's
|
|
266
|
+
and is mutated in place."""
|
|
267
|
+
state = StreamState()
|
|
268
|
+
for _ in range(max_turns):
|
|
269
|
+
response = await send_request(lm, messages, model, tools)
|
|
270
|
+
state.reset()
|
|
271
|
+
async for chunk in response:
|
|
272
|
+
for kind, token in accumulate_chunk(chunk, state):
|
|
273
|
+
yield {"type": kind, "token": token}
|
|
274
|
+
|
|
275
|
+
tool_call_inputs = build_tool_calls(state)
|
|
276
|
+
if not tool_call_inputs:
|
|
277
|
+
add_response_to_messages(messages, state, [], [])
|
|
278
|
+
yield {"type": "usage", "token": state.usage}
|
|
279
|
+
return
|
|
280
|
+
tool_results = await execute_tool_calls(mcp_client, tool_call_inputs)
|
|
281
|
+
add_response_to_messages(messages, state, tool_call_inputs, tool_results)
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
def make_renderer():
|
|
285
|
+
last = None
|
|
286
|
+
|
|
287
|
+
def render(chunk):
|
|
288
|
+
nonlocal last
|
|
289
|
+
kind, token = chunk["type"], chunk["token"]
|
|
290
|
+
if last == "tool_args" and kind != "tool_args":
|
|
291
|
+
print(")")
|
|
292
|
+
if kind in ("thinking", "content"):
|
|
293
|
+
if last != kind:
|
|
294
|
+
print(("\n" if last else "") + f"[{kind}] ", end="")
|
|
295
|
+
print(token, end="", flush=True)
|
|
296
|
+
elif kind == "tool_call":
|
|
297
|
+
print(f"\n[tool] {token[0]}({token[1]}", end="", flush=True)
|
|
298
|
+
elif kind == "tool_args":
|
|
299
|
+
print(token, end="", flush=True)
|
|
300
|
+
elif kind == "usage":
|
|
301
|
+
print(f"\n[usage] {token}")
|
|
302
|
+
last = kind
|
|
303
|
+
|
|
304
|
+
return render
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
async def run(raw: bool) -> list[dict]:
|
|
308
|
+
mcp_client = Client(MCP_CONFIG)
|
|
309
|
+
lm = configure_provider(raw)
|
|
310
|
+
render = make_renderer()
|
|
311
|
+
messages = [
|
|
312
|
+
dict(role="system", content="You are a helpful assistant named Crow."),
|
|
313
|
+
dict(role="user", content="search for machine learning papers with your search tool"),
|
|
314
|
+
]
|
|
315
|
+
async with mcp_client:
|
|
316
|
+
tools = await get_tools(mcp_client)
|
|
317
|
+
async for chunk in react_loop(messages, mcp_client, lm, MODEL, tools):
|
|
318
|
+
render(chunk)
|
|
319
|
+
return messages
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
if __name__ == "__main__":
|
|
323
|
+
asyncio.run(run("--raw" in sys.argv[1:]))
|