@hadoku/game-server 0.1.96 → 0.1.98

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.
@@ -11,8 +11,8 @@
11
11
  * them only when the shared secret checks out; otherwise we overwrite them with
12
12
  * the most restrictive identity.
13
13
  */
14
- import { TIER_ORDER, type Tier, rankOf, tierOf, callerIdOf, userIdOf, userKeyOf, accountIdOf, userNameOf, isAdmin } from '@wolffm/service-kernel/auth';
15
- export { TIER_ORDER, rankOf, tierOf, callerIdOf, userIdOf, userKeyOf, accountIdOf, userNameOf, isAdmin };
14
+ import { TIER_ORDER, type Tier, rankOf, tierOf, edgeTierOf, callerIdOf, userIdOf, userKeyOf, accountIdOf, userNameOf, isAdmin } from '@wolffm/service-kernel/auth';
15
+ export { TIER_ORDER, rankOf, tierOf, edgeTierOf, callerIdOf, userIdOf, userKeyOf, accountIdOf, userNameOf, isAdmin };
16
16
  export type { Tier };
17
17
  /**
18
18
  * The floor must be a tier this build knows, and never `public` here —
package/dist/edge-auth.js CHANGED
@@ -11,9 +11,9 @@
11
11
  * them only when the shared secret checks out; otherwise we overwrite them with
12
12
  * the most restrictive identity.
13
13
  */
14
- import { TIER_ORDER, assertFloor as kernelAssertFloor, rankOf, tierOf, callerIdOf, userIdOf, userKeyOf, accountIdOf, userNameOf, isAdmin, } from '@wolffm/service-kernel/auth';
14
+ import { TIER_ORDER, assertFloor as kernelAssertFloor, rankOf, tierOf, edgeTierOf, callerIdOf, userIdOf, userKeyOf, accountIdOf, userNameOf, isAdmin, } from '@wolffm/service-kernel/auth';
15
15
  import { ENV_PREFIX, edgeAuth, gate } from './kernel.js';
16
- export { TIER_ORDER, rankOf, tierOf, callerIdOf, userIdOf, userKeyOf, accountIdOf, userNameOf, isAdmin };
16
+ export { TIER_ORDER, rankOf, tierOf, edgeTierOf, callerIdOf, userIdOf, userKeyOf, accountIdOf, userNameOf, isAdmin };
17
17
  /**
18
18
  * The floor must be a tier this build knows, and never `public` here —
19
19
  * cardtable admits members and friends, never the public tier. An unknown
@@ -1,18 +1,19 @@
1
1
  /**
2
2
  * Adapter: cardtable's binding of `@hadoku/service-kernel/relays`'s `attachUsage` (w93-K3).
3
3
  * `POST /api/usage`: the browser's usage batches (`packages/game-ui/src/usage.ts`), counted here and posted
4
- * to telemetry as one `usage` event per window — which screens were shown and which controls
5
- * pressed, how often, by how many people, by tier. Nothing per click is kept, and nothing is
6
- * answered but 204.
4
+ * to telemetry once per window: one `usage` event for everyone (which screens were shown and which
5
+ * controls pressed, how often, by how many people, by tier) and one `usage-user` event per person
6
+ * with their own ordered trail. The tier reported is the edge's (`edgeTierOf`), so a member reads
7
+ * as a member, not as the friend cardtable's gates treat them as. Nothing is answered but 204.
7
8
  *
8
9
  * Every export and signature below is unchanged from before this moved into the kernel:
9
10
  * `index.ts` imports this path exactly as it did. The cardtable-specific bits are
10
11
  * `@hadoku/platform-wire/telemetry`'s schema and path, bound here — the kernel itself never imports it.
11
12
  */
12
13
  import type { Router } from 'express';
13
- import { MAX_BATCHES_PER_MINUTE, USAGE_TOP, USAGE_WINDOW_MS, type UsageCounter } from '@wolffm/service-kernel/relays';
14
+ import { MAX_BATCHES_PER_MINUTE, USAGE_TOP, USAGE_TRAIL_MAX, USAGE_WINDOW_MS, type UsageCounter } from '@wolffm/service-kernel/relays';
14
15
  import { type Report } from '../telemetry.js';
15
- export { MAX_BATCHES_PER_MINUTE, USAGE_TOP, USAGE_WINDOW_MS };
16
+ export { MAX_BATCHES_PER_MINUTE, USAGE_TOP, USAGE_TRAIL_MAX, USAGE_WINDOW_MS };
16
17
  export type { UsageCounter };
17
18
  export interface UsageDeps {
18
19
  report?: Report;
@@ -1,14 +1,15 @@
1
1
  import { USAGE_PATH, UsageBatchSchema } from '@wolffm/platform-wire/telemetry';
2
- import { attachUsage as kernelAttachUsage, MAX_BATCHES_PER_MINUTE, USAGE_TOP, USAGE_WINDOW_MS, } from '@wolffm/service-kernel/relays';
3
- import { tierOf, userIdOf } from '../edge-auth.js';
2
+ import { attachUsage as kernelAttachUsage, MAX_BATCHES_PER_MINUTE, USAGE_TOP, USAGE_TRAIL_MAX, USAGE_WINDOW_MS, } from '@wolffm/service-kernel/relays';
3
+ import { edgeTierOf, userIdOf, userNameOf } from '../edge-auth.js';
4
4
  import { report as defaultReport } from '../telemetry.js';
5
- export { MAX_BATCHES_PER_MINUTE, USAGE_TOP, USAGE_WINDOW_MS };
5
+ export { MAX_BATCHES_PER_MINUTE, USAGE_TOP, USAGE_TRAIL_MAX, USAGE_WINDOW_MS };
6
6
  export function attachUsage(api, deps = {}) {
7
7
  return kernelAttachUsage(api, {
8
8
  schema: UsageBatchSchema,
9
9
  path: USAGE_PATH,
10
- tierOf,
10
+ tierOf: edgeTierOf,
11
11
  userIdOf,
12
+ nameOf: userNameOf,
12
13
  report: deps.report ?? defaultReport,
13
14
  now: deps.now,
14
15
  windowMs: deps.windowMs,
@@ -222,6 +222,8 @@ export declare function isLifecycle<L extends {
222
222
  export interface TurnSnapshot {
223
223
  turn: number;
224
224
  state: string;
225
+ /** The engine's random as the turn began, so a restore replays the turn's shuffles and rolls; absent, the restore rolls afresh. */
226
+ rng?: number;
225
227
  /** What the game held that {@link state} does not; absent or empty is the whole game. */
226
228
  lossy?: readonly string[];
227
229
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hadoku/game-server",
3
- "version": "0.1.96",
4
- "gitHead": "e5f8a3ad2185e6524f982af947e6850dcf19134d",
3
+ "version": "0.1.98",
4
+ "gitHead": "f1d05adb733a43c0e239197bb1a656eb5575c999",
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.",
@@ -16,9 +16,9 @@
16
16
  "play/remote/"
17
17
  ],
18
18
  "dependencies": {
19
- "@wolffm/host-wire": "npm:@hadoku/host-wire@0.1.96",
20
- "@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.96",
21
- "@wolffm/service-kernel": "npm:@hadoku/service-kernel@0.1.129",
19
+ "@wolffm/host-wire": "npm:@hadoku/host-wire@0.1.98",
20
+ "@wolffm/platform-wire": "npm:@hadoku/platform-wire@0.1.98",
21
+ "@wolffm/service-kernel": "npm:@hadoku/service-kernel@0.1.131",
22
22
  "@wolffm/prefs-client": "npm:@hadoku/prefs-client@^1.1.31",
23
23
  "@wolffm/rooms-protocol": "npm:@hadoku/rooms-protocol@^0.45.128",
24
24
  "@wolffm/rooms-server": "npm:@hadoku/rooms-server@^0.45.128",