Skip to content

0.9.0-preview.1

Pre-release
Pre-release

Choose a tag to compare

@Blind-Striker Blind-Striker released this 18 Sep 15:37

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 with npm install -g @opencode/cli@2.0.8. Operation identities lost their v2. 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, and ServerResponse are removed with upstream's /api/health and
    /api/server. Call client.Server.GetInfoAsync() (GET /api/info) and read
    ServerInfoResponse.ServerInfo: Version, Pid, Urls, and Paths.Tmp, the server's
    temporary directory. There is no Healthy member; 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.Workspace and
    SessionListRequest.Workspace are removed: upstream dropped the location[workspace] query and
    the x-opencode-workspace header. The Location a location-scoped response carries is now
    LocationPublicRef with Directory alone, and location.get answers LocationPublicInfo;
    LocationInfo and LocationInfoProject are removed. The client.Workspaces family
    (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 …InstructionsEntryAsync methods →
      Experimental.ListSessionInstructionsEntryAsync, PutSessionInstructionsEntryAsync, and
      RemoveSessionInstructionsEntryAsync.
    • The McpServerClient handle and McpServersClient.GetMcpServerClient are removed; adding,
      connecting, disconnecting, and removing a server are Experimental.AddMcpServerAsync,
      ConnectMcpServerAsync, DisconnectMcpServerAsync, and RemoveMcpServerAsync.
      McpServersClient keeps the list and the resource catalog.
    • client.Generation.GenerateTextAsync → Experimental.GenerateTextAsync; GenerationClient
      is removed.
  • Configuration preferences are gone upstream. ConfigClient.GetPreferencesAsync,
    PatchUpdatePreferencesAsync, and the ConfigPreferences* and ConfigWebSearchInfo models are
    removed with /api/config/preferences. Write through Experimental.UpdateConfigAsync, whose
    Shell is required and nullable: a string sets the shell, null clears it, and there is no
    "leave it unchanged" form any more. There is no configuration read at this pin: upstream
    folded it into config.get, which this SDK does not generate yet
    (coverage). ConfigClient keeps GetShellsAsync.
  • Session operations that changed shape. RenameSessionAsync and PutPermissionRulesAsync →
    SessionClient.UpdateSessionAsync (Title, Permissions). PostInboxQueueAsync and
    PostInboxSteerAsync → UpdateInboxAsync with the delivery to switch to. GetFormStateAsync
    is removed; the state is GetFormAsync(…).Form.State on the new FormDetail.
    PostFormCancelAsync → DeleteFormCancelAsync and PostRevertClearAsync →
    DeleteRevertClearAsync (upstream changed the method). The fork boundary union
    (ISessionForkRequestBoundary, SessionForkRequestBoundaryBefore, …Through) is removed; set
    SessionForkPostRequest.Before. SessionInterruptPostRequest.Continue → Resume.
    MessageListRequest, MessageListResponse, and MessageListRequestType →
    SessionMessageListRequest, SessionMessageListResponse, and SessionMessageListRequestType.
  • Events. session.permissions.updated is now session.permissions:
    SessionPermissionsUpdated and its Data and Durable companions → SessionPermissions,
    SessionPermissionsData, and SessionPermissionsDurable. catalog.updated (CatalogUpdated)
    is removed; provider.updated and model.updated arrive as ProviderUpdated and ModelUpdated.
  • Worktrees name their project. Every worktree request requires ProjectId, and the requests
    no longer take a Location; WorktreeCreateRequest.Strategy is removed.
  • Smaller renames and removals. VcsClient.GetBranchesAsync → ListBranchesAsync
    (VcsBranchListRequest / VcsBranchListResponse). FormsClient.ListRequestsAsync →
    ListFormsAsync, and its payload Requests → Forms. ProjectsClient.GetCurrentAsync is
    removed; the current project arrives on client.Location.GetLocationAsync().
    ShellClient.TimeoutShellAsync is removed. SkillInfo.Location and Slash → Path. An unknown
    integration now throws the declared 404 instead of returning null.
  • PluginsClient.AwaitPluginActivationAsync is 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.DiscoverAsync opens 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-owning OpenCodeServer: the new OwnsProcess member is false, DisposeAsync is a
    no-op, and CreateClient() 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. OpenCodeServerDiscoverOptions carries Channel,
    RegistrationFilePath, ExpectedVersion, and InstalledVersion, validated at the call. This is
    the one SDK door that reads the environment, and it reads exactly XDG_STATE_HOME,
    XDG_CONFIG_HOME, OPENCODE_CONFIG_DIR, and the user profile (USERPROFILE first on Windows,
    HOME elsewhere) — 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 own serve --service daemon 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.GetDiffAsync binds session.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. SessionDiffRequest carries the
    optional From and To user-message anchors and the Context line count, and
    SessionDiffResponse.Diffs is the same FileDiffInfo list 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. SessionMessageIdle joins the message union with
    its Outcome (Succeeded, Failed, or Interrupted). The server writes one at the end of
    every turn; on 0.8.0-preview.2 those entries surfaced as UnknownSessionMessageInfo.
  • Reloading every loaded location. client.ReloadLocationsAsync() binds location.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 new location.shutdown
    event (LocationShutdown) arrives on the event stream for each location it tears down, so a
    consumer can revalidate its reads. The declared ServiceUnavailableError is its one typed
    failure.
  • Smaller additions. SessionStepStartedData.Started carries the step's
    request dispatch time, before the provider answers, and every Form*Field has an optional
    Hidden that 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 are 0.9.0-nightly.*.
  • OpenCodeServerException now 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.
  • OpenCodeServer is 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 through OwnsProcess.
  • The published opencode build is tested now, not only the pinned source. The live-test fixture
    takes a new optional OPENCODE_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 from PATH by 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/cli at the version spec/SNAPSHOT.md pins, after
    asserting the version the installed command reports.

Full changelog: https://github.com/Blind-Striker/opencode-sdk-dotnet/blob/master/CHANGELOG.md