/** * astroengine provenance -- what a chart is, and when and where it is anchored. * * A chart silently asserts "a real instant at a real place." That is wrong for * most interesting cases: forecasts, fictional or mythic subjects, archetypes, * counterfactuals, charts with only an approximate or relative time. This module * makes the chart's grounding first-class so the rest of the system can act on * it -- route generation (ephemeris vs the compiler's symbolic synthesis), frame * interpretation honestly, and degrade gracefully when no instant exists. * * It does not compute charts; it resolves a {@link TemporalAnchor} / * {@link SpatialAnchor} to a usable instant / place (or reports that none can be * derived, and why). Pure and deterministic. */ /** What a chart's subject *is* -- its epistemic / ontological status. */ export type Realm = "observed" | "reported" | "planned" | "forecast" | "fictional" | "mythic" | "counterfactual" | "archetypal" | "conceptual"; /** How a chart's time is known. */ export type TemporalAnchor = { kind: "instant"; utc: string; } | { kind: "range"; earliest: string; latest: string; } | { kind: "relative"; relation: "before" | "after" | "during"; anchorId: string; offset?: string; } | { kind: "narrative"; calendar?: string; value: string; sequence?: number; } | { kind: "symbolic"; rationale: string; } | { kind: "none"; reason: "atemporal" | "time_irrelevant" | "intentionally_unset"; }; /** How a chart's place is known -- the spatial twin of {@link TemporalAnchor}. */ export type SpatialAnchor = { kind: "geo"; lat: number; lonEast: number; altM?: number; } | { kind: "named"; placeId: string; } | { kind: "region"; lat: number; lonEast: number; radiusKm: number; } | { kind: "relative"; relation: "near" | "at"; anchorId: string; } | { kind: "fictional"; value: string; } | { kind: "none"; reason: "heliocentric" | "atemporal" | "intentionally_unset"; }; /** Resolved coordinates a chart can be computed at. */ export interface GeoPlace { lat: number; lonEast: number; altM?: number; } /** Lookups an anchor may need to resolve: prior instants/places for `relative` * anchors, calendar resolvers for `narrative` times, a gazetteer for `named` * places. All optional; an anchor that needs a missing one resolves to null. */ export interface AnchorRegistry { /** `anchorId` -> a resolved instant (UT Julian Day). */ instants?: Record; /** Calendar name -> `value` -> UT Julian Day (or null when unmappable). */ calendars?: Record number | null>; /** `anchorId` -> a resolved place. */ places?: Record; /** Named-place resolver (e.g. the gazetteer). */ gazetteer?: (placeId: string) => GeoPlace | null; } /** How trustworthy a resolved instant/place is for computation. */ export type Certainty = "exact" | "approximate" | "representative" | "none"; /** The outcome of resolving a {@link TemporalAnchor}. */ export interface ResolvedTime { /** A concrete UT Julian Day to compute with, or null when none can be derived. */ jd: number | null; certainty: Certainty; /** Bounds in UT JD, for ranges (and relatives with a known reference). */ earliest?: number; latest?: number; /** How `jd` was derived, or why it is null. */ note?: string; } /** The outcome of resolving a {@link SpatialAnchor}. */ export interface ResolvedPlace { place: GeoPlace | null; certainty: Certainty; /** For a `region`, its radius in km. */ radiusKm?: number; note?: string; } /** ISO-8601 timestamp -> UT Julian Day, or null when unparseable. */ export declare function isoToJd(iso: string): number | null; /** * Parse a duration offset into days. Accepts a compact single unit * (`"3d"`, `"-2h"`, `"1.5y"`, `"6mo"`, `"90m"`) or an ISO-8601 duration * (`"P1Y2M10DT2H30M"`). Calendar units use mean lengths (year 365.2425 d, * month 30.436875 d). Returns `NaN` when unparseable. */ export declare function parseOffset(offset: string): number; /** * Resolve a {@link TemporalAnchor} to a usable instant, using `registry` for * relative references and narrative calendars. The result always reports its * {@link Certainty}; `jd` is null exactly when no instant can be derived * (`symbolic`, `none`, an unknown reference, or an unmappable calendar). */ export declare function resolveTime(anchor: TemporalAnchor, registry?: AnchorRegistry): ResolvedTime; /** * Resolve a {@link SpatialAnchor} to coordinates, using `registry` for relative * references and the gazetteer for named places. `place` is null when no * coordinates can be derived (`fictional`, `none`, an unknown reference). */ export declare function resolvePlace(anchor: SpatialAnchor, registry?: AnchorRegistry): ResolvedPlace; /** Realms whose charts come from a time + place (the ephemeris path). The rest * (`archetypal`, `conceptual`, `mythic`) are better generated from constraints * via the compiler, since they have no instant to compute from. */ export declare const TIME_ANCHORED_REALMS: ReadonlySet; /** Whether a realm is normally grounded in an instant (ephemeris) rather than * synthesized from symbolic constraints. */ export declare function isTimeAnchored(realm: Realm): boolean;