@chuzi/shared 1.3.42 → 1.3.44

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.
@@ -1,4 +1,4 @@
1
- import { PasswordLoginRequest, PasswordLoginResponse, OidcExchangeRequest, OidcExchangeResponse, MagicLinkRequest, MagicLinkRequestResponse, MagicLinkVerifyRequest, MagicLinkVerifyResponse, UsernameAvailabilityResponse, UserProfile, CatalogResponse, LocaleId, RealmConfigResponse, PaginatedResponse, StoryListItem, MineResponse, CreateStoryRequest, UpdateStoryRequest, TagListResponse, SceneListItem, CreateSceneRequest, UpdateSceneRequest, SceneActionItem, CreateSceneActionRequest, UpdateSceneActionRequest, UploadUrlRequest, UploadUrlResponse, RegisterMediaRequest, RegisterMediaResponse, TranscodeRequest, TranscodeResponse, PlayUrlResponse, SourceUrlResponse, SceneMapResponse, TrackEngagementRequest, EngagementResponse, SaveBookmarkRequest, BookmarkResponse, BookmarkListResponse, PublicDirectorProfile, UpdateRealmRequest, UpdateRealmResponse, UpdateLocaleRequest, UpdateLocaleResponse, UpdateProfileRequest, UpdateProfileResponse, CreditBalanceResponse, CreditPool, CreditPack, UploadCostResponse, PurchaseCreditsRequest, PurchaseCreditsResponse, PurchaseAmountRequest, CreditBalance, PaymentMethod, StorePaymentMethodRequest, GrantCreditsRequest, GrantCreditsResponse, GenerateImageRequest, GenerateImageResponse, AiGenerationShowResponse, AcceptGenerationRequest, AcceptGenerationResponse, RejectGenerationRequest, RejectGenerationResponse, StoryStyleResponse } from '../types/index.js';
1
+ import { PasswordLoginRequest, PasswordLoginResponse, OidcExchangeRequest, OidcExchangeResponse, MagicLinkRequest, MagicLinkRequestResponse, MagicLinkVerifyRequest, MagicLinkVerifyResponse, UsernameAvailabilityResponse, UserProfile, CatalogResponse, LocaleId, RealmConfigResponse, PaginatedResponse, StoryListItem, MineResponse, CreateStoryRequest, UpdateStoryRequest, TagListResponse, SceneListItem, CreateSceneRequest, UpdateSceneRequest, SceneActionItem, CreateSceneActionRequest, UpdateSceneActionRequest, UploadUrlRequest, UploadUrlResponse, RegisterMediaRequest, RegisterMediaResponse, TranscodeRequest, TranscodeResponse, PlayUrlResponse, SourceUrlResponse, SceneMapResponse, TrackEngagementRequest, EngagementResponse, SaveBookmarkRequest, BookmarkResponse, BookmarkListResponse, PublicDirectorProfile, UpdateRealmRequest, UpdateRealmResponse, UpdateLocaleRequest, UpdateLocaleResponse, UpdateProfileRequest, UpdateProfileResponse, CreditBalanceResponse, CreditPool, CreditPack, UploadCostResponse, PurchaseCreditsRequest, PurchaseCreditsResponse, PurchaseAmountRequest, CreditBalance, PaymentMethod, StorePaymentMethodRequest, GrantCreditsRequest, GrantCreditsResponse, GenerateImageRequest, GenerateImageResponse, AiGenerationShowResponse, AcceptGenerationRequest, AcceptGenerationResponse, RejectGenerationRequest, RejectGenerationResponse, StoryStyleResponse, AiStoryEstimateRequest, AiStoryEstimateResponse, AiStoryGenerateRequest, AiStoryGenerateResponse, AiSceneEstimateRequest, AiSceneEstimateResponse, AiSceneGenerateRequest, AiSceneGenerateResponse } from '../types/index.js';
2
2
 
3
3
  /**
4
4
  * Token resolver returned by the host app. Called on every request; may be
@@ -192,6 +192,10 @@ interface ChuziClient {
192
192
  storyStyle(storyId: string, opts?: {
193
193
  signal?: AbortSignal;
194
194
  }): Promise<StoryStyleResponse>;
195
+ storyEstimate(req: AiStoryEstimateRequest): Promise<AiStoryEstimateResponse>;
196
+ storyGenerate(req: AiStoryGenerateRequest): Promise<AiStoryGenerateResponse>;
197
+ sceneEstimate(req: AiSceneEstimateRequest): Promise<AiSceneEstimateResponse>;
198
+ sceneGenerate(req: AiSceneGenerateRequest): Promise<AiSceneGenerateResponse>;
195
199
  };
196
200
  }
197
201
  /**
package/dist/api/index.js CHANGED
@@ -190,7 +190,15 @@ function createChuziClient(config) {
190
190
  show: (id, opts) => request("GET", `/api/v1/ai/generations/${encodeURIComponent(id)}`, opts),
191
191
  accept: (id, req) => request("POST", `/api/v1/ai/generations/${encodeURIComponent(id)}/accept`, { body: req }),
192
192
  reject: (id, req) => request("POST", `/api/v1/ai/generations/${encodeURIComponent(id)}/reject`, { body: req }),
193
- storyStyle: (storyId, opts) => request("GET", `/api/v1/ai/stories/${encodeURIComponent(storyId)}/style`, opts)
193
+ storyStyle: (storyId, opts) => request("GET", `/api/v1/ai/stories/${encodeURIComponent(storyId)}/style`, opts),
194
+ storyEstimate: (req) => request("POST", "/api/v1/ai/story/estimate", { body: req }),
195
+ storyGenerate: (req) => request("POST", "/api/v1/ai/story/generate", { body: req }),
196
+ sceneEstimate: (req) => request("POST", `/api/v1/ai/stories/${encodeURIComponent(req.story_id)}/scene/estimate`, {
197
+ body: { brief: req.brief, mode: req.mode, scene_id: req.scene_id }
198
+ }),
199
+ sceneGenerate: (req) => request("POST", `/api/v1/ai/stories/${encodeURIComponent(req.story_id)}/scene/generate`, {
200
+ body: { brief: req.brief, mode: req.mode, scene_id: req.scene_id }
201
+ })
194
202
  }
195
203
  };
196
204
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/api/index.ts"],"names":[],"mappings":";AAsFO,IAAM,aAAA,GAAN,cAA4B,KAAA,CAAM;AAAA,EACvC,WAAA,CACS,MAAA,EACA,IAAA,EACP,OAAA,EACA;AACA,IAAA,KAAA,CAAM,OAAA,IAAW,CAAA,UAAA,EAAa,MAAM,CAAA,CAAE,CAAA;AAJ/B,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AACA,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAIP,IAAA,IAAA,CAAK,IAAA,GAAO,eAAA;AAAA,EACd;AAAA,EANS,MAAA;AAAA,EACA,IAAA;AAMX;AAEO,SAAS,2BAA2B,GAAA,EAAoC;AAC7E,EAAA,IAAI,EAAE,GAAA,YAAe,aAAA,CAAA,IAAkB,GAAA,CAAI,WAAW,GAAA,EAAK;AACzD,IAAA,OAAO,KAAA;AAAA,EACT;AACA,EAAA,MAAM,OAAO,GAAA,CAAI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AAC,CAAA,MAAA,CAAA,EAAU,IAAI;AAAA;AAClF,GACF;AACF","file":"index.js","sourcesContent":["import type {\n AcceptGenerationRequest,\n AcceptGenerationResponse,\n AiGenerationShowResponse,\n BookmarkListResponse,\n BookmarkResponse,\n CatalogResponse,\n CreateSceneActionRequest,\n CreateSceneRequest,\n CreateStoryRequest,\n EngagementResponse,\n GenerateImageRequest,\n GenerateImageResponse,\n LocaleId,\n MagicLinkRequest,\n MagicLinkRequestResponse,\n MagicLinkVerifyRequest,\n MagicLinkVerifyResponse,\n MediaItem,\n MineResponse,\n OidcExchangeRequest,\n OidcExchangeResponse,\n PasswordLoginRequest,\n PasswordLoginResponse,\n PaginatedResponse,\n PlayUrlResponse,\n PublicDirectorProfile,\n RealmConfigResponse,\n RegisterMediaRequest,\n RegisterMediaResponse,\n RejectGenerationRequest,\n RejectGenerationResponse,\n SaveBookmarkRequest,\n SceneActionItem,\n SceneListItem,\n SceneMapResponse,\n SourceUrlResponse,\n StoryListItem,\n StoryStyleResponse,\n TagListResponse,\n TrackEngagementRequest,\n TranscodeRequest,\n TranscodeResponse,\n UsernameAvailabilityResponse,\n UpdateLocaleRequest,\n UpdateLocaleResponse,\n UpdateProfileRequest,\n UpdateProfileResponse,\n UpdateRealmRequest,\n UpdateRealmResponse,\n UpdateSceneActionRequest,\n UpdateSceneRequest,\n UpdateStoryRequest,\n UploadUrlRequest,\n UploadUrlResponse,\n UserProfile,\n CreditBalanceResponse,\n CreditPool,\n GrantCreditsRequest,\n GrantCreditsResponse,\n PaymentMethod,\n PurchaseAmountRequest,\n PurchaseCreditsRequest,\n PurchaseCreditsResponse,\n StorePaymentMethodRequest,\n UploadCostResponse,\n} from \"../types/index.js\";\n\n/**\n * Token resolver returned by the host app. Called on every request; may be\n * synchronous (in-memory) or async (SecureStore on RN-tvOS, AsyncStorage on\n * RN). Return null when the user is unauthenticated.\n */\nexport type TokenResolver = () => string | null | Promise<string | null>;\n\nexport interface ChuziClientConfig {\n /** Base URL of the CHUZI API — no trailing slash required. */\n baseUrl: string;\n /** Returns the current bearer token, or null if unauthenticated. */\n getToken?: TokenResolver;\n /** Override fetch for testing or RN polyfills. Defaults to globalThis.fetch. */\n fetch?: typeof fetch;\n /** Sent as User-Agent (web), or X-Client header (RN). Optional. */\n client?: string;\n}\n\nexport class ChuziApiError extends Error {\n constructor(\n public status: number,\n public body: unknown,\n message?: string,\n ) {\n super(message ?? `chuzi-api ${status}`);\n this.name = \"ChuziApiError\";\n }\n}\n\nexport function isInsufficientCreditsError(err: unknown): err is ChuziApiError {\n if (!(err instanceof ChuziApiError) || err.status !== 403) {\n return false;\n }\n const body = err.body as { error?: string } | null;\n return typeof body?.error === \"string\" && /insufficient/i.test(body.error);\n}\n\nexport function insufficientCreditsPool(err: unknown): CreditPool | null {\n if (!isInsufficientCreditsError(err)) {\n return null;\n }\n const body = err.body as { error?: string };\n const message = body.error ?? \"\";\n if (/watch/i.test(message)) return \"watch\";\n if (/create/i.test(message)) return \"create\";\n return null;\n}\n\ninterface RequestOptions {\n query?: Record<string, string | number | boolean | undefined>;\n body?: unknown;\n signal?: AbortSignal;\n}\n\nfunction buildQuery(query: RequestOptions[\"query\"]): string {\n if (!query) return \"\";\n const params = new URLSearchParams();\n for (const [k, v] of Object.entries(query)) {\n if (v === undefined) continue;\n params.set(k, String(v));\n }\n const s = params.toString();\n return s ? `?${s}` : \"\";\n}\n\nfunction makeRequester(config: ChuziClientConfig) {\n const fetchFn = config.fetch ?? globalThis.fetch;\n const baseUrl = config.baseUrl.replace(/\\/+$/, \"\");\n\n return async function request<T>(\n method: string,\n path: string,\n opts: RequestOptions = {},\n ): Promise<T> {\n const headers: Record<string, string> = {\n Accept: \"application/json\",\n };\n if (config.client) headers[\"X-Chuzi-Client\"] = config.client;\n if (config.getToken) {\n const token = await config.getToken();\n if (token) headers[\"Authorization\"] = `Bearer ${token}`;\n }\n if (opts.body !== undefined) headers[\"Content-Type\"] = \"application/json\";\n\n const res = await fetchFn(`${baseUrl}${path}${buildQuery(opts.query)}`, {\n method,\n headers,\n body: opts.body !== undefined ? JSON.stringify(opts.body) : undefined,\n signal: opts.signal,\n });\n\n if (res.status === 204) return undefined as T;\n\n let parsed: unknown = null;\n const text = await res.text();\n if (text.length > 0) {\n try {\n parsed = JSON.parse(text);\n } catch {\n parsed = text;\n }\n }\n\n if (!res.ok) {\n throw new ChuziApiError(res.status, parsed);\n }\n return parsed as T;\n };\n}\n\nexport interface ChuziClient {\n auth: {\n login(req: PasswordLoginRequest): Promise<PasswordLoginResponse>;\n exchangeOidcCode(req: OidcExchangeRequest): Promise<OidcExchangeResponse>;\n requestMagicLink(req: MagicLinkRequest): Promise<MagicLinkRequestResponse>;\n verifyMagicLink(req: MagicLinkVerifyRequest): Promise<MagicLinkVerifyResponse>;\n usernameAvailability(username: string, opts?: { signal?: AbortSignal }): Promise<UsernameAvailabilityResponse>;\n logout(): Promise<void>;\n user(): Promise<UserProfile>;\n };\n catalog: {\n index(opts?: { signal?: AbortSignal }): Promise<CatalogResponse>;\n byCreator(userId: string, opts?: { signal?: AbortSignal }): Promise<CatalogResponse>;\n };\n config: {\n realms(opts?: { locale?: LocaleId; signal?: AbortSignal }): Promise<RealmConfigResponse>;\n };\n stories: {\n index(opts?: { signal?: AbortSignal }): Promise<PaginatedResponse<StoryListItem>>;\n show(id: string, opts?: { signal?: AbortSignal }): Promise<StoryListItem>;\n mine(opts?: { signal?: AbortSignal }): Promise<MineResponse>;\n create(req: CreateStoryRequest): Promise<{ data: StoryListItem }>;\n update(id: string, req: UpdateStoryRequest): Promise<{ data: StoryListItem }>;\n destroy(id: string): Promise<void>;\n };\n tags: {\n index(opts?: { signal?: AbortSignal }): Promise<TagListResponse>;\n };\n scenes: {\n index(storyId: string, opts?: { signal?: AbortSignal }): Promise<SceneListItem[]>;\n show(id: string, opts?: { signal?: AbortSignal }): Promise<SceneListItem>;\n create(req: CreateSceneRequest): Promise<SceneListItem>;\n update(id: string, req: UpdateSceneRequest): Promise<SceneListItem>;\n destroy(id: string): Promise<void>;\n };\n sceneActions: {\n index(opts?: {\n sceneId?: string;\n signal?: AbortSignal;\n }): Promise<SceneActionItem[]>;\n show(id: string, opts?: { signal?: AbortSignal }): Promise<SceneActionItem>;\n create(req: CreateSceneActionRequest): Promise<SceneActionItem>;\n update(id: string, req: UpdateSceneActionRequest): Promise<SceneActionItem>;\n destroy(id: string): Promise<{ message: string }>;\n };\n media: {\n uploadUrl(req: UploadUrlRequest): Promise<UploadUrlResponse>;\n register(req: RegisterMediaRequest): Promise<RegisterMediaResponse>;\n transcode(req: TranscodeRequest): Promise<TranscodeResponse>;\n playUrl(id: string, opts?: { signal?: AbortSignal }): Promise<PlayUrlResponse>;\n sourceUrl(id: string, opts?: { signal?: AbortSignal }): Promise<SourceUrlResponse>;\n };\n watch: {\n sceneMap(storyId: string, opts?: { signal?: AbortSignal }): Promise<SceneMapResponse>;\n trackEngagement(storyId: string, req: TrackEngagementRequest): Promise<EngagementResponse>;\n saveBookmark(storyId: string, req: SaveBookmarkRequest): Promise<BookmarkResponse>;\n listBookmarks(storyId: string, opts?: { signal?: AbortSignal }): Promise<BookmarkListResponse>;\n };\n user: {\n profile(opts?: { signal?: AbortSignal }): Promise<UserProfile>;\n publicProfile(userId: string, opts?: { signal?: AbortSignal }): Promise<PublicDirectorProfile>;\n updateRealm(req: UpdateRealmRequest): Promise<UpdateRealmResponse>;\n updateLocale(req: UpdateLocaleRequest): Promise<UpdateLocaleResponse>;\n updateProfile(req: UpdateProfileRequest): Promise<UpdateProfileResponse>;\n usernameAvailability(username: string, opts?: { signal?: AbortSignal }): Promise<UsernameAvailabilityResponse>;\n };\n credits: {\n balance(opts?: { signal?: AbortSignal }): Promise<CreditBalanceResponse>;\n ledger(opts?: {\n signal?: AbortSignal;\n pool?: CreditPool;\n }): Promise<{ transactions: unknown[] }>;\n packs(opts?: { signal?: AbortSignal }): Promise<{ packs: import(\"../types/index.js\").CreditPack[] }>;\n uploadCost(fileSize: number, opts?: { signal?: AbortSignal }): Promise<UploadCostResponse>;\n purchase(req: PurchaseCreditsRequest): Promise<PurchaseCreditsResponse>;\n purchaseAmount(req: PurchaseAmountRequest): Promise<PurchaseCreditsResponse>;\n unlockScene(sceneId: string, opts?: { signal?: AbortSignal }): Promise<{\n unlocked: boolean;\n already_watched?: boolean;\n balance: import(\"../types/index.js\").CreditBalance;\n error?: string;\n }>;\n };\n payments: {\n list(opts?: { signal?: AbortSignal }): Promise<{ payment_methods: PaymentMethod[] }>;\n store(req: StorePaymentMethodRequest): Promise<{ payment_method: PaymentMethod }>;\n remove(paymentMethodId: string): Promise<{ message: string }>;\n setDefault(paymentMethodId: string): Promise<{ message: string }>;\n };\n admin: {\n credits: {\n grant(req: GrantCreditsRequest): Promise<GrantCreditsResponse>;\n };\n };\n ai: {\n generateImage(req: GenerateImageRequest): Promise<GenerateImageResponse>;\n show(id: string, opts?: { signal?: AbortSignal }): Promise<AiGenerationShowResponse>;\n accept(id: string, req: AcceptGenerationRequest): Promise<AcceptGenerationResponse>;\n reject(id: string, req: RejectGenerationRequest): Promise<RejectGenerationResponse>;\n storyStyle(storyId: string, opts?: { signal?: AbortSignal }): Promise<StoryStyleResponse>;\n };\n}\n\n/**\n * Construct a typed CHUZI API client. Bearer-token auth via Authorization\n * header (works for web/SPA and native apps). The host owns token storage\n * and lifecycle — pass `getToken` to plug in localStorage / AsyncStorage /\n * SecureStore as appropriate.\n *\n * Surfaces not yet wired: scene-actions, exports, admin, reports.\n * Add them here as the migration reaches each surface; the route shapes\n * are documented in chuzi-api/routes/api.php.\n */\nexport function createChuziClient(config: ChuziClientConfig): ChuziClient {\n const request = makeRequester(config);\n\n return {\n auth: {\n login: (req) =>\n request(\"POST\", \"/api/v1/auth/login\", { body: req }),\n exchangeOidcCode: (req) =>\n request(\"POST\", \"/api/v1/auth/oidc/exchange\", { body: req }),\n requestMagicLink: (req) =>\n request(\"POST\", \"/api/v1/auth/magic-link/request\", { body: req }),\n verifyMagicLink: (req) =>\n request(\"POST\", \"/api/v1/auth/magic-link/verify\", { body: req }),\n usernameAvailability: (username, opts) =>\n request(\"GET\", \"/api/v1/auth/username-availability\", {\n signal: opts?.signal,\n query: { username },\n }),\n logout: () => request(\"POST\", \"/api/v1/auth/logout\"),\n user: () => request(\"GET\", \"/api/v1/auth/user\"),\n },\n catalog: {\n index: (opts) => request(\"GET\", \"/api/v1/catalog\", opts),\n byCreator: (userId, opts) =>\n request(\"GET\", \"/api/v1/catalog\", {\n signal: opts?.signal,\n query: { creator_id: userId },\n }),\n },\n config: {\n realms: (opts) =>\n request(\"GET\", \"/api/v1/config/realms\", {\n signal: opts?.signal,\n query: opts?.locale ? { locale: opts.locale } : undefined,\n }),\n },\n stories: {\n index: (opts) => request(\"GET\", \"/api/v1/stories\", opts),\n show: (id, opts) => request(\"GET\", `/api/v1/stories/${encodeURIComponent(id)}`, opts),\n mine: (opts) => request(\"GET\", \"/api/v1/stories/mine\", opts),\n create: (req) => request(\"POST\", \"/api/v1/stories\", { body: req }),\n update: (id, req) => request(\"PATCH\", `/api/v1/stories/${encodeURIComponent(id)}`, { body: req }),\n destroy: (id) => request(\"DELETE\", `/api/v1/stories/${encodeURIComponent(id)}`),\n },\n tags: {\n index: (opts) => request(\"GET\", \"/api/v1/tags\", opts),\n },\n scenes: {\n index: (storyId, opts) =>\n request(\"GET\", \"/api/v1/scenes\", {\n signal: opts?.signal,\n query: { story_id: storyId },\n }),\n show: (id, opts) =>\n request(\"GET\", `/api/v1/scenes/${encodeURIComponent(id)}`, opts),\n create: (req) =>\n request(\"POST\", \"/api/v1/scenes\", { body: req }),\n update: (id, req) =>\n request(\"PATCH\", `/api/v1/scenes/${encodeURIComponent(id)}`, { body: req }),\n destroy: (id) =>\n request(\"DELETE\", `/api/v1/scenes/${encodeURIComponent(id)}`),\n },\n sceneActions: {\n index: (opts) =>\n request(\"GET\", \"/api/v1/scene-actions\", {\n signal: opts?.signal,\n query: opts?.sceneId ? { scene_id: opts.sceneId } : undefined,\n }),\n show: (id, opts) =>\n request(\"GET\", `/api/v1/scene-actions/${encodeURIComponent(id)}`, opts),\n create: (req) =>\n request(\"POST\", \"/api/v1/scene-actions\", { body: req }),\n update: (id, req) =>\n request(\"PATCH\", `/api/v1/scene-actions/${encodeURIComponent(id)}`, {\n body: req,\n }),\n destroy: (id) =>\n request(\"DELETE\", `/api/v1/scene-actions/${encodeURIComponent(id)}`),\n },\n media: {\n uploadUrl: (req) =>\n request(\"POST\", \"/api/v1/media/upload-url\", { body: req }),\n register: (req) =>\n request(\"POST\", \"/api/v1/media/register\", { body: req }),\n transcode: (req) =>\n request(\"POST\", \"/api/v1/media/transcode\", { body: req }),\n playUrl: (id, opts) =>\n request(\"GET\", `/api/v1/media/${encodeURIComponent(id)}/play`, opts),\n sourceUrl: (id, opts) =>\n request(\"GET\", `/api/v1/media/${encodeURIComponent(id)}/source-url`, opts),\n },\n watch: {\n sceneMap: (storyId, opts) =>\n request(\"GET\", `/api/v1/stories/${encodeURIComponent(storyId)}/scene-map`, opts),\n trackEngagement: (storyId, req) =>\n request(\"POST\", `/api/v1/stories/${encodeURIComponent(storyId)}/engagement`, { body: req }),\n saveBookmark: (storyId, req) =>\n request(\"POST\", `/api/v1/stories/${encodeURIComponent(storyId)}/bookmark`, { body: req }),\n listBookmarks: (storyId, opts) =>\n request(\"GET\", `/api/v1/stories/${encodeURIComponent(storyId)}/bookmarks`, opts),\n },\n user: {\n profile: (opts) => request(\"GET\", \"/api/v1/user/profile\", opts),\n publicProfile: (userId, opts) =>\n request(\"GET\", `/api/v1/users/${encodeURIComponent(userId)}/public`, opts),\n updateRealm: (req) => request(\"PUT\", \"/api/v1/user/realm\", { body: req }),\n updateLocale: (req) => request(\"PUT\", \"/api/v1/user/locale\", { body: req }),\n updateProfile: (req) => request(\"PUT\", \"/api/v1/user/profile\", { body: req }),\n usernameAvailability: (username, opts) =>\n request(\"GET\", \"/api/v1/user/username-availability\", {\n signal: opts?.signal,\n query: { username },\n }),\n },\n credits: {\n balance: (opts) => request(\"GET\", \"/api/v1/credits/balance\", opts),\n ledger: (opts) =>\n request(\"GET\", \"/api/v1/credits/ledger\", {\n signal: opts?.signal,\n query: opts?.pool ? { pool: opts.pool } : undefined,\n }),\n packs: (opts) => request(\"GET\", \"/api/v1/credits/packs\", opts),\n uploadCost: (fileSize, opts) =>\n request(\"GET\", \"/api/v1/credits/upload-cost\", {\n signal: opts?.signal,\n query: { file_size: fileSize },\n }),\n purchase: (req) =>\n request(\"POST\", \"/api/v1/credits/purchase\", { body: req }),\n purchaseAmount: (req) =>\n request(\"POST\", \"/api/v1/credits/purchase-amount\", { body: req }),\n unlockScene: (sceneId, opts) =>\n request(\"POST\", `/api/v1/scenes/${encodeURIComponent(sceneId)}/unlock`, opts),\n },\n payments: {\n list: (opts) => request(\"GET\", \"/api/v1/payments/methods\", opts),\n store: (req) =>\n request(\"POST\", \"/api/v1/payments/methods\", { body: req }),\n remove: (paymentMethodId) =>\n request(\"DELETE\", `/api/v1/payments/methods/${encodeURIComponent(paymentMethodId)}`),\n setDefault: (paymentMethodId) =>\n request(\n \"POST\",\n `/api/v1/payments/methods/${encodeURIComponent(paymentMethodId)}/default`,\n ),\n },\n admin: {\n credits: {\n grant: (req) =>\n request(\"POST\", \"/api/v1/admin/credits/grant\", { body: req }),\n },\n },\n ai: {\n generateImage: (req) =>\n request(\"POST\", \"/api/v1/ai/generate-image\", { body: req }),\n show: (id, opts) =>\n request(\"GET\", `/api/v1/ai/generations/${encodeURIComponent(id)}`, opts),\n accept: (id, req) =>\n request(\"POST\", `/api/v1/ai/generations/${encodeURIComponent(id)}/accept`, { body: req }),\n reject: (id, req) =>\n request(\"POST\", `/api/v1/ai/generations/${encodeURIComponent(id)}/reject`, { body: req }),\n storyStyle: (storyId, opts) =>\n request(\"GET\", `/api/v1/ai/stories/${encodeURIComponent(storyId)}/style`, opts),\n },\n };\n}\n"]}
1
+ {"version":3,"sources":["../../src/api/index.ts"],"names":[],"mappings":";AAsFO,IAAM,aAAA,GAAN,cAA4B,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,KAAA,EAAO,GAAA,CAAI,KAAA,EAAO,MAAM,GAAA,CAAI,IAAA,EAAM,QAAA,EAAU,GAAA,CAAI,QAAA;AAAS,OAClE;AAAA;AACL,GACF;AACF","file":"index.js","sourcesContent":["import type {\n AcceptGenerationRequest,\n AcceptGenerationResponse,\n AiGenerationShowResponse,\n BookmarkListResponse,\n BookmarkResponse,\n CatalogResponse,\n CreateSceneActionRequest,\n CreateSceneRequest,\n CreateStoryRequest,\n EngagementResponse,\n GenerateImageRequest,\n GenerateImageResponse,\n LocaleId,\n MagicLinkRequest,\n MagicLinkRequestResponse,\n MagicLinkVerifyRequest,\n MagicLinkVerifyResponse,\n MediaItem,\n MineResponse,\n OidcExchangeRequest,\n OidcExchangeResponse,\n PasswordLoginRequest,\n PasswordLoginResponse,\n PaginatedResponse,\n PlayUrlResponse,\n PublicDirectorProfile,\n RealmConfigResponse,\n RegisterMediaRequest,\n RegisterMediaResponse,\n RejectGenerationRequest,\n RejectGenerationResponse,\n SaveBookmarkRequest,\n SceneActionItem,\n SceneListItem,\n SceneMapResponse,\n SourceUrlResponse,\n StoryListItem,\n StoryStyleResponse,\n TagListResponse,\n TrackEngagementRequest,\n TranscodeRequest,\n TranscodeResponse,\n UsernameAvailabilityResponse,\n UpdateLocaleRequest,\n UpdateLocaleResponse,\n UpdateProfileRequest,\n UpdateProfileResponse,\n UpdateRealmRequest,\n UpdateRealmResponse,\n UpdateSceneActionRequest,\n UpdateSceneRequest,\n UpdateStoryRequest,\n UploadUrlRequest,\n UploadUrlResponse,\n UserProfile,\n CreditBalanceResponse,\n CreditPool,\n GrantCreditsRequest,\n GrantCreditsResponse,\n PaymentMethod,\n PurchaseAmountRequest,\n PurchaseCreditsRequest,\n PurchaseCreditsResponse,\n StorePaymentMethodRequest,\n UploadCostResponse,\n} from \"../types/index.js\";\n\n/**\n * Token resolver returned by the host app. Called on every request; may be\n * synchronous (in-memory) or async (SecureStore on RN-tvOS, AsyncStorage on\n * RN). Return null when the user is unauthenticated.\n */\nexport type TokenResolver = () => string | null | Promise<string | null>;\n\nexport interface ChuziClientConfig {\n /** Base URL of the CHUZI API — no trailing slash required. */\n baseUrl: string;\n /** Returns the current bearer token, or null if unauthenticated. */\n getToken?: TokenResolver;\n /** Override fetch for testing or RN polyfills. Defaults to globalThis.fetch. */\n fetch?: typeof fetch;\n /** Sent as User-Agent (web), or X-Client header (RN). Optional. */\n client?: string;\n}\n\nexport class ChuziApiError extends Error {\n constructor(\n public status: number,\n public body: unknown,\n message?: string,\n ) {\n super(message ?? `chuzi-api ${status}`);\n this.name = \"ChuziApiError\";\n }\n}\n\nexport function isInsufficientCreditsError(err: unknown): err is ChuziApiError {\n if (!(err instanceof ChuziApiError) || err.status !== 403) {\n return false;\n }\n const body = err.body as { error?: string } | null;\n return typeof body?.error === \"string\" && /insufficient/i.test(body.error);\n}\n\nexport function insufficientCreditsPool(err: unknown): CreditPool | null {\n if (!isInsufficientCreditsError(err)) {\n return null;\n }\n const body = err.body as { error?: string };\n const message = body.error ?? \"\";\n if (/watch/i.test(message)) return \"watch\";\n if (/create/i.test(message)) return \"create\";\n return null;\n}\n\ninterface RequestOptions {\n query?: Record<string, string | number | boolean | undefined>;\n body?: unknown;\n signal?: AbortSignal;\n}\n\nfunction buildQuery(query: RequestOptions[\"query\"]): string {\n if (!query) return \"\";\n const params = new URLSearchParams();\n for (const [k, v] of Object.entries(query)) {\n if (v === undefined) continue;\n params.set(k, String(v));\n }\n const s = params.toString();\n return s ? `?${s}` : \"\";\n}\n\nfunction makeRequester(config: ChuziClientConfig) {\n const fetchFn = config.fetch ?? globalThis.fetch;\n const baseUrl = config.baseUrl.replace(/\\/+$/, \"\");\n\n return async function request<T>(\n method: string,\n path: string,\n opts: RequestOptions = {},\n ): Promise<T> {\n const headers: Record<string, string> = {\n Accept: \"application/json\",\n };\n if (config.client) headers[\"X-Chuzi-Client\"] = config.client;\n if (config.getToken) {\n const token = await config.getToken();\n if (token) headers[\"Authorization\"] = `Bearer ${token}`;\n }\n if (opts.body !== undefined) headers[\"Content-Type\"] = \"application/json\";\n\n const res = await fetchFn(`${baseUrl}${path}${buildQuery(opts.query)}`, {\n method,\n headers,\n body: opts.body !== undefined ? JSON.stringify(opts.body) : undefined,\n signal: opts.signal,\n });\n\n if (res.status === 204) return undefined as T;\n\n let parsed: unknown = null;\n const text = await res.text();\n if (text.length > 0) {\n try {\n parsed = JSON.parse(text);\n } catch {\n parsed = text;\n }\n }\n\n if (!res.ok) {\n throw new ChuziApiError(res.status, parsed);\n }\n return parsed as T;\n };\n}\n\nexport interface ChuziClient {\n auth: {\n login(req: PasswordLoginRequest): Promise<PasswordLoginResponse>;\n exchangeOidcCode(req: OidcExchangeRequest): Promise<OidcExchangeResponse>;\n requestMagicLink(req: MagicLinkRequest): Promise<MagicLinkRequestResponse>;\n verifyMagicLink(req: MagicLinkVerifyRequest): Promise<MagicLinkVerifyResponse>;\n usernameAvailability(username: string, opts?: { signal?: AbortSignal }): Promise<UsernameAvailabilityResponse>;\n logout(): Promise<void>;\n user(): Promise<UserProfile>;\n };\n catalog: {\n index(opts?: { signal?: AbortSignal }): Promise<CatalogResponse>;\n byCreator(userId: string, opts?: { signal?: AbortSignal }): Promise<CatalogResponse>;\n };\n config: {\n realms(opts?: { locale?: LocaleId; signal?: AbortSignal }): Promise<RealmConfigResponse>;\n };\n stories: {\n index(opts?: { signal?: AbortSignal }): Promise<PaginatedResponse<StoryListItem>>;\n show(id: string, opts?: { signal?: AbortSignal }): Promise<StoryListItem>;\n mine(opts?: { signal?: AbortSignal }): Promise<MineResponse>;\n create(req: CreateStoryRequest): Promise<{ data: StoryListItem }>;\n update(id: string, req: UpdateStoryRequest): Promise<{ data: StoryListItem }>;\n destroy(id: string): Promise<void>;\n };\n tags: {\n index(opts?: { signal?: AbortSignal }): Promise<TagListResponse>;\n };\n scenes: {\n index(storyId: string, opts?: { signal?: AbortSignal }): Promise<SceneListItem[]>;\n show(id: string, opts?: { signal?: AbortSignal }): Promise<SceneListItem>;\n create(req: CreateSceneRequest): Promise<SceneListItem>;\n update(id: string, req: UpdateSceneRequest): Promise<SceneListItem>;\n destroy(id: string): Promise<void>;\n };\n sceneActions: {\n index(opts?: {\n sceneId?: string;\n signal?: AbortSignal;\n }): Promise<SceneActionItem[]>;\n show(id: string, opts?: { signal?: AbortSignal }): Promise<SceneActionItem>;\n create(req: CreateSceneActionRequest): Promise<SceneActionItem>;\n update(id: string, req: UpdateSceneActionRequest): Promise<SceneActionItem>;\n destroy(id: string): Promise<{ message: string }>;\n };\n media: {\n uploadUrl(req: UploadUrlRequest): Promise<UploadUrlResponse>;\n register(req: RegisterMediaRequest): Promise<RegisterMediaResponse>;\n transcode(req: TranscodeRequest): Promise<TranscodeResponse>;\n playUrl(id: string, opts?: { signal?: AbortSignal }): Promise<PlayUrlResponse>;\n sourceUrl(id: string, opts?: { signal?: AbortSignal }): Promise<SourceUrlResponse>;\n };\n watch: {\n sceneMap(storyId: string, opts?: { signal?: AbortSignal }): Promise<SceneMapResponse>;\n trackEngagement(storyId: string, req: TrackEngagementRequest): Promise<EngagementResponse>;\n saveBookmark(storyId: string, req: SaveBookmarkRequest): Promise<BookmarkResponse>;\n listBookmarks(storyId: string, opts?: { signal?: AbortSignal }): Promise<BookmarkListResponse>;\n };\n user: {\n profile(opts?: { signal?: AbortSignal }): Promise<UserProfile>;\n publicProfile(userId: string, opts?: { signal?: AbortSignal }): Promise<PublicDirectorProfile>;\n updateRealm(req: UpdateRealmRequest): Promise<UpdateRealmResponse>;\n updateLocale(req: UpdateLocaleRequest): Promise<UpdateLocaleResponse>;\n updateProfile(req: UpdateProfileRequest): Promise<UpdateProfileResponse>;\n usernameAvailability(username: string, opts?: { signal?: AbortSignal }): Promise<UsernameAvailabilityResponse>;\n };\n credits: {\n balance(opts?: { signal?: AbortSignal }): Promise<CreditBalanceResponse>;\n ledger(opts?: {\n signal?: AbortSignal;\n pool?: CreditPool;\n }): Promise<{ transactions: unknown[] }>;\n packs(opts?: { signal?: AbortSignal }): Promise<{ packs: import(\"../types/index.js\").CreditPack[] }>;\n uploadCost(fileSize: number, opts?: { signal?: AbortSignal }): Promise<UploadCostResponse>;\n purchase(req: PurchaseCreditsRequest): Promise<PurchaseCreditsResponse>;\n purchaseAmount(req: PurchaseAmountRequest): Promise<PurchaseCreditsResponse>;\n unlockScene(sceneId: string, opts?: { signal?: AbortSignal }): Promise<{\n unlocked: boolean;\n already_watched?: boolean;\n balance: import(\"../types/index.js\").CreditBalance;\n error?: string;\n }>;\n };\n payments: {\n list(opts?: { signal?: AbortSignal }): Promise<{ payment_methods: PaymentMethod[] }>;\n store(req: StorePaymentMethodRequest): Promise<{ payment_method: PaymentMethod }>;\n remove(paymentMethodId: string): Promise<{ message: string }>;\n setDefault(paymentMethodId: string): Promise<{ message: string }>;\n };\n admin: {\n credits: {\n grant(req: GrantCreditsRequest): Promise<GrantCreditsResponse>;\n };\n };\n ai: {\n generateImage(req: GenerateImageRequest): Promise<GenerateImageResponse>;\n show(id: string, opts?: { signal?: AbortSignal }): Promise<AiGenerationShowResponse>;\n accept(id: string, req: AcceptGenerationRequest): Promise<AcceptGenerationResponse>;\n reject(id: string, req: RejectGenerationRequest): Promise<RejectGenerationResponse>;\n storyStyle(storyId: string, opts?: { signal?: AbortSignal }): Promise<StoryStyleResponse>;\n storyEstimate(req: import(\"../types/index.js\").AiStoryEstimateRequest): Promise<import(\"../types/index.js\").AiStoryEstimateResponse>;\n storyGenerate(req: import(\"../types/index.js\").AiStoryGenerateRequest): Promise<import(\"../types/index.js\").AiStoryGenerateResponse>;\n sceneEstimate(req: import(\"../types/index.js\").AiSceneEstimateRequest): Promise<import(\"../types/index.js\").AiSceneEstimateResponse>;\n sceneGenerate(req: import(\"../types/index.js\").AiSceneGenerateRequest): Promise<import(\"../types/index.js\").AiSceneGenerateResponse>;\n };\n}\n\n/**\n * Construct a typed CHUZI API client. Bearer-token auth via Authorization\n * header (works for web/SPA and native apps). The host owns token storage\n * and lifecycle — pass `getToken` to plug in localStorage / AsyncStorage /\n * SecureStore as appropriate.\n *\n * Surfaces not yet wired: scene-actions, exports, admin, reports.\n * Add them here as the migration reaches each surface; the route shapes\n * are documented in chuzi-api/routes/api.php.\n */\nexport function createChuziClient(config: ChuziClientConfig): ChuziClient {\n const request = makeRequester(config);\n\n return {\n auth: {\n login: (req) =>\n request(\"POST\", \"/api/v1/auth/login\", { body: req }),\n exchangeOidcCode: (req) =>\n request(\"POST\", \"/api/v1/auth/oidc/exchange\", { body: req }),\n requestMagicLink: (req) =>\n request(\"POST\", \"/api/v1/auth/magic-link/request\", { body: req }),\n verifyMagicLink: (req) =>\n request(\"POST\", \"/api/v1/auth/magic-link/verify\", { body: req }),\n usernameAvailability: (username, opts) =>\n request(\"GET\", \"/api/v1/auth/username-availability\", {\n signal: opts?.signal,\n query: { username },\n }),\n logout: () => request(\"POST\", \"/api/v1/auth/logout\"),\n user: () => request(\"GET\", \"/api/v1/auth/user\"),\n },\n catalog: {\n index: (opts) => request(\"GET\", \"/api/v1/catalog\", opts),\n byCreator: (userId, opts) =>\n request(\"GET\", \"/api/v1/catalog\", {\n signal: opts?.signal,\n query: { creator_id: userId },\n }),\n },\n config: {\n realms: (opts) =>\n request(\"GET\", \"/api/v1/config/realms\", {\n signal: opts?.signal,\n query: opts?.locale ? { locale: opts.locale } : undefined,\n }),\n },\n stories: {\n index: (opts) => request(\"GET\", \"/api/v1/stories\", opts),\n show: (id, opts) => request(\"GET\", `/api/v1/stories/${encodeURIComponent(id)}`, opts),\n mine: (opts) => request(\"GET\", \"/api/v1/stories/mine\", opts),\n create: (req) => request(\"POST\", \"/api/v1/stories\", { body: req }),\n update: (id, req) => request(\"PATCH\", `/api/v1/stories/${encodeURIComponent(id)}`, { body: req }),\n destroy: (id) => request(\"DELETE\", `/api/v1/stories/${encodeURIComponent(id)}`),\n },\n tags: {\n index: (opts) => request(\"GET\", \"/api/v1/tags\", opts),\n },\n scenes: {\n index: (storyId, opts) =>\n request(\"GET\", \"/api/v1/scenes\", {\n signal: opts?.signal,\n query: { story_id: storyId },\n }),\n show: (id, opts) =>\n request(\"GET\", `/api/v1/scenes/${encodeURIComponent(id)}`, opts),\n create: (req) =>\n request(\"POST\", \"/api/v1/scenes\", { body: req }),\n update: (id, req) =>\n request(\"PATCH\", `/api/v1/scenes/${encodeURIComponent(id)}`, { body: req }),\n destroy: (id) =>\n request(\"DELETE\", `/api/v1/scenes/${encodeURIComponent(id)}`),\n },\n sceneActions: {\n index: (opts) =>\n request(\"GET\", \"/api/v1/scene-actions\", {\n signal: opts?.signal,\n query: opts?.sceneId ? { scene_id: opts.sceneId } : undefined,\n }),\n show: (id, opts) =>\n request(\"GET\", `/api/v1/scene-actions/${encodeURIComponent(id)}`, opts),\n create: (req) =>\n request(\"POST\", \"/api/v1/scene-actions\", { body: req }),\n update: (id, req) =>\n request(\"PATCH\", `/api/v1/scene-actions/${encodeURIComponent(id)}`, {\n body: req,\n }),\n destroy: (id) =>\n request(\"DELETE\", `/api/v1/scene-actions/${encodeURIComponent(id)}`),\n },\n media: {\n uploadUrl: (req) =>\n request(\"POST\", \"/api/v1/media/upload-url\", { body: req }),\n register: (req) =>\n request(\"POST\", \"/api/v1/media/register\", { body: req }),\n transcode: (req) =>\n request(\"POST\", \"/api/v1/media/transcode\", { body: req }),\n playUrl: (id, opts) =>\n request(\"GET\", `/api/v1/media/${encodeURIComponent(id)}/play`, opts),\n sourceUrl: (id, opts) =>\n request(\"GET\", `/api/v1/media/${encodeURIComponent(id)}/source-url`, opts),\n },\n watch: {\n sceneMap: (storyId, opts) =>\n request(\"GET\", `/api/v1/stories/${encodeURIComponent(storyId)}/scene-map`, opts),\n trackEngagement: (storyId, req) =>\n request(\"POST\", `/api/v1/stories/${encodeURIComponent(storyId)}/engagement`, { body: req }),\n saveBookmark: (storyId, req) =>\n request(\"POST\", `/api/v1/stories/${encodeURIComponent(storyId)}/bookmark`, { body: req }),\n listBookmarks: (storyId, opts) =>\n request(\"GET\", `/api/v1/stories/${encodeURIComponent(storyId)}/bookmarks`, opts),\n },\n user: {\n profile: (opts) => request(\"GET\", \"/api/v1/user/profile\", opts),\n publicProfile: (userId, opts) =>\n request(\"GET\", `/api/v1/users/${encodeURIComponent(userId)}/public`, opts),\n updateRealm: (req) => request(\"PUT\", \"/api/v1/user/realm\", { body: req }),\n updateLocale: (req) => request(\"PUT\", \"/api/v1/user/locale\", { body: req }),\n updateProfile: (req) => request(\"PUT\", \"/api/v1/user/profile\", { body: req }),\n usernameAvailability: (username, opts) =>\n request(\"GET\", \"/api/v1/user/username-availability\", {\n signal: opts?.signal,\n query: { username },\n }),\n },\n credits: {\n balance: (opts) => request(\"GET\", \"/api/v1/credits/balance\", opts),\n ledger: (opts) =>\n request(\"GET\", \"/api/v1/credits/ledger\", {\n signal: opts?.signal,\n query: opts?.pool ? { pool: opts.pool } : undefined,\n }),\n packs: (opts) => request(\"GET\", \"/api/v1/credits/packs\", opts),\n uploadCost: (fileSize, opts) =>\n request(\"GET\", \"/api/v1/credits/upload-cost\", {\n signal: opts?.signal,\n query: { file_size: fileSize },\n }),\n purchase: (req) =>\n request(\"POST\", \"/api/v1/credits/purchase\", { body: req }),\n purchaseAmount: (req) =>\n request(\"POST\", \"/api/v1/credits/purchase-amount\", { body: req }),\n unlockScene: (sceneId, opts) =>\n request(\"POST\", `/api/v1/scenes/${encodeURIComponent(sceneId)}/unlock`, opts),\n },\n payments: {\n list: (opts) => request(\"GET\", \"/api/v1/payments/methods\", opts),\n store: (req) =>\n request(\"POST\", \"/api/v1/payments/methods\", { body: req }),\n remove: (paymentMethodId) =>\n request(\"DELETE\", `/api/v1/payments/methods/${encodeURIComponent(paymentMethodId)}`),\n setDefault: (paymentMethodId) =>\n request(\n \"POST\",\n `/api/v1/payments/methods/${encodeURIComponent(paymentMethodId)}/default`,\n ),\n },\n admin: {\n credits: {\n grant: (req) =>\n request(\"POST\", \"/api/v1/admin/credits/grant\", { body: req }),\n },\n },\n ai: {\n generateImage: (req) =>\n request(\"POST\", \"/api/v1/ai/generate-image\", { body: req }),\n show: (id, opts) =>\n request(\"GET\", `/api/v1/ai/generations/${encodeURIComponent(id)}`, opts),\n accept: (id, req) =>\n request(\"POST\", `/api/v1/ai/generations/${encodeURIComponent(id)}/accept`, { body: req }),\n reject: (id, req) =>\n request(\"POST\", `/api/v1/ai/generations/${encodeURIComponent(id)}/reject`, { body: req }),\n storyStyle: (storyId, opts) =>\n request(\"GET\", `/api/v1/ai/stories/${encodeURIComponent(storyId)}/style`, opts),\n storyEstimate: (req) =>\n request(\"POST\", \"/api/v1/ai/story/estimate\", { body: req }),\n storyGenerate: (req) =>\n request(\"POST\", \"/api/v1/ai/story/generate\", { body: req }),\n sceneEstimate: (req) =>\n request(\"POST\", `/api/v1/ai/stories/${encodeURIComponent(req.story_id)}/scene/estimate`, {\n body: { brief: req.brief, mode: req.mode, scene_id: req.scene_id },\n }),\n sceneGenerate: (req) =>\n request(\"POST\", `/api/v1/ai/stories/${encodeURIComponent(req.story_id)}/scene/generate`, {\n body: { brief: req.brief, mode: req.mode, scene_id: req.scene_id },\n }),\n },\n };\n}\n"]}
@@ -11,6 +11,20 @@ declare function defaultPurchaseCredits(pool: CreditPool): number;
11
11
  declare function priceCentsForCredits(pool: CreditPool, credits: number): number;
12
12
  declare function formatCreditPrice(cents: number): string;
13
13
 
14
+ /**
15
+ * Guided prompts for Chuzi AI story creation.
16
+ * Based on Dan Harmon's Story Circle and Joseph Campbell's Hero's Journey.
17
+ */
18
+ interface ChuziAiPromptStep {
19
+ key: string;
20
+ lexicon_title: string;
21
+ lexicon_hint: string;
22
+ /** Monomyth stage reference shown in the UI */
23
+ monomyth_ref?: string;
24
+ required?: boolean;
25
+ }
26
+ declare const CHUZI_AI_PROMPT_STEPS: ChuziAiPromptStep[];
27
+
14
28
  declare const REALM_IDS: readonly RealmId[];
15
29
  declare const SUPPORTED_LOCALES: readonly LocaleId[];
16
30
  declare const LOCALE_LABELS: Record<LocaleId, string>;
@@ -50,4 +64,4 @@ declare function t(realmId: RealmId | null | undefined, key: string, fallback?:
50
64
  */
51
65
  declare function lexiconForRealm(realmId: RealmId | null | undefined, locale?: LocaleId | null | undefined): Record<string, string>;
52
66
 
53
- export { CONTENT_RATINGS, CONTENT_RATING_IDS, CREDITS_PER_DOLLAR, CREDIT_CENTS_PER_UNIT, DEFAULT_LOCALE, FALLBACK_LEXICON, FALLBACK_LOCALES, LOCALE_LABELS, REALMS, REALM_IDS, SUPPORTED_LOCALES, defaultPurchaseCredits, formatCreditPrice, getRealmLexiconOverrides, isContentRating, isSupportedLocale, lexiconForRealm, matchAcceptLanguage, normalizeLocale, priceCentsForCredits, setRealmLexiconOverrides, t };
67
+ export { CHUZI_AI_PROMPT_STEPS, CONTENT_RATINGS, CONTENT_RATING_IDS, CREDITS_PER_DOLLAR, CREDIT_CENTS_PER_UNIT, type ChuziAiPromptStep, DEFAULT_LOCALE, FALLBACK_LEXICON, FALLBACK_LOCALES, LOCALE_LABELS, REALMS, REALM_IDS, SUPPORTED_LOCALES, defaultPurchaseCredits, formatCreditPrice, getRealmLexiconOverrides, isContentRating, isSupportedLocale, lexiconForRealm, matchAcceptLanguage, normalizeLocale, priceCentsForCredits, setRealmLexiconOverrides, t };
@@ -17,6 +17,86 @@ function formatCreditPrice(cents) {
17
17
  return `$${(cents / 100).toFixed(2)}`;
18
18
  }
19
19
 
20
+ // src/config/chuzi-ai-prompts.ts
21
+ var CHUZI_AI_PROMPT_STEPS = [
22
+ {
23
+ key: "hero",
24
+ lexicon_title: "chuzi_ai_step_hero",
25
+ lexicon_hint: "chuzi_ai_step_hero_hint",
26
+ monomyth_ref: "chuzi_ai_monomyth_hero",
27
+ required: true
28
+ },
29
+ {
30
+ key: "world",
31
+ lexicon_title: "chuzi_ai_step_world",
32
+ lexicon_hint: "chuzi_ai_step_world_hint",
33
+ monomyth_ref: "chuzi_ai_monomyth_world",
34
+ required: true
35
+ },
36
+ {
37
+ key: "you",
38
+ lexicon_title: "chuzi_ai_step_you",
39
+ lexicon_hint: "chuzi_ai_step_you_hint",
40
+ monomyth_ref: "chuzi_ai_monomyth_you",
41
+ required: true
42
+ },
43
+ {
44
+ key: "need",
45
+ lexicon_title: "chuzi_ai_step_need",
46
+ lexicon_hint: "chuzi_ai_step_need_hint",
47
+ monomyth_ref: "chuzi_ai_monomyth_need",
48
+ required: true
49
+ },
50
+ {
51
+ key: "go",
52
+ lexicon_title: "chuzi_ai_step_go",
53
+ lexicon_hint: "chuzi_ai_step_go_hint",
54
+ monomyth_ref: "chuzi_ai_monomyth_go",
55
+ required: true
56
+ },
57
+ {
58
+ key: "search",
59
+ lexicon_title: "chuzi_ai_step_search",
60
+ lexicon_hint: "chuzi_ai_step_search_hint",
61
+ monomyth_ref: "chuzi_ai_monomyth_search",
62
+ required: false
63
+ },
64
+ {
65
+ key: "find",
66
+ lexicon_title: "chuzi_ai_step_find",
67
+ lexicon_hint: "chuzi_ai_step_find_hint",
68
+ monomyth_ref: "chuzi_ai_monomyth_find",
69
+ required: false
70
+ },
71
+ {
72
+ key: "take",
73
+ lexicon_title: "chuzi_ai_step_take",
74
+ lexicon_hint: "chuzi_ai_step_take_hint",
75
+ monomyth_ref: "chuzi_ai_monomyth_take",
76
+ required: false
77
+ },
78
+ {
79
+ key: "return",
80
+ lexicon_title: "chuzi_ai_step_return",
81
+ lexicon_hint: "chuzi_ai_step_return_hint",
82
+ monomyth_ref: "chuzi_ai_monomyth_return",
83
+ required: false
84
+ },
85
+ {
86
+ key: "change",
87
+ lexicon_title: "chuzi_ai_step_change",
88
+ lexicon_hint: "chuzi_ai_step_change_hint",
89
+ monomyth_ref: "chuzi_ai_monomyth_change",
90
+ required: false
91
+ },
92
+ {
93
+ key: "tone",
94
+ lexicon_title: "chuzi_ai_step_tone",
95
+ lexicon_hint: "chuzi_ai_step_tone_hint",
96
+ required: false
97
+ }
98
+ ];
99
+
20
100
  // src/config/index.ts
21
101
  var REALM_IDS = ["cosmos", "wilds"];
22
102
  var SUPPORTED_LOCALES = [
@@ -150,7 +230,7 @@ var REALMS = {
150
230
  select_genre: "Select galaxy",
151
231
  genre_field_aria: "Galaxy",
152
232
  delete_story_verb: "Delete star system",
153
- title_scene_default: "Title planet",
233
+ title_scene_default: "Launch",
154
234
  choices_made_stat: "trajectories taken",
155
235
  content_rating: "Audience Class",
156
236
  content_rating_field_aria: "Audience class",
@@ -163,10 +243,10 @@ var REALMS = {
163
243
  editor_alt_media: "Effects",
164
244
  editor_choices: "Choices",
165
245
  editor_scene_settings: "Star Settings",
166
- editor_title_scene: "Title Star",
246
+ editor_title_scene: "Start",
167
247
  editor_film_title: "Star System Title",
168
248
  editor_film_title_hint: "Click to rename this star system",
169
- editor_ending_scene: "Final Star",
249
+ editor_ending_scene: "End",
170
250
  editor_play: "Engage",
171
251
  editor_pause: "Hold",
172
252
  editor_prev_frame: "Previous Frame",
@@ -183,8 +263,69 @@ var REALMS = {
183
263
  editor_create_scene_cost: "1 Stardust",
184
264
  editor_delete_scene_cta: "Delete Scene",
185
265
  editor_delete_scene_confirm: "Click again to confirm",
186
- editor_scene_locked_delete: "Title and end scenes cannot be deleted.",
266
+ editor_scene_locked_delete: "Start and end scenes cannot be deleted.",
187
267
  editor_scene_color: "Star Hue",
268
+ chuzi_ai_name: "Chuzi AI",
269
+ chuzi_ai_create_with: "Create with Chuzi AI",
270
+ chuzi_ai_create_manual: "Enter title manually",
271
+ chuzi_ai_intro: "Answer story-circle prompts and Chuzi AI will chart your short story.",
272
+ chuzi_ai_step_of: "Step",
273
+ chuzi_ai_back: "Back",
274
+ chuzi_ai_next: "Next",
275
+ chuzi_ai_scenes_label: "scenes",
276
+ chuzi_ai_creating: "Creating\u2026",
277
+ chuzi_ai_generate_failed: "Story generation failed.",
278
+ chuzi_ai_build_failed: "Failed to build story.",
279
+ chuzi_ai_generate: "Generate story",
280
+ chuzi_ai_generating: "Generating\u2026",
281
+ chuzi_ai_token_in: "Tokens in",
282
+ chuzi_ai_token_out: "Tokens out",
283
+ chuzi_ai_credits_cost: "AI credits",
284
+ chuzi_ai_scene_credits: "Scene credits",
285
+ chuzi_ai_total_cost: "Total create credits",
286
+ chuzi_ai_insufficient: "Not enough create credits for this generation.",
287
+ chuzi_ai_apply: "Build story",
288
+ chuzi_ai_applying: "Building scenes\u2026",
289
+ chuzi_ai_scene_create: "Create scene with Chuzi AI",
290
+ chuzi_ai_scene_overwrite: "Rewrite scene with Chuzi AI",
291
+ chuzi_ai_scene_brief: "Scene direction",
292
+ chuzi_ai_scene_brief_hint: "Describe what should happen in this scene. Chuzi AI reads your existing story for characters, tone, and style.",
293
+ chuzi_ai_scene_context_note: "Uses your story\u2019s existing scenes, typography, and art direction as context.",
294
+ chuzi_ai_scene_overwrite_confirm: "I understand this replaces this scene\u2019s text and styling.",
295
+ chuzi_ai_scene_apply_create: "Create scene",
296
+ chuzi_ai_scene_apply_overwrite: "Replace scene",
297
+ chuzi_ai_step_hero: "Hero",
298
+ chuzi_ai_step_hero_hint: "Who is your protagonist? Name, age, personality, and what makes them relatable.",
299
+ chuzi_ai_step_world: "Ordinary world",
300
+ chuzi_ai_step_world_hint: "Where does the story begin? Describe the setting and daily life before adventure calls.",
301
+ chuzi_ai_step_you: "You",
302
+ chuzi_ai_step_you_hint: "The character in a zone of comfort. What is their normal life like right now?",
303
+ chuzi_ai_step_need: "Need",
304
+ chuzi_ai_step_need_hint: "Something isn\u2019t right. What problem, longing, or imbalance disrupts their comfort?",
305
+ chuzi_ai_step_go: "Go",
306
+ chuzi_ai_step_go_hint: "Crossing the threshold. What event pushes them into the unknown?",
307
+ chuzi_ai_step_search: "Search",
308
+ chuzi_ai_step_search_hint: "Trials, growth, and exploration. What challenges and discoveries shape them?",
309
+ chuzi_ai_step_find: "Find",
310
+ chuzi_ai_step_find_hint: "The thing is found or revealed. What truth, object, or insight do they uncover?",
311
+ chuzi_ai_step_take: "Take",
312
+ chuzi_ai_step_take_hint: "Pay the price. What must they sacrifice or confront to claim their goal?",
313
+ chuzi_ai_step_return: "Return",
314
+ chuzi_ai_step_return_hint: "Back to the known world. How do they bring what they learned home?",
315
+ chuzi_ai_step_change: "Change",
316
+ chuzi_ai_step_change_hint: "Transformation achieved. How is the hero different from who they were at the start?",
317
+ chuzi_ai_step_tone: "Tone & mood",
318
+ chuzi_ai_step_tone_hint: "Genre, mood, and atmosphere (e.g. bittersweet sci-fi, cozy mystery, epic fantasy).",
319
+ chuzi_ai_monomyth_hero: "Hero\u2019s Journey: the protagonist",
320
+ chuzi_ai_monomyth_world: "Monomyth: ordinary world",
321
+ chuzi_ai_monomyth_you: "Story Circle: zone of comfort",
322
+ chuzi_ai_monomyth_need: "Story Circle: something isn\u2019t right",
323
+ chuzi_ai_monomyth_go: "Monomyth: crossing the first threshold",
324
+ chuzi_ai_monomyth_search: "Monomyth: road of trials",
325
+ chuzi_ai_monomyth_find: "Monomyth: the ultimate boon",
326
+ chuzi_ai_monomyth_take: "Monomyth: atonement with the father",
327
+ chuzi_ai_monomyth_return: "Monomyth: crossing the return threshold",
328
+ chuzi_ai_monomyth_change: "Monomyth: freedom to live",
188
329
  editor_ai_generate: "Generate Transmission",
189
330
  editor_ai_generating: "Transmitting Signal\u2026",
190
331
  editor_ai_mood_question: "What energy should this planet radiate?",
@@ -482,7 +623,7 @@ var REALMS = {
482
623
  select_genre: "Select biome",
483
624
  genre_field_aria: "Biome",
484
625
  delete_story_verb: "Delete grove",
485
- title_scene_default: "Title clearing",
626
+ title_scene_default: "Trailhead",
486
627
  choices_made_stat: "trails taken",
487
628
  content_rating: "Field Guide",
488
629
  content_rating_field_aria: "Field guide",
@@ -495,10 +636,10 @@ var REALMS = {
495
636
  editor_alt_media: "Effects",
496
637
  editor_choices: "Choices",
497
638
  editor_scene_settings: "Clearing Settings",
498
- editor_title_scene: "Title Clearing",
639
+ editor_title_scene: "Start",
499
640
  editor_film_title: "Grove Title",
500
641
  editor_film_title_hint: "Click to rename this grove",
501
- editor_ending_scene: "Roots",
642
+ editor_ending_scene: "End",
502
643
  editor_play: "Unfurl",
503
644
  editor_pause: "Rest",
504
645
  editor_prev_frame: "Previous Frame",
@@ -515,8 +656,69 @@ var REALMS = {
515
656
  editor_create_scene_cost: "1 Pollen",
516
657
  editor_delete_scene_cta: "Delete Scene",
517
658
  editor_delete_scene_confirm: "Click again to confirm",
518
- editor_scene_locked_delete: "Title and end scenes cannot be deleted.",
659
+ editor_scene_locked_delete: "Start and end scenes cannot be deleted.",
519
660
  editor_scene_color: "Clearing Tint",
661
+ chuzi_ai_name: "Chuzi AI",
662
+ chuzi_ai_create_with: "Create with Chuzi AI",
663
+ chuzi_ai_create_manual: "Enter title manually",
664
+ chuzi_ai_intro: "Answer story-circle prompts and Chuzi AI will grow your short story.",
665
+ chuzi_ai_step_of: "Step",
666
+ chuzi_ai_back: "Back",
667
+ chuzi_ai_next: "Next",
668
+ chuzi_ai_scenes_label: "scenes",
669
+ chuzi_ai_creating: "Creating\u2026",
670
+ chuzi_ai_generate_failed: "Story generation failed.",
671
+ chuzi_ai_build_failed: "Failed to build story.",
672
+ chuzi_ai_generate: "Generate story",
673
+ chuzi_ai_generating: "Generating\u2026",
674
+ chuzi_ai_token_in: "Tokens in",
675
+ chuzi_ai_token_out: "Tokens out",
676
+ chuzi_ai_credits_cost: "AI credits",
677
+ chuzi_ai_scene_credits: "Scene credits",
678
+ chuzi_ai_total_cost: "Total create credits",
679
+ chuzi_ai_insufficient: "Not enough create credits for this generation.",
680
+ chuzi_ai_apply: "Build story",
681
+ chuzi_ai_applying: "Building scenes\u2026",
682
+ chuzi_ai_scene_create: "Create scene with Chuzi AI",
683
+ chuzi_ai_scene_overwrite: "Rewrite scene with Chuzi AI",
684
+ chuzi_ai_scene_brief: "Scene direction",
685
+ chuzi_ai_scene_brief_hint: "Describe what should happen in this scene. Chuzi AI reads your existing story for characters, tone, and style.",
686
+ chuzi_ai_scene_context_note: "Uses your story\u2019s existing scenes, typography, and art direction as context.",
687
+ chuzi_ai_scene_overwrite_confirm: "I understand this replaces this scene\u2019s text and styling.",
688
+ chuzi_ai_scene_apply_create: "Create scene",
689
+ chuzi_ai_scene_apply_overwrite: "Replace scene",
690
+ chuzi_ai_step_hero: "Hero",
691
+ chuzi_ai_step_hero_hint: "Who is your protagonist? Name, age, personality, and what makes them relatable.",
692
+ chuzi_ai_step_world: "Ordinary world",
693
+ chuzi_ai_step_world_hint: "Where does the story begin? Describe the setting and daily life before adventure calls.",
694
+ chuzi_ai_step_you: "You",
695
+ chuzi_ai_step_you_hint: "The character in a zone of comfort. What is their normal life like right now?",
696
+ chuzi_ai_step_need: "Need",
697
+ chuzi_ai_step_need_hint: "Something isn\u2019t right. What problem, longing, or imbalance disrupts their comfort?",
698
+ chuzi_ai_step_go: "Go",
699
+ chuzi_ai_step_go_hint: "Crossing the threshold. What event pushes them into the unknown?",
700
+ chuzi_ai_step_search: "Search",
701
+ chuzi_ai_step_search_hint: "Trials, growth, and exploration. What challenges and discoveries shape them?",
702
+ chuzi_ai_step_find: "Find",
703
+ chuzi_ai_step_find_hint: "The thing is found or revealed. What truth, object, or insight do they uncover?",
704
+ chuzi_ai_step_take: "Take",
705
+ chuzi_ai_step_take_hint: "Pay the price. What must they sacrifice or confront to claim their goal?",
706
+ chuzi_ai_step_return: "Return",
707
+ chuzi_ai_step_return_hint: "Back to the known world. How do they bring what they learned home?",
708
+ chuzi_ai_step_change: "Change",
709
+ chuzi_ai_step_change_hint: "Transformation achieved. How is the hero different from who they were at the start?",
710
+ chuzi_ai_step_tone: "Tone & mood",
711
+ chuzi_ai_step_tone_hint: "Genre, mood, and atmosphere (e.g. bittersweet sci-fi, cozy mystery, epic fantasy).",
712
+ chuzi_ai_monomyth_hero: "Hero\u2019s Journey: the protagonist",
713
+ chuzi_ai_monomyth_world: "Monomyth: ordinary world",
714
+ chuzi_ai_monomyth_you: "Story Circle: zone of comfort",
715
+ chuzi_ai_monomyth_need: "Story Circle: something isn\u2019t right",
716
+ chuzi_ai_monomyth_go: "Monomyth: crossing the first threshold",
717
+ chuzi_ai_monomyth_search: "Monomyth: road of trials",
718
+ chuzi_ai_monomyth_find: "Monomyth: the ultimate boon",
719
+ chuzi_ai_monomyth_take: "Monomyth: atonement with the father",
720
+ chuzi_ai_monomyth_return: "Monomyth: crossing the return threshold",
721
+ chuzi_ai_monomyth_change: "Monomyth: freedom to live",
520
722
  editor_ai_generate: "Grow Bloom",
521
723
  editor_ai_generating: "Seed Sprouting\u2026",
522
724
  editor_ai_mood_question: "What feeling should this clearing evoke?",
@@ -812,7 +1014,7 @@ var FALLBACK_LEXICON = {
812
1014
  select_genre: "Select genre",
813
1015
  genre_field_aria: "Film genre",
814
1016
  delete_story_verb: "Delete film",
815
- title_scene_default: "Title Scene",
1017
+ title_scene_default: "Start",
816
1018
  choices_made_stat: "choices made",
817
1019
  content_rating: "Rating",
818
1020
  content_rating_field_aria: "Content rating",
@@ -825,10 +1027,10 @@ var FALLBACK_LEXICON = {
825
1027
  editor_alt_media: "Effects",
826
1028
  editor_choices: "Choices",
827
1029
  editor_scene_settings: "Scene Settings",
828
- editor_title_scene: "Title Scene",
1030
+ editor_title_scene: "Start",
829
1031
  editor_film_title: "Film Title",
830
1032
  editor_film_title_hint: "Click to rename this film",
831
- editor_ending_scene: "Ending Scene",
1033
+ editor_ending_scene: "End",
832
1034
  editor_play: "Play",
833
1035
  editor_pause: "Pause",
834
1036
  editor_prev_frame: "Previous Frame",
@@ -845,8 +1047,69 @@ var FALLBACK_LEXICON = {
845
1047
  editor_create_scene_cost: "1 credit",
846
1048
  editor_delete_scene_cta: "Delete Scene",
847
1049
  editor_delete_scene_confirm: "Click again to confirm",
848
- editor_scene_locked_delete: "Title and end scenes cannot be deleted.",
1050
+ editor_scene_locked_delete: "Start and end scenes cannot be deleted.",
849
1051
  editor_scene_color: "Scene Color",
1052
+ chuzi_ai_name: "Chuzi AI",
1053
+ chuzi_ai_create_with: "Create with Chuzi AI",
1054
+ chuzi_ai_create_manual: "Enter title manually",
1055
+ chuzi_ai_intro: "Answer a few story-circle prompts and Chuzi AI will draft your short story.",
1056
+ chuzi_ai_step_of: "Step",
1057
+ chuzi_ai_back: "Back",
1058
+ chuzi_ai_next: "Next",
1059
+ chuzi_ai_scenes_label: "scenes",
1060
+ chuzi_ai_creating: "Creating\u2026",
1061
+ chuzi_ai_generate_failed: "Story generation failed.",
1062
+ chuzi_ai_build_failed: "Failed to build story.",
1063
+ chuzi_ai_generate: "Generate story",
1064
+ chuzi_ai_generating: "Generating\u2026",
1065
+ chuzi_ai_token_in: "Tokens in",
1066
+ chuzi_ai_token_out: "Tokens out",
1067
+ chuzi_ai_credits_cost: "AI credits",
1068
+ chuzi_ai_scene_credits: "Scene credits",
1069
+ chuzi_ai_total_cost: "Total create credits",
1070
+ chuzi_ai_insufficient: "Not enough create credits for this generation.",
1071
+ chuzi_ai_apply: "Build story",
1072
+ chuzi_ai_applying: "Building scenes\u2026",
1073
+ chuzi_ai_scene_create: "Create scene with Chuzi AI",
1074
+ chuzi_ai_scene_overwrite: "Rewrite scene with Chuzi AI",
1075
+ chuzi_ai_scene_brief: "Scene direction",
1076
+ chuzi_ai_scene_brief_hint: "Describe what should happen in this scene. Chuzi AI reads your existing story for characters, tone, and style.",
1077
+ chuzi_ai_scene_context_note: "Uses your story\u2019s existing scenes, typography, and art direction as context.",
1078
+ chuzi_ai_scene_overwrite_confirm: "I understand this replaces this scene\u2019s text and styling.",
1079
+ chuzi_ai_scene_apply_create: "Create scene",
1080
+ chuzi_ai_scene_apply_overwrite: "Replace scene",
1081
+ chuzi_ai_step_hero: "Hero",
1082
+ chuzi_ai_step_hero_hint: "Who is your protagonist? Name, age, personality, and what makes them relatable.",
1083
+ chuzi_ai_step_world: "Ordinary world",
1084
+ chuzi_ai_step_world_hint: "Where does the story begin? Describe the setting and daily life before adventure calls.",
1085
+ chuzi_ai_step_you: "You",
1086
+ chuzi_ai_step_you_hint: "The character in a zone of comfort. What is their normal life like right now?",
1087
+ chuzi_ai_step_need: "Need",
1088
+ chuzi_ai_step_need_hint: "Something isn\u2019t right. What problem, longing, or imbalance disrupts their comfort?",
1089
+ chuzi_ai_step_go: "Go",
1090
+ chuzi_ai_step_go_hint: "Crossing the threshold. What event pushes them into the unknown?",
1091
+ chuzi_ai_step_search: "Search",
1092
+ chuzi_ai_step_search_hint: "Trials, growth, and exploration. What challenges and discoveries shape them?",
1093
+ chuzi_ai_step_find: "Find",
1094
+ chuzi_ai_step_find_hint: "The thing is found or revealed. What truth, object, or insight do they uncover?",
1095
+ chuzi_ai_step_take: "Take",
1096
+ chuzi_ai_step_take_hint: "Pay the price. What must they sacrifice or confront to claim their goal?",
1097
+ chuzi_ai_step_return: "Return",
1098
+ chuzi_ai_step_return_hint: "Back to the known world. How do they bring what they learned home?",
1099
+ chuzi_ai_step_change: "Change",
1100
+ chuzi_ai_step_change_hint: "Transformation achieved. How is the hero different from who they were at the start?",
1101
+ chuzi_ai_step_tone: "Tone & mood",
1102
+ chuzi_ai_step_tone_hint: "Genre, mood, and atmosphere (e.g. bittersweet sci-fi, cozy mystery, epic fantasy).",
1103
+ chuzi_ai_monomyth_hero: "Hero\u2019s Journey: the protagonist",
1104
+ chuzi_ai_monomyth_world: "Monomyth: ordinary world",
1105
+ chuzi_ai_monomyth_you: "Story Circle: zone of comfort",
1106
+ chuzi_ai_monomyth_need: "Story Circle: something isn\u2019t right",
1107
+ chuzi_ai_monomyth_go: "Monomyth: crossing the first threshold",
1108
+ chuzi_ai_monomyth_search: "Monomyth: road of trials",
1109
+ chuzi_ai_monomyth_find: "Monomyth: the ultimate boon",
1110
+ chuzi_ai_monomyth_take: "Monomyth: atonement with the father",
1111
+ chuzi_ai_monomyth_return: "Monomyth: crossing the return threshold",
1112
+ chuzi_ai_monomyth_change: "Monomyth: freedom to live",
850
1113
  editor_ai_generate: "Generate with AI",
851
1114
  editor_ai_generating: "Generating\u2026",
852
1115
  editor_ai_mood_question: "What mood should this scene convey?",
@@ -1146,6 +1409,6 @@ function lexiconForRealm(realmId, locale = null) {
1146
1409
  return { ...fb, ...resolveRealm(realmId, locale) };
1147
1410
  }
1148
1411
 
1149
- export { CONTENT_RATINGS, CONTENT_RATING_IDS, CREDITS_PER_DOLLAR, CREDIT_CENTS_PER_UNIT, DEFAULT_LOCALE, FALLBACK_LEXICON, FALLBACK_LOCALES, LOCALE_LABELS, REALMS, REALM_IDS, SUPPORTED_LOCALES, defaultPurchaseCredits, formatCreditPrice, getRealmLexiconOverrides, isContentRating, isSupportedLocale, lexiconForRealm, matchAcceptLanguage, normalizeLocale, priceCentsForCredits, setRealmLexiconOverrides, t };
1412
+ export { CHUZI_AI_PROMPT_STEPS, CONTENT_RATINGS, CONTENT_RATING_IDS, CREDITS_PER_DOLLAR, CREDIT_CENTS_PER_UNIT, DEFAULT_LOCALE, FALLBACK_LEXICON, FALLBACK_LOCALES, LOCALE_LABELS, REALMS, REALM_IDS, SUPPORTED_LOCALES, defaultPurchaseCredits, formatCreditPrice, getRealmLexiconOverrides, isContentRating, isSupportedLocale, lexiconForRealm, matchAcceptLanguage, normalizeLocale, priceCentsForCredits, setRealmLexiconOverrides, t };
1150
1413
  //# sourceMappingURL=index.js.map
1151
1414
  //# sourceMappingURL=index.js.map