# @event4u/agent-switch 中文文档

规范地址：https://npmcn.com/package/%40event4u/agent-switch/

版本：2\.14\.3
npm 元数据更新时间：2026-11-13T12:45:42.391Z
中文译文更新时间：2026-11-14T01:09:27.036Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40event4u/agent-switch
原文对照：https://npmcn.com/package/%40event4u/agent-switch/?lang=original
项目主页：https://event4u-app.github.io/agent-switch/
源码仓库：https://github.com/event4u-app/agent-switch

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：854 kB，86 个文件
- 模块格式：ES Module
- TypeScript 类型：未声明
- Node.js 要求：\>=20
- 运行依赖：0 个
- 首次发布：2026-07-21T05:54:53.401Z
- 最新版本发布：2026-11-13T12:45:41.979Z
- 近 30 天下载量：4772（2026-10-14 至 2026-11-12，npm 官方下载统计）
- 已发布版本数：43（近 12 个月 43 个）

## 中文简介

Claude Code, Codex 和 Antigravity 账户并排签名;每个会话从最左侧的会话开始.

## 安装

```sh
npm install @event4u/agent-switch
```

也可以使用：`pnpm add @event4u/agent-switch`、`yarn add @event4u/agent-switch`、`bun add @event4u/agent-switch`

## README

[![Agent Switch — one tool for all your AI accounts: Claude, Codex and Antigravity signed in side by side, every session on the account with the most left](https://raw.githubusercontent.com/event4u-app/agent-switch/main/.github/assets/info-banner.png)](https://event4u-app.github.io/agent-switch/)

# 代理切换

**你所有的AI编码账户 并肩签名  
和每一次最左侧的会议.**

[![npm](https://img.shields.io/npm/v/@event4u/agent-switch?style=flat-square&color=orange)](https://www.npmjs.com/package/@event4u/agent-switch) [![downloads](https://img.shields.io/npm/dm/@event4u/agent-switch?style=flat-square&label=downloads%2Fmonth&color=orange)](https://www.npmjs.com/package/@event4u/agent-switch) [![CI](https://github.com/event4u-app/agent-switch/actions/workflows/ci.yml/badge.svg)](https://github.com/event4u-app/agent-switch/actions/workflows/ci.yml) [![Documentation](https://img.shields.io/badge/docs-read%20online-orange?style=flat-square)](https://event4u-app.github.io/agent-switch/) [![License: MIT](https://img.shields.io/badge/license-MIT-orange?style=flat-square)](https://github.com/event4u-app/agent-switch/blob/main/LICENSE)

Claude Code – Codex – 反重力- macOS, Linux 和 Windows

## 听起来熟悉吗?

-   **"我不停的伐木 并回到账户。"** 每个账户都签了名,并肩行动 切换永远不记录任何人.
-   **"一个账户点击其极限的中任务,而另一个重置则未使用"** 每一届新会议都从本来会浪费大部分时间的帐户开始 其配额在下次重置时.
-   **"我不知道哪个账户还剩下什么"** 菜单栏应用显示每个账户的5小时和每周的限值,直播.
-   **"勤奋的工作最终 在我的个人帐户。"** 将文件夹刻入账户一次, 每次会话都使用它 .

## 快速开始——60秒

**1\. 安装** (节点20或更新):

```bash
npm install -g @event4u/agent-switch
```

**2\. 增加每个账户一次.** 每个都打开供应商的正常登录 您的浏览器 :

```bash
agent-switch add work
agent-switch add personal
```

**3\. 打开.** 这添加了外壳包装和背景服务 保持使用数新鲜 :

```bash
agent-switch shellenv install
agent-switch service install
```

打开新终端并运行 `claude` 一如既往 从账户开始 给的最多。 想看看吗? 运行 `agent-switch`:桌面应用程序打开, 不需要安装器 .

![Terminal demo: two signed-in accounts; a new session goes to the account whose quota would expire first, and a client folder is pinned to the work account](https://raw.githubusercontent.com/event4u-app/agent-switch/main/.github/assets/demo.gif)

> 代码: 添加 `--provider codex` 改为 `add`已经签了克劳德密码? 见 [保留当前登录](https://event4u-app.github.io/agent-switch/start-here/quick-start/#keep-the-login-you-already-have)。 。 。 .

## 你得到的东西

### 永远不要登录两次

每个账户都拥有自己的登录文件夹,即提供者的方式 原计划。 代理交换器只决定下一个会话所用的文件夹 。 这个 从不复制、互换或旋转登录。 你换衣服的时候没有什么会僵化的 运行的会话永远不会被触碰。 有背景服务,闲克洛德 登录保存为新鲜, 不花费任何配额 .

### 永远不要浪费一个支付限额

没有文件夹规则, 您的账户将会平衡新会话 。 它会去 在下一次重置时 将失去大部分剩下的东西 计划被使用之前,它重新。 账户的限额被跳过。 文件夹 规则将项目固定在一个账户或一组账户。 询问 `agent-switch dir --json` 对于任何文件夹, 它告诉你是哪个账户 将选择和为什么.

### 看到一切,移动任何东西

![Agent Switch desktop app: what needs you, what is running, and what every account has left](https://raw.githubusercontent.com/event4u-app/agent-switch/main/.github/assets/screenshots/overview.png)

桌面应用程序及其菜单栏 Popover 显示每个账户的极限, 每个 以上下文 % 运行会话, 下一步需要您 。 移动 一段会话到另一个账户并在那里继续(`takeover`) (中文(简体) ). 在马科斯你 甚至可以切换仍在运行的会话的账户( q)`rebind`),对 现在或当它的当前转折结束.

与 [代理配置](https://github.com/event4u-app/agent-config) 安装, 您的 代理在限制前在会话中询问您, 应用程序也询问同样的 问. 回答一次, 在任一位置; 代理切换移动工作 。 还有 当您的账户运行速度不同时 在它重新设置之前,另一个会让房间到期,所以限制是最后的 整个运行。 见 [使用代理配置](https://event4u-app.github.io/agent-switch/guides/agent-config/)。 。 。 .

## 如何融为一体

![How Agent Switch fits together: Claude, Codex and Antigravity accounts feed one orchestrator with usage monitor, limit guard, session keep-alive and live rebind; it routes each task from the CLI, IDE or desktop app to the account with free capacity, runs it, monitors it and suggests a switch](https://raw.githubusercontent.com/event4u-app/agent-switch/main/.github/assets/info-image.png)

## 您的登录号是您的

代理开关不是代理服务器,没有服务器,没有账户,也没有遥测功能. 登录在提供者放置的地方。 在互联网上,它只谈论:

-   提供者自己的使用端点,并有自己的登录;
-   GitHub,用于发布和桌面应用程序下载;
-   npm,用于更新代理交换工具的检查(桌面应用程序检查 `claude` 财务报告和审定财务报表 `codex` (原始内容存档于2019-03-26). CLIS.

它只有在确认时才会切换运行的会话 . [什么代理交换机读取,存储和发送](https://event4u-app.github.io/agent-switch/trust/security-and-privacy/)

## 哪里有用吗

|  | 克劳德代码 | 代码 | 反重力 |
| --- | :-: | :-: | :-: |
| 数个账户同时签入 | ✅ | ✅ | ✅ |
| 使用表和平衡开始 | ✅ | ✅ | ➖ |
| 将文件夹切入账户 | ✅ | ✅ | ✅ |
| 将会话移动到另一个账户 | ✅ | ✅ | ➖ |
| 切换正在运行的会话账户 | {\\fn黑体\\fs22\\bord1\\shad0\\3aHBE\\4aH00\\fscx67\\fscy66\\2cHFFFFFF\\3cH808080}你这混蛋 | ➖ | ➖ |
| 记录保存在背景中 | ✅ | ➖ | ➖ |

反重力账户 `--provider antigravity`。桌面应用程序显示 默认 Claude 代码和 Codex; 显示反重力 `agent-switch providers enable --provider antigravity`的核心工作 macOS,Linux和Windows,以zsh,bash,鱼和PowerShell为单位. 这个 [平台矩阵](https://event4u-app.github.io/agent-switch/reference/platform-matrix/) 列出所有例外.

## 每天的命令

```bash
asw                        # list your accounts (* = the one you prefer)
asw work                   # prefer "work" when the accounts are level
agent-switch run personal  # one session on "personal", whatever the balance says
agent-switch map work ~/code/client-a   # this folder always uses "work"
agent-switch status        # every account's limits
agent-switch doctor        # check the setup
```

这个 [CLI 参考](https://event4u-app.github.io/agent-switch/reference/cli/) 列出每个命令.

## 文档

-   **[快开始](https://event4u-app.github.io/agent-switch/start-here/quick-start/)**数字 : 以上三个步骤,每个外壳和操作系统.
-   **[会话使用的账户](https://event4u-app.github.io/agent-switch/concepts/which-account/)**数字 : 文件夹规则、 平衡启动和您首选的账户.
-   **[桌面应用程序](https://event4u-app.github.io/agent-switch/guides/desktop-app/)**数字 : 概览、会话、通知和桌面宠物.
-   **[移动会话](https://event4u-app.github.io/agent-switch/guides/move-a-session/)**数字 : 接住 接住 接住 接住.
-   **[解答问题( F)](https://event4u-app.github.io/agent-switch/reference/troubleshooting/)**
-   **[什么代理交换永远不会做](https://npmcn.com/package/%40event4u/agent-switch/NON-GOALS.md)**: 没有代理, 没有 指纹,不集合免费等级.

## 更新和卸载

`agent-switch update` 通过 npm 安装最新版本。 桌面应用程序 自我更新。 每个版本中的变化都在 [发布注释](https://github.com/event4u-app/agent-switch/releases)。 。 。 . `agent-switch uninstall` 删除它的配置文件, 它们存储 登录,背景服务和应用程序发射器. 你的默认克洛德代码, Codex和Antigravity安装未受影响. 删除 `shellenv` 行从 你壳的启动文件你自己. [详细情况](https://event4u-app.github.io/agent-switch/start-here/install/#uninstall)

## 捐款

欢迎提出问题和拉动请求。 要从源头构建:

```bash
npm ci && npm run build && npm link
npm test
```

桌面应用程序位于 [`gui/`](https://npmcn.com/package/%40event4u/agent-switch/gui/) (陶里+反应. 文献网站位于 [`starlight/`](https://npmcn.com/package/%40event4u/agent-switch/starlight/)。 。 。 .

如果代理切换器保存了登录或被浪费的限制, GitHub 上的 QQ 会帮助其他人 找到它。 发现它.

## 许可证

[麻省理工学院](https://npmcn.com/package/%40event4u/agent-switch/LICENSE) © [事件4u](https://event4u.app/)

## 常见问题

### @event4u/agent-switch 是什么？

Claude Code, Codex 和 Antigravity 账户并排签名;每个会话从最左侧的会话开始\.

### 如何安装 @event4u/agent-switch？

在项目目录运行 npm install @event4u/agent-switch，或使用 pnpm add / yarn add / bun add。它还提供命令行工具 agent-switch，可以用 npx agent-switch 直接运行。

### @event4u/agent-switch 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/event4u\_\_agent-switch 是否存在。

### @event4u/agent-switch 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### @event4u/agent-switch 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=20。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @event4u/agent-switch 可以商用吗？

@event4u/agent-switch 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @event4u/agent-switch 的下载量有多少？

根据 npm 官方下载统计，@event4u/agent-switch 在 2026/10/14 – 2026/11/12 这 30 天内被下载 4,772 次，日均约 159 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @event4u/agent-switch 还在维护吗？

最新版本 2\.14\.3 发布于 2026/11/13（今天）；至今共发布 43 个版本，其中过去 12 个月发布了 43 个；首次发布于 2026/07/21。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

