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 AssistantPreview
- type ConversationPage
- type Direction
- type MessagePage
- type Option
- type PageInput
- type RunStepPage
- type Service
- type TerminalArtifactCandidate
- type TerminalArtifactCleanupStore
- type TerminalArtifactDisposition
- type TerminalArtifactKind
- type TerminalArtifactLinkage
- type TurnPage
Constants ¶
This section is empty.
Variables ¶
var ErrConversationActive = errors.New("conversation is still in progress")
var ErrConversationNotFound = errors.New("conversation not found")
var ErrPermissionDenied = errors.New("permission denied")
var ErrScheduleNotFound = errors.New("schedule not found")
Functions ¶
func NewDatly ¶
NewDatly creates a singleton datly service with configured connector. It prefers AGENTLY_DB_DSN and falls back to AGENTLY_DB_PATH for SQLite.
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 AssistantPreview ¶ added in v0.1.8
type AssistantPreview struct {
Output string
Narration string
HasFinalResponse bool
OutputAt time.Time
NarrationAt time.Time
LastMessageAt time.Time
LastMessageKnown bool
ConversationID string
OutputMessageID string
NarrationMessageID string
}
func LatestAssistantPreview ¶ added in v0.1.8
func (*AssistantPreview) PreferredText ¶ added in v0.1.8
func (p *AssistantPreview) PreferredText() string
type ConversationPage ¶
type ConversationPage struct {
Rows []*agconvlist.ConversationRowsView
NextCursor string
PrevCursor string
HasMore bool
HasOlder bool
HasNewer 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)
GetGoal(ctx context.Context, conversationID string, in *aggoal.GoalInput, opts ...Option) (*aggoal.GoalView, 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)
PatchGoals(ctx context.Context, rows []*aggoalwrite.MutableGoalView) ([]*aggoalwrite.MutableGoalView, 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
DeleteGoals(ctx context.Context, ids ...string) error
DeleteConversationTree(ctx context.Context, ids ...string) error
DeleteScheduleCascade(ctx context.Context, id 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 TerminalArtifactCandidate ¶ added in v0.1.17
type TerminalArtifactCandidate struct {
Kind TerminalArtifactKind
ID string
ConversationID string
TurnID string
Linkage TerminalArtifactLinkage
ExpectedLink string
ExpectedRun string
TerminalStatus string
Reason string
}
TerminalArtifactCandidate contains only the identity and optimistic guard values captured at startup. Message content and artifact payloads are never retained in memory.
type TerminalArtifactCleanupStore ¶ added in v0.1.17
type TerminalArtifactCleanupStore interface {
SnapshotTerminalArtifactCandidates(ctx context.Context, terminalSince time.Time, terminalTurnLimit int) ([]TerminalArtifactCandidate, error)
CleanupTerminalArtifactCandidates(ctx context.Context, candidates []TerminalArtifactCandidate, completedAt time.Time) ([]TerminalArtifactDisposition, error)
}
TerminalArtifactCleanupStore is an optional, narrow startup-maintenance capability. It deliberately is not part of Service so callers that do not use the Datly store do not need to expose direct SQL maintenance methods.
type TerminalArtifactDisposition ¶ added in v0.1.17
type TerminalArtifactDisposition uint8
const ( TerminalArtifactUnresolved TerminalArtifactDisposition = iota TerminalArtifactRepaired TerminalArtifactAlreadyResolved TerminalArtifactNoLongerEligible )
type TerminalArtifactKind ¶ added in v0.1.17
type TerminalArtifactKind string
const ( TerminalArtifactModelCall TerminalArtifactKind = "model_call" TerminalArtifactToolCall TerminalArtifactKind = "tool_call" TerminalArtifactMessage TerminalArtifactKind = "message" )
type TerminalArtifactLinkage ¶ added in v0.1.17
type TerminalArtifactLinkage string
const ( TerminalArtifactDirectTurn TerminalArtifactLinkage = "direct_turn" TerminalArtifactMessageTurn TerminalArtifactLinkage = "message_turn" TerminalArtifactRun TerminalArtifactLinkage = "run" TerminalArtifactLegacyRun TerminalArtifactLinkage = "legacy_run" )
type TurnPage ¶
type TurnPage struct {
Rows []*agturnlistall.TurnRowsView
NextCursor string
PrevCursor string
HasMore bool
}