Brickheart-web BrickAgent handover
Project: /home/chinapal/brickheart-web/app · Reference repository: ~/bricknet
1. Original objective
Port as much of BrickAgent's functionality as practical into Brickheart-web using the existing TypeScript BrickNet port.
The first priority was assembly construction and attachment. The UI should let a user select parts and attach them interactively, but the implementation must reproduce BrickAgent's attachment semantics—not just snap two parts together.
Hard constraints from the original brief:
- Run entirely in the browser; no Python runtime or Python server dependency.
- Implement in TypeScript, reusing and extending the existing port.
- Establish test parity with the Python package's original tests.
- Read actual source and tests before deciding behavior; record command output and evidence rather than guessing.
- Audit the full BrickAgent package before deciding which functionality to port next.
2. Work completed and verified
TypeScript functionality
The existing port includes these modules, identified in the initial brief:
| Module | Responsibility |
|---|---|
src/snap/catalog.ts |
Connector kinds, subtypes, compatibility, connector frames, part information and aliases |
src/snap/pairs.ts |
World-coordinate connector flattening and connection-pair detection |
src/snap/graph.ts |
LDraw parsing, graph construction, edges, connected components and tree operations |
src/snap/mat.ts |
Rigid transforms, matrix operations, rotations and LDraw conversion |
src/snap/decode.ts |
Decoding functionality |
src/snap/path.ts |
Path functionality |
src/snap/place.ts |
Placement functionality |
The current attachment work adds or uses:
src/snap/agentload.ts— loads the generated agent data bundle.src/snap/relate.ts— generates joint and touch placement candidates.src/attach-ui.ts— attachment picker UI.src/build.ts— build page, scene, operations, selection and attachment integration.
Attachment behavior
The picker offers these relations:
- On / under
- Front / behind
- Left / right
It generates connector-compatible joint candidates and surface-touch candidates. The UI has a relation selector, candidate-position selector and placement action.
The attachment operation records the selected candidate's pose and whether it was a joint or touch placement. The operation history drives undo/redo.
Important scope distinction: the original BrickAgent attachment path includes flip, slide, yaw, seat, align and orient. The current UI's relation and candidate selection should not be treated as proof that every original argument or edge case is exposed and parity-tested.
Bundle and build integration
The agent bundle is generated and copied to:
dist/data/agent/bundle.json.gz
Reported checks
The user reported these results:
npm run typecheck— passed.npm run test:snap— 19 tests passed, 0 failed.- Placement parity test — 11,520 cases.
- Attachment scenarios — 134 cases.
- Production build — succeeded.
- Agent bundle — approximately 0.13 MiB.
- Database — approximately 12.0 MiB.
- Service worker — 38 files precached.
3. Build-page controls
The current build UI has:
- Pick and Place
- Delete
- Rotate 90° (RY)
- Undo and Redo
- Forward, Back, Left and Right
- Up/down one plate
- Up/down one brick
- Show parts wall
- Show baseplate
Added a missing second 90° rotation control in the vertical plane (RX).
4. Additional feature requests and future work
- Investigate MIRROR support, including which mirrored configurations are valid and when a different part is required.
Mirror is not interchangeable with rotation. It may require special handling for asymmetric parts and connector frames.
Collision detection
- Detect unintended geometry intersections.
- Distinguish valid connector engagement and designed overlap from collisions.
- Decide whether collisions should warn, block placement or remain informational.
- Test after attachment, movement and rotation.
Performance and UI
- Measure candidate-search time on large or connector-dense parts.
- Investigate the
LIMIT = 400candidate cap: the output limit does not necessarily bound the work needed to find candidates. - Test the picker with no compatible candidates, missing data and complex connectors.
- Verify localization and keyboard interaction.
- Check bundle loading and service-worker behavior on the actual deployed base path.