@genex-ai/embed-sdk 0.30.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.
|
@@ -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.30.
|
|
920
|
+
var SDK_VERSION = "0.30.1";
|
|
921
921
|
var config2 = null;
|
|
922
922
|
var state = "pending";
|
|
923
923
|
var user = null;
|
package/dist/development.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RuntimeJudgeQuestion, RuntimeWorkflowInput, RuntimeGenerationView } from '
|
|
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 '
|
|
2
|
-
export { RuntimeBillingPolicy, RuntimeCurrency, RuntimeExternalProvider,
|
|
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 {
|
|
@@ -786,4 +786,4 @@ declare function __resetForTests(overrides?: {
|
|
|
786
786
|
heartbeatIntervalMs?: number;
|
|
787
787
|
}): void;
|
|
788
788
|
|
|
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, type RuntimeGenerationResult, type RuntimeWorkflowAuthorization, 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 };
|
|
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
|
@@ -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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genex-ai/embed-sdk",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.1",
|
|
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",
|
|
@@ -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": {
|