Show HN: Canopy – 用Go实现的A2UI,面向macOS/AkkPit
Canopy 是用 Go 实现的 A2UI 工具,可将 JSONL 文件转换为交互式原生图形界面。项目通过定义数据模型和组件结构,实现界面动态渲染与数据绑定。示例展示了创建主界面、更新数据模型及组件布局的基本用法,体现其通过简洁数据格式构建复杂 UI 的能力。
1 分•作者: artpar•大约 2 小时前
几个月前我偶然发现了https://a2ui.org/,并决定将其作为侧边项目进行实现
canopy 可以将 JSONL 文件渲染为功能齐全且交互式的原生图形用户界面
以下是一个 hello world 示例
```example.jsonl
{"type":"createSurface","surfaceId":"main","title":"Tasks"}
{"type":"updateDataModel","surfaceId":"main","ops":[{"op":"replace","path":"/tasks","value":[{"title":"Ship demo","done":false}]}]}
{"type":"updateComponents","surfaceId":"main","components":[{"componentId":"root","type":"Column","children":["title"]}, {"componentId":"title","type":"T..."
```
查看原文
I came across <a href="https://a2ui.org/" rel="nofollow">https://a2ui.org/</a> a couple of months ago and decided to do an implementation as a side project<p>canopy renders jsonl files as functional and interactive native GUI<p>Here is a hello world example<p>```example.jsonl<p>{"type":"createSurface","surfaceId":"main","title":"Tasks"}<p>{"type":"updateDataModel","surfaceId":"main","ops":[ {"op":"replace","path":"/tasks","value":[{"title":"Ship demo","done":false}]}]}<p>{"type":"updateComponents","surfaceId":"main","components":[ {"componentId":"root","type":"Column","children":["title"]}, {"componentId":"title","type":"Text","props":{"content":{"path":"/tasks/0/title"}}} ]}<p>```<p>jsonl to gui renderer is one part, canopy can connect with your llm provider directly and let the llm build the app thru these incremental jsonl.<p>canopy supports --claude or --codex at run in "reverse controlled mode", starts claude/codex with canopy as an MCP server and appropriate prompt.<p>the mcp also exposes a "screenshot" tool for itself so the LLM can actually "see" whats its build. and it can obviously interact with the app itself to test it.<p>the images in the readme are real examples.<p>apart from the basic native components like input field, scroll, layouts etc, canopy can do - ffi function calls - take its own screenshot - audio/video capture - api calls<p>for "demo" apps it works okay, i notice different kind of "behavioral issues" in the generated apps though, mostly in terms of state management for more complex apps, the issue gets multiplied. i tried a "pixel editor to ico export", the editor part worked fine (0 ergonomics for the user though), the export did not work at all. i coulnt get to a usable "sqlite browser" at this point.<p>but i am sure these are prompt problems/tooling that can be fixed with better abstractions (packages, reusable components)<p><a href="https://github.com/artpar/canopy" rel="nofollow">https://github.com/artpar/canopy</a><p>go build -o canopy