@zaisma/cli 0.68.0 → 0.70.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 +2 -0
- package/package.json +1 -1
- package/skill/SKILL.md +1 -1
- package/skill/references/developer-api.md +54 -9
- package/skill/references/errors.md +12 -0
- package/skill/references/game-server.md +1 -1
- package/skill/references/naming.md +4 -2
- package/skill/references/sdk.md +2 -1
- package/zaisma.mjs +78 -3
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
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
|
|
|
@@ -104,6 +104,7 @@ The HTTP status goes with the code, as listed. The list lives in `ERROR_CODES` (
|
|
|
104
104
|
| `bad_deleted_account_erase_enabled` | 400 | deleted_account_erase_enabled isn't true or false. |
|
|
105
105
|
| `bad_friend_joins_enabled` | 400 | friend_joins_enabled isn't true or false. |
|
|
106
106
|
| `bad_performance_measuring_enabled` | 400 | performance_measuring_enabled isn't true or false. |
|
|
107
|
+
| `bad_microphone_enabled` | 400 | microphone_enabled isn't true or false. |
|
|
107
108
|
| `bad_room_browsing` | 400 | room_browsing isn't page, game or off. |
|
|
108
109
|
| `bad_multiplayer_mode` | 400 | multiplayer_mode isn't none, relay or own. |
|
|
109
110
|
| `bad_account_requirement` | 400 | account_requirement isn't none, multiplayer or whole_game. |
|
|
@@ -164,6 +165,19 @@ The HTTP status goes with the code, as listed. The list lives in `ERROR_CODES` (
|
|
|
164
165
|
| `background_not_ready` | 409 | The image or shader isn't this game's, isn't approved yet, or is for the other screen. |
|
|
165
166
|
| `bad_color` | 400 | The color isn't #RRGGBB. |
|
|
166
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
|
+
|
|
167
181
|
**Uploading versions**
|
|
168
182
|
|
|
169
183
|
| Code | HTTP | Meaning |
|
|
@@ -669,11 +683,11 @@ Every call is checked before any of it runs, in this order: the key's access, wh
|
|
|
669
683
|
| Call | What it does |
|
|
670
684
|
| --- | --- |
|
|
671
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. |
|
|
672
|
-
| `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"?, "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. |
|
|
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
|
-
| `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`. |
|
|
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. |
|
|
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`. |
|
|
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`. |
|
|
675
689
|
|
|
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`.
|
|
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`.
|
|
677
691
|
|
|
678
692
|
- **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
693
|
- **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.
|
|
@@ -689,6 +703,7 @@ A game looks like: `slug`, `page_url`, `can_change_slug`, `title`, `description`
|
|
|
689
703
|
- **room_browsing:** for games on Zaisma rooms (`multiplayer_mode` other than `none`), where open rooms are listed so players can join them: `page` (the default) on the game page and to the game through `Zaisma.rooms.list()`, `game` only to the game (for games with their own lobby or server browser), or `off`. Room codes and invite links work either way, and the game can hide single rooms itself (see Multiplayer in the README). Whatever the setting, every game's page and the home say how many are playing now once it's 3 or more, for every game and not only multiplayer ones (no names); `GET /games/:slug` gives you the exact number. Rooms on your own servers aren't listed or counted.
|
|
690
704
|
- **friend_joins_enabled:** `true` (the default) lets Join on zaisma.com (a friend's face on /friends, "Alex is playing" on the game page, a profile's Playing now) and `Zaisma.friends.list()` take a player into the room their friend is in, for any game with rooms (Zaisma rooms, or its own servers through `Zaisma.friends.setRoom`). `false` grays Join as "This game doesn't take joins". One room turns it off instead, shown as "Private room": `Zaisma.joinRoom({ friendJoinsEnabled: false })` from the player who makes it, or `room.setFriendJoinsEnabled(false)` (the game server's, or the host's with the relay). It isn't a lock: a room's code or link still reaches it, so close the room (`setOpen(false)`) or answer `false` from `canJoin` to keep players out.
|
|
691
705
|
- **performance_measuring_enabled:** `true` (the default) has Zaisma measure how the game runs on players' devices, for `performance` in the stats (Play stats, below). `false` stops Zaisma adding its measuring script to the game's pages at all, and the stats answer `performance: null`.
|
|
706
|
+
- **microphone_enabled:** `false` (the default) means the game is never allowed the microphone. `true` lets it ask players for it, for voice chat in rooms (`room.voice`) or a game played by voice. Browsers keep a player's yes for zaisma.com, not for one game, so where the browser already keeps one from another game, the game page asks the player once for this game before it plays (on that device); Not now plays without the microphone.
|
|
692
707
|
- **account_requirement:** what the game needs a Zaisma account for. `none` (the default): guests play everything, and signed-in players play as their account. `multiplayer`: guests play alone; only signed-in players get player passes, so a guest's `Zaisma.player.getPass()` and `Zaisma.joinRoom()` fail with `error.code` `"account_needed"` (show your own message, or ask them to sign in without leaving the game with `Zaisma.player.signIn()`), and room links ask guests to sign in first. That's part of v1: a guest never gets a pass in such a game. `whole_game`: the game page says "Needs a Zaisma account" and Play asks guests to sign in first; only signed-in players get player passes. Passes are the backstop: Zaisma rooms also turn away guest passes given before the change, and your own servers can check a pass's `kind` claim for the same. Players under 13 can't make accounts, so they can't play games that need one.
|
|
693
708
|
- **minimum_player_age_years:** the youngest age that can play, even when the game's content suits everyone. `13` (the default): everyone, guests included as `account_requirement` allows. `16` or `18`: only accounts that old; younger accounts don't find the game on Zaisma (home, More games, friends' Playing now, profiles), and a link to it says "This game isn't open to your account." Only accounts have an age, so above 13 the game needs an account for the whole game: giving `16` or `18` alone sets `account_requirement` to `whole_game` too, and any other `account_requirement` while it's above 13 is refused with `accounts_needed_for_minimum_age` (set it back to `13` first; that leaves `account_requirement` as it is). Zaisma enforces it: Play, player passes, the relay and requests to your game server turn away younger accounts with `game_not_open_to_player`, and Zaisma rooms remove ones already playing when you raise it. Tester links follow it (testers then need an account); your own previews don't. Neither your game nor your own servers ever learn a player's age: a pass never carries it, and a younger account never gets one. Lifelike gore needs `16` or `18`: see "Allowed, even where other platforms ban it" under the content rules.
|
|
694
709
|
- **game_server_allowed_hosts:** the hosts the game's own game server can call with plain `fetch()` (game server reach): your own server, a payment provider, Discord, GitHub. Up to 20 host names, like `["discord.com", "api.github.com"]`, or `"*.example.com"` for every name under example.com (not example.com itself); `[]` (the default) for none, and the whole list each time. No `https://`, paths or ports: every call is https, never to an IP address, this computer or Zaisma's own domains. Live within a minute, with no approval by Zaisma, and kept in the game's history; players don't see it (the game page names only servers their browser connects to). Calls send up to 5 MB, get 10 seconds, aren't redirected (a redirect comes back to your code), and a game makes up to about 600 a minute in each place. A call to anything else throws an `OutsideCallError` in the game server, with a `code` (`not_https`, `unreachable_host`, `host_not_allowed`, `outside_call_limit`, `too_big`, `outside_call_timeout` or `outside_call_failed`) and a `fix`; the stats' `game_server_errors` show it. Raw sockets (`connect()` from `cloudflare:sockets`, `node:net` and `node:tls`) aren't offered: opening one throws. The game server reaches the game's database, receipts and rooms through `room` and `server` while a handler runs, and `env` from `cloudflare:workers` is empty. The tokens it needs go in its secrets (below).
|
|
@@ -780,6 +795,7 @@ In the .zip:
|
|
|
780
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.
|
|
781
796
|
- `versions/<version_id>/…`: each version's files, as they were uploaded.
|
|
782
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.
|
|
783
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`.
|
|
784
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`.
|
|
785
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.
|
|
@@ -958,7 +974,7 @@ Players talk to each other in a room with `room.voice`, through Cloudflare's med
|
|
|
958
974
|
|
|
959
975
|
- **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
976
|
- **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.
|
|
977
|
+
- **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 (the game needs `microphone_enabled` on), 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
978
|
- **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
979
|
- **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
980
|
- **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.
|
|
@@ -1134,7 +1150,7 @@ A room answers a refusal with `{ type: "error", code, message }`, then closes th
|
|
|
1134
1150
|
| `chat_too_long` | `room.chat` over 2000 characters. |
|
|
1135
1151
|
| `chat_too_fast` | More than 20 chat messages in 10 seconds from one player. |
|
|
1136
1152
|
| `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). |
|
|
1153
|
+
| `microphone_refused` | The SDK's own: `room.voice.join` couldn't use the microphone (the player or the browser said no, or the game's `microphone_enabled` is off). |
|
|
1138
1154
|
| `voice_not_allowed` | `room.voice.join` from a guest or a spectator. |
|
|
1139
1155
|
| `voice_unavailable` | Voice couldn't start or connect: try again. |
|
|
1140
1156
|
| `voice_ticket_required` | `room.voice.join` in a room on your own server without a ticket from that server. |
|
|
@@ -1695,6 +1711,33 @@ curl -X POST "https://zaisma.com/api/dev/games/sky-hopper/images?kind=cover" \
|
|
|
1695
1711
|
-H "Authorization: Bearer $ZAISMA_KEY" --data-binary @cover.png
|
|
1696
1712
|
```
|
|
1697
1713
|
|
|
1714
|
+
## Clips
|
|
1715
|
+
|
|
1716
|
+
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.
|
|
1717
|
+
|
|
1718
|
+
| Call | What it does |
|
|
1719
|
+
| --- | --- |
|
|
1720
|
+
| `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`. |
|
|
1721
|
+
| `DELETE /games/:slug/clip` | Remove it, waiting or showing; answers `removed_clip_ids`. |
|
|
1722
|
+
|
|
1723
|
+
`GET /games/:slug` answers the game's `clip` beside its `images`, or `null`.
|
|
1724
|
+
|
|
1725
|
+
**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:
|
|
1726
|
+
|
|
1727
|
+
```bash
|
|
1728
|
+
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
|
|
1729
|
+
```
|
|
1730
|
+
|
|
1731
|
+
**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.
|
|
1732
|
+
|
|
1733
|
+
**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>`).
|
|
1734
|
+
|
|
1735
|
+
```bash
|
|
1736
|
+
curl -X PUT "https://zaisma.com/api/dev/games/sky-hopper/clip" \
|
|
1737
|
+
-H "Authorization: Bearer $ZAISMA_KEY" -H "Content-Type: application/json" \
|
|
1738
|
+
-d "{\"clip_base64\": \"$(base64 < clip.mp4)\", \"still_base64\": \"$(base64 < still.jpg)\"}"
|
|
1739
|
+
```
|
|
1740
|
+
|
|
1698
1741
|
## Seeing it as players do
|
|
1699
1742
|
|
|
1700
1743
|
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:
|
|
@@ -1939,6 +1982,8 @@ The files a version needed before its first frame in its run in Chrome are prelo
|
|
|
1939
1982
|
| `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 |
|
|
1940
1983
|
| `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 |
|
|
1941
1984
|
| `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` |
|
|
1985
|
+
| `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` |
|
|
1986
|
+
| `zaisma clip remove --game <slug>` | Remove the game's clip | `DELETE /games/:slug/clip` |
|
|
1942
1987
|
| `zaisma versions <slug>` | The game and its versions, with preview links | `GET /games/:slug` |
|
|
1943
1988
|
| `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` |
|
|
1944
1989
|
| `zaisma unschedule <slug> <version_id>` | Cancel a publish-later | `DELETE /games/:slug/versions/:id/publish` |
|
|
@@ -2039,8 +2084,8 @@ Errors only the command answers with, beside the API's own codes (it also uses `
|
|
|
2039
2084
|
| `unknown_shader_file` | A file in a shader's folder isn't one the command reads, or no channel in channels.json names it. |
|
|
2040
2085
|
| `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. |
|
|
2041
2086
|
| `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. |
|
|
2042
|
-
| `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. |
|
|
2043
|
-
| `local_chrome_failed` | check: the Chrome on this computer couldn't draw the shader. |
|
|
2087
|
+
| `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. |
|
|
2088
|
+
| `local_chrome_failed` | check: the Chrome on this computer couldn't draw the shader; clip: it couldn't take the clip's first frame. |
|
|
2044
2089
|
| `game_server_not_run` | play-locally: npx couldn't run @zaisma/game-server, which runs the game on this computer. |
|
|
2045
2090
|
| `server_unreachable` | Zaisma couldn't be reached: no connection, or a wrong ZAISMA_API. |
|
|
2046
2091
|
| `unexpected_answer` | Zaisma answered without JSON, like a page from a network in between. |
|
|
@@ -53,6 +53,7 @@ Every error the developer API and MCP answer with, as `{ "error": { code, messag
|
|
|
53
53
|
- `bad_deleted_account_erase_enabled` (HTTP 400): deleted_account_erase_enabled isn't true or false. Fix: Give deleted_account_erase_enabled as true or false. https://zaisma.com/developers/errors/bad_deleted_account_erase_enabled
|
|
54
54
|
- `bad_friend_joins_enabled` (HTTP 400): friend_joins_enabled isn't true or false. Fix: Give friend_joins_enabled as true or false. https://zaisma.com/developers/errors/bad_friend_joins_enabled
|
|
55
55
|
- `bad_performance_measuring_enabled` (HTTP 400): performance_measuring_enabled isn't true or false. Fix: Give performance_measuring_enabled as true or false. https://zaisma.com/developers/errors/bad_performance_measuring_enabled
|
|
56
|
+
- `bad_microphone_enabled` (HTTP 400): microphone_enabled isn't true or false. Fix: Give microphone_enabled as true or false. https://zaisma.com/developers/errors/bad_microphone_enabled
|
|
56
57
|
- `bad_room_browsing` (HTTP 400): room_browsing isn't page, game or off. Fix: Give room_browsing as page, game or off. https://zaisma.com/developers/errors/bad_room_browsing
|
|
57
58
|
- `bad_multiplayer_mode` (HTTP 400): multiplayer_mode isn't none, relay or own. Fix: Give multiplayer_mode as none, relay or own. https://zaisma.com/developers/errors/bad_multiplayer_mode
|
|
58
59
|
- `bad_account_requirement` (HTTP 400): account_requirement isn't none, multiplayer or whole_game. Fix: Give account_requirement as none, multiplayer or whole_game. https://zaisma.com/developers/errors/bad_account_requirement
|
|
@@ -109,6 +110,17 @@ Every error the developer API and MCP answer with, as `{ "error": { code, messag
|
|
|
109
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
|
|
110
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
|
|
111
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
|
+
|
|
112
124
|
## Uploading versions
|
|
113
125
|
|
|
114
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
|
|
@@ -558,7 +558,7 @@ A room answers a refusal with `{ type: "error", code, message }`, then closes th
|
|
|
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
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). |
|
|
561
|
+
| `microphone_refused` | The SDK's own: `room.voice.join` couldn't use the microphone (the player or the browser said no, or the game's `microphone_enabled` is off). |
|
|
562
562
|
| `voice_not_allowed` | `room.voice.join` from a guest or a spectator. |
|
|
563
563
|
| `voice_unavailable` | Voice couldn't start or connect: try again. |
|
|
564
564
|
| `voice_ticket_required` | `room.voice.join` in a room on your own server without a ticket from that server. |
|
|
@@ -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_…` |
|
|
@@ -239,6 +240,7 @@ One name per concept. The API and MCP column is snake_case; the SDK and game ser
|
|
|
239
240
|
| 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
241
|
| How many accounts have a game in their favorites (Your games) now, never who | `favorite_count` | |
|
|
241
242
|
| A cover or gallery picture | `image_id` | |
|
|
243
|
+
| 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
244
|
| 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
245
|
| 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
246
|
| 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` |
|
|
@@ -281,7 +283,7 @@ One name per concept. The API and MCP column is snake_case; the SDK and game ser
|
|
|
281
283
|
| 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
284
|
| 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
285
|
| 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` |
|
|
286
|
+
| 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` |
|
|
285
287
|
| 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
288
|
| 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
289
|
| 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 +424,7 @@ One name per concept. The API and MCP column is snake_case; the SDK and game ser
|
|
|
422
424
|
| 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
425
|
| 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
426
|
| 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) |
|
|
427
|
+
| 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
428
|
| 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
429
|
| 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
430
|
| 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) | |
|
package/skill/references/sdk.md
CHANGED
|
@@ -1741,7 +1741,8 @@ interface VoiceOptions {
|
|
|
1741
1741
|
interface RoomVoice {
|
|
1742
1742
|
/**
|
|
1743
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
|
|
1744
|
+
* listen. Resolves once connected; rejects with microphone_refused (the player or browser said no, or the game's microphone_enabled
|
|
1745
|
+
* setting is off), voice_not_allowed
|
|
1745
1746
|
* (a guest or a spectator), voice_unavailable or hosting_paused. Call it from a tap or key press: browsers play
|
|
1746
1747
|
* sound only after one.
|
|
1747
1748
|
*/
|
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") {
|