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 ¶
- Variables
- func ConfigPath() string
- func DisplayText(s string, limit int) string
- func ModelName(ref SourceRef, name string) string
- func RemoveAllManagedPackages(id string) error
- func RemoveManagedPackage(pkg ManagedPackage) error
- func WriteNewSource(path string, ref SourceRef, c SourceConfig) error
- func WriteSource(path string, ref SourceRef, c *SourceConfig) error
- type Catalog
- type Config
- type Item
- type LarkAuthorizationStatus
- type LarkRelease
- type LarkServiceAuthorization
- type LarkSetup
- type LarkSourceOptions
- type MCPDraft
- type MCPEdit
- type ManagedPackage
- func InstallLarkRelease(ctx context.Context, version string) (ManagedPackage, error)
- func InstallManagedPackage(opts PackageInstallOptions) (ManagedPackage, error)
- func InstalledManagedPackage(id string) (ManagedPackage, bool)
- func ManagedPackageForExecutable(id, executable string) (ManagedPackage, bool)
- type Manager
- func (m *Manager) AddLark(ctx context.Context, setup LarkSetup) (err error)
- func (m *Manager) AddMCP(d MCPDraft) (err error)
- func (m *Manager) Approve(ref SourceRef) error
- func (m *Manager) ApproveSession(ref SourceRef) error
- func (m *Manager) AuthorizeMCP(ctx context.Context, ref SourceRef, open mcpauth.Open) error
- func (m *Manager) Close() error
- func (m *Manager) Config(ref SourceRef) (SourceConfig, error)
- func (m *Manager) ConfigureSource(ref SourceRef, cfg SourceConfig) error
- func (m *Manager) Connect(ctx context.Context, ref SourceRef) error
- func (m *Manager) Cwd() string
- func (m *Manager) Disable(ref SourceRef) error
- func (m *Manager) DisableReviewedMCP(edit MCPEdit) error
- func (m *Manager) Disconnect(ref SourceRef) error
- func (m *Manager) Enable(ref SourceRef) error
- func (m *Manager) EnableReviewedMCP(edit MCPEdit, remember bool) error
- func (m *Manager) EnabledSourceConfig(ref SourceRef, enabled bool) error
- func (m *Manager) HasSource(ref SourceRef) bool
- func (m *Manager) KnownTools() []agentcore.AgentTool
- func (m *Manager) List() []Snapshot
- func (m *Manager) Logs(ref SourceRef) (string, error)
- func (m *Manager) Observe(ev agentcore.AgentEvent)
- func (m *Manager) PackageSkills() map[string]string
- func (m *Manager) PackageViews() []PackageView
- func (m *Manager) PrepareMCPEdit(id string) (MCPEdit, error)
- func (m *Manager) ProbeLarkAuthorization(ctx context.Context) (LarkAuthorizationStatus, error)
- func (m *Manager) Prompt(ctx context.Context, ref SourceRef, name string, args map[string]string) (string, error)
- func (m *Manager) Refresh(ctx context.Context, ref SourceRef) error
- func (m *Manager) RefreshDirty(ctx context.Context)
- func (m *Manager) RemoveMCP(edit MCPEdit) error
- func (m *Manager) RemoveSource(ref SourceRef) error
- func (m *Manager) ReplaceReviewedMCP(edit MCPEdit, cfg SourceConfig) error
- func (m *Manager) ReplaceSourceConfig(ref SourceRef, cfg SourceConfig) error
- func (m *Manager) Reset(ref SourceRef) error
- func (m *Manager) Resource(ctx context.Context, ref SourceRef, uri string) (string, error)
- func (m *Manager) Revision() uint64
- func (m *Manager) SetSkillEnabled(name string, enabled bool) bool
- func (m *Manager) SetSkills(skills []*runtime.Skill, off bool)
- func (m *Manager) Setup(ctx context.Context, ref SourceRef, show func(setupevent.Event) error) error
- func (m *Manager) SetupVariant(ctx context.Context, ref SourceRef, variant string, ...) error
- func (m *Manager) Skill(name string) *runtime.Skill
- func (m *Manager) SkillRoots() []string
- func (m *Manager) SkillViews() []SkillView
- func (m *Manager) Skills() []*runtime.Skill
- func (m *Manager) Source(ref SourceRef) (Snapshot, bool)
- func (m *Manager) Tools() []agentcore.AgentTool
- func (m *Manager) UpdateMCPTarget(edit MCPEdit, draft MCPDraft) error
- type OfficialCLI
- type OfficialCLIInstallProgress
- type OfficialCLIInstallSpec
- type OfficialCLIInstaller
- type OfficialCLIKind
- type Options
- type PackageInstallOptions
- type PackageView
- type SkillView
- type Snapshot
- type SourceConfig
- type SourceRef
- type ToolView
Constants ¶
This section is empty.
Variables ¶
var ErrSourceCommitted = errors.New("source saved but live update failed")
ErrSourceCommitted reports that disk configuration was saved but the live manager could not adopt it; callers must retain any newly referenced secret.
Functions ¶
func ConfigPath ¶
func ConfigPath() string
func DisplayText ¶
DisplayText is for terminal-facing data, not for rewriting executable input.
func RemoveAllManagedPackages ¶ added in v1.5.49
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 WriteNewSource ¶ added in v1.5.62
func WriteNewSource(path string, ref SourceRef, c SourceConfig) error
WriteNewSource registers only an absent source, checking and writing under the same cross-process lock so concurrent CLI additions cannot overwrite it.
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 ¶
type LarkAuthorizationStatus ¶ added in v1.5.78
type LarkAuthorizationStatus struct {
Lark, Project LarkServiceAuthorization
}
type LarkRelease ¶ added in v1.5.62
LarkRelease identifies the exact first-party helper package the operator is asked to approve. Discovery does not download or execute anything.
func LarkReleaseFor ¶ added in v1.5.62
func LarkReleaseFor(version string) (LarkRelease, error)
LarkReleaseFor reports official URLs for a Golder release and the independent Lark version contained in that release.
type LarkServiceAuthorization ¶ added in v1.5.78
type LarkServiceAuthorization struct {
State string // authorized, required, unavailable, or unknown
}
LarkServiceAuthorization describes only a bounded status probe. Unknown is deliberately distinct from requiring login: network and CLI failures must not trigger a new authorization flow.
type LarkSetup ¶ added in v1.5.62
type LarkSetup struct {
Package ManagedPackage
LarkCLI string
ProjectCLI string
AppID string
AppSecret string
Domains []string
ProjectHost string
}
LarkSetup holds one transient operator-entered configuration. AppSecret is never put into the source table, transcript, command line or model context.
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 MCPDraft ¶ added in v1.5.62
type MCPDraft struct {
ID string
Transport string
Command string
Args []string
URL string
Network bool
OAuthClientID string
OAuthIssuer string
Env map[string]string `json:"-"`
Headers map[string]string `json:"-"`
}
MCPDraft is a transient operator-only import. Env and Headers may contain secrets and must never be logged, displayed in a transcript or marshalled.
func ParseMCPImport ¶ added in v1.5.62
ParseMCPImport accepts an mcpServers object or one server object. It performs no I/O and never includes untrusted configuration values in errors.
type MCPEdit ¶ added in v1.5.62
type MCPEdit struct {
ID string
Revision string
Config SourceConfig
}
MCPEdit is an operator-only snapshot. Config can contain legacy literal secrets: callers may show keys, but must never render or log Env/Headers.
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 InstallLarkRelease ¶ added in v1.5.62
func InstallLarkRelease(ctx context.Context, version string) (ManagedPackage, error)
InstallLarkRelease downloads the exact matching first-party release after an explicit operator decision and verifies the archive before installing it.
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 (*Manager) AddLark ¶ added in v1.5.62
AddLark writes one new, disabled Lark source after validating its installed helper and executable dependencies. Existing sources are never overwritten.
func (*Manager) AddMCP ¶ added in v1.5.62
AddMCP persists one disabled source and its private values. It rejects an existing ID while holding the cross-process config lock. Each inline value gets a new, unshared credential so rollback cannot delete another source's. No program is started and no remote server is contacted.
func (*Manager) ApproveSession ¶
ApproveSession must not become persistent when a later probe saves its catalog. Session admission and remembered trust are separate state.
func (*Manager) AuthorizeMCP ¶ added in v1.5.62
AuthorizeMCP runs an explicitly requested, operator-controlled OAuth flow. It is never called by tool execution or ordinary connection attempts.
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) DisableReviewedMCP ¶ added in v1.5.62
DisableReviewedMCP refuses to overwrite a newer source definition while persisting a disabled bit. Revocation precedes the disk update.
func (*Manager) Disconnect ¶
func (*Manager) EnableReviewedMCP ¶ added in v1.5.62
EnableReviewedMCP approves exactly the definition reviewed by the operator. The disk comparison and optional enabled-bit write share one interprocess lock, so a concurrent settings edit cannot be silently overwritten.
func (*Manager) EnabledSourceConfig ¶ added in v1.5.49
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
HasSource reports whether a source identity is currently registered.
func (*Manager) KnownTools ¶
KnownTools is used for validating explicit operator tool names before the allow/deny filter. It is never registered directly for execution.
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 ¶
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) PrepareMCPEdit ¶ added in v1.5.62
PrepareMCPEdit reads the current disk definition and refuses to edit a source whose in-memory definition differs from a different process's edit.
func (*Manager) ProbeLarkAuthorization ¶ added in v1.5.78
func (m *Manager) ProbeLarkAuthorization(ctx context.Context) (LarkAuthorizationStatus, error)
ProbeLarkAuthorization is an operator-initiated, fixed read-only status call. It cannot invoke arbitrary tools or authorize writes and retains the normal source approval, sandbox, tool policy, lifetime and fingerprint checks.
func (*Manager) RefreshDirty ¶
RefreshDirty only uses already-established sessions. No new process or connection can be introduced by a list_changed notification.
func (*Manager) RemoveMCP ¶ added in v1.5.62
RemoveMCP deletes only the confirmed current source definition and live source. Shared named credentials and source-scoped login state are retained.
func (*Manager) RemoveSource ¶ added in v1.5.49
RemoveSource forgets one live source after disconnecting it. Persistent login state is intentionally separate: Reset is the explicit destructive action.
func (*Manager) ReplaceReviewedMCP ¶ added in v1.5.62
func (m *Manager) ReplaceReviewedMCP(edit MCPEdit, cfg SourceConfig) error
ReplaceReviewedMCP atomically replaces a complete reviewed definition. The new configuration is disabled and must receive a new approval.
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
Reset clears only this source HOME, with its persistent parent lock retained. The caller must obtain a separate explicit operator confirmation.
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 (*Manager) SkillRoots ¶
func (*Manager) SkillViews ¶
func (*Manager) Source ¶ added in v1.5.49
Source returns one safe snapshot, or false when it is not configured.
func (*Manager) UpdateMCPTarget ¶ added in v1.5.62
UpdateMCPTarget replaces the reviewed connection and environment/header values while retaining advanced source capabilities. An edit always disables the source and invalidates its previous approval.
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 OfficialCLIInstallProgress ¶ added in v1.5.74
type OfficialCLIInstallProgress struct {
Kind OfficialCLIKind
Phase string // checking, connecting, downloading, verifying, extracting, installing, complete
Downloaded int64
Total int64
}
OfficialCLIInstallProgress contains no credentials, URLs or archive content. Total is zero when the server does not advertise a download size. Downloaded measures archive bytes, not verification or installation completion.
type OfficialCLIInstallSpec ¶ added in v1.5.57
type OfficialCLIInstaller ¶ added in v1.5.57
type OfficialCLIInstaller struct {
Client *http.Client
Root string
GOOS string
GOARCH string
Specs map[OfficialCLIKind]OfficialCLIInstallSpec
// Progress is called synchronously on the installing goroutine. Callers
// dispatch UI updates themselves; callbacks must not block the download.
Progress func(OfficialCLIInstallProgress)
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
func (i *OfficialCLIInstaller) Install(ctx context.Context, kind OfficialCLIKind) (OfficialCLI, error)
type OfficialCLIKind ¶ added in v1.5.57
type OfficialCLIKind string
const ( OfficialLarkCLI OfficialCLIKind = "lark-cli" OfficialProjectCLI OfficialCLIKind = "meegle" )
type PackageInstallOptions ¶ added in v1.5.49
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 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"`
OAuthClientID string `toml:"oauth_client_id,omitempty" json:"oauth_client_id,omitempty"`
OAuthIssuer string `toml:"oauth_issuer,omitempty" json:"oauth_issuer,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.
Source Files
¶
- backends.go
- capabilities.go
- catalog.go
- config.go
- events.go
- firstparty.go
- lark_authorization_status.go
- lark_release.go
- lark_setup.go
- lark_state_backend.go
- manage.go
- manifest.go
- mcp_import.go
- mcp_manage.go
- official_cli.go
- official_cli_progress.go
- packages.go
- process.go
- process_unix.go
- service.go
- setup.go
- skills.go
- source_redact.go
- state.go
- state_unix.go
- tool.go