@vibechain/os 0.4.1 → 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 +76 -48
- 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 +95 -31
- 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 +7 -7
- 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/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 +17 -11
- package/package.json +6 -2
package/AGENTS.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# VibeStore app author contract — @vibechain/os 0.
|
|
1
|
+
# VibeStore app author contract — @vibechain/os 0.5.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
|
|
@@ -9,63 +9,80 @@ guide is https://vibechain.com/os/docs.
|
|
|
9
9
|
|
|
10
10
|
An ordinary static web app: a game, a tool or a desktop toy. You submit a ZIP of
|
|
11
11
|
**built output**, not source, `node_modules`, a server or an install script.
|
|
12
|
-
Vanilla TypeScript, canvas, WebGL and engine
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
Vanilla JavaScript with two script tags, TypeScript, canvas, WebGL and engine
|
|
13
|
+
builds all work. Bundle your code and assets and use relative paths (`base: './'`
|
|
14
|
+
in Vite). Scripts, styles and workers' first scripts always come from the bundle;
|
|
15
|
+
images, audio, video, fonts and data may also come from servers your manifest
|
|
16
|
+
declares in `network` (below).
|
|
15
17
|
|
|
16
18
|
## Start
|
|
17
19
|
|
|
18
20
|
```sh
|
|
19
|
-
npx --yes @vibechain/os@0.
|
|
21
|
+
npx --yes @vibechain/os@0.5.0 init my-app # TypeScript + canvas; or --template three, or --template plain
|
|
20
22
|
cd my-app
|
|
21
23
|
npm install
|
|
22
24
|
npm run build
|
|
25
|
+
npm run check
|
|
23
26
|
npm run dev
|
|
24
27
|
```
|
|
25
28
|
|
|
26
|
-
`os init` writes
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
`os init` writes a complete starter whose `vibemarket.json` is already a schema
|
|
30
|
+
version 3 listing with placeholder text and pictures. Replace the fields its
|
|
31
|
+
README lists before submitting; an unchanged starter is rejected at review.
|
|
32
|
+
`--template plain` writes `index.html`, `game.js`, `vibemarket-os.js`, the
|
|
33
|
+
manifest and two images, with nothing to install. `examples/paw-beat` in this
|
|
34
|
+
package is a complete 3D game with a real listing.
|
|
31
35
|
|
|
32
36
|
## The app API
|
|
33
37
|
|
|
34
38
|
```ts
|
|
35
|
-
import {
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
await
|
|
39
|
-
|
|
40
|
-
await
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
import { connect, OsError } from "@vibechain/os";
|
|
40
|
+
const os = await connect();
|
|
41
|
+
const save = await os.load<{ best: number }>(); // null on first open
|
|
42
|
+
await os.save({ best: 7 }); // up to 1 MiB of JSON; kept across opens and devices
|
|
43
|
+
os.onPause(() => { void os.save(state); }); // pause, resume and resize listeners
|
|
44
|
+
await os.ready(); // remove the host's loading state (or os.progress(0.5) while loading)
|
|
45
|
+
const cards = await os.cards(); // if the manifest declares cards
|
|
46
|
+
const me = await os.player(); // { guest: false, handle, username?, name, picture } or { guest: true }; plus token with network
|
|
47
|
+
await os.finish({ score: 42 });
|
|
43
48
|
```
|
|
44
49
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
1,000,000,000, once per open window; the host
|
|
49
|
-
score grants nothing.
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
Every rejection is an `OsError` with a stable `code` (`unsupported`,
|
|
51
|
+
`not-permitted`, `invalid`, `too-large`, `rate-limited`, `needs-click`,
|
|
52
|
+
`unavailable`, `timeout`, `closed`); refusals keep the app running. `game.finish`
|
|
53
|
+
takes one integer score from 0 to 1,000,000,000, once per open window; the host
|
|
54
|
+
owns the results screen and the score grants nothing. Saves are coalesced (one
|
|
55
|
+
write per 10 seconds) and kept on the server, except a guest's, which last only
|
|
56
|
+
while the window is open. `os.pack(slug)` and `os.showPack(slug)` work for linked
|
|
57
|
+
packs; `os.cards()` and `os.packs()` with `cards` declared. Pointer lock,
|
|
58
|
+
gamepads, audio, WebAssembly and `blob:` workers (`spawnWorker`) work; threads
|
|
59
|
+
and `SharedArrayBuffer` do not. `os.fullscreen()` asks the host after a click.
|
|
60
|
+
Optional helpers: `@vibechain/os/loop`, `@vibechain/os/canvas` and
|
|
61
|
+
`@vibechain/os/testing` (`createFakeOs`, an in-memory host for unit tests).
|
|
62
|
+
`connectVibeMarketApp()` (0.4) still works and is deprecated.
|
|
52
63
|
|
|
53
64
|
## What an app cannot do
|
|
54
65
|
|
|
55
|
-
An app
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
66
|
+
An app learns who is playing (their public handle, @name, display name and
|
|
67
|
+
picture, the same in every app; there is no anonymous id) but has no access to
|
|
68
|
+
the player's account, session, Steam ID or balance; no wallets, purchases,
|
|
69
|
+
trades, Cash, Nuggets, XP or rewards;
|
|
70
|
+
no vibechain.com APIs; no undeclared servers; no Classic `/market` holdings; and
|
|
71
|
+
no access to the desktop page, other apps, Steam commands or native IPC. Card
|
|
72
|
+
holdings are visible only as the manifest declares (`cards`), and the signed
|
|
73
|
+
player token only with `network`; whatever the app sends its servers is tied to
|
|
74
|
+
the player's public identity. A network app may not embed third-party advertising
|
|
75
|
+
or analytics SDKs, take payments, or ask players to sign in; what its server
|
|
76
|
+
sends after review is still bound by the listing rules. Never ask players to type
|
|
77
|
+
secrets into your app.
|
|
61
78
|
|
|
62
79
|
## Manifest and listing
|
|
63
80
|
|
|
64
|
-
`vibemarket.json` sits at the root of the build. VibeStore accepts
|
|
65
|
-
version
|
|
81
|
+
`vibemarket.json` sits at the root of the build. VibeStore accepts schema
|
|
82
|
+
version 3 (and version 2 unchanged), with unknown fields refused at every level:
|
|
66
83
|
|
|
67
|
-
- `schemaVersion:
|
|
68
|
-
`
|
|
84
|
+
- `schemaVersion: 3`. Version 3 refuses the four constant fields of version 2
|
|
85
|
+
(`sdkVersion`, `category`, `permissions`, `collectionId`).
|
|
69
86
|
- `id`: lowercase letters, digits and single hyphens, at most 60 characters;
|
|
70
87
|
the first accepted submission claims it. `version`: semver, each submitted
|
|
71
88
|
once. `name` (60) and `tagline` (160). `entry`: the HTML file.
|
|
@@ -74,28 +91,36 @@ version 2, with every field required and unknown fields refused at every level:
|
|
|
74
91
|
- `store.screenshots`: 1–4 PNG, JPEG or WebP files in the bundle, at most
|
|
75
92
|
1 MiB each, contents matching the extension, none the icon.
|
|
76
93
|
- `store.description`: 40–2,000 characters of plain text (line breaks allowed).
|
|
77
|
-
- `store.category`: `game
|
|
94
|
+
- `store.category`: `game` or `app`.
|
|
78
95
|
- `store.rating`: `violence` and `language` each `none`, `mild` or `strong`;
|
|
79
96
|
`mature` true or false. Rate honestly.
|
|
80
97
|
- `store.support`: an `https://` URL or an email address, at most 200
|
|
81
98
|
characters, shown to players and reviewers.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
(
|
|
85
|
-
|
|
99
|
+
- `packs` (optional): up to 3 vmOS pack slugs. Someone else's pack is linked
|
|
100
|
+
only after its creator approves.
|
|
101
|
+
- `cards` (optional): `none`, `linked` (needs `packs`) or `all` (every vmOS
|
|
102
|
+
pack the player holds).
|
|
103
|
+
- `network` (optional): up to 8 exact `https://` or `wss://` origins with a
|
|
104
|
+
public DNS name; no IP addresses, local or wildcard-DNS names, paths or `*`.
|
|
105
|
+
Your servers must send `Access-Control-Allow-Origin: *`.
|
|
106
|
+
|
|
107
|
+
`os check` lists every problem at once; `os preview` and `os pack` run the same
|
|
108
|
+
checks. `checkManifest` and `parseManifest` (`@vibechain/os/manifest`) and
|
|
109
|
+
`checkListing` (`@vibechain/os/listing`) run them in your own tools.
|
|
86
110
|
|
|
87
111
|
## Bundle rules
|
|
88
112
|
|
|
89
|
-
At most
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
types: HTML, JS/MJS, CSS,
|
|
93
|
-
MP3/OGG/WAV, MP4/WebM,
|
|
94
|
-
document format that can carry
|
|
113
|
+
At most 2,000 entries, 32 MiB per file, 128 MiB expanded and a 50 MiB ZIP; a
|
|
114
|
+
game may stream more from its declared servers. ASCII paths in normal
|
|
115
|
+
subdirectories: no absolute or hidden paths, traversal, symlinks, encrypted
|
|
116
|
+
entries, or names that differ only by letter case. File types: HTML, JS/MJS, CSS,
|
|
117
|
+
JSON, PNG/JPEG/WebP/GIF/AVIF/ICO, WOFF/WOFF2/TTF/OTF, MP3/OGG/WAV, MP4/WebM,
|
|
118
|
+
WASM/BIN/TXT. **No SVG** anywhere, because it is a document format that can carry
|
|
119
|
+
script. Workers start from `blob:` URLs (`spawnWorker`); `SharedArrayBuffer` and
|
|
95
120
|
threaded WASM are unavailable.
|
|
96
121
|
|
|
97
122
|
```sh
|
|
98
|
-
npm run build # the starter: type-check, bundle, then os assets copies HTML, manifest
|
|
123
|
+
npm run build # the starter: type-check, bundle, then os assets copies HTML, manifest, store images and public/
|
|
99
124
|
npm run pack # os pack dist app.zip
|
|
100
125
|
```
|
|
101
126
|
|
|
@@ -105,7 +130,10 @@ npm run pack # os pack dist app.zip
|
|
|
105
130
|
a Steam account; new versions of an app must come from the account that
|
|
106
131
|
first submitted it.
|
|
107
132
|
2. Open **VibeStore**, go to **Submit**, choose `app.zip` and submit it for
|
|
108
|
-
review. Refusals are explained there in plain words.
|
|
133
|
+
review. Refusals are explained there in plain words. Or, from a terminal:
|
|
134
|
+
`os login` (approve the code in your browser), then `os submit dist`; see
|
|
135
|
+
README.md, "Submit from the command line". Never approve a code you did not
|
|
136
|
+
start yourself.
|
|
109
137
|
3. Vibechain staff review every version: they read the listing, look at the
|
|
110
138
|
file list and run the app in a sandboxed window. There is no automatic
|
|
111
139
|
approval and no promised review time. A rejection comes with a note; fix the
|
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
|
|