<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh">
    <title>bigfish的网络博客 - Zed</title>
    <subtitle>记录技术和生活</subtitle>
    <link rel="self" type="application/atom+xml" href="https://blog.laofu.online/tags/zed/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://blog.laofu.online"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-10-14T00:04:00+08:00</updated>
    <id>https://blog.laofu.online/tags/zed/atom.xml</id>
    <entry xml:lang="zh">
        <title>rpi-acp 源码解读：以 Zed 为例，一个 ACP Client 如何启动并驱动 rpi Agent</title>
        <published>2026-10-14T00:04:00+08:00</published>
        <updated>2026-10-14T00:04:00+08:00</updated>
        
        <author>
          <name>bigfish</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://blog.laofu.online/blog/20261014-0004-acpshi-shen-me/"/>
        <id>https://blog.laofu.online/blog/20261014-0004-acpshi-shen-me/</id>
        
        <summary type="html">&lt;p&gt;在 &lt;code&gt;rpi-package&lt;/code&gt; 的 &lt;code&gt;rpi-acp&lt;/code&gt; 中，ACP 指的是 &lt;strong&gt;Agent Client Protocol&lt;/strong&gt;。这个 package 的实际用途很具体：让 Zed 这样的 ACP Client 通过标准输入输出启动 rpi，并把 rpi 当作一个可以发送 prompt、接收流式更新和处理权限请求的外部 Agent。&lt;/p&gt;
&lt;p&gt;本文以 Zed 作为具体客户端，因为仓库提供了完整的 Zed 注册、配置和排错路径；但 &lt;code&gt;rpi-acp&lt;/code&gt; 并不是 Zed 专用实现。只要其他客户端支持 ACP v1、JSON-RPC 2.0 和 stdio，并能处理本文介绍的会话与更新方法，同样可以通过 &lt;code&gt;rpi-acp-bridge&lt;/code&gt; 启动 rpi。&lt;/p&gt;
&lt;p&gt;本文对应 &lt;code&gt;rpi-packages&lt;/code&gt; 中的 &lt;code&gt;rpi-acp&lt;/code&gt; &lt;strong&gt;0.1.3&lt;/strong&gt;，主要源码如下：&lt;/p&gt;
&lt;pre class=&quot;giallo z-l-code z-d-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;packages/rpi-acp/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── src/lib.rs       插件生命周期、ownsStdio、启动服务&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── src/main.rs      独立 rpi-acp-bridge 二进制&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── src/protocol.rs  ACP v1 JSON-RPC 服务与请求分发&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── src/session.rs   每个 ACP session 对应的 rpi RPC 子进程&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;├── src/history.rs   session 历史保存与回放&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;└── src/zed.rs       Zed settings.json 注册&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;源码仓库：&lt;a rel=&quot;noopener noreferrer external&quot; target=&quot;_blank&quot; href=&quot;https://github.com/pi-rust/rpi-package/tree/master/packages/rpi-acp&quot;&gt;https://github.com/pi-rust/rpi-package/tree/master/packages/rpi-acp&lt;/a&gt;&lt;/p&gt;</summary>
        
    </entry>
</feed>
