Skip to content

v0.2.1#23

Merged
x2d7 merged 22 commits intomainfrom
dev
Feb 19, 2026
Merged

v0.2.1#23
x2d7 merged 22 commits intomainfrom
dev

Conversation

@x2d7
Copy link
Copy Markdown
Owner

@x2d7 x2d7 commented Feb 19, 2026

Summary

Merges three improvements from dev: context cancellation hardening in the streaming layer, primitive type support in tool input unmarshaling, and partial tool call assembly in Session.


Changes

#18 — Context cancellation in Stream.Next()

Stream.Next() now accepts a context.Context and respects cancellation mid-stream. Empty chunks from the OpenAI streaming response are handled gracefully instead of causing parse errors.

#21 — Primitive type support in tool input unmarshaling

NewTool previously constructed the correct inputType via ensureInputStructType[T]() but always unmarshaled into T directly — causing failures for primitive types (string, int, bool, float64). The execution wrapper now uses reflection to construct the appropriate container, so primitives are handled correctly alongside structs.

#22 — Partial tool call assembly in Session

Providers that stream tool calls in chunks (first event carries CallID, subsequent events carry argument fragments) caused broken, incomplete JSON to be delivered to callers. Session now assembles partial chunks into complete EventNewToolCall events before forwarding them. Events are dispatched as soon as a call is fully assembled — not batched until end of generation — keeping with interlude's streaming-first design.

Also includes a refactor of Session internals: state moved into a dedicated sessionState struct, flush and completion-end logic extracted into methods, and send helper unified across the handler.


Tests

  • Context cancellation for Stream.Next() and Session at various lifecycle points
  • End-to-end Execute() coverage for primitive and struct tool inputs
  • Partial tool call assembly: single call, multiple interleaved calls, large content
  • Interleaved token and tool call event ordering

x2d7 added 22 commits February 19, 2026 10:53
Updates Next() to accept context.Context for improved streaming control.
- Update test calls with context.Background()
- Remove deprecated empty event error handling tests
Client.Next cancellation via context + empty events fix
tools execution wrapper unmarshal fix
@x2d7 x2d7 merged commit 856f693 into main Feb 19, 2026
1 check passed
@x2d7 x2d7 changed the title Dev v0.2.1 Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant