states

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// CookStates contains all the states for the Cook machine.
	CookStates = ssC
	// CookGroups contains all the state groups for the Cook machine.
	CookGroups = sgC
)
View Source
var CookSchema = SchemaMerge(

	ssllm.AgentLLMSchema,
	am.Schema{

		ssC.ErrIngredients: {},
		ssC.ErrCooking:     {},

		ssC.IngredientsReady: {},
		ssC.RecipeReady:      {Require: S{ssC.IngredientsReady}},
		ssC.StepCompleted:    {Multi: true},

		ssC.StoryJoke:               {},
		ssC.StoryWakingUp:           {Tags: S{ssbase.TagManual}},
		ssC.StoryIngredientsPicking: {Tags: S{ssbase.TagPrompt}},
		ssC.StoryRecipePicking:      {Tags: S{ssbase.TagPrompt}},
		ssC.StoryCookingStarted:     {Tags: S{ssbase.TagPrompt}},
		ssC.StoryMealReady: {
			Tags:   S{ssbase.TagPrompt, ssbase.TagManual},
			Remove: S{ssC.InputPending},
		},
		ssC.StoryMemoryWipe: {Tags: S{ssbase.TagPrompt}},
		ssC.StoryStartAgain: {Tags: S{ssbase.TagPrompt}},

		ssC.RestoreJokes: {
			Auto:    true,
			Require: S{ssC.DBReady, ssC.CharacterReady},
			Remove:  sgC.Jokes,
		},
		ssC.GenJokes: {
			Require: S{ssC.CharacterReady, ssC.DBReady},
			Remove:  sgC.Jokes,
			Tags:    S{ssbase.TagPrompt},
		},
		ssC.JokesReady: {Remove: sgC.Jokes},

		ssC.GenSteps: {
			Auto:    true,
			Require: S{ssC.StoryCookingStarted},
			Remove:  S{ssC.StepsReady},
			Tags:    S{ssbase.TagPrompt},
		},
		ssC.StepsReady: {
			Require: S{ssC.RecipeReady},
			Remove:  S{ssC.GenSteps},
		},

		ssC.GenStepComments: {
			Auto:    true,
			Require: S{ssC.StoryCookingStarted, ssC.StepsReady},
			Remove:  S{ssC.StepCommentsReady},
			Tags:    S{ssbase.TagPrompt},
		},
		ssC.StepCommentsReady: {Remove: S{ssC.GenStepComments}},

		ssC.Orienting: {
			Multi: true,
			Tags:  S{ssbase.TagPrompt},
		},
		ssC.OrientingMove: {},

		ssC.Start: StateAdd(saLLM[ssLLM.Start], State{
			Add: S{ssC.CheckStories, ssC.DBStarting},
		}),
		ssC.Ready: StateAdd(saLLM[ssLLM.Ready], State{
			Auto:    true,
			Require: S{ssC.CharacterReady, ssC.ResourcesReady},
		}),
		ssC.Interrupted: StateAdd(saLLM[ssLLM.Interrupted], State{

			Remove: sgC.Interruptable,
		}),
		ssC.Prompt: StateAdd(saLLM[ssLLM.Prompt], State{}),
	})

CookSchema represents all relations and properties of CookStates.

View Source
var Exception = am.StateException

Exception is a type alias for the exception state.

View Source
var MemMealReady = "StepMealReady"

TODO schema, define the base memory in ssbase

View Source
var SAdd = am.SAdd

SAdd is a func alias for merging lists of states.

View Source
var SchemaMerge = am.SchemaMerge

SchemaMerge is a func alias for extending an existing state schema.

View Source
var StateAdd = am.StateAdd

StateAdd is a func alias for adding to an existing state definition.

View Source
var StateSet = am.StateSet

StateSet is a func alias for replacing parts of an existing state definition.

Functions

func NewCook

func NewCook(ctx context.Context) *am.Machine

NewCook will create the most basic Cook state machine.

Types

type CookGroupsDef

type CookGroupsDef struct {
	// Group with all stories.
	Stories S
	// Group with all the start states which call LLMs.
	BootGen S
	// Group with ready states for BootGen.
	BootGenReady S
	// All the states which should be stopped on Interrupt
	Interruptable S

	// All the states for jokes generation.
	Jokes S
	// List of main flow states.
	MainFlow S
}

CookGroupsDef contains all the state groups Cook state machine.

type CookStatesDef

type CookStatesDef struct {
	*am.StatesBase

	ErrIngredients string
	ErrCooking     string

	// Ready is when the agent has CharacterReady, JokesReady, and ResourcesReady.
	Ready string
	// IngredientsReady is the first step of the flow, the bot has a list of ingredients.
	IngredientsReady string
	// RecipeReady is when the user and the bot agree on the recipe.
	RecipeReady string
	// One of the cooking steps have been completed.
	StepCompleted string

	// StoryJoke indicates that the joke story is currently happening.
	StoryJoke string
	// StoryWakingUp indicates that the waking-up story is currently happening.
	// This will boot up the bot from the prev session (SQL) or construct a new one (LLM).
	StoryWakingUp string
	// StoryIngredientsPicking indicates that the ingredients story is currently happening.
	StoryIngredientsPicking string
	StoryRecipePicking      string
	StoryCookingStarted     string
	StoryMealReady          string
	StoryMemoryWipe         string
	StoryStartAgain         string

	RestoreJokes string
	GenJokes     string
	JokesReady   string

	GenSteps string
	// StepsReady implies the steps have been translated into actionable memory.
	StepsReady string

	GenStepComments   string
	StepCommentsReady string

	// inherit from AgentLLM
	*ssllm.AgentLLMStatesDef
}

CookStatesDef contains all the states of the Cook state machine.

type S

type S = am.S

S is a type alias for a list of state names.

type State

type State = am.State

State is a type alias for a state definition. See am.State.

Jump to

Keyboard shortcuts

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