@kyun.si/codex-polish 0.0.1-beta.3 → 0.0.1-beta.4
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 +15 -0
- package/CONTRIBUTING.en.md +6 -6
- package/CONTRIBUTING.md +6 -6
- package/README.en.md +45 -17
- package/README.md +45 -17
- package/SECURITY.en.md +5 -3
- package/SECURITY.md +4 -2
- package/docs/technical.en.md +57 -41
- package/docs/technical.md +54 -34
- package/evaluation/README.en.md +1 -1
- package/evaluation/README.md +1 -1
- package/package.json +1 -1
- package/plugins/codex-polish/.codex-plugin/plugin.json +1 -1
- package/plugins/codex-polish/hooks/editor_prompt.mjs +51 -0
- package/plugins/codex-polish/hooks/history.mjs +107 -66
- package/plugins/codex-polish/hooks/preferences.mjs +137 -114
- package/plugins/codex-polish/hooks/project_setting.mjs +40 -30
- package/plugins/codex-polish/hooks/recovery.mjs +2 -69
- package/plugins/codex-polish/hooks/rewrite_mode.mjs +19 -0
- package/plugins/codex-polish/skills/codex-polish/SKILL.md +3 -33
- package/plugins/codex-polish/skills/codex-polish/WORKFLOW.md +47 -0
- package/plugins/codex-polish/skills/codex-polish/references/acp.md +30 -17
- package/plugins/codex-polish/skills/codex-polish/references/codex-polish-editor.md +4 -2
- package/plugins/codex-polish/skills/codex-polish/scripts/acp_models.mjs +31 -6
- package/plugins/codex-polish/skills/codex-polish/scripts/acp_payload.mjs +55 -30
- package/plugins/codex-polish/skills/codex-polish/scripts/cli_io.mjs +2 -2
- package/plugins/codex-polish/skills/codex-polish/scripts/decisions.mjs +49 -58
- package/plugins/codex-polish/skills/codex-polish/scripts/editor_role.mjs +48 -0
- package/plugins/codex-polish/skills/codex-polish/scripts/format_reply.mjs +171 -0
- package/plugins/codex-polish/skills/codex-polish/scripts/previous_reply.mjs +31 -0
- package/plugins/codex-polish/skills/codex-polish/scripts/rewrite_material.mjs +28 -0
- package/plugins/codex-polish/skills/codex-polish/scripts/text_guard.mjs +65 -166
- package/plugins/codex-polish/skills/codex-polish-setup/SKILL.md +37 -11
- package/plugins/codex-polish/skills/codex-polish-setup/references/credentials.en.md +8 -6
- package/plugins/codex-polish/skills/codex-polish-setup/references/credentials.md +3 -3
- package/scripts/install.mjs +389 -123
- package/scripts/native_cache.mjs +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
[中文使用说明](README.md) · [English README](README.en.md)
|
|
4
4
|
|
|
5
|
+
## 0.0.1-beta.4
|
|
6
|
+
|
|
7
|
+
- 在普通模式也可以说“这题用 Turbo”或“让 Gemini 重写刚才那条”。单次请求直接走 Gemini,可以附上具体改法。下一条普通提问继续使用项目默认模式。
|
|
8
|
+
- A one-time Turbo request can rewrite the current draft or a specific earlier answer in the same chat. Give Gemini any directions for that rewrite. The next ordinary question uses the project's saved mode.
|
|
9
|
+
- 新增项目改写模式。普通模式(默认)沿用原有流程,Turbo 会跳过 OpenAI,将每份符合条件的草稿直接交给 Gemini,可直接说“切换到 Turbo 模式”或“恢复普通模式”。
|
|
10
|
+
- Projects can now choose a rewrite mode. Normal (default) keeps the existing workflow. Turbo skips OpenAI and sends every eligible draft directly to Gemini. Say “Switch to turbo mode” or “Switch back to normal mode”.
|
|
11
|
+
- OpenAI 风格检查只使用本轮问题、草稿和已设置的自定义润色提示词。历史问答仅在 Gemini 改写时附带,默认最多 2 轮,可选 0 到 10 轮。可以要求本轮不带历史。OpenAI 检查不可用或材料超过该接口限制时,直接交给 Gemini。
|
|
12
|
+
- The OpenAI style check uses only the current question, draft, and any custom polishing prompt. History goes only to Gemini when it rewrites. Projects can choose 0–10 exchanges (default 2), or omit history for one rewrite. When the OpenAI check is unavailable or its input limit is exceeded, the draft goes directly to Gemini.
|
|
13
|
+
- 可以在项目里说“查看润色提示词”“设置润色提示词”或“恢复默认润色提示词”。自定义提示词逐字保存在 `.codex/codex-polish.prompt.md`,供同一项目后续聊天使用。普通和 Turbo 模式都将原文作为 Gemini 的全部编辑指令。可选的 OpenAI 风格检查也会参考它。
|
|
14
|
+
- Projects can show, set, or restore the default polishing prompt in chat. Custom prompts are saved verbatim in `.codex/codex-polish.prompt.md` for future chats in the project. Normal and Turbo both use the saved text as Gemini’s complete editing prompt. The optional OpenAI style check also considers it.
|
|
15
|
+
- Gemini 返回改稿后,在支持折叠的客户端,完整原稿默认收起。点击润色版下方的“查看 GPT 原稿”即可对照。
|
|
16
|
+
- When a rewrite changes the text, clients that support folding show the full draft collapsed. Select “View original GPT draft” below the rewrite to compare.
|
|
17
|
+
- Gemini 和可选的 OpenAI 风格检查现在直接接收本轮问题和草稿原文,包括代码、路径、链接和数值。OpenAI 只在改写前判断草稿是否需要润色。本轮材料含疑似凭据或用户要求固定格式时,插件会在发送前跳过。两种模式收到 Gemini 的完整回复后只做显示排版。Gemini 返回原文时,正文只显示一次。
|
|
18
|
+
- Gemini and the optional OpenAI style check now receive the current question and draft as written, including code, paths, links, and numbers. OpenAI is called only before rewriting to decide whether the draft needs editing. The plugin skips suspected credentials and exact-output requests before sending. Both modes now format Gemini’s complete reply for display. If Gemini returns the original text, it appears once.
|
|
19
|
+
|
|
5
20
|
## 0.0.1-beta.3
|
|
6
21
|
|
|
7
22
|
- 聊天里先显示 Gemini 润色版,再附上完整的 GPT 原稿。Gemini 返回原文时会注明,正文只显示一次。跳过或失败时会说明原因并保留原稿。可以单独要求只看润色后的正文。
|
package/CONTRIBUTING.en.md
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
[简体中文](CONTRIBUTING.md)
|
|
4
4
|
|
|
5
|
-
For installation, see the [project README](README.en.md). For the
|
|
5
|
+
For installation, see the [project README](README.en.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
|
|
|
9
9
|
- `scripts/install.mjs` and the `.command` launchers handle installation, updates, status checks, uninstallation, and local marketplace registration.
|
|
10
|
-
- `plugins/codex-polish/` contains the plugin manifest, the `UserPromptSubmit` hook, and two skills. `codex-polish`
|
|
10
|
+
- `plugins/codex-polish/` contains the plugin manifest, the `UserPromptSubmit` hook, and two skills. `codex-polish` checks rewrite eligibility locally, optionally asks OpenAI Decisions whether to edit the draft, runs rewrites through `agy acp`, and formats Gemini’s complete reply for display. `codex-polish-setup` manages `.codex/codex-polish.*` settings, runtime model discovery, diagnostics, and the [credential guide](plugins/codex-polish/skills/codex-polish-setup/references/credentials.en.md).
|
|
11
11
|
- The full source tree includes the regression suite in `tests/` and the evaluation script and synthetic samples in `evaluation/`. See the [evaluation guide](evaluation/README.en.md).
|
|
12
12
|
- When updating user-facing prompts or documentation, update both English and Chinese.
|
|
13
13
|
|
|
@@ -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.4` of `@kyun.si/codex-polish` to `dist/kyun.si-codex-polish-0.0.1-beta.4.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.4`:
|
|
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.4
|
|
43
|
+
git push origin v0.0.1-beta.4
|
|
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
|
+
安装和使用请看[项目说明](README.md)。改动插件前,可以先查[技术参考](docs/technical.md),了解插件何时发送草稿、如何显示回复。
|
|
6
6
|
|
|
7
7
|
## 改哪里
|
|
8
8
|
|
|
9
9
|
- `scripts/install.mjs` 和两个 `.command` 启动脚本负责安装、更新、环境检查和卸载。
|
|
10
|
-
- `plugins/codex-polish/` 里有插件清单、钩子和两个技能。`codex-polish`
|
|
10
|
+
- `plugins/codex-polish/` 里有插件清单、钩子和两个技能。`codex-polish` 通过可选的 OpenAI 风格检查判断是否需要润色,经 ACP 把草稿交给 Gemini,并排版显示完整回复。`codex-polish-setup` 负责设置、选择模型和检查环境。改动用户提示时,请一起更新中英文。
|
|
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.4` 版打包为 `dist/kyun.si-codex-polish-0.0.1-beta.4.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.4` 时运行:
|
|
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.4
|
|
42
|
+
git push origin v0.0.1-beta.4
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
GitHub Actions 会测试这个标签的代码,将安装包发布到 npm 的 `beta` 标签,并创建 GitHub 预发布版。如果某一步失败,可以在 Actions 中选择发布工作流,用已有标签重试。
|
package/README.en.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**English** | **[简体中文](README.md)**
|
|
4
4
|
|
|
5
|
-
Codex Polish uses Gemini through Antigravity’s `agy acp` to polish Codex’s final replies. When
|
|
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
6
|
|
|
7
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
8
|
|
|
@@ -10,34 +10,47 @@ In one test, Codex had to report that the export button was fixed and had passed
|
|
|
10
10
|
|
|
11
11
|
The export button is fixed and passed local tests. It still needs to be checked in production.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
<details>
|
|
14
|
+
<summary>View original GPT draft</summary>
|
|
14
15
|
|
|
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.
|
|
16
17
|
|
|
18
|
+
</details>
|
|
19
|
+
|
|
17
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.
|
|
18
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
|
+
|
|
19
31
|
## Quick Start
|
|
20
32
|
|
|
21
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.
|
|
22
34
|
|
|
23
|
-
1. **Install the plugin.** Use this command to install the beta from npm.
|
|
35
|
+
1. **Install the plugin from your project directory.** Use this command to install the beta from npm.
|
|
24
36
|
|
|
25
37
|
```sh
|
|
26
38
|
npx @kyun.si/codex-polish@beta setup
|
|
27
39
|
```
|
|
28
40
|
|
|
29
|
-
You can also clone the repository and run
|
|
41
|
+
You can also clone the repository into your home directory and run its installer from your current project.
|
|
30
42
|
|
|
31
43
|
```sh
|
|
32
|
-
git clone https://github.com/mreasonyang/codex-polish.git
|
|
33
|
-
|
|
34
|
-
node scripts/install.mjs setup
|
|
44
|
+
git clone https://github.com/mreasonyang/codex-polish.git ~/codex-polish
|
|
45
|
+
node ~/codex-polish/scripts/install.mjs setup
|
|
35
46
|
```
|
|
36
47
|
|
|
37
|
-
On
|
|
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.
|
|
38
51
|
|
|
39
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.
|
|
40
|
-
3. **Trust the hook and try an ordinary question.**
|
|
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.”**
|
|
41
54
|
|
|
42
55
|
## Project Settings
|
|
43
56
|
|
|
@@ -45,23 +58,38 @@ Settings are saved in each project’s `.codex/` directory and carry over to new
|
|
|
45
58
|
|
|
46
59
|
| Setting | Default | Natural prompt |
|
|
47
60
|
| --- | --- | --- |
|
|
48
|
-
|
|
|
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” |
|
|
49
63
|
| Gemini model | Gemini 4 Hydrogen | "Choose a rewrite model" (lists runtime account options, which can differ) or "Restore the default rewrite model" |
|
|
50
|
-
|
|
|
51
|
-
|
|
|
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" |
|
|
52
67
|
| Language | Auto (`zh` or `en`) | "Use English for plugin settings", "Use Chinese for plugin settings", or "Detect the plugin language automatically" |
|
|
53
68
|
|
|
54
|
-
|
|
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.
|
|
55
74
|
|
|
56
75
|
## Privacy and Hooks
|
|
57
76
|
|
|
58
|
-
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
|
|
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.
|
|
59
87
|
|
|
60
|
-
|
|
88
|
+
The plugin writes no draft logs of its own. Codex, your providers, and any global `agy` hooks have their own settings.
|
|
61
89
|
|
|
62
90
|
## If a Reply Stays Unchanged
|
|
63
91
|
|
|
64
|
-
If Gemini returns the same text, the reply says
|
|
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.
|
|
65
93
|
|
|
66
94
|
## Check, Update, or Uninstall
|
|
67
95
|
|
|
@@ -71,7 +99,7 @@ If Gemini returns the same text, the reply says it left the draft unchanged and
|
|
|
71
99
|
| Update | `npx @kyun.si/codex-polish@beta update` | Get the latest source, then run `node scripts/install.mjs update` |
|
|
72
100
|
| Uninstall | `npx @kyun.si/codex-polish@beta uninstall` | `node scripts/install.mjs uninstall` |
|
|
73
101
|
|
|
74
|
-
Updates preserve
|
|
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.
|
|
75
103
|
|
|
76
104
|
## References and License
|
|
77
105
|
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**简体中文** | [English](README.en.md)
|
|
4
4
|
|
|
5
|
-
Codex Polish 通过 Antigravity 的 `agy acp` 请 Gemini 润色 Codex
|
|
5
|
+
Codex Polish 通过 Antigravity 的 `agy acp` 请 Gemini 润色 Codex 的最终回复。Gemini 返回改稿后,聊天里先显示润色版。在支持折叠的客户端,点下方的“查看 GPT 原稿”就能展开完整原稿。项目默认使用自动模式,信任插件的 hook 并新开聊天后,像平常一样提问即可触发。
|
|
6
6
|
|
|
7
7
|
## 改写示例
|
|
8
8
|
|
|
@@ -12,34 +12,47 @@ Codex Polish 通过 Antigravity 的 `agy acp` 请 Gemini 润色 Codex 的最终
|
|
|
12
12
|
|
|
13
13
|
导出按钮目前已经修复,本地测试也已通过,不过线上还没有验证。
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
<details>
|
|
16
|
+
<summary>查看 GPT 原稿</summary>
|
|
16
17
|
|
|
17
18
|
关于导出按钮的修复进度,这里向你说明一下实际情况。目前导出按钮已经修复,本地测试已经通过,线上还没有验证。
|
|
18
19
|
|
|
20
|
+
</details>
|
|
21
|
+
|
|
19
22
|
这轮只想看改稿,可以说 **“只给我润色后的正文”**。如果指定只输出 JSON、命令或逐字引文,回复会遵守指定格式。
|
|
20
23
|
|
|
24
|
+
## 只让 Gemini 重写一次
|
|
25
|
+
|
|
26
|
+
即使项目用的是普通模式,也可以在聊天里直接指定这次用 Turbo。用自己的话说明要改哪条,以及想怎么改就行。
|
|
27
|
+
|
|
28
|
+
- **“为什么缓存命中了还要等?这条用 Turbo。”** Codex 先回答这个问题,再把这份草稿交给 Gemini。
|
|
29
|
+
- **“你刚才那条我没看懂,换个说法,先说结论。”** Gemini 直接重写上一条回答。你也可以指明更早的一条,比如“让 Gemini 重写前面解释缓存的那条”。
|
|
30
|
+
|
|
31
|
+
这一次会跳过 OpenAI 检查。下一条普通提问继续用项目原先的模式。如果希望以后都用 Turbo,可以说 **“把这个项目的默认改写模式设成 Turbo”**。
|
|
32
|
+
|
|
21
33
|
## 三步快速开始
|
|
22
34
|
|
|
23
35
|
支持 macOS 和 Linux。需要 Node.js 22.16 或更新版本,以及支持插件的 [Codex CLI](https://developers.openai.com/codex/cli/)。如果你用 T3 Code,选择 Codex 后端,并把插件装在运行该后端的机器上。
|
|
24
36
|
|
|
25
|
-
1.
|
|
37
|
+
1. **在要润色的项目目录安装插件。** 用下面的命令安装 npm 上的测试版。
|
|
26
38
|
|
|
27
39
|
```sh
|
|
28
40
|
npx @kyun.si/codex-polish@beta setup
|
|
29
41
|
```
|
|
30
42
|
|
|
31
|
-
|
|
43
|
+
也可以将源码下载到家目录,在当前项目运行安装脚本。
|
|
32
44
|
|
|
33
45
|
```sh
|
|
34
|
-
git clone https://github.com/mreasonyang/codex-polish.git
|
|
35
|
-
|
|
36
|
-
node scripts/install.mjs setup
|
|
46
|
+
git clone https://github.com/mreasonyang/codex-polish.git ~/codex-polish
|
|
47
|
+
node ~/codex-polish/scripts/install.mjs setup
|
|
37
48
|
```
|
|
38
49
|
|
|
39
|
-
|
|
50
|
+
首次交互配置时,用 **↑ / ↓** 选择改写模式,按 **回车** 确认。默认选中 **普通(Normal)**,可让 OpenAI 先判断草稿是否需要改写。**Turbo** 跳过 OpenAI,直接让 Gemini 改写符合条件的草稿。何时触发润色可单独设置。安装器会沿用项目已选的改写模式。首次配置还可以用方向键选择 Gemini 4 Hydrogen,或让 Codex 查询账号里可用的其他模型。选择会保存在仓库根目录,无人值守安装使用默认值。
|
|
51
|
+
|
|
52
|
+
在 macOS 上也可以下载并解压 GitHub 仓库,双击[安装回复润色.command](安装回复润色.command)。在项目目录提示处输入目标路径,或按回车稍后配置。在项目聊天里说 **“配置回复润色”**,首次配置时即可点选 **普通(Normal)** 或 **Turbo**。如果聊天只支持文字,直接回复模式名即可。
|
|
40
53
|
|
|
41
54
|
2. **连接 Gemini。** 安装器会复用已有的 Antigravity CLI(`agy` 1.2.1 或更新版本)。如果没装,按回车即可安装官方版本。无人值守安装时,在上述 `setup` 命令末尾加上 `--install-agy`。插件默认沿用 Antigravity 登录。只有收到登录提示时,才需要在运行 Codex 的机器上打开 `agy` 登录。
|
|
42
|
-
3. **信任 hook,试一次普通提问。**
|
|
55
|
+
3. **信任 hook,试一次普通提问。** 启用 OpenAI 风格检查时,OpenAI 只收到本轮问题、草稿和已设置的自定义润色提示词。进入改写时,Google 收到这些内容,默认还会附带最近最多 2 轮完整问答。在 Codex 的 **设置 → Hooks**(CLI 输入 `/hooks`)里信任本插件的 `UserPromptSubmit`,然后在项目里新开聊天,问 **“用一句话解释 DNS。”** 想改成手动,可以在项目里说 **“只在我要求时润色”**。
|
|
43
56
|
|
|
44
57
|
## 项目设置
|
|
45
58
|
|
|
@@ -48,22 +61,37 @@ Codex Polish 通过 Antigravity 的 `agy acp` 请 Gemini 润色 Codex 的最终
|
|
|
48
61
|
| 设置 | 默认值 | 可以这样说 |
|
|
49
62
|
| --- | --- | --- |
|
|
50
63
|
| 什么时候润色 | 自动(需信任 hook) | “只在我要求时润色”“关闭回复润色”“给这个项目开启自动润色” |
|
|
64
|
+
| 改写模式 | 普通(normal) | “切换到 Turbo 模式”“恢复普通模式” |
|
|
51
65
|
| Gemini 模型 | Gemini 4 Hydrogen | “选择改写模型”会列出当前账号可用的模型,也可以说“恢复默认改写模型” |
|
|
52
|
-
|
|
|
53
|
-
|
|
|
54
|
-
|
|
|
66
|
+
| 润色提示词 | 当前模式的内置提示词 | “查看润色提示词”“设置润色提示词”“恢复默认润色提示词” |
|
|
67
|
+
| Gemini 改写时带几轮历史 | 最近最多 2 轮 | “带最近 5 轮对话”“润色时不带历史”。可选 0 到 10 轮。说“这次润色不带历史”只对本轮生效 |
|
|
68
|
+
| 改写前的 OpenAI 风格检查 | 普通模式下,配了 `OPENAI_API_KEY` 时启用 | “这个项目只用 Gemini 改写”“有密钥时用 OpenAI 检查” |
|
|
69
|
+
| 插件提示语言 | 自动识别中英文 | “插件提示改成中文”“恢复自动识别语言” |
|
|
55
70
|
|
|
56
|
-
|
|
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 主动改写。切换改写模式不影响自动、手动或关闭设置。说 **“恢复普通模式”** 即可重新使用原有的风格检查设置。
|
|
57
76
|
|
|
58
77
|
## 谁会收到对话内容
|
|
59
78
|
|
|
60
|
-
自动模式下,受信任的 `UserPromptSubmit` 会在普通提问时提醒 Codex 润色最终回复。信任前,仍可说
|
|
79
|
+
自动模式下,受信任的 `UserPromptSubmit` 会在普通提问时提醒 Codex 润色最终回复。信任前,仍可说 **“把这轮回复润色一下”**,用本轮问答润色,不附带历史。手动模式只在点名时触发,附带历史同样需要信任 hook。关闭后,即使点名也会跳过润色。
|
|
80
|
+
|
|
81
|
+
插件会先在本地检查本轮问题和草稿。检测到疑似凭据,或用户要求只输出 JSON、命令等固定格式时,插件会跳过润色。
|
|
82
|
+
|
|
83
|
+
问题和草稿按原文发送,包括其中的代码、命令、路径、链接和数值。
|
|
84
|
+
|
|
85
|
+
- **OpenAI** 启用风格检查时只收到本轮问题、草稿和已设置的自定义润色提示词,用来判断草稿是否需要改写。
|
|
86
|
+
- **Google** 收到待改回复对应的问题、原稿和项目自定义润色提示词(如有)。单次 Turbo 还会带上你这次提出的改写要求。重写之前的回答时,插件从同一聊天里取出那一轮的提问和答复。如果当时展示了两个版本,就取折叠的 GPT 原稿。附带的历史从目标回复往前数,设为 0 就只发改写所需的材料。插件跳过含疑似凭据、有附件或尚未完成的历史轮次。
|
|
87
|
+
|
|
88
|
+
OpenAI 风格检查的输入超过接口的 256 KiB 限制时,完整材料会直接交给 Gemini。
|
|
61
89
|
|
|
62
|
-
|
|
90
|
+
插件本身不记录草稿。Codex、服务商和全局 `agy` 钩子各有自己的日志设置。
|
|
63
91
|
|
|
64
92
|
## 为什么还是原稿?
|
|
65
93
|
|
|
66
|
-
|
|
94
|
+
普通和 Turbo 模式都会直接显示 Gemini 通过 ACP 返回的完整正文。如果 Gemini 返回原文,回复会注明这一点,正文只显示一次。如果在发送前跳过润色,或 ACP 请求未能取得完整正文,回复会说明原因并显示 GPT 原稿。需要排查时,可以问 **“为什么上条回复没润色?”** 或 **“检查回复润色环境”**。
|
|
67
95
|
|
|
68
96
|
## 检查、更新与卸载
|
|
69
97
|
|
|
@@ -73,7 +101,7 @@ Codex Polish 通过 Antigravity 的 `agy acp` 请 Gemini 润色 Codex 的最终
|
|
|
73
101
|
| 更新 | `npx @kyun.si/codex-polish@beta update` | 取得新版源码后运行 `node scripts/install.mjs update` |
|
|
74
102
|
| 卸载 | `npx @kyun.si/codex-polish@beta uninstall` | `node scripts/install.mjs uninstall` |
|
|
75
103
|
|
|
76
|
-
|
|
104
|
+
更新会保留项目设置和插件启用状态。安装器会向 Codex 查询 hook 的信任状态。已安装插件里的文件有变动,包括内置的 Gemini 提示词或配置指南,Codex 都可能要求再次确认。看到提示时,在 **设置 → Hooks** 里审查并信任 `UserPromptSubmit`,再新开聊天。重新安装内容相同的插件会保留信任。卸载后,项目的 `.codex` 设置和共用的 `agy` 会保留。
|
|
77
105
|
|
|
78
106
|
## 文档与许可
|
|
79
107
|
|
package/SECURITY.en.md
CHANGED
|
@@ -6,12 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
Please [report vulnerabilities privately on GitHub](https://github.com/mreasonyang/codex-polish/security/advisories/new). The maintainer can follow up with you in the report.
|
|
8
8
|
|
|
9
|
-
Include the plugin version, steps to reproduce the issue, what you expected, and what happened. Add relevant details such as your operating system, the versions of Node.js, Codex CLI, and `agy`, or the status of a project setting or hook. Use a fictional exchange and
|
|
9
|
+
Include the plugin version, steps to reproduce the issue, what you expected, and what happened. Add relevant details such as your operating system, the versions of Node.js, Codex CLI, and `agy`, or the status of a project setting or hook. Use a fictional exchange and made-up values in your example. Remove keys, tokens, authorization headers, and private conversation text.
|
|
10
10
|
|
|
11
11
|
## Control what the plugin sends
|
|
12
12
|
|
|
13
|
+
When the optional style check runs in Normal mode, OpenAI receives only the current question and draft as written (including code, paths, and links) and any custom polishing prompt. Turbo, including a one-time Turbo request, skips OpenAI and calls Gemini through `agy acp`. Google receives the selected reply’s question and draft, any custom project prompt, and any directions you give for that Turbo rewrite. Optional history comes from before the selected reply. The default is up to 2 exchanges, configurable from 0 to 10. The plugin skips incomplete exchanges and those containing attachments or possible credentials. A possible credential in the rewrite material causes the plugin to skip the turn before sharing it. Once Gemini returns a complete reply, the plugin formats it locally for display.
|
|
14
|
+
|
|
13
15
|
- To stop future rewrite requests in the current project, set `.codex/codex-polish.mode` to `off`.
|
|
14
|
-
- To
|
|
15
|
-
- To turn off the
|
|
16
|
+
- To omit additional exchanges, set `.codex/codex-polish.history-turns` to `0` or say “Leave out history this time.” You can still request a rewrite of an earlier answer. The trusted hook stores the transcript location and turn locally so the plugin can retrieve that question and reply.
|
|
17
|
+
- To turn off the OpenAI style check, set `.codex/codex-polish.decisions` to `off`.
|
|
16
18
|
|
|
17
19
|
If a key or token may have been exposed, revoke it with the provider and replace it wherever it is configured.
|
package/SECURITY.md
CHANGED
|
@@ -6,12 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
如发现安全漏洞,请[私下提交漏洞报告](https://github.com/mreasonyang/codex-polish/security/advisories/new)。维护者可以在同一份报告里与你跟进。
|
|
8
8
|
|
|
9
|
-
在报告中写明插件版本、复现步骤、预期结果和实际结果。视问题补充操作系统、Node.js、Codex CLI 或 `agy`
|
|
9
|
+
在报告中写明插件版本、复现步骤、预期结果和实际结果。视问题补充操作系统、Node.js、Codex CLI 或 `agy` 的版本,以及相关的项目设置或钩子状态。请用虚构的对话和示例值演示问题,并删去密钥、令牌、认证头和私人对话原文。
|
|
10
10
|
|
|
11
11
|
## 控制插件发送的内容
|
|
12
12
|
|
|
13
|
+
普通模式启用风格检查时,OpenAI 只收到本轮问题和草稿原文(包括代码、路径和链接),以及已设置的自定义润色提示词。Turbo(含单次 Turbo)跳过 OpenAI,通过 `agy acp` 调用 Gemini。Google 收到待改回复对应的问题、草稿、自定义润色提示词(如有),以及你为这次 Turbo 改写提出的要求。可选历史取自目标回复之前,默认最多 2 轮,可设为 0 到 10 轮。带附件、含疑似凭据或尚未完成的历史轮次会被跳过。改写材料含疑似凭据时,插件在发送前跳过整轮。收到 Gemini 的完整回复后,插件在本地排版并显示正文。
|
|
14
|
+
|
|
13
15
|
- 要停止当前项目后续的改写请求,将 `.codex/codex-polish.mode` 设为 `off`。
|
|
14
|
-
-
|
|
16
|
+
- 要让 Gemini 省略附带的历史问答,将 `.codex/codex-polish.history-turns` 设为 `0`,或说“这次润色不带历史”。这时仍可点名重写之前的某条回复。受信任的 hook 会在本机保存会话位置与轮次,插件据此取得你选中的原问题和答复。
|
|
15
17
|
- 要关闭插件的 OpenAI 检查,将 `.codex/codex-polish.decisions` 设为 `off`。
|
|
16
18
|
|
|
17
19
|
如果密钥或令牌可能已经泄露,请到相应服务商处撤销受影响的凭据,并在使用它的配置中换用新凭据。
|