@genex-ai/embed-sdk 0.29.0 → 0.30.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/README.md CHANGED
@@ -1,11 +1,45 @@
1
1
  # Genex embed SDK
2
2
 
3
- `@genex-ai/embed-sdk` connects a game to player identity, saves, commerce and
4
- player-funded generation. Initialize it with your game's slug, API URL and
5
- trusted dashboard origins before using player APIs. See
3
+ `@genex-ai/embed-sdk` connects a game to player identity, saves, shared
4
+ collections, commerce and player-funded generation. Initialize it with your
5
+ game's slug, API URL and trusted dashboard origins before using player APIs. See
6
6
  [the play-identity contract](../../CLI_INTEGRATION.md#6-durable-game-state--leaderboards--play-identity)
7
7
  for identity and storage.
8
8
 
9
+ ## Share what players make
10
+
11
+ Since 0.30.0 a signed-in player can publish objects every player of the game
12
+ can list and read — a robot, a level, a deck — and append small records anyone
13
+ reads back in order, like match results. No game server needed.
14
+
15
+ ```ts
16
+ import { putShared, listShared, getShared, appendEvent, listEvents } from "@genex-ai/embed-sdk";
17
+
18
+ // Publish (or replace) this player's own robot. `meta` is the small card a
19
+ // list shows, so a list screen never downloads every body.
20
+ const saved = await putShared("robots", "grinder", robot, { meta: { name: "Grinder", elo: 1200 } });
21
+ if (saved.guest) showSignInToPublish();
22
+ if (saved.quota) showTooManyRobots(saved.quota.limit);
23
+
24
+ // Browse everyone's, newest first, then load one. Passing the listed version
25
+ // makes the read cacheable: that exact version never changes.
26
+ const page = await listShared("robots", { limit: 20 });
27
+ const rival = await getShared<Robot>("robots", page.items[0].id, { version: page.items[0].version });
28
+
29
+ // An ordered public record: append, then tail it with `after: next`.
30
+ await appendEvent("matches", { winner: "grinder", loser: rival?.id });
31
+ let cursor: string | undefined;
32
+ const { items, next } = await listEvents("matches", { after: cursor });
33
+ cursor = next ?? cursor;
34
+ ```
35
+
36
+ Writes need an account: a guest's resolves `{ guest: true }` and is never
37
+ queued. Reads are public on a published game, guests included. On a preview
38
+ build the game's owner writes a separate test partition the live game never
39
+ sees; anyone else there resolves `{ staging: true }`. Names match
40
+ `^[a-z0-9_-]{1,64}$`. Limits, quotas and endpoints:
41
+ [§6a](../../CLI_INTEGRATION.md#6a-shared-collections--event-streams).
42
+
9
43
  ## Generate during play
10
44
 
11
45
  Runtime generation requires a signed-in player in a published game and an
@@ -917,7 +917,7 @@ var RETRY_FLAG = "genex:embed:retry";
917
917
  var POPOVER_DISMISSED_FLAG = "genex:guest:popover-dismissed";
918
918
  var LOCAL_AUTH_FLAG = "genex:embed:local-auth";
919
919
  var PLAYER_ID_KEY = "genex:player";
920
- var SDK_VERSION = "0.29.0";
920
+ var SDK_VERSION = "0.30.1";
921
921
  var config2 = null;
922
922
  var state = "pending";
923
923
  var user = null;
@@ -1284,6 +1284,126 @@ async function getLeaderboard(opts) {
1284
1284
  if (!res.ok) throw new Error(`genex leaderboard failed (${res.status})`);
1285
1285
  return await res.json();
1286
1286
  }
1287
+ async function readFetch(path, headers = {}) {
1288
+ if (state === "pending") {
1289
+ try {
1290
+ await waitForPlayer();
1291
+ } catch {
1292
+ }
1293
+ }
1294
+ const h = { ...headers };
1295
+ if (embedToken) h.Authorization = `Bearer ${embedToken}`;
1296
+ return doFetch(`${config2.apiUrl}/api/projects/${encodeURIComponent(config2.slug)}${path}`, {
1297
+ headers: h
1298
+ });
1299
+ }
1300
+ function sharedPath(collection, rest) {
1301
+ return `/shared/${encodeURIComponent(collection)}${rest === void 0 ? "" : `/${encodeURIComponent(rest)}`}`;
1302
+ }
1303
+ async function errorBody(res) {
1304
+ return await res.json().catch(() => null) ?? {};
1305
+ }
1306
+ async function putShared(collection, key, data, opts) {
1307
+ await ensurePlayer();
1308
+ if (state === "guest") return { saved: false, guest: true };
1309
+ const body = { data };
1310
+ if (opts?.meta !== void 0) body.meta = opts.meta;
1311
+ const res = await stateFetch(sharedPath(collection, key), {
1312
+ method: "PUT",
1313
+ body: JSON.stringify(body),
1314
+ ifVersion: opts?.ifVersion
1315
+ });
1316
+ if (res.ok) {
1317
+ const ok = await res.json();
1318
+ return { saved: true, id: ok.id, version: ok.version, created: ok.created };
1319
+ }
1320
+ const err = await errorBody(res);
1321
+ if (res.status === 409) return { saved: false, conflict: true, version: err.version };
1322
+ if (res.status === 413) return { saved: false, tooLarge: true };
1323
+ if (res.status === 403 && err.error === "staging_no_save") return { saved: false, staging: true };
1324
+ if (res.status === 403 && err.error === "quota_exceeded") {
1325
+ return {
1326
+ saved: false,
1327
+ quota: { scope: err.scope, limit: err.limit }
1328
+ };
1329
+ }
1330
+ emit("error", { error: new Error(`genex shared publish failed (${res.status})`) });
1331
+ return { saved: false };
1332
+ }
1333
+ async function deleteShared(collection, key, opts) {
1334
+ await ensurePlayer();
1335
+ if (state === "guest") return { deleted: false, guest: true };
1336
+ const res = await stateFetch(sharedPath(collection, key), {
1337
+ method: "DELETE",
1338
+ ifVersion: opts?.ifVersion
1339
+ });
1340
+ if (res.ok) return { deleted: true };
1341
+ const err = await errorBody(res);
1342
+ if (res.status === 404) return { deleted: false };
1343
+ if (res.status === 409) return { deleted: false, conflict: true, version: err.version };
1344
+ if (res.status === 403 && err.error === "staging_no_save") return { deleted: false, staging: true };
1345
+ emit("error", { error: new Error(`genex shared delete failed (${res.status})`) });
1346
+ return { deleted: false };
1347
+ }
1348
+ async function listShared(collection, opts) {
1349
+ if (!config2) throw new Error("genex embed: call initEmbed() first");
1350
+ if (localTestMode) return { items: [], next: null };
1351
+ let userFilter = opts?.user;
1352
+ if (opts?.mine) {
1353
+ if (state === "pending") await waitForPlayer().catch(() => void 0);
1354
+ if (state !== "authenticated" || !user) return { items: [], next: null };
1355
+ userFilter = user.id;
1356
+ }
1357
+ const params = new URLSearchParams();
1358
+ if (opts?.cursor !== void 0) params.set("cursor", opts.cursor);
1359
+ if (opts?.limit !== void 0) params.set("limit", String(opts.limit));
1360
+ if (userFilter !== void 0) params.set("user", userFilter);
1361
+ const qs = params.toString();
1362
+ const res = await readFetch(`${sharedPath(collection)}${qs ? `?${qs}` : ""}`);
1363
+ if (!res.ok) throw new Error(`genex shared list failed (${res.status})`);
1364
+ return await res.json();
1365
+ }
1366
+ async function getShared(collection, id, opts) {
1367
+ if (!config2) throw new Error("genex embed: call initEmbed() first");
1368
+ if (localTestMode) return null;
1369
+ const qs = opts?.version !== void 0 ? `?v=${encodeURIComponent(String(opts.version))}` : "";
1370
+ let res = await readFetch(`${sharedPath(collection, id)}${qs}`);
1371
+ if (res.status === 404 && qs) {
1372
+ const err = await errorBody(res);
1373
+ if (err.error !== "version_gone") return null;
1374
+ res = await readFetch(sharedPath(collection, id));
1375
+ }
1376
+ if (res.status === 404) return null;
1377
+ if (!res.ok) throw new Error(`genex shared read failed (${res.status})`);
1378
+ return await res.json();
1379
+ }
1380
+ async function appendEvent(stream, data) {
1381
+ await ensurePlayer();
1382
+ if (state === "guest") return { appended: false, guest: true };
1383
+ const res = await stateFetch(`/events/${encodeURIComponent(stream)}`, {
1384
+ method: "POST",
1385
+ body: JSON.stringify(data)
1386
+ });
1387
+ if (res.ok) return { appended: true, id: (await res.json()).id };
1388
+ const err = await errorBody(res);
1389
+ if (res.status === 413) return { appended: false, tooLarge: true };
1390
+ if (res.status === 403 && err.error === "staging_no_save") return { appended: false, staging: true };
1391
+ emit("error", { error: new Error(`genex event append failed (${res.status})`) });
1392
+ return { appended: false };
1393
+ }
1394
+ async function listEvents(stream, opts) {
1395
+ if (!config2) throw new Error("genex embed: call initEmbed() first");
1396
+ if (localTestMode) return { items: [], next: opts?.after ?? opts?.before ?? null, more: false };
1397
+ const params = new URLSearchParams();
1398
+ if (opts?.after !== void 0) params.set("after", opts.after);
1399
+ if (opts?.before !== void 0) params.set("before", opts.before);
1400
+ if (opts?.limit !== void 0) params.set("limit", String(opts.limit));
1401
+ if (opts?.order !== void 0) params.set("order", opts.order);
1402
+ const qs = params.toString();
1403
+ const res = await readFetch(`/events/${encodeURIComponent(stream)}${qs ? `?${qs}` : ""}`);
1404
+ if (!res.ok) throw new Error(`genex events read failed (${res.status})`);
1405
+ return await res.json();
1406
+ }
1287
1407
  async function flushGuestQueue() {
1288
1408
  try {
1289
1409
  if (hasPendingPlayerSave) {
@@ -2190,6 +2310,12 @@ export {
2190
2310
  saveWorldState,
2191
2311
  submitScore,
2192
2312
  getLeaderboard,
2313
+ putShared,
2314
+ deleteShared,
2315
+ listShared,
2316
+ getShared,
2317
+ appendEvent,
2318
+ listEvents,
2193
2319
  _stashTicketFromUrl,
2194
2320
  __resetForTests
2195
2321
  };
@@ -1,4 +1,4 @@
1
- import { RuntimeJudgeQuestion, RuntimeWorkflowInput, RuntimeGenerationView } from '@genex/embed-protocol';
1
+ import { R as RuntimeJudgeQuestion, a as RuntimeWorkflowInput, b as RuntimeGenerationView } from './runtime-generation-sXuSFc3c.js';
2
2
 
3
3
  /**
4
4
  * Server-only benchmarks spend the authenticated creator's OWN CREDITS
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { RuntimeJudgeQuestion, RuntimeJudgeAnswer, RuntimeJudgmentView, RuntimeWorkflowInput, RuntimeGenerationBilling, RuntimeGenerationFunding, RuntimeGrantView, RuntimeGenerationView, RuntimeGenerationModels, RuntimeWorkflowOfferings } from '@genex/embed-protocol';
2
- export { RuntimeBillingPolicy, RuntimeCurrency, RuntimeExternalProvider, RuntimeGenerationBilling, RuntimeGenerationFunding, RuntimeGenerationModels, RuntimeGenerationStatus, RuntimeGenerationStreamEvent, RuntimeGenerationView, RuntimeGrantJudgeTerms, RuntimeGrantStatus, RuntimeGrantTerms, RuntimeGrantView, RuntimeJudgeAnswer, RuntimeJudgeCriterion, RuntimeJudgeQuestion, RuntimeJudgmentView, RuntimeWorkflowInput, RuntimeWorkflowOfferings } from '@genex/embed-protocol';
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-sXuSFc3c.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-sXuSFc3c.js';
3
3
 
4
4
  /** A thing the game sells. Resolved server-side; the game never sets a price. */
5
5
  interface ShopItem {
@@ -473,6 +473,87 @@ interface Leaderboard {
473
473
  score: number;
474
474
  } | null;
475
475
  }
476
+ /** One published object's listing card — everything but the body. */
477
+ interface SharedObjectInfo {
478
+ /** Stable across versions; what getShared() takes. */
479
+ id: string;
480
+ collection: string;
481
+ /** The publishing player (verified server-side) and their display name. */
482
+ userId: string;
483
+ name: string;
484
+ image: string | null;
485
+ /** The publisher's own name for it — unique per player per collection. */
486
+ key: string;
487
+ version: number;
488
+ /** Serialized size of `data`. */
489
+ bytes: number;
490
+ /** The small card passed to putShared({ meta }) — null when none. */
491
+ meta: Record<string, unknown> | null;
492
+ createdAt: string;
493
+ updatedAt: string;
494
+ /** Present only for the game's owner (moderation view). */
495
+ hidden?: boolean;
496
+ }
497
+ interface SharedObject<T = unknown> extends SharedObjectInfo {
498
+ data: T;
499
+ }
500
+ interface SharedPage {
501
+ items: SharedObjectInfo[];
502
+ /** Pass as `cursor` for the next page; null on the last one. */
503
+ next: string | null;
504
+ }
505
+ interface PutSharedResult {
506
+ /** True when the object landed on the server. */
507
+ saved: boolean;
508
+ id?: string;
509
+ /** The object's version after the write — or the CURRENT one on a conflict (0 = none). */
510
+ version?: number;
511
+ /** True when this write created the key. */
512
+ created?: boolean;
513
+ /** True when `ifVersion` lost the race (reload, merge, retry). */
514
+ conflict?: boolean;
515
+ /** True for guests — publishing needs an account and is never queued. */
516
+ guest?: boolean;
517
+ /** True on the preview channel when the caller is not the game's owner. */
518
+ staging?: boolean;
519
+ /** Set when a NEW key would pass a per-player quota (per collection or per game). */
520
+ quota?: {
521
+ scope: 'collection' | 'game';
522
+ limit: number;
523
+ };
524
+ /** True when `data` or `meta` is over the server's cap. */
525
+ tooLarge?: boolean;
526
+ }
527
+ interface DeleteSharedResult {
528
+ deleted: boolean;
529
+ /** True when `ifVersion` no longer matched; `version` is the current one. */
530
+ conflict?: boolean;
531
+ version?: number;
532
+ guest?: boolean;
533
+ staging?: boolean;
534
+ }
535
+ interface SharedEventRecord<T = unknown> {
536
+ /** A decimal id; ids are a total order within a stream. */
537
+ id: string;
538
+ userId: string;
539
+ name: string;
540
+ createdAt: string;
541
+ data: T;
542
+ }
543
+ interface SharedEventPage<T = unknown> {
544
+ items: SharedEventRecord<T>[];
545
+ /** Where to continue in the same direction (`after` for asc, `before` for desc). */
546
+ next: string | null;
547
+ /** True when a full page is already waiting past `next`. */
548
+ more: boolean;
549
+ }
550
+ interface AppendEventResult {
551
+ appended: boolean;
552
+ id?: string;
553
+ guest?: boolean;
554
+ staging?: boolean;
555
+ tooLarge?: boolean;
556
+ }
476
557
  interface EventContext {
477
558
  user?: EmbedUser;
478
559
  error?: unknown;
@@ -627,6 +708,68 @@ declare function getLeaderboard(opts?: {
627
708
  limit?: number;
628
709
  order?: 'desc' | 'asc';
629
710
  }): Promise<Leaderboard>;
711
+ /**
712
+ * Publish (or replace) THIS player's own object at `key` in `collection` — any
713
+ * JSON `data` (≤ 256KB on the default stand) plus an optional small `meta`
714
+ * card (≤ 1KB) that listings return, so a list screen never fetches bodies.
715
+ * Every player of the game can then list and read it. Names match
716
+ * `^[a-z0-9_-]{1,64}$`. Pass `{ ifVersion }` to update only from that version
717
+ * (a lost race resolves { conflict: true, version }), `ifVersion: 0` to create
718
+ * only. A NEW key past the per-player quota resolves { quota: { scope, limit } };
719
+ * an oversized body { tooLarge: true }. Guests resolve { guest: true }.
720
+ */
721
+ declare function putShared(collection: string, key: string, data: unknown, opts?: {
722
+ meta?: Record<string, unknown>;
723
+ ifVersion?: number;
724
+ }): Promise<PutSharedResult>;
725
+ /**
726
+ * Delete THIS player's own object at `key` (optionally only from `ifVersion`).
727
+ * Resolves { deleted: false } when there is nothing there.
728
+ */
729
+ declare function deleteShared(collection: string, key: string, opts?: {
730
+ ifVersion?: number;
731
+ }): Promise<DeleteSharedResult>;
732
+ /**
733
+ * List a collection's objects, newest-updated first: listing cards (with each
734
+ * object's `meta`), never bodies. `limit` ≤ 100 (default 50); pass the page's
735
+ * `next` back as `cursor`. `user` narrows to one publisher; `mine: true` to this
736
+ * player (an empty page for guests). Public on published games — guests and
737
+ * tokenless contexts read it too. Throws on a failed read, like getLeaderboard().
738
+ */
739
+ declare function listShared(collection: string, opts?: {
740
+ cursor?: string;
741
+ limit?: number;
742
+ user?: string;
743
+ mine?: boolean;
744
+ }): Promise<SharedPage>;
745
+ /**
746
+ * Read one object by `id` (from a listing or a putShared result). Resolves null
747
+ * when it does not exist or was hidden by the game's owner. Pass `{ version }`
748
+ * (the listing's) to make the read cacheable for a day — that exact version
749
+ * never changes; if a newer one replaced it, the current one is returned.
750
+ */
751
+ declare function getShared<T = unknown>(collection: string, id: string, opts?: {
752
+ version?: number;
753
+ }): Promise<SharedObject<T> | null>;
754
+ /**
755
+ * Append one record (any JSON ≤ 4KB on the default stand) to `stream` — match
756
+ * results, a ladder's history. Every player of the game can read it back in
757
+ * order. Guests resolve { guest: true }; a small append survives tab close
758
+ * (fetch keepalive).
759
+ */
760
+ declare function appendEvent(stream: string, data: unknown): Promise<AppendEventResult>;
761
+ /**
762
+ * Page a stream. Default: oldest first, forward from `after` (exclusive) — tail
763
+ * a stream by passing each page's `next` back as `after`. `order: "desc"`
764
+ * reads newest first, back from `before`. `limit` ≤ 200 (default 100). Public
765
+ * on published games; throws on a failed read.
766
+ */
767
+ declare function listEvents<T = unknown>(stream: string, opts?: {
768
+ after?: string;
769
+ before?: string;
770
+ limit?: number;
771
+ order?: 'asc' | 'desc';
772
+ }): Promise<SharedEventPage<T>>;
630
773
  /**
631
774
  * @internal — for ./sentry.ts ONLY, not public API (games never call this).
632
775
  * If the URL fragment carries any genex marker (`genex_ticket` — a secret —
@@ -643,4 +786,4 @@ declare function __resetForTests(overrides?: {
643
786
  heartbeatIntervalMs?: number;
644
787
  }): void;
645
788
 
646
- export { type AuthState, 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 RequestWorkflowOptions, type RuntimeGenerationResult, type RuntimeWorkflowAuthorization, type SaveStateResult, type ShopItem, type SpendGrantDisclosure, type SpendGrantOptions, type SpendGrantResult, type SubmitScoreResult, type WorldStateResult, __resetForTests, _stashTicketFromUrl, buy, consumeEntitlement, generate, generateStream, generationErrorMessage, getAuthState, getColyseusAuth, getColyseusUrls, getEmbedToken, getEntitlements, getGeneration, getGenerationModels, getLeaderboard, getShop, getSpendGrant, getUser, getWorkflowOfferings, initEmbed, isEmbedded, judge, loadPlayerState, loadWorldState, on, requestSpendGrant, requestWorkflow, resumeWorkflow, savePlayerState, saveWorldState, stopSpendGrant, submitScore, waitForAuth, waitForGeneration, waitForPlayer };
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 };
package/dist/index.js CHANGED
@@ -1,8 +1,10 @@
1
1
  import {
2
2
  __resetForTests,
3
3
  _stashTicketFromUrl,
4
+ appendEvent,
4
5
  buy,
5
6
  consumeEntitlement,
7
+ deleteShared,
6
8
  generate,
7
9
  generateStream,
8
10
  generationErrorMessage,
@@ -14,6 +16,7 @@ import {
14
16
  getGeneration,
15
17
  getGenerationModels,
16
18
  getLeaderboard,
19
+ getShared,
17
20
  getShop,
18
21
  getSpendGrant,
19
22
  getUser,
@@ -21,9 +24,12 @@ import {
21
24
  initEmbed,
22
25
  isEmbedded,
23
26
  judge,
27
+ listEvents,
28
+ listShared,
24
29
  loadPlayerState,
25
30
  loadWorldState,
26
31
  on,
32
+ putShared,
27
33
  requestSpendGrant,
28
34
  requestWorkflow,
29
35
  resumeWorkflow,
@@ -34,13 +40,15 @@ import {
34
40
  waitForAuth,
35
41
  waitForGeneration,
36
42
  waitForPlayer
37
- } from "./chunk-SJLIF32C.js";
43
+ } from "./chunk-FBJN7DGJ.js";
38
44
  import "./chunk-MJPLBT3T.js";
39
45
  export {
40
46
  __resetForTests,
41
47
  _stashTicketFromUrl,
48
+ appendEvent,
42
49
  buy,
43
50
  consumeEntitlement,
51
+ deleteShared,
44
52
  generate,
45
53
  generateStream,
46
54
  generationErrorMessage,
@@ -52,6 +60,7 @@ export {
52
60
  getGeneration,
53
61
  getGenerationModels,
54
62
  getLeaderboard,
63
+ getShared,
55
64
  getShop,
56
65
  getSpendGrant,
57
66
  getUser,
@@ -59,9 +68,12 @@ export {
59
68
  initEmbed,
60
69
  isEmbedded,
61
70
  judge,
71
+ listEvents,
72
+ listShared,
62
73
  loadPlayerState,
63
74
  loadWorldState,
64
75
  on,
76
+ putShared,
65
77
  requestSpendGrant,
66
78
  requestWorkflow,
67
79
  resumeWorkflow,
@@ -0,0 +1,528 @@
1
+ type RuntimeGenerationStatus = 'requires_confirmation' | 'queued' | 'dispatching' | 'awaiting_external' | 'succeeded' | 'failed' | 'unknown' | 'canceled' | 'expired';
2
+ /**
3
+ * Who pays. `credits` is the player's Genex credits — every quote and budget
4
+ * issued since 2026-09-25. `coins` is the dormant coin path: a quote or budget
5
+ * issued before then, settling under its frozen terms. `claude` / `chatgpt` is
6
+ * the player's own plan, answered by their watcher, free to Genex.
7
+ */
8
+ type RuntimeGenerationFunding = 'coins' | 'credits' | 'claude' | 'chatgpt';
9
+ /** The wallet a quote or a budget is written in. */
10
+ type RuntimeCurrency = 'coins' | 'credits';
11
+ /**
12
+ * `metered-credits-v1` is how every in-game call is billed now: its real
13
+ * provider cost × (1 + the platform fee), in credits — a one-time call or a
14
+ * workflow captures that rounded UP to a whole credit when it settles; a call
15
+ * under a budget accrues it on the budget's meter, and the player's credits
16
+ * move one whole credit at a time. `standing-credits-v1` is a STANDING BUDGET
17
+ * paid that way (its judge calls included).
18
+ *
19
+ * The coin policies are the dormant path, for quotes and budgets issued before
20
+ * credits: `declared-v1` a fixed coin price per started attempt, `consumed-v1`
21
+ * a coin charge for consumed work, `standing-v1` / `standing-judge-v1` a coin
22
+ * budget, and `metered-v1` its judge calls on a coin meter.
23
+ */
24
+ type RuntimeBillingPolicy = 'consumed-v1' | 'declared-v1' | 'standing-v1' | 'standing-judge-v1' | 'metered-v1' | 'metered-credits-v1' | 'standing-credits-v1';
25
+ /** One option of a `choice`: a description, or a sharper one with its opposite and examples. */
26
+ type RuntimeJudgeCriterion = string | {
27
+ what: string;
28
+ not_for?: string;
29
+ examples?: string[];
30
+ };
31
+ /**
32
+ * A question for the judge. `choice` picks one of up to 255 named options,
33
+ * `score` places the state on a 2–10 level scale, `noul` is a yes/no with a
34
+ * probability. Every text field is at most 2000 characters.
35
+ */
36
+ type RuntimeJudgeQuestion = {
37
+ type: 'choice';
38
+ instructions: string;
39
+ criteria: Record<string, RuntimeJudgeCriterion>;
40
+ } | {
41
+ type: 'score';
42
+ instructions: string;
43
+ criteria: string[];
44
+ } | {
45
+ type: 'noul';
46
+ instructions: string;
47
+ criteria?: {
48
+ true: string;
49
+ false: string;
50
+ };
51
+ };
52
+ /** One answer, of the type its question asked. Probabilities are 0–1. */
53
+ type RuntimeJudgeAnswer = {
54
+ type: 'choice';
55
+ choice: string;
56
+ probabilities: Record<string, number>;
57
+ confidence?: number;
58
+ } | {
59
+ type: 'score';
60
+ score: number;
61
+ probabilities: Record<string, number>;
62
+ confidence?: number;
63
+ legend?: unknown;
64
+ } | {
65
+ type: 'noul';
66
+ noul: number;
67
+ };
68
+ /** The judge door's answer: the call, its answers, and where its money went. */
69
+ interface RuntimeJudgmentView {
70
+ generationId: string;
71
+ grantId: string | null;
72
+ /** `dispatching` only on a replay of a call still running. */
73
+ status: 'succeeded' | 'failed' | 'unknown' | 'canceled' | 'dispatching';
74
+ /** One answer per question asked; present only on `succeeded`. */
75
+ answers?: Record<string, RuntimeJudgeAnswer>;
76
+ error?: string;
77
+ billing: {
78
+ /** `metered-credits-v1` on a credit budget; `metered-v1` on a coin one. */
79
+ billingPolicy: 'metered-v1' | 'metered-credits-v1';
80
+ billingStatus: 'pending' | 'final';
81
+ /** A metered call never charges a unit of its own — its budget's meter does. */
82
+ chargedCoins: 0;
83
+ /** Absent on a stand that predates credits. */
84
+ chargedCredits?: 0;
85
+ /** USD pico-dollars as decimal strings: the provider's reported cost (null
86
+ * when the outcome is unknown) and what the call added to the meter,
87
+ * tariff included (the quoted maximum for an unknown outcome). */
88
+ costUsdPicos: string | null;
89
+ chargedUsdPicos: string | null;
90
+ /** The budget's meter, in whole units of its currency. On a credit meter
91
+ * the credit fields carry the numbers and the coin ones are 0. */
92
+ meter?: {
93
+ status: 'open' | 'closed';
94
+ currency?: RuntimeCurrency;
95
+ accruedUsdPicos: string;
96
+ coinUsdPicos: string;
97
+ reservedCoins: number;
98
+ capturedCoins: number;
99
+ creditUsdPicos?: string;
100
+ reservedCredits?: number;
101
+ capturedCredits?: number;
102
+ };
103
+ };
104
+ grant?: {
105
+ status: RuntimeGrantStatus;
106
+ spentCoins: number;
107
+ heldCoins: number;
108
+ remainingCoins: number;
109
+ spentCredits?: number;
110
+ heldCredits?: number;
111
+ remainingCredits?: number;
112
+ };
113
+ createdAt: string;
114
+ completedAt?: string;
115
+ }
116
+ /**
117
+ * Execution may be terminal while unresolved provider expense still holds money.
118
+ * A credit row carries its numbers in the credit fields and 0 in the coin ones
119
+ * (kept for readers written before credits); a coin row the reverse. The USD
120
+ * fields are beside whichever unit the row is in. A call under a credit budget
121
+ * holds and charges nothing itself — its budget's meter does (`metered`).
122
+ */
123
+ interface RuntimeGenerationBilling {
124
+ billingStatus?: 'pending' | 'final';
125
+ currency?: RuntimeCurrency;
126
+ reservedCoins?: number;
127
+ reservedDisplayUsdCents?: number;
128
+ chargedCoins?: number;
129
+ chargedDisplayUsdCents?: number;
130
+ /** The most the call can move, in whole credits: billed as used, up to this. */
131
+ maxCredits?: number;
132
+ reservedCredits?: number;
133
+ chargedCredits?: number;
134
+ }
135
+ interface RuntimeExternalProvider {
136
+ id: 'claude' | 'chatgpt';
137
+ label: string;
138
+ connectorUrl: string;
139
+ openUrl?: string;
140
+ }
141
+ interface RuntimeWorkflowInput {
142
+ operation: 'create' | 'refactor';
143
+ description: string;
144
+ bundleId: string;
145
+ creatureId?: string;
146
+ revisionDigest?: string;
147
+ }
148
+ interface RuntimeWorkflowOfferings {
149
+ workflowId: string;
150
+ version: string;
151
+ projectId: string;
152
+ usdCentsPerCoin: number;
153
+ /** Which wallet this workflow bills — its executor's registration decides.
154
+ * Absent on a stand that predates credits (coin). */
155
+ currency?: RuntimeCurrency;
156
+ usdCentsPerCredit?: number;
157
+ offerings: {
158
+ id: string;
159
+ bundleId: string;
160
+ modelId: string;
161
+ label: string;
162
+ mode: string;
163
+ funding: RuntimeGenerationFunding;
164
+ free: boolean;
165
+ estimatedModelUsd: string;
166
+ /** The operator-registered margin. Under `metered-credits-v1` it is served
167
+ * unchanged and prices nothing: a credit workflow is billed its real cost
168
+ * × (1 + `feeBps`). */
169
+ priceMultiplier: 2 | 3;
170
+ billingPolicy: RuntimeBillingPolicy;
171
+ currency?: RuntimeCurrency;
172
+ /** Credit offerings: the indicative estimate and the most one request can
173
+ * move, in whole credits, and the fee they are billed at. */
174
+ estimatedCredits?: number;
175
+ maxCredits?: number;
176
+ feeBps?: number;
177
+ estimatedCoins: number;
178
+ estimatedDisplayUsdCents: number;
179
+ maxCoins: number;
180
+ maxPriceDisplayUsdCents: number;
181
+ /** Compatibility aliases for the indicative estimate, never the maximum. */
182
+ priceCoins: number;
183
+ priceDisplayUsdCents: number;
184
+ available: boolean;
185
+ }[];
186
+ externalProviders: RuntimeExternalProvider[];
187
+ }
188
+ interface RuntimeGenerationView extends RuntimeGenerationBilling {
189
+ id: string;
190
+ status: RuntimeGenerationStatus;
191
+ funding: null | RuntimeGenerationFunding;
192
+ projectId: string | null;
193
+ gameName: string;
194
+ /** The game's ADDRESS — a project is addressed by slug wherever a person can
195
+ * click it, and `projectId` is not that. Present only on the surfaces that
196
+ * link out (today the player's activity listing), so a reader must treat
197
+ * its absence as "do not link", never as "the game has no page". */
198
+ gameSlug?: string;
199
+ /** Which build asked. `staging` is a TEST build (`genex preview`), which
200
+ * only the game's owner can generate on — charged exactly like the
201
+ * published game. Absent on a stand older than the tag and on development
202
+ * rows; read absence as "the published game". */
203
+ channel?: 'production' | 'staging';
204
+ modelId: string;
205
+ /** For a judge call, the game's state as JSON text. */
206
+ prompt: string;
207
+ outputFormat: 'text' | 'json' | 'judge';
208
+ schema?: Record<string, unknown>;
209
+ /** A judge call's questions. */
210
+ questions?: Record<string, RuntimeJudgeQuestion>;
211
+ /** A `metered-v1` call's receipt (pico-dollar decimal strings). Absent on other rows. */
212
+ metered?: {
213
+ costUsdPicos: string | null;
214
+ chargedUsdPicos: string | null;
215
+ };
216
+ quote: {
217
+ id: string;
218
+ maxCoins: number;
219
+ /** USD equivalent of the quote's maximum (maxCoins, or maxCredits on a
220
+ * credit quote), never the indicative estimate. */
221
+ priceDisplayUsdCents: number;
222
+ expiresAt: string;
223
+ /** Absent means the legacy promise stored with this quote. */
224
+ billingPolicy?: RuntimeBillingPolicy;
225
+ estimatedCoins?: number;
226
+ estimatedDisplayUsdCents?: number;
227
+ /** A credit quote (`metered-credits-v1`): billed as used, up to `maxCredits`,
228
+ * at `feeBps` over the real cost; `maxCoins` is 0. */
229
+ currency?: RuntimeCurrency;
230
+ maxCredits?: number;
231
+ estimatedCredits?: number;
232
+ feeBps?: number;
233
+ } & ({
234
+ kind?: 'metered';
235
+ estimatedModelUsd?: string;
236
+ priceMultiplier?: 2 | 3;
237
+ } | {
238
+ kind: 'fixed';
239
+ estimatedModelUsd?: string;
240
+ priceMultiplier?: 2 | 3;
241
+ priceCoins: number;
242
+ });
243
+ kind?: 'workflow';
244
+ /** Workflow cancellation is draining provider calls; billing is not settled yet. */
245
+ stopping?: boolean;
246
+ workflow?: {
247
+ id: string;
248
+ offeringId: string;
249
+ bundleId: string;
250
+ operation: 'create' | 'refactor';
251
+ executorId: string;
252
+ validatorVersion: string;
253
+ };
254
+ /** Funding choices are frozen by the server quote; confirmation selects exactly one. */
255
+ allowedFunding?: RuntimeGenerationFunding[];
256
+ externalProvider?: RuntimeExternalProvider;
257
+ externalProviders?: RuntimeExternalProvider[];
258
+ /** Personal submissions do not prove which model or subscription produced them. */
259
+ modelProvenance?: 'unverified';
260
+ development?: boolean;
261
+ /** Development-only actual provider cost and unresolved exposure. Token
262
+ * counts are what the provider REPORTED, never inferred. The fields after
263
+ * `unknownProviderUsdPicos` are optional because a stand that predates them
264
+ * does not send them. */
265
+ usage?: {
266
+ costUsdPicos: string | null;
267
+ costUsd: number | null;
268
+ maxProviderUsdPicos: string;
269
+ unknownProviderUsdPicos: string;
270
+ /** Provider-reported input and output tokens (output includes reasoning); null when none was reported. */
271
+ inputTokens?: number | null;
272
+ outputTokens?: number | null;
273
+ /** This call's own `max_tokens`, funded from its declared ceiling. */
274
+ maxOutputTokens?: number;
275
+ /** The smallest declared price whose funded `max_tokens` holds this answer
276
+ * plus the server's headroom — the declared price also decides how long
277
+ * the answer may be. Null when the length is unknown, the answer was cut
278
+ * off, or no price fits. */
279
+ fitCoins?: number | null;
280
+ /** A CREDIT row's fit: the smallest per-call ceiling, in whole credits,
281
+ * whose funded `max_tokens` holds this answer plus the headroom. */
282
+ fitCredits?: number | null;
283
+ /** No price fits on this stand: the answer is longer than one call may produce. */
284
+ fitExceedsCap?: boolean;
285
+ /** The answer was cut off (`provider_token_limit`), so its true length is unknown. */
286
+ truncated?: boolean;
287
+ };
288
+ /** The provider's own words beside `error`, sanitized (no key shapes, one
289
+ * line, at most 300 characters). DEVELOPMENT ROWS ONLY — the builder is
290
+ * the payer of their own benchmark; a player-facing view never carries it,
291
+ * because it can name providers and internal detail. */
292
+ providerMessage?: string;
293
+ /** Whether this row currently counts against its concurrency cap. Carried
294
+ * only by the development listing (`GET …/development/projects/:id/generations`):
295
+ * a settled row, and a pending bill whose dispatch is no longer recent, hold
296
+ * no slot even while the pending bill still holds its coin. */
297
+ slotHeld?: boolean;
298
+ allowExternal: boolean;
299
+ output?: unknown;
300
+ source?: 'openrouter' | 'external' | 'typesafe';
301
+ error?: string;
302
+ /** The SERVER's clock: when the player asked, when the provider call actually
303
+ * started, and when it stopped running. Measure elapsed from these rather
304
+ * than from when a client first saw the row — that invents a duration for
305
+ * anything already in flight when a page loaded. Optional because a stand
306
+ * older than they are simply omits them. */
307
+ createdAt?: string;
308
+ dispatchedAt?: string;
309
+ completedAt?: string;
310
+ /** Set when a standing budget admitted this call instead of a popup. */
311
+ grantId?: string;
312
+ /** A local watcher is answering personal-plan work for this player right now. */
313
+ watcherOnline?: boolean;
314
+ }
315
+ type RuntimeGrantStatus = 'requires_confirmation' | 'active' | 'suspended_insufficient_funds' | 'waiting_for_plan' | 'exhausted' | 'stopped' | 'expired';
316
+ /**
317
+ * The judge's terms on a budget, frozen with it. `estimatedCallsPerPeriod` is
318
+ * the GAME's estimate; `worstCaseCoinsPerPeriod` is the SERVER's — every one of
319
+ * those calls at the largest request the judge door admits, tariff included,
320
+ * rounded up to whole coins. Show them attributed that way.
321
+ */
322
+ interface RuntimeGrantJudgeTerms {
323
+ enabled: true;
324
+ modelId: string;
325
+ /** `metered-credits-v1` on a credit budget; `metered-v1` on a coin one. */
326
+ billingPolicy: 'metered-v1' | 'metered-credits-v1';
327
+ estimatedCallsPerPeriod: number;
328
+ /** A coin budget's worst case; 0 on a credit budget. */
329
+ worstCaseCoinsPerPeriod: number;
330
+ /** A credit budget's worst case, in whole credits. */
331
+ worstCaseCreditsPerPeriod?: number;
332
+ }
333
+ /** Frozen at creation and read off the grant forever; live config never decides a spend. */
334
+ interface RuntimeGrantTerms {
335
+ /** `standing-credits-v1` for every budget quoted since 2026-09-25 (judge or
336
+ * not); `standing-v1` / `standing-judge-v1` are the dormant coin budgets. */
337
+ billingPolicy: 'standing-v1' | 'standing-judge-v1' | 'standing-credits-v1';
338
+ /** Absent on a coin budget quoted before credits. */
339
+ currency?: RuntimeCurrency;
340
+ models: string[];
341
+ /** Coin terms: 0 on a credit budget. */
342
+ perCallMaxCoins: number;
343
+ perCallEstimateCoins: number;
344
+ /** Credit terms: the per-call CEILING the player approves, and the game's
345
+ * honest per-call estimate the disclosure is built on — never a price. */
346
+ perCallMaxCredits?: number;
347
+ perCallEstimateCredits?: number;
348
+ maxConcurrent: number;
349
+ maxCallsPerMinute: number;
350
+ maxPendingExternal: number;
351
+ /** The DEVELOPER's estimate. Always shown attributed, never as a Genex figure. */
352
+ disclosure: {
353
+ periodLabel: 'minute' | 'hour' | 'session';
354
+ estimatedCallsPerPeriod: number;
355
+ /** A coin budget's figure; 0 on a credit budget. */
356
+ estimatedCoinsPerPeriod: number;
357
+ estimatedCreditsPerPeriod?: number;
358
+ };
359
+ /** Server-owned slider bounds. A client never decides the range. On a credit
360
+ * budget the credit bounds carry the numbers and the coin ones are 0. */
361
+ limit: {
362
+ minCoins: number;
363
+ maxCoins: number;
364
+ stepCoins: number;
365
+ defaultCoins: number;
366
+ minUsdCents: number;
367
+ maxUsdCents: number;
368
+ stepUsdCents: number;
369
+ minCredits?: number;
370
+ maxCredits?: number;
371
+ stepCredits?: number;
372
+ defaultCredits?: number;
373
+ };
374
+ /** Present when the budget also admits the judge. */
375
+ judge?: RuntimeGrantJudgeTerms;
376
+ }
377
+ interface RuntimeGrantView {
378
+ id: string;
379
+ status: RuntimeGrantStatus;
380
+ funding: null | RuntimeGenerationFunding;
381
+ projectId: string | null;
382
+ gameName: string;
383
+ /** The game's address, on the same terms as `RuntimeGenerationView.gameSlug`. */
384
+ gameSlug?: string;
385
+ /** The build that requested the budget, on the same terms as `RuntimeGenerationView.channel`. */
386
+ channel?: 'production' | 'staging';
387
+ quoteId: string;
388
+ terms: RuntimeGrantTerms;
389
+ allowedFunding: RuntimeGenerationFunding[];
390
+ externalProviders?: RuntimeExternalProvider[];
391
+ usdCentsPerCoin: number;
392
+ /** `credits` on every budget quoted since 2026-09-25. Absent on an older stand. */
393
+ currency?: RuntimeCurrency;
394
+ /** Coin funding. `heldCoins` is admitted work not settled yet. 0 on a credit budget. */
395
+ limitCoins: number;
396
+ limitDisplayUsdCents: number;
397
+ spentCoins: number;
398
+ spentDisplayUsdCents: number;
399
+ heldCoins: number;
400
+ remainingCoins: number;
401
+ /** Credit funding: the limit the player chose, what settled, what the budget
402
+ * holds for calls not yet settled (and a remainder under one credit), and
403
+ * what is left. */
404
+ usdCentsPerCredit?: number;
405
+ limitCredits?: number;
406
+ spentCredits?: number;
407
+ heldCredits?: number;
408
+ remainingCredits?: number;
409
+ /** Personal-plan funding meters REQUESTS; the ledger never sees them. */
410
+ limitCalls: number;
411
+ perCallEstimateUsdCents: number;
412
+ callCount: number;
413
+ externalCallCount: number;
414
+ expiresAt: string;
415
+ lastCallAt?: string;
416
+ stopRequestedAt?: string;
417
+ stopReason?: string;
418
+ createdAt: string;
419
+ /** When a `waiting_for_plan` budget may admit again. The player's OWN plan
420
+ * said wait and named the time; it is a clock, never a paid fallback. Sent
421
+ * only while the status is `waiting_for_plan`. */
422
+ resumeAt?: string;
423
+ watcherOnline?: boolean;
424
+ }
425
+ interface RuntimeGenerationModels {
426
+ enabled: true;
427
+ /**
428
+ * Every model this stand serves, FEATURED FIRST then by vendor and label.
429
+ *
430
+ * The catalog is synced from OpenRouter and filtered, so it can be long:
431
+ * `featured` marks the short set the operator stands behind, and a picker
432
+ * should render that set unless the player asked to see everything. Where
433
+ * `featuredCount` is 0 this whole list IS the short list.
434
+ *
435
+ * Everything past the four pricing fields is optional because a stand running
436
+ * off the hand-written env list alone knows none of it.
437
+ */
438
+ models: {
439
+ id: string;
440
+ label: string;
441
+ inputUsdPerMillion: number;
442
+ outputUsdPerMillion: number;
443
+ /** The id's prefix — `google`, `anthropic`, … */
444
+ vendor?: string;
445
+ contextLength?: number;
446
+ featured?: boolean;
447
+ /** Which personal subscription could fund this model, or null for none. */
448
+ personalPlan?: 'claude' | 'chatgpt' | null;
449
+ /** Serves strict `json_schema` output. */
450
+ structuredOutputs?: boolean;
451
+ /** Which door calls it: `openrouter` is `generate()`, `typesafe` is the
452
+ * judge (`judge()` under a budget that enabled it). Absent on a stand
453
+ * that predates the judge, where every model is `openrouter`. */
454
+ kind?: 'openrouter' | 'typesafe';
455
+ }[];
456
+ externalProviders: RuntimeExternalProvider[];
457
+ /** How many rows are in `models`. */
458
+ total?: number;
459
+ /** How many of them are featured. 0 means this stand features nothing. */
460
+ featuredCount?: number;
461
+ /** What a developer should add to a benchmarked figure. Never typed into copy. */
462
+ recommendedDeclaredHeadroomBps?: number;
463
+ /**
464
+ * This stand's size of one call, served so no game or doc types a number.
465
+ * `maxPromptBytes` and `maxSchemaBytes` are UTF-8 bytes (a prompt over its
466
+ * cap is `prompt_too_large`); `defaultOutputTokens` is a call's output budget
467
+ * when it names no `maxOutputTokens`, and `maxOutputTokens` the most one may
468
+ * ask for (`output_tokens_too_large` above it) — what a call is given is
469
+ * also bounded by what its ceiling funds; `maxOutputBytes` is the answer's
470
+ * JSON-encoded size. Absent on a stand that predates them.
471
+ */
472
+ limits?: {
473
+ maxPromptBytes: number;
474
+ maxSchemaBytes: number;
475
+ defaultOutputTokens: number;
476
+ maxOutputTokens: number;
477
+ maxOutputBytes: number;
478
+ };
479
+ /** `credits`: in-game calls are paid from the player's credits. */
480
+ currency?: RuntimeCurrency;
481
+ /** The fee a call is billed at over its real provider cost, in basis points. */
482
+ feeBps?: number;
483
+ usdCentsPerCredit?: number;
484
+ /** The slider a new budget freezes, in credits. */
485
+ standingCreditGrant?: {
486
+ minCredits: number;
487
+ maxCredits: number;
488
+ stepCredits: number;
489
+ defaultCredits: number;
490
+ minUsdCents: number;
491
+ maxUsdCents: number;
492
+ stepUsdCents: number;
493
+ };
494
+ /** The dormant coin slider, kept for readers written before credits. */
495
+ standingGrant?: RuntimeGrantTerms['limit'];
496
+ /**
497
+ * The stand's own probe of its provider key — one word, nothing else.
498
+ * `rejected` means every in-game call answers `provider_http_401` until an
499
+ * operator replaces the key; `unknown` means it has not asked yet or could
500
+ * not reach the provider. Absent on a stand that predates the probe.
501
+ */
502
+ providerKey?: 'ok' | 'rejected' | 'unknown';
503
+ }
504
+ /**
505
+ * What `POST /api/runtime/grants/:id/generations/stream` sends, as
506
+ * `text/event-stream`, in this order: one `start`, any number of `delta`, one
507
+ * `done`. `delta.text` is the answer's text in order — a JSON answer arrives as
508
+ * its raw text — and is NEVER the answer: only `done` is, and it carries the
509
+ * same view `GET /generations/:id` returns. A `done` whose status is not
510
+ * terminal (`queued`, `dispatching`, `awaiting_external`) means the call runs
511
+ * elsewhere — poll that id.
512
+ */
513
+ type RuntimeGenerationStreamEvent = {
514
+ event: 'start';
515
+ data: {
516
+ generationId: string;
517
+ };
518
+ } | {
519
+ event: 'delta';
520
+ data: {
521
+ text: string;
522
+ };
523
+ } | {
524
+ event: 'done';
525
+ data: RuntimeGenerationView;
526
+ };
527
+
528
+ export type { RuntimeJudgeQuestion as R, RuntimeWorkflowInput as a, RuntimeGenerationView as b, RuntimeJudgeAnswer as c, RuntimeJudgmentView as d, RuntimeGenerationBilling as e, RuntimeGenerationFunding as f, RuntimeGrantView as g, RuntimeGenerationModels as h, RuntimeWorkflowOfferings as i, RuntimeBillingPolicy as j, RuntimeCurrency as k, RuntimeExternalProvider as l, RuntimeGenerationStatus as m, RuntimeGenerationStreamEvent as n, RuntimeGrantJudgeTerms as o, RuntimeGrantStatus as p, RuntimeGrantTerms as q, RuntimeJudgeCriterion as r };
package/dist/sentry.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  _stashTicketFromUrl,
3
3
  getUser,
4
4
  on
5
- } from "./chunk-SJLIF32C.js";
5
+ } from "./chunk-FBJN7DGJ.js";
6
6
  import "./chunk-MJPLBT3T.js";
7
7
 
8
8
  // src/sentry.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genex-ai/embed-sdk",
3
- "version": "0.29.0",
4
- "description": "Player identity + durable game state for genex games \u2014 signed-in or guest play, per-player save slots, shared world state, and soft-trust leaderboards.",
3
+ "version": "0.30.1",
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",
7
7
  "types": "./dist/index.d.ts",
@@ -30,7 +30,8 @@
30
30
  "build": "tsup",
31
31
  "typecheck": "tsc --noEmit",
32
32
  "test": "node --test test/*.test.ts",
33
- "check": "pnpm build && publint && attw --pack . --profile esm-only",
33
+ "check": "pnpm build && publint && attw --pack . --profile esm-only && node scripts/check-packed-types.mjs",
34
+ "check:packed-types": "node scripts/check-packed-types.mjs",
34
35
  "prepack": "pnpm build && publint"
35
36
  },
36
37
  "publishConfig": {