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 @@ -18,6 +18,7 @@
- Untouched floors keep the building's grey; a floor the agent read or edited keeps a soft tint of that action.
- The floors the current step reads or edits light up in the action's colour, with an outline: exactly the functions it works on, not the whole file.
- A function the agent writes from scratch gets a new floor, built in front of you when the step plays.
- Replaying the timeline animates the city as it changed: moving back shows the city as it was at that point of the chat, and playing forward grows new floors, raises and lowers buildings and fades neighbours step by step. Before, every growth and fade finished on the next frame.
- Resting the pointer on a floor names its function, its lines and how many times it was read and written.
- Line data comes from Claude Code's edit and read results and from the Code-XR IDE's agent locations; a step without it lights the whole building, as before.
- 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,8 @@
return bound;
}

var AFRAME_LIFECYCLE = ['init', 'update', 'remove', 'tick', 'tock', 'play', 'pause'];

function registerCityComponent() {
var aframe = root.AFRAME;
if (!aframe?.registerComponent || aframe.components?.[CITY_COMPONENT]) { return; }
Expand All @@ -775,7 +777,13 @@
if (!c) { return; }
var api = c.api || (c.api = bindCityApi(c));
var component = this;
Object.keys(api).forEach(function (name) { component[name] = api[name]; });
// A-Frame calls a component's tick(time, delta) every frame: copying the
// city's tick(dt, time) there fed it the clock as dt, finishing every
// tween (heights, fades, floors) on the next frame. The view drives the
// city's tick, so lifecycle names stay A-Frame's.
Object.keys(api).forEach(function (name) {
if (AFRAME_LIFECYCLE.indexOf(name) === -1) { component[name] = api[name]; }
});
},
remove: function () {
if (this.el.codexrCity && !this.el.codexrCity.external) { cityApi.dispose(this.el.codexrCity); }
Expand Down
28 changes: 25 additions & 3 deletions apps/vscode-extension/test/runners/run-agent-flow-harness.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ async function runScenario(browser, port) {
await sleep(300);
await page.evaluate(() => { window.CodeXRAgentFlowRuntime.stepForward(); });
await waitFor(page, (i) => window.CodeXRAgentFlowRuntime.getState().stepIndex === i, index, 10000);
// Software GL runs at a few frames a second: wait for the hop to land.
await waitFor(page, () => !window.CodeXRAgentFlowRuntime.getState().moving, undefined, 15000);
// Software GL runs at a few frames a second and a frame advances the
// tweens by at most 64 ms: wait for the hop and the growth to land.
await waitFor(page, () => !window.CodeXRAgentFlowRuntime.getState().moving, undefined, 60000);
await sleep(settleMs);
return snapshot(page);
};
Expand Down Expand Up @@ -278,7 +279,27 @@ async function runScenario(browser, port) {
assert.ok(!floors.rects.includes(floors.names.indexOf('fanInOutRows')), 'a function written later is not built yet');
await shot(page, '14-floors-read-window');
// The edit that writes fanInOutRows builds its floor and lights exactly that one.
// Replayed (not live), the floor still grows in its step: sample its height every frame.
await page.evaluate((s) => {
const view = window.CodeXRAgentFlowRuntime.__testing.getView();
const index = view.files.findIndex((file) => file.path === s || file.path.endsWith('/' + s));
const slot = view.city.floorInstances(index)[view.files[index].floors.findIndex((floor) => floor.name === 'fanInOutRows')];
let mesh = null;
view.rootEl.object3D.traverse((object) => { if (object.name === 'agentFlowFloors') { mesh = object; } });
const matrix = new window.AFRAME.THREE.Matrix4();
window.__floorGrowth = [];
const sample = () => {
mesh.getMatrixAt(slot, matrix);
window.__floorGrowth.push(matrix.elements[5]);
if (window.__floorGrowth.length < 400) { window.requestAnimationFrame(sample); }
};
window.requestAnimationFrame(sample);
}, tooltips);
state = await stepTo(15, 1600);
const growth = await page.evaluate(() => window.__floorGrowth.slice());
const grown = growth.at(-1);
const between = new Set(growth.filter((value) => value > 0.0005 && Math.abs(value - grown) > 0.0005).map((value) => value.toFixed(4)));
assert.ok(grown > 0 && between.size >= 2, `the new floor grows over several frames (${growth.length} frames, ${between.size} in between)`);
floors = await floorsOf(tooltips);
assert.deepEqual(floors.lit, ['fanInOutRows']);
assert.ok(floors.rects.includes(floors.names.indexOf('fanInOutRows')), 'the new floor stands once built');
Expand Down Expand Up @@ -449,7 +470,8 @@ async function runScenario(browser, port) {
assert.equal(state.seeThrough.style, 'transparent');
await shot(page, '13-see-through');
await page.evaluate(() => window.CodeXRAgentFlowRuntime.setToggle('seeThrough', false));
await sleep(900);
// The fade back runs on frames (at most 64 ms each): software GL needs a few seconds.
await waitFor(page, () => window.CodeXRAgentFlowRuntime.getState().seeThrough.faded.length === 0, undefined, 20000).catch(() => {});
state = await snapshot(page);
assert.deepEqual(state.seeThrough.faded, [], 'toggle off: every building solid again');
await page.evaluate(() => window.CodeXRAgentFlowRuntime.setToggle('seeThrough', true));
Expand Down
Loading