Releases: ylvict/NOpenCode
Release list
v0.3.2
v0.3.2
🔧 Maintenance
- Removed dead code:
NOpenCodeHttpClient.ReadSse()was unused — all SSE reading now goes throughGetStream()+SseReader - Cleaned up
ActiveServersstale entries: whenTryReuseExistingfinds a previously registered server that is no longer healthy, the stale entry is now removed from the static dictionary - Unified dependency versions:
Microsoft.Extensions.Hosting.Abstractionsbumped from8.0.1to10.0.8to match the rest of the dependency set - Removed unused import:
System.Collections.GenericfromNOpenCodeHttpClient.cs
v0.3.1
v0.3.1
🔧 Bug Fixes & Quality Improvements
Linux/Unix CLI Discovery (ServerManager.cs)
FindCliViaWhere()renamed toFindCliViaWhich(): useswhichon Linux/macOS andwhereon Windows. Fixes a latent bug where Linux systems fell back toCanRunDirectly()unnecessarily.
Logging Wired Up
ServerOptions.Logproperty added, populated fromNOpenCodeBuilder.LogCallback- All previously empty
catch { }blocks inServerManagernow log the exception via the callback:FindNpmGlobalCli,FindCliViaWhich,CanRunDirectly,IsHealthy,DisposeAsync(instance dispose + kill),CleanupDataDir
ServerManager.Start()logs "Reusing existing..." / "Starting opencode serve..."
DI Deadlock Fix (ServiceCollectionExtensions.cs)
AddNOpenCode()now wrapsbuilder.Launch()inTask.Run(...)to avoid ASP.NET Core sync context deadlock with.GetAwaiter().GetResult()
WithAutoServer() Documentation
- Added XML doc explaining this is the default behavior; method exists for explicitness in builder chains
v0.3.0
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": truein the request body toPOST /session/{id}/message - Reads SSE events via
SseReaderfrom a response stream (ResponseHeadersRead) event: chunk— each text part is deserialized and passed toonChunkin real timeevent: complete— the finalOpenCodeReplyis deserialized and passed toonCompleteevent: error— throwsNOpenCodeException- 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
Partmodel now includes[JsonPropertyName("uri")]property for file reference serializationBuildMessageDict()generatestype: "file"parts whenMessageOptions.Filesis specifiedAskOperation.WithFiles()correctly forwards attachments to the session'sAskcall viaMessageOptions
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 withHttpCompletionOption.ResponseHeadersReadfor streaming responseOpenCodeSession.BuildMessageDict()— restructured to support file parts and"stream": trueInternalsVisibleToadded forNOpenCode.Teststo enable testing of internal types (SseReader,NOpenCodeHttpClient)- Added
using System.IO/using System.Text.JsontoOpenCodeSession.cs
v0.2.2
What's Changed
- Bump Microsoft.Bcl.AsyncInterfaces and 2 others by @dependabot[bot] in #11
- Bump Microsoft.NET.Test.Sdk from 17.14.1 to 18.6.0 by @dependabot[bot] in #10
- Bump Microsoft.Bcl.AsyncInterfaces and 3 others by @dependabot[bot] in #9
- Bump Microsoft.Extensions.Hosting from 8.0.1 to 10.0.8 by @dependabot[bot] in #8
- Bump coverlet.collector from 6.0.4 to 10.0.1 by @dependabot[bot] in #5
- chore(deps): bump github/codeql-action from 3 to 4 by @dependabot[bot] in #4
- chore(deps): bump actions/setup-dotnet from 4 to 5 by @dependabot[bot] in #3
- chore(deps): bump actions/checkout from 4 to 6 by @dependabot[bot] in #2
- chore(deps): bump actions/setup-node from 4 to 6 by @dependabot[bot] in #1
New Contributors
- @dependabot[bot] made their first contribution in #11
Full Changelog: v0.2.1...v0.2.2
v0.2.1
Changes
NOpenCodeBuilder.AnyFreeSelectoris now public — consumers and tests filteringOpenCodeClient.Modelscan reuse the same predicate the SDK uses internally forWithAnyFreeModel()and the defaultLaunch()selection. The-freesuffix that defines "free tier" now lives in exactly one place.- Integration tests no longer hardcode provider ids or model suffixes — replaced
"opencode"withProviders.OpenCodeand the inlinem.Id.EndsWith("-free")withNOpenCodeBuilder.AnyFreeSelector, so the tests stay in sync with the SDK. - Removed
<NoWarn>CS0618</NoWarn>from integration test csproj — the test project no longer calls any obsolete API; allWithModel(string)usages have been migrated to the newWithModel(selector)overload.
v0.2.0 — Resilient model selection & new Providers API
Highlights
- Resilient model selection by default.
OpenCode.Configure().Launch()now auto-picks a free-tier model from the opencode provider at launch time, so your code no longer breaks when upstream renames or versions a model. - Capability-based model selection. Pick models by predicate (
WithModel(selector)) or by free tier (WithAnyFreeModel(provider)) instead of hardcoding a stringly-typed model id. - New
Providersconstants class with 20 well-known upstream provider ids (Providers.OpenCode,Providers.Anthropic,Providers.OpenAI, ...), giving you IntelliSense and compile-time typo protection.
Breaking Changes for users upgrading from 0.1.x
WithModel(string) is now [Obsolete]
.WithModel("opencode/deepseek-v4-flash-free") // CS0618 warningThe overload is kept for backward compatibility but emits a compile-time warning. Migration: drop the call entirely (the new default is already resilient), or switch to a capability-based overload:
.Launch() // uses the default free-model selection
// or
.WithAnyFreeModel() // explicit free-tier, default provider
.WithAnyFreeModel(Providers.Anthropic) // explicit free-tier, custom provider
.WithModel(m => m.Id.EndsWith("-free")) // custom predicateDefault model at Launch() changed
If you previously called OpenCode.Configure().Launch() without specifying a model, the opencode server's default was used. As of 0.2.0 the SDK auto-picks the first free-tier model from the opencode provider. To restore the previous behaviour, pin a model explicitly with WithModel(...).
New Features
WithModel(Func<ModelInfo, bool> selector, string provider = Providers.OpenCode)— pick the first model from a provider that matches a caller-supplied predicate. Resolution happens atLaunch()time viaOpenCodeClient.Models.List().WithAnyFreeModel(string provider = Providers.OpenCode)— convenience that resolves to the first model whose id ends with-free. Use it when you want to switch the free-model default to a non-opencode provider.Providersconstants class —OpenCode,Anthropic,OpenAI,GitHubCopilot,GoogleVertex,AmazonBedrock,Azure,DeepSeek,Groq,OpenRouter,Ollama,LMStudio,Cerebras,Minimax,MoonshotAI,NVIDIA,HuggingFace,Helicone,VercelGateway,XAI. For providers not listed, pass the raw id as a string — the server is the source of truth and you can discover all currently connected providers viaOpenCodeClient.Providers.List().
Bug Fixes
- CI:
dotnet testinci.ymlis now scoped to the unit-test project, so PR builds no longer fail on opencode-dependent integration tests. Integration tests run on a daily schedule and viaworkflow_dispatch. - Integration tests: opencode server is now started in the same step as the test run, so it survives the GitHub Actions step boundary that was killing it mid-test.
Models.List: removed a no-op ternary (provider != null ? "/config/providers" : "/config/providers") with identical branches and a meaningless$interpolation.- Release workflow:
gh release createnow hascontents: writeso the GitHub release step no longer 403s.
Tooling & CI
- New scheduled integration tests (daily) for NuGet package + free-model availability — surfaces upstream model churn before users do.
- Added Dependabot, CodeQL,
.editorconfig,.gitattributes.
Documentation
- READMEs (EN + ZH) updated to drop hardcoded model ids and use
Providers.OpenCode. - Fixed a pre-existing duplicate
### 多轮对话section inREADME.zh.md.
Full diff: v0.1.3...v0.2.0
v0.1.3 — Initial Release
NOpenCode is a .NET SDK that brings OpenCode's AI engine into your application services. Express your intent in natural language — NOpenCode bridges your application logic with AI.
Features
- Zero setup — auto-discovers or starts \opencode serve\ for you
- Natural language API — plain-English interface for AI interactions
- Multi-turn sessions — context-aware follow-up conversations
- Streaming — receive AI responses chunk by chunk in real time
- File & code search — ripgrep, filename lookup, symbol search
- Session lifecycle — create, fork, share, diff, revert, summarize
- Provider & model discovery — query available models, providers, agents
- MCP server management — dynamically add and list MCP servers
- Event monitoring — subscribe to SSE event streams
- DI integration — \AddNOpenCode()\ for ASP.NET Core / console hosts
- .NET Standard 2.0 — compatible with .NET Framework 4.6.1+ and all modern .NET
Getting Started
dotnet add package NOpenCodeusing NOpenCode;
string answer = await OpenCode.Ask("What's the capital of France?");
Console.WriteLine(answer);What's Changed in v0.1.3
✨ New
- Initial NuGet publish (v0.1.0 → v0.1.3)
- Full SDK with all clients and models
- 10 example projects demonstrating every API feature
- Examples CI workflow — builds and runs all examples on every commit
📦 Packaging
- NuGet package includes README.md (no more missing readme warning)
- Added NuGet search tags for SEO: opencode, ai, sdk, llm, chat, copilot, assistant, dotnet, csharp
🐛 Bug Fixes
- Token usage display — tokens now correctly read from \info.tokens\ in API response
- Find API — handles new response format where \path, \lines, and \match\ are objects with \ ext\ field
- MCP API — uses new \ ype\ + \command\ array format
- Model API — \Provider.Models\ is a dictionary ({ [key: string]: Model }), not a list
📝 Documentation
- Added Chinese README (README.zh.md) with cross-language links
- Emoji badges on all section headers for visual clarity
- Added CI, Examples, and NuGet version badges to README
- Simplified and repositioned SDK description
- All examples updated to use lightweight prompts for fast execution