@genex-ai/embed-sdk 0.30.1 → 0.32.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/README.md +249 -3
- package/dist/{chunk-FBJN7DGJ.js → chunk-NBCL5P5V.js} +809 -67
- package/dist/chunk-QBCWKMVQ.js +534 -0
- package/dist/development.d.ts +1 -1
- package/dist/development.js +1 -1
- package/dist/index.d.ts +276 -10
- package/dist/index.js +26 -2
- package/dist/{runtime-generation-sXuSFc3c.d.ts → runtime-generation-B3oFDmCp.d.ts} +8 -0
- package/dist/sentry.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-MJPLBT3T.js +0 -264
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
import { R as RuntimeJudgeQuestion, c as RuntimeJudgeAnswer, d as RuntimeJudgmentView, a as RuntimeWorkflowInput, e as RuntimeGenerationBilling, f as RuntimeGenerationFunding, g as RuntimeGrantView, b as RuntimeGenerationView, h as RuntimeGenerationModels, i as RuntimeWorkflowOfferings } from './runtime-generation-
|
|
2
|
-
export { j as RuntimeBillingPolicy, k as RuntimeCurrency, l as RuntimeExternalProvider, m as RuntimeGenerationStatus, n as RuntimeGenerationStreamEvent, o as RuntimeGrantJudgeTerms, p as RuntimeGrantStatus, q as RuntimeGrantTerms, r as RuntimeJudgeCriterion } from './runtime-generation-
|
|
1
|
+
import { R as RuntimeJudgeQuestion, c as RuntimeJudgeAnswer, d as RuntimeJudgmentView, a as RuntimeWorkflowInput, e as RuntimeGenerationBilling, f as RuntimeGenerationFunding, g as RuntimeGrantView, b as RuntimeGenerationView, h as RuntimeGenerationModels, i as RuntimeWorkflowOfferings } from './runtime-generation-B3oFDmCp.js';
|
|
2
|
+
export { j as RuntimeBillingPolicy, k as RuntimeCurrency, l as RuntimeExternalProvider, m as RuntimeGenerationStatus, n as RuntimeGenerationStreamEvent, o as RuntimeGrantJudgeTerms, p as RuntimeGrantStatus, q as RuntimeGrantTerms, r as RuntimeJudgeCriterion } from './runtime-generation-B3oFDmCp.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Why a platform call did not happen. One vocabulary for every SDK function,
|
|
6
|
+
* whether the reason was found in the game's own page or sent back by the
|
|
7
|
+
* dashboard in `code`:
|
|
8
|
+
*
|
|
9
|
+
* - `unsupported`: this shell has no way to do it.
|
|
10
|
+
* - `needs_gesture`: the browser wants a click or a tap behind the call.
|
|
11
|
+
* - `dismissed`: the player said no.
|
|
12
|
+
* - `busy`: another confirmation is already on screen.
|
|
13
|
+
* - `rate_limited`: this game asked too often.
|
|
14
|
+
* - `invalid_request`: the arguments are outside the bounds below.
|
|
15
|
+
* - `too_large`: the file is over `SAVE_MAX_BYTES`.
|
|
16
|
+
* - `timeout`: no answer came back. Only the SDK reports this one.
|
|
17
|
+
*/
|
|
18
|
+
declare const PLATFORM_ERRORS: readonly ["unsupported", "needs_gesture", "dismissed", "busy", "rate_limited", "invalid_request", "too_large", "timeout"];
|
|
19
|
+
type PlatformError = (typeof PLATFORM_ERRORS)[number];
|
|
3
20
|
|
|
4
21
|
/** A thing the game sells. Resolved server-side; the game never sets a price. */
|
|
5
22
|
interface ShopItem {
|
|
@@ -290,10 +307,25 @@ interface SpendGrantResult {
|
|
|
290
307
|
grantId?: string;
|
|
291
308
|
/** The authoritative server view: limit, spend, counts and the frozen terms. */
|
|
292
309
|
grant?: RuntimeGrantView;
|
|
310
|
+
/** Why a `failed` result failed, as a code for generationErrorMessage(). */
|
|
293
311
|
error?: string;
|
|
294
312
|
}
|
|
295
313
|
/** Read a budget: limit, spend, calls and status. Scoped to this player AND this game. */
|
|
296
314
|
declare function getSpendGrant(grantId: string): Promise<RuntimeGrantView>;
|
|
315
|
+
/**
|
|
316
|
+
* This player's live budget in this game, or `null` when there is none (0.31.0).
|
|
317
|
+
*
|
|
318
|
+
* Genex keeps ONE live budget per player per game, and a newer approval
|
|
319
|
+
* replaces it — so a game that already has one running (after a reload, in a
|
|
320
|
+
* new session, or after losing the id requestSpendGrant() gave it) reuses it
|
|
321
|
+
* here instead of asking the player to approve another. "Live" means it can
|
|
322
|
+
* run calls now or once its reason clears (an empty wallet, the player's own
|
|
323
|
+
* plan asking to wait); a stopped, expired or used-up budget is not returned.
|
|
324
|
+
* Scoped by the player's token to this player AND this game. Rejects like the
|
|
325
|
+
* other budget helpers (`no_player_session` for a guest, the server's code
|
|
326
|
+
* otherwise); only "none" is `null`.
|
|
327
|
+
*/
|
|
328
|
+
declare function getActiveSpendGrant(): Promise<RuntimeGrantView | null>;
|
|
297
329
|
/**
|
|
298
330
|
* Release a budget when the feature that needed it ends. Stopping is
|
|
299
331
|
* PROSPECTIVE: calls already started finish and are charged. The player has the
|
|
@@ -309,6 +341,11 @@ declare function stopSpendGrant(grantId: string): Promise<RuntimeGrantView>;
|
|
|
309
341
|
* Resolves `active` once the budget can serve calls; pass its `grantId` to
|
|
310
342
|
* generate() from then on. A player who closes the sheet resolves `canceled`.
|
|
311
343
|
* Store the id: getSpendGrant(id) recovers the budget after a reload.
|
|
344
|
+
*
|
|
345
|
+
* Genex keeps one live budget per player per game, and the newest approval
|
|
346
|
+
* REPLACES the running one (the sheet tells the player so before they
|
|
347
|
+
* approve). So ask getActiveSpendGrant() first: a game that reuses the running
|
|
348
|
+
* budget does not ask the player again every session.
|
|
312
349
|
*/
|
|
313
350
|
declare function requestSpendGrant(options: SpendGrantOptions): Promise<SpendGrantResult>;
|
|
314
351
|
interface GenerateStreamOptions extends GenerateOptions {
|
|
@@ -382,6 +419,137 @@ declare function judge(options: JudgeOptions): Promise<JudgeResult>;
|
|
|
382
419
|
*/
|
|
383
420
|
declare function generationErrorMessage(code: string | undefined): string;
|
|
384
421
|
|
|
422
|
+
/** How a platform call ended: done, or not done and the one reason why. */
|
|
423
|
+
type PlatformOutcome = {
|
|
424
|
+
ok: true;
|
|
425
|
+
} | {
|
|
426
|
+
ok: false;
|
|
427
|
+
error: PlatformError;
|
|
428
|
+
};
|
|
429
|
+
interface ShareOptions {
|
|
430
|
+
/**
|
|
431
|
+
* A line to go with the link ("Join my room"). The system share sheet shows
|
|
432
|
+
* it; when the link is copied instead, only the link is copied.
|
|
433
|
+
*/
|
|
434
|
+
text?: string;
|
|
435
|
+
/**
|
|
436
|
+
* Your own parameters for the link, e.g. `{ room: 'abc' }`. Whoever opens it
|
|
437
|
+
* reads them back with `getEntry().params`. `embed`, `ref`, `s`, `from`,
|
|
438
|
+
* `remix`, `slug` and every name starting `genex_` are the platform's and
|
|
439
|
+
* are left out.
|
|
440
|
+
*/
|
|
441
|
+
params?: Record<string, string | number | boolean>;
|
|
442
|
+
}
|
|
443
|
+
interface ShareResult {
|
|
444
|
+
/**
|
|
445
|
+
* `shared`: the system share sheet took it. `copied`: no sheet here, the
|
|
446
|
+
* link is on the clipboard. `dismissed`: the player closed the sheet.
|
|
447
|
+
* `unavailable`: neither worked; show `url` so the player can copy it.
|
|
448
|
+
*/
|
|
449
|
+
status: 'shared' | 'copied' | 'dismissed' | 'unavailable';
|
|
450
|
+
/** The link, built by the SDK: the game's page, plus your `params`. */
|
|
451
|
+
url: string;
|
|
452
|
+
}
|
|
453
|
+
type HapticKind = 'selection' | 'light' | 'medium' | 'heavy' | 'success' | 'warning' | 'error';
|
|
454
|
+
/** What supports() can be asked about: one name per function in this module. */
|
|
455
|
+
type PlatformFeature = 'share' | 'copy' | 'awake' | 'haptic' | 'open' | 'save' | 'fullscreen';
|
|
456
|
+
/**
|
|
457
|
+
* Share this game. The link is the SDK's to build, never the caller's: the
|
|
458
|
+
* game's page on Genex (on a creator's own domain, that address), plus your
|
|
459
|
+
* `params`, which come back through `getEntry().params` for whoever opens it.
|
|
460
|
+
*
|
|
461
|
+
* **Call it from a click or tap handler.** It opens the system share sheet
|
|
462
|
+
* where the browser has one; where it has none it copies the link and says
|
|
463
|
+
* `copied`; and when neither works it hands the link back as `unavailable`,
|
|
464
|
+
* for the game to show. An open sheet is waited on for as long as the player
|
|
465
|
+
* keeps it open: no timer ends it. On a dev server (local test mode) the sheet
|
|
466
|
+
* is never opened, so an automated browser is not left waiting on it.
|
|
467
|
+
*
|
|
468
|
+
* ```ts
|
|
469
|
+
* inviteButton.addEventListener('click', async () => {
|
|
470
|
+
* const { status, url } = await share({ text: 'Join my room', params: { room } });
|
|
471
|
+
* if (status === 'copied') toast('Link copied');
|
|
472
|
+
* if (status === 'unavailable') showLink(url);
|
|
473
|
+
* });
|
|
474
|
+
* ```
|
|
475
|
+
*/
|
|
476
|
+
declare function share(options?: ShareOptions): Promise<ShareResult>;
|
|
477
|
+
/**
|
|
478
|
+
* Copy text to the clipboard. **Call it from a click or tap handler.**
|
|
479
|
+
*
|
|
480
|
+
* The Clipboard API first. In a frame it works only where the page around the
|
|
481
|
+
* game delegates it, so its refusal is followed by the older selection copy,
|
|
482
|
+
* which a frame is allowed after a tap either way.
|
|
483
|
+
*/
|
|
484
|
+
declare function copyText(text: string): Promise<PlatformOutcome>;
|
|
485
|
+
/**
|
|
486
|
+
* Keep the screen from dimming and locking (`true`), or stop (`false`): a
|
|
487
|
+
* cutscene, a tilt or gamepad game nobody is touching.
|
|
488
|
+
*
|
|
489
|
+
* The browser drops the lock whenever the tab is hidden; it is taken again
|
|
490
|
+
* when the player comes back, for as long as this is on. In the Genex app the
|
|
491
|
+
* screen already stays on while a game is open, so this resolves `ok` there
|
|
492
|
+
* without asking for anything.
|
|
493
|
+
*/
|
|
494
|
+
declare function keepAwake(on: boolean): Promise<PlatformOutcome>;
|
|
495
|
+
/**
|
|
496
|
+
* A short vibration, by kind. Fire and forget: no result, never throws.
|
|
497
|
+
*
|
|
498
|
+
* It buzzes where the browser can (Android browsers, after the player's first
|
|
499
|
+
* tap). It does nothing on an iPhone, whose browsers have no vibration, and
|
|
500
|
+
* nothing in the Genex app, whose own haptics are not open to games. Use it as
|
|
501
|
+
* a garnish, never as the only signal that something happened.
|
|
502
|
+
*/
|
|
503
|
+
declare function haptic(kind: HapticKind): void;
|
|
504
|
+
/**
|
|
505
|
+
* Open a link in a new tab: a Discord invite, the creator's site, credits.
|
|
506
|
+
* `https://` only, at most 2048 characters. **Call it from a click or tap
|
|
507
|
+
* handler.**
|
|
508
|
+
*
|
|
509
|
+
* On the Genex game page the dashboard asks the player first, showing where
|
|
510
|
+
* the link goes, and opens it on their click there; `dismissed` is their no.
|
|
511
|
+
* On the game's own address it is a new tab. In the Genex app links out of a
|
|
512
|
+
* game are not available (`unsupported`): show the address instead.
|
|
513
|
+
*/
|
|
514
|
+
declare function openExternal(url: string): Promise<PlatformOutcome>;
|
|
515
|
+
/**
|
|
516
|
+
* Save a file to the player's device: a screenshot, a replay, an export.
|
|
517
|
+
* **Call it from a click or tap handler.**
|
|
518
|
+
*
|
|
519
|
+
* The same bounds in every shell, so a save that works on the game's own link
|
|
520
|
+
* works on Genex: at most 50 MB; PNG, JPEG, WebP, WebM, MP4, JSON or plain
|
|
521
|
+
* text (the Blob's `type`); a file name of 1 to 128 characters with no path
|
|
522
|
+
* in it. The saved file's extension follows the type, whatever the name says.
|
|
523
|
+
*
|
|
524
|
+
* On the Genex game page the dashboard asks the player first and saves on
|
|
525
|
+
* their click there. In the Genex app it is not available (`unsupported`).
|
|
526
|
+
*/
|
|
527
|
+
declare function saveFile(file: Blob, name: string): Promise<PlatformOutcome>;
|
|
528
|
+
/**
|
|
529
|
+
* Enter (`true`) or leave (`false`) fullscreen. **Call it from a click or tap
|
|
530
|
+
* handler.**
|
|
531
|
+
*
|
|
532
|
+
* On the Genex game page this is the PAGE's fullscreen, the one its own
|
|
533
|
+
* button gives, so the page's controls stay on top of the game. A game's own
|
|
534
|
+
* `requestFullscreen()` fullscreens only the frame's document, and does
|
|
535
|
+
* nothing at all on a phone whose browser has no element fullscreen. On the
|
|
536
|
+
* game's own address it is the browser's fullscreen. In the Genex app the
|
|
537
|
+
* game already has the whole screen and there is nothing to toggle
|
|
538
|
+
* (`unsupported`).
|
|
539
|
+
*/
|
|
540
|
+
declare function setFullscreen(on: boolean): Promise<PlatformOutcome>;
|
|
541
|
+
/**
|
|
542
|
+
* Whether a function here can do its job in this shell and this browser:
|
|
543
|
+
* `supports('open')` for `openExternal()`, `'save'` for `saveFile()`, `'copy'`
|
|
544
|
+
* for `copyText()`, `'awake'` for `keepAwake()`, and the rest by name.
|
|
545
|
+
* Synchronous, for deciding whether to draw a button at all.
|
|
546
|
+
*
|
|
547
|
+
* On the Genex game page the answer for `open`, `save` and the page's
|
|
548
|
+
* fullscreen arrives with the identity handshake: ask after `waitForPlayer()`.
|
|
549
|
+
* A hint, not a promise. The call's own result is the truth.
|
|
550
|
+
*/
|
|
551
|
+
declare function supports(feature: PlatformFeature): boolean;
|
|
552
|
+
|
|
385
553
|
interface EmbedConfig {
|
|
386
554
|
/** This game's own slug (GENEX.slug) — identifies the project to /play/authorize. */
|
|
387
555
|
slug: string;
|
|
@@ -407,6 +575,39 @@ interface EmbedUser {
|
|
|
407
575
|
}
|
|
408
576
|
type AuthState = 'pending' | 'authenticated' | 'guest' | 'blocked';
|
|
409
577
|
type EmbedEvent = 'authenticated' | 'guest' | 'blocked' | 'error';
|
|
578
|
+
/** The link this page was opened with — see getEntry(). */
|
|
579
|
+
interface EmbedEntry {
|
|
580
|
+
/**
|
|
581
|
+
* The link's own query: `?room=abc&film`, or `''`. The pairs the visitor's
|
|
582
|
+
* link carried, in their order and byte for byte, minus the platform's keys:
|
|
583
|
+
* `embed` and everything starting `genex_`, wherever the game runs. A link
|
|
584
|
+
* to the game's page on Genex, and one opened in the Genex app, also loses
|
|
585
|
+
* `ref`, `s`, `from`, `remix` and `slug`, which Genex reads there itself; on
|
|
586
|
+
* the game's own address those five reach the game.
|
|
587
|
+
*/
|
|
588
|
+
search: string;
|
|
589
|
+
/** The same query, parsed. A fresh object on every call. */
|
|
590
|
+
params: URLSearchParams;
|
|
591
|
+
/**
|
|
592
|
+
* The link's own fragment: `#lobby`, or `''`. A fragment that contains
|
|
593
|
+
* `genex_` is never carried, and on the game's page on Genex neither is
|
|
594
|
+
* `#credits`, which opens Genex's own settings there.
|
|
595
|
+
*/
|
|
596
|
+
hash: string;
|
|
597
|
+
/**
|
|
598
|
+
* The origin of the site the visitor came from (`https://example.com`), or
|
|
599
|
+
* null when there is none or it is not known. Never a path or a query.
|
|
600
|
+
* Attribution data, not a credential: a link can claim any origin.
|
|
601
|
+
*/
|
|
602
|
+
referrer: string | null;
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Where the game is running — see getShell(). `page`: in a frame, which is its
|
|
606
|
+
* Genex game page or any other page that embeds it. `app`: the Genex mobile
|
|
607
|
+
* app. `standalone`: its own tab on its own address. `local`: a dev server in
|
|
608
|
+
* local test mode.
|
|
609
|
+
*/
|
|
610
|
+
type EmbedShell = 'page' | 'app' | 'standalone' | 'local';
|
|
410
611
|
interface PlayerStateResult {
|
|
411
612
|
/** The saved blob, or null when this player never saved. For guests: the queued pending save, if any. */
|
|
412
613
|
data: unknown;
|
|
@@ -438,7 +639,8 @@ interface SaveStateResult {
|
|
|
438
639
|
conflict?: boolean;
|
|
439
640
|
/** True when the caller is a guest — accounts save, guests don't. */
|
|
440
641
|
guest?: boolean;
|
|
441
|
-
/** True when
|
|
642
|
+
/** True when a guest's value was held in memory for this page load. It is sent only if an
|
|
643
|
+
* account arrives without a reload, which no Genex shell does today: signing in loads the game again. */
|
|
442
644
|
queued?: boolean;
|
|
443
645
|
/**
|
|
444
646
|
* True when the build is running on the PREVIEW channel (the owner's draft
|
|
@@ -455,7 +657,8 @@ interface SubmitScoreResult {
|
|
|
455
657
|
/** True when this submit improved the player's best. */
|
|
456
658
|
improved?: boolean;
|
|
457
659
|
guest?: boolean;
|
|
458
|
-
/** True when
|
|
660
|
+
/** True when a guest's score was held in memory for this page load. It is sent only if an
|
|
661
|
+
* account arrives without a reload, which no Genex shell does today. */
|
|
459
662
|
queued?: boolean;
|
|
460
663
|
}
|
|
461
664
|
interface LeaderboardEntry {
|
|
@@ -576,6 +779,60 @@ declare function initEmbed(cfg: EmbedConfig): void;
|
|
|
576
779
|
* "is authenticated". True even before the handshake resolves.
|
|
577
780
|
*/
|
|
578
781
|
declare function isEmbedded(): boolean;
|
|
782
|
+
/**
|
|
783
|
+
* The link this page was opened with, and where the visitor came from: the
|
|
784
|
+
* same answer in every shell, whenever it is asked.
|
|
785
|
+
*
|
|
786
|
+
* Read the game's own URL parameters HERE rather than from `location`. On a
|
|
787
|
+
* standalone visit the page first loads with Genex's return fragment in the
|
|
788
|
+
* address bar; initEmbed() puts the game's own fragment back, but that rewrite
|
|
789
|
+
* fires no `hashchange`, so code that read `location.hash` before initEmbed()
|
|
790
|
+
* saw the wrong one and is never told. This is right before and after. And
|
|
791
|
+
* `document.referrer` is the Genex dashboard after the sign-in round trip (and
|
|
792
|
+
* inside the game page); `referrer` here is the site the visitor came from.
|
|
793
|
+
*
|
|
794
|
+
* `referrer` is resolved once per browser tab and kept in the tab's
|
|
795
|
+
* sessionStorage, so a reload answers the same. Where the browser withholds
|
|
796
|
+
* that storage from the game (site data blocked) there is nowhere to keep it,
|
|
797
|
+
* and a reload answers from what that load was handed: `null`, or Genex's own
|
|
798
|
+
* origin, never again the site the visitor first came from. A shell older
|
|
799
|
+
* than this SDK carries less: whatever it did not send is empty or null,
|
|
800
|
+
* never an error.
|
|
801
|
+
*/
|
|
802
|
+
declare function getEntry(): EmbedEntry;
|
|
803
|
+
/**
|
|
804
|
+
* Which shell the game is running in. Synchronous, and safe before
|
|
805
|
+
* initEmbed(): `page` inside a frame (the Genex game page, or any other page
|
|
806
|
+
* that embeds the game), `app` inside the Genex mobile app, `local` on a dev
|
|
807
|
+
* server in local test mode, `standalone` on the game's own address in a
|
|
808
|
+
* browser tab (and anywhere that is not a browser at all).
|
|
809
|
+
*
|
|
810
|
+
* `app` is read off the WebView itself: a top-level page with a
|
|
811
|
+
* `window.ReactNativeWebView` bridge, whether or not the address carries the
|
|
812
|
+
* app's entry marker. The app also opens games on an address without one, and
|
|
813
|
+
* what a game may do in that WebView (no new window, no download, no leaving
|
|
814
|
+
* the game) is the same either way. So the answer is `app` in any React Native
|
|
815
|
+
* WebView, and it can be `app` while the game signs in the way a browser tab
|
|
816
|
+
* does: identity takes the native handshake only on both signals.
|
|
817
|
+
*
|
|
818
|
+
* A fact about the page, not about the player: who is signed in is
|
|
819
|
+
* getAuthState(), and nothing here is a permission.
|
|
820
|
+
*/
|
|
821
|
+
declare function getShell(): EmbedShell;
|
|
822
|
+
/**
|
|
823
|
+
* Run `cb` when the shell is taking the page away: the browser's `pagehide`
|
|
824
|
+
* (the tab closed, reloaded or navigated away) and the mobile app's `cancel`.
|
|
825
|
+
* The moment for a last savePlayerState(). On the browser's `pagehide` a small
|
|
826
|
+
* save still lands (fetch keepalive). The app takes its WebView away a moment
|
|
827
|
+
* after `cancel`, and a save started there is not known to finish first.
|
|
828
|
+
* Called once per closing; a page the browser brings back from its
|
|
829
|
+
* back/forward cache can close again. Returns an unsubscribe function.
|
|
830
|
+
*
|
|
831
|
+
* The last chance to save, not the only one: a phone can drop a backgrounded
|
|
832
|
+
* tab without telling the page, so save as the game goes. `cb` cannot keep the
|
|
833
|
+
* page open and cannot ask the player anything.
|
|
834
|
+
*/
|
|
835
|
+
declare function onShellClosing(cb: () => void): () => void;
|
|
579
836
|
/**
|
|
580
837
|
* Current auth state. Synchronous; starts 'pending', ends 'authenticated',
|
|
581
838
|
* 'guest' (accountless guest play) or 'blocked'. A 'guest' session may still
|
|
@@ -653,8 +910,12 @@ declare function on(event: EmbedEvent, cb: (ctx?: EventContext) => void): () =>
|
|
|
653
910
|
declare function loadPlayerState(): Promise<PlayerStateResult>;
|
|
654
911
|
/**
|
|
655
912
|
* Save THIS player's own slot (any JSON ≤ 256KB; last-write-wins on their own
|
|
656
|
-
* row). Guests:
|
|
657
|
-
*
|
|
913
|
+
* row). Guests: nothing is saved. The value is held in memory for this page
|
|
914
|
+
* load ({ saved: false, guest: true, queued: true }) and flushed only if an
|
|
915
|
+
* account arrives without a reload. No Genex shell does that today (signing in
|
|
916
|
+
* loads the game again), so a game that wants a guest's progress to survive
|
|
917
|
+
* keeps its own copy and starts from it, saving it, when the account loads
|
|
918
|
+
* with no save of its own.
|
|
658
919
|
* On the preview channel: { saved: false, staging: true }, nothing queued
|
|
659
920
|
* (nothing would ever flush it) and no `error` event — keep it in localStorage.
|
|
660
921
|
* Pass { ifVersion } (from the last load/save) to detect same-account
|
|
@@ -690,8 +951,9 @@ declare function saveWorldState(data: unknown, opts?: {
|
|
|
690
951
|
* Submit a score (soft-trust leaderboards: identity is verified server-side,
|
|
691
952
|
* one row per real player per board). Keep-best: only a strictly better score
|
|
692
953
|
* moves the row — `mode: "min"` for lap-time-style boards (send a consistent
|
|
693
|
-
* mode per board). Guests:
|
|
694
|
-
*
|
|
954
|
+
* mode per board). Guests: nothing is posted. The BEST value per board is
|
|
955
|
+
* held in memory for this page load and submitted only if an account arrives
|
|
956
|
+
* without a reload, which no Genex shell does today.
|
|
695
957
|
*/
|
|
696
958
|
declare function submitScore(score: number, opts?: {
|
|
697
959
|
board?: string;
|
|
@@ -774,16 +1036,20 @@ declare function listEvents<T = unknown>(stream: string, opts?: {
|
|
|
774
1036
|
* @internal — for ./sentry.ts ONLY, not public API (games never call this).
|
|
775
1037
|
* If the URL fragment carries any genex marker (`genex_ticket` — a secret —
|
|
776
1038
|
* or the inert `genex_guest`), move it out of the URL (so no recorder/logger
|
|
777
|
-
* ever sees it) into a stash the standalone flow reads.
|
|
1039
|
+
* ever sees it) into a stash the standalone flow reads. The game's own
|
|
1040
|
+
* fragment, carried inside it, goes back into the URL in the same step.
|
|
778
1041
|
*/
|
|
779
1042
|
declare function _stashTicketFromUrl(): void;
|
|
780
1043
|
declare function __resetForTests(overrides?: {
|
|
781
1044
|
handshakeTimeoutMs?: number;
|
|
1045
|
+
standaloneWatchdogGraceMs?: number;
|
|
782
1046
|
refreshDelayMs?: number;
|
|
783
1047
|
refreshRetryMs?: number;
|
|
784
1048
|
overlayTextDelayMs?: number;
|
|
785
1049
|
nativeReauthTimeoutMs?: number;
|
|
786
1050
|
heartbeatIntervalMs?: number;
|
|
1051
|
+
platformReplyTimeoutMs?: number;
|
|
1052
|
+
platformConfirmTimeoutMs?: number;
|
|
787
1053
|
}): void;
|
|
788
1054
|
|
|
789
|
-
export { type AppendEventResult, type AuthState, type DeleteSharedResult, type EmbedConfig, type EmbedEvent, type EmbedUser, type Entitlement, type GenerateOptions, type GenerateStreamOptions, type JudgeOptions, type JudgeResult, type Leaderboard, type LeaderboardEntry, type PlayerStateResult, type PurchaseResult, type PurchaseStatus, type PutSharedResult, type RequestWorkflowOptions, RuntimeGenerationBilling, RuntimeGenerationFunding, RuntimeGenerationModels, type RuntimeGenerationResult, RuntimeGenerationView, RuntimeGrantView, RuntimeJudgeAnswer, RuntimeJudgeQuestion, RuntimeJudgmentView, type RuntimeWorkflowAuthorization, RuntimeWorkflowInput, RuntimeWorkflowOfferings, type SaveStateResult, type SharedEventPage, type SharedEventRecord, type SharedObject, type SharedObjectInfo, type SharedPage, type ShopItem, type SpendGrantDisclosure, type SpendGrantOptions, type SpendGrantResult, type SubmitScoreResult, type WorldStateResult, __resetForTests, _stashTicketFromUrl, appendEvent, buy, consumeEntitlement, deleteShared, generate, generateStream, generationErrorMessage, getAuthState, getColyseusAuth, getColyseusUrls, getEmbedToken, getEntitlements, getGeneration, getGenerationModels, getLeaderboard, getShared, getShop, getSpendGrant, getUser, getWorkflowOfferings, initEmbed, isEmbedded, judge, listEvents, listShared, loadPlayerState, loadWorldState, on, putShared, requestSpendGrant, requestWorkflow, resumeWorkflow, savePlayerState, saveWorldState, stopSpendGrant, submitScore, waitForAuth, waitForGeneration, waitForPlayer };
|
|
1055
|
+
export { type AppendEventResult, type AuthState, type DeleteSharedResult, type EmbedConfig, type EmbedEntry, type EmbedEvent, type EmbedShell, type EmbedUser, type Entitlement, type GenerateOptions, type GenerateStreamOptions, type HapticKind, type JudgeOptions, type JudgeResult, type Leaderboard, type LeaderboardEntry, type PlatformError, type PlatformFeature, type PlatformOutcome, type PlayerStateResult, type PurchaseResult, type PurchaseStatus, type PutSharedResult, type RequestWorkflowOptions, RuntimeGenerationBilling, RuntimeGenerationFunding, RuntimeGenerationModels, type RuntimeGenerationResult, RuntimeGenerationView, RuntimeGrantView, RuntimeJudgeAnswer, RuntimeJudgeQuestion, RuntimeJudgmentView, type RuntimeWorkflowAuthorization, RuntimeWorkflowInput, RuntimeWorkflowOfferings, type SaveStateResult, type ShareOptions, type ShareResult, type SharedEventPage, type SharedEventRecord, type SharedObject, type SharedObjectInfo, type SharedPage, type ShopItem, type SpendGrantDisclosure, type SpendGrantOptions, type SpendGrantResult, type SubmitScoreResult, type WorldStateResult, __resetForTests, _stashTicketFromUrl, appendEvent, buy, consumeEntitlement, copyText, deleteShared, generate, generateStream, generationErrorMessage, getActiveSpendGrant, getAuthState, getColyseusAuth, getColyseusUrls, getEmbedToken, getEntitlements, getEntry, getGeneration, getGenerationModels, getLeaderboard, getShared, getShell, getShop, getSpendGrant, getUser, getWorkflowOfferings, haptic, initEmbed, isEmbedded, judge, keepAwake, listEvents, listShared, loadPlayerState, loadWorldState, on, onShellClosing, openExternal, putShared, requestSpendGrant, requestWorkflow, resumeWorkflow, saveFile, savePlayerState, saveWorldState, setFullscreen, share, stopSpendGrant, submitScore, supports, waitForAuth, waitForGeneration, waitForPlayer };
|
package/dist/index.js
CHANGED
|
@@ -4,83 +4,107 @@ import {
|
|
|
4
4
|
appendEvent,
|
|
5
5
|
buy,
|
|
6
6
|
consumeEntitlement,
|
|
7
|
+
copyText,
|
|
7
8
|
deleteShared,
|
|
8
9
|
generate,
|
|
9
10
|
generateStream,
|
|
10
11
|
generationErrorMessage,
|
|
12
|
+
getActiveSpendGrant,
|
|
11
13
|
getAuthState,
|
|
12
14
|
getColyseusAuth,
|
|
13
15
|
getColyseusUrls,
|
|
14
16
|
getEmbedToken,
|
|
15
17
|
getEntitlements,
|
|
18
|
+
getEntry,
|
|
16
19
|
getGeneration,
|
|
17
20
|
getGenerationModels,
|
|
18
21
|
getLeaderboard,
|
|
19
22
|
getShared,
|
|
23
|
+
getShell,
|
|
20
24
|
getShop,
|
|
21
25
|
getSpendGrant,
|
|
22
26
|
getUser,
|
|
23
27
|
getWorkflowOfferings,
|
|
28
|
+
haptic,
|
|
24
29
|
initEmbed,
|
|
25
30
|
isEmbedded,
|
|
26
31
|
judge,
|
|
32
|
+
keepAwake,
|
|
27
33
|
listEvents,
|
|
28
34
|
listShared,
|
|
29
35
|
loadPlayerState,
|
|
30
36
|
loadWorldState,
|
|
31
37
|
on,
|
|
38
|
+
onShellClosing,
|
|
39
|
+
openExternal,
|
|
32
40
|
putShared,
|
|
33
41
|
requestSpendGrant,
|
|
34
42
|
requestWorkflow,
|
|
35
43
|
resumeWorkflow,
|
|
44
|
+
saveFile,
|
|
36
45
|
savePlayerState,
|
|
37
46
|
saveWorldState,
|
|
47
|
+
setFullscreen,
|
|
48
|
+
share,
|
|
38
49
|
stopSpendGrant,
|
|
39
50
|
submitScore,
|
|
51
|
+
supports,
|
|
40
52
|
waitForAuth,
|
|
41
53
|
waitForGeneration,
|
|
42
54
|
waitForPlayer
|
|
43
|
-
} from "./chunk-
|
|
44
|
-
import "./chunk-
|
|
55
|
+
} from "./chunk-NBCL5P5V.js";
|
|
56
|
+
import "./chunk-QBCWKMVQ.js";
|
|
45
57
|
export {
|
|
46
58
|
__resetForTests,
|
|
47
59
|
_stashTicketFromUrl,
|
|
48
60
|
appendEvent,
|
|
49
61
|
buy,
|
|
50
62
|
consumeEntitlement,
|
|
63
|
+
copyText,
|
|
51
64
|
deleteShared,
|
|
52
65
|
generate,
|
|
53
66
|
generateStream,
|
|
54
67
|
generationErrorMessage,
|
|
68
|
+
getActiveSpendGrant,
|
|
55
69
|
getAuthState,
|
|
56
70
|
getColyseusAuth,
|
|
57
71
|
getColyseusUrls,
|
|
58
72
|
getEmbedToken,
|
|
59
73
|
getEntitlements,
|
|
74
|
+
getEntry,
|
|
60
75
|
getGeneration,
|
|
61
76
|
getGenerationModels,
|
|
62
77
|
getLeaderboard,
|
|
63
78
|
getShared,
|
|
79
|
+
getShell,
|
|
64
80
|
getShop,
|
|
65
81
|
getSpendGrant,
|
|
66
82
|
getUser,
|
|
67
83
|
getWorkflowOfferings,
|
|
84
|
+
haptic,
|
|
68
85
|
initEmbed,
|
|
69
86
|
isEmbedded,
|
|
70
87
|
judge,
|
|
88
|
+
keepAwake,
|
|
71
89
|
listEvents,
|
|
72
90
|
listShared,
|
|
73
91
|
loadPlayerState,
|
|
74
92
|
loadWorldState,
|
|
75
93
|
on,
|
|
94
|
+
onShellClosing,
|
|
95
|
+
openExternal,
|
|
76
96
|
putShared,
|
|
77
97
|
requestSpendGrant,
|
|
78
98
|
requestWorkflow,
|
|
79
99
|
resumeWorkflow,
|
|
100
|
+
saveFile,
|
|
80
101
|
savePlayerState,
|
|
81
102
|
saveWorldState,
|
|
103
|
+
setFullscreen,
|
|
104
|
+
share,
|
|
82
105
|
stopSpendGrant,
|
|
83
106
|
submitScore,
|
|
107
|
+
supports,
|
|
84
108
|
waitForAuth,
|
|
85
109
|
waitForGeneration,
|
|
86
110
|
waitForPlayer
|
|
@@ -414,6 +414,10 @@ interface RuntimeGrantView {
|
|
|
414
414
|
expiresAt: string;
|
|
415
415
|
lastCallAt?: string;
|
|
416
416
|
stopRequestedAt?: string;
|
|
417
|
+
/** Why it stopped: `player_stopped`, `game_stopped`, `operator_stopped`,
|
|
418
|
+
* `session_revoked`, … — and `replaced` when the player approved a newer
|
|
419
|
+
* budget for the same game and funding, which the game finds with
|
|
420
|
+
* `getActiveSpendGrant()`. */
|
|
417
421
|
stopReason?: string;
|
|
418
422
|
createdAt: string;
|
|
419
423
|
/** When a `waiting_for_plan` budget may admit again. The player's OWN plan
|
|
@@ -421,6 +425,10 @@ interface RuntimeGrantView {
|
|
|
421
425
|
* only while the status is `waiting_for_plan`. */
|
|
422
426
|
resumeAt?: string;
|
|
423
427
|
watcherOnline?: boolean;
|
|
428
|
+
/** Only on the PLAYER's own Genex read of a request still waiting on them:
|
|
429
|
+
* the live budgets of this game that approving it would replace, one per
|
|
430
|
+
* funding door at most. Never sent to a game. */
|
|
431
|
+
replaces?: RuntimeGrantView[];
|
|
424
432
|
}
|
|
425
433
|
interface RuntimeGenerationModels {
|
|
426
434
|
enabled: true;
|
package/dist/sentry.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genex-ai/embed-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "Player identity + durable game state for genex games \u2014 signed-in or guest play, per-player save slots, shared world state, soft-trust leaderboards, and shared collections and event streams.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|