242 Commits

Author SHA1 Message Date
codex-bot 6d1ffdbcb4 docs: pin annotated Aster source for Nexus preparation 2026-11-15 20:08:30 +08:00
codex-bot 9caa94b562 docs: reconcile agent guide with resumable runtime behavior 2026-11-12 21:31:50 +08:00
codex-bot ec05424e22 docs: clarify agent guide template ownership and maintenance 2026-11-12 21:30:35 +08:00
codex-bot 2e905df467 docs: clarify application demo state and page factory lifecycles 2026-11-12 21:28:15 +08:00
codex-bot 0c12190e2d docs: clarify shared scene cameras and event lifecycle examples 2026-11-12 21:25:50 +08:00
codex-bot 8a6bdc3790 docs: clarify layout example dependency and occurrence contracts 2026-11-12 21:23:58 +08:00
codex-bot 94e0f96e4a docs: clarify task example ownership and failure boundaries 2026-11-12 21:22:00 +08:00
codex-bot 40b43ac3c3 docs: clarify typed example callbacks and delegation contracts 2026-11-12 21:20:10 +08:00
codex-bot c3e7d01c09 docs: clarify tool outputs and example window contexts 2026-11-12 21:18:12 +08:00
codex-bot ffc98fb657 docs: complete host regression annotation review 2026-11-12 21:16:40 +08:00
codex-bot 3bf5a5415a docs: clarify scene and protocol cache regression scope 2026-11-12 21:14:54 +08:00
codex-bot 831d013f75 docs: clarify incremental layout and pixel sampling regressions 2026-11-12 21:12:57 +08:00
codex-bot 435ec3b8be docs: clarify rendering contract and event regression evidence 2026-11-12 21:10:26 +08:00
codex-bot c15a5e6729 docs: distinguish window and rendering test coverage boundaries 2026-11-12 21:08:47 +08:00
codex-bot 3f47f76a8d docs: clarify host test observations and task wait limits 2026-11-12 21:07:05 +08:00
codex-bot 5e26994569 docs: align integration test comments with actual coverage 2026-11-12 21:04:10 +08:00
codex-bot fe8ffa1a78 docs: clarify developer tool filtering and module contracts 2026-11-12 21:02:02 +08:00
codex-bot 91801dc417 docs: clarify source viewing and host interaction boundaries 2026-11-12 21:00:31 +08:00
codex-bot b15d0872d7 docs: clarify shell observation and window-local tab contracts 2026-11-12 20:58:37 +08:00
codex-bot 2d5138c7ad docs: clarify event failure cleanup and VM sequence contracts 2026-11-12 20:53:49 +08:00
codex-bot f0bfbc9fc1 docs: explain 3D renderer panel and BVH ownership boundaries 2026-11-12 20:51:29 +08:00
codex-bot 3db8b13768 docs: clarify layout convergence and scene coordinate contracts 2026-11-12 20:49:23 +08:00
codex-bot cd0f292b78 docs: explain intrinsic visual paths and shared font cache lifetimes 2026-11-12 20:46:56 +08:00
codex-bot afff46c0a8 docs: explain hit selection and scroll viewport projection order 2026-11-12 20:43:30 +08:00
codex-bot 45b0b53d4f docs: clarify layout bounds and retained image text flow 2026-11-12 20:41:16 +08:00
codex-bot 0c4bd06231 docs: clarify protocol and document publication contracts 2026-11-12 20:38:06 +08:00
codex-bot ab3cd0c7cf docs: clarify mount checkpoints and snapshot ownership contracts 2026-11-12 20:34:58 +08:00
codex-bot 8042d2efd4 docs: clarify presentation state and window resource lifecycle 2026-11-12 20:32:45 +08:00
codex-bot 723e7f1fbd docs: clarify UI registration signatures and visual snapshot fields 2026-11-12 20:30:28 +08:00
codex-bot 373a95996c docs: clarify UI bridge continuation and publication boundaries 2026-11-12 20:27:32 +08:00
codex-bot b44d7833ea docs: clarify graphics resource and Block validation call paths 2026-11-12 20:24:05 +08:00
codex-bot 1f26349436 docs: clarify developer workspace editing and request presentation 2026-11-12 20:19:57 +08:00
codex-bot edf513bff7 docs: clarify shell input window and host widget lifecycles 2026-11-12 20:17:03 +08:00
codex-bot f743c427f7 docs: clarify source paint handoff and raster presentation limits 2026-11-12 20:11:57 +08:00
codex-bot b10a5b43d2 docs: clarify layout continuation and runtime refresh cleanup 2026-11-12 20:09:27 +08:00
codex-bot f1e413c8c5 docs: clarify API request phases and native input ordering 2026-11-12 20:05:19 +08:00
codex-bot a1c1781b00 docs: clarify task ownership and I/O completion cleanup 2026-11-12 20:01:32 +08:00
codex-bot 0cd708f8c7 docs: clarify binding refresh and worker publication boundaries 2026-11-12 19:57:03 +08:00
codex-bot 7f7464ae2b docs: explain scene graphics and composite example execution 2026-11-12 19:51:41 +08:00
codex-bot 99ce4e3fc6 docs: explain page window and scrolling example callers 2026-11-12 19:46:10 +08:00
codex-bot ce17cb6ed3 docs: explain event binding and object lifecycle examples 2026-11-12 19:43:48 +08:00
codex-bot 9cdbf00961 docs: clarify example inheritance and type contract calls 2026-11-12 19:40:58 +08:00
codex-bot 07812bc47a docs: explain layout example constraints and protocol calls 2026-11-12 19:39:17 +08:00
codex-bot a0545e7e40 docs: explain asynchronous example ownership and callbacks 2026-11-12 19:34:37 +08:00
codex-bot 8a61d27938 docs: explain application entry points and tooling workflows 2026-11-12 19:31:28 +08:00
codex-bot ca5bc863c1 docs: explain host widget interaction and visual states 2026-11-12 19:28:49 +08:00
codex-bot 0971d08e1b docs: explain native input capture and window event lifecycle 2026-11-12 19:25:56 +08:00
codex-bot b95912d840 docs: explain sidebar and native window coordination 2026-11-12 19:22:21 +08:00
codex-bot d8dc24da26 docs: explain developer workspace state and input lifecycle 2026-11-12 19:19:12 +08:00
codex-bot a0ff16e23f docs: explain developer tool painting and source selection 2026-11-12 19:15:28 +08:00
codex-bot bb6e78ad04 docs: explain console, network and settings view projections 2026-11-12 19:12:50 +08:00
codex-bot 50571e156e docs: explain shell activity and platform support boundaries 2026-11-12 19:10:08 +08:00
codex-bot c28c08a29a docs: explain text flow cursors and viewport hit indexing 2026-11-12 19:07:30 +08:00
codex-bot 9517053a75 docs: explain text shaping and viewport projection flows 2026-11-12 19:04:55 +08:00
codex-bot 03241d4ac1 docs: explain source layout caching and convergence lifecycle 2026-11-12 19:01:17 +08:00
codex-bot cd323de3ac docs: explain scroll projection and source hit selection 2026-11-12 18:57:09 +08:00
codex-bot ac6cc82b0e docs: explain source paint lifecycle and software composition 2026-11-12 18:54:25 +08:00
codex-bot b18d56c439 docs: explain 3D rasterization, picking and spatial indexing 2026-11-12 18:50:21 +08:00
codex-bot 0431510d0e docs: explain scene composition and 3D panel coordinate flows 2026-11-12 18:45:46 +08:00
codex-bot 3442e3b3c2 docs: explain layout constraints, flex allocation and occurrence identity 2026-11-12 18:41:07 +08:00
codex-bot df7e1846b2 docs: explain native visual protocols and legacy page coordinate rules 2026-11-12 18:36:10 +08:00
codex-bot 13a8b1b4b5 docs: explain box sizing, device drawing and image preparation 2026-11-12 18:32:01 +08:00
codex-bot 7a3eea3958 docs: explain managed windows, page ownership and native command delivery 2026-11-12 18:28:18 +08:00
codex-bot f4ab4db475 docs: explain managed 3d construction, scene extraction and camera updates 2026-11-12 18:25:42 +08:00
codex-bot c67a205867 docs: explain mount synchronization, queries and cancellation recovery 2026-11-12 18:21:44 +08:00
codex-bot f0a55e0f7a docs: explain object lists, presentation state and capability installation 2026-11-12 18:17:20 +08:00
codex-bot 38e8bbc1e6 docs: explain document publication and visual snapshot invalidation 2026-11-12 18:13:48 +08:00
codex-bot dbf0bb5800 docs: explain binding convergence and managed block model ownership 2026-11-12 18:08:16 +08:00
codex-bot 742fee4295 docs: explain effects, bindings, publication and shutdown test paths 2026-11-12 18:03:00 +08:00
codex-bot d9c191ec00 docs: explain world ui, scroll policies and native identity test paths 2026-11-12 17:56:13 +08:00
codex-bot 3ed148c880 docs: explain box layout, camera projection and 3d picking tests 2026-11-12 17:51:21 +08:00
codex-bot 00514825a0 docs: explain scrolling, incremental refresh and flex test invariants 2026-11-12 17:47:44 +08:00
codex-bot 6f84d6574a docs: explain visual contracts, mount lifecycle and event test assertions 2026-11-12 17:43:59 +08:00
codex-bot 91bd0d4c5a docs: explain host test setup, dependencies and incremental painting 2026-11-12 17:39:06 +08:00
codex-bot ed1a9d2956 docs: explain worker publication and HTTP integration regressions 2026-11-12 17:27:39 +08:00
codex-bot e7f387ed9f docs: explain task scheduling, VM sessions and API control flow 2026-11-12 17:13:43 +08:00
codex-bot 21aa7b837b docs: explain graphics resources and runtime dispatch lifecycles 2026-11-12 16:53:32 +08:00
codex-bot fbc5bed19e docs: explain UI bridge callers, control flow and VM ownership 2026-11-12 16:36:11 +08:00
Zayden-Jung f00fd05754 Merge pull request 'feat: 用 Endor 脚本实现龙与文字绕排并补齐通用图形输入能力' (#9) from codex/dragon-manuscript into main
Reviewed-on: #9
2026-11-12 03:12:08 +00:00
codex-bot b0ceb83320 merge: resolve manuscript conflicts with latest main comments 2026-11-12 11:11:00 +08:00
Zayden-Jung f2f19ef87b Merge pull request 'docs: 全库细化中文逻辑注释,覆盖测试、示例与脚本' (#8) from codex/chinese-comment-detail into main
Reviewed-on: #8
2026-11-12 03:06:44 +00:00
codex-bot 09c1090339 chore: normalize bundled font license line endings 2026-11-12 10:53:05 +08:00
codex-bot 2715c1ce2c feat: render interactive manuscript from Endor through generic graphics 2026-11-12 10:52:28 +08:00
codex-bot 45ff965b01 docs: 补齐各模块局部回归测试的输入与断言说明 2026-11-12 10:34:22 +08:00
codex-bot e315172ce1 docs: 解释最新主线场景性能基准的采样与计时边界 2026-11-12 10:32:25 +08:00
codex-bot cd23e70db1 docs: 逐模块细化中文逻辑注释并覆盖测试与示例 2026-11-12 10:31:41 +08:00
Zayden-Jung d29a1be329 Merge pull request 'test: add reproducible scene performance baseline on current main' (#6) from codex/scene-performance into main
Reviewed-on: #6
2026-11-11 18:39:17 +00:00
codex-bot 723e41706b fix: keep current Aster API when updating performance study 2026-11-12 02:21:34 +08:00
codex-bot caea8c62a2 Merge remote-tracking branch 'origin/main' into codex/scene-performance 2026-11-12 02:13:08 +08:00
Zayden-Jung 0b1394e407 Merge pull request 'docs: 为 Tessera 本体补充中文源码注释与阅读索引' (#7) from codex/code-comments into main
Reviewed-on: #7
2026-11-11 16:29:49 +00:00
codex-bot 1fedd21d3c docs: explain Tessera modules and execution flows in Chinese 2026-11-11 23:36:03 +08:00
codex-bot 534f6e03c1 perf: add repeatable scene benchmarks and validate borrowed dictionary keys 2026-11-11 15:50:10 +08:00
Zayden-Jung 4c3fc8b5dd Merge pull request 'feat: compose nested UI layouts with 2D and 3D scene viewports' (#5) from codex/page-surfaces into main
Reviewed-on: #5
2026-11-10 17:02:25 +00:00
codex-bot 741977c3fb docs: record verified scene delivery and manual merge status 2026-11-11 00:55:35 +08:00
codex-bot 32d5da5528 feat: bound scene visibility rendering and continuous native input 2026-11-11 00:53:21 +08:00
codex-bot 15fc01542c feat: compose interactive world ui across nested 3d viewports 2026-11-11 00:08:23 +08:00
codex-bot ad2c01bc29 feat: render programmable 3d scenes cameras and picking 2026-11-10 23:19:26 +08:00
codex-bot 040b779f5f feat: separate 2d scenes viewports and explicit cameras 2026-11-10 22:42:56 +08:00
codex-bot 32d7ada3ab feat: implement nested border-box layout and alignment 2026-11-10 22:17:19 +08:00
codex-bot 525097a0b2 Merge remote-tracking branch 'origin/main' into codex/page-surfaces 2026-11-10 21:55:47 +08:00
Zayden-Jung dff84f2b27 Merge pull request 'Add a workspace dashboard script example' (#3) from codex/workspace-dashboard-example into main
Reviewed-on: #3
2026-11-10 08:27:10 +00:00
Zayden-Jung 7007835541 Merge pull request 'chore: remove CI/CD and document local development' (#4) from codex/local-development into main
Reviewed-on: #4
2026-11-10 08:26:58 +00:00
codex-bot 82f9256a84 feat: add page surfaces and collapsible sidebar 2026-11-10 16:18:47 +08:00
codex-bot e0eff7755f chore: remove CI/CD and document local development 2026-11-10 15:17:47 +08:00
codex-bot 1e57e908d4 Add a workspace dashboard script example 2026-11-05 00:53:30 +08:00
Zayden-Jung 303c823eb0 Merge pull request 'test: 修正窗口 chrome 引入后的布局测试尺寸预期' (#2) from codex/fix-layout-ci into main
Verify Tessera GUI / verify (push) Successful in 3m36s
Reviewed-on: #2
2026-10-29 20:28:36 +00:00
Zayden-Jung f787ff25e0 Merge pull request 'ci: 仅 main 分支执行 CI/CD' (#1) from codex/main-only-cicd into main
Verify Tessera GUI / verify (push) Has been cancelled
Reviewed-on: #1
2026-10-29 20:28:29 +00:00
codex-bot 1fb6dc3b8f test: account for window chrome in viewport layout assertions 2026-10-30 03:45:21 +08:00
codex-bot 714d257058 ci: restrict workflows to main branch 2026-10-30 03:43:57 +08:00
codex-bot 21439d4c4d docs: render UML diagrams and embed portable previews
Verify Tessera GUI / verify (push) Failing after 1m30s
2026-10-25 22:09:47 +08:00
codex-bot 18376793b0 refactor: organize host modules and document architecture with UML
Verify Tessera GUI / verify (push) Failing after 2m2s
2026-10-25 21:25:43 +08:00
codex-bot 48fcb96f42 fix: connect toolbar double clicks to native window zoom
Verify Tessera GUI / verify (push) Failing after 1m33s
2026-10-25 15:22:24 +08:00
codex-bot 050f777e33 fix: ease tab hover colors without delaying selection
Verify Tessera GUI / verify (push) Failing after 1m35s
2026-10-25 15:15:16 +08:00
codex-bot 7b769b1477 fix: restore comfortable tab height with native control alignment
Verify Tessera GUI / verify (push) Failing after 1m39s
2026-10-25 15:01:32 +08:00
codex-bot 846c99a991 fix: align compact tabs and scroll overflow continuously
Verify Tessera GUI / verify (push) Failing after 1m52s
2026-10-25 14:46:29 +08:00
codex-bot 38ddb80b7c docs: record Endor campus modeling and shared-state walkthrough
Verify Tessera GUI / verify (push) Failing after 1m34s
2026-10-25 00:30:19 +08:00
codex-bot e54264f23b example: add multi-page Endor campus learning environment
Verify Tessera GUI / verify (push) Failing after 1m32s
2026-10-25 00:13:22 +08:00
codex-bot 3a4a91d5b6 example: add interactive Endor student grades center
Verify Tessera GUI / verify (push) Failing after 2m35s
2026-10-24 23:50:53 +08:00
codex-bot 8881650d4f design: simplify the Endor start page into quiet action rows 2026-10-24 23:23:17 +08:00
codex-bot cd092a9fed fix: increase contrast between workspace chrome and content 2026-10-24 20:41:56 +08:00
codex-bot 952fc2eff2 feat: build functional Endor start page and balance compact tabs 2026-10-24 20:12:02 +08:00
codex-bot 3cb44b96eb fix: preserve source focus across native chrome activation 2026-10-24 19:50:31 +08:00
codex-bot d3165b1224 docs: record workspace behavior and complete requirement audit 2026-10-24 19:37:56 +08:00
codex-bot 656522edfe feat: unify window chrome and managed workspace tabs 2026-10-24 19:36:01 +08:00
codex-bot 3220544777 refactor: separate runtime regression sources from production host 2026-10-24 19:35:50 +08:00
codex-bot 193c5bca89 docs: distinguish ready VM work from idle provider polling
Verify Tessera GUI / verify (push) Successful in 1m42s
2026-10-24 02:27:51 +08:00
codex-bot fa6dfa7062 perf: run ready VM quanta without per-quantum timer delays 2026-10-24 02:27:51 +08:00
codex-bot 1cf07a75f7 style: format precise property binding integration
Verify Tessera GUI / verify (push) Successful in 1m48s
2026-10-24 02:19:57 +08:00
codex-bot 918cdbfa27 docs: describe precise property binding invalidation and evaluation counts
Verify Tessera GUI / verify (push) Failing after 10s
2026-10-24 02:18:53 +08:00
codex-bot e2802efe0a perf: retain precise name observations in property binding caches 2026-10-24 02:18:25 +08:00
codex-bot ea81150390 diagnostics: identify accepted inputs waiting for active refresh
Verify Tessera GUI / verify (push) Successful in 1m52s
2026-10-24 02:06:30 +08:00
codex-bot a5a55699cf test: cover source rendering caches with suspended owner cycles 2026-10-24 02:06:29 +08:00
codex-bot 1975d36cb1 docs: demonstrate collection of mounted cycles with suspended workflows 2026-10-24 02:05:56 +08:00
codex-bot 514eeb8648 test: cover shared paint dependencies across windows
Verify Tessera GUI / verify (push) Successful in 2m22s
2026-10-24 01:55:27 +08:00
codex-bot ae3a2d6163 fix: exclude shared host desktop bookkeeping from visual dependencies 2026-10-24 01:55:27 +08:00
codex-bot 9bb61befd8 diagnostics: include dependency reasons from every window
Verify Tessera GUI / verify (push) Successful in 2m36s
2026-10-24 01:52:19 +08:00
codex-bot a508842b09 diagnostics: expose snapshot cache invalidation causes
Verify Tessera GUI / verify (push) Has been cancelled
2026-10-24 01:51:22 +08:00
codex-bot 1808c87394 style: keep dependency conversion before the test module
Verify Tessera GUI / verify (push) Successful in 2m13s
2026-10-24 01:43:22 +08:00
codex-bot 839a3f248b fix: finish precise dependency draft migration
Verify Tessera GUI / verify (push) Has been cancelled
2026-10-24 01:41:43 +08:00
codex-bot 13bb9e84aa docs: demonstrate name-sensitive rendering invalidation
Verify Tessera GUI / verify (push) Has been cancelled
2026-10-24 01:40:56 +08:00
codex-bot 6a8a643371 perf: validate precise source name dependencies before relayout and repaint 2026-10-24 01:40:56 +08:00
codex-bot 0c63cd3102 test: guard foreground input priority over newly ready task callbacks
Verify Tessera GUI / verify (push) Successful in 1m38s
2026-10-24 01:23:25 +08:00
codex-bot ac1ae782c7 docs: clarify pre-input refresh cancellation and scheduling fairness
Verify Tessera GUI / verify (push) Successful in 1m50s
2026-10-24 01:20:40 +08:00
codex-bot a55178abb6 fix: park foreground inputs instead of synchronously draining idle refresh 2026-10-24 01:20:40 +08:00
codex-bot 435f95187b fix: remove obsolete event-loop arguments from native close handling
Verify Tessera GUI / verify (push) Successful in 3m24s
2026-10-24 01:01:59 +08:00
codex-bot 1e7925ca65 docs: describe graceful shutdown and show shared exit lifecycle hooks
Verify Tessera GUI / verify (push) Has been cancelled
2026-10-24 01:01:22 +08:00
codex-bot 0ad4555922 feat: quiesce the VM and unmount windows before native application exit 2026-10-24 01:01:22 +08:00
codex-bot 864e57ce1f Persist CI Cargo caches and repair runtime regression coverage
Verify Tessera GUI / verify (push) Successful in 1m40s
2026-10-23 22:35:00 +08:00
codex-bot 7f77a4aa72 docs: describe transient drag scrolling and lifecycle limits
Verify Tessera GUI / verify (push) Failing after 9m33s
2026-10-23 20:32:27 +08:00
codex-bot d86b84800a feat: reveal overflow tabs while holding a native drag at strip edges 2026-10-23 20:32:27 +08:00
codex-bot c9eb498932 fix: align await traversal with generated AST node shape
Verify Tessera GUI / verify (push) Failing after 9m42s
2026-10-23 20:16:01 +08:00
codex-bot 5256ac1318 docs: demonstrate Endor await and task result propagation
Verify Tessera GUI / verify (push) Failing after 7m46s
2026-10-23 20:15:10 +08:00
codex-bot 750484477b feat: await Task results with cancellation and cycle-aware scheduling 2026-10-23 20:15:10 +08:00
codex-bot 7bb59fe06f perf: wake promptly while cooperative source tasks remain runnable
Verify Tessera GUI / verify (push) Failing after 9m31s
2026-10-23 20:04:42 +08:00
codex-bot e0a7d8169c docs: demonstrate cooperative Endor tasks and pending await scope
Verify Tessera GUI / verify (push) Failing after 9m45s
2026-10-23 20:02:25 +08:00
codex-bot 485c35c641 feat: schedule owner-scoped source tasks with managed coroutine quanta 2026-10-23 20:02:25 +08:00
codex-bot eb48ec3396 fix: retain full network results independently of text widget limits
Verify Tessera GUI / verify (push) Failing after 9m42s
2026-10-23 19:49:49 +08:00
codex-bot 053b0f5fba docs: expose HTTP task contract and real Endor network example
Verify Tessera GUI / verify (push) Failing after 9m51s
2026-10-23 19:46:27 +08:00
codex-bot c418a425f3 feat: deliver cancellable HTTP text requests through owner-scoped tasks 2026-10-23 19:46:27 +08:00
codex-bot b725cf488d fix: publish file errors only after the task reaches failed state
Verify Tessera GUI / verify (push) Failing after 9m13s
2026-10-23 12:13:22 +08:00
codex-bot 05b727a4a5 test: cover file task delivery, replacement, cancellation and provider failures
Verify Tessera GUI / verify (push) Failing after 9m15s
2026-10-23 12:06:44 +08:00
codex-bot 047e008729 feat: deliver owner-scoped text file tasks through a bounded provider pool 2026-10-23 12:03:59 +08:00
codex-bot 05403e6996 test: preserve stable frames after collecting lazy driver helpers
Verify Tessera GUI / verify (push) Failing after 9m29s
2026-10-23 11:42:23 +08:00
codex-bot fc0634e79f feat: report invalidated rendering dependency identities and versions
Verify Tessera GUI / verify (push) Failing after 9m24s
2026-10-23 11:36:28 +08:00
codex-bot ae89dfad1e test: bound managed preparation overhead across large occurrence counts
Verify Tessera GUI / verify (push) Failing after 9m26s
2026-10-23 11:24:05 +08:00
codex-bot 618bffdada feat: prepare layout and paint occurrences lazily within VM quanta 2026-10-23 11:23:08 +08:00
codex-bot 65f5092f0f test: cover paint cancellation, consistent publication and post-pause errors
Verify Tessera GUI / verify (push) Failing after 9m10s
2026-10-23 11:08:54 +08:00
codex-bot acaef9ae29 feat: resume source paint across worker turns and cancel unpublished commands 2026-10-23 11:07:49 +08:00
codex-bot 180a08ea63 test: cover initial layout cancellation and retained replacement owners
Verify Tessera GUI / verify (push) Failing after 9m18s
2026-10-23 10:53:04 +08:00
codex-bot d521568d73 feat: park PUT candidate layout while preserving the live runtime 2026-10-23 10:52:23 +08:00
codex-bot 799fe9f3c7 feat: separate candidate program execution from initial layout continuation 2026-10-23 10:52:01 +08:00
codex-bot 470454caa6 test: cover deferred input results and one-shot event callbacks
Verify Tessera GUI / verify (push) Failing after 9m9s
2026-10-23 02:03:12 +08:00
codex-bot 7289df036f feat: retain HTTP input requests across cooperative refresh turns 2026-10-23 02:02:43 +08:00
codex-bot dfc69b4777 feat: retain REPL and event results while incremental refresh is pending 2026-10-23 02:01:33 +08:00
codex-bot ef44d7cb18 fix: use concrete load document in refresh regression fixtures
Verify Tessera GUI / verify (push) Failing after 9m1s
2026-10-23 01:52:13 +08:00
codex-bot 184b067945 test: cover intrinsic layout retargeting and idle task publication order
Verify Tessera GUI / verify (push) Failing after 8m37s
2026-10-23 01:51:46 +08:00
codex-bot bd5c91ba99 feat: park idle task refresh and bound delivery to one callback per turn 2026-10-23 01:50:56 +08:00
codex-bot 5a1cf9d702 feat: slice large intrinsic layout trees between node calls 2026-10-23 01:50:17 +08:00
codex-bot 8a13cd027a fix: use zero-argument callback in viewport cancellation fixture
Verify Tessera GUI / verify (push) Failing after 9m9s
2026-10-23 01:45:12 +08:00
codex-bot cd35121b59 fix: specify layout finalization error type for checkpoint cleanup
Verify Tessera GUI / verify (push) Failing after 9m26s
2026-10-23 01:40:39 +08:00
codex-bot 4df99cb2aa test: cover viewport replacement with saved mount and task ownership
Verify Tessera GUI / verify (push) Failing after 8m33s
2026-10-23 01:38:18 +08:00
codex-bot d452b95e57 feat: coalesce viewport changes by cancelling unpublished layout work 2026-10-23 01:36:18 +08:00
codex-bot ed301b2eb4 feat: restore prepared mounts when cancelling unpublished layout work 2026-10-23 01:34:55 +08:00
codex-bot cd07c958c1 feat: checkpoint mount preparation and defer task cancellation to unmount 2026-10-23 01:33:58 +08:00
codex-bot 8f7255f4cf fix: remove obsolete synchronous bridge entry and box refresh results
Verify Tessera GUI / verify (push) Failing after 8m58s
2026-10-23 01:23:30 +08:00
codex-bot 6c4be694f7 fix: guard runtime mutation across parked refresh stages
Verify Tessera GUI / verify (push) Failing after 9m6s
2026-10-23 01:22:03 +08:00
codex-bot ba26e74bea feat: park viewport refreshes across worker turns and serialize new input 2026-10-23 01:20:39 +08:00
codex-bot 3a636a8a79 refactor: retain refresh traversal and unpublished window documents across polls 2026-10-23 01:20:00 +08:00
codex-bot 175421ece3 refactor: retain bridge finalization context across layout pauses
Verify Tessera GUI / verify (push) Failing after 9m10s
2026-10-23 01:14:08 +08:00
codex-bot 020b914658 refactor: own resumable layout drafts in explicit host work objects
Verify Tessera GUI / verify (push) Failing after 8m52s
2026-10-23 01:07:33 +08:00
codex-bot 09c3902d84 feat: resume layout calls in VM instruction slices and expose slice statistics
Verify Tessera GUI / verify (push) Failing after 8m59s
2026-10-23 01:00:49 +08:00
codex-bot 33f94da927 fix: refresh nested flex measurements after cross-axis constraint changes
Verify Tessera GUI / verify (push) Failing after 9m2s
2026-10-23 00:50:15 +08:00
codex-bot 1fda07ebc5 feat: constrain flex bases and redistribute bounded growth and shrink
Verify Tessera GUI / verify (push) Failing after 9m4s
2026-10-23 00:42:48 +08:00
codex-bot 78fb66277d feat: allocate weighted flex space and remeasure affected occurrences
Verify Tessera GUI / verify (push) Failing after 7m59s
2026-10-22 22:01:28 +08:00
codex-bot 0c1cc12b6b Align native container children within allocated main-axis bounds
Verify Tessera GUI / verify (push) Failing after 7m55s
2026-10-22 21:48:08 +08:00
codex-bot 1885693f7c Add axis-aware scroll constraints and per-mount limits
Verify Tessera GUI / verify (push) Failing after 7m38s
2026-10-22 19:35:38 +08:00
codex-bot 2b20976658 Honor replaced visual methods and correct event contracts
Verify Tessera GUI / verify (push) Failing after 7m43s
2026-10-22 19:08:28 +08:00
codex-bot 8d0dbbce29 Cover source call-graph effects and rebinding in Endor 2026-10-22 15:56:23 +08:00
codex-bot 666fd2d973 Track conservative source effect proofs in GUI contracts 2026-10-22 15:41:17 +08:00
codex-bot b2fe392ddb Invalidate rendering when typed method storage is shadowed 2026-10-22 15:28:47 +08:00
codex-bot ab40e424e0 Publish UI factory contracts and separate native options from subclass fields 2026-10-22 15:08:29 +08:00
codex-bot 8b698cb39f Register typed GUI capabilities and reject incompatible presenters early 2026-10-22 14:37:43 +08:00
codex-bot 579b6f8bec Adopt checked source method overrides and document variance contracts 2026-10-22 14:14:08 +08:00
codex-bot d9fd3f2f65 Complete nullable page and typed lifecycle resource method contracts 2026-10-22 14:01:01 +08:00
codex-bot 543c909d53 Publish native visual and window type and effect contracts 2026-10-22 13:52:01 +08:00
codex-bot 1eb3b87050 Settle source layout constraints before publishing complete frames
Verify Tessera GUI / verify (push) Failing after 7m49s
2026-10-22 13:26:00 +08:00
codex-bot 7b5d3940fd Wrap native text within occurrence constraints and preserve paint bounds
Verify Tessera GUI / verify (push) Failing after 7m33s
2026-10-22 12:24:23 +08:00
codex-bot 25275b515c Publish native arity and validate callback contracts before registration
Verify Tessera GUI / verify (push) Failing after 7m44s
2026-10-22 12:03:24 +08:00
codex-bot 50422f801a Enforce declared visual subclass field contracts before native effects
Verify Tessera GUI / verify (push) Failing after 7m46s
2026-10-22 11:45:21 +08:00
codex-bot 7cd7ec2c11 Support stable insertion and managed tab placement
Verify Tessera GUI / verify (push) Failing after 7m40s
2026-10-22 11:29:14 +08:00
codex-bot 6d6a9b7a34 Own asynchronous timer tasks in the managed object lifecycle
Verify Tessera GUI / verify (push) Failing after 7m26s
2026-10-21 23:09:03 +08:00
codex-bot 3a7b755532 Enable source function type checks in the shared GUI runtime
Verify Tessera GUI / verify (push) Failing after 7m34s
2026-10-21 22:40:11 +08:00
codex-bot 6e69c5e5ce Add per-Mount scrolling with shared paint and input clipping
Verify Tessera GUI / verify (push) Failing after 7m33s
2026-10-21 22:05:08 +08:00
codex-bot 7acc5783a5 Declare visual capabilities and dispatch explicit Presentable views
Verify Tessera GUI / verify (push) Failing after 7m41s
2026-10-21 21:37:22 +08:00
codex-bot 8d980745ea Bind managed Block properties with read-only dependency tracking
Verify Tessera GUI / verify (push) Failing after 7m31s
2026-10-21 21:19:36 +08:00
codex-bot dff49770fa Retire inactive windows without invoking stopped runtimes
Verify Tessera GUI / verify (push) Failing after 7m31s
2026-10-21 21:02:52 +08:00
codex-bot e3e46068eb Support shared-VM native windows and Page detachment
Verify Tessera GUI / verify (push) Failing after 7m35s
2026-10-21 18:11:58 +08:00
codex-bot f8173168fd Isolate rendering state per window presentation
Verify Tessera GUI / verify (push) Failing after 7m26s
2026-10-21 17:42:11 +08:00
codex-bot 96319b13a3 Connect native tab chrome to managed Page methods
Verify Tessera GUI / verify (push) Failing after 7m37s
2026-10-21 17:29:54 +08:00
codex-bot 76e293d3b8 Add managed Window resource and native shell operations
Verify Tessera GUI / verify (push) Failing after 7m25s
2026-10-21 17:12:55 +08:00
codex-bot 3ea4bac48c Cache source measurements and propagate native viewport inputs
Verify Tessera GUI / verify (push) Failing after 7m29s
2026-10-21 16:33:35 +08:00
codex-bot 1b5fe1069f Run source measurement and arrangement in the frame pipeline
Verify Tessera GUI / verify (push) Failing after 7m30s
2026-10-21 15:58:30 +08:00
codex-bot 7b11e32eb6 Dispatch source hit testing for native pointer clicks
Verify Tessera GUI / verify (push) Failing after 7m31s
2026-10-21 15:37:26 +08:00
codex-bot d19fab55b9 fix: allow plain local reference rebinding in source paint
Verify Tessera GUI / verify (push) Failing after 7m30s
2026-10-21 14:32:21 +08:00
codex-bot 6a88447524 feat: render source paint overrides with read-only object dependencies
Verify Tessera GUI / verify (push) Failing after 7m37s
2026-10-21 14:20:02 +08:00
codex-bot dc61f5e33c feat: expose native visual protocols and explicit invalidation
Verify Tessera GUI / verify (push) Failing after 7m23s
2026-10-21 02:42:16 +08:00
codex-bot d2f167e71f feat: notify Endor objects of mount lifecycle transitions
Verify Tessera GUI / verify (push) Failing after 7m23s
2026-10-21 02:29:46 +08:00
codex-bot 8886bdbd2d feat: dispatch managed events through capture and bubble subscriptions
Verify Tessera GUI / verify (push) Failing after 7m13s
2026-10-21 02:20:00 +08:00
codex-bot 6c42e5dde4 feat: construct native visual subclasses from Endor source
Verify Tessera GUI / verify (push) Successful in 9m53s
2026-10-21 02:06:25 +08:00
codex-bot 0d5e4b318d feat: retain managed visual objects and dispatch native input through Endor
Verify Tessera GUI / verify (push) Successful in 9m28s
2026-10-21 01:49:35 +08:00
codex-bot 757fa22d9b feat: retain live page mounts and update shared UI references across aliases
Verify Tessera GUI / verify (push) Failing after 7m13s
2026-10-20 20:58:41 +08:00
codex-bot 9d3f766275 fix: restore neutral separators between Console commands
Verify Tessera GUI / verify (push) Failing after 7m15s
2026-10-20 20:26:27 +08:00
codex-bot 098fe45129 fix: unify Console prompt and output and keep splitters above pane chrome
Verify Tessera GUI / verify (push) Failing after 7m13s
2026-10-20 20:19:34 +08:00
codex-bot 53e8d7b287 feat: add system widgets and a persistent native Console with bare assignments
Verify Tessera GUI / verify (push) Failing after 7m17s
2026-10-20 18:36:48 +08:00
codex-bot 1d4b1d3c86 fix: preserve UTF-8 clipboard text in native macOS launches
Verify Tessera GUI / verify (push) Failing after 7m14s
2026-10-20 17:59:39 +08:00
codex-bot d641f62116 feat: build a resizable native developer workspace with console and network inspection
Verify Tessera GUI / verify (push) Failing after 7m12s
2026-10-20 16:42:12 +08:00
codex-bot 5f202e8347 fix: retain the selected code font with CJK fallback
Verify Tessera GUI / verify (push) Successful in 9m46s
2026-10-20 14:31:24 +08:00
codex-bot f0fae1792f feat: shape and antialias Tessera text with system fonts
Verify Tessera GUI / verify (push) Successful in 13m28s
2026-10-20 14:25:28 +08:00
codex-bot 1f64de48b9 test: initialize snapshot state in the struct literal
Verify Tessera GUI / verify (push) Successful in 7m44s
2026-10-20 13:56:25 +08:00
codex-bot 47ab2aa3a6 feat: render top-level Endor scripts through embedded Aster
Verify Tessera GUI / verify (push) Failing after 6m52s
2026-10-20 13:47:29 +08:00
codex-bot 8cb2bf8607 feat: execute Tessera UI source with embedded Aster
Verify Tessera GUI / verify (push) Successful in 7m38s
2026-10-20 03:35:46 +08:00
codex-bot 3e1cce78f8 fix: use standard CI checkout with package-only Aster
Verify Tessera GUI / verify (push) Successful in 9m54s
2026-10-20 02:39:47 +08:00
233 changed files with 52610 additions and 2279 deletions
-8
View File
@@ -1,8 +0,0 @@
.git
**/.git
target
**/target
**/AGENTS.md
**/work
**/ci-output
.env
-22
View File
@@ -1,22 +0,0 @@
# Tessera GUI automation
[workflows](workflows/README.md) contains repository workflows.
## CI checkout prerequisites
All workflows use `runs-on: ces-control`; no shared Runner configuration is changed.
Configure repository or organization secrets `CODEX_BOT_SSH_KEY` (the dedicated
codex-bot private SSH key) and `GITEA_SSH_KNOWN_HOSTS` (the independently verified
known_hosts entry for `[gitea.entroia.com]:22222`). The bot needs read access to the
repository and its Aster submodule. Workflows use an isolated SSH command with
`-F /dev/null`, `IdentitiesOnly=yes`, an explicit key and port, strict host-key
checking, and temporary credential files removed after checkout. Keys are never
written into tracked files. Missing secrets fail checkout explicitly.
The SSH submodule URL's repository owner is separate from the authenticated bot.
Local Git operations must use the same dedicated bot identity; configure the
checkout's isolated command in `GIT_SSH_COMMAND` for submodule initialization.
Workflow definitions do not prove CI passed. CI/deployment state is not queried
automatically. Local runtime checks are not performed for Aster, Lyra or Hestia;
Tessera permits local native builds/window runs, with automated tests in CI.
-5
View File
@@ -1,5 +0,0 @@
# Tessera GUI workflows
[ci.yml](ci.yml) verifies this project on main pushes, pull requests and manual dispatch. It runs on ces-control, with a 60-minute timeout. Checkout and secret requirements are in [the parent README](../README.md).
There is no production service deployment in this workflow.
-49
View File
@@ -1,49 +0,0 @@
name: Verify Tessera GUI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
jobs:
verify:
runs-on: ces-control
timeout-minutes: 60
env:
DOCKER_BUILDKIT: "0"
steps:
- name: Checkout with codex-bot
env:
CODEX_BOT_SSH_KEY: ${{ secrets.CODEX_BOT_SSH_KEY }}
GITEA_SSH_KNOWN_HOSTS: ${{ secrets.GITEA_SSH_KNOWN_HOSTS }}
SOURCE_SHA: ${{ gitea.sha }}
SOURCE_REPOSITORY: ${{ gitea.repository }}
run: |
set -eu
test -n "$CODEX_BOT_SSH_KEY"
test -n "$GITEA_SSH_KNOWN_HOSTS"
case "$SOURCE_SHA" in *[!0-9a-f]*|'') exit 1;; esac
test "${#SOURCE_SHA}" -eq 40
umask 077
checkout_keys=$(mktemp -d)
trap 'rm -rf "$checkout_keys"' EXIT
printf '%s\n' "$CODEX_BOT_SSH_KEY" > "$checkout_keys/key"
printf '%s\n' "$GITEA_SSH_KNOWN_HOSTS" > "$checkout_keys/known_hosts"
unset CODEX_BOT_SSH_KEY GITEA_SSH_KNOWN_HOSTS
export GIT_SSH_COMMAND="ssh -F /dev/null -o IdentitiesOnly=yes -i $checkout_keys/key -p 22222 -o StrictHostKeyChecking=yes -o UserKnownHostsFile=$checkout_keys/known_hosts"
git init .
source_url="ssh://git@gitea.entroia.com:22222/$SOURCE_REPOSITORY.git"
if git remote get-url origin >/dev/null 2>&1; then
git remote set-url origin "$source_url"
else
git remote add origin "$source_url"
fi
git fetch --no-tags --depth=1 origin "$SOURCE_SHA"
git checkout --detach --force FETCH_HEAD
git submodule update --init --recursive
- name: Verify portable GUI code
run: |
image="endorphin-tessera-gui-ci:${{ gitea.sha }}"
docker build -f Dockerfile.ci -t "$image" .
docker run --rm --init "$image"
Generated
+374 -5
View File
@@ -18,6 +18,12 @@ version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618" checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618"
[[package]]
name = "adler2"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
[[package]] [[package]]
name = "ahash" name = "ahash"
version = "0.8.12" version = "0.8.12"
@@ -92,6 +98,12 @@ version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]]
name = "autocfg"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.3.2" version = "1.3.2"
@@ -275,6 +287,48 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "core_maths"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77745e017f5edba1a9c1d854f6f3a52dac8a12dd5af5d2f54aecf61e43d80d30"
dependencies = [
"libm",
]
[[package]]
name = "cosmic-text"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be17b688510d934ce13f48a2beba700e11583e281e0fda99c22bb256a14eda73"
dependencies = [
"bitflags 2.13.2",
"fontdb",
"harfrust",
"linebender_resource_handle",
"log",
"rangemap",
"rustc-hash",
"self_cell",
"skrifa 0.40.0",
"smol_str 0.3.6",
"swash",
"sys-locale",
"unicode-bidi",
"unicode-linebreak",
"unicode-script",
"unicode-segmentation",
]
[[package]]
name = "crc32fast"
version = "1.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b929dd2a135771f40afabd1073f85eed59c800b7c61901e5c254270497dad64"
dependencies = [
"cfg-if",
]
[[package]] [[package]]
name = "crossbeam-utils" name = "crossbeam-utils"
version = "0.8.23" version = "0.8.23"
@@ -401,6 +455,15 @@ version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
[[package]]
name = "fdeflate"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c"
dependencies = [
"simd-adler32",
]
[[package]] [[package]]
name = "find-msvc-tools" name = "find-msvc-tools"
version = "0.1.14" version = "0.1.14"
@@ -408,10 +471,56 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484" checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484"
[[package]] [[package]]
name = "font8x8" name = "flate2"
version = "0.3.1" version = "1.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "875488b8711a968268c7cf5d139578713097ca4635a76044e8fe8eedf831d07e" checksum = "626d4928326b646e70f65ed36fc7cf9f206bdb68a0019ee7c6b4709da4e084c4"
dependencies = [
"crc32fast",
"miniz_oxide 0.9.1",
"zlib-rs",
]
[[package]]
name = "font-types"
version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b38ad915f6dadd993ced50848a8291a543bd41ca62bc10740d5e64e2ab4cfd7"
dependencies = [
"bytemuck",
]
[[package]]
name = "font-types"
version = "0.12.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "835ae9d781464a79026cde387f9cbc650c9a4909d7cf7e658b127e3c35d2f35d"
dependencies = [
"bytemuck",
]
[[package]]
name = "fontconfig-parser"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbc773e24e02d4ddd8395fd30dc147524273a83e54e0f312d986ea30de5f5646"
dependencies = [
"roxmltree",
]
[[package]]
name = "fontdb"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "457e789b3d1202543297a350643cf459f836cade38934e7a4cf6a39e7cde2905"
dependencies = [
"fontconfig-parser",
"log",
"memmap2",
"slotmap",
"tinyvec",
"ttf-parser",
]
[[package]] [[package]]
name = "foreign-types" name = "foreign-types"
@@ -506,6 +615,19 @@ dependencies = [
"r-efi 6.0.0", "r-efi 6.0.0",
] ]
[[package]]
name = "harfrust"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9da2e5ae821f6e96664977bf974d6d6a2d6682f9ccee23e62ec1d134246845f9"
dependencies = [
"bitflags 2.13.2",
"bytemuck",
"core_maths",
"read-fonts 0.37.0",
"smallvec",
]
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.17.1" version = "0.17.1"
@@ -635,6 +757,12 @@ dependencies = [
"windows-link", "windows-link",
] ]
[[package]]
name = "libm"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
[[package]] [[package]]
name = "libredox" name = "libredox"
version = "0.1.25" version = "0.1.25"
@@ -647,6 +775,12 @@ dependencies = [
"redox_syscall 0.9.4", "redox_syscall 0.9.4",
] ]
[[package]]
name = "linebender_resource_handle"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4"
[[package]] [[package]]
name = "linux-raw-sys" name = "linux-raw-sys"
version = "0.4.15" version = "0.4.15"
@@ -686,6 +820,26 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "miniz_oxide"
version = "0.8.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
dependencies = [
"adler2",
"simd-adler32",
]
[[package]]
name = "miniz_oxide"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c"
dependencies = [
"adler2",
"simd-adler32",
]
[[package]] [[package]]
name = "ndk" name = "ndk"
version = "0.9.0" version = "0.9.0"
@@ -716,6 +870,45 @@ dependencies = [
"jni-sys 0.3.1", "jni-sys 0.3.1",
] ]
[[package]]
name = "num-bigint"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367"
dependencies = [
"num-integer",
"num-traits",
]
[[package]]
name = "num-integer"
version = "0.1.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b"
dependencies = [
"num-traits",
]
[[package]]
name = "num-rational"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824"
dependencies = [
"num-bigint",
"num-integer",
"num-traits",
]
[[package]]
name = "num-traits"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [
"autocfg",
]
[[package]] [[package]]
name = "num_enum" name = "num_enum"
version = "0.7.6" version = "0.7.6"
@@ -1011,6 +1204,11 @@ dependencies = [
[[package]] [[package]]
name = "objects" name = "objects"
version = "0.1.0" version = "0.1.0"
dependencies = [
"num-bigint",
"num-rational",
"num-traits",
]
[[package]] [[package]]
name = "once_cell" name = "once_cell"
@@ -1108,6 +1306,19 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"
[[package]]
name = "png"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61"
dependencies = [
"bitflags 2.13.2",
"crc32fast",
"fdeflate",
"flate2",
"miniz_oxide 0.8.9",
]
[[package]] [[package]]
name = "polling" name = "polling"
version = "3.11.0" version = "3.11.0"
@@ -1170,12 +1381,40 @@ version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
[[package]]
name = "rangemap"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a611d15b50743feb4c76b7d03edcb0e64f399c26961e4efe6975bc398be6aa3d"
[[package]] [[package]]
name = "raw-window-handle" name = "raw-window-handle"
version = "0.6.2" version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539"
[[package]]
name = "read-fonts"
version = "0.37.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b634fabf032fab15307ffd272149b622260f55974d9fad689292a5d33df02e5"
dependencies = [
"bytemuck",
"core_maths",
"font-types 0.11.3",
]
[[package]]
name = "read-fonts"
version = "0.41.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709"
dependencies = [
"bytemuck",
"font-types 0.12.7",
"once_cell",
]
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.4.1" version = "0.4.1"
@@ -1203,6 +1442,18 @@ dependencies = [
"bitflags 2.13.2", "bitflags 2.13.2",
] ]
[[package]]
name = "roxmltree"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97"
[[package]]
name = "rustc-hash"
version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
[[package]] [[package]]
name = "rustc_version" name = "rustc_version"
version = "0.4.1" version = "0.4.1"
@@ -1272,6 +1523,12 @@ dependencies = [
"tiny-skia", "tiny-skia",
] ]
[[package]]
name = "self_cell"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ab42ca02749e120097e328d91d415325bdf43b1c72c4c8badf37375fe40a813"
[[package]] [[package]]
name = "semver" name = "semver"
version = "1.0.28" version = "1.0.28"
@@ -1327,6 +1584,12 @@ version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
[[package]]
name = "simd-adler32"
version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea"
[[package]] [[package]]
name = "simd_cesu8" name = "simd_cesu8"
version = "1.2.0" version = "1.2.0"
@@ -1343,12 +1606,41 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
[[package]]
name = "skrifa"
version = "0.40.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fbdfe3d2475fbd7ddd1f3e5cf8288a30eb3e5f95832829570cd88115a7434ac"
dependencies = [
"bytemuck",
"read-fonts 0.37.0",
]
[[package]]
name = "skrifa"
version = "0.44.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "819ab7d62b1d3e72d9d9dea5650bac30424f9111364bb94928dbf5ecad1baa68"
dependencies = [
"bytemuck",
"read-fonts 0.41.0",
]
[[package]] [[package]]
name = "slab" name = "slab"
version = "0.4.12" version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
[[package]]
name = "slotmap"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038"
dependencies = [
"version_check",
]
[[package]] [[package]]
name = "smallvec" name = "smallvec"
version = "1.16.2" version = "1.16.2"
@@ -1389,6 +1681,12 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "smol_str"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4aaa7368fcf4852a4c2dd92df0cace6a71f2091ca0a23391ce7f3a31833f1523"
[[package]] [[package]]
name = "softbuffer" name = "softbuffer"
version = "0.4.8" version = "0.4.8"
@@ -1427,6 +1725,17 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731"
[[package]]
name = "swash"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c2499c2d826531388872b2268718aed907a39bd785ab0dcfe57fab26283f92e"
dependencies = [
"skrifa 0.44.0",
"yazi",
"zeno",
]
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.119" version = "2.0.119"
@@ -1449,6 +1758,15 @@ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]]
name = "sys-locale"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "tessera" name = "tessera"
version = "0.1.0" version = "0.1.0"
@@ -1456,12 +1774,18 @@ dependencies = [
"anyhow", "anyhow",
"compiler", "compiler",
"core", "core",
"font8x8", "cosmic-text",
"frontend", "frontend",
"objc2 0.5.2",
"objc2-app-kit",
"objc2-foundation 0.2.2",
"png",
"serde", "serde",
"serde_json", "serde_json",
"softbuffer", "softbuffer",
"tiny_http", "tiny_http",
"unicode-linebreak",
"unicode-segmentation",
"winit", "winit",
] ]
@@ -1555,6 +1879,12 @@ dependencies = [
"log", "log",
] ]
[[package]]
name = "tinyvec"
version = "1.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee"
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.53.2" version = "1.53.2"
@@ -1615,6 +1945,15 @@ name = "ttf-parser"
version = "0.25.1" version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31" checksum = "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31"
dependencies = [
"core_maths",
]
[[package]]
name = "unicode-bidi"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5"
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
@@ -1622,6 +1961,18 @@ version = "1.0.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954" checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954"
[[package]]
name = "unicode-linebreak"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f"
[[package]]
name = "unicode-script"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "383ad40bb927465ec0ce7720e033cb4ca06912855fc35db31b5755d0de75b1ee"
[[package]] [[package]]
name = "unicode-segmentation" name = "unicode-segmentation"
version = "1.13.3" version = "1.13.3"
@@ -1979,7 +2330,7 @@ dependencies = [
"rustix 0.38.44", "rustix 0.38.44",
"sctk-adwaita", "sctk-adwaita",
"smithay-client-toolkit", "smithay-client-toolkit",
"smol_str", "smol_str 0.2.2",
"tracing", "tracing",
"unicode-segmentation", "unicode-segmentation",
"wasm-bindgen", "wasm-bindgen",
@@ -2068,6 +2419,18 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56" checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56"
[[package]]
name = "yazi"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e01738255b5a16e78bbb83e7fbba0a1e7dd506905cfc53f4622d89015a03fbb5"
[[package]]
name = "zeno"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6df3dc4292935e51816d896edcd52aa30bc297907c26167fec31e2b0c6a32524"
[[package]] [[package]]
name = "zerocopy" name = "zerocopy"
version = "0.8.59" version = "0.8.59"
@@ -2088,6 +2451,12 @@ dependencies = [
"syn 2.0.119", "syn 2.0.119",
] ]
[[package]]
name = "zlib-rs"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112"
[[package]] [[package]]
name = "zmij" name = "zmij"
version = "1.0.23" version = "1.0.23"
+28 -2
View File
@@ -1,3 +1,4 @@
# Cargo 包元数据与编译器最低版本;二进制入口默认取 src/main.rs。
[package] [package]
name = "tessera" name = "tessera"
version = "0.1.0" version = "0.1.0"
@@ -6,18 +7,43 @@ rust-version = "1.91"
description = "Cross-platform desktop rendering client" description = "Cross-platform desktop rendering client"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
# 跨平台运行依赖:语言执行、文字排版、序列化、窗口/像素表面与轻量 HTTP 服务。
# Aster 三个 crate 使用固定在本仓库 vendor 子模块中的本地源码,不从注册表选择同名实现。
[dependencies] [dependencies]
# 应用边界的错误聚合与上下文,保留底层失败原因。
anyhow = "1.0" anyhow = "1.0"
# Aster 字节码编译器,把前端结果交给同一套 VM 执行。
compiler = { path = "vendor/aster/crates/compiler" } compiler = { path = "vendor/aster/crates/compiler" }
# 系统字体发现、塑形与换行,用于测量和软件文字绘制。
cosmic-text = "0.19"
# 解码脚本加载的 PNG 图像,供通用精灵绘制与透明轮廓计算。
png = "0.18"
# 按 Unicode 断行机会准备可复用文字片段,供排除区域绕排。
unicode-linebreak = "0.1.5"
# Aster 托管对象、类型系统、VM 和可恢复调用;依赖包名 core 在 Rust 中重命名为 endor_core。
endor_core = { package = "core", path = "vendor/aster/crates/core" } endor_core = { package = "core", path = "vendor/aster/crates/core" }
font8x8 = "0.3" # Endor 源语法解析与原始位置诊断。
frontend = { path = "vendor/aster/crates/frontend" } frontend = { path = "vendor/aster/crates/frontend" }
serde = { version = "1.0", features = ["derive"] } # 派生序列化协议,rc 特性允许发布模型中的 Arc/Rc 数据参与序列化。
serde = { version = "1.0", features = ["derive", "rc"] }
# HTTP 请求/响应与事件信封的 JSON 编解码。
serde_json = "1.0" serde_json = "1.0"
# 把宿主软件光栅化得到的像素缓冲呈现到原生窗口。
softbuffer = "0.4.8" softbuffer = "0.4.8"
# 本地 Agent API 的 HTTP 监听与请求响应,不引入异步 Web 运行时。
tiny_http = "0.12" tiny_http = "0.12"
# 按 Unicode 字素边界处理编辑/选择,避免把组合字符拆开。
unicode-segmentation = "1.12"
# 跨平台窗口、事件循环、DPI 与输入法事件。
winit = "0.30.13" winit = "0.30.13"
# 仅 macOS 编译原生标题栏适配,显式开启所用 AppKit/Foundation API,其他平台不引入这些依赖。
[target.'cfg(target_os = "macos")'.dependencies]
objc2 = "0.5.2"
objc2-app-kit = { version = "0.2.2", default-features = false, features = ["NSApplication", "NSButton", "NSEvent", "NSView", "NSWindow"] }
objc2-foundation = { version = "0.2.2", default-features = false, features = ["NSGeometry", "NSString", "NSUserDefaults"] }
# 发布构建:thin LTO 与单代码生成单元偏重最终优化,strip 去除可执行文件符号以控制体积。
[profile.release] [profile.release]
lto = "thin" lto = "thin"
codegen-units = 1 codegen-units = 1
-10
View File
@@ -1,10 +0,0 @@
FROM rust:1.91.1-bookworm
WORKDIR /build
RUN apt-get update && apt-get install -y --no-install-recommends pkg-config libx11-dev libxkbcommon-dev libwayland-dev libudev-dev libegl1-mesa-dev libgbm-dev \
&& rm -rf /var/lib/apt/lists/* \
&& rustup component add rustfmt clippy
ENV CARGO_BUILD_JOBS=1 CARGO_PROFILE_DEV_DEBUG=0 CARGO_PROFILE_TEST_DEBUG=0
COPY Cargo.toml Cargo.lock ./
COPY src ./src
COPY vendor ./vendor
CMD ["sh", "-eu", "-c", "cargo fmt --check && cargo test --locked && cargo clippy --all-targets --locked -- -D warnings"]
+569 -60
View File
@@ -1,54 +1,71 @@
# Tessera # Tessera
Tessera is a clean desktop rendering host. It starts with an empty page. Coding agents submit source code to a namespace through a local CRUD API; Tessera parses that code, builds its architecture tree, compiles it to drawing commands, and renders the result. Tessera is a native desktop UI host embedding [Aster](vendor/aster/README.md).
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 application starts with one managed New tab, implemented in Endor.
## Aster source dependency For the current architecture, UML diagrams and implementation status, start with
the [中文架构与进展导览](docs/architecture/README.md).
[Aster](vendor/aster/README.md) is an independent Git repository checked out as a ## Source and library integration
submodule at `vendor/aster`. Tessera records its exact commit in the Git submodule
entry; `.gitmodules` records its source URL. See [vendor](vendor/README.md) for
initialization, version updates, and the checkout layout.
Cargo directly depends on Aster's `frontend`, `compiler`, and `core` library `vendor/aster` is an independent Git submodule pinned to a published Aster commit.
packages through paths inside that submodule. The `core` dependency is named Cargo path dependencies directly use its `frontend`, `compiler` and `core`
`endor_core` in Tessera's manifest. These packages also bring in Aster's `objects` (library name `endor_core`) packages, which bring in `objects`. The Aster workspace
package. Aster retains its own Cargo workspace and source history. and history remain independent. See [vendor](vendor/README.md) for initialization
and version updates, and [src](src/README.md) for the implementation map.
Rust 1.91 or newer is required. Building Tessera compiles the required Aster The runtime now uses Aster's Reader, Parser, AST, Compiler and VM. Tessera's former
libraries automatically; no separate Aster build or CLI/server process is experimental `namespace` / `export scene` / `render` parser has been removed.
required. Tessera does not depend on Aster's storage, host, CLI, or server packages. Host UI integration lives in Tessera; Aster needs no Tessera-specific changes.
Lyra CLI and Hestia Server are independent hosts and are not application dependencies.
This change establishes the source and library dependency only. The namespace ## Endor manuscript example
API still uses the experimental Tessera parser described below. Executing Endor
through Aster and replacing that parser is the next implementation step; no
Aster source changes are part of this integration.
## Start [illustrated-manuscript.endor](examples/illustrated-manuscript.endor) implements
cursor-following dragon animation, small directional fire and text exclusion in
ordinary Endor. It uses generic graphics resources, source paint, pointer events
and Page-owned Tasks; no native demo mode is required. See [run instructions,
script walkthrough and validation](docs/illustrated-manuscript.md).
Initialize the Aster submodule first, following the SSH identity instructions in ## Native build and start
[vendor](vendor/README.md):
Use Rust 1.91 or newer. Initialize the source submodule following the dedicated
codex-bot SSH identity instructions in [vendor](vendor/README.md), then build:
```bash ```bash
git submodule update --init --recursive git submodule update --init --recursive
cargo build --release --locked
./target/release/tessera
``` ```
For local native builds and window runs (automated tests run only in CI): 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 by default. A temporary dependency mirror may be used
when the official source is unavailable, without changing global configuration.
Builds and validation run locally using the native Rust toolchain; no CI/CD
workflow or Docker toolchain is configured. The command above produces a native
executable. To create a
Finder-launchable development app on macOS, run:
```bash ```bash
cargo run --release sh scripts/build-macos-app.sh
``` ```
Tessera listens only on `127.0.0.1:4737`. Open `target/release/Tessera.app`. See [packaging](scripts/README.md); this local
bundle does not include distribution signing, notarization or an installer.
Start every agent integration by reading the live Markdown guide: The API listens only on `127.0.0.1:4737`. Start integrations with its live guide:
```bash ```bash
curl http://127.0.0.1:4737/agent curl http://127.0.0.1:4737/agent
``` ```
## Namespace code API ## Submit Endor
The initial active namespace is `app.main`. Tessera has no file concept. The active namespace starts as `app.main`:
```text ```text
GET /v1/namespaces/app.main/code GET /v1/namespaces/app.main/code
@@ -56,53 +73,545 @@ PUT /v1/namespaces/app.main/code
DELETE /v1/namespaces/app.main/code DELETE /v1/namespaces/app.main/code
``` ```
Submit code as plain text: Submit the [complete example](examples/page.endor):
```bash ```bash
curl \ curl --request PUT --header 'Content-Type: text/plain; charset=utf-8' \
--request PUT \ --data-binary @examples/page.endor \
--header 'Content-Type: text/plain; charset=utf-8' \ http://127.0.0.1:4737/v1/namespaces/app.main/code
--data-binary @- \
http://127.0.0.1:4737/v1/namespaces/app.main/code <<'TESSERA'
namespace app.main
use tessera.ui::{Column, Text}
export scene Main {
render {
Column(gap: 12, padding: 24) {
Text("Hello", role: .title)
Text("Rendered by Tessera")
}
}
}
TESSERA
``` ```
Updates are atomic. Invalid code returns diagnostics with HTTP 422 and preserves the last successfully rendered revision. A minimal program is:
```endor
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. 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
All arguments are positional. Defaults below describe omitted trailing arguments,
not Endor keyword argument syntax.
| Member | Arguments and defaults |
| --- | --- |
| `ui.text` | String, integer size (default 1, range 1..8), color (default `#242422`) |
| `ui.rect` | Width, height, radius (default 0), color (default `#DCE8FF`) |
| `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 retains one active program with multiple managed Pages and windows.
Each window projects its ordered Page registry and currently selected Page.
Rendering an existing Page updates that Page without replacing shared business
objects. A complete-source PUT 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 is shaped and antialiased with COSMIC Text and Swash, using
installed system fonts and per-glyph fallback (including Chinese when a CJK font
is installed). UI text uses a proportional sans-serif font; developer source uses
a monospace font. The existing size argument remains a 1..8 multiplier: size 1
is 14 logical pixels with a 20-pixel line height; size 2 is 28/40. Row/Column layout
uses measured text advances and multiline height. Device scale remains fractional,
and glyphs are rasterized at the actual display resolution rather than enlarged.
The application does not bundle proprietary OS fonts. Linux installations need
fonts such as DejaVu Sans/Mono and Noto CJK installed locally.
## Candidate execution and publication
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.
Aster's scoped NativeContext allocates actual managed Block objects on demand.
Blocks own managed Cells and data objects; child, history and forwarding edges
are traced by the same VM collector. Native methods capture their owner through
declared heap edges. No fixed node/page pool or separate mutable Arc graph remains.
The desktop's tab registry holds open Pages. close releases that registry edge;
referenced Pages remain usable and unreferenced cycles are collected between inputs.
The bridge's diagnostic object index uses non-owning WeakObjectRef values.
Limits are 1 MiB source, 10000 visited AST nodes with a 64-level visitor depth,
4096 retained visual objects, 64 retained pages, 10000 expanded graph/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.
GET reads the last successful source while the worker executes. PUT waits for its
result; a successful response includes submission and committed revision numbers.
Parsing, compilation, execution, argument or layout errors return 422 with
explanations and preserve the last successful document. Source diagnostics include
line, column and byte ranges; VM tracebacks currently identify function starts and
instruction offsets, not an exact source location for every instruction.
A newer accepted PUT invalidates older work. DELETE clears the document immediately
and invalidates both queued and executing candidates. Superseded requests return
409 and cannot republish their page. A full or unavailable queue returns 503;
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 live mounted UI for both complete programs and Console inputs, with immutable window frames on the existing worker.
Native mouse/keyboard activation and code-driven callbacks share onClick/click. Managed Mount objects expose each occurrence, and property dependencies and measurement caches avoid recomputing clean visual subtrees. Arrangement still traverses occurrences.
Sidebar page navigation and multiple windows are available. Typed capability contracts
are installed for host protocols; the complete language/type/effect surface and
process isolation remain incomplete. Worker threads,
source budgets and VM instruction limits are not a complete untrusted-code sandbox.
## Developer tools ## Developer tools
The developer sidebar is closed by default. Native visual protocols are under active implementation: Text/Rect/Row/Column,
container append/insert/remove/replace/move, Page open/close/navigation, ui.present,
ui.state(value), ui.textOf(state, "value"), and button.onClick/click are available
in the persistent Console. Method bodies can call other methods without a trailing
return. Bound text tracks its source property; clean derived subtrees and unchanged measurements are reused. Buttons have a native background, focus ring and pointer/keyboard activation.
`Page()`, `TextBlock(...)`, `Row(...)`, `Column(...)`, `ScrollBlock(...)` and `Button(...)` are callable managed type objects; `Page.base` is ContainerBlock and `page.type` is Page. `isInstance(page, Block)` and `isSubtype(Page, Block)` query nominal relations. Object and Type are explicitly bootstrapped in the same GC heap. Ordinary source class declarations, positional field construction, member assignment and inherited method dispatch are supported; source subclasses of concrete native visual types now reuse their real native allocator; abstract types remain unconstructible. Explicit host-registered capabilities are available; formal trait syntax and full type/effect checks remain pending. Native visual methods now live on their nominal type tables and use the same receiver binding as source methods. See [managed-types.endor](examples/managed-types.endor), [classes.endor](examples/classes.endor) and [native-subclasses.endor](examples/native-subclasses.endor).
- macOS: `Command-Option-I` or `F12` Source native subclass construction takes native arguments first, followed by all inherited and own declared fields. For example, a TextBlock subclass with one field accepts `CustomText("text", 2, "#242422", fieldValue)`; optional native arguments can be omitted before the required field suffix. Field storage belongs to the current shared Block content: replacement updates aliases and bindings and releases the previous fields through Aster. This is an implementation subset; field annotations are not yet runtime checked.
- Windows/Linux: `Control-Shift-I` or `F12`
The upper section displays the compiler-produced architecture tree. Selecting a node shows the corresponding source range below it. Events use `block.on("click", callback)` or `block.on("click", callback, "capture")`, returning a managed Subscription with `disconnect()` and `isConnected()`. A Block owns its connections; tokens refer to connections weakly and do not retain the target or callback. Dropping a token leaves the listener registered. Disconnection releases the callback and is safe to repeat.
## Current syntax experiment `block.dispatch(Event("custom"))` returns the dispatched Event. `block.click()` creates a click Event and uses the same dispatcher as native activation. An optional Mount selects one occurrence: `block.dispatch(event, mount)` or `block.click(mount)`. Without a Mount only the target is visited. With one, capture walks from Page through ancestors, then target capture, the object's `onEvent(self, event)` method and target listeners, then ancestors/Page in bubble order. The target method runs before non-capture target listeners. Event fields expose `kind`, `target`, `mount`, `currentTarget`, `currentMount` and `phase` (`capture`, `target`, `bubble`, then `none`). Source subclasses can override onEvent.
The first parser intentionally supports only enough syntax to test the architecture: Event methods `stopPropagation()`, `stopImmediatePropagation()`, `preventDefault()` and `isDefaultPrevented()` control delivery or report cancellation; there is currently no additional host default action to cancel. stopPropagation permits remaining listeners on the current occurrence, while the immediate variant stops them too. Listener order is snapshotted at dispatch start; disconnection before a listener's turn skips it, new connections wait for the next dispatch. The existing onClick setter remains a single compatibility callback, called after other non-capture listeners on that Block. All handlers share the VM call budget, with an explicit 10000-delivery limit that reports failure instead of truncating propagation. Reentrant dispatch of the same active Event is rejected; a completed Event can be reused. See [events.endor](examples/events.endor).
- `namespace` Visual objects also inherit `onMount(self, mount)` and `onUnmount(self, mount)` no-op methods, which source subclasses can override. Notifications occur once per actual occurrence transition: parents before children when attaching, children before parents when detaching. Updating text, color or geometry keeps an existing Mount and does not remount it. Shared content keeps its Block identity when replaced; hooks describe Mount attachment rather than each mutation of that content. Replacing a container child or switching Page produces the appropriate occurrence transitions, even when two Pages display the same root object. Mount lifecycle follows the active presentation in each native window.
- namespace-only `use`
- one `export scene`
- one `render` root
- `Column`, `Row`, `Spacer`, and `Text`
- `gap`, `padding`, and `.title`
There are no files, HTML, CSS, JavaScript, DOM, or resource-network concepts in the runtime. Mount synchronization queues hooks after links and geometry are coherent. Hooks execute outside the session lock, under one VM budget per batch, after the source input or native event and before final publication. They may update objects or containers; resulting layout/notification work settles before a complete frame is published. A scalar Console result is evaluated before these deferred hooks. The rendering work budget explicitly fails on non-converging feedback. A hook failure after mount mutation stops that runtime and retains its previously displayed frame; failed PUT candidates preserve the old runtime. Hooks are never invoked by GC or by discarding an execution domain.
Saved detached Mounts expose `mounted = false`, cleared parent/child/sibling links and a weak Page query for cleanup; geometry, focus and hit-test operations reject them. Reopening creates new contexts and never revives an old saved Mount. `layoutVersion` is refreshed even when only paint inputs change. See [mount-lifecycle.endor](examples/mount-lifecycle.endor).
Native visual methods are now available on Block: `measure(mount, Constraints(minWidth, minHeight, maxWidth, maxHeight))`, `arrange(mount, Bounds(x, y, width, height))`, `paint(mount, Bounds(...))` and `hitTest(mount, Point(x, y))`. The Mount must be live and belong to that exact Block occurrence. These query methods return managed MeasureResult, Arrangement and DisplayList objects, using the renderer's native geometry and painting functions. They do not publish geometry or pixels. Results are readable in Endor: `result.width`, `arrangement.children.at(0).x`, `drawing.commands.at(0).color`; indexed ObjectList results provide count, first and at(index), with traced references. Arrangement child bounds also carry their stable slot. Paint returns only that object's own commands; descendants are separate occurrences.
Outside a renderer layout call, native measurement queries find intrinsic native subtree size and clamp it to the given constraints. During layout, native base methods use the staged measured children of that occurrence. Native Row/Column arrangement uses child sizes, padding and gaps; it does not stretch children to fill the supplied bounds. Hit testing uses local coordinates against the current Mount dimensions. Coordinates/dimensions must be finite and remain within the native layout limit. Width/height and constraint ranges cannot be negative or inverted. The value constructors preserve fields as ordinary objects with declared-field type checks; methods also validate their geometry when used. Whole-program static typing remains pending.
Visual, EventTarget, Children and Presentable are explicit managed Trait definitions. Block declares Visual (measure/arrange/paint/hitTest) and EventTarget (on/dispatch/onEvent); ContainerBlock declares Children (append/insert/remove/replace/move/children), inherited by Page. `ui.supports(value, capability)` queries an instance; `ui.implements(type, capability)` queries a type. `ui.implement(type, capability)` checks required methods and establishes an explicit relation. Matching member names alone never declare a capability. Aster checks source positional parameter counts, including self, when registering, creating subclasses or replacing methods; declaration and ancestor updates also validate existing affected descendants. Source and native positional intervals are checked against the canonical call count, including self; native methods without metadata cannot declare a capability; source argument/return annotations are checked at invocation as described below. Typed requirements also compare parameter/return types and known native effects. Runtime calls check actual results across delegation. Conservative bytecode and current call-graph proofs recognize ReadOnly source functions; general effect inference and formal trait syntax remain pending.
A plain source object can declare Presentable by implementing `present(self, window: Window): Block` and calling `ui.implement(MyType, Presentable)`. `ui.present(value)` invokes this method with the calling window and checks the returned actual Block; `ui.open(value)` also opens the result in a Page. Block values pass through directly. The existing summary viewer remains the fallback for unregistered values, and merely viewing a function does not execute it. Presentation runs through the same bounded VM call sequence; there is no recursive host evaluator. A source adapter can keep the original object through fields/callbacks/bindings; [presentable.endor](examples/presentable.endor) shows a source-preserving view and GUI calls to the original object's method. Presentation methods are ordinary calls; visual measure/arrange/paint/hitTest still run read-only and check their nominal results at runtime. Source implementations of EventTarget.on/dispatch must provide the contract's canonical 3/2 arguments after self; native methods retain their existing optional convenience arguments.
`ScrollBlock(width, height, child)` is a ContainerBlock with a bounded viewport. Its `axis` attribute defaults to `"both"`, preserving unconstrained content measurement. `"vertical"` wraps/restricts content to the actual occurrence viewport width minus padding, while `"horizontal"` restricts its height. The disabled axis has a zero offset/limit, including after a live axis change. Source-arranged viewport dimensions participate in remeasurement. Child stacking remains Column-like; use a Row child for horizontal composition. See [scroll-axis.endor](examples/scroll-axis.endor). It also supports inherited child operations and padding/gap. Its width/height are managed attributes and can be bound or assigned. Each attached Mount owns its scroll offset; two occurrences of the same ScrollBlock scroll independently. Moving/remounting content creates a new Mount and starts at zero. Changes to content or viewport clamp offsets to the new limits.
`mount.scrollTo(x,y)` and `scrollBy(dx,dy)` update that occurrence; multiple relative requests in one input accumulate. `scrollPosition()` returns a snapshot with x/y/maxX/maxY from the last committed layout. `mount.scrollIntoView()` minimally adjusts all scrollable ancestors, and requestFocus() uses it too. Requests settle at the same successful input/event boundary as other UI changes. Detached mounts and mutations during read-only rendering are rejected. Wheel input selects an eligible scrolling ancestor of the foremost visible occurrence, with outer scrolling when the inner range is exhausted; Shift+wheel selects the horizontal axis. A diagonal gesture currently goes to one eligible container rather than splitting axes across ancestors. Scrollbars/thumb dragging, touch inertia and PageUp/PageDown are not yet implemented.
Native/source painting, focus outlines, pointer selection and Mount.hitTest share the final translated geometry and intersected ancestor clip rectangles. A clipped descendant keeps its identity and state but cannot receive pointer clicks outside the viewport. This does not remove it from the managed object graph. Paint x/y may be negative within the existing coordinate budget after projection; dimensions and radii remain nonnegative. See [scroll.endor](examples/scroll.endor) for a shared object tree in two independent native windows.
`block.bind(property, compute)` binds an existing managed field to a zero-argument function and returns a Subscription with disconnect()/isConnected(). Targets are Block fields, including source-defined fields; arbitrary non-Block objects are not binding targets yet. Native visual fields are now ordinary attributes: TextBlock.text/size/color, RectBlock.width/height/radius/color, Spacer.size and container padding/gap. Direct assignments and native setters feed the same visual snapshot. Text size remains 1..8, geometry must be finite/nonnegative and within the existing limits, and colors use the existing color parser. Legacy textOf still owns its derived text until setText or a text binding replaces it.
The target's managed content owns its bindings; each binding traces the actual compute function and its captures. Tokens and the host registry hold weak references. Rebinding a field disconnects its previous binding; disconnecting leaves the last value in place. Hidden but still-referenced Blocks update at successful input/event/viewport stabilization boundaries. Functions run read-only against existing objects; they may construct result objects. Dependencies are recorded from actual VM reads, with object-level versions and conservative global-dictionary invalidation. This replaces the earlier candidate API's explicit source list. Binding results are settled before frame publication, including across windows and after lifecycle changes. Values read earlier in the same input precede this batch boundary. Explicit dependencies and property-level dependency precision remain future work.
One Block can have up to 128 active bindings. Each computation has 100000 instructions/128 frames, and a refresh rejects after 10000 computations if dependencies do not stabilize; it reports an error and preserves the published picture instead of silently truncating propagation. A live binding-computation failure stops that runtime. General type/effect checking remains pending. See [property-bindings.endor](examples/property-bindings.endor) for actual Endor source.
Declared fields now use the same runtime type-check switch as source functions, enabled in Tessera. Ordinary and native subclass constructors validate field arguments before allocating/opening native objects. Subsequent source assignments, native set_attr calls and binding writes check the actual declaring field before changing its storage; an error preserves that field's old value. Declared fields cannot be deleted while checks are enabled. Inherited fields use their declaring ancestor and environment. The declaring class name means that actual definition, so REPL redefinition preserves old self-type fields; other names resolve dynamically from the declaration's globals/builtins. Shared Block forwarding selects the current content's type and storage. See [field-contracts.endor](examples/field-contracts.endor).
These are checks at construction/write boundaries. Enabling does not scan old objects, and changing a referenced object's shared content does not revalidate every field that refers to it. Trusted hosts still own low-level payload/storage/attach operations. Complete initialization, local/captured type-name resolution, override variance, static and effect typing remain pending.
`invalidate("paint")` requests a frame while retaining measurement caches; `invalidate("layout")` also clears affected intrinsic measurements; `invalidate("content")` also invalidates derived content and ancestor dependencies. The default reason is layout. Requests coalesce at the refresh boundary, cover all aliases/occurrences of the same current content and preserve Mount identities. Hidden objects do not force visible frames. See [visual-protocols.endor](examples/visual-protocols.endor). Source measure/arrange overrides now participate in actual layout with structural Mount contexts available before first measurement. Source paint and hitTest also run in the frame/input pipeline. Full parameter/return type and effect contracts, more precise context dependencies and additional container allocation policies remain future work.
A source subclass can override `measure(self, mount, constraints): MeasureResult` and `arrange(self, mount, geometry): Arrangement`. The persistent renderer creates stable Mount identities and parent/child/sibling links before measuring. Measurement proceeds bottom-up with the current logical viewport as the Page constraints (headless callers default to 0..1000000); native parents and explicit native base calls use the current occurrence's measured child sizes, including source overrides. Arrangement proceeds top-down; each child Bounds must be assigned exactly once using its stable slot, with nominal result types and finite geometry checked. Source arrangements can resize or move children; omission, duplicate/foreign slots and invalid geometry reject the frame. See [source-layout.endor](examples/source-layout.endor).
Source layout now repeats bottom-up measurement and top-down arrangement inside one read-only VM call until input constraints, desired sizes and all allocated bounds repeat unchanged. Source-arranged dimensions that differ from a child's measured size become exact constraints for that axis during this solve. Native parents then account for the newly measured size. A source container measurement that differs from native measurement also constrains its content on the relevant policy axis. Selected limits remain until this solve finishes; the next input/resize starts fresh. Ordinary native intrinsic-size policies are retained. See [layout-negotiation.endor](examples/layout-negotiation.endor).
The solver detects a previously visited nonconsecutive state as a cycle. It has no fixed propagation/pass cutoff: the whole solve shares the existing 1000000-instruction/128-frame VM budget, and exhaustion is an explicit failure. It reuses one bytecode driver frame rather than nesting one frame per pass. All measurement phases clear provisional geometry from every Mount, and only the complete settled result is committed. Failed candidates preserve the active program; live layout failures stop the domain and preserve its published picture. This is not a resumable layout scheduler or an optimal/general flex solver.
`ui.stats().layoutPasses` reports passes for the latest layout (native-only fast path uses one). Measured/arranged/cache counters include the work of all solve passes. Source annotation validation is distinguished from actual content reads: merely checking a Mount parameter's type no longer disables measurement caching, while program reads of Mount layoutVersion/geometry still bypass it conservatively. Other type/validation dependencies remain version-checked. Runtime type checks stay enabled.
Mount.bounds() rejects reads during measurement, including old geometry on an existing Mount. The current occurrence's allocated Bounds become available while its arrange method runs. Structural contexts are prepared before layout, geometry is committed after successful layout, and onMount/onUnmount notifications then run before paint/publication. Both layout phases share one read-only VM call and instruction budget; temporary results can be modified, existing business state cannot. Read versions are captured before hooks, so a hook changing a measured dependency schedules another pass before publication. Dependencies are currently tracked per object. Source measurement results are cached by Mount identity, method, child sizes, constraints and actual object reads, including decoding an existing returned MeasureResult. Cache entries contain borrowed identities and versions, adding no GC roots. Mount-reading measurements currently bypass the cache conservatively because object-level tracking cannot distinguish layoutVersion/geometry from stable structure. Global dictionary writes or changes to another field on a read object can also cause conservative misses. Native measurements keep their shape cache, and arrangement still visits each active occurrence. ui.stats() exposes sourceMeasureHits/sourceMeasureMisses; diagnostic statistics are rejected inside read-only rendering because allocation/count observations are not stable layout inputs.
`Window: Object` represents a native window resource. `Window()` creates another window in the same Aster VM, up to 16 open windows per runtime. `ui.window()` returns the current event/render window, with the main window as the top-level Console default. `page.window()` reports its actual owner or nil. `page.open(window)` and `page.moveToWindow(window)` move the same Page, including navigation and business references, to that window. Omitting the open target keeps an existing owner; an unowned Page uses the calling view. `page.detachToWindow()` creates a new Window, moves the Page there and returns the resource. Moving a Page unmounts the old occurrence and creates destination Mounts. `window.pages()` returns a traced ObjectList in open order. See [windows.endor](examples/windows.endor).
`container.insert(position, block)` inserts at a zero-based position from 0 through the current child count and returns a new stable slot. Existing slots and attached Mount identities survive insertion. Invalid positions and cyclic child graphs fail before replacing the child list. `page.moveTab(position)` moves the same Page to a final zero-based position in its owning window; a code reorder does not implicitly activate it.
The version-checked tab-drop transport remains available for managed Page movement. Same-window requests call moveTab/activate and cross-window requests call moveToWindow first. Source overrides participate; generation/layout mismatches reject before callbacks. The sidebar currently supports selection/closure, with pointer dragging deferred. See [tab-placement.endor](examples/tab-placement.endor).
`window.moveTo(x, y)` queues a native outer-window origin in signed physical desktop pixels, within +/-1000000 per axis. The window manager can adjust placement; unsupported native placement reports a diagnostic. Sidebar cross-window pointer dragging and mixed-DPI gestures remain unverified.
`window.close()` and a secondary native close button call the same managed method. Closing first removes Page ownership, then commits unmounts and removes that context from the runtime registry; the native resource disappears after successful publication. Retained Pages can be opened in another live Window; otherwise Aster reclaims them normally. Window resource objects may remain referenced after closing, but reject resource operations; id/pages remain queryable. A retained leaf Mount uses a weak context link and cannot keep a closed window alive through its query methods. The primary shell still defines the application's lifetime: closing its OS window exits Tessera. Full application-exit notifications remain follow-up work.
A secondary window can also be closed after a callback/rendering failure or Console reset. A stopped VM uses host teardown to detach Mounts and release window-owned Page roots without invoking source close/unmount callbacks; it remains stopped. A preserved picture from a discarded generation is removed without touching a fresh Console VM, even when both generations use the same numeric window ID. Secondary viewport inputs are likewise scoped to their runtime generation. If host teardown fails, that VM is discarded and remaining pictures have input disabled. Native initialization and software-surface failures are reported instead of panicking; a failed secondary creation leaves its managed resource inspectable and closable from Console. Automatic retry and complete application-exit notifications remain future work.
Each window has its own Presentation, layout/Mount/focus state, caches and native viewport. A single VM change batch fans out to all views, all affected frames settle before publication, and shared business references are never copied. Frames and native inputs carry window/session/layout identities; stale requests are rejected. Existing event clients default to window 1, exposed by X-Tessera-Window. Secondary native resize feeds the same worker and updates only its window constraints. Console reset preserves all old pictures with input disabled; replacement sessions discard the old native resources before projecting new resources with the same numeric IDs.
Open Pages appear in the left sidebar. Set `page.title` to label a page; clicking its row or close control calls the actual Page `activate()` or `close()` method in the same VM. Ctrl+Tab / Ctrl+Shift+Tab cycle pages, Cmd/Ctrl+T creates one and Cmd/Ctrl+W closes the active page. Sidebar rows scroll when needed. Source overrides, managed references, GC and stale-event rejection remain in use. See [tabs.endor](examples/tabs.endor).
The host has one collapsible left sidebar, with page navigation and Console/Sources/Network/Settings. Cmd/Ctrl+B toggles it. Collapsed, the host draws only its expand button alongside the three real macOS window controls; content fills the native inner window with no top strip or surrounding inset. Only this small control area intercepts page input. `ui.viewport()` / `window.viewport()` and the API viewport headers report the available page area, including the width recovered when the sidebar collapses. Page drawings and hit tests share one camera transform. See [page surfaces](docs/page-surfaces.md).
`window.resize(width, height)`, `setTitle(text)` and `focus()` project requests to the GUI thread. `id()` returns an opaque runtime resource ID and `viewport()` reports actual logical dimensions. Requests are asynchronous and coalesced by kind; queried dimensions change when the native window reports them, and platform bounds can adjust requested sizes. This host accepts sizes from 1 to 4096 logical pixels per axis, with a native minimum of 720 by 480. Titles are UTF-8 text up to 4096 bytes with no control characters. See [window.endor](examples/window.endor).
Native creation and commands remain local until the input/candidate succeeds. Failed inputs discard pending commands; failed PUT candidates preserve the live native window. Accepted projections carry the runtime session, so replacement/reset/discard clears old requests. GUI publication and native operations are serialized through the namespace boundary. Read-only rendering rejects window side effects. The private transport queue contains only resource IDs/scalars, introduces no Page roots, and is drained without incrementing object versions. Tab UI, move/detach and secondary native windows use the same resource pipeline.
The native window publishes its current logical content size to the existing VM worker on startup, resize and scale changes. The worker coalesces the latest size, updates the managed viewport input, and refreshes the same runtime without adding Console source/history entries. ui.viewport() returns a fresh managed width/height snapshot; reads during rendering depend on the private input object. User changes to a returned snapshot do not resize the window. Unchanged sizes cause no frame; a fresh or unopened Console runtime updates its inputs without replacing a preserved displayed page. Failed resize layouts stop the affected runtime and preserve the displayed frame.
Row, Column and Overlay can nest with main/cross alignment, per-child alignment, margin, asymmetric border/padding, fixed/auto/fill sizes and min/max constraints. Page owns the root; scrolling is a finite ScrollView around ordinary layout. Scene2D owns world positions and CanvasViewport provides a finite UI box with an explicit Camera2D. Multiple views can share a scene while retaining independent cameras; assigning the same camera explicitly shares navigation. The old `Page.mode` API remains for compatibility. See [scene architecture](docs/scene-architecture.md), [box layout](examples/box-layout.endor) and [scene viewports](examples/scene-viewports.endor).
Scene3D, Group3D, mesh geometry, lights and programmable perspective/orthographic cameras render through finite Viewport3D boxes. OrbitController handles rotation, pan and zoom and can be replaced by an Endor controller. Ray picking and world-space Panel3D UI use the same transforms and depth visibility. A panel can contain ordinary UI, a 2D canvas or another 3D viewport. Rendering currently uses the existing CPU compositor with bounded depth/texture surfaces; this is not a GPU renderer. See [3D scenes](examples/scene3d.endor) and [world UI](examples/world-ui.endor).
Native pointer clicks now resolve source `hitTest(self, mount, point): Bool` overrides in reverse paint order, then dispatch through the existing capture/target/bubble route. The Point is local to that occurrence; `point.inside(bounds)` uses a half-open rectangle and `point.inCircle(cx, cy, radius)` includes the circle boundary. Each candidate is first restricted to its Mount rectangle, so hit shapes can refine that area, but cannot expand it. A rejected target falls through to another interactive occurrence, including a parent. Ordinary Blocks become interactive through a live click subscription or a source onEvent override; disconnecting the final click subscription updates that status. See [source-hit.endor](examples/source-hit.endor).
The native app sends both press and release positions with the click. Both targets are resolved against the current published frame and heap when the release is processed; only matching Mount identities dispatch a click. These selectors share one read-only VM call and budget, and must return Bool. Callback execution starts after the read-only scope has ended. This is semantic click handling, not a raw pointer-down/up event stream or pointer capture. Keyboard/programmatic activation retains its semantic target and bypasses spatial filtering. API pointer events carry `point: [x, y]` and `press_point: [x, y]` together; GET code exposes X-Tessera-Session and X-Tessera-Layout-Version headers for clients to obtain current metadata without evaluating more source.
Native TextBlock measurement now uses the occurrence's maximum width, with word wrapping and glyph fallback for long words. Width changes affect measured height and propagate through native Column/Button sibling placement. The shared text cache includes wrap width; the native shape cache also includes the incoming width. Native base measure queries use the supplied constraints both during source layout and when called directly. Shared Blocks retain separate geometry per Mount and can wrap differently in different windows. See [wrapped-text.endor](examples/wrapped-text.endor).
Native TextBlock painting carries its allocated width/height into the immutable frame and clips glyphs to those bounds as well as any enclosing scroll clip. Measurement and drawing use the same font/shaping implementation; drawing shapes at the device font size. Zero-width or zero-height paint bounds draw nothing. Management UI text keeps its existing single-line/explicit-newline behavior.
Source `PaintCommand` text may supply both `wrapWidth` and `wrapHeight` as finite nonnegative logical dimensions up to 1000000. Omitting both preserves unwrapped text; supplying only one is rejected. `TextBlock.paint` returns these fields, so a source override can preserve or explicitly change the boundary. Changing paint bounds does not renegotiate layout: source arrange supplies child Bounds and changed dimensions participate in the layout solve. Bounded flex allocation is described below. ScrollBlock's axis policy now controls cross-axis wrapping and scrolling. Fractional-DPI wrap boundaries need broader platform validation.
A source subclass can override `paint(self, mount, geometry): DisplayList`. The renderer invokes that method for each occurrence, after Mount synchronization and hooks, using current logical Bounds. Its commands replace that occurrence's native paint in preorder. Calling `RectBlock.paint(self, mount, geometry)` or another native base method obtains a fresh result that can be modified before returning. `DisplayList(ObjectList(command, ...))` builds multiple commands; ObjectList accepts objects and has a 10000-member bound. PaintCommand fields use kind (`roundedRect`, `strokeRoundedRect` or `text`), x/y/color and the corresponding width/height/radius, strokeWidth, or text/size fields. Commands must pass the same native validation and a total 10000-command frame limit. See [source-paint.endor](examples/source-paint.endor), including a Button source method that updates the same tint field used by two occurrences.
Renderer-dispatched paint runs in a read-only Aster call: existing heap objects cannot be modified; fresh result graphs may be allocated and filled. Existing globals, model fields, containers, Mounts and types remain protected. invalidate is rejected in this phase. All overrides share one VM budget. Read dependencies are currently recorded per object, with versions used to detect changes without depending on bounded change-notification delivery. Native frames keep their existing dependency/cache behavior. Derived allocations do not produce application change notifications, preventing temporary results from causing redraw feedback. This protects managed heap writes; trusted Rust host implementations must also respect read-only calls for external state and I/O. Paint errors stop the affected runtime before publication; failed PUT candidates preserve the previously running heap and frame.
The application starts with an Endor Page containing a Scene2D and CanvasViewport. Its four actions demonstrate a window-sized layout, vertically scrolling Column, horizontally scrolling Row and independent canvas. The default page is implemented in [start_page.endor](src/bridge/ui_bridge/start_page.endor), compiled once per VM in a private namespace. `ui.newTab()` and the sidebar New page action use the same factory. Cards, copy, layout, actions and the shared-state example are Endor objects. The host owns the sidebar and native window controls.
Console, Sources, Network and Settings are independent managed Pages with separate
view modules and window-local input/focus/scroll/selection state. They are not
opened by default; the left sidebar provides their launchers. Existing integrations can call
`ui.developerTools("Console")`, `"Sources"`, `"Network"` or `"Settings"`.
F12, Cmd-Option-I and Cmd-Shift-I on macOS, or Ctrl-Shift-I elsewhere,
open/focus Console. Page closure, placement and GC use the ordinary Page methods.
Sources supports read-only drag selection, select-all/copy, and Shift+arrow
selection; source line numbers are excluded from copied text. The Console prompt
only captures pointer hits over its actual input lines.
See [the UI requirement audit](docs/ui-workspace-audit.md) for the full change
scope, design references, native verification and outstanding evidence.
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. The current prompt, submitted commands and results
share one scrollable surface, with no separate input box, editor splitter or Run
toolbar. Typing appears at the prompt immediately; Enter executes it and the result
appears directly below. Shift-Enter inserts a newline. Each command and its result
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 mount them when ready:
```endor
title = ui.text("你好,Tessera", 2, "#243047")
```
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))
```
Ordinary values keep normal name assignment. UI references opt into Aster's
managed `ObjectPayload::assignment_cell` 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
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. 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 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 retained pages. Unreachable objects and cycles 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. On success the new VM remains live for Console and GUI events; a failed replacement preserves the old VM. Accepted PUT/code DELETE invalidate 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 in the Console footer 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
`src/shell/sources.rs` supplies file identities/paths and full source on open; there is no
cloud backend, fake file listing or source persistence in this release.
Network observes only HTTP requests handled by this Tessera process on
`127.0.0.1:4737`, including pending requests, method, path, status, server duration,
request/response headers and bodies. Filter matches method, path or status. Clear
clears the Network view without changing the document or Console transcript. A bounded
ring retains 80 requests with explicitly marked 32 KiB body previews. Request
headers are allowlisted to Content-Type and Content-Length; credentials and cookies
are not captured. No external browser or operating-system traffic is represented.
Console and Network share the bounded capture ring and have independent clear
markers. Clicking a Console record opens its Network details and restores that view.
Settings applies six accent presets or a custom six-digit hex color immediately.
Very bright custom colors are darkened to keep accents visible on white. Execution
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/shell/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 at the Console prompt. Empty
Clear actions are disabled. Splitters are painted and registered above all pane
backgrounds, toolbars and status bars, so their entire length stays visible and
draggable. macOS clipboard reads and writes explicitly use
UTF-8 even when launched from Finder, and decoding errors are surfaced.
## Validation ## Validation
Local Cargo builds and native window runs are allowed; do not run local tests or Docker. Automated tests and Clippy run in [.gitea](.gitea/README.md) on ces-control using Dockerfile.ci. The Linux CI checks portable code and software-renderer tests, not macOS window presentation. Aster dependency unit tests remain in Aster CI. CI bot SSH secrets are documented in .gitea/README.md. Run checks from the repository root after initializing the pinned Aster submodule:
```bash
cargo fmt --check
cargo test --locked
cargo clippy --all-targets --locked -- -D warnings
sh -n scripts/build-macos-app.sh
```
The existing tests cover rendering, Aster execution, page layout, source ranges,
lifetime, budgets, failed-update preservation and deletion invalidation. API tests
use loopback HTTP, so allow local socket access. Font checks use installed system
fonts. Automated checks do not replace native window verification: launch Tessera
and check the start page, shared-object example, tab creation/closure and developer
tools. Build the macOS bundle separately with `sh scripts/build-macos-app.sh`.
There is no repository CI/CD workflow. Commits and pull requests do not trigger
builds or deployment; record the actual local check results with each delivery.
### Source function types
Tessera enables Aster runtime checks for source parameter and return annotations.
`Object` accepts any live value, `Unit` accepts nil, `Number`, `String`/`Text` and
`Bool` check their value kinds. `Function` accepts source/native functions and
bound methods; callable class definitions remain `Type`. Newly created functions
share the actual managed Function type, so `isInstance(callback, Function)` works.
`View` is retained as a global compatibility alias for Block.
Other annotation names resolve through the function's own globals and captured
builtins on each invocation. A real Type requires nominal inheritance; a Trait
requires an explicit implementation. A method's own declaring-class annotation
uses its receiver's actual owning definition, allowing saved bound methods on old
instances to survive a REPL class-name redefinition. Other global type names are
not frozen when a function is defined. TypeMismatch reports the function,
parameter/return and expected/actual names. Unknown annotations and argument
mismatches reject before the body; a bad return does not roll back completed writes.
The per-call return definition remains rooted until success/error cleanup.
See [function-types.endor](examples/function-types.endor) for actual Endor source.
Declared-field construction/write checks are described above. Static inference, generics,
static effect typing and complete native signature coverage remain pending. Native APIs retain their domain-specific value and resource checks.
Native methods publish positional argument intervals through Aster CallArity. The VM checks counts before invoking them, and trait registration/descendant updates verify that each source or native method accepts the canonical argument count. Optional/default parameters are included; bound receiver counts are removed for callback queries. Generic Type construction still uses its host constructor rules. CallSignature adds optional resolved parameter/return types and host effect metadata, as described below.
Native typed contracts now cover measure(Block, Mount, Constraints): MeasureResult, arrange(Block, Mount, Bounds): Arrangement, paint(Block, Mount, Bounds): DisplayList and hitTest(Block, Mount, Point): Bool, plus Point geometry queries and Window, Block/Container/Page, Mount, Task, Event, Subscription and ObjectList.at methods. The explicit receiver is checked before binding dispatch. Aster checks types before invoking the implementation and checks actual returns, including final results delegated to Endor functions. Signature definitions are traced managed edges; pending delegated return checks retain execution roots and use the existing VM frame/budget machinery. Wrong returns release temporary results but do not roll back earlier writes.
Host CallEffect distinguishes ReadOnly, Delegated, Mutating and External. Delegated means the native wrapper itself is read-only while its continuation has dynamic effects; ui.present uses this category and the actual callback remains in the same VM scope. It is not a static purity proof. A declared mutating/external call is rejected before invocation during read-only rendering; declaring ReadOnly does not bypass the existing heap write barrier. Legacy missing metadata remains unknown, and trusted native code still must obey its I/O contract. CallType supports single types and flat nonempty unions, retaining every branch definition. Page.open accepts Window or nil, Page.window returns Window or nil, and Block.on accepts Bool or String for its optional phase. Mount parent/child/sibling/Page queries have nullable results; bounds() returns an actual Bounds object so Point.inside(mount.bounds()) composes directly. Scope/resource eligibility, numeric ranges and phase names keep their domain checks. This adds native contract metadata, not Endor union syntax.
Public ui functions, captured state set/increment methods and native constructor factories now publish signatures. Bootstrap fills immutable signatures after all referenced types exist, preserving function identities. A native factory first separates the requested subclass fields from native options; its envelope checks the Type receiver/general result/effect, then the concrete options and declared fields are checked before allocation or window effects. Optional Rect/Text options and variadic Row/Column children therefore do not consume subclass fields. Event/ObjectList factories retain their own field/member validation. Generic Type construction still has no single fixed reflected signature. See [constructor-contracts.endor](examples/constructor-contracts.endor).
Source overrides now check contravariant parameters and covariant returns at class construction, method replacement and before invocation with dynamically resolved annotations. Ancestor replacement checks overriding descendants before mutation. Forward names may defer until invocation, where unresolved or incompatible contracts fail before the body. Known native effects may only shrink; source effects remain unknown and read-only execution retains its barriers.
Visual, EventTarget, Children and Presentable now use typed Trait requirements. Registration checks parameter/return substitution and known native effects before recording the declaration, including existing descendants. Runtime calls recheck dynamic annotations and final Trait results, including delegated source/native returns. Concrete implementations retain wider parameters and optional convenience forms. Source functions outside the conservative read-only bytecode proof remain unknown; general effect inference remains pending. See [method-contracts.endor](examples/method-contracts.endor) for real Endor widening parameters to Object and returning a MeasureResult subclass. Existing [visual-protocols.endor](examples/visual-protocols.endor) and [layout-negotiation.endor](examples/layout-negotiation.endor) exercise the typed visual methods with actual Endor code.
Event listeners and onClick callbacks must be Functions with known metadata accepting zero arguments or one Event. If both forms work, the dispatcher passes Event. Binding computes and Task callbacks must accept zero arguments, checked before replacing a binding, adding a connection or scheduling work. Native and source callbacks follow the same rule. See [native-signatures.endor](examples/native-signatures.endor) for real native one-argument and zero-argument handlers. Event and ObjectList subclass allocators also check declared field suffixes before allocation.
### Owner-managed asynchronous tasks
`ui.after(owner, key, milliseconds, callback)` returns a managed `Task` and runs
its zero-argument callback on the existing VM worker after the monotonic deadline.
The callback must return Unit. Delay is an integer from 0 to 86,400,000 ms; zero
means a later worker turn. The worker currently polls at up to 100-ms idle intervals,
so deadlines are minimum delays rather than exact timing guarantees. No timer thread
reads or changes VM objects. Ready work shares the same heap as code and native events;
bindings, lifecycle and all affected windows settle before publishing a new frame.
Owners can be Blocks, attached Mounts, open Pages, live Windows, or ordinary objects
with attribute storage. Use `ui` for application lifetime. Each owner owns a traced
task scope, and tasks trace callbacks/captures. The scheduler and task-to-owner link
are weak. Hidden but still-referenced objects keep updating; keeping a task token
alone does not keep its owner alive unless the callback explicitly captures it.
A source function's normal global environment remains a managed capture.
The same owner/key supersedes its previous pending task, using the actual managed
task identity as the request generation. `task.cancel()` cancels pending work and
returns whether it was active. `task.active()` queries eligibility; `task.status()`
returns pending/running/completed/cancelled/failed. Cancellation and completion drop
the callback and remove the owner slot, including when the caller retained the Task.
Already running synchronous callbacks finish before the next input can be processed.
Closing a Page cancels its tasks and its Mount tasks immediately, including closing
and reopening in one input. Switching away or replacing content cancels detached
Mount tasks; Page and ordinary Block tasks remain. Moving a Page between windows
preserves Page tasks and cancels old Mount tasks. Closing a Window cancels its tasks
and the Pages it owns. Reset, DELETE and successful program replacement discard the
old scheduler with its VM; the worker validates submission/runtime generation before
publication, so stale work cannot update the new heap. A failed replacement keeps
the previous runtime and its tasks. Callback errors stop the shared runtime, cancel
remaining tasks and preserve the last valid picture; completed writes do not roll back.
Scheduling/cancelling in read-only render/binding calls is rejected.
Limits are 64 pending tasks per owner, 1024 per runtime, and 64 ready callbacks per
worker poll, each with 128 frames/100,000 instructions. Remaining ready work stays
pending for later polls. Timers and asynchronous UTF-8 file reads use the same task lifecycle.
Network providers, await/coroutines and interrupting a blocked native callback remain unimplemented. See [owned-tasks.endor](examples/owned-tasks.endor)
for real Endor code and native buttons.
Typed capability methods cannot be shadowed by instance attributes. Aster checks ordinary writes, type attachment and capability declaration before changing state; queries and method invocation reject backing-store conflicts introduced through trusted host access. The render cache subscribes to these method attribute keys and validates dirty Blocks before native dispatch, so direct storage changes cannot silently leave source calls and rendering on different methods. Removing the conflicting attribute restores the instance. Class method overrides and event subscriptions keep their existing APIs.
Aster `ObjectStore::call_effect` queries known native or conservatively proved source effects, including bound methods, without executing the function. Proved source ReadOnly methods constrain known native overrides. Shared local assignment, unresolved dynamic calls and other unproved instructions remain unknown; the runtime read-only barrier still follows actual calls and delegation. This does not establish a full source call graph or prove trusted host I/O safe.
Known source call graphs can now be proved ReadOnly using current globals/builtins, closure Cells and resolved receivers. Analysis follows control-flow joins and recursive call graphs with explicit queues, executes no function body and retains no cross-query cache. Rebinding triggers fresh analysis. Unresolved targets/results, shared assignments and calls outside the ReadOnly proof remain unknown; actual runtime barriers and native target checks still apply.
Native layout/paint fast paths and the default event classification inspect the actual ContextNativeFunction implementation and operation. They do not use the current mutable Block method table as an intrinsic baseline. Replacing a base method or a function payload therefore takes the new implementation path. Visual snapshots depend on each protocol function's version and include it in the protocol key, so payload changes at a stable function identity invalidate cached visuals and interactivity.
Block.click returns the generated Event and Block.dispatch returns the delivered Event, preserving the event object from the dispatch pipeline. Native return signatures match these actual results, including GUI activation.
Event dispatch/click and lifecycle entry points publish External as their allowed effect bound: handlers may mutate application state or use host I/O APIs. The built-in no-op bodies do not make the overridable handler contract ReadOnly. These entry points still reject invocation inside read-only rendering.
ContainerBlock.mainAlign is a managed attribute with start (default), center, end and space-between policies. It positions children in the allocated main-axis space after padding and the configured minimum gap. Center/end use remaining positive space; space-between adds it between two or more children. Overflow keeps start positions and existing sizes; alignment does not imply flex sizing. Native arrange queries and rendering use the same actual Bounds. Source arrange overrides retain their explicit placements.
Block.flex is a nonnegative managed weight, default 0. In native containers, fixed children retain measured main-axis sizes; positive weights share the remaining allocated space after padding/gaps with zero basis. This does not request extra parent size. Actual allocated child bounds feed back into measurement before publication. Source arrangement overrides remain authoritative. The additional flexBasis, flexMin, flexMax and flexShrink attributes control bounded allocation and opt-in shrinking along the parent main axis; see the policy below. See [flex.endor](examples/flex.endor) for shared text reflow and native button updates.
Flex main-axis policy: flexBasis is "auto" by default (zero basis when flex > 0, otherwise the first measured size of this occurrence in the current solve); a number supplies an explicit basis. flexMin defaults to 0, flexMax to 1000000, and flexShrink to 0. All numbers are finite/nonnegative and at most 1000000; flexMin must not exceed flexMax. The parent clamps bases to min/max, distributes positive space by flex, and redistributes space left after a maximum is reached. Deficits shrink by flexShrink times the original basis, freezing at minima. A fixed child can opt into shrink without growth. Unresolvable minimum overflow is preserved, and remaining positive space follows mainAlign. The policy applies to width in a Row and height in Column-like containers; these are not independent width/height bounds. Source arrange overrides remain authoritative. Preferred sizes are derived per occurrence and reset for each new solve, never shared through Block state. See examples/flex-constraints.endor. Layout continuation remains unfinished.
When an occurrence's cross-axis constraint changes during settling, its preferred main-axis size is invalidated and remeasured. Any obsolete native flex allocation on that axis is removed for the replacement measurement, so narrowing a nested Column can increase wrapped text height. Source arrange allocations remain explicit. Preferred-size presence and values participate in convergence/cycle detection.
The source layout driver now uses Aster's resumable read-only call API with a soft quantum of 256 instructions. Pauses retain the same VM frames, operand/local roots, return contracts and read tracking; total instruction/frame limits still apply across slices. ui.stats().layoutSlices counts slices in the most recent solve (native fast path: 1). Viewport and idle-task refresh park Pending across worker turns; newer viewport targets can cancel and replace unpublished work. Source/event callbacks execute atomically; their refresh can park across worker turns. Native callbacks are not preempted. Only the completed settled frame is published.
source_layout::start now returns either Complete(Draft) or Pending(Work). The host-owned Work retains the unpublished frame, derived runtime/cache snapshots, convergence plan and prepare root without borrowing caller frame/cache variables. Work::resume consumes the saved job and advances the same VM continuation; Work::cancel closes that continuation and releases the prepare root without merging a draft. A second start is rejected while any read-only execution is active. Every pending Work must be resumed or explicitly cancelled with its owning VM; dropping it is not cancellation. Synchronous ReplSession operations drain the same saved refresh state. The worker can park viewport and idle-task refresh jobs; cancellation restores still-pending Mount preparation.
UiBridge::begin_layout_frame/resume_layout_frame now expose PendingLayout around the source job. This bridge-level continuation also owns its target window, page snapshot, tab projection, viewport restoration and retained lifecycle hook root. Only the Complete branch projects scroll/focus, captures dependency versions, merges derived caches, commits Mount geometry and runs deferred hooks. Resume restores the saved window context, and failure releases hook roots. ReplSession uses this protocol through its saved refresh state. Viewport refresh supports cross-worker-turn scheduling and prepared-Mount rollback; callers must not drop a pending bridge layout as a substitute for cancellation.
ReplSession now owns a resumable RefreshWork containing window traversal, pending bridge layout, unpublished per-window documents and the cumulative refresh work budget. poll_refresh advances one refresh stage or VM quantum; only a complete stable pass replaces the session's full document map. Synchronous callers drain the same state machine. Failure stops the domain, releases any pending bridge work and preserves the externally published picture. refreshYields counts cooperative refresh returns, not wall-clock time. Only still-pending Mount preparation is rolled back; completed callbacks remain committed.
Viewport refresh now advances through ReplSession's saved refresh state on worker idle turns. A turn advances one traversal stage or a 256-instruction layout quantum; ready layout/paint or coroutine work checks the request queue without a timed wait and yields to other ready OS threads between turns. An accepted pending input/candidate also yields without adding a fixed millisecond delay per VM quantum; control, epoch and viewport checks still run on every turn. When only external completion/timers are pending, the normal idle wait remains 100 ms. Tasks/window commands and document publication wait for complete refresh. ui.stats().refreshYields reports cooperative idle returns. Mutating requests wait across worker turns for the existing job, so they cannot run inside its read-only scope. Mutating requests are serialized; newer viewport targets coalesce by cancelling unpublished layout. Initial source execution remains atomic; its layout can park across worker turns. Explicit REPL/event refresh can park across worker turns. Idle task delivery starts at most one ready callback per turn and parks its subsequent layout; callbacks themselves and individual Rust measurement/paint calls remain atomic.
Runtime mutation entry points reject direct calls while refresh work is pending, before executing source or changing metadata; task polling defers. The API worker drains the saved refresh before accepting those mutations, keeping the runtime usable. Incremental refresh keeps the prior complete document map until a stable pass, including across window traversal boundaries where no VM read-only frame is currently active.
Pending bridge layouts now retain a Mount checkpoint. cancel_layout_frame closes the VM continuation, restores the old Mount payloads/links/dictionary and marks the presentation dirty for a new solve; discarded lifecycle hooks do not run. Successful finalization releases checkpoint roots after callbacks. This restores speculative Mount preparation, not arbitrary application writes or already completed lifecycle callbacks.
New viewport targets now coalesce pending refresh work. The runtime cancels only an unfinished bridge layout, restores its Mount checkpoint, preserves completed per-window drafts/callback effects and restarts traversal with the latest viewport map. refreshRestarts counts target replacements; layoutCancels counts replacements that actually closed a pending VM layout. Unchanged targets resume the same job. A new external target resets its convergence budget; internal settling does not. Ordinary source/event mutations still serialize behind refresh rather than roll back application effects.
Cancellation checkpoints own explicit VM roots until restored or released. Initial presentations may have no mount dictionary; cancellation restores that absence too. Saved metadata values retain object-valued attributes. A pending refresh can restart while keeping already completed window drafts; no onMount/onUnmount callback is replayed merely because the viewport target changed. Mount-owned tasks are cancelled immediately before an actual onUnmount callback, never during abandoned preparation.
Large intrinsic layout trees (more than 64 occurrences) now use the resumable per-occurrence driver too. Native measurement caches remain active, and a single native callback remains atomic; VM instruction boundaries between nodes allow the worker to yield and replace an obsolete viewport. Small intrinsic trees retain the allocation-free native fast path. Structural extraction, driver preparation, settling checks and final command projection still run atomically; this is not a wall-clock preemption guarantee.
Idle timer delivery now processes at most one ready callback (or one ineligible task cancellation) before starting an incremental refresh. No further task is delivered while that refresh is pending. Viewport changes can replace its unfinished layout without replaying the completed task callback. Task effects and native window commands publish only after settling; a previously completed resize may publish separately. Explicit input still drains pending work first. Synchronous host callers retain a maximum of 64 task deliveries per poll.
REPL and event mutations now have incremental refresh entry points. They execute source/callbacks once, retain scalar response metadata, then park layout with the current viewport target. While pending, mutation, command extraction and garbage collection wait; layout can be retargeted by a newer native size. Synchronous helpers remain for host regression coverage. Discarding a ReplSession explicitly cancels any still-pending bridge layout before the Candidate releases service/global roots. This does not preempt source/callback execution, structural preparation or paint.
The API worker now owns a pending HTTP request plus its scalar result while REPL/event layout is parked. It advances the layout with current native viewport targets and responds only after the stable full-window publication and command extraction. Later mutation requests remain queued; GET /code can observe the last complete publication. A newer accepted PUT invalidates queued inputs but lets the already-running owner settle before candidate construction, so failed replacement can preserve its consistent heap. DELETE revokes that owner and prevents late publication. This queue ordering does not roll back already-executed source effects.
Complete-source candidates now separate one-time compilation/source execution from initial layout. load_incremental owns the isolated VM while its first layout is pending; the current live VM stays separate. Cancellation uses the same Mount checkpoint/continuation cleanup as later refresh. Synchronous load helpers remain for host regression coverage. This does not slice parsing, compilation, mutating source execution, structural preparation or final command projection.
The API keeps the old runtime alongside a pending PUT candidate. Newer submissions cancel only the obsolete candidate; failures restore the published runtime's submission owner. Background epoch checks distinguish accepted replacements from DELETE revocation, so queued/superseded candidates do not destroy the previous live heap. Candidate resumption reads only the primary shell viewport, avoiding reuse of an old secondary window's dimensions for a new VM's resource with the same numeric ID. Success publishes the complete candidate document and commands together, then replaces the old runtime.
Source paint now uses a resumable read-only VM call with the same 256-instruction quantum and a cumulative 1,000,000-instruction budget. The pending job owns the unpublished frame, visual snapshot, decoded command buffer and prepare root. The refresh worker resumes paint before advancing to another window and publishes only the full stable window set. New viewport targets cancel unfinished paint, discard partial commands and force that window to refresh. Already completed layout/Mount geometry and lifecycle callbacks remain committed; cancelling paint does not replay or undo them. Failure/discard explicitly closes the read-only continuation and releases its roots. paintSlices reports the most recently completed paint solve (1 when the solve completes within its first quantum); paintCancels counts viewport replacements that closed pending paint. Layout checkpoint rollback remains limited to unfinished layout preparation. Native callback bodies, driver preparation, command decoding/projection and rasterization remain atomic.
Layout and paint drivers now prepare one occurrence at a time. Their fixed-size outer bytecode repeats on the same VM frame; a short-lived helper retains only the current call, its bounds/arguments and collector. The helper is released before the next occurrence. Layout keeps bottom-up measure, top-down arrange and the same settling loop. Paint advances even intrinsic method classification through VM quanta. The weak occurrence list and native scratch/output data remain proportional to the actual tree, but preparation no longer allocates managed callables/Bounds for the whole tree before the first slice. All helpers share the original read-only scope and cumulative instruction/frame limits. Weak-list copying, structural extraction, settling and final projection remain bounded atomic native work.
ui.stats().dependencyInvalidations counts observed layout/paint dependency mismatches. lastInvalidDependency records the phase and invalidating identity/name or snapshot-cache cause without rendering its fields or retaining it. windowDependencyDiagnostics reports nonempty reasons from all windows. Source rendering observes the global names it reads, so unrelated global changes do not require repainting; compare idle document versions before diagnosing a refresh loop.
examples/gc-lifecycle.endor demonstrates an actual Page/Block/Task/await-frame reference cycle. Record ui.stats().objects, call mountCycle(), and inspect phase.value (1 while awaiting) and pending.value.status(). Closing the tab removes its navigation root; a retained Block's own workflow continues. Call releaseCycle() to release both external references, then query objects again to trigger the normal between-input collection and compare with the same baseline. Cached layout/paint metadata borrows identities and must not keep that cycle alive. The baseline is specific to that VM/program, not a fixed object count across programs.
ui.readText(owner,key,path[,callback]) returns an owner-scoped Task and reads a regular UTF-8 file off the VM thread. Paths use native filesystem syntax; absolute paths are recommended. The optional callback takes zero arguments and must return Unit; it runs only on successful read and can use task.result(). Without a callback, poll status then read result from code. result() is available while a success callback is running or after completion (timers return Unit); error() returns an empty String until failed, then the provider/callback error. A provider failure marks the task failed and skips its callback without stopping the VM; a source callback failure still stops the shared domain. Owner/key replacement, explicit cancellation, close/reset/VM discard and GC drop the provider lease, remove queued completion and reject late delivery. In-progress OS reads may finish, but cannot deliver after cancellation. Only the owning VM worker updates managed results and rechecks owner/key identity. No VM handles enter provider threads beyond opaque weak identities.
The lazy shared pool has four threads and a 64-job queue. Each runtime permits 16 outstanding I/O requests (one temporary replacement reservation), and each read is capped at 1 MiB by metadata plus actual streaming length; non-regular files, non-UTF-8 data and over-limit content fail rather than truncate. These limits do not constitute a full filesystem sandbox. The provider returns text in the same managed Task, not a second application-state store. Task await is supported through ui.spawn; see the await contract below. See examples/async-file.endor; from REPL call reader.read("/absolute/path.txt") to update its actual TextBlock, even when that object is hidden but retained.
ui.fetchText(owner,key,url[,callback]) performs an asynchronous HTTP(S) GET using the same Task, owner/key replacement and success-only callback protocol as readText. Example: fetcher.fetch("http://127.0.0.1:4737/agent") after loading examples/async-network.endor. The example retains the complete result in fetcher.response and displays completion status; it does not put arbitrary network content into a TextBlock, whose own 16 KiB limit is independent of the provider limit. Only 2xx responses produce a UTF-8 result; HTTP failures, invalid UTF-8, oversize bodies and transport errors set status() to failed with error(). It verifies HTTPS certificates, follows at most five HTTP(S) redirects, has a 10-second connect and 30-second total transfer timeout (starting when a worker takes the request), and bounds decoded text to 1 MiB without truncation. URLs are limited to 8192 bytes and must not contain credentials or control characters. This GET API does not accept request bodies, custom headers or authentication.
The current transport uses a separate system curl process per request (/usr/bin/curl on Unix, curl.exe on Windows); missing or incompatible curl fails the Task. User curlrc and URL globbing are disabled; URL data is passed through escaped stdin configuration rather than command arguments. TLS and normal system proxy behavior remain enabled. Cancellation kills an active HTTP process immediately and the provider worker reaps it; the VM thread never waits for the process. All file and HTTP requests share the per-runtime 16-task limit and global four-worker/64-job queue. In-progress file reads remain cooperatively cancelled at delivery. Network access is not a security sandbox, and this is a text GET provider rather than a general HTTP client. Task await is supported through ui.spawn; see below.
ui.spawn(owner,key,function) creates an owner-scoped cooperative Task for a zero-argument function; its returned value is retained as the Task result. Each owning VM poll resumes at most a 256-instruction quantum per selected Task, rotates runnable tasks fairly, and retains source frames in an Aster-managed coroutine edge. Calls and writes may interleave between quanta; prior writes are not rolled back on cancellation or error. Pending/running Task replacement, owner closure, GC and reset release parked frames through the same managed graph. Native calls remain atomic and all quanta share the 128-frame/100000-instruction callback limit; a native entry may run during preparation. result() is unavailable until spawn completes. A source error still stops the shared runtime. See examples/cooperative-tasks.endor. Endor await expressions now suspend these calls on a Task without replaying the operand. See the await contract below.
Inside a function run by ui.spawn, `value = await task` waits for any timer/file/network/spawn Task and resumes at the same expression with its retained result. A source function may return a Number, String, managed Object or Unit; normal source annotations still apply. Task.result() and await share the result. `ui.sleep(owner,key,milliseconds)` creates a callback-free timer Task returning Unit. Plain calls/REPL can await an already completed Task; a pending await requires a coroutine and fails explicitly rather than blocking. There is no new async function declaration: ui.spawn explicitly schedules an ordinary Endor function. See examples/await-file.endor.
A waiting coroutine retains its evaluated operand and frames as managed edges; waiting performs no VM execution or active polling. Source side effects and IO initiation before await are not replayed. When the dependency completes, the owning VM worker resumes the waiter through the existing fair quantum scheduler. Cancelling/replacing/closing the waiter releases its frames and operand; it does not automatically cancel an independently owned or shared dependency. Dependency cancellation propagates cancellation to its waiters without running the remainder. An unhandled dependency failure becomes a source await error (with the original provider message), fails the waiter and follows the existing shared-runtime fault rule; provider failure alone still only fails its own Task. Self-await and cyclic Task waits fail explicitly. Read-only layout/paint cannot await. Waiting state is reported as running, while active() remains true; result() is unavailable until completion. These APIs do not introduce try/finally or change the existing exception model.
The former horizontal tab-strip gestures and animation have been replaced by sidebar page navigation. Page.moveTab, moveToWindow and detachToWindow remain available through Endor/API; sidebar pointer drag/reorder and cross-window drag are not implemented in this revision.
Application exit now uses a private VM-worker control channel, independent of HTTP queue capacity. Main native close and a managed primary Window.close request asynchronous cleanup; duplicate requests coalesce and mutation requests are rejected with 503 while exiting. An unpublished candidate/input refresh is cancelled without replay. The current VM cancels all Task entries, closes managed windows, detaches occurrences child-before-parent per window, and invokes normal onUnmount hooks once. It does not run layout/paint during shutdown. All windows are closed before hooks run; new windows and tasks are forbidden. A stopped/faulted VM detaches without source hooks; reset/discarded pictures cannot revive an old VM. A hook error aborts remaining source hooks, releases prepared hook roots, drops the VM and reports failure before native exit. Completed shutdown is acknowledged to the GUI, which then ends the event loop. An OS exit bypassing CloseRequested uses a five-second bounded final fallback; non-cooperative native calls remain atomic and force-kill/crash cannot guarantee notifications. Native stderr records the window/mount/task-entry counts and whether source hooks were enabled, or the cleanup error. See examples/exit-lifecycle.endor. Cross-platform exit/drag validation remains broader follow-up work.
Foreground REPL/events now retain a BeforeInput request while an existing idle layout/paint refresh advances one stage/quantum per worker turn. They execute their source only after that refresh settles, so mutations never enter its read-only scope. New task callbacks are not delivered ahead of this accepted input. Shutdown can cancel the waiting request with 503, and superseded submissions still return 409. Reset cancels/discards the old VM instead of synchronously draining its unpublished refresh. Source parsing/compilation and ordinary synchronous source/native calls remain atomic boundaries; this change removes the worker's synchronous pre-input refresh drain.
Source layout/paint now validate name-level read observations from Aster: each globals/builtins lookup records its text key and observed presence/value, while dictionary kind checks remain separate. Updating the REPL result `_` or another unread global no longer invalidates these frames solely because the whole globals dictionary version changed. Reading `_` still observes its value; adding a previously missing global correctly invalidates a builtin fallback. Ordinary native dictionary iteration/content reads retain whole-object version dependencies. Measurement cache hits replay their recorded observations into the outer solve; they do not drop dependencies merely because source execution was skipped. Cache observations contain borrowed handles (including object-valued names), add no GC roots, and never write comparison snapshots back into language objects. Invalid-name diagnostics report only identity/key, not captured values. General Block binding and other legacy readers keep their existing conservative object dependencies. See examples/global-dependencies.endor.
Property bind computations also use precise global-name observations. Unrelated REPL/global changes keep valid cached outputs; changing an observed name or business object recalculates the binding, including hidden retained Blocks. A direct overwrite of a bound property is repaired by its compute function. ui.stats().bindingEvaluations counts computations in completed binding refreshes over this VM's lifetime, including initial computations; querying it does not itself force valid bindings to recompute. General dictionary-content reads still conservatively observe the dictionary.
+58
View File
@@ -0,0 +1,58 @@
# 01 · 模块、依赖与部署
## 项目目录
```text
Tessera/
├── Cargo.toml / Cargo.lock Rust 依赖和固定解析结果
├── src/
│ ├── main.rs 组合入口、事件循环和共享发布状态
│ ├── shell/ 原生窗口、可收起侧栏、开发工具、管理控件
│ ├── runtime/ 本机 API、VM worker、执行、事件与异步任务
│ ├── model/ 托管对象、挂载、绑定、依赖和发布数据
│ ├── render/ 布局、绘制、命中、字体与软件光栅化
│ └── bridge/ Endor 与宿主 UI 类型及行为的连接
├── examples/ Endor 示例程序,保留原文件名与入口
├── docs/
│ ├── architecture/ 本套架构说明和 UML 源文件
│ └── media/ 已有建模视频与字幕
├── scripts/ 本地原生打包及 UML 文档渲染
└── vendor/aster/ 独立 Git 子模块:语言、编译器、VM
```
`target/` 是忽略的构建产物,不是源码目录。示例与媒体保留原位置,避免破坏已有引用。完整源码职责见 [逐文件清单](file-map.md)。
## 组件关系
箭头表示主要运行时调用/数据流,不宣称是无环的 Rust import 图。
![组件与主要数据流](uml/rendered/components.png)
[放大 SVG](uml/rendered/components.svg) · [编辑 UML 源码](uml/components.puml)
标准 UML 组件表示见 [components.puml](uml/components.puml)。`System UI` 只依赖低层几何、文本和画图,不导入 Endor VM 或 guest bridge;开发工具的执行逻辑由外层提供。
## 线程与进程
| 执行位置 | 核心所有物 | 交互方式 |
| --- | --- | --- |
| GUI / winit 主线程 | TesseraApp、原生 Window、Surface、侧栏、页面视角交互 | 读已发布快照;发 viewport、输入和窗口命令 |
| `tessera-agent-api` | tiny_http 接收循环、请求观察 | 对写入做校验并进入最多 8 条的构建队列;读取当前发布状态 |
| `tessera-endor-worker` | 活跃 ReplSession、候选 VM、托管对象图 | 串行执行程序、回调、布局/绘制协议及任务完成交付 |
| 输入发送线程 | 有界输入客户端 | 把原生输入转为本机 HTTP 请求;不执行 VM |
| 按需 I/O 池 | 文件/HTTP 工作及取消控制 | 不持有托管根;通过 mailbox 回传文本/错误 |
| 系统 curl 子进程 | `fetchText` 的实际 HTTP 传输 | 有超时、大小和协议限制;不是业务服务 |
![进程与线程部署](uml/rendered/deployment.png)
[放大 SVG](uml/rendered/deployment.svg) · [编辑 UML 源码](uml/deployment.puml)
可编辑部署图:[deployment.puml](uml/deployment.puml)。Aster 作为 Cargo path dependency 编译到同一应用,不是额外 VM 服务;Lyra 和 Hestia 不在应用依赖链中。
## 入口定位
- 启动:`src/main.rs` → `runtime/api::start` → `shell/app::TesseraApp`。
- 请求路由和有界队列:`runtime/api.rs`;VM 所有权与发布:`runtime/api/worker.rs`。
- 启动 Endor 主程序/Console:`runtime/endor_host.rs`。
- 类型安装:`bridge/ui_bridge/bootstrap.rs`;原生 Block 方法:`calls.rs`。
- 组合最终画面:`render/scene.rs`;写入像素:`render/software_renderer.rs`。
+43
View File
@@ -0,0 +1,43 @@
# 02 · 对象模型、展示位置与所有权
## 托管语义与原生快照是两种东西
业务对象、Block、Window、Mount、Task 等语义对象位于 Aster 堆中。Rust 的 `ObjectRef` 只是受检查的堆身份;能否存活由 VM 根及 `trace` 边决定。窗口侧的 `Arc<UiNode>`、Frame、Tab 是提取后的原生值,不能用来复活或直接修改语义对象。
下面是简化 UML 类图;实线关联表示有强引用/直接持有,虚线标明弱引用或派生关系。它省略类型表、回调捕获边和桌面的内部字典,不能当成完整 GC 根枚举。
![对象模型与引用关系](uml/rendered/domain.png)
[放大 SVG](uml/rendered/domain.svg) · [编辑 UML 源码](uml/domain.puml)
可编辑来源:[domain.puml](uml/domain.puml)。`Page` 是具有 Page 行为的托管 Block,不是另一棵浏览器 DOM;`ManagedWindow` 是 VM 中的窗口语义,和 winit 的原生 Window 有对应关系,但不是同一对象。
## 同一对象的两次出现
例如两个成绩页都引用同一个课程对象,并通过 `ui.textOf(course, "grade")` 展示字段。字段改变后,两处绑定都能更新。即使同一个可视 Block 出现两次,也必须分别布局:这两次出现对应不同 Mount,具有不同坐标、父位置、滚动偏移和焦点上下文。
`Child.slot` 是稳定的子出现标识,不能简单用数组下标替代。插入、移动子项时,这有助于保持原来的展示身份,而不是把所有后续位置都当作新出现。
## 谁保留什么
| 关系 | 保留/释放含义 |
| --- | --- |
| Candidate 的 globals / service roots | 保持当前程序全局对象和宿主服务可达 |
| Block → Cell → Data,或 Cell → Block | 支持共享赋值与别名;内容变化不会要求窗口侧重建对象身份 |
| Data → children / bindings / callbacks / history | 实际托管强边,交给 Aster GC 追踪 |
| Window 的 Page registry | 打开的 Page 被保留;关闭标签释放 registry 边 |
| 桌面内部 mount 字典 → Mount | 保留活跃展示位置;Mount 强引用其 Block |
| Mount → page / parent / siblings | 弱反向边,避免共享内容把 Page 留住 |
| MountTable、对象诊断索引、任务索引 | 使用弱身份,不单独延长对象寿命 |
| Subscription token → connection | 弱引用;丢弃 token 不等于取消监听,需 disconnect |
| 原生 Frame / Tab / DrawCommand | 无 VM handles;只是绘制和交互所需的值 |
关闭标签不必然销毁 Page:脚本仍引用它时可以重新打开。反之,关闭后不可达的对象图可以回收;没有“固定页面池”。重置 Console、删除程序或成功替换程序会触发活跃运行时的清理路径。
## 三种版本号不能混用
- `submission`:已接受写入工作的先后次序,用于撤销旧候选的发布资格。
- `revision`:已提交文档的修订,失败构建不应冒充成功修订。
- `runtime_session` / Frame.session 与 `layout_version`:界面输入属于哪一代运行时、哪份布局;旧点击和旧拖放不能作用到新对象。
对象模型源文件集中在 `src/model/`。实际分配、根清理和回调预算由 `runtime/endor_host.rs` 与 bridge 协作完成。
+50
View File
@@ -0,0 +1,50 @@
# 03 · Endor 执行、并发请求与发布
## 完整程序提交的时序
![完整程序执行与发布时序](uml/rendered/publication.png)
[放大 SVG](uml/rendered/publication.svg) · [编辑 UML 源码](uml/publication.puml)
图简化了 HTTP Response 的持有:原始请求在入队后由 worker 完成响应,不是 GUI 执行 HTTP 请求。可编辑来源:[publication.puml](uml/publication.puml)。
## 不同入口的语义
| 入口 | VM / 发布行为 |
| --- | --- |
| `GET /agent` | 按当前 namespace 生成使用指南,不执行 Endor |
| `GET .../code` | 读取最后成功发布的源码文本 |
| `PUT .../code` | 新候选执行;成功后接替活跃运行时,失败保留原程序 |
| `POST .../repl` | 在活跃 Console/程序 VM 内执行,不靠重放历史恢复对象 |
| `DELETE .../repl` | 清理 Console 上下文,重新建立可用会话 |
| `DELETE .../code` | 清空并使旧工作失去发布资格 |
| `POST .../events` | 校验窗口、运行时代际与布局身份,再在拥有对象的 VM 中分发 |
| `POST .../evaluate` | 独立表达式求值;不是替换当前页面的入口 |
在线契约以 `GET http://127.0.0.1:4737/agent` 为准,静态正文实现位于 `runtime/api/guide.rs`。
Console 的编译错误发生在执行前;运行期错误则可能保留此前已经完成的赋值,所以它**不是数据库事务回滚**。故障运行时有单独的停用/清理规则;完整 PUT 的隔离候选和 REPL 的活对象修改不能混为一谈。
## 代际与失败边界
![候选与活跃运行时状态](uml/rendered/runtime.png)
[放大 SVG](uml/rendered/runtime.svg) · [编辑 UML 源码](uml/runtime.puml)
这是候选和活跃运行时的概念状态图,并非源码中一个同名 enum。刷新具体由 `RefreshWork`、`PendingLayout`、paint Work 与 worker 的 PendingRequest 协作,不能在挂起时换一个 VM 恢复。
## 异步任务
`ui.after`、`ui.readText`、`ui.fetchText` 和协作任务由托管 Task 表示。回调及 scope 是 VM 强边,调度索引保留弱身份。I/O 池只接收路径/URL等原生数据、取消控制及完成消息,不拿着 ObjectRef 在其他线程调用 VM。
![异步任务状态](uml/rendered/tasks.png)
[放大 SVG](uml/rendered/tasks.svg) · [编辑 UML 源码](uml/tasks.puml)
源码的 Task 状态为 pending、running、completed、cancelled、failed;具体 provider 可能在 Pending 期间已开展后台 I/O,图中的 Running 不表示后台 I/O 一定此时才启动。见 [tasks.puml](uml/tasks.puml)。
## 预算与实际边界
源码上限 1 MiB;AST 访问上限 10000、深度 64;VM 栈帧上限 128;指令预算、UI 对象和页面预算各有上限。完整脚本各输入共享分摊总指令额度;Console 还检查累计来源与活对象限制。队列上限是 8,不是无限吞吐。
这些预算帮助限制失控工作,**不构成执行任意不可信代码的安全沙箱**。当前程序仍运行在桌面进程内,文件和网络能力没有完成产品级权限治理。
+38
View File
@@ -0,0 +1,38 @@
# 04 · 布局、绘制、输入与刷新
## 一帧不是重新执行整个程序
活跃 VM 中的属性修改先被依赖系统观察,必要时刷新绑定、派生 UiNode、布局、paint 和 Mount 几何,再发布原生 Frame。干净的派生子树和测量结果可以复用;这不意味着所有帧都只访问变化节点,arrange、出现遍历和版本校验仍有成本。
| 环节 | 文件 | 产物 / 约束 |
| --- | --- | --- |
| 绑定与变化依赖 | `model/binding.rs`、`snapshot.rs`、`presentation.rs` | 属性/方法身份依赖、缓存失效 |
| 不可变视觉提取 | `bridge/ui_bridge/tree.rs`、`model/block.rs` | 无 VM handles 的 UiNode 树,可有共享子树 |
| native 布局 | `render/layout.rs` | 测量、排列、稳定出现身份与预算 |
| source 布局协议 | `render/source_layout.rs`、`native_visual.rs` | 只读 measure/arrange 调用、约束和缓存 |
| source/native 绘制 | `render/source_paint.rs` | 检查绘制命令、文字换行界限、依赖与预算 |
| 滚动 / 命中 | `render/scroll.rs`、`source_hit.rs` | 每 Mount 偏移、剪裁、逆绘制顺序选目标 |
| 窗口画面合成 | `render/scene.rs` | guest 页面 + 标签 + 当前开发工具 |
| 文本 / 光栅化 | `render/text.rs`、`software_renderer.rs` | 系统字体 shaping、抗锯齿 glyph、像素和嵌套剪裁 |
GUI 在 redraw 时组合已发布的画面和宿主 chrome,并按实际屏幕倍率写入 softbuffer。需要运行 source 方法的布局或 paint 由 worker 处理;viewport 变化也会送回 worker,GUI 线程不执行这些 VM 方法。
## 点击如何回到对象
![原生输入与事件分发时序](uml/rendered/input.png)
[放大 SVG](uml/rendered/input.svg) · [编辑 UML 源码](uml/input.puml)
可编辑来源:[input.puml](uml/input.puml)。没有 Mount 的代码主动 dispatch 只访问目标;有 Mount 的事件沿该次出现的父路径传播。事件监听器连接由 Block 保留,Subscription token 是弱控制句柄。
`stopPropagation`、`stopImmediatePropagation`、`preventDefault` 有各自语义;`preventDefault` 目前没有额外宿主默认动作可取消。原生输入不应绕过同一分发器直接调用另一个回调机制。
## 为什么 Mount、剪裁与 source 协议必须一起看
一个 Block 在两个容器出现时,源方法接收不同 Mount 的约束和几何。滚动需要更新该次出现的坐标、剪裁和祖先选择;命中顺序必须对应画出来的顺序。仅修改 paint 而不修改 hit/layout 会导致“看得到点不到”,反过来也会产生不可见点击区域。
只读协议及签名约束用于保护这些阶段,但不应表述为语言的所有 effect/trait 特性都已完成。当前具体原生签名和检查见 `bridge/ui_bridge/signatures.rs`、`model/protocols.rs` 及 Aster 固定版本。
## 刷新中的过时工作
尺寸、对象内容或运行时代际在刷新中变化时,旧 layout/paint 可以取消或重启。worker 负责完成当前清理并重新对齐 viewport,不能把旧 Mount 几何发布为新布局。当前刷新主协调仍在 `runtime/endor_host.rs` 与 `bridge/ui_bridge.rs`,后续可继续拆出独立 coordinator;本次没有改变该调度算法。
+39
View File
@@ -0,0 +1,39 @@
# 05 · 标签、窗口、默认页与开发工具
## 三层身份
| 层次 | 负责什么 | 不负责什么 |
| --- | --- | --- |
| 托管 Page / ManagedWindow | 页面内容、打开/关闭、所属窗口、脚本覆盖行为和对象可达性 | 像素级 hover、原生按钮位置 |
| 已发布 Tab / Frame / Window Envelope | 传输不透明 ID、标题、活动状态、窗口命令和版本 | 保留 VM 堆对象 |
| TesseraApp / tabs::Motion / winit Window | 绘制、命中、拖动、滚动、原生资源及即时交互 | 执行业务回调、复制业务对象图 |
![页面展示与可达性状态](uml/rendered/windows.png)
[放大 SVG](uml/rendered/windows.svg) · [编辑 UML 源码](uml/windows.puml)
该图是**可达性与展示状态的说明**,不是一个源码 enum。关闭原生窗口、移除 Page 展示和回收对象不是同一动作。跨窗口拖放携带来源/目标窗口、布局版本、插入位置等元数据,worker 拒绝过期目标,再更新托管 registry;GUI 不直接移动堆对象。可编辑来源:[windows.puml](uml/windows.puml)。
## 已完成的标签行为
- 启动有一个默认 Page;`+`、Cmd/Ctrl+T 新建,Cmd/Ctrl+W 关闭活动页。
- 顶部与左侧宿主区域共用背景;内容区单独作为页面表面,未实现用户暂不需要的左右页面分栏。
- 40 逻辑像素栏高、32 像素标签、88–208 像素宽度;保留高密度和鼠标/触控板滚动,移除两侧点击箭头。
- 非活动标签之间有短竖线,活动/hover 邻边按状态隐藏或渐变。
- 新建/关闭/自动揭示使用独立几何动画;hover 背景、关闭按钮和分隔线使用 160ms 颜色过渡,点击选中即时生效。
- macOS 原生红黄绿保留系统行为,并与标签中心线对齐;工具栏空白处可拖动和双击放大/还原。
`native_chrome.rs` 通过 AppKit 操作现有窗口与系统按钮。双击使用 NSEvent.clickCount 和 NSWindow.performZoom,而不是画一个假的最大化动画。读取系统偏好:最小化/禁用遵循分支;Fill 目前映射到公开 zoom API,没有调用 Chrome 使用的私有 `_zoomFill`,不保证复刻所有新系统平铺边距。
## 默认页与四个工具页
默认页源码是 [start_page.endor](../../src/bridge/ui_bridge/start_page.endor),位于独立私有模块;创建页、共享计数和组合示例都是真实 Endor 对象操作。它不覆盖用户程序 globals,也没有把四个工具页当作默认内容。
Console、Sources、Network、Settings 各自有独立页面实现和窗口内交互状态。目前通过 `ui.developerTools("Console")` 等入口与现有快捷键进入,工具发现菜单仍延后。四页不是新平台业务模块,也不代表已经接入云服务。
- Console:真实 VM 输入、输出和本机请求活动;不是只显示介绍的文本区域。
- Sources:当前源码/Console transcript、AST 与选择;云文件 provider 默认未连接。
- Network:仅本 Tessera API 请求的有界记录,不是浏览器或操作系统抓包。
- Settings:内存内主题强调色;没有跨进程持久化。
源码位置:`shell/developer_tools/`。宿主管理控件在 `shell/system_ui/`,和 guest 的 Button/Block 类型有明确区别。
+53
View File
@@ -0,0 +1,53 @@
# 06 · 当前进展、限制与验证
截至 2026-10-25,可以用 Endor 建立共享对象、多 Page 的原生交互应用,在 Console 中持续修改它们,并用已有开发工具观察源码和本机 API。这是可工作的桌面宿主及语言 UI 集成阶段,不是完整 LMS、浏览器或云 IDE。
## 进展矩阵
| 领域 | 已有实现与证据位置 | 尚未完成 / 不能据此推断 |
| --- | --- | --- |
| 语言运行 | 固定版本 Aster Reader、Parser、Compiler、VM;完整程序和持久 Console,`runtime/endor_host.rs` | 不等于 Endor 全语言、全部数值指令或所有 trait/effect 语法均已完整实现 |
| 对象与类型 | 托管 Block/Cell/Data、原生名义类型、源类与原生子类、方法签名和能力检查,`bridge` / `model` | 仍受当前 Aster 版本的表达式、注解和 effect 实现子集限制 |
| 活界面 | 共享对象绑定、Mount、source/native measure/arrange/paint/hitTest、缓存及刷新预算 | 不保证每次刷新只做局部 O(变更数) 工作;无 GPU 渲染后端 |
| 页面/窗口 | 默认页、真实多 Page、标签关闭重开、原生多窗口、带代际校验的拖放 | 混合 DPI 跨屏、真实触屏与动画帧时序没有完整硬件验收 |
| 桌面交互 | 统一 chrome、原生按钮对齐、双击 zoom/restore、高密度滚动、hover 淡入淡出 | Fill 并未接 macOS 私有精确平铺接口;非 macOS 构建本轮未验证 |
| 事件 | capture/target/bubble、代码/native 共用分发、Subscription、Mount 生命周期回调 | preventDefault 尚无额外宿主默认动作可取消 |
| 异步 | timer、文件读取、fetchText、协作调度、owner/key 取消 | 不是完整浏览器网络栈;fetchText 使用系统 curl,无完整产品权限体系 |
| 开发工具 | Console/Sources/Network/Settings 四个独立 Page | 云 source provider 默认断开;工具发现 UI 延后;状态不持久化 |
| 示例 | 学生成绩示例、七页 Campus LMS、共享提交/成绩更新、建模录屏 | 全部虚构数据;预设评分,不连接 Canvas,不具备真实认证/上传/成绩计算服务 |
| 本机 API | 仅 loopback、有界队列、版本和失败保留,`runtime/api*` | loopback 不是完整授权系统,执行预算不是不可信代码沙箱 |
| 分发 | 可构建 Finder 可启动的 macOS 开发 bundle | 没有发行签名、公证、安装器和本轮跨平台发布验证 |
## 推荐看这几个实物
1. [默认页源码](../../src/bridge/ui_bridge/start_page.endor):理解“页面本身就是 Endor 程序”。
2. 默认页的“共享对象示例”入口:展示一个状态对象的两处绑定;更多源码见 [examples README](../../examples/README.md)。
3. [Campus LMS 源码](../../examples/campus-lms.endor) 与 [操作说明](../campus-lms-demo.md):七个真实 Page 共享课程和提交对象。
4. [建模视频](../media/endor-campus-modeling.mp4) 与 [中文字幕](../media/endor-campus-modeling.zh.srt):已有实际窗口操作记录,静音、采样帧率有说明。
5. `GET /agent`:运行中的实时 API 指南,优先于长期静态样例推断接口。
## 当前本地开发方式(2026-11-10)
页面/宿主设计更新:支持 window、vertical、horizontal、canvas 四种空间;顶部标签条由可收起左侧栏替代。实现、测试与原生验收边界见 [页面空间说明](../page-surfaces.md)。下文 150 项测试及原窗口结构属于前一次移除 CI 的交付记录。
项目已移除 CI/CD 工作流、Docker 工具链定义及远程验证脚本。开发、构建、现有测试与原生窗口验收改在本机执行,命令见 [项目验证说明](../../README.md#validation)。以下保留 2026-10-25 整理时的验收记录,不代表本次检查结果。
本次使用 macOS / Rust 1.91.1:格式检查、150 项现有测试、all-target Clippy(拒绝 warnings)、打包脚本语法检查及 release app 构建均通过。应用已启动,`GET /agent` 与 `GET /code` 返回正常,窗口报告 1280 × 800 的逻辑 viewport;通过实际 REPL 创建/关闭临时标签页,页面数为 1 → 2 → 1。首次页面查询误用了不存在的 `ui.pages()`,返回 422;改为 `ui.window().pages().count` 后通过。原生 UI 检查工具启动失败,本次没有窗口外观、真实鼠标交互或跨屏验收证据。Aster 保持固定版本,未修改源码或 gitlink。
下一步优先补齐真实窗口的共享对象、标签拖放和退出清理验收,然后定义本地 `.endor` 文件的打开、保存及重启恢复方式。当前 Sources 的云文件 provider 默认断开,源码/设置尚不持久化。此外,在线 API 指南仍有旧的标签高度、overflow 箭头和增量布局状态说明,需要与现有实现及测试统一。
## 2026-10-25 整理验证方式
本轮是整理,不扩展业务功能。沿用工作约定:格式、`cargo clippy --all-targets --offline -- -D warnings`、原生 release 打包、真实窗口和少量人工 API 操作;不执行 cargo test、自动 smoke 脚本或 Docker。Clippy 会编译检查已有测试代码,但不代表测试已经执行。
最终实际执行结果见 [整理清单的验收记录](file-map.md#验收记录)。架构图已用官方 PlantUML JavaScript 引擎在本地生成 SVG 和 PNG,并检查实际图片。渲染工具临时安装在仓库外,不需要 Java、原生 Graphviz 或在线服务;详见 [UML 图册的重建步骤](uml/README.md#重新生成)。
## 后续建议顺序
以下是后续建议,不是本轮已经实现或已承诺排期的功能。
1. 把多 Page、关闭重开、跨窗拖放、共享字段刷新作为固定人工验收场景,优先暴露状态与生命周期问题。
2. 沿稳定接口继续拆分 `ui_bridge` 的刷新协调和 `app` 的输入路由,减少大模块;不要仅为“分层”额外复制对象模型。
3. 明确保存/恢复与文件 provider 的产品语义,再选择持久化格式和后端。
4. 根据真实应用需求推进 Aster 运算与类型能力,避免用 UI 层预设值冒充完整业务计算。
5. 在增加可信外部运行能力前明确权限、执行隔离与分发机制。
+30
View File
@@ -0,0 +1,30 @@
# 07 · 本轮整理的设计决策
## 职责目录,不冒充已经解耦的层
采用 `shell / runtime / model / render / bridge` 是为了让入口、对象、执行和绘制更容易定位。当前仍是一个 Rust binary crate:model 需要 bridge 派生类型与 render 几何,bridge 需要 model 和 render,runtime/API 也会通知 shell 的 AppEvent。组件图因此画的是主要行为流,不是严格单向依赖约束。
`main.rs` 的 `pub(crate) use` 是内部路径兼容门面,使现有 `crate::block` 等调用继续指向新目录。它不增加公共库 API、不产生第二份对象,也不隐藏多份实现。代价是调用路径暂时不能单独反映目录所属;需要打开 `main.rs` 或源码导航确定归属。后续若要拆 crate,应先定义跨边界协议并梳理实际循环依赖,而不是机械删掉别名。
## 拆分的是职责,不是复制代码
- API 的 worker 负责活跃 VM、候选请求、增量执行、发布与关闭;HTTP 路由和活动记录仍在 `api.rs`。
- 在线 agent 指南独立到 `api/guide.rs`,仍由当前 NamespaceState 生成;嵌入例子的相对路径已随目录调整。
- bridge 的 `tree.rs` 只放无托管句柄的派生画面数据;`signatures.rs` 负责规范签名;`calls.rs` 实现 NativeCallable;`bootstrap.rs` 安装类型表及 globals。
- bridge 主模块保留 Session、窗口 Presentation 和挂起布局等协调。这里仍接近 2000 行;本轮没有声称已把全部大模块拆完。
- 原有 tests.rs 随所属模块移动,保持原测试含义,只修正编译时样例文件路径。没有删减现有测试来让检查通过。
这些子模块共享父模块的内部类型;`use super::*` 表达它们是同一实现单元的拆分,而不是独立公共服务。worker 只向 API 父作用域暴露必要协调接口和现有测试所需状态;其他请求处理细节继续私有。
## 本轮保持的边界
- 不更改 Endor 示例、API 路由、语法、运行时预算、窗口视觉参数和交互效果。
- 不更新 Aster 子模块,不改变 vendor 历史。
- 不移动构建产物、已有示例与媒体目录,不修改用户未提交的示例工作。
- 不引入新的产品依赖或在线 UML 渲染服务。文档图片由仓库外的临时 Node 工具生成,应用构建不依赖它。
## 文档的可信度
本套 UML 以实际 Rust 类型、线程名、队列、方法和引用语义为依据。`.puml` 是图的唯一可编辑来源,PNG/SVG 由 `scripts/render-uml.mjs` 生成;文档直接引用生成图像。概念状态机、主要调用流及省略字段都在图旁标明;它们不是自动从源码生成的完整模型。进展矩阵区分代码已有、此前人工验证、本轮验证及未完成项。
更改执行/生命周期语义后应同步更新 `02/03/04` 与对应 `.puml`;更改 shell 交互后更新 `05`;发布阶段结果更新 `06` 和本轮验收记录。逐文件清单是本次迁移快照,不要求以后每次新增模块都伪装成同一轮迁移。
+37
View File
@@ -0,0 +1,37 @@
# Tessera 架构与进展导览
核对日期:2026-10-25。范围:本仓库当前实现;Aster 子模块固定在 `f3e1670`,本次不更新其代码或版本。
Tessera 目前是**运行 Endor 对象程序的原生桌面宿主**。Endor 程序创建和共享对象,Page 把对象组织成可交互界面;Tessera 负责窗口、输入、布局、绘制、调试入口和本机 API。它已经能运行多页面示例,但还不是带持久化、权限和业务后端的完整应用平台。
建议按下面顺序阅读。图表示真实结构或经过标注的简化流程,不把后续计划画成已经存在的组件。
| 文档 | 回答的问题 |
| --- | --- |
| [01 模块与部署](01-modules.md) | 目录为什么这样分?有哪些线程与外部依赖? |
| [02 对象模型与所有权](02-object-model.md) | Block、Page、Window、Mount 分别是什么?谁保留对象? |
| [03 执行与发布](03-runtime.md) | Endor 如何变成界面?错误和过期请求怎么处理? |
| [04 布局、绘制与输入](04-rendering.md) | 修改对象后如何刷新?点击如何回到同一个 VM? |
| [05 桌面工作区](05-workspace.md) | 标签、原生窗口、默认页、开发工具如何配合? |
| [06 当前进展](06-progress.md) | 已经做到什么?还有哪些限制?怎样复现? |
| [07 设计决策](07-decisions.md) | 为什么使用这些边界?整理还没有解决什么? |
| [逐文件整理清单](file-map.md) | 每个文件迁移到哪里、负责什么,本次拆出了什么? |
UML 已渲染为普通 PNG 图片,直接嵌入各篇说明,不依赖 Mermaid 或 PlantUML 插件。需要放大可打开 SVG;八张图的图片、SVG 和可编辑源码集中在 [UML 图册](uml/README.md)。图像由本地脚本从 `.puml` 生成,不使用在线渲染服务。
![组件与主要数据流](uml/rendered/components.png)
[放大组件图 SVG](uml/rendered/components.svg)
## 先抓住四个概念
1. **对象是程序状态**:共享内容留在 Aster 管理的对象堆内;切换标签不靠重放源码恢复对象。
2. **Mount 是一次展示位置**:同一个 Block 可以在不同位置出现,每个位置有自己的几何、滚动和焦点上下文。
3. **Frame 是发布给窗口的值**:窗口收到命令、文本、标量 ID 等原生数据,不拿到 VM 堆引用。
4. **Page 和标签不是两套页面系统**:标签是托管 Page 的窗口侧投影;默认页也是 Endor Page。
## 本轮整理结果
`src` 的实现收进 `shell / runtime / model / render / bridge` 五个目录,根目录保留启动入口和源码导航。`api.rs` 从约 1800 行拆成请求处理、worker 与在线指南;`ui_bridge.rs` 从约 3450 行拆出画面树、签名、原生方法调用和类型初始化,主文件保留会话与展示刷新协调。
这些目录是**职责分组,不是已经隔离的五个 crate**。目前 model、bridge、render 仍有协作依赖,主窗口事件与 worker 之间也有协议耦合。根目录保留 crate 私有模块别名,让本次迁移不同时改写全部调用路径;详见设计决策。
+144
View File
@@ -0,0 +1,144 @@
# 逐文件整理清单
本轮仅重排 Tessera 宿主实现;以下覆盖所有迁移源码、测试和默认页文件。未修改 `vendor/aster`、用户已有的 `examples/README.md` 改动及未跟踪的 `examples/workspace.endor`。
主入口 `src/main.rs` 改为五组目录模块及 crate 私有兼容别名;`src/README.md` 改为中文源码导航;根 `README.md` 更新架构入口、实际初始页/多页面状态和迁移后的路径。既有 Endor 示例、媒体和打包脚本保留原位置。
## shell
| 原路径 | 新路径 | 用途与本次变化 |
| --- | --- | --- |
| `src/activity.rs` | [src/shell/activity.rs](../../src/shell/activity.rs) | 有界 HTTP 活动记录与允许的头部预览 |
| `src/app.rs` | [src/shell/app.rs](../../src/shell/app.rs) | GUI 事件循环、窗口/viewport、输入与 chrome 调度 |
| `src/clipboard.rs` | [src/shell/clipboard.rs](../../src/shell/clipboard.rs) | 原生 UTF-8 剪贴板适配 |
| `src/developer_tools.rs` | [src/shell/developer_tools.rs](../../src/shell/developer_tools.rs) | 四个工具 Page 的状态、焦点与管理交互协调 |
| `src/developer_tools/console.rs` | [src/shell/developer_tools/console.rs](../../src/shell/developer_tools/console.rs) | Console 提示符、执行输出与输入布局 |
| `src/developer_tools/network.rs` | [src/shell/developer_tools/network.rs](../../src/shell/developer_tools/network.rs) | 本机 API Network 检查视图 |
| `src/developer_tools/painter.rs` | [src/shell/developer_tools/painter.rs](../../src/shell/developer_tools/painter.rs) | 工具页面绘制辅助 |
| `src/developer_tools/selection.rs` | [src/shell/developer_tools/selection.rs](../../src/shell/developer_tools/selection.rs) | 文本选择和光标几何 |
| `src/developer_tools/settings.rs` | [src/shell/developer_tools/settings.rs](../../src/shell/developer_tools/settings.rs) | 内存内主题设置视图 |
| `src/developer_tools/sources.rs` | [src/shell/developer_tools/sources.rs](../../src/shell/developer_tools/sources.rs) | 源码、AST 和文件来源视图 |
| `src/native_chrome.rs` | [src/shell/native_chrome.rs](../../src/shell/native_chrome.rs) | macOS 原生按钮对齐和工具栏双击系统动作 |
| `src/sources.rs` | [src/shell/sources.rs](../../src/shell/sources.rs) | 默认断开的云文件 provider 接口及工作区 |
| `src/system_ui/README.md` | [src/shell/system_ui/README.md](../../src/shell/system_ui/README.md) | 管理控件职责说明及更新后的源码路径 |
| `src/system_ui/interaction.rs` | [src/shell/system_ui/interaction.rs](../../src/shell/system_ui/interaction.rs) | 宿主管理控件的 ID、命中、焦点和交互状态 |
| `src/system_ui/mod.rs` | [src/shell/system_ui/mod.rs](../../src/shell/system_ui/mod.rs) | 管理控件模块导出 |
| `src/system_ui/theme.rs` | [src/shell/system_ui/theme.rs](../../src/shell/system_ui/theme.rs) | 管理表面颜色和主题 |
| `src/system_ui/widgets.rs` | [src/shell/system_ui/widgets.rs](../../src/shell/system_ui/widgets.rs) | 宿主可复用控件绘制 |
| `src/tabs.rs` | [src/shell/tabs.rs](../../src/shell/tabs.rs) | 共享标签绘制/命中、密集布局、滚动、拖放及动画 |
| `src/tabs/hover.rs` | [src/shell/tabs/hover.rs](../../src/shell/tabs/hover.rs) | 标签、关闭和加号的颜色过渡 |
| `src/tabs/motion.rs` | [src/shell/tabs/motion.rs](../../src/shell/tabs/motion.rs) | 标签布局动画及 hover 重绘期限 |
## runtime
| 原路径 | 新路径 | 用途与本次变化 |
| --- | --- | --- |
| `src/api.rs` | [src/runtime/api.rs](../../src/runtime/api.rs) | HTTP 请求路由、队列、请求观察和响应;worker/指南拆为子模块 |
| `src/api/tests.rs` | [src/runtime/api/tests.rs](../../src/runtime/api/tests.rs) | 保留原 API 测试;只调整嵌入示例路径,不执行测试 |
| `src/endor_host.rs` | [src/runtime/endor_host.rs](../../src/runtime/endor_host.rs) | 候选/活跃 VM、编译执行、增量刷新、清理和诊断 |
| `src/endor_host/tests.rs` | [src/runtime/endor_host/tests.rs](../../src/runtime/endor_host/tests.rs) | 保留原宿主测试;只调整嵌入示例路径,不执行测试 |
| `src/endor_script.rs` | [src/runtime/endor_script.rs](../../src/runtime/endor_script.rs) | 组织 Aster Script/Module 输入及原始源码范围 |
| `src/event_dispatch.rs` | [src/runtime/event_dispatch.rs](../../src/runtime/event_dispatch.rs) | 托管事件、订阅和 capture/target/bubble 分发 |
| `src/events.rs` | [src/runtime/events.rs](../../src/runtime/events.rs) | 原生输入的有界 loopback 传输 |
| `src/io_tasks.rs` | [src/runtime/io_tasks.rs](../../src/runtime/io_tasks.rs) | 有界文件/HTTP provider、纯数据完成消息和取消 |
| `src/tasks.rs` | [src/runtime/tasks.rs](../../src/runtime/tasks.rs) | 托管 Task、owner/key 取消和协作任务调度 |
| `src/vm_sequence.rs` | [src/runtime/vm_sequence.rs](../../src/runtime/vm_sequence.rs) | 共享 VM 调用序列及同帧迭代驱动 |
## model
| 原路径 | 新路径 | 用途与本次变化 |
| --- | --- | --- |
| `src/binding.rs` | [src/model/binding.rs](../../src/model/binding.rs) | 属性依赖、只读计算与托管绑定 |
| `src/block.rs` | [src/model/block.rs](../../src/model/block.rs) | Block/Cell/Data 语义、稳定子 slot 和共享赋值 |
| `src/document.rs` | [src/model/document.rs](../../src/model/document.rs) | NamespaceState、RenderDocument、Frame、发布校验与原生命令 |
| `src/mount.rs` | [src/model/mount.rs](../../src/model/mount.rs) | 每次展示出现的托管上下文、生命周期及弱索引 |
| `src/object_list.rs` | [src/model/object_list.rs](../../src/model/object_list.rs) | 托管结果集合的类型封装与只读访问 |
| `src/presentation.rs` | [src/model/presentation.rs](../../src/model/presentation.rs) | 逐窗口布局、Mount、缓存、读依赖和失效状态 |
| `src/protocols.rs` | [src/model/protocols.rs](../../src/model/protocols.rs) | Visual/EventTarget/Children/Presentable 能力契约安装 |
| `src/snapshot.rs` | [src/model/snapshot.rs](../../src/model/snapshot.rs) | 变化依赖和不可变视觉提取缓存 |
| `src/window.rs` | [src/model/window.rs](../../src/model/window.rs) | 托管 Window、Page registry、命令及生命周期 |
## render
| 原路径 | 新路径 | 用途与本次变化 |
| --- | --- | --- |
| `src/display_list.rs` | [src/render/display_list.rs](../../src/render/display_list.rs) | 原生绘制原语和颜色 |
| `src/geometry.rs` | [src/render/geometry.rs](../../src/render/geometry.rs) | 点和矩形值 |
| `src/layout.rs` | [src/render/layout.rs](../../src/render/layout.rs) | 原生测量、排列、出现几何及预算 |
| `src/native_visual.rs` | [src/render/native_visual.rs](../../src/render/native_visual.rs) | 托管原生视觉协议、值转换和签名检查 |
| `src/scene.rs` | [src/render/scene.rs](../../src/render/scene.rs) | 页面、标签、插入标记和开发工具画面合成 |
| `src/scroll.rs` | [src/render/scroll.rs](../../src/render/scroll.rs) | 逐 Mount 偏移、嵌套滚动和剪裁投影 |
| `src/software_renderer.rs` | [src/render/software_renderer.rs](../../src/render/software_renderer.rs) | 软件光栅化、抗锯齿覆盖和嵌套剪裁 |
| `src/source_hit.rs` | [src/render/source_hit.rs](../../src/render/source_hit.rs) | 源/原生命中协议与匹配目标 |
| `src/source_layout.rs` | [src/render/source_layout.rs](../../src/render/source_layout.rs) | 源 measure/arrange、约束、挂起工作和测量缓存 |
| `src/source_paint.rs` | [src/render/source_paint.rs](../../src/render/source_paint.rs) | 源 paint 调用、受限命令转换和依赖 |
| `src/text.rs` | [src/render/text.rs](../../src/render/text.rs) | 系统字体、shaping、字形和测量缓存 |
## bridge
| 原路径 | 新路径 | 用途与本次变化 |
| --- | --- | --- |
| `src/ui_bridge.rs` | [src/bridge/ui_bridge.rs](../../src/bridge/ui_bridge.rs) | Endor 宿主类型、窗口展示会话、布局/绘制发布协调;本次拆出四个实现子模块 |
| `src/ui_bridge/developer_pages.rs` | [src/bridge/ui_bridge/developer_pages.rs](../../src/bridge/ui_bridge/developer_pages.rs) | 托管默认页与工具页的建立入口 |
| `src/ui_bridge/start_page.endor` | [src/bridge/ui_bridge/start_page.endor](../../src/bridge/ui_bridge/start_page.endor) | 默认页和共享/组合交互的 Endor 源码 |
## 新增模块与拆分
| 新文件 | 职责 / 来源 |
| --- | --- |
| `src/shell/mod.rs` | 声明 shell 组内模块,形成明确的目录所有权 |
| `src/runtime/mod.rs` | 声明 runtime 组内模块,形成明确的目录所有权 |
| `src/model/mod.rs` | 声明 model 组内模块,形成明确的目录所有权 |
| `src/render/mod.rs` | 声明 render 组内模块,形成明确的目录所有权 |
| `src/bridge/mod.rs` | 声明 bridge 组内模块,形成明确的目录所有权 |
| [src/runtime/api/worker.rs](../../src/runtime/api/worker.rs) | 从 api.rs 提取 VM worker、增量请求状态、候选/活跃发布及关闭协调,内部可见性限制在父 API 模块 |
| [src/runtime/api/guide.rs](../../src/runtime/api/guide.rs) | 从 api.rs 提取当前 namespace 的在线 agent 使用指南;修正 include_str 示例路径 |
| [src/bridge/ui_bridge/tree.rs](../../src/bridge/ui_bridge/tree.rs) | 从 ui_bridge.rs 提取不可变 UiNode / UiKind 与比较逻辑 |
| [src/bridge/ui_bridge/signatures.rs](../../src/bridge/ui_bridge/signatures.rs) | 提取宿主方法/构造操作的规范签名 |
| [src/bridge/ui_bridge/calls.rs](../../src/bridge/ui_bridge/calls.rs) | 提取 NativeCallable for Function 的 Block 操作分发 |
| [src/bridge/ui_bridge/bootstrap.rs](../../src/bridge/ui_bridge/bootstrap.rs) | 提取 desktop、类型表与宿主 globals 安装 |
## 新增架构文档
| 文件 | 说明 |
| --- | --- |
| `docs/architecture/README.md` | 中文阅读入口与本轮范围 |
| `01-modules.md` | 职责目录、组件和线程部署 |
| `02-object-model.md` | 对象、Mount、强弱引用与版本 |
| `03-runtime.md` | PUT/Console/API、候选发布与任务状态 |
| `04-rendering.md` | 依赖、布局、paint、命中和输入回路 |
| `05-workspace.md` | Page、标签、原生窗口和四个工具页 |
| `06-progress.md` | 已实现、限制、示例和后续建议 |
| `07-decisions.md` | 路径兼容门面与未完全解耦的边界 |
| `file-map.md` | 本逐文件迁移和拆分清单、验收记录 |
| `uml/README.md` | UML 文件导航及本地导出说明 |
| `uml/components.puml` | 组件 UML 源码 |
| `uml/deployment.puml` | 部署 UML 源码 |
| `uml/domain.puml` | 对象类 UML 源码 |
| `uml/publication.puml` | PUT 发布时序 UML 源码 |
| `uml/input.puml` | 输入分发时序 UML 源码 |
| `uml/tasks.puml` | 任务状态 UML 源码 |
| `uml/windows.puml` | Page 可达性/展示状态 UML 源码 |
## 验收记录
- `cargo fmt --check`、`cargo clippy --all-targets --offline -- -D warnings`、`scripts/build-macos-app.sh --offline` 通过。
- 原生启动通过;人工提交 Campus Console 输入成功,七页正常显示。实际点击提交/评分后,仪表盘共享成绩更新为 88.5%。
- 完整 Campus PUT 返回 HTTP 200;故意错误的 PUT 返回 422;随后 GET 返回 HTTP 200,源码与原成功提交逐字节相同。
- 在线指南完整 GET 返回 HTTP 200;新增架构文档、源码导航和项目入口的本地文件链接检查通过。
- 原有 API/宿主测试随模块迁移并通过编译检查;未执行 cargo test、自动 smoke 或 Docker。
- Aster 子模块仍为 `f3e1670`。用户已有的示例变更保留且不提交。
- 初轮仅提供 UML 源码;后续已补齐八图的本地 SVG/PNG 渲染、普通 Markdown 图片引用和实际图像检查,见下节。
## UML 渲染补齐
- `scripts/render-uml.mjs`:新增本地官方 PlantUML 引擎的导出入口,使用 XML DOM、原生 Canvas 字体测量和 Viz 布局;检测错误图,生成不透明白底 SVG 与高分辨率 PNG。
- `scripts/README.md`:增加文档渲染入口;不改变原生打包/检查流程。
- `uml/components.puml`、`deployment.puml`、`domain.puml`、`publication.puml`、`input.puml`、`tasks.puml`、`windows.puml`:修正标签换行,统一字体和画布设置,调整组件图方向并修正部署图中不兼容的注释位置。
- `uml/runtime.puml`:补充文档原有的候选/活跃运行时状态图源码。
- `uml/rendered/{components,deployment,domain,publication,runtime,input,tasks,windows}.{svg,png}`:新增对应八张图的 SVG 和 PNG,共 16 个生成文件。
- `01-modules.md`、`02-object-model.md`、`03-runtime.md`、`04-rendering.md`、`05-workspace.md`:把所有未渲染的 Mermaid 图块替换为普通图片,附 SVG 和源码链接。
- `README.md`、`06-progress.md`、`07-decisions.md`、`uml/README.md` 和本清单:更新查看入口、图册、生成方式与实际验证状态。
八份源码均通过本地导出并检查实际图片;文档图片/本地链接、Node 语法和 Git 空白检查通过。本轮没有修改 Rust 应用代码,因此不重复运行应用构建或 cargo test。
+67
View File
@@ -0,0 +1,67 @@
# UML 图册
下面直接显示已渲染的 PNG,不需要安装 Markdown 插件。打开 SVG 可以放大阅读;`.puml` 保留可编辑源码。画布为不透明白底,避免深色查看器把黑色文字和连线淹没。
## 组件与主要数据流
![组件与主要数据流](rendered/components.png)
[放大 SVG](rendered/components.svg) · [编辑源码](components.puml)
## 进程与线程部署
![进程与线程部署](rendered/deployment.png)
[放大 SVG](rendered/deployment.svg) · [编辑源码](deployment.puml)
## 对象模型与引用关系
![对象模型与引用关系](rendered/domain.png)
[放大 SVG](rendered/domain.svg) · [编辑源码](domain.puml)
## 完整程序执行与发布时序
![完整程序执行与发布时序](rendered/publication.png)
[放大 SVG](rendered/publication.svg) · [编辑源码](publication.puml)
## 候选与活跃运行时状态
![候选与活跃运行时状态](rendered/runtime.png)
[放大 SVG](rendered/runtime.svg) · [编辑源码](runtime.puml)
## 原生输入与事件分发时序
![原生输入与事件分发时序](rendered/input.png)
[放大 SVG](rendered/input.svg) · [编辑源码](input.puml)
## 异步任务状态
![异步任务状态](rendered/tasks.png)
[放大 SVG](rendered/tasks.svg) · [编辑源码](tasks.puml)
## 页面展示与可达性状态
![页面展示与可达性状态](rendered/windows.png)
[放大 SVG](rendered/windows.svg) · [编辑源码](windows.puml)
## 重新生成
从项目根目录运行下面的文档工具。依赖只安装到临时目录,固定版本;不写入 Cargo、应用依赖或全局环境。渲染时不上传图的源码。
```sh
export UML_RENDER_TOOLS="$(mktemp -d /private/tmp/tessera-uml.XXXXXX)"
npm install --prefix "$UML_RENDER_TOOLS" --ignore-scripts --no-audit --no-fund \
@plantuml/core@1.2026.9 @viz-js/viz@3.17.0 \
@napi-rs/canvas@0.1.80 @xmldom/xmldom@0.9.12 sharp@0.34.5
node scripts/render-uml.mjs
```
使用官方 `@plantuml/core` JavaScript 引擎、Viz 布局、XML DOM 和本机 Canvas 字体测量,不需要 Java 或原生 Graphviz。PNG 由同一份 SVG 导出。脚本对渲染错误图做检查,失败则停止;修改源码后应重新生成并查看图片。
字体取自本机,跨机器重建可能有微小的排版差异。源图中的概念状态与省略字段范围以各篇架构说明为准;渲染不会把概念图变成自动提取的完整代码模型。
+32
View File
@@ -0,0 +1,32 @@
@startuml
skinparam backgroundColor #FFFFFF
skinparam defaultFontName Arial
skinparam defaultFontSize 14
skinparam shadowing false
top to bottom direction
title Tessera — implemented components (principal runtime flows)
component "shell\nwindows / tabs / developer tools" as Shell
component "runtime/api\nHTTP + queue" as API
component "runtime/api/worker\nserial VM ownership" as Worker
component "bridge/ui_bridge\ntypes / native calls / refresh" as Bridge
component "model\nobjects / mounts / bindings" as Model
component "render\nlayout / paint / hit / raster" as Render
component "Aster\nfrontend / compiler / core" as Aster
component "runtime/io_tasks\nplain-data completion" as IO
database "NamespaceState\nowned document + frame values" as State
Shell --> API : serialized input / Console
API --> Worker : bounded BuildRequest queue
Worker --> Aster : compile / execute
Worker --> Bridge : install / refresh / dispatch
Bridge <--> Model : managed graph + dependencies
Bridge --> Render : derive frame
Worker --> State : validate epoch + publish
State --> Shell : immutable snapshot
Shell --> Render : compose chrome + rasterize
Worker <--> IO : request / completion
note bottom of Model
Directory groups are not separate crates.
Imports still cross groups; this is not
an exhaustive or acyclic import graph.
end note
@enduml
+29
View File
@@ -0,0 +1,29 @@
@startuml
skinparam backgroundColor #FFFFFF
skinparam defaultFontName Arial
skinparam defaultFontSize 14
skinparam shadowing false
title Tessera — local process and thread deployment
node "User computer" {
artifact "Local agent client" as Agent
node "Tessera desktop process" {
node "GUI main thread\nwinit + softbuffer" as GUI
node "tessera-agent-api\nHTTP receiver" as API
node "tessera-endor-worker\nReplSession / Candidate / Aster heap" as Worker
node "Input sender thread" as Input
node "Lazy bounded I/O pool" as IO
database "Arc<RwLock<NamespaceState>>\nno VM handles in published frames" as State
API --> Worker : bounded queue (8 pending)
Worker --> State : commit document
State --> GUI : native snapshots
GUI --> Input : Input values
Input --> API : loopback HTTP
Worker <--> IO : mailbox / cancellation
}
node "System curl subprocess" as Curl
artifact "OS window + pixel buffer" as Window
Agent --> API : 127.0.0.1:4737
GUI --> Window
IO --> Curl : fetchText transport
}
@enduml
+89
View File
@@ -0,0 +1,89 @@
@startuml
skinparam backgroundColor #FFFFFF
skinparam defaultFontName Arial
skinparam defaultFontSize 14
skinparam shadowing false
title Tessera — managed identity versus published values
hide empty methods
class ReplSession {
id: u64
faulted: bool
}
class Candidate {
vm: Vm
roots: ObjectRef[]
globals: ObjectRef
}
class UiBridge
class Presentation {
desktop: ObjectRef
active: ObjectRef
render_cache: RenderCache
}
class ManagedWindow {
id: u64
pages: ObjectRef[]
closed: bool
}
class Block {
state: ObjectRef
page: bool
}
class Cell
class Data {
kind: Kind
children: Child[]
bindings: ObjectRef[]
}
class Child {
slot: u64
block: ObjectRef
}
class Mount {
block: ObjectRef
page: WeakObjectRef
parent: WeakObjectRef
geometry: MountGeometry
}
class MountTable {
active: Map<u64, WeakObjectRef>
}
class UiNode {
block_id: String
slots: u64[]
kind: UiKind
}
class Frame {
session: u64
layout_version: u64
commands: RenderCommand[]
tabs: Tab[]
}
class RenderDocument {
source: String
ui_root: Arc<UiNode>
windows: Map
}
ReplSession *-- Candidate
ReplSession *-- UiBridge
UiBridge *-- Presentation : shared Session
ManagedWindow --> Block : open Pages retained
Block --> Cell : state
Cell --> Data : ordinary content
Cell --> Block : shared assignment forwarding
Data *-- Child
Child --> Block
Mount --> Block : strong
Mount ..> Mount : weak reverse/sibling links
Presentation *-- MountTable
MountTable ..> Mount : weak index
Presentation ..> UiNode : cached derivation
RenderDocument o-- UiNode
RenderDocument *-- Frame
RenderDocument *-- RenderDocument : secondary windows
note bottom of Block
Page is a managed Block kind/nominal type.
This omits type tables, service dictionaries,
captured roots and many fields: not a full GC graph.
end note
@enduml
+29
View File
@@ -0,0 +1,29 @@
@startuml
skinparam backgroundColor #FFFFFF
skinparam defaultFontName Arial
skinparam defaultFontSize 14
skinparam shadowing false
title Native input — one VM and one event dispatcher
actor User
participant TesseraApp as GUI
participant "events::Client" as Client
participant "API / worker" as Worker
participant ReplSession as VM
participant event_dispatch as Dispatch
participant "refresh / publication" as Refresh
User -> GUI : pointer press / release
GUI -> GUI : published geometry; matching target
GUI -> Client : Input(window, session, layout_version, mount)
Client -> Worker : POST /events
Worker -> Worker : reject stale source/destination identities
Worker -> VM : dispatch_incremental
VM -> Dispatch : target Block + optional Mount
Dispatch -> Dispatch : capture -> target -> bubble
Dispatch -> VM : budgeted handler / onEvent / onClick
VM -> Refresh : update related presentations
Refresh --> GUI : Frame / DocumentUpdated
note over Dispatch
Without a Mount, dispatch visits only the target.
With a Mount, traversal follows that occurrence.
end note
@enduml
+39
View File
@@ -0,0 +1,39 @@
@startuml
skinparam backgroundColor #FFFFFF
skinparam defaultFontName Arial
skinparam defaultFontSize 14
skinparam shadowing false
title Complete PUT — isolated execution and epoch-checked publication
actor Client
participant "api.rs" as API
queue "BuildRequest queue" as Queue
participant "api/worker.rs" as Worker
participant "Aster candidate VM" as VM
participant UiBridge
participant NamespaceState as State
participant TesseraApp as GUI
Client -> API : PUT /v1/namespaces/app.main/code
API -> API : validate / assign accepted submission
API -> Queue : bounded enqueue
Queue -> Worker : receive request
Worker -> VM : parse / compile / execute in fresh candidate
VM -> UiBridge : allocate objects / Pages
loop incremental refresh slices
Worker -> UiBridge : bindings / layout / paint / mounts
UiBridge --> Worker : Pending or native document
end
Worker -> State : verify submission epoch
alt valid and successful
Worker -> State : commit document + window commands
Worker -> Worker : candidate becomes active ReplSession
Worker --> GUI : DocumentUpdated
Worker --> Client : response + committed revision
else superseded / failed
Worker -> Worker : discard candidate; keep valid live owner
Worker --> Client : 409 / 422 / 500 as applicable
end
note over API,Worker
Worker retains the observed request and responds.
GUI does not execute the HTTP request or VM.
end note
@enduml
Binary file not shown.

After

Width:  |  Height:  |  Size: 317 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 8.4 KiB

+20
View File
@@ -0,0 +1,20 @@
@startuml
skinparam backgroundColor #FFFFFF
skinparam defaultFontName Arial
skinparam defaultFontSize 14
skinparam shadowing false
title Candidate and active runtime (conceptual states)
[*] --> Candidate : accepted complete PUT
Candidate --> Refreshing : compilation / execution succeeds
Candidate --> Rejected : compilation / execution error
Refreshing --> Refreshing : yield / continue refresh
Refreshing --> Active : valid document + matching submission
Refreshing --> Superseded : newer write / delete
Active --> Active : Console / input / task completion
Active --> Faulted : callback or refresh fault
Active --> Retired : replace / reset / delete / shutdown
Faulted --> Retired : cleanup or replace
Rejected --> [*]
Superseded --> [*]
Retired --> [*]
@enduml
+25
View File
@@ -0,0 +1,25 @@
@startuml
skinparam backgroundColor #FFFFFF
skinparam defaultFontName Arial
skinparam defaultFontSize 14
skinparam shadowing false
title Managed Task — lifecycle states from tasks.rs
[*] --> Pending
Pending --> Running : due / delivery eligible
Pending --> Completed : provider done; no callback
Pending --> Failed : provider error
Pending --> Cancelled : owner invalid / key replacement / cancel
Running --> Completed : successful delivery
Running --> Failed : transport or execution error
Running --> Cancelled : cancel / lifecycle cleanup
Completed --> [*]
Failed --> [*]
Cancelled --> [*]
note right of Pending
Provider I/O may already run while the Task
is Pending. Running does not necessarily
mean the I/O starts at that instant.
Scheduler index is weak; callbacks/scopes
are traced managed edges.
end note
@enduml
+20
View File
@@ -0,0 +1,20 @@
@startuml
skinparam backgroundColor #FFFFFF
skinparam defaultFontName Arial
skinparam defaultFontSize 14
skinparam shadowing false
title Page visibility and reachability (conceptual states)
[*] --> Open : Page registered
Open --> Selected : activate / click tab
Selected --> Open : select another Page
Open --> Closed : close / release registry edge
Selected --> Closed : close active Page
Closed --> Open : still referenced; reopen
Closed --> Collected : no strong managed path; GC
Collected --> [*]
note right of Closed
Closing a tab is not destroying an object.
Cross-window moves update managed registries
only after session/layout/drop validation.
end note
@enduml
+84
View File
@@ -0,0 +1,84 @@
# Endor Campus 多页面示例
源码:[campus-lms.endor](../examples/campus-lms.endor)。这是参考 Instructure
Canvas LMS 信息结构的本地学习环境示例,使用虚构学生、课程与作业数据。
## 运行与页面
在 Tessera 按 F12 打开 Console,点击 `>` 输入位置,粘贴完整源码并按 Enter。
建议在新会话中运行一次;重复执行会创建另一组页面。
源码建立七个真正的 managed Page:仪表盘、程序设计、高等数学、学术英语、
作业中心、成绩总览和实验提交详情。每页进入应用现有的标签栏,可以切换、
关闭,再通过课程卡片或导航重新打开。没有额外模拟一套网页标签栏。
酒红侧栏提供全局导航,仪表盘用三种课程色区分课程,课程主页展示各自的
介绍和学习单元;作业中心汇总课程作业,成绩总览提供课程成绩与实验反馈。
侧栏的「课程」入口回到程序设计示例课,其余课程从仪表盘卡片或成绩行进入。
## 对象与交互
三门课程各有一个 `CampusCourse` 对象。程序设计的 `CampusWork` 对象被
仪表盘、作业中心、成绩页和提交详情共同引用,界面通过 `ui.textOf` 绑定字段。
- 「模拟提交实验」更新提交内容和状态;作业中心同步显示等待评分。
- 「应用示例评分」写入预设的 92 / 100 与反馈,并把课程成绩改为 88.5%、
学习进度改为 4 / 6;课程主页、成绩总览和仪表盘同步更新。
- 「恢复演示数据」恢复未提交、无分数、课程 86.0% 和 3 / 6 的进度。
页面导航通过接收 `Event` 的 `CampusTarget.open` 方法调用零参数 `Page.open()`。
不能把有可选 Window 参数的 `Page.open` 直接当作点击回调,否则 Event 会被
误当作 Window。重新打开页面会保留共享对象中的状态。
## 原生验证
通过原生 Console 输入源码并执行,实际点击检查了:
- 三门课程内容各不相同,卡片和全局导航能切换真实 Page。
- 提交后作业中心显示「已提交 · 等待评分」。
- 评分后详情显示 92 / 100 与反馈,课程主页显示 88.5% 和 4 / 6,
成绩总览与仪表盘也显示 88.5%。
- 关闭高等数学标签,再从仪表盘卡片重新打开成功。
- 恢复数据后,详情和成绩总览恢复未提交、无分数和课程 86.0%。
截图保存在本次会话的 `/private/tmp/endor-campus-demo/`,包括仪表盘、
评分详情、成绩总览与恢复后的仪表盘。首次验证时没有成功的连续录屏;
后续建模视频见下节。
本阶段只增加 Endor 源码与说明,没有修改 Rust 渲染器。验证采用原生运行与
手动点击,以及 `git diff --check`;未运行 cargo test 或自动 smoke 脚本。
## 建模过程视频(2026-10-25)
[观看 MP4](media/endor-campus-modeling.mp4) ·
[中文字幕 SRT](media/endor-campus-modeling.zh.srt)
视频约 72 秒、1920 × 1200,无声,附带中文软字幕与章节。播放器未自动显示
字幕时可以开启中文字幕,或者加载同目录 SRT。
在新 Console 会话中分段执行同一份示例源码:先定义课程和作业模型,再定义
界面组件,创建共享对象图与七个 Page,逐步渲染仪表盘、课程、作业中心、
成绩总览,最后绑定提交与评分事件。末尾实际点击提交和预设评分,展示
作业状态、总评与学习进度在各页之间同步。代码分段粘贴,不是逐字输入。
系统屏幕采集设备虽然可被 FFmpeg 识别,但没有收到画面;因此使用原生
应用控制接口在操作期间连续抓取 Tessera 窗口,再由已有 FFmpeg 编码为 H.264。
共采集 299 帧,采样帧率随操作变化,剪去各采集段之间的等待;输出封装为
15 fps,重复帧不代表原始采样达到了 15 fps。没有使用静态成品截图重演操作。
应用重置后,在首次渲染前保留了上一次页面的显示快照,首次渲染后由新会话
的页面替换。视频包含该过程,并非从应用启动开始的系统录屏。
检查了视频参数、全片解码和抽帧画面;全片解码无错误。录制阶段没有修改
示例程序或 Rust 渲染器。
## 范围
这是多页面交互示例,没有 Canvas 登录、服务器、持久化、真实文件上传或
通用成绩计算。提交文件名为示例字符串,评分和总评是明确的预设状态,
不是根据公式计算的结果。页面使用双向 ScrollBlock;未完成所有小窗口尺寸的
布局验证。它不替代完整的 LMS 产品。
参考的是 Canvas 的课程卡片、全局导航、作业状态和成绩反馈结构:
[Dashboard 官方指南](https://community.instructure.com/en/kb/articles/664620-how-do-i-use-the-dashboard)、
[Grades 官方指南](https://community.instructure.com/en/kb/articles/661305-how-do-i-view-my-grades-in-a-current-course)。
没有登录或查看需要账户的学校数据。
+173
View File
@@ -0,0 +1,173 @@
# Tessera 中文源码注释与阅读索引
本轮进一步细化 Tessera 自有代码的中文注释:覆盖所有 Rust 模块、运行时/API 测试、内置起始页、45 个 Endor 示例、Cargo 依赖配置及两个工具脚本。说明聚焦具体输入/输出、状态归属、计算步骤、依赖观察、取消/失败路径和资源预算;不修改接口、算法、常量或非注释程序文本。Aster 是独立维护的 vendor 子模块,其固定版本与内容沿用主线。
## 建议阅读顺序
1. [main](../src/main.rs):创建原生循环、共享文档与执行 worker。
2. [原生应用](../src/shell/app.rs):理解窗口生命周期、可用视口、输入边界和最终 present。
3. [API worker](../src/runtime/api/worker.rs) 与 [运行时](../src/runtime/endor_host.rs):理解候选/活跃 VM、输入串行化、分片刷新和发布。
4. [桥接层](../src/bridge/ui_bridge.rs)、[Block](../src/model/block.rs) 与 [Mount](../src/model/mount.rs):区分共享业务对象、每次出现和展示事务。
5. [快照](../src/model/snapshot.rs)、[源布局](../src/render/source_layout.rs) 和 [源绘制](../src/render/source_paint.rs):理解依赖缓存、只读执行及挂起工作。
6. [二维视口](../src/render/viewport.rs)、[3D](../src/render/scene3d.rs) 和 [面板映射](../src/render/scene3d/panel.rs):理解布局/世界/视图的边界。
7. [任务](../src/runtime/tasks.rs)、[provider](../src/runtime/io_tasks.rs) 和 [事件传播](../src/runtime/event_dispatch.rs):理解异步交付资格与生命周期。
## 阅读时需要保留的边界
- Block/Data 属于共享业务组成;Mount 属于一个展示位置,不能把一次出现的尺寸写回共享对象来代替排版。
- ObjectRef/WeakObjectRef 的含义由真实托管拥有关系决定;派生缓存中的身份索引不能成为隐藏根。
- 窗口线程消费完整发布值;VM、源回调和托管堆操作只在执行 worker 内推进。
- submission 防止旧请求覆盖新输入;session 防止跨 VM 资源误用;layout_version 防止旧几何上的离散操作误触。
- Pending Work 同时拥有续体与上下文;取消必须关闭原 VM 的只读执行并恢复未提交 Mount,不能只丢弃 Rust 值。
- 场景世界不是无限尺寸的排版盒子;有限视口参加布局,摄像机负责投影,命中沿相同链逆变换。
- 现有 CPU 绘制、缓存范围与输入队列限制仍按当前代码执行;说明性注释不代表性能优化已实现。
## Rust 逐文件说明
每行说明该文件本次深化注释的职责和目的。生产函数/方法的入口说明与内部关键逻辑互相补充;VM 可调用适配器说明实际参数约定,而非仅重复 trait 名称。集成测试中的每个顶层测试/辅助函数都有具体场景和断言说明,测试程序字符串与断言保持原样。
| 文件 | 注释解释的职责与目的 |
| --- | --- |
| [src/bridge/mod.rs](../src/bridge/mod.rs) | 语言桥接模块入口。集中导出 Endor 类型和宿主实现之间的适配层。 |
| [src/bridge/ui_bridge.rs](../src/bridge/ui_bridge.rs) | Endor 与 Tessera 的展示事务协调层:维护每个窗口的 Page、Mount、布局缓存和发布版本。 |
| [src/bridge/ui_bridge/bootstrap.rs](../src/bridge/ui_bridge/bootstrap.rs) | 安装一次 VM 域需要的宿主类型、对象和方法。类型注册表是源代码调用原生能力的入口。 |
| [src/bridge/ui_bridge/calls.rs](../src/bridge/ui_bridge/calls.rs) | 把 Endor 方法调用分派到对应宿主操作。这里处理构造、树修改、绑定、状态与页面能力。 |
| [src/bridge/ui_bridge/developer_pages.rs](../src/bridge/ui_bridge/developer_pages.rs) | 把内置开发工具和起始页接入托管 Page。工厂在所属 VM 中编译和执行,而不是在窗口线程另建业务状态。 |
| [src/bridge/ui_bridge/page_input.rs](../src/bridge/ui_bridge/page_input.rs) | 把页面、2D 视口和 3D 视口的相机输入转换成托管对象更新。 |
| [src/bridge/ui_bridge/signatures.rs](../src/bridge/ui_bridge/signatures.rs) | 声明宿主方法在 Endor 类型系统中的参数和返回契约。 |
| [src/bridge/ui_bridge/tree.rs](../src/bridge/ui_bridge/tree.rs) | 定义从托管对象提取的不可变视觉树。共享业务对象可以有多次展示,树节点与 Mount 出现的身份不是同一概念。 |
| [src/main.rs](../src/main.rs) | 应用组合入口。先创建原生事件循环和共享发布状态,再启动 API/VM worker,最后把窗口事件交给 TesseraApp。 |
| [src/model/binding.rs](../src/model/binding.rs) | 属性绑定:在只读计算中收集依赖,将结果写回绑定目标。 |
| [src/model/block.rs](../src/model/block.rs) | Block 的共享赋值、底层 Data 与视觉属性实现。Block 通过 Cell 间接指向 Data,使别名能观察到同一次替换。 |
| [src/model/document.rs](../src/model/document.rs) | 运行时与窗口线程之间的发布数据契约。NamespaceState 管理提交序号、版本和当前完整文档。 |
| [src/model/mod.rs](../src/model/mod.rs) | 模型层模块入口。包含托管业务对象、每次展示上下文、依赖缓存,以及交给窗口线程的发布值。 |
| [src/model/mount.rs](../src/model/mount.rs) | 每次展示的托管上下文:同一个 Block 出现在两个位置时,有两个独立 Mount。 |
| [src/model/object_list.rs](../src/model/object_list.rs) | 给源协议返回的对象列表提供受控封装。列表内容通过托管引用被追踪,读方法只暴露检查后的条目。 |
| [src/model/presentation.rs](../src/model/presentation.rs) | 一个原生窗口对应一份 Presentation:独立视口、Mount、测量缓存、焦点与依赖记录。 |
| [src/model/protocols.rs](../src/model/protocols.rs) | 安装 Visual、EventTarget、Children 和 Presentable 等能力契约。 |
| [src/model/scene3d.rs](../src/model/scene3d.rs) | 将 Endor 托管场景对象转换成可供渲染线程读取的 3D 数据。 |
| [src/model/snapshot.rs](../src/model/snapshot.rs) | 从可变托管对象图提取不可变 UiNode,并维护反向依赖与父子失效传播。 |
| [src/model/window.rs](../src/model/window.rs) | 托管 Window 的页面所有权、原生命令与关闭生命周期。 |
| [src/render/box_model.rs](../src/render/box_model.rs) | 有限布局盒子的尺寸策略。区分 auto、固定值和 fill,并处理 min/max 对约束与最终尺寸的限制。 |
| [src/render/display_list.rs](../src/render/display_list.rs) | 面向设备像素的绘制指令集合。它承载矩形、文字、裁剪与 3D 表面等原语,不直接操作 VM。 |
| [src/render/geometry.rs](../src/render/geometry.rs) | 共享的二维点和矩形值。命中判断在调用方完成坐标系转换后使用,矩形本身不隐式处理相机。 |
| [src/render/layout.rs](../src/render/layout.rs) | 原生布局求解器:自底向上测量期望尺寸,再自顶向下分配位置和实际尺寸。 |
| [src/render/mod.rs](../src/render/mod.rs) | 渲染模块入口。排版、源视觉协议、相机投影和最终光栅化各自独立,通过不可变帧衔接。 |
| [src/render/native_visual.rs](../src/render/native_visual.rs) | 让原生组件也通过 Endor 的 measure/arrange/paint 协议被调用。 |
| [src/render/page.rs](../src/render/page.rs) | 旧 Page.mode 的兼容空间策略,以及页面级的正逆相机变换。 |
| [src/render/scene.rs](../src/render/scene.rs) | 合成整个原生窗口的显示列表:页面画面、宿主侧栏和开发工具绘制。 |
| [src/render/scene3d.rs](../src/render/scene3d.rs) | 有界 CPU 3D 渲染器。使用相同摄像机与世界变换进行视锥裁剪、深度测试、纹理采样和射线拾取。 |
| [src/render/scene3d/math.rs](../src/render/scene3d/math.rs) | 3D 数学基础:向量、仿射矩阵、摄像机基向量、投影射线和三角形相交。 |
| [src/render/scene3d/panel.rs](../src/render/scene3d/panel.rs) | 连接 3D 平面与普通 UI 的坐标和绘制桥梁。 |
| [src/render/scene3d/spatial.rs](../src/render/scene3d/spatial.rs) | 不可变世界空间 BVH。用网格变换后的包围盒快速筛选视锥与射线候选。 |
| [src/render/scroll.rs](../src/render/scroll.rs) | 逐 Mount 的滚动状态、裁剪和输入目标选择。 |
| [src/render/software_renderer.rs](../src/render/software_renderer.rs) | 把 DisplayList 写入 CPU 像素缓冲。裁剪栈限定矩形、文字和 3D 表面的实际写入区域。 |
| [src/render/source_hit.rs](../src/render/source_hit.rs) | 通过真正的源/原生 hitTest 协议确定指针目标。 |
| [src/render/source_layout.rs](../src/render/source_layout.rs) | 源 measure/arrange 协议的分片布局驱动器。自底向上的测量与自顶向下的安排共享一个只读 VM 调用域。 |
| [src/render/source_paint.rs](../src/render/source_paint.rs) | 执行源 paint 覆盖并解码受检查的 PaintCommand。 |
| [src/render/text.rs](../src/render/text.rs) | 统一字体发现、文字整形、测量与抗锯齿字形绘制。 |
| [src/render/viewport.rs](../src/render/viewport.rs) | 独立 2D 相机与可逆投影。视口尺寸属于布局;平移、缩放属于视图,不改变世界对象的逻辑位置。 |
| [src/render/viewport/spatial.rs](../src/render/viewport/spatial.rs) | 有界屏幕网格,用来减少普通二维命中和相机目标查询的候选。 |
| [src/runtime/api.rs](../src/runtime/api.rs) | 本机 HTTP API 入口:路由请求、限制输入大小、观察活动,并将执行工作送入串行 worker。 |
| [src/runtime/api/guide.rs](../src/runtime/api/guide.rs) | 从当前命名空间生成 /agent 使用指南。返回的示例、地址和版本描述来自运行时上下文;这里生成文档,不执行用户源码。 |
| [src/runtime/api/tests.rs](../src/runtime/api/tests.rs) | API 集成回归。通过实际本地 HTTP 请求检查队列、候选替换、状态码、版本和完整文档发布。 |
| [src/runtime/api/worker.rs](../src/runtime/api/worker.rs) | 唯一串行执行 VM 的 API worker。保留活跃运行时,另建 PUT 候选,并在候选完整成功后切换发布。 |
| [src/runtime/endor_host.rs](../src/runtime/endor_host.rs) | 把 Aster 编译/执行与 Tessera 展示生命周期连接起来。Candidate 拥有 VM 与宿主根,ReplSession 保留实际运行中的全局环境。 |
| [src/runtime/endor_host/tests.rs](../src/runtime/endor_host/tests.rs) | 说明全部运行时测试和辅助函数的场景/断言,并解释新主线性能基准的 DPI 分组、预热、三类计时边界和统计方式。 |
| [src/runtime/endor_script.rs](../src/runtime/endor_script.rs) | 区分完整 Module 与顶层 Script,并保留输入源码位置。 |
| [src/runtime/event_dispatch.rs](../src/runtime/event_dispatch.rs) | 托管事件与订阅的传播实现。Connection 持有回调引用,Event 保存目标、阶段与停止传播状态。 |
| [src/runtime/events.rs](../src/runtime/events.rs) | 原生窗口输入到执行 worker 的纯数据传输。Input 只含窗口/会话/版本/Mount 身份及有限坐标。 |
| [src/runtime/io_tasks.rs](../src/runtime/io_tasks.rs) | 后台文件/网络 provider。线程池只携带纯数据、取消控制与弱 Task 身份,不持有 VM。 |
| [src/runtime/mod.rs](../src/runtime/mod.rs) | 运行时模块入口。VM 生命周期、API、源程序组织、事件与异步任务在这里组合。 |
| [src/runtime/tasks.rs](../src/runtime/tasks.rs) | owner/key 管理的异步任务与协作式源函数调度。弱索引用于查找,回调、等待对象和协程帧是托管图中的真实边。 |
| [src/runtime/vm_sequence.rs](../src/runtime/vm_sequence.rs) | 构造共享 VM 调用序列与同帧循环驱动的字节码。 |
| [src/shell/activity.rs](../src/shell/activity.rs) | 有界 HTTP 活动记录。保存请求/响应的可显示预览供 Network 工具读取,不负责执行请求。 |
| [src/shell/app.rs](../src/shell/app.rs) | winit 原生应用生命周期和窗口事件入口。这里创建窗口、发布逻辑视口、转发输入,并把不可变文档画到原生表面。 |
| [src/shell/clipboard.rs](../src/shell/clipboard.rs) | 把 UTF-8 文本读写适配到当前平台的系统剪贴板命令。 |
| [src/shell/developer_tools.rs](../src/shell/developer_tools.rs) | Console/Sources/Network/Settings 的宿主交互协调与绘制状态。 |
| [src/shell/developer_tools/console.rs](../src/shell/developer_tools/console.rs) | 绘制 Console 输入、结果历史和对应命中区域。 |
| [src/shell/developer_tools/network.rs](../src/shell/developer_tools/network.rs) | 绘制已观察到的 HTTP 活动、请求列表与详情。 |
| [src/shell/developer_tools/painter.rs](../src/shell/developer_tools/painter.rs) | 开发工具画面的绘制辅助:文字行、按钮、分隔线和滚动条。 |
| [src/shell/developer_tools/selection.rs](../src/shell/developer_tools/selection.rs) | 多行文本选择和光标导航。选择端点映射到合法字符边界,避免把 UTF-8 字节中间当成一个字符。 |
| [src/shell/developer_tools/settings.rs](../src/shell/developer_tools/settings.rs) | 绘制宿主设置页面和主题选择区域。 |
| [src/shell/developer_tools/sources.rs](../src/shell/developer_tools/sources.rs) | 绘制 AST、当前源码快照和云文件视图。 |
| [src/shell/mod.rs](../src/shell/mod.rs) | 原生宿主模块入口。窗口、管理控件、系统适配和开发工具状态与用户业务界面分开维护。 |
| [src/shell/native_chrome.rs](../src/shell/native_chrome.rs) | macOS 原生标题栏适配。定位系统窗口按钮并沿用用户的标题栏双击设置。 |
| [src/shell/sidebar.rs](../src/shell/sidebar.rs) | 宿主管理工具和页面列表的唯一侧栏。展开时占据页面左侧空间,折叠后只保留展开按钮区域。 |
| [src/shell/sources.rs](../src/shell/sources.rs) | 云文件浏览的 provider 抽象与工作区状态。默认 provider 未连接,不假装已有外部文件。 |
| [src/shell/system_ui/interaction.rs](../src/shell/system_ui/interaction.rs) | 即时绘制控件的跨帧交互状态:稳定 WidgetId、悬停、按下捕获、键盘焦点和释放激活。 |
| [src/shell/system_ui/mod.rs](../src/shell/system_ui/mod.rs) | 宿主管理控件的共享组件入口。主题、绘制原语和跨帧交互状态分离,用户 Endor 页面不依赖这里的控件树。 |
| [src/shell/system_ui/theme.rs](../src/shell/system_ui/theme.rs) | 宿主控件的颜色与状态调色。根据背景、强调色和交互状态生成可读颜色,不改变业务状态。 |
| [src/shell/system_ui/widgets.rs](../src/shell/system_ui/widgets.rs) | 用统一主题绘制宿主管理控件,并同步注册交互目标。 |
| [src/shell/tabs.rs](../src/shell/tabs.rs) | 发布页面标签的数据结构。保留稳定页面身份、标题、选中状态和开发工具类别;页面的托管所有权由模型层管理。 |
## 其他文件
| 文件 | 本次改动及目的 |
| --- | --- |
| [src/bridge/ui_bridge/start_page.endor](../src/bridge/ui_bridge/start_page.endor) | 解释卡片源测量/背景、页面工厂、纵横布局与滚动组合、共享计数和场景位置,便于从真实 Endor 页面理解宿主边界。 |
| [scripts/build-macos-app.sh](../scripts/build-macos-app.sh) | 说明 macOS 构建环境前提、失败退出、锁定依赖、临时文件替换和 bundle 元数据,帮助理解每个打包步骤。 |
| [scripts/render-uml.mjs](../scripts/render-uml.mjs) | 说明独立文档依赖、DOM/Canvas 适配、错误图检查与 SVG/PNG 产物生成,避免混淆运行依赖与文档工具。 |
| [Cargo.toml](../Cargo.toml) | 解释每个依赖负责的能力、Aster 本地路径依赖、macOS 条件依赖与 release 优化配置。 |
| [docs/code-comments.md](code-comments.md) | 更新本逐文件说明、示例索引和实际核对方式,使本次注释范围与可验证结果对应。 |
## Endor 示例逐文件说明
每个示例的类、方法及关键逻辑旁增加中文说明。`page.endor` 和 `hello.endor` 被测试固定断言源码行号,因此使用行尾注释,保留原始行数;其余示例使用独立注释行,程序符号与字面量不变。
| 文件 | 注释解释的场景与目的 |
| --- | --- |
| [examples/async-file.endor](../examples/async-file.endor) | 异步 UTF-8 文件读取:在 Console 调用 reader.read(绝对路径),后台 provider 只交付文本,VM worker 执行业务回调。 |
| [examples/async-network.endor](../examples/async-network.endor) | 异步 HTTP(S) 文本 GET:Console 调用 fetcher.fetch(url),沿用 owner/key 替换、状态与成功回调协议。 |
| [examples/await-file.endor](../examples/await-file.endor) | 把 callback-free 文件 Task 与 ui.spawn 协作函数组合:await 保存执行位置,等待完成后继续,不阻塞 VM worker。 |
| [examples/box-layout.endor](../examples/box-layout.endor) | 盒模型组合:容器与 Page/相机独立,border-box 尺寸、padding、margin 和对齐分别参与布局。 |
| [examples/campus-lms.endor](../examples/campus-lms.endor) | 多页面校园演示:七个普通托管 Page 共享 CampusCourse/CampusWork 业务对象,所有课程与学生数据均虚构。 |
| [examples/classes.endor](../examples/classes.endor) | 普通源类继承示例:GUI 点击执行继承的 activate,内部 self.change 再动态分派到 DemoCounter 覆盖。 |
| [examples/constructor-contracts.endor](../examples/constructor-contracts.endor) | 构造器分段示例:原生可选参数/可变子项与源子类新增字段分别验证。 |
| [examples/cooperative-tasks.endor](../examples/cooperative-tasks.endor) | 协作任务示例:两个 ui.spawn 各自保留执行帧,worker 按指令量子轮转推进。 |
| [examples/events.endor](../examples/events.endor) | 同一托管对象系统中的事件阶段:祖先 capture → 目标 onEvent → 目标监听器 → 祖先 bubble。 |
| [examples/exit-lifecycle.endor](../examples/exit-lifecycle.endor) | 正常退出与多窗口卸载示例:同一 ExitText 出现在两窗,onUnmount 按出现位置分别调用。 |
| [examples/field-contracts.endor](../examples/field-contracts.endor) | 字段类型契约示例:CounterText 同时有原生文本载荷和源 Number 字段。 |
| [examples/flex-constraints.endor](../examples/flex-constraints.endor) | flexBasis/flexMin/flexMax/flexShrink 约束同一主轴分配。 |
| [examples/flex.endor](../examples/flex.endor) | 按 flex 权重分配有限主轴空间:固定项先占自然尺寸,剩余空间按正权重划分。 |
| [examples/fonts.endor](../examples/fonts.endor) | 字体测量示例:中英文混排、重音字符和不同字宽均走系统字体塑形与回退。 |
| [examples/function-types.endor](../examples/function-types.endor) | Function 与 Type 的契约示例:源函数、原生函数与绑定方法都可作为函数值,类型构造器保持 Type 身份。 |
| [examples/gc-lifecycle.endor](../examples/gc-lifecycle.endor) | 托管对象循环与等待帧回收:先记 ui.stats().objects,再调用 mountCycle,观察 phase 与 pending.value.status()。 |
| [examples/global-dependencies.endor](../examples/global-dependencies.endor) | 全局名称依赖示例:paint 读取 color 这个具体名字,而非依赖整个 globals 字典版本。 |
| [examples/hello.endor](../examples/hello.endor) | 解释辅助 heading、兼容 main 入口、局部业务引用和原生布局,保留源码位置夹具。 |
| [examples/layout-cache.endor](../examples/layout-cache.endor) | 测量与绘制依赖分离:改颜色应复用尺寸缓存,改模型宽度才需要重新测量。 |
| [examples/layout-negotiation.endor](../examples/layout-negotiation.endor) | 测量/排列协商示例:arrange 指定子宽后需重新换行测量,高度变化继续影响父容器和后继位置,直到整树稳定。 |
| [examples/main.endor](../examples/main.endor) | 与 page.endor 等价的 main 返回根入口:用于对比顶层显式 render 和兼容模块入口的绘图结果。 |
| [examples/managed-types.endor](../examples/managed-types.endor) | 托管名义类型入门:ui 构造器与 TextBlock/Button/Page 返回同一套 VM 托管对象。 |
| [examples/method-contracts.endor](../examples/method-contracts.endor) | 方法覆盖遵守参数可更宽、返回可更具体的规则。 |
| [examples/mount-lifecycle.endor](../examples/mount-lifecycle.endor) | 业务对象与出现位置生命周期分离:同一 child 在根中出现两次,每次都获得独立 Mount 和通知。 |
| [examples/native-signatures.endor](../examples/native-signatures.endor) | 原生回调也发布 Function 签名:state.set 接收一个 Event,increment 接收零参数。 |
| [examples/native-subclasses.endor](../examples/native-subclasses.endor) | 源类继承原生视觉类型:原生载荷负责基础绘制,新增字段和覆盖方法由源类提供。 |
| [examples/owned-tasks.endor](../examples/owned-tasks.endor) | owner 作用域决定取消时机:Page 关闭会取消其任务,隐藏 Block 和 ui 的任务可继续。 |
| [examples/page.endor](../examples/page.endor) | 解释顶层脚本创建文字/矩形、Page 与 render 的关系,保留四行结构树夹具。 |
| [examples/presentable.endor](../examples/presentable.endor) | 普通业务对象显式实现 Presentable 后,ui.present 可调用其 present(window) 生成视觉对象。 |
| [examples/property-bindings.endor](../examples/property-bindings.endor) | 通用属性绑定:业务 Model 的三个零参只读方法分别计算 rect.width、rect.color 和 label.text。 |
| [examples/scene-viewports.endor](../examples/scene-viewports.endor) | 一个二维世界可被多个有限视口观察,Scene2D 的对象位置共享,默认 Camera2D 各自独立。 |
| [examples/scene3d.endor](../examples/scene3d.endor) | 同一 Scene3D 在透视/正交视口中展示;相机控制独立,网格业务变换由两边共享。 |
| [examples/scroll-axis.endor](../examples/scroll-axis.endor) | 滚动轴策略影响可滚动方向与内容测量约束:vertical 限宽并允许长高,horizontal 允许横向展开。 |
| [examples/scroll.endor](../examples/scroll.endor) | 同一 ScrollBlock 在两个原生窗口中展示:内容业务对象共享,滚动偏移按 Mount 独立保存。 |
| [examples/source-hit.endor](../examples/source-hit.endor) | 自定义形状命中:对象原始矩形宽 160,但 paint 只画左侧直径 80 的圆,hitTest 也只接受圆内。 |
| [examples/source-layout.endor](../examples/source-layout.endor) | 源视觉协议的最小组合:measure 决定尺寸,arrange 决定子项位置,Metrics 是被两者读取的业务模型。 |
| [examples/source-paint.endor](../examples/source-paint.endor) | 源 paint 产出真正进入窗口的 DisplayList;允许构造并修改本次计算的新命令,禁止改已有业务对象。 |
| [examples/student-grades.endor](../examples/student-grades.endor) | 学生成绩中心为纯内存演示,记录均虚构,不连接学校数据库。 |
| [examples/tab-placement.endor](../examples/tab-placement.endor) | 页面位置与子项插入的代码示例:Page 方法覆盖计数,Container.insert 在指定位置创建稳定子槽。 |
| [examples/tabs.endor](../examples/tabs.endor) | 代码与原生侧栏都操作真实 Page 对象;activate/close/open 改变展示关系,业务对象可继续被全局引用保留。 |
| [examples/visual-protocols.endor](../examples/visual-protocols.endor) | 原生视觉协议直接返回托管数据:Constraints/MeasureResult、Bounds/Arrangement 和 DisplayList 都可在源码中查询。 |
| [examples/window.endor](../examples/window.endor) | 托管 Window 资源与原生窗口相连:源码排出 resize/title 命令,成功刷新后由 GUI 线程执行。 |
| [examples/windows.endor](../examples/windows.endor) | 两个原生窗口共用一个 Aster VM 和 count 业务对象,各自拥有独立 Page 与 Mount。 |
| [examples/workspace.endor](../examples/workspace.endor) | 静态工作台组合示例:所有指标、进度与活动记录均为演示数据,不读取任务系统或网络。 |
| [examples/world-ui.endor](../examples/world-ui.endor) | 世界空间 UI:普通 Endor 树先在独立 UI 分辨率中布局/绘制,再作为 Panel3D 平面的纹理参与三维深度。 |
| [examples/wrapped-text.endor](../examples/wrapped-text.endor) | 多窗口共享长段落:同一文字对象在每个 Mount 按当前宽度独立换行,后继位置跟随实际高度。 |
## 核对方式与边界
- 与本次分支起点及最新主线比较,逐文件核对移除注释后的文本;Rust/Endor 另做词法扫描,完整保留字符串/原始字符串内容,确认新增说明没有进入程序字面量。
- 使用 rustfmt 的 `--emit stdout`、`skip_children=true` 逐文件做 Rust 语法解析,丢弃输出,不格式化文件、不运行 Cargo、不生成编译产物。
- 对工具脚本使用 `node --check` 和 `sh -n`,只检查语法,不执行渲染、构建或打包;Cargo 配置另以 TOML 解析核对。
- 检查固定行号的示例夹具、测试依赖的源码替换片段和 `git diff --check`。这些检查能证明注释外代码保持一致及语法可解析,不能替代运行时回归结果。
- 本次未执行编译、GUI 回归、Clippy 或 rustdoc;需要构建的验证应在用户已确认的远程 runner 上运行,不能把未执行步骤写成通过。实际交付结果记录在 PR 中。
+111
View File
@@ -0,0 +1,111 @@
# Endor 脚本:龙与文字实时绕排
完整程序:[examples/illustrated-manuscript.endor](../examples/illustrated-manuscript.endor)。它通过普通 Page、源 measure/paint、托管事件及 owner-scoped Task 工作。Tessera 没有 Dragon / Flame / Manuscript 专用 Rust 类型、专用启动参数或动画循环;Rust 只补齐可被其他脚本复用的图形与文字能力。
## 运行
在仓库根目录启动普通应用:
```sh
cargo run --release --locked
```
另开终端,在同一个仓库根目录提交原始 Endor 文件:
```sh
curl --request PUT --header 'Content-Type: text/plain; charset=utf-8' \
--data-binary @examples/illustrated-manuscript.endor \
http://127.0.0.1:4737/v1/namespaces/app.main/code
```
这是普通源码提交,没有预编译场景或原生替身。资源路径目前相对于应用工作目录;通过以上根目录启动方式使用 `examples/assets/manuscript/`。从其他目录启动时,修改脚本的 `assets` 路径为绝对路径。图片、字体、正文都在示例目录,不编入宿主。素材与字体许可见 [NOTICE](../examples/assets/manuscript/NOTICE.md)。
移动鼠标让龙跟随,按住左键喷火,松开停止。离开窗口、取消指针或失焦也会停止喷火。空闲两秒回到卷曲姿势。原生窗口缩放触发普通布局和 paint;窄窗口切换到脚本预备的小字号。关闭 Page 会取消其定时任务,不留下应用级动画循环。
## 脚本对象分工
| 对象 | 状态与责任 |
| --- | --- |
| `Segment` | 一节身体的位置、角度及共享图片引用 |
| `FireArt` | 一张火焰图及其原始轴角;这些校准值是示例素材数据 |
| `Flame` | 一个粒子的位置、速度、尺寸、年龄及 FireArt 引用 |
| `Dragon` | 身体链、火焰集合、目标点、输入状态、时钟样本和随机种子;实现追随、恢复、生成/更新/删除粒子及绘图描述 |
| `Manuscript : RectBlock` | 普通视觉子类;组合预处理文字、首字母图片、龙和 Page,覆盖 measure/paint,通过 onMount/onUnmount 管理 Task |
| `Page` / `Task` / `Event` / `Mount` | 沿用 Tessera 已有托管体系:Page 是任务 owner,Task 调用脚本 tick,Event 带局部指针位置,Mount 提供当前出现的几何 |
这些是同一 VM 中的普通对象与引用。身体并不是多个重量远程 actor;图片被多个出现/粒子共享,临时 PaintCommand 只描述本帧绘制。
## 从输入到一帧
1. `view.on("pointermove", dragon.pointer)` 显式订阅连续输入。宿主把原生指针转换成 Event,再交给普通传播链;脚本读取 `event.mount.bounds()`,将目标点换算到自己的 700 单位画布。按下/松开只改变脚本 `pressed`。
2. `onMount` 用 `ui.after(page,"animation",80,self.tick)` 创建 Page 所有的任务。`tick` 调用脚本 `Dragon.step()`,再安排下一个任务。80 ms 是脚本参数;宿主不知道这是龙的动画。
3. `step` 先采样通用单调时钟。头向目标移动,其余 19 节依次跟随上一节,保持间距 30,并把相邻转角差限制在 ±0.25 弧度。空闲时由脚本计算卷曲目标并插值回去。
4. 粒子在脚本中更新位置、速度与年龄,倒序删除超过 12 步的粒子。每步最多产生 1 个、总数最多 12 个,最长边仅 12–20 个画布单位。随机变化由脚本自己的确定性种子和数学函数产生。
5. 普通属性变更使源 paint 的已观察依赖失效。`paint` 从当前几何生成图像绘制命令,再由脚本选择哪些图片形成避让区,交给通用文字流布局。
6. 正常文字使用缓存整词形状;喷火时脚本请求字素粒度,并在 `heat` 中按粒子距离修改临时文字命令的位置、角度、透明度和颜色。没有把热力规则藏进宿主。
7. 返回的 DisplayList 经过现有只读 paint 校验、Frame 发布和 CPU 栅格化,在普通窗口中呈现。VM 对象不进入窗口线程。
paint 内创建/修改的是临时返回对象,不能写已有龙状态或读取文件/时钟。资源加载、时钟采样和状态更新发生在初始化、事件或任务中。
## 绕排与预处理
脚本初始化时用 `prepareText` 准备两套正文和提示文字。字体/字号/行高/颜色/设备分辨率属于准备参数;每帧只传新几何与避让区,复用字形形状和透明图像。
`Dragon.artwork` 返回普通图像命令。脚本循环调用通用 `imageExclusion(command,padding)`,由图片 alpha 轮廓产生保守凸包,并给首字母添加矩形避让。`flowText` 对整个行带求交、合并遮挡区间,再依次填充剩余的左右片段;同一个文字 cursor 跨片段继续,不复制或跳过词。单词装不下所有可用片段时才退回字素边界。
当前提供面向本示例的从左到右文字流,不声称完整支持所有文字系统的双向段落。字素绘制会改变部分字偶距;这是喷火效果的取舍。正文超出当前页的部分留在准备数据中,当前示例保持单页,未增加滚动文档业务。
## 火焰角度与尺寸
火焰 PNG 自身方向各不相同;把它们一律当作朝右图片会错位。脚本在 `FireArt.axis` 中记录每张图片原始轴角,绘制时使用:
```endor
image = p.art.image
imageScale = p.size * scale / math.max(image.width, image.height)
angle = math.atan2(p.vy, p.vx) - p.art.axis
drawing = sprite(image, ox + p.x * scale, oy + p.y * scale, imageScale, angle, 0.5, 0.5)
```
角度以弧度表示,在屏幕坐标中正方向为顺时针;原始素材校准值与 PNG 一起属于应用数据。尺寸按最长边归一化,窄高的 PNG 不会因宽度较小而放大。舌头同样通过局部 anchor 定位,使其偏移随头部一起旋转。
## 可复用宿主接口
入口是 `g = ui.graphics`,数学入口是 `g.math`。宿主实现位于 `src/bridge/graphics.rs`、`src/render/image.rs` 和 `src/render/text_flow.rs`。
| 方法 | 行为 |
| --- | --- |
| `loadImage(path)` | 读取有界普通 PNG 文件,返回共享不可变资源及 width/height |
| `loadFont(path,family)` | 注册开放字体,验证指定 family;相同资源复用,冲突不替换既有字体 |
| `readText(path)` / `textSlice(text,start,end)` / `string(value)` | 初始化用有界 UTF-8 资源读取、按字符切片及标量文本转换 |
| `prepareText(text,font,size,lineHeight,color,rasterScale)` | 生成与障碍无关的缓存文字资源 |
| `sprite(image,x,y,width,height,angle,anchorX,anchorY,opacity)` | 返回普通 PaintCommand;旋转围绕原点,anchor 决定图片局部偏移 |
| `imageExclusion(command,padding)` | 图像实际 alpha 轮廓的保守凸包,应用该命令的平移、缩放与旋转 |
| `circleExclusion(x,y,r)` / `rectExclusion(x,y,w,h)` | 通用几何避让区 |
| `flowText(prepared,x,y,w,h,exclusions,letterMode)` | 生成可检查/修改的普通文字图像命令列表 |
| `math.float/sin/cos/sqrt/atan2/abs/min/max/clamp/floor/now` | 通用实数与图形数学;float 是显式二进制浮点入口,now 仅在事件/任务中采样 |
| `ObjectList.append/remove/extend/added` | 通用托管集合编辑/批量追加/持久添加;paint 只能编辑本次创建的临时集合 |
PNG 单张最多 4M 像素,文件最多 4 MiB;准备文字最多 16 KiB、缓存最多 8M 像素;最多 512 个避让区、1024 行和 10000 条绘图命令。资源读取不允许在 paint/layout 中执行。图形边界显式窄化数字,源语言的精确数值表示不会被改写。
原生连续指针输入需显式订阅。生产端在有界队列中只合并相同窗口/session/目标的相邻绝对移动采样,按下/松开/取消及目标变化都是顺序边界。后台 relay 直接把内部 Input envelope 送进同一 VM worker 队列并等待完成,窗口线程不等待;不绕行 HTTP。worker 等既有刷新结束后才重验 Mount/session 并更新连续事件版本,避免动画发布新帧时丢掉移动或松开。外部 HTTP 无法创建内部 envelope,继续严格校验帧版本。
## Aster 语言扩展
为使上述逻辑留在源码中,独立 Aster 分支实现了真实四则运算、非字面量负号、六种比较、if/else 与 while,并同步 ASDL、AST 生成产物、名称分析、bytecode 验证与 VM。整数/十进制/有理数保持精确;有 BinaryFloat 操作数才选择浮点算术,混合数值比较避免大整数丢精度。循环沿用同一累计指令限制与协作暂停机制。不是在 Tessera 中解释另一个小语言。
## 验证与范围
```sh
cargo test --locked
cargo clippy --locked --all-targets -- -D warnings
cargo fmt --all -- --check
TESSERA_MANUSCRIPT_SNAPSHOTS=/absolute/output/path \
cargo test --release --locked manuscript_script_snapshots -- --nocapture
```
快照测试加载实际 Endor 文件,经 VM、事件、源 paint 和软件渲染器输出 endor-rest/crossing/fire/narrow 等 PNG。覆盖持续喷火达到上限、角度校准、最长边尺寸、字形呈现、宽窄窗口,以及任务确实调用脚本和关闭 Page 后停止。另一项集成测试验证指针驱动头部移动、取消与粒子回收。不是用 Rust 动画或手工绘图替代源码执行。
当前采用既有 CPU 后端;无 GPU 实现,也未达到稳定 60 FPS。参考本机 release 样本,16 次持续喷火的 VM 更新与完整 Frame 刷新约 1.4–1.5 秒(不含 OS 呈现),不能把 80 ms 定时参数当作实际帧率。性能结果属于脚本通路而非之前已移除的原生原型。
本次还补上了指针类型的 HTTP 白名单。最初只测 VM 分发遗漏了真实 worker 入口,随后通过真实 HTTP 回归复现并修复 `unsupported event kind`;动画期间的过期事件竞争则通过内部原生 envelope 解决。测试分别覆盖 HTTP 的坐标/类型/严格版本、原生 envelope 换帧后仍投递且旧会话不穿透,以及生产端合并不跨越按下/松开。最终运行窗口已由用户确认“持续正常,松开也正常”。系统自动事件投递/截图权限未开启,因此最终展示图来自实际脚本的 VM→Frame→软件渲染快照,原生交互验证来自用户操作。
Binary file not shown.
+83
View File
@@ -0,0 +1,83 @@
1
00:00:00,000 --> 00:00:02,658
01 定义课程和作业对象
2
00:00:02,658 --> 00:00:07,300
02 执行对象定义并建立界面组件
3
00:00:07,300 --> 00:00:11,921
03 实例化课程、共享作业和七个页面
4
00:00:11,921 --> 00:00:14,209
04 执行共享对象图
5
00:00:14,209 --> 00:00:18,392
05 构建仪表盘并渲染
6
00:00:18,392 --> 00:00:22,510
06 仪表盘渲染结果
7
00:00:22,510 --> 00:00:27,198
07 创建三个课程主页
8
00:00:27,198 --> 00:00:30,301
08 渲染课程页面
9
00:00:30,301 --> 00:00:35,238
09 创建作业中心
10
00:00:35,238 --> 00:00:37,881
10 作业中心渲染结果
11
00:00:37,881 --> 00:00:42,805
11 创建成绩总览
12
00:00:42,805 --> 00:00:45,432
12 成绩总览渲染结果
13
00:00:45,432 --> 00:00:50,363
13 绑定提交、评分与恢复事件
14
00:00:50,363 --> 00:00:53,514
14 全部页面完成
15
00:00:53,514 --> 00:00:56,070
15 打开实验并模拟提交
16
00:00:56,070 --> 00:00:57,930
16 提交后切到作业中心查看共享状态
17
00:00:57,930 --> 00:01:00,168
17 作业中心显示已提交
18
00:01:00,168 --> 00:01:02,952
18 应用示例评分
19
00:01:02,952 --> 00:01:06,054
19 成绩总览同步分数与反馈
20
00:01:06,054 --> 00:01:09,211
20 仪表盘同步课程总评
21
00:01:09,211 --> 00:01:12,278
21 课程主页同步进度与成绩
+59
View File
@@ -0,0 +1,59 @@
# Endorphin 页面空间与窗口边界
> 下文的 Page.mode 是前一阶段的兼容接口。当前默认页已迁移到普通 Page、Row/Column、滚动容器和独立 Scene2D / CanvasViewport / Camera2D。新代码请使用 [统一场景架构](scene-architecture.md),不要再把横纵排版或相机作为 Page 的固有模式。
本次按参考图的“左侧栏展开/收起”两种状态调整原生宿主。窗口保留系统关闭、最小化和缩放按钮;宿主管理入口集中在左侧栏。收起后只保留展开按钮及系统三键,页面从窗口左上角铺满,不再保留顶部标签条、左侧空轨或内容卡片边距。
页面内容、卡片、文字和操作按钮由 Endor 源码渲染。默认 [开始页](../src/bridge/ui_bridge/start_page.endor) 是真实的画布 Page,其操作创建另外三种 Page;不会把示例的静态截图当作可操作界面。
## 四种页面模式
| `page.mode` | 布局 | 浏览方式 |
| --- | --- | --- |
| `window`(默认) | 根 Page 等于可用区域,子组件按纵向流组织 | 应用自行安排内部布局或 ScrollBlock |
| `vertical` | 宽度跟随可用区域,高度至少一屏并随子组件增长 | 纵向滚动,偏移限制到内容范围 |
| `horizontal` | 高度跟随可用区域,宽度至少一屏并随子组件增长 | 横向滚动;普通纵向滚轮也可推进横向页面 |
| `canvas` | 直接子组件使用各自的 `x`、`y` 世界坐标 | 双向平移、缩放,视角不限制到内容边界 |
侧栏展开占用 256 个逻辑像素;收起归还全部宽度。`ui.viewport()`、`window.viewport()` 和 GET code 的 viewport headers 均报告实际可用页面区域。窗口变更重排同一个运行时,不重放源码。窗口模式保证根 Page 填满,但不会强迫每个子组件拉伸。
```endor
page = Page()
page.mode = "canvas"
page.title = "我的画布"
card = Button("一个真正的 Endor 组件")
card.x = -120
card.y = 90
page.render(card)
page.panX = -200
page.panY = 0
page.zoom = 1
```
`page.render(root)` 替换内容;`page.append(child)` 继续添加。直接画布子组件的 `x/y` 决定位置,内部 Row/Column 仍使用原来的流式布局;纵向、横向和窗口页面不使用子组件的 `x/y` 排列。共享 Block 可以有多个 Mount,不会为画布复制业务对象。
## 交互与坐标
- 滚轮或触控板平移;嵌套 ScrollBlock 优先处理其可滚动方向。
- 画布支持空格+左键拖动、鼠标中键拖动;已有按钮键盘焦点保留 Space 激活。
- 画布支持捏合、Cmd/Ctrl+滚轮缩放,以指针位置为锚点。
- Cmd/Ctrl+B 展开/收起侧栏;侧栏提供新建、切换和关闭页面及四个开发工具入口。
- Cmd/Ctrl+T 新建,Cmd/Ctrl+W 关闭,Ctrl+Tab / Ctrl+Shift+Tab 切换页面。
`panX/panY` 是可视区域左上角的世界坐标,`zoom` 为 0.1–4。变换是 `screen = (world - pan) * zoom`;绘制使用正变换,原生点击/滚动使用逆变换。VM 中 Mount 始终使用世界坐标,worker 根据同一视角重新检查可见性。Page 自己保存视角,切换后仍保留;有限页面在内容缩短或窗口变大时限制偏移。
画布没有内容边界裁剪,但保留现有运行预算:坐标为有限数且绝对值不超过 1,000,000,维度、对象数和绘制命令数仍有上限。“无限”指可以向内容以外导航,不代表无限内存或数值范围。
原生相机事件 `page-pan/page-zoom` 经过真实 HTTP worker,再由所属 VM 更新 Page;它们使用 `mount=0` 和当前 window/session/layout_version。平移 delta 使用可视区域像素;缩放 delta 为 `[factor,0]`,point 是可视区域内的锚点。普通点击与嵌套滚动的 point 使用世界坐标。过期事件返回 409;不适用于当前模式或参数非法的相机事件在执行前拒绝。
## 实现位置与验证边界
- [page.rs](../src/render/page.rs):模式约束、视角、正逆坐标变换和有限页面偏移限制。
- [sidebar.rs](../src/shell/sidebar.rs):唯一宿主管理栏及折叠后点击遮挡范围。
- [page_input.rs](../src/bridge/ui_bridge/page_input.rs):串行 VM 内的视角变更。
- [API 回归](../src/runtime/api/tests.rs):真实 HTTP 平移、指针锚定缩放、负世界坐标点击、过期/非法事件。
- [宿主回归](../src/runtime/endor_host/tests.rs):四种模式、实时内容增长、共享对象坐标、视角恢复和默认页真实按钮。
本地格式、153 项测试和 all-target Clippy 均通过;release app 已构建并实际启动。运行中平移与缩放事件返回 200,并读回 Page.panX=80、Page.zoom=2,随后恢复初始视角。最初 HTTP worker 漏接相机事件导致 400,现由完整链路回归覆盖。
macOS 当前未授予本次工具模拟输入和窗口截图权限。模拟滚轮未生效,无法据此声称真实鼠标/触控板、捏合或窗口外观验收通过。侧栏指针拖放、跨窗口拖放尚未迁移;原有 `moveTab/moveToWindow/detachToWindow` 与版本校验的 API 保留。没有修改 Aster 或引入新的 GUI/语言依赖。
+63
View File
@@ -0,0 +1,63 @@
# 场景交互性能研究
## 结论
性能问题有可验证的解决路径,但单改 Aster 字典不能让当前世界 UI 达到稳定 60 FPS。本 PR 交付可重复基准和研究记录;去除字符串键比较临时分配的改动仍在独立 Aster 分支,未随本 PR 集成;面板纹理缓存实验因当前示例收益不足而撤回。没有实现 GPU 后端或宣称完成性能目标。
## 方法
在 Apple M4 Pro、macOS 15.6 本机使用 release 构建,固定 1024×800 逻辑视口、1× / 2× 像素比例,分别加载 world-ui 和 scene3d 示例。每组执行 33 次真实 scene-orbit 运行时分发,前 3 次作为预热,统计后 30 次的均值、P50、P95。每次先测分发到文档更新,再测变化后的软件绘制,最后测相同显示列表的缓存绘制。没有运行 Console 编译来代替原生事件。
```sh
cargo test --release --locked scene_interaction_performance -- --ignored --nocapture --test-threads=1
```
这是无窗口的运行时与软件渲染基准,包含回调、快照、布局和运行时收尾,但不包含本地 HTTP、OS 事件排队、窗口呈现或输入到显示延迟。阶段耗时不能简单当作实测 FPS。时间是本机样本,不是跨设备保证;基准默认 ignored,普通回归不以绝对耗时断言通过。
## 对照结果
世界 UI、2× 像素比例,单位 ms:
| 条件 | 更新均值 | 更新 P95 | 变化绘制均值 | 变化绘制 P95 |
| --- | ---: | ---: | ---: | ---: |
| 原始 Aster | 8.456 | 8.843 | 18.704 | 20.742 |
| 借用字符串键比较 | 6.842 | 7.226 | 18.598 | 20.665 |
| 再加面板纹理缓存实验 | 6.823 | 7.053 | 18.410 | 20.482 |
去掉字符串键比较的分配后,本组更新均值减少约 19%,绘制基本不变。面板缓存的绘制收益约 1%,不足以证明值得在本次增加缓存与失效复杂度,因此撤回。
作为对照,普通 scene3d 示例在 2× 下更新约 0.94 ms、变化绘制约 6.15 ms;它的视口尺寸、覆盖像素和 UI 复杂度不同,不能据此把两个示例的全部差值都归给某一层。
## Aster 发现与保留的修改
`EndorDictObject` 用插入有序的数组存储,`dict_position` 逐项调用 `key_equal`。原实现每次比较都会把内联文本或托管 String 转成新的 String;查找名称时会重复分配和复制候选键。
本次只改为借用字符串切片比较。保留线性查找、原 key_equal 分支、对象检查、只读依赖观察、键的插入身份与顺序、写入验证和引用计数流程。新增测试覆盖空文本、普通文本、Unicode、托管 / 内联字符串等价替换、删除和引用释放。
没有把通用字典直接改成 HashMap,也没有绕过 heap.replace_payload 的事务性边验证。前者还需处理托管键相等 / 哈希与顺序语义;后者涉及 GC、失败原子性和只读保护。它们不属于本次已经证明安全的改动。
## 尚未解决的主要成本
1. 世界 UI 的摄像机变化后,当前统计仍为 measured=8、arranged=88;普通 3D 为 measured=0、arranged=14。数据证明相机更新没有彻底绕开排版。
2. 3D 变化帧仍在窗口线程逐像素进行 CPU 绘制。当前世界 UI 的绘制本身已超过 60 Hz 的 16.7 ms 预算,其他 CPU 优化不能消除这个事实。
3. 原生连续输入仍逐项经本地 HTTP 发送,有界队列不等于按显示帧合并;真实排队和呈现延迟需要另外测量。
## 后续实施顺序与条件
1. **相机更新专用路径。** 复用已有 Mount 几何、UI 排版和绘制结果,仅更新视图 / 投影、可见性和命中映射。必须检查源 measure / arrange / paint 的实际读取依赖;源函数若读取相机,应继续正确失效。不能无条件跳过所有布局或绘制。验收:不依赖相机的 UI 在旋转时零测量、零重新排版,依赖相机的源协议回归仍通过。
2. **按帧收集连续输入。** 原生操作直接进入进程内通道,连续手势按捕获会话 / 目标与顺序合并;点击、页面切换和运行时替换保持边界。外部 HTTP API 保留严格版本校验。验收包括缩放锚点、非交换手势顺序、嵌套捕获与过期会话,不能只检查最终数值。
3. **GPU 合成与独立渲染。** 现有不可变网格、变换、相机、深度和 UV 数据可以成为渲染输入;VM 对象留在运行时线程。GPU 应直接向窗口表面呈现,同时合成 2D / 3D 内容,避免每帧 GPU→CPU 回读后再交给 softbuffer。跨线程队列只保留最新可呈现快照;纹理、缓冲与缓存均需资源预算和正确失效。
建议验收目标:固定示例 2× 下相机更新 P95 ≤2 ms、GPU 绘制 P95 ≤8 ms,另外记录真实窗口的帧间隔和输入到呈现延迟。目标尚未达到,也没有用无窗口基准宣称原生 60 FPS。
## 检查说明
Aster 全工作区测试发现 compiler 的 classes 测试中两项解析失败(第三行 expected EOF),以及 core 的 managed_coroutine_hard_budget_accumulates_and_error_releases_frames 指令预算失败。将对象实现恢复为未优化的基线后,这三项失败均能复现,说明不是本次借用字符串比较引入;不把全工作区标为全绿。对象层测试通过,Aster 全工作区 Clippy / 格式通过;GUI 为 186 项通过、1 项默认忽略的基准,GUI Clippy / 格式通过。该基准已经另行在 release 模式实际执行。
本次没有修改用户指向的 builtins.rs 第 176 行(该处是函数对象定义)。实际热路径修改位于 Aster 的 store_builtins.rs。
## PR #6 主线兼容修复
2026-11-12:合入最新 GUI main,保留 main 的 Aster f3e1670,而非旧性能分支 fd247ac。旧引用缺少 GUI 目前使用的精确读取依赖接口,不能为性能实验回退。上文数值是原有实验记录,不代表当前主线已经采用借用键优化。本 PR 的最终差异仅包括本研究记录和默认 ignored 的基准;Aster 优化需单独更新其分支并审阅后再集成。PR 标题中的 WIP 将移除,交付范围为可运行基准,不承诺上述后续性能目标。
本次兼容修复检查:GUI `cargo test --locked` 为 186 passed / 1 ignored;Clippy(全部 target,警告视为错误)、格式和差异空白检查通过。最初沙箱内 9 项 HTTP 测试因不能监听本地端口失败;允许回环网络后全套重跑通过。本次未重跑历史 release 性能采样,也未修改 Aster。
+109
View File
@@ -0,0 +1,109 @@
# UI、场景、视口与摄像机
本次完整实现目标的持续记录。完成布局并不等于完成场景或原生交互验收。
## 边界
- Page 负责页面身份、生命周期和根内容。Row、Column、Overlay 负责有限盒子内的排版。
- Scene2D、Scene3D 管理世界对象。世界不是一个无限宽高的布局盒子。
- CanvasViewport、Viewport3D 是有限的 UI 盒子,可以加入 Row、Column、Overlay,也可以放进世界内的有限 UI 面板。
- Camera2D、透视和正交摄像机是显式对象。视口保存自己的尺寸、裁剪和投影比例;共享场景不隐式共享摄像机。
- 摄像机控制器独立于摄像机数据。移动相机只改变投影、可见性和命中坐标,不应重新排版无关内容。
- 视口覆盖 UI 不随世界移动。世界内 UI 面板拥有有限大小,使用普通布局,再由对应的世界变换呈现。
- 嵌套视口的输入逐级逆变换,尊重裁剪和捕获;同一手势不能同时驱动内外相机。
- 无限导航受数值、可见对象、递归、内存和绘制预算约束;引用环必须在发布部分结果前拒绝。
## 当前实现状态
| 阶段 | 状态 | 证据 / 剩余工作 |
| --- | --- | --- |
| 基线审查 | 完成 | 保留共享 Block / 独立 Mount、源协议和已合并工作区示例 |
| 嵌套布局与盒模型 | 完成 | Row / Column / Overlay、双轴对齐、子项覆盖、外边距、非对称内边距和边框、尺寸策略、裁剪;见下面接口 |
| 独立 2D 场景与视口 | 完成 | 独立场景/摄像机、多视口及嵌套、覆盖 UI、投影/命中、原生输入路由、真实 HTTP 与像素回归;旧 Page.mode 仅保留兼容 |
| 3D 场景、视口和摄像机 | 完成 | 软件深度缓冲、网格/变换/灯光、透视/正交相机、可替换控制器、射线拾取、世界空间 UI 及 2D/3D 嵌套 |
| 可见性与资源防护 | 完成 | 2D 屏幕索引、3D BVH / 视锥剔除、场景缓存、连续原生事件版本更新、字形 LOD 和嵌套资源预算 |
| 原生综合验收 | 可取得检查完成 | release 构建与实际窗口截图,运行实例的按钮 / 旋转 / 缩放事件及过期拒绝均通过;系统不允许模拟鼠标,未冒充硬件验收 |
| 完成交付 | 已提交可评审 PR | [PR #5](https://gitea.entroia.com/Zayden-Jung/endorphin-tessera-gui/pulls/5) 已移除 Draft,Gitea 返回 mergeable=true;等待用户手动合并 |
## 有限盒子的接口
现有 `Row(padding, gap, children...)`、`Column(padding, gap, children...)` 保留,新增 `Overlay(padding, gap, children...)`。Overlay 为构造协议兼容保留 gap 参数,但叠放不使用 gap;子项顺序决定绘制和命中顺序。
- `mainAlign`: `start`、`center`、`end`、`space-between`。Overlay 对应横向对齐,不使用 space-between 分散规则。
- `crossAlign`: `start`、`center`、`end`、`stretch`。Row 对应纵向;Column 对应横向。Overlay 对应纵向。
- `alignSelf`: `auto` 继承所在父容器的 crossAlign,或以上交叉轴选项。属性在对象上,每个 Mount 根据自己的父容器解释。
- `marginTop/Right/Bottom/Left`: 外边距参与父容器的测量、主轴分配和对齐。不折叠外边距,不支持负外边距。
- `paddingTop/Right/Bottom/Left`: 数值覆盖对应边;`auto` 回退到构造参数或容器的 padding 属性。非容器回退为 0。
- `borderTop/Right/Bottom/Left` 和 `borderColor`: 边框占据 border box 内侧,压缩内容空间。原生绘制产生实心直角边框;自定义 paint 可调用基类绘制,也可自行提供完整外观。
- `boxWidth/boxHeight`: `auto`、非负数值或 `fill`。保留 RectBlock / ScrollBlock 原有 width/height 和源子类字段语义,通用盒尺寸使用独立名称。数值表示 border box,不包含外边距。
- `minWidth/minHeight/maxWidth/maxHeight`: 盒尺寸边界,最低值不得超过最高值。父分配小于最低值时,外部有限约束仍然生效。
- 主轴 `fill` 使用零基准分享剩余空间;未显式设置 flex 时权重为 1。最大值饱和后,剩余空间继续分给其他项目。交叉轴 fill 使用父容器提供的有限内容尺寸。没有有限父分配的 fill 报错。
- `stretch` 仅拉伸交叉轴 auto 尺寸,遵守盒尺寸边界;数值固定尺寸保留。显式源 arrange 返回的布局始终优先。
- `overflow`: `visible` 或 `clip`;后者同时裁剪后代绘制和指针命中。需要滚动时使用 ScrollBlock,滚动轴与内层 Row/Column 排版独立。
尺寸、边距和边框必须有限、非负,受现有 1000000 上限限制。根约束、每个 Mount 的偏好尺寸、分配、收敛判定及源协议缓存均保持独立。示例见 [box-layout.endor](../examples/box-layout.endor)。
布局阶段验证:本地 `cargo test --locked` 的 162 项回归全部通过,`cargo clippy --all-targets --locked -- -D warnings`、格式与差异空白检查通过。新增用例执行实际 Endor 脚本,覆盖共享对象在不同父容器中的对齐、实时边距变更、flex 分配、叠放、尺寸边界、文本换行、有限 fill、无界 fill 拒绝、源 arrange 优先、裁剪命中和可运行示例。本阶段尚未重新打包或进行原生指针验收。
## 2D 场景与视口
`Scene2D(children...)` 持有世界内容。直接子项的 x/y 是世界位置;Row/Column/Overlay 仍然只解释自己的有限内容布局。给世界内卡片设置 boxWidth,即可在其内部换行和嵌套排版。
`CanvasViewport(width, height, scene)` 是可参加普通排版的有限盒子,世界范围不参与它的本征尺寸。视口可使用通用盒模型尺寸、边框、内边距和 flex。每个新建视口拥有自己的 `Camera2D()`;显式赋值 `second.camera = first.camera` 才会共享视角。摄像机 x/y 是可视内容左上角的世界位置,zoom 范围 0.01–100;也可以 `Camera2D(x, y, zoom)` 创建。嵌套投影还受合成变换预算限制。
视口的有限内容框裁剪世界绘制和输入,Overlay 中的兄弟 UI 保持固定。场景内可以放另一个 CanvasViewport:布局坐标不变,投影逐层合成,指针逆变换至目标组件坐标。相机改变时复用不变的测量结果。`view.mounts().at(index).fitView()` 使用指定 Mount 的有限尺寸及场景直接子项的有限边界适配摄像机,不把无限世界当作排版边界。
滚轮优先交给命中的可滚动 ScrollView;其余平移交给最内层画布。空格加左键或中键拖动锁定开始时的视口,不因指针跨到另一个视口而切换相机;捏合及 Cmd/Ctrl+滚轮围绕指针缩放。`viewport-pan` / `viewport-zoom` 使用真实 Mount 身份及帧版本,通过 HTTP worker 串行修改所属 VM 的摄像机。非法缩放锚点在进入 VM 前拒绝,过期帧返回 409。
`ScrollView` 是现有 ScrollBlock 的名义子类型别名,滚动轴和其内容 Row/Column 排版独立。默认开始页已使用普通 Page + 独立场景/视口,纵横示例使用 ScrollView 对应的滚动容器组合;不再设置 Page.mode。原有 Page.mode/panX/panY/zoom 暂保留兼容旧脚本,不用于新架构示例。
示例见 [scene-viewports.endor](../examples/scene-viewports.endor)。回归包含两个视口共享同一业务对象、显式共享相机、嵌套变换、真实点击回调、相机修改时测量数为 0、真实 HTTP 链路及软件渲染像素中的缩放/裁剪。它们不能替代原生鼠标和触控板验收。
2D 阶段最终验证:169 项本地回归全部通过,all-target Clippy 拒绝 warnings 通过,编辑器未报告错误。默认页的真实按钮事件也已迁移验证。未将原生窗口验收记为完成。
## 3D 基础接口与当前边界
- `Scene3D(nodes...)` 管理世界对象;`Group3D(nodes...)` 组合变换。`children` 是 ObjectList,可显式替换;共享节点可以出现多次,路径循环会拒绝。
- `Box3D(width,height,depth,color)` 创建网格;`Geometry3D(ObjectList(Vec3(...),...), ObjectList(Triangle3D(a,b,c),...))` 创建不可变顶点/索引缓冲,再用 `Mesh3D(geometry,color)` 实例化。可替换 mesh.geometry;修改原输入 Vec3 不会改写已建立的不可变几何。
- 网格/组有 x/y/z、rotationX/Y/Z(角度)、scaleX/Y/Z;局部缩放、X/Y/Z 旋转、平移依序应用,再继承父组变换。`translate(dx,dy,dz)`、`rotate(dx,dy,dz)` 可在 Endor 中直接调用。
- `DirectionalLight(dx,dy,dz,color,intensity)` 使用传播方向,Scene3D.ambient 为基础照明。当前材质是完全不透明的平面着色。
- `Viewport3D(width,height,scene)` 是普通有限 UI 盒子,可以放入 Row、Column、Overlay 或 Scene2D 中。背景与 3D 内容在独立表面上渲染,再交给现有原生软件合成器;采用实际深度缓冲、六面视锥裁剪,没有用静态图替代三维场景。
- 每个新 Viewport3D 有独立 PerspectiveCamera;可用 `view.camera = OrthographicCamera()` 替换,或显式共享同一个 camera。摄像机字段为 x/y/z、targetX/Y/Z、upX/Y/Z、near/far、透视 fov(角度)、正交 height。宽高比由每次视口投影提供,不写回共享摄像机。`camera.translate(...)` 同时平移位置与观察目标。
- `OrbitController()` 独立于摄像机数据,默认绑定到新视口。左键拖动旋转,中键/空格拖动平移,滚轮/捏合缩放。view.controller 可替换为提供 `update(camera, gesture)` 的 Endor 对象,或设为字符串 `none` 禁用。CameraGesture 提供 kind、dx/dy、factor、width/height、pointX/pointY。透视缩放改变观察距离,正交缩放改变 height。
- `view.mounts().at(index).pick3D(x,y)` 接受投影前页面空间中的指针坐标,返回 RayHit3D 或空值;结果包含实际托管 mesh、世界 point/normal、distance、triangle 和 barycentric。原生指针点击对应视口时,标准 click Event.hit 提供相同结果;点击空白时为空。拾取与绘制共享摄像机和变换,遵守 near/far。
固定 Aster 版本不支持数值算术表达式,不能用 `x = x + dx` 编译控制器。因此示例使用可运行的原生 translate/rotate 操作;自定义控制器可以调用这些方法或直接设置摄像机字段。未修改 Aster 源码或 gitlink。
3D 表面最长边按需降采样至 2048,单表面不超过 4194304 像素;缓存最多 8 个不可变表面、总计 8388608 像素。三角形、顶点、场景节点、灯光、光栅工作和摄像机范围均有检查;超过光栅预算返回错误,不发布截断的半幅结果。降采样保留原始视口宽高比,使绘制与拾取使用相同投影。
示例见 [scene3d.endor](../examples/scene3d.endor)。测试覆盖真正的 Endor 构造/修改、最终渲染像素、深度顺序、透视/正交独立视图、近面裁剪、射线回调、可替换控制器的真实 HTTP 路由以及循环/非法几何拒绝。原生硬件交互尚未验收。
3D 基础阶段检查:176 项本地回归全部通过,all-target Clippy 拒绝 warnings 通过。后续世界空间 UI 与嵌套资源/可见性工作尚未完成,因此整体目标及 PR 仍处于进行中。
## 世界空间 UI 与组合
`Panel3D(worldWidth, worldHeight, content)` 把普通 Endor Block 放进 3D 场景。面板有独立的 uiWidth/uiHeight(默认 512×320,整数 1–2048)和不透明 background;本次 UI 表面不实现透明材质。世界尺寸控制平面几何,UI 尺寸提供有限排版约束,两者互不代替。面板与组/网格一样支持位置、旋转、缩放及 translate/rotate。
内容仍是同一个托管对象树,正常执行 measure/arrange/paint/hitTest;每次出现有自己的 Mount、有限尺寸、滚动状态和纹理。一个组件可以放进多个不同尺寸的面板,不复制其业务状态。3D 摄像机移动不改变 UI 的排版尺寸。UI 绘制指令按面板收集,透视裁剪时保留 UV,并按深度进行透视校正插值;普通网格会正确遮挡面板。
指针先沿视口摄像机发射射线,再沿可见面板的逆世界变换映射到 UI 像素,然后继续通过内部 CanvasViewport 的逆变换。被其他网格挡住的 UI 无法收到指针命中。拖动捕获使用平面的连续逆投影,因此指针移出面板后不会把同一手势交给另一个摄像机。Mount.toView(x,y) 将组件本地坐标转到页面视图坐标;toLocal(x,y) 执行反向转换,无法命中可见面板时返回空值。pick3D 另提供实际 node/mesh 和实例编号。
面板 UI 可以继续嵌入 CanvasViewport 或 Viewport3D,后者也可以再包含 Panel3D;普通 Overlay 的兄弟 UI 仍固定在其 UI 空间。引用环在派生布局前拒绝;世界 UI 最多嵌套 8 层,光栅/纹理像素采用统一总预算。滚动视口与普通画布的世界内容不会撑大外层有限视口或外层滚动范围。
示例见 [world-ui.endor](../examples/world-ui.endor)。世界 UI 阶段的 181 项完整本地回归和 all-target Clippy 均通过;新增回归覆盖真正的像素、托管回调、材质遮挡、多面板独立尺寸、再次嵌入 3D、真实 HTTP 射线/UV 摄像机输入、循环和递归预算。
## 可见性、连续输入与资源
3D 场景快照构建世界 AABB 的 BVH,摄像机变化复用相同的不可变场景和索引。视锥查询剔除不可见网格,射线查询按近到远缩小候选;序列化不携带缓存,反序列化后可重建。几何或变换变化会生成新场景和新索引。
普通 2D 交互和相机目标使用 128px 屏幕网格。每个对象最多进入 256 格,索引总计最多 65536 项;巨大矩形和项目化的 3D 面板 UI 进入精确命中的后备集合。后备集合仍遵循原有裁剪、投影和反向绘制顺序,不因近面投影或索引预算遗漏对象。源 hitTest 仍逐一执行其真实协议,未更改源覆盖行为。
原生输入使用有界 64 项队列。同一个运行时的连续 viewport / scene / scroll 事件在出队时更新到当前帧版本,保留原窗口、会话和捕获 Mount;目标消失、控制器禁用、运行时更换或失败时丢弃。所有窗口共用同一事件客户端和权威文档。离散点击及外部 HTTP 请求仍严格拒绝过时版本,不自动重放业务动作。队列满时仍可拒绝新输入,不保证任意输入速率下无损。
文字先裁剪再遍历可见字形像素;字体超过 512 设备像素时使用有界字形位图采样,避免高倍率缩放产生巨大单字形分配。字形缓存逐字检查 4096 项 / 32 MiB 阈值,整形缓存继续限制字符串数量与源字节数。极端放大时清晰度受字形 LOD 限制。面板派生槽位限制为非负 i64,避免哈希高位造成偶发排版错误;重复标识拒绝发布。
## 原生验证记录
2026-11-11:本地完整回归、格式、all-target Clippy 和 release 应用打包;实际启动 Tessera.app,通过本机 API 加载 world-ui 示例,并取得原生窗口截图,确认立方体、倾斜面板和内部 Canvas 的显示。系统 `CGPreflightScreenCaptureAccess` 为 true,`CGPreflightPostEventAccess` 为 false;集成的原生自动操作工具还因 OpenSSL 配置读取权限启动失败。因此 API / VM 事件与像素测试不宣称为硬件鼠标或触控板验收。最终检查数量及交付提交在 PR 中记录。
最终完整回归为 186 项通过;运行中的原生实例验证世界 UI 按钮将计数从 0 改为 1、scene-orbit 改变摄像机、scene-zoom 改变观察距离、重复旧帧请求返回 HTTP 409,空闲连续采样的版本保持一致。保留应用窗口供用户直接操作。
+52
View File
@@ -0,0 +1,52 @@
# Default-page design
Endor is a working object and UI environment. This page should help someone begin
working, with three existing actions, rather than explain the VM or advertise
future model connections. Layout, painting and callbacks live in Endor source.
## Reference decisions
| User reference | Adopt | Adapt for Endor |
| --- | --- | --- |
| Codex | Clear selected tab and restrained grouped actions | Keep the existing rounded tabs and continuous top/left chrome; omit its tool directory |
| Chrome | A recognizable visual center and immediately usable actions | Use a compact centered start surface; no search field without working search |
| Obsidian | A short vertical list of equal-sized quick actions | Three 360 × 40 logical-pixel action rows with consistent text alignment and spacing |
| VS Code | Quiet branding and aligned action/shortcut information | 28 px wordmark, 14 px supporting text, separate shortcut rows; no oversized slogan |
## Tokens and composition
- Chrome: #E6E9ED; canvas: existing #F7F7F5; action rows have no fill or border.
- Text: #30343B; supporting text: #80858D; action labels use existing native interface text.
- Typeface: existing native interface family with CJK fallback. A desktop tool
should follow the OS text conventions; a decorative web font is inappropriate.
- Type scale: 28 px wordmark, 14 px labels and supporting information.
- Action height: 40 px; no visible container; vertical rhythm: 8 px.
- Group width: 360 px; page centered in content constraints. The app's current
minimum window is 720 × 480, leaving room for the full group and chrome.
- Keep the normal native button focus outline and existing event handling.
```text
Endor
创建页面,或从一个示例开始。
+ 创建页面
↗ 共享对象示例
◇ 界面组合示例
新建标签页 ⌘T / Ctrl+T
关闭标签页 ⌘W / Ctrl+W
```
## Review before implementation
The rejected surface had two competing large titles, prose wider than its actions,
blue buttons of different widths and one long shortcut sentence. Replace those
with one small wordmark, one functional hint, quiet text actions and paired
shortcut rows. The first screenshot review still showed three white bordered
blocks that the user found too prominent; those surfaces were removed, bringing
the action treatment closer to VS Code while retaining Obsidian's short list.
Guidance reviewed: Anthropic's frontend-design SKILL.md (upstream main, retrieved
2026-10-24), using its plan/review/build/critique process. Only a temporary copy
was fetched; no global skill, hooks, browser runtime or frontend dependency was
installed. Native screenshot review and button activation checks follow the build.
+34
View File
@@ -0,0 +1,34 @@
# 学生成绩管理中心测试页
源码:[student-grades.endor](../examples/student-grades.endor)。
在 Tessera 按 F12 打开 Console,点击 `>` 输入位置,粘贴完整源码后按 Enter。
源码创建并渲染一个独立的「学生成绩管理中心」Page,不替换其他页面。
该示例使用 6 位虚构学生的内存对象,展示语文、数学、英语和复核状态。
它验证 Endor 类、原生 Column 子类的测量、自定义绘制、字段绑定、事件和
同一对象在筛选前后的共享状态。关闭应用后数据不会保存。
## 已完成的原生检查
- 通过原生 Console 粘贴完整源码并按 Enter,成功出现成绩页标签和 6 行数据。
- 「查看复核记录」切换为林沐的一行复核记录。
- 「录入复核成绩」执行示例中预设的复核结果:数学 58 → 68、状态改为已复核、待复核 1 → 0。
- 「全部学生」恢复 6 行,林沐的 68 分和已复核状态保留。
- 「恢复示例数据」恢复 58 分、待复核状态和计数 1。
这是交互测试示例,复核按钮应用预设结果,不是通用成绩录入表单;没有
文件存储、通用校验、导入导出、真实学校数据或完整 CRUD 的实现声明。
## 录制结果
尝试了 macOS screencapture 的窗口录像与限定区域录像,均返回 capture error。
随后尝试 QuickTime「新建录屏」,没有成功出现可操作的录制界面;直接打开
系统录屏工具也超时。因此没有成功生成连续录屏,不把截图当作录屏交付。
原生操作关键截图保存在本次会话的 /private/tmp/endor-grades-demo/:
01-endor-input.png、02-rendered.png、03-filtered.png、04-reviewed.png、
05-all-reviewed.png、06-reset.png。
本次仅新增示例和此说明,未修改渲染器。以实际 Console 执行和原生点击
作为验证;未运行 cargo test、自动化 smoke 脚本,也未因纯示例新增而重复构建。
+232
View File
@@ -0,0 +1,232 @@
# Window workspace requirement audit — 2026-10-24
This audit follows the full conversation, including later corrections. Implementation completion and native evidence are different columns. No claim is made that Chrome was personally measured.
| Requirement | Implementation | Evidence / limits |
| --- | --- | --- |
| One top row with native macOS controls | Transparent/full-size native title bar; reserved control space; 40 px tab strip; native AppKit controls repositioned to its y=20 center | Actual Retina macOS windows viewed; native close/minimize/fullscreen controls retained |
| Continuous left/top chrome | One neutral background; 56 px left rail; inset content panel | Actual main and detached windows viewed; no Tools label or rail launchers |
| Compact symmetric round tabs, softer active state | 88–208 px width; 32 px pill with equal 4 px vertical insets; 13 px labels and matching 18 px icon/close slots; no hard active stroke | Native settled UI viewed; hover and selected use the same bounds |
| + and startup default page | One startup request guarded against duplicate resume; + release-inside; Cmd/Ctrl+T | Immediately after restart: pages().count = 1. Two native Cmd+T actions produced three tabs |
| New-tab motion, filled and unfilled | 220 ms cubic ease; insertion grows from the previous trailing edge; full-strip geometry and + interpolate; removed tabs shrink without remaining interactive | Real native new/close/fill operations completed; settled compression/overflow viewed. No frame-by-frame recording or Chrome timing comparison |
| Overflow and scrolling | Separate + reservation; no arrow buttons; logical-pixel wheel/trackpad scrolling and clipped offscreen tabs; invisible drag edge dwell retained | Native overflow reached; + in overflow increased VM count 7 → 8. Dragging out of + kept count at 7 |
| Close/activate/reorder/migrate/detach | Ordinary managed Page methods retained; animated hit bounds and drag anchors use current visual bounds | Native close and drag-out to Endor Window 2 succeeded. API detach/move-back preserved Page 1:135:0. Native cross-window drop, dwell and mixed-DPI were not re-run in this final build |
| Four developer tools separated | Independent Page instances; Console/Sources/Network/Settings modules and separate per-view state | Earlier native top-level Sources/Console activation and read-only copy/paste verified; no nested navigation remains |
| Four tools not default or permanently placed | No Tools menu, rail buttons or new-page tool directory; existing API/shortcut retained | Final default surfaces viewed without tool entries |
| Source reading/selection/copy | Grapheme-boundary selection, no gutter in copy, select-all/copy, Shift navigation, drag edge scrolling | Native single-line drag/copy/paste verified earlier in this change. Final keyboard copy was re-run after the chrome-focus fix: drag-copy matched the complete selected line; four Shift+Right operations copied the expected four characters; select-all copied multiline source without a gutter. Drag edge behavior compiled; exhaustive combinations remain untested |
| Clicking Console output must not jump to prompt/end | Input hit region restricted to actual prompt rows | Native reading/copy path verified earlier; no input hit over transcript-only area |
| Default page reflects Endor | Real Endor Page with creation, shared-object and composition actions; no persistence/model backend claims | Referenced chats read: 01a16819-28c3-7ce0-9423-0ffaa19402ce and 01a1689b-77d8-75a2-ba9e-b2fa3dce654e; actual native start surface viewed |
| Sensible source organization | Runtime/API tests separated; four page view modules; shared painter/selection; native tool Page factory; motion module | All-target Clippy compiled production and test sources. Runtime host reduced from ~7000 to ~1380 lines |
| Protect existing work | examples/README.md and examples/workspace.endor excluded; vendor/Aster untouched | git status checked before staging |
| Verification restrictions | fmt, all-target Clippy -D warnings, release build and manual native/API checks | No cargo test, smoke script, Docker, dependency test install or CI polling |
## Reference boundaries
The user's Chrome/Codex reference images supplied the single-row controls, capsules and continuous left/top chrome. The [Obsidian reading-view reference](https://forum.obsidian.md/t/make-button-to-switch-views-in-tab-title-bar-more-intuitive/89814/6) informed restrained contrast and pane separation.
The actual tools refused access to both Codex and Terminal. The available in-app browser exposes page content, not Chrome's native tab strip. No personal Chrome window/profile was operated. A Chromium source search was supplementary research, not an animation test; fetching the selected source page failed. Therefore the requested isolated Chrome comparison remains unverified.
## Manual request correction
One placement probe used unsupported == syntax and returned a parse error before execution. It was replaced with direct returned object-identity checks. Both the detached-window Page and moved-back Page returned 1:135:0. The failed expression is not counted as passing evidence.
## Remaining verification
Isolated Chrome timing/shape comparison, frame-by-frame animation capture, fresh native cross-window drop/dwell on the final build, mixed-DPI cross-screen interaction and exhaustive keyboard/source-selection combinations remain without new runtime evidence. These are not silently marked passed. The shipped Page lifetime/GC model was preserved; no new persistence or AI backend is claimed.
## Final focus regression fix
Final native retesting found a real regression: title-strip mouse events cleared the active editor focus. Window activation performed before automated key events exposed the same behavior. Chrome mouse presses now preserve content focus; developer pane hit testing ignores points outside the pane; frame publication updates the keyboard route according to the active Page. No source, tab geometry or selection state is logged by the shipped build.
After the fix, direct system clipboard comparisons (without printing clipboard contents) confirmed selected-line equality (28 characters), Shift+Right selection equality (4 characters), and multiline select-all with no line-number gutter. The temporary Sources Page was closed afterwards. All-target Clippy, formatting and release building passed again.
## Local delivery state
Implementation commits: 3220544 (runtime test-source separation), 656522e (managed workspace/chrome implementation), d3165b1 (behavior and requirement audit), followed by the chrome-focus fix commit. A push to origin/main was attempted once and rejected by automatic approval review because explicit authorization for this default-branch remote mutation was required. No alternative push route was attempted. The remote remains unchanged pending the user's approval.
## Functional start-page revision
The previous Rust-painted introduction was removed. `ui_bridge/start_page.endor`
now defines a managed Page subclass with native layout alignment, real buttons,
a shared-state counter and a composed-Blocks example. Its private module globals
do not overwrite user REPL bindings. The same factory is available as `ui.newTab()`;
legacy `ui.developerTools("New tab")` delegates to it. No developer-tool entry is
shown on the start page.
Native startup checks caught unsupported comparison syntax and unimplemented
arithmetic bytecode in initial layout drafts. Those drafts were replaced with
existing Page/Row measurement and native `mainAlign`, without changing Aster.
A subsequent layout check caught unbounded child-height centering; sizing now
belongs to the root Page, which receives the actual content constraints.
These failures were corrected locally, and are not counted as passing checks.
Final native checks for this revision: all three start-page buttons opened their
corresponding managed Pages; the blank-page return action activated its original
home Page; one native counter click changed both views from 0 to 1. Overflow
navigation was visible while these Pages were added. A direct `ui.newTab()` call
increased the live Page count from 4 to 5, confirming one Page per factory call.
The final window was also being operated by the user (reported by the UI tool),
so the pre-existing four tabs are not treated as a clean-start count measurement.
No additional restart was done after that interaction. The earlier isolated
startup count of one remains evidence for the guarded startup path; the new
factory's single-call count was checked separately.
Formatting, all-target offline Clippy with warnings denied, the release macOS
bundle and diff whitespace checks passed. No test suite or smoke script was run.
All earlier requirements were reviewed against the table above; isolated Chrome
motion comparison and the explicitly listed cross-window/DPI verification gaps
remain unverified, rather than being marked complete.
## Chrome contrast correction
The continuous top/left chrome now uses #E6E9ED instead of #F5F5F5,
separating it visibly from the #F7F7F5 content canvas. Selected tabs retain
white fill and dark text; inactive titles use muted text. Geometry and borderless
selection are unchanged. After rebuilding and restarting, the native window
showed one startup tab; a + click added a second tab and the two states were
visually checked. Formatting, all-target offline Clippy and release bundling passed.
## Start-page visual redesign
Reviewed the four user-supplied Codex/Chrome/Obsidian/VS Code references and
Anthropic's frontend-design skill. Reference decisions and tokens are recorded in
`docs/start-page-design.md`. The default page now uses one 28 px wordmark, a short
14 px hint, aligned action rows and separate shortcut rows. A first pass with
white outlined buttons was rejected by the user; the action fill and border were
removed in the final pass. The Endor Button subclass keeps a 360 × 40 hit target
but returns an empty background display list; its label and native focus indicator
still render through the existing tree.
Native screenshot review confirmed the final text-row treatment. Clicking the
shared-object action opened its Page; Tab focused the first action with a visible
outline. Startup displayed one default Page. Formatting, all-target offline Clippy,
release bundling and diff whitespace checks passed. No automated test suite was run.
The design skill was read from a temporary download only; no global skill, hooks
or new application dependency was installed.
## Tab motion, density and macOS alignment correction — 2026-10-25
Reviewed the user-provided 60 fps reference recording by extracting insertion,
full-strip and closing frames. The reference's unfilled strip expands the new tab
from the previous trailing edge and moves + with it; overflow scrolls the strip
and permits a partial tab at the edge. This is analysis of the supplied recording,
not an independently measured live Chrome/Codex session.
The strip now retains geometry for every tab ID, including offscreen tabs. Moving
an existing tab into the viewport no longer treats it as a new zero-width tab.
Geometry retargets from its sampled position during repeated operations; closed
tabs shrink visually and are excluded from hit testing. New selection reveals only
the required portion of the strip rather than centering the selected tab.
The former 160 px minimum is reduced to 88 px, and arrow controls plus their
reserved margins are removed. Horizontal trackpad deltas and vertical mouse-wheel
deltas over the strip both change a clamped floating-point scroll offset. Gesture
scrolling follows input directly, while insertion, closure and automatic reveal
use the 220 ms transition. OS momentum remains ordinary subsequent wheel input.
No touchscreen hardware verification is claimed.
The initial 28 px row was too shallow. The revised 40 px row centers tabs at
y=20 and repositions the retained native AppKit controls onto the same center
line. Pills are 32 px high, with 4 px top/bottom margins and 13 px labels. A 1 × 12 px divider separates adjacent inactive tabs; it is hidden beside
an active or hovered tab. Hover and selection retain the same pill geometry.
Manual native checks covered startup, + and repeated Cmd+T, dense overflow,
vertical wheel movement to either end, hover divider suppression, tab selection
and Cmd+W closure. Native screenshots confirmed alignment, density and absence
of arrow controls. Physical trackpad feel, mixed-DPI cross-window drag and an
exact frame-timing match remain unverified. A capture attempt around an insertion
returned only one usable frame, so it is not presented as animation timing proof.
Formatting, all-target offline Clippy with warnings denied, release app bundling
and whitespace checks passed. Existing geometry test fixtures were updated for
pixel offsets and the denser layout; they were type-checked by Clippy but no
cargo test, automated smoke script or Docker task was run.
### Comfortable row height with native alignment — 2026-10-25
The current Chromium [layout constants](https://github.com/chromium/chromium/blob/main/chrome/browser/ui/layout_constants.cc)
define a 35 px tab (34 + 1 px toolbar overlap) and 6 px strip padding, totaling
41 px. Tessera uses a 40 px row with a symmetric 32 px capsule, retaining its
88–208 px width range, separators, gesture scrolling and insertion motion.
Only the in-app web view is available for agent-owned browser access, so this
is a source/reference-image comparison, not a live measurement of Chrome.
A macOS-only adapter obtains the winit-owned content NSView and positions the
three real standard window buttons at the row's center. It preserves their
native sizes, horizontal positions and actions, and reapplies alignment before
drawing after native layout changes. Fullscreen floating controls stay under
AppKit management. Native bindings were already cached transitively; direct
macOS-only dependencies now declare this use explicitly.
Manual resizing followed by repeated tab creation exposed a renderer panic:
rounding at large absolute x positions could invert a rounded rectangle's
clamp bounds while a tab grew from almost zero width. Rounded hit coverage now
clamps in local coordinates with a radius bounded by half the rectangle size.
Final native checks passed for 18 consecutive Cmd+T insertions, dense overflow,
wheel scrolling, five consecutive Cmd+W closures and native window zoom. The
final process stayed running without stderr errors. Initial native screenshots
showed the traffic lights, tab capsules and + centered at the same y position.
Subsequent computer-control captures can display macOS's capture badge over the
traffic lights. Fullscreen floating controls and mixed-DPI moves were not tested.
Offline all-target Clippy with warnings denied, formatting, release app bundling
and git whitespace checks passed; no cargo test or automated smoke script ran.
### Hover fades with immediate selection — 2026-10-25
Tab bodies, the + button and close-button hover backgrounds now use the same
160 ms cubic ease-out for entering and leaving. Each tab is tracked by its
stable ID; reversing a fade starts from the current sampled intensity. Adjacent
inactive dividers fade with the tab hover instead of disappearing abruptly.
Close-button colors interpolate from the tab's actual current background,
including the selected white surface.
Hover state runs separately from geometry animation. The event loop schedules
frames until either transition finishes, including after the pointer stops or
leaves the window. Selected backgrounds and label colors still read the current
active flag directly, so selection has no color fade or animation delay.
Existing insertion/closure movement and native control alignment are retained.
Native manual checks covered an inactive tab hover, leaving that tab, the +
hover, selecting a different tab and moving back into page content. Settled
screenshots confirmed hover does not select the tab, + has its hover surface,
selection changes to the clicked tab and idle separators return after leaving.
The capture API does not establish frame-accurate 160 ms timing. Offline
all-target Clippy, formatting, release bundling and whitespace checks passed;
no cargo test, automated smoke script or Docker task was run.
### Native toolbar double-click — 2026-10-25
The custom row previously called only winit's native window-drag operation;
a manual double-click in its empty area did not resize the window. The same
empty-area hit test now consults AppKit's current NSEvent clickCount before
starting a drag. On the second press it calls NSWindow.performZoom, preserving
AppKit's standard/user frame toggle and avoiding a hand-built resize animation.
Tabs, close buttons and + remain excluded from this handler.
The adapter reads AppleActionOnDoubleClick without changing system preferences:
Minimize calls performMiniaturize; absent/Maximize calls performZoom; disabled
or unknown values do nothing. Fill also uses the public performZoom action,
whose standard frame fills this application's available screen in the checked
configuration. It does not invoke the private _zoomFill selector used by Chrome.
Consequently Fill is not claimed to reproduce every macOS tiling margin rule.
Native fullscreen uses a different window state and is left to AppKit.
References: Apple's [performZoom](https://developer.apple.com/documentation/appkit/nswindow/performzoom(_:))
and Chromium's [custom draggable-area handling](https://github.com/chromium/chromium/blob/main/components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm).
Manual native verification: an empty-row double-click changed the Retina window
from 2560×1600 to 3024×1888; a second double-click restored 2560×1600. Clicking
+ and double-clicking a tab did not zoom the window. Dragging empty toolbar
space continued to move the window. The user's double-click preference was
absent (default zoom); other preference branches were not changed or manually
tested. Offline all-target Clippy, formatting, release bundling and whitespace
checks passed. No cargo test or automated smoke script was run.
+43
View File
@@ -0,0 +1,43 @@
# Endor UI examples
| File | Purpose |
| --- | --- |
| [world-ui.endor](world-ui.endor) | Interactive Endor UI on a transformed 3D plane, with shared counter state, nested canvas, programmable camera and fixed UI controls. |
| [scene3d.endor](scene3d.endor) | Shared 3D meshes, transforms and light with independent perspective/orthographic cameras, orbit controls and Endor buttons. |
| [scene-viewports.endor](scene-viewports.endor) | One Scene2D in two CanvasViewports with independent Camera2D, a nested viewport, shared state and fixed overlay UI. |
| [box-layout.endor](box-layout.endor) | Nested Row/Column/Overlay, shared text, finite border-box sizing, margins, borders, alignment and clipping. |
| [gc-lifecycle.endor](gc-lifecycle.endor) | A Page/Block/Task/await-frame cycle: hidden retained Blocks keep running, then releasing the last references permits collection despite rendering caches. |
| [scroll-axis.endor](scroll-axis.endor) | One shared TextBlock in vertical and horizontal viewports, live axis changes and independent offsets. |
| [windows.endor](windows.endor) | Two real native windows in one Aster VM, live shared counter state and explicit Page ownership. |
| [tabs.endor](tabs.endor) | Three real Page tabs, shared counter state, source titles, native switching/closing and reopening through code. |
| [window.endor](window.endor) | A managed native Window resizes the actual shell; source callbacks update it and layout follows reported dimensions. |
| [layout-cache.endor](layout-cache.endor) | Per-occurrence source measurement caches, separate size/paint models, and a band using the logical viewport input. |
| [source-layout.endor](source-layout.endor) | Source measurement reads its initial Mount parent; source arrangement moves a child and a click updates the shared layout model. |
| [source-hit.endor](source-hit.endor) | Source circle hit testing, ordinary Block click subscriptions and fallback to the parent through transparent space. |
| [source-paint.endor](source-paint.endor) | Source paint overrides render checked commands in the window; a source Button method updates the shared tint model. |
| [visual-protocols.endor](visual-protocols.endor) | Real source calls for constrained native measurement, arrangement and managed paint-command results from live Mounts. |
| [mount-lifecycle.endor](mount-lifecycle.endor) | Source onMount/onUnmount methods, two occurrences of one object, ordered notifications and retained Mount lifetime. |
| [events.endor](events.endor) | Managed event subscriptions, source onEvent override and numbered capture/target/bubble steps from native input. |
| [native-subclasses.endor](native-subclasses.endor) | Real native TextBlock/Button/Page source subclasses, inherited fields, method overrides and shared field bindings. |
| [classes.endor](classes.endor) | Endor class fields, inheritance, overriding, a retained receiver and Event arguments; native keyboard input updates shared model properties. |
| [managed-types.endor](managed-types.endor) | Callable managed Endor types, one shared counter, two bound displays and a language callback invoked from native Button input. |
| [page.endor](page.endor) | Four top-level statements construct text, a rectangle and a page, then call page.render; no main wrapper. |
| [main.endor](main.endor) | The earlier function-entry form, producing the same frame as page.endor. |
| [hello.endor](hello.endor) | Richer function-entry example covering a helper, Row/Column and Spacer. |
| [fonts.endor](fonts.endor) | Mixed Chinese/Latin text and proportional widths, with rectangles following narrow and wide letters. |
| [workspace.endor](workspace.endor) | Larger static workspace dashboard with reusable functions, metrics, progress bars and an activity column. Paste the complete file into Console in Script mode; all displayed data is illustrative. |
Submit a file as the UTF-8 body of a namespace PUT request. No namespace,
scene, render block or imports belong in the source.
The live `/agent` guide embeds page.endor exactly. Local tests execute examples through
Aster and check the resulting coordinates and source ranges after VM cleanup.
For Page window/vertical/horizontal/canvas modes, see [page surfaces](../docs/page-surfaces.md)
and the running start page's four working actions.
The file is client-side sample material; Tessera's API stores source by namespace.
Return to the [project guide](../README.md).
## 龙与文字绕排
`illustrated-manuscript.endor` 通过通用图形资源、源 paint、指针事件与 Page 任务实现。龙、火焰和文字受热逻辑均在 Endor 中。资源在 `assets/manuscript/`;从仓库根目录启动应用并提交源码,详见 [运行和脚本解释](../docs/illustrated-manuscript.md)。
Binary file not shown.
+16
View File
@@ -0,0 +1,16 @@
# Illustrated Manuscript assets and attribution
Dragon sprites (head, tongue, front/back wings, body-1 through body-19), fire
sprites (Layer 2 through Layer 11), dropcap.png and story.txt are from
https://github.com/dengshu2/illustrated-manuscript (main, retrieved 2026-11-12).
The upstream package.json declares `ISC`; upstream has no separate LICENSE file.
Its complete README is retained as UPSTREAM.md. It credits the original demo to
River Marchand (@Riyvir), Neither/Nor: https://neithernor.studio/.
Reference live demo: https://illustrated-manuscript.vercel.app/.
The native chain animation, exclusion and fire algorithms are adapted from that
project's src/dragon.js and src/main.js; this port contains no JavaScript runtime.
IMFellEnglish-Regular.ttf is the unmodified IMFeENrm28P.ttf from
https://github.com/google/fonts/tree/main/ofl/imfellenglish.
Copyright (c) 2010, Igino Marini. SIL Open Font License 1.1, retained in OFL.txt.
The face is embedded for offline, reproducible manuscript typography.
+93
View File
@@ -0,0 +1,93 @@
Copyright (c) 2010, Igino Marini (mail@iginomarini.com)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
+67
View File
@@ -0,0 +1,67 @@
# Illustrated Manuscript
An interactive illuminated manuscript page featuring an animated dragon that follows your cursor, breathes fire on click, and causes text to flow around it in real-time.
**[→ Live Demo](https://illustrated-manuscript.vercel.app/)**
## Overview
This project renders a medieval manuscript page on Canvas, featuring a hand-painted dragon made of sprite segments. The dragon tracks the mouse cursor with chain-physics (20 body segments with angle constraints), and clicking makes it breathe fire. Text reflows around the dragon body and fire particles each frame using [Pretext](https://github.com/chenglou/pretext)'s `layoutNextLine` API — no DOM measurements, no CSS reflow.
### Features
- **Real-time text exclusion** — text wraps around arbitrary moving shapes (dragon body + fire particles), re-laid out every frame via Pretext
- **Chain-physics dragon** — 20-segment inverse-kinematics body, hand-painted sprites, wing flapping, idle rest pose
- **Fire-breathing** — click to spawn particle bursts from the dragon's mouth; particles push and distort nearby text characters
- **Illuminated drop cap** — hand-drawn initial letter in manuscript tradition
- **Medieval aesthetic** — IM Fell English font, parchment tones, hand-painted sprites throughout
## Tech Stack
- **[Pretext](https://github.com/chenglou/pretext)** — Pure JS/TS text measurement & layout engine by [Cheng Lou](https://x.com/_chenglou). Enables laying out text without DOM reflow, line by line with variable widths
- **WebGL2 + 2D Canvas** — offscreen 2D Canvas compositing, uploaded to WebGL2 texture for display
- **Vite** — build tool
## Project Structure
```
src/
config.js — constants, responsive layout calculations
dragon.js — dragon physics, sprite rendering, fire particle system
story.js — manuscript story text
main.js — entry point: WebGL pipeline, input, text layout, render loop
public/
dragon-sprites/ — 23 hand-painted dragon body part PNGs
fire-sprites/ — 10 fire particle PNGs
img/dropcap.png — illuminated drop cap
(IM Fell English loaded via Google Fonts)
```
## Getting Started
```bash
npm install
npm run dev
```
Open in browser. Desktop recommended — mobile support is limited.
## How It Works
1. **Text preparation**: story text is segmented and measured once via `prepareWithSegments()`
2. **Each frame**: dragon segments and fire particles generate exclusion rectangles
3. **Text layout**: for each line, available width ranges are computed by subtracting exclusion zones, then `layoutNextLine()` fills each range
4. **Fire text effect**: characters near fire particles are displaced, rotated, and color-shifted based on proximity
5. **Rendering**: everything composites on an offscreen 2D Canvas, then uploads to a WebGL2 fullscreen quad
## Credits
Created by [River Marchand (@Riyvir)](https://x.com/Riyvir), Creative Director at [Neither/Nor](https://neithernor.studio/).
Built with [Pretext](https://github.com/chenglou/pretext) by [Cheng Lou](https://x.com/_chenglou) — a pure JavaScript/TypeScript library for multiline text measurement & layout, enabling web UIs to bypass DOM measurements and reflow entirely.
> *"This little illuminated dragon is very happy about Pretext."* — [@Riyvir](https://x.com/Riyvir/status/2038093450139279426)
## License
ISC
Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

+47
View File
@@ -0,0 +1,47 @@
It was the third candle the abbess had confiscated, and Sable had nodded gravely each time and stolen another from the chapel stores. She kept reading by its unsteady light, hunched beneath her wool blanket in the scriptorium where the novices slept on straw pallets between the copying desks.
It was the bestiary that held her. Not the psalter, not the gospels, not the lives of saints with their wooden sufferings. The bestiary. Some brother at Lindisfarne had painted it two centuries ago, and his creatures had a quality she could not name, a weight to them, as if they had been observed from life rather than copied from pattern books. His lions looked hungry. His basilisks looked bored.
And his dragon, coiled in the lower margin of the forty-seventh leaf, looked like it was breathing.
She had watched it for six nights before she was certain. The movement was slight, a swelling of the ribs, a settling, barely more than the flicker the candlelight threw across the page. On the seventh night she held her breath and placed a finger beside its painted flank, and the parchment was warm.
\u201CYou could simply ask,\u201D the dragon said.
Sable jerked her hand back. The dragon opened one eye, yellow as egg tempera, and regarded her with an expression she recognized from the abbey cats: mild contempt for a creature too slow to be interesting but too close to ignore.
\u201CI am called Voss,\u201D it said. \u201CThough the brother who painted me called me several other things, mostly under his breath, mostly because I would not hold still.\u201D
\u201CYou are paint,\u201D Sable said. It came out less firmly than she intended.
\u201CI am gall ink and oak soot and gum arabic,\u201D Voss replied. \u201CAlso rabbit skin glue, which I find personally offensive. But I am not paint. Paint does not get stiff from two centuries of holding the same pose.\u201D He uncurled one leg and stretched it across the margin rule, his claws dimpling the parchment. \u201CYou, on the other hand, are trespassing. This page is not assigned reading for novices.\u201D
\u201CI am not a novice. I clean the scriptorium.\u201D
\u201CEven worse. A servant reading. The brothers would be scandalized.\u201D
\u201CThe brothers are asleep.\u201D
\u201CThe brothers,\u201D Voss said, \u201Care always asleep. That is the principal advantage of monasteries.\u201D He yawned, and his breath smelled of lamp-black and something older, something mineral, like a cave after rain. A thin red tongue uncurled and tasted the air above the page.
Sable leaned closer. In the candlelight she could see the crosshatching of his scales, each one laid down with a single stroke of the brush. The brother who painted him had not scrimped. Most bestiary dragons were outlines stuffed with vermillion, flat and heraldic. This one had shadow under its jaw. This one had a nick in its left ear.
\u201CWhat do you eat?\u201D she asked.
\u201CSilverfish, mostly. They get into the binding paste. Occasionally a bookworm, if I am feeling athletic.\u201D He cocked his head. \u201CWhy are you not frightened?\u201D
\u201CShould I be?\u201D
\u201CConvention demands it. A maiden, a dragon. There are expectations.\u201D
\u201CI scrub floors and empty chamber pots. I am not anyone\u2019s idea of a maiden.\u201D
Voss made a sound that might have been a laugh. It was dry and papery, like a sheet of vellum being folded. \u201CGood,\u201D he said. \u201CMaidens are tedious. They always scream at exactly the wrong moment. You, at least, have the sense to ask questions first.\u201D
He settled back into the margin, tucking his tail around the descender of a large Q. \u201CCome back tomorrow night,\u201D he said. \u201CBring a candle that does not gutter so badly. And if you can manage it, a bit of cheese. I have not tasted cheese in two hundred years, but I believe I would still recognize it.\u201D
\u201CCan you eat cheese? You are made of ink.\u201D
\u201CI am made of ink that remembers being alive,\u201D Voss said. \u201CThere is a considerable difference.\u201D He closed his eyes. The warmth under Sable\u2019s fingertips faded, and the dragon on the page was still again, just pigment and binder on stretched calfskin, exactly as lifeless as it should have been.
Sable sat in the dark for a long time after the candle burned out. Then she went to the larder and stole a piece of cheese.\u2026
+39
View File
@@ -0,0 +1,39 @@
// 异步 UTF-8 文件读取:在 Console 调用 reader.read(绝对路径),后台 provider 只交付文本,VM worker 执行业务回调。
// owner/key 相同的新读取替换旧任务;provider 读取失败记录 Task.error、不执行 apply;apply 自身失败则遵循共享运行时停域规则。
// 持有三个显示对象与当前任务;task 初值占位,第一次 read 后替换为真实 Task。
class FileReader {
// 这三个字段保存已构造的文字对象引用,回调更新同一业务对象,不创建一份新的页面或复制 Mount。
output: TextBlock
problem: TextBlock
status: TextBlock
// 初始用通用 Object 占位;read 安装真实 Task 后可查询 status/error,result 需等待成功交付,apply 不会在占位阶段执行。
task: Object
// 仅成功时调用,result 在成功回调期间已可读;写原 TextBlock 触发显示刷新。
function apply(self: FileReader): Unit {
// 任务调度器在 I/O 成功且仍有交付资格时调用绑定的 apply;self 是原 reader,调用者无需另外传参。
// 本例适用于不超过 TextBlock 16 KiB UTF-8 字节预算的文件;readText 自身允许至多 1 MiB,读取成功不保证这次控件赋值合法。
self.output.text = self.task.result()
}
// 以 self 为 owner、file 为 key 启动读取,清空旧输出,并把状态/错误文字绑定到当前任务。
function read(self: FileReader, path: String): Unit {
// path 是 Console 本次传入的路径;任务创建同步返回句柄,文件读取在后台,方法这里不会等文件内容。
self.task = ui.readText(self, "file", path, self.apply)
// 清掉上次显示与当前读取状态对齐;已取消的旧任务不能稍后回写覆盖这次读取。
self.output.text = ""
// Task.status/error 是零参数只读方法,可直接作为绑定计算;换任务后绑定也随本次调用更新。
self.status.bind("text", self.task.status)
self.problem.bind("text", self.task.error)
}
}
// 先建立界面对象,保持 reader 为可从 Console 操作的全局业务入口。
output = TextBlock("尚未读取文件")
// 单独显示 Task.error;失败不会触发 apply,所以读不到新内容时也能通过绑定看到错误。
problem = TextBlock("")
// 独立进度控件绑定到这次任务的方法,普通重绘不会重新提交 readText。
status = TextBlock("")
// 全局 reader 保留 owner 和三个显示对象;ui.state(0) 仅满足 Object 字段初值,不是文件结果。
reader = FileReader(output, problem, status, ui.state(0))
// 页面只是展示输出,任务 owner 是 reader;关闭这个页面不等于直接取消 reader 下的任务。
page = Page()
page.title = "异步文件"
page.render(Column(24,16,TextBlock("在 REPL 调用 reader.read(绝对路径字符串)",2),status,output,problem))
+42
View File
@@ -0,0 +1,42 @@
// 异步 HTTP(S) 文本 GET:Console 调用 fetcher.fetch(url),沿用 owner/key 替换、状态与成功回调协议。
// 完整响应保存为 String,界面只显示完成提示,避免把可能很大的响应放进文字控件。
// response 是结果业务存储;output/problem/status 仅呈现任务进度与提示。
class TextFetcher {
output: TextBlock
problem: TextBlock
status: TextBlock
// 保存最新请求句柄,owner/key 替换后 apply 只读取当前任务;初始 Object 值尚不是可查询的 Task。
task: Object
// 完整响应留在 VM 业务字段,TextBlock 只显示提示;外部读取和 GUI 排版的内容量分开。
response: String
// 成功后取出完整 UTF-8 结果,写 response 供 Console 查询;provider 失败不会进入此方法。
function apply(self: TextFetcher): Unit {
// 成功交付前调度器已写入 Task 结果;绑定 self 的零参回调在所属 VM 执行,不在网络线程写业务字段。
self.response = self.task.result()
self.output.text = "请求完成;在 REPL 查看 fetcher.response"
}
// 同一 self/request 身份的新请求取消旧交付,重置旧内容并把显示绑定到新任务。
function fetch(self: TextFetcher, url: String): Unit {
// url 来自显式 fetch 调用,HTTP(S) GET 由后台 provider 完成;新句柄返回不代表网络已完成。
self.task = ui.fetchText(self, "request", url, self.apply)
// 只有 fetchText 成功创建新句柄才清旧结果;若 URL 校验/任务额度拒绝,上面的调用报错,下面不会执行。
// 同步清旧结果,避免新请求等待期间让 Console 把旧响应误认成新请求结果。
self.response = ""
self.output.text = ""
// 绑定读取当前 Task 方法,完成和失败由 worker 的任务状态变更传播。
self.status.bind("text", self.task.status)
self.problem.bind("text", self.task.error)
}
}
// 界面不自动访问网络,用户以 Console 明确指定 URL 后才创建任务。
output = TextBlock("尚未请求网络")
// 错误单独绑定 Task.error,即使失败没有调用 apply 也能展示原因。
problem = TextBlock("")
// 进度显示绑定任务状态,响应内容不拼接进这个控件,避免大正文参与每次布局。
status = TextBlock("")
// 全局业务入口让后续 REPL 复用同一 owner,因此多次 fetch 才会按 request 键替换。
fetcher = TextFetcher(output, problem, status, ui.state(0), "")
// Page 展示与任务身份分开,任务归属 fetcher;保持该业务对象可达时,页面隐藏不自动取消它。
page = Page()
page.title = "异步网络"
page.render(Column(24,16,TextBlock("在 REPL 调用 fetcher.fetch(HTTP 或 HTTPS 地址字符串)",2),status,problem,output))
+43
View File
@@ -0,0 +1,43 @@
// 把 callback-free 文件 Task 与 ui.spawn 协作函数组合:await 保存执行位置,等待完成后继续,不阻塞 VM worker。
// readText 的 file 与 spawn 的 workflow 使用不同 key,分别管理读取和等待流程。
// 保存 provider Task、协程 Task 和结果;两种任务都是托管对象,可以从 Console 独立查看。
class AwaitReader {
output: TextBlock
status: TextBlock
// workflow 句柄由 ui.spawn 返回,用于观察协作函数状态和最终返回值。
task: Object
// provider 句柄由 ui.readText 返回,apply 的 await 等待它;两个字段不是同一个 Task 的别名。
file: Object
response: String
// await 在文件未完成时挂起并保留 self/操作数;恢复后只执行后半段一次,再把字符串作为 workflow.result。
function apply(self: AwaitReader): String {
// 调度器启动 apply 后遇到未完成 file 会保留续体,后续 provider 就绪再恢复;成功结果才赋给 response。
// 依赖取消会取消等待流程;依赖失败在 await 处变成源错误,本例没有捕获逻辑,也不会执行后面的完成提示。
self.response = await self.file
self.output.text = "读取完成;在 REPL 查看 reader.response 或 reader.task.result()"
// 正常返回值成为 workflow.result(),与 file 的读取结果来源相同但属于另一个任务结果。
return self.response
}
// 先创建读任务,再调度普通函数 apply;spawn 而非新 async 语法提供可暂停执行上下文。
function read(self: AwaitReader, path: String): Unit {
// 先安装本轮文件任务,省略成功回调;它以可 await 的结果状态通知 workflow。
self.file = ui.readText(self, "file", path)
// 再安装 workflow,捕获的是绑定 self 的源方法;它在后续调度量子内推进,不在此处同步跑完 apply。
// file/workflow 分属两个 key;连续启动不是一笔原子事务,若 spawn 创建失败,前面已创建的文件任务不会自动撤回。
self.task = ui.spawn(self, "workflow", self.apply)
// 启动后清上次业务结果及显示提示,新的 await 恢复后才写入本轮文本。
self.response = ""
self.output.text = "等待文件"
// 显示的是 workflow 状态,等待 provider 时它仍报告 running;结束后 result 可从 Task 或 response 读取。
self.status.bind("text", self.task.status)
}
}
output = TextBlock("在 REPL 调用 reader.read(绝对路径字符串)")
// 只展示协作 workflow 的状态,provider 自身状态可从 reader.file 单独查询。
status = TextBlock("")
// 占位值只用于满足初始字段构造;在 read 内被真实 Task 替换,页面建立不自动读文件。
reader = AwaitReader(output,status,ui.state(0),ui.state(0),"")
// 页面只投影 status/output,两个任务 owner 都是 reader,页面可见与否不是该普通 owner 的交付资格条件。
page = Page()
page.title = "await 文件"
page.render(Column(24,16,status,output))
+57
View File
@@ -0,0 +1,57 @@
// 盒模型组合:容器与 Page/相机独立,border-box 尺寸、padding、margin 和对齐分别参与布局。
// 同一文字共享内容,在左右不同有限分配中各自换行;外层 Overlay 负责叠放固定角标并裁剪溢出。
// 内部布局基于容器自己的约束;Page 和相机只提供外部展示/投影上下文。
// 文字 boxWidth=fill 占父分配的可用宽度,marginBottom 在文字边框盒外参与排布。
shared = TextBlock("同一个对象可以有多个 Mount。每个位置分别测量、换行和对齐。", 2)
// fill 是共享对象的布局策略,每次出现仍从各自父约束得到实际宽度;不把首次测量宽度保存回 shared。
shared.boxWidth = "fill"
shared.marginBottom = 8
// 左 Column 使用 fill、min/max 宽度限制和四边边框;非对称 paddingLeft 覆盖统一 padding。
left = Column(16, 12, TextBlock("Row / Column", 2), shared, Button("继续探索"))
left.boxWidth = "fill"
// 给父 Row 的分配加上下限/上限,min/max 是 border-box 约束,不是原生窗口宽度。
left.minWidth = 180
left.maxWidth = 360
// 四边分别设置厚度,测量/安排时边框与 padding 占内容外空间;颜色只影响绘制。
left.borderLeft = 2
left.borderTop = 2
left.borderRight = 2
left.borderBottom = 2
left.borderColor = "#CBD5E1"
left.paddingLeft = 24
// Column 的交叉轴为横轴,未自行覆盖对齐的孩子按 center 排;共享文字还有 fill 自身宽度策略。
left.crossAlign = "center"
// 右 Column 也引用同一 shared,但最大宽只有 240,因此对应 Mount 的换行高度可以不同。
right = Column(16, 12, TextBlock("共享内容,独立排版", 2), shared)
right.boxWidth = "fill"
right.maxWidth = 240
// 这里 end 仅选择右容器内的交叉轴位置,不改变 shared 业务对象在左容器的对齐。
right.crossAlign = "end"
// Row 分配有限 760 主轴空间,扣 padding/gap 后在两侧 fill 子项之间分配并服从上限。
content = Row(24, 24, left, right)
content.boxWidth = 760
// Row 的交叉轴为纵轴,start 让左右两列按可用上侧对齐,列高仍来自各自文字换行测量。
content.crossAlign = "start"
// 角标是 Overlay 的另一子项,alignSelf 与 margin 控制它在容器交叉轴上的位置。
badge = TextBlock("Endorphin · layout")
badge.marginRight = 12
badge.marginBottom = 12
// 子项显式对齐覆盖父级默认交叉轴对齐,margin 保留在边框盒外,不作为文字内容绘制。
badge.alignSelf = "end"
// 固定 800x400 的 Overlay 不按线性顺序挤开兄弟,overflow=clip 同时约束绘制和命中。
surface = Overlay(0, 0, content, badge)
surface.boxWidth = 800
surface.boxHeight = 400
// Overlay 的主轴对齐参与各子项在同一区域的分配,不像 Column 那样把 content 和 badge 顺序堆叠。
surface.mainAlign = "end"
// overflow 策略由宿主投影成子裁剪,超出有限表面的文字/按钮不能仅凭原布局盒穿透命中。
surface.overflow = "clip"
// Page 只提供展示入口,根容器自身的盒模型规则不依赖页面导航方式。
page = Page()
page.title = "嵌套盒模型"
// 顶层脚本执行到这里请求展示完整对象组合;布局驱动随后按出现约束求解,再发布不可变绘制帧。
page.render(surface)
+329
View File
@@ -0,0 +1,329 @@
// 多页面校园演示:七个普通托管 Page 共享 CampusCourse/CampusWork 业务对象,所有课程与学生数据均虚构。
// 无服务器、账号登录或真实上传;提交/评分按钮只应用预设字段值,其他页通过绑定读同一状态。
// 作为一次完整输入提交;七页共用同一VM,会话重置后数据消失。
// 白色圆角卡片容器,继承 Column 的排版,只覆盖自身背景绘制。
class CampusPanel: Column {
// 按当前出现位置 geometry 创建一条背景命令,子项由展示遍历继续绘制。
function paint(self: CampusPanel, mount: Mount, geometry: Bounds): DisplayList {
// source_paint 为每个卡片出现调用;fill 是本轮新结果,允许写字段,不能在这里修改课程或作业模型。
fill = PaintCommand()
fill.kind = "roundedRect"
fill.x = geometry.x
fill.y = geometry.y
fill.width = geometry.width
fill.height = geometry.height
fill.radius = 10
fill.color = "#FFFFFF"
return DisplayList(ObjectList(fill))
}
}
// 通过额外 width 字段固定表格列的期望宽,保持成绩表头和行对齐。
class CampusCell: Column {
// 这是源子类的期望宽度策略,不是某个 Mount 的最终宽度;相同列宽仍要服从父 Constraints。
width: Number
// 先算子内容自然高度,再改新测量结果宽度,保留真实字体引起的高度。
function measure(self: CampusCell, mount: Mount, constraints: Constraints): MeasureResult {
// source_layout 先调用覆盖,再显式委托 Column 得到新 MeasureResult;只改返回结果,不写 content 的业务状态。
result = Column.measure(self, mount, constraints)
result.width = self.width
return result
}
}
// 页面内容里的演示导航栏,与应用自身的原生页面侧栏是两棵不同控件树。
class CampusSidebar: Column {
// 返回固定168x620期望尺寸,外层 ScrollBlock 承担超出区域的滚动。
function measure(self: CampusSidebar, mount: Mount, constraints: Constraints): MeasureResult {
// 每个侧栏出现的只读测量入口;固定返回值仍受父约束处理,不是强制原生窗口至少 620 高。
return MeasureResult(168, 620)
}
// 为导航区创建深红背景,位置/大小来自当前Mount,文字等子项保持独立命令。
function paint(self: CampusSidebar, mount: Mount, geometry: Bounds): DisplayList {
// 侧栏背景命令只覆盖当前容器,子按钮和文字通过独立出现继续绘制,避免在父命令里重复画子树。
fill = PaintCommand()
fill.kind = "roundedRect"
fill.x = geometry.x
fill.y = geometry.y
fill.width = geometry.width
fill.height = geometry.height
fill.radius = 10
fill.color = "#852B38"
return DisplayList(ObjectList(fill))
}
}
// Button 子类增加背景字段,固定导航按钮尺寸,并保留原生事件目标能力。
class CampusNav: Button {
background: String
// 导航按钮期望144x40,确保四个入口宽高一致。
function measure(self: CampusNav, mount: Mount, constraints: Constraints): MeasureResult {
// source_layout 调用此固定尺寸策略,实际测量结果仍由宿主验证,再交给父导航容器安排。
return MeasureResult(144, 40)
}
// 取原生按钮背景命令改色/圆角;文字由后面 replace 后的子项绘制,不在此重复生成。
function paint(self: CampusNav, mount: Mount, geometry: Bounds): DisplayList {
// 原生按钮生成本轮临时命令,at(0) 只取背景;下面 campusNav 替换的白字孩子由统一遍历画出。
fill = Button.paint(self, mount, geometry).commands.at(0)
fill.color = self.background
fill.radius = 7
return DisplayList(ObjectList(fill))
}
}
// 课程业务记录,grade/progress 被多个页面绑定读取,其余静态字段构建时直接读取。
class CampusCourse {
// grade/progress 用 ui.textOf 注册实时依赖;其余字段传给 TextBlock 时只读取构造当时的值。
title: String
code: String
teacher: String
grade: String
progress: String
}
// 实验状态集中在一个对象,course 指向同一课程模型,评分因此能影响全站课程摘要。
class CampusWork {
status: String
score: String
feedback: String
submission: String
todo: String
result: String
course: CampusCourse
// 模拟提交只改状态、文件名提示、待办和结果文字,不访问磁盘或网络。
function submit(self: CampusWork, event: Event): Unit {
// campusSubmitButton 的 click 连接调用;没有文件选择或成绩计算,重复点击会再次写相同预设状态。
self.status = "已提交 · 等待评分"
self.submission = "lab01.endor · 已提交示例内容"
self.todo = "已完成本次实验提交"
self.result = "示例提交成功,可以切到作业中心查看同一条记录。"
}
// 应用预设92分和反馈,并更新所属课程成绩/进度;绑定让仪表盘、课程、成绩页同步观察。
// 不要求先 submit,也不校验现有 status;再次 submit 只覆盖其写到的字段,不会自动清空旧 score/feedback。
function assess(self: CampusWork, event: Event): Unit {
// campusAssessButton 派发到这里,course 引用 campusProgramming;只改该课程,数学与英语保持原值。
self.status = "已评分"
self.score = "92 / 100"
self.feedback = "结构清晰,边界情况处理完整。建议补充函数说明。"
self.submission = "lab01.endor · 已提交示例内容"
self.todo = "本次实验已评分"
self.course.grade = "88.5%"
self.course.progress = "已完成 4 / 6 个学习单元"
self.result = "已应用预设评分;仪表盘、课程主页和成绩总览同步更新。"
}
// 恢复初始实验与课程状态,保留所有原对象和绑定,便于反复演示。
function reset(self: CampusWork, event: Event): Unit {
// campusResetButton 的事件入口恢复共享模型字段,不重新创建七页,不需要逐页重新注册文字绑定。
self.status = "未提交"
self.score = "— / 100"
self.feedback = "提交后可在此查看教师反馈。"
self.submission = "尚无提交内容"
self.todo = "1 项实验待提交"
self.course.grade = "86.0%"
self.course.progress = "已完成 3 / 6 个学习单元"
self.result = "已恢复实验、课程成绩和学习进度的示例状态。"
}
}
// 用统一包装构造表格单元格;传入的content是已有Block引用。
function campusCell(content: Block, width: Number): Block {
// campusGradeRow 和成绩表头调用;width 放在原生 Column 的单个孩子之后,属于源字段而非额外孩子。
return CampusCell(0, 0, content, width)
}
// 显式事件适配器把click的Event与Page.open可选Window参数分开,不能直接把Event误当窗口。
class CampusTarget {
page: Page
// 事件参数在适配器这一层消化,Page.open 只接收其声明的可选 Window。
// 消费事件但不传给Page.open;无参open表示在合适窗口打开/激活目标页。
// campusLink/campusNav 保存此绑定方法;点击时以已保存的真实 Page 为目标,不按标题字符串重新找页。
function open(self: CampusTarget, event: Event): Unit { self.page.open() }
}
// 为普通按钮创建持有目标Page的适配器,并把其绑定方法注册为click回调。
function campusLink(label: String, target: Page): Button {
// 由卡片、课程正文和作业详情等组合函数调用,每次生成独立按钮/适配器,但复用传入 target 页身份。
button = Button(label)
action = CampusTarget(target)
// 连接持有绑定接收者所需引用,action 局部变量离开函数不代表回调丢失目标;调用方不需额外保存适配器。
button.on("click", action.open)
return button
}
// 构造带指定背景的导航按钮,替换原生文字子槽为白字,然后复用事件适配器连接目标页。
function campusNav(label: String, target: Page, background: String): Button {
// campusNavigation 调用,先用源字段构造导航按钮,再替换稳定槽 0 的文字,不把背景字符串误传成孩子。
button = CampusNav(label, background)
button.replace(0, TextBlock(label, 1, "#FFFFFF"))
action = CampusTarget(target)
button.on("click", action.open)
return button
}
// 用目标Page和四个色调参数构建整块导航;不同页面复用目标资源但用不同高亮背景。
function campusNavigation(home: Page, course: Page, assignments: Page, grades: Page, homeTone: String, courseTone: String, workTone: String, gradeTone: String): Block {
// 顶层调用四次建立不同高亮版本;四个 Page 参数只提供导航目标,此函数不直接 open 或 render 它们。
return CampusSidebar(12, 10,
TextBlock("Endor", 2, "#FFFFFF"),
TextBlock("Campus", 1, "#E7BAC0"), Spacer(16),
campusNav("仪表盘", home, homeTone),
campusNav("课程", course, courseTone),
campusNav("作业中心", assignments, workTone),
campusNav("成绩总览", grades, gradeTone), Spacer(100),
TextBlock("林沐", 1, "#FFFFFF"),
TextBlock("2026 秋季学期", 1, "#E7BAC0"),
TextBlock("本地演示", 1, "#E7BAC0"))
}
// 把演示导航与标题/正文横排,外层有限ScrollBlock启用双轴,容纳固定宽度演示内容。
function campusShell(navigation: Block, title: String, subtitle: String, body: Block): Block {
// 七个 render 的参数求值调用本函数,各自新建外层滚动对象;传入 navigation 可共享,偏移则按出现分别保存。
scroll = ScrollBlock(1120, 680,
Row(24, 28, navigation,
Column(0, 16,
TextBlock(title, 2, "#263444"),
TextBlock(subtitle, 1, "#7C8793"),
RectBlock(800, 1, 0, "#E0E5EB"), body)))
scroll.axis = "both"
return scroll
}
// 卡片静态显示课程代码/标题/教师,grade 用绑定随评分变化,入口按钮引用真实课程Page。
function campusCourseCard(course: CampusCourse, page: Page, color: String): Block {
// 仪表盘为三门课各调用一次;color 同时用于静态色条与成绩文字,grade 的实时值仍来自传入 course。
return CampusPanel(0, 0,
RectBlock(248, 44, 8, color),
Column(16, 8,
TextBlock(course.code, 1, "#7C8793"),
TextBlock(course.title, 1, "#263444"),
TextBlock(course.teacher, 1, "#7C8793"),
ui.textOf(course, "grade", 2, color),
campusLink("进入课程", page)))
}
// 成绩表一行复用固定列宽单元格,当前grade为响应式文字,详情链接指向指定课程页。
function campusGradeRow(course: CampusCourse, target: Page): Block {
// 成绩总览逐门课程调用,创建新的表格视觉行,不复制 CampusCourse;详情按钮保留对应课程 Page。
return Column(0, 12,
Row(0, 0,
campusCell(TextBlock(course.title), 240),
campusCell(TextBlock(course.code, 1, "#7C8793"), 140),
campusCell(ui.textOf(course, "grade", 1, "#315E86"), 140),
campusLink("课程详情", target)),
RectBlock(752, 1, 0, "#EDF0F3"))
}
// 组合课程概况/进度和静态学习单元;上方两个链接复用作业/成绩Page,不创建新页面。
function campusCourseBody(course: CampusCourse, intro: String, moduleOne: String, moduleTwo: String, moduleThree: String, assignments: Page, grades: Page): Block {
// 三个课程页调用同一构造函数,各自传不同课程模型/静态单元文案;只有明确 textOf 的字段会随模型改动重算。
return Column(0, 20,
Row(0, 16, campusLink("作业与提交", assignments), campusLink("查看成绩", grades)),
CampusPanel(20, 12,
TextBlock("课程概况", 1, "#263444"),
TextBlock(intro, 1, "#6D7987"),
TextBlock(course.teacher, 1, "#6D7987"),
Row(0, 24, TextBlock("当前成绩", 1, "#7C8793"), ui.textOf(course, "grade", 2, "#315E86")),
ui.textOf(course, "progress", 1, "#6D7987")),
CampusPanel(20, 14,
TextBlock("学习单元", 1, "#263444"),
TextBlock(moduleOne, 1, "#526372"),
RectBlock(752, 1, 0, "#EDF0F3"),
TextBlock(moduleTwo, 1, "#526372"),
RectBlock(752, 1, 0, "#EDF0F3"),
TextBlock(moduleThree, 1, "#526372")))
}
// 共享对象图只构造一次,各Page的文字绑定投影同一业务字段。
// 只创建三份课程模型和一份实验模型,后续各页读取这些对象,避免页面间状态副本不一致。
campusProgramming = CampusCourse("计算机程序设计", "CS 101", "陈老师 · 周二 / 周四", "86.0%", "已完成 3 / 6 个学习单元")
campusMathematics = CampusCourse("高等数学 I", "MATH 101", "周老师 · 周一 / 周三", "91.0%", "已完成 4 / 6 个学习单元")
campusEnglish = CampusCourse("学术英语", "ENG 102", "许老师 · 周五", "89.0%", "已完成 3 / 5 个学习单元")
campusWork = CampusWork("未提交", "— / 100", "提交后可在此查看教师反馈。", "尚无提交内容", "1 项实验待提交", "这是一个本地提交与评分演示。", campusProgramming)
// course 只关联程序设计模型;课程标题/成绩等对象引用与页面资源随后通过各组合函数串成同一托管对象图。
// 先创建全部七个Page,允许导航按钮互相引用;随后逐一render建立内容。
campusDashboard = Page()
campusDashboard.title = "Campus · 仪表盘"
campusProgrammingPage = Page()
campusProgrammingPage.title = "CS 101 · 程序设计"
campusMathPage = Page()
campusMathPage.title = "MATH 101 · 高等数学"
campusEnglishPage = Page()
campusEnglishPage.title = "ENG 102 · 学术英语"
campusAssignments = Page()
campusAssignments.title = "Campus · 作业中心"
campusGrades = Page()
campusGrades.title = "Campus · 成绩总览"
campusWorkPage = Page()
campusWorkPage.title = "实验 01 · 提交详情"
// 预建四种高亮导航树,课程三页共享course导航,Page切换时各自拥有独立Mount。
// 所有“课程”导航按钮的目标均为 campusProgrammingPage;数学/英语详情由各自课程卡或成绩链接进入,不按当前页动态改目标。
campusHomeNav = campusNavigation(campusDashboard, campusProgrammingPage, campusAssignments, campusGrades, "#A64350", "#852B38", "#852B38", "#852B38")
campusCourseNav = campusNavigation(campusDashboard, campusProgrammingPage, campusAssignments, campusGrades, "#852B38", "#A64350", "#852B38", "#852B38")
campusAssignmentNav = campusNavigation(campusDashboard, campusProgrammingPage, campusAssignments, campusGrades, "#852B38", "#852B38", "#A64350", "#852B38")
campusGradeNav = campusNavigation(campusDashboard, campusProgrammingPage, campusAssignments, campusGrades, "#852B38", "#852B38", "#852B38", "#A64350")
// 仪表盘展示课程卡和当前实验摘要,status/todo均从同一campusWork绑定读取。
campusDashboard.render(campusShell(campusHomeNav, "仪表盘", "林沐,欢迎回来。这里是你的课程与近期学习安排。",
Column(0, 20,
Row(0, 16,
campusCourseCard(campusProgramming, campusProgrammingPage, "#326A8F"),
campusCourseCard(campusMathematics, campusMathPage, "#547C67"),
campusCourseCard(campusEnglish, campusEnglishPage, "#88647D")),
CampusPanel(20, 12,
TextBlock("近期作业", 1, "#263444"),
Row(0, 24, TextBlock("CS 101 · 实验 01:对象与函数"), ui.textOf(campusWork, "status", 1, "#315E86")),
ui.textOf(campusWork, "todo", 1, "#7C8793"),
campusLink("打开作业详情", campusWorkPage)),
TextBlock("虚构课程与学生数据 · Endor 本地多页面演示", 1, "#8C959F"))))
// 程序设计课程附加实验入口;数学和英语页复用相同概况结构但读取不同课程模型。
campusProgrammingPage.render(campusShell(campusCourseNav, "计算机程序设计", "课程 / CS 101 / 主页",
Column(0, 16,
campusCourseBody(campusProgramming, "通过实际编程理解对象、函数与交互。", "01 对象与字段 · 已完成", "02 函数与方法 · 已完成", "03 事件与可视界面 · 进行中", campusAssignments, campusGrades),
campusLink("实验 01:对象与函数", campusWorkPage))))
campusMathPage.render(campusShell(campusCourseNav, "高等数学 I", "课程 / MATH 101 / 主页",
campusCourseBody(campusMathematics, "学习极限、微分与积分的基本方法。", "01 函数与极限 · 已完成", "02 导数及其应用 · 已完成", "03 积分方法 · 进行中", campusAssignments, campusGrades)))
campusEnglishPage.render(campusShell(campusCourseNav, "学术英语", "课程 / ENG 102 / 主页",
campusCourseBody(campusEnglish, "阅读学术文本,练习清晰的论证与表达。", "01 Academic reading · 已完成", "02 Evidence and arguments · 已完成", "03 Research writing · 进行中", campusAssignments, campusGrades)))
// 作业中心只有程序设计实验为共享动态模型,其余两项是固定演示文字。
campusAssignments.render(campusShell(campusAssignmentNav, "作业中心", "本学期 / 全部课程 / 作业与提交",
Column(0, 20,
CampusPanel(20, 12,
TextBlock("实验 01:对象与函数", 1, "#263444"),
TextBlock("CS 101 · 10 月 30 日 23:59 截止 · 满分 100", 1, "#7C8793"),
Row(0, 24, ui.textOf(campusWork, "status", 1, "#315E86"), ui.textOf(campusWork, "score")),
campusLink("查看提交详情", campusWorkPage)),
CampusPanel(20, 12,
TextBlock("习题 04:微分与应用", 1, "#263444"),
TextBlock("MATH 101 · 已提交 · 90 / 100", 1, "#7C8793")),
CampusPanel(20, 12,
TextBlock("Reading response", 1, "#263444"),
TextBlock("ENG 102 · 已评分 · 88 / 100", 1, "#7C8793")))))
// 成绩总览复用课程grade绑定和实验score/feedback,评分无需逐页手动写UI。
campusGrades.render(campusShell(campusGradeNav, "成绩总览", "2026 秋季学期 / 当前课程成绩",
Column(0, 20,
CampusPanel(20, 16,
Row(0, 0,
campusCell(TextBlock("课程", 1, "#7C8793"), 240),
campusCell(TextBlock("课程编号", 1, "#7C8793"), 140),
campusCell(TextBlock("当前成绩", 1, "#7C8793"), 140)),
campusGradeRow(campusProgramming, campusProgrammingPage),
campusGradeRow(campusMathematics, campusMathPage),
campusGradeRow(campusEnglish, campusEnglishPage)),
CampusPanel(20, 12,
TextBlock("CS 101 · 作业评分与反馈", 1, "#263444"),
Row(0, 24, TextBlock("实验 01:对象与函数"), ui.textOf(campusWork, "score", 1, "#315E86")),
ui.textOf(campusWork, "feedback", 1, "#6D7987"),
campusLink("打开作业与反馈", campusWorkPage)))))
// 三个操作按钮连接同一个实验对象的submit/assess/reset,均为真实源方法回调。
campusSubmitButton = Button("模拟提交实验")
campusSubmitButton.on("click", campusWork.submit)
campusAssessButton = Button("应用示例评分")
campusAssessButton.on("click", campusWork.assess)
campusResetButton = Button("恢复演示数据")
campusResetButton.on("click", campusWork.reset)
// 注册三个方法只建立监听,不立即执行预设提交/评分/恢复;首次所有绑定读取上面的模型初值。
// 详情页组合要求、提交状态、操作按钮和反馈;所有输入仍只是预设本地状态转换。
campusWorkPage.render(campusShell(campusAssignmentNav, "实验 01:对象与函数", "CS 101 / 作业 / 提交详情",
Column(0, 20,
Row(0, 16, campusLink("返回课程", campusProgrammingPage), campusLink("全部作业", campusAssignments), campusLink("成绩总览", campusGrades)),
CampusPanel(20, 12,
TextBlock("实验要求", 1, "#263444"),
TextBlock("使用 Endor 定义一个对象,并通过方法更新其字段。", 1, "#6D7987"),
TextBlock("为同一个对象建立两个可视展示,验证修改后同时更新。", 1, "#6D7987"),
TextBlock("截止:10 月 30 日 23:59 满分:100", 1, "#7C8793")),
CampusPanel(20, 12,
TextBlock("提交记录", 1, "#263444"),
ui.textOf(campusWork, "submission"),
ui.textOf(campusWork, "status", 1, "#315E86"),
Row(0, 12, campusSubmitButton, campusAssessButton, campusResetButton)),
CampusPanel(20, 12,
Row(0, 24, TextBlock("成绩与反馈"), ui.textOf(campusWork, "score", 2, "#315E86")),
ui.textOf(campusWork, "feedback", 1, "#6D7987")),
ui.textOf(campusWork, "result", 1, "#7C8793"))))
// 逐页render会改变当前活动页,最后显式选择仪表盘作为打开后的首页。
campusDashboard.activate()
// 激活只请求展示已有仪表盘,保留其余六页及共享课程/实验对象;所有页面都没有独立数据库或独立 VM。
+43
View File
@@ -0,0 +1,43 @@
// 普通源类继承示例:GUI 点击执行继承的 activate,内部 self.change 再动态分派到 DemoCounter 覆盖。
// 两个 textOf 共享同一模型字段,修改一次业务值会更新两个展示位置。
// 定义业务状态和公共事件入口,Number/String 字段在构造与赋值时按声明契约检查。
class Counter {
// value 是两处 textOf 的读取目标,lastEvent 是第三处绑定的读取目标;它们都属于同一模型。
value: Number
lastEvent: String
// 保存实际事件种类,再通过 self 调用可覆盖的方法;接收者保持具体子类身份。
function activate(self: Counter, event: Event): Unit {
// Button.onClick 派发传入本次 Event;先记录种类,再调用下面的动态业务方法。
self.lastEvent = event.kind
self.change()
}
// 基类默认行为把值置为 10,子类可复用入口并替换这部分策略。
function change(self: Counter): Unit {
// 仅直接使用 Counter 或未覆盖 change 的子类才采用此默认值;本例 DemoCounter 会替换它。
self.value = 10
}
}
// 继承 Counter 的字段与 activate,仅替换 change;构造参数仍按继承字段顺序传入。
class DemoCounter: Counter {
// 覆盖把值设为 12,演示从继承方法内部发起的调用也会选中实际接收者的方法。
function change(self: DemoCounter): Unit {
// 本例从 Counter.activate 的 self.change() 进入这里,self 仍是 model,两个数值绑定一起失效。
self.value = 12
}
}
// 创建唯一模型,之后所有绑定和按钮回调都指向它,无需把 GUI 状态复制到另一份存储。
model = DemoCounter(9, "等待点击")
// 两次调用各创建一个展示对象,但都读取 model.value;不是把初值 9 各自复制成互不关联的计数器。
first = ui.textOf(model, "value", 2)
second = ui.textOf(model, "value", 2)
eventName = ui.textOf(model, "lastEvent")
// 构造按钮只建立对象,下一行 onClick 注册后才拥有修改模型的点击行为。
button = Button("调用继承方法,再分派到覆盖方法")
// 注册绑定方法,运行时将 click 的 Event 传给 activate;最后 Page.render 才把对象树显示出来。
button.onClick(model.activate)
page = Page()
page.render(Column(24, 16, TextBlock("Endor class:继承、self 与动态方法分派", 2), Row(0, 16, first, second), button, eventName))
+34
View File
@@ -0,0 +1,34 @@
// 构造器分段示例:原生可选参数/可变子项与源子类新增字段分别验证。
// 省略 RectBlock 的 radius/color 不应使字符串 tag 被错当成原生颜色参数。
// 在原生矩形后增加 tag 字段;位置构造仍保留 width/height 及可选圆角/颜色规则。
class TaggedRect: RectBlock { tag: String }
// 在可变数量 Block 子项之后接收源 tag,子项列表与字段不混用。
class TaggedColumn: Column { tag: String }
// 保留原生事件 kind,再追加业务字符串字段。
class TaggedEvent: Event { tag: String }
// 原生列表成员之后追加 tag,列表元素仍可保存不同托管类型。
class TaggedList: ObjectList { tag: String }
// 将需要更新的矩形作为强业务引用保存,按钮回调只修改它的颜色。
class Actions {
// 字段保存 TaggedRect 的对象引用,recolor 的写入会被当前页面中该对象的绘制读取观察到。
rect: TaggedRect
// 写原对象的 color,挂载显示由依赖跟踪刷新,不需要重新构造整个页面。
// 由下面 Button.onClick 注册为零参绑定方法;不接收 Event,也不修改 tag。
function recolor(self: Actions): Unit { self.rect.color = "#237A45" }
}
// 这里刻意省略原生可选项,用末尾字符串初始化子类字段;后面的列表/Column 做对应可变参数演示。
rect = TaggedRect(180, 60, "省略 radius/color 后的字段")
// kind 是原生 Event 参数,第二个字符串才是 TaggedEvent 的源字段 tag。
event = TaggedEvent("click", "事件字段")
// 前两个托管对象归入原生 ObjectList 成员,末尾字符串留给子类字段,不作为第三个列表成员。
// TaggedList.tag 是该列表实例的业务字段;它既不改变 items.count,也不会参与 rect 的容器布局。
items = TaggedList(rect, event, "列表成员之后的字段")
actions = Actions(rect)
button = Button("调用原对象方法")
// 这里只注册回调,不立即执行 recolor,因此首次显示仍使用矩形原生构造的默认颜色。
button.onClick(actions.recolor)
// Column 原生参数接收 padding/gap 和视觉孩子;末尾 tag 字符串不参与布局,textOf 则读取各对象的 tag。
root = TaggedColumn(24, 16, TextBlock("原生选项与子类字段分别检查", 2), rect, ui.textOf(rect, "tag"), ui.textOf(event, "tag"), ui.textOf(items, "tag"), button, "可变子项之后的字段")
page = Page()
page.title = "构造器契约"
page.render(root)

Some files were not shown because too many files have changed in this diff Show More