@xgamesfun/xcore 0.2.1 → 0.3.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.
@@ -82,7 +82,10 @@ export const NODE_REFUSED = Object.freeze([
82
82
  /**
83
83
  * env.GF, the platform binding (a Workers RPC service, entrypoint GameServices; locally ./gf-local.js). Every answer is
84
84
  * {ok: true, …} or {ok: false, code, why}; a refusal is an answer, never a throw.
85
- * verifyPlayer(token) → {ok, sub, wallet | null, x: {id, handle} | null, lvl, exp (unix s)}
85
+ * verifyPlayer(token) → {ok, sub, wallet | null, x: {id, handle} | null, lvl, exp (unix s),
86
+ * banned?: {kind: 'ban' | 'hide', until: ms | null} | null}
87
+ * (banned: the creator's ban on the player from the console; a token made
88
+ * before the ban still verifies, so a server refuses kind 'ban' itself)
86
89
  * saves.get(player, key = 'main') → {ok, value | null, updatedAt}
87
90
  * saves.put(player, key, value) → {ok, bytes} (a JSON value, 64 KB; 16 keys a player)
88
91
  * saves.delete(player, key) → {ok, deleted}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xgamesfun/xcore",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "xgames.fun from the command line: bring a web game you already made, check it as xgames.fun hosts it, give it a backend and a Solana economy, and publish it at a link anyone can play.",
5
5
  "keywords": [
6
6
  "game",
@@ -56,7 +56,7 @@
56
56
  "test": "node --test \"tests/**/*.test.mjs\""
57
57
  },
58
58
  "dependencies": {
59
- "@xgamesfun/solana": "0.25.0",
59
+ "@xgamesfun/solana": "0.25.1",
60
60
  "esbuild": "0.28.2",
61
61
  "playwright-core": "1.63.0"
62
62
  },
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: bring-your-own-game
3
- description: Help someone bring a web game they already made without this kit (plain HTML/JS, or a Vite, Next.js static export, Astro, SvelteKit, Nuxt, Create React App or Parcel project) to xgames.fun - adopt it, fix what does not fit the hosting (server-side rendering, paths from the root, CDN scripts and fonts, undeclared backend origins, secrets, size limits), check it with the page check, connect their own backend or a server/ Worker, add a loot economy, and publish it. Use when the person has an existing game folder or repository and wants web3, xgames.fun hosting, or the kit's checks for it; never rebuild such a game through the creation loop.
3
+ description: Help someone bring a web game they already made without this kit (plain HTML/JS, or a Vite, Next.js static export, Astro, SvelteKit, Nuxt, Create React App or Parcel project) to xgames.fun - adopt it, fix what does not fit the hosting (server-side rendering, paths from the root, CDN scripts and fonts, undeclared backend origins, secrets, size limits), check it with the page check, connect their own backend or a server/ Worker, add a loot economy, review what a cheater gets from it, and publish it. Use when the person has an existing game folder or repository and wants web3, xgames.fun hosting, or the kit's checks for it; never rebuild such a game through the creation loop.
4
4
  ---
5
5
 
6
6
  # Bring your own game
@@ -12,7 +12,7 @@ here is `@xgamesfun/xcore` (the `xcore` command: `npx -y @xgamesfun/xcore …`,
12
12
  @xgamesfun/xcore`; never a bare `npx xcore`, which is another package), which needs no kit; with the kit, its MCP tools
13
13
  (`gamesfun_adopt` and the rest, named below) do the same.
14
14
 
15
- The order: **adopt → fix the list → check → (backend) → (economy) → publish when they ask.**
15
+ The order: **adopt → fix the list → check → (backend) → (economy) → (review, when it pays) → publish when they ask → (review --live).**
16
16
 
17
17
  ## 1. Adopt
18
18
 
@@ -57,6 +57,17 @@ stays on their host as a backend (README, "A game with its own Node server"). Su
57
57
  Never edit their build tool's output by hand (it is made again on every build): change the source or the config.
58
58
  Adopt again after the fixes; the list should be empty.
59
59
 
60
+ **Full screen.** Most players meet a game in a post on X or on a phone, where it first shows in a small frame. When adopt
61
+ warns that the game has no way to go full screen, offer the person a button for it (their game, their call): a small
62
+ button in a corner of the first screen, big enough for a thumb, that calls `GamesFun.fullscreen()` from the click
63
+ (`gamesfun.js`, loaded by `xcore add signin`; Godot `await GamesFun.fullscreen()`; Unity `Screen.fullScreen`).
64
+ Pressed again it comes back. It answers `{on, how}`: on xgames.fun the page around the game goes full screen, or fills
65
+ the screen in an app's own browser (X's on a phone among them); on the game's own link the browser does; in a frame
66
+ that allows none (a post on X on a computer) the game opens in a tab of its own (`how: 'tab'`); an iPhone's Safari has
67
+ no full screen for a page (`how: 'none'`): there the button can hide, or say "Add to Home Screen".
68
+ `GamesFun.onFullscreen(on => …)` follows it (Esc, the browser's own controls). A game that goes full screen already
69
+ (its own button, or its engine's) needs nothing.
70
+
60
71
  ## 3. Check
61
72
 
62
73
  ```bash
@@ -139,8 +150,9 @@ out of `.dev.vars` or repeat it.
139
150
 
140
151
  Design it so a cheater gains little (docs/SERVER.md, "How much your server can check" and "Who gets paid"): never send
141
152
  the page a run's whole seed up front (reveal randomness as the run goes); give slack per second, not per request; one
142
- open run per player; pay only proven wallets (the page calls `gf.loot.link()` once; a wallet sign-in needs none);
143
- a wallet is free, so for rewards worth farming set `VOUCHERS.payOnly` to `'x'` and give every grant a `perDay` total.
153
+ open run per player; pay only proven wallets (the page calls `gf.loot.link()` once; a player whose xgames.fun account
154
+ has a wallet linked needs none); a wallet is free, so for rewards worth farming set `VOUCHERS.payOnly` to `'x'` (X only)
155
+ or `'account'` (X or Google; a Google account is easier to make) and give every grant a `perDay` total.
144
156
 
145
157
  A page alone can't prove a score or a win: anyone can change it in the console. A leaderboard that must be fair is
146
158
  one the server owns: `env.GF.scores.setup(board, {writer: 'server'})` refuses the page's submits to it (a pattern,
@@ -152,7 +164,35 @@ your server can check". A bounded result earns small capped amounts; entry fees
152
164
  replayed one. Without a server,
153
165
  offer what the player pays for or the chain decides (a shop, boxes, raffles, staking, perks), and say why.
154
166
 
155
- ## 6. Publish (only when they ask)
167
+ ## 6. Review (a game whose server pays results)
168
+
169
+ Before publishing a game that pays results, read it as a cheater would:
170
+
171
+ ```bash
172
+ xcore review <folder> # evidence/review-N/review.md and review.json; exits 1 on a high finding
173
+ xcore loot review # the economy's part alone (@xgamesfun/solana's xsolana_review)
174
+ ```
175
+
176
+ - **Fix every high finding** (a `PAY.check` that pays from the request alone, a route anyone can call, a seed in the
177
+ page, `.dev.vars` in git…), and run it again. Mediums are the person's to decide with you: say each one plainly.
178
+ - **Declare `trust` honestly** on every grant a voucher pays: `"decides"` (the server runs the game; the page sends
179
+ only inputs), `"replays"` (the server runs the page's inputs again) or `"bounds"` (the page plays and reports; the
180
+ server checks its clock, order and caps). It is what `PAY.check` really does, not what you hope it does: a server
181
+ that times a run the page simulated is `bounds`, whatever it is called. (The field needs the `@xgamesfun/solana`
182
+ that has `review`: 0.25.0's `xcore loot check` refuses it, so with that one leave it out and still tell the person
183
+ the level in words.)
184
+ - **Tell the person**, in plain words, from the end of `review.md`: for each paid route, the level it uses, what a
185
+ cheater gets (a bounded result pays a script that waits and reports, without playing; a decided one pays what a bot
186
+ that plays well wins), and what the stronger level would cost to build (replaying: a deterministic step and about
187
+ 3 ms of CPU a second played; deciding: the rules moved to the server, a request each step). Let them choose: a
188
+ smaller prize and tighter caps, or the stronger level. Never call a bounded result safe.
189
+
190
+ After publishing, `xcore review <folder> --live` asks the published game as a stranger (no sign-in, a forged one;
191
+ nothing it sends can spend or sign) and checks its voucher key and economy against the folder. Under `xcore dev`,
192
+ give its address: `--live http://127.0.0.1:<port>/game/`. `xcore publish` reminds you when the economy or `server/`
193
+ changed since the last review.
194
+
195
+ ## 7. Publish (only when they ask)
156
196
 
157
197
  ```bash
158
198
  xcore publish <folder> --check # the offline part: what goes up, what refuses it