@thegeem/protocol 0.1.20 → 0.1.22

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
@@ -95,7 +95,17 @@ var ClientMsg = import_zod.z.discriminatedUnion("t", [
95
95
  import_zod.z.object({ t: import_zod.z.literal("createRoom"), name: DisplayName.optional(), avatar: Avatar.optional(), game: import_zod.z.enum(GAME_IDS).optional(), pv: Pv, idToken: IdToken, platform: Platform }),
96
96
  // Host sets/changes their display name AFTER createRoom (for anonymous one-tap
97
97
  // hosts who started nameless). Host-only; the relay re-broadcasts the lobby.
98
+ // SUPERSEDED by setProfile (kept working for shipped builds).
98
99
  import_zod.z.object({ t: import_zod.z.literal("renameHost"), name: DisplayName }),
100
+ // ANY room member changes their OWN display identity mid-room (gs#48) — lobby or mid-game.
101
+ // One message for both fields because the client's picker edits them together: one atomic
102
+ // update, one re-broadcast, no half-changed roster. Send either field or both; sending
103
+ // neither is a no-op. SELF-ONLY by construction — the server always applies it to the
104
+ // SENDER's seat, so there is no playerId to spoof. Additive: no pv bump.
105
+ // Note: mid-game propagation depends on what the running game's state carries — trivia's
106
+ // view carries names+avatars so it updates live; dama/ersimha views are id-keyed (clients
107
+ // map ids→names from the lobby roster), so a change there lands on the next lobby.
108
+ import_zod.z.object({ t: import_zod.z.literal("setProfile"), name: DisplayName.optional(), avatar: Avatar.optional() }),
99
109
  import_zod.z.object({ t: import_zod.z.literal("joinRoom"), code: RoomCode, name: DisplayName, avatar: Avatar.optional(), pv: Pv, idToken: IdToken, platform: Platform }),
100
110
  import_zod.z.object({ t: import_zod.z.literal("resume"), code: RoomCode, token: import_zod.z.string().max(120), avatar: Avatar.optional(), pv: Pv, idToken: IdToken, platform: Platform }),
101
111
  import_zod.z.object({ t: import_zod.z.literal("leaveRoom") }),
@@ -125,6 +135,14 @@ var ClientMsg = import_zod.z.discriminatedUnion("t", [
125
135
  totalRounds: import_zod.z.number().int().min(1).max(50),
126
136
  categoryIds: import_zod.z.array(import_zod.z.string().max(60)).min(0).max(12),
127
137
  // empty for games without categories (Dama); trivia rejects empty in-handler
138
+ // Is the HOST a participant, or just running the room on the TV? Additive, no pv bump.
139
+ // ⚠ The DEFAULT when omitted is PER-GAME (each game's shipped behavior is preserved):
140
+ // • ersimha (gs#45): omit/false = host stays the TV/spectator (D-030 MVP shape);
141
+ // true = host joins the drawer rotation as first drawer — a pair plays on 2 devices.
142
+ // • dama (gs#47, D-037): omit/true = host plays black (the original 1v1 shape);
143
+ // false = the first two approved joiners take the board and the host WATCHES
144
+ // (yourColor:null) while keeping every host power. Needs 2 approved joiners.
145
+ hostPlays: import_zod.z.boolean().optional(),
128
146
  // PREFERRED: pick a mode from the registry (see MODES). The server maps it to the engine
129
147
  // rules. Send this and omit buzzerMode/noHost. Falls back to the legacy flags below if omitted.
130
148
  modeId: import_zod.z.enum(MODE_IDS).optional(),
package/dist/index.d.cts CHANGED
@@ -134,6 +134,33 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
134
134
  }, {
135
135
  t: "renameHost";
136
136
  name: string;
137
+ }>, z.ZodObject<{
138
+ t: z.ZodLiteral<"setProfile">;
139
+ name: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
140
+ avatar: z.ZodOptional<z.ZodObject<{
141
+ emoji: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
142
+ color: z.ZodString;
143
+ }, "strip", z.ZodTypeAny, {
144
+ emoji: string;
145
+ color: string;
146
+ }, {
147
+ emoji: string;
148
+ color: string;
149
+ }>>;
150
+ }, "strip", z.ZodTypeAny, {
151
+ t: "setProfile";
152
+ name?: string | undefined;
153
+ avatar?: {
154
+ emoji: string;
155
+ color: string;
156
+ } | undefined;
157
+ }, {
158
+ t: "setProfile";
159
+ name?: string | undefined;
160
+ avatar?: {
161
+ emoji: string;
162
+ color: string;
163
+ } | undefined;
137
164
  }>, z.ZodObject<{
138
165
  t: z.ZodLiteral<"joinRoom">;
139
166
  code: z.ZodString;
@@ -295,6 +322,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
295
322
  game: z.ZodOptional<z.ZodEnum<["seedha", "snag", "trivia", "dama", "ersimha"]>>;
296
323
  totalRounds: z.ZodNumber;
297
324
  categoryIds: z.ZodArray<z.ZodString, "many">;
325
+ hostPlays: z.ZodOptional<z.ZodBoolean>;
298
326
  modeId: z.ZodOptional<z.ZodEnum<["solo", "oneDevice", "snag", "multiplayer"]>>;
299
327
  buzzerMode: z.ZodOptional<z.ZodEnum<["off", "solo", "race", "controller"]>>;
300
328
  noHost: z.ZodOptional<z.ZodBoolean>;
@@ -304,6 +332,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
304
332
  totalRounds: number;
305
333
  game?: "seedha" | "snag" | "trivia" | "dama" | "ersimha" | undefined;
306
334
  modeId?: "snag" | "solo" | "oneDevice" | "multiplayer" | undefined;
335
+ hostPlays?: boolean | undefined;
307
336
  buzzerMode?: "solo" | "off" | "race" | "controller" | undefined;
308
337
  noHost?: boolean | undefined;
309
338
  }, {
@@ -312,6 +341,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
312
341
  totalRounds: number;
313
342
  game?: "seedha" | "snag" | "trivia" | "dama" | "ersimha" | undefined;
314
343
  modeId?: "snag" | "solo" | "oneDevice" | "multiplayer" | undefined;
344
+ hostPlays?: boolean | undefined;
315
345
  buzzerMode?: "solo" | "off" | "race" | "controller" | undefined;
316
346
  noHost?: boolean | undefined;
317
347
  }>, z.ZodObject<{
package/dist/index.d.ts CHANGED
@@ -134,6 +134,33 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
134
134
  }, {
135
135
  t: "renameHost";
136
136
  name: string;
137
+ }>, z.ZodObject<{
138
+ t: z.ZodLiteral<"setProfile">;
139
+ name: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
140
+ avatar: z.ZodOptional<z.ZodObject<{
141
+ emoji: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
142
+ color: z.ZodString;
143
+ }, "strip", z.ZodTypeAny, {
144
+ emoji: string;
145
+ color: string;
146
+ }, {
147
+ emoji: string;
148
+ color: string;
149
+ }>>;
150
+ }, "strip", z.ZodTypeAny, {
151
+ t: "setProfile";
152
+ name?: string | undefined;
153
+ avatar?: {
154
+ emoji: string;
155
+ color: string;
156
+ } | undefined;
157
+ }, {
158
+ t: "setProfile";
159
+ name?: string | undefined;
160
+ avatar?: {
161
+ emoji: string;
162
+ color: string;
163
+ } | undefined;
137
164
  }>, z.ZodObject<{
138
165
  t: z.ZodLiteral<"joinRoom">;
139
166
  code: z.ZodString;
@@ -295,6 +322,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
295
322
  game: z.ZodOptional<z.ZodEnum<["seedha", "snag", "trivia", "dama", "ersimha"]>>;
296
323
  totalRounds: z.ZodNumber;
297
324
  categoryIds: z.ZodArray<z.ZodString, "many">;
325
+ hostPlays: z.ZodOptional<z.ZodBoolean>;
298
326
  modeId: z.ZodOptional<z.ZodEnum<["solo", "oneDevice", "snag", "multiplayer"]>>;
299
327
  buzzerMode: z.ZodOptional<z.ZodEnum<["off", "solo", "race", "controller"]>>;
300
328
  noHost: z.ZodOptional<z.ZodBoolean>;
@@ -304,6 +332,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
304
332
  totalRounds: number;
305
333
  game?: "seedha" | "snag" | "trivia" | "dama" | "ersimha" | undefined;
306
334
  modeId?: "snag" | "solo" | "oneDevice" | "multiplayer" | undefined;
335
+ hostPlays?: boolean | undefined;
307
336
  buzzerMode?: "solo" | "off" | "race" | "controller" | undefined;
308
337
  noHost?: boolean | undefined;
309
338
  }, {
@@ -312,6 +341,7 @@ declare const ClientMsg: z.ZodDiscriminatedUnion<"t", [z.ZodObject<{
312
341
  totalRounds: number;
313
342
  game?: "seedha" | "snag" | "trivia" | "dama" | "ersimha" | undefined;
314
343
  modeId?: "snag" | "solo" | "oneDevice" | "multiplayer" | undefined;
344
+ hostPlays?: boolean | undefined;
315
345
  buzzerMode?: "solo" | "off" | "race" | "controller" | undefined;
316
346
  noHost?: boolean | undefined;
317
347
  }>, z.ZodObject<{
package/dist/index.js CHANGED
@@ -60,7 +60,17 @@ var ClientMsg = z.discriminatedUnion("t", [
60
60
  z.object({ t: z.literal("createRoom"), name: DisplayName.optional(), avatar: Avatar.optional(), game: z.enum(GAME_IDS).optional(), pv: Pv, idToken: IdToken, platform: Platform }),
61
61
  // Host sets/changes their display name AFTER createRoom (for anonymous one-tap
62
62
  // hosts who started nameless). Host-only; the relay re-broadcasts the lobby.
63
+ // SUPERSEDED by setProfile (kept working for shipped builds).
63
64
  z.object({ t: z.literal("renameHost"), name: DisplayName }),
65
+ // ANY room member changes their OWN display identity mid-room (gs#48) — lobby or mid-game.
66
+ // One message for both fields because the client's picker edits them together: one atomic
67
+ // update, one re-broadcast, no half-changed roster. Send either field or both; sending
68
+ // neither is a no-op. SELF-ONLY by construction — the server always applies it to the
69
+ // SENDER's seat, so there is no playerId to spoof. Additive: no pv bump.
70
+ // Note: mid-game propagation depends on what the running game's state carries — trivia's
71
+ // view carries names+avatars so it updates live; dama/ersimha views are id-keyed (clients
72
+ // map ids→names from the lobby roster), so a change there lands on the next lobby.
73
+ z.object({ t: z.literal("setProfile"), name: DisplayName.optional(), avatar: Avatar.optional() }),
64
74
  z.object({ t: z.literal("joinRoom"), code: RoomCode, name: DisplayName, avatar: Avatar.optional(), pv: Pv, idToken: IdToken, platform: Platform }),
65
75
  z.object({ t: z.literal("resume"), code: RoomCode, token: z.string().max(120), avatar: Avatar.optional(), pv: Pv, idToken: IdToken, platform: Platform }),
66
76
  z.object({ t: z.literal("leaveRoom") }),
@@ -90,6 +100,14 @@ var ClientMsg = z.discriminatedUnion("t", [
90
100
  totalRounds: z.number().int().min(1).max(50),
91
101
  categoryIds: z.array(z.string().max(60)).min(0).max(12),
92
102
  // empty for games without categories (Dama); trivia rejects empty in-handler
103
+ // Is the HOST a participant, or just running the room on the TV? Additive, no pv bump.
104
+ // ⚠ The DEFAULT when omitted is PER-GAME (each game's shipped behavior is preserved):
105
+ // • ersimha (gs#45): omit/false = host stays the TV/spectator (D-030 MVP shape);
106
+ // true = host joins the drawer rotation as first drawer — a pair plays on 2 devices.
107
+ // • dama (gs#47, D-037): omit/true = host plays black (the original 1v1 shape);
108
+ // false = the first two approved joiners take the board and the host WATCHES
109
+ // (yourColor:null) while keeping every host power. Needs 2 approved joiners.
110
+ hostPlays: z.boolean().optional(),
93
111
  // PREFERRED: pick a mode from the registry (see MODES). The server maps it to the engine
94
112
  // rules. Send this and omit buzzerMode/noHost. Falls back to the legacy flags below if omitted.
95
113
  modeId: z.enum(MODE_IDS).optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thegeem/protocol",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
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",