Repository navigation
0.9.0-preview.1
Pre-release
Pre-release
Two things changed since 0.8.0-preview.2. The SDK now follows upstream release tag v2.0.8
instead of v2.0.2: upstream renamed, moved, or removed many operations in between, and the SDK
keeps no compatibility layer, so the breaking changes come first, each with what to change. And
OpenCodeServer gained background-service discovery, opencode's third connection mode.
💥 Breaking changes
- The accepted snapshot moved to upstream release tag
v2.0.8
(7673ed6bd6547ee0dcb81aab55f1392fb751d652), which published as@opencode/cli@2.0.8; install
it withnpm install -g @opencode/cli@2.0.8. Operation identities lost theirv2.prefix
upstream (session.diff,event.subscribe); routes did not change for that reason. 130 of
the document's 136 operations are generated and two more are hand-written
WebSocket transports. The Restore patch that repairs upstream's lost SSE payload schemas
(anomalyco/opencode#44911) is still
required at this tag and applies unchanged. - Health became server info.
OpenCodeClient.GetHealthAsync,ServerClient.GetServerAsync,
HealthResponse,Health, andServerResponseare removed with upstream's/api/healthand
/api/server. Callclient.Server.GetInfoAsync()(GET /api/info) and read
ServerInfoResponse.ServerInfo:Version,Pid,Urls, andPaths.Tmp, the server's
temporary directory. There is noHealthymember; an info call that answers is the health
signal, and it throws like any other call when the server does not. Background-service discovery
probes the same door, and a registered daemon of an older 2.x release, which still serves
/api/status, is reported as present but incompatible. - Location targeting is directory-only.
LocationSelector.Workspaceand
SessionListRequest.Workspaceare removed: upstream dropped thelocation[workspace]query and
thex-opencode-workspaceheader. TheLocationa location-scoped response carries is now
LocationPublicRefwithDirectoryalone, andlocation.getanswersLocationPublicInfo;
LocationInfoandLocationInfoProjectare removed. Theclient.Workspacesfamily
(WorkspacesClient) is removed with upstream's workspace routes. - Operations upstream marked experimental moved to
client.Experimental, as flat methods that
take their ids explicitly:SessionClient.GetExportAsync→Experimental.GetSessionExportAsync(payload member
SessionExport),SessionsClient.PostImportAsync→Experimental.PostSessionImportAsync,
SessionsClient.GetStatsAsync→Experimental.GetSessionStatsAsync.SessionClient.PostSkillAsync/PostWaitAsync→Experimental.PostSessionSkillAsync/
PostSessionWaitAsync, and the three…InstructionsEntryAsyncmethods →
Experimental.ListSessionInstructionsEntryAsync,PutSessionInstructionsEntryAsync, and
RemoveSessionInstructionsEntryAsync.- The
McpServerClienthandle andMcpServersClient.GetMcpServerClientare removed; adding,
connecting, disconnecting, and removing a server areExperimental.AddMcpServerAsync,
ConnectMcpServerAsync,DisconnectMcpServerAsync, andRemoveMcpServerAsync.
McpServersClientkeeps the list and the resource catalog. client.Generation.GenerateTextAsync→Experimental.GenerateTextAsync;GenerationClient
is removed.
- Configuration preferences are gone upstream.
ConfigClient.GetPreferencesAsync,
PatchUpdatePreferencesAsync, and theConfigPreferences*andConfigWebSearchInfomodels are
removed with/api/config/preferences. Write throughExperimental.UpdateConfigAsync, whose
Shellis required and nullable: a string sets the shell,nullclears it, and there is no
"leave it unchanged" form any more. There is no configuration read at this pin: upstream
folded it intoconfig.get, which this SDK does not generate yet
(coverage).ConfigClientkeepsGetShellsAsync. - Session operations that changed shape.
RenameSessionAsyncandPutPermissionRulesAsync→
SessionClient.UpdateSessionAsync(Title,Permissions).PostInboxQueueAsyncand
PostInboxSteerAsync→UpdateInboxAsyncwith the delivery to switch to.GetFormStateAsync
is removed; the state isGetFormAsync(…).Form.Stateon the newFormDetail.
PostFormCancelAsync→DeleteFormCancelAsyncandPostRevertClearAsync→
DeleteRevertClearAsync(upstream changed the method). The fork boundary union
(ISessionForkRequestBoundary,SessionForkRequestBoundaryBefore,…Through) is removed; set
SessionForkPostRequest.Before.SessionInterruptPostRequest.Continue→Resume.
MessageListRequest,MessageListResponse, andMessageListRequestType→
SessionMessageListRequest,SessionMessageListResponse, andSessionMessageListRequestType. - Events.
session.permissions.updatedis nowsession.permissions:
SessionPermissionsUpdatedand itsDataandDurablecompanions →SessionPermissions,
SessionPermissionsData, andSessionPermissionsDurable.catalog.updated(CatalogUpdated)
is removed;provider.updatedandmodel.updatedarrive asProviderUpdatedandModelUpdated. - Worktrees name their project. Every worktree request requires
ProjectId, and the requests
no longer take aLocation;WorktreeCreateRequest.Strategyis removed. - Smaller renames and removals.
VcsClient.GetBranchesAsync→ListBranchesAsync
(VcsBranchListRequest/VcsBranchListResponse).FormsClient.ListRequestsAsync→
ListFormsAsync, and its payloadRequests→Forms.ProjectsClient.GetCurrentAsyncis
removed; the current project arrives onclient.Location.GetLocationAsync().
ShellClient.TimeoutShellAsyncis removed.SkillInfo.LocationandSlash→Path. An unknown
integration now throws the declared 404 instead of returning null. PluginsClient.AwaitPluginActivationAsyncis removed and has no replacement: the pin exposes
no HTTP activation barrier. When your code needs a particular plugin, provider, or model, wait
for that identity under your own cancellation deadline; an empty list does not prove absence.
✨ New features
- Background-service discovery.
OpenCodeServer.DiscoverAsyncopens opencode's third
connection mode: it finds the background service the opencode CLI registers for every client on
the machine, through the CLI's own rules — the registration file resolved by service channel
under the XDG state root (or named directly), the CLI's one-time copy of an older hashed
registration filename, a strict decode of the registration, and an authenticated/api/info
probe under a two-second bound whose pid must match. A ready daemon comes back as a
non-owningOpenCodeServer: the newOwnsProcessmember is false,DisposeAsyncis a
no-op, andCreateClient()binds a client to the daemon exactly as it does to a started server.
Everything unusable — no registration, an undecodable or passwordless one, a daemon still
starting or failed, a probe timeout, a version other than the expected one — is a null answer,
never a half-usable handle.OpenCodeServerDiscoverOptionscarriesChannel,
RegistrationFilePath,ExpectedVersion, andInstalledVersion, validated at the call. This is
the one SDK door that reads the environment, and it reads exactlyXDG_STATE_HOME,
XDG_CONFIG_HOME,OPENCODE_CONFIG_DIR, and the user profile (USERPROFILEfirst on Windows,
HOMEelsewhere) — never a credential. The behaviour is the pinned CLI's, source-watched at the
accepted commit (ADR-0025); live tests prove it against the pin's ownserve --servicedaemon on
every target-framework leg, from an isolated process whose environment the test owns. Ensuring and
stopping the service follow as their own slices. - Turn diffs.
SessionClient.GetDiffAsyncbindssession.diff: the structured per-file diffs of the files one turn changed, where a turn runs from the first
prompt after the session was last idle to its next idle marker.SessionDiffRequestcarries the
optionalFromandTouser-message anchors and theContextline count, and
SessionDiffResponse.Diffsis the sameFileDiffInfolist the VCS diff returns. A live test
proves the declared 200, 400, and 404 arms against the pinned server. - The idle turn marker is a typed message.
SessionMessageIdlejoins the message union with
itsOutcome(Succeeded,Failed, orInterrupted). The server writes one at the end of
every turn; on0.8.0-preview.2those entries surfaced asUnknownSessionMessageInfo. - Reloading every loaded location.
client.ReloadLocationsAsync()bindslocation.reload:
the server shuts down and rebuilds every loaded location, cancels
pending permissions and forms, lets running sessions continue with fresh services at their next
step boundary, and answers once every replacement build settles. The newlocation.shutdown
event (LocationShutdown) arrives on the event stream for each location it tears down, so a
consumer can revalidate its reads. The declaredServiceUnavailableErroris its one typed
failure. - Smaller additions.
SessionStepStartedData.Startedcarries the step's
request dispatch time, before the provider answers, and everyForm*Fieldhas an optional
Hiddenthat skips the interactive prompt when a default exists.
🔧 Changes
- The version line is
0.9.0. Discovery is the M4 milestone's background-service boundary;
nightlies are0.9.0-nightly.*. OpenCodeServerExceptionnow covers every local-server door. Discovery throws it for one
cause only — an XDG variable unset with no user home to fall back to — beside the launcher's
start, readiness, and stop failures. The class summary and the errors guide say so.OpenCodeServeris the home of every local-server handle (ADR-0024): its summary no longer
promises that it never attaches to another server, because a discovered handle is exactly that,
with its ownership visible throughOwnsProcess.- The published opencode build is tested now, not only the pinned source. The live-test fixture
takes a new optionalOPENCODE_SDK_TESTS_SERVER_COMMAND(|-separated, e.g.opencode|serve):
it replaces the command the fixture starts and changes nothing else, so the whole suite can be
pointed at any build of the same server — the executable is resolved fromPATHby the SDK's own
launcher. The new Consumer leg workflow — on demand and
weekly, Linux and Windows — uses it to run that suite against
npm install -g @opencode/cliat the versionspec/SNAPSHOT.mdpins, after
asserting the version the installed command reports.
Full changelog: https://github.com/Blind-Striker/opencode-sdk-dotnet/blob/master/CHANGELOG.md