Documentation
¶
Index ¶
- Constants
- func ApplyGlobalEmbedToOpenOptions(opts *imprint.OpenOptions)
- func BaseURL(port int) string
- func CallTool(route ToolRoute, args json.RawMessage) (json.RawMessage, error)
- func DefaultShelvesStateDir(projectRoot string) string
- func DetachProcess(cmd *exec.Cmd)
- func EmbedSidecarReady(port int) bool
- func FreeListenPort(listen string, wait time.Duration) error
- func GlobalEmbedConfigPath() (string, error)
- func GlobalEmbedPluginStateDir(id string) (string, error)
- func MergeGlobalEmbed(cfg *Config) error
- func PackageDir(workspace, pkg string) string
- func ParseListenPort(listen string) int
- func PluginPort(entry PluginEntry, def int) int
- func ResolveConfigPath(getwd func() (string, error)) (string, error)
- func ResolveConfigPathForVault(vaultDir string) (string, bool)
- func RunEmbedPrepare(ctx context.Context, cfg *Config) error
- func SaveGlobalEmbedEntry(entry PluginEntry) error
- func StopBackgroundHost(cfg *Config)
- type Config
- type EmbedConfig
- type GlossaryConfig
- type HostConfig
- type Manager
- func (m *Manager) Config() *Config
- func (m *Manager) DeskURL() (string, error)
- func (m *Manager) List() ([]Status, error)
- func (m *Manager) StartEnabledExcept(ctx context.Context, omit []string) ([]Status, error)
- func (m *Manager) StartPlugin(ctx context.Context, id string) error
- func (m *Manager) StopAll()
- func (m *Manager) StopAllExcept(omit []string)
- func (m *Manager) StopPlugin(id string) error
- type Manifest
- type ManifestEntry
- type ManifestTool
- type PluginEntry
- type ShelvesConfig
- type Status
- type SupersedeConfig
- type TelemetryConfig
- type ToolRoute
Constants ¶
const ( EmbedCrossScopeAdvisoryOnly = "advisory_only" EmbedCrossScopeStrict = "strict" )
EmbedCrossScopePolicy values. Empty / unknown = default.
Variables ¶
This section is empty.
Functions ¶
func ApplyGlobalEmbedToOpenOptions ¶ added in v1.3.9
func ApplyGlobalEmbedToOpenOptions(opts *imprint.OpenOptions)
ApplyGlobalEmbedToOpenOptions wires the embed HTTP client from ~/.imprint/embed.yaml.
func CallTool ¶
func CallTool(route ToolRoute, args json.RawMessage) (json.RawMessage, error)
CallTool forwards args to a plugin HTTP handler from manifest.
func DefaultShelvesStateDir ¶
DefaultShelvesStateDir is the shelves cache directory under the vault state tree.
func DetachProcess ¶ added in v1.0.7
DetachProcess starts the child in a new session so it outlives the CLI terminal.
func EmbedSidecarReady ¶ added in v1.3.6
EmbedSidecarReady reports whether the sidecar finished warm-up (embed dim loaded, and relate model loaded when configured). Missing "ready" falls back to HTTP 2xx only.
func FreeListenPort ¶ added in v1.0.8
FreeListenPort kills the process listening on host:port (e.g. 127.0.0.1:9470).
func GlobalEmbedConfigPath ¶ added in v1.3.9
GlobalEmbedConfigPath returns ~/.imprint/embed.yaml.
func GlobalEmbedPluginStateDir ¶ added in v1.3.9
GlobalEmbedPluginStateDir is ~/.imprint/state/plugins/<id> (not vault-scoped).
func MergeGlobalEmbed ¶ added in v1.3.9
MergeGlobalEmbed replaces in-memory plugins.embed with ~/.imprint/embed.yaml.
func PackageDir ¶
PackageDir resolves entry.Package relative to workspace.
func ParseListenPort ¶ added in v1.0.7
ParseListenPort extracts the TCP port from a host:port listen address.
func PluginPort ¶
func PluginPort(entry PluginEntry, def int) int
PluginPort returns the configured port for a plugin id.
func ResolveConfigPath ¶
ResolveConfigPath walks up from cwd for imprint.yaml (root or legacy .imprint/).
func ResolveConfigPathForVault ¶ added in v1.0.6
ResolveConfigPathForVault returns imprint.yaml for the project that owns vaultDir.
func RunEmbedPrepare ¶ added in v1.3.6
RunEmbedPrepare downloads and loads embed + relate models in the foreground. Hugging Face / tqdm progress goes to the caller's terminal via inherited stdout/stderr.
func SaveGlobalEmbedEntry ¶ added in v1.3.9
func SaveGlobalEmbedEntry(entry PluginEntry) error
SaveGlobalEmbedEntry writes ~/.imprint/embed.yaml.
func StopBackgroundHost ¶ added in v1.0.7
func StopBackgroundHost(cfg *Config)
StopBackgroundHost frees the host listen port for this project.
Types ¶
type Config ¶
type Config struct {
Vault string `yaml:"vault"`
Host HostConfig `yaml:"host"`
Shelves ShelvesConfig `yaml:"shelves"`
Glossary GlossaryConfig `yaml:"glossary"`
Telemetry TelemetryConfig `yaml:"telemetry"`
Supersede SupersedeConfig `yaml:"supersede"`
Plugins map[string]PluginEntry `yaml:"plugins"`
// contains filtered or unexported fields
}
Config is imprint.yaml at the project root (legacy: .imprint/imprint.yaml).
func LoadEmbedManagerConfig ¶ added in v1.3.9
LoadEmbedManagerConfig builds a minimal config for embed prepare/start without a project yaml.
func (*Config) ApplyGlossary ¶ added in v1.3.0
ApplyGlossary loads glossary.path when configured (relative to workspace).
func (*Config) ApplyToOpenOptions ¶ added in v1.3.0
func (c *Config) ApplyToOpenOptions(opts *imprint.OpenOptions)
ApplyToOpenOptions copies yaml vault tunables onto Open. Embed is wired from ~/.imprint/embed.yaml (not project imprint.yaml).
func (*Config) FileExists ¶ added in v1.0.7
FileExists reports whether imprint.yaml was loaded from an on-disk file.
func (*Config) ResolveVaultAbs ¶
ResolveVaultAbs returns the absolute vault directory for this config.
type EmbedConfig ¶ added in v1.3.3
type EmbedConfig struct {
Port int
Model string
TimeoutSeconds int
DuplicateThreshold float64
RelateContradictionMin float64
RelateEntailmentMin float64
DuplicateHighCosineBlock float64
RelateBidirectional bool
// CrossScopePolicy is advisory_only (default) or strict.
// advisory_only keeps the cross-project recall signal — a Chinese rule
// in one project can still surface as a paraphrase of an English rule
// in another — as advisory only. strict requires the existing rule to
// have every tag of the new claim (AND / subset, not overlap).
CrossScopePolicy string
}
EmbedConfig is the parsed plugins.embed.config section.
func EmbedConfigFrom ¶ added in v1.3.3
func EmbedConfigFrom(entry PluginEntry) EmbedConfig
EmbedConfigFrom reads typed values from a plugin entry with defaults.
type GlossaryConfig ¶ added in v1.3.0
type GlossaryConfig struct {
Path string `yaml:"path"`
}
GlossaryConfig points at an optional domain word list for gse tokenization.
type HostConfig ¶
type HostConfig struct {
Listen string `yaml:"listen"`
}
HostConfig is the vault HTTP server section in imprint.yaml.
type Manager ¶
type Manager struct {
// StartProgress, when set, receives sidecar.log output while embed starts (e.g. os.Stderr).
StartProgress io.Writer
// contains filtered or unexported fields
}
Manager starts and stops plugin processes.
func (*Manager) StartEnabledExcept ¶ added in v1.3.3
StartEnabledExcept stops running plugins and starts every enabled one whose id is not in omit. Omitted plugins are not stopped either — use this when a plugin is owned elsewhere (e.g. embed is owned by `imprint-mcp` / `imprint plugin start embed` and must not be reaped by `up`).
func (*Manager) StartPlugin ¶
StartPlugin starts one plugin by id.
func (*Manager) StopAll ¶
func (m *Manager) StopAll()
StopAll frees listen ports for every configured plugin. `up` / `down` must not call this when embed is in the config — they use StopAllExcept so the sidecar is left running.
func (*Manager) StopAllExcept ¶ added in v1.3.3
StopAllExcept is StopAll with a list of plugin ids excluded. Use this when one plugin is owned by a different process (e.g. embed is owned by `imprint-mcp` or `imprint plugin start embed`, and `imprint down` must not reap it just because it happens to occupy the configured port). The omit list applies to both the procs map and the cfg.Plugins port-sweep, so downstream callers can rely on the omitted plugin remaining untouched.
func (*Manager) StopPlugin ¶ added in v1.3.3
StopPlugin frees the listen port for one plugin id. Safe when this Manager did not start the process: stop is by port, not by the procs map.
type Manifest ¶
type Manifest struct {
APIVersion int `json:"apiVersion"`
ID string `json:"id"`
Name string `json:"name"`
Version string `json:"version"`
Capabilities []string `json:"capabilities"`
Entry ManifestEntry `json:"entry"`
ConfigSchema map[string]any `json:"configSchema,omitempty"`
Tools []ManifestTool `json:"tools"`
// contains filtered or unexported fields
}
Manifest is imprint.plugin.json in a plugin package root.
func LoadManifest ¶
LoadManifest reads imprint.plugin.json from packageDir.
type ManifestEntry ¶
ManifestEntry describes how to start and health-check a plugin.
type ManifestTool ¶
type ManifestTool struct {
Name string `json:"name"`
Description string `json:"description"`
InputSchema map[string]any `json:"inputSchema,omitempty"`
Handler string `json:"handler"`
RegisteredAs string `json:"-"`
}
ManifestTool is one MCP tool proxied through imprint-mcp.
func ResolveTools ¶
func ResolveTools(pluginID string, tools []ManifestTool, taken map[string]struct{}) []ManifestTool
ResolveTools assigns RegisteredAs names with optional pluginId prefix on collision.
type PluginEntry ¶
type PluginEntry struct {
Enabled bool `yaml:"enabled"`
Package string `yaml:"package"`
Config map[string]any `yaml:"config"`
}
PluginEntry is one external plugin in imprint.yaml (e.g. desk).
func LoadGlobalEmbedEntry ¶ added in v1.3.9
func LoadGlobalEmbedEntry() (PluginEntry, string, bool, error)
LoadGlobalEmbedEntry reads ~/.imprint/embed.yaml. Missing file → disabled entry.
type ShelvesConfig ¶ added in v1.1.0
type ShelvesConfig struct {
Enabled bool `yaml:"enabled"`
Config map[string]any `yaml:"config"`
Defined bool `yaml:"-"`
}
ShelvesConfig is workspace doc indexing (host + MCP).
func (*ShelvesConfig) UnmarshalYAML ¶ added in v1.1.0
func (s *ShelvesConfig) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML records whether shelves: was present in imprint.yaml.
type Status ¶
type Status struct {
ID string `json:"id"`
Enabled bool `json:"enabled"`
Package string `json:"package"`
Port int `json:"port"`
Running bool `json:"running"`
Healthy bool `json:"healthy"`
URL string `json:"url,omitempty"`
Error string `json:"error,omitempty"`
Name string `json:"name,omitempty"`
Version string `json:"version,omitempty"`
Manifest *Manifest `json:"-"`
}
Status is one plugin row for list/reload.
type SupersedeConfig ¶ added in v1.3.0
type SupersedeConfig struct {
InheritanceAlpha *float64 `yaml:"inheritance_alpha,omitempty"`
}
SupersedeConfig tunes how the successor rule's confidence is derived.
func (SupersedeConfig) Alpha ¶ added in v1.3.0
func (s SupersedeConfig) Alpha() float64
Alpha is supersede inheritance_alpha in [0, 1]; nil uses DefaultInheritanceAlpha.
type TelemetryConfig ¶ added in v1.3.0
type ToolRoute ¶
type ToolRoute struct {
PluginID string
Tool ManifestTool
BaseURL string
Registered string
}
ToolRoute is one MCP tool proxied to a plugin HTTP handler.
func EnabledTools ¶
EnabledTools returns proxied tools from enabled plugins with resolved names. skipped lists human-readable reasons for enabled plugins that were not loaded.