Documentation
¶
Overview ¶
Package modules defines the daemon's modules and the set that owns them.
Index ¶
- Variables
- func OnOff(on bool) string
- func Toggle(value string) (bool, error)
- func Unknown(path []string) error
- type Change
- type ChangeRequest
- type ChangeResponse
- type Configurable
- type Fact
- type Item
- type ItemKind
- type Module
- type Option
- type Set
- func (s *Set) Apply(ctx context.Context, cfg setup.Config) error
- func (s *Set) Close() error
- func (s *Set) ConcurrencyKey(toolID string, call tools.Call) string
- func (s *Set) Configurable(id string) (Configurable, bool)
- func (s *Set) Execute(ctx context.Context, toolID string, call tools.Call) (tools.Result, error)
- func (s *Set) List() []tools.Spec
- func (s *Set) Preview(ctx context.Context, toolID string, call tools.Call) (tools.ApprovalRequest, *tools.Result)
- func (s *Set) ReadsOnly(toolID string, call tools.Call) bool
- func (s *Set) Settings(ctx context.Context, id string) (Settings, bool)
- func (s *Set) Spec(toolID string) (tools.Spec, bool)
- func (s *Set) Statuses(ctx context.Context) []Status
- func (s *Set) Subjects(toolID string, call tools.Call) []permission.Subject
- type Settings
- type Status
- type StatusResponse
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnknownSetting = errors.New("unknown setting") ErrInvalidSetting = errors.New("invalid setting") )
Functions ¶
Types ¶
type Change ¶ added in v0.2.0
type Change struct {
Config func(*setup.Config) error // nil when setup.json stays as it is
// Reload applies the setup again though it did not change: what the
// modules offer depends on something the change installed or removed.
Reload bool
Open []string // nil: the changed item's page
Message string
}
Change is what a settings change does to setup.json and which page the client shows next.
type ChangeRequest ¶ added in v0.2.0
ChangeRequest is the body of POST /v1/modules/{id}/settings.
type ChangeResponse ¶ added in v0.2.0
type ChangeResponse struct {
Settings Settings `json:"settings"`
Open []string `json:"open,omitempty"`
Message string `json:"message,omitempty"`
}
ChangeResponse answers a change with the screen after it.
type Configurable ¶ added in v0.2.0
type Configurable interface {
// Settings are the screen's rows; building them may probe (the user asked).
Settings(ctx context.Context) []Item
// Change sets the item at path to value (empty for an action). Slow work
// such as a download runs here; the setup.json edit is returned.
Change(ctx context.Context, path []string, value string) (Change, error)
}
Configurable is a module with a settings screen that clients render without knowing the module.
type Fact ¶ added in v0.2.0
type Fact struct {
Key string `json:"key"`
Label string `json:"label"`
Value string `json:"value"`
}
Fact is one labelled value of a module's status.
type Item ¶ added in v0.2.0
type Item struct {
Key string `json:"key"`
Kind ItemKind `json:"kind"`
Label string `json:"label"`
Value string `json:"value,omitempty"`
Display string `json:"display,omitempty"` // shown next to the label
Hint string `json:"hint,omitempty"` // prompt placeholder, or why it is disabled
Confirm string `json:"confirm,omitempty"` // ask before running an action
Danger bool `json:"danger,omitempty"`
Disabled bool `json:"disabled,omitempty"`
Options []Option `json:"options,omitempty"`
Items []Item `json:"items,omitempty"`
Facts []Fact `json:"facts,omitempty"`
}
Item is one row of a settings screen. Key is one path segment ([a-z0-9_.-], unique among its siblings).
type ItemKind ¶ added in v0.2.0
type ItemKind string
ItemKind is how a client shows and edits an Item.
const ( ItemToggle ItemKind = "toggle" // Value is "on" or "off" ItemChoice ItemKind = "choice" // Value is one of Options ItemText ItemKind = "text" // free text; an empty value clears it ItemSecret ItemKind = "secret" // never sent back; Display is a masked preview ItemAction ItemKind = "action" // changed with an empty value ItemPage ItemKind = "page" // a page of Items ItemInfo ItemKind = "info" // read-only Facts )
type Module ¶
type Module interface {
ID() string
// Apply makes the module follow cfg. It is called at start and after
// every setup change, one call at a time, and is cheap when the module's
// part of cfg did not change.
Apply(ctx context.Context, cfg setup.Config) error
// Tools are the tools the module offers now; none while it is off.
Tools() []tools.Executor
// Status describes the module without network calls beyond cached ones.
Status(ctx context.Context) Status
Close() error
}
Module is a daemon feature configured from setup.json.
type Option ¶ added in v0.2.0
type Option struct {
Value string `json:"value"`
Label string `json:"label"`
Info string `json:"info,omitempty"`
Group string `json:"group,omitempty"`
Confirm string `json:"confirm,omitempty"` // ask before choosing it
Disabled bool `json:"disabled,omitempty"`
}
Option is one value of a choice; options with a Group are picked group first (a language, then a voice).
type Set ¶ added in v0.2.0
type Set struct {
// contains filtered or unexported fields
}
Set owns the daemon's modules and serves their tools, with the base tools, as the core's tool executor.
func (*Set) Apply ¶ added in v0.2.0
Apply applies cfg to every module and then offers the tools they offer now. A module that fails keeps its previous state; the others still apply. A tool whose id is taken is left out, logged and shown in its module's Status.
func (*Set) ConcurrencyKey ¶ added in v0.2.0
func (*Set) Configurable ¶ added in v0.2.0
func (s *Set) Configurable(id string) (Configurable, bool)
Configurable is the module with id when it has a settings screen.
type Status ¶ added in v0.2.0
type Status struct {
ID string `json:"id"`
Title string `json:"title"`
Enabled bool `json:"enabled"`
Ready bool `json:"ready"`
State string `json:"state"`
Detail string `json:"detail,omitempty"`
Facts []Fact `json:"facts,omitempty"`
Tools []string `json:"tools,omitempty"`
// Settings tells that the module has a settings screen (Configurable).
Settings bool `json:"settings,omitempty"`
}
Status is a module's state in a shape any client can render.
type StatusResponse ¶ added in v0.2.0
type StatusResponse struct {
Modules []Status `json:"modules"`
}
StatusResponse is the body of GET /v1/modules.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package browser is the module of the local Playwright browser, whose tools the MCP module serves.
|
Package browser is the module of the local Playwright browser, whose tools the MCP module serves. |
|
Package geo offers OpenStreetMap reverse geocoding and nearby place search.
|
Package geo offers OpenStreetMap reverse geocoding and nearby place search. |
|
Package image is the module that generates images through a configured provider's OpenAI-compatible images endpoint.
|
Package image is the module that generates images through a configured provider's OpenAI-compatible images endpoint. |
|
Package mcp is the module serving the tools of configured MCP servers, the local browser's included.
|
Package mcp is the module serving the tools of configured MCP servers, the local browser's included. |
|
Package telephony is the module that places phone calls through the telephony gateway.
|
Package telephony is the module that places phone calls through the telephony gateway. |
|
Package voice is the local text-to-speech and speech-to-text modules.
|
Package voice is the local text-to-speech and speech-to-text modules. |
|
realtime/providers/gemini
Package gemini is the Gemini Live realtime voice provider.
|
Package gemini is the Gemini Live realtime voice provider. |
|
realtime/providers/grok
Package grok is the xAI Grok Voice realtime voice provider.
|
Package grok is the xAI Grok Voice realtime voice provider. |
|
realtime/providers/openai
Package openai is the OpenAI Realtime voice provider.
|
Package openai is the OpenAI Realtime voice provider. |
|
Package web is the module offering web_search and web_fetch.
|
Package web is the module offering web_search and web_fetch. |