persistence

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package persistence provides persistence interfaces and common errors.

Package persistence provides abstract persistence layer for Runtime components.

This package implements the Repository Pattern to decouple Runtime from storage implementations. It provides interfaces for loading prompts, tools, and fragments from various backends (YAML files, JSON files, memory, packs, etc.).

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNilConfig is returned when a nil config is passed to SavePrompt.
	ErrNilConfig = errors.New("config cannot be nil")

	// ErrNilDescriptor is returned when a nil descriptor is passed to SaveTool.
	ErrNilDescriptor = errors.New("descriptor cannot be nil")

	// ErrEmptyTaskType is returned when a config has an empty task_type.
	ErrEmptyTaskType = errors.New("task_type cannot be empty")

	// ErrEmptyToolName is returned when a tool descriptor has an empty name.
	ErrEmptyToolName = errors.New("tool name cannot be empty")

	// ErrPromptNotFound is returned when a requested prompt is not found.
	ErrPromptNotFound = errors.New("prompt not found")

	// ErrToolNotFound is returned when a requested tool is not found.
	ErrToolNotFound = errors.New("tool not found")
)

Sentinel errors for persistence operations.

Functions

This section is empty.

Types

type PromptRepository

type PromptRepository interface {
	// LoadPrompt loads a prompt configuration by task type
	LoadPrompt(taskType string) (*prompt.Config, error)

	// LoadFragment loads a fragment by name and optional path
	LoadFragment(name string, relativePath string, baseDir string) (*prompt.Fragment, error)

	// ListPrompts returns all available prompt task types
	ListPrompts() ([]string, error)

	// SavePrompt saves a prompt configuration (for future write support)
	SavePrompt(config *prompt.Config) error
}

PromptRepository provides abstract access to prompt configurations

type ToolRepository

type ToolRepository interface {
	// LoadTool loads a tool descriptor by name
	LoadTool(name string) (*tools.ToolDescriptor, error)

	// ListTools returns all available tool names
	ListTools() ([]string, error)

	// SaveTool saves a tool descriptor (for future write support)
	SaveTool(descriptor *tools.ToolDescriptor) error
}

ToolRepository provides abstract access to tool descriptors

Directories

Path Synopsis
Package common provides shared functionality for persistence repositories.
Package common provides shared functionality for persistence repositories.
Package json provides JSON file-based implementations of persistence repositories.
Package json provides JSON file-based implementations of persistence repositories.
Package memory provides in-memory implementations of persistence repositories.
Package memory provides in-memory implementations of persistence repositories.
Package yaml provides YAML file-based implementations of persistence repositories.
Package yaml provides YAML file-based implementations of persistence repositories.

Jump to

Keyboard shortcuts

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