schema

package
v1.2.1 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: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const MemoryListMax uint64 = 100

MemoryListMax is the most memories which are listed at once

Variables

Fields are the fields, in the order they're described

Functions

This section is empty.

Types

type Detail added in v1.0.0

type Detail struct {
	Value    string `json:"value,omitempty" help:"The detail, such as a name"`
	Declined bool   `json:"declined,omitempty" help:"The person declined to say it, so it isn't in the system prompt"`
}

Detail is what's known of a field: its value, or that the person declined to say it, so it isn't in the system prompt. A field which isn't known, as it was never said, or was forgotten, has no detail.

func (Detail) Validate added in v1.0.0

func (d Detail) Validate(field Field) (Detail, error)

Validate returns the detail of the field, with its value trimmed, or ErrBadParameter when it has a value and is declined, or has neither, or its value isn't valid for the field, such as a time zone which isn't known

type DetailRow added in v1.0.0

type DetailRow struct {
	Field  Field
	Detail *Detail
}

DetailRow is a field, and its detail, which is nil when it isn't known, as a row of a table

func (DetailRow) Cell added in v1.0.0

func (r DetailRow) Cell(col int) tui.CellText

Cell returns the field, whether its detail is known, declined, or not known, and its value, when it's known

func (DetailRow) Header added in v1.0.0

func (DetailRow) Header() []string

func (DetailRow) Width added in v1.0.0

func (DetailRow) Width(int) int

type Details added in v1.0.0

type Details struct {
	Name      *Detail `json:"name,omitempty" help:"The person's name"`
	Assistant *Detail `json:"assistant,omitempty" help:"The assistant's name"`
	Location  *Detail `json:"location,omitempty" help:"Where the person is, such as their city"`
	Timezone  *Detail `json:"timezone,omitempty" help:"The person's time zone, by its IANA name, such as Europe/Berlin"`
	Language  *Detail `json:"language,omitempty" help:"The language the person speaks"`
}

Details are the details which the memory keeps, each of which is nil when it isn't known

func (Details) Get added in v1.0.0

func (d Details) Get(field Field) *Detail

Get returns the detail of the field, or nil when it isn't known

func (Details) Rows added in v1.0.0

func (d Details) Rows() []DetailRow

Rows returns each field, and its detail, in the order of the fields

func (*Details) Set added in v1.0.0

func (d *Details) Set(field Field, detail *Detail) error

Set sets the detail of the field, which forgets it, when it's nil, so it isn't known. Returns ErrBadParameter when the field, or the detail, isn't valid.

func (Details) String added in v1.0.0

func (d Details) String() string

func (Details) Validate added in v1.0.0

func (d Details) Validate() error

Validate returns ErrBadParameter when a detail isn't valid

func (Details) Value added in v1.0.0

func (d Details) Value(field Field) (string, bool)

Value returns the value of the field, and whether it's known, and not declined

func (Details) Zone added in v1.0.0

func (d Details) Zone() *time.Location

Zone returns the person's time zone, or nil when it isn't known, or they declined to say it

type Field added in v1.0.0

type Field string

Field is a detail which the memory keeps, about the person who's being talked to, or the assistant, such as their name

const (
	FieldName      Field = "name"
	FieldAssistant Field = "assistant"
	FieldLocation  Field = "location"
	FieldTimezone  Field = "timezone"
	FieldLanguage  Field = "language"
)

func ParseField added in v1.0.0

func ParseField(name string) (Field, error)

ParseField returns the field with the name, such as location, or ErrBadParameter when there's none

func (Field) Valid added in v1.0.0

func (f Field) Valid() bool

Valid returns whether the field is one of the fields

type Memory

type Memory struct {
	MemoryMeta
	Version  string    `` /* 183-byte string literal not displayed */
	Created  time.Time `json:"created,omitzero" readonly:"" help:"When it was remembered"`
	Modified time.Time `json:"modified,omitzero" readonly:"" help:"When it was last changed"`
}

Memory is what's remembered, its version, which is one when it's remembered, and one more each time it's changed, and when it was remembered, and last changed

func (Memory) Cell added in v1.0.0

func (m Memory) Cell(col int) tui.CellText

Cell returns the memory's key, description, and when it was last changed, in local time

func (Memory) Header added in v1.0.0

func (Memory) Header() []string

func (Memory) Matches added in v1.0.0

func (m Memory) Matches(q string) bool

Matches returns whether the memory has each word of the query, in its key, description or body, in any case, which every memory does, when there are none

func (Memory) String added in v1.0.0

func (m Memory) String() string

func (Memory) Width added in v1.0.0

func (Memory) Width(int) int

func (Memory) WithoutLine added in v1.0.0

func (m Memory) WithoutLine(line string) (string, bool)

WithoutLine returns the body without the lines which are the line, apart from the space around them, and a bullet, such as "- ", and whether there were any

type MemoryEvent added in v1.0.0

type MemoryEvent struct {
	Version string `json:"version" help:"Version of the memory, as it is now"`
}

MemoryEvent is the data of an event of a memory, which was created, or updated: its version

type MemoryForgetRequest added in v1.0.0

type MemoryForgetRequest struct {
	Line string `json:"line,omitempty" help:"A line of the memory's body to forget, rather than the whole memory" optional:""`
}

MemoryForgetRequest is what's forgotten of a memory: a line of it, or all of it

type MemoryList

type MemoryList struct {
	MemoryListRequest
	Count uint     `json:"count" help:"How many memories match"`
	Body  []Memory `json:"body,omitzero" help:"The memories"`
}

MemoryList is the memories which are listed, the most recently changed first, and how many there are

func (MemoryList) String added in v1.0.0

func (l MemoryList) String() string

type MemoryListRequest

type MemoryListRequest struct {
	Q      string  `` /* 128-byte string literal not displayed */
	Offset uint64  `json:"offset,omitempty" help:"How many memories to skip" optional:""`
	Limit  *uint64 `json:"limit,omitempty" help:"Most memories to return" optional:""`
}

MemoryListRequest is which memories are listed: those which match the query, when there is one, from the offset, and at most the limit of them

func (MemoryListRequest) Page added in v1.0.0

func (r MemoryListRequest) Page(memories []Memory) MemoryList

Page returns the memories of the request's page, from its offset, and at most its limit, or MemoryListMax, of them, and how many there are

func (MemoryListRequest) Query

func (r MemoryListRequest) Query() url.Values

Query returns the request as URL query values

func (MemoryListRequest) String added in v1.0.0

func (r MemoryListRequest) String() string

type MemoryMeta

type MemoryMeta struct {
	Key         string `json:"key" help:"Key of the memory, which is an identifier, such as kitchen_lights" example:"kitchen_lights"`
	Description string `json:"description" help:"A line which describes what's remembered" example:"Which lights are in the kitchen"`
	Body        string `json:"body" help:"What's remembered, as Markdown"`
}

MemoryMeta is what's remembered: its key, which identifies it, a line which describes it, and its body

func (MemoryMeta) Hash added in v1.0.0

func (m MemoryMeta) Hash() string

Hash returns the version of what's remembered, which is a hash of its description and body, so it changes when either does, however they're changed, such as by hand, and is never the version of a memory with other content

func (MemoryMeta) Validate added in v1.0.0

func (m MemoryMeta) Validate() (MemoryMeta, error)

Validate returns the memory, with its key, description and body trimmed, or ErrBadParameter when its key isn't an identifier, or it has no description, or body

type MemoryRequest added in v1.0.0

type MemoryRequest struct {
	Description string `json:"description" help:"A line which describes what's remembered" example:"Which lights are in the kitchen"`
	Body        string `json:"body" help:"What's remembered, as Markdown, which replaces all of what was remembered under the key"`
	Version     string `json:"version,omitempty" help:"Version of the memory which it replaces, or none, to remember a new memory" optional:""`
}

MemoryRequest is a memory to remember, under the key its path has: its description and body, and the version of the memory it replaces, or none, to remember a new memory

Jump to

Keyboard shortcuts

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