client

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package client is the reference client for the dcode protocol.

It is the first consumer of the contract. If the API feels awkward here, the protocol is what needs fixing, not this package.

It holds no session state: only a read position, which is what lets a client die and rejoin without the session noticing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client talks to a dcode daemon over a Unix socket.

func New

func New(socketPath string) *Client

New builds a client for a socket path.

func (*Client) CreateSession

func (c *Client) CreateSession(ctx context.Context, req protocol.CreateSessionRequest) (protocol.Session, error)

CreateSession opens a session.

func (*Client) DeleteSession

func (c *Client) DeleteSession(ctx context.Context, id string) error

DeleteSession closes a session.

func (*Client) GetSession

func (c *Client) GetSession(ctx context.Context, id string) (protocol.Session, error)

GetSession returns one session.

func (*Client) Health

func (c *Client) Health(ctx context.Context) error

Health reports whether a daemon is answering.

func (*Client) Interrupt

func (c *Client) Interrupt(ctx context.Context, id string) error

Interrupt cancels the running turn.

func (*Client) ListSessions

func (c *Client) ListSessions(ctx context.Context) ([]protocol.Session, error)

ListSessions returns live sessions.

func (*Client) RenameSession added in v0.2.0

func (c *Client) RenameSession(ctx context.Context, id, name string) error

RenameSession names a conversation, live or not.

An empty name restores the title derived from the first question. That is the way back rather than a second call for undoing: one operation with a meaningful zero value is one thing to get right.

func (*Client) Resolve

func (c *Client) Resolve(ctx context.Context, id, approvalID string, d protocol.ApprovalDecision) error

func (*Client) Steer

func (c *Client) Steer(ctx context.Context, id, text string) error

Steer hands a running turn something the person said, without ending it.

Refused when no turn is running: a correction to a turn that already finished is a new message, and quietly turning it into one would let the person believe an urgent instruction landed when it never did.

func (*Client) Submit

func (c *Client) Submit(ctx context.Context, id, text string, images ...protocol.TurnImage) error

Submit sends user input. Submit sends a turn, optionally with pictures.

func (*Client) Subscribe

func (c *Client) Subscribe(ctx context.Context, id string, from uint64) (<-chan protocol.Event, <-chan error)

Subscribe streams events from `from`, reconnecting on its own.

Reconnection resumes at the last sequence seen plus one, which is why the read position is the only state a client keeps. Reconnecting therefore behaves exactly like connecting for the first time.

func (*Client) Undo

func (c *Client) Undo(ctx context.Context, id string) (protocol.UndoResult, error)

Resolve answers a pending approval. Undo puts back what the last turn changed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL