Documentation
¶
Overview ¶
Package tenant manages isolated tenant profiles under ~/.multiversa/tenants/<slug>/. One tenant = one manifest (the brand DNA) + one vault (0700, never read by any Multiversa surface) + one memory/graph home. Switching tenants swaps the whole context safely: nothing from one tenant's dir is ever read while another is active.
Index ¶
- Constants
- func Active() string
- func ConnectProvider(slug string, cfg ProviderConfig) error
- func Dir(slug string) (string, error)
- func Load(slug string) (*manifest.Manifest, string, error)
- func New(slug, name, kind string, pillars ...manifest.Pillar) (*manifest.Manifest, string, error)
- func ProviderNames() []string
- func ProviderSecretKey(name string) (string, error)
- func Root() (string, error)
- func SecretsPath(slug string) (string, error)
- func SetSecret(slug, key, value string) (int, error)
- func Template(kind string) *manifest.Manifest
- func Use(slug string) error
- type BootstrapOptions
- type BootstrapResult
- type BootstrapSource
- type Info
- type ProviderAttempt
- type ProviderConfig
- type ProviderPlan
- type ProviderSpec
Constants ¶
const ProvidersFileName = "providers.json"
const SecretsFileName = "secrets.env"
SecretsFileName is the env-style file inside a tenant's vault that holds its connection keys (ElevenLabs voice, its own backend, …). It lives inside the 0700 vault and is itself 0600. It is a real .env file so a local runtime can source it; it is never serialized into the manifest, synced, or shown to an agent — that is the vault invariant, enforced by the vault-leak test.
Variables ¶
This section is empty.
Functions ¶
func ConnectProvider ¶ added in v0.8.0
func ConnectProvider(slug string, cfg ProviderConfig) error
ConnectProvider stores only routing metadata. API keys always remain in vault/secrets.env.
func New ¶
New scaffolds a unique project OS from neutral technical defaults. It never overwrites: an existing tenant dir is an error, keeping profiles append-only.
Layout created:
~/.multiversa/tenants/<slug>/ multiversa.toml the tenant's DNA (template pre-filled) vault/ 0700 — secrets live here, never serialized graph/ knowledge graph home (anchored to identity) memory/ Engram home for this tenant
Pillars given here replace the template's defaults; passing none keeps them. It is variadic so every existing three-argument call still compiles — and so that the Tauri installer can delegate tenant creation here instead of writing its own multiversa.toml, which is how the two implementations drifted apart.
func ProviderNames ¶ added in v0.8.0
func ProviderNames() []string
func ProviderSecretKey ¶ added in v0.8.0
func SecretsPath ¶ added in v0.8.0
SecretsPath returns the path to a tenant's vault secrets file. It does not require the file to exist.
func SetSecret ¶ added in v0.8.0
SetSecret writes or updates one KEY=value entry in the tenant's vault secrets file, creating it 0600 inside the 0700 vault. Existing entries are preserved; a repeated key is updated in place. Returns the number of keys stored afterward.
The value is treated as opaque and is never logged by this package. Callers (the CLI command, the installer) must not print it either.
Types ¶
type BootstrapOptions ¶ added in v0.8.0
type BootstrapOptions struct {
Name string
Kind string
OSName string
Owner string
Brand string
Voice string
Language string
Taboos []string
Route string
Engagement string
Pillars []manifest.Pillar
Sources []BootstrapSource
Backend string
Model string
Mode string
NoCluster bool
Force bool
SkipExtract bool
DryRun bool
Activate bool
}
BootstrapOptions describes a resumable tenant bootstrap. Creation fields are used only when the tenant does not exist; an existing manifest is never overwritten.
type BootstrapResult ¶ added in v0.8.0
type BootstrapResult struct {
Slug string `json:"slug"`
Dir string `json:"dir"`
Created bool `json:"created"`
Resumed bool `json:"resumed"`
DryRun bool `json:"dry_run"`
Activated bool `json:"activated"`
Added int `json:"added"`
Skipped int `json:"skipped"`
GraphPath string `json:"graph_path,omitempty"`
SourceFile string `json:"source_file"`
Plan []string `json:"plan,omitempty"`
ProviderAttempts []ProviderAttempt `json:"provider_attempts,omitempty"`
}
func Bootstrap ¶ added in v0.8.0
func Bootstrap(ctx context.Context, slug string, opts BootstrapOptions, client ingest.Engine) (*BootstrapResult, error)
Bootstrap creates or resumes a tenant, materializes an identity-rooted corpus, ingests each new URL, extracts the graph, and optionally activates the tenant only after graph validation.
type BootstrapSource ¶ added in v0.8.0
type BootstrapSource struct {
URL string `json:"url"`
Author string `json:"author,omitempty"`
Contributor string `json:"contributor,omitempty"`
}
BootstrapSource is one public source approved for ingestion. Credentials do not belong here: Graphify receives API keys only through its process environment.
type Info ¶
type Info struct {
Slug string `json:"slug"`
Name string `json:"name,omitempty"`
Kind string `json:"kind,omitempty"`
Owner string `json:"owner,omitempty"`
Dir string `json:"dir"`
Active bool `json:"active"`
VaultOK bool `json:"vault_ok"` // vault dir exists with 0700
Manifest bool `json:"manifest"` // multiversa.toml present and parseable
}
Info is the JSON-safe view of a tenant profile. Vault contents are never included — only the path and whether the layout is intact.
type ProviderAttempt ¶ added in v0.8.0
type ProviderAttempt struct {
Provider string `json:"provider"`
Backend string `json:"backend"`
Model string `json:"model"`
Success bool `json:"success"`
ErrorCode string `json:"error_code,omitempty"`
}
ProviderAttempt is deliberately redacted: it records routing and outcome, never environment variables, credentials, or provider response bodies.
type ProviderConfig ¶ added in v0.8.0
type ProviderConfig struct {
Provider string `json:"provider"`
Model string `json:"model,omitempty"`
Priority int `json:"priority,omitempty"`
Enabled bool `json:"enabled"`
}
func LoadProviderConfigs ¶ added in v0.8.0
func LoadProviderConfigs(slug string) ([]ProviderConfig, error)
type ProviderPlan ¶ added in v0.8.0
type ProviderPlan struct {
Provider string `json:"provider"`
Backend string `json:"backend"`
Model string `json:"model"`
Env []string `json:"-"`
}
func BuildProviderFallback ¶ added in v0.8.0
func BuildProviderFallback(slug string, preferred []string) ([]ProviderPlan, error)
BuildProviderFallback resolves enabled providers in requested/configured order and injects tenant-local keys only into the child process environment.
type ProviderSpec ¶ added in v0.8.0
type ProviderSpec struct {
Name string
SecretKey string
Backend string
DefaultModel string
BaseURL string
}
func LookupProvider ¶ added in v0.8.0
func LookupProvider(name string) (ProviderSpec, bool)