registry

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 47 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package registry has the providers of models, by names which the registry gives them, and finds the models across them

Index

Constants

View Source
const (
	// DefaultMaxIterations is how many times the agent loop asks a model for
	// its reply, when it isn't told how many
	DefaultMaxIterations = 10

	// DefaultToolTimeout is the most time a tool the agent loop runs has to
	// return, when it isn't told how long
	DefaultToolTimeout = 30 * time.Second
)
View Source
const (
	// AgentNamespace is the name of the namespace of the toolkit's tools
	// which are the agents which people, and chats, create
	AgentNamespace = schema.AgentNamespace

	// BuiltinNamespace is the name of the namespace of the toolkit's tools
	// which are the server's own agents, which are built in
	BuiltinNamespace = schema.BuiltinNamespace
)
View Source
const (
	// DefaultCompactAgent is the agent which summarises a conversation, as
	// it's compacted
	DefaultCompactAgent = "compact"

	// DefaultSummaryTimeout is the most time a summary has to be written,
	// when the compact agent has no timeout of its own, after which its
	// marker is failed, rather than left pending, as when its model's
	// request hangs
	DefaultSummaryTimeout = 5 * time.Minute
)
View Source
const (
	// EventSchema is the schema of the registry's events, which the
	// toolkit's events share
	EventSchema = "llm"

	// ProviderTable is the table of the events of providers, whose rows are
	// their names in the registry
	ProviderTable = "provider"

	// SessionTable is the table of the events of sessions, whose rows are
	// their identifiers
	SessionTable = "session"
)
View Source
const DefaultEventAgent = "event"

DefaultEventAgent is the agent which runs an event, unless another is given

View Source
const DefaultMaxDepth = 3

DefaultMaxDepth is the most agents which run in one another, as an agent calls another, or itself, as a tool, when the max_depth option of the session, or agent, which runs them, doesn't say

View Source
const DefaultMaxEvents = 2

DefaultMaxEvents is the most events which run at once, unless WithMaxEvents sets it

View Source
const (
	// DefaultToolResultLimit is the most tokens of a tool's result the agent
	// loop sends to the model, when the model's context isn't known
	DefaultToolResultLimit = 8192
)
View Source
const EventTable = "event"

EventTable is the table of the registry's events of the outcomes of events, whose rows are their identifiers, and whose data, unless they were deleted, is an EventChange

View Source
const (
	// RetentionInterval is how often the sessions which haven't changed for
	// longer than they're kept are deleted, as the registry runs
	RetentionInterval = time.Hour
)
View Source
const ThinkingLog = schema.ThinkingLog

ThinkingLog is the line which is logged to a chat's stream, once, the first time its model thinks, or its tools run, as schema.ThinkingLog

Variables

View Source
var (
	// PingInterval is how long the result of a provider's ping is used, and
	// how often Run pings the providers, so whether one can be reached is
	// known within it. A provider decides how often it asks its server, so
	// one of an API, such as OpenAI's, which is rarely unreachable, can keep
	// its ping's result for longer. A provider which downloads models, such
	// as Ollama, has its models listed again as often, as they can be
	// downloaded or deleted without the registry, and listing them is quick.
	PingInterval = 30 * time.Second

	// ModelCacheInterval is how long a provider's models are cached, unless
	// it downloads models
	ModelCacheInterval = 6 * time.Hour

	// PingTimeout is how long a provider's ping waits for its server, so one
	// which can't be reached is known to be down soon, rather than once its
	// client gives up
	PingTimeout = 5 * time.Second
)
View Source
var MaxAttachmentsSize int64 = 64 << 20

MaxAttachmentsSize is the most content of the resources which a request's attachments refer to, together, which is read into memory, as it's sent to a model, which is more than any provider accepts

View Source
var TypingTimeout = 10 * time.Second

TypingTimeout is how long a session is typing, after a client last says someone is, before it's idle, so a client which goes away doesn't leave it typing

Functions

This section is empty.

Types

type AgentSource added in v1.6.4

type AgentSource interface {
	// SourceAgent returns the definition of the agent with the name, in the
	// namespace, with its namespace as its origin. Returns ErrNotFound when
	// there's none.
	SourceAgent(ctx context.Context, namespace, name string) (schema.AgentMeta, error)

	// SourceMessages returns the messages the agent with the name, in the
	// namespace, sends its model, with the input, which is a JSON object.
	// Returns ErrBadParameter when the input isn't valid.
	SourceMessages(ctx context.Context, namespace, name string, input json.RawMessage) ([]llm.Message, error)
}

AgentSource has agents which aren't stored, by their namespace, such as a connector's MCP prompts, which RunAgent runs as it runs the stored ones, with their messages in place of a prompt, and which can't be changed, or deleted

type AgentStore added in v0.6.0

type AgentStore interface {
	// Create creates an agent with the definition, and returns it, with its
	// serial, and when it was created. Returns ErrConflict when there's an
	// agent with its name.
	Create(context.Context, schema.AgentMeta) (schema.Agent, error)

	// Get returns the agent with the name. Returns ErrNotFound when there's
	// none.
	Get(ctx context.Context, name string) (schema.Agent, error)

	// List returns the agents, in the store's order, from the request's
	// offset, and at most its limit of them, and how many there are
	List(context.Context, schema.AgentListRequest) (schema.AgentList, error)

	// Put replaces the agent with its name, when its serial is that agent's,
	// and returns it, with its new serial, and when it was modified. Returns
	// ErrNotFound when there's none, and ErrConflict when its serial isn't
	// the agent's, as it was changed since it was seen.
	Put(context.Context, schema.Agent) (schema.Agent, error)

	// Delete deletes the agent with the name, when the serial is its serial,
	// or does nothing when there's none. Returns ErrConflict when the serial
	// isn't its serial, as it was changed since it was seen.
	Delete(ctx context.Context, name string, serial uint64) error
}

AgentStore has agents, each by its name, with its serial, which the store sets, and changes each time the agent is stored, so a change is made to the agent as it was last seen, rather than a newer one, such as one which another server made. An agent's serial is never one which an agent with its name had before, including one which was deleted, and created again, so a change to the agent as it was isn't made to the new one.

type CredentialsProvider

type CredentialsProvider = credential.CredentialProvider

CredentialsProvider expands credentials, such as a provider's API key, whose placeholders, such as ${OPENAI_KEY}, are replaced with the credentials they name. It's go-auth's CredentialProvider, so one provider is shared by the registry, the toolkit and the connectors.

type EventBuilder added in v1.2.0

EventBuilder returns how an event is run: its agent's input, the namespaces of the tools it's run without, and what it's for, and when it was due, and fired, for RunEvent

type EventStore added in v1.2.0

type EventStore interface {
	// Create creates an event with the outcome, and a new identifier, and
	// returns it, with its serial, and when it was created
	Create(context.Context, schema.EventMeta) (schema.Event, error)

	// Get returns the event with the identifier. Returns ErrNotFound when
	// there's none.
	Get(ctx context.Context, id uuid.UUID) (schema.Event, error)

	// List returns the events which the request selects, the most recently
	// created first, from its offset, and at most its limit of them, and how
	// many it selects
	List(context.Context, schema.EventListRequest) (schema.EventList, error)

	// Put replaces the event with its identifier, when its serial is that
	// event's, and returns it, with its new serial, and when it was
	// modified. Returns ErrNotFound when there's none, and ErrConflict when
	// its serial isn't the event's, as it was changed since it was seen.
	Put(context.Context, schema.Event) (schema.Event, error)

	// Delete deletes the event with the identifier, when the serial is its
	// serial, or does nothing when there's none. Returns ErrConflict when
	// the serial isn't its serial.
	Delete(ctx context.Context, id uuid.UUID, serial uint64) error
}

EventStore has the outcomes of the events which the registry runs, such as heartbeats which fire, each with its identifier and serial, which the store sets, and changes each time it's stored, so a change is made to the event as it was last seen, such as when it's delivered

type Opt

type Opt func(*opt) error

Opt is a functional option for the registry

func WithAgentSource added in v1.6.4

func WithAgentSource(source AgentSource) Opt

WithAgentSource sets where the agents which aren't stored come from, by their namespaces, such as connectors' MCP prompts, which are run, as tools and by RunAgent, as the stored agents are

func WithAgentStore added in v0.6.0

func WithAgentStore(store AgentStore) Opt

WithAgentStore sets the store of the agents, such as a database, which other servers share, or files, so they're kept when the server restarts

func WithBroadcaster added in v0.6.0

func WithBroadcaster(b *broadcaster.Broadcaster) Opt

WithBroadcaster sets the broadcaster which the registry publishes its events to, such as one which others share, so a server's events are served together. Its owner runs it. Without it, the registry has its own, which isn't run, so its watches end only when they're cancelled.

func WithClientOpts

func WithClientOpts(opts ...client.ClientOpt) Opt

WithClientOpts sets the options of the HTTP clients of the providers which the registry creates, such as their tracer, user agent and timeout

func WithCompactTools added in v1.5.1

func WithCompactTools(namespaces ...string) Opt

WithCompactTools sets the namespaces, such as memory, whose tools the compact agent is given, as it summarises a session, when the session has them, so it can remember what's worth remembering, update what's out of date, and forget what was asked to be forgotten, as it reads it

func WithCredentialsProvider

func WithCredentialsProvider(provider CredentialsProvider) Opt

WithCredentialsProvider sets the provider which expands credentials, such as the API key of a provider which is created, whose placeholders, such as ${OPENAI_KEY}, are replaced with the credentials they name. Without one, or with nil, the credentials are environment variables.

func WithEventBuilder added in v1.2.0

func WithEventBuilder(fn EventBuilder) Opt

WithEventBuilder sets the function which returns how an event, which TriggerEvent is given, is run, such as with what the system says of the person, and the tools it's run without. Without one, its input says only the time, in UTC, and it's run with every tool of the session it's for.

func WithEventStore added in v1.2.0

func WithEventStore(store EventStore) Opt

WithEventStore sets the store of the outcomes of the events which the registry runs, such as heartbeats which fire, so they can be seen, and delivered. Without one, an event's outcome is only in the session it ran in.

func WithMaxEvents added in v1.2.0

func WithMaxEvents(n uint) Opt

WithMaxEvents sets the most events, such as heartbeats which fire, and events which are triggered, which run at once, which is DefaultMaxEvents, unless it's set. Those which are run once these are, wait until one of them has, and an event which was triggered is scheduled until it runs. Returns ErrBadParameter when it's zero.

func WithProviderStore added in v0.6.0

func WithProviderStore(store ProviderStore) Opt

WithProviderStore sets the store of the providers, which the registry's providers are kept the same as, both ways, as Run syncs them, such as a database, which other servers share, or a file, so they're kept when the server restarts

func WithReplies added in v1.4.4

func WithReplies(fn ReplyFunc) Opt

WithReplies sets the function which is called with each reply which Chat adds to a session, once it's stored, and each event's outcome which is delivered to one, with its text, and the resources it made, such as to send it to the session's channels, with a context which isn't cancelled when the chat's is, so it can take longer than its request

func WithResources added in v1.3.0

func WithResources(resources Resources) Opt

WithResources sets the resources, which messages' attachments, and the audio, documents and images which are transcribed, recognized, or embedded, refer to by their URIs, which are resource:///<hash>, whose content is read, as they're sent to a model, or none, when attachments can't refer to resources

func WithSessionRetention added in v1.4.1

func WithSessionRetention(d time.Duration, keep func(context.Context, uuid.UUID) (bool, error)) Opt

WithSessionRetention deletes the sessions which haven't changed for the duration, as the registry runs, unless one is replying, or the function, when it isn't nil, says it's kept, such as one with a heartbeat. Zero keeps sessions until they're deleted.

func WithSessionStore added in v0.6.0

func WithSessionStore(store SessionStore) Opt

WithSessionStore sets the store of the sessions, such as a database, which other servers share, or files, so they're kept when the server restarts

func WithTimes added in v1.4.1

func WithTimes(zone func() *time.Location, namespaces ...string) Opt

WithTimes tells a model when each of the person's messages was sent, at its start, such as (Saturday 2026-11-07T12:38+01:00), in the time zone the function returns, or UTC, when it's nil, or returns nil, when the model can call a tool of one of the namespaces, such as memory, which makes a chat an assistant's, so the model knows the time, and how long it's been since an earlier message, without its system prompt changing

func WithToolkit

func WithToolkit(tools *toolkit.Toolkit) Opt

WithToolkit sets the toolkit of the tools which the registry's models can call

func WithTracer

func WithTracer(tracer trace.Tracer) Opt

WithTracer sets the tracer, which traces the registry's operations, such as listing models, and generating messages

type ProviderOpt

type ProviderOpt func(*cached) error

ProviderOpt is an option of a provider which is added to the registry

func WithExclude

func WithExclude(patterns ...string) ProviderOpt

WithExclude excludes the models whose names match one of the patterns, which are regular expressions, such as -mini$

func WithInclude

func WithInclude(patterns ...string) ProviderOpt

WithInclude includes only the models whose names match one of the patterns, which are regular expressions, such as ^gpt-, or every model when there are none

type ProviderStore added in v0.6.0

type ProviderStore interface {
	// List returns the providers, with their serials, in any order
	List(context.Context) ([]schema.Provider, error)

	// Put creates the provider, when its serial is zero, and the store has
	// no provider with its name, or replaces the provider with its name,
	// when its serial is that provider's, and returns it, with its new
	// serial. Returns ErrConflict when its serial isn't the provider's, as
	// the provider was changed, or created, since it was seen.
	Put(context.Context, schema.Provider) (schema.Provider, error)

	// Delete deletes the provider with the name, when the serial is its
	// serial, or does nothing when there's none. Returns ErrConflict when
	// the serial isn't its serial, as it was changed since it was seen.
	Delete(ctx context.Context, name string, serial uint64) error

	// Watch sends the store's events to the channel, when its providers are
	// changed by others, such as other servers, from when it returns, until
	// the context is cancelled, as the registry's Watch does. It returns a
	// channel which is sent nil, or an error when the store stops, once the
	// watch has ended. A store which isn't changed by others, such as a
	// file, sends no events, as its providers are listed periodically.
	Watch(context.Context, chan<- eventschema.Change) (<-chan error, error)
}

ProviderStore has the definitions of providers, with their names, and their API keys' placeholders, such as ${OPENAI_KEY}, rather than their credentials, by their names, each with its serial, which the store sets, and changes each time the provider does, so a change is made to the provider as it was last seen, rather than a newer one, such as one which another server made

type Registry

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

Registry is the providers of models, by names which it gives them, so there can be more than one provider of a type, such as two Ollama servers. Providers can be added and removed. It's safe to use concurrently.

func New

func New(opts ...Opt) (*Registry, error)

New returns a registry without providers, which are added with Add, with the options, such as its tracer

func (*Registry) Add

func (r *Registry) Add(name string, provider llm.Provider, opts ...ProviderOpt) error

Add adds the provider, with the name, which must be an identifier, such as my-ollama, which starts with a letter, followed by letters, numbers, underscores or hyphens, or with its own name, such as its type, when the name is empty, and the options, such as the patterns of the names of the models which are included, or excluded. Returns ErrConflict when a provider with the name, or the provider itself, is added already, and ErrBadParameter when a pattern isn't valid. Watchers are sent that it was created.

func (*Registry) AgentLoop added in v0.6.0

func (r *Registry) AgentLoop(ctx context.Context, model llm.Model, messages []llm.Message, tools []llm.Tool, stream llm.GeneratorStreamFn, opts ...llm.Opt) (_ []providerschema.Message, _ llm.Usage, err error)

AgentLoop asks the model for its reply to the messages, runs the tools it calls, and asks it again with their results, until it replies, its reply is truncated as it reached the most tokens it can generate, or it's been asked as many times as the max_iterations option, or DefaultMaxIterations times when it isn't set.

When the json_schema option is set, the model replies by calling the respond tool, which is added to the tools, with a result which conforms to the schema, and the system prompt says so. The reply is then the result, as JSON text, rather than the call, so each tool call in the conversation has its result. A model which replies with text is asked to call the tool, and a result which doesn't conform, or a call with other tools, is returned to the model as an error, each of which counts as an iteration, until it's been asked as many times as it can be.

Each tool has the tool_timeout option to return, or DefaultToolTimeout when it isn't set, after which its result is that it timed out. The results are truncated, as toolkit.TruncateResult does, as the model's provider measures them, or as they're estimated, so the model's context, which is the smaller of its input token limit and the context_window option, is at most two thirds full with them, or to DefaultToolResultLimit tokens each, when the model's context isn't known.

The max_iterations, tool_timeout and json_schema options are the loop's, so aren't passed to the model, unlike the other options. Returns the messages added to the conversation: each of the model's replies, followed by the results of the tools it called, or the request to call the respond tool, except the last, which is the model's last reply, whose result is why the loop stopped: stop, or another reason the model stopped; or max_tokens, blocked, error or max_iterations, when the tools it called aren't run, as its input may be incomplete, or it didn't finish, or it's been asked as many times as it can be, so are left out of it. So each tool call has its result, and the messages can be sent to a model again, as the rest of a conversation. When the reply has a schema, its result is stop only when it's the result. A tool which the model calls, and which isn't one of the tools, or fails, has its error returned to the model as its result. The replies are streamed to the function as they're generated, when it isn't nil, each separated by a blank line, until the loop returns, when nothing more is streamed, though a tool which didn't return in time may still log. Returns ErrBadParameter when a message is nil, an option isn't valid, or a tool is named as the respond tool when the reply has a schema, the errors of WithoutSession, and the context's error when it's done while a tool runs.

func (*Registry) AgentStore added in v0.6.0

func (r *Registry) AgentStore() AgentStore

AgentStore returns the store of the registry's agents, or nil when it has none, when it has no agents

func (*Registry) Ask

Ask returns the reply of the request's model to its messages, which include earlier turns of the conversation, as the agent loop does, but which stops when the model calls tools, whose calls are in its reply, for the caller to run, rather than run. The model replies after the system prompt, with the options, and can call the tools, which are got from the registry's toolkit. When the request has a schema, the model replies by calling the respond tool, whose result is the reply's result: a model which replies with text is asked to call it, and a result which doesn't conform to the schema is returned to the model to correct, until it's been asked respondAttempts times, or as many times as the max_iterations option. The messages are compacted, as the agent loop does, to fit the model's context, without changing them, and when they don't fit, however compacted, the model isn't asked, and the reply is empty, with max_context as its result. The reply is streamed to the function as it's generated, when it isn't nil, with each of the model's replies separated by a blank line. Returns ErrBadParameter when the request isn't valid, ErrNotFound when the model, or a tool, isn't found, and the errors of WithoutSession.

func (*Registry) Broadcaster added in v0.6.0

func (r *Registry) Broadcaster() *broadcaster.Broadcaster

Broadcaster returns the broadcaster which the registry publishes its events to, so its events can be served, and it can be run

func (*Registry) Chat added in v0.6.0

func (r *Registry) Chat(ctx context.Context, id uuid.UUID, messages []llm.Message, stream llm.GeneratorStreamFn) (_ *schema.ChatResponse, err error)

Chat adds the messages to the session with the identifier, and the messages which its model, asked as WithSession asks it, adds, which are its reply, the results of the tools it called, and the rest, and stores it, with its usage: the tokens used by every request to its model, and the tokens of its conversation, as of the reply. The reply is streamed to the function as it's generated, when it isn't nil. Returns what was added, with the session's serial, as it was stored. Returns ErrNotFound when there's no session, ErrForbidden when it's an event's, which isn't chatted in, ErrConflict when it was changed as the model replied, as the reply is to the conversation as it was, so isn't stored, apart from when messages were only added to it, such as an event's outcome, which was delivered, which then follow the reply, ErrServiceUnavailable when the registry has no session store, and the errors of WithSession. The session is replying until the model has replied, and its reply is stored.

func (*Registry) CompactSession added in v1.5.1

func (r *Registry) CompactSession(ctx context.Context, id uuid.UUID) (_ *schema.Session, err error)

CompactSession compacts the session with the identifier: a marker is added to its messages, after which its context starts, so the messages before it are kept, but aren't sent to its model, and returns it, without its messages. A summary of them, and a title for the conversation, are written in the background, by the compact agent, and added to the marker, and the model is sent the summary in their place, once it's written, and the title is the session's. Returns ErrNotFound when there's no session, ErrForbidden when it's an event's, ErrBadParameter when it has no messages since it was last compacted, and ErrServiceUnavailable when the registry has no session store.

func (*Registry) CreateAgent added in v0.6.0

func (r *Registry) CreateAgent(ctx context.Context, meta schema.AgentMeta) (_ *schema.Agent, created bool, err error)

CreateAgent creates an agent with the definition, in the registry's agent store, or replaces the agent with its name, with the definition, as it is, rather than merging them, when it's changed, and returns it, as it's stored, or the agent as it is, when it hasn't changed, so creating agents each time a server starts, such as its examples, changes only those which have, and whether it was created, rather than replaced, or kept. Its name must be an identifier, such as segment, which refers to it. Its input, when it has one, must be a JSON schema of an object, and its prompt a Go template, which is executed with the input. Its model, when it has one, is the registry's, by its canonical name, and its tools are the toolkit's, by their canonical names, as a session's are. It needn't have a model, as one can be given when it's run, but one it has must call tools, unless that isn't known. Returns ErrBadParameter when the definition isn't valid, ErrNotFound when the model isn't the registry's, or a tool isn't the toolkit's, ErrConflict when the agent was changed as it was replaced, or a name is ambiguous, and ErrServiceUnavailable when the registry has no agent store.

func (*Registry) CreateProvider

func (r *Registry) CreateProvider(ctx context.Context, req schema.Provider) (_ *schema.ProviderStatus, err error)

CreateProvider creates a provider of the type, such as ollama, and adds it to the registry, with its name, or its type when it has none, once it's validated, as newProvider does, and pinged. The request is kept, as the provider's definition, with its API key's placeholder, rather than its credentials, and its serial is 1, whatever the request's. Returns ErrBadParameter when the type is unknown, ErrServiceUnavailable when it can't be reached, as it can't be used, and ErrConflict when a provider with its name is added already.

func (*Registry) CreateSession added in v0.6.0

func (r *Registry) CreateSession(ctx context.Context, meta schema.SessionMeta) (_ *schema.Session, err error)

CreateSession creates a session with the settings, in the registry's session store, and returns it, with no messages. Its model, when it has one, is the registry's, by its canonical name, such as ollama:llama3.2:latest, and its tools are the toolkit's, by their canonical names, such as weatherapi:current, or a namespace and "*", or "*", as they are. It needn't have a model, as it can be inherited. Returns ErrBadParameter when the settings aren't valid, ErrNotFound when the model isn't the registry's, or a tool isn't the toolkit's, ErrConflict when a name is ambiguous, and ErrServiceUnavailable when the registry has no session store.

func (*Registry) DeleteAgent added in v0.6.0

func (r *Registry) DeleteAgent(ctx context.Context, name string) (_ *schema.Agent, err error)

DeleteAgent deletes the agent with the name, and returns it, as it was. Returns ErrNotFound when there's none, ErrConflict when it was changed as it was deleted, and ErrServiceUnavailable when the registry has no agent store.

func (*Registry) DeleteEvent added in v1.2.0

func (r *Registry) DeleteEvent(ctx context.Context, id uuid.UUID) (_ *schema.Event, err error)

DeleteEvent deletes the outcome of the event with the identifier, and returns it, as it was. Returns ErrNotFound when there's none, ErrConflict when it was changed as it was deleted, and ErrServiceUnavailable when the registry has no event store.

func (*Registry) DeleteModel

func (r *Registry) DeleteModel(ctx context.Context, model llm.Model) (err error)

DeleteModel deletes the model, with its provider, which must be in the registry, and download models

func (*Registry) DeleteProvider

func (r *Registry) DeleteProvider(ctx context.Context, name string) (_ *schema.ProviderStatus, err error)

DeleteProvider removes the provider with the name from the registry, and returns it, or returns ErrNotFound when there's none. It isn't pinged.

func (*Registry) DeleteSession added in v0.6.0

func (r *Registry) DeleteSession(ctx context.Context, id uuid.UUID) (_ *schema.Session, err error)

DeleteSession deletes the session with the identifier, with its messages, and returns it, as it was, without them, such as an event's, which is created again, when the event runs again. Returns ErrNotFound when there's none, ErrConflict when its model is replying, such as when an event runs in it, so it's deleted once it's replied, or when it was changed as it was deleted, and ErrServiceUnavailable when the registry has no session store.

func (*Registry) Embed

func (r *Registry) Embed(ctx context.Context, model llm.Model, messages []llm.Message, opts ...llm.Opt) (_ []llm.Vector, _ llm.Usage, err error)

Embed returns a vector for each of the messages, from the model's provider, which must be in the registry, and embed messages, whose attachments which refer to resources on their own, by their URIs, are read. Returns ErrNotImplemented when the model is known not to embed, and the provider's error as providerErr does.

func (*Registry) EventStore added in v1.2.0

func (r *Registry) EventStore() EventStore

EventStore returns the store of the outcomes of the events which the registry runs, or nil when it has none

func (*Registry) ForgetSessionMessages added in v1.0.0

func (r *Registry) ForgetSessionMessages(ctx context.Context, id uuid.UUID) (_ *schema.Session, err error)

ForgetSessionMessages forgets the messages of the session with the identifier, keeping its settings, so its conversation starts again, and returns it, without them. The tokens of its conversation are none, and the tokens used by every request to its model are kept. Returns ErrNotFound when there's none, ErrConflict when it was changed as they were forgotten, and ErrServiceUnavailable when the registry has no session store. A reply which is being waited for, as they're forgotten, isn't stored.

func (*Registry) GetAgent added in v0.6.0

func (r *Registry) GetAgent(ctx context.Context, name string) (_ *schema.Agent, err error)

GetAgent returns the agent with the name. Returns ErrNotFound when there's none, and ErrServiceUnavailable when the registry has no agent store.

func (*Registry) GetEvent added in v1.2.0

func (r *Registry) GetEvent(ctx context.Context, id uuid.UUID) (_ *schema.Event, err error)

GetEvent returns the outcome of the event with the identifier. Returns ErrNotFound when there's none, and ErrServiceUnavailable when the registry has no event store.

func (*Registry) GetModel

func (r *Registry) GetModel(ctx context.Context, name string) (_ llm.Model, err error)

GetModel returns the model with the name, which is its canonical name, such as ollama:llama3.2:latest, which is its provider's name in the registry, and its name, or otherwise its name, or an alias, which every provider's models are searched for at once. A model must match its provider's patterns. The models are cached, as ListModels does. Returns ErrNotFound when no provider has it, and ErrConflict when more than one does, so its canonical name is needed. When no provider has it, and a provider can't be asked, such as when it can't be reached, that provider's error is returned.

func (*Registry) GetProvider

func (r *Registry) GetProvider(ctx context.Context, name string) (_ *schema.ProviderStatus, err error)

GetProvider returns the provider with the name, with whether it could be reached, when it was last pinged, as describePing does, or ErrNotFound when there's none

func (*Registry) GetSession added in v0.6.0

func (r *Registry) GetSession(ctx context.Context, id uuid.UUID) (_ *schema.Session, err error)

GetSession returns the session with the identifier, without its messages, which ListSessionMessages lists. Returns ErrNotFound when there's none, and ErrServiceUnavailable when the registry has no session store.

func (*Registry) Illustrate added in v1.4.0

func (r *Registry) Illustrate(ctx context.Context, model llm.Model, prompt string, images []llm.Resource, opts ...llm.Opt) (_ []llm.Resource, _ llm.Usage, err error)

Illustrate returns the images the model makes from the prompt, or by changing, or combining, the images, which can refer to resources, by their URIs, as the prompt says, from the model's provider, which must be in the registry, and make images. Returns ErrNotImplemented when the model is known not to make images, ErrBadParameter when one of the images isn't an image, or they're larger than MaxAttachmentsSize, together, and the provider's error as providerErr does.

func (*Registry) InsertAgent added in v1.6.4

func (r *Registry) InsertAgent(ctx context.Context, meta schema.AgentMeta) (_ *schema.Agent, err error)

InsertAgent creates an agent with the definition, and returns it, as CreateAgent does, but never replaces one: it returns ErrConflict when there's an agent with its name, built-in or not, so of two which are created at once, with one name, only one is

func (*Registry) Keep added in v1.4.0

func (r *Registry) Keep(ctx context.Context, session uuid.UUID, resource llm.Resource, name string) (toolschema.ResourceLink, bool, error)

Keep keeps the resource, such as an image a model made, as a resource of the session, or, without one, on its own, with its name, or one of its type, such as image.png, when it's empty, and returns the link to it, and whether it was kept, which it isn't when the registry has no resources.

func (*Registry) ListAgents added in v0.6.0

func (r *Registry) ListAgents(ctx context.Context, req schema.AgentListRequest) (_ *schema.AgentList, err error)

ListAgents returns the agents, in the store's order, as the request selects. Returns ErrServiceUnavailable when the registry has no agent store.

func (*Registry) ListEvents added in v1.2.0

func (r *Registry) ListEvents(ctx context.Context, req schema.EventListRequest) (_ *schema.EventList, err error)

ListEvents returns the outcomes of the events which the request selects, those for its session, and of its status, when it has them, the most recent first, from its offset, and at most its limit of them, and how many it selects. Returns ErrBadParameter when the session isn't a UUID, and ErrServiceUnavailable when the registry has no event store.

func (*Registry) ListModels

func (r *Registry) ListModels(ctx context.Context, providers ...string) (_ []llm.Model, err error)

ListModels returns the models of every provider, or of the providers with the names, when there are any, which must exist, which match their patterns, in order of their providers' names, and then their names. The models are cached, and are listed again, at once, when they're stale. When a provider's models can't be listed, such as when it can't be reached, and none are cached, the others' models are returned, with an error saying which providers' couldn't be. A provider whose last ping, or listing, failed within PingInterval isn't asked again, so its error is returned without waiting for it.

func (*Registry) ListProviders

func (r *Registry) ListProviders(ctx context.Context, req schema.ProviderListRequest) (_ *schema.ProviderList, err error)

ListProviders returns the providers, in order of their names, of the type which the request selects, or every type, which are pinged at once, so it's known which can't be reached

func (*Registry) ListSessionMessages added in v0.6.0

func (r *Registry) ListSessionMessages(ctx context.Context, id uuid.UUID, req schema.MessageListRequest) (_ *schema.MessageList, err error)

ListSessionMessages returns the messages of the session with the identifier, oldest first, as the request selects: of its role, or every role, of its context only, which is its last marker, which a summary didn't fail for, and the messages after it, when it's asked for, from its offset, or, when that's negative, that many from the end, and at most its limit of them, and how many there are, with the offset they start at, from the start. Returns ErrNotFound when there's no session, and ErrServiceUnavailable when the registry has no session store.

func (*Registry) ListSessions added in v0.6.0

func (r *Registry) ListSessions(ctx context.Context, req schema.SessionListRequest) (_ *schema.SessionList, err error)

ListSessions returns the sessions, without their messages, most recently modified first, as the request selects. Returns ErrServiceUnavailable when the registry has no session store.

func (*Registry) ListVoices added in v1.6.7

func (r *Registry) ListVoices(ctx context.Context, model llm.Model, opts ...llm.Opt) (_ *llm.VoiceList, err error)

ListVoices returns the voices the model speaks in, from the model's provider, which must be in the registry, and speak text, or none, when the provider can't say, a page at a time, as the options say, with how many there are, and the token of the next page. Returns ErrNotImplemented when the model is known not to speak, and the provider's error as providerErr does.

func (*Registry) LoadModel

func (r *Registry) LoadModel(ctx context.Context, name string, progress llm.DownloadProgressFn) (_ llm.Model, err error)

LoadModel downloads the model with the name, with its provider, which must download models, and returns it. As the model may not exist yet, the name must be its canonical name, such as ollama:llama3.2:latest, unless only one of the providers downloads models.

func (*Registry) Measure added in v0.6.0

func (r *Registry) Measure(ctx context.Context, model llm.Model, text string) (_ uint, err error)

Measure returns how many tokens the text is, for the model, from the model's provider, which must be in the registry, when it measures text, or otherwise an estimate, of a token for every bytesPerToken bytes, or part of one. Returns the provider's error as providerErr does.

func (*Registry) Model

func (r *Registry) Model(model llm.Model) *schema.Model

Model returns the model, with the name of its provider in the registry, and its canonical name

func (*Registry) Name

func (r *Registry) Name(model llm.Model) string

Name returns the canonical name of the model, which is the name of its provider in the registry, and its name, such as my-ollama:llama3.2:latest, or its provider's own name, when its provider isn't in the registry

func (*Registry) Names

func (r *Registry) Names() []string

Names returns the names of the providers, in order

func (*Registry) Ping

func (r *Registry) Ping(ctx context.Context) (err error)

Ping pings every provider at once, and returns when they've replied, with the errors of those which failed joined, each saying which provider it is, or nil when every ping succeeded. The providers are pinged, whenever they were last.

func (*Registry) Provider

func (r *Registry) Provider(name string) llm.Provider

Provider returns the provider with the name, or nil when there's none

func (*Registry) Providers

func (r *Registry) Providers() []llm.Provider

Providers returns the providers, in order of their names

func (*Registry) Ready added in v1.1.0

func (r *Registry) Ready() <-chan struct{}

Ready returns a channel which is closed once Run has loaded the stored agents, and synced the providers, and their models, when it starts, so what needs them, such as heartbeats which are overdue, waits for it

func (*Registry) Recognize

func (r *Registry) Recognize(ctx context.Context, model llm.Model, resource llm.Resource, opts ...llm.Opt) (_ llm.Document, _ llm.Usage, err error)

Recognize returns the text in the resource, such as an image or a PDF, as a document, from the model's provider, which must be in the registry, and recognize text. Returns ErrNotImplemented when the model is known not to recognize text, and the provider's error as providerErr does.

func (*Registry) Remove

func (r *Registry) Remove(name string) (llm.Provider, error)

Remove removes the provider with the name, and returns it, so it can be closed, or returns ErrNotFound when there's none. Calls which have started already, such as listing models, still use it. Watchers are sent that it was deleted.

func (*Registry) Run

func (r *Registry) Run(ctx context.Context, logger *slog.Logger) error

Run keeps the registry current, until the context is cancelled, when it returns nil: it pings the providers, and lists the models of those whose models are stale, when it starts, and every PingInterval, so the providers' state, and their models, are kept current, and with a store, it syncs the registry's providers with the store's, when it starts, as either changes, and every PingInterval, as an event can be missed. The errors syncing them, which are synced again later, are logged with the logger, or aren't when it's nil. When the store stops, it returns its error. The registry is used without it, when its models are listed as they're needed. With a store of sessions, the changes others make to them, which it sends as events, are published as the registry's own. With a store of agents, and a toolkit, the stored agents are made tools, when it starts. With a store of sessions, and WithSessionRetention, the sessions which haven't changed for longer than they're kept are deleted, when it starts, and every RetentionInterval.

func (*Registry) RunAgent added in v0.6.0

func (r *Registry) RunAgent(ctx context.Context, name string, req schema.RunAgentRequest, stream llm.GeneratorStreamFn) (_ *schema.RunAgentResponse, err error)

RunAgent runs the agent with the name: the request's input is validated against its input schema, and its prompt is executed with it, as the message to its model, which is its own, or, when it has none, the model of the session it's run from, which is asked as its settings say, without its history, and runs the tools it calls, until it replies. Its reply is streamed to the function as it's generated, when it isn't nil. Returns what the agent did: the messages it added, the tokens used, and its reply, as JSON, which is its text, or what it replied, when it has a schema.

The agents which are running, as an agent calls another, or itself, as a tool, are in the context, with the most which can run in one another, which is the max_depth option of the session, or agent, which runs them, or the least of them, or DefaultMaxDepth, so an agent isn't run deeper, as agents could call one another without end.

Returns ErrNotFound when there's no agent with the name, or session, ErrForbidden when it would run deeper than the most agents which can run in one another, ErrBadParameter when its input isn't valid, or its prompt can't be executed with it, or it has no model, nor has the session it's run from, and ErrServiceUnavailable when the registry has no agent store, and the errors of WithSession.

func (*Registry) RunAgentTool added in v1.6.4

func (r *Registry) RunAgentTool(ctx context.Context, name string, input json.RawMessage) (any, error)

RunAgentTool runs the agent with the name, or its name in its namespace, such as a connector's prompt, as a tool which a model called, with the input, as an agent's tool does: from the session of the model which called it, when there's one, with what it streams as the tool's progress, and the tokens it used as the tool's, and returns its reply, or an error, which says how it stopped, when its reply isn't complete

func (*Registry) RunEvent added in v1.1.0

RunEvent runs the event with the identifier, such as a heartbeat which fired, with the request's agent, or the event agent, and its input, from the event's session, whose identifier is the event's, so an event which happens again, such as a heartbeat on a schedule, has the one session, and returns the session, and what the agent did, and replied, which is added to the session, with its usage, so it has each run, which is shown as it's replying, as the agent runs. The session is created, when there's none, with the model of the session the event is for, and the event's title, and takes them again, when they've changed, each time it's run, and an agent which has no model, such as the event agent, is run with it, and with the tools of the session the event is for, apart from those of the namespaces it's without, such as heartbeat, so an event doesn't schedule events. Returns ErrBadParameter when the identifier, or the session, is the nil UUID, or they're the same, or the session has no model, ErrNotFound when there's no session, or agent, ErrConflict when the event's session was changed as the agent ran, such as when its messages were forgotten, so what it did isn't stored, ErrServiceUnavailable when the registry has no session store, or agent store, and the errors of RunAgent.

func (*Registry) SessionStore added in v0.6.0

func (r *Registry) SessionStore() SessionStore

SessionStore returns the store of the registry's sessions, or nil when it has none, when it has no sessions

func (*Registry) SetSessionStatus added in v0.6.0

func (r *Registry) SetSessionStatus(ctx context.Context, id uuid.UUID, value schema.SessionStatus) (_ *schema.Session, err error)

SetSessionStatus sets the status of the session with the identifier, as a client says someone is typing a message, which it is until TypingTimeout after it was last said, or they stopped, when it's idle, unless its model is replying, which it is until it has replied. A change of the status is published as an update of the session. Returns the session, without its messages, with its status. Returns ErrBadParameter when the status isn't typing or idle, ErrNotFound when there's no session, and ErrServiceUnavailable when the registry has no session store.

func (*Registry) Speak added in v1.3.0

func (r *Registry) Speak(ctx context.Context, model llm.Model, text string, opts ...llm.Opt) (_ llm.Resource, _ llm.Usage, err error)

Speak returns the text, spoken, as audio, from the model's provider, which must be in the registry, and speak text, in the voice, by its ID, or its name, such as "Matilda", which is found in the model's voices. Returns ErrNotImplemented when the model is known not to speak, and the provider's error as providerErr does.

func (*Registry) Toolkit

func (r *Registry) Toolkit() *toolkit.Toolkit

Toolkit returns the toolkit of the tools which the registry's models can call, or nil when it has none

func (*Registry) Transcribe

func (r *Registry) Transcribe(ctx context.Context, model llm.Model, audio llm.Resource, stream llm.TranscriberStreamFn, opts ...llm.Opt) (_ llm.Transcript, _ llm.Usage, err error)

Transcribe returns the speech in the audio, from the model's provider, which must be in the registry, and transcribe audio, and streams its pieces to the function, when it isn't nil. Returns ErrNotImplemented when the model is known not to transcribe, and the provider's error as providerErr does.

func (*Registry) Translate

func (r *Registry) Translate(ctx context.Context, model llm.Model, audio llm.Resource, stream llm.TranscriberStreamFn, opts ...llm.Opt) (_ llm.Transcript, _ llm.Usage, err error)

Translate returns the speech in the audio as English text, from the model's provider, which must be in the registry, and transcribe audio. Returns ErrNotImplemented when the model can't translate, or is known not to, and the provider's error as providerErr does.

func (*Registry) TriggerEvent added in v1.2.0

func (r *Registry) TriggerEvent(ctx context.Context, req schema.EventRequest) (_ *schema.TriggerEventResponse, err error)

TriggerEvent schedules the event, from a source other than a heartbeat, such as a file which changed, or a webhook, to run, in the background, in the session of its source, for the session it's for, or a session of its own, when it has no source, as RunEvent runs it, and returns its outcome, which is scheduled, until it's run, when it's updated, as it's pending, or ignored, or failed, when it couldn't be run, with the error as its message. An event of a source which is scheduled already, for the session, isn't scheduled, so a burst of them runs once, and the outcome of that event is returned. Returns ErrBadParameter when it has no session, or prompt, ErrNotFound when there's no session, and ErrServiceUnavailable when the registry has no event store, in which its outcome is kept, or session store.

func (*Registry) UnloadModel

func (r *Registry) UnloadModel(ctx context.Context, model llm.Model) (err error)

UnloadModel unloads the model from memory, with its provider, which must be in the registry, and load models, keeping it stored, so its provider's models aren't listed again. Returns ErrNotImplemented when the provider doesn't load models, or can't unload them.

func (*Registry) UpdateAgent added in v0.6.0

func (r *Registry) UpdateAgent(ctx context.Context, name string, meta schema.AgentMeta) (_ *schema.Agent, err error)

UpdateAgent changes the definition of the agent with the name, as AgentMeta.Merge does: what the update sets is changed, its options are set, or removed, when they're null, and the rest is kept. Its name isn't changed: the update has no name, or the agent's, such as when it's the agent's whole definition. The definition, as changed, must be valid, as CreateAgent says, and a model, or tools, which are changed are the registry's, by their canonical names. Returns the agent. Returns ErrBadParameter when the update has another name, or changes nothing, or the definition, as changed, isn't valid, ErrNotFound when there's no agent, or the model, or a tool, isn't the registry's, ErrConflict when it was changed as it was updated, or a name is ambiguous, and ErrServiceUnavailable when the registry has no agent store.

func (*Registry) UpdateProvider

func (r *Registry) UpdateProvider(ctx context.Context, name string, meta schema.ProviderMeta) (_ *schema.ProviderStatus, err error)

UpdateProvider changes the provider with the name: its fields which can be set are replaced with the meta, apart from its API key, which is kept when the meta has none, as it isn't returned. Its type and name aren't changed. The provider is created again, as CreateProvider does, and replaces it, whether it can be reached or not, which it says, with its serial incremented, and watchers are sent that it was updated. A provider whose fields are the same is left as it is. Returns ErrNotFound when there's no provider with the name, ErrBadParameter when the meta isn't valid, and ErrConflict when the provider was added without a definition, such as with Add.

func (*Registry) UpdateSession added in v0.6.0

func (r *Registry) UpdateSession(ctx context.Context, id uuid.UUID, meta schema.SessionMeta) (_ *schema.Session, err error)

UpdateSession changes the settings of the session with the identifier, as SessionMeta.Merge does: what the update sets is changed, its options are set, or removed, when they're null, and the rest is kept, as are the session's messages. A model, or tools, which are changed are the registry's, by their canonical names, as CreateSession says. Returns the session. Returns ErrBadParameter when the update changes nothing, or the settings, as changed, aren't valid, ErrNotFound when there's no session, or the model, or a tool, isn't the registry's, ErrConflict when it was changed as it was updated, and ErrServiceUnavailable when the registry has no session store.

func (*Registry) Watch

func (r *Registry) Watch(ctx context.Context, filter schema.ChangeFilter, ch chan<- schema.Change) (<-chan error, error)

Watch sends the registry's broadcaster's changes which match the filter to the channel, as the broadcaster's Watch does. The registry's events are of providers: when one is created, or deleted, and updated, when whether it can be reached changes, or its models do, and of sessions: when one is created, deleted, or updated, as its settings change, messages are added to it, or its status changes. A broadcaster which others share sends their events too.

func (*Registry) WithSession added in v0.6.0

func (r *Registry) WithSession(ctx context.Context, session schema.Session, messages []llm.Message, stream llm.GeneratorStreamFn) (_ *schema.SessionResponse, err error)

WithSession asks the session's model, after its system prompt, with its options, tools and the schema of the reply, for its reply to the conversation, which is the session's messages, each with its tokens, when it has them, and the messages, as the agent loop does, which runs the tools the model calls. The messages can be any messages, which are kept as messages of the provider schema, with the data of their attachments read. Returns the messages to add to the session: the messages, and those the loop added, the last of which is the model's reply, each with its tokens; the tokens of the conversation, with them, of the messages sent to the model, of its replies, and of what's sent with them; and the usage. With a schema, the model's reply, when its result is stop, is JSON which conforms to it. The session isn't changed. The reply is streamed to the function as it's generated, when it isn't nil. Returns ErrBadParameter when the session, or the messages, aren't valid, ErrNotFound when the model, or a tool, isn't found, and the errors of AgentLoop.

func (*Registry) WithoutSession

func (r *Registry) WithoutSession(ctx context.Context, model llm.Model, messages []llm.Message, tools []llm.Tool, stream llm.GeneratorStreamFn, opts ...llm.Opt) (_ llm.Message, _ llm.Usage, err error)

WithoutSession returns the model's reply to the messages, from the model's provider, which must be in the registry, and generate messages, or the provider's error as providerErr does. Returns ErrNotImplemented, without asking the provider, when the model is known not to reply, or there are tools, and it's known not to call them, or the messages have images, and it's known not to see them. The options a model is known not to take, such as thinking, for a model which doesn't think, and the temperature, for one which doesn't take one, aren't sent, as a session keeps its options as its model changes.

type Reply added in v1.5.0

type Reply struct {
	Text      string
	Resources []toolschema.ResourceLink
}

Reply is a reply in a session: its text, and the resources it made, such as an image, or speech, which are the session's

type ReplyFunc added in v1.4.4

type ReplyFunc func(ctx context.Context, session uuid.UUID, reply Reply)

ReplyFunc is called with the session, and its model's reply, once Chat has stored it, or an event's outcome, once it's delivered to it

type Resources added in v1.3.0

type Resources interface {
	// Resource returns the resource with the URI, in the session, or on its
	// own, when it's nil, whose content is read from where it's kept.
	// Returns ErrNotFound when there's none.
	Resource(ctx context.Context, uri string, session *uuid.UUID) (llm.Resource, error)

	// Link links the resource with the URI, which is on its own, to the
	// session, so it's kept with it, and returns it, as the session's.
	// Returns ErrNotFound when there's no resource on its own with it, or
	// the session doesn't exist.
	Link(ctx context.Context, uri string, session uuid.UUID) (resourceschema.Resource, error)

	// Copy copies the resource with the URI, of the session it's from, to
	// the other session, so it's kept with it too, and returns it, as the
	// other session's. Returns ErrNotFound when the session it's from has no
	// resource with it, or the other session doesn't exist.
	Copy(ctx context.Context, uri string, from, to uuid.UUID) (resourceschema.Resource, error)

	// List returns the resources the request selects, such as a session's,
	// a page at a time
	List(ctx context.Context, req resourceschema.ResourceListRequest) (resourceschema.ResourceList, error)

	// Create keeps the content, as it's read, as a resource, which is what
	// the meta says, in its session, or on its own, and returns it, and
	// whether it was created, rather than there being one with its content
	// already
	Create(ctx context.Context, meta resourceschema.ResourceMeta, content io.Reader) (resourceschema.Resource, bool, error)
}

Resources are content, such as images, documents and audio, which is kept once, and referred to by its URI, which is resource:///<hash>, which is in a session, or on its own, such as the resource package's manager

type SessionStore added in v0.6.0

type SessionStore interface {
	// Create creates a session with the identifier, or a new one, when it's
	// the nil UUID, with the settings, and no messages, and returns it, with
	// its identifier, serial, and when it was created. Returns ErrConflict
	// when there's a session with the identifier.
	Create(ctx context.Context, id uuid.UUID, meta schema.SessionMeta) (schema.Session, error)

	// Get returns the session with the identifier, with its messages.
	// Returns ErrNotFound when there's none.
	Get(ctx context.Context, id uuid.UUID) (schema.Session, error)

	// List returns the sessions, without their messages, most recently
	// modified first, from the request's offset, and at most its limit of
	// them, and how many there are
	List(context.Context, schema.SessionListRequest) (schema.SessionList, error)

	// Put replaces the session with its identifier, when its serial is that
	// session's, and returns it, with its new serial, and when it was
	// modified. Returns ErrNotFound when there's none, and ErrConflict when
	// its serial isn't the session's, as it was changed since it was seen.
	Put(context.Context, schema.Session) (schema.Session, error)

	// Delete deletes the session with the identifier, when the serial is its
	// serial, or does nothing when there's none. Returns ErrConflict when the
	// serial isn't its serial, as it was changed since it was seen.
	Delete(ctx context.Context, id uuid.UUID, serial uint64) error

	// Watch sends the store's events to the channel, when its sessions are
	// changed by others, such as other servers, from when it returns, until
	// the context is cancelled, as the registry's Watch does: the table is
	// SessionTable, the row the session's identifier, and when it was
	// created or updated, the data is its serial, as a SessionEvent. It
	// returns a channel which is sent nil, or an error when the store stops,
	// once the watch has ended. A store which isn't changed by others, such
	// as files which only its server writes, sends no events.
	Watch(context.Context, chan<- eventschema.Change) (<-chan error, error)
}

SessionStore has sessions, each with its identifier and serial, which the store sets, and changes each time the session is stored, so a change is made to the session as it was last seen, rather than a newer one, such as when two replies are added to it at once

Directories

Path Synopsis
cmd
Package cmd has the registry's commands and flags
Package cmd has the registry's commands and flags
tui
Package tui is a terminal interface to chat in a session, which is a throwaway, until there's a better one
Package tui is a terminal interface to chat in a session, which is a throwaway, until there's a better one
Package httpclient is a client of the registry's HTTP API
Package httpclient is a client of the registry's HTTP API
Package httphandler has the registry's HTTP API
Package httphandler has the registry's HTTP API
Package schema has the requests and responses of the registry's API
Package schema has the requests and responses of the registry's API
Package test has a registry and a HTTP server of its API, for tests
Package test has a registry and a HTTP server of its API, for tests

Jump to

Keyboard shortcuts

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