persistence

package
v1.4.11 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: Apache-2.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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, relativePath, 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