@kyun.si/codex-polish 0.0.1-beta.1 → 0.0.1-beta.2
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 +5 -0
- package/CONTRIBUTING.en.md +7 -6
- package/CONTRIBUTING.md +7 -6
- package/README.en.md +7 -7
- package/README.md +7 -7
- package/docs/technical.en.md +4 -4
- package/docs/technical.md +3 -3
- package/package.json +1 -1
- package/plugins/codex-polish/.codex-plugin/plugin.json +1 -1
- package/plugins/codex-polish/hooks/preferences.mjs +1 -1
- package/plugins/codex-polish/hooks/project_setting.mjs +2 -1
- package/plugins/codex-polish/skills/codex-polish/SKILL.md +2 -2
- package/plugins/codex-polish/skills/codex-polish/references/acp.md +1 -1
- package/plugins/codex-polish/skills/codex-polish-setup/SKILL.md +4 -4
- package/plugins/codex-polish/skills/codex-polish-setup/references/credentials.en.md +5 -3
- package/plugins/codex-polish/skills/codex-polish-setup/references/credentials.md +4 -2
- package/scripts/install.mjs +34 -29
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
[中文使用说明](README.md) · [English README](README.en.md)
|
|
4
4
|
|
|
5
|
+
## 0.0.1-beta.2
|
|
6
|
+
|
|
7
|
+
- 项目没有指定润色模式时,普通提问也会自动触发润色。使用前,在 Codex 中信任插件的 `UserPromptSubmit` 钩子。已选“只在我要求时”或“关闭”的项目会沿用该选择。
|
|
8
|
+
- Projects without a saved mode now polish ordinary replies automatically once the `UserPromptSubmit` hook is trusted. Projects set to on-demand or off keep their preference.
|
|
9
|
+
|
|
5
10
|
## 0.0.1-beta.1
|
|
6
11
|
|
|
7
12
|
### 简体中文
|
package/CONTRIBUTING.en.md
CHANGED
|
@@ -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.2` of `@kyun.si/codex-polish` to `dist/kyun.si-codex-polish-0.0.1-beta.2.tgz`. Default tests need no API key. Native installer tests use a temporary Codex profile. A separate opt-in test makes four billable OpenAI requests. See the [live test instructions](docs/technical.en.md).
|
|
26
26
|
|
|
27
27
|
## Reporting Bugs
|
|
28
28
|
|
|
@@ -34,14 +34,15 @@ Report security vulnerabilities privately. [Security policy](SECURITY.en.md)
|
|
|
34
34
|
|
|
35
35
|
Open a GitHub pull request with the reason for the change, steps to reproduce or verify it, and results from the tests you ran. For changes involving a provider, say whether you used a mock or a live account. Use synthetic samples or authorized, de-identified material. The project uses the [Apache License 2.0](LICENSE).
|
|
36
36
|
|
|
37
|
-
## Publishing
|
|
37
|
+
## Publishing a beta
|
|
38
38
|
|
|
39
|
-
|
|
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.2`:
|
|
40
40
|
|
|
41
41
|
```sh
|
|
42
|
-
|
|
42
|
+
git tag v0.0.1-beta.2
|
|
43
|
+
git push origin v0.0.1-beta.2
|
|
43
44
|
```
|
|
44
45
|
|
|
45
|
-
|
|
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.
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
npm grants publishing access per package. Configure this package’s trusted publisher for the `mreasonyang/codex-polish` repository and the `publish.yml` workflow, and enable **Allow npm publish** and **Allow npm dist-tag**. Tag access lets the workflow remove `latest` if npm sets it on the first beta. GitHub authenticates the workflow to npm on each release without a stored npm token. [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/)
|
package/CONTRIBUTING.md
CHANGED
|
@@ -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.2` 版打包为 `dist/kyun.si-codex-polish-0.0.1-beta.2.tgz`。默认测试无需 API 密钥,原生安装测试会使用临时 Codex 配置。另有一项在线测试需要显式开启,会向 OpenAI 发出四次付费请求。[运行在线检查](docs/technical.md)
|
|
25
25
|
|
|
26
26
|
## 反馈问题
|
|
27
27
|
|
|
@@ -33,14 +33,15 @@ npm pack --ignore-scripts --pack-destination dist
|
|
|
33
33
|
|
|
34
34
|
请通过 GitHub Pull Request 提交改动,附上改动原因、复现或验证方法,以及实际跑过的测试结果。如果改动涉及 Gemini 或 OpenAI,写明用的是模拟服务还是真实账号。测试样本请使用虚构内容,或已获授权且脱敏的材料。本项目采用 [Apache License 2.0](LICENSE)。
|
|
35
35
|
|
|
36
|
-
##
|
|
36
|
+
## 发布 beta
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
将 `package.json` 和插件清单中的版本一同改为 `X.Y.Z-beta.N`,提交后推送同名 Git 标签。例如发布 `0.0.1-beta.2` 时运行:
|
|
39
39
|
|
|
40
40
|
```sh
|
|
41
|
-
|
|
41
|
+
git tag v0.0.1-beta.2
|
|
42
|
+
git push origin v0.0.1-beta.2
|
|
42
43
|
```
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
GitHub Actions 会测试这个标签的代码,将安装包发布到 npm 的 `beta` 标签,并创建 GitHub 预发布版。如果某一步失败,可以在 Actions 中选择发布工作流,用已有标签重试。
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
npm 按包授权。此包使用 GitHub 仓库 `mreasonyang/codex-polish` 的 `publish.yml` 工作流,可信发布者勾选 **Allow npm publish** 和 **Allow npm dist-tag**。后一项让工作流在 npm 把首个 beta 同时标记为 `latest` 时自动清理标签。发布时 GitHub 会向 npm 证明工作流身份,仓库无需保存 npm 令牌。[npm 可信发布设置](https://docs.npmjs.com/trusted-publishers/)
|
package/README.en.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**English** | **[简体中文](README.md)**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Codex Polish uses Gemini through Antigravity’s `agy acp` to polish Codex’s final replies. Projects default to automatic mode. Once you trust the plugin hook and start a new chat, ordinary questions trigger polishing. If the rewrite fails a check, you get the original.
|
|
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
|
|
|
@@ -13,13 +13,13 @@ In one test, Codex had to report that the export button was fixed and had passed
|
|
|
13
13
|
|
|
14
14
|
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.
|
|
15
15
|
|
|
16
|
-
1. **Install the plugin.**
|
|
16
|
+
1. **Install the plugin.** Use this command to install the beta from npm.
|
|
17
17
|
|
|
18
18
|
```sh
|
|
19
19
|
npx @kyun.si/codex-polish@beta setup
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
You can also
|
|
22
|
+
You can also clone the repository and run the installer locally.
|
|
23
23
|
|
|
24
24
|
```sh
|
|
25
25
|
git clone https://github.com/mreasonyang/codex-polish.git
|
|
@@ -30,7 +30,7 @@ You need macOS or Linux, Node.js 22.16+, and a [Codex CLI](https://developers.op
|
|
|
30
30
|
On macOS, you can also download and extract the GitHub repository, then double-click [Install Codex Polish.command](Install%20Codex%20Polish.command) in its root folder.
|
|
31
31
|
|
|
32
32
|
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.
|
|
33
|
-
3. **
|
|
33
|
+
3. **Trust the hook and try an ordinary question.** Automatic polishing sends eligible questions and drafts to Google, with up to two 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.”**
|
|
34
34
|
|
|
35
35
|
## Project Settings
|
|
36
36
|
|
|
@@ -38,7 +38,7 @@ Settings are saved in each project’s `.codex/` directory and carry over to new
|
|
|
38
38
|
|
|
39
39
|
| Setting | Default | Natural prompt |
|
|
40
40
|
| --- | --- | --- |
|
|
41
|
-
| Mode |
|
|
41
|
+
| Mode | Automatic (requires a trusted hook) | "Only polish when I ask", "Turn off Codex Polish", or "Polish automatically in this project" |
|
|
42
42
|
| Gemini model | Gemini 4 Hydrogen | "Choose a rewrite model" (lists runtime account options, which can differ) or "Restore the default rewrite model" |
|
|
43
43
|
| History turns | Up to 2 earlier question-and-answer pairs | "Include the last 5 exchanges" or "Don't include any conversation history when polishing replies" (`0` to `10`, max 16 KiB) |
|
|
44
44
|
| OpenAI checks | On when `OPENAI_API_KEY` is set | "Use Gemini only" or "Use OpenAI checks when a key is available" |
|
|
@@ -48,7 +48,7 @@ Without `OPENAI_API_KEY`, eligible drafts go straight to ACP. With OpenAI checks
|
|
|
48
48
|
|
|
49
49
|
## Privacy and Hooks
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
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 share just the current question and draft. In manual mode, only explicit requests trigger polishing. Including history still requires the trusted hook. Turning polishing off skips even explicit requests.
|
|
52
52
|
|
|
53
53
|
For a rewrite, Google receives your current question and reply draft. The plugin replaces fixed details such as commands, paths, links, and numbers with placeholders. Ordinary prose is still readable. If history is enabled and available, Google also receives earlier exchanges as written, including code. The plugin skips turns with detected secrets, attachments, or incomplete output. OpenAI checks use only the protected current question and draft, plus the proposed rewrite for the final check. The plugin writes no draft logs of its own. Codex, your providers, and any global `agy` hooks have their own settings.
|
|
54
54
|
|
|
@@ -64,7 +64,7 @@ Exact-output requests, already clear drafts when OpenAI checks are active, missi
|
|
|
64
64
|
| Update | `npx @kyun.si/codex-polish@beta update` | Get the latest source, then run `node scripts/install.mjs update` |
|
|
65
65
|
| Uninstall | `npx @kyun.si/codex-polish@beta uninstall` | `node scripts/install.mjs uninstall` |
|
|
66
66
|
|
|
67
|
-
Updates preserve
|
|
67
|
+
Updates preserve saved project modes and the plugin’s enabled state. Projects with no saved mode also pick up the automatic default. Start a new chat after upgrading, and review the updated hook if Codex prompts you. Uninstalling keeps your `.codex` project settings and shared `agy` binary.
|
|
68
68
|
|
|
69
69
|
## References and License
|
|
70
70
|
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**简体中文** | [English](README.en.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Codex Polish 通过 Antigravity 的 `agy acp` 请 Gemini 润色 Codex 的最终回复。项目默认使用自动模式。信任插件的 hook 并新开聊天后,像平常一样提问就会触发润色。改写失败或检查没通过,你看到的还是原稿。
|
|
6
6
|
|
|
7
7
|
## 改写示例
|
|
8
8
|
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
|
|
16
16
|
支持 macOS 和 Linux。需要 Node.js 22.16 或更新版本,以及支持插件的 [Codex CLI](https://developers.openai.com/codex/cli/)。如果你用 T3 Code,选择 Codex 后端,并把插件装在运行该后端的机器上。
|
|
17
17
|
|
|
18
|
-
1. **安装插件。**
|
|
18
|
+
1. **安装插件。** 用下面的命令安装 npm 上的测试版。
|
|
19
19
|
|
|
20
20
|
```sh
|
|
21
21
|
npx @kyun.si/codex-polish@beta setup
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
也可以下载源码,运行仓库里的安装脚本。
|
|
25
25
|
|
|
26
26
|
```sh
|
|
27
27
|
git clone https://github.com/mreasonyang/codex-polish.git
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
在 macOS 上也可以下载并解压 GitHub 仓库,在项目根目录双击[安装回复润色.command](安装回复润色.command)。
|
|
33
33
|
|
|
34
34
|
2. **连接 Gemini。** 安装器会复用已有的 Antigravity CLI(`agy` 1.2.1 或更新版本)。如果没装,按回车即可安装官方版本。无人值守安装时,在上述 `setup` 命令末尾加上 `--install-agy`。插件默认沿用 Antigravity 登录。只有收到登录提示时,才需要在运行 Codex 的机器上打开 `agy` 登录。
|
|
35
|
-
3.
|
|
35
|
+
3. **信任 hook,试一次普通提问。** 自动润色会将符合条件的问题和草稿发给 Google,默认最多附带最近 2 轮完整问答。在 Codex 的 **设置 → Hooks**(CLI 输入 `/hooks`)里信任本插件的 `UserPromptSubmit`,然后在项目里新开聊天,问 **“用一句话解释 DNS。”** 想改成手动,可以在项目里说 **“只在我要求时润色”**。
|
|
36
36
|
|
|
37
37
|
## 项目设置
|
|
38
38
|
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
|
|
41
41
|
| 设置 | 默认值 | 可以这样说 |
|
|
42
42
|
| --- | --- | --- |
|
|
43
|
-
| 什么时候润色 |
|
|
43
|
+
| 什么时候润色 | 自动(需信任 hook) | “只在我要求时润色”“关闭回复润色”“给这个项目开启自动润色” |
|
|
44
44
|
| Gemini 模型 | Gemini 4 Hydrogen | “选择改写模型”会列出当前账号可用的模型,也可以说“恢复默认改写模型” |
|
|
45
45
|
| 带几轮历史 | 最近 2 轮 | “带最近 5 轮对话”“润色时不带历史”。一轮是之前的一个问题和对应的最终回复,可选 0 到 10 轮,历史正文合计最多 16 KiB |
|
|
46
46
|
| OpenAI 检查 | 配了 `OPENAI_API_KEY` 时启用 | “这个项目只用 Gemini 改写”“有密钥时用 OpenAI 检查” |
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
|
|
51
51
|
## 谁会收到对话内容
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
自动模式下,受信任的 `UserPromptSubmit` 会在普通提问时提醒 Codex 润色最终回复。信任前,仍可说 **“把这轮回复润色一下”**,仅发送本轮材料。手动模式只在点名时触发,附带历史同样需要信任 hook。关闭后,即使点名也会跳过润色。
|
|
54
54
|
|
|
55
55
|
每次润色,Google 都会收到当前问题和草稿,其中的代码、命令、路径、链接和数值会先替换成占位符,普通文字仍可读。附带的历史则按原文发送,可能包含代码。插件会跳过检测到凭据、带附件或回复不完整的历史轮次。启用检查时,OpenAI 只会收到经过占位符处理的本轮材料,最后一次检查还会收到候选改稿。插件本身不记录草稿。Codex、服务商和全局 `agy` 钩子各有自己的日志设置。
|
|
56
56
|
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
| 更新 | `npx @kyun.si/codex-polish@beta update` | 取得新版源码后运行 `node scripts/install.mjs update` |
|
|
67
67
|
| 卸载 | `npx @kyun.si/codex-polish@beta uninstall` | `node scripts/install.mjs uninstall` |
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
更新会保留已保存的项目模式和插件启用状态。此前未设置模式的项目也会采用默认的自动模式。升级后新开一个聊天。如果 Codex 提示钩子内容已变更,请重新审查并信任。卸载后,项目的 `.codex` 设置和共用的 `agy` 会保留。
|
|
70
70
|
|
|
71
71
|
## 文档与许可
|
|
72
72
|
|
package/docs/technical.en.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[简体中文](technical.md) · [Overview](../README.en.md)
|
|
4
4
|
|
|
5
|
-
Codex Polish `0.0.1-beta.
|
|
5
|
+
Codex Polish `0.0.1-beta.2` 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 [rewrite skill](../plugins/codex-polish/skills/codex-polish/SKILL.md) polishes eligible final replies. 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 and Inheritance
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@ Each project stores its settings as individual files inside `.codex`. The plugin
|
|
|
10
10
|
|
|
11
11
|
| File | Values and Default | Behavior |
|
|
12
12
|
| --- | --- | --- |
|
|
13
|
-
| `.codex/codex-polish.mode` | `
|
|
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.model` | Model ID, default `gemini-4-hydrogen` (Gemini 4 Hydrogen) | Stores the per-project Gemini model discovered from the signed-in Antigravity account over ACP. |
|
|
15
15
|
| `.codex/codex-polish.history-turns` | Integer `0`–`10`, default `2` | Maximum completed exchanges to attach. Use `0` for the current turn only. Saving a value above `10` returns an error. An invalid or out-of-range setting disables history. Changes apply on the next rewrite. |
|
|
16
16
|
| `.codex/codex-polish.decisions` | `auto` (default), `off` | `auto` uses `OPENAI_API_KEY` to determine whether to run OpenAI’s style and meaning checks. `off` uses ACP only. This setting is independent of the trigger mode. |
|
|
@@ -37,7 +37,7 @@ The plugin requires the official Antigravity CLI 1.2.1 or later. By default it r
|
|
|
37
37
|
|
|
38
38
|
## Outgoing Content, Hooks, and Limits
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
For automatic polishing, trust the plugin's `UserPromptSubmit` hook in Codex (**Settings → Hooks** or `/hooks` in the CLI), then start a fresh chat. Explicit requests to polish the current question and draft work without the hook in both automatic and manual mode. Including earlier exchanges requires the trusted hook in either mode. [Codex plugins](https://developers.openai.com/plugins/build/plugins) · [Codex hooks](https://learn.chatgpt.com/docs/hooks#where-codex-looks-for-hooks)
|
|
41
41
|
|
|
42
42
|
The hook records which transcript belongs to the current turn. Local Node.js code reads the exchanges directly from that transcript. If the hook is untrusted, the matching transcript is unavailable, no eligible history can be read, or the user limits sharing to the current turn, the plugin can still send the current question and draft alone. One exchange consists of the user's prompt (including follow-up messages within that turn) and Codex's final reply, excluding progress updates and tool output. The current question and draft are sent alongside history and do not count toward `.codex/codex-polish.history-turns`.
|
|
43
43
|
|
|
@@ -95,4 +95,4 @@ Once the beta is published to npm, install it with `npx @kyun.si/codex-polish@be
|
|
|
95
95
|
|
|
96
96
|
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.
|
|
97
97
|
|
|
98
|
-
If you packed version `0.0.1-beta.
|
|
98
|
+
If you packed version `0.0.1-beta.2` locally, you can also run `npx --yes file:./kyun.si-codex-polish-0.0.1-beta.2.tgz uninstall` in the directory containing the archive. Uninstall removes the plugin and its marketplace, clears cooldowns and 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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[English](technical.en.md) · [项目首页](../README.md)
|
|
4
4
|
|
|
5
|
-
`codex-polish` 的 `0.0.1-beta.
|
|
5
|
+
`codex-polish` 的 `0.0.1-beta.2` 版包含两个 Codex 技能。[改写技能](../plugins/codex-polish/skills/codex-polish/SKILL.md) 在最终答复交付前润色草稿,[设置技能](../plugins/codex-polish/skills/codex-polish-setup/SKILL.md) 检查运行环境并保存项目设置。
|
|
6
6
|
|
|
7
7
|
## 模式、配置文件与查找规则
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
| 配置文件 | 取值范围与默认值 | 运行行为 |
|
|
12
12
|
| --- | --- | --- |
|
|
13
|
-
| `.codex/codex-polish.mode` | `manual
|
|
13
|
+
| `.codex/codex-polish.mode` | `auto`(默认)、`manual`、`off` | 未保存模式时使用 `auto`。在 Codex 的 **设置 → Hooks** 或 CLI `/hooks` 中信任插件的 `UserPromptSubmit`,再新开聊天,普通提问就会触发润色流程。`manual` 仅在点名时触发。两种模式都可以点名润色本轮问答,无需 hook。`off` 跳过所有润色请求。 |
|
|
14
14
|
| `.codex/codex-polish.model` | 模型 ID,默认 `gemini-4-hydrogen`(Gemini 4 Hydrogen) | 保存当前项目选用的 Gemini 模型。选项在运行时通过 ACP 从当前登录的 Antigravity 账号实时读取,不同账号返回的列表可能不同。仅查看模型菜单不会发送草稿或历史。下次改写时会核对所选模型,若已下线则本轮保留原稿。 |
|
|
15
15
|
| `.codex/codex-polish.history-turns` | `0`–`10` 的整数,默认 `2` | 控制附带的最近完整问答轮数,从下次改写起生效。设为 `0` 只发本轮问题和草稿。保存大于 `10` 的值会报错。文件中的值不在范围内或格式无效时,本轮不带历史。无论手动还是自动模式,读取历史都需要受信任的 `UserPromptSubmit` hook。 |
|
|
16
16
|
| `.codex/codex-polish.decisions` | `auto`(默认)、`off` | 与触发模式分开设置。`auto` 按 `OPENAI_API_KEY` 决定是否调用 OpenAI,`off` 始终只用 ACP。 |
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
|
|
64
64
|
`setup` 和 `update` 支持 `--install-agy`,在缺少 Antigravity CLI 时可自动安装。更新会保留项目设置与插件启用状态。同一版本号的新构建也能用 `update` 覆盖或重试中断的更新。
|
|
65
65
|
|
|
66
|
-
手头有本地打包的 `0.0.1-beta.
|
|
66
|
+
手头有本地打包的 `0.0.1-beta.2` 版时,也可以在压缩包所在目录运行 `npx --yes file:./kyun.si-codex-polish-0.0.1-beta.2.tgz uninstall`。卸载会清理该插件与专用市场,按当前 Codex 配置清除冷却记录和会话指针,保留各项目的 `.codex/` 配置和共用的 `agy`,并提示被手动修改过的安装文件备份位置。
|
|
67
67
|
|
|
68
68
|
## 已验证记录与真机验收
|
|
69
69
|
|
package/package.json
CHANGED
|
@@ -32,7 +32,7 @@ const DECISION_REASONS = {
|
|
|
32
32
|
|
|
33
33
|
export function projectSettings(cwd) {
|
|
34
34
|
const [value, scope] = readProjectSetting(cwd, MODE_FILE, 16, { allowMissingLink: true });
|
|
35
|
-
return [value === null ? '
|
|
35
|
+
return [value === null ? 'auto' : MODES.includes(value) ? value : 'off', scope];
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function parseHistoryTurns(value, lang) {
|
|
@@ -74,7 +74,8 @@ export function readProjectSetting(cwd, filename, maxBytes, { allowMissingLink =
|
|
|
74
74
|
const settings = path.join(base, '.codex');
|
|
75
75
|
try {
|
|
76
76
|
if (fs.lstatSync(settings).isSymbolicLink()) {
|
|
77
|
-
if (!allowMissingLink || fs.
|
|
77
|
+
if (!allowMissingLink || !fs.statSync(settings, { throwIfNoEntry: false })?.isDirectory() ||
|
|
78
|
+
fs.lstatSync(path.join(settings, filename), { throwIfNoEntry: false })) {
|
|
78
79
|
return [invalid, base];
|
|
79
80
|
}
|
|
80
81
|
} else {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: codex-polish
|
|
3
|
-
description:
|
|
3
|
+
description: Polishes Codex's final reply with Gemini when you ask or a trusted automatic-mode hook prompts. 在你点名或受信任的自动润色 hook 提醒时运行。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# 润色本轮回复
|
|
@@ -9,7 +9,7 @@ description: Uses Gemini to polish Codex's final reply when you ask, or when pro
|
|
|
9
9
|
|
|
10
10
|
## 本轮可否处理
|
|
11
11
|
|
|
12
|
-
用本文件的安装位置定位 `scripts/`、`references/` 和 `../../hooks/preferences.mjs`。记住**本轮开始时实际工作目录的绝对路径**(即使它是仓库的子目录),后面的 `--cwd`
|
|
12
|
+
用本文件的安装位置定位 `scripts/`、`references/` 和 `../../hooks/preferences.mjs`。记住**本轮开始时实际工作目录的绝对路径**(即使它是仓库的子目录),后面的 `--cwd` 始终用它。用户本轮主动点名时用 `--trigger explicit`。普通提问只有收到本轮受信任的 `UserPromptSubmit` 提醒才用 `--trigger auto`,即使项目采用默认的自动模式也是如此。重复的提醒只处理一次。用户本轮禁止外发、材料不适合外发、宿主无法持续读写并回收同一个子进程,直接交付原稿。
|
|
13
13
|
|
|
14
14
|
使用 Node.js 22.16 或更新版本。先在实际执行工具的环境运行 `node …/hooks/preferences.mjs check --cwd "<原项目目录>"`。模式为 `off`、仅提醒触发而模式为 `manual`、`blockers` 非空、或自动触发且 `cooldown` 非空时,直接交付原稿。找不到 Node.js、帮助脚本无法运行或结果不完整,也沿用原稿。记下本轮 `gemini_model`,默认值为 `gemini-4-hydrogen`。插件状态提示使用本项目的界面语言。在自动语言模式下优先跟随本轮用户说的中文或英文,无法判断时用 `check.ui_language`。最终答复始终保持待润色原稿的语言。按 `google_auth_method` 选择 ACP 步骤。默认的 `existing-session` 由官方进程使用已有登录,直接建立新会话。显式指定 API key 或企业身份时,才发送对应的认证请求。CLI 能否找到 `codex` 供安装排查参考,正在运行的宿主可以直接提供执行工具。
|
|
15
15
|
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
3. 对输入管道逐次写入一条完整的 JSON 行,然后从同一运行句柄读返回值。用执行工具在临时目录执行 `printf '%s\n' '<已安全引用的一帧>' > .acp-in`;有参数的文本始终交给 JSON 序列化器和安全引用,不拼入命令代码。若管道写入阻塞,限定在同一控制请求的期限内中断本次写入并回收服务。每帧通过 JSON 序列化器生成,末尾追加一个换行。正文中的换行属于 JSON 字符串;不可拆成多个请求或把正文当作 shell 命令执行。先发下列帧并等待对应的 `id`:
|
|
21
21
|
|
|
22
22
|
```json
|
|
23
|
-
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":1,"clientCapabilities":{},"clientInfo":{"name":"codex-polish","version":"0.0.1-beta.
|
|
23
|
+
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":1,"clientCapabilities":{},"clientInfo":{"name":"codex-polish","version":"0.0.1-beta.2"}}}
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
确认 `result.protocolVersion == 1`。生产中若服务端提供 `agentInfo.name`,应与官方 `Antigravity ACP Server` 一致,身份或协议版本冲突记 `acp_protocol_error`。
|
|
@@ -17,11 +17,11 @@ Use one language for the conversation, including menus, status, examples and rec
|
|
|
17
17
|
|
|
18
18
|
Opening **Setup** or saying “配置回复润色” / “Set up Codex Polish” starts with local checks. Keep the first answer short. Skip the general tour if the user asked about a particular setting.
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Use the effective project mode from the local check. A project without a saved mode starts in automatic mode. Before inviting the user to trust Codex Polish’s `UserPromptSubmit`, explain what polishing shares. Google receives the current question and draft with fixed details masked, plus up to the configured number of eligible earlier exchanges as written (two by default). If OpenAI checks are enabled, OpenAI receives the protected current question and draft, plus the candidate on the final check.
|
|
21
21
|
|
|
22
22
|
- **A required step is missing.** Lead with the next step from the [中文指南](references/credentials.md) or [English guide](references/credentials.en.md). For `agy_missing`, explain that Gemini needs the Antigravity CLI. The user can run `node scripts/install.mjs setup --install-agy` from the extracted package on the machine running Codex, then ask to check setup again. Offer Google's installation guide if the package is unavailable. Use the existing sign-in and suggest opening `agy` to sign in only if Antigravity requests authentication. When a saved model or optional OpenAI key is invalid, offer the relevant recovery choice.
|
|
23
|
-
- **Ready to try
|
|
24
|
-
- **Offer a short path onward.** For example,
|
|
23
|
+
- **Ready to try.** For automatic mode, direct the user to Codex **Settings → Hooks** (`/hooks` in the CLI) to trust `UserPromptSubmit`. Have them start a fresh chat and ask an ordinary question such as “用一句话解释 DNS。” / “Explain what DNS does in one sentence.” For manual mode, show the explicit request “把这轮回复润色一下” / “Polish this reply”. Explicit requests work before trusting the hook and use only the current question and draft then. If the project is off, explain that the user can choose automatic or manual mode to try polishing.
|
|
24
|
+
- **Offer a short path onward.** For example, in automatic mode offer “只在我要求时润色 · 关闭回复润色 · 更多设置” / “Only polish when I ask · Turn off Codex Polish · More settings”. Keep the user's current settings until they choose. “More settings” leads to the choices below, including the model picker. A local check does not open a provider session or ask for API keys. Run the model lookup only when the user chooses it or explicitly asks to verify available models.
|
|
25
25
|
|
|
26
26
|
## Project settings
|
|
27
27
|
|
|
@@ -29,7 +29,7 @@ When asked to show settings, describe the current values in plain language. Offe
|
|
|
29
29
|
|
|
30
30
|
| What the user can change | What to do |
|
|
31
31
|
| --- | --- |
|
|
32
|
-
| **什么时候润色 / When to polish** |
|
|
32
|
+
| **什么时候润色 / When to polish** | “自动润色 / Polish automatically” → `set-mode auto` (default). “只在我要求时 / Only when I ask” → `set-mode manual`. “关闭 / Turn off” → `set-mode off`. Off also skips explicit requests. For auto, explain the sharing and hook steps above. |
|
|
33
33
|
| **改写模型 / Rewrite model** | “选择改写模型 / Choose a rewrite model” opens the account's live Gemini list below. Default is Gemini 4 Hydrogen. “恢复默认模型 / Restore the default model” → `set-model --reset`. |
|
|
34
34
|
| **带多少对话历史 / Conversation history** | “带最近 5 轮 / Include the last 5 exchanges” → `set-history-turns 5`. Accept 0–10, default 2. Zero sends just the current question and draft. One exchange is one earlier completed user input and final Codex reply. History needs a trusted hook and readable transcript. Up to 16 KiB can be attached, so fewer exchanges may fit. For “no history just this time”, omit `--cwd` from the ACP prompt formatter for this rewrite only. |
|
|
35
35
|
| **额外检查 / Extra OpenAI checks** | Explain what the choice does in ordinary words. With an OpenAI key, OpenAI checks whether editing is worthwhile and whether the result keeps the meaning. “这个项目只用 Gemini 改写 / Use only Gemini for rewrites in this project” → `set-decisions off`. “有密钥时使用 OpenAI 检查 / Use OpenAI checks when a key is available” → `set-decisions auto` (default). Without a key, Gemini can handle eligible rewrites. OpenAI receives current material only. |
|
|
@@ -6,13 +6,15 @@
|
|
|
6
6
|
|
|
7
7
|
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` from the extracted package. You can also install it directly from Google. [Antigravity installation guide](https://antigravity.google/docs/getting-started/?tab=cli)
|
|
8
8
|
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.
|
|
9
|
-
3.
|
|
9
|
+
3. Projects default to automatic polishing. On a rewrite, Google receives your current question and draft with fixed details such as code, commands, and paths masked. Up to two earlier completed exchanges are included as written by default. 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.”**
|
|
10
10
|
|
|
11
|
-
The default setup works without API keys. If Codex runs on a remote machine, follow these steps there.
|
|
11
|
+
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 using just the current question and draft. The default setup works without API keys. If Codex runs on a remote machine, follow these steps there.
|
|
12
|
+
|
|
13
|
+
Say **“Check Codex Polish setup”** to inspect the local configuration or **“Choose a rewrite model”** to see the Gemini models your account can use.
|
|
12
14
|
|
|
13
15
|
## Optional OpenAI checks
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
When `OPENAI_API_KEY` is set, the default configuration uses OpenAI to check whether the draft needs editing and whether the edit keeps its meaning. These checks send the protected current question and draft to OpenAI, plus the candidate for the final check. The OpenAI project linked to the key covers the Decisions API usage for `gpt-6-luna`. [Decisions API](https://developers.openai.com/api/docs/guides/decisions)
|
|
16
18
|
|
|
17
19
|
1. Open your OpenAI project’s **API keys** page. Choose **Create new secret key**, name it something like `codex-polish`, and save it in a password manager. For restricted keys, allow `POST /v1/decisions` and make sure the project can use `gpt-6-luna`. [Create a project key](https://platform.openai.com/api-keys)
|
|
18
20
|
2. Pass the key as `OPENAI_API_KEY` to the process running Codex. In a bash or zsh terminal, run these commands. Paste the key when prompted, then press Return. The terminal hides it while you type.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[English](credentials.en.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
插件默认沿用 Antigravity 登录,普通登录不用额外申请密钥。如果想让 OpenAI 判断什么时候值得润色、改稿有没有保留原意,可以配置下面的可选服务。
|
|
6
6
|
|
|
7
7
|
## 准备 Antigravity
|
|
8
8
|
|
|
@@ -10,9 +10,11 @@
|
|
|
10
10
|
|
|
11
11
|
只有 Antigravity 提示需要登录时,才需要在自己的终端运行 `agy` 登录。如果终端找不到命令,可以直接运行 `~/.local/bin/agy`。登录后回 Codex 再试一次改写。[ACP 认证说明](https://antigravity.google/docs/ide/extensions/acp#authentication)
|
|
12
12
|
|
|
13
|
+
项目默认自动润色。改写时,Google 会收到本轮问题和草稿,代码、命令、路径等固定内容会先替换成占位符。默认最多附带之前 2 轮完整问答,历史按原文发送。在 Codex 的 **设置 → Hooks**(CLI 输入 `/hooks`)里信任插件的 `UserPromptSubmit`,再开一个项目聊天,问 **“用一句话解释 DNS。”** 如果想自己决定何时润色,可以说 **“只在我要求时润色”**。信任 hook 前也可以点名润色本轮问答。想停用就说 **“关闭回复润色”**。
|
|
14
|
+
|
|
13
15
|
## 选配 OpenAI Decisions
|
|
14
16
|
|
|
15
|
-
默认有 `OPENAI_API_KEY` 时启用 Decisions,没有时直接走 ACP
|
|
17
|
+
默认有 `OPENAI_API_KEY` 时启用 Decisions,没有时直接走 ACP。OpenAI 会收到用占位符保护了固定内容的本轮问题和草稿,最后一次检查还会收到候选改稿。在项目里说 **“有 key 时用 Decisions”** 可以恢复这个默认设置。想保留现有 OpenAI key、只关掉本项目的两次判定,就说 **“这个项目只用 ACP”**。
|
|
16
18
|
|
|
17
19
|
要启用 Decisions,可以直接用自己已有的项目密钥,也可以按下面的步骤新建一个。
|
|
18
20
|
|
package/scripts/install.mjs
CHANGED
|
@@ -576,25 +576,28 @@ async function setup(root, store, run, setEnabled, action) {
|
|
|
576
576
|
),
|
|
577
577
|
false
|
|
578
578
|
];
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
`Codex Polish ${version} is installed. You can ask it to polish the current reply right away.\nFor automatic rewrites or to include earlier exchanges, open Settings → Hooks in Codex (/hooks in the CLI), trust the Codex Polish UserPromptSubmit hook, and start a new chat. To enable automatic rewrites, say “Polish automatically in this project”.\nSetup guide: ${guide}`,
|
|
586
|
-
lang
|
|
587
|
-
),
|
|
588
|
-
true
|
|
589
|
-
];
|
|
590
|
-
}
|
|
591
|
-
return [
|
|
579
|
+
const lang = language();
|
|
580
|
+
const status = action === 'setup'
|
|
581
|
+
? tr(`回复润色 ${version} 已安装。`, `Codex Polish ${version} is installed.`, lang)
|
|
582
|
+
: tr(`回复润色已更新到 ${version}。`, `Updated Codex Polish to ${version}.`, lang);
|
|
583
|
+
const lines = [
|
|
584
|
+
status,
|
|
592
585
|
tr(
|
|
593
|
-
|
|
594
|
-
|
|
586
|
+
'未设置模式的项目默认自动润色,已保存的模式继续生效。改写时,Google 会收到用占位符保护了固定内容的本轮问题和草稿,以及按原文附带的历史问答(默认最多 2 轮)。开启 OpenAI 检查时,OpenAI 只收到本轮材料。',
|
|
587
|
+
'Projects without a saved mode default to automatic polishing. Saved modes still apply. On a rewrite, Google receives the current question and draft with fixed details masked, plus earlier exchanges as written (up to two by default). Optional OpenAI checks use only current-turn material.',
|
|
588
|
+
lang
|
|
595
589
|
),
|
|
596
|
-
|
|
590
|
+
tr(
|
|
591
|
+
'要自动润色或附带历史,请在 Codex 的「设置 → Hooks」(CLI 输入 /hooks)中信任本插件的 UserPromptSubmit,再新开一个聊天。想改模式,可以说「只在我要求时润色」或「关闭回复润色」。',
|
|
592
|
+
'For automatic polishing or history, trust the plugin’s UserPromptSubmit hook in Codex Settings → Hooks (/hooks in the CLI), then start a new chat. To change modes, say “Only polish when I ask” or “Turn off Codex Polish”.',
|
|
593
|
+
lang
|
|
594
|
+
)
|
|
597
595
|
];
|
|
596
|
+
if (action === 'setup') {
|
|
597
|
+
const guide = join(target, lang === 'zh' ? GUIDE : GUIDE.replace('credentials.md', 'credentials.en.md'));
|
|
598
|
+
lines.push(tr(`配置指南:${guide}`, `Setup guide: ${guide}`, lang));
|
|
599
|
+
}
|
|
600
|
+
return [lines.join('\n'), action === 'setup'];
|
|
598
601
|
}
|
|
599
602
|
// Node has no unlinkat. Pin each directory as the kernel cwd for this synchronous
|
|
600
603
|
// walk and check inode identity after chdir, before any relative unlink/rmdir.
|
|
@@ -950,19 +953,21 @@ export function configurationSteps(checks) {
|
|
|
950
953
|
lang
|
|
951
954
|
)
|
|
952
955
|
);
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
956
|
+
const examples = {
|
|
957
|
+
auto: [
|
|
958
|
+
'在已信任 hook 的新聊天里,直接问「用一句话解释 DNS。」就会触发自动润色。',
|
|
959
|
+
'After trusting the hook, try automatic polishing in a new chat. Ask “Explain what DNS does in one sentence.”'
|
|
960
|
+
],
|
|
961
|
+
manual: [
|
|
962
|
+
'这个项目只在点名时润色。试一句:「用一句话解释 DNS,再把你的回复润色一下。」',
|
|
963
|
+
'This project polishes only when asked. Try “Explain what DNS does in one sentence, then polish your reply.”'
|
|
964
|
+
],
|
|
965
|
+
off: [
|
|
966
|
+
'这个项目已关闭改写。想试用的话,可以先说「改回手动润色」。',
|
|
967
|
+
'Rewriting is off in this project. To try it, say “Switch to on-demand rewrites”.'
|
|
968
|
+
]
|
|
969
|
+
};
|
|
970
|
+
lines.push(tr(...examples[checks.mode], lang));
|
|
966
971
|
return [lines, pages];
|
|
967
972
|
}
|
|
968
973
|
async function ask(prompt) {
|