consolidateprompt

package
v0.0.40 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: Apache-2.0 Imports: 13 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 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

View Source
const AnswerNow = "" /* 135-byte string literal not displayed */

AnswerNow is the turn a session gets when its reply cannot be read, with why.

Variables

View Source
var Consolidate string

Consolidate is the skill of step 3: one area's near-duplicate entries merged, rules moved and answered questions dropped.

View Source
var Lift string

Lift is the skill of step 4: which groups of rules repeated across areas are one rule the product keeps.

View Source
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

Names is g's capabilities, comma-separated.

func Shown

func Shown(groups []repeats.RuleGroup) (shown []string, each [][]string)

Shown is the ids of groups' rules a lift session is shown, and each group's.

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 AreaMove

type AreaMove struct {
	ID  string `json:"id"`
	To  string `json:"to"`
	Why string `json:"why"`
}

AreaMove moves a rule to another capability of its area.

type AreaReply

type AreaReply struct {
	Merge  []AreaMerge
	Move   []AreaMove
	Drop   []AreaDrop
	Faults []Fault
}

AreaReply is step 3's reply as read.

func ParseArea

func ParseArea(text string) (AreaReply, error)

ParseArea reads step 3's reply, as ParseMerge does.

func (AreaReply) Choices

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

type Fault struct {
	Item   string `json:"item"`
	Reason string `json:"reason"`
}

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 LiftReply

type LiftReply struct {
	Lift   []LiftItem
	Faults []Fault
}

LiftReply is step 4's reply as read.

func ParseLift

func ParseLift(text string) (LiftReply, error)

ParseLift reads step 4's reply, as ParseMerge does.

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.

func (MergeItem) Check

func (m MergeItem) Check(groups []repeats.CapabilityGroup) string

Check says why m is refused against the candidate groups its session was given: fewer than two capabilities, or not all in one group; empty when it is not.

type MergeReply

type MergeReply struct {
	Merge  []MergeItem
	Faults []Fault
}

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.

Jump to

Keyboard shortcuts

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