@cyanheads/astronomy-mcp-server 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/AGENTS.md +431 -0
  2. package/CLAUDE.md +431 -0
  3. package/Dockerfile +104 -0
  4. package/LICENSE +201 -0
  5. package/README.md +320 -0
  6. package/changelog/0.1.x/0.1.1.md +28 -0
  7. package/changelog/0.1.x/0.1.2.md +16 -0
  8. package/changelog/template.md +127 -0
  9. package/dist/config/server-config.d.ts +22 -0
  10. package/dist/config/server-config.d.ts.map +1 -0
  11. package/dist/config/server-config.js +40 -0
  12. package/dist/config/server-config.js.map +1 -0
  13. package/dist/index.d.ts +11 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +55 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/mcp-server/prompts/definitions/stargazing-plan.prompt.d.ts +12 -0
  18. package/dist/mcp-server/prompts/definitions/stargazing-plan.prompt.d.ts.map +1 -0
  19. package/dist/mcp-server/prompts/definitions/stargazing-plan.prompt.js +36 -0
  20. package/dist/mcp-server/prompts/definitions/stargazing-plan.prompt.js.map +1 -0
  21. package/dist/mcp-server/resources/definitions/body.resource.d.ts +29 -0
  22. package/dist/mcp-server/resources/definitions/body.resource.d.ts.map +1 -0
  23. package/dist/mcp-server/resources/definitions/body.resource.js +65 -0
  24. package/dist/mcp-server/resources/definitions/body.resource.js.map +1 -0
  25. package/dist/mcp-server/tools/definitions/find-events.tool.d.ts +157 -0
  26. package/dist/mcp-server/tools/definitions/find-events.tool.d.ts.map +1 -0
  27. package/dist/mcp-server/tools/definitions/find-events.tool.js +242 -0
  28. package/dist/mcp-server/tools/definitions/find-events.tool.js.map +1 -0
  29. package/dist/mcp-server/tools/definitions/get-ephemeris.tool.d.ts +62 -0
  30. package/dist/mcp-server/tools/definitions/get-ephemeris.tool.d.ts.map +1 -0
  31. package/dist/mcp-server/tools/definitions/get-ephemeris.tool.js +161 -0
  32. package/dist/mcp-server/tools/definitions/get-ephemeris.tool.js.map +1 -0
  33. package/dist/mcp-server/tools/definitions/get-moon-phase.tool.d.ts +53 -0
  34. package/dist/mcp-server/tools/definitions/get-moon-phase.tool.d.ts.map +1 -0
  35. package/dist/mcp-server/tools/definitions/get-moon-phase.tool.js +109 -0
  36. package/dist/mcp-server/tools/definitions/get-moon-phase.tool.js.map +1 -0
  37. package/dist/mcp-server/tools/definitions/get-rise-set.tool.d.ts +100 -0
  38. package/dist/mcp-server/tools/definitions/get-rise-set.tool.d.ts.map +1 -0
  39. package/dist/mcp-server/tools/definitions/get-rise-set.tool.js +200 -0
  40. package/dist/mcp-server/tools/definitions/get-rise-set.tool.js.map +1 -0
  41. package/dist/mcp-server/tools/definitions/get-satellite-passes.tool.d.ts +77 -0
  42. package/dist/mcp-server/tools/definitions/get-satellite-passes.tool.d.ts.map +1 -0
  43. package/dist/mcp-server/tools/definitions/get-satellite-passes.tool.js +180 -0
  44. package/dist/mcp-server/tools/definitions/get-satellite-passes.tool.js.map +1 -0
  45. package/dist/mcp-server/tools/definitions/get-sky-position.tool.d.ts +99 -0
  46. package/dist/mcp-server/tools/definitions/get-sky-position.tool.d.ts.map +1 -0
  47. package/dist/mcp-server/tools/definitions/get-sky-position.tool.js +196 -0
  48. package/dist/mcp-server/tools/definitions/get-sky-position.tool.js.map +1 -0
  49. package/dist/mcp-server/tools/definitions/list-visible.tool.d.ts +104 -0
  50. package/dist/mcp-server/tools/definitions/list-visible.tool.d.ts.map +1 -0
  51. package/dist/mcp-server/tools/definitions/list-visible.tool.js +151 -0
  52. package/dist/mcp-server/tools/definitions/list-visible.tool.js.map +1 -0
  53. package/dist/services/ephemeris/body-data.d.ts +25 -0
  54. package/dist/services/ephemeris/body-data.d.ts.map +1 -0
  55. package/dist/services/ephemeris/body-data.js +24 -0
  56. package/dist/services/ephemeris/body-data.js.map +1 -0
  57. package/dist/services/ephemeris/ephemeris-service.d.ts +93 -0
  58. package/dist/services/ephemeris/ephemeris-service.d.ts.map +1 -0
  59. package/dist/services/ephemeris/ephemeris-service.js +742 -0
  60. package/dist/services/ephemeris/ephemeris-service.js.map +1 -0
  61. package/dist/services/ephemeris/star-catalog.d.ts +17 -0
  62. package/dist/services/ephemeris/star-catalog.d.ts.map +1 -0
  63. package/dist/services/ephemeris/star-catalog.js +273 -0
  64. package/dist/services/ephemeris/star-catalog.js.map +1 -0
  65. package/dist/services/ephemeris/types.d.ts +150 -0
  66. package/dist/services/ephemeris/types.d.ts.map +1 -0
  67. package/dist/services/ephemeris/types.js +33 -0
  68. package/dist/services/ephemeris/types.js.map +1 -0
  69. package/dist/services/horizons/horizons-service.d.ts +47 -0
  70. package/dist/services/horizons/horizons-service.d.ts.map +1 -0
  71. package/dist/services/horizons/horizons-service.js +229 -0
  72. package/dist/services/horizons/horizons-service.js.map +1 -0
  73. package/dist/services/horizons/types.d.ts +21 -0
  74. package/dist/services/horizons/types.d.ts.map +1 -0
  75. package/dist/services/horizons/types.js +6 -0
  76. package/dist/services/horizons/types.js.map +1 -0
  77. package/dist/services/satellite/satellite-service.d.ts +48 -0
  78. package/dist/services/satellite/satellite-service.d.ts.map +1 -0
  79. package/dist/services/satellite/satellite-service.js +231 -0
  80. package/dist/services/satellite/satellite-service.js.map +1 -0
  81. package/dist/services/satellite/types.d.ts +32 -0
  82. package/dist/services/satellite/types.d.ts.map +1 -0
  83. package/dist/services/satellite/types.js +6 -0
  84. package/dist/services/satellite/types.js.map +1 -0
  85. package/package.json +104 -0
  86. package/server.json +139 -0
@@ -0,0 +1,151 @@
1
+ /**
2
+ * @fileoverview astronomy_list_visible — the workflow flagship. For a location and
3
+ * instant, iterate every naked-eye body (and optionally catalog stars), filter to
4
+ * above the horizon, rank brightest-and-highest first, annotate each with a
5
+ * visibility note, and gate the whole sky by the Sun's altitude.
6
+ * @module mcp-server/tools/definitions/list-visible.tool
7
+ */
8
+ import { tool, z } from '@cyanheads/mcp-ts-core';
9
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
10
+ import { getServerConfig } from '../../../config/server-config.js';
11
+ import { getEphemerisService } from '../../../services/ephemeris/ephemeris-service.js';
12
+ import { SkyPositionOutput } from './get-sky-position.tool.js';
13
+ const VisibleBodySchema = SkyPositionOutput.extend({
14
+ rank: z.number().describe('1-based rank, brightest-and-highest first.'),
15
+ visibility_note: z
16
+ .string()
17
+ .describe('Server-computed one-line headline from real values, e.g. "Venus, mag -4.1, 12° above the WSW horizon — very bright".'),
18
+ }).describe('A sky position above the horizon, with its rank and a plain-language visibility note.');
19
+ export const ListVisibleOutput = z.object({
20
+ sky_condition: z
21
+ .enum(['daylight', 'civil_twilight', 'nautical_twilight', 'astronomical_twilight', 'dark'])
22
+ .describe("Sky condition derived from the Sun's altitude — the gate for whether faint objects are observable."),
23
+ sun_altitude_degrees: z
24
+ .number()
25
+ .describe("The Sun's altitude in degrees that produced the sky condition."),
26
+ total_count: z.number().describe('Number of bodies returned above the minimum-altitude filter.'),
27
+ bodies: z
28
+ .array(VisibleBodySchema)
29
+ .describe('Every body (and optional star) above the minimum-altitude filter, ranked brightest-and-highest first.'),
30
+ });
31
+ export const listVisibleTool = tool('astronomy_list_visible', {
32
+ title: 'astronomy-mcp-server: list visible bodies',
33
+ description: 'The one-call "what is up right now" answer. For an observer location and instant, iterate every naked-eye solar-system body (and, with include_stars, the bundled bright stars), compute altitude and azimuth, keep those above the horizon, rank them brightest-and-highest first, and attach a plain-language visibility note to each. The whole sky is gated by the Sun\'s altitude into daylight / civil / nautical / astronomical twilight / dark, returned alongside the list. `time` is a single evaluation instant, not a window — for "tonight" pass a time after astronomical dusk (use astronomy_get_rise_set on the sun to find it). Default elevation 0 m; use min_altitude to skip objects grazing the horizon. This server does not geocode — resolve coordinates upstream first; pass an IANA timezone for observer-local times on each body.',
34
+ annotations: { readOnlyHint: true, openWorldHint: false, idempotentHint: true },
35
+ input: z.object({
36
+ latitude: z
37
+ .number()
38
+ .min(-90)
39
+ .max(90)
40
+ .describe('Observer latitude in decimal degrees, north positive.'),
41
+ longitude: z
42
+ .number()
43
+ .min(-180)
44
+ .max(180)
45
+ .describe('Observer longitude in decimal degrees, east positive.'),
46
+ elevation: z
47
+ .number()
48
+ .default(0)
49
+ .describe('Observer elevation in meters above sea level. Default 0.'),
50
+ time: z
51
+ .string()
52
+ .optional()
53
+ .describe('Evaluation instant as an ISO 8601 UTC string, e.g. "2024-08-12T05:00:00Z". Defaults to now. A single instant, not a window.'),
54
+ timezone: z
55
+ .string()
56
+ .optional()
57
+ .describe('IANA timezone for localized output, e.g. "America/Los_Angeles". When omitted, output is UTC-only.'),
58
+ min_altitude: z
59
+ .number()
60
+ .min(-90)
61
+ .max(90)
62
+ .default(0)
63
+ .describe('Minimum altitude in degrees to include a body. Default 0 (above the horizon); use e.g. 5 to require clearance.'),
64
+ include_stars: z
65
+ .boolean()
66
+ .default(false)
67
+ .describe('Include the bundled bright stars alongside planets. Default false.'),
68
+ }),
69
+ output: ListVisibleOutput,
70
+ errors: [
71
+ {
72
+ reason: 'time_out_of_range',
73
+ code: JsonRpcErrorCode.InvalidParams,
74
+ when: "The requested instant is outside the engine's high-accuracy span (≈1900–2100).",
75
+ recovery: 'Use a date between 1900 and 2100 and retry.',
76
+ },
77
+ ],
78
+ handler(input, ctx) {
79
+ const svc = getEphemerisService();
80
+ const timezone = svc.resolveTimezone(input.timezone ?? getServerConfig().defaultTimezone);
81
+ const date = svc.resolveTime(input.time);
82
+ const observer = {
83
+ latitude: input.latitude,
84
+ longitude: input.longitude,
85
+ elevation: input.elevation,
86
+ };
87
+ const result = svc.listVisible(observer, date, {
88
+ minAltitude: input.min_altitude,
89
+ includeStars: input.include_stars,
90
+ ...(timezone ? { timezone } : {}),
91
+ });
92
+ ctx.log.info('Listed visible bodies', {
93
+ count: result.bodies.length,
94
+ skyCondition: result.skyCondition,
95
+ });
96
+ const out = {
97
+ sky_condition: result.skyCondition,
98
+ sun_altitude_degrees: result.sunAltitudeDegrees,
99
+ total_count: result.bodies.length,
100
+ bodies: result.bodies.map((b) => ({
101
+ body: b.body,
102
+ time_utc: b.timeUtc,
103
+ ...(b.timeLocal ? { time_local: b.timeLocal } : {}),
104
+ equatorial: {
105
+ ra_hours: b.equatorial.raHours,
106
+ dec_degrees: b.equatorial.decDegrees,
107
+ distance_au: b.equatorial.distanceAu,
108
+ },
109
+ horizontal: {
110
+ altitude_degrees: b.horizontal.altitudeDegrees,
111
+ azimuth_degrees: b.horizontal.azimuthDegrees,
112
+ above_horizon: b.horizontal.aboveHorizon,
113
+ },
114
+ ecliptic: {
115
+ longitude_degrees: b.ecliptic.longitudeDegrees,
116
+ latitude_degrees: b.ecliptic.latitudeDegrees,
117
+ },
118
+ magnitude: b.magnitude,
119
+ angular_diameter_arcsec: b.angularDiameterArcsec,
120
+ phase_angle_degrees: b.phaseAngleDegrees,
121
+ illuminated_fraction: b.illuminatedFraction,
122
+ constellation: b.constellation,
123
+ rank: b.rank,
124
+ visibility_note: b.visibilityNote,
125
+ })),
126
+ };
127
+ return out;
128
+ },
129
+ format: (r) => {
130
+ const lines = [
131
+ `Sky: ${r.sky_condition} (Sun ${r.sun_altitude_degrees.toFixed(1)}°) — ${r.total_count} bodies visible`,
132
+ ];
133
+ if (r.bodies.length === 0) {
134
+ lines.push('No bodies above the minimum-altitude filter at this instant.');
135
+ }
136
+ for (const b of r.bodies) {
137
+ lines.push(`## ${b.rank}. ${b.body} — ${b.visibility_note}`);
138
+ lines.push(`time_utc: ${b.time_utc}${b.time_local ? ` | time_local: ${b.time_local}` : ''}`);
139
+ lines.push(`equatorial: RA ${b.equatorial.ra_hours} h, Dec ${b.equatorial.dec_degrees}°, distance ${b.equatorial.distance_au} AU`);
140
+ lines.push(`horizontal: altitude ${b.horizontal.altitude_degrees}°, azimuth ${b.horizontal.azimuth_degrees}°, above_horizon ${b.horizontal.above_horizon}`);
141
+ lines.push(`ecliptic: longitude ${b.ecliptic.longitude_degrees}°, latitude ${b.ecliptic.latitude_degrees}°`);
142
+ lines.push(`magnitude: ${b.magnitude ?? 'unavailable'}`);
143
+ lines.push(`angular_diameter_arcsec: ${b.angular_diameter_arcsec ?? 'unavailable'}`);
144
+ lines.push(`phase_angle_degrees: ${b.phase_angle_degrees ?? 'unavailable'}`);
145
+ lines.push(`illuminated_fraction: ${b.illuminated_fraction ?? 'unavailable'}`);
146
+ lines.push(`constellation: ${b.constellation.name} (${b.constellation.abbreviation})`);
147
+ }
148
+ return [{ type: 'text', text: lines.join('\n') }];
149
+ },
150
+ });
151
+ //# sourceMappingURL=list-visible.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-visible.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/list-visible.tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,MAAM,iBAAiB,GAAG,iBAAiB,CAAC,MAAM,CAAC;IACjD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4CAA4C,CAAC;IACvE,eAAe,EAAE,CAAC;SACf,MAAM,EAAE;SACR,QAAQ,CACP,sHAAsH,CACvH;CACJ,CAAC,CAAC,QAAQ,CACT,uFAAuF,CACxF,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,aAAa,EAAE,CAAC;SACb,IAAI,CAAC,CAAC,UAAU,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,CAAC,CAAC;SAC1F,QAAQ,CACP,oGAAoG,CACrG;IACH,oBAAoB,EAA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C;YACrF,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,mBAAmB,IAAI,aAAa,EAAE,CAAC,CAAC;YAC7E,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC,oBAAoB,IAAI,aAAa,EAAE,CAAC,CAAC;YAC/E,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,CAAC,aAAa,CAAC,YAAY,GAAG,CAAC,CAAC;QACzF,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @fileoverview Static reference data for the ephemeris layer: per-body mean radius
3
+ * (for angular-diameter computation), body type, and naked-eye visibility. Loaded
4
+ * once at module init — no upstream, no per-request allocation.
5
+ * @module services/ephemeris/body-data
6
+ */
7
+ import type { BodyName } from './types.js';
8
+ export type BodyType = 'star' | 'planet' | 'moon' | 'dwarf';
9
+ export interface BodyMeta {
10
+ /** Mean radius in kilometers — drives angular-diameter. Null for the point-source convention. */
11
+ meanRadiusKm: number;
12
+ /** Naked-eye visible under typical conditions. */
13
+ nakedEye: boolean;
14
+ /** Canonical display name. */
15
+ name: string;
16
+ /** Classification. */
17
+ type: BodyType;
18
+ }
19
+ /**
20
+ * Mean equatorial radii (km) from IAU / NASA fact sheets. Used to derive apparent
21
+ * angular diameter from the engine's distance; the Sun and Moon are the large discs,
22
+ * the planets resolve to arcseconds, Pluto is included for completeness.
23
+ */
24
+ export declare const BODY_META: Record<BodyName, BodyMeta>;
25
+ //# sourceMappingURL=body-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"body-data.d.ts","sourceRoot":"","sources":["../../../src/services/ephemeris/body-data.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAE5D,MAAM,WAAW,QAAQ;IACvB,iGAAiG;IACjG,YAAY,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,QAAQ,EAAE,OAAO,CAAC;IAClB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,sBAAsB;IACtB,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAWhD,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @fileoverview Static reference data for the ephemeris layer: per-body mean radius
3
+ * (for angular-diameter computation), body type, and naked-eye visibility. Loaded
4
+ * once at module init — no upstream, no per-request allocation.
5
+ * @module services/ephemeris/body-data
6
+ */
7
+ /**
8
+ * Mean equatorial radii (km) from IAU / NASA fact sheets. Used to derive apparent
9
+ * angular diameter from the engine's distance; the Sun and Moon are the large discs,
10
+ * the planets resolve to arcseconds, Pluto is included for completeness.
11
+ */
12
+ export const BODY_META = {
13
+ sun: { name: 'Sun', type: 'star', meanRadiusKm: 695700, nakedEye: true },
14
+ moon: { name: 'Moon', type: 'moon', meanRadiusKm: 1737.4, nakedEye: true },
15
+ mercury: { name: 'Mercury', type: 'planet', meanRadiusKm: 2439.7, nakedEye: true },
16
+ venus: { name: 'Venus', type: 'planet', meanRadiusKm: 6051.8, nakedEye: true },
17
+ mars: { name: 'Mars', type: 'planet', meanRadiusKm: 3389.5, nakedEye: true },
18
+ jupiter: { name: 'Jupiter', type: 'planet', meanRadiusKm: 69911, nakedEye: true },
19
+ saturn: { name: 'Saturn', type: 'planet', meanRadiusKm: 58232, nakedEye: true },
20
+ uranus: { name: 'Uranus', type: 'planet', meanRadiusKm: 25362, nakedEye: false },
21
+ neptune: { name: 'Neptune', type: 'planet', meanRadiusKm: 24622, nakedEye: false },
22
+ pluto: { name: 'Pluto', type: 'dwarf', meanRadiusKm: 1188.3, nakedEye: false },
23
+ };
24
+ //# sourceMappingURL=body-data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"body-data.js","sourceRoot":"","sources":["../../../src/services/ephemeris/body-data.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAA+B;IACnD,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IACxE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC1E,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAClF,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC9E,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC5E,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;IACjF,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC/E,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE;IAChF,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE;IAClF,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE;CAC/E,CAAC"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * @fileoverview EphemerisService — the keyless, offline compute core. Wraps
3
+ * astronomy-engine plus the bundled bright-star catalog and owns all unit
4
+ * normalization (radians/sidereal-hours → degrees/hours), the angular-diameter
5
+ * computation, the phase-name / visibility-note derivations, timezone formatting,
6
+ * and DefineStar slot management. Pure computation — no upstream, no ctx.state,
7
+ * nothing crosses requests; the catalog loads once at module init. This is a
8
+ * server-as-service: given (body, time, observer) every method is deterministic.
9
+ * @module services/ephemeris/ephemeris-service
10
+ */
11
+ import { Body } from 'astronomy-engine';
12
+ import type { BodyName, CatalogStar, EventName, EventRecord, ListVisibleResult, MoonPhaseResult, ObserverInput, RiseSetEvent, SkyPosition } from './types.js';
13
+ /** Options for the position computation when targeting a catalog star. */
14
+ interface StarTarget {
15
+ meta: CatalogStar;
16
+ slot: Body;
17
+ }
18
+ export declare class EphemerisService {
19
+ /** Lower-cased common name → catalog entry, built once at construction. */
20
+ private readonly starIndex;
21
+ /** Lower-cased designation → catalog entry, for Bayer-name lookups. */
22
+ private readonly designationIndex;
23
+ constructor();
24
+ /**
25
+ * Parse an optional ISO 8601 instant (defaults to now) into a JS Date,
26
+ * validating against astronomy-engine's high-accuracy span (≈1900–2100).
27
+ * Throws `invalidParams` with reason `time_out_of_range` outside it.
28
+ */
29
+ resolveTime(time?: string): Date;
30
+ /**
31
+ * Validate an IANA timezone (or fall back to undefined). Throws `invalidParams`
32
+ * with reason `invalid_timezone` when the zone is unknown to the runtime.
33
+ */
34
+ resolveTimezone(timezone?: string): string | undefined;
35
+ /** Format a Date as an ISO 8601 string carrying the observer-local offset. */
36
+ formatLocal(date: Date, timezone: string): string;
37
+ /** Compute the signed UTC offset string (e.g. "-07:00") for a zone at an instant. */
38
+ private tzOffset;
39
+ /** Resolve a star name/designation (case-insensitive) to a catalog entry, or throw. */
40
+ lookupStar(name: string): CatalogStar;
41
+ /** Allocate a DefineStar slot for one star and load its J2000 coordinates. */
42
+ private defineStarTarget;
43
+ /**
44
+ * Apparent topocentric position of a body (or catalog star) at one instant.
45
+ * `bodyOrStar` is a BodyName for solar-system bodies, or a StarTarget when the
46
+ * caller resolved a catalog star into a DefineStar slot.
47
+ */
48
+ position(target: {
49
+ kind: 'body';
50
+ body: BodyName;
51
+ } | {
52
+ kind: 'star';
53
+ star: StarTarget;
54
+ }, observer: ObserverInput, date: Date, timezone?: string): SkyPosition;
55
+ /** Rise/set/transit cycles for a body, searching forward from `start`. */
56
+ riseSet(body: BodyName, observer: ObserverInput, start: Date, count: number, timezone?: string): RiseSetEvent[];
57
+ /** Civil/nautical/astronomical dawn+dusk pairs for the Sun on the search day. */
58
+ private twilight;
59
+ /** Moon phase, illumination, age, and the next four quarter phases. */
60
+ moonPhase(date: Date, timezone?: string): MoonPhaseResult;
61
+ /** Days since the previous new moon (synodic age). */
62
+ private moonAgeDays;
63
+ /** Search forward for the next `count` occurrences of an event class. */
64
+ findEvents(event: EventName, opts: {
65
+ start: Date;
66
+ count: number;
67
+ body?: BodyName;
68
+ observer?: ObserverInput;
69
+ timezone?: string;
70
+ }): EventRecord[];
71
+ private seasonEvents;
72
+ private moonQuarterEvents;
73
+ private lunarEclipseEvents;
74
+ private solarEclipseEvents;
75
+ private relativeLongitudeEvents;
76
+ private maxElongationEvents;
77
+ private apsisEvents;
78
+ /** Iterate naked-eye bodies (+ optional catalog stars), filter above-horizon, rank. */
79
+ listVisible(observer: ObserverInput, date: Date, opts: {
80
+ minAltitude: number;
81
+ includeStars: boolean;
82
+ timezone?: string;
83
+ }): ListVisibleResult;
84
+ /** Resolve a single named star into a DefineStar slot for get_sky_position. */
85
+ resolveStarTarget(name: string): StarTarget;
86
+ private toObserver;
87
+ }
88
+ /** Initialize the ephemeris service. Pure compute — no config or storage needed. */
89
+ export declare function initEphemerisService(): void;
90
+ /** Accessor — throws if not initialized in setup(). */
91
+ export declare function getEphemerisService(): EphemerisService;
92
+ export {};
93
+ //# sourceMappingURL=ephemeris-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ephemeris-service.d.ts","sourceRoot":"","sources":["../../../src/services/ephemeris/ephemeris-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAGL,IAAI,EA+BL,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EACV,QAAQ,EACR,WAAW,EACX,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,aAAa,EAGb,YAAY,EAEZ,WAAW,EAIZ,MAAM,YAAY,CAAC;AA8CpB,0EAA0E;AAC1E,UAAU,UAAU;IAClB,IAAI,EAAE,WAAW,CAAC;IAClB,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,qBAAa,gBAAgB;IAC3B,2EAA2E;IAC3E,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA2B;IACrD,uEAAuE;IACvE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA2B;;IAa5D;;;;OAIG;IACH,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;IAoBhC;;;OAGG;IACH,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAgBtD,8EAA8E;IAC9E,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAmBjD,qFAAqF;IACrF,OAAO,CAAC,QAAQ;IAuBhB,uFAAuF;IACvF,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW;IAcrC,8EAA8E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