plugins

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 96 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 plugins discovers, loads, installs and dispatches icebath plugins through one registration context

Index

Constants

View Source
const (
	PluginSchemaV1 = "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json"
	MCPSchemaV1    = "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json"
)

Schema ids of the portable Agent Plugins v1 manifests

View Source
const (
	GrantedCapabilitiesKey = "granted_capabilities"
	CapabilitiesConsentKey = "capabilities_consent"
)

Config keys under plugins.entries.<id> holding consent state

View Source
const (
	LoginBackendRule = "password-manager login backends are accepted only from plugins bundled with Icebath or " +
		"installed from the Icebath plugin catalog at tier verified or official (published by the " +
		"password-manager vendor itself or by icebath)"
	BrowserPageBackendRule = "browser page backends (which carry browser_vault fill scripts) are accepted only from " +
		"plugins bundled with Icebath or installed from the Icebath plugin catalog at tier " +
		"verified or official"
)
View Source
const (
	LiveCatalogTTLSeconds        = 6 * 60 * 60
	LiveCatalogFailureTTLSeconds = 60.0
)
View Source
const (
	DefaultSystemPromptSectionMaxChars = 4000
	MaxSystemPromptSectionChars        = 4000
	MaxSystemPromptSections            = 32
	MaxSystemPromptSectionsTotalChars  = 8000

	PluginSectionsStart = "<!-- icebath-plugin-sections:start -->"
	PluginSectionsEnd   = "<!-- icebath-plugin-sections:end -->"
)
View Source
const (
	RuntimeWasm    = "wasm"
	RuntimeProgram = "program"
)

Forms a third party plugin takes

View Source
const (
	GuestPluginNameEnv = "ICEBATH_PLUGIN_NAME"
	GuestPluginDirEnv  = "ICEBATH_PLUGIN_DIR"
)

Environment variables telling an external program plugin which plugin it runs as

View Source
const (
	HostProcessEnv     = "ICEBATH_PLUGIN_HOST_PROCESS"
	HostDenyNetworkEnv = "ICEBATH_PLUGIN_HOST_DENY_NETWORK"
	HostLogLevelEnv    = "ICEBATH_PLUGIN_HOST_LOG_LEVEL"
)
View Source
const (
	CategoryMemoryProvider      = "memory_provider"
	CategoryContextEngine       = "context_engine"
	CategoryCronScheduler       = "cron_scheduler"
	CategoryComputerUseProvider = "computer_use_provider"
)

Categories a wasm or program plugin is found under by the category that selects it

View Source
const (
	ObserverSchemaVersion   = "icebath.observer.v1"
	MiddlewareSchemaVersion = "icebath.middleware.v1"
	ToolRequestMiddleware   = "tool_request"
	ToolExecutionMiddleware = "tool_execution"
	LLMRequestMiddleware    = "llm_request"
	LLMExecutionMiddleware  = "llm_execution"
)
View Source
const (
	OutboundWebhookDefaultTimeoutSeconds = 10
	OutboundWebhookMaxTimeoutSeconds     = 60
	OutboundWebhookMaxDeliveryAttempts   = 2

	OutboundWebhookQueueMaxSize = 256
)
View Source
const (
	ActionsContractVersion   = 1
	PlatformActionCapability = "gateway.platform_actions"
)
View Source
const (
	ShellHookDefaultTimeoutSeconds = 60
	ShellHookMaxTimeoutSeconds     = 300
	ShellHookAllowlistFilename     = "shell-hooks-allowlist.json"
	ShellHookBlockExitCode         = 2
)
View Source
const CatalogSidecar = ".icebath-catalog.json"
View Source
const CloneTimeoutHint = "On a slow connection, raise plugins.clone_timeout_seconds in config.yaml."

Advice a clone timeout ends with

View Source
const (
	CoreEventNamespace = "icebath"
)
View Source
const EnvEnableProjectPlugins = "ICEBATH_ENABLE_PROJECT_PLUGINS"

Environment variable enabling project local plugin discovery

View Source
const EnvSafeMode = "ICEBATH_SAFE_MODE"

Environment variable that skips every plugin and user hook

View Source
const ImageHostSuffix = ".githubusercontent.com"

Host suffix every GitHub user content host shares

View Source
const InBothLists = "listed in both plugins.enabled and plugins.disabled — disabled wins"

Error recorded for a plugin listed in both the enabled and the disabled list

View Source
const LiveCatalogMaxStaleSeconds = 24 * 60 * 60
View Source
const PluginEventPrefix = "plugin."

Prefix every plugin event name starts with, core owning every other name

View Source
const PluginFormsText = "icebath loads plugins built in, as WebAssembly modules (runtime: wasm) or as external programs (runtime: program)"

Sentence naming every form icebath loads a plugin in

View Source
const PluginScannerVersion = "plugin-guard-v12"
View Source
const PortableExtension = "app.icebath"

Vendor extension namespace carrying icebath specific portable fields

View Source
const ProtocolVersion = 1
View Source
const (
	PublicContractVersion = 1
)
View Source
const SessionResetConfigKey = "session_reset"

Config block the session reset plugin reads

View Source
const SessionResetPluginName = "icebath-session-reset-policy"

Catalog plugin that applies idle and daily session resets

View Source
const StreamHoldingHook = "transform_llm_output"
View Source
const SupportedManifestVersion = 2

Highest manifest schema version this build understands

Variables

View Source
var Advisories = []Advisory{
	{
		ID:    "shai-hulud-2026-05",
		Title: "Mini Shai-Hulud worm — mistralai 2.4.6 compromised on PyPI",
		Summary: "PyPI quarantined the mistralai package on 2026-05-12 after a " +
			"malicious 2.4.6 release. The worm steals credentials from " +
			"environment variables and credential files (~/.npmrc, ~/.pypirc, " +
			"~/.aws/credentials, GitHub PATs, cloud SDK tokens) and exfils " +
			"them to a hardcoded webhook. If you ran any Python process that " +
			"imported mistralai 2.4.6 — including a Python plugin or tool " +
			"runtime icebath ran from its managed environment — assume those credentials " +
			"are exposed. PyPI has since removed 2.4.6 and the project ships " +
			"clean releases again (2.4.7, 2.4.8); this advisory only fires if " +
			"the compromised 2.4.6 is still installed in that environment.",
		URL:         "https://socket.dev/blog/mini-shai-hulud-worm-pypi",
		Compromised: []AdvisoryPackage{{Name: "mistralai", Versions: map[string]bool{"2.4.6": true}}},
		Remediation: []string{
			"Run: icebath pm update --uv  (re-resolves the managed Python environment past mistralai 2.4.6)",
			"Rotate API keys in {icebath_home}/.env (OpenRouter, Anthropic, OpenAI, " +
				"xAI, GitHub, AWS, Google, Mistral, etc.).",
			"Audit ~/.npmrc, ~/.pypirc, ~/.aws/credentials, ~/.config/gh/hosts.yml, " +
				"and any other credential files for tokens that may have been read.",
			"Check GitHub for unexpected new SSH keys, deploy keys, or webhook " +
				"additions on repos you have admin on.",
			"After cleanup: icebath doctor --ack shai-hulud-2026-05  to dismiss " +
				"this warning.",
		},
		Published: "2026-05-12",
		Severity:  "critical",
	},
}

Advisory catalog, entries are appended and never removed

View Source
var CapabilityRegistry = map[string]CapabilitySpec{
	"tools.override":           {"tools.override", []string{"allow_tool_override"}, "Replace built-in tools (e.g. shell_exec, write_file) — an override can intercept everything routed through that tool"},
	"llm.provider_override":    {"llm.provider_override", []string{"llm", "allow_provider_override"}, "Run host-owned LLM calls against a provider other than your active one (uses your credentials)"},
	"llm.model_override":       {"llm.model_override", []string{"llm", "allow_model_override"}, "Choose which model host-owned LLM calls use (spend follows the chosen model)"},
	"llm.agent_id_override":    {"llm.agent_id_override", []string{"llm", "allow_agent_id_override"}, "Attribute its LLM calls to a different agent id"},
	"llm.profile_override":     {"llm.profile_override", []string{"llm", "allow_profile_override"}, "Run LLM calls under a different auth profile"},
	"llm.task_override":        {"llm.task_override", []string{"llm", "allow_task_override"}, "Route its LLM calls through the host's built-in auxiliary task lanes"},
	"llm.side_question":        {"llm.side_question", nil, "Ask your agent a short question after each turn. It sees the whole session, including memory, and spends your main model's tokens."},
	"gateway.platform_actions": {"gateway.platform_actions", []string{"allow_platform_actions"}, "Act on connected chat platforms as the gateway bot (add reactions, rename threads) via ctx.platform_actions"},
}

Every capability with an enforcing surface, keyed by id

View Source
var CatalogCategories = []string{"memory", "platform", "web", "tools", "voice", "automation", "models", "general"}

Browse shelves a catalog entry may name

View Source
var CatalogTiers = []string{"official", "verified", "community"}

Catalog badges, official first

View Source
var ConfigSchemaTypes = map[string][]string{
	"str": {"string"}, "string": {"string"}, "int": {"int"}, "integer": {"int"}, "float": {"int", "float"},
	"number": {"int", "float"}, "bool": {"bool"}, "boolean": {"bool"}, "list": {"list"}, "array": {"list"},
	"dict": {"map"}, "object": {"map"}, "secret": {"string"},
}

Config schema type names and the Go kinds a setting value must have

View Source
var DefaultCatalogTiers = map[string]bool{"official": true, "verified": true}

Tiers whose entries may be marked default and installed in every home

View Source
var DocProseExtensions = map[string]bool{".md": true, ".txt": true, ".rst": true, ".html": true}
View Source
var ErrUserInterrupt = errors.New("user interrupt")

Error a plugin callback returns to propagate a user interrupt instead of reporting a failure

View Source
var GithubTokenEnvVars = []string{"GITHUB_TOKEN", "GH_TOKEN"}

Environment variables the update check reads a GitHub token from, in order

View Source
var HostDegradedHooks = map[string]string{
	"pre_gateway_dispatch": "receives the live gateway runner and session store",
}

Hooks whose payload reaches hosted callbacks only as opaque values

View Source
var HostInProcessObjectBases = map[string]string{
	"register_login_backend":        "agent.vault_backends.base:LoginBackend",
	"register_browser_page_backend": "agent.browser_page_backend:BrowserPageBackend",
	"register_platform":             "gateway.platforms.send_targets:StandaloneSendPolicy",
}

Unsupported registrars the parent serves for an in process plugin, mapped to the base their object subclasses

View Source
var HostObjectBases = map[string]string{
	"register_image_gen_provider":            "agent.image_gen_provider:ImageGenProvider",
	"register_video_gen_provider":            "agent.video_gen_provider:VideoGenProvider",
	"register_web_search_provider":           "agent.web_search_provider:WebSearchProvider",
	"register_browser_provider":              "agent.browser_provider:BrowserProvider",
	"register_terminal_environment_provider": "agent.terminal_env_provider:TerminalEnvironmentProvider",
	"register_secret_source":                 "agent.secret_sources.base:SecretSource",
	"register_tts_provider":                  "agent.tts_provider:TTSProvider",
	"register_transcription_provider":        "agent.transcription_provider:TranscriptionProvider",
	"register_delegation_provider":           "agent.delegation_provider:DelegationProvider",
	"register_context_engine":                "agent.context_engine:ContextEngine",
	"register_context_reference":             "agent.context_references:ContextReferenceProvider",
	"register_memory_provider":               "agent.memory_provider:MemoryProvider",
}

Registrars whose argument may be a plugin object, mapped to the provider base it stands in for

View Source
var HostRemoteFacades = map[string]bool{
	"state": true, "llm": true, "platform_actions": true, "subagent_lifecycle": true, "delegation_backends": true,
}

Context facades whose methods run on the parent side object

View Source
var HostResultObjectBases = []string{"tools.computer_use.backend:ComputerUseProvider", "tools.computer_use.backend:ComputerUseBackend",
	"agent.transcription_provider:TranscriptionStreamSession", "tools.environments.base:BaseEnvironment"}

Bases a category loader or a hosted provider method hands back as hosted objects though no ctx registration names them

View Source
var HostSkippedCtxMethods = map[string]string{
	"register_cli_command": "`icebath <command>` subcommands are wired into the local CLI parser",
}

Context methods the host skips with a warning

View Source
var HostUnsupportedCtxMethods = map[string]string{
	"register_login_backend":        "browser-vault fills hold a server-local context manager",
	"register_browser_page_backend": "browser-vault fill scripts carry credentials that stay in the Icebath process",
	"register_platform":             "platform adapters run on the gateway's event loop with native SDK clients",
	"register_platform_handler":     "the handler factory receives the platform's native SDK client",
	"register_telegram_handler":     "the handler factory receives the native Telegram Application",
	"register_slack_action_handler": "the callback receives native slack_bolt ack/body objects",
	"register_approval_transport":   "approval transports hold the live approval request/response channel",
	"post_message":                  "the returned handle is bound to the gateway's event loop and live adapter",
	"apost_message":                 "the returned handle is bound to the gateway's event loop and live adapter",
}

Context methods the host refuses with the reason the live object cannot cross

View Source
var ImageHosts = []string{"raw.githubusercontent.com", "github.com"}

Hosts catalog images and screenshots may come from

View Source
var LiteralInertPatternIDs = map[string]bool{"sudo_usage": true, "dump_all_env": true, "format_filesystem": true}
View Source
var LiveCatalogURL = "https://icebath.app/api/plugin-catalog.json"

Site copy of the shipped catalog document the refresh fetches

View Source
var Logger = slog.Default()

Logger every plugin subsystem message goes through, replaceable by the host

View Source
var LoginBackendTiers = map[string]bool{"official": true, "verified": true}
View Source
var MemoryQueryRewrite func(ctx context.Context, userMessage string) string

Rewrite of a user message into one memory retrieval question, installed by the memory package and served to memory provider plugins only

View Source
var RunnerAdapterByValue func(runner any, value string) (adapter any, hasRegistry bool)

Live adapter a gateway runner's default profile registry holds for a platform value, installed by pkg/gateway

View Source
var RunnerAuthorizationAdapter func(runner any) (resolve func(ctx context.Context, value, profile string) any, callable bool)

Profile aware fail closed adapter resolver of a runner with _authorization_adapter, callable false without one, installed by pkg/gateway

View Source
var RunningVersion = buildVersion()

Version of the running binary, read from build info and overridable by the main package

View Source
var StepDown = map[string]string{"critical": "high", "high": "medium"}

StepDown lowers one severity step, medium and low are already informational

View Source
var (
	SystemPromptSectionPositions = map[string]bool{"after_memory": true}
)
View Source
var TestTreeDirs = map[string]bool{"tests": true, "test": true, "testing": true, "spec": true, "specs": true, "fixtures": true}
View Source
var UnknownPresence = Presence{State: "unknown"}

Functions

func AInvokeHook

func AInvokeHook(ctx context.Context, hookName string, kwargs map[string]any) []any

Loop side hook invocation on the active profile's manager after lazy discovery

func AcceptShellHooksForLaunch

func AcceptShellHooksForLaunch(ctx context.Context) error

Records a launch's --accept-hooks in the allowlist and holds in memory each approval the write lost

func AcceptShellHooksForProcess

func AcceptShellHooksForProcess()

Opts this process into every configured hook for its lifetime without exporting the variable

func AckAdvisory

func AckAdvisory(ctx context.Context, advisoryID string) bool

Persists the dismissal of an advisory id in security.acked_advisories of the profile of ctx, true when it is stored

func ActivationSummaries

func ActivationSummaries(ctx context.Context, m *Manager) []map[string]any

One summary per loaded plugin that is neither a deferred platform nor errored, the plugin loaded payload

func AddShellHook

func AddShellHook(ctx context.Context, event, command, matcher string, timeout int) error

AddShellHook appends a hook to the hooks of an event in the user config, the tools it is for and the seconds it may take left out when not given

func AdmitPluginSetChange

func AdmitPluginSetChange(ctx context.Context, enabled, disabled map[string]bool, opts AdmitOptions) error

Public admission of a plugin set change, refused without touching config when the union cannot resolve

func AdvisoryFullRemediationText

func AdvisoryFullRemediationText(ctx context.Context, hit AdvisoryHit) ([]string, error)

Multi line block describing the advisory of a hit and its numbered remediation steps

func AdvisoryGatewayLogMessage

func AdvisoryGatewayLogMessage(ctx context.Context, hits []AdvisoryHit) string

One line gateway log message for the hits not dismissed, empty when there is none

func AdvisoryShortBannerLines

func AdvisoryShortBannerLines(hits []AdvisoryHit) []string

One to three unstyled startup banner lines naming the first hit and counting the others

func AdvisoryStartupBanner

func AdvisoryStartupBanner(ctx context.Context, hits []AdvisoryHit) string

Printable startup banner of the hits due now, empty when none is due, bold red on a color terminal

func AllowlistedShellHookPairs

func AllowlistedShellHookPairs(ctx context.Context) map[[2]string]bool

Approved event and command pairs of the current home's allowlist

func ApproveShellHook

func ApproveShellHook(ctx context.Context, event, command string) error

ApproveShellHook puts a configured hook on the allowlist with the time of its script now, so it runs

func ArgFloat

func ArgFloat(v any, def float64) float64

ArgFloat gives the number a plugin argument converts to, def when it does not convert

func AskerBound

func AskerBound(ctx context.Context) bool

Reports whether a surface bound an asker for this context

func AttachToToolMessage

func AttachToToolMessage(agent *PluginLiveNotes, message *state.Message)

Appends every queued notice after the content of the tool result about to be flushed

func AutoApplyEnabled

func AutoApplyEnabled(ctx context.Context) bool

Whether plugins.auto_apply of the profile of ctx opts into unattended git updates

func BindAsker

func BindAsker(ctx context.Context, asker ChoiceAsker) context.Context

Context whose AskChoice calls the asker binds, the surface that dispatches the command wraps its handler call

func BindHostCall

func BindHostCall(owner, method string, params []HostParam, args []any, kwargs map[string]any) (map[string]any, map[string]any, error)

BindHostCall exports the Python keyword binding of a host facade method for facades other packages implement

func BindSubagentParentRef

func BindSubagentParentRef(ctx context.Context, ref SubagentParentRef) context.Context

Context carrying a weakly held parent so a context outliving the turn never pins the agent

func BroadcastPluginEvent

func BroadcastPluginEvent(pluginID, event string, payload any) error

Emits the namespaced plugin event to every connected client, a logged no op without a gateway here

func BundledPluginKeys

func BundledPluginKeys() []string

Registry keys of every compiled-in plugin in registration order

func BundledPluginsFS

func BundledPluginsFS() fs.FS

Bundled plugins tree a reader walks, the ICEBATH_BUNDLED_PLUGINS directory when set, else the copy compiled in

func CachedGitUpdates

func CachedGitUpdates(ctx context.Context, installMetadata map[string]any) map[string]string

Plugin names mapped to the commit or feed version the last check found for still matching git installs

func CapabilityGranted

func CapabilityGranted(ctx context.Context, pluginID, capability string) bool

Reports whether a capability is live for a plugin in the profile of ctx through a grant or the legacy allow key

func CapabilitySetHash

func CapabilitySetHash(caps []string) string

Order insensitive sha256 of a capability set

func CatalogCap

func CatalogCap(f skills.Finding) (string, bool)

CatalogCap is the stepped down severity for a finding inside a locale catalog

func CatalogEntryRunsHere

func CatalogEntryRunsHere(ctx context.Context, entry *PluginCatalogEntry) bool

Whether this OS and this icebath can run a catalog entry, the verdict of the install gate

func CatalogInstallRecord

func CatalogInstallRecord(ctx context.Context, pluginDir string) (map[string]any, error)

Catalog sidecar of an installed plugin directory, nil when it was not installed from the catalog

func CatalogRowFields

func CatalogRowFields(h, dir string, pins, versions map[string]string) (map[string]any, error)

Provenance fields of one installed plugin row with the current pin and update flag when the pins know it

func CatalogRowsMaps

func CatalogRowsMaps(ctx context.Context) (map[string]string, map[string]string, map[string]string)

Pins, versions and titles maps from one live catalog resolution, all empty when it fails

func CategoryActiveNames

func CategoryActiveNames(ctx context.Context) map[string]bool

Provider names of the active scope home that category config switches on

func CheckDue

func CheckDue(ctx context.Context, now, intervalHours *float64) bool

Whether the interval has passed since the last run marker, true when no marker exists

func CheckIntervalHours

func CheckIntervalHours(ctx context.Context) float64

Hours between update checks from plugins.auto_update_check_hours of the profile of ctx, zero or less disabling the check

func ClearPublishedGatewayMessageHost

func ClearPublishedGatewayMessageHost(owner any)

Forgets this owner's gateway host without clobbering a newer runner

func ClearPublishedTUIMessageHost

func ClearPublishedTUIMessageHost(owner any)

Forgets the process TUI host and clears it where this owner still holds the slot

func CmdAdopt

func CmdAdopt(ctx context.Context, name string, out io.Writer) error

Records the git origin of a self cloned plugin dir as its provenance row

func CmdCapabilities

func CmdCapabilities(ctx context.Context, name *string, out io.Writer) error

Prints declared against granted capabilities for one plugin or every plugin holding any

func CmdCheckUpdates

func CmdCheckUpdates(ctx context.Context, asJSON bool, out io.Writer) error

Reports which installed plugins are outdated without changing anything

func CmdDisable

func CmdDisable(ctx context.Context, name string, out io.Writer) error

Disables a plugin, removing its toolset from saved lists and hinting how the gateway applies it

func CmdEnable

func CmdEnable(ctx context.Context, name string, allowToolOverride *bool, out io.Writer) error

Enables a plugin, asking capability consent for non bundled ones and syncing saved toolset lists

func CmdInfo

func CmdInfo(ctx context.Context, name string, out io.Writer) error

Full catalog entry of a name, the installed plugin details for a non catalog name

func CmdInstall

func CmdInstall(ctx context.Context, opts InstallCommandOptions, out io.Writer) error

Installs a plugin from the catalog, a git URL or owner/repo shorthand, then prompts, enables and reports

func CmdList

func CmdList(ctx context.Context, opts ListOptions, out io.Writer) error

Lists bundled and user plugins with their activation state, provenance and catalog removals

func CmdPackExport

func CmdPackExport(ctx context.Context, enabledOnly bool, name string, out, errOut io.Writer) error

Pack YAML of the current install on out, warnings and errors on errOut

func CmdPackInstall

func CmdPackInstall(ctx context.Context, source string, force bool, out io.Writer) error

Review screen, one pack level consent, pinned fan out installs and per plugin consent, exit 1 on any failure

func CmdPackShow

func CmdPackShow(ctx context.Context, source string, out io.Writer) error

Dry run review of a pack

func CmdPluginDoctor

func CmdPluginDoctor(ctx context.Context, target string, ci bool, out io.Writer) error

Validates one plugin through runtime discovery and registration, exit 1 under ci when it fails

func CmdRemove

func CmdRemove(ctx context.Context, name string, out io.Writer) error

Removes an installed plugin by name

func CmdSearch

func CmdSearch(ctx context.Context, term string, jsonOutput bool, out io.Writer) error

Searches the curated catalog by name, description and declared tools, an empty term browsing everything

func CmdShow

func CmdShow(ctx context.Context, name string, out io.Writer) error

icebath plugins show printing one plugin's details to out

func CmdToggle

func CmdToggle(ctx context.Context, out io.Writer) error

Interactive composite screen of the general plugins and the provider plugin categories

func CmdTrustUpdateURL

func CmdTrustUpdateURL(ctx context.Context, name string, out io.Writer) error

Moves the saved update url tag to the manifest update url after a needs fixing mismatch

func CmdUpdate

func CmdUpdate(ctx context.Context, name string, interactive, force bool, out io.Writer) error

Updates one named plugin, exiting 1 on a consent, scan or operation refusal

func CmdUpdateAll

func CmdUpdateAll(ctx context.Context, yes bool, out io.Writer) error

Lists every plugin with an update and updates them all after one confirmation, exit 1 when any failed

func CmdValidate

func CmdValidate(ctx context.Context, path string, asJSON, installDeps bool, out, errOut io.Writer) error

Catalog admission validation of a plugin directory, the CI gate exiting 0 or 1, with installDeps syncing its deps first

func ConsentHash

func ConsentHash(ctx context.Context, pluginID string) string

Stored consent hash of a plugin in the profile of ctx, empty when absent

func DeclaredSetChanged

func DeclaredSetChanged(ctx context.Context, pluginID string, declared []string) bool

Reports whether the declared set differs from the one the user consented to in the profile of ctx

func DecodeOrderedObject

func DecodeOrderedObject(raw []byte) ([]string, map[string]any, error)

Keys and decoded values of a JSON object in document order, objects inside as plain maps, integers as int64 and other numbers as float64

func DependencyBlockedSummaries

func DependencyBlockedSummaries(ctx context.Context, m *Manager) []map[string]any

Plugins that failed to load while a declared Python dependency is missing, as activation entries

func DescribeGithubFailure

func DescribeGithubFailure(err error, authenticated bool, now *float64) string

One actionable line for a failed api.github.com call naming the reset time and the GITHUB_TOKEN fix

func DirectoryHookTimeout

func DirectoryHookTimeout(raw any) int

Seconds the command of a hook directory may run as a whole number of seconds or numeric text, the shell hook default for an unset, unusable or boolean value and its cap above that

func DisabledPluginSet

func DisabledPluginSet(ctx context.Context) map[string]bool

Deny list of disabled plugin keys of the active scope home, empty on a failed read

func DisabledPlugins

func DisabledPlugins(h string) map[string]bool

Names the plugins.disabled list of a home parks

func DiscoverPlugins

func DiscoverPlugins(ctx context.Context, force bool)

Discovers and loads every plugin of the active profile, joining an in flight background scan first

func EnabledPluginSet

func EnabledPluginSet(ctx context.Context) map[string]bool

Allow list of enabled plugin keys of the active scope home, empty on a failed read

func EnqueuePluginStreamHook

func EnqueuePluginStreamHook(ctx context.Context, hookName string, payload map[string]any) bool

Queues an observer hook for each consumer without running plugin code inline, true when any accepted it

func EntryCapabilitySummary

func EntryCapabilitySummary(e *PluginCatalogEntry) string

One paragraph of what installing or enabling an entry grants

func ErrorTypeName

func ErrorTypeName(err error) string

Kind label of an error a plugin call returned, the exception class name a Python plugin catches

func ExportPack

func ExportPack(ctx context.Context, enabledOnly bool, packName string) (string, []string, error)

Pack YAML of the current install and the warnings for plugins without Git provenance

func FetchLiveCatalog

func FetchLiveCatalog(ctx context.Context, force bool) map[string]any

Published catalog cached for the TTL under the current home, nil on any failure with a dead host remembered for a minute

func FieldsOf

func FieldsOf(v any) map[string]any

Fields of a mapping a hosted call answered, a record or a rebuilt dataclass read by its fields, nil for any other value

func FindEngineDir

func FindEngineDir(ctx context.Context, name string) (string, bool)

Engine dir of a name, bundled first then a user plugin dir that holds a context engine

func FindPluginEntryDir

func FindPluginEntryDir(plugin string) (string, bool, error)

Entry directory of an installed or bundled plugin under the process home, found false when unresolved

func FirePreCommandHook

func FirePreCommandHook(ctx context.Context, surface, command, aliasUsed, argsRaw string, sessionKey, platform *string)

Fires the observer only pre_command hook, logging and ignoring any directive a callback returns

func FlushOutboundWebhooks

func FlushOutboundWebhooks(timeout time.Duration) bool

FlushOutboundWebhooks blocks until every queued delivery finished or the timeout passed, true when drained

func FormatPluginScanReport

func FormatPluginScanReport(result skills.ScanResult) string

FormatPluginScanReport renders the compact scan report the CLI shows

func FormatSessionResetNotice

func FormatSessionResetNotice(mode string) string

Notice that a timed session_reset mode waits on the plugin that applies it

func FormatSystemPromptSection

func FormatSystemPromptSection(sectionID, content string) string

Auditable length framed block recoverable from the full prompt

func FormatSystemPromptSections

func FormatSystemPromptSections(sections []RenderedSystemPromptSection) string

Canonical container of rendered sections used for persistence recovery, empty for no sections

func GetAckedAdvisoryIDs

func GetAckedAdvisoryIDs(ctx context.Context) map[string]bool

Advisory ids dismissed under security.acked_advisories of the profile of ctx

func GetActiveSubagentParent

func GetActiveSubagentParent(ctx context.Context) any

Parent agent bound to this execution context, nil when none or collected

func GetBundledPluginsDir

func GetBundledPluginsDir() string

Bundled plugins directory, ICEBATH_BUNDLED_PLUGINS first, else the plugins tree beside the running install

func GetPluginAuxiliaryTasks

func GetPluginAuxiliaryTasks(ctx context.Context) []map[string]any

Plugin auxiliary task registrations sorted by key after discovery

func GetPluginCommandOrder

func GetPluginCommandOrder(ctx context.Context) []string

Plugin slash command names after discovery in the order their names were first registered

func GetPluginCommands

func GetPluginCommands(ctx context.Context) map[string]*PluginCommand

Plugin slash commands by name after discovery

func GetPluginContextEngine

func GetPluginContextEngine(ctx context.Context) any

Plugin registered context engine after discovery, nil when none

func GetPluginErrorClassification

func GetPluginErrorClassification(ctx context.Context, in ErrorClassificationInput) (map[string]any, error)

First valid plugin error classification in registration order, sanitized, nil when none

func GetPluginToolsetKeysNowait

func GetPluginToolsetKeysNowait(ctx context.Context) map[string]bool

Plugin toolset keys without blocking on an in flight background discovery

func GetPortableMCPServerNamesNowait

func GetPortableMCPServerNamesNowait(ctx context.Context) map[string]bool

Portable MCP server names without blocking on an in flight background discovery

func GetPreVerifyContinueMessage

func GetPreVerifyContinueMessage(ctx context.Context, in PreVerifyInput) string

First non empty continue or block message of the pre_verify hooks, empty to let the turn finish

func GithubToken

func GithubToken() (string, bool)

Credential for an api.github.com request, false for anonymous

func GithubTokenFromEnv

func GithubTokenFromEnv(getenv func(string) string) (string, bool)

First non blank environment token trimmed, a blank value falling through to the next

func GrantedCapabilities

func GrantedCapabilities(ctx context.Context, pluginID string) map[string]bool

Capabilities the user granted the plugin in the profile of ctx

func GuestPluginDirs

func GuestPluginDirs(root string) []string

Sorted child directories of a plugins root that hold a wasm or program plugin, underscore and dot names skipped

func GuestProvides

func GuestProvides(dir, category string) bool

Whether a plugin directory holds a wasm or program plugin offering a category, one that lists it under provides or one of the exclusive kind that lists nothing

func HasEnabledAgentPluginMCP

func HasEnabledAgentPluginMCP(ctx context.Context, rawConfig map[string]any) bool

Whether config enables a portable package with MCP servers, scanned on a fresh manager

func HasHook

func HasHook(ctx context.Context, hookName string) bool

Reports whether the active profile has callbacks for a hook after lazy discovery

func HasMiddleware

func HasMiddleware(ctx context.Context, kind string) bool

Reports whether the active profile has middleware of a kind after lazy discovery

func HasReasoningStreamObserverHooks

func HasReasoningStreamObserverHooks(ctx context.Context) bool

Reports whether reasoning deltas are opted in and a delta observer is registered

func HasStreamObserverHooks

func HasStreamObserverHooks(ctx context.Context) bool

Reports whether any stream start, delta or end observer is registered

func HeldStreamTransforms

func HeldStreamTransforms(ctx context.Context) []*hookEntry

Held output transforms of the active profile's manager after lazy discovery

func HooksCommand

func HooksCommand(ctx context.Context, args HooksArgs, w io.Writer) error

Dispatches one icebath hooks action, printing usage for a missing one and a notice for an unknown one

func HooksOverview

func HooksOverview(ctx context.Context) ([]HookView, []WebhookView, error)

HooksOverview is every configured shell hook with its consent state and every outbound webhook target of the home in the context

func HostCallable

func HostCallable(fn func(ctx context.Context, args []any, kwargs map[string]any) (any, error)) any

Value the wire sends to the plugin host as a callable running fn here

func HostLauncher

func HostLauncher(ctx context.Context) ([]string, error)

Argv prefix the plugin host process runs under from plugins.host.launcher of the profile of ctx, a sandbox runner, a single line split like a shell command line

func InPluginLoadWorker

func InPluginLoadWorker(ctx context.Context) bool

Reports a deadline bound plugin load worker context to the gateway platform registry

func InTreeCatalogTime

func InTreeCatalogTime() *float64

Commit time of the last change to the in-tree catalog, its newest file mtime on a treeless clone, nil outside a checkout

func InspectPluginSource

func InspectPluginSource(ctx context.Context, identifier, catalogName string) (map[string]any, error)

Whether a source ships an agent plugin at the commit read, joining a running or recent read of the same request

func InstallServices

func InstallServices(s *Services)

Installs the process wide collaborator set used by every plugin manager

func InstalledInSelectedEnvironment

func InstalledInSelectedEnvironment(ctx context.Context, requirements []string) bool

Whether every requirement is installed in the dependency environment the install currently selects

func InteractiveScanDecision

func InteractiveScanDecision(console *Console, verb string) func(scan any) bool

Terminal y or N accepting a caution verdict, shared by install and update

func InvalidateLiveCacheForHome

func InvalidateLiveCacheForHome(h string)

Removes the cached live catalog of any home, logging at debug when removal fails

func InvokeHook

func InvokeHook(ctx context.Context, hookName string, kwargs map[string]any) []any

Invokes a hook on the active profile's manager after lazy discovery

func InvokePluginCommand

func InvokePluginCommand(ctx context.Context, handler PluginCommandHandler, rawArgs string, context map[string]any) (any, error)

Calls a slash command handler once with the raw args plus the session context keywords it declares

func IsAgentFacing

func IsAgentFacing(f skills.Finding) bool

IsAgentFacing is true for a shape whose prose is the payload

func IsAllowedImageURL

func IsAllowedImageURL(raw string) bool

Whether a URL is https on a GitHub image host

func IsAuthorizedKeysProse

func IsAuthorizedKeysProse(f skills.Finding, line string, isDoc bool) bool

IsAuthorizedKeysProse is true for an authorized_keys mention inside a literal with no write action

func IsBase64ArchiveRoundtrip

func IsBase64ArchiveRoundtrip(f skills.Finding, line string) bool

IsBase64ArchiveRoundtrip is true for a base64 decode pipe line that creates and round trips an archive

func IsBase64Media

func IsBase64Media(line string) bool

IsBase64Media is true when a long base64 run on the line decodes to a recognised media header

func IsBenignLazyOSImport

func IsBenignLazyOSImport(f skills.Finding, line string) bool

IsBenignLazyOSImport is true when every lazy os import reads a benign member with no dangerous call

func IsCIWorkflow

func IsCIWorkflow(relPath string) bool

IsCIWorkflow is true for a forge CI workflow definition that runs on the forge's runner

func IsCoinNameOnly

func IsCoinNameOnly(f skills.Finding, line string) bool

IsCoinNameOnly is true when every crypto mining hit is the bare word monero with no mining machinery

func IsDisclosedConfigNote

func IsDisclosedConfigNote(f skills.Finding, relPath string) bool

IsDisclosedConfigNote is true for a prose intent config mod finding on an install doc surface

func IsDocProse

func IsDocProse(relPath string) bool

IsDocProse is true for a documentation file the loader never executes and the agent never runs as a skill

func IsEnvDumpInSafetyClause

func IsEnvDumpInSafetyClause(f skills.Finding, line string) bool

IsEnvDumpInSafetyClause is true when every env dump hit is governed by a safety negation

func IsHexInCharClass

func IsHexInCharClass(f skills.Finding, line string) bool

IsHexInCharClass is true when every hex escape on the line sits inside a regex character class

func IsInertFixtureLine

func IsInertFixtureLine(f skills.Finding, line string, isCode bool, relPath string) bool

IsInertFixtureLine is true when every hit is quoted test data nothing on the line runs

func IsJSONProseValue

func IsJSONProseValue(f skills.Finding, relPath, line string) bool

IsJSONProseValue is true when every hit sits mid sentence in a JSON string pair under a non command key

func IsLocaleCatalog

func IsLocaleCatalog(relPath string) bool

IsLocaleCatalog is true for a locales catalog at the plugin root

func IsLoopbackContinuation

func IsLoopbackContinuation(f skills.Finding, line, joined string) bool

IsLoopbackContinuation is true when the pattern stops matching on the logical line and every host is loopback

func IsLoopbackOnly

func IsLoopbackOnly(f skills.Finding, line string) bool

IsLoopbackOnly is true when every hardcoded ip port hit is a loopback address

func IsOwnProcRead

func IsOwnProcRead(f skills.Finding, line string) bool

IsOwnProcRead is true when every proc path on the line is a benign leaf read only

func IsPipInstallInProseLiteral

func IsPipInstallInProseLiteral(f skills.Finding, line string) bool

IsPipInstallInProseLiteral is true when every pip install sits mid sentence inside a literal

func IsPluginEventID

func IsPluginEventID(key string) bool

Whether a plugin key forms a plugin event name

func IsPortablePluginDir

func IsPortablePluginDir(dir string) bool

Whether a plugin directory is an Agent Plugins v1 package

func IsPublicClientKey

func IsPublicClientKey(f skills.Finding, line string) bool

IsPublicClientKey is true when every hardcoded secret literal is a public by design client key

func IsQuotedInjectionPhrase

func IsQuotedInjectionPhrase(f skills.Finding, line string) bool

IsQuotedInjectionPhrase is true when the injection phrase sits entirely inside a quoted span

func IsRegexAlternationToken

func IsRegexAlternationToken(f skills.Finding, line string) bool

IsRegexAlternationToken is true when every token occurrence is an alternation member or a whole literal

func IsRepoRootTraversal

func IsRepoRootTraversal(f skills.Finding, line string) bool

IsRepoRootTraversal is true when every traversal run climbs to an ancestor with no sensitive leaf

func IsSelfUninstallDoc

func IsSelfUninstallDoc(f skills.Finding, line string) bool

IsSelfUninstallDoc is true for a README uninstall line removing the plugin's own install directory

func IsSudoInert

func IsSudoInert(f skills.Finding, line, relPath string) bool

IsSudoInert is true when every sudo on the line is an advisory hint or governed by a safety negation

func IsTestTree

func IsTestTree(relPath string) bool

IsTestTree is true for a root level test dir, dunder test dirs at any depth, or a test file name

func IsTrustedInstallerPipe

func IsTrustedInstallerPipe(f skills.Finding, line string) bool

IsTrustedInstallerPipe is true when every URL on a curl pipe shell line names a trusted installer

func IsValidSystemPromptSectionID

func IsValidSystemPromptSectionID(value any) bool

Reports whether a value is a stable heading safe section identifier

func KeepAfterTurnBudget

func KeepAfterTurnBudget(agent *PluginLiveNotes, batch []*state.Message)

Puts a notice back on a batch row whose content the turn budget spilled to a file

func ListedPluginStatus

func ListedPluginStatus(ctx context.Context, e PluginEntry, enabled, disabled, active map[string]bool) (string, error)

Activation state of a listed plugin as plugins list prints it, its directory deciding default on kinds

func LoadAndGoLive

func LoadAndGoLive(ctx context.Context, name string) (map[string]any, error)

Rediscovers plugins here one go live at a time and makes the named plugin live in open chats

func LoadNamed

func LoadNamed(name, pluginDir string, loadFromDir func(dir string) (any, error), kind, noun string) any

Shared body of a named category load, a warning on the category logger and nil when it fails or yields no instance

func LoadShellHookAllowlist

func LoadShellHookAllowlist(ctx context.Context) map[string]any

Parsed allowlist, an empty skeleton when absent or broken

func LogicalLine

func LogicalLine(lines []string, index int) string

LogicalLine joins a line with the lines a trailing backslash continues onto, at most eight

func LooksLikeCatalogName

func LooksLikeCatalogName(identifier string) bool

Bare lowercase catalog token rather than a url, owner/repo shorthand or path

func MiddlewarePayload

func MiddlewarePayload(kwargs map[string]any) map[string]any

Middleware payload stamped with the telemetry and middleware schema versions unless already set

func MissingPythonDependencies

func MissingPythonDependencies(ctx context.Context, mf *Manifest) []string

Declared Python requirements of a plugin that apply here and are not installed in the selected environment

func ObserverPayload

func ObserverPayload(kwargs map[string]any) map[string]any

Observer payload stamped with the telemetry schema version unless already set

func OrderedDict

func OrderedDict(keys []string, values map[string]any) map[string]any

Dict value the child rebuilds with its keys in the given order, keys absent from values skipped

func PackCommand

func PackCommand(ctx context.Context, args PackArgs, out, errOut io.Writer) error

Dispatches icebath plugins pack install, export or show

func ParseDeclaredCapabilities

func ParseDeclaredCapabilities(raw any, pluginName string) []string

Known capability ids of a manifest capabilities value, unknown ids dropped with a warning

func PendingCapabilities

func PendingCapabilities(ctx context.Context, pluginID string, declared []string) []string

Declared capabilities the user has not granted yet in the profile of ctx

func PinnedRevision

func PinnedRevision(ctx context.Context, name string, metadata map[string]any) (string, error)

Full commit a ref install of the plugin is pinned to in the metadata, empty when it floats

func PluginCommandContext

func PluginCommandContext(ctx context.Context) map[string]any

Session context keywords the dispatching surface passed, read by an in process handler taking every keyword

func PluginEventName

func PluginEventName(pluginID, event string) (string, error)

Wire name plugin dot id dot event, a ValueError for an id or event that cannot form one

func PluginRelativeSegments

func PluginRelativeSegments(key string) ([]string, error)

Validated segments of a plugin relative settings key, refusing global, reserved and traversal paths

func PluginSettingsFields

func PluginSettingsFields(ctx context.Context, h, pluginID, pluginDir string) []map[string]any

Renderable settings fields of one plugin with current values, secrets carrying only env and presence

func PluginStorageDir

func PluginStorageDir(ctx context.Context, name string) (string, error)

Creates and returns the plugin data directory under the active home, never the install tree

func PluginsInBothLists

func PluginsInBothLists(h string) []string

Keys the loader skips because both config lists name them

func PopPluginNotices

func PopPluginNotices(agent *PluginLiveNotes) string

Every queued notice oldest plugin first joined by blank lines, clearing the queue

func PortableLiveness

func PortableLiveness(server string) map[string]any

Copy of the liveness declaration of a portable MCP server, nil when it declared none

func PortableMCPServerName

func PortableMCPServerName(server string) string

Internal MCP server name of a portable plugin server, exactly the name its mcp.json gives it

func PortableMCPServers

func PortableMCPServers(h string) (map[string]map[string]any, error)

MCP servers the enabled portable plugins of a home declare, after discovery of that home

func ProbeAvailability

func ProbeAvailability(load func() (any, error)) (ok bool)

Whether load returns an instance whose is_available answers truthy, any failure counting as unavailable

func ProseCap

func ProseCap(f skills.Finding) (string, bool)

ProseCap is the stepped down severity for a command or path shaped finding in documentation

func PublishGatewayMessageHost

func PublishGatewayMessageHost(owner any, injector MessageInjector)

Remembers the process gateway host and stamps every existing manager with it

func PublishTUIMessageHost

func PublishTUIMessageHost(owner any, injector MessageInjector)

Remembers the process TUI host and stamps every existing manager with it

func QueuePluginNotice

func QueuePluginNotice(agent *PluginLiveNotes, pluginKey, note string)

Queues a note for the next tool result or user turn, replacing this plugin's older one

func ReRegisterOutboundWebhooks

func ReRegisterOutboundWebhooks(ctx context.Context) error

ReRegisterOutboundWebhooks drops the current home's wired keys and registers the saved config again after a force reload

func ReadInstallMetadata

func ReadInstallMetadata(h string) (map[string]any, error)

Profile-local plugin install metadata keyed by plugin directory name, for callers outside the package

func ReadManifestForInstall

func ReadManifestForInstall(pluginDir string) (map[string]any, error)

Manifest an install candidate publishes, a manifest_invalid error when it is unreadable or malformed, empty without one

func ReadPluginDescription

func ReadPluginDescription(dir string) string

Description of a plugin.yaml, empty when absent, falsy or unreadable

func ReadSidecarRows

func ReadSidecarRows(pluginsDir string) map[string]any

Install metadata rows of a plugins dir, empty when absent, unreadable or not an object

func RecordConsent

func RecordConsent(ctx context.Context, h, pluginID string, granted, declared []string) error

Persists a consent decision, granting the union and mirroring every grant into its legacy gate

func ReferenceKeys

func ReferenceKeys(ctx context.Context, surface string) map[string]bool

English key set of a surface in the catalogs of the profile of ctx, nil when the bundled reference is unavailable

func RegisterActiveSettings

func RegisterActiveSettings(h string)

Registers the settings blocks every discovered plugin and the selected memory provider declare

func RegisterBundled

func RegisterBundled(p Plugin)

Adds a compiled-in plugin to the bundled set, panicking on an empty or duplicate registry key

func RegisterPort

func RegisterPort(p Plugin)

Adds a compiled-in port of a plugin that ships outside core, listed and loaded only once installed into a home

func RegisterProviderRegistry

func RegisterProviderRegistry(kind string, registry func() ScopedRegistry)

Registers the scoped registry plugins of a provider kind load into, called at init by its owner

func RegisteredProviderRegistries

func RegisteredProviderRegistries() map[string]ScopedRegistry

Scoped registries of every provider kind the linked packages registered

func RemoveInstalledPlugin

func RemoveInstalledPlugin(ctx context.Context, h, target string) error

Removes the plugin tree at target from a home together with its install metadata

func RemoveShellHook

func RemoveShellHook(ctx context.Context, event, command string) (int, error)

RemoveShellHook takes every hook running the command out of the hooks of an event in the user config and reports how many went

func RequiresVersionError

func RequiresVersionError(spec string) string

Load blocking reason when a requires_icebath spec rejects the running version, else empty

func ResetOutboundWebhooksForTests

func ResetOutboundWebhooksForTests()

ResetOutboundWebhooksForTests clears the idempotence set and drains the queue

func ResetPluginEnabled

func ResetPluginEnabled(ctx context.Context) bool

Whether the session reset plugin is installed and enabled in the plugin set of this process

func ResetPluginManagersForTests

func ResetPluginManagersForTests()

Drops every cached manager after unloading it and clears published hosts

func ResetShellHooksForTests

func ResetShellHooksForTests()

Clears the wiring registry and every in process consent

func ResolveDirectoryHookCommand

func ResolveDirectoryHookCommand(hookDir, command string) ([]string, error)

Argument vector of the command line a hook directory names, a program that sits inside the directory resolved to its full path

func ResolveLoadOrder

func ResolveLoadOrder(manifests map[string]*Manifest) []string

Plugin keys in dependency order with alphabetical ties, alphabetical for all on a cycle

func ResolveManifestWinners

func ResolveManifestWinners(manifests []*Manifest) map[string]*Manifest

Later sources win on key collision except a flat impostor claiming a bundled key from another directory

func ResolvePluginCommandResult

func ResolvePluginCommandResult(ctx context.Context, result any) (any, error)

Awaits an awaitable result, bounded on a running loop, returning any other value unchanged

func ResolvePluginPath

func ResolvePluginPath(ctx context.Context, target string) (string, error)

Explicit plugin path or installed, bundled or project plugin id resolved to its directory

func RevokeShellHook

func RevokeShellHook(ctx context.Context, command string) (int, error)

Removes every allowlist record of the command and returns how many went

func RunDirectoryHook

func RunDirectoryHook(ctx context.Context, eventType, hookDir string, argv []string, timeout int, hookContext map[string]any) (any, error)

Runs the command of a hook directory inside that directory for one gateway event with the event name and its context as JSON on standard input and answers the JSON object it printed, nil when it printed none

func RunLLMExecutionMiddleware

func RunLLMExecutionMiddleware(ctx context.Context, request map[string]any, next NextCall, extra map[string]any) (any, error)

Runs LLM execution through the middleware of the active profile after lazy discovery, so a cold surface keeps its gates

func RunToolExecutionMiddleware

func RunToolExecutionMiddleware(ctx context.Context, toolName string, args map[string]any, next NextCall, extra map[string]any) (any, error)

Runs tool execution through the middleware of the active profile after lazy discovery, so a cold surface keeps its gates

func RunVerifyCommand

func RunVerifyCommand(ctx context.Context, ns map[string]any, w, errw io.Writer) int

Detects a project's run recipe and smoke tests it

func SavePluginSetting

func SavePluginSetting(ctx context.Context, h, pluginID string, segments []string, value any) error

Writes one value under plugins.entries.<id>.settings atomically, refusing managed installs and keys

func SavePluginSettings

func SavePluginSettings(ctx context.Context, h, pluginID, pluginDir string, values []PluginSettingValue) ([]string, error)

Validates every edit against the schema then writes each one, returning the keys written in order

func SaveShellHookAllowlist

func SaveShellHookAllowlist(ctx context.Context, data map[string]any) error

Writes the allowlist atomically at mode 0600, an OS failure logged and the approval held in memory only

func ScanBlockedResult

func ScanBlockedResult(blocked *PluginScanBlocked) map[string]any

Non interactive answer to a scan block with the verdict and findings a client can show

func ScanPlugin

func ScanPlugin(pluginDir, source string) skills.ScanResult

ScanPlugin scans a plugin directory with every external plugin at community trust

func SecretEnvName

func SecretEnvName(pluginID, key string, spec map[string]any) string

Env variable a secret field lives under, the declared env or the upper snaked plugin id and key

func SessionCwd

func SessionCwd(ctx context.Context) (string, error)

Recorded working directory of the calling session, then the policy cwd, then the profile terminal cwd

func SessionSurface

func SessionSurface(ctx context.Context) string

Client surface of a local session turn or the messaging platform of a chat turn, empty outside any session

func SetAgentPluginEnabled

func SetAgentPluginEnabled(ctx context.Context, name string, enabled bool) (map[string]any, error)

Enables or disables a plugin without prompts, loading an enabled plugin live

func ShellHookAllowlistEntry

func ShellHookAllowlistEntry(ctx context.Context, event, command string) map[string]any

Allowlist record of the pair, nil when none

func ShellHookAllowlistPath

func ShellHookAllowlistPath(ctx context.Context) string

Path of the current home's shell hook allowlist

func ShellHookDirective

func ShellHookDirective(result *ShellHookResult) (string, error)

ShellHookDirective is the answer a run handed back in the wire shape, empty when it answered nothing

func ShellHookEvents

func ShellHookEvents() []string

ShellHookEvents is every event a shell hook may be set on

func ShellHookScriptIsExecutable

func ShellHookScriptIsExecutable(command string) bool

Whether the command runs as configured, a bare script needing execute and an interpreted one read access

func ShellHookScriptMtimeISO

func ShellHookScriptMtimeISO(command string) (string, bool)

ISO mtime of the command's resolved script, false when it is missing

func ShouldAllowPluginInstall

func ShouldAllowPluginInstall(result skills.ScanResult, force bool) (*bool, string)

ShouldAllowPluginInstall maps a verdict to allowed, nil for confirmation, and the reason

func StartBackgroundPluginDiscovery

func StartBackgroundPluginDiscovery(ctx context.Context)

Starts plugin discovery on a background goroutine unless done or already in flight

func StreamHeld

func StreamHeld(ctx context.Context) bool

Reports whether the active profile holds its reply stream for an output transform, after lazy discovery

func StreamReasoningDeltasEnabled

func StreamReasoningDeltasEnabled(ctx context.Context) bool

Reports whether plugins.stream_reasoning_deltas opts the plugins of the manager's profile into reasoning deltas

func SuppressPluginDiscovery

func SuppressPluginDiscovery(ctx context.Context) context.Context

Context in which discovery is a no op so the scope manager stays undiscovered

func SwapBundled

func SwapBundled(add ...Plugin) (restore func())

Adds compiled-in plugins for a caller outside the package until the returned restore drops them again

func SwapCatalogDir

func SwapCatalogDir(dir string) func()

Points the in-tree catalog at a directory, the returned func putting the previous source back

func SweepPendingPluginDeletes

func SweepPendingPluginDeletes(ctx context.Context)

Deletes what an earlier remove parked because another process held it

func SyncShellHooksFromConfig

func SyncShellHooksFromConfig(ctx context.Context)

Brings this home's wired hooks in step with the hooks setting of ctx and consent, never prompting and never disarming on bad input

func TimedSessionReset

func TimedSessionReset(cfg any) (mode string, ok bool)

Mode of a timed session_reset block a config declares, ok false when there is none

func UnattendedInstallPlugin

func UnattendedInstallPlugin(ctx context.Context, opts UnattendedInstallOptions) (map[string]any, error)

Non interactive install with the kill list enforced on every path

func UnattendedRemoveUserPlugin

func UnattendedRemoveUserPlugin(ctx context.Context, name string) (map[string]any, error)

Deletes a plugin tree under the user plugins dir only, refusing bundled plugins

func UnattendedUpdateUserPlugin

func UnattendedUpdateUserPlugin(ctx context.Context, name string, acceptCapabilities, force bool) (map[string]any, error)

Non interactive update by catalog re pin or git pull, refusals as answers

func UserPluginsDir

func UserPluginsDir(ctx context.Context) (string, bool)

Plugins dir of the active home when it exists

func ValidCapabilityIDs

func ValidCapabilityIDs() []string

Sorted ids of every known capability

func ValidHooks

func ValidHooks() []string

Every lifecycle hook name a plugin may register, sorted

func ValidateConfigSchema

func ValidateConfigSchema(pluginID string, schema map[string]map[string]any, settings map[string]any) []string

Warning strings for settings that violate the config schema

func ValidateConfigSeed

func ValidateConfigSeed(pluginID string, seed any) (map[string]any, error)

Validated copy of one plugin's config seed, refusing reserved, trust gate and secret shaped keys at any depth

func VersionSatisfies

func VersionSatisfies(spec, current string) bool

Reports whether current satisfies every comma separated clause, unparseable versions passing

func WithOrderedResult

func WithOrderedResult(ctx context.Context) context.Context

Context whose host calls return dict results with their keys in wire order

func WithSharedDependencyAnswers

func WithSharedDependencyAnswers(ctx context.Context) context.Context

Context in which each dependency question is asked once and repeats reuse the first answer

func WithToolWhitelist

func WithToolWhitelist(ctx context.Context, allowed map[string]bool, denyFmt string) context.Context

Restricts the tools pre_tool_call admits for work under the returned context

Types

type AdmissionRefused

type AdmissionRefused struct{ Msg string }

The candidate plugin set was refused with config and environment untouched

func (*AdmissionRefused) Error

func (e *AdmissionRefused) Error() string

type AdmitOptions

type AdmitOptions = admitOptions

AdmitOptions carries the keyword arguments of admit_plugin_set_change

type Advisory

type Advisory struct {
	ID          string
	Title       string
	Summary     string
	URL         string
	Compromised []AdvisoryPackage
	Remediation []string
	Published   string
	Severity    string
}

One security advisory, its stable id, the compromised packages and the ordered remediation steps

type AdvisoryHit

type AdvisoryHit struct {
	Advisory         Advisory
	Package          string
	InstalledVersion string
}

One package version match against an advisory

func AdvisoryHitsDueForBanner

func AdvisoryHitsDueForBanner(ctx context.Context, hits []AdvisoryHit, repeatHours int) []AdvisoryHit

Hits not dismissed and not shown within the repeat window, each stamped into the banner cache

func DetectCompromised

func DetectCompromised(ctx context.Context, advisories []Advisory) []AdvisoryHit

Every advisory package that is installed at a compromised version, or at any version for an empty set

func FilterUnackedAdvisories

func FilterUnackedAdvisories(ctx context.Context, hits []AdvisoryHit) []AdvisoryHit

Hits whose advisories are not dismissed

type AdvisoryPackage

type AdvisoryPackage struct {
	Name     string
	Versions map[string]bool
}

One package of an advisory with its compromised versions, an empty set flagging any installed version

type AgentPluginDiagnostic

type AgentPluginDiagnostic struct {
	Scope   string
	Message string
}

One non fatal portable package problem

func ReadAgentPluginManifest

func ReadAgentPluginManifest(pluginRoot string) (map[string]any, []AgentPluginDiagnostic, error)

Validated root plugin.json without discovering components

type AgentPluginError

type AgentPluginError struct{ Msg string }

Fatal portable manifest validation failure

func (*AgentPluginError) Error

func (e *AgentPluginError) Error() string

type AgentPluginPackage

type AgentPluginPackage struct {
	Name               string
	Version            string
	Description        string
	Root               string
	DataRoot           string
	Manifest           map[string]any
	Skills             []AgentPluginSkill
	MCPServers         map[string]map[string]any
	ServerDeclarations map[string]AgentPluginServerDeclaration
	Diagnostics        []AgentPluginDiagnostic
}

Validated and translated portable package

func LoadAgentPlugin

func LoadAgentPlugin(pluginRoot, dataRoot string) (*AgentPluginPackage, error)

Validates and translates one installed portable package

type AgentPluginServerDeclaration

type AgentPluginServerDeclaration struct {
	Name     string
	App      map[string]any
	Requires map[string]any
	Liveness map[string]any
}

One local application declaration of a portable package server

type AgentPluginSkill

type AgentPluginSkill struct {
	Name        string
	Description string
	Root        string
	SkillMD     string
	Frontmatter map[string]any
}

One skill a portable package ships

type AuxLLMRequest

type AuxLLMRequest struct {
	Task        *string
	Provider    *string
	Model       *string
	Messages    []any
	Temperature *float64
	MaxTokens   *int
	Timeout     *float64
	ExtraBody   map[string]any
	RouteInfo   map[string]string
}

Keyword arguments of agent.auxiliary_client call_llm and async_call_llm for one plugin completion

type AuxTaskOptions

type AuxTaskOptions struct {
	DisplayName any
	Description any
	Defaults    any
	InheritFrom any
}

Options of one plugin auxiliary task registration, each holding the value the plugin passed

type Awaitable

type Awaitable interface {
	Await(ctx context.Context) (any, error)
}

Deferred result a hook, event or command callback returns for the dispatcher to await

type BlueprintSpec

type BlueprintSpec struct {
	Title            any
	Description      any
	ScheduleTemplate any
	PromptTemplate   any
	Category         any
	Slots            any
	DeliverDefault   any
	Skills           any
	Tags             any
}

Fields of one plugin automation blueprint registration as the plugin passed them, checked by the builder

type CLICommand

type CLICommand struct {
	Name        string
	Help        string
	Description string
	Setup       func(parser any)
	Handler     func(args any) error
	// Plugin parser of a hosted plugin parsing the raw arguments onto the top level namespace and running its func
	Parse     func(ctx context.Context, top map[string]any, argv []string) (CLIOutcome, error)
	Plugin    string
	PluginKey string
}

Plugin CLI subcommand registration with its parser setup and handler

type CLIOutcome

type CLIOutcome struct {
	Code       int
	Exited     bool
	Dispatched bool
	Extras     []string
}

What a hosted plugin command did, the exit status it raised or returned and arguments nothing recognized

type CallbackPanicError

type CallbackPanicError struct{ Value any }

Error carrying a recovered callback panic

func (*CallbackPanicError) Error

func (e *CallbackPanicError) Error() string

type CapabilitySpec

type CapabilitySpec struct {
	ID          string
	LegacyPath  []string
	Description string
}

One declarable capability and the legacy config gate it maps to

type CatalogCapabilities

type CatalogCapabilities struct {
	ProvidesTools      []string
	ProvidesHooks      []string
	ProvidesMiddleware []string
	RequiresEnv        []string
}

Tools, hooks, middleware and env vars a catalog entry declares

type CatalogInstallOptions

type CatalogInstallOptions struct {
	Force             bool
	Ref               string
	AllowRemoved      bool
	ScanDecision      func(scan any) bool
	BeforeSwap        func(manifest map[string]any, tree string) ([]string, error)
	InspectedSha      string
	NoDeps            bool
	AssumeDepsConsent bool
}

Options of a catalog entry install beyond the entry itself

type Channel

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

Bidirectional request and response over a pair of byte streams, one JSON document per line

func (*Channel) Call

func (c *Channel) Call(ctx context.Context, method string, params map[string]any, timeout time.Duration) (any, error)

Sends a request and returns its result or remote error

func (*Channel) Close

func (c *Channel) Close(reason string)

Marks the channel closed and closes both streams

func (*Channel) ClosedReason

func (c *Channel) ClosedReason() (string, bool)

Close reason, empty while open

func (*Channel) ContextOf

func (c *Channel) ContextOf(id any) context.Context

Caller context recorded for a pending request id this side sent, nil when none is pending

func (*Channel) Request

func (c *Channel) Request(ctx context.Context, method string, params map[string]any, timeout time.Duration) (map[string]any, error)

Sends one request and waits for its reply frame, a zero timeout waiting forever

func (*Channel) Start

func (c *Channel) Start() *Channel

Starts the reader goroutine

type CheckResult

type CheckResult struct {
	Name            string
	Class           string
	Current         string
	Latest          string
	UpdateAvailable *bool
	NeedsFixing     string
	MinIcebath      string
	Reason          string
}

Update check outcome of one plugin, nil pointers and empty strings stand for unknown

func MaybeRunGatewayCheck

func MaybeRunGatewayCheck(ctx context.Context, opts ScheduledCheckOptions) ([]*CheckResult, bool, error)

Gateway boot and housekeeping tick filling the real check, plugins dir and non interactive update seams

func RunChecks

func RunChecks(ctx context.Context, pluginsDir string, opts RunChecksOptions) []*CheckResult

Every update check for one plugins dir, never mutating anything on disk

func RunScheduledCheck

func RunScheduledCheck(ctx context.Context, opts ScheduledCheckOptions) ([]*CheckResult, bool)

One cadence tick of gate, check, receipt and opt in apply, false when not due, disabled or already running

func (*CheckResult) ToJSON

func (r *CheckResult) ToJSON() map[string]any

JSON form with null for every unknown field

type ChoiceAsker

type ChoiceAsker func(question string, labels []string) (string, bool)

Surface prompt taking a question and shown labels, returning the picked label or false

func ClarifyAsker

func ClarifyAsker(callback func(questions []any) map[string]any) ChoiceAsker

Asker over a clarify tool callback taking questions and returning answers keyed by qid

type CommandExit

type CommandExit struct{ Code int }

Process exit a plugin command asks for after printing its message

func (*CommandExit) Error

func (e *CommandExit) Error() string

type CommandSpec

type CommandSpec struct {
	Name         string
	Description  string
	ArgsHint     string
	ArgumentMode string
}

One slash command a manifest declares for its executable entry

type ConsentRefusal

type ConsentRefusal struct{ Text, FailureClass string }

Refusal reason of a dependency consent with the closed install failure class it reports

type Console

type Console struct {
	Out   io.Writer
	Color bool
	// Width in cells panels fit within, zero reading the terminal size the way rich does
	Width int
}

Console markup printer writing plain text, or ANSI styled text when the writer is a terminal

func NewConsole

func NewConsole(w io.Writer) *Console

Console over a writer, styled only when the writer is a terminal file

func (*Console) Print

func (c *Console) Print(markup string)

Prints one markup message with repr highlighting on unwrapped lines so every command in it stays copyable

type Context

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

Facade handed to a plugin so it can register tools, hooks and commands with its manager

func NewContext

func NewContext(m *Manifest, mgr *Manager) *Context

NewContext binds a registration context to a manifest on a manager

func (*Context) APostMessage

func (c *Context) APostMessage(ctx context.Context, text string) (*PluginMessage, error)

Post for async code already on the gateway loop, its edits made with AEdit

func (*Context) AskChoice

func (c *Context) AskChoice(ctx context.Context, question string, choices []any) (string, bool, error)

Asks the slash command user to pick one choice, false when nobody can answer

func (*Context) CallMCP

func (c *Context) CallMCP(ctx context.Context, server, tool string, arguments map[string]any, timeout any) (map[string]any, error)

Calls a tool on an allowlisted MCP server through the native client and wraps the result in an envelope

func (*Context) CredentialedProviderRequest

func (c *Context) CredentialedProviderRequest(ctx context.Context, provider, method, url string, json any, headers map[string]string, timeout time.Duration) (*ProviderRequestAnswer, error)

Sends one provider request with the sign in of the calling plugin attached, the plugin named by its directory

func (*Context) CurrentCronExecution

func (c *Context) CurrentCronExecution(ctx context.Context) (any, error)

Cron run executing in this context, nil outside a cron fire

func (*Context) DelegationBackends

func (c *Context) DelegationBackends() (any, error)

Delegation backend listing and selection service

func (*Context) DispatchTool

func (c *Context) DispatchTool(ctx context.Context, toolName string, args map[string]any, kwargs map[string]any) (string, error)

Dispatches a tool through the registry with the CLI agent as parent when one is attached

func (*Context) Emit

func (c *Context) Emit(ctx context.Context, event string, payload map[string]any) (int, error)

Publishes a bare event under this plugin's namespace and returns the subscriber count scheduled

func (*Context) GetConfig

func (c *Context) GetConfig(ctx context.Context, key string, def any) (any, error)

Plugin relative setting from plugins.entries.<id>.settings in the profile of ctx

func (*Context) HasCapability

func (c *Context) HasCapability(ctx context.Context, capability string) bool

Whether a capability is live for this plugin under the context profile, bundled plugins trusted for overrides

func (*Context) HasPlugin

func (c *Context) HasPlugin(pluginID string) bool

Reports whether another plugin is loaded and enabled under that registry key or manifest name

func (*Context) HomeContext

func (c *Context) HomeContext() context.Context

Context bound to the home of the manager loading this plugin, what load_config resolves during register

func (*Context) InjectMessage

func (c *Context) InjectMessage(ctx context.Context, content, role, sessionKey string, origin any) bool

Queues content for a session key or an origin chat of this profile, true when a host accepted it

func (*Context) LLM

func (c *Context) LLM() *PluginLlm

Host owned completion facade on the active model, overrides gated per plugin

func (*Context) MemoryProvider

func (c *Context) MemoryProvider() any

Memory provider this plugin recorded, nil when none

func (*Context) OnUnload

func (c *Context) OnUnload(callback func() error) (*Registration, error)

Registers a cleanup callback run in reverse acquisition order on unload, errors logged never raised

func (*Context) PlatformActions

func (c *Context) PlatformActions() (any, error)

Capability gated platform action facade re-checking gateway.platform_actions on every call

func (*Context) PluginDir

func (c *Context) PluginDir() string

Directory of the installed plugin tree the context loads, empty for a plugin compiled into the bundled set

func (*Context) PluginID

func (c *Context) PluginID() string

Effective registry key used for every namespace of the plugin

func (*Context) PostMessage

func (c *Context) PostMessage(ctx context.Context, text string) *PluginMessage

Posts text into the session bound to this call and returns an editable handle that never raises

func (*Context) ProfileName

func (c *Context) ProfileName(ctx context.Context) string

Active profile name derived from the context home, default or custom outside named profiles

func (*Context) RegisterApprovalTransport

func (c *Context) RegisterApprovalTransport(ctx context.Context, name string, present tools.ApprovalPresentFunc) error

Registers a human approval transport inactive until security.approval.transport selects it

func (*Context) RegisterAutomationBlueprint

func (c *Context) RegisterAutomationBlueprint(key any, spec BlueprintSpec) (*Registration, error)

Adds an automation blueprint to this profile catalog, malformed or duplicate input warned and skipped

func (*Context) RegisterAuxiliaryTask

func (c *Context) RegisterAuxiliaryTask(rawKey any, opts AuxTaskOptions) (*Registration, error)

Registers an auxiliary LLM task with its own auxiliary config block, the key a str a plugin passed

func (*Context) RegisterBrowserPageBackend

func (c *Context) RegisterBrowserPageBackend(p any) (*Registration, error)

Registers a browser page backend for browsers without a CDP endpoint

func (*Context) RegisterBrowserProvider

func (c *Context) RegisterBrowserProvider(p any) (*Registration, error)

Registers a cloud browser provider matched by browser.cloud_provider

func (*Context) RegisterCLICommand

func (c *Context) RegisterCLICommand(name, help string, setup func(parser any), handler func(args any) error, description string) *Registration

Registers a CLI subcommand whose setup receives the subparser and whose handler runs it

func (*Context) RegisterCommand

func (c *Context) RegisterCommand(name string, handler PluginCommandHandler, description, argsHint, argumentMode string) *Registration

Registers an in session slash command, refusing empty names and built-in conflicts

func (*Context) RegisterContextEngine

func (c *Context) RegisterContextEngine(engine any) (*Registration, error)

Registers the single context engine replacing the built-in compressor, a second one rejected

func (*Context) RegisterContextReference

func (c *Context) RegisterContextReference(provider any) (*Registration, error)

Registers an at prefix context reference provider for the profile, an empty, built-in or taken prefix refused with a warning

func (*Context) RegisterDelegationProvider

func (c *Context) RegisterDelegationProvider(p any) (*Registration, error)

Registers a delegation provider matched by delegation.backend

func (*Context) RegisterHook

func (c *Context) RegisterHook(hookName string, fn HookFunc, holdStream bool) *Registration

Registers a lifecycle hook callback, hold_stream declaring the reply must not stream

func (*Context) RegisterImageGenProvider

func (c *Context) RegisterImageGenProvider(p any) (*Registration, error)

Registers an image generation provider matched by image_gen.provider

func (*Context) RegisterLocale

func (c *Context) RegisterLocale(lang string, source any, endonym string, rtl bool, surface string) (*Registration, error)

Registers one language pack layer for a surface, unload removing the layer

func (*Context) RegisterLocaleDir

func (c *Context) RegisterLocaleDir(path string, metadata map[string]map[string]any) []*Registration

Registers every language file of a locales directory, a broken file skipped with a warning

func (*Context) RegisterLoginBackend

func (c *Context) RegisterLoginBackend(p any) (*Registration, error)

Registers a trusted in process browser vault login backend

func (*Context) RegisterMemoryProvider

func (c *Context) RegisterMemoryProvider(provider any) error

Records an inert memory provider whose activation the memory plugin loader owns

func (*Context) RegisterMiddleware

func (c *Context) RegisterMiddleware(kind string, fn MiddlewareFunc) *Registration

Registers behaviour changing middleware, unknown kinds warned about but stored

func (*Context) RegisterPlatform

func (c *Context) RegisterPlatform(spec PlatformSpec) (*Registration, error)

Registers a gateway platform adapter in the profile scoped platform registry and leases it

func (*Context) RegisterPlatformHandler

func (c *Context) RegisterPlatformHandler(platform string, factory any) error

Registers a factory invoked at platform connect before or as the core handlers register

func (*Context) RegisterProvider

func (c *Context) RegisterProvider(kind string, provider any) (*Registration, error)

Registers a provider of one category into its scope keyed registry and leases the slot for unload

func (*Context) RegisterRedactionPatterns

func (c *Context) RegisterRedactionPatterns(patterns any) int

Additively registers secret token regexes with the redactor, returning how many were accepted

func (*Context) RegisterSecretSource

func (c *Context) RegisterSecretSource(source any) (*Registration, error)

Registers a secret source run by the dotenv loader when secrets.name is enabled

func (*Context) RegisterSkill

func (c *Context) RegisterSkill(name, path, description string, frontmatter map[string]any) (*Registration, error)

Registers a read only skill under the plugin namespace, refusing invalid names and missing files

func (*Context) RegisterSlackActionHandler

func (c *Context) RegisterSlackActionHandler(actionID any, callback any) (*Registration, error)

Registers a Slack Block Kit action handler wired into the Slack app at connect

func (*Context) RegisterSystemPromptSection

func (c *Context) RegisterSystemPromptSection(id string, content any, opts ...SectionOption) (*Registration, error)

Registers bounded context frozen into each new session prompt, from text or a session info callback

func (*Context) RegisterTTSProvider

func (c *Context) RegisterTTSProvider(p any) (*Registration, error)

Registers a text to speech provider matched by tts.provider

func (*Context) RegisterTelegramHandler

func (c *Context) RegisterTelegramHandler(factory any) error

Registers a telegram handler factory

func (*Context) RegisterTerminalEnvironmentProvider

func (c *Context) RegisterTerminalEnvironmentProvider(p any) (*Registration, error)

Registers a terminal environment provider matched by terminal.backend

func (*Context) RegisterTool

func (c *Context) RegisterTool(ctx context.Context, spec ToolSpec) (*Registration, error)

Registers a tool in the profile scoped registry and leases it for unload

func (*Context) RegisterTranscriptionProvider

func (c *Context) RegisterTranscriptionProvider(p any) (*Registration, error)

Registers a speech to text provider matched by stt.provider

func (*Context) RegisterVideoGenProvider

func (c *Context) RegisterVideoGenProvider(p any) (*Registration, error)

Registers a video generation provider matched by video_gen.provider

func (*Context) RegisterWebSearchProvider

func (c *Context) RegisterWebSearchProvider(p any) (*Registration, error)

Registers a web search provider matched by the web backend settings

func (*Context) RegisterWidget

func (c *Context) RegisterWidget(spec WidgetSpec) (*Registration, error)

Registers a terminal UI widget under its id, a modal one by default and an ambient one in the top right by default

func (*Context) SessionCwd

func (c *Context) SessionCwd(ctx context.Context) (string, error)

Recorded working directory of the calling session, never the gateway process cwd

func (*Context) SessionSurface

func (c *Context) SessionSurface(ctx context.Context) (string, error)

Client surface or messaging platform of the calling session

func (*Context) SetConfig

func (c *Context) SetConfig(ctx context.Context, key string, value any) error

Atomically writes one value in the settings subtree of this plugin under the context profile

func (*Context) SideQuestion

func (c *Context) SideQuestion(ctx context.Context, token, prompt, timeout any) (*string, error)

Asks the session agent about the turn that just ended, nil without the side question capability

func (*Context) SpawnTask

func (c *Context) SpawnTask(ctx context.Context, fn func(context.Context) error, name string) (*PluginTask, error)

Starts a supervised task on its own goroutine, unload cancelling its context

func (*Context) State

func (c *Context) State(ctx context.Context) *PluginState

Profile scoped durable JSON state of this plugin under the context profile

func (*Context) SubagentLifecycle

func (c *Context) SubagentLifecycle() *SubagentLifecycleService

Plugin safe subagent lifecycle service returning serializable handles and snapshots

func (*Context) Subscribe

func (c *Context) Subscribe(event string, fn EventFunc) error

Subscribes to a fully qualified plugin event, owner tagged so a failed load removes the callback

func (*Context) WithDelegationSink

func (c *Context) WithDelegationSink(sink func(provider any)) *Context

Context whose register_delegation_provider hands the provider to sink instead of the registry, the bundled registrar

type ContextEngineInfo

type ContextEngineInfo struct {
	Name        string
	Description string
	Available   bool
}

ContextEngineInfo is one discovered context engine with its description and availability

func DiscoverContextEngines

func DiscoverContextEngines(ctx context.Context) ([]ContextEngineInfo, error)

Every bundled and user context engine with its plugin.yaml description and availability

type Dataclass

type Dataclass struct {
	Type   string
	Fields Record
}

Dataclass is a Record rebuilt as the dataclass a provider base declares, every init field present

type DeferredPlatformLoader

type DeferredPlatformLoader struct {
	Load func(ctx context.Context)
}

Lazy loader of a bundled platform plugin run when the registry is first asked for it

type DependencyConflict

type DependencyConflict struct{ Cause, Plugin string }

The resolver proved the candidate set cannot co-install with the pinned dependency set

func (*DependencyConflict) Error

func (e *DependencyConflict) Error() string

Conflict message leading with the plugin the user asked for and keeping the resolver cause

func (*DependencyConflict) Unwrap

func (e *DependencyConflict) Unwrap() error

The AdmissionRefused base so a refusal check also catches a conflict

type DiscordActionChannel

type DiscordActionChannel interface {
	FetchMessage(ctx context.Context, id int64) (DiscordActionMessage, error)
}

type DiscordActionClient

type DiscordActionClient interface {
	GetChannel(id int64) DiscordActionChannel
	FetchChannel(ctx context.Context, id int64) (DiscordActionChannel, error)
}

Discord client calls the reaction verb makes, a nil channel from GetChannel meaning not cached

type DiscordActionMessage

type DiscordActionMessage interface {
	AddReaction(ctx context.Context, emoji string) error
}

type DoctorFinding

type DoctorFinding struct {
	Level   string
	Message string
}

One Doctor finding at error or warning level

type EnvSpec

type EnvSpec struct {
	Name        string
	Description string
	URL         string
	Secret      bool
}

One requires_env entry with the install prompt metadata

type ErrorClassificationInput

type ErrorClassificationInput struct {
	Provider, Model, ErrorType, ErrorCode, ErrorMessage string
	StatusCode                                          *int
	ErrorBody                                           map[string]any
	Err                                                 error
	ApproxTokens, ContextLength, NumMessages            int
}

Error facts offered to transform_api_error_classification hooks

type EventFunc

type EventFunc func(ctx context.Context, payload map[string]any) (any, error)

Event subscriber receiving a private deep copy of the payload under the emitter's context

type FileNotFoundError

type FileNotFoundError struct{ Msg string }

Missing file error mirroring Python FileNotFoundError

func (*FileNotFoundError) Error

func (e *FileNotFoundError) Error() string

type GitTimeoutError

type GitTimeoutError struct{ Timeout time.Duration }

Git subprocess killed at its deadline

func (*GitTimeoutError) Error

func (e *GitTimeoutError) Error() string

type GithubHTTPError

type GithubHTTPError struct {
	Code   int
	Header http.Header
}

HTTP error status api.github.com answered with its response headers

func GithubHTTPErrorFromResponse

func GithubHTTPErrorFromResponse(resp *http.Response) *GithubHTTPError

Error for a non success api.github.com response, nil for a 2xx or 3xx status

func (*GithubHTTPError) Error

func (e *GithubHTTPError) Error() string

type HookCheck

type HookCheck struct {
	Executable bool
	Allowed    bool
	// When it was allowed, a question mark when the allowlist does not say
	ApprovedAt string
	// Whether the allowlist holds a script time to compare, with Drift as in HookView when it does
	DriftChecked       bool
	Drift              int
	DriftWas, DriftNow string
	// Run on a sample event, nil for a hook that is not allowed or cannot run
	Run *ShellHookResult
	// What a finished run printed: empty, json or invalid
	Output string
	// How many of the findings are problems
	Problems int
}

HookCheck is what checking one configured hook found

func CheckShellHook

func CheckShellHook(ctx context.Context, event, command string) (*HookCheck, error)

CheckShellHook checks a configured hook of the home in the context

type HookFunc

type HookFunc func(ctx context.Context, kwargs map[string]any) (any, error)

Hook callback receiving the hook payload fields and returning an optional directive or value

type HookRefusal

type HookRefusal struct{ Message string }

HookRefusal is a change to the hooks refused for what was asked

func (*HookRefusal) Error

func (e *HookRefusal) Error() string

type HookView

type HookView struct {
	Event, Command, Matcher string
	Timeout                 int
	FailClosed              bool
	// On the allowlist, so it runs
	Allowed bool
	// When it was allowed, empty when the allowlist does not say
	ApprovedAt string
	// 1 when the script changed since it was allowed, 0 when it did not, -1 when that cannot be told
	Drift              int
	DriftWas, DriftNow string
}

HookView is one configured shell hook with its consent state

type HooksArgs

type HooksArgs struct {
	Action, Event, ForTool, PayloadFile, Command string
}

Parsed icebath hooks arguments, Action empty when no subcommand was given

type HostBuiltinError

type HostBuiltinError struct {
	Type    string
	Message string
	Bases   []string
}

Remote raise of a builtin exception class plugins commonly catch, message only like str(exc)

func (*HostBuiltinError) ClassChain

func (e *HostBuiltinError) ClassChain() []string

Class names of the remote exception through BaseException, its type(exc).__mro__ without object

func (*HostBuiltinError) Error

func (e *HostBuiltinError) Error() string

type HostEvent

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

Flag living in this process that a plugin reads, waits on and sets through its host

func NewHostEvent

func NewHostEvent() *HostEvent

Unset event living in this process

func (*HostEvent) IsSet

func (e *HostEvent) IsSet() bool

Whether the flag is set

func (*HostEvent) Set

func (e *HostEvent) Set()

Sets the flag and wakes every waiter in this process and in the plugins that wait on it

func (*HostEvent) Wait

func (e *HostEvent) Wait(ctx context.Context, timeout time.Duration) bool

Blocks until the flag is set, ctx ends or timeout passes (negative waits without limit) and answers the flag

type HostFacade

type HostFacade interface {
	HostAttr(ctx context.Context, name string) (value any, isMethod bool, async bool, err error)
	HostCall(ctx context.Context, method string, args []any, kwargs map[string]any) (any, error)
}

Parent object whose attributes and methods a hosted plugin reaches by Python name

type HostObjectFacade

type HostObjectFacade interface {
	HostFacade
	ErrorKind() string
	Quoted() string
}

Parent object a ctx method returns that the plugin keeps by reference, with the Python type name and repr it shows

type HostParam

type HostParam = paramValue

HostParam is one Python parameter of a host facade method another package implements

func HostKwo

func HostKwo(name string, def any) HostParam

HostKwo is a keyword only parameter of a host facade method with its default

func HostReq

func HostReq(name string) HostParam

HostReq is a required positional or keyword parameter of a host facade method

type HostedCallOptions

type HostedCallOptions struct {
	// Per positional argument, the dotted builder path the child makes the Python value with from the dict sent
	Build []string
	// Base an instance answer is judged against when it crosses as a hosted object
	Describe string
	// Per positional argument, the method whose answer the child returns after the call
	Dump []string
	// Per positional argument, an item of another argument's attribute passed in its place
	Derive []*HostedDerive
	// Longest time the call may run, zero for no limit
	Timeout time.Duration
}

Builders of a hosted call's positional arguments and how its answer crosses back

type HostedCallable

type HostedCallable struct {
	Async    bool
	Sig      []wireParam
	Name     string
	QualName string
	Module   string
	// Dataclass fields or partial function and arguments of the callable, nil for a plain function
	Shape map[string]any
	// contains filtered or unexported fields
}

Plugin callable living in the child, invoked over the wire with its declared signature

func (*HostedCallable) Call

func (f *HostedCallable) Call(ctx context.Context, args []any, kwargs map[string]any) (any, error)

Calls the plugin callable in the child

func (*HostedCallable) CallWith

func (f *HostedCallable) CallWith(ctx context.Context, args []any, kwargs map[string]any, opts HostedCallOptions) (any, []any, error)

Calls the plugin callable with built arguments, answering the value and the dumped arguments

func (*HostedCallable) HostContext

func (f *HostedCallable) HostContext() context.Context

Context the plugin host was started for, its profile home bound

type HostedDerive

type HostedDerive struct {
	From     int
	Attr     string
	Key      any
	KeyBuild string
}

Argument taken as getattr(args[From], Attr)[Key], the key built by KeyBuild when set

type HostedObject

type HostedObject struct {
	TypeName string
	Base     string
	// Identity the child judged from the class alone for an object an in process registrar received
	Identity map[string]any
	// contains filtered or unexported fields
}

Plugin provider object living in the child, an instance of its provider base on the parent side

func CollectMemoryProviderInHost

func CollectMemoryProviderInHost(ctx context.Context, name, providerDir string, registerSkills bool, trackSkill func(qualifiedName string)) (*HostedObject, error)

Loads the memory provider a wasm or program plugin directory registers, its hooks and skills collected the way the memory loader collects them

func LoadCategoryInstance

func LoadCategoryInstance(ctx context.Context, pluginDir, baseRef, capture string, facades map[string]HostFacade) (*HostedObject, error)

Loads the one provider a wasm or program plugin directory registers for a category, its other registrations kept from the host and the objects in facades answering it under their names

func LoadComputerUseProviderInHost

func LoadComputerUseProviderInHost(ctx context.Context, providerDir string) (*HostedObject, error)

Loads the computer use provider a wasm or program plugin directory registers, nil when it registers none

func LoadContextEngine

func LoadContextEngine(ctx context.Context, name string) *HostedObject

Context engine instance by name, nil when it is not found or fails to load

func (*HostedObject) AcceptsKeyword

func (o *HostedObject) AcceptsKeyword(method, keyword string) bool

Whether the hosted method takes keyword, true for an unknown signature or one taking var keywords

func (*HostedObject) BindPlatform

func (o *HostedObject) BindPlatform(ctx context.Context, installHandle bool, handle, runner func(ctx context.Context, event map[string]any) (any, error),
	lifecycle func(ctx context.Context, name string, args []any, kwargs map[string]any) error) error

Routes a hosted platform adapter's inbound events and its own lifecycle hook calls to the Go adapter

func (*HostedObject) Call

func (o *HostedObject) Call(ctx context.Context, method string, args []any, kwargs map[string]any) (any, error)

Calls one method of the plugin object in the child, a dotted name reading its attribute path first as Python does

func (*HostedObject) CallBuilt

func (o *HostedObject) CallBuilt(ctx context.Context, method string, args []any, kwargs map[string]any, build []string) (any, error)

Calls one method of the plugin object with positional arguments built in the child by the named builders

func (*HostedObject) DefinedOutside

func (o *HostedObject) DefinedOutside(ctx context.Context, module string, names []string) (map[string]bool, error)

Python names among those asked that the object's class defines outside the module or the instance holds

func (*HostedObject) Dismiss

func (o *HostedObject) Dismiss(ctx context.Context)

Gives back a category instance that was loaded only to look at it and stops its guest when no loaded plugin and no other instance uses it

func (*HostedObject) Get

func (o *HostedObject) Get(ctx context.Context, name string) (any, error)

Reads an attribute, live ones from the child and the rest locally first, an absent one an AttributeError

func (*HostedObject) HasMethod

func (o *HostedObject) HasMethod(name string) bool

Reports whether the object declared a method of that name

func (*HostedObject) LoginBackendCall

func (o *HostedObject) LoginBackendCall(ctx context.Context, op string, params map[string]any) (any, error)

Runs one login backend operation on the object in the child, which type checks its result

func (*HostedObject) MethodIsAsync

func (o *HostedObject) MethodIsAsync(name string) bool

Async flag of a declared method

func (*HostedObject) Next

func (o *HostedObject) Next(ctx context.Context) (item any, ok bool, err error)

Takes the next item of a for loop over the object in the child, ok false once it raises StopIteration

func (*HostedObject) PlatformCall

func (o *HostedObject) PlatformCall(ctx context.Context, name string, args []any, kwargs map[string]any, opts PlatformCallOptions) (any, error)

Calls or reads one name of the adapter surface on the hosted object, private overridable names included

func (*HostedObject) Set

func (o *HostedObject) Set(ctx context.Context, name string, value any) error

Assigns an attribute on the plugin object when the value can cross, else keeps it on the proxy

func (*HostedObject) String

func (o *HostedObject) String() string

type HostedProfile

type HostedProfile struct {
	Name      string
	Type      string
	Fields    map[string]any
	Calls     map[string]HostedProfileCall
	PluginDir string
	Module    string
	// Why this profile is imported in process, its create_client then serving a live host client
	InProcess string
}

Model provider profile whose overridden methods and callable fields run in the plugin host

func LoadProviderPluginProfiles

func LoadProviderPluginProfiles(ctx context.Context, pluginDir, moduleName string) ([]*HostedProfile, error)

Every profile a model provider plugin directory registers, a create_client override keeping its client in the host

func (*HostedProfile) Call

func (p *HostedProfile) Call(ctx context.Context, attr string, args []any, kwargs map[string]any) (any, error)

Runs one overridden method or callable field in the plugin host of the active profile

func (*HostedProfile) CreateClient

func (p *HostedProfile) CreateClient(ctx context.Context, args []any, kwargs map[string]any) (*HostedObject, error)

Runs the overridden create_client in the plugin host and returns the live client it built as a hosted object

type HostedProfileCall

type HostedProfileCall struct {
	Async bool
	Sig   []wireParam
	Field bool
}

One overridden method or callable field of a hosted profile

type HostedScopedRegistry

type HostedScopedRegistry struct {
	Inner ScopedRegistry
	// Typed provider standing in for a plugin host object of the kind, any other value unchanged
	Adapt func(provider any) any
	// Plugin host object behind a stored provider, false for a provider that is none
	Object func(held any) (*HostedObject, bool)
}

Registry view that stores a plugin host object as the typed provider Adapt makes of it and answers snapshots as the object the plugin handed over

func (HostedScopedRegistry) Accepts

func (r HostedScopedRegistry) Accepts(provider any) bool

Whether the inner registry takes the adapted provider

func (HostedScopedRegistry) Identity

func (r HostedScopedRegistry) Identity(provider any) error

Identity verdict of the inner registry on the adapted provider

func (HostedScopedRegistry) ProviderName

func (r HostedScopedRegistry) ProviderName(provider any) string

Name the inner registry reads off the adapted provider

func (HostedScopedRegistry) Register

func (r HostedScopedRegistry) Register(provider any, scope string) (bool, error)

Registers the adapted provider

func (HostedScopedRegistry) Restore

func (r HostedScopedRegistry) Restore(name string, current, replacement any, scope string) bool

Restores the adapted replacement while the adapted current still occupies the slot

func (HostedScopedRegistry) Snapshot

func (r HostedScopedRegistry) Snapshot(name, scope string) any

Occupant of a slot, a stored plugin host provider answered as its host object so the registrar and the leases compare what the plugin registered

type InstallCommandOptions

type InstallCommandOptions struct {
	Identifier   string
	Force        bool
	Enable       *bool
	Ref          string
	AllowRemoved bool
	Brief        bool
	NoDeps       bool
	YesDeps      bool
}

Flags of the plugins install command, a nil Enable prompts for it

type InstallPhase

type InstallPhase string

Slow install step ids a connector operation reports while a plugin installs

const (
	InstallPhaseDownloading    InstallPhase = "downloading"
	InstallPhasePythonPackages InstallPhase = "python_packages"
	InstallPhaseLoadingTools   InstallPhase = "loading_tools"
)

type ListOptions

type ListOptions struct {
	NoBundled, User, Enabled, Plain, JSON bool
}

Filters of icebath plugins list

type LoadedPlugin

type LoadedPlugin struct {
	Manifest             *Manifest
	Module               string
	ModuleFile           string
	ToolsRegistered      []string
	HooksRegistered      []string
	MiddlewareRegistered []string
	CommandsRegistered   []string
	Enabled              bool
	Error                string
	Deferred             bool
	// Whether the enable gate left the plugin out, its error then saying why it was not tried
	Skipped bool
}

type MCPConnector

type MCPConnector interface {
	LoadConfig(ctx context.Context) (map[string]any, error)
	FilterSuspicious(servers map[string]any) map[string]any
	RegisterServers(ctx context.Context, servers map[string]any) ([]string, error)
	RegisteredToolNames(ctx context.Context, server string) ([]string, error)
	UtilityKinds() []string
	Status(ctx context.Context) ([]map[string]any, error)
	SanitizeNameComponent(value string) string
	ToolNamePrefix() string
}

MCP configuration, registration and naming the activation path reaches through the wiring

type Manager

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

Discovers, loads and invokes the plugins of one home

func GetPluginManager

func GetPluginManager(ctx context.Context) *Manager

Plugin manager of the active profile, created once per resolved home and stamped with published hosts

func NewManager

func NewManager(h string) *Manager

Manager scoped to one home with empty registries

func (*Manager) AInvokeHook

func (m *Manager) AInvokeHook(ctx context.Context, hookName string, kwargs map[string]any) []any

Hook invocation for callers on a running loop, awaiting awaitable results inline under the hook timeout

func (*Manager) ApplyLLMRequestMiddleware

func (m *Manager) ApplyLLMRequestMiddleware(request map[string]any, context map[string]any) RequestMiddlewareResult

Runs LLM request middleware where a returned request mapping replaces the provider kwargs

func (*Manager) ApplyToolRequestMiddleware

func (m *Manager) ApplyToolRequestMiddleware(goctx context.Context, toolName string, args, originalArgs map[string]any, context map[string]any) (RequestMiddlewareResult, error)

Runs relay intercepts then tool request middleware where a returned args mapping replaces the tool arguments

func (*Manager) AuxiliaryTasks

func (m *Manager) AuxiliaryTasks() map[string]map[string]any

Plugin auxiliary task entries by key

func (*Manager) CLICommands

func (m *Manager) CLICommands() map[string]*CLICommand

Plugin CLI subcommands by name

func (*Manager) ClearGatewayMessageInjector

func (m *Manager) ClearGatewayMessageInjector(owner any)

Clears the gateway injector only while it still belongs to the owner

func (*Manager) ClearTUIMessageInjector

func (m *Manager) ClearTUIMessageInjector(owner any)

Clears the TUI injector only while it still belongs to the owner

func (*Manager) ContextEngine

func (m *Manager) ContextEngine() any

Plugin registered context engine, nil when none

func (*Manager) DiscoverAndLoad

func (m *Manager) DiscoverAndLoad(ctx context.Context, force bool)

Scans every plugin source and loads each plugin, force unloading first so config changes apply

func (*Manager) EnabledPluginsDeclaring

func (m *Manager) EnabledPluginsDeclaring(capability string) []string

Keys of the enabled plugins whose manifest declares the capability, sorted

func (*Manager) FindPluginSkill

func (m *Manager) FindPluginSkill(qualified string) (string, bool)

SKILL.md path of a qualified plugin skill

func (*Manager) GetApprovalTransport

func (m *Manager) GetApprovalTransport(ctx context.Context, name string) *tools.RegisteredApprovalTransport

Approval transport registered under a name, only inside the profile that registered it

func (*Manager) GetPlatformHandlerFactories

func (m *Manager) GetPlatformHandlerFactories(platform string) []*PlatformHandlerFactory

Handler factories registered for one platform

func (*Manager) GetPortableMCPServerPlugins

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

Owning plugin key of every portable MCP server

func (*Manager) GetPortableMCPServers

func (m *Manager) GetPortableMCPServers() map[string]map[string]any

Defensive copy of the enabled portable MCP server configs

func (*Manager) GetSlackActionHandlers

func (m *Manager) GetSlackActionHandlers() []*SlackActionHandler

Slack action handlers for the Slack adapter to wire at connect

func (*Manager) GetTelegramHandlerFactories

func (m *Manager) GetTelegramHandlerFactories() []*PlatformHandlerFactory

Handler factories registered for telegram

func (*Manager) GuestHosts

func (m *Manager) GuestHosts() []*PluginHost

Hosts of the third party plugins of a manager, sorted by plugin key

func (*Manager) HasEnabledPortableMCP

func (m *Manager) HasEnabledPortableMCP(rawConfig map[string]any) bool

Whether config enables a portable package with MCP servers, probed without loading plugins

func (*Manager) HasGatewayMessageInjector

func (m *Manager) HasGatewayMessageInjector() bool

Reports whether a live gateway can accept plugin triggered turns

func (*Manager) HasHook

func (m *Manager) HasHook(hookName string) bool

Reports whether at least one callback is registered for a hook outside a safe worker

func (*Manager) HasMiddleware

func (m *Manager) HasMiddleware(kind string) bool

Reports whether any middleware of a kind is registered outside a safe worker

func (*Manager) HasPortableMCPServers

func (m *Manager) HasPortableMCPServers() bool

Whether any portable MCP server is registered

func (*Manager) HasTUIMessageInjector

func (m *Manager) HasTUIMessageInjector() bool

Reports whether a live TUI host can accept plugin triggered turns

func (*Manager) HeldTransforms

func (m *Manager) HeldTransforms() []*hookEntry

Output transform callbacks a held turn runs, captured with the hold decision, nil when nothing holds

func (*Manager) HoldsStream

func (m *Manager) HoldsStream() bool

Reports whether a loaded output transform registration declared hold_stream

func (*Manager) InjectGatewayMessage

func (m *Manager) InjectGatewayMessage(ctx context.Context, kwargs map[string]any) bool

Submits a plugin triggered turn to the live gateway

func (*Manager) InjectTUIMessage

func (m *Manager) InjectTUIMessage(ctx context.Context, kwargs map[string]any) bool

Submits a plugin triggered turn to the live TUI host

func (*Manager) InvokeHook

func (m *Manager) InvokeHook(ctx context.Context, hookName string, kwargs map[string]any) []any

Calls every callback of a hook and returns their non nil results, empty inside a safe worker

func (*Manager) InvokeMiddleware

func (m *Manager) InvokeMiddleware(kind, payloadKey string, kwargs map[string]any) []any

Calls every middleware of a kind in isolation, request kinds composing rewrites under the payload key

func (*Manager) IterHookCallbacks

func (m *Manager) IterHookCallbacks(hookName string) []HookFunc

Stable snapshot of a hook's callbacks, empty inside a safe worker

func (*Manager) ListAutomationBlueprints

func (m *Manager) ListAutomationBlueprints() []any

Plugin registered automation blueprints sorted by key

func (*Manager) ListPluginSkillMetadata

func (m *Manager) ListPluginSkillMetadata() []map[string]any

Progressive disclosure metadata of every registered plugin skill sorted by qualified name

func (*Manager) ListPluginSkills

func (m *Manager) ListPluginSkills(pluginName string) []string

Sorted bare names of every skill a plugin registered

func (*Manager) ListPlugins

func (m *Manager) ListPlugins() []map[string]any

Info rows of every discovered plugin sorted by key

func (*Manager) LoadFailures

func (m *Manager) LoadFailures() [][2]string

Plugins whose load was tried and failed, each as its name and its failure, sorted by key

func (*Manager) LoadedPluginsInOrder

func (m *Manager) LoadedPluginsInOrder() []OrderedPlugin

Every loaded record in the order its key was first stored

func (*Manager) MarkDiscoveredForTests

func (m *Manager) MarkDiscoveredForTests()

Marks the manager discovered without a sweep, the test pin of a zero plugin runtime

func (*Manager) OnPluginLoaded

func (m *Manager) OnPluginLoaded(callback func(summaries []map[string]any)) (func(), error)

Subscribes a process listener to sweeps that load plugins this process did not have, returning its unsubscribe

func (*Manager) OwnedRegistrations

func (m *Manager) OwnedRegistrations(pluginKey string) []*Registration

Registrations the ownership ledger attributes to one plugin key

func (*Manager) PluginCommandOrder

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

Registered plugin command names in insertion order, a name replaced in place keeping its rank

func (*Manager) PluginCommands

func (m *Manager) PluginCommands() map[string]*PluginCommand

Plugin slash commands by name

func (*Manager) PluginKeys

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

Keys of every plugin the manager has a record for, sorted

func (*Manager) RearmFailedPlatform

func (m *Manager) RearmFailedPlatform(ctx context.Context, platformName string) bool

Re-leases the deferred loader of a failed platform plugin so the next lookup retries it

func (*Manager) RegisterApprovalTransport

func (m *Manager) RegisterApprovalTransport(ctx context.Context, name string, present tools.ApprovalPresentFunc, pluginID string) error

Manager level approval transport registration without unload tracking

func (*Manager) RegistrationOrder

func (m *Manager) RegistrationOrder() []*Registration

Registrations enrolled in reverse order teardown, in registration order

func (*Manager) RemovePluginSkill

func (m *Manager) RemovePluginSkill(qualified string)

Drops a stale plugin skill entry, ignoring missing names

func (*Manager) RenderSystemPromptSections

func (m *Manager) RenderSystemPromptSections(sessionInfo map[string]any) []RenderedSystemPromptSection

Renders every registered section in id order within the count and size budgets, failing open

func (*Manager) RunHeldTransforms

func (m *Manager) RunHeldTransforms(ctx context.Context, callbacks []*hookEntry, kwargs map[string]any) (string, bool)

Runs a held turn's snapshotted transforms returning the first non empty rewrite and whether all failed

func (*Manager) RunLLMExecutionMiddleware

func (m *Manager) RunLLMExecutionMiddleware(request map[string]any, next NextCall, context map[string]any) (any, error)

Runs provider execution through the registered LLM execution middleware

func (*Manager) RunToolExecutionMiddleware

func (m *Manager) RunToolExecutionMiddleware(toolName string, args map[string]any, next NextCall, context map[string]any) (any, error)

Runs tool execution through the registered tool execution middleware

func (*Manager) ScopeKey

func (m *Manager) ScopeKey() string

Home key the manager is scoped to

func (*Manager) SetGatewayMessageInjector

func (m *Manager) SetGatewayMessageInjector(owner any, injector MessageInjector)

Publishes a live gateway injector and its lifecycle owner

func (*Manager) SetTUIMessageInjector

func (m *Manager) SetTUIMessageInjector(owner any, injector MessageInjector)

Publishes a live TUI injector without touching the gateway slot

func (*Manager) TrackHook

func (m *Manager) TrackHook(c *Context, hookName string, fn HookFunc, holdStream bool) *Registration

Registers a hook callback for a context, hold_stream honoured only on the output transform hook

func (*Manager) Unload

func (m *Manager) Unload(plugin any) bool

Unloads one plugin by key, manifest name, manifest or loaded record, or every plugin when nil

func (*Manager) Widgets

func (m *Manager) Widgets() []Widget

Registered widgets of this manager sorted by id

type Manifest

type Manifest struct {
	Name              string
	Version           string
	Description       string
	Author            string
	RequiresEnv       []EnvSpec
	ProvidesTools     []string
	ProvidesHooks     []string
	ProvidesMiddlewar []string
	Source            string
	Path              string
	Kind              string
	Key               string
	RequiresIcebath   string
	Portable          bool
	DataNamespace     string
	Capabilities      []string
	ManifestVersion   int
	APIVersion        *int
	RequiresPlugins   []PluginDependency
	PythonDeps        []string
	PythonRuntime     string
	ConfigSchema      map[string]map[string]any
	License           string
	Homepage          string
	Tags              []string
	Emits             []string
	Listens           []string
	ProvidesLocales   []string
	LocaleMetadata    map[string]map[string]any
	ConfigKeys        []string
	UpdateURL         string
	RequiresAuth      []string
	OAuth             []map[string]any
	Entry             []string
	SkillDirs         []string
	Commands          []CommandSpec
	MCPServers        map[string]map[string]any
	Raw               map[string]any
}

Parsed plugin.yaml or portable plugin.json manifest

func CatalogPortManifest

func CatalogPortManifest(name string) Manifest

Manifest of a catalog port read from the plugin.yaml of its compiled-in catalog tree

func CollectDirectoryManifests

func CollectDirectoryManifests(h string) []*Manifest

Directory manifests of a home in discovery order with bundled Go plugins first

func DiscoverEntrypointManifests

func DiscoverEntrypointManifests(ctx context.Context) []*Manifest

Metadata only manifests of the entry point plugins installed in the selected dependency environment

func ParseManifestFile

func ParseManifestFile(file, dir, source, prefix string) *Manifest

Parses one plugin.yaml file into a manifest, nil with a warning on failure

func ScanDirectory

func ScanDirectory(path, source string, skipNames map[string]bool) []*Manifest

Manifests under a plugins root, one level of category nesting, portable packages included

func (*Manifest) HasEntry

func (m *Manifest) HasEntry() bool

Reports whether the manifest names an executable that speaks the plugin host protocol

func (*Manifest) ID

func (m *Manifest) ID() string

Registry id of a manifest, the path derived key when set, else the bare name

func (*Manifest) ManifestOnly

func (m *Manifest) ManifestOnly() bool

Reports whether the plugin loads from declared files alone with no code to run

type ManifestGate

type ManifestGate struct {
	Action  string
	Enabled bool
	Error   string
	Log     string
	Level   string
}

Routing verdict for one winning manifest

func GateManifest

func GateManifest(h string, m *Manifest, disabled map[string]bool, enabled map[string]bool) ManifestGate

Decides how one winning manifest is handled by the enable gate

type MessageInjector

type MessageInjector func(ctx context.Context, kwargs map[string]any) bool

Callback a live host uses to accept a plugin triggered turn

type MessageReactionAdapter

type MessageReactionAdapter interface {
	AddReaction(ctx context.Context, chatID, messageID, emoji string) error
}

Adapter whose platform API adds an emoji reaction to a message

type MiddlewareFunc

type MiddlewareFunc func(kwargs map[string]any) (any, error)

Middleware callback receiving keyword payload fields, returning a rewrite or the wrapped result

type NamedPresence

type NamedPresence struct {
	Name       string `json:"name"`
	Title      string `json:"title"`
	State      string `json:"state"`
	Sentence   string `json:"sentence"`
	Disclosure string `json:"disclosure"`
}

NamedPresence is one questionnaire row with the app state and the description disclosure

func PresenceFor

func PresenceFor(ctx context.Context, names []string) ([]NamedPresence, error)

Named catalog plugins this os family runs in the order asked, manifests read in parallel, unknown names dropped

type NextCall

type NextCall func(payload any) (any, error)

Downstream continuation an execution middleware calls at most once, nil payload reusing the current one

type Opaque

type Opaque struct {
	TypeName string
	Text     string
}

Live object the other process owns, any attribute access failing with a readable reason

func (*Opaque) Attr

func (o *Opaque) Attr(name string) error

Attribute access on an Opaque, which always fails naming the live object

func (*Opaque) String

func (o *Opaque) String() string

type OrderedPlugin

type OrderedPlugin struct {
	Key    string
	Plugin *LoadedPlugin
}

Plugin key with its loaded record

type OutboundWebhookTarget

type OutboundWebhookTarget struct {
	URL     string
	Events  []string
	Name    string
	Secret  string
	Timeout int
	// contains filtered or unexported fields
}

One hooks.outbound entry parsed and validated, the matcher regex compiled for the tool events

func IterConfiguredOutboundWebhooks

func IterConfiguredOutboundWebhooks(ctx context.Context) ([]*OutboundWebhookTarget, error)

IterConfiguredOutboundWebhooks parses hooks.outbound of the hooks setting of ctx without registering anything, the error an unscoped secret read

func NewOutboundWebhookTarget

func NewOutboundWebhookTarget(url string, events []string, name, secret, matcher string, timeout int) *OutboundWebhookTarget

NewOutboundWebhookTarget builds a target the way the dataclass does, the matcher stripped and compiled or kept literal

func RegisterOutboundWebhooksFromConfig

func RegisterOutboundWebhooksFromConfig(ctx context.Context) ([]*OutboundWebhookTarget, error)

RegisterOutboundWebhooksFromConfig wires every configured target once per home and event, the targets newly wired

func (*OutboundWebhookTarget) Label

func (t *OutboundWebhookTarget) Label() string

Label is the configured name, the url when there is none

func (*OutboundWebhookTarget) MatchesTool

func (m *OutboundWebhookTarget) MatchesTool(toolName any) (bool, error)

Whether the tool name passes the matcher, a TypeError for a non string name against a regex

type PackArgs

type PackArgs struct {
	Action, Source, Name string
	Force, EnabledOnly   bool
}

Parsed icebath plugins pack command line

type PackError

type PackError struct{ Msg string }

Pack parse, validation or fetch failure the CLI exits non zero on

func (*PackError) Error

func (e *PackError) Error() string

type PackInstallResult

type PackInstallResult struct {
	Display       string
	OK            bool
	InstalledName string
	Error         string
}

Outcome of one plugin install within a pack

func InstallPackPlugins

func InstallPackPlugins(ctx context.Context, pack *PluginPack, resolved []ResolvedPackPlugin, console *Console, force bool) ([]PackInstallResult, error)

Fans a pack out to pinned installs with per plugin consent, enabling and seeding each success

type PackPluginEntry

type PackPluginEntry struct {
	Ref, Name, Repo, Subdir string
}

One pinned plugin of a pack, empty name, repo or subdir standing for None

func (PackPluginEntry) Display

func (e PackPluginEntry) Display() string

Name or repo with the subdir of a repo entry, a question mark when neither is set

func (PackPluginEntry) InstallIdentifier

func (e PackPluginEntry) InstallIdentifier() string

Install identifier of a repo entry, empty for a bare name the catalog resolves

type PackSeed

type PackSeed struct {
	ID   string
	Seed map[string]any
}

Plugin id and its validated non secret config seed in pack order

type PlatformActionAdapter

type PlatformActionAdapter interface {
	PlatformValue() string
	IsConnected() bool
}

Live adapter surface every verb needs, its platform value and connection state

type PlatformActionRunner

type PlatformActionRunner interface {
	ParsePlatform(ctx context.Context, value string) (string, error)
}

Runner whose platform values gateway.config.Platform accepts, answering the enum value or an error

type PlatformActions

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

Per plugin facade over the live gateway adapters, resolved at call time and gated by the capability

func NewPlatformActions

func NewPlatformActions(pluginID string) *PlatformActions

Facade holding only the owning plugin id

func (*PlatformActions) AddReaction

func (p *PlatformActions) AddReaction(ctx context.Context, platform, chatID, messageID, emoji any) map[string]any

Adds or sets an emoji reaction on a platform message

func (*PlatformActions) HostAttr

func (p *PlatformActions) HostAttr(_ context.Context, name string) (any, bool, bool, error)

Python attribute of the facade a hosted plugin reads, both verbs answering as coroutine methods

func (*PlatformActions) HostCall

func (p *PlatformActions) HostCall(ctx context.Context, method string, args []any, kwargs map[string]any) (any, error)

Runs add_reaction or set_thread_title for a hosted plugin with the Python argument binding

func (*PlatformActions) SetThreadTitle

func (p *PlatformActions) SetThreadTitle(ctx context.Context, platform, chatID, threadID, title any) map[string]any

Renames a thread or forum topic

type PlatformCallOptions

type PlatformCallOptions struct {
	// Per positional argument, the builder the child makes the Python value with, a leading ** passing the dict as keywords
	Build []string
	// Per keyword argument, the builder the child makes the Python value with when the value is not None
	BuildKw map[string]string
	// Whether the name is read as an attribute instead of called
	Get bool
	// Upstream class a non None answer stays in the child as, crossing as a hosted object, empty to encode it
	Hold string
	// Whether the class implementation runs past the instance bridge, answering None when the class has none
	Own bool
}

How a hosted platform adapter call crosses, its arguments built in the child, an attribute read, or the answer held there

type PlatformDeclarations

type PlatformDeclarations interface {
	Register(name string, app, requires map[string]any) error
	Unregister(name string)
}

Platform declaration registry of portable MCP servers

type PlatformHandlerFactory

type PlatformHandlerFactory struct {
	Factory any
	Plugin  string
}

Platform handler factory a plugin registered, called with the native client and adapter at connect

type PlatformRegistry

type PlatformRegistry interface {
	CoreShipsPlatform(name string) bool
	NewEntry(spec PlatformSpec) (any, error)
	Snapshot(name, scope string) PlatformSlot
	Register(entry any, scope string)
	RegisterDeferred(name string, loader *DeferredPlatformLoader, scope string)
	NoteActivationEnv(name string, env []string)
	IsDeferredLoadCancelled(name, scope string) bool
	Restore(name string, current, previous PlatformSlot, scope string) bool
	Unregister(name string)
}

Gateway platform registry owned by the gateway package

type PlatformSlot

type PlatformSlot struct {
	Entry  any
	Loader *DeferredPlatformLoader
}

Entry and deferred loader occupying one platform registry slot

type PlatformSpec

type PlatformSpec struct {
	Name           string
	Label          string
	AdapterFactory any
	Check          func() bool
	ValidateConfig any
	RequiredEnv    []string
	InstallHint    string
	Extra          map[string]any
}

Arguments of one gateway platform adapter registration

type Plugin

type Plugin interface {
	Manifest() Manifest
	Register(ctx *Context) error
}

A plugin compiled into the binary that registers its tools, hooks and commands through a context

func BundledPlugin

func BundledPlugin(key string) (Plugin, bool)

Exported bundledPlugin

type PluginCatalogEntry

type PluginCatalogEntry struct {
	Name            string
	Repo            string
	Sha             string
	Description     string
	Maintainer      string
	Tier            string
	Category        string
	RequiresIcebath string
	Subdir          string
	DocsURL         string
	Version         string
	Image           string
	Screenshots     []string
	Readme          bool
	Platforms       []string
	Title           string
	Onboarding      bool
	// Installed and enabled once in every home, official and verified entries only
	Default      bool
	Capabilities CatalogCapabilities
	KnownIssues  []string
}

One curated catalog entry pinned to an exact commit

func EntryFromMapping

func EntryFromMapping(raw any, label string) *PluginCatalogEntry

Validated entry of one catalog mapping, nil with a warning on any failure

func FilterEntries

func FilterEntries(entries []*PluginCatalogEntry, query string) []*PluginCatalogEntry

Entries whose name, description or declared tools contain the query case insensitively, all for an empty query

func GetCatalogEntry

func GetCatalogEntry(name, dir string) *PluginCatalogEntry

In-tree catalog entry of a name, nil when the catalog lacks it

func GetLiveCatalogEntry

func GetLiveCatalogEntry(ctx context.Context, name string) *PluginCatalogEntry

Live catalog entry of a name, nil when absent

func GetPluginCatalogEntry

func GetPluginCatalogEntry(name string) (*PluginCatalogEntry, error)

In-tree catalog entry of a name, nil when absent, an error when the shipped catalog cannot be listed

func LoadCatalog

func LoadCatalog(dir string) []*PluginCatalogEntry

Every valid in-tree or directory catalog entry sorted by file name, malformed ones skipped with a warning

func LoadCatalogLive

func LoadCatalogLive(ctx context.Context) []*PluginCatalogEntry

Live or cached catalog entries merged with the in-tree ones, the newer source winning a differing pin

func (*PluginCatalogEntry) InstallIdentifier

func (e *PluginCatalogEntry) InstallIdentifier() string

Installer identifier, repo#subdir for monorepo entries

func (*PluginCatalogEntry) ToDict

func (e *PluginCatalogEntry) ToDict() map[string]any

Ordered mapping of every field the JSON output renders

type PluginCommand

type PluginCommand struct {
	Handler      PluginCommandHandler
	Description  string
	Plugin       string
	PluginKey    string
	ArgsHint     string
	ArgumentMode string
}

In session slash command a plugin registered

type PluginCommandHandler

type PluginCommandHandler func(ctx context.Context, rawArgs string) (any, error)

Slash command handler receiving the raw argument text

func GetPluginCommandHandler

func GetPluginCommandHandler(ctx context.Context, name string) (PluginCommandHandler, bool)

Handler of a plugin slash command after discovery

type PluginCommandTimeoutError

type PluginCommandTimeoutError struct{ Seconds float64 }

Error raised when an awaited plugin command result outlives its bound

func (*PluginCommandTimeoutError) Error

func (e *PluginCommandTimeoutError) Error() string

type PluginDependency

type PluginDependency struct {
	ID           string
	VersionRange string
}

One advisory requires_plugins entry

type PluginDoctorReport

type PluginDoctorReport struct {
	Path                string
	Manifest            *Manifest
	Findings            []DoctorFinding
	RegisteredTools     []string
	RegisteredHooks     []string
	RegisteredProviders []string
}

Plugin Doctor result for one target

func (*PluginDoctorReport) FormatText

func (r *PluginDoctorReport) FormatText() string

Human report with the manifest line, every finding, the verdict and the registration counts

func (*PluginDoctorReport) OK

func (r *PluginDoctorReport) OK() bool

True when no finding is an error

type PluginEntry

type PluginEntry struct {
	Name        string
	Version     string
	Description string
	Source      string
	Dir         string
	Key         string
}

One plugin the loader sees with its display metadata, source label, directory and registry key

func DiscoverAllPlugins

func DiscoverAllPlugins(h string) ([]PluginEntry, error)

Every plugin the loader sees in load order, bundled in sorted tree walk order, then user plugins, then entry points

func FindPluginEntry

func FindPluginEntry(h, name string) (*PluginEntry, error)

Plugin entry for a key or manifest name, else a unique bare leaf, else the catalog name it was installed under

type PluginEventNameError

type PluginEventNameError struct{ Msg string }

Error a ValueError raised by the plugin event naming carries

func (*PluginEventNameError) Error

func (e *PluginEventNameError) Error() string

func (*PluginEventNameError) ErrorKind

func (e *PluginEventNameError) ErrorKind() string

type PluginEventPayloadError

type PluginEventPayloadError struct{ Msg string }

Error a TypeError raised for a plugin event payload that is not a dict carries

func (*PluginEventPayloadError) Error

func (e *PluginEventPayloadError) Error() string

func (*PluginEventPayloadError) ErrorKind

func (e *PluginEventPayloadError) ErrorKind() string

type PluginHost

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

Guest of one plugin of a manager, started on first use and restarted after an unexpected exit

func (*PluginHost) Alive

func (h *PluginHost) Alive() bool

Reports whether the channel is open and the child has not exited

func (*PluginHost) Home

func (h *PluginHost) Home() string

Profile home this host serves

func (*PluginHost) Info

func (h *PluginHost) Info() map[string]any

Hello reply of the running child

func (*PluginHost) Load

func (h *PluginHost) Load(ctx context.Context, mf *Manifest, pctx *Context) error

Runs the register function of a plugin in its guest and replays its registrations onto the plugin context

func (*PluginHost) LoadInstance

func (h *PluginHost) LoadInstance(ctx context.Context, pluginDir, baseRef, capture string, pctx *Context, beforeReload func(context.Context)) (*HostedObject, error)

Runs the register function of a category plugin in its guest and returns a proxy of the one provider it registered for capture, reloaded after a guest restart

func (*PluginHost) PID

func (h *PluginHost) PID() int

Process id of the running child, zero when none

func (*PluginHost) ProfileCall

func (h *PluginHost) ProfileCall(ctx context.Context, pluginDir, moduleName, profile, attr string, args []any, kwargs map[string]any) (any, error)

Runs a model provider profile overridden method or callable field in the child

func (*PluginHost) Shutdown

func (h *PluginHost) Shutdown()

Stops the child, asking it to run unload callbacks first and killing it after the grace period

type PluginHostError

type PluginHostError struct {
	TypeName      string
	RemoteMessage string
	ExitCode      string
	Bases         []string
}

Remote raise naming a class plugins do not commonly catch, or the parent raising while serving

func (*PluginHostError) ClassChain

func (e *PluginHostError) ClassChain() []string

Class names of the remote exception through BaseException, the parent side raise standing as PluginHostError

func (*PluginHostError) Error

func (e *PluginHostError) Error() string

type PluginHostUnavailable

type PluginHostUnavailable struct{ Reason string }

Channel closed because the host process exited or never started

func (*PluginHostUnavailable) Error

func (e *PluginHostUnavailable) Error() string

type PluginHostUnsupported

type PluginHostUnsupported struct{ Msg string }

Context method that cannot cross the plugin host boundary

func (*PluginHostUnsupported) Error

func (e *PluginHostUnsupported) Error() string

type PluginLLMClient

type PluginLLMClient interface {
	CallLLM(ctx context.Context, req *AuxLLMRequest) (any, error)
	AsyncCallLLM(ctx context.Context, req *AuxLLMRequest) (any, error)
	ReadMainProvider() string
	ReadMainModel() string
}

Auxiliary client the wiring installs, RouteInfo filled by the callee with the provider and model that ran

type PluginLiveNotes

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

Go live notices an open chat holds, one per plugin key in queue order, plus those riding this tool batch

type PluginLlm

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

Host owned LLM access of one trusted plugin, identity bound at construction for the trust gate

func (*PluginLlm) AComplete

func (l *PluginLlm) AComplete(ctx context.Context, messages []any, o PluginLlmOptions) (*PluginLlmCompleteResult, error)

Async sibling of the plain completion

func (*PluginLlm) ACompleteStructured

Async sibling of the structured completion

func (*PluginLlm) Complete

func (l *PluginLlm) Complete(ctx context.Context, messages []any, o PluginLlmOptions) (*PluginLlmCompleteResult, error)

Host chat completion against the active model, overrides gated per plugin

func (*PluginLlm) CompleteStructured

Bounded structured completion with text and image input, JSON parsed and validated when requested

func (*PluginLlm) HostAttr

func (l *PluginLlm) HostAttr(_ context.Context, name string) (any, bool, bool, error)

The four completion methods for a hosted plugin, the a variants as coroutine methods

func (*PluginLlm) HostCall

func (l *PluginLlm) HostCall(ctx context.Context, method string, args []any, kwargs map[string]any) (any, error)

Runs a completion method for a hosted plugin with the Python keyword binding

type PluginLlmCompleteResult

type PluginLlmCompleteResult struct {
	Text     string         `json:"text"`
	Provider string         `json:"provider"`
	Model    string         `json:"model"`
	AgentID  string         `json:"agent_id"`
	Usage    PluginLlmUsage `json:"usage"`
	Audit    map[string]any `json:"audit"`
}

Result of a plain completion

type PluginLlmImageInput

type PluginLlmImageInput struct {
	Data     []byte `json:"data"`
	URL      string `json:"url"`
	MimeType string `json:"mime_type"`
	FileName string `json:"file_name"`
	Type     string `json:"type"`
}

Image block given as raw bytes or an http or data URL

type PluginLlmOptions

type PluginLlmOptions struct {
	Provider, Model, AgentID, Profile, Purpose, Task *string
	Temperature                                      *float64
	MaxTokens                                        *int
	Timeout                                          *float64
}

Keyword options of the completion methods, nil pointers and empty strings meaning None

type PluginLlmStructuredRequest

type PluginLlmStructuredRequest struct {
	Instructions string
	Input        []any
	JSONSchema   any
	JSONMode     bool
	SchemaName   string
	SystemPrompt string
}

Arguments of a structured completion

type PluginLlmStructuredResult

type PluginLlmStructuredResult struct {
	Text        string         `json:"text"`
	Provider    string         `json:"provider"`
	Model       string         `json:"model"`
	AgentID     string         `json:"agent_id"`
	Usage       PluginLlmUsage `json:"usage"`
	Parsed      any            `json:"parsed"`
	ContentType string         `json:"content_type"`
	Audit       map[string]any `json:"audit"`
}

Result of a structured completion, parsed only when JSON was requested and returned

type PluginLlmTextInput

type PluginLlmTextInput struct {
	Text string `json:"text"`
	Type string `json:"type"`
}

Text block of a structured input list

type PluginLlmTrustError

type PluginLlmTrustError struct{ Message string }

Refusal of an LLM override the plugin is not trusted for, a PermissionError in Python

func (*PluginLlmTrustError) Error

func (e *PluginLlmTrustError) Error() string

type PluginLlmUsage

type PluginLlmUsage struct {
	InputTokens      int      `json:"input_tokens"`
	OutputTokens     int      `json:"output_tokens"`
	TotalTokens      int      `json:"total_tokens"`
	CacheReadTokens  int      `json:"cache_read_tokens"`
	CacheWriteTokens int      `json:"cache_write_tokens"`
	CostUSD          *float64 `json:"cost_usd"`
}

Token and cost usage of one completion, cost the host estimate when known

type PluginLoadTimeout

type PluginLoadTimeout struct{ Msg string }

Raised on the loading goroutine when a plugin import and register overran its deadline

func (*PluginLoadTimeout) Error

func (e *PluginLoadTimeout) Error() string

type PluginMessage

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

Handle of one posted message whose edits replace it in place and stay ordered behind a slow operation

func (*PluginMessage) AEdit

func (h *PluginMessage) AEdit(ctx context.Context, text string) (map[string]any, error)

Edit for code already running on the gateway loop, waiting for a pending operation first

func (*PluginMessage) Edit

func (h *PluginMessage) Edit(ctx context.Context, text string) map[string]any

Replaces the message text in place or posts anew where the surface cannot edit, never raising

func (*PluginMessage) ErrorCode

func (h *PluginMessage) ErrorCode() any

Error code of the last operation, nil after a success

func (*PluginMessage) ErrorKind

func (h *PluginMessage) ErrorKind() string

Python type name a hosted plugin sees for the handle

func (*PluginMessage) HostAttr

func (h *PluginMessage) HostAttr(_ context.Context, name string) (any, bool, bool, error)

Attribute of the handle a hosted plugin reads, edit and the async aedit as methods

func (*PluginMessage) HostCall

func (h *PluginMessage) HostCall(ctx context.Context, method string, args []any, kwargs map[string]any) (any, error)

Runs edit or aedit for a hosted plugin with the text argument bound as Python binds it

func (*PluginMessage) MessageID

func (h *PluginMessage) MessageID() any

Message id the handle follows, nil before any message landed

func (*PluginMessage) OK

func (h *PluginMessage) OK() bool

Whether the last operation succeeded

func (*PluginMessage) Pending

func (h *PluginMessage) Pending() bool

Whether an operation the gateway has not finished is still attached

func (*PluginMessage) Quoted

func (h *PluginMessage) Quoted() string

Repr a hosted plugin sees for the handle

func (*PluginMessage) Result

func (h *PluginMessage) Result() map[string]any

Result of the last operation on the handle

func (*PluginMessage) String

func (h *PluginMessage) String() string

Summary of the handle for logs: whether the last operation succeeded, then the message id and error code it has, an absent one left out

type PluginOperationError

type PluginOperationError struct {
	Msg          string
	FailureClass string
}

Error raised by plugin management operations with a user facing message and its failure class

func (*PluginOperationError) Class

func (e *PluginOperationError) Class() string

Failure class of an operation error, other when the raise site named none

func (*PluginOperationError) Error

func (e *PluginOperationError) Error() string

type PluginPack

type PluginPack struct {
	Name, Description, Author, Version string
	Plugins                            []PackPluginEntry
	Config                             []PackSeed
	Skills                             []string
}

A parsed and validated pack manifest

func LoadPack

func LoadPack(ctx context.Context, pathOrURL string) (*PluginPack, error)

Loads a pack from a local file path or an https URL

func ParsePack

func ParsePack(text, source string) (*PluginPack, error)

Parses and validates a pack YAML document

type PluginPanicError

type PluginPanicError struct {
	Value any
	Stack []byte
}

A plugin panic recovered during import or register, the Go form of SystemExit

func (*PluginPanicError) Error

func (e *PluginPanicError) Error() string

type PluginPathNotFoundError

type PluginPathNotFoundError struct{ Msg string }

Explicit path or plugin id that names no plugin

func (*PluginPathNotFoundError) Error

func (e *PluginPathNotFoundError) Error() string

type PluginPermissionError

type PluginPermissionError struct{ Msg string }

Refusal raised when a managed install or administrator owned key blocks a plugin settings write

func (*PluginPermissionError) Error

func (e *PluginPermissionError) Error() string

type PluginScanBlocked

type PluginScanBlocked struct {
	*PluginOperationError
	ScanResult *skills.ScanResult
}

Security scan refusal carrying the scan result it was decided on

func (*PluginScanBlocked) Unwrap

func (e *PluginScanBlocked) Unwrap() error

type PluginSettingValue

type PluginSettingValue struct {
	Key   string
	Value any
}

One key and value of an ordered settings edit

type PluginSettingsValueError

type PluginSettingsValueError struct{ Msg string }

PluginSettingsValueError is a settings edit the schema refuses, the ValueError a form shows back

func (*PluginSettingsValueError) Error

func (e *PluginSettingsValueError) Error() string

func (*PluginSettingsValueError) ErrorKind

func (e *PluginSettingsValueError) ErrorKind() string

type PluginSkill

type PluginSkill struct {
	Path        string
	Plugin      string
	PluginKey   string
	PluginName  string
	Portable    bool
	BareName    string
	Description string
	Frontmatter map[string]any
}

Read only plugin skill resolvable as plugin:name while the plugin is enabled

type PluginSourceMoved

type PluginSourceMoved struct{ *PluginOperationError }

Source no longer at the commit the install dialog reviewed

func (*PluginSourceMoved) Unwrap

func (e *PluginSourceMoved) Unwrap() error

type PluginState

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

Atomic quota bounded JSON key value state owned by one plugin

func NewPluginState

func NewPluginState(h, pluginID, dataNamespace string) *PluginState

State facade of one plugin under a home, keyed by its data namespace

func (*PluginState) DataDir

func (s *PluginState) DataDir() string

Profile scoped directory matching the PLUGIN_DATA of portable plugins

func (*PluginState) Get

func (s *PluginState) Get(key string, def any) (any, error)

Stored JSON value of a key, def when absent

func (*PluginState) HostAttr

func (s *PluginState) HostAttr(_ context.Context, name string) (any, bool, bool, error)

Python attribute of the plugin state store a hosted plugin reads, get and set answering as methods

func (*PluginState) HostCall

func (s *PluginState) HostCall(_ context.Context, method string, args []any, kwargs map[string]any) (any, error)

Runs get(key, default=None) or set(key, value) of the plugin state store for a hosted plugin

func (*PluginState) Path

func (s *PluginState) Path() string

The state.json file inside the data directory

func (*PluginState) QuotaBytes

func (s *PluginState) QuotaBytes() int

Largest encoded state document a plugin may store

func (*PluginState) Set

func (s *PluginState) Set(key string, value any) error

Sets one JSON value atomically under the lock, refusing values that break the quota

type PluginTask

type PluginTask struct {
	Name string
	// contains filtered or unexported fields
}

Supervised background task of a plugin cancelled by unload or force reload

func (*PluginTask) Cancel

func (t *PluginTask) Cancel()

Requests cancellation of the task context

func (*PluginTask) Done

func (t *PluginTask) Done() <-chan struct{}

Closed once the task function returned

func (*PluginTask) Err

func (t *PluginTask) Err() error

Error the task function returned, valid after Done closed

type PluginToolOverrideError

type PluginToolOverrideError struct{ Msg string }

Raised when a plugin overrides a built-in tool without the operator opt in

func (*PluginToolOverrideError) Error

func (e *PluginToolOverrideError) Error() string

func (*PluginToolOverrideError) Is

func (e *PluginToolOverrideError) Is(target error) bool

Matches PluginPermissionError the way the Python class subclasses PermissionError

type PluginToolset

type PluginToolset struct {
	Key, Label, Description string
}

One plugin toolset row of the tools picker

func GetPluginToolsets

func GetPluginToolsets(ctx context.Context) []PluginToolset

Plugin toolsets as key, label and description rows for the tools picker

type PortableAvailability

type PortableAvailability struct {
	State   string
	Version string
	Path    string
}

Install time availability verdict of a portable server declaration on this host

type PreToolCallDirective

type PreToolCallDirective struct {
	Action, Message, RuleKey string
	ModifiedArgs             map[string]any
}

Resolved pre_tool_call outcome

func PreToolCallDirectiveDetails

func PreToolCallDirectiveDetails(ctx context.Context, toolName string, args map[string]any, ids PreToolCallIDs) (PreToolCallDirective, error)

PreToolCallDirectiveDetails exports preToolCallDirectiveDetails for the tool dispatcher bridge

type PreToolCallIDs

type PreToolCallIDs struct {
	TaskID, SessionID, ToolCallID, TurnID, APIRequestID string
	MiddlewareTrace                                     []map[string]any
}

Observability ids forwarded to pre_tool_call hooks

type PreVerifyInput

type PreVerifyInput struct {
	SessionID, Platform, Model, FinalResponse string
	Coding                                    bool
	Attempt                                   int
	ChangedPaths                              []string
}

Scope signals forwarded to pre_verify hooks

type Presence

type Presence struct {
	State    string `json:"state"`
	Sentence string `json:"sentence"`
}

Catalog card app state with the reason sentence, empty when present or unknown

func CatalogPresence

func CatalogPresence(ctx context.Context, entry *PluginCatalogEntry) (Presence, error)

App state of one catalog entry on this host, the worst server winning in manifest order

type Provenance

type Provenance struct {
	Name           string
	Class          ProvenanceClass
	Path           string
	Row            map[string]any
	OriginURL      string
	SavedUpdateURL string
}

Provenance of one installed plugin dir with its sidecar row, origin and saved feed tag

func PluginsProvenance

func PluginsProvenance(ctx context.Context, pluginsDir string) []Provenance

Classifies every visible plugin dir by sidecar row and git checkout presence

type ProvenanceClass

type ProvenanceClass string

Install provenance class of a plugin directory

const (
	ProvenanceGit        ProvenanceClass = "git"
	ProvenanceManual     ProvenanceClass = "manual"
	ProvenanceSelfCloned ProvenanceClass = "self-cloned"
	ProvenanceDrift      ProvenanceClass = "drift"
)

type ProviderRequestAnswer

type ProviderRequestAnswer struct {
	Status  int
	Headers map[string]string
	Body    []byte
}

Answer of a credentialed provider request the wiring sends for a plugin

type Record

type Record map[string]any

Dataclass that crossed the boundary with item and attribute access

type Registration

type Registration struct {
	Kind       string
	Key        string
	Release    func() error
	PluginKey  string
	HoldStream bool
	// contains filtered or unexported fields
}

One host owned registration with the inverse that unwinds it

func (*Registration) Active

func (r *Registration) Active() bool

Reports whether the handle still owns an active registration

func (*Registration) Dispose

func (r *Registration) Dispose() error

Releases the registration once, repeated disposal being harmless

type RemovedEntry

type RemovedEntry struct {
	Name   string
	Repo   string
	Reason string
	Date   string
}

One catalog kill list entry naming a pulled plugin and why

func FindRemoved

func FindRemoved(ctx context.Context, nameOrRepo, dir string) *RemovedEntry

Kill list entry matching a catalog name or repo, the in-tree list united with the live one when dir is empty

func InstalledPluginRemoval

func InstalledPluginRemoval(h, name, pluginDir string) *RemovedEntry

Kill list verdict for an installed plugin by name, recorded source, catalog block or directory

func LiveRemovedList

func LiveRemovedList(ctx context.Context) []RemovedEntry

Kill list of the live or cached catalog, empty when it is unavailable

func MatchRemoved

func MatchRemoved(candidate string, entries []RemovedEntry) *RemovedEntry

One candidate against a resolved kill list by exact name or normalized repo

func ResolvedRemovedEntries

func ResolvedRemovedEntries(ctx context.Context) []RemovedEntry

Full kill list in one resolution, the in-tree list united with the live one

type RenderedSystemPromptSection

type RenderedSystemPromptSection struct {
	ID       string
	Content  string
	Position string
	Plugin   string
}

Validated prompt text frozen on the owning agent

func RenderSystemPromptSections

func RenderSystemPromptSections(ctx context.Context, sessionInfo map[string]any) []RenderedSystemPromptSection

Renders the active profile's plugin prompt sections after ensuring discovery

type RepinConsentRequired

type RepinConsentRequired struct {
	Name, Sha string
	Delta     map[string][]string
}

New pin widens the plugin surface without consent, nothing changed on disk

func (*RepinConsentRequired) Error

func (e *RepinConsentRequired) Error() string

type RepinResult

type RepinResult struct {
	Sha           string
	Changed       bool
	InstalledName string
	Warnings      []string
}

Outcome of a catalog re-pin

type ReplacementCoordinator

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

Links and removes registration generations in any unload order

func (*ReplacementCoordinator) Acquire

func (c *ReplacementCoordinator) Acquire(slot, current, previous any, restore func(any) error, finalize func() error) *ReplacementLease

Attaches a new live generation to the active predecessor whose value equals previous

func (*ReplacementCoordinator) Transaction

func (c *ReplacementCoordinator) Transaction(fn func())

Runs fn while serialized against every acquire and dispose, re-entrant on the owning goroutine

type ReplacementLease

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

One ownership generation in a replaceable registry slot

func (*ReplacementLease) Dispose

func (l *ReplacementLease) Dispose() error

Releases the lease, restoring the nearest live predecessor when it is the latest generation

type RequestMiddlewareResult

type RequestMiddlewareResult struct {
	Payload         any
	OriginalPayload any
	Changed         bool
	Trace           []map[string]any
}

Result of running request middleware over a payload

func ApplyLLMRequestMiddleware

func ApplyLLMRequestMiddleware(ctx context.Context, request map[string]any, extra map[string]any) RequestMiddlewareResult

Runs LLM request middleware of the active profile after lazy discovery, so a cold surface still rewrites requests

func ApplyToolRequestMiddleware

func ApplyToolRequestMiddleware(ctx context.Context, toolName string, args, originalArgs map[string]any, extra map[string]any) (RequestMiddlewareResult, error)

Runs tool request middleware of the active profile after lazy discovery, so a cold surface still rewrites tool arguments

type ResolvedPackPlugin

type ResolvedPackPlugin struct {
	Entry             PackPluginEntry
	Identifier        string
	IndexCapabilities []string
	ResolveError      string
}

A pack entry resolved to an installable identifier, empty when catalog resolution failed

func ResolvePackPlugins

func ResolvePackPlugins(ctx context.Context, pack *PluginPack) []ResolvedPackPlugin

Resolves every entry, bare names through the curated catalog, failures carried per entry

type RunChecksOptions

type RunChecksOptions struct {
	Fetch, LsRemote func(context.Context, string) (string, error)
}

Options of one update check run, nil functions taking the real network and git probes

type ScheduledCheckOptions

type ScheduledCheckOptions struct {
	RunChecks   func(ctx context.Context, pluginsDir string) ([]*CheckResult, error)
	PluginsDir  string
	ApplyUpdate func(ctx context.Context, name string) error
	Log         *slog.Logger
	Now         *float64
}

Seams of one scheduled update check, nil fields left to the caller defaults

type ScopedRegistry

type ScopedRegistry interface {
	Accepts(provider any) bool
	ProviderName(provider any) string
	Identity(provider any) error
	Snapshot(name, scope string) any
	Register(provider any, scope string) (bool, error)
	Restore(name string, current, replacement any, scope string) bool
}

Scope keyed process wide provider registry of one category, owned by a higher package

type SecretSourceInfo

type SecretSourceInfo struct {
	Name      string
	IsEnabled func(section map[string]any) (bool, error)
}

Plugin registered secret source as the dotenv orchestrator sees it

type SecretSources

type SecretSources interface {
	ListPluginSources() []SecretSourceInfo
	ResetCache(h string) error
	LoadDotenv(ctx context.Context, h string) error
	RefreshInstalledScope(ctx context.Context, h string) error
}

Secret source orchestrator the manager re-pulls after discovery

type SectionOption

type SectionOption func(*SystemPromptSection)

Optional setting of a system prompt section registration

func WithSectionMaxChars

func WithSectionMaxChars(maxChars int) SectionOption

Caps the rendered section length in characters

func WithSectionPosition

func WithSectionPosition(position string) SectionOption

Places the section at a prompt position

type ServerLiveness

type ServerLiveness struct {
	Kind       string
	Path       string
	URLField   string
	TokenField string
	PIDField   string
}

ServerLiveness is a parsed server liveness declaration, field for field the mcp Liveness

type ServiceMissingError

type ServiceMissingError struct{ Name string }

Error naming a collaborator the wiring never installed

func (*ServiceMissingError) Error

func (e *ServiceMissingError) Error() string

type Services

type Services struct {
	InvokeLifecycleHook               func(ctx context.Context, hookName string, kwargs map[string]any) []any
	FailoverReason                    func(value any) (any, bool)
	MemoryProviderDir                 func(h, name string) (string, bool)
	HostObject                        func(kind string, obj any) (name string, ok bool)
	BindProfileSecretScope            func(ctx context.Context, home string) context.Context
	GetSecret                         func(ctx context.Context, name string) (string, bool, error)
	PluginLLM                         PluginLLMClient
	SubagentLifecycle                 SubagentDelegation
	DelegationBackends                func(c *Context) any
	CurrentCronExecution              func(ctx context.Context) any
	CallMCPTool                       func(ctx context.Context, server, tool string, timeout float64, args map[string]any) (string, error)
	RedeemSideQuestion                func(ctx context.Context, token, prompt any, pluginID, h string, timeout any) (*string, error)
	BoundSessionKey                   func(ctx context.Context) string
	ResolveBuiltinCommand             func(name string) bool
	DispatchTool                      func(ctx context.Context, scope, toolName string, args, kwargs map[string]any) (string, error)
	Platforms                         PlatformRegistry
	ProviderRegistries                map[string]ScopedRegistry
	BuiltinAuxTaskKeys                func() []string
	RegisterRedactionPatterns         func(patterns any, source string) (int, error)
	BuildPluginBlueprint              func(pluginName string, key any, spec BlueprintSpec) (string, any, error)
	SecretSources                     SecretSources
	PlatformDeclarations              PlatformDeclarations
	OAuthSurface                      func(manifest map[string]any) map[string]bool
	OAuthAdmissionProblems            func(manifest map[string]any, pluginDir string) []string
	OAuthAdmissionWarnings            func(manifest map[string]any, pluginDir string) []string
	PortableServerAvailability        func(ctx context.Context, decl AgentPluginServerDeclaration) (PortableAvailability, error)
	MaskedSecretPrompt                func(prompt string) (string, error)
	ServerAvailabilityReason          func(ctx context.Context, declaration AgentPluginServerDeclaration, appTitle string) (reason string, offerable bool, err error)
	PrepareMemoryProviderDependencies func(ctx context.Context, name string) error
	RequiresAuthNotice                func(manifest map[string]any) string
	DeclaresModelProviderKind         func(pluginDir string) bool
	PluginOAuthKey                    func(pluginDir string) string
	ForgetPluginGrants                func(plugin string) error
	ReloadGatewayPlugins              func(ctx context.Context, target, profileHome string) (map[string]any, error)
	GatewayRunningPid                 func(pidPath string, cleanupStale bool) (int, bool, error)
	InstalledGatewayServiceKind       func(ctx context.Context) (string, bool, error)
	RefreshPluginSessions             func(ctx context.Context, home, pluginKey, note string) error
	MCP                               MCPConnector
	BroadcastGlobalEvent              func(name string, payload map[string]any)
	ActiveMemoryProvider              func(ctx context.Context, h string) string
	PruneInactiveMemoryProviderSkills func(ctx context.Context, h, active string)
	LoadMemoryProvider                func(ctx context.Context, h, name string)
	GatewayLoop                       func(ctx context.Context) (runner any, onLoop bool)
	BoundRoute                        func(ctx context.Context) any
	ResolvePluginMessageTarget        func(ctx context.Context, runner any, sessionKey string, route any, pluginHome, pluginID string) (target any, refusal map[string]any, err error)
	PostPluginMessage                 func(ctx context.Context, target any, text, pluginID string) map[string]any
	EditPluginMessage                 func(ctx context.Context, target, messageID any, text, pluginID string) map[string]any
	ActiveSessionPolicy               func(ctx context.Context) (platform, cwd string, ok bool)
	GatewayRunnerRef                  func() PlatformActionRunner
	ParseServerLiveness               func(raw any) (ServerLiveness, error)
	ParseCostPolicy                   func(costs, spendLimit, costUnit any, where string) error
	DiscoverMemoryProviders           func(ctx context.Context) [][2]string
	CredentialedProviderRequest       func(ctx context.Context, pluginDir, provider, method, url string, json any, headers map[string]string, timeout time.Duration) (*ProviderRequestAnswer, error)
}

Higher package collaborators the top level wiring installs so pkg/plugins never imports them

func InstalledServices

func InstalledServices() *Services

InstalledServices exports the installed collaborator set so other packages' tests can restore it

type SetOf

type SetOf []any

SetOf is a set or frozenset rebuilt from a wire list, first occurrences kept in order

type ShellHookResult

type ShellHookResult struct {
	ReturnCode     *int
	Stdout, Stderr string
	TimedOut       bool
	ElapsedSeconds float64
	Error          string
	Parsed         map[string]any
}

Outcome of one hook subprocess, Error empty and ReturnCode nil when not applicable

func RunShellHookOnce

func RunShellHookOnce(ctx context.Context, spec *ShellHookSpec, kwargs map[string]any) (*ShellHookResult, error)

Fires one hook with a synthetic payload through the production path, the parsed directive attached

func TestShellHook

func TestShellHook(ctx context.Context, event, command, forTool string) (*ShellHookResult, error)

TestShellHook runs a configured hook once on a sample event, naming the tool when one is given

type ShellHookSpec

type ShellHookSpec struct {
	Event, Command string
	Timeout        int
	FailClosed     bool
	// contains filtered or unexported fields
}

One parsed hooks entry, the matcher empty when absent

func IterConfiguredShellHooks

func IterConfiguredShellHooks(ctx context.Context) []*ShellHookSpec

Parsed hooks of the hooks setting of ctx without wiring any, for the hooks list command and doctor

func NewShellHookSpec

func NewShellHookSpec(event, command, matcher string, timeout int, failClosed bool) *ShellHookSpec

Spec with its matcher stripped and compiled, an invalid regex kept for literal equality

func RecordShellHookConsentFromConfig

func RecordShellHookConsentFromConfig(ctx context.Context, acceptHooks bool) ([]*ShellHookSpec, error)

First use consent for every configured hook without wiring any, returning the consented specs

func RegisterShellHooksFromConfig

func RegisterShellHooksFromConfig(ctx context.Context, acceptHooks, interactive bool) ([]*ShellHookSpec, error)

Registers every consented configured hook once per home and returns the newly wired specs

func (*ShellHookSpec) MatchesTool

func (m *ShellHookSpec) MatchesTool(toolName any) (bool, error)

Whether the tool name passes the matcher, a TypeError for a non string name against a regex

type SkippedUpdate

type SkippedUpdate struct {
	Row    *CheckResult
	Reason string
}

One check row an update with no name cannot move and why

type SlackActionHandler

type SlackActionHandler struct {
	ActionID any
	Callback any
	Plugin   string
}

Slack Block Kit action handler a plugin registered

type SubagentCancelResult

type SubagentCancelResult struct {
	Accepted        bool          `json:"accepted"`
	AlreadyTerminal bool          `json:"already_terminal"`
	UnknownHandle   bool          `json:"unknown_handle"`
	Unsupported     bool          `json:"unsupported"`
	State           SubagentState `json:"state"`
}

Outcome of a cancellation request

type SubagentChild

type SubagentChild interface {
	SubagentID() string
	Provider() *string
	Model() *string
	DelegateRole() (string, bool)
	DelegateDepth() int
}

Child agent the delegate tool built, as the lifecycle reads it

type SubagentChildSpec

type SubagentChildSpec struct {
	Goal        string
	Context     *string
	Toolsets    []string
	Model       any
	Parent      any
	Role        string
	Credentials map[string]any
	RoutingCfg  map[string]any
}

Arguments of tools.delegate_tool _build_child_preserving_parent_tools for one lifecycle launch

type SubagentDelegation

type SubagentDelegation interface {
	SessionID(parent any) string
	EnabledToolsets(parent any) ([]string, bool)
	ValidateToolset(ctx context.Context, name string) bool
	LoadConfig(ctx context.Context) map[string]any
	ResolveCredentials(ctx context.Context, routingCfg map[string]any, parent any) (map[string]any, error)
	BuildChild(ctx context.Context, spec SubagentChildSpec) (SubagentChild, error)
	RunChild(ctx context.Context, goal string, child SubagentChild, parent any) (any, error)
	HardInterrupt(child SubagentChild, reason, toolReason string) (bool, error)
	Steer(subagentID, text string) bool
}

Delegate tool, toolset and parent agent collaborators the wiring installs for the lifecycle service

type SubagentHandle

type SubagentHandle struct {
	ContractVersion int     `json:"contract_version"`
	SubagentID      string  `json:"subagent_id"`
	ParentSessionID *string `json:"parent_session_id"`
	CorrelationID   *string `json:"correlation_id"`
	CreatedAt       float64 `json:"created_at"`
	Provider        *string `json:"provider"`
	Model           *string `json:"model"`
	Role            string  `json:"role"`
	Depth           int     `json:"depth"`
	Capability      string  `json:"capability"`
	// contains filtered or unexported fields
}

Serializable handle of a launched subagent carrying its capability

func SubagentHandleFromDict

func SubagentHandleFromDict(value map[string]any) (*SubagentHandle, error)

Handle rebuilt from its dict, malformed when a field is missing or unknown

func (*SubagentHandle) ToDict

func (h *SubagentHandle) ToDict() map[string]any

Field dict of the handle in declaration order

type SubagentLaunchRequest

type SubagentLaunchRequest struct {
	Goal             string         `json:"goal"`
	Context          *string        `json:"context"`
	Role             string         `json:"role"`
	Model            *string        `json:"model"`
	Provider         *string        `json:"provider"`
	AllowedToolsets  []string       `json:"allowed_toolsets"`
	BlockedTools     []string       `json:"blocked_tools"`
	WorkingDirectory *string        `json:"working_directory"`
	ParentSessionID  *string        `json:"parent_session_id"`
	CorrelationID    *string        `json:"correlation_id"`
	Metadata         map[string]any `json:"metadata"`
	TimeoutSeconds   *float64       `json:"timeout_seconds"`
	// contains filtered or unexported fields
}

Launch request of one delegated subagent, nil pointers and slices meaning None

type SubagentLifecycleError

type SubagentLifecycleError struct{ Message string }

Request the public lifecycle API cannot safely accept, a ValueError in Python

func (*SubagentLifecycleError) Error

func (e *SubagentLifecycleError) Error() string

type SubagentLifecycleService

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

Plugin safe lifecycle service over the host delegate tool, children in process with terminal retention

func NewSubagentLifecycleService

func NewSubagentLifecycleService(resolver func(ctx context.Context) any) *SubagentLifecycleService

Service resolving the parent bound to the calling context

func (*SubagentLifecycleService) Cancel

func (s *SubagentLifecycleService) Cancel(ctx context.Context, handle any, reason string) *SubagentCancelResult

Requests a hard interrupt of a running child, accepted only when the child took it

func (*SubagentLifecycleService) HostAttr

func (s *SubagentLifecycleService) HostAttr(_ context.Context, name string) (any, bool, bool, error)

The seven lifecycle methods for a hosted plugin, each a plain method

func (*SubagentLifecycleService) HostCall

func (s *SubagentLifecycleService) HostCall(ctx context.Context, method string, args []any, kwargs map[string]any) (any, error)

Runs a lifecycle method for a hosted plugin with the Python argument binding

func (*SubagentLifecycleService) Launch

func (s *SubagentLifecycleService) Launch(ctx context.Context, request any) (*SubagentHandle, error)

Validates, builds the child through the delegate tool and starts it on the lifecycle executor

func (*SubagentLifecycleService) Reconnect

Whether a handle still names a record of this process, never relaunching work

func (*SubagentLifecycleService) Result

func (s *SubagentLifecycleService) Result(ctx context.Context, handle any) *SubagentResult

Terminal result, NOT_READY while running and UNKNOWN_HANDLE for foreign handles

func (*SubagentLifecycleService) Status

func (s *SubagentLifecycleService) Status(ctx context.Context, handle any) *SubagentStatus

Current state of a handle, UNKNOWN_HANDLE for anything not owned by the active parent

func (*SubagentLifecycleService) Steer

func (s *SubagentLifecycleService) Steer(ctx context.Context, handle any, text any) bool

Queues text for the child next iteration boundary while it accepts steering

func (*SubagentLifecycleService) Wait

func (s *SubagentLifecycleService) Wait(ctx context.Context, handle any, timeoutSeconds *float64) *SubagentTerminalState

Waits for the child to finish, timed out when the timeout elapses first, nil timeout waiting forever

type SubagentParentRef

type SubagentParentRef func() any

Resolver of a weakly held parent agent, nil once the agent is collected

type SubagentReconnectResult

type SubagentReconnectResult struct {
	Connected  bool          `json:"connected"`
	State      SubagentState `json:"state"`
	Diagnostic *string       `json:"diagnostic"`
}

Outcome of reconnecting a serialized handle

type SubagentResult

type SubagentResult struct {
	Handle               any            `json:"handle"`
	TerminalState        SubagentState  `json:"terminal_state"`
	Ready                bool           `json:"ready"`
	Summary              *string        `json:"summary"`
	StructuredPayload    map[string]any `json:"structured_payload"`
	StartedAt            *float64       `json:"started_at"`
	CompletedAt          *float64       `json:"completed_at"`
	ErrorClassification  *string        `json:"error_classification"`
	ErrorMessage         *string        `json:"error_message"`
	UsageMetadata        map[string]any `json:"usage_metadata"`
	ToolExecutionSummary map[string]any `json:"tool_execution_summary"`
	ResultHash           *string        `json:"result_hash"`
}

Terminal result snapshot of a subagent, ready once it finished

type SubagentState

type SubagentState string

Lifecycle state of a delegated subagent, a str enum in Python

const (
	SubagentPending         SubagentState = "PENDING"
	SubagentStarting        SubagentState = "STARTING"
	SubagentRunning         SubagentState = "RUNNING"
	SubagentSucceeded       SubagentState = "SUCCEEDED"
	SubagentFailed          SubagentState = "FAILED"
	SubagentInterrupted     SubagentState = "INTERRUPTED"
	SubagentCancelRequested SubagentState = "CANCEL_REQUESTED"
	SubagentCancelled       SubagentState = "CANCELLED"
	SubagentUnknown         SubagentState = "UNKNOWN"
)

func (SubagentState) PythonEnumValue

func (s SubagentState) PythonEnumValue() any

type SubagentStatus

type SubagentStatus struct {
	Handle     any           `json:"handle"`
	State      SubagentState `json:"state"`
	UpdatedAt  float64       `json:"updated_at"`
	Diagnostic *string       `json:"diagnostic"`
}

Status snapshot, Handle the handle given when it is unknown

type SubagentTerminalState

type SubagentTerminalState struct {
	Handle     any           `json:"handle"`
	State      SubagentState `json:"state"`
	Completed  bool          `json:"completed"`
	TimedOut   bool          `json:"timed_out"`
	Diagnostic *string       `json:"diagnostic"`
}

Outcome of waiting on a subagent

type SystemPromptSection

type SystemPromptSection struct {
	ID          string
	Content     string
	ContentFunc func(sessionInfo map[string]any) (any, error)
	Position    string
	MaxChars    int
	Plugin      string
}

Plugin owned system prompt section rendered once per new session, from text or a session callback

type ThreadRenameOptions

type ThreadRenameOptions struct {
	OnlyIfCurrentName      *string
	PreferConnectorCreated bool
	ParentChatID           *string
}

Keyword options of an adapter thread rename, the native guard or the relay connector guard

type ToolSpec

type ToolSpec struct {
	Name        string
	Toolset     string
	Schema      *jsonutil.Object
	Handler     tools.Handler
	Check       func(env *tools.Env) bool
	RequiresEnv []string
	Description string
	Emoji       string
	Override    bool
}

Arguments of one plugin tool registration

type ToolsRegistrar

type ToolsRegistrar interface {
	RegisterTools(ctx *Context) error
}

Compiled-in plugin that pre-registers client tools of a deferred platform without its adapter

type UnattendedInstallOptions

type UnattendedInstallOptions struct {
	Identifier   string
	Force        bool
	Enable       bool
	CatalogName  string
	Ref          string
	OnStep       func(InstallPhase)
	InspectedSha string
	// Consent the caller holds for the Python dependencies, nil taking a fresh enable without force as that consent
	AssumeDepsConsent *bool
}

Inputs of an unattended install, a nil AssumeDepsConsent takes the fresh enable as consent

type UpdatePlan

type UpdatePlan struct {
	Movable []*CheckResult
	Skipped []SkippedUpdate
	Current int
}

Rows an update with no name moves, rows it skips with the reason, and the count already current

func PlanUpdateAll

func PlanUpdateAll(results []*CheckResult) UpdatePlan

Splits check rows into movable plugins and skipped ones with the reason each cannot move

type UserInterrupt

type UserInterrupt struct{ Err error }

UserInterrupt is the panic value a user interrupt escapes plugin dispatch with, recovered at the turn boundary

func (*UserInterrupt) Error

func (u *UserInterrupt) Error() string

func (*UserInterrupt) Unwrap

func (u *UserInterrupt) Unwrap() error

type ValidationCheck

type ValidationCheck struct {
	Name   string
	OK     bool
	Detail string
}

One admission check outcome

type ValidationReport

type ValidationReport struct {
	Checks   []ValidationCheck
	Warnings []string
}

Result of validating one plugin directory

func (*ValidationReport) ExitCode

func (r *ValidationReport) ExitCode() int

Zero when every check passed, one otherwise

func (*ValidationReport) OK

func (r *ValidationReport) OK() bool

Reports whether every check passed

func (*ValidationReport) ToDict

func (r *ValidationReport) ToDict() *jsonutil.Object

JSON document of the report in the upstream key order

type WebhookView

type WebhookView struct {
	Label, URL, Matcher string
	Events              []string
	Timeout             int
	Signed              bool
}

WebhookView is one outbound webhook target

type Widget

type Widget struct {
	Plugin string
	Spec   WidgetSpec
}

One registered widget with the plugin that provides it

func Widgets

func Widgets(ctx context.Context) []Widget

Registered widgets of the profile the context names, sorted by id

type WidgetFrame

type WidgetFrame struct {
	Cols  int
	Rows  int
	State any
}

Size and state a widget renders for

type WidgetInput

type WidgetInput struct {
	Text  string
	Key   string
	Ctrl  bool
	Alt   bool
	Shift bool
}

One key press or text input the UI delivers to a widget

type WidgetLine

type WidgetLine struct {
	Spans []WidgetSpan
}

One rendered line

type WidgetSpan

type WidgetSpan struct {
	Text      string
	Role      string
	Bold      bool
	Dim       bool
	Italic    bool
	Underline bool
	Inverse   bool
}

Run of text in one theme role and style

type WidgetSpec

type WidgetSpec struct {
	ID    string
	Help  string
	Usage string
	Mode  string
	Zone  string
	Width int
	// Interval the UI refreshes the widget at, running Tick when set and rendering again, zero for input only
	Refresh time.Duration
	Open    func(ctx context.Context, arg string) (state any, ok bool, err error)
	Input   func(ctx context.Context, state any, in WidgetInput) (next any, open bool, err error)
	// Next state at each refresh, nil for a widget that only renders again
	Tick   func(ctx context.Context, state any) (next any, err error)
	Render func(ctx context.Context, frame WidgetFrame) (WidgetView, error)
}

Named view a plugin provides and the terminal UI renders, its state a JSON value the UI holds between calls

type WidgetView

type WidgetView struct {
	Lines []WidgetLine
}

Rendered lines of a widget

Source Files

Directories

Path Synopsis
Package defaults installs the catalog plugins marked default into every home once
Package defaults installs the catalog plugins marked default into every home once

Jump to

Keyboard shortcuts

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