Skip to content

0.8.0-preview.2

Pre-release
Pre-release

Choose a tag to compare

@Blind-Striker Blind-Striker released this 12 Sep 16:28

The second preview of the unofficial OpenCode .NET SDK, built against upstream release tag v2.0.2 (@opencode/cli@2.0.2).

dotnet add package OpenCodeAI.Sdk --prerelease
dotnet add package OpenCodeAI.Sdk.Extensions --prerelease   # dependency injection, optional

The package id is not the namespace. You install OpenCodeAI.Sdk and you write using OpenCode.Sdk; — nuget.org reserves the OpenCode. id prefix for an unrelated owner, so the artifact carries a different name than the code inside it.

What changed since 0.8.0-preview.1

  • The pin moved to upstream release tag v2.0.2. The SDK now targets the OpenCode 2.x server as published on the @opencode/cli release channel; install it with npm install -g @opencode/cli@2.0.2. OpenCode 1.x servers are not supported. The old @opencode-ai/cli scope is frozen and no longer reaches a server this SDK can drive.
  • Coverage is 138 of 143 operations across 29 client families. New: OpenCodeClient.Config (preferences read and patch, host shell catalog) and SessionClient.PutPermissionRulesAsync; sessions carry their permission ruleset and the durable session.permissions.updated event. Removed upstream: v2.session.messageUpdate.
  • Request properties that the server accepts as absent, null, or a value are now Optional<T>. default leaves the member out, = null or Optional<T>.Null writes an explicit null, a value writes the value. This is what makes clearing a preference ({"shell":null}) expressible; object initializers such as Title = "x" are unchanged. 39 properties across 21 operations changed type, one of them the shared ToolFileContent.Name, which is read through .Value on the response side. See the new Requests guide.
  • The launcher defaults to opencode serve and resolves the command the way a shell does, PATHEXT included, so an npm-installed CLI's .cmd shim starts on Windows. A 1.x install on PATH fails fast with its usage text.
  • Cursor lists generalize. Every cursor-carrying list derives from ListRequest; EnumerateSessionsAsync joins EnumerateMessagesAsync, both returning CursorSequence<TPage, TItem> (an IAsyncEnumerable<TItem> with .Pages), and continuation carries the first page's filters.
  • Union interfaces carry what every member shares. A member every arm of a union declares in the same shape is hoisted onto the union interface (nullable there, because the unknown carrier holds none), and records promoted for one identical shape share a carrier interface such as IDurableEnvelope.
  • SubmitAsync(string) on both terminal families sends a line plus the carriage return a terminal's Enter key sends.
  • A 401 on a client built without a password says why: an opencode serve process always runs with a password. The docs no longer claim an anonymous server exists.
  • Durable replay is documented honestly: the distributed CLI starts its server without event persistence and exposes no switch for it, so a replay from such a server is the log.synced marker alone; a live test is the reversal trigger.

Targets netstandard2.0, net472, net8.0, net9.0, net10.0; both packages declare IsAotCompatible on net10.0.

Verification

5,612 tests green on Windows (the fullest leg, with net472), Linux and macOS; the Windows consumer leg ran against the npm-distributed @opencode/cli@2.0.2 build with isolated roots (1,184 of 1,185 live tests, the one failure being a proof that needs the owned pinned server).

Full details in CHANGELOG.md.