zeus-api-types 1.0.66 → 1.0.69

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.
@@ -60,11 +60,24 @@ export interface WorldReduced {
60
60
  * Core game state interfaces shared between middle-layer and frontend.
61
61
  */
62
62
  export interface TimeState {
63
- current: string;
63
+ /** @deprecated Do not write this field. Use computeTimeString(time) to derive it. */
64
+ current?: string;
64
65
  day: number;
65
66
  hour: number;
66
67
  minute: number;
67
68
  }
69
+ /**
70
+ * Derives the canonical time string from scalar time fields.
71
+ * Use this everywhere instead of reading time.current, which may be stale.
72
+ * @example computeTimeString({ day: 1, hour: 10, minute: 38 }) === 'day_1_10:38'
73
+ */
74
+ export declare function computeTimeString(time: Pick<TimeState, 'day' | 'hour' | 'minute'>): string;
75
+ /**
76
+ * Formats time into a human-readable string for AI prompt ingestion.
77
+ * @example formatTimeHuman({ day: 1, hour: 15, minute: 11 }) === 'Day 1, 3:11pm'
78
+ * @example formatTimeHuman({ day: 3, hour: 0, minute: 5 }) === 'Day 3, 12:05am'
79
+ */
80
+ export declare function formatTimeHuman(time: Pick<TimeState, 'day' | 'hour' | 'minute'>): string;
68
81
  /**
69
82
  * Base interface for world entities (NPCs, Locations, etc.)
70
83
  * All world entities share this common structure
@@ -206,7 +219,7 @@ export interface GameState {
206
219
  }
207
220
  export interface GameStateReduced {
208
221
  currentTurn: number;
209
- time: TimeState;
222
+ time: string;
210
223
  location: string;
211
224
  player: Player;
212
225
  world: WorldReduced;
@@ -1,2 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.computeTimeString = computeTimeString;
4
+ exports.formatTimeHuman = formatTimeHuman;
5
+ /**
6
+ * Derives the canonical time string from scalar time fields.
7
+ * Use this everywhere instead of reading time.current, which may be stale.
8
+ * @example computeTimeString({ day: 1, hour: 10, minute: 38 }) === 'day_1_10:38'
9
+ */
10
+ function computeTimeString(time) {
11
+ return `day_${time.day}_${time.hour.toString().padStart(2, '0')}:${time.minute.toString().padStart(2, '0')}`;
12
+ }
13
+ /**
14
+ * Formats time into a human-readable string for AI prompt ingestion.
15
+ * @example formatTimeHuman({ day: 1, hour: 15, minute: 11 }) === 'Day 1, 3:11pm'
16
+ * @example formatTimeHuman({ day: 3, hour: 0, minute: 5 }) === 'Day 3, 12:05am'
17
+ */
18
+ function formatTimeHuman(time) {
19
+ const h = time.hour;
20
+ const period = h < 12 ? 'am' : 'pm';
21
+ const hour12 = h % 12 === 0 ? 12 : h % 12;
22
+ const minute = time.minute.toString().padStart(2, '0');
23
+ return `Day ${time.day}, ${hour12}:${minute}${period}`;
24
+ }
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export type { DoneEventPayload, ErrorEventPayload, MetadataEventPayload, Narrati
3
3
  export type { AIMetadata, AIOperationTokens, AIOperationType } from './ai';
4
4
  export type { BaseDeckCard, DeckDefinition, FixtureSet, MultiDeckDefinition, NarrativeStyleCard, StoryArc, StoryArcCard } from './deck';
5
5
  export type { BaseEvent, DeterministicEvent, EventHistoryEntry, EventPropagation, ProbabilisticEvent, ScheduledEvent, WorldEvents } from './events';
6
+ export { computeTimeString, formatTimeHuman } from './game-state';
6
7
  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';
7
8
  export type { AIPreferences, ModelEntry, ModelStack, ModelStackPreferences, ModelStackPreset, NarrativeFontPreferences, SoundPreferences, SystemModelPresets, UserMetadata, UserPreferences } from './user-preferences';
8
9
  export type { CreatePresetRequest, CreatePresetResponse, DeletePresetResponse, ListPresetsResponse, PaginatedPresetsResponse, PaginationMetadata, PresetIndex, PresetMetadata, UpdatePresetRequest, UpdatePresetResponse } from './preset';
package/dist/index.js CHANGED
@@ -1,2 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatTimeHuman = exports.computeTimeString = void 0;
4
+ // Game State Utilities (value exports — not type-only)
5
+ var game_state_1 = require("./game-state");
6
+ Object.defineProperty(exports, "computeTimeString", { enumerable: true, get: function () { return game_state_1.computeTimeString; } });
7
+ Object.defineProperty(exports, "formatTimeHuman", { enumerable: true, get: function () { return game_state_1.formatTimeHuman; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zeus-api-types",
3
- "version": "1.0.66",
3
+ "version": "1.0.69",
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",