@vibechain/os 0.4.0 → 0.4.1
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 +111 -208
- package/README.md +7 -7
- package/dist/cli.js +1 -1
- package/dist/scaffold.js +10 -4
- package/examples/vibexp-app/README.md +19 -3
- package/examples/vibexp-app/store/icon.png +0 -0
- package/examples/vibexp-app/store/screenshot-1.png +0 -0
- package/examples/vibexp-app/vibemarket.json +21 -1
- package/package.json +3 -2
- 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/AGENTS.md
CHANGED
|
@@ -1,224 +1,127 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
**VibeMarket OS app authors:** start with [README.md](README.md) and
|
|
4
|
-
[SECURITY.md](SECURITY.md), the `os init` starter and
|
|
5
|
-
`connectVibeMarketApp()`. Use category `vibexp-app`, `permissions: []` and
|
|
6
|
-
`collectionId: null`. That browser-only app facade has readiness, lifecycle and
|
|
7
|
-
bounded app-owned checkpoints and a score-only `game.finish({score})` signal; it has no profile, inventory, Steam/native,
|
|
8
|
-
wallet, purchase or reward authority. The existing Market-game contract below
|
|
9
|
-
continues to apply to collection games using `connectGameSdk()`; do not infer
|
|
10
|
-
those permissions for an OS app. A VibeStore listing uses manifest schema version 2
|
|
11
|
-
(window size and a `store` object with icon, screenshots, description, category,
|
|
12
|
-
rating and support); the requirements are in README.md under "Listing in
|
|
13
|
-
VibeStore". Submit the packed ZIP from the VibeStore Submit tab in VibeMarket OS; every version is reviewed before listing, and an approved version is archived to public IPFS.
|
|
14
|
-
|
|
15
|
-
This is the contract internal developers and agents test before public release.
|
|
16
|
-
Build an ordinary static web game. Deliver a ZIP of **built output**, not source,
|
|
17
|
-
node_modules, a server, or an install script. React, vanilla TypeScript and canvas
|
|
18
|
-
renderers all work. Use relative asset paths (`base: './'` in Vite). No remote
|
|
19
|
-
scripts, fonts, APIs, workers or wallet libraries. Bundle your dependencies/assets.
|
|
20
|
-
|
|
21
|
-
## Install and author
|
|
22
|
-
|
|
23
|
-
Install the published package in an independent game project:
|
|
1
|
+
# VibeStore app author contract — @vibechain/os 0.4.1
|
|
24
2
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
3
|
+
This is the contract for people and agents building apps for VibeStore, the app
|
|
4
|
+
store inside VibeMarket OS. Read it with [README.md](README.md) (API, helpers and
|
|
5
|
+
the listing table) and [SECURITY.md](SECURITY.md) (sandbox and limits). The public
|
|
6
|
+
guide is https://vibechain.com/os/docs.
|
|
28
7
|
|
|
29
|
-
|
|
8
|
+
## What you build
|
|
30
9
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
```
|
|
10
|
+
An ordinary static web app: a game, a tool or a desktop toy. You submit a ZIP of
|
|
11
|
+
**built output**, not source, `node_modules`, a server or an install script.
|
|
12
|
+
Vanilla TypeScript, canvas, WebGL and engine builds all work. Bundle every
|
|
13
|
+
dependency and asset, and use relative paths (`base: './'` in Vite). No remote
|
|
14
|
+
scripts, fonts, images or APIs: the app can load only its own files.
|
|
37
15
|
|
|
38
|
-
|
|
16
|
+
## Start
|
|
39
17
|
|
|
40
18
|
```sh
|
|
41
|
-
|
|
42
|
-
|
|
19
|
+
npx --yes @vibechain/os@0.4.1 init my-app
|
|
20
|
+
cd my-app
|
|
21
|
+
npm install
|
|
22
|
+
npm run build
|
|
23
|
+
npm run dev
|
|
43
24
|
```
|
|
44
25
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
26
|
+
`os init` writes Stamp Club, a complete starter whose `vibemarket.json` is already
|
|
27
|
+
a schema version 2 listing with placeholder text and pictures. Replace the
|
|
28
|
+
fields its README lists before submitting; an unchanged starter is rejected at
|
|
29
|
+
review. `examples/paw-beat` in this package is a complete 3D game with a real
|
|
30
|
+
listing.
|
|
50
31
|
|
|
51
|
-
|
|
52
|
-
import { connectGameSdk } from '@vibechain/os';
|
|
53
|
-
const sdk = await connectGameSdk();
|
|
54
|
-
await sdk.ready(); // Call when the first usable frame is mounted, within 30 seconds.
|
|
55
|
-
// At the end of a round: await sdk.game.finish({ score: 42 });
|
|
56
|
-
// Report only the integer score; the host owns results and any verified reward.
|
|
57
|
-
const profile = await sdk.profile.get(); // null for guests; no wallet address
|
|
58
|
-
const packs = await sdk.catalog.list(); // only this game's approved collection
|
|
59
|
-
const inventory = await sdk.inventory.get(); // pages of <=100 cards
|
|
60
|
-
const stop = sdk.inventory.onChanged(() => { /* re-fetch inventory */ });
|
|
61
|
-
// On teardown: stop(); sdk.destroy();
|
|
62
|
-
```
|
|
32
|
+
## The app API
|
|
63
33
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
`examples/paw-beat` is a complete 3D rhythm game on the OS app facade (no permissions): Three.js, the `@vibechain/os/loop` and `@vibechain/os/canvas` helpers, synthesized audio, a checkpoint and `game.finish`; see its README.
|
|
74
|
-
|
|
75
|
-
`examples/chonk-stack` is a complete game using this contract: vanilla
|
|
76
|
-
TypeScript and Three.js, with all geometry and textures generated locally.
|
|
77
|
-
Copy the folder into your game project, install the SDK tarball, run
|
|
78
|
-
`npm install three@0.175.0` and `npm install --save-dev @types/three@0.175.0`, then run
|
|
79
|
-
`npx esbuild main.ts --bundle --minify --target=es2022 --outfile=dist/game.js`.
|
|
80
|
-
Copy `index.html` and `vibemarket.json` into `dist/`; esbuild emits `game.css`.
|
|
81
|
-
Use a unique manifest ID/version before packaging. Its After Hours collection
|
|
82
|
-
is intentionally fixed in `skins.ts` and the manifest; change both for a new
|
|
83
|
-
collection. The package is usable under the normal opaque-origin sandbox.
|
|
84
|
-
The game pauses on blur, tab hiding, collection access, and opening the shop.
|
|
85
|
-
Scores are session-only; cosmetics never alter timing, speed, or rewards.
|
|
86
|
-
|
|
87
|
-
`profile.get`, `catalog.list`, `inventory.get`, `packs.buy`, `packs.sell`,
|
|
88
|
-
`packs.open`, `cards.reveal`, `cards.sell` and `cards.collect` each require an
|
|
89
|
-
explicit manifest permission. `ready()`, `showShop()` and the score-only `game.finish()` signal are always available; they grant no reward or transaction authority.
|
|
90
|
-
The SDK has no provider, arbitrary signing, chain RPC, wallet/session object,
|
|
91
|
-
private key, balances, recipient override or transaction calldata escape hatch.
|
|
92
|
-
`playerId` is session-local, not a durable account ID. Guest inventories are empty.
|
|
93
|
-
|
|
94
|
-
Pack actions take `(packId, quantity = 1)` (integer 1–10); card actions take
|
|
95
|
-
`cardId`. Calls return `{completed: true}` after the existing host driver
|
|
96
|
-
completes. Handle cancellation/errors and re-read inventory. On timeout check
|
|
97
|
-
inventory before retrying: a submitted transaction may still complete. The host
|
|
98
|
-
revalidates account, ownership and price after the user reviews the action.
|
|
99
|
-
Never auto-buy on game load. Only request spending following a clear player
|
|
100
|
-
interaction. Calling `showShop()` opens the trusted host rail/mobile drawer.
|
|
101
|
-
|
|
102
|
-
Collecting a non-Classic card permanently forfeits its cashout; Classic KEEP is a
|
|
103
|
-
local preference and remains sellable. Collection skins should use rarity/foil
|
|
104
|
-
or bundled artwork. Metadata image URLs are returned as data, but arbitrary
|
|
105
|
-
remote images are blocked in the runtime; the host rail renders collection art.
|
|
106
|
-
|
|
107
|
-
## Bundle and manifest
|
|
108
|
-
|
|
109
|
-
ZIP root must contain `vibemarket.json` and the declared HTML entry. All manifest
|
|
110
|
-
fields are required; unknown fields fail validation. Example:
|
|
111
|
-
|
|
112
|
-
```json
|
|
113
|
-
{
|
|
114
|
-
"schemaVersion": 1,
|
|
115
|
-
"sdkVersion": 1,
|
|
116
|
-
"id": "my-cat-game",
|
|
117
|
-
"version": "1.0.0-test.1",
|
|
118
|
-
"name": "My Cat Game",
|
|
119
|
-
"tagline": "Collect a cat. Take it for a spin.",
|
|
120
|
-
"category": "Collect · customize · play",
|
|
121
|
-
"entry": "index.html",
|
|
122
|
-
"permissions": ["profile.get", "catalog.list", "inventory.get", "packs.buy", "packs.open", "cards.reveal", "cards.collect"],
|
|
123
|
-
"collectionId": "REPLACE_WITH_A_REAL_MARKET_COLLECTION_ID"
|
|
124
|
-
}
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
Use `collectionId: null` for unbound free play; omit trading permissions in that
|
|
128
|
-
case. This release binds **one collection** per version. Get its exact ID from
|
|
129
|
-
the market catalog/developer collection selector; do not invent one. All game
|
|
130
|
-
and rail access is filtered to that collection. A missing/retired collection
|
|
131
|
-
shows an unavailable state; it does not silently bind another one. The local
|
|
132
|
-
operator approves the declared collection and permissions when publishing.
|
|
133
|
-
Changing either requires a new version. Public developer ownership approval is
|
|
134
|
-
not implemented in the local adapter.
|
|
135
|
-
|
|
136
|
-
Supported assets: HTML, JS/MJS, CSS, JSON, PNG/JPEG/WebP/GIF/AVIF/SVG/ICO (no SVG in
|
|
137
|
-
schema version 2 bundles), WOFF/
|
|
138
|
-
WOFF2/TTF/OTF, MP3/OGG/WAV, MP4/WebM, WASM/BIN/TXT. Max 20 MiB compressed,
|
|
139
|
-
64 MiB expanded, 16 MiB/file, 256 ZIP entries. No symlinks, encrypted files,
|
|
140
|
-
traversal, duplicate/case-colliding names, absolute paths or hidden paths.
|
|
141
|
-
Use ASCII filenames and normal subdirectories. WASM must run without threads;
|
|
142
|
-
workers/SharedArrayBuffer and arbitrary network access are unavailable.
|
|
143
|
-
|
|
144
|
-
```sh
|
|
145
|
-
npx vibemarket-game pack dist my-cat-game.zip
|
|
34
|
+
```ts
|
|
35
|
+
import { connectVibeMarketApp } from "@vibechain/os";
|
|
36
|
+
const app = await connectVibeMarketApp();
|
|
37
|
+
const saved = await app.checkpoint.read(); // null on first open
|
|
38
|
+
await app.checkpoint.write({ level: 2 }); // resolves after the host accepts it
|
|
39
|
+
app.lifecycle.onChanged(({ active, width, height }) => { /* pause when inactive, resize */ });
|
|
40
|
+
await app.ready(); // remove the host's loading state
|
|
41
|
+
// At the end of a game: await app.game.finish({ score: 42 });
|
|
42
|
+
window.addEventListener("pagehide", () => app.destroy(), { once: true });
|
|
146
43
|
```
|
|
147
44
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
45
|
+
That is the whole facade: readiness, lifecycle, a bounded checkpoint and one
|
|
46
|
+
score. Checkpoints are plain JSON of at most 32 KiB, kept in host memory only
|
|
47
|
+
while the window is open. `game.finish` takes one integer score from 0 to
|
|
48
|
+
1,000,000,000, once per open window; the host owns the results screen and the
|
|
49
|
+
score grants nothing. Optional helpers: `@vibechain/os/loop` (fixed-step loop
|
|
50
|
+
that pauses when inactive), `@vibechain/os/canvas` (canvas sizing and WebGL
|
|
51
|
+
context loss) and `@vibechain/os/testing` (an in-memory host for unit tests).
|
|
52
|
+
|
|
53
|
+
## What an app cannot do
|
|
54
|
+
|
|
55
|
+
An app has no access to the player's account, session, profile, Steam ID,
|
|
56
|
+
handle or balance; no inventory, wallets, purchases, trades, Cash, XP or
|
|
57
|
+
rewards; no network requests to vibechain.com APIs or other servers; no saves
|
|
58
|
+
that outlive the open window; no multiplayer or leaderboards; and no access to
|
|
59
|
+
the desktop page, other apps, Steam commands or native IPC. Requests for any of
|
|
60
|
+
these end the app's session. Never ask players to type secrets into your app.
|
|
61
|
+
|
|
62
|
+
## Manifest and listing
|
|
63
|
+
|
|
64
|
+
`vibemarket.json` sits at the root of the build. VibeStore accepts only schema
|
|
65
|
+
version 2, with every field required and unknown fields refused at every level:
|
|
66
|
+
|
|
67
|
+
- `schemaVersion: 2`, `sdkVersion: 1`, `category: "vibexp-app"`,
|
|
68
|
+
`permissions: []`, `collectionId: null`.
|
|
69
|
+
- `id`: lowercase letters, digits and single hyphens, at most 60 characters;
|
|
70
|
+
the first accepted submission claims it. `version`: semver, each submitted
|
|
71
|
+
once. `name` (60) and `tagline` (160). `entry`: the HTML file.
|
|
72
|
+
- `window`: `width` 320–1600 and `height` 200–1200 CSS pixels, `resizable`.
|
|
73
|
+
- `store.icon`: a PNG in the bundle, exactly 256 x 256, at most 256 KiB.
|
|
74
|
+
- `store.screenshots`: 1–4 PNG, JPEG or WebP files in the bundle, at most
|
|
75
|
+
1 MiB each, contents matching the extension, none the icon.
|
|
76
|
+
- `store.description`: 40–2,000 characters of plain text (line breaks allowed).
|
|
77
|
+
- `store.category`: `game`, `tool` or `toy`.
|
|
78
|
+
- `store.rating`: `violence` and `language` each `none`, `mild` or `strong`;
|
|
79
|
+
`mature` true or false. Rate honestly.
|
|
80
|
+
- `store.support`: an `https://` URL or an email address, at most 200
|
|
81
|
+
characters, shown to players and reviewers.
|
|
82
|
+
|
|
83
|
+
`os preview` and `os pack` run these checks locally. `parseManifest`
|
|
84
|
+
(`@vibechain/os/manifest`) and `checkListing` (`@vibechain/os/listing`) run them
|
|
85
|
+
in your own tools.
|
|
86
|
+
|
|
87
|
+
## Bundle rules
|
|
88
|
+
|
|
89
|
+
At most 256 entries, 16 MiB per file, 64 MiB expanded and a 20 MiB ZIP. ASCII
|
|
90
|
+
paths in normal subdirectories: no absolute or hidden paths, traversal,
|
|
91
|
+
symlinks, encrypted entries, or names that differ only by letter case. File
|
|
92
|
+
types: HTML, JS/MJS, CSS, JSON, PNG/JPEG/WebP/GIF/AVIF/ICO, WOFF/WOFF2/TTF/OTF,
|
|
93
|
+
MP3/OGG/WAV, MP4/WebM, WASM/BIN/TXT. **No SVG** anywhere, because it is a
|
|
94
|
+
document format that can carry script. Workers, `SharedArrayBuffer` and
|
|
95
|
+
threaded WASM are unavailable.
|
|
160
96
|
|
|
161
97
|
```sh
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
npx vibemarket-game upload my-cat-game.zip
|
|
165
|
-
npx vibemarket-game list
|
|
166
|
-
npx vibemarket-game publish my-cat-game 1.0.0-test.1 1
|
|
167
|
-
# Last argument = latest registry revision returned by list/upload; never guess.
|
|
168
|
-
npx vibemarket-game rollback my-cat-game 1.0.0-test.1 3
|
|
98
|
+
npm run build # the starter: type-check, bundle, then os assets copies HTML, manifest and store images
|
|
99
|
+
npm run pack # os pack dist app.zip
|
|
169
100
|
```
|
|
170
101
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
Local desktop browser/device emulation works; physical-phone/LAN previews need
|
|
198
|
-
a separately configured isolated runtime host and are not supported yet.
|
|
199
|
-
All publisher APIs and uploaded runtimes return 404 outside development. This is
|
|
200
|
-
not a public upload service. To enable public publishing, replace the local
|
|
201
|
-
adapter with authenticated developer/collection approval, object storage/CDN on
|
|
202
|
-
a separate registrable domain, transactional version registry, quotas, malware
|
|
203
|
-
review and revocation. Keep this bundle, version and SDK contract unchanged.
|
|
204
|
-
|
|
205
|
-
### Player links
|
|
206
|
-
|
|
207
|
-
Published games open at `/market/games/<manifest.id>`. Upload returns a draft
|
|
208
|
-
URL at that same path with `?preview=<version-key>`; keep the key to reopen that
|
|
209
|
-
exact version. Do not generate `?play=<id>` URLs. Existing query-style links
|
|
210
|
-
redirect for compatibility.
|
|
211
|
-
|
|
212
|
-
### Cosmetic entitlements (Chonk reference)
|
|
213
|
-
|
|
214
|
-
Read `inventory.get()` and offer equip controls only for cards whose `state` is
|
|
215
|
-
`collected`. A revealed/sealed card is not an equipped collectible. Subscribe to
|
|
216
|
-
`inventory.onChanged` and revalidate every displayed page; revoke a skin when
|
|
217
|
-
its ownership disappears. Render names as text. Never derive race odds, payouts,
|
|
218
|
-
or ownership from local storage. Chonk After Hours maps the five rarity indices
|
|
219
|
-
to five matching model palettes; foil changes no race advantage.
|
|
220
|
-
|
|
221
|
-
Ship wardrobe thumbnails inside your bundle. The Chonk packaging command copies
|
|
222
|
-
its five product images and rewrites their paths, so it works under the same
|
|
223
|
-
no-external-network policy as every uploaded game. The host records development
|
|
224
|
-
views and successful SDK boots separately; games cannot assign counter values.
|
|
102
|
+
## Submit, review and publication
|
|
103
|
+
|
|
104
|
+
1. Open VibeMarket OS in a web browser and sign in with Steam. Submitting needs
|
|
105
|
+
a Steam account; new versions of an app must come from the account that
|
|
106
|
+
first submitted it.
|
|
107
|
+
2. Open **VibeStore**, go to **Submit**, choose `app.zip` and submit it for
|
|
108
|
+
review. Refusals are explained there in plain words.
|
|
109
|
+
3. Vibechain staff review every version: they read the listing, look at the
|
|
110
|
+
file list and run the app in a sandboxed window. There is no automatic
|
|
111
|
+
approval and no promised review time. A rejection comes with a note; fix the
|
|
112
|
+
problem and submit a new version number.
|
|
113
|
+
4. **Approval is publication.** An approved version's files are copied to public
|
|
114
|
+
IPFS, and removing or revoking the app later does not recall that copy.
|
|
115
|
+
Submit only what you are willing to publish permanently. Staff choose which
|
|
116
|
+
approved version is live.
|
|
117
|
+
|
|
118
|
+
Apps open in the browser version of VibeMarket OS. The Steam client shows a
|
|
119
|
+
notice with a link instead of opening them, and the mobile apps do not run them.
|
|
120
|
+
|
|
121
|
+
## Market-game API (not for VibeStore apps)
|
|
122
|
+
|
|
123
|
+
The package still exports `connectGameSdk()`, `watchInventory()` and the schema
|
|
124
|
+
version 1 manifest with permissions and a `collectionId`. They exist for
|
|
125
|
+
Vibechain's own collection games and are not available to VibeStore apps:
|
|
126
|
+
VibeStore refuses any manifest with permissions or a collection, and an app
|
|
127
|
+
that calls them gets no economy access.
|
package/README.md
CHANGED
|
@@ -5,19 +5,19 @@ Build games, tools and desktop apps for VibeMarket OS with TypeScript. Start wit
|
|
|
5
5
|
## Quickstart
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
npx --yes @vibechain/os@0.4.
|
|
8
|
+
npx --yes @vibechain/os@0.4.1 init my-app
|
|
9
9
|
cd my-app
|
|
10
10
|
npm install
|
|
11
11
|
npm run build
|
|
12
12
|
npm run dev
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
Open the printed `http://127.0.0.1:PORT` address. Stamp Club is a complete starter: start a round, add stamps, minimize and restore, then finish to see the host's result screen. Play again starts a fresh round. Host-accepted state survives suspension in the same open window. Reset clears it. Rebuild and restart the immutable preview after changes. `npm run pack` creates `app.zip`
|
|
15
|
+
Open the printed `http://127.0.0.1:PORT` address. Stamp Club is a complete starter: start a round, add stamps, minimize and restore, then finish to see the host's result screen. Play again starts a fresh round. Host-accepted state survives suspension in the same open window. Reset clears it. Rebuild and restart the immutable preview after changes. `npm run pack` creates `app.zip`, ready to submit to VibeStore: the starter's `vibemarket.json` is already a complete listing, with placeholder text and pictures you must replace first (its README lists the fields; an unchanged starter is rejected at review).
|
|
16
16
|
|
|
17
17
|
The starter includes TypeScript and esbuild and pins your SDK version. To install from a downloaded SDK archive, supply its absolute path to npm and the initializer:
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
|
-
npm exec --yes --package=/absolute/path/vibechain-os-0.4.
|
|
20
|
+
npm exec --yes --package=/absolute/path/vibechain-os-0.4.1.tgz -- os init my-app /absolute/path/vibechain-os-0.4.1.tgz
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
That explicit fallback 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`.
|
|
@@ -41,7 +41,7 @@ window.addEventListener("pagehide", () => app.destroy(), { once: true });
|
|
|
41
41
|
|
|
42
42
|
Checkpoint is a base app capability, separate from Market permissions. It accepts only the same app's bounded JSON: ≤32 KiB UTF-8, depth8, ≤2,048 nodes, ≤64 keys/object, ≤256 items/array and ≤8KiB/string. State lives in trusted host memory, scoped to the open installation/version/identity/window; it is cleared on close, revoke, package/identity change or the controller's absolute 15-minute expiry. Suspension does not extend that lifetime. There is no arbitrary namespace, disk storage, account data or browser-restart guarantee. `write()` resolves after acknowledgement; an accepted snapshot can be restored even if that acknowledgement was interrupted.
|
|
43
43
|
|
|
44
|
-
Manifest: use `sdkVersion: 1`, category `vibexp-app`, `permissions: []` and `collectionId: null`, with `schemaVersion:
|
|
44
|
+
Manifest: use `sdkVersion: 1`, category `vibexp-app`, `permissions: []` and `collectionId: null`, with `schemaVersion: 2` and a store listing (below). Schema version 1, without a listing, still runs in the preview but cannot be submitted. App methods are deliberately limited to readiness, checkpoints and the score-only completion signal. Raw requests for profile, inventory, rewards, purchases, Steam, native IPC or wallet operations terminate this app session. Existing Market games continue using `connectGameSdk()` with their existing permissions and host transaction review.
|
|
45
45
|
|
|
46
46
|
## Game helpers (since 0.3.0)
|
|
47
47
|
|
|
@@ -126,7 +126,7 @@ VibeStore is the app store inside VibeMarket OS. You submit from its **Submit**
|
|
|
126
126
|
|
|
127
127
|
A version 2 bundle may not contain SVG files anywhere, because SVG is a document format that can carry script; use PNG or WebP. The bundle limits in [SECURITY.md](SECURITY.md) still apply, and the submitted ZIP is at most 20 MiB. Unknown fields are refused at every level. `os pack` and `os preview` run the same manifest and image checks, so a listing problem shows up locally first. To validate in your own tools, `@vibechain/os/manifest` exports `parseManifest` and the bounds, and `@vibechain/os/listing` exports `checkListing`, `pngSize` and `imageKind`, which work on plain `Uint8Array` bytes in Node or a browser.
|
|
128
128
|
|
|
129
|
-
`examples/paw-beat`
|
|
129
|
+
`examples/paw-beat` and the `os init` starter are complete version 2 listings.
|
|
130
130
|
|
|
131
131
|
## Publishing status
|
|
132
132
|
|
|
@@ -141,10 +141,10 @@ pnpm install --frozen-lockfile
|
|
|
141
141
|
pnpm review
|
|
142
142
|
pnpm build
|
|
143
143
|
pnpm check:package
|
|
144
|
-
pnpm release:preview --version 0.4.
|
|
144
|
+
pnpm release:preview --version 0.4.1
|
|
145
145
|
```
|
|
146
146
|
|
|
147
|
-
`pnpm build` emits JavaScript/declarations plus one bundled preview host UI.
|
|
147
|
+
`pnpm build` emits JavaScript/declarations plus one bundled preview host UI. Only `examples/paw-beat` and `examples/vibexp-app` are published. 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
148
|
|
|
149
149
|
## License
|
|
150
150
|
|
package/dist/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ export async function runCli(argv, runtime = createCliRuntime()) {
|
|
|
13
13
|
if (command === "init") {
|
|
14
14
|
if (!args[0] || args.length > 2)
|
|
15
15
|
throw Error("Usage: os init <empty-directory> [sdk.tgz]");
|
|
16
|
-
runtime.log(`Created ${await createApp(args[0], args[1])}. Run npm install,
|
|
16
|
+
runtime.log(`Created ${await createApp(args[0], args[1])}. Run npm install, npm run build, then npm run dev there.`);
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
if (command === "assets") {
|
package/dist/scaffold.js
CHANGED
|
@@ -20,6 +20,10 @@ export async function createApp(directory, sdkTarball) {
|
|
|
20
20
|
throw Error("Installed SDK package metadata is invalid.");
|
|
21
21
|
dependency = input.version;
|
|
22
22
|
}
|
|
23
|
+
const template = fileURLToPath(new URL("../examples/vibexp-app/", import.meta.url));
|
|
24
|
+
// The starter's own manifest names its store images, so the copy list follows the listing.
|
|
25
|
+
const starter = parseManifest(JSON.parse(new TextDecoder().decode(await readBoundedAsset(path.join(template, "vibemarket.json"), 16 * 1024))));
|
|
26
|
+
const files = ["index.html", "vibemarket.json", "README.md", "src/main.ts", ...(starter.schemaVersion === 2 ? [starter.store.icon, ...starter.store.screenshots] : [])];
|
|
23
27
|
const requested = path.resolve(directory);
|
|
24
28
|
await mkdir(requested, { recursive: true });
|
|
25
29
|
if ((await lstat(requested)).isSymbolicLink())
|
|
@@ -27,10 +31,12 @@ export async function createApp(directory, sdkTarball) {
|
|
|
27
31
|
const target = await realpath(requested);
|
|
28
32
|
if ((await readdir(target)).length)
|
|
29
33
|
throw Error("The new app directory must be empty.");
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
for (const file of files) {
|
|
35
|
+
const destination = path.join(target, file);
|
|
36
|
+
if (path.dirname(destination) !== target)
|
|
37
|
+
await mkdir(path.dirname(destination), { recursive: true });
|
|
38
|
+
await copyFile(path.join(template, file), destination);
|
|
39
|
+
}
|
|
34
40
|
await writeFile(path.join(target, "tsconfig.json"), JSON.stringify({ compilerOptions: { target: "ES2022", module: "ESNext", moduleResolution: "Bundler", lib: ["ES2022", "DOM"], strict: true, skipLibCheck: true, noEmit: true }, include: ["src/**/*.ts"] }, null, 2) + "\n", { flag: "wx" });
|
|
35
41
|
await writeFile(path.join(target, "package.json"), JSON.stringify({
|
|
36
42
|
name: "my-vibemarket-app", version: "0.1.0", private: true, type: "module",
|
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
# Stamp Club
|
|
2
2
|
|
|
3
|
-
Stamp Club is a small VibeMarket OS app built with TypeScript. Use it to try your own intro, checkpoints, window lifecycle events and a host-owned final score screen, then replace the stamp counter with your own idea.
|
|
3
|
+
Stamp Club is a small VibeMarket OS app built with TypeScript, and the starting point `os init` gives you. Use it to try your own intro, checkpoints, window lifecycle events and a host-owned final score screen, then replace the stamp counter with your own idea.
|
|
4
4
|
|
|
5
5
|
Run `npm install`, `npm run build`, then `npm run dev`. Open the printed **127.0.0.1** URL. Start a round, add stamps, minimize the window and restore it: the host restores only this app's host-accepted JSON into a fresh isolated frame. Finish the round to see the reported score. Play again creates a new controller and clears the old round. Rebuild and restart the preview after source changes.
|
|
6
6
|
|
|
7
|
-
`npm run pack` produces `app.zip` for the existing development publisher. Production app publishing remains disabled; installing the SDK does not provide a public app-store listing.
|
|
8
|
-
|
|
9
7
|
The app API has `ready()`, `checkpoint.read()/write()`, lifecycle notifications and `game.finish({score})`. Your app owns its intro/loading UI; the host owns final results. The preview awards no Cash. Checkpoints are at most 32 KiB, remain in host memory only while this window is open, and carry no account, inventory, wallet, Cash, Steam or reward authority. Native shells are unsupported. See the SDK security documentation before accepting untrusted code.
|
|
8
|
+
|
|
9
|
+
## Before you submit to VibeStore
|
|
10
|
+
|
|
11
|
+
`vibemarket.json` is already a complete VibeStore listing (manifest schema version 2), so `npm run build` and `npm run pack` produce an `app.zip` that passes the submission checks. Its listing is placeholder text and pictures of this starter, though, and **a submission of the unchanged starter will be rejected at review.** Change these first:
|
|
12
|
+
|
|
13
|
+
| Field | Change it to |
|
|
14
|
+
|---|---|
|
|
15
|
+
| `id` | Your own app ID: lowercase letters, digits and single hyphens, at most 60 characters. The first accepted submission claims an ID for its publisher. |
|
|
16
|
+
| `version` | Your version number. Each version can be submitted once; use a new one for every change. |
|
|
17
|
+
| `name` and `tagline` | Your app's name and one line about it. |
|
|
18
|
+
| `store.description` | 40 to 2,000 characters of plain text about your app. |
|
|
19
|
+
| `store.category` and `store.rating` | `game`, `tool` or `toy`, and an honest content rating. |
|
|
20
|
+
| `store.support` | Your own `https://` support page or email address. Players and reviewers see it. |
|
|
21
|
+
| `store/icon.png` | Your icon: a PNG of exactly 256 x 256 pixels, at most 256 KiB. |
|
|
22
|
+
| `store/screenshot-1.png` | 1 to 4 screenshots of your app (PNG, JPEG or WebP, at most 1 MiB each). List every file in `store.screenshots`. |
|
|
23
|
+
| `window` | The size your app's window opens at: 320 to 1600 by 200 to 1200 pixels, and whether it can be resized. |
|
|
24
|
+
|
|
25
|
+
`npm run build` copies `index.html`, `vibemarket.json` and the listed store images into `dist/`. `os preview` and `os pack` check the manifest and images, so a listing mistake shows up locally. Submit `app.zip` from the **Submit** tab of VibeStore in VibeMarket OS. A person reviews every version, and an approved version is copied to public IPFS, so approval is publication: never put anything secret in a bundle.
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1,21 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 2,
|
|
3
|
+
"sdkVersion": 1,
|
|
4
|
+
"id": "stamp-club",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"name": "Stamp Club",
|
|
7
|
+
"tagline": "A tiny VibeMarket OS app with restorable state.",
|
|
8
|
+
"category": "vibexp-app",
|
|
9
|
+
"entry": "index.html",
|
|
10
|
+
"permissions": [],
|
|
11
|
+
"collectionId": null,
|
|
12
|
+
"window": { "width": 640, "height": 480, "resizable": true },
|
|
13
|
+
"store": {
|
|
14
|
+
"icon": "store/icon.png",
|
|
15
|
+
"screenshots": ["store/screenshot-1.png"],
|
|
16
|
+
"description": "Replace this description before you submit. It is the placeholder text of the VibeMarket OS starter app, Stamp Club: start a round, add stamps, minimize and restore the window to see them come back, then finish to report a score. Describe your own app here in plain text.",
|
|
17
|
+
"category": "toy",
|
|
18
|
+
"rating": { "violence": "none", "language": "none", "mature": false },
|
|
19
|
+
"support": "https://example.com/replace-with-your-support-page"
|
|
20
|
+
}
|
|
21
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibechain/os",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"AGENTS.md",
|
|
19
19
|
"SECURITY.md",
|
|
20
20
|
"LICENSE",
|
|
21
|
-
"examples"
|
|
21
|
+
"examples/paw-beat",
|
|
22
|
+
"examples/vibexp-app"
|
|
22
23
|
],
|
|
23
24
|
"exports": {
|
|
24
25
|
".": {
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { START_WIDTH, type CardLayer } from './model';
|
|
2
|
-
|
|
3
|
-
export interface CardSlice { left: number; right: number }
|
|
4
|
-
/** UV width follows physical width, so the card's print never gets squeezed. */
|
|
5
|
-
export function centeredCardSlice(width: number): CardSlice {
|
|
6
|
-
if (!Number.isFinite(width) || width <= 0 || width > START_WIDTH) throw new Error('Invalid card slice width');
|
|
7
|
-
const span = width / START_WIDTH;
|
|
8
|
-
return { left: (1 - span) / 2, right: (1 + span) / 2 };
|
|
9
|
-
}
|
|
10
|
-
/** A landed piece and its falling offcut retain complementary parts of the incoming print. */
|
|
11
|
-
export function cutCardSlice(card: Pick<CardLayer, 'x' | 'width'>, piece: Pick<CardLayer, 'x' | 'width'>): CardSlice {
|
|
12
|
-
const source = centeredCardSlice(card.width);
|
|
13
|
-
if (![card.x, piece.x, piece.width].every(Number.isFinite) || piece.width <= 0
|
|
14
|
-
|| piece.x < card.x - 1e-7 || piece.x + piece.width > card.x + card.width + 1e-7) throw new Error('Piece is outside the card');
|
|
15
|
-
const left = source.left + (piece.x - card.x) / START_WIDTH;
|
|
16
|
-
return { left: Math.max(0, left), right: Math.min(1, left + piece.width / START_WIDTH) };
|
|
17
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import * as THREE from "three";
|
|
2
|
-
import { SKINS } from "./skins";
|
|
3
|
-
|
|
4
|
-
/** Procedural author-owned character: no host renderer or remote model. */
|
|
5
|
-
export function createChonk() {
|
|
6
|
-
const root = new THREE.Group();
|
|
7
|
-
const fur = new THREE.MeshPhysicalMaterial({ color: SKINS[0].fur, roughness: 0.4, clearcoat: 0.45 });
|
|
8
|
-
const belly = new THREE.MeshStandardMaterial({ color: SKINS[0].belly, roughness: 0.55 });
|
|
9
|
-
const pink = new THREE.MeshStandardMaterial({ color: "#ff94bd", roughness: 0.4 });
|
|
10
|
-
const black = new THREE.MeshPhysicalMaterial({ color: "#100e29", roughness: 0.25, clearcoat: 0.4, envMapIntensity: 0.2 });
|
|
11
|
-
const white = new THREE.MeshBasicMaterial({ color: "#ffffff" });
|
|
12
|
-
const gold = new THREE.MeshStandardMaterial({ color: "#ffc54f", metalness: 0.8, roughness: 0.19 });
|
|
13
|
-
const stripe = new THREE.MeshStandardMaterial({ color: "#96623d", roughness: 0.55 });
|
|
14
|
-
const ball = new THREE.SphereGeometry(1, 24, 16);
|
|
15
|
-
const mesh = (geometry: THREE.BufferGeometry, material: THREE.Material, position: number[], scale = [1, 1, 1]) => {
|
|
16
|
-
const item = new THREE.Mesh(geometry, material); item.position.set(position[0], position[1], position[2]); item.scale.set(scale[0], scale[1], scale[2]); item.castShadow = true; root.add(item); return item;
|
|
17
|
-
};
|
|
18
|
-
mesh(ball, fur, [0, 0.68, 0], [0.91, 0.67, 0.71]);
|
|
19
|
-
mesh(ball, belly, [0, 0.6, 0.54], [0.61, 0.44, 0.25]);
|
|
20
|
-
mesh(ball, fur, [0, 1.36, 0.08], [1.03, 0.75, 0.76]);
|
|
21
|
-
const ear = new THREE.ConeGeometry(0.39, 0.8, 3);
|
|
22
|
-
for (const side of [-1, 1]) {
|
|
23
|
-
const outer = mesh(ear, fur, [side * 0.67, 1.99, 0.07]); outer.rotation.z = side * -0.24; outer.rotation.y = Math.PI;
|
|
24
|
-
const inner = mesh(ear, pink, [side * 0.67, 2.02, 0.18], [0.58, 0.66, 0.58]); inner.rotation.copy(outer.rotation);
|
|
25
|
-
mesh(ball, fur, [side * 0.56, 0.12, 0.39], [0.35, 0.16, 0.35]);
|
|
26
|
-
mesh(ball, belly, [side * 0.24, 1.11, 0.75], [0.35, 0.23, 0.13]);
|
|
27
|
-
mesh(ball, pink, [side * 0.59, 1.2, 0.65], [0.17, 0.085, 0.05]);
|
|
28
|
-
mesh(ball, black, [side * 0.38, 1.45, 0.745], [0.12, 0.17, 0.075]);
|
|
29
|
-
mesh(ball, white, [side * 0.38 - 0.035, 1.5, 0.81], [0.037, 0.05, 0.015]);
|
|
30
|
-
for (let i = 0; i < 3; i++) {
|
|
31
|
-
const line = new THREE.Line(new THREE.BufferGeometry().setFromPoints([new THREE.Vector3(side * 0.58, 1.04 + i * 0.09, 0.7), new THREE.Vector3(side * 1.13, 0.98 + i * 0.15, 0.65)]), new THREE.LineBasicMaterial({ color: "#fff7eb" })); root.add(line);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
mesh(ball, pink, [0, 1.18, 0.865], [0.09, 0.065, 0.055]);
|
|
35
|
-
for (const side of [-1, 1]) {
|
|
36
|
-
const smile = new THREE.Mesh(new THREE.TorusGeometry(0.115, 0.013, 5, 12, Math.PI), black); smile.rotation.z = Math.PI; smile.position.set(side * 0.106, 1.052, 0.873); root.add(smile);
|
|
37
|
-
}
|
|
38
|
-
const tailCurve = new THREE.CatmullRomCurve3([new THREE.Vector3(0.5, 0.35, -0.4), new THREE.Vector3(1.1, 0.4, -0.65), new THREE.Vector3(1.35, 0.9, -0.4), new THREE.Vector3(1.1, 1.05, -0.28)]);
|
|
39
|
-
mesh(new THREE.TubeGeometry(tailCurve, 16, 0.17, 8, false), fur, [0, 0, 0]);
|
|
40
|
-
const glasses = new THREE.Group(), shades = new THREE.Group(), jewelry = new THREE.Group(), stripes = new THREE.Group(), bracelets = new THREE.Group();
|
|
41
|
-
root.add(glasses, shades, jewelry, stripes, bracelets);
|
|
42
|
-
for (const side of [-1, 1]) {
|
|
43
|
-
const lens = new THREE.Mesh(new THREE.TorusGeometry(0.24, 0.028, 6, 24), black); lens.position.set(side * 0.37, 1.45, 0.85); glasses.add(lens);
|
|
44
|
-
const shade = new THREE.Mesh(new THREE.BoxGeometry(0.48, 0.29, 0.06), black); shade.position.set(side * 0.37, 1.44, 0.855); shade.rotation.z = side * 0.07; shades.add(shade);
|
|
45
|
-
const bracelet = new THREE.Mesh(new THREE.TorusGeometry(0.23, 0.055, 6, 16), pink); bracelet.rotation.x = Math.PI / 2; bracelet.position.set(side * 0.56, 0.17, 0.39); bracelets.add(bracelet);
|
|
46
|
-
}
|
|
47
|
-
const bridge = new THREE.Mesh(new THREE.BoxGeometry(0.25, 0.03, 0.04), black); bridge.position.set(0, 1.47, 0.86); glasses.add(bridge); shades.add(bridge.clone());
|
|
48
|
-
const chain = new THREE.Mesh(new THREE.TorusGeometry(0.6, 0.055, 7, 28), gold); chain.rotation.x = Math.PI / 2.8; chain.position.set(0, 0.92, 0.25); jewelry.add(chain);
|
|
49
|
-
const charm = new THREE.Mesh(new THREE.OctahedronGeometry(0.14), gold); charm.position.set(0, 0.49, 0.77); jewelry.add(charm);
|
|
50
|
-
for (const x of [-0.23, 0, 0.23]) { const mark = new THREE.Mesh(new THREE.CapsuleGeometry(0.047, 0.18, 3, 6), stripe); mark.position.set(x, 1.89, 0.49); mark.rotation.x = -0.65; stripes.add(mark); }
|
|
51
|
-
return { root, skin(index: number) {
|
|
52
|
-
const look = SKINS[index] ?? SKINS[0]; fur.color.set(look.fur); belly.color.set(look.belly);
|
|
53
|
-
fur.metalness = index === 5 ? 0.45 : 0; fur.roughness = index === 5 ? 0.22 : 0.4;
|
|
54
|
-
glasses.visible = index === 3; shades.visible = index === 4; jewelry.visible = index === 5; stripes.visible = index === 1 || index === 5; bracelets.visible = index === 2;
|
|
55
|
-
stripe.color.set(index === 5 ? "#b68c28" : "#96623d");
|
|
56
|
-
} };
|
|
57
|
-
}
|