Files
endorphin-tessera-gui/src
2026-10-21 01:49:35 +08:00
..

Tessera source

Module Responsibility
main.rs Native window event loop, namespace state and API startup
api.rs Code CRUD, live Console/reset and compatibility evaluation endpoints, worker-owned session, request observation and diagnostics
activity.rs Bounded in-memory HTTP exchanges with marked previews and allowlisted request headers
endor_host.rs Aster compilation, fresh PUT candidates retained after successful publication, shared Console/program VM, bounded execution, root cleanup and AST developer tree for function/class/member assignment nodes
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 Managed nominal type constructors, shared type method tables and bound receiver dispatch, tab registry, Page lifecycle/navigation and immutable frame extraction
block.rs Aster-managed Block/Cell/data graph, stable child slots, shared assignment, cycle validation and explicit text bindings
snapshot.rs Property dependencies, reverse parent links and cached immutable visual derivation
mount.rs Managed per-occurrence contexts, weak reverse links, geometry and focus queries
events.rs Managed Event marker and bounded native input transport to the owning VM
layout.rs Iterative measurement/arrangement, stable occurrence IDs, measurement cache and geometry budgets
document.rs Published source/AST/UI snapshot, revisions, invalidation, frame validation and display commands
app.rs Window events, redraw and system widget pointer/keyboard/IME routing
clipboard.rs UTF-8 macOS clipboard adapter independent of Finder locale, with strict decoding and surfaced errors
system_ui/ Host-only management widget library: stable IDs, interaction, theme and reusable control drawing
scene.rs Page and developer-tools display-list composition
developer_tools.rs Unified Console prompt/output stream, caret/IME mapping, full Sources, Network inspector, theme, scrolling, overlay splitters 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 independent source submodule pinned to the published managed type/native-call implementation. 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.

A complete-PUT candidate owns the desktop and UI service roots, with dynamic Block allocation through scoped NativeContext. Block -> Cell -> data and all child/history/forwarding references are managed VM edges. Native functions declare their captured owner edges. The bridge holds only weak diagnostic references to allocated Blocks; the tab registry owns open Pages. Closing a tab releases that edge, without destroying a still-referenced Page. Console retains the actual VM; a successful complete PUT also retains its candidate as the active program, accessible from Console and native input. Failed PUT preserves the previous heap. Cleanup releases globals/service roots, collects cycles and requires an empty VM. Window frames contain only immutable native data.

Tests in api.rs execute real HTTP CRUD, persistent Console/reset/PUT isolation 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, live object identity, explicit rendering, compile-before-execute behavior 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.

The System UI library owns management control appearance and interaction. It imports no Endor runtime or guest UI bridge; developer tools supply typed actions and keep all execution/source behavior outside the widget layer.

Console sessions use endor_host::ReplSession on the same worker thread. Real VM globals, live Blocks and _ survive between inputs. Parse/compile precede execution; only a successful input commits a pending mount or publishes changes to an existing mount. Runtime-failed input can retain earlier completed bindings, but cannot publish its pending render. Session budgets cover cumulative source/AST and live Block counts. page.unmount releases current content; unreachable object cycles are reclaimed between inputs. Explicit reset drops the VM. Successful PUT replaces it with the fresh program; failed PUT restores the displayed program’s event epoch. Code DELETE invalidates the context. Source snapshots carry annotated AST ranges for the actual Console transcript; source history is never rerun to reconstruct memory. The Aster pin includes independent Assignment syntax and generic opt-in assign_from support. Live reference tests cover alias updates, nested mounts, cycle rejection, detached branch release and unmount/remount.