Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/vscode-extension/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- Click a building to pin its card; it stays while you look at others and follows the playhead. Click it again to remove it.
- The label of the current step floats in the same band.
- Agents fly UFOs: each agent is a flying saucer in its colour, cruising above the tallest building and below the legends, so it is always in sight.
- Buildings are at most 0.55 m tall, so the UFOs fly at the height of a standing viewer's eyes.
- It glides from file to file at its altitude; the trail draws the flight path in the sky.
- Over the building it works on it lights a tractor beam and a halo on the roof (read colour on a read), following the building while it grows.
- Subagents fly a little lower than the main agent, so several UFOs never overlap; they are born from the main UFO and fly back to it when done.
Expand Down
3 changes: 2 additions & 1 deletion apps/vscode-extension/src/core/agent-flow/agentFlowModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ export interface AgentFlowSessionInfo {
export const AGENT_FLOW_SCHEMA_VERSION = 1;

/** The table box the city is laid out in (metres), the dependency graph's box. */
export const AGENT_FLOW_TABLE = Object.freeze({ width: 4.7, depth: 2.35, maxHeight: 0.9, minHeight: 0.04 });
/** Table size in metres; maxHeight keeps the skyline under a standing viewer's eye line (runtime CITY mirrors it). */
export const AGENT_FLOW_TABLE = Object.freeze({ width: 4.7, depth: 2.35, maxHeight: 0.55, minHeight: 0.04 });

export interface AgentFlowDataset {
schemaVersion: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
var ROOT_ID = 'codexrAgentFlowRoot';
var ROOT_POSITION = { x: 0, y: 0.935, z: -18 };
// The city box (AGENT_FLOW_TABLE in agentFlowModels.ts) and the visible table.
var CITY = { width: 4.7, depth: 2.35, maxHeight: 0.9, minHeight: 0.04 };
// maxHeight keeps the skyline under a standing viewer's eye line (the table
// top is 0.935 m up), so the UFO lane above it is at eye height.
var CITY = { width: 4.7, depth: 2.35, maxHeight: 0.55, minHeight: 0.04 };
var SURFACE = { width: 6.514, depth: 4.118 };
// The timeline is a lectern along the front edge (the side facing the
// viewer, +z), tilted toward the user: flat on the table it would be read at
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// the playhead does; `v.skyExtra` lets a layer that lifts geometry above
// the roofs (the floor accordion) push them up.

var SKY = { ufoLift: 0.18, legendLift: 0.45 };
var SKY = { ufoLift: 0.12, legendLift: 0.45 };

function skylineY(v) {
var top = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@
};
}

/**
* A dataset built with taller buildings than the city allows (an older
* server, or a saved export) is scaled down to CITY.maxHeight, keeping
* the proportions between buildings, so the city always stays below the
* UFO lane and the viewer's eye line.
*/
function fitHeights(files) {
var tallest = files.reduce(function (top, file) { return Math.max(top, file.h); }, 0);
if (!(tallest > CITY.maxHeight)) { return; }
var k = (CITY.maxHeight - CITY.minHeight) / Math.max(1e-6, tallest - CITY.minHeight);
files.forEach(function (file) { file.h = CITY.minHeight + (file.h - CITY.minHeight) * k; });
}

/**
* Files a step removes, as indexes. `step.deleted` may list indexes or
* paths; without it a file flagged deleted is removed by its last step
Expand Down Expand Up @@ -86,6 +99,7 @@
function normalizeDataset(raw) {
if (!raw || typeof raw !== 'object' || !Array.isArray(raw.files)) { return null; }
var files = raw.files.map(normalizeFile);
fitHeights(files);
var fileCount = files.length;
var validFile = function (index) { return Number.isInteger(index) && index >= 0 && index < fileCount; };
var steps = (Array.isArray(raw.steps) ? raw.steps : [])
Expand Down
8 changes: 8 additions & 0 deletions apps/vscode-extension/test/runners/run-agent-flow-harness.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,14 @@ async function runScenario(browser, port) {
await lookAtLocal({ x: roof.x, y: target.y * 0.6, z: roof.z }, { x: 0.15, y: 0.05, z: 2.1 });
await sleep(900);
await shot(page, '18-ufo-sky-layers');
// Seen from a standing viewer's eyes (A-Frame's 1.6 m camera; the table
// top is 0.935 m up): the main UFO cruises about at eye height.
const EYE = 1.6 - 0.935;
const mainUfo = sky.workers.reduce((top, ufo) => (ufo.y > top.y ? ufo : top), sky.workers[0]);
assert.ok(Math.abs(mainUfo.y - EYE) < 0.2, `the UFO flies near eye height (${mainUfo.y.toFixed(3)} vs ${EYE.toFixed(3)})`);
await lookAtLocal({ x: 0, y: EYE, z: 0 }, { x: 0, y: 0, z: 2.4 });
await sleep(900);
await shot(page, '20-ufo-eye-level');

// (a3) Skins: the UFO dresses for each action (colour + accessory).
// Shown on the main UFO, one action at a time, then put back.
Expand Down
2 changes: 1 addition & 1 deletion docs/agent-flow/legends.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Story Code-XR#419 (epic #319). Proposed by Adrián on 2026-12-02 after testing t
| Band | Height | Used by |
|---|---|---|
| Skyline | `skylineY(v)`: highest roof of the session (final, current or growing height) + `v.skyExtra` | reference |
| UFO lane | `ufoAltitude(v)` = skyline + 0.18 | the worker's saucer (UFO thread, PRs #421/#422) |
| UFO lane | `ufoAltitude(v)` = skyline + 0.12 | the worker's saucer (UFO thread, PRs #421/#422) |
| Legends | `legendAltitude(v)` = skyline + 0.45 | bottom edge of every legend card and of the current-step label |

The skyline counts every building at its tallest, so the bands do not jump while the playhead moves. A layer that lifts geometry above the roofs (the floor accordion, #412) sets `v.skyExtra` to push the bands up.
Expand Down
11 changes: 10 additions & 1 deletion docs/agent-flow/ufo.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,23 @@ above the city, in table-local Y:
| Layer | Height |
|---|---|
| Legends (step label, legend cards) | `legendAltitude(v)` = skyline + 0.45 m, bottom edge |
| UFOs and their name tags | `ufoAltitude(v)` = skyline + 0.18 m |
| UFOs and their name tags | `ufoAltitude(v)` = skyline + 0.12 m |
| City | `skylineY(v)` = highest roof of the session (final, current or growing-to height, plus `v.skyExtra`) |

The main UFO flies at `ufoAltitude`; subagents fly 3, 6 or 9 cm lower (three
layers), so saucers crossing each other never meet. The name tag sits over
the dome and the thought bubble / permission sign beside it, all under the
legend layer.

### Heights (2-dec, Adrián: fly at the viewer's height)

The table top is 0.935 m up and A-Frame's camera stands at 1.6 m. Buildings
are capped at 0.55 m (`AGENT_FLOW_TABLE.maxHeight` in core and `CITY.maxHeight`
in the runtime, kept equal; a dataset built with taller buildings is scaled
down by `fitHeights` in `timelineModel.js`), so roofs end around 1.5 m and the
main UFO cruises about at eye height (~1.6 m). The harness checks the main
UFO is within 0.2 m of eye height and takes `20-ufo-eye-level.png`.

## Behaviour

- `spotForStep` returns the cruise point over the target plus `ground`: what
Expand Down
Loading