Documentation
¶
Overview ¶
Package consolidateprompt holds the skills of init's consolidation, one for each step a session judges (merging capabilities that are one promise, consolidating one area's entries, lifting rules the whole product keeps), writes each session's message with every entry fenced as data, and reads each reply. A reply only names capabilities and entries by id: an item in another shape, or naming one its session was not given, is returned as a fault with why, never read.
Index ¶
- Constants
- Variables
- func AreaMessage(caps []capabilitytext.Capability) string
- func Fit[T any](system string, window int, items []T, msg func([]T) string) (batches [][]T, tooLarge []T)
- func LiftMessage(promise string, stated bool, caps []capabilitytext.Capability, ...) string
- func MergeMessage(caps []capabilitytext.Capability, groups []repeats.CapabilityGroup, every bool) string
- func Names(g repeats.CapabilityGroup) string
- func Shown(groups []repeats.RuleGroup) (shown []string, each [][]string)
- type AreaDrop
- type AreaMerge
- type AreaMove
- type AreaReply
- type Fault
- type LiftItem
- type LiftReply
- type MergeItem
- type MergeReply
Constants ¶
const AnswerNow = "" /* 135-byte string literal not displayed */
AnswerNow is the turn a session gets when its reply cannot be read, with why.
Variables ¶
var Consolidate string
Consolidate is the skill of step 3: one area's near-duplicate entries merged, rules moved and answered questions dropped.
var Lift string
Lift is the skill of step 4: which groups of rules repeated across areas are one rule the product keeps.
var Merge string
Merge is the skill of step 1: which candidate groups of capabilities from different areas are one promise.
Functions ¶
func AreaMessage ¶
func AreaMessage(caps []capabilitytext.Capability) string
AreaMessage is step 3's message for caps, capabilities of one area: each with its promise and its entries.
func Fit ¶
func Fit[T any](system string, window int, items []T, msg func([]T) string) (batches [][]T, tooLarge []T)
Fit lays items into batches whose messages each fit a session of system in window (recovering.Fits): all of them when they fit, else each half laid the same way. A single item whose message does not fit is returned in tooLarge, never sent.
func LiftMessage ¶
func LiftMessage(promise string, stated bool, caps []capabilitytext.Capability, groups []repeats.RuleGroup) string
LiftMessage is step 4's message: the product's promise, said not to be stated yet when stated is false, then each group's rules, found in caps, with their capability and area.
func MergeMessage ¶
func MergeMessage(caps []capabilitytext.Capability, groups []repeats.CapabilityGroup, every bool) string
MergeMessage is step 1's message: the capabilities, every one of caps when every is true, else only those of groups, by name, area and promise, then each candidate group with what joined it.
func Names ¶
func Names(g repeats.CapabilityGroup) string
Names is g's capabilities, comma-separated.
Types ¶
type AreaDrop ¶
type AreaDrop struct {
ID string `json:"id"`
AnsweredBy string `json:"answered_by"`
Why string `json:"why"`
}
AreaDrop drops a question another entry answers.
type AreaMerge ¶
type AreaMerge struct {
Keep string `json:"keep"`
Drop []string `json:"drop"`
Why string `json:"why"`
}
AreaMerge keeps one entry and drops others into it.
type AreaReply ¶
AreaReply is step 3's reply as read.
func (AreaReply) Choices ¶
func (r AreaReply) Choices(caps []capabilitytext.Capability) (consolidating.AreaChoices, []Fault)
Choices is r as the choices code applies to caps, the capabilities its session was given: every item naming an id or a capability not among them is a fault, never applied.
type Fault ¶
Fault is an item of a reply that is not in its wanted shape, or a key the skill does not ask for: it is never read.
type LiftItem ¶
type LiftItem struct {
Keep string `json:"keep"`
With []string `json:"with"`
Why string `json:"why"`
}
LiftItem is one lift step 4's session chose.
type MergeItem ¶
type MergeItem struct {
Capabilities []string `json:"capabilities"`
Name string `json:"name"`
PromiseOf string `json:"promise_of"`
Why string `json:"why"`
}
MergeItem is one merge step 1's session chose.
type MergeReply ¶
MergeReply is step 1's reply as read.
func ParseMerge ¶
func ParseMerge(text string) (MergeReply, error)
ParseMerge reads step 1's reply. The error, for a reply with no closed json block or one that is not an object, is what the answer-now turn names.