Documentation
¶
Overview ¶
Package chat provides the `ana chat` verb tree: new/list/show/history/send (streaming) plus rename, bookmark/unbookmark, duplicate, delete, and share. Like the other verb packages it avoids importing internal/transport and internal/config — consumers inject a narrow Deps struct that adapts a real transport client to two function fields plus a UUID generator.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Deps ¶
type Deps struct {
Unary func(ctx context.Context, path string, req, resp any) error
Stream func(ctx context.Context, path string, req any) (StreamSession, error)
UUIDFn func() string
}
Deps is the injection boundary for the chat package.
- Unary JSON-encodes req, POSTs it to path, and JSON-decodes into *resp.
- Stream opens a server-streaming call and returns a StreamSession the caller drains frame-by-frame.
- UUIDFn returns a fresh v4 UUID string. Injected so tests can assert on a deterministic cellId rather than a random one per run.
type StreamSession ¶
StreamSession is the minimum surface the `send` subcommand needs from a streaming RPC call: pull the next frame, decode into an arbitrary value, and close the underlying body. transport.StreamReader satisfies this at the call site; tests supply an in-memory fake (see chat_test.go).