Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(x-content): let a scenario hold a key down, as the authoring guide documents

nirholas0e3176a16d54
diff --git a/api/_lib/x-content/reel.js b/api/_lib/x-content/reel.js
index 5c3d91acd..cdbb4fa51 100644
--- a/api/_lib/x-content/reel.js
+++ b/api/_lib/x-content/reel.js
@@ -80,9 +80,11 @@ const PAUSE_ATTEMPTS = 4;
const RIPPLE_FRAMES = 9;
const TYPE_FRAMES_PER_CHAR = 2;
-// `caption` is last on purpose: any step may carry a caption as well as its
-// action, and a step is only a caption step when it does nothing else.
-export const STEP_KINDS = ['goto', 'hold', 'click', 'hover', 'type', 'press', 'expect', 'read', 'drag', 'scroll', 'wait', 'caption'];
+// The first kind a step carries is what it does, so a kind that another step
+// can carry as a modifier comes after the steps that use it that way: `hold`
+// after `press` (a held key is `{ "press": "w", "hold": 2000 }`), and
+// `caption` last, because any step may carry a caption as well as its action.
+export const STEP_KINDS = ['goto', 'click', 'hover', 'type', 'press', 'expect', 'read', 'drag', 'scroll', 'wait', 'hold', 'caption'];
// The steps that can cause a request, and so may carry `awaits`.
const ACTIONS = ['click', 'press', 'type'];
diff --git a/tests/x-content-reel.test.js b/tests/x-content-reel.test.js
index 4d90392c5..c6906e223 100644
--- a/tests/x-content-reel.test.js
+++ b/tests/x-content-reel.test.js
@@ -373,3 +373,17 @@ describe('a machine that cannot run the browser', () => {
expect(describeBrowserError('something else\nmore')).toBe('the browser cannot start: something else');
});
});
+
+describe('a held key', () => {
+ it('reads as a key press that is held, not as a plain hold', () => {
+ expect(stepKind({ press: 'w', hold: 2000 })).toBe('press');
+ expect(stepKind({ hold: 2000 })).toBe('hold');
+ expect(stepKind({ hold: 1500, caption: 'Watch it walk' })).toBe('hold');
+ });
+
+ it('validates the hold length on a held key', () => {
+ const steps = [{ goto: 'https://three.ws/walk' }, { press: 'w', hold: 2000 }, { expect: 'Walking' }];
+ expect(scenarioProblems({ steps })).toEqual([]);
+ expect(scenarioProblems({ steps: [steps[0], { press: 'w', hold: 60_000 }, steps[2]] }).join('\n')).toMatch(/step 2: hold is .* of the key held down/);
+ });
+});