Documentation
¶
Index ¶
- type APIKey
- type APIKeyID
- type APIKeySummary
- type Brain
- type ComposeRequest
- type ComposeResponse
- type ComposeSource
- type ComposeSourceKind
- type ContentType
- type ContentVersion
- type CreateAPIKeyResult
- type EffectiveState
- type EntityID
- type LayerOverride
- type ModelPrefs
- type Persona
- type Project
- type Rule
- type RuleEntry
- type ScopeType
- type Slug
- type Soul
- type TokenEstimate
- type UserID
- type ValidationError
- type VersionSummary
- type Workspace
- type WorkspaceID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIKey ¶
type APIKey struct {
ID APIKeyID `json:"id"`
UserID UserID `json:"user_id"`
Name string `json:"name"`
KeyPrefix string `json:"key_prefix"`
KeyHash string `json:"key_hash"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
RevokedAt *time.Time `json:"revoked_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
type APIKeySummary ¶
type Brain ¶
type Brain struct {
ID EntityID `json:"id"`
WorkspaceID WorkspaceID `json:"workspace_id"`
Slug Slug `json:"slug"`
SoulSlug Slug `json:"soul_slug"`
PersonaSlug Slug `json:"persona_slug"`
RuleSlugs []Slug `json:"rule_slugs"`
ModelPrefs *ModelPrefs `json:"model_prefs,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type ComposeRequest ¶
type ComposeRequest struct {
WorkspaceID WorkspaceID `json:"workspace_id"`
Source ComposeSource `json:"source"`
ModelPrefs *ModelPrefs `json:"model_prefs,omitempty"`
ProjectSlug Slug `json:"project_slug,omitempty"`
SessionID string `json:"session_id,omitempty"`
Task string `json:"task,omitempty"`
}
type ComposeResponse ¶
type ComposeResponse struct {
Prompt string `json:"prompt"`
Soul Slug `json:"soul"`
Persona Slug `json:"persona"`
Brain Slug `json:"brain"`
Rules []Slug `json:"rules"`
ModelPrefs *ModelPrefs `json:"model_prefs,omitempty"`
TokenEstimate TokenEstimate `json:"token_estimate"`
Warnings []string `json:"warnings"`
}
type ComposeSource ¶
type ComposeSource struct {
Kind ComposeSourceKind `json:"kind"`
BrainSlug Slug `json:"brain_slug,omitempty"`
PersonaSlug Slug `json:"persona_slug,omitempty"`
}
ComposeSource is a discriminated union — brain, persona, and state resolution are mutually exclusive. The Kind field selects the variant.
type ComposeSourceKind ¶
type ComposeSourceKind string
const ( ComposeFromBrain ComposeSourceKind = "brain" ComposeFromPersona ComposeSourceKind = "persona" ComposeFromState ComposeSourceKind = "state" )
type ContentType ¶
type ContentType string
const ( ContentTypeSoul ContentType = "soul" ContentTypePersona ContentType = "persona" ContentTypeRule ContentType = "rule" )
type ContentVersion ¶
type ContentVersion struct {
ID EntityID `json:"id"`
ContentType ContentType `json:"content_type"`
WorkspaceID WorkspaceID `json:"workspace_id"`
Slug Slug `json:"slug"`
Version int `json:"version"`
Content string `json:"content,omitempty"`
Metadata json.RawMessage `json:"metadata,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
ContentVersion is a historical snapshot of a content entity. Stores hold old versions only — the current version lives in the live entity table. For rules, Content is empty and Metadata holds the entries as JSON.
type CreateAPIKeyResult ¶
type CreateAPIKeyResult struct {
ID APIKeyID `json:"id"`
Name string `json:"name"`
Key string `json:"key"`
KeyPrefix string `json:"key_prefix"`
UserID UserID `json:"user_id"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
CreateAPIKeyResult is returned by CreateAPIKey — Key is the plaintext token shown to the user once and never persisted in recoverable form.
type EffectiveState ¶
type EffectiveState struct {
Soul string `json:"soul"`
Persona string `json:"persona"`
Rules []string `json:"rules"`
}
EffectiveState is the resolved state after merging all applicable layers.
type LayerOverride ¶
type LayerOverride struct {
WorkspaceID WorkspaceID `json:"workspace_id"`
ScopeType ScopeType `json:"scope_type"`
ReferenceID string `json:"reference_id"`
SoulSlug *string `json:"soul_slug,omitempty"`
PersonaSlug *string `json:"persona_slug,omitempty"`
RulesToAdd []string `json:"rules_to_add"`
RulesToRemove []string `json:"rules_to_remove"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
LayerOverride is a single row in the precedence chain, keyed by (WorkspaceID, ScopeType, ReferenceID). Three-way semantics for single-valued fields via *string:
- nil = absent (no opinion, NULL in SQL)
- &"" = inherit (clear override, empty string in SQL)
- &"cto" = set (value in SQL)
type ModelPrefs ¶
type ModelPrefs struct {
Model string `json:"model,omitempty"`
Temperature *float64 `json:"temperature,omitempty"`
MaxTokens *int `json:"max_tokens,omitempty"`
PlatformExtras map[string]any `json:"platform_extras,omitempty"`
}
ModelPrefs controls how a brain should be instantiated. All fields are optional — omitted fields inherit runtime defaults. Only platform-agnostic fields are first-class. Provider-specific params live in PlatformExtras.
ModelPrefs is attached to Brain as the default, but ComposeRequest can supply a per-call override and ComposeResponse echoes the resolved value.
func (*ModelPrefs) IsZero ¶
func (m *ModelPrefs) IsZero() bool
IsZero returns true when no preferences are set.
type Slug ¶
type Slug string
type TokenEstimate ¶
type ValidationError ¶
type ValidationError struct {
Message string
}
ValidationError is returned when input fails validation.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
type VersionSummary ¶
type WorkspaceID ¶
type WorkspaceID string