opencode_sdk_dart 0.2.0
opencode_sdk_dart: ^0.2.0 copied to clipboard
Cross-platform Dart SDK for the OpenCode V2 HTTP API. Generated from the official OpenAPI 3.1 contract with sealed model unions, typed errors, multiplexed event streams, plugin RPC, PTY sockets, and l [...]
0.2.0 #
Refreshed from the latest OpenCode V2 OpenAPI 3.1 contract: 813 declarations, 170 operations, 32 resource groups, and 501 schemas.
New API surface:
- Experimental artifacts (
client.experimental.artifacts), schedules (client.experimental.schedule), background jobs (client.experimental.jobList), media blobs (client.experimental.mediaGet), and usage limits (client.usage.limits). - Voice models and server-brokered voice sessions (
client.voice). - Text, image, and decision generation
(
client.generate.text,image, anddecisions); the legacy/api/experimental/generateendpoint remains available asclient.generate.textLegacy. - Client MCP endpoints (
client.mcp.client), a client-hosted MCP WebSocket helper (client.mcp.connectClientSocket(...)), filesystem watch/unwatch, plugin GUI bundles (client.plugin.gui), heap dumps (client.debug.heapDump), and saved-permission updates (client.permission.saved.update). - Event type filtering:
client.event.subscribe(types: ['session.*', 'rpc.*']). Filtering happens locally over the shared connection, and theserver.connectedmarker is always delivered. - Durable event log plus new event schemas for session status, idle, inbox, execution, step, tool, compaction, revert, usage, TUI, filesystem, artifact, installation, VCS, and MCP updates.
- Model types (
chat,decision,image), freeform tool formats, provider cache/TLS settings, media-input and streaming-usage capabilities, session archive filters, typedparentID, PTY titles/user titles, andLocationRef.workspaceID.
Breaking changes:
- Assistant message parts now expose
nativeinstead of provider-state fields; compaction messages no longer carryrecent. Credential.Key.configurationwas removed by the contract.Location.PublicRefbecameLocation.Ref; the SDK keeps the hand-writtenLocationRefand addsworkspaceID.- Experimental generate and persistent-PTY operation IDs were renamed.
- Removed
Event.SeqEncoded,PersistentPty.ReadLinesEncoded,Form.Fields_2/3, and theSession.ProviderContext*schemas. session.list(parentID:)is nowString?because the wire type accepts a session ID or the literal"null"root-session sentinel.model.list(types:)is nowList<String>?and repeats the query key.
0.1.0 #
Initial release.
- Generated from the OpenCode V2 OpenAPI 3.1 contract (438 declarations, 142 operations, 28 resources).
- Sealed unions, branded
extension typescalars, and wire-mapped enums. - Structured
_tagerror decoding with HTTP status codes. - Shared lazy event multiplexer with
server.connectedreplay and capacity protection. - Plugin RPC calls, streaming subscriptions, and sequential callback subscriptions.
- PTY and persistent PTY WebSocket helpers.
- Local background service discovery, startup, stop, version constraints, and persistent-terminal handoff.
- Request cancellation via
CancellationToken. - One-call session turns:
client.streamPrompt(...)streams text and reasoning deltas, falls back tosession.waitpolling when the live-only event stream drops, and reconciles the final answer with the server's record. - Cursor pagination helpers:
session.listAll(...)andsession.message.listAll(...)followcursor.nextuntil it runs out. - Opt-in
RetryPolicyfor transient transport failures, configurable on the transport or per request, withRetry-Aftersupport and idempotent-only defaults. - Unit test suite (87 tests) plus a live read-only smoke test.