You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wire per-version validation into ClientSession; fix elicit schema generation
ClientSession now uses parse_server_request/notification for inbound
dispatch (KeyError -> METHOD_NOT_FOUND), validates callback results
against the surface schema before sending (ValidationError ->
INTERNAL_ERROR), and gates server results through validate_server_result
before parsing. Adds a protocol_version property.
Surface codegen: SCHEMA_PATCHES targets ["integer", "number"] instead
of bare "number" so generated types use int | float (pydantic
smart-union preserves int through the sieve; previously coerced 37 ->
37.0). Regenerated both packages.
elicitation.py: Optional[T] fields now emit {"type": ...} with the
field omitted from required (was non-spec anyOf). Gate tightened to
reject list[...] and multi-primitive unions; only T or T | None
accepted. The interaction-suite divergence for nested requestedSchema is
flipped (client now rejects with INVALID_PARAMS).
Documented the elicit gate change in migration.md.
Positional calls (`await ctx.info("hello")`) are unaffected.
537
537
538
+
### `Context.elicit()` schema gate tightened
539
+
540
+
`Context.elicit()` (and `elicit_with_validation()`) now accept only schemas whose fields are a single primitive type (`str`, `int`, `float`, `bool`) or `Optional[primitive]`. `list[...]` fields and unions of multiple primitives (e.g. `int | str`) raise `TypeError` at the call site; previously `list[str]` and arbitrary primitive unions were allowed but produced a `requestedSchema` outside the spec's restricted subset. `Optional[T]` fields now render as `{"type": ...}` with the field omitted from `required` instead of the non-spec `anyOf` shape.
541
+
538
542
### Replace `RootModel` by union types with `TypeAdapter` validation
539
543
540
544
The following union types are no longer `RootModel` subclasses:
0 commit comments