Repository navigation
feat(client): accept extra_params on initialize_session and load_session - #26
Open
scott82anderson wants to merge 1 commit into
Open
scott82anderson wants to merge 1 commit into
scott82anderson wants to merge 1 commit into
Conversation
Add an extra_params escape hatch so callers can send JSON-RPC fields the SDK does not yet model. Keys that match any modelled field raise ValueError before anything is sent. Closes Factory-AI#14 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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 #14
DroidClient.initialize_sessionandload_sessionnow acceptextra_params: Mapping[str, Any] | None. Entries are merged into theserialized request after the modelled fields, keyed by wire name, and
sent exactly as written. A key that matches any modelled field raises
ValueErrorbefore anything is sent, even if that field was leftunset. The check covers fields the SDK always sets, such as
sessionOriginHint. Modelled fields therefore always go through theirtyped argument and its validation, and
extra_paramscan only addfields the SDK does not know about.
This is the supported path for protocol fields newer than the installed
SDK, per the issue's third ask; both docstrings say so.
Scope deliberately limited to
initialize_sessionandload_session.The same helper can be applied to other wrapped methods on request.
Tests:
tests/test_client_protocol_surface.py::TestExtraParams(7 cases).Gates: ruff check, mypy, pyright, pytest clean.
ruff format --checkflags
src/droid_sdk/_high_level/output.py, which this PR does nottouch; it is flagged on
mainas well.🤖 Generated with Claude Code