Files
endorphin-tessera-gui/src/README.md
T
2026-10-20 16:42:12 +08:00

4.1 KiB

Tessera source

Module Responsibility
main.rs Native window event loop, namespace state and API startup
api.rs Code CRUD, isolated expression endpoint, eight-entry worker queue, request observation and diagnostics
activity.rs Bounded in-memory HTTP exchanges with marked previews and allowlisted request headers
endor_host.rs Aster compilation, fresh candidate VM, bounded script/module execution, root cleanup and AST developer tree
endor_script.rs Batch complete inputs for Aster's Interactive parser/compiler, retain Module entry, and rebase Aster spans to the original snapshot
ui_bridge.rs Tessera UI/page payloads and bound render methods, preallocated node/page pools and native snapshot extraction
layout.rs Native UI tree to Frame; expanded-tree and coordinate budgets
document.rs Published source/AST/UI snapshot, revisions, invalidation, frame validation and display commands
app.rs Window events, redraw and developer-tools input
scene.rs Page and developer-tools display-list composition
developer_tools.rs Console input/transcript, full Sources, Network inspector, theme, pane/scroll geometry and focus
sources.rs Disconnected cloud workspace and provider boundary for listing/opening complete source files
display_list.rs Rendering primitives and color representation
geometry.rs Native points and rectangles
software_renderer.rs Software rasterization and nested rectangular clipping for independently scrolling panes
text.rs Shared system font discovery, shaping, real measurements, antialiased glyphs and bounded caches
README.md Module map

Aster is an unmodified source submodule. Language parsing, AST definitions, compilation, bytecode and VM execution come from its libraries. Tessera implements only host UI behavior and layout. No CLI, HTTP server or Docker process is needed to execute Endor in the application.

An execution candidate owns all external VM roots, including the 4096-node pool and 64 pages with bound render callbacks. Script units share one globals dictionary inside the candidate; no variables or VM handles persist across successful PUTs. Callbacks return borrowed, preallocated real VM objects. Their mutable slots hold immutable native UI descriptions; child edges contain owned native Arcs, never managed VM references. Page rendering stores native root data in the build session; the final render selects the snapshot after all script units succeed. Once extraction finishes, release temporary results, clear globals, release roots, collect cycles and require an empty VM. The window keeps only source, developer metadata, frame commands and native UI data.

Tests in api.rs execute real HTTP CRUD and a controlled queued-PUT/DELETE race without opening a window. Tests in endor_host.rs cover lifecycle, direct script and module entry, page methods, multiline inputs, original source ranges, malformed input, entry checks, budgets, failure preservation and stale-result invalidation. They run only in remote CI. Font tests in text.rs and software_renderer.rs cover real advances, multiline height, fractional scaling, CJK fallback, grapheme-safe fitting, antialiasing and transparency. A process-wide mutex keeps font discovery, shaping and glyph caches shared between the worker's layout and window redraw. The 256-string/512-KiB source cache and 4096-glyph/32-MiB image cache are discarded when their budgets are exceeded. See the project guide for public behavior.

The expression endpoint deliberately uses Aster's Expression entry in a fresh VM; it has no host UI, no history replay and no published document. API observation notifies the window for accepted and completed requests, including failures. The worker still owns source compilation and snapshot publication. Console sends real loopback HTTP requests on a separate client thread and reports transport failures through the native event loop. CloudSourceProvider is an optional host-side adapter, not a cloud service. A future network adapter should deliver cached/asynchronous results to the workspace rather than block the native event loop during I/O.