Swiss Ephemeris adapter — workspace module
Reading guide: The current package architecture defines the binder boundary. Sections below describe reference designs unless an implementation note says otherwise. Standalone facade, cache and provenance services are dropped; their integration responsibilities belong to the consumer.
Status: Implemented module · Part of: Astro Binder
The reusable @astrology/swiss-ephemeris-adapter package implements the standalone
@astrology/adapter-contract port. Consumers import it into their own applications.
Neither package hosts a server. The implementation evidence covers the
native mapping, installed coverage, time model, and tests.
Package responsibilities
| Package | Owns | Runtime dependency |
|---|---|---|
@astrology/adapter-contract |
Canonical requests/results, capabilities, typed failures, validation, immutable fluent queries | None |
@astrology/swiss-ephemeris-adapter |
Swiss constants, flags, file verification, native worker lifecycle and result admission | Shared contract and pinned sweph |
| Future NASA adapter | Horizons request/response mapping and native capability refusals | Shared contract; not implemented |
The contract package does not import either provider. Swiss and a future NASA adapter share the same error class and DTO definitions; callers do not receive copies of those definitions from a provider-specific export.
Architecture
The shared contract and Swiss package are implemented. The NASA module and the binder’s facade/router/normalizer remain planned. Solid arrows show dependencies or calls, as labelled. The Swiss child process is internal native isolation, not a separate server or service.
Public API
SwissAdapter implements three Promise-returning operations:
capabilities()probes the native engine/files and advertises supported features and zodiacs.positions(request)returns ordered geometry plus its provider declaration.houses(request)returns twelve cusps and eight named angles plus its declaration.
Importing or constructing an adapter performs no I/O. Each operation validates where applicable, starts an isolated child process, verifies the pinned files, computes, admits the native result, and reaps the process before settling. Default capacity is four concurrent operations per instance with a five-second budget including startup. There are no retries or Moshier fallback.
Calculation rules
- Check the installed file identities and coverage; never advertise the full theoretical library range.
- Convert UTC to TT/UT1 with a consistently pinned DE441 tidal acceleration.
- Apply sidereal mode in Swiss once, and record that the provider applied it.
- Preserve returned native flags and reject unexpected fallback or invalid geometry.
- Map Ketu to the selected lunar node’s antipode, rather than inventing a native body id.
- Refuse polar house failures instead of returning native fallback cusps under the requested name.
- Return typed errors without HTTP statuses, provider error strings, or filesystem paths.
- Leave routing, caching, astrology interpretation and application transport to their owners.
Installed coverage is approximately 1800–2400. The implementation has no cancellation-token API
and no established per-request precision estimate; precisionArcsec is null. Missing/altered files,
overload, and worker failures fail closed. Timeout kills the native process.