@thegeem/protocol 0.1.30 → 0.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -74,7 +74,7 @@ var modesForGame = (gameId) => MODES.filter((m) => m.gameId === gameId);
74
74
  var EMOTE_IDS = ["laugh", "wow", "think", "gg"];
75
75
  var CHARACTER_IDS = ["m", "f"];
76
76
  var ROOM_ALPHABET = "ACDEFGHJKMNPQRTUVWXY2346789";
77
- var UNSAFE_CHARS = /[\p{Cc}<>]/gu;
77
+ var UNSAFE_CHARS = /[\p{Cc}\u202A-\u202E\u2066-\u2069<>]/gu;
78
78
  var DisplayName = import_zod.z.string().trim().min(1).max(LIMITS.MAX_NAME_LEN).transform((s) => s.replace(UNSAFE_CHARS, "").trim()).refine((s) => s.length >= 1, "name is empty after sanitizing");
79
79
  var RoomCode = import_zod.z.string().trim().toUpperCase().regex(new RegExp(`^[${ROOM_ALPHABET}]{${LIMITS.ROOM_CODE_LEN}}$`), "bad room code");
80
80
  var PlayerId = import_zod.z.string().max(40);
package/dist/index.d.cts CHANGED
@@ -806,6 +806,16 @@ type Effect = {
806
806
  } | {
807
807
  t: 'endGame';
808
808
  };
809
+ /**
810
+ * One pen sample on the ارسمها canvas, NORMALIZED 0…1 against the canvas side — genuinely FRACTIONAL.
811
+ * Named (rather than inline) so the native codegen can exempt it from the integer coercion it applies
812
+ * to the rest of the outbound protocol: as `{x: Long, y: Long}` a whole drawing collapses into the
813
+ * canvas corner, or fails to decode, depending on the client (gs#56).
814
+ */
815
+ interface StrokePointView {
816
+ x: number;
817
+ y: number;
818
+ }
809
819
  /** A Dama piece as clients see it. */
810
820
  interface DamaPieceView {
811
821
  color: 'black' | 'white';
@@ -873,6 +883,8 @@ type ServerMsg = {
873
883
  pv: number;
874
884
  } | {
875
885
  t: 'joinPending';
886
+ youId: string;
887
+ token: string;
876
888
  } | {
877
889
  t: 'joinRequest';
878
890
  playerId: string;
@@ -902,12 +914,16 @@ type ServerMsg = {
902
914
  hostId: string;
903
915
  hostName: string;
904
916
  hostAvatar?: AvatarView;
917
+ hostPlaying?: boolean;
918
+ hostPinned?: boolean;
905
919
  players: LobbyPlayer[];
906
920
  categories: CategoryView[];
907
921
  selectedCategoryIds: string[];
908
922
  teams: TeamSlotView[];
909
923
  hostActivity: 'configuring' | 'idle';
910
- tally?: Record<string, number>;
924
+ tally?: {
925
+ [playerId: string]: number;
926
+ };
911
927
  modeId: ModeId | null;
912
928
  you: YouContext;
913
929
  } | {
@@ -931,10 +947,7 @@ type ServerMsg = {
931
947
  from: string;
932
948
  strokeId: string;
933
949
  seq: number;
934
- points: {
935
- x: number;
936
- y: number;
937
- }[];
950
+ points: StrokePointView[];
938
951
  color: string;
939
952
  width: number;
940
953
  } | {
@@ -960,4 +973,4 @@ type ServerMsg = {
960
973
  message: string;
961
974
  };
962
975
 
963
- export { type AvatarView, type BuzzerGameMode, CHARACTER_IDS, type CategoryView, type CharacterId, ClientMsg, type DamaMoveView, type DamaPieceView, type DamaStateView, EMOTE_IDS, type Effect, type EmoteId, type ErsimhaStateView, GAMES, GAME_IDS, type GameId, type GameInfo, type GameStateView, type GameStatus, type GameplayFlow, type HelpName, LIMITS, type LobbyPlayer, MIN_SUPPORTED_PV, MODES, MODE_IDS, type ModeId, type ModeInfo, PROTOCOL_VERSION, type QuestionView, ROOM_ALPHABET, type ServerMsg, type SoundName, type TeamSlotView, type TeamView, type YouContext, gameIdForPv, gamesForPv, modesForGame };
976
+ export { type AvatarView, type BuzzerGameMode, CHARACTER_IDS, type CategoryView, type CharacterId, ClientMsg, type DamaMoveView, type DamaPieceView, type DamaStateView, EMOTE_IDS, type Effect, type EmoteId, type ErsimhaStateView, GAMES, GAME_IDS, type GameId, type GameInfo, type GameStateView, type GameStatus, type GameplayFlow, type HelpName, LIMITS, type LobbyPlayer, MIN_SUPPORTED_PV, MODES, MODE_IDS, type ModeId, type ModeInfo, PROTOCOL_VERSION, type QuestionView, ROOM_ALPHABET, type ServerMsg, type SoundName, type StrokePointView, type TeamSlotView, type TeamView, type YouContext, gameIdForPv, gamesForPv, modesForGame };
package/dist/index.d.ts CHANGED
@@ -806,6 +806,16 @@ type Effect = {
806
806
  } | {
807
807
  t: 'endGame';
808
808
  };
809
+ /**
810
+ * One pen sample on the ارسمها canvas, NORMALIZED 0…1 against the canvas side — genuinely FRACTIONAL.
811
+ * Named (rather than inline) so the native codegen can exempt it from the integer coercion it applies
812
+ * to the rest of the outbound protocol: as `{x: Long, y: Long}` a whole drawing collapses into the
813
+ * canvas corner, or fails to decode, depending on the client (gs#56).
814
+ */
815
+ interface StrokePointView {
816
+ x: number;
817
+ y: number;
818
+ }
809
819
  /** A Dama piece as clients see it. */
810
820
  interface DamaPieceView {
811
821
  color: 'black' | 'white';
@@ -873,6 +883,8 @@ type ServerMsg = {
873
883
  pv: number;
874
884
  } | {
875
885
  t: 'joinPending';
886
+ youId: string;
887
+ token: string;
876
888
  } | {
877
889
  t: 'joinRequest';
878
890
  playerId: string;
@@ -902,12 +914,16 @@ type ServerMsg = {
902
914
  hostId: string;
903
915
  hostName: string;
904
916
  hostAvatar?: AvatarView;
917
+ hostPlaying?: boolean;
918
+ hostPinned?: boolean;
905
919
  players: LobbyPlayer[];
906
920
  categories: CategoryView[];
907
921
  selectedCategoryIds: string[];
908
922
  teams: TeamSlotView[];
909
923
  hostActivity: 'configuring' | 'idle';
910
- tally?: Record<string, number>;
924
+ tally?: {
925
+ [playerId: string]: number;
926
+ };
911
927
  modeId: ModeId | null;
912
928
  you: YouContext;
913
929
  } | {
@@ -931,10 +947,7 @@ type ServerMsg = {
931
947
  from: string;
932
948
  strokeId: string;
933
949
  seq: number;
934
- points: {
935
- x: number;
936
- y: number;
937
- }[];
950
+ points: StrokePointView[];
938
951
  color: string;
939
952
  width: number;
940
953
  } | {
@@ -960,4 +973,4 @@ type ServerMsg = {
960
973
  message: string;
961
974
  };
962
975
 
963
- export { type AvatarView, type BuzzerGameMode, CHARACTER_IDS, type CategoryView, type CharacterId, ClientMsg, type DamaMoveView, type DamaPieceView, type DamaStateView, EMOTE_IDS, type Effect, type EmoteId, type ErsimhaStateView, GAMES, GAME_IDS, type GameId, type GameInfo, type GameStateView, type GameStatus, type GameplayFlow, type HelpName, LIMITS, type LobbyPlayer, MIN_SUPPORTED_PV, MODES, MODE_IDS, type ModeId, type ModeInfo, PROTOCOL_VERSION, type QuestionView, ROOM_ALPHABET, type ServerMsg, type SoundName, type TeamSlotView, type TeamView, type YouContext, gameIdForPv, gamesForPv, modesForGame };
976
+ export { type AvatarView, type BuzzerGameMode, CHARACTER_IDS, type CategoryView, type CharacterId, ClientMsg, type DamaMoveView, type DamaPieceView, type DamaStateView, EMOTE_IDS, type Effect, type EmoteId, type ErsimhaStateView, GAMES, GAME_IDS, type GameId, type GameInfo, type GameStateView, type GameStatus, type GameplayFlow, type HelpName, LIMITS, type LobbyPlayer, MIN_SUPPORTED_PV, MODES, MODE_IDS, type ModeId, type ModeInfo, PROTOCOL_VERSION, type QuestionView, ROOM_ALPHABET, type ServerMsg, type SoundName, type StrokePointView, type TeamSlotView, type TeamView, type YouContext, gameIdForPv, gamesForPv, modesForGame };
package/dist/index.js CHANGED
@@ -37,7 +37,7 @@ var modesForGame = (gameId) => MODES.filter((m) => m.gameId === gameId);
37
37
  var EMOTE_IDS = ["laugh", "wow", "think", "gg"];
38
38
  var CHARACTER_IDS = ["m", "f"];
39
39
  var ROOM_ALPHABET = "ACDEFGHJKMNPQRTUVWXY2346789";
40
- var UNSAFE_CHARS = /[\p{Cc}<>]/gu;
40
+ var UNSAFE_CHARS = /[\p{Cc}\u202A-\u202E\u2066-\u2069<>]/gu;
41
41
  var DisplayName = z.string().trim().min(1).max(LIMITS.MAX_NAME_LEN).transform((s) => s.replace(UNSAFE_CHARS, "").trim()).refine((s) => s.length >= 1, "name is empty after sanitizing");
42
42
  var RoomCode = z.string().trim().toUpperCase().regex(new RegExp(`^[${ROOM_ALPHABET}]{${LIMITS.ROOM_CODE_LEN}}$`), "bad room code");
43
43
  var PlayerId = z.string().max(40);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thegeem/protocol",
3
- "version": "0.1.30",
3
+ "version": "0.1.32",
4
4
  "description": "Geem's wire protocol — shared zod schemas + TypeScript types for talking to the Geem game server over Socket.IO. The source of truth all clients implement against.",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://geem.tv",
@@ -29,7 +29,8 @@
29
29
  "build": "tsup",
30
30
  "typecheck": "tsc --noEmit",
31
31
  "release": "node scripts/release.mjs",
32
- "gen:native": "npm run build && node scripts/gen-native.mjs"
32
+ "gen:native": "npm run build && node scripts/gen-native.mjs",
33
+ "gen:native:check": "npm run gen:native && git diff --exit-code -- generated || (echo '\\n✗ protocol/generated is STALE — run `npm run gen:native` and commit the result.\\n Native clients vendor these files (D-006), so drift is silent: the symptom is a feature that just looks unimplemented (gs#61).' && exit 1)"
33
34
  },
34
35
  "dependencies": {
35
36
  "zod": "^3.23.8"