返回资讯中心
外部精选
软件工程
#开发者实时流

AffrescoUI:用Clojure定义、AI实时改写的原生应用引擎

来源标题:Why stop at Emacs? Native apps you or an AI reprogram in Clojure while they run

AffrescoUI 发布 v1.0.0,这是一个原生 UI 引擎,应用以 Clojure 方言 AffrescoUI Lisp 定义,用户可通过 AI 助手在应用运行时实时修改功能。目前下载版本尚未代码签名,macOS 和 Windows 首次打开会提示无法验证开发者,官方建议从源码构建。

Hacker News 最新RiccardoSottini2026/11/22 · 今天30 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

Any application, defined in one format and rendered natively. Its users reshape it live, just by asking an AI.

Vision · Applications · Architecture · Lisp (Clojure) · How it works · Quick start · Documentation

affrescoui-demo-final-web.mp4

The demo: an image editor given a 3D modeller's and a presentation app's features by asking its assistant, a new app made from a name and a description, a small change to a home app, and the Launcher with its apps.

The v1.0.0 downloads are not code-signed yet, so macOS and Windows warn that they can't verify the developer when you first open them. Signed builds will come in the next releases.

Best today: build from source. It's one command, gives an optimised build for your machine, and never shows that warning (you need CMake 3.25+ and a C++23 compiler):

cmake -S . -B build && cmake --build build && ./build/affrescoui_launcher

AffrescoUI is a native UI engine whose applications are defined in Lisp. AffrescoUI Lisp, a sandboxed dialect of Clojure, is the standard: an application's window, views, state, behaviour, commands, keys, settings and text are all named Lisp definitions, which the engine builds into one document, draws in C++ and OpenGL, and keeps running. If you write Clojure, you can already read and write these apps. JSON is supported too: the same document can be written directly in JSON, and every example ships both. People and AI agents change an application while it runs: each change is checked against the app's permissions, previewed if it needs approval, and applied in place in milliseconds, with no rebuild, no restart and nothing lost.

Software is frozen at build time: it does what its makers shipped, and every change waits for the next release. AffrescoUI applications keep evolving while they are used, shaped by the people who use them.

An application starts from a document, then grows by being talked to: "add a filter to this list", "make the sidebar collapsible", "show the total in red when it's negative". Each request becomes a reviewed revision. A run of revisions becomes a change set, a portable file that works like a plugin, and whole features move between applications: the planetarium below reuses the presentation editor's slide sorter. A person's own version of an app is shared as one file too, and every install is a proposal they review before it lands.

flowchart LR app["📦 An application<br/>one live document"] ask["💬 You ask<br/>'add a filter to this list'"] propose["🤖 An agent proposes<br/>a revision"] approve["✅ You preview,<br/>accept or reject"] plugin[("🧩 Change set<br/>or feature")] catalogue[("🌍 Shared<br/>others can install")] app --> ask --> propose --> approve --> plugin --> catalogue catalogue -. "install" .-> app

classDef step fill:#EEF2FF,stroke:#6366F1,color:#312E81 classDef win fill:#10B981,stroke:#047857,color:#fff class app,ask,propose,approve step class plugin,catalogue win

Loading

The direction: applications as complex as the professional tools people use every day, in one format, rendered natively, and shaped by the people who use them while they run.

Thirteen applications, from everyday apps to professional tools, all in the same format. They are examples (examples/), not part of the library, and each carries the AI assistant in its bottom right corner: ask for a change in plain words, or Point at the part to change first, then review the proposal it becomes. Each is a Lisp program (examples/<app>/lisp/) in the dialect's idiomatic style, small named views and functions with their text in English, Spanish and French, and keeps the same app as a JSON document beside it (examples/<app>/json/): choose which opens in the Launcher's Settings. Calamaio, the text editor reprogrammed from inside, is Lisp only.

The AffrescoUI Launcher, itself one live document: every application one click away, your own apps, a new app made blank, from an example or from a description, a catalogue of apps and features to install after review, and the AI provider every app's assistant uses.

AffrescoUI renders what it is told to: an application is a folder of documents (and, in a program that embeds the library, any native code it registers), and the engine knows nothing else about it. It is built in three layers, each made only of the one below:

A change travels down a stack of layers, each with one job.

%%{init: {"theme": "base", "flowchart": {"nodeSpacing": 30, "rankSpacing": 34, "padding": 14, "wrappingWidth": 400}, "themeVariables": {"fontFamily": "Helvetica, Arial, sans-serif", "fontSize": "14px", "lineColor": "#94A3B8", "primaryTextColor": "#0F172A", "edgeLabelBackground": "#FFFFFF"}}}%% flowchart TB studio(["<b>You</b> · the app's assistant or a script"]) agent(["<b>AI agent</b> · Claude Code"])

mcp["🤖 <b>MCP server</b> · mcp/<br/>connects AI agents, both ways"] channel["🔌 <b>Channel</b> · modules/channel, modules/net<br/>local sockets · processes · WebSocket · one session per peer"] vcs["🛡️ <b>Version control</b> · modules/vcs<br/>allow / ask / deny · proposals · commits · history"] format["📄 <b>Screen format</b> · modules/format<br/>checks the document · evaluates it · reconciles in place"] lisp["λ <b>Lisp language</b> · modules/lisp<br/>builds a program's tree · runs its functions"] render["🎨 <b>Renderer</b> · modules/render<br/>layout · shaped text · input · accessibility · OpenGL"] themes["🧩 <b>Kits and themes</b> · modules/themes<br/>components · design tokens · JSON"]

agent --> mcp mcp --> channel studio --> channel channel -- "revision" --> vcs vcs -- "accepted commit" --> format format -- "panels" --> render themes -. "components, tokens" .-> format lisp -. "programs" .-> format

classDef peer fill:#FFFFFF,stroke:#CBD5E1,color:#0F172A classDef c_mcp fill:#F3E8FF,stroke:#9333EA,stroke-width:1.5px,color:#3B0764 classDef c_channel fill:#E0F2FE,stroke:#0284C7,stroke-width:1.5px,color:#0C4A6E classDef c_vcs fill:#FEF3C7,stroke:#D97706,stroke-width:1.5px,color:#78350F classDef c_format fill:#D1FAE5,stroke:#059669,stroke-width:1.5px,color:#064E3B classDef c_render fill:#EDE9FE,stroke:#7C3AED,stroke-width:1.5px,color:#4C1D95 class studio,agent peer class mcp c_mcp class channel c_channel class vcs c_vcs class format c_format class themes c_format class lisp c_format class render c_render

Loading

Written in Lisp. An app is a program in AffrescoUI Lisp (LISP.md, modules/lisp): named definitions (defscreen, defview, defstate, defn, defcommand, defkey, defcustom, add-hook, advice), run by the library's own interpreter. Each definition is versioned on its own, so a diff names the view or function that changed, and a proposal is rebuilt and judged by the tree it builds. The language can't reach files, processes or the network. Its only ways out are the steps a host grants, each checked against who wrote the code that is running.

One document, drawn natively. What a program builds is a screen document (SCREEN_FORMAT.md, with a JSON Schema): layout, components, themes, state, bindings, events, timers, services and permissions. It can also be written directly in JSON, for data and tools. Behaviour that usually needs code (wiring a button to a list, validating a form, filtering, drag and drop, shortcuts, navigation, calls to services) is declared, so an agent changes it as safely as a colour.

Compact for agents. Edits address nodes by id ({"set": {"#title/text": "Q4"}}, stored as JSON Patch) and re-reads return only what changed: a typical edit is 28 tokens, a re-read after one commit 27 (BENCHMARKS.md). When the person points at a part, the agent reads only the definition that built it.

Apps that agents can use. An app's commands are tools: an agent lists them, runs one under its own name and the app's run rules, never the person's, and can undo its runs (VERSION_CONTROL.md).

Swappable layers. Modules talk only through the interfaces in modules/core, and affresco::Screen plugs them together. No public header exposes OpenGL or GLFW, and each module links on its own (affrescoui::render, affrescoui::vcs, ...) or all together (affrescoui::affrescoui).

Features travel. A part declares the contribution points and contracts it needs, so one application installs another's feature, checked before it lands. A feature can hold Lisp code, which runs with its author's authority, and a person's version of an app is shared as one file (VERSION_CONTROL.md).

modules/core/ the interfaces between modules: Executor, Channel, VersionControl, Services, Network modules/render/ windows, panels, layout, shaped text, input, accessibility; OpenGL 4.1 core or ES 3.0 modules/format/ the screen format: rules, checker, {{expressions}}, the runtime that reconciles in place modules/themes/ the kits' components and the themes' design tokens, as JSON built into the library modules/notation/ documents read and written in JSON or in the Lisp notation modules/lisp/ the Lisp language, a Clojure dialect: reader, interpreter, programs built purely into a document modules/data/ an app's records in SQLite, kept apart from its document: models and migrations modules/audio/ sound: voices of files, streams and generators, mixed to the system's output modules/vcs/ version control: commits, proposals, permissions, history modules/channel/ peers and the live protocol over local sockets and processes modules/net/ HTTP(S), server-sent events, WebSocket, remote peers modules/services/ language servers, local programs and folders the host grants modules/intelligence/ the providers an app's assistant asks (APIs or a command line), behind the assistant capability modules/screen/ affresco::Screen, the composition root, and the umbrella header affresco/affresco.hpp modules/automation/ scenarios: scripted input, expectations, golden images modules/imaging/ layered images on copy-on-write tiles modules/scene3d/ 3D scenes, glTF 2.0 in and out modules/export/ panel trees as vector PDF modules/capi/ the C API, affresco/affresco.h mcp/ the MCP server for AI agents apps/server/ the document server: shared, persistent documents over WebSocket apps/host/ the stock host, affrescoui_launcher: it opens an app's folder and asks for what the app uses examples/ the apps (each with a lisp/ and a json/ folder), the Launcher among them, the assistant add-on catalogue/ the apps' versions and features the Launcher's Catalogue lists and installs editors/ a VS Code extension, and a clj-kondo configuration for the Lisp programs web/ the WebAssembly build

The layers, the path of a revision and of an event, and the security boundary: ARCHITECTURE.md.

An AffrescoUI app is a program in AffrescoUI Lisp, a sandboxed dialect of Clojure with its own runtime, built into the library (LISP.md has every definition and rule in tables; modules/lisp, RFC 0005, RFC 0006). Its forms, functions and reader forms are Clojure's: of 186 everyday Clojure forms, 163 give Clojure's own value and the other 23 are left out or differ on purpose (everyday.lisp, checked on every test run). It is measured against Clojure's cross-dialect test suite too (CONFORMANCE.md), every difference is written down with what to write instead (differences.md), and clj-kondo lints the programs with its configuration. Every example is written in its idiomatic style (style.md). The program is a folder of small, named definitions. Building it gives the document the engine draws, and its functions run whenever a button is pressed, a key is typed or a bound value changes. From Flow's own code (examples/flow/lisp/flow.lisp):

(ns flow.flow)

(defn cards-of "A column's cards, in their order." [c] (:cards (column c)))

(defn next-order "The order that puts a card at the end of a column." [c] (->> (cards-of c) (map :order) (reduce max -1) inc))

(defn column-of "The column that holds a card, or -1." [ref] (or (first (keep-indexed (fn [c col] (when (some #(= (:ref %) ref) (:cards col)) c)) computed.columns)) -1)

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →