fix(pkg-py): accumulate streaming HTMLDependency objects and simplify bookmark restore#193
Draft
fix(pkg-py): accumulate streaming HTMLDependency objects and simplify bookmark restore#193
Conversation
…sages() Drop the dual content_client/content_server split and the deprecated transform_user/transform_assistant parameters from messages(). StoredMessage has a single content field plus html_deps. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The streaming path sent deps to the client during individual chunks but didn't accumulate them on the stored message. This meant bookmark save found no deps to serialize. Now deps are collected across chunks and attached to the stored message at stream end. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Drop the separate --deps save and render_deps hack. Messages now carry their own deps, and the restore path passes pre-serialized deps directly to the client. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #192
Summary
render_depsaction and separate--depsbookmark key were a stopgap that didn't cover streamed messages.TransformedMessagewithStoredMessage— drops the dualcontent_client/content_serversplit and the deprecatedtransform_user/transform_assistantparameters frommessages(). Singlecontentfield plushtml_deps.html_depsinChatMessageDict—messages()now returns serialized deps alongside each message, so bookmark save gets everything in one place._current_stream_depscollector gathers deps across chunks and attaches them to the stored message at stream end.--depskey orrender_depshack. The restore path passes pre-serialized deps directly to the client viahtml_deps_serializedon_send_append_message.Why Python-only
The R package doesn't have this issue — it re-renders from the ellmer client's restored turns on bookmark restore (
contents_shinychat()→as.tags()→processDeps()), so HTMLDependencies are regenerated from scratch. Python saves/restores rendered message strings, so deps must be explicitly tracked.Test plan
bookmark_html_deps— non-streaming HTMLDep bookmark restore (existing test, re-added after revert)bookmark_html_deps_stream— streaming HTMLDep bookmark restore (new test)transform/transform_assistant/transform_assistant_stream— transform decorators still workuv run pytest pkg-py/tests/ -x(61 tests pass)🤖 Generated with Claude Code