feat: retain managed visual objects and dispatch native input through Endor
Verify Tessera GUI / verify (push) Successful in 9m28s

This commit is contained in:
2026-10-21 01:49:35 +08:00
parent 757fa22d9b
commit 0d5e4b318d
21 changed files with 3295 additions and 892 deletions
+22 -18
View File
@@ -8,7 +8,7 @@ The initial page is empty.
## Source and library integration
`vendor/aster` is an unmodified Git submodule, pinned to an exact published commit.
`vendor/aster` is an independent Git submodule pinned to a published Aster commit.
Cargo path dependencies directly use its `frontend`, `compiler` and `core`
(library name `endor_core`) packages, which bring in `objects`. The Aster workspace
and history remain independent. See [vendor](vendor/README.md) for initialization
@@ -134,19 +134,16 @@ selected UI root, extracts native data, builds and validates the frame, then
cleans up all VM roots. The window receives no VM handles. It relays out the owned
native tree during redraw and display scale changes without rerunning Endor.
The existing callback interface has no allocator access. Tessera therefore
preallocates 4096 real UI node objects plus a separate 64-page pool with bound
render callbacks per candidate. Each occupied slot owns one live UI reference.
Constructors return those borrowed handles; Aster retains call results under its
existing rules. Native child data owns its own lifetime and contains no managed
VM edges. Each complete PUT gets a new pool. Console keeps live shared UI references
and page mounts. Native mount/child edges register explicit Aster retain/release
roots; unused VM pool slots are recycled only after no managed or native owner
needs them. A recycled slot gets a fresh native cell. Detached branches are freed
when their last owner disappears; reset releases the session's roots.
Aster's scoped NativeContext allocates actual managed Block objects on demand.
Blocks own managed Cells and data objects; child, history and forwarding edges
are traced by the same VM collector. Native methods capture their owner through
declared heap edges. No fixed node/page pool or separate mutable Arc graph remains.
The desktop's tab registry holds open Pages. close releases that registry edge;
referenced Pages remain usable and unreferenced cycles are collected between inputs.
The bridge's diagnostic object index uses non-owning WeakObjectRef values.
Limits are 1 MiB source, 10000 visited AST nodes with a 64-level visitor depth,
4096 constructed UI nodes, 64 pages, 64 UI levels, 10000 expanded layout visits
4096 retained visual objects, 64 retained pages, 10000 expanded graph/layout visits
and 16 KiB per text. Every execution has a 128-frame limit. Script inputs each
receive an equal share of a total 1000000-instruction allowance; function-only
module initialization and main execution each retain a 1000000-instruction budget. Repeated children count again during layout, preventing a
@@ -167,12 +164,20 @@ rejected queue entries do not invalidate accepted work. Failed builds do not
increment the committed revision. A worker-caught panic discards the entire
candidate and returns 500, retaining the previous document.
This stage supports live mounted UI in the Console VM and immutable window frames on the existing worker.
Event callbacks, window-size language inputs and process isolation are future work. Worker threads,
This stage supports live mounted UI for both complete programs and Console inputs, with immutable window frames on the existing worker.
Native mouse/keyboard activation and code-driven callbacks share onClick/click. Managed Mount objects expose each occurrence, and property dependencies and measurement caches avoid recomputing clean visual subtrees. Arrangement still traverses occurrences.
Tab chrome/multiple windows, native class allocation inheritance and trait definitions, window-size language inputs and process isolation are still being implemented. Worker threads,
source budgets and VM instruction limits are not a complete untrusted-code sandbox.
## Developer tools
Native visual protocols are under active implementation: Text/Rect/Row/Column,
container append/remove/replace/move, Page open/close/navigation, ui.present,
ui.state(value), ui.textOf(state, "value"), and button.onClick/click are available
in the persistent Console. Method bodies can call other methods without a trailing
return. Bound text tracks its source property; clean derived subtrees and unchanged measurements are reused. Buttons have a native background, focus ring and pointer/keyboard activation.
`Page()`, `TextBlock(...)`, `Row(...)`, `Column(...)` and `Button(...)` are callable managed type objects; `Page.base` is ContainerBlock and `page.type` is Page. `isInstance(page, Block)` and `isSubtype(Page, Block)` query nominal relations. Object and Type are explicitly bootstrapped in the same GC heap. Ordinary source class declarations, positional field construction, member assignment and inherited method dispatch are supported; native allocator subclasses and traits are still pending. Native visual methods now live on their nominal type tables and use the same receiver binding as source methods. See [managed-types.endor](examples/managed-types.endor) and [classes.endor](examples/classes.endor).
Toggle developer tools with Command-Option-I or F12 on macOS, Control-Shift-I or
F12 on Windows/Linux. The compact Console, Sources, Network and Settings tabs
share a draggable dock edge. The Sources tree/source
@@ -207,7 +212,7 @@ page.render(ui.column(24, 16, title, note, card))
```
Ordinary values keep normal name assignment. UI references opt into Aster's
`ObjectPayload::assign_from` protocol: assigning another UI object updates the
managed `ObjectPayload::assignment_cell` protocol: assigning another UI object updates the
existing shared reference and preserves its identity. Aliases and mounted parents
therefore observe the same replacement, including across function-local slots.
For example, after `other = card` and `page.render(other)`, assigning
@@ -239,11 +244,10 @@ statements from that input, while preserving the previously displayed page.
Reset session (`DELETE .../repl`) drops the VM and all bindings/objects, preserving
the displayed immutable frame. Clear only hides the transcript. Limits per session
are 256 executed inputs, 1 MiB transcript, 10000 cumulative AST nodes, 4096 UI nodes
and 64 retained pages. Unused slots are reclaimed between inputs; reset releases the whole session. Code and objects are never stored on disk.
and 64 retained pages. Unreachable objects and cycles are reclaimed between inputs; reset releases the whole session. Code and objects are never stored on disk.
Existing `PUT .../code` remains a complete program replacement with a fresh VM;
function-only source still invokes main. Accepted PUT/code DELETE invalidate the
Console context and older queued Console inputs. The compatibility `POST .../evaluate`
function-only source still invokes main. On success the new VM remains live for Console and GUI events; a failed replacement preserves the old VM. Accepted PUT/code DELETE invalidate older queued Console inputs. The compatibility `POST .../evaluate`
endpoint remains isolated for existing clients, but is not a Console mode. All use
the bounded eight-entry worker queue. GET /code returns the displayed source: exact
PUT source, or annotated Console transcript after a REPL render, distinguished by