modules

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 10 Imported by: 0 modules, 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 modules defines the daemon's modules and the set that owns them.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownSetting = errors.New("unknown setting")
	ErrInvalidSetting = errors.New("invalid setting")
)

Functions

func OnOff added in v0.2.0

func OnOff(on bool) string

OnOff is a toggle's value.

func Toggle added in v0.2.0

func Toggle(value string) (bool, error)

Toggle reads a toggle's value.

func Unknown added in v0.2.0

func Unknown(path []string) error

Unknown is the error for a path no item has.

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

type ChangeRequest struct {
	Path  []string `json:"path"`
	Value string   `json:"value,omitempty"`
}

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).

func Find added in v0.2.0

func Find(items []Item, path []string) (Item, bool)

Find is the item at path among items.

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.

func Static added in v0.2.0

func Static(id string, title string, executors ...tools.Executor) Module

Static is a module with fixed tools and no settings.

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 NewSet added in v0.2.0

func NewSet(base []tools.Executor, modules ...Module) (*Set, error)

func (*Set) Apply added in v0.2.0

func (s *Set) Apply(ctx context.Context, cfg setup.Config) error

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) Close added in v0.2.0

func (s *Set) Close() error

func (*Set) ConcurrencyKey added in v0.2.0

func (s *Set) ConcurrencyKey(toolID string, call tools.Call) string

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.

func (*Set) Execute added in v0.2.0

func (s *Set) Execute(ctx context.Context, toolID string, call tools.Call) (tools.Result, error)

func (*Set) List added in v0.2.0

func (s *Set) List() []tools.Spec

func (*Set) Preview added in v0.2.0

func (s *Set) Preview(ctx context.Context, toolID string, call tools.Call) (tools.ApprovalRequest, *tools.Result)

func (*Set) ReadsOnly added in v0.2.1

func (s *Set) ReadsOnly(toolID string, call tools.Call) bool

func (*Set) Settings added in v0.2.0

func (s *Set) Settings(ctx context.Context, id string) (Settings, bool)

Settings is the settings screen of the module with id.

func (*Set) Spec added in v0.2.0

func (s *Set) Spec(toolID string) (tools.Spec, bool)

func (*Set) Statuses added in v0.2.0

func (s *Set) Statuses(ctx context.Context) []Status

Context is the modules' system prompt paragraphs.

func (*Set) Subjects added in v0.2.1

func (s *Set) Subjects(toolID string, call tools.Call) []permission.Subject

type Settings added in v0.2.0

type Settings struct {
	Status Status `json:"status"`
	Items  []Item `json:"items"`
}

Settings is a module's screen: GET /v1/modules/{id}/settings.

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 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.

Jump to

Keyboard shortcuts

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