spec

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PromptBundlesMetaFileName      = "prompts.bundles.json"
	PromptDBFileName               = "prompts.fts.sqlite"
	PromptBuiltInOverlayDBFileName = "promptsbuiltin.overlay.sqlite"

	// BasePromptBundleID Reserved writable bundle that acts as the default scratch-pad for user prompts.
	BasePromptBundleID          bundleitemutils.BundleID   = "019d2a53-964e-7700-b8b7-24573c722142"
	BasePromptBundleSlug        bundleitemutils.BundleSlug = "base"
	BasePromptBundleDisplayName                            = "Base"
	BasePromptBundleDescription                            = "Editable starter bundle for custom prompts."

	// SchemaVersion is the current on-disk schema version.
	SchemaVersion = "2025-07-01"
)

Variables

View Source
var (
	ErrInvalidRequest = errors.New("invalid request")
	ErrInvalidDir     = errors.New("invalid directory")
	ErrConflict       = errors.New("resource already exists")

	ErrBuiltInBundleNotFound = errors.New("bundle not found in built-in data")
	ErrBundleNotFound        = errors.New("bundle not found")
	ErrBundleDisabled        = errors.New("bundle is disabled")
	ErrBundleDeleting        = errors.New("bundle is being deleted")
	ErrBundleNotEmpty        = errors.New("bundle still contains templates")
	ErrTemplateNotFound      = errors.New("template not found")

	ErrReservedBundleReadOnly = errors.New("reserved bundle metadata is read-only")
	ErrBuiltInReadOnly        = errors.New("built-in resource is read-only")

	ErrFTSDisabled = errors.New("FTS is disabled")
)

Functions

This section is empty.

Types

type AllBundles

type AllBundles struct {
	Bundles map[bundleitemutils.BundleID]PromptBundle `json:"bundles"`
}

type BundlePageToken

type BundlePageToken struct {
	BundleIDs       []bundleitemutils.BundleID `json:"ids,omitempty"` //nolint:tagliatelle // Pagetoken specific. optional filter
	IncludeDisabled bool                       `json:"d,omitempty"`   //nolint:tagliatelle // Pagetoken specific. include disabled bundles?
	PageSize        int                        `json:"s"`             //nolint:tagliatelle // Pagetoken specific. page size
	CursorMod       string                     `json:"t,omitempty"`   //nolint:tagliatelle // Pagetoken specific. RFC-3339-nano
	CursorID        bundleitemutils.BundleID   `json:"id,omitempty"`  //nolint:tagliatelle // Pagetoken specific.
}

type DeletePromptBundleRequest

type DeletePromptBundleRequest struct {
	BundleID bundleitemutils.BundleID `path:"bundleID" required:"true"`
}

type DeletePromptBundleResponse

type DeletePromptBundleResponse struct{}

type DeletePromptTemplateRequest

type DeletePromptTemplateRequest struct {
	BundleID     bundleitemutils.BundleID    `path:"bundleID"     required:"true"`
	TemplateSlug bundleitemutils.ItemSlug    `path:"templateSlug" required:"true"`
	Version      bundleitemutils.ItemVersion `path:"version"      required:"true"`
}

type DeletePromptTemplateResponse

type DeletePromptTemplateResponse struct{}

type GetPromptTemplateRequest

type GetPromptTemplateRequest struct {
	BundleID     bundleitemutils.BundleID    `path:"bundleID"     required:"true"`
	TemplateSlug bundleitemutils.ItemSlug    `path:"templateSlug" required:"true"`
	Version      bundleitemutils.ItemVersion `path:"version"      required:"true"`
}

type GetPromptTemplateResponse

type GetPromptTemplateResponse struct{ Body *PromptTemplate }

type ListPromptBundlesRequest

type ListPromptBundlesRequest struct {
	BundleIDs       []bundleitemutils.BundleID `query:"bundleIDs"`
	IncludeDisabled bool                       `query:"includeDisabled"`
	PageSize        int                        `query:"pageSize"`
	PageToken       string                     `query:"pageToken"`
}

type ListPromptBundlesResponse

type ListPromptBundlesResponse struct {
	Body *ListPromptBundlesResponseBody
}

type ListPromptBundlesResponseBody

type ListPromptBundlesResponseBody struct {
	PromptBundles []PromptBundle `json:"promptBundles"`
	NextPageToken *string        `json:"nextPageToken,omitempty"`
}

type ListPromptTemplatesRequest

type ListPromptTemplatesRequest struct {
	BundleIDs           []bundleitemutils.BundleID `query:"bundleIDs"`
	Tags                []string                   `query:"tags"`
	Kinds               []PromptTemplateKind       `query:"kinds"`
	OnlyResolved        bool                       `query:"onlyResolved"`
	IncludeDisabled     bool                       `query:"includeDisabled"`
	RecommendedPageSize int                        `query:"recommendedPageSize"`
	PageToken           string                     `query:"pageToken"`
}

type ListPromptTemplatesResponse

type ListPromptTemplatesResponse struct {
	Body *ListPromptTemplatesResponseBody
}

type ListPromptTemplatesResponseBody

type ListPromptTemplatesResponseBody struct {
	PromptTemplateListItems []PromptTemplateListItem `json:"promptTemplateListItems"`
	NextPageToken           *string                  `json:"nextPageToken,omitempty"`
}

type MessageBlock

type MessageBlock struct {
	ID      MessageBlockID `json:"id"`
	Role    PromptRoleEnum `json:"role"`
	Content string         `json:"content"`
}

MessageBlock - One role-tagged chunk of text.

type MessageBlockID

type MessageBlockID string

type PatchPromptBundleRequest

type PatchPromptBundleRequest struct {
	BundleID bundleitemutils.BundleID `path:"bundleID" required:"true"`
	Body     *PatchPromptBundleRequestBody
}

type PatchPromptBundleRequestBody

type PatchPromptBundleRequestBody struct {
	IsEnabled bool `json:"isEnabled" required:"true"`
}

type PatchPromptBundleResponse

type PatchPromptBundleResponse struct{}

type PatchPromptTemplateRequest

type PatchPromptTemplateRequest struct {
	BundleID     bundleitemutils.BundleID    `path:"bundleID"     required:"true"`
	TemplateSlug bundleitemutils.ItemSlug    `path:"templateSlug" required:"true"`
	Version      bundleitemutils.ItemVersion `path:"version"      required:"true"`
	Body         *PatchPromptTemplateRequestBody
}

type PatchPromptTemplateRequestBody

type PatchPromptTemplateRequestBody struct {
	IsEnabled bool `json:"isEnabled" required:"true"`
}

type PatchPromptTemplateResponse

type PatchPromptTemplateResponse struct{}

type PromptBundle

type PromptBundle struct {
	SchemaVersion string                     `json:"schemaVersion"`
	ID            bundleitemutils.BundleID   `json:"id"`
	Slug          bundleitemutils.BundleSlug `json:"slug"`

	DisplayName string `json:"displayName,omitempty"`
	Description string `json:"description,omitempty"`

	IsEnabled     bool       `json:"isEnabled"`
	CreatedAt     time.Time  `json:"createdAt"`
	ModifiedAt    time.Time  `json:"modifiedAt"`
	IsBuiltIn     bool       `json:"isBuiltIn"`
	SoftDeletedAt *time.Time `json:"softDeletedAt,omitempty"`
}

PromptBundle is a hard grouping & distribution unit.

type PromptRoleEnum

type PromptRoleEnum string
const (
	System    PromptRoleEnum = "system"
	Developer PromptRoleEnum = "developer"
	User      PromptRoleEnum = "user"
)

type PromptTemplate

type PromptTemplate struct {
	SchemaVersion string             `json:"schemaVersion"`
	Kind          PromptTemplateKind `json:"kind"`

	ID        bundleitemutils.ItemID   `json:"id"`
	Slug      bundleitemutils.ItemSlug `json:"slug"`
	IsEnabled bool                     `json:"isEnabled"`

	DisplayName string   `json:"displayName"`
	Description string   `json:"description,omitempty"`
	Tags        []string `json:"tags,omitempty"`

	// Ordered list of blocks that form the final prompt.
	Blocks []MessageBlock `json:"blocks"`
	// Declared placeholders.
	Variables []PromptVariable `json:"variables,omitempty"`

	// IsResolved is a backend-computed persisted property.
	//
	// True means all placeholders used by this template can be resolved using template-local variable information only,
	// with no external caller/user input required.
	//
	// Current resolution rules:
	//   - SourceStatic => resolved iff StaticVal is non-empty
	//   - SourceUser   => resolved iff Default is non-nil
	//
	// This field is computed and enforced by backend validation on put/read flows.
	IsResolved bool `json:"isResolved"`

	Version    bundleitemutils.ItemVersion `json:"version"`
	CreatedAt  time.Time                   `json:"createdAt"`
	ModifiedAt time.Time                   `json:"modifiedAt"`
	IsBuiltIn  bool                        `json:"isBuiltIn"`
}

type PromptTemplateKind added in v0.0.86

type PromptTemplateKind string
const (
	PromptTemplateKindInstructionsOnly PromptTemplateKind = "instructionsOnly"
	PromptTemplateKindGeneric          PromptTemplateKind = "generic"
)

type PromptTemplateListItem

type PromptTemplateListItem struct {
	BundleID        bundleitemutils.BundleID    `json:"bundleID"`
	BundleSlug      bundleitemutils.BundleSlug  `json:"bundleSlug"`
	TemplateSlug    bundleitemutils.ItemSlug    `json:"templateSlug"`
	TemplateVersion bundleitemutils.ItemVersion `json:"templateVersion"`
	Kind            PromptTemplateKind          `json:"kind"`
	IsResolved      bool                        `json:"isResolved"`
	IsBuiltIn       bool                        `json:"isBuiltIn"`
}

type PromptTemplateRef added in v0.0.86

type PromptTemplateRef struct {
	BundleID        bundleitemutils.BundleID    `json:"bundleID"`
	TemplateSlug    bundleitemutils.ItemSlug    `json:"templateSlug"`
	TemplateVersion bundleitemutils.ItemVersion `json:"templateVersion"`
}

type PromptVariable

type PromptVariable struct {
	Name        string    `json:"name"`
	Type        VarType   `json:"type"`
	Required    bool      `json:"required"`
	Source      VarSource `json:"source"`
	Description string    `json:"description,omitempty"`

	// SourceStatic.
	StaticVal string `json:"staticVal,omitempty"`
	// VarEnum.
	EnumValues []string `json:"enumValues,omitempty"`

	// Optional default for the var.
	Default *string `json:"default,omitempty"`
}

type PutPromptBundleRequest

type PutPromptBundleRequest struct {
	BundleID bundleitemutils.BundleID `path:"bundleID" required:"true"`
	Body     *PutPromptBundleRequestBody
}

type PutPromptBundleRequestBody

type PutPromptBundleRequestBody struct {
	Slug        bundleitemutils.BundleSlug `json:"slug"                  required:"true"`
	DisplayName string                     `json:"displayName"           required:"true"`
	IsEnabled   bool                       `json:"isEnabled"             required:"true"`
	Description string                     `json:"description,omitempty"`
}

type PutPromptBundleResponse

type PutPromptBundleResponse struct{}

type PutPromptTemplateRequest

type PutPromptTemplateRequest struct {
	BundleID     bundleitemutils.BundleID    `path:"bundleID"     required:"true"`
	TemplateSlug bundleitemutils.ItemSlug    `path:"templateSlug" required:"true"`
	Version      bundleitemutils.ItemVersion `path:"version"      required:"true"`
	Body         *PutPromptTemplateRequestBody
}

type PutPromptTemplateRequestBody

type PutPromptTemplateRequestBody struct {
	// Auto populate template id internally.
	Kind        PromptTemplateKind `json:"kind"                  required:"true"`
	DisplayName string             `json:"displayName"           required:"true"`
	IsEnabled   bool               `json:"isEnabled"             required:"true"`
	Description string             `json:"description,omitempty"`

	Blocks    []MessageBlock   `json:"blocks"              required:"true"`
	Tags      []string         `json:"tags,omitempty"`
	Variables []PromptVariable `json:"variables,omitempty"`

	IsResolved bool `json:"isResolved" required:"true"`
}

type PutPromptTemplateResponse

type PutPromptTemplateResponse struct{}

type TemplatePageToken

type TemplatePageToken struct {
	RecommendedPageSize int                        `json:"ps,omitempty"`   //nolint:tagliatelle // PageToken specific.
	IncludeDisabled     bool                       `json:"d,omitempty"`    //nolint:tagliatelle // PageToken specific.
	BundleIDs           []bundleitemutils.BundleID `json:"ids,omitempty"`  //nolint:tagliatelle // PageToken specific.
	Tags                []string                   `json:"tags,omitempty"` //nolint:tagliatelle // PageToken specific.
	BuiltInDone         bool                       `json:"bd,omitempty"`   //nolint:tagliatelle // PageToken specific.
	DirTok              string                     `json:"dt,omitempty"`   //nolint:tagliatelle // PageToken specific.
	Kinds               []PromptTemplateKind       `json:"k,omitempty"`    //nolint:tagliatelle // PageToken specific.
	OnlyResolved        bool                       `json:"r,omitempty"`    //nolint:tagliatelle // PageToken specific.
}

type VarSource

type VarSource string
const (
	// SourceUser: Ask UI / CLI.
	SourceUser VarSource = "user"
	// SourceStatic: Fixed literal.
	SourceStatic VarSource = "static"
)

type VarType

type VarType string
const (
	VarString  VarType = "string"
	VarNumber  VarType = "number"
	VarBoolean VarType = "boolean"
	VarEnum    VarType = "enum"
	VarDate    VarType = "date"
)

Jump to

Keyboard shortcuts

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