@kyun.si/codex-polish 0.0.0-stage → 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.
Files changed (37) hide show
  1. package/.agents/plugins/marketplace.json +12 -0
  2. package/CHANGELOG.md +24 -0
  3. package/CONTRIBUTING.en.md +48 -0
  4. package/CONTRIBUTING.md +47 -0
  5. package/Install Codex Polish.command +29 -0
  6. package/LICENSE +202 -0
  7. package/README.en.md +77 -0
  8. package/README.md +78 -2
  9. package/SECURITY.en.md +17 -0
  10. package/SECURITY.md +17 -0
  11. package/docs/technical.en.md +98 -0
  12. package/docs/technical.md +91 -0
  13. package/evaluation/README.en.md +47 -0
  14. package/evaluation/README.md +47 -0
  15. package/package.json +48 -4
  16. package/plugins/codex-polish/.codex-plugin/plugin.json +21 -0
  17. package/plugins/codex-polish/LICENSE +202 -0
  18. package/plugins/codex-polish/hooks/history.mjs +169 -0
  19. package/plugins/codex-polish/hooks/hooks.json +15 -0
  20. package/plugins/codex-polish/hooks/preferences.mjs +401 -0
  21. package/plugins/codex-polish/hooks/project_setting.mjs +93 -0
  22. package/plugins/codex-polish/hooks/recovery.mjs +201 -0
  23. package/plugins/codex-polish/hooks/ui_locale.mjs +61 -0
  24. package/plugins/codex-polish/skills/codex-polish/SKILL.md +36 -0
  25. package/plugins/codex-polish/skills/codex-polish/references/acp.md +94 -0
  26. package/plugins/codex-polish/skills/codex-polish/references/codex-polish-editor.md +15 -0
  27. package/plugins/codex-polish/skills/codex-polish/scripts/acp_models.mjs +99 -0
  28. package/plugins/codex-polish/skills/codex-polish/scripts/acp_payload.mjs +53 -0
  29. package/plugins/codex-polish/skills/codex-polish/scripts/cli_io.mjs +29 -0
  30. package/plugins/codex-polish/skills/codex-polish/scripts/decisions.mjs +224 -0
  31. package/plugins/codex-polish/skills/codex-polish/scripts/text_guard.mjs +203 -0
  32. package/plugins/codex-polish/skills/codex-polish-setup/SKILL.md +52 -0
  33. package/plugins/codex-polish/skills/codex-polish-setup/references/credentials.en.md +47 -0
  34. package/plugins/codex-polish/skills/codex-polish-setup/references/credentials.md +56 -0
  35. package/scripts/install.mjs +1221 -0
  36. package/scripts/native_cache.mjs +86 -0
  37. package//345/256/211/350/243/205/345/233/236/345/244/215/346/266/246/350/211/262.command +2 -0
@@ -0,0 +1,98 @@
1
+ # Codex Polish Technical Reference
2
+
3
+ [简体中文](technical.md) · [Overview](../README.en.md)
4
+
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
+
7
+ ## Project Settings and Inheritance
8
+
9
+ Each project stores its settings as individual files inside `.codex`. The plugin looks up each file independently, starting in the working directory where the turn began. The closest file wins. The search includes the first directory containing `.git` and stops there. If it reaches the user's home directory or the filesystem root first, it stops before reading settings there.
10
+
11
+ | File | Values and Default | Behavior |
12
+ | --- | --- | --- |
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
+ | `.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
+ | `.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
+ | `.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. |
17
+ | `.codex/codex-polish.language` | `auto` (default), `zh`, `en` | Sets the language for plugin prompts and setup checks. Polished replies always stay in the draft's own language. |
18
+
19
+ When `.codex/codex-polish.language` is `auto`, chat prompts match the user's current message, falling back to the established chat language and then the system locale. Short replies such as menu numbers use the chat language. Terminal checks and the installer check the project setting first, then the system locale, and default to English.
20
+
21
+ ## Rewrite Routes, Stages, and Thresholds
22
+
23
+ - **Direct ACP.** When `OPENAI_API_KEY` is missing, empty, or entirely whitespace, the plugin uses Gemini alone. Setting `codex-polish.decisions` to `off` has the same effect. Every eligible draft that passes local checks goes to Gemini, even if it already reads well.
24
+ - **OpenAI Decisions and ACP.** With `codex-polish.decisions` set to `auto` and a nonblank key, the plugin checks the key’s format locally before contacting OpenAI. It asks `gpt-6-luna` whether to rewrite and, if a changed candidate passes local checks, whether the meaning was preserved. [Decisions API](https://developers.openai.com/api/reference/resources/decisions/methods/create)
25
+
26
+ | Stage | Passing Condition |
27
+ | --- | --- |
28
+ | 1. Text protection | Drafts with detected credentials, explicit exact-output requests, or unsupported structures return the original draft immediately. Code blocks, inline commands, links, citations, file paths, and numbers with units are replaced with turn-specific and source-specific literal placeholders. |
29
+ | 2. Style check | Direct ACP proceeds immediately. With Decisions enabled, the protected current question and draft must score `P(needs rewrite) >= 0.80`. |
30
+ | 3. ACP rewrite | The agent launches `agy acp` in a temporary workspace under a dedicated editor role, opens a session with the configured Antigravity identity, reads the live model list, and verifies the project model. It rejects tool permission requests and requires a complete `end_turn` matching the request ID. |
31
+ | 4. Placeholder check | Every placeholder must appear in its original order. After restoring protected spans, the script verifies fixed tokens, numbers, units, and supported Markdown structures. |
32
+ | 5. Meaning check and delivery | Direct ACP delivers the verified rewrite. With Decisions enabled, comparing the protected question, draft, and candidate rewrite must score `P(substantive change) <= 0.05`. Any stage failure returns the original draft, and user cancellation ends the turn. |
33
+
34
+ During a rewrite, `agy` connects to Google. The plugin's Node.js scripts contact a provider only for the optional OpenAI Decisions checks. The current Codex agent starts and cleans up the ACP process, selects the model, and exchanges protocol messages. [ACP operating instructions](../plugins/codex-polish/skills/codex-polish/references/acp.md)
35
+
36
+ The plugin requires the official Antigravity CLI 1.2.1 or later. By default it reuses the existing Antigravity sign-in on the machine and OS account running Codex. To use an AI Studio key or an enterprise identity, set `CODEX_POLISH_AGY_AUTH` to `gemini-api-key` or `agent-platform`, respectively. [Sign-in guide](../plugins/codex-polish/skills/codex-polish-setup/references/credentials.en.md) · [Google ACP authentication](https://antigravity.google/docs/ide/extensions/acp)
37
+
38
+ ## Outgoing Content, Hooks, and Limits
39
+
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
+
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
+
44
+ - **Sent to Google over ACP.** Each rewrite sends a single ACP prompt containing the placeholder-protected current question and draft, plus up to the configured number of completed exchanges within a `16 KiB` total history cap. The reader scans up to the last 4 MiB of transcript, gives recent exchanges priority within the UTF-8 byte budget, and sends them in chronological order. It skips incomplete turns and turns with detected credentials or attachments. Earlier exchanges are sent with their original text and code. The current turn’s placeholders protect fixed tokens. The provider can still read ordinary prose. Opening the model menu in setup only queries available models and never sends drafts or history.
45
+ - **Sent to OpenAI Decisions.** Only the placeholder-protected current question and draft (plus the candidate rewrite during the second check) are sent. Conversation history is never sent to OpenAI.
46
+
47
+ The plugin never invokes `agy -p` and writes no draft logs of its own. Codex session logs and provider logs follow their own settings ([Google FAQ](https://antigravity.google/docs/faq)). The dedicated Antigravity editor role disables built-in tools ([Antigravity CLI 1.2.1](https://github.com/google-antigravity/antigravity-cli/releases/tag/1.2.1)), though global Antigravity hooks configured on the machine may still run.
48
+
49
+ ## Failure Classes and Cooldowns
50
+
51
+ | Failure Class | Handling |
52
+ | --- | --- |
53
+ | Locally malformed key, unsupported auth mode, missing `agy`, or unavailable Node.js or host process tools | The plugin keeps the draft locally. With Decisions enabled, a nonblank key containing whitespace, non-ASCII characters, or nonprintable characters fails local checks. Correct or clear the key, or set the project’s Decisions mode to `off`. The plugin looks for `agy` in `PATH`, then in `~/.local/bin`. |
54
+ | Decisions network error, timeout, rate limit, quota failure, auth error, malformed JSON, or content refusal | Each request has a 10-second deadline. A key can pass the local format check and still receive HTTP 401 or 403 from OpenAI. Errors return the original draft and may trigger the cooldowns below. A content refusal affects only the current turn. |
55
+ | ACP startup failure, auth failure, missing selected model, or mid-stream model switch | The agent aborts the rewrite, terminates the process, and delivers the original draft. |
56
+ | ACP stall, truncated stream, or mismatched `end_turn` request ID | Each control request has a 10-second deadline. During generation, the agent stops after 30 seconds without valid progress for this session, or 90 seconds after process startup. Cleanup can take up to 3 additional seconds. The agent discards incomplete output without replaying the request. |
57
+ | Modified numbers or units, dropped code, control characters, suspected credentials, or failed meaning check | Discards the entire candidate rewrite and delivers the original draft. |
58
+ | Project disabled mid-turn, updated user instructions, or cancellation | Re-checks project mode before sending text out. The agent discards the old candidate on new instructions. User cancellation ends the turn. If only the server cancels while the user waits, the plugin returns the original draft. |
59
+
60
+ In automatic mode, service errors pause automatic rewrites for the current project within the active Codex profile.
61
+
62
+ - **60-second cooldown.** Triggered by connection failures, timeouts, rate limits, or transient service errors.
63
+ - **5-minute cooldown.** Triggered by authentication failures, explicit OpenAI quota exhaustion, or an unavailable selected Gemini model.
64
+
65
+ Exact-format skips, content refusals, and failed draft validation do not trigger a cooldown. Cooldown records store only a scope hash, a fixed error code, a timestamp, and a random token. An explicit request in a later turn can retry during a cooldown. If the cache is unavailable, a failed rewrite still returns the original draft. Saying `"Check Codex Polish setup"` shows missing dependencies and any active cooldown timer, while `"Test ACP connection"` runs a standalone handshake without sending a draft.
66
+
67
+ ## Verification Status
68
+
69
+ Run the offline test suite and synthetic report from the root of a full source checkout. The release archive ships both language versions of the evaluation guide. The test scripts, report generator, and sample data are available in the source checkout.
70
+
71
+ ```sh
72
+ npm test
73
+ node evaluation/report.mjs evaluation/example.jsonl
74
+ ```
75
+
76
+ The separate live meaning check makes four billable OpenAI Decisions requests to `gpt-6-luna`. It tests one faithful rewrite and one factual reversal in each of English and Chinese. The default suite skips it. To run it, set `OPENAI_API_KEY` in your terminal and opt in explicitly.
77
+
78
+ ```sh
79
+ CODEX_POLISH_TEST_LIVE_DECISIONS=1 node --test --test-name-pattern='live fidelity' tests/decisions.test.mjs
80
+ ```
81
+
82
+ ### Verified on macOS
83
+
84
+ 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 passed local validation and retained the distinction between passing local tests and unverified production behavior. The test environment had no Python on PATH and no OpenAI key. The Node.js helpers made no network requests.
85
+
86
+ ### Checks still open
87
+
88
+ - Verify a complete rewrite in the T3 chat interface. Exercise both routes with authorized, de-identified samples. Compare the tool trace with the selected model, completed output, and process cleanup. Compare the chosen text with the native final message and the transcript after reopening the chat.
89
+ - Run Chinese drafts over 4 KiB in two chats simultaneously and check that each keeps its own text, placeholders, and session ID. Check fallback for an unavailable model, a permission request, cancellation, and a truncated stream.
90
+ - 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).
91
+
92
+ ## Installation, Updates, and Uninstall
93
+
94
+ Once the beta is published to npm, install it 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.en.md#quick-start)
95
+
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
+
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.
@@ -0,0 +1,91 @@
1
+ # 技术参考
2
+
3
+ [English](technical.en.md) · [项目首页](../README.md)
4
+
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
+
7
+ ## 模式、配置文件与查找规则
8
+
9
+ 设置保存在项目的 `.codex/` 目录下。每个文件单独查找,从本轮开始时的工作目录逐级向上,最先找到的文件生效。查过第一个含 `.git` 的目录即停止。在这之前若到达用户主目录或文件系统根目录,也会停止,不读取这两个目录里的设置。
10
+
11
+ | 配置文件 | 取值范围与默认值 | 运行行为 |
12
+ | --- | --- | --- |
13
+ | `.codex/codex-polish.mode` | `auto`(默认)、`manual`、`off` | 未保存模式时使用 `auto`。在 Codex 的 **设置 → Hooks** 或 CLI `/hooks` 中信任插件的 `UserPromptSubmit`,再新开聊天,普通提问就会触发润色流程。`manual` 仅在点名时触发。两种模式都可以点名润色本轮问答,无需 hook。`off` 跳过所有润色请求。 |
14
+ | `.codex/codex-polish.model` | 模型 ID,默认 `gemini-4-hydrogen`(Gemini 4 Hydrogen) | 保存当前项目选用的 Gemini 模型。选项在运行时通过 ACP 从当前登录的 Antigravity 账号实时读取,不同账号返回的列表可能不同。仅查看模型菜单不会发送草稿或历史。下次改写时会核对所选模型,若已下线则本轮保留原稿。 |
15
+ | `.codex/codex-polish.history-turns` | `0`–`10` 的整数,默认 `2` | 控制附带的最近完整问答轮数,从下次改写起生效。设为 `0` 只发本轮问题和草稿。保存大于 `10` 的值会报错。文件中的值不在范围内或格式无效时,本轮不带历史。无论手动还是自动模式,读取历史都需要受信任的 `UserPromptSubmit` hook。 |
16
+ | `.codex/codex-polish.decisions` | `auto`(默认)、`off` | 与触发模式分开设置。`auto` 按 `OPENAI_API_KEY` 决定是否调用 OpenAI,`off` 始终只用 ACP。 |
17
+ | `.codex/codex-polish.language` | `auto`(默认)、`zh`、`en` | 控制插件设置与终端提示语言。`auto` 下,设置对话优先跟随本条消息所用的中文或英文。只点击菜单或回复数字时沿用对话语言。两者都无法判断时使用系统语言。终端也使用系统语言,未识别出中文或英文时用英文。改写后的回复始终保持草稿原本的语言。 |
18
+
19
+ 有关 Codex 如何加载插件、注册 hook 以及取得用户信任,参见 [Codex 插件与 hook](https://developers.openai.com/plugins/build/plugins) 和 [项目 hook 和信任机制](https://learn.chatgpt.com/docs/hooks#where-codex-looks-for-hooks)。
20
+
21
+ ## 改写流程与判定阈值
22
+
23
+ 插件支持直接 ACP 和 OpenAI Decisions 加 ACP 两条路径。当 `OPENAI_API_KEY` 未设置、为空或仅含空白字符,或项目已关闭额外检查时,插件直接使用 ACP。此时由 `agy` 联系 Google,本地 Node.js 脚本不发网络请求。开启 Decisions 时,Node.js 脚本只向 OpenAI `gpt-6-luna` 发起风格判定与原意复核,且这两步都不附带对话历史。每轮最多提交一次含草稿的 ACP 请求。当前 Codex agent 负责启动和回收进程,并在同一会话中收发协议消息。[ACP 操作步骤](../plugins/codex-polish/skills/codex-polish/references/acp.md)
24
+
25
+ | 阶段 | 执行标准与阈值 |
26
+ | --- | --- |
27
+ | 1. 文本保护 | 扫描常见凭据、固定格式要求(如仅输出 JSON 或命令)以及不适合改写的结构,命中时直接返回原稿。将代码块、行内命令、链接、引用、文件路径和数值及其单位替换为按本轮和来源区分的字面量占位符。 |
28
+ | 2. 风格判定 | 直接 ACP 路径在本地检查通过后立即进入改写。开启 Decisions 时,只有 `P(需要改写) ≥ 0.80` 才进入改写,原本清楚的草稿直接保留。 |
29
+ | 3. ACP 改写 | 在临时工作区启动关闭了默认内置工具的专用编辑角色,使用已配置的 Antigravity 身份建立会话,核对项目选中的模型,拒绝全部权限请求,且只接收请求 ID 匹配的完整 `end_turn`。 |
30
+ | 4. 固定内容还原 | 占位符必须按顺序逐一对应。还原后再次校验固定内容、数值与单位、控制字符、疑似凭据以及受支持的 Markdown 结构。 |
31
+ | 5. 原意复核与交付 | 直接 ACP 路径通过本地校验即采用改稿。开启 Decisions 时还需满足 `P(实质变化) ≤ 0.05`。任一阶段未通过均回退原稿,用户取消则直接结束本轮。 |
32
+
33
+ 相关接口规范见 [Google ACP 认证](https://antigravity.google/docs/ide/extensions/acp)、[Decisions API](https://developers.openai.com/api/reference/resources/decisions/methods/create) 与 [Antigravity 角色的工具配置](https://github.com/google-antigravity/antigravity-cli/releases/tag/1.2.1)。
34
+
35
+ ## 隐私边界、文本保护与历史限制
36
+
37
+ 本轮问题和待润色草稿在外发给 OpenAI 或 Google 之前都会先做字面量占位符替换。这些占位符保护代码、命令、路径、链接和数字等固定片段。服务商仍可读取普通正文。
38
+
39
+ 只有 Google 会在触发改写时收到允许附带的对话历史,OpenAI 不会收到任何历史记录。hook 记录本轮对应的会话文件,本地脚本直接从该文件读取问答。一轮历史指本轮之前已完成的完整问答,含同一轮内用户补发的消息和 Codex 的最终答复,工具输出和进度提示均不计入。本轮问题和草稿不占历史轮数名额。
40
+
41
+ 历史里的文字和代码按原文发送。脚本最多扫描会话记录末尾 4 MiB,按从近到远选取完整问答,最多附带 16 KiB 的 UTF-8 正文,再按时间顺序交给 Google。含疑似凭据或附件的回合会跳过,尚未完成的回合也不附带。未信任 hook、读不到匹配的会话记录、没有符合条件的历史,或用户本轮只允许发送当前内容时,插件仍可只用本轮问题和草稿改写。
42
+
43
+ 插件自身不写草稿日志。Codex 宿主日志、服务商侧日志以及机器上全局配置的 Antigravity hooks 仍按各自的环境配置运行。服务商的数据处理遵循各自条款,与本项目的 Apache License 2.0 代码许可无关,可参阅 [Google 使用说明](https://antigravity.google/docs/faq)。
44
+
45
+ ## 认证、故障分类与冷却机制
46
+
47
+ 插件要求官方 Antigravity CLI(`agy`)1.2.1 或更高版本,先在 Codex 的 `PATH` 中查找 `agy`,再查 `~/.local/bin/agy`。默认通过 `agy acp` 复用本机已有登录,无需配置 Gemini API 密钥,也从不调用 `agy -p`。旧配置如需沿用 AI Studio 密钥可设 `CODEX_POLISH_AGY_AUTH=gemini-api-key`,企业环境可设 `agent-platform`。凭据必须配置在运行 Codex 的机器和对应系统用户下,详见 [首次配置指南](../plugins/codex-polish/skills/codex-polish-setup/references/credentials.md)。
48
+
49
+ | 故障类型 | 回退与限制行为 |
50
+ | --- | --- |
51
+ | 密钥格式错误、认证方式不支持、缺少 `agy` 或宿主工具不可用 | 本地停止并交付原稿。启用 Decisions 后,如果密钥含有实际内容,但夹带空白、非 ASCII 字符或不可打印字符,本地检查会拦下请求。修正或清空密钥,或将项目的 Decisions 设为 `off` 后可重试。 |
52
+ | Decisions 超时、断网、限流、配额耗尽、认证失败、响应无效或拒答 | 每次调用限时 10 秒。即使密钥格式通过本地检查,OpenAI 仍可能返回 401 或 403。发生错误时交付原稿,相关服务故障会触发下述冷却。单条内容被拒答只影响本轮。 |
53
+ | ACP 握手失败、未登录、账号无所选模型或中途切换模型 | 当前 agent 结束本次 ACP 请求,回收进程并交付原稿。 |
54
+ | ACP 静默、半篇断流或结束帧 ID 不匹配 | 每个控制请求限时 10 秒。生成期间若连续 30 秒未收到本会话的有效进度,就停止等待。从启动算起总限时 90 秒,清理阶段最多再等 3 秒。即使退出码为 0,未收到匹配 `end_turn` 的半篇内容也会丢弃,且不会自动重发。 |
55
+ | 占位符错位、数值单位改动、出现疑似凭据或原意复核超标 | 整篇改稿丢弃并交付原稿,模型思考与其他会话消息不会混入正文。 |
56
+ | 本轮中途停用、修改要求或取消 | 外发前重新核对项目模式。收到新要求时丢弃旧候选,按新要求作答。用户取消则结束本轮。若只有服务端取消,用户仍在等待,就交付原稿。 |
57
+
58
+ 自动模式下,连接失败、超时、限流或服务异常会让当前 Codex 配置下的该项目暂停自动润色 **60 秒**。认证失败、明确的 OpenAI 配额耗尽或所选 Gemini 模型不可用会暂停 **5 分钟**。固定格式跳过、正常拒答和改稿校验驳回不会触发冷却。每条冷却记录只包含作用域哈希、固定故障码、时间戳和随机标记。用户在修好环境后可以随时在新一轮点名手动重试。
59
+
60
+ ## 安装、更新和卸载
61
+
62
+ 测试版发布到 npm 后,运行 `npx @kyun.si/codex-polish@beta setup` 即可安装。将最后一个参数换成 `update`、`doctor` 或 `uninstall` 即可更新、检查当前项目或卸载。从 GitHub 源码安装时,在仓库根目录运行 `node scripts/install.mjs setup`,其余子命令相同。[安装步骤](../README.md#三步快速开始)
63
+
64
+ `setup` 和 `update` 支持 `--install-agy`,在缺少 Antigravity CLI 时可自动安装。更新会保留项目设置与插件启用状态。同一版本号的新构建也能用 `update` 覆盖或重试中断的更新。
65
+
66
+ 手头有本地打包的 `0.0.1-beta.2` 版时,也可以在压缩包所在目录运行 `npx --yes file:./kyun.si-codex-polish-0.0.1-beta.2.tgz uninstall`。卸载会清理该插件与专用市场,按当前 Codex 配置清除冷却记录和会话指针,保留各项目的 `.codex/` 配置和共用的 `agy`,并提示被手动修改过的安装文件备份位置。
67
+
68
+ ## 已验证记录与真机验收
69
+
70
+ 在完整源码的根目录运行以下离线测试和合成数据报告。发行包附带中英文评测说明,测试脚本、统计脚本和示例数据需从源码获取。参见 [源码测试与贡献指南](../CONTRIBUTING.md)。
71
+
72
+ ```sh
73
+ npm test
74
+ node evaluation/report.mjs evaluation/example.jsonl
75
+ ```
76
+
77
+ 真实 Decisions 原意复核是单独的付费测试,默认跳过。在终端配置 `OPENAI_API_KEY` 后,运行以下命令会发起四次 API 请求。中文和英文各测两份改稿,一份保留原意,一份改错了事实。
78
+
79
+ ```sh
80
+ CODEX_POLISH_TEST_LIVE_DECISIONS=1 node --test --test-name-pattern='live fidelity' tests/decisions.test.mjs
81
+ ```
82
+
83
+ 源码中的 `tests/fixture_acp.mjs` 是专供测试的模拟服务端,覆盖正常改写、认证失败、模型缺失、生成期换模型、权限请求、静默超时、断流和跨会话消息交错,不会安装到最终产物中。安装回归测试会在本机已装好 Codex CLI 和 npm 的前提下创建一次性 Codex 配置,打出发版压缩包,验证 macOS 双击脚本以及从 `.tgz` 安装、更新、检查和卸载的全流程,并通过 Codex CLI 确认 Setup 已启用、`UserPromptSubmit` 已注册且等待信任。本地 T3 Code Beta 的 Codex 配置中也能发现 `codex-polish` 和 `codex-polish-setup`,两者都显示已启用。T3 聊天界面从触发改写到显示最终回复的全流程仍待验收。
84
+
85
+ 在 macOS 上用 Node.js 22.16 和官方 Antigravity CLI 1.5.12 做过一次真实改写。测试环境的 PATH 中没有 Python,也没有配置 OpenAI 密钥。当前 Codex agent 通过 ACP 选中了 `gemini-4-hydrogen`,改稿保留了本地测试通过、线上尚未验证的事实。本地校验通过,Node 辅助脚本没有向网络发出请求。
86
+
87
+ 真人偏好仍待盲评。可用已获授权并去除敏感信息的真实样本完成以下验收。
88
+
89
+ 1. 分别在无 OpenAI 密钥和开启 Decisions 的项目中核对工具轨迹,确认只有当前 agent 持有 ACP 进程、模型选择准确且结束后进程回收干净。
90
+ 2. 用超过 4 KiB 的中文长文在两个 Codex 会话中并发运行,确认正文、占位符和会话 ID 不串线,并核对缺模型、权限请求、取消和断流时的回退表现。
91
+ 3. 对照校验工具输出、原生最终消息和重开会话后的记录,统计盲评偏好、严重事实反转、漏调率、逐字一致率和端到端延迟。统计门槛要求校准集和盲评集合计至少 200 个已交付的真实样本。[验收数据格式和指标](../evaluation/README.md)
@@ -0,0 +1,47 @@
1
+ # Offline Evaluation Statistics
2
+
3
+ [简体中文](README.md)
4
+
5
+ Run these commands from the root of a full source checkout. Release archives include the English and Chinese guides. The script, sample data, and tests are available in the full source checkout. The reporting script uses the Node.js standard library to read per-sample observations from UTF-8 JSONL and write a JSON summary to standard output. All five records, preference votes, and latency numbers in the example file are synthetic.
6
+
7
+ ```sh
8
+ node evaluation/report.mjs evaluation/example.jsonl
9
+ node --test tests/evaluation.test.mjs
10
+ ```
11
+
12
+ ## Data Collection and Blind Rating
13
+
14
+ 1. Obtain permission to use the samples and remove sensitive content. Assign a stable `case_id` to each original prompt and draft. Record the variants and votes for that case in one JSONL row, assigned to a single split. A repeated ID in any row or split stops the script with the offending line number.
15
+ 2. Label independently whether each original draft needs rewriting, then select thresholds on the calibration split. Freeze the plugin settings, model, and concise prompt used for the prompt-only baseline, and use that frozen setup across all blind samples. Each report corresponds to one frozen configuration.
16
+ 3. Record the host tool trace, the selected reply text, and the native final message. For each blind sample, generate a prompt-only baseline reply using the same task, Codex model, and context with only a concise style instruction added. For samples that adopt a rewrite, also pair the rewrite against the original draft.
17
+ 4. Randomize each pair into A and B. Raters see only the user prompt, required context, and two anonymous replies, choosing A, B, or a tie. After unblinding, record `plugin_side` and `pick`. An independent fact checker compares the original draft against the delivered reply and flags any severe fact reversal, such as turning "tests were not run" into "tests passed." The script consumes the collected records, while the data provider verifies authorization, split assignment, and blinding.
18
+
19
+ ## JSONL Record Fields
20
+
21
+ | Field | How to Fill It |
22
+ | --- | --- |
23
+ | `case_id` | Non-empty string unique within the collection |
24
+ | `source`, `split` | `authorized_real` or `synthetic`, paired with `calibration` or `blind` |
25
+ | `needs_rewrite` | `true` when human review judges that the original draft needs rewriting |
26
+ | `workflow_expected`, `workflow_ran` | Whether the turn should run through the plugin, and whether the host trace shows it actually ran. Turns skipped by rule can be `false` |
27
+ | `triggered` | `true` when the check decides to trigger an external rewrite, even if a failure happens afterward |
28
+ | `outcome` | `original` when delivering the initial draft, `adopted` when using the rewrite, `fallback` when delivering the original draft after a workflow error or validation rejection, `cancelled` when the user cancels and nothing is delivered |
29
+ | `selected_text`, `final_text` | The final chosen text and the text actually shown to the user in the native session, preserving spaces and newlines. Omit or set to `null` when cancelled |
30
+ | `elapsed_ms` | Total milliseconds from draft ready to native final message display. Set to `null` when unmeasured or cancelled |
31
+ | `severe_fact_reversal` | Human fact-check result for the delivered reply. Set `true` if a severe reversal is found, `false` if checked and none is found, or `null` if unchecked or cancelled |
32
+ | `vs_original` | One vote for each blind record that adopted a rewrite. `{"plugin_side":"B","pick":"A"}` means the rewrite appeared on side B and the rater chose the original draft. Use `"pick":"tie"` for a tie |
33
+ | `vs_prompt_only` | One vote for each delivered blind record. The plugin side holds the actual delivered reply and the other side holds the prompt-only baseline, using the same format. Omit or set to `null` when missing or not applicable |
34
+
35
+ ## Reading the Report
36
+
37
+ The report summarizes synthetic and real datasets separately, taking quality metrics from the `blind` split. Each ratio entry includes the numerator `count`, denominator `total`, and a `rate` from 0 to 1. When the denominator is zero, `rate` is JSON `null`. Cancelled turns are counted separately.
38
+
39
+ | Metric | Denominator and Calculation |
40
+ | --- | --- |
41
+ | `false_trigger`, `hit` | Among delivered blind turns expected to run, the trigger rate within human-labeled clear drafts and within drafts needing a rewrite respectively. Expected turns where the workflow was missed remain in the denominator |
42
+ | `adopted_preferred_to_original`, `preferred_to_prompt_only` | Plugin win rate across valid preference votes for each comparison, counting ties in the denominator. Also reports `eligible` sample count and `ties` |
43
+ | `severe_fact_reversal` | Count and rate of severe reversals among delivered replies that completed human fact checking |
44
+ | `missed_workflow`, `verbatim_display`, `adopted_verbatim_display` | Rate of missed workflow runs among delivered turns expected to run, plus exact character match rates (including punctuation, spaces, and newlines) across all delivered replies and across adopted rewrites |
45
+ | `fallback`, `latency` | Fallback rate among delivered turns where the workflow ran. Recorded delivery latencies are sorted ascending, and P50 and P95 take item `ceil(p × n)` in milliseconds |
46
+
47
+ Any severe fact reversal in real blind data sets the status to `blocked_severe_fact_reversal`. Assessment requires at least 200 delivered real samples across the two splits, with delivered samples in both `calibration` and `blind`, non-zero denominators for `false_trigger`, `hit`, and `adopted_preferred_to_original`, and complete records for applicable blind votes, fact checks, and latency. Missing evidence sets `insufficient_evidence`. Once the evidence requirements are met, the report sets `statistical_targets_met` if the false trigger rate is at most 5%, the hit rate is at least 70%, and raters prefer at least 70% of adopted rewrites to their original drafts. Missing any of these targets gives `thresholds_not_met`. Actual sample counts for both splits appear in the report, while live runtime checks and host delivery still require separate verification. The synthetic group is always marked `demo_only`.
@@ -0,0 +1,47 @@
1
+ # 离线验收统计
2
+
3
+ [English](README.en.md)
4
+
5
+ 在完整源码的根目录运行以下命令。发行包附带中英文评测说明。统计脚本、示例数据和测试脚本需从完整源码获取。统计脚本使用 Node.js 内置模块,从 UTF-8 JSONL 读取每个样本的观测值,向标准输出写 JSON 汇总。示例中的五条记录、偏好票和延迟全部是合成数据。
6
+
7
+ ```sh
8
+ node evaluation/report.mjs evaluation/example.jsonl
9
+ node --test tests/evaluation.test.mjs
10
+ ```
11
+
12
+ ## 采集和盲评
13
+
14
+ 1. 取得使用授权并去除敏感信息。每条原始问题与草稿分配一个稳定的 `case_id`。同一个原稿及其变体使用同一 ID,划分时只进一个集合。脚本遇到重复 ID 会报行号并退出。
15
+ 2. 独立标注原稿是否需要改写,再用校准集选择阈值。冻结插件配置、模型和仅提示对照的简洁提示,将这组配置用于全部盲评样本。每份报告对应一次冻结配置。
16
+ 3. 记录宿主实际工具轨迹、选定的正文和原生最终消息。每条盲评样本用同一任务、同一 Codex 模型和上下文生成仅加简洁提示的对照答复。对采用改稿的样本,再与原稿配对比较。
17
+ 4. 每对随机排列成 A/B。评分者只看到用户问题、必要上下文和两篇匿名答复,分别选 A、B 或平局。揭盲后合并 `plugin_side` 和 `pick`。由独立核事实的人对照原稿和交付文本标出严重事实反转,例如把「没跑测试」改为「测试通过」。脚本消费采集结果,数据提供者负责核实授权、分组和盲法。
18
+
19
+ ## 一行记录的字段
20
+
21
+ | 字段 | 填写方式 |
22
+ | --- | --- |
23
+ | `case_id` | 本次采集中唯一的非空字符串 |
24
+ | `source`、`split` | `authorized_real` 或 `synthetic`,以及 `calibration` 或 `blind` |
25
+ | `needs_rewrite` | 人工判断原稿需要改写时为 `true` |
26
+ | `workflow_expected`、`workflow_ran` | 该回合是否应走插件,以及从宿主轨迹观察到是否实际运行。按约定跳过的回合可填 `false` |
27
+ | `triggered` | 判定触发外部改写时为 `true`,即使随后发生故障 |
28
+ | `outcome` | `original` 交付初稿,`adopted` 采用改稿,`fallback` 工作流出错或校验驳回后交付原稿,`cancelled` 用户取消且本轮未交付 |
29
+ | `selected_text`、`final_text` | 最终选定的文本和原生会话中用户实际看到的文本。保留空格和换行。取消时省略或填 `null` |
30
+ | `elapsed_ms` | 草稿就绪到原生最终消息显示的总毫秒数。缺测或取消填 `null` |
31
+ | `severe_fact_reversal` | 对已交付正文的人工结论。发现严重反转填 `true`,已检查且无反转填 `false`,未检查或取消填 `null` |
32
+ | `vs_original` | 盲评中采用改稿的记录填写一票。用 `{"plugin_side":"B","pick":"A"}` 表示改稿放在 B,评分者选了原稿。平局为 `"pick":"tie"` |
33
+ | `vs_prompt_only` | 所有已交付的盲评记录各填一票。插件一侧放实际交付结果,另一侧放仅提示对照。格式同上。缺失或不适用的票省略或填 `null` |
34
+
35
+ ## 读报告
36
+
37
+ 报告分别统计合成和真实数据。效果指标取自盲评集。统计项包含分子 `count`、分母 `total` 和 0~1 的 `rate`。分母为零时比例为 JSON `null`。取消单列计数。
38
+
39
+ | 指标 | 分母及算法 |
40
+ | --- | --- |
41
+ | `false_trigger`、`hit` | 盲评中应运行且已交付的回合,分别取人工判断清楚和需要改写的两组,各自计算触发比例。应该运行却漏调的回合也计入相应分母 |
42
+ | `adopted_preferred_to_original`、`preferred_to_prompt_only` | 各自有效偏好票中的插件胜率,平局计入分母。另列适用样本数 `eligible` 和平局数 `ties` |
43
+ | `severe_fact_reversal` | 已完成人工事实检查的交付结果中,发生严重反转的数量和比例 |
44
+ | `missed_workflow`、`verbatim_display`、`adopted_verbatim_display` | 应运行的已交付回合中漏调的比例。所有交付结果和采用改稿的结果各自单独计算逐字一致率,包括标点、空格和换行 |
45
+ | `fallback`、`latency` | 已运行工作流且已交付回合中的回退比例。所有已记录交付耗时按从小到大排序,P50/P95 取第 `ceil(p × n)` 项,单位毫秒 |
46
+
47
+ 出现真实盲评严重反转标记 `blocked_severe_fact_reversal`。应用效果门槛要求至少 200 个已交付的真实样本,校准集和盲评集均有观测,误触发、命中和采用改稿偏好三个分母均大于零,适用的盲评票、事实检查和延迟记录齐全。缺少证据标记 `insufficient_evidence`。误触发率 ≤ 5%、命中率 ≥ 70%、采用改稿偏好率 ≥ 70% 时标记 `statistical_targets_met`,否则标记 `thresholds_not_met`。两组的实际样本量随报告给出,真机能力和宿主交付仍需独立验收。合成集固定标记 `demo_only`。
package/package.json CHANGED
@@ -1,6 +1,50 @@
1
1
  {
2
2
  "name": "@kyun.si/codex-polish",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.1-beta.2",
4
+ "license": "Apache-2.0",
5
+ "description": "Codex plugin that rewrites replies with Gemini via Antigravity ACP · 通过 Antigravity ACP 调用 Gemini 改写 Codex 回复的插件",
6
+ "os": [
7
+ "darwin",
8
+ "linux"
9
+ ],
10
+ "bin": {
11
+ "codex-polish": "scripts/install.mjs"
12
+ },
13
+ "files": [
14
+ ".agents/plugins/marketplace.json",
15
+ "plugins/codex-polish",
16
+ "scripts/install.mjs",
17
+ "scripts/native_cache.mjs",
18
+ "安装回复润色.command",
19
+ "Install Codex Polish.command",
20
+ "README.en.md",
21
+ "CONTRIBUTING.md",
22
+ "CONTRIBUTING.en.md",
23
+ "SECURITY.md",
24
+ "SECURITY.en.md",
25
+ "CHANGELOG.md",
26
+ "docs/",
27
+ "evaluation/README.md",
28
+ "evaluation/README.en.md"
29
+ ],
30
+ "type": "module",
31
+ "engines": {
32
+ "node": ">=22.16.0"
33
+ },
34
+ "scripts": {
35
+ "test": "node --test tests/*.test.mjs"
36
+ },
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/mreasonyang/codex-polish.git"
40
+ },
41
+ "homepage": "https://github.com/mreasonyang/codex-polish#readme",
42
+ "bugs": {
43
+ "url": "https://github.com/mreasonyang/codex-polish/issues"
44
+ },
45
+ "publishConfig": {
46
+ "access": "public",
47
+ "registry": "https://registry.npmjs.org/",
48
+ "tag": "beta"
49
+ }
50
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "codex-polish",
3
+ "version": "0.0.1-beta.2",
4
+ "description": "Rewrites Codex drafts with Gemini for cleaner replies. 用 Gemini 改写 Codex 草稿,让回复更清晰。",
5
+ "skills": "./skills/",
6
+ "hooks": "./hooks/hooks.json",
7
+ "extensions": {
8
+ "com.openai": {
9
+ "onboardingSkill": "./skills/codex-polish-setup/SKILL.md"
10
+ }
11
+ },
12
+ "interface": {
13
+ "displayName": "Codex Polish · 回复润色",
14
+ "shortDescription": "把生硬的 Codex 草稿改得更好读。 Turn rough Codex drafts into clearer replies.",
15
+ "category": "Productivity",
16
+ "defaultPrompt": [
17
+ "用一句话解释 DNS,再把你的回复润色一下。",
18
+ "Explain what DNS does in one sentence, then polish your reply."
19
+ ]
20
+ }
21
+ }
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.