@thegeem/protocol 0.1.29 → 0.1.31

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
@@ -800,9 +800,22 @@ type Effect = {
800
800
  } | {
801
801
  t: 'noHostAdvance';
802
802
  ms: number;
803
+ } | {
804
+ t: 'answerWindow';
805
+ ms: number;
803
806
  } | {
804
807
  t: 'endGame';
805
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
+ }
806
819
  /** A Dama piece as clients see it. */
807
820
  interface DamaPieceView {
808
821
  color: 'black' | 'white';
@@ -870,6 +883,8 @@ type ServerMsg = {
870
883
  pv: number;
871
884
  } | {
872
885
  t: 'joinPending';
886
+ youId: string;
887
+ token: string;
873
888
  } | {
874
889
  t: 'joinRequest';
875
890
  playerId: string;
@@ -904,7 +919,9 @@ type ServerMsg = {
904
919
  selectedCategoryIds: string[];
905
920
  teams: TeamSlotView[];
906
921
  hostActivity: 'configuring' | 'idle';
907
- tally?: Record<string, number>;
922
+ tally?: {
923
+ [playerId: string]: number;
924
+ };
908
925
  modeId: ModeId | null;
909
926
  you: YouContext;
910
927
  } | {
@@ -928,10 +945,7 @@ type ServerMsg = {
928
945
  from: string;
929
946
  strokeId: string;
930
947
  seq: number;
931
- points: {
932
- x: number;
933
- y: number;
934
- }[];
948
+ points: StrokePointView[];
935
949
  color: string;
936
950
  width: number;
937
951
  } | {
@@ -957,4 +971,4 @@ type ServerMsg = {
957
971
  message: string;
958
972
  };
959
973
 
960
- 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 };
974
+ 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
@@ -800,9 +800,22 @@ type Effect = {
800
800
  } | {
801
801
  t: 'noHostAdvance';
802
802
  ms: number;
803
+ } | {
804
+ t: 'answerWindow';
805
+ ms: number;
803
806
  } | {
804
807
  t: 'endGame';
805
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
+ }
806
819
  /** A Dama piece as clients see it. */
807
820
  interface DamaPieceView {
808
821
  color: 'black' | 'white';
@@ -870,6 +883,8 @@ type ServerMsg = {
870
883
  pv: number;
871
884
  } | {
872
885
  t: 'joinPending';
886
+ youId: string;
887
+ token: string;
873
888
  } | {
874
889
  t: 'joinRequest';
875
890
  playerId: string;
@@ -904,7 +919,9 @@ type ServerMsg = {
904
919
  selectedCategoryIds: string[];
905
920
  teams: TeamSlotView[];
906
921
  hostActivity: 'configuring' | 'idle';
907
- tally?: Record<string, number>;
922
+ tally?: {
923
+ [playerId: string]: number;
924
+ };
908
925
  modeId: ModeId | null;
909
926
  you: YouContext;
910
927
  } | {
@@ -928,10 +945,7 @@ type ServerMsg = {
928
945
  from: string;
929
946
  strokeId: string;
930
947
  seq: number;
931
- points: {
932
- x: number;
933
- y: number;
934
- }[];
948
+ points: StrokePointView[];
935
949
  color: string;
936
950
  width: number;
937
951
  } | {
@@ -957,4 +971,4 @@ type ServerMsg = {
957
971
  message: string;
958
972
  };
959
973
 
960
- 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 };
974
+ 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.29",
3
+ "version": "0.1.31",
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"