PARACOSM AGENTOS | API Reference v0.9.1035
Home Simulation API Docs GitHub npm
Home Simulation API Docs GitHub npm AgentOS Discord
paracosm - v0.9.1035
    Preparing search index...

    Class SimulationKernel

    Index
    • Advance to the next turn. Runs between-turn progression.

      Parameters

      • nextTurn: number
      • nextTime: number
      • OptionalprogressionHook: (
            ctx: {
                agents: any[];
                rng: any;
                startTime: number;
                time: number;
                timeDelta: number;
                turn: number;
            },
        ) => void

      Returns SimulationState

    • Apply featured colonist updates from department reports.

      Parameters

      • updates: {
            agentId: string;
            career?: Partial<AgentCareer>;
            health?: Partial<AgentHealth>;
            narrativeEvent?: string;
        }[]

      Returns void

    • Apply a policy effect from the commander's decision.

      Parameters

      • effect: PolicyEffect

      Returns void

    • Get top N candidates for a department role, scored by trait fit.

      Parameters

      • dept: string
      • topN: number = 5

      Returns Agent[]

    • Parameters

      • dept: string

      Returns {
          avgBoneDensity: number;
          avgMorale: number;
          avgRadiation: number;
          count: number;
      }

    • Promote a colonist to a department head role.

      Parameters

      • agentId: string
      • dept: string
      • role: string
      • promotedBy: string

      Returns void

    • Capture a KernelSnapshot bundle. The returned object is plain JSON-safe data: JSON.stringify(snap) + JSON.parse + SimulationKernel.fromSnapshot(parsed, scenarioId) round-trips to a new kernel in the same state. Used by WorldModel.snapshot() + fork() for mid-run counterfactuals.

      Parameters

      • scenarioId: string

        Scenario id the snapshot is being taken against. Stamped into the snapshot so fromSnapshot can verify the target WorldModel's scenario matches.

      Returns KernelSnapshot

    • Reverse of SimulationKernel.toSnapshot. Constructs a fresh kernel positioned at the snapshot's turn, with simulation state + PRNG state + metadata fully restored. The returned kernel is indistinguishable from the one that produced the snapshot as far as subsequent advanceTurn calls are concerned.

      Parameters

      • snap: KernelSnapshot

        The captured snapshot.

      • expectedScenarioId: string

        Scenario id the caller expects the snapshot to match. Throws when they differ; this is the gate against accidental cross-scenario forks.

      Returns SimulationKernel

      Error when snap.snapshotVersion !== 1 or when snap.scenarioId !== expectedScenarioId.