store

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 20 Imported by: 0 modules, 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

Overview

Package store persists percepts, decisions and memory in PostgreSQL.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotTheirs = errors.New("this database holds someone else's memory")

Functions

This section is empty.

Types

type Backup

type Backup struct {
	Format  int           `json:"format"`
	Whose   string        `json:"whose"`
	Version int64         `json:"version"` // the newest migration it was made at
	At      time.Time     `json:"at"`
	Tables  []BackupTable `json:"tables"`
}

func Restore

func Restore(ctx context.Context, url string, r io.ReaderAt, size int64) (Backup, error)

Restore loads a backup into the database at url, which must have nothing in it yet: at the backup's version, then migrated to this Tinio's.

func (Backup) Rows

func (b Backup) Rows() int64

type BackupTable

type BackupTable struct {
	Name    string   `json:"name"`
	Columns []string `json:"columns"`
	Rows    int64    `json:"rows"`
}

type Counts

type Counts struct {
	Facts, SelfFacts, People, Intentions, Projects, Works, Percepts, Decisions int
}

type DayCost

type DayCost struct {
	Day     string // YYYY-MM-DD
	CostUSD float64
	Count   int
}

type Example

type Example struct {
	DecisionID ulid.ULID
	SetID      string // the set and version that decided, e.g. "incoming_message@1"
	Text       string
	Answer     decision.Answer
	Label      string
}

type FactView

type FactView struct {
	memory.Fact
	Public  *bool // whether it may go on the profile; nil: not decided (or not its own)
	AskedAt *time.Time
}

type LogEntry

type LogEntry struct {
	decision.Decision
	Source, Kind, Text, Speaker string // the percept's; "" for a decision of the agent's own
}

type Store

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

func Open

func Open(ctx context.Context, url string) (*Store, error)

func (*Store) Actions

func (s *Store) Actions(ctx context.Context, statuses []string, limit int) ([]memory.Action, error)

Actions returns, oldest first, up to limit actions with one of statuses.

func (*Store) ActionsSince

func (s *Store) ActionsSince(ctx context.Context, since time.Time) (int, error)

func (*Store) ActiveProjects

func (s *Store) ActiveProjects(ctx context.Context, limit int) ([]memory.Project, error)

ActiveProjects returns up to limit active projects, most recently worked on first.

func (*Store) AddPersonIfNew

func (s *Store) AddPersonIfNew(ctx context.Context, p memory.Person) (bool, error)

AddPersonIfNew is for what the agent was born knowing: memory, once formed, wins over the file it came from.

func (*Store) AddSkill

func (s *Store) AddSkill(ctx context.Context, sk memory.Skill) error

AddSkill does nothing if it already has the skill.

func (*Store) AdvancePlan

func (s *Store) AdvancePlan(ctx context.Context, plan ulid.ULID, at time.Time) error

AdvancePlan finishes a plan's current stage and moves to the next, or marks the plan done after its last.

func (*Store) AgentSkills

func (s *Store) AgentSkills(ctx context.Context) ([]memory.AgentSkill, error)

AgentSkills are the skills it has, with their files, by name.

func (*Store) Agreement

func (s *Store) Agreement(ctx context.Context, n int) ([]memory.Agreement, error)

Agreement is over the latest n answered calls of each type.

func (*Store) AgreementByStakes

func (s *Store) AgreementByStakes(ctx context.Context, n int) ([]memory.Agreement, error)

AgreementByStakes is by what the calls put at stake ("low", "medium", "high"; "low, can't undo", ...), over the latest n answered at each level.

func (*Store) AllFacts

func (s *Store) AllFacts(ctx context.Context, limit int) ([]FactView, error)

AllFacts returns up to limit facts, newest first.

func (*Store) AllPeople

func (s *Store) AllPeople(ctx context.Context, limit int) ([]memory.Person, error)

AllPeople returns everyone the agent knows, oldest acquaintance first.

func (*Store) AllProjects

func (s *Store) AllProjects(ctx context.Context, limit int) ([]memory.Project, error)

AllProjects returns up to limit projects, most recently worked on first.

func (*Store) AnswerCall

func (s *Store) AnswerCall(ctx context.Context, c memory.Call, asCase bool) (bool, error)

AnswerCall records c's OwnerPick, OwnerChoice, OwnerReason, AnsweredBy, AnsweredAt and Waiting. With asCase, the answer is also kept as one of their decisions (approved: it's theirs). It returns false if already answered.

func (*Store) Approval

func (s *Store) Approval(ctx context.Context, id ulid.ULID) (memory.Approval, bool, error)

func (*Store) AskedForReview

func (s *Store) AskedForReview(ctx context.Context, since time.Time) (memory.Work, bool, error)

func (*Store) AutonomyRules

func (s *Store) AutonomyRules(ctx context.Context) (map[string]string, error)

AutonomyRules returns the owner's newest change per class.

func (*Store) AwaitIntention

func (s *Store) AwaitIntention(ctx context.Context, id ulid.ULID) error

func (*Store) AwaitWorkPublic

func (s *Store) AwaitWorkPublic(ctx context.Context, id ulid.ULID) error

AwaitWorkPublic marks an undecided work as judged public but waiting for the owner's approval, so the daily check doesn't ask about it again.

func (*Store) Backup

func (s *Store) Backup(ctx context.Context, w io.Writer, at time.Time) (Backup, error)

Backup writes everything as it is at one moment, so the agent can keep running while it's made.

func (*Store) Call

func (s *Store) Call(ctx context.Context, id ulid.ULID) (memory.Call, bool, error)

func (*Store) CallsAskedSince

func (s *Store) CallsAskedSince(ctx context.Context, mode string, since time.Time) (int, error)

func (*Store) CallsToLookBack

func (s *Store) CallsToLookBack(ctx context.Context, types []string, from, to time.Time, limit int) ([]memory.Call, error)

CallsToLookBack returns calls not looked back on yet, oldest first: what its weekly review judges.

func (*Store) Close

func (s *Store) Close()

func (*Store) Conversations

func (s *Store) Conversations(ctx context.Context) ([]memory.Conversation, error)

Conversations returns, for each person who has messaged the agent, the thread of their latest message and when anything was last said in it.

func (*Store) CostByDay

func (s *Store) CostByDay(ctx context.Context, since time.Time, zone *time.Location) ([]DayCost, error)

CostByDay returns each day since the given time, in zone, oldest first.

func (*Store) CostSince

func (s *Store) CostSince(ctx context.Context, since time.Time, actions []string) (float64, error)

func (*Store) Counts

func (s *Store) Counts(ctx context.Context) (Counts, error)

func (*Store) DecideApproval

func (s *Store) DecideApproval(ctx context.Context, id ulid.ULID, status string, at time.Time) (bool, error)

DecideApproval reports whether it was still pending: an approval is decided once.

func (*Store) DecisionChain

func (s *Store) DecisionChain(ctx context.Context, id ulid.ULID) ([]LogEntry, error)

DecisionChain returns the decision with id and every decision about the same percept (or, for one of the agent's own, its children), oldest first.

func (*Store) DecisionLog

func (s *Store) DecisionLog(ctx context.Context, after time.Time, limit int, newestFirst bool) ([]LogEntry, error)

DecisionLog returns decisions after the given time: oldest first when following the log live, newest first for a page of history.

func (*Store) DeleteFact

func (s *Store) DeleteFact(ctx context.Context, id ulid.ULID) (bool, error)

func (*Store) Dreams

func (s *Store) Dreams(ctx context.Context, activeOnly bool) ([]memory.Dream, error)

Dreams returns its dreams, oldest first.

func (*Store) DueIntentions

func (s *Store) DueIntentions(ctx context.Context, now time.Time, limit int) ([]memory.Intention, error)

DueIntentions returns pending intentions due by now, earliest first.

func (*Store) EndPlan

func (s *Store) EndPlan(ctx context.Context, plan ulid.ULID, status string, at time.Time) error

func (*Store) ExpireCall

func (s *Store) ExpireCall(ctx context.Context, id ulid.ULID) (bool, error)

ExpireCall returns whether it was still asked.

func (*Store) FinishIntention

func (s *Store) FinishIntention(ctx context.Context, id ulid.ULID, status, result string, at time.Time) error

func (*Store) FinishResource

func (s *Store) FinishResource(ctx context.Context, id, work ulid.ULID, title string, at time.Time) error

func (*Store) Found

func (s *Store) Found(ctx context.Context, url string) (search.Result, bool, error)

func (*Store) GiveCallReason

func (s *Store) GiveCallReason(ctx context.Context, id ulid.ULID, reason string, at time.Time) error

GiveCallReason also sets the reason on the case the call became, and stops waiting for one.

func (*Store) Goals

func (s *Store) Goals(ctx context.Context, activeOnly bool) ([]memory.Goal, error)

Goals returns its goals, oldest first.

func (*Store) Intention

func (s *Store) Intention(ctx context.Context, id ulid.ULID) (memory.Intention, bool, error)

func (*Store) IntentionWork

func (s *Store) IntentionWork(ctx context.Context, intention ulid.ULID) (memory.Work, bool, error)

func (*Store) IntentionsDue

func (s *Store) IntentionsDue(ctx context.Context, from, to time.Time) ([]memory.Intention, error)

IntentionsDue returns those due in [from, to), whatever their status, earliest first.

func (*Store) JudgmentCases

func (s *Store) JudgmentCases(ctx context.Context, status string, types []string) ([]memory.JudgmentCase, error)

JudgmentCases returns oldest first; status "" is all, and no types is all types.

func (*Store) KnownPeople

func (s *Store) KnownPeople(ctx context.Context, limit int) ([]memory.Person, error)

KnownPeople returns everyone whose relation is known, oldest acquaintance first.

func (*Store) LabelledExamples

func (s *Store) LabelledExamples(ctx context.Context, setID, question string, limit int) ([]Example, error)

LabelledExamples returns the newest decisions of setID (any version) with a label on question.

func (*Store) Labels

func (s *Store) Labels(ctx context.Context, decisions []ulid.ULID) ([]memory.Label, error)

func (*Store) LastFrom

func (s *Store) LastFrom(ctx context.Context, source string) (string, bool, error)

LastFrom is the text of the newest percept from source; false if none.

func (*Store) LastRead

func (s *Store) LastRead(ctx context.Context, setID, source, thread string, before time.Time) (ulid.ULID, bool, error)

LastRead returns the newest decision of setID (any version) on a message in source's thread before before: the agent's read of the message before the one it is answering.

func (*Store) LastSpokeFirst

func (s *Store) LastSpokeFirst(ctx context.Context, person, kind string) (time.Time, bool, error)

LastSpokeFirst is when the agent last spoke first to person with a percept of kind (a reminder or a check-in), and whether it ever did.

func (*Store) LatestWork

func (s *Store) LatestWork(ctx context.Context, kind string) (memory.Work, bool, error)

func (*Store) Lessons

func (s *Store) Lessons(ctx context.Context, skill string, limit int) ([]memory.Lesson, error)

Lessons returns active lessons, newest first; all skills' if skill is "".

func (*Store) LogWeb

func (s *Store) LogWeb(ctx context.Context, kind, what string, costUSD float64, at time.Time) error

func (*Store) MarkApprovalSent

func (s *Store) MarkApprovalSent(ctx context.Context, id ulid.ULID, message []byte, at time.Time) error

func (*Store) MarkCallAsked

func (s *Store) MarkCallAsked(ctx context.Context, id ulid.ULID, where json.RawMessage, at time.Time) error

func (*Store) MarkFactsAsked

func (s *Store) MarkFactsAsked(ctx context.Context, ids []ulid.ULID, at time.Time) error

func (*Store) MarkReviewAsked

func (s *Store) MarkReviewAsked(ctx context.Context, work ulid.ULID, at time.Time) error

func (*Store) OpenIntentions

func (s *Store) OpenIntentions(ctx context.Context, subject, kind string) ([]memory.Intention, error)

OpenIntentions returns the pending ones, earliest due first.

func (*Store) Person

func (s *Store) Person(ctx context.Context, key string) (memory.Person, bool, error)

func (*Store) Plans

func (s *Store) Plans(ctx context.Context, activeOnly bool) ([]memory.LearningPlan, error)

Plans returns its learning plans with their stages, oldest first.

func (*Store) PostponeIntention

func (s *Store) PostponeIntention(ctx context.Context, id ulid.ULID, due time.Time) error

func (*Store) Principles

func (s *Store) Principles(ctx context.Context, status string) ([]memory.Principle, error)

Principles returns priorities by rank, then the rest oldest first, with the keys of the cases behind them; status "" is all.

func (*Store) Profile

func (s *Store) Profile(ctx context.Context) (page []byte, inputs string, at time.Time, ok bool, err error)

Profile returns the page as JSON and a hash of what it was written from; ok is false if it never has been.

func (*Store) Project

func (s *Store) Project(ctx context.Context, id ulid.ULID) (memory.Project, bool, error)

func (*Store) ProjectWorks

func (s *Store) ProjectWorks(ctx context.Context, project ulid.ULID, limit int) ([]memory.Work, error)

ProjectWorks returns the newest works in a project, oldest first.

func (*Store) PublicFacts

func (s *Store) PublicFacts(ctx context.Context, limit int) ([]memory.Fact, error)

PublicFacts returns the newest public facts, oldest first. Facts about people are never among them.

func (*Store) PublicWork

func (s *Store) PublicWork(ctx context.Context, id ulid.ULID) (memory.Work, bool, error)

func (*Store) PublicWorks

func (s *Store) PublicWorks(ctx context.Context, limit int) ([]memory.Work, error)

func (*Store) RankPriority

func (s *Store) RankPriority(ctx context.Context, id ulid.ULID, rank int, at time.Time) (bool, error)

RankPriority shifts the others to make room, and returns whether there was such a priority. Rank 1 is first.

func (*Store) ReadingProject

func (s *Store) ReadingProject(ctx context.Context, source ulid.ULID) (memory.Project, bool, error)

ReadingProject returns the active project that follows a source.

func (*Store) RecallCandidates

func (s *Store) RecallCandidates(ctx context.Context, subjects, areas []string, limit int) ([]memory.Fact, error)

RecallCandidates returns facts sharing an area with areas first, then the rest, newest first within each group.

func (*Store) RecentActions

func (s *Store) RecentActions(ctx context.Context, limit int) ([]memory.Action, error)

func (*Store) RecentApprovals

func (s *Store) RecentApprovals(ctx context.Context, limit int) ([]memory.Approval, error)

RecentApprovals returns the pending approvals, oldest first, then the newest decided ones.

func (*Store) RecentCalls

func (s *Store) RecentCalls(ctx context.Context, status string, limit int) ([]memory.Call, error)

RecentCalls returns its latest calls, newest first; status "" is all.

func (*Store) RecentDecisions

func (s *Store) RecentDecisions(ctx context.Context, n int) ([]decision.Decision, error)

func (*Store) RecentEvidence

func (s *Store) RecentEvidence(ctx context.Context, skill string, limit int) ([]memory.Evidence, error)

RecentEvidence returns a skill's newest scores, newest first.

func (*Store) RecentExchanges

func (s *Store) RecentExchanges(ctx context.Context, source, thread string, since time.Time,
	exclude ulid.ULID, limit int) ([]memory.Exchange, error)

RecentExchanges is oldest first, with what the agent said first (reminders, check-ins). The percept being handled is left out.

func (*Store) RecentFacts

func (s *Store) RecentFacts(ctx context.Context, limit int) ([]memory.Fact, error)

RecentFacts returns up to limit facts, newest first.

func (*Store) RecentFound

func (s *Store) RecentFound(ctx context.Context, limit int) ([]search.Result, error)

RecentFound returns the newest pages its searches found, newest first.

func (*Store) RecentWorks

func (s *Store) RecentWorks(ctx context.Context, limit int) ([]memory.Work, error)

RecentWorks returns up to limit works, newest first.

func (*Store) RemoveAgentSkill

func (s *Store) RemoveAgentSkill(ctx context.Context, name string) (bool, error)

func (*Store) Resources

func (s *Store) Resources(ctx context.Context, plan ulid.ULID) ([]memory.Resource, error)

Resources returns a plan's resources, by stage and when they were added.

func (*Store) ResumeIntention

func (s *Store) ResumeIntention(ctx context.Context, id ulid.ULID, notBefore time.Time) error

ResumeIntention makes an intention that was waiting for approval pending again, due when it was or at notBefore, whichever is later.

func (*Store) RetireLesson

func (s *Store) RetireLesson(ctx context.Context, id ulid.ULID, at time.Time) error

func (*Store) RetireTaste

func (s *Store) RetireTaste(ctx context.Context, id ulid.ULID, at time.Time) (bool, error)

func (*Store) ReviewCase

func (s *Store) ReviewCase(ctx context.Context, id ulid.ULID, status, reason string, at time.Time) (bool, error)

ReviewCase keeps the reason when reason is empty. It returns whether there was such a case.

func (*Store) ReviewPrinciple

func (s *Store) ReviewPrinciple(ctx context.Context, id ulid.ULID, status, text string, at time.Time) (bool, error)

ReviewPrinciple keeps the text when text is empty. It returns whether there was such a principle.

func (*Store) SaveAction

func (s *Store) SaveAction(ctx context.Context, a memory.Action) error

func (*Store) SaveAgentSkill

func (s *Store) SaveAgentSkill(ctx context.Context, sk memory.AgentSkill) error

SaveAgentSkill replaces any skill of the same name, files and all.

func (*Store) SaveApproval

func (s *Store) SaveApproval(ctx context.Context, a memory.Approval) error

func (*Store) SaveAutonomyRule

func (s *Store) SaveAutonomyRule(ctx context.Context, class, verdict, by string, percept ulid.ULID, at time.Time) error

func (*Store) SaveCall

func (s *Store) SaveCall(ctx context.Context, c memory.Call) error

func (*Store) SaveCaseEmbedding

func (s *Store) SaveCaseEmbedding(ctx context.Context, id ulid.ULID, v []float32, model string) error

func (*Store) SaveDecision

func (s *Store) SaveDecision(ctx context.Context, d decision.Decision) error

func (*Store) SaveDream

func (s *Store) SaveDream(ctx context.Context, d memory.Dream) error

func (*Store) SaveEvidence

func (s *Store) SaveEvidence(ctx context.Context, e memory.Evidence) error

func (*Store) SaveFact

func (s *Store) SaveFact(ctx context.Context, f memory.Fact) error

func (*Store) SaveFound

func (s *Store) SaveFound(ctx context.Context, query string, rs []search.Result, at time.Time) error

func (*Store) SaveGoal

func (s *Store) SaveGoal(ctx context.Context, g memory.Goal) error

func (*Store) SaveIntention

func (s *Store) SaveIntention(ctx context.Context, i memory.Intention) error

func (*Store) SaveLabel

func (s *Store) SaveLabel(ctx context.Context, l memory.Label) error

SaveLabel replaces an earlier label for the same decision and question.

func (*Store) SaveLesson

func (s *Store) SaveLesson(ctx context.Context, l memory.Lesson) error

func (*Store) SavePercept

func (s *Store) SavePercept(ctx context.Context, p perception.Percept) (bool, error)

SavePercept reports whether p was new: one already seen from the same source (same ExternalID) is not stored again.

func (*Store) SavePerson

func (s *Store) SavePerson(ctx context.Context, p memory.Person) error

func (*Store) SavePlan

func (s *Store) SavePlan(ctx context.Context, p memory.LearningPlan) error

func (*Store) SavePrinciple

func (s *Store) SavePrinciple(ctx context.Context, p memory.Principle) error

func (*Store) SaveProfile

func (s *Store) SaveProfile(ctx context.Context, page []byte, inputs string, at time.Time) error

func (*Store) SaveProject

func (s *Store) SaveProject(ctx context.Context, p memory.Project) error

func (*Store) SaveResource

func (s *Store) SaveResource(ctx context.Context, r memory.Resource) error

func (*Store) SaveSelf

func (s *Store) SaveSelf(ctx context.Context, name string, vs ...memory.SelfVersion) error

SaveSelf adds new versions. name is the person's name in a life among them ("" if none): whose memory this is follows it.

func (*Store) SaveSource

func (s *Store) SaveSource(ctx context.Context, src memory.Source) (ulid.ULID, error)

SaveSource returns the ID already stored if the same URL was fetched before.

func (*Store) SaveTaste

func (s *Store) SaveTaste(ctx context.Context, t memory.Taste) error

func (*Store) SaveWork

func (s *Store) SaveWork(ctx context.Context, w memory.Work) error

func (*Store) SaveWorkEmbedding

func (s *Store) SaveWorkEmbedding(ctx context.Context, id ulid.ULID, v []float32, model string) error

func (*Store) Secrets

func (s *Store) Secrets(ctx context.Context) (map[string][]byte, error)

Secrets are sealed values by name.

func (*Store) SeedJudgment

func (s *Store) SeedJudgment(ctx context.Context, cases []memory.JudgmentCase, principles []memory.Principle) (int, int, error)

SeedJudgment adds its owner's judgment file as proposed: each case not seen before (by key), and each principle not seeded before (by its seed text, so an edited or rejected one isn't seeded again). It returns how many of each it added.

func (*Store) SeenFrom

func (s *Store) SeenFrom(ctx context.Context, source string) (bool, error)

SeenFrom is whether any percept from source has been kept.

func (*Store) Self

func (s *Store) Self(ctx context.Context, section string) (memory.SelfVersion, bool, error)

Self is the newest version of section; false if there is none.

func (*Store) SelfHistory

func (s *Store) SelfHistory(ctx context.Context, section string, limit int) ([]memory.SelfVersion, error)

SelfHistory is section's versions, newest first.

func (*Store) SetAction

func (s *Store) SetAction(ctx context.Context, id ulid.ULID, from []string, status, result string, at time.Time) (bool, error)

SetAction moves an action on: only from one of from, so a second tap or a late expiry can't move it again. It reports whether it moved.

func (*Store) SetFactAreas

func (s *Store) SetFactAreas(ctx context.Context, id ulid.ULID, areas []string) error

func (*Store) SetFactPublic

func (s *Store) SetFactPublic(ctx context.Context, id ulid.ULID, public bool) error

func (*Store) SetOutcome

func (s *Store) SetOutcome(ctx context.Context, id ulid.ULID, outcome, verdict, note, by string, at time.Time) (bool, error)

SetOutcome also records it on the owner's decision the call became. The owner's verdict stands: its review never overrides it. It returns whether it was recorded.

func (*Store) SetSecrets

func (s *Store) SetSecrets(ctx context.Context, sealed map[string][]byte, at time.Time) error

SetSecrets sets them all or none, each replacing what was there.

func (*Store) SetSkillLevel

func (s *Store) SetSkillLevel(ctx context.Context, name string, level float64, at time.Time) error

func (*Store) SetWorkData

func (s *Store) SetWorkData(ctx context.Context, id ulid.ULID, kind string, data json.RawMessage) error

func (*Store) SetWorkPublic

func (s *Store) SetWorkPublic(ctx context.Context, id ulid.ULID, public bool, by string) (bool, error)

SetWorkPublic reports whether the work was changed. The daily check (PublicBySystem1) never overrides its owner, and a work that may never be public can't be made public.

func (*Store) Skills

func (s *Store) Skills(ctx context.Context) ([]memory.Skill, error)

Skills returns its skills, by name.

func (*Store) SourceText

func (s *Store) SourceText(ctx context.Context, id ulid.ULID) (string, error)

func (*Store) StaleApprovals

func (s *Store) StaleApprovals(ctx context.Context, before time.Time, limit int) ([]memory.Approval, error)

StaleApprovals returns pending approvals asked before before, oldest first.

func (*Store) StaleCalls

func (s *Store) StaleCalls(ctx context.Context, before time.Time, limit int) ([]memory.Call, error)

func (*Store) Start

func (s *Store) Start(ctx context.Context, name string, vs []memory.SelfVersion, secrets map[string][]byte, skills []memory.AgentSkill,
	at time.Time) (bool, error)

Start makes the database someone's: their first versions, secrets and skills, all or nothing. It returns false, changing nothing, if a life is already here; ErrNotTheirs if the database was claimed by someone else.

func (*Store) Tastes

func (s *Store) Tastes(ctx context.Context, limit int) ([]memory.Taste, error)

Tastes returns those still true, newest first.

func (*Store) UnaskedFacts

func (s *Store) UnaskedFacts(ctx context.Context, person string, since time.Time, limit int) ([]memory.Fact, error)

UnaskedFacts returns facts the agent has not checked in about yet, newest first.

func (*Store) UndecidedPublicFacts

func (s *Store) UndecidedPublicFacts(ctx context.Context, limit int) ([]memory.Fact, error)

UndecidedPublicFacts are about the agent itself, oldest first.

func (*Store) UndecidedPublicWorks

func (s *Store) UndecidedPublicWorks(ctx context.Context, limit int) ([]memory.Work, error)

UndecidedPublicWorks returns works that may be public but haven't been decided on yet, oldest first.

func (*Store) UnlabelledFacts

func (s *Store) UnlabelledFacts(ctx context.Context, limit int) ([]memory.Fact, error)

UnlabelledFacts returns facts with no areas yet, oldest first.

func (*Store) UnsentApprovals

func (s *Store) UnsentApprovals(ctx context.Context, limit int) ([]memory.Approval, error)

UnsentApprovals returns pending approvals the owner hasn't been asked yet, oldest first.

func (*Store) UnsetSecret

func (s *Store) UnsetSecret(ctx context.Context, name string) (bool, error)

func (*Store) Vitals

func (s *Store) Vitals(ctx context.Context, since time.Time) (Vitals, error)

func (*Store) WaitForOwner

func (s *Store) WaitForOwner(ctx context.Context, id ulid.ULID, waiting string, at time.Time) error

func (*Store) WaitingCall

func (s *Store) WaitingCall(ctx context.Context, since time.Time) (memory.Call, bool, error)

func (*Store) WebLog

func (s *Store) WebLog(ctx context.Context, kind string, limit int) ([]WebEntry, error)

WebLog returns the last limit entries of kind, newest first.

func (*Store) WebSince

func (s *Store) WebSince(ctx context.Context, kind string, since time.Time) (int, error)

func (*Store) Whose

func (s *Store) Whose(ctx context.Context) (string, bool, error)

func (*Store) Work

func (s *Store) Work(ctx context.Context, id ulid.ULID) (memory.Work, bool, error)

func (*Store) WorksBetween

func (s *Store) WorksBetween(ctx context.Context, from, to time.Time) ([]memory.Work, error)

WorksBetween returns what the agent made in [from, to), oldest first.

func (*Store) WorksFor

func (s *Store) WorksFor(ctx context.Context, person string, limit int) ([]memory.Work, error)

WorksFor returns, newest first, the works it may bring up with person: those made for itself or for them, not its journal or reviews.

func (*Store) WorksMissingData

func (s *Store) WorksMissingData(ctx context.Context, kinds []string, limit int) ([]memory.Work, error)

WorksMissingData returns up to limit works of kinds that carry no data, newest first.

type Vitals

type Vitals struct {
	Decisions   int
	ByTier      map[string]int
	Escalations int // System 1 was unsure or only fairly sure
	CostUSD     float64
	AvgLatency  time.Duration // of decisions that took any time
}

type WebEntry

type WebEntry struct {
	What string    `json:"what"`
	At   time.Time `json:"at"`
}

Jump to

Keyboard shortcuts

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