zeus-api-types 1.0.50 → 1.0.51

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.
package/dist/ai.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Operation types for AI metadata tracking
3
+ */
4
+ export type AIOperationType = 'narrative' | 'dialog' | 'updateScript' | 'choiceMetadata' | 'gameInit' | 'genreInit';
5
+ export interface AIOperationTokens {
6
+ prompt_tokens: number;
7
+ completion_tokens: number;
8
+ total_tokens: number;
9
+ count: number;
10
+ }
11
+ export interface AIMetadata {
12
+ tokensUsed: {
13
+ total: {
14
+ prompt_tokens: number;
15
+ completion_tokens: number;
16
+ total_tokens: number;
17
+ };
18
+ byOperation: {
19
+ narrative?: AIOperationTokens;
20
+ dialog?: AIOperationTokens;
21
+ updateScript?: AIOperationTokens;
22
+ choiceMetadata?: AIOperationTokens;
23
+ gameInit?: AIOperationTokens;
24
+ genreInit?: AIOperationTokens;
25
+ };
26
+ };
27
+ modelsUsed: string[];
28
+ operationCount: number;
29
+ operationsByType: Record<string, number>;
30
+ firstOperationAt?: string;
31
+ lastOperationAt?: string;
32
+ }
package/dist/ai.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // ============================================================================
3
+ // AI METADATA TRACKING
4
+ // ============================================================================
5
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/deck.d.ts ADDED
@@ -0,0 +1,81 @@
1
+ import type { GameState } from "./game-state";
2
+ export interface StoryArc {
3
+ id?: string;
4
+ theme?: string;
5
+ title?: string;
6
+ description?: string;
7
+ narrative_hooks?: string[];
8
+ atmosphere_modifiers?: Record<string, number>;
9
+ /**
10
+ * Arc pattern representing emotional trajectory
11
+ * 11 values (0-100) at 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100% progress
12
+ */
13
+ arc_pattern?: number[];
14
+ /**
15
+ * Tone pattern representing emotional tone trajectory throughout the story
16
+ * 11 tone values in compact notation at progress intervals
17
+ */
18
+ tone_pattern?: string[];
19
+ [key: string]: unknown;
20
+ }
21
+ /**
22
+ * Base card interface - shared properties across all card types
23
+ */
24
+ export interface BaseDeckCard {
25
+ id: string;
26
+ theme?: string;
27
+ title?: string;
28
+ description?: string;
29
+ emoji?: string;
30
+ [key: string]: unknown;
31
+ }
32
+ /**
33
+ * Story Arc card - used for narrative trajectory
34
+ */
35
+ export interface StoryArcCard extends BaseDeckCard {
36
+ narrative_hooks?: string[];
37
+ /**
38
+ * Arc pattern representing emotional trajectory
39
+ * 11 values (0-100) at 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100% progress
40
+ * 0 = darkest/worst, 100 = brightest/best
41
+ * Based on Kurt Vonnegut's story shapes
42
+ */
43
+ arc_pattern?: number[];
44
+ /**
45
+ * Tone pattern representing emotional tone trajectory throughout the story
46
+ * 11 tone values in compact notation at 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100% progress
47
+ * Each tone is in format "HHH:SSS:LLL" (hue:saturation:lightness)
48
+ * Interpolated between values to get tone at any progression point
49
+ */
50
+ tone_pattern?: string[];
51
+ }
52
+ /**
53
+ * Narrative Style card - used for writing style and voice
54
+ */
55
+ export interface NarrativeStyleCard extends BaseDeckCard {
56
+ representative_authors?: string[];
57
+ technical_guide?: string;
58
+ example?: string;
59
+ }
60
+ export interface DeckDefinition {
61
+ deckId: string;
62
+ name?: string;
63
+ description?: string;
64
+ version?: string;
65
+ genre?: string;
66
+ cards: BaseDeckCard[];
67
+ draw_rules?: Record<string, unknown>;
68
+ [key: string]: unknown;
69
+ }
70
+ /**
71
+ * Multi-deck format - contains multiple named decks
72
+ * Example: { story_arc: {...}, mood: {...}, etc. }
73
+ */
74
+ export interface MultiDeckDefinition {
75
+ story_arc: DeckDefinition;
76
+ [deckName: string]: DeckDefinition;
77
+ }
78
+ export interface FixtureSet {
79
+ state: GameState;
80
+ deck: DeckDefinition;
81
+ }
package/dist/deck.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // ============================================================================
3
+ // STORY ARC & CARD SYSTEM
4
+ // ============================================================================
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,43 @@
1
+ import type { WorldEntity } from "./game-state";
2
+ export interface EventPropagation {
3
+ to: string;
4
+ effect: Record<string, unknown>;
5
+ decay?: number;
6
+ }
7
+ export interface BaseEvent extends WorldEntity {
8
+ id: string;
9
+ name?: string;
10
+ description?: string;
11
+ location?: string;
12
+ conditions?: Record<string, unknown>;
13
+ effects?: Record<string, unknown>;
14
+ propagation?: EventPropagation[];
15
+ cooldown?: number;
16
+ cooldown_remaining?: number;
17
+ }
18
+ export interface DeterministicEvent extends BaseEvent {
19
+ }
20
+ export interface ScheduledEvent extends BaseEvent {
21
+ timestamp: string;
22
+ interrupts?: boolean;
23
+ severity?: string;
24
+ }
25
+ export interface ProbabilisticEvent extends BaseEvent {
26
+ base_probability: number;
27
+ current_probability: number;
28
+ modifiers?: Record<string, unknown>;
29
+ last_triggered_turn?: number;
30
+ }
31
+ export interface EventHistoryEntry {
32
+ event_id: string;
33
+ type: 'deterministic' | 'scheduled' | 'probabilistic';
34
+ turn: number;
35
+ timestamp?: string;
36
+ outcome?: string;
37
+ }
38
+ export interface WorldEvents {
39
+ deterministic: DeterministicEvent[];
40
+ scheduled: ScheduledEvent[];
41
+ probabilistic: ProbabilisticEvent[];
42
+ history: EventHistoryEntry[];
43
+ }
package/dist/events.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // ============================================================================
3
+ // WORLD EVENT SYSTEM
4
+ // ============================================================================
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,37 +1,8 @@
1
1
  import { ToneCompact } from "tonelib";
2
+ import type { AIMetadata } from "./ai";
3
+ import type { NarrativeStyleCard, StoryArc } from "./deck";
4
+ import type { WorldEvents } from "./events";
2
5
  import { UserMetadata } from "./user-preferences";
3
- /**
4
- * Operation types for AI metadata tracking
5
- */
6
- export type AIOperationType = 'narrative' | 'dialog' | 'updateScript' | 'choiceMetadata' | 'gameInit' | 'genreInit';
7
- export interface AIOperationTokens {
8
- prompt_tokens: number;
9
- completion_tokens: number;
10
- total_tokens: number;
11
- count: number;
12
- }
13
- export interface AIMetadata {
14
- tokensUsed: {
15
- total: {
16
- prompt_tokens: number;
17
- completion_tokens: number;
18
- total_tokens: number;
19
- };
20
- byOperation: {
21
- narrative?: AIOperationTokens;
22
- dialog?: AIOperationTokens;
23
- updateScript?: AIOperationTokens;
24
- choiceMetadata?: AIOperationTokens;
25
- gameInit?: AIOperationTokens;
26
- genreInit?: AIOperationTokens;
27
- };
28
- };
29
- modelsUsed: string[];
30
- operationCount: number;
31
- operationsByType: Record<string, number>;
32
- firstOperationAt?: string;
33
- lastOperationAt?: string;
34
- }
35
6
  /**
36
7
  * Tag structure for both system-level and author-defined metadata
37
8
  * - System tags (in immutable): managed by backend, hidden from UI
@@ -194,133 +165,6 @@ export interface Session {
194
165
  presentationCache?: PresentationCache;
195
166
  prologue?: string;
196
167
  }
197
- export interface StoryArc {
198
- id?: string;
199
- theme?: string;
200
- title?: string;
201
- description?: string;
202
- narrative_hooks?: string[];
203
- atmosphere_modifiers?: Record<string, number>;
204
- /**
205
- * Arc pattern representing emotional trajectory
206
- * 11 values (0-100) at 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100% progress
207
- */
208
- arc_pattern?: number[];
209
- /**
210
- * Tone pattern representing emotional tone trajectory throughout the story
211
- * 11 tone values in compact notation at progress intervals
212
- */
213
- tone_pattern?: string[];
214
- [key: string]: unknown;
215
- }
216
- /**
217
- * Deck Definitions
218
- *
219
- * Describes the structure of deck.json fixtures for each genre.
220
- */
221
- /**
222
- * Base card interface - shared properties across all card types
223
- */
224
- export interface BaseDeckCard {
225
- id: string;
226
- theme?: string;
227
- title?: string;
228
- description?: string;
229
- emoji?: string;
230
- [key: string]: unknown;
231
- }
232
- /**
233
- * Story Arc card - used for narrative trajectory
234
- */
235
- export interface StoryArcCard extends BaseDeckCard {
236
- narrative_hooks?: string[];
237
- /**
238
- * Arc pattern representing emotional trajectory
239
- * 11 values (0-100) at 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100% progress
240
- * 0 = darkest/worst, 100 = brightest/best
241
- * Based on Kurt Vonnegut's story shapes
242
- */
243
- arc_pattern?: number[];
244
- /**
245
- * Tone pattern representing emotional tone trajectory throughout the story
246
- * 11 tone values in compact notation at 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100% progress
247
- * Each tone is in format "HHH:SSS:LLL" (hue:saturation:lightness)
248
- * Interpolated between values to get tone at any progression point
249
- */
250
- tone_pattern?: string[];
251
- }
252
- /**
253
- * Narrative Style card - used for writing style and voice
254
- */
255
- export interface NarrativeStyleCard extends BaseDeckCard {
256
- representative_authors?: string[];
257
- technical_guide?: string;
258
- example?: string;
259
- }
260
- export interface DeckDefinition {
261
- deckId: string;
262
- name?: string;
263
- description?: string;
264
- version?: string;
265
- genre?: string;
266
- cards: BaseDeckCard[];
267
- draw_rules?: Record<string, unknown>;
268
- [key: string]: unknown;
269
- }
270
- /**
271
- * Multi-deck format - contains multiple named decks
272
- * Example: { story_arc: {...}, mood: {...}, etc. }
273
- */
274
- export interface MultiDeckDefinition {
275
- story_arc: DeckDefinition;
276
- [deckName: string]: DeckDefinition;
277
- }
278
- export interface FixtureSet {
279
- state: GameState;
280
- deck: DeckDefinition;
281
- }
282
- export interface EventPropagation {
283
- to: string;
284
- effect: Record<string, unknown>;
285
- decay?: number;
286
- }
287
- export interface BaseEvent extends WorldEntity {
288
- id: string;
289
- name?: string;
290
- description?: string;
291
- location?: string;
292
- conditions?: Record<string, unknown>;
293
- effects?: Record<string, unknown>;
294
- propagation?: EventPropagation[];
295
- cooldown?: number;
296
- cooldown_remaining?: number;
297
- }
298
- export interface DeterministicEvent extends BaseEvent {
299
- }
300
- export interface ScheduledEvent extends BaseEvent {
301
- timestamp: string;
302
- interrupts?: boolean;
303
- severity?: string;
304
- }
305
- export interface ProbabilisticEvent extends BaseEvent {
306
- base_probability: number;
307
- current_probability: number;
308
- modifiers?: Record<string, unknown>;
309
- last_triggered_turn?: number;
310
- }
311
- export interface EventHistoryEntry {
312
- event_id: string;
313
- type: 'deterministic' | 'scheduled' | 'probabilistic';
314
- turn: number;
315
- timestamp?: string;
316
- outcome?: string;
317
- }
318
- export interface WorldEvents {
319
- deterministic: DeterministicEvent[];
320
- scheduled: ScheduledEvent[];
321
- probabilistic: ProbabilisticEvent[];
322
- history: EventHistoryEntry[];
323
- }
324
168
  export interface World extends WorldReduced {
325
169
  events: WorldEvents;
326
170
  }
@@ -1,5 +1,2 @@
1
1
  "use strict";
2
- // ============================================================================
3
- // AI METADATA TRACKING
4
- // ============================================================================
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
package/dist/index.d.ts CHANGED
@@ -1,4 +1,8 @@
1
1
  export type { ApiError, ApiErrorResponse } from './errors';
2
2
  export type { DoneEventPayload, ErrorEventPayload, MetadataEventPayload, NarrativeChunkEventPayload, NarrativeCompleteEventPayload, NarrativeMetadataEventPayload, NarrativeSSEEventPayload, NarrativeStartEventPayload } from './sse/narrative';
3
- export type { AIMetadata, AIOperationTokens, BaseDeckCard, BaseImmutableState, DeckDefinition, DialogContext, DialogMessage, FixtureSet, GameState, GameStateReduced, GenreImmutableState, HistoryEntry, ImmutableState, Location, Metadata, MultiDeckDefinition, NarrativeStyleCard, NPC, Player, PresentationCache, Session, StoryArc, StoryArcCard, Tag, TimeState, WorldEntity, WorldReduced, EventPropagation, BaseEvent, DeterministicEvent, ScheduledEvent, ProbabilisticEvent, EventHistoryEntry, WorldEvents, World, StateSnapshot, PromptVariables, GameMetadata, AIOperationType, NpcExistingOrNewOp, PresentationChoiceMeta } from './game-state';
3
+ export type { AIMetadata, AIOperationTokens, AIOperationType } from './ai';
4
+ export type { BaseDeckCard, DeckDefinition, FixtureSet, MultiDeckDefinition, NarrativeStyleCard, StoryArc, StoryArcCard } from './deck';
5
+ export type { BaseEvent, DeterministicEvent, EventHistoryEntry, EventPropagation, ProbabilisticEvent, ScheduledEvent, WorldEvents } from './events';
6
+ export type { BaseImmutableState, DialogContext, DialogMessage, GameMetadata, GameState, GameStateReduced, GenreImmutableState, HistoryEntry, ImmutableState, Location, Metadata, NPC, NpcExistingOrNewOp, Player, PresentationCache, PresentationChoiceMeta, PromptVariables, Session, StateSnapshot, Tag, TimeState, World, WorldEntity, WorldReduced } from './game-state';
4
7
  export type { AIPreferences, ModelEntry, ModelStack, ModelStackPreferences, ModelStackPreset, NarrativeFontPreferences, SoundPreferences, SystemModelPresets, UserMetadata, UserPreferences } from './user-preferences';
8
+ export type { CreatePresetRequest, CreatePresetResponse, DeletePresetResponse, ListPresetsResponse, PaginatedPresetsResponse, PaginationMetadata, PresetIndex, PresetMetadata, UpdatePresetRequest, UpdatePresetResponse } from './preset';
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Preset Types
3
+ *
4
+ * Presets are portable game state snapshots that can be cloned
5
+ * to create new games with identical initial conditions.
6
+ */
7
+ /**
8
+ * Lightweight metadata for a single preset (stored in index.json)
9
+ */
10
+ export interface PresetMetadata {
11
+ /** Unique identifier for this preset */
12
+ presetId: string;
13
+ /** Display name for the preset */
14
+ name: string;
15
+ /** Brief description of the opening scene */
16
+ description: string;
17
+ /** Original Act 1 gameId this preset was created from (for reference/debugging) */
18
+ sourceGameId: string;
19
+ /** ISO 8601 timestamp when preset was created */
20
+ createdAt: string;
21
+ }
22
+ /**
23
+ * Index file structure for genre presets
24
+ * Stored at: fixtures/genres/{genreId}/presets/index.json
25
+ */
26
+ export interface PresetIndex {
27
+ /** Schema version for future evolution */
28
+ version: number;
29
+ /** Array of preset metadata entries */
30
+ presets: PresetMetadata[];
31
+ }
32
+ /**
33
+ * Response from GET /genres/{genreId}/presets (non-paginated, deprecated)
34
+ */
35
+ export interface ListPresetsResponse {
36
+ /** Genre identifier */
37
+ genreId: string;
38
+ /** Array of available presets */
39
+ presets: PresetMetadata[];
40
+ }
41
+ /**
42
+ * Pagination metadata for list responses
43
+ */
44
+ export interface PaginationMetadata {
45
+ /** Total number of items across all pages */
46
+ total: number;
47
+ /** Number of items per page */
48
+ limit: number;
49
+ /** Current offset (number of items skipped) */
50
+ offset: number;
51
+ /** Whether there are more items after this page */
52
+ hasMore: boolean;
53
+ }
54
+ /**
55
+ * Paginated response from GET /genres/{genreId}/presets
56
+ */
57
+ export interface PaginatedPresetsResponse {
58
+ /** Genre identifier */
59
+ genreId: string;
60
+ /** Array of presets for this page */
61
+ presets: PresetMetadata[];
62
+ /** Pagination metadata */
63
+ pagination: PaginationMetadata;
64
+ }
65
+ /**
66
+ * Request body for POST /genres/{genreId}/presets
67
+ */
68
+ export interface CreatePresetRequest {
69
+ /** Game ID to create preset from (can be any act - will resolve to Act 1 Turn 0) */
70
+ sourceGameId: string;
71
+ /** Display name for the new preset */
72
+ name: string;
73
+ /** Brief description of the opening scene */
74
+ description: string;
75
+ }
76
+ /**
77
+ * Response from POST /genres/{genreId}/presets
78
+ */
79
+ export interface CreatePresetResponse extends PresetMetadata {
80
+ /** Genre this preset belongs to */
81
+ genreId: string;
82
+ }
83
+ /**
84
+ * Request body for PUT /genres/{genreId}/presets/{presetId}
85
+ */
86
+ export interface UpdatePresetRequest {
87
+ /** Updated display name for the preset */
88
+ name: string;
89
+ /** Updated description of the opening scene */
90
+ description: string;
91
+ }
92
+ /**
93
+ * Response from PUT /genres/{genreId}/presets/{presetId}
94
+ */
95
+ export interface UpdatePresetResponse extends PresetMetadata {
96
+ /** Genre this preset belongs to */
97
+ genreId: string;
98
+ }
99
+ /**
100
+ * Response from DELETE /genres/{genreId}/presets/{presetId}
101
+ */
102
+ export interface DeletePresetResponse {
103
+ /** ID of the deleted preset */
104
+ presetId: string;
105
+ /** Genre the preset was deleted from */
106
+ genreId: string;
107
+ /** Confirmation message */
108
+ message: string;
109
+ }
package/dist/preset.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ /**
3
+ * Preset Types
4
+ *
5
+ * Presets are portable game state snapshots that can be cloned
6
+ * to create new games with identical initial conditions.
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.50",
3
+ "version": "1.0.51",
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",