feat: add system widgets and a persistent native Console with bare assignments
Verify Tessera GUI / verify (push) Failing after 7m17s
Verify Tessera GUI / verify (push) Failing after 7m17s
This commit is contained in:
@@ -139,7 +139,8 @@ 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.
|
||||
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.
|
||||
|
||||
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
|
||||
@@ -163,8 +164,8 @@ 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. Event callbacks, persistent running VMs,
|
||||
window-size language inputs and process isolation are future work. Worker threads,
|
||||
This stage supports static snapshot UI and one live Console VM 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.
|
||||
|
||||
## Developer tools
|
||||
@@ -177,27 +178,57 @@ area has independent vertical and horizontal scrolling, draggable scrollbar thum
|
||||
and trackpad support. Shift-wheel scrolls horizontally. Layout uses logical pixels
|
||||
and the actual display scale; resize clamps pane sizes to keep controls reachable.
|
||||
|
||||
Console is the default execution transcript. Type an expression, press Enter to
|
||||
run, or Shift-Enter for a newline. Switch to Script mode to PUT a **complete source
|
||||
replacement** that renders a page. Arrow keys, Home/End, grapheme-safe deletion,
|
||||
selection of all input, macOS copy/cut/paste and IME composition are supported.
|
||||
Up/Down recall single-line history; Command/Control-Up/Down also recall history in
|
||||
multiline input. Clicking the editor positions the caret. HTTP requests from other
|
||||
clients appear in the same transcript with input, result, error and diagnostics.
|
||||
Clear hides the displayed transcript; history stays in memory for this window.
|
||||
Transport failures are shown beside the editor and restore an otherwise empty draft.
|
||||
Console is one live execution context: statements, function definitions and
|
||||
expressions use the same VM and globals dictionary across submissions. There is no
|
||||
Expression/Script selector. Enter runs the input; Shift-Enter inserts a newline.
|
||||
Create objects with bare assignment or `let`, then render them when ready:
|
||||
|
||||
Expression mode sends `POST /v1/namespaces/app.main/evaluate` as `text/plain`.
|
||||
It accepts exactly one Aster expression and returns JSON with `value`,
|
||||
`execution: "isolated-expression"` and `persistent: false`. It uses a disposable VM,
|
||||
without `ui` or previous bindings, and never changes the page or committed revision.
|
||||
For example, `"Hello Endor"` and `42` return values. Language operations unsupported
|
||||
by the pinned Aster compiler (currently including numeric arithmetic bytecode)
|
||||
produce actual diagnostics. Evaluation shares the eight-entry execution queue.
|
||||
**Persistent REPL sessions are not connected.** Console history is a transcript,
|
||||
not VM state; Tessera never replays old input to simulate persistence.
|
||||
```endor
|
||||
title = ui.text("你好,Tessera", 2, "#243047")
|
||||
```
|
||||
|
||||
Sources shows the full last successful source snapshot with line numbers, Aster's
|
||||
At this point the object exists in Console memory and the page stays unchanged.
|
||||
Later inputs can refer to it:
|
||||
|
||||
```endor
|
||||
note = ui.text("这是 Endor 渲染的页面", 1, "#637082")
|
||||
card = ui.rect(320, 100, 16, "#DCE8FF")
|
||||
page = ui.page()
|
||||
page.render(ui.column(24, 16, title, note, card))
|
||||
```
|
||||
|
||||
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
|
||||
keys, Home/End, grapheme-safe deletion, select-all, macOS copy/cut/paste and IME.
|
||||
Up/Down recall single-line history; Command/Control-Up/Down recall multiline history.
|
||||
|
||||
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
|
||||
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
|
||||
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.
|
||||
|
||||
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`
|
||||
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
|
||||
`X-Tessera-Source-Kind`. The transcript shows actual executed input and can contain
|
||||
failed statements; it is not guaranteed to replay as a standalone program.
|
||||
|
||||
External HTTP activity appears in the same transcript. Unsupported language
|
||||
operations (currently numeric arithmetic bytecode) show actual diagnostics. Transport
|
||||
failures appear beside the editor and restore an otherwise empty draft.
|
||||
|
||||
Sources shows the full source snapshot or Console transcript with line numbers, Aster's
|
||||
AST and selected source ranges. Selecting an AST node scrolls to its location while
|
||||
keeping the entire file available. Cloud files has a separate file navigator and
|
||||
source viewer, initially disconnected. The `CloudSourceProvider` boundary in
|
||||
@@ -219,6 +250,15 @@ Very bright custom colors are darkened to keep accents visible on white. Executi
|
||||
separators, selected tabs and focus indicators use the accent, while text keeps its
|
||||
readable neutral/error/success colors. Settings and source remain in memory only.
|
||||
|
||||
Management controls use the internal [Tessera System UI](src/system_ui/README.md)
|
||||
widget library, independent of Endor-controlled page widgets. Buttons, tabs,
|
||||
toggles, rows, input fields, color swatches and drag handles share hover, pressed,
|
||||
selected, focus and disabled presentation. Buttons activate on release inside;
|
||||
dragging outside cancels. Tab/Shift-Tab navigate enabled controls and Enter/Space
|
||||
activate focused buttons. Plain Tab still indents in the Console editor. Empty
|
||||
Run/Clear actions are disabled. macOS clipboard reads and writes explicitly use
|
||||
UTF-8 even when launched from Finder, and decoding errors are surfaced.
|
||||
|
||||
## Validation
|
||||
|
||||
Local native builds and window runs are allowed; do not run local automated tests
|
||||
|
||||
Reference in New Issue
Block a user