resources

package
v0.107.23 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package resources owns LiveAgent-compatible prompt resources.

Index

Constants

View Source
const MaxPromptSize = 1 << 20

Variables

View Source
var (
	ErrConflict = errors.New("prompt revision conflict")
	ErrNotFound = errors.New("prompt template not found")
)

Functions

func CanonicalWorkdir

func CanonicalWorkdir(workdir string) (string, error)

Types

type AgentTemplate

type AgentTemplate struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Prompt      string `json:"prompt"`
	Enabled     bool   `json:"enabled"`
}

type ProjectPrompt

type ProjectPrompt struct {
	Workdir       string `json:"workdir"`
	SourceWorkdir string `json:"sourceWorkdir,omitempty"`
	Prompt        string `json:"prompt"`
	Strategy      string `json:"strategy"`
}

type PromptState

type PromptState struct {
	Revision  uint64                   `json:"revision"`
	Templates []AgentTemplate          `json:"templates"`
	Projects  map[string]ProjectPrompt `json:"-"`
}

type PromptStore

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

PromptStore is independent of provider settings and directory instruction files.

func OpenPrompts

func OpenPrompts(root string) (*PromptStore, error)

func (*PromptStore) Create

func (s *PromptStore) Create(item AgentTemplate, base *uint64) (PromptState, error)

func (*PromptStore) Delete

func (s *PromptStore) Delete(id string, base *uint64) (PromptState, error)

func (*PromptStore) Patch

func (s *PromptStore) Patch(id string, patch TemplatePatch) (PromptState, error)

func (*PromptStore) Replace

func (s *PromptStore) Replace(items []AgentTemplate, base *uint64) (PromptState, error)

func (*PromptStore) Resolve

func (s *PromptStore) Resolve(workdir string, override *ProjectPrompt) (global string, project ProjectPrompt, effective string, err error)

Resolve replaces only the global template layer, never system/brain/AGENTS rules.

func (*PromptStore) SetProject

func (s *PromptStore) SetProject(project ProjectPrompt, base *uint64) (PromptState, error)

func (*PromptStore) Snapshot

func (s *PromptStore) Snapshot() PromptState

type TemplatePatch

type TemplatePatch struct {
	Name         *string `json:"name,omitempty"`
	Description  *string `json:"description,omitempty"`
	Prompt       *string `json:"prompt,omitempty"`
	Enabled      *bool   `json:"enabled,omitempty"`
	BaseRevision *uint64 `json:"baseRevision,omitempty"`
}

Jump to

Keyboard shortcuts

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