Documentation
¶
Overview ¶
Package data provides Datly-backed read/write persistence services.
It wraps generated components for conversations, messages, turns, runs, tool calls, payloads, and related pagination/patch/delete operations.
Index ¶
- Variables
- func NewDatly(ctx context.Context) (*datly.Service, error)
- func NewDatlyFromWorkspace(ctx context.Context, root string) (*datly.Service, error)
- func NewDatlyInMemory(ctx context.Context) (*datly.Service, error)
- func NewDatlyServiceFromEnv(ctx context.Context) (*datly.Service, error)
- type ConversationPage
- type Direction
- type MessagePage
- type Option
- type PageInput
- type RunStepPage
- type Service
- type TurnPage
Constants ¶
This section is empty.
Variables ¶
var ErrPermissionDenied = errors.New("permission denied")
Functions ¶
func NewDatly ¶
NewDatly creates a singleton datly service with configured connector. It expects AGENTLY_DB_DSN and AGENTLY_DB_DRIVER to be set.
func NewDatlyFromWorkspace ¶
NewDatlyFromWorkspace creates a datly service backed by file-based SQLite in the given workspace root directory ({root}/db/agently-core.db). Data persists across restarts.
func NewDatlyInMemory ¶
NewDatlyInMemory creates a non-singleton datly service backed by in-memory sqlite.
Types ¶
type ConversationPage ¶
type ConversationPage struct {
Rows []*agconvlist.ConversationRowsView
NextCursor string
PrevCursor string
HasMore bool
}
type MessagePage ¶
type MessagePage struct {
Rows []*agmessagelist.MessageRowsView
NextCursor string
PrevCursor string
HasMore bool
}
type Option ¶
type Option func(*options)
Option customizes read execution without changing generated input DTOs.
func WithAdminPrincipal ¶
WithAdminPrincipal bypasses visibility restrictions.
func WithPrincipal ¶
WithPrincipal enforces conversation visibility rules for reads.
func WithQuerySelector ¶
func WithQuerySelector(selectors ...*hstate.NamedQuerySelector) Option
WithQuerySelector delegates pagination/projection/order constraints to Datly selectors.
type RunStepPage ¶
type RunStepPage struct {
Rows []*agrunsteps.RunStepsView
NextCursor string
PrevCursor string
HasMore bool
}
type Service ¶
type Service interface {
Raw() *datly.Service
GetConversation(ctx context.Context, id string, in *agconv.ConversationInput, opts ...Option) (*agconv.ConversationView, error)
ListConversations(ctx context.Context, in *agconvlist.ConversationRowsInput, page *PageInput, opts ...Option) (*ConversationPage, error)
GetMessage(ctx context.Context, id string, in *agmessage.MessageInput, opts ...Option) (*agmessage.MessageView, error)
GetMessagesPage(ctx context.Context, in *agmessagelist.MessageRowsInput, page *PageInput, opts ...Option) (*MessagePage, error)
GetMessageByElicitation(ctx context.Context, conversationID, elicitationID string, opts ...Option) (*elicitationmsg.MessageView, error)
GetRun(ctx context.Context, id string, in *agrun.RunRowsInput, opts ...Option) (*agrun.RunRowsView, error)
GetRunStepsPage(ctx context.Context, in *agrunsteps.RunStepsInput, page *PageInput, opts ...Option) (*RunStepPage, error)
GetActiveRun(ctx context.Context, in *agrunactive.ActiveRunsInput, opts ...Option) (*agrunactive.ActiveRunsView, error)
ListStaleRuns(ctx context.Context, in *agrunstale.StaleRunsInput, opts ...Option) ([]*agrunstale.StaleRunsView, error)
GetActiveTurn(ctx context.Context, in *agturnactive.ActiveTurnsInput, opts ...Option) (*agturnactive.ActiveTurnsView, error)
GetTurnByID(ctx context.Context, in *agturnbyid.TurnLookupInput, opts ...Option) (*agturnbyid.TurnLookupView, error)
GetTurnsPage(ctx context.Context, in *agturnlistall.TurnRowsInput, page *PageInput, opts ...Option) (*TurnPage, error)
GetNextQueuedTurn(ctx context.Context, in *agturnnext.QueuedTurnInput, opts ...Option) (*agturnnext.QueuedTurnView, error)
ListQueuedTurns(ctx context.Context, in *agturnlist.QueuedTurnsInput, opts ...Option) ([]*agturnlist.QueuedTurnsView, error)
CountQueuedTurns(ctx context.Context, in *agturncount.QueuedTotalInput, opts ...Option) (int, error)
GetToolCallByOp(ctx context.Context, opID string, in *agtoolcall.ToolCallRowsInput, opts ...Option) ([]*agtoolcall.ToolCallRowsView, error)
ListPayloadRows(ctx context.Context, in *agpayload.PayloadRowsInput, opts ...Option) ([]*agpayload.PayloadRowsView, error)
ListGeneratedFiles(ctx context.Context, conversationID string, opts ...Option) ([]*gfread.GeneratedFileView, error)
PatchConversations(ctx context.Context, rows []*agconvwrite.MutableConversationView) ([]*agconvwrite.MutableConversationView, error)
PatchMessages(ctx context.Context, rows []*agmessagewrite.MutableMessageView) ([]*agmessagewrite.MutableMessageView, error)
PatchTurns(ctx context.Context, rows []*agturnwrite.MutableTurnView) ([]*agturnwrite.MutableTurnView, error)
PatchModelCalls(ctx context.Context, rows []*agmodelcallwrite.MutableModelCallView) ([]*agmodelcallwrite.MutableModelCallView, error)
PatchToolCalls(ctx context.Context, rows []*agtoolcallwrite.MutableToolCallView) ([]*agtoolcallwrite.MutableToolCallView, error)
PatchPayloads(ctx context.Context, rows []*agpayloadwrite.MutablePayloadView) ([]*agpayloadwrite.MutablePayloadView, error)
PatchRuns(ctx context.Context, rows []*agrunwrite.MutableRunView) ([]*agrunwrite.MutableRunView, error)
DeleteConversations(ctx context.Context, ids ...string) error
DeleteMessages(ctx context.Context, ids ...string) error
DeleteTurns(ctx context.Context, ids ...string) error
DeleteModelCalls(ctx context.Context, messageIDs ...string) error
DeleteToolCalls(ctx context.Context, messageIDs ...string) error
DeletePayloads(ctx context.Context, ids ...string) error
DeleteRuns(ctx context.Context, ids ...string) error
}
Service is a thin facade over generated Datly read components.
func NewService ¶
NewService creates a thin data service on top of a Datly DAO.
func NewThinServiceFromEnv ¶
NewThinServiceFromEnv creates a thin data.Service backed by env-configured Datly.
type TurnPage ¶
type TurnPage struct {
Rows []*agturnlistall.TurnRowsView
NextCursor string
PrevCursor string
HasMore bool
}