@escapeaihq/client-core 0.6.1 → 0.8.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 +28 -3
- package/dist/api.d.ts +102 -2
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +92 -0
- package/dist/api.js.map +1 -1
- package/dist/audio.d.ts +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/reactor/entityContext.d.ts +34 -0
- package/dist/reactor/entityContext.d.ts.map +1 -0
- package/dist/reactor/entityContext.js +119 -0
- package/dist/reactor/entityContext.js.map +1 -0
- package/dist/reactor/entitySearch.d.ts +71 -0
- package/dist/reactor/entitySearch.d.ts.map +1 -0
- package/dist/reactor/entitySearch.js +93 -0
- package/dist/reactor/entitySearch.js.map +1 -0
- package/dist/reactor/heliosCommandDispatcher.d.ts +98 -0
- package/dist/reactor/heliosCommandDispatcher.d.ts.map +1 -0
- package/dist/reactor/heliosCommandDispatcher.js +181 -0
- package/dist/reactor/heliosCommandDispatcher.js.map +1 -0
- package/dist/reactor/heliosTools.d.ts +156 -0
- package/dist/reactor/heliosTools.d.ts.map +1 -0
- package/dist/reactor/heliosTools.js +241 -0
- package/dist/reactor/heliosTools.js.map +1 -0
- package/dist/reactor/index.d.ts +17 -0
- package/dist/reactor/index.d.ts.map +1 -0
- package/dist/reactor/index.js +17 -0
- package/dist/reactor/index.js.map +1 -0
- package/dist/reactor/promptAddonRegistry.d.ts +37 -0
- package/dist/reactor/promptAddonRegistry.d.ts.map +1 -0
- package/dist/reactor/promptAddonRegistry.js +38 -0
- package/dist/reactor/promptAddonRegistry.js.map +1 -0
- package/dist/reactor/regenTemplate.d.ts +23 -0
- package/dist/reactor/regenTemplate.d.ts.map +1 -0
- package/dist/reactor/regenTemplate.js +103 -0
- package/dist/reactor/regenTemplate.js.map +1 -0
- package/dist/reactor/sceneEntry.d.ts +79 -0
- package/dist/reactor/sceneEntry.d.ts.map +1 -0
- package/dist/reactor/sceneEntry.js +177 -0
- package/dist/reactor/sceneEntry.js.map +1 -0
- package/dist/reactor/scenesFromEnrichment.d.ts +67 -0
- package/dist/reactor/scenesFromEnrichment.d.ts.map +1 -0
- package/dist/reactor/scenesFromEnrichment.js +344 -0
- package/dist/reactor/scenesFromEnrichment.js.map +1 -0
- package/dist/reactor/seedImageOrchestrator.d.ts +81 -0
- package/dist/reactor/seedImageOrchestrator.d.ts.map +1 -0
- package/dist/reactor/seedImageOrchestrator.js +79 -0
- package/dist/reactor/seedImageOrchestrator.js.map +1 -0
- package/dist/reactor/toolPromptAddon.d.ts +44 -0
- package/dist/reactor/toolPromptAddon.d.ts.map +1 -0
- package/dist/reactor/toolPromptAddon.js +129 -0
- package/dist/reactor/toolPromptAddon.js.map +1 -0
- package/dist/reactor/toolPromptAddonId.d.ts +10 -0
- package/dist/reactor/toolPromptAddonId.d.ts.map +1 -0
- package/dist/reactor/toolPromptAddonId.js +10 -0
- package/dist/reactor/toolPromptAddonId.js.map +1 -0
- package/dist/reactor/types.d.ts +149 -0
- package/dist/reactor/types.d.ts.map +1 -0
- package/dist/reactor/types.js +2 -0
- package/dist/reactor/types.js.map +1 -0
- package/dist/reactor/upsamplePrompt.d.ts +30 -0
- package/dist/reactor/upsamplePrompt.d.ts.map +1 -0
- package/dist/reactor/upsamplePrompt.js +118 -0
- package/dist/reactor/upsamplePrompt.js.map +1 -0
- package/dist/timeFormat.d.ts +28 -0
- package/dist/timeFormat.d.ts.map +1 -0
- package/dist/timeFormat.js +48 -0
- package/dist/timeFormat.js.map +1 -0
- package/dist/websocket.d.ts +31 -0
- package/dist/websocket.d.ts.map +1 -1
- package/dist/websocket.js +20 -0
- package/dist/websocket.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/reactor/__snapshots__/regenTemplate.test.ts.snap +5 -0
- package/src/__tests__/reactor/__snapshots__/scenesFromEnrichment.test.ts.snap +34 -0
- package/src/__tests__/reactor/api-reactor.test.ts +253 -0
- package/src/__tests__/reactor/entityContext.test.ts +237 -0
- package/src/__tests__/reactor/entitySearch.test.ts +223 -0
- package/src/__tests__/reactor/heliosCommandDispatcher.test.ts +438 -0
- package/src/__tests__/reactor/heliosTools.test.ts +164 -0
- package/src/__tests__/reactor/promptAddonRegistry.test.ts +40 -0
- package/src/__tests__/reactor/regenTemplate.test.ts +156 -0
- package/src/__tests__/reactor/sceneEntry.test.ts +342 -0
- package/src/__tests__/reactor/scenesFromEnrichment.test.ts +760 -0
- package/src/__tests__/reactor/seedImageOrchestrator.test.ts +139 -0
- package/src/__tests__/reactor/toolPromptAddon.test.ts +104 -0
- package/src/__tests__/reactor/upsamplePrompt.test.ts +245 -0
- package/src/__tests__/timeFormat.test.ts +80 -0
- package/src/__tests__/websocket.test.ts +75 -0
- package/src/api.ts +170 -2
- package/src/index.ts +2 -0
- package/src/reactor/entityContext.ts +147 -0
- package/src/reactor/entitySearch.ts +139 -0
- package/src/reactor/heliosCommandDispatcher.ts +293 -0
- package/src/reactor/heliosTools.ts +260 -0
- package/src/reactor/index.ts +17 -0
- package/src/reactor/promptAddonRegistry.ts +52 -0
- package/src/reactor/regenTemplate.ts +142 -0
- package/src/reactor/sceneEntry.ts +267 -0
- package/src/reactor/scenesFromEnrichment.ts +393 -0
- package/src/reactor/seedImageOrchestrator.ts +132 -0
- package/src/reactor/toolPromptAddon.ts +135 -0
- package/src/reactor/toolPromptAddonId.ts +9 -0
- package/src/reactor/types.ts +158 -0
- package/src/reactor/upsamplePrompt.ts +154 -0
- package/src/timeFormat.ts +57 -0
- package/src/websocket.ts +42 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helios world-steering command vocabulary.
|
|
3
|
+
*
|
|
4
|
+
* Phase 3 ships an "inline markers" implementation: the chat model emits
|
|
5
|
+
* bracket-style commands like `[SET_SCENE: "wide cinematic shot…"]`
|
|
6
|
+
* inline in its assistant turn, and the browser intercepts them with
|
|
7
|
+
* `parseHeliosCommands()` and dispatches `reactor.sendCommand(...)` for
|
|
8
|
+
* each one. `stripHeliosCommands()` then removes the markers from the
|
|
9
|
+
* user-facing transcript so the user only sees natural-language reply
|
|
10
|
+
* text.
|
|
11
|
+
*
|
|
12
|
+
* Why markers and not real Bedrock tool-use today? `shared/chat_dispatcher.py`
|
|
13
|
+
* and `agents/strands/tool_schemas.py` only register SERVER-SIDE tools
|
|
14
|
+
* (executed inline by the agent) — there is no per-request browser-tools
|
|
15
|
+
* pipe through the WS yet. Adding that is a substantial refactor that
|
|
16
|
+
* would dwarf the Phase 3 scope. Markers are a pragmatic bridge.
|
|
17
|
+
*
|
|
18
|
+
* Future Phase 3b: migrate to real Bedrock tool-use by threading
|
|
19
|
+
* browser-defined tools through the WS payload. The
|
|
20
|
+
* {@link BEDROCK_TOOL_SCHEMAS} export below already encodes the same
|
|
21
|
+
* vocabulary in Converse-tool-spec form, so the migration is mostly
|
|
22
|
+
* delete-marker-parser + add-toolUse-handler. Tracked in
|
|
23
|
+
* `specs/technical-debt.md` Issue #113.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Discriminated union of every world-steering action the chat model can
|
|
27
|
+
* trigger. Keep this in sync with both {@link parseHeliosCommands} (the
|
|
28
|
+
* marker grammar) and {@link BEDROCK_TOOL_SCHEMAS} (the future-tool-use
|
|
29
|
+
* grammar).
|
|
30
|
+
*/
|
|
31
|
+
export type HeliosCommand = {
|
|
32
|
+
type: 'set_scene';
|
|
33
|
+
prompt: string;
|
|
34
|
+
} | {
|
|
35
|
+
type: 'swap_seed';
|
|
36
|
+
entityName: string;
|
|
37
|
+
} | {
|
|
38
|
+
type: 'pause_world';
|
|
39
|
+
} | {
|
|
40
|
+
type: 'resume_world';
|
|
41
|
+
} | {
|
|
42
|
+
type: 'reset_world';
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Extract Helios commands from a streamed model response. Unknown
|
|
46
|
+
* marker names are silently dropped. Malformed markers (unclosed
|
|
47
|
+
* brackets, missing quotes when an arg is expected) are also dropped —
|
|
48
|
+
* tolerance over strictness because the model is the source of truth
|
|
49
|
+
* for whether a marker was intended.
|
|
50
|
+
*
|
|
51
|
+
* Returned commands preserve source order.
|
|
52
|
+
*/
|
|
53
|
+
export declare function parseHeliosCommands(text: string): HeliosCommand[];
|
|
54
|
+
/**
|
|
55
|
+
* Remove every Helios marker from a text fragment so the user-facing
|
|
56
|
+
* transcript reads cleanly. The function:
|
|
57
|
+
* - Drops markers regardless of whether the name is recognised (the
|
|
58
|
+
* user shouldn't see `[FOO: "bar"]` either way).
|
|
59
|
+
* - Collapses runs of horizontal whitespace introduced by the
|
|
60
|
+
* deletion (so `Hello [PAUSE_WORLD] world` becomes `Hello world`,
|
|
61
|
+
* not `Hello world`).
|
|
62
|
+
* - Collapses 3+ consecutive newlines down to 2 (preserves paragraph
|
|
63
|
+
* breaks but doesn't leave huge gaps where markers used to sit).
|
|
64
|
+
* - Leaves the input's leading/trailing whitespace untouched. Streaming
|
|
65
|
+
* callers concatenate chunks, so trimming boundary whitespace would
|
|
66
|
+
* corrupt seams.
|
|
67
|
+
*/
|
|
68
|
+
export declare function stripHeliosCommands(text: string): string;
|
|
69
|
+
/**
|
|
70
|
+
* Bedrock Converse tool specs for the same vocabulary as the markers
|
|
71
|
+
* above. **NOT USED IN PHASE 3** — the chat dispatcher doesn't accept
|
|
72
|
+
* browser-defined tools yet (see Issue #113 in
|
|
73
|
+
* `specs/technical-debt.md`). Kept here so the future migration to real
|
|
74
|
+
* tool-use only needs to delete the marker parser and wire these into
|
|
75
|
+
* the WS send payload.
|
|
76
|
+
*
|
|
77
|
+
* Schema shape matches the AWS Bedrock Converse API:
|
|
78
|
+
* { toolSpec: { name, description, inputSchema: { json: {...} } } }
|
|
79
|
+
*
|
|
80
|
+
* NAMING NOTE: schemas use `snake_case` property names (`entity_name`,
|
|
81
|
+
* not `entityName`) because that's the convention Bedrock Converse
|
|
82
|
+
* tool-use expects in the inputSchema, and the LLM emits arguments
|
|
83
|
+
* keyed to the schema. The Phase 3b migration handler will need to
|
|
84
|
+
* translate snake_case tool-use args → camelCase `HeliosCommand`
|
|
85
|
+
* fields (e.g. `entity_name` → `entityName`). The marker parser does
|
|
86
|
+
* the same translation for the inline-marker path today.
|
|
87
|
+
*/
|
|
88
|
+
export declare const BEDROCK_TOOL_SCHEMAS: readonly [{
|
|
89
|
+
readonly toolSpec: {
|
|
90
|
+
readonly name: "set_scene";
|
|
91
|
+
readonly description: string;
|
|
92
|
+
readonly inputSchema: {
|
|
93
|
+
readonly json: {
|
|
94
|
+
readonly type: "object";
|
|
95
|
+
readonly properties: {
|
|
96
|
+
readonly prompt: {
|
|
97
|
+
readonly type: "string";
|
|
98
|
+
readonly description: "Detailed 80-120 word scene description for Helios.";
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
readonly required: readonly ["prompt"];
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
}, {
|
|
106
|
+
readonly toolSpec: {
|
|
107
|
+
readonly name: "swap_seed";
|
|
108
|
+
readonly description: string;
|
|
109
|
+
readonly inputSchema: {
|
|
110
|
+
readonly json: {
|
|
111
|
+
readonly type: "object";
|
|
112
|
+
readonly properties: {
|
|
113
|
+
readonly entity_name: {
|
|
114
|
+
readonly type: "string";
|
|
115
|
+
readonly description: "Exact display name of the target entity (e.g. \"Leo\").";
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
readonly required: readonly ["entity_name"];
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
}, {
|
|
123
|
+
readonly toolSpec: {
|
|
124
|
+
readonly name: "pause_world";
|
|
125
|
+
readonly description: string;
|
|
126
|
+
readonly inputSchema: {
|
|
127
|
+
readonly json: {
|
|
128
|
+
readonly type: "object";
|
|
129
|
+
readonly properties: {};
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
}, {
|
|
134
|
+
readonly toolSpec: {
|
|
135
|
+
readonly name: "resume_world";
|
|
136
|
+
readonly description: "Resume a paused Helios stream from the current frame.";
|
|
137
|
+
readonly inputSchema: {
|
|
138
|
+
readonly json: {
|
|
139
|
+
readonly type: "object";
|
|
140
|
+
readonly properties: {};
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
}, {
|
|
145
|
+
readonly toolSpec: {
|
|
146
|
+
readonly name: "reset_world";
|
|
147
|
+
readonly description: string;
|
|
148
|
+
readonly inputSchema: {
|
|
149
|
+
readonly json: {
|
|
150
|
+
readonly type: "object";
|
|
151
|
+
readonly properties: {};
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
}];
|
|
156
|
+
//# sourceMappingURL=heliosTools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heliosTools.d.ts","sourceRoot":"","sources":["../../src/reactor/heliosTools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,GACvB;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,GACxB;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC;AAgD5B;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,EAAE,CA4BjE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAwBxD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6EvB,CAAC"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helios world-steering command vocabulary.
|
|
3
|
+
*
|
|
4
|
+
* Phase 3 ships an "inline markers" implementation: the chat model emits
|
|
5
|
+
* bracket-style commands like `[SET_SCENE: "wide cinematic shot…"]`
|
|
6
|
+
* inline in its assistant turn, and the browser intercepts them with
|
|
7
|
+
* `parseHeliosCommands()` and dispatches `reactor.sendCommand(...)` for
|
|
8
|
+
* each one. `stripHeliosCommands()` then removes the markers from the
|
|
9
|
+
* user-facing transcript so the user only sees natural-language reply
|
|
10
|
+
* text.
|
|
11
|
+
*
|
|
12
|
+
* Why markers and not real Bedrock tool-use today? `shared/chat_dispatcher.py`
|
|
13
|
+
* and `agents/strands/tool_schemas.py` only register SERVER-SIDE tools
|
|
14
|
+
* (executed inline by the agent) — there is no per-request browser-tools
|
|
15
|
+
* pipe through the WS yet. Adding that is a substantial refactor that
|
|
16
|
+
* would dwarf the Phase 3 scope. Markers are a pragmatic bridge.
|
|
17
|
+
*
|
|
18
|
+
* Future Phase 3b: migrate to real Bedrock tool-use by threading
|
|
19
|
+
* browser-defined tools through the WS payload. The
|
|
20
|
+
* {@link BEDROCK_TOOL_SCHEMAS} export below already encodes the same
|
|
21
|
+
* vocabulary in Converse-tool-spec form, so the migration is mostly
|
|
22
|
+
* delete-marker-parser + add-toolUse-handler. Tracked in
|
|
23
|
+
* `specs/technical-debt.md` Issue #113.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Marker names recognised by {@link parseHeliosCommands}. Matched
|
|
27
|
+
* case-insensitively. Anything else is silently dropped — the model
|
|
28
|
+
* regularly invents marker names, and throwing would break the chat
|
|
29
|
+
* session for every typo.
|
|
30
|
+
*/
|
|
31
|
+
const KNOWN_MARKERS = {
|
|
32
|
+
set_scene: 'set_scene',
|
|
33
|
+
swap_seed: 'swap_seed',
|
|
34
|
+
pause_world: 'pause_world',
|
|
35
|
+
resume_world: 'resume_world',
|
|
36
|
+
reset_world: 'reset_world',
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Markers that REQUIRE a string argument. The argument is captured from
|
|
40
|
+
* the `"…"` group in the grammar; missing-arg variants are dropped.
|
|
41
|
+
*/
|
|
42
|
+
const MARKERS_REQUIRING_ARG = new Set(['set_scene', 'swap_seed']);
|
|
43
|
+
/**
|
|
44
|
+
* Grammar (loose):
|
|
45
|
+
* - `[ NAME ]`
|
|
46
|
+
* - `[ NAME : "argument" ]`
|
|
47
|
+
*
|
|
48
|
+
* Whitespace around the name/colon is tolerated; the name is matched
|
|
49
|
+
* case-insensitively. Markers that look syntactically valid but don't
|
|
50
|
+
* match a known name are dropped (so the model can hallucinate
|
|
51
|
+
* `[ENGAGE_HYPERDRIVE: "warp 9"]` without crashing).
|
|
52
|
+
*
|
|
53
|
+
* The regex is non-greedy on the argument to handle multiple markers
|
|
54
|
+
* on one line, and forbids embedded brackets inside the name to avoid
|
|
55
|
+
* catastrophic backtracking on malformed input.
|
|
56
|
+
*
|
|
57
|
+
* Only the regex SOURCE + FLAGS are kept at module scope. Each call
|
|
58
|
+
* to `parseHeliosCommands` constructs a fresh `RegExp` instance from
|
|
59
|
+
* those constants so the `g`-flag's `lastIndex` state is never shared
|
|
60
|
+
* across calls. Browser is single-threaded so the difference is mostly
|
|
61
|
+
* theoretical, but it eliminates the shared-state concern for SSR or
|
|
62
|
+
* concurrent test workers and lets us drop a defensive reset line.
|
|
63
|
+
*/
|
|
64
|
+
const MARKER_PATTERN = /\[\s*([A-Za-z_][A-Za-z0-9_]*)\s*(?::\s*"((?:[^"\\]|\\.)*)"\s*)?\]/g;
|
|
65
|
+
const MARKER_PATTERN_SOURCE = MARKER_PATTERN.source;
|
|
66
|
+
const MARKER_PATTERN_FLAGS = MARKER_PATTERN.flags;
|
|
67
|
+
/**
|
|
68
|
+
* Extract Helios commands from a streamed model response. Unknown
|
|
69
|
+
* marker names are silently dropped. Malformed markers (unclosed
|
|
70
|
+
* brackets, missing quotes when an arg is expected) are also dropped —
|
|
71
|
+
* tolerance over strictness because the model is the source of truth
|
|
72
|
+
* for whether a marker was intended.
|
|
73
|
+
*
|
|
74
|
+
* Returned commands preserve source order.
|
|
75
|
+
*/
|
|
76
|
+
export function parseHeliosCommands(text) {
|
|
77
|
+
if (!text)
|
|
78
|
+
return [];
|
|
79
|
+
const commands = [];
|
|
80
|
+
// Fresh regex per call — no shared lastIndex state to worry about.
|
|
81
|
+
const regex = new RegExp(MARKER_PATTERN_SOURCE, MARKER_PATTERN_FLAGS);
|
|
82
|
+
for (const match of text.matchAll(regex)) {
|
|
83
|
+
const rawName = match[1]?.toLowerCase();
|
|
84
|
+
const arg = match[2]; // string | undefined
|
|
85
|
+
if (!rawName)
|
|
86
|
+
continue;
|
|
87
|
+
const type = KNOWN_MARKERS[rawName];
|
|
88
|
+
if (!type)
|
|
89
|
+
continue;
|
|
90
|
+
if (MARKERS_REQUIRING_ARG.has(type)) {
|
|
91
|
+
// Argument is required and must be a non-empty trimmed string.
|
|
92
|
+
const trimmed = arg?.trim();
|
|
93
|
+
if (!trimmed)
|
|
94
|
+
continue;
|
|
95
|
+
if (type === 'set_scene') {
|
|
96
|
+
commands.push({ type: 'set_scene', prompt: trimmed });
|
|
97
|
+
}
|
|
98
|
+
else if (type === 'swap_seed') {
|
|
99
|
+
commands.push({ type: 'swap_seed', entityName: trimmed });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
// Zero-arg markers; any included arg is ignored.
|
|
104
|
+
if (type === 'pause_world')
|
|
105
|
+
commands.push({ type: 'pause_world' });
|
|
106
|
+
else if (type === 'resume_world')
|
|
107
|
+
commands.push({ type: 'resume_world' });
|
|
108
|
+
else if (type === 'reset_world')
|
|
109
|
+
commands.push({ type: 'reset_world' });
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return commands;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Remove every Helios marker from a text fragment so the user-facing
|
|
116
|
+
* transcript reads cleanly. The function:
|
|
117
|
+
* - Drops markers regardless of whether the name is recognised (the
|
|
118
|
+
* user shouldn't see `[FOO: "bar"]` either way).
|
|
119
|
+
* - Collapses runs of horizontal whitespace introduced by the
|
|
120
|
+
* deletion (so `Hello [PAUSE_WORLD] world` becomes `Hello world`,
|
|
121
|
+
* not `Hello world`).
|
|
122
|
+
* - Collapses 3+ consecutive newlines down to 2 (preserves paragraph
|
|
123
|
+
* breaks but doesn't leave huge gaps where markers used to sit).
|
|
124
|
+
* - Leaves the input's leading/trailing whitespace untouched. Streaming
|
|
125
|
+
* callers concatenate chunks, so trimming boundary whitespace would
|
|
126
|
+
* corrupt seams.
|
|
127
|
+
*/
|
|
128
|
+
export function stripHeliosCommands(text) {
|
|
129
|
+
if (!text)
|
|
130
|
+
return text;
|
|
131
|
+
// Reuse the parser's grammar via MARKER_PATTERN_SOURCE so any future
|
|
132
|
+
// change to the marker syntax automatically applies here too. Fresh
|
|
133
|
+
// RegExp instance — no `lastIndex` state shared with the parser.
|
|
134
|
+
// (Stripping doesn't capture so we don't need the parentheses, but
|
|
135
|
+
// keeping the same source is cheaper than maintaining two regexes.)
|
|
136
|
+
const stripRegex = new RegExp(MARKER_PATTERN_SOURCE, MARKER_PATTERN_FLAGS);
|
|
137
|
+
const stripped = text.replace(stripRegex, '');
|
|
138
|
+
// Collapse whitespace introduced by deletion (multiple spaces, tabs,
|
|
139
|
+
// newlines that became adjacent). Preserve single newlines for
|
|
140
|
+
// paragraph structure: collapse runs of horizontal whitespace, then
|
|
141
|
+
// dedupe consecutive blank lines.
|
|
142
|
+
const collapsed = stripped
|
|
143
|
+
// Collapse runs of spaces/tabs.
|
|
144
|
+
.replace(/[ \t]{2,}/g, ' ')
|
|
145
|
+
// Remove trailing spaces before newlines.
|
|
146
|
+
.replace(/[ \t]+\n/g, '\n')
|
|
147
|
+
// Collapse 3+ newlines down to 2.
|
|
148
|
+
.replace(/\n{3,}/g, '\n\n');
|
|
149
|
+
return collapsed;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Bedrock Converse tool specs for the same vocabulary as the markers
|
|
153
|
+
* above. **NOT USED IN PHASE 3** — the chat dispatcher doesn't accept
|
|
154
|
+
* browser-defined tools yet (see Issue #113 in
|
|
155
|
+
* `specs/technical-debt.md`). Kept here so the future migration to real
|
|
156
|
+
* tool-use only needs to delete the marker parser and wire these into
|
|
157
|
+
* the WS send payload.
|
|
158
|
+
*
|
|
159
|
+
* Schema shape matches the AWS Bedrock Converse API:
|
|
160
|
+
* { toolSpec: { name, description, inputSchema: { json: {...} } } }
|
|
161
|
+
*
|
|
162
|
+
* NAMING NOTE: schemas use `snake_case` property names (`entity_name`,
|
|
163
|
+
* not `entityName`) because that's the convention Bedrock Converse
|
|
164
|
+
* tool-use expects in the inputSchema, and the LLM emits arguments
|
|
165
|
+
* keyed to the schema. The Phase 3b migration handler will need to
|
|
166
|
+
* translate snake_case tool-use args → camelCase `HeliosCommand`
|
|
167
|
+
* fields (e.g. `entity_name` → `entityName`). The marker parser does
|
|
168
|
+
* the same translation for the inline-marker path today.
|
|
169
|
+
*/
|
|
170
|
+
export const BEDROCK_TOOL_SCHEMAS = [
|
|
171
|
+
{
|
|
172
|
+
toolSpec: {
|
|
173
|
+
name: 'set_scene',
|
|
174
|
+
description: 'Change the live Helios scene to a new prompt. The prompt should ' +
|
|
175
|
+
'be a detailed 80-120 word scene description following the Helios ' +
|
|
176
|
+
'prompt-guide style: subject, environment, lighting, camera framing, ' +
|
|
177
|
+
'mood. Use this when the user asks to change the world, the weather, ' +
|
|
178
|
+
'the time of day, or the mood. The change applies on the next chunk.',
|
|
179
|
+
inputSchema: {
|
|
180
|
+
json: {
|
|
181
|
+
type: 'object',
|
|
182
|
+
properties: {
|
|
183
|
+
prompt: {
|
|
184
|
+
type: 'string',
|
|
185
|
+
description: 'Detailed 80-120 word scene description for Helios.',
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
required: ['prompt'],
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
toolSpec: {
|
|
195
|
+
name: 'swap_seed',
|
|
196
|
+
description: 'Replace the active seed image with a different entity from the ' +
|
|
197
|
+
'current video. The entity name should match one of the ' +
|
|
198
|
+
"extracted entities (matching is case-insensitive on whitespace-trimmed " +
|
|
199
|
+
"names — `Leo`, `leo`, `LEO` all resolve to the same entity). Use when " +
|
|
200
|
+
'the user asks to ' +
|
|
201
|
+
"swap or focus on a different character. Triggers a blended " +
|
|
202
|
+
'transition rather than a hard cut.',
|
|
203
|
+
inputSchema: {
|
|
204
|
+
json: {
|
|
205
|
+
type: 'object',
|
|
206
|
+
properties: {
|
|
207
|
+
entity_name: {
|
|
208
|
+
type: 'string',
|
|
209
|
+
description: 'Exact display name of the target entity (e.g. "Leo").',
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
required: ['entity_name'],
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
toolSpec: {
|
|
219
|
+
name: 'pause_world',
|
|
220
|
+
description: 'Pause the live Helios stream at the current frame. Use when the ' +
|
|
221
|
+
'user wants to freeze the action.',
|
|
222
|
+
inputSchema: { json: { type: 'object', properties: {} } },
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
toolSpec: {
|
|
227
|
+
name: 'resume_world',
|
|
228
|
+
description: 'Resume a paused Helios stream from the current frame.',
|
|
229
|
+
inputSchema: { json: { type: 'object', properties: {} } },
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
toolSpec: {
|
|
234
|
+
name: 'reset_world',
|
|
235
|
+
description: 'Reset the Helios stream back to frame 0 and clear the scheduled ' +
|
|
236
|
+
'prompt buffer. Use when the user wants to start over.',
|
|
237
|
+
inputSchema: { json: { type: 'object', properties: {} } },
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
];
|
|
241
|
+
//# sourceMappingURL=heliosTools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heliosTools.js","sourceRoot":"","sources":["../../src/reactor/heliosTools.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Barrel re-export for the framework-agnostic Reactor / Helios layer.
|
|
3
|
+
* Consumed from `src/index.ts` via `export * from './reactor'`.
|
|
4
|
+
*/
|
|
5
|
+
export * from './types';
|
|
6
|
+
export * from './regenTemplate';
|
|
7
|
+
export * from './upsamplePrompt';
|
|
8
|
+
export * from './entityContext';
|
|
9
|
+
export * from './scenesFromEnrichment';
|
|
10
|
+
export * from './heliosTools';
|
|
11
|
+
export * from './toolPromptAddon';
|
|
12
|
+
export * from './entitySearch';
|
|
13
|
+
export * from './heliosCommandDispatcher';
|
|
14
|
+
export * from './seedImageOrchestrator';
|
|
15
|
+
export * from './promptAddonRegistry';
|
|
16
|
+
export * from './sceneEntry';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","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,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Barrel re-export for the framework-agnostic Reactor / Helios layer.
|
|
3
|
+
* Consumed from `src/index.ts` via `export * from './reactor.js'`.
|
|
4
|
+
*/
|
|
5
|
+
export * from './types.js';
|
|
6
|
+
export * from './regenTemplate.js';
|
|
7
|
+
export * from './upsamplePrompt.js';
|
|
8
|
+
export * from './entityContext.js';
|
|
9
|
+
export * from './scenesFromEnrichment.js';
|
|
10
|
+
export * from './heliosTools.js';
|
|
11
|
+
export * from './toolPromptAddon.js';
|
|
12
|
+
export * from './entitySearch.js';
|
|
13
|
+
export * from './heliosCommandDispatcher.js';
|
|
14
|
+
export * from './seedImageOrchestrator.js';
|
|
15
|
+
export * from './promptAddonRegistry.js';
|
|
16
|
+
export * from './sceneEntry.js';
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Frontend-facing registry of known prompt addons.
|
|
3
|
+
*
|
|
4
|
+
* The persona-edit form (and any other UI that wants to expose addon
|
|
5
|
+
* toggles) imports `KNOWN_PROMPT_ADDONS` to render a multi-select
|
|
6
|
+
* without having to hardcode the addon ID list. Each entry carries the
|
|
7
|
+
* stable ID, a human label, and a short description that the UI shows
|
|
8
|
+
* as helper text.
|
|
9
|
+
*
|
|
10
|
+
* Source of truth for the addon BEHAVIOUR still lives in the addon's
|
|
11
|
+
* own module (`toolPromptAddon.ts` for `helios-world-steering`); this
|
|
12
|
+
* registry is just the metadata listing.
|
|
13
|
+
*
|
|
14
|
+
* When a new addon lands:
|
|
15
|
+
* 1. Add its ID constant in `<addon>AddonId.ts` (mirroring
|
|
16
|
+
* `toolPromptAddonId.ts`) AND the matching Python constant in
|
|
17
|
+
* `shared/persona_addon_ids.py`.
|
|
18
|
+
* 2. Add the addon-text builder.
|
|
19
|
+
* 3. Add one entry here so the persona UI picks it up automatically.
|
|
20
|
+
*
|
|
21
|
+
* Once this list grows past ~10 entries, consider moving to a DynamoDB
|
|
22
|
+
* registry surfaced via API (`shared/prompt_addon_store.py`) — see
|
|
23
|
+
* `specs/technical-debt.md` #118 for the migration plan.
|
|
24
|
+
*/
|
|
25
|
+
export interface PromptAddonDescriptor {
|
|
26
|
+
/** Stable ID matching `prompt_addon_ids` in `PersonaConfig`. */
|
|
27
|
+
id: string;
|
|
28
|
+
/** Short label for the multi-select option. */
|
|
29
|
+
label: string;
|
|
30
|
+
/** One-sentence description for helper text under the option. */
|
|
31
|
+
description: string;
|
|
32
|
+
}
|
|
33
|
+
export declare const KNOWN_PROMPT_ADDONS: readonly PromptAddonDescriptor[];
|
|
34
|
+
/** Look up a descriptor by ID. Returns `undefined` for unknown IDs —
|
|
35
|
+
* callers can fall back to rendering the raw ID string. */
|
|
36
|
+
export declare function getPromptAddonDescriptor(id: string): PromptAddonDescriptor | undefined;
|
|
37
|
+
//# sourceMappingURL=promptAddonRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promptAddonRegistry.d.ts","sourceRoot":"","sources":["../../src/reactor/promptAddonRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAIH,MAAM,WAAW,qBAAqB;IACpC,gEAAgE;IAChE,EAAE,EAAE,MAAM,CAAC;IACX,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,mBAAmB,EAAE,SAAS,qBAAqB,EAO/D,CAAC;AAEF;4DAC4D;AAC5D,wBAAgB,wBAAwB,CACtC,EAAE,EAAE,MAAM,GACT,qBAAqB,GAAG,SAAS,CAEnC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Frontend-facing registry of known prompt addons.
|
|
3
|
+
*
|
|
4
|
+
* The persona-edit form (and any other UI that wants to expose addon
|
|
5
|
+
* toggles) imports `KNOWN_PROMPT_ADDONS` to render a multi-select
|
|
6
|
+
* without having to hardcode the addon ID list. Each entry carries the
|
|
7
|
+
* stable ID, a human label, and a short description that the UI shows
|
|
8
|
+
* as helper text.
|
|
9
|
+
*
|
|
10
|
+
* Source of truth for the addon BEHAVIOUR still lives in the addon's
|
|
11
|
+
* own module (`toolPromptAddon.ts` for `helios-world-steering`); this
|
|
12
|
+
* registry is just the metadata listing.
|
|
13
|
+
*
|
|
14
|
+
* When a new addon lands:
|
|
15
|
+
* 1. Add its ID constant in `<addon>AddonId.ts` (mirroring
|
|
16
|
+
* `toolPromptAddonId.ts`) AND the matching Python constant in
|
|
17
|
+
* `shared/persona_addon_ids.py`.
|
|
18
|
+
* 2. Add the addon-text builder.
|
|
19
|
+
* 3. Add one entry here so the persona UI picks it up automatically.
|
|
20
|
+
*
|
|
21
|
+
* Once this list grows past ~10 entries, consider moving to a DynamoDB
|
|
22
|
+
* registry surfaced via API (`shared/prompt_addon_store.py`) — see
|
|
23
|
+
* `specs/technical-debt.md` #118 for the migration plan.
|
|
24
|
+
*/
|
|
25
|
+
import { HELIOS_WORLD_STEERING_ADDON_ID } from './toolPromptAddonId.js';
|
|
26
|
+
export const KNOWN_PROMPT_ADDONS = [
|
|
27
|
+
{
|
|
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.',
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
/** Look up a descriptor by ID. Returns `undefined` for unknown IDs —
|
|
34
|
+
* callers can fall back to rendering the raw ID string. */
|
|
35
|
+
export function getPromptAddonDescriptor(id) {
|
|
36
|
+
return KNOWN_PROMPT_ADDONS.find(a => a.id === id);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=promptAddonRegistry.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `buildRegenPrompt` — pure, deterministic prompt builder for the
|
|
3
|
+
* optional Gemini Flash Image regen step.
|
|
4
|
+
*
|
|
5
|
+
* Encodes the locked guarantees (16:9, identity preservation when
|
|
6
|
+
* requested, entity grounding) plus structured creative choices
|
|
7
|
+
* (framing, lighting, style) plus the user's free-form creative
|
|
8
|
+
* direction. The output is a single string suitable for
|
|
9
|
+
* `services/image_regeneration`'s `prompt` field.
|
|
10
|
+
*
|
|
11
|
+
* **Determinism matters.** The output of this function is shown
|
|
12
|
+
* verbatim in the RegenForm's live preview — a hidden non-determinism
|
|
13
|
+
* (e.g. `Date.now()` interpolation, randomization) would make the
|
|
14
|
+
* preview lie about the prompt that's actually generated.
|
|
15
|
+
*
|
|
16
|
+
* Throws `Error("customStyle required when styleFamily is 'custom'")`
|
|
17
|
+
* when the invariant is violated. The TS type can't express this
|
|
18
|
+
* cleanly without a discriminated union, so it's checked at runtime
|
|
19
|
+
* (the consuming UI also validates pre-submit).
|
|
20
|
+
*/
|
|
21
|
+
import type { RegenTemplateInput } from './types';
|
|
22
|
+
export declare function buildRegenPrompt(input: RegenTemplateInput): string;
|
|
23
|
+
//# sourceMappingURL=regenTemplate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regenTemplate.d.ts","sourceRoot":"","sources":["../../src/reactor/regenTemplate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAsClD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAkFlE"}
|