Documentation
¶
Overview ¶
Package session holds the product-neutral conversational working state that helps resolve requests such as "move it to Friday": the focused entity, the current selection, sidebar pins, and the pending and previous actions.
It stores stable entity references, never rendered snapshots. Products define entity types and key names ("happening" + spaceID/happeningID in Sneat, "recordset" + ... in DataTug).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
Kind string `json:"kind"` // e.g. "calendar.reschedule_happening"
Target *EntityRef `json:"target,omitempty"`
Args map[string]string `json:"args,omitempty"`
// Summary is the human confirmation text ("Move Dentist to Fri 16:00?").
Summary string `json:"summary,omitempty"`
// Undo, when set, is the action that reverses this one.
Undo *Action `json:"undo,omitempty"`
}
Action is a semantic, product-defined operation (never a storage write).
type EntityRef ¶
type EntityRef struct {
Type string `json:"type" yaml:"type"`
Keys map[string]string `json:"keys" yaml:"keys"` // e.g. {"spaceID": "...", "happeningID": "..."}
// Title is a display hint for prompts and the sidebar. It may be stale;
// products re-resolve the entity by Keys before acting on it.
Title string `json:"title,omitempty" yaml:"title,omitempty"`
}
EntityRef is a stable reference to a product entity.
type State ¶
type State struct {
Focused *EntityRef `json:"focused,omitempty"`
Selection []EntityRef `json:"selection,omitempty"`
Sidebar []EntityRef `json:"sidebar,omitempty"`
// Pending is an action awaiting user confirmation.
Pending *Action `json:"pending,omitempty"`
// Previous is the last executed action (for "undo", "that").
Previous *Action `json:"previous,omitempty"`
PreviousAt time.Time `json:"previousAt,omitzero"`
// LastShown are the entities of the most recent structured output, in
// display order, so "the second one" can resolve.
LastShown []EntityRef `json:"lastShown,omitempty"`
}
State is the working context of one chat session.
func (*State) Candidates ¶
Candidates returns the entities a pronoun ("it", "that") most plausibly refers to, most likely first: focused, selection, the sole last-shown entity, the previous action's target, then sidebar pins (newest first). Duplicates are removed. Products filter by type.