@vibechain/os 0.5.2 → 0.6.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/AGENTS.md +39 -7
- package/README.md +87 -17
- package/SECURITY.md +3 -3
- package/dist/app-host.d.ts +62 -3
- package/dist/app-host.js +82 -4
- package/dist/app-wire.d.ts +186 -6
- package/dist/app-wire.js +213 -7
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +1 -1
- package/dist/bundle.js +3 -3
- package/dist/check.js +11 -4
- package/dist/fake-services.d.ts +88 -0
- package/dist/fake-services.js +132 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/links.d.ts +8 -1
- package/dist/links.js +17 -3
- package/dist/listing.d.ts +12 -0
- package/dist/listing.js +49 -1
- package/dist/manifest.d.ts +76 -1
- package/dist/manifest.js +170 -5
- package/dist/os.d.ts +65 -5
- package/dist/os.js +150 -11
- package/dist/preview-parent.d.ts +21 -2
- package/dist/preview-parent.js +87 -7
- package/dist/preview-surfaces.d.ts +36 -0
- package/dist/preview-surfaces.js +84 -0
- package/dist/preview-ui.js +1 -1
- package/dist/preview.js +4 -2
- package/dist/testing.d.ts +41 -6
- package/dist/testing.js +111 -8
- package/dist/transport.d.ts +4 -1
- package/dist/transport.js +2 -2
- package/dist/vibemarket-os.js +1 -1
- package/examples/paw-beat/README.md +14 -5
- package/examples/paw-beat/cat.ts +13 -0
- package/examples/paw-beat/game.ts +11 -1
- package/examples/paw-beat/index.html +2 -0
- package/examples/paw-beat/main.ts +62 -11
- package/examples/paw-beat/vibemarket.json +15 -8
- package/package.json +1 -1
- package/skill.md +86 -14
package/AGENTS.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# VibeStore app author contract — @vibechain/os 0.
|
|
1
|
+
# VibeStore app author contract — @vibechain/os 0.6.0
|
|
2
2
|
|
|
3
3
|
This is the contract for people and agents building apps for VibeStore, the app
|
|
4
4
|
store inside VibeMarket OS. Read it with [README.md](README.md) (API, helpers and
|
|
@@ -19,7 +19,7 @@ declares in `network` (below).
|
|
|
19
19
|
## Start
|
|
20
20
|
|
|
21
21
|
```sh
|
|
22
|
-
npx --yes @vibechain/os@0.
|
|
22
|
+
npx --yes @vibechain/os@0.6.0 init my-app # TypeScript + canvas; or --template three, or --template plain
|
|
23
23
|
cd my-app
|
|
24
24
|
npm install
|
|
25
25
|
npm run build
|
|
@@ -45,12 +45,15 @@ os.onPause(() => { void os.save(state); }); // pause, resume and resize
|
|
|
45
45
|
await os.ready(); // remove the host's loading state (or os.progress(0.5) while loading)
|
|
46
46
|
const cards = await os.cards(); // if the manifest declares cards
|
|
47
47
|
const me = await os.player(); // { guest: false, handle, username?, name, picture } or { guest: true }; plus token with network
|
|
48
|
-
await os.finish({ score: 42 });
|
|
48
|
+
await os.finish({ score: 42 }); // also posts to the board "score" (or { score, board })
|
|
49
|
+
await os.unlock("first-win"); // an achievement the manifest declares; vmOS shows the toast
|
|
50
|
+
const receipt = await os.buy("gold-frame"); // from a click: vmOS's own spend dialog, Printer Cash burned
|
|
49
51
|
```
|
|
50
52
|
|
|
51
53
|
Every rejection is an `OsError` with a stable `code` (`unsupported`,
|
|
52
54
|
`not-permitted`, `invalid`, `too-large`, `rate-limited`, `needs-click`,
|
|
53
|
-
`unavailable`, `timeout`, `closed
|
|
55
|
+
`unavailable`, `timeout`, `closed`, and since 0.6 `cancelled`, `insufficient`,
|
|
56
|
+
`limit`, `guest`); refusals keep the app running. `game.finish`
|
|
54
57
|
takes one integer score from 0 to 1,000,000,000, once per open window; the host
|
|
55
58
|
owns the results screen. The score is display data: it never sets a reward. A finished round of an approved app may earn the player a small amount of Printer Cash, decided and paid by VibeMarket OS within per-player daily caps. The app cannot grant, see or influence the amount, and nothing an app sends is trusted for it. Saves are coalesced (one
|
|
56
59
|
write per 10 seconds) and kept on the server, except a guest's, which last only
|
|
@@ -65,6 +68,25 @@ and `SharedArrayBuffer` do not. `os.fullscreen()` asks the host after a click.
|
|
|
65
68
|
The optional `os.onCapture?.(() => canvasOrDataUrl)` customises the picture the desktop camera takes of your app (by default the SDK sends the largest visible canvas, so canvas and WebGL games need nothing; apps built with an older SDK show a placeholder in desktop photos). Optional helpers: `@vibechain/os/loop`, `@vibechain/os/canvas` and
|
|
66
69
|
`@vibechain/os/testing` (`createFakeOs`, an in-memory host for unit tests).
|
|
67
70
|
|
|
71
|
+
**Leaderboards, achievements, friends, invites, sharing and spending (0.6).**
|
|
72
|
+
`os.leaderboard()` reads a board and `os.showLeaderboard()` opens vmOS's panel;
|
|
73
|
+
`os.unlock(id)` and `os.achievements()` (achievements pay nothing);
|
|
74
|
+
`os.friends()` (only friends who have the app); `os.invite()` and `os.share()`
|
|
75
|
+
open vmOS's sheets, and `os.launch.invite` or `os.onInvite` carries a friend's
|
|
76
|
+
invite and its `data`; `os.products()`, `os.buy(id)`, `os.purchases()`,
|
|
77
|
+
`os.consume(id)` and `os.receiptToken(id)` (network apps) sell the products the
|
|
78
|
+
manifest declares for Printer Cash, which is burned, never paid to the
|
|
79
|
+
developer. Buying, sharing and inviting need the app in front, a click (for
|
|
80
|
+
`buy` within the last second) and the player's confirmation in a surface vmOS
|
|
81
|
+
draws itself; guests get `guest`. Scores are the app's claims, accepted only in
|
|
82
|
+
a server-timed round. Spending and invite limits exist; their values are not
|
|
83
|
+
published. On an older host each of these answers `unsupported`: hide the
|
|
84
|
+
feature. Product rules: a product delivers what its name and description say,
|
|
85
|
+
inside the app; it is never, and never stands for, money, Nuggets, Steam items,
|
|
86
|
+
cards, packs or anything usable outside the app; a chance-based product shows
|
|
87
|
+
its odds before the dialog can open; nothing the screenshots show may need a
|
|
88
|
+
purchase; prices change only in a new reviewed version.
|
|
89
|
+
|
|
68
90
|
**Sound belongs to the desktop.** Follow `os.sound` (`{ muted, volume }`) and
|
|
69
91
|
`os.onSound`: silent while muted, scaled by the volume, live. A sandboxed frame
|
|
70
92
|
cannot be muted from outside, so review checks that the app follows it. Use
|
|
@@ -78,14 +100,15 @@ desktop is muted.
|
|
|
78
100
|
|
|
79
101
|
An app learns who is playing (their public handle, @name, display name and
|
|
80
102
|
picture, the same in every app; there is no anonymous id) but has no access to
|
|
81
|
-
the player's account, session, Steam ID or balance; no wallets,
|
|
82
|
-
|
|
103
|
+
the player's account, session, Steam ID or balance; no wallets, trades, Cash,
|
|
104
|
+
Nuggets, XP or rewards, and no purchases but its own declared products bought
|
|
105
|
+
through `os.buy`;
|
|
83
106
|
no vibechain.com APIs; no undeclared servers; no Classic `/market` holdings; and
|
|
84
107
|
no access to the desktop page, other apps, Steam commands or native IPC. Card
|
|
85
108
|
holdings are visible only as the manifest declares (`cards`), and the signed
|
|
86
109
|
player token only with `network`; whatever the app sends its servers is tied to
|
|
87
110
|
the player's public identity. A network app may not embed third-party advertising
|
|
88
|
-
or analytics SDKs, take payments, or ask players to sign in; what its server
|
|
111
|
+
or analytics SDKs, take payments (other than `os.buy`), or ask players to sign in; what its server
|
|
89
112
|
sends after review is still bound by the listing rules. Never ask players to type
|
|
90
113
|
secrets into your app.
|
|
91
114
|
|
|
@@ -113,6 +136,15 @@ version 3 (and version 2 unchanged), with unknown fields refused at every level:
|
|
|
113
136
|
only after its creator approves.
|
|
114
137
|
- `cards` (optional): `none`, `linked` (needs `packs`) or `all` (every vmOS
|
|
115
138
|
pack the player holds).
|
|
139
|
+
- `leaderboards` (optional, 0.6): up to 5 `{ id, name, order?, format? }`;
|
|
140
|
+
`order` `high` or `low`, `format` `number` or `time` (milliseconds). The
|
|
141
|
+
board `score` exists anyway. `achievements` (optional): up to 50
|
|
142
|
+
`{ id, name, description, icon?, secret? }`, icons 128 x 128 PNG or WebP of
|
|
143
|
+
at most 64 KiB. `products` (optional): up to 50
|
|
144
|
+
`{ id, name, description, price, kind }`, whole Printer Cash within the
|
|
145
|
+
store's maximum, `kind` `consumable` or `permanent`. Ids are a lowercase
|
|
146
|
+
letter then up to 31 lowercase letters, digits or hyphens, unique and never
|
|
147
|
+
given a new meaning; names at most 40 and descriptions 120 characters.
|
|
116
148
|
- `network` (optional): up to 8 exact `https://` or `wss://` origins with a
|
|
117
149
|
public DNS name; no IP addresses, local or wildcard-DNS names, paths or `*`.
|
|
118
150
|
Your servers must send `Access-Control-Allow-Origin: *`.
|
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# @vibechain/os
|
|
2
2
|
|
|
3
|
-
Build games, tools and desktop apps for VibeMarket OS. Coding agents: read the agent skill, https://vibechain.com/os/skill.md. One `connect()` gives your app readiness, a save that follows the player, who is playing, their vmOS cards and packs, a signed statement of the player for your own server, and
|
|
3
|
+
Build games, tools and desktop apps for VibeMarket OS. Coding agents: read the agent skill, https://vibechain.com/os/skill.md. One `connect()` gives your app readiness, a save that follows the player, who is playing, their vmOS cards and packs, a signed statement of the player for your own server, a score with leaderboards, achievements, friends and invites, sharing, and products the player buys with Printer Cash. Use TypeScript with a bundler, or two `<script>` tags and nothing to install.
|
|
4
4
|
|
|
5
5
|
## Quickstart
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
npx --yes @vibechain/os@0.
|
|
9
|
-
npx --yes @vibechain/os@0.
|
|
10
|
-
npx --yes @vibechain/os@0.
|
|
8
|
+
npx --yes @vibechain/os@0.6.0 init my-app # TypeScript, esbuild and a 2D canvas (the default)
|
|
9
|
+
npx --yes @vibechain/os@0.6.0 init my-app --template three # TypeScript, esbuild and Three.js: a spinning vmOS card
|
|
10
|
+
npx --yes @vibechain/os@0.6.0 init my-app --template plain # index.html + game.js, nothing to install
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
For `canvas` and `three`: `cd my-app`, `npm install`, `npm run build`, `npm run dev`, and open the printed `http://127.0.0.1:PORT` address. `npm run check` (`os check`) lists every problem with the manifest and the build at once, and `npm run pack` writes `app.zip`. For `plain`: `npx @vibechain/os preview my-app`; the folder is already the app, so zip it to submit. Every template's `vibemarket.json` is a complete schema version 3 listing with placeholder text and pictures you must replace first (an unchanged starter is rejected at review).
|
|
@@ -15,7 +15,7 @@ For `canvas` and `three`: `cd my-app`, `npm install`, `npm run build`, `npm run
|
|
|
15
15
|
To install from a downloaded SDK archive, supply its absolute path to npm and the initializer:
|
|
16
16
|
|
|
17
17
|
```sh
|
|
18
|
-
npm exec --yes --package=/absolute/path/vibechain-os-0.
|
|
18
|
+
npm exec --yes --package=/absolute/path/vibechain-os-0.6.0.tgz -- os init my-app /absolute/path/vibechain-os-0.6.0.tgz
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
That keeps a `file:` archive dependency; retain the archive for later reinstalls. Use a supported Node.js release: `^22.23.4`, `^24.22.1` or `^26.12.1`. The library is ESM-only (`import`, or dynamic `import()` from CommonJS); browsers without a bundler use `vibemarket-os.js` (below).
|
|
@@ -41,7 +41,23 @@ await os.showCard("born-to-vibe", "b1"); // ...or one card on its pack's page
|
|
|
41
41
|
await os.open("vmos://pack/born-to-vibe"); // ...or an app link (packLink, cardLink, parseVmosLink)
|
|
42
42
|
|
|
43
43
|
const me = await os.player(); // { guest: false, handle, username?, name, picture, token?, expiresAt? } or { guest: true }
|
|
44
|
-
await os.finish({ score: 42 }); // one integer score, 0 to 1,000,000,000
|
|
44
|
+
await os.finish({ score: 42 }); // one integer score, 0 to 1,000,000,000, posted to the board "score"
|
|
45
|
+
await os.finish({ score: 61250, board: "time-trial" }); // ...or to a board you declared (0.6)
|
|
46
|
+
|
|
47
|
+
// 0.6: leaderboards, achievements, friends, invites, sharing and spending
|
|
48
|
+
const board = await os.leaderboard({ board: "score", scope: "friends", period: "week", limit: 10 });
|
|
49
|
+
await os.showLeaderboard("score"); // vmOS's own panel over the app; needs a click
|
|
50
|
+
await os.unlock("first-win"); // { unlocked: true } the first time; vmOS shows the toast
|
|
51
|
+
const achievements = await os.achievements();
|
|
52
|
+
const friends = await os.friends(); // friends who have this app, with presence
|
|
53
|
+
await os.invite({ text: "Race me!", data: "room-42" }); // vmOS's invite sheet; needs a click
|
|
54
|
+
os.launch.invite; // { from, data } when a friend's invite opened the app, else null
|
|
55
|
+
os.onInvite(invite => {}); // an invite while the app is open
|
|
56
|
+
await os.share({ score: 42 }); // vmOS's share sheet; needs a click
|
|
57
|
+
const products = await os.products(); // the manifest's products, with owned
|
|
58
|
+
const receipt = await os.buy("midnight-coat"); // vmOS's spend dialog; needs a click in the last second
|
|
59
|
+
for (const waiting of await os.purchases()) { grant(waiting.product); await os.consume(waiting.id); }
|
|
60
|
+
const token = await os.receiptToken(receipt.id); // network apps: verify on your server
|
|
45
61
|
|
|
46
62
|
os.onPause(() => {}); os.onResume(() => {});
|
|
47
63
|
os.onResize(({ width, height }) => {});
|
|
@@ -51,7 +67,7 @@ await os.maximize(); await os.fullscreen();
|
|
|
51
67
|
os.close(); // release the port
|
|
52
68
|
```
|
|
53
69
|
|
|
54
|
-
**Errors.** Every rejection is an `OsError` whose `code` is one of
|
|
70
|
+
**Errors.** Every rejection is an `OsError` whose `code` is one of thirteen and never changes; the `message` is a plain sentence that may. A refusal keeps the app running; only protocol violations (malformed messages, replayed requests, the hard rate limits) end the session.
|
|
55
71
|
|
|
56
72
|
| Code | Means |
|
|
57
73
|
|---|---|
|
|
@@ -60,10 +76,14 @@ os.close(); // release the port
|
|
|
60
76
|
| `invalid` | A bad argument: not JSON, a bad pack slug, a number out of range. |
|
|
61
77
|
| `too-large` | A save over 1 MiB, or over the player's 8 MiB across all apps. |
|
|
62
78
|
| `rate-limited` | Too often; try later. |
|
|
63
|
-
| `needs-click` | `showPack`, `showCard`, `open` or `
|
|
79
|
+
| `needs-click` | `showPack`, `showCard`, `open`, `fullscreen`, `showLeaderboard`, `share` or `invite` without a fresh click in the app, or `buy` without one in the last second. |
|
|
64
80
|
| `unavailable` | The host or server could not answer now; retry. |
|
|
65
81
|
| `timeout` | No answer in 10 seconds. |
|
|
66
82
|
| `closed` | The session ended: the window closed, the app was revoked, or a limit. |
|
|
83
|
+
| `cancelled` | 0.6: the player closed the spend dialog without spending. |
|
|
84
|
+
| `insufficient` | 0.6: the player does not have enough Printer Cash (you never learn how much they have). |
|
|
85
|
+
| `limit` | 0.6: a cap was reached: a daily spending limit, too many unconsumed purchases, or the day's invites. |
|
|
86
|
+
| `guest` | 0.6: guests cannot buy, share or invite; the player has to sign in. |
|
|
67
87
|
|
|
68
88
|
**Saves.** `os.save(value)` stores one JSON value per player per app on VibeMarket's servers: at most 1 MiB as UTF-8 JSON, nested at most 64 deep, finite numbers only. It survives closing the window, other devices and reinstalling; a save not written for 365 days is deleted, and the player can delete it from the app's VibeStore page. Calls made sooner than the host accepts (one write in flight, at most one every 10 seconds) replace the pending value, and every caller's promise resolves with the write that carries it, so call it as often as you like. Saves are accepted while the window is behind another one: `os.onPause(() => os.save(state))` is the place to save. Two devices playing at once overwrite each other (last write wins). A guest's save lives only while the window is open (`os.guest`).
|
|
69
89
|
|
|
@@ -71,13 +91,25 @@ os.close(); // release the port
|
|
|
71
91
|
|
|
72
92
|
**Showing any pack, and app links (0.5.1).** Any app can show and advertise any public vmOS pack, linked or not, with nothing in the manifest. `os.pack(slug)` returns its public face, what the pack's public page shows: name, creator, cover art and every card with its name, rarity and art (art URLs work as described above), never what the player holds. `os.showPack(slug)` opens the pack in VibeMarket inside vmOS, and `os.showCard(slug, cardId)` opens one card on its pack's page. An app link is one string you can put in your own content or get from your server: `vmos://pack/<slug>`, `vmos://card/<slug>/<cardId>`, or a pack's public page `https://vibechain.com/os/pack/<slug>` (or `www.`); `os.open(link)` opens it. `packLink(slug)` and `cardLink(slug, cardId)` write links and `parseVmosLink(text)` reads one (`{ kind: "pack", pack }`, `{ kind: "card", pack, card }` or `null`); the grammar is exact (lowercase scheme and host, no query, fragment, port or percent-encoding, at most 200 characters), and anything else answers `invalid` without reaching the host. `open` never navigates your frame: the SDK sends the host only the parsed pack or card. All three need the app ready and in front (`not-permitted`) and a fresh click in it (`needs-click`), share one budget of one per 10 seconds (`rate-limited`), and answer `invalid` for a pack that does not exist or was taken down or a card not in it. Buying and opening happen only in VibeMarket's own window, and your app learns nothing about what the player does there; it sees new holdings only through `os.cards()` and `onCards`, as the manifest permits. On a 0.5.0 host `showCard` and card links answer `unsupported`. The [docs](https://vibechain.com/os/docs#sdk-05-link-out) have the full rules and examples.
|
|
73
93
|
|
|
74
|
-
**Network and the player.** A manifest may declare up to 8 servers in `network`: exact `https://` or `wss://` origins (a DNS name, no path, no IP addresses, no local or wildcard-DNS names). The app may then `fetch`, `WebSocket` and `EventSource` them, and load images, audio, video and fonts from the `https://` ones; never scripts, styles or workers. Your servers must answer the frame's `Origin: null` with `Access-Control-Allow-Origin: *` (or `null`) for `fetch` and for images used as textures. Version remote URLs and send a long `Cache-Control`: the app has no IndexedDB, Cache Storage or service worker. Every server you declare sees the player's IP address; the listing says "Connects to" and "Loads content from" your hosts, and what your server sends after review is still bound by the listing rules (no third-party advertising or analytics, no payments
|
|
94
|
+
**Network and the player.** A manifest may declare up to 8 servers in `network`: exact `https://` or `wss://` origins (a DNS name, no path, no IP addresses, no local or wildcard-DNS names). The app may then `fetch`, `WebSocket` and `EventSource` them, and load images, audio, video and fonts from the `https://` ones; never scripts, styles or workers. Your servers must answer the frame's `Origin: null` with `Access-Control-Allow-Origin: *` (or `null`) for `fetch` and for images used as textures. Version remote URLs and send a long `Cache-Control`: the app has no IndexedDB, Cache Storage or service worker. Every server you declare sees the player's IP address; the listing says "Connects to" and "Loads content from" your hosts, and what your server sends after review is still bound by the listing rules (no third-party advertising or analytics, no payments other than `os.buy`, no sign-in prompts).
|
|
75
95
|
|
|
76
96
|
**Who is playing, and what your app and your servers learn.** `os.player()` tells every schema 3 app who is playing, with no permission and no prompt: the player's public vmOS identity, exactly what their public profile shows anyone. That is `{ guest: false, handle, username?, name, picture }`: `handle` is the character's fixed id and never changes (key your data on it), `username` the @name they show when it differs, `name` the display name, and `picture` the avatar as a URL under your app's own address (CORS-clean, like card art), or null. A guest is `{ guest: true }` and nothing else. There is no anonymous or per-app id: the same player has the same handle in every app, so two apps can recognize the same player, and anything your app sends to your servers (handle, name, holdings, save, gameplay) arrives tied to that public identity. Your app never receives the player's Steam ID, account id, session, balance, Nuggets, level or wallet. With `network`, the answer also carries `token` and `expiresAt`: a 5-minute Ed25519 JWT stating the same identity (`sub` is the handle, plus `username`, `name`, `aud` = your app id) for your own server, which must verify it rather than trust a handle the client sends: the [verification sample in the docs](https://vibechain.com/os/docs#sdk-05-verify) is the whole check, in Node with no dependencies, and compares `aud` with your app id. The token is not a credential for any vibechain.com route; the SDK reuses it while more than a minute remains; guests get none. Every server you declare also sees the player's IP address.
|
|
77
97
|
|
|
78
98
|
**Loading, window and input.** `ready()` within 15 seconds, or call `progress(fraction)` at least every 15 seconds and `ready()` within 120 (the SDK sends at most one progress a second). `maximize()` maximizes or restores the window. `fullscreen()` asks the host to put your app's window, with a slim host strip (your app's name, Report, Exit), into the browser's full screen; it needs a fresh click and Escape always leaves. Pointer lock, gamepads and audio work in every app (sound starts on the first input). Workers run from `blob:` URLs: `spawnWorker("worker.js")` fetches a bundled worker script and starts it (bundle it into one file). WebAssembly works; threads and `SharedArrayBuffer` do not, so use single-threaded engine exports.
|
|
79
99
|
|
|
80
|
-
**
|
|
100
|
+
**Leaderboards, achievements, friends, invites and sharing (0.6).** Every app has the board `score` ("High scores", bigger is better); a manifest may declare up to 5 boards of its own, each bigger-is-better or smaller-is-better, as a number or a time in milliseconds. `os.finish({ score, board })` ends the round as before and also posts the score to the board (`score` when you name none). vmOS keeps each player's best per board, all time and per week (from Monday 00:00 UTC), and accepts one score per round, only inside a round it timed itself (from `ready()` to the first `finish()`), at a limited rate; a refused score never affects the round, and `finish` resolves either way. Scores are reported by your app, so they are not proof of skill: players can report rows from vmOS's panel and staff remove them; a game that needs trusted rankings keeps its own board on its own server. `os.leaderboard({ board, scope, period, limit })` reads up to 50 rows (default 10) of `everyone` or `friends`, `all` or `week`, with each row's rank, handle, name, picture and score, and `you`, the player's own place even when it is outside the rows. `os.showLeaderboard(board)` opens vmOS's own panel over your app (needs a click) and resolves when it closes. `os.unlock(id)` records an achievement your manifest declares, once (`{ unlocked: true }` only the first time), and vmOS shows its own toast; achievements pay nothing. `os.achievements()` lists every declared achievement with `unlocked` and `at`; a secret one reads "Secret achievement", with no description or icon, until it is unlocked. `os.friends()` lists the player's friends who installed your app (at most 100), with `presence` `playing` (your app is open on their desk), `online` or `offline`, and only the public fields of a player; you never see the whole friends list. `os.invite({ to, text, data })` opens vmOS's invite sheet (needs a click): the player picks friends and confirms; they get a chat message with your app's card, and `{ sent }` says how many (0 when the player closes the sheet). `text` is a line of at most 80 characters and `data` up to 256 characters of your own (a room code, a seed). The friend who opens it starts your app with `os.launch.invite` (`{ from, data }`, read it once at start), or, if it is already open, `os.onInvite` hears it. `os.share({ text, score, board })` opens vmOS's share sheet with a card vmOS composes (your app's name and icon, the player's name, the score in the board's format and their rank); the player chooses a friend in chat or their VibeSpace status, may edit the caption (at most 140 characters) and confirms; `{ shared }` is false when they close it. `vmos://app/<appId>` and `https://vibechain.com/os/app/<appId>` are app links (`appLink(id)` writes one) that open an app's page in MiniVibe; `os.open` takes them, with a click. Guests can play, but their scores and achievements are not recorded and `share`, `invite` and `buy` answer `guest`. Invites, shares and spend dialogs are rate limited per app; the limits exist and may change.
|
|
101
|
+
|
|
102
|
+
**Spending Printer Cash (0.6).** An app may sell things inside itself for Printer Cash, and only products its manifest declares, with a price, reviewed with the version. `os.buy(productId)`, called from a click (within the last second), makes vmOS draw its own dialog over your app, outside your frame: your app's name and icon, the product's name and description as approved, the price and the player's Printer Cash now and after, with Cancel as the default. Your app is paused and learns nothing until it closes; then `buy` resolves with a `Receipt` (`{ id, product, kind, price, at, consumed }`) or rejects `cancelled`, `insufficient` (you never learn the balance), `limit` or `guest`. The price and product come from the approved manifest, never from your call. The Printer Cash is removed from play: nothing is paid to you. A `permanent` product is owned from then on, on every device (`products()` says `owned`, and buying it again returns the same receipt and spends nothing). A `consumable`'s receipt stays in `os.purchases()` until you grant the item and call `os.consume(receipt.id)`, so a crash between paying and granting loses nothing: read `purchases()` at every start and grant what is waiting. A player holds a limited number of unconsumed purchases per app, and spending per player per day is limited; the limits exist and their values are not published. A `network` app verifies a purchase on its server with `os.receiptToken(id)`: an Ed25519 JWT signed with the same key as the player token (same `kid`, same public keys), valid for 5 minutes, with the claims `sub` (handle), `app`, `rid`, `product`, `kind`, `price` and `at`. There is no refund call; staff can reverse a receipt.
|
|
103
|
+
|
|
104
|
+
Products are reviewed with the version, by these rules:
|
|
105
|
+
|
|
106
|
+
- A product delivers what its name and description say, inside the app.
|
|
107
|
+
- No product is, or stands for, money, Nuggets, Steam items, cards, packs or anything usable or tradable outside the app.
|
|
108
|
+
- A product whose result depends on chance shows its odds in the app before the dialog can open.
|
|
109
|
+
- Nothing the listing's screenshots show may need a purchase.
|
|
110
|
+
- Prices and products change only through a new reviewed version. An id keeps its meaning: a later version may add products, change names, descriptions and prices or drop one, but never change a product's `kind` (or a board's `order` or `format`).
|
|
111
|
+
|
|
112
|
+
**Older hosts.** On a host older than 0.6 every 0.6 call answers `unsupported`, `os.launch.invite` is null and `finish({ score, board })` ends the round without a board; nothing throws at import or connect, so hide the buttons and carry on. On a host older than 0.5, `ready`, `finish`, the lifecycle, `load` and `save` work (saves use the window-only 32 KiB checkpoint, and a larger one answers `too-large`); the rest answers `unsupported` and `progress` does nothing.
|
|
81
113
|
|
|
82
114
|
**Desktop photos.** The desktop camera cannot see inside a sandboxed app window, so it asks the app for its current frame (`app.capture`). `connect()` and `connectVibeMarketApp()` answer by default with the largest visible `<canvas>` on the page, taken on the next animation frame, scaled to at most 1280 pixels on its longest side and encoded as WebP (JPEG if WebP is unavailable) under 1,000,000 characters; a WebGL game needs no changes. An app that draws with the DOM, or wants a custom picture, registers `const off = os.onCapture?.(() => canvasOrDataUrl)` (optional; the 0.4 client has `sdk.onCapture` too): return an `HTMLCanvasElement`, a PNG/JPEG/WebP data URL, `null`, or a promise of one; the latest handler wins and the host waits about 1.2 seconds. Failures are silent. An app built with an older SDK shows a placeholder in desktop photos until it is rebuilt against this SDK.
|
|
83
115
|
|
|
@@ -85,7 +117,7 @@ os.close(); // release the port
|
|
|
85
117
|
|
|
86
118
|
## Apps without a bundler
|
|
87
119
|
|
|
88
|
-
`vibemarket-os.js` (in `dist/` of the package, copied by `os init --template plain`) defines one global, `VibemarketOS`, with `connect`, `OsError` and the link helpers `packLink`, `cardLink` and `parseVmosLink`. **Load it and your game from files: inline `<script>` code does not run**, because the runtime's policy allows scripts only from your app's own files.
|
|
120
|
+
`vibemarket-os.js` (in `dist/` of the package, copied by `os init --template plain`) defines one global, `VibemarketOS`, with `connect`, `OsError`, `createAudio` and the link helpers `packLink`, `cardLink`, `appLink` and `parseVmosLink`. **Load it and your game from files: inline `<script>` code does not run**, because the runtime's policy allows scripts only from your app's own files.
|
|
89
121
|
|
|
90
122
|
```html
|
|
91
123
|
<script src="vibemarket-os.js"></script>
|
|
@@ -149,11 +181,29 @@ host.click(); await game.openShop(); // showPack, showCard, open and f
|
|
|
149
181
|
expect(host.save).toEqual({ best: 7 }); expect(host.finished).toEqual({ score: 7 });
|
|
150
182
|
```
|
|
151
183
|
|
|
184
|
+
0.6 adds fakes for every new call, with the rules of the real services:
|
|
185
|
+
|
|
186
|
+
```ts
|
|
187
|
+
const host = createFakeOs({
|
|
188
|
+
leaderboards: [{ id: "laps", name: "Fastest lap", order: "low", format: "time" }], // as in vibemarket.json
|
|
189
|
+
achievements: [{ id: "first-win", name: "First win", description: "Win a race." }],
|
|
190
|
+
products: [{ id: "nitro", name: "Nitro", description: "One boost for the next race.", price: 5, kind: "consumable" }],
|
|
191
|
+
scores: [{ board: "laps", handle: "rival", name: "Rival", score: 61_000, friend: true }],
|
|
192
|
+
friends: [{ handle: "rival", name: "Rival", picture: null, presence: "online" }],
|
|
193
|
+
printerCash: 20,
|
|
194
|
+
});
|
|
195
|
+
host.click(); await host.os.buy("nitro"); // confirmed; host.setChoice("cancel") makes the player say no
|
|
196
|
+
expect(host.services.receipts).toHaveLength(1); expect(host.services.printerCash).toBe(15);
|
|
197
|
+
host.receiveInvite({ from: "rival", data: "room-42" }); // onInvite listeners hear it
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
`host.services` records the scores posted, achievements unlocked, shares, invites, receipts and the Printer Cash left; `shownLeaderboards` and `shownApps` what the game opened. `host: "0.5"` behaves like a host from before 0.6 (every new call `unsupported`). The same fakes answer the new calls in `os preview`, which draws plain stand-ins marked "Preview" for vmOS's dialog, sheets, panel and toast; the real ones look different and are drawn by vmOS.
|
|
201
|
+
|
|
152
202
|
It applies the real save limits, slug checks, card access levels, single-shot score, click rule, link grammar and error codes, and `protocol: 1` behaves like an older host. `packs` lists every public pack it knows (any of them works with `pack`, `showPack`, `showCard` and `open`), and `shownPacks` and `shownCards` record what the game asked to show. It has no time limits, rate limits or save coalescing, so still run the preview before you ship. `createFakeApp` is the same for the legacy `connectVibeMarketApp()` API.
|
|
153
203
|
|
|
154
204
|
### Complete examples
|
|
155
205
|
|
|
156
|
-
`examples/paw-beat` is a small 3D rhythm game with Three.js (
|
|
206
|
+
`examples/paw-beat` is a small 3D rhythm game with Three.js on `connect()`: a save, a leaderboard, three achievements, a share button and one cosmetic product, each degrading silently on an older host. The `os init` templates live in `examples/vibexp-app` (canvas), `examples/vibexp-app/plain` (the smallest app) and `examples/vibexp-app/three`.
|
|
157
207
|
|
|
158
208
|
## Intro, loading and results
|
|
159
209
|
|
|
@@ -182,7 +232,10 @@ VibeStore is the app store inside VibeMarket OS. You submit from its **Submit**
|
|
|
182
232
|
"description": "At least forty characters of plain text about the app.", "category": "game",
|
|
183
233
|
"rating": { "violence": "none", "language": "none", "mature": false }, "support": "https://example.com/help"
|
|
184
234
|
},
|
|
185
|
-
"packs": ["rooftop-rats"], "cards": "linked", "network": ["wss://play.example.com"]
|
|
235
|
+
"packs": ["rooftop-rats"], "cards": "linked", "network": ["wss://play.example.com"],
|
|
236
|
+
"leaderboards": [{ "id": "score", "name": "High scores" }],
|
|
237
|
+
"achievements": [{ "id": "first-win", "name": "First win", "description": "Win your first match." }],
|
|
238
|
+
"products": [{ "id": "gold-frame", "name": "Gold frame", "description": "A gold frame for your deck.", "price": 20, "kind": "permanent" }]
|
|
186
239
|
}
|
|
187
240
|
```
|
|
188
241
|
|
|
@@ -201,15 +254,19 @@ VibeStore is the app store inside VibeMarket OS. You submit from its **Submit**
|
|
|
201
254
|
| `store.support` | An `https://` URL without a user name or password, or an email address, at most 200 characters. Players and reviewers see it. |
|
|
202
255
|
| `packs` | Optional. Up to 3 pack slugs, no repeats, in the order the listing shows them. |
|
|
203
256
|
| `cards` | Optional. `none` (the default), `linked` (needs a pack in `packs`) or `all`. |
|
|
257
|
+
| `leaderboards` | Optional (0.6). Up to 5 of `{ id, name, order?, format? }`: `order` `high` (default, bigger is better) or `low`, `format` `number` (default) or `time` (milliseconds, shown m:ss.cc). The board `score` exists anyway unless you declare that id. |
|
|
258
|
+
| `achievements` | Optional (0.6). Up to 50 of `{ id, name, description, icon?, secret? }`. `icon` is a `.png` or `.webp` in the bundle, exactly 128 x 128 pixels, at most 64 KiB. `secret` hides the name and description until unlocked. |
|
|
259
|
+
| `products` | Optional (0.6). Up to 50 of `{ id, name, description, price, kind }`: `price` in whole Printer Cash, at least 1 and within the store's maximum price; `kind` `consumable` or `permanent`. Reviewed by the product rules above. |
|
|
260
|
+
| ids and names | An id is a lowercase letter followed by up to 31 lowercase letters, digits and hyphens, unique in its list, and keeps its meaning in every later version. A name is at most 40 characters and a description at most 120, one line each. |
|
|
204
261
|
| `network` | Optional. Up to 8 `https://` or `wss://` origins: `scheme://host` or `scheme://host:port` exactly (no path, not even `/`; no port 443), a public DNS name with internationalized names in punycode; never an IP address, `localhost` or a `.local`, `.internal`, `.lan`, `.home.arpa`, `.test`, `.example`, `.invalid`, `.onion` or `.arpa` name, a wildcard-DNS service (`nip.io`, `sslip.io`, `xip.io`, `localtest.me`, `lvh.me`, `traefik.me`), a vibechain.com, vibe.market or eattherich.gg address, or a `*`. Stored lowercase and sorted. |
|
|
205
262
|
|
|
206
|
-
Unknown fields are refused at every level, and version 3 refuses the four constant fields of version 2 (`sdkVersion`, `category`, `permissions`, `collectionId`). Schema version 2 manifests are still accepted unchanged. A bundle may not contain SVG files anywhere, because SVG is a document format that can carry script; use PNG or WebP. The submitted ZIP is at most 50 MiB (128 MiB expanded, 32 MiB per file, 2,000 files and folders; see [SECURITY.md](SECURITY.md)); a game may stream more art, audio and data from its declared servers. `os assets` copies a `public/` folder of your project whole into `dist/`, so assets need no manual copying.
|
|
263
|
+
The `vibemarket.json` file is at most 64 KiB. Unknown fields are refused at every level, and version 3 refuses the four constant fields of version 2 (`sdkVersion`, `category`, `permissions`, `collectionId`). Schema version 2 manifests are still accepted unchanged. A bundle may not contain SVG files anywhere, because SVG is a document format that can carry script; use PNG or WebP. The submitted ZIP is at most 50 MiB (128 MiB expanded, 32 MiB per file, 2,000 files and folders; see [SECURITY.md](SECURITY.md)); a game may stream more art, audio and data from its declared servers. `os assets` copies a `public/` folder of your project whole into `dist/`, so assets need no manual copying.
|
|
207
264
|
|
|
208
|
-
`os check [dir]` prints every problem with the manifest and the built folder at once, one per line with the field and how to fix it (`store.icon: icon.png is 512 x 512; it must be exactly 256 x 256 pixels`), and exits 1 if there is any: the same manifest, origin, listing image, file type and size checks as the server. `os pack` and `os preview` run them too. To validate in your own tools, `@vibechain/os/manifest` exports `parseManifest`, `checkManifest` (every problem as `{ path, message }`), `networkOrigin` and the bounds (`APP_BUNDLE_LIMITS`, `APP_MANIFEST_LIMITS`, `APP_STORE_CATEGORIES`), `@vibechain/os/listing` exports `checkListing`, `pngSize` and `
|
|
265
|
+
`os check [dir]` prints every problem with the manifest and the built folder at once, one per line with the field and how to fix it (`store.icon: icon.png is 512 x 512; it must be exactly 256 x 256 pixels`), and exits 1 if there is any: the same manifest, origin, listing image, file type and size checks as the server. `os pack` and `os preview` run them too. To validate in your own tools, `@vibechain/os/manifest` exports `parseManifest`, `checkManifest` (every problem as `{ path, message }`), `networkOrigin` and the bounds (`APP_BUNDLE_LIMITS`, `APP_MANIFEST_LIMITS`, `APP_STORE_CATEGORIES`), `@vibechain/os/listing` exports `checkListing`, `pngSize`, `webpSize`, `imageKind` and `achievementIconProblem`, and `@vibechain/os/policy` exports `appRuntimeCsp`, the runtime's exact Content-Security-Policy, which the preview and vibechain.com share.
|
|
209
266
|
|
|
210
267
|
## Publishing status
|
|
211
268
|
|
|
212
|
-
Publish by submitting your packed ZIP from the VibeStore **Submit** tab in VibeMarket OS, or with `os submit` from your terminal; see [Publish](https://vibechain.com/os/docs#publish) and [Review](https://vibechain.com/os/docs#review). Installing the SDK does not list your app. An approved version is archived to public IPFS, so approval is publication: removing an app from VibeStore later does not recall that copy. Third-party apps open in VibeMarket OS in the browser and in the VibeMarket Steam client. The app API grants no native
|
|
269
|
+
Publish by submitting your packed ZIP from the VibeStore **Submit** tab in VibeMarket OS, or with `os submit` from your terminal; see [Publish](https://vibechain.com/os/docs#publish) and [Review](https://vibechain.com/os/docs#review). Installing the SDK does not list your app. An approved version is archived to public IPFS, so approval is publication: removing an app from VibeStore later does not recall that copy. Third-party apps open in VibeMarket OS in the browser and in the VibeMarket Steam client. The app API grants no native or wallet access, no payment but a declared product bought in vmOS's own dialog, and cannot grant, see or influence a reward, and card reads only as the manifest declares them. Existing Market games continue to use their separate permissioned API.
|
|
213
270
|
|
|
214
271
|
See the [SDK docs](https://vibechain.com/os/docs) for the app API and [SECURITY.md](SECURITY.md) for the sandbox and resource limits.
|
|
215
272
|
|
|
@@ -243,11 +300,24 @@ pnpm skill # regenerate skill.md from the SDK; pnpm review fails while
|
|
|
243
300
|
pnpm review
|
|
244
301
|
pnpm build
|
|
245
302
|
pnpm check:package
|
|
246
|
-
pnpm release:preview --version 0.
|
|
303
|
+
pnpm release:preview --version 0.6.0
|
|
247
304
|
```
|
|
248
305
|
|
|
249
306
|
`pnpm build` emits JavaScript/declarations, the bundled preview host UI, `dist/vibemarket-os.js` (the no-bundler IIFE) and `dist/templates/plain/game.js` (built from `examples/vibexp-app/plain/game.ts`, so the repository holds no authored JavaScript). Only `examples/paw-beat` and `examples/vibexp-app` (with its `plain` and `three` templates) are published; `examples/card-game` and `examples/verify-player.ts` are type-checked and tested here and shown on the docs site. The store images of both examples are generated by scripts in `tools/` (not published), which drive headless, muted Chromium through Playwright. Read [SECURITY.md](SECURITY.md) before integrating any untrusted app.
|
|
250
307
|
|
|
308
|
+
## Changes in 0.6.0 (since 0.5.2)
|
|
309
|
+
|
|
310
|
+
- **New: leaderboards.** The manifest's optional `leaderboards`; `os.finish({ score, board })` posts to a board (the default board `score` without one); `os.leaderboard()` and `os.showLeaderboard()`.
|
|
311
|
+
- **New: achievements.** The manifest's optional `achievements` (with optional 128 x 128 icons, checked by `os check`); `os.unlock()` and `os.achievements()`.
|
|
312
|
+
- **New: friends, invites and sharing.** `os.friends()`, `os.invite()`, `os.launch`, `os.onInvite()` and `os.share()`; app links `vmos://app/<appId>` and `https://vibechain.com/os/app/<appId>` for `os.open`, written by the new `appLink()` (also on the `VibemarketOS` global).
|
|
313
|
+
- **New: spending Printer Cash.** The manifest's optional `products`; `os.products()`, `os.buy()`, `os.purchases()`, `os.consume()` and `os.receiptToken()`, with the product review rules above.
|
|
314
|
+
- **New error codes:** `cancelled`, `insufficient`, `limit` and `guest` (thirteen in all).
|
|
315
|
+
- **Compatible both ways.** Still protocol 2: each new call is a new message a host lists in its hello features, so every 0.5 app works on a 0.6 host unchanged, and a 0.6 app on an older host gets `unsupported` from the new calls (nothing throws at import or connect; `finish` with a board ends the round without it). The `Os` interface gained the new members, so a hand-written object implementing `Os` needs them (use `createFakeOs`).
|
|
316
|
+
- **Manifest file:** `vibemarket.json` may be up to 64 KiB (was 16 KiB). Older manifests parse exactly as before.
|
|
317
|
+
- **Testing and preview.** `createFakeOs` fakes every new call (`setChoice`, `receiveInvite`, `services`, `host: "0.5"`); `os preview` answers them with the same fakes and draws marked stand-ins for vmOS's surfaces.
|
|
318
|
+
- **Host side** (for VibeMarket OS itself): `AppHostServices` gained an optional handler per call and `clicked`; the controller enforces the window state, arguments, guests, the click and the per-call rates before a handler runs.
|
|
319
|
+
- **Paw Beat 1.3.0** moves to `connect()` and schema version 3: its save follows the player, and it has a Top dancers board, three achievements, a share button, a Leaderboard button and a midnight coat for Biscuit.
|
|
320
|
+
|
|
251
321
|
## Changes in 0.5.2 (since 0.5.1)
|
|
252
322
|
|
|
253
323
|
- **New: the desktop's sound.** The host sends `app.sound` (`{ muted, volume }`) with the port, before any answer, and on every change; `Os.sound` and `Os.onSound` are new, and the 0.4 object gains `sound.current()` and `sound.onChanged()`. `@vibechain/os/audio` (`createAudio`, also on the `VibemarketOS` global) gives an AudioContext and a master that follow it, the window and the browser's gesture rule, and recover a stopped or closed context. Nothing existing changed: older apps ignore the event, and on an older host the sound reads audible at full volume. The fake hosts (`setSound`) and the preview (a speaker and volume in its header) let you test it.
|
package/SECURITY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# VibeMarket OS app security and resource contract
|
|
2
2
|
|
|
3
|
-
These are bounded browser host controls, not a certification that arbitrary web code is safe. They grant no economy
|
|
3
|
+
These are bounded browser host controls, not a certification that arbitrary web code is safe. They grant no economy or wallet access, no payment other than a declared product the player confirms in vmOS's own spend dialog (SDK 0.6), and no credential for any vibechain.com route. What an app can receive is listed under Boundary: its own save, the card holdings its manifest declares, the player's public identity (handle, @name, display name, picture), and, for apps that declare servers, a short-lived signed statement of that identity for those servers. Native shells are refused, with one narrow exception for the VibeMarket Steam client described under Host admission. Store submission and review are checked by the VibeStore service, not by this package, and are not described here as open.
|
|
4
4
|
|
|
5
5
|
## Host admission
|
|
6
6
|
|
|
@@ -32,7 +32,7 @@ The flag is a claim made by the client's page-level marker, not a credential. On
|
|
|
32
32
|
- Admission binds the exact iframe WindowProxy, opaque origin `null`, one unpredictable 128-bit URL challenge, then a private MessagePort with a fresh 128-bit session. `null` is not an identity by itself. Bootstrap is ≤256-byte JSON and ≤32 messages from that child; unrelated windows receive no port. The global listener is removed after connection.
|
|
33
33
|
- The additive app codec uses bounded JSON on the existing channel/envelope/port transport. Legacy Market messages stay unchanged. Wrong session, replayed IDs, unknown methods, invalid schemas, malformed/oversized messages and quota exhaustion close the port. No implicit Market permissions are inherited.
|
|
34
34
|
- Close, navigation, minimize, hidden document, identity or package change revoke the active generation, and so does losing the front to another desktop window once a 60 second grace has run out. Within the grace the website's desk keeps the backgrounded frame and its session: the app is sent `active: false`, the frame is `display: none` and inert (never painted, hit or focused; the keyboard goes back to the desk), and its `game.finish` and `app.checkpoint.set` requests are withheld, neither applied nor answered, as they would be lost for a suspended app; reads are answered, saves (`app.save.set`, protocol 2) are accepted because that is when a game saves, `pack.show` and the display methods answer `not-permitted`, and every request still counts against the limits below. Returning in front within the grace re-activates the same frame, controller and session. The grace timer is the host's, starts when the window leaves the front, and nothing the app sends extends it; at most one app frame lives on the page, and opening another app tears the backgrounded one down at once. This is a cooperative pause, not a sandbox: until the host's frame-time watchdog exists (it does not yet), a hostile backgrounded app can keep its timers, workers and audio running for up to 60 seconds (Chromium stops a hidden frame's animation frames; WebKit does not), bounded only by the one-frame cap, the grace and the immediate teardown on a hidden page. Revocation preserves only the same app's host-accepted bounded checkpoint. Restore after revocation creates a fresh iframe, challenge and session. Host focus uses desktop policy, not the browser `blur` event caused by focusing the child itself.
|
|
35
|
-
- The app receives no session, Steam ID, account id, balance, wallet address, Steam ticket, native handle, money, arbitrary HTTP relay or credential for any vibechain.com route. What it can receive (protocol 2, after `host.hello`): its own save (JSON it wrote, at most 1 MiB, parsed and validated, never merged into host objects); the card holdings its manifest declares (`cards: "linked"` for its effective linked packs, `cards: "all"` for every vmOS pack the player holds, with no prompt; card id, pack slug, name, rarity, count and an art path under the app's own prefix, never an internal pack id, pull id, Nugget or Printer Cash amount or foil); public pack card lists; and who is playing (owner decision 2026-11-23, "just tell the app who the user is"): for every schema 3 app, without a permission, the player's public vmOS identity, exactly what their public profile shows anyone (the fixed `handle`, the @`username` when it differs, the display `name` and the profile `picture` as a path under the app's own prefix), or `{ guest: true }` for a guest; and, only for apps whose manifest declares `network`, a 5-minute Ed25519 token stating that identity, whose audience is the app id and which no vibechain.com route accepts. The host re-checks every card, pack and
|
|
35
|
+
- The app receives no session, Steam ID, account id, balance, wallet address, Steam ticket, native handle, money, arbitrary HTTP relay or credential for any vibechain.com route. What it can receive (protocol 2, after `host.hello`): its own save (JSON it wrote, at most 1 MiB, parsed and validated, never merged into host objects); the card holdings its manifest declares (`cards: "linked"` for its effective linked packs, `cards: "all"` for every vmOS pack the player holds, with no prompt; card id, pack slug, name, rarity, count and an art path under the app's own prefix, never an internal pack id, pull id, Nugget or Printer Cash amount or foil); public pack card lists; and who is playing (owner decision 2026-11-23, "just tell the app who the user is"): for every schema 3 app, without a permission, the player's public vmOS identity, exactly what their public profile shows anyone (the fixed `handle`, the @`username` when it differs, the display `name` and the profile `picture` as a path under the app's own prefix), or `{ guest: true }` for a guest; and, only for apps whose manifest declares `network`, a 5-minute Ed25519 token stating that identity, whose audience is the app id and which no vibechain.com route accepts. Since 0.6 it can also receive: other players' public profile fields and scores on its own boards; the player's friends who installed the same app (public fields and a coarse presence, never the whole friends list); that an invite came from a named friend, with the `data` the sending app attached; its own achievements; and the player's receipts for its own products (never the Printer Cash balance: only that a purchase failed for lack of it). Spending, sharing and inviting need the app in front, a recent click in it and the player's confirmation in a dialog or sheet vmOS draws outside the frame, which the app cannot imitate, cover or click; the host checks the front state, the click, guests, the arguments and a per-call rate before the desk's handler runs. The host re-checks every card, pack, player, board, achievement, friend, invite, product and receipt value against strict shapes before it reaches the app, so an extra field cannot ride along. There is no anonymous or per-app id: the same player is the same handle in every app, so apps can recognize and correlate a player, and everything an app sends to its declared servers (identity, holdings, save, gameplay) reaches them tied to the player's public profile, together with the player's IP address. The listing says what an app can see and where it connects. Checkpoints (legacy) contain only the app's own JSON. An app must not ask people to enter secrets inside its UI.
|
|
36
36
|
- `game.finish` accepts only an integer score from 0 through 1,000,000,000. It cannot carry Cash, XP, receipts or grant instructions. The first score is retained across suspension; same-score retries acknowledge without a second host callback, and changed scores are refused. The host posts its acknowledgement before notifying its results UI. Callback throws or acknowledgement failure never authorize another award. Stale generations cannot notify the host. A reported score is not reward proof. The score is display data: it never sets a reward. A finished round of an approved app may earn the player a small amount of Printer Cash, decided and paid by VibeMarket OS within per-player daily caps. The app cannot grant, see or influence the amount, and nothing an app sends is trusted for it.
|
|
37
37
|
|
|
38
38
|
## Enforced accepted-work limits
|
|
@@ -73,7 +73,7 @@ The runtime policy (`appRuntimeCsp`, `@vibechain/os/policy`) limits scripts, sty
|
|
|
73
73
|
|
|
74
74
|
**Owner decisions applied (2026-11-23).** An app is told who is playing (its public identity; no anonymous ids), and `cards: "all"` reads every vmOS pack the player holds with no consent prompt: the listing discloses both. Fullscreen goes through the host: the app's window, with a host-drawn strip naming the app and offering Report and Exit, enters the browser's full screen; the frame never gets the Fullscreen API (`fullscreen=()` stays in the runtime's Permissions-Policy) and Escape always leaves. Saves are kept on uninstall and revocation, deleted after 365 days without a write, on the player's request and with the account. Network apps carry no third-party advertising or analytics SDKs (a review rule).
|
|
75
75
|
|
|
76
|
-
Listing third-party apps relies on controls outside this package: publisher authentication, employee review of every version, immutable version digests, revocation, network and abuse budgets, install scope and adversarial tests. The listing checks in this package (`parseManifest`, `checkListing`, the SVG refusal) validate a bundle's shape; they do not review its behaviour. Scores, saves, checkpoints and any deck a game sends its server are untrusted client claims: the player token carries no holdings, so a server cannot ask whether a player really holds a card. Rewards, inventory grants and
|
|
76
|
+
Listing third-party apps relies on controls outside this package: publisher authentication, employee review of every version, immutable version digests, revocation, network and abuse budgets, install scope and adversarial tests. The listing checks in this package (`parseManifest`, `checkListing`, the SVG refusal) validate a bundle's shape; they do not review its behaviour. Scores, saves, checkpoints and any deck a game sends its server are untrusted client claims: the player token carries no holdings, so a server cannot ask whether a player really holds a card. Leaderboard scores (0.6) are the app's own claims too: they are accepted only inside a server-timed round and at a bounded rate, and are not proof of skill. Rewards, inventory grants and spending require separate server-authoritative, replay-safe, idempotent and capped verification: the server takes a product's price from the approved manifest, never from the call, and spends in one ledger transaction keyed by the dialog's operation; this package implements none of that, only the messages.
|
|
77
77
|
|
|
78
78
|
## CLI sign-in and tokens
|
|
79
79
|
|
package/dist/app-host.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GameFinishInput } from "./completion.ts";
|
|
2
2
|
import { type AppLifecycle, type AppSound } from "./app-protocol.ts";
|
|
3
|
-
import { type Player, type WireCard, type WirePack, type WirePackSummary } from "./app-wire.ts";
|
|
3
|
+
import { type Achievement, type Friend, type Invite, type InviteOptions, type Leaderboard, type LeaderboardQuery, type Player, type Product, type Receipt, type ShareOptions, type WireCard, type WirePack, type WirePackSummary } from "./app-wire.ts";
|
|
4
4
|
export interface AppSession {
|
|
5
5
|
lifecycle(value: AppLifecycle): void;
|
|
6
6
|
close(): void;
|
|
@@ -12,7 +12,18 @@ export interface AppSession {
|
|
|
12
12
|
* over). One capture is pending at a time. Never rejects.
|
|
13
13
|
*/
|
|
14
14
|
capture(timeoutMs?: number): Promise<string | null>;
|
|
15
|
+
/**
|
|
16
|
+
* SDK 0.6: a friend's invite reached the player while this app is open (`app.invite`; the app's `os.onInvite` hears it).
|
|
17
|
+
* Sent only to a client that said hello (protocol 2); a 0.5 client ignores the event. Returns whether it was sent. The
|
|
18
|
+
* invite the app was opened with is not sent this way: the host answers it from `AppHostServices.launch`. Optional only so
|
|
19
|
+
* that objects written against 0.5 still type-check; the controller's sessions always have it.
|
|
20
|
+
*/
|
|
21
|
+
invite?(value: Invite): boolean;
|
|
15
22
|
}
|
|
23
|
+
/** A finished round as the host hears it: the score, and since SDK 0.6 the board it is for when the app named one. */
|
|
24
|
+
export type AppFinish = GameFinishInput & {
|
|
25
|
+
board?: string;
|
|
26
|
+
};
|
|
16
27
|
/**
|
|
17
28
|
* `current`: this generation is the live one (its frame is mounted for this app and the page is shown). `foreground`: its
|
|
18
29
|
* window is in front. A generation that is current but not in the foreground is backgrounded: the host keeps its frame
|
|
@@ -26,8 +37,9 @@ export interface AppAttachOptions {
|
|
|
26
37
|
current: () => boolean;
|
|
27
38
|
foreground?: () => boolean;
|
|
28
39
|
ready: () => void;
|
|
29
|
-
finish?: (result: Readonly<GameFinishInput>) => void;
|
|
30
40
|
fault: (message: string) => void;
|
|
41
|
+
/** the app's first finish: its score, and the board to post it to when it named one (SDK 0.6; else the default `score` board) */
|
|
42
|
+
finish?: (result: Readonly<AppFinish>) => void;
|
|
31
43
|
progress?: (fraction: number) => void;
|
|
32
44
|
}
|
|
33
45
|
/**
|
|
@@ -71,7 +83,52 @@ export interface AppHostServices {
|
|
|
71
83
|
player(): Promise<Player>;
|
|
72
84
|
maximize(on: boolean): Promise<void>;
|
|
73
85
|
fullscreen(on: boolean): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Whether a user activation (a click, a tap, a key) reached the app's window within the last `withinMs` milliseconds; the
|
|
88
|
+
* desk's own check, as for showPack. Without it every call that needs a click answers `needs-click`.
|
|
89
|
+
*/
|
|
90
|
+
clicked?(withinMs: number): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* A board read (`os.leaderboard`), every option resolved: `board` defaults to "score", `scope` to "everyone", `period` to
|
|
93
|
+
* "all", `limit` (1 to 50) to 10. Answer that board and period with at most `limit` entries. Supplying it also lists
|
|
94
|
+
* FINISH_BOARD_FEATURE, so `os.finish({ score, board })` names its board to `AppAttachOptions.finish`.
|
|
95
|
+
*/
|
|
96
|
+
leaderboard?(query: LeaderboardQuery): Promise<Leaderboard>;
|
|
97
|
+
/** Open the vmOS leaderboard panel on `board` (default "score") and resolve when the player closes it. */
|
|
98
|
+
showLeaderboard?(board: string): Promise<void>;
|
|
99
|
+
/** Record an achievement: `{ unlocked: true }` only the first time (and show the toast); `invalid` for an undeclared id. */
|
|
100
|
+
unlock?(id: string): Promise<{
|
|
101
|
+
unlocked: boolean;
|
|
102
|
+
}>;
|
|
103
|
+
/** The app's declared achievements with the player's state; secret locked ones as SECRET_ACHIEVEMENT_NAME, "" and no icon. At most 50. */
|
|
104
|
+
achievements?(): Promise<Achievement[]>;
|
|
105
|
+
/** The player's friends who installed this app, at most 100, ordered playing, online, offline, then by name. */
|
|
106
|
+
friends?(): Promise<Friend[]>;
|
|
107
|
+
/** The invite this app was opened with (`os.launch.invite`), or null; asked once per frame load, so answer the same for the whole open. */
|
|
108
|
+
launch?(): Promise<Invite | null>;
|
|
109
|
+
/** Open the invite sheet; resolve with how many friends were invited (1 to 10) once the player confirms, `{ sent: 0 }` when they close it. */
|
|
110
|
+
invite?(options: InviteOptions): Promise<{
|
|
111
|
+
sent: number;
|
|
112
|
+
}>;
|
|
113
|
+
/** Open the share sheet; resolve `{ shared: false }` when the player closes it without posting. */
|
|
114
|
+
share?(options: ShareOptions): Promise<{
|
|
115
|
+
shared: boolean;
|
|
116
|
+
}>;
|
|
117
|
+
/** The approved version's products with `owned` (a permanent product the player bought; always false for a consumable). At most 50. */
|
|
118
|
+
products?(): Promise<Product[]>;
|
|
119
|
+
/** Draw the spend dialog for `product` and spend on confirmation; the receipt (the existing one for an owned permanent product). */
|
|
120
|
+
buy?(product: string): Promise<Receipt>;
|
|
121
|
+
/** Permanent receipts and consumables not yet consumed, at most 100. */
|
|
122
|
+
purchases?(): Promise<Receipt[]>;
|
|
123
|
+
/** Mark a consumable receipt consumed; consuming it again is not an error; `invalid` for an unknown or permanent receipt. */
|
|
124
|
+
consume?(receipt: string): Promise<void>;
|
|
125
|
+
/** A 5-minute signed receipt token (at most 1,500 characters) for a `network` app's server; `not-permitted` otherwise. */
|
|
126
|
+
receiptToken?(receipt: string): Promise<string>;
|
|
127
|
+
/** Open an app's page in MiniVibe (`os.open("vmos://app/<appId>")`). */
|
|
128
|
+
showApp?(app: string): Promise<void>;
|
|
74
129
|
}
|
|
130
|
+
/** The 0.6 features a host lists: each method whose handler it supplies, and the finish board with a board read. */
|
|
131
|
+
export declare function apps4Features(services: AppHostServices): string[];
|
|
75
132
|
export interface AppControllerOptions {
|
|
76
133
|
/** protocol 2 and the apps3 lifetime (15 minutes idle, 4 hours absolute); without it the controller is exactly protocol 1 */
|
|
77
134
|
services?: AppHostServices;
|
|
@@ -99,7 +156,7 @@ export interface AppFrameOptions {
|
|
|
99
156
|
fault: (message: string) => void;
|
|
100
157
|
/** whether the app's window is in front (AppAttachOptions); `setActive` tells the app the same */
|
|
101
158
|
foreground?: () => boolean;
|
|
102
|
-
finish?: (result: Readonly<
|
|
159
|
+
finish?: (result: Readonly<AppFinish>) => void;
|
|
103
160
|
/** protocol 2: the app's loading progress, 0 to 1, for the host's loading bar */
|
|
104
161
|
progress?: (fraction: number) => void;
|
|
105
162
|
/**
|
|
@@ -118,6 +175,8 @@ export interface MountedAppFrame {
|
|
|
118
175
|
setSound(sound: AppSound): void;
|
|
119
176
|
/** the app's current frame as a data URL (see `AppSession.capture`), or null; also null when there is no session or it ended */
|
|
120
177
|
capture(timeoutMs?: number): Promise<string | null>;
|
|
178
|
+
/** SDK 0.6: a friend's invite arrived while the app is open (see `AppSession.invite`); false when the app cannot hear it */
|
|
179
|
+
invite?(value: Invite): boolean;
|
|
121
180
|
}
|
|
122
181
|
/**
|
|
123
182
|
* Caller supplies the already-validated immutable URL, including this generation's fragment. With a protocol 2
|