Documentation
¶
Index ¶
- Variables
- func CaptureSurveyAnomaly(ctx context.Context, kb Base, hint, systemID, detectedBy string, tick int64) (bool, error)
- func MissionCatalogID(e serverapi.MissionBoardEntry) (id string, procedural bool)
- type AgentInfo
- type Anomaly
- type Base
- type BaseMarketItem
- type BuildMaterial
- type CargoEntry
- type CatalogItem
- type ChangeSnapshot
- type Config
- type Connection
- type ConnectionMetric
- type ConnectionMetrics
- type DangerZone
- type DemandHistorySample
- type DepletingResource
- type Experience
- type Facility
- type FactionBaseRow
- type FactionFacilityRow
- type FactionFuelBunkerRow
- type FactionListEntry
- type FactionMember
- type FactionMissionRow
- type FactionOrderRow
- type FactionRecord
- type FactionRelation
- type FactionRoomRow
- type FactionStorageItem
- type FactionStorageRow
- type FactionView
- type ItemAmmo
- type ItemConsumableEffect
- type ItemDefense
- type ItemMining
- type ItemModule
- type ItemUtility
- type ItemWeapon
- type KnowledgeExport
- type KnowledgeExportMeta
- type MapSystemData
- type MarketBuyOrderRow
- type MarketSellOrderRow
- type MemoryKB
- func (kb *MemoryKB) AddExperience(ctx context.Context, agentID, expType, description, outcome, location string) error
- func (kb *MemoryKB) Close() error
- func (kb *MemoryKB) ExportKnowledge(ctx context.Context, description string, agentID string) (*KnowledgeExport, error)
- func (kb *MemoryKB) FindCheapestRoute(ctx context.Context, fromSystem, toSystem string, maxHops int) ([]string, float64, error)
- func (kb *MemoryKB) GetActiveAnomalies(ctx context.Context, systemID string) ([]Anomaly, error)
- func (kb *MemoryKB) GetAllStorageSnapshots(_ context.Context) ([]StorageSnapshot, error)
- func (kb *MemoryKB) GetAnomaliesByType(ctx context.Context, anomalyType, severity string, limit int) ([]Anomaly, error)
- func (kb *MemoryKB) GetBase(ctx context.Context, baseID string) (*SpaceBase, error)
- func (kb *MemoryKB) GetBaseByPOI(ctx context.Context, poiID string) (*SpaceBase, error)
- func (kb *MemoryKB) GetChangeSnapshots(_ context.Context, systemID string, limit int) ([]ChangeSnapshot, error)
- func (kb *MemoryKB) GetConnectionMetrics(ctx context.Context) ([]ConnectionMetric, error)
- func (kb *MemoryKB) GetConnections(ctx context.Context) ([]Connection, error)
- func (kb *MemoryKB) GetDangerZones(ctx context.Context, minDangerLevel int) ([]DangerZone, error)
- func (kb *MemoryKB) GetDepletingResources(ctx context.Context, threshold float64) ([]DepletingResource, error)
- func (kb *MemoryKB) GetItem(ctx context.Context, itemID string) (*CatalogItem, error)
- func (kb *MemoryKB) GetItems(ctx context.Context) ([]CatalogItem, error)
- func (kb *MemoryKB) GetItemsByCategory(ctx context.Context, category string) ([]CatalogItem, error)
- func (kb *MemoryKB) GetLatestShipListings(ctx context.Context, systemID, stationID string) (*ShipListings, error)
- func (kb *MemoryKB) GetOptimalRoute(ctx context.Context, fromSystem, toSystem string) (*ConnectionMetrics, error)
- func (kb *MemoryKB) GetPOIs(ctx context.Context, systemID string) ([]POI, error)
- func (kb *MemoryKB) GetPlayer(ctx context.Context, playerID string) (*PlayerRecord, error)
- func (kb *MemoryKB) GetPlayerShips(ctx context.Context, playerID string) ([]ShipRecord, error)
- func (kb *MemoryKB) GetPlayerSkills(ctx context.Context, playerID string) ([]PlayerSkillRecord, error)
- func (kb *MemoryKB) GetRecentExperiences(ctx context.Context, agentID string, limit int) ([]Experience, error)
- func (kb *MemoryKB) GetRecipe(ctx context.Context, recipeID string) (*RecipeDef, error)
- func (kb *MemoryKB) GetRecipes(ctx context.Context) ([]RecipeDef, error)
- func (kb *MemoryKB) GetRecipesByCategory(ctx context.Context, category string) ([]RecipeDef, error)
- func (kb *MemoryKB) GetResourceHistory(ctx context.Context, poiID, resourceID string, limit int) ([]ResourceHistory, error)
- func (kb *MemoryKB) GetShip(ctx context.Context, shipID string) (*ShipRecord, error)
- func (kb *MemoryKB) GetShipClass(ctx context.Context, classID string) (*ShipClassDef, error)
- func (kb *MemoryKB) GetShipClasses(ctx context.Context) ([]ShipClassDef, error)
- func (kb *MemoryKB) GetShipClassesByCategory(ctx context.Context, category string) ([]ShipClassDef, error)
- func (kb *MemoryKB) GetShipListings(ctx context.Context, systemID, stationID string, limit int) ([]ShipListings, error)
- func (kb *MemoryKB) GetSkill(id string) (*Skill, error)
- func (kb *MemoryKB) GetSkills() []Skill
- func (kb *MemoryKB) GetStorageSnapshot(_ context.Context, agentID, baseID string) (*StorageSnapshot, error)
- func (kb *MemoryKB) GetSystem(ctx context.Context, systemID string) (*System, error)
- func (kb *MemoryKB) GetSystemDanger(ctx context.Context, systemID string) (*DangerZone, error)
- func (kb *MemoryKB) GetSystems(ctx context.Context) ([]System, error)
- func (kb *MemoryKB) GetUnknownConnections(ctx context.Context, systemID string) ([]string, error)
- func (kb *MemoryKB) GetXPObservations(_ context.Context, action string, limit int) ([]XPObservation, error)
- func (kb *MemoryKB) GetXPSummary(_ context.Context) ([]XPSummaryRow, error)
- func (kb *MemoryKB) HasShipListingsToday(ctx context.Context, systemID, stationID string) (bool, error)
- func (kb *MemoryKB) ImportKnowledge(ctx context.Context, exportData string) error
- func (kb *MemoryKB) ListExports(ctx context.Context) ([]KnowledgeExportMeta, error)
- func (kb *MemoryKB) RecordAnomaly(ctx context.Context, anomaly Anomaly) error
- func (kb *MemoryKB) RecordChangeSnapshot(_ context.Context, snapshot ChangeSnapshot) error
- func (kb *MemoryKB) RecordHostileEncounter(ctx context.Context, systemID string, encounterType string, details string) error
- func (kb *MemoryKB) RecordJourney(ctx context.Context, fromSystem, toSystem string, fuelCost, travelTime float64, ...) error
- func (kb *MemoryKB) RecordPassengers(_ []SeenPassenger) error
- func (kb *MemoryKB) RecordResourceState(ctx context.Context, poiID, resourceID string, richness, remaining float64, ...) error
- func (kb *MemoryKB) RecordSightings(_ []SeenPlayer) error
- func (kb *MemoryKB) RecordXPObservation(_ context.Context, obs XPObservation) error
- func (kb *MemoryKB) RegisterAgent(ctx context.Context, agentID, name, role, empire string, personality []byte) error
- func (kb *MemoryKB) RememberBase(ctx context.Context, base SpaceBase) error
- func (kb *MemoryKB) RememberConnection(ctx context.Context, fromSystem, toSystem string) error
- func (kb *MemoryKB) RememberPOI(ctx context.Context, poi POI) error
- func (kb *MemoryKB) RememberSystem(ctx context.Context, sys System) error
- func (kb *MemoryKB) ResolveAnomaly(ctx context.Context, anomalyID int64, status string) error
- func (kb *MemoryKB) StoreItems(ctx context.Context, items []CatalogItem) error
- func (kb *MemoryKB) StorePlayer(ctx context.Context, player PlayerRecord) error
- func (kb *MemoryKB) StorePlayerSkills(ctx context.Context, playerID string, skills []PlayerSkillRecord) error
- func (kb *MemoryKB) StoreRecipes(ctx context.Context, recipes []RecipeDef) error
- func (kb *MemoryKB) StoreShip(ctx context.Context, ship ShipRecord) error
- func (kb *MemoryKB) StoreShipClasses(ctx context.Context, classes []ShipClassDef) error
- func (kb *MemoryKB) StoreShipListings(ctx context.Context, listings ShipListings, agentID string) error
- func (kb *MemoryKB) StoreSkills(ctx context.Context, skills []Skill) error
- func (kb *MemoryKB) StoreStorageSnapshot(_ context.Context, snapshot StorageSnapshot) error
- func (kb *MemoryKB) UpdateAgentWalletCredits(_ context.Context, agentID string, credits int) error
- func (kb *MemoryKB) UpsertMissionTemplate(ctx context.Context, entry serverapi.MissionBoardEntry, ...) (*MissionUpsertResult, error)
- type Migration
- type MissionFieldDiff
- type MissionUpsertResult
- type POI
- type PlayerRecord
- type PlayerSkillRecord
- type PlayerStatsRecord
- type PublicFacility
- type RecipeDef
- type RecipeIngredient
- type RecipeProduct
- type ResourceHistory
- type SQLiteKB
- func (kb *SQLiteKB) AddExperience(ctx context.Context, agentID, expType, description, outcome, location string) error
- func (kb *SQLiteKB) Close() error
- func (kb *SQLiteKB) DB() *sql.DB
- func (kb *SQLiteKB) ExportKnowledge(ctx context.Context, description string, agentID string) (*KnowledgeExport, error)
- func (kb *SQLiteKB) FacilitiesForRecipe(ctx context.Context, recipeID string) ([]PublicFacility, error)
- func (kb *SQLiteKB) FactionCapturedAt(ctx context.Context, factionID string) (time.Time, bool, error)
- func (kb *SQLiteKB) FactionTag(ctx context.Context, factionID string) (string, bool, error)
- func (kb *SQLiteKB) FindCheapestRoute(ctx context.Context, fromSystem, toSystem string, maxHops int) ([]string, float64, error)
- func (kb *SQLiteKB) GetActiveAnomalies(ctx context.Context, systemID string) ([]Anomaly, error)
- func (kb *SQLiteKB) GetAllStorageSnapshots(ctx context.Context) ([]StorageSnapshot, error)
- func (kb *SQLiteKB) GetAnomaliesByType(ctx context.Context, anomalyType, severity string, limit int) ([]Anomaly, error)
- func (kb *SQLiteKB) GetBase(ctx context.Context, baseID string) (*SpaceBase, error)
- func (kb *SQLiteKB) GetBaseByPOI(ctx context.Context, poiID string) (*SpaceBase, error)
- func (kb *SQLiteKB) GetChangeSnapshots(ctx context.Context, systemID string, limit int) ([]ChangeSnapshot, error)
- func (kb *SQLiteKB) GetConnectionMetrics(ctx context.Context) ([]ConnectionMetric, error)
- func (kb *SQLiteKB) GetConnections(ctx context.Context) ([]Connection, error)
- func (kb *SQLiteKB) GetDangerZones(ctx context.Context, minDangerLevel int) ([]DangerZone, error)
- func (kb *SQLiteKB) GetDepletingResources(ctx context.Context, threshold float64) ([]DepletingResource, error)
- func (kb *SQLiteKB) GetItem(ctx context.Context, itemID string) (*CatalogItem, error)
- func (kb *SQLiteKB) GetItems(ctx context.Context) ([]CatalogItem, error)
- func (kb *SQLiteKB) GetItemsByCategory(ctx context.Context, category string) ([]CatalogItem, error)
- func (kb *SQLiteKB) GetLatestShipListings(ctx context.Context, systemID, stationID string) (*ShipListings, error)
- func (kb *SQLiteKB) GetOptimalRoute(ctx context.Context, fromSystem, toSystem string) (*ConnectionMetrics, error)
- func (kb *SQLiteKB) GetPOIs(ctx context.Context, systemID string) ([]POI, error)
- func (kb *SQLiteKB) GetPassenger(citizenID string) (*SeenPassenger, error)
- func (kb *SQLiteKB) GetPlayer(ctx context.Context, playerID string) (*PlayerRecord, error)
- func (kb *SQLiteKB) GetPlayerShips(ctx context.Context, playerID string) ([]ShipRecord, error)
- func (kb *SQLiteKB) GetPlayerSkills(ctx context.Context, playerID string) ([]PlayerSkillRecord, error)
- func (kb *SQLiteKB) GetRecentExperiences(ctx context.Context, agentID string, limit int) ([]Experience, error)
- func (kb *SQLiteKB) GetRecipe(ctx context.Context, recipeID string) (*RecipeDef, error)
- func (kb *SQLiteKB) GetRecipes(ctx context.Context) ([]RecipeDef, error)
- func (kb *SQLiteKB) GetRecipesByCategory(ctx context.Context, category string) ([]RecipeDef, error)
- func (kb *SQLiteKB) GetResourceHistory(ctx context.Context, poiID, resourceID string, limit int) ([]ResourceHistory, error)
- func (kb *SQLiteKB) GetSeenPlayer(playerID string) (*SeenPlayer, error)
- func (kb *SQLiteKB) GetShip(ctx context.Context, shipID string) (*ShipRecord, error)
- func (kb *SQLiteKB) GetShipClass(ctx context.Context, classID string) (*ShipClassDef, error)
- func (kb *SQLiteKB) GetShipClasses(ctx context.Context) ([]ShipClassDef, error)
- func (kb *SQLiteKB) GetShipClassesByCategory(ctx context.Context, category string) ([]ShipClassDef, error)
- func (kb *SQLiteKB) GetShipListings(ctx context.Context, systemID, stationID string, limit int) ([]ShipListings, error)
- func (kb *SQLiteKB) GetSkill(id string) (*Skill, error)
- func (kb *SQLiteKB) GetSkills() []Skill
- func (kb *SQLiteKB) GetStorageSnapshot(ctx context.Context, agentID, baseID string) (*StorageSnapshot, error)
- func (kb *SQLiteKB) GetSystem(ctx context.Context, systemID string) (*System, error)
- func (kb *SQLiteKB) GetSystemDanger(ctx context.Context, systemID string) (*DangerZone, error)
- func (kb *SQLiteKB) GetSystems(ctx context.Context) ([]System, error)
- func (kb *SQLiteKB) GetUnknownConnections(ctx context.Context, systemID string) ([]string, error)
- func (kb *SQLiteKB) GetXPObservations(ctx context.Context, action string, limit int) ([]XPObservation, error)
- func (kb *SQLiteKB) GetXPSummary(ctx context.Context) ([]XPSummaryRow, error)
- func (kb *SQLiteKB) HasShipListingsToday(ctx context.Context, systemID, stationID string) (bool, error)
- func (kb *SQLiteKB) ImportKnowledge(ctx context.Context, exportData string) error
- func (kb *SQLiteKB) LatestDemandCapture(ctx context.Context, stationID string) (time.Time, bool, error)
- func (kb *SQLiteKB) ListExports(ctx context.Context) ([]KnowledgeExportMeta, error)
- func (kb *SQLiteKB) ListFactionIDs(ctx context.Context) ([]string, error)
- func (kb *SQLiteKB) ListPassengers(ctx context.Context, citizenship string) ([]SeenPassenger, error)
- func (kb *SQLiteKB) ListSeenFactions(ctx context.Context) ([]SeenFaction, error)
- func (kb *SQLiteKB) LoadDemandHistory(ctx context.Context, itemID, stationID string, limit int) ([]DemandHistorySample, error)
- func (kb *SQLiteKB) LoadFactionView(ctx context.Context, factionID string) (*FactionView, error)
- func (kb *SQLiteKB) LoadMarketBuyOrders(ctx context.Context) ([]MarketBuyOrderRow, error)
- func (kb *SQLiteKB) LoadMarketSellOrders(ctx context.Context) ([]MarketSellOrderRow, error)
- func (kb *SQLiteKB) LoadSupplyHistory(ctx context.Context, itemID, stationID string, limit int) ([]SupplyHistorySample, error)
- func (kb *SQLiteKB) RecordAnomaly(ctx context.Context, anomaly Anomaly) error
- func (kb *SQLiteKB) RecordChangeSnapshot(ctx context.Context, snapshot ChangeSnapshot) error
- func (kb *SQLiteKB) RecordDemandHistory(ctx context.Context, samples []DemandHistorySample) error
- func (kb *SQLiteKB) RecordHostileEncounter(ctx context.Context, systemID string, encounterType string, details string) error
- func (kb *SQLiteKB) RecordJourney(ctx context.Context, fromSystem, toSystem string, fuelCost, travelTime float64, ...) error
- func (kb *SQLiteKB) RecordPassengers(obs []SeenPassenger) error
- func (kb *SQLiteKB) RecordResourceState(ctx context.Context, poiID, resourceID string, richness, remaining float64, ...) error
- func (kb *SQLiteKB) RecordSightings(obs []SeenPlayer) error
- func (kb *SQLiteKB) RecordSupplyHistory(ctx context.Context, samples []SupplyHistorySample) error
- func (kb *SQLiteKB) RecordXPObservation(ctx context.Context, obs XPObservation) error
- func (kb *SQLiteKB) RegisterAgent(ctx context.Context, agentID, name, role, empire string, personality []byte) error
- func (kb *SQLiteKB) RememberBase(ctx context.Context, base SpaceBase) error
- func (kb *SQLiteKB) RememberConnection(ctx context.Context, fromSystem, toSystem string) error
- func (kb *SQLiteKB) RememberPOI(ctx context.Context, poi POI) error
- func (kb *SQLiteKB) RememberSystem(ctx context.Context, sys System) error
- func (kb *SQLiteKB) ReplaceFactionFacilities(ctx context.Context, factionID, baseID string, fs []FactionFacilityRow) error
- func (kb *SQLiteKB) ReplaceFactionFuelBunkers(ctx context.Context, factionID string, bunkers []FactionFuelBunkerRow) error
- func (kb *SQLiteKB) ReplaceFactionMembers(ctx context.Context, factionID string, members []FactionMember) error
- func (kb *SQLiteKB) ReplaceFactionMissions(ctx context.Context, factionID, baseID string, ms []FactionMissionRow) error
- func (kb *SQLiteKB) ReplaceFactionOrders(ctx context.Context, factionID, baseID string, orders []FactionOrderRow) error
- func (kb *SQLiteKB) ReplaceFactionRelations(ctx context.Context, factionID string, rels []FactionRelation) error
- func (kb *SQLiteKB) ReplaceFactionRooms(ctx context.Context, factionID, baseID string, rooms []FactionRoomRow) error
- func (kb *SQLiteKB) ReplaceFactionStorage(ctx context.Context, s FactionStorageRow) error
- func (kb *SQLiteKB) ReplaceStationBuyOrders(ctx context.Context, stationID string, orders []MarketBuyOrderRow) error
- func (kb *SQLiteKB) ReplaceStationSellOrders(ctx context.Context, stationID string, orders []MarketSellOrderRow) error
- func (kb *SQLiteKB) ResolveAnomaly(ctx context.Context, anomalyID int64, status string) error
- func (kb *SQLiteKB) StoreFaction(ctx context.Context, r FactionRecord) error
- func (kb *SQLiteKB) StoreFactionBase(ctx context.Context, b FactionBaseRow) error
- func (kb *SQLiteKB) StoreItems(ctx context.Context, items []CatalogItem) error
- func (kb *SQLiteKB) StorePlayer(ctx context.Context, player PlayerRecord) error
- func (kb *SQLiteKB) StorePlayerSkills(ctx context.Context, playerID string, skills []PlayerSkillRecord) error
- func (kb *SQLiteKB) StoreRecipes(ctx context.Context, recipes []RecipeDef) error
- func (kb *SQLiteKB) StoreShip(ctx context.Context, ship ShipRecord) error
- func (kb *SQLiteKB) StoreShipClasses(ctx context.Context, classes []ShipClassDef) error
- func (kb *SQLiteKB) StoreShipListings(ctx context.Context, listings ShipListings, agentID string) error
- func (kb *SQLiteKB) StoreSkills(ctx context.Context, skills []Skill) error
- func (kb *SQLiteKB) StoreStorageSnapshot(ctx context.Context, snapshot StorageSnapshot) error
- func (kb *SQLiteKB) UpdateAgentWalletCredits(ctx context.Context, agentID string, credits int) error
- func (kb *SQLiteKB) UpsertFactionListEntry(ctx context.Context, e FactionListEntry) (bool, error)
- func (kb *SQLiteKB) UpsertMissionTemplate(ctx context.Context, entry serverapi.MissionBoardEntry, ...) (*MissionUpsertResult, error)
- func (kb *SQLiteKB) UpsertPublicFacilities(ctx context.Context, rows []PublicFacility) error
- func (kb *SQLiteKB) UpsertSystemFromMap(ctx context.Context, data MapSystemData) error
- type SeenFaction
- type SeenPassenger
- type SeenPlayer
- type ShipCapability
- type ShipClassDef
- type ShipListing
- type ShipListings
- type ShipModuleRecord
- type ShipRecord
- type Skill
- type SpaceBase
- type StorageSnapshot
- type StorageSnapshotItem
- type StorageSnapshotShip
- type SupplyHistorySample
- type System
- type SystemConnection
- type XPObservation
- type XPSummaryRow
- type XPTracker
Constants ¶
This section is empty.
Variables ¶
var FacilityCategoryMapping = map[string]Facility{
"grand_solarian_exchange": {ID: "grand_solarian_exchange", Name: "Grand Solarian Exchange", Category: "service", Level: 5},
"confederacy_administrative_bureau": {ID: "confederacy_administrative_bureau", Name: "Solarian Admin Bureau", Category: "service", Level: 5},
"confederacy_bonded_warehouse": {ID: "confederacy_bonded_warehouse", Name: "Solarian Bonded Warehouse", Category: "service", Level: 5},
"solarian_precision_drydock": {ID: "solarian_precision_drydock", Name: "Precision Drydock", Category: "service", Level: 5},
"solarian_naval_shipyard": {ID: "solarian_naval_shipyard", Name: "Naval Shipyard", Category: "service", Level: 5},
"solarian_research_labs": {ID: "solarian_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_biosphere": {ID: "solarian_biosphere", 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_line": {ID: "sensor_assembly_line", Name: "Sensor Assembly", Category: "production", Level: 2},
"solarian_biosphere_kitchen": {ID: "solarian_biosphere_kitchen", Name: "Solarian Galley", Category: "production", Level: 1},
"solarian_fuel_grid": {ID: "solarian_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},
"haven_cipher_foundry": {ID: "haven_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},
"haven_ecosync": {ID: "haven_ecosync", 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},
"null_atmosphere_processor": {ID: "null_atmosphere_processor", Name: "Voidborn Atmosphere", Category: "infrastructure", Level: 5},
"dimensional_vault": {ID: "dimensional_vault", Name: "Dimensional Vault", Category: "infrastructure", Level: 5},
"void_energy_dispenser": {ID: "void_energy_dispenser", Name: "Energy Dispenser", Category: "infrastructure", Level: 5},
"neural_growth_chamber": {ID: "neural_growth_chamber", Name: "Neural Forge", Category: "infrastructure", Level: 5},
"reconstruction_matrix": {ID: "reconstruction_matrix", Name: "Reconstruction Matrix", Category: "infrastructure", Level: 5},
"pattern_council_terminal": {ID: "pattern_council_terminal", Name: "Pattern Council", Category: "faction", Level: 5},
"crystalline_cradle": {ID: "crystalline_cradle", Name: "Crystalline Cradle", Category: "faction", Level: 5},
"null_energy_shaping_chamber": {ID: "null_energy_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},
"fleet_command": {ID: "fleet_command", Name: "Crimson Fleet Command", Category: "service", Level: 5},
"war_market": {ID: "war_market", Name: "War Market", Category: "service", Level: 5},
"fleet_life_support": {ID: "fleet_life_support", Name: "Crimson Life Support", Category: "infrastructure", Level: 5},
"military_grade_reactor": {ID: "military_grade_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},
"fleet_forge_distillery": {ID: "fleet_forge_distillery", Name: "Crimson Distillery", Category: "production", Level: 5},
"fleet_fuel_bunker": {ID: "fleet_fuel_bunker", Name: "Crimson Fuel Bunker", Category: "production", Level: 5},
"fleet_munitions_vault": {ID: "fleet_munitions_vault", Name: "Munitions Vault", Category: "production", Level: 5},
"crimson_war_forge": {ID: "crimson_war_forge", Name: "Crimson War Forge", Category: "production", Level: 5},
"fleet_weapons_forge": {ID: "fleet_weapons_forge", Name: "Weapons Forge", Category: "production", Level: 5},
"frontier_exchange": {ID: "frontier_exchange", Name: "Frontier Exchange", Category: "service", Level: 1},
"the_notice_board": {ID: "the_notice_board", Name: "Notice Board", Category: "service", Level: 1},
"the_magazine_still": {ID: "the_magazine_still", Name: "Still", Category: "service", Level: 1},
"frontier_fuel_siphon": {ID: "frontier_fuel_siphon", Name: "Fuel Siphon", Category: "infrastructure", Level: 1},
"frontier_recycler": {ID: "frontier_recycler", Name: "Life Support", Category: "infrastructure", Level: 1},
"salvage_reactor": {ID: "salvage_reactor", Name: "Salvage Reactor", Category: "infrastructure", Level: 1},
"hull_lockers": {ID: "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 ¶
func CaptureSurveyAnomaly ¶ added in v0.2.0
func CaptureSurveyAnomaly(ctx context.Context, kb Base, hint, systemID, detectedBy string, tick int64) (bool, error)
CaptureSurveyAnomaly parses a survey anomaly hint and persists it, skipping the write when an active anomaly with the same type and description already exists for the system (so repeat surveys don't pile up duplicates). It returns (true, nil) only when a new row was recorded; an empty hint is a silent no-op.
func MissionCatalogID ¶ added in v0.2.5
func MissionCatalogID(e serverapi.MissionBoardEntry) (id string, procedural bool)
MissionCatalogID returns the catalog key for a board entry and whether it is a procedural (route-generated) mission. Hand-authored missions carry a stable template_id and are keyed by it (procedural=false). Procedural missions (couriers, trade-runs) carry no template_id; their mission_id embeds a per-instance "~<hash>" suffix, so the key is the mission_id with that suffix stripped (procedural=true) — which dedups repeat sightings of the same route. id is "" when the entry has neither a template_id nor a mission_id (caller must skip such entries).
Types ¶
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
func ParseSurveyAnomaly ¶ added in v0.2.0
ParseSurveyAnomaly turns a survey_system AnomalyHint into an Anomaly record. It returns ok=false for an empty hint. When the hint points toward another system ("... toward X (N jumps)") the target system and jump count are parsed into Details; an "in this system" hint sets InSystem=true. The raw hint is always preserved as the Description and in Details.raw.
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
GetSystems(ctx context.Context) ([]System, error)
// GetConnections returns all system connections (for graph building)
GetConnections(ctx context.Context) ([]Connection, error)
// GetConnectionMetrics returns connection metrics (for weighted pathfinding)
GetConnectionMetrics(ctx context.Context) ([]ConnectionMetric, 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
// 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)
// Agent wallet
UpdateAgentWalletCredits(ctx context.Context, agentID string, credits int) error
// Storage snapshots
StoreStorageSnapshot(ctx context.Context, snapshot StorageSnapshot) error
GetStorageSnapshot(ctx context.Context, agentID, baseID string) (*StorageSnapshot, error)
GetAllStorageSnapshots(ctx context.Context) ([]StorageSnapshot, error)
// Change detection snapshots
RecordChangeSnapshot(ctx context.Context, snapshot ChangeSnapshot) error
GetChangeSnapshots(ctx context.Context, systemID string, limit int) ([]ChangeSnapshot, error)
// XP tracking
RecordXPObservation(ctx context.Context, obs XPObservation) error
GetXPObservations(ctx context.Context, action string, limit int) ([]XPObservation, error)
GetXPSummary(ctx context.Context) ([]XPSummaryRow, error)
// Mission catalog: stores a global catalog of hand-authored mission templates
// observed at mission boards, keyed by template_id. Returns diffs when an
// existing row's catalog fields have changed.
UpsertMissionTemplate(
ctx context.Context,
entry serverapi.MissionBoardEntry,
baseID, systemID string,
tick int64,
) (*MissionUpsertResult, error)
// RecordSightings persists a batch of player observations. Empty
// PlayerIDs are dropped. Implementations may choose to no-op (e.g.
// the in-memory KB).
RecordSightings(obs []SeenPlayer) error
// RecordPassengers persists a batch of passenger (citizen) observations
// into the identity catalog. Empty CitizenIDs are dropped. Implementations
// may choose to no-op (e.g. the in-memory KB).
RecordPassengers(obs []SeenPassenger) error
}
Base provides the KB interface for both SQLite and in-memory implementations
type BaseMarketItem ¶
BaseMarketItem represents an item for sale at a base market
type BuildMaterial ¶
BuildMaterial represents a material required to build a ship class.
type CargoEntry ¶
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
Hazardous bool
PowerBonus int
// Item-level requirements and flags.
QuestItem bool
ExtractedBy string
RequiredSkills map[string]int
RegionLock []string
// Passenger berths (passenger-hauler modules).
PassengerEconomyBerths int
PassengerBusinessBerths int
PassengerFirstBerths int
// Module detail (non-nil when item is a ship module)
Module *ItemModule
// Consumable effect detail (non-nil when item has a non-ammo effect)
ConsumableEffect *ItemConsumableEffect
// Ammo detail (non-nil when item is ammunition)
Ammo *ItemAmmo
}
CatalogItem represents an item from the game catalog.
type ChangeSnapshot ¶ added in v0.2.0
type ChangeSnapshot struct {
ID int64
EntityType string // "system", "poi", "base"
EntityID string
SystemID string
ChangeSummary string // human-readable summary of what changed
OldData string // JSON snapshot of old values
DetectedBy string // agent ID
DetectedAtTick int64
DetectedAt time.Time
}
ChangeSnapshot records old data when a system, POI, or base change is detected.
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 Connection ¶ added in v0.2.0
Connection represents a direct connection between two systems. Unlike SystemConnection (which is embedded in System), this is a standalone record for graph building queries.
type ConnectionMetric ¶ added in v0.2.0
type ConnectionMetric struct {
FromSystem string
ToSystem string
AvgFuelCost float64
AvgTravelTime float64
LastTraveled string // ISO-8601 timestamp
}
ConnectionMetric represents aggregated travel metrics for a connection. Used for weighted pathfinding (fuel cost, travel time).
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 DemandHistorySample ¶ added in v0.2.0
type DemandHistorySample struct {
StationID string `json:"station_id"`
SystemID string `json:"system_id"`
ItemID string `json:"item_id"`
ItemName string `json:"item_name"`
BucketAt time.Time `json:"bucket_at"`
CapturedAt time.Time `json:"captured_at"`
BestPrice float64 `json:"best_price"`
TotalQty float64 `json:"total_qty"`
SMBestPrice float64 `json:"sm_best_price"`
SMQty float64 `json:"sm_qty"`
OrderCount int `json:"order_count"`
}
DemandHistorySample is one (station, item, hourly bucket) aggregate of buy-order demand, persisted to market_demand_history to build a time series. BucketAt is the capture time truncated to the bucket size (the upsert key); CapturedAt is the actual last observation time within that bucket. SMBestPrice and SMQty are the Station-Manager (source=="station") slice of the demand.
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 type ID (e.g., "commerce_hub")
InstanceID string // Unique instance ID for this facility at this base
Name string // Display name
Description string // Current description (may reflect condition)
Category string // "service", "infrastructure", "production", "faction", "personal"
Level int // Facility level (1-5)
Active bool // Whether the facility is currently active
MaintenanceSatisfied bool // Whether maintenance requirements are met
Service string // Service provided (e.g., "market", "repair")
RecipeID string // Crafting recipe ID for production facilities
LastUpdated int64 // Last updated tick for data freshness tracking
}
Facility represents a facility at a base with category and level information.
type FactionBaseRow ¶ added in v0.2.0
type FactionBaseRow struct {
FactionID string
BaseID string
BaseName string
SystemID string
SystemName string
POIID string
ServicesJSON string
CapturedAt time.Time
}
FactionBaseRow is an owned base / location.
type FactionFacilityRow ¶ added in v0.2.0
type FactionFacilityRow struct {
FactionID string
BaseID string
FacilityID string
FacilityType string
Category string
Level int
Status string
RecipeID string
DetailsJSON string
CapturedAt time.Time
}
FactionFacilityRow is a faction facility at a base.
type FactionFuelBunkerRow ¶ added in v0.2.0
type FactionFuelBunkerRow struct {
FactionID string
BaseID string
BaseName string
FuelReserve int
FuelCapacity int
CapturedAt time.Time
}
FactionFuelBunkerRow is one base's fuel-bunker status for a faction (faction_info galaxy-wide fuel summary, gameserver v0.346.0+).
type FactionListEntry ¶ added in v0.2.0
type FactionListEntry struct {
FactionID string
Name string
Tag string
LeaderUsername string
MemberCount int
OwnedBases int
PrimaryColor string
SecondaryColor string
}
FactionListEntry holds the lightweight header fields a faction_list response carries — a strict subset of FactionRecord. It omits the columns only a full faction_info capture provides (treasury, leader_id, description, charter, emblem, founded_utc, intel_*), so seeding from it must not clobber those.
type FactionMember ¶ added in v0.2.0
type FactionMember struct {
FactionID string
PlayerID string
Username string
Role string
JoinedUTC string
LastSeenUTC string
IsOnline bool
CapturedAt time.Time
}
FactionMember is one member of a faction.
type FactionMissionRow ¶ added in v0.2.0
type FactionMissionRow struct {
FactionID string
BaseID string
MissionID string
Title string
Type string
Description string
GiverName string
RewardsJSON string
ObjectivesJSON string
AssignedPlayerID string
ExpirationUTC string
CapturedAt time.Time
}
FactionMissionRow is a posted faction mission.
type FactionOrderRow ¶ added in v0.2.0
type FactionOrderRow struct {
FactionID string
BaseID string
OrderID string
Side string // "buy" | "sell"
ItemID string
ItemName string
PriceEach float64
Quantity float64
CapturedAt time.Time
}
FactionOrderRow is a faction market buy/sell order.
type FactionRecord ¶ added in v0.2.0
type FactionRecord struct {
FactionID string
Name string
Tag string
LeaderID string
LeaderUsername string
Treasury int
MemberCount int
OwnedBases int
Description string
Charter string
Emblem string
PrimaryColor string
SecondaryColor string
FoundedUTC string
IntelSystems int
IntelTrade int
CapturedAt time.Time
}
FactionRecord is the current-state header row for a faction.
type FactionRelation ¶ added in v0.2.0
type FactionRelation struct {
FactionID string
TargetFactionID string
TargetName string
TargetTag string
Kind string // "ally" | "enemy" | "war" | "peace_proposal"
Reason string
Terms string
OurKills int
TheirKills int
StartedUTC string
CapturedAt time.Time
}
FactionRelation is an ally/enemy/war/peace_proposal edge.
type FactionRoomRow ¶ added in v0.2.0
type FactionRoomRow struct {
FactionID string
BaseID string
RoomID string
Name string
Access string
Description string
CapturedAt time.Time
}
FactionRoomRow is a faction common-space room at a base.
type FactionStorageItem ¶ added in v0.2.0
FactionStorageItem is one item in faction storage at a base.
type FactionStorageRow ¶ added in v0.2.0
type FactionStorageRow struct {
FactionID string
BaseID string
Credits int
ItemCount int
Items []FactionStorageItem
CapturedAt time.Time
}
FactionStorageRow is faction storage at a single base (header + items).
type FactionView ¶ added in v0.2.0
type FactionView struct {
Faction FactionRecord
Members []FactionMember
Relations []FactionRelation
Bases []FactionBaseRow
Facilities []FactionFacilityRow
Storage []FactionStorageRow
Orders []FactionOrderRow
Missions []FactionMissionRow
Rooms []FactionRoomRow
FuelBunkers []FactionFuelBunkerRow
}
FactionView is the full assembled current state for one faction, used by the dashboard renderer.
type ItemAmmo ¶ added in v0.2.0
type ItemAmmo struct {
AmmoType string // "autocannon", "missile", "railgun", "plasma", "em_charge", "torpedo", "mine", "void_core"
// Modifiers holds projectile stat modifiers (damage_mod, armor_bypass,
// dot_pct, untraceable, ...) as a generic map. Stored as JSON because the
// set is sparse and the server adds modifiers over time.
Modifiers map[string]any
}
ItemAmmo holds ammunition type data.
type ItemConsumableEffect ¶ added in v0.2.0
type ItemConsumableEffect struct {
EffectType string // "buff", "repair", "fuel", "shield", "power", "probe", "countermeasure", "beacon", "emergency_jump"
Subtype string
Amount *int
Duration *int
Stat string
}
ItemConsumableEffect holds effect data for consumable items (non-ammo).
type ItemDefense ¶ added in v0.2.0
type ItemDefense struct {
ArmorBonus *int
HullBonus *int
ShieldBonus *int
ShieldRechargeBonus *int
ArmorRepairRate *int
ResistanceBonus map[string]float64 // e.g. {"em": 30, "kinetic": 25}
DamageReduction *float64
CloakStrength *int
Cooldown *int
Damage *int
DamageType string
Range *int
}
ItemDefense holds defense-module-specific attributes.
type ItemMining ¶ added in v0.2.0
ItemMining holds mining-module-specific attributes.
type ItemModule ¶ added in v0.2.0
type ItemModule struct {
Type string // "weapon", "defense", "mining", "utility"
TypeID string // server-assigned module identifier
Slot string // fitting slot the module occupies
CPUUsage int
PowerUsage int
Hidden bool
Special string // comma-separated special ability tags
// Subtype detail (exactly one is non-nil)
Weapon *ItemWeapon
Defense *ItemDefense
Mining *ItemMining
Utility *ItemUtility
}
ItemModule holds common fields for all fitted ship modules.
type ItemUtility ¶ added in v0.2.0
type ItemUtility struct {
SpeedBonus *int
CargoBonus *int
CloakStrength *int
ScannerPower *int
AccuracyBonus *int
TrackingBonus *int
SignatureBonus *int
FuelEfficiency *float64
DroneBandwidth *int
DroneCapacity *int
HarvestPower *int
HarvestRange *int
SurveyPower *int
SurveyRange *int
TowSpeedPenalty *int
CPUBonus *int
MaxFuelBonus *int
HullPenalty *int
SpeedPenalty *int
Cooldown *int
}
ItemUtility holds utility-module-specific attributes.
type ItemWeapon ¶ added in v0.2.0
type ItemWeapon struct {
Damage int
DamageType string // "kinetic", "energy", "em", "explosive", "void", "thermal"
Range *int // nullable
Reach *int // nullable
Cooldown int
AmmoType string // empty for energy weapons
MagazineSize *int // nil when AmmoType is empty
ArmorBypassBonus *float64 // fraction of armor ignored
ShieldBypassBonus *float64 // fraction of shield ignored
}
ItemWeapon holds weapon-specific module attributes.
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 MarketBuyOrderRow ¶ added in v0.2.0
type MarketBuyOrderRow struct {
StationID string
SystemID string
ItemID string
ItemName string
PriceEach float64
Quantity float64
MyQuantity float64
Source string
CapturedAt time.Time
}
MarketBuyOrderRow is a single buy order captured from a view_market response, carrying Source so the report can distinguish Station Manager ("station") orders from player orders ("" — null source in the compact response). MyQuantity is the slice of Quantity owned by the capturing player (from the compact response's my_quantity), letting the demand report skip rows whose demand is entirely the player's own buy orders.
type MarketSellOrderRow ¶ added in v0.2.0
type MarketSellOrderRow struct {
StationID string
SystemID string
ItemID string
ItemName string
PriceEach float64
Quantity float64
MyQuantity float64
Source string
CapturedAt time.Time
}
MarketSellOrderRow is a single sell order captured from a view_market response — the supply-side mirror of MarketBuyOrderRow. Source distinguishes Station Manager ("station") supply from player listings (""). MyQuantity is the slice of Quantity the capturing player listed themselves.
type MemoryKB ¶
type MemoryKB struct {
// contains filtered or unexported fields
}
MemoryKB is an in-memory knowledge base for MVP
func (*MemoryKB) AddExperience ¶
func (kb *MemoryKB) AddExperience(ctx context.Context, agentID, expType, description, outcome, location string) error
AddExperience logs an agent experience
func (*MemoryKB) ExportKnowledge ¶
func (*MemoryKB) FindCheapestRoute ¶
func (*MemoryKB) GetActiveAnomalies ¶
func (*MemoryKB) GetAllStorageSnapshots ¶ added in v0.2.0
func (kb *MemoryKB) GetAllStorageSnapshots(_ context.Context) ([]StorageSnapshot, error)
func (*MemoryKB) GetAnomaliesByType ¶
func (*MemoryKB) GetBaseByPOI ¶
GetBaseByPOI retrieves a base by its POI ID
func (*MemoryKB) GetChangeSnapshots ¶ added in v0.2.0
func (*MemoryKB) GetConnectionMetrics ¶ added in v0.2.0
func (kb *MemoryKB) GetConnectionMetrics(ctx context.Context) ([]ConnectionMetric, error)
GetConnectionMetrics returns connection metrics (for weighted pathfinding)
func (*MemoryKB) GetConnections ¶ added in v0.2.0
func (kb *MemoryKB) GetConnections(ctx context.Context) ([]Connection, error)
GetConnections returns all system connections (for graph building)
func (*MemoryKB) GetDangerZones ¶
func (*MemoryKB) GetDepletingResources ¶
func (*MemoryKB) GetItems ¶
func (kb *MemoryKB) GetItems(ctx context.Context) ([]CatalogItem, error)
func (*MemoryKB) GetItemsByCategory ¶
func (*MemoryKB) GetLatestShipListings ¶
func (kb *MemoryKB) GetLatestShipListings(ctx context.Context, systemID, stationID string) (*ShipListings, error)
GetLatestShipListings retrieves the most recent ship listings
func (*MemoryKB) GetOptimalRoute ¶
func (*MemoryKB) GetPlayerShips ¶
func (*MemoryKB) GetPlayerSkills ¶
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) GetRecipes ¶
func (*MemoryKB) GetRecipesByCategory ¶
func (*MemoryKB) GetResourceHistory ¶
func (*MemoryKB) GetShipClass ¶
func (*MemoryKB) GetShipClasses ¶
func (kb *MemoryKB) GetShipClasses(ctx context.Context) ([]ShipClassDef, error)
func (*MemoryKB) GetShipClassesByCategory ¶
func (*MemoryKB) GetShipListings ¶
func (kb *MemoryKB) GetShipListings(ctx context.Context, systemID, stationID string, limit int) ([]ShipListings, error)
GetShipListings retrieves historical ship listings
func (*MemoryKB) GetStorageSnapshot ¶ added in v0.2.0
func (*MemoryKB) GetSystemDanger ¶
func (*MemoryKB) GetSystems ¶
GetSystemsWithContext returns all known systems (with context for graph building)
func (*MemoryKB) GetUnknownConnections ¶
GetUnknownConnections finds unexplored connections from a system
func (*MemoryKB) GetXPObservations ¶ added in v0.2.0
func (*MemoryKB) GetXPSummary ¶ added in v0.2.0
func (kb *MemoryKB) GetXPSummary(_ context.Context) ([]XPSummaryRow, error)
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 (*MemoryKB) ListExports ¶
func (kb *MemoryKB) ListExports(ctx context.Context) ([]KnowledgeExportMeta, error)
func (*MemoryKB) RecordAnomaly ¶
func (*MemoryKB) RecordChangeSnapshot ¶ added in v0.2.0
func (kb *MemoryKB) RecordChangeSnapshot(_ context.Context, snapshot ChangeSnapshot) error
func (*MemoryKB) RecordHostileEncounter ¶
func (*MemoryKB) RecordJourney ¶
func (*MemoryKB) RecordPassengers ¶ added in v0.2.0
func (kb *MemoryKB) RecordPassengers(_ []SeenPassenger) error
RecordPassengers is a no-op for the in-memory KB — the passenger catalog is persistent-only state, mirroring RecordSightings.
func (*MemoryKB) RecordResourceState ¶
func (*MemoryKB) RecordSightings ¶ added in v0.2.0
func (kb *MemoryKB) RecordSightings(_ []SeenPlayer) error
RecordSightings is a no-op for the in-memory KB — sightings are persistent-only state and the memory backend exists for tests/agents that don't care to retain them.
func (*MemoryKB) RecordXPObservation ¶ added in v0.2.0
func (kb *MemoryKB) RecordXPObservation(_ context.Context, obs XPObservation) 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 ¶
RememberBase stores or updates space base knowledge
func (*MemoryKB) RememberConnection ¶
RememberConnection stores a system connection (with deduplication)
func (*MemoryKB) RememberPOI ¶
RememberPOI stores or updates POI knowledge
func (*MemoryKB) RememberSystem ¶
RememberSystem stores or updates system knowledge
func (*MemoryKB) ResolveAnomaly ¶
func (*MemoryKB) StoreItems ¶
func (kb *MemoryKB) StoreItems(ctx context.Context, items []CatalogItem) error
func (*MemoryKB) StorePlayer ¶
func (kb *MemoryKB) StorePlayer(ctx context.Context, player PlayerRecord) error
func (*MemoryKB) StorePlayerSkills ¶
func (*MemoryKB) StoreRecipes ¶
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 the latest ship-listing snapshot for a station, replacing any prior snapshot for that station (mirrors SQLiteKB).
func (*MemoryKB) StoreSkills ¶
StoreSkills stores skills in memory.
func (*MemoryKB) StoreStorageSnapshot ¶ added in v0.2.0
func (kb *MemoryKB) StoreStorageSnapshot(_ context.Context, snapshot StorageSnapshot) error
func (*MemoryKB) UpdateAgentWalletCredits ¶ added in v0.2.0
func (*MemoryKB) UpsertMissionTemplate ¶ added in v0.2.0
func (kb *MemoryKB) UpsertMissionTemplate( ctx context.Context, entry serverapi.MissionBoardEntry, baseID, systemID string, tick int64, ) (*MissionUpsertResult, error)
UpsertMissionTemplate implements Base.
type Migration ¶
type Migration struct {
// contains filtered or unexported fields
}
Migration represents a database schema migration
type MissionFieldDiff ¶ added in v0.2.0
MissionFieldDiff records one field whose value changed between the stored catalog row and a newly-observed entry.
type MissionUpsertResult ¶ added in v0.2.0
type MissionUpsertResult struct {
Inserted bool
Diffs []MissionFieldDiff
}
MissionUpsertResult summarizes the outcome of UpsertMissionTemplate.
- Inserted is true when a brand new template_id was stored.
- Diffs is non-empty when an existing row had different values; the row is always updated to the new values before returning.
type POI ¶
type POI struct {
ID string
SystemID string
Name string
Type string
Class string // Star class (e.g., "G2 V") or planet type (e.g., "terran")
Description string
Position game.Position
Services []string
Resources []game.POIResource
Hidden bool
RevealDifficulty int
ExpiresAt string // ISO-8601 timestamp when POI expires (e.g., wormholes)
LastUpdatedTick int64
// DetectedBy is the agent id that produced this observation. Provenance for
// the shared KB so a later capability-aware merge can rank quality; today it
// is recorded but not used to gate overwrites.
DetectedBy string
}
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 ¶
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 PublicFacility ¶ added in v0.2.0
type PublicFacility struct {
StationID string
FacilityID string
RecipeID string
FacilityName string
Category string
OwnerFaction string
Level int
// RentalFeePerRun is the credit fee a renter pays per production run
// (server: production.rental_fee_per_run). The per-unit price
// (output_price_per_unit) and throughput are preserved in DetailsJSON.
RentalFeePerRun int
LastSeenTick int
// LastSeenUTC is the wall-clock capture time (RFC3339). Prefer it over
// LastSeenTick for staleness: the GameClock only ever syncs forward, so
// tick deltas understate real age. Stamped by the upsert when left empty.
LastSeenUTC string
DetailsJSON string // raw captured payload, forward-compat; holds production.ticks_per_run etc.
}
PublicFacility is a captured public crafting facility at a station — who runs it, what recipe it produces, and its labor cost/level.
type RecipeDef ¶
type RecipeDef struct {
ID string
Name string
Description string
Category string
CraftingTime float64
BaseQuality int
SkillQualityMod int
RequiredSkills map[string]int
Inputs []RecipeIngredient
Outputs []RecipeProduct
Hidden bool
FacilityOnly bool
NoRecycle bool
FuelOutput int
LastUpdatedTick int64
}
RecipeDef represents a crafting recipe stored in the knowledge base.
type RecipeIngredient ¶
RecipeIngredient represents an input item for a recipe.
type RecipeProduct ¶
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 ¶
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) DB ¶ added in v0.2.0
DB exposes the underlying handle for callers that need ad-hoc queries the Base interface does not cover (e.g. craftbrain's station->system resolution).
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) FacilitiesForRecipe ¶ added in v0.2.0
func (kb *SQLiteKB) FacilitiesForRecipe(ctx context.Context, recipeID string) ([]PublicFacility, error)
FacilitiesForRecipe returns public production facilities that can craft recipeID, most-recently-seen first.
func (*SQLiteKB) FactionCapturedAt ¶ added in v0.2.0
func (kb *SQLiteKB) FactionCapturedAt(ctx context.Context, factionID string) (time.Time, bool, error)
FactionCapturedAt returns the captured_utc of a stored faction header and whether a row exists. A missing faction yields (zero, false, nil) — not an error — so callers can treat "unknown" and "stale" uniformly.
func (*SQLiteKB) FactionTag ¶ added in v0.2.0
FactionTag returns the tag recorded for a faction and ok=true, or ("", false, nil) when the faction is unknown or has no tag stored. Used for cheap id→tag display lookups without loading the full faction view.
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 ¶
GetActiveAnomalies retrieves active anomalies in a system
func (*SQLiteKB) GetAllStorageSnapshots ¶ added in v0.2.0
func (kb *SQLiteKB) GetAllStorageSnapshots(ctx context.Context) ([]StorageSnapshot, error)
GetAllStorageSnapshots returns the latest storage snapshots for all agents.
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) GetBaseByPOI ¶
GetBaseByPOI retrieves a base by its POI ID
func (*SQLiteKB) GetChangeSnapshots ¶ added in v0.2.0
func (kb *SQLiteKB) GetChangeSnapshots(ctx context.Context, systemID string, limit int) ([]ChangeSnapshot, error)
GetChangeSnapshots retrieves change snapshots for a system, newest first.
func (*SQLiteKB) GetConnectionMetrics ¶ added in v0.2.0
func (kb *SQLiteKB) GetConnectionMetrics(ctx context.Context) ([]ConnectionMetric, error)
GetConnectionMetrics retrieves connection metrics (for weighted pathfinding)
func (*SQLiteKB) GetConnections ¶ added in v0.2.0
func (kb *SQLiteKB) GetConnections(ctx context.Context) ([]Connection, error)
GetConnections retrieves all system connections (for graph building)
func (*SQLiteKB) GetDangerZones ¶
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) GetItems ¶
func (kb *SQLiteKB) GetItems(ctx context.Context) ([]CatalogItem, error)
GetItems retrieves all catalog items.
func (*SQLiteKB) GetItemsByCategory ¶
GetItemsByCategory retrieves items filtered by category.
func (*SQLiteKB) GetLatestShipListings ¶
func (kb *SQLiteKB) GetLatestShipListings(ctx context.Context, systemID, stationID string) (*ShipListings, error)
GetLatestShipListings retrieves the most recent ship listings
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) GetPassenger ¶ added in v0.2.0
func (kb *SQLiteKB) GetPassenger(citizenID string) (*SeenPassenger, error)
GetPassenger returns the stored catalog row for a citizen_id, or (nil, nil) if no such row exists.
func (*SQLiteKB) GetPlayerShips ¶
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) GetRecentExperiences ¶
func (kb *SQLiteKB) GetRecentExperiences(ctx context.Context, agentID string, limit int) ([]Experience, error)
GetRecentExperiences retrieves recent experiences for an agent
func (*SQLiteKB) GetRecipes ¶
GetRecipes retrieves all recipes.
func (*SQLiteKB) GetRecipesByCategory ¶
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) GetSeenPlayer ¶ added in v0.2.0
func (kb *SQLiteKB) GetSeenPlayer(playerID string) (*SeenPlayer, error)
GetSeenPlayer returns the stored row for a player_id, or (nil, nil) if no such row exists.
func (*SQLiteKB) GetShipClass ¶
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. Only the latest snapshot per station is retained (StoreShipListings replaces on write), so this returns at most one snapshot per station regardless of limit.
func (*SQLiteKB) GetSkill ¶
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 ¶
GetSkills retrieves all skills, reading from the database first and falling back to static data if no skills are stored.
func (*SQLiteKB) GetStorageSnapshot ¶ added in v0.2.0
func (kb *SQLiteKB) GetStorageSnapshot(ctx context.Context, agentID, baseID string) (*StorageSnapshot, error)
GetStorageSnapshot returns the latest storage snapshot for an agent at a base.
func (*SQLiteKB) GetSystemDanger ¶
GetSystemDanger retrieves danger information for a specific system
func (*SQLiteKB) GetSystems ¶
GetSystems returns all known systems
func (*SQLiteKB) GetUnknownConnections ¶
GetUnknownConnections finds unexplored connections from a system
func (*SQLiteKB) GetXPObservations ¶ added in v0.2.0
func (kb *SQLiteKB) GetXPObservations(ctx context.Context, action string, limit int) ([]XPObservation, error)
GetXPObservations retrieves observations, optionally filtered by action.
func (*SQLiteKB) GetXPSummary ¶ added in v0.2.0
func (kb *SQLiteKB) GetXPSummary(ctx context.Context) ([]XPSummaryRow, error)
GetXPSummary aggregates observations by action, skill, and source.
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 ¶
ImportKnowledge imports data from a JSON export
func (*SQLiteKB) LatestDemandCapture ¶ added in v0.2.0
func (kb *SQLiteKB) LatestDemandCapture(ctx context.Context, stationID string) (time.Time, bool, error)
LatestDemandCapture returns the most recent captured_utc recorded for a station in the live buy-order ledger (market_buy_orders), and whether any rows exist. It is the shared freshness primitive: callers use it to skip re-capturing a station whose demand was read recently (possibly by another agent). RFC3339 timestamps sort lexically in chronological order, so MAX() gives the latest.
func (*SQLiteKB) ListExports ¶
func (kb *SQLiteKB) ListExports(ctx context.Context) ([]KnowledgeExportMeta, error)
ListExports retrieves metadata for all knowledge exports
func (*SQLiteKB) ListFactionIDs ¶ added in v0.2.0
ListFactionIDs returns all faction IDs that have a header row.
func (*SQLiteKB) ListPassengers ¶ added in v0.2.0
func (kb *SQLiteKB) ListPassengers(ctx context.Context, citizenship string) ([]SeenPassenger, error)
ListPassengers returns every stored passenger, ordered by name. When citizenship is non-empty it filters to that empire (case-sensitive match on the stored value).
func (*SQLiteKB) ListSeenFactions ¶ added in v0.2.0
func (kb *SQLiteKB) ListSeenFactions(ctx context.Context) ([]SeenFaction, error)
ListSeenFactions returns the distinct non-empty faction_ids observed across seen_players, ordered by player count desc. Each row is left-joined against the factions table so callers can see which still need backfilling.
func (*SQLiteKB) LoadDemandHistory ¶ added in v0.2.0
func (kb *SQLiteKB) LoadDemandHistory(ctx context.Context, itemID, stationID string, limit int) ([]DemandHistorySample, error)
LoadDemandHistory returns demand-history samples for itemID, optionally narrowed to a single stationID (""=all stations). Rows are ordered chronologically (oldest first) within each station. When limit>0, only the most recent `limit` buckets of each station are returned (0=no cap).
func (*SQLiteKB) LoadFactionView ¶ added in v0.2.0
LoadFactionView assembles the full current state for a faction. Returns (nil, nil) if no faction header row exists.
func (*SQLiteKB) LoadMarketBuyOrders ¶ added in v0.2.0
func (kb *SQLiteKB) LoadMarketBuyOrders(ctx context.Context) ([]MarketBuyOrderRow, error)
LoadMarketBuyOrders returns every captured buy order across all stations, ordered by station, item, then price descending.
func (*SQLiteKB) LoadMarketSellOrders ¶ added in v0.2.0
func (kb *SQLiteKB) LoadMarketSellOrders(ctx context.Context) ([]MarketSellOrderRow, error)
LoadMarketSellOrders returns every captured sell order across all stations, ordered by station, item, then price ascending (cheapest first) — the mirror of LoadMarketBuyOrders.
func (*SQLiteKB) LoadSupplyHistory ¶ added in v0.2.0
func (kb *SQLiteKB) LoadSupplyHistory(ctx context.Context, itemID, stationID string, limit int) ([]SupplyHistorySample, error)
LoadSupplyHistory returns supply-history samples for itemID, optionally narrowed to a single stationID (""=all). Rows are ordered chronologically (oldest first) within each station; when limit>0, only the most recent `limit` buckets of each station are returned — the mirror of LoadDemandHistory.
func (*SQLiteKB) RecordAnomaly ¶
RecordAnomaly logs an unusual discovery or event
func (*SQLiteKB) RecordChangeSnapshot ¶ added in v0.2.0
func (kb *SQLiteKB) RecordChangeSnapshot(ctx context.Context, snapshot ChangeSnapshot) error
RecordChangeSnapshot stores a snapshot of old data when a change is detected.
func (*SQLiteKB) RecordDemandHistory ¶ added in v0.2.0
func (kb *SQLiteKB) RecordDemandHistory(ctx context.Context, samples []DemandHistorySample) error
RecordDemandHistory upserts one row per (station, item, bucket) into market_demand_history. Re-reading a station within the same bucket updates that row in place (last observation in the bucket wins); a new bucket appends a new row. Runs in one transaction so a station's samples are all-or-nothing.
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) RecordPassengers ¶ added in v0.2.0
func (kb *SQLiteKB) RecordPassengers(obs []SeenPassenger) error
RecordPassengers inserts/updates rows in the passengers catalog for each observation. All writes share a single transaction. Records with an empty CitizenID are silently dropped. Empire/bio/class are COALESCE-merged so a sparse source (e.g. an aboard manifest lacking citizenship) never wipes richer data already captured from a station listing.
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) RecordSightings ¶ added in v0.2.0
func (kb *SQLiteKB) RecordSightings(obs []SeenPlayer) error
RecordSightings inserts/updates rows in seen_players, seen_player_ships, and seen_player_sightings for each observation. All writes share a single transaction. Records with an empty PlayerID are silently dropped.
func (*SQLiteKB) RecordSupplyHistory ¶ added in v0.2.0
func (kb *SQLiteKB) RecordSupplyHistory(ctx context.Context, samples []SupplyHistorySample) error
RecordSupplyHistory upserts one row per (station, item, bucket) into market_supply_history — the mirror of RecordDemandHistory. Re-reading a station within the same bucket updates that row in place (last observation in the bucket wins); a new bucket appends a new row.
func (*SQLiteKB) RecordXPObservation ¶ added in v0.2.0
func (kb *SQLiteKB) RecordXPObservation(ctx context.Context, obs XPObservation) error
RecordXPObservation inserts a single XP change observation.
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 ¶
RememberBase stores or updates space base knowledge
func (*SQLiteKB) RememberConnection ¶
RememberConnection stores a system connection (with deduplication)
func (*SQLiteKB) RememberPOI ¶
RememberPOI stores or updates POI knowledge
func (*SQLiteKB) RememberSystem ¶
RememberSystem stores or updates system knowledge.
The last_visited_tick column uses a preserve-on-zero semantic: passing sys.LastVisitedTick == 0 leaves the stored value unchanged. Callers on the visit path must set sys.LastVisitedTick to the current tick; callers that only refresh other fields may leave it at 0.
func (*SQLiteKB) ReplaceFactionFacilities ¶ added in v0.2.0
func (kb *SQLiteKB) ReplaceFactionFacilities(ctx context.Context, factionID, baseID string, fs []FactionFacilityRow) error
ReplaceFactionFacilities replaces facilities at one base.
func (*SQLiteKB) ReplaceFactionFuelBunkers ¶ added in v0.2.0
func (kb *SQLiteKB) ReplaceFactionFuelBunkers(ctx context.Context, factionID string, bunkers []FactionFuelBunkerRow) error
ReplaceFactionFuelBunkers replaces the whole galaxy-wide fuel-bunker set for a faction (the faction_info summary is delivered as one list across all bases, not per-base, so the replace is faction-scoped).
func (*SQLiteKB) ReplaceFactionMembers ¶ added in v0.2.0
func (kb *SQLiteKB) ReplaceFactionMembers(ctx context.Context, factionID string, members []FactionMember) error
ReplaceFactionMembers replaces all members for a faction.
func (*SQLiteKB) ReplaceFactionMissions ¶ added in v0.2.0
func (kb *SQLiteKB) ReplaceFactionMissions(ctx context.Context, factionID, baseID string, ms []FactionMissionRow) error
ReplaceFactionMissions replaces missions at one base.
func (*SQLiteKB) ReplaceFactionOrders ¶ added in v0.2.0
func (kb *SQLiteKB) ReplaceFactionOrders(ctx context.Context, factionID, baseID string, orders []FactionOrderRow) error
ReplaceFactionOrders replaces orders at one base.
func (*SQLiteKB) ReplaceFactionRelations ¶ added in v0.2.0
func (kb *SQLiteKB) ReplaceFactionRelations(ctx context.Context, factionID string, rels []FactionRelation) error
ReplaceFactionRelations replaces all relations for a faction.
func (*SQLiteKB) ReplaceFactionRooms ¶ added in v0.2.0
func (kb *SQLiteKB) ReplaceFactionRooms(ctx context.Context, factionID, baseID string, rooms []FactionRoomRow) error
ReplaceFactionRooms replaces rooms at one base.
func (*SQLiteKB) ReplaceFactionStorage ¶ added in v0.2.0
func (kb *SQLiteKB) ReplaceFactionStorage(ctx context.Context, s FactionStorageRow) error
ReplaceFactionStorage replaces storage header + items at one base.
func (*SQLiteKB) ReplaceStationBuyOrders ¶ added in v0.2.0
func (kb *SQLiteKB) ReplaceStationBuyOrders(ctx context.Context, stationID string, orders []MarketBuyOrderRow) error
ReplaceStationBuyOrders replaces ALL buy orders for a station with the supplied set in one transaction. A full compact view_market read covers every item at the station, so replacing by station keeps the snapshot fresh and prunes items whose demand has vanished since the last read. Empty SystemID/ItemName/Source are stored as "" (never NULL) so loaders scan into plain strings.
func (*SQLiteKB) ReplaceStationSellOrders ¶ added in v0.2.0
func (kb *SQLiteKB) ReplaceStationSellOrders(ctx context.Context, stationID string, orders []MarketSellOrderRow) error
ReplaceStationSellOrders replaces ALL sell orders for a station with the supplied set in one transaction — the supply-side mirror of ReplaceStationBuyOrders. A full compact view_market read covers every item at the station, so replacing by station keeps the snapshot fresh and prunes items whose supply has vanished since the last read.
func (*SQLiteKB) ResolveAnomaly ¶
ResolveAnomaly marks an anomaly as resolved or obsolete
func (*SQLiteKB) StoreFaction ¶ added in v0.2.0
func (kb *SQLiteKB) StoreFaction(ctx context.Context, r FactionRecord) error
StoreFaction upserts the faction header row.
func (*SQLiteKB) StoreFactionBase ¶ added in v0.2.0
func (kb *SQLiteKB) StoreFactionBase(ctx context.Context, b FactionBaseRow) error
StoreFactionBase upserts a single owned base.
func (*SQLiteKB) StoreItems ¶
func (kb *SQLiteKB) StoreItems(ctx context.Context, items []CatalogItem) error
StoreItems stores or replaces all items in the catalog.
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 ¶
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 the latest ship-listing snapshot for a station, replacing any prior snapshot for that station (no history is kept — an hourly append across the fleet would grow ~120k rows/day of near-identical data).
func (*SQLiteKB) StoreSkills ¶
StoreSkills stores or replaces all skills in the catalog.
func (*SQLiteKB) StoreStorageSnapshot ¶ added in v0.2.0
func (kb *SQLiteKB) StoreStorageSnapshot(ctx context.Context, snapshot StorageSnapshot) error
StoreStorageSnapshot upserts a storage snapshot for an agent at a base.
func (*SQLiteKB) UpdateAgentWalletCredits ¶ added in v0.2.0
func (kb *SQLiteKB) UpdateAgentWalletCredits(ctx context.Context, agentID string, credits int) error
UpdateAgentWalletCredits updates the wallet credits for an agent.
func (*SQLiteKB) UpsertFactionListEntry ¶ added in v0.2.0
UpsertFactionListEntry inserts a faction header from the lightweight fields a faction_list response carries. When the faction already exists it refreshes only those columns, leaving the faction_info-sourced columns (treasury, leader_id, description, charter, emblem, founded_utc, intel_*) and the captured_utc full-capture timestamp untouched — so a cheap header refresh never clobbers richer data. Reports whether a new row was inserted.
func (*SQLiteKB) UpsertMissionTemplate ¶ added in v0.2.0
func (kb *SQLiteKB) UpsertMissionTemplate( ctx context.Context, entry serverapi.MissionBoardEntry, baseID, systemID string, tick int64, ) (*MissionUpsertResult, error)
UpsertMissionTemplate implements Base for the SQLite backend.
func (*SQLiteKB) UpsertPublicFacilities ¶ added in v0.2.0
func (kb *SQLiteKB) UpsertPublicFacilities(ctx context.Context, rows []PublicFacility) error
UpsertPublicFacilities inserts or refreshes public_facilities rows, keyed on (station_id, facility_id). Every row is stored as public=1 — this table only holds public facilities.
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, is_stronghold, and connections.
empire is authoritatively overwritten (not merged) here: get_map is the sole source of ownership data, and callers (see cmd/data/import-map-data) upsert every system returned by a single get_map fetch, so a system that has been de-owned since the last import arrives with empire = "" and must have that clear it, not preserve a stale owner.
type SeenFaction ¶ added in v0.2.0
type SeenFaction struct {
FactionID string
FactionTag string
PlayerCount int // distinct players seen flying this faction
Sightings int // total sighting_count across those players
LastSeen time.Time // most recent sighting of any of its members
Seeded bool // a row exists in the factions table
Name string // faction name, if seeded
}
SeenFaction is a distinct faction observed across seen_players, enriched with whether it has already been captured into the factions table.
type SeenPassenger ¶ added in v0.2.0
type SeenPassenger struct {
CitizenID string
Name string
Citizenship string // the passenger's empire of origin
Bio string
Class string // travel class preference (economy | business | first)
Source string // "list_station_passengers" | "list_passengers" | "dock" | ...
SeenAt time.Time
}
SeenPassenger is a single passenger (citizen) observation. Mirrors the shape of game.ObservedPassenger but lives in pkg/knowledge so this package does not import pkg/game. Callers adapt one to the other.
The store is identity-only: it captures who a passenger is (name, empire, bio, preferred travel class), not where they were going or what they paid.
type SeenPlayer ¶ added in v0.2.0
type SeenPlayer struct {
PlayerID string
Username string
ShipClass string
FactionID string
FactionTag string
ClanTag string
PrimaryColor string
SecondaryColor string
StatusMessage string
Anonymous bool
InCombat bool
SystemID string // "" => identity-only, no sightings row
POIID string // "" => system-scope sighting (stored as empty string for PK uniqueness)
Source string // "get_nearby" | "get_system_agents" | "battle_alert" | ...
SeenAt time.Time
}
SeenPlayer is a single player observation. Mirrors the shape of game.ObservedPlayer but lives in pkg/knowledge so this package does not import pkg/game. Callers adapt one to the other.
type ShipCapability ¶ added in v0.2.0
ShipCapability is a built-in ability granted by a ship class (e.g. passenger berths, integrated survey scanner, yield bonuses).
type ShipClassDef ¶
type ShipClassDef struct {
ID string
Name string
Class string
Category string
Description string
Lore string
Faction string
Tier int
Scale 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
BasedOn string
NPCRole string
Special string
RequiredReputation int
PilotingRequired int
InherentCapabilities []ShipCapability
DefaultModules []string
FlavorTags []string
BuildMaterials []BuildMaterial
PassiveRecipes []string
// Prestige / unlock gating (server v0.495.1).
RequiredAchievement string
RequiredFactionAchievement string
RequiredFactionLeader bool
PrestigeLock string
DefaultLoadoutVersion int
LastUpdatedTick int64
}
ShipClassDef represents a ship class definition stored in the knowledge base.
type ShipListing ¶
type ShipListing struct {
ListingID string
ShipID string
ClassID string
ShipName string
Category string
Tier int
Scale int
Hull int // current hull; -1 = not reported by the server
MaxHull int
Shield int
ModulesCount int
Price int
Seller string
ListedAt string
}
ShipListing is one hull for sale at a station, matching the browse_ships listing shape (server response since ~2026-02-18). Static class stats (cargo space, slots) are NOT here — join ship_classes on ClassID.
func ShipListingFromDetail ¶ added in v0.2.0
func ShipListingFromDetail(d serverapi.ShipListingDetail) ShipListing
ShipListingFromDetail maps a browse_ships wire listing to the KB row shape. The wire Hull field is int/omitempty, so absent and 0 are indistinguishable; a for-sale hull of literal 0 does not occur, so both map to -1 (not reported).
func ShipListingsFromBrowseJSON ¶ added in v0.2.0
func ShipListingsFromBrowseJSON(raw []byte) (string, []ShipListing, error)
ShipListingsFromBrowseJSON decodes a raw browse_ships response payload (raw-store key "ship_listings") into KB listing rows. Returns the base id the server reported alongside the rows.
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"`
EmpireRestriction string `json:"empire_restriction,omitempty"`
}
Skill represents a skill in SpaceMolt with its XP requirements
func (*Skill) GetNextLevelXP ¶
GetNextLevelXP returns the XP required to reach the next level from current level
func (*Skill) GetXPForLevel ¶
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
Story string // Narrative description of the station
Empire string
DefenseLevel int
HasDrones bool
PublicAccess bool
PirateRepRequired int
Condition string // e.g., "thriving", "degraded", "critical"
ConditionText string // Human-readable condition description
SatisfactionPct int // 0-100 satisfaction percentage
SatisfiedCount int // Number of satisfied service/infra facilities
TotalServiceInfra int // Total number of service/infra facilities
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 StorageSnapshot ¶ added in v0.2.0
type StorageSnapshot struct {
AgentID string
BaseID string
Credits int
Items []StorageSnapshotItem
Ships []StorageSnapshotShip
CapturedAt time.Time
}
StorageSnapshot represents a captured station storage state for an agent
type StorageSnapshotItem ¶ added in v0.2.0
StorageSnapshotItem represents an item in a storage snapshot
type StorageSnapshotShip ¶ added in v0.2.0
StorageSnapshotShip represents a ship in a storage snapshot
type SupplyHistorySample ¶ added in v0.2.0
type SupplyHistorySample struct {
StationID string `json:"station_id"`
SystemID string `json:"system_id"`
ItemID string `json:"item_id"`
ItemName string `json:"item_name"`
BucketAt time.Time `json:"bucket_at"`
CapturedAt time.Time `json:"captured_at"`
BestPrice float64 `json:"best_price"`
TotalQty float64 `json:"total_qty"`
SMBestPrice float64 `json:"sm_best_price"`
SMQty float64 `json:"sm_qty"`
OrderCount int `json:"order_count"`
}
SupplyHistorySample is one (station, item, hourly bucket) aggregate of sell-order supply, persisted to market_supply_history — the mirror of DemandHistorySample. BestPrice is the LOWEST (cheapest, most attractive to a buyer) sell price across all orders; SMBestPrice is likewise the cheapest of the Station-Manager (source=="station") slice, and SMQty its quantity.
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
LastVisitedTick int64 // 0 = never visited; PoliceLevel is untrusted when 0
}
System represents knowledge about a solar system Wraps game.SystemData with exploration metadata
type SystemConnection ¶
GetSystems returns all known systems SystemConnection pairs a connected system ID with the jump distance.
type XPObservation ¶ added in v0.2.0
type XPObservation struct {
ID int64
AgentID string
Action string
Target string
Source string // "action", "mission_reward", "passive_skill"
SkillID string
XPDelta float64
LevelDelta int
LevelBefore int
LevelAfter int
GameTick int64
CreatedAt time.Time
MissionID string // empty for non-mission sources
Quantity int // quantity parameter for the command (default 1)
}
XPObservation records a skill XP change from a single command execution.
type XPSummaryRow ¶ added in v0.2.0
type XPSummaryRow struct {
Action string
SkillID string
Source string
AvgXPDelta float64
Count int
}
XPSummaryRow aggregates XP observations by action and skill.
type XPTracker ¶ added in v0.2.0
type XPTracker struct {
// contains filtered or unexported fields
}
XPTracker records skill XP changes to the knowledge base. It is designed to be wired into a game.Client's XPCallback field so that every successful mutation command automatically records XP deltas.
func NewXPTracker ¶ added in v0.2.0
func NewXPTracker(client game.XPCallbackSetter, kb Base, agentID string, logger *log.Logger) *XPTracker
NewXPTracker creates a tracker and wires it into the game client's XPCallback. If kb is nil, no tracker is created and the client is left unchanged. The client parameter accepts any type implementing game.XPCallbackSetter, so both the WebSocket *game.Client and *game.MCPGameClient work.
Source Files
¶
- analytics.go
- anomaly_survey.go
- base.go
- base_helpers.go
- catalog.go
- demand.go
- demand_load.go
- demand_store.go
- faction.go
- faction_load.go
- faction_store.go
- faction_tx.go
- memory.go
- memory_skills.go
- mission_catalog.go
- passengers.go
- public_facilities.go
- seen_players.go
- ship_listings.go
- skills.go
- sqlite.go
- sqlite_catalog.go
- sqlite_migrations.go
- sqlite_mission.go
- sqlite_player.go
- supply_store.go
- xp_tracker.go