@cyanheads/astronomy-mcp-server 0.2.4 → 0.2.6

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 (29) hide show
  1. package/AGENTS.md +1 -1
  2. package/CLAUDE.md +1 -1
  3. package/README.md +13 -11
  4. package/changelog/0.2.x/0.2.5.md +19 -0
  5. package/changelog/0.2.x/0.2.6.md +13 -0
  6. package/dist/config/server-config.js +3 -3
  7. package/dist/config/server-config.js.map +1 -1
  8. package/dist/mcp-server/tools/definitions/get-ephemeris.tool.d.ts.map +1 -1
  9. package/dist/mcp-server/tools/definitions/get-ephemeris.tool.js +67 -10
  10. package/dist/mcp-server/tools/definitions/get-ephemeris.tool.js.map +1 -1
  11. package/dist/mcp-server/tools/definitions/get-satellite-passes.tool.d.ts +29 -5
  12. package/dist/mcp-server/tools/definitions/get-satellite-passes.tool.d.ts.map +1 -1
  13. package/dist/mcp-server/tools/definitions/get-satellite-passes.tool.js +83 -13
  14. package/dist/mcp-server/tools/definitions/get-satellite-passes.tool.js.map +1 -1
  15. package/dist/services/horizons/horizons-service.d.ts.map +1 -1
  16. package/dist/services/horizons/horizons-service.js +7 -0
  17. package/dist/services/horizons/horizons-service.js.map +1 -1
  18. package/dist/services/horizons/types.d.ts +6 -1
  19. package/dist/services/horizons/types.d.ts.map +1 -1
  20. package/dist/services/satellite/satellite-service.d.ts +87 -33
  21. package/dist/services/satellite/satellite-service.d.ts.map +1 -1
  22. package/dist/services/satellite/satellite-service.js +266 -103
  23. package/dist/services/satellite/satellite-service.js.map +1 -1
  24. package/dist/services/satellite/types.d.ts +60 -7
  25. package/dist/services/satellite/types.d.ts.map +1 -1
  26. package/dist/services/satellite/types.js +36 -2
  27. package/dist/services/satellite/types.js.map +1 -1
  28. package/package.json +1 -1
  29. package/server.json +5 -5
@@ -1,21 +1,29 @@
1
1
  /**
2
2
  * @fileoverview SatelliteService — gated extension that predicts visible satellite
3
- * passes. Fetches the current TLE from CelesTrak (keyless, cached briefly in
4
- * process per CelesTrak's refetch guidance), propagates with SGP4 via satellite.js
5
- * (offline), and returns above-horizon passes. A pass is "visible" only when the
6
- * satellite is sunlit at peak AND the observer's sky is dark — the ground-darkness
7
- * gate reuses the core sun-altitude logic. A pass already underway when the window
8
- * opens is omitted rather than reported with the query boundary as its rise, and an
9
- * element set that will not propagate to the window is rejected — naming the object
10
- * or the requested instant, whichever the epoch distance implicates — rather than
11
- * yielding no passes. Network-touching code carries its own timeout + retry boundary
12
- * and degrades loudly; it never substitutes core output.
3
+ * passes. Fetches the current GP element set from CelesTrak as OMM JSON (keyless,
4
+ * cached briefly in process per CelesTrak's refetch guidance), propagates it with SGP4
5
+ * via satellite.js (offline), and returns above-horizon passes. One request builder
6
+ * serves both lookups: by catalog number (`CATNR=`) and by name (`NAME=`, a
7
+ * case-insensitive substring match whose single-match response already carries the
8
+ * element set, so resolving a name costs no extra round trip). A pass is "visible"
9
+ * only when the satellite is sunlit at peak AND the observer's sky is dark — the
10
+ * ground-darkness gate reuses the core sun-altitude logic. A pass already underway
11
+ * when the window opens is omitted rather than reported with the query boundary as its
12
+ * rise. A start beyond the element set's epoch horizon is rejected on that distance
13
+ * alone, and inside the horizon an element set that will not propagate at all is
14
+ * rejected as a decayed object — neither reaches the caller as a 200-shaped answer,
15
+ * which would read as "nothing visible tonight" or as a pass list built from mean
16
+ * elements that stopped describing the orbit. Network-touching code carries its own
17
+ * timeout + retry boundary and degrades loudly; it never substitutes core output. A
18
+ * response that parses but is not an OMM element set is reported apart from an outage
19
+ * — its shape is a property of the record, so retrying it can only fail again.
13
20
  * @module services/satellite/satellite-service
14
21
  */
15
- import { invalidParams, JsonRpcErrorCode, McpError, notFound, serviceUnavailable, } from '@cyanheads/mcp-ts-core/errors';
22
+ import { invalidParams, JsonRpcErrorCode, McpError, notFound, serializationError, serviceUnavailable, } from '@cyanheads/mcp-ts-core/errors';
16
23
  import { fetchWithTimeout, withRetry } from '@cyanheads/mcp-ts-core/utils';
17
24
  import { Body, Equator, Horizon, MakeTime, Observer } from 'astronomy-engine';
18
- import { ecfToLookAngles, eciToEcf, gstime, jday, propagate, shadowFraction, sunPos, twoline2satrec, } from 'satellite.js';
25
+ import { ecfToLookAngles, eciToEcf, gstime, jday, json2satrec, propagate, shadowFraction, sunPos, } from 'satellite.js';
26
+ import { OmmResponseSchema, } from './types.js';
19
27
  const DEG = 180 / Math.PI;
20
28
  /**
21
29
  * Opt in to satellite.js's community decay check on every propagation. Reference SGP4
@@ -29,10 +37,12 @@ const PROPAGATE_OPTIONS = { communityDecayCheckEnabled: true };
29
37
  /** Julian date of the Unix epoch — converts `satrec.jdsatepoch` to milliseconds. */
30
38
  const JD_UNIX_EPOCH = 2440587.5;
31
39
  /**
32
- * How far the requested window may sit from the element set's epoch before a refused
33
- * propagation is attributed to the request rather than to the object. CelesTrak serves
40
+ * How far the requested window may sit from the element set's epoch. CelesTrak serves
34
41
  * element sets refreshed within hours and SGP4 stops describing the orbit within weeks
35
- * of epoch, so a month comfortably covers any window anchored near the present.
42
+ * of epoch, so a month comfortably covers any window anchored near the present. It also
43
+ * separates the two ways a window can be unreachable: inside the horizon the element set
44
+ * is current, so a refused propagation is the object having reentered; beyond it the
45
+ * request is what overreached, whether or not the propagation would have succeeded.
36
46
  */
37
47
  const MAX_EPOCH_DISTANCE_DAYS = 30;
38
48
  /** Minimum peak elevation (deg) for a pass to count — below this it grazes the horizon. */
@@ -41,6 +51,34 @@ const MIN_PEAK_ELEVATION = 10;
41
51
  const STEP_SECONDS = 30;
42
52
  /** Ground is "dark enough" for a naked-eye pass when the Sun is below this altitude (civil dusk). */
43
53
  const GROUND_DARK_SUN_ALT = -6;
54
+ /**
55
+ * How many candidates an ambiguous name query offers back. CelesTrak's `NAME=` is a
56
+ * case-insensitive substring match, so an everyday query is routinely five figures deep
57
+ * ("STARLINK" matches over ten thousand objects) — the list exists to let a caller
58
+ * recognize the object it meant, not to enumerate the catalog. Twenty covers a real
59
+ * family (the handful of objects carrying "HUBBLE", a weather-satellite series) while
60
+ * keeping the error small enough to read; past that the answer is to narrow the name,
61
+ * and the match count says so rather than passing a slice off as the whole set.
62
+ */
63
+ const MAX_NAME_CANDIDATES = 20;
64
+ /**
65
+ * Recovery hints, byte-identical to the `recovery` strings the tool declares for the
66
+ * same reasons. The contract entry documents the next move and this is the copy that
67
+ * reaches the wire; a test pins each pair so the two cannot drift apart.
68
+ */
69
+ const TLE_NOT_FOUND_RECOVERY = 'Verify the catalog number at celestrak.org; the object may have decayed or never been catalogued.';
70
+ const NAME_NOT_FOUND_RECOVERY = 'Check the spelling, try a shorter distinctive substring, or look the object up at celestrak.org.';
71
+ const AMBIGUOUS_NAME_RECOVERY = 'Re-call with norad_id set to one of the listed candidates, or supply a longer, more specific name.';
72
+ /**
73
+ * The hint for an ambiguity whose candidate list is a slice rather than the whole match
74
+ * set. Picking from the list is the right first move only when the list is complete;
75
+ * offered against a constellation query it invites a confident pass prediction for an
76
+ * object the caller never asked about, so the truncated case leads with narrowing and
77
+ * makes the list conditional on the wanted object actually appearing in it.
78
+ */
79
+ const AMBIGUOUS_NAME_TRUNCATED_RECOVERY = 'Supply a longer, more specific name — the listed candidates are only the lowest-numbered few of the matches. Use norad_id only if the object you want is among them.';
80
+ const CELESTRAK_UNAVAILABLE_RECOVERY = 'CelesTrak is degraded or timed out; retry in a few minutes.';
81
+ const MALFORMED_ELEMENT_SET_RECOVERY = 'Retrying returns the same record — request a different object, and report the element set to celestrak.org.';
44
82
  export class SatelliteService {
45
83
  baseUrl;
46
84
  timeoutMs;
@@ -51,108 +89,227 @@ export class SatelliteService {
51
89
  this.timeoutMs = timeoutMs;
52
90
  this.cacheTtlMs = cacheTtlMs;
53
91
  }
54
- /** Fetch a current TLE for a NORAD ID, using the in-process TTL cache. */
55
- async fetchTle(noradId, ctx) {
56
- const cached = this.cache.get(noradId);
57
- if (cached && cached.expiresAt > Date.now())
58
- return cached.tle;
59
- const url = `${this.baseUrl}?CATNR=${noradId}&FORMAT=TLE`;
92
+ /** Fetch the current element set for a NORAD ID, using the in-process TTL cache. */
93
+ async fetchElementSet(noradId, ctx) {
94
+ const cacheKey = `CATNR=${noradId}`;
95
+ const cached = this.fromCache(cacheKey);
96
+ if (cached)
97
+ return cached;
98
+ const records = await this.fetchGpRecords(cacheKey, `NORAD ID ${noradId}`, ctx, () => this.catalogMiss(noradId));
99
+ return this.cacheElementSet(cacheKey, records[0]);
100
+ }
101
+ /**
102
+ * Resolve a satellite name to the one current element set it names. CelesTrak matches
103
+ * `NAME=` as a case-insensitive substring, so a query resolves only when it picks out a
104
+ * single object — either because it matched one, or because exactly one match carries
105
+ * that name outright, which is a request for that object however many longer names
106
+ * contain it. Anything else comes back as candidates to choose from.
107
+ */
108
+ async resolveByName(name, ctx) {
109
+ const query = name.trim();
110
+ const cacheKey = `NAME=${encodeURIComponent(query)}`;
111
+ const cached = this.fromCache(cacheKey);
112
+ if (cached)
113
+ return cached;
114
+ const records = await this.fetchGpRecords(cacheKey, `the name "${query}"`, ctx, () => this.nameMiss(query));
115
+ const single = records.length === 1 ? records[0] : this.exactlyNamed(records, query);
116
+ if (!single)
117
+ throw this.ambiguousName(records, query);
118
+ return this.cacheElementSet(cacheKey, single);
119
+ }
120
+ /** The one record whose `OBJECT_NAME` is the query itself, when exactly one is. */
121
+ exactlyNamed(records, query) {
122
+ const wanted = query.toLowerCase();
123
+ const exact = records.filter((r) => r.OBJECT_NAME.trim().toLowerCase() === wanted);
124
+ return exact.length === 1 ? exact[0] : undefined;
125
+ }
126
+ /** The cached element set for a query, while its TTL holds. */
127
+ fromCache(cacheKey) {
128
+ const entry = this.cache.get(cacheKey);
129
+ return entry && entry.expiresAt > Date.now() ? entry.elements : undefined;
130
+ }
131
+ cacheElementSet(cacheKey, record) {
132
+ const elements = {
133
+ name: record.OBJECT_NAME.trim(),
134
+ noradId: Number(record.NORAD_CAT_ID),
135
+ omm: record,
136
+ };
137
+ this.cache.set(cacheKey, { elements, expiresAt: Date.now() + this.cacheTtlMs });
138
+ return elements;
139
+ }
140
+ /**
141
+ * Run one GP query and return the records it matched. `FORMAT=JSON` rather than
142
+ * `FORMAT=TLE`: the legacy format cannot encode a catalog number above 99999, and
143
+ * CelesTrak refuses to serve such an object as TLE at all, so JSON is the only format
144
+ * covering the whole catalog. `params` is the query fragment selecting the objects
145
+ * (`CATNR=` or `NAME=`); `miss` names an empty result in the caller's own terms, since
146
+ * "no object with that catalog number" and "no object with that name" are different
147
+ * answers with different next moves.
148
+ */
149
+ async fetchGpRecords(params, subject, ctx, miss) {
150
+ const url = `${this.baseUrl}?${params}&FORMAT=JSON`;
60
151
  let text;
61
152
  try {
62
153
  text = await withRetry(async () => {
63
154
  const response = await fetchWithTimeout(url, this.timeoutMs, ctx, {
64
155
  signal: ctx.signal,
65
- // CelesTrak answers an uncatalogued object with 404, which is a domain
66
- // outcome here (tle_not_found), not a service failure — log it at debug.
67
- // The thrown status-mapped McpError is unchanged; only severity drops.
156
+ // CelesTrak answers an unmatched query with 404, which is a domain outcome
157
+ // here (a miss), not a service failure — log it at debug. The thrown
158
+ // status-mapped McpError is unchanged; only severity drops.
68
159
  expectedStatuses: [404],
69
160
  });
70
161
  return response.text();
71
162
  }, {
72
- operation: 'SatelliteService.fetchTle',
163
+ operation: 'SatelliteService.fetchGpRecords',
73
164
  context: ctx,
74
165
  baseDelayMs: 1000,
75
166
  signal: ctx.signal,
76
167
  });
77
168
  }
78
169
  catch (err) {
79
- // fetchWithTimeout throws a status-mapped McpError on any non-2xx whose
80
- // data carries raw upstream internals (URL, status/body plus the legacy
81
- // statusCode/responseBody aliases). Map it into the typed contract with
82
- // clean data so nothing upstream leaks to the client. CelesTrak answers a
83
- // missing object with 404 → NotFound.
84
- throw this.classifyFetchError(err, noradId);
170
+ /**
171
+ * fetchWithTimeout throws a status-mapped McpError on any non-2xx whose data
172
+ * carries raw upstream internals (URL, status/body plus the legacy
173
+ * statusCode/responseBody aliases). Map it into the typed contract with clean data
174
+ * so nothing upstream leaks to the client. CelesTrak answers an unmatched query
175
+ * with 404 → NotFound; everything else — 5xx, a fetch deadline, a network failure
176
+ * — is an outage. The original rides as `cause` for server-side logs only.
177
+ */
178
+ if (err instanceof McpError && err.code === JsonRpcErrorCode.NotFound)
179
+ throw miss();
180
+ throw serviceUnavailable(`Failed to fetch element sets for ${subject} from CelesTrak.`, {
181
+ reason: 'celestrak_unavailable',
182
+ recovery: { hint: CELESTRAK_UNAVAILABLE_RECOVERY },
183
+ }, { cause: err instanceof Error ? err : undefined });
85
184
  }
86
- const tle = this.parseTle(text, noradId);
87
- this.cache.set(noradId, { tle, expiresAt: Date.now() + this.cacheTtlMs });
88
- return tle;
185
+ return this.parseGpRecords(text, subject, miss);
89
186
  }
90
187
  /**
91
- * Map a fetch/transport McpError onto the typed contract with leak-free data.
92
- * A NotFound (CelesTrak's 404 for an uncatalogued object) becomes tle_not_found;
93
- * everything else — 5xx (ServiceUnavailable), a fetch deadline (Timeout), or a
94
- * network failure — becomes celestrak_unavailable. The
95
- * original error rides as `cause` for server-side logs but never reaches the client.
188
+ * Parse a CelesTrak GP response into OMM records. The miss sentinel has to be tested
189
+ * before `JSON.parse`: CelesTrak returns that text under a 200 in some cases, and
190
+ * parsing it would throw a `SyntaxError` where the caller is owed a typed miss.
96
191
  */
97
- classifyFetchError(err, noradId) {
98
- if (err instanceof McpError && err.code === JsonRpcErrorCode.NotFound) {
99
- return notFound(`CelesTrak has no current element set for NORAD ID ${noradId}.`, {
100
- reason: 'tle_not_found',
101
- recovery: {
102
- hint: 'Verify the catalog number at celestrak.org; the object may have decayed or never been catalogued.',
103
- },
104
- });
105
- }
106
- return serviceUnavailable(`Failed to fetch a TLE for NORAD ID ${noradId} from CelesTrak.`, {
107
- reason: 'celestrak_unavailable',
108
- recovery: { hint: 'CelesTrak is degraded or timed out; retry in a few minutes.' },
109
- }, { cause: err instanceof Error ? err : undefined });
110
- }
111
- /** Parse a CelesTrak TLE response (optional name line + the two element lines). */
112
- parseTle(text, noradId) {
192
+ parseGpRecords(text, subject, miss) {
113
193
  const trimmed = text.trim();
114
- if (/No GP data found|Invalid query/i.test(trimmed) || trimmed.length === 0) {
115
- throw notFound(`CelesTrak has no current element set for NORAD ID ${noradId}.`, {
116
- reason: 'tle_not_found',
117
- recovery: {
118
- hint: 'Verify the catalog number at celestrak.org; the object may have decayed or never been catalogued.',
119
- },
120
- });
194
+ if (trimmed.length === 0 || /No GP data found|Invalid query/i.test(trimmed))
195
+ throw miss();
196
+ let parsed;
197
+ try {
198
+ parsed = JSON.parse(trimmed);
121
199
  }
122
- const lines = trimmed.split('\n').map((l) => l.trimEnd());
123
- const line1Index = lines.findIndex((l) => l.startsWith('1 '));
124
- const line2Index = lines.findIndex((l) => l.startsWith('2 '));
125
- const line1 = line1Index === -1 ? undefined : lines[line1Index];
126
- const line2 = line2Index === -1 ? undefined : lines[line2Index];
127
- if (!line1 || !line2) {
128
- throw serviceUnavailable(`CelesTrak returned an unparsable response for NORAD ID ${noradId}.`, {
129
- reason: 'celestrak_unavailable',
130
- recovery: { hint: 'CelesTrak may be degraded; retry in a few minutes.' },
131
- });
200
+ catch {
201
+ throw this.unparsable(subject);
132
202
  }
133
- const nameLine = line1Index > 0 ? lines[line1Index - 1]?.trim() : undefined;
134
- return { ...(nameLine ? { name: nameLine } : {}), line1, line2 };
203
+ const records = OmmResponseSchema.safeParse(parsed);
204
+ /**
205
+ * A body that parsed as JSON but does not carry an OMM element set is a different
206
+ * outcome from one that is not GP data at all: CelesTrak answered, with a record
207
+ * whose shape is a permanent property of that record. Retrying reaches the same
208
+ * record and fails the same way, so it is classified apart from the outage rather
209
+ * than sending the caller into a loop that can only fail again.
210
+ */
211
+ if (!records.success)
212
+ throw this.malformedElementSet(subject, records.error.issues);
213
+ if (records.data.length === 0)
214
+ throw miss();
215
+ return records.data;
216
+ }
217
+ unparsable(subject) {
218
+ return serviceUnavailable(`CelesTrak returned an unparsable response for ${subject}.`, {
219
+ reason: 'celestrak_unavailable',
220
+ recovery: { hint: CELESTRAK_UNAVAILABLE_RECOVERY },
221
+ });
222
+ }
223
+ /**
224
+ * Name the record that failed OMM validation, and the fields that failed it. Each
225
+ * issue path is `[record index, field name]`, and those names are the OMM message's
226
+ * own, so listing them says which part of the record is wrong without putting the
227
+ * validator's vocabulary — issue codes, expected/received types — on the wire. A body
228
+ * whose whole shape is wrong (an object where an array belongs) names no field, and
229
+ * the message stands on the subject alone.
230
+ */
231
+ malformedElementSet(subject, issues) {
232
+ const fields = [...new Set(issues.map(({ path: [, field] }) => field))].filter((field) => typeof field === 'string');
233
+ const named = fields.length > 0 ? ` Fields that did not validate: ${fields.join(', ')}.` : '';
234
+ return serializationError(`CelesTrak returned a GP record for ${subject} that is not a valid OMM element set.${named}`, {
235
+ reason: 'malformed_element_set',
236
+ recovery: { hint: MALFORMED_ELEMENT_SET_RECOVERY },
237
+ });
238
+ }
239
+ catalogMiss(noradId) {
240
+ return notFound(`CelesTrak has no current element set for NORAD ID ${noradId}.`, {
241
+ reason: 'tle_not_found',
242
+ recovery: { hint: TLE_NOT_FOUND_RECOVERY },
243
+ });
244
+ }
245
+ nameMiss(query) {
246
+ return notFound(`No current CelesTrak object has a name containing "${query}".`, {
247
+ reason: 'satellite_name_not_found',
248
+ recovery: { hint: NAME_NOT_FOUND_RECOVERY },
249
+ });
250
+ }
251
+ /**
252
+ * Hand back the objects a name query matched so the caller can name one outright. The
253
+ * total is stated whether or not the list is complete, because a slice presented as the
254
+ * whole set would read as a catalog holding twenty Starlinks. Ordered by catalog
255
+ * number — the order CelesTrak already answers in — so the same query always offers the
256
+ * same candidates. Whether the list is complete also selects the hint: a complete list
257
+ * is something to pick from, a slice is something to narrow past.
258
+ */
259
+ ambiguousName(records, query) {
260
+ const candidates = records
261
+ .map((r) => ({ name: r.OBJECT_NAME.trim(), norad_id: Number(r.NORAD_CAT_ID) }))
262
+ .sort((a, b) => a.norad_id - b.norad_id)
263
+ .slice(0, MAX_NAME_CANDIDATES);
264
+ const truncated = records.length > candidates.length;
265
+ const listing = candidates.map((c) => `${c.name} (${c.norad_id})`).join(', ');
266
+ const preamble = truncated
267
+ ? `"${query}" matches ${records.length} current CelesTrak objects. The ${candidates.length} with the lowest catalog numbers:`
268
+ : `"${query}" matches ${records.length} current CelesTrak objects:`;
269
+ return invalidParams(`${preamble} ${listing}.`, {
270
+ reason: 'ambiguous_satellite_name',
271
+ recovery: {
272
+ hint: truncated ? AMBIGUOUS_NAME_TRUNCATED_RECOVERY : AMBIGUOUS_NAME_RECOVERY,
273
+ },
274
+ match_count: records.length,
275
+ shown: candidates.length,
276
+ truncated,
277
+ candidates,
278
+ });
135
279
  }
136
280
  /**
137
281
  * Predict visible passes over the next `days` from `start`. Steps the orbit with
138
282
  * SGP4, brackets above-horizon intervals, and keeps passes whose peak is sunlit
139
283
  * and over a dark-enough ground.
140
284
  *
141
- * Throws when the element set will not propagate to the requested window — as
142
- * `object_decayed` if the window sits near the element set's epoch, otherwise as
143
- * `time_out_of_range`. Without that check either condition reaches the caller as
144
- * `passes: []`, which reads identically to "nothing visible tonight".
285
+ * Throws `time_out_of_range` when `start` lies beyond the element set's epoch horizon,
286
+ * and `object_decayed` when a window inside that horizon will not propagate at all.
287
+ * Without those checks either condition reaches the caller as a 200-shaped result —
288
+ * `passes: []`, which reads identically to "nothing visible tonight", or a pass list
289
+ * built from elements that stopped describing the orbit weeks earlier.
145
290
  */
146
- predictPasses(tle, noradId, observer, days, start, formatLocal) {
147
- const satrec = twoline2satrec(tle.line1, tle.line2);
291
+ predictPasses(elements, observer, days, start, formatLocal) {
292
+ const satrec = json2satrec(elements.omm);
148
293
  /**
149
- * Probe the first instant of the window before scanning it. SGP4 refuses an element
150
- * set it can no longer turn into an orbit by answering null, and the scan loop would
151
- * silently skip every such timestep and return an empty, falsely-successful pass
152
- * list. Reject up front instead, naming which of the two causes applies.
294
+ * Reject a start the element set does not reach before propagating anything. SGP4's
295
+ * own refusal cannot stand in for this: past the horizon it keeps answering with
296
+ * numerically well-formed positions built from mean elements that no longer describe
297
+ * the orbit, and whether it refuses at a given distance follows the element set's
298
+ * drag terms rather than the distance itself. Gating the horizon on that refusal left
299
+ * it unenforced for exactly the requests it exists to catch.
300
+ */
301
+ const epochDistanceDays = this.epochDistanceDays(satrec, start);
302
+ if (epochDistanceDays > MAX_EPOCH_DISTANCE_DAYS) {
303
+ throw this.startBeyondEpoch(elements.noradId, epochDistanceDays);
304
+ }
305
+ /**
306
+ * Probe the first instant of the window before scanning it. Inside the horizon the
307
+ * element set is current, so a refusal is the object having reentered rather than the
308
+ * request overreaching — and the scan loop would silently skip every such timestep and
309
+ * return an empty, falsely-successful pass list.
153
310
  */
154
311
  if (!propagate(satrec, start, PROPAGATE_OPTIONS)) {
155
- throw this.classifyPropagationFailure(satrec, noradId, start);
312
+ throw this.objectDecayed(elements.noradId);
156
313
  }
157
314
  const observerGd = {
158
315
  longitude: (observer.longitude * Math.PI) / 180,
@@ -241,27 +398,33 @@ export class SatelliteService {
241
398
  peakElevation = -90;
242
399
  }
243
400
  }
244
- return { noradId, ...(tle.name ? { satelliteName: tle.name } : {}), passes };
401
+ return { noradId: elements.noradId, satelliteName: elements.name, passes };
402
+ }
403
+ /** How far an instant sits from the element set's epoch, in days, on either side. */
404
+ epochDistanceDays(satrec, instant) {
405
+ const epochMs = (satrec.jdsatepoch - JD_UNIX_EPOCH) * 86400000;
406
+ return Math.abs(instant.getTime() - epochMs) / 86400000;
245
407
  }
246
408
  /**
247
- * Name the reason SGP4 refused the first instant of the window. The refusal on its own
248
- * is ambiguous: a reentered object and a start far from the element set's epoch both
249
- * leave the mean elements unable to describe an orbit. Epoch distance separates them —
250
- * within the horizon the element set is current, so the object is what changed; beyond
251
- * it the request is, and calling a satellite that is still in orbit decayed would be a
252
- * false statement with an unfollowable recovery.
409
+ * Blame the request when it reaches past the element set's validity horizon. Calling a
410
+ * satellite that is still in orbit decayed would be a false statement with an
411
+ * unfollowable recovery, so the message names the distance instead — the one fact that
412
+ * says how far the start has to move.
253
413
  */
254
- classifyPropagationFailure(satrec, noradId, start) {
255
- const epochMs = (satrec.jdsatepoch - JD_UNIX_EPOCH) * 86400000;
256
- const distanceDays = Math.abs(start.getTime() - epochMs) / 86400000;
257
- if (distanceDays > MAX_EPOCH_DISTANCE_DAYS) {
258
- return invalidParams(`The requested start is ${distanceDays.toFixed(0)} days from the epoch of the current element set for NORAD ID ${noradId}; SGP4 cannot propagate it that far.`, {
259
- reason: 'time_out_of_range',
260
- recovery: {
261
- hint: 'An element set describes the orbit for weeks either side of its epoch — request a start within about a month of today.',
262
- },
263
- });
264
- }
414
+ startBeyondEpoch(noradId, distanceDays) {
415
+ return invalidParams(`The requested start is ${distanceDays.toFixed(0)} days from the epoch of the current element set for NORAD ID ${noradId}; the element set stops describing the orbit well before that.`, {
416
+ reason: 'time_out_of_range',
417
+ recovery: {
418
+ hint: 'An element set describes the orbit for weeks either side of its epoch — request a start within about a month of today.',
419
+ },
420
+ });
421
+ }
422
+ /**
423
+ * Blame the object when a window inside the epoch horizon still will not propagate. The
424
+ * element set is current there, so mean elements that cannot describe an orbit are the
425
+ * signature of a reentry rather than of a request that overreached.
426
+ */
427
+ objectDecayed(noradId) {
265
428
  return notFound(`NORAD ID ${noradId} has decayed — SGP4 cannot propagate its current element set to the requested window.`, {
266
429
  reason: 'object_decayed',
267
430
  recovery: {
@@ -1 +1 @@
1
- {"version":3,"file":"satellite-service.js","sourceRoot":"","sources":["../../../src/services/satellite/satellite-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,kBAAkB,GACnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EACL,eAAe,EACf,QA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G,GAAG,OAAO,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAC7D,OAAO,GAAG,CAAC,QAAQ,GAAG,mBAAmB,CAAC;IAC5C,CAAC;CACF;AAED,+EAA+E;AAE/E,IAAI,QAAsC,CAAC;AAE3C,6FAA6F;AAC7F,MAAM,UAAU,oBAAoB,CAAC,OAAe,EAAE,SAAiB,EAAE,UAAkB;IACzF,QAAQ,GAAG,IAAI,gBAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAClE,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,mBAAmB;IACjC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;IAC3F,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,7 +1,10 @@
1
1
  /**
2
- * @fileoverview Domain types for the satellite-pass extension.
2
+ * @fileoverview Domain types for the satellite-pass extension, including the OMM
3
+ * (Orbit Mean-Elements Message) record CelesTrak serves under `FORMAT=JSON` — the
4
+ * only format that carries the six-digit catalog numbers now in the catalog.
3
5
  * @module services/satellite/types
4
6
  */
7
+ import { z } from '@cyanheads/mcp-ts-core';
5
8
  /** A single visible pass of a satellite over an observer. */
6
9
  export interface SatellitePass {
7
10
  durationSeconds: number;
@@ -21,12 +24,62 @@ export interface SatellitePass {
21
24
  export interface SatellitePassResult {
22
25
  noradId: number;
23
26
  passes: SatellitePass[];
24
- satelliteName?: string;
27
+ satelliteName: string;
25
28
  }
26
- /** A parsed two-line element set plus its display name. */
27
- export interface Tle {
28
- line1: string;
29
- line2: string;
30
- name?: string;
29
+ /**
30
+ * One GP record as CelesTrak serves it under `FORMAT=JSON`. Validated at the network
31
+ * edge because every field here is read straight into the SGP4 initializer — a missing
32
+ * one becomes NaN and surfaces as a plausible-looking but meaningless pass rather than a
33
+ * failure. `OBJECT_ID` and `ELEMENT_SET_NO` take no part in the propagation math but are
34
+ * required by the OMM v3 record the propagator accepts, and CelesTrak supplies both on
35
+ * every GP record. Unknown keys are dropped: nothing downstream reads them.
36
+ */
37
+ export declare const OmmRecordSchema: z.ZodObject<{
38
+ ARG_OF_PERICENTER: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
39
+ BSTAR: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
40
+ ECCENTRICITY: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
41
+ ELEMENT_SET_NO: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
42
+ EPOCH: z.ZodString;
43
+ INCLINATION: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
44
+ MEAN_ANOMALY: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
45
+ MEAN_MOTION: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
46
+ MEAN_MOTION_DDOT: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
47
+ MEAN_MOTION_DOT: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
48
+ NORAD_CAT_ID: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
49
+ OBJECT_ID: z.ZodString;
50
+ OBJECT_NAME: z.ZodString;
51
+ RA_OF_ASC_NODE: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
52
+ }, z.core.$strip>;
53
+ export type OmmRecord = z.infer<typeof OmmRecordSchema>;
54
+ /** A CelesTrak `FORMAT=JSON` response body: an array of GP records, one per match. */
55
+ export declare const OmmResponseSchema: z.ZodArray<z.ZodObject<{
56
+ ARG_OF_PERICENTER: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
57
+ BSTAR: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
58
+ ECCENTRICITY: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
59
+ ELEMENT_SET_NO: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
60
+ EPOCH: z.ZodString;
61
+ INCLINATION: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
62
+ MEAN_ANOMALY: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
63
+ MEAN_MOTION: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
64
+ MEAN_MOTION_DDOT: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
65
+ MEAN_MOTION_DOT: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
66
+ NORAD_CAT_ID: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
67
+ OBJECT_ID: z.ZodString;
68
+ OBJECT_NAME: z.ZodString;
69
+ RA_OF_ASC_NODE: z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>;
70
+ }, z.core.$strip>>;
71
+ /** A current element set for one catalogued object, with its identity resolved. */
72
+ export interface ElementSet {
73
+ name: string;
74
+ noradId: number;
75
+ omm: OmmRecord;
76
+ }
77
+ /**
78
+ * One object a name query matched. Snake-cased because this shape goes straight onto the
79
+ * wire in the ambiguity error's `data`, alongside the tool's other client-facing fields.
80
+ */
81
+ export interface SatelliteCandidate {
82
+ name: string;
83
+ norad_id: number;
31
84
  }
32
85
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/satellite/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,6DAA6D;AAC7D,MAAM,WAAW,aAAa;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM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CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,sFAAsF;AACtF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;kBAA2B,CAAC;AAE1D,mFAAmF;AACnF,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,SAAS,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB"}
@@ -1,6 +1,40 @@
1
1
  /**
2
- * @fileoverview Domain types for the satellite-pass extension.
2
+ * @fileoverview Domain types for the satellite-pass extension, including the OMM
3
+ * (Orbit Mean-Elements Message) record CelesTrak serves under `FORMAT=JSON` — the
4
+ * only format that carries the six-digit catalog numbers now in the catalog.
3
5
  * @module services/satellite/types
4
6
  */
5
- export {};
7
+ import { z } from '@cyanheads/mcp-ts-core';
8
+ /**
9
+ * The OMM spec leaves numeric types open and sources disagree — CelesTrak emits numbers,
10
+ * Space-Track emits strings. The propagator coerces either, so accept both rather than
11
+ * rejecting a well-formed element set over its JSON type.
12
+ */
13
+ const OmmNumber = z.union([z.number(), z.string()]);
14
+ /**
15
+ * One GP record as CelesTrak serves it under `FORMAT=JSON`. Validated at the network
16
+ * edge because every field here is read straight into the SGP4 initializer — a missing
17
+ * one becomes NaN and surfaces as a plausible-looking but meaningless pass rather than a
18
+ * failure. `OBJECT_ID` and `ELEMENT_SET_NO` take no part in the propagation math but are
19
+ * required by the OMM v3 record the propagator accepts, and CelesTrak supplies both on
20
+ * every GP record. Unknown keys are dropped: nothing downstream reads them.
21
+ */
22
+ export const OmmRecordSchema = z.object({
23
+ ARG_OF_PERICENTER: OmmNumber,
24
+ BSTAR: OmmNumber,
25
+ ECCENTRICITY: OmmNumber,
26
+ ELEMENT_SET_NO: OmmNumber,
27
+ EPOCH: z.string(),
28
+ INCLINATION: OmmNumber,
29
+ MEAN_ANOMALY: OmmNumber,
30
+ MEAN_MOTION: OmmNumber,
31
+ MEAN_MOTION_DDOT: OmmNumber,
32
+ MEAN_MOTION_DOT: OmmNumber,
33
+ NORAD_CAT_ID: OmmNumber,
34
+ OBJECT_ID: z.string(),
35
+ OBJECT_NAME: z.string(),
36
+ RA_OF_ASC_NODE: OmmNumber,
37
+ });
38
+ /** A CelesTrak `FORMAT=JSON` response body: an array of GP records, one per match. */
39
+ export const OmmResponseSchema = z.array(OmmRecordSchema);
6
40
  //# sourceMappingURL=types.js.map