@genex-ai/embed-sdk 0.35.0 → 0.37.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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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';
1
+ import { R as RuntimeConversationFields, a as RuntimeControlFields, b as RuntimeJudgeQuestion, e as RuntimeJudgeAnswer, f as RuntimeJudgmentView, c as RuntimeWorkflowInput, g as RuntimeGenerationBilling, h as RuntimeGenerationFunding, i as RuntimeGrantView, j as RuntimeMessage, d as RuntimeGenerationView, k as RuntimeGenerationModels, l as RuntimeWorkflowOfferings, m as RuntimeRoomLendView } from './runtime-generation-D4RMgsvn.js';
2
+ export { n as RuntimeBillingPolicy, o as RuntimeControl, p as RuntimeCurrency, q as RuntimeExternalProvider, r as RuntimeGenerationFeatures, s as RuntimeGenerationStatus, t as RuntimeGenerationStreamEvent, u as RuntimeGrantJudgeTerms, v as RuntimeGrantStatus, w as RuntimeGrantTerms, x as RuntimeJudgeCriterion, y as RuntimeReasoningEffort } from './runtime-generation-D4RMgsvn.js';
3
3
 
4
4
  /**
5
5
  * Why a platform call did not happen. One vocabulary for every SDK function,
@@ -263,7 +263,18 @@ declare function getPayments(opts?: {
263
263
  */
264
264
  declare function requestPayment(opts: PaymentOptions): Promise<PaymentResult>;
265
265
 
266
- interface GenerateOptions {
266
+ /**
267
+ * A call may be more than one block of text: `system` is the game's own
268
+ * instruction, `messages` a conversation of `user` / `assistant` turns, and
269
+ * `temperature`, `topP`, `stop`, `seed`, `reasoningEffort` and `cacheSystem`
270
+ * steer the model. They are accepted by a stand whose getGenerationModels()
271
+ * says `features.messages`, and each control by a model that lists it in its
272
+ * `controls` (else `unsupported_parameter`, nothing charged). On a stand that
273
+ * does not accept them the SDK still runs the call: it folds `system`,
274
+ * `messages` and `prompt` into one prompt (foldGenerationRequest() is that
275
+ * text) and drops the controls, so a game written this way works everywhere.
276
+ */
277
+ interface GenerateOptions extends RuntimeConversationFields, RuntimeControlFields {
267
278
  /**
268
279
  * The call's CEILING in the player's Genex credits (SDK 0.27+). Not a price:
269
280
  * the call is billed AS USED — its real model cost plus the Genex fee, and a
@@ -276,7 +287,9 @@ interface GenerateOptions {
276
287
  * as the call's credit ceiling. Kept so games built on earlier versions work. */
277
288
  estimateCoins?: number;
278
289
  modelId: string;
279
- prompt: string;
290
+ /** What to answer. Required unless `messages` ends with the user's turn;
291
+ * sent with `messages`, it is the last user turn after them. */
292
+ prompt?: string;
280
293
  outputFormat: 'text' | 'json';
281
294
  schema?: Record<string, unknown>;
282
295
  /**
@@ -312,10 +325,16 @@ interface RuntimeGenerationResult extends RuntimeGenerationBilling {
312
325
  generationId?: string;
313
326
  output?: unknown;
314
327
  /** External output is user-supplied; never use it as authority for rewards or money.
315
- * `typesafe` appears only on a judge call read back through getGeneration(). */
316
- source?: 'openrouter' | 'external' | 'typesafe';
328
+ * `typesafe` appears only on a judge call read back through getGeneration().
329
+ * `practice` is the builder's local helper (`genex llm practice`): made-up
330
+ * output on a dev server, which authorizes nothing either. */
331
+ source?: 'openrouter' | 'external' | 'typesafe' | 'practice';
317
332
  modelProvenance?: 'unverified';
318
333
  error?: string;
334
+ /** With `error: 'content_blocked'`: `input` — what was sent was refused
335
+ * before the model ran, at no charge — or `output` — the model's answer was
336
+ * withheld. Absent otherwise, and on a stand that predates the check. */
337
+ contentBlocked?: 'input' | 'output';
319
338
  }
320
339
  interface RequestWorkflowOptions {
321
340
  /**
@@ -345,6 +364,16 @@ interface RuntimeWorkflowAuthorization extends RuntimeGenerationBilling {
345
364
  }
346
365
  /** Available models and pricing; the confirmation always uses a fresh server quote. */
347
366
  declare function getGenerationModels(): Promise<RuntimeGenerationModels>;
367
+ /**
368
+ * The one prompt a call's `system`, `messages` and `prompt` fold into — what
369
+ * the SDK sends a stand that does not accept them, and the same text Genex
370
+ * hands a player's own plan. A call that is only a prompt is that prompt.
371
+ */
372
+ declare function foldGenerationRequest(request: {
373
+ system?: string;
374
+ messages?: readonly RuntimeMessage[];
375
+ prompt?: string;
376
+ }): string;
348
377
  /** Server-owned estimates, reservation maxima and availability. Confirmation seals the quote. */
349
378
  declare function getWorkflowOfferings(workflowId: string): Promise<RuntimeWorkflowOfferings>;
350
379
  /** Recover an operation by ID after a reload. Scoped to this player AND this game. */
@@ -421,14 +450,50 @@ interface SpendGrantOptions {
421
450
  enabled: boolean;
422
451
  estimatedCallsPerPeriod: number;
423
452
  };
453
+ /**
454
+ * The game's multiplayer server may also spend this budget (0.37+): in a
455
+ * server-authoritative room this player lends it to with
456
+ * lendSpendGrantToRoom(), for AI everyone in the room shares. The sheet tells
457
+ * the player so in one sentence, and a budget approved without it can never
458
+ * be spent by a server. Only on a stand whose getGenerationModels() says
459
+ * `features.roomCalls`; on any other the request fails with
460
+ * `room_calls_unavailable` and asks the player nothing.
461
+ */
462
+ shareWithRooms?: boolean;
424
463
  /** Reuse for the same budget request across retries and reloads. */
425
464
  idempotencyKey?: string;
426
465
  /** Approval waiting time only. A timeout neither cancels nor charges. */
427
466
  timeoutMs?: number;
467
+ /** Omit, or `false`: a budget the PLAYER approves and pays (this interface).
468
+ * `true` asks for one the game's creator pays: see SponsoredGrantOptions. */
469
+ sponsored?: false;
428
470
  }
471
+ /**
472
+ * A budget paid by the GAME'S CREATOR, from the allowance they set with
473
+ * `genex llm sponsor set`. The player approves nothing and pays nothing: no
474
+ * sheet opens, and the request needs no click.
475
+ *
476
+ * Only what the game NEEDS is asked for — the models and the per-call ceiling
477
+ * — and it must fit what the creator allowed. Everything else is the
478
+ * creator's and the server's: the limit is what is left of this player's
479
+ * allowance for the day, the pace is the creator's, and a personal plan never
480
+ * applies. The other SpendGrantOptions fields are accepted and ignored, so one
481
+ * options object can serve this request and the player-paid fallback.
482
+ */
483
+ type SponsoredGrantOptions = Omit<Partial<SpendGrantOptions>, 'sponsored' | 'models'> & {
484
+ sponsored: true;
485
+ /** Models this budget may spend on. One to eight, or none for a judge-only budget. */
486
+ models: string[];
487
+ };
429
488
  interface SpendGrantResult {
430
- /** `active` means the budget is approved and generate({ grantId }) may run. */
431
- status: 'active' | 'canceled' | 'expired' | 'failed' | 'pending';
489
+ /**
490
+ * `active` means the budget can serve calls and generate({ grantId }) may run.
491
+ * `unavailable` is the answer to a SPONSORED request only: the creator's
492
+ * allowance cannot serve this player now (`error` says why). Nothing was
493
+ * asked of the player and nothing is charged — fall back to a player-paid
494
+ * request, or to content that needs no model.
495
+ */
496
+ status: 'active' | 'canceled' | 'expired' | 'failed' | 'pending' | 'unavailable';
432
497
  grantId?: string;
433
498
  /** The authoritative server view: limit, spend, counts and the frozen terms. */
434
499
  grant?: RuntimeGrantView;
@@ -457,6 +522,29 @@ declare function getActiveSpendGrant(): Promise<RuntimeGrantView | null>;
457
522
  * same lever on Genex and it always outranks the game's.
458
523
  */
459
524
  declare function stopSpendGrant(grantId: string): Promise<RuntimeGrantView>;
525
+ /**
526
+ * Lend this player's budget to the server-authoritative room they are in
527
+ * (0.37+), so the game's room module may ask a model on it. `roomId` is the
528
+ * room's id as the multiplayer session names it (`session.code` of
529
+ * `connectAuthority()`). Call it once the player has joined the room; calling
530
+ * it again for the same room is the same lend.
531
+ *
532
+ * Only a budget requested with `shareWithRooms: true` can be lent
533
+ * (`grant_not_shareable` otherwise), only to a live room of this same game
534
+ * (`room_not_found`), and only by its owner. Every call the room makes is an
535
+ * ordinary call of the budget: the same per-call ceiling, limit and pace the
536
+ * player approved, on the same receipts, marked as asked for by the game's
537
+ * server. Rejects with the server's code, like getSpendGrant();
538
+ * `room_calls_unavailable` on a stand that does not have room calls.
539
+ */
540
+ declare function lendSpendGrantToRoom(grantId: string, roomId: string): Promise<RuntimeRoomLendView>;
541
+ /**
542
+ * Take the budget back from a room (0.37+): nothing more of the room's is
543
+ * admitted on it. A call already running finishes and is charged, as after
544
+ * any stop. Leaving the room, stopping the budget or signing out ends a lend
545
+ * too; this is for a game that offers the player a switch.
546
+ */
547
+ declare function returnSpendGrantFromRoom(grantId: string, roomId: string): Promise<RuntimeRoomLendView>;
460
548
  /**
461
549
  * Ask the player for a standing budget. Call it directly from a click handler,
462
550
  * before awaiting anything: the trusted surface is reserved synchronously, just
@@ -472,7 +560,7 @@ declare function stopSpendGrant(grantId: string): Promise<RuntimeGrantView>;
472
560
  * approve). So ask getActiveSpendGrant() first: a game that reuses the running
473
561
  * budget does not ask the player again every session.
474
562
  */
475
- declare function requestSpendGrant(options: SpendGrantOptions): Promise<SpendGrantResult>;
563
+ declare function requestSpendGrant(options: SpendGrantOptions | SponsoredGrantOptions): Promise<SpendGrantResult>;
476
564
  interface GenerateStreamOptions extends GenerateOptions {
477
565
  /** A standing budget from requestSpendGrant(). Required: only a budget streams. */
478
566
  grantId: string;
@@ -526,6 +614,9 @@ interface JudgeResult {
526
614
  error?: string;
527
615
  /** Where the call's money went: never a credit of its own, always the budget's meter. */
528
616
  billing?: RuntimeJudgmentView['billing'];
617
+ /** `practice`: answered by the builder's local helper (`genex llm practice`),
618
+ * not the classifier. Absent on every real answer. */
619
+ source?: 'practice';
529
620
  }
530
621
  /**
531
622
  * Ask the budget's classifier. No popup, no user gesture — the player approved
@@ -1011,6 +1102,12 @@ type AuthorityRegion = {
1011
1102
  * is its own matchmaking pool. Empty when the stand names no regions, and in local test mode; `urls`
1012
1103
  * alone are then used. Fresh copies: editing them changes nothing. */
1013
1104
  declare function getAuthorityRegions(): AuthorityRegion[];
1105
+ /** The player's home region (multiplayer PROTOCOL.md §17.1 *Regions*, server-owned): the region of
1106
+ * {@link getAuthorityRegions} nearest the player by geography, which the server names from the country
1107
+ * the request came from. Pass to `connectAuthority()` as `home`: that region is joined and created in
1108
+ * first, whatever a latency probe measured. Undefined when the server names none (no country, an older
1109
+ * API), when it names a region it does not serve, and in local test mode. */
1110
+ declare function getAuthorityHome(): string | undefined;
1014
1111
  /**
1015
1112
  * Resolves with the signed-in ACCOUNT once authenticated; rejects if the
1016
1113
  * session ends up blocked. THE gate for /state saves and any account-bound
@@ -1192,4 +1289,4 @@ declare function __resetForTests(overrides?: {
1192
1289
  platformConfirmTimeoutMs?: number;
1193
1290
  }): void;
1194
1291
 
1195
- 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, 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 };
1292
+ 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, RuntimeMessage, RuntimeRoomLendView, 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 SponsoredGrantOptions, type SubmitScoreResult, type WorldStateResult, __resetForTests, _stashTicketFromUrl, appendEvent, buy, consumeEntitlement, copyText, deleteShared, foldGenerationRequest, 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, lendSpendGrantToRoom, listEvents, listShared, loadPlayerState, loadWorldState, on, onShellClosing, openExternal, putShared, requestPayment, requestSpendGrant, requestWorkflow, resumeWorkflow, returnSpendGrantFromRoom, saveFile, savePlayerState, saveWorldState, setFullscreen, share, stopSpendGrant, submitScore, supports, waitForAuth, waitForGeneration, waitForPlayer };
package/dist/index.js CHANGED
@@ -7,11 +7,13 @@ import {
7
7
  consumeEntitlement,
8
8
  copyText,
9
9
  deleteShared,
10
+ foldGenerationRequest,
10
11
  generate,
11
12
  generateStream,
12
13
  generationErrorMessage,
13
14
  getActiveSpendGrant,
14
15
  getAuthState,
16
+ getAuthorityHome,
15
17
  getAuthorityRegions,
16
18
  getAuthorityUrls,
17
19
  getColyseusAuth,
@@ -35,6 +37,7 @@ import {
35
37
  isEmbedded,
36
38
  judge,
37
39
  keepAwake,
40
+ lendSpendGrantToRoom,
38
41
  listEvents,
39
42
  listShared,
40
43
  loadPlayerState,
@@ -47,6 +50,7 @@ import {
47
50
  requestSpendGrant,
48
51
  requestWorkflow,
49
52
  resumeWorkflow,
53
+ returnSpendGrantFromRoom,
50
54
  saveFile,
51
55
  savePlayerState,
52
56
  saveWorldState,
@@ -58,8 +62,8 @@ import {
58
62
  waitForAuth,
59
63
  waitForGeneration,
60
64
  waitForPlayer
61
- } from "./chunk-KEW6LYT2.js";
62
- import "./chunk-QBCWKMVQ.js";
65
+ } from "./chunk-5VDV25LF.js";
66
+ import "./chunk-WQJM5MJL.js";
63
67
  export {
64
68
  ItemState,
65
69
  __resetForTests,
@@ -69,11 +73,13 @@ export {
69
73
  consumeEntitlement,
70
74
  copyText,
71
75
  deleteShared,
76
+ foldGenerationRequest,
72
77
  generate,
73
78
  generateStream,
74
79
  generationErrorMessage,
75
80
  getActiveSpendGrant,
76
81
  getAuthState,
82
+ getAuthorityHome,
77
83
  getAuthorityRegions,
78
84
  getAuthorityUrls,
79
85
  getColyseusAuth,
@@ -97,6 +103,7 @@ export {
97
103
  isEmbedded,
98
104
  judge,
99
105
  keepAwake,
106
+ lendSpendGrantToRoom,
100
107
  listEvents,
101
108
  listShared,
102
109
  loadPlayerState,
@@ -109,6 +116,7 @@ export {
109
116
  requestSpendGrant,
110
117
  requestWorkflow,
111
118
  resumeWorkflow,
119
+ returnSpendGrantFromRoom,
112
120
  saveFile,
113
121
  savePlayerState,
114
122
  saveWorldState,
@@ -20,8 +20,50 @@ type RuntimeCurrency = 'coins' | 'credits';
20
20
  * credits: `declared-v1` a fixed coin price per started attempt, `consumed-v1`
21
21
  * a coin charge for consumed work, `standing-v1` / `standing-judge-v1` a coin
22
22
  * budget, and `metered-v1` its judge calls on a coin meter.
23
+ *
24
+ * `standing-sponsored-v1` is a budget the game's CREATOR pays for (a sponsored
25
+ * allowance): nobody approves it and no sheet may, because the money is not
26
+ * the player's.
23
27
  */
24
- type RuntimeBillingPolicy = 'consumed-v1' | 'declared-v1' | 'standing-v1' | 'standing-judge-v1' | 'metered-v1' | 'metered-credits-v1' | 'standing-credits-v1';
28
+ type RuntimeBillingPolicy = 'consumed-v1' | 'declared-v1' | 'standing-v1' | 'standing-judge-v1' | 'metered-v1' | 'metered-credits-v1' | 'standing-credits-v1' | 'standing-sponsored-v1';
29
+ /** One turn of a conversation. Exactly two roles and plain text: a game can
30
+ * never write a `system`, `tool` or `developer` turn, or a non-text part. */
31
+ interface RuntimeMessage {
32
+ role: 'user' | 'assistant';
33
+ content: string;
34
+ }
35
+ /** How hard a thinking model may think. `none` switches thinking off. */
36
+ type RuntimeReasoningEffort = 'none' | 'low' | 'medium' | 'high';
37
+ /** The controls a model has to support; a model's row lists the ones it takes. */
38
+ type RuntimeControl = 'temperature' | 'topP' | 'stop' | 'seed' | 'reasoningEffort';
39
+ /** What a call may carry beside (or instead of) `prompt`. */
40
+ interface RuntimeConversationFields {
41
+ /** The game's own instruction. Genex's fixed line stays ahead of it. */
42
+ system?: string;
43
+ /** `user` / `assistant` turns, alternating, starting with `user`. With a
44
+ * `prompt` they end on `assistant` (the prompt is the last user turn);
45
+ * without one they end on `user`. */
46
+ messages?: RuntimeMessage[];
47
+ }
48
+ /** Sampling and reasoning controls. Each needs a model that takes it
49
+ * (`RuntimeGenerationModels.models[].controls`), else `unsupported_parameter`. */
50
+ interface RuntimeControlFields {
51
+ /** 0–2. */
52
+ temperature?: number;
53
+ /** 0–1. */
54
+ topP?: number;
55
+ /** A few short strings (the stand serves how many and how long). */
56
+ stop?: string[];
57
+ /** A whole number, 0 to 2,147,483,647. Best effort: not every model is deterministic. */
58
+ seed?: number;
59
+ /** One of the model's `reasoningEfforts`. Reasoning tokens are output
60
+ * tokens: they count against the answer's funded length, so `none` or
61
+ * `low` is the way out for an answer cut off while thinking. */
62
+ reasoningEffort?: RuntimeReasoningEffort;
63
+ /** Mark the `system` block as a cacheable prefix where the vendor needs to
64
+ * be told (Anthropic); a no-op where caching is automatic or absent. */
65
+ cacheSystem?: boolean;
66
+ }
25
67
  /** One option of a `choice`: a description, or a sharper one with its opposite and examples. */
26
68
  type RuntimeJudgeCriterion = string | {
27
69
  what: string;
@@ -112,6 +154,9 @@ interface RuntimeJudgmentView {
112
154
  };
113
155
  createdAt: string;
114
156
  completedAt?: string;
157
+ /** `practice`: answered by the builder's local helper (`genex llm practice`),
158
+ * never by the classifier. Absent on every real answer. */
159
+ source?: 'practice';
115
160
  }
116
161
  /**
117
162
  * Execution may be terminal while unresolved provider expense still holds money.
@@ -185,7 +230,7 @@ interface RuntimeWorkflowOfferings {
185
230
  }[];
186
231
  externalProviders: RuntimeExternalProvider[];
187
232
  }
188
- interface RuntimeGenerationView extends RuntimeGenerationBilling {
233
+ interface RuntimeGenerationView extends RuntimeGenerationBilling, RuntimeConversationFields, RuntimeControlFields {
189
234
  id: string;
190
235
  status: RuntimeGenerationStatus;
191
236
  funding: null | RuntimeGenerationFunding;
@@ -201,9 +246,17 @@ interface RuntimeGenerationView extends RuntimeGenerationBilling {
201
246
  * published game. Absent on a stand older than the tag and on development
202
247
  * rows; read absence as "the published game". */
203
248
  channel?: 'production' | 'staging';
249
+ /** Who asked, when it was not the player's own browser: `room` is the game's multiplayer
250
+ * server, on a budget the player lent it. Only on the player's own reads on Genex. */
251
+ origin?: 'room';
204
252
  modelId: string;
205
- /** For a judge call, the game's state as JSON text. */
253
+ /** For a judge call, the game's state as JSON text. Empty on a call that
254
+ * sent `messages` alone; `system`, `messages` and the controls are beside
255
+ * it, as sent. */
206
256
  prompt: string;
257
+ /** Controls this call asked for that its funding cannot honour: a call
258
+ * answered on the player's own plan is run as one prompt and takes none. */
259
+ ignoredControls?: string[];
207
260
  outputFormat: 'text' | 'json' | 'judge';
208
261
  schema?: Record<string, unknown>;
209
262
  /** A judge call's questions. */
@@ -270,6 +323,10 @@ interface RuntimeGenerationView extends RuntimeGenerationBilling {
270
323
  /** Provider-reported input and output tokens (output includes reasoning); null when none was reported. */
271
324
  inputTokens?: number | null;
272
325
  outputTokens?: number | null;
326
+ /** Of the input, what the provider read from its cache; of the output,
327
+ * what was reasoning. Present only when the provider reported one. */
328
+ cachedInputTokens?: number;
329
+ reasoningTokens?: number;
273
330
  /** This call's own `max_tokens`, funded from its declared ceiling. */
274
331
  maxOutputTokens?: number;
275
332
  /** The smallest declared price whose funded `max_tokens` holds this answer
@@ -297,8 +354,18 @@ interface RuntimeGenerationView extends RuntimeGenerationBilling {
297
354
  slotHeld?: boolean;
298
355
  allowExternal: boolean;
299
356
  output?: unknown;
300
- source?: 'openrouter' | 'external' | 'typesafe';
357
+ /** `practice` is the builder's local helper (`genex llm practice`): made-up
358
+ * output on a dev server, which authorizes nothing. */
359
+ source?: 'openrouter' | 'external' | 'typesafe' | 'practice';
301
360
  error?: string;
361
+ /** Beside the error `content_blocked` only: which side the content check
362
+ * refused (`RUNTIME_CONTENT_BLOCKED`). Absent on every other call. */
363
+ contentBlocked?: RuntimeContentBlockedSide;
364
+ /** When the stand removed this settled call's stored text under its
365
+ * retention setting: `prompt` is then empty and `output` null, whatever the
366
+ * status — keep what your game needs when the call resolves. Absent on a
367
+ * call whose text is still stored. */
368
+ textRemovedAt?: string;
302
369
  /** The SERVER's clock: when the player asked, when the provider call actually
303
370
  * started, and when it stopped running. Measure elapsed from these rather
304
371
  * than from when a client first saw the row — that invents a duration for
@@ -309,6 +376,8 @@ interface RuntimeGenerationView extends RuntimeGenerationBilling {
309
376
  completedAt?: string;
310
377
  /** Set when a standing budget admitted this call instead of a popup. */
311
378
  grantId?: string;
379
+ /** The game's creator paid for this call (a sponsored budget), not the player. */
380
+ sponsored?: true;
312
381
  /** A local watcher is answering personal-plan work for this player right now. */
313
382
  watcherOnline?: boolean;
314
383
  }
@@ -334,7 +403,7 @@ interface RuntimeGrantJudgeTerms {
334
403
  interface RuntimeGrantTerms {
335
404
  /** `standing-credits-v1` for every budget quoted since 2026-09-25 (judge or
336
405
  * not); `standing-v1` / `standing-judge-v1` are the dormant coin budgets. */
337
- billingPolicy: 'standing-v1' | 'standing-judge-v1' | 'standing-credits-v1';
406
+ billingPolicy: 'standing-v1' | 'standing-judge-v1' | 'standing-credits-v1' | 'standing-sponsored-v1';
338
407
  /** Absent on a coin budget quoted before credits. */
339
408
  currency?: RuntimeCurrency;
340
409
  models: string[];
@@ -373,6 +442,21 @@ interface RuntimeGrantTerms {
373
442
  };
374
443
  /** Present when the budget also admits the judge. */
375
444
  judge?: RuntimeGrantJudgeTerms;
445
+ /** The game's multiplayer server may also spend this budget, in a server-authoritative room its
446
+ * owner lends it to. Present, and `true`, only on a budget that was requested that way; the
447
+ * approval sheet says so. */
448
+ shareWithRooms?: true;
449
+ }
450
+ /** A budget lent to one server-authoritative room, as its owner reads it. */
451
+ interface RuntimeRoomLendView {
452
+ id: string;
453
+ grantId: string;
454
+ roomId: string;
455
+ /** `ended`: the room's calls no longer run on this budget. */
456
+ status: 'active' | 'ended';
457
+ /** Why it ended: `returned` (the player took it back), `left_room`, or the budget's own end. */
458
+ endReason?: string;
459
+ createdAt: string;
376
460
  }
377
461
  interface RuntimeGrantView {
378
462
  id: string;
@@ -429,9 +513,38 @@ interface RuntimeGrantView {
429
513
  * the live budgets of this game that approving it would replace, one per
430
514
  * funding door at most. Never sent to a game. */
431
515
  replaces?: RuntimeGrantView[];
516
+ /** A SPONSORED budget: the game's creator pays for every call under it, not
517
+ * the player. Nobody approved it, its limit is the player's allowance for
518
+ * the day, and it is never offered a personal plan. */
519
+ sponsored?: true;
520
+ /** `practice`: a pretend budget kept by the builder's local helper
521
+ * (`genex llm practice`). No player approved it and nothing is charged. */
522
+ source?: 'practice';
523
+ }
524
+ /**
525
+ * What this stand's in-game model lane can do beyond the baseline, one key per
526
+ * capability. A game (and the SDK) decides from these, never from a version
527
+ * number: a key that is absent or false is a capability this stand does not
528
+ * serve. Absent altogether on a stand that predates every one of them.
529
+ */
530
+ interface RuntimeGenerationFeatures {
531
+ /** A game's creator can pay for players' calls: `requestSpendGrant({ sponsored: true })`. */
532
+ sponsor?: boolean;
533
+ /** A guest (no account) may use a sponsored budget, where the creator allowed it. */
534
+ sponsorGuests?: boolean;
535
+ /** A call may carry `system`, `messages`, the controls and `cacheSystem`. */
536
+ messages?: boolean;
537
+ /** The content check on every generation: `off` (none), `log` (recorded for
538
+ * operators, never blocks) or `enforce` (a flagged request or answer fails
539
+ * as `content_blocked`). */
540
+ moderation?: 'off' | 'log' | 'enforce';
541
+ /** A budget may be requested with `shareWithRooms` and lent to a
542
+ * server-authoritative room (`lendSpendGrantToRoom`). */
543
+ roomCalls?: boolean;
432
544
  }
433
545
  interface RuntimeGenerationModels {
434
546
  enabled: true;
547
+ features?: RuntimeGenerationFeatures;
435
548
  /**
436
549
  * Every model this stand serves, FEATURED FIRST then by vendor and label.
437
550
  *
@@ -460,7 +573,22 @@ interface RuntimeGenerationModels {
460
573
  * judge (`judge()` under a budget that enabled it). Absent on a stand
461
574
  * that predates the judge, where every model is `openrouter`. */
462
575
  kind?: 'openrouter' | 'typesafe';
576
+ /** The optional controls a call to this model may carry on this stand;
577
+ * one it does not list is refused `unsupported_parameter`, nothing
578
+ * charged. Empty while `features.messages` is off; absent on a stand
579
+ * that predates the field. */
580
+ controls?: RuntimeControl[];
581
+ /** The values `reasoningEffort` may take, where the model takes it. */
582
+ reasoningEfforts?: RuntimeReasoningEffort[];
463
583
  }[];
584
+ /** The sizes of a conversation, where `features.messages` is on: turns in
585
+ * `messages`, and how many `stop` strings of how many UTF-8 bytes. The text
586
+ * itself — prompt, system and every turn together — fits `limits.maxPromptBytes`. */
587
+ messageLimits?: {
588
+ maxMessages: number;
589
+ maxStopSequences: number;
590
+ maxStopBytes: number;
591
+ };
464
592
  externalProviders: RuntimeExternalProvider[];
465
593
  /** How many rows are in `models`. */
466
594
  total?: number;
@@ -508,6 +636,9 @@ interface RuntimeGenerationModels {
508
636
  * not reach the provider. Absent on a stand that predates the probe.
509
637
  */
510
638
  providerKey?: 'ok' | 'rejected' | 'unknown';
639
+ /** `practice`: the list of the builder's local helper (`genex llm practice`),
640
+ * not a stand's catalog. */
641
+ source?: 'practice';
511
642
  }
512
643
  /**
513
644
  * What `POST /api/runtime/grants/:id/generations/stream` sends, as
@@ -532,5 +663,6 @@ type RuntimeGenerationStreamEvent = {
532
663
  event: 'done';
533
664
  data: RuntimeGenerationView;
534
665
  };
666
+ type RuntimeContentBlockedSide = 'input' | 'output';
535
667
 
536
- 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 };
668
+ export type { RuntimeConversationFields as R, RuntimeControlFields as a, RuntimeJudgeQuestion as b, RuntimeWorkflowInput as c, RuntimeGenerationView as d, RuntimeJudgeAnswer as e, RuntimeJudgmentView as f, RuntimeGenerationBilling as g, RuntimeGenerationFunding as h, RuntimeGrantView as i, RuntimeMessage as j, RuntimeGenerationModels as k, RuntimeWorkflowOfferings as l, RuntimeRoomLendView as m, RuntimeBillingPolicy as n, RuntimeControl as o, RuntimeCurrency as p, RuntimeExternalProvider as q, RuntimeGenerationFeatures as r, RuntimeGenerationStatus as s, RuntimeGenerationStreamEvent as t, RuntimeGrantJudgeTerms as u, RuntimeGrantStatus as v, RuntimeGrantTerms as w, RuntimeJudgeCriterion as x, RuntimeReasoningEffort as y };
package/dist/sentry.js CHANGED
@@ -2,8 +2,8 @@ import {
2
2
  _stashTicketFromUrl,
3
3
  getUser,
4
4
  on
5
- } from "./chunk-KEW6LYT2.js";
6
- import "./chunk-QBCWKMVQ.js";
5
+ } from "./chunk-5VDV25LF.js";
6
+ import "./chunk-WQJM5MJL.js";
7
7
 
8
8
  // src/sentry.ts
9
9
  import * as Sentry from "@sentry/browser";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genex-ai/embed-sdk",
3
- "version": "0.35.0",
3
+ "version": "0.37.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",