@genex-ai/embed-sdk 0.34.0 → 0.36.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 +43 -18
- package/dist/{chunk-276FF56N.js → chunk-RAAJ2ZK5.js} +76 -5
- package/dist/development.d.ts +1 -1
- package/dist/index.d.ts +29 -7
- package/dist/index.js +7 -1
- package/dist/sentry.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -127,6 +127,27 @@ one, and a phone can also drop a backgrounded tab without telling the page:
|
|
|
127
127
|
save as the game goes. A game cannot block the close or ask the player to
|
|
128
128
|
confirm it.
|
|
129
129
|
|
|
130
|
+
## Multiplayer servers
|
|
131
|
+
|
|
132
|
+
After `await waitForPlayer()`, pass these to `@genex-ai/multiplayer`. Read the credential
|
|
133
|
+
fresh at each join (`auth: () => getColyseusAuth()`; tokens rotate) and never log it.
|
|
134
|
+
|
|
135
|
+
- `getColyseusUrls()`: the relay servers, for `connect()` and `matchmake()`.
|
|
136
|
+
- `getAuthorityUrls()` (SDK **0.35.0+**): the server-authoritative room servers, for
|
|
137
|
+
`connectAuthority()`. Empty when the stand serves none.
|
|
138
|
+
- `getAuthorityRegions()`: the same servers by region (`{ region, urls }`), for `connectAuthority()`'s
|
|
139
|
+
`regions`: the nearest region is joined, and each region is its own matchmaking pool. Empty when the
|
|
140
|
+
stand names no regions, and in local test mode.
|
|
141
|
+
- `getAuthorityHome()` (SDK **0.36.0+**): the region of those nearest the player by geography (from the country the player
|
|
142
|
+
connects from), for `connectAuthority()`'s `home`: it is joined and created in first. `undefined` when
|
|
143
|
+
the stand names none or the country is unknown, and in local test mode.
|
|
144
|
+
|
|
145
|
+
In local test mode both lists are empty and `getColyseusAuth()` is `undefined`, except for a
|
|
146
|
+
local authority server: a loopback page opened with `?genex_authority_url=ws://127.0.0.1:<port>`
|
|
147
|
+
(a plain `ws://` url on `localhost`, `127.0.0.1` or `[::1]`, nothing after the port) gets that
|
|
148
|
+
one url from `getAuthorityUrls()`, and `getColyseusAuth()` answers a fixed local placeholder that
|
|
149
|
+
no real server accepts. Any other value is ignored.
|
|
150
|
+
|
|
130
151
|
## Platform capabilities
|
|
131
152
|
|
|
132
153
|
SDK **0.32.0+**. The browser gives a page different powers in each shell. The
|
|
@@ -254,11 +275,15 @@ and save from `onShellClosing()`. Reading the clipboard is not available: listen
|
|
|
254
275
|
for the `paste` event. Sign-in popups for other services, notifications and
|
|
255
276
|
the tab's title are not available to a framed game.
|
|
256
277
|
|
|
257
|
-
## Request a
|
|
278
|
+
## Request a Nex payment
|
|
258
279
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
280
|
+
Nex is Genex's own currency: players buy it with real money and spend it in the
|
|
281
|
+
Genex store (the API and the SDK's fields keep its internal name, coin:
|
|
282
|
+
`amountCoins`, `priceCoins`). SDK **0.33.0+**. Use `requestPayment()` when an
|
|
283
|
+
action needs payment of an amount decided while playing: an extra turn, access
|
|
284
|
+
to a room, a custom upgrade. A fixed-price item is a store item instead (below).
|
|
285
|
+
No product registration or shop card is required. Pass
|
|
286
|
+
the title, optional description and Nex amount; Genex freezes those terms,
|
|
262
287
|
shows its own confirmation with the real-money equivalent, and charges only
|
|
263
288
|
after the player agrees. The game never confirms a charge itself.
|
|
264
289
|
|
|
@@ -365,12 +390,12 @@ for (const item of await getShop()) {
|
|
|
365
390
|
card.onclick = async () => {
|
|
366
391
|
const result = await buy({ skuId: item.id }); // first await in the click
|
|
367
392
|
if (result.status === 'succeeded' || result.status === 'already_owned') await applyOwned();
|
|
368
|
-
if (result.status === 'insufficient_balance')
|
|
393
|
+
if (result.status === 'insufficient_balance') showNotEnoughNex(); // nothing was charged
|
|
369
394
|
};
|
|
370
395
|
}
|
|
371
396
|
```
|
|
372
397
|
|
|
373
|
-
`knowsItem`, `applyItem`, `drawCard` and `
|
|
398
|
+
`knowsItem`, `applyItem`, `drawCard` and `showNotEnoughNex` are your game
|
|
374
399
|
code. `ShopItem` gains optional `description`, `modelUrl`, `tags`, `shared`,
|
|
375
400
|
`homeGame` and `state`; `Entitlement` gains optional `shared`, `iconUrl`,
|
|
376
401
|
`description` and `tags`. An older platform sends none of them, so read each as
|
|
@@ -380,9 +405,9 @@ are `shared` too. `homeGame` is sent for every item, this game's own included:
|
|
|
380
405
|
to tell another game's item, compare `homeGame.slug` with your game's slug (the
|
|
381
406
|
one you passed to `initEmbed`). The player may have bought such an item in
|
|
382
407
|
another game, and this game decides how it looks and what it does. Tags are
|
|
383
|
-
search words, never a type. Show `priceDisplayUsdCents` beside every
|
|
408
|
+
search words, never a type. Show `priceDisplayUsdCents` beside every Nex
|
|
384
409
|
price. `buy()` resolves `already_owned` when the player already owns the item,
|
|
385
|
-
and `insufficient_balance` when they were short of
|
|
410
|
+
and `insufficient_balance` when they were short of Nex at Confirm; nothing is
|
|
386
411
|
charged either way. An SDK before 0.34.0 reports both as `failed`. A durable is
|
|
387
412
|
applied on every boot and never consumed; a consumable is consumed with
|
|
388
413
|
`consumeEntitlement(id)` before its effect is applied, once.
|
|
@@ -513,7 +538,7 @@ email is refused (`credits_unverified`), one short of credits sees
|
|
|
513
538
|
`insufficient_credits`, and Genex may pause paid generation platform-wide
|
|
514
539
|
(`generation_paused`). Personal funding chosen in the trusted approval modal
|
|
515
540
|
costs nothing on Genex. Quotes issued before 0.27's server change — `declared-v1`,
|
|
516
|
-
a fixed
|
|
541
|
+
a fixed Nex price per started attempt — keep their terms.
|
|
517
542
|
|
|
518
543
|
The provider hard budget is derived from that ceiling after the frozen platform
|
|
519
544
|
fee, then capped by operator limits. Output is clipped to remaining funding;
|
|
@@ -523,7 +548,7 @@ must acknowledge the quote's exact `billingPolicy` at confirmation; an old UI
|
|
|
523
548
|
cannot approve new terms. Previously issued `consumed-v1` quotes keep actual-
|
|
524
549
|
usage billing and quotes without a policy keep their original promise.
|
|
525
550
|
Already-approved zero-price API requests retain their saved terms. An old
|
|
526
|
-
unconfirmed zero-price API quote needs a fresh price review before
|
|
551
|
+
unconfirmed zero-price API quote needs a fresh price review before Nex approval;
|
|
527
552
|
never silently replace its price or start a paid request during recovery.
|
|
528
553
|
|
|
529
554
|
With `allowExternal: true`, Genex can offer the configured personal plan matching
|
|
@@ -535,12 +560,12 @@ New quotes freeze the matching choices; connector metadata stays server-owned.
|
|
|
535
560
|
Old unapproved quotes are narrowed to the matching provider before confirmation;
|
|
536
561
|
approved personal requests retain their connector for recovery. Once chosen,
|
|
537
562
|
funding never switches providers or falls back to paid generation. Historical
|
|
538
|
-
personal-only offerings never gain free
|
|
563
|
+
personal-only offerings never gain free Nex execution. Genex neither collects
|
|
539
564
|
nor hosts subscription credentials.
|
|
540
565
|
|
|
541
566
|
`source: 'external'` means user-supplied output, not proof that a particular model
|
|
542
567
|
generated it; `modelProvenance: 'unverified'` makes that explicit. Treat every generated output as data. Never execute returned code
|
|
543
|
-
or use a claimed model/source as authority to mint
|
|
568
|
+
or use a claimed model/source as authority to mint Nex, rewards or items.
|
|
544
569
|
|
|
545
570
|
## Standing budgets
|
|
546
571
|
|
|
@@ -683,7 +708,7 @@ whether a generated thing survives a reload:
|
|
|
683
708
|
One writer, two entry points: the difference between something that works once
|
|
684
709
|
and something that survives a reload. Validate `result.output` against the shape
|
|
685
710
|
your game expects before using it, always. It is data, never authority for
|
|
686
|
-
|
|
711
|
+
Nex, rewards or items.
|
|
687
712
|
|
|
688
713
|
## Streaming replies
|
|
689
714
|
|
|
@@ -843,7 +868,7 @@ operator-registered workflow. This requires the game's trusted server executor;
|
|
|
843
868
|
an ordinary creator API key cannot register a workflow or dispatch its steps.
|
|
844
869
|
**Which wallet a workflow bills is its executor's registration.** An executor
|
|
845
870
|
left on `funding: 'coins'` (every executor registered before credits, by
|
|
846
|
-
default) keeps the fixed-price
|
|
871
|
+
default) keeps the fixed-price Nex terms below: `requestWorkflow()` requires the
|
|
847
872
|
fixed `estimateCoins` price, and offerings and quotes are `declared-v1` with a
|
|
848
873
|
multiplier of 2 or 3. An executor switched to `funding: 'credits'` issues
|
|
849
874
|
`metered-credits-v1` offerings and quotes instead — `estimatedCredits`,
|
|
@@ -900,7 +925,7 @@ persist or log the token.
|
|
|
900
925
|
|
|
901
926
|
On a COIN executor, the catalog's `estimatedCoins` and `priceCoins` are suggested price aliases,
|
|
902
927
|
and its maximum describes operator limits. Choose the game's fixed attempt price
|
|
903
|
-
after development benchmarks, pass it as `estimateCoins`, and show
|
|
928
|
+
after development benchmarks, pass it as `estimateCoins`, and show Nex plus USD.
|
|
904
929
|
The player's final approval always uses the server quote. Preserve the selected
|
|
905
930
|
model, bundle, funding, availability and operator-owned tariff; the game cannot
|
|
906
931
|
change provider prices, dispatch costs or settlement.
|
|
@@ -926,7 +951,7 @@ All API-backed Genex offerings are paid, including `google/gemini-3.8-flash` and
|
|
|
926
951
|
`z-ai/glm-5.3-flash`. Airena's free access to those models is game-funded through
|
|
927
952
|
its own direct OpenRouter path, outside the Genex runtime API.
|
|
928
953
|
Personal Claude/ChatGPT funding choices in the Genex approval modal cost
|
|
929
|
-
**0
|
|
954
|
+
**0 Nex** and use the player's own account through Genex-owned
|
|
930
955
|
MCP connectors. Claude uses `/player/mcp`; ChatGPT uses `/player/chatgpt/mcp`.
|
|
931
956
|
ChatGPT connector availability depends on account and workspace policy. One
|
|
932
957
|
external request may be active per player across both providers. Follow the
|
|
@@ -961,7 +986,7 @@ the subpath is disabled for browser resolution and rejects browser execution.
|
|
|
961
986
|
an explicit positive maximum from your own credits. Development uses
|
|
962
987
|
`metered-credits-v1`: actual model usage plus the Genex fee, rounded up to a
|
|
963
988
|
whole credit per call, including failed usage, up to that maximum (a workflow
|
|
964
|
-
whose executor still bills
|
|
989
|
+
whose executor still bills Nex uses `consumed-v1` on your Nex wallet).
|
|
965
990
|
Gemini/GLM models are paid too. Actual zero cost is free; unknown expense
|
|
966
991
|
remains held. No personal or paid fallback occurs.
|
|
967
992
|
|
|
@@ -1014,7 +1039,7 @@ replaces it — check it before a benchmark, not after.
|
|
|
1014
1039
|
|
|
1015
1040
|
For a registered workflow, call `developmentRequestWorkflow({ apiUrl,
|
|
1016
1041
|
creatorToken, projectId, workflowId, maxCredits, request: { offeringId, input,
|
|
1017
|
-
idempotencyKey? } })` (on a coin executor the same number is its
|
|
1042
|
+
idempotencyKey? } })` (on a coin executor the same number is its Nex cap). It returns the accepted, claimed workflow immediately so
|
|
1018
1043
|
your trusted executor can enqueue it. After enqueueing, call
|
|
1019
1044
|
`waitForDevelopmentGeneration(config, id, timeoutMs?)`. Both generic and workflow
|
|
1020
1045
|
benchmarks are recoverable with `getDevelopmentGeneration(config, id)` and
|
|
@@ -1668,7 +1668,7 @@ var LOCAL_AUTH_FLAG = "genex:embed:local-auth";
|
|
|
1668
1668
|
var ENTRY_REFERRER_MEMO = "genex:embed:entry-referrer";
|
|
1669
1669
|
var ENTRY_REFERRER_NONE = "none";
|
|
1670
1670
|
var PLAYER_ID_KEY = "genex:player";
|
|
1671
|
-
var SDK_VERSION = "0.
|
|
1671
|
+
var SDK_VERSION = "0.36.0";
|
|
1672
1672
|
var config2 = null;
|
|
1673
1673
|
var state = "pending";
|
|
1674
1674
|
var user = null;
|
|
@@ -1680,6 +1680,10 @@ var heartbeatTimer;
|
|
|
1680
1680
|
var nativeBootAt = 0;
|
|
1681
1681
|
var embedToken;
|
|
1682
1682
|
var colyseusUrls;
|
|
1683
|
+
var authorityUrls;
|
|
1684
|
+
var authorityRegions;
|
|
1685
|
+
var authorityHome;
|
|
1686
|
+
var localAuthority = false;
|
|
1683
1687
|
var parentOrigin = null;
|
|
1684
1688
|
var shellCaps = [];
|
|
1685
1689
|
var initialized = false;
|
|
@@ -1896,11 +1900,23 @@ function getEmbedToken() {
|
|
|
1896
1900
|
return embedToken;
|
|
1897
1901
|
}
|
|
1898
1902
|
function getColyseusAuth() {
|
|
1903
|
+
if (localAuthority) return { embedToken: LOCAL_AUTHORITY_TOKEN };
|
|
1899
1904
|
return embedToken ? { embedToken } : void 0;
|
|
1900
1905
|
}
|
|
1901
1906
|
function getColyseusUrls() {
|
|
1902
1907
|
return colyseusUrls ?? [];
|
|
1903
1908
|
}
|
|
1909
|
+
function getAuthorityUrls() {
|
|
1910
|
+
return urlList(authorityUrls) ?? [];
|
|
1911
|
+
}
|
|
1912
|
+
function getAuthorityRegions() {
|
|
1913
|
+
return regionList(authorityRegions);
|
|
1914
|
+
}
|
|
1915
|
+
function getAuthorityHome() {
|
|
1916
|
+
if (typeof authorityHome !== "string" || authorityHome.length === 0) return void 0;
|
|
1917
|
+
const home = authorityHome;
|
|
1918
|
+
return regionList(authorityRegions).some((r) => r.region === home) ? home : void 0;
|
|
1919
|
+
}
|
|
1904
1920
|
function waitForAuth() {
|
|
1905
1921
|
if (state === "authenticated" && user) return Promise.resolve({ user });
|
|
1906
1922
|
if (state === "blocked") return Promise.reject(new Error("genex embed auth: blocked"));
|
|
@@ -2580,7 +2596,7 @@ async function redeemTicket(ticket) {
|
|
|
2580
2596
|
if (epoch !== identityEpoch) return;
|
|
2581
2597
|
embedToken = body.embedToken;
|
|
2582
2598
|
user = body.user;
|
|
2583
|
-
|
|
2599
|
+
adoptColyseus(body.colyseus);
|
|
2584
2600
|
state = "authenticated";
|
|
2585
2601
|
if (handshakeTimer !== void 0) clearTimeout(handshakeTimer);
|
|
2586
2602
|
handshakeTimer = void 0;
|
|
@@ -2634,7 +2650,7 @@ async function requestGuestSession() {
|
|
|
2634
2650
|
if (epoch !== identityEpoch) return;
|
|
2635
2651
|
embedToken = body.embedToken;
|
|
2636
2652
|
user = body.user;
|
|
2637
|
-
|
|
2653
|
+
adoptColyseus(body.colyseus);
|
|
2638
2654
|
enterGuest();
|
|
2639
2655
|
} catch (error) {
|
|
2640
2656
|
if (epoch !== identityEpoch) return;
|
|
@@ -2670,11 +2686,48 @@ function enterGuest() {
|
|
|
2670
2686
|
function isLoopbackLocation(w) {
|
|
2671
2687
|
try {
|
|
2672
2688
|
const u = new URL(w.location.origin);
|
|
2673
|
-
return u.protocol === "http:" && (u.hostname
|
|
2689
|
+
return u.protocol === "http:" && LOOPBACK_HOSTNAMES.has(u.hostname);
|
|
2674
2690
|
} catch {
|
|
2675
2691
|
return false;
|
|
2676
2692
|
}
|
|
2677
2693
|
}
|
|
2694
|
+
var LOOPBACK_HOSTNAMES = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]"]);
|
|
2695
|
+
var AUTHORITY_URL_PARAM = "genex_authority_url";
|
|
2696
|
+
var LOCAL_AUTHORITY_TOKEN = "local:test";
|
|
2697
|
+
var MAX_AUTHORITY_URL_CHARS = 64;
|
|
2698
|
+
function loopbackAuthorityUrl(raw) {
|
|
2699
|
+
if (!raw || raw.length > MAX_AUTHORITY_URL_CHARS) return null;
|
|
2700
|
+
let u;
|
|
2701
|
+
try {
|
|
2702
|
+
u = new URL(raw);
|
|
2703
|
+
} catch {
|
|
2704
|
+
return null;
|
|
2705
|
+
}
|
|
2706
|
+
const bare = !u.username && !u.password && u.pathname === "/" && !u.search && !u.hash;
|
|
2707
|
+
if (u.protocol !== "ws:" || !LOOPBACK_HOSTNAMES.has(u.hostname) || !bare) return null;
|
|
2708
|
+
return `ws://${u.host}`;
|
|
2709
|
+
}
|
|
2710
|
+
function adoptColyseus(block) {
|
|
2711
|
+
colyseusUrls = block?.urls;
|
|
2712
|
+
authorityUrls = block?.authorityUrls;
|
|
2713
|
+
authorityRegions = block?.authorityRegions;
|
|
2714
|
+
authorityHome = block?.authorityHome;
|
|
2715
|
+
}
|
|
2716
|
+
function urlList(value) {
|
|
2717
|
+
if (!Array.isArray(value)) return void 0;
|
|
2718
|
+
return value.filter((url) => typeof url === "string" && url.length > 0);
|
|
2719
|
+
}
|
|
2720
|
+
function regionList(value) {
|
|
2721
|
+
if (!Array.isArray(value)) return [];
|
|
2722
|
+
const out = [];
|
|
2723
|
+
for (const entry of value) {
|
|
2724
|
+
if (entry === null || typeof entry !== "object") continue;
|
|
2725
|
+
const { region, urls } = entry;
|
|
2726
|
+
const list = urlList(urls) ?? [];
|
|
2727
|
+
if (typeof region === "string" && region.length > 0 && list.length > 0) out.push({ region, urls: list });
|
|
2728
|
+
}
|
|
2729
|
+
return out;
|
|
2730
|
+
}
|
|
2678
2731
|
function wantsLocalTestMode(w, latch = true) {
|
|
2679
2732
|
if (isEmbedded()) return false;
|
|
2680
2733
|
if (detectNativeEntry(w)) return false;
|
|
@@ -2699,6 +2752,7 @@ function hasGenexFragment(w) {
|
|
|
2699
2752
|
function enterLocalTestMode(w) {
|
|
2700
2753
|
localTestMode = true;
|
|
2701
2754
|
readFragment(w);
|
|
2755
|
+
acceptLocalAuthorityUrl(w);
|
|
2702
2756
|
const localUser = { id: "local:test", name: "Local Tester" };
|
|
2703
2757
|
user = localUser;
|
|
2704
2758
|
state = "guest";
|
|
@@ -2712,6 +2766,19 @@ function enterLocalTestMode(w) {
|
|
|
2712
2766
|
for (const waiter of playerWaiters.splice(0)) waiter.resolve({ user: localUser, guest: true });
|
|
2713
2767
|
emit("guest", { user: localUser });
|
|
2714
2768
|
}
|
|
2769
|
+
function acceptLocalAuthorityUrl(w) {
|
|
2770
|
+
if (!isLoopbackLocation(w)) return;
|
|
2771
|
+
let raw = null;
|
|
2772
|
+
try {
|
|
2773
|
+
raw = new URLSearchParams(w.location.search).get(AUTHORITY_URL_PARAM);
|
|
2774
|
+
} catch {
|
|
2775
|
+
return;
|
|
2776
|
+
}
|
|
2777
|
+
const url = loopbackAuthorityUrl(raw);
|
|
2778
|
+
if (!url) return;
|
|
2779
|
+
authorityUrls = [url];
|
|
2780
|
+
localAuthority = true;
|
|
2781
|
+
}
|
|
2715
2782
|
async function handleRedeemFailure() {
|
|
2716
2783
|
const w = win2();
|
|
2717
2784
|
if (handshakeTimer !== void 0) clearTimeout(handshakeTimer);
|
|
@@ -3127,7 +3194,8 @@ function __resetForTests(overrides) {
|
|
|
3127
3194
|
user = null;
|
|
3128
3195
|
localTestMode = false;
|
|
3129
3196
|
embedToken = void 0;
|
|
3130
|
-
|
|
3197
|
+
adoptColyseus(void 0);
|
|
3198
|
+
localAuthority = false;
|
|
3131
3199
|
parentOrigin = null;
|
|
3132
3200
|
shellCaps = [];
|
|
3133
3201
|
initialized = false;
|
|
@@ -3219,6 +3287,9 @@ export {
|
|
|
3219
3287
|
getEmbedToken,
|
|
3220
3288
|
getColyseusAuth,
|
|
3221
3289
|
getColyseusUrls,
|
|
3290
|
+
getAuthorityUrls,
|
|
3291
|
+
getAuthorityRegions,
|
|
3292
|
+
getAuthorityHome,
|
|
3222
3293
|
waitForAuth,
|
|
3223
3294
|
waitForPlayer,
|
|
3224
3295
|
on,
|
package/dist/development.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { R as RuntimeJudgeQuestion, a as RuntimeWorkflowInput, b as RuntimeGener
|
|
|
4
4
|
* Server-only benchmarks spend the authenticated creator's OWN CREDITS
|
|
5
5
|
* (`metered-credits-v1` since SDK 0.27: the real model cost plus the Genex fee,
|
|
6
6
|
* rounded up to a whole credit per call) — or, for a workflow whose executor
|
|
7
|
-
* still bills
|
|
7
|
+
* still bills Nex, their own Nex wallet (`consumed-v1`).
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
interface DevelopmentGenerationConfig {
|
package/dist/index.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ interface ShopItem {
|
|
|
45
45
|
/**
|
|
46
46
|
* The real-money equivalent, in USD cents, from the server.
|
|
47
47
|
*
|
|
48
|
-
* Show it next to the
|
|
48
|
+
* Show it next to the Nex price (`priceCoins`). It is not decoration: a currency price
|
|
49
49
|
* without its real-world value is the practice consumer regulators single
|
|
50
50
|
* out first, and the platform sends this so a game never has to compute it —
|
|
51
51
|
* or be tempted to omit it.
|
|
@@ -116,8 +116,8 @@ type PurchaseStatus =
|
|
|
116
116
|
/** The confirmation was never completed in time. */
|
|
117
117
|
| 'expired'
|
|
118
118
|
/**
|
|
119
|
-
* The player does not have enough
|
|
120
|
-
* get
|
|
119
|
+
* The player does not have enough Nex; nothing was charged. Offer a way to
|
|
120
|
+
* get Nex. An SDK before 0.34.0 reports it from buy() as `failed`.
|
|
121
121
|
*/
|
|
122
122
|
| 'insufficient_balance'
|
|
123
123
|
/**
|
|
@@ -251,7 +251,8 @@ declare function getPayments(opts?: {
|
|
|
251
251
|
limit?: number;
|
|
252
252
|
}): Promise<PaymentPage>;
|
|
253
253
|
/**
|
|
254
|
-
* Ask the player to approve a dynamic
|
|
254
|
+
* Ask the player to approve a dynamic Nex payment, for an amount decided in
|
|
255
|
+
* play. No catalog item required.
|
|
255
256
|
* Call directly from a click or tap, before any await: standalone games reserve
|
|
256
257
|
* the platform popup synchronously. Only Genex can confirm the charge.
|
|
257
258
|
*
|
|
@@ -318,8 +319,8 @@ interface RuntimeGenerationResult extends RuntimeGenerationBilling {
|
|
|
318
319
|
}
|
|
319
320
|
interface RequestWorkflowOptions {
|
|
320
321
|
/**
|
|
321
|
-
* The operation's ceiling. A workflow whose executor bills
|
|
322
|
-
* for every executor registered before credits) reads it as its fixed
|
|
322
|
+
* The operation's ceiling. A workflow whose executor bills Nex (the default
|
|
323
|
+
* for every executor registered before credits) reads it as its fixed Nex
|
|
323
324
|
* price of a started attempt; one whose executor bills credits reads it as the
|
|
324
325
|
* credit ceiling of a request billed as used. Pass this or `maxCredits`.
|
|
325
326
|
*/
|
|
@@ -995,6 +996,27 @@ declare function getColyseusAuth(): {
|
|
|
995
996
|
/** The relay URLs for this session (server-owned; a regional list when configured). Pass to
|
|
996
997
|
* connect()/matchmake() as `urls` so the SDK joins the lowest-latency one; single-url fallback. */
|
|
997
998
|
declare function getColyseusUrls(): string[];
|
|
999
|
+
/** The server-authoritative room servers for this session (multiplayer PROTOCOL.md §17; separate from
|
|
1000
|
+
* the relay urls, server-owned). Pass to `connectAuthority()` as `urls`. Empty when the stand serves
|
|
1001
|
+
* none. In local test mode it is the loopback `genex_authority_url` the page was opened with (a
|
|
1002
|
+
* `ws://` url on `localhost`, `127.0.0.1` or `[::1]`, on a loopback page), and empty otherwise. */
|
|
1003
|
+
declare function getAuthorityUrls(): string[];
|
|
1004
|
+
/** One region of the server-authoritative cluster: its name and its servers' urls. */
|
|
1005
|
+
type AuthorityRegion = {
|
|
1006
|
+
region: string;
|
|
1007
|
+
urls: string[];
|
|
1008
|
+
};
|
|
1009
|
+
/** The server-authoritative room servers by region (multiplayer PROTOCOL.md §17.1 *Regions*, server-owned).
|
|
1010
|
+
* Pass to `connectAuthority()` as `regions` beside `urls`: the nearest region is joined, and each region
|
|
1011
|
+
* is its own matchmaking pool. Empty when the stand names no regions, and in local test mode; `urls`
|
|
1012
|
+
* alone are then used. Fresh copies: editing them changes nothing. */
|
|
1013
|
+
declare function getAuthorityRegions(): AuthorityRegion[];
|
|
1014
|
+
/** The player's home region (multiplayer PROTOCOL.md §17.1 *Regions*, server-owned): the region of
|
|
1015
|
+
* {@link getAuthorityRegions} nearest the player by geography, which the server names from the country
|
|
1016
|
+
* the request came from. Pass to `connectAuthority()` as `home`: that region is joined and created in
|
|
1017
|
+
* first, whatever a latency probe measured. Undefined when the server names none (no country, an older
|
|
1018
|
+
* API), when it names a region it does not serve, and in local test mode. */
|
|
1019
|
+
declare function getAuthorityHome(): string | undefined;
|
|
998
1020
|
/**
|
|
999
1021
|
* Resolves with the signed-in ACCOUNT once authenticated; rejects if the
|
|
1000
1022
|
* session ends up blocked. THE gate for /state saves and any account-bound
|
|
@@ -1176,4 +1198,4 @@ declare function __resetForTests(overrides?: {
|
|
|
1176
1198
|
platformConfirmTimeoutMs?: number;
|
|
1177
1199
|
}): void;
|
|
1178
1200
|
|
|
1179
|
-
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, ItemState, type JudgeOptions, type JudgeResult, type Leaderboard, type LeaderboardEntry, type PaymentOptions, type PaymentPage, type PaymentReceipt, type PaymentResult, type PaymentStatus, 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, getPayment, getPayments, getShared, getShell, getShop, getSpendGrant, getUser, getWorkflowOfferings, haptic, initEmbed, isEmbedded, judge, keepAwake, listEvents, listShared, loadPlayerState, loadWorldState, on, onShellClosing, openExternal, putShared, requestPayment, requestSpendGrant, requestWorkflow, resumeWorkflow, saveFile, savePlayerState, saveWorldState, setFullscreen, share, stopSpendGrant, submitScore, supports, waitForAuth, waitForGeneration, waitForPlayer };
|
|
1201
|
+
export { type AppendEventResult, type AuthState, type AuthorityRegion, type DeleteSharedResult, type EmbedConfig, type EmbedEntry, type EmbedEvent, type EmbedShell, type EmbedUser, type Entitlement, type GenerateOptions, type GenerateStreamOptions, type HapticKind, ItemState, type JudgeOptions, type JudgeResult, type Leaderboard, type LeaderboardEntry, type PaymentOptions, type PaymentPage, type PaymentReceipt, type PaymentResult, type PaymentStatus, 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, getAuthorityHome, getAuthorityRegions, getAuthorityUrls, getColyseusAuth, getColyseusUrls, getEmbedToken, getEntitlements, getEntry, getGeneration, getGenerationModels, getLeaderboard, getPayment, getPayments, getShared, getShell, getShop, getSpendGrant, getUser, getWorkflowOfferings, haptic, initEmbed, isEmbedded, judge, keepAwake, listEvents, listShared, loadPlayerState, loadWorldState, on, onShellClosing, openExternal, putShared, requestPayment, requestSpendGrant, requestWorkflow, resumeWorkflow, saveFile, savePlayerState, saveWorldState, setFullscreen, share, stopSpendGrant, submitScore, supports, waitForAuth, waitForGeneration, waitForPlayer };
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,9 @@ import {
|
|
|
12
12
|
generationErrorMessage,
|
|
13
13
|
getActiveSpendGrant,
|
|
14
14
|
getAuthState,
|
|
15
|
+
getAuthorityHome,
|
|
16
|
+
getAuthorityRegions,
|
|
17
|
+
getAuthorityUrls,
|
|
15
18
|
getColyseusAuth,
|
|
16
19
|
getColyseusUrls,
|
|
17
20
|
getEmbedToken,
|
|
@@ -56,7 +59,7 @@ import {
|
|
|
56
59
|
waitForAuth,
|
|
57
60
|
waitForGeneration,
|
|
58
61
|
waitForPlayer
|
|
59
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-RAAJ2ZK5.js";
|
|
60
63
|
import "./chunk-QBCWKMVQ.js";
|
|
61
64
|
export {
|
|
62
65
|
ItemState,
|
|
@@ -72,6 +75,9 @@ export {
|
|
|
72
75
|
generationErrorMessage,
|
|
73
76
|
getActiveSpendGrant,
|
|
74
77
|
getAuthState,
|
|
78
|
+
getAuthorityHome,
|
|
79
|
+
getAuthorityRegions,
|
|
80
|
+
getAuthorityUrls,
|
|
75
81
|
getColyseusAuth,
|
|
76
82
|
getColyseusUrls,
|
|
77
83
|
getEmbedToken,
|
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.36.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",
|