@hadoku/game-server 0.1.182 → 0.1.183

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.
@@ -153,7 +153,13 @@ export interface SettingsRefusal {
153
153
  * reasons of their own names them in `RoomCoreDeps.settings.refusal`.
154
154
  */
155
155
  export declare function settingsRefusal(reason: string): SettingsRefusal;
156
- /** Every one of the leader's three seat ops, per caller: a burst of 10, then one every 10 s — the same shape as a join attempt, spent only by a leader who is actually a member of the room (checked before this is asked). */
156
+ /**
157
+ * The leader's ops that act on another person or on the room's size, per caller: `seats/remove`,
158
+ * `seats/capacity`, `seats/bot` (the AI replaces a seated human) and `leader`. A burst of 10, then
159
+ * one every 10 s — the same shape as a join attempt. Setting up open seats (`seats/bot-on`,
160
+ * `seats/bot-off`, `seats/close`) spends none of it: a leader fills a whole pod with the AI in
161
+ * one go, and a member's own `seats/sit`/`seats/stand` never spend it either.
162
+ */
157
163
  export declare const SEAT_OP_RATE_LIMIT: RateLimitConfig;
158
164
  /** The request-body schemas and the room-id shape, injected rather than imported: the real values live in a Magic-resolved package. */
159
165
  export interface RoomCoreWire<C, P extends object> {
@@ -106,7 +106,13 @@ function seatOpStatus(res, reason) {
106
106
  }
107
107
  res.status(400).json({ error: reason });
108
108
  }
109
- /** Every one of the leader's three seat ops, per caller: a burst of 10, then one every 10 s — the same shape as a join attempt, spent only by a leader who is actually a member of the room (checked before this is asked). */
109
+ /**
110
+ * The leader's ops that act on another person or on the room's size, per caller: `seats/remove`,
111
+ * `seats/capacity`, `seats/bot` (the AI replaces a seated human) and `leader`. A burst of 10, then
112
+ * one every 10 s — the same shape as a join attempt. Setting up open seats (`seats/bot-on`,
113
+ * `seats/bot-off`, `seats/close`) spends none of it: a leader fills a whole pod with the AI in
114
+ * one go, and a member's own `seats/sit`/`seats/stand` never spend it either.
115
+ */
110
116
  export const SEAT_OP_RATE_LIMIT = {
111
117
  capacity: 10,
112
118
  refillAmount: 1,
@@ -420,21 +426,24 @@ export function attachRoomCore(api, deps, opts = {}) {
420
426
  const seats = deps.seatRoutes;
421
427
  if (seats !== undefined) {
422
428
  // Opted in (`RoomCoreDeps.seatRoutes`): a member sits and stands; the leader closes, opens, and puts the AI in an open seat or takes it back out.
423
- const seatRoute = (path, schema, leaders, run) => {
429
+ /**
430
+ * One opt-in seat route. `leader`: the leader's op, so an operator (`deps.operator`) may act in
431
+ * the leader's place; a member's own sit and stand are not. None of these spends
432
+ * `SEAT_OP_RATE_LIMIT`: they touch only the caller's own seat or an open one, and a leader
433
+ * filling a pod with the AI makes a dozen of them in a row.
434
+ */
435
+ const seatRoute = (path, schema, leader, run) => {
424
436
  rooms.post(`/:id/seats/${path}`, (req, res) => {
425
437
  // No body at all is `{}`, as it is for every other room route.
426
438
  const read = readBody(schema, req.body ?? {});
427
439
  if (!read.ok)
428
440
  return void res.status(400).json({ error: read.error });
429
441
  const body = read.value;
430
- // The leader's ops spend the seat-op limit, as `remove`/`capacity`/`bot` do; a member's own sit and stand do not.
431
- if (leaders && !seatOpLimit(req, res))
432
- return;
433
442
  const caller = callerOf(req);
434
443
  const id = String(req.params.id);
435
444
  if (!wire.roomIdRe.test(id))
436
445
  return noMatch(res);
437
- const result = run(id, caller.id, body, leaders && deps.operator?.(req) === true);
446
+ const result = run(id, caller.id, body, leader && deps.operator?.(req) === true);
438
447
  if (!result.ok)
439
448
  return seatOpStatus(res, result.reason);
440
449
  res.json(roomBody(result.room, caller.id));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hadoku/game-server",
3
- "version": "0.1.182",
4
- "gitHead": "a0fcf2b837ee05bcc0c975d3dd14e27ad620c41c",
3
+ "version": "0.1.183",
4
+ "gitHead": "01148a983236975af19414ad2d04f7d5665864df",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "description": "The server parts any hosted game shares, above the kernel: the app config and edge auth, the room core (identity, seats, sessions, membership, the room list, the generic room routes), match hosting (the host contract, local and remote JVMs, placement, the start queue, recordings, the in-process and relay runtimes), streams, erase, telemetry and usage. Knows no game; Magic plugs in from apps/server. MIT; imports only node built-ins, express, socket.io, @wolffm/* and the platform packages.",
@@ -17,9 +17,9 @@
17
17
  "play/remote/"
18
18
  ],
19
19
  "dependencies": {
20
- "@wolffm/host-wire": "npm:@hadoku/host-wire@0.1.182",
21
- "@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.182",
22
- "@wolffm/service-kernel": "npm:@hadoku/service-kernel@0.1.215",
20
+ "@wolffm/host-wire": "npm:@hadoku/host-wire@0.1.183",
21
+ "@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.183",
22
+ "@wolffm/service-kernel": "npm:@hadoku/service-kernel@0.1.216",
23
23
  "@wolffm/prefs-client": "npm:@hadoku/prefs-client@^1.2.2",
24
24
  "@wolffm/rooms-protocol": "npm:@hadoku/rooms-protocol@^0.45.145",
25
25
  "@wolffm/rooms-server": "npm:@hadoku/rooms-server@^0.45.145",