@omen.dog/sdk 1.0.0 → 1.2.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.mts CHANGED
@@ -1,3 +1,5 @@
1
+ export { ASK_GROWN_UP_STATES, CHILD_LOGIN_STATES, ChildIdentity, ChildLogin, ChildLoginApprovedPayload, ChildLoginContext, ChildLoginDisplayGroup, ChildLoginOptions, ChildLoginSignal, ChildLoginState, ChildRebind, ChildTokens, DeviceStartOptions, DeviceStartResult, ENTRY_STATES, PollResult, PollUntilOptions, SealedSession, deriveInitialState, displayGroup, reduce } from './child-login.mjs';
2
+
1
3
  interface RequestOptions {
2
4
  method?: string;
3
5
  body?: unknown;
@@ -160,6 +162,149 @@ interface BatchIssueResponse {
160
162
  items: Item[];
161
163
  count: number;
162
164
  }
165
+ interface AwardSparksOptions {
166
+ userId: string;
167
+ amount: number;
168
+ reason?: string;
169
+ /** Make retries safe — the same key is credited at most once. */
170
+ idempotencyKey?: string;
171
+ }
172
+ interface AwardResult {
173
+ awarded: number;
174
+ userId: string;
175
+ userBalance: number;
176
+ poolBalance: number;
177
+ transactionId: string | null;
178
+ idempotent: boolean;
179
+ }
180
+ interface AwardBatchItem {
181
+ userId: string;
182
+ amount: number;
183
+ reason?: string;
184
+ idempotencyKey?: string;
185
+ }
186
+ interface AwardBatchResultItem {
187
+ index: number;
188
+ userId: string | null;
189
+ ok: boolean;
190
+ awarded?: number;
191
+ userBalance?: number;
192
+ idempotent?: boolean;
193
+ error?: string;
194
+ }
195
+ interface AwardBatchResponse {
196
+ results: AwardBatchResultItem[];
197
+ succeeded: number;
198
+ failed: number;
199
+ poolBalance: number;
200
+ }
201
+ interface PoolBudget {
202
+ appId: string;
203
+ balance: number;
204
+ lifetimeAllocated: number;
205
+ lifetimeAwarded: number;
206
+ }
207
+ interface PoolStatus {
208
+ balance: number;
209
+ lifetimePurchased: number;
210
+ lifetimeAwarded: number;
211
+ lowBalanceThreshold: number;
212
+ currency: string;
213
+ budgets: PoolBudget[];
214
+ }
215
+ interface DisplayTokenOptions {
216
+ userId: string;
217
+ /** Your app's OAuth client secret (backend only). */
218
+ secret: string;
219
+ /** Token lifetime in seconds. Default 600, max 3600. */
220
+ ttlSeconds?: number;
221
+ }
222
+ /** F262 — write-scoped editor token for <omen-avatar-editor>. */
223
+ interface EditorTokenOptions {
224
+ userId: string;
225
+ /** Your app's OAuth client secret (backend only). */
226
+ secret: string;
227
+ /** Token lifetime in seconds. Default 600, max 3600. */
228
+ ttlSeconds?: number;
229
+ }
230
+ interface AvatarCatalogTrait {
231
+ /** `category/file.svg` path — also a public SVG at `{baseUrl}/avatar/{id}`. */
232
+ id: string;
233
+ name: string;
234
+ rarity: string;
235
+ /** Sparks list price derived from rarity (0 = common/free). */
236
+ price: number;
237
+ /** With an editor token: whether that user still needs to unlock it. */
238
+ locked: boolean;
239
+ [key: string]: unknown;
240
+ }
241
+ interface AvatarCatalogResult {
242
+ catalog: Record<string, {
243
+ traits: AvatarCatalogTrait[];
244
+ [key: string]: unknown;
245
+ }>;
246
+ /** Sparks price per rarity tier. */
247
+ rarityPricing: Record<string, number>;
248
+ [key: string]: unknown;
249
+ }
250
+ interface SendEmailOptions {
251
+ /** Sender address. Its domain must be a verified sending domain on your org. */
252
+ from: string;
253
+ /** Display name shown next to the from address. */
254
+ fromName?: string;
255
+ /** One address or up to 10. */
256
+ to: string | string[];
257
+ subject: string;
258
+ html?: string;
259
+ text?: string;
260
+ replyTo?: string;
261
+ }
262
+ interface SendEmailResult {
263
+ sent: number;
264
+ rejected: string[];
265
+ messageId: string | null;
266
+ from: string;
267
+ dailyRemaining: number;
268
+ }
269
+ interface EmailLogEntry {
270
+ id: string;
271
+ fromEmail: string;
272
+ toEmail: string;
273
+ subject: string;
274
+ status: 'sent' | 'failed';
275
+ error: string | null;
276
+ createdAt: string;
277
+ }
278
+ interface EmailLogResponse {
279
+ messages: EmailLogEntry[];
280
+ quota: {
281
+ dailyLimit: number;
282
+ usedToday: number;
283
+ remaining: number;
284
+ };
285
+ }
286
+ type CatalogType = 'store' | 'avatar_trait';
287
+ interface AwardCatalogOptions {
288
+ userId: string;
289
+ /** 'store' = open-shop item, 'avatar_trait' = avatar-editor item. */
290
+ catalogType: CatalogType;
291
+ catalogItemId: string;
292
+ idempotencyKey?: string;
293
+ }
294
+ interface AwardCatalogResult {
295
+ userId: string;
296
+ item?: {
297
+ id: string;
298
+ name: string;
299
+ rarity?: string | null;
300
+ type?: string;
301
+ category?: string;
302
+ };
303
+ price?: number;
304
+ poolBalance?: number;
305
+ alreadyOwned?: boolean;
306
+ idempotent?: boolean;
307
+ }
163
308
  type SchemaFieldType = 'string' | 'number' | 'boolean' | 'date';
164
309
  interface CreateCollectionOptions {
165
310
  name: string;
@@ -203,6 +348,81 @@ interface TransactionResponse {
203
348
  deleted: string;
204
349
  }>;
205
350
  }
351
+ interface Product {
352
+ id: string;
353
+ appId: string;
354
+ name: string;
355
+ description: string;
356
+ type: 'one_time' | 'subscription';
357
+ priceCents: number;
358
+ currency: string;
359
+ billingInterval: 'month' | 'year' | null;
360
+ trialDays: number | null;
361
+ maxPurchasesPerUser: number | null;
362
+ templateId: string | null;
363
+ active: boolean;
364
+ stripeProductId: string | null;
365
+ stripePriceId: string | null;
366
+ createdAt: string;
367
+ updatedAt: string;
368
+ }
369
+ interface CreateProductOptions {
370
+ name: string;
371
+ type: 'one_time' | 'subscription';
372
+ priceCents: number;
373
+ currency?: string;
374
+ description?: string;
375
+ billingInterval?: 'month' | 'year';
376
+ trialDays?: number;
377
+ maxPurchasesPerUser?: number;
378
+ templateId?: string;
379
+ }
380
+ interface UpdateProductOptions {
381
+ name?: string;
382
+ description?: string;
383
+ active?: boolean;
384
+ maxPurchasesPerUser?: number;
385
+ templateId?: string;
386
+ }
387
+ interface MultiplayerConfig {
388
+ managed: boolean;
389
+ maxPlayers: number;
390
+ soloSupported: boolean;
391
+ allowSpectators: boolean;
392
+ voiceEnabled: boolean;
393
+ teamMode: 'none' | 'manual' | 'auto';
394
+ teamCount: number;
395
+ matchmaking: boolean;
396
+ }
397
+ interface UpdateMultiplayerConfigOptions {
398
+ managed?: boolean;
399
+ maxPlayers?: number;
400
+ soloSupported?: boolean;
401
+ allowSpectators?: boolean;
402
+ voiceEnabled?: boolean;
403
+ teamMode?: 'none' | 'manual' | 'auto';
404
+ teamCount?: number;
405
+ matchmaking?: boolean;
406
+ }
407
+ interface RoomLogicVersion {
408
+ version: number;
409
+ deployedAt: string;
410
+ active: boolean;
411
+ sizeBytes: number;
412
+ }
413
+ type NotificationCategory = 'general' | 'items' | 'transfers' | 'badges' | 'social' | 'app' | 'system';
414
+ interface SendNotificationOptions {
415
+ userId: string;
416
+ title: string;
417
+ body: string;
418
+ category?: NotificationCategory;
419
+ data?: Record<string, unknown>;
420
+ actionUrl?: string;
421
+ }
422
+ interface NotificationResponse {
423
+ id: string;
424
+ status: 'sent';
425
+ }
206
426
  interface CreateWebhookOptions {
207
427
  url: string;
208
428
  events: string[];
@@ -216,6 +436,79 @@ interface Webhook {
216
436
  createdAt: string;
217
437
  updatedAt: string;
218
438
  }
439
+ /** A content asset owned by your app (not a user), served by a public immutable URL. */
440
+ interface AppAsset {
441
+ id: string;
442
+ name: string;
443
+ /** Public, immutable, CDN-cacheable file URL (relative to the API base). */
444
+ url: string;
445
+ width: number;
446
+ height: number;
447
+ fileSize: number;
448
+ contentType: string | null;
449
+ /** 'upload' (you sent the bytes) or 'generated' (app-pool generation). */
450
+ source: 'upload' | 'generated';
451
+ /** The generation prompt, for generated assets. */
452
+ prompt?: string | null;
453
+ createdAt: string;
454
+ }
455
+ interface UploadAssetOptions {
456
+ /** Display name. Defaults to a slug of the filename. */
457
+ name?: string;
458
+ /** MIME type of the bytes (e.g. 'image/png'). Inferred from a data: URL if omitted. */
459
+ contentType?: string;
460
+ /** Original filename — used to derive the stored extension if contentType is absent. */
461
+ filename?: string;
462
+ }
463
+ interface AppAssetListOptions {
464
+ /** Page size (1–100, default 50). */
465
+ limit?: number;
466
+ /** Pagination cursor — pass the previous response's `nextCursor`. */
467
+ cursor?: string;
468
+ }
469
+ interface AppAssetListResponse {
470
+ assets: AppAsset[];
471
+ nextCursor: string | null;
472
+ }
473
+ /** Curated model-native aspect ratios (Decision 7). */
474
+ type ImageAspectRatio = '1:1' | '4:3' | '3:4' | '16:9' | '9:16';
475
+ /** Optional illustration style presets. Omit for raw-prompt mode. */
476
+ type ContentImageStyle = 'storybook' | 'watercolor' | 'flat-vector' | 'cartoon' | 'crayon' | '3d-clay';
477
+ /**
478
+ * A reference image passed natively to the model. `tag: 'style'` matches palette
479
+ * / line / rendering; `tag: 'identity'` keeps a recurring character consistent
480
+ * across pages. `data` is base64 (raw or a data: URL).
481
+ */
482
+ interface ReferenceImage {
483
+ data: string;
484
+ tag?: 'style' | 'identity';
485
+ contentType?: string;
486
+ }
487
+ interface GenerateImageOptions {
488
+ /** What to draw. Mandatory; always passes the child-safety filter (output is child-facing). */
489
+ prompt: string;
490
+ /** Curated native aspect ratio. Default '1:1'. */
491
+ aspectRatio?: ImageAspectRatio;
492
+ /** Optional illustration style preset. Omit for raw-prompt mode. */
493
+ style?: ContentImageStyle;
494
+ /** Cut the subject out onto transparency (chroma-key). Default false. */
495
+ transparent?: boolean;
496
+ /** Up to 4 reference images (base64 string or { data, tag }). */
497
+ referenceImages?: Array<string | ReferenceImage>;
498
+ /** Display name for the stored asset. */
499
+ name?: string;
500
+ /** Make retries safe — the same key produces one asset and is charged once. */
501
+ idempotencyKey?: string;
502
+ }
503
+ interface GeneratedImageResult {
504
+ asset: AppAsset;
505
+ /** Sparks debited from your pool for this image. */
506
+ cost: number;
507
+ /** Pool balance after the debit (null on an idempotent replay). */
508
+ poolBalance: number | null;
509
+ /** True when an idempotent replay returned an already-generated asset. */
510
+ idempotent?: boolean;
511
+ }
219
512
 
220
513
  /** Read-only access to Omen user profiles and friend lists. */
221
514
  declare class UsersNamespace {
@@ -330,6 +623,20 @@ declare class ItemsNamespace {
330
623
  * ```
331
624
  */
332
625
  revoke(itemId: string, reason?: string): Promise<Item>;
626
+ /**
627
+ * Award a catalog item (open-shop cosmetic or avatar-editor trait) to a user,
628
+ * paid for from your Sparks pool at the item's list price. Custom items use
629
+ * `issue()` and are free; catalog items draw the pool down. Re-awarding an item
630
+ * the user already owns is a no-op (no charge).
631
+ *
632
+ * @example
633
+ * ```ts
634
+ * await omen.items.awardCatalog({
635
+ * userId, catalogType: 'store', catalogItemId: 'theme_lava',
636
+ * });
637
+ * ```
638
+ */
639
+ awardCatalog(options: AwardCatalogOptions): Promise<AwardCatalogResult>;
333
640
  }
334
641
 
335
642
  /**
@@ -483,6 +790,347 @@ declare class WebhooksNamespace {
483
790
  verify(payload: string, signature: string, secret: string): Promise<boolean>;
484
791
  }
485
792
 
793
+ /**
794
+ * Manage in-app products (one-time purchases and subscriptions).
795
+ *
796
+ * Products are created by developers and purchased by users via Stripe.
797
+ */
798
+ declare class ProductsNamespace {
799
+ private readonly http;
800
+ private readonly appId;
801
+ constructor(http: HttpClient, appId: string);
802
+ /**
803
+ * Create a new product.
804
+ *
805
+ * @example
806
+ * ```ts
807
+ * const product = await omen.products.create({
808
+ * name: 'Premium Sword',
809
+ * type: 'one_time',
810
+ * priceCents: 499,
811
+ * });
812
+ * ```
813
+ */
814
+ create(options: CreateProductOptions): Promise<Product>;
815
+ /**
816
+ * List all products for this app.
817
+ *
818
+ * @param activeOnly - If true, only return active products. Defaults to false.
819
+ */
820
+ list(activeOnly?: boolean): Promise<Product[]>;
821
+ /**
822
+ * Update an existing product.
823
+ *
824
+ * @param productId - The product ID to update.
825
+ * @param options - Fields to update.
826
+ */
827
+ update(productId: string, options: UpdateProductOptions): Promise<Product>;
828
+ /**
829
+ * Deactivate a product. Deactivated products cannot be purchased but existing
830
+ * purchases remain valid.
831
+ *
832
+ * @param productId - The product ID to deactivate.
833
+ */
834
+ deactivate(productId: string): Promise<void>;
835
+ }
836
+
837
+ /**
838
+ * Configure managed multiplayer and deploy authoritative room logic.
839
+ *
840
+ * Room creation/joining is handled by the platform via the SDK bridge.
841
+ * This namespace is for developer-side configuration and deployment.
842
+ */
843
+ declare class MultiplayerNamespace {
844
+ private readonly http;
845
+ private readonly appId;
846
+ constructor(http: HttpClient, appId: string);
847
+ /**
848
+ * Get the current multiplayer configuration for this app.
849
+ */
850
+ getConfig(): Promise<MultiplayerConfig | null>;
851
+ /**
852
+ * Enable or update managed multiplayer configuration.
853
+ *
854
+ * @example
855
+ * ```ts
856
+ * await omen.multiplayer.updateConfig({
857
+ * managed: true,
858
+ * maxPlayers: 8,
859
+ * voiceEnabled: true,
860
+ * teamMode: 'manual',
861
+ * });
862
+ * ```
863
+ */
864
+ updateConfig(options: UpdateMultiplayerConfigOptions): Promise<MultiplayerConfig>;
865
+ /**
866
+ * Deploy authoritative room logic (Pro tier required).
867
+ * The bundle is a JavaScript file that exports room lifecycle hooks.
868
+ *
869
+ * @param bundle - The JavaScript source code as a string.
870
+ */
871
+ deployLogic(bundle: string): Promise<{
872
+ version: number;
873
+ deployedAt: string;
874
+ }>;
875
+ /**
876
+ * List deployed room logic versions.
877
+ */
878
+ listLogicVersions(): Promise<RoomLogicVersion[]>;
879
+ /**
880
+ * Roll back to a previous room logic version.
881
+ *
882
+ * @param version - The version number to roll back to.
883
+ */
884
+ rollbackLogic(version: number): Promise<{
885
+ version: number;
886
+ rolledBackAt: string;
887
+ }>;
888
+ }
889
+
890
+ /**
891
+ * Send notifications to users of your app.
892
+ *
893
+ * Notifications appear in the user's notification inbox on Omen.
894
+ */
895
+ declare class NotificationsNamespace {
896
+ private readonly http;
897
+ private readonly appId;
898
+ constructor(http: HttpClient, appId: string);
899
+ /**
900
+ * Send a notification to a user.
901
+ *
902
+ * @example
903
+ * ```ts
904
+ * await omen.notifications.send({
905
+ * userId: 'cmm0tzco8...',
906
+ * title: 'New high score!',
907
+ * body: 'Someone beat your record on Pixel Duel.',
908
+ * category: 'app',
909
+ * actionUrl: '/creations/pixel-duel',
910
+ * });
911
+ * ```
912
+ */
913
+ send(options: SendNotificationOptions): Promise<NotificationResponse>;
914
+ }
915
+
916
+ /**
917
+ * Award Sparks (money-backed) to your app's users from your prepaid pool, and
918
+ * mint short-lived display tokens for the embeddable UI kit.
919
+ *
920
+ * Buy and manage the pool in the Developer Portal → Sparks Pool. Awards draw the
921
+ * pool down (or an app's allocated sub-budget if one exists).
922
+ *
923
+ * NOTE: `award`, `awardBatch`, and `items.awardCatalog` require an APPROVED
924
+ * Partner App (Developer Portal → Partner Program). Unapproved apps receive
925
+ * `403 partner_required`. Funding a pool and minting display tokens do not.
926
+ */
927
+ declare class SparksNamespace {
928
+ private readonly http;
929
+ private readonly appId;
930
+ constructor(http: HttpClient, appId: string);
931
+ /**
932
+ * Award Sparks to a single user. Pass `idempotencyKey` to make retries safe.
933
+ *
934
+ * @example
935
+ * ```ts
936
+ * await omen.sparks.award({
937
+ * userId: 'cmm0tzco8...',
938
+ * amount: 250,
939
+ * reason: 'Beat level 10',
940
+ * idempotencyKey: `level10:${userId}`,
941
+ * });
942
+ * ```
943
+ */
944
+ award(options: AwardSparksOptions): Promise<AwardResult>;
945
+ /**
946
+ * Award Sparks to many users in one request (max 100). Best-effort per item:
947
+ * a single bad/underfunded entry does not fail the rest. Inspect `results`.
948
+ */
949
+ awardBatch(awards: AwardBatchItem[]): Promise<AwardBatchResponse>;
950
+ /** Current pool status: balance, lifetime stats, and per-app budgets. */
951
+ pool(): Promise<PoolStatus>;
952
+ /**
953
+ * Mint a short-lived display token for the UI kit, scoped to one user. Sign
954
+ * with your app's OAuth client SECRET (from the Developer Portal) — never ship
955
+ * the secret to the browser; call this on your backend and pass the token to
956
+ * `<omen-sparks-balance token="...">` / `<omen-inventory token="...">`.
957
+ *
958
+ * Synchronous (no network). Default TTL 10 min, max 1 hour.
959
+ *
960
+ * @example
961
+ * ```ts
962
+ * const token = omen.sparks.displayToken({ userId, secret: process.env.OMEN_CLIENT_SECRET! });
963
+ * ```
964
+ */
965
+ displayToken(options: DisplayTokenOptions): string;
966
+ }
967
+
968
+ /**
969
+ * Send transactional email from your own verified domain through Omen.
970
+ *
971
+ * Add and verify a sending domain in the Developer Portal → Email (publish the
972
+ * ownership/SPF/DKIM TXT records it gives you), then send from any address on
973
+ * that domain.
974
+ *
975
+ * NOTE: sending requires an APPROVED Partner App (Developer Portal → Partner
976
+ * Program); unapproved apps receive `403 partner_required`. Sends are capped
977
+ * per app per rolling 24h — check `dailyRemaining` / `emails.log()`.
978
+ */
979
+ declare class EmailsNamespace {
980
+ private readonly http;
981
+ private readonly appId;
982
+ constructor(http: HttpClient, appId: string);
983
+ /**
984
+ * Send one email (up to 10 recipients). No attachments; 256 KB body max.
985
+ *
986
+ * @example
987
+ * ```ts
988
+ * await omen.emails.send({
989
+ * from: 'hello@yourdomain.com',
990
+ * fromName: 'My App',
991
+ * to: player.email,
992
+ * subject: 'Your weekly recap',
993
+ * html: '<h1>Nice run!</h1>',
994
+ * });
995
+ * ```
996
+ */
997
+ send(options: SendEmailOptions): Promise<SendEmailResult>;
998
+ /** Recent sends for this app plus the rolling 24h quota. */
999
+ log(limit?: number): Promise<EmailLogResponse>;
1000
+ }
1001
+
1002
+ /**
1003
+ * F262 Embedded Avatar Kit — the shared Omen avatar inside your app.
1004
+ *
1005
+ * Your users keep ONE avatar across Omen and every partner app: display it
1006
+ * with `<omen-avatar>` (or `renderUrl()`), and let users edit it in-place
1007
+ * with `<omen-avatar-editor>` powered by an editor token minted here.
1008
+ *
1009
+ * NOTE: editor tokens only verify for APPROVED Partner Apps, and only for
1010
+ * users who have connected your app via Omen OAuth. Theme, currency display
1011
+ * and commerce flags are configured per-app via the Developer Portal →
1012
+ * Embed, or PUT /api/v1/developer/apps/{appId}/embed-config.
1013
+ */
1014
+ declare class AvatarNamespace {
1015
+ private readonly appId;
1016
+ private readonly baseUrl;
1017
+ constructor(appId: string, baseUrl: string);
1018
+ /**
1019
+ * Mint a short-lived WRITE-scoped editor token for one user (backend only —
1020
+ * never expose your client secret to the browser). Pass it to
1021
+ * `<omen-avatar-editor token="...">`.
1022
+ *
1023
+ * @example
1024
+ * ```ts
1025
+ * const token = omen.avatar.editorToken({ userId, secret: process.env.OMEN_CLIENT_SECRET! });
1026
+ * ```
1027
+ */
1028
+ editorToken(options: EditorTokenOptions): string;
1029
+ /**
1030
+ * Public render URL for a user's shared avatar (SVG; append `&format=png`
1031
+ * where supported). Pass `version` (from the `avatar:saved` event or the
1032
+ * `user.avatar_updated` webhook) to bust caches after an edit.
1033
+ */
1034
+ renderUrl(userId: string, options?: {
1035
+ version?: string;
1036
+ }): string;
1037
+ /**
1038
+ * Enumerate the shared avatar catalog — every trait id, name, rarity and
1039
+ * Sparks list price. Public, no auth. Trait ids (`category/file.svg` paths)
1040
+ * are also public SVGs at `{baseUrl}/avatar/{id}` for previews, and feed
1041
+ * `omen.items.awardCatalog({ catalogType: 'avatar_trait', catalogItemId })`
1042
+ * for pool-funded gifts.
1043
+ *
1044
+ * Pass a user's editor token and each trait's `locked` flag reflects that
1045
+ * user's ownership instead of the anonymous default.
1046
+ */
1047
+ catalog(options?: {
1048
+ editorToken?: string;
1049
+ }): Promise<AvatarCatalogResult>;
1050
+ }
1051
+
1052
+ /**
1053
+ * App-owned content hosting (Tier 3, F264 Phase 1).
1054
+ *
1055
+ * Host images your **app** owns — content art shared across all your users (a
1056
+ * vocabulary item's picture, a story-page illustration), not a single user's
1057
+ * upload. App-owned assets are server-to-server, owned by the app, **exempt from
1058
+ * the per-user asset cap**, and served by a public, immutable, CDN-cacheable URL.
1059
+ *
1060
+ * Build the bytes with your own provider and host them here, or generate them on
1061
+ * Omen with {@link ImagesNamespace.generate}.
1062
+ */
1063
+ declare class AssetsNamespace {
1064
+ private readonly http;
1065
+ private readonly appId;
1066
+ constructor(http: HttpClient, appId: string);
1067
+ /**
1068
+ * Upload bytes and get back a public, immutable file URL. Accepts a Buffer /
1069
+ * Uint8Array (raw bytes) or a base64 string (raw or a `data:` URL). Supported:
1070
+ * PNG, JPG, SVG, GIF (SVGs are sanitized). Max 10 MB.
1071
+ *
1072
+ * @example
1073
+ * ```ts
1074
+ * const { url } = await omen.assets.upload(pngBuffer, { name: 'Apple', contentType: 'image/png' });
1075
+ * ```
1076
+ */
1077
+ upload(data: Buffer | Uint8Array | string, options?: UploadAssetOptions): Promise<AppAsset>;
1078
+ /** List the app's assets, newest first. Paginate with `nextCursor`. */
1079
+ list(options?: AppAssetListOptions): Promise<AppAssetListResponse>;
1080
+ /** Get one asset's metadata. */
1081
+ get(id: string): Promise<AppAsset>;
1082
+ /** Evict an asset (hard delete — row + bytes). Never purged on a timer; deletion is yours to control. */
1083
+ delete(id: string): Promise<{
1084
+ deleted: boolean;
1085
+ id: string;
1086
+ }>;
1087
+ }
1088
+
1089
+ /**
1090
+ * App-pool image generation (Tier 3, F264 Phase 2).
1091
+ *
1092
+ * Generate content art on your app's behalf, **billed to your prepaid Sparks
1093
+ * pool** (never an end user), stored **app-owned**, and served by the same public
1094
+ * immutable URL as every other Omen asset. Built for content-time / overnight
1095
+ * pre-builds — no user, no spinner.
1096
+ *
1097
+ * Requires an **approved Partner App** (Developer Portal → Partner Program) and a
1098
+ * funded pool. A depleted pool fails closed (`402 pool_insufficient`). The output
1099
+ * is child-facing, so generation always runs the safety filter; a rejected prompt
1100
+ * or blocked image returns `400 content_rejected` (the SDK throws `OmenError`
1101
+ * with `.status === 400`; inspect the response body's `code`/`reason`) and your
1102
+ * pool is **not** charged.
1103
+ */
1104
+ declare class ImagesNamespace {
1105
+ private readonly http;
1106
+ private readonly appId;
1107
+ constructor(http: HttpClient, appId: string);
1108
+ /**
1109
+ * Generate one image and host it app-owned.
1110
+ *
1111
+ * @example
1112
+ * ```ts
1113
+ * const { asset, cost, poolBalance } = await omen.images.generate({
1114
+ * prompt: 'a friendly red apple with a smiling face',
1115
+ * aspectRatio: '4:3',
1116
+ * style: 'storybook',
1117
+ * idempotencyKey: `apple:${pageId}`,
1118
+ * });
1119
+ * console.log(asset.url); // embed anywhere
1120
+ * ```
1121
+ *
1122
+ * @example Recurring character across story pages — pass an identity reference:
1123
+ * ```ts
1124
+ * await omen.images.generate({
1125
+ * prompt: 'the same fox, now jumping over a log',
1126
+ * aspectRatio: '3:4',
1127
+ * referenceImages: [{ data: foxPngBase64, tag: 'identity' }],
1128
+ * });
1129
+ * ```
1130
+ */
1131
+ generate(options: GenerateImageOptions): Promise<GeneratedImageResult>;
1132
+ }
1133
+
486
1134
  /** Base error for all Omen SDK errors. */
487
1135
  declare class OmenError extends Error {
488
1136
  /** HTTP status code from the API. */
@@ -551,9 +1199,25 @@ declare class OmenClient {
551
1199
  readonly collections: CollectionsNamespace;
552
1200
  /** Webhook endpoint management and signature verification. */
553
1201
  readonly webhooks: WebhooksNamespace;
1202
+ /** In-app products (one-time purchases and subscriptions). */
1203
+ readonly products: ProductsNamespace;
1204
+ /** Managed multiplayer configuration and room logic deployment. */
1205
+ readonly multiplayer: MultiplayerNamespace;
1206
+ /** Send notifications to app users. */
1207
+ readonly notifications: NotificationsNamespace;
1208
+ /** Award Sparks from your prepaid pool + mint UI-kit display tokens. */
1209
+ readonly sparks: SparksNamespace;
1210
+ /** Send transactional email from your verified domains (Partner Apps). */
1211
+ readonly emails: EmailsNamespace;
1212
+ /** Shared Omen avatar in your app: editor tokens + render URLs (F262). */
1213
+ readonly avatar: AvatarNamespace;
1214
+ /** Host app-owned content art — upload + serve from a public immutable URL (F264). */
1215
+ readonly assets: AssetsNamespace;
1216
+ /** Generate content art billed to your prepaid Sparks pool, hosted app-owned (F264). */
1217
+ readonly images: ImagesNamespace;
554
1218
  constructor(options: OmenClientOptions & {
555
1219
  appId: string;
556
1220
  });
557
1221
  }
558
1222
 
559
- export { type AcquisitionType, type Badge, type BatchIssueResponse, type Collection, type CreateCollectionOptions, type CreateWebhookOptions, type Document, type FeaturedItem, type Friend, type FriendsListOptions, type FriendsListResponse, type IssueItemOptions, type Item, type ItemType, OmenAuthError, OmenClient, type OmenClientOptions, OmenError, OmenNotFoundError, OmenRateLimitError, OmenValidationError, type PinnedCreation, type QueryDocumentsOptions, type QueryDocumentsResponse, type SchemaFieldType, type StorageData, type TransactionOperation, type TransactionResponse, type UserProfile, type UserProfileResponse, type Webhook };
1223
+ export { type AcquisitionType, type AppAsset, type AppAssetListOptions, type AppAssetListResponse, type AwardBatchItem, type AwardBatchResponse, type AwardBatchResultItem, type AwardCatalogOptions, type AwardCatalogResult, type AwardResult, type AwardSparksOptions, type Badge, type BatchIssueResponse, type CatalogType, type Collection, type ContentImageStyle, type CreateCollectionOptions, type CreateProductOptions, type CreateWebhookOptions, type DisplayTokenOptions, type Document, type EditorTokenOptions, type EmailLogEntry, type EmailLogResponse, type FeaturedItem, type Friend, type FriendsListOptions, type FriendsListResponse, type GenerateImageOptions, type GeneratedImageResult, type ImageAspectRatio, type IssueItemOptions, type Item, type ItemType, type MultiplayerConfig, type NotificationCategory, type NotificationResponse, OmenAuthError, OmenClient, type OmenClientOptions, OmenError, OmenNotFoundError, OmenRateLimitError, OmenValidationError, type PinnedCreation, type PoolBudget, type PoolStatus, type Product, type QueryDocumentsOptions, type QueryDocumentsResponse, type ReferenceImage, type RoomLogicVersion, type SchemaFieldType, type SendEmailOptions, type SendEmailResult, type SendNotificationOptions, type StorageData, type TransactionOperation, type TransactionResponse, type UpdateMultiplayerConfigOptions, type UpdateProductOptions, type UploadAssetOptions, type UserProfile, type UserProfileResponse, type Webhook };