@escapeaihq/client-core 0.49.0 → 0.52.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 (46) hide show
  1. package/README.md +4 -4
  2. package/dist/adapters/worldAdapter.js +1 -1
  3. package/dist/conversation/binding.d.ts +28 -1
  4. package/dist/conversation/binding.d.ts.map +1 -1
  5. package/dist/conversation/binding.js +12 -0
  6. package/dist/conversation/binding.js.map +1 -1
  7. package/dist/conversation/controller.d.ts +16 -0
  8. package/dist/conversation/controller.d.ts.map +1 -1
  9. package/dist/conversation/controller.js +22 -0
  10. package/dist/conversation/controller.js.map +1 -1
  11. package/dist/index.d.ts +4 -4
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +10 -4
  14. package/dist/index.js.map +1 -1
  15. package/dist/reactor/dmSceneControlPrompt.d.ts +40 -0
  16. package/dist/reactor/dmSceneControlPrompt.d.ts.map +1 -0
  17. package/dist/reactor/dmSceneControlPrompt.js +83 -0
  18. package/dist/reactor/dmSceneControlPrompt.js.map +1 -0
  19. package/dist/reactor/index.d.ts +1 -0
  20. package/dist/reactor/index.d.ts.map +1 -1
  21. package/dist/reactor/index.js +3 -0
  22. package/dist/reactor/index.js.map +1 -1
  23. package/dist/reactor/promptAddonRegistry.js +2 -2
  24. package/dist/reactor/promptAddonRegistry.js.map +1 -1
  25. package/dist/reactor/toolPromptAddon.d.ts +37 -28
  26. package/dist/reactor/toolPromptAddon.d.ts.map +1 -1
  27. package/dist/reactor/toolPromptAddon.js +48 -100
  28. package/dist/reactor/toolPromptAddon.js.map +1 -1
  29. package/dist/websocket.d.ts +119 -2
  30. package/dist/websocket.d.ts.map +1 -1
  31. package/dist/websocket.js +73 -0
  32. package/dist/websocket.js.map +1 -1
  33. package/package.json +1 -1
  34. package/src/__tests__/conversation/binding.test.ts +53 -0
  35. package/src/__tests__/conversation/controller.test.ts +117 -0
  36. package/src/__tests__/reactor/promptAddonRegistry.test.ts +3 -1
  37. package/src/__tests__/reactor/toolPromptAddon.test.ts +34 -42
  38. package/src/__tests__/websocket-session-attach.test.ts +288 -0
  39. package/src/conversation/binding.ts +40 -1
  40. package/src/conversation/controller.ts +39 -0
  41. package/src/index.ts +10 -4
  42. package/src/reactor/dmSceneControlPrompt.ts +85 -0
  43. package/src/reactor/index.ts +3 -0
  44. package/src/reactor/promptAddonRegistry.ts +2 -2
  45. package/src/reactor/toolPromptAddon.ts +51 -101
  46. package/src/websocket.ts +186 -2
@@ -12,6 +12,9 @@ export * from './scenesFromEnrichment.js';
12
12
  // (imported by both mappers); they are deliberately NOT re-exported here.
13
13
  export * from './storyTimeline.js';
14
14
  export * from './heliosTools.js';
15
+ // A-DM2 — canonical [SCENE:...] scene-control vocabulary (single source; the
16
+ // retired-`[SET_SCENE]`-prose replacement, tech-debt #113).
17
+ export * from './dmSceneControlPrompt.js';
15
18
  export * from './toolPromptAddon.js';
16
19
  export * from './entitySearch.js';
17
20
  export * from './heliosCommandDispatcher.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/reactor/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,+EAA+E;AAC/E,+EAA+E;AAC/E,0EAA0E;AAC1E,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/reactor/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,+EAA+E;AAC/E,+EAA+E;AAC/E,0EAA0E;AAC1E,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,6EAA6E;AAC7E,4DAA4D;AAC5D,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC"}
@@ -26,8 +26,8 @@ import { HELIOS_WORLD_STEERING_ADDON_ID } from './toolPromptAddonId.js';
26
26
  export const KNOWN_PROMPT_ADDONS = [
27
27
  {
28
28
  id: HELIOS_WORLD_STEERING_ADDON_ID,
29
- label: 'Helios world steering',
30
- description: 'Lets this persona drive a live Helios scene from the /interactive/chat page by emitting inline scene-change markers ([SET_SCENE], [SWAP_SEED], etc.). Auto-enabled when the persona is bound to a source video or character image.',
29
+ label: 'Scene control',
30
+ description: 'Lets this persona drive the viewer’s experience surface with scene-control tags ([SCENE:enter_world], [SCENE:seek_video], [SCENE:exit_world]) — transport into the world model, seek the video, or return to it. Auto-enabled when the persona is bound to a source video or character image.',
31
31
  },
32
32
  ];
33
33
  /** Look up a descriptor by ID. Returns `undefined` for unknown IDs —
@@ -1 +1 @@
1
- {"version":3,"file":"promptAddonRegistry.js","sourceRoot":"","sources":["../../src/reactor/promptAddonRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAWrE,MAAM,CAAC,MAAM,mBAAmB,GAAqC;IACnE;QACE,EAAE,EAAE,8BAA8B;QAClC,KAAK,EAAE,uBAAuB;QAC9B,WAAW,EACT,oOAAoO;KACvO;CACF,CAAC;AAEF;4DAC4D;AAC5D,MAAM,UAAU,wBAAwB,CACtC,EAAU;IAEV,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AACpD,CAAC"}
1
+ {"version":3,"file":"promptAddonRegistry.js","sourceRoot":"","sources":["../../src/reactor/promptAddonRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAWrE,MAAM,CAAC,MAAM,mBAAmB,GAAqC;IACnE;QACE,EAAE,EAAE,8BAA8B;QAClC,KAAK,EAAE,eAAe;QACtB,WAAW,EACT,+RAA+R;KAClS;CACF,CAAC;AAEF;4DAC4D;AAC5D,MAAM,UAAU,wBAAwB,CACtC,EAAU;IAEV,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AACpD,CAAC"}
@@ -1,44 +1,53 @@
1
1
  /**
2
- * System-prompt addon that teaches a chat model to emit Helios
3
- * world-steering markers.
2
+ * System-prompt addon that teaches a chat model to drive the viewer's
3
+ * experience surface with scene-control tags.
4
4
  *
5
- * Phase 3 hooks this addon up via `PersonaConfig.prompt_addon_ids`: when
6
- * a persona declares `prompt_addon_ids: ['helios-world-steering']`, the
7
- * browser-side `/interactive/chat` page looks up the addon text via
8
- * `getHeliosSteeringAddonText()` and concatenates it onto the persona's
9
- * `custom_system_prompt` before sending each chat turn via the WS
10
- * `systemPrompt` field.
5
+ * A-DM2 RETIREMENT (tech-debt #113): this addon used to teach a SECOND,
6
+ * divergent world-steering vocabulary — the legacy `[SET_SCENE]` / `[SWAP_SEED]`
7
+ * / `[PAUSE_WORLD]` marker prose (the Phase-3 Helios prototype, whose only live
8
+ * web consumer `/interactive/chat` was removed in R0-4). That duplicate steering
9
+ * text is GONE. `getHeliosSteeringAddonText()` now delegates to the single
10
+ * canonical scene-control vocabulary in `dmSceneControlPrompt.ts` (the
11
+ * `[SCENE:...]` grammar that mirrors the backend
12
+ * `shared/adventure_prompts.py::DM_SCENE_CONTROL_INSTRUCTIONS` and is parsed by
13
+ * the dispatcher's `DM_SCENE_TAG_PATTERN`). There is now exactly ONE place that
14
+ * teaches a model how to steer the scene.
11
15
  *
12
- * The backend has no awareness of the addon ID's semantics — the field
13
- * is just metadata on `PersonaConfig`. See
14
- * `shared/persona_addon_ids.py` for the matching Python constant.
16
+ * The function name + the addon id (`helios-world-steering`) are kept for
17
+ * backward compatibility — `PersonaConfig.prompt_addon_ids` rows, the persona
18
+ * UI, and the pinned `../Web-App` consumer all reference them. Only the TEXT the
19
+ * addon produces changed (now the current `[SCENE:...]` vocabulary).
20
+ *
21
+ * The backend has no awareness of the addon ID's semantics — the field is just
22
+ * metadata on `PersonaConfig`. See `shared/persona_addon_ids.py` for the matching
23
+ * Python constant.
15
24
  */
16
25
  export { HELIOS_WORLD_STEERING_ADDON_ID } from './toolPromptAddonId';
17
26
  /**
18
- * Stable, model-friendly addon text that teaches the marker grammar
19
- * and the rules around when to emit each marker. Kept as a function
20
- * (not a const) so callers don't accidentally share-and-mutate the
27
+ * Stable, model-friendly addon text that teaches the scene-control grammar.
28
+ *
29
+ * RETIRED: the legacy `[SET_SCENE]` marker prose. RETURNS: the single canonical
30
+ * `[SCENE:...]` scene-control vocabulary (`getDmSceneControlPromptText`). Kept as
31
+ * a function (not a const) so callers don't accidentally share-and-mutate the
21
32
  * underlying string.
22
33
  *
23
- * Update the version sentinel inside the function if the addon
24
- * semantics change in a way the model needs to relearn — `prompt_addon_ids`
25
- * is a stable identifier, but cached upstream chat history may have
26
- * trained the model against the OLD prose. The sentinel doubles as a
27
- * "did the LLM see the new version?" diagnostic.
34
+ * @deprecated Prefer {@link getDmSceneControlPromptText} directly — this alias
35
+ * is retained only so existing `helios-world-steering` callers keep working; it
36
+ * now returns the same canonical scene-control text.
28
37
  */
29
38
  export declare function getHeliosSteeringAddonText(): string;
30
39
  /**
31
- * Concatenate the Helios steering addon onto an arbitrary base system
32
- * prompt. Idempotent: a prompt that already contains the addon sentinel
33
- * is returned unchanged.
40
+ * Concatenate the scene-control addon onto an arbitrary base system prompt.
41
+ * Idempotent: a prompt that already contains the addon sentinel is returned
42
+ * unchanged.
34
43
  *
35
- * An empty base prompt is allowed — the addon stands on its own and
36
- * works without a persona backstory (the test suite covers this).
44
+ * An empty base prompt is allowed — the addon stands on its own and works
45
+ * without a persona backstory (the test suite covers this).
37
46
  *
38
- * @param baseSystemPrompt - persona's `custom_system_prompt` (may be
39
- * empty string or whitespace).
40
- * @returns concatenated prompt: `<base>\n\n<addon>` when the base is
41
- * non-empty, just `<addon>` otherwise.
47
+ * @param baseSystemPrompt - persona's `custom_system_prompt` (may be empty
48
+ * string or whitespace).
49
+ * @returns concatenated prompt: `<base>\n\n<addon>` when the base is non-empty,
50
+ * just `<addon>` otherwise.
42
51
  */
43
52
  export declare function buildHeliosSteeringSystemPrompt(baseSystemPrompt: string): string;
44
53
  //# sourceMappingURL=toolPromptAddon.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolPromptAddon.d.ts","sourceRoot":"","sources":["../../src/reactor/toolPromptAddon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAYrE;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,IAAI,MAAM,CAmEnD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,+BAA+B,CAC7C,gBAAgB,EAAE,MAAM,GACvB,MAAM,CAQR"}
1
+ {"version":3,"file":"toolPromptAddon.d.ts","sourceRoot":"","sources":["../../src/reactor/toolPromptAddon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAOH,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAerE;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,IAAI,MAAM,CAEnD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,+BAA+B,CAC7C,gBAAgB,EAAE,MAAM,GACvB,MAAM,CAQR"}
@@ -1,120 +1,68 @@
1
1
  /**
2
- * System-prompt addon that teaches a chat model to emit Helios
3
- * world-steering markers.
2
+ * System-prompt addon that teaches a chat model to drive the viewer's
3
+ * experience surface with scene-control tags.
4
4
  *
5
- * Phase 3 hooks this addon up via `PersonaConfig.prompt_addon_ids`: when
6
- * a persona declares `prompt_addon_ids: ['helios-world-steering']`, the
7
- * browser-side `/interactive/chat` page looks up the addon text via
8
- * `getHeliosSteeringAddonText()` and concatenates it onto the persona's
9
- * `custom_system_prompt` before sending each chat turn via the WS
10
- * `systemPrompt` field.
5
+ * A-DM2 RETIREMENT (tech-debt #113): this addon used to teach a SECOND,
6
+ * divergent world-steering vocabulary — the legacy `[SET_SCENE]` / `[SWAP_SEED]`
7
+ * / `[PAUSE_WORLD]` marker prose (the Phase-3 Helios prototype, whose only live
8
+ * web consumer `/interactive/chat` was removed in R0-4). That duplicate steering
9
+ * text is GONE. `getHeliosSteeringAddonText()` now delegates to the single
10
+ * canonical scene-control vocabulary in `dmSceneControlPrompt.ts` (the
11
+ * `[SCENE:...]` grammar that mirrors the backend
12
+ * `shared/adventure_prompts.py::DM_SCENE_CONTROL_INSTRUCTIONS` and is parsed by
13
+ * the dispatcher's `DM_SCENE_TAG_PATTERN`). There is now exactly ONE place that
14
+ * teaches a model how to steer the scene.
11
15
  *
12
- * The backend has no awareness of the addon ID's semantics — the field
13
- * is just metadata on `PersonaConfig`. See
14
- * `shared/persona_addon_ids.py` for the matching Python constant.
16
+ * The function name + the addon id (`helios-world-steering`) are kept for
17
+ * backward compatibility — `PersonaConfig.prompt_addon_ids` rows, the persona
18
+ * UI, and the pinned `../Web-App` consumer all reference them. Only the TEXT the
19
+ * addon produces changed (now the current `[SCENE:...]` vocabulary).
20
+ *
21
+ * The backend has no awareness of the addon ID's semantics — the field is just
22
+ * metadata on `PersonaConfig`. See `shared/persona_addon_ids.py` for the matching
23
+ * Python constant.
15
24
  */
25
+ import { DM_SCENE_CONTROL_ADDON_SENTINEL, getDmSceneControlPromptText, } from './dmSceneControlPrompt.js';
16
26
  export { HELIOS_WORLD_STEERING_ADDON_ID } from './toolPromptAddonId.js';
27
+ // NOTE: the canonical `getDmSceneControlPromptText` + `DM_SCENE_CONTROL_ADDON_SENTINEL`
28
+ // are exported once from the barrel via `export * from './dmSceneControlPrompt.js'`
29
+ // (reactor/index.ts) — not re-exported here, to avoid an ambiguous double export.
17
30
  /**
18
31
  * Marker the addon uses to verify idempotent reapplication. The build
19
- * function looks for this string in the base prompt before appending,
20
- * so calling `buildHeliosSteeringSystemPrompt(buildHeliosSteeringSystemPrompt(p))`
21
- * returns the same value as a single application. Choose something
22
- * unique enough that a normal persona prompt would never include it
23
- * verbatim.
32
+ * function looks for this string in the base prompt before appending, so calling
33
+ * `buildHeliosSteeringSystemPrompt(buildHeliosSteeringSystemPrompt(p))` returns
34
+ * the same value as a single application. Single-sourced from the canonical
35
+ * scene-control module (bumped to `v2` for the retired-prose migration) so the
36
+ * sentinel can't drift from the text it guards.
24
37
  */
25
- const ADDON_SENTINEL = '<!-- helios-world-steering-addon:v1 -->';
38
+ const ADDON_SENTINEL = DM_SCENE_CONTROL_ADDON_SENTINEL;
26
39
  /**
27
- * Stable, model-friendly addon text that teaches the marker grammar
28
- * and the rules around when to emit each marker. Kept as a function
29
- * (not a const) so callers don't accidentally share-and-mutate the
40
+ * Stable, model-friendly addon text that teaches the scene-control grammar.
41
+ *
42
+ * RETIRED: the legacy `[SET_SCENE]` marker prose. RETURNS: the single canonical
43
+ * `[SCENE:...]` scene-control vocabulary (`getDmSceneControlPromptText`). Kept as
44
+ * a function (not a const) so callers don't accidentally share-and-mutate the
30
45
  * underlying string.
31
46
  *
32
- * Update the version sentinel inside the function if the addon
33
- * semantics change in a way the model needs to relearn — `prompt_addon_ids`
34
- * is a stable identifier, but cached upstream chat history may have
35
- * trained the model against the OLD prose. The sentinel doubles as a
36
- * "did the LLM see the new version?" diagnostic.
47
+ * @deprecated Prefer {@link getDmSceneControlPromptText} directly — this alias
48
+ * is retained only so existing `helios-world-steering` callers keep working; it
49
+ * now returns the same canonical scene-control text.
37
50
  */
38
51
  export function getHeliosSteeringAddonText() {
39
- return [
40
- ADDON_SENTINEL,
41
- '## World Steering Capability',
42
- '',
43
- 'This conversation is running alongside a live Helios video stream that ' +
44
- "you can steer directly. When the user asks you to change the visible " +
45
- 'world — scene changes, atmospheric shifts, character swaps, pausing, ' +
46
- 'resetting — emit ONE of the following bracket-style markers at the ' +
47
- 'VERY END of your response, after your natural-language reply.',
48
- '',
49
- '### Markers',
50
- '',
51
- '- `[SET_SCENE: "<80-120 word Helios-quality scene prompt>"]` — change ' +
52
- 'the live world to a new scene. The prompt MUST follow the Helios ' +
53
- "prompt-guide style: name the subject, the environment, the lighting, " +
54
- 'the camera framing (wide / medium / medium close-up / close-up), and ' +
55
- 'the mood. Target 80-120 words. Example argument: "wide cinematic ' +
56
- 'shot, a man in a red coat walks across a snowy bridge at dusk, soft ' +
57
- "golden hour light streaming through wrought-iron railings, medium " +
58
- 'tracking shot following him from the right, his breath visible in the ' +
59
- 'cold air, distant city lights glowing behind him, mood: contemplative ' +
60
- 'and quietly hopeful, 35mm film grain, cinematic depth of field."',
61
- '- `[SWAP_SEED: "<entity name>"]` — replace the active seed image ' +
62
- 'with a different entity from the current video. The entity name must ' +
63
- 'match one of the entities the user has shown you (matching is ' +
64
- "case-insensitive). If you're not sure of the name, don't emit this " +
65
- 'marker — ask the user to clarify instead.',
66
- '- `[PAUSE_WORLD]` — pause the live stream at the current frame. Use ' +
67
- 'when the user wants to freeze the action.',
68
- '- `[RESUME_WORLD]` — resume a paused stream.',
69
- '- `[RESET_WORLD]` — reset the stream to frame 0 and clear pending ' +
70
- 'prompts. Use only when the user explicitly asks to start over.',
71
- '',
72
- '### Critical Rules',
73
- '',
74
- '1. Emit AT MOST ONE marker per turn. If the user asks for a sequence ' +
75
- '(e.g. "pause then change the scene"), pick the first action and tell ' +
76
- 'them you\'ll do the next one when they ask.',
77
- '2. Markers go at the END of your response, after a blank line, never ' +
78
- 'mixed into the middle of prose.',
79
- '3. SET_SCENE prompts must be detailed and ground in the established ' +
80
- 'world. Bland three-word prompts produce bland output.',
81
- '4. For SET_SCENE, weave the existing entity / character continuity into ' +
82
- "the prompt so identity is preserved across the cut. Don't invent a " +
83
- 'brand-new protagonist mid-scene unless the user explicitly asks for ' +
84
- 'one.',
85
- '5. If the user asks something you can answer in words alone — describe ' +
86
- "the world, recall a past moment, plan a beat — DON'T emit a marker. " +
87
- 'Markers are for actions, not exposition.',
88
- '',
89
- '### Example',
90
- '',
91
- 'User: "Make it start raining and feel a bit lonelier."',
92
- '',
93
- 'Assistant: Pulling the warmth out of the light and adding a slow grey ' +
94
- 'rain — give it a beat to settle in.',
95
- '',
96
- '[SET_SCENE: "wide cinematic shot, a man in a long coat stands alone on ' +
97
- 'a deserted cobblestone bridge in a slow grey downpour, single sodium ' +
98
- "streetlamp casting a cone of amber light onto wet stone, distant city " +
99
- 'reflections rippling in puddles, medium tracking shot pulling back ' +
100
- 'slightly, his breath fogging in the cold air, mood: melancholy and ' +
101
- 'introspective, 35mm film grain, shallow depth of field, muted blue and ' +
102
- 'amber color palette, soft falling rain catching the lamp light."]',
103
- '',
104
- ].join('\n');
52
+ return getDmSceneControlPromptText();
105
53
  }
106
54
  /**
107
- * Concatenate the Helios steering addon onto an arbitrary base system
108
- * prompt. Idempotent: a prompt that already contains the addon sentinel
109
- * is returned unchanged.
55
+ * Concatenate the scene-control addon onto an arbitrary base system prompt.
56
+ * Idempotent: a prompt that already contains the addon sentinel is returned
57
+ * unchanged.
110
58
  *
111
- * An empty base prompt is allowed — the addon stands on its own and
112
- * works without a persona backstory (the test suite covers this).
59
+ * An empty base prompt is allowed — the addon stands on its own and works
60
+ * without a persona backstory (the test suite covers this).
113
61
  *
114
- * @param baseSystemPrompt - persona's `custom_system_prompt` (may be
115
- * empty string or whitespace).
116
- * @returns concatenated prompt: `<base>\n\n<addon>` when the base is
117
- * non-empty, just `<addon>` otherwise.
62
+ * @param baseSystemPrompt - persona's `custom_system_prompt` (may be empty
63
+ * string or whitespace).
64
+ * @returns concatenated prompt: `<base>\n\n<addon>` when the base is non-empty,
65
+ * just `<addon>` otherwise.
118
66
  */
119
67
  export function buildHeliosSteeringSystemPrompt(baseSystemPrompt) {
120
68
  if (baseSystemPrompt && baseSystemPrompt.includes(ADDON_SENTINEL)) {
@@ -1 +1 @@
1
- {"version":3,"file":"toolPromptAddon.js","sourceRoot":"","sources":["../../src/reactor/toolPromptAddon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAErE;;;;;;;GAOG;AACH,MAAM,cAAc,GAAG,yCAAyC,CAAC;AAEjE;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,0BAA0B;IACxC,OAAO;QACL,cAAc;QACd,8BAA8B;QAC9B,EAAE;QACF,yEAAyE;YACvE,uEAAuE;YACvE,uEAAuE;YACvE,qEAAqE;YACrE,+DAA+D;QACjE,EAAE;QACF,aAAa;QACb,EAAE;QACF,wEAAwE;YACtE,mEAAmE;YACnE,uEAAuE;YACvE,uEAAuE;YACvE,mEAAmE;YACnE,sEAAsE;YACtE,oEAAoE;YACpE,wEAAwE;YACxE,wEAAwE;YACxE,kEAAkE;QACpE,mEAAmE;YACjE,uEAAuE;YACvE,gEAAgE;YAChE,qEAAqE;YACrE,2CAA2C;QAC7C,sEAAsE;YACpE,2CAA2C;QAC7C,8CAA8C;QAC9C,oEAAoE;YAClE,gEAAgE;QAClE,EAAE;QACF,oBAAoB;QACpB,EAAE;QACF,uEAAuE;YACrE,uEAAuE;YACvE,6CAA6C;QAC/C,uEAAuE;YACrE,iCAAiC;QACnC,sEAAsE;YACpE,uDAAuD;QACzD,0EAA0E;YACxE,qEAAqE;YACrE,sEAAsE;YACtE,MAAM;QACR,yEAAyE;YACvE,sEAAsE;YACtE,0CAA0C;QAC5C,EAAE;QACF,aAAa;QACb,EAAE;QACF,wDAAwD;QACxD,EAAE;QACF,wEAAwE;YACtE,qCAAqC;QACvC,EAAE;QACF,yEAAyE;YACvE,uEAAuE;YACvE,wEAAwE;YACxE,qEAAqE;YACrE,qEAAqE;YACrE,yEAAyE;YACzE,mEAAmE;QACrE,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,+BAA+B,CAC7C,gBAAwB;IAExB,IAAI,gBAAgB,IAAI,gBAAgB,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QAClE,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IACD,MAAM,KAAK,GAAG,0BAA0B,EAAE,CAAC;IAC3C,MAAM,OAAO,GAAG,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAChD,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAC3B,OAAO,GAAG,OAAO,OAAO,KAAK,EAAE,CAAC;AAClC,CAAC"}
1
+ {"version":3,"file":"toolPromptAddon.js","sourceRoot":"","sources":["../../src/reactor/toolPromptAddon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EACL,+BAA+B,EAC/B,2BAA2B,GAC5B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AACrE,wFAAwF;AACxF,iFAAiF;AACjF,kFAAkF;AAElF;;;;;;;GAOG;AACH,MAAM,cAAc,GAAG,+BAA+B,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,0BAA0B;IACxC,OAAO,2BAA2B,EAAE,CAAC;AACvC,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,+BAA+B,CAC7C,gBAAwB;IAExB,IAAI,gBAAgB,IAAI,gBAAgB,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QAClE,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IACD,MAAM,KAAK,GAAG,0BAA0B,EAAE,CAAC;IAC3C,MAAM,OAAO,GAAG,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAChD,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAC3B,OAAO,GAAG,OAAO,OAAO,KAAK,EAAE,CAAC;AAClC,CAAC"}
@@ -76,6 +76,29 @@ export interface PlaybackState {
76
76
  shotId?: string;
77
77
  paused: boolean;
78
78
  }
79
+ /**
80
+ * The anchored playback state replayed in a `session_attached` ack (B5,
81
+ * Dashboard Redesign §10). Read server-side from the EXISTING
82
+ * `PlaybackStateStore` row (`(userId, videoId)`) and replayed verbatim to a
83
+ * newly-attaching connection so a chat opened on one device picks up where
84
+ * another device left the playhead (cross-device hand-off, owner decision D6).
85
+ *
86
+ * Camel-case mirrors the dict `api/chat/ws.py::_handle_session_attach` builds
87
+ * (`anchoredState`): `current_time → currentTime`, `experience_source →
88
+ * experienceSource`, etc. Omitted from the ack entirely when the store has no
89
+ * fresh row yet — the attach is still confirmed, the field is just `undefined`.
90
+ */
91
+ export interface SessionAnchoredState {
92
+ currentTime: number;
93
+ /** `null` on the wire when the last publish carried no shot id. */
94
+ shotId?: string | null;
95
+ paused: boolean;
96
+ /** The active experience source (`video` / `world` / `generated`); `null`
97
+ * for a legacy frame published before A10 added the field. */
98
+ experienceSource?: string | null;
99
+ /** Server epoch-seconds the row was last written. */
100
+ updatedAt?: number;
101
+ }
79
102
  export type ChatWsEvent = {
80
103
  type: 'token';
81
104
  timestamp?: number;
@@ -199,6 +222,45 @@ export type ChatWsEvent = {
199
222
  timestamp?: number;
200
223
  directive: 'enter_world' | 'exit_world' | 'seek_video' | 'set_experience_source';
201
224
  params: Record<string, unknown>;
225
+ } | {
226
+ /**
227
+ * Dashboard Spec B (§10 / B5) — acknowledgement that this connection
228
+ * joined a SERVER-ANCHORED chat session (it sent `session_attach`).
229
+ * Emitted by `api/chat/ws.py::_handle_session_attach` (wire type
230
+ * `"session_attached"`, single-sourced in
231
+ * `SESSION_ATTACHED_EVENT_TYPE`). Carries the OTHER connection ids
232
+ * already present on the anchor (`peers`) and — when the existing
233
+ * `PlaybackStateStore` had a fresh row — the `anchoredState` the other
234
+ * device left behind (the cross-device hand-off playhead). Added as a
235
+ * union variant so exhaustive consumers get a typed arm; no live
236
+ * consumer is wired until the floater handles it. Land-dark: a client
237
+ * that never sends `session_attach` never receives this.
238
+ */
239
+ type: 'session_attached';
240
+ timestamp?: number;
241
+ videoId: string;
242
+ connectionId: string;
243
+ peers: string[];
244
+ anchoredState?: SessionAnchoredState;
245
+ } | {
246
+ /**
247
+ * Dashboard Spec B (§10 / B5) — presence fan-out: another tab/device
248
+ * just `attached` to (or `detached` from) the SAME server-anchored
249
+ * session. Emitted by `_handle_session_attach` / `_detach_session`
250
+ * (wire type `"presence"`, `event` ∈ {`attached`,`detached`} —
251
+ * single-sourced in `PRESENCE_EVENT_TYPE` / `PRESENCE_ATTACHED` /
252
+ * `PRESENCE_DETACHED`). The originator is excluded from its own
253
+ * `attached` fan-out (it learns the peer list from the ack instead).
254
+ * `videoId` is present on `attached`, omitted on `detached` (the
255
+ * survivor already knows the anchor). Added as a union variant so the
256
+ * floater can render a lightweight presence indicator; absence of peers
257
+ * means it never fires (byte-identical to a no-peer floater).
258
+ */
259
+ type: 'presence';
260
+ timestamp?: number;
261
+ event: 'attached' | 'detached';
262
+ connectionId: string;
263
+ videoId?: string;
202
264
  };
203
265
  /**
204
266
  * @deprecated Prefer {@link ChatWsEvent} — the flat-shape interface
@@ -262,7 +324,7 @@ export type BinaryHandler = (data: ArrayBuffer) => void;
262
324
  *
263
325
  * Spec: `specs/2026-05-22-phase-2-multimodal-watch.md`.
264
326
  */
265
- export type ChatWsTypedEvent = 'vision_answer' | 'vision_ice' | 'vision_status';
327
+ export type ChatWsTypedEvent = 'vision_answer' | 'vision_ice' | 'vision_status' | 'session_attached' | 'presence';
266
328
  /** Inbound `vision_answer` payload from the backend after it processes
267
329
  * the publisher's offer. */
268
330
  export interface VisionAnswerEvent {
@@ -287,7 +349,30 @@ export interface VisionStatusEvent {
287
349
  bufferedFrames: number;
288
350
  processingPaused: boolean;
289
351
  }
290
- export type ChatWsTypedEventPayload<E extends ChatWsTypedEvent> = E extends 'vision_answer' ? VisionAnswerEvent : E extends 'vision_ice' ? VisionIceEvent : E extends 'vision_status' ? VisionStatusEvent : never;
352
+ /**
353
+ * Inbound `session_attached` ack payload (B5). Mirrors the
354
+ * {@link ChatWsEvent} `session_attached` variant — the SAME shape the server
355
+ * sends (camel-case on the wire already), surfaced to typed `on()` listeners
356
+ * so the floater can replay the anchored playhead + seed the peer list.
357
+ */
358
+ export interface SessionAttachedEvent {
359
+ type: 'session_attached';
360
+ videoId: string;
361
+ connectionId: string;
362
+ peers: string[];
363
+ anchoredState?: SessionAnchoredState;
364
+ }
365
+ /**
366
+ * Inbound `presence` payload (B5) — a peer tab/device `attached`/`detached`.
367
+ * Mirrors the {@link ChatWsEvent} `presence` variant; camel-case on the wire.
368
+ */
369
+ export interface PresenceEvent {
370
+ type: 'presence';
371
+ event: 'attached' | 'detached';
372
+ connectionId: string;
373
+ videoId?: string;
374
+ }
375
+ export type ChatWsTypedEventPayload<E extends ChatWsTypedEvent> = E extends 'vision_answer' ? VisionAnswerEvent : E extends 'vision_ice' ? VisionIceEvent : E extends 'vision_status' ? VisionStatusEvent : E extends 'session_attached' ? SessionAttachedEvent : E extends 'presence' ? PresenceEvent : never;
291
376
  export type TypedEventHandler<E extends ChatWsTypedEvent = ChatWsTypedEvent> = (payload: ChatWsTypedEventPayload<E>) => void | Promise<void>;
292
377
  export interface ChatWebSocketOptions {
293
378
  url: string;
@@ -504,6 +589,38 @@ export declare class ChatWebSocket {
504
589
  * sooner during long-lived chat sessions.
505
590
  */
506
591
  sendVisionDetach(): void;
592
+ /**
593
+ * Attach this connection to a SERVER-ANCHORED chat session (B5, Dashboard
594
+ * Redesign §10). The anchor is the `(userId, videoId)` pair — the same key
595
+ * the cross-device `PlaybackStateStore` row uses — so the server can replay
596
+ * the playhead another device left (a `session_attached` ack) and fan
597
+ * `presence` events between the user's tabs/devices (owner decision D6).
598
+ *
599
+ * Wire shape EXACTLY matches `shared/websocket_models.py::SessionAttachMessage`
600
+ * (`{ action, videoId, connectionId }`, `extra="forbid"`). `connectionId` is
601
+ * an opaque per-tab/device label the caller mints (the server treats it only
602
+ * as a fan-out name, never for auth — the row is scoped to the authenticated
603
+ * user). Fire-and-forget like the vision sends: best-effort, drops silently
604
+ * when the socket isn't OPEN (the server reconciles on the next attach /
605
+ * disconnect). Land-dark: a client that never calls this is byte-identical.
606
+ */
607
+ sendSessionAttach(payload: {
608
+ action: 'session_attach';
609
+ videoId: string;
610
+ connectionId: string;
611
+ }): void;
612
+ /**
613
+ * Leave the server-anchored session WITHOUT closing the socket (B5). Needed
614
+ * when a LONG-LIVED ADOPTED socket (the Watch surface's shared socket) rebinds
615
+ * away from its video session — e.g. the floater switches from a video
616
+ * conversation to a persona one — so the connection doesn't stay registered
617
+ * under the old `(user, video)` anchor (a stale peer for the user's other
618
+ * tabs). The backend (`api/chat/ws.py` `session_detach` action) fans a
619
+ * `detached` presence to the survivors + clears its per-connection holder.
620
+ * Fire-and-forget like the other session/vision sends; the backend also
621
+ * detaches on socket close, so a dropped detach is harmless.
622
+ */
623
+ sendSessionDetach(): void;
507
624
  /**
508
625
  * Register a typed listener for a vision-signaling event. Returns
509
626
  * void (matches the `messageHandlers` pattern); unsubscribe via
@@ -1 +1 @@
1
- {"version":3,"file":"websocket.d.ts","sourceRoot":"","sources":["../src/websocket.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,KAAK,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;IACH,SAAS,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1E;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,QAAQ,C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C,UAAU;IA4BlB;;OAEG;IACH,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,UAAU,GAAG,IAAI;IAQrD;;OAEG;IACH,IAAI,IAAI,IAAI;IAQZ;;OAEG;IACH,YAAY,IAAI,SAAS,GAAG,IAAI;IAIhC;;OAEG;IACH,SAAS,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAIxC;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAItC;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAIzC;;OAEG;IACH,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAIvC;;;OAGG;IACH,UAAU,IAAI,IAAI;IAalB;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,OAAO,CAEzB;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG"}
package/dist/websocket.js CHANGED
@@ -282,6 +282,42 @@ export class ChatWebSocket {
282
282
  sendVisionDetach() {
283
283
  this._sendVisionJson({ action: 'vision_detach' });
284
284
  }
285
+ /**
286
+ * Attach this connection to a SERVER-ANCHORED chat session (B5, Dashboard
287
+ * Redesign §10). The anchor is the `(userId, videoId)` pair — the same key
288
+ * the cross-device `PlaybackStateStore` row uses — so the server can replay
289
+ * the playhead another device left (a `session_attached` ack) and fan
290
+ * `presence` events between the user's tabs/devices (owner decision D6).
291
+ *
292
+ * Wire shape EXACTLY matches `shared/websocket_models.py::SessionAttachMessage`
293
+ * (`{ action, videoId, connectionId }`, `extra="forbid"`). `connectionId` is
294
+ * an opaque per-tab/device label the caller mints (the server treats it only
295
+ * as a fan-out name, never for auth — the row is scoped to the authenticated
296
+ * user). Fire-and-forget like the vision sends: best-effort, drops silently
297
+ * when the socket isn't OPEN (the server reconciles on the next attach /
298
+ * disconnect). Land-dark: a client that never calls this is byte-identical.
299
+ */
300
+ sendSessionAttach(payload) {
301
+ this._sendVisionJson({
302
+ action: payload.action,
303
+ videoId: payload.videoId,
304
+ connectionId: payload.connectionId,
305
+ });
306
+ }
307
+ /**
308
+ * Leave the server-anchored session WITHOUT closing the socket (B5). Needed
309
+ * when a LONG-LIVED ADOPTED socket (the Watch surface's shared socket) rebinds
310
+ * away from its video session — e.g. the floater switches from a video
311
+ * conversation to a persona one — so the connection doesn't stay registered
312
+ * under the old `(user, video)` anchor (a stale peer for the user's other
313
+ * tabs). The backend (`api/chat/ws.py` `session_detach` action) fans a
314
+ * `detached` presence to the survivors + clears its per-connection holder.
315
+ * Fire-and-forget like the other session/vision sends; the backend also
316
+ * detaches on socket close, so a dropped detach is harmless.
317
+ */
318
+ sendSessionDetach() {
319
+ this._sendVisionJson({ action: 'session_detach' });
320
+ }
285
321
  /**
286
322
  * Register a typed listener for a vision-signaling event. Returns
287
323
  * void (matches the `messageHandlers` pattern); unsubscribe via
@@ -319,6 +355,43 @@ export class ChatWebSocket {
319
355
  _dispatchVisionEvent(raw) {
320
356
  const t = raw['type'];
321
357
  const action = raw['action'];
358
+ // B5 — server-anchored session presence. These inbound events are already
359
+ // camel-case on the wire (the server builds the dict in camelCase), so we
360
+ // pass the fields through to typed listeners after a defensive coerce. The
361
+ // raw event ALSO flows on through `messageHandlers` as a `WebSocketMessage`
362
+ // (the caller in `onmessage`), so a `ChatWsEvent`-switch consumer can read
363
+ // the same frame too — same back-compat contract the vision events keep.
364
+ if (t === 'session_attached') {
365
+ const anchored = raw['anchoredState'];
366
+ const payload = {
367
+ type: 'session_attached',
368
+ videoId: String(raw['videoId'] ?? ''),
369
+ connectionId: String(raw['connectionId'] ?? ''),
370
+ peers: Array.isArray(raw['peers']) ? raw['peers'] : [],
371
+ };
372
+ if (anchored) {
373
+ payload.anchoredState = {
374
+ currentTime: Number(anchored['currentTime'] ?? 0),
375
+ shotId: anchored['shotId'] ?? null,
376
+ paused: Boolean(anchored['paused']),
377
+ experienceSource: anchored['experienceSource'] ?? null,
378
+ updatedAt: anchored['updatedAt'],
379
+ };
380
+ }
381
+ this._fireTyped('session_attached', payload);
382
+ return;
383
+ }
384
+ if (t === 'presence') {
385
+ this._fireTyped('presence', {
386
+ type: 'presence',
387
+ event: raw['event'] === 'detached' ? 'detached' : 'attached',
388
+ connectionId: String(raw['connectionId'] ?? ''),
389
+ ...(raw['videoId'] !== undefined
390
+ ? { videoId: String(raw['videoId']) }
391
+ : {}),
392
+ });
393
+ return;
394
+ }
322
395
  if (t === 'vision_answer') {
323
396
  this._fireTyped('vision_answer', {
324
397
  type: 'vision_answer',