Packages2 MIN READ111 / 116

Internal module guide. This module is now part of @astrology/western; use the public package README for application setup.

upstream module

Adapter and binder layer that connects upstream astronomy and geometry ports as they become available. Public imports use the package root. See the package specification and the adapter record.

Run pnpm --filter @astrology/western build, check, and test after building Compose. The package imports Compose types only; the ports are injected by the host.

Gates

UPSTREAM_GATES lists each capability, the task that delivers it and what it unblocks:

Gate Source today Unblocks
positions Composer capabilities Every chart layer
houses Composer capabilities and offered house systems House emphasis, house placement, synastry overlays
geometry Composer shared geometry Natal aspect patterns, transit and directed contacts
cross-chart-geometry Composer shared geometry Synastry
probes Composer probe sessions (host probe limits) Transit windows, return search

upstreamGate(id) returns the catalog entry; an unknown id is a programming error.

Binder

bindWesternUpstream({ composer }) inspects Composer capabilities once and returns:

  • status — every gate open or closed, with the owning task and a detail string when closed;
  • require(gate) — throws LAYER_UNSUPPORTED naming the gate and owner;
  • connect(gates, probe?) — validates every requested gate, opens a probe session only when probes is included, and returns exactly the geometry/probe ports a feature asked for.

A closed gate is never inferred open from another capability, and no technique receives a port it did not declare.

Snapshot adapter

geometryChartFrom(snapshot) copies snapshot bodies into shared GeometryPoints with { kind: 'observed', snapshot: hash } origins, appends ascendant and midheaven when angles exist, and passes cusps and evidence through. Nothing is recomputed, so a derived point can never be mistaken for a provider position.

Consumer example

import { bindWesternUpstream, geometryChartFrom } from './upstream/index.js';

const upstream = await bindWesternUpstream({ composer });
const ports = upstream.connect(['geometry']);
const contacts = ports.geometry?.evaluateChartAspects(geometryChartFrom(snapshot), profile.aspectPolicy);

Not implemented here

Astronomy reads, house calculation, aspect evaluation, probe search, technique rules and result envelopes.