session
The bot being built in the garage, and every edit to it. It holds one live v2 design per peer and provides:
editor.session
The bot being built in the garage, and every edit to it. It holds one live v2 design per peer and provides:
- part operations: add, remove, set a field, translate, duplicate, mirror a part, unlink a twin, replace the whole design, and set the name, number or paint;
- mirror symmetry with linked twins across the centre line;
- snapping;
- continuous drags recorded as a single undo step;
- undo and redo (up to 100 steps);
- selection;
- change listeners;
- a cached
bots.designderive of the live design.
Both the 3D build view (editor/) and the garage panels (screens/) edit the design only through this module, so every surface shares one history and one selection.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2strict
emit(kind: string, ids: { string }?) → void
| arg | type | description |
|---|---|---|
| kind | string | |
| ids | { string }? |
findPart(id: string) → void
| arg | type | description |
|---|---|---|
| id | string |
pushUndo( ) → void
renormalize( ) → void
open(design: any, slot: string?) → void
Start editing a copy of `design` (any v1/v2 design-shaped table). Clears undo/redo and selection. `slot` is an optional label (e.g. a save slot name) the garage keeps with it.
| arg | type | description |
|---|---|---|
| design | any | |
| slot | string? |
isOpen( ) → boolean
True while a design is open.
design( ) → any
The live design being edited (normalized v2). Treat as read-only: change it through the ops.
stats( ) → any
bots.design derive() of the live design, cached until the next change.
slot( ) → string
The slot label passed to open() or setSlot().
setSlot(slot: string?) → void
Change the slot label (after a save-as).
| arg | type | description |
|---|---|---|
| slot | string? |
on(fn: (any) → void
Subscribe to changes. `fn(change)` gets { kind = "open"|"add"|"remove"|"set"|"undo"|"redo"|"replace"|"select"|"meta"|"mirror", ids, design }. Returns an unsubscribe function.
| arg | type | description |
|---|---|---|
| fn | (any |
part(id: string) → any
A part of the live design by id (a copy, safe to read and modify locally).
| arg | type | description |
|---|---|---|
| id | string |
twinOf(p: any) → any
| arg | type | description |
|---|---|---|
| p | any |
syncTwin(p: any) → void
| arg | type | description |
|---|---|---|
| p | any |
add(typeName: string, fields: any?) → string
Add a part of `typeName` (fields as bots.parts.new takes). With mirror mode on and the part off the centre line, a linked mirror twin is added too. Selects the new part(s). Returns the new part's id (nil at the part limit).
| arg | type | description |
|---|---|---|
| typeName | string | |
| fields | any? |
remove(ids: { string }) → void
Remove parts (and their mirror twins). Clears them from the selection.
| arg | type | description |
|---|---|---|
| ids | { string } |
snapNum(v: number, step: number) → number
| arg | type | description |
|---|---|---|
| v | number | |
| step | number |
set(id: string, field: string, value: any, raw: boolean?) → any
Set one field of a part (and its mirror twin): "pos" | "rot" | "size" ({x,y,z}), "material", "param.<name>", "paint". Snaps pos/rot/size to the snap steps when snapping is on and `raw` is not true. Returns the value actually stored.
| arg | type | description |
|---|---|---|
| id | string | |
| field | string | |
| value | any | |
| raw | boolean? |
translate(ids: { string }, delta: { number }) → void
Move parts by a bot-space offset (twins move mirrored). One undo step unless inside a drag.
| arg | type | description |
|---|---|---|
| ids | { string } | |
| delta | { number } |
duplicate(ids: { string }, offset: { number }?) → void
Duplicate parts (offset by `offset`, default 5 cm along +X... or along the snap). Twins are duplicated as twins. Selects the copies. Returns the new ids.
| arg | type | description |
|---|---|---|
| ids | { string } | |
| offset | { number }? |
mirrorPart(id: string) → string
Give a part a linked mirror twin across x = 0 (no-op if it has one or sits on the centre line). Returns the twin's id.
| arg | type | description |
|---|---|---|
| id | string |
unlink(id: string) → void
Break a part's mirror link (both parts stay, edited independently from now on).
| arg | type | description |
|---|---|---|
| id | string |
replace(design: any) → void
Replace the whole design (load a preset or a saved build into the open session) as one undo step.
| arg | type | description |
|---|---|---|
| design | any |
setMeta(key: string, value: any) → void
Set the design's name, number or paint palette (key "name"|"number"|"paint.primary"|"paint.secondary"|"paint.accent"|"paint.pattern"|"paint.finish").
| arg | type | description |
|---|---|---|
| key | string | |
| value | any |
beginDrag(kind: string?) → void
Start a continuous edit (gizmo drag, slider drag): edits until endDrag() are one undo step and listeners see kind "set" each frame.
| arg | type | description |
|---|---|---|
| kind | string? |
endDrag( ) → void
End a continuous edit.
cancelDrag( ) → void
Cancel a continuous edit, restoring the design from its start.
dragging( ) → boolean
True while a continuous edit runs.
undo( ) → boolean
Undo the last edit. Returns false when there is nothing to undo.
redo( ) → boolean
Redo the last undone edit. Returns false when there is nothing to redo.
history( ) → void
How many undo and redo steps are available.
prune( ) → void
Drop selected ids that no longer exist.
select(ids: { string }, add: boolean?) → void
Select parts (replaces the selection; `add` true extends it, toggling ids already in it).
| arg | type | description |
|---|---|---|
| ids | { string } | |
| add | boolean? |
selection( ) → void
The selected part ids (a copy).
setMirror(on: boolean) → void
Mirror mode: new parts placed off the centre line get a linked twin.
| arg | type | description |
|---|---|---|
| on | boolean |
mirror( ) → boolean
setSnap(t: any) → void
Snap settings { move = metres, rotate = degrees, size = metres, enabled = bool } (partial tables merge).
| arg | type | description |
|---|---|---|
| t | any |
snap( ) → any
snapValue(kind: string, v: number) → number
Snap a single value with the current settings ("move" | "rotate" | "size").
| arg | type | description |
|---|---|---|
| kind | string | |
| v | number |
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Showing up to 3 levels deep. Open a part to see what it holds further down.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.