castle-web-cli 0.4.243 → 0.4.245
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/api.d.ts +1 -0
- package/dist/api.js +13 -0
- package/dist/contentOriginTiming.d.ts +13 -0
- package/dist/contentOriginTiming.js +15 -0
- package/dist/imports.js +28 -6
- package/dist/index.js +54 -5
- package/dist/init.js +1 -1
- package/dist/projectState.d.ts +33 -0
- package/dist/projectState.js +97 -0
- package/dist/serve.d.ts +18 -0
- package/dist/serve.js +103 -2
- package/dist/serveSecurity.d.ts +105 -3
- package/dist/serveSecurity.js +500 -39
- package/dist/shell/assets/{index-DulbYIJm.js → index-Bec6LpAv.js} +87 -87
- package/dist/shell/index.html +1 -1
- package/kits/base/castle.json +1 -1
- package/kits/base/sdk/runtime.js +57 -0
- package/kits/hub-game/code/client/chrome.js +9 -2
- package/kits/hub-game/code/client/hookLayer.js +8 -0
- package/kits/hub-game/code/client/padCues.js +2 -0
- package/kits/hub-game/code/client/padReadability.js +6 -1
- package/kits/hub-game/code/client/signals.js +126 -0
- package/kits/hub-game/code/client/state.js +4 -0
- package/kits/hub-game/code/server/friendBests.js +8 -2
- package/kits/hub-game/code/server/hub.js +31 -4
- package/kits/hub-game/code/server/npcs.js +4 -0
- package/kits/hub-game/code/server/party.js +3 -0
- package/kits/hub-game/code/server/resumePose.js +30 -9
- package/kits/hub-game/code/server/signals.js +124 -0
- package/kits/hub-game/code/server/writerLease.js +161 -17
- package/kits/hub-game/code/systems/hub.js +21 -2
- package/kits/hub-game/docs/contract.md +92 -11
- package/kits/hub-game/package.json +1 -1
- package/kits/hub-game/scripts/test-menu-client.mjs +7 -6
- package/kits/hub-game/scripts/test-menu-footer-dom.mjs +94 -0
- package/kits/hub-game/scripts/test-pad-cues.mjs +6 -3
- package/kits/hub-game/scripts/test-resume-pose.mjs +85 -0
- package/kits/hub-game/scripts/test-signals.mjs +412 -0
- package/kits/hub-game/scripts/test-writer-lease-server.mjs +108 -4
- package/kits/hub-game/scripts/test-writer-lease.mjs +385 -1
- package/package.json +2 -2
|
@@ -228,6 +228,7 @@ of any of these. Every hook gets `hub`, the place's context, first:
|
|
|
228
228
|
| `sit(hub, playerId, seatId)` | v1.6, a place with `idle.seats`: a player asked to sit on seat actor `seatId` (§6). v1.158 `idle.expression` also calls this with `seatId: null` for sit-anywhere, independently of `idle.seats`. Return `false` to refuse; a hook that throws refuses |
|
|
229
229
|
| `action(hub, playerId, id)` | v1.74, a place with `actions: true`: an arrived, connected player pressed an id in their current offer, carrying a safe-integer `n` equal to that offer's current version (§9). Stale, removed, another player's, malformed or over-budget presses are silently dropped. Six presses/s with a burst of eight per player; dropped or refused presses spend tokens too. The return is ignored; throws and rejections are contained and logged once. Async hooks are neither serialised nor cancelled when the player leaves. |
|
|
230
230
|
| `menu(hub, playerId, id)` | v1.79, only with `menu: true`: an arrived, connected player picked an item in their current, last-sent menu with its safe-integer `n`, or closed the sheet (`id: "close"`). Stale, unknown, malformed and over-budget picks are dropped; readOnly refuses item picks but still delivers close. Six attempts/s, burst eight per player, including dropped presses. Return ignored; throws/rejections contained and logged once. Async hooks are neither serialised nor cancelled on leave. |
|
|
231
|
+
| `signal(hub, playerId, signal)` | v1.221, optional; defining it is the opt-in (no manifest key): one of a fixed vocabulary of a player's first moments (§12 "First-input signals"). From the client, each at most once per arrival and only within 120 s of it: `{ kind: 'move' }` (first walk input), `{ kind: 'jump' }` (first jump), `{ kind: 'prompt', door }` (the first door prompt shown: a question card offering a door, or a door pad's `hubPadContext` caption). From the kit, every time: `{ kind: 'talk', npc }` (a conversation opened by the Talk button or Act; `npc` is the NPC's actor id, or `'companion'` for the player's own companion), `{ kind: 'press', door }` (the player was put at a door they asked for: the Doors list's or a question card's Go, a People row, a party Go or Go-yes, a friend's House) and `{ kind: 'pad', door }` (the place's `hub.pad` first names them on that door's pad). `signal` is a fresh frozen object; no field is free text. Called after the kit's own work for the event; the return value is ignored, and a hook that throws or rejects is logged once and changes nothing. A kit older than v1.221 never calls it |
|
|
231
232
|
| `answer(hub, playerId, id, text)` | v1.75, only in a place with `ask: true`: that arrived, connected player answered their last-sent and still-current prompt; `text` is the exact string they typed, or `null` for Cancel (§9). The prompt is consumed and its close queued before the hook runs. Refused text on a current id/version consumes the prompt and calls the hook with null; it is never passed on. Two attempts/s, burst four per player; stale, malformed, oversized and dropped messages spend tokens too. Return ignored; throws and rejections contained and logged once without the text or error details. A place must never show what a player typed to another player. |
|
|
232
233
|
| `decor(hub, playerId, op)` | v1.67, a place with `decor`: an offered button or an open catalogue's validated edit (§10 Decorating). The deck checks ownership, stock and collisions and applies the edit; the kit moves or spawns nothing |
|
|
233
234
|
| `ballot(hub, playerId, { face, line, option, mode })` | v1.68, a place with `ballot`: a player tapped the choice card (§6). `face` a player id on their card or null, `line` a manifest line id or null, `option` an option id of the card or null, `mode` the card's mode then. The kit has already checked it against the card that player was last sent and limited it; the hook decides what it means (a line for the card's `feed`, a vote to count). Its return is ignored; a hook that throws is logged |
|
|
@@ -293,7 +294,7 @@ of any of these. Every hook gets `hub`, the place's context, first:
|
|
|
293
294
|
| `hub.mark(playerId, { text, color })` | a coloured tag over a player's avatar for everyone: a team, who is it; `null` clears it (§11, v1.1) |
|
|
294
295
|
| `hub.wear(playerId, { kind, color, rarity })` | put a wearable on a player's avatar, kept on their account in every hub place where the host runs the hub: `kind` `"halo"`, `"aura"`, `"orbit"` or, v1.24, a hat `"hat-<id>"`, `color` `#rrggbb`, `rarity` 0-9; `null` takes it off; true when taken (§11, v1.4) |
|
|
295
296
|
| `hub.friendsAmong(playerId, userIds)` | v1.36: `Promise<string[]>`, the subset of candidate decimal user-id strings that are this connected player's friends (a guest's too: a guest is over 13 like any other player). Deduped, capped at 100; ghost applies mutual follows, age, blocks and the hub gate. Every refusal (including an unknown op), absent hub ops or failure resolves `[]`. Empty answers cached per player for 40 s, non-empty answers for 10 min; requests within that window intersect the cached answer with their candidates, and never send another op inside 31 s. v1.166: an account's first read in a session that comes back empty is cached 5 s and gets one early re-read even inside the 31 s gap; a read begun within that first read's minute holds the next op until the minute ends, so at most two ops go out in it (ghost allows two a minute per player per session); later empty answers keep 40 s and the gap. Optional per-place `freshFriends: true` (v1.99) instead bounds both TTLs to 31 s and exposes the server-only freshness flag. On by use, no manifest key |
|
|
296
|
-
| `hub.friendBests(key, { better: 'higher' or 'lower' })` | v1.57: a helper with `report(playerId, best): Promise<void>` and `friendFor(playerId): Promise<{ userId, username, best } or null>`. Signed-in players only, finite numbers. `report` keeps each user's best in a top-100 deck-storage index `fb:<key>` of `{ userId, username, best, at }` (20-character username, `at` wall-clock milliseconds), through one serialized writer per key per layer. Cross-layer lost updates are acceptable. Index reads cache for 60 s; `friendFor` caches empty membership for 40 s (v1.166: an empty answer from the session's first minute only until `friendsAmong` may read again, 5 s after the provisional first) and non-empty membership for 10 min per player per visit, and selects the best friend from the index. Leaving clears the visit cache. Both methods swallow failures. Keys are 1–60 letters, digits, `_`, `.`, `:`, `-`; use one direction per key. No manifest key, reads or writes until used |
|
|
297
|
+
| `hub.friendBests(key, { better: 'higher' or 'lower' })` | v1.57: a helper with `report(playerId, best): Promise<void>` and `friendFor(playerId): Promise<{ userId, username, best } or null>`. Signed-in players only, finite numbers. `report` keeps each user's best in a top-100 deck-storage index `fb:<key>` of `{ userId, username, best, at }` (20-character username, `at` wall-clock milliseconds), through one serialized writer per key per layer. Cross-layer lost updates are acceptable. Index reads cache for 60 s; `friendFor` caches empty membership for 40 s (v1.166: an empty answer from the session's first minute only until `friendsAmong` may read again, 5 s after the provisional first) and non-empty membership for 10 min per player per visit, and selects the best friend from the index. Leaving clears the visit cache. With a writer lease on (§"Writer leases"), `report(playerId, best, saves?)` writes the index through `saves` when given (a `hub.saves.deck` view, taken when the best was made) or else the account's `hub.saves.deck(userId)` view at the call, so a best whose claim has since been replaced is never written; without a lease it writes the raw deck store as before. Both methods swallow failures. Keys are 1–60 letters, digits, `_`, `.`, `:`, `-`; use one direction per key. No manifest key, reads or writes until used |
|
|
297
298
|
| `hub.leaving(playerId, text)` | v1.52: the line this player reads when leaving this place; a string, trimmed and cut at 120 characters, `null` or empty clears it. The latest call wins; true when taken, otherwise false and warn once. Sent to this player alone, only on change; never in a snapshot (§5) |
|
|
298
299
|
| `hub.tryOn(playerId, { kind, color, rarity } \| null)` | v1.28: show a wearable on a player in this place only, instead of the one they own, until `null`, their leaving or the place's end. Never saved: nothing goes to ghost, the wearable on the account is neither read nor changed, and no other place hears of it. The same shape and refusals as `hub.wear`; true when taken (§11) |
|
|
299
300
|
| `hub.role(playerId, spec \| null)` | v1.157: set a visit-only role `{ id, label, color, hat?, top?, tool? }`; true when taken, false and logged once when refused. Null or no second argument clears; no host calls (§11) |
|
|
@@ -3696,6 +3697,64 @@ place never keeps a stale hidden or visible. A place may pause its own guidance
|
|
|
3696
3697
|
visible. This does not itself reconnect, arrive, leave or change progression;
|
|
3697
3698
|
the existing `resume` hook remains independent.
|
|
3698
3699
|
|
|
3700
|
+
### First-input signals (v1.221, opt-in by hook)
|
|
3701
|
+
|
|
3702
|
+
A place whose module exports a `signal` hook (§4) opts in; there is no
|
|
3703
|
+
manifest key, and an older kit simply never calls the hook. On each genuine
|
|
3704
|
+
arrival there (the arrival the place's `arrive` hook hears, not a rehello or a
|
|
3705
|
+
retained resume) the kit numbers the arrival and adds it to that player's
|
|
3706
|
+
`hub-arrived` as `signals: <n>`. A place without the hook sends
|
|
3707
|
+
`hub-arrived` exactly as before, and its clients send nothing.
|
|
3708
|
+
|
|
3709
|
+
For such an arrival, and only within 120 s of it, the client sends each of
|
|
3710
|
+
these at most once:
|
|
3711
|
+
|
|
3712
|
+
- `{ k: 'hub-signal', kind: 'move', a }`: the first walk input (a walk key,
|
|
3713
|
+
or the drag stick past 0.15);
|
|
3714
|
+
- `{ k: 'hub-signal', kind: 'jump', a }`: the first jump (Space, a tap the
|
|
3715
|
+
Player behavior takes, or Act's Jump);
|
|
3716
|
+
- `{ k: 'hub-signal', kind: 'prompt', a, door }`: the first door prompt
|
|
3717
|
+
shown, which is a question card that offers a door (`again`, a friend's
|
|
3718
|
+
`play`, Your games) or a door pad's caption (`engine.hubPadContext`) once
|
|
3719
|
+
the chrome has actually drawn it visible (not behind an open panel, not
|
|
3720
|
+
left unplaced). A party's
|
|
3721
|
+
proposal card names no door and is not one. A Town's pad words drawn as
|
|
3722
|
+
world labels are not a prompt either: the kit does not watch labels. A
|
|
3723
|
+
Town sees a player step onto a pad as `pad` below.
|
|
3724
|
+
|
|
3725
|
+
Keys typed into a text field count as neither a walk nor a jump. A signal is
|
|
3726
|
+
only marked sent once it went out on a connected socket during that arrival;
|
|
3727
|
+
once all three are sent or the 120 s are over, the client's per-frame check is
|
|
3728
|
+
one comparison. `a` is the arrival number the client was armed with.
|
|
3729
|
+
|
|
3730
|
+
A retained rehello or resume (a rejoined socket, or a page reloaded onto a
|
|
3731
|
+
retained body) is not an arrival. While the current arrival has window and
|
|
3732
|
+
kinds left, the server answers it with `{ k: 'hub-signals', n, left, sent }`:
|
|
3733
|
+
the same arrival number, the milliseconds left of its window and the kinds
|
|
3734
|
+
already spent. The client arms from that and says only what is left; neither
|
|
3735
|
+
the window nor the allowance starts again.
|
|
3736
|
+
|
|
3737
|
+
The server takes each from a present sender whose current arrival is still in
|
|
3738
|
+
its 120 s, named by the session and never by the payload, at most once per kind
|
|
3739
|
+
per arrival. A signal whose `a` is not the current arrival's number (one sent
|
|
3740
|
+
from an earlier arrival's record across a rejoin) is dropped before it spends
|
|
3741
|
+
anything; the once check comes next, before any door lookup, so a repeat costs
|
|
3742
|
+
one lookup. `move` and `jump` carry no other field; `prompt` must name one of the
|
|
3743
|
+
place's doors. Anything else is ignored silently. It is heard during a
|
|
3744
|
+
progress read too, as telemetry.
|
|
3745
|
+
|
|
3746
|
+
The kit adds three of its own, on every occurrence: `talk` when a conversation
|
|
3747
|
+
opens (`hub-npc-open`, or Act's Talk), `press` once it has put a player at a
|
|
3748
|
+
door they asked for (a door jump, a party Go or Go-yes, a friend's House
|
|
3749
|
+
visit), and `pad` when `hub.pad` first names a player on a door's pad. The hook
|
|
3750
|
+
runs after the kit's own work for that event.
|
|
3751
|
+
|
|
3752
|
+
Limits. A Town's pad words drawn as world labels are not a `prompt`; party
|
|
3753
|
+
proposals name no door, so their card is not one either. `talk`, `press` and
|
|
3754
|
+
`pad` are the server's own and fire every time, with no window or once rule; a
|
|
3755
|
+
place that keeps a bounded trace (the Town keeps 120 s) keeps only its own
|
|
3756
|
+
window of them. `move`, `jump` and `prompt` are best-effort: once per arrival,
|
|
3757
|
+
and lost if the socket drops while one is in flight.
|
|
3699
3758
|
|
|
3700
3759
|
A first home unlock (v1.70, §11) sends private `{ k: 'hub-home-unlock' }`
|
|
3701
3760
|
to its player only, announcing "Sent to your house". It carries no item and
|
|
@@ -4078,23 +4137,38 @@ fences this one's later saves. Reset/undo also loses the writer, and so does a
|
|
|
4078
4137
|
claim the platform refuses, or one still failing after 20 seconds. A lost
|
|
4079
4138
|
account stays lost on a same-playerId resume, or while another connected visit
|
|
4080
4139
|
of that account remains here. If a fresh connection has a new playerId and all
|
|
4081
|
-
other visits of its
|
|
4140
|
+
other visits of its account are only retained, the kit first forgets those
|
|
4082
4141
|
visits through ordinary leave cleanup (including the deck's `leave` hook), then
|
|
4083
|
-
joins the new visit
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4142
|
+
joins the new visit. A lost account claims anew before its arrival hooks run; a
|
|
4143
|
+
held one is revalidated (a transient failure retried for up to 20 seconds), and
|
|
4144
|
+
if another instance took it meanwhile the visit claims anew without the notice.
|
|
4145
|
+
Only a check that answers keeps the claim: one refused, or still failing after
|
|
4146
|
+
20 seconds, also claims anew, so the arrival never loads under a claim it may
|
|
4147
|
+
have lost; writes the previous visit already queued go first, each under its own
|
|
4148
|
+
fence, including ones queued while earlier ones were in flight. A check that
|
|
4149
|
+
settles after every connected visit of the account here has gone (a visit held
|
|
4150
|
+
only for `resumePose` counts as gone) never claims anew, so it cannot take the
|
|
4151
|
+
account from another instance; a claim still retrying stops once no visit of the
|
|
4152
|
+
account remains here.
|
|
4153
|
+
A `resumePose` place ends a replaced held visit's pose under its own claim first.
|
|
4154
|
+
Views made while the claim revalidates follow its outcome. A place must reload the account's saves through
|
|
4155
|
+
`hub.saves` on that fresh arrival; `get`/`list` wait for the claim. Once the kit
|
|
4156
|
+
has forgotten every visit, a visit back also claims anew.
|
|
4087
4157
|
The last departure of a held account keeps the lease for 60 seconds for end
|
|
4088
|
-
saves. A host with no save API (`UNKNOWN_COMMAND`, or a non-retryable
|
|
4158
|
+
saves; a visit back inside that window revalidates it the same way. A host with no save API (`UNKNOWN_COMMAND`, or a non-retryable
|
|
4089
4159
|
`CAULDRON_STORAGE_UNAVAILABLE`) saves as before, without a lease.
|
|
4090
4160
|
|
|
4091
4161
|
`hub.saves` exposes `enabled`, `deck(userId)`, `fence(userId)`, `ready(userId)`,
|
|
4092
4162
|
`lost(userId)`, and `onLost(fn)` (called with the user ID; returns unsubscribe).
|
|
4093
4163
|
`deck` returns the raw deck store by identity when disabled or when the host
|
|
4094
|
-
lacks root `claim`/`transaction`. Otherwise its `get`/`list` wait for the claim
|
|
4164
|
+
lacks root `claim`/`transaction`. Otherwise its `get`/`list`/`snapshot` wait for the claim
|
|
4095
4165
|
to commit or give up; `set`/`remove`/`increment`/`transaction`/`conditionalWrite`
|
|
4096
|
-
fence and run in account order.
|
|
4097
|
-
|
|
4166
|
+
fence and run in account order. A view is bound to the claim current when it was
|
|
4167
|
+
made: once the account is claimed anew here, writes through an older view reject
|
|
4168
|
+
with `CAULDRON_STORAGE_WRITER_LOST`, so a write a visit queued never lands under a
|
|
4169
|
+
later visit's claim. Take the view when the write is queued.
|
|
4170
|
+
`user(userId)` provides the same wrapper for user-scoped writes. A `resumePose`
|
|
4171
|
+
place takes, ends and clears the durable pose through this view. Places must use these views for their per-player writes;
|
|
4098
4172
|
shared boards keep their ordinary stores. Root `session.storage` atomic calls
|
|
4099
4173
|
are not wrapped and need an explicit `fence`.
|
|
4100
4174
|
`hub.wallet` fences its own writes: a lost writer locks that account's wallet
|
|
@@ -4105,7 +4179,9 @@ and shows a persistent personal HUD line: “You're playing somewhere else, so
|
|
|
4105
4179
|
progress here isn't saved.” Repeated fences fail locally. The fence and the
|
|
4106
4180
|
ordinary write are separate requests: a write already past its fence when
|
|
4107
4181
|
another instance claims and loads can still land. This one-round-trip window
|
|
4108
|
-
remains; the lease does not make ordinary saves atomic.
|
|
4182
|
+
remains; the lease does not make ordinary saves atomic. The platform cannot close it yet: ordinary
|
|
4183
|
+
`set`/`remove`/`increment` take no writer check, and `transaction`/`conditionalWrite`
|
|
4184
|
+
write only managed targets.
|
|
4109
4185
|
|
|
4110
4186
|
### Town pose retention (v1.98)
|
|
4111
4187
|
|
|
@@ -5312,6 +5388,7 @@ a deck written before them remains valid.
|
|
|
5312
5388
|
|
|
5313
5389
|
| date | change |
|
|
5314
5390
|
| --- | --- |
|
|
5391
|
+
| 2026-11-18 (v1.221) | §4/§12 first-input signals: a place that exports a `signal(hub, playerId, { kind, npc?, door? })` hook hears `move`, `jump` and the first door `prompt` from the client (each at most once per arrival, within 120 s of it; `hub-arrived` carries the arrival's `signals` number only where the hook exists, each `hub-signal` carries it back as `a`, and a retained rehello is answered `hub-signals` with that arrival's remaining window and spent kinds) and the kit's own `talk`, `press` (door jump, party Go/Go-yes, House visit) and `pad` (`hub.pad` step-on). A fixed vocabulary of authored ids, no free text and no manifest key. Without the hook: no wrapper, message, state, hook dispatch or wire field. |
|
|
5315
5392
|
| 2026-11-18 (v1.220) | §"A place replaced under its players" copy: when the ending is seen as the player comes back from away (`multiplayer.returning()`), the line is "<this place's title> closed while you were away. Back to <the place left>…" ("This place closed while you were away…" with no title) instead of "This place was updated", which was not true for an owner's House left empty past its reconnect window. A player who was present still sees the updated line. Copy only: no key, API or wire change. |
|
|
5316
5393
|
| 2026-11-18 (v1.219) | §12 page visibility after a rejoin: a client whose connection is not up forgets the state it last sent and sends its current state once it is connected again (a send into a socket that died unseen, as on an app switch, no longer leaves the server holding a stale hidden); the server takes a rejoin's first `hub-visibility` even when it repeats the kept value, then coalesces as before. An avatar-change hello is not a rejoin. No new key or wire field. |
|
|
5317
5394
|
| 2026-11-17 (v1.218) | Kit-internal, server only, no deck-facing key or API and no wire change: §5 two bodies never start on one spot. A body admitted with no pose where another body takes the scene spawn or the slot its lone arrival would take starts where that arrival will put it (the arrival slot if free, else the free spot beside it; one helper decides both) before its WORLD goes out, so that WORLD is the one placement its client makes, at once; arriving alone it stays there while the spot is still free, and a group with such a member takes the row's slots in the order its members stand along it. An arrival slot (an arrival, and the arrival a fall or a Stuck? unstick puts a player at) or stored pose (cold `resumePose`, arrival pose, retained visit) that another body takes is likewise stepped off on every place, not only on authored floors (`ground.none: true`); a free slot or pose is used exactly. A body takes a spot when it is nearer than two radii and overlaps it in height (one on a floor above or below does not), and only while its player is on the roster (real-time admits a joiner before it removes the bodies of players who left that tick). A group row's later slots are held where a body would stand in them. The search uses the place's own body size and treats a spot past the ground slab's edge (`ground.half`, 100 m by default) as unsupported unless an authored solid holds it; when every candidate fails the slot is shared, as before. Ground-backed places (the Town) kept the spawn for everyone, so two lone joiners stood on exactly the same point; on each client the two capsules were coaxial, Rapier pushed the local one into the ground under the other's avatar, and it could not walk until one left (Nov 17 Market check, reproduced locally). A stepped-off cold restore still reaches its client as the restore always has. Tests: `test-placeat-server` stepoff, arrivalFree and arrivalTaken (WORLD before hello, reports and corrections on: the client moves once), restoreFree, restoreOccupied; `test-standing` slab edge, floors, a leaver on the same tick and an elevated row, `test-rehello` and `test-stuck` updated; physics-3d `test-coaxial-escape`. |
|
|
@@ -5365,6 +5442,10 @@ a deck written before them remains valid.
|
|
|
5365
5442
|
| 2026-10-25 (v1.190) | §8 `hub.hold(playerId, at?, facingDeg?, { turnCamera: true })`: the held player is sent `hub-hold-face` with the held facing on the hold and again at `hub.release`, and their client turns as `hub-jumped` does (the camera to `PI - facing`; under the orbit key the avatar via `faceRequest`). A later hold without the option takes the release turn away; other ends of a hold turn nothing. Absent the option, holds, the wire and v1.85's rule are unchanged. The native host mirrors the turn. |
|
|
5366
5443
|
| 2026-10-25 (v1.191) | §4/§6 `hub.drop(playerId)` with an explicit id always sends that player `hub-drop` when they are in the place, even with no hold the place registered (then without `actor`), so a client holding an object the server never heard of lets go. `hub.drop()` with no id, the return value (registered holds ended) and grab budgets are unchanged. |
|
|
5367
5444
|
| 2026-10-25 (v1.192) | Writer leases: `writerLease: true` (the hub block or a named place; only `true` or absent) makes the newest instance to claim an account the only one that saves it. Each account claims its own empty user target (`hub:writer:`) once per instance; another instance's claim fences this one, whose later per-player writes reject with `CAULDRON_STORAGE_WRITER_LOST` (no network call) and whose visits see the personal HUD line "You're playing somewhere else, so progress here isn't saved." A claim refused, still failing after 20 s, or a reset/undo also loses the writer; the last departure keeps the lease 60 s for end saves. A fresh connection (new player id) of a lost account with no other connected visit here forgets that account's retained visits through ordinary leave cleanup (the deck's `leave` hook included) and claims anew before its arrival hooks; a same-player-id resume, or a fresh visit beside a connected lost one, stays lost. `hub.saves` adds `enabled`, `deck(userId)`, `user(userId)`, `fence(userId)`, `ready(userId)`, `lost(userId)` and `onLost(fn)`; places route per-player writes through `deck`/`user`, `fence` before root `session.storage` atomic calls, and reload an account's saves on every fresh arrival (`get`/`list` wait for the claim); `hub.wallet` fences its own writes. Compatibility: absent, nothing changes (raw stores by identity, no claim, no notice, retention as before); a host without root `claim`/`transaction`, or one answering `UNKNOWN_COMMAND` or a non-retryable `CAULDRON_STORAGE_UNAVAILABLE`, saves as before without a lease. Server-only: no client manifest key or wire field (the notice uses the existing `hub-hud`). A write already past its fence when another instance claims can still land (about one round trip). No deck opts in yet. |
|
|
5445
|
+
| 2026-11-18 (v1.222) | Writer leases (server-only, no wire or manifest change): a fresh connection whose account has no connected visit here forgets that account's retained visits whether or not it is lost, and a visit back to a held claim (retained visits, or the 60 s end-save window) revalidates it; a claim another instance took meanwhile is replaced silently instead of losing the fresh visit. `hub.saves.deck`/`user` views are bound to the claim current when made, so a superseded visit's queued writes reject with `CAULDRON_STORAGE_WRITER_LOST`. `resumePose` takes, ends and clears its durable pose through the lease view, so a fenced instance no longer moves the pose revision. No deck opts in yet. |
|
|
5446
|
+
| 2026-11-18 (v1.223) | Writer leases (server-only, no wire or manifest change): a lone visit back that arrives while an earlier visit's revalidation is still out checks the claim again once that round settles (on whichever claim it settled), so a check from before another instance's takeover never lets the return proceed only to lose its first save. `resumePose` takes its snapshot through the lease view too, so it reads only once the claim settles and keeps a pose the previous writer saved just before; its 5 s read budget starts once the claim has settled. An older pending round that resumes on a replacement claim a newer arrival is already checking waits for that round and keeps the claim it found; it never inherits a claim that round reopens. A take holds its queue place at once, so an end asked while it waits for the claim runs after it. Without `writerLease` nothing changes. No deck opts in yet. |
|
|
5447
|
+
| 2026-11-18 (v1.224) | Writer leases (server-only): `await hub.saves.holds(view)` tells whether the claim a save view writes through is still active and has not been lost, after pending claim checks settle. Unrecognized views and lease-off stores answer true. No manifest or wire change. |
|
|
5448
|
+
| 2026-11-18 (v1.225) | Writer leases (server-only): a lone visit back whose claim check is refused, or still failing after 20 s, claims anew like a taken claim instead of keeping a claim its first save may find lost; writes already queued under the old claim go first under their own fences, a check that settles after the account's connected visits here have all gone (held visits count as gone) never claims anew (taken or not), and a claim still retrying stops once no visit of the account remains. `friendBests` `report(playerId, best, saves?)` under a lease writes the `fb:<key>` index through the given `hub.saves` view (else the account's view at the call), so a best whose claim was replaced never reaches the index. The write-after-fence window stays open: the platform has no writer check on ordinary writes. Without `writerLease` nothing changes. No manifest or wire change. |
|
|
5368
5449
|
| 2026-10-25 (v1.193) | Town purse paid ledger: the Town deck's scope gains `paid:<userId>:<paymentId>`, an integer tokens count for one once-only payment, set once (a repeatable `set`) and never lowered or removed. Payment ids are the fixed list `bell:1`..`bell:7`, `bell:encore:1`..`bell:encore:7` and `errand:cat` (hub-town `tokens.js` `PAID`, T9). A balance is `tokens:<userId>` plus every ledger row, less hat prices and `spent:<userId>`; the Town's wardrobe read and the House's `chirpPurchases` funds read the rows by key. Each payment marks its old claim (`<earn key>:ledger`), raises it, then sets its row, so a layer on older code reads it as claimed. Ghost adds `paid` to `HUB_TOWN_PLAYER_NAMESPACES` (door-deck reads) and to the hub user reset. Compatibility: absent rows, the balance is exactly the old one; an older Town or House reader, or a Ghost without the namespace, shows a lower balance, never a higher one; this House against a Ghost without the namespace has its funds read refused, so Ghost lands first. Gifts, the day's bonuses and game results keep the old claim-then-credit path. No manifest key, wire field or SDK change. |
|
|
5369
5450
|
| 2026-10-25 (v1.187) | §9 Action chips: every place draws its `hub.actions` offers on the action overflow rail. A landscape place without `hub.safeInsets` or the `hubActionOverflow` scene key leaves the bottom-right column, which trimmed offers from the top with no sign, for the rail portrait and safe-inset places already used: one row, two rows, the first offer and More, then Actions, with a sheet listing all. At 844 × 390 three short offers stand in one row; in a crowded 509 × 218 frame an offer the column dropped is now behind More. The rail now also yields to open panels, sounds the chip cue on a press and leaves no focus behind after a pointer press, as the column did, in every place. The scene key is a no-op. No wire field. |
|
|
5370
5451
|
| 2026-10-25 | Chat with Chirp: the chat flight holds the companion on the sightline between the camera and the player, at the depth where its paper is about a tenth of view height (the active lens, as the show pose is sized), facing the camera, instead of 1.3 m beyond the player where a 6 m orbit (and more so the tablet camera) drew it tiny. Panel lift, 0.9 m camera clearance and closing back to following are unchanged; a camera too close behind the player, or facing away, keeps the old spot. No version, manifest or wire change |
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"precheck": "node scripts/test-back-visibility.mjs && node scripts/test-landscape-layout.mjs && node scripts/test-safe-layout.mjs && node scripts/test-safe-caption.mjs && node scripts/test-safe-prompt.mjs && node scripts/test-safe-act.mjs && node scripts/test-action-observers.mjs && node scripts/test-crowd-names.mjs && node scripts/test-default-environment.mjs && node scripts/test-default-environment-root.mjs",
|
|
8
|
-
"check": "eslint . && npm run test:anonymous-entry && node scripts/test-manifest.mjs && node scripts/test-push-visit.mjs && node scripts/test-act.mjs && node scripts/test-act-client.mjs && node scripts/test-act-core.mjs && node scripts/test-act-gate.mjs && node scripts/test-loading-cover.mjs && node scripts/test-frame-batch.mjs && node scripts/test-invites.mjs && node scripts/test-invites-client.mjs && node scripts/test-analytics.mjs && node scripts/test-device-class.mjs && node scripts/test-door-analytics.mjs && node scripts/test-fps-telemetry.mjs && node scripts/test-load-abandon.mjs && node scripts/test-track-queue.mjs && node scripts/test-build.mjs && node scripts/test-decor.mjs && node scripts/test-actions.mjs && node scripts/test-resume-action-order.mjs && node scripts/test-actions-client.mjs && node scripts/test-action-layout.mjs && node scripts/test-ask-slot.mjs && node scripts/test-placement-cache.mjs && node scripts/test-ask.mjs && node scripts/test-ask-client.mjs && node scripts/test-menu.mjs && node scripts/test-held-offers.mjs && node scripts/test-menu-client.mjs && node scripts/test-companion.mjs && node scripts/test-companion-chat.mjs && node scripts/test-companion-client.mjs && node scripts/test-visibility.mjs && node scripts/test-rehello.mjs && node scripts/test-rejoin-yaw.mjs && node scripts/test-resync.mjs && node scripts/test-writer-lease.mjs && node scripts/test-writer-lease-server.mjs && node scripts/test-resume-pose.mjs && node scripts/test-resume-held.mjs && node scripts/test-arrival-pose.mjs && node scripts/test-arrival-pose-server.mjs && node scripts/test-arrival-pose-server.mjs clinic && node scripts/test-arrival-pose-server.mjs cove && node scripts/test-arrival-pose-server.mjs fishing && node scripts/test-arrival-pose-server.mjs plot && node scripts/test-arrival-pose-server.mjs runway && POSE_REPLACE=1 node scripts/test-arrival-pose-server.mjs && POSE_REPLACE=1 node scripts/test-arrival-pose-server.mjs clinic && POSE_REPLACE=1 node scripts/test-arrival-pose-server.mjs cove && POSE_REPLACE=1 node scripts/test-arrival-pose-server.mjs fishing && POSE_REPLACE=1 node scripts/test-arrival-pose-server.mjs plot && POSE_REPLACE=1 node scripts/test-arrival-pose-server.mjs runway && POSE_REPLACE=1 POSE_PLAIN=1 POSE_RESULT=1 node scripts/test-arrival-pose-server.mjs && POSE_LINE=1 node scripts/test-arrival-pose-server.mjs && node scripts/test-resume-pose-server.mjs && node scripts/test-placeat-server.mjs && node scripts/test-resume-pose-server.mjs same-layer && node scripts/test-progress-reset.mjs && node scripts/test-decor-client.mjs && node scripts/test-yours.mjs && node scripts/test-yours-chrome.mjs && node scripts/test-npcs.mjs && node scripts/test-avatar.mjs && node scripts/test-avatar-colors.mjs && node scripts/test-avatar-models.mjs && node scripts/test-avatar-wire.mjs && node scripts/test-avatar-share.mjs && node scripts/test-far-avatars.mjs && node scripts/test-avatar-cap.mjs && node scripts/test-picker.mjs && node scripts/test-friend-bests.mjs && node scripts/test-hub-ops.mjs && node scripts/test-storage-limit.mjs && node scripts/test-wallet.mjs && node scripts/test-hub-leaving.mjs && node scripts/test-standing.mjs && node scripts/test-observed.mjs && node scripts/test-actors.mjs && node scripts/test-grab.mjs && node scripts/test-grab-client.mjs && node scripts/test-grab-orbit.mjs && node scripts/test-idle.mjs && node scripts/test-car.mjs && node scripts/test-vehicle.mjs && node scripts/test-vehicle-client.mjs && node scripts/test-disguise.mjs && node scripts/test-town-day.mjs && node scripts/test-disguise-client.mjs && node scripts/test-emote-bubble.mjs && node scripts/test-emote-wheel.mjs && node scripts/test-shot.mjs && node scripts/test-vis.mjs && node scripts/test-keys.mjs && node scripts/test-attention.mjs && node scripts/test-hub-trip.mjs && node scripts/test-hub-entry.mjs && node scripts/test-host-go.mjs && node scripts/test-no-trips.mjs && node scripts/test-pack.mjs && node scripts/test-interest.mjs && node scripts/test-relations-among.mjs && node scripts/test-relations-refresh.mjs && node scripts/test-fresh-friends.mjs && node scripts/test-cells.mjs && node scripts/test-interest-cells.mjs && node scripts/test-interest-cap.mjs && node scripts/test-object-entry.mjs && node scripts/test-interest-client.mjs && node scripts/test-blocks.mjs && node scripts/test-hub-idle.mjs && node scripts/test-ban-join.mjs && node scripts/test-door.mjs && node scripts/test-door-stay.mjs && node scripts/test-door-stay-client.mjs && node scripts/test-door-jump.mjs && node scripts/test-together.mjs && node scripts/test-hub-controls.mjs && node scripts/test-party.mjs && node scripts/test-say.mjs && node scripts/test-ballot.mjs && node scripts/test-chat.mjs && node scripts/test-no-forms.mjs && node scripts/test-classic.mjs && node scripts/test-actor-budget.mjs && node scripts/test-quality.mjs && node scripts/test-high-only.mjs && node scripts/test-tiers.mjs && node scripts/test-tiers-render.mjs && node scripts/test-tier-cells.mjs && node scripts/test-hats.mjs && node scripts/test-try-on.mjs && node scripts/test-replay.mjs && node scripts/test-replay-client.mjs && node scripts/test-role.mjs && node scripts/test-role-client.mjs && node scripts/test-hold-show.mjs && node scripts/test-hold-show-client.mjs && node scripts/test-earned.mjs && node scripts/test-earned-client.mjs && node scripts/test-celebrate.mjs && node scripts/test-celebrate-client.mjs && node scripts/test-spin.mjs && node scripts/test-hud-clear.mjs && node scripts/test-labels.mjs && node scripts/test-world-labels.mjs && node scripts/test-pad-occupancy.mjs && node scripts/test-pad-cues.mjs && node scripts/test-stuck.mjs && node scripts/test-toast-band.mjs && node scripts/test-soundscape.mjs && node scripts/test-weakest-tier.mjs && node scripts/test-hud-rate.mjs && node scripts/test-ui-tree.mjs && node scripts/test-hud-surface.mjs && node scripts/test-talk-surface.mjs && node scripts/test-action-rail-surface.mjs && node scripts/test-dock-surface.mjs && node scripts/test-ballot-surface.mjs && node scripts/test-menu-surface.mjs && node scripts/test-emote-surface.mjs && node scripts/test-quick-chat-surface.mjs && node scripts/test-text-ask-surface.mjs && node scripts/test-stuck-surface.mjs && node scripts/test-sound-surface.mjs && node scripts/test-ask-surface.mjs && node scripts/test-picker-surface.mjs && node scripts/test-corner-surface.mjs && node scripts/test-apply-deck.mjs && node tools/hubScene/test/export-fixture.mjs && node --test tools/hubScene/test/upload.test.mjs && node --input-type=module -e \"const { bundleProject } = await import('../../cli/dist/bundle.js'); await bundleProject('.');\"",
|
|
8
|
+
"check": "eslint . && npm run test:anonymous-entry && node scripts/test-manifest.mjs && node scripts/test-push-visit.mjs && node scripts/test-act.mjs && node scripts/test-act-client.mjs && node scripts/test-act-core.mjs && node scripts/test-act-gate.mjs && node scripts/test-loading-cover.mjs && node scripts/test-frame-batch.mjs && node scripts/test-invites.mjs && node scripts/test-invites-client.mjs && node scripts/test-analytics.mjs && node scripts/test-device-class.mjs && node scripts/test-door-analytics.mjs && node scripts/test-fps-telemetry.mjs && node scripts/test-load-abandon.mjs && node scripts/test-track-queue.mjs && node scripts/test-build.mjs && node scripts/test-decor.mjs && node scripts/test-actions.mjs && node scripts/test-resume-action-order.mjs && node scripts/test-actions-client.mjs && node scripts/test-action-layout.mjs && node scripts/test-ask-slot.mjs && node scripts/test-placement-cache.mjs && node scripts/test-ask.mjs && node scripts/test-ask-client.mjs && node scripts/test-menu.mjs && node scripts/test-held-offers.mjs && node scripts/test-menu-client.mjs && node scripts/test-companion.mjs && node scripts/test-companion-chat.mjs && node scripts/test-companion-client.mjs && node scripts/test-visibility.mjs && node scripts/test-signals.mjs && node scripts/test-rehello.mjs && node scripts/test-rejoin-yaw.mjs && node scripts/test-resync.mjs && node scripts/test-writer-lease.mjs && node scripts/test-writer-lease-server.mjs && node scripts/test-resume-pose.mjs && node scripts/test-resume-held.mjs && node scripts/test-arrival-pose.mjs && node scripts/test-arrival-pose-server.mjs && node scripts/test-arrival-pose-server.mjs clinic && node scripts/test-arrival-pose-server.mjs cove && node scripts/test-arrival-pose-server.mjs fishing && node scripts/test-arrival-pose-server.mjs plot && node scripts/test-arrival-pose-server.mjs runway && POSE_REPLACE=1 node scripts/test-arrival-pose-server.mjs && POSE_REPLACE=1 node scripts/test-arrival-pose-server.mjs clinic && POSE_REPLACE=1 node scripts/test-arrival-pose-server.mjs cove && POSE_REPLACE=1 node scripts/test-arrival-pose-server.mjs fishing && POSE_REPLACE=1 node scripts/test-arrival-pose-server.mjs plot && POSE_REPLACE=1 node scripts/test-arrival-pose-server.mjs runway && POSE_REPLACE=1 POSE_PLAIN=1 POSE_RESULT=1 node scripts/test-arrival-pose-server.mjs && POSE_LINE=1 node scripts/test-arrival-pose-server.mjs && node scripts/test-resume-pose-server.mjs && node scripts/test-placeat-server.mjs && node scripts/test-resume-pose-server.mjs same-layer && node scripts/test-progress-reset.mjs && node scripts/test-decor-client.mjs && node scripts/test-yours.mjs && node scripts/test-yours-chrome.mjs && node scripts/test-npcs.mjs && node scripts/test-avatar.mjs && node scripts/test-avatar-colors.mjs && node scripts/test-avatar-models.mjs && node scripts/test-avatar-wire.mjs && node scripts/test-avatar-share.mjs && node scripts/test-far-avatars.mjs && node scripts/test-avatar-cap.mjs && node scripts/test-picker.mjs && node scripts/test-friend-bests.mjs && node scripts/test-hub-ops.mjs && node scripts/test-storage-limit.mjs && node scripts/test-wallet.mjs && node scripts/test-hub-leaving.mjs && node scripts/test-standing.mjs && node scripts/test-observed.mjs && node scripts/test-actors.mjs && node scripts/test-grab.mjs && node scripts/test-grab-client.mjs && node scripts/test-grab-orbit.mjs && node scripts/test-idle.mjs && node scripts/test-car.mjs && node scripts/test-vehicle.mjs && node scripts/test-vehicle-client.mjs && node scripts/test-disguise.mjs && node scripts/test-town-day.mjs && node scripts/test-disguise-client.mjs && node scripts/test-emote-bubble.mjs && node scripts/test-emote-wheel.mjs && node scripts/test-shot.mjs && node scripts/test-vis.mjs && node scripts/test-keys.mjs && node scripts/test-attention.mjs && node scripts/test-hub-trip.mjs && node scripts/test-hub-entry.mjs && node scripts/test-host-go.mjs && node scripts/test-no-trips.mjs && node scripts/test-pack.mjs && node scripts/test-interest.mjs && node scripts/test-relations-among.mjs && node scripts/test-relations-refresh.mjs && node scripts/test-fresh-friends.mjs && node scripts/test-cells.mjs && node scripts/test-interest-cells.mjs && node scripts/test-interest-cap.mjs && node scripts/test-object-entry.mjs && node scripts/test-interest-client.mjs && node scripts/test-blocks.mjs && node scripts/test-hub-idle.mjs && node scripts/test-ban-join.mjs && node scripts/test-door.mjs && node scripts/test-door-stay.mjs && node scripts/test-door-stay-client.mjs && node scripts/test-door-jump.mjs && node scripts/test-together.mjs && node scripts/test-hub-controls.mjs && node scripts/test-party.mjs && node scripts/test-say.mjs && node scripts/test-ballot.mjs && node scripts/test-chat.mjs && node scripts/test-no-forms.mjs && node scripts/test-classic.mjs && node scripts/test-actor-budget.mjs && node scripts/test-quality.mjs && node scripts/test-high-only.mjs && node scripts/test-tiers.mjs && node scripts/test-tiers-render.mjs && node scripts/test-tier-cells.mjs && node scripts/test-hats.mjs && node scripts/test-try-on.mjs && node scripts/test-replay.mjs && node scripts/test-replay-client.mjs && node scripts/test-role.mjs && node scripts/test-role-client.mjs && node scripts/test-hold-show.mjs && node scripts/test-hold-show-client.mjs && node scripts/test-earned.mjs && node scripts/test-earned-client.mjs && node scripts/test-celebrate.mjs && node scripts/test-celebrate-client.mjs && node scripts/test-spin.mjs && node scripts/test-hud-clear.mjs && node scripts/test-labels.mjs && node scripts/test-world-labels.mjs && node scripts/test-pad-occupancy.mjs && node scripts/test-pad-cues.mjs && node scripts/test-stuck.mjs && node scripts/test-toast-band.mjs && node scripts/test-soundscape.mjs && node scripts/test-weakest-tier.mjs && node scripts/test-hud-rate.mjs && node scripts/test-ui-tree.mjs && node scripts/test-hud-surface.mjs && node scripts/test-talk-surface.mjs && node scripts/test-action-rail-surface.mjs && node scripts/test-dock-surface.mjs && node scripts/test-ballot-surface.mjs && node scripts/test-menu-surface.mjs && node scripts/test-emote-surface.mjs && node scripts/test-quick-chat-surface.mjs && node scripts/test-text-ask-surface.mjs && node scripts/test-stuck-surface.mjs && node scripts/test-sound-surface.mjs && node scripts/test-ask-surface.mjs && node scripts/test-picker-surface.mjs && node scripts/test-corner-surface.mjs && node scripts/test-apply-deck.mjs && node tools/hubScene/test/export-fixture.mjs && node --test tools/hubScene/test/upload.test.mjs && node --input-type=module -e \"const { bundleProject } = await import('../../cli/dist/bundle.js'); await bundleProject('.');\"",
|
|
9
9
|
"format": "prettier --write \"code/**/*.js\" \"scripts/**/*.mjs\" castle.json package.json",
|
|
10
10
|
"test:grab-carry": "node scripts/test-grab-orbit.mjs",
|
|
11
11
|
"test:anonymous-entry": "node scripts/test-signin-client.mjs && node scripts/test-anonymous-entry.mjs"
|
|
@@ -206,7 +206,7 @@ test('buffer before WORLD, opt-in only, stale versions ignored, place change cle
|
|
|
206
206
|
test('lazy sheet, sections including empty sections, square phone touch tiles, scroll, note and selection', () => {
|
|
207
207
|
const r = rig(), count = r.dom.made.length; r.draw(null); assert.equal(r.dom.made.length, count); assert.deepEqual(r.locks, []);
|
|
208
208
|
r.draw(); const card = sheet(r.dom), blue = tile(r.dom, 'blue'), red = tile(r.dom, 'red');
|
|
209
|
-
assert.equal(card.attrs.role, 'dialog'); assert.equal(card.attrs['aria-label'], 'Wardrobe'); assert.equal(card.style.maxHeight, 'min(max(
|
|
209
|
+
assert.equal(card.attrs.role, 'dialog'); assert.equal(card.attrs['aria-label'], 'Wardrobe'); assert.equal(card.style.maxHeight, 'min(max(55dvh, 220px), calc(100dvh - 24px))');
|
|
210
210
|
assert.equal(card.style.bottom, '0'); assert.equal(card.style.pointerEvents, 'auto');
|
|
211
211
|
assert(card.style.background.startsWith('var(--castle-surface-'));
|
|
212
212
|
for (const text of ['Wardrobe', 'Pick a colour', 'Colours', 'Hats', 'Empty', 'Blue', 'Red', 'Cap', '✓']) assert(find(r.dom, text));
|
|
@@ -235,15 +235,16 @@ test('face caps the sheet at 40 percent, absent face preserves CSS and replaceme
|
|
|
235
235
|
@media (prefers-reduced-motion: reduce) { .hub-menu-tile:not(:disabled):active, .hub-menu-tile.is-pressed { transform: none; } }
|
|
236
236
|
@media (max-width: 600px) { .hub-menu-grid { grid-template-columns: repeat(4, minmax(64px, 1fr)) !important; } }
|
|
237
237
|
@media (max-width: 340px) { .hub-menu-grid { grid-template-columns: repeat(3, minmax(64px, 1fr)) !important; } }
|
|
238
|
-
@supports (height: 1dvh) { .hub-menu-sheet { max-height: min(max(55dvh, 220px), calc(100dvh - 24px)) !important; } }
|
|
239
238
|
`;
|
|
240
239
|
r.draw(); const stylesBefore = { ...sheet(r.dom).styles };
|
|
241
240
|
for (const [i, value] of [spec, { ...spec, face: 0 }, spec, { ...spec, face: 90 }].entries()) {
|
|
242
241
|
r.draw({ n: i + 2, spec: value });
|
|
243
242
|
const card = sheet(r.dom), hasFace = Object.hasOwn(value, 'face');
|
|
244
243
|
// A short view keeps a row of choices: 220 px (150 px with face) at least, short of the view.
|
|
245
|
-
assert.deepEqual(card.styles, { ...stylesBefore, maxHeight: hasFace ? 'min(max(
|
|
246
|
-
assert.equal(card.children.find((node) => node.tag === 'style').textContent,
|
|
244
|
+
assert.deepEqual(card.styles, { ...stylesBefore, maxHeight: hasFace ? 'min(max(40dvh, 150px), calc(100dvh - 24px))' : 'min(max(55dvh, 220px), calc(100dvh - 24px))' });
|
|
245
|
+
assert.equal(card.children.find((node) => node.tag === 'style').textContent, cssBefore);
|
|
246
|
+
// The cap is the inline dvh declaration (the vh one where dvh is unknown), never an !important rule the safe-inset cap would lose to.
|
|
247
|
+
assert(!card.children.find((node) => node.tag === 'style').textContent.includes('max-height'));
|
|
247
248
|
const scroll = tile(r.dom, 'blue').parent.parent;
|
|
248
249
|
assert.equal(scroll.style.overflowY, 'auto'); assert.equal(scroll.style.minHeight, '0');
|
|
249
250
|
assert.equal(scroll.style.overscrollBehavior, 'contain'); assert.equal(scroll.style.touchAction, 'pan-y');
|
|
@@ -488,7 +489,7 @@ test('row menu has complete text columns, no icon slots and a pinned footer; clo
|
|
|
488
489
|
const rows = { title: 'Scores', presentation: 'rows', sections: [{ title: 'Rank · Player · Points', items: [{ id: 'record', label: '1st', readOnly: true, columns: ['1st', 'abcdefghijklmnopqrstuvwx', '500 pts'] }] }], footer: [{ id: 'next', label: 'More scores' }, { id: 'leave', label: 'Back to town' }] };
|
|
489
490
|
r.draw({ n: 1, spec: rows });
|
|
490
491
|
const card = sheet(r.dom), record = tile(r.dom, 'record'), leave = tile(r.dom, 'leave');
|
|
491
|
-
assert.equal(card.style.maxHeight, 'calc(
|
|
492
|
+
assert.equal(card.style.maxHeight, 'calc(100dvh - 24px)');
|
|
492
493
|
assert.equal(hud.style.visibility, 'hidden'); assert.equal(prompt.style.visibility, 'hidden');
|
|
493
494
|
assert.equal(record.tag, 'div'); assert.deepEqual(record.children.map(c => c.textContent), ['1st', 'abcdefghijklmnopqrstuvwx', '500 pts']);
|
|
494
495
|
assert.equal(record.style.gridTemplateColumns, 'minmax(0, 6em) minmax(4em, 1fr) minmax(0, max-content)');
|
|
@@ -496,7 +497,7 @@ test('row menu has complete text columns, no icon slots and a pinned footer; clo
|
|
|
496
497
|
assert.equal(leave.parent.parent, card); assert.equal(leave.parent.style.flexShrink, '0');
|
|
497
498
|
assert.equal(leave.textContent, 'Back to town'); assert.equal(leave.style.minHeight, '44px'); assert.equal(leave.style.aspectRatio, '');
|
|
498
499
|
tap(tile(r.dom, 'next')); assert.deepEqual(r.sent, [{ k: 'hub-menu-pick', id: 'next', n: 1 }]);
|
|
499
|
-
r.draw({ n: 2, spec: { ...rows, face: 0 } }); assert.equal(sheet(r.dom).style.maxHeight, 'min(max(
|
|
500
|
+
r.draw({ n: 2, spec: { ...rows, face: 0 } }); assert.equal(sheet(r.dom).style.maxHeight, 'min(max(40dvh, 150px), calc(100dvh - 24px))');
|
|
500
501
|
r.draw(null); assert.equal(hud.style.visibility, ''); assert.equal(prompt.style.visibility, '');
|
|
501
502
|
r.draw({ n: 3, spec }); assert.equal(tile(r.dom, 'blue').style.aspectRatio, '1');
|
|
502
503
|
r.chrome.dispose();
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// A row sheet's footer (a shop's Buy / Back) stays inside the play frame at
|
|
2
|
+
// every size, in the real CSS cascade with the safe-inset layout on. On a
|
|
3
|
+
// short frame (the 497x213 a 844x390 landscape browser gives an embedded deck)
|
|
4
|
+
// the safe pass caps the sheet's height and moves it; the sheet's own height
|
|
5
|
+
// rule once out-ranked that cap while the move still applied, so the footer
|
|
6
|
+
// left the frame and a tap on Buy hit the page around it.
|
|
7
|
+
import assert from 'node:assert/strict';
|
|
8
|
+
import { readFile } from 'node:fs/promises';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { chromium } from 'playwright-core';
|
|
11
|
+
import { launchChromium } from '../../../experiments/hub-town/qa/launch.mjs';
|
|
12
|
+
|
|
13
|
+
const root = new URL('../../../', import.meta.url);
|
|
14
|
+
// Web embeds (short landscape, portrait), the Android app's portrait card
|
|
15
|
+
// (full width at 800:1120) and its fullscreen landscape, and a smaller frame.
|
|
16
|
+
const SIZES = [[497, 213], [574, 246], [352, 623], [360, 504], [411, 575], [800, 360], [914, 411], [640, 200]];
|
|
17
|
+
// The confirm sheet as a shop sends it (hub-liferp `confirmMenu`).
|
|
18
|
+
const CONFIRM = {
|
|
19
|
+
title: 'Furniture', note: 'You have $150', presentation: 'rows',
|
|
20
|
+
sections: [{ title: 'Buy this?', items: [{ id: 'furn-plant', label: 'Plant', columns: ['Plant', 'Leafy pot plant', '$20'], readOnly: true }] }],
|
|
21
|
+
footer: [{ id: 'buy', label: 'Buy $20' }, { id: 'back', label: 'Back' }],
|
|
22
|
+
};
|
|
23
|
+
const FACED = { ...CONFIRM, face: 0 };
|
|
24
|
+
const browser = await launchChromium(chromium, { executablePath: process.env.CHROME });
|
|
25
|
+
try {
|
|
26
|
+
const page = await browser.newPage();
|
|
27
|
+
await page.route('**/*', async route => {
|
|
28
|
+
const url = new URL(route.request().url());
|
|
29
|
+
assert.equal(url.origin, 'http://layout.test');
|
|
30
|
+
if (url.pathname === '/') {
|
|
31
|
+
return route.fulfill({ contentType: 'text/html', body: '<script type="importmap">{"imports":{"three":"/node_modules/three/build/three.module.js"}}</script><body style="margin:0"></body>' });
|
|
32
|
+
}
|
|
33
|
+
const file = new URL(`.${url.pathname}`, root);
|
|
34
|
+
assert(fileURLToPath(file).startsWith(fileURLToPath(root)));
|
|
35
|
+
await route.fulfill({ contentType: 'text/javascript', body: await readFile(file, 'utf8') });
|
|
36
|
+
});
|
|
37
|
+
let checks = 0;
|
|
38
|
+
for (const [width, height] of SIZES) {
|
|
39
|
+
await page.setViewportSize({ width, height });
|
|
40
|
+
await page.goto('http://layout.test/');
|
|
41
|
+
for (const [name, spec, showHud] of [['confirm', CONFIRM, false], ['faced confirm', FACED, false], ['confirm under the HUD', CONFIRM, true], ['faced confirm under the HUD', FACED, true]]) {
|
|
42
|
+
const seen = await page.evaluate(async ({ spec, showHud }) => {
|
|
43
|
+
const { makeChrome } = await import('/kits/hub-game/code/client/chrome.js');
|
|
44
|
+
const chrome = makeChrome({ avatarCount: 1, onBack() {}, onAvatar() {}, safeInsets: true });
|
|
45
|
+
try {
|
|
46
|
+
chrome.setHudClear(true);
|
|
47
|
+
chrome.setHud({ big: '$150', text: 'Step up to the counter' }, null);
|
|
48
|
+
chrome.setMenu({ n: 1, spec }, () => {});
|
|
49
|
+
// Live Hollowbrook (iWhMzrJZV6hF, Nov 18) shows its cash HUD over an
|
|
50
|
+
// open row sheet; that HUD's band is what leaves the sheet a short
|
|
51
|
+
// place under the host corners. Emulate the state seen there.
|
|
52
|
+
if (showHud) document.querySelector('[data-hub-copy]').parentElement.style.visibility = '';
|
|
53
|
+
for (let i = 0; i < 3; i++) {
|
|
54
|
+
chrome.flushSafeInsets();
|
|
55
|
+
await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve)));
|
|
56
|
+
chrome.frameSafeInsets();
|
|
57
|
+
}
|
|
58
|
+
const sheet = document.querySelector('[data-hub="menu"]');
|
|
59
|
+
const s = sheet.getBoundingClientRect();
|
|
60
|
+
const buttons = ['buy', 'back'].map((id) => {
|
|
61
|
+
const b = sheet.querySelector(`[data-menu-footer] button[data-id="${id}"]`);
|
|
62
|
+
const r = b.getBoundingClientRect();
|
|
63
|
+
const hit = document.elementFromPoint(r.left + r.width / 2, r.top + r.height / 2);
|
|
64
|
+
// As first drawn, unscrolled: inside the sheet's own visible box too.
|
|
65
|
+
return { id, top: r.top, bottom: r.bottom, h: r.height, hits: hit === b || b.contains(hit), inSheet: r.top >= s.top - 0.5 && r.bottom <= s.bottom + 0.5 };
|
|
66
|
+
});
|
|
67
|
+
const hudNode = document.querySelector('[data-hub-copy]').parentElement;
|
|
68
|
+
return { hudShown: getComputedStyle(hudNode).visibility === 'visible', capped: sheet.hasAttribute('data-hub-safe-max-height'), moved: sheet.hasAttribute('data-hub-safe-translate'), boxes: chrome.layout().boxes, safe: sheet.getAttribute('style').match(/--hub-safe[^;]*/g), sheet: { top: s.top, bottom: s.bottom, h: s.height }, buttons };
|
|
69
|
+
} finally {
|
|
70
|
+
chrome.dispose();
|
|
71
|
+
}
|
|
72
|
+
}, { spec, showHud });
|
|
73
|
+
const at = `${width}x${height} ${name}: ${JSON.stringify(seen)}`;
|
|
74
|
+
// The live case: the shown HUD leaves the sheet a short place, so the
|
|
75
|
+
// safe pass both caps and moves it. Without both, the cascade this
|
|
76
|
+
// test guards was not exercised.
|
|
77
|
+
if (showHud) assert(seen.hudShown, `the HUD is shown, ${at}`);
|
|
78
|
+
if (showHud && width === 497 && height === 213 && name === 'confirm under the HUD') {
|
|
79
|
+
assert(seen.capped && seen.moved, `the safe pass caps and moves the sheet, ${at}`);
|
|
80
|
+
}
|
|
81
|
+
assert(seen.sheet.top >= -0.5 && seen.sheet.bottom <= height + 0.5, `sheet inside the frame, ${at}`);
|
|
82
|
+
for (const b of seen.buttons) {
|
|
83
|
+
assert(b.top >= -0.5 && b.bottom <= height + 0.5, `${b.id} inside the frame, ${at}`);
|
|
84
|
+
assert(b.h >= 43.5, `${b.id} keeps its 44 px target, ${at}`);
|
|
85
|
+
assert(b.hits, `a tap on ${b.id} reaches it, ${at}`);
|
|
86
|
+
assert(b.inSheet, `${b.id} shows without scrolling, ${at}`);
|
|
87
|
+
}
|
|
88
|
+
checks++;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
console.log(`menu footer: ${checks} real DOM size checks passed`);
|
|
92
|
+
} finally {
|
|
93
|
+
await browser.close();
|
|
94
|
+
}
|
|
@@ -256,15 +256,18 @@ caption.size = { w: 180, h: 70 };
|
|
|
256
256
|
const obstacle = document.createElement('div');
|
|
257
257
|
obstacle.rect = { left: 0, right: 844, top: 0, bottom: 390 };
|
|
258
258
|
chrome.safeSurface('full-screen-hud', obstacle, 'text');
|
|
259
|
-
|
|
259
|
+
// v1.221: setPadContext says whether the caption is drawn and visible.
|
|
260
|
+
assert.equal(chrome.setPadContext(text), false, 'an unplaced caption is not shown');
|
|
260
261
|
assert.equal(caption.style.visibility, 'hidden', 'no slot suppresses the caption');
|
|
261
262
|
chrome.safeSurface('full-screen-hud', null);
|
|
262
|
-
chrome.setPadContext(text);
|
|
263
|
+
assert.equal(chrome.setPadContext(text), true, 'a placed caption is shown');
|
|
263
264
|
assert.equal(caption.style.visibility, '');
|
|
265
|
+
assert.equal(chrome.setPadContext(null), false);
|
|
266
|
+
chrome.setPadContext(text);
|
|
264
267
|
const panel = document.createElement('div');
|
|
265
268
|
panel.rect = { left: 0, right: 100, top: 0, bottom: 100 };
|
|
266
269
|
chrome.safeSurface('invite-dialog', panel, 'card');
|
|
267
|
-
chrome.setPadContext(text);
|
|
270
|
+
assert.equal(chrome.setPadContext(text), false, 'a caption behind an open panel is not shown');
|
|
268
271
|
assert.equal(caption.style.visibility, 'hidden', 'any registered open panel hides the caption');
|
|
269
272
|
chrome.safeSurface('invite-dialog', null);
|
|
270
273
|
// v1.217: an open cabinet board hides the caption and is opaque; the chip
|
|
@@ -140,3 +140,88 @@ void cleanupHung.prune();
|
|
|
140
140
|
void cleanupHung.prune();
|
|
141
141
|
assert.equal(cleanupCalls, 1, 'hung cleanup is single-flight');
|
|
142
142
|
console.log('resumePose: cursor coverage and hung cleanup single-flight passed');
|
|
143
|
+
|
|
144
|
+
// A leased take snapshots only once the claim settles: the previous writer's
|
|
145
|
+
// last pose save, landing before that, is the revision it consumes.
|
|
146
|
+
{
|
|
147
|
+
const shared = poseStorage();
|
|
148
|
+
const raw = { storage: { deck: shared } };
|
|
149
|
+
const old = store(raw, 'main');
|
|
150
|
+
await old.take('102');
|
|
151
|
+
let settle;
|
|
152
|
+
const claimed = new Promise((resolve) => { settle = resolve; });
|
|
153
|
+
const leased = new Proxy(shared, {
|
|
154
|
+
get(target, name) {
|
|
155
|
+
if (name === 'snapshot') { return async (...args) => { await claimed; return target.snapshot(...args); }; }
|
|
156
|
+
return typeof target[name] === 'function' ? target[name].bind(target) : target[name];
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
const fresh = store(raw, 'main', null, () => leased);
|
|
160
|
+
const taking = fresh.take('102', 'return');
|
|
161
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
162
|
+
await old.end('102', pose);
|
|
163
|
+
settle();
|
|
164
|
+
assert.deepEqual(await taking, pose, 'the return keeps the pose saved before its claim settled');
|
|
165
|
+
console.log('resumePose: leased take waits for the claim passed');
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// A slow claim does not eat the take's read budget: the pose is restored and
|
|
169
|
+
// its revision kept for the next departure.
|
|
170
|
+
{
|
|
171
|
+
const shared = poseStorage();
|
|
172
|
+
const raw = { storage: { deck: shared } };
|
|
173
|
+
const old = store(raw, 'main');
|
|
174
|
+
await old.take('102');
|
|
175
|
+
await old.end('102', pose);
|
|
176
|
+
const realNow = Date.now;
|
|
177
|
+
let skew = 0;
|
|
178
|
+
Date.now = () => realNow() + skew;
|
|
179
|
+
try {
|
|
180
|
+
let settle;
|
|
181
|
+
const claimed = new Promise((resolve) => { settle = resolve; });
|
|
182
|
+
const send = shared.transaction.bind(shared);
|
|
183
|
+
const slow = new Proxy(shared, {
|
|
184
|
+
get(target, name) {
|
|
185
|
+
// The clear's reply comes back 600 ms later.
|
|
186
|
+
if (name === 'transaction') { return async (input) => { const out = await send(input); skew += 600; return out; }; }
|
|
187
|
+
// As the lease view: reads wait for the claim.
|
|
188
|
+
if (name === 'snapshot') { return async (...args) => { await claimed; return target.snapshot(...args); }; }
|
|
189
|
+
return typeof target[name] === 'function' ? target[name].bind(target) : target[name];
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
const fresh = store(raw, 'main', null, () => slow, () => claimed);
|
|
193
|
+
const taking = fresh.take('102', 'return');
|
|
194
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
195
|
+
// The claim settles 4.6 s in.
|
|
196
|
+
skew += 4600;
|
|
197
|
+
settle();
|
|
198
|
+
assert.deepEqual(await taking, pose, 'the slow claim leaves the take its whole budget');
|
|
199
|
+
const moved = { at: { x: 1, y: 1, z: 1 }, facing: 0 };
|
|
200
|
+
await fresh.end('102', moved, Date.now(), 'return');
|
|
201
|
+
assert.deepEqual(await store(raw, 'main').take('102'), moved, 'its revision is kept for the next departure');
|
|
202
|
+
} finally {
|
|
203
|
+
Date.now = realNow;
|
|
204
|
+
}
|
|
205
|
+
console.log('resumePose: a slow claim keeps the take\'s budget passed');
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// An end asked while a take waits for the claim runs after that take: the
|
|
209
|
+
// departure's pose is saved, not dropped for want of a revision.
|
|
210
|
+
{
|
|
211
|
+
const shared = poseStorage();
|
|
212
|
+
const raw = { storage: { deck: shared } };
|
|
213
|
+
const first = store(raw, 'main');
|
|
214
|
+
await first.take('102');
|
|
215
|
+
await first.end('102', pose);
|
|
216
|
+
let settle;
|
|
217
|
+
const claimed = new Promise((resolve) => { settle = resolve; });
|
|
218
|
+
const fresh = store(raw, 'main', null, () => shared, () => claimed);
|
|
219
|
+
const taking = fresh.take('102', 'v2');
|
|
220
|
+
const moved = { at: { x: 2, y: 1, z: 2 }, facing: 1 };
|
|
221
|
+
const ending = fresh.end('102', moved, Date.now(), 'v2');
|
|
222
|
+
settle();
|
|
223
|
+
assert.deepEqual(await taking, pose);
|
|
224
|
+
await ending;
|
|
225
|
+
assert.deepEqual(await store(raw, 'main').take('102'), moved, 'the quick departure\'s pose was saved');
|
|
226
|
+
console.log('resumePose: an end during a take\'s claim wait runs after it passed');
|
|
227
|
+
}
|