knowledge

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 9 Imported by: ? 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

Index

Constants

This section is empty.

Variables

View Source
var FacilityCategoryMapping = map[string]Facility{

	"grand_solarian_exchange": {ID: "grand_solarian_exchange", Name: "Grand Solarian Exchange", Category: "service", Level: 5},
	"sol_admin_bureau":        {ID: "sol_admin_bureau", Name: "Solarian Admin Bureau", Category: "service", Level: 5},
	"sol_bonded_warehouse":    {ID: "sol_bonded_warehouse", Name: "Solarian Bonded Warehouse", Category: "service", Level: 5},
	"sol_precision_drydock":   {ID: "sol_precision_drydock", Name: "Precision Drydock", Category: "service", Level: 5},
	"sol_naval_shipyard":      {ID: "sol_naval_shipyard", Name: "Naval Shipyard", Category: "service", Level: 5},
	"sol_research_labs":       {ID: "sol_research_labs", Name: "Research Labs", Category: "service", Level: 5},

	"solarian_fusion_plant": {ID: "solarian_fusion_plant", Name: "Solarian Fusion Plant", Category: "infrastructure", Level: 5},
	"solarian_life_support": {ID: "solarian_life_support", Name: "Solarian Life Support", Category: "infrastructure", Level: 5},

	"iron_refinery":        {ID: "iron_refinery", Name: "Iron Refinery", Category: "production", Level: 1},
	"circuit_fabricator":   {ID: "circuit_fabricator", Name: "Circuit Fabricator", Category: "production", Level: 1},
	"copper_wire_mill":     {ID: "copper_wire_mill", Name: "Copper Wire Mill", Category: "production", Level: 1},
	"polymer_synthesizer":  {ID: "polymer_synthesizer", Name: "Polymer Synthesizer", Category: "production", Level: 1},
	"fuel_cell_plant":      {ID: "fuel_cell_plant", Name: "Fuel Cell Plant", Category: "production", Level: 1},
	"repair_kit_factory":   {ID: "repair_kit_factory", Name: "Repair Kit Factory", Category: "production", Level: 1},
	"power_cell_assembler": {ID: "power_cell_assembler", Name: "Power Cell Assembler", Category: "production", Level: 1},
	"sensor_assembly":      {ID: "sensor_assembly", Name: "Sensor Assembly", Category: "production", Level: 2},
	"sol_galley":           {ID: "sol_galley", Name: "Solarian Galley", Category: "production", Level: 1},
	"sol_fuel_grid":        {ID: "sol_fuel_grid", Name: "Solarian Fuel Grid", Category: "production", Level: 5},

	"haven_grand_bazaar":     {ID: "haven_grand_bazaar", Name: "Grand Bazaar", Category: "service", Level: 5},
	"haven_promenade":        {ID: "haven_promenade", Name: "Promenade", Category: "service", Level: 5},
	"haven_repair_complex":   {ID: "haven_repair_complex", Name: "Repair Complex", Category: "service", Level: 5},
	"haven_fuel_plaza":       {ID: "haven_fuel_plaza", Name: "Fuel Plaza", Category: "service", Level: 5},
	"haven_ship_showroom":    {ID: "haven_ship_showroom", Name: "Ship Showroom", Category: "service", Level: 5},
	"haven_makers_market":    {ID: "haven_makers_market", Name: "Makers Market", Category: "service", Level: 5},
	"haven_trade_commission": {ID: "haven_trade_commission", Name: "Trade Commission", Category: "service", Level: 5},
	"haven_premium_storage":  {ID: "haven_premium_storage", Name: "Premium Storage", Category: "service", Level: 5},
	"trade_cipher_foundry":   {ID: "trade_cipher_foundry", Name: "Trade Cipher Foundry", Category: "service", Level: 5},

	"nebula_solar_array":  {ID: "nebula_solar_array", Name: "Nebula Solar Array", Category: "infrastructure", Level: 5},
	"nebula_life_support": {ID: "nebula_life_support", Name: "Nebula Life Support", Category: "infrastructure", Level: 5},

	"void_nexus_exchange": {ID: "void_nexus_exchange", Name: "Void Nexus Exchange", Category: "service", Level: 5},

	"null_energy_tap":                {ID: "null_energy_tap", Name: "Null Energy Tap", Category: "infrastructure", Level: 5},
	"voidborn_atmosphere":            {ID: "voidborn_atmosphere", Name: "Voidborn Atmosphere", Category: "infrastructure", Level: 5},
	"voidborn_dimensional_vault":     {ID: "voidborn_dimensional_vault", Name: "Dimensional Vault", Category: "infrastructure", Level: 5},
	"voidborn_energy_dispenser":      {ID: "voidborn_energy_dispenser", Name: "Energy Dispenser", Category: "infrastructure", Level: 5},
	"voidborn_neural_foundry":        {ID: "voidborn_neural_foundry", Name: "Neural Forge", Category: "infrastructure", Level: 5},
	"voidborn_reconstruction_matrix": {ID: "voidborn_reconstruction_matrix", Name: "Reconstruction Matrix", Category: "infrastructure", Level: 5},

	"voidborn_pattern_council":    {ID: "voidborn_pattern_council", Name: "Pattern Council", Category: "faction", Level: 5},
	"voidborn_crystalline_cradle": {ID: "voidborn_crystalline_cradle", Name: "Crystalline Cradle", Category: "faction", Level: 5},
	"voidborn_shaping_chamber":    {ID: "voidborn_shaping_chamber", Name: "Shaping Chamber", Category: "faction", Level: 5},

	"crystal_refinery":      {ID: "crystal_refinery", Name: "Crystal Refinery", Category: "production", Level: 5},
	"null_matter_processor": {ID: "null_matter_processor", Name: "Null Matter Processor", Category: "production", Level: 5},

	"crimson_fleet_command": {ID: "crimson_fleet_command", Name: "Crimson Fleet Command", Category: "service", Level: 5},
	"war_market":            {ID: "war_market", Name: "War Market", Category: "service", Level: 5},

	"crimson_life_support": {ID: "crimson_life_support", Name: "Crimson Life Support", Category: "infrastructure", Level: 5},
	"crimson_reactor":      {ID: "crimson_reactor", Name: "Crimson Reactor", Category: "infrastructure", Level: 5},

	"alloy_foundry":           {ID: "alloy_foundry", Name: "Alloy Foundry", Category: "production", Level: 5},
	"crimson_armor_works":     {ID: "crimson_armor_works", Name: "Crimson Armor Works", Category: "production", Level: 5},
	"crimson_distillery":      {ID: "crimson_distillery", Name: "Crimson Distillery", Category: "production", Level: 5},
	"crimson_fuel_bunker":     {ID: "crimson_fuel_bunker", Name: "Crimson Fuel Bunker", Category: "production", Level: 5},
	"crimson_munitions_vault": {ID: "crimson_munitions_vault", Name: "Munitions Vault", Category: "production", Level: 5},
	"crimson_war_forge":       {ID: "crimson_war_forge", Name: "Crimson War Forge", Category: "production", Level: 5},
	"crimson_weapons_forge":   {ID: "crimson_weapons_forge", Name: "Weapons Forge", Category: "production", Level: 5},

	"frontier_exchange":     {ID: "frontier_exchange", Name: "Frontier Exchange", Category: "service", Level: 1},
	"frontier_notice_board": {ID: "frontier_notice_board", Name: "Notice Board", Category: "service", Level: 1},
	"frontier_still":        {ID: "frontier_still", Name: "Still", Category: "service", Level: 1},

	"frontier_fuel_siphon":     {ID: "frontier_fuel_siphon", Name: "Fuel Siphon", Category: "infrastructure", Level: 1},
	"frontier_life_support":    {ID: "frontier_life_support", Name: "Life Support", Category: "infrastructure", Level: 1},
	"frontier_salvage_reactor": {ID: "frontier_salvage_reactor", Name: "Salvage Reactor", Category: "infrastructure", Level: 1},

	"frontier_hull_lockers": {ID: "frontier_hull_lockers", Name: "Hull Lockers", Category: "production", Level: 1},
	"frontier_machine_shop": {ID: "frontier_machine_shop", Name: "Machine Shop", Category: "production", Level: 1},
	"frontier_salvage_yard": {ID: "frontier_salvage_yard", Name: "Salvage Yard", Category: "production", Level: 1},
	"frontier_weld_shop":    {ID: "frontier_weld_shop", Name: "Weld Shop", Category: "production", Level: 1},
}

FacilityCategoryMapping maps facility IDs to their metadata This is populated from game data since the API doesn't provide categories

Functions

This section is empty.

Types

type AgentInfo

type AgentInfo struct {
	ID     string
	Name   string
	Role   string
	Empire string
	Status string
}

AgentInfo holds agent metadata

type Anomaly

type Anomaly struct {
	ID              int64
	Type            string // 'rich_deposit', 'hostile_zone', 'rare_resource', 'empty_station', 'price_anomaly'
	Severity        string // 'info', 'warning', 'critical', 'opportunity'
	SystemID        string
	POIID           string
	Description     string
	Details         string // JSON with additional data
	DetectedAt      time.Time
	DetectedBy      string
	Status          string // 'active', 'resolved', 'obsolete'
	LastUpdatedTick int64
}

Anomaly represents an unusual or noteworthy discovery

type Base

type Base interface {
	Close() error
	RememberSystem(ctx context.Context, sys System) error
	GetSystem(ctx context.Context, systemID string) (*System, error)
	GetUnknownConnections(ctx context.Context, systemID string) ([]string, error)
	RememberConnection(ctx context.Context, fromSystem, toSystem string) error
	RememberPOI(ctx context.Context, poi POI) error
	GetPOIs(ctx context.Context, systemID string) ([]POI, error)
	RememberBase(ctx context.Context, base SpaceBase) error
	GetBase(ctx context.Context, baseID string) (*SpaceBase, error)
	GetBaseByPOI(ctx context.Context, poiID string) (*SpaceBase, error)
	AddExperience(ctx context.Context, agentID, expType, description, outcome, location string) error
	GetRecentExperiences(ctx context.Context, agentID string, limit int) ([]Experience, error)
	RegisterAgent(ctx context.Context, agentID, name, role, faction string, personality []byte) error

	// GetSystems returns all known systems
	// Note: This method does not take a context for API compatibility with existing callers
	GetSystems() []System

	// Market data methods
	StoreMarketSnapshot(ctx context.Context, snapshot MarketSnapshot, agentID string) error
	GetMarketSnapshots(ctx context.Context, systemID, stationID string, limit int) ([]MarketSnapshot, error)
	GetLatestMarketSnapshot(ctx context.Context, systemID, stationID string) (*MarketSnapshot, error)
	GetMarketItems(ctx context.Context, itemType string) ([]string, error)
	HasMarketSnapshotToday(ctx context.Context, systemID, stationID string) (bool, error)

	// Market analysis methods
	StoreMarketAnalysis(ctx context.Context, analysis MarketAnalysis, agentID string) error
	GetLatestMarketAnalysis(ctx context.Context, systemID, stationID string) (*MarketAnalysis, error)
	GetMarketAnalysisHistory(ctx context.Context, systemID, stationID string, limit int) ([]MarketAnalysis, error)

	// Ship listings methods
	StoreShipListings(ctx context.Context, listings ShipListings, agentID string) error
	GetShipListings(ctx context.Context, systemID, stationID string, limit int) ([]ShipListings, error)
	GetLatestShipListings(ctx context.Context, systemID, stationID string) (*ShipListings, error)
	HasShipListingsToday(ctx context.Context, systemID, stationID string) (bool, error)

	// Resource depletion tracking
	RecordResourceState(ctx context.Context, poiID, resourceID string, richness, remaining float64, gameTick int64, agentID string) error
	GetResourceHistory(ctx context.Context, poiID, resourceID string, limit int) ([]ResourceHistory, error)
	GetDepletingResources(ctx context.Context, threshold float64) ([]DepletingResource, error)

	// Route optimization
	RecordJourney(ctx context.Context, fromSystem, toSystem string, fuelCost, travelTime float64, agentID string) error
	GetOptimalRoute(ctx context.Context, fromSystem, toSystem string) (*ConnectionMetrics, error)
	FindCheapestRoute(ctx context.Context, fromSystem, toSystem string, maxHops int) ([]string, float64, error)

	// Anomaly detection
	RecordAnomaly(ctx context.Context, anomaly Anomaly) error
	GetActiveAnomalies(ctx context.Context, systemID string) ([]Anomaly, error)
	GetAnomaliesByType(ctx context.Context, anomalyType, severity string, limit int) ([]Anomaly, error)
	ResolveAnomaly(ctx context.Context, anomalyID int64, status string) error

	// Market price analytics
	AnalyzePriceTrends(ctx context.Context, itemID, stationID string, windowHours int) (*PriceTrend, error)
	FindBestPrices(ctx context.Context, itemID string, listingType string, limit int) ([]BestPrice, error)
	GetPriceHistory(ctx context.Context, itemID, stationID string, limit int) ([]PricePoint, error)

	// Danger zone tracking
	RecordHostileEncounter(ctx context.Context, systemID string, encounterType string, details string) error
	GetDangerZones(ctx context.Context, minDangerLevel int) ([]DangerZone, error)
	GetSystemDanger(ctx context.Context, systemID string) (*DangerZone, error)

	// Knowledge export/import
	ExportKnowledge(ctx context.Context, description string, agentID string) (*KnowledgeExport, error)
	ImportKnowledge(ctx context.Context, exportData string) error
	ListExports(ctx context.Context) ([]KnowledgeExportMeta, error)

	// Skills
	GetSkill(id string) (*Skill, error)
	GetSkills() []Skill
	StoreSkills(ctx context.Context, skills []Skill) error

	// Catalog: Items
	StoreItems(ctx context.Context, items []CatalogItem) error
	GetItem(ctx context.Context, itemID string) (*CatalogItem, error)
	GetItems(ctx context.Context) ([]CatalogItem, error)
	GetItemsByCategory(ctx context.Context, category string) ([]CatalogItem, error)

	// Catalog: Ship Classes
	StoreShipClasses(ctx context.Context, classes []ShipClassDef) error
	GetShipClass(ctx context.Context, classID string) (*ShipClassDef, error)
	GetShipClasses(ctx context.Context) ([]ShipClassDef, error)
	GetShipClassesByCategory(ctx context.Context, category string) ([]ShipClassDef, error)

	// Catalog: Recipes
	StoreRecipes(ctx context.Context, recipes []RecipeDef) error
	GetRecipe(ctx context.Context, recipeID string) (*RecipeDef, error)
	GetRecipes(ctx context.Context) ([]RecipeDef, error)
	GetRecipesByCategory(ctx context.Context, category string) ([]RecipeDef, error)

	// Player State
	StorePlayer(ctx context.Context, player PlayerRecord) error
	GetPlayer(ctx context.Context, playerID string) (*PlayerRecord, error)
	StorePlayerSkills(ctx context.Context, playerID string, skills []PlayerSkillRecord) error
	GetPlayerSkills(ctx context.Context, playerID string) ([]PlayerSkillRecord, error)
	StoreShip(ctx context.Context, ship ShipRecord) error
	GetShip(ctx context.Context, shipID string) (*ShipRecord, error)
	GetPlayerShips(ctx context.Context, playerID string) ([]ShipRecord, error)
	StoreMissionTemplates(ctx context.Context, baseID string, missions []MissionTemplate) error
	GetMissionTemplates(ctx context.Context, baseID string) ([]MissionTemplate, error)
}

Base provides the KB interface for both SQLite and in-memory implementations

type BaseMarketItem

type BaseMarketItem struct {
	ID        string
	ItemID    string
	PriceEach float64
	Quantity  int
	IsNPC     bool
}

BaseMarketItem represents an item for sale at a base market

type BestPrice

type BestPrice struct {
	ItemID      string
	StationID   string
	StationName string
	SystemID    string
	SystemName  string
	Price       float64
	Quantity    float64
	ListingType string
	CapturedAt  time.Time
}

BestPrice identifies the best buy/sell opportunity for an item

type BuildMaterial

type BuildMaterial struct {
	ItemID   string
	Quantity int
}

BuildMaterial represents a material required to build a ship class.

type CargoEntry

type CargoEntry struct {
	ItemID   string
	Quantity float64
}

CargoEntry represents an item in a ship's cargo hold.

type CatalogItem

type CatalogItem struct {
	ID          string
	Name        string
	Description string
	Category    string
	Rarity      string
	Size        int
	BaseValue   int
	Stackable   bool
	Tradeable   bool
}

CatalogItem represents an item from the game catalog.

type Config

type Config struct {
	DBPath       string        // Path to SQLite database file
	WAL          bool          // Enable WAL mode for better concurrency
	MaxOpenConns int           // Maximum open connections
	MaxIdleConns int           // Maximum idle connections
	BusyTimeout  time.Duration // Timeout for busy database
}

Config holds configuration for SQLite knowledge base

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a config with sensible defaults

type ConnectionMetrics

type ConnectionMetrics struct {
	FromSystem    string
	ToSystem      string
	TravelCount   int
	AvgFuelCost   float64
	AvgTravelTime float64
	LastTraveled  time.Time
	TraveledBy    string
}

ConnectionMetrics stores route optimization data

type DangerZone

type DangerZone struct {
	SystemID          string
	SystemName        string
	DangerLevel       int // 0-10 scale
	HostileEncounters int
	PlayerKills       int
	NPCKills          int
	LastIncident      time.Time
	LastUpdated       time.Time
}

DangerZone tracks hostile activity in a system

type DepletingResource

type DepletingResource struct {
	POIID         string
	POIName       string
	SystemID      string
	SystemName    string
	ResourceID    string
	CurrentRem    float64
	PreviousRem   float64
	DepletionRate float64 // per game tick
	EstimatedLife int64   // ticks until exhausted
}

DepletingResource identifies resources running low

type Experience

type Experience struct {
	Time            string
	Type            string
	Description     string
	Outcome         string
	Location        string
	LastUpdatedTick int64
}

Experience represents a significant event

type Facility

type Facility struct {
	ID          string // Facility ID (e.g., "grand_solarian_exchange")
	Name        string // Display name
	Category    string // Category: "service", "infrastructure", "production", "faction", "personal"
	Level       int    // Facility level (1-5)
	LastUpdated int64  // Last updated tick for data freshness tracking
}

Facility represents a facility at a base with category and level information

type KnowledgeExport

type KnowledgeExport struct {
	ID               string
	CreatedAt        time.Time
	CreatedBy        string
	Description      string
	SystemsCount     int
	POIsCount        int
	ExperiencesCount int
	ExportData       string // JSON snapshot
}

KnowledgeExport represents exported knowledge bundle

type KnowledgeExportMeta

type KnowledgeExportMeta struct {
	ID               string
	CreatedAt        time.Time
	CreatedBy        string
	Description      string
	SystemsCount     int
	POIsCount        int
	ExperiencesCount int
}

KnowledgeExportMeta is metadata about an export

type MapSystemData

type MapSystemData struct {
	ID           string
	Name         string
	Empire       string
	PositionX    float64
	PositionY    float64
	IsStronghold bool
	Connections  []string
}

MapSystemData contains the subset of system data available from map imports. Used by UpsertSystemFromMap to perform partial upserts that preserve richer explorer-collected data (police_level, description, last_updated_tick).

type MarketAnalysis

type MarketAnalysis struct {
	SystemID        string
	SystemName      string
	StationID       string
	StationName     string
	GameTick        int64
	CapturedAt      time.Time
	Mode            string
	SkillLevel      int
	ScanningRange   string
	StationsInRange int
	ItemsScanned    int
	TopInsights     []map[string]any
	TotalItems      int
	TotalPages      int
	Page            int
	Hint            string
	XPGained        map[string]any
	AnalysisData    map[string]any
}

MarketAnalysis represents AI-generated market insights from analyze_market

type MarketListing

type MarketListing struct {
	ItemID       string
	ItemType     string
	Quantity     float64
	PricePerUnit float64
	TotalPrice   float64
	Type         string // 'buy' or 'sell'
	ListedBy     string
}

MarketListing represents a single market listing

type MarketSnapshot

type MarketSnapshot struct {
	SystemID    string
	SystemName  string
	StationID   string
	StationName string
	GameTick    int64
	Listings    []MarketListing
	CapturedAt  time.Time
}

MarketSnapshot represents a captured market state

type MemoryKB

type MemoryKB struct {
	// contains filtered or unexported fields
}

MemoryKB is an in-memory knowledge base for MVP

func NewMemoryKB

func NewMemoryKB() *MemoryKB

NewMemoryKB creates a new in-memory knowledge base

func (*MemoryKB) AddExperience

func (kb *MemoryKB) AddExperience(ctx context.Context, agentID, expType, description, outcome, location string) error

AddExperience logs an agent experience

func (*MemoryKB) AnalyzePriceTrends

func (kb *MemoryKB) AnalyzePriceTrends(ctx context.Context, itemID, stationID string, windowHours int) (*PriceTrend, error)

func (*MemoryKB) Close

func (kb *MemoryKB) Close() error

func (*MemoryKB) ExportKnowledge

func (kb *MemoryKB) ExportKnowledge(ctx context.Context, description string, agentID string) (*KnowledgeExport, error)

func (*MemoryKB) FindBestPrices

func (kb *MemoryKB) FindBestPrices(ctx context.Context, itemID string, listingType string, limit int) ([]BestPrice, error)

func (*MemoryKB) FindCheapestRoute

func (kb *MemoryKB) FindCheapestRoute(ctx context.Context, fromSystem, toSystem string, maxHops int) ([]string, float64, error)

func (*MemoryKB) GetActiveAnomalies

func (kb *MemoryKB) GetActiveAnomalies(ctx context.Context, systemID string) ([]Anomaly, error)

func (*MemoryKB) GetAnomaliesByType

func (kb *MemoryKB) GetAnomaliesByType(ctx context.Context, anomalyType, severity string, limit int) ([]Anomaly, error)

func (*MemoryKB) GetBase

func (kb *MemoryKB) GetBase(ctx context.Context, baseID string) (*SpaceBase, error)

GetBase retrieves a base by ID

func (*MemoryKB) GetBaseByPOI

func (kb *MemoryKB) GetBaseByPOI(ctx context.Context, poiID string) (*SpaceBase, error)

GetBaseByPOI retrieves a base by its POI ID

func (*MemoryKB) GetDangerZones

func (kb *MemoryKB) GetDangerZones(ctx context.Context, minDangerLevel int) ([]DangerZone, error)

func (*MemoryKB) GetDepletingResources

func (kb *MemoryKB) GetDepletingResources(ctx context.Context, threshold float64) ([]DepletingResource, error)

func (*MemoryKB) GetItem

func (kb *MemoryKB) GetItem(ctx context.Context, itemID string) (*CatalogItem, error)

func (*MemoryKB) GetItems

func (kb *MemoryKB) GetItems(ctx context.Context) ([]CatalogItem, error)

func (*MemoryKB) GetItemsByCategory

func (kb *MemoryKB) GetItemsByCategory(ctx context.Context, category string) ([]CatalogItem, error)

func (*MemoryKB) GetLatestMarketAnalysis

func (kb *MemoryKB) GetLatestMarketAnalysis(ctx context.Context, systemID, stationID string) (*MarketAnalysis, error)

func (*MemoryKB) GetLatestMarketSnapshot

func (kb *MemoryKB) GetLatestMarketSnapshot(ctx context.Context, systemID, stationID string) (*MarketSnapshot, error)

GetLatestMarketSnapshot retrieves the most recent market snapshot

func (*MemoryKB) GetLatestShipListings

func (kb *MemoryKB) GetLatestShipListings(ctx context.Context, systemID, stationID string) (*ShipListings, error)

GetLatestShipListings retrieves the most recent ship listings

func (*MemoryKB) GetMarketAnalysisHistory

func (kb *MemoryKB) GetMarketAnalysisHistory(ctx context.Context, systemID, stationID string, limit int) ([]MarketAnalysis, error)

func (*MemoryKB) GetMarketItems

func (kb *MemoryKB) GetMarketItems(ctx context.Context, itemType string) ([]string, error)

GetMarketItems retrieves unique item IDs optionally filtered by type

func (*MemoryKB) GetMarketSnapshots

func (kb *MemoryKB) GetMarketSnapshots(ctx context.Context, systemID, stationID string, limit int) ([]MarketSnapshot, error)

GetMarketSnapshots retrieves historical market snapshots

func (*MemoryKB) GetMissionTemplates

func (kb *MemoryKB) GetMissionTemplates(ctx context.Context, baseID string) ([]MissionTemplate, error)

func (*MemoryKB) GetOptimalRoute

func (kb *MemoryKB) GetOptimalRoute(ctx context.Context, fromSystem, toSystem string) (*ConnectionMetrics, error)

func (*MemoryKB) GetPOIs

func (kb *MemoryKB) GetPOIs(ctx context.Context, systemID string) ([]POI, error)

GetPOIs retrieves all POIs in a system

func (*MemoryKB) GetPlayer

func (kb *MemoryKB) GetPlayer(ctx context.Context, playerID string) (*PlayerRecord, error)

func (*MemoryKB) GetPlayerShips

func (kb *MemoryKB) GetPlayerShips(ctx context.Context, playerID string) ([]ShipRecord, error)

func (*MemoryKB) GetPlayerSkills

func (kb *MemoryKB) GetPlayerSkills(ctx context.Context, playerID string) ([]PlayerSkillRecord, error)

func (*MemoryKB) GetPriceHistory

func (kb *MemoryKB) GetPriceHistory(ctx context.Context, itemID, stationID string, limit int) ([]PricePoint, error)

func (*MemoryKB) GetRecentExperiences

func (kb *MemoryKB) GetRecentExperiences(ctx context.Context, agentID string, limit int) ([]Experience, error)

GetRecentExperiences retrieves recent experiences for an agent

func (*MemoryKB) GetRecipe

func (kb *MemoryKB) GetRecipe(ctx context.Context, recipeID string) (*RecipeDef, error)

func (*MemoryKB) GetRecipes

func (kb *MemoryKB) GetRecipes(ctx context.Context) ([]RecipeDef, error)

func (*MemoryKB) GetRecipesByCategory

func (kb *MemoryKB) GetRecipesByCategory(ctx context.Context, category string) ([]RecipeDef, error)

func (*MemoryKB) GetResourceHistory

func (kb *MemoryKB) GetResourceHistory(ctx context.Context, poiID, resourceID string, limit int) ([]ResourceHistory, error)

func (*MemoryKB) GetShip

func (kb *MemoryKB) GetShip(ctx context.Context, shipID string) (*ShipRecord, error)

func (*MemoryKB) GetShipClass

func (kb *MemoryKB) GetShipClass(ctx context.Context, classID string) (*ShipClassDef, error)

func (*MemoryKB) GetShipClasses

func (kb *MemoryKB) GetShipClasses(ctx context.Context) ([]ShipClassDef, error)

func (*MemoryKB) GetShipClassesByCategory

func (kb *MemoryKB) GetShipClassesByCategory(ctx context.Context, category string) ([]ShipClassDef, error)

func (*MemoryKB) GetShipListings

func (kb *MemoryKB) GetShipListings(ctx context.Context, systemID, stationID string, limit int) ([]ShipListings, error)

GetShipListings retrieves historical ship listings

func (*MemoryKB) GetSkill

func (kb *MemoryKB) GetSkill(id string) (*Skill, error)

GetSkill retrieves a single skill by ID.

func (*MemoryKB) GetSkills

func (kb *MemoryKB) GetSkills() []Skill

GetSkills retrieves all skills.

func (*MemoryKB) GetSystem

func (kb *MemoryKB) GetSystem(ctx context.Context, systemID string) (*System, error)

GetSystem retrieves a system by ID

func (*MemoryKB) GetSystemDanger

func (kb *MemoryKB) GetSystemDanger(ctx context.Context, systemID string) (*DangerZone, error)

func (*MemoryKB) GetSystems

func (kb *MemoryKB) GetSystems() []System

GetSystems returns all known systems

func (*MemoryKB) GetUnknownConnections

func (kb *MemoryKB) GetUnknownConnections(ctx context.Context, systemID string) ([]string, error)

GetUnknownConnections finds unexplored connections from a system

func (*MemoryKB) HasMarketSnapshotToday

func (kb *MemoryKB) HasMarketSnapshotToday(ctx context.Context, systemID, stationID string) (bool, error)

HasMarketSnapshotToday checks if a market snapshot was captured today for a station

func (*MemoryKB) HasShipListingsToday

func (kb *MemoryKB) HasShipListingsToday(ctx context.Context, systemID, stationID string) (bool, error)

HasShipListingsToday checks if ship listings were captured today for a station

func (*MemoryKB) ImportKnowledge

func (kb *MemoryKB) ImportKnowledge(ctx context.Context, exportData string) error

func (*MemoryKB) ListExports

func (kb *MemoryKB) ListExports(ctx context.Context) ([]KnowledgeExportMeta, error)

func (*MemoryKB) RecordAnomaly

func (kb *MemoryKB) RecordAnomaly(ctx context.Context, anomaly Anomaly) error

func (*MemoryKB) RecordHostileEncounter

func (kb *MemoryKB) RecordHostileEncounter(ctx context.Context, systemID string, encounterType string, details string) error

func (*MemoryKB) RecordJourney

func (kb *MemoryKB) RecordJourney(ctx context.Context, fromSystem, toSystem string, fuelCost, travelTime float64, agentID string) error

func (*MemoryKB) RecordResourceState

func (kb *MemoryKB) RecordResourceState(ctx context.Context, poiID, resourceID string, richness, remaining float64, gameTick int64, agentID string) error

func (*MemoryKB) RegisterAgent

func (kb *MemoryKB) RegisterAgent(ctx context.Context, agentID, name, role, empire string, personality []byte) error

RegisterAgent registers an agent in the knowledge base

func (*MemoryKB) RememberBase

func (kb *MemoryKB) RememberBase(ctx context.Context, base SpaceBase) error

RememberBase stores or updates space base knowledge

func (*MemoryKB) RememberConnection

func (kb *MemoryKB) RememberConnection(ctx context.Context, fromSystem, toSystem string) error

RememberConnection stores a system connection (with deduplication)

func (*MemoryKB) RememberPOI

func (kb *MemoryKB) RememberPOI(ctx context.Context, poi POI) error

RememberPOI stores or updates POI knowledge

func (*MemoryKB) RememberSystem

func (kb *MemoryKB) RememberSystem(ctx context.Context, sys System) error

RememberSystem stores or updates system knowledge

func (*MemoryKB) ResolveAnomaly

func (kb *MemoryKB) ResolveAnomaly(ctx context.Context, anomalyID int64, status string) error

func (*MemoryKB) StoreItems

func (kb *MemoryKB) StoreItems(ctx context.Context, items []CatalogItem) error

func (*MemoryKB) StoreMarketAnalysis

func (kb *MemoryKB) StoreMarketAnalysis(ctx context.Context, analysis MarketAnalysis, agentID string) error

func (*MemoryKB) StoreMarketSnapshot

func (kb *MemoryKB) StoreMarketSnapshot(ctx context.Context, snapshot MarketSnapshot, agentID string) error

StoreMarketSnapshot stores a market snapshot with its listings

func (*MemoryKB) StoreMissionTemplates

func (kb *MemoryKB) StoreMissionTemplates(ctx context.Context, baseID string, missions []MissionTemplate) error

func (*MemoryKB) StorePlayer

func (kb *MemoryKB) StorePlayer(ctx context.Context, player PlayerRecord) error

func (*MemoryKB) StorePlayerSkills

func (kb *MemoryKB) StorePlayerSkills(ctx context.Context, playerID string, skills []PlayerSkillRecord) error

func (*MemoryKB) StoreRecipes

func (kb *MemoryKB) StoreRecipes(ctx context.Context, recipes []RecipeDef) error

func (*MemoryKB) StoreShip

func (kb *MemoryKB) StoreShip(ctx context.Context, ship ShipRecord) error

func (*MemoryKB) StoreShipClasses

func (kb *MemoryKB) StoreShipClasses(ctx context.Context, classes []ShipClassDef) error

func (*MemoryKB) StoreShipListings

func (kb *MemoryKB) StoreShipListings(ctx context.Context, listings ShipListings, agentID string) error

StoreShipListings stores ship listings at a station

func (*MemoryKB) StoreSkills

func (kb *MemoryKB) StoreSkills(ctx context.Context, skills []Skill) error

StoreSkills stores skills in memory.

type Migration

type Migration struct {
	// contains filtered or unexported fields
}

Migration represents a database schema migration

type MissionObjectiveRecord

type MissionObjectiveRecord struct {
	Type        string
	Description string
	SortOrder   int
}

MissionObjectiveRecord represents a single objective in a mission template.

type MissionTemplate

type MissionTemplate struct {
	ID              string
	Title           string
	Description     string
	Type            string
	Difficulty      int
	BaseID          string
	GiverName       string
	GiverTitle      string
	DialogOffer     string
	ChainNext       string
	ExpiresInTicks  int
	RewardsCredits  int
	RewardsSkillXP  map[string]int
	Requirements    map[string]any
	Objectives      []MissionObjectiveRecord
	LastUpdatedTick int64
}

MissionTemplate represents an available mission from a mission board.

type POI

type POI struct {
	ID              string
	SystemID        string
	Name            string
	Type            string
	Description     string
	Position        game.Position
	Services        []string
	Resources       []game.POIResource
	LastUpdatedTick int64
}

POI represents knowledge about a Point of Interest Extends game.POI with exploration metadata

type PlayerRecord

type PlayerRecord struct {
	ID              string
	Username        string
	Empire          string
	Credits         float64
	CurrentSystem   string
	CurrentPOI      string
	CurrentShipID   string
	HomeBase        string
	DockedAtBase    string
	FactionID       string
	FactionRank     string
	Experience      int64
	Stats           PlayerStatsRecord
	LastUpdatedTick int64
}

PlayerRecord represents a player's core data stored in the knowledge base.

type PlayerSkillRecord

type PlayerSkillRecord struct {
	SkillID   string
	Level     int
	CurrentXP float64
}

PlayerSkillRecord represents a player's progress in a specific skill.

type PlayerStatsRecord

type PlayerStatsRecord struct {
	ShipsDestroyed    int
	TimesDestroyed    int
	OreMined          float64
	CreditsEarned     float64
	CreditsSpent      float64
	TradesCompleted   int
	SystemsDiscovered int
	ItemsCrafted      int
	MissionsCompleted int
	BasesDestroyed    int
	DistanceTraveled  int64
	PiratesDestroyed  int
	ShipsLost         int
	TimePlayed        int64
	LastUpdatedTick   int64
}

PlayerStatsRecord holds player statistics.

type PricePoint

type PricePoint struct {
	Price      float64
	Quantity   float64
	GameTick   int64
	CapturedAt time.Time
}

PricePoint represents a single price observation

type PriceTrend

type PriceTrend struct {
	ItemID       string
	ItemType     string
	StationID    string
	SystemID     string
	ListingType  string // 'buy' or 'sell'
	AvgPrice     float64
	MinPrice     float64
	MaxPrice     float64
	CurrentPrice float64
	PriceChange  float64 // percentage change
	SampleCount  int
	WindowStart  time.Time
	WindowEnd    time.Time
}

PriceTrend represents aggregate price data over a time window

type RecipeDef

type RecipeDef struct {
	ID              string
	Name            string
	Description     string
	Category        string
	CraftingTime    int
	BaseQuality     int
	SkillQualityMod int
	RequiredSkills  map[string]int
	Inputs          []RecipeIngredient
	Outputs         []RecipeProduct
	LastUpdatedTick int64
}

RecipeDef represents a crafting recipe stored in the knowledge base.

type RecipeIngredient

type RecipeIngredient struct {
	ItemID   string
	Quantity int
}

RecipeIngredient represents an input item for a recipe.

type RecipeProduct

type RecipeProduct struct {
	ItemID     string
	Quantity   int
	QualityMod bool
}

RecipeProduct represents an output item from a recipe.

type ResourceHistory

type ResourceHistory struct {
	POIID      string
	ResourceID string
	Richness   float64
	Remaining  float64
	GameTick   int64
	RecordedAt time.Time
	AgentID    string
}

ResourceHistory tracks resource depletion over time

type SQLiteKB

type SQLiteKB struct {
	// contains filtered or unexported fields
}

SQLiteKB implements Base interface using SQLite backend

func NewSQLiteKB

func NewSQLiteKB(config Config) (*SQLiteKB, error)

NewSQLiteKB creates a new SQLite-backed knowledge base

func (*SQLiteKB) AddExperience

func (kb *SQLiteKB) AddExperience(ctx context.Context, agentID, expType, description, outcome, location string) error

AddExperience logs an agent experience

func (*SQLiteKB) AnalyzePriceTrends

func (kb *SQLiteKB) AnalyzePriceTrends(ctx context.Context, itemID, stationID string, windowHours int) (*PriceTrend, error)

AnalyzePriceTrends calculates price trends for an item at a station

func (*SQLiteKB) Close

func (kb *SQLiteKB) Close() error

Close closes the database connection

func (*SQLiteKB) ExportKnowledge

func (kb *SQLiteKB) ExportKnowledge(ctx context.Context, description string, agentID string) (*KnowledgeExport, error)

ExportKnowledge creates a JSON export of the knowledge base

func (*SQLiteKB) FindBestPrices

func (kb *SQLiteKB) FindBestPrices(ctx context.Context, itemID string, listingType string, limit int) ([]BestPrice, error)

FindBestPrices finds the best buy/sell prices for an item across all stations

func (*SQLiteKB) FindCheapestRoute

func (kb *SQLiteKB) FindCheapestRoute(ctx context.Context, fromSystem, toSystem string, maxHops int) ([]string, float64, error)

FindCheapestRoute finds the most fuel-efficient multi-hop route

func (*SQLiteKB) GetActiveAnomalies

func (kb *SQLiteKB) GetActiveAnomalies(ctx context.Context, systemID string) ([]Anomaly, error)

GetActiveAnomalies retrieves active anomalies in a system

func (*SQLiteKB) GetAnomaliesByType

func (kb *SQLiteKB) GetAnomaliesByType(ctx context.Context, anomalyType, severity string, limit int) ([]Anomaly, error)

GetAnomaliesByType retrieves anomalies filtered by type and severity

func (*SQLiteKB) GetBase

func (kb *SQLiteKB) GetBase(ctx context.Context, baseID string) (*SpaceBase, error)

GetBase retrieves a base by ID

func (*SQLiteKB) GetBaseByPOI

func (kb *SQLiteKB) GetBaseByPOI(ctx context.Context, poiID string) (*SpaceBase, error)

GetBaseByPOI retrieves a base by its POI ID

func (*SQLiteKB) GetDangerZones

func (kb *SQLiteKB) GetDangerZones(ctx context.Context, minDangerLevel int) ([]DangerZone, error)

GetDangerZones retrieves systems with high danger levels

func (*SQLiteKB) GetDepletingResources

func (kb *SQLiteKB) GetDepletingResources(ctx context.Context, threshold float64) ([]DepletingResource, error)

GetDepletingResources finds resources that are depleting rapidly

func (*SQLiteKB) GetItem

func (kb *SQLiteKB) GetItem(ctx context.Context, itemID string) (*CatalogItem, error)

GetItem retrieves a single item by ID.

func (*SQLiteKB) GetItems

func (kb *SQLiteKB) GetItems(ctx context.Context) ([]CatalogItem, error)

GetItems retrieves all catalog items.

func (*SQLiteKB) GetItemsByCategory

func (kb *SQLiteKB) GetItemsByCategory(ctx context.Context, category string) ([]CatalogItem, error)

GetItemsByCategory retrieves items filtered by category.

func (*SQLiteKB) GetLatestMarketAnalysis

func (kb *SQLiteKB) GetLatestMarketAnalysis(ctx context.Context, systemID, stationID string) (*MarketAnalysis, error)

GetLatestMarketAnalysis retrieves the most recent market analysis

func (*SQLiteKB) GetLatestMarketSnapshot

func (kb *SQLiteKB) GetLatestMarketSnapshot(ctx context.Context, systemID, stationID string) (*MarketSnapshot, error)

GetLatestMarketSnapshot retrieves the most recent market snapshot

func (*SQLiteKB) GetLatestShipListings

func (kb *SQLiteKB) GetLatestShipListings(ctx context.Context, systemID, stationID string) (*ShipListings, error)

GetLatestShipListings retrieves the most recent ship listings

func (*SQLiteKB) GetMarketAnalysisHistory

func (kb *SQLiteKB) GetMarketAnalysisHistory(ctx context.Context, systemID, stationID string, limit int) ([]MarketAnalysis, error)

GetMarketAnalysisHistory retrieves historical market analyses

func (*SQLiteKB) GetMarketItems

func (kb *SQLiteKB) GetMarketItems(ctx context.Context, itemType string) ([]string, error)

GetMarketItems retrieves unique item IDs optionally filtered by type

func (*SQLiteKB) GetMarketSnapshots

func (kb *SQLiteKB) GetMarketSnapshots(ctx context.Context, systemID, stationID string, limit int) ([]MarketSnapshot, error)

GetMarketSnapshots retrieves historical market snapshots

func (*SQLiteKB) GetMissionTemplates

func (kb *SQLiteKB) GetMissionTemplates(ctx context.Context, baseID string) ([]MissionTemplate, error)

GetMissionTemplates retrieves mission templates for a given base.

func (*SQLiteKB) GetOptimalRoute

func (kb *SQLiteKB) GetOptimalRoute(ctx context.Context, fromSystem, toSystem string) (*ConnectionMetrics, error)

GetOptimalRoute finds the best known route between two systems

func (*SQLiteKB) GetPOIs

func (kb *SQLiteKB) GetPOIs(ctx context.Context, systemID string) ([]POI, error)

GetPOIs retrieves all POIs in a system

func (*SQLiteKB) GetPlayer

func (kb *SQLiteKB) GetPlayer(ctx context.Context, playerID string) (*PlayerRecord, error)

GetPlayer retrieves a player record by ID.

func (*SQLiteKB) GetPlayerShips

func (kb *SQLiteKB) GetPlayerShips(ctx context.Context, playerID string) ([]ShipRecord, error)

GetPlayerShips retrieves all ships owned by a player.

func (*SQLiteKB) GetPlayerSkills

func (kb *SQLiteKB) GetPlayerSkills(ctx context.Context, playerID string) ([]PlayerSkillRecord, error)

GetPlayerSkills retrieves a player's skill progress.

func (*SQLiteKB) GetPriceHistory

func (kb *SQLiteKB) GetPriceHistory(ctx context.Context, itemID, stationID string, limit int) ([]PricePoint, error)

GetPriceHistory retrieves historical price points for an item

func (*SQLiteKB) GetRecentExperiences

func (kb *SQLiteKB) GetRecentExperiences(ctx context.Context, agentID string, limit int) ([]Experience, error)

GetRecentExperiences retrieves recent experiences for an agent

func (*SQLiteKB) GetRecipe

func (kb *SQLiteKB) GetRecipe(ctx context.Context, recipeID string) (*RecipeDef, error)

GetRecipe retrieves a single recipe by ID.

func (*SQLiteKB) GetRecipes

func (kb *SQLiteKB) GetRecipes(ctx context.Context) ([]RecipeDef, error)

GetRecipes retrieves all recipes.

func (*SQLiteKB) GetRecipesByCategory

func (kb *SQLiteKB) GetRecipesByCategory(ctx context.Context, category string) ([]RecipeDef, error)

GetRecipesByCategory retrieves recipes filtered by category.

func (*SQLiteKB) GetResourceHistory

func (kb *SQLiteKB) GetResourceHistory(ctx context.Context, poiID, resourceID string, limit int) ([]ResourceHistory, error)

GetResourceHistory retrieves historical resource data

func (*SQLiteKB) GetShip

func (kb *SQLiteKB) GetShip(ctx context.Context, shipID string) (*ShipRecord, error)

GetShip retrieves a ship by ID with its cargo and modules.

func (*SQLiteKB) GetShipClass

func (kb *SQLiteKB) GetShipClass(ctx context.Context, classID string) (*ShipClassDef, error)

GetShipClass retrieves a single ship class by ID.

func (*SQLiteKB) GetShipClasses

func (kb *SQLiteKB) GetShipClasses(ctx context.Context) ([]ShipClassDef, error)

GetShipClasses retrieves all ship classes.

func (*SQLiteKB) GetShipClassesByCategory

func (kb *SQLiteKB) GetShipClassesByCategory(ctx context.Context, category string) ([]ShipClassDef, error)

GetShipClassesByCategory retrieves ship classes filtered by class (e.g., "Mining", "Fighter").

func (*SQLiteKB) GetShipListings

func (kb *SQLiteKB) GetShipListings(ctx context.Context, systemID, stationID string, limit int) ([]ShipListings, error)

GetShipListings retrieves historical ship listings

func (*SQLiteKB) GetSkill

func (kb *SQLiteKB) GetSkill(id string) (*Skill, error)

GetSkill retrieves a single skill by ID, reading from the database first and falling back to static data if no skills are stored.

func (*SQLiteKB) GetSkills

func (kb *SQLiteKB) GetSkills() []Skill

GetSkills retrieves all skills, reading from the database first and falling back to static data if no skills are stored.

func (*SQLiteKB) GetSystem

func (kb *SQLiteKB) GetSystem(ctx context.Context, systemID string) (*System, error)

GetSystem retrieves a system by ID

func (*SQLiteKB) GetSystemDanger

func (kb *SQLiteKB) GetSystemDanger(ctx context.Context, systemID string) (*DangerZone, error)

GetSystemDanger retrieves danger information for a specific system

func (*SQLiteKB) GetSystems

func (kb *SQLiteKB) GetSystems() []System

GetSystems returns all known systems

func (*SQLiteKB) GetUnknownConnections

func (kb *SQLiteKB) GetUnknownConnections(ctx context.Context, systemID string) ([]string, error)

GetUnknownConnections finds unexplored connections from a system

func (*SQLiteKB) HasMarketSnapshotToday

func (kb *SQLiteKB) HasMarketSnapshotToday(ctx context.Context, systemID, stationID string) (bool, error)

HasMarketSnapshotToday checks if a market snapshot was captured today for a station

func (*SQLiteKB) HasShipListingsToday

func (kb *SQLiteKB) HasShipListingsToday(ctx context.Context, systemID, stationID string) (bool, error)

HasShipListingsToday checks if ship listings were captured today for a station

func (*SQLiteKB) ImportKnowledge

func (kb *SQLiteKB) ImportKnowledge(ctx context.Context, exportData string) error

ImportKnowledge imports data from a JSON export

func (*SQLiteKB) ListExports

func (kb *SQLiteKB) ListExports(ctx context.Context) ([]KnowledgeExportMeta, error)

ListExports retrieves metadata for all knowledge exports

func (*SQLiteKB) RecordAnomaly

func (kb *SQLiteKB) RecordAnomaly(ctx context.Context, anomaly Anomaly) error

RecordAnomaly logs an unusual discovery or event

func (*SQLiteKB) RecordHostileEncounter

func (kb *SQLiteKB) RecordHostileEncounter(ctx context.Context, systemID string, encounterType string, details string) error

RecordHostileEncounter logs a hostile encounter in a system

func (*SQLiteKB) RecordJourney

func (kb *SQLiteKB) RecordJourney(ctx context.Context, fromSystem, toSystem string, fuelCost, travelTime float64, agentID string) error

RecordJourney logs a journey between systems for route optimization

func (*SQLiteKB) RecordResourceState

func (kb *SQLiteKB) RecordResourceState(ctx context.Context, poiID, resourceID string, richness, remaining float64, gameTick int64, agentID string) error

RecordResourceState tracks resource levels over time

func (*SQLiteKB) RegisterAgent

func (kb *SQLiteKB) RegisterAgent(ctx context.Context, agentID, name, role, empire string, personality []byte) error

RegisterAgent registers an agent in the knowledge base

func (*SQLiteKB) RememberBase

func (kb *SQLiteKB) RememberBase(ctx context.Context, base SpaceBase) error

RememberBase stores or updates space base knowledge

func (*SQLiteKB) RememberConnection

func (kb *SQLiteKB) RememberConnection(ctx context.Context, fromSystem, toSystem string) error

RememberConnection stores a system connection (with deduplication)

func (*SQLiteKB) RememberPOI

func (kb *SQLiteKB) RememberPOI(ctx context.Context, poi POI) error

RememberPOI stores or updates POI knowledge

func (*SQLiteKB) RememberSystem

func (kb *SQLiteKB) RememberSystem(ctx context.Context, sys System) error

RememberSystem stores or updates system knowledge

func (*SQLiteKB) ResolveAnomaly

func (kb *SQLiteKB) ResolveAnomaly(ctx context.Context, anomalyID int64, status string) error

ResolveAnomaly marks an anomaly as resolved or obsolete

func (*SQLiteKB) StoreItems

func (kb *SQLiteKB) StoreItems(ctx context.Context, items []CatalogItem) error

StoreItems stores or replaces all items in the catalog.

func (*SQLiteKB) StoreMarketAnalysis

func (kb *SQLiteKB) StoreMarketAnalysis(ctx context.Context, analysis MarketAnalysis, agentID string) error

StoreMarketAnalysis stores a market analysis snapshot

func (*SQLiteKB) StoreMarketSnapshot

func (kb *SQLiteKB) StoreMarketSnapshot(ctx context.Context, snapshot MarketSnapshot, agentID string) error

StoreMarketSnapshot stores a market snapshot with its listings

func (*SQLiteKB) StoreMissionTemplates

func (kb *SQLiteKB) StoreMissionTemplates(ctx context.Context, baseID string, missions []MissionTemplate) error

StoreMissionTemplates stores mission templates for a given base, replacing any existing ones.

func (*SQLiteKB) StorePlayer

func (kb *SQLiteKB) StorePlayer(ctx context.Context, player PlayerRecord) error

StorePlayer stores or updates a player record and their stats.

func (*SQLiteKB) StorePlayerSkills

func (kb *SQLiteKB) StorePlayerSkills(ctx context.Context, playerID string, skills []PlayerSkillRecord) error

StorePlayerSkills stores a player's skill progress.

func (*SQLiteKB) StoreRecipes

func (kb *SQLiteKB) StoreRecipes(ctx context.Context, recipes []RecipeDef) error

StoreRecipes stores or replaces all recipes in the catalog.

func (*SQLiteKB) StoreShip

func (kb *SQLiteKB) StoreShip(ctx context.Context, ship ShipRecord) error

StoreShip stores or updates a ship record with its cargo and modules.

func (*SQLiteKB) StoreShipClasses

func (kb *SQLiteKB) StoreShipClasses(ctx context.Context, classes []ShipClassDef) error

StoreShipClasses stores or replaces all ship classes in the catalog.

func (*SQLiteKB) StoreShipListings

func (kb *SQLiteKB) StoreShipListings(ctx context.Context, listings ShipListings, agentID string) error

StoreShipListings stores ship listings at a station

func (*SQLiteKB) StoreSkills

func (kb *SQLiteKB) StoreSkills(ctx context.Context, skills []Skill) error

StoreSkills stores or replaces all skills in the catalog.

func (*SQLiteKB) UpsertSystemFromMap

func (kb *SQLiteKB) UpsertSystemFromMap(ctx context.Context, data MapSystemData) error

UpsertSystemFromMap inserts or updates a system using map data only. Unlike RememberSystem, this preserves richer data (police_level, description, last_updated_tick) that may have been collected by explorers. It only updates fields that the map data provides: name, position, empire (when non-empty), is_stronghold, and connections.

type ShipClassDef

type ShipClassDef struct {
	ID                 string
	Name               string
	Class              string
	Category           string
	Description        string
	Lore               string
	Faction            string
	Tier               int
	Scale              int
	Price              int
	BaseHull           int
	BaseShield         int
	BaseShieldRecharge int
	BaseArmor          int
	BaseSpeed          int
	BaseFuel           int
	CargoCapacity      int
	CPUCapacity        int
	PowerCapacity      int
	WeaponSlots        int
	DefenseSlots       int
	UtilitySlots       int
	BuildTime          int
	ShipyardTier       int
	StarterShip        bool
	TowSpeedBonus      int
	RequiredSkills     map[string]int
	DefaultModules     []string
	FlavorTags         []string
	BuildMaterials     []BuildMaterial
	LastUpdatedTick    int64
}

ShipClassDef represents a ship class definition stored in the knowledge base.

type ShipListing

type ShipListing struct {
	ShipClass    string
	ShipName     string
	BasePrice    float64
	Description  string
	CargoSpace   int
	ModuleSlots  int
	UtilitySlots int
	WeaponSlots  int
}

ShipListing represents a single ship listing at a station

type ShipListings

type ShipListings struct {
	SystemID    string
	SystemName  string
	StationID   string
	StationName string
	GameTick    int64
	Listings    []ShipListing
	CapturedAt  time.Time
}

ShipListings represents captured ship listings at a station

type ShipModuleRecord

type ShipModuleRecord struct {
	ID              string
	TypeID          string
	Name            string
	Type            string
	CPUUsage        int
	PowerUsage      int
	Quality         float64
	QualityGrade    string
	Wear            float64
	WearStatus      string
	LastUpdatedTick int64
}

ShipModuleRecord represents a module fitted on a ship.

type ShipRecord

type ShipRecord struct {
	ID              string
	OwnerID         string
	ClassID         string
	Name            string
	Hull            float64
	MaxHull         float64
	Shield          float64
	MaxShield       float64
	ShieldRecharge  float64
	Armor           float64
	Speed           float64
	Fuel            float64
	MaxFuel         float64
	CargoUsed       float64
	CargoCapacity   float64
	CPUUsed         float64
	CPUCapacity     float64
	PowerUsed       float64
	PowerCapacity   float64
	WeaponSlots     int
	DefenseSlots    int
	UtilitySlots    int
	DockedAtBase    string
	Cargo           []CargoEntry
	Modules         []ShipModuleRecord
	LastUpdatedTick int64
}

ShipRecord represents a player-owned ship stored in the knowledge base.

type Skill

type Skill struct {
	ID             string         `json:"id"`
	Name           string         `json:"name"`
	Category       string         `json:"category"`
	Description    string         `json:"description"`
	MaxLevel       int            `json:"max_level"`
	TrainingSource string         `json:"training_source,omitempty"`
	XPPerLevel     []int          `json:"xp_per_level"`
	BonusPerLevel  map[string]int `json:"bonus_per_level,omitempty"`
	RequiredSkills map[string]int `json:"required_skills,omitempty"`
}

Skill represents a skill in SpaceMolt with its XP requirements

func (*Skill) GetNextLevelXP

func (s *Skill) GetNextLevelXP(currentLevel int) int

GetNextLevelXP returns the XP required to reach the next level from current level

func (*Skill) GetXPForLevel

func (s *Skill) GetXPForLevel(level int) int

GetXPForLevel returns the XP required to reach a specific level (1-indexed)

type SpaceBase

type SpaceBase struct {
	ID              string
	POIID           string // The POI this base is located at
	Name            string
	Description     string
	Empire          string
	DefenseLevel    int
	HasDrones       bool
	PublicAccess    bool
	Services        map[string]bool
	Facilities      []Facility // Facilities with category and level information
	Market          []BaseMarketItem
	LastUpdatedTick int64
}

SpaceBase represents knowledge about a space station, outpost, base, or fortress

func BaseDataFromRawJSON

func BaseDataFromRawJSON(rawJSON []byte, discoveredBy string, lastUpdatedTick int64) (*SpaceBase, error)

BaseDataFromRawJSON extracts base information from raw get_base response JSON Returns a SpaceBase that can be saved to the knowledge base

Example usage in an agent:

rawJSON := client.GetRawJSON("base")
if rawJSON != nil {
    base, err := knowledge.BaseDataFromRawJSON(rawJSON, agentID, state.GetTick())
    if err != nil {
        logger.Printf("Failed to parse base data: %v", err)
        return err
    }
    if err := kb.RememberBase(ctx, *base); err != nil {
        logger.Printf("Failed to save base to knowledge base: %v", err)
        return err
    }
}

type System

type System struct {
	ID              string
	Name            string
	Description     string
	Position        game.Position
	PoliceLevel     int    // Security level 0-3 (0=none, 1=low, 2=medium, 3=high)
	SecurityStatus  string // e.g. "high_sec", "low_sec", "null_sec"
	Empire          string
	IsStronghold    bool
	Connections     []SystemConnection
	POIs            []string
	LastUpdatedTick int64
}

System represents knowledge about a solar system Wraps game.SystemData with exploration metadata

type SystemConnection

type SystemConnection struct {
	SystemID string
	Distance int
}

SystemConnection pairs a connected system ID with the jump distance.

Jump to

Keyboard shortcuts

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