@escapeaihq/client-core 0.12.0 → 0.49.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/README.md +32 -7
- package/dist/adapters/capabilities.d.ts +10 -0
- package/dist/adapters/capabilities.d.ts.map +1 -0
- package/dist/adapters/capabilities.js +2 -0
- package/dist/adapters/capabilities.js.map +1 -0
- package/dist/adapters/chatAdapter.d.ts +38 -0
- package/dist/adapters/chatAdapter.d.ts.map +1 -0
- package/dist/adapters/chatAdapter.js +88 -0
- package/dist/adapters/chatAdapter.js.map +1 -0
- package/dist/adapters/directorAdapter.d.ts +62 -0
- package/dist/adapters/directorAdapter.d.ts.map +1 -0
- package/dist/adapters/directorAdapter.js +71 -0
- package/dist/adapters/directorAdapter.js.map +1 -0
- package/dist/adapters/imageAdapter.d.ts +44 -0
- package/dist/adapters/imageAdapter.d.ts.map +1 -0
- package/dist/adapters/imageAdapter.js +73 -0
- package/dist/adapters/imageAdapter.js.map +1 -0
- package/dist/adapters/index.d.ts +47 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +41 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/registry.d.ts +98 -0
- package/dist/adapters/registry.d.ts.map +1 -0
- package/dist/adapters/registry.js +106 -0
- package/dist/adapters/registry.js.map +1 -0
- package/dist/adapters/worldAdapter.d.ts +142 -0
- package/dist/adapters/worldAdapter.d.ts.map +1 -0
- package/dist/adapters/worldAdapter.js +164 -0
- package/dist/adapters/worldAdapter.js.map +1 -0
- package/dist/admin.d.ts +323 -0
- package/dist/admin.d.ts.map +1 -0
- package/dist/admin.js +198 -0
- package/dist/admin.js.map +1 -0
- package/dist/api.d.ts +1512 -4
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +820 -52
- package/dist/api.js.map +1 -1
- package/dist/audio.d.ts +33 -1
- package/dist/audio.d.ts.map +1 -1
- package/dist/audio.js +4 -1
- package/dist/audio.js.map +1 -1
- package/dist/castProjection.d.ts +35 -0
- package/dist/castProjection.d.ts.map +1 -0
- package/dist/castProjection.js +80 -0
- package/dist/castProjection.js.map +1 -0
- package/dist/conversation/binding.d.ts +77 -0
- package/dist/conversation/binding.d.ts.map +1 -0
- package/dist/conversation/binding.js +57 -0
- package/dist/conversation/binding.js.map +1 -0
- package/dist/conversation/controller.d.ts +209 -0
- package/dist/conversation/controller.d.ts.map +1 -0
- package/dist/conversation/controller.js +350 -0
- package/dist/conversation/controller.js.map +1 -0
- package/dist/conversation/effectiveModel.d.ts +62 -0
- package/dist/conversation/effectiveModel.d.ts.map +1 -0
- package/dist/conversation/effectiveModel.js +73 -0
- package/dist/conversation/effectiveModel.js.map +1 -0
- package/dist/conversation/index.d.ts +27 -0
- package/dist/conversation/index.d.ts.map +1 -0
- package/dist/conversation/index.js +27 -0
- package/dist/conversation/index.js.map +1 -0
- package/dist/conversation/participant.d.ts +66 -0
- package/dist/conversation/participant.d.ts.map +1 -0
- package/dist/conversation/participant.js +36 -0
- package/dist/conversation/participant.js.map +1 -0
- package/dist/conversation/presence.d.ts +56 -0
- package/dist/conversation/presence.d.ts.map +1 -0
- package/dist/conversation/presence.js +34 -0
- package/dist/conversation/presence.js.map +1 -0
- package/dist/conversation/presenceBus.d.ts +42 -0
- package/dist/conversation/presenceBus.d.ts.map +1 -0
- package/dist/conversation/presenceBus.js +81 -0
- package/dist/conversation/presenceBus.js.map +1 -0
- package/dist/conversation/presenceRegistry.d.ts +49 -0
- package/dist/conversation/presenceRegistry.d.ts.map +1 -0
- package/dist/conversation/presenceRegistry.js +59 -0
- package/dist/conversation/presenceRegistry.js.map +1 -0
- package/dist/conversation/roster.d.ts +72 -0
- package/dist/conversation/roster.d.ts.map +1 -0
- package/dist/conversation/roster.js +69 -0
- package/dist/conversation/roster.js.map +1 -0
- package/dist/conversation/rosterProjection.d.ts +52 -0
- package/dist/conversation/rosterProjection.d.ts.map +1 -0
- package/dist/conversation/rosterProjection.js +74 -0
- package/dist/conversation/rosterProjection.js.map +1 -0
- package/dist/conversation/router.d.ts +74 -0
- package/dist/conversation/router.d.ts.map +1 -0
- package/dist/conversation/router.js +58 -0
- package/dist/conversation/router.js.map +1 -0
- package/dist/conversation/runtime.d.ts +64 -0
- package/dist/conversation/runtime.d.ts.map +1 -0
- package/dist/conversation/runtime.js +172 -0
- package/dist/conversation/runtime.js.map +1 -0
- package/dist/conversation/types.d.ts +99 -0
- package/dist/conversation/types.d.ts.map +1 -0
- package/dist/conversation/types.js +13 -0
- package/dist/conversation/types.js.map +1 -0
- package/dist/conversation/voice.d.ts +185 -0
- package/dist/conversation/voice.d.ts.map +1 -0
- package/dist/conversation/voice.js +307 -0
- package/dist/conversation/voice.js.map +1 -0
- package/dist/graphSchema.d.ts +201 -13
- package/dist/graphSchema.d.ts.map +1 -1
- package/dist/graphSchema.js +258 -9
- package/dist/graphSchema.js.map +1 -1
- package/dist/http.d.ts +20 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +57 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/platformAssistant.d.ts +155 -0
- package/dist/platformAssistant.d.ts.map +1 -0
- package/dist/platformAssistant.js +256 -0
- package/dist/platformAssistant.js.map +1 -0
- package/dist/reactor/chunkDistribution.d.ts +43 -0
- package/dist/reactor/chunkDistribution.d.ts.map +1 -0
- package/dist/reactor/chunkDistribution.js +85 -0
- package/dist/reactor/chunkDistribution.js.map +1 -0
- package/dist/reactor/index.d.ts +2 -0
- package/dist/reactor/index.d.ts.map +1 -1
- package/dist/reactor/index.js +5 -0
- package/dist/reactor/index.js.map +1 -1
- package/dist/reactor/longLiveCommandDispatcher.d.ts +103 -0
- package/dist/reactor/longLiveCommandDispatcher.d.ts.map +1 -0
- package/dist/reactor/longLiveCommandDispatcher.js +87 -0
- package/dist/reactor/longLiveCommandDispatcher.js.map +1 -0
- package/dist/reactor/scenesFromEnrichment.d.ts.map +1 -1
- package/dist/reactor/scenesFromEnrichment.js +2 -66
- package/dist/reactor/scenesFromEnrichment.js.map +1 -1
- package/dist/reactor/seedImageOrchestrator.d.ts +6 -9
- package/dist/reactor/seedImageOrchestrator.d.ts.map +1 -1
- package/dist/reactor/seedImageOrchestrator.js +12 -13
- package/dist/reactor/seedImageOrchestrator.js.map +1 -1
- package/dist/reactor/storyTimeline.d.ts +44 -0
- package/dist/reactor/storyTimeline.d.ts.map +1 -0
- package/dist/reactor/storyTimeline.js +95 -0
- package/dist/reactor/storyTimeline.js.map +1 -0
- package/dist/storyGraph.d.ts +70 -0
- package/dist/storyGraph.d.ts.map +1 -0
- package/dist/storyGraph.js +178 -0
- package/dist/storyGraph.js.map +1 -0
- package/dist/vision/VisionSourceController.d.ts +127 -0
- package/dist/vision/VisionSourceController.d.ts.map +1 -0
- package/dist/vision/VisionSourceController.js +284 -0
- package/dist/vision/VisionSourceController.js.map +1 -0
- package/dist/vision/index.d.ts +4 -0
- package/dist/vision/index.d.ts.map +1 -1
- package/dist/vision/index.js +2 -0
- package/dist/vision/index.js.map +1 -1
- package/dist/vision/sourceKinds.d.ts +65 -0
- package/dist/vision/sourceKinds.d.ts.map +1 -0
- package/dist/vision/sourceKinds.js +26 -0
- package/dist/vision/sourceKinds.js.map +1 -0
- package/dist/websocket.d.ts +92 -0
- package/dist/websocket.d.ts.map +1 -1
- package/dist/websocket.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/adapters-capabilities.test.ts +46 -0
- package/src/__tests__/adapters-chat.test.ts +172 -0
- package/src/__tests__/adapters-director.test.ts +95 -0
- package/src/__tests__/adapters-image.test.ts +133 -0
- package/src/__tests__/adapters-platform.test.ts +95 -0
- package/src/__tests__/adapters-registry.test.ts +189 -0
- package/src/__tests__/adapters-world.test.ts +296 -0
- package/src/__tests__/admin.test.ts +312 -0
- package/src/__tests__/adventures-party.test.ts +219 -0
- package/src/__tests__/adventures.test.ts +282 -0
- package/src/__tests__/api-pollers.test.ts +4 -0
- package/src/__tests__/api.clip-lookup.test.ts +64 -0
- package/src/__tests__/api.list-images-filters.test.ts +103 -0
- package/src/__tests__/api.test.ts +553 -0
- package/src/__tests__/audio.test.ts +65 -0
- package/src/__tests__/cast.test.ts +95 -0
- package/src/__tests__/castProjection.test.ts +167 -0
- package/src/__tests__/conversation/binding.test.ts +62 -0
- package/src/__tests__/conversation/controller.test.ts +732 -0
- package/src/__tests__/conversation/effectiveModel.test.ts +169 -0
- package/src/__tests__/conversation/headlessRenderer.ts +46 -0
- package/src/__tests__/conversation/presenceBus.test.ts +236 -0
- package/src/__tests__/conversation/presenceRegistry.test.ts +73 -0
- package/src/__tests__/conversation/roster.test.ts +100 -0
- package/src/__tests__/conversation/rosterProjection.test.ts +142 -0
- package/src/__tests__/conversation/router.test.ts +81 -0
- package/src/__tests__/conversation/runtime.test.ts +206 -0
- package/src/__tests__/conversation/voice.test.ts +440 -0
- package/src/__tests__/documents.test.ts +360 -0
- package/src/__tests__/graphSchema.test.ts +218 -9
- package/src/__tests__/longLiveCommandDispatcher.test.ts +185 -0
- package/src/__tests__/monitoring.test.ts +162 -0
- package/src/__tests__/persona-generation.test.ts +352 -0
- package/src/__tests__/platformAssistant.test.ts +484 -0
- package/src/__tests__/reactor/storyTimeline.test.ts +186 -0
- package/src/__tests__/regeneration.test.ts +486 -0
- package/src/__tests__/stories.test.ts +171 -0
- package/src/__tests__/storyGraph.test.ts +134 -0
- package/src/__tests__/tools-wrappers.test.ts +272 -0
- package/src/__tests__/videoGraph.test.ts +94 -0
- package/src/__tests__/websocket.test.ts +263 -0
- package/src/adapters/capabilities.ts +24 -0
- package/src/adapters/chatAdapter.ts +114 -0
- package/src/adapters/directorAdapter.ts +126 -0
- package/src/adapters/imageAdapter.ts +100 -0
- package/src/adapters/index.ts +67 -0
- package/src/adapters/registry.ts +159 -0
- package/src/adapters/worldAdapter.ts +272 -0
- package/src/admin.ts +517 -0
- package/src/api.ts +2215 -95
- package/src/audio.ts +35 -0
- package/src/castProjection.ts +95 -0
- package/src/conversation/binding.ts +100 -0
- package/src/conversation/controller.ts +447 -0
- package/src/conversation/effectiveModel.ts +111 -0
- package/src/conversation/index.ts +27 -0
- package/src/conversation/participant.ts +71 -0
- package/src/conversation/presence.ts +60 -0
- package/src/conversation/presenceBus.ts +109 -0
- package/src/conversation/presenceRegistry.ts +83 -0
- package/src/conversation/roster.ts +111 -0
- package/src/conversation/rosterProjection.ts +98 -0
- package/src/conversation/router.ts +96 -0
- package/src/conversation/runtime.ts +188 -0
- package/src/conversation/types.ts +100 -0
- package/src/conversation/voice.ts +402 -0
- package/src/graphSchema.ts +396 -13
- package/src/http.ts +72 -0
- package/src/index.ts +9 -0
- package/src/platformAssistant.ts +347 -0
- package/src/reactor/chunkDistribution.ts +98 -0
- package/src/reactor/index.ts +5 -0
- package/src/reactor/longLiveCommandDispatcher.ts +156 -0
- package/src/reactor/scenesFromEnrichment.ts +11 -76
- package/src/reactor/seedImageOrchestrator.ts +12 -13
- package/src/reactor/storyTimeline.ts +127 -0
- package/src/storyGraph.ts +298 -0
- package/src/vision/VisionSourceController.ts +354 -0
- package/src/vision/__tests__/VisionSourceController.test.ts +719 -0
- package/src/vision/index.ts +13 -0
- package/src/vision/sourceKinds.ts +75 -0
- package/src/websocket.ts +99 -3
package/src/vision/index.ts
CHANGED
|
@@ -29,3 +29,16 @@ export type {
|
|
|
29
29
|
StartVisionPublisherOptions,
|
|
30
30
|
VisionPublisherHandle,
|
|
31
31
|
} from './startVisionPublisher';
|
|
32
|
+
export { VISION_SOURCE_KINDS } from './sourceKinds';
|
|
33
|
+
export type {
|
|
34
|
+
ElementSourceDescriptor,
|
|
35
|
+
VisionCaptureElement,
|
|
36
|
+
VisionSourceDescriptor,
|
|
37
|
+
VisionSourceKind,
|
|
38
|
+
WebcamSourceDescriptor,
|
|
39
|
+
} from './sourceKinds';
|
|
40
|
+
export { VisionSourceController } from './VisionSourceController';
|
|
41
|
+
export type {
|
|
42
|
+
VisionCredentialsClient,
|
|
43
|
+
VisionSourceControllerOptions,
|
|
44
|
+
} from './VisionSourceController';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vision source kinds + descriptors — the single source of truth for the
|
|
3
|
+
* three local vision sources a surface can point the VLM at.
|
|
4
|
+
*
|
|
5
|
+
* R3a of the Platform Experience Restructure
|
|
6
|
+
* (`specs/platform-experience-restructure-phase-R3-vision-source-picker.md`).
|
|
7
|
+
* The `VisionSourceController` consumes these; the React adapter (R3b) and
|
|
8
|
+
* the `/chat-ws` + `/watch` surfaces (R3c/R3d) pick among them. Constants
|
|
9
|
+
* over bare literals, per CLAUDE.md — consumers compare against
|
|
10
|
+
* `VISION_SOURCE_KINDS.*`, never inline strings.
|
|
11
|
+
*
|
|
12
|
+
* Cross-device vision relay is explicitly deferred: every kind here is a
|
|
13
|
+
* LOCAL source, published over the user's own chat WebSocket exactly as
|
|
14
|
+
* today.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** The three local vision source kinds, as a frozen constant object. */
|
|
18
|
+
export const VISION_SOURCE_KINDS = {
|
|
19
|
+
/** The user's camera via `navigator.mediaDevices.getUserMedia`. */
|
|
20
|
+
WEBCAM: 'webcam',
|
|
21
|
+
/** The surface's playing `<video>` element via `captureStream()`. */
|
|
22
|
+
PLAYING_VIDEO: 'playing-video',
|
|
23
|
+
/** A server-rendered world surface (e.g. the Step-Into-Video / Helios
|
|
24
|
+
* canvas) via `captureStream()`. */
|
|
25
|
+
SERVER_RENDER: 'server-render',
|
|
26
|
+
} as const;
|
|
27
|
+
|
|
28
|
+
export type VisionSourceKind =
|
|
29
|
+
(typeof VISION_SOURCE_KINDS)[keyof typeof VISION_SOURCE_KINDS];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* An element whose `captureStream()` output can feed the publisher.
|
|
33
|
+
* `HTMLVideoElement.captureStream` / `HTMLCanvasElement.captureStream`
|
|
34
|
+
* aren't in every lib.dom version, so the controller duck-checks at
|
|
35
|
+
* runtime rather than widening global types (same pattern as the watch
|
|
36
|
+
* hook this lifts).
|
|
37
|
+
*/
|
|
38
|
+
export type VisionCaptureElement = HTMLVideoElement | HTMLCanvasElement;
|
|
39
|
+
|
|
40
|
+
/** Webcam source: the controller calls `getUserMedia(constraints ?? { video: true })`. */
|
|
41
|
+
export interface WebcamSourceDescriptor {
|
|
42
|
+
kind: typeof VISION_SOURCE_KINDS.WEBCAM;
|
|
43
|
+
/** Optional getUserMedia constraints; defaults to `{ video: true }`
|
|
44
|
+
* (byte-parity with today's chat-ws webcam path). */
|
|
45
|
+
constraints?: MediaStreamConstraints;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Element-backed source (`playing-video` / `server-render`): the
|
|
50
|
+
* controller calls `element.captureStream()`. The DOM element stays a
|
|
51
|
+
* call-site concern — the descriptor carries it so the controller never
|
|
52
|
+
* queries the document.
|
|
53
|
+
*/
|
|
54
|
+
export interface ElementSourceDescriptor {
|
|
55
|
+
kind:
|
|
56
|
+
| typeof VISION_SOURCE_KINDS.PLAYING_VIDEO
|
|
57
|
+
| typeof VISION_SOURCE_KINDS.SERVER_RENDER;
|
|
58
|
+
element: VisionCaptureElement;
|
|
59
|
+
/**
|
|
60
|
+
* When true and the element is a `<video>` that hasn't decoded its
|
|
61
|
+
* first frame yet (`readyState < HAVE_CURRENT_DATA`), the controller
|
|
62
|
+
* waits for `loadeddata` before capturing — without this gate a fast
|
|
63
|
+
* toggle-on publishes a black frame (the watch-page guard, lifted
|
|
64
|
+
* verbatim). Ignored for canvas elements (no readyState).
|
|
65
|
+
*/
|
|
66
|
+
waitForFrame?: boolean;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Tagged union describing where the published track comes from, without
|
|
71
|
+
* the controller knowing about the page. Discriminate on `kind`.
|
|
72
|
+
*/
|
|
73
|
+
export type VisionSourceDescriptor =
|
|
74
|
+
| WebcamSourceDescriptor
|
|
75
|
+
| ElementSourceDescriptor;
|
package/src/websocket.ts
CHANGED
|
@@ -87,14 +87,22 @@ export interface PlaybackState {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
export type ChatWsEvent =
|
|
90
|
-
| { type: 'token'; timestamp?: number; content: string }
|
|
90
|
+
| { type: 'token'; timestamp?: number; content: string; personaId?: string }
|
|
91
91
|
| {
|
|
92
92
|
type: 'citation';
|
|
93
93
|
timestamp?: number;
|
|
94
94
|
citation: Citation;
|
|
95
95
|
span?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Active speaking persona for this frame, set ONLY by the M10 Story
|
|
98
|
+
* Engine Phase 9a multi-persona scene orchestrator (when an adventure
|
|
99
|
+
* has a non-empty party). Undefined for all other chat — the frame
|
|
100
|
+
* stays byte-identical (land-dark). Matches the additive `personaId`
|
|
101
|
+
* the `WebSocketEmitter` stamps in `api/chat/ws.py`.
|
|
102
|
+
*/
|
|
103
|
+
personaId?: string;
|
|
96
104
|
}
|
|
97
|
-
| { type: 'done'; timestamp?: number; reason?: DoneReason }
|
|
105
|
+
| { type: 'done'; timestamp?: number; reason?: DoneReason; personaId?: string }
|
|
98
106
|
| { type: 'error'; timestamp?: number; message: string }
|
|
99
107
|
| {
|
|
100
108
|
type: 'image';
|
|
@@ -103,6 +111,8 @@ export type ChatWsEvent =
|
|
|
103
111
|
entity?: string;
|
|
104
112
|
prompt?: string;
|
|
105
113
|
sourceTimestamp?: number;
|
|
114
|
+
/** See the `citation` case — orchestrator-stamped persona id (M10 9a). */
|
|
115
|
+
personaId?: string;
|
|
106
116
|
}
|
|
107
117
|
| {
|
|
108
118
|
type: 'tool_use';
|
|
@@ -143,6 +153,13 @@ export type ChatWsEvent =
|
|
|
143
153
|
chunkId?: string;
|
|
144
154
|
audio: string;
|
|
145
155
|
format: 'mp3' | 'pcm16' | 'ogg_opus';
|
|
156
|
+
/**
|
|
157
|
+
* Active speaking persona for this audio frame (M10 9a, additive). The
|
|
158
|
+
* 9a server only STAMPS this so the client can swap face/voice per turn;
|
|
159
|
+
* per-turn server-side TTS voice swap is deferred (tracked in tech-debt).
|
|
160
|
+
* Undefined for all non-orchestrated audio (land-dark).
|
|
161
|
+
*/
|
|
162
|
+
personaId?: string;
|
|
146
163
|
}
|
|
147
164
|
| {
|
|
148
165
|
type: 'metrics';
|
|
@@ -152,7 +169,48 @@ export type ChatWsEvent =
|
|
|
152
169
|
transcript_to_first_audio_ms?: number;
|
|
153
170
|
}
|
|
154
171
|
| { type: 'heartbeat'; timestamp?: number }
|
|
155
|
-
| { type: 'pong'; timestamp?: number }
|
|
172
|
+
| { type: 'pong'; timestamp?: number }
|
|
173
|
+
| {
|
|
174
|
+
/**
|
|
175
|
+
* The active speaking persona changed. Emitted by the M10 Story Engine
|
|
176
|
+
* Phase 9a multi-persona scene orchestrator whenever it hands the turn
|
|
177
|
+
* to a different persona (DM ↔ party member, or one party member to
|
|
178
|
+
* another via a `cue_persona` tool call). Carries the new `personaId`
|
|
179
|
+
* and the `previousPersonaId` it replaced (omitted/undefined for the
|
|
180
|
+
* first turn of a connection). Never emitted for non-adventure chat or
|
|
181
|
+
* M9 single-DM (empty-party) adventures — those keep the existing event
|
|
182
|
+
* set verbatim (land-dark). Mirrors `ChatEventType.TURN_CHANGED`
|
|
183
|
+
* (`"turn_changed"`) in `shared/chat_dispatcher.py`.
|
|
184
|
+
*/
|
|
185
|
+
type: 'turn_changed';
|
|
186
|
+
timestamp?: number;
|
|
187
|
+
personaId: string;
|
|
188
|
+
previousPersonaId?: string;
|
|
189
|
+
}
|
|
190
|
+
| {
|
|
191
|
+
/**
|
|
192
|
+
* Dashboard Spec A (§10A.5) — a DM-issued scene-control directive. Emitted
|
|
193
|
+
* by `ChatDispatcher.emit_dm_directive` (`shared/chat_dispatcher.py`,
|
|
194
|
+
* `ChatEventType.DM_DIRECTIVE` → wire `"dm_directive"`) at `MESSAGE_STOP`
|
|
195
|
+
* when the DM's completed turn carries a line-anchored `[SCENE:...]` tag;
|
|
196
|
+
* the tag is stripped from the streamed narration before this fires. Added
|
|
197
|
+
* as a union variant so exhaustive `switch` consumers get a typed arm
|
|
198
|
+
* (without it the `ConversationRuntime.applyFrame` default branch would
|
|
199
|
+
* stay the only path for this type). Shape mirrors {@link DmDirectiveEvent}
|
|
200
|
+
* in `api.ts` (the `directive` literals are inlined here to avoid a
|
|
201
|
+
* websocket↔api import cycle — `api.ts` already imports `Citation` from
|
|
202
|
+
* here). No existing consumer is wired (A-DM0 ships dark); the
|
|
203
|
+
* `applyFrame` default-drop stays safe for unhandled variants.
|
|
204
|
+
*/
|
|
205
|
+
type: 'dm_directive';
|
|
206
|
+
timestamp?: number;
|
|
207
|
+
directive:
|
|
208
|
+
| 'enter_world'
|
|
209
|
+
| 'exit_world'
|
|
210
|
+
| 'seek_video'
|
|
211
|
+
| 'set_experience_source';
|
|
212
|
+
params: Record<string, unknown>;
|
|
213
|
+
};
|
|
156
214
|
|
|
157
215
|
/**
|
|
158
216
|
* @deprecated Prefer {@link ChatWsEvent} — the flat-shape interface
|
|
@@ -518,6 +576,44 @@ export class ChatWebSocket {
|
|
|
518
576
|
messages?: Array<{ role: string; content: string; modelId?: string }>;
|
|
519
577
|
systemPrompt?: string;
|
|
520
578
|
systemPromptOverride?: boolean;
|
|
579
|
+
/**
|
|
580
|
+
* Entity id of the character a bound persona portrays. When set, the
|
|
581
|
+
* backend auto-scopes entity_timeline / speaker_dialog tools to this
|
|
582
|
+
* entity and appends a "you are portraying X" suffix. Omit (undefined)
|
|
583
|
+
* for unbound personas — the wire stays unchanged for them (land-dark).
|
|
584
|
+
* Frontend-resolved, same as `systemPrompt`. Matches
|
|
585
|
+
* `SendActionMessage.entityId` in `shared/websocket_models.py`.
|
|
586
|
+
*/
|
|
587
|
+
entityId?: string;
|
|
588
|
+
/**
|
|
589
|
+
* Persona id the chat memory plane is namespaced to (M8 Memory Plane
|
|
590
|
+
* Phase D). Independent of `entityId`: when set, the backend scopes memory
|
|
591
|
+
* recall/store to this persona so two personas accumulate distinct memory.
|
|
592
|
+
* Omit (undefined) for general chat / no active persona — recall stays
|
|
593
|
+
* user-scoped (land-dark). Matches `SendActionMessage.personaId` in
|
|
594
|
+
* `shared/websocket_models.py`.
|
|
595
|
+
*/
|
|
596
|
+
personaId?: string;
|
|
597
|
+
/**
|
|
598
|
+
* Adventure session id the chat turn is running inside (M9 Adventure
|
|
599
|
+
* Runtime Phase 8a). When set, the backend exposes the Dungeon-Master
|
|
600
|
+
* tool surface and threads the active adventure's state into the system
|
|
601
|
+
* prompt so the persona drives the story. Omit (undefined) for ordinary
|
|
602
|
+
* chat — the wire stays unchanged (land-dark). Matches
|
|
603
|
+
* `SendActionMessage.adventureSessionId` in `shared/websocket_models.py`.
|
|
604
|
+
*/
|
|
605
|
+
adventureSessionId?: string;
|
|
606
|
+
/**
|
|
607
|
+
* Party persona ids for a multi-persona adventure (M10 Story Engine
|
|
608
|
+
* Phase 9a). Advisory / forward-compat only — the server's
|
|
609
|
+
* `AdventureState.party_persona_ids` is authoritative for scene
|
|
610
|
+
* routing; the orchestrator loads the roster from `AdventureState`,
|
|
611
|
+
* not from this field. Omit / leave empty for ordinary chat and M9
|
|
612
|
+
* single-DM (empty-party) adventures — the wire stays unchanged
|
|
613
|
+
* (land-dark). Matches `SendActionMessage.partyPersonaIds` in
|
|
614
|
+
* `shared/websocket_models.py`.
|
|
615
|
+
*/
|
|
616
|
+
partyPersonaIds?: string[];
|
|
521
617
|
heartbeatInterval?: number;
|
|
522
618
|
idleTimeout?: number;
|
|
523
619
|
}
|