Documentation
¶
Index ¶
- func ComposeContent(providers []ContentProvider, templateContent string) string
- func LoadManualContexts(dataDir string) ([]string, error)
- func ResolveActiveContexts(resolvers []ContextResolver, manualContexts []string, store ContextStore) ([]entry.ContextRef, []string)
- func SetManualContext(dataDir string, name string) error
- func UnsetManualContext(dataDir string, name string) error
- type CompositeProvider
- type ContentProvider
- type ContextResolver
- type ContextStore
- type EnrichedContent
- type EntryResult
- type MCPClient
- type Provider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComposeContent ¶
func ComposeContent(providers []ContentProvider, templateContent string) string
ComposeContent assembles the editor buffer from provider output and template content. Order: provider outputs (in order, separated by newlines) -> blank line -> template content. Providers that return empty strings or errors are silently skipped.
func LoadManualContexts ¶
LoadManualContexts reads the active manual context names from the state file.
func ResolveActiveContexts ¶
func ResolveActiveContexts( resolvers []ContextResolver, manualContexts []string, store ContextStore, ) ([]entry.ContextRef, []string)
ResolveActiveContexts gathers contexts from resolvers and manual list, deduplicates, and ensures each exists in storage (creating if needed). Returns resolved context refs and a slice of warning messages. Warnings are informational only and never block entry creation.
func SetManualContext ¶
SetManualContext adds a context name to the active list (idempotent).
func UnsetManualContext ¶
UnsetManualContext removes a context name from the active list.
Types ¶
type CompositeProvider ¶
type CompositeProvider struct {
// contains filtered or unexported fields
}
CompositeProvider implements Provider using the local MCP server.
func NewCompositeProvider ¶
func NewCompositeProvider(store storage.Storage) (*CompositeProvider, error)
NewCompositeProvider creates a provider backed by an in-memory MCP server.
func (*CompositeProvider) Filter ¶
func (p *CompositeProvider) Filter(ctx context.Context, opts storage.ListOptions) ([]EntryResult, error)
Filter implements Provider.Filter.
func (*CompositeProvider) Search ¶
func (p *CompositeProvider) Search(ctx context.Context, query string, limit int) ([]EntryResult, error)
Search implements Provider.Search.
type ContentProvider ¶
ContentProvider generates text for the editor buffer.
func LookupContentProvider ¶
func LookupContentProvider(name string) ContentProvider
LookupContentProvider returns a content provider by name, or nil if unknown.
type ContextResolver ¶
ContextResolver detects contexts from the environment.
func LookupContextResolver ¶
func LookupContextResolver(name string) ContextResolver
LookupContextResolver returns a context resolver by name, or nil if unknown.
type ContextStore ¶
type ContextStore interface {
GetContextByName(name string) (storage.Context, error)
CreateContext(c storage.Context) error
}
ContextStore is the subset of storage.Storage needed for context resolution.
type EnrichedContent ¶
type EnrichedContent struct {
Content string `json:"content"`
SuggestedTags []string `json:"suggested_tags"`
Mood string `json:"mood,omitempty"`
FollowUpPrompts []string `json:"follow_up_prompts"`
}
EnrichedContent holds LLM-enriched template output.
type EntryResult ¶
type EntryResult struct {
ID string `json:"id"`
Preview string `json:"preview"`
Date string `json:"date"`
Score float64 `json:"score"`
}
EntryResult represents a search result from the context provider.
type MCPClient ¶
type MCPClient struct {
// contains filtered or unexported fields
}
MCPClient wraps an MCP client session for calling tools.
func NewMCPClient ¶
NewMCPClient creates a client connected to the given transport.
func (*MCPClient) Filter ¶
func (c *MCPClient) Filter(ctx context.Context, input mcptools.FilterInput) ([]EntryResult, error)
Filter calls the filter_entries tool.
type Provider ¶
type Provider interface {
// Search performs fuzzy search over diary entries.
Search(ctx context.Context, query string, limit int) ([]EntryResult, error)
// Filter retrieves entries matching date/template criteria.
Filter(ctx context.Context, opts storage.ListOptions) ([]EntryResult, error)
}
Provider defines the interface for context enrichment operations.