store

package
v0.99.18 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: GPL-3.0 Imports: 92 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.

Index

Constants

This section is empty.

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 DataEventFromRow added in v0.99.8

func DataEventFromRow(row *gen.DataEvent) types.DataEvent

DataEventFromRow maps a persisted data_events row to the domain event.

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 NewPipelineEventLoader

func NewPipelineEventLoader(s *EventStore) pipeline.EventLoader

NewPipelineEventLoader wraps an EventStore as pipeline.EventLoader.

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 SetOAuthEncryptor

func SetOAuthEncryptor(e *webauth.Encryptor)

SetOAuthEncryptor wires AES-GCM sealing for OAuth token columns. Nil disables encryption (tests / before web module Init).

func SetQueryLimits added in v0.99.0

func SetQueryLimits(maxResults, maxMessageResults int)

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

func WorkflowServiceAdapters

func WorkflowServiceAdapters() (workflow.Catalog, workflow.WorkflowRunStore)

WorkflowServiceAdapters returns the catalog and run store backed by Database. Both are nil when the database is closed.

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 AuditCaller

type AuditCaller struct {
	// UID is the caller uid.
	UID string
	// Admin is true when the caller holds admin:*.
	Admin bool
	// SubjectID is the requested uid filter. Empty lists every uid when Admin is true.
	SubjectID string
}

AuditCaller is the identity used to filter an audit list.

type AuditRecord

type AuditRecord struct {
	ID            int64
	At            time.Time
	Action        string
	SubjectType   string
	SubjectID     string
	TargetType    string
	TargetID      string
	Result        string
	ErrorCode     string
	Request       any
	Truncated     bool
	CorrelationID string
}

AuditRecord is one audit row returned by List.

func (AuditRecord) Item

func (r AuditRecord) Item() map[string]any

Item is the list payload shared by REST and MCP.

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) List

List returns audit rows newest first. The cursor is the last row id. Rows are ordered by created_at and id descending; ids increase with inserts. SubjectID matches details.uid, the caller uid stored on the row.

func (*AuditStore) ListForCaller

func (s *AuditStore) ListForCaller(ctx context.Context, caller AuditCaller, opts ListAuditOptions) ([]AuditRecord, string, error)

ListForCaller returns audit rows visible to caller. A non-admin caller is limited to their own uid. Admin with an empty SubjectID lists every uid.

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. The stored error_code is the tool error code.

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. A single error-code token is stored as error_code.

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.

func (*ChatStore) UpdateChatSessionWorkspace added in v0.99.2

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

UpdateChatSessionWorkspace sets the session workspace relative path (create-time only).

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.

func (*ClipStore) UpdateClipVisibility added in v0.99.12

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

UpdateClipVisibility sets whether a clip is readable by anonymous visitors.

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) DataEventExists

func (s *EventStore) DataEventExists(ctx context.Context, eventType, idempotencyKey string) (bool, error)

DataEventExists reports whether a data_events row with the given event type and idempotency key already exists. Empty keys are treated as not found.

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) EventStats

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

EventStats aggregates data_events for charts filtered by user and time range. groupBy must be event_type, capability, or source.

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) ListPublishedVersionNumbersByNames

func (a FunctionCatalogAdapter) ListPublishedVersionNumbersByNames(ctx context.Context, names []string) (map[string][]int, error)

ListPublishedVersionNumbersByNames 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) Stats

func (a FunctionCatalogAdapter) Stats(ctx context.Context, name string, since, until time.Time, groupBy string) (*types.FunctionStats, error)

Stats 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, until time.Time, groupBy string) (*types.FunctionStats, error)

FunctionStats returns aggregated function run statistics for chart rendering. name empty = all functions. since/until zero = open bound. 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) ListPublishedVersionNumbers added in v0.99.12

func (s *FunctionStore) ListPublishedVersionNumbers(ctx context.Context, name string) ([]int, error)

ListPublishedVersionNumbers returns published version numbers for a function, newest first.

func (*FunctionStore) ListPublishedVersionNumbersByNames added in v0.99.12

func (s *FunctionStore) ListPublishedVersionNumbersByNames(ctx context.Context, names []string) (map[string][]int, error)

ListPublishedVersionNumbersByNames returns published version numbers per function name, newest first.

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) OwnedRunActivity

func (s *FunctionStore) OwnedRunActivity(ctx context.Context, uid string, since, until time.Time) ([]types.ActivityStatsPoint, int64, error)

OwnedRunActivity returns daily function run counts for definitions owned by uid.

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 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 ListAuditOptions

type ListAuditOptions struct {
	Action     string
	SubjectID  string
	TargetType string
	Result     string
	Since      time.Time
	Until      time.Time
	Limit      int
	Cursor     string
}

ListAuditOptions filters audit rows. Limit defaults to 20 and caps at 100.

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, 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) 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) 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 (token fields sealed at rest when an encryptor is wired).

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) ParameterUpdateParams added in v0.99.10

func (s *ModuleDataStore) ParameterUpdateParams(ctx context.Context, flag string, params types.KV) error

ParameterUpdateParams updates params without changing expired_at.

func (*ModuleDataStore) RevokeToken added in v0.99.0

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

RevokeToken revokes the token.

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 NewPipelineService

func NewPipelineService(ps *PipelineStore, events *EventStore) (*pipeline.Service, PipelineCatalogAdapter)

NewPipelineService wires a pipeline service to ps and events. The returned catalog is the adapter the service uses.

func (PipelineCatalogAdapter) ClearBlueprintOrigin

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

ClearBlueprintOrigin implements pipeline.BlueprintOriginStore.

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) GetDefinitionVersion

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

GetDefinitionVersion 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) LatestRunStartedAtByParentNames

func (a PipelineCatalogAdapter) LatestRunStartedAtByParentNames(ctx context.Context, names []string) (map[string]time.Time, error)

LatestRunStartedAtByParentNames implements pipeline.DefinitionCatalog.

func (PipelineCatalogAdapter) ListDefinitionVersions

func (a PipelineCatalogAdapter) ListDefinitionVersions(ctx context.Context, name string) ([]model.PipelineDefinitionVersion, error)

ListDefinitionVersions implements pipeline.DefinitionCatalog.

func (PipelineCatalogAdapter) ListDefinitions

func (a PipelineCatalogAdapter) ListDefinitions(ctx context.Context) ([]*model.PipelineDefinition, error)

ListDefinitions implements pipeline.DefinitionCatalog.

func (PipelineCatalogAdapter) ListLinkedPipelineNames

func (a PipelineCatalogAdapter) ListLinkedPipelineNames(ctx context.Context, source, blueprintID string) ([]string, error)

ListLinkedPipelineNames implements pipeline.BlueprintOriginStore.

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) RenameDefinition

func (a PipelineCatalogAdapter) RenameDefinition(ctx context.Context, oldName, newName string) (*model.PipelineDefinition, error)

RenameDefinition implements pipeline.DefinitionCatalog.

func (PipelineCatalogAdapter) RunLatencyStatsByParentNames

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

RunLatencyStatsByParentNames implements pipeline.DefinitionCatalog.

func (PipelineCatalogAdapter) SetBlueprintOrigin

func (a PipelineCatalogAdapter) SetBlueprintOrigin(ctx context.Context, name string, origin pipeline.BlueprintOrigin) error

SetBlueprintOrigin implements pipeline.BlueprintOriginStore.

func (PipelineCatalogAdapter) SetDefinitionEnabled

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

SetDefinitionEnabled implements pipeline.DefinitionCatalog.

func (PipelineCatalogAdapter) Stats

func (a PipelineCatalogAdapter) Stats(ctx context.Context, name string, since, until time.Time, groupBy string) (*types.PipelineStats, error)

Stats 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 PipelineEventLoader

type PipelineEventLoader struct {
	S *EventStore
}

PipelineEventLoader adapts EventStore to pipeline.EventLoader.

func (PipelineEventLoader) LoadDataEvent

func (a PipelineEventLoader) LoadDataEvent(ctx context.Context, eventID string) (types.DataEvent, error)

LoadDataEvent implements pipeline.EventLoader.

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) ClaimFailedRun added in v0.99.8

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

ClaimFailedRun implements pipeline.RunStore.

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) ListStepRuns added in v0.99.8

func (a PipelineRunStoreAdapter) ListStepRuns(ctx context.Context, runID int64) ([]*model.PipelineStepRun, error)

ListStepRuns implements pipeline.RunStore.

func (PipelineRunStoreAdapter) ListStepRunsByID

func (a PipelineRunStoreAdapter) ListStepRunsByID(ctx context.Context, runID int64) ([]*model.PipelineStepRun, error)

ListStepRunsByID implements pipeline.RunStore.

func (PipelineRunStoreAdapter) PrepareStepRetry added in v0.99.8

func (a PipelineRunStoreAdapter) PrepareStepRetry(ctx context.Context, stepRunID int64, params map[string]any, attempt int) error

PrepareStepRetry 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) ClaimFailedRun added in v0.99.8

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

ClaimFailedRun atomically moves a failed run back to start so a retry can proceed. Returns types.ErrConflict when the row is missing or not failed.

func (*PipelineStore) ClearBlueprintOrigin

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

ClearBlueprintOrigin detaches a pipeline from its blueprint.

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) DeleteUserTemplate

func (s *PipelineStore) DeleteUserTemplate(ctx context.Context, blueprintID string) error

DeleteUserTemplate removes an imported blueprint template.

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) GetUserTemplate

func (s *PipelineStore) GetUserTemplate(ctx context.Context, blueprintID string) (*pipeline.BlueprintTemplateRecord, error)

GetUserTemplate returns one imported blueprint template.

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) ListLinkedPipelineNames

func (s *PipelineStore) ListLinkedPipelineNames(ctx context.Context, source, blueprintID string) ([]string, error)

ListLinkedPipelineNames returns pipeline names linked to a blueprint source and id.

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) ListUserTemplates

func (s *PipelineStore) ListUserTemplates(ctx context.Context) ([]pipeline.BlueprintTemplateRecord, error)

ListUserTemplates returns imported blueprint templates ordered by id.

func (*PipelineStore) OwnedRunActivity

func (s *PipelineStore) OwnedRunActivity(ctx context.Context, uid string, since, until time.Time) ([]types.ActivityStatsPoint, int64, error)

OwnedRunActivity returns daily pipeline run counts for definitions owned by uid.

func (*PipelineStore) PipelineStats added in v0.92.0

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

PipelineStats returns aggregated pipeline run statistics for chart rendering. name empty = all pipelines. since/until zero = open bound. groupBy = "day"|"week"|"month".

func (*PipelineStore) PrepareStepRetry added in v0.99.8

func (s *PipelineStore) PrepareStepRetry(ctx context.Context, stepRunID int64, params map[string]any, attempt int) error

PrepareStepRetry resets a failed step row for another attempt in place.

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) SetBlueprintOrigin

func (s *PipelineStore) SetBlueprintOrigin(ctx context.Context, name string, origin pipeline.BlueprintOrigin) error

SetBlueprintOrigin writes linked-instance origin fields.

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

func (*PipelineStore) UpsertUserTemplate

func (s *PipelineStore) UpsertUserTemplate(ctx context.Context, rec pipeline.BlueprintTemplateRecord) error

UpsertUserTemplate creates or updates an imported blueprint template.

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) (upstream, downstream []schema.ResourceEdge, err 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) LatestRunStartedAtByNames

func (a WorkflowCatalogAdapter) LatestRunStartedAtByNames(ctx context.Context, names []string) (map[string]time.Time, error)

LatestRunStartedAtByNames implements workflow.Catalog.

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.

func (WorkflowCatalogAdapter) ListTriggers

ListTriggers implements workflow.Catalog.

func (WorkflowCatalogAdapter) RunLatencyStatsByNames

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

RunLatencyStatsByNames implements workflow.Catalog.

func (WorkflowCatalogAdapter) SetEnabled

func (a WorkflowCatalogAdapter) SetEnabled(ctx context.Context, name string, enabled bool) (*model.Workflow, error)

SetEnabled implements workflow.Catalog.

func (WorkflowCatalogAdapter) SetTriggerEnabled

func (a WorkflowCatalogAdapter) SetTriggerEnabled(ctx context.Context, workflowName string, triggerID int64, enabled bool) (*model.WorkflowTrigger, error)

SetTriggerEnabled implements workflow.Catalog.

func (WorkflowCatalogAdapter) Stats

func (a WorkflowCatalogAdapter) Stats(ctx context.Context, name string, since, until time.Time, groupBy string) (*types.WorkflowStats, error)

Stats implements workflow.Catalog.

func (WorkflowCatalogAdapter) TriggersByName

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

TriggersByName 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) ListStepRuns

func (a WorkflowRunStoreAdapter) ListStepRuns(ctx context.Context, runID int64) ([]*model.WorkflowStepRun, error)

ListStepRuns 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, until time.Time, groupBy string) (*types.WorkflowStats, error)

WorkflowStats returns aggregated workflow run statistics for chart rendering. name empty = all workflows. since/until zero = open bound. 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