extensions

package
v1.5.60 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 47 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 extensions owns the host-side extension boundary. Discovery does not execute code; approved sources are connected only explicitly or after a tool gate.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigPath

func ConfigPath() string

func DisplayText

func DisplayText(s string, limit int) string

DisplayText is for terminal-facing data, not for rewriting executable input.

func ModelName

func ModelName(ref SourceRef, name string) string

ModelName is deterministic even when multiple wire names sanitize alike.

func RemoveAllManagedPackages added in v1.5.49

func RemoveAllManagedPackages(id string) error

RemoveAllManagedPackages removes every valid installed version for one first-party package. An unexpected directory fails closed instead of turning uninstall into an arbitrary recursive delete.

func RemoveManagedPackage added in v1.5.49

func RemoveManagedPackage(pkg ManagedPackage) error

RemoveManagedPackage removes only the exact registered package root. Source config and login state are separate explicit operations.

func WriteSource

func WriteSource(path string, ref SourceRef, c *SourceConfig) error

WriteSource edits just one canonical source table, preserving unrelated tables/comments. Noncanonical dotted/inline representations fail closed.

Types

type Catalog

type Catalog struct {
	Protocol  string               `json:"protocol,omitempty"`
	Version   string               `json:"version,omitempty"`
	Tools     []extension.ToolSpec `json:"tools"`
	Commands  []Item               `json:"commands,omitempty"`
	Events    []string             `json:"events,omitempty"`
	Prompts   []Item               `json:"prompts,omitempty"`
	Resources []Item               `json:"resources,omitempty"`
}

type Config

type Config struct {
	Plugins map[string]SourceConfig `toml:"plugins"`
	MCP     struct {
		Servers map[string]SourceConfig `toml:"servers"`
	} `toml:"mcp"`
}

func LoadConfig

func LoadConfig(path string) (Config, error)

type Item

type Item struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	URI         string `json:"uri,omitempty"`
}

type LarkSourceOptions added in v1.5.49

type LarkSourceOptions struct {
	Package             ManagedPackage
	LarkCLI             string
	ProjectCLI          string
	AppID               string
	AppSecretCredential string
	Domains             []string
	ProjectHost         string
}

LarkSourceOptions is the non-secret configuration collected by the GUI. AppSecretCredential names a value in .credentials.yaml; no secret is accepted.

type ManagedPackage added in v1.5.49

type ManagedPackage struct {
	ID         string `json:"id"`
	Version    string `json:"version"`
	Executable string `json:"executable"`
	SHA256     string `json:"sha256"`
	Root       string `json:"root"`
}

ManagedPackage is one checksum-verified first-party helper installed below the protected Golder state root.

func InstallManagedPackage added in v1.5.49

func InstallManagedPackage(opts PackageInstallOptions) (ManagedPackage, error)

InstallManagedPackage copies a signed-bundle helper into a versioned private directory and verifies its SHA-256 before the atomic directory rename.

func InstalledManagedPackage added in v1.5.49

func InstalledManagedPackage(id string) (ManagedPackage, bool)

InstalledManagedPackage returns the newest valid installed version.

func ManagedPackageForExecutable added in v1.5.55

func ManagedPackageForExecutable(id, executable string) (ManagedPackage, bool)

ManagedPackageForExecutable resolves an active Source command to the exact verified managed package it belongs to. It never trusts a version parsed from the path alone: package.json and the installed executable hash must validate.

type Manager

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

func New

func New(opts Options) (*Manager, error)

func (*Manager) Approve

func (m *Manager) Approve(ref SourceRef) error

func (*Manager) ApproveSession

func (m *Manager) ApproveSession(ref SourceRef) error

ApproveSession must not become persistent when a later probe saves its catalog. Session admission and remembered trust are separate state.

func (*Manager) Close

func (m *Manager) Close() error

func (*Manager) Config

func (m *Manager) Config(ref SourceRef) (SourceConfig, error)

func (*Manager) ConfigureSource added in v1.5.49

func (m *Manager) ConfigureSource(ref SourceRef, cfg SourceConfig) error

ConfigureSource installs or replaces one already-reviewed source definition in this Manager. It does not approve, enable or execute the source. Callers persist the same definition with WriteSource first, so a process crash cannot leave an in-memory extension that the next launch does not know about.

func (*Manager) Connect

func (m *Manager) Connect(ctx context.Context, ref SourceRef) error

func (*Manager) Cwd

func (m *Manager) Cwd() string

func (*Manager) Disable

func (m *Manager) Disable(ref SourceRef) error

func (*Manager) Disconnect

func (m *Manager) Disconnect(ref SourceRef) error

func (*Manager) Enable

func (m *Manager) Enable(ref SourceRef) error

func (*Manager) EnabledSourceConfig added in v1.5.49

func (m *Manager) EnabledSourceConfig(ref SourceRef, enabled bool) error

EnabledSourceConfig persists only the enabled bit of a source configuration. It is used after an explicit GUI/CLI approval, never during discovery.

func (*Manager) HasSource added in v1.5.49

func (m *Manager) HasSource(ref SourceRef) bool

HasSource reports whether a source identity is currently registered.

func (*Manager) KnownTools

func (m *Manager) KnownTools() []agentcore.AgentTool

KnownTools is used for validating explicit operator tool names before the allow/deny filter. It is never registered directly for execution.

func (*Manager) List

func (m *Manager) List() []Snapshot

func (*Manager) Logs

func (m *Manager) Logs(ref SourceRef) (string, error)

func (*Manager) Observe

func (m *Manager) Observe(ev agentcore.AgentEvent)

Observe only queues host-owned metadata. Message bodies, tool arguments and result text are never copied into an extension event subscription.

func (*Manager) PackageSkills

func (m *Manager) PackageSkills() map[string]string

PackageSkills returns only approved enabled package roots. Independent skills retain their existing discovery order and win same-name collisions upstream.

func (*Manager) PackageViews added in v1.5.45

func (m *Manager) PackageViews() []PackageView

PackageViews returns the small first-party package catalog. These rows make a shipped-but-unconfigured package discoverable without turning discovery into installation or source authority.

func (*Manager) Prompt

func (m *Manager) Prompt(ctx context.Context, ref SourceRef, name string, args map[string]string) (string, error)

func (*Manager) Refresh

func (m *Manager) Refresh(ctx context.Context, ref SourceRef) error

func (*Manager) RefreshDirty

func (m *Manager) RefreshDirty(ctx context.Context)

RefreshDirty only uses already-established sessions. No new process or connection can be introduced by a list_changed notification.

func (*Manager) RemoveSource added in v1.5.49

func (m *Manager) RemoveSource(ref SourceRef) error

RemoveSource forgets one live source after disconnecting it. Persistent login state is intentionally separate: Reset is the explicit destructive action.

func (*Manager) ReplaceSourceConfig added in v1.5.55

func (m *Manager) ReplaceSourceConfig(ref SourceRef, cfg SourceConfig) error

ReplaceSourceConfig persists and activates one replacement definition. The resulting Source is always disabled and unapproved; private state_dir data and named credentials are outside the definition and are deliberately untouched.

func (*Manager) Reset added in v1.5.16

func (m *Manager) Reset(ref SourceRef) error

Reset clears only this source HOME, with its persistent parent lock retained. The caller must obtain a separate explicit operator confirmation.

func (*Manager) Resource

func (m *Manager) Resource(ctx context.Context, ref SourceRef, uri string) (string, error)

func (*Manager) Revision

func (m *Manager) Revision() uint64

func (*Manager) SetSkillEnabled

func (m *Manager) SetSkillEnabled(name string, enabled bool) bool

func (*Manager) SetSkills

func (m *Manager) SetSkills(skills []*runtime.Skill, off bool)

func (*Manager) Setup added in v1.5.16

func (m *Manager) Setup(ctx context.Context, ref SourceRef, show func(setupevent.Event) error) error

Setup is an explicit operator action, never a model tool or handshake side effect. Its callback runs as events arrive, while the child keeps polling.

func (*Manager) SetupVariant added in v1.5.16

func (m *Manager) SetupVariant(ctx context.Context, ref SourceRef, variant string, show func(setupevent.Event) error) error

func (*Manager) Skill

func (m *Manager) Skill(name string) *runtime.Skill

func (*Manager) SkillRoots

func (m *Manager) SkillRoots() []string

func (*Manager) SkillViews

func (m *Manager) SkillViews() []SkillView

func (*Manager) Skills

func (m *Manager) Skills() []*runtime.Skill

func (*Manager) Source added in v1.5.49

func (m *Manager) Source(ref SourceRef) (Snapshot, bool)

Source returns one safe snapshot, or false when it is not configured.

func (*Manager) Tools

func (m *Manager) Tools() []agentcore.AgentTool

type OfficialCLI added in v1.5.57

type OfficialCLI struct {
	Kind       OfficialCLIKind
	Version    string
	Executable string
}

func DiscoverOfficialCLI added in v1.5.57

func DiscoverOfficialCLI(kind OfficialCLIKind, preferred string) (OfficialCLI, bool)

type OfficialCLIInstallSpec added in v1.5.57

type OfficialCLIInstallSpec struct {
	Version     string
	ArchiveURL  string
	SHA256      string
	SHA512      string
	ArchivePath string
	BinaryName  string
}

type OfficialCLIInstaller added in v1.5.57

type OfficialCLIInstaller struct {
	Client              *http.Client
	Root                string
	GOOS                string
	GOARCH              string
	Specs               map[OfficialCLIKind]OfficialCLIInstallSpec
	AllowHTTP           bool // tests only
	SkipCommonDiscovery bool // tests only
}

func NewOfficialCLIInstaller added in v1.5.57

func NewOfficialCLIInstaller() *OfficialCLIInstaller

func (*OfficialCLIInstaller) Discover added in v1.5.57

func (i *OfficialCLIInstaller) Discover(kind OfficialCLIKind, preferred string) (OfficialCLI, bool)

func (*OfficialCLIInstaller) Install added in v1.5.57

type OfficialCLIKind added in v1.5.57

type OfficialCLIKind string
const (
	OfficialLarkCLI    OfficialCLIKind = "lark-cli"
	OfficialProjectCLI OfficialCLIKind = "meegle"
)

type Options

type Options struct {
	Cwd           string
	ConfigPath    string
	Allow         func(string) bool
	Permissions   *permissions.State
	NoTools       bool
	IgnoreSources bool // embedders opt in separately from built-in tools
}

type PackageInstallOptions added in v1.5.49

type PackageInstallOptions struct {
	ID      string
	Version string
	Source  string
	SHA256  string
}

PackageInstallOptions is fixed by the signed GUI package. ID is checked against the first-party registry; Source and SHA256 must refer to the bundled helper, never a URL or model-provided path.

type PackageView added in v1.5.45

type PackageView struct {
	ID          string    `json:"id"`
	Name        string    `json:"name"`
	Type        string    `json:"type"`
	Description string    `json:"description"`
	Source      SourceRef `json:"source"`
	State       string    `json:"state"`
	Executable  string    `json:"executable,omitempty"`
	Version     string    `json:"version,omitempty"`
	Configured  bool      `json:"configured"`
	NextAction  string    `json:"next_action"`
	Docs        string    `json:"docs"`
}

PackageView is a first-party extension package Golder knows how to host but never installs, registers, enables or executes by discovery alone.

type SkillView

type SkillView struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Path        string `json:"path"`
	State       string `json:"state"`
	ProvidedBy  string `json:"provided_by,omitempty"`
}

type Snapshot

type Snapshot struct {
	Ref            SourceRef      `json:"source"`
	Type           string         `json:"type"`
	Enabled        bool           `json:"enabled"`
	Trust          string         `json:"trust"`
	State          string         `json:"state"`
	Authentication string         `json:"authentication"`
	Endpoint       string         `json:"endpoint,omitempty"`
	Version        string         `json:"version,omitempty"`
	Protocol       string         `json:"protocol,omitempty"`
	LastError      string         `json:"last_error,omitempty"`
	Tools          []ToolView     `json:"tools"`
	Commands       []Item         `json:"commands,omitempty"`
	Events         []string       `json:"events,omitempty"`
	Prompts        []Item         `json:"prompts,omitempty"`
	Resources      []Item         `json:"resources,omitempty"`
	Revision       uint64         `json:"revision"`
	Capabilities   map[string]any `json:"capabilities,omitempty"`
}

type SourceConfig

type SourceConfig struct {
	Enabled         bool                `toml:"enabled" json:"enabled"`
	Runtime         string              `toml:"runtime,omitempty" json:"runtime,omitempty"`
	Manifest        string              `toml:"manifest,omitempty" json:"manifest,omitempty"`
	Transport       string              `toml:"transport,omitempty" json:"transport,omitempty"`
	Command         string              `toml:"command,omitempty" json:"command,omitempty"`
	Args            []string            `toml:"args,omitempty" json:"args,omitempty"`
	URL             string              `toml:"url,omitempty" json:"url,omitempty"`
	Dir             string              `toml:"dir,omitempty" json:"dir,omitempty"`
	Env             map[string]string   `toml:"env,omitempty" json:"env,omitempty"`
	EnvPassthrough  []string            `toml:"env_passthrough,omitempty" json:"env_passthrough,omitempty"`
	Headers         map[string]string   `toml:"headers,omitempty" json:"headers,omitempty"`
	AllowedTools    []string            `toml:"allowed_tools,omitempty" json:"allowed_tools,omitempty"`
	DisallowedTools []string            `toml:"disallowed_tools,omitempty" json:"disallowed_tools,omitempty"`
	StartupTimeout  string              `toml:"startup_timeout,omitempty" json:"startup_timeout,omitempty"`
	CallTimeout     string              `toml:"call_timeout,omitempty" json:"call_timeout,omitempty"`
	Network         bool                `toml:"network,omitempty" json:"network,omitempty"`
	StateDir        bool                `toml:"state_dir,omitempty" json:"state_dir,omitempty"`
	Setup           []string            `toml:"setup,omitempty" json:"setup,omitempty"`
	SetupVariants   map[string][]string `toml:"setup_variants,omitempty" json:"setup_variants,omitempty"`
	SetupOrigins    []string            `toml:"setup_origins,omitempty" json:"setup_origins,omitempty"`
	Executables     []string            `toml:"executables,omitempty" json:"executables,omitempty"`
	Skills          string              `toml:"skills,omitempty" json:"skills,omitempty"`
	ConfirmTools    []string            `toml:"confirm_tools,omitempty" json:"confirm_tools,omitempty"`
	AggregateTools  []string            `toml:"aggregate_tools,omitempty" json:"aggregate_tools,omitempty"`
	// contains filtered or unexported fields
}

SourceConfig is an operator declaration, never a model argument. Network is the immutable launch ceiling of a local process, not a per-call grant.

func LarkSourceConfig added in v1.5.49

func LarkSourceConfig(opts LarkSourceOptions) (SourceConfig, error)

LarkSourceConfig builds the fixed first-party source declaration. The only variable executable paths are explicit native CLI selections included in the fingerprint and sandbox capability list.

type SourceRef

type SourceRef = extension.SourceRef

type ToolView

type ToolView struct {
	Spec      extension.ToolSpec `json:"spec"`
	ModelName string             `json:"model_name"`
	State     string             `json:"state"`
	Reason    string             `json:"reason,omitempty"`
}

Jump to

Keyboard shortcuts

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