@vibechain/os 0.4.0 → 0.5.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 +139 -208
- package/README.md +131 -54
- package/SECURITY.md +45 -20
- package/dist/app-client.d.ts +4 -1
- package/dist/app-client.js +4 -1
- package/dist/app-host.d.ts +111 -9
- package/dist/app-host.js +339 -58
- package/dist/app-protocol.d.ts +2 -0
- package/dist/app-runtime.d.ts +18 -2
- package/dist/app-runtime.js +75 -11
- package/dist/app-wire.d.ts +194 -0
- package/dist/app-wire.js +253 -0
- package/dist/browser.d.ts +2 -0
- package/dist/browser.js +2 -0
- package/dist/bundle.js +6 -6
- package/dist/canvas.d.ts +2 -2
- package/dist/canvas.js +3 -1
- package/dist/check.d.ts +12 -0
- package/dist/check.js +167 -0
- package/dist/cli-publish.d.ts +24 -0
- package/dist/cli-publish.js +288 -0
- package/dist/cli-session.d.ts +108 -0
- package/dist/cli-session.js +245 -0
- package/dist/cli.d.ts +10 -0
- package/dist/cli.js +46 -10
- package/dist/index.d.ts +5 -0
- package/dist/index.js +3 -0
- package/dist/listing.d.ts +3 -3
- package/dist/listing.js +1 -1
- package/dist/loop.d.ts +18 -2
- package/dist/loop.js +13 -1
- package/dist/manifest.d.ts +90 -4
- package/dist/manifest.js +340 -5
- package/dist/os.d.ts +56 -0
- package/dist/os.js +354 -0
- package/dist/preview-parent.d.ts +36 -0
- package/dist/preview-parent.js +122 -11
- package/dist/preview-ui.js +1 -1
- package/dist/preview.js +25 -7
- package/dist/redact.d.ts +6 -0
- package/dist/redact.js +16 -0
- package/dist/runtime-policy.d.ts +20 -0
- package/dist/runtime-policy.js +45 -0
- package/dist/scaffold.d.ts +13 -2
- package/dist/scaffold.js +99 -29
- package/dist/submit-notice.d.ts +26 -0
- package/dist/submit-notice.js +34 -0
- package/dist/templates/plain/game.js +18 -0
- package/dist/testing.d.ts +63 -0
- package/dist/testing.js +157 -1
- package/dist/transport.d.ts +20 -0
- package/dist/transport.js +71 -19
- package/dist/vibemarket-os.js +1 -0
- package/dist/worker.d.ts +18 -0
- package/dist/worker.js +34 -0
- package/examples/paw-beat/README.md +20 -8
- package/examples/paw-beat/cat.ts +665 -89
- package/examples/paw-beat/game.ts +162 -28
- package/examples/paw-beat/index.html +114 -40
- package/examples/paw-beat/main.ts +264 -149
- package/examples/paw-beat/music.ts +314 -65
- package/examples/paw-beat/stage.ts +560 -0
- package/examples/paw-beat/store/icon.png +0 -0
- package/examples/paw-beat/store/screenshot-1.webp +0 -0
- package/examples/paw-beat/store/screenshot-2.webp +0 -0
- package/examples/paw-beat/vibemarket.json +2 -2
- package/examples/vibexp-app/README.md +20 -4
- package/examples/vibexp-app/index.html +3 -2
- package/examples/vibexp-app/plain/game.ts +20 -0
- package/examples/vibexp-app/plain/index.html +6 -0
- package/examples/vibexp-app/plain/vibemarket.json +17 -0
- package/examples/vibexp-app/src/main.ts +46 -31
- package/examples/vibexp-app/store/icon.png +0 -0
- package/examples/vibexp-app/store/screenshot-1.png +0 -0
- package/examples/vibexp-app/three/README.md +21 -0
- package/examples/vibexp-app/three/index.html +4 -0
- package/examples/vibexp-app/three/src/main.ts +45 -0
- package/examples/vibexp-app/three/vibemarket.json +19 -0
- package/examples/vibexp-app/vibemarket.json +27 -1
- package/package.json +8 -3
- package/examples/chonk-stack/card-slice.ts +0 -17
- package/examples/chonk-stack/cat3d.ts +0 -57
- package/examples/chonk-stack/game.css +0 -174
- package/examples/chonk-stack/index.html +0 -32
- package/examples/chonk-stack/main.ts +0 -149
- package/examples/chonk-stack/model.ts +0 -40
- package/examples/chonk-stack/renderer.ts +0 -263
- package/examples/chonk-stack/skins.ts +0 -47
- package/examples/chonk-stack/vibemarket.json +0 -21
- package/examples/collection-room/index.html +0 -3
- package/examples/collection-room/main.ts +0 -31
- package/examples/collection-room/vibemarket.json +0 -12
- package/examples/tsconfig.json +0 -4
package/README.md
CHANGED
|
@@ -1,87 +1,137 @@
|
|
|
1
1
|
# @vibechain/os
|
|
2
2
|
|
|
3
|
-
Build games, tools and desktop apps for VibeMarket OS
|
|
3
|
+
Build games, tools and desktop apps for VibeMarket OS. 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 a score. 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
|
-
|
|
10
|
-
|
|
11
|
-
npm run build
|
|
12
|
-
npm run dev
|
|
8
|
+
npx --yes @vibechain/os@0.5.0 init my-app # TypeScript, esbuild and a 2D canvas (the default)
|
|
9
|
+
npx --yes @vibechain/os@0.5.0 init my-app --template three # TypeScript, esbuild and Three.js: a spinning vmOS card
|
|
10
|
+
npx --yes @vibechain/os@0.5.0 init my-app --template plain # index.html + game.js, nothing to install
|
|
13
11
|
```
|
|
14
12
|
|
|
15
|
-
|
|
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).
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
To install from a downloaded SDK archive, supply its absolute path to npm and the initializer:
|
|
18
16
|
|
|
19
17
|
```sh
|
|
20
|
-
npm exec --yes --package=/absolute/path/vibechain-os-0.
|
|
18
|
+
npm exec --yes --package=/absolute/path/vibechain-os-0.5.0.tgz -- os init my-app /absolute/path/vibechain-os-0.5.0.tgz
|
|
21
19
|
```
|
|
22
20
|
|
|
23
|
-
That
|
|
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).
|
|
24
22
|
|
|
25
|
-
The
|
|
26
|
-
|
|
27
|
-
## App API
|
|
23
|
+
## The app API
|
|
28
24
|
|
|
29
25
|
```ts
|
|
30
|
-
import {
|
|
26
|
+
import { connect, OsError } from "@vibechain/os";
|
|
31
27
|
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
const os = await connect(); // the handshake; no arguments
|
|
29
|
+
os.progress(0.5); // optional, while loading
|
|
30
|
+
os.ready(); // hide the host's loading screen
|
|
31
|
+
|
|
32
|
+
const save = await os.load<MySave>(); // MySave | null
|
|
33
|
+
await os.save(save); // JSON, up to 1 MiB, coalesced
|
|
34
|
+
|
|
35
|
+
const cards = await os.cards(); // the Card[] the manifest permits; os.cards("rooftop-rats") filters
|
|
36
|
+
const off = os.onCards(next => {}); // the whole list again whenever it changes; returns unsubscribe
|
|
37
|
+
const packs = await os.packs(); // PackSummary[]
|
|
38
|
+
const pack = await os.pack("rooftop-rats"); // the full public card list
|
|
39
|
+
await os.showPack("rooftop-rats"); // the host opens the pack; needs a click
|
|
40
|
+
|
|
41
|
+
const me = await os.player(); // { guest: false, handle, username?, name, picture, token?, expiresAt? } or { guest: true }
|
|
42
|
+
await os.finish({ score: 42 }); // one integer score, 0 to 1,000,000,000
|
|
43
|
+
|
|
44
|
+
os.onPause(() => {}); os.onResume(() => {});
|
|
45
|
+
os.onResize(({ width, height }) => {});
|
|
46
|
+
os.size; os.active; os.guest; // current values
|
|
47
|
+
await os.maximize(); await os.fullscreen();
|
|
48
|
+
os.close(); // release the port
|
|
40
49
|
```
|
|
41
50
|
|
|
42
|
-
|
|
51
|
+
**Errors.** Every rejection is an `OsError` whose `code` is one of nine 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.
|
|
52
|
+
|
|
53
|
+
| Code | Means |
|
|
54
|
+
|---|---|
|
|
55
|
+
| `unsupported` | The host is older than this SDK and has no such feature. |
|
|
56
|
+
| `not-permitted` | The manifest does not declare it, or the app is loading or behind another window. |
|
|
57
|
+
| `invalid` | A bad argument: not JSON, a bad pack slug, a number out of range. |
|
|
58
|
+
| `too-large` | A save over 1 MiB, or over the player's 8 MiB across all apps. |
|
|
59
|
+
| `rate-limited` | Too often; try later. |
|
|
60
|
+
| `needs-click` | `showPack` or `fullscreen` without a fresh click in the app. |
|
|
61
|
+
| `unavailable` | The host or server could not answer now; retry. |
|
|
62
|
+
| `timeout` | No answer in 10 seconds. |
|
|
63
|
+
| `closed` | The session ended: the window closed, the app was revoked, or a limit. |
|
|
64
|
+
|
|
65
|
+
**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`).
|
|
66
|
+
|
|
67
|
+
**Cards and packs.** A manifest may link up to 3 vmOS packs by slug (the last part of `vibechain.com/os/pack/<slug>`), in `packs`. Linking someone else's pack takes effect once its creator approves the request your submission sends; your own packs are linked at once. With `packs` alone, `os.pack(slug)` returns the public card list (cards the player does not hold included, to draw them locked), `os.showPack(slug)` opens the pack in the market window, and the listing shows "Uses cards from". `"cards": "linked"` adds `os.cards()` and `os.packs()` for the player's holdings in those packs; `"cards": "all"` for every vmOS pack they hold. There is no prompt: the listing says what the app can see. An app never sees Nuggets, prices, Steam IDs or balances. Card art URLs are under your app's own address and send `Access-Control-Allow-Origin: *`: Three.js's `TextureLoader` uses them as WebGL textures as is; an `<img>` you create needs `img.crossOrigin = "anonymous"` before `src`. The [docs](https://vibechain.com/os/docs#sdk-05-card-game) show a card game skeleton (a deck builder) on these calls.
|
|
68
|
+
|
|
69
|
+
**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, no sign-in prompts).
|
|
70
|
+
|
|
71
|
+
**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.
|
|
72
|
+
|
|
73
|
+
**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.
|
|
74
|
+
|
|
75
|
+
**Older hosts.** 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.
|
|
43
76
|
|
|
44
|
-
|
|
77
|
+
**Legacy API.** `connectVibeMarketApp()` and its `checkpoint` (0.4) keep working and keep their types, and are deprecated: `connect()` does the same and more on every host.
|
|
45
78
|
|
|
46
|
-
##
|
|
79
|
+
## Apps without a bundler
|
|
47
80
|
|
|
48
|
-
|
|
81
|
+
`vibemarket-os.js` (in `dist/` of the package, copied by `os init --template plain`) defines one global, `VibemarketOS`, with `connect` and `OsError`. **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.
|
|
82
|
+
|
|
83
|
+
```html
|
|
84
|
+
<script src="vibemarket-os.js"></script>
|
|
85
|
+
<script src="game.js"></script>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
```js
|
|
89
|
+
VibemarketOS.connect().then(async os => {
|
|
90
|
+
const best = (await os.load())?.best ?? 0;
|
|
91
|
+
os.ready();
|
|
92
|
+
// ... then await os.save({ best }) and await os.finish({ score })
|
|
93
|
+
});
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Game helpers
|
|
97
|
+
|
|
98
|
+
`@vibechain/os/loop` and `@vibechain/os/canvas` take the result of `connect()` (or of the legacy `connectVibeMarketApp()`) and follow its lifecycle, so a game stops drawing when its window is not active.
|
|
49
99
|
|
|
50
100
|
```ts
|
|
51
|
-
import {
|
|
101
|
+
import { connect } from "@vibechain/os";
|
|
52
102
|
import { createLoop } from "@vibechain/os/loop";
|
|
53
103
|
import { fitCanvas } from "@vibechain/os/canvas";
|
|
54
104
|
|
|
55
|
-
const
|
|
105
|
+
const os = await connect();
|
|
56
106
|
const canvas = document.querySelector("canvas")!;
|
|
57
|
-
fitCanvas(
|
|
58
|
-
const loop = createLoop(
|
|
59
|
-
|
|
60
|
-
window.addEventListener("pagehide", () => { loop.stop();
|
|
107
|
+
fitCanvas(os, canvas, { onResize: ({ width, height }) => renderer.setSize(width, height, false) });
|
|
108
|
+
const loop = createLoop(os, { update: stepMs => world.step(stepMs), render: alpha => renderer.draw(alpha) });
|
|
109
|
+
os.ready();
|
|
110
|
+
window.addEventListener("pagehide", () => { loop.stop(); os.close(); }, { once: true });
|
|
61
111
|
```
|
|
62
112
|
|
|
63
113
|
`createLoop` runs a fixed-timestep simulation (default 60 steps per second, at most 5 catch-up steps per frame) and renders once per animation frame. It pauses while the app is inactive and discards that time instead of simulating it on return. `fitCanvas` sizes the canvas backing store from the host surface with the device pixel ratio capped (default 2, and at most 3840 x 2160 pixels), resizes only when the size changes, and keeps a lost WebGL context restorable through `onContextLost` and `onContextRestored`.
|
|
64
114
|
|
|
65
115
|
### Testing your game
|
|
66
116
|
|
|
67
|
-
`@vibechain/os/testing`
|
|
117
|
+
`@vibechain/os/testing` has an in-memory host, so game logic can be unit-tested without a browser:
|
|
68
118
|
|
|
69
119
|
```ts
|
|
70
|
-
import {
|
|
120
|
+
import { createFakeOs } from "@vibechain/os/testing";
|
|
71
121
|
|
|
72
|
-
const host =
|
|
73
|
-
const game = await startGame(host.
|
|
122
|
+
const host = createFakeOs({ save: { best: 3 }, cards: myCards, packs: [myPack], access: { cards: "linked", packs: ["rooftop-rats"] }, network: true });
|
|
123
|
+
const game = await startGame(host.os); // your code, given the os instead of connecting
|
|
124
|
+
host.setCards(afterAPull); // onCards listeners hear about it
|
|
74
125
|
host.setLifecycle({ active: false }); // as if the window was minimized
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
expect(host.finished).toEqual({ score: 3 });
|
|
126
|
+
host.click(); await game.openShop(); // showPack and fullscreen need a click
|
|
127
|
+
expect(host.save).toEqual({ best: 7 }); expect(host.finished).toEqual({ score: 7 });
|
|
78
128
|
```
|
|
79
129
|
|
|
80
|
-
It applies the real
|
|
130
|
+
It applies the real save limits, slug checks, card access levels, single-shot score, click rule and error codes, and `protocol: 1` behaves like an older host. 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.
|
|
81
131
|
|
|
82
|
-
###
|
|
132
|
+
### Complete examples
|
|
83
133
|
|
|
84
|
-
`examples/paw-beat`
|
|
134
|
+
`examples/paw-beat` is a small 3D rhythm game with Three.js (built on the legacy API, unchanged). The `os init` templates live in `examples/vibexp-app` (canvas), `examples/vibexp-app/plain` (the smallest app) and `examples/vibexp-app/three`.
|
|
85
135
|
|
|
86
136
|
## Intro, loading and results
|
|
87
137
|
|
|
@@ -99,41 +149,68 @@ Completion does not grant Cash, XP, inventory or a wallet action. The local prev
|
|
|
99
149
|
|
|
100
150
|
## Listing in VibeStore
|
|
101
151
|
|
|
102
|
-
VibeStore is the app store inside VibeMarket OS. You submit from its **Submit** tab, and every version is reviewed by a person before it is listed. The requirements below are checked at submission.
|
|
152
|
+
VibeStore is the app store inside VibeMarket OS. You submit from its **Submit** tab or with `os submit` (below), and every version is reviewed by a person before it is listed. The requirements below are checked at submission. A listing is manifest schema version 3:
|
|
103
153
|
|
|
104
154
|
```json
|
|
105
155
|
{
|
|
106
|
-
"schemaVersion":
|
|
107
|
-
"category": "vibexp-app", "entry": "index.html", "permissions": [], "collectionId": null,
|
|
156
|
+
"schemaVersion": 3, "id": "my-app", "version": "1.0.0", "name": "My App", "tagline": "One line about it.", "entry": "index.html",
|
|
108
157
|
"window": { "width": 960, "height": 600, "resizable": true },
|
|
109
158
|
"store": {
|
|
110
159
|
"icon": "store/icon.png", "screenshots": ["store/screenshot-1.webp"],
|
|
111
160
|
"description": "At least forty characters of plain text about the app.", "category": "game",
|
|
112
161
|
"rating": { "violence": "none", "language": "none", "mature": false }, "support": "https://example.com/help"
|
|
113
|
-
}
|
|
162
|
+
},
|
|
163
|
+
"packs": ["rooftop-rats"], "cards": "linked", "network": ["wss://play.example.com"]
|
|
114
164
|
}
|
|
115
165
|
```
|
|
116
166
|
|
|
117
167
|
| Field | Requirement |
|
|
118
168
|
|---|---|
|
|
119
|
-
| `
|
|
120
|
-
| `
|
|
169
|
+
| `id` | Lowercase letters, digits and single hyphens, starting with a letter, at most 60 characters. The first accepted submission claims it. |
|
|
170
|
+
| `version` | Semantic version, each submitted once. |
|
|
171
|
+
| `name`, `tagline` | At most 60 and 160 characters. |
|
|
172
|
+
| `entry` | The relative path of the `.html` file to open. |
|
|
173
|
+
| `window` | `width` 320 to 1600 and `height` 200 to 1200 whole CSS pixels, `resizable` true or false. The window opens at this size; maximize and full screen go beyond it. |
|
|
174
|
+
| `store.icon` | A `.png` file in the bundle, exactly 256 x 256 pixels and at most 256 KiB. Supply a full-bleed, opaque square with your subject inside a margin: VibeStore rounds the corners itself. |
|
|
121
175
|
| `store.screenshots` | 1 to 4 different `.png`, `.jpg`, `.jpeg` or `.webp` files in the bundle, none of them the icon, each at most 1 MiB, with contents that match the extension. |
|
|
122
176
|
| `store.description` | Plain text, 40 to 2,000 characters after trimming. Line breaks are allowed; other control characters are not. Shown as text, never as HTML. |
|
|
123
|
-
| `store.category` | `game
|
|
177
|
+
| `store.category` | `game` or `app`. Version 2 manifests written for 0.4 with `tool` or `toy` still validate and are read as `app`; `os check` says so. |
|
|
124
178
|
| `store.rating` | `violence` and `language` each `none`, `mild` or `strong`, and `mature` true or false. Rate honestly. |
|
|
125
179
|
| `store.support` | An `https://` URL without a user name or password, or an email address, at most 200 characters. Players and reviewers see it. |
|
|
180
|
+
| `packs` | Optional. Up to 3 pack slugs, no repeats, in the order the listing shows them. |
|
|
181
|
+
| `cards` | Optional. `none` (the default), `linked` (needs a pack in `packs`) or `all`. |
|
|
182
|
+
| `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. |
|
|
126
183
|
|
|
127
|
-
|
|
184
|
+
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.
|
|
128
185
|
|
|
129
|
-
`
|
|
186
|
+
`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 `imageKind`, and `@vibechain/os/policy` exports `appRuntimeCsp`, the runtime's exact Content-Security-Policy, which the preview and vibechain.com share.
|
|
130
187
|
|
|
131
188
|
## Publishing status
|
|
132
189
|
|
|
133
|
-
Publish by submitting your packed ZIP from the VibeStore **Submit** tab in VibeMarket OS; 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 the browser version of VibeMarket OS; the Steam client does not run them yet. The app API
|
|
190
|
+
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 the browser version of VibeMarket OS; the Steam client does not run them yet. The app API grants no native, payment, wallet or reward access, and card reads only as the manifest declares them. Existing Market games continue to use their separate permissioned API.
|
|
134
191
|
|
|
135
192
|
See the [SDK docs](https://vibechain.com/os/docs) for the app API and [SECURITY.md](SECURITY.md) for the sandbox and resource limits.
|
|
136
193
|
|
|
194
|
+
## Submit from the command line
|
|
195
|
+
|
|
196
|
+
`os submit` is a second way in to the same submission as the **Submit** tab: the same checks, limits, refusal codes and review.
|
|
197
|
+
|
|
198
|
+
```sh
|
|
199
|
+
npx os login # prints a code and opens https://vibechain.com/os/cli
|
|
200
|
+
npx os submit dist # checks and packs the build, shows a summary and the notice, asks, uploads
|
|
201
|
+
npx os status # your submissions and their review state (os status <app-id> for one app)
|
|
202
|
+
npx os whoami # the account and computer of this sign-in
|
|
203
|
+
npx os logout # revokes this computer's sign-in, then deletes it
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
- **Sign-in.** `os login` asks vibechain.com for a short code, prints it with the page address and opens the page with your system's opener (`--no-browser` to skip). Sign in with Steam on that page, type the code your terminal shows, check that the page shows the same code and your computer's name, and select **Approve**. The CLI never asks for, sees or stores your Steam password or browser session. Only approve a code that your own terminal just showed you: whoever gets you to approve their code can submit apps in your name.
|
|
207
|
+
- **What the sign-in can do.** Submit apps to VibeStore review and read your own submissions' status; nothing else. It lasts 30 days from sign-in (use does not extend it) and you can revoke it at [vibechain.com/os/cli](https://vibechain.com/os/cli) at any time. Signing out of Steam in the browser does not revoke it.
|
|
208
|
+
- **Where it is kept.** `$XDG_CONFIG_HOME/vibemarket-os/credentials.json`, else `~/Library/Application Support/vibemarket-os` (macOS), `%APPDATA%\vibemarket-os` (Windows) or `~/.config/vibemarket-os`: a `0700` directory and a `0600` file, never your project. The CLI refuses to read it if other users can.
|
|
209
|
+
- **CI.** Set `VIBEMARKET_OS_TOKEN` to the `token` of a saved sign-in, stored as a CI secret. It is used by `whoami`, `submit` and `status` and never written to disk. Use `os submit dist --yes` there: without a terminal the CLI does not ask.
|
|
210
|
+
- **Before uploading,** `os submit` prints the app, version, file count, size and digest, and the same notice as the [Review](https://vibechain.com/os/docs#review) docs: approval is publication, and the Terms link. It records no acceptance; it asks you to confirm (or takes `--yes`).
|
|
211
|
+
- **Refusals** print the Submit tab's code, the server's message and the fix from the [docs table](https://vibechain.com/os/docs#publish).
|
|
212
|
+
- **Hosts.** Requests go only to `https://vibechain.com`; redirects are never followed. `--origin http://127.0.0.1:<port>` (or `localhost`) is for local development only and prints a warning. `--verbose` prints each request's method, address and status, never the token.
|
|
213
|
+
|
|
137
214
|
## Maintainer workflow
|
|
138
215
|
|
|
139
216
|
```sh
|
|
@@ -141,10 +218,10 @@ pnpm install --frozen-lockfile
|
|
|
141
218
|
pnpm review
|
|
142
219
|
pnpm build
|
|
143
220
|
pnpm check:package
|
|
144
|
-
pnpm release:preview --version 0.
|
|
221
|
+
pnpm release:preview --version 0.5.0
|
|
145
222
|
```
|
|
146
223
|
|
|
147
|
-
`pnpm build` emits JavaScript/declarations
|
|
224
|
+
`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.
|
|
148
225
|
|
|
149
226
|
## License
|
|
150
227
|
|
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
|
|
3
|
+
These are bounded browser host controls, not a certification that arbitrary web code is safe. They grant no economy, wallet or payment access 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
|
|
|
@@ -13,10 +13,16 @@ These are bounded browser host controls, not a certification that arbitrary web
|
|
|
13
13
|
|
|
14
14
|
Every other origin is refused, including other `https` hosts and subdomains, plain `http` to the production names and any explicit port on them. A framed host is refused. Known native bridge markers (`__VM_STEAM__`, `__TAURI_INTERNALS__`, `__TAURI__`, `vibeNative`, `ReactNativeWebView`) and embedded user agents (Tauri, Electron, VibeSteam, VibeMarketDesktop, Android `wv`) are refused on every host. Admission is a refusal policy: the absence of a marker does not certify an unknown webview.
|
|
15
15
|
|
|
16
|
+
**Steam client claim.** On the VibeMarket OS website only (`https://vibechain.com` or `https://www.vibechain.com`, default port, top-level window), a window whose own data property `__VM_STEAM__` holds a plain object (prototype `Object.prototype` or `null`, frozen or not) whose own data property `appFrames` is exactly the number `1` is not refused for the two markers that client always carries, `__VM_STEAM__` and `__TAURI_INTERNALS__`. The flag is read once, from its property descriptor, so no getter runs. An accessor, an inherited property, any other value (`0`, `"1"`, `true`, absent) or a marker that is not a plain object counts as no flag and is refused with the same native-shell message as before. With the flag present every other marker (`__TAURI__`, `vibeNative`, `ReactNativeWebView`) and every embedded user agent is still refused, and the flag changes nothing on the local preview, on any other origin or in a framed host, which keep their own messages. The Steam client sets no custom user agent, so it presents its platform webview's default (WKWebView, WebView2 or WebKitGTK), which matches none of the refused agent patterns.
|
|
17
|
+
|
|
18
|
+
The flag is a claim made by the client's page-level marker, not a credential. Only Steam client builds that carry the client's app-frame guard set it, and only on a platform where that build passed a manual hostile-app test. This package cannot verify any of that: the claim is not authenticated, a webview that copies the marker makes the same claim, and the check proves nothing about the client's IPC scope, its navigation and window policy or whether its bridge is reachable from a sandboxed frame. It shows only that the page is the top-level website on its production origin and that the shell asserts the guard. Inside an admitted Steam client, app isolation still rests on the frame's sandbox and opaque origin (`mountAppFrame` still accepts its bootstrap only from origin `null`), on the website's runtime headers and on the client's own guard.
|
|
19
|
+
|
|
20
|
+
**Shipped Steam clients, by platform.** Steam client builds already in players' hands carry no version, no custom user agent and no `appFrames` key, so the website holds a second admission path for them: `SHIPPED_CLIENT_FRAMES` in `app-runtime.ts`, one entry per platform (`windows`, `macos`, `linux`), all `1` since 2026-11-23 (the owner's decision on the automated frame harness's results on all three platforms, recorded in `vibemarket-desktop/docs/frame-probe-results/ci-2026-11-23.md`; no person has run the probe inside the shipped client). On the production website, top-level, a window whose `__VM_STEAM__` is the same own plain-object marker is not refused for the client's two markers when the platform named by its webview's default user agent has entry `1`. The platform is read conservatively from the whole agent string: WebView2's Edge agent on `Windows NT` for Windows, WKWebView's agent on `Macintosh` with no `Version/` or `Safari/` tokens for macOS, WebKitGTK's agent on `X11; Linux` for Linux; any other agent, or one with an extra token, is no platform and refuses. A `1` means the owner admitted that platform on the evidence recorded beside the entry: either a person ran the frame probe (`vibechain/components/os-apps/frame-probe`, opened from the desk) inside the shipped client on that platform and every native command it tries came back unreachable from the sandboxed frame, or the automated frame harness (`vibemarket-desktop/docs/FRAME-HARNESS.md`) ran the shipped build's own configuration and pinned framework on that platform's webview and its native-side log showed no command body run because of a frame. The harness is not the players' binary and not their own webview runtime. Either way it is evidence about what was tested, not about future builds, and the user agent cannot tell a WebView2 page from the Edge browser or one client build from another; the marker, the production origin and the other refusals still apply. The table and its pinned test change only in a reviewed commit.
|
|
21
|
+
|
|
16
22
|
## Runtime origins
|
|
17
23
|
|
|
18
24
|
- **Local preview.** `os preview` serves the parent page from `127.0.0.1` and the app from a different host, `localhost`, on the same port.
|
|
19
|
-
- **vibechain.com.** Apps are served by the website on the same origin as the desktop, under `/os/runtime/external/<appId>/<versionKey>/<file>`, where `versionKey` names one immutable version. There is no separate app domain. On the same origin exactly one thing keeps an app's HTML from running as `vibechain.com` with the player's session: the sandbox, which gives the document an opaque origin. The website's runtime route is therefore required to send `Content-Security-Policy: sandbox allow-scripts` on every response under that path, to serve HTML only to frame requests, to answer errors as plain text, to use fixed content types with `nosniff`, and to ignore and never set cookies. Those controls live in the website, not in this package, and this package cannot enforce them. What remains after them: browsers may run an app in the same process as the desktop, and the protection depends on those headers being right on every response. A separate registrable domain would be stronger; moving to one later is a routing change.
|
|
25
|
+
- **vibechain.com.** Apps are served by the website on the same origin as the desktop, under `/os/runtime/external/<appId>/<versionKey>/<file>`, where `versionKey` names one immutable version. There is no separate app domain. On the same origin exactly one thing keeps an app's HTML from running as `vibechain.com` with the player's session: the sandbox, which gives the document an opaque origin. The website's runtime route is therefore required to send `Content-Security-Policy: sandbox allow-scripts allow-pointer-lock` (from `appRuntimeCsp` in this package, the one generator both the website and the preview use) on every response under that path, to serve HTML only to frame requests, to answer errors as plain text, to use fixed content types with `nosniff`, and to ignore and never set cookies. Those controls live in the website, not in this package, and this package cannot enforce them. What remains after them: browsers may run an app in the same process as the desktop, and the protection depends on those headers being right on every response. A separate registrable domain would be stronger; moving to one later is a routing change.
|
|
20
26
|
|
|
21
27
|
`mountAppFrame` accepts the bootstrap only from its own frame's window with origin `null`, on both hosts. If a response ever arrived without the sandbox, the app would not be able to connect to the host, but its code would already have run with the site's origin; the connection check is not a substitute for the header.
|
|
22
28
|
|
|
@@ -25,31 +31,50 @@ Every other origin is refused, including other `https` hosts and subdomains, pla
|
|
|
25
31
|
- App code executes in an iframe with `sandbox="allow-scripts"`, without `allow-same-origin`, top navigation, popups, forms or downloads. Runtime HTTP CSP also carries `sandbox allow-scripts`, including direct visits. The host checks its browser/native policy before creating a frame. Never inject third-party JavaScript into the desktop React realm or a privileged native webview.
|
|
26
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.
|
|
27
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.
|
|
28
|
-
- Close, navigation, minimize,
|
|
29
|
-
- The app receives no
|
|
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 player 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.
|
|
30
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; only a separately registered host/server policy can confirm an existing Cash award.
|
|
31
37
|
|
|
32
38
|
## Enforced accepted-work limits
|
|
33
39
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
|
37
|
-
|
|
38
|
-
|
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
|
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
A host that supplies protocol 2 services (an apps3 host: the desk with its `apps3` flag on, and the local preview) applies the right-hand column to every session, protocol 1 clients included. A host without services is exactly the 0.4 host (left column).
|
|
41
|
+
|
|
42
|
+
| Boundary | 0.4 host | apps3 host |
|
|
43
|
+
|---|---:|---:|
|
|
44
|
+
| App checkpoint (legacy) | 32KiB UTF-8; depth8; 2,048nodes; 64keys/object; 256items/array; 8KiB/string | same |
|
|
45
|
+
| Save (`os.save`) | none | 1 MiB UTF-8 JSON, depth 64, finite numbers; one write in flight, one per 10 s (soft, `rate-limited`); the backend also bounds 8 MiB per account and 16 MiB written per hour |
|
|
46
|
+
| Request / response | 34KiB UTF-8 JSON each, cheap character cap before encoding/parsing | 34 KiB before `host.hello` and for protocol 1 methods; after it, per method (`APP_METHODS_2`): 64 B to 256 B for most requests, 1,100,000 B for a save; responses up to 256 KiB for a page of 500 cards and 1,100,000 B for a save read |
|
|
47
|
+
| In-flight requests | 4 per active generation | 4 before hello, 8 after |
|
|
48
|
+
| Request rate | 10 per fixed one-second host interval; exhaustion terminates | 10 per one-second interval and 120 per rolling minute; exhaustion terminates. Per-method soft rates answer `rate-limited` and keep the session |
|
|
49
|
+
| Request ids | each unique per session | strictly increasing decimal integers per session (every shipped client sends 1, 2, 3, ...) |
|
|
50
|
+
| Cumulative requests | 5,000 per open app controller, including suspended generations | 30,000 (unreachable inside 4 hours at 120 a minute; the minute bound decides) |
|
|
51
|
+
| Controller lifetime / readiness | 15minutes absolute across suspension and remounts / `ready()` within 15seconds | idle prompt after 15 minutes with no user activation and no request, teardown if unanswered (the host's UI); 4 hours absolute / `ready()` within 15 s, or `progress()` at least every 15 s and `ready()` within 120 s |
|
|
52
|
+
| App-side request wait | 10seconds | 10 seconds; the client also paces itself below the host's limits |
|
|
53
|
+
| Built bundle | 2,000 entries, 32 MiB per file, 128 MiB expanded; ZIP 50 MiB (`APP_BUNDLE_LIMITS`; Market games keep `GAME_LIMITS`: 256, 16 MiB, 64 MiB, 20 MiB) | same |
|
|
54
|
+
| Schema version 2 and 3 bundle | No SVG files; store icon a 256 x 256 PNG ≤256KiB; 1–4 screenshots ≤1MiB each, signature matching the extension | same |
|
|
55
|
+
| Schema version 3 manifest | | at most 3 linked packs, 8 declared origins |
|
|
56
|
+
| First Desk adapter | One open third-party app controller and at most one untrusted iframe | same |
|
|
57
|
+
|
|
58
|
+
Policy outcomes (a missing permission, the app loading or behind another window, a soft rate, a missing click, a quota, an unavailable server) are answered with one of nine stable codes and keep the session. Protocol violations (malformed or unknown messages, schema errors, a second hello, a lower or repeated id, a request over its method's bound, the hard limits above) end it. `pack.show` and entering `display.fullscreen` act only while the app is ready and in front; the host additionally checks fresh user activation on its own page and answers `needs-click`. Leaving fullscreen is always allowed.
|
|
59
|
+
|
|
60
|
+
The local preview snapshots admitted files once using bounded no-follow file-handle reads, then serves only that immutable in-memory map, exact fixed host assets and stand-in card art (the bundle's own listing icon, under the version prefix). It is an apps3 host with stand-in services: six fake cards per linked pack, a save in the parent page's own browser storage, and an unsigned placeholder player token for apps that declare `network`; its runtime responses carry the production policy from `appRuntimeCsp`, with the preview's asset prefix and parent. It has no URL proxy, arbitrary filesystem route, write route or credential. Local filesystem authoring is not the public upload trust boundary; the existing ZIP validator remains responsible for untrusted uploads. The preview requires `127.0.0.1` for the parent and a different `localhost` runtime host, validates Host headers, never auto-opens a browser, and closes owned connections on shutdown.
|
|
48
61
|
|
|
49
62
|
## What these controls cannot promise
|
|
50
63
|
|
|
51
64
|
The browser allocates structured-clone data before host validation. Message byte limits bound accepted host processing, not that prior allocation. An iframe has no portable hard CPU, memory, GPU, event-queue or network quota. A hostile app can still stall or exhaust a browser before removal. Cooperative lifecycle events do not enforce resource fairness; physical iframe removal limits continued execution after suspension but is not an OS process kill certificate.
|
|
52
65
|
|
|
53
|
-
|
|
66
|
+
The runtime policy (`appRuntimeCsp`, `@vibechain/os/policy`) limits scripts, styles and workers' first scripts to the version's own files, and every fetch, image, media and font to those files plus, for a version whose manifest declares `network`, its declared origins: every origin in `connect-src`, the `https://` ones also in `img-src`, `media-src` and `font-src`, and never in `script-src`, `style-src`, `worker-src`, `child-src`, `frame-src` or `object-src`. Declared origins are re-validated (`networkOrigin`: https or wss, a public DNS name, no IP address in any form, no local, reserved or wildcard-DNS name, no Vibechain domain) and a list that is not normalized throws rather than produce a partial policy. What it cannot stop: text fetched from a declared server run in a `blob:` worker (`worker-src blob:` stays, for engines and decoders), `WebAssembly.instantiate` on fetched bytes, fetched CSS put into a `<style>` element, an interpreter in the bundle running server-sent programs, and server data driving behaviour. So "the reviewed code is the code that runs" holds for the files VibeStore hosts and is listing policy for everything else: an app whose behaviour changes after review because its server says so breaches the listing rules and is removed by revocation; it is not confined. A declared name can also resolve to a private address; Chromium's Private Network Access narrows that in one engine only. Every declared server sees the player's IP address. Network apps may not embed third-party advertising or analytics SDKs (review rule, owner decision 2026-11-23). WebRTC is not governed by CSP: an app can open peer connections in every measured engine, so the listing allows WebRTC only for play between players signalled through declared servers. A sandboxed app can also navigate its own frame to an external URL; navigation revokes the session after load, but a request may already have occurred. Do not describe any of this as a network firewall or supply secrets that require one. Known native bridge markers and embedded user agents are denied, except the Steam client's own two markers when it claims app frames (see Host admission); their absence does not certify unknown webviews, and that claim does not certify the client. Native IPC provenance tests on each platform remain the client's gate before a build sets the flag.
|
|
67
|
+
|
|
68
|
+
**Player identity.** An app learns the player's public identity and nothing private: the handle, @name, display name and picture their public profile already shows. The token is a 5-minute Ed25519 JWT (`sub` = the handle, plus `username`, `name`, `guest: false`, `aud` = the app id) signed by the backend only, for apps that declare `network`, so their servers can trust who is playing instead of a handle the client claims; guests get none; public keys are at `https://vibechain.com/.well-known/vmos-app-keys.json`. It is a statement for the app's own server, not a credential: no vibechain.com route accepts it. A server that does not check `aud` would accept another app's tokens; the verification sample in the docs (https://vibechain.com/os/docs#sdk-05-verify) checks it. Within its 5 minutes a token can be replayed; servers that need one-time use keep `jti`.
|
|
69
|
+
|
|
70
|
+
**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).
|
|
71
|
+
|
|
72
|
+
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 payments require separate server-authoritative, replay-safe, idempotent and capped verification; they are not implemented by this app API.
|
|
73
|
+
|
|
74
|
+
## CLI sign-in and tokens
|
|
75
|
+
|
|
76
|
+
`os login` is a browser device grant. The CLI receives a 256-bit device code it alone holds (its poll credential) and an 8-letter user code it shows the person; it never handles a Steam password, a Steam cookie or the website's session. The person approves on `https://vibechain.com/os/cli` with an explicit POST after signing in with Steam there. The resulting token (`vmos_cli_` + 256 random bits) is shown to the CLI once, kept server-side only as a SHA-256 hash, expires 30 days after issue without extension, and is accepted only by the four CLI routes: create a submission, read the account's submissions, read its own identity, revoke itself. Every other route refuses it. A disabled account's tokens stop working.
|
|
77
|
+
|
|
78
|
+
On disk the token lives in the per-user config directory (`0700`) in `credentials.json` (`0600`), written with `O_CREAT | O_EXCL | O_NOFOLLOW` to a new name and renamed into place. On POSIX the CLI refuses a file or directory that is a link, owned by another user, or readable by group or others. Windows has no such mode bits; the file relies on the per-user ACL of `%APPDATA%`. `VIBEMARKET_OS_TOKEN` overrides the file and is never written. The token is never printed, put in a URL or a process argument, or written to the project; errors and `--verbose` output are redacted. Requests go only to `https://vibechain.com` (or a loudly announced loopback development origin), the saved token only to the origin that issued it, and redirects are never followed, so the Authorization header cannot reach another host. The browser opener is called with a fixed argument list and a URL the CLI builds itself.
|
|
54
79
|
|
|
55
|
-
|
|
80
|
+
What this cannot promise: anyone who persuades you to approve their code gets a token for your account (submit and read submissions only), so approve only a code your own terminal shows and revoke unknown sign-ins at `/os/cli`. Malware running as your user can read the file, as it could read a browser profile; revoke the sign-in if a machine is compromised.
|
package/dist/app-client.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { type VibeMarketAppSdk } from "./app-protocol.ts";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* The 0.4 app API: readiness, lifecycle, the window-only checkpoint and one score.
|
|
4
|
+
* @deprecated Use `connect()` from `@vibechain/os`, which works on every host.
|
|
5
|
+
*/
|
|
3
6
|
export declare function connectVibeMarketApp(signal?: AbortSignal): Promise<VibeMarketAppSdk>;
|
|
4
7
|
export declare function createAppPortSdk(port: MessagePort, session: string): VibeMarketAppSdk;
|
package/dist/app-client.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { APP_FRAGMENT, APP_LIMITS, appNonce, checkpointValue, lifecycleValue } from "./app-protocol.js";
|
|
2
2
|
import { connectHostPort, createRpcTransport } from "./transport.js";
|
|
3
3
|
import { gameFinishInput } from "./completion.js";
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* The 0.4 app API: readiness, lifecycle, the window-only checkpoint and one score.
|
|
6
|
+
* @deprecated Use `connect()` from `@vibechain/os`, which works on every host.
|
|
7
|
+
*/
|
|
5
8
|
export async function connectVibeMarketApp(signal) {
|
|
6
9
|
const challenge = new URLSearchParams(window.location.hash.slice(1)).get(APP_FRAGMENT);
|
|
7
10
|
if (!appNonce(challenge))
|