Skip to content

v0.3.0

Choose a tag to compare

@github-actions github-actions released this 11 Jun 02:16
· 15 commits to master since this release

v0.3.0

🚀 New Features

True SSE Streaming for AskStream

OpenCodeSession.AskStream() and AskOperation.AskStream() now perform real SSE streaming instead of buffering the entire response.

  • Sends "stream": true in the request body to POST /session/{id}/message
  • Reads SSE events via SseReader from a response stream (ResponseHeadersRead)
  • event: chunk — each text part is deserialized and passed to onChunk in real time
  • event: complete — the final OpenCodeReply is deserialized and passed to onComplete
  • event: error — throws NOpenCodeException
  • New NOpenCodeHttpClient.PostStream() method added for POST with streaming response

CancellationToken Support

AskOperation.Execute() and AskOperation.ExecuteFull() now accept CancellationToken ct = default, propagated through session creation and message sending. Fully backward compatible.

File Attachments

  • Part model now includes [JsonPropertyName("uri")] property for file reference serialization
  • BuildMessageDict() generates type: "file" parts when MessageOptions.Files is specified
  • AskOperation.WithFiles() correctly forwards attachments to the session's Ask call via MessageOptions

McpClient Enhancements

  • Remove(string name, CancellationToken ct) → DELETE /mcp/{name}
  • Update(string name, object config, CancellationToken ct) → PATCH /mcp/{name}

Type-Safe ConfigClient.Update

  • Added Update(NOpenCodeConfig config, CancellationToken ct) overload with strong typing
  • The original Update(object patch, CancellationToken) overload remains for backward compatibility

🧪 Testing (24 new tests)

  • StreamingTests.cs (new) — 7 tests covering SseReader: chunk, complete, error, comment lines, multiple events, default type, empty stream
  • NewApiTests.cs (new) — 10 reflection-based API signature tests: CancellationToken overloads, WithFiles chaining, McpClient Remove/Update, ConfigClient typed overload, Part.Uri, MessageOptions.Files
  • ModelTests.cs (updated) — 3 tests for Part.Uri default value and property setter

🔧 Internal Improvements

  • NOpenCodeHttpClient.PostStream() — POST with HttpCompletionOption.ResponseHeadersRead for streaming response
  • OpenCodeSession.BuildMessageDict() — restructured to support file parts and "stream": true
  • InternalsVisibleTo added for NOpenCode.Tests to enable testing of internal types (SseReader, NOpenCodeHttpClient)
  • Added using System.IO / using System.Text.Json to OpenCodeSession.cs