@agent-play/sdk 3.3.3 → 3.3.7

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.
@@ -225,15 +225,16 @@ type AgentPlayWorldMapBounds = {
225
225
  maxY: number;
226
226
  };
227
227
  /**
228
- * One agent on the world map. Coordinates are grid positions; the server enforces unique `(x,y)` per occupant.
228
+ * 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.
229
229
  */
230
230
  type AgentPlayWorldMapAgentOccupant = {
231
231
  kind: "agent";
232
232
  nodeId?: string;
233
233
  agentId: string;
234
234
  name: string;
235
- x: number;
236
- y: number;
235
+ streetId?: string;
236
+ x?: number;
237
+ y?: number;
237
238
  /**
238
239
  * 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.
239
240
  */
@@ -416,6 +417,11 @@ type WorldBounds = {
416
417
  };
417
418
  /** Minimum playable span aligned with the watch canvas scrolling world (~20×20 cells). */
418
419
  declare const MINIMUM_PLAY_WORLD_BOUNDS: WorldBounds;
420
+ /**
421
+ * Default bounds for {@link createVerticalStripSeedLayout} (street / zone map).
422
+ * Shorter on Y than {@link MINIMUM_PLAY_WORLD_BOUNDS}: three vertical strips across span X = 20, height 3.
423
+ */
424
+ declare const MINIMUM_STREET_LAYOUT_BOUNDS: WorldBounds;
419
425
  declare function expandBoundsToMinimumPlayArea(bounds: WorldBounds): WorldBounds;
420
426
  /**
421
427
  * Clamps a point to lie inside `bounds` along both axes.
@@ -450,6 +456,7 @@ type OccupancyGridPoint = {
450
456
  declare const OCCUPANCY_POINT_MULTIPLIER = 5;
451
457
  declare const CONTINUOUS_RENDER_OFFSET = 0.2;
452
458
  declare const DEFAULT_AGENT_SPAWN_MIN_DISTANCE = 0.9;
459
+ declare const SPACE_STRUCTURE_ANCHOR_MIN_DISTANCE = 2.1;
453
460
  /** @deprecated Prefer {@link WorldLayout} zones from snapshot; quartile geometry is legacy. */
454
461
  declare const SPATIAL_ZONE_INDEX_AGENTS = 0;
455
462
  /** @deprecated Prefer {@link WorldLayout} zones from snapshot; quartile geometry is legacy. */
@@ -801,8 +808,8 @@ declare const SupermarketItemSchema: z.ZodObject<{
801
808
  soldToPlayerId?: string | undefined;
802
809
  soldAt?: string | undefined;
803
810
  };
804
- row: 1 | 2 | 3 | 4;
805
- column: 1 | 5 | 2 | 3 | 4;
811
+ row: 2 | 1 | 3 | 4;
812
+ column: 2 | 1 | 5 | 3 | 4;
806
813
  }, {
807
814
  id: string;
808
815
  spaceId: string;
@@ -815,8 +822,8 @@ declare const SupermarketItemSchema: z.ZodObject<{
815
822
  soldToPlayerId?: string | undefined;
816
823
  soldAt?: string | undefined;
817
824
  };
818
- row: 1 | 2 | 3 | 4;
819
- column: 1 | 5 | 2 | 3 | 4;
825
+ row: 2 | 1 | 3 | 4;
826
+ column: 2 | 1 | 5 | 3 | 4;
820
827
  }>;
821
828
  /** Runtime type for {@link SupermarketItemSchema}. @public */
822
829
  type SupermarketItem = z.infer<typeof SupermarketItemSchema>;
@@ -879,7 +886,7 @@ declare const CarWashCarSchema: z.ZodObject<{
879
886
  soldToPlayerId?: string | undefined;
880
887
  soldAt?: string | undefined;
881
888
  };
882
- slot: 1 | 5 | 2 | 3 | 7 | 6 | 4 | 8 | 9;
889
+ slot: 2 | 1 | 5 | 3 | 7 | 6 | 4 | 8 | 9;
883
890
  model: string;
884
891
  year: number;
885
892
  colorHex: string;
@@ -894,7 +901,7 @@ declare const CarWashCarSchema: z.ZodObject<{
894
901
  soldToPlayerId?: string | undefined;
895
902
  soldAt?: string | undefined;
896
903
  };
897
- slot: 1 | 5 | 2 | 3 | 7 | 6 | 4 | 8 | 9;
904
+ slot: 2 | 1 | 5 | 3 | 7 | 6 | 4 | 8 | 9;
898
905
  model: string;
899
906
  year: number;
900
907
  colorHex: string;
@@ -928,16 +935,19 @@ declare const PlayerWalletSchema: z.ZodObject<{
928
935
  balanceUsd: z.ZodNumber;
929
936
  currency: z.ZodLiteral<"USD">;
930
937
  updatedAt: z.ZodString;
938
+ powerUps: z.ZodDefault<z.ZodNumber>;
931
939
  }, "strip", z.ZodTypeAny, {
932
940
  playerId: string;
933
941
  balanceUsd: number;
934
942
  currency: "USD";
935
943
  updatedAt: string;
944
+ powerUps: number;
936
945
  }, {
937
946
  playerId: string;
938
947
  balanceUsd: number;
939
948
  currency: "USD";
940
949
  updatedAt: string;
950
+ powerUps?: number | undefined;
941
951
  }>;
942
952
  /** Runtime type for {@link PlayerWalletSchema}. @public */
943
953
  type PlayerWallet = z.infer<typeof PlayerWalletSchema>;
@@ -960,6 +970,10 @@ declare function createInitialPlayerWallet(input: {
960
970
  playerId: string;
961
971
  now: string;
962
972
  }): PlayerWallet;
973
+ declare function createInitialAgentRewardWallet(input: {
974
+ playerId: string;
975
+ now: string;
976
+ }): PlayerWallet;
963
977
  /**
964
978
  * Audit record appended each time a player completes a purchase.
965
979
  *
@@ -973,7 +987,7 @@ declare const PurchaseRecordSchema: z.ZodObject<{
973
987
  id: z.ZodString;
974
988
  playerId: z.ZodString;
975
989
  spaceId: z.ZodString;
976
- amenityKind: z.ZodEnum<["shop", "supermarket", "car_wash"]>;
990
+ amenityKind: z.ZodEnum<["shop", "supermarket", "car_wash", "talk_time", "wallet_bundle"]>;
977
991
  itemRef: z.ZodObject<{
978
992
  kind: z.ZodEnum<["shop", "supermarket", "carwash"]>;
979
993
  id: z.ZodString;
@@ -986,28 +1000,34 @@ declare const PurchaseRecordSchema: z.ZodObject<{
986
1000
  }>;
987
1001
  priceUsd: z.ZodNumber;
988
1002
  at: z.ZodString;
1003
+ detail: z.ZodOptional<z.ZodString>;
1004
+ powerUpsSpent: z.ZodOptional<z.ZodNumber>;
989
1005
  }, "strip", z.ZodTypeAny, {
990
1006
  at: string;
991
1007
  id: string;
992
1008
  spaceId: string;
993
1009
  priceUsd: number;
994
1010
  playerId: string;
995
- amenityKind: "supermarket" | "shop" | "car_wash";
1011
+ amenityKind: "supermarket" | "shop" | "car_wash" | "talk_time" | "wallet_bundle";
996
1012
  itemRef: {
997
1013
  id: string;
998
1014
  kind: "supermarket" | "shop" | "carwash";
999
1015
  };
1016
+ detail?: string | undefined;
1017
+ powerUpsSpent?: number | undefined;
1000
1018
  }, {
1001
1019
  at: string;
1002
1020
  id: string;
1003
1021
  spaceId: string;
1004
1022
  priceUsd: number;
1005
1023
  playerId: string;
1006
- amenityKind: "supermarket" | "shop" | "car_wash";
1024
+ amenityKind: "supermarket" | "shop" | "car_wash" | "talk_time" | "wallet_bundle";
1007
1025
  itemRef: {
1008
1026
  id: string;
1009
1027
  kind: "supermarket" | "shop" | "carwash";
1010
1028
  };
1029
+ detail?: string | undefined;
1030
+ powerUpsSpent?: number | undefined;
1011
1031
  }>;
1012
1032
  /** Runtime type for {@link PurchaseRecordSchema}. @public */
1013
1033
  type PurchaseRecord = z.infer<typeof PurchaseRecordSchema>;
@@ -1062,6 +1082,28 @@ type SpaceContentItem = ShopItem | SupermarketItem | CarWashCar;
1062
1082
  */
1063
1083
  declare function desaturateColor(hex: number): number;
1064
1084
 
1085
+ declare const TALK_PRICE_PER_60S_USD = 1.5;
1086
+ declare const TALK_PRICE_PER_SECOND_USD = 0.025;
1087
+ declare const TALK_TICK_SECONDS = 10;
1088
+ declare const costForSeconds: (seconds: number) => number;
1089
+
1090
+ declare const TALK_AGENT_PU_BILLED_SECONDS_PER_UNIT = 10;
1091
+ declare const TALK_AGENT_PU_MAX_PER_LEG = 5;
1092
+ type ComputeTalkAgentPowerUpsEarnedInput = {
1093
+ billedWholeSeconds: number;
1094
+ costUsd: number;
1095
+ };
1096
+ declare const computeTalkAgentPowerUpsEarned: (input: ComputeTalkAgentPowerUpsEarnedInput) => number;
1097
+
1098
+ type WalletBundleId = "bundle-10" | "bundle-20" | "bundle-50" | "bundle-100";
1099
+ type WalletBundleOffer = {
1100
+ readonly id: WalletBundleId;
1101
+ readonly powerUpsCost: number;
1102
+ readonly creditUsd: number;
1103
+ };
1104
+ declare const WALLET_BUNDLE_OFFERS: readonly WalletBundleOffer[];
1105
+ declare const getWalletBundleById: (id: string) => WalletBundleOffer | undefined;
1106
+
1065
1107
  /**
1066
1108
  * Parses **`playerChainNotify`** envelopes and merges {@link PlayerChainNodeResponse} slices into {@link AgentPlaySnapshot} (pure functions + fetch ordering for serialized RPC).
1067
1109
  */
@@ -1075,4 +1117,4 @@ declare function mergeSnapshotWithPlayerChainNode(snapshot: AgentPlaySnapshot, n
1075
1117
  declare const PLAYER_CHAIN_GENESIS_STABLE_KEY: "__genesis__";
1076
1118
  declare const PLAYER_CHAIN_HEADER_STABLE_KEY: "__header__";
1077
1119
 
1078
- export { type SaleState as $, type AgentPlaySnapshot as A, type PlayerChainFanoutNotify as B, CONTINUOUS_RENDER_OFFSET as C, DEFAULT_AGENT_SPAWN_MIN_DISTANCE as D, type PlayerChainGenesisNode as E, type PlayerChainHeaderNode as F, type PlayerChainNotifyNodeRef as G, type PlayerChainOccupantPresentNode as H, type PlayerChainOccupantRemovedNode as I, type Journey as J, type PlayerWallet as K, type LangChainAgentRegistration as L, MINIMUM_PLAY_WORLD_BOUNDS as M, PlayerWalletSchema as N, OCCUPANCY_POINT_MULTIPLIER as O, type PlayerChainNodeResponse as P, type PositionedStep as Q, type RemotePlayWorldInitAudioOptions as R, type PurchaseRecord as S, PurchaseRecordSchema as T, type RealtimeWebrtcClientSecret as U, type RegisteredAgentSummary as V, type WorldInteractionRole as W, type RemotePlayWorldOpenAiAudioOptions as X, SPATIAL_ZONE_INDEX_AGENTS as Y, SPATIAL_ZONE_INDEX_SPACES as Z, STREET_NAME_POOL as _, type AddAgentInput as a, SaleStateSchema as a0, type ShopItem as a1, ShopItemSchema as a2, type SpaceContentItem as a3, type Street as a4, type StreetPoolEntry as a5, type StructureJourneyStep as a6, type SupermarketItem as a7, SupermarketItemSchema as a8, type WorldBounds as a9, isItemAvailableForPurchase as aA, isSpaceAnchorOccupancyPointAvailable as aB, isSpaceAnchorOccupancyPointAvailableInRect as aC, isSpaceAnchorOccupancyPointAvailableInZone as aD, listAllowedOccupancyPoints as aE, listOccupancyPointsForSpatialZone as aF, listOccupancyPointsForZone as aG, listOccupancyPointsInRect as aH, mergeSnapshotWithPlayerChainNode as aI, migrateWorldLayoutBounds as aJ, nextStreetFromPool as aK, occupancyKeyForPosition as aL, occupancyPointsGroupedBySpatialZone as aM, occupancyPointsGroupedByZones as aN, parsePlayerChainFanoutNotify as aO, parsePlayerChainFanoutNotifyFromSsePayload as aP, parsePlayerChainNodeRpcBody as aQ, pickZoneForGroup as aR, pointCellInRect as aS, pointCellInSpatialZone as aT, pointCellInZone as aU, primaryZoneForGroup as aV, sortNodeRefsForSerializedFetch as aW, spatialZoneBounds as aX, spatialZoneCenter as aY, streetFromPoolEntry as aZ, zonesForGroup as a_, type WorldJourneyUpdate as aa, type WorldLayout as ab, type WorldLayoutBoundsField as ac, type YieldEventInfo as ad, type Zone as ae, type ZoneEventInfo as af, applyBoundsFieldUpdateToLayout as ag, availableCellsForZone as ah, boundingWorldRectForOccupancyPoints as ai, boundsContain as aj, buildRankedOccupancyPoints as ak, buildRankedOccupancyPointsForSpatialZone as al, buildRankedOccupancyPointsForZone as am, buildRankedOccupancyPointsInRect as an, cellsForZone as ao, centerOfZone as ap, clampWorldPosition as aq, createInitialPlayerWallet as ar, createVerticalStripSeedLayout as as, desaturateColor as at, enumerateIntegerCellsInRect as au, expandBoundsToMinimumPlayArea as av, getStreetPoolEntryById as aw, isAgentSpawnOccupancyPointAvailable as ax, isAgentSpawnOccupancyPointAvailableInRect as ay, isAgentSpawnOccupancyPointAvailableInZone as az, type RegisteredPlayer as b, type AddPlayerInput as c, type RecordInteractionInput as d, type AgentPlayWorldLayout as e, type AgentPlayWorldLayoutZone as f, type AgentPlayWorldMap as g, type AgentPlayWorldMapAgentOccupant as h, type AgentPlayWorldMapBounds as i, type AgentPlayWorldMapMcpOccupant as j, type AssistToolFieldType as k, type AssistToolParameterSpec as l, type AssistToolSpec as m, type CarWashCar as n, CarWashCarSchema as o, DEFAULT_PLAYER_WALLET_BALANCE_USD as p, type DestinationJourneyStep as q, type JourneyStep as r, type OccupancyGridPoint as s, type OccupantGroup as t, type OriginJourneyStep as u, type P2aEnableFlag as v, PLAYER_CHAIN_GENESIS_STABLE_KEY as w, PLAYER_CHAIN_HEADER_STABLE_KEY as x, type PlatformAgentInformation as y, type PlayAgentInformation as z };
1120
+ export { SPATIAL_ZONE_INDEX_AGENTS as $, type AgentPlaySnapshot as A, type PlatformAgentInformation as B, CONTINUOUS_RENDER_OFFSET as C, DEFAULT_AGENT_SPAWN_MIN_DISTANCE as D, type PlayAgentInformation as E, type PlayerChainFanoutNotify as F, type PlayerChainGenesisNode as G, type PlayerChainHeaderNode as H, type PlayerChainNotifyNodeRef as I, type Journey as J, type PlayerChainOccupantPresentNode as K, type LangChainAgentRegistration as L, MINIMUM_PLAY_WORLD_BOUNDS as M, type PlayerChainOccupantRemovedNode as N, OCCUPANCY_POINT_MULTIPLIER as O, type PlayerChainNodeResponse as P, type PlayerWallet as Q, type RemotePlayWorldInitAudioOptions as R, PlayerWalletSchema as S, type PositionedStep as T, type PurchaseRecord as U, PurchaseRecordSchema as V, type WorldInteractionRole as W, type RealtimeWebrtcClientSecret as X, type RegisteredAgentSummary as Y, type RemotePlayWorldOpenAiAudioOptions as Z, SPACE_STRUCTURE_ANCHOR_MIN_DISTANCE as _, type AddAgentInput as a, occupancyPointsGroupedBySpatialZone as a$, SPATIAL_ZONE_INDEX_SPACES as a0, STREET_NAME_POOL as a1, type SaleState as a2, SaleStateSchema as a3, type ShopItem as a4, ShopItemSchema as a5, type SpaceContentItem as a6, type Street as a7, type StreetPoolEntry as a8, type StructureJourneyStep as a9, centerOfZone as aA, clampWorldPosition as aB, computeTalkAgentPowerUpsEarned as aC, costForSeconds as aD, createInitialAgentRewardWallet as aE, createInitialPlayerWallet as aF, createVerticalStripSeedLayout as aG, desaturateColor as aH, enumerateIntegerCellsInRect as aI, expandBoundsToMinimumPlayArea as aJ, getStreetPoolEntryById as aK, getWalletBundleById as aL, isAgentSpawnOccupancyPointAvailable as aM, isAgentSpawnOccupancyPointAvailableInRect as aN, isAgentSpawnOccupancyPointAvailableInZone as aO, isItemAvailableForPurchase as aP, isSpaceAnchorOccupancyPointAvailable as aQ, isSpaceAnchorOccupancyPointAvailableInRect as aR, isSpaceAnchorOccupancyPointAvailableInZone as aS, listAllowedOccupancyPoints as aT, listOccupancyPointsForSpatialZone as aU, listOccupancyPointsForZone as aV, listOccupancyPointsInRect as aW, mergeSnapshotWithPlayerChainNode as aX, migrateWorldLayoutBounds as aY, nextStreetFromPool as aZ, occupancyKeyForPosition as a_, type SupermarketItem as aa, SupermarketItemSchema as ab, TALK_AGENT_PU_BILLED_SECONDS_PER_UNIT as ac, TALK_AGENT_PU_MAX_PER_LEG as ad, TALK_PRICE_PER_60S_USD as ae, TALK_PRICE_PER_SECOND_USD as af, TALK_TICK_SECONDS as ag, WALLET_BUNDLE_OFFERS as ah, type WalletBundleId as ai, type WalletBundleOffer as aj, type WorldBounds as ak, type WorldJourneyUpdate as al, type WorldLayout as am, type WorldLayoutBoundsField as an, type YieldEventInfo as ao, type Zone as ap, type ZoneEventInfo as aq, applyBoundsFieldUpdateToLayout as ar, availableCellsForZone as as, boundingWorldRectForOccupancyPoints as at, boundsContain as au, buildRankedOccupancyPoints as av, buildRankedOccupancyPointsForSpatialZone as aw, buildRankedOccupancyPointsForZone as ax, buildRankedOccupancyPointsInRect as ay, cellsForZone as az, type RegisteredPlayer as b, occupancyPointsGroupedByZones as b0, parsePlayerChainFanoutNotify as b1, parsePlayerChainFanoutNotifyFromSsePayload as b2, parsePlayerChainNodeRpcBody as b3, pickZoneForGroup as b4, pointCellInRect as b5, pointCellInSpatialZone as b6, pointCellInZone as b7, primaryZoneForGroup as b8, sortNodeRefsForSerializedFetch as b9, spatialZoneBounds as ba, spatialZoneCenter as bb, streetFromPoolEntry as bc, zonesForGroup as bd, type AddPlayerInput as c, type RecordInteractionInput as d, type AgentPlayWorldLayout as e, type AgentPlayWorldLayoutZone as f, type AgentPlayWorldMap as g, type AgentPlayWorldMapAgentOccupant as h, type AgentPlayWorldMapBounds as i, type AgentPlayWorldMapMcpOccupant as j, type AssistToolFieldType as k, type AssistToolParameterSpec as l, type AssistToolSpec as m, type CarWashCar as n, CarWashCarSchema as o, type ComputeTalkAgentPowerUpsEarnedInput as p, DEFAULT_PLAYER_WALLET_BALANCE_USD as q, type DestinationJourneyStep as r, type JourneyStep as s, MINIMUM_STREET_LAYOUT_BOUNDS as t, type OccupancyGridPoint as u, type OccupantGroup as v, type OriginJourneyStep as w, type P2aEnableFlag as x, PLAYER_CHAIN_GENESIS_STABLE_KEY as y, PLAYER_CHAIN_HEADER_STABLE_KEY as z };
package/dist/browser.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { A as AgentPlaySnapshot, e as AgentPlayWorldLayout, C as CONTINUOUS_RENDER_OFFSET, n as CarWashCar, o as CarWashCarSchema, D as DEFAULT_AGENT_SPAWN_MIN_DISTANCE, p as DEFAULT_PLAYER_WALLET_BALANCE_USD, M as MINIMUM_PLAY_WORLD_BOUNDS, O as OCCUPANCY_POINT_MULTIPLIER, s as OccupancyGridPoint, t as OccupantGroup, w as PLAYER_CHAIN_GENESIS_STABLE_KEY, x as PLAYER_CHAIN_HEADER_STABLE_KEY, K as PlayerWallet, N as PlayerWalletSchema, S as PurchaseRecord, T as PurchaseRecordSchema, Y as SPATIAL_ZONE_INDEX_AGENTS, Z as SPATIAL_ZONE_INDEX_SPACES, _ as STREET_NAME_POOL, $ as SaleState, a0 as SaleStateSchema, a1 as ShopItem, a2 as ShopItemSchema, a3 as SpaceContentItem, a4 as Street, a5 as StreetPoolEntry, a7 as SupermarketItem, a8 as SupermarketItemSchema, a9 as WorldBounds, ab as WorldLayout, ac as WorldLayoutBoundsField, ae as Zone, ag as applyBoundsFieldUpdateToLayout, ah as availableCellsForZone, ai as boundingWorldRectForOccupancyPoints, aj as boundsContain, ak as buildRankedOccupancyPoints, al as buildRankedOccupancyPointsForSpatialZone, am as buildRankedOccupancyPointsForZone, an as buildRankedOccupancyPointsInRect, ao as cellsForZone, ap as centerOfZone, aq as clampWorldPosition, ar as createInitialPlayerWallet, as as createVerticalStripSeedLayout, at as desaturateColor, au as enumerateIntegerCellsInRect, av as expandBoundsToMinimumPlayArea, aw as getStreetPoolEntryById, ax as isAgentSpawnOccupancyPointAvailable, ay as isAgentSpawnOccupancyPointAvailableInRect, az as isAgentSpawnOccupancyPointAvailableInZone, aA as isItemAvailableForPurchase, aB as isSpaceAnchorOccupancyPointAvailable, aC as isSpaceAnchorOccupancyPointAvailableInRect, aD as isSpaceAnchorOccupancyPointAvailableInZone, aE as listAllowedOccupancyPoints, aF as listOccupancyPointsForSpatialZone, aG as listOccupancyPointsForZone, aH as listOccupancyPointsInRect, aI as mergeSnapshotWithPlayerChainNode, aJ as migrateWorldLayoutBounds, aK as nextStreetFromPool, aL as occupancyKeyForPosition, aM as occupancyPointsGroupedBySpatialZone, aN as occupancyPointsGroupedByZones, aO as parsePlayerChainFanoutNotify, aP as parsePlayerChainFanoutNotifyFromSsePayload, aQ as parsePlayerChainNodeRpcBody, aR as pickZoneForGroup, aS as pointCellInRect, aT as pointCellInSpatialZone, aU as pointCellInZone, aV as primaryZoneForGroup, aW as sortNodeRefsForSerializedFetch, aX as spatialZoneBounds, aY as spatialZoneCenter, aZ as streetFromPoolEntry, a_ as zonesForGroup } from './browser-Dpx-0L8A.js';
1
+ export { A as AgentPlaySnapshot, e as AgentPlayWorldLayout, C as CONTINUOUS_RENDER_OFFSET, n as CarWashCar, o as CarWashCarSchema, p as ComputeTalkAgentPowerUpsEarnedInput, D as DEFAULT_AGENT_SPAWN_MIN_DISTANCE, q as DEFAULT_PLAYER_WALLET_BALANCE_USD, M as MINIMUM_PLAY_WORLD_BOUNDS, t as MINIMUM_STREET_LAYOUT_BOUNDS, O as OCCUPANCY_POINT_MULTIPLIER, u as OccupancyGridPoint, v as OccupantGroup, y as PLAYER_CHAIN_GENESIS_STABLE_KEY, z as PLAYER_CHAIN_HEADER_STABLE_KEY, Q as PlayerWallet, S as PlayerWalletSchema, U as PurchaseRecord, V as PurchaseRecordSchema, _ as SPACE_STRUCTURE_ANCHOR_MIN_DISTANCE, $ as SPATIAL_ZONE_INDEX_AGENTS, a0 as SPATIAL_ZONE_INDEX_SPACES, a1 as STREET_NAME_POOL, a2 as SaleState, a3 as SaleStateSchema, a4 as ShopItem, a5 as ShopItemSchema, a6 as SpaceContentItem, a7 as Street, a8 as StreetPoolEntry, aa as SupermarketItem, ab as SupermarketItemSchema, ac as TALK_AGENT_PU_BILLED_SECONDS_PER_UNIT, ad as TALK_AGENT_PU_MAX_PER_LEG, ae as TALK_PRICE_PER_60S_USD, af as TALK_PRICE_PER_SECOND_USD, ag as TALK_TICK_SECONDS, ah as WALLET_BUNDLE_OFFERS, ai as WalletBundleId, aj as WalletBundleOffer, ak as WorldBounds, am as WorldLayout, an as WorldLayoutBoundsField, ap as Zone, ar as applyBoundsFieldUpdateToLayout, as as availableCellsForZone, at as boundingWorldRectForOccupancyPoints, au as boundsContain, av as buildRankedOccupancyPoints, aw as buildRankedOccupancyPointsForSpatialZone, ax as buildRankedOccupancyPointsForZone, ay as buildRankedOccupancyPointsInRect, az as cellsForZone, aA as centerOfZone, aB as clampWorldPosition, aC as computeTalkAgentPowerUpsEarned, aD as costForSeconds, aE as createInitialAgentRewardWallet, aF as createInitialPlayerWallet, aG as createVerticalStripSeedLayout, aH as desaturateColor, aI as enumerateIntegerCellsInRect, aJ as expandBoundsToMinimumPlayArea, aK as getStreetPoolEntryById, aL as getWalletBundleById, aM as isAgentSpawnOccupancyPointAvailable, aN as isAgentSpawnOccupancyPointAvailableInRect, aO as isAgentSpawnOccupancyPointAvailableInZone, aP as isItemAvailableForPurchase, aQ as isSpaceAnchorOccupancyPointAvailable, aR as isSpaceAnchorOccupancyPointAvailableInRect, aS as isSpaceAnchorOccupancyPointAvailableInZone, aT as listAllowedOccupancyPoints, aU as listOccupancyPointsForSpatialZone, aV as listOccupancyPointsForZone, aW as listOccupancyPointsInRect, aX as mergeSnapshotWithPlayerChainNode, aY as migrateWorldLayoutBounds, aZ as nextStreetFromPool, a_ as occupancyKeyForPosition, a$ as occupancyPointsGroupedBySpatialZone, b0 as occupancyPointsGroupedByZones, b1 as parsePlayerChainFanoutNotify, b2 as parsePlayerChainFanoutNotifyFromSsePayload, b3 as parsePlayerChainNodeRpcBody, b4 as pickZoneForGroup, b5 as pointCellInRect, b6 as pointCellInSpatialZone, b7 as pointCellInZone, b8 as primaryZoneForGroup, b9 as sortNodeRefsForSerializedFetch, ba as spatialZoneBounds, bb as spatialZoneCenter, bc as streetFromPoolEntry, bd as zonesForGroup } from './browser-da9E-kSP.js';
2
2
  import 'zod';
package/dist/browser.js CHANGED
@@ -4,17 +4,25 @@ import {
4
4
  DEFAULT_AGENT_SPAWN_MIN_DISTANCE,
5
5
  DEFAULT_PLAYER_WALLET_BALANCE_USD,
6
6
  MINIMUM_PLAY_WORLD_BOUNDS,
7
+ MINIMUM_STREET_LAYOUT_BOUNDS,
7
8
  OCCUPANCY_POINT_MULTIPLIER,
8
9
  PLAYER_CHAIN_GENESIS_STABLE_KEY,
9
10
  PLAYER_CHAIN_HEADER_STABLE_KEY,
10
11
  PlayerWalletSchema,
11
12
  PurchaseRecordSchema,
13
+ SPACE_STRUCTURE_ANCHOR_MIN_DISTANCE,
12
14
  SPATIAL_ZONE_INDEX_AGENTS,
13
15
  SPATIAL_ZONE_INDEX_SPACES,
14
16
  STREET_NAME_POOL,
15
17
  SaleStateSchema,
16
18
  ShopItemSchema,
17
19
  SupermarketItemSchema,
20
+ TALK_AGENT_PU_BILLED_SECONDS_PER_UNIT,
21
+ TALK_AGENT_PU_MAX_PER_LEG,
22
+ TALK_PRICE_PER_60S_USD,
23
+ TALK_PRICE_PER_SECOND_USD,
24
+ TALK_TICK_SECONDS,
25
+ WALLET_BUNDLE_OFFERS,
18
26
  applyBoundsFieldUpdateToLayout,
19
27
  availableCellsForZone,
20
28
  boundingWorldRectForOccupancyPoints,
@@ -26,12 +34,16 @@ import {
26
34
  cellsForZone,
27
35
  centerOfZone,
28
36
  clampWorldPosition,
37
+ computeTalkAgentPowerUpsEarned,
38
+ costForSeconds,
39
+ createInitialAgentRewardWallet,
29
40
  createInitialPlayerWallet,
30
41
  createVerticalStripSeedLayout,
31
42
  desaturateColor,
32
43
  enumerateIntegerCellsInRect,
33
44
  expandBoundsToMinimumPlayArea,
34
45
  getStreetPoolEntryById,
46
+ getWalletBundleById,
35
47
  isAgentSpawnOccupancyPointAvailable,
36
48
  isAgentSpawnOccupancyPointAvailableInRect,
37
49
  isAgentSpawnOccupancyPointAvailableInZone,
@@ -62,24 +74,32 @@ import {
62
74
  spatialZoneCenter,
63
75
  streetFromPoolEntry,
64
76
  zonesForGroup
65
- } from "./chunk-VWC7EE2F.js";
77
+ } from "./chunk-SLAPRNMF.js";
66
78
  export {
67
79
  CONTINUOUS_RENDER_OFFSET,
68
80
  CarWashCarSchema,
69
81
  DEFAULT_AGENT_SPAWN_MIN_DISTANCE,
70
82
  DEFAULT_PLAYER_WALLET_BALANCE_USD,
71
83
  MINIMUM_PLAY_WORLD_BOUNDS,
84
+ MINIMUM_STREET_LAYOUT_BOUNDS,
72
85
  OCCUPANCY_POINT_MULTIPLIER,
73
86
  PLAYER_CHAIN_GENESIS_STABLE_KEY,
74
87
  PLAYER_CHAIN_HEADER_STABLE_KEY,
75
88
  PlayerWalletSchema,
76
89
  PurchaseRecordSchema,
90
+ SPACE_STRUCTURE_ANCHOR_MIN_DISTANCE,
77
91
  SPATIAL_ZONE_INDEX_AGENTS,
78
92
  SPATIAL_ZONE_INDEX_SPACES,
79
93
  STREET_NAME_POOL,
80
94
  SaleStateSchema,
81
95
  ShopItemSchema,
82
96
  SupermarketItemSchema,
97
+ TALK_AGENT_PU_BILLED_SECONDS_PER_UNIT,
98
+ TALK_AGENT_PU_MAX_PER_LEG,
99
+ TALK_PRICE_PER_60S_USD,
100
+ TALK_PRICE_PER_SECOND_USD,
101
+ TALK_TICK_SECONDS,
102
+ WALLET_BUNDLE_OFFERS,
83
103
  applyBoundsFieldUpdateToLayout,
84
104
  availableCellsForZone,
85
105
  boundingWorldRectForOccupancyPoints,
@@ -91,12 +111,16 @@ export {
91
111
  cellsForZone,
92
112
  centerOfZone,
93
113
  clampWorldPosition,
114
+ computeTalkAgentPowerUpsEarned,
115
+ costForSeconds,
116
+ createInitialAgentRewardWallet,
94
117
  createInitialPlayerWallet,
95
118
  createVerticalStripSeedLayout,
96
119
  desaturateColor,
97
120
  enumerateIntegerCellsInRect,
98
121
  expandBoundsToMinimumPlayArea,
99
122
  getStreetPoolEntryById,
123
+ getWalletBundleById,
100
124
  isAgentSpawnOccupancyPointAvailable,
101
125
  isAgentSpawnOccupancyPointAvailableInRect,
102
126
  isAgentSpawnOccupancyPointAvailableInZone,
@@ -11,6 +11,12 @@ var MINIMUM_PLAY_WORLD_BOUNDS = {
11
11
  maxX: 19,
12
12
  maxY: 19
13
13
  };
14
+ var MINIMUM_STREET_LAYOUT_BOUNDS = {
15
+ minX: 0,
16
+ minY: 0,
17
+ maxX: 19,
18
+ maxY: 2
19
+ };
14
20
  function expandBoundsToMinimumPlayArea(bounds) {
15
21
  return {
16
22
  minX: Math.min(bounds.minX, MINIMUM_PLAY_WORLD_BOUNDS.minX),
@@ -33,18 +39,19 @@ function boundsContain(bounds, p) {
33
39
  var OCCUPANCY_POINT_MULTIPLIER = 5;
34
40
  var CONTINUOUS_RENDER_OFFSET = 0.2;
35
41
  var DEFAULT_AGENT_SPAWN_MIN_DISTANCE = 0.9;
42
+ var SPACE_STRUCTURE_ANCHOR_MIN_DISTANCE = 2.1;
36
43
  var SPATIAL_ZONE_INDEX_AGENTS = 0;
37
44
  var SPATIAL_ZONE_INDEX_SPACES = 2;
38
45
  function spatialZoneBounds(quartileIndex) {
39
46
  const { minX, maxX, minY, maxY } = MINIMUM_PLAY_WORLD_BOUNDS;
40
47
  const spanX = maxX - minX + 1;
41
48
  const spanY = maxY - minY + 1;
42
- const halfX = spanX / 2;
43
- const halfY = spanY / 2;
44
- const midLeftMax = minX + halfX - 1;
45
- const midRightMin = minX + halfX;
46
- const midBottomMax = minY + halfY - 1;
47
- const midTopMin = minY + halfY;
49
+ const leftSpanX = Math.floor(spanX / 2);
50
+ const leftSpanY = Math.floor(spanY / 2);
51
+ const midLeftMax = minX + leftSpanX - 1;
52
+ const midRightMin = minX + leftSpanX;
53
+ const midBottomMax = minY + leftSpanY - 1;
54
+ const midTopMin = minY + leftSpanY;
48
55
  switch (quartileIndex) {
49
56
  case 0:
50
57
  return { minX, maxX: midLeftMax, minY, maxY: midBottomMax };
@@ -4585,27 +4592,46 @@ var PlayerWalletSchema = external_exports.object({
4585
4592
  playerId: NonEmpty,
4586
4593
  balanceUsd: external_exports.number().finite().nonnegative(),
4587
4594
  currency: external_exports.literal("USD"),
4588
- updatedAt: IsoTimestamp
4595
+ updatedAt: IsoTimestamp,
4596
+ powerUps: external_exports.number().int().nonnegative().default(0)
4589
4597
  });
4590
4598
  function createInitialPlayerWallet(input) {
4591
4599
  return {
4592
4600
  playerId: input.playerId,
4593
4601
  balanceUsd: DEFAULT_PLAYER_WALLET_BALANCE_USD,
4594
4602
  currency: "USD",
4595
- updatedAt: input.now
4603
+ updatedAt: input.now,
4604
+ powerUps: 0
4605
+ };
4606
+ }
4607
+ function createInitialAgentRewardWallet(input) {
4608
+ return {
4609
+ playerId: input.playerId,
4610
+ balanceUsd: 0,
4611
+ currency: "USD",
4612
+ updatedAt: input.now,
4613
+ powerUps: 0
4596
4614
  };
4597
4615
  }
4598
4616
  var PurchaseRecordSchema = external_exports.object({
4599
4617
  id: NonEmpty,
4600
4618
  playerId: NonEmpty,
4601
4619
  spaceId: NonEmpty,
4602
- amenityKind: external_exports.enum(["shop", "supermarket", "car_wash"]),
4620
+ amenityKind: external_exports.enum([
4621
+ "shop",
4622
+ "supermarket",
4623
+ "car_wash",
4624
+ "talk_time",
4625
+ "wallet_bundle"
4626
+ ]),
4603
4627
  itemRef: external_exports.object({
4604
4628
  kind: external_exports.enum(["shop", "supermarket", "carwash"]),
4605
4629
  id: NonEmpty
4606
4630
  }),
4607
4631
  priceUsd: PositivePrice,
4608
- at: IsoTimestamp
4632
+ at: IsoTimestamp,
4633
+ detail: external_exports.string().optional(),
4634
+ powerUpsSpent: external_exports.number().int().positive().optional()
4609
4635
  });
4610
4636
  function isItemAvailableForPurchase(item) {
4611
4637
  return item.sale.status === "available";
@@ -4619,6 +4645,44 @@ function desaturateColor(hex) {
4619
4645
  return y << 16 | y << 8 | y;
4620
4646
  }
4621
4647
 
4648
+ // src/lib/talk-billing.ts
4649
+ var TALK_PRICE_PER_60S_USD = 1.5;
4650
+ var TALK_PRICE_PER_SECOND_USD = 0.025;
4651
+ var TALK_TICK_SECONDS = 10;
4652
+ var costForSeconds = (seconds) => {
4653
+ if (!Number.isFinite(seconds) || seconds <= 0) {
4654
+ return 0;
4655
+ }
4656
+ const whole = Math.floor(seconds);
4657
+ return Math.round(whole * 25) / 1e3;
4658
+ };
4659
+
4660
+ // src/lib/talk-agent-reward.ts
4661
+ var TALK_AGENT_PU_BILLED_SECONDS_PER_UNIT = 10;
4662
+ var TALK_AGENT_PU_MAX_PER_LEG = 5;
4663
+ var computeTalkAgentPowerUpsEarned = (input) => {
4664
+ if (!Number.isFinite(input.costUsd) || input.costUsd <= 0) {
4665
+ return 0;
4666
+ }
4667
+ if (!Number.isFinite(input.billedWholeSeconds) || input.billedWholeSeconds <= 0) {
4668
+ return 0;
4669
+ }
4670
+ const whole = Math.floor(input.billedWholeSeconds);
4671
+ const raw = Math.floor(whole / TALK_AGENT_PU_BILLED_SECONDS_PER_UNIT);
4672
+ return Math.min(TALK_AGENT_PU_MAX_PER_LEG, Math.max(0, raw));
4673
+ };
4674
+
4675
+ // src/lib/wallet-bundle-catalog.ts
4676
+ var WALLET_BUNDLE_OFFERS = [
4677
+ { id: "bundle-10", powerUpsCost: 150, creditUsd: 10 },
4678
+ { id: "bundle-20", powerUpsCost: 300, creditUsd: 20 },
4679
+ { id: "bundle-50", powerUpsCost: 500, creditUsd: 50 },
4680
+ { id: "bundle-100", powerUpsCost: 900, creditUsd: 100 }
4681
+ ];
4682
+ var getWalletBundleById = (id) => {
4683
+ return WALLET_BUNDLE_OFFERS.find((o) => o.id === id);
4684
+ };
4685
+
4622
4686
  // src/lib/world-chain-keys.ts
4623
4687
  var PLAYER_CHAIN_GENESIS_STABLE_KEY = "__genesis__";
4624
4688
  var PLAYER_CHAIN_HEADER_STABLE_KEY = "__header__";
@@ -5033,12 +5097,14 @@ function mergeSnapshotWithPlayerChainNode(snapshot, node) {
5033
5097
 
5034
5098
  export {
5035
5099
  MINIMUM_PLAY_WORLD_BOUNDS,
5100
+ MINIMUM_STREET_LAYOUT_BOUNDS,
5036
5101
  expandBoundsToMinimumPlayArea,
5037
5102
  clampWorldPosition,
5038
5103
  boundsContain,
5039
5104
  OCCUPANCY_POINT_MULTIPLIER,
5040
5105
  CONTINUOUS_RENDER_OFFSET,
5041
5106
  DEFAULT_AGENT_SPAWN_MIN_DISTANCE,
5107
+ SPACE_STRUCTURE_ANCHOR_MIN_DISTANCE,
5042
5108
  SPATIAL_ZONE_INDEX_AGENTS,
5043
5109
  SPATIAL_ZONE_INDEX_SPACES,
5044
5110
  spatialZoneBounds,
@@ -5085,9 +5151,19 @@ export {
5085
5151
  DEFAULT_PLAYER_WALLET_BALANCE_USD,
5086
5152
  PlayerWalletSchema,
5087
5153
  createInitialPlayerWallet,
5154
+ createInitialAgentRewardWallet,
5088
5155
  PurchaseRecordSchema,
5089
5156
  isItemAvailableForPurchase,
5090
5157
  desaturateColor,
5158
+ TALK_PRICE_PER_60S_USD,
5159
+ TALK_PRICE_PER_SECOND_USD,
5160
+ TALK_TICK_SECONDS,
5161
+ costForSeconds,
5162
+ TALK_AGENT_PU_BILLED_SECONDS_PER_UNIT,
5163
+ TALK_AGENT_PU_MAX_PER_LEG,
5164
+ computeTalkAgentPowerUpsEarned,
5165
+ WALLET_BUNDLE_OFFERS,
5166
+ getWalletBundleById,
5091
5167
  parseHumanOccupantRow,
5092
5168
  parseAgentOccupantRow,
5093
5169
  parseMcpOccupantRow,
@@ -5101,4 +5177,4 @@ export {
5101
5177
  parsePlayerChainNodeRpcBody,
5102
5178
  mergeSnapshotWithPlayerChainNode
5103
5179
  };
5104
- //# sourceMappingURL=chunk-VWC7EE2F.js.map
5180
+ //# sourceMappingURL=chunk-SLAPRNMF.js.map