feat: render top-level Endor scripts through embedded Aster
Verify Tessera GUI / verify (push) Failing after 6m52s
Verify Tessera GUI / verify (push) Failing after 6m52s
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
# Tessera
|
||||
|
||||
Tessera is a native desktop UI host embedding [Aster](vendor/aster/README.md).
|
||||
Agents submit ordinary Endor source through a local namespace API. Aster parses,
|
||||
compiles and executes it; `main` returns a Tessera UI object. Tessera extracts a
|
||||
Agents submit ordinary Endor scripts through a local namespace API. Aster parses,
|
||||
compiles and executes them; `ui.page().render(root)` selects a Tessera UI tree. Tessera extracts a
|
||||
native tree, lays it out and draws it using the existing software renderer.
|
||||
The initial page is empty.
|
||||
|
||||
@@ -33,8 +33,15 @@ cargo build --release --locked
|
||||
Cargo compiles the required Aster libraries together with Tessera. No separate
|
||||
Aster build, service or deployment is required. Local builds download dependencies
|
||||
from official crates.io; do not substitute a mirror. Docker and automated tests
|
||||
are not used locally. On macOS this produces a native executable, not an `.app`
|
||||
bundle or installer.
|
||||
are not used locally. The command above produces a native executable. To create a
|
||||
Finder-launchable development app on macOS, run:
|
||||
|
||||
```bash
|
||||
sh scripts/build-macos-app.sh
|
||||
```
|
||||
|
||||
Open `target/release/Tessera.app`. See [packaging](scripts/README.md); this local
|
||||
bundle does not include distribution signing, notarization or an installer.
|
||||
|
||||
The API listens only on `127.0.0.1:4737`. Start integrations with its live guide:
|
||||
|
||||
@@ -52,30 +59,39 @@ PUT /v1/namespaces/app.main/code
|
||||
DELETE /v1/namespaces/app.main/code
|
||||
```
|
||||
|
||||
Submit the [complete example](examples/hello.endor):
|
||||
Submit the [complete example](examples/page.endor):
|
||||
|
||||
```bash
|
||||
curl --request PUT --header 'Content-Type: text/plain; charset=utf-8' \
|
||||
--data-binary @examples/hello.endor \
|
||||
--data-binary @examples/page.endor \
|
||||
http://127.0.0.1:4737/v1/namespaces/app.main/code
|
||||
```
|
||||
|
||||
A minimal program is:
|
||||
|
||||
```endor
|
||||
function main(): View {
|
||||
let title = ui.text("Hello Endor", 2, "#242422")
|
||||
let rectangle = ui.rect(240, 80, 12, "#DCE8FF")
|
||||
return ui.column(24, 12, title, rectangle)
|
||||
}
|
||||
let heading = ui.text("Hello Endor", 2, "#242422")
|
||||
let rectangle = ui.rect(240, 80, 12, "#DCE8FF")
|
||||
let myui = ui.page()
|
||||
myui.render(ui.column(24, 12, heading, rectangle))
|
||||
```
|
||||
|
||||
The namespace comes from the request path. `ui` is a host global declared to
|
||||
Aster's compiler and injected into the candidate VM. Function declarations,
|
||||
helper calls, local variables, member reads and positional arguments use Aster's
|
||||
existing language implementation. `View` is currently a syntactic annotation;
|
||||
Tessera validates the actual returned object. This does not add syntax to Endor.
|
||||
The sample file is client-side material; the API itself stores source by namespace.
|
||||
Aster's compiler and injected into the candidate VM. Top-level variables share
|
||||
that VM's globals within this source submission. No `main` wrapper is generated.
|
||||
Complete top-level inputs are separated by newlines; multiline calls and function
|
||||
bodies are grouped before being handed to Aster's existing Interactive parser and
|
||||
compiler. Expression continuations such as a member read on the following line
|
||||
remain in the same input. Aster still owns every token, syntax rule, AST and
|
||||
bytecode operation; the host only batches inputs and restores original AST offsets.
|
||||
|
||||
The older [main-returning-View example](examples/main.endor) and the richer
|
||||
[function example](examples/hello.endor) remain supported. A source consisting
|
||||
entirely of function declarations uses Aster's Module entry and calls zero-argument
|
||||
`main`. Mixed function declarations, bindings and expression statements use
|
||||
Interactive inputs in source order. Type annotations remain syntactic in Aster;
|
||||
Tessera checks actual UI values. The sample files are client-side material; the
|
||||
API itself stores source by namespace.
|
||||
|
||||
## UI host API
|
||||
|
||||
@@ -89,29 +105,37 @@ not Endor keyword argument syntax.
|
||||
| `ui.column` | Padding, gap, followed by zero or more UI children |
|
||||
| `ui.row` | Padding, gap, followed by zero or more UI children |
|
||||
| `ui.spacer` | Size |
|
||||
| `ui.page` | No arguments; creates a page with a bound `render(root)` member |
|
||||
|
||||
Colors are `#RRGGBB` or `#RRGGBBAA`. Dimensions are finite numbers in 0..1000000.
|
||||
A namespace has one displayed page. If a script creates several pages or renders
|
||||
more than once, its final successful render selects the visible root. Rendering
|
||||
does not publish partial execution: a later error rejects the entire submission.
|
||||
|
||||
Aster keeps its exact numeric representation; conversion occurs only at the UI
|
||||
boundary. Text uses the current bitmap renderer, with Chinese fonts still pending.
|
||||
|
||||
## Candidate execution and publication
|
||||
|
||||
A dedicated worker performs source parsing, AST budget checks, compilation,
|
||||
module initialization and zero-argument `main` execution in a fresh VM. It checks
|
||||
the returned UI node, extracts native data, builds and validates the frame, then
|
||||
A dedicated worker performs source parsing, AST budget checks and compilation in
|
||||
a fresh candidate VM. It executes each script input with shared globals (or module
|
||||
initialization and zero-argument `main` for function-only source), checks the
|
||||
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 at most 4096 real UI objects per candidate. Each is initialized once.
|
||||
preallocates 4096 real UI node objects plus a separate 64-page pool with bound
|
||||
render callbacks per candidate. Each constructed node is initialized once.
|
||||
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. This bounded pool is for snapshot construction, not a persistent dynamic UI.
|
||||
|
||||
Limits are 1 MiB source, 10000 visited AST nodes with a 64-level visitor depth,
|
||||
4096 constructed UI nodes, 64 UI levels, 10000 expanded layout visits and 16 KiB
|
||||
per text. VM initialization and entry execution each have a 128-frame and 1000000-
|
||||
instruction budget. Repeated children count again during layout, preventing a
|
||||
4096 constructed UI nodes, 64 pages, 64 UI levels, 10000 expanded 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
|
||||
small shared tree from expanding without bound. The build queue holds eight
|
||||
pending requests.
|
||||
|
||||
@@ -144,7 +168,7 @@ maintain a second language AST.
|
||||
|
||||
Local native builds and window runs are allowed; do not run local automated tests
|
||||
or Docker. [Remote CI](.gitea/README.md) on ces-control runs the existing renderer
|
||||
checks and the new Aster execution, UI layout, source-range, lifetime, budget,
|
||||
checks and the new Aster script/module execution, page rendering, UI layout, source-range, lifetime, budget,
|
||||
failed-update and deletion-invalidation regressions, plus Clippy.
|
||||
The API regressions use actual HTTP requests, including DELETE while the worker
|
||||
is occupied and a queued PUT is superseded.
|
||||
|
||||
Reference in New Issue
Block a user