life

package
v0.99.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package life is the Life capability (quest evaluation and item lore).

Index

Constants

View Source
const (
	OpEvaluateQuest        = "EvaluateQuest"
	OpAdjudicateQuest      = "AdjudicateQuest"
	OpGenerateInstanceLore = "GenerateInstanceLore"
	OpBreakdownGoalTree    = "BreakdownGoalTree"
)

Operation names for hub.CapLife.

Variables

This section is empty.

Functions

func Register

func Register(svc Service) error

Register registers hub.CapLife operations.

Types

type AdjudicateQuestRequest

type AdjudicateQuestRequest struct {
	QuestTitle      string           `json:"quest_title"`
	QuestPrompt     string           `json:"quest_prompt,omitempty"`
	QuestType       string           `json:"quest_type,omitempty"`
	Difficulty      string           `json:"difficulty,omitempty"`
	BaseExp         int              `json:"base_exp,omitempty"`
	BaseGold        int              `json:"base_gold,omitempty"`
	AIPersonality   string           `json:"ai_personality,omitempty"`
	CompletionRate  float64          `json:"completion_rate,omitempty"`
	Mood            map[string]any   `json:"mood,omitempty"`
	RecentActionLog []map[string]any `json:"recent_action_log,omitempty"`
	Evidence        []QuestEvidence  `json:"evidence,omitempty"`
	ActiveGoals     []string         `json:"active_goals,omitempty"`
}

AdjudicateQuestRequest carries one quest plus its evidence context.

type EvaluateQuestRequest

type EvaluateQuestRequest struct {
	Prompt         string         `json:"prompt"`
	AIPersonality  string         `json:"ai_personality,omitempty"`
	CompletionRate float64        `json:"completion_rate,omitempty"`
	Mood           map[string]any `json:"mood,omitempty"`
	Privileges     map[string]any `json:"privileges,omitempty"`
	ActiveGoals    []string       `json:"active_goals,omitempty"`
	BreakdownDepth string         `json:"breakdown_depth,omitempty"`
}

EvaluateQuestRequest carries prompt plus optional DM context and gear privileges.

type GoalBreakdownActionSuggestion

type GoalBreakdownActionSuggestion struct {
	IsRepeatable       bool   `json:"is_repeatable,omitempty"`
	TrackingMode       string `json:"tracking_mode,omitempty"`
	RepeatTrigger      string `json:"repeat_trigger,omitempty"`
	SuggestedCadence   string `json:"suggested_cadence,omitempty"`
	IsIdentityBuilding bool   `json:"is_identity_building,omitempty"`
	Reason             string `json:"reason,omitempty"`
	Difficulty         string `json:"difficulty,omitempty"`
	BaseExp            int    `json:"base_exp,omitempty"`
	BaseGold           int    `json:"base_gold,omitempty"`
}

GoalBreakdownActionSuggestion is the suggested action payload for action nodes.

type GoalBreakdownRequest

type GoalBreakdownRequest struct {
	RootTitle      string         `json:"root_title"`
	Description    string         `json:"description,omitempty"`
	AIPersonality  string         `json:"ai_personality,omitempty"`
	Privileges     map[string]any `json:"privileges,omitempty"`
	ActiveGoals    []string       `json:"active_goals,omitempty"`
	BreakdownDepth string         `json:"breakdown_depth,omitempty"`
}

GoalBreakdownRequest carries the root goal plus planning context.

type GoalBreakdownSuggestion

type GoalBreakdownSuggestion struct {
	NodeType    string                         `json:"node_type"`
	Title       string                         `json:"title"`
	Description string                         `json:"description,omitempty"`
	Action      *GoalBreakdownActionSuggestion `json:"action,omitempty"`
	Children    []GoalBreakdownSuggestion      `json:"children,omitempty"`
}

GoalBreakdownSuggestion is one suggested tree node.

type InstanceLore

type InstanceLore struct {
	Name string `json:"name"`
	Lore string `json:"lore"`
}

InstanceLore is generated flavor text for a dropped item instance.

type LLMService

type LLMService struct {
	ResolveModel modelResolver
	ChatModel    func() string
}

LLMService evaluates quests and lore via the chat agent model.

func NewLLM

func NewLLM() *LLMService

NewLLM returns an LLM-backed life capability service.

func (*LLMService) AdjudicateQuest

func (s *LLMService) AdjudicateQuest(ctx context.Context, req AdjudicateQuestRequest) (*QuestAdjudication, error)

AdjudicateQuest asks the LLM to turn quest evidence into a structured ruling.

func (*LLMService) BreakdownGoalTree

func (s *LLMService) BreakdownGoalTree(ctx context.Context, req GoalBreakdownRequest) (*GoalBreakdownSuggestion, error)

BreakdownGoalTree asks the LLM for a structured suggested plan tree.

func (*LLMService) EvaluateQuest

func (s *LLMService) EvaluateQuest(ctx context.Context, req EvaluateQuestRequest) (*QuestEvaluation, error)

EvaluateQuest asks the LLM to score the prompt into a QuestEvaluation.

func (*LLMService) GenerateInstanceLore

func (s *LLMService) GenerateInstanceLore(ctx context.Context, questTitle, equipmentName, rarity string) (*InstanceLore, error)

GenerateInstanceLore asks the LLM for memorial item name and lore.

type QuestAdjudication

type QuestAdjudication struct {
	Verdict            string   `json:"verdict"`
	Reason             string   `json:"reason"`
	SuggestedExp       int      `json:"suggested_exp"`
	SuggestedGold      int      `json:"suggested_gold"`
	SuggestedNextSteps []string `json:"suggested_next_steps,omitempty"`
}

QuestAdjudication is the structured AI ruling for one quest.

type QuestEvaluation

type QuestEvaluation struct {
	Title      string `json:"title"`
	SkillName  string `json:"skill_name"`
	StatCode   string `json:"stat_code"`
	Difficulty string `json:"difficulty"`
	Fear       int    `json:"fear"`
	BaseExp    int    `json:"base_exp"`
	BaseGold   int    `json:"base_gold"`
	DropTier   string `json:"drop_tier"`
	QuestType  string `json:"quest_type"`
}

QuestEvaluation is the structured LLM assessment of a quest prompt.

type QuestEvidence

type QuestEvidence struct {
	SourceType string `json:"source_type"`
	Content    string `json:"content"`
	SourceURL  string `json:"source_url,omitempty"`
	Summary    string `json:"summary,omitempty"`
}

QuestEvidence is one user-submitted proof item for adjudication.

type Service

type Service interface {
	EvaluateQuest(ctx context.Context, req EvaluateQuestRequest) (*QuestEvaluation, error)
	AdjudicateQuest(ctx context.Context, req AdjudicateQuestRequest) (*QuestAdjudication, error)
	GenerateInstanceLore(ctx context.Context, questTitle, equipmentName, rarity string) (*InstanceLore, error)
	BreakdownGoalTree(ctx context.Context, req GoalBreakdownRequest) (*GoalBreakdownSuggestion, error)
}

Service is the life capability contract.

Jump to

Keyboard shortcuts

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