ether-to-astro 1.2.0 → 1.3.0

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 (66) hide show
  1. package/README.md +15 -5
  2. package/dist/astro-service/chart-output-service.d.ts +44 -0
  3. package/dist/astro-service/chart-output-service.js +110 -0
  4. package/dist/astro-service/date-input.d.ts +14 -0
  5. package/dist/astro-service/date-input.js +30 -0
  6. package/dist/astro-service/electional-service.d.ts +45 -0
  7. package/dist/astro-service/electional-service.js +305 -0
  8. package/dist/astro-service/natal-service.d.ts +41 -0
  9. package/dist/astro-service/natal-service.js +179 -0
  10. package/dist/astro-service/rising-sign-service.d.ts +37 -0
  11. package/dist/astro-service/rising-sign-service.js +137 -0
  12. package/dist/astro-service/service-types.d.ts +82 -0
  13. package/dist/astro-service/service-types.js +1 -0
  14. package/dist/astro-service/shared.d.ts +65 -0
  15. package/dist/astro-service/shared.js +98 -0
  16. package/dist/astro-service/sky-service.d.ts +48 -0
  17. package/dist/astro-service/sky-service.js +144 -0
  18. package/dist/astro-service/transit-service.d.ts +82 -0
  19. package/dist/astro-service/transit-service.js +353 -0
  20. package/dist/astro-service.d.ts +101 -89
  21. package/dist/astro-service.js +162 -1042
  22. package/dist/tool-registry.js +1 -1
  23. package/docs/product/architecture-boundaries.md +8 -0
  24. package/docs/releases/1.3.0.md +51 -0
  25. package/docs/releases/README.md +17 -0
  26. package/package.json +4 -1
  27. package/src/astro-service/chart-output-service.ts +155 -0
  28. package/src/astro-service/date-input.ts +40 -0
  29. package/src/astro-service/electional-service.ts +395 -0
  30. package/src/astro-service/natal-service.ts +235 -0
  31. package/src/astro-service/rising-sign-service.ts +181 -0
  32. package/src/astro-service/service-types.ts +90 -0
  33. package/src/astro-service/shared.ts +128 -0
  34. package/src/astro-service/sky-service.ts +191 -0
  35. package/src/astro-service/transit-service.ts +507 -0
  36. package/src/astro-service.ts +177 -1386
  37. package/src/tool-registry.ts +1 -1
  38. package/tests/README.md +15 -0
  39. package/tests/property/electional-service.property.test.ts +67 -0
  40. package/tests/property/helpers/arbitraries.ts +126 -0
  41. package/tests/property/helpers/config.ts +52 -0
  42. package/tests/property/helpers/runtime.ts +12 -0
  43. package/tests/property/houses.property.test.ts +74 -0
  44. package/tests/property/rising-sign-service.property.test.ts +255 -0
  45. package/tests/property/service-transits.property.test.ts +154 -0
  46. package/tests/property/time-utils.property.test.ts +91 -0
  47. package/tests/property/transits.property.test.ts +113 -0
  48. package/tests/unit/astro-service/chart-output-service.test.ts +102 -0
  49. package/tests/unit/astro-service/electional-service.test.ts +182 -0
  50. package/tests/unit/astro-service/natal-service.test.ts +126 -0
  51. package/tests/unit/astro-service/rising-sign-service.test.ts +145 -0
  52. package/tests/unit/astro-service/sky-service.test.ts +130 -0
  53. package/tests/unit/astro-service/transit-service.test.ts +312 -0
  54. package/tests/unit/astro-service.test.ts +136 -781
  55. package/tests/unit/rising-sign-windows.test.ts +93 -0
  56. package/tests/unit/tool-registry.test.ts +11 -0
  57. package/tests/validation/README.md +14 -0
  58. package/tests/validation/adapters/internal.ts +234 -4
  59. package/tests/validation/compare/electional.ts +151 -0
  60. package/tests/validation/compare/rising-sign-windows.ts +347 -0
  61. package/tests/validation/compare/service-transits.ts +205 -0
  62. package/tests/validation/fixtures/electional/core.ts +88 -0
  63. package/tests/validation/fixtures/rising-sign-windows/core.ts +57 -0
  64. package/tests/validation/fixtures/service-transits/core.ts +89 -0
  65. package/tests/validation/utils/fixtureTypes.ts +139 -1
  66. package/tests/validation/validation.spec.ts +82 -0
@@ -1,12 +1,12 @@
1
+ import type { GenerateChartInput, GenerateTransitChartInput, GetElectionalContextInput, GetHousesInput, GetRisingSignWindowsInput, GetTransitsInput, ServiceResult, SetNatalChartInput } from './astro-service/service-types.js';
1
2
  import { ChartRenderer } from './charts.js';
2
3
  import { EclipseCalculator } from './eclipses.js';
3
4
  import type { McpStartupDefaults } from './entrypoint.js';
4
5
  import { EphemerisCalculator } from './ephemeris.js';
5
6
  import { HouseCalculator } from './houses.js';
6
7
  import { RiseSetCalculator } from './riseset.js';
7
- import { type Disambiguation } from './time-utils.js';
8
8
  import { TransitCalculator } from './transits.js';
9
- import { type AspectType, type ElectionalHouseSystem, type HouseSystem, type NatalChart, type PlanetPosition } from './types.js';
9
+ import type { NatalChart } from './types.js';
10
10
  interface AstroServiceDependencies {
11
11
  ephem?: EphemerisCalculator;
12
12
  transitCalc?: TransitCalculator;
@@ -18,72 +18,6 @@ interface AstroServiceDependencies {
18
18
  now?: () => Date;
19
19
  writeFile?: (path: string, data: string | Buffer, encoding?: BufferEncoding) => Promise<void>;
20
20
  }
21
- export interface SetNatalChartInput {
22
- name: string;
23
- year: number;
24
- month: number;
25
- day: number;
26
- hour: number;
27
- minute: number;
28
- latitude: number;
29
- longitude: number;
30
- timezone: string;
31
- house_system?: HouseSystem;
32
- birth_time_disambiguation?: Disambiguation;
33
- }
34
- export interface GetTransitsInput {
35
- date?: string;
36
- categories?: string[];
37
- include_mundane?: boolean;
38
- days_ahead?: number;
39
- mode?: 'snapshot' | 'best_hit' | 'forecast';
40
- max_orb?: number;
41
- exact_only?: boolean;
42
- applying_only?: boolean;
43
- }
44
- export interface GetElectionalContextInput {
45
- date: string;
46
- time: string;
47
- timezone: string;
48
- latitude: number;
49
- longitude: number;
50
- house_system?: ElectionalHouseSystem;
51
- include_ruler_basics?: boolean;
52
- include_planetary_applications?: boolean;
53
- orb_degrees?: number;
54
- }
55
- export interface GetHousesInput {
56
- system?: string;
57
- }
58
- export interface GetRisingSignWindowsInput {
59
- date: string;
60
- latitude: number;
61
- longitude: number;
62
- timezone: string;
63
- mode?: 'approximate' | 'exact';
64
- }
65
- export interface GenerateChartInput {
66
- theme?: 'light' | 'dark';
67
- format?: 'svg' | 'png' | 'webp';
68
- output_path?: string;
69
- }
70
- export interface GenerateTransitChartInput extends GenerateChartInput {
71
- date?: string;
72
- }
73
- export interface ServiceResult<T> {
74
- data: T;
75
- text: string;
76
- }
77
- export interface MundaneAspect {
78
- id: string;
79
- planetA: PlanetPosition['planet'];
80
- planetB: PlanetPosition['planet'];
81
- aspect: AspectType;
82
- orb: number;
83
- isApplying: boolean;
84
- longitudeA: number;
85
- longitudeB: number;
86
- }
87
21
  interface ChartServiceResult {
88
22
  format: 'svg' | 'png' | 'webp';
89
23
  outputPath?: string;
@@ -94,13 +28,15 @@ interface ChartServiceResult {
94
28
  mimeType: string;
95
29
  };
96
30
  }
97
- export declare function parseDateOnlyInput(dateStr: string): {
98
- year: number;
99
- month: number;
100
- day: number;
101
- hour: number;
102
- minute: number;
103
- };
31
+ export { parseDateOnlyInput } from './astro-service/date-input.js';
32
+ export type { GenerateChartInput, GenerateTransitChartInput, GetElectionalContextInput, GetHousesInput, GetRisingSignWindowsInput, GetTransitsInput, ServiceResult, SetNatalChartInput, } from './astro-service/service-types.js';
33
+ /**
34
+ * Shared service facade used by both the MCP server and the CLI.
35
+ *
36
+ * @remarks
37
+ * Public methods remain the stable orchestration boundary while domain-specific
38
+ * internals can be extracted behind the class without changing callers.
39
+ */
104
40
  export declare class AstroService {
105
41
  readonly ephem: EphemerisCalculator;
106
42
  readonly transitCalc: TransitCalculator;
@@ -109,39 +45,115 @@ export declare class AstroService {
109
45
  readonly eclipseCalc: EclipseCalculator;
110
46
  readonly chartRenderer: ChartRenderer;
111
47
  readonly mcpStartupDefaults: Readonly<McpStartupDefaults>;
48
+ private readonly transitService;
49
+ private readonly electionalService;
50
+ private readonly risingSignService;
51
+ private readonly natalService;
52
+ private readonly skyService;
53
+ private readonly chartOutputService;
112
54
  private readonly now;
113
55
  private readonly writeFileFn;
114
56
  constructor(deps?: AstroServiceDependencies);
57
+ /**
58
+ * Format user-facing timestamps using the current startup default weekday policy.
59
+ */
115
60
  private formatTimestamp;
116
- private normalizeLongitude;
117
- private getSignAndDegree;
118
- private getHouseNumber;
119
- private resolveHouseSystem;
120
- private resolveTimezones;
61
+ /**
62
+ * Resolve the timezone used for user-facing timestamps and labels.
63
+ *
64
+ * @remarks
65
+ * Explicit per-call timezone wins, then startup defaults, then the natal chart
66
+ * timezone, and finally UTC.
67
+ */
121
68
  resolveReportingTimezone(explicitTimezone?: string, natalTimezone?: string): string;
69
+ /**
70
+ * Initialize the underlying ephemeris engine.
71
+ */
122
72
  init(): Promise<void>;
73
+ /**
74
+ * Report whether the ephemeris engine has been initialized.
75
+ */
123
76
  isInitialized(): boolean;
77
+ /**
78
+ * Build and cache the shared natal chart payload used by later workflows.
79
+ *
80
+ * @remarks
81
+ * This preserves the existing natal contract, including polar-latitude house
82
+ * fallback behavior and the current user-facing summary text.
83
+ */
124
84
  setNatalChart(input: SetNatalChartInput): ServiceResult<Record<string, unknown>> & {
125
85
  chart: NatalChart;
126
86
  };
87
+ /**
88
+ * Calculate natal transits while preserving the public service contract.
89
+ *
90
+ * @remarks
91
+ * Transit day interpretation uses the natal chart timezone for calculation and
92
+ * may use a different reporting timezone for labels when startup defaults are set.
93
+ */
127
94
  getTransits(natalChart: NatalChart, input?: GetTransitsInput): ServiceResult<Record<string, unknown>>;
128
- private getMundaneWeather;
129
- private getMundaneAspects;
130
- private getMundaneDay;
95
+ /**
96
+ * Produce deterministic electional context for a single local instant.
97
+ *
98
+ * @remarks
99
+ * Electional local times keep strict DST rejection semantics for ambiguous or
100
+ * nonexistent wall-clock instants.
101
+ */
131
102
  getElectionalContext(input: GetElectionalContextInput): ServiceResult<Record<string, unknown>>;
103
+ /**
104
+ * Calculate house cusps and angles for a natal chart.
105
+ *
106
+ * @remarks
107
+ * House-system resolution still respects explicit per-call input, then stored
108
+ * chart preference, then startup defaults.
109
+ */
132
110
  getHouses(natalChart: NatalChart, input?: GetHousesInput): ServiceResult<Record<string, unknown>>;
111
+ /**
112
+ * Find rising-sign windows across a calendar day at a specific location.
113
+ *
114
+ * @remarks
115
+ * `exact` mode refines sign boundaries more aggressively; `approximate` mode
116
+ * keeps the cheaper bucketed scan behavior.
117
+ */
133
118
  getRisingSignWindows(input: GetRisingSignWindowsInput): ServiceResult<Record<string, unknown>>;
134
- private getElectionalApplyingAspects;
135
- private isElectionalAspectApplying;
136
- private getSignedAngularDifference;
137
- private getElectionalPhaseName;
138
- private getTraditionalSignRuler;
119
+ /**
120
+ * Return the currently retrograde planets for the requested reporting timezone.
121
+ */
139
122
  getRetrogradePlanets(timezone?: string): ServiceResult<Record<string, unknown>>;
123
+ /**
124
+ * Return the next rise and set events after the local day anchor for the chart location.
125
+ *
126
+ * @remarks
127
+ * The lookup anchor remains local midnight in the natal chart timezone even
128
+ * when reporting text uses a preferred reporting timezone.
129
+ */
140
130
  getRiseSetTimes(natalChart: NatalChart): Promise<ServiceResult<Record<string, unknown>>>;
131
+ /**
132
+ * Return current asteroid and node positions for the requested reporting timezone.
133
+ */
141
134
  getAsteroidPositions(timezone?: string): ServiceResult<Record<string, unknown>>;
135
+ /**
136
+ * Look up the next solar and lunar eclipses after the current instant.
137
+ */
142
138
  getNextEclipses(timezone?: string): ServiceResult<Record<string, unknown>>;
139
+ /**
140
+ * Summarize process-local server state and configured startup defaults.
141
+ */
143
142
  getServerStatus(natalChart: NatalChart | null): ServiceResult<Record<string, unknown>>;
143
+ /**
144
+ * Generate a natal chart image or SVG for the current chart.
145
+ *
146
+ * @remarks
147
+ * When `output_path` is omitted the payload is returned inline; otherwise the
148
+ * rendered asset is written to disk and only path metadata is returned.
149
+ */
144
150
  generateNatalChart(natalChart: NatalChart, input?: GenerateChartInput): Promise<ChartServiceResult>;
151
+ /**
152
+ * Generate a transit chart image or SVG for a target date.
153
+ *
154
+ * @remarks
155
+ * Omitted dates still resolve to local noon in the natal chart timezone before
156
+ * rendering so date-only behavior stays stable across timezone conversions.
157
+ */
145
158
  generateTransitChart(natalChart: NatalChart, input?: GenerateTransitChartInput): Promise<ChartServiceResult>;
146
159
  }
147
- export {};