@fuzdev/fuz_app 0.178.0 → 0.180.0
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/actions/CLAUDE.md +106 -0
- package/dist/actions/connection_registry.d.ts +18 -0
- package/dist/actions/connection_registry.d.ts.map +1 -1
- package/dist/actions/connection_registry.js +23 -0
- package/dist/actions/room_action_specs.d.ts +733 -0
- package/dist/actions/room_action_specs.d.ts.map +1 -0
- package/dist/actions/room_action_specs.js +506 -0
- package/dist/actions/room_actions.d.ts +276 -0
- package/dist/actions/room_actions.d.ts.map +1 -0
- package/dist/actions/room_actions.js +394 -0
- package/dist/actions/room_client.svelte.d.ts +399 -0
- package/dist/actions/room_client.svelte.d.ts.map +1 -0
- package/dist/actions/room_client.svelte.js +942 -0
- package/dist/actions/room_registry.d.ts +454 -0
- package/dist/actions/room_registry.d.ts.map +1 -0
- package/dist/actions/room_registry.js +927 -0
- package/dist/auth/role_grant_offer_action_specs.d.ts +1 -1
- package/dist/auth/role_grant_queries.d.ts +17 -0
- package/dist/auth/role_grant_queries.d.ts.map +1 -1
- package/dist/auth/role_grant_queries.js +30 -0
- package/dist/rtc/rtc_mesh.svelte.d.ts +102 -0
- package/dist/rtc/rtc_mesh.svelte.d.ts.map +1 -0
- package/dist/rtc/rtc_mesh.svelte.js +232 -0
- package/dist/rtc/rtc_peer.svelte.d.ts +180 -0
- package/dist/rtc/rtc_peer.svelte.d.ts.map +1 -0
- package/dist/rtc/rtc_peer.svelte.js +397 -0
- package/dist/rtc/rtc_signal.d.ts +74 -0
- package/dist/rtc/rtc_signal.d.ts.map +1 -0
- package/dist/rtc/rtc_signal.js +87 -0
- package/dist/testing/CLAUDE.md +67 -13
- package/dist/testing/cross_backend/action_manifest.d.ts +34 -2
- package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
- package/dist/testing/cross_backend/action_manifest.js +33 -6
- package/dist/testing/cross_backend/capabilities.d.ts +22 -4
- package/dist/testing/cross_backend/capabilities.d.ts.map +1 -1
- package/dist/testing/cross_backend/capabilities.js +4 -1
- package/dist/testing/cross_backend/full_spine_mount.d.ts +31 -6
- package/dist/testing/cross_backend/full_spine_mount.d.ts.map +1 -1
- package/dist/testing/cross_backend/full_spine_mount.js +45 -13
- package/dist/testing/cross_backend/rooms_ws.d.ts +20 -0
- package/dist/testing/cross_backend/rooms_ws.d.ts.map +1 -0
- package/dist/testing/cross_backend/rooms_ws.js +534 -0
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/rust_spine_stub_backend_config.js +4 -1
- package/dist/testing/cross_backend/spine_suites.d.ts +5 -2
- package/dist/testing/cross_backend/spine_suites.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_suites.js +24 -5
- package/dist/testing/cross_backend/spine_surface_constants.d.ts +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.d.ts.map +1 -1
- package/dist/testing/cross_backend/spine_surface_constants.js +2 -1
- package/dist/testing/cross_backend/test_room_authorize.d.ts +47 -0
- package/dist/testing/cross_backend/test_room_authorize.d.ts.map +1 -0
- package/dist/testing/cross_backend/test_room_authorize.js +58 -0
- package/dist/testing/cross_backend/testing_backdoor.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_backdoor.js +10 -4
- package/dist/testing/cross_backend/testing_reset_actions.d.ts +85 -1
- package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
- package/dist/testing/cross_backend/testing_reset_actions.js +57 -3
- package/dist/testing/cross_backend/ts_spine_backend_config.d.ts.map +1 -1
- package/dist/testing/cross_backend/ts_spine_backend_config.js +5 -2
- package/dist/ui/AccountSessions.svelte.d.ts.map +1 -1
- package/dist/ui/AdminAccounts.svelte.d.ts.map +1 -1
- package/dist/ui/AdminAuditLog.svelte.d.ts.map +1 -1
- package/dist/ui/AdminInvites.svelte.d.ts.map +1 -1
- package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
- package/dist/ui/AdminRoleGrantHistory.svelte.d.ts.map +1 -1
- package/dist/ui/AdminSessions.svelte.d.ts.map +1 -1
- package/dist/ui/AdminSettings.svelte.d.ts.map +1 -1
- package/dist/ui/AdminSurface.svelte.d.ts.map +1 -1
- package/dist/ui/BootstrapForm.svelte.d.ts.map +1 -1
- package/dist/ui/ConfirmButton.svelte.d.ts.map +1 -1
- package/dist/ui/Datatable.svelte.d.ts.map +1 -1
- package/dist/ui/LoginForm.svelte.d.ts.map +1 -1
- package/dist/ui/LogoutButton.svelte.d.ts.map +1 -1
- package/dist/ui/OpenSignupToggle.svelte.d.ts.map +1 -1
- package/dist/ui/PopoverButton.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferForm.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferHistory.svelte.d.ts.map +1 -1
- package/dist/ui/RoleGrantOfferInbox.svelte.d.ts.map +1 -1
- package/dist/ui/SignupForm.svelte.d.ts.map +1 -1
- package/dist/ui/SurfaceExplorer.svelte.d.ts.map +1 -1
- package/package.json +19 -19
package/dist/actions/CLAUDE.md
CHANGED
|
@@ -1045,6 +1045,112 @@ Two abort signals composed via `AbortSignal.any`:
|
|
|
1045
1045
|
- `socket_abort_controller` — per-socket, fires when the socket ends: at the server's close (revocation, cap eviction, heartbeat timeout, …) or the client's. Registered with the registry, which aborts it on the closes it makes. Drives every handler's `ctx.signal`.
|
|
1046
1046
|
- `pending_controllers: Map<JsonrpcRequestId, AbortController>` — per-request. Registered before dispatch (one entry per running request — a duplicate live id is refused — so its size is the in-flight count the ceiling bounds), cleared in `finally` so late cancels for a completed id (or a reused id) can't null-abort the wrong handler. Unknown cancels no-op.
|
|
1047
1047
|
|
|
1048
|
+
## Rooms (`actions/room_registry.ts`, `actions/room_action_specs.ts`, `actions/room_actions.ts`)
|
|
1049
|
+
|
|
1050
|
+
A generic live-room primitive over one WS endpoint's `ConnectionRegistry` —
|
|
1051
|
+
the TS twin of the Rust spine's `fuz_realtime::RoomRegistry` and
|
|
1052
|
+
`fuz_actions::room`, one wire, held to it by the `rooms_ws` cross suite. Each
|
|
1053
|
+
module doc holds the detail; the cross-cutting shape:
|
|
1054
|
+
|
|
1055
|
+
- **`RoomRegistry`** (`new RoomRegistry(connections, options)`) — rooms keyed
|
|
1056
|
+
by a consumer's `RoomId` (1–`ROOM_ID_MAX_LENGTH` printable ASCII), holding
|
|
1057
|
+
seats (random `MemberId` per join, keyed by connection and actor) and watches
|
|
1058
|
+
(one per connection and room, for whichever actor last asked). Options:
|
|
1059
|
+
`exclusive` (one seat per actor across the registry, newest admitted wins,
|
|
1060
|
+
with the rejoin tombstone — `ROOM_REJOIN_TOMBSTONE_TTL_MS`,
|
|
1061
|
+
`ROOM_REJOIN_TOMBSTONES_PER_ACTOR`), `max_members_per_room`,
|
|
1062
|
+
`max_payload_bytes`, `max_state_bytes`, `max_watches_per_connection`
|
|
1063
|
+
(`DEFAULT_ROOM_*`), `topology`. Every method runs without an `await`, so no
|
|
1064
|
+
check is separated from its mutation (the Rust registry's one lock). Each
|
|
1065
|
+
room's events carry a per-room `seq`; an empty room is deleted. Refusals are
|
|
1066
|
+
a `RoomResult` (`RoomError`), not throws.
|
|
1067
|
+
- **Two-phase join and watch** — `reserve_seat` / `reserve_watch` before the
|
|
1068
|
+
consumer's authorizer reads, `admit_seat` / `admit_watch` after, so an
|
|
1069
|
+
eviction committing mid-authorizer still reaches the request (an actor or
|
|
1070
|
+
room target refuses it, a scope target poisons it, at most
|
|
1071
|
+
`MAX_POISONED_SCOPES`). The admit consumes the pending entry; a caller that
|
|
1072
|
+
never reaches it calls `withdraw` in a `finally` (the Rust guard's drop). A
|
|
1073
|
+
TS join keeps running after its socket closes, so the admit reads the
|
|
1074
|
+
socket's signal and the close marks every join in flight.
|
|
1075
|
+
- **Disconnect** — the first reserve on a connection adds one listener to
|
|
1076
|
+
`ConnectionRegistry.socket_signal(connection_id)` (the registered
|
|
1077
|
+
`abort_controller`'s signal, which every close path aborts; `null` while
|
|
1078
|
+
pending or once gone); its abort releases every seat (`room_member_left`
|
|
1079
|
+
reason `disconnected`), watch, and join in flight on the next microtask, so a
|
|
1080
|
+
close inside a fan-out (an overflow) never re-enters the registry mid-step.
|
|
1081
|
+
- **Eviction** — `evict(target, reason)` by `actor`, `actor_in_scope`, `room`,
|
|
1082
|
+
or `scope` (`RoomEvictTarget`), covering seats, watches, and joins in flight;
|
|
1083
|
+
the consumer calls it after its authority change commits
|
|
1084
|
+
(`emit_after_commit`). `clear()` drops everything silently, for a test reset.
|
|
1085
|
+
- **The verbs** — `create_room_actions({registry, authorize, limiter},
|
|
1086
|
+
{join_extra?})` returns the `room_*` `RpcAction`s
|
|
1087
|
+
(`all_room_action_specs`), **WS-only**: mount them on a `ws_endpoints` entry
|
|
1088
|
+
(with `room_notification_actions` for the surface), never an RPC endpoint.
|
|
1089
|
+
Actor-required, `side_effects: false`; `room_join` and `room_watch` carry
|
|
1090
|
+
`rate_limit: 'account'`. `RoomAuthorize.authorize({actor_id, account_id,
|
|
1091
|
+
room_id, access}, db)` gets the caller's ids and the pool `db`, never the
|
|
1092
|
+
request's role grants (loaded before the reserve, so possibly older than an
|
|
1093
|
+
eviction); `{allow: false}` answers `room_not_found`, the IDOR mask.
|
|
1094
|
+
`RoomRateLimiter` (`DEFAULT_ROOM_RATE_LIMIT`: 300 requests and 1 MiB per
|
|
1095
|
+
10 s) is per connection, two refilling buckets charged on join, send, and
|
|
1096
|
+
state set — one request plus the payload's or state's `json_escaped_len`,
|
|
1097
|
+
the bytes it adds to each frame — but not watch; `create_room_actions` throws
|
|
1098
|
+
when the limiter can't cover a max-size payload or state
|
|
1099
|
+
(`check_room_limits`). Refusals: the `ERROR_ROOM_*` reasons
|
|
1100
|
+
(`to_room_jsonrpc_error`), `rate_limited` with `data.retry_after`, and
|
|
1101
|
+
`request_cancelled` for a cancelled join or a closed socket.
|
|
1102
|
+
- **Notifications** — `room_member_joined`, `room_member_left`,
|
|
1103
|
+
`room_member_state` (to the other members and the watchers),
|
|
1104
|
+
`room_message` (addressee, or the room minus the sender), `room_seat_lost`
|
|
1105
|
+
(the displaced or evicted seat's own connection, `moved_to` for a move), and
|
|
1106
|
+
`room_watch_ended` — each a `remote_notification` spec with its params schema.
|
|
1107
|
+
|
|
1108
|
+
### Room client (`actions/room_client.svelte.ts`)
|
|
1109
|
+
|
|
1110
|
+
The frontend side, one `RoomClient` per socket and actor (`acting`), holding a
|
|
1111
|
+
reactive `RoomState` per room (`client.room(room_id)`): `members`, `seat`
|
|
1112
|
+
(`RoomSeat` — `member_id`, `topology`, `extra`), `seat_status`
|
|
1113
|
+
(`RoomSeatStatus`), `watching`, `ended` (`RoomSeatEnded`), `watch_ended`,
|
|
1114
|
+
`error`, `local_state`. The module doc holds the reasoning; the shape:
|
|
1115
|
+
|
|
1116
|
+
- **Verbs** — `create_room_rpc(socket)` builds the `RoomRpc` the client takes:
|
|
1117
|
+
the room verbs straight over `FrontendWebsocketClient.request`, unqueued,
|
|
1118
|
+
answers parsed with the output schemas forward-compatibly
|
|
1119
|
+
(`safe_parse_dropping_unknown_keys`), never through the RPC client's
|
|
1120
|
+
transports (which fall back to HTTP while the socket is down, where no room
|
|
1121
|
+
verb is mounted), plus `connection` — the open `WebSocket`, else `null`.
|
|
1122
|
+
- **Wants, converged one request at a time** — `join`, `leave`, `watch`,
|
|
1123
|
+
`unwatch`, `set_state` record a want; one runner per room sends the requests
|
|
1124
|
+
that close the gap, waiting for each answer (the server dispatches a
|
|
1125
|
+
socket's requests concurrently, so a leave could otherwise overtake its
|
|
1126
|
+
join). Nothing is sent while the socket is down. `send` goes out at once.
|
|
1127
|
+
Every verb runs in `untrack`, so a page's `$effect` may call one (with its
|
|
1128
|
+
opposite in the teardown) without depending on room state.
|
|
1129
|
+
- **`seq`** — events before the first join or watch answer buffer, then replay
|
|
1130
|
+
past its `seq`; a live room drops events at or below its last `seq`. A
|
|
1131
|
+
message reaching a live watch while the join is in flight is held for the
|
|
1132
|
+
seat and delivered after `seated`.
|
|
1133
|
+
- **Connections** — the client follows `RoomRpc.connection` itself, an
|
|
1134
|
+
`$effect.root` made in the constructor (a no-op on the server) and ended by
|
|
1135
|
+
`dispose`, calling `sync_connection()`, which compares it by identity, so a
|
|
1136
|
+
close and reopen in one batch still counts; `sync_connection` stays public
|
|
1137
|
+
and runs before each request and notification. A seat lost to the old
|
|
1138
|
+
connection is rejoined with `rejoin_of`; a `room_seat_moved` refusal ends it
|
|
1139
|
+
as moved, and a `rate_limited` one is retried after its `retry_after`, up
|
|
1140
|
+
to `ROOM_REJOIN_RATE_LIMITED_RETRIES_MAX` times (`set_timeout` /
|
|
1141
|
+
`clear_timeout` in `RoomClientOptions`). `room_seat_lost` (moved, evicted,
|
|
1142
|
+
room closed) is never rejoined. Watches are taken again.
|
|
1143
|
+
- **Notifications** — `receive(method, params)` from the RPC client's
|
|
1144
|
+
`'receive'` handlers (`is_room_notification_method`), parsing each with its
|
|
1145
|
+
params schema. `RoomListener` (`add_listener`) hears `seated`, `unseated`
|
|
1146
|
+
(`RoomUnseatedReason`), member events, and messages, in `seq` order except
|
|
1147
|
+
a message held for the seat, heard once it is taken —
|
|
1148
|
+
`rtc/rtc_mesh.svelte.ts`'s `RtcMesh` follows a room through it. A listener
|
|
1149
|
+
that throws is logged; the others still hear, and the join or replay
|
|
1150
|
+
carries on.
|
|
1151
|
+
- **`dispose()`** leaves every seat, drops every watch, and stops following
|
|
1152
|
+
the connection.
|
|
1153
|
+
|
|
1048
1154
|
## Protocol actions (`actions/protocol.ts`)
|
|
1049
1155
|
|
|
1050
1156
|
Three shared `{spec, handler}` tuples that every consumer spreads into both
|
|
@@ -533,6 +533,24 @@ export declare class ConnectionRegistry {
|
|
|
533
533
|
* is still in flight. The twin of the Rust `ConnectionRegistry::is_registered`.
|
|
534
534
|
*/
|
|
535
535
|
is_registered(connection_id: Uuid): boolean;
|
|
536
|
+
/**
|
|
537
|
+
* The socket-scoped signal of an admitted connection — its registered
|
|
538
|
+
* `abort_controller`'s, which every close path aborts: the registry's own
|
|
539
|
+
* closes (a revocation, the cap, an overflow, a stalled write, the
|
|
540
|
+
* shutdown) and `register_action_ws`'s (a heartbeat timeout, an oversized
|
|
541
|
+
* message, a refused admission, the client's close). `null` once the
|
|
542
|
+
* connection is gone, while it is still pending admission, and for one
|
|
543
|
+
* registered without a controller.
|
|
544
|
+
*
|
|
545
|
+
* A room registry (`actions/room_registry.ts`) waits on it, one listener
|
|
546
|
+
* per connection, to release the connection's seats and watches. Twin of
|
|
547
|
+
* the Rust `ConnectionRegistry::socket_signal` (crate-private there, where
|
|
548
|
+
* the room registry shares the crate).
|
|
549
|
+
*
|
|
550
|
+
* @param connection_id - the id `register_pending` / `add_connection` returned
|
|
551
|
+
* @returns the signal, or `null`
|
|
552
|
+
*/
|
|
553
|
+
socket_signal(connection_id: Uuid): AbortSignal | null;
|
|
536
554
|
/**
|
|
537
555
|
* Number of currently **admitted** WebSocket connections.
|
|
538
556
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection_registry.d.ts","sourceRoot":"","sources":["../../src/lib/actions/connection_registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiHG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,EAAe,KAAK,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,KAAK,EACX,gCAAgC,EAChC,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,MAAM,oBAAoB,CAAC;AAe5B,OAAO,EAEN,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,MAAM,mBAAmB,CAAC;AAO3B,OAAO,KAAK,EAAE,qBAAqB,E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class ConnectionRegistry {
|
|
|
824
824
|
is_registered(connection_id) {
|
|
825
825
|
return this.#connections.get(connection_id)?.admitted === true;
|
|
826
826
|
}
|
|
827
|
+
/**
|
|
828
|
+
* The socket-scoped signal of an admitted connection — its registered
|
|
829
|
+
* `abort_controller`'s, which every close path aborts: the registry's own
|
|
830
|
+
* closes (a revocation, the cap, an overflow, a stalled write, the
|
|
831
|
+
* shutdown) and `register_action_ws`'s (a heartbeat timeout, an oversized
|
|
832
|
+
* message, a refused admission, the client's close). `null` once the
|
|
833
|
+
* connection is gone, while it is still pending admission, and for one
|
|
834
|
+
* registered without a controller.
|
|
835
|
+
*
|
|
836
|
+
* A room registry (`actions/room_registry.ts`) waits on it, one listener
|
|
837
|
+
* per connection, to release the connection's seats and watches. Twin of
|
|
838
|
+
* the Rust `ConnectionRegistry::socket_signal` (crate-private there, where
|
|
839
|
+
* the room registry shares the crate).
|
|
840
|
+
*
|
|
841
|
+
* @param connection_id - the id `register_pending` / `add_connection` returned
|
|
842
|
+
* @returns the signal, or `null`
|
|
843
|
+
*/
|
|
844
|
+
socket_signal(connection_id) {
|
|
845
|
+
const entry = this.#connections.get(connection_id);
|
|
846
|
+
if (!entry?.admitted)
|
|
847
|
+
return null;
|
|
848
|
+
return entry.abort_controller?.signal ?? null;
|
|
849
|
+
}
|
|
827
850
|
/**
|
|
828
851
|
* Number of currently **admitted** WebSocket connections.
|
|
829
852
|
*
|