@zaisma/cli 0.69.0 → 0.71.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/README.md CHANGED
@@ -17,6 +17,8 @@ To play a multiplayer game on your own computer before uploading it, run `zaisma
17
17
 
18
18
  A background shader lives in a folder of its own: `image.glsl` (Shadertoy's `mainImage`), `buffer-a.glsl` to `buffer-d.glsl` if it has buffers, `channels.json` wiring each pass's channels to a buffer or a texture file, and the textures (`zaisma help` shows the folder). `zaisma check ./sky` draws it as Zaisma's check does, in your Chrome, and saves a sheet picture of it under Zaisma's glass beside the folder; `zaisma shader ./sky --game sky-hopper --screen wide` sends its textures and the shader.
19
19
 
20
+ A clip is up to 6 seconds of the game, silent and looping, that the game's shared links play in iMessage, Discord and Telegram. Record one on the bench with **Record a clip** (`zaisma play-locally`), or make any MP4 (H.264, no sound, fitting inside 1200 by 630); `zaisma clip ./clip.mp4 --game sky-hopper` sends it with its first frame as the still, taken in your Chrome (or `--still <picture>`). `zaisma clip remove --game sky-hopper` removes it.
21
+
20
22
  For scripts, CI and AI tools: every command takes `--json` and prints the API's answer as-is, or its `{ "error": { code, message, field, fix, retry_after_sec } }`. Commands refuse flags and choices they don't take instead of ignoring them, and the exit code says how it went: `0` done (for upload: passed), `1` failed, `2` a wrong command line (nothing was sent), `3` held for a person to look at, `4` rejected, `5` still scanning, `6` the check found something to fix. `zaisma help --json` lists every command, flag and code.
21
23
 
22
24
  Found a bug in Zaisma, or missing something? Search the developer forum first with `zaisma forum --search "too_big"`. `zaisma forum post --kind bug --title "…" --category mcp --text "…"` starts a public topic, and `zaisma forum message …` sends Zaisma a private one (logs, an unreleased game). `zaisma forum` lists your topics and messages, `zaisma forum <topic_id>` shows one with its replies, and `zaisma forum reply <topic_id> --text "…"` replies (`--reopen` if a fixed one is back). Posts say an AI wrote them unless you add `--by-me`. Everything here uses the [developer API](https://github.com/zaisma/zaisma-sdk/blob/main/docs/DEVELOPER-API.md#the-upload-command).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zaisma/cli",
3
- "version": "0.69.0",
3
+ "version": "0.71.0",
4
4
  "description": "Upload and publish browser games on Zaisma from the command line.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://zaisma.com",
package/skill/SKILL.md CHANGED
@@ -33,7 +33,7 @@ The MCP also serves this skill and its references as resources (`zaisma://skill`
33
33
 
34
34
  **Ask the developer first** before making a game players can play private or a draft again (they lose access), and before ending a live room; those calls need `"confirm": true`. Anything that spends money (top-ups, budgets, Stripe) or deletes a game others played waits for the developer's passkey on zaisma.com: show them `confirm_url` from the `confirmation_needed` answer.
35
35
 
36
- **Show it well.** A listed game needs a cover and at least one gallery picture (`add_image`); the cover guide is at zaisma.com/developers/covers and the background guide at zaisma.com/developers/backgrounds. `preview_game_page` pictures every place players meet the game before anything is sent.
36
+ **Show it well.** A listed game needs a cover and at least one gallery picture (`add_image`); the cover guide is at zaisma.com/developers/covers and the background guide at zaisma.com/developers/backgrounds. `preview_game_page` pictures every place players meet the game before anything is sent. A clip (`add_clip`, up to 6 silent seconds of the game playing) makes every shared link play in iMessage, Discord and Telegram: record it on the bench's Record a clip (or `POST /bench/api/clips`), then `zaisma clip <file.mp4> --game <slug>`.
37
37
 
38
38
  ## Pick the path by the game
39
39
 
@@ -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), `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.
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_clip`, `remove_clip`, `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
 
@@ -165,6 +165,19 @@ The HTTP status goes with the code, as listed. The list lives in `ERROR_CODES` (
165
165
  | `background_not_ready` | 409 | The image or shader isn't this game's, isn't approved yet, or is for the other screen. |
166
166
  | `bad_color` | 400 | The color isn't #RRGGBB. |
167
167
 
168
+ **Clips**
169
+
170
+ | Code | HTTP | Meaning |
171
+ | --- | --- | --- |
172
+ | `not_a_clip` | 415 | A clip is one MP4 file, not fragmented, with one H.264 picture track. |
173
+ | `clip_has_sound` | 400 | A clip is silent, and this one has a sound track. |
174
+ | `clip_too_long` | 400 | A clip runs at most 6 seconds. |
175
+ | `clip_too_big` | 413 | A clip is at most 6 MB. |
176
+ | `bad_clip_dimensions` | 400 | A clip fits inside 1200 by 630 px, and is at least 600 by 315. |
177
+ | `bad_clip_still` | 400 | A clip comes with its still: its first frame, a PNG, JPEG or WebP the clip's size, up to 2 MB. |
178
+ | `clip_refused` | 422 | The clip can't be used. |
179
+ | `no_clip` | 404 | The game has no clip. |
180
+
168
181
  **Uploading versions**
169
182
 
170
183
  | Code | HTTP | Meaning |
@@ -671,7 +684,7 @@ Every call is checked before any of it runs, in this order: the key's access, wh
671
684
  | --- | --- |
672
685
  | `GET /games` | Your games, each with its `alerts` (see Alerts below), and `unread_topic_count`: how many of your forum topics Zaisma has replied to or changed since you last opened them. |
673
686
  | `POST /games` | Make a game: `{"title", "slug"?, "description"?, "glass_tint_color"?, "devices"?, "controls"?, "genres"?, "screen_orientation"?, "play_modes"?, "cloud_saves_enabled"?, "account_offer_enabled"?, "deleted_account_erase_enabled"?, "friend_joins_enabled"?, "performance_measuring_enabled"?, "microphone_enabled"?, "multiplayer_mode"?, "room_browsing"?, "account_requirement"?, "minimum_player_age_years"?, "game_server_allowed_hosts"?, "own_server_urls"?, "links"?, "link_out_url"?}`. It starts as a draft that only you can see. Publishing is never limited, but an account holds at most 50 games that no real players play; a game with players frees its slot. |
674
- | `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`. |
687
+ | `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`, `clip` (see Clips), `versions` (newest first, each with its `review_reason` and scan `findings`) and `testers`. |
675
688
  | `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`, `microphone_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`. |
676
689
 
677
690
  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`, `microphone_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`.
@@ -782,6 +795,7 @@ In the .zip:
782
795
  - `versions.json`: every version Zaisma keeps, with its patch notes, review status and findings, as `GET /games/:slug` answers them without the preview links; `folder_path` is where its files are, or `null` for a version that's still being scanned, held or rejected. Those carry no files, so nothing unscanned or held leaves through an export.
783
796
  - `versions/<version_id>/…`: each version's files, as they were uploaded.
784
797
  - `images/<kind>-<image_id>.png` (or `.jpg`, `.webp`): the cover, square cover and gallery pictures that passed review.
798
+ - `clip/clip.mp4` and `clip/still.jpg`: the clip its links play and its still, when it has one.
785
799
  - `shaders/<screen>-<shader_id>.glsl`: each shader that passed its check, with its buffer passes beside it as `<screen>-<shader_id>.buffer-a.glsl` to `.buffer-d.glsl`.
786
800
  - `database.sql`: the game database as SQLite's SQL dump, the same text `export_database` answers part by part. `zaisma export` also makes it `database.sqlite`, the file the Node runner takes as `--database-file`.
787
801
  - `saves.jsonl`: every player's cloud save, one JSON object a line, as `get_save` answers it (`player_id`, `sha256`, `size_bytes`, `saved_at`, `changed_by_kind`, `save_copy_count`, `version_id`, `local_storage_items`, `indexeddb_databases`). Earlier copies of saves stay out.
@@ -903,7 +917,7 @@ A player sits in one of your game's rooms at a time, as on Steam: joining anothe
903
917
 
904
918
  Games and servers get the same with no key at `GET https://rooms.zaisma.com/v1/players/<player_id>` (open to any site, up to 300 a minute per address, answers cacheable for 5 minutes), and in games with `Zaisma.player.getProfile(playerId)`. A player pass proves only who the player is: an account's carries no name, so your server looks the name up there (the Node game server does it for you). It also says how an account's chat reaches, never its age: `who_reads_my_chat` (`friends`, `my_age_band` or `everyone`: the player's own choice; `nobody` while their chat is stopped), `chat_reading_enabled` (whether they read others' chat), an opaque `chat_group_id` (`chat_group_…`, their age band's, different in every game: only `everyone` crosses it), `network_seal` (their network, sealed for Zaisma's witness rule alone and different in every pass) and `who_can_chat`, v1's setting, still sent as a stricter stand-in for servers that don't read `who_reads_my_chat`; and its friends and blocks as opaque tags, never their player IDs: `player_tag_id` (its own, different in every game), `friend_player_tag_ids` (its friends', up to 200) and `block_player_tag_ids` (accounts it has a block with, either way, up to 100). Your server asks `passesAreFriends(first, second)`, `passesHaveBlockBetween(first, second)` and `canChat(first, second)` from `@zaisma/game-server` with two checked passes, before passing chat between them. Inside games, `Zaisma.friends.list()` gives a signed-in player their friends playing this game, with their rooms, and `Zaisma.friends.sendRequest(playerId)` offers a friend request that Zaisma asks the player about first, answering `{ status }`: `sent`, `cancelled`, `already_friends` or `not_taking_requests` (see "Friends in your game" in the README). A game never sees a request; two players who become friends get each other's tags in their next passes.
905
919
 
906
- In games, `Zaisma.player.getPass()` gives this tab's player and their pass (`{ id, name, kind, pass, expiresAt }`) to send to your own server. `Zaisma.invite(room)` opens Zaisma's invite sheet on the game page (the room's QR code, link and code), or on your own site the share sheet or a copied link; it works only right after the player taps or presses a key in the game, so call it from that tap's handler, and it fails with `error.code` `"needs_player_tap"` otherwise. It answers `"opened"`, or `"failed"` when the page couldn't open it; on your own site `"shared"` from the share sheet, `"copied"` the link, `"cancelled"` the share sheet, or `"failed"` (`InviteStatus`; treat a value you don't know as `"failed"`). A game that shows its own player list reads its room's players and draws it, with `room.mute`, `room.unmute`, `room.block` and `room.report` behind its own buttons; the Zaisma overlay keeps its own list for every game, and no call opens it. On touch screens the Zaisma button stays in the top right corner over your game and takes presses there, so keep that corner free of your own buttons on phones and tablets. The reference is `packages/sdk/zaisma.d.ts`, served beside the SDK as `_zaisma/v1.d.ts`.
920
+ In games, `Zaisma.player.getPass()` gives this tab's player and their pass (`{ id, name, kind, pass, expiresAt }`) to send to your own server. `Zaisma.invite(room)` opens Zaisma's invite sheet on the game page (the room's QR code, link and code), or on your own site the share sheet or a copied link; it works only right after the player taps or presses a key in the game, so call it from that tap's handler, and it fails with `error.code` `"needs_player_tap"` otherwise. It answers `"opened"`, or `"failed"` when the page couldn't open it; on your own site `"shared"` from the share sheet, `"copied"` the link, `"cancelled"` the share sheet, or `"failed"` (`InviteStatus`; treat a value you don't know as `"failed"`). A game that shows its own player list reads its room's players and draws it, with `room.mute`, `room.unmute`, `room.block` and `room.report` behind its own buttons; the guide keeps its own list for every game, and no call opens it. On touch screens the Zaisma button stays in the top right corner over your game and takes presses there, so keep that corner free of your own buttons on phones and tablets. The reference is `packages/sdk/zaisma.d.ts`, served beside the SDK as `_zaisma/v1.d.ts`.
907
921
 
908
922
  ### Chat
909
923
 
@@ -1344,7 +1358,7 @@ On your own server, the Node runner runs the same hooks. It needs `ZAISMA_KEY` s
1344
1358
 
1345
1359
  ### When Zaisma covers your game
1346
1360
 
1347
- Zaisma puts nothing over a running game by default, but the player can open one of its sheets (buying, Players, Report), and a card can come over the game's corner (Still there?, Keep your progress). The SDK says when, so a game can pause or hold its input:
1361
+ Zaisma puts nothing over a running game by default, but the player can open the guide beside it (the Z in the corner, or Shift Tab) or one of its sheets (buying, Report), and a notice can come along the game's top edge (Still there?, Keep your progress). The SDK says when, so a game can pause or hold its input:
1348
1362
 
1349
1363
  - `Zaisma.page.coveredBy` is `"sheet"` while one of Zaisma's sheets is open over the game: the player is busy with it, so pausing makes sense. While a sheet is open, Still there? waits, since the player is there.
1350
1364
  - `"card"` while one of its cards is over the game's corner: the game stays in view and playable.
@@ -1359,6 +1373,24 @@ Zaisma.page.on("coveredBy", (coveredBy) => {
1359
1373
  });
1360
1374
  ```
1361
1375
 
1376
+ ### The game's two calls on Zaisma's page
1377
+
1378
+ A game owns everything inside itself, in its own look: its menus, its rooms and codes, muting and kicking. Two things it can hand to the guide beside it:
1379
+
1380
+ - `Zaisma.page.openPlayerCard(playerId)`: Zaisma's player card for a player in the room the game is in, on that player's press in your game (a Card button on a scoreboard). It shows who they are, how the player knows them, Add friend, and Mute, Block and Report side by side. Only a player in the game's room, and only right after the player's own press, as `Zaisma.invite` does; anything else does nothing.
1381
+ - `Zaisma.page.leave()`: ends play from your own menu, after your own confirm. The player lands on the game's page, where the guide's Leave lands.
1382
+
1383
+ Each answers a promise; off Zaisma's page (your own site, a local test without a page) each fails with `not_on_zaisma`, and `openPlayerCard` with `bad_player_id` for something that isn't a player's id.
1384
+
1385
+ ```js
1386
+ cardButton.onclick = () => Zaisma.page.openPlayerCard(player.id);
1387
+ quitConfirm.onclick = () => Zaisma.page.leave();
1388
+ ```
1389
+
1390
+ ### Zaisma's own sound
1391
+
1392
+ The player sets one volume and a mute for every game in the guide's Settings, and a volume of their own for voices (`room.voice`), kept on their account. Zaisma applies them to the game's audio itself, Web Audio and audio and video elements alike, on top of the game's own settings: a game needs to do nothing, and a game's own volume slider keeps working within Zaisma's.
1393
+
1362
1394
  ## Selling with the buy sheet
1363
1395
 
1364
1396
  Players buy a game's priced items through Zaisma's buy sheet. The developer connects their own Stripe account (Stripe Connect Standard): they are the seller, every sale is a direct charge on their account, the money goes to them, and Zaisma takes no fee. Stripe's own fees apply. The sheet and the receipt show the account's `business_name` and `support_email`. Until an account is connected and can take payments, the sheet answers `stripe_not_connected` or `stripe_cannot_take_payments`, and setting a price answers `next_steps` pointing at `get_stripe_account`.
@@ -1680,7 +1712,7 @@ Before a build reaches testers, try its online play on your own computer: `npx @
1680
1712
  | `background` | landscape, 1.3 to 2.4 times as wide as tall | 3840 by 2160 | 1600 wide |
1681
1713
  | `phone_background` | portrait, 1.6 to 2.4 times as tall as wide | 1440 by 3120 | 1600 tall |
1682
1714
 
1683
- The cover is your game's card everywhere players browse: we show it alone, with no title over or under it, so put your game's name or logo on it. A square cover is optional and as wide as it is tall. The gallery is yours: any picture of the game, made or captured, with or without words on it, held only for safety and fake rewards like every picture; a listed game has at least one. Tag a capture of the game as it plays a screenshot (`is_screenshot`), and the game page shows the tag; players can report a picture tagged Screenshot that isn't one, and an upheld report counts against the account's standing. A share picture is optional: wherever a link to your game or one of its rooms is shared (chats, social sites, search results), it unfolds into a card with your share picture, or your cover when there isn't one, the game's title and "Play now in your browser." (a room link says "Join my match in" the title and "Tap to join in your browser."). It's landscape: 1200 by 630 shows best, and the card fits it inside that size. PNG, JPEG or WebP, checked from the file itself; SVG and other types are refused. Up to 10 MB, each kind at least its size above and at most 8,192 px on a side, one cover, one square cover, one share picture and up to 8 gallery pictures. Zaisma keeps each approved picture at the widths pages ask for, up to 3840, never wider than it is. Each image's `review_status` is `pending` until it's checked, usually within a minute, then shows at `https://zaisma.com/img/:id`; a newly approved cover replaces the old one of its kind. Until then only you can see it. One that isn't approved is `rejected`, with its `review_reason`.
1715
+ The cover is your game's card everywhere players browse: we show it alone, with no title over or under it, so put your game's name or logo on it. A square cover is optional and as wide as it is tall: it's your game's picture wherever a game is shown small (a player's card in the guide, a search's games), where a wide cover's title can't be read; without one, the middle of your cover shows there. The gallery is yours: any picture of the game, made or captured, with or without words on it, held only for safety and fake rewards like every picture; a listed game has at least one. Tag a capture of the game as it plays a screenshot (`is_screenshot`), and the game page shows the tag; players can report a picture tagged Screenshot that isn't one, and an upheld report counts against the account's standing. A share picture is optional: wherever a link to your game or one of its rooms is shared (chats, social sites, search results), it unfolds into a card with your share picture, or your cover when there isn't one, the game's title and "Play now in your browser." (a room link says "Join my match in" the title and "Tap to join in your browser."). It's landscape: 1200 by 630 shows best, and the card fits it inside that size. PNG, JPEG or WebP, checked from the file itself; SVG and other types are refused. Up to 10 MB, each kind at least its size above and at most 8,192 px on a side, one cover, one square cover, one share picture and up to 8 gallery pictures. Zaisma keeps each approved picture at the widths pages ask for, up to 3840, never wider than it is. Each image's `review_status` is `pending` until it's checked, usually within a minute, then shows at `https://zaisma.com/img/:id`; a newly approved cover replaces the old one of its kind. Until then only you can see it. One that isn't approved is `rejected`, with its `review_reason`.
1684
1716
 
1685
1717
  **What's checked.** No AI reads a game's covers, gallery pictures, title or description. A picture is approved as soon as image matching has checked it for known abuse material (when matching can't answer, a person looks, usually within a day); new words apply at once. These are the lines covers and titles keep, checked against what's visibly there, never taste; players report one that breaks them, and a person at Zaisma decides:
1686
1718
 
@@ -1697,6 +1729,33 @@ curl -X POST "https://zaisma.com/api/dev/games/sky-hopper/images?kind=cover" \
1697
1729
  -H "Authorization: Bearer $ZAISMA_KEY" --data-binary @cover.png
1698
1730
  ```
1699
1731
 
1732
+ ## Clips
1733
+
1734
+ A clip is up to 6 seconds of your game, silent and looping, that every link to the game or one of its rooms unfolds into, playing, in the apps that play one (iMessage, Discord, Telegram). Every other app (WhatsApp, X, Slack, LinkedIn, Signal) shows its still, the clip's first frame, so an iPhone's picture turns into the clip without a jump. It's your art alone: Zaisma draws nothing on it, and the app prints the title ("Join my match in" the title for a room link) under it. Pick a moment that shows the game playing, never a loader or "click to start", and that loops well. Without a clip, links show the share picture, then the cover, then the first gallery picture; a game with no picture at all gets Zaisma's card with its title on it, which moves where apps play a clip.
1735
+
1736
+ | Call | What it does |
1737
+ | --- | --- |
1738
+ | `PUT /games/:slug/clip` | Send the clip: JSON `{ "clip_base64", "still_base64" }`, the MP4 and its first frame, each base64 (a `data:` URL prefix is fine), up to 11 MB together. Answers with the `clip` (`id`, `review_status`, `review_reason`, `width_px`, `height_px`, `duration_ms`, `size_bytes`, `clip_url`, `still_url`, `created_at`), a `review_message` and `next_steps`. |
1739
+ | `DELETE /games/:slug/clip` | Remove it, waiting or showing; answers `removed_clip_ids`. |
1740
+
1741
+ `GET /games/:slug` answers the game's `clip` beside its `images`, or `null`.
1742
+
1743
+ **What a clip is.** One MP4 file with one H.264 picture track (what every app that plays a link's video plays), no sound track (`clip_has_sound`), at most 6 seconds (`clip_too_long`), fitting inside 1200 by 630 px and at least 600 by 315 (`bad_clip_dimensions`), up to 6 MB (`clip_too_big`; about 3 MB is usual). Anything else is `not_a_clip`, a fragmented MP4 (as a browser's recorder saves one) included. Its still is a PNG, JPEG or WebP the same width and height as the clip, up to 2 MB (`bad_clip_still`); Zaisma keeps it as the share card's JPEG. Any video becomes a clip with:
1744
+
1745
+ ```bash
1746
+ ffmpeg -i in.mp4 -t 6 -an -vf "scale=1200:630:force_original_aspect_ratio=decrease:force_divisible_by=2" -c:v libx264 -pix_fmt yuv420p -movflags +faststart clip.mp4
1747
+ ```
1748
+
1749
+ **What's checked.** The same as a cover: image matching checks the clip's frames and its still for known abuse material and approves it at once (when matching can't answer, a person looks, usually within a day; a match is refused with `clip_refused`); it keeps the cover lines above, and players report one that breaks them. A newly approved clip replaces the old one. A game has one clip, swapped any time. Its size and its still's count toward the account's storage, and sending one passes the day's new-data limit (`storage_full`, `new_data_limit`), like any file; fetches of it are free. It's served at `https://zaisma.com/clips/<id>.mp4` and `/clips/<id>/still` once approved; before that only you can see it.
1750
+
1751
+ **Making one.** `npx @zaisma/cli play-locally`, then press Record a clip on the bench's bar at the moment you choose: it records the game's canvas as it plays, fits it inside the card, plays it back, and sends it to Zaisma with Send to Zaisma when the bench has your key, or says the command. Your AI records too: `POST /bench/api/clips` (the game server README's bench API). Any MP4, made any way, goes with `npx @zaisma/cli clip <file.mp4> --game <slug>`, which takes the still from the first frame in your computer's Chrome (or give `--still <picture>`).
1752
+
1753
+ ```bash
1754
+ curl -X PUT "https://zaisma.com/api/dev/games/sky-hopper/clip" \
1755
+ -H "Authorization: Bearer $ZAISMA_KEY" -H "Content-Type: application/json" \
1756
+ -d "{\"clip_base64\": \"$(base64 < clip.mp4)\", \"still_base64\": \"$(base64 < still.jpg)\"}"
1757
+ ```
1758
+
1700
1759
  ## Seeing it as players do
1701
1760
 
1702
1761
  Every place players meet a game can be seen before it's published or even sent: the game page, the home's cards, the game's link as a chat unfolds it, and the game while it plays, each on a laptop and a phone, drawn by the same code players get. The dashboard shows it live beside Details, Images and Background, from what's typed or picked before it's saved; your AI gets the same as pictures:
@@ -1840,7 +1899,7 @@ Files are stored once, by their SHA-256, and shared by every version that has th
1840
1899
  - Same rules as zips: `index.html` at the top, no hidden files, no pre-compressed `.gz` or `.br` files, only the file types games use. Up to 20,000 files per version and 500 MB per file, at any size per game: see Storage for what an account can keep. Up to 100 versions per game a day.
1841
1900
  - Each version is scanned. Image matching also checks the pictures stored inside engine packs (Godot `.pck`, `.glb`, `.data`, `.dat`, `.bin`, `.wasm`); one it can't read, like a GPU texture, isn't held for it. An update sends only new pictures and videos through image matching (one checked in the last 30 days isn't sent again), so it's checked in seconds however big the game is.
1842
1901
  - A version most of whose files another developer sent first (leaving out engines, libraries and asset packs many developers share) is held with `matches_another_developers_game` until a person looks, usually within a day; your own games never count. If it's your game on another account, or you have permission, say so with `message_zaisma`. When a person finds it's a re-upload, the original developer hears, with your username.
1843
- - One that passes waits as a draft with a private preview link for you and your AI, `https://zaisma.com/p/<secret>`, that works even while the game is a draft or private. Every call answers a fresh one, each working for a day (`preview_url_expires_at`); to show a version to anyone else, make a tester link. It opens the version inside the real game page, details first, then Play with the Zaisma overlay, as players will meet it; `https://zaisma.com/p/<secret>/game` opens the bare game alone, for quick test loops. Either way it plays at the game's fixed preview address, `https://<slug>--preview.zaismausercontent.com/`, so a game address never holds a key, and preview saves stay in that address's own browser storage, from one build to the next. A preview link doesn't join rooms: build and test multiplayer with `npx @zaisma/cli play-locally` (the same game server, SDK and game page, on your computer, with no review), and before release test it once on Zaisma's rooms through a tester link on a published version of the game while it's private (`add_tester_link` with `version_choice` `live`). That checks what only Zaisma's rooms have: the game server's CPU limits, real networks and regions, the chat filter, and rooms restarting under players.
1902
+ - One that passes waits as a draft with a private preview link for you and your AI, `https://zaisma.com/p/<secret>`, that works even while the game is a draft or private. Every call answers a fresh one, each working for a day (`preview_url_expires_at`); to show a version to anyone else, make a tester link. It opens the version inside the real game page, details first, then Play with the guide, as players will meet it; `https://zaisma.com/p/<secret>/game` opens the bare game alone, for quick test loops. Either way it plays at the game's fixed preview address, `https://<slug>--preview.zaismausercontent.com/`, so a game address never holds a key, and preview saves stay in that address's own browser storage, from one build to the next. A preview link doesn't join rooms: build and test multiplayer with `npx @zaisma/cli play-locally` (the same game server, SDK and game page, on your computer, with no review), and before release test it once on Zaisma's rooms through a tester link on a published version of the game while it's private (`add_tester_link` with `version_choice` `live`). That checks what only Zaisma's rooms have: the game server's CPU limits, real networks and regions, the chat filter, and rooms restarting under players.
1844
1903
  - A version can use only files you sent yourself: a file another developer sent counts as missing for you until you send it once too (storage still keeps one copy), so a file's hash neither gets someone else's file nor says whether Zaisma has it.
1845
1904
  - Publishing makes it the version players get. We keep the live version plus the last 5 that passed, for rolling back.
1846
1905
  - Drafts nobody publishes are deleted after 30 days, and files no version uses after a day. Held and rejected versions are kept.
@@ -1941,6 +2000,8 @@ The files a version needed before its first frame in its run in Chrome are prelo
1941
2000
  | `zaisma play-locally [folder] [--port <port>] [--game <slug>] [--on-network] [--no-open]` | Play the game on this computer with its game server and a test bench: each player on Zaisma's own game page, blocking and buying through it (Zaisma's buy sheet with a test card that's never charged), players made on this computer with an age band and social mode, their friends, blocks, items and refunds set in their details, and a dev bar to add or switch players; with no key and nothing sent, it runs `npx @zaisma/game-server@1 play-locally` | none |
1942
2001
  | `zaisma upload <folder> --game <slug> [--patch-notes "…"] [--publish-when-approved [--match-update-mode next_match\|now] [--big-update]]` | Check, fix what it can, upload a version, sending only new files, and wait for its scan | Uploading versions, above |
1943
2002
  | `zaisma shader <folder> --game <slug> --screen wide\|phone` | Send a shader's folder: each texture as an image of kind `shader_texture` (one the game has already, byte for byte, is used again), waited for until approved, then the shader | `POST /games/:slug/images?kind=shader_texture`, `POST /games/:slug/shaders` |
2003
+ | `zaisma clip <file> --game <slug> [--still <picture>]` | Send a clip: the MP4 and its first frame as the still, taken in this computer's Chrome unless `--still` gives it | `PUT /games/:slug/clip` |
2004
+ | `zaisma clip remove --game <slug>` | Remove the game's clip | `DELETE /games/:slug/clip` |
1944
2005
  | `zaisma versions <slug>` | The game and its versions, with preview links | `GET /games/:slug` |
1945
2006
  | `zaisma publish <slug> <version_id> [--scheduled-publish-at <time>] [--match-update-mode next_match\|now] [--big-update] [--patch-notes "…"]` | Publish, roll back, or publish later | `POST /games/:slug/versions/:id/publish` |
1946
2007
  | `zaisma unschedule <slug> <version_id>` | Cancel a publish-later | `DELETE /games/:slug/versions/:id/publish` |
@@ -2041,8 +2102,8 @@ Errors only the command answers with, beside the API's own codes (it also uses `
2041
2102
  | `unknown_shader_file` | A file in a shader's folder isn't one the command reads, or no channel in channels.json names it. |
2042
2103
  | `bad_channels_file` | A shader's channels.json isn't JSON, or isn't an object of the folder's passes, each a list of channels. |
2043
2104
  | `shader_texture_not_approved` | shader, check: a texture sent for the shader was rejected, or still waits for a person, so the shader wasn't sent. |
2044
- | `no_chrome` | check: there's no Chrome on this computer to draw the shader in, and no --game with ZAISMA_KEY to draw it on Zaisma. |
2045
- | `local_chrome_failed` | check: the Chrome on this computer couldn't draw the shader. |
2105
+ | `no_chrome` | check: there's no Chrome on this computer to draw the shader in, and no --game with ZAISMA_KEY to draw it on Zaisma; clip: none to take the still from the clip, and no --still. |
2106
+ | `local_chrome_failed` | check: the Chrome on this computer couldn't draw the shader; clip: it couldn't take the clip's first frame. |
2046
2107
  | `game_server_not_run` | play-locally: npx couldn't run @zaisma/game-server, which runs the game on this computer. |
2047
2108
  | `server_unreachable` | Zaisma couldn't be reached: no connection, or a wrong ZAISMA_API. |
2048
2109
  | `unexpected_answer` | Zaisma answered without JSON, like a page from a network in between. |
@@ -110,6 +110,17 @@ Every error the developer API and MCP answer with, as `{ "error": { code, messag
110
110
  - `background_not_ready` (HTTP 409): The image or shader isn't this game's, isn't approved yet, or is for the other screen. Fix: Wait until get_game shows the image or shader approved for this screen, then call set_background again. https://zaisma.com/developers/errors/background_not_ready
111
111
  - `bad_color` (HTTP 400): The color isn't #RRGGBB. Fix: Give the color as #RRGGBB, like #1A2B3C. https://zaisma.com/developers/errors/bad_color
112
112
 
113
+ ## Clips
114
+
115
+ - `not_a_clip` (HTTP 415): A clip is one MP4 file, not fragmented, with one H.264 picture track. Fix: Send an MP4 with one H.264 track, like the bench's Record a clip makes, or make one with ffmpeg (libx264, -movflags +faststart). https://zaisma.com/developers/errors/not_a_clip
116
+ - `clip_has_sound` (HTTP 400): A clip is silent, and this one has a sound track. Fix: Take the sound track out (ffmpeg's -an) and send it again. https://zaisma.com/developers/errors/clip_has_sound
117
+ - `clip_too_long` (HTTP 400): A clip runs at most 6 seconds. Fix: Cut it to at most 6 seconds that loop well (ffmpeg's -t 6) and send it again. https://zaisma.com/developers/errors/clip_too_long
118
+ - `clip_too_big` (HTTP 413): A clip is at most 6 MB. Fix: Save it at a lower bitrate (about 4 megabits a second) and send it again. https://zaisma.com/developers/errors/clip_too_big
119
+ - `bad_clip_dimensions` (HTTP 400): A clip fits inside 1200 by 630 px, and is at least 600 by 315. Fix: Scale it to fit inside 1200 by 630 px (ffmpeg's scale=1200:630:force_original_aspect_ratio=decrease) and send it again. https://zaisma.com/developers/errors/bad_clip_dimensions
120
+ - `bad_clip_still` (HTTP 400): A clip comes with its still: its first frame, a PNG, JPEG or WebP the clip's size, up to 2 MB. Fix: Send the clip's first frame as still_base64, the same size as the clip; the upload command's clip makes it for you. https://zaisma.com/developers/errors/bad_clip_still
121
+ - `clip_refused` (HTTP 422): The clip can't be used. Fix: Send a different clip. https://zaisma.com/developers/errors/clip_refused
122
+ - `no_clip` (HTTP 404): The game has no clip. Fix: Call get_game to see the game's clip; add_clip sends one. https://zaisma.com/developers/errors/no_clip
123
+
113
124
  ## Uploading versions
114
125
 
115
126
  - `bad_files` (HTTP 400): files isn't a list of files in the shape the call takes. Fix: Give files as a list of { path, content_base64 } or { path, size_bytes, sha256 }, as the call's input schema shows. https://zaisma.com/developers/errors/bad_files
@@ -115,6 +115,7 @@ Every ID Zaisma makes says its kind in its value: `<kind>_<random>`, the kind in
115
115
  | `game` | `game_…` |
116
116
  | `version` | `version_…` |
117
117
  | `image` | `image_…` |
118
+ | `clip` (a game's short silent loop its shared links play) | `clip_…` |
118
119
  | `shader` | `shader_…` |
119
120
  | `tester` | `tester_…` |
120
121
  | `topic` (known issues too) | `topic_…` |
@@ -150,6 +151,7 @@ Every ID Zaisma makes says its kind in its value: `<kind>_<random>`, the kind in
150
151
  | `ncmec_report` (a report to NCMEC's CyberTipline; never shown outside Zaisma) | `ncmec_report_…` |
151
152
  | `admin_change` (a change the admin's AI asked for, waiting for the admin's passkey tap; never shown outside Zaisma) | `admin_change_…` |
152
153
  | `inbox_notice` (a notice in an account's inbox: from Zaisma, or a game the account follows) | `inbox_notice_…` |
154
+ | `room_invite` (a friend's invite into the room they're in, waiting in the other's bell for a day) | `room_invite_…` |
153
155
 
154
156
  `ID_KINDS` (`packages/core/src/ids.ts`) is this list, and a test keeps the two in step; a new kind is added to both in the same change. Accounts' and guests' player IDs are both `player_…`, in their passes and everywhere the SDK and game server show them; an account's never changes, and Zaisma's own account ID (the sign-in's) never leaves Zaisma. The developer API and MCP still name a game by its `slug`, the link name developers know. Not IDs, and kept as they are: a `slug`, a `room_code` (six letters players type), API keys (`zsk_…`, a format secret scanners know), connected apps' access and refresh tokens (`zat_…`, `zrt_…`), webhook signing secrets (`whsec_…`, Standard Webhooks' form) and file hashes (`sha256`).
155
157
 
@@ -239,6 +241,7 @@ One name per concept. The API and MCP column is snake_case; the SDK and game ser
239
241
  | The Zaisma skill: the workflow and its references, for any AI, installed by the upload command | `zaisma skill` (the command); MCP resources `zaisma://skill`, `zaisma://sdk`, `zaisma://naming`, `zaisma://errors`, `zaisma://game-server`, `zaisma://developer-api`, `zaisma://multiplayer`, `zaisma://loading`, `zaisma://phones`, `zaisma://saves`; MCP prompts `make_game`, `publish_game`, `fix_problem` | |
240
242
  | How many accounts have a game in their favorites (Your games) now, never who | `favorite_count` | |
241
243
  | A cover or gallery picture | `image_id` | |
244
+ | A game's clip: up to 6 seconds of the game, silent and looping, that its shared links unfold into where an app plays one, and its still (the clip's first frame) everywhere else | `clip` on a game: `id`, `review_status`, `review_reason`, `width_px`, `height_px`, `duration_ms`, `size_bytes`, `clip_url`, `still_url`, `created_at`; inputs `clip_base64`, `still_base64`; tools `add_clip`, `remove_clip`; the upload command's `clip`; the bench's Record a clip and `POST /bench/api/clips` (`clip_file`, `still_file`); errors `not_a_clip`, `clip_has_sound`, `clip_too_long`, `clip_too_big`, `bad_clip_dimensions`, `bad_clip_still`, `clip_refused`, `no_clip`, `no_canvas`. Inside: `game_clips`, `CLIP_LIMITS` | `CLIP_LIMITS` |
242
245
  | A game's world behind Zaisma's glass, for one screen, and what it shows | `background`: `screen`, `source` (`zaisma`, `image`, `shader`, and on phone `wide`), `image_id`, `shader_id`, `still_url`; pictures are images of `kind` `background` and `phone_background` | |
243
246
  | Which screen a background is for | `screen`: `wide` (desktops and tablets), `phone` (composed for a tall screen); errors `bad_screen`, `bad_background_source`, `background_not_ready` | |
244
247
  | A small program that paints a background live | `shader_id`; a shader's `image` pass and `buffers`, `quality_checks`, `has_quality_levels`, `flash_count`, `still_url`, `frame_urls`, each pass's `source_url`, `buffer_count`, `texture_count`, `texture_image_ids`. Its source keeps Shadertoy's names on purpose (`mainImage`, `fragColor`, `fragCoord`, `iResolution`, `iTime`, `iTimeDelta`, `iFrame`, `iChannel0` to `iChannel3`, `iChannelResolution`), the form AI already writes, so nothing is left to guess; Zaisma's own inputs follow them (`iQuality`, `iGlassPanes`, `iGlassPaneCount`) | `SHADER_LIMITS`, `ShaderManifest` |
@@ -282,6 +285,7 @@ One name per concept. The API and MCP column is snake_case; the SDK and game ser
282
285
  | 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
286
  | 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
287
  | 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`; a game's `microphone_enabled` (off by default: only then may its frame use the microphone; `bad_microphone_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` |
288
+ | The guide: Zaisma's one panel about you on every page and beside every game, its places and the player card; Zaisma's own sound for every game; a friend's invite into a room | Zaisma's own code: `accounts.game_volume_pct`, `accounts.game_sound_enabled`, `accounts.voice_volume_pct` (`/guide/sound`), `room_invites` (`sender_account_id`, `recipient_account_id`, `sent_at_ms`, `shown_at_ms`; `/guide/invite`, its `server_url` for a room on the game's own server and its `invite_status`; error `bad_server_url`), the presence answer's `invites` (`sender_name`, `game_title`, `room_link_path`), the guide's inbox (`/guide/dismiss` with `inbox_notice_id`, its `inbox_notice_status` `archived`, error `no_inbox_notice`; `/guide/clear`, its `cleared_notice_count`), `GUIDE_PLACES`, `GUIDE_PAGES`, `zaismaGuide`, `zaismaSound` | `Zaisma.page.openPlayerCard(playerId)`, `Zaisma.page.leave()`; the page's messages `zaisma:open-player-card`, `zaisma:leave`, `zaisma:sound` (`gameVolumePct`, `isGameSoundOn`, `voiceVolumePct`) and `zaisma:sound-request` |
285
289
  | 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
290
  | 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
291
  | 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 |
@@ -422,7 +426,7 @@ One name per concept. The API and MCP column is snake_case; the SDK and game ser
422
426
  | A game database's use this month, and the most a game can keep | `database_use_this_month`: `read_row_count`, `written_row_count`, `storage_size_bytes`, `maximum_storage_size_bytes`; at it, `database_full` | `MAXIMUM_DATABASE_SIZE_BYTES`, `MAXIMUM_GAME_STORAGE_SIZE_BYTES` (Zaisma's own code); `database_full`, and `hosting_paused` an hour after the game's hosting paused |
423
427
  | A request from a game to its own game server outside any room, and what that answers | `request_count` (in a day's `game_server`) | `Zaisma.server.request(request, { serverUrl })` answers the `answer`; the game server's `onRequest(player, request, server)`, with `server.database`; sent to `POST /v1/requests/<slug>` as `{ pass, request }`, answered `{ answer }` |
424
428
  | A game server's schedules, and one run of one | `schedules` (in stats): `schedule_name`, `cron`, `version_id`, `next_run_at`, `last_run_at`; `scheduled_run_count` (in a day's `game_server`) | `schedules: [{ name, cron }]` (`Schedule`, up to `SCHEDULE_LIMITS.maximumScheduleCount`, cron in UTC); `onSchedule(run, server)` with `run.name`, `run.cron`, `run.scheduledAt` (`ScheduledRun`), and `server.database` |
425
- | A friend request a game offers, sent only once the player says yes on Zaisma's page, and who takes them | the social setting `who_can_send_friend_requests`: `nobody` (Invites only), `played_with` (People I play with: the same room now or within the last hour), `anyone`; in Zaisma's own code `friend_requests` (`sender_account_id`, `recipient_account_id`, `answer`: `accepted`, `turned_down`) and `room_visits` | `Zaisma.friends.sendRequest(playerId)` answers `{ status }`: `sent`, `cancelled`, `already_friends`, `not_taking_requests`; the room's `{ type: "friend_request", playerId }` from a game and `{ type: "friend_request" }` to the other player (look now, never who) |
429
+ | A friend request a game offers, sent only once the player says yes on Zaisma's page, and who takes them | the social setting `who_can_send_friend_requests`: `nobody` (Invites only), `played_with` (People I play with: the same room now or within the last hour), `anyone`; in Zaisma's own code `friend_requests` (`sender_account_id`, `recipient_account_id`, `answer`: `accepted`, `turned_down`; `taken_back_at_ms` when its sender took it back, `card_sent_at_ms` for one corner card a day per pair, `is_held` when it never reached its recipient) and `room_visits`; a waiting one's `can_show_card`; `takeBackFriendRequest` answers `{ status }`: `taken_back`, `friends` | `Zaisma.friends.sendRequest(playerId)` answers `{ status }`: `sent`, `cancelled`, `already_friends`, `not_taking_requests`; the room's `{ type: "friend_request", playerId }` from a game and `{ type: "friend_request" }` to the other player (look now, never who) |
426
430
  | A game played off its Zaisma page (exported, on another site, in a store), and its players on the developer's own server | | `Zaisma.setUpOffZaisma({ gameSlug, playerToken })` answers `{ isOffZaisma }` (refused with `bad_game_slug`, `bad_player_token`); `playerToken`, a player's proof from somewhere other than Zaisma (a Sign in with Zaisma ID token or the game's own token, up to 8 KB; `null` for a guest), sent in a hello or request in place of `pass` (`REQUEST_LIMITS.maximumPlayerTokenSizeBytes`); the player's `kind` `outside_zaisma`; `startServer`'s `identifyPlayer(playerToken, { origin })` answering `{ id, name }` or null (`IdentifyPlayer`, `OutsidePlayer`) and `outsideGuestsEnabled`; `signInWithZaismaPlayers({ signInAppIds, siteUrl, loadKeys, loadProfile })` and `guestPlayer()`; refused with `bad_player_token`; `checkChat`'s `null` passes. Inside: `OUTSIDE_PLAYER_LIMITS`, `OUTSIDE_ZAISMA_CHAT_SETTINGS`, `checkedOutsidePlayer`, `isPlayerToken`, `ChatMessage.hasOutsideReceiver` |
427
431
  | A game's own servers that players' browsers connect to, named in the game's menu and in the warning before play | `own_server_urls` (each `wss://` or `https://` and a host, like `wss://play.example.com`). Inside: `ownServerHostsOf`, `playsOnOwnServers`, the page's `has_own_servers`, `ownServerSheet`; `games.lists_held_at_ms` (a report holding such a game out of Zaisma's lists until a person decides) | `serverUrl` in `Zaisma.joinRoom` and `Zaisma.friends.setRoom` |
428
432
  | A new developer's listed game waiting for Zaisma's own lists (home, browsing, search) | `is_waiting_for_zaisma_lists` on a game, and where it stands, `zaisma_lists_wait`: `{ is_held_by_reports, progress }`, `progress` `{ live_duration_days, minimum_live_duration_days, counted_player_count, minimum_counted_player_count, quiet_duration_days, minimum_quiet_duration_days }`. Inside: `games.lists_opened_at_ms` (when they opened; they stay open), `LISTS_WAIT_LIMITS`, `listsWaitProgress`, `hasEarnedLists`, `owners.is_invited_developer` (let publish before the beta: established from the start) | |
@@ -236,7 +236,7 @@ const server: Server;
236
236
 
237
237
  ```ts
238
238
  /**
239
- * Invite friends. On Zaisma it opens Zaisma's invite sheet, the same as the Zaisma overlay's Share: the
239
+ * Invite friends. On Zaisma it opens Zaisma's invite sheet, the same as the guide's Share: the
240
240
  * room's QR code, link and code, Copy and the share sheet ("opened", or "failed" when the page couldn't
241
241
  * open it). On your own site it opens the share sheet on phones, otherwise copies the room's invite link
242
242
  * (the game's page without a room). Call it from a button in your game, like on a "waiting for players"
@@ -346,7 +346,7 @@ const versions: Versions;
346
346
  ```ts
347
347
  /**
348
348
  * Whether Zaisma's page covers the game right now, so a game can pause or hold the player's input while it does.
349
- * coveredBy is "sheet" while one of Zaisma's sheets is open over the game (buying, the Zaisma overlay, Report: the player is
349
+ * coveredBy is "sheet" while one of Zaisma's sheets is open over the game (buying, the guide, Report: the player is
350
350
  * busy with it), "card" while one of its cards is over the game's corner (Still there?, Keep your progress; the
351
351
  * game stays in view and playable), and null otherwise. Always null outside Zaisma's page (your own site, a
352
352
  * local test). Listen for "coveredBy" to hear each change.
@@ -761,10 +761,26 @@ interface ItemForSale {
761
761
  ### Page
762
762
 
763
763
  ```ts
764
- /** Whether Zaisma's page covers the game ({@link page}). */
764
+ /** Whether Zaisma's page covers the game ({@link page}), and the game's two calls on it. */
765
765
  interface Page {
766
766
  /** "sheet", "card" or null: what of Zaisma's is over the game now. Read-only. */
767
767
  readonly coveredBy: CoveredBy;
768
+ /**
769
+ * Opens Zaisma's player card for a player in the game's room, on that player's press in your game (a Card button on a scoreboard): who they are, how
770
+ * the player knows them, Add friend, Mute, Block and Report. Only a player in the room the game is in; the guide beside the game shows it. It opens
771
+ * only right after the player's own press, as Zaisma.invite does: called at any other time, nothing opens.
772
+ * Fails with error.code "bad_player_id" for something that isn't a player's id, and "not_on_zaisma" off Zaisma's page.
773
+ * @example
774
+ * cardButton.onclick = () => Zaisma.page.openPlayerCard(player.id);
775
+ */
776
+ openPlayerCard(playerId: string): Promise<void>;
777
+ /**
778
+ * Ends play from the game's own menu, after its own confirm: the player lands on the game's page, where the guide's Leave lands. Fails with
779
+ * error.code "not_on_zaisma" off Zaisma's page, where the game ends play its own way.
780
+ * @example
781
+ * quitConfirm.onclick = () => Zaisma.page.leave();
782
+ */
783
+ leave(): Promise<void>;
768
784
  /** Listen for "coveredBy": called with the new value each time it changes. A wrong name fails with error.code "unknown_event". */
769
785
  on(event: "coveredBy", listener: (coveredBy: CoveredBy) => void): Page;
770
786
  off(event: "coveredBy", listener: (coveredBy: CoveredBy) => void): Page;
package/zaisma.mjs CHANGED
@@ -152,8 +152,8 @@ const COMMAND_ERROR_CODES = {
152
152
  unknown_shader_file: "A file in a shader's folder isn't one the command reads, or no channel in channels.json names it.",
153
153
  bad_channels_file: "A shader's channels.json isn't JSON, or isn't an object of the folder's passes, each a list of channels.",
154
154
  shader_texture_not_approved: "shader, check: a texture sent for the shader was rejected, or still waits for a person, so the shader wasn't sent.",
155
- no_chrome: "check: there's no Chrome on this computer to draw the shader in, and no --game with ZAISMA_KEY to draw it on Zaisma.",
156
- local_chrome_failed: "check: the Chrome on this computer couldn't draw the shader.",
155
+ no_chrome: "check: there's no Chrome on this computer to draw the shader in, and no --game with ZAISMA_KEY to draw it on Zaisma; clip: none to take the still from the clip, and no --still.",
156
+ local_chrome_failed: "check: the Chrome on this computer couldn't draw the shader; clip: it couldn't take the clip's first frame.",
157
157
  game_server_not_run: "play-locally: npx couldn't run @zaisma/game-server, which runs the game on this computer.",
158
158
  server_unreachable: "Zaisma couldn't be reached: no connection, or a wrong ZAISMA_API.",
159
159
  unexpected_answer: "Zaisma answered without JSON, like a page from a network in between.",
@@ -218,6 +218,17 @@ const COMMANDS = {
218
218
  screen: { hasValue: true, isRequired: true, choices: SCREENS, about: "wide (desktops and tablets) or phone (composed for a tall screen)" },
219
219
  },
220
220
  },
221
+ clip: {
222
+ about:
223
+ "Send a game's clip: up to 6 seconds of it, silent and looping, that links to the game and its rooms unfold into, playing, in iMessage, Discord and Telegram, with its first frame everywhere else. " +
224
+ "An MP4 (H.264, no sound) fitting inside 1200 by 630, like play-locally's Record a clip makes; its still is taken from the first frame in the Chrome on this computer unless --still gives one",
225
+ arguments: [{ name: "file" }],
226
+ flags: {
227
+ game: { hasValue: true, isRequired: true, placeholder: "<slug>", about: "The game it's for" },
228
+ still: { hasValue: true, placeholder: "<picture>", about: "The clip's first frame as a PNG, JPEG or WebP the clip's size, when there's no Chrome here to take it" },
229
+ },
230
+ },
231
+ "clip remove": { about: "Remove a game's clip: its links go back to the share picture or cover", arguments: [], flags: { game: { hasValue: true, isRequired: true, placeholder: "<slug>", about: "The game" } } },
221
232
  versions: { about: "List a game's versions and preview links", arguments: [{ name: "slug" }], flags: {} },
222
233
  publish: {
223
234
  about: "Publish a version that passed, or roll back to an older one",
@@ -379,7 +390,7 @@ const COMMANDS = {
379
390
  help: { about: "This help; with --json, every command, flag, exit code and error code", arguments: [], flags: {} },
380
391
  };
381
392
  /** Commands with a second word, like zaisma forum post. */
382
- const SUBCOMMANDS = { links: ["set", "remove"], forum: ["post", "message", "reply"], database: ["query", "batch", "export", "import", "restore", "undo-restore"], saves: ["get", "change", "replace", "reset", "copies", "copy", "restore"], secrets: ["set", "delete"], items: ["set", "remove"], "kept-rooms": ["delete", "bring-back", "erase-now", "restore", "undo-restore", "restores", "restore-all", "restore-all-status", "undo-restore-all"] };
393
+ const SUBCOMMANDS = { clip: ["remove"], links: ["set", "remove"], forum: ["post", "message", "reply"], database: ["query", "batch", "export", "import", "restore", "undo-restore"], saves: ["get", "change", "replace", "reset", "copies", "copy", "restore"], secrets: ["set", "delete"], items: ["set", "remove"], "kept-rooms": ["delete", "bring-back", "erase-now", "restore", "undo-restore", "restores", "restore-all", "restore-all-status", "undo-restore-all"] };
383
394
  /** Flags every command takes. */
384
395
  const GLOBAL_FLAGS = {
385
396
  json: { hasValue: false, about: "Print the API's answer as JSON, as-is (on failure its { error }), and nothing else" },
@@ -922,6 +933,69 @@ async function drawInChrome(chromePath, manifest, textures, screen) {
922
933
  }
923
934
  }
924
935
 
936
+ /** zaisma clip <file> --game <slug> [--still <picture>], and zaisma clip remove --game <slug>. */
937
+ async function clip(command, values, flags) {
938
+ if (command === "clip remove") {
939
+ const answer = await api("DELETE", `/games/${flags.game}/clip`);
940
+ if (isJson) return printAnswer(answer);
941
+ console.log(`Removed ${flags.game}'s clip: its links show the share picture or cover again.\nPASS`);
942
+ return EXIT_CODES.done;
943
+ }
944
+ const clipBytes = await readFile(values.file).catch(() => refuse("not_a_file", { message: `${values.file} can't be read.`, field: "file", fix: "Give the clip's MP4 file, like the one play-locally's Record a clip saved." }));
945
+ let stillBytes;
946
+ if (flags.still) stillBytes = await readFile(flags.still).catch(() => refuse("not_a_file", { message: `${flags.still} can't be read.`, field: "still", fix: "Give the clip's first frame as a PNG, JPEG or WebP picture." }));
947
+ else {
948
+ const chromePath = findChrome([join(process.cwd(), ".wrangler/chrome"), join(process.cwd(), "chrome")]);
949
+ if (!chromePath) refuse("no_chrome", { message: "There's no Chrome on this computer to take the clip's first frame.", field: "still", fix: "Install Chrome (or set CHROME_PATH), or give the first frame with --still <picture>, like: ffmpeg -i clip.mp4 -frames:v 1 still.jpg" });
950
+ stillBytes = await firstFrameInChrome(chromePath, clipBytes);
951
+ }
952
+ const answer = await api("PUT", `/games/${flags.game}/clip`, { clip_base64: clipBytes.toString("base64"), still_base64: Buffer.from(stillBytes).toString("base64") });
953
+ if (isJson) return printAnswer(answer);
954
+ console.log(`${answer.review_message}\nThe clip: ${answer.clip.clip_url}\n${answer.clip.review_status === "approved" ? "PASS" : "WAITING"}`);
955
+ return EXIT_CODES.done;
956
+ }
957
+
958
+ /** A clip's first frame as a JPEG, decoded by the Chrome on this computer; nothing the page asks for leaves it. */
959
+ async function firstFrameInChrome(chromePath, clipBytes) {
960
+ const failed = (error) => refuse("local_chrome_failed", { message: `Chrome on this computer couldn't take the clip's first frame: ${error.message}`, field: "still", fix: "Make sure the clip is an H.264 MP4 (Chromium builds may lack H.264: set CHROME_PATH to Google Chrome), or give it with --still <picture>, like: ffmpeg -i clip.mp4 -frames:v 1 still.jpg" }, EXIT_CODES.failed);
961
+ let chrome;
962
+ try {
963
+ chrome = await openChrome(chromePath, "zaisma-clip-still-");
964
+ } catch (error) {
965
+ failed(error);
966
+ }
967
+ try {
968
+ const { targetId } = await chrome.send("Target.createTarget", { url: "about:blank" });
969
+ const { sessionId } = await chrome.send("Target.attachToTarget", { targetId, flatten: true });
970
+ const send = (method, parameters) => chrome.send(method, parameters, sessionId);
971
+ chrome.listen(sessionId, (method, parameters) => method === "Fetch.requestPaused" && send("Fetch.failRequest", { requestId: parameters.requestId, errorReason: "BlockedByClient" }).catch(() => {}));
972
+ await send("Fetch.enable", { patterns: [{ urlPattern: "http*" }] });
973
+ const { result: evaluated, exceptionDetails } = await send("Runtime.evaluate", {
974
+ expression: `(async () => {
975
+ const video = document.createElement("video");
976
+ video.muted = true; video.preload = "auto";
977
+ video.src = URL.createObjectURL(await (await fetch("data:video/mp4;base64,${clipBytes.toString("base64")}")).blob());
978
+ await new Promise((done, fail) => { video.onloadeddata = done; video.onerror = () => fail(new Error("it can't play this video")); });
979
+ video.currentTime = 0;
980
+ await new Promise((done) => (video.readyState >= 2 ? done() : (video.onseeked = done)));
981
+ const canvas = document.createElement("canvas");
982
+ canvas.width = video.videoWidth; canvas.height = video.videoHeight;
983
+ canvas.getContext("2d").drawImage(video, 0, 0);
984
+ return canvas.toDataURL("image/jpeg", 0.9).split(",")[1];
985
+ })()`,
986
+ awaitPromise: true,
987
+ returnByValue: true,
988
+ });
989
+ if (exceptionDetails) throw new Error(exceptionDetails.exception?.description?.split("\n")[0] ?? exceptionDetails.text);
990
+ return Buffer.from(evaluated.value, "base64");
991
+ } catch (error) {
992
+ if (error instanceof CommandError) throw error;
993
+ failed(error);
994
+ } finally {
995
+ await chrome.close();
996
+ }
997
+ }
998
+
925
999
  /** Draws the shader on Zaisma, as a check before sending (POST /games/:slug/shader-checks), after sending its textures; downloads its sheet. */
926
1000
  async function drawOnZaisma(slug, manifest, textures, screen) {
927
1001
  const textureImages = await sendTextures(slug, textures);
@@ -2251,6 +2325,7 @@ async function run({ command, values, flags, globalFlags, rest }) {
2251
2325
  return EXIT_CODES.done;
2252
2326
  }
2253
2327
  if (command === "check") return checkFolder(values, flags);
2328
+ if (command === "clip" || command === "clip remove") return clip(command, values, flags);
2254
2329
  if (command === "play-locally") return playLocally(values, flags);
2255
2330
  if (command === "export") return exportGame(values, flags);
2256
2331
  if (command === "upload") {