@vibechain/os 0.5.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/skill.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: vibemarket-os
3
- version: 0.5.2
4
- description: Build, test and publish a VibeMarket OS app or game with @vibechain/os 0.5.2: the connect() API, a schema 3 manifest, local checks and preview, and VibeStore submission with the human's approval.
3
+ version: 0.6.0
4
+ description: Build, test and publish a VibeMarket OS app or game with @vibechain/os 0.6.0: the connect() API, a schema 3 manifest, local checks and preview, and VibeStore submission with the human's approval.
5
5
  homepage: https://vibechain.com/os/docs
6
6
  ---
7
7
 
@@ -9,9 +9,9 @@ homepage: https://vibechain.com/os/docs
9
9
 
10
10
  Canonical URL: **https://vibechain.com/os/skill.md**. This skill covers building
11
11
  and publishing apps and games for VibeMarket OS with the npm package
12
- `@vibechain/os` 0.5.2. Re-fetch it at the start of a session; it is
12
+ `@vibechain/os` 0.6.0. Re-fetch it at the start of a session; it is
13
13
  generated from the SDK it describes, so its numbers and names are the SDK's.
14
- If `npm view @vibechain/os version` is newer than 0.5.2, re-fetch this
14
+ If `npm view @vibechain/os version` is newer than 0.6.0, re-fetch this
15
15
  file before you rely on it. For vibe.market protocol work (onchain packs,
16
16
  trading, the market API, creator launches) use the other skill,
17
17
  **https://vibechain.com/skill.md**. Human reference: https://vibechain.com/os/docs.
@@ -31,16 +31,16 @@ install script.
31
31
  Node.js `^22.23.4`, `^24.22.1` or `^26.12.1`.
32
32
 
33
33
  ```sh
34
- npx --yes @vibechain/os@0.5.2 init my-app # canvas (TypeScript + esbuild + 2D canvas)
35
- npx --yes @vibechain/os@0.5.2 init my-app --template three # TypeScript + esbuild + Three.js
36
- npx --yes @vibechain/os@0.5.2 init my-app --template plain # index.html + game.js, nothing to install
34
+ npx --yes @vibechain/os@0.6.0 init my-app # canvas (TypeScript + esbuild + 2D canvas)
35
+ npx --yes @vibechain/os@0.6.0 init my-app --template three # TypeScript + esbuild + Three.js
36
+ npx --yes @vibechain/os@0.6.0 init my-app --template plain # index.html + game.js, nothing to install
37
37
  ```
38
38
 
39
39
  Templates: `plain`, `canvas`, `three`.
40
40
 
41
41
  For `canvas` and `three`: `cd my-app && npm install && npm run build && npm run check && npm run dev`
42
42
  (the dev script runs `os preview dist`), then `npm run pack`. For `plain`:
43
- `npx @vibechain/os@0.5.2 preview my-app`, `npx @vibechain/os@0.5.2 check my-app`; the
43
+ `npx @vibechain/os@0.6.0 preview my-app`, `npx @vibechain/os@0.6.0 check my-app`; the
44
44
  folder itself is the app. Every template's `vibemarket.json` holds placeholder
45
45
  listing text and pictures: replace them, or review rejects the app.
46
46
 
@@ -140,7 +140,21 @@ const os = await connect(); // once, early; then call os.ready() when your fir
140
140
  - `await os.showCard(slug, cardId)`: VibeMarket opens that card on its pack's page (needs a click)
141
141
  - `await os.open(link)`: open a `vmos://` or pack-page link (needs a click)
142
142
  - `await os.player()`: who is playing (see below); a token only with `network`
143
- - `await os.finish({ score })`: one integer score, 0 to 1,000,000,000, once per open window
143
+ - `await os.finish({ score, board? })`: one integer score, 0 to 1,000,000,000, once per open window, posted to `board` (default `score`)
144
+ - `await os.leaderboard({ board?, scope?, period?, limit? })`: a board's top rows (`everyone` or `friends`, `all` or `week`, 1 to 50, default 10) and your place
145
+ - `await os.showLeaderboard(board?)`: vmOS opens its leaderboard panel over the app; resolves when closed (needs a click)
146
+ - `await os.unlock(id)`: record an achievement the manifest declares; `{ unlocked }` is true only the first time, and vmOS shows the toast
147
+ - `await os.achievements()`: every declared achievement with `unlocked` and `at`; secret ones stay hidden until unlocked
148
+ - `await os.friends()`: the player's friends who installed this app (`{ handle, name, picture, presence }`, presence `playing`, `online` or `offline`)
149
+ - `await os.invite({ to?, text?, data? })`: vmOS opens its invite sheet; `{ sent }` friends were invited (needs a click; not for guests)
150
+ - `os.launch.invite`: the friend's invite this app was opened with (`{ from, data }`), or null; read it once at start
151
+ - `os.onInvite(listener)`: a friend's invite arrived while the app is open; returns unsubscribe
152
+ - `await os.share({ text?, score?, board? })`: vmOS opens its share sheet with a card it composes; `{ shared }` (needs a click; not for guests)
153
+ - `await os.products()`: the manifest's products as approved, with `owned` for permanent ones the player bought
154
+ - `await os.buy(productId)`: vmOS asks the player to spend Printer Cash; the `Receipt` on confirmation (needs a click in the last second; not for guests)
155
+ - `await os.purchases()`: permanent receipts and consumables not yet consumed
156
+ - `await os.consume(receiptId)`: after granting a consumable, so it leaves `purchases()`
157
+ - `await os.receiptToken(receiptId)`: a 5-minute signed token of the receipt for your server (`network` apps only)
144
158
  - `await os.maximize(on = true)`: maximize or restore the window
145
159
  - `await os.fullscreen(on = true)`: the host makes the window full screen (needs a click; Escape leaves)
146
160
  - `os.onPause(listener)`: the window was minimized or went behind; pause
@@ -150,7 +164,7 @@ const os = await connect(); // once, early; then call os.ready() when your fir
150
164
  - `os.onCapture(handler)` (optional): supply the picture the desktop camera takes (by default your largest canvas)
151
165
  - `os.close()`: release the connection
152
166
 
153
- Without a bundler, the global `VibemarketOS` has `OsError`, `cardLink`, `connect`, `createAudio`, `packLink`, `parseVmosLink`.
167
+ Without a bundler, the global `VibemarketOS` has `OsError`, `appLink`, `cardLink`, `connect`, `createAudio`, `packLink`, `parseVmosLink`.
154
168
  `@vibechain/os/loop` (`createLoop`), `@vibechain/os/canvas` (`fitCanvas`) and
155
169
  `@vibechain/os/audio` (`createAudio`) take the `os` and pause with it; `@vibechain/os/testing` (`createFakeOs`) is an
156
170
  in-memory host for unit tests. `connectVibeMarketApp()` is the deprecated 0.4
@@ -172,6 +186,10 @@ message. A refusal keeps the app running.
172
186
  | `unavailable` | The host could not answer now; try again. | retry later; show the player a gentle message |
173
187
  | `timeout` | The host did not answer in 10 seconds. | retry once, then carry on without it |
174
188
  | `closed` | The session ended. Reopen the app. | stop; the window is gone or the session ended |
189
+ | `cancelled` | The player closed the dialog without confirming. | the player said no: carry on, and do not ask again at once |
190
+ | `insufficient` | The player does not have enough Printer Cash for that. | say the player needs more Printer Cash; never offer a top-up |
191
+ | `limit` | A limit was reached; try again another day. | a cap was reached: consume waiting purchases, or try another day |
192
+ | `guest` | Guests cannot do that; the player has to sign in. | ask the player to sign in to VibeMarket OS; the game itself keeps working |
175
193
 
176
194
  ## Manifest (`vibemarket.json`, schema version 3)
177
195
 
@@ -196,6 +214,10 @@ refused in version 3).
196
214
  | `packs` | optional; 0 to 3 pack slugs (lowercase letters, digits and single hyphens, at most 56 characters), no repeats, in listing order |
197
215
  | `cards` | optional; one of `none`, `linked`, `all` (default `none`); `linked` needs a pack in `packs` |
198
216
  | `network` | optional; 0 to 8 origins (rules below), stored lowercase and sorted |
217
+ | `leaderboards` | optional; 0 to 5 of `{ id, name, order?, format? }`: `order` `high`, `low` (default `high`), `format` `number`, `time` (default `number`; `time` is milliseconds). Every app also has the board `score` ("High scores") unless it declares that id |
218
+ | `achievements` | optional; 0 to 50 of `{ id, name, description, icon?, secret? }`; `icon` a `.png` or `.webp` in the bundle, exactly 128 x 128 pixels, at most 64 KiB |
219
+ | `products` | optional; 0 to 50 of `{ id, name, description, price, kind }`: `price` whole Printer Cash, at least 1 and within the store's maximum; `kind` `consumable`, `permanent` |
220
+ | ids, names | ids `^[a-z][a-z0-9-]{0,31}$`, unique in their list and never reused for something else; names at most 40 and descriptions at most 120 characters, one line |
199
221
 
200
222
  `network` origins must be exactly `https://host` or `wss://host` (optionally
201
223
  `:port`, never `:443`), with no path (not even `/`), query, fragment, user or
@@ -299,6 +321,8 @@ Any app may show any public pack, linked or not, with nothing declared:
299
321
  - `vmos://pack/rooftop-rats` (pattern `^vmos:\/\/pack\/([a-z0-9]+(?:-[a-z0-9]+)*)$`)
300
322
  - `vmos://card/rooftop-rats/r1` (pattern `^vmos:\/\/card\/([a-z0-9]+(?:-[a-z0-9]+)*)\/([A-Za-z0-9_-]{1,64})$`)
301
323
  - `https://vibechain.com/os/pack/rooftop-rats` (pattern `^https:\/\/(?:www\.)?vibechain\.com\/os\/pack\/([a-z0-9]+(?:-[a-z0-9]+)*)\/?$`)
324
+ - `vmos://app/paw-beat` (pattern `^vmos:\/\/app\/([a-z][a-z0-9]*(?:-[a-z0-9]+)*)$`): an app's page in MiniVibe, to install or play it
325
+ - `https://vibechain.com/os/app/paw-beat` (pattern `^https:\/\/(?:www\.)?vibechain\.com\/os\/app\/([a-z][a-z0-9]*(?:-[a-z0-9]+)*)\/?$`)
302
326
 
303
327
  Lowercase scheme and host, no percent-encoding, query, fragment, port or user; anything else answers `invalid` without reaching the host.
304
328
 
@@ -309,6 +333,51 @@ app in front and a fresh click in it; `showPack`, `showCard` and `open` share on
309
333
  only in VibeMarket's own window, and the app learns nothing about what the
310
334
  player does there.
311
335
 
336
+ ## Leaderboards, achievements, friends, invites and sharing (0.6)
337
+
338
+ `os.finish({ score, board })` also posts the score to a board (`score` unless
339
+ you name one you declared). A score counts only inside a round the server timed
340
+ (from `ready()` to the first `finish()`); a refused score never affects the
341
+ round, so never wait on or report it. `os.leaderboard()` reads a board and
342
+ `os.showLeaderboard()` opens vmOS's own panel. `os.unlock(id)` records an
343
+ achievement once and vmOS shows the toast; achievements pay nothing. `os.friends()`
344
+ lists only friends who installed your app. `os.invite()` and `os.share()` open
345
+ vmOS's sheets; the player chooses and confirms there, and you learn only the
346
+ count or whether they posted. An invited friend opens your app with
347
+ `os.launch.invite` (`{ from, data }`), or `os.onInvite` hears it while it is
348
+ open; `data` is yours, up to 256 characters (a room code, a seed). App links
349
+ `vmos://app/<appId>` open an app's page; `os.open` takes them, with a click.
350
+
351
+ Scores are reported by the app, so they are not proof of skill: a game that
352
+ needs trusted rankings keeps its own board on its own server. Guests play, but
353
+ their scores and achievements are not recorded and `share`, `invite` and `buy`
354
+ answer `guest`. Every one of these calls answers `unsupported` on a host older
355
+ than 0.6: hide the button and carry on.
356
+
357
+ ## Spending Printer Cash (0.6)
358
+
359
+ Declare each thing you sell in `products`, with its price. `os.buy(id)`, called
360
+ from a click, makes vmOS draw its own spend dialog over your app (name,
361
+ description, price, the player's balance before and after); you learn nothing
362
+ until it closes, then get a `Receipt` or `cancelled`, `insufficient` or
363
+ `limit`. You never learn the balance. The price is burned: nothing is paid to
364
+ you. A `permanent` product is owned for good (`products()` says `owned`);
365
+ buying it again returns the same receipt. A `consumable`'s receipt stays in
366
+ `purchases()` until you grant the item and call `os.consume(receipt.id)`, so a
367
+ crash in between loses nothing; read `purchases()` on every start. A `network`
368
+ app verifies a purchase on its server with `os.receiptToken(id)`. Daily
369
+ spending limits exist; their values are not published.
370
+
371
+ Products are reviewed:
372
+
373
+ - A product delivers what its name and description say, inside the app.
374
+ - No product is, or stands for, money, Nuggets, Steam items, cards, packs or
375
+ anything usable or tradable outside the app.
376
+ - A product whose result depends on chance shows its odds in the app before
377
+ the dialog can open.
378
+ - Nothing the listing's screenshots show may need a purchase.
379
+ - Prices and products change only through a new reviewed version.
380
+
312
381
  ## Rules your app must follow
313
382
 
314
383
  - **No inline scripts.** Scripts, styles and workers' first scripts load only
@@ -320,8 +389,8 @@ player does there.
320
389
  Declared servers may serve images, audio, video, fonts and data, never
321
390
  scripts, styles or workers. Your servers must answer the frame's
322
391
  `Origin: null` with `Access-Control-Allow-Origin: *` (or `null`).
323
- - **No third-party advertising or analytics SDKs**, no payments, no sign-in
324
- prompts, and **never ask the player for a password, key or seed phrase**.
392
+ - **No third-party advertising or analytics SDKs**, no payments other than
393
+ `os.buy`, no sign-in prompts, and **never ask the player for a password, key or seed phrase**.
325
394
  - **No SVG** anywhere in the bundle; use PNG or WebP.
326
395
  - **Pause when not active.** Stop simulation, audio and rendering on
327
396
  `os.onPause` and resume on `os.onResume` (or use `createLoop`).
@@ -346,12 +415,15 @@ host's own results screen says what a round paid.
346
415
 
347
416
  ## What an app must never claim or attempt
348
417
 
349
- - To sell anything, take payment, or open, buy or sell packs itself: VibeMarket's
350
- own window does that, after the player's own clicks.
418
+ - To sell anything except declared products through `os.buy`, take any other
419
+ payment, or open, buy or sell packs itself: VibeMarket's own window does that,
420
+ after the player's own clicks.
351
421
  - To grant, promise or display Cash, Nuggets, XP, items or any reward. A
352
422
  `finish({ score })` score is display data only.
353
423
  - To read or act on the player's account, wallet, balance or other apps, or to
354
424
  identify them beyond the public identity above.
425
+ - To draw anything that looks like a vmOS dialog, sheet, toast or panel: vmOS
426
+ draws its own, outside your frame.
355
427
  - To be made, endorsed or run by VibeMarket or Vibechain.
356
428
 
357
429
  ## Review and publishing