fix simulation reporting and research resilience

This commit is contained in:
2026-09-28 15:43:23 +08:00
parent 23297be2d7
commit a428214c53
25 changed files with 1488 additions and 244 deletions
+5 -2
View File
@@ -67,7 +67,7 @@ class LifeState(BaseModel):
life_log: list[str] = Field(default_factory=list)
class AgentPersona(BaseModel):
class AgentPersona(BaseModel):
id: int
name: str
role: str
@@ -88,4 +88,7 @@ class AgentPersona(BaseModel):
knowledge_level: str = Field(default="full")
life_state: LifeState | None = None
abandoned_products: set[str] = Field(default_factory=set)
has_defected: bool = False
has_defected: bool = False
# Keeps degraded citizen generation observable without changing the
# existing persona contract. Normal LLM-generated citizens use "llm".
generation_source: str = "llm"
+16 -4
View File
@@ -1,6 +1,6 @@
from __future__ import annotations
from typing import Literal
from pydantic import BaseModel, Field
from pydantic import BaseModel, Field, model_validator
class Location(BaseModel):
@@ -10,11 +10,23 @@ class Location(BaseModel):
description: str
class TimeConfig(BaseModel):
class TimeConfig(BaseModel):
total_days: int = 365
rounds_per_day: int = 3
active_agents_per_round_min: int = 3
active_agents_per_round_max: int = 10
active_agents_per_round_min: int = 3
active_agents_per_round_max: int = 10
@model_validator(mode="after")
def validate_ranges(self) -> "TimeConfig":
if self.total_days < 1:
raise ValueError("total_days must be positive")
if self.rounds_per_day < 1:
raise ValueError("rounds_per_day must be positive")
if self.active_agents_per_round_min < 0 or self.active_agents_per_round_max < 0:
raise ValueError("active agent counts cannot be negative")
if self.active_agents_per_round_min > self.active_agents_per_round_max:
raise ValueError("active_agents_per_round_min cannot exceed max")
return self
class WorldBlueprint(BaseModel):