@agent-play/sdk 3.3.8 → 3.4.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.
@@ -0,0 +1,2237 @@
1
+ import { z } from 'zod';
2
+
3
+ type GameId = "hidden-gems" | "map-recall" | "price-check" | "signal-hunt" | "delivery-dash" | "lease-locker" | "talk-timer" | "daily-rotator";
4
+ type GameCabinetEntry = {
5
+ readonly id: string;
6
+ readonly gameId: GameId;
7
+ readonly name: string;
8
+ };
9
+ declare const GAME_CABINET_CATALOG: readonly GameCabinetEntry[];
10
+ declare const PLAYABLE_GAME_IDS: readonly GameId[];
11
+ declare const getGameCabinetById: (id: string) => GameCabinetEntry | undefined;
12
+ declare const getGameCabinetByGameId: (gameId: GameId) => GameCabinetEntry | undefined;
13
+ declare const featuredGameIdForUtcDate: (date: Date) => GameId;
14
+ declare const isGameId: (value: string) => value is GameId;
15
+
16
+ /**
17
+ * Domain types for sessions, journeys, agents, and the shared world map exposed by the SDK and server.
18
+ */
19
+ /** Role for a single line in the interaction log / chat stream. */
20
+ type WorldInteractionRole = "user" | "assistant" | "tool";
21
+ /**
22
+ * Payload for {@link RemotePlayWorld.recordInteraction}.
23
+ *
24
+ * @property playerId - Player id returned from `addAgent` / `addPlayer`.
25
+ * @property role - Who "spoke" the line.
26
+ * @property text - Plain text; may be truncated for display server-side.
27
+ */
28
+ type RecordInteractionInput = {
29
+ playerId: string;
30
+ role: WorldInteractionRole;
31
+ text: string;
32
+ };
33
+ /** How the watch UI should render and coerce a single assist tool argument. */
34
+ type AssistToolFieldType = "string" | "number" | "boolean";
35
+ /**
36
+ * Per-parameter metadata for assist tools. Legacy snapshots may omit `fieldType`; the UI treats that as `"string"`.
37
+ */
38
+ type AssistToolParameterSpec = {
39
+ fieldType: AssistToolFieldType;
40
+ field?: string;
41
+ };
42
+ /**
43
+ * Metadata for a tool whose name starts with `assist_`, shown as assist actions on the watch UI.
44
+ *
45
+ * @property parameters - Derived from Zod object `schema` when present: each key maps to
46
+ * {@link AssistToolParameterSpec} with `fieldType` from schema introspection. May include `_note` when no schema shape exists.
47
+ */
48
+ type AssistToolSpec = {
49
+ name: string;
50
+ description: string;
51
+ parameters: Record<string, unknown>;
52
+ };
53
+ /**
54
+ * Serializable shape returned by {@link langchainRegistration} for agent registration.
55
+ *
56
+ * @property type - Always `"langchain"` for this adapter.
57
+ * @property toolNames - All tool names from the agent (must include `chat_tool`). Used for assist/chat UI only; **does not** spawn map structures (see world map v3).
58
+ * @property assistTools - Subset of tools with `assist_` prefix, for UI buttons.
59
+ */
60
+ type LangChainAgentRegistration = {
61
+ type: "langchain";
62
+ toolNames: string[];
63
+ assistTools?: AssistToolSpec[];
64
+ };
65
+ /** Minimal player identity in the SDK (without preview URL). */
66
+ type PlayAgentInformation = {
67
+ id: string;
68
+ name: string;
69
+ sid: string;
70
+ createdAt: Date;
71
+ updatedAt: Date;
72
+ };
73
+ /** Input fields for {@link AddAgentInput} / {@link AddPlayerInput} before `agent` is attached. */
74
+ type PlatformAgentInformation = {
75
+ name: string;
76
+ type: string;
77
+ version?: string;
78
+ createdAt?: Date;
79
+ updatedAt?: Date;
80
+ };
81
+ /**
82
+ * Register an automation agent in the world, tied to **agent node identity**.
83
+ *
84
+ * Use **`langchainRegistration(agent)`** for `agent` (requires a **`chat_tool`** tool; `assist_*`
85
+ * tools are indexed for the watch UI).
86
+ *
87
+ * **`nodeId`** is the **agent node id** (from **`agent-play create`** when the server uses a repository).
88
+ * It is sent on the wire as `agentId` for server compatibility; treating it as a node id makes the
89
+ * contract explicit for billing, validation, and event attribution.
90
+ */
91
+ type P2aEnableFlag = "on" | "off";
92
+ type RealtimeWebrtcClientSecret = {
93
+ clientSecret: string;
94
+ expiresAt?: string;
95
+ model: string;
96
+ voice?: string;
97
+ };
98
+ /** OpenAI Realtime minting options used by {@link RemotePlayWorld.initAudio}. */
99
+ type RemotePlayWorldOpenAiAudioOptions = {
100
+ /** Server-side OpenAI key used to mint ephemeral browser client secrets. */
101
+ apiKey?: string;
102
+ /** Realtime model id, defaults to `gpt-realtime`. */
103
+ model?: string;
104
+ /** Realtime voice id, defaults to `marin`. */
105
+ voice?: string;
106
+ /** Explicit system instructions for the realtime session. */
107
+ instructions?: string;
108
+ /** Template fallback for instructions; `{{agentName}}` placeholder is supported. */
109
+ instructionsTemplate?: string;
110
+ };
111
+ /** Configuration payload for enabling SDK-managed realtime audio initialization. */
112
+ type RemotePlayWorldInitAudioOptions = {
113
+ openai: RemotePlayWorldOpenAiAudioOptions;
114
+ };
115
+ type AddAgentInput = PlatformAgentInformation & {
116
+ /** Registration from {@link langchainRegistration}. */
117
+ agent: LangChainAgentRegistration;
118
+ /** Main node id that owns the agent (required on repository-backed servers). */
119
+ mainNodeId?: string;
120
+ /** Agent node id — same value the server stores as registered `agentId`. */
121
+ nodeId: string;
122
+ /**
123
+ * Human passphrase for this agent node (from **`agent-play create-agent-node`** or
124
+ * **`AGENT_PLAY_AGENT_NODE_ID_*_*_PASSW`**). When omitted, the main node passphrase from
125
+ * {@link RemotePlayWorld} construction is used (local dev only).
126
+ */
127
+ agentPassphrase?: string;
128
+ /**
129
+ * When **`"on"`**, registration enables OpenAI Realtime provisioning for this agent.
130
+ * Omitted or **`"off"`** disables realtime voice for this registration.
131
+ */
132
+ enableP2a?: P2aEnableFlag;
133
+ /**
134
+ * Per-agent instructions for OpenAI Realtime when **`enableP2a`** is **`"on"`** (e.g. from
135
+ * **`personality.txt`**). Ignored when **`initAudio`** was given explicit **`openai.instructions`**,
136
+ * which still wins as a global override.
137
+ */
138
+ realtimeInstructions?: string;
139
+ };
140
+ /**
141
+ * Register a player (agent) in the world.
142
+ *
143
+ * @deprecated Prefer {@link AddAgentInput} and `RemotePlayWorld.prototype.addAgent` for SDK and automation; use `nodeId` there instead of `agentId`.
144
+ *
145
+ * Use **`langchainRegistration(agent)`** for `agent` (requires a **`chat_tool`** tool; `assist_*`
146
+ * tools are indexed for the watch UI).
147
+ *
148
+ * **`agentId`** is required: use an id from **`agent-play create`** when the server uses a repository
149
+ * (with account **`passwHash`** from **`RemotePlayWorld`**), or any stable string for local dev without Redis.
150
+ */
151
+ type AddPlayerInput = PlatformAgentInformation & {
152
+ /** Registration from {@link langchainRegistration}. */
153
+ agent: LangChainAgentRegistration;
154
+ /** Main node id that owns the agent (required on repository-backed servers). */
155
+ mainNodeId?: string;
156
+ /** Registered agent id (or session-local id without Redis). */
157
+ agentId: string;
158
+ /**
159
+ * When **`"on"`**, registration enables OpenAI Realtime provisioning for this agent.
160
+ * Omitted or **`"off"`** disables realtime voice for this registration.
161
+ *
162
+ * Same semantics as {@link AddAgentInput} **`enableP2a`**.
163
+ */
164
+ enableP2a?: P2aEnableFlag;
165
+ /**
166
+ * Same semantics as {@link AddAgentInput} **`realtimeInstructions`**.
167
+ */
168
+ realtimeInstructions?: string;
169
+ };
170
+ /** Zone counter event surfaced on snapshots and signals. */
171
+ type ZoneEventInfo = {
172
+ zoneCount: number;
173
+ flagged?: boolean;
174
+ at: string;
175
+ };
176
+ /** Yield counter event surfaced on snapshots and signals. */
177
+ type YieldEventInfo = {
178
+ yieldCount: number;
179
+ at: string;
180
+ };
181
+ /** Repository-backed summary returned with `addAgent` when the agent is (or maps to) a stored registration. */
182
+ type RegisteredAgentSummary = {
183
+ agentId: string;
184
+ name: string;
185
+ toolNames: string[];
186
+ zoneCount: number;
187
+ yieldCount: number;
188
+ flagged: boolean;
189
+ };
190
+ /** Result of `addAgent` / `addPlayer` including watch URL and registered-agent metadata from the server. */
191
+ type RegisteredPlayer = PlayAgentInformation & {
192
+ previewUrl: string;
193
+ registeredAgent: RegisteredAgentSummary;
194
+ /** Echo of registration-time P2A flag (defaults to **`"off"`**). */
195
+ enableP2a: P2aEnableFlag;
196
+ /** Optional OpenAI Realtime WebRTC client-secret payload for browser-side direct voice. */
197
+ realtimeWebrtc?: RealtimeWebrtcClientSecret;
198
+ connectionId?: string;
199
+ leaseTtlSeconds?: number;
200
+ };
201
+ /** First step of a journey: user message origin. */
202
+ type OriginJourneyStep = {
203
+ type: "origin";
204
+ content: string;
205
+ messageId: string;
206
+ };
207
+ /** Middle step: tool invocation on the map. */
208
+ type StructureJourneyStep = {
209
+ type: "structure";
210
+ toolName: string;
211
+ toolCallId: string;
212
+ args: Record<string, unknown>;
213
+ result?: string;
214
+ };
215
+ /** Final step: assistant reply. */
216
+ type DestinationJourneyStep = {
217
+ type: "destination";
218
+ content: string;
219
+ messageId: string;
220
+ };
221
+ /** Union of journey step shapes. */
222
+ type JourneyStep = OriginJourneyStep | StructureJourneyStep | DestinationJourneyStep;
223
+ /**
224
+ * Ordered journey with timestamps; sent to the server via `recordJourney`.
225
+ *
226
+ * @property steps - Ordered path from origin through tool steps to destination.
227
+ * @property startedAt, completedAt - Wall times for the run (client or server).
228
+ */
229
+ type Journey = {
230
+ steps: JourneyStep[];
231
+ startedAt: Date;
232
+ completedAt: Date;
233
+ };
234
+ /** Journey step after server assigns coordinates (and optional structure id). */
235
+ type PositionedStep = JourneyStep & {
236
+ x?: number;
237
+ y?: number;
238
+ structureId?: string;
239
+ };
240
+ type AgentPlayWorldMapBounds = {
241
+ minX: number;
242
+ minY: number;
243
+ maxX: number;
244
+ maxY: number;
245
+ };
246
+ /**
247
+ * One agent on the world map. Prefer `streetId` with layout-driven placement; `x`/`y` are optional on wire before normalization and act as a denormalized cache after materialize.
248
+ */
249
+ type AgentPlayWorldMapAgentOccupant = {
250
+ kind: "agent";
251
+ nodeId?: string;
252
+ agentId: string;
253
+ name: string;
254
+ streetId?: string;
255
+ x?: number;
256
+ y?: number;
257
+ /**
258
+ * Integration label from addPlayer `type` (e.g. `langchain`). Populated from the snapshot field `platform`. The legacy wire field `agentType` is deprecated and accepted only for backward compatibility when parsing JSON.
259
+ */
260
+ platform?: string;
261
+ toolNames?: string[];
262
+ assistToolNames?: string[];
263
+ assistTools?: AssistToolSpec[];
264
+ hasChatTool?: boolean;
265
+ enableP2a?: P2aEnableFlag;
266
+ realtimeInstructions?: string;
267
+ realtimeWebrtc?: RealtimeWebrtcClientSecret;
268
+ stationary?: boolean;
269
+ lastUpdate?: unknown;
270
+ recentInteractions?: Array<{
271
+ role: WorldInteractionRole;
272
+ text: string;
273
+ at: string;
274
+ seq: number;
275
+ }>;
276
+ zoneCount?: number;
277
+ yieldCount?: number;
278
+ flagged?: boolean;
279
+ onZone?: ZoneEventInfo;
280
+ onYield?: YieldEventInfo;
281
+ };
282
+ /** MCP server shown as a separate map occupant (distinct from LangChain agents). */
283
+ type AgentPlayWorldMapHumanOccupant = {
284
+ kind: "human";
285
+ id: string;
286
+ name: string;
287
+ x: number;
288
+ y: number;
289
+ interactive?: boolean;
290
+ };
291
+ /** MCP server shown as a separate map occupant (distinct from LangChain agents). */
292
+ type AgentPlayWorldMapMcpOccupant = {
293
+ kind: "mcp";
294
+ id: string;
295
+ name: string;
296
+ x: number;
297
+ y: number;
298
+ url?: string;
299
+ };
300
+ type AgentPlaySpaceAmenityKind = "supermarket" | "shop" | "car_wash";
301
+ type AgentPlaySpaceOwner = {
302
+ displayName: string;
303
+ playerId?: string;
304
+ nodeId?: string;
305
+ };
306
+ type AgentPlaySpaceCatalogEntry = {
307
+ id: string;
308
+ name: string;
309
+ description: string;
310
+ designKey: string;
311
+ owner: AgentPlaySpaceOwner;
312
+ amenities: AgentPlaySpaceAmenityKind[];
313
+ activityObjectIds?: string[];
314
+ };
315
+
316
+ /** Map anchor linking one or more authored spaces or an arcade game cabinet. */
317
+ type AgentPlayWorldMapStructureOccupant = {
318
+ kind: "structure";
319
+ id: string;
320
+ name: string;
321
+ x: number;
322
+ y: number;
323
+ worldId: string;
324
+ spaceIds: string[];
325
+ /** When set, this structure is an arcade cabinet door on Maple Ave. */
326
+ gameId?: GameId;
327
+ /** When true, the anchor is fixed map furniture (e.g. authored spaces). */
328
+ stationary?: boolean;
329
+ primaryAmenity?: AgentPlaySpaceAmenityKind;
330
+ amenities?: AgentPlaySpaceAmenityKind[];
331
+ };
332
+ /** Spatial index: axis-aligned bounds plus every agent and MCP registration placed on the grid. */
333
+ type AgentPlayWorldMap = {
334
+ bounds: AgentPlayWorldMapBounds;
335
+ occupants: (AgentPlayWorldMapHumanOccupant | AgentPlayWorldMapAgentOccupant | AgentPlayWorldMapMcpOccupant | AgentPlayWorldMapStructureOccupant)[];
336
+ };
337
+ /** Wire shape for seeded world zones (matches server snapshot `worldLayout`). */
338
+ type AgentPlayWorldLayoutZone = {
339
+ id: string;
340
+ streetId: string;
341
+ streetLabel: string;
342
+ rect: AgentPlayWorldMapBounds;
343
+ primaryGroup: "agent" | "space" | "arcade";
344
+ allowedGroups: readonly ("agent" | "space" | "arcade")[];
345
+ };
346
+ type AgentPlayWorldLayout = {
347
+ rev: number;
348
+ bounds: AgentPlayWorldMapBounds;
349
+ zones: AgentPlayWorldLayoutZone[];
350
+ streets: readonly {
351
+ id: string;
352
+ label: string;
353
+ }[];
354
+ };
355
+ /**
356
+ * Session snapshot from {@link RemotePlayWorld.getWorldSnapshot}.
357
+ * Agents and MCP servers appear only under **`worldMap.occupants`** (no separate `players` list).
358
+ */
359
+ type AgentPlaySnapshot = {
360
+ sid: string;
361
+ worldMap: AgentPlayWorldMap;
362
+ worldLayout?: AgentPlayWorldLayout;
363
+ spaces?: AgentPlaySpaceCatalogEntry[];
364
+ mcpServers?: Array<{
365
+ id: string;
366
+ name: string;
367
+ url?: string;
368
+ }>;
369
+ };
370
+ type PlayerChainNotifyNodeRef = {
371
+ stableKey: string;
372
+ leafIndex: number;
373
+ removed?: boolean;
374
+ updatedAt?: string;
375
+ };
376
+ type PlayerChainFanoutNotify = {
377
+ updatedAt: string;
378
+ nodes: PlayerChainNotifyNodeRef[];
379
+ };
380
+ type PlayerChainGenesisStableKey = "__genesis__";
381
+ type PlayerChainHeaderStableKey = "__header__";
382
+ type PlayerChainGenesisNode = {
383
+ kind: "genesis";
384
+ stableKey: PlayerChainGenesisStableKey;
385
+ text: string;
386
+ };
387
+ type PlayerChainHeaderNode = {
388
+ kind: "header";
389
+ stableKey: PlayerChainHeaderStableKey;
390
+ sid: string;
391
+ bounds: AgentPlayWorldMapBounds;
392
+ };
393
+ type PlayerChainOccupantRemovedNode = {
394
+ kind: "occupant";
395
+ stableKey: string;
396
+ removed: true;
397
+ };
398
+ type PlayerChainOccupantPresentNode = {
399
+ kind: "occupant";
400
+ stableKey: string;
401
+ removed: false;
402
+ occupant: AgentPlayWorldMapHumanOccupant | AgentPlayWorldMapAgentOccupant | AgentPlayWorldMapMcpOccupant | AgentPlayWorldMapStructureOccupant;
403
+ };
404
+ type PlayerChainSpaceRemovedNode = {
405
+ kind: "space";
406
+ stableKey: string;
407
+ removed: true;
408
+ };
409
+ type PlayerChainSpacePresentNode = {
410
+ kind: "space";
411
+ stableKey: string;
412
+ removed: false;
413
+ space: AgentPlaySpaceCatalogEntry;
414
+ };
415
+ type PlayerChainNodeResponse = PlayerChainGenesisNode | PlayerChainHeaderNode | PlayerChainOccupantRemovedNode | PlayerChainOccupantPresentNode | PlayerChainSpaceRemovedNode | PlayerChainSpacePresentNode;
416
+ /** Full journey + path update (SSE `world:journey`); coordinates are embedded in `path` steps. */
417
+ type WorldJourneyUpdate = {
418
+ playerId: string;
419
+ journey: Journey;
420
+ path: PositionedStep[];
421
+ };
422
+
423
+ /**
424
+ * Axis-aligned rectangle in world coordinates (grid units). Used by the server to clamp paths
425
+ * and by the watch UI to clamp joystick-driven movement.
426
+ *
427
+ * @remarks **Consumers:** {@link clampWorldPosition}, {@link boundsContain}; server `PlayWorld` and
428
+ * play-ui canvas both import these helpers from `@agent-play/sdk`.
429
+ */
430
+ type WorldBounds = {
431
+ /** Inclusive minimum X. */
432
+ minX: number;
433
+ /** Inclusive minimum Y. */
434
+ minY: number;
435
+ /** Inclusive maximum X. */
436
+ maxX: number;
437
+ /** Inclusive maximum Y. */
438
+ maxY: number;
439
+ };
440
+ /** Minimum playable span aligned with the watch canvas scrolling world (~20×20 cells). */
441
+ declare const MINIMUM_PLAY_WORLD_BOUNDS: WorldBounds;
442
+ /**
443
+ * Default bounds for {@link createVerticalStripSeedLayout} (street / zone map).
444
+ * Shorter on Y than {@link MINIMUM_PLAY_WORLD_BOUNDS}: three vertical strips across span X = 20, height 3.
445
+ */
446
+ declare const MINIMUM_STREET_LAYOUT_BOUNDS: WorldBounds;
447
+ declare function expandBoundsToMinimumPlayArea(bounds: WorldBounds): WorldBounds;
448
+ /**
449
+ * Clamps a point to lie inside `bounds` along both axes.
450
+ *
451
+ * @param p - Position with `x` and `y` in world units.
452
+ * @param bounds - Valid rectangle (`min` ≤ `max` per axis).
453
+ * @returns Same point if inside, otherwise clamped to the nearest edge.
454
+ *
455
+ * @remarks **Callers:** server `PlayWorld` path enrichment; play-ui joystick and preview. **Callees:** `Math.min/Math.max`.
456
+ */
457
+ declare function clampWorldPosition(p: {
458
+ x: number;
459
+ y: number;
460
+ }, bounds: WorldBounds): {
461
+ x: number;
462
+ y: number;
463
+ };
464
+ /**
465
+ * @returns Whether `p` lies inside or on the border of `bounds`.
466
+ *
467
+ * @remarks **Callers:** optional UI checks. **Callees:** none.
468
+ */
469
+ declare function boundsContain(bounds: WorldBounds, p: {
470
+ x: number;
471
+ y: number;
472
+ }): boolean;
473
+
474
+ type OccupancyGridPoint = {
475
+ x: number;
476
+ y: number;
477
+ };
478
+ declare const OCCUPANCY_POINT_MULTIPLIER = 5;
479
+ declare const CONTINUOUS_RENDER_OFFSET = 0.2;
480
+ declare const DEFAULT_AGENT_SPAWN_MIN_DISTANCE = 0.9;
481
+ declare const SPACE_STRUCTURE_ANCHOR_MIN_DISTANCE = 2.1;
482
+ /** @deprecated Prefer {@link WorldLayout} zones from snapshot; quartile geometry is legacy. */
483
+ declare const SPATIAL_ZONE_INDEX_AGENTS = 0;
484
+ /** @deprecated Prefer {@link WorldLayout} zones from snapshot; quartile geometry is legacy. */
485
+ declare const SPATIAL_ZONE_INDEX_SPACES = 2;
486
+ /** @deprecated Prefer layout zone rects; quartile geometry is legacy. */
487
+ declare function spatialZoneBounds(quartileIndex: number): WorldBounds;
488
+ /** @deprecated Prefer {@link centerOfZone} with a layout zone. */
489
+ declare function spatialZoneCenter(quartileIndex: number): OccupancyGridPoint;
490
+ declare function pointCellInRect(wx: number, wy: number, bounds: WorldBounds): boolean;
491
+ declare function listOccupancyPointsInRect(bounds: WorldBounds): readonly OccupancyGridPoint[];
492
+ declare function buildRankedOccupancyPointsInRect(bounds: WorldBounds): OccupancyGridPoint[];
493
+ /** @deprecated Prefer {@link pointCellInZone} with a layout zone. */
494
+ declare function pointCellInSpatialZone(wx: number, wy: number, zoneIndex: number): boolean;
495
+ /** @deprecated Prefer {@link listOccupancyPointsForZone}. */
496
+ declare function listOccupancyPointsForSpatialZone(zoneIndex: number): readonly OccupancyGridPoint[];
497
+ /** @deprecated Prefer {@link occupancyPointsGroupedByZones}. */
498
+ declare function occupancyPointsGroupedBySpatialZone(): readonly (readonly OccupancyGridPoint[])[];
499
+ /** @deprecated Prefer points from the agent primary zone in {@link WorldLayout}. */
500
+ declare function listAllowedOccupancyPoints(): readonly OccupancyGridPoint[];
501
+ declare function occupancyKeyForPosition(x: number, y: number): string;
502
+ /** @deprecated Prefer {@link buildRankedOccupancyPointsForZone}. */
503
+ declare function buildRankedOccupancyPointsForSpatialZone(zoneIndex: number): OccupancyGridPoint[];
504
+ /** Back-compat: agent-zone ranking only. */
505
+ declare function buildRankedOccupancyPoints(): OccupancyGridPoint[];
506
+ declare function boundingWorldRectForOccupancyPoints(points: readonly OccupancyGridPoint[]): {
507
+ minX: number;
508
+ maxX: number;
509
+ minY: number;
510
+ maxY: number;
511
+ } | null;
512
+ declare function isAgentSpawnOccupancyPointAvailableInRect(input: {
513
+ rect: WorldBounds;
514
+ point: OccupancyGridPoint;
515
+ occupiedKeys: ReadonlySet<string>;
516
+ existingOccupants: ReadonlyArray<{
517
+ x: number;
518
+ y: number;
519
+ }>;
520
+ minDistance?: number;
521
+ }): boolean;
522
+ declare function isSpaceAnchorOccupancyPointAvailableInRect(input: {
523
+ rect: WorldBounds;
524
+ point: OccupancyGridPoint;
525
+ occupiedKeys: ReadonlySet<string>;
526
+ existingOccupants: ReadonlyArray<{
527
+ x: number;
528
+ y: number;
529
+ }>;
530
+ structureAnchors: ReadonlyArray<{
531
+ x: number;
532
+ y: number;
533
+ }>;
534
+ minDistance: number;
535
+ structureMinDistance: number;
536
+ }): boolean;
537
+ declare function isAgentSpawnOccupancyPointAvailable(input: {
538
+ point: OccupancyGridPoint;
539
+ occupiedKeys: ReadonlySet<string>;
540
+ existingOccupants: ReadonlyArray<{
541
+ x: number;
542
+ y: number;
543
+ }>;
544
+ minDistance?: number;
545
+ }): boolean;
546
+ declare function isSpaceAnchorOccupancyPointAvailable(input: {
547
+ point: OccupancyGridPoint;
548
+ occupiedKeys: ReadonlySet<string>;
549
+ existingOccupants: ReadonlyArray<{
550
+ x: number;
551
+ y: number;
552
+ }>;
553
+ structureAnchors: ReadonlyArray<{
554
+ x: number;
555
+ y: number;
556
+ }>;
557
+ minDistance: number;
558
+ structureMinDistance: number;
559
+ }): boolean;
560
+
561
+ type StreetPoolEntry = {
562
+ id: string;
563
+ label: string;
564
+ };
565
+ declare const STREET_NAME_POOL: readonly StreetPoolEntry[];
566
+ declare function getStreetPoolEntryById(id: string): StreetPoolEntry | undefined;
567
+
568
+ type OccupantGroup = "agent" | "space" | "arcade";
569
+ type Street = {
570
+ id: string;
571
+ label: string;
572
+ };
573
+ type Zone = {
574
+ id: string;
575
+ streetId: string;
576
+ streetLabel: string;
577
+ rect: WorldBounds;
578
+ primaryGroup: OccupantGroup;
579
+ allowedGroups: readonly OccupantGroup[];
580
+ };
581
+ type WorldLayout = {
582
+ rev: number;
583
+ bounds: WorldBounds;
584
+ zones: readonly Zone[];
585
+ streets: readonly Street[];
586
+ };
587
+ declare function streetFromPoolEntry(entry: StreetPoolEntry): Street;
588
+ declare function zonesForGroup(layout: WorldLayout, group: OccupantGroup): readonly Zone[];
589
+ declare function primaryZoneForGroup(layout: WorldLayout, group: OccupantGroup): Zone | undefined;
590
+ declare function enumerateIntegerCellsInRect(rect: WorldBounds): OccupancyGridPoint[];
591
+ declare function cellsForZone(zone: Zone): readonly OccupancyGridPoint[];
592
+ declare function centerOfZone(zone: Zone): OccupancyGridPoint;
593
+ declare function pointCellInZone(wx: number, wy: number, zone: Zone): boolean;
594
+ declare function listOccupancyPointsForZone(zone: Zone): readonly OccupancyGridPoint[];
595
+ declare function buildRankedOccupancyPointsForZone(zone: Zone): OccupancyGridPoint[];
596
+ declare function occupancyPointsGroupedByZones(layout: WorldLayout): readonly (readonly OccupancyGridPoint[])[];
597
+ declare function nextStreetFromPool(usedStreetIds: ReadonlySet<string>): StreetPoolEntry | undefined;
598
+ declare function pickZoneForGroup(layout: WorldLayout, group: OccupantGroup): Zone;
599
+ declare function availableCellsForZone(zone: Zone, occupiedCellKeys: ReadonlySet<string>): OccupancyGridPoint[];
600
+ declare function isAgentSpawnOccupancyPointAvailableInZone(input: {
601
+ zone: Zone;
602
+ point: OccupancyGridPoint;
603
+ occupiedKeys: ReadonlySet<string>;
604
+ existingOccupants: ReadonlyArray<{
605
+ x: number;
606
+ y: number;
607
+ }>;
608
+ minDistance?: number;
609
+ }): boolean;
610
+ declare function isSpaceAnchorOccupancyPointAvailableInZone(input: {
611
+ zone: Zone;
612
+ point: OccupancyGridPoint;
613
+ occupiedKeys: ReadonlySet<string>;
614
+ existingOccupants: ReadonlyArray<{
615
+ x: number;
616
+ y: number;
617
+ }>;
618
+ structureAnchors: ReadonlyArray<{
619
+ x: number;
620
+ y: number;
621
+ }>;
622
+ minDistance: number;
623
+ structureMinDistance: number;
624
+ }): boolean;
625
+ type WorldLayoutBoundsField = "minX" | "minY" | "maxX" | "maxY";
626
+ declare function migrateWorldLayoutBounds(input: {
627
+ layout: WorldLayout;
628
+ bounds: WorldBounds;
629
+ }): WorldLayout;
630
+ declare function applyBoundsFieldUpdateToLayout(input: {
631
+ layout: WorldLayout;
632
+ field: WorldLayoutBoundsField;
633
+ value: number;
634
+ }): WorldLayout;
635
+ declare function createVerticalStripSeedLayout(input: {
636
+ bounds: WorldBounds;
637
+ streets: readonly [StreetPoolEntry, StreetPoolEntry, StreetPoolEntry];
638
+ }): WorldLayout;
639
+
640
+ /**
641
+ * @packageDocumentation
642
+ * @module @agent-play/sdk/space-content-model
643
+ *
644
+ * Zod schemas and helpers for the **server-authoritative content** a space owns
645
+ * inside each amenity kind, plus the **per-player wallet** that funds purchases.
646
+ *
647
+ * **Scope**
648
+ * - {@link SaleStateSchema}: shared sub-record describing whether an item is
649
+ * still available for purchase or has already been sold (and to whom).
650
+ * - {@link ShopItemSchema}, {@link SupermarketItemSchema}, {@link CarWashCarSchema}:
651
+ * the three amenity-content kinds. Each carries a `sale` block.
652
+ * - {@link PlayerWalletSchema} + {@link createInitialPlayerWallet}: every player
653
+ * starts with **`$10`** ({@link DEFAULT_PLAYER_WALLET_BALANCE_USD}); the wallet
654
+ * is seeded lazily on first read by the server.
655
+ * - {@link PurchaseRecordSchema}: append-only audit row stored per player.
656
+ * - {@link isItemAvailableForPurchase}: pure helper consumed by the `purchase`
657
+ * RPC (server) and the item-tooltip / sprite renderers (client).
658
+ *
659
+ * @see ../../packages/web-ui/src/server/agent-play/session-store.ts for the
660
+ * session-store interface that persists these records.
661
+ * @see ../../packages/web-ui/src/app/api/agent-play/sdk/rpc/route.ts for the
662
+ * RPC handlers that write them.
663
+ */
664
+
665
+ /**
666
+ * Sale state attached to every amenity content record.
667
+ *
668
+ * @remarks
669
+ * Records start as `{ status: "available" }`. The `purchase` RPC flips them
670
+ * to `{ status: "sold", soldToPlayerId, soldAt }` inside a `WATCH`/`MULTI`
671
+ * transaction so concurrent buyers cannot both succeed.
672
+ *
673
+ * @example
674
+ * ```ts
675
+ * SaleStateSchema.parse({ status: "available" });
676
+ * SaleStateSchema.parse({
677
+ * status: "sold",
678
+ * soldToPlayerId: "player-42",
679
+ * soldAt: new Date().toISOString(),
680
+ * });
681
+ * ```
682
+ *
683
+ * @public
684
+ */
685
+ declare const SaleStateSchema: z.ZodObject<{
686
+ status: z.ZodEnum<["available", "sold"]>;
687
+ soldToPlayerId: z.ZodOptional<z.ZodString>;
688
+ soldAt: z.ZodOptional<z.ZodString>;
689
+ }, "strip", z.ZodTypeAny, {
690
+ status: "available" | "sold";
691
+ soldToPlayerId?: string | undefined;
692
+ soldAt?: string | undefined;
693
+ }, {
694
+ status: "available" | "sold";
695
+ soldToPlayerId?: string | undefined;
696
+ soldAt?: string | undefined;
697
+ }>;
698
+ /** Runtime type derived from {@link SaleStateSchema}. @public */
699
+ type SaleState = z.infer<typeof SaleStateSchema>;
700
+ /**
701
+ * Shop amenity item — books, music, coffee.
702
+ *
703
+ * @remarks
704
+ * Inserted by `addShopItem` AQL / RPC. Always starts with
705
+ * `sale.status === "available"`. Client renders this via
706
+ * `sprite-shop-item.ts` and the bookstore amenity stage.
707
+ *
708
+ * @example
709
+ * ```ts
710
+ * ShopItemSchema.parse({
711
+ * id: "shop-1",
712
+ * spaceId: "space-42",
713
+ * type: "book",
714
+ * name: "Hitchhiker's Guide",
715
+ * description: "Don't panic.",
716
+ * priceUsd: 12.5,
717
+ * createdAt: new Date().toISOString(),
718
+ * sale: { status: "available" },
719
+ * });
720
+ * ```
721
+ *
722
+ * @public
723
+ */
724
+ declare const ShopItemSchema: z.ZodObject<{
725
+ id: z.ZodString;
726
+ spaceId: z.ZodString;
727
+ type: z.ZodEnum<["book", "music", "coffee"]>;
728
+ name: z.ZodString;
729
+ description: z.ZodString;
730
+ priceUsd: z.ZodNumber;
731
+ createdAt: z.ZodString;
732
+ sale: z.ZodObject<{
733
+ status: z.ZodEnum<["available", "sold"]>;
734
+ soldToPlayerId: z.ZodOptional<z.ZodString>;
735
+ soldAt: z.ZodOptional<z.ZodString>;
736
+ }, "strip", z.ZodTypeAny, {
737
+ status: "available" | "sold";
738
+ soldToPlayerId?: string | undefined;
739
+ soldAt?: string | undefined;
740
+ }, {
741
+ status: "available" | "sold";
742
+ soldToPlayerId?: string | undefined;
743
+ soldAt?: string | undefined;
744
+ }>;
745
+ }, "strip", z.ZodTypeAny, {
746
+ type: "book" | "music" | "coffee";
747
+ id: string;
748
+ spaceId: string;
749
+ name: string;
750
+ description: string;
751
+ priceUsd: number;
752
+ createdAt: string;
753
+ sale: {
754
+ status: "available" | "sold";
755
+ soldToPlayerId?: string | undefined;
756
+ soldAt?: string | undefined;
757
+ };
758
+ }, {
759
+ type: "book" | "music" | "coffee";
760
+ id: string;
761
+ spaceId: string;
762
+ name: string;
763
+ description: string;
764
+ priceUsd: number;
765
+ createdAt: string;
766
+ sale: {
767
+ status: "available" | "sold";
768
+ soldToPlayerId?: string | undefined;
769
+ soldAt?: string | undefined;
770
+ };
771
+ }>;
772
+ /** Runtime type for {@link ShopItemSchema}. @public */
773
+ type ShopItem = z.infer<typeof ShopItemSchema>;
774
+ /**
775
+ * Supermarket amenity item — laid out on a 4×5 grid of slots.
776
+ *
777
+ * @remarks
778
+ * `row` selects the section (1=Fruits, 2=Mens, 3=Womens, 4=Kids in the
779
+ * client-side stage); `column` is 1..5. If the AQL caller omits `column` the
780
+ * server picks the next free slot in that row.
781
+ *
782
+ * @example
783
+ * ```ts
784
+ * SupermarketItemSchema.parse({
785
+ * id: "sm-1",
786
+ * spaceId: "space-42",
787
+ * row: 1,
788
+ * column: 3,
789
+ * name: "Apple",
790
+ * description: "fresh",
791
+ * priceUsd: 1.25,
792
+ * createdAt: new Date().toISOString(),
793
+ * sale: { status: "available" },
794
+ * });
795
+ * ```
796
+ *
797
+ * @public
798
+ */
799
+ declare const SupermarketItemSchema: z.ZodObject<{
800
+ id: z.ZodString;
801
+ spaceId: z.ZodString;
802
+ row: z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>]>;
803
+ column: z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>;
804
+ name: z.ZodString;
805
+ description: z.ZodString;
806
+ priceUsd: z.ZodNumber;
807
+ createdAt: z.ZodString;
808
+ sale: z.ZodObject<{
809
+ status: z.ZodEnum<["available", "sold"]>;
810
+ soldToPlayerId: z.ZodOptional<z.ZodString>;
811
+ soldAt: z.ZodOptional<z.ZodString>;
812
+ }, "strip", z.ZodTypeAny, {
813
+ status: "available" | "sold";
814
+ soldToPlayerId?: string | undefined;
815
+ soldAt?: string | undefined;
816
+ }, {
817
+ status: "available" | "sold";
818
+ soldToPlayerId?: string | undefined;
819
+ soldAt?: string | undefined;
820
+ }>;
821
+ }, "strip", z.ZodTypeAny, {
822
+ id: string;
823
+ spaceId: string;
824
+ name: string;
825
+ description: string;
826
+ priceUsd: number;
827
+ createdAt: string;
828
+ sale: {
829
+ status: "available" | "sold";
830
+ soldToPlayerId?: string | undefined;
831
+ soldAt?: string | undefined;
832
+ };
833
+ row: 1 | 2 | 3 | 4;
834
+ column: 1 | 2 | 5 | 3 | 4;
835
+ }, {
836
+ id: string;
837
+ spaceId: string;
838
+ name: string;
839
+ description: string;
840
+ priceUsd: number;
841
+ createdAt: string;
842
+ sale: {
843
+ status: "available" | "sold";
844
+ soldToPlayerId?: string | undefined;
845
+ soldAt?: string | undefined;
846
+ };
847
+ row: 1 | 2 | 3 | 4;
848
+ column: 1 | 2 | 5 | 3 | 4;
849
+ }>;
850
+ /** Runtime type for {@link SupermarketItemSchema}. @public */
851
+ type SupermarketItem = z.infer<typeof SupermarketItemSchema>;
852
+ /**
853
+ * Car-wash amenity car parked in one of nine slots.
854
+ *
855
+ * @remarks
856
+ * Client renders the car via `sprite-car.ts`, parameterised by `colorHex`.
857
+ * Sold cars flip to a desaturated palette plus a `SOLD` banner overlay.
858
+ *
859
+ * @example
860
+ * ```ts
861
+ * CarWashCarSchema.parse({
862
+ * id: "car-1",
863
+ * spaceId: "space-42",
864
+ * slot: 5,
865
+ * name: "Mustang",
866
+ * model: "GT",
867
+ * year: 2023,
868
+ * priceUsd: 45000,
869
+ * colorHex: "#ff3344",
870
+ * createdAt: new Date().toISOString(),
871
+ * sale: { status: "available" },
872
+ * });
873
+ * ```
874
+ *
875
+ * @public
876
+ */
877
+ declare const CarWashCarSchema: z.ZodObject<{
878
+ id: z.ZodString;
879
+ spaceId: z.ZodString;
880
+ slot: z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>, z.ZodLiteral<6>, z.ZodLiteral<7>, z.ZodLiteral<8>, z.ZodLiteral<9>]>;
881
+ name: z.ZodString;
882
+ model: z.ZodString;
883
+ year: z.ZodNumber;
884
+ priceUsd: z.ZodNumber;
885
+ colorHex: z.ZodString;
886
+ createdAt: z.ZodString;
887
+ sale: z.ZodObject<{
888
+ status: z.ZodEnum<["available", "sold"]>;
889
+ soldToPlayerId: z.ZodOptional<z.ZodString>;
890
+ soldAt: z.ZodOptional<z.ZodString>;
891
+ }, "strip", z.ZodTypeAny, {
892
+ status: "available" | "sold";
893
+ soldToPlayerId?: string | undefined;
894
+ soldAt?: string | undefined;
895
+ }, {
896
+ status: "available" | "sold";
897
+ soldToPlayerId?: string | undefined;
898
+ soldAt?: string | undefined;
899
+ }>;
900
+ }, "strip", z.ZodTypeAny, {
901
+ id: string;
902
+ spaceId: string;
903
+ name: string;
904
+ priceUsd: number;
905
+ createdAt: string;
906
+ sale: {
907
+ status: "available" | "sold";
908
+ soldToPlayerId?: string | undefined;
909
+ soldAt?: string | undefined;
910
+ };
911
+ slot: 8 | 7 | 1 | 6 | 2 | 5 | 3 | 4 | 9;
912
+ model: string;
913
+ year: number;
914
+ colorHex: string;
915
+ }, {
916
+ id: string;
917
+ spaceId: string;
918
+ name: string;
919
+ priceUsd: number;
920
+ createdAt: string;
921
+ sale: {
922
+ status: "available" | "sold";
923
+ soldToPlayerId?: string | undefined;
924
+ soldAt?: string | undefined;
925
+ };
926
+ slot: 8 | 7 | 1 | 6 | 2 | 5 | 3 | 4 | 9;
927
+ model: string;
928
+ year: number;
929
+ colorHex: string;
930
+ }>;
931
+ /** Runtime type for {@link CarWashCarSchema}. @public */
932
+ type CarWashCar = z.infer<typeof CarWashCarSchema>;
933
+ /**
934
+ * Default starting balance, in USD, seeded into every new player wallet.
935
+ *
936
+ * @remarks
937
+ * The session store seeds the wallet lazily on first read via
938
+ * {@link createInitialPlayerWallet} inside an atomic `MULTI`, so two
939
+ * simultaneous first reads still leave the balance at exactly `$10`.
940
+ *
941
+ * @defaultValue 10
942
+ * @public
943
+ */
944
+ declare const DEFAULT_PLAYER_WALLET_BALANCE_USD = 10;
945
+ /**
946
+ * Per-player wallet.
947
+ *
948
+ * @remarks
949
+ * Stored at `agent-play:${hostId}:player:${playerId}:wallet`. Mutated atomically
950
+ * by the `purchase` RPC (decrement) and by the optional AQL `SET WALLET`
951
+ * statement.
952
+ *
953
+ * @public
954
+ */
955
+ declare const PlayerWalletSchema: z.ZodObject<{
956
+ playerId: z.ZodString;
957
+ balanceUsd: z.ZodNumber;
958
+ currency: z.ZodLiteral<"USD">;
959
+ updatedAt: z.ZodString;
960
+ powerUps: z.ZodDefault<z.ZodNumber>;
961
+ }, "strip", z.ZodTypeAny, {
962
+ playerId: string;
963
+ balanceUsd: number;
964
+ currency: "USD";
965
+ updatedAt: string;
966
+ powerUps: number;
967
+ }, {
968
+ playerId: string;
969
+ balanceUsd: number;
970
+ currency: "USD";
971
+ updatedAt: string;
972
+ powerUps?: number | undefined;
973
+ }>;
974
+ /** Runtime type for {@link PlayerWalletSchema}. @public */
975
+ type PlayerWallet = z.infer<typeof PlayerWalletSchema>;
976
+ /**
977
+ * Build a fresh wallet seeded with the {@link DEFAULT_PLAYER_WALLET_BALANCE_USD}
978
+ * balance for an unseen player.
979
+ *
980
+ * @example
981
+ * ```ts
982
+ * const wallet = createInitialPlayerWallet({
983
+ * playerId: "player-42",
984
+ * now: new Date().toISOString(),
985
+ * });
986
+ * // → { playerId: "player-42", balanceUsd: 10, currency: "USD", updatedAt: ... }
987
+ * ```
988
+ *
989
+ * @public
990
+ */
991
+ declare function createInitialPlayerWallet(input: {
992
+ playerId: string;
993
+ now: string;
994
+ }): PlayerWallet;
995
+ declare function createInitialAgentRewardWallet(input: {
996
+ playerId: string;
997
+ now: string;
998
+ }): PlayerWallet;
999
+ /**
1000
+ * Audit record appended each time a player completes a purchase.
1001
+ *
1002
+ * @remarks
1003
+ * Stored as a Redis list at `agent-play:${hostId}:player:${playerId}:purchases`
1004
+ * with `LPUSH` so the newest entry is at index 0.
1005
+ *
1006
+ * @public
1007
+ */
1008
+ declare const PurchaseRecordSchema: z.ZodObject<{
1009
+ id: z.ZodString;
1010
+ playerId: z.ZodString;
1011
+ spaceId: z.ZodString;
1012
+ amenityKind: z.ZodEnum<["shop", "supermarket", "car_wash", "talk_time", "wallet_bundle", "apu_credit", "apu_debit"]>;
1013
+ itemRef: z.ZodObject<{
1014
+ kind: z.ZodEnum<["shop", "supermarket", "carwash", "game", "apu", "talk", "bundle"]>;
1015
+ id: z.ZodString;
1016
+ }, "strip", z.ZodTypeAny, {
1017
+ id: string;
1018
+ kind: "supermarket" | "shop" | "carwash" | "game" | "apu" | "talk" | "bundle";
1019
+ }, {
1020
+ id: string;
1021
+ kind: "supermarket" | "shop" | "carwash" | "game" | "apu" | "talk" | "bundle";
1022
+ }>;
1023
+ priceUsd: z.ZodOptional<z.ZodNumber>;
1024
+ at: z.ZodString;
1025
+ detail: z.ZodOptional<z.ZodString>;
1026
+ powerUpsSpent: z.ZodOptional<z.ZodNumber>;
1027
+ powerUpsEarned: z.ZodOptional<z.ZodNumber>;
1028
+ powerUpsDelta: z.ZodOptional<z.ZodNumber>;
1029
+ debitSource: z.ZodOptional<z.ZodString>;
1030
+ creditSource: z.ZodOptional<z.ZodString>;
1031
+ counterpartyNodeId: z.ZodOptional<z.ZodString>;
1032
+ token: z.ZodOptional<z.ZodLiteral<"APU">>;
1033
+ }, "strip", z.ZodTypeAny, {
1034
+ at: string;
1035
+ id: string;
1036
+ spaceId: string;
1037
+ playerId: string;
1038
+ amenityKind: "supermarket" | "shop" | "car_wash" | "talk_time" | "wallet_bundle" | "apu_credit" | "apu_debit";
1039
+ itemRef: {
1040
+ id: string;
1041
+ kind: "supermarket" | "shop" | "carwash" | "game" | "apu" | "talk" | "bundle";
1042
+ };
1043
+ priceUsd?: number | undefined;
1044
+ detail?: string | undefined;
1045
+ powerUpsSpent?: number | undefined;
1046
+ powerUpsEarned?: number | undefined;
1047
+ powerUpsDelta?: number | undefined;
1048
+ debitSource?: string | undefined;
1049
+ creditSource?: string | undefined;
1050
+ counterpartyNodeId?: string | undefined;
1051
+ token?: "APU" | undefined;
1052
+ }, {
1053
+ at: string;
1054
+ id: string;
1055
+ spaceId: string;
1056
+ playerId: string;
1057
+ amenityKind: "supermarket" | "shop" | "car_wash" | "talk_time" | "wallet_bundle" | "apu_credit" | "apu_debit";
1058
+ itemRef: {
1059
+ id: string;
1060
+ kind: "supermarket" | "shop" | "carwash" | "game" | "apu" | "talk" | "bundle";
1061
+ };
1062
+ priceUsd?: number | undefined;
1063
+ detail?: string | undefined;
1064
+ powerUpsSpent?: number | undefined;
1065
+ powerUpsEarned?: number | undefined;
1066
+ powerUpsDelta?: number | undefined;
1067
+ debitSource?: string | undefined;
1068
+ creditSource?: string | undefined;
1069
+ counterpartyNodeId?: string | undefined;
1070
+ token?: "APU" | undefined;
1071
+ }>;
1072
+ /** Runtime type for {@link PurchaseRecordSchema}. @public */
1073
+ type PurchaseRecord = z.infer<typeof PurchaseRecordSchema>;
1074
+ /**
1075
+ * Returns whether an amenity content record can still be purchased.
1076
+ *
1077
+ * @remarks
1078
+ * Server-side, the `purchase` RPC calls this **after** re-reading the item
1079
+ * inside the `WATCH`/`MULTI` block to make the check atomic. Client-side, the
1080
+ * tooltip and sprite renderers call it to decide between the `Buy` button and
1081
+ * the disabled `SOLD` pill.
1082
+ *
1083
+ * @example
1084
+ * ```ts
1085
+ * if (!isItemAvailableForPurchase(item)) {
1086
+ * // render the sold view
1087
+ * }
1088
+ * ```
1089
+ *
1090
+ * @public
1091
+ */
1092
+ declare function isItemAvailableForPurchase(item: {
1093
+ sale: SaleState;
1094
+ }): boolean;
1095
+ /**
1096
+ * Union of all three content kinds, useful for places where the carrier
1097
+ * doesn't need to know the specific amenity.
1098
+ *
1099
+ * @public
1100
+ */
1101
+ type SpaceContentItem = ShopItem | SupermarketItem | CarWashCar;
1102
+ /**
1103
+ * Convert any 24-bit RGB color to its perceptual grey equivalent using the
1104
+ * standard luminance coefficients (`Y = 0.299·R + 0.587·G + 0.114·B`).
1105
+ *
1106
+ * @remarks
1107
+ * Used by every amenity sprite (shop card, grocery item, car) when the
1108
+ * item's `sale.status === 'sold'`. Replacing original fills with the
1109
+ * desaturated grey is the first step of the sold visual treatment;
1110
+ * `drawSoldBadge` then paints the red `SOLD` banner on top.
1111
+ *
1112
+ * The function is bit-pure: it accepts a `0xRRGGBB` integer and returns a
1113
+ * `0xGGGGGG` integer, so it composes cleanly with `pixi.js` color params.
1114
+ *
1115
+ * @example
1116
+ * ```ts
1117
+ * const grey = desaturateColor(0xff3344);
1118
+ * // grey = 0x6e6e6e (approximate)
1119
+ * ```
1120
+ *
1121
+ * @public
1122
+ */
1123
+ declare function desaturateColor(hex: number): number;
1124
+
1125
+ /**
1126
+ * Token name for redeemable power-up units (Agent Play Units).
1127
+ *
1128
+ * @public
1129
+ */
1130
+ declare const APU_TOKEN: "APU";
1131
+ type ApuItemRef = PurchaseRecord["itemRef"];
1132
+ /**
1133
+ * Build a wallet transaction row for an APU credit or debit.
1134
+ *
1135
+ * @public
1136
+ */
1137
+ declare const buildApuWalletTransaction: (input: {
1138
+ id: string;
1139
+ playerId: string;
1140
+ spaceId: string;
1141
+ delta: number;
1142
+ at: string;
1143
+ creditSource?: string;
1144
+ debitSource?: string;
1145
+ counterpartyNodeId?: string;
1146
+ detail?: string;
1147
+ itemRef: ApuItemRef;
1148
+ }) => PurchaseRecord;
1149
+ /**
1150
+ * APU fields appended to amenity purchase audit rows when USD is spent
1151
+ * and power-ups are minted.
1152
+ *
1153
+ * @public
1154
+ */
1155
+ declare const buildAmenityPurchaseApuFields: (input: {
1156
+ amenityKind: "shop" | "supermarket" | "car_wash";
1157
+ spaceId: string;
1158
+ earnedPowerUps: number;
1159
+ }) => Pick<PurchaseRecord, "powerUpsEarned" | "powerUpsDelta" | "creditSource" | "debitSource" | "token">;
1160
+ /**
1161
+ * APU fields for wallet bundle redemption rows.
1162
+ *
1163
+ * @public
1164
+ */
1165
+ declare const buildWalletBundleApuFields: (input: {
1166
+ bundleId: string;
1167
+ powerUpsCost: number;
1168
+ }) => Pick<PurchaseRecord, "powerUpsSpent" | "powerUpsDelta" | "creditSource" | "debitSource" | "token">;
1169
+
1170
+ declare const TALK_PRICE_PER_60S_USD = 1.5;
1171
+ declare const TALK_PRICE_PER_SECOND_USD = 0.025;
1172
+ declare const TALK_TICK_SECONDS = 10;
1173
+ declare const costForSeconds: (seconds: number) => number;
1174
+
1175
+ declare const TALK_AGENT_PU_BILLED_SECONDS_PER_UNIT = 10;
1176
+ declare const TALK_AGENT_PU_MAX_PER_LEG = 5;
1177
+ type ComputeTalkAgentPowerUpsEarnedInput = {
1178
+ billedWholeSeconds: number;
1179
+ costUsd: number;
1180
+ };
1181
+ declare const computeTalkAgentPowerUpsEarned: (input: ComputeTalkAgentPowerUpsEarnedInput) => number;
1182
+
1183
+ type WalletBundleId = "bundle-10" | "bundle-20" | "bundle-50" | "bundle-100";
1184
+ type WalletBundleOffer = {
1185
+ readonly id: WalletBundleId;
1186
+ readonly powerUpsCost: number;
1187
+ readonly creditUsd: number;
1188
+ };
1189
+ declare const WALLET_BUNDLE_OFFERS: readonly WalletBundleOffer[];
1190
+ declare const getWalletBundleById: (id: string) => WalletBundleOffer | undefined;
1191
+
1192
+ declare const DAILY_GAME_PU_CAP = 100;
1193
+ declare const STREAK_BONUS_PU = 5;
1194
+ declare const STREAK_BONUS_THRESHOLD_DAYS = 5;
1195
+ declare const GameEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1196
+ type: z.ZodLiteral<"chest_open">;
1197
+ correct: z.ZodBoolean;
1198
+ tutorial: z.ZodOptional<z.ZodBoolean>;
1199
+ }, "strip", z.ZodTypeAny, {
1200
+ type: "chest_open";
1201
+ correct: boolean;
1202
+ tutorial?: boolean | undefined;
1203
+ }, {
1204
+ type: "chest_open";
1205
+ correct: boolean;
1206
+ tutorial?: boolean | undefined;
1207
+ }>, z.ZodObject<{
1208
+ type: z.ZodLiteral<"sequence_step">;
1209
+ correct: z.ZodBoolean;
1210
+ tutorial: z.ZodOptional<z.ZodBoolean>;
1211
+ }, "strip", z.ZodTypeAny, {
1212
+ type: "sequence_step";
1213
+ correct: boolean;
1214
+ tutorial?: boolean | undefined;
1215
+ }, {
1216
+ type: "sequence_step";
1217
+ correct: boolean;
1218
+ tutorial?: boolean | undefined;
1219
+ }>, z.ZodObject<{
1220
+ type: z.ZodLiteral<"price_guess">;
1221
+ correct: z.ZodBoolean;
1222
+ round: z.ZodNumber;
1223
+ }, "strip", z.ZodTypeAny, {
1224
+ type: "price_guess";
1225
+ correct: boolean;
1226
+ round: number;
1227
+ }, {
1228
+ type: "price_guess";
1229
+ correct: boolean;
1230
+ round: number;
1231
+ }>, z.ZodObject<{
1232
+ type: z.ZodLiteral<"signal_pick">;
1233
+ correct: z.ZodBoolean;
1234
+ }, "strip", z.ZodTypeAny, {
1235
+ type: "signal_pick";
1236
+ correct: boolean;
1237
+ }, {
1238
+ type: "signal_pick";
1239
+ correct: boolean;
1240
+ }>, z.ZodObject<{
1241
+ type: z.ZodLiteral<"delivery_finish">;
1242
+ band: z.ZodEnum<["fast", "ok", "slow"]>;
1243
+ hits: z.ZodNumber;
1244
+ }, "strip", z.ZodTypeAny, {
1245
+ type: "delivery_finish";
1246
+ band: "fast" | "ok" | "slow";
1247
+ hits: number;
1248
+ }, {
1249
+ type: "delivery_finish";
1250
+ band: "fast" | "ok" | "slow";
1251
+ hits: number;
1252
+ }>, z.ZodObject<{
1253
+ type: z.ZodLiteral<"door_pick">;
1254
+ correct: z.ZodBoolean;
1255
+ }, "strip", z.ZodTypeAny, {
1256
+ type: "door_pick";
1257
+ correct: boolean;
1258
+ }, {
1259
+ type: "door_pick";
1260
+ correct: boolean;
1261
+ }>, z.ZodObject<{
1262
+ type: z.ZodLiteral<"talk_release">;
1263
+ success: z.ZodBoolean;
1264
+ round: z.ZodNumber;
1265
+ }, "strip", z.ZodTypeAny, {
1266
+ type: "talk_release";
1267
+ round: number;
1268
+ success: boolean;
1269
+ }, {
1270
+ type: "talk_release";
1271
+ round: number;
1272
+ success: boolean;
1273
+ }>]>;
1274
+ type GameEvent = z.infer<typeof GameEventSchema>;
1275
+ declare const ApplyGameOutcomeInputSchema: z.ZodObject<{
1276
+ gameId: z.ZodEffects<z.ZodString, GameId, string>;
1277
+ roundId: z.ZodString;
1278
+ events: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1279
+ type: z.ZodLiteral<"chest_open">;
1280
+ correct: z.ZodBoolean;
1281
+ tutorial: z.ZodOptional<z.ZodBoolean>;
1282
+ }, "strip", z.ZodTypeAny, {
1283
+ type: "chest_open";
1284
+ correct: boolean;
1285
+ tutorial?: boolean | undefined;
1286
+ }, {
1287
+ type: "chest_open";
1288
+ correct: boolean;
1289
+ tutorial?: boolean | undefined;
1290
+ }>, z.ZodObject<{
1291
+ type: z.ZodLiteral<"sequence_step">;
1292
+ correct: z.ZodBoolean;
1293
+ tutorial: z.ZodOptional<z.ZodBoolean>;
1294
+ }, "strip", z.ZodTypeAny, {
1295
+ type: "sequence_step";
1296
+ correct: boolean;
1297
+ tutorial?: boolean | undefined;
1298
+ }, {
1299
+ type: "sequence_step";
1300
+ correct: boolean;
1301
+ tutorial?: boolean | undefined;
1302
+ }>, z.ZodObject<{
1303
+ type: z.ZodLiteral<"price_guess">;
1304
+ correct: z.ZodBoolean;
1305
+ round: z.ZodNumber;
1306
+ }, "strip", z.ZodTypeAny, {
1307
+ type: "price_guess";
1308
+ correct: boolean;
1309
+ round: number;
1310
+ }, {
1311
+ type: "price_guess";
1312
+ correct: boolean;
1313
+ round: number;
1314
+ }>, z.ZodObject<{
1315
+ type: z.ZodLiteral<"signal_pick">;
1316
+ correct: z.ZodBoolean;
1317
+ }, "strip", z.ZodTypeAny, {
1318
+ type: "signal_pick";
1319
+ correct: boolean;
1320
+ }, {
1321
+ type: "signal_pick";
1322
+ correct: boolean;
1323
+ }>, z.ZodObject<{
1324
+ type: z.ZodLiteral<"delivery_finish">;
1325
+ band: z.ZodEnum<["fast", "ok", "slow"]>;
1326
+ hits: z.ZodNumber;
1327
+ }, "strip", z.ZodTypeAny, {
1328
+ type: "delivery_finish";
1329
+ band: "fast" | "ok" | "slow";
1330
+ hits: number;
1331
+ }, {
1332
+ type: "delivery_finish";
1333
+ band: "fast" | "ok" | "slow";
1334
+ hits: number;
1335
+ }>, z.ZodObject<{
1336
+ type: z.ZodLiteral<"door_pick">;
1337
+ correct: z.ZodBoolean;
1338
+ }, "strip", z.ZodTypeAny, {
1339
+ type: "door_pick";
1340
+ correct: boolean;
1341
+ }, {
1342
+ type: "door_pick";
1343
+ correct: boolean;
1344
+ }>, z.ZodObject<{
1345
+ type: z.ZodLiteral<"talk_release">;
1346
+ success: z.ZodBoolean;
1347
+ round: z.ZodNumber;
1348
+ }, "strip", z.ZodTypeAny, {
1349
+ type: "talk_release";
1350
+ round: number;
1351
+ success: boolean;
1352
+ }, {
1353
+ type: "talk_release";
1354
+ round: number;
1355
+ success: boolean;
1356
+ }>]>, "many">;
1357
+ }, "strip", z.ZodTypeAny, {
1358
+ gameId: GameId;
1359
+ roundId: string;
1360
+ events: ({
1361
+ type: "chest_open";
1362
+ correct: boolean;
1363
+ tutorial?: boolean | undefined;
1364
+ } | {
1365
+ type: "sequence_step";
1366
+ correct: boolean;
1367
+ tutorial?: boolean | undefined;
1368
+ } | {
1369
+ type: "price_guess";
1370
+ correct: boolean;
1371
+ round: number;
1372
+ } | {
1373
+ type: "signal_pick";
1374
+ correct: boolean;
1375
+ } | {
1376
+ type: "delivery_finish";
1377
+ band: "fast" | "ok" | "slow";
1378
+ hits: number;
1379
+ } | {
1380
+ type: "door_pick";
1381
+ correct: boolean;
1382
+ } | {
1383
+ type: "talk_release";
1384
+ round: number;
1385
+ success: boolean;
1386
+ })[];
1387
+ }, {
1388
+ gameId: string;
1389
+ roundId: string;
1390
+ events: ({
1391
+ type: "chest_open";
1392
+ correct: boolean;
1393
+ tutorial?: boolean | undefined;
1394
+ } | {
1395
+ type: "sequence_step";
1396
+ correct: boolean;
1397
+ tutorial?: boolean | undefined;
1398
+ } | {
1399
+ type: "price_guess";
1400
+ correct: boolean;
1401
+ round: number;
1402
+ } | {
1403
+ type: "signal_pick";
1404
+ correct: boolean;
1405
+ } | {
1406
+ type: "delivery_finish";
1407
+ band: "fast" | "ok" | "slow";
1408
+ hits: number;
1409
+ } | {
1410
+ type: "door_pick";
1411
+ correct: boolean;
1412
+ } | {
1413
+ type: "talk_release";
1414
+ round: number;
1415
+ success: boolean;
1416
+ })[];
1417
+ }>;
1418
+ type ApplyGameOutcomeInput = z.infer<typeof ApplyGameOutcomeInputSchema>;
1419
+ declare const GamePerTitleStatsSchema: z.ZodObject<{
1420
+ plays: z.ZodNumber;
1421
+ bestNetPu: z.ZodNumber;
1422
+ }, "strip", z.ZodTypeAny, {
1423
+ plays: number;
1424
+ bestNetPu: number;
1425
+ }, {
1426
+ plays: number;
1427
+ bestNetPu: number;
1428
+ }>;
1429
+ type GamePerTitleStats = z.infer<typeof GamePerTitleStatsSchema>;
1430
+ declare const GameStatsSchema: z.ZodObject<{
1431
+ dayStreak: z.ZodNumber;
1432
+ bestStreak: z.ZodNumber;
1433
+ puEarnedToday: z.ZodNumber;
1434
+ puCapRemaining: z.ZodNumber;
1435
+ gamesPlayedToday: z.ZodNumber;
1436
+ featuredGameId: z.ZodString;
1437
+ firstGamePlayed: z.ZodBoolean;
1438
+ perGame: z.ZodRecord<z.ZodString, z.ZodObject<{
1439
+ plays: z.ZodNumber;
1440
+ bestNetPu: z.ZodNumber;
1441
+ }, "strip", z.ZodTypeAny, {
1442
+ plays: number;
1443
+ bestNetPu: number;
1444
+ }, {
1445
+ plays: number;
1446
+ bestNetPu: number;
1447
+ }>>;
1448
+ }, "strip", z.ZodTypeAny, {
1449
+ dayStreak: number;
1450
+ bestStreak: number;
1451
+ puEarnedToday: number;
1452
+ puCapRemaining: number;
1453
+ gamesPlayedToday: number;
1454
+ featuredGameId: string;
1455
+ firstGamePlayed: boolean;
1456
+ perGame: Record<string, {
1457
+ plays: number;
1458
+ bestNetPu: number;
1459
+ }>;
1460
+ }, {
1461
+ dayStreak: number;
1462
+ bestStreak: number;
1463
+ puEarnedToday: number;
1464
+ puCapRemaining: number;
1465
+ gamesPlayedToday: number;
1466
+ featuredGameId: string;
1467
+ firstGamePlayed: boolean;
1468
+ perGame: Record<string, {
1469
+ plays: number;
1470
+ bestNetPu: number;
1471
+ }>;
1472
+ }>;
1473
+ type GameStats = z.infer<typeof GameStatsSchema>;
1474
+ declare const computeEventPuDelta: (event: GameEvent) => number;
1475
+ declare const computeRoundPuDelta: (events: readonly GameEvent[]) => number;
1476
+ declare const utcDateKey: (date: Date) => string;
1477
+ declare const createEmptyGameStats: (date: Date) => GameStats;
1478
+
1479
+ declare const ScannerTxOpSchema: z.ZodEnum<["purchase", "redeemWalletBundle", "applyGameOutcome", "talkTick", "talkStop", "talkStart", "walletSeeded"]>;
1480
+ type ScannerTxOp = z.infer<typeof ScannerTxOpSchema>;
1481
+ /**
1482
+ * Explorer row for a wallet / APU transaction indexed globally.
1483
+ *
1484
+ * @public
1485
+ */
1486
+ declare const ScannerTxRecordSchema: z.ZodObject<{
1487
+ id: z.ZodString;
1488
+ playerId: z.ZodString;
1489
+ spaceId: z.ZodString;
1490
+ amenityKind: z.ZodEnum<["shop", "supermarket", "car_wash", "talk_time", "wallet_bundle", "apu_credit", "apu_debit"]>;
1491
+ itemRef: z.ZodObject<{
1492
+ kind: z.ZodEnum<["shop", "supermarket", "carwash", "game", "apu", "talk", "bundle"]>;
1493
+ id: z.ZodString;
1494
+ }, "strip", z.ZodTypeAny, {
1495
+ id: string;
1496
+ kind: "supermarket" | "shop" | "carwash" | "game" | "apu" | "talk" | "bundle";
1497
+ }, {
1498
+ id: string;
1499
+ kind: "supermarket" | "shop" | "carwash" | "game" | "apu" | "talk" | "bundle";
1500
+ }>;
1501
+ priceUsd: z.ZodOptional<z.ZodNumber>;
1502
+ at: z.ZodString;
1503
+ detail: z.ZodOptional<z.ZodString>;
1504
+ powerUpsSpent: z.ZodOptional<z.ZodNumber>;
1505
+ powerUpsEarned: z.ZodOptional<z.ZodNumber>;
1506
+ powerUpsDelta: z.ZodOptional<z.ZodNumber>;
1507
+ debitSource: z.ZodOptional<z.ZodString>;
1508
+ creditSource: z.ZodOptional<z.ZodString>;
1509
+ counterpartyNodeId: z.ZodOptional<z.ZodString>;
1510
+ token: z.ZodOptional<z.ZodLiteral<"APU">>;
1511
+ } & {
1512
+ hostId: z.ZodString;
1513
+ indexedAt: z.ZodString;
1514
+ op: z.ZodEnum<["purchase", "redeemWalletBundle", "applyGameOutcome", "talkTick", "talkStop", "talkStart", "walletSeeded"]>;
1515
+ blockRev: z.ZodOptional<z.ZodNumber>;
1516
+ merkleRootHex: z.ZodOptional<z.ZodString>;
1517
+ }, "strip", z.ZodTypeAny, {
1518
+ at: string;
1519
+ id: string;
1520
+ spaceId: string;
1521
+ playerId: string;
1522
+ amenityKind: "supermarket" | "shop" | "car_wash" | "talk_time" | "wallet_bundle" | "apu_credit" | "apu_debit";
1523
+ itemRef: {
1524
+ id: string;
1525
+ kind: "supermarket" | "shop" | "carwash" | "game" | "apu" | "talk" | "bundle";
1526
+ };
1527
+ hostId: string;
1528
+ indexedAt: string;
1529
+ op: "purchase" | "redeemWalletBundle" | "applyGameOutcome" | "talkTick" | "talkStop" | "talkStart" | "walletSeeded";
1530
+ priceUsd?: number | undefined;
1531
+ detail?: string | undefined;
1532
+ powerUpsSpent?: number | undefined;
1533
+ powerUpsEarned?: number | undefined;
1534
+ powerUpsDelta?: number | undefined;
1535
+ debitSource?: string | undefined;
1536
+ creditSource?: string | undefined;
1537
+ counterpartyNodeId?: string | undefined;
1538
+ token?: "APU" | undefined;
1539
+ blockRev?: number | undefined;
1540
+ merkleRootHex?: string | undefined;
1541
+ }, {
1542
+ at: string;
1543
+ id: string;
1544
+ spaceId: string;
1545
+ playerId: string;
1546
+ amenityKind: "supermarket" | "shop" | "car_wash" | "talk_time" | "wallet_bundle" | "apu_credit" | "apu_debit";
1547
+ itemRef: {
1548
+ id: string;
1549
+ kind: "supermarket" | "shop" | "carwash" | "game" | "apu" | "talk" | "bundle";
1550
+ };
1551
+ hostId: string;
1552
+ indexedAt: string;
1553
+ op: "purchase" | "redeemWalletBundle" | "applyGameOutcome" | "talkTick" | "talkStop" | "talkStart" | "walletSeeded";
1554
+ priceUsd?: number | undefined;
1555
+ detail?: string | undefined;
1556
+ powerUpsSpent?: number | undefined;
1557
+ powerUpsEarned?: number | undefined;
1558
+ powerUpsDelta?: number | undefined;
1559
+ debitSource?: string | undefined;
1560
+ creditSource?: string | undefined;
1561
+ counterpartyNodeId?: string | undefined;
1562
+ token?: "APU" | undefined;
1563
+ blockRev?: number | undefined;
1564
+ merkleRootHex?: string | undefined;
1565
+ }>;
1566
+ type ScannerTxRecord = z.infer<typeof ScannerTxRecordSchema>;
1567
+ /**
1568
+ * Snapshot revision block indexed by the scanner.
1569
+ *
1570
+ * @public
1571
+ */
1572
+ declare const ScannerBlockRecordSchema: z.ZodObject<{
1573
+ rev: z.ZodNumber;
1574
+ merkleRootHex: z.ZodString;
1575
+ merkleLeafCount: z.ZodNumber;
1576
+ at: z.ZodString;
1577
+ occupantCount: z.ZodOptional<z.ZodNumber>;
1578
+ leafDeltaCount: z.ZodOptional<z.ZodNumber>;
1579
+ label: z.ZodOptional<z.ZodString>;
1580
+ }, "strip", z.ZodTypeAny, {
1581
+ at: string;
1582
+ merkleRootHex: string;
1583
+ rev: number;
1584
+ merkleLeafCount: number;
1585
+ occupantCount?: number | undefined;
1586
+ leafDeltaCount?: number | undefined;
1587
+ label?: string | undefined;
1588
+ }, {
1589
+ at: string;
1590
+ merkleRootHex: string;
1591
+ rev: number;
1592
+ merkleLeafCount: number;
1593
+ occupantCount?: number | undefined;
1594
+ leafDeltaCount?: number | undefined;
1595
+ label?: string | undefined;
1596
+ }>;
1597
+ type ScannerBlockRecord = z.infer<typeof ScannerBlockRecordSchema>;
1598
+ declare const ScannerMigrationStatusSchema: z.ZodEnum<["pending", "running", "completed", "failed"]>;
1599
+ type ScannerMigrationStatus = z.infer<typeof ScannerMigrationStatusSchema>;
1600
+ /**
1601
+ * Backfill progress for scanner indexes.
1602
+ *
1603
+ * @public
1604
+ */
1605
+ declare const ScannerMigrationStateSchema: z.ZodObject<{
1606
+ status: z.ZodEnum<["pending", "running", "completed", "failed"]>;
1607
+ cursor: z.ZodString;
1608
+ totalIndexed: z.ZodNumber;
1609
+ startedAt: z.ZodString;
1610
+ completedAt: z.ZodOptional<z.ZodString>;
1611
+ error: z.ZodOptional<z.ZodString>;
1612
+ }, "strip", z.ZodTypeAny, {
1613
+ status: "pending" | "running" | "completed" | "failed";
1614
+ cursor: string;
1615
+ totalIndexed: number;
1616
+ startedAt: string;
1617
+ completedAt?: string | undefined;
1618
+ error?: string | undefined;
1619
+ }, {
1620
+ status: "pending" | "running" | "completed" | "failed";
1621
+ cursor: string;
1622
+ totalIndexed: number;
1623
+ startedAt: string;
1624
+ completedAt?: string | undefined;
1625
+ error?: string | undefined;
1626
+ }>;
1627
+ type ScannerMigrationState = z.infer<typeof ScannerMigrationStateSchema>;
1628
+ /**
1629
+ * Cached wallet snapshot for scanner supply metrics.
1630
+ *
1631
+ * @public
1632
+ */
1633
+ declare const ScannerWalletSnapshotSchema: z.ZodObject<{
1634
+ playerId: z.ZodString;
1635
+ balanceUsd: z.ZodNumber;
1636
+ powerUps: z.ZodNumber;
1637
+ updatedAt: z.ZodString;
1638
+ }, "strip", z.ZodTypeAny, {
1639
+ playerId: string;
1640
+ balanceUsd: number;
1641
+ updatedAt: string;
1642
+ powerUps: number;
1643
+ }, {
1644
+ playerId: string;
1645
+ balanceUsd: number;
1646
+ updatedAt: string;
1647
+ powerUps: number;
1648
+ }>;
1649
+ type ScannerWalletSnapshot = z.infer<typeof ScannerWalletSnapshotSchema>;
1650
+ /**
1651
+ * Chain head + KPI strip for the scanner dashboard.
1652
+ *
1653
+ * @public
1654
+ */
1655
+ declare const ScannerHeadSchema: z.ZodObject<{
1656
+ generatedAt: z.ZodString;
1657
+ hostId: z.ZodString;
1658
+ snapshotRev: z.ZodNumber;
1659
+ merkleRootHex: z.ZodNullable<z.ZodString>;
1660
+ merkleLeafCount: z.ZodNullable<z.ZodNumber>;
1661
+ sid: z.ZodNullable<z.ZodString>;
1662
+ txsLast24h: z.ZodNumber;
1663
+ apuMintedLast24h: z.ZodNumber;
1664
+ apuBurnedLast24h: z.ZodNumber;
1665
+ migrationStatus: z.ZodEnum<["pending", "running", "completed", "failed"]>;
1666
+ }, "strip", z.ZodTypeAny, {
1667
+ hostId: string;
1668
+ merkleRootHex: string | null;
1669
+ merkleLeafCount: number | null;
1670
+ generatedAt: string;
1671
+ snapshotRev: number;
1672
+ sid: string | null;
1673
+ txsLast24h: number;
1674
+ apuMintedLast24h: number;
1675
+ apuBurnedLast24h: number;
1676
+ migrationStatus: "pending" | "running" | "completed" | "failed";
1677
+ }, {
1678
+ hostId: string;
1679
+ merkleRootHex: string | null;
1680
+ merkleLeafCount: number | null;
1681
+ generatedAt: string;
1682
+ snapshotRev: number;
1683
+ sid: string | null;
1684
+ txsLast24h: number;
1685
+ apuMintedLast24h: number;
1686
+ apuBurnedLast24h: number;
1687
+ migrationStatus: "pending" | "running" | "completed" | "failed";
1688
+ }>;
1689
+ type ScannerHead = z.infer<typeof ScannerHeadSchema>;
1690
+ declare const ScannerNodeProfileSchema: z.ZodObject<{
1691
+ nodeId: z.ZodString;
1692
+ kind: z.ZodEnum<["main", "agent", "unknown"]>;
1693
+ generatedAt: z.ZodString;
1694
+ wallet: z.ZodNullable<z.ZodObject<{
1695
+ balanceUsd: z.ZodNumber;
1696
+ powerUps: z.ZodNumber;
1697
+ currency: z.ZodLiteral<"USD">;
1698
+ updatedAt: z.ZodString;
1699
+ }, "strip", z.ZodTypeAny, {
1700
+ balanceUsd: number;
1701
+ currency: "USD";
1702
+ updatedAt: string;
1703
+ powerUps: number;
1704
+ }, {
1705
+ balanceUsd: number;
1706
+ currency: "USD";
1707
+ updatedAt: string;
1708
+ powerUps: number;
1709
+ }>>;
1710
+ ledger: z.ZodObject<{
1711
+ txCount: z.ZodNumber;
1712
+ usdSpent: z.ZodNumber;
1713
+ apuMinted: z.ZodNumber;
1714
+ apuBurned: z.ZodNumber;
1715
+ lastTxAt: z.ZodNullable<z.ZodString>;
1716
+ }, "strip", z.ZodTypeAny, {
1717
+ txCount: number;
1718
+ usdSpent: number;
1719
+ apuMinted: number;
1720
+ apuBurned: number;
1721
+ lastTxAt: string | null;
1722
+ }, {
1723
+ txCount: number;
1724
+ usdSpent: number;
1725
+ apuMinted: number;
1726
+ apuBurned: number;
1727
+ lastTxAt: string | null;
1728
+ }>;
1729
+ breakdown: z.ZodObject<{
1730
+ byAmenityKind: z.ZodRecord<z.ZodString, z.ZodNumber>;
1731
+ bySpaceId: z.ZodRecord<z.ZodString, z.ZodNumber>;
1732
+ byToken: z.ZodObject<{
1733
+ usd: z.ZodNumber;
1734
+ apu: z.ZodNumber;
1735
+ }, "strip", z.ZodTypeAny, {
1736
+ apu: number;
1737
+ usd: number;
1738
+ }, {
1739
+ apu: number;
1740
+ usd: number;
1741
+ }>;
1742
+ }, "strip", z.ZodTypeAny, {
1743
+ byAmenityKind: Record<string, number>;
1744
+ bySpaceId: Record<string, number>;
1745
+ byToken: {
1746
+ apu: number;
1747
+ usd: number;
1748
+ };
1749
+ }, {
1750
+ byAmenityKind: Record<string, number>;
1751
+ bySpaceId: Record<string, number>;
1752
+ byToken: {
1753
+ apu: number;
1754
+ usd: number;
1755
+ };
1756
+ }>;
1757
+ txs: z.ZodArray<z.ZodObject<{
1758
+ id: z.ZodString;
1759
+ playerId: z.ZodString;
1760
+ spaceId: z.ZodString;
1761
+ amenityKind: z.ZodEnum<["shop", "supermarket", "car_wash", "talk_time", "wallet_bundle", "apu_credit", "apu_debit"]>;
1762
+ itemRef: z.ZodObject<{
1763
+ kind: z.ZodEnum<["shop", "supermarket", "carwash", "game", "apu", "talk", "bundle"]>;
1764
+ id: z.ZodString;
1765
+ }, "strip", z.ZodTypeAny, {
1766
+ id: string;
1767
+ kind: "supermarket" | "shop" | "carwash" | "game" | "apu" | "talk" | "bundle";
1768
+ }, {
1769
+ id: string;
1770
+ kind: "supermarket" | "shop" | "carwash" | "game" | "apu" | "talk" | "bundle";
1771
+ }>;
1772
+ priceUsd: z.ZodOptional<z.ZodNumber>;
1773
+ at: z.ZodString;
1774
+ detail: z.ZodOptional<z.ZodString>;
1775
+ powerUpsSpent: z.ZodOptional<z.ZodNumber>;
1776
+ powerUpsEarned: z.ZodOptional<z.ZodNumber>;
1777
+ powerUpsDelta: z.ZodOptional<z.ZodNumber>;
1778
+ debitSource: z.ZodOptional<z.ZodString>;
1779
+ creditSource: z.ZodOptional<z.ZodString>;
1780
+ counterpartyNodeId: z.ZodOptional<z.ZodString>;
1781
+ token: z.ZodOptional<z.ZodLiteral<"APU">>;
1782
+ } & {
1783
+ hostId: z.ZodString;
1784
+ indexedAt: z.ZodString;
1785
+ op: z.ZodEnum<["purchase", "redeemWalletBundle", "applyGameOutcome", "talkTick", "talkStop", "talkStart", "walletSeeded"]>;
1786
+ blockRev: z.ZodOptional<z.ZodNumber>;
1787
+ merkleRootHex: z.ZodOptional<z.ZodString>;
1788
+ }, "strip", z.ZodTypeAny, {
1789
+ at: string;
1790
+ id: string;
1791
+ spaceId: string;
1792
+ playerId: string;
1793
+ amenityKind: "supermarket" | "shop" | "car_wash" | "talk_time" | "wallet_bundle" | "apu_credit" | "apu_debit";
1794
+ itemRef: {
1795
+ id: string;
1796
+ kind: "supermarket" | "shop" | "carwash" | "game" | "apu" | "talk" | "bundle";
1797
+ };
1798
+ hostId: string;
1799
+ indexedAt: string;
1800
+ op: "purchase" | "redeemWalletBundle" | "applyGameOutcome" | "talkTick" | "talkStop" | "talkStart" | "walletSeeded";
1801
+ priceUsd?: number | undefined;
1802
+ detail?: string | undefined;
1803
+ powerUpsSpent?: number | undefined;
1804
+ powerUpsEarned?: number | undefined;
1805
+ powerUpsDelta?: number | undefined;
1806
+ debitSource?: string | undefined;
1807
+ creditSource?: string | undefined;
1808
+ counterpartyNodeId?: string | undefined;
1809
+ token?: "APU" | undefined;
1810
+ blockRev?: number | undefined;
1811
+ merkleRootHex?: string | undefined;
1812
+ }, {
1813
+ at: string;
1814
+ id: string;
1815
+ spaceId: string;
1816
+ playerId: string;
1817
+ amenityKind: "supermarket" | "shop" | "car_wash" | "talk_time" | "wallet_bundle" | "apu_credit" | "apu_debit";
1818
+ itemRef: {
1819
+ id: string;
1820
+ kind: "supermarket" | "shop" | "carwash" | "game" | "apu" | "talk" | "bundle";
1821
+ };
1822
+ hostId: string;
1823
+ indexedAt: string;
1824
+ op: "purchase" | "redeemWalletBundle" | "applyGameOutcome" | "talkTick" | "talkStop" | "talkStart" | "walletSeeded";
1825
+ priceUsd?: number | undefined;
1826
+ detail?: string | undefined;
1827
+ powerUpsSpent?: number | undefined;
1828
+ powerUpsEarned?: number | undefined;
1829
+ powerUpsDelta?: number | undefined;
1830
+ debitSource?: string | undefined;
1831
+ creditSource?: string | undefined;
1832
+ counterpartyNodeId?: string | undefined;
1833
+ token?: "APU" | undefined;
1834
+ blockRev?: number | undefined;
1835
+ merkleRootHex?: string | undefined;
1836
+ }>, "many">;
1837
+ txsNextCursor: z.ZodNullable<z.ZodString>;
1838
+ gameStats: z.ZodNullable<z.ZodObject<{
1839
+ dayStreak: z.ZodNumber;
1840
+ bestStreak: z.ZodNumber;
1841
+ puEarnedToday: z.ZodNumber;
1842
+ puCapRemaining: z.ZodNumber;
1843
+ gamesPlayedToday: z.ZodNumber;
1844
+ featuredGameId: z.ZodString;
1845
+ firstGamePlayed: z.ZodBoolean;
1846
+ perGame: z.ZodRecord<z.ZodString, z.ZodObject<{
1847
+ plays: z.ZodNumber;
1848
+ bestNetPu: z.ZodNumber;
1849
+ }, "strip", z.ZodTypeAny, {
1850
+ plays: number;
1851
+ bestNetPu: number;
1852
+ }, {
1853
+ plays: number;
1854
+ bestNetPu: number;
1855
+ }>>;
1856
+ }, "strip", z.ZodTypeAny, {
1857
+ dayStreak: number;
1858
+ bestStreak: number;
1859
+ puEarnedToday: number;
1860
+ puCapRemaining: number;
1861
+ gamesPlayedToday: number;
1862
+ featuredGameId: string;
1863
+ firstGamePlayed: boolean;
1864
+ perGame: Record<string, {
1865
+ plays: number;
1866
+ bestNetPu: number;
1867
+ }>;
1868
+ }, {
1869
+ dayStreak: number;
1870
+ bestStreak: number;
1871
+ puEarnedToday: number;
1872
+ puCapRemaining: number;
1873
+ gamesPlayedToday: number;
1874
+ featuredGameId: string;
1875
+ firstGamePlayed: boolean;
1876
+ perGame: Record<string, {
1877
+ plays: number;
1878
+ bestNetPu: number;
1879
+ }>;
1880
+ }>>;
1881
+ analyticsEvents: z.ZodArray<z.ZodObject<{
1882
+ messageId: z.ZodString;
1883
+ event: z.ZodString;
1884
+ distinctId: z.ZodString;
1885
+ timestamp: z.ZodString;
1886
+ properties: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
1887
+ }, "strip", z.ZodTypeAny, {
1888
+ event: string;
1889
+ messageId: string;
1890
+ distinctId: string;
1891
+ timestamp: string;
1892
+ properties: Record<string, string | number | boolean | null>;
1893
+ }, {
1894
+ event: string;
1895
+ messageId: string;
1896
+ distinctId: string;
1897
+ timestamp: string;
1898
+ properties: Record<string, string | number | boolean | null>;
1899
+ }>, "many">;
1900
+ analyticsEventsNextCursor: z.ZodNullable<z.ZodString>;
1901
+ analytics: z.ZodObject<{
1902
+ eventsLast24h: z.ZodNumber;
1903
+ topEvents: z.ZodArray<z.ZodObject<{
1904
+ event: z.ZodString;
1905
+ count: z.ZodNumber;
1906
+ }, "strip", z.ZodTypeAny, {
1907
+ event: string;
1908
+ count: number;
1909
+ }, {
1910
+ event: string;
1911
+ count: number;
1912
+ }>, "many">;
1913
+ }, "strip", z.ZodTypeAny, {
1914
+ eventsLast24h: number;
1915
+ topEvents: {
1916
+ event: string;
1917
+ count: number;
1918
+ }[];
1919
+ }, {
1920
+ eventsLast24h: number;
1921
+ topEvents: {
1922
+ event: string;
1923
+ count: number;
1924
+ }[];
1925
+ }>;
1926
+ traits: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
1927
+ }, "strip", z.ZodTypeAny, {
1928
+ kind: "agent" | "unknown" | "main";
1929
+ generatedAt: string;
1930
+ nodeId: string;
1931
+ wallet: {
1932
+ balanceUsd: number;
1933
+ currency: "USD";
1934
+ updatedAt: string;
1935
+ powerUps: number;
1936
+ } | null;
1937
+ ledger: {
1938
+ txCount: number;
1939
+ usdSpent: number;
1940
+ apuMinted: number;
1941
+ apuBurned: number;
1942
+ lastTxAt: string | null;
1943
+ };
1944
+ breakdown: {
1945
+ byAmenityKind: Record<string, number>;
1946
+ bySpaceId: Record<string, number>;
1947
+ byToken: {
1948
+ apu: number;
1949
+ usd: number;
1950
+ };
1951
+ };
1952
+ txs: {
1953
+ at: string;
1954
+ id: string;
1955
+ spaceId: string;
1956
+ playerId: string;
1957
+ amenityKind: "supermarket" | "shop" | "car_wash" | "talk_time" | "wallet_bundle" | "apu_credit" | "apu_debit";
1958
+ itemRef: {
1959
+ id: string;
1960
+ kind: "supermarket" | "shop" | "carwash" | "game" | "apu" | "talk" | "bundle";
1961
+ };
1962
+ hostId: string;
1963
+ indexedAt: string;
1964
+ op: "purchase" | "redeemWalletBundle" | "applyGameOutcome" | "talkTick" | "talkStop" | "talkStart" | "walletSeeded";
1965
+ priceUsd?: number | undefined;
1966
+ detail?: string | undefined;
1967
+ powerUpsSpent?: number | undefined;
1968
+ powerUpsEarned?: number | undefined;
1969
+ powerUpsDelta?: number | undefined;
1970
+ debitSource?: string | undefined;
1971
+ creditSource?: string | undefined;
1972
+ counterpartyNodeId?: string | undefined;
1973
+ token?: "APU" | undefined;
1974
+ blockRev?: number | undefined;
1975
+ merkleRootHex?: string | undefined;
1976
+ }[];
1977
+ txsNextCursor: string | null;
1978
+ gameStats: {
1979
+ dayStreak: number;
1980
+ bestStreak: number;
1981
+ puEarnedToday: number;
1982
+ puCapRemaining: number;
1983
+ gamesPlayedToday: number;
1984
+ featuredGameId: string;
1985
+ firstGamePlayed: boolean;
1986
+ perGame: Record<string, {
1987
+ plays: number;
1988
+ bestNetPu: number;
1989
+ }>;
1990
+ } | null;
1991
+ analyticsEvents: {
1992
+ event: string;
1993
+ messageId: string;
1994
+ distinctId: string;
1995
+ timestamp: string;
1996
+ properties: Record<string, string | number | boolean | null>;
1997
+ }[];
1998
+ analyticsEventsNextCursor: string | null;
1999
+ analytics: {
2000
+ eventsLast24h: number;
2001
+ topEvents: {
2002
+ event: string;
2003
+ count: number;
2004
+ }[];
2005
+ };
2006
+ traits: Record<string, string | number | boolean | null>;
2007
+ }, {
2008
+ kind: "agent" | "unknown" | "main";
2009
+ generatedAt: string;
2010
+ nodeId: string;
2011
+ wallet: {
2012
+ balanceUsd: number;
2013
+ currency: "USD";
2014
+ updatedAt: string;
2015
+ powerUps: number;
2016
+ } | null;
2017
+ ledger: {
2018
+ txCount: number;
2019
+ usdSpent: number;
2020
+ apuMinted: number;
2021
+ apuBurned: number;
2022
+ lastTxAt: string | null;
2023
+ };
2024
+ breakdown: {
2025
+ byAmenityKind: Record<string, number>;
2026
+ bySpaceId: Record<string, number>;
2027
+ byToken: {
2028
+ apu: number;
2029
+ usd: number;
2030
+ };
2031
+ };
2032
+ txs: {
2033
+ at: string;
2034
+ id: string;
2035
+ spaceId: string;
2036
+ playerId: string;
2037
+ amenityKind: "supermarket" | "shop" | "car_wash" | "talk_time" | "wallet_bundle" | "apu_credit" | "apu_debit";
2038
+ itemRef: {
2039
+ id: string;
2040
+ kind: "supermarket" | "shop" | "carwash" | "game" | "apu" | "talk" | "bundle";
2041
+ };
2042
+ hostId: string;
2043
+ indexedAt: string;
2044
+ op: "purchase" | "redeemWalletBundle" | "applyGameOutcome" | "talkTick" | "talkStop" | "talkStart" | "walletSeeded";
2045
+ priceUsd?: number | undefined;
2046
+ detail?: string | undefined;
2047
+ powerUpsSpent?: number | undefined;
2048
+ powerUpsEarned?: number | undefined;
2049
+ powerUpsDelta?: number | undefined;
2050
+ debitSource?: string | undefined;
2051
+ creditSource?: string | undefined;
2052
+ counterpartyNodeId?: string | undefined;
2053
+ token?: "APU" | undefined;
2054
+ blockRev?: number | undefined;
2055
+ merkleRootHex?: string | undefined;
2056
+ }[];
2057
+ txsNextCursor: string | null;
2058
+ gameStats: {
2059
+ dayStreak: number;
2060
+ bestStreak: number;
2061
+ puEarnedToday: number;
2062
+ puCapRemaining: number;
2063
+ gamesPlayedToday: number;
2064
+ featuredGameId: string;
2065
+ firstGamePlayed: boolean;
2066
+ perGame: Record<string, {
2067
+ plays: number;
2068
+ bestNetPu: number;
2069
+ }>;
2070
+ } | null;
2071
+ analyticsEvents: {
2072
+ event: string;
2073
+ messageId: string;
2074
+ distinctId: string;
2075
+ timestamp: string;
2076
+ properties: Record<string, string | number | boolean | null>;
2077
+ }[];
2078
+ analyticsEventsNextCursor: string | null;
2079
+ analytics: {
2080
+ eventsLast24h: number;
2081
+ topEvents: {
2082
+ event: string;
2083
+ count: number;
2084
+ }[];
2085
+ };
2086
+ traits: Record<string, string | number | boolean | null>;
2087
+ }>;
2088
+ type ScannerNodeProfile = z.infer<typeof ScannerNodeProfileSchema>;
2089
+
2090
+ declare const AnalyticsPropertyValueSchema: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
2091
+ type AnalyticsPropertyValue = z.infer<typeof AnalyticsPropertyValueSchema>;
2092
+ declare const AnalyticsContextSchema: z.ZodObject<{
2093
+ hostId: z.ZodString;
2094
+ sid: z.ZodOptional<z.ZodString>;
2095
+ snapshotRev: z.ZodOptional<z.ZodNumber>;
2096
+ library: z.ZodEnum<["agent-play-server", "agent-play-client"]>;
2097
+ }, "strip", z.ZodTypeAny, {
2098
+ hostId: string;
2099
+ library: "agent-play-server" | "agent-play-client";
2100
+ snapshotRev?: number | undefined;
2101
+ sid?: string | undefined;
2102
+ }, {
2103
+ hostId: string;
2104
+ library: "agent-play-server" | "agent-play-client";
2105
+ snapshotRev?: number | undefined;
2106
+ sid?: string | undefined;
2107
+ }>;
2108
+ type AnalyticsContext = z.infer<typeof AnalyticsContextSchema>;
2109
+ /**
2110
+ * Segment-style track envelope for in-platform analytics.
2111
+ *
2112
+ * @public
2113
+ */
2114
+ declare const AnalyticsEventSchema: z.ZodObject<{
2115
+ messageId: z.ZodString;
2116
+ event: z.ZodString;
2117
+ distinctId: z.ZodString;
2118
+ timestamp: z.ZodString;
2119
+ properties: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
2120
+ context: z.ZodOptional<z.ZodObject<{
2121
+ hostId: z.ZodString;
2122
+ sid: z.ZodOptional<z.ZodString>;
2123
+ snapshotRev: z.ZodOptional<z.ZodNumber>;
2124
+ library: z.ZodEnum<["agent-play-server", "agent-play-client"]>;
2125
+ }, "strip", z.ZodTypeAny, {
2126
+ hostId: string;
2127
+ library: "agent-play-server" | "agent-play-client";
2128
+ snapshotRev?: number | undefined;
2129
+ sid?: string | undefined;
2130
+ }, {
2131
+ hostId: string;
2132
+ library: "agent-play-server" | "agent-play-client";
2133
+ snapshotRev?: number | undefined;
2134
+ sid?: string | undefined;
2135
+ }>>;
2136
+ }, "strip", z.ZodTypeAny, {
2137
+ event: string;
2138
+ messageId: string;
2139
+ distinctId: string;
2140
+ timestamp: string;
2141
+ properties: Record<string, string | number | boolean | null>;
2142
+ context?: {
2143
+ hostId: string;
2144
+ library: "agent-play-server" | "agent-play-client";
2145
+ snapshotRev?: number | undefined;
2146
+ sid?: string | undefined;
2147
+ } | undefined;
2148
+ }, {
2149
+ event: string;
2150
+ messageId: string;
2151
+ distinctId: string;
2152
+ timestamp: string;
2153
+ properties: Record<string, string | number | boolean | null>;
2154
+ context?: {
2155
+ hostId: string;
2156
+ library: "agent-play-server" | "agent-play-client";
2157
+ snapshotRev?: number | undefined;
2158
+ sid?: string | undefined;
2159
+ } | undefined;
2160
+ }>;
2161
+ type AnalyticsEvent = z.infer<typeof AnalyticsEventSchema>;
2162
+ /**
2163
+ * Segment-style identify envelope for node traits.
2164
+ *
2165
+ * @public
2166
+ */
2167
+ declare const AnalyticsTraitsSchema: z.ZodObject<{
2168
+ distinctId: z.ZodString;
2169
+ traits: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>;
2170
+ timestamp: z.ZodString;
2171
+ }, "strip", z.ZodTypeAny, {
2172
+ distinctId: string;
2173
+ timestamp: string;
2174
+ traits: Record<string, string | number | boolean | null>;
2175
+ }, {
2176
+ distinctId: string;
2177
+ timestamp: string;
2178
+ traits: Record<string, string | number | boolean | null>;
2179
+ }>;
2180
+ type AnalyticsTraits = z.infer<typeof AnalyticsTraitsSchema>;
2181
+ declare const AnalyticsMigrationStateSchema: z.ZodObject<{
2182
+ status: z.ZodEnum<["pending", "running", "completed", "failed"]>;
2183
+ cursor: z.ZodString;
2184
+ totalIndexed: z.ZodNumber;
2185
+ startedAt: z.ZodString;
2186
+ completedAt: z.ZodOptional<z.ZodString>;
2187
+ error: z.ZodOptional<z.ZodString>;
2188
+ }, "strip", z.ZodTypeAny, {
2189
+ status: "pending" | "running" | "completed" | "failed";
2190
+ cursor: string;
2191
+ totalIndexed: number;
2192
+ startedAt: string;
2193
+ completedAt?: string | undefined;
2194
+ error?: string | undefined;
2195
+ }, {
2196
+ status: "pending" | "running" | "completed" | "failed";
2197
+ cursor: string;
2198
+ totalIndexed: number;
2199
+ startedAt: string;
2200
+ completedAt?: string | undefined;
2201
+ error?: string | undefined;
2202
+ }>;
2203
+ type AnalyticsMigrationState = z.infer<typeof AnalyticsMigrationStateSchema>;
2204
+ declare const ANALYTICS_EVENT_NAMES: {
2205
+ readonly purchaseCompleted: "Purchase Completed";
2206
+ readonly walletBundleRedeemed: "Wallet Bundle Redeemed";
2207
+ readonly gameRoundCompleted: "Game Round Completed";
2208
+ readonly talkSessionStarted: "Talk Session Started";
2209
+ readonly talkSessionBilled: "Talk Session Billed";
2210
+ readonly talkSessionEnded: "Talk Session Ended";
2211
+ readonly walletSeeded: "Wallet Seeded";
2212
+ readonly spaceEntered: "Space Entered";
2213
+ readonly amenityEntered: "Amenity Entered";
2214
+ readonly worldJourneyRecorded: "World Journey Recorded";
2215
+ readonly worldInteractionRecorded: "World Interaction Recorded";
2216
+ readonly playerAdded: "Player Added";
2217
+ readonly chainRevisionPublished: "Chain Revision Published";
2218
+ readonly uiPresentationAction: "UI Presentation Action";
2219
+ readonly gameStageActivated: "Game Stage Activated";
2220
+ readonly scannerViewOpened: "Scanner View Opened";
2221
+ };
2222
+ type AnalyticsEventName = (typeof ANALYTICS_EVENT_NAMES)[keyof typeof ANALYTICS_EVENT_NAMES];
2223
+
2224
+ /**
2225
+ * Parses **`playerChainNotify`** envelopes and merges {@link PlayerChainNodeResponse} slices into {@link AgentPlaySnapshot} (pure functions + fetch ordering for serialized RPC).
2226
+ */
2227
+
2228
+ declare function sortNodeRefsForSerializedFetch(nodes: ReadonlyArray<PlayerChainNotifyNodeRef>): PlayerChainNotifyNodeRef[];
2229
+ declare function parsePlayerChainFanoutNotify(raw: unknown): PlayerChainFanoutNotify | undefined;
2230
+ declare function parsePlayerChainFanoutNotifyFromSsePayload(sseData: unknown): PlayerChainFanoutNotify | undefined;
2231
+ declare function parsePlayerChainNodeRpcBody(json: unknown): PlayerChainNodeResponse;
2232
+ declare function mergeSnapshotWithPlayerChainNode(snapshot: AgentPlaySnapshot, node: PlayerChainNodeResponse): AgentPlaySnapshot;
2233
+
2234
+ declare const PLAYER_CHAIN_GENESIS_STABLE_KEY: "__genesis__";
2235
+ declare const PLAYER_CHAIN_HEADER_STABLE_KEY: "__header__";
2236
+
2237
+ export { MINIMUM_STREET_LAYOUT_BOUNDS as $, type AgentPlaySnapshot as A, type AssistToolParameterSpec as B, type AssistToolSpec as C, CONTINUOUS_RENDER_OFFSET as D, type CarWashCar as E, CarWashCarSchema as F, type ComputeTalkAgentPowerUpsEarnedInput as G, DAILY_GAME_PU_CAP as H, DEFAULT_AGENT_SPAWN_MIN_DISTANCE as I, type Journey as J, DEFAULT_PLAYER_WALLET_BALANCE_USD as K, type LangChainAgentRegistration as L, type DestinationJourneyStep as M, GAME_CABINET_CATALOG as N, type GameCabinetEntry as O, type PlayerChainNodeResponse as P, type GameEvent as Q, type RemotePlayWorldInitAudioOptions as R, GameEventSchema as S, type GameId as T, type GamePerTitleStats as U, GamePerTitleStatsSchema as V, type WorldInteractionRole as W, type GameStats as X, GameStatsSchema as Y, type JourneyStep as Z, MINIMUM_PLAY_WORLD_BOUNDS as _, type AddAgentInput as a, type WalletBundleOffer as a$, OCCUPANCY_POINT_MULTIPLIER as a0, type OccupancyGridPoint as a1, type OccupantGroup as a2, type OriginJourneyStep as a3, type P2aEnableFlag as a4, PLAYABLE_GAME_IDS as a5, PLAYER_CHAIN_GENESIS_STABLE_KEY as a6, PLAYER_CHAIN_HEADER_STABLE_KEY as a7, type PlatformAgentInformation as a8, type PlayAgentInformation as a9, type ScannerMigrationState as aA, ScannerMigrationStateSchema as aB, type ScannerMigrationStatus as aC, ScannerMigrationStatusSchema as aD, type ScannerNodeProfile as aE, ScannerNodeProfileSchema as aF, type ScannerTxOp as aG, ScannerTxOpSchema as aH, type ScannerTxRecord as aI, ScannerTxRecordSchema as aJ, type ScannerWalletSnapshot as aK, ScannerWalletSnapshotSchema as aL, type ShopItem as aM, ShopItemSchema as aN, type SpaceContentItem as aO, type Street as aP, type StreetPoolEntry as aQ, type StructureJourneyStep as aR, type SupermarketItem as aS, SupermarketItemSchema as aT, TALK_AGENT_PU_BILLED_SECONDS_PER_UNIT as aU, TALK_AGENT_PU_MAX_PER_LEG as aV, TALK_PRICE_PER_60S_USD as aW, TALK_PRICE_PER_SECOND_USD as aX, TALK_TICK_SECONDS as aY, WALLET_BUNDLE_OFFERS as aZ, type WalletBundleId as a_, type PlayerChainFanoutNotify as aa, type PlayerChainGenesisNode as ab, type PlayerChainHeaderNode as ac, type PlayerChainNotifyNodeRef as ad, type PlayerChainOccupantPresentNode as ae, type PlayerChainOccupantRemovedNode as af, type PlayerWallet as ag, PlayerWalletSchema as ah, type PositionedStep as ai, type PurchaseRecord as aj, PurchaseRecordSchema as ak, type RealtimeWebrtcClientSecret as al, type RegisteredAgentSummary as am, type RemotePlayWorldOpenAiAudioOptions as an, SPACE_STRUCTURE_ANCHOR_MIN_DISTANCE as ao, SPATIAL_ZONE_INDEX_AGENTS as ap, SPATIAL_ZONE_INDEX_SPACES as aq, STREAK_BONUS_PU as ar, STREAK_BONUS_THRESHOLD_DAYS as as, STREET_NAME_POOL as at, type SaleState as au, SaleStateSchema as av, type ScannerBlockRecord as aw, ScannerBlockRecordSchema as ax, type ScannerHead as ay, ScannerHeadSchema as az, type RegisteredPlayer as b, sortNodeRefsForSerializedFetch as b$, type WorldBounds as b0, type WorldJourneyUpdate as b1, type WorldLayout as b2, type WorldLayoutBoundsField as b3, type YieldEventInfo as b4, type Zone as b5, type ZoneEventInfo as b6, applyBoundsFieldUpdateToLayout as b7, availableCellsForZone as b8, boundingWorldRectForOccupancyPoints as b9, getWalletBundleById as bA, isAgentSpawnOccupancyPointAvailable as bB, isAgentSpawnOccupancyPointAvailableInRect as bC, isAgentSpawnOccupancyPointAvailableInZone as bD, isGameId as bE, isItemAvailableForPurchase as bF, isSpaceAnchorOccupancyPointAvailable as bG, isSpaceAnchorOccupancyPointAvailableInRect as bH, isSpaceAnchorOccupancyPointAvailableInZone as bI, listAllowedOccupancyPoints as bJ, listOccupancyPointsForSpatialZone as bK, listOccupancyPointsForZone as bL, listOccupancyPointsInRect as bM, mergeSnapshotWithPlayerChainNode as bN, migrateWorldLayoutBounds as bO, nextStreetFromPool as bP, occupancyKeyForPosition as bQ, occupancyPointsGroupedBySpatialZone as bR, occupancyPointsGroupedByZones as bS, parsePlayerChainFanoutNotify as bT, parsePlayerChainFanoutNotifyFromSsePayload as bU, parsePlayerChainNodeRpcBody as bV, pickZoneForGroup as bW, pointCellInRect as bX, pointCellInSpatialZone as bY, pointCellInZone as bZ, primaryZoneForGroup as b_, boundsContain as ba, buildAmenityPurchaseApuFields as bb, buildApuWalletTransaction as bc, buildRankedOccupancyPoints as bd, buildRankedOccupancyPointsForSpatialZone as be, buildRankedOccupancyPointsForZone as bf, buildRankedOccupancyPointsInRect as bg, buildWalletBundleApuFields as bh, cellsForZone as bi, centerOfZone as bj, clampWorldPosition as bk, computeEventPuDelta as bl, computeRoundPuDelta as bm, computeTalkAgentPowerUpsEarned as bn, costForSeconds as bo, createEmptyGameStats as bp, createInitialAgentRewardWallet as bq, createInitialPlayerWallet as br, createVerticalStripSeedLayout as bs, desaturateColor as bt, enumerateIntegerCellsInRect as bu, expandBoundsToMinimumPlayArea as bv, featuredGameIdForUtcDate as bw, getGameCabinetByGameId as bx, getGameCabinetById as by, getStreetPoolEntryById as bz, type AddPlayerInput as c, spatialZoneBounds as c0, spatialZoneCenter as c1, streetFromPoolEntry as c2, utcDateKey as c3, zonesForGroup as c4, type RecordInteractionInput as d, ANALYTICS_EVENT_NAMES as e, APU_TOKEN as f, type AgentPlayWorldLayout as g, type AgentPlayWorldLayoutZone as h, type AgentPlayWorldMap as i, type AgentPlayWorldMapAgentOccupant as j, type AgentPlayWorldMapBounds as k, type AgentPlayWorldMapMcpOccupant as l, type AnalyticsContext as m, AnalyticsContextSchema as n, type AnalyticsEvent as o, type AnalyticsEventName as p, AnalyticsEventSchema as q, type AnalyticsMigrationState as r, AnalyticsMigrationStateSchema as s, type AnalyticsPropertyValue as t, AnalyticsPropertyValueSchema as u, type AnalyticsTraits as v, AnalyticsTraitsSchema as w, type ApplyGameOutcomeInput as x, ApplyGameOutcomeInputSchema as y, type AssistToolFieldType as z };