json

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package json provides JSON file-based implementations of persistence repositories.

This package can be used for production environments where JSON is preferred over YAML.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PromptRepository

type PromptRepository struct {
	*common.BasePromptRepository
}

JSONPromptRepository loads prompts from JSON files on disk

func NewJSONPromptRepository

func NewJSONPromptRepository(basePath string, taskTypeToFile map[string]string) *PromptRepository

NewJSONPromptRepository creates a JSON file-based prompt repository

func (*PromptRepository) LoadFragment

func (r *PromptRepository) LoadFragment(name, relativePath, baseDir string) (*prompt.Fragment, error)

LoadFragment loads a fragment by name

func (*PromptRepository) SavePrompt

func (r *PromptRepository) SavePrompt(config *prompt.Config) error

SavePrompt saves a prompt configuration to a JSON file

type ToolRepository

type ToolRepository struct {
	// contains filtered or unexported fields
}

JSONToolRepository loads tools from JSON files on disk

func NewJSONToolRepository

func NewJSONToolRepository(basePath string) *ToolRepository

NewJSONToolRepository creates a JSON file-based tool repository

func (*ToolRepository) ListTools

func (r *ToolRepository) ListTools() ([]string, error)

ListTools returns all available tool names

func (*ToolRepository) LoadDirectory

func (r *ToolRepository) LoadDirectory(dirPath string) error

LoadDirectory recursively loads all JSON tool files from a directory

func (*ToolRepository) LoadTool

func (r *ToolRepository) LoadTool(name string) (*tools.ToolDescriptor, error)

LoadTool loads a tool descriptor by name

func (*ToolRepository) LoadToolFromFile

func (r *ToolRepository) LoadToolFromFile(filename string) error

LoadToolFromFile loads a tool from a JSON file

func (*ToolRepository) RegisterTool

func (r *ToolRepository) RegisterTool(name string, descriptor *tools.ToolDescriptor)

RegisterTool adds a tool descriptor directly

func (*ToolRepository) SaveTool

func (r *ToolRepository) SaveTool(descriptor *tools.ToolDescriptor) error

SaveTool saves a tool descriptor to a JSON file using K8s manifest format. The file will be named <tool-name>.json in the repository's base path.

Jump to

Keyboard shortcuts

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