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
13 changes: 13 additions & 0 deletions .claude/docs/V1.2.1_STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,3 +290,16 @@ Then pushed `v1.2.1` to `origin` at the maintainer's request. **No merge and no
**What changed**: `core/analysis/launch/` (new): `targetKey.ts`, `launchControl.ts` (AbortController + 10 min deadline + teardown stack per session, signal carried to the Python spawn via AsyncLocalStorage), `analysisTypes.ts` / `launchKinds.ts` / `storageFolders.ts` (descriptors; server capabilities, default controller views and router snapshot probes are derived). `launchPipeline.ts` is a transaction: server before watcher for every kind, rollback newest first, one error toast, silent on Close. Registry reserves the target before its first await. SSE + file map keyed by session id; `sessionServerManager.ts` and `sseNotificationManager.ts` deleted; close path matches servers by `metadata.sessionId` only. Startup cleanup sweeps the folders the launchers write.

**Measured**: ESLint warnings 158 → 155 (budget `--max-warnings` lowered to 155); guardrails any.total 84 → 83, complexity.over10 53 → 52 (baseline regenerated). New suite `test/analysis/launchTransaction.test.cjs` (15 tests). Not done here: progress notifications are not cancellable (Close Analysis is the cancel path); LAUNCHER-11 belongs to another story.

### XR bug-fix epic #72 — S6 cancellable jobs (#78) [confirmed by unit tests] (2026-11-25, PR #91 merged into `v1.2.1`)

**What changed**: `core/analysis/launch/jobRunner.ts` (new) replaces `SingleJobGate`: atomic `tryReserve` before the first await, cancel that reaches the Git/Python children through the launch signal, a deadline per job (evolution 30 min, comparison 15, dependency graph 10), late results discarded, slot held until the work ends (grace 5 s). Per-revision watchdog (5 min) and per-Git-command timeout (3 min); a cancelled analysis is never recorded as a deterministic exclusion. Evolution and comparison runtimes gained Cancel. `projectEvolutionArtifacts.ts` split out of the service (filesOver500 must not grow).

**Measured**: `npm test` 1,135/1,135; ESLint warnings 155 → 154 (budget lowered). Not done: the real Python kill path needs a manual check; HIST-10 and the piling-up dependency dataset revisions (second half of DEPGRAPH-9) are out of scope.

### XR bug-fix epic #72 — S9 panels without overlaps (#81) [confirmed by unit tests + a real A-Frame page] (2026-11-25, branch `claude/project-thread-kvvyg6-panels`)

**What changed**: new runtime part `virtual-screen/virtualScreenRuntime/placementRegistry.js`: the obstacle registry (other screens, any shown entity tagged `data-codexr-panel-obstacle`, the analysis table plus 2.2 m of chart headroom), an oriented-box separating-axis test replacing the 9-point sampling against obstacles, `findFreePlacement` (right, left, up, rings of one screen size plus 0.25 m) used by add/Bring, and an escape so a screen already inside an obstacle is not frozen. Follow now goes through `constrainPosition`. Added screens read the scene config (`readSceneConfig`, JSON script first) and label with their display name. Dependency-graph legend: `legendSlotPosition` gained `maxRows` (2), pinned cards a close button; the legend board and the evolution playback overlay register as obstacles.

**Measured**: `npm test` 1,138/1,138; ESLint warnings unchanged at 154. In Chromium + A-Frame 1.7.1 (scratch page, not committed): before, two added screens both at (0, 2.30, -10.20); after, (0, 2.40, -10.40) and (5.05, 2.40, -10.40); with the table in front of the user the screen goes above the chart volume (y 5.35); a followed screen stops at another screen. Not done: text sizes for VR legibility need a headset (manual guide); the evolution overlay keeps its fixed position (now an obstacle, not moved).

7 changes: 7 additions & 0 deletions apps/vscode-extension/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@
- A double click on Generate or Compare, or two participants starting at once, no longer shows an error to everyone while the first job runs: "already running" goes only to the person who asked. A participant who joins mid-job sees it running.
- A cancelled analysis is no longer recorded as "this revision has no data", which hid that commit from both Git pickers until the session ended.
- Git-history exports no longer wait forever on one file: a file analysis is stopped after 2 minutes and retried once, and a Python worker that is slow to start (antivirus on Windows) reduces the number of workers instead of failing the export.
- **Panels in the XR room no longer land on top of each other or on the table.**
- Two screens added with **+ Add screen** used to appear in exactly the same spot, one hidden inside the other. An added or brought screen (**+ Add screen**, **Bring**) now goes to the nearest free spot beside the one in front of you: to the right, to the left, then above.
- Screens now keep clear of the analysis table and the space its charts stand in, the project evolution playback banner, and the dependency graph's card stack, as well as of walls and other screens.
- A screen set to **follow** you now stops at walls and other screens like a dragged one, instead of passing through them.
- Two screens turned toward you at an angle could still pass through each other while you dragged or followed them. The collision check now compares the whole panel, not a few points on it.
- Added screens now use the scene's screen settings (sizes, distance in front of you, collision) instead of built-in defaults, and their idle label shows the screen's name ("vscreen 2") instead of an internal id.
- Dependency graph cards now have a close button (**X**, at the top-right corner of a pinned card). The stack stays at most two rows high and grows sideways, so six pinned cards no longer climb through the ceiling.
- A source file of the XR chart-mapping runtime contained a raw control character typed into a string. Behaviour was correct, but the file was invisible to code search and review tools. It now uses the equivalent escape sequence; the runtime value is identical.

## [1.2.0] - 2026-07-30
Expand Down
1 change: 1 addition & 0 deletions apps/vscode-extension/templates/components/COMPONENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ its parts directory. Manual harnesses load assembled copies from
- `codexr/virtual-screen/virtualScreenRuntime.js`
- Owns a shared virtual screen and screen broadcast interaction. Also the base for screen subtypes: `contentKind: 'fixed'` + `registerContentProvider(id, build)` hosts immutable locally-rendered content (no video surface, no share button) while inheriting chrome, drag/resize, follow and the shared `screen` entity.
- Collision bumpers: look-at, drag and resize stop at the room shell (bounds derived from the `codexr-room` entity, `collisionBounds` override) and at other screens; dragging slides along obstacles. `collisionEnabled: false` opts out. **In `ar-mode` the room-derived bounds are skipped entirely** (checked live, before the cache, so desktop/VR keep the cached shell exactly as before and an explicit `collisionBounds` override still applies): screens move freely in the user's own space instead of bumping into invisible walls. Screen-vs-screen obstacles stay on in every mode.
- **Placement registry** (`placementRegistry.js` part, 1.2.1): the obstacles are other screens, every shown entity carrying `data-codexr-panel-obstacle` (a panel registers by carrying the attribute and releases by being hidden or removed: the project evolution playback overlay, the dependency graph's legend board) and `#codexr-analysis-table-geometry` extended upward by `tableChartHeadroom` (default 2.2 m, the standing charts). Obstacles are oriented boxes tested against the whole panel with the separating-axis test, not against sampled points (two screens crossing at an angle slipped between the points). **Placement** (`placeInFrontOfUser`: + Add screen, Bring) runs `findFreePlacement`: the front spot if free, else one screen size plus 0.25 m to the right, left, up, then further rings. **Follow** goes through the same bumper as drag. A screen whose current pose is already blocked moves and turns freely, so a panel appearing over it cannot freeze it. To make a new panel avoidable, tag its root entity; nothing else to register.
- Drag depth ("grab and reach"): while a `move` drag is live, the mouse wheel steps the screen along the camera→screen axis (`dragDepthStep`), and the **grabbing controller's thumbstick** does the same continuously — the handler only records the deflection (thumbstickmoved fires on change, not while held) and the drag loop applies `controllerDepthSpeed` m/s per frame; stick forward pushes away, and stick x slides the screen sideways along `depthAxis × up` at the same speed. Depth works by shifting the interaction PLANE (that is what slides the ray-plane intersection along the ray); the lateral offset must shift ONLY the screen's reference position — a plane shifted parallel to itself leaves the intersection untouched, so routing lateral through the plane moves the screen by a tiny depth-coupled residual instead (observed live). The depth target is clamped (`dragDepthMaxLead` against bumper accumulation, `dragDepthMinDistance` so pulling stops before the user's head); the lateral target gets the same lead clamp. A controller drag also claims its hand in `CodeXRStickGateRuntime` (that stick stops walking/turning; the other hand keeps its role) and holds the scene state `codexr-screen-drag` so `codexr-pointer-policy` never hands the laser away mid-grab — both released on every endDrag path.
- Media transport is chosen per viewer: same network → direct WebRTC; through the
tunnel → frames relayed by the server (`relayTransport.js` part, VP8/Opus via
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
var MAX_PINNED_LEGENDS = 6;
// cardHeight must cover the tallest rendered card (a navigable node card with
// 7 metrics + an action button is ~1.72) so grid rows never overlap.
// maxRows caps the stack at two rows: six pins grow sideways (3 per row)
// instead of climbing a third row through the ceiling (PANELS-7).
var LEGEND_SLOT = {
perRow: 2, cardWidth: 2.5, cardHeight: 1.85, gapX: 0.34, gapY: 0.3, originYOffset: 1.05, z: 0.18
perRow: 2, maxRows: 2, cardWidth: 2.5, cardHeight: 1.85, gapX: 0.34, gapY: 0.3, originYOffset: 1.05, z: 0.18
};
// Flow-particle catalogues — part of the SHARED room contract: the ids travel
// in the dependency-graph entity as `flowSize` / `flowSpeed` (validated by the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@
// ever rotating into each other (their relative layout never changes).
ensureLegendBoard: function () {
if (this.legendBoard?.isConnected) { return this.legendBoard; }
this.legendBoard = entity('a-entity', { class: 'codexr-legend-board' });
// Registered with the screens' placement registry (PANELS-5): a
// placed screen never lands on the card stack.
this.legendBoard = entity('a-entity', {
class: 'codexr-legend-board',
'data-codexr-panel-obstacle': 'dependency-legend-board'
});
this.legendBoardYaw = null;
this.el.appendChild(this.legendBoard);
return this.legendBoard;
Expand Down Expand Up @@ -81,6 +86,7 @@
var card = this.legendCards[key];
if (!card) { return; }
if (card.action?.parentNode) { card.action.parentNode.removeChild(card.action); }
if (card.closeButton?.parentNode) { card.closeButton.parentNode.removeChild(card.closeButton); }
root.CodeXRCommonRuntime?.hideTooltip?.(card);
if (card.connectorRoot?.parentNode) { card.connectorRoot.parentNode.removeChild(card.connectorRoot); }
if (card.root?.parentNode) { card.root.parentNode.removeChild(card.root); }
Expand All @@ -97,6 +103,8 @@
&& (record.data.kind === 'group' || record.data.kind === 'file' || record.data.syntheticExternal);
if (card.action?.parentNode) { card.action.parentNode.removeChild(card.action); }
card.action = null;
if (card.closeButton?.parentNode) { card.closeButton.parentNode.removeChild(card.closeButton); }
card.closeButton = null;
root.CodeXRCommonRuntime.updateTooltip(card, detail, slotPosition, {
width: LEGEND_SLOT.cardWidth,
columns: 2,
Expand Down Expand Up @@ -125,6 +133,27 @@
);
card.root.appendChild(card.action);
}
if (this.isPinned(selection)) {
// A pinned card closes on its own (PANELS-7): before, the only
// way out was finding its node again or the global clear.
var self = this;
var pinnedSelection = { type: selection.type, id: selection.id };
card.closeButton = button(
'X',
// Just outside the top-right corner, inside the grid gap (0.28
// wide < gapX 0.34): it never covers the title or a neighbour.
(LEGEND_SLOT.cardWidth / 2 + .17) + ' ' + (card.height / 2 - .14) + ' 0.03',
.28,
function (event) {
event.stopPropagation?.();
if (self.isPinned(pinnedSelection)) { self.togglePinnedSelection(pinnedSelection); }
},
'#475569'
);
card.closeButton.setAttribute('height', .28);
card.closeButton.setAttribute('data-codexr-role', 'legend-close');
card.root.appendChild(card.closeButton);
}
},
// Re-place every visible legend into a non-overlapping grid slot above the
// graph, drop cards whose selection is gone, and refresh the shared visuals.
Expand All @@ -149,6 +178,7 @@
if (!card) { return; }
var slot = root.CodeXRCommonRuntime.legendSlotPosition(index, active.length, {
perRow: LEGEND_SLOT.perRow,
maxRows: LEGEND_SLOT.maxRows,
cardWidth: LEGEND_SLOT.cardWidth,
cardHeight: LEGEND_SLOT.cardHeight,
gapX: LEGEND_SLOT.gapX,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
id: 'codexr-project-evolution-playback-overlay',
position: '0 3.35 -18',
visible: 'false',
'data-codexr-role': 'project-evolution playback-overlay'
'data-codexr-role': 'project-evolution playback-overlay',
// Registered with the screens' placement registry while shown (PANELS-9).
'data-codexr-panel-obstacle': 'project-evolution-overlay'
});
overlay.appendChild(entity('a-plane', {
width: 6.2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,12 @@
},

buildRuntimeInitConfig: function (instanceId, options) {
const sharedConfig = root.__CODEXR_VIRTUAL_SCREEN_CONFIG__ || {};
// Same source as the scene's own screens (the JSON config script):
// the global alone is unset in the XR templates, so added screens
// used to fall back to the runtime defaults (PANELS-8).
const sharedConfig = this.runtimeFactory?.readSceneConfig?.(root)
|| root.__CODEXR_VIRTUAL_SCREEN_CONFIG__
|| {};
const collaborationConfig = root.__CODEXR_COLLABORATION_CONFIG__ || {};
const transform = options?.transform || {};
const position = transform.position || options?.anchoredPosition || sharedConfig.anchoredPosition || { x: 0, y: 8, z: 6 };
Expand Down Expand Up @@ -572,7 +577,7 @@
},
labels: {
...(sharedConfig.labels || {}),
idle: options?.idleLabel || `${instanceId}: choose source independently.`,
idle: options?.idleLabel || `${options?.displayName || instanceId}: choose source independently.`,
},
};
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@
return;
}
el.object3D.updateMatrixWorld(true);
obstacles.push({
inverseMatrix: el.object3D.matrixWorld.clone().invert(),
halfExtents: { x: width / 2, y: height / 2, z: 0.15 },
});
const center = new global.THREE.Vector3();
const orientation = new global.THREE.Quaternion();
el.object3D.getWorldPosition(center);
el.object3D.getWorldQuaternion(orientation);
obstacles.push(orientedBox(center, orientation, width / 2, height / 2, 0.15));
});
collectPanelObstacles(obstacles);
refs.obstacleCache = obstacles;
refs.obstacleCacheTime = now;
return obstacles;
Expand All @@ -98,12 +100,16 @@
const effectiveWidth = Number(width) > 0 ? Number(width) : state.screenWidth;
const w = effectiveWidth / 2;
const h = (effectiveWidth / refs.config.aspectRatio) / 2;
return [
const points = [
[-w, -h], [w, -h], [-w, h], [w, h],
[0, -h], [0, h], [-w, 0], [w, 0], [0, 0],
].map(([x, y]) => new global.THREE.Vector3(x, y, 0)
.applyQuaternion(worldQuaternion)
.add(worldPosition));
// The points test the room shell (a box contains the panel when it
// contains its corners); the box tests the obstacles.
points.box = orientedBox(worldPosition.clone(), worldQuaternion, w, h, 0.02);
return points;
}

function violatesCollision(samplePoints) {
Expand All @@ -117,15 +123,12 @@
}
}
}
const local = new global.THREE.Vector3();
if (!samplePoints.box) {
return false;
}
for (const obstacle of getScreenObstacles()) {
for (const point of samplePoints) {
local.copy(point).applyMatrix4(obstacle.inverseMatrix);
if (Math.abs(local.x) < obstacle.halfExtents.x
&& Math.abs(local.y) < obstacle.halfExtents.y
&& Math.abs(local.z) < obstacle.halfExtents.z) {
return true;
}
if (orientedBoxesOverlap(samplePoints.box, obstacle)) {
return true;
}
}
return false;
Expand All @@ -141,6 +144,9 @@
if (!violatesCollision(collectScreenSamplePoints(worldPosition, targetQuaternion))) {
return targetQuaternion;
}
if (isCurrentPoseBlocked()) {
return targetQuaternion;
}
const currentQuaternion = getWorldQuaternion(refs.root);
if (!currentQuaternion?.clone) {
return targetQuaternion;
Expand All @@ -167,6 +173,9 @@
if (!violatesCollision(collectScreenSamplePoints(targetWorldPosition, orientation))) {
return targetWorldPosition;
}
if (isCurrentPoseBlocked()) {
return targetWorldPosition;
}
const current = getWorldPosition(refs.root);
if (!current?.clone) {
return targetWorldPosition;
Expand Down Expand Up @@ -301,7 +310,7 @@
}
state.follow = false;
state.followTransform = followTransform;
if (!applyFollowTransform()) {
if (!applyFollowTransform({ resolveFreeSpot: true })) {
console.log('[CodeXR][VirtualScreen] placeInFrontOfUser failed: applyFollowTransform returned false', {
screenId: getScreenId(),
followTransform: {
Expand Down Expand Up @@ -560,7 +569,7 @@
};
}

function applyFollowTransform() {
function applyFollowTransform(options) {
if (!state.followTransform?.position?.clone) {
console.log('[CodeXR][VirtualScreen] applyFollowTransform failed: missing followTransform position', {
screenId: getScreenId(),
Expand All @@ -581,9 +590,18 @@
return false;
}

const targetWorldPosition = state.followTransform.position.clone()
const desiredWorldPosition = state.followTransform.position.clone()
.applyQuaternion(cameraWorldQuaternion.clone())
.add(cameraWorldPosition.clone());
// A placement looks for a free spot; following is a bumper like
// dragging, so a followed screen no longer passes through walls,
// screens, panels or the table (PANELS-3).
const targetWorldPosition = options?.resolveFreeSpot === true
? findFreePlacement(
desiredWorldPosition,
computeFaceUserQuaternion(desiredWorldPosition, cameraWorldPosition),
)
: constrainPosition(desiredWorldPosition);
const targetWorldQuaternion = computeFaceUserQuaternion(targetWorldPosition, cameraWorldPosition);
const applied = applyWorldTransform(refs.root, targetWorldPosition, targetWorldQuaternion);
if (applied && updateLegendSide()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"webrtcPeers.js",
"relayTransport.js",
"signalingAndRemote.js",
"placementRegistry.js",
"followAndTransform.js",
"pointerAndDrag.js",
"wiringAndApi.js"
Expand Down
Loading
Loading