Types
GetApiSessionActiveResponse = object
GetApiSessionSessionIDResponse = object
PostApiSessionResponse = object
SessionOrderOption = enum orderAsc = "asc", orderDesc = "desc"
Procs
proc getApiSession(client: OpencodeClient; workspace: string = default(string); limit: float64 = default(float64); order: set[SessionOrderOption] = {}; search: string = default(string); directory: string = default(string); project: string = default(string); subpath: string = default(string); cursor: string = default(string)): Future[SessionsResponse] {. ...stackTrace: false, raises: [Exception, ValueError, KeyError, HttpRequestError, LibraryError, SslError, OSError, IOError, ProtocolError, OpenParserJsonError, OpencodeClientError], tags: [RootEffect, ReadIOEffect, TimeEffect], forbids: [].}
- Retrieve sessions in the requested order. Items keep that order across pages; use cursor.next or cursor.previous to move through the ordered list.
proc getApiSessionActive(client: OpencodeClient): Future[ GetApiSessionActiveResponse] {....stackTrace: false, raises: [Exception, ValueError, HttpRequestError, LibraryError, SslError, OSError, IOError, ProtocolError, KeyError, OpenParserJsonError, OpencodeClientError], tags: [ RootEffect, ReadIOEffect, TimeEffect], forbids: [].}
- Retrieve foreground Session drains currently owned by this OpenCode process. Sessions absent from the result are inactive.
proc getApiSessionSessionID(client: OpencodeClient; sessionID: string): Future[ GetApiSessionSessionIDResponse] {....stackTrace: false, raises: [Exception, ValueError, HttpRequestError, LibraryError, SslError, OSError, IOError, ProtocolError, KeyError, OpenParserJsonError, OpencodeClientError], tags: [ RootEffect, ReadIOEffect, TimeEffect], forbids: [].}
- Retrieve a session by ID.
proc getApiSessionSessionIDContext(client: OpencodeClient; sessionID: string): Future[ GetApiSessionSessionIDContextResponse] {....stackTrace: false, raises: [ Exception, ValueError, HttpRequestError, LibraryError, SslError, OSError, IOError, ProtocolError, KeyError, OpenParserJsonError, OpencodeClientError], tags: [RootEffect, ReadIOEffect, TimeEffect], forbids: [].}
- Retrieve the active context messages for a session (all messages after the last compaction).
proc getApiSessionSessionIDEvent(client: OpencodeClient; sessionID: string; after: string = default(string)): Future[ AsyncResponse] {....stackTrace: false, raises: [Exception, ValueError, KeyError, HttpRequestError, LibraryError, SslError, OSError, IOError, ProtocolError], tags: [RootEffect, ReadIOEffect, TimeEffect], forbids: [].}
- Replay durable events after an aggregate sequence, then continue with new durable events.
proc getApiSessionSessionIDHistory(client: OpencodeClient; sessionID: string; limit: string = default(string); after: string = default(string)): Future[ SessionHistory] {....stackTrace: false, raises: [Exception, ValueError, KeyError, HttpRequestError, LibraryError, SslError, OSError, IOError, ProtocolError, OpenParserJsonError, OpencodeClientError], tags: [RootEffect, ReadIOEffect, TimeEffect], forbids: [].}
- Read one finite page of public durable Session events after an exclusive aggregate sequence. Newly committed events may appear on later pages.
proc getApiSessionSessionIDMessageMessageID(client: OpencodeClient; sessionID: string; messageID: string): Future[ GetApiSessionSessionIDMessageMessageIDResponse] {....stackTrace: false, raises: [ Exception, ValueError, HttpRequestError, LibraryError, SslError, OSError, IOError, ProtocolError, KeyError, OpenParserJsonError, OpencodeClientError], tags: [RootEffect, ReadIOEffect, TimeEffect], forbids: [].}
- Retrieve one projected message owned by the Session.
proc postApiSession(client: OpencodeClient; body: PostApiSessionRequest): Future[ PostApiSessionResponse] {....stackTrace: false, raises: [Exception, ValueError, HttpRequestError, LibraryError, SslError, OSError, IOError, ProtocolError, KeyError, OpenParserJsonError, OpencodeClientError], tags: [RootEffect, ReadIOEffect, TimeEffect], forbids: [].}
- Create a session at the requested location.
proc postApiSessionSessionIDAgent(client: OpencodeClient; sessionID: string; body: PostApiSessionSessionIDAgentRequest): Future[ AsyncResponse] {....stackTrace: false, raises: [Exception, ValueError, HttpRequestError, LibraryError, SslError, OSError, IOError, ProtocolError, KeyError], tags: [RootEffect, ReadIOEffect, TimeEffect], forbids: [].}
- Switch the agent used by subsequent provider turns.
proc postApiSessionSessionIDCompact(client: OpencodeClient; sessionID: string): Future[ AsyncResponse] {....stackTrace: false, raises: [Exception, ValueError, HttpRequestError, LibraryError, SslError, OSError, IOError, ProtocolError, KeyError], tags: [RootEffect, ReadIOEffect, TimeEffect], forbids: [].}
- Compact a session conversation.
proc postApiSessionSessionIDInterrupt(client: OpencodeClient; sessionID: string): Future[ AsyncResponse] {....stackTrace: false, raises: [Exception, ValueError, HttpRequestError, LibraryError, SslError, OSError, IOError, ProtocolError, KeyError], tags: [RootEffect, ReadIOEffect, TimeEffect], forbids: [].}
- Interrupt active execution owned by this OpenCode process. Idle interruption is a no-op.
proc postApiSessionSessionIDModel(client: OpencodeClient; sessionID: string; body: PostApiSessionSessionIDModelRequest): Future[ AsyncResponse] {....stackTrace: false, raises: [Exception, ValueError, HttpRequestError, LibraryError, SslError, OSError, IOError, ProtocolError, KeyError], tags: [RootEffect, ReadIOEffect, TimeEffect], forbids: [].}
- Switch the model used by subsequent provider turns.
proc postApiSessionSessionIDPrompt(client: OpencodeClient; sessionID: string; body: PostApiSessionSessionIDPromptRequest): Future[ PostApiSessionSessionIDPromptResponse] {....stackTrace: false, raises: [ Exception, ValueError, HttpRequestError, LibraryError, SslError, OSError, IOError, ProtocolError, KeyError, OpenParserJsonError, OpencodeClientError], tags: [RootEffect, ReadIOEffect, TimeEffect], forbids: [].}
- Durably admit one session input and schedule agent-loop execution unless resume is false.
proc postApiSessionSessionIDRevertClear(client: OpencodeClient; sessionID: string): Future[AsyncResponse] {. ...stackTrace: false, raises: [Exception, ValueError, HttpRequestError, LibraryError, SslError, OSError, IOError, ProtocolError, KeyError], tags: [RootEffect, ReadIOEffect, TimeEffect], forbids: [].}
- Clear staged revert
proc postApiSessionSessionIDRevertCommit(client: OpencodeClient; sessionID: string): Future[AsyncResponse] {....stackTrace: false, raises: [ Exception, ValueError, HttpRequestError, LibraryError, SslError, OSError, IOError, ProtocolError, KeyError], tags: [RootEffect, ReadIOEffect, TimeEffect], forbids: [].}
- Commit staged revert
proc postApiSessionSessionIDRevertStage(client: OpencodeClient; sessionID: string; body: PostApiSessionSessionIDRevertStageRequest): Future[ PostApiSessionSessionIDRevertStageResponse] {....stackTrace: false, raises: [ Exception, ValueError, HttpRequestError, LibraryError, SslError, OSError, IOError, ProtocolError, KeyError, OpenParserJsonError, OpencodeClientError], tags: [RootEffect, ReadIOEffect, TimeEffect], forbids: [].}
- Stage or move a reversible session boundary and optionally apply its file changes.
proc postApiSessionSessionIDWait(client: OpencodeClient; sessionID: string): Future[ AsyncResponse] {....stackTrace: false, raises: [Exception, ValueError, HttpRequestError, LibraryError, SslError, OSError, IOError, ProtocolError, KeyError], tags: [RootEffect, ReadIOEffect, TimeEffect], forbids: [].}
- Wait for a session agent loop to become idle.