@zaisma/cli 0.66.0 → 0.68.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/check.mjs
CHANGED
|
@@ -47,7 +47,7 @@ export const CHECK_PROBLEM_CODES = {
|
|
|
47
47
|
file_download: { problemKind: "broken", isFixedByUploadCommand: false, meaning: "A file download, which the game's frame doesn't allow." },
|
|
48
48
|
outside_link: { problemKind: "broken", isFixedByUploadCommand: false, meaning: "A link that opens another site or a new window, which the game's frame doesn't allow." },
|
|
49
49
|
outside_frame: { problemKind: "broken", isFixedByUploadCommand: false, meaning: "A frame of another site, which games can't show." },
|
|
50
|
-
blocked_feature: { problemKind: "broken", isFixedByUploadCommand: false, meaning: "Camera,
|
|
50
|
+
blocked_feature: { problemKind: "broken", isFixedByUploadCommand: false, meaning: "Camera, screen capture, location, payments, USB, serial, Bluetooth or HID, which games on Zaisma can't use." },
|
|
51
51
|
// Zaisma's fixed checks (fixed-checks.mjs): the scan refuses a version with any of these, the same answer every time.
|
|
52
52
|
crypto_miner: { problemKind: "refused", isFixedByUploadCommand: false, meaning: "The code mines cryptocurrency." },
|
|
53
53
|
disguised_code: { problemKind: "refused", isFixedByUploadCommand: false, meaning: "The code runs text it decodes (base64, character codes or bytes) as code, which hides what it runs." },
|
|
@@ -293,7 +293,8 @@ function findAddresses(text) {
|
|
|
293
293
|
}
|
|
294
294
|
|
|
295
295
|
const FEATURES = [
|
|
296
|
-
|
|
296
|
+
// The microphone is the game's to ask for (voice chat, a game played by voice: Julius, Nov 26, 2026); the camera isn't.
|
|
297
|
+
{ pattern: /\bgetUserMedia\s*\(\s*\{[^}]*\bvideo\s*:\s*(?!false\b)/, name: "the camera (getUserMedia with video)" },
|
|
297
298
|
{ pattern: /\bgetDisplayMedia\b/, name: "screen capture (getDisplayMedia)" },
|
|
298
299
|
{ pattern: /\bnavigator\.geolocation\b/, name: "location (navigator.geolocation)" },
|
|
299
300
|
{ pattern: /\bnew\s+PaymentRequest\b/, name: "payments (PaymentRequest)" },
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@ claude mcp add --transport http zaisma https://zaisma.com/mcp --header "Authoriz
|
|
|
16
16
|
|
|
17
17
|
Apps that can't send a key connect by signing in instead. In claude.ai: Settings → Connectors → Add custom connector, with `https://zaisma.com/mcp`; ChatGPT and other apps the same way, wherever they add a remote MCP server. The app opens a Zaisma page where you choose what it may do and tap your passkey, then you're back in the app with every tool working. The key command above stays the way for Claude Code and the upload command.
|
|
18
18
|
|
|
19
|
-
Every tool is a call to this API (`apps/site/src/mcp.ts`): `list_games`, `create_game`, `get_game`, `get_playing_now`, `get_whats_on`, `update_game`, `check_game` (what Zaisma would refuse in a game and what won't work on Zaisma, before uploading; see Checking a game below), `upload_files` (small games up to 5 MB, sent as file contents), `get_version`, `update_version` (a version's notes before it's live), `publish_version` (also rolls back and publishes later), `cancel_scheduled_publish`, `end_preview_links`, `add_image`, `remove_image`, `add_shader`, `check_shader` (a shader drawn as the check would, before it's sent; see Backgrounds below), `remove_shader`, `set_background`, `preview_game_page` (pictures of every place players meet the game, from what you're still designing; see Seeing it as players do below), `add_tester_link`, `update_tester_link`, `remove_tester_link`, `get_reports`, `get_stats`, `get_history`, `get_qr_code` (the game's link, or a room's, as a QR code), `export_game` (everything about a game as one .zip; see Export everything below), `get_logs` (what the game server printed, see A game server's logs below), `get_player`, `get_access` (what the key can do), `get_activity` (your account's activity, needs a full key), the inbox's `list_inbox`, `update_inbox_notice`, `delete_inbox_notice` and `set_inbox_settings`, a game's `announce_event` and `reply_to_bug_report` (see The inbox below), `list_api_keys` (your keys and connected apps with their end dates, last use and whether Zaisma turned one off; needs a full key), the sign-in apps' `list_sign_in_apps`, `create_sign_in_app`, `update_sign_in_app` and `delete_sign_in_app`, hosting credit's `get_credit`, `top_up_credit`, `refund_top_up`, `start_credit_plan`, `change_credit_plan`, `stop_credit_plan` and `get_spending_request` (see Hosting and credit below), Zaisma Pro's `get_pro`, `start_pro`, `cancel_pro`, `resume_pro` and `refund_pro` (see Zaisma Pro below), `get_storage`, `set_storage_budget`, `delete_version` and `delete_game`, `bring_back_game`, `erase_game_now`, `get_game_deletion_request` (see Storage below), the Stripe account's `get_stripe_account`, `connect_stripe_account`, `update_stripe_account` and `disconnect_stripe_account` (see Selling with the buy sheet below), the webhooks' `list_webhooks`, `create_webhook`, `update_webhook`, `delete_webhook`, `test_webhook` and `list_webhook_deliveries` (see Webhooks below), a game's secrets' `list_secrets`, `set_secret` and `delete_secret` (see Secrets below), the items' `list_items`, `set_item`, `remove_item`, `set_purchase_settings`, `grant_item`, `list_purchases`, `get_purchase`, `refund_purchase`, `mark_purchase_handled` and `get_player_items` (see Items and purchases below), a game's kept rooms' `list_kept_rooms`, `delete_kept_room`, `bring_back_kept_room` and `erase_kept_room_now`, `restore_kept_room`, `undo_kept_room_restore`, `list_kept_room_restores`, `restore_every_kept_room`, `get_kept_room_restore_batch`, `undo_every_kept_room_restore` (see Kept rooms below), a game's live rooms' `list_rooms`, `get_room`, `send_room_message`, `send_to_every_room`, `list_room_messages`, `cancel_room_message`, `kick_player` and `end_room` (see Reaching live rooms below), the game database's `get_database`, `query_database`, `batch_database`, `export_database`, `import_database`, `erase_player`, `restore_database` and `undo_database_restore` (see The game database below), cloud saves' `list_saves`, `get_save`, `change_save`, `replace_save`, `reset_save`, `list_save_copies`, `get_save_copy` and `restore_save_copy` (see Cloud saves below), and the developer forum's `search_forum`, `get_topic`, `post_topic`, `message_zaisma`, `reply_to_topic`, `vote`, `rate_post`, `bookmark_post`, `report_post`, `forum_people`, `still_happening`, `flag_misplaced`, `follow_topic` and `mark_answer` (see The developer forum below). Bigger builds go through the upload command. Making a game players can play private or a draft again, and ending a live room (`end_room`), need `"confirm": true`, so the AI asks you first.
|
|
19
|
+
Every tool is a call to this API (`apps/site/src/mcp.ts`): `list_games`, `create_game`, `get_game`, `get_playing_now`, `get_whats_on`, `update_game`, `check_game` (what Zaisma would refuse in a game and what won't work on Zaisma, before uploading; see Checking a game below), `upload_files` (small games up to 5 MB, sent as file contents), `get_version`, `update_version` (a version's notes before it's live), `publish_version` (also rolls back and publishes later), `cancel_scheduled_publish`, `end_preview_links`, `add_image`, `remove_image`, `add_shader`, `check_shader` (a shader drawn as the check would, before it's sent; see Backgrounds below), `remove_shader`, `set_background`, `preview_game_page` (pictures of every place players meet the game, from what you're still designing; see Seeing it as players do below), `add_tester_link`, `update_tester_link`, `remove_tester_link`, `get_reports`, `get_stats`, `get_history`, `get_qr_code` (the game's link, or a room's, as a QR code), `export_game` (everything about a game as one .zip; see Export everything below), `get_logs` (what the game server printed, see A game server's logs below), `get_player`, `get_access` (what the key can do), `get_activity` (your account's activity, needs a full key), the inbox's `list_inbox`, `update_inbox_notice`, `delete_inbox_notice` and `set_inbox_settings`, a game's `announce_event` and `reply_to_bug_report` (see The inbox below), `list_api_keys` (your keys and connected apps with their end dates, last use and whether Zaisma turned one off; needs a full key), the sign-in apps' `list_sign_in_apps`, `create_sign_in_app`, `update_sign_in_app` and `delete_sign_in_app`, hosting credit's `get_credit`, `top_up_credit`, `refund_top_up`, `start_credit_plan`, `change_credit_plan`, `stop_credit_plan` and `get_spending_request` (see Hosting and credit below), Zaisma Pro's `get_pro`, `start_pro`, `cancel_pro`, `resume_pro` and `refund_pro` (see Zaisma Pro below), `get_storage`, `set_storage_budget`, `delete_version` and `delete_game`, `bring_back_game`, `erase_game_now`, `get_game_deletion_request` (see Storage below), the Stripe account's `get_stripe_account`, `connect_stripe_account`, `update_stripe_account` and `disconnect_stripe_account` (see Selling with the buy sheet below), the webhooks' `list_webhooks`, `create_webhook`, `update_webhook`, `delete_webhook`, `test_webhook` and `list_webhook_deliveries` (see Webhooks below), a game's secrets' `list_secrets`, `set_secret` and `delete_secret` (see Secrets below), `create_ticket_secret` (the secret a game's own server signs voice tickets with; see Voice below), the items' `list_items`, `set_item`, `remove_item`, `set_purchase_settings`, `grant_item`, `list_purchases`, `get_purchase`, `refund_purchase`, `mark_purchase_handled` and `get_player_items` (see Items and purchases below), a game's kept rooms' `list_kept_rooms`, `delete_kept_room`, `bring_back_kept_room` and `erase_kept_room_now`, `restore_kept_room`, `undo_kept_room_restore`, `list_kept_room_restores`, `restore_every_kept_room`, `get_kept_room_restore_batch`, `undo_every_kept_room_restore` (see Kept rooms below), a game's live rooms' `list_rooms`, `get_room`, `send_room_message`, `send_to_every_room`, `list_room_messages`, `cancel_room_message`, `kick_player` and `end_room` (see Reaching live rooms below), the game database's `get_database`, `query_database`, `batch_database`, `export_database`, `import_database`, `erase_player`, `restore_database` and `undo_database_restore` (see The game database below), cloud saves' `list_saves`, `get_save`, `change_save`, `replace_save`, `reset_save`, `list_save_copies`, `get_save_copy` and `restore_save_copy` (see Cloud saves below), and the developer forum's `search_forum`, `get_topic`, `post_topic`, `message_zaisma`, `reply_to_topic`, `vote`, `rate_post`, `bookmark_post`, `report_post`, `forum_people`, `still_happening`, `flag_misplaced`, `follow_topic` and `mark_answer` (see The developer forum below). Bigger builds go through the upload command. Making a game players can play private or a draft again, and ending a live room (`end_room`), need `"confirm": true`, so the AI asks you first.
|
|
20
20
|
|
|
21
21
|
Every tool has an output schema, and answers are compact JSON. Arguments are closed: one a tool doesn't take is refused (`unknown_field`, with the arguments it does take), never quietly dropped, and a missing required one is `missing_field`. A refused call is a tool result with `isError: true`, the error object below as its `structuredContent` and its message, fix and code as its text; each tool's listed output schema is its answer or that error, because MCP clients check both against it. The tools that are easy to get wrong (`update_game`, `check_game`, `upload_files`, `publish_version`, `search_forum`, `post_topic`, `change_save`, `replace_save`, `set_secret`) carry good examples in their input schema and bad ones at the end of their description.
|
|
22
22
|
|
|
@@ -673,7 +673,7 @@ Every call is checked before any of it runs, in this order: the key's access, wh
|
|
|
673
673
|
| `GET /games/:slug` | One game with its `alerts` (see Alerts below), `playing_now_player_count` (the exact number of people playing it now: browsers that pressed Play and still have it on screen, and players in your Zaisma rooms, each counted once however many rooms they sit in, from the last 6 minutes; players see it from 3 up), `images`, `versions` (newest first, each with its `review_reason` and scan `findings`) and `testers`. |
|
|
674
674
|
| `PATCH /games/:slug` | Change any of `new_slug` (the game's link, only while `can_change_slug`: a draft or private game never published, with no tester links or kept rooms; else `slug_locked`), `title`, `description`, `visibility`, `devices`, `controls`, `genres`, `screen_orientation`, `play_modes`, `cloud_saves_enabled`, `account_offer_enabled`, `deleted_account_erase_enabled`, `friend_joins_enabled`, `performance_measuring_enabled`, `room_browsing`, `multiplayer_mode`, `account_requirement`, `minimum_player_age_years`, `game_server_allowed_hosts`, `own_server_urls`, `links`, `glass_tint_color`, `demo_game_slug`, `full_game_item_name` (the game's price to play, see "Sell your game once" under Items and purchases; it needs `purchase_access` `write`), `monthly_budget_cents` (the game's monthly budget from your hosting credit, see Hosting and credit; it needs `credit_access` `write`, and a first or higher budget answers `confirmation_needed`). Leave out what stays the same; `null` clears it. Answers with the `game`, `review_message` (set when new words wait for review), `game_server_problem` (why the game's own game server can't run yet, or `null`) and `next_steps`. |
|
|
675
675
|
|
|
676
|
-
A game looks like: `slug`, `page_url`, `can_change_slug`, `title`, `description`, `visibility`, `is_waiting_for_zaisma_lists` (a listed game from a new developer, waiting for real players and a few quiet days before Zaisma's own lists show it; its link plays meanwhile), `zaisma_lists_wait` (where a live waiting game stands, null when it isn't waiting or isn't live: `is_held_by_reports`, true when reports a person or triage upheld hold it, never who reported or what they wrote, and `progress`, null when only a report holds it: `live_duration_days` of `minimum_live_duration_days`, `counted_player_count` of `minimum_counted_player_count` and `quiet_duration_days` of `minimum_quiet_duration_days`, the same limits that open the lists every hour), `review_status`, `review_reason`, `erases_at`, `is_erase_now_allowed`, `country_blocks`, `devices`, `controls`, `genres`, `screen_orientation`, `play_modes`, `cloud_saves_enabled`, `account_offer_enabled`, `deleted_account_erase_enabled`, `friend_joins_enabled`, `performance_measuring_enabled`, `multiplayer_mode`, `room_browsing`, `account_requirement`, `minimum_player_age_years`, `game_server_allowed_hosts`, `own_server_urls`, `links`, `link_out_url`, `link_out_who_can_open`, `link_out_review_reason`, `details_waiting_for_review` (a title or description from before Nov 25, 2026 still waiting for a person; new words apply at once), `glass_tint_color`, `monthly_budget_cents` (`null`: no paid hosting), `purchase_label` (what the game page says it sells, see In-game purchases), `refund_policy` and `refund_policy_text` (`null` until it states one), `full_game_item_name` (`null`: free to play), `demo_game_slug` (`null`: no demo), `first_published_at` (when it first went live; it never moves), `big_update_at` (the last marked big update; `null`: none yet), `recently_updated_at` (where Browse's Recently updated places it) and `updated_at`.
|
|
676
|
+
A game looks like: `slug`, `page_url`, `can_change_slug`, `title`, `description`, `visibility`, `is_waiting_for_zaisma_lists` (a listed game from a new developer, waiting for real players and a few quiet days before Zaisma's own lists show it; its link plays meanwhile), `zaisma_lists_wait` (where a live waiting game stands, null when it isn't waiting or isn't live: `is_held_by_reports`, true when reports a person or triage upheld hold it, never who reported or what they wrote, and `progress`, null when only a report holds it: `live_duration_days` of `minimum_live_duration_days`, `counted_player_count` of `minimum_counted_player_count` and `quiet_duration_days` of `minimum_quiet_duration_days`, the same limits that open the lists every hour), `review_status`, `review_reason`, `erases_at`, `is_erase_now_allowed`, `country_blocks`, `devices`, `controls`, `genres`, `screen_orientation`, `play_modes`, `cloud_saves_enabled`, `account_offer_enabled`, `deleted_account_erase_enabled`, `friend_joins_enabled`, `performance_measuring_enabled`, `multiplayer_mode`, `room_browsing`, `account_requirement`, `minimum_player_age_years`, `game_server_allowed_hosts`, `own_server_urls`, `has_ticket_secret` (whether its own server has a ticket secret for voice, see Voice), `links`, `link_out_url`, `link_out_who_can_open`, `link_out_review_reason`, `details_waiting_for_review` (a title or description from before Nov 25, 2026 still waiting for a person; new words apply at once), `glass_tint_color`, `monthly_budget_cents` (`null`: no paid hosting), `purchase_label` (what the game page says it sells, see In-game purchases), `refund_policy` and `refund_policy_text` (`null` until it states one), `full_game_item_name` (`null`: free to play), `demo_game_slug` (`null`: no demo), `first_published_at` (when it first went live; it never moves), `big_update_at` (the last marked big update; `null`: none yet), `recently_updated_at` (where Browse's Recently updated places it) and `updated_at`.
|
|
677
677
|
|
|
678
678
|
- **visibility:** `draft`, `listed` (home page, search and search engines), `unlisted` (anyone with the link, never in lists or search engines) or `private`. Draft and private games open only through preview links and tester links (below), and on their own page for their developer, signed in. There a multiplayer game plays online while the page plays the live version; a newer version not yet published plays alone, and joining a room says so. A game is listed only with at least one gallery picture, sent or approved: `listed` without one answers `gallery_picture_needed`, and so does removing the last gallery picture of a listed game.
|
|
679
679
|
- **review_status** is ours and separate: `pending` (no version has passed review yet), `live`, `held` or `removed`, and `review_reason` says why it's held or removed (see Holds and takedowns). Changing visibility never undoes a takedown.
|
|
@@ -789,19 +789,19 @@ Account-wide things (webhooks, sign-in apps, API keys) aren't in it: they belong
|
|
|
789
789
|
|
|
790
790
|
## Hosting and credit
|
|
791
791
|
|
|
792
|
-
Everything a game runs on Zaisma's servers is on one meter per game, shown as a percentage of its free hosting for the month, never in dollars: its rooms, its game server, data Zaisma's relay sends its players, its database, and requests, webhook events and schedule runs to its game server. Every game gets the same free hosting each calendar month (UTC), with no card: 8 friends playing a real-time game 2 hours every night use about a third of it; it covers about 1,300 player-hours of an 8-player real-time game at 60 ticks a second (over 300 players playing 4 hours a month), or about 2,500 player-hours of a 4-player turn-based game. A demo or a test never uses up another game's month. Free on purpose, for every game and off the meter: game files (downloads and storage, so a game never stops loading), cloud saves, accounts and sign-in, publishing and its reviews, spectators, and anything on your own servers (rooms, a relay, an API).
|
|
792
|
+
Everything a game runs on Zaisma's servers is on one meter per game, shown as a percentage of its free hosting for the month, never in dollars: its rooms, its game server, data Zaisma's relay sends its players, voice, its database, and requests, webhook events and schedule runs to its game server. Every game gets the same free hosting each calendar month (UTC), with no card: 8 friends playing a real-time game 2 hours every night use about a third of it; it covers about 1,300 player-hours of an 8-player real-time game at 60 ticks a second (over 300 players playing 4 hours a month), or about 2,500 player-hours of a 4-player turn-based game. A demo or a test never uses up another game's month. Free on purpose, for every game and off the meter: game files (downloads and storage, so a game never stops loading), cloud saves, accounts and sign-in, publishing and its reviews, spectators, and anything on your own servers (rooms, a relay, an API).
|
|
793
793
|
|
|
794
794
|
`hosting_use_this_month`, in `GET /games/:slug/stats` and `GET /games/:slug/database`:
|
|
795
795
|
|
|
796
796
|
- `free_used_pct`: how much of the month's free hosting is used, 0 to 100. `resets_on_date` is when it starts again.
|
|
797
|
-
- `shares`: what used it, each `{"kind", "share_pct"}` adding to 100, biggest first: `rooms`, `game_server`, `relayed_data`, `database`, `requests`, `ai_reviews` (AI reviews of its versions from before the fixed checks became the review; nothing new is charged), `page_previews` (Chrome drawing your AI's preview pictures, `preview_game_page`). `[]` before any use.
|
|
797
|
+
- `shares`: what used it, each `{"kind", "share_pct"}` adding to 100, biggest first: `rooms`, `game_server`, `relayed_data`, `voice` (voice Cloudflare's media server sent your players, `room.voice`), `database`, `requests`, `ai_reviews` (AI reviews of its versions from before the fixed checks became the review; nothing new is charged), `page_previews` (Chrome drawing your AI's preview pictures, `preview_game_page`). `[]` before any use.
|
|
798
798
|
- `second_free_allowance_month_start_date`: the month the game had its second free allowance, the first time it filled its free hosting, or `null` until then. It comes once; that month `free_used_pct` counts both.
|
|
799
799
|
- `is_paused`, `paused_reason` (`free_used`, `budget_used`, `credit_used`, `no_real_players`, `free_hosting_ended` or `null`) and `paused_at`.
|
|
800
800
|
- `free_rooms_stopped_at`: when Zaisma's free room time for the month ran out across all games, for a game with no budget with credit; `null` otherwise. See the stop below.
|
|
801
801
|
- `monthly_budget_cents` and `spent_from_credit_cents`: the game's budget and what credit paid for it this month.
|
|
802
802
|
- **Where the hours went:** `play_hours`, this month's totals, never who: `total_duration_hours`, of it `new_player_duration_hours` and `returning_player_duration_hours`, and of it again `rented_network_duration_hours` and `other_network_duration_hours`, with `rented_share_used_pct`.
|
|
803
803
|
- **Real players go last:** traffic from rented-server networks has its own share of 10% of the game's free hosting and of its budget, counting only its own use, and everyone else plays from the rest, with no extra free time and no gap in the meter. On that share: anyone on a rented-server network without history, and anyone at all whose browser shows no input and no graphics chip. An account a week old, or that played before or bought something, and a browser that played this game before, play from the rest on any network. Past it those players get `rented_share_used` from rooms, requests and the relay, and in a match they get an hour; everyone else plays on. A game on its own server isn't on the meter, and never hears any of it.
|
|
804
|
-
- The counts behind it: `room_awake_duration_hours`, `room_connection_count`, `inbound_message_count`, `relayed_size_bytes`, `game_server_cpu_duration_sec` (of it `startup_cpu_duration_sec`), `game_server_session_count`, `game_server_invocation_count` (calls into it as Cloudflare counts them: a real-time room's ticks, up to 30 to a call, each message, join, request, schedule run, webhook event and start; the stats' `call_count` is only its rooms' calls, for its health), `loaded_version_count`, `outside_call_count`, `log_file_count`, `request_count`, `awake_duration_hours`, `database_call_count`, `written_row_count`, `read_row_count`, `bookkeeping_written_row_count` and `database_size_bytes`; and `room_play_duration_hours`, player time in rooms, a fact for tuning that isn't priced.
|
|
804
|
+
- The counts behind it: `room_awake_duration_hours`, `room_connection_count`, `inbound_message_count`, `relayed_size_bytes`, `voice_size_bytes`, `game_server_cpu_duration_sec` (of it `startup_cpu_duration_sec`), `game_server_session_count`, `game_server_invocation_count` (calls into it as Cloudflare counts them: a real-time room's ticks, up to 30 to a call, each message, join, request, schedule run, webhook event and start; the stats' `call_count` is only its rooms' calls, for its health), `loaded_version_count`, `outside_call_count`, `log_file_count`, `request_count`, `awake_duration_hours`, `database_call_count`, `written_row_count`, `read_row_count`, `bookkeeping_written_row_count` and `database_size_bytes`; and `room_play_duration_hours`, player time in rooms, a fact for tuning that isn't priced.
|
|
805
805
|
|
|
806
806
|
**A second free allowance, once.** The first time a game with real players fills its free hosting, it gets a second allowance free that month, so it doesn't stop before you can react: `second_free_allowance_started` tells you. A game with no real players doesn't get it yet, and doesn't lose it. A game with a budget isn't charged for it. From the next month it has one allowance again.
|
|
807
807
|
|
|
@@ -855,7 +855,7 @@ Versions a day are the same on every plan: 100 a game, and publishing has no lim
|
|
|
855
855
|
|
|
856
856
|
| Call | What it does |
|
|
857
857
|
| --- | --- |
|
|
858
|
-
| `GET /pro` | Your plan: `{"pro": {"plan", "pro_ends_at", "is_pro_cancelled", "monthly_price_cents", "limits": {"free": {...}, "pro": {...}}, "limits_for_everyone": {
|
|
858
|
+
| `GET /pro` | Your plan: `{"pro": {"plan", "pro_ends_at", "is_pro_cancelled", "monthly_price_cents", "limits": {"free": {...}, "pro": {...}}, "limits_for_everyone": {"maximum_version_count"}, "used_today": {"performance_check_count"}}}`. `plan` is `free` or `pro`; `pro_ends_at` is when Pro ends or renews (`null` on free); `is_pro_cancelled` says it ends there instead of renewing; `refund_ends_at` is until when `POST /pro/refund` refunds the first payment (14 days after it, while it's the only one), `null` after that, on free, or when Stripe didn't answer within 3 seconds. Each plan's limits are `{"maximum_performance_check_count", "included_size_bytes", "maximum_new_data_size_bytes"}`. |
|
|
859
859
|
| `POST /pro/checkout` | Start Pro. Answers `checkout_url`, Stripe's page where only you can pay, `expires_at` and `next_steps` (`get_pro` once you've paid). `already_pro` (409) while Stripe holds your Pro subscription, cancelled or not (`resume_pro` takes cancelling back). Up to 10 starts, cancels, resumes and refunds a minute. |
|
|
860
860
|
| `POST /pro/cancel` | Cancel at the end of the paid month. Answers the `pro` as `GET /pro` does, and `next_steps`. `not_pro` (409) when you have no Pro or it's already cancelled. |
|
|
861
861
|
| `POST /pro/resume` | Take cancelling back before it ends. Answers the `pro` as `GET /pro` does. `not_pro` (409) when you have no Pro or it isn't cancelled. |
|
|
@@ -891,7 +891,7 @@ An account over its limit keeps its live versions. New uploads must fit: `storag
|
|
|
891
891
|
|
|
892
892
|
## Players
|
|
893
893
|
|
|
894
|
-
A signed-in player plays as their Zaisma account in every game, with the same player ID (`player_…`) everywhere; anyone else is a guest with a new ID for each pass. Your game sees the ID in `room.players`, in `Zaisma.player.getPass()` and as the `sub` of the player pass your own server checks, with `kind` saying `account` or `guest`. Your server checks a pass with `verifyPass(pass, keys, { gameSlug })` from `@zaisma/game-server` (your game's own keys at `https://rooms.zaisma.com/v1/pass-keys/<gameSlug>`: every game's passes are signed with a key of its own, so a pass for another game never checks out against them; the list holds more than one so the next key is out ahead of signing anything: pick by the token's `kid`, as `verifyPass` does, and never pin one; `issuerUrl` defaults to `https://rooms.zaisma.com`): a JWT with header `typ` `pass+jwt` and claim `pass_version_number` `1`, refused with a `PassError` whose `code` is `malformed`, `unknown_key` (fetch the keys again), `bad_signature`, `expired`, `wrong_game`, `wrong_issuer`, `wrong_kind` (a receipt, or another JWT) or `wrong_version`. `kind`, `who_reads_my_chat` and `who_can_chat` may gain values, so treat one you don't know as a guest and as `nobody`. An account's pass says how its chat reaches (`who_reads_my_chat`, `chat_reading_enabled`, its age band's opaque `chat_group_id`, its sealed `network_seal`, and v1's `who_can_chat` as a stricter stand-in), its own opaque `player_tag_id` and its friends' and blocks' tags (`friend_player_tag_ids`, `block_player_tag_ids`), all different in every game. Zaisma never tells a game anyone's age; a game could guess which chat group is the younger one from its size.
|
|
894
|
+
A signed-in player plays as their Zaisma account in every game, with the same player ID (`player_…`) everywhere; anyone else is a guest with a new ID for each pass. Your game sees the ID in `room.players`, in `Zaisma.player.getPass()` and as the `sub` of the player pass your own server checks, with `kind` saying `account` or `guest`. Your server checks a pass with `verifyPass(pass, keys, { gameSlug })` from `@zaisma/game-server` (your game's own keys at `https://rooms.zaisma.com/v1/pass-keys/<gameSlug>`: every game's passes are signed with a key of its own, so a pass for another game never checks out against them; the list holds more than one so the next key is out ahead of signing anything: pick by the token's `kid`, as `verifyPass` does, and never pin one; `issuerUrl` defaults to `https://rooms.zaisma.com`): a JWT with header `typ` `pass+jwt` and claim `pass_version_number` `1`, refused with a `PassError` whose `code` is `malformed`, `unknown_key` (fetch the keys again), `bad_signature`, `expired`, `wrong_game`, `wrong_issuer`, `wrong_kind` (a receipt, or another JWT) or `wrong_version`. `kind`, `who_reads_my_chat` and `who_can_chat` may gain values, so treat one you don't know as a guest and as `nobody`. An account's pass says how its chat reaches (`who_reads_my_chat`, `chat_reading_enabled`, its age band's opaque `chat_group_id`, its sealed `network_seal`, and v1's `who_can_chat` as a stricter stand-in), its own opaque `player_tag_id` and its friends' and blocks' tags (`friend_player_tag_ids`, `block_player_tag_ids`), all different in every game. It also says who hears it talk (`who_hears_my_voice`, the same choices, `nobody` while its chat is stopped) and whether it hears others (`voice_hearing_enabled`): see Voice. Zaisma never tells a game anyone's age; a game could guess which chat group is the younger one from its size.
|
|
895
895
|
|
|
896
896
|
| Call | What it does |
|
|
897
897
|
| --- | --- |
|
|
@@ -952,6 +952,44 @@ Every answer from the filter is `{ isAllowed, reason, message, hasSwearing, hasS
|
|
|
952
952
|
|
|
953
953
|
Contact details stopped toward under-18 accounts five times in a day pause the sender's chat for an hour. A paused account's next pass says `who_reads_my_chat: "nobody"` (and `who_can_chat: "nobody"`), so `canChat` stops it on your server too. Zaisma keeps no chat.
|
|
954
954
|
|
|
955
|
+
### Voice
|
|
956
|
+
|
|
957
|
+
Players talk to each other in a room with `room.voice`, through Cloudflare's media server, so nobody sees anyone's address. Your game holds the microphone and plays the voices, with its own volumes, placement and effects; Zaisma decides whose voice reaches whom, by chat's rules, and keeps none of it.
|
|
958
|
+
|
|
959
|
+
- **Who hears whom:** each player chooses who hears them talk (Friends, My age band or Everyone, starting where their typed chat is, `who_hears_my_voice` on their pass) and whether they hear others (`voice_hearing_enabled`). A voice reaches the players that choice takes in, with no block either way and not muted by them. Guests and spectators have no voice (`room.canTalk` is `false`; a player who can't talk can still listen).
|
|
960
|
+
- **The witness rule, for voice:** anyone under 18 is heard, and hears adults, only while at least two independent players hear that voice too (the same independent players as chat's). In a duo, in proximity voice with one other player in range, or on a team of two, an under-18's voice goes quiet both ways, and the moment a witness leaves it's cut. No filter listens to voice: a report carries the last 30 seconds the reporter heard instead.
|
|
961
|
+
- **In the game:** `await room.voice.join()` (call it from a tap: browsers play sound only after one) asks for the microphone when the player can talk, and rejects with `microphone_refused`, `voice_not_allowed`, `voice_unavailable` or `hosting_paused`. `room.on("speaking", ({ playerId, isSpeaking }) => …)` says who's talking, this player included; `room.voice.speakerPlayerIds` (and the `voiceSpeakers` event) is whose voices reach this player now. `room.voice.setMicrophoneMuted(isMuted)` for a mute button or push-to-talk; `room.voice.leave()`, or leaving the room, ends it.
|
|
962
|
+
- **Proximity and effects:** `room.voice.setSpeakerVolume(playerId, volumePct)` (0 to 100; at 0 the voice isn't sent at all, so nobody pays for it) and `room.voice.setSpeakerPan(playerId, panPct)` (-100 left to 100 right) place each voice; `room.voice.audioNodeOf(playerId)` hands you its sound to run through your own Web Audio nodes (a radio's crackle, a muffled wall) to `room.voice.outputNode`.
|
|
963
|
+
- **Echo:** voices play through `room.voice.outputNode`, which the browser's echo cancellation hears, so a player on speakers doesn't send the others' voices back. Route your game's own sound there too (made in `room.voice.audioContext`), or a phone's microphone picks it up.
|
|
964
|
+
- **Your game server's rules, the backstop:** `room.setVoiceGroup(playerId, groupName)` puts a player in a group (a team, a squad's radio: 1 to 40 characters, `null` for none), who then hears and is heard only within it; `room.setHeardSpeakers(listenerPlayerId, speakerPlayerIds)` limits whom a player hears (proximity: only those in range; `null` for everyone allowed); `room.setHeardSpeakerCount(count)` sets how many voices each player hears at once, 1 to 32 (16 unless you set it), the loudest past that. A changed game can't hear past these: Zaisma's room makes every connection itself.
|
|
965
|
+
- **What it sends:** Opus at about 24 kbps in 40 ms packets, nothing while a player is silent: about 33 kbps on the wire while talking, 1 kbps silent. Voice is its own line on the meter, `voice`, at $0.20 per GB Cloudflare's media server sends your players (four times Cloudflare's $0.05): 12 players all shouting nonstop for 5 minutes, each hearing the other 11, is about 3 cents; a normal lobby, under 1 cent.
|
|
966
|
+
- **Reports:** a report about a player, from Zaisma's report sheet or a game's own `room.report`, can carry the last 30 seconds this player heard (the SDK keeps them in memory only, as they play). Only Zaisma hears it; it's never passed to you, and it's deleted with the report.
|
|
967
|
+
- **On your own server:** your players join a voice channel on Zaisma with a ticket your server signs: make the game's ticket secret once with `create_ticket_secret` (`POST /games/:slug/ticket-secret`, shown once; keep it only on your server), then `voiceTicket(playerPass, channelName, ticketSecret, { voiceGroupName, heardSpeakerPlayerIds, heardSpeakerCount })` from `@zaisma/game-server` for a player whose pass you checked, and send it to their game, which joins with `room.voice.join({ ticket })`. A ticket lasts 5 minutes, enough to join; for a new team or range, send a new one (`room.voice.updateTicket(ticket)`). Channel names are 1 to 40 of `a-z 0-9 - _ :`, like `match-12`. Without a ticket a room on your own server answers `voice_ticket_required`; a ticket for another player, channel or game, expired, or signed with another secret is `voice_ticket_refused`. `canVoiceChat(speakerPass, listenerPass)` is the pass rule if you pass voice yourself; Zaisma applies it and the witness rule on its channels.
|
|
968
|
+
- **Trying it:** voice goes through Zaisma's media server, so the local bench (`npx @zaisma/cli play-locally`) has none: your game's `room.voice.join()` answers `voice_ticket_required` there. Try voice on Zaisma, through a tester link (`add_tester_link`), with a friend or a second browser.
|
|
969
|
+
|
|
970
|
+
```js
|
|
971
|
+
// Push-to-talk with proximity: the game holds the microphone, Zaisma decides who hears it.
|
|
972
|
+
const room = await Zaisma.joinRoom();
|
|
973
|
+
joinButton.addEventListener("click", async () => {
|
|
974
|
+
try {
|
|
975
|
+
await room.voice.join({ isMuted: true });
|
|
976
|
+
} catch (error) {
|
|
977
|
+
showNote(error.message);
|
|
978
|
+
}
|
|
979
|
+
});
|
|
980
|
+
addEventListener("keydown", (event) => event.key === "v" && room.voice.setMicrophoneMuted(false));
|
|
981
|
+
addEventListener("keyup", (event) => event.key === "v" && room.voice.setMicrophoneMuted(true));
|
|
982
|
+
room.on("speaking", ({ playerId, isSpeaking }) => setMicIcon(playerId, isSpeaking));
|
|
983
|
+
function everyFrame() {
|
|
984
|
+
for (const other of room.players) {
|
|
985
|
+
if (other.id === room.me.id) continue;
|
|
986
|
+
const distanceM = distanceTo(other.id);
|
|
987
|
+
room.voice.setSpeakerVolume(other.id, Math.max(0, Math.round(100 - distanceM * 5)));
|
|
988
|
+
room.voice.setSpeakerPan(other.id, Math.round(directionTo(other.id) * 100));
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
```
|
|
992
|
+
|
|
955
993
|
## Room connections
|
|
956
994
|
|
|
957
995
|
How a room and each player's game stay in touch, the same in Zaisma rooms and on your own server (the Node runner): how a dead connection is noticed, what happens to a player whose connection drops or who walks away, the limits on what players send, and why a connection closes.
|
|
@@ -1095,6 +1133,12 @@ A room answers a refusal with `{ type: "error", code, message }`, then closes th
|
|
|
1095
1133
|
| `chat_empty` | `room.chat` with nothing but spaces. |
|
|
1096
1134
|
| `chat_too_long` | `room.chat` over 2000 characters. |
|
|
1097
1135
|
| `chat_too_fast` | More than 20 chat messages in 10 seconds from one player. |
|
|
1136
|
+
| `voice_not_here` | A voice message reached a room whose server doesn't take voice (your own server: voice goes through a ticket, see Voice). |
|
|
1137
|
+
| `microphone_refused` | The SDK's own: `room.voice.join` couldn't use the microphone (the player or the browser said no). |
|
|
1138
|
+
| `voice_not_allowed` | `room.voice.join` from a guest or a spectator. |
|
|
1139
|
+
| `voice_unavailable` | Voice couldn't start or connect: try again. |
|
|
1140
|
+
| `voice_ticket_required` | `room.voice.join` in a room on your own server without a ticket from that server. |
|
|
1141
|
+
| `voice_ticket_refused` | A voice ticket for another player, channel or game, expired, or signed with another secret. |
|
|
1098
1142
|
| `bad_region` | The SDK's own: a `region` that isn't a continent code (`"AF"`, `"AN"`, `"AS"`, `"EU"`, `"NA"`, `"OC"` or `"SA"`). |
|
|
1099
1143
|
| `bad_idle_timeout` | The SDK's own: an `idleTimeoutSec` that isn't from 30 to 86400. |
|
|
1100
1144
|
| `bad_transport` | The SDK's own: a `transport` that isn't `"websocket"` or `"webtransport"`. |
|
|
@@ -1141,6 +1185,8 @@ Every event the game's room object has, and what its listener gets. Within v1, e
|
|
|
1141
1185
|
| `error` | `{ code, message }` |
|
|
1142
1186
|
| `versionUpdate` | `{ versionId, appliesAt, isReloading }` |
|
|
1143
1187
|
| `roomMessage` | `{ message, senderKind, fromRoomCode, sentAt }`: a room message for a room whose game server has no `onRoomMessage` (see Reaching live rooms) |
|
|
1188
|
+
| `speaking` | `{ playerId, isSpeaking }`: a voice started or stopped speaking, this player's own included (see Voice) |
|
|
1189
|
+
| `voiceSpeakers` | `{ playerIds }`: whose voices reach this player now changed |
|
|
1144
1190
|
|
|
1145
1191
|
The SDK and rooms say which messages they speak with `protocolVersionNumber` (1 today): the SDK sends it in its hello, and the welcome answers the room's. A room skips a message type it doesn't know, so a newer SDK still plays in an older room.
|
|
1146
1192
|
|
|
@@ -1199,6 +1245,7 @@ Tokens and keys a game's own game server needs, like a Discord webhook URL, a Gi
|
|
|
1199
1245
|
| `GET /games/:slug/secrets` | The game's `secrets`, by name, each `{"name", "set_at"}`: never the value. |
|
|
1200
1246
|
| `PUT /games/:slug/secrets/:secret_name` | Set one, replacing any of that name: `{"secret_value"}`. Answers the `secret` and `next_steps`. |
|
|
1201
1247
|
| `DELETE /games/:slug/secrets/:secret_name` | Delete one. Answers `deleted_secret_name` and `next_steps`. |
|
|
1248
|
+
| `POST /games/:slug/ticket-secret` | A new ticket secret for the game, answered once as `ticket_secret` (with `next_steps`) and never again: its own server signs voice tickets with it (see Voice). A new one replaces the old at once, and tickets signed with the old stop working. `GET /games/:slug` says `has_ticket_secret`. Needs `game_access` write. |
|
|
1202
1249
|
|
|
1203
1250
|
- **Names** are like environment variables: capitals, digits and underscores, starting with a capital, up to 64 characters (`DISCORD_WEBHOOK_URL`). **Values** are text, up to 8 KB; put several values in one as JSON text if you like. Up to 50 a game.
|
|
1204
1251
|
- **When it changes:** requests and schedules use the new value from their next call; running rooms get it within a minute.
|
|
@@ -1857,7 +1904,7 @@ Each problem is `{ code, problem_kind, is_fixed_by_upload_command, message, path
|
|
|
1857
1904
|
| `file_download` | broken | no | A file download, which the game's frame doesn't allow. |
|
|
1858
1905
|
| `outside_link` | broken | no | A link that opens another site or a new window, which the game's frame doesn't allow. |
|
|
1859
1906
|
| `outside_frame` | broken | no | A frame of another site, which games can't show. |
|
|
1860
|
-
| `blocked_feature` | broken | no | Camera,
|
|
1907
|
+
| `blocked_feature` | broken | no | Camera, screen capture, location, payments, USB, serial, Bluetooth or HID, which games on Zaisma can't use. |
|
|
1861
1908
|
|
|
1862
1909
|
`performance_notes` are the asset notes of How it started in Chrome (`images_could_be_ktx2`, `audio_could_be_opus`, `models_could_be_smaller`, `development_build`), each `{ code, message, path, saved_size_bytes, fix }`. They never stop an upload, and `zaisma check` prints them under "Could be smaller" without changing its exit code. Image sizes, sound lengths and models are read from the files' first bytes, so the API, which gets only sizes for them, gives only `development_build`; `zaisma check` gives them all.
|
|
1863
1910
|
|
|
@@ -313,7 +313,7 @@ Zaisma.joinRoom({ idleCheckEnabled: false }); // no "Still there?" in this game
|
|
|
313
313
|
|
|
314
314
|
Every number behind this (pings, timeouts, reconnecting, held seats, message limits, close codes) is in [Room connections](docs/DEVELOPER-API.md#room-connections).
|
|
315
315
|
|
|
316
|
-
Your own clients follow the same protocol: send the text `ping` every 30 seconds or so (the room answers `pong`), `{"type":"idle"}`, `{"type":"hidden"}` and `{"type":"shown"}` as they happen, and `{"type":"back"}` when the player returns. Their hello carries `"protocolVersionNumber":1`. Errors from the room are `{"type":"error","code":"room_full","message":"This room is full."}`, with codes in lowercase snake_case, one of: `rented_share_used`, `room_full`, `room_closed`, `ended`, `too_big`, `too_fast`, `bad_message`, `bad_pass`, `bad_player_token`, `no_hello`, `not_allowed`, `game_unavailable`, `busy`, `kept_out`, `refused`, `room_not_running`, `hosting_paused`, `account_needed`, `game_not_open_to_player`, `blocked_player_here`, `other_version`, `spectators_full`, `spectator_cannot_send`, `already_playing`, `bad_origin`, `send_queue_full`, `chat_not_here`, `chat_not_allowed`, `chat_empty`, `chat_too_long` or `chat_too_fast`. The SDK's types explain each one (`RoomErrorCode`); codes only grow within v1.
|
|
316
|
+
Your own clients follow the same protocol: send the text `ping` every 30 seconds or so (the room answers `pong`), `{"type":"idle"}`, `{"type":"hidden"}` and `{"type":"shown"}` as they happen, and `{"type":"back"}` when the player returns. Their hello carries `"protocolVersionNumber":1`. Errors from the room are `{"type":"error","code":"room_full","message":"This room is full."}`, with codes in lowercase snake_case, one of: `rented_share_used`, `room_full`, `room_closed`, `ended`, `too_big`, `too_fast`, `bad_message`, `bad_pass`, `bad_player_token`, `no_hello`, `not_allowed`, `game_unavailable`, `busy`, `kept_out`, `refused`, `room_not_running`, `hosting_paused`, `account_needed`, `game_not_open_to_player`, `blocked_player_here`, `other_version`, `spectators_full`, `spectator_cannot_send`, `already_playing`, `bad_origin`, `send_queue_full`, `chat_not_here`, `voice_not_here`, `chat_not_allowed`, `chat_empty`, `chat_too_long` or `chat_too_fast`. The SDK's types explain each one (`RoomErrorCode`); codes only grow within v1.
|
|
317
317
|
|
|
318
318
|
#### Requests to your game server
|
|
319
319
|
|
|
@@ -557,6 +557,12 @@ A room answers a refusal with `{ type: "error", code, message }`, then closes th
|
|
|
557
557
|
| `chat_empty` | `room.chat` with nothing but spaces. |
|
|
558
558
|
| `chat_too_long` | `room.chat` over 2000 characters. |
|
|
559
559
|
| `chat_too_fast` | More than 20 chat messages in 10 seconds from one player. |
|
|
560
|
+
| `voice_not_here` | A voice message reached a room whose server doesn't take voice (your own server: voice goes through a ticket, see Voice). |
|
|
561
|
+
| `microphone_refused` | The SDK's own: `room.voice.join` couldn't use the microphone (the player or the browser said no). |
|
|
562
|
+
| `voice_not_allowed` | `room.voice.join` from a guest or a spectator. |
|
|
563
|
+
| `voice_unavailable` | Voice couldn't start or connect: try again. |
|
|
564
|
+
| `voice_ticket_required` | `room.voice.join` in a room on your own server without a ticket from that server. |
|
|
565
|
+
| `voice_ticket_refused` | A voice ticket for another player, channel or game, expired, or signed with another secret. |
|
|
560
566
|
| `bad_region` | The SDK's own: a `region` that isn't a continent code (`"AF"`, `"AN"`, `"AS"`, `"EU"`, `"NA"`, `"OC"` or `"SA"`). |
|
|
561
567
|
| `bad_idle_timeout` | The SDK's own: an `idleTimeoutSec` that isn't from 30 to 86400. |
|
|
562
568
|
| `bad_transport` | The SDK's own: a `transport` that isn't `"websocket"` or `"webtransport"`. |
|
|
@@ -603,5 +609,7 @@ Every event the game's room object has, and what its listener gets. Within v1, e
|
|
|
603
609
|
| `error` | `{ code, message }` |
|
|
604
610
|
| `versionUpdate` | `{ versionId, appliesAt, isReloading }` |
|
|
605
611
|
| `roomMessage` | `{ message, senderKind, fromRoomCode, sentAt }`: a room message for a room whose game server has no `onRoomMessage` (see Reaching live rooms) |
|
|
612
|
+
| `speaking` | `{ playerId, isSpeaking }`: a voice started or stopped speaking, this player's own included (see Voice) |
|
|
613
|
+
| `voiceSpeakers` | `{ playerIds }`: whose voices reach this player now changed |
|
|
606
614
|
|
|
607
615
|
The SDK and rooms say which messages they speak with `protocolVersionNumber` (1 today): the SDK sends it in its hello, and the welcome answers the room's. A room skips a message type it doesn't know, so a newer SDK still plays in an older room.
|
|
@@ -281,6 +281,10 @@ One name per concept. The API and MCP column is snake_case; the SDK and game ser
|
|
|
281
281
|
| Who reads what an account types, whether it reads others' chat, and the opaque group of its age band (never an age) | `who_reads_my_chat`: `friends`, `my_age_band`, `everyone` (the social setting, outside the presets, `defaultWhoReadsMyChat`), `chat_reading_enabled` (Zaisma's own code: `accounts.who_reads_my_chat`, `accounts.chat_reading_enabled`, `PRESET_SOCIAL_SETTINGS`) | player pass claims `who_reads_my_chat` (`WhoReadsMyChat`, or `nobody` while stopped), `chat_reading_enabled`, `chat_group_id` (a `chat_group_…` ID, different in every game), v1's `who_can_chat` (`WhoCanChat`: `nobody`, `friends`, `anyone`) as a stricter stand-in; checked with `canChat(first, second)`, first the sender and second the reader; inside, `ChatReach` (`nobody`, `friends`, `my_age_band`, `everyone`), `chatReachOf`, `isWithinChatReach`, `PlayerChatSettings` (`sending`, `reading`, `chatGroupId`, `networkSeal`) |
|
|
282
282
|
| A chat message: a line a player typed, sent with room.chat through the room to the players who may read it, after the game server's onChat and Zaisma's chat filter | `chat_messages` on a player report (`from_player_id`, the reported player's or `null`, `text`, `sent_at`); Zaisma's own code: `reports.reported_chat_json`, `ReportedChatMessage`, `REPORTED_CHAT_LIMITS` | `room.chat(text, { toPlayerIds })` answers `{ sentAt }` (`ChatSent`); the `chat` event's `ChatMessage`: `fromPlayerId`, `text`, `hasSwearing`, `hasSlur`, `sentAt`; game server `onChat(state, player, room, chatInfo)` with `ChatInfo` `{ text, toPlayerIds }`, answering a `ChatAnswer` (`true`, `false`, `{ toPlayerIds }`); option `adultChatFilterEnabled`; `CHAT_ROOM_LIMITS` (`maximumChatMessageCount`, `chatWindowDurationMs`); wire messages `chat`, `chat_sent`, `chat_stopped` with a `chatNumber`; error codes `chat_stopped` (with `reason`, `stopped_by_game` for onChat), `chat_not_allowed`, `chat_empty`, `chat_too_long`, `chat_too_fast`, `chat_not_here` |
|
|
283
283
|
| Anyone under 18 types only where two independent players read it: who counts, and a player's network for it (never shown to a game) | Zaisma's own code: `CHAT_WITNESS_LIMITS` (`minimumWitnessCount`, `minimumWitnessAccountAgeDays`, `minimumWitnessCountedDayCount`), `isEstablishedWitness`, `independentWitnessCount`, `WitnessReader`; a network is `v4:<address>` or `v6:<the /56>` (`networkOfAddress`, `networkOf`, `sealNetwork`, `openNetworkSeal`); the filter's answer in rooms adds `readerPlayerIds` and `isEveryReaderNeeded` | player pass claim `network_seal`; `deliverChat`'s `isEveryReaderNeeded` |
|
|
284
|
+
| Voice in a room: a player's voice going through Cloudflare's media server to the players who may hear it, by chat's rules; who hears whom is decided by Zaisma, never the game | `who_hears_my_voice` (`friends`, `my_age_band`, `everyone`, outside the presets, starting where `who_reads_my_chat` is), `voice_hearing_enabled`; `voice_size_bytes` and the meter share `voice`; Zaisma's own code: `VOICE_LIMITS`, `voicePulls`, `accounts.who_hears_my_voice`, `voice_sessions` | `room.voice` (`join`, `leave`, `setMicrophoneMuted`, `setSpeakerVolume(playerId, volumePct)`, `setSpeakerPan(playerId, panPct)`, `audioNodeOf`, `speakerPlayerIds`, `canTalk`), events `speaking` and `voiceSpeakers`; `room.canTalk`; `canVoiceChat(speaker, listener)`; errors `microphone_refused`, `voice_not_allowed`, `voice_unavailable`, `voice_not_here` |
|
|
285
|
+
| A voice group: the players who hear one another only, like a team or a squad's radio; heard speakers: whom one player hears, for proximity; how many voices a player hears at once, the loudest past it | | `room.setVoiceGroup(playerId, groupName)`, `room.setHeardSpeakers(listenerPlayerId, speakerPlayerIds)`, `room.setHeardSpeakerCount(count)`, `VOICE_ROOM_LIMITS` |
|
|
286
|
+
| A voice channel: voice for players of a game on its own server, joined with a voice ticket the server signs with the game's ticket secret | `create_ticket_secret`, `ticket_secret`, `has_ticket_secret`; errors `voice_ticket_required`, `voice_ticket_refused`; Zaisma's own code: `games.sealed_ticket_secret` | `voiceTicket(playerPass, channelName, ticketSecret, voiceTicketOptions)`, `VoiceTicketClaims` (`ticket_kind` `voice`, `channel_name`, `voice_group_name`, `heard_speaker_ids`, `heard_speaker_count`), `room.voice.join({ ticket })`, `room.voice.updateTicket` |
|
|
287
|
+
| A report's voice clip: the last 30 seconds of voice the reporter heard, from their game; only Zaisma hears it | Zaisma's own code: `reports.reported_audio_key`, `reportAudioKey` | `voiceClipBase64` on a report a game sends |
|
|
284
288
|
| An account's Zaisma friends, and the invite that makes two accounts friends | | player pass claim `friend_player_tag_ids` (their `player_tag_id`s, never their player IDs), checked with `passesAreFriends(first, second)`; `room.areFriends(firstPlayerId, secondPlayerId)`; a friend invite's `invite_code` is 8 letters and digits, shown as `K7Q2-MX9P` |
|
|
285
289
|
| A player's friends playing this game, the room to join each in, and why not | `server_url` (in Zaisma's own code: a room on the game's own servers) | `Zaisma.friends.list()` answers `{ friends }`, each `{ id, name, username, roomCode, serverUrl, joinRefusal }`; `joinRefusal`: `game_not_taking_joins`, `friend_not_taking_joins`, `private_room`, `room_closed`, `room_full`, `spectators_full`, `friend_not_in_room`; `Zaisma.friends.setRoom({ serverUrl, roomCode, friendJoinsEnabled })` (null when the player left), refused with `unlisted_server`; a friend's Join link's `?server=`, read as `Zaisma.rooms.linkedServerUrl` |
|
|
286
290
|
| A block between two players, either way (never who made it, never anyone's list of blocks) | | `room.hasBlockBetween(firstPlayerId, secondPlayerId)`; player pass claims `player_tag_id` (the account's own `player_tag_…` ID, different in every game) and `block_player_tag_ids` (the player tags of the accounts it has a block with), checked with `passesHaveBlockBetween(first, second)`; the room's `{ type: "blocks", playerIds }` to each player; a game's `{ type: "block", playerId }` and `{ type: "unblock", playerId }`; `room.block(playerId)`; quickJoin's hello `avoidBlockedPlayers: true`, turned away with `blocked_player_here` |
|
|
@@ -317,7 +321,7 @@ One name per concept. The API and MCP column is snake_case; the SDK and game ser
|
|
|
317
321
|
| What an account stores | `storage`: `{ stored_size_bytes, included_size_bytes, maximum_stored_size_bytes, allowance_kind, new_data_today_size_bytes, maximum_new_data_size_bytes, monthly_storage_budget_cents, unpaid_files_delete_at, spent_this_month_cents, price_per_gigabyte_month_cents, deletable_versions }`; "stored" is what the account keeps, "included" what it has with no budget, "new data" what it sends that it didn't already store (`owner_new_data_days`); `allowance_kind`: `new`, `established`, `paid_by_card`, `pro`; credit entry `storage_charge`; errors `storage_full`, `new_data_limit`, `bad_monthly_storage_budget_cents` | |
|
|
318
322
|
| Deleting a version or a game | `delete_version`, `delete_game` with `confirm_slug`; `is_deleted`; errors `version_in_use`, `kept_for_review`, `bad_confirm_slug`; a file no version of the owner's uses is released (`released_at_ms`) and stops counting | |
|
|
319
323
|
| A game waiting to be erased | `erases_at` on the game (`null` for any other), `is_erase_now_allowed`, `bring_back_game`, `erase_game_now`, and `game_deletion_request` with `request_kind` `delete_game` or `erase_game_now` |
|
|
320
|
-
| A developer's plan and its limits | `plan`: `free` or `pro` (never "subscription" or "tier"); `pro`: `{ plan, pro_ends_at, is_pro_cancelled, monthly_price_cents, limits: { free, pro }, limits_for_everyone, used_today }`, each plan's limits `{ maximum_performance_check_count, included_size_bytes, maximum_new_data_size_bytes }`, `limits_for_everyone` `{
|
|
324
|
+
| A developer's plan and its limits | `plan`: `free` or `pro` (never "subscription" or "tier"); `pro`: `{ plan, pro_ends_at, is_pro_cancelled, monthly_price_cents, limits: { free, pro }, limits_for_everyone, used_today }`, each plan's limits `{ maximum_performance_check_count, included_size_bytes, maximum_new_data_size_bytes }`, `limits_for_everyone` `{ maximum_version_count }`, `used_today` `{ performance_check_count }`; Stripe's `checkout_url`; `plan` in `get_access`; key area `credit_access`; tools `get_pro`, `start_pro`, `cancel_pro`, `resume_pro`; errors `already_pro`, `not_pro`. Inside: `owners.pro_until_ms`, `is_pro_cancelled`, `stripe_subscription_id`, `PLAN_KINDS`, `PLAN_LIMITS`, `PRO_PRICE_CENTS_PER_MONTH`, `planOf`, `limitsFor`, `proCheckout`, `setProCancelled`, `STRIPE_PRO_PRICE_ID` | |
|
|
321
325
|
| A developer's own Stripe account, where the buy sheet's sales go (Connect Standard: the developer is the seller, no fee) | `stripe_account`: `is_connected`, `stripe_account_id` (Stripe's `acct_…`, not a Zaisma ID, so it says no kind), `can_take_payments`, `country_code`, `default_currency_code`, `business_name`, `support_email`, `is_stripe_tax_used`, `connected_at`, `balance` (Stripe's own figures, read live: `currency_code`, `available_minor_units`, `pending_minor_units`, `other_currency_balances` (each `{ currency_code, available_minor_units, pending_minor_units }`), `next_payout` (`{ amount_minor_units, currency_code, arrives_at }`); `null` when Stripe doesn't answer in 3 seconds); key area `stripe_account_access`; tools `get_stripe_account`, `connect_stripe_account`, `update_stripe_account`, `disconnect_stripe_account`; errors `stripe_not_connected`, `stripe_cannot_take_payments`, `bad_is_stripe_tax_used`. Inside: columns `stripe_account_id`, `can_take_stripe_payments`, `stripe_country_code`, `stripe_default_currency_code`, `stripe_business_name`, `stripe_support_email`, `is_stripe_tax_used`, `stripe_connected_at_ms` | |
|
|
322
326
|
| The link a developer connects their Stripe account on | `connect_url`, `expires_at` (10 minutes), answered by `connect_stripe_account` (`POST /stripe-account/connection-links`); through a key, `confirmation_needed` with `confirm_url` | |
|
|
323
327
|
| Whether Stripe Tax works out and records the tax inside each price (prices never change with it) | `is_stripe_tax_used`, `true` or `false`, in `update_stripe_account` and the `stripe_account`; error `bad_is_stripe_tax_used` | |
|
package/skill/references/sdk.md
CHANGED
|
@@ -1386,6 +1386,24 @@ interface Room {
|
|
|
1386
1386
|
* nobody, playing (not watching). False for guests: hide your chat box, and offer preset phrases or emotes.
|
|
1387
1387
|
*/
|
|
1388
1388
|
readonly canChat: boolean;
|
|
1389
|
+
/**
|
|
1390
|
+
* Whether this player can talk in voice ({@link Room.voice}): a Zaisma account whose voice setting reaches someone,
|
|
1391
|
+
* playing (not watching). A player who can't talk can still join voice to listen.
|
|
1392
|
+
*/
|
|
1393
|
+
readonly canTalk: boolean;
|
|
1394
|
+
/**
|
|
1395
|
+
* Voice in this room: your game holds the microphone, and Zaisma's room decides whose voices reach this player, by
|
|
1396
|
+
* chat's rules (who each player lets hear them, blocks, mutes, and anyone under 18 only where two independent
|
|
1397
|
+
* players hear them too), plus your server's teams and ranges (room.setVoiceGroup, setHeardSpeakers). It goes
|
|
1398
|
+
* through Cloudflare's media server, so nobody sees anyone's address, and it's on your game's meter as voice.
|
|
1399
|
+
* Each player hears up to 16 voices at once (your server can set 1 to 32), the loudest past that.
|
|
1400
|
+
* @example
|
|
1401
|
+
* await room.voice.join();
|
|
1402
|
+
* room.on("speaking", ({ playerId, isSpeaking }) => showMicIcon(playerId, isSpeaking));
|
|
1403
|
+
* // Proximity voice: fade and place each voice by distance.
|
|
1404
|
+
* for (const other of room.players) room.voice.setSpeakerVolume(other.id, volumeByDistance(other));
|
|
1405
|
+
*/
|
|
1406
|
+
readonly voice: RoomVoice;
|
|
1389
1407
|
/**
|
|
1390
1408
|
* When Zaisma will end this match, an ISO time, or null: set once the game's hosting pauses for the
|
|
1391
1409
|
* month, an hour after the pause (the "ending" event); null again if Zaisma calls the end off (the
|
|
@@ -1683,6 +1701,79 @@ interface RoomEvents {
|
|
|
1683
1701
|
* them if your game doesn't. (Optional here only so games written for v1's events still fit.)
|
|
1684
1702
|
*/
|
|
1685
1703
|
chat?: (chatMessage: ChatMessage) => void;
|
|
1704
|
+
/** A voice started or stopped speaking, this player's own included, from its level on this device ({@link Room.voice}). */
|
|
1705
|
+
speaking?: (speaking: Speaking) => void;
|
|
1706
|
+
/** The voices this player hears changed: who's in {@link RoomVoice.speakerPlayerIds} now. */
|
|
1707
|
+
voiceSpeakers?: (voiceSpeakers: { playerIds: string[] }) => void;
|
|
1708
|
+
}
|
|
1709
|
+
```
|
|
1710
|
+
|
|
1711
|
+
### Speaking
|
|
1712
|
+
|
|
1713
|
+
```ts
|
|
1714
|
+
/** The "speaking" event's answer. */
|
|
1715
|
+
interface Speaking {
|
|
1716
|
+
playerId: string;
|
|
1717
|
+
isSpeaking: boolean;
|
|
1718
|
+
}
|
|
1719
|
+
```
|
|
1720
|
+
|
|
1721
|
+
### VoiceOptions
|
|
1722
|
+
|
|
1723
|
+
```ts
|
|
1724
|
+
/** What {@link RoomVoice.join} takes. */
|
|
1725
|
+
interface VoiceOptions {
|
|
1726
|
+
/** Join with the microphone muted (push-to-talk starts here). */
|
|
1727
|
+
isMuted?: boolean;
|
|
1728
|
+
/**
|
|
1729
|
+
* For a room on your own server: a voice ticket your server signed (voiceTicket in @zaisma/game-server, with the
|
|
1730
|
+
* game's ticket secret from create_ticket_secret), naming the voice channel and this player's team and range. Rooms
|
|
1731
|
+
* on Zaisma need none.
|
|
1732
|
+
*/
|
|
1733
|
+
ticket?: string;
|
|
1734
|
+
}
|
|
1735
|
+
```
|
|
1736
|
+
|
|
1737
|
+
### RoomVoice
|
|
1738
|
+
|
|
1739
|
+
```ts
|
|
1740
|
+
/** A room's voice: {@link Room.voice}. */
|
|
1741
|
+
interface RoomVoice {
|
|
1742
|
+
/**
|
|
1743
|
+
* Join the room's voice: asks for the microphone when the player can talk ({@link Room.canTalk}), else joins to
|
|
1744
|
+
* listen. Resolves once connected; rejects with microphone_refused (the player or browser said no), voice_not_allowed
|
|
1745
|
+
* (a guest or a spectator), voice_unavailable or hosting_paused. Call it from a tap or key press: browsers play
|
|
1746
|
+
* sound only after one.
|
|
1747
|
+
*/
|
|
1748
|
+
join(voiceOptions?: VoiceOptions): Promise<void>;
|
|
1749
|
+
/** Leave voice: the microphone stops and nobody's voice comes. Leaving the room does it too. */
|
|
1750
|
+
leave(): void;
|
|
1751
|
+
/** On your own server: new rules for this player (a team switch, a range), as a new ticket from your server for the same channel. */
|
|
1752
|
+
updateTicket(ticket: string): void;
|
|
1753
|
+
/** Mute or unmute this player's microphone, for push-to-talk or a mute button. Muted, it sends almost nothing. */
|
|
1754
|
+
setMicrophoneMuted(isMuted: boolean): void;
|
|
1755
|
+
/** A voice's volume here, 0 to 100 (100 unless you set it), for proximity voice or a volume slider. At 0 it isn't sent at all. */
|
|
1756
|
+
setSpeakerVolume(playerId: string, volumePct: number): void;
|
|
1757
|
+
/** Where a voice sits left to right, -100 (left) to 100 (right), 0 unless you set it. */
|
|
1758
|
+
setSpeakerPan(playerId: string, panPct: number): void;
|
|
1759
|
+
/**
|
|
1760
|
+
* A voice's sound after its volume, for your own effects (a radio's crackle, a muffled wall): disconnect it and
|
|
1761
|
+
* connect it through your own nodes to {@link RoomVoice.outputNode}. Null while that voice isn't heard.
|
|
1762
|
+
*/
|
|
1763
|
+
audioNodeOf(playerId: string): AudioNode | null;
|
|
1764
|
+
/** The Web Audio context voices play through, or null before joining. */
|
|
1765
|
+
readonly audioContext: AudioContext | null;
|
|
1766
|
+
/**
|
|
1767
|
+
* Where voices go to the speakers, in {@link RoomVoice.audioContext}, or null before joining. Echo cancellation
|
|
1768
|
+
* hears what plays through it, so the microphone doesn't send it back: connect your effects here, not to the
|
|
1769
|
+
* context's destination, and your game's own sound too, made in this context, while players talk on speakers.
|
|
1770
|
+
*/
|
|
1771
|
+
readonly outputNode: AudioNode | null;
|
|
1772
|
+
/** The players whose voices reach this player now (the "voiceSpeakers" event says when it changes). */
|
|
1773
|
+
readonly speakerPlayerIds: readonly string[];
|
|
1774
|
+
readonly isJoined: boolean;
|
|
1775
|
+
/** Whether this player can talk, as {@link Room.canTalk}. */
|
|
1776
|
+
readonly canTalk: boolean;
|
|
1686
1777
|
}
|
|
1687
1778
|
```
|
|
1688
1779
|
|
|
@@ -2083,6 +2174,7 @@ interface RoomError {
|
|
|
2083
2174
|
* - spectator_cannot_send: a spectator tried to send to the room ({@link Room.send}, {@link Room.sendBytes}).
|
|
2084
2175
|
* - send_queue_full: the SDK's own: more than 60 reliable sends waited while the room wasn't reachable, so the oldest were dropped. Send less while connectionStatus isn't open, or use latest_only for updates that replace each other.
|
|
2085
2176
|
* - chat_not_allowed, chat_empty, chat_too_long, chat_too_fast: {@link Room.chat} refused (they reject its promise, not the "error" event); chat_not_here: the room's server doesn't take chat.
|
|
2177
|
+
* - microphone_refused, voice_not_allowed, voice_unavailable: {@link RoomVoice.join} refused (they reject its promise); after joining, the "error" event says when voice stopped. voice_not_here: the room's server doesn't take voice. voice_ticket_required, voice_ticket_refused: on your own server, join needs a ticket your server signed, for this player and game, not expired.
|
|
2086
2178
|
*
|
|
2087
2179
|
* More codes may come within v1: handle one you don't know like an error you can show (its message).
|
|
2088
2180
|
*
|
|
@@ -2124,7 +2216,13 @@ type RoomErrorCode =
|
|
|
2124
2216
|
| "chat_not_allowed"
|
|
2125
2217
|
| "chat_empty"
|
|
2126
2218
|
| "chat_too_long"
|
|
2127
|
-
| "chat_too_fast"
|
|
2219
|
+
| "chat_too_fast"
|
|
2220
|
+
| "voice_not_here"
|
|
2221
|
+
| "microphone_refused"
|
|
2222
|
+
| "voice_not_allowed"
|
|
2223
|
+
| "voice_unavailable"
|
|
2224
|
+
| "voice_ticket_required"
|
|
2225
|
+
| "voice_ticket_refused";
|
|
2128
2226
|
|
|
2129
2227
|
/**
|
|
2130
2228
|
* The codes a request's errors have ({@link Server.request}), from Zaisma or the Node runner alike:
|