feat: retain live page mounts and update shared UI references across aliases
Verify Tessera GUI / verify (push) Failing after 7m13s

This commit is contained in:
2026-10-20 20:58:41 +08:00
parent 9d3f766275
commit 757fa22d9b
8 changed files with 528 additions and 95 deletions
+29 -9
View File
@@ -136,11 +136,14 @@ 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 constructed node is initialized once.
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 retains its bounded pool until reset;
it still publishes static native snapshots when render is called.
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.
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
@@ -164,7 +167,7 @@ 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 static snapshot UI and one live Console VM on the existing worker.
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,
source budgets and VM instruction limits are not a complete untrusted-code sandbox.
@@ -187,7 +190,7 @@ appears directly below. Shift-Enter inserts a newline. Each command and its resu
are followed by a thin neutral horizontal separator. Input focus uses a text caret,
without a blue field border or hover fill. The prompt, history and caret share the
same scroll offset; typing and cursor navigation reveal the current insertion point.
Create objects with bare assignment or `let`, then render them when ready:
Create objects with bare assignment or `let`, then mount them when ready:
```endor
title = ui.text("你好,Tessera", 2, "#243047")
@@ -203,6 +206,22 @@ page = ui.page()
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
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
`card = ui.rect(640, 200, 32)` updates the page without another render. This is
shared-reference semantics, not variable-name tracking. Assigning a non-UI value
uses normal value assignment; it does not unmount the old UI reference.
`page.render(root)` mounts a live root and selects its page. Changes to mounted
references publish a new frame after a successful input; unrelated objects do not.
`page.unmount()` releases that page's mount and clears the frame if it was active.
Replacing a container updates its whole mounted position. Repeated aliases are
allowed; replacements that would create a cycle or exceed graph limits are rejected
before mutation. Scalar constructor arguments are evaluated once, as ordinary values.
Bare assignment creates/updates a name; `let` remains a declaration. Aster owns this
syntax, AST and bytecode; Tessera never inserts `let` or replays history. The actual
last value is also bound to `_`. Text editing supports cursor positioning, arrow
@@ -211,15 +230,16 @@ Up/Down recall single-line history; Command/Control-Up/Down recall multiline his
Console sends `POST /v1/namespaces/app.main/repl` as UTF-8 text/plain. Responses
include value, session/input IDs, bindings, `persistent: true`, rendered flag and
revision. Object creation alone never publishes a page or advances revision.
`page.render` publishes the last render only after the input succeeds. Syntax and
revision. Before the first mount, object creation never publishes a page or advances revision.
After mounting, changed shared UI references publish automatically. The last explicit
render in an input selects the active page, only after that input succeeds. Syntax and
compilation errors run no statements; runtime errors can retain earlier successful
statements from that input, while preserving the previously displayed page.
Reset session (`DELETE .../repl`) drops the VM and all bindings/objects, preserving
the displayed native snapshot. Clear only hides the transcript. Limits per session
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 pages; reset reclaims the whole pool. Code and objects are never stored on disk.
and 64 retained pages. Unused slots 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