From b311a8a2b631b0664569ce074372c857218291a2 Mon Sep 17 00:00:00 2001 From: clockwork-labs-bot Date: Sun, 13 Sep 2026 08:10:05 -0400 Subject: [PATCH 1/9] docs: fix TypeScript table count return type --- .../00600-clients/00700-typescript-reference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/00200-core-concepts/00600-clients/00700-typescript-reference.md b/docs/docs/00200-core-concepts/00600-clients/00700-typescript-reference.md index 68d84fe951d..34100ce7e84 100644 --- a/docs/docs/00200-core-concepts/00600-clients/00700-typescript-reference.md +++ b/docs/docs/00200-core-concepts/00600-clients/00700-typescript-reference.md @@ -924,7 +924,7 @@ Each table or view defined by a module has an accessor method, whose name is the ```typescript class TableHandle { - public count(): number; + public count(): bigint; } ``` From 80116c7d208a392bd32c9a1d9175cf24b975e349 Mon Sep 17 00:00:00 2001 From: clockwork-labs-bot Date: Mon, 14 Sep 2026 08:11:49 -0400 Subject: [PATCH 2/9] docs: clarify environment value preservation --- .../00100-databases/00300-spacetime-publish.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md b/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md index dd805b69ecf..15d52f35936 100644 --- a/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md +++ b/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md @@ -106,7 +106,7 @@ For all available publishing options and flags, see the [`spacetime publish` CLI ### Environment Variables -Modules can declare environment variables for configuration and secrets. Each publish supplies the complete set of values from the target's `env` configuration and declared shell variables. Required values must be supplied on every publish; omitted optional values are removed. The module and its environment update atomically. +Modules can declare environment variables for configuration and secrets. Each publish supplies values from the target's `env` configuration and declared shell variables, then preserves unspecified stored values by default. Required values must exist in the resulting environment; optional values are removed only when you unset them explicitly or use `--replace-env`. The module and its environment update atomically. See [Environment Variables](./00700-environment-variables.md) for declarations, reading values in module code, publishing examples, and private tables for secrets that need to change without republishing. From dc5eb44d9cf2bb3db94722acda4becb8bbdd921e Mon Sep 17 00:00:00 2001 From: clockwork-labs-bot Date: Tue, 15 Sep 2026 08:10:06 -0400 Subject: [PATCH 3/9] docs: fix C# auth reducer snippet --- .../00200-core-concepts/00500-authentication/00500-usage.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/docs/00200-core-concepts/00500-authentication/00500-usage.md b/docs/docs/00200-core-concepts/00500-authentication/00500-usage.md index a022cc1dc65..65c051ba599 100644 --- a/docs/docs/00200-core-concepts/00500-authentication/00500-usage.md +++ b/docs/docs/00200-core-concepts/00500-authentication/00500-usage.md @@ -132,7 +132,9 @@ public static readonly List OIDC_CLIENT_IDS = new() { "client_XXXXXXXXXXXXXXXXXXXXXX", }; -public void Connect(ReducerContext ctx) + +[Reducer(ReducerKind.ClientConnected)] +public static void Connect(ReducerContext ctx) { var claims = ctx.SenderAuth.Jwt ?? throw new Exception("Client connected without JWT"); if (claims.Issuer != "https://auth.spacetimedb.com/oidc") From 7dbd695020c93045057a93247951951b802f49ed Mon Sep 17 00:00:00 2001 From: clockwork-labs-bot Date: Wed, 16 Sep 2026 08:09:57 -0400 Subject: [PATCH 4/9] docs: clarify procedure HTTP decompression --- .../00200-core-concepts/00200-functions/00400-procedures.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/docs/00200-core-concepts/00200-functions/00400-procedures.md b/docs/docs/00200-core-concepts/00200-functions/00400-procedures.md index 30be60eceae..58be1005c97 100644 --- a/docs/docs/00200-core-concepts/00200-functions/00400-procedures.md +++ b/docs/docs/00200-core-concepts/00200-functions/00400-procedures.md @@ -875,6 +875,11 @@ Procedures can't send requests at the same time as holding open a [transaction]( +Procedure HTTP requests automatically accept gzip and Brotli responses and expose the decoded +response body to module code. If you set an `Accept-Encoding` header yourself, the response body is +still decoded by the host, so do not manually decompress it in the module. Headers that describe the +compressed wire body, such as `Content-Encoding` and `Content-Length`, may be absent after decoding. + :::note If no timeout is specified, HTTP requests default to 30 seconds. User-specified timeouts are clamped to a maximum of 180 seconds by the host. ::: From 07fe0ac5868e80c6ea631ef385817dccaf34da8d Mon Sep 17 00:00:00 2001 From: clockwork-labs-bot Date: Thu, 17 Sep 2026 08:10:21 -0400 Subject: [PATCH 5/9] docs: fix TypeScript procedure argument type --- .../00200-core-concepts/00200-functions/00400-procedures.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/00200-core-concepts/00200-functions/00400-procedures.md b/docs/docs/00200-core-concepts/00200-functions/00400-procedures.md index 58be1005c97..0236f5da9d7 100644 --- a/docs/docs/00200-core-concepts/00200-functions/00400-procedures.md +++ b/docs/docs/00200-core-concepts/00200-functions/00400-procedures.md @@ -140,7 +140,7 @@ const myTable = table( const spacetimedb = schema({ myTable }); export default spacetimedb; -export const insertAValue = spacetimedb.procedure({ a: t.u32(), b: t.u32() }, t.unit(), (ctx, { a, b }) => { +export const insertAValue = spacetimedb.procedure({ a: t.u32(), b: t.string() }, t.unit(), (ctx, { a, b }) => { ctx.withTx(ctx => { ctx.db.myTable.insert({ a, b }); }); From 399fb6f311a94a0bd63fa5340bdde59aed439dc7 Mon Sep 17 00:00:00 2001 From: clockwork-labs-bot Date: Tue, 13 Oct 2026 17:13:38 -0400 Subject: [PATCH 6/9] docs: align reconnect agent skills --- skills/csharp-client/SKILL.md | 4 ++-- skills/typescript-client/SKILL.md | 9 +++++++-- skills/unity/SKILL.md | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/skills/csharp-client/SKILL.md b/skills/csharp-client/SKILL.md index 47ad75496f9..8af6787560d 100644 --- a/skills/csharp-client/SKILL.md +++ b/skills/csharp-client/SKILL.md @@ -54,9 +54,9 @@ Automatic reconnect is opt-in: add `.WithAutomaticReconnect()` to the builder. I Keep calling `FrameTick()` while `IsActive` is false. `IsReconnecting` is true while recovering before the next handshake. Use `.OnDisconnect((conn, error, next) => ...)` and `.OnConnectError((error, next) => ...)` to inspect `NextReconnect?`: a non-null value provides `Attempt` and `Delay`; null means no retry is scheduled. Existing callback overloads still work. -`OnConnect` runs on every successful reconnect, so create the subscription in the example above only on the first connection, or move it after `Build()`. Register row callbacks once as well. The same connection, identity, table handles, and subscriptions survive; each attempt gets a fresh `ConnectionId`. Cached rows stay readable but stale during outages. The SDK replays subscriptions in one batch and emits only net row changes. Subscription `OnApplied` runs again after replay; use it to mark data ready, not for repeated one-time setup. +`OnConnect` runs once per `DbConnection`, on the first successful connection. Successful automatic reconnects invoke `OnAutomaticReconnect` before subscription replay instead. Register subscriptions and row callbacks once, either in `OnConnect` or after `Build()`, and use `OnAutomaticReconnect` for recovery-specific work such as saving a refreshed token. The same connection, identity, table handles, and subscriptions survive; each attempt gets a fresh `ConnectionId`. Cached rows stay readable but stale during outages. The SDK replays subscriptions in one batch and emits only net row changes. Subscription `OnApplied` runs again after replay; use it to mark data ready, not for repeated one-time setup. -For expiring credentials, combine `.WithToken(initialToken)` with `.WithTokenProvider(() => RefreshTokenAsync())`, where your provider returns `Task` for the same identity. The provider is not called for the initial connection. Before retries, it is called when remaining validity is at most 30 seconds or 5% of the token lifetime, whichever is greater, when expiry cannot be read, or after a reused token is rejected. Provider failures retry; rejection of a freshly provided token is terminal. No periodic refresh runs while connected. Disconnecting ignores a pending provider result but does not cancel the provider's own work. +For expiring credentials, combine `.WithToken(initialToken)` with `.WithTokenProvider(() => RefreshTokenAsync())`, where your provider returns `Task` for the same identity. The provider is not called for the initial connection. Before retries, it is called when remaining validity is at most 30 seconds or 5% of the token lifetime, whichever is greater, when expiry cannot be read, or after a reused token is rejected. Provider failures retry; rejection of a freshly provided token is terminal. No periodic refresh runs while connected. After recovery, persist the token passed to `OnAutomaticReconnect` if the application stores tokens. Disconnecting ignores a pending provider result but does not cancel the provider's own work. Calls made while disconnected fail immediately. Pending reducer calls receive `Status.UnknownResult`; pending procedures and one-off queries fail with `UnknownResultException`. These calls may already have executed and are never replayed. Regenerate bindings so unhandled unknown reducer outcomes reach `OnUnhandledReducerError`. diff --git a/skills/typescript-client/SKILL.md b/skills/typescript-client/SKILL.md index 4249daf15a1..ae59a1683f9 100644 --- a/skills/typescript-client/SKILL.md +++ b/skills/typescript-client/SKILL.md @@ -34,7 +34,8 @@ function Root() { .withDatabaseName(MODULE_NAME) .withToken(localStorage.getItem(TOKEN_KEY) ?? undefined) .withAutomaticReconnect() - .onConnect((_conn, _identity, token) => localStorage.setItem(TOKEN_KEY, token)), + .onConnect((_conn, _identity, token) => localStorage.setItem(TOKEN_KEY, token)) + .onAutomaticReconnect((_conn, _identity, token) => localStorage.setItem(TOKEN_KEY, token)), [] ); return ( @@ -110,6 +111,10 @@ const conn = DbConnection.builder() localStorage.setItem(TOKEN_KEY, token); console.log('Connected as:', identity.toHexString()); }) + .onAutomaticReconnect((_conn, identity, token) => { + localStorage.setItem(TOKEN_KEY, token); + console.log('Reconnected as:', identity.toHexString()); + }) .onDisconnect((_ctx, error, nextAttempt, delayMs) => { if (nextAttempt !== undefined) { console.warn(`Reconnect attempt ${nextAttempt} in ${delayMs} ms`, error); @@ -140,7 +145,7 @@ conn.db.user.onUpdate((ctx, oldUser, newUser) => console.log('Updated:', newUser The React provider's connection manager enables automatic reconnect; the explicit `.withAutomaticReconnect()` above also shows the setting to use for direct connections. Without it, a direct connection does not recover automatically. For direct connections, initial failures are not retried. After an established connection drops, retries use exponential backoff and jitter from `minDelayMs` (default 1 s) up to `maxDelayMs` (default 30 s), until `disconnect()` or a terminal failure. Tune these with `.withAutomaticReconnect({ minDelayMs, maxDelayMs })`; values below the 500 ms and 1 s floors are raised with a warning, so that retrying clients cannot overwhelm the database. While mounted, the React provider also preserves its separate connection-manager retries: it builds a replacement connection after an initial or terminal failure that the core connection will not retry. It respects an explicit `disconnect()`. -The same connection, identity, table handles, subscriptions, and row callbacks survive recovery. Each attempt gets a fresh connection ID. `onConnect` runs again before subscription replay, so register subscriptions and row callbacks once, outside that callback. The SDK replays subscriptions in one batch, retains readable but stale cached rows during outages, and emits net row changes after reconciliation. Subscription `onApplied` runs again after replay; keep one-time setup separate. +The same connection, identity, table handles, subscriptions, and row callbacks survive recovery. Each attempt gets a fresh connection ID. `onConnect` fires once per `DbConnection`; successful automatic reconnects invoke `onAutomaticReconnect` before subscription replay instead. Register subscriptions and row callbacks once, either in `onConnect` or after `build()`, and use `onAutomaticReconnect` for recovery-specific work such as saving a refreshed token. The SDK replays subscriptions in one batch, retains readable but stale cached rows during outages, and emits net row changes after reconciliation. Subscription `onApplied` runs again after replay; keep one-time setup separate. In React, let `useTable` manage its own subscriptions. Do not add a second subscription effect for the same queries or recreate subscriptions whenever `isActive` changes. Use the hook's `isReady` result for data readiness: a successful reconnect handshake does not mean replay has completed. Invoke reducers from event handlers, not during rendering. For a manually created subscription, retain its handle and call `unsubscribe()` when it is no longer needed, including during an outage. diff --git a/skills/unity/SKILL.md b/skills/unity/SKILL.md index 4e1a2b86534..baa52d2e97c 100644 --- a/skills/unity/SKILL.md +++ b/skills/unity/SKILL.md @@ -122,7 +122,7 @@ public class SpacetimeManager : MonoBehaviour ## Automatic Reconnect -Add `.WithAutomaticReconnect()` to the builder to recover an established connection after an outage. In the singleton above, create subscriptions only on the first `OnConnected`, or move them after `Build()`: `OnConnected` runs again after each successful reconnect. Keep calling `FrameTick()` during outages, or use `SpacetimeDBNetworkManager`, which also ticks reconnecting connections. Do not gate ticking on `IsActive`. +Add `.WithAutomaticReconnect()` to the builder to recover an established connection after an outage. In the singleton above, create subscriptions in `OnConnected` or move them after `Build()`: `OnConnected` runs only on the first successful connection. Successful automatic reconnects invoke `OnAutomaticReconnect` before subscription replay; use it for recovery-specific work such as saving a refreshed token. Keep calling `FrameTick()` during outages, or use `SpacetimeDBNetworkManager`, which also ticks reconnecting connections. Do not gate ticking on `IsActive`. The SDK retains the identity, table handles, callbacks, and subscriptions, and replays subscriptions in one batch. Cached rows stay readable during an outage; row callbacks report net changes after recovery. `OnApplied` runs again, so separate one-time object setup from marking data ready. Each reconnect attempt has a fresh `ConnectionId`. @@ -232,6 +232,6 @@ The SpacetimeDB SDK uses code generation. If you encounter issues with IL2CPP bu ### Token Persistence Token save/load via `PlayerPrefs` is demonstrated in the SpacetimeManager singleton above. Persisting the server-issued token and passing it back on reconnect keeps the same identity; without a saved token the server issues a new identity in the `OnConnect` callback. This token does not expire and a lost one can't be recovered, so self-issued identities are for development. For production, authenticate with an OIDC provider such as SpacetimeAuth, which handles token lifecycle. -With automatic reconnect enabled, the SDK retains the authentication token and passes it to `OnConnect`, including on WebGL. Without automatic reconnect, a WebGL connection using a saved token may return a short-lived WebSocket token instead; in that case, keep the original saved token rather than overwriting it in the callback above. +With automatic reconnect enabled, the SDK retains the authentication token and passes it to `OnConnect` on the initial connection, including on WebGL. Successful recovery passes the retained or refreshed token to `OnAutomaticReconnect`. Without automatic reconnect, a WebGL connection using a saved token may return a short-lived WebSocket token instead; in that case, keep the original saved token rather than overwriting it in the callback above. For expiring credentials, configure `.WithToken(initialToken)`, `.WithAutomaticReconnect()`, and `.WithTokenProvider(() => RefreshTokenAsync())`. The provider returns `Task` for the same identity. It is used before reconnect attempts when expiry is unreadable, remaining validity is at most 30 seconds or 5% of the original lifetime, or a reused token is rejected. It is not called for the initial connection or periodically while connected. Provider failures retry; rejection of a freshly provided token stops recovery. `Disconnect()` ignores a pending provider result without canceling the provider's own asynchronous work. From 04e088cebe51405d35efff0bd392d76e65c8512e Mon Sep 17 00:00:00 2001 From: clockwork-labs-bot Date: Tue, 13 Oct 2026 22:49:48 -0400 Subject: [PATCH 7/9] docs: sync reconnect fixes to Codex plugin skills --- .../plugins/spacetimedb/skills/csharp-client/SKILL.md | 4 ++-- .../spacetimedb/skills/typescript-client/SKILL.md | 9 +++++++-- codex-plugin/plugins/spacetimedb/skills/unity/SKILL.md | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/codex-plugin/plugins/spacetimedb/skills/csharp-client/SKILL.md b/codex-plugin/plugins/spacetimedb/skills/csharp-client/SKILL.md index 47ad75496f9..8af6787560d 100644 --- a/codex-plugin/plugins/spacetimedb/skills/csharp-client/SKILL.md +++ b/codex-plugin/plugins/spacetimedb/skills/csharp-client/SKILL.md @@ -54,9 +54,9 @@ Automatic reconnect is opt-in: add `.WithAutomaticReconnect()` to the builder. I Keep calling `FrameTick()` while `IsActive` is false. `IsReconnecting` is true while recovering before the next handshake. Use `.OnDisconnect((conn, error, next) => ...)` and `.OnConnectError((error, next) => ...)` to inspect `NextReconnect?`: a non-null value provides `Attempt` and `Delay`; null means no retry is scheduled. Existing callback overloads still work. -`OnConnect` runs on every successful reconnect, so create the subscription in the example above only on the first connection, or move it after `Build()`. Register row callbacks once as well. The same connection, identity, table handles, and subscriptions survive; each attempt gets a fresh `ConnectionId`. Cached rows stay readable but stale during outages. The SDK replays subscriptions in one batch and emits only net row changes. Subscription `OnApplied` runs again after replay; use it to mark data ready, not for repeated one-time setup. +`OnConnect` runs once per `DbConnection`, on the first successful connection. Successful automatic reconnects invoke `OnAutomaticReconnect` before subscription replay instead. Register subscriptions and row callbacks once, either in `OnConnect` or after `Build()`, and use `OnAutomaticReconnect` for recovery-specific work such as saving a refreshed token. The same connection, identity, table handles, and subscriptions survive; each attempt gets a fresh `ConnectionId`. Cached rows stay readable but stale during outages. The SDK replays subscriptions in one batch and emits only net row changes. Subscription `OnApplied` runs again after replay; use it to mark data ready, not for repeated one-time setup. -For expiring credentials, combine `.WithToken(initialToken)` with `.WithTokenProvider(() => RefreshTokenAsync())`, where your provider returns `Task` for the same identity. The provider is not called for the initial connection. Before retries, it is called when remaining validity is at most 30 seconds or 5% of the token lifetime, whichever is greater, when expiry cannot be read, or after a reused token is rejected. Provider failures retry; rejection of a freshly provided token is terminal. No periodic refresh runs while connected. Disconnecting ignores a pending provider result but does not cancel the provider's own work. +For expiring credentials, combine `.WithToken(initialToken)` with `.WithTokenProvider(() => RefreshTokenAsync())`, where your provider returns `Task` for the same identity. The provider is not called for the initial connection. Before retries, it is called when remaining validity is at most 30 seconds or 5% of the token lifetime, whichever is greater, when expiry cannot be read, or after a reused token is rejected. Provider failures retry; rejection of a freshly provided token is terminal. No periodic refresh runs while connected. After recovery, persist the token passed to `OnAutomaticReconnect` if the application stores tokens. Disconnecting ignores a pending provider result but does not cancel the provider's own work. Calls made while disconnected fail immediately. Pending reducer calls receive `Status.UnknownResult`; pending procedures and one-off queries fail with `UnknownResultException`. These calls may already have executed and are never replayed. Regenerate bindings so unhandled unknown reducer outcomes reach `OnUnhandledReducerError`. diff --git a/codex-plugin/plugins/spacetimedb/skills/typescript-client/SKILL.md b/codex-plugin/plugins/spacetimedb/skills/typescript-client/SKILL.md index 4249daf15a1..ae59a1683f9 100644 --- a/codex-plugin/plugins/spacetimedb/skills/typescript-client/SKILL.md +++ b/codex-plugin/plugins/spacetimedb/skills/typescript-client/SKILL.md @@ -34,7 +34,8 @@ function Root() { .withDatabaseName(MODULE_NAME) .withToken(localStorage.getItem(TOKEN_KEY) ?? undefined) .withAutomaticReconnect() - .onConnect((_conn, _identity, token) => localStorage.setItem(TOKEN_KEY, token)), + .onConnect((_conn, _identity, token) => localStorage.setItem(TOKEN_KEY, token)) + .onAutomaticReconnect((_conn, _identity, token) => localStorage.setItem(TOKEN_KEY, token)), [] ); return ( @@ -110,6 +111,10 @@ const conn = DbConnection.builder() localStorage.setItem(TOKEN_KEY, token); console.log('Connected as:', identity.toHexString()); }) + .onAutomaticReconnect((_conn, identity, token) => { + localStorage.setItem(TOKEN_KEY, token); + console.log('Reconnected as:', identity.toHexString()); + }) .onDisconnect((_ctx, error, nextAttempt, delayMs) => { if (nextAttempt !== undefined) { console.warn(`Reconnect attempt ${nextAttempt} in ${delayMs} ms`, error); @@ -140,7 +145,7 @@ conn.db.user.onUpdate((ctx, oldUser, newUser) => console.log('Updated:', newUser The React provider's connection manager enables automatic reconnect; the explicit `.withAutomaticReconnect()` above also shows the setting to use for direct connections. Without it, a direct connection does not recover automatically. For direct connections, initial failures are not retried. After an established connection drops, retries use exponential backoff and jitter from `minDelayMs` (default 1 s) up to `maxDelayMs` (default 30 s), until `disconnect()` or a terminal failure. Tune these with `.withAutomaticReconnect({ minDelayMs, maxDelayMs })`; values below the 500 ms and 1 s floors are raised with a warning, so that retrying clients cannot overwhelm the database. While mounted, the React provider also preserves its separate connection-manager retries: it builds a replacement connection after an initial or terminal failure that the core connection will not retry. It respects an explicit `disconnect()`. -The same connection, identity, table handles, subscriptions, and row callbacks survive recovery. Each attempt gets a fresh connection ID. `onConnect` runs again before subscription replay, so register subscriptions and row callbacks once, outside that callback. The SDK replays subscriptions in one batch, retains readable but stale cached rows during outages, and emits net row changes after reconciliation. Subscription `onApplied` runs again after replay; keep one-time setup separate. +The same connection, identity, table handles, subscriptions, and row callbacks survive recovery. Each attempt gets a fresh connection ID. `onConnect` fires once per `DbConnection`; successful automatic reconnects invoke `onAutomaticReconnect` before subscription replay instead. Register subscriptions and row callbacks once, either in `onConnect` or after `build()`, and use `onAutomaticReconnect` for recovery-specific work such as saving a refreshed token. The SDK replays subscriptions in one batch, retains readable but stale cached rows during outages, and emits net row changes after reconciliation. Subscription `onApplied` runs again after replay; keep one-time setup separate. In React, let `useTable` manage its own subscriptions. Do not add a second subscription effect for the same queries or recreate subscriptions whenever `isActive` changes. Use the hook's `isReady` result for data readiness: a successful reconnect handshake does not mean replay has completed. Invoke reducers from event handlers, not during rendering. For a manually created subscription, retain its handle and call `unsubscribe()` when it is no longer needed, including during an outage. diff --git a/codex-plugin/plugins/spacetimedb/skills/unity/SKILL.md b/codex-plugin/plugins/spacetimedb/skills/unity/SKILL.md index 4e1a2b86534..baa52d2e97c 100644 --- a/codex-plugin/plugins/spacetimedb/skills/unity/SKILL.md +++ b/codex-plugin/plugins/spacetimedb/skills/unity/SKILL.md @@ -122,7 +122,7 @@ public class SpacetimeManager : MonoBehaviour ## Automatic Reconnect -Add `.WithAutomaticReconnect()` to the builder to recover an established connection after an outage. In the singleton above, create subscriptions only on the first `OnConnected`, or move them after `Build()`: `OnConnected` runs again after each successful reconnect. Keep calling `FrameTick()` during outages, or use `SpacetimeDBNetworkManager`, which also ticks reconnecting connections. Do not gate ticking on `IsActive`. +Add `.WithAutomaticReconnect()` to the builder to recover an established connection after an outage. In the singleton above, create subscriptions in `OnConnected` or move them after `Build()`: `OnConnected` runs only on the first successful connection. Successful automatic reconnects invoke `OnAutomaticReconnect` before subscription replay; use it for recovery-specific work such as saving a refreshed token. Keep calling `FrameTick()` during outages, or use `SpacetimeDBNetworkManager`, which also ticks reconnecting connections. Do not gate ticking on `IsActive`. The SDK retains the identity, table handles, callbacks, and subscriptions, and replays subscriptions in one batch. Cached rows stay readable during an outage; row callbacks report net changes after recovery. `OnApplied` runs again, so separate one-time object setup from marking data ready. Each reconnect attempt has a fresh `ConnectionId`. @@ -232,6 +232,6 @@ The SpacetimeDB SDK uses code generation. If you encounter issues with IL2CPP bu ### Token Persistence Token save/load via `PlayerPrefs` is demonstrated in the SpacetimeManager singleton above. Persisting the server-issued token and passing it back on reconnect keeps the same identity; without a saved token the server issues a new identity in the `OnConnect` callback. This token does not expire and a lost one can't be recovered, so self-issued identities are for development. For production, authenticate with an OIDC provider such as SpacetimeAuth, which handles token lifecycle. -With automatic reconnect enabled, the SDK retains the authentication token and passes it to `OnConnect`, including on WebGL. Without automatic reconnect, a WebGL connection using a saved token may return a short-lived WebSocket token instead; in that case, keep the original saved token rather than overwriting it in the callback above. +With automatic reconnect enabled, the SDK retains the authentication token and passes it to `OnConnect` on the initial connection, including on WebGL. Successful recovery passes the retained or refreshed token to `OnAutomaticReconnect`. Without automatic reconnect, a WebGL connection using a saved token may return a short-lived WebSocket token instead; in that case, keep the original saved token rather than overwriting it in the callback above. For expiring credentials, configure `.WithToken(initialToken)`, `.WithAutomaticReconnect()`, and `.WithTokenProvider(() => RefreshTokenAsync())`. The provider returns `Task` for the same identity. It is used before reconnect attempts when expiry is unreadable, remaining validity is at most 30 seconds or 5% of the original lifetime, or a reused token is rejected. It is not called for the initial connection or periodically while connected. Provider failures retry; rejection of a freshly provided token stops recovery. `Disconnect()` ignores a pending provider result without canceling the provider's own asynchronous work. From 941190489ea0c71898e51b9231b41d0eb9884f7e Mon Sep 17 00:00:00 2001 From: clockwork-labs-bot Date: Mon, 16 Nov 2026 21:02:51 -0500 Subject: [PATCH 8/9] docs: cover API and tooling changes from audit catch-up --- codex-plugin/plugins/spacetimedb/skills/cli/SKILL.md | 4 ++++ .../plugins/spacetimedb/skills/concepts/SKILL.md | 2 +- .../plugins/spacetimedb/skills/rust-server/SKILL.md | 2 ++ .../spacetimedb/skills/typescript-client/SKILL.md | 2 ++ .../00300-reducers/00400-reducer-context.md | 4 ++++ .../00600-clients/00700-typescript-reference.md | 10 +++++++++- docs/docs/00250-how-to/00900-unit-testing.md | 6 ++++-- .../00100-cli-reference/00300-spacetime-json.md | 1 + .../00300-resources/00200-http-api/00300-database.md | 2 ++ skills/cli/SKILL.md | 4 ++++ skills/concepts/SKILL.md | 2 +- skills/rust-server/SKILL.md | 2 ++ skills/typescript-client/SKILL.md | 2 ++ 13 files changed, 38 insertions(+), 5 deletions(-) diff --git a/codex-plugin/plugins/spacetimedb/skills/cli/SKILL.md b/codex-plugin/plugins/spacetimedb/skills/cli/SKILL.md index 8e604f25be5..430ffe98582 100644 --- a/codex-plugin/plugins/spacetimedb/skills/cli/SKILL.md +++ b/codex-plugin/plugins/spacetimedb/skills/cli/SKILL.md @@ -52,6 +52,10 @@ spacetime generate --lang typescript|csharp|rust --out-dir ./bindings --module-p spacetime generate --lang unrealcpp --uproject-dir ./MyGame --module-path ./server --unreal-module-name MyGame ``` +### TypeScript Import Extensions + +For TypeScript client bindings, `spacetime generate --lang typescript --import-extension none|js|ts` selects the relative import suffix: `none` is the bundler-friendly default, `js` suits `moduleResolution: "nodenext"`, and `ts` suits runtimes executing TypeScript source directly. Set `"import-extension"` per `generate` entry in `spacetime.json` to persist it. This setting changes imports inside generated files, not application imports; NodeNext applications should import an explicit file such as `./module_bindings/index.js`. See https://spacetimedb.com/docs/clients/typescript#import-extensions for direct-TypeScript typecheck settings. + ### Client and Module Bindings `spacetime generate --bindings client` (default) generates bindings for clients connecting to a database. `--bindings module` generates receiver bindings used inside a **sending database module** to call reducers in another **receiving database** through asynchronous IDC. Rust and TypeScript module bindings are supported; C#/C++ module bindings are not implemented yet. `unrealcpp` is client-only; `cpp` is accepted only in module mode. diff --git a/codex-plugin/plugins/spacetimedb/skills/concepts/SKILL.md b/codex-plugin/plugins/spacetimedb/skills/concepts/SKILL.md index e663f1491fd..db3852e4264 100644 --- a/codex-plugin/plugins/spacetimedb/skills/concepts/SKILL.md +++ b/codex-plugin/plugins/spacetimedb/skills/concepts/SKILL.md @@ -25,7 +25,7 @@ This describes Spacetime 2.x. The API changed substantially from 1.x, so older a - **App types.** It is used for games, such as BitCraft Online, and for web apps such as chat, collaboration tools, dashboards, and SaaS. The TypeScript SDK has quickstarts for React, Next.js, Vue, Svelte, and more. ([React quickstart](https://spacetimedb.com/docs/quickstarts/react/)) - **Storage.** Tiered storage keeps hot data in memory and colder data on disk. On Maincloud, tables can also be backed by object storage, so a single database can store an effectively unbounded amount of data. ([How does Spacetime scale?](https://spacetimedb.com/blog/how-does-spacetime-scale)) - **Scaling.** Each database runs its transactions one at a time on a single thread. One app can span many databases with asynchronous inter-database communication, and Maincloud replicates each database. ([How does Spacetime scale?](https://spacetimedb.com/blog/how-does-spacetime-scale)) -- **Durability.** Transactions are ACID with serializable isolation. By default, clients see a transaction's results, including the acknowledgment of their own writes, only after it is durable. ([Confirmed reads](https://spacetimedb.com/docs/clients/typescript/#method-withconfirmedreads)) +- **Durability.** Transactions are ACID with serializable isolation. By default, clients see a transaction's results, including the acknowledgment of their own writes, only after it is durable. ([Confirmed reads](https://spacetimedb.com/docs/clients/typescript/#method-withconfirmedreads)) An HTTP durability-confirmation timeout after five seconds returns `504` with an unknown outcome, not proof of rollback; do not retry non-idempotent calls without deduplication. ([HTTP calls](https://spacetimedb.com/docs/http/database#post-v1databasename_or_identitycallreducer)) - **Module languages.** TypeScript, Rust, C#, and C++. TypeScript modules run on V8 and can use npm packages, which are bundled when you publish; Rust, C#, and C++ modules compile to WebAssembly. ([Language support](https://spacetimedb.com/docs/intro/language-support/)) - **Composing modules.** TypeScript and C# modules can mount other modules as submodules, each under its own namespace, to reuse logic such as authentication, rate limiting, or email. Official and community modules are listed at spacetimedb.com/modules. ([Modules](https://spacetimedb.com/docs/modules/)) - **External APIs.** Reducers are deterministic and make no network calls. Procedures make outbound HTTP requests, with a 30-second default timeout and a 180-second maximum. ([Procedures](https://spacetimedb.com/docs/functions/procedures/)) diff --git a/codex-plugin/plugins/spacetimedb/skills/rust-server/SKILL.md b/codex-plugin/plugins/spacetimedb/skills/rust-server/SKILL.md index 42e2f311876..c2e69876968 100644 --- a/codex-plugin/plugins/spacetimedb/skills/rust-server/SKILL.md +++ b/codex-plugin/plugins/spacetimedb/skills/rust-server/SKILL.md @@ -507,4 +507,6 @@ mod tests { `with_reducer_tx` commits on `Ok` and rolls back on `Err` or panic unwinding; propagate reducer errors with `?` when the reducer returns `Result`. Create a new `TestContext` for each test: cloning shares the database. Use `TestAuth::from_jwt_payload(payload, connection_id)?` for client calls and `TestAuth::internal()` for the database itself. The harness exposes `clock`, `rng`, procedure/view contexts, and query execution. It does not simulate subscriptions, RLS, lifecycle calls, or timers. Invoke lifecycle/scheduled reducers explicitly and retain integration tests for host behavior. +In SDK 2.13+, native tests support `ProcedureContext::with_tx` and environment reads. Use `TestContext::set_env` / `unset_env` for module-declared environment keys; undeclared keys and disallowed values are rejected. Clones share the same test environment. The `with_tx` panic workaround applies only to SDK 2.12. + See https://spacetimedb.com/docs/how-to/unit-testing for test setup, HTTP mocking, and current limitations. diff --git a/codex-plugin/plugins/spacetimedb/skills/typescript-client/SKILL.md b/codex-plugin/plugins/spacetimedb/skills/typescript-client/SKILL.md index 9f6737cf85f..a232086ad3a 100644 --- a/codex-plugin/plugins/spacetimedb/skills/typescript-client/SKILL.md +++ b/codex-plugin/plugins/spacetimedb/skills/typescript-client/SKILL.md @@ -15,6 +15,8 @@ metadata: Generated bindings convert snake_case names to camelCase, including row fields: a server column `trip_id` is `tripId` on client rows. +The examples below use bundler-style extensionless imports. For NodeNext or direct-TypeScript execution, choose the matching binding import extension and use explicit file imports in your application; see https://spacetimedb.com/docs/clients/typescript#import-extensions. + ## React: main.tsx ```typescript diff --git a/docs/docs/00200-core-concepts/00200-functions/00300-reducers/00400-reducer-context.md b/docs/docs/00200-core-concepts/00200-functions/00300-reducers/00400-reducer-context.md index 9bcb7f3b17c..2fbb3331601 100644 --- a/docs/docs/00200-core-concepts/00200-functions/00300-reducers/00400-reducer-context.md +++ b/docs/docs/00200-core-concepts/00200-functions/00300-reducers/00400-reducer-context.md @@ -281,8 +281,12 @@ Use the context-provided random API for any reducer logic that needs random valu const fraction = ctx.random(); // [0.0, 1.0) const roll = ctx.random.integerInRange(1, 6); // inclusive const bytes = ctx.random.fill(new Uint8Array(16)); +const cards = ['ace', 'king', 'queen']; +const shuffledCards = ctx.random.shuffle([...cards]); ``` +In SpacetimeDB 2.13+, `ctx.random.shuffle(array)` shuffles the array in place and returns the same array. Copy it first, as above, to preserve the original order. + diff --git a/docs/docs/00200-core-concepts/00600-clients/00700-typescript-reference.md b/docs/docs/00200-core-concepts/00600-clients/00700-typescript-reference.md index 78bdb59bc51..ecc993e4eed 100644 --- a/docs/docs/00200-core-concepts/00600-clients/00700-typescript-reference.md +++ b/docs/docs/00200-core-concepts/00600-clients/00700-typescript-reference.md @@ -85,7 +85,15 @@ spacetime generate --lang typescript \ --module-path PATH-TO-MODULE-DIRECTORY ``` -Import the `module_bindings` in your client's _main_ file: +### Import extensions + +The default generated imports are extensionless, which suits bundler-based clients. For TypeScript projects using `moduleResolution: "nodenext"`, add `--import-extension js` to the generate command. Generated files then import each other with `.js` extensions, which TypeScript resolves to their `.ts` sources and preserves when emitting JavaScript. Use explicit file paths in your own imports too, for example `./module_bindings/index.js` rather than a directory import. + +For runtimes that execute TypeScript source directly, use `--import-extension ts` and import `./module_bindings/index.ts` in your application. If typechecking those imports with TypeScript, enable `allowImportingTsExtensions` with `noEmit` (or another compatible emit configuration). The flag controls imports within the generated bindings, not your application's imports or how it is executed. + +Set `"import-extension": "js"` or `"ts"` on a `generate` entry in [`spacetime.json`](../../00300-resources/00100-cli-reference/00300-spacetime-json.md#generate-configuration) to retain the choice across generation runs. + +For the default bundler configuration, import the `module_bindings` in your client's _main_ file: ```typescript import * as moduleBindings from './module_bindings/index'; diff --git a/docs/docs/00250-how-to/00900-unit-testing.md b/docs/docs/00250-how-to/00900-unit-testing.md index 29d46d7366d..23b303f25b2 100644 --- a/docs/docs/00250-how-to/00900-unit-testing.md +++ b/docs/docs/00250-how-to/00900-unit-testing.md @@ -214,6 +214,8 @@ This won't be needed once [#6317](https://github.com/clockworklabs/SpacetimeDB/i Run these tests natively with `cargo test`, not with a WebAssembly target. The feature enables module registration and the in-memory test datastore without requiring a running host. +SDK 2.13 and later also support environment values in native Rust tests. Use `TestContext::set_env` and `unset_env` for keys declared by the module's `#[spacetimedb::env]` struct. Set values before invoking code that reads `ctx.env`; the harness rejects undeclared keys and values outside a declared constraint. Clones of a `TestContext` share its environment. + ### Define the module For a standalone example, put this in `src/lib.rs`. In an existing module, use your own tables and reducers instead. @@ -1214,8 +1216,8 @@ fn shows_each_client_only_their_own_notes() { ### Known issues -- **`ProcedureContext::with_tx` panics** ([#6296](https://github.com/clockworklabs/SpacetimeDB/pull/6296)). In a test, `with_tx` makes host calls instead of using the test datastore, and panics with `holding &mut HandlerContext, so should not be in a tx already`. Use `try_with_tx` in procedures you want to test until the fix is released. -- **Projects from the `chat-console-rs` template have an invalid dev-dependency** ([#6298](https://github.com/clockworklabs/SpacetimeDB/issues/6298)). `spacetime init` writes the template's `spacetimedb` dev-dependency with a `path` into the SpacetimeDB repository. Replace it with a version that matches the normal dependency, as shown in [Enable the test utilities](#enable-the-test-utilities). +- **SDK 2.12: `ProcedureContext::with_tx` panics in tests.** Upgrade to SDK 2.13 or later for the [fix](https://github.com/clockworklabs/SpacetimeDB/pull/6302). On 2.12, use `try_with_tx` in procedures you want to test; `with_tx` makes host calls instead of using the test datastore. +- **CLI 2.12: `chat-console-rs` projects have an invalid dev-dependency.** CLI 2.13 and later [rewrite template dev-dependencies correctly](https://github.com/clockworklabs/SpacetimeDB/pull/6307). For projects already generated with the old CLI, replace the repository `path` with a version that matches the normal dependency, as shown in [Enable the test utilities](#enable-the-test-utilities). diff --git a/docs/docs/00300-resources/00100-cli-reference/00300-spacetime-json.md b/docs/docs/00300-resources/00100-cli-reference/00300-spacetime-json.md index 3e466c3c5f3..048b7706489 100644 --- a/docs/docs/00300-resources/00100-cli-reference/00300-spacetime-json.md +++ b/docs/docs/00300-resources/00100-cli-reference/00300-spacetime-json.md @@ -57,6 +57,7 @@ The `generate` key is an array of objects. Each object configures bindings gener | `language` | string | Target language: `typescript`, `csharp`, `rust`, `unrealcpp`; `cpp` is reserved for module bindings | | `bindings` | string | `client` (default) for application clients, or `module` for inter-database calls | | `out-dir` | string | Output directory for generated files | +| `import-extension` | string | TypeScript relative import extension: `none` (default) for bundlers, `js` for NodeNext, or `ts` for direct TypeScript execution; see [TypeScript import extensions](../../00200-core-concepts/00600-clients/00700-typescript-reference.md#import-extensions) | | `namespace` | string | C# namespace (`csharp` only) | | `unreal-module-name` | string | Unreal module name (`unrealcpp` only) | | `uproject-dir` | string | Unreal project directory (`unrealcpp` only) | diff --git a/docs/docs/00300-resources/00200-http-api/00300-database.md b/docs/docs/00300-resources/00200-http-api/00300-database.md index d6234a2816c..3054fab79dc 100644 --- a/docs/docs/00300-resources/00200-http-api/00300-database.md +++ b/docs/docs/00300-resources/00200-http-api/00300-database.md @@ -397,6 +397,8 @@ Invoke a reducer or procedure in a database. | ---- | ----- | | `confirmed` | Optional boolean, default `true`. Wait for durability before returning success. For procedure calls, also wait after each successful `withTx`, before procedure code continues. Set to `false` to allow results from state that has committed in memory but may be lost after a crash. +The HTTP durability-confirmation wait has a five-second timeout. If it expires, the response is `504 Gateway Timeout` with an unknown outcome: the operation may already have committed. Do not retry a non-idempotent call without deduplication. This deadline bounds confirmation, not the total execution time of the reducer or procedure. + #### Path parameters | Name | Value | diff --git a/skills/cli/SKILL.md b/skills/cli/SKILL.md index 8e604f25be5..430ffe98582 100644 --- a/skills/cli/SKILL.md +++ b/skills/cli/SKILL.md @@ -52,6 +52,10 @@ spacetime generate --lang typescript|csharp|rust --out-dir ./bindings --module-p spacetime generate --lang unrealcpp --uproject-dir ./MyGame --module-path ./server --unreal-module-name MyGame ``` +### TypeScript Import Extensions + +For TypeScript client bindings, `spacetime generate --lang typescript --import-extension none|js|ts` selects the relative import suffix: `none` is the bundler-friendly default, `js` suits `moduleResolution: "nodenext"`, and `ts` suits runtimes executing TypeScript source directly. Set `"import-extension"` per `generate` entry in `spacetime.json` to persist it. This setting changes imports inside generated files, not application imports; NodeNext applications should import an explicit file such as `./module_bindings/index.js`. See https://spacetimedb.com/docs/clients/typescript#import-extensions for direct-TypeScript typecheck settings. + ### Client and Module Bindings `spacetime generate --bindings client` (default) generates bindings for clients connecting to a database. `--bindings module` generates receiver bindings used inside a **sending database module** to call reducers in another **receiving database** through asynchronous IDC. Rust and TypeScript module bindings are supported; C#/C++ module bindings are not implemented yet. `unrealcpp` is client-only; `cpp` is accepted only in module mode. diff --git a/skills/concepts/SKILL.md b/skills/concepts/SKILL.md index e663f1491fd..db3852e4264 100644 --- a/skills/concepts/SKILL.md +++ b/skills/concepts/SKILL.md @@ -25,7 +25,7 @@ This describes Spacetime 2.x. The API changed substantially from 1.x, so older a - **App types.** It is used for games, such as BitCraft Online, and for web apps such as chat, collaboration tools, dashboards, and SaaS. The TypeScript SDK has quickstarts for React, Next.js, Vue, Svelte, and more. ([React quickstart](https://spacetimedb.com/docs/quickstarts/react/)) - **Storage.** Tiered storage keeps hot data in memory and colder data on disk. On Maincloud, tables can also be backed by object storage, so a single database can store an effectively unbounded amount of data. ([How does Spacetime scale?](https://spacetimedb.com/blog/how-does-spacetime-scale)) - **Scaling.** Each database runs its transactions one at a time on a single thread. One app can span many databases with asynchronous inter-database communication, and Maincloud replicates each database. ([How does Spacetime scale?](https://spacetimedb.com/blog/how-does-spacetime-scale)) -- **Durability.** Transactions are ACID with serializable isolation. By default, clients see a transaction's results, including the acknowledgment of their own writes, only after it is durable. ([Confirmed reads](https://spacetimedb.com/docs/clients/typescript/#method-withconfirmedreads)) +- **Durability.** Transactions are ACID with serializable isolation. By default, clients see a transaction's results, including the acknowledgment of their own writes, only after it is durable. ([Confirmed reads](https://spacetimedb.com/docs/clients/typescript/#method-withconfirmedreads)) An HTTP durability-confirmation timeout after five seconds returns `504` with an unknown outcome, not proof of rollback; do not retry non-idempotent calls without deduplication. ([HTTP calls](https://spacetimedb.com/docs/http/database#post-v1databasename_or_identitycallreducer)) - **Module languages.** TypeScript, Rust, C#, and C++. TypeScript modules run on V8 and can use npm packages, which are bundled when you publish; Rust, C#, and C++ modules compile to WebAssembly. ([Language support](https://spacetimedb.com/docs/intro/language-support/)) - **Composing modules.** TypeScript and C# modules can mount other modules as submodules, each under its own namespace, to reuse logic such as authentication, rate limiting, or email. Official and community modules are listed at spacetimedb.com/modules. ([Modules](https://spacetimedb.com/docs/modules/)) - **External APIs.** Reducers are deterministic and make no network calls. Procedures make outbound HTTP requests, with a 30-second default timeout and a 180-second maximum. ([Procedures](https://spacetimedb.com/docs/functions/procedures/)) diff --git a/skills/rust-server/SKILL.md b/skills/rust-server/SKILL.md index 42e2f311876..c2e69876968 100644 --- a/skills/rust-server/SKILL.md +++ b/skills/rust-server/SKILL.md @@ -507,4 +507,6 @@ mod tests { `with_reducer_tx` commits on `Ok` and rolls back on `Err` or panic unwinding; propagate reducer errors with `?` when the reducer returns `Result`. Create a new `TestContext` for each test: cloning shares the database. Use `TestAuth::from_jwt_payload(payload, connection_id)?` for client calls and `TestAuth::internal()` for the database itself. The harness exposes `clock`, `rng`, procedure/view contexts, and query execution. It does not simulate subscriptions, RLS, lifecycle calls, or timers. Invoke lifecycle/scheduled reducers explicitly and retain integration tests for host behavior. +In SDK 2.13+, native tests support `ProcedureContext::with_tx` and environment reads. Use `TestContext::set_env` / `unset_env` for module-declared environment keys; undeclared keys and disallowed values are rejected. Clones share the same test environment. The `with_tx` panic workaround applies only to SDK 2.12. + See https://spacetimedb.com/docs/how-to/unit-testing for test setup, HTTP mocking, and current limitations. diff --git a/skills/typescript-client/SKILL.md b/skills/typescript-client/SKILL.md index 9f6737cf85f..a232086ad3a 100644 --- a/skills/typescript-client/SKILL.md +++ b/skills/typescript-client/SKILL.md @@ -15,6 +15,8 @@ metadata: Generated bindings convert snake_case names to camelCase, including row fields: a server column `trip_id` is `tripId` on client rows. +The examples below use bundler-style extensionless imports. For NodeNext or direct-TypeScript execution, choose the matching binding import extension and use explicit file imports in your application; see https://spacetimedb.com/docs/clients/typescript#import-extensions. + ## React: main.tsx ```typescript From ebec96717ac4e03beebbb921890054e30f42890d Mon Sep 17 00:00:00 2001 From: clockwork-labs-bot Date: Tue, 17 Nov 2026 09:11:56 -0500 Subject: [PATCH 9/9] docs: clarify receiver dependency local-source lookup --- .../00100-databases/00650-inter-database-communication.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/00200-core-concepts/00100-databases/00650-inter-database-communication.md b/docs/docs/00200-core-concepts/00100-databases/00650-inter-database-communication.md index 3f1be1aef08..7c0b8c84a27 100644 --- a/docs/docs/00200-core-concepts/00100-databases/00650-inter-database-communication.md +++ b/docs/docs/00200-core-concepts/00100-databases/00650-inter-database-communication.md @@ -128,7 +128,7 @@ The sending module needs **receiver bindings**: code generated from the receivin `parent` makes `game-world` a child database of `lobby` when it's first published, so that it inherits the lobby's team permissions. Async IDC doesn't require this; any database can call another on the same server. -`name` is the name of the directory created for the generated code, and `database` refers to either a deployed receiving database or the receiving database's source code. Next generate the bindings: +`name` is the name of the directory created for the generated code. `database` must match another target in the same `spacetime.json`; here, it selects the `game-world` child's local `./game_world` module source. It does not fetch a deployed database's schema, so the receiving module's source must be available locally. Next generate the bindings: ```bash spacetime generate lobby