@agent-play/sdk 3.3.9 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -382,7 +382,7 @@ function assertValidLayoutBounds(bounds) {
382
382
  );
383
383
  }
384
384
  }
385
- var PRIMARY_GROUP_ORDER = ["agent", "space", "mcp"];
385
+ var PRIMARY_GROUP_ORDER = ["agent", "space", "arcade"];
386
386
  function streetsFromLayoutPrimaryGroups(layout) {
387
387
  const picks = PRIMARY_GROUP_ORDER.map((g) => {
388
388
  const zone = primaryZoneForGroup(layout, g);
@@ -466,12 +466,12 @@ function createVerticalStripSeedLayout(input) {
466
466
  allowedGroups: ["space"]
467
467
  },
468
468
  {
469
- id: "zone-mcp-strip",
469
+ id: "zone-arcade-strip",
470
470
  streetId: s2.id,
471
471
  streetLabel: s2.label,
472
472
  rect: { minX: x2, maxX: x2Max, minY, maxY },
473
- primaryGroup: "mcp",
474
- allowedGroups: ["mcp"]
473
+ primaryGroup: "arcade",
474
+ allowedGroups: ["arcade"]
475
475
  }
476
476
  ];
477
477
  const streets = [
@@ -487,7 +487,7 @@ function createVerticalStripSeedLayout(input) {
487
487
  };
488
488
  }
489
489
 
490
- // node_modules/zod/v3/external.js
490
+ // ../../node_modules/zod/v3/external.js
491
491
  var external_exports = {};
492
492
  __export(external_exports, {
493
493
  BRAND: () => BRAND,
@@ -599,7 +599,7 @@ __export(external_exports, {
599
599
  void: () => voidType
600
600
  });
601
601
 
602
- // node_modules/zod/v3/helpers/util.js
602
+ // ../../node_modules/zod/v3/helpers/util.js
603
603
  var util;
604
604
  (function(util2) {
605
605
  util2.assertEqual = (_) => {
@@ -733,7 +733,7 @@ var getParsedType = (data) => {
733
733
  }
734
734
  };
735
735
 
736
- // node_modules/zod/v3/ZodError.js
736
+ // ../../node_modules/zod/v3/ZodError.js
737
737
  var ZodIssueCode = util.arrayToEnum([
738
738
  "invalid_type",
739
739
  "invalid_literal",
@@ -851,7 +851,7 @@ ZodError.create = (issues) => {
851
851
  return error;
852
852
  };
853
853
 
854
- // node_modules/zod/v3/locales/en.js
854
+ // ../../node_modules/zod/v3/locales/en.js
855
855
  var errorMap = (issue, _ctx) => {
856
856
  let message;
857
857
  switch (issue.code) {
@@ -954,7 +954,7 @@ var errorMap = (issue, _ctx) => {
954
954
  };
955
955
  var en_default = errorMap;
956
956
 
957
- // node_modules/zod/v3/errors.js
957
+ // ../../node_modules/zod/v3/errors.js
958
958
  var overrideErrorMap = en_default;
959
959
  function setErrorMap(map) {
960
960
  overrideErrorMap = map;
@@ -963,7 +963,7 @@ function getErrorMap() {
963
963
  return overrideErrorMap;
964
964
  }
965
965
 
966
- // node_modules/zod/v3/helpers/parseUtil.js
966
+ // ../../node_modules/zod/v3/helpers/parseUtil.js
967
967
  var makeIssue = (params) => {
968
968
  const { data, path, errorMaps, issueData } = params;
969
969
  const fullPath = [...path, ...issueData.path || []];
@@ -1073,14 +1073,14 @@ var isDirty = (x) => x.status === "dirty";
1073
1073
  var isValid = (x) => x.status === "valid";
1074
1074
  var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
1075
1075
 
1076
- // node_modules/zod/v3/helpers/errorUtil.js
1076
+ // ../../node_modules/zod/v3/helpers/errorUtil.js
1077
1077
  var errorUtil;
1078
1078
  (function(errorUtil2) {
1079
1079
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
1080
1080
  errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
1081
1081
  })(errorUtil || (errorUtil = {}));
1082
1082
 
1083
- // node_modules/zod/v3/types.js
1083
+ // ../../node_modules/zod/v3/types.js
1084
1084
  var ParseInputLazyPath = class {
1085
1085
  constructor(parent, value, path, key) {
1086
1086
  this._cachedPath = [];
@@ -4587,7 +4587,7 @@ var CarWashCarSchema = external_exports.object({
4587
4587
  createdAt: IsoTimestamp,
4588
4588
  sale: SaleStateSchema
4589
4589
  });
4590
- var DEFAULT_PLAYER_WALLET_BALANCE_USD = 70;
4590
+ var DEFAULT_PLAYER_WALLET_BALANCE_USD = 10;
4591
4591
  var PlayerWalletSchema = external_exports.object({
4592
4592
  playerId: NonEmpty,
4593
4593
  balanceUsd: external_exports.number().finite().nonnegative(),
@@ -4622,16 +4622,32 @@ var PurchaseRecordSchema = external_exports.object({
4622
4622
  "supermarket",
4623
4623
  "car_wash",
4624
4624
  "talk_time",
4625
- "wallet_bundle"
4625
+ "wallet_bundle",
4626
+ "apu_credit",
4627
+ "apu_debit"
4626
4628
  ]),
4627
4629
  itemRef: external_exports.object({
4628
- kind: external_exports.enum(["shop", "supermarket", "carwash"]),
4630
+ kind: external_exports.enum([
4631
+ "shop",
4632
+ "supermarket",
4633
+ "carwash",
4634
+ "game",
4635
+ "apu",
4636
+ "talk",
4637
+ "bundle"
4638
+ ]),
4629
4639
  id: NonEmpty
4630
4640
  }),
4631
- priceUsd: PositivePrice,
4641
+ priceUsd: PositivePrice.optional(),
4632
4642
  at: IsoTimestamp,
4633
4643
  detail: external_exports.string().optional(),
4634
- powerUpsSpent: external_exports.number().int().positive().optional()
4644
+ powerUpsSpent: external_exports.number().int().positive().optional(),
4645
+ powerUpsEarned: external_exports.number().int().positive().optional(),
4646
+ powerUpsDelta: external_exports.number().int().optional(),
4647
+ debitSource: external_exports.string().optional(),
4648
+ creditSource: external_exports.string().optional(),
4649
+ counterpartyNodeId: external_exports.string().optional(),
4650
+ token: external_exports.literal("APU").optional()
4635
4651
  });
4636
4652
  function isItemAvailableForPurchase(item) {
4637
4653
  return item.sale.status === "available";
@@ -4645,6 +4661,43 @@ function desaturateColor(hex) {
4645
4661
  return y << 16 | y << 8 | y;
4646
4662
  }
4647
4663
 
4664
+ // src/lib/wallet-apu-transaction.ts
4665
+ var APU_TOKEN = "APU";
4666
+ var buildApuWalletTransaction = (input) => {
4667
+ const amount = Math.abs(Math.trunc(input.delta));
4668
+ const isCredit = input.delta > 0;
4669
+ return {
4670
+ id: input.id,
4671
+ playerId: input.playerId,
4672
+ spaceId: input.spaceId,
4673
+ amenityKind: isCredit ? "apu_credit" : "apu_debit",
4674
+ itemRef: input.itemRef,
4675
+ at: input.at,
4676
+ detail: input.detail,
4677
+ powerUpsEarned: isCredit ? amount : void 0,
4678
+ powerUpsSpent: isCredit ? void 0 : amount,
4679
+ powerUpsDelta: input.delta,
4680
+ creditSource: input.creditSource,
4681
+ debitSource: input.debitSource,
4682
+ counterpartyNodeId: input.counterpartyNodeId,
4683
+ token: APU_TOKEN
4684
+ };
4685
+ };
4686
+ var buildAmenityPurchaseApuFields = (input) => ({
4687
+ powerUpsEarned: input.earnedPowerUps,
4688
+ powerUpsDelta: input.earnedPowerUps,
4689
+ creditSource: `amenity:${input.amenityKind}:${input.spaceId}`,
4690
+ debitSource: "wallet:usd",
4691
+ token: APU_TOKEN
4692
+ });
4693
+ var buildWalletBundleApuFields = (input) => ({
4694
+ powerUpsSpent: input.powerUpsCost,
4695
+ powerUpsDelta: -input.powerUpsCost,
4696
+ debitSource: "wallet:apu",
4697
+ creditSource: `wallet:usd:bundle:${input.bundleId}`,
4698
+ token: APU_TOKEN
4699
+ });
4700
+
4648
4701
  // src/lib/talk-billing.ts
4649
4702
  var TALK_PRICE_PER_60S_USD = 1.5;
4650
4703
  var TALK_PRICE_PER_SECOND_USD = 0.025;
@@ -4683,6 +4736,368 @@ var getWalletBundleById = (id) => {
4683
4736
  return WALLET_BUNDLE_OFFERS.find((o) => o.id === id);
4684
4737
  };
4685
4738
 
4739
+ // src/lib/game-catalog.ts
4740
+ var GAME_CABINET_CATALOG = [
4741
+ { id: "arcade-hidden-gems", gameId: "hidden-gems", name: "Gem Chest" },
4742
+ { id: "arcade-map-recall", gameId: "map-recall", name: "Map Room" },
4743
+ { id: "arcade-price-check", gameId: "price-check", name: "Price Tag" },
4744
+ { id: "arcade-signal-hunt", gameId: "signal-hunt", name: "Signal Tower" },
4745
+ { id: "arcade-delivery-dash", gameId: "delivery-dash", name: "Courier Lane" },
4746
+ { id: "arcade-lease-locker", gameId: "lease-locker", name: "Locker Hall" },
4747
+ { id: "arcade-talk-timer", gameId: "talk-timer", name: "Comms Booth" },
4748
+ { id: "arcade-daily-rotator", gameId: "daily-rotator", name: "Featured" }
4749
+ ];
4750
+ var PLAYABLE_GAME_IDS = [
4751
+ "hidden-gems",
4752
+ "map-recall",
4753
+ "price-check",
4754
+ "signal-hunt",
4755
+ "delivery-dash",
4756
+ "lease-locker",
4757
+ "talk-timer"
4758
+ ];
4759
+ var getGameCabinetById = (id) => {
4760
+ return GAME_CABINET_CATALOG.find((c) => c.id === id);
4761
+ };
4762
+ var getGameCabinetByGameId = (gameId) => {
4763
+ return GAME_CABINET_CATALOG.find((c) => c.gameId === gameId);
4764
+ };
4765
+ var ROTATOR_SCHEDULE = [
4766
+ "hidden-gems",
4767
+ "map-recall",
4768
+ "price-check",
4769
+ "signal-hunt",
4770
+ "delivery-dash",
4771
+ "lease-locker",
4772
+ "talk-timer"
4773
+ ];
4774
+ var featuredGameIdForUtcDate = (date) => {
4775
+ const day = date.getUTCDay();
4776
+ const index = day === 0 ? 6 : day - 1;
4777
+ const featured = ROTATOR_SCHEDULE[index];
4778
+ if (featured === void 0) {
4779
+ return "hidden-gems";
4780
+ }
4781
+ return featured;
4782
+ };
4783
+ var GAME_ID_SET = /* @__PURE__ */ new Set([
4784
+ "hidden-gems",
4785
+ "map-recall",
4786
+ "price-check",
4787
+ "signal-hunt",
4788
+ "delivery-dash",
4789
+ "lease-locker",
4790
+ "talk-timer",
4791
+ "daily-rotator"
4792
+ ]);
4793
+ var isGameId = (value) => {
4794
+ return GAME_ID_SET.has(value);
4795
+ };
4796
+
4797
+ // src/lib/game-outcome-model.ts
4798
+ var DAILY_GAME_PU_CAP = 100;
4799
+ var STREAK_BONUS_PU = 5;
4800
+ var STREAK_BONUS_THRESHOLD_DAYS = 5;
4801
+ var GameEventSchema = external_exports.discriminatedUnion("type", [
4802
+ external_exports.object({
4803
+ type: external_exports.literal("chest_open"),
4804
+ correct: external_exports.boolean(),
4805
+ tutorial: external_exports.boolean().optional()
4806
+ }),
4807
+ external_exports.object({
4808
+ type: external_exports.literal("sequence_step"),
4809
+ correct: external_exports.boolean(),
4810
+ tutorial: external_exports.boolean().optional()
4811
+ }),
4812
+ external_exports.object({
4813
+ type: external_exports.literal("price_guess"),
4814
+ correct: external_exports.boolean(),
4815
+ round: external_exports.number().int().min(1)
4816
+ }),
4817
+ external_exports.object({
4818
+ type: external_exports.literal("signal_pick"),
4819
+ correct: external_exports.boolean()
4820
+ }),
4821
+ external_exports.object({
4822
+ type: external_exports.literal("delivery_finish"),
4823
+ band: external_exports.enum(["fast", "ok", "slow"]),
4824
+ hits: external_exports.number().int().min(0)
4825
+ }),
4826
+ external_exports.object({
4827
+ type: external_exports.literal("door_pick"),
4828
+ correct: external_exports.boolean()
4829
+ }),
4830
+ external_exports.object({
4831
+ type: external_exports.literal("talk_release"),
4832
+ success: external_exports.boolean(),
4833
+ round: external_exports.number().int().min(1).max(3)
4834
+ })
4835
+ ]);
4836
+ var ApplyGameOutcomeInputSchema = external_exports.object({
4837
+ gameId: external_exports.string().refine(isGameId, "invalid gameId"),
4838
+ roundId: external_exports.string().min(1),
4839
+ events: external_exports.array(GameEventSchema).min(1)
4840
+ });
4841
+ var GamePerTitleStatsSchema = external_exports.object({
4842
+ plays: external_exports.number().int().min(0),
4843
+ bestNetPu: external_exports.number().int()
4844
+ });
4845
+ var GameStatsSchema = external_exports.object({
4846
+ dayStreak: external_exports.number().int().min(0),
4847
+ bestStreak: external_exports.number().int().min(0),
4848
+ puEarnedToday: external_exports.number().int().min(0),
4849
+ puCapRemaining: external_exports.number().int().min(0),
4850
+ gamesPlayedToday: external_exports.number().int().min(0),
4851
+ featuredGameId: external_exports.string(),
4852
+ firstGamePlayed: external_exports.boolean(),
4853
+ perGame: external_exports.record(external_exports.string(), GamePerTitleStatsSchema)
4854
+ });
4855
+ var computeEventPuDelta = (event) => {
4856
+ switch (event.type) {
4857
+ case "chest_open":
4858
+ if (event.tutorial === true) {
4859
+ return event.correct ? 5 : 0;
4860
+ }
4861
+ return event.correct ? 8 : -2;
4862
+ case "sequence_step":
4863
+ if (event.tutorial === true) {
4864
+ return event.correct ? 4 : 0;
4865
+ }
4866
+ return event.correct ? 4 : -2;
4867
+ case "price_guess":
4868
+ if (event.round === 1 && !event.correct) return 0;
4869
+ return event.correct ? 4 : -1;
4870
+ case "signal_pick":
4871
+ return event.correct ? 8 : -3;
4872
+ case "delivery_finish": {
4873
+ const bandPu = event.band === "fast" ? 15 : event.band === "ok" ? 8 : 3;
4874
+ return bandPu - event.hits * 2;
4875
+ }
4876
+ case "door_pick":
4877
+ return event.correct ? 6 : -4;
4878
+ case "talk_release":
4879
+ return event.success ? 5 : -2;
4880
+ default: {
4881
+ const _exhaustive = event;
4882
+ void _exhaustive;
4883
+ return 0;
4884
+ }
4885
+ }
4886
+ };
4887
+ var computeRoundPuDelta = (events) => {
4888
+ return events.reduce((sum, e) => sum + computeEventPuDelta(e), 0);
4889
+ };
4890
+ var utcDateKey = (date) => {
4891
+ return date.toISOString().slice(0, 10);
4892
+ };
4893
+ var createEmptyGameStats = (date) => {
4894
+ return GameStatsSchema.parse({
4895
+ dayStreak: 0,
4896
+ bestStreak: 0,
4897
+ puEarnedToday: 0,
4898
+ puCapRemaining: DAILY_GAME_PU_CAP,
4899
+ gamesPlayedToday: 0,
4900
+ featuredGameId: featuredGameIdForUtcDate(date),
4901
+ firstGamePlayed: false,
4902
+ perGame: {}
4903
+ });
4904
+ };
4905
+
4906
+ // src/lib/scanner-model.ts
4907
+ var NonEmpty2 = external_exports.string().trim().min(1);
4908
+ var IsoTimestamp2 = external_exports.string().trim().min(1);
4909
+ var ScannerTxOpSchema = external_exports.enum([
4910
+ "purchase",
4911
+ "redeemWalletBundle",
4912
+ "applyGameOutcome",
4913
+ "talkTick",
4914
+ "talkStop",
4915
+ "talkStart",
4916
+ "walletSeeded"
4917
+ ]);
4918
+ var ScannerTxRecordSchema = PurchaseRecordSchema.extend({
4919
+ hostId: NonEmpty2,
4920
+ indexedAt: IsoTimestamp2,
4921
+ op: ScannerTxOpSchema,
4922
+ blockRev: external_exports.number().int().nonnegative().optional(),
4923
+ merkleRootHex: external_exports.string().optional()
4924
+ });
4925
+ var ScannerBlockRecordSchema = external_exports.object({
4926
+ rev: external_exports.number().int().nonnegative(),
4927
+ merkleRootHex: external_exports.string(),
4928
+ merkleLeafCount: external_exports.number().int().nonnegative(),
4929
+ at: IsoTimestamp2,
4930
+ occupantCount: external_exports.number().int().nonnegative().optional(),
4931
+ leafDeltaCount: external_exports.number().int().nonnegative().optional(),
4932
+ label: external_exports.string().optional()
4933
+ });
4934
+ var ScannerMigrationStatusSchema = external_exports.enum([
4935
+ "pending",
4936
+ "running",
4937
+ "completed",
4938
+ "failed"
4939
+ ]);
4940
+ var ScannerMigrationStateSchema = external_exports.object({
4941
+ status: ScannerMigrationStatusSchema,
4942
+ cursor: external_exports.string(),
4943
+ totalIndexed: external_exports.number().int().nonnegative(),
4944
+ startedAt: IsoTimestamp2,
4945
+ completedAt: IsoTimestamp2.optional(),
4946
+ error: external_exports.string().optional()
4947
+ });
4948
+ var ScannerWalletSnapshotSchema = external_exports.object({
4949
+ playerId: NonEmpty2,
4950
+ balanceUsd: external_exports.number().finite().nonnegative(),
4951
+ powerUps: external_exports.number().int().nonnegative(),
4952
+ updatedAt: IsoTimestamp2
4953
+ });
4954
+ var ScannerHeadSchema = external_exports.object({
4955
+ generatedAt: IsoTimestamp2,
4956
+ hostId: NonEmpty2,
4957
+ snapshotRev: external_exports.number().int().nonnegative(),
4958
+ merkleRootHex: external_exports.string().nullable(),
4959
+ merkleLeafCount: external_exports.number().int().nonnegative().nullable(),
4960
+ sid: external_exports.string().nullable(),
4961
+ txsLast24h: external_exports.number().int().nonnegative(),
4962
+ apuMintedLast24h: external_exports.number().int().nonnegative(),
4963
+ apuBurnedLast24h: external_exports.number().int().nonnegative(),
4964
+ migrationStatus: ScannerMigrationStatusSchema
4965
+ });
4966
+ var ScannerNodeKindSchema = external_exports.enum(["main", "agent", "unknown"]);
4967
+ var ScannerNodeWalletSchema = external_exports.object({
4968
+ balanceUsd: external_exports.number().finite().nonnegative(),
4969
+ powerUps: external_exports.number().int().nonnegative(),
4970
+ currency: external_exports.literal("USD"),
4971
+ updatedAt: IsoTimestamp2
4972
+ });
4973
+ var ScannerNodeLedgerKpisSchema = external_exports.object({
4974
+ txCount: external_exports.number().int().nonnegative(),
4975
+ usdSpent: external_exports.number().finite().nonnegative(),
4976
+ apuMinted: external_exports.number().int().nonnegative(),
4977
+ apuBurned: external_exports.number().int().nonnegative(),
4978
+ lastTxAt: IsoTimestamp2.nullable()
4979
+ });
4980
+ var ScannerNodeBreakdownSchema = external_exports.object({
4981
+ byAmenityKind: external_exports.record(external_exports.string(), external_exports.number().int().nonnegative()),
4982
+ bySpaceId: external_exports.record(external_exports.string(), external_exports.number().int().nonnegative()),
4983
+ byToken: external_exports.object({
4984
+ usd: external_exports.number().finite().nonnegative(),
4985
+ apu: external_exports.number().int().nonnegative()
4986
+ })
4987
+ });
4988
+ var ScannerNodeAnalyticsKpisSchema = external_exports.object({
4989
+ eventsLast24h: external_exports.number().int().nonnegative(),
4990
+ topEvents: external_exports.array(
4991
+ external_exports.object({
4992
+ event: NonEmpty2,
4993
+ count: external_exports.number().int().nonnegative()
4994
+ })
4995
+ )
4996
+ });
4997
+ var ScannerNodeProfileSchema = external_exports.object({
4998
+ nodeId: NonEmpty2,
4999
+ kind: ScannerNodeKindSchema,
5000
+ generatedAt: IsoTimestamp2,
5001
+ wallet: ScannerNodeWalletSchema.nullable(),
5002
+ ledger: ScannerNodeLedgerKpisSchema,
5003
+ breakdown: ScannerNodeBreakdownSchema,
5004
+ txs: external_exports.array(ScannerTxRecordSchema),
5005
+ txsNextCursor: external_exports.string().nullable(),
5006
+ gameStats: external_exports.object({
5007
+ dayStreak: external_exports.number().int().min(0),
5008
+ bestStreak: external_exports.number().int().min(0),
5009
+ puEarnedToday: external_exports.number().int().min(0),
5010
+ puCapRemaining: external_exports.number().int().min(0),
5011
+ gamesPlayedToday: external_exports.number().int().min(0),
5012
+ featuredGameId: external_exports.string(),
5013
+ firstGamePlayed: external_exports.boolean(),
5014
+ perGame: external_exports.record(
5015
+ external_exports.string(),
5016
+ external_exports.object({
5017
+ plays: external_exports.number().int().min(0),
5018
+ bestNetPu: external_exports.number().int()
5019
+ })
5020
+ )
5021
+ }).nullable(),
5022
+ analyticsEvents: external_exports.array(
5023
+ external_exports.object({
5024
+ messageId: NonEmpty2,
5025
+ event: NonEmpty2,
5026
+ distinctId: NonEmpty2,
5027
+ timestamp: IsoTimestamp2,
5028
+ properties: external_exports.record(
5029
+ external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean(), external_exports.null()])
5030
+ )
5031
+ })
5032
+ ),
5033
+ analyticsEventsNextCursor: external_exports.string().nullable(),
5034
+ analytics: ScannerNodeAnalyticsKpisSchema,
5035
+ traits: external_exports.record(
5036
+ external_exports.union([external_exports.string(), external_exports.number(), external_exports.boolean(), external_exports.null()])
5037
+ )
5038
+ });
5039
+
5040
+ // src/lib/analytics-event-model.ts
5041
+ var NonEmpty3 = external_exports.string().trim().min(1);
5042
+ var IsoTimestamp3 = external_exports.string().trim().min(1);
5043
+ var AnalyticsPropertyValueSchema = external_exports.union([
5044
+ external_exports.string(),
5045
+ external_exports.number(),
5046
+ external_exports.boolean(),
5047
+ external_exports.null()
5048
+ ]);
5049
+ var AnalyticsContextSchema = external_exports.object({
5050
+ hostId: NonEmpty3,
5051
+ sid: external_exports.string().optional(),
5052
+ snapshotRev: external_exports.number().int().nonnegative().optional(),
5053
+ library: external_exports.enum(["agent-play-server", "agent-play-client"])
5054
+ });
5055
+ var AnalyticsEventSchema = external_exports.object({
5056
+ messageId: NonEmpty3,
5057
+ event: NonEmpty3,
5058
+ distinctId: NonEmpty3,
5059
+ timestamp: IsoTimestamp3,
5060
+ properties: external_exports.record(AnalyticsPropertyValueSchema),
5061
+ context: AnalyticsContextSchema.optional()
5062
+ });
5063
+ var AnalyticsTraitsSchema = external_exports.object({
5064
+ distinctId: NonEmpty3,
5065
+ traits: external_exports.record(AnalyticsPropertyValueSchema),
5066
+ timestamp: IsoTimestamp3
5067
+ });
5068
+ var AnalyticsMigrationStatusSchema = external_exports.enum([
5069
+ "pending",
5070
+ "running",
5071
+ "completed",
5072
+ "failed"
5073
+ ]);
5074
+ var AnalyticsMigrationStateSchema = external_exports.object({
5075
+ status: AnalyticsMigrationStatusSchema,
5076
+ cursor: external_exports.string(),
5077
+ totalIndexed: external_exports.number().int().nonnegative(),
5078
+ startedAt: IsoTimestamp3,
5079
+ completedAt: IsoTimestamp3.optional(),
5080
+ error: external_exports.string().optional()
5081
+ });
5082
+ var ANALYTICS_EVENT_NAMES = {
5083
+ purchaseCompleted: "Purchase Completed",
5084
+ walletBundleRedeemed: "Wallet Bundle Redeemed",
5085
+ gameRoundCompleted: "Game Round Completed",
5086
+ talkSessionStarted: "Talk Session Started",
5087
+ talkSessionBilled: "Talk Session Billed",
5088
+ talkSessionEnded: "Talk Session Ended",
5089
+ walletSeeded: "Wallet Seeded",
5090
+ spaceEntered: "Space Entered",
5091
+ amenityEntered: "Amenity Entered",
5092
+ worldJourneyRecorded: "World Journey Recorded",
5093
+ worldInteractionRecorded: "World Interaction Recorded",
5094
+ playerAdded: "Player Added",
5095
+ chainRevisionPublished: "Chain Revision Published",
5096
+ uiPresentationAction: "UI Presentation Action",
5097
+ gameStageActivated: "Game Stage Activated",
5098
+ scannerViewOpened: "Scanner View Opened"
5099
+ };
5100
+
4686
5101
  // src/lib/world-chain-keys.ts
4687
5102
  var PLAYER_CHAIN_GENESIS_STABLE_KEY = "__genesis__";
4688
5103
  var PLAYER_CHAIN_HEADER_STABLE_KEY = "__header__";
@@ -4858,15 +5273,21 @@ function parseStructureOccupantRow(raw) {
4858
5273
  throw new Error("occupant: structure needs worldId");
4859
5274
  }
4860
5275
  const spaceIdsRaw = raw.spaceIds;
4861
- if (!Array.isArray(spaceIdsRaw) || spaceIdsRaw.length === 0) {
4862
- throw new Error("occupant: structure needs non-empty spaceIds");
4863
- }
5276
+ const gameIdRaw = raw.gameId;
4864
5277
  const spaceIds = [];
4865
- for (const s of spaceIdsRaw) {
4866
- if (typeof s !== "string") {
4867
- throw new Error("occupant: structure spaceIds must be strings");
5278
+ if (Array.isArray(spaceIdsRaw)) {
5279
+ for (const s of spaceIdsRaw) {
5280
+ if (typeof s !== "string") {
5281
+ throw new Error("occupant: structure spaceIds must be strings");
5282
+ }
5283
+ spaceIds.push(s);
4868
5284
  }
4869
- spaceIds.push(s);
5285
+ }
5286
+ const hasGameId = typeof gameIdRaw === "string" && isGameId(gameIdRaw);
5287
+ if (spaceIds.length === 0 && !hasGameId) {
5288
+ throw new Error(
5289
+ "occupant: structure needs non-empty spaceIds or a valid gameId"
5290
+ );
4870
5291
  }
4871
5292
  const base = {
4872
5293
  kind: "structure",
@@ -4877,6 +5298,9 @@ function parseStructureOccupantRow(raw) {
4877
5298
  worldId: raw.worldId,
4878
5299
  spaceIds
4879
5300
  };
5301
+ if (hasGameId) {
5302
+ base.gameId = gameIdRaw;
5303
+ }
4880
5304
  if (raw.stationary === true) {
4881
5305
  base.stationary = true;
4882
5306
  }
@@ -5155,6 +5579,10 @@ export {
5155
5579
  PurchaseRecordSchema,
5156
5580
  isItemAvailableForPurchase,
5157
5581
  desaturateColor,
5582
+ APU_TOKEN,
5583
+ buildApuWalletTransaction,
5584
+ buildAmenityPurchaseApuFields,
5585
+ buildWalletBundleApuFields,
5158
5586
  TALK_PRICE_PER_60S_USD,
5159
5587
  TALK_PRICE_PER_SECOND_USD,
5160
5588
  TALK_TICK_SECONDS,
@@ -5164,6 +5592,37 @@ export {
5164
5592
  computeTalkAgentPowerUpsEarned,
5165
5593
  WALLET_BUNDLE_OFFERS,
5166
5594
  getWalletBundleById,
5595
+ GAME_CABINET_CATALOG,
5596
+ PLAYABLE_GAME_IDS,
5597
+ getGameCabinetById,
5598
+ getGameCabinetByGameId,
5599
+ featuredGameIdForUtcDate,
5600
+ isGameId,
5601
+ DAILY_GAME_PU_CAP,
5602
+ STREAK_BONUS_PU,
5603
+ STREAK_BONUS_THRESHOLD_DAYS,
5604
+ GameEventSchema,
5605
+ ApplyGameOutcomeInputSchema,
5606
+ GamePerTitleStatsSchema,
5607
+ GameStatsSchema,
5608
+ computeEventPuDelta,
5609
+ computeRoundPuDelta,
5610
+ utcDateKey,
5611
+ createEmptyGameStats,
5612
+ ScannerTxOpSchema,
5613
+ ScannerTxRecordSchema,
5614
+ ScannerBlockRecordSchema,
5615
+ ScannerMigrationStatusSchema,
5616
+ ScannerMigrationStateSchema,
5617
+ ScannerWalletSnapshotSchema,
5618
+ ScannerHeadSchema,
5619
+ ScannerNodeProfileSchema,
5620
+ AnalyticsPropertyValueSchema,
5621
+ AnalyticsContextSchema,
5622
+ AnalyticsEventSchema,
5623
+ AnalyticsTraitsSchema,
5624
+ AnalyticsMigrationStateSchema,
5625
+ ANALYTICS_EVENT_NAMES,
5167
5626
  parseHumanOccupantRow,
5168
5627
  parseAgentOccupantRow,
5169
5628
  parseMcpOccupantRow,
@@ -5177,4 +5636,4 @@ export {
5177
5636
  parsePlayerChainNodeRpcBody,
5178
5637
  mergeSnapshotWithPlayerChainNode
5179
5638
  };
5180
- //# sourceMappingURL=chunk-SLAPRNMF.js.map
5639
+ //# sourceMappingURL=chunk-Z2PYRHFU.js.map