zeus-api-types 1.0.0 → 1.0.1

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.
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Game State Types
3
+ *
4
+ * Core game state interfaces shared between middle-layer and frontend.
5
+ * Extracted from middle-layer/src/core/GameState.ts
6
+ */
7
+ export interface TimeState {
8
+ current: string;
9
+ day: number;
10
+ hour: number;
11
+ minute: number;
12
+ }
13
+ /**
14
+ * Base interface for world entities (NPCs, Locations, etc.)
15
+ * All world entities share this common structure
16
+ */
17
+ export interface WorldEntity {
18
+ id: string;
19
+ name?: string;
20
+ description?: string;
21
+ discovered?: boolean;
22
+ image?: string;
23
+ [key: string]: unknown;
24
+ }
25
+ /**
26
+ * Player character
27
+ */
28
+ export interface Player extends WorldEntity {
29
+ name: string;
30
+ motivation?: string;
31
+ role?: string;
32
+ backstory?: string;
33
+ tone?: string;
34
+ }
35
+ /**
36
+ * Non-Player Character
37
+ * Inherits base entity structure, all other properties are genre-specific
38
+ */
39
+ export interface NPC extends WorldEntity {
40
+ name: string;
41
+ discovered: boolean;
42
+ playable?: boolean;
43
+ motivation?: string;
44
+ role?: string;
45
+ backstory?: string;
46
+ tone?: string;
47
+ }
48
+ /**
49
+ * Location in the game world
50
+ * Requires name and description, maintains custom properties for tracking
51
+ */
52
+ export interface Location extends WorldEntity {
53
+ name: string;
54
+ description: string;
55
+ discovered: boolean;
56
+ atmosphere: string;
57
+ accessible: boolean;
58
+ }
59
+ /**
60
+ * World container - reduced version without events (for frontend)
61
+ */
62
+ export interface World {
63
+ locations: Record<string, Location>;
64
+ npcs: Record<string, NPC>;
65
+ }
66
+ export interface DialogMessage {
67
+ speaker: string;
68
+ message: string;
69
+ timestamp?: string;
70
+ tone?: string;
71
+ }
72
+ export interface HistoryEntry {
73
+ turn_number: number;
74
+ timestamp: string;
75
+ game_time?: string;
76
+ location: string;
77
+ narrative_summary: string;
78
+ choice: {
79
+ id?: string;
80
+ label: string;
81
+ meta?: unknown;
82
+ };
83
+ charactersPresent?: string[];
84
+ }
85
+ export interface PresentationCache {
86
+ turn: number;
87
+ narrative: string;
88
+ charactersPresent?: string[];
89
+ storyArcProgression?: number;
90
+ dialogHistory?: DialogMessage[];
91
+ generatedAt?: string;
92
+ source?: string;
93
+ }
94
+ export interface Session {
95
+ history: HistoryEntry[];
96
+ storySoFar?: HistoryEntry[];
97
+ key_themes?: string[];
98
+ narrative_momentum?: string;
99
+ presentationCache?: PresentationCache;
100
+ prologue?: string;
101
+ }
102
+ export interface StoryArc {
103
+ id?: string;
104
+ theme?: string;
105
+ title?: string;
106
+ description?: string;
107
+ narrative_hooks?: string[];
108
+ atmosphere_modifiers?: Record<string, number>;
109
+ /**
110
+ * Arc pattern representing emotional trajectory
111
+ * 11 values (0-100) at 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100% progress
112
+ */
113
+ arc_pattern?: number[];
114
+ /**
115
+ * Tone pattern representing emotional tone trajectory throughout the story
116
+ * 11 tone values in compact notation at progress intervals
117
+ */
118
+ tone_pattern?: string[];
119
+ [key: string]: unknown;
120
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ /**
3
+ * Game State Types
4
+ *
5
+ * Core game state interfaces shared between middle-layer and frontend.
6
+ * Extracted from middle-layer/src/core/GameState.ts
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
- export { ApiError, ApiErrorResponse } from './errors';
2
- export { NarrativeStartEventPayload, NarrativeChunkEventPayload, NarrativeCompleteEventPayload, NarrativeMetadataEventPayload, MetadataEventPayload, DoneEventPayload, ErrorEventPayload, NarrativeSSEEventPayload, } from './sse/narrative';
1
+ export type { ApiError, ApiErrorResponse } from './errors';
2
+ export type { NarrativeStartEventPayload, NarrativeChunkEventPayload, NarrativeCompleteEventPayload, NarrativeMetadataEventPayload, MetadataEventPayload, DoneEventPayload, ErrorEventPayload, NarrativeSSEEventPayload, } from './sse/narrative';
3
+ export type { TimeState, WorldEntity, Player, NPC, Location, World, DialogMessage, HistoryEntry, PresentationCache, Session, StoryArc, } from './game-state';
4
+ export type { NarrativeFontPreferences, SoundPreferences, ModelStackPreset, ModelEntry, ModelStack, ModelStackPreferences, SystemModelPresets, AIPreferences, UserPreferences, UserMetadata, } from './user-preferences';
@@ -0,0 +1,131 @@
1
+ /**
2
+ * User Preferences Types
3
+ *
4
+ * User preference interfaces shared between middle-layer and frontend.
5
+ * Extracted from middle-layer/src/core/GameState.ts
6
+ */
7
+ /**
8
+ * Narrative font preferences for display customization
9
+ * Supports preset font stacks, custom fonts, and Google Fonts
10
+ */
11
+ export interface NarrativeFontPreferences {
12
+ /**
13
+ * Font family - can be:
14
+ * - Preset name: 'serif', 'sans', 'mono', 'literary', 'modern', 'typewriter'
15
+ * - Custom CSS font-family string: 'Lora, Georgia, serif'
16
+ */
17
+ family: string;
18
+ /** Font size in pixels (12-48) */
19
+ sizePx: number;
20
+ /** Line height multiplier (1.0-3.0), default 1.7 */
21
+ lineHeight?: number;
22
+ /** Letter spacing in pixels (0-5), default 0 */
23
+ letterSpacing?: number;
24
+ /** Optional Google Fonts URL for custom font loading */
25
+ googleFontsUrl?: string;
26
+ }
27
+ /**
28
+ * Sound notification preferences
29
+ */
30
+ export interface SoundPreferences {
31
+ /** Sound to play when narrative starts streaming */
32
+ onNarrativeStart: string;
33
+ /** Volume for narrative start sound (0.0-1.0) */
34
+ onNarrativeStartVolume: number;
35
+ /** Sound to play when narrative finishes streaming */
36
+ onNarrativeEnd: string;
37
+ /** Volume for narrative end sound (0.0-1.0) */
38
+ onNarrativeEndVolume: number;
39
+ /** Enable haptic feedback (vibration) when narrative ends */
40
+ hapticsOnNarrativeEnd?: boolean;
41
+ }
42
+ /**
43
+ * Preset identifiers for model stacks
44
+ */
45
+ export type ModelStackPreset = 'fast' | 'balanced' | 'detailed' | 'custom';
46
+ /**
47
+ * A single model entry in a stack with configuration
48
+ * Extensible for future OpenRouter parameters
49
+ */
50
+ export interface ModelEntry {
51
+ /** OpenRouter model identifier (e.g., "anthropic/claude-3.5-sonnet") */
52
+ model: string;
53
+ /** Temperature for generation (0.0-2.0) */
54
+ temperature: number;
55
+ /** Optional max tokens override */
56
+ maxTokens?: number;
57
+ /** Optional top_p parameter */
58
+ topP?: number;
59
+ }
60
+ /**
61
+ * A stack of models to try in order (with deduplication against env fallbacks)
62
+ */
63
+ export type ModelStack = ModelEntry[];
64
+ /**
65
+ * User's model stack preferences
66
+ */
67
+ export interface ModelStackPreferences {
68
+ /** Selected preset for narrative generation */
69
+ narrativePreset: ModelStackPreset;
70
+ /** Selected preset for dialog generation */
71
+ dialogPreset: ModelStackPreset;
72
+ /** Custom stack for narrative (used when narrativePreset === 'custom') */
73
+ narrativeCustom?: ModelStack;
74
+ /** Custom stack for dialog (used when dialogPreset === 'custom') */
75
+ dialogCustom?: ModelStack;
76
+ }
77
+ /**
78
+ * System-level model stack presets (stored in TEMPLATE/preferences.json)
79
+ */
80
+ export interface SystemModelPresets {
81
+ narrative: {
82
+ fast: ModelStack;
83
+ balanced: ModelStack;
84
+ detailed: ModelStack;
85
+ };
86
+ dialog: {
87
+ fast: ModelStack;
88
+ balanced: ModelStack;
89
+ detailed: ModelStack;
90
+ };
91
+ /** Extraction presets (backend-only, no user selection - only 'balanced') */
92
+ extraction?: {
93
+ balanced: ModelStack;
94
+ };
95
+ /** Genre init presets (backend-only, no user selection - only 'balanced') */
96
+ genre?: {
97
+ balanced: ModelStack;
98
+ };
99
+ }
100
+ /**
101
+ * AI behavior preferences
102
+ */
103
+ export interface AIPreferences {
104
+ /**
105
+ * Words/phrases the AI should avoid using in narrative generation.
106
+ * These are aggregated with system, genre, and narrative style blacklists.
107
+ */
108
+ blacklist: string[];
109
+ /**
110
+ * Model stack preferences for narrative and dialog generation
111
+ */
112
+ modelPrefs?: ModelStackPreferences;
113
+ }
114
+ /**
115
+ * User preferences stored in preferences.json
116
+ */
117
+ export interface UserPreferences {
118
+ version: number;
119
+ updatedAt?: string;
120
+ /** Display name for the user (1-50 chars, free-text Unicode) */
121
+ userName?: string;
122
+ narrativeFont: NarrativeFontPreferences;
123
+ sound?: SoundPreferences;
124
+ ai?: AIPreferences;
125
+ }
126
+ /**
127
+ * User-specific metadata injected into game state responses
128
+ */
129
+ export interface UserMetadata {
130
+ preferences: UserPreferences;
131
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ /**
3
+ * User Preferences Types
4
+ *
5
+ * User preference interfaces shared between middle-layer and frontend.
6
+ * Extracted from middle-layer/src/core/GameState.ts
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zeus-api-types",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Shared API types for Wagtales - SSE payloads, error types, and common interfaces",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -44,4 +44,3 @@
44
44
  "typescript": "^5.0.0"
45
45
  }
46
46
  }
47
-