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:&#x2F;&#x2F;a2ui.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;a2ui.org&#x2F;</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>{&quot;type&quot;:&quot;createSurface&quot;,&quot;surfaceId&quot;:&quot;main&quot;,&quot;title&quot;:&quot;Tasks&quot;}<p>{&quot;type&quot;:&quot;updateDataModel&quot;,&quot;surfaceId&quot;:&quot;main&quot;,&quot;ops&quot;:[ {&quot;op&quot;:&quot;replace&quot;,&quot;path&quot;:&quot;&#x2F;tasks&quot;,&quot;value&quot;:[{&quot;title&quot;:&quot;Ship demo&quot;,&quot;done&quot;:false}]}]}<p>{&quot;type&quot;:&quot;updateComponents&quot;,&quot;surfaceId&quot;:&quot;main&quot;,&quot;components&quot;:[ {&quot;componentId&quot;:&quot;root&quot;,&quot;type&quot;:&quot;Column&quot;,&quot;children&quot;:[&quot;title&quot;]}, {&quot;componentId&quot;:&quot;title&quot;,&quot;type&quot;:&quot;Text&quot;,&quot;props&quot;:{&quot;content&quot;:{&quot;path&quot;:&quot;&#x2F;tasks&#x2F;0&#x2F;title&quot;}}} ]}<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 &quot;reverse controlled mode&quot;, starts claude&#x2F;codex with canopy as an MCP server and appropriate prompt.<p>the mcp also exposes a &quot;screenshot&quot; tool for itself so the LLM can actually &quot;see&quot; 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&#x2F;video capture - api calls<p>for &quot;demo&quot; apps it works okay, i notice different kind of &quot;behavioral issues&quot; in the generated apps though, mostly in terms of state management for more complex apps, the issue gets multiplied. i tried a &quot;pixel editor to ico export&quot;, the editor part worked fine (0 ergonomics for the user though), the export did not work at all. i coulnt get to a usable &quot;sqlite browser&quot; at this point.<p>but i am sure these are prompt problems&#x2F;tooling that can be fixed with better abstractions (packages, reusable components)<p><a href="https:&#x2F;&#x2F;github.com&#x2F;artpar&#x2F;canopy" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;artpar&#x2F;canopy</a><p>go build -o canopy