Show HN: Canopy – 基于 Go 语言的 A2UI 实现,面向 macOS/AkkPit
1 分•作者: artpar•3 个月前
几个月前,我发现了 <a href="https://a2ui.org/" rel="nofollow">https://a2ui.org/</a>,并决定将其作为一个副项目来实现。<p>canopy 将 jsonl 文件渲染为功能强大且交互式的原生 GUI。<p>这是一个 Hello World 示例:<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 到 GUI 渲染器只是一部分,canopy 可以直接连接到你的 LLM 提供商,并让 LLM 通过这些增量的 jsonl 构建应用程序。<p>canopy 在“反向控制模式”下支持 --claude 或 --codex 运行,以 canopy 作为 MCP 服务器并提供适当的提示启动 claude/codex。<p>MCP 还为其自身提供了一个“截图”工具,因此 LLM 实际上可以“看到”它构建的内容。 显然,它还可以与应用程序本身交互以进行测试。<p>readme 中的图像是真实的示例。<p>除了基本的原生组件(如输入字段、滚动、布局等)之外,canopy 还可以执行 - FFI 函数调用 - 截取自己的屏幕截图 - 音频/视频捕获 - API 调用。<p>对于“演示”应用程序,它运行良好,但我注意到在生成的应用程序中存在不同类型的“行为问题”,主要是在更复杂应用程序的状态管理方面,这个问题会被放大。 我尝试了一个“像素编辑器到 ico 导出”,编辑器部分运行良好(尽管用户体验为 0),但导出根本不起作用。 目前我无法获得可用的“sqlite 浏览器”。<p>但我相信这些都是提示问题/工具问题,可以通过更好的抽象(包、可重用组件)来解决。<p><a href="https://github.com/artpar/canopy" rel="nofollow">https://github.com/artpar/canopy</a><p>go build -o canopy
查看原文
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