store

package
v0.99.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: GPL-3.0 Imports: 115 Imported by: 0

Documentation

Overview

Package store provides database storage implementations.

Package store provides database storage implementations.

Package store provides database storage implementations.

Package store provides database storage implementations.

Package store provides database storage implementations.

Package store provides database storage implementations.

Package store provides database storage implementations.

Package store provides database storage implementations.

Package store provides database storage implementations.

Package store provides database storage implementations.

Package store provides database storage implementations.

Package store provides database storage implementations.

Package store provides database storage implementations.

Package store provides database storage implementations.

Package store provides database storage implementations.

Index

Constants

View Source
const LifeLoreRequestedType = "life.inventory.lore_requested"

LifeLoreRequestedType is the Life lore outbox event type (payload["type"]).

Variables

This section is empty.

Functions

func ClientFromDB added in v0.99.0

func ClientFromDB() *gen.Client

ClientFromDB returns the ent client from the global Database adapter. Prefer GetDB(*gen.Client) so BDD stubs that only implement GetDB work; calling GetClient on a nil embedded Adapter panics. Fall back to GetClient otherwise.

func Init

func Init()

func MaskNotifyURI added in v0.99.0

func MaskNotifyURI(protocol, uri string) string

MaskNotifyURI produces a display-safe masked form of a notification URI.

func Migrate

func Migrate() error

func NewFunctionCatalogAdapter added in v0.99.0

func NewFunctionCatalogAdapter(s *FunctionStore) functions.Catalog

NewFunctionCatalogAdapter wraps a FunctionStore as functions.Catalog.

func NewPipelineCatalogAdapter added in v0.99.0

func NewPipelineCatalogAdapter(s *PipelineStore) pipeline.DefinitionCatalog

NewPipelineCatalogAdapter wraps a PipelineStore as pipeline.DefinitionCatalog.

func NewPipelineRunStoreAdapter added in v0.99.0

func NewPipelineRunStoreAdapter(s *PipelineStore) pipeline.RunStore

NewPipelineRunStoreAdapter wraps a PipelineStore as pipeline.RunStore.

func NewWorkflowCatalogAdapter added in v0.99.0

func NewWorkflowCatalogAdapter(s *WorkflowStore) workflow.Catalog

NewWorkflowCatalogAdapter wraps a WorkflowStore as workflow.Catalog.

func NewWorkflowRunStoreAdapter added in v0.99.0

func NewWorkflowRunStoreAdapter(s *WorkflowRunStore) workflow.WorkflowRunStore

NewWorkflowRunStoreAdapter wraps a WorkflowRunStore as workflow.WorkflowRunStore.

func ParameterIsExpired added in v0.92.0

func ParameterIsExpired(p gen.Parameter) bool

ParameterIsExpired checks whether the given access token parameter has expired.

func RegisterAdapter

func RegisterAdapter(a Adapter)

func SetQueryLimits added in v0.99.0

func SetQueryLimits(maxResults, maxMessageResults int)

SetQueryLimits updates package-level query caps (called from adapter Open).

Types

type Adapter

type Adapter interface {
	// Open and configure the adapter
	Open(storeConfig config.StoreType) error
	// Close the adapter
	Close() error
	// IsOpen checks if the adapter is ready for use
	IsOpen() bool
	// GetName returns the name of the adapter
	GetName() string
	// Stats returns the DB connection stats object.
	Stats() any
	// Ping checks database connectivity and returns the round-trip latency.
	Ping(ctx context.Context) (time.Duration, error)
	// GetDB returns the underlying DB connection (ent client as any).
	GetDB() any
	// GetClient returns the ent client.
	GetClient() *gen.Client
}

Adapter is the database connection facade (open/close/ping/client). Domain persistence lives on *Store types (ChatStore, AgentStore, …).

var Database Adapter

type AgentKnowledgeListFilter added in v0.98.1

type AgentKnowledgeListFilter struct {
	// Q matches a substring of path or title when non-empty.
	Q string
}

AgentKnowledgeListFilter filters knowledge documents for the management UI.

type AgentKnowledgeSearchParams added in v0.98.1

type AgentKnowledgeSearchParams struct {
	// Query matches path, title, tags, summary, or content via case-insensitive substring.
	Query string
	// PathPrefix restricts results to paths with this prefix.
	PathPrefix string
	// Tag requires an exact tag match when non-empty.
	Tag string
	// Limit caps results (default 10, max 50).
	Limit int
}

AgentKnowledgeSearchParams controls agent knowledge search over path, title, tags, summary, content (DB substring match), plus optional exact tag filter.

type AgentMemoryFactUpsert added in v0.98.1

type AgentMemoryFactUpsert struct {
	// Scope isolates facts (interactive chat uses "default").
	Scope string
	// Key is the fact name within the scope.
	Key string
	// Value is the stored fact text.
	Value string
	// Pinned prefers the fact for system-prompt injection.
	Pinned bool
}

AgentMemoryFactUpsert carries fields for inserting or updating one memory fact.

type AgentMemoryFactsFingerprint added in v0.98.1

type AgentMemoryFactsFingerprint struct {
	// Count is the number of facts in the scope.
	Count int
	// MaxUpdatedAt is the newest updated_at among facts in the scope.
	MaxUpdatedAt time.Time
	// ContentHash digests key/value/pinned/updated_at for cache invalidation.
	ContentHash string
}

AgentMemoryFactsFingerprint is a cache-busting digest for injectable facts in a scope.

type AgentMemoryInjectableParams added in v0.98.1

type AgentMemoryInjectableParams struct {
	// Scope selects which memory scope to read.
	Scope string
	// MaxCount caps how many facts are returned (default 30).
	MaxCount int
	// MaxChars caps total key+value characters across returned facts (default 4000).
	MaxChars int
}

AgentMemoryInjectableParams controls which facts are selected for system-prompt injection.

type AgentSessionSummaryListFilter added in v0.98.1

type AgentSessionSummaryListFilter struct {
	// Scope restricts results when non-empty.
	Scope string
	// Status filters by pending|ready|failed when non-empty.
	Status string
	// Q matches title or summary via case-insensitive substring when non-empty.
	Q string
}

AgentSessionSummaryListFilter filters session summaries for the management UI.

type AgentSessionSummarySearchParams added in v0.98.1

type AgentSessionSummarySearchParams struct {
	// Query matches title or summary via case-insensitive substring.
	Query string
	// Scope restricts results when non-empty.
	Scope string
	// Limit caps results (default 10, max 50).
	Limit int
}

AgentSessionSummarySearchParams controls session summary search.

type AgentStore added in v0.99.0

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

AgentStore persists chat-agent plans, skills, knowledge, memory, and subagents.

func AgentStoreFromDB added in v0.99.0

func AgentStoreFromDB() *AgentStore

AgentStoreFromDB returns an AgentStore using the global database client.

func NewAgentStore added in v0.99.0

func NewAgentStore(client *gen.Client) *AgentStore

NewAgentStore creates an AgentStore with the given ent client.

func (*AgentStore) ClaimAgentSessionSummaryPending added in v0.99.0

func (s *AgentStore) ClaimAgentSessionSummaryPending(ctx context.Context, claimToken string) (*gen.AgentSessionSummary, error)

ClaimAgentSessionSummaryPending claims agent session summary pending.

func (*AgentStore) Client added in v0.99.0

func (s *AgentStore) Client() *gen.Client

Client returns the underlying ent client.

func (*AgentStore) CreateAgentKnowledge added in v0.99.0

func (s *AgentStore) CreateAgentKnowledge(ctx context.Context, doc *gen.AgentKnowledge) error

CreateAgentKnowledge persists a new agent knowledge.

func (*AgentStore) CreateAgentPlan added in v0.99.0

func (s *AgentStore) CreateAgentPlan(ctx context.Context, plan *gen.AgentPlan) error

CreateAgentPlan persists a new agent plan.

func (*AgentStore) CreateAgentSkill added in v0.99.0

func (s *AgentStore) CreateAgentSkill(ctx context.Context, skill *gen.AgentSkill) error

CreateAgentSkill persists a new agent skill.

func (*AgentStore) CreateAgentSkillFile added in v0.99.0

func (s *AgentStore) CreateAgentSkillFile(ctx context.Context, file *gen.AgentSkillFile) error

CreateAgentSkillFile persists a new agent skill file.

func (*AgentStore) CreateAgentSubagent added in v0.99.0

func (s *AgentStore) CreateAgentSubagent(ctx context.Context, subagent *gen.AgentSubagent) error

CreateAgentSubagent persists a new agent subagent.

func (*AgentStore) CreateAgentSubagentTask added in v0.99.0

func (s *AgentStore) CreateAgentSubagentTask(ctx context.Context, task *gen.AgentSubagentTask) error

CreateAgentSubagentTask persists a new agent subagent task.

func (*AgentStore) DeleteAgentKnowledge added in v0.99.0

func (s *AgentStore) DeleteAgentKnowledge(ctx context.Context, id int64) error

DeleteAgentKnowledge deletes the agent knowledge.

func (*AgentStore) DeleteAgentMemoryFact added in v0.99.0

func (s *AgentStore) DeleteAgentMemoryFact(ctx context.Context, scope, key string) error

DeleteAgentMemoryFact deletes the agent memory fact.

func (*AgentStore) DeleteAgentSkill added in v0.99.0

func (s *AgentStore) DeleteAgentSkill(ctx context.Context, flag string) error

DeleteAgentSkill deletes the agent skill.

func (*AgentStore) DeleteAgentSkillFile added in v0.99.0

func (s *AgentStore) DeleteAgentSkillFile(ctx context.Context, skillFlag, path string) error

DeleteAgentSkillFile deletes the agent skill file.

func (*AgentStore) DeleteAgentSkillFilesByFlag added in v0.99.0

func (s *AgentStore) DeleteAgentSkillFilesByFlag(ctx context.Context, skillFlag string) error

DeleteAgentSkillFilesByFlag deletes the agent skill files by flag.

func (*AgentStore) DeleteAgentSubagent added in v0.99.0

func (s *AgentStore) DeleteAgentSubagent(ctx context.Context, flag string) error

DeleteAgentSubagent deletes the agent subagent.

func (*AgentStore) GetAgentKnowledgeByID added in v0.99.0

func (s *AgentStore) GetAgentKnowledgeByID(ctx context.Context, id int64) (*gen.AgentKnowledge, error)

GetAgentKnowledgeByID returns the agent knowledge with the given id.

func (*AgentStore) GetAgentKnowledgeByPath added in v0.99.0

func (s *AgentStore) GetAgentKnowledgeByPath(ctx context.Context, path string) (*gen.AgentKnowledge, error)

GetAgentKnowledgeByPath returns the agent knowledge by path.

func (*AgentStore) GetAgentMemoryFact added in v0.99.0

func (s *AgentStore) GetAgentMemoryFact(ctx context.Context, scope, key string) (*gen.AgentMemoryFact, error)

GetAgentMemoryFact returns the agent memory fact.

func (*AgentStore) GetAgentMemoryFactsFingerprint added in v0.99.0

func (s *AgentStore) GetAgentMemoryFactsFingerprint(ctx context.Context, scope string) (AgentMemoryFactsFingerprint, error)

GetAgentMemoryFactsFingerprint returns the agent memory facts fingerprint.

func (*AgentStore) GetAgentPlan added in v0.99.0

func (s *AgentStore) GetAgentPlan(ctx context.Context, flag string) (*gen.AgentPlan, error)

GetAgentPlan returns the agent plan.

func (*AgentStore) GetAgentPlanInSession added in v0.99.0

func (s *AgentStore) GetAgentPlanInSession(ctx context.Context, sessionID, flag string) (*gen.AgentPlan, error)

GetAgentPlanInSession returns the agent plan in session.

func (*AgentStore) GetAgentSessionSummaryBySession added in v0.99.0

func (s *AgentStore) GetAgentSessionSummaryBySession(ctx context.Context, sessionFlag string) (*gen.AgentSessionSummary, error)

GetAgentSessionSummaryBySession returns the agent session summary by session.

func (*AgentStore) GetAgentSkillByFlag added in v0.99.0

func (s *AgentStore) GetAgentSkillByFlag(ctx context.Context, flag string) (*gen.AgentSkill, error)

GetAgentSkillByFlag returns the agent skill by flag.

func (*AgentStore) GetAgentSkillByName added in v0.99.0

func (s *AgentStore) GetAgentSkillByName(ctx context.Context, name string) (*gen.AgentSkill, error)

GetAgentSkillByName returns the agent skill by name.

func (*AgentStore) GetAgentSkillFile added in v0.99.0

func (s *AgentStore) GetAgentSkillFile(ctx context.Context, skillFlag, path string) (*gen.AgentSkillFile, error)

GetAgentSkillFile returns the agent skill file.

func (*AgentStore) GetAgentSkillsMaxUpdatedAt added in v0.99.0

func (s *AgentStore) GetAgentSkillsMaxUpdatedAt(ctx context.Context) (time.Time, error)

GetAgentSkillsMaxUpdatedAt returns the agent skills max updated at.

func (*AgentStore) GetAgentSubagentByFlag added in v0.99.0

func (s *AgentStore) GetAgentSubagentByFlag(ctx context.Context, flag string) (*gen.AgentSubagent, error)

GetAgentSubagentByFlag returns the agent subagent by flag.

func (*AgentStore) GetAgentSubagentByName added in v0.99.0

func (s *AgentStore) GetAgentSubagentByName(ctx context.Context, name string) (*gen.AgentSubagent, error)

GetAgentSubagentByName returns the agent subagent by name.

func (*AgentStore) GetAgentSubagentTask added in v0.99.0

func (s *AgentStore) GetAgentSubagentTask(ctx context.Context, id int64) (*gen.AgentSubagentTask, error)

GetAgentSubagentTask returns the agent subagent task.

func (*AgentStore) GetAgentSubagentsMaxUpdatedAt added in v0.99.0

func (s *AgentStore) GetAgentSubagentsMaxUpdatedAt(ctx context.Context) (time.Time, error)

GetAgentSubagentsMaxUpdatedAt returns the agent subagents max updated at.

func (*AgentStore) ListAgentKnowledge added in v0.99.0

func (s *AgentStore) ListAgentKnowledge(ctx context.Context, filter AgentKnowledgeListFilter) ([]*gen.AgentKnowledge, error)

ListAgentKnowledge returns agent knowledge.

func (*AgentStore) ListAgentMemoryFacts added in v0.99.0

func (s *AgentStore) ListAgentMemoryFacts(ctx context.Context, scope string) ([]*gen.AgentMemoryFact, error)

ListAgentMemoryFacts returns agent memory facts.

func (*AgentStore) ListAgentPlansBySession added in v0.99.0

func (s *AgentStore) ListAgentPlansBySession(ctx context.Context, sessionID string) ([]*gen.AgentPlan, error)

ListAgentPlansBySession returns agent plans by session.

func (*AgentStore) ListAgentSessionSummaries added in v0.99.0

func (s *AgentStore) ListAgentSessionSummaries(ctx context.Context, filter AgentSessionSummaryListFilter) ([]*gen.AgentSessionSummary, error)

ListAgentSessionSummaries returns agent session summaries.

func (*AgentStore) ListAgentSkillFiles added in v0.99.0

func (s *AgentStore) ListAgentSkillFiles(ctx context.Context, skillFlag string) ([]*gen.AgentSkillFile, error)

ListAgentSkillFiles returns agent skill files.

func (*AgentStore) ListAgentSkills added in v0.99.0

func (s *AgentStore) ListAgentSkills(ctx context.Context, enabledOnly bool) ([]*gen.AgentSkill, error)

ListAgentSkills returns agent skills.

func (*AgentStore) ListAgentSubagentTasks added in v0.99.0

func (s *AgentStore) ListAgentSubagentTasks(ctx context.Context, sessionID string, limit int) ([]*gen.AgentSubagentTask, error)

ListAgentSubagentTasks returns agent subagent tasks.

func (*AgentStore) ListAgentSubagents added in v0.99.0

func (s *AgentStore) ListAgentSubagents(ctx context.Context, enabledOnly bool) ([]*gen.AgentSubagent, error)

ListAgentSubagents returns agent subagents.

func (*AgentStore) ListAgentTodosBySession added in v0.99.0

func (s *AgentStore) ListAgentTodosBySession(ctx context.Context, sessionID string) ([]*gen.AgentTodo, error)

ListAgentTodosBySession returns agent todos by session.

func (*AgentStore) ListAgentTodosBySessions added in v0.99.0

func (s *AgentStore) ListAgentTodosBySessions(ctx context.Context, sessionIDs []string) ([]*gen.AgentTodo, error)

ListAgentTodosBySessions returns agent todos by sessions.

func (*AgentStore) ListInjectableAgentMemoryFacts added in v0.99.0

func (s *AgentStore) ListInjectableAgentMemoryFacts(ctx context.Context, params AgentMemoryInjectableParams) ([]*gen.AgentMemoryFact, error)

ListInjectableAgentMemoryFacts returns injectable agent memory facts.

func (*AgentStore) MarkAgentSessionSummaryFailed added in v0.99.0

func (s *AgentStore) MarkAgentSessionSummaryFailed(ctx context.Context, sessionFlag, claimToken, errMsg string) error

MarkAgentSessionSummaryFailed marks agent session summary failed.

func (*AgentStore) MarkAgentSessionSummaryReady added in v0.99.0

func (s *AgentStore) MarkAgentSessionSummaryReady(ctx context.Context, sessionFlag, claimToken, title, summary string) error

MarkAgentSessionSummaryReady marks agent session summary ready.

func (*AgentStore) MergeAgentTodosForSession added in v0.99.0

func (s *AgentStore) MergeAgentTodosForSession(ctx context.Context, sessionID string, items []*gen.AgentTodo) error

MergeAgentTodosForSession merges agent todos for session.

func (*AgentStore) ReplaceAgentTodosForSession added in v0.99.0

func (s *AgentStore) ReplaceAgentTodosForSession(ctx context.Context, sessionID string, items []*gen.AgentTodo) error

ReplaceAgentTodosForSession replaces agent todos for session.

func (*AgentStore) RequeueStaleAgentSessionSummaryPending added in v0.99.0

func (s *AgentStore) RequeueStaleAgentSessionSummaryPending(ctx context.Context, olderThan time.Duration) (int, error)

RequeueStaleAgentSessionSummaryPending requeues stale agent session summary pending.

func (*AgentStore) SearchAgentKnowledge added in v0.99.0

func (s *AgentStore) SearchAgentKnowledge(ctx context.Context, params AgentKnowledgeSearchParams) ([]*gen.AgentKnowledge, error)

SearchAgentKnowledge searches agent knowledge.

func (*AgentStore) SearchAgentSessionSummaries added in v0.99.0

func (s *AgentStore) SearchAgentSessionSummaries(ctx context.Context, params AgentSessionSummarySearchParams) ([]*gen.AgentSessionSummary, error)

SearchAgentSessionSummaries searches agent session summaries.

func (*AgentStore) UpdateAgentKnowledge added in v0.99.0

func (s *AgentStore) UpdateAgentKnowledge(ctx context.Context, doc *gen.AgentKnowledge) error

UpdateAgentKnowledge updates the agent knowledge.

func (*AgentStore) UpdateAgentSkill added in v0.99.0

func (s *AgentStore) UpdateAgentSkill(ctx context.Context, skill *gen.AgentSkill) error

UpdateAgentSkill updates the agent skill.

func (*AgentStore) UpdateAgentSkillFile added in v0.99.0

func (s *AgentStore) UpdateAgentSkillFile(ctx context.Context, file *gen.AgentSkillFile) error

UpdateAgentSkillFile updates the agent skill file.

func (*AgentStore) UpdateAgentSubagent added in v0.99.0

func (s *AgentStore) UpdateAgentSubagent(ctx context.Context, subagent *gen.AgentSubagent) error

UpdateAgentSubagent updates the agent subagent.

func (*AgentStore) UpdateAgentSubagentTask added in v0.99.0

func (s *AgentStore) UpdateAgentSubagentTask(ctx context.Context, task *gen.AgentSubagentTask) error

UpdateAgentSubagentTask updates the agent subagent task.

func (*AgentStore) UpsertAgentMemoryFact added in v0.99.0

func (s *AgentStore) UpsertAgentMemoryFact(ctx context.Context, fact AgentMemoryFactUpsert) (*gen.AgentMemoryFact, error)

UpsertAgentMemoryFact inserts or updates agent memory fact.

func (*AgentStore) UpsertAgentSessionSummaryPending added in v0.99.0

func (s *AgentStore) UpsertAgentSessionSummaryPending(ctx context.Context, sessionFlag, scope, title string) (*gen.AgentSessionSummary, error)

UpsertAgentSessionSummaryPending inserts or updates agent session summary pending.

type AppInfo added in v0.92.0

type AppInfo struct {
	Name      string
	UpdatedAt time.Time
}

AppInfo is a lightweight projection of store-level app metadata.

type AuditStore added in v0.92.0

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

func AuditStoreFromDB added in v0.99.0

func AuditStoreFromDB() *AuditStore

AuditStoreFromDB returns an AuditStore using the global database client.

func NewAuditStore added in v0.92.0

func NewAuditStore(client *gen.Client) *AuditStore

func (*AuditStore) Record added in v0.92.0

func (s *AuditStore) Record(ctx context.Context, entry audit.Entry) error

Record writes an audit entry to persistent storage. If the store or client is nil, the call is silently skipped. Audit write failures are logged and do not propagate to the caller. Sensitive fields in entry.Request are redacted before storage.

func (*AuditStore) RecordFailure added in v0.92.0

func (s *AuditStore) RecordFailure(ctx context.Context, entry audit.Entry, err error) error

RecordFailure writes a failure audit entry with the error message.

func (*AuditStore) RecordRejected added in v0.92.0

func (s *AuditStore) RecordRejected(ctx context.Context, entry audit.Entry, reason string) error

RecordRejected writes a rejected audit entry with the reason.

func (*AuditStore) RecordSuccess added in v0.92.0

func (s *AuditStore) RecordSuccess(ctx context.Context, entry audit.Entry) error

RecordSuccess writes a success audit entry.

type ChatStore added in v0.99.0

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

ChatStore persists chat sessions, entries, and scheduled tasks.

func ChatStoreFromDB added in v0.99.0

func ChatStoreFromDB() *ChatStore

ChatStoreFromDB returns a ChatStore using the global database client.

func NewChatStore added in v0.99.0

func NewChatStore(client *gen.Client) *ChatStore

NewChatStore creates a ChatStore with the given ent client.

func (*ChatStore) AppendChatSessionEntry added in v0.99.0

func (s *ChatStore) AppendChatSessionEntry(ctx context.Context, entry *gen.ChatSessionEntry) error

AppendChatSessionEntry appends a chat session entry.

func (*ChatStore) Client added in v0.99.0

func (s *ChatStore) Client() *gen.Client

Client returns the underlying ent client.

func (*ChatStore) CloseChatSession added in v0.99.0

func (s *ChatStore) CloseChatSession(ctx context.Context, flag string) error

CloseChatSession closes the chat session.

func (*ChatStore) CountChatSessions added in v0.99.0

func (s *ChatStore) CountChatSessions(ctx context.Context, opts ListChatSessionsOptions) (int, error)

CountChatSessions returns the number of chat sessions.

func (*ChatStore) CreateChatScheduledTask added in v0.99.0

func (s *ChatStore) CreateChatScheduledTask(ctx context.Context, task *gen.ChatScheduledTask) error

CreateChatScheduledTask persists a new chat scheduled task.

func (*ChatStore) CreateChatScheduledTaskRun added in v0.99.0

func (s *ChatStore) CreateChatScheduledTaskRun(ctx context.Context, run *gen.ChatScheduledTaskRun) error

CreateChatScheduledTaskRun persists a new chat scheduled task run.

func (*ChatStore) CreateChatSession added in v0.99.0

func (s *ChatStore) CreateChatSession(ctx context.Context, session *gen.ChatSession) error

CreateChatSession persists a new chat session.

func (*ChatStore) CreateChatSessionEntry added in v0.99.0

func (s *ChatStore) CreateChatSessionEntry(ctx context.Context, entry *gen.ChatSessionEntry) error

CreateChatSessionEntry persists a new chat session entry.

func (*ChatStore) DeleteChatScheduledTask added in v0.99.0

func (s *ChatStore) DeleteChatScheduledTask(ctx context.Context, flag string) error

DeleteChatScheduledTask deletes the chat scheduled task.

func (*ChatStore) FailStaleChatScheduledTaskRuns added in v0.99.0

func (s *ChatStore) FailStaleChatScheduledTaskRuns(ctx context.Context) error

FailStaleChatScheduledTaskRuns marks stale chat scheduled task runs.

func (*ChatStore) GetChatScheduledTask added in v0.99.0

func (s *ChatStore) GetChatScheduledTask(ctx context.Context, flag string) (*gen.ChatScheduledTask, error)

GetChatScheduledTask returns the chat scheduled task.

func (*ChatStore) GetChatScheduledTaskForUID added in v0.99.0

func (s *ChatStore) GetChatScheduledTaskForUID(ctx context.Context, flag, uid string) (*gen.ChatScheduledTask, error)

GetChatScheduledTaskForUID returns the chat scheduled task for uid.

func (*ChatStore) GetChatSession added in v0.99.0

func (s *ChatStore) GetChatSession(ctx context.Context, flag string) (*gen.ChatSession, error)

GetChatSession returns the chat session.

func (*ChatStore) GetChatSessionEntry added in v0.99.0

func (s *ChatStore) GetChatSessionEntry(ctx context.Context, flag string) (*gen.ChatSessionEntry, error)

GetChatSessionEntry returns the chat session entry.

func (*ChatStore) GetChatSessionEntryInSession added in v0.99.0

func (s *ChatStore) GetChatSessionEntryInSession(ctx context.Context, sessionID, flag string) (*gen.ChatSessionEntry, error)

GetChatSessionEntryInSession returns the chat session entry in session.

func (*ChatStore) ListChatScheduledTaskRuns added in v0.99.0

func (s *ChatStore) ListChatScheduledTaskRuns(ctx context.Context, taskID string, limit int) ([]*gen.ChatScheduledTaskRun, error)

ListChatScheduledTaskRuns returns chat scheduled task runs.

func (*ChatStore) ListChatScheduledTasks added in v0.99.0

func (s *ChatStore) ListChatScheduledTasks(ctx context.Context, opts ListChatScheduledTasksOptions) ([]*gen.ChatScheduledTask, error)

ListChatScheduledTasks returns chat scheduled tasks.

func (*ChatStore) ListChatSessionEntries added in v0.99.0

func (s *ChatStore) ListChatSessionEntries(ctx context.Context, sessionID string) ([]*gen.ChatSessionEntry, error)

ListChatSessionEntries returns chat session entries.

func (*ChatStore) ListChatSessionEntriesBySessions added in v0.99.0

func (s *ChatStore) ListChatSessionEntriesBySessions(ctx context.Context, sessionIDs []string) ([]*gen.ChatSessionEntry, error)

ListChatSessionEntriesBySessions returns chat session entries by sessions.

func (*ChatStore) ListChatSessions added in v0.99.0

func (s *ChatStore) ListChatSessions(ctx context.Context, opts ListChatSessionsOptions) ([]*gen.ChatSession, string, error)

ListChatSessions returns chat sessions.

func (*ChatStore) UpdateChatScheduledTask added in v0.99.0

func (s *ChatStore) UpdateChatScheduledTask(ctx context.Context, flag string, params UpdateChatScheduledTaskParams) error

UpdateChatScheduledTask updates the chat scheduled task.

func (*ChatStore) UpdateChatScheduledTaskRun added in v0.99.0

func (s *ChatStore) UpdateChatScheduledTaskRun(ctx context.Context, flag string, params UpdateChatScheduledTaskRunParams) error

UpdateChatScheduledTaskRun updates the chat scheduled task run.

func (*ChatStore) UpdateChatSessionArchived added in v0.99.0

func (s *ChatStore) UpdateChatSessionArchived(ctx context.Context, flag string, archived bool) error

UpdateChatSessionArchived updates the chat session archived.

func (*ChatStore) UpdateChatSessionLeaf added in v0.99.0

func (s *ChatStore) UpdateChatSessionLeaf(ctx context.Context, flag, leafID string) error

UpdateChatSessionLeaf updates the chat session leaf.

func (*ChatStore) UpdateChatSessionMode added in v0.99.0

func (s *ChatStore) UpdateChatSessionMode(ctx context.Context, flag, mode string) error

UpdateChatSessionMode updates the chat session mode.

func (*ChatStore) UpdateChatSessionPinned added in v0.99.0

func (s *ChatStore) UpdateChatSessionPinned(ctx context.Context, flag string, pinned bool) error

UpdateChatSessionPinned updates the chat session pinned.

func (*ChatStore) UpdateChatSessionPreview added in v0.99.0

func (s *ChatStore) UpdateChatSessionPreview(ctx context.Context, flag, preview string) error

UpdateChatSessionPreview updates the chat session preview.

func (*ChatStore) UpdateChatSessionSettings added in v0.99.0

func (s *ChatStore) UpdateChatSessionSettings(ctx context.Context, flag, modelName, thinkingLevel string) error

UpdateChatSessionSettings updates the chat session settings.

func (*ChatStore) UpdateChatSessionTitle added in v0.99.0

func (s *ChatStore) UpdateChatSessionTitle(ctx context.Context, flag, title string) error

UpdateChatSessionTitle updates the chat session title.

type Client added in v0.92.0

type Client = gen.Client

Client is a type alias for the Ent client.

type ClipStore added in v0.97.0

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

ClipStore persists shareable markdown clips keyed by short slugs.

func ClipStoreFromDB added in v0.99.0

func ClipStoreFromDB() *ClipStore

ClipStoreFromDB returns a ClipStore using the global database client.

func NewClipStore added in v0.97.0

func NewClipStore(client *gen.Client) *ClipStore

NewClipStore creates a ClipStore with the given ent client.

func (*ClipStore) CreateClip added in v0.97.0

func (s *ClipStore) CreateClip(ctx context.Context, slug, title, description, content, createdBy string) error

CreateClip inserts a new clip row.

func (*ClipStore) GetClipBySlug added in v0.97.0

func (s *ClipStore) GetClipBySlug(ctx context.Context, slug string) (*gen.Clip, error)

GetClipBySlug retrieves a clip by slug. Returns nil if not found.

func (*ClipStore) ListClips added in v0.97.0

func (s *ClipStore) ListClips(ctx context.Context, limit int) ([]*gen.Clip, error)

ListClips returns clips ordered by created_at descending. When limit <= 0, all clips are returned.

type CreateAccountInput added in v0.99.0

type CreateAccountInput struct {
	Username     string
	PasswordHash string
}

CreateAccountInput holds fields for creating a web account and ensuring a users row.

type EventStore added in v0.92.0

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

func EventStoreFromDB added in v0.99.0

func EventStoreFromDB() *EventStore

EventStoreFromDB returns an EventStore using the global database client.

func NewEventStore added in v0.92.0

func NewEventStore(client *gen.Client) *EventStore

func (*EventStore) AppendDataEvent added in v0.92.0

func (s *EventStore) AppendDataEvent(ctx context.Context, event types.DataEvent) error

func (*EventStore) AppendEventOutbox added in v0.92.0

func (s *EventStore) AppendEventOutbox(ctx context.Context, event types.DataEvent) error

func (*EventStore) CountDataEvents added in v0.92.0

func (s *EventStore) CountDataEvents(ctx context.Context, opts ListDataEventsOptions) (int64, error)

CountDataEvents returns the total number of data_events matching the given filters. Uses the same filter predicates as ListDataEvents without pagination.

func (*EventStore) DeleteDataEventsOlderThan added in v0.97.1

func (s *EventStore) DeleteDataEventsOlderThan(ctx context.Context, cutoff time.Time) (int, error)

DeleteDataEventsOlderThan deletes data_events with created_at before cutoff and related history (pipeline step runs, pipeline runs, event consumptions, event outbox rows, and resource links that reference those events). Returns the number of deleted data_events rows.

func (*EventStore) GetDataEventByEventID added in v0.92.0

func (s *EventStore) GetDataEventByEventID(ctx context.Context, eventID string) (*gen.DataEvent, error)

GetDataEventByEventID looks up a single data event by its event_id.

func (*EventStore) GetPipelineRunsForEvents added in v0.92.0

func (s *EventStore) GetPipelineRunsForEvents(ctx context.Context, eventIDs []string) (map[string][]PipelineRunInfo, error)

GetPipelineRunsForEvents batch-looks up pipeline runs for the given event IDs. Returns a map of eventID -> []PipelineRunInfo.

func (*EventStore) ListDataEvents added in v0.92.0

func (s *EventStore) ListDataEvents(ctx context.Context, opts ListDataEventsOptions) ([]*gen.DataEvent, string, error)

ListDataEvents returns paginated data_events ordered by created_at DESC. Supports offset-based pagination (when Offset > 0) and cursor-based (backward compatible).

func (*EventStore) ListDistinctEventPipelineNames added in v0.92.0

func (s *EventStore) ListDistinctEventPipelineNames(ctx context.Context) ([]string, error)

ListDistinctEventPipelineNames returns distinct pipeline names from pipeline_runs that have matched events, ordered alphabetically.

func (*EventStore) ListDistinctEventSources added in v0.92.0

func (s *EventStore) ListDistinctEventSources(ctx context.Context, since time.Duration) ([]string, error)

ListDistinctEventSources returns unique source values from data_events created within the given duration (e.g. 30*24*time.Hour for last 30 days).

func (*EventStore) ListDistinctEventTypes added in v0.92.0

func (s *EventStore) ListDistinctEventTypes(ctx context.Context, since time.Duration) ([]string, error)

ListDistinctEventTypes returns unique event_type values from data_events created within the given duration.

func (*EventStore) ListPendingDataEventOutbox added in v0.99.0

func (s *EventStore) ListPendingDataEventOutbox(ctx context.Context, olderThan time.Time, limit int) ([]types.DataEvent, error)

ListPendingDataEventOutbox returns unpublished DataEvent outbox rows older than olderThan. Skips domain-specific outbox rows (e.g. life lore) that share the same table but lack event_type. Scans in batches so a long run of lore rows cannot starve DataEvent redelivery.

func (*EventStore) MarkOutboxPublished added in v0.92.0

func (s *EventStore) MarkOutboxPublished(ctx context.Context, eventID string) error

type FileStore added in v0.99.0

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

FileStore persists file upload records.

func FileStoreFromDB added in v0.99.0

func FileStoreFromDB() *FileStore

FileStoreFromDB returns a FileStore using the global database client.

func NewFileStore added in v0.99.0

func NewFileStore(client *gen.Client) *FileStore

NewFileStore creates a FileStore with the given ent client.

func (*FileStore) Client added in v0.99.0

func (s *FileStore) Client() *gen.Client

Client returns the underlying ent client.

func (*FileStore) FileDeleteUnused added in v0.99.0

func (s *FileStore) FileDeleteUnused(ctx context.Context, olderThan time.Time, limit int) ([]string, error)

FileDeleteUnused delete unused a file upload.

func (*FileStore) FileFinishUpload added in v0.99.0

func (s *FileStore) FileFinishUpload(ctx context.Context, fd *types.FileDef, success bool, size int64) (*types.FileDef, error)

FileFinishUpload finish upload a file upload.

func (*FileStore) FileGet added in v0.99.0

func (s *FileStore) FileGet(ctx context.Context, fid string) (*types.FileDef, error)

FileGet get a file upload.

func (*FileStore) FileStartUpload added in v0.99.0

func (s *FileStore) FileStartUpload(ctx context.Context, fd *types.FileDef) error

FileStartUpload start upload a file upload.

type FunctionCatalogAdapter added in v0.99.0

type FunctionCatalogAdapter struct {
	S *FunctionStore
}

FunctionCatalogAdapter adapts FunctionStore to functions.Catalog (model DTOs).

func (FunctionCatalogAdapter) CompleteRun added in v0.99.0

func (a FunctionCatalogAdapter) CompleteRun(ctx context.Context, id int64, status string, durationMs int64, exitCode *int, errMsg string, resultJSON *string) (*model.FunctionRun, error)

CompleteRun implements functions.Catalog.

func (FunctionCatalogAdapter) Create added in v0.99.0

func (a FunctionCatalogAdapter) Create(ctx context.Context, name, metadata, entrypoint, source, createdBy string) error

Create implements functions.Catalog.

func (FunctionCatalogAdapter) CreateRun added in v0.99.0

func (a FunctionCatalogAdapter) CreateRun(ctx context.Context, name string, version int, idempotencyKey *string) (*model.FunctionRun, error)

CreateRun implements functions.Catalog.

func (FunctionCatalogAdapter) Delete added in v0.99.0

func (a FunctionCatalogAdapter) Delete(ctx context.Context, name string) (int64, error)

Delete implements functions.Catalog.

func (FunctionCatalogAdapter) GetByName added in v0.99.0

GetByName implements functions.Catalog.

func (FunctionCatalogAdapter) GetLatestPublished added in v0.99.0

GetLatestPublished implements functions.Catalog.

func (FunctionCatalogAdapter) GetRunByIdempotency added in v0.99.0

func (a FunctionCatalogAdapter) GetRunByIdempotency(ctx context.Context, name, key string) (*model.FunctionRun, error)

GetRunByIdempotency implements functions.Catalog.

func (FunctionCatalogAdapter) GetVersion added in v0.99.0

GetVersion implements functions.Catalog.

func (FunctionCatalogAdapter) ListAll added in v0.99.0

ListAll implements functions.Catalog.

func (FunctionCatalogAdapter) ListPublished added in v0.99.0

ListPublished implements functions.Catalog.

func (FunctionCatalogAdapter) ListRuns added in v0.99.0

func (a FunctionCatalogAdapter) ListRuns(ctx context.Context, name string) ([]*model.FunctionRun, error)

ListRuns implements functions.Catalog.

func (FunctionCatalogAdapter) Publish added in v0.99.0

func (a FunctionCatalogAdapter) Publish(ctx context.Context, name string, version int) (*model.FunctionDefinition, error)

Publish implements functions.Catalog.

func (FunctionCatalogAdapter) UpdateDraft added in v0.99.0

func (a FunctionCatalogAdapter) UpdateDraft(ctx context.Context, name, metadata, entrypoint, source string, version int) (*model.FunctionDefinition, error)

UpdateDraft implements functions.Catalog.

type FunctionStore added in v0.99.0

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

FunctionStore persists named function definitions, published versions, and runs.

func FunctionStoreFromDB added in v0.99.0

func FunctionStoreFromDB() *FunctionStore

FunctionStoreFromDB returns a FunctionStore using the global database client.

func NewFunctionStore added in v0.99.0

func NewFunctionStore(client *gen.Client) *FunctionStore

NewFunctionStore returns a FunctionStore backed by the given ent client.

func (*FunctionStore) Create added in v0.99.0

func (s *FunctionStore) Create(ctx context.Context, name, metadata, entrypoint, source, createdBy string) error

Create creates a new function definition in draft status at version 1 with draft fields set. createdBy is the Web UI user UID that created the function (may be empty in tests).

func (*FunctionStore) CreateDefinition added in v0.99.0

func (s *FunctionStore) CreateDefinition(ctx context.Context, name, createdBy string) error

CreateDefinition creates an empty draft definition (tests / callers that fill draft later).

func (*FunctionStore) CreateRun added in v0.99.0

func (s *FunctionStore) CreateRun(ctx context.Context, functionName string, version int, status, idempotencyKey string) (*gen.FunctionRun, error)

CreateRun inserts a new function run. Empty idempotencyKey is stored as NULL so empty keys do not collide.

func (*FunctionStore) DeleteDefinitionByName added in v0.99.0

func (s *FunctionStore) DeleteDefinitionByName(ctx context.Context, name string) (int64, error)

DeleteDefinitionByName removes a function definition, its version snapshots, and runs. Returns the number of runs deleted.

func (*FunctionStore) FunctionStats added in v0.99.0

func (s *FunctionStore) FunctionStats(ctx context.Context, name string, since time.Time, groupBy string) (*types.FunctionStats, error)

FunctionStats returns aggregated function run statistics for chart rendering. name empty = all functions. since zero = no time filter. groupBy = "day"|"week"|"month".

func (*FunctionStore) GetDefinitionByName added in v0.99.0

func (s *FunctionStore) GetDefinitionByName(ctx context.Context, name string) (*gen.FunctionDefinition, error)

GetDefinitionByName returns a function definition by name.

func (*FunctionStore) GetLatestPublished added in v0.99.0

func (s *FunctionStore) GetLatestPublished(ctx context.Context, name string) (*gen.FunctionDefinitionVersion, error)

GetLatestPublished returns the newest published version snapshot for a function name.

func (*FunctionStore) GetPublishedVersion added in v0.99.0

func (s *FunctionStore) GetPublishedVersion(ctx context.Context, name string, version int) (*gen.FunctionDefinitionVersion, error)

GetPublishedVersion returns a published version snapshot by function name and version number.

func (*FunctionStore) GetRunByIdempotencyKey added in v0.99.0

func (s *FunctionStore) GetRunByIdempotencyKey(ctx context.Context, functionName, idempotencyKey string) (*gen.FunctionRun, error)

GetRunByIdempotencyKey returns a run for the given function name and non-empty idempotency key.

func (*FunctionStore) ListAllDefinitions added in v0.99.0

func (s *FunctionStore) ListAllDefinitions(ctx context.Context) ([]*gen.FunctionDefinition, error)

ListAllDefinitions returns all function definitions ordered by name.

func (*FunctionStore) ListPublishedDefinitions added in v0.99.0

func (s *FunctionStore) ListPublishedDefinitions(ctx context.Context) ([]*gen.FunctionDefinition, error)

ListPublishedDefinitions returns published function definitions ordered by name.

func (*FunctionStore) ListRunsByName added in v0.99.0

func (s *FunctionStore) ListRunsByName(ctx context.Context, functionName string) ([]*gen.FunctionRun, error)

ListRunsByName returns recent runs for a function name, newest first.

func (*FunctionStore) PublishDefinition added in v0.99.0

func (s *FunctionStore) PublishDefinition(ctx context.Context, name string, version int) (*gen.FunctionDefinition, error)

PublishDefinition copies draft fields to published with optimistic locking and inserts a version snapshot.

func (*FunctionStore) UpdateDefinitionDraft added in v0.99.0

func (s *FunctionStore) UpdateDefinitionDraft(ctx context.Context, name, metadata, entrypoint, source string, expectedVersion int) (*gen.FunctionDefinition, error)

UpdateDefinitionDraft updates draft metadata/entrypoint/source with optimistic locking. Uses conditional UPDATE WHERE version=expectedVersion. Returns ErrConflict if no row matched.

func (*FunctionStore) UpdateRun added in v0.99.0

func (s *FunctionStore) UpdateRun(ctx context.Context, runID int64, status string, durationMs int64, exitCode *int, errMsg string, resultJSON *string) (*gen.FunctionRun, error)

UpdateRun updates status and result fields for an existing function run.

type GatewayStore added in v0.99.0

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

GatewayStore persists local-CLI gateway jobs and worker heartbeats.

func GatewayStoreFromDB added in v0.99.0

func GatewayStoreFromDB() *GatewayStore

GatewayStoreFromDB returns a GatewayStore using the global database client.

func NewGatewayStore added in v0.99.0

func NewGatewayStore(client *gen.Client) *GatewayStore

NewGatewayStore creates a GatewayStore with the given ent client.

func (*GatewayStore) Cancel added in v0.99.0

func (s *GatewayStore) Cancel(ctx context.Context, jobID string) (*types.GatewayJob, error)

Cancel marks a non-terminal job as canceled.

func (*GatewayStore) Claim added in v0.99.0

func (s *GatewayStore) Claim(ctx context.Context, workerID string, leaseTTL time.Duration) (*types.GatewayJob, error)

Claim atomically takes the oldest pending job for workerID with a lease.

func (*GatewayStore) Complete added in v0.99.0

func (s *GatewayStore) Complete(ctx context.Context, jobID string, in types.GatewayCompleteRequest, maxOutputBytes int) (*types.GatewayJob, error)

Complete writes a terminal result for a running (or already canceled) job.

func (*GatewayStore) Create added in v0.99.0

Create inserts a pending gateway job and returns its view.

func (*GatewayStore) Get added in v0.99.0

func (s *GatewayStore) Get(ctx context.Context, jobID string) (*types.GatewayJob, error)

Get returns a job by job_id, or nil when not found.

func (*GatewayStore) HasFreshWorker added in v0.99.0

func (s *GatewayStore) HasFreshWorker(ctx context.Context, staleAfter time.Duration) (bool, error)

HasFreshWorker reports whether any worker heartbeated within staleAfter.

func (*GatewayStore) ReclaimExpired added in v0.99.0

func (s *GatewayStore) ReclaimExpired(ctx context.Context) error

ReclaimExpired returns running jobs with expired leases to pending for re-claim.

func (*GatewayStore) TouchWorker added in v0.99.0

func (s *GatewayStore) TouchWorker(ctx context.Context, workerID string) error

TouchWorker upserts worker last-seen and optionally renews a running job lease.

func (*GatewayStore) TouchWorkerLease added in v0.99.0

func (s *GatewayStore) TouchWorkerLease(ctx context.Context, workerID, jobID string, leaseTTL time.Duration) error

TouchWorkerLease updates worker last-seen and renews lease for jobID when set.

type HubStore added in v0.92.0

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

HubStore persists homelab discovery data to the database.

func NewHubStore added in v0.92.0

func NewHubStore(client *gen.Client) *HubStore

NewHubStore returns a HubStore backed by the given Ent client.

func (*HubStore) ListApps added in v0.92.0

func (s *HubStore) ListApps(ctx context.Context) ([]AppInfo, error)

ListApps returns all apps from the database with Name and UpdatedAt. When the client is nil, returns nil (safe for no-DB environments).

func (*HubStore) SaveHomelabApps added in v0.92.0

func (s *HubStore) SaveHomelabApps(ctx context.Context, apps []homelab.App) error

SaveHomelabApps upserts a batch of discovered homelab apps. Existing rows are loaded once by name, new rows use CreateBulk, and updates run in one transaction. Duplicate names in the input keep the last occurrence.

type LLMUsageStore added in v0.95.0

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

func NewLLMUsageStore added in v0.95.0

func NewLLMUsageStore(client *gen.Client) *LLMUsageStore

NewLLMUsageStore returns a store backed by the given ent client.

func NewLLMUsageStoreFromDatabase added in v0.95.0

func NewLLMUsageStoreFromDatabase() *LLMUsageStore

NewLLMUsageStoreFromDatabase returns a store using the global database client.

func (*LLMUsageStore) RecordLLMUsage added in v0.95.0

func (s *LLMUsageStore) RecordLLMUsage(ctx context.Context, record *types.LLMUsageRecordInput) error

RecordLLMUsage inserts one LLM usage row.

func (*LLMUsageStore) TokenUsageStats added in v0.95.0

func (s *LLMUsageStore) TokenUsageStats(ctx context.Context, uid string, since, until time.Time, groupBy string) (*types.TokenUsageStats, error)

TokenUsageStats aggregates usage for charts filtered by user and time range.

type LifeAchievementUpsert added in v0.99.0

type LifeAchievementUpsert struct {
	Flag        string
	Name        string
	Description string
	Active      bool
	Kind        string
	QuestType   string
	Difficulty  string
	Threshold   int
	SortOrder   int
}

LifeAchievementUpsert is the seed write shape for one catalog achievement.

type LifeAdjudicationInput added in v0.99.0

type LifeAdjudicationInput struct {
	ProfileID          int64
	QuestID            int64
	Status             string
	Verdict            string
	Reason             string
	SuggestedExp       int
	SuggestedGold      int
	SuggestedNextSteps []string
	EvidenceSnapshot   []map[string]any
}

LifeAdjudicationInput is the write shape for a suggested quest ruling.

type LifeCompleteOccurrenceInput added in v0.99.0

type LifeCompleteOccurrenceInput struct {
	OccurrenceID int64
	ProfileID    int64
	PlanNodeID   int64
	Summary      string
	GainedExp    int
	GainedGold   int
	SkillID      int64
	CharID       int64
	SkillLevel   int
	SkillExp     int64
	CharLevel    int
	CharExp      int64
	ProfLevel    int
	ProfExp      int64
	ProfGold     int
}

LifeCompleteOccurrenceInput is the transaction write shape for one completed occurrence.

type LifeCompletePersist added in v0.99.0

type LifeCompletePersist struct {
	ProfileID   int64
	QuestID     int64
	SkillID     int64
	CharID      int64
	SkillLevel  int
	SkillExp    int64
	CharLevel   int
	CharExp     int64
	ProfLevel   int
	ProfExp     int64
	ProfGold    int
	Pity        map[string]int
	RustInvIDs  []int64
	DropEquipID int64 // 0 = no drop; set by ResolveLootInTx when enabled
	DropQuestID int64
	LoreStatus  string
	NeedLore    bool
	ActionExp   int
	ActionGold  int
	Dice        float64
	QuestType   string
	Difficulty  string
	// DailyRespawn clones a pending Daily quest after completion when non-nil.
	DailyRespawn *gen.LifeQuest

	// ResolveLootInTx rolls loot from the live profile pity inside the completion transaction.
	ResolveLootInTx  bool
	DropTier         string
	LootBaseChance   float64
	LootPool         []string
	ProfileBonus     float64
	EquippedDropRate float64
}

LifeCompletePersist is the write-set for an atomic quest completion.

type LifeCompleteResult added in v0.99.0

type LifeCompleteResult struct {
	Inventory     *gen.LifeInventory
	Equipment     *gen.LifeEquipment
	NewlyUnlocked []*gen.LifeAchievement
	Dice          float64
	Loot          pkglife.LootResult
}

LifeCompleteResult is returned from PersistCompleteQuest.

type LifeCreateOccurrenceInput added in v0.99.0

type LifeCreateOccurrenceInput struct {
	ProfileID          int64
	PlanNodeID         int64
	Kind               string
	State              string
	DueAt              time.Time
	CadenceSnapshot    string
	SourceOccurrenceID *int64
}

LifeCreateOccurrenceInput is the write shape for creating one action occurrence.

type LifeCreatePlanNodeInput added in v0.99.0

type LifeCreatePlanNodeInput struct {
	ProfileID             int64
	ParentID              *int64
	NodeType              string
	Title                 string
	Description           string
	Status                string
	SortOrder             int
	ActionSpec            *LifePlanActionSpecInput
	DependencyPlanNodeIDs []int64
}

LifeCreatePlanNodeInput is the write shape for creating one plan node.

type LifeEvidenceInput added in v0.99.0

type LifeEvidenceInput struct {
	ProfileID  int64
	QuestID    *int64
	SourceType string
	Content    string
	SourceURL  string
	Summary    string
}

LifeEvidenceInput is the write shape for quest evidence.

type LifeHabitCheckinInput added in v0.99.0

type LifeHabitCheckinInput struct {
	ProfileID  int64
	PlanNodeID int64
	CheckinAt  time.Time
	Status     string
	Note       string
	Summary    string
}

LifeHabitCheckinInput is the write shape for a habit check-in.

type LifePlanActionSpecInput added in v0.99.0

type LifePlanActionSpecInput struct {
	TaskType              string
	TrackingMode          string
	IsRepeatable          bool
	RepeatTrigger         string
	SuggestedCadence      string
	IsIdentityBuilding    bool
	Reason                string
	NeedsUserConfirmation bool
	Difficulty            string
	BaseExpReward         int
	BaseGoldReward        int
	ConfirmedAt           *time.Time
}

LifePlanActionSpecInput is the write shape for action metadata.

type LifeRewardCreate added in v0.99.0

type LifeRewardCreate struct {
	Name          string
	Notes         string
	Price         int
	CooldownHours int
}

LifeRewardCreate is the write-set for inserting a player reward.

type LifeSkipOccurrenceInput added in v0.99.0

type LifeSkipOccurrenceInput struct {
	OccurrenceID int64
	State        string
}

LifeSkipOccurrenceInput is the write shape for skipping one occurrence.

type LifeStore added in v0.99.0

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

LifeStore persists Life domain entities.

func LifeStoreFromDB added in v0.99.0

func LifeStoreFromDB() *LifeStore

LifeStoreFromDB returns a LifeStore using the global database client.

func NewLifeStore added in v0.99.0

func NewLifeStore(client *gen.Client) *LifeStore

NewLifeStore creates a LifeStore with the given ent client.

func (*LifeStore) AppendLoreOutbox added in v0.99.0

func (s *LifeStore) AppendLoreOutbox(ctx context.Context, profileID, inventoryID int64) (string, error)

AppendLoreOutbox writes an unpublished outbox row for lore generation.

func (*LifeStore) ClearGoalAreaRefs added in v0.99.0

func (s *LifeStore) ClearGoalAreaRefs(ctx context.Context, areaID int64) error

ClearGoalAreaRefs clears area_id on goals that point at the given Area goal id.

func (*LifeStore) Client added in v0.99.0

func (s *LifeStore) Client() *gen.Client

Client returns the underlying ent client for transactional use-cases.

func (*LifeStore) CompleteActionOccurrence added in v0.99.0

func (s *LifeStore) CompleteActionOccurrence(ctx context.Context, in LifeCompleteOccurrenceInput) error

CompleteActionOccurrence completes one occurrence and writes an action log.

func (*LifeStore) ConfirmHabitAction added in v0.99.0

func (s *LifeStore) ConfirmHabitAction(ctx context.Context, planNodeID int64) (*gen.LifeActionSpec, error)

ConfirmHabitAction promotes a habit candidate to a confirmed habit.

func (*LifeStore) CreateActionLog added in v0.99.0

func (s *LifeStore) CreateActionLog(ctx context.Context, profileID, questID int64, exp, gold int, invID *int64, dice *float64) (*gen.LifeActionLog, error)

CreateActionLog inserts an action log row.

func (*LifeStore) CreateActionOccurrence added in v0.99.0

func (s *LifeStore) CreateActionOccurrence(ctx context.Context, in LifeCreateOccurrenceInput) (*gen.LifeActionOccurrence, error)

CreateActionOccurrence inserts one occurrence row.

func (*LifeStore) CreateAdjudication added in v0.99.0

func (s *LifeStore) CreateAdjudication(ctx context.Context, in LifeAdjudicationInput) (*gen.LifeAdjudication, error)

CreateAdjudication inserts one suggested quest ruling.

func (*LifeStore) CreateCharacteristic added in v0.99.0

func (s *LifeStore) CreateCharacteristic(ctx context.Context, profileID int64, code, name string) (*gen.LifeCharacteristic, error)

CreateCharacteristic inserts a characteristic row.

func (*LifeStore) CreateEvidence added in v0.99.0

func (s *LifeStore) CreateEvidence(ctx context.Context, in LifeEvidenceInput) (*gen.LifeEvidence, error)

CreateEvidence inserts one quest evidence row.

func (*LifeStore) CreateGoal added in v0.99.0

func (s *LifeStore) CreateGoal(ctx context.Context, profileID int64, title, category string, areaID *int64) (*gen.LifeGoal, error)

CreateGoal inserts an active PARA goal. areaID is optional parent Area for Project/Resource.

func (*LifeStore) CreateInventory added in v0.99.0

func (s *LifeStore) CreateInventory(ctx context.Context, profileID, equipmentID int64, questID *int64, loreStatus string) (*gen.LifeInventory, error)

CreateInventory inserts an inventory instance.

func (*LifeStore) CreatePlanNode added in v0.99.0

CreatePlanNode inserts one life plan node and its action spec when needed.

func (*LifeStore) CreateProfile added in v0.99.0

func (s *LifeStore) CreateProfile(ctx context.Context, userID, nickname, classType string) (*gen.LifeProfile, error)

CreateProfile inserts a new life profile.

func (*LifeStore) CreateQuest added in v0.99.0

func (s *LifeStore) CreateQuest(ctx context.Context, q *gen.LifeQuest) (*gen.LifeQuest, error)

CreateQuest inserts a quest.

func (*LifeStore) CreateReward added in v0.99.0

func (s *LifeStore) CreateReward(ctx context.Context, profileID int64, in LifeRewardCreate) (*gen.LifeReward, error)

CreateReward inserts an active player-defined reward.

func (*LifeStore) CreateRewardRedemption added in v0.99.0

func (s *LifeStore) CreateRewardRedemption(ctx context.Context, profileID, rewardID int64, rewardName string, pricePaid int, at time.Time) (*gen.LifeRewardRedemption, error)

CreateRewardRedemption inserts one redemption audit row with price/name snapshots.

func (*LifeStore) CreateSkill added in v0.99.0

func (s *LifeStore) CreateSkill(ctx context.Context, profileID, characteristicID int64, name string, ratio float64) (*gen.LifeSkill, error)

CreateSkill inserts a skill.

func (*LifeStore) DeactivateAchievementsNotInFlags added in v0.99.0

func (s *LifeStore) DeactivateAchievementsNotInFlags(ctx context.Context, keepFlags []string) error

DeactivateAchievementsNotInFlags sets active=false for catalog rows whose flag is not listed.

func (*LifeStore) DeleteGoal added in v0.99.0

func (s *LifeStore) DeleteGoal(ctx context.Context, id int64) error

DeleteGoal removes a goal row.

func (*LifeStore) DeletePlanNode added in v0.99.0

func (s *LifeStore) DeletePlanNode(ctx context.Context, profileID, id int64) error

DeletePlanNode removes one plan node and its descendants.

func (*LifeStore) EnsureAIContext added in v0.99.0

func (s *LifeStore) EnsureAIContext(ctx context.Context, profileID int64) error

EnsureAIContext creates AI context if missing.

func (*LifeStore) EnsureEquippedSlots added in v0.99.0

func (s *LifeStore) EnsureEquippedSlots(ctx context.Context, profileID int64) (*gen.LifeEquippedSlots, error)

EnsureEquippedSlots creates empty slots row if missing.

func (*LifeStore) EnsureRecurringOccurrences added in v0.99.0

func (s *LifeStore) EnsureRecurringOccurrences(ctx context.Context, profileID int64, now time.Time) error

EnsureRecurringOccurrences lazily creates due daily/weekly occurrences.

func (*LifeStore) EnsureTodoOccurrence added in v0.99.0

func (s *LifeStore) EnsureTodoOccurrence(ctx context.Context, profileID, planNodeID int64) (*gen.LifeActionOccurrence, error)

EnsureTodoOccurrence creates a pending one-time occurrence if missing.

func (*LifeStore) GetAIContext added in v0.99.0

func (s *LifeStore) GetAIContext(ctx context.Context, profileID int64) (*gen.LifeAIContext, error)

GetAIContext returns the AI context row for a profile.

func (*LifeStore) GetActionOccurrenceByFlag added in v0.99.0

func (s *LifeStore) GetActionOccurrenceByFlag(ctx context.Context, profileID int64, flag string) (*gen.LifeActionOccurrence, error)

GetActionOccurrenceByFlag returns one occurrence by flag scoped to profile.

func (*LifeStore) GetActionSpecByPlanNodeID added in v0.99.0

func (s *LifeStore) GetActionSpecByPlanNodeID(ctx context.Context, planNodeID int64) (*gen.LifeActionSpec, error)

GetActionSpecByPlanNodeID returns one action spec by plan node id.

func (*LifeStore) GetAdjudicationByFlag added in v0.99.0

func (s *LifeStore) GetAdjudicationByFlag(ctx context.Context, profileID int64, flag string) (*gen.LifeAdjudication, error)

GetAdjudicationByFlag returns a quest ruling by flag scoped to profile.

func (*LifeStore) GetCharacteristic added in v0.99.0

func (s *LifeStore) GetCharacteristic(ctx context.Context, id int64) (*gen.LifeCharacteristic, error)

GetCharacteristic returns one characteristic by id.

func (*LifeStore) GetEquipment added in v0.99.0

func (s *LifeStore) GetEquipment(ctx context.Context, id int64) (*gen.LifeEquipment, error)

GetEquipment returns equipment by id.

func (*LifeStore) GetEquipmentByFlag added in v0.99.0

func (s *LifeStore) GetEquipmentByFlag(ctx context.Context, flag string) (*gen.LifeEquipment, error)

GetEquipmentByFlag returns equipment by flag.

func (*LifeStore) GetEquippedSlots added in v0.99.0

func (s *LifeStore) GetEquippedSlots(ctx context.Context, profileID int64) (*gen.LifeEquippedSlots, error)

GetEquippedSlots returns equipped slots for a profile.

func (*LifeStore) GetGoalByFlag added in v0.99.0

func (s *LifeStore) GetGoalByFlag(ctx context.Context, profileID int64, flag string) (*gen.LifeGoal, error)

GetGoalByFlag returns a goal by flag for a profile.

func (*LifeStore) GetInventory added in v0.99.0

func (s *LifeStore) GetInventory(ctx context.Context, id int64) (*gen.LifeInventory, error)

GetInventory returns inventory by id.

func (*LifeStore) GetInventoryByFlag added in v0.99.0

func (s *LifeStore) GetInventoryByFlag(ctx context.Context, profileID int64, flag string) (*gen.LifeInventory, error)

GetInventoryByFlag returns inventory by flag scoped to profile.

func (*LifeStore) GetLatestAdjudicationByQuest added in v0.99.0

func (s *LifeStore) GetLatestAdjudicationByQuest(ctx context.Context, profileID, questID int64) (*gen.LifeAdjudication, error)

GetLatestAdjudicationByQuest returns the newest ruling for one quest.

func (*LifeStore) GetLootTable added in v0.99.0

func (s *LifeStore) GetLootTable(ctx context.Context, tier string) (*gen.LifeLootTable, error)

GetLootTable returns loot table by tier.

func (*LifeStore) GetPlanNode added in v0.99.0

func (s *LifeStore) GetPlanNode(ctx context.Context, id int64) (*gen.LifePlanNode, error)

GetPlanNode fetches a plan node by id.

func (*LifeStore) GetPlanNodeByFlag added in v0.99.0

func (s *LifeStore) GetPlanNodeByFlag(ctx context.Context, profileID int64, flag string) (*gen.LifePlanNode, error)

GetPlanNodeByFlag returns one plan node scoped to profile.

func (*LifeStore) GetProfileByID added in v0.99.0

func (s *LifeStore) GetProfileByID(ctx context.Context, id int64) (*gen.LifeProfile, error)

GetProfileByID returns a profile by primary key.

func (*LifeStore) GetProfileByUserID added in v0.99.0

func (s *LifeStore) GetProfileByUserID(ctx context.Context, userID string) (*gen.LifeProfile, error)

GetProfileByUserID returns the life profile for a platform user id.

func (*LifeStore) GetQuest added in v0.99.0

func (s *LifeStore) GetQuest(ctx context.Context, id int64) (*gen.LifeQuest, error)

GetQuest returns a quest by id.

func (*LifeStore) GetQuestByFlag added in v0.99.0

func (s *LifeStore) GetQuestByFlag(ctx context.Context, profileID int64, flag string) (*gen.LifeQuest, error)

GetQuestByFlag returns a quest by flag scoped to profile.

func (*LifeStore) GetRewardByFlag added in v0.99.0

func (s *LifeStore) GetRewardByFlag(ctx context.Context, profileID int64, flag string) (*gen.LifeReward, error)

GetRewardByFlag returns a reward by flag for a profile.

func (*LifeStore) GetSkill added in v0.99.0

func (s *LifeStore) GetSkill(ctx context.Context, id int64) (*gen.LifeSkill, error)

GetSkill returns a skill by id.

func (*LifeStore) GetSkillByName added in v0.99.0

func (s *LifeStore) GetSkillByName(ctx context.Context, profileID int64, name string) (*gen.LifeSkill, error)

GetSkillByName returns a skill by profile + name.

func (*LifeStore) ListAchievementProgress added in v0.99.0

func (s *LifeStore) ListAchievementProgress(ctx context.Context, profileID int64) ([]*gen.LifeAchievementProgress, error)

ListAchievementProgress returns progress rows for a profile.

func (*LifeStore) ListAchievementUnlocks added in v0.99.0

func (s *LifeStore) ListAchievementUnlocks(ctx context.Context, profileID int64) ([]*gen.LifeAchievementUnlock, error)

ListAchievementUnlocks returns unlock rows for a profile.

func (*LifeStore) ListAchievementUnlocksInRange added in v0.99.0

func (s *LifeStore) ListAchievementUnlocksInRange(ctx context.Context, profileID int64, since, until time.Time) ([]*gen.LifeAchievementUnlock, error)

ListAchievementUnlocksInRange returns unlocks with unlocked_at in [since, until).

func (*LifeStore) ListAchievements added in v0.99.0

func (s *LifeStore) ListAchievements(ctx context.Context) ([]*gen.LifeAchievement, error)

ListAchievements returns the achievement catalog ordered by sort_order.

func (*LifeStore) ListActionLogs added in v0.99.0

func (s *LifeStore) ListActionLogs(ctx context.Context, profileID int64, limit int) ([]*gen.LifeActionLog, error)

ListActionLogs returns recent action logs.

func (*LifeStore) ListActionLogsInRange added in v0.99.0

func (s *LifeStore) ListActionLogsInRange(ctx context.Context, profileID int64, since, until time.Time) ([]*gen.LifeActionLog, error)

ListActionLogsInRange returns action logs with created_at in [since, until).

func (*LifeStore) ListActionLogsPage added in v0.99.0

func (s *LifeStore) ListActionLogsPage(ctx context.Context, profileID int64, limit, offset int) ([]*gen.LifeActionLog, int, error)

ListActionLogsPage returns a page of action logs and the total count. A non-positive limit returns all matching rows (offset ignored).

func (*LifeStore) ListActionOccurrences added in v0.99.0

func (s *LifeStore) ListActionOccurrences(ctx context.Context, profileID int64, state string) ([]*gen.LifeActionOccurrence, error)

ListActionOccurrences returns occurrences for a profile, optional state filter.

func (*LifeStore) ListActionSpecs added in v0.99.0

func (s *LifeStore) ListActionSpecs(ctx context.Context, profileID int64) ([]*gen.LifeActionSpec, error)

ListActionSpecs returns all action specs keyed by plan node id.

func (*LifeStore) ListCharacteristics added in v0.99.0

func (s *LifeStore) ListCharacteristics(ctx context.Context, profileID int64) ([]*gen.LifeCharacteristic, error)

ListCharacteristics returns characteristics for a profile.

func (*LifeStore) ListEvidenceByQuest added in v0.99.0

func (s *LifeStore) ListEvidenceByQuest(ctx context.Context, profileID, questID int64) ([]*gen.LifeEvidence, error)

ListEvidenceByQuest returns recent evidence rows for one quest.

func (*LifeStore) ListEvidenceByQuestIDs added in v0.99.0

func (s *LifeStore) ListEvidenceByQuestIDs(ctx context.Context, profileID int64, questIDs []int64) ([]*gen.LifeEvidence, error)

ListEvidenceByQuestIDs returns evidence for many quests, newest first overall. Callers group by QuestID.

func (*LifeStore) ListGoals added in v0.99.0

func (s *LifeStore) ListGoals(ctx context.Context, profileID int64, status string) ([]*gen.LifeGoal, error)

ListGoals returns goals for a profile, optional status filter.

func (*LifeStore) ListHabitCheckins added in v0.99.0

func (s *LifeStore) ListHabitCheckins(ctx context.Context, profileID, planNodeID int64, from, to time.Time) ([]*gen.LifeHabitCheckin, error)

ListHabitCheckins returns habit checkins for a node in a time window.

func (*LifeStore) ListInventory added in v0.99.0

func (s *LifeStore) ListInventory(ctx context.Context, profileID int64) ([]*gen.LifeInventory, error)

ListInventory lists inventory for a profile.

func (*LifeStore) ListInventoryPage added in v0.99.0

func (s *LifeStore) ListInventoryPage(ctx context.Context, profileID int64, limit, offset int) ([]*gen.LifeInventory, int, error)

ListInventoryPage returns a page of inventory rows and the total count. A non-positive limit returns all matching rows (offset ignored).

func (*LifeStore) ListPendingLoreOutbox added in v0.99.0

func (s *LifeStore) ListPendingLoreOutbox(ctx context.Context, limit int) ([]*gen.EventOutbox, error)

ListPendingLoreOutbox returns unpublished lore outbox rows.

func (*LifeStore) ListPlanNodes added in v0.99.0

func (s *LifeStore) ListPlanNodes(ctx context.Context, profileID int64) ([]*gen.LifePlanNode, error)

ListPlanNodes returns plan nodes for one profile in stable tree order.

func (*LifeStore) ListQuests added in v0.99.0

func (s *LifeStore) ListQuests(ctx context.Context, profileID int64, status string) ([]*gen.LifeQuest, error)

ListQuests lists quests for a profile, optional status filter.

func (*LifeStore) ListQuestsByIDs added in v0.99.0

func (s *LifeStore) ListQuestsByIDs(ctx context.Context, profileID int64, ids []int64) ([]*gen.LifeQuest, error)

ListQuestsByIDs returns quests for the given ids scoped to a profile.

func (*LifeStore) ListQuestsCompletedInRange added in v0.99.0

func (s *LifeStore) ListQuestsCompletedInRange(ctx context.Context, profileID int64, since, until time.Time) ([]*gen.LifeQuest, error)

ListQuestsCompletedInRange returns Completed quests with completed_at in [since, until).

func (*LifeStore) ListQuestsPage added in v0.99.0

func (s *LifeStore) ListQuestsPage(ctx context.Context, profileID int64, status string, limit, offset int) ([]*gen.LifeQuest, int, error)

ListQuestsPage returns a page of quests and the total matching count. Completed quests are ordered by completed_at descending; others by created_at descending. A non-positive limit returns all matching rows (offset ignored).

func (*LifeStore) ListRecurringActionSpecs added in v0.99.0

func (s *LifeStore) ListRecurringActionSpecs(ctx context.Context, profileID int64) ([]*gen.LifeActionSpec, map[int64]*gen.LifePlanNode, error)

ListRecurringActionSpecs returns active recurring specs and their nodes.

func (*LifeStore) ListRewardRedemptions added in v0.99.0

func (s *LifeStore) ListRewardRedemptions(ctx context.Context, profileID int64, limit int) ([]*gen.LifeRewardRedemption, error)

ListRewardRedemptions returns recent redemptions newest first.

func (*LifeStore) ListRewardRedemptionsInRange added in v0.99.0

func (s *LifeStore) ListRewardRedemptionsInRange(ctx context.Context, profileID int64, since, until time.Time) ([]*gen.LifeRewardRedemption, error)

ListRewardRedemptionsInRange returns redemptions with redeemed_at in [since, until).

func (*LifeStore) ListRewardRedemptionsPage added in v0.99.0

func (s *LifeStore) ListRewardRedemptionsPage(ctx context.Context, profileID int64, limit, offset int) ([]*gen.LifeRewardRedemption, int, error)

ListRewardRedemptionsPage returns a page of redemptions and the total count. A non-positive limit returns all matching rows (offset ignored).

func (*LifeStore) ListRewards added in v0.99.0

func (s *LifeStore) ListRewards(ctx context.Context, profileID int64, activeOnly *bool) ([]*gen.LifeReward, error)

ListRewards lists rewards for a profile, newest first. When activeOnly is non-nil, filters by active status.

func (*LifeStore) ListRewardsPage added in v0.99.0

func (s *LifeStore) ListRewardsPage(ctx context.Context, profileID int64, activeOnly *bool, limit, offset int) ([]*gen.LifeReward, int, error)

ListRewardsPage returns a page of rewards and the total matching count. A non-positive limit returns all matching rows (offset ignored).

func (*LifeStore) ListSkills added in v0.99.0

func (s *LifeStore) ListSkills(ctx context.Context, profileID int64) ([]*gen.LifeSkill, error)

ListSkills returns skills for a profile.

func (*LifeStore) MapEquipmentByIDs added in v0.99.0

func (s *LifeStore) MapEquipmentByIDs(ctx context.Context, ids []int64) (map[int64]*gen.LifeEquipment, error)

MapEquipmentByIDs returns equipment templates keyed by id.

func (*LifeStore) MapInventoryByIDs added in v0.99.0

func (s *LifeStore) MapInventoryByIDs(ctx context.Context, ids []int64) (map[int64]*gen.LifeInventory, error)

MapInventoryByIDs returns inventory rows keyed by id.

func (*LifeStore) MapLatestAdjudicationsByQuestIDs added in v0.99.0

func (s *LifeStore) MapLatestAdjudicationsByQuestIDs(ctx context.Context, profileID int64, questIDs []int64) (map[int64]*gen.LifeAdjudication, error)

MapLatestAdjudicationsByQuestIDs returns the newest ruling per quest id.

func (*LifeStore) MapLootTablesByTiers added in v0.99.0

func (s *LifeStore) MapLootTablesByTiers(ctx context.Context, tiers []string) (map[string]*gen.LifeLootTable, error)

MapLootTablesByTiers returns loot tables keyed by drop tier.

func (*LifeStore) MarkAdjudicationApplied added in v0.99.0

func (s *LifeStore) MarkAdjudicationApplied(ctx context.Context, id int64) error

MarkAdjudicationApplied records that the ruling was accepted.

func (*LifeStore) MarkOutboxPublished added in v0.99.0

func (s *LifeStore) MarkOutboxPublished(ctx context.Context, eventID string) error

MarkOutboxPublished marks an outbox event published.

func (*LifeStore) MarkQuestCompleted added in v0.99.0

func (s *LifeStore) MarkQuestCompleted(ctx context.Context, id int64) error

MarkQuestCompleted sets status Completed.

func (*LifeStore) MarkQuestStatus added in v0.99.0

func (s *LifeStore) MarkQuestStatus(ctx context.Context, id int64, status string) error

MarkQuestStatus sets quest status and completed_at when Completed.

func (*LifeStore) MarkRewardRedeemed added in v0.99.0

func (s *LifeStore) MarkRewardRedeemed(ctx context.Context, id int64, at time.Time) error

MarkRewardRedeemed updates last_redeemed_at after a successful redeem.

func (*LifeStore) PersistCompleteQuest added in v0.99.0

func (s *LifeStore) PersistCompleteQuest(ctx context.Context, in LifeCompletePersist) (*LifeCompleteResult, error)

PersistCompleteQuest applies cascade, loot inventory, action log, and rust clear in one transaction.

func (*LifeStore) PersistFailQuest added in v0.99.0

func (s *LifeStore) PersistFailQuest(ctx context.Context, profileID, questID int64, rustInvIDs []int64, until time.Time) error

PersistFailQuest marks a quest failed and applies rust in one transaction.

func (*LifeStore) SetEquippedSlot added in v0.99.0

func (s *LifeStore) SetEquippedSlot(ctx context.Context, profileID int64, slotField string, inventoryID *int64) error

SetEquippedSlot writes one slot inventory id (nil clears).

func (*LifeStore) SetEquippedSlotsTarnishedUntil added in v0.99.0

func (s *LifeStore) SetEquippedSlotsTarnishedUntil(ctx context.Context, profileID int64, until *time.Time) error

SetEquippedSlotsTarnishedUntil sets or clears rust on equipped slots.

func (*LifeStore) SetInventoryTarnishedUntil added in v0.99.0

func (s *LifeStore) SetInventoryTarnishedUntil(ctx context.Context, id int64, until *time.Time) error

SetInventoryTarnishedUntil sets or clears rust on an inventory row.

func (*LifeStore) SetProfileGold added in v0.99.0

func (s *LifeStore) SetProfileGold(ctx context.Context, id int64, gold int) error

SetProfileGold sets absolute gold balance on a profile.

func (*LifeStore) SetRewardActive added in v0.99.0

func (s *LifeStore) SetRewardActive(ctx context.Context, id int64, active bool) error

SetRewardActive soft-deletes or restores a reward.

func (*LifeStore) SkipActionOccurrence added in v0.99.0

func (s *LifeStore) SkipActionOccurrence(ctx context.Context, in LifeSkipOccurrenceInput) error

SkipActionOccurrence marks one occurrence skipped or missed.

func (*LifeStore) UpdateAIContext added in v0.99.0

func (s *LifeStore) UpdateAIContext(ctx context.Context, profileID int64, rate float64, mood map[string]any, personality string) error

UpdateAIContext writes completion rate, mood, and personality.

func (*LifeStore) UpdateCharacteristicStats added in v0.99.0

func (s *LifeStore) UpdateCharacteristicStats(ctx context.Context, id int64, level int, exp int64) error

UpdateCharacteristicStats updates level/exp.

func (*LifeStore) UpdateGoal added in v0.99.0

func (s *LifeStore) UpdateGoal(ctx context.Context, id int64, title, category string, areaID *int64) error

UpdateGoal updates title, category, and optional Area parent for a goal. A nil areaID clears the parent link.

func (*LifeStore) UpdateGoalStatus added in v0.99.0

func (s *LifeStore) UpdateGoalStatus(ctx context.Context, id int64, status string) error

UpdateGoalStatus sets goal status (Active / Paused / Completed).

func (*LifeStore) UpdateInventoryLore added in v0.99.0

func (s *LifeStore) UpdateInventoryLore(ctx context.Context, id int64, name, lore, status string) error

UpdateInventoryLore sets instance lore fields and status.

func (*LifeStore) UpdateInventoryLoreStatus added in v0.99.0

func (s *LifeStore) UpdateInventoryLoreStatus(ctx context.Context, id int64, status string) error

UpdateInventoryLoreStatus sets only lore_status (keeps instance name/lore).

func (*LifeStore) UpdatePlanNode added in v0.99.0

func (s *LifeStore) UpdatePlanNode(ctx context.Context, id int64, title, description, status string, sortOrder int) error

UpdatePlanNode edits mutable fields on one plan node.

func (*LifeStore) UpdateProfileClass added in v0.99.0

func (s *LifeStore) UpdateProfileClass(ctx context.Context, id int64, classType string) error

UpdateProfileClass sets class_type.

func (*LifeStore) UpdateProfileStats added in v0.99.0

func (s *LifeStore) UpdateProfileStats(ctx context.Context, id int64, level int, exp int64, gold int, pity map[string]int) error

UpdateProfileStats updates level/exp/gold/pity on a profile.

func (*LifeStore) UpdateReward added in v0.99.0

func (s *LifeStore) UpdateReward(ctx context.Context, id int64, in LifeRewardCreate) error

UpdateReward updates mutable catalog fields for a reward.

func (*LifeStore) UpdateSkillStats added in v0.99.0

func (s *LifeStore) UpdateSkillStats(ctx context.Context, id int64, level int, exp int64) error

UpdateSkillStats updates skill level/exp.

func (*LifeStore) UpsertAchievement added in v0.99.0

func (s *LifeStore) UpsertAchievement(ctx context.Context, in LifeAchievementUpsert) error

UpsertAchievement inserts or updates a catalog achievement by flag.

func (*LifeStore) UpsertEquipment added in v0.99.0

func (s *LifeStore) UpsertEquipment(ctx context.Context, flag, name, rarity, slotType, lore string, buffs, priv map[string]any) (*gen.LifeEquipment, error)

UpsertEquipment creates equipment if flag missing.

func (*LifeStore) UpsertHabitCheckin added in v0.99.0

func (s *LifeStore) UpsertHabitCheckin(ctx context.Context, in LifeHabitCheckinInput) (*gen.LifeHabitCheckin, error)

UpsertHabitCheckin creates or refreshes a daily habit checkin and writes an action log.

func (*LifeStore) UpsertLootTable added in v0.99.0

func (s *LifeStore) UpsertLootTable(ctx context.Context, tier string, chance float64, pool []string) error

UpsertLootTable creates or updates a loot table by tier.

func (*LifeStore) WithTx added in v0.99.0

func (s *LifeStore) WithTx(ctx context.Context, fn func(*LifeStore) error) error

WithTx runs a callback inside one ent transaction.

type ListChatScheduledTasksOptions added in v0.94.0

type ListChatScheduledTasksOptions struct {
	UID    string
	States []string
}

ListChatScheduledTasksOptions filters scheduled task queries.

type ListChatSessionsOptions added in v0.93.0

type ListChatSessionsOptions struct {
	Limit  int    // max 100, default 20
	Cursor string // opaque cursor: session ID value as string
	UID    string // when set, only sessions owned by this user are returned
	State  *int   // when set, only sessions in this state are returned
	// Archived filters by archive flag; nil means any.
	Archived *bool
	// PinnedFirst sorts pinned sessions ahead of unpinned ones.
	PinnedFirst bool
	// Flags restricts results to the given session flags when non-empty.
	Flags []string
}

ListChatSessionsOptions holds pagination for listing chat agent sessions.

type ListConfigOptions added in v0.92.0

type ListConfigOptions struct {
	Offset int
	Limit  int
	Search string
}

ListConfigOptions controls pagination and search for ListConfigs.

type ListDataEventsOptions added in v0.92.0

type ListDataEventsOptions struct {
	Limit        int        // max 100, default 20
	Offset       int        // page offset for offset-based pagination
	Cursor       string     // opaque CreatedAt cursor (backward compatible)
	Source       string     // filter by source, empty = all
	EventType    string     // filter by event type, empty = all
	Webhook      bool       // if true, only events where data->>'_webhook_method' IS NOT NULL
	Search       string     // ILIKE match against source and data::text
	PipelineName string     // filter events that triggered a specific pipeline
	TimeStart    *time.Time // created_at >= TimeStart
	TimeEnd      *time.Time // created_at <= TimeEnd
}

ListDataEventsOptions holds filters and pagination for listing data events.

type ListNotifyChannelOptions added in v0.92.0

type ListNotifyChannelOptions struct {
	Protocol string
	Enabled  *bool // nil = all, true = enabled only, false = disabled only
}

ListNotifyChannelOptions holds filtering options for listing notification channels.

type ListNotifyRecordsOptions added in v0.92.0

type ListNotifyRecordsOptions = notify.ListNotifyRecordsOptions

ListNotifyRecordsOptions is an alias of notify.ListNotifyRecordsOptions.

type ListNotifyRuleOptions added in v0.92.0

type ListNotifyRuleOptions struct {
	Enabled *bool // nil = all, true = enabled only, false = disabled only
}

ListNotifyRuleOptions holds filtering and sorting options for listing notification rules.

type ListNotifyTemplateOptions added in v0.97.0

type ListNotifyTemplateOptions struct{}

ListNotifyTemplateOptions holds filtering options for listing notification templates.

type MessageStore added in v0.99.0

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

MessageStore persists chat messages.

func MessageStoreFromDB added in v0.99.0

func MessageStoreFromDB() *MessageStore

MessageStoreFromDB returns a MessageStore using the global database client.

func NewMessageStore added in v0.99.0

func NewMessageStore(client *gen.Client) *MessageStore

NewMessageStore creates a MessageStore with the given ent client.

func (*MessageStore) Client added in v0.99.0

func (s *MessageStore) Client() *gen.Client

Client returns the underlying ent client.

func (*MessageStore) CreateMessage added in v0.99.0

func (s *MessageStore) CreateMessage(ctx context.Context, msg gen.Message) error

CreateMessage persists a new message.

func (*MessageStore) GetMessage added in v0.99.0

func (s *MessageStore) GetMessage(ctx context.Context, flag string) (*gen.Message, error)

GetMessage returns the message.

func (*MessageStore) GetMessageByPlatform added in v0.99.0

func (s *MessageStore) GetMessageByPlatform(ctx context.Context, platformId int64, platformMsgId string) (*gen.Message, error)

GetMessageByPlatform returns the message by platform.

func (*MessageStore) GetMessagesBySession added in v0.99.0

func (s *MessageStore) GetMessagesBySession(ctx context.Context, session string) ([]*gen.Message, error)

GetMessagesBySession returns the messages by session.

type ModuleDataStore added in v0.99.0

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

ModuleDataStore persists module KV data, config, OAuth, forms, pages, behaviors, parameters, instructs, and counters.

func ModuleDataStoreFromDB added in v0.99.0

func ModuleDataStoreFromDB() *ModuleDataStore

ModuleDataStoreFromDB returns a ModuleDataStore using the global database client.

func NewModuleDataStore added in v0.99.0

func NewModuleDataStore(client *gen.Client) *ModuleDataStore

NewModuleDataStore creates a ModuleDataStore with the given ent client.

func (*ModuleDataStore) BehaviorGet added in v0.99.0

func (s *ModuleDataStore) BehaviorGet(ctx context.Context, uid types.Uid, flag string) (gen.Behavior, error)

BehaviorGet get behavior records.

func (*ModuleDataStore) BehaviorIncrease added in v0.99.0

func (s *ModuleDataStore) BehaviorIncrease(ctx context.Context, uid types.Uid, flag string, number int) error

BehaviorIncrease increase behavior records.

func (*ModuleDataStore) BehaviorList added in v0.99.0

func (s *ModuleDataStore) BehaviorList(ctx context.Context, uid types.Uid) ([]*gen.Behavior, error)

BehaviorList list behavior records.

func (*ModuleDataStore) BehaviorSet added in v0.99.0

func (s *ModuleDataStore) BehaviorSet(ctx context.Context, behaviorModel gen.Behavior) error

BehaviorSet set behavior records.

func (*ModuleDataStore) Client added in v0.99.0

func (s *ModuleDataStore) Client() *gen.Client

Client returns the underlying ent client.

func (*ModuleDataStore) ConfigDelete added in v0.99.0

func (s *ModuleDataStore) ConfigDelete(ctx context.Context, uid types.Uid, topic, key string) error

ConfigDelete delete config data.

func (*ModuleDataStore) ConfigGet added in v0.99.0

func (s *ModuleDataStore) ConfigGet(ctx context.Context, uid types.Uid, topic, key string) (types.KV, error)

ConfigGet get config data.

func (*ModuleDataStore) ConfigSet added in v0.99.0

func (s *ModuleDataStore) ConfigSet(ctx context.Context, uid types.Uid, topic, key string, value types.KV) error

ConfigSet set config data.

func (*ModuleDataStore) CreateCounter added in v0.99.0

func (s *ModuleDataStore) CreateCounter(ctx context.Context, counterModel *gen.Counter) (int64, error)

CreateCounter persists a new counter.

func (*ModuleDataStore) CreateInstruct added in v0.99.0

func (s *ModuleDataStore) CreateInstruct(ctx context.Context, instructModel *gen.Instruct) (int64, error)

CreateInstruct persists a new instruct.

func (*ModuleDataStore) CreateToken added in v0.99.0

func (s *ModuleDataStore) CreateToken(ctx context.Context, uid types.Uid, expiresAt time.Time, scopes []string) (string, error)

CreateToken persists a new token.

func (*ModuleDataStore) DataDelete added in v0.99.0

func (s *ModuleDataStore) DataDelete(ctx context.Context, uid types.Uid, topic, key string) error

DataDelete delete module data.

func (*ModuleDataStore) DataGet added in v0.99.0

func (s *ModuleDataStore) DataGet(ctx context.Context, uid types.Uid, topic, key string) (types.KV, error)

DataGet get module data.

func (*ModuleDataStore) DataList added in v0.99.0

func (s *ModuleDataStore) DataList(ctx context.Context, uid types.Uid, topic string, filter types.DataFilter) ([]*gen.Data, error)

DataList list module data.

func (*ModuleDataStore) DataSet added in v0.99.0

func (s *ModuleDataStore) DataSet(ctx context.Context, uid types.Uid, topic, key string, value types.KV) error

DataSet set module data.

func (*ModuleDataStore) DecreaseCounter added in v0.99.0

func (s *ModuleDataStore) DecreaseCounter(ctx context.Context, id, amount int64) error

DecreaseCounter decreases the counter.

func (*ModuleDataStore) FormGet added in v0.99.0

func (s *ModuleDataStore) FormGet(ctx context.Context, formId string) (gen.Form, error)

FormGet get a form.

func (*ModuleDataStore) FormSet added in v0.99.0

func (s *ModuleDataStore) FormSet(ctx context.Context, formId string, formModel gen.Form) error

FormSet set a form.

func (*ModuleDataStore) GetCounter added in v0.99.0

func (s *ModuleDataStore) GetCounter(ctx context.Context, id int64) (gen.Counter, error)

GetCounter returns the counter.

func (*ModuleDataStore) GetCounterByFlag added in v0.99.0

func (s *ModuleDataStore) GetCounterByFlag(ctx context.Context, uid types.Uid, topic, flag string) (gen.Counter, error)

GetCounterByFlag returns the counter by flag.

func (*ModuleDataStore) IncreaseCounter added in v0.99.0

func (s *ModuleDataStore) IncreaseCounter(ctx context.Context, id, amount int64) error

IncreaseCounter increases the counter.

func (*ModuleDataStore) ListConfigByPrefix added in v0.99.0

func (s *ModuleDataStore) ListConfigByPrefix(ctx context.Context, uid types.Uid, topic, prefix string) ([]*gen.ConfigData, error)

ListConfigByPrefix returns config by prefix.

func (*ModuleDataStore) ListConfigs added in v0.99.0

func (s *ModuleDataStore) ListConfigs(ctx context.Context, opts ListConfigOptions) ([]model.ConfigItem, error)

ListConfigs returns configs.

func (*ModuleDataStore) ListCounter added in v0.99.0

func (s *ModuleDataStore) ListCounter(ctx context.Context, uid types.Uid, topic string) ([]*gen.Counter, error)

ListCounter returns counter.

func (*ModuleDataStore) ListInstruct added in v0.99.0

func (s *ModuleDataStore) ListInstruct(ctx context.Context, uid types.Uid, isExpire bool, limit int) ([]*gen.Instruct, error)

ListInstruct returns instruct.

func (*ModuleDataStore) ListTokens added in v0.99.0

func (s *ModuleDataStore) ListTokens(ctx context.Context) ([]model.TokenItem, error)

ListTokens returns tokens.

func (*ModuleDataStore) OAuthGet added in v0.99.0

func (s *ModuleDataStore) OAuthGet(ctx context.Context, uid types.Uid, topic, t string) (gen.OAuth, error)

OAuthGet returns OAuth credentials for uid, topic, and type.

func (*ModuleDataStore) OAuthGetAvailable added in v0.99.0

func (s *ModuleDataStore) OAuthGetAvailable(ctx context.Context, t string) ([]gen.OAuth, error)

OAuthGetAvailable lists OAuth credentials of the given type.

func (*ModuleDataStore) OAuthSet added in v0.99.0

func (s *ModuleDataStore) OAuthSet(ctx context.Context, oauthModel gen.OAuth) error

OAuthSet stores OAuth credentials.

func (*ModuleDataStore) PageGet added in v0.99.0

func (s *ModuleDataStore) PageGet(ctx context.Context, pageId string) (gen.Page, error)

PageGet get a page.

func (*ModuleDataStore) PageSet added in v0.99.0

func (s *ModuleDataStore) PageSet(ctx context.Context, pageId string, pageModel gen.Page) error

PageSet set a page.

func (*ModuleDataStore) ParameterDelete added in v0.99.0

func (s *ModuleDataStore) ParameterDelete(ctx context.Context, flag string) error

ParameterDelete delete a parameter.

func (*ModuleDataStore) ParameterGet added in v0.99.0

func (s *ModuleDataStore) ParameterGet(ctx context.Context, flag string) (gen.Parameter, error)

ParameterGet get a parameter.

func (*ModuleDataStore) ParameterSet added in v0.99.0

func (s *ModuleDataStore) ParameterSet(ctx context.Context, flag string, params types.KV, expiredAt time.Time) error

ParameterSet set a parameter.

func (*ModuleDataStore) RevokeToken added in v0.99.0

func (s *ModuleDataStore) RevokeToken(ctx context.Context, flag string) error

RevokeToken revokes the token.

func (*ModuleDataStore) UpdateInstruct added in v0.99.0

func (s *ModuleDataStore) UpdateInstruct(ctx context.Context, instructModel *gen.Instruct) error

UpdateInstruct updates the instruct.

type NotifyConfigStore added in v0.99.0

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

NotifyConfigStore persists notification channels, rules, and templates.

func NewNotifyConfigStore added in v0.99.0

func NewNotifyConfigStore(client *gen.Client) *NotifyConfigStore

NewNotifyConfigStore creates a NotifyConfigStore with the given ent client.

func NotifyConfigStoreFromDB added in v0.99.0

func NotifyConfigStoreFromDB() *NotifyConfigStore

NotifyConfigStoreFromDB returns a NotifyConfigStore using the global database client.

func (*NotifyConfigStore) Client added in v0.99.0

func (s *NotifyConfigStore) Client() *gen.Client

Client returns the underlying ent client.

func (*NotifyConfigStore) CreateNotifyChannel added in v0.99.0

func (s *NotifyConfigStore) CreateNotifyChannel(ctx context.Context, name, protocol, uri string) (int64, error)

CreateNotifyChannel persists a new notify channel.

func (*NotifyConfigStore) CreateNotifyRule added in v0.99.0

func (s *NotifyConfigStore) CreateNotifyRule(ctx context.Context, rule model.NotifyRule) (int64, error)

CreateNotifyRule persists a new notify rule.

func (*NotifyConfigStore) CreateNotifyTemplate added in v0.99.0

func (s *NotifyConfigStore) CreateNotifyTemplate(ctx context.Context, tmpl model.NotifyTemplate) (int64, error)

CreateNotifyTemplate persists a new notify template.

func (*NotifyConfigStore) DeleteNotifyChannel added in v0.99.0

func (s *NotifyConfigStore) DeleteNotifyChannel(ctx context.Context, id int64) error

DeleteNotifyChannel deletes the notify channel.

func (*NotifyConfigStore) DeleteNotifyRule added in v0.99.0

func (s *NotifyConfigStore) DeleteNotifyRule(ctx context.Context, id int64) error

DeleteNotifyRule deletes the notify rule.

func (*NotifyConfigStore) DeleteNotifyTemplate added in v0.99.0

func (s *NotifyConfigStore) DeleteNotifyTemplate(ctx context.Context, id int64) error

DeleteNotifyTemplate deletes the notify template.

func (*NotifyConfigStore) GetDefaultNotifyChannelRaw added in v0.99.0

func (s *NotifyConfigStore) GetDefaultNotifyChannelRaw(ctx context.Context) (model.NotifyChannel, error)

GetDefaultNotifyChannelRaw returns the default notify channel raw.

func (*NotifyConfigStore) GetDefaultNotifyTemplate added in v0.99.0

func (s *NotifyConfigStore) GetDefaultNotifyTemplate(ctx context.Context) (model.NotifyTemplate, error)

GetDefaultNotifyTemplate returns the default notify template.

func (*NotifyConfigStore) GetNotifyChannel added in v0.99.0

func (s *NotifyConfigStore) GetNotifyChannel(ctx context.Context, id int64) (model.NotifyChannel, error)

GetNotifyChannel returns the notify channel.

func (*NotifyConfigStore) GetNotifyChannelByNameRaw added in v0.99.0

func (s *NotifyConfigStore) GetNotifyChannelByNameRaw(ctx context.Context, name string) (model.NotifyChannel, error)

GetNotifyChannelByNameRaw returns the notify channel by name raw.

func (*NotifyConfigStore) GetNotifyChannelRaw added in v0.99.0

func (s *NotifyConfigStore) GetNotifyChannelRaw(ctx context.Context, id int64) (model.NotifyChannel, error)

GetNotifyChannelRaw returns the notify channel raw.

func (*NotifyConfigStore) GetNotifyRule added in v0.99.0

func (s *NotifyConfigStore) GetNotifyRule(ctx context.Context, id int64) (model.NotifyRule, error)

GetNotifyRule returns the notify rule.

func (*NotifyConfigStore) GetNotifyTemplate added in v0.99.0

func (s *NotifyConfigStore) GetNotifyTemplate(ctx context.Context, id int64) (model.NotifyTemplate, error)

GetNotifyTemplate returns the notify template.

func (*NotifyConfigStore) GetNotifyTemplateByTemplateID added in v0.99.0

func (s *NotifyConfigStore) GetNotifyTemplateByTemplateID(ctx context.Context, templateID string) (model.NotifyTemplate, error)

GetNotifyTemplateByTemplateID returns the notify template by template id.

func (*NotifyConfigStore) ListNotifyChannels added in v0.99.0

func (s *NotifyConfigStore) ListNotifyChannels(ctx context.Context, opts ListNotifyChannelOptions) ([]model.NotifyChannel, error)

ListNotifyChannels returns notify channels.

func (*NotifyConfigStore) ListNotifyRules added in v0.99.0

func (s *NotifyConfigStore) ListNotifyRules(ctx context.Context, opts ListNotifyRuleOptions) ([]model.NotifyRule, error)

ListNotifyRules returns notify rules.

func (*NotifyConfigStore) ListNotifyTemplates added in v0.99.0

ListNotifyTemplates returns notify templates.

func (*NotifyConfigStore) SetDefaultNotifyChannel added in v0.99.0

func (s *NotifyConfigStore) SetDefaultNotifyChannel(ctx context.Context, id int64) error

SetDefaultNotifyChannel sets the default notify channel.

func (*NotifyConfigStore) SetDefaultNotifyTemplate added in v0.99.0

func (s *NotifyConfigStore) SetDefaultNotifyTemplate(ctx context.Context, id int64) error

SetDefaultNotifyTemplate sets the default notify template.

func (*NotifyConfigStore) UpdateNotifyChannel added in v0.99.0

func (s *NotifyConfigStore) UpdateNotifyChannel(ctx context.Context, id int64, name, protocol, uri string, enabled bool) error

UpdateNotifyChannel updates the notify channel.

func (*NotifyConfigStore) UpdateNotifyRule added in v0.99.0

func (s *NotifyConfigStore) UpdateNotifyRule(ctx context.Context, id int64, rule model.NotifyRule) error

UpdateNotifyRule updates the notify rule.

func (*NotifyConfigStore) UpdateNotifyTemplate added in v0.99.0

func (s *NotifyConfigStore) UpdateNotifyTemplate(ctx context.Context, id int64, tmpl model.NotifyTemplate) error

UpdateNotifyTemplate updates the notify template.

type NotifyStore added in v0.92.0

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

NotifyStore provides CRUD for notification delivery records.

func NewNotifyStore added in v0.92.0

func NewNotifyStore(client *gen.Client) *NotifyStore

NewNotifyStore returns a NotifyStore backed by the given Ent client.

func NotifyStoreFromDB added in v0.99.0

func NotifyStoreFromDB() *NotifyStore

NotifyStoreFromDB returns a NotifyStore using the global database client.

func (*NotifyStore) CancelDeferredByCorrelation added in v0.99.0

func (s *NotifyStore) CancelDeferredByCorrelation(ctx context.Context, uid, correlationID string) error

CancelDeferredByCorrelation sets deferred rows with the correlation id to cancelled.

func (*NotifyStore) CancelDeferredByCorrelations added in v0.99.0

func (s *NotifyStore) CancelDeferredByCorrelations(ctx context.Context, uid string, correlationIDs ...string) error

CancelDeferredByCorrelations cancels deferred notification records for any of the given correlation ids.

func (*NotifyStore) CountUnread added in v0.99.0

func (s *NotifyStore) CountUnread(ctx context.Context, uid, channel, status string) (int, error)

CountUnread returns how many unread records exist for uid on the given channel and status.

func (*NotifyStore) DeleteOldest added in v0.92.0

func (s *NotifyStore) DeleteOldest(ctx context.Context, uid string, keepN int) error

DeleteOldest removes the oldest records for a user exceeding keepN.

func (*NotifyStore) GetRecord added in v0.92.0

func (s *NotifyStore) GetRecord(ctx context.Context, id int64) (*gen.NotificationRecord, error)

GetRecord returns a single notification record by ID.

func (*NotifyStore) HasUnreadSuccessByCorrelation added in v0.99.0

func (s *NotifyStore) HasUnreadSuccessByCorrelation(ctx context.Context, uid, correlationID string) (bool, error)

HasUnreadSuccessByCorrelation reports whether an unread success record exists for the correlation.

func (*NotifyStore) ListDueDeferred added in v0.99.0

func (s *NotifyStore) ListDueDeferred(ctx context.Context, now time.Time, limit int) ([]*gen.NotificationRecord, error)

ListDueDeferred returns deferred records whose escalate_at is at or before now.

func (*NotifyStore) ListRecords added in v0.92.0

ListRecords returns per-user notification records, cursor-paginated (newest first).

func (*NotifyStore) MarkRead added in v0.98.1

func (s *NotifyStore) MarkRead(ctx context.Context, uid string, ids ...int64) error

MarkRead sets read_at on the given notification records owned by uid and cancels related deferred rows.

func (*NotifyStore) MarkReadByCorrelation added in v0.99.0

func (s *NotifyStore) MarkReadByCorrelation(ctx context.Context, uid, correlationID string) error

MarkReadByCorrelation marks unread inapp (or any) records with the correlation id as read and cancels deferred.

func (*NotifyStore) Record added in v0.92.0

func (s *NotifyStore) Record(ctx context.Context, uid, channel, templateID, summary, status, errorMsg, ruleID string, payload map[string]any) (int64, error)

Record inserts a notification delivery record and returns the new row ID. ruleID is the matched notify rule id when known; empty when no rule applied. New records are unread (read_at nil) until MarkRead.

func (*NotifyStore) RecordParams added in v0.99.0

func (s *NotifyStore) RecordParams(ctx context.Context, p RecordParams) (int64, error)

RecordParams inserts a notification delivery record with extended fields.

func (*NotifyStore) UpdateRecordStatus added in v0.99.0

func (s *NotifyStore) UpdateRecordStatus(ctx context.Context, id int64, status, errorMsg string) error

UpdateRecordStatus sets status (and optional error) on a record by id.

type PageDataStore added in v0.92.0

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

PageDataStore persists shareable view page data keyed by opaque tokens.

func NewPageDataStore added in v0.92.0

func NewPageDataStore(client *gen.Client) *PageDataStore

NewPageDataStore creates a PageDataStore with the given ent client.

func (*PageDataStore) CreatePageData added in v0.92.0

func (s *PageDataStore) CreatePageData(ctx context.Context, token, pageType, title string, data types.KV, createdBy string, expiresAt *time.Time) error

CreatePageData inserts a new page_data row.

func (*PageDataStore) DeleteExpiredPageData added in v0.92.0

func (s *PageDataStore) DeleteExpiredPageData(ctx context.Context) (int64, error)

DeleteExpiredPageData removes rows where expires_at < now(). Returns the number of deleted rows.

func (*PageDataStore) DeletePageData added in v0.92.0

func (s *PageDataStore) DeletePageData(ctx context.Context, token string) (int, error)

DeletePageData removes a page_data row by token. Returns the number of deleted rows.

func (*PageDataStore) GetPageDataByToken added in v0.92.0

func (s *PageDataStore) GetPageDataByToken(ctx context.Context, token string) (*gen.PageData, error)

GetPageDataByToken retrieves a page_data row by token. Returns nil if not found.

type PersistentStorageInterface

type PersistentStorageInterface interface {
	Open(jsonConfig config.StoreType) error
	Close() error
	IsOpen() bool
	GetAdapter() Adapter
	DbStats() func() any
}

PersistentStorageInterface defines methods used for interaction with persistent storage.

Store is the main object for interacting with persistent storage.

type PipelineCatalogAdapter added in v0.99.0

type PipelineCatalogAdapter struct {
	S *PipelineStore
}

PipelineCatalogAdapter adapts PipelineStore to pipeline.DefinitionCatalog.

func (PipelineCatalogAdapter) CreateDefinition added in v0.99.0

func (a PipelineCatalogAdapter) CreateDefinition(ctx context.Context, name, description, createdBy string) error

CreateDefinition implements pipeline.DefinitionCatalog.

func (PipelineCatalogAdapter) DeleteDefinitionByName added in v0.99.0

func (a PipelineCatalogAdapter) DeleteDefinitionByName(ctx context.Context, name string) (int64, error)

DeleteDefinitionByName implements pipeline.DefinitionCatalog.

func (PipelineCatalogAdapter) EnsureDefinitionCreatedBy added in v0.99.0

func (a PipelineCatalogAdapter) EnsureDefinitionCreatedBy(ctx context.Context, name, createdBy string) error

EnsureDefinitionCreatedBy implements pipeline.DefinitionCatalog.

func (PipelineCatalogAdapter) GetDefinitionByName added in v0.99.0

func (a PipelineCatalogAdapter) GetDefinitionByName(ctx context.Context, name string) (*model.PipelineDefinition, error)

GetDefinitionByName implements pipeline.DefinitionCatalog.

func (PipelineCatalogAdapter) GetRunsByParentName added in v0.99.0

func (a PipelineCatalogAdapter) GetRunsByParentName(ctx context.Context, parentName string) ([]*model.PipelineRun, error)

GetRunsByParentName implements pipeline.DefinitionCatalog.

func (PipelineCatalogAdapter) ListPublishedDefinitions added in v0.99.0

func (a PipelineCatalogAdapter) ListPublishedDefinitions(ctx context.Context) ([]pipeline.DefinitionRecord, error)

ListPublishedDefinitions implements pipeline.DefinitionCatalog.

func (PipelineCatalogAdapter) PublishDefinition added in v0.99.0

func (a PipelineCatalogAdapter) PublishDefinition(ctx context.Context, name string, version int) (*model.PipelineDefinition, error)

PublishDefinition implements pipeline.DefinitionCatalog.

func (PipelineCatalogAdapter) UpdateDefinitionDraft added in v0.99.0

func (a PipelineCatalogAdapter) UpdateDefinitionDraft(ctx context.Context, name, yamlDraft string, version int) (*model.PipelineDefinition, error)

UpdateDefinitionDraft implements pipeline.DefinitionCatalog.

type PipelineRunInfo added in v0.92.0

type PipelineRunInfo struct {
	ID            int64
	PipelineName  string
	EventID       string
	Status        string
	TriggerSource string
}

PipelineRunInfo is a lightweight view of a pipeline run for event matching display.

type PipelineRunStoreAdapter added in v0.99.0

type PipelineRunStoreAdapter struct {
	S *PipelineStore
}

PipelineRunStoreAdapter adapts PipelineStore to pipeline.RunStore (model DTOs).

func (PipelineRunStoreAdapter) CreateRun added in v0.99.0

func (a PipelineRunStoreAdapter) CreateRun(ctx context.Context, pipelineName, eventID, eventType, triggerSource string) (*model.PipelineRun, error)

CreateRun implements pipeline.RunStore.

func (PipelineRunStoreAdapter) CreateStepRun added in v0.99.0

func (a PipelineRunStoreAdapter) CreateStepRun(ctx context.Context, runID int64, stepName, capName, operation string, params map[string]any, attempt int) (*model.PipelineStepRun, error)

CreateStepRun implements pipeline.RunStore.

func (PipelineRunStoreAdapter) GetCheckpoint added in v0.99.0

func (a PipelineRunStoreAdapter) GetCheckpoint(ctx context.Context, runID int64, target any) error

GetCheckpoint implements pipeline.RunStore.

func (PipelineRunStoreAdapter) GetIncompleteRuns added in v0.99.0

func (a PipelineRunStoreAdapter) GetIncompleteRuns(ctx context.Context) ([]*model.PipelineRun, error)

GetIncompleteRuns implements pipeline.RunStore.

func (PipelineRunStoreAdapter) GetRun added in v0.99.0

GetRun implements pipeline.RunStore.

func (PipelineRunStoreAdapter) HasConsumed added in v0.99.0

func (a PipelineRunStoreAdapter) HasConsumed(ctx context.Context, consumerName, eventID string) (bool, error)

HasConsumed implements pipeline.RunStore.

func (PipelineRunStoreAdapter) RecordConsumption added in v0.99.0

func (a PipelineRunStoreAdapter) RecordConsumption(ctx context.Context, consumerName, eventID string) error

RecordConsumption implements pipeline.RunStore.

func (a PipelineRunStoreAdapter) RecordResourceLink(ctx context.Context, link model.ResourceLink) error

RecordResourceLink implements pipeline.RunStore.

func (PipelineRunStoreAdapter) SaveCheckpoint added in v0.99.0

func (a PipelineRunStoreAdapter) SaveCheckpoint(ctx context.Context, runID int64, data any) error

SaveCheckpoint implements pipeline.RunStore.

func (PipelineRunStoreAdapter) UpdateRunHeartbeat added in v0.99.0

func (a PipelineRunStoreAdapter) UpdateRunHeartbeat(ctx context.Context, runID int64) error

UpdateRunHeartbeat implements pipeline.RunStore.

func (PipelineRunStoreAdapter) UpdateRunStatus added in v0.99.0

func (a PipelineRunStoreAdapter) UpdateRunStatus(ctx context.Context, runID int64, status int, errMsg string) error

UpdateRunStatus implements pipeline.RunStore.

func (PipelineRunStoreAdapter) UpdateStepRun added in v0.99.0

func (a PipelineRunStoreAdapter) UpdateStepRun(ctx context.Context, stepRunID int64, status int, result map[string]any, errMsg string, attempt int) error

UpdateStepRun implements pipeline.RunStore.

type PipelineStore added in v0.92.0

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

PipelineStore persists pipeline definitions, runs, step runs, and event consumptions.

func NewPipelineStore added in v0.92.0

func NewPipelineStore(client *gen.Client) *PipelineStore

func PipelineStoreFromDB added in v0.99.0

func PipelineStoreFromDB() *PipelineStore

PipelineStoreFromDB returns a PipelineStore using the global database client.

func (*PipelineStore) CreateDefinition added in v0.92.0

func (s *PipelineStore) CreateDefinition(ctx context.Context, name, description, createdBy string) error

CreateDefinition creates a new pipeline definition with initial yaml_draft and version 1. createdBy is the Web UI user UID that created the pipeline (may be empty in tests).

func (*PipelineStore) CreateRun added in v0.92.0

func (s *PipelineStore) CreateRun(ctx context.Context, pipelineName, eventID, eventType, triggerSource string) (*gen.PipelineRun, error)

func (*PipelineStore) CreateStepRun added in v0.92.0

func (s *PipelineStore) CreateStepRun(ctx context.Context, runID int64, stepName, capability, operation string, params map[string]any, attempt int) (*gen.PipelineStepRun, error)

func (*PipelineStore) DeleteDefinitionByName added in v0.92.0

func (s *PipelineStore) DeleteDefinitionByName(ctx context.Context, name string) (int64, error)

DeleteDefinitionByName removes a pipeline definition and its associated runs. Runs match the parent name and compound trigger engine names (name__trigger_*). Returns the number of pipeline runs that were deleted.

func (*PipelineStore) EnsureDefinitionCreatedBy added in v0.96.2

func (s *PipelineStore) EnsureDefinitionCreatedBy(ctx context.Context, name, createdBy string) error

EnsureDefinitionCreatedBy sets created_by when it is currently empty. Used to backfill owner UID for pipelines created before the field existed.

func (*PipelineStore) GetCheckpoint added in v0.92.0

func (s *PipelineStore) GetCheckpoint(ctx context.Context, runID int64, target any) error

GetCheckpoint loads the checkpoint data for a pipeline run.

func (*PipelineStore) GetDefinitionByName added in v0.92.0

func (s *PipelineStore) GetDefinitionByName(ctx context.Context, name string) (*gen.PipelineDefinition, error)

GetDefinitionByName returns a pipeline definition by name.

func (*PipelineStore) GetDefinitionVersion added in v0.92.0

func (s *PipelineStore) GetDefinitionVersion(ctx context.Context, name string, version int) (*gen.PipelineDefinitionVersion, error)

GetDefinitionVersion returns a single version snapshot by pipeline name and version number.

func (*PipelineStore) GetIncompleteRuns added in v0.92.0

func (s *PipelineStore) GetIncompleteRuns(ctx context.Context) ([]*gen.PipelineRun, error)

GetIncompleteRuns returns pipeline runs that are in Start state and may need recovery.

func (*PipelineStore) GetRun added in v0.92.0

func (s *PipelineStore) GetRun(ctx context.Context, runID int64) (*gen.PipelineRun, error)

GetRun returns a pipeline run by ID.

func (*PipelineStore) GetRunByID added in v0.92.0

func (s *PipelineStore) GetRunByID(ctx context.Context, id int64) (*gen.PipelineRun, error)

GetRunByID returns a pipeline run by its database ID.

func (*PipelineStore) GetRunsByParentName added in v0.92.0

func (s *PipelineStore) GetRunsByParentName(ctx context.Context, parentName string) ([]*gen.PipelineRun, error)

GetRunsByParentName returns pipeline runs matching a parent pipeline name. Matches both exact name and compound trigger names (name__trigger_*).

func (*PipelineStore) GetStepRunsByRunID added in v0.92.0

func (s *PipelineStore) GetStepRunsByRunID(ctx context.Context, runID int64) ([]*gen.PipelineStepRun, error)

GetStepRunsByRunID returns all step runs for a given pipeline run, ordered by ID.

func (*PipelineStore) HasConsumed added in v0.92.0

func (s *PipelineStore) HasConsumed(ctx context.Context, consumerName, eventID string) (bool, error)

func (*PipelineStore) LatestRunStartedAtByParentNames added in v0.97.1

func (s *PipelineStore) LatestRunStartedAtByParentNames(ctx context.Context, names []string) (map[string]time.Time, error)

LatestRunStartedAtByParentNames returns the latest started_at for each parent pipeline name. Matches exact pipeline_name and compound trigger names (name__trigger_*). Names without runs are omitted from the result.

func (*PipelineStore) ListDefinitionVersions added in v0.92.0

func (s *PipelineStore) ListDefinitionVersions(ctx context.Context, name string) ([]*gen.PipelineDefinitionVersion, error)

ListDefinitionVersions returns all published version snapshots for a pipeline, ordered by version descending (newest first).

func (*PipelineStore) ListDefinitions added in v0.92.0

func (s *PipelineStore) ListDefinitions(ctx context.Context) ([]*gen.PipelineDefinition, error)

ListDefinitions returns all pipeline definitions ordered by updated_at desc.

func (*PipelineStore) ListPublishedDefinitions added in v0.92.0

func (s *PipelineStore) ListPublishedDefinitions(ctx context.Context) ([]pipeline.DefinitionRecord, error)

ListPublishedDefinitions returns all pipeline definitions that are published and have a non-nil yaml_published field.

func (*PipelineStore) ListStepRunsByRunID added in v0.92.0

func (s *PipelineStore) ListStepRunsByRunID(ctx context.Context, runID int64) ([]*gen.PipelineStepRun, error)

ListStepRunsByRunID returns all step runs for a pipeline run, ordered by creation time.

func (*PipelineStore) PipelineStats added in v0.92.0

func (s *PipelineStore) PipelineStats(ctx context.Context, name string, since time.Time, groupBy string) (*types.PipelineStats, error)

PipelineStats returns aggregated pipeline run statistics for chart rendering. name empty = all pipelines. since zero = no time filter. groupBy = "day"|"week"|"month".

func (*PipelineStore) PublishDefinition added in v0.92.0

func (s *PipelineStore) PublishDefinition(ctx context.Context, name string, version int) (*gen.PipelineDefinition, error)

PublishDefinition copies yaml_draft to yaml_published with atomic optimistic locking. Also inserts a version snapshot into pipeline_definition_versions.

func (*PipelineStore) RecordConsumption added in v0.92.0

func (s *PipelineStore) RecordConsumption(ctx context.Context, consumerName, eventID string) error
func (s *PipelineStore) RecordResourceLink(ctx context.Context, link *gen.ResourceLink) error

RecordResourceLink inserts a resource link with UPSERT semantics.

func (*PipelineStore) RenameDefinition added in v0.98.1

func (s *PipelineStore) RenameDefinition(ctx context.Context, oldName, newName string) (*gen.PipelineDefinition, error)

RenameDefinition renames a pipeline definition and cascades the new name to version snapshots, runs (including compound trigger names), resource links, and top-level name fields in draft/published YAML.

func (*PipelineStore) RunLatencyStatsByParentNames added in v0.98.1

func (s *PipelineStore) RunLatencyStatsByParentNames(ctx context.Context, names []string, since time.Time) (map[string]types.RunLatencyStats, error)

RunLatencyStatsByParentNames returns success rate and P50/P95 duration stats per parent pipeline name. Matches exact pipeline_name and compound trigger names (name__trigger_*). Only completed runs with started_at >= since (when since is non-zero) are included. Names without qualifying runs are omitted from the result.

func (*PipelineStore) SaveCheckpoint added in v0.92.0

func (s *PipelineStore) SaveCheckpoint(ctx context.Context, runID int64, data any) error

SaveCheckpoint persists the intermediate pipeline run state.

func (*PipelineStore) SetDefinitionEnabled added in v0.95.0

func (s *PipelineStore) SetDefinitionEnabled(ctx context.Context, name string, enabled bool) (*gen.PipelineDefinition, error)

SetDefinitionEnabled toggles the top-level enabled flag in draft and published YAML. Only published pipelines can be paused at runtime.

func (*PipelineStore) UpdateDefinitionDraft added in v0.92.0

func (s *PipelineStore) UpdateDefinitionDraft(ctx context.Context, name, yamlDraft string, version int) (*gen.PipelineDefinition, error)

UpdateDefinitionDraft updates the yaml_draft with atomic optimistic locking. Uses conditional UPDATE WHERE version=X. Returns ErrConflict if no row matched.

func (*PipelineStore) UpdateRunHeartbeat added in v0.92.0

func (s *PipelineStore) UpdateRunHeartbeat(ctx context.Context, runID int64) error

UpdateRunHeartbeat refreshes the last_heartbeat timestamp for a running pipeline.

func (*PipelineStore) UpdateRunStatus added in v0.92.0

func (s *PipelineStore) UpdateRunStatus(ctx context.Context, runID int64, status int, errMsg string) error

func (*PipelineStore) UpdateStepRun added in v0.92.0

func (s *PipelineStore) UpdateStepRun(ctx context.Context, stepRunID int64, status int, result map[string]any, errMsg string, attempt int) error

type PlatformStore added in v0.99.0

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

PlatformStore persists platforms, channels, bots, and platform channel links.

func NewPlatformStore added in v0.99.0

func NewPlatformStore(client *gen.Client) *PlatformStore

NewPlatformStore creates a PlatformStore with the given ent client.

func PlatformStoreFromDB added in v0.99.0

func PlatformStoreFromDB() *PlatformStore

PlatformStoreFromDB returns a PlatformStore using the global database client.

func (*PlatformStore) Client added in v0.99.0

func (s *PlatformStore) Client() *gen.Client

Client returns the underlying ent client.

func (*PlatformStore) CreateBot added in v0.99.0

func (s *PlatformStore) CreateBot(ctx context.Context, botModel *gen.Bot) (int64, error)

CreateBot persists a new bot.

func (*PlatformStore) CreateChannel added in v0.99.0

func (s *PlatformStore) CreateChannel(ctx context.Context, channelModel *gen.Channel) (int64, error)

CreateChannel persists a new channel.

func (*PlatformStore) CreatePlatform added in v0.99.0

func (s *PlatformStore) CreatePlatform(ctx context.Context, platformModel *gen.Platform) (int64, error)

CreatePlatform persists a new platform.

func (*PlatformStore) CreatePlatformChannel added in v0.99.0

func (s *PlatformStore) CreatePlatformChannel(ctx context.Context, item *gen.PlatformChannel) (int64, error)

CreatePlatformChannel persists a new platform channel.

func (*PlatformStore) CreatePlatformChannelUser added in v0.99.0

func (s *PlatformStore) CreatePlatformChannelUser(ctx context.Context, item *gen.PlatformChannelUser) (int64, error)

CreatePlatformChannelUser persists a new platform channel user.

func (*PlatformStore) DeleteBot added in v0.99.0

func (s *PlatformStore) DeleteBot(ctx context.Context, name string) error

DeleteBot deletes the bot.

func (*PlatformStore) DeleteChannel added in v0.99.0

func (s *PlatformStore) DeleteChannel(ctx context.Context, name string) error

DeleteChannel deletes the channel.

func (*PlatformStore) GetBot added in v0.99.0

func (s *PlatformStore) GetBot(ctx context.Context, id int64) (*gen.Bot, error)

GetBot returns the bot.

func (*PlatformStore) GetBotByName added in v0.99.0

func (s *PlatformStore) GetBotByName(ctx context.Context, name string) (*gen.Bot, error)

GetBotByName returns the bot by name.

func (*PlatformStore) GetBots added in v0.99.0

func (s *PlatformStore) GetBots(ctx context.Context) ([]*gen.Bot, error)

GetBots returns the bots.

func (*PlatformStore) GetChannel added in v0.99.0

func (s *PlatformStore) GetChannel(ctx context.Context, id int64) (*gen.Channel, error)

GetChannel returns the channel.

func (*PlatformStore) GetChannelByName added in v0.99.0

func (s *PlatformStore) GetChannelByName(ctx context.Context, name string) (*gen.Channel, error)

GetChannelByName returns the channel by name.

func (*PlatformStore) GetChannels added in v0.99.0

func (s *PlatformStore) GetChannels(ctx context.Context) ([]*gen.Channel, error)

GetChannels returns the channels.

func (*PlatformStore) GetPlatform added in v0.99.0

func (s *PlatformStore) GetPlatform(ctx context.Context, id int64) (*gen.Platform, error)

GetPlatform returns the platform.

func (*PlatformStore) GetPlatformByName added in v0.99.0

func (s *PlatformStore) GetPlatformByName(ctx context.Context, name string) (*gen.Platform, error)

GetPlatformByName returns the platform by name.

func (*PlatformStore) GetPlatformChannelByFlag added in v0.99.0

func (s *PlatformStore) GetPlatformChannelByFlag(ctx context.Context, flag string) (*gen.PlatformChannel, error)

GetPlatformChannelByFlag returns the platform channel by flag.

func (*PlatformStore) GetPlatformChannelUsersByUserFlag added in v0.99.0

func (s *PlatformStore) GetPlatformChannelUsersByUserFlag(ctx context.Context, userFlag string) ([]*gen.PlatformChannelUser, error)

GetPlatformChannelUsersByUserFlag returns the platform channel users by user flag.

func (*PlatformStore) GetPlatformChannelUsersByUserFlags added in v0.99.0

func (s *PlatformStore) GetPlatformChannelUsersByUserFlags(ctx context.Context, userFlags []string) ([]*gen.PlatformChannelUser, error)

GetPlatformChannelUsersByUserFlags returns platform channel user records for a batch of user flags.

func (*PlatformStore) GetPlatformChannelsByChannelId added in v0.99.0

func (s *PlatformStore) GetPlatformChannelsByChannelId(ctx context.Context, channelId int64) (*gen.PlatformChannel, error)

GetPlatformChannelsByChannelId returns the platform channels by channel id.

func (*PlatformStore) GetPlatformChannelsByPlatformIds added in v0.99.0

func (s *PlatformStore) GetPlatformChannelsByPlatformIds(ctx context.Context, platformIds []int64) ([]*gen.PlatformChannel, error)

GetPlatformChannelsByPlatformIds returns the platform channels by platform ids.

func (*PlatformStore) GetPlatforms added in v0.99.0

func (s *PlatformStore) GetPlatforms(ctx context.Context) ([]*gen.Platform, error)

GetPlatforms returns the platforms.

func (*PlatformStore) UpdateBot added in v0.99.0

func (s *PlatformStore) UpdateBot(ctx context.Context, botModel *gen.Bot) error

UpdateBot updates the bot.

func (*PlatformStore) UpdateChannel added in v0.99.0

func (s *PlatformStore) UpdateChannel(ctx context.Context, channelModel *gen.Channel) error

UpdateChannel updates the channel.

func (*PlatformStore) UpdatePlatformChannelChannelID added in v0.99.0

func (s *PlatformStore) UpdatePlatformChannelChannelID(ctx context.Context, platformChannelID, channelID int64) error

UpdatePlatformChannelChannelID updates the platform channel channel id.

type PollingStateEntry added in v0.92.0

type PollingStateEntry struct {
	Cursor      string
	KnownHashes map[string]string
	UpdatedAt   any
}

PollingStateEntry represents a single persisted polling state row.

type PollingStateStore added in v0.92.0

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

PollingStateStore persists polling state entries for the provider event source framework.

func NewPollingStateStore added in v0.92.0

func NewPollingStateStore(client *gen.Client) *PollingStateStore

NewPollingStateStore returns a PollingStateStore backed by the given Ent client.

func (*PollingStateStore) LoadAll added in v0.92.0

LoadAll loads all polling state entries from the database.

func (*PollingStateStore) Save added in v0.92.0

func (s *PollingStateStore) Save(ctx context.Context, resourceName, cursor string, knownHashes map[string]string) error

Save upserts a polling state entry for the given resource. If an entry with the same resource name already exists, it is updated; otherwise a new one is created.

type RecordParams added in v0.99.0

type RecordParams = notify.RecordParams

RecordParams is an alias of notify.RecordParams.

type ResourceChainStore added in v0.92.0

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

ResourceChainStore provides query methods for resource tag and lineage lookups.

func NewResourceChainStore added in v0.92.0

func NewResourceChainStore(client *gen.Client) *ResourceChainStore

NewResourceChainStore creates a ResourceChainStore with the given ent client.

func (*ResourceChainStore) FindNodeRelations added in v0.92.0

func (s *ResourceChainStore) FindNodeRelations(ctx context.Context, appName, capability, entityID, pipelineName string, since time.Duration) ([]schema.ResourceEdge, []schema.ResourceEdge, error)

FindNodeRelations returns upstream and downstream edges for a node identified by (appName, capability, entityID). Optional pipelineName filter and time window.

func (*ResourceChainStore) FindRelations added in v0.92.0

func (s *ResourceChainStore) FindRelations(ctx context.Context, appName, entityID string) (*schema.ResourceRelations, error)

FindRelations returns upstream and downstream resource references for a specific resource identified by appName + entity_id.

func (s *ResourceChainStore) FindResourceLinks(ctx context.Context, eventIDs []string) ([]*gen.ResourceLink, error)

FindResourceLinks returns all links involving any of the given event IDs, either as source or target.

func (*ResourceChainStore) FindResourcesByTag added in v0.92.0

func (s *ResourceChainStore) FindResourcesByTag(ctx context.Context, key, value string, limit int, cursor string) ([]*gen.DataEvent, string, error)

FindResourcesByTag returns DataEvents matching a tag key-value pair, ordered by created_at descending. Supports limit + opaque cursor pagination.

func (*ResourceChainStore) SearchNodes added in v0.92.0

func (s *ResourceChainStore) SearchNodes(ctx context.Context, query string, limit int, cursor string) ([]schema.ResourceRef, string, error)

SearchNodes returns distinct (app, capability, entity_id) tuples from resource_links where source_entity_id, target_entity_id, source_app, target_app, source_capability, or target_capability contains the query. cursor is a decimal offset into the deduplicated result stream; empty starts at 0.

type RuntimeAgentStore added in v0.99.0

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

RuntimeAgentStore persists host/runtime agent heartbeats.

func NewRuntimeAgentStore added in v0.99.0

func NewRuntimeAgentStore(client *gen.Client) *RuntimeAgentStore

NewRuntimeAgentStore creates a RuntimeAgentStore with the given ent client.

func RuntimeAgentStoreFromDB added in v0.99.0

func RuntimeAgentStoreFromDB() *RuntimeAgentStore

RuntimeAgentStoreFromDB returns a RuntimeAgentStore using the global database client.

func (*RuntimeAgentStore) Client added in v0.99.0

func (s *RuntimeAgentStore) Client() *gen.Client

Client returns the underlying ent client.

func (*RuntimeAgentStore) CreateAgent added in v0.99.0

func (s *RuntimeAgentStore) CreateAgent(ctx context.Context, agentModel *gen.Agent) (int64, error)

CreateAgent persists a new agent.

func (*RuntimeAgentStore) GetAgentByHostid added in v0.99.0

func (s *RuntimeAgentStore) GetAgentByHostid(ctx context.Context, uid types.Uid, topic, hostid string) (*gen.Agent, error)

GetAgentByHostid returns the agent by hostid.

func (*RuntimeAgentStore) GetAgents added in v0.99.0

func (s *RuntimeAgentStore) GetAgents(ctx context.Context) ([]*gen.Agent, error)

GetAgents returns the agents.

func (*RuntimeAgentStore) UpdateAgentLastOnlineAt added in v0.99.0

func (s *RuntimeAgentStore) UpdateAgentLastOnlineAt(ctx context.Context, uid types.Uid, topic, hostid string, lastOnlineAt time.Time) error

UpdateAgentLastOnlineAt updates the agent last online at.

func (*RuntimeAgentStore) UpdateAgentOnlineDuration added in v0.99.0

func (s *RuntimeAgentStore) UpdateAgentOnlineDuration(ctx context.Context, uid types.Uid, topic, hostid string, offlineTime time.Time) error

UpdateAgentOnlineDuration updates the agent online duration.

type UpdateChatScheduledTaskParams added in v0.94.0

type UpdateChatScheduledTaskParams struct {
	Name      *string
	Cron      *string
	RunAt     *time.Time
	Prompt    *string
	State     *string
	LastRunAt *time.Time
	NextRunAt *time.Time
}

UpdateChatScheduledTaskParams carries partial updates for a scheduled task row.

type UpdateChatScheduledTaskRunParams added in v0.94.0

type UpdateChatScheduledTaskRunParams struct {
	State      *string
	Reply      *string
	Error      *string
	FinishedAt *time.Time
}

UpdateChatScheduledTaskRunParams carries partial updates for one run row.

type UserStore added in v0.99.0

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

UserStore persists users and platform user mappings.

func NewUserStore added in v0.99.0

func NewUserStore(client *gen.Client) *UserStore

NewUserStore creates a UserStore with the given ent client.

func UserStoreFromDB added in v0.99.0

func UserStoreFromDB() *UserStore

UserStoreFromDB returns a UserStore using the global database client.

func (*UserStore) Client added in v0.99.0

func (s *UserStore) Client() *gen.Client

Client returns the underlying ent client.

func (*UserStore) CreatePlatformUser added in v0.99.0

func (s *UserStore) CreatePlatformUser(ctx context.Context, item *gen.PlatformUser) (int64, error)

CreatePlatformUser creates a platform user record.

func (*UserStore) FirstUser added in v0.99.0

func (s *UserStore) FirstUser(ctx context.Context) (*gen.User, error)

FirstUser returns the first user.

func (*UserStore) GetPlatformUserByFlag added in v0.99.0

func (s *UserStore) GetPlatformUserByFlag(ctx context.Context, flag string) (*gen.PlatformUser, error)

GetPlatformUserByFlag returns the platform user by flag.

func (*UserStore) GetPlatformUsersByUserId added in v0.99.0

func (s *UserStore) GetPlatformUsersByUserId(ctx context.Context, userId int64) ([]*gen.PlatformUser, error)

GetPlatformUsersByUserId returns the platform users by user id.

func (*UserStore) GetUserByFlag added in v0.99.0

func (s *UserStore) GetUserByFlag(ctx context.Context, flag string) (*gen.User, error)

GetUserByFlag returns the user by flag.

func (*UserStore) GetUserById added in v0.99.0

func (s *UserStore) GetUserById(ctx context.Context, id int64) (*gen.User, error)

GetUserById returns the user with the given id.

func (*UserStore) GetUsers added in v0.99.0

func (s *UserStore) GetUsers(ctx context.Context) ([]*gen.User, error)

GetUsers returns all users up to the query limit.

func (*UserStore) UpdatePlatformUser added in v0.99.0

func (s *UserStore) UpdatePlatformUser(ctx context.Context, item *gen.PlatformUser) error

UpdatePlatformUser updates the platform user.

func (*UserStore) UserCreate added in v0.99.0

func (s *UserStore) UserCreate(ctx context.Context, usr *gen.User) error

UserCreate creates a new user.

func (*UserStore) UserDelete added in v0.99.0

func (s *UserStore) UserDelete(ctx context.Context, uid types.Uid, hard bool) error

UserDelete soft- or hard-deletes the user for uid.

func (*UserStore) UserGet added in v0.99.0

func (s *UserStore) UserGet(ctx context.Context, uid types.Uid) (*gen.User, error)

UserGet returns the user for uid.

func (*UserStore) UserGetAll added in v0.99.0

func (s *UserStore) UserGetAll(ctx context.Context, ids ...types.Uid) ([]*gen.User, error)

UserGetAll returns users, optionally filtered by uid flags.

func (*UserStore) UserUpdate added in v0.99.0

func (s *UserStore) UserUpdate(ctx context.Context, uid types.Uid, update types.KV) error

UserUpdate applies partial updates to the user for uid.

type WebAccountStore added in v0.99.0

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

WebAccountStore persists web UI login accounts.

func NewWebAccountStore added in v0.99.0

func NewWebAccountStore(client *gen.Client) *WebAccountStore

NewWebAccountStore creates a WebAccountStore with the given ent client.

func WebAccountStoreFromDB added in v0.99.0

func WebAccountStoreFromDB() *WebAccountStore

WebAccountStoreFromDB returns a WebAccountStore using the global database client.

func (*WebAccountStore) Client added in v0.99.0

func (s *WebAccountStore) Client() *gen.Client

Client returns the underlying ent client.

func (*WebAccountStore) Count added in v0.99.0

func (s *WebAccountStore) Count(ctx context.Context) (int, error)

Count returns the number of web accounts.

func (*WebAccountStore) CreateFirstAccount added in v0.99.0

func (s *WebAccountStore) CreateFirstAccount(ctx context.Context, in CreateAccountInput) (*gen.WebAccount, error)

CreateFirstAccount creates the first web account when none exist (setup / migration). It runs in a transaction: COUNT must be 0, then insert web_accounts + users.

func (*WebAccountStore) DeleteWebSessionsForUID added in v0.99.0

func (s *WebAccountStore) DeleteWebSessionsForUID(ctx context.Context, uid string) (int, error)

DeleteWebSessionsForUID removes parameter rows for web sessions belonging to uid.

func (*WebAccountStore) EnableTOTP added in v0.99.0

func (s *WebAccountStore) EnableTOTP(ctx context.Context, username string, ciphertext, nonce []byte, backupHashes []string, lastStep int64) error

EnableTOTP stores encrypted secret, backup hashes, marks enabled, and records the enroll step.

func (*WebAccountStore) EnsureUser added in v0.99.0

func (s *WebAccountStore) EnsureUser(ctx context.Context, uid, username string) error

EnsureUser creates a users row for uid if missing.

func (*WebAccountStore) GetByUID added in v0.99.0

func (s *WebAccountStore) GetByUID(ctx context.Context, uid string) (*gen.WebAccount, error)

GetByUID returns the account for uid.

func (*WebAccountStore) GetByUsername added in v0.99.0

func (s *WebAccountStore) GetByUsername(ctx context.Context, username string) (*gen.WebAccount, error)

GetByUsername returns the account for username.

func (*WebAccountStore) ResetTOTP added in v0.99.0

func (s *WebAccountStore) ResetTOTP(ctx context.Context, username string) error

ResetTOTP clears TOTP secret, disables 2FA, and clears backup codes.

func (*WebAccountStore) RevokeLegacyWebSessions added in v0.99.0

func (s *WebAccountStore) RevokeLegacyWebSessions(ctx context.Context) (int, error)

RevokeLegacyWebSessions deletes web sessions that are not full authenticated sessions. This clears pre-2FA legacy cookies (missing kind) and any pending sessions on startup.

func (*WebAccountStore) SetBackupCodeHashes added in v0.99.0

func (s *WebAccountStore) SetBackupCodeHashes(ctx context.Context, username string, hashes []string) error

SetBackupCodeHashes replaces backup code hashes.

func (*WebAccountStore) SetTOTPLastStep added in v0.99.0

func (s *WebAccountStore) SetTOTPLastStep(ctx context.Context, username string, step int64) error

SetTOTPLastStep records the last accepted TOTP time step (replay protection).

func (*WebAccountStore) SoleAccount added in v0.99.0

func (s *WebAccountStore) SoleAccount(ctx context.Context) (*gen.WebAccount, bool, error)

SoleAccount returns the only web account when exactly one exists. Homelab installs typically have a single admin; platform chat identities can share it.

func (*WebAccountStore) UpdatePasswordHash added in v0.99.0

func (s *WebAccountStore) UpdatePasswordHash(ctx context.Context, username, hash string) error

UpdatePasswordHash sets a new password hash.

type WorkflowCatalogAdapter added in v0.99.0

type WorkflowCatalogAdapter struct {
	S *WorkflowStore
}

WorkflowCatalogAdapter adapts WorkflowStore to workflow.Catalog (model DTOs).

func (WorkflowCatalogAdapter) ApplyDefinition added in v0.99.0

func (a WorkflowCatalogAdapter) ApplyDefinition(ctx context.Context, meta *types.WorkflowMetadata) (*model.Workflow, error)

ApplyDefinition implements workflow.Catalog.

func (WorkflowCatalogAdapter) DeleteDefinitionByName added in v0.99.0

func (a WorkflowCatalogAdapter) DeleteDefinitionByName(ctx context.Context, name string) error

DeleteDefinitionByName implements workflow.Catalog.

func (WorkflowCatalogAdapter) GetMetadata added in v0.99.0

GetMetadata implements workflow.DefinitionStore by loading gen rows and mapping to types.

func (WorkflowCatalogAdapter) ListDefinitions added in v0.99.0

func (a WorkflowCatalogAdapter) ListDefinitions(ctx context.Context) ([]*model.Workflow, error)

ListDefinitions implements workflow.Catalog.

func (WorkflowCatalogAdapter) ListRunsByName added in v0.99.0

func (a WorkflowCatalogAdapter) ListRunsByName(ctx context.Context, name string) ([]*model.WorkflowRun, error)

ListRunsByName implements workflow.Catalog.

type WorkflowDefinitionDTO added in v0.98.0

type WorkflowDefinitionDTO struct {
	Workflow *gen.Workflow
	Tasks    []*gen.WorkflowTask
	Triggers []*gen.WorkflowTrigger
}

WorkflowDefinitionDTO is a workflow definition with its tasks and triggers.

type WorkflowRunStore added in v0.92.0

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

WorkflowRunStore persists workflow runs, step runs, and checkpoint data.

func NewWorkflowRunStore added in v0.92.0

func NewWorkflowRunStore(client *gen.Client) *WorkflowRunStore

NewWorkflowRunStore creates a WorkflowRunStore backed by the given ent client.

func (*WorkflowRunStore) CreateRun added in v0.92.0

func (s *WorkflowRunStore) CreateRun(ctx context.Context, workflowID int64, workflowName, workflowFile, triggerType string, triggerInfo, inputParams map[string]any) (*gen.WorkflowRun, error)

CreateRun inserts a new workflow run record. workflowID may be 0 when unknown; workflowFile is "" or "db" for DB-backed definitions.

func (*WorkflowRunStore) CreateStepRun added in v0.92.0

func (s *WorkflowRunStore) CreateStepRun(ctx context.Context, runID int64, stepID, stepName, action, actionType string, params map[string]any, attempt int) (*gen.WorkflowStepRun, error)

CreateStepRun inserts a new workflow step run record.

func (*WorkflowRunStore) GetCheckpoint added in v0.92.0

func (s *WorkflowRunStore) GetCheckpoint(ctx context.Context, runID int64, target any) error

GetCheckpoint loads the checkpoint data for a workflow run.

func (*WorkflowRunStore) GetIncompleteRuns added in v0.92.0

func (s *WorkflowRunStore) GetIncompleteRuns(ctx context.Context) ([]*gen.WorkflowRun, error)

GetIncompleteRuns returns workflow runs that are still running and may need recovery.

func (*WorkflowRunStore) GetRun added in v0.92.0

func (s *WorkflowRunStore) GetRun(ctx context.Context, runID int64) (*gen.WorkflowRun, error)

GetRun returns a workflow run by ID.

func (*WorkflowRunStore) GetStepRunsByRunID added in v0.98.0

func (s *WorkflowRunStore) GetStepRunsByRunID(ctx context.Context, runID int64) ([]*gen.WorkflowStepRun, error)

GetStepRunsByRunID returns all step runs for a workflow run, ordered by ID.

func (*WorkflowRunStore) SaveCheckpoint added in v0.92.0

func (s *WorkflowRunStore) SaveCheckpoint(ctx context.Context, runID int64, data any) error

SaveCheckpoint persists the intermediate workflow run state.

func (*WorkflowRunStore) UpdateRunHeartbeat added in v0.92.0

func (s *WorkflowRunStore) UpdateRunHeartbeat(ctx context.Context, runID int64) error

UpdateRunHeartbeat refreshes the last_heartbeat timestamp for a running workflow.

func (*WorkflowRunStore) UpdateRunStatus added in v0.92.0

func (s *WorkflowRunStore) UpdateRunStatus(ctx context.Context, runID int64, status int, errMsg string) error

UpdateRunStatus updates the status, error, and completed_at of a workflow run.

func (*WorkflowRunStore) UpdateStepRun added in v0.92.0

func (s *WorkflowRunStore) UpdateStepRun(ctx context.Context, stepRunID int64, status int, result map[string]any, errMsg string, attempt int) error

UpdateStepRun updates the status, result, error, and attempt count of a workflow step run. completed_at is only set for terminal states (Done, Failed).

type WorkflowRunStoreAdapter added in v0.99.0

type WorkflowRunStoreAdapter struct {
	S *WorkflowRunStore
}

WorkflowRunStoreAdapter adapts WorkflowRunStore to workflow.WorkflowRunStore.

func (WorkflowRunStoreAdapter) CreateRun added in v0.99.0

func (a WorkflowRunStoreAdapter) CreateRun(ctx context.Context, workflowID int64, workflowName, workflowFile, triggerType string, triggerInfo, inputParams map[string]any) (*model.WorkflowRun, error)

CreateRun implements workflow.WorkflowRunStore.

func (WorkflowRunStoreAdapter) CreateStepRun added in v0.99.0

func (a WorkflowRunStoreAdapter) CreateStepRun(ctx context.Context, runID int64, stepID, stepName, action, actionType string, params map[string]any, attempt int) (*model.WorkflowStepRun, error)

CreateStepRun implements workflow.WorkflowRunStore.

func (WorkflowRunStoreAdapter) GetCheckpoint added in v0.99.0

func (a WorkflowRunStoreAdapter) GetCheckpoint(ctx context.Context, runID int64, target any) error

GetCheckpoint implements workflow.WorkflowRunStore.

func (WorkflowRunStoreAdapter) GetIncompleteRuns added in v0.99.0

func (a WorkflowRunStoreAdapter) GetIncompleteRuns(ctx context.Context) ([]*model.WorkflowRun, error)

GetIncompleteRuns implements workflow.WorkflowRunStore.

func (WorkflowRunStoreAdapter) GetRun added in v0.99.0

GetRun implements workflow.WorkflowRunStore.

func (WorkflowRunStoreAdapter) SaveCheckpoint added in v0.99.0

func (a WorkflowRunStoreAdapter) SaveCheckpoint(ctx context.Context, runID int64, data any) error

SaveCheckpoint implements workflow.WorkflowRunStore.

func (WorkflowRunStoreAdapter) UpdateRunHeartbeat added in v0.99.0

func (a WorkflowRunStoreAdapter) UpdateRunHeartbeat(ctx context.Context, runID int64) error

UpdateRunHeartbeat implements workflow.WorkflowRunStore.

func (WorkflowRunStoreAdapter) UpdateRunStatus added in v0.99.0

func (a WorkflowRunStoreAdapter) UpdateRunStatus(ctx context.Context, runID int64, status int, errMsg string) error

UpdateRunStatus implements workflow.WorkflowRunStore.

func (WorkflowRunStoreAdapter) UpdateStepRun added in v0.99.0

func (a WorkflowRunStoreAdapter) UpdateStepRun(ctx context.Context, stepRunID int64, status int, result map[string]any, errMsg string, attempt int) error

UpdateStepRun implements workflow.WorkflowRunStore.

type WorkflowStore added in v0.98.0

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

WorkflowStore persists normalized workflow definitions (tasks + triggers).

func NewWorkflowStore added in v0.98.0

func NewWorkflowStore(client *gen.Client) *WorkflowStore

NewWorkflowStore creates a WorkflowStore backed by the given ent client.

func WorkflowStoreFromDB added in v0.99.0

func WorkflowStoreFromDB() *WorkflowStore

WorkflowStoreFromDB returns a WorkflowStore using the global database client.

func (*WorkflowStore) ApplyDefinition added in v0.98.0

func (s *WorkflowStore) ApplyDefinition(ctx context.Context, meta *types.WorkflowMetadata) (*gen.Workflow, error)

ApplyDefinition upserts a workflow definition by name and replaces all tasks and triggers.

func (*WorkflowStore) DeleteDefinitionByName added in v0.98.0

func (s *WorkflowStore) DeleteDefinitionByName(ctx context.Context, name string) error

DeleteDefinitionByName deletes a workflow and its tasks/triggers. Existing runs are kept; their workflow_id is set to NULL.

func (*WorkflowStore) GetDefinitionByName added in v0.98.0

func (s *WorkflowStore) GetDefinitionByName(ctx context.Context, name string) (*WorkflowDefinitionDTO, error)

GetDefinitionByName returns a workflow definition with tasks and triggers.

func (*WorkflowStore) LatestRunStartedAtByNames added in v0.98.0

func (s *WorkflowStore) LatestRunStartedAtByNames(ctx context.Context, names []string) (map[string]time.Time, error)

LatestRunStartedAtByNames returns the latest started_at for each workflow name. Names without runs are omitted from the result.

func (*WorkflowStore) ListDefinitions added in v0.98.0

func (s *WorkflowStore) ListDefinitions(ctx context.Context) ([]*gen.Workflow, error)

ListDefinitions returns all workflow definition rows (without tasks/triggers).

func (*WorkflowStore) ListRunsByName added in v0.98.0

func (s *WorkflowStore) ListRunsByName(ctx context.Context, name string) ([]*gen.WorkflowRun, error)

ListRunsByName returns workflow runs matching the given workflow name.

func (*WorkflowStore) ListTriggers added in v0.98.0

func (s *WorkflowStore) ListTriggers(ctx context.Context) ([]*gen.WorkflowTrigger, error)

ListTriggers returns all workflow trigger rows.

func (*WorkflowStore) RunLatencyStatsByNames added in v0.98.1

func (s *WorkflowStore) RunLatencyStatsByNames(ctx context.Context, names []string, since time.Time) (map[string]types.RunLatencyStats, error)

RunLatencyStatsByNames returns success rate and P50/P95 duration stats per workflow name. Only completed runs with started_at >= since (when since is non-zero) are included. Names without qualifying runs are omitted from the result.

func (*WorkflowStore) SetEnabled added in v0.98.0

func (s *WorkflowStore) SetEnabled(ctx context.Context, name string, enabled bool) (*gen.Workflow, error)

SetEnabled updates the enabled flag for a workflow definition by name.

func (*WorkflowStore) SetTriggerEnabled added in v0.98.0

func (s *WorkflowStore) SetTriggerEnabled(ctx context.Context, workflowName string, triggerID int64, enabled bool) (*gen.WorkflowTrigger, error)

SetTriggerEnabled updates the enabled flag for one trigger belonging to a named workflow.

func (*WorkflowStore) WorkflowStats added in v0.98.2

func (s *WorkflowStore) WorkflowStats(ctx context.Context, name string, since time.Time, groupBy string) (*types.WorkflowStats, error)

WorkflowStats returns aggregated workflow run statistics for chart rendering. name empty = all workflows. since zero = no time filter. groupBy = "day"|"week"|"month".

Directories

Path Synopsis
ent
Package ent provides the Ent ORM client initialization and database connectivity.
Package ent provides the Ent ORM client initialization and database connectivity.
gen
schema
Package schema provides Ent ORM schema definitions.
Package schema provides Ent ORM schema definitions.
Package postgres implements the PostgreSQL storage adapter.
Package postgres implements the PostgreSQL storage adapter.
Package sqlitetest opens in-memory SQLite databases for unit tests using modernc.org/sqlite.
Package sqlitetest opens in-memory SQLite databases for unit tests using modernc.org/sqlite.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL