@escapeaihq/client-core 0.139.0 → 0.141.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.
Files changed (60) hide show
  1. package/dist/api.d.ts +122 -0
  2. package/dist/api.d.ts.map +1 -1
  3. package/dist/api.js +71 -0
  4. package/dist/api.js.map +1 -1
  5. package/dist/domains/adventureDefinitions.d.ts +14 -4
  6. package/dist/domains/adventureDefinitions.d.ts.map +1 -1
  7. package/dist/domains/adventureDefinitions.js +14 -4
  8. package/dist/domains/adventureDefinitions.js.map +1 -1
  9. package/dist/domains/personas.d.ts +3 -0
  10. package/dist/domains/personas.d.ts.map +1 -1
  11. package/dist/domains/personas.js +6 -0
  12. package/dist/domains/personas.js.map +1 -1
  13. package/dist/domains/runtime.d.ts +25 -0
  14. package/dist/domains/runtime.d.ts.map +1 -0
  15. package/dist/domains/runtime.js +29 -0
  16. package/dist/domains/runtime.js.map +1 -0
  17. package/dist/domains/showcase.d.ts +16 -1
  18. package/dist/domains/showcase.d.ts.map +1 -1
  19. package/dist/domains/showcase.js +15 -0
  20. package/dist/domains/showcase.js.map +1 -1
  21. package/dist/generated/contract.d.ts +7 -1
  22. package/dist/generated/contract.d.ts.map +1 -1
  23. package/dist/generated/contract.js.map +1 -1
  24. package/dist/index.d.ts +2 -0
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +3 -0
  27. package/dist/index.js.map +1 -1
  28. package/dist/runtimeEvents.d.ts +111 -0
  29. package/dist/runtimeEvents.d.ts.map +1 -0
  30. package/dist/runtimeEvents.js +55 -0
  31. package/dist/runtimeEvents.js.map +1 -0
  32. package/dist/sceneBridge.d.ts +193 -0
  33. package/dist/sceneBridge.d.ts.map +1 -0
  34. package/dist/sceneBridge.js +329 -0
  35. package/dist/sceneBridge.js.map +1 -0
  36. package/dist/voiceCloneCaption.d.ts +7 -1
  37. package/dist/voiceCloneCaption.d.ts.map +1 -1
  38. package/dist/voiceCloneCaption.js +26 -1
  39. package/dist/voiceCloneCaption.js.map +1 -1
  40. package/dist/websocket.d.ts +18 -1
  41. package/dist/websocket.d.ts.map +1 -1
  42. package/dist/websocket.js +16 -0
  43. package/dist/websocket.js.map +1 -1
  44. package/package.json +1 -1
  45. package/src/__tests__/api.adventure-definitions.test.ts +16 -0
  46. package/src/__tests__/castFramePipelinePending.test.ts +56 -1
  47. package/src/__tests__/persona-generation.test.ts +26 -0
  48. package/src/__tests__/scene-bridge.test.ts +314 -0
  49. package/src/__tests__/voiceCloneCaption.test.ts +56 -0
  50. package/src/api.ts +156 -0
  51. package/src/domains/adventureDefinitions.ts +14 -4
  52. package/src/domains/personas.ts +7 -0
  53. package/src/domains/runtime.ts +38 -0
  54. package/src/domains/showcase.ts +24 -1
  55. package/src/generated/contract.ts +10 -0
  56. package/src/index.ts +3 -0
  57. package/src/runtimeEvents.ts +127 -0
  58. package/src/sceneBridge.ts +433 -0
  59. package/src/voiceCloneCaption.ts +36 -2
  60. package/src/websocket.ts +25 -1
package/dist/api.d.ts CHANGED
@@ -9,6 +9,7 @@ import type { InventoryAction, PartyAction } from './domains/adventures';
9
9
  import type { CreateStoryboardRequest, CreateStoryboardResponse, ExportStoryboardResponse, ListStoryboardsResponse, PatchStoryboardFrameRequest, RegionEditFrameRequest, ReorderStoryboardFramesRequest, RetryStoryboardFrameRequest, SelectFrameVariantRequest, PrepareStoryboardWorldsResponse, ReleaseStoryboardWorldsRequest, ReleaseStoryboardWorldsResponse, SetFrameWorldRequest, StoryboardDetailResponse, StoryboardExportTarget, StoryboardFrameResponse, StoryboardResponse, StoryboardView, StyleProfile } from './domains/storyboards';
10
10
  import type { ArtifactDeletionReport, ListArtifactsParams, ListArtifactsResponse, ListGenerationRunsParams, ListGenerationRunsResponse } from './domains/artifacts';
11
11
  import type { CurateQuestsResponse, CutsceneClipResponse, CutsceneDefinitionWire, ListCutscenesResponse, PutCutscenesResponse, QuestCurationDelta, QuestHistoryResponse, QuestMapResponse, QuestPreviewResponse, ReliveResponse, SessionQuestStateResponse } from './domains/quests';
12
+ import type { RuntimeEventBatchRequest, RuntimeEventBatchResponse } from './runtimeEvents';
12
13
  import type { BundleLinkFields, BundleManifestResult } from './domains/visemeBundles';
13
14
  export { CHARACTER_STYLE_PRESETS, MAX_IMAGE_OPTION_COUNT, RecloneConflictError, } from './domains/personas';
14
15
  export type { CharacterStylePreset, RecloneConflictCode } from './domains/personas';
@@ -132,6 +133,28 @@ export interface IngestionJob {
132
133
  * cast read returns is final. See {@link castFramePipelinePending}.
133
134
  */
134
135
  castFramesAt?: string | null;
136
+ /**
137
+ * §Q PERS.108 — the entity-typing tail ran with the presence spine ON, so this
138
+ * job's cast-frame/identity chain was OWED a dispatch
139
+ * (`shared/models.py::IngestionJob.presenceSpineAtIngest`). Informational: read
140
+ * readiness from {@link castFrameChain}, never by re-deriving it from this.
141
+ */
142
+ presenceSpineAtIngest?: boolean;
143
+ /**
144
+ * §Q PERS.125 — the typing tail took its classifier-failure arm (typed
145
+ * nothing); a stalled chain on such a job needs its cast re-typed
146
+ * (`shared/models.py::IngestionJob.entityTypingFailed`).
147
+ */
148
+ entityTypingFailed?: boolean;
149
+ /**
150
+ * §Q PERS.130 — where the cast-frame/identity chain stands, answered by the
151
+ * SERVER at read time with the persona job's own rule (it depends on the
152
+ * deployment's presence-spine switch and the server's clock, neither of which
153
+ * a client can see). Present on `GET /api/v1/ingestion/jobs/{videoId}`
154
+ * ({@link ApiClient.getJob}); absent on list rows and from a backend that
155
+ * predates it. Read it through {@link castFrameChainSettled}.
156
+ */
157
+ castFrameChain?: CastFrameChainState | null;
135
158
  /** Episode sequence number within {@link seriesId}, when applicable. */
136
159
  episodeNumber?: number | null;
137
160
  /** Human-readable episode title within {@link seriesId}, when applicable. */
@@ -162,6 +185,23 @@ export interface IngestionJob {
162
185
  */
163
186
  visibility?: ResourceVisibility | null;
164
187
  }
188
+ /**
189
+ * §Q PERS.130 — the cast-frame/identity chain's state as the persona job reads
190
+ * it. Mirrors `shared/ingestion_jobs.py` `CastFrameChainState`:
191
+ * - `settled` — finished, or none will run: picks made now are final and a
192
+ * persona job reads the identity index without waiting;
193
+ * - `in_flight` — a persona job would wait for it, and its identity pass will
194
+ * re-read the cast;
195
+ * - `stalled` — it will not finish on its own; a persona job is refused until
196
+ * the chain is re-run (`POST /api/v1/ingestion/videos/{id}/cii-chain/rerun`).
197
+ */
198
+ export type CastFrameChainState = 'settled' | 'in_flight' | 'stalled';
199
+ /** Named constants for {@link CastFrameChainState}. */
200
+ export declare const CAST_FRAME_CHAIN_STATE: {
201
+ readonly SETTLED: "settled";
202
+ readonly IN_FLIGHT: "in_flight";
203
+ readonly STALLED: "stalled";
204
+ };
165
205
  /**
166
206
  * Named constants for the {@link IngestionJob.status} values. Mirrors the
167
207
  * backend `JobStatus` (`shared/models.py`). Use these instead of bare string
@@ -308,6 +348,24 @@ export declare function jobPipelineStages(job: IngestionJob): JobPipelineStage[]
308
348
  * build): it increments per-shot EARLY in graph sync.
309
349
  */
310
350
  export declare function castFramePipelinePending(job: IngestionJob): boolean;
351
+ /**
352
+ * §Q PERS.130 — is the video's cast ready for a person to make picks, by the
353
+ * persona job's OWN rule? True only when the server says the cast-frame/identity
354
+ * chain is `settled` ({@link IngestionJob.castFrameChain}, from
355
+ * {@link ApiClient.getJob}).
356
+ *
357
+ * Use this, not {@link castFramePipelinePending}, to decide when to open cast
358
+ * review: a chain that is still owed reruns the identity pass over the cast, and
359
+ * a persona job started meanwhile waits for it.
360
+ *
361
+ * Takes no clock: the state is computed by the server when the job is read, with
362
+ * the clock and the presence-spine switch the persona job uses; re-read the job
363
+ * to refresh it. `false` when the field is absent (a list row, or a backend
364
+ * older than it): the caller cannot know, so it must not open picks on it. A
365
+ * `stalled` chain is also `false`; check
366
+ * `job.castFrameChain === CAST_FRAME_CHAIN_STATE.STALLED` to offer the re-run.
367
+ */
368
+ export declare function castFrameChainSettled(job: IngestionJob): boolean;
311
369
  export interface ListJobsResponse {
312
370
  traceId: string;
313
371
  results: IngestionJob[];
@@ -2268,6 +2326,15 @@ export interface ShowcaseExperiencesResponse {
2268
2326
  traceId: string;
2269
2327
  experiences: ShowcaseExperienceCard[];
2270
2328
  }
2329
+ /**
2330
+ * Response from `GET /api/v1/showcase/experiences/{definitionId}` (§Q ADV.37) —
2331
+ * ONE published experience, the same card the registry lists. This is how a
2332
+ * viewer reads a definition they did not author.
2333
+ */
2334
+ export interface ShowcaseExperienceResponse {
2335
+ traceId: string;
2336
+ experience: ShowcaseExperienceCard;
2337
+ }
2271
2338
  /**
2272
2339
  * Definition lifecycle (adventure spec §4): DRAFT → PLAYABLE → BLESSED
2273
2340
  * (→ Showcase) → ARCHIVED (terminal). Mirrors
@@ -3170,12 +3237,30 @@ export type VoiceCloneStatus = 'cloned' | 'skipped_no_dialogue' | 'skipped_insuf
3170
3237
  * voice lineage; only that source persona re-clones it.
3171
3238
  */
3172
3239
  export type RecloneIneligibleReason = 'voice_lineage_copy';
3240
+ /**
3241
+ * §Q PERS.130 — which empty harvest a `skipped_no_dialogue` outcome was.
3242
+ * Mirrors `shared/persona_models.py` `VoiceCloneSkipCause`:
3243
+ * - `no_character` — the persona is bound to no character;
3244
+ * - `speech_unverified` — the speech-grounding gate refused: the character's
3245
+ * speech was not verified as theirs and no person confirmed it by listening;
3246
+ * - `speech_untimed` — their verified speech has no usable time span;
3247
+ * - `lines_unusable` — every line has an unusable time range;
3248
+ * - `lines_too_short` — every line is too short to sample;
3249
+ * - `lines_unreadable` — two reads of the video's lines disagree;
3250
+ * - `audio_unusable` — their lines were cut and no usable audio came out;
3251
+ * - `no_speech_matched` — no speech in the video is matched to anyone yet;
3252
+ * - `no_lines_matched` — others have matched lines, this character has none.
3253
+ */
3254
+ export type VoiceCloneSkipCause = 'no_character' | 'speech_unverified' | 'speech_untimed' | 'lines_unusable' | 'lines_too_short' | 'lines_unreadable' | 'audio_unusable' | 'no_speech_matched' | 'no_lines_matched';
3173
3255
  /** §Q DM.68 — the persona-level clone record (`PersonaConfig.voice_clone_outcome`). */
3174
3256
  export interface VoiceCloneOutcome {
3175
3257
  status: VoiceCloneStatus;
3176
3258
  /** Inworld's own refusal message for `refused`; the skip/crash sentence
3177
3259
  * otherwise. Absent for `cloned`. Capped server-side at 300 characters. */
3178
3260
  reason?: string | null;
3261
+ /** §Q PERS.130 — which empty harvest a `skipped_no_dialogue` was; absent on
3262
+ * every other status and on rows written before the field. */
3263
+ cause?: VoiceCloneSkipCause | null;
3179
3264
  }
3180
3265
  export interface PersonaConfig {
3181
3266
  persona_id: string;
@@ -7145,6 +7230,7 @@ export declare class ApiClient {
7145
7230
  private readonly chat;
7146
7231
  private readonly graph;
7147
7232
  private readonly showcase;
7233
+ private readonly runtime;
7148
7234
  private readonly universes;
7149
7235
  private readonly adventureDefinitions;
7150
7236
  private readonly studioSettings;
@@ -8368,6 +8454,7 @@ export declare class ApiClient {
8368
8454
  status?: 'pending' | 'approved';
8369
8455
  sourceVideoId?: string;
8370
8456
  includeBlessed?: boolean;
8457
+ general?: boolean;
8371
8458
  }): Promise<PersonaListResponse>;
8372
8459
  /**
8373
8460
  * §Q SHOW.8: the VIEWER roster of one video — the personas a viewer may pick
@@ -8380,6 +8467,16 @@ export declare class ApiClient {
8380
8467
  * parameter).
8381
8468
  */
8382
8469
  listViewerPersonasByVideo(sourceVideoId: string): Promise<PersonaListResponse>;
8470
+ /**
8471
+ * §Q SHOW.9: the VIEWER roster of GENERAL personas — the ones that name no
8472
+ * video (a site guide an admin made). The caller's own general personas,
8473
+ * plus other owners' general personas this caller may read (blessed and
8474
+ * approved), each shaped exactly like {@link getPersona}'s viewer copy (no
8475
+ * authored prompt). Sends `?general=true&includeBlessed=true`; not paginated
8476
+ * (`next_token` is always null). An older backend answers 400 (unknown
8477
+ * parameter).
8478
+ */
8479
+ listViewerGeneralPersonas(): Promise<PersonaListResponse>;
8383
8480
  /**
8384
8481
  * C3a: list the personas auto-generated from a given source video. Thin
8385
8482
  * wrapper over {@link listPersonas} with ``sourceVideoId`` — backs the review
@@ -8529,6 +8626,12 @@ export declare class ApiClient {
8529
8626
  * out — for a caller whose job output IS a whole roster (the workflow runner's
8530
8627
  * batch step). Omitted / false => the dedupe applies.
8531
8628
  *
8629
+ * Characters an approved story arc invents are cast members too: each is a
8630
+ * graph Entity with an `arcent-` id, `getCast` lists it, and the server builds
8631
+ * a persona for each one that has none by itself after the approval applies
8632
+ * (the cast-growth backfill). To build them on demand instead, pass their ids
8633
+ * in ``opts.entityIds``. There is no separate call for invented cast.
8634
+ *
8532
8635
  * @deprecated Facade delegation (§A9.2/A9.4) — implementation now lives on
8533
8636
  * {@link PersonasApi.generatePersonasForVideo} in `./domains/personas.ts`; prefer the
8534
8637
  * domain module directly in new client-core internal code. It is NOT
@@ -10695,6 +10798,25 @@ export declare class ApiClient {
10695
10798
  listShowcaseExperiences(options?: {
10696
10799
  signal?: AbortSignal;
10697
10800
  }): Promise<ShowcaseExperiencesResponse>;
10801
+ /**
10802
+ * Read ONE published (BLESSED) experience as a viewer (§Q ADV.37) —
10803
+ * `GET /api/v1/showcase/experiences/{definitionId}`. 404 when the definition
10804
+ * is not BLESSED. See {@link ShowcaseApi.getShowcaseExperience}.
10805
+ * Additive — never remove/rename.
10806
+ */
10807
+ getShowcaseExperience(definitionId: string, options?: {
10808
+ signal?: AbortSignal;
10809
+ }): Promise<ShowcaseExperienceResponse>;
10810
+ /**
10811
+ * §Q RUNTIME.3 — report a batch of external-runtime facts (zone reached,
10812
+ * object found, world predicate set, map area unlocked) into a running
10813
+ * adventure session the caller owns. `POST /api/v1/runtime/sessions/{id}/events`;
10814
+ * see {@link RuntimeApi.submitRuntimeEvents} for the status contract. The
10815
+ * WebSocket twin is {@link ChatWebSocket.sendRuntimeEvent}. Additive.
10816
+ */
10817
+ submitRuntimeEvents(sessionId: string, request: RuntimeEventBatchRequest, options?: {
10818
+ signal?: AbortSignal;
10819
+ }): Promise<RuntimeEventBatchResponse>;
10698
10820
  /** See {@link AdventureDefinitionsApi.createDefinition}. */
10699
10821
  createAdventureDefinition(request: CreateAdventureDefinitionRequest, options?: {
10700
10822
  signal?: AbortSignal;