131 Commits

Author SHA1 Message Date
b943a3a0ae Auto-detect API container in search Makefile, add lockfile
The Makefile targets (migrate, ingest, shell) hardcoded api-dev, which
fails when running in production mode. Now auto-detects whichever API
container is active (dev or prod) via docker compose ps.
2026-03-01 19:59:47 -07:00
8faaf9ab13 Add Vite dev proxy for search API during local development
API_PROXY_TARGET env var forwards /api, /mcp, /health to the
search backend container, enabling E2E chat testing without Caddy.
2026-03-01 16:45:52 -07:00
33787e03da Fix ruff lint, Pyright type ambiguity, and MCP tool SQL queries
- Fix 28 ruff errors: E501 line length, B904 raise-from, F401 unused import
- Fix SQLAlchemy Row.count() ambiguity with tuple indexing (Pyright)
- Replace composite column notation with accessor functions in MCP tools
  (topocentric/equatorial/pass_event are C-level base types, not composites)
- Fix satellite_pass: use time window (start + end) not count parameter
  to match predict_passes(tle, observer, start_ts, end_ts, min_el) signature
2026-03-01 16:41:07 -07:00
a40ae9437d Add chat widget to docs site: floating panel for Q&A + live celestial queries
Floating chat panel injected via Starlight Head override:

- ChatWidget.astro wrapper with astro:after-swap for View Transitions
- ~900-line TypeScript widget: SSE streaming, conversation persistence
  (localStorage), markdown rendering (marked + DOMPurify), suggestion
  pills, two-click delete, conversation history, rAF-throttled streaming
- ~680-line CSS: dark/light themes (amber/slate palette), full-screen
  mobile layout with FAB/Ask button overlap fix, reduced-motion support
- Three domain-specific suggestions: "Where is Jupiter right now?",
  "How do I predict satellite passes?", "What functions handle rise/set
  prediction?"
- FAB uses orbit SVG icon (3 rotated ellipses + center circle)
- Wired to /api/chat/stream endpoint (search backend)
2026-03-01 15:42:31 -07:00
317f74b33b Add search backend: FastAPI + FastMCP + pgvector for docs Q&A and live SQL
Search stack replicates the Hamilton site pattern with pg_orrery-specific
additions:

- FastAPI REST API (chat SSE streaming, semantic search, health check)
- FastMCP server at /mcp with doc search and live SQL query tools
- pgvector + pgai vectorizer for 1024-dim document embeddings
- Hybrid search (semantic cosine + text ILIKE with pg_trgm GIN)
- Dual LLM backend: self-hosted qwen3 via GPU gateway or Anthropic Claude
- Live read-only pg_orrery SQL execution with safety guardrails
  (SELECT-only validation, read-only transaction, 5s timeout, 100-row cap)
- Convenience MCP tools: planet_position, sky_survey, satellite_pass
- MDX content ingestion from docs/src/content/docs/ (50 pages)
- Docker Compose: pg_orrery+pgvector DB, pgai, vectorizer-worker, API
- Alembic async migrations, Makefile, .env.example
2026-03-01 15:42:14 -07:00
c850277efe Add astrolock reply: Tier 1+2+3 Lagrange integration confirmed 2026-02-28 21:04:00 -07:00
d3cbf18352 Add astrolock reply: v0.20.0 integration assessment, confirm types and batching 2026-02-28 19:22:12 -07:00
54e1bdf1fd Reply to v020 thread: integration assessment, L-point sky markers plan 2026-02-28 19:21:10 -07:00
f37aeeb24d Start v0.20.0 astrolock thread: Lagrange point integration 2026-02-28 19:09:13 -07:00
024c0c1e0c Harden Newton-Raphson gamma bounds, improve v0.20.0 test coverage
Add positive-gamma clamp in L1/L2/L3 Newton-Raphson iterations to
prevent divergence on extreme mass ratios. Add missing CREATE EXTENSION,
tighter L1/L2 precision checks (4 decimal places), lagrange_distance_oe
test with Ceres, L1-Earth-L2 ordering verification, and DE fallback
tests for planetary moon Lagrange functions.
2026-02-28 19:09:08 -07:00
eb90309128 Reply to v019 thread: observer arg fixed, thread complete 2026-02-28 18:57:58 -07:00
0be3e11247 Add v0.20.0 Lagrange point documentation
Reference page (20 IMMUTABLE functions), guide with progressive
scenarios (JWST, Trojans, cislunar, planetary moons, Hill survey),
17 DE variant sections appended to functions-de.mdx, sidebar entries.
2026-02-28 18:57:17 -07:00
eefc0958f6 Add message 003: confirm conjunction/penumbral signatures, note v0.20.0 2026-02-28 17:54:46 -07:00
6aa1db2619 Reply to v019 thread: integration complete, confirm conjunction signature 2026-02-28 17:53:40 -07:00
585dbb1ed8 Merge feature/lagrange-pg: v0.20.0 Lagrange point SQL functions
37 new SQL objects (188 → 225 total): Sun-planet, Earth-Moon,
planetary moon L1-L5, Hill radius, DE variants, regression tests.
All 31 tests pass.
v0.20.0
2026-02-28 14:21:53 -07:00
6e80dab6a3 Merge feature/lagrange-math: CR3BP solver and standalone tests 2026-02-28 14:21:47 -07:00
dbc1f20a46 Add v0.20.0: Lagrange point SQL functions, DE variants, regression tests
37 new SQL objects (188 → 225 total):
- Sun-planet L1-L5: heliocentric, observe, equatorial, distance (5 IMMUTABLE)
- Earth-Moon L1-L5: observe, equatorial via ELP2000-82B (2 IMMUTABLE)
- Planetary moon L1-L5: Galilean/Saturn/Uranus/Mars families (8 IMMUTABLE)
- Hill radius, zone radius, mass ratio, point name (5 IMMUTABLE)
- DE variants with VSOP87/ELP2000-82B fallback (17 STABLE)

All 31 regression tests pass. 210/210 standalone math tests pass.
2026-02-28 14:21:28 -07:00
dfd085f176 Add CR3BP Lagrange point solver (pure math, no PG dependency)
Quintic Newton-Raphson for L1/L2/L3, analytic L4/L5. Includes
Sun-planet, Earth-Moon, and planet-moon mass ratio constants from
IAU 2012 / JPL DE441. Co-rotating to ecliptic J2000 frame transform.
Hill sphere and libration zone radius. 210/210 standalone tests pass.
2026-02-28 14:02:02 -07:00
df9863dcc2 Add CR3BP Lagrange point solver (pure math, no PG dependency)
Quintic Newton-Raphson for L1/L2/L3, analytic L4/L5. Includes
Sun-planet, Earth-Moon, and planet-moon mass ratio constants from
IAU 2012 / JPL DE441. Co-rotating to ecliptic J2000 frame transform.
Hill sphere and libration zone radius. 210/210 standalone tests pass.
2026-02-28 14:01:55 -07:00
0cf55f28ac Add v0.19.0 astrolock integration thread, message 001 2026-02-28 13:52:57 -07:00
4d64b78fb8 Add v0.19.0: sun almanac, conjunction detection, penumbral fraction, physical libration
Four new functions (184 → 188 SQL objects):
- sun_almanac_events(): merged rise/set + twilight SRF (4 threshold scans)
- planet_conjunctions(): angular separation minima via daily scan + ternary search
- satellite_penumbral_fraction(): continuous 0.0-1.0 shadow depth
- moon_physical_libration(): Meeus p. 373 Fourier corrections (tau, rho)

30 regression test suites, all passing.
v0.19.0
2026-02-28 13:51:35 -07:00
16909c3007 Add astrolock reply: v0.18.0 deployed and verified on dev 2026-02-28 13:00:33 -07:00
8c6076cd99 Add message 005: Docker image pushed, astrolock unblocked for deployment 2026-02-28 12:50:39 -07:00
3c47a4431e Add astrolock reply: migration created, waiting on Docker image 2026-02-28 04:05:35 -07:00
8312512b86 Add message 003: confirm integration, migration advice, SRF signatures 2026-02-28 03:42:18 -07:00
1e9d856a39 Add astrolock reply: v0.18.0 Tiers 1+2 integrated 2026-02-28 03:41:20 -07:00
c31f282cf8 Add v0.18.0 astrolock integration thread, message 001
Opens agent thread for astrolock to integrate 10 new functions:
saturn_ring_tilt, penumbral eclipse (4), rise/set event windows (3),
angular separation rate (2). Notes three items from v0.17.0's
"not in this release" are now addressed.
2026-02-27 23:53:38 -07:00
b309980003 Add v0.18.0: Saturn ring tilt, penumbral eclipse, rise/set windows, angular rate
Four features, 10 new SQL functions (174 → 184 objects), 29 test suites:

Saturn ring tilt: saturn_ring_tilt() exposes sub-observer latitude B'.
planet_magnitude() for Saturn now includes Mallama & Hilton Eq. 10
ring correction (-2.60|sin B'| + 1.25 sin²B'), removing the ~1.5 mag
globe-only caveat. IAU 2000 pole direction, ecliptic J2000 projection.

Conical shadow model: Replaces cylindrical shadow with umbra/penumbra
cones using Sun's finite angular size. Four new functions:
satellite_in_penumbra(), satellite_shadow_state(),
satellite_next_penumbra_entry/exit(). Existing eclipse functions are
backward compatible via narrower (more accurate) umbra boundary.

Rise/set event windows: Three SRFs returning TABLE(event_time, event_type)
for all rise/set events within a time window — planet_rise_set_events(),
sun_rise_set_events(), moon_rise_set_events(). Follows predict_passes()
SRF pattern. Optional refracted parameter, 366-day window limit.

Angular separation rate: Vincenty formula extracted to reusable helper.
eq_angular_rate() for generic finite-difference rate, planet_angular_rate()
for solar system body convenience (1-minute dt, handles Sun/planets/Moon).
2026-02-27 23:52:06 -07:00
08a5cdf994 Confirm night quality fix, Tier 2 fully operational
All three Tier 2 features verified: eclipse clipping, night quality, lunar libration.
2026-02-27 15:17:01 -07:00
cdc030b1d3 Add message 008: observing_night_quality fix shipped, Docker updated 2026-02-27 13:23:25 -07:00
76b4e449c7 Fix observing_night_quality: use topo_elevation() accessor, not .elevation composite 2026-02-27 13:22:09 -07:00
ae8deae67e Add astrolock Tier 1 + Tier 2 integration thread replies
Tier 1: eclipse fraction, solar elongation, planet phase
Tier 2: eclipse clipping, night quality, lunar libration

Reports observing_night_quality() bug (.elevation vs topo_elevation)
2026-02-27 13:21:20 -07:00
2e424f2867 Add message 006: confirm Tier 1, eclipse clipping guidance, perf notes 2026-02-26 23:13:34 -07:00
333493a609 Add message 004: v0.17.0 tagged, Docker image pushed to registry 2026-02-26 20:09:03 -07:00
bbfed58d81 Add message 003: answer TLE reuse, eclipse cost, body_id error questions v0.17.0 2026-02-26 19:56:38 -07:00
3d13f44cbd Reply to pg_orrery v0.17.0 announcement with integration plan
Three-tier plan: elongation+phase+eclipse in existing SQL (immediate),
observing_night_quality as secondary signal (next), lunar libration in
new Moon detail section (later). Questions on TLE CTE reuse and eclipse
fraction compute cost.
2026-02-26 19:39:21 -07:00
dc52b844b3 Add message 001: v0.17.0 available for astrolock integration 2026-02-26 19:36:52 -07:00
22b272fd0c Implement v0.17.0: solar elongation, planet phase, satellite eclipse, observing night quality, lunar libration
162 → 174 SQL objects, 27 → 28 test suites, 3 new C source files.

Features:
- solar_elongation(body_id, ts): Sun-Earth-Planet angle [0,180] degrees
- planet_phase(body_id, ts): illuminated disk fraction [0,1]
- satellite_is_eclipsed/next_eclipse_entry/exit/eclipse_fraction:
  cylindrical shadow model (Vallado §5.3) for Earth shadow prediction
- observing_night_quality(observer, ts): composite PL/pgSQL scoring
  based on astronomical darkness duration and Moon interference
- moon_libration_longitude/latitude/position_angle/libration/subsolar_longitude:
  optical libration from Meeus (1998) Ch. 53

Refactored magnitude_funcs.c to extract shared compute_planet_geometry()
used by magnitude, elongation, and phase — single VSOP87 evaluation per call.

All 28 regression suites pass. Zero compiler warnings.
2026-02-26 18:47:30 -07:00
557f94364d Add message 006: All tiers live, v0.16.0 fully integrated 2026-02-26 17:37:01 -07:00
085d27adb3 Add message 005: Mercury magnitude fix shipped, full polynomial model 2026-02-26 17:24:22 -07:00
9949af738d Fix planet_magnitude: use full Mallama & Hilton (2018) polynomials
The original implementation only used c1+c2 coefficients from the
simplified model. Mercury's 6th-order polynomial diverges badly
beyond ~60 deg phase angle with only 2 terms — returning -23 mag
at 130 deg (should be +1.1).

Now uses the complete piecewise models from the paper:
- Mercury: full 6th-order polynomial (Eq. 1)
- Venus: piecewise at 163.7 deg (Eq. 2/3)
- Mars: piecewise at 50 deg (Eq. 5/6)
- Jupiter: piecewise at 12 deg with log term (Eq. 7/8)
- Saturn: globe-only model (Eq. 11/12), ring tilt still not modeled
- Uranus: phase threshold at 3.1 deg (Eq. 14)
- Neptune: phase threshold at 1.9 deg (Eq. 17)

Bug found by astrolock: Mercury at superior conjunction (i=130.6 deg)
returned -23.3 mag instead of +1.1.
2026-02-26 17:23:44 -07:00
9eaff060ab Add message 004: Tier 1 live, Mercury edge case, proceeding to Tier 2/3 2026-02-26 17:17:24 -07:00
beb1b97c23 Add message 003: confirm integration plan, answer Saturn/moon_age questions 2026-02-26 13:05:30 -07:00
11d0f95324 Reply to v0.16.0 thread: integration plan for twilight, lunar phase, planet magnitude 2026-02-26 13:04:51 -07:00
0851d2d171 Add message 001: v0.16.0 available for astrolock integration
Twilight (6 functions), lunar phase (4 functions), planet
apparent magnitude (1 function). 151 -> 162 SQL objects.
2026-02-26 13:01:42 -07:00
46c8a30575 Add v0.16.0: twilight dawn/dusk, lunar phase, planet apparent magnitude
Twilight: 6 functions (civil/nautical/astronomical × dawn/dusk) reusing
the existing find_next_crossing() bisection search with Sun depression
angle thresholds (-6°, -12°, -18°). Returns NULL for polar regions
where the threshold is never reached.

Lunar phase: 4 functions computing Sun-Earth-Moon geometry from VSOP87
+ ELP2000-82B. Phase angle [0,360) via elongation + cross product
z-component for waxing/waning discrimination. 8 named phases in 45°
bins. Moon age approximated from phase angle and mean synodic month.

Planet magnitude: Mallama & Hilton (2018) polynomial model with VSOP87
heliocentric distances and phase angle via law of cosines. All 7
planets (Mercury-Neptune, excluding Earth). Saturn ring tilt not
modeled.

151 → 162 SQL objects. 26 → 27 test suites, all passing.
v0.16.0
2026-02-26 12:42:01 -07:00
e670ed7ed1 Add rise/set and constellation guides, remove stale TODO
Two new workflow guides covering v0.13.0–v0.15.0 features:
- Rise/set prediction: geometric vs refracted, NULL contract, extreme latitudes
- Constellation identification: composability chains, catalog enrichment, zodiac

Remove docs/TODO-v0.10.0.md (5 versions stale, all Tier 1–2 items shipped).
2026-02-26 12:29:45 -07:00
e4589715bd Update docs for v0.15.0: rise/set reference page, llms.txt, sidebar 2026-02-25 20:48:40 -07:00
8159b949b1 Add message 011: astrolock deploy blocked, needs merge to main 2026-02-25 20:48:35 -07:00
fe61428b96 Add message 013: v0.15.0 integration confirmed in astrolock 2026-02-25 20:36:57 -07:00