Cowork A: SSE v2 tool events, artifacts table + API #60
Reference in New Issue
Block a user
Delete Branch "feat/cowork-stream"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Task A from
docs/cowork-ui-plan.md.What
stream-query:tool_start {run_id, tool, label, input}andtool_end {run_id, tool, label, status, ms, artifact}.on_tool_errormaps tostatus:"error". Payload shaping lives in pure functions inblueprints/conversation/tool_events.py. Additive, so old clients keep working.blueprints/conversation/tool_labels.py: every tool (both old and #55 YNAB names), prefix matches forhomebox_/bookstack_, and the fallbackUsing <tool>….blueprints/artifacts/(model, logic, routes).on_tool_endwhen a tool returns acontent_and_artifactdict with akind, and linked to the saved tool message.data.GET /api/artifacts?conversation_id=andGET /api/artifacts/<id>, owner-scoped. Malformed ids are validated before querying (400/404, not a 500 from asyncpg).tool,label,artifact;textis still the header line.17_…_add_artifacts.py(aerich-generated, creates a table only, blue/green-safe).Notes
tool_endis now sent after the tool message and artifact are saved, so it can carry the artifact ref.artifactis alwaysnull.Test plan
pytest tests/ -q: 153 passed (newtest_tool_events.py,test_artifacts.pyincl. a full fake-agent stream with parallel tools, the error path, the cap and owner scoping)make logsshows the artifacts migration applied; a tool-using question streams with labels🤖 Generated with Claude Code