prompt

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package prompt compiles prompt fragments into provider-ready instructions.

Index

Constants

View Source
const ViewShapeGeneric = "generic"

Variables

This section is empty.

Functions

This section is empty.

Types

type Compiled

type Compiled struct {
	Fragments             []Fragment
	Document              string
	StablePrefix          string
	DynamicSuffix         string
	ProviderDocument      string
	ProviderStablePrefix  string
	ProviderDynamicSuffix string
}

type Compiler

type Compiler interface {
	Compile(context.Context, Request) (Compiled, error)
}

type Fragment

type Fragment struct {
	Kind            Kind
	Source          Source
	Stability       Stability
	Key             string
	Label           string
	Content         string
	ProviderContent string
}

func (Fragment) Validate

func (f Fragment) Validate() error

type Kind

type Kind string
const (
	KindPolicy   Kind = "policy"
	KindRole     Kind = "role"
	KindTooling  Kind = "tooling"
	KindRepo     Kind = "repo"
	KindMemory   Kind = "memory"
	KindRuntime  Kind = "runtime"
	KindMetadata Kind = "metadata"
)

type Request

type Request struct {
	Fragments []Fragment
}

type Shaper

type Shaper interface {
	Shape(context.Context, Compiled) (View, error)
}

type Source

type Source string
const (
	SourceBuiltin Source = "builtin"
	SourceGlobal  Source = "global"
	SourceProject Source = "project"
	SourceRuntime Source = "runtime"
	SourceSession Source = "session"
	SourceUser    Source = "user"
)

type Stability

type Stability string
const (
	StabilityStable  Stability = "stable"
	StabilityDynamic Stability = "dynamic"
)

type StaticCompiler

type StaticCompiler struct{}

func NewStaticCompiler

func NewStaticCompiler() StaticCompiler

func (StaticCompiler) Compile

func (StaticCompiler) Compile(_ context.Context, req Request) (Compiled, error)

type StaticShaper

type StaticShaper struct{}

func NewShaper

func NewShaper() StaticShaper

func (StaticShaper) Shape

func (StaticShaper) Shape(_ context.Context, compiled Compiled) (View, error)

type View

type View struct {
	Shape           string
	Instructions    string
	CacheablePrefix string
	DynamicSuffix   string
}

Jump to

Keyboard shortcuts

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