Skip to content

feat(client): accept extra_params on initialize_session and load_session - #26

Open
scott82anderson wants to merge 1 commit into
Factory-AI:mainfrom
scott82anderson:fix/extra-params-escape-hatch
Open

scott82anderson wants to merge 1 commit into
Factory-AI:mainfrom
scott82anderson:fix/extra-params-escape-hatch

Conversation

@scott82anderson

Copy link
Copy Markdown

Closes #14

DroidClient.initialize_session and load_session now accept
extra_params: Mapping[str, Any] | None. Entries are merged into the
serialized request after the modelled fields, keyed by wire name, and
sent exactly as written. A key that matches any modelled field raises
ValueError before anything is sent, even if that field was left
unset. The check covers fields the SDK always sets, such as
sessionOriginHint. Modelled fields therefore always go through their
typed argument and its validation, and extra_params can only add
fields 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_session and load_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 --check
flags src/droid_sdk/_high_level/output.py, which this PR does not
touch; it is flagged on main as well.

🤖 Generated with Claude Code

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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

initialize_session cannot pass params the SDK does not model

1 participant