@kyun.si/codex-polish 0.0.1-beta.4 → 0.0.1-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -1
- package/CONTRIBUTING.en.md +5 -5
- package/CONTRIBUTING.md +6 -6
- package/README.md +32 -90
- package/SECURITY.en.md +1 -1
- package/SECURITY.md +1 -1
- package/docs/README.zh-CN.md +56 -0
- package/docs/technical.en.md +13 -7
- package/docs/technical.md +10 -6
- package/package.json +1 -2
- package/plugins/codex-polish/.codex-plugin/plugin.json +1 -1
- package/plugins/codex-polish/skills/codex-polish/references/acp.md +1 -1
- package/plugins/codex-polish/skills/codex-polish-setup/references/credentials.en.md +3 -3
- package/plugins/codex-polish/skills/codex-polish-setup/references/credentials.md +7 -5
- package/README.en.md +0 -112
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# 更新记录 / Changelog
|
|
2
2
|
|
|
3
|
-
[中文使用说明](README.md) · [English README](README.
|
|
3
|
+
[中文使用说明](docs/README.zh-CN.md) · [English README](README.md)
|
|
4
|
+
|
|
5
|
+
## 0.0.1-beta.5
|
|
6
|
+
|
|
7
|
+
- The repository and npm beta now open with the English README. The Simplified Chinese guide is linked at the top. Both guides cover first setup, one-time Turbo rewrites, and what each provider receives.
|
|
8
|
+
- 仓库和 npm 测试包默认展示英文 README,顶部可切换至简体中文。两份指南都更新了安装步骤、单次 Turbo 用法和数据发送范围。
|
|
4
9
|
|
|
5
10
|
## 0.0.1-beta.4
|
|
6
11
|
|
package/CONTRIBUTING.en.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[简体中文](CONTRIBUTING.md)
|
|
4
4
|
|
|
5
|
-
For installation, see the [project README](README.
|
|
5
|
+
For installation, see the [project README](README.md). For details on when the plugin sends a draft and how it displays the reply, see the [technical reference](docs/technical.en.md).
|
|
6
6
|
|
|
7
7
|
## Where to Make Changes
|
|
8
8
|
|
|
@@ -22,7 +22,7 @@ mkdir -p dist
|
|
|
22
22
|
npm pack --ignore-scripts --pack-destination dist
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
`npm pack` writes version `0.0.1-beta.
|
|
25
|
+
`npm pack` writes version `0.0.1-beta.5` of `@kyun.si/codex-polish` to `dist/kyun.si-codex-polish-0.0.1-beta.5.tgz`. Default tests need no API key. Native installer tests use a temporary Codex profile. The Decisions tests use mock responses to exercise the style check.
|
|
26
26
|
|
|
27
27
|
## Reporting Bugs
|
|
28
28
|
|
|
@@ -36,11 +36,11 @@ Open a GitHub pull request with the reason for the change, steps to reproduce or
|
|
|
36
36
|
|
|
37
37
|
## Publishing a beta
|
|
38
38
|
|
|
39
|
-
Set the version in both `package.json` and the plugin manifest to `X.Y.Z-beta.N`. Commit the change and push the matching Git tag. For example, to publish `0.0.1-beta.
|
|
39
|
+
Set the version in both `package.json` and the plugin manifest to `X.Y.Z-beta.N`. Commit the change and push the matching Git tag. For example, to publish `0.0.1-beta.5`:
|
|
40
40
|
|
|
41
41
|
```sh
|
|
42
|
-
git tag v0.0.1-beta.
|
|
43
|
-
git push origin v0.0.1-beta.
|
|
42
|
+
git tag v0.0.1-beta.5
|
|
43
|
+
git push origin v0.0.1-beta.5
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
GitHub Actions tests the tagged code, publishes the package to npm with the `beta` tag, and creates a GitHub prerelease. If a step fails, run the publishing workflow again from the Actions tab and enter the existing tag.
|
package/CONTRIBUTING.md
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
[English](CONTRIBUTING.en.md)
|
|
4
4
|
|
|
5
|
-
安装和使用请看[项目说明](README.md)。改动插件前,可以先查[技术参考](docs/technical.md),了解插件何时发送草稿、如何显示回复。
|
|
5
|
+
安装和使用请看[项目说明](docs/README.zh-CN.md)。改动插件前,可以先查[技术参考](docs/technical.md),了解插件何时发送草稿、如何显示回复。
|
|
6
6
|
|
|
7
7
|
## 改哪里
|
|
8
8
|
|
|
9
9
|
- `scripts/install.mjs` 和两个 `.command` 启动脚本负责安装、更新、环境检查和卸载。
|
|
10
|
-
- `plugins/codex-polish/` 里有插件清单、钩子和两个技能。`codex-polish` 通过可选的 OpenAI 风格检查判断是否需要润色,经 ACP 把草稿交给 Gemini,并排版显示完整回复。`codex-polish-setup`
|
|
10
|
+
- `plugins/codex-polish/` 里有插件清单、钩子和两个技能。`codex-polish` 通过可选的 OpenAI 风格检查判断是否需要润色,经 ACP 把草稿交给 Gemini,并排版显示完整回复。`codex-polish-setup` 负责设置、选择模型和检查环境,详见[首次配置与登录指南](plugins/codex-polish/skills/codex-polish-setup/references/credentials.md)。改动用户提示或文档时,请同步更新中英文。
|
|
11
11
|
- 完整源码的 `tests/` 放回归测试,`evaluation/` 放评测脚本和合成样本。[评测说明](evaluation/README.md)
|
|
12
12
|
|
|
13
13
|
## 本地测试与打包
|
|
@@ -21,7 +21,7 @@ mkdir -p dist
|
|
|
21
21
|
npm pack --ignore-scripts --pack-destination dist
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
`npm pack` 会把 `@kyun.si/codex-polish` 的 `0.0.1-beta.
|
|
24
|
+
`npm pack` 会把 `@kyun.si/codex-polish` 的 `0.0.1-beta.5` 版打包为 `dist/kyun.si-codex-polish-0.0.1-beta.5.tgz`。默认测试无需 API 密钥,原生安装测试会使用临时 Codex 配置。Decisions 测试使用模拟响应验证风格判定。
|
|
25
25
|
|
|
26
26
|
## 反馈问题
|
|
27
27
|
|
|
@@ -35,11 +35,11 @@ npm pack --ignore-scripts --pack-destination dist
|
|
|
35
35
|
|
|
36
36
|
## 发布 beta
|
|
37
37
|
|
|
38
|
-
将 `package.json` 和插件清单中的版本一同改为 `X.Y.Z-beta.N`,提交后推送同名 Git 标签。例如发布 `0.0.1-beta.
|
|
38
|
+
将 `package.json` 和插件清单中的版本一同改为 `X.Y.Z-beta.N`,提交后推送同名 Git 标签。例如发布 `0.0.1-beta.5` 时运行:
|
|
39
39
|
|
|
40
40
|
```sh
|
|
41
|
-
git tag v0.0.1-beta.
|
|
42
|
-
git push origin v0.0.1-beta.
|
|
41
|
+
git tag v0.0.1-beta.5
|
|
42
|
+
git push origin v0.0.1-beta.5
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
GitHub Actions 会测试这个标签的代码,将安装包发布到 npm 的 `beta` 标签,并创建 GitHub 预发布版。如果某一步失败,可以在 Actions 中选择发布工作流,用已有标签重试。
|
package/README.md
CHANGED
|
@@ -1,114 +1,56 @@
|
|
|
1
|
-
# Codex Polish
|
|
1
|
+
# Codex Polish
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**English** | [简体中文](docs/README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
Codex Polish
|
|
5
|
+
Codex Polish lets Gemini rewrite a Codex reply so it’s easier to read. Codex sends its draft through Antigravity (`agy acp`) and shows the rewrite in chat. In clients that support folding, you can expand the original underneath. Here’s an example translated from a Chinese test run.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
**Polished by Gemini**
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
**Gemini 润色版**
|
|
12
|
-
|
|
13
|
-
导出按钮目前已经修复,本地测试也已通过,不过线上还没有验证。
|
|
9
|
+
The export button is fixed and passed local tests. It still needs to be checked in production.
|
|
14
10
|
|
|
15
11
|
<details>
|
|
16
|
-
<summary
|
|
12
|
+
<summary>View original GPT draft</summary>
|
|
17
13
|
|
|
18
|
-
|
|
14
|
+
Regarding progress with the export button fix, let me explain the actual situation. The export button has now been fixed, local tests have passed, and production verification has not yet been done.
|
|
19
15
|
|
|
20
16
|
</details>
|
|
21
17
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
## 只让 Gemini 重写一次
|
|
25
|
-
|
|
26
|
-
即使项目用的是普通模式,也可以在聊天里直接指定这次用 Turbo。用自己的话说明要改哪条,以及想怎么改就行。
|
|
27
|
-
|
|
28
|
-
- **“为什么缓存命中了还要等?这条用 Turbo。”** Codex 先回答这个问题,再把这份草稿交给 Gemini。
|
|
29
|
-
- **“你刚才那条我没看懂,换个说法,先说结论。”** Gemini 直接重写上一条回答。你也可以指明更早的一条,比如“让 Gemini 重写前面解释缓存的那条”。
|
|
30
|
-
|
|
31
|
-
这一次会跳过 OpenAI 检查。下一条普通提问继续用项目原先的模式。如果希望以后都用 Turbo,可以说 **“把这个项目的默认改写模式设成 Turbo”**。
|
|
32
|
-
|
|
33
|
-
## 三步快速开始
|
|
34
|
-
|
|
35
|
-
支持 macOS 和 Linux。需要 Node.js 22.16 或更新版本,以及支持插件的 [Codex CLI](https://developers.openai.com/codex/cli/)。如果你用 T3 Code,选择 Codex 后端,并把插件装在运行该后端的机器上。
|
|
36
|
-
|
|
37
|
-
1. **在要润色的项目目录安装插件。** 用下面的命令安装 npm 上的测试版。
|
|
38
|
-
|
|
39
|
-
```sh
|
|
40
|
-
npx @kyun.si/codex-polish@beta setup
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
也可以将源码下载到家目录,在当前项目运行安装脚本。
|
|
44
|
-
|
|
45
|
-
```sh
|
|
46
|
-
git clone https://github.com/mreasonyang/codex-polish.git ~/codex-polish
|
|
47
|
-
node ~/codex-polish/scripts/install.mjs setup
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
首次交互配置时,用 **↑ / ↓** 选择改写模式,按 **回车** 确认。默认选中 **普通(Normal)**,可让 OpenAI 先判断草稿是否需要改写。**Turbo** 跳过 OpenAI,直接让 Gemini 改写符合条件的草稿。何时触发润色可单独设置。安装器会沿用项目已选的改写模式。首次配置还可以用方向键选择 Gemini 4 Hydrogen,或让 Codex 查询账号里可用的其他模型。选择会保存在仓库根目录,无人值守安装使用默认值。
|
|
51
|
-
|
|
52
|
-
在 macOS 上也可以下载并解压 GitHub 仓库,双击[安装回复润色.command](安装回复润色.command)。在项目目录提示处输入目标路径,或按回车稍后配置。在项目聊天里说 **“配置回复润色”**,首次配置时即可点选 **普通(Normal)** 或 **Turbo**。如果聊天只支持文字,直接回复模式名即可。
|
|
53
|
-
|
|
54
|
-
2. **连接 Gemini。** 安装器会复用已有的 Antigravity CLI(`agy` 1.2.1 或更新版本)。如果没装,按回车即可安装官方版本。无人值守安装时,在上述 `setup` 命令末尾加上 `--install-agy`。插件默认沿用 Antigravity 登录。只有收到登录提示时,才需要在运行 Codex 的机器上打开 `agy` 登录。
|
|
55
|
-
3. **信任 hook,试一次普通提问。** 启用 OpenAI 风格检查时,OpenAI 只收到本轮问题、草稿和已设置的自定义润色提示词。进入改写时,Google 收到这些内容,默认还会附带最近最多 2 轮完整问答。在 Codex 的 **设置 → Hooks**(CLI 输入 `/hooks`)里信任本插件的 `UserPromptSubmit`,然后在项目里新开聊天,问 **“用一句话解释 DNS。”** 想改成手动,可以在项目里说 **“只在我要求时润色”**。
|
|
56
|
-
|
|
57
|
-
## 项目设置
|
|
58
|
-
|
|
59
|
-
直接对 Codex 说 **“查看回复润色设置”** 就能看到当前配置。每个项目单独保存,在同一项目新开的聊天也会沿用。
|
|
60
|
-
|
|
61
|
-
| 设置 | 默认值 | 可以这样说 |
|
|
62
|
-
| --- | --- | --- |
|
|
63
|
-
| 什么时候润色 | 自动(需信任 hook) | “只在我要求时润色”“关闭回复润色”“给这个项目开启自动润色” |
|
|
64
|
-
| 改写模式 | 普通(normal) | “切换到 Turbo 模式”“恢复普通模式” |
|
|
65
|
-
| Gemini 模型 | Gemini 4 Hydrogen | “选择改写模型”会列出当前账号可用的模型,也可以说“恢复默认改写模型” |
|
|
66
|
-
| 润色提示词 | 当前模式的内置提示词 | “查看润色提示词”“设置润色提示词”“恢复默认润色提示词” |
|
|
67
|
-
| Gemini 改写时带几轮历史 | 最近最多 2 轮 | “带最近 5 轮对话”“润色时不带历史”。可选 0 到 10 轮。说“这次润色不带历史”只对本轮生效 |
|
|
68
|
-
| 改写前的 OpenAI 风格检查 | 普通模式下,配了 `OPENAI_API_KEY` 时启用 | “这个项目只用 Gemini 改写”“有密钥时用 OpenAI 检查” |
|
|
69
|
-
| 插件提示语言 | 自动识别中英文 | “插件提示改成中文”“恢复自动识别语言” |
|
|
70
|
-
|
|
71
|
-
例如,对 Codex 说 **“把这个项目的润色提示词设为:先写结论。尽量用短句。保留专业术语。”** 从下次改写起,无论使用普通模式还是 Turbo,Gemini 都用这三句话作为完整的项目提示词。恢复默认后,Gemini 使用当前模式的内置提示词。也可以直接编辑项目里的 `.codex/codex-polish.prompt.md`。查看、设置和恢复默认都在本机完成,无需调用润色模型。只说“这次回答简短一点”仅对本轮生效。
|
|
72
|
-
|
|
73
|
-
**普通模式(normal)** 默认生效。启用风格检查时,OpenAI 判断是否需要改写,需要时才交给 Gemini。检查已关闭或未配置密钥时,符合条件的草稿直接交给 Gemini。如果密钥失效或 OpenAI 暂时不可用,本轮也直接交给 Gemini。
|
|
74
|
-
|
|
75
|
-
**Turbo 模式** 通过 `agy acp` 将每份符合条件的草稿直接交给 Gemini,即使配了 OpenAI 密钥也一样。Turbo 的内置提示词要求 Gemini 主动改写。切换改写模式不影响自动、手动或关闭设置。说 **“恢复普通模式”** 即可重新使用原有的风格检查设置。
|
|
76
|
-
|
|
77
|
-
## 谁会收到对话内容
|
|
18
|
+
If Gemini returns the original wording, you see it once. If the rewrite fails, you get the draft and a short explanation.
|
|
78
19
|
|
|
79
|
-
|
|
20
|
+
## Quick start
|
|
80
21
|
|
|
81
|
-
|
|
22
|
+
Requires **macOS or Linux**, **Node.js 22.16+**, a [Codex CLI](https://developers.openai.com/codex/cli/) with plugin support, and `agy` 1.2.1+. No API key is needed—it reuses your Antigravity sign-in.
|
|
82
23
|
|
|
83
|
-
|
|
24
|
+
```sh
|
|
25
|
+
npx @kyun.si/codex-polish@beta setup
|
|
26
|
+
```
|
|
84
27
|
|
|
85
|
-
- **
|
|
86
|
-
- **Google** 收到待改回复对应的问题、原稿和项目自定义润色提示词(如有)。单次 Turbo 还会带上你这次提出的改写要求。重写之前的回答时,插件从同一聊天里取出那一轮的提问和答复。如果当时展示了两个版本,就取折叠的 GPT 原稿。附带的历史从目标回复往前数,设为 0 就只发改写所需的材料。插件跳过含疑似凭据、有附件或尚未完成的历史轮次。
|
|
28
|
+
Run the command in your project directory. Interactive setup offers to install `agy` if needed and lets you choose a rewrite mode. With the built-in prompt, **Normal** (default) can keep a clear draft as written. **Turbo** asks Gemini to rewrite each eligible draft. With T3 Code, select the Codex backend and install the plugin on the machine running it. [Other installation options](docs/technical.en.md#installation-updates-and-uninstall)
|
|
87
29
|
|
|
88
|
-
|
|
30
|
+
- **Before trusting the hook:** Ask **“Why does a cache hit still take time? Use Turbo for this answer.”** Codex sends the draft to Gemini once, without attaching earlier exchanges.
|
|
31
|
+
- **Automatic mode (default):** Trust `UserPromptSubmit` in Codex **Settings → Hooks** (`/hooks` in the CLI) and start a **new chat**. Codex then runs the polishing workflow on ordinary questions and can include recent exchanges.
|
|
89
32
|
|
|
90
|
-
|
|
33
|
+
## Useful chat prompts
|
|
91
34
|
|
|
92
|
-
|
|
35
|
+
- **“Have Gemini rewrite your last answer in two sentences.”** One-time Turbo skips the OpenAI check and rewrites the answer you picked. You can also name an earlier answer in the same chat. The next ordinary question uses your project default.
|
|
36
|
+
- **“Only polish when I ask.”** Sets the project to manual. **“Make Turbo the default for this project”** changes how it rewrites. **“Only show the polished text”** hides the comparison for one reply.
|
|
37
|
+
- **Model and prompt:** Defaults to **Gemini 4 Hydrogen** (`gemini-4-hydrogen`). Say **“Choose a rewrite model”** for live account models, or **“Set this project’s polishing prompt to: Lead with the conclusion. Use short sentences.”** (`.codex/codex-polish.prompt.md`).
|
|
93
38
|
|
|
94
|
-
|
|
39
|
+
## Privacy and checks
|
|
95
40
|
|
|
96
|
-
|
|
41
|
+
If the draft or question contains a suspected credential, Codex Polish skips that rewrite. If you ask for JSON only, a single command, or a verbatim quote, you get the requested format without a polishing label.
|
|
97
42
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
| 检查当前项目 | `npx @kyun.si/codex-polish@beta doctor` | `node scripts/install.mjs doctor` |
|
|
101
|
-
| 更新 | `npx @kyun.si/codex-polish@beta update` | 取得新版源码后运行 `node scripts/install.mjs update` |
|
|
102
|
-
| 卸载 | `npx @kyun.si/codex-polish@beta uninstall` | `node scripts/install.mjs uninstall` |
|
|
43
|
+
- **OpenAI** receives the current question, draft and any custom prompt only when the optional Normal-mode style check runs. With no `OPENAI_API_KEY`, with the check off, or if it’s unavailable, eligible drafts go directly to Gemini. Turbo always skips the check.
|
|
44
|
+
- **Google** receives the selected draft, its original question, any custom prompt, and any directions you gave for this rewrite. With a trusted hook, the plugin includes up to two completed exchanges from before that answer by default. Set history to 0–10 exchanges or say **“Leave out history this time.”** The plugin keeps no draft log of its own.
|
|
103
45
|
|
|
104
|
-
|
|
46
|
+
## Maintenance
|
|
105
47
|
|
|
106
|
-
|
|
48
|
+
| Action | Command |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| Check setup | `npx @kyun.si/codex-polish@beta doctor` |
|
|
51
|
+
| Update | `npx @kyun.si/codex-polish@beta update` |
|
|
52
|
+
| Uninstall | `npx @kyun.si/codex-polish@beta uninstall` |
|
|
107
53
|
|
|
108
|
-
-
|
|
109
|
-
- [技术说明与验证范围](docs/technical.md) · [如何评估润色效果](evaluation/README.md)
|
|
110
|
-
- [贡献指南](CONTRIBUTING.md)
|
|
111
|
-
- [安全问题反馈](SECURITY.md)
|
|
112
|
-
- [更新记录](CHANGELOG.md)
|
|
54
|
+
`doctor` checks local dependencies, project settings and hook trust. Ask **“Choose a rewrite model”** to check your Antigravity sign-in and see the available models. After an update, Codex may ask you to trust the hook again.
|
|
113
55
|
|
|
114
|
-
|
|
56
|
+
[Credentials Guide](plugins/codex-polish/skills/codex-polish-setup/references/credentials.en.md) · [Technical Reference](docs/technical.en.md) · [Evaluation](evaluation/README.en.md) · [Contributing](CONTRIBUTING.en.md) · [Security](SECURITY.en.md) · [Changelog](CHANGELOG.md) · [Apache-2.0 License](LICENSE)
|
package/SECURITY.en.md
CHANGED
package/SECURITY.md
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Codex Polish · Codex 回复润色
|
|
2
|
+
|
|
3
|
+
[English](../README.md) | **简体中文**
|
|
4
|
+
|
|
5
|
+
Codex 的回答太绕时,可以让 Gemini 换个说法。Codex 通过 Antigravity(`agy acp`)发送原稿,在聊天里显示改写后的版本。支持折叠的客户端还可以点开原稿对照。下面是一次实际改写。
|
|
6
|
+
|
|
7
|
+
**Gemini 润色版**
|
|
8
|
+
|
|
9
|
+
导出按钮目前已经修复,本地测试也已通过,不过线上还没有验证。
|
|
10
|
+
|
|
11
|
+
<details>
|
|
12
|
+
<summary>查看 GPT 原稿</summary>
|
|
13
|
+
|
|
14
|
+
关于导出按钮的修复进度,这里向你说明一下实际情况。目前导出按钮已经修复,本地测试已经通过,线上还没有验证。
|
|
15
|
+
|
|
16
|
+
</details>
|
|
17
|
+
|
|
18
|
+
Gemini 返回原文时,正文只显示一次。改写失败时,你会看到原稿和原因。
|
|
19
|
+
|
|
20
|
+
## 快速开始
|
|
21
|
+
|
|
22
|
+
支持 **macOS 和 Linux**,需要 **Node.js 22.16+**、支持插件的 [Codex CLI](https://developers.openai.com/codex/cli/),以及 `agy` 1.2.1+。无需配置 API 密钥,直接复用本机已有的 Antigravity 登录。
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
npx @kyun.si/codex-polish@beta setup
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
在项目目录运行上面的命令。交互安装时,如果缺少 `agy`,安装器会提示安装,也会让你选择改写模式,默认是**普通(Normal)**。使用内置提示词时,普通模式允许保留已经写清楚的原稿,**Turbo** 会要求 Gemini 改写每份符合条件的草稿。如果用 T3 Code,选择 Codex 后端,并在运行后端的机器上安装插件。[其他安装方式](technical.md#安装更新和卸载)
|
|
29
|
+
|
|
30
|
+
- **信任 hook 前手动试用:** 试试 **“为什么缓存命中了还要等?这条用 Turbo。”** 这次会直接把草稿交给 Gemini,不附带以前的问答。
|
|
31
|
+
- **自动模式(默认):** 在 Codex **设置 → Hooks**(CLI 输入 `/hooks`)中信任 `UserPromptSubmit` 并**新开聊天**。之后照常提问就会触发润色流程,也可以附上最近几轮对话。
|
|
32
|
+
|
|
33
|
+
## 常用聊天指令
|
|
34
|
+
|
|
35
|
+
- **“让 Gemini 把上一条改成两句话。”** 这次会跳过 OpenAI 检查,直接改写指定的答复。也可以说“重写前面讲缓存的那条”。下一条普通提问仍然用项目原来的模式。
|
|
36
|
+
- **“只在我要求时润色。”** 这会把项目设为手动触发。想让项目以后默认用 Turbo,可以说“把这个项目的默认改写模式设成 Turbo”。只想看本轮改稿,就说“只给我润色后的正文”。
|
|
37
|
+
- **自定义模型与提示词:** 默认使用 **Gemini 4 Hydrogen**(`gemini-4-hydrogen`)。可说 **“选择改写模型”** 查询账号实时可用模型,或说 **“把这个项目的润色提示词设为:先写结论。尽量用短句。”**(保存在 `.codex/codex-polish.prompt.md`)。
|
|
38
|
+
|
|
39
|
+
## 隐私与检查机制
|
|
40
|
+
|
|
41
|
+
问题或草稿里有疑似密钥时,插件会跳过这次改写。要求只输出 JSON、一条命令或逐字引文时,回复会保留指定格式,不加润色标题。
|
|
42
|
+
|
|
43
|
+
- **OpenAI** 只在普通模式启用风格检查时收到本轮问题、草稿和项目自定义提示词。没配 `OPENAI_API_KEY`、关闭检查,或检查服务不可用时,符合条件的草稿会直接发给 Gemini。Turbo 总是跳过这项检查。
|
|
44
|
+
- **Google** 收到选中的草稿、它所回答的问题、项目自定义提示词,以及你为这次改写提出的要求。信任 hook 后,默认还会附上目标答复之前最多两轮完整问答。历史可设为 0 到 10 轮,也可以说“这次不带历史”。插件自身不记录草稿日志。
|
|
45
|
+
|
|
46
|
+
## 维护与排查
|
|
47
|
+
|
|
48
|
+
| 操作 | 命令 |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| 检查配置 | `npx @kyun.si/codex-polish@beta doctor` |
|
|
51
|
+
| 更新 | `npx @kyun.si/codex-polish@beta update` |
|
|
52
|
+
| 卸载 | `npx @kyun.si/codex-polish@beta uninstall` |
|
|
53
|
+
|
|
54
|
+
`doctor` 检查本机依赖、项目设置和 hook 信任状态。要确认 Antigravity 登录是否可用,可以说 **“选择改写模型”**,查看账号当前能用的模型。插件更新后,Codex 可能提示你重新信任 hook。
|
|
55
|
+
|
|
56
|
+
[凭据与配置指南](../plugins/codex-polish/skills/codex-polish-setup/references/credentials.md) · [技术参考](technical.md) · [离线评测](../evaluation/README.md) · [参与贡献](../CONTRIBUTING.md) · [安全说明](../SECURITY.md) · [更新记录](../CHANGELOG.md) · [Apache-2.0 许可证](../LICENSE)
|
package/docs/technical.en.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Codex Polish Technical Reference
|
|
2
2
|
|
|
3
|
-
[简体中文](technical.md) · [Overview](../README.
|
|
3
|
+
[简体中文](technical.md) · [Overview](../README.md)
|
|
4
4
|
|
|
5
|
-
Codex Polish `0.0.1-beta.
|
|
5
|
+
Codex Polish `0.0.1-beta.5` is a Codex plugin for macOS and Linux. Its local scripts use built-in Node.js modules and require Node.js 22.16 or newer. The automatic hook directs Codex to follow the [polishing workflow](../plugins/codex-polish/skills/codex-polish/WORKFLOW.md) once the draft is ready and show the result in the final reply. Explicit requests use the same workflow through the [rewrite skill](../plugins/codex-polish/skills/codex-polish/SKILL.md). The [setup skill](../plugins/codex-polish/skills/codex-polish-setup/SKILL.md) checks the environment and manages project settings.
|
|
6
6
|
|
|
7
7
|
## Project Settings
|
|
8
8
|
|
|
@@ -12,7 +12,7 @@ Settings live in the nearest Git repository’s root .codex directory. All direc
|
|
|
12
12
|
| --- | --- | --- |
|
|
13
13
|
| `.codex/codex-polish.mode` | `auto` (default), `manual`, `off` | Without a saved mode, the project uses `auto`. The trusted hook triggers polishing for ordinary questions. `manual` runs only on explicit requests. `off` skips rewrites even when requested. |
|
|
14
14
|
| `.codex/codex-polish.rewrite-mode` | `normal` (default), `turbo` | Once polishing is triggered, normal uses the saved Decisions setting. Turbo sends each eligible draft directly to Gemini. |
|
|
15
|
-
| `.codex/codex-polish.model` | Model ID, default `gemini-4-hydrogen` (Gemini 4 Hydrogen) |
|
|
15
|
+
| `.codex/codex-polish.model` | Model ID, default `gemini-4-hydrogen` (Gemini 4 Hydrogen) | The model picker lists models from the signed-in Antigravity account without sending a draft or history. If the saved model becomes unavailable, that rewrite keeps the original draft. |
|
|
16
16
|
| `.codex/codex-polish.prompt.md` | UTF-8 text, defaults to the active mode’s built-in prompt | Custom text takes effect on the next rewrite and carries over to new chats in the same project. |
|
|
17
17
|
| `.codex/codex-polish.history-turns` | Integer `0`–`10`, default `2` | Maximum completed exchanges to attach to a Gemini rewrite. Use `0` to omit earlier exchanges. Saving a value above `10` returns an error. An invalid or out-of-range setting disables history. Changes apply on the next rewrite. |
|
|
18
18
|
| `.codex/codex-polish.decisions` | `auto` (default), `off` | In normal mode, `auto` enables the OpenAI style check when `OPENAI_API_KEY` is set. `off` uses ACP only. This setting is independent of the trigger mode. |
|
|
@@ -56,6 +56,8 @@ The plugin requires the official Antigravity CLI 1.2.1 or later. By default it r
|
|
|
56
56
|
|
|
57
57
|
When Gemini returns a changed reply, the final message starts with **Polished by Gemini**. In the Codex app, select “View original GPT draft” below the rewrite to expand the full draft. Select it again to collapse it. Drafts retain their Markdown formatting. When a draft contains disclosure tags or container delimiters, the expanded view shows its Markdown source so you can read those markers verbatim.
|
|
58
58
|
|
|
59
|
+
For a selected passage or a previous Gemini version, the comparison is labeled **View original text**. Only the selected text and its question are used, along with any editing directions. Additional conversation history is omitted.
|
|
60
|
+
|
|
59
61
|
If Gemini returns identical text, the reply says it left the draft unchanged and shows the text once. If polishing is skipped before sending or the ACP request ends without a complete reply, the status explains what happened and the reply shows the original. Asking for “only the polished text” shows just Gemini’s text when the rewrite completes. Requests for plain JSON, a single command, or other exact output receive the requested content without labels or status.
|
|
60
62
|
|
|
61
63
|
When a visualization reference loses its delimiters in the ACP reply and unambiguously matches a reference in the draft, the formatter restores the delimiters. The formatter still displays Gemini’s reply if a reference changes or disappears. New visualization markers with no match in the draft appear as text.
|
|
@@ -97,24 +99,28 @@ npm test
|
|
|
97
99
|
node evaluation/report.mjs evaluation/example.jsonl
|
|
98
100
|
```
|
|
99
101
|
|
|
100
|
-
The Decisions tests use mock OpenAI responses to exercise the style threshold and API error handling.
|
|
102
|
+
The Decisions tests use mock OpenAI responses to exercise the style threshold and API error handling. A simulated ACP server covers model changes, permission requests, interrupted replies and mixed session messages. The installer tests use a temporary Codex profile to install the packed archive, check hook registration, update the plugin and uninstall it.
|
|
101
103
|
|
|
102
104
|
### Verified on macOS
|
|
103
105
|
|
|
104
106
|
Using Node.js 22.16 and Antigravity CLI 1.5.12, the Codex agent selected `gemini-4-hydrogen` over ACP and requested a rewrite. The reply reported that local tests passed and production verification was still pending. The test environment had no Python on PATH and no OpenAI key. The Node.js helpers made no network requests.
|
|
105
107
|
|
|
108
|
+
In a T3 Code chat using the Codex backend, a one-time Turbo request rewrote the preceding visible answer through Gemini 4 Hydrogen. The delivered message contained the rewrite and the original draft.
|
|
109
|
+
|
|
106
110
|
### Checks still open
|
|
107
111
|
|
|
108
|
-
-
|
|
112
|
+
- Exercise the Normal route in T3 Code both with and without Decisions, using authorized, de-identified samples. Compare the tool trace with the selected model, completed output, and process cleanup. Check the status and section order in the native final message and again after reopening the chat. In clients that support folding, verify that a new reply starts with the draft collapsed. Expand it and compare each body with its source.
|
|
109
113
|
- Run Chinese drafts over 4 KiB in two chats simultaneously and check that each keeps its own text and session ID. Check fallback for an unavailable model, a permission request, cancellation, and a truncated stream.
|
|
110
114
|
- Collect at least 200 delivered real samples across the calibration and blind splits. Use the blind split to measure preference rates, severe fact reversals, missed workflows, verbatim display match, and end-to-end latency. Current thresholds are initial defaults, and `evaluation/example.jsonl` contains synthetic records (`demo_only`). See the [evaluation specification](../evaluation/README.en.md) and [contribution guide](../CONTRIBUTING.en.md).
|
|
111
115
|
|
|
112
116
|
## Installation, Updates, and Uninstall
|
|
113
117
|
|
|
114
|
-
|
|
118
|
+
Install the published npm beta with `npx @kyun.si/codex-polish@beta setup`. Replace `setup` with `update` to upgrade, `doctor` to check the current project, or `uninstall` to remove the plugin. For a source installation, run `node scripts/install.mjs setup` from the root of the GitHub checkout. The same subcommands work there. [Quick Start](../README.md#quick-start)
|
|
119
|
+
|
|
120
|
+
For a Finder install on macOS, extract the repository archive and double-click [Install Codex Polish.command](../Install%20Codex%20Polish.command). Select the project you want to configure when prompted.
|
|
115
121
|
|
|
116
122
|
Both `setup` and `update` accept `--install-agy` to install the Google CLI when needed. Updates preserve `.codex` project settings and the plugin’s enabled state. Re-running `update` with the same version replaces the build or recovers an interrupted update.
|
|
117
123
|
|
|
118
124
|
The installer registers one local marketplace per Codex profile. Updates stage a verified snapshot, atomically switch the marketplace manifest to the new snapshot and refresh the native plugin cache. If the refresh fails, the installer restores the previous snapshot and enabled state. Codex checks the installed plugin’s contents when deciding hook trust. An update to a bundled prompt or setup guide can therefore require a new approval even when the hook command is unchanged. The installer and `doctor` read the current status from `hooks/list`.
|
|
119
125
|
|
|
120
|
-
If you packed version `0.0.1-beta.
|
|
126
|
+
If you packed version `0.0.1-beta.5` locally, you can also run `npx --yes file:./kyun.si-codex-polish-0.0.1-beta.5.tgz uninstall` in the directory containing the archive. Uninstall removes the plugin and its marketplace, clears session pointers for the active Codex profile, and prints the backup path for any manually edited installation files. It keeps shared `agy` binaries and project `.codex` files.
|
package/docs/technical.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# 技术参考
|
|
2
2
|
|
|
3
|
-
[English](technical.en.md) · [项目首页](
|
|
3
|
+
[English](technical.en.md) · [项目首页](README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Codex Polish 支持 macOS 和 Linux,本地脚本使用 Node.js 22.16 或更高版本的内置模块。自动 hook 让 Codex 在原稿写完后直接执行[润色流程](../plugins/codex-polish/skills/codex-polish/WORKFLOW.md),只在最终回复中展示结果。用户点名润色时,[改写技能](../plugins/codex-polish/skills/codex-polish/SKILL.md) 执行同一份流程。[设置技能](../plugins/codex-polish/skills/codex-polish-setup/SKILL.md) 检查运行环境并保存项目设置。
|
|
6
6
|
|
|
7
7
|
## 模式、配置文件与查找规则
|
|
8
8
|
|
|
@@ -55,6 +55,8 @@ Gemini 返回的正文有改动时,Codex 在同一条最终消息中先显示
|
|
|
55
55
|
|
|
56
56
|
如果 Gemini 确实返回了相同的文字,回复会说明 Gemini 返回了原文,正文只显示一次。发送前跳过润色,或 ACP 请求未能取得完整正文时,回复说明可确认的原因,并显示原稿。明确要求“只给润色后的正文”时,改写完成后只显示 Gemini 正文。JSON、单条命令及其他逐字输出按用户要求直接交付,不加标题或状态。
|
|
57
57
|
|
|
58
|
+
用户选中一段文字或指定改写之前的 Gemini 版本时,折叠标题为“查看原文”。这种请求会附上对应的问题和本次改写要求,省略额外的历史问答。
|
|
59
|
+
|
|
58
60
|
排版时,如果 ACP 回复中的图表引用丢失了分隔符,且能明确对应原稿中的引用,插件会补回分隔符。Gemini 更改或省略图表引用时,仍显示它返回的正文。无法对应原稿的新增图表标记以文本显示。
|
|
59
61
|
|
|
60
62
|
## 发送给服务商的内容与历史限制
|
|
@@ -85,13 +87,15 @@ Google 为默认模型 `gemini-4-hydrogen` 的 Gemini API 公布了 1,048,576 to
|
|
|
85
87
|
|
|
86
88
|
## 安装、更新和卸载
|
|
87
89
|
|
|
88
|
-
|
|
90
|
+
在项目目录运行 `npx @kyun.si/codex-polish@beta setup` 即可安装。将最后一个参数换成 `update`、`doctor` 或 `uninstall` 即可更新、检查当前项目或卸载。从 GitHub 源码安装时,在仓库根目录运行 `node scripts/install.mjs setup`,其余子命令相同。[安装步骤](README.zh-CN.md#快速开始)
|
|
91
|
+
|
|
92
|
+
在 macOS 上也可以解压仓库,在 Finder 中双击[安装回复润色.command](../安装回复润色.command),按提示选择要配置的项目。
|
|
89
93
|
|
|
90
94
|
`setup` 和 `update` 支持 `--install-agy`,在缺少 Antigravity CLI 时可自动安装。更新会保留项目设置与插件启用状态。同一版本号的新构建也能用 `update` 覆盖或重试中断的更新。
|
|
91
95
|
|
|
92
96
|
安装器为每份 Codex 配置注册一个本地市场。更新时先准备并校验新快照,然后原子替换市场清单,再请 Codex 刷新插件缓存。刷新失败时会恢复原快照和启用状态。Codex 判断 hook 信任时会核对已安装插件的内容,所以即使命令没变,内置提示词或配置指南的改动也可能触发重新确认。安装器和 `doctor` 都从 `hooks/list` 读取实际状态。
|
|
93
97
|
|
|
94
|
-
手头有本地打包的 `0.0.1-beta.
|
|
98
|
+
手头有本地打包的 `0.0.1-beta.5` 版时,也可以在压缩包所在目录运行 `npx --yes file:./kyun.si-codex-polish-0.0.1-beta.5.tgz uninstall`。卸载会清理该插件与专用市场,按当前 Codex 配置清除会话指针,保留各项目的 `.codex/` 配置和共用的 `agy`,并提示被手动修改过的安装文件备份位置。
|
|
95
99
|
|
|
96
100
|
## 已验证记录与真机验收
|
|
97
101
|
|
|
@@ -106,12 +110,12 @@ node evaluation/report.mjs evaluation/example.jsonl
|
|
|
106
110
|
|
|
107
111
|
Decisions 测试使用模拟的 OpenAI 响应检查风格判定阈值和接口报错时的处理。
|
|
108
112
|
|
|
109
|
-
源码中的 `tests/fixture_acp.mjs`
|
|
113
|
+
源码中的 `tests/fixture_acp.mjs` 是专供测试的模拟服务端,覆盖正常改写、认证失败、模型缺失、生成期换模型、权限请求、取消无响应的生成、断流和跨会话消息交错,不会安装到最终产物中。安装回归测试会在本机已装好 Codex CLI 和 npm 的前提下创建一次性 Codex 配置,打出发版压缩包,验证 macOS 双击脚本以及从 `.tgz` 安装、更新、检查和卸载的全流程,并通过 Codex CLI 确认 Setup 已启用、`UserPromptSubmit` 已注册且等待信任。本地 T3 Code Beta 的 Codex 配置中也能发现 `codex-polish` 和 `codex-polish-setup`,两者都显示已启用。一次 T3 Code 实测中,用户要求用单次 Turbo 重写当前对话里可见的上一条答复。Codex 通过 ACP 调用 Gemini 4 Hydrogen,最终消息包含改稿和原稿。
|
|
110
114
|
|
|
111
115
|
在 macOS 上用 Node.js 22.16 和官方 Antigravity CLI 1.5.12 做过一次真实改写。测试环境的 PATH 中没有 Python,也没有配置 OpenAI 密钥。当前 Codex agent 通过 ACP 选中了 `gemini-4-hydrogen`,改稿保留了本地测试通过、线上尚未验证的事实。Node 辅助脚本没有向网络发出请求。
|
|
112
116
|
|
|
113
117
|
真人偏好仍待盲评。可用已获授权并去除敏感信息的真实样本完成以下验收。
|
|
114
118
|
|
|
115
|
-
1.
|
|
119
|
+
1. 在 T3 Code 的普通模式下,分别在无 OpenAI 密钥和开启 Decisions 的项目中核对工具记录,确认只有当前 agent 持有 ACP 进程、模型选择准确且结束后进程回收干净。
|
|
116
120
|
2. 用超过 4 KiB 的中文长文在两个 Codex 会话中并发运行,确认正文和会话 ID 不串线,并核对缺模型、权限请求、取消和断流时的回退表现。
|
|
117
121
|
3. 在原生最终消息和重开会话后的记录中核对状态、两版顺序及正文。在支持折叠的客户端,确认新回复里的原稿默认收起,展开后对照原稿,并将润色版与 Gemini 返回的改稿逐字核对。统计盲评偏好、严重事实反转、漏调率、选定正文的逐字一致率和端到端延迟。统计门槛要求校准集和盲评集合计至少 200 个已交付的真实样本。[验收数据格式和指标](../evaluation/README.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kyun.si/codex-polish",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.5",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Codex plugin that rewrites replies with Gemini via Antigravity ACP · 通过 Antigravity ACP 调用 Gemini 改写 Codex 回复的插件",
|
|
6
6
|
"os": [
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"scripts/native_cache.mjs",
|
|
18
18
|
"安装回复润色.command",
|
|
19
19
|
"Install Codex Polish.command",
|
|
20
|
-
"README.en.md",
|
|
21
20
|
"CONTRIBUTING.md",
|
|
22
21
|
"CONTRIBUTING.en.md",
|
|
23
22
|
"SECURITY.md",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
3. 对输入管道逐次写入一条完整的 JSON 行,然后从同一运行句柄读返回值。用执行工具在临时目录执行 `printf '%s\n' '<已安全引用的一帧>' > .acp-in`;有参数的文本始终交给 JSON 序列化器和安全引用,不拼入命令代码。若管道写入阻塞,检查官方进程是否仍在运行;若宿主取消或进程已退出,中断写入并回收。每帧通过 JSON 序列化器生成,末尾追加一个换行。正文中的换行属于 JSON 字符串;不可拆成多个请求或把正文当作 shell 命令执行。先发下列帧并等待对应的 `id`:
|
|
27
27
|
|
|
28
28
|
```json
|
|
29
|
-
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":1,"clientCapabilities":{},"clientInfo":{"name":"codex-polish","version":"0.0.1-beta.
|
|
29
|
+
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":1,"clientCapabilities":{},"clientInfo":{"name":"codex-polish","version":"0.0.1-beta.5"}}}
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
确认 `result.protocolVersion == 1`。生产中若服务端提供 `agentInfo.name`,应与官方 `Antigravity ACP Server` 一致,身份或协议版本冲突记 `acp_protocol_error`。
|
|
@@ -6,13 +6,13 @@ Run interactive `setup` from your project directory. Use **↑ / ↓** to select
|
|
|
6
6
|
|
|
7
7
|
## Use your Antigravity sign-in
|
|
8
8
|
|
|
9
|
-
1. Install the plugin on the machine that runs Codex, using the same system account. It looks for `agy` on the Codex process’s PATH and then at `~/.local/bin/agy`. On a first install from Finder or an interactive terminal, you can accept the offer to install Google’s official CLI or skip it. For an unattended install or to add the CLI later, run `node scripts/install.mjs setup --install-agy
|
|
9
|
+
1. Install the plugin on the machine that runs Codex, using the same system account. It looks for `agy` on the Codex process’s PATH and then at `~/.local/bin/agy`. On a first install from Finder or an interactive terminal, you can accept the offer to install Google’s official CLI or skip it. For an unattended install or to add the CLI later, run `npx @kyun.si/codex-polish@beta setup --install-agy`. From a source checkout, use `node scripts/install.mjs setup --install-agy`. You can also install it directly from Google. [Antigravity installation guide](https://antigravity.google/docs/getting-started/?tab=cli)
|
|
10
10
|
2. The plugin uses your existing Antigravity sign-in. If Antigravity requests authentication, run `agy` in your terminal and sign in. If your shell can’t find the installed CLI, open `~/.local/bin/agy` directly.
|
|
11
|
-
3. Projects default to automatic polishing.
|
|
11
|
+
3. Projects default to automatic polishing. When you ask to rewrite an earlier answer, Google receives that draft, the question it answers and any directions for this rewrite. The plugin sends the text as written, including code, commands, paths and any custom project prompt. By default it also includes up to two exchanges from before the selected answer. In Codex **Settings → Hooks** (`/hooks` in the CLI), trust the plugin’s `UserPromptSubmit` hook. Start a fresh project chat and ask **“Explain what DNS does in one sentence.”**
|
|
12
12
|
|
|
13
13
|
Say **“Only polish when I ask”** for manual mode or **“Turn off Codex Polish”** to disable polishing. Before trusting the hook, you can still ask explicitly to polish a reply without including earlier exchanges. The default setup works without API keys. If Codex runs on a remote machine, follow these steps there.
|
|
14
14
|
|
|
15
|
-
Say **“Check Codex Polish setup”** to inspect the local configuration
|
|
15
|
+
Say **“Check Codex Polish setup”** to inspect the local configuration and **“Test the ACP connection”** to check the live connection. **“Choose a rewrite model”** lists the models your account can use. Neither live check sends a draft.
|
|
16
16
|
|
|
17
17
|
## Optional OpenAI style check
|
|
18
18
|
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
[English](credentials.en.md)
|
|
4
4
|
|
|
5
|
-
在项目目录交互运行 `setup`,用 **↑ / ↓** 选择改写模式,按 **回车** 确认。默认选中 **普通(Normal)**,可使用下文的 OpenAI 风格检查。**Turbo** 跳过 OpenAI,直接让 Gemini 改写符合条件的草稿。也可以在项目聊天里说
|
|
5
|
+
在项目目录交互运行 `setup`,用 **↑ / ↓** 选择改写模式,按 **回车** 确认。默认选中 **普通(Normal)**,可使用下文的 OpenAI 风格检查。**Turbo** 跳过 OpenAI,直接让 Gemini 改写符合条件的草稿。也可以在项目聊天里说 **“配置回复润色”**,然后点选模式。如果聊天只支持文字,回复模式名即可。项目会记住你的选择。接着可以选默认的 Gemini 4 Hydrogen,或让 Codex 查询你的 Antigravity 账号可用的模型。只有查询账号模型才会启动 Codex 会话。
|
|
6
6
|
|
|
7
7
|
## 准备 Antigravity
|
|
8
8
|
|
|
9
|
-
在实际运行 Codex 的机器上,用同一个系统账户安装插件。插件先在 Codex 的 PATH 里找 `agy`,再查 `~/.local/bin/agy`。首次双击安装或在终端交互运行 `setup` 时,如果缺少 `agy`,你可以同意安装 Google 官方 CLI
|
|
9
|
+
在实际运行 Codex 的机器上,用同一个系统账户安装插件。插件先在 Codex 的 PATH 里找 `agy`,再查 `~/.local/bin/agy`。首次双击安装或在终端交互运行 `setup` 时,如果缺少 `agy`,你可以同意安装 Google 官方 CLI,也可以跳过。无人值守安装或之后想补装时,运行 `npx @kyun.si/codex-polish@beta setup --install-agy`。用源码安装时,在仓库里运行 `node scripts/install.mjs setup --install-agy`。也可以按 Google 的指南单独安装。[官方 CLI 安装指南](https://antigravity.google/docs/getting-started/?tab=cli)
|
|
10
10
|
|
|
11
11
|
只有 Antigravity 提示需要登录时,才需要在自己的终端运行 `agy` 登录。如果终端找不到命令,可以直接运行 `~/.local/bin/agy`。登录后回 Codex 再试一次改写。[ACP 认证说明](https://antigravity.google/docs/ide/extensions/acp#authentication)
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
项目默认自动润色。改写已有答复时,Google 收到的是那条答复、它所回答的问题,以及你这次提出的改写要求。改写材料按原文发送,包括其中的代码、命令、路径和已设置的自定义提示词。默认还会附上目标答复之前最多 2 轮问答。在 Codex 的 **设置 → Hooks**(CLI 输入 `/hooks`)里信任插件的 `UserPromptSubmit`,再开一个项目聊天,问 **“用一句话解释 DNS。”** 如果想自己决定何时润色,可以说 **“只在我要求时润色”**。信任 hook 前也可以点名润色本轮问答。想停用就说 **“关闭回复润色”**。
|
|
14
14
|
|
|
15
|
-
## 选配 OpenAI
|
|
15
|
+
## 选配 OpenAI 风格检查
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
在普通模式中,配好 `OPENAI_API_KEY` 后,OpenAI 可以在润色前判断草稿是否需要改写。没有密钥时,草稿直接交给 Gemini。要把每份符合条件的草稿直接交给 Gemini,可以说 **“切换到 Turbo 模式”**。Turbo 跳过 OpenAI,即使配了密钥也一样。说 **“恢复普通模式”** 即可重新使用项目的 Decisions 设置。OpenAI 只收到本轮问题、草稿和项目已设置的自定义润色提示词,用来判断是否需要改写。项目的历史轮数仅用于 Gemini 改写。在项目里说 **“有密钥时用 OpenAI 检查”** 可以恢复这个默认设置。要单独关闭本项目的风格检查,可以说 **“这个项目只用 Gemini 改写”**。
|
|
18
18
|
|
|
19
19
|
要启用 Decisions,可以直接用自己已有的项目密钥,也可以按下面的步骤新建一个。
|
|
20
20
|
|
|
@@ -54,3 +54,5 @@ printf 'Gemini API key(隐藏输入):'; IFS= read -r -s GEMINI_API_KEY </d
|
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
用企业身份时,设置 `CODEX_POLISH_AGY_AUTH=agent-platform`,并由管理员给运行环境配好 Application Default Credentials(ADC)、Google Cloud 项目和区域。这三种方式都通过同一个官方 `agy acp` 进程提交改写。[Antigravity ACP 认证](https://antigravity.google/docs/ide/extensions/acp#authentication)
|
|
57
|
+
|
|
58
|
+
更换身份后,新开项目聊天,说 **“选择改写模型”**。成功列出模型表示当前账号已连通,这一步只读取模型列表。
|
package/README.en.md
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
# Codex Polish
|
|
2
|
-
|
|
3
|
-
**English** | **[简体中文](README.md)**
|
|
4
|
-
|
|
5
|
-
Codex Polish uses Gemini through Antigravity’s `agy acp` to polish Codex’s final replies. When Gemini returns a rewrite, the chat shows it first. In clients that support collapsible sections, select “View original GPT draft” below it to read the full draft. Projects default to automatic mode. Once you trust the plugin hook and start a new chat, ordinary questions trigger polishing.
|
|
6
|
-
|
|
7
|
-
In one test, Codex had to report that the export button was fixed and had passed local tests. A production check was still pending. Both texts below are translated from that test.
|
|
8
|
-
|
|
9
|
-
**Polished by Gemini**
|
|
10
|
-
|
|
11
|
-
The export button is fixed and passed local tests. It still needs to be checked in production.
|
|
12
|
-
|
|
13
|
-
<details>
|
|
14
|
-
<summary>View original GPT draft</summary>
|
|
15
|
-
|
|
16
|
-
Regarding progress with the export button fix, let me explain the actual situation. The export button has now been fixed, local tests have passed, and production verification has not yet been done.
|
|
17
|
-
|
|
18
|
-
</details>
|
|
19
|
-
|
|
20
|
-
To see just the rewrite for one reply, say **“Only show the polished text.”** If you ask for plain JSON, a command, or a verbatim quotation, the reply keeps that exact format.
|
|
21
|
-
|
|
22
|
-
## Use Turbo for one reply
|
|
23
|
-
|
|
24
|
-
You can ask for a single Turbo rewrite even in Normal mode. Say which answer you mean and how you’d like it to read.
|
|
25
|
-
|
|
26
|
-
- **“Why does a cache hit still take time? Use Turbo for this answer.”** Codex drafts an answer to your question and gives that draft to Gemini.
|
|
27
|
-
- **“I couldn’t follow your last reply. Say it another way and give me the conclusion first.”** Gemini rewrites the previous answer. You can also point to an earlier one, for example, “Have Gemini rewrite the answer about caching.”
|
|
28
|
-
|
|
29
|
-
This skips the OpenAI check for one rewrite. Your next ordinary question uses the project’s usual mode. To use Turbo from now on, say **“Make Turbo the default rewrite mode for this project.”**
|
|
30
|
-
|
|
31
|
-
## Quick Start
|
|
32
|
-
|
|
33
|
-
You need macOS or Linux, Node.js 22.16+, and a [Codex CLI](https://developers.openai.com/codex/cli/) with plugin support. In T3 Code, select Codex and install the plugin on the machine running that backend.
|
|
34
|
-
|
|
35
|
-
1. **Install the plugin from your project directory.** Use this command to install the beta from npm.
|
|
36
|
-
|
|
37
|
-
```sh
|
|
38
|
-
npx @kyun.si/codex-polish@beta setup
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
You can also clone the repository into your home directory and run its installer from your current project.
|
|
42
|
-
|
|
43
|
-
```sh
|
|
44
|
-
git clone https://github.com/mreasonyang/codex-polish.git ~/codex-polish
|
|
45
|
-
node ~/codex-polish/scripts/install.mjs setup
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
On first interactive setup, use **↑ / ↓** to select a rewrite mode and press **Enter** to confirm. **Normal** is selected by default and can ask OpenAI whether a draft needs editing. **Turbo** skips OpenAI and sends eligible drafts directly to Gemini for rewriting. You can set when polishing runs separately. Setup reuses the project's saved choice. First setup also offers Gemini 4 Hydrogen or an account model list fetched by Codex. Choices persist at the repository root. Unattended setup uses the defaults.
|
|
49
|
-
|
|
50
|
-
On macOS, you can also download and extract the GitHub repository, then double-click [Install Codex Polish.command](Install%20Codex%20Polish.command). At the project directory prompt, enter the path or press Enter to choose later. Say **“Set up Codex Polish”** in a project chat to select **Normal** or **Turbo** on first setup. In a text-only chat, reply with the mode name.
|
|
51
|
-
|
|
52
|
-
2. **Connect Gemini.** Setup reuses the Antigravity CLI (`agy` 1.2.1+) if it finds it. If it offers to install the official CLI, press Enter to accept. For unattended installation, add `--install-agy` to either `setup` command above. Your existing Antigravity sign-in works over ACP. If asked to sign in, run `agy` on the machine that runs Codex.
|
|
53
|
-
3. **Trust the hook and try an ordinary question.** If the OpenAI style check is enabled, OpenAI receives only your current question, draft, and any custom polishing prompt. When Gemini rewrites, Google receives those items plus up to two earlier completed exchanges by default. In Codex **Settings → Hooks** (`/hooks` in the CLI), trust the plugin’s `UserPromptSubmit` hook. Start a new chat in your project and ask **“Explain what DNS does in one sentence.”** To switch the project to manual mode, say **“Only polish when I ask.”**
|
|
54
|
-
|
|
55
|
-
## Project Settings
|
|
56
|
-
|
|
57
|
-
Settings are saved in each project’s `.codex/` directory and carry over to new chats in that project. Say **"Show Codex Polish settings"** to inspect them.
|
|
58
|
-
|
|
59
|
-
| Setting | Default | Natural prompt |
|
|
60
|
-
| --- | --- | --- |
|
|
61
|
-
| When to polish | Automatic (requires a trusted hook) | "Only polish when I ask", "Turn off Codex Polish", or "Polish automatically in this project" |
|
|
62
|
-
| Rewrite mode | Normal | “Switch to turbo mode” or “Switch back to normal mode” |
|
|
63
|
-
| Gemini model | Gemini 4 Hydrogen | "Choose a rewrite model" (lists runtime account options, which can differ) or "Restore the default rewrite model" |
|
|
64
|
-
| Polishing prompt | Built-in prompt for the current mode | “Show the polishing prompt”, “Set the polishing prompt”, or “Restore the default polishing prompt” |
|
|
65
|
-
| History for Gemini rewrites | Up to 2 earlier question-and-answer pairs | “Include the last 5 exchanges” or “Don't include any conversation history when polishing replies”. Choose 0 to 10 exchanges. Say “Leave out history this time” for one rewrite. |
|
|
66
|
-
| OpenAI style check before rewriting | On in normal mode when `OPENAI_API_KEY` is set | "Use Gemini only" or "Use the OpenAI style check when a key is available" |
|
|
67
|
-
| Language | Auto (`zh` or `en`) | "Use English for plugin settings", "Use Chinese for plugin settings", or "Detect the plugin language automatically" |
|
|
68
|
-
|
|
69
|
-
For example, say **“Set this project's polishing prompt to: Lead with the conclusion. Use short sentences. Keep the technical terms.”** On the next rewrite, those three sentences become Gemini’s full project prompt in both Normal and Turbo. Restoring the default brings back the built-in prompt for the current mode. You can also edit `.codex/codex-polish.prompt.md` directly. Viewing, saving, and restoring the prompt all work locally without calling a polishing model. A request like “Keep this reply short” applies only to that reply.
|
|
70
|
-
|
|
71
|
-
**Normal mode** is the default. With the style check enabled, OpenAI decides whether the draft needs editing. Eligible drafts go straight to Gemini when the check is off or there is no key. If the key is invalid or OpenAI is unavailable, Gemini handles the rewrite directly.
|
|
72
|
-
|
|
73
|
-
**Turbo mode** sends every eligible draft directly to Gemini through `agy acp`, even with an OpenAI key. Turbo’s built-in prompt asks Gemini to actively rewrite the draft. Your automatic, manual, or off setting still controls when polishing runs. Say **“Switch back to normal mode”** to resume your saved style-check setting.
|
|
74
|
-
|
|
75
|
-
## Privacy and Hooks
|
|
76
|
-
|
|
77
|
-
In automatic mode, the trusted `UserPromptSubmit` hook reminds Codex to polish the final reply to an ordinary question. Before trusting the hook, you can still say **“Polish this reply”** to polish the current draft without sharing earlier exchanges. In manual mode, only explicit requests trigger polishing. Including history still requires the trusted hook. Turning polishing off skips even explicit requests.
|
|
78
|
-
|
|
79
|
-
The plugin checks the current question and draft locally before sending them. It skips polishing if it detects a possible credential or you request exact output such as JSON only or a single command.
|
|
80
|
-
|
|
81
|
-
The plugin sends the question and draft as written, including code, commands, paths, links, and numbers.
|
|
82
|
-
|
|
83
|
-
- **OpenAI** receives only the current question, draft, and any custom polishing prompt when the optional style check runs.
|
|
84
|
-
- **Google** receives the question the selected reply answers, its draft, and any custom project prompt. A one-time Turbo request can include your directions for that rewrite. For an earlier answer, the plugin takes the question and answer from that turn in the same chat, using the folded GPT draft if both versions were shown. Optional history comes from before the selected reply. Set it to zero to send only the material for the rewrite. The plugin skips incomplete exchanges and those with detected credentials or attachments.
|
|
85
|
-
|
|
86
|
-
If the style check exceeds OpenAI’s 256 KiB input limit, the plugin sends the full material directly to Gemini.
|
|
87
|
-
|
|
88
|
-
The plugin writes no draft logs of its own. Codex, your providers, and any global `agy` hooks have their own settings.
|
|
89
|
-
|
|
90
|
-
## If a Reply Stays Unchanged
|
|
91
|
-
|
|
92
|
-
Normal and Turbo both display the complete text Gemini returns over ACP. If Gemini returns the same text, the reply says so and shows it once. If the plugin skips polishing before sending the draft or the ACP request ends without a complete reply, you see the reason and the original GPT draft. Ask **“Why wasn’t my last reply polished?”** for that turn’s reason, or **“Check Codex Polish setup”** to troubleshoot the connection.
|
|
93
|
-
|
|
94
|
-
## Check, Update, or Uninstall
|
|
95
|
-
|
|
96
|
-
| Action | From the npm beta | From the source directory |
|
|
97
|
-
| --- | --- | --- |
|
|
98
|
-
| Check the current project | `npx @kyun.si/codex-polish@beta doctor` | `node scripts/install.mjs doctor` |
|
|
99
|
-
| Update | `npx @kyun.si/codex-polish@beta update` | Get the latest source, then run `node scripts/install.mjs update` |
|
|
100
|
-
| Uninstall | `npx @kyun.si/codex-polish@beta uninstall` | `node scripts/install.mjs uninstall` |
|
|
101
|
-
|
|
102
|
-
Updates preserve project settings and the plugin’s enabled state. The installer checks hook trust with Codex. A change to the installed plugin, including a bundled Gemini prompt or setup guide, can require approval again. If prompted, open **Settings → Hooks**, review `UserPromptSubmit`, trust it and start a new chat. Reinstalling identical plugin content preserves trust. Uninstalling keeps your `.codex` project settings and shared `agy` binary.
|
|
103
|
-
|
|
104
|
-
## References and License
|
|
105
|
-
|
|
106
|
-
- [Credentials and Sign-In Guide](plugins/codex-polish/skills/codex-polish-setup/references/credentials.en.md)
|
|
107
|
-
- [Technical Reference](docs/technical.en.md) · [How to Evaluate Rewrites](evaluation/README.en.md)
|
|
108
|
-
- [Contributing](CONTRIBUTING.en.md)
|
|
109
|
-
- [Security Policy](SECURITY.en.md)
|
|
110
|
-
- [Changelog](CHANGELOG.md)
|
|
111
|
-
|
|
112
|
-
Codex Polish is licensed under the [Apache License 2.0](LICENSE).
|