@hadoku/game-server 0.1.181 → 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.
- package/dist/http/client-events.d.ts +1 -3
- package/dist/http/client-events.js +0 -1
- package/dist/http/room-core.d.ts +7 -1
- package/dist/http/room-core.js +15 -6
- package/dist/play/host.d.ts +0 -1
- package/dist/play/host.js +0 -2
- package/package.json +5 -5
- package/dist/log.d.ts +0 -1
- package/dist/log.js +0 -2
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
* as `client` events, under `svc: 'cardtable-client'`, keyed by page and user. Nothing is stored
|
|
8
8
|
* and nothing is answered but 204; `perf` lines are also rolled up into the 5-minute `frames` event.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
* cardtable-specific bits are `@hadoku/platform-wire/telemetry`'s schema, path and per-second cap, bound here — the kernel itself
|
|
10
|
+
* The cardtable-specific bits are `@hadoku/platform-wire/telemetry`'s schema, path and per-second cap, bound here — the kernel itself
|
|
12
11
|
* never imports it.
|
|
13
12
|
*
|
|
14
13
|
* Read them with `grep -a '"svc":"cardtable-client"' ~/.pm2/logs/cardtable-ppe-out.log` (PPE) or
|
|
@@ -16,7 +15,6 @@
|
|
|
16
15
|
*/
|
|
17
16
|
import type { Router } from 'express';
|
|
18
17
|
import { type JsonLog } from '@wolffm/service-kernel/log';
|
|
19
|
-
export { malformedFacts } from '@wolffm/service-kernel/relays';
|
|
20
18
|
export interface ClientEventsDeps {
|
|
21
19
|
log?: JsonLog;
|
|
22
20
|
now?: () => number;
|
|
@@ -3,7 +3,6 @@ import { attachClientEvents as kernelAttachClientEvents } from '@wolffm/service-
|
|
|
3
3
|
import { userIdOf } from '../edge-auth.js';
|
|
4
4
|
import { frames } from '../frames.js';
|
|
5
5
|
import { jsonLogger } from '@wolffm/service-kernel/log';
|
|
6
|
-
export { malformedFacts } from '@wolffm/service-kernel/relays';
|
|
7
6
|
export function attachClientEvents(api, deps = {}) {
|
|
8
7
|
const log = deps.log ?? jsonLogger('cardtable-client');
|
|
9
8
|
kernelAttachClientEvents(api, {
|
package/dist/http/room-core.d.ts
CHANGED
|
@@ -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
|
-
/**
|
|
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> {
|
package/dist/http/room-core.js
CHANGED
|
@@ -106,7 +106,13 @@ function seatOpStatus(res, reason) {
|
|
|
106
106
|
}
|
|
107
107
|
res.status(400).json({ error: reason });
|
|
108
108
|
}
|
|
109
|
-
/**
|
|
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
|
-
|
|
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,
|
|
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/dist/play/host.d.ts
CHANGED
|
@@ -122,7 +122,6 @@
|
|
|
122
122
|
*/
|
|
123
123
|
import type { JvmLauncher } from './jvm-transport.js';
|
|
124
124
|
import { type JvmHostConfig } from './local-jvm.js';
|
|
125
|
-
export { FORGE_PREFERENCES, jvmHostConfig } from './local-jvm.js';
|
|
126
125
|
export interface SeatSpec {
|
|
127
126
|
/** Forge's player name. Shown to both seats, so never an identity. */
|
|
128
127
|
name: string;
|
package/dist/play/host.js
CHANGED
|
@@ -125,8 +125,6 @@ import { randomBytes } from 'node:crypto';
|
|
|
125
125
|
import { join } from 'node:path';
|
|
126
126
|
import { jsonLogger } from '@wolffm/service-kernel/log';
|
|
127
127
|
import { JVM_HEAP_MB, MATCHES_PER_JVM, RUN_DIR_NAME, localJvmLauncher, writeFileAtomic } from './local-jvm.js';
|
|
128
|
-
// Until auto.test.ts, draftRooms.jvm.test.ts and scripts/agent/{claw-acceptance,local-e2e}.ts import these from local-jvm.
|
|
129
|
-
export { FORGE_PREFERENCES, jvmHostConfig } from './local-jvm.js';
|
|
130
128
|
const LIFECYCLE_T = new Set(['ready', 'fatal', 'frame', 'snapshot']);
|
|
131
129
|
/** Narrows any engine's line onto the four the host itself understands. See {@link HostLifecycleLine}. */
|
|
132
130
|
export function isLifecycle(line) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hadoku/game-server",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"gitHead": "
|
|
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.
|
|
21
|
-
"@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.
|
|
22
|
-
"@wolffm/service-kernel": "npm:@hadoku/service-kernel@0.1.
|
|
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",
|
package/dist/log.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { jsonLogger, type JsonLog } from '@wolffm/service-kernel/log';
|
package/dist/log.js
DELETED