store

package
v0.0.64 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: MPL-2.0 Imports: 32 Imported by: 0

Documentation

Overview

Package store keeps the read-only built-in tool assets together with a writable overlay that enables or disables individual bundles or tools.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitToolStoreHandlers

func InitToolStoreHandlers(api huma.API, store *ToolStore)

InitToolStoreHandlers registers all endpoints for tool bundles and tools.

Types

type BuiltInToolData

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

func NewBuiltInToolData

func NewBuiltInToolData(
	ctx context.Context,
	overlayBaseDir string,
	snapshotMaxAge time.Duration,
	opts ...BuiltInToolDataOption,
) (*BuiltInToolData, error)

func (*BuiltInToolData) GetBuiltInTool

func (*BuiltInToolData) GetBuiltInToolBundle

func (d *BuiltInToolData) GetBuiltInToolBundle(
	ctx context.Context,
	id bundleitemutils.BundleID,
) (spec.ToolBundle, error)

func (*BuiltInToolData) ListBuiltInToolData

func (d *BuiltInToolData) ListBuiltInToolData(ctx context.Context) (
	bundles map[bundleitemutils.BundleID]spec.ToolBundle,
	tools map[bundleitemutils.BundleID]map[bundleitemutils.ItemID]spec.Tool,
	err error,
)

func (*BuiltInToolData) SetToolBundleEnabled

func (d *BuiltInToolData) SetToolBundleEnabled(
	ctx context.Context,
	id bundleitemutils.BundleID,
	enabled bool,
) (spec.ToolBundle, error)

SetToolBundleEnabled toggles a bundle flag and returns the updated bundle.

func (*BuiltInToolData) SetToolEnabled

func (d *BuiltInToolData) SetToolEnabled(
	ctx context.Context,
	bundleID bundleitemutils.BundleID,
	slug bundleitemutils.ItemSlug,
	version bundleitemutils.ItemVersion,
	enabled bool,
) (spec.Tool, error)

SetToolEnabled toggles one tool (identified by slug+version) and returns the updated object. Deriving the primary key from slug & version keeps the API parallel to the prompt store.

type BuiltInToolDataOption

type BuiltInToolDataOption func(*BuiltInToolData)

func WithLLMToolsGoBuiltins

func WithLLMToolsGoBuiltins(enabled bool) BuiltInToolDataOption

WithLLMToolsGoBuiltins enables importing Go builtin tool manifests from llmtools-go at runtime.

func WithToolBundlesFS

func WithToolBundlesFS(fsys fs.FS, rootDir string) BuiltInToolDataOption

type Option

type Option func(*ToolStore) error

Option configures a ToolStore instance.

func WithFTS

func WithFTS(enabled bool) Option

WithFTS toggles full-text search indexing.

type ToolStore

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

ToolStore provides CRUD, soft-delete and optional FTS for Tool bundles.

func NewToolStore

func NewToolStore(baseDir string, opts ...Option) (*ToolStore, error)

NewToolStore initialises a ToolStore rooted at baseDir.

func (*ToolStore) Close

func (ts *ToolStore) Close()

Close shuts down the background sweep.

func (*ToolStore) DeleteTool

func (ts *ToolStore) DeleteTool(
	ctx context.Context, req *spec.DeleteToolRequest,
) (*spec.DeleteToolResponse, error)

DeleteTool removes a tool version permanently.

func (*ToolStore) DeleteToolBundle

DeleteToolBundle performs soft delete (only if empty).

func (*ToolStore) GetTool

func (ts *ToolStore) GetTool(
	ctx context.Context, req *spec.GetToolRequest,
) (*spec.GetToolResponse, error)

GetTool retrieves a specific tool version.

func (*ToolStore) InvokeTool

func (ts *ToolStore) InvokeTool(
	ctx context.Context,
	req *spec.InvokeToolRequest,
) (*spec.InvokeToolResponse, error)

InvokeTool locates a tool version and executes it according to its type. - Validates struct (validateTool), bundle/tool enabled state. - Dispatches to HTTP or Go runner with functional options constructed from the request body.

func (*ToolStore) ListToolBundles

func (ts *ToolStore) ListToolBundles(
	ctx context.Context, req *spec.ListToolBundlesRequest,
) (*spec.ListToolBundlesResponse, error)

ListToolBundles returns bundles with filtering & pagination.

func (*ToolStore) ListTools

func (ts *ToolStore) ListTools(
	ctx context.Context, req *spec.ListToolsRequest,
) (*spec.ListToolsResponse, error)

ListTools enumerates every stored tool version subject to filters.

func (*ToolStore) PatchTool

func (ts *ToolStore) PatchTool(
	ctx context.Context, req *spec.PatchToolRequest,
) (*spec.PatchToolResponse, error)

PatchTool toggles enabled flag on a tool version.

func (*ToolStore) PatchToolBundle

func (ts *ToolStore) PatchToolBundle(
	ctx context.Context, req *spec.PatchToolBundleRequest,
) (*spec.PatchToolBundleResponse, error)

PatchToolBundle toggles the enabled flag.

func (*ToolStore) PutTool

func (ts *ToolStore) PutTool(
	ctx context.Context, req *spec.PutToolRequest,
) (*spec.PutToolResponse, error)

PutTool creates a new tool version (immutable). Only HTTPImpl function tools are allowed to be added as of now.

func (*ToolStore) PutToolBundle

func (ts *ToolStore) PutToolBundle(
	ctx context.Context, req *spec.PutToolBundleRequest,
) (*spec.PutToolBundleResponse, error)

PutToolBundle creates or replaces a bundle.

func (*ToolStore) SearchTools

func (ts *ToolStore) SearchTools(
	ctx context.Context, req *spec.SearchToolsRequest,
) (*spec.SearchToolsResponse, error)

SearchTools executes a full-text query via FTS.

Jump to

Keyboard shortcuts

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