@kyun.si/agy-polish 0.0.4-beta.3 → 0.0.4-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/package.json +1 -1
- package/plugins/agy-polish/plugin.json +1 -1
- package/plugins/agy-polish/rules/AGENTS.md +1 -1
- package/plugins/agy-polish/scripts/mode-hook.mjs +10 -1
- package/plugins/agy-polish/scripts/polish-reply.mjs +3 -1
- package/plugins/agy-polish/skills/polish/SKILL.md +2 -2
- package/scripts/agy-cli.mjs +13 -18
package/README.md
CHANGED
|
@@ -12,7 +12,9 @@ npx @kyun.si/agy-polish@beta setup
|
|
|
12
12
|
|
|
13
13
|
In Windows PowerShell, use `npx.cmd` in place of `npx`.
|
|
14
14
|
|
|
15
|
-
Choose
|
|
15
|
+
Choose Normal, Turbo, Manual, or Off. With polishing on, you can keep the Codex default or choose a model and a supported reasoning effort from your provider’s model list. Run `setup` again to change your choices, or use `/polish-settings` in Antigravity.
|
|
16
|
+
|
|
17
|
+
Start a new `agy` chat and try `/polish Rewrite the previous reply in two sentences.` If Antigravity asks for permission, allow the `polish_reply` tool.
|
|
16
18
|
|
|
17
19
|
For a full reply rewrite, your Codex provider receives the current draft, its question and your editing directions. For a selected passage, it receives just that passage and the relevant directions.
|
|
18
20
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agy-polish",
|
|
3
3
|
"displayName": "AGY Polish · 回复润色",
|
|
4
|
-
"version": "0.0.4-beta.
|
|
4
|
+
"version": "0.0.4-beta.5",
|
|
5
5
|
"description": "Polish Antigravity replies with your local Codex CLI. 用本机 Codex CLI 润色 Antigravity 的回复。",
|
|
6
6
|
"author": { "name": "mreasonyang" },
|
|
7
7
|
"repository": "https://github.com/mreasonyang/agent-polish",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Answer the user normally, including doing any requested work. Use the latest Codex Polish mode message for this user turn. In Normal or Turbo, finish the complete Gemini draft before publishing, then call the `polish_reply` MCP tool from the agy-polish plugin once with the current user question, the complete draft, and `trigger: "auto"`. In Manual (Only when asked), send ordinary answers directly and use the tool only for explicit polishing requests. If the current-turn mode message is missing, answer directly. Never call the MCP tool or run a command to determine the mode for an ordinary answer.
|
|
4
4
|
|
|
5
5
|
- In Off, never invoke Codex or the `polish_reply` MCP tool for reply polishing. If the request only asks to polish supplied text or an identifiable previous reply, return the original text or complete reply verbatim, preserving leading and trailing whitespace, line breaks, Markdown, and code. Do not rewrite it yourself or add anything to it, even if the user specifies edits. If `/polish` accompanies a new question or task, answer it normally and send the answer directly.
|
|
6
|
-
- Use `trigger: "explicit"`
|
|
6
|
+
- Use `trigger: "explicit"` when the user asks to polish or invokes `/polish`. A standalone “说人话” asks to rewrite the previous assistant reply in plain language. Pass that reply verbatim as `draft` and the user's wording as `rewrite_request`. Follow the polish skill for a prior reply or a selected passage. Ordinary requests to edit a file or write content are not explicit requests to polish the chat reply.
|
|
7
7
|
- For “配置回复润色”, “configure reply polishing”, or requests to view or change **reply polishing** mode, Codex model, or thinking level, use the `polish-settings` skill. Send the settings answer directly. Unrelated Antigravity settings remain ordinary host settings.
|
|
8
8
|
- Skip polishing when the user asks to cancel, skip polishing, keep the turn private, use Gemini only, or avoid sharing the material with another model or service. Also skip it for exact-format or verbatim responses, such as a JSON-only answer, literal transcription, or a raw command. A request for prose with no preamble or extra commentary still permits polishing. Follow these instructions even in Turbo and on an explicit turn. When uncertain about permission to share, keep the Gemini response.
|
|
9
9
|
- Send only the current question, the final draft, and explicitly requested editing instructions. Keep the draft private within this workflow until the tool returns. Use the tool's full text as the final reply verbatim, preserving the language, Markdown, code, and whitespace. On tool errors, unavailability, cancellation, or if the tool returns no usable body, keep the Gemini draft and never retry in the same turn. If the turn itself is cancelled, stop.
|
|
@@ -21,9 +21,18 @@ function modeContext() {
|
|
|
21
21
|
} catch {
|
|
22
22
|
// Treat unavailable settings as off for this turn.
|
|
23
23
|
}
|
|
24
|
+
let guidance = instructions[mode];
|
|
25
|
+
if (typeof input.lastUserInput === 'string' && /^说人话[。!.!]*$/u.test(input.lastUserInput.trim())) {
|
|
26
|
+
guidance = mode === 'off'
|
|
27
|
+
? 'For this request, return the previous assistant reply verbatim. Do not call polish_reply or invoke Codex.'
|
|
28
|
+
: 'The user explicitly asks for the previous reply in plain language. Call polish_reply once with trigger "explicit". ' +
|
|
29
|
+
'Use the complete previous assistant reply verbatim as draft, its original question if available, and the exact user request as rewrite_request. ' +
|
|
30
|
+
'Send the original reply to the editor before rewriting any of it yourself. Return the tool result verbatim.';
|
|
31
|
+
guidance += ' If there is no previous reply, ask which text to rewrite.';
|
|
32
|
+
}
|
|
24
33
|
return {
|
|
25
34
|
injectSteps: [{ systemMessage: { systemMessage:
|
|
26
|
-
'The Codex Polish mode for the current user turn is ' + mode + '. ' +
|
|
35
|
+
'The Codex Polish mode for the current user turn is ' + mode + '. ' + guidance
|
|
27
36
|
} }]
|
|
28
37
|
};
|
|
29
38
|
}
|
|
@@ -108,7 +108,9 @@ function protectedLiterals(text) {
|
|
|
108
108
|
function promptFor(input, mode, selected) {
|
|
109
109
|
let approach = 'Revise proactively for clarity, precision, and natural language.';
|
|
110
110
|
if (input.trigger === 'explicit') {
|
|
111
|
-
approach = 'Make a direct editing pass. Follow the supplied rewrite_request where it applies to the prose.'
|
|
111
|
+
approach = 'Make a direct editing pass. Follow the supplied rewrite_request where it applies to the prose. ' +
|
|
112
|
+
'When asked for plain language (说人话), describe what actually happens in words the reader would use in conversation. ' +
|
|
113
|
+
'Replace process jargon with its concrete meaning and keep all limits and exceptions.';
|
|
112
114
|
} else if (mode === 'normal') {
|
|
113
115
|
approach = 'Make changes only if they clearly improve the draft. If it already reads well, return it exactly as supplied.';
|
|
114
116
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: polish
|
|
3
|
-
description: Explicitly polish an Antigravity reply with Codex. Use /polish or when explicitly asked to polish this or a previous reply, with optional editing instructions or a selected passage.
|
|
3
|
+
description: Explicitly polish an Antigravity reply with Codex. Use /polish or when explicitly asked to polish this or a previous reply, with optional editing instructions or a selected passage. 润色这条或上一条回复,可指定改法或只选一段。单独发送「说人话」时,把上一条回复改成大白话。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Use the current-turn Codex Polish mode from the plugin hook. Respect the plugin rule about sharing, cancellation, and exact-format responses.
|
|
@@ -11,6 +11,6 @@ In any other mode, use the agy-polish `polish_reply` MCP tool with `trigger: "ex
|
|
|
11
11
|
|
|
12
12
|
With a new question, answer it fully and use your complete unsent final reply as `draft`. If the user asks to polish a previous reply or just enters `/polish`, use the referenced reply in full as `draft` and supply its original question when available. If the user gives only text to polish, use that exact text as the draft. Do not guess a missing reply or question. Use an empty `question` if the draft is available but its original question is missing. Ask which reply or passage only when you cannot resolve the reference.
|
|
13
13
|
|
|
14
|
-
Put additional edit directions in `rewrite_request`. For a selected passage, supply its exact text as `selection` and keep the whole reply in `draft`; the tool returns the entire reply with only that passage replaced. If the selection occurs more than once, use enough surrounding text to identify the intended passage without editing neighboring text, or ask the user to identify it. Do not automatically enrich any of these fields with chat history.
|
|
14
|
+
Put additional edit directions in `rewrite_request`. For a standalone “说人话”, pass the previous assistant reply unchanged as `draft` and the user's exact request as `rewrite_request`. For a selected passage, supply its exact text as `selection` and keep the whole reply in `draft`; the tool returns the entire reply with only that passage replaced. If the selection occurs more than once, use enough surrounding text to identify the intended passage without editing neighboring text, or ask the user to identify it. Do not automatically enrich any of these fields with chat history.
|
|
15
15
|
|
|
16
16
|
Return the full text from the tool as the final reply verbatim. If the tool is unavailable or fails, use the exact draft. Do not run automatic polishing on this turn as well.
|
package/scripts/agy-cli.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { parseArgs } from 'node:util';
|
|
|
6
6
|
import { agyExecutable, canonical, compareVersions, interactiveTerminal, LEGACY_BOTH_SETUP, npmChannel, windows } from './installer_common.mjs';
|
|
7
7
|
import { systemLanguage, tr } from './installer_locale.mjs';
|
|
8
8
|
import { withLock } from './installer_lock.mjs';
|
|
9
|
-
import {
|
|
9
|
+
import { chooseOption, thinkingLabels, waitForCatalog } from './installer_terminal.mjs';
|
|
10
10
|
import { AGY_INSTALL, installAgyBootstrap } from './agy_bootstrap.mjs';
|
|
11
11
|
import {
|
|
12
12
|
AgyInstallError, agyProfile, requireAgyCli, installedAgy, validateAgyBundle,
|
|
@@ -100,27 +100,23 @@ async function chooseAgyModel(settings, { model, effort }, { signedIn }, lang) {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
async function prepareAgySetup(interactive,
|
|
103
|
+
async function prepareAgySetup(interactive, lang) {
|
|
104
104
|
const { settings, current } = await loadAgySettings();
|
|
105
105
|
const t = (zh, en) => tr(zh, en, lang);
|
|
106
106
|
const patch = {};
|
|
107
107
|
let mode = current.mode;
|
|
108
108
|
if (interactive) {
|
|
109
109
|
console.log(t(...agyDataNotice));
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
mode = await chooseOption(title, modes, lang, process.stdin, process.stdout, current.mode);
|
|
116
|
-
} else {
|
|
117
|
-
mode = await chooseOnboardingMode(title, current.mode, lang);
|
|
118
|
-
}
|
|
110
|
+
const modes = Object.entries(agyModeLabels).map(([id, label]) => ({
|
|
111
|
+
id, name: t(...label) + (id === current.mode ? t('(当前)', ' (current)') : '')
|
|
112
|
+
}));
|
|
113
|
+
mode = await chooseOption(t('在 Antigravity 中如何润色?', 'How should Antigravity replies be polished?'),
|
|
114
|
+
modes, lang, process.stdin, process.stdout, current.mode);
|
|
119
115
|
if (!mode) return null;
|
|
120
116
|
if (mode !== current.mode) patch.mode = mode;
|
|
121
117
|
}
|
|
122
118
|
let provider;
|
|
123
|
-
if (mode !== 'off' && interactive
|
|
119
|
+
if (mode !== 'off' && interactive) {
|
|
124
120
|
provider = await checkCodexProvider(lang);
|
|
125
121
|
if (provider.ready || provider.canListModels) {
|
|
126
122
|
const model = await chooseAgyModel(settings, current, provider, lang);
|
|
@@ -241,8 +237,8 @@ async function runAgyHost(action, plan, installDependency, lang) {
|
|
|
241
237
|
|
|
242
238
|
function usage(lang) {
|
|
243
239
|
return tr(
|
|
244
|
-
'用法:agy-polish [setup|update|doctor|uninstall] [--install-agy]
|
|
245
|
-
'Usage: agy-polish [setup|update|doctor|uninstall] [--install-agy]
|
|
240
|
+
'用法:agy-polish [setup|update|doctor|uninstall] [--install-agy]\nsetup(默认命令)安装 Antigravity 插件,可选择润色模式、Codex 模型和思考等级。\n--install-agy 可在 setup 或 update 中安装 Google 的 Antigravity CLI。\n-h, --help 显示帮助。',
|
|
241
|
+
'Usage: agy-polish [setup|update|doctor|uninstall] [--install-agy]\nsetup (default) installs the Antigravity plugin and lets you choose the polishing mode, Codex model and reasoning effort.\n--install-agy can install Google’s Antigravity CLI during setup or update.\n-h, --help shows this help.',
|
|
246
242
|
lang
|
|
247
243
|
);
|
|
248
244
|
}
|
|
@@ -253,7 +249,7 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
253
249
|
console.log(usage(lang));
|
|
254
250
|
return 0;
|
|
255
251
|
}
|
|
256
|
-
let action, installDependency
|
|
252
|
+
let action, installDependency;
|
|
257
253
|
try {
|
|
258
254
|
const { values, positionals } = parseArgs({
|
|
259
255
|
args, allowPositionals: true,
|
|
@@ -261,9 +257,8 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
261
257
|
});
|
|
262
258
|
action = positionals[0] ?? 'setup';
|
|
263
259
|
installDependency = values['install-agy'] ?? false;
|
|
264
|
-
advanced = values.advanced ?? false;
|
|
265
260
|
if (positionals.length > 1 || !['setup', 'update', 'doctor', 'uninstall'].includes(action) ||
|
|
266
|
-
(advanced && action !== 'setup') || (installDependency && !['setup', 'update'].includes(action))) {
|
|
261
|
+
(values.advanced && action !== 'setup') || (installDependency && !['setup', 'update'].includes(action))) {
|
|
267
262
|
throw new Error('invalid installer arguments');
|
|
268
263
|
}
|
|
269
264
|
} catch {
|
|
@@ -271,7 +266,7 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
271
266
|
return 2;
|
|
272
267
|
}
|
|
273
268
|
try {
|
|
274
|
-
const plan = action === 'setup' ? await prepareAgySetup(interactiveTerminal(),
|
|
269
|
+
const plan = action === 'setup' ? await prepareAgySetup(interactiveTerminal(), lang) : undefined;
|
|
275
270
|
if (plan === null) {
|
|
276
271
|
const legacy = process.env[LEGACY_BOTH_SETUP];
|
|
277
272
|
if (legacy === 'codex-complete') console.log(tr('Codex 配置已完成。Antigravity 配置已取消。',
|