pi-for-antigravity 0.2.2 → 0.2.3
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 +4 -2
- package/build/antigravity/README.md +4 -2
- package/build/antigravity/config.example.json +0 -6
- package/build/antigravity/install.cjs +9 -6
- package/build/antigravity/plugin.json +1 -1
- package/build/antigravity/server.cjs +21 -18
- package/build/antigravity/zh.md +4 -2
- package/config.example.json +0 -6
- package/dist/config.js +7 -5
- package/dist/install.js +3 -1
- package/dist/runner.js +12 -4
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/zh.md +4 -2
package/README.md
CHANGED
|
@@ -53,11 +53,13 @@ Restart Antigravity App and check **Customizations → Installed**. Update by re
|
|
|
53
53
|
|
|
54
54
|
In plugin mode, configuration and state live in the host-provided `PLUGIN_DATA` directory:
|
|
55
55
|
|
|
56
|
-
- `${PLUGIN_DATA}/config.json` —
|
|
56
|
+
- `${PLUGIN_DATA}/config.json` — auto-created on first MCP start from `config.example.json`; it works out of the box with your local `pi` default model.
|
|
57
57
|
- `${PLUGIN_DATA}/state/` — session metadata and per-run logs (`runs/` grows over time; prune old run folders as needed).
|
|
58
58
|
|
|
59
59
|
Find the active config path in MCP initialization instructions, startup stderr, or the `config_path` tool result field.
|
|
60
60
|
|
|
61
|
+
Per role, `provider`, `model`, and `thinking` are optional: omit them (as `config.example.json` does) to run with your local `pi` default model. The snippet below is an explicit per-role override example:
|
|
62
|
+
|
|
61
63
|
```json
|
|
62
64
|
{
|
|
63
65
|
"pi": { "command": "pi" },
|
|
@@ -79,7 +81,7 @@ Find the active config path in MCP initialization instructions, startup stderr,
|
|
|
79
81
|
```
|
|
80
82
|
|
|
81
83
|
- `pi.command`: command name, native executable, or `.js`/`.mjs`/`.cjs` entry. `pi.agentDir` optionally overrides `PI_CODING_AGENT_DIR`.
|
|
82
|
-
- `roles.<name>`: `provider`, `model`, `thinking`, and
|
|
84
|
+
- `roles.<name>`: all of `provider`, `model`, `thinking`, and `prompt` are optional per-role overrides. Set `"reviewer": { "enabled": false }` and reconnect MCP to hide `review`.
|
|
83
85
|
- New calls reload config; resumed executor sessions keep their saved settings.
|
|
84
86
|
- Config precedence: `--config` → `PI_FOR_ANTIGRAVITY_CONFIG` → `${PLUGIN_DATA}/config.json` → standalone default (`~/.config/pi-for-antigravity/config.json` on Linux/macOS; `%APPDATA%\pi-for-antigravity\config.json` on Windows; XDG overrides supported). Relative paths resolve from the config file's directory.
|
|
85
87
|
- **Windows `pi` lookup**: checks `PATH`, `%USERPROFILE%\.pi\agent\bin`, `%APPDATA%\npm`, and Node's directory. Managed `pi-launcher.js` and npm `pi.cmd` shims launch their JS entry directly under Node without `cmd.exe`.
|
|
@@ -53,11 +53,13 @@ Restart Antigravity App and check **Customizations → Installed**. Update by re
|
|
|
53
53
|
|
|
54
54
|
In plugin mode, configuration and state live in the host-provided `PLUGIN_DATA` directory:
|
|
55
55
|
|
|
56
|
-
- `${PLUGIN_DATA}/config.json` —
|
|
56
|
+
- `${PLUGIN_DATA}/config.json` — auto-created on first MCP start from `config.example.json`; it works out of the box with your local `pi` default model.
|
|
57
57
|
- `${PLUGIN_DATA}/state/` — session metadata and per-run logs (`runs/` grows over time; prune old run folders as needed).
|
|
58
58
|
|
|
59
59
|
Find the active config path in MCP initialization instructions, startup stderr, or the `config_path` tool result field.
|
|
60
60
|
|
|
61
|
+
Per role, `provider`, `model`, and `thinking` are optional: omit them (as `config.example.json` does) to run with your local `pi` default model. The snippet below is an explicit per-role override example:
|
|
62
|
+
|
|
61
63
|
```json
|
|
62
64
|
{
|
|
63
65
|
"pi": { "command": "pi" },
|
|
@@ -79,7 +81,7 @@ Find the active config path in MCP initialization instructions, startup stderr,
|
|
|
79
81
|
```
|
|
80
82
|
|
|
81
83
|
- `pi.command`: command name, native executable, or `.js`/`.mjs`/`.cjs` entry. `pi.agentDir` optionally overrides `PI_CODING_AGENT_DIR`.
|
|
82
|
-
- `roles.<name>`: `provider`, `model`, `thinking`, and
|
|
84
|
+
- `roles.<name>`: all of `provider`, `model`, `thinking`, and `prompt` are optional per-role overrides. Set `"reviewer": { "enabled": false }` and reconnect MCP to hide `review`.
|
|
83
85
|
- New calls reload config; resumed executor sessions keep their saved settings.
|
|
84
86
|
- Config precedence: `--config` → `PI_FOR_ANTIGRAVITY_CONFIG` → `${PLUGIN_DATA}/config.json` → standalone default (`~/.config/pi-for-antigravity/config.json` on Linux/macOS; `%APPDATA%\pi-for-antigravity\config.json` on Windows; XDG overrides supported). Relative paths resolve from the config file's directory.
|
|
85
87
|
- **Windows `pi` lookup**: checks `PATH`, `%USERPROFILE%\.pi\agent\bin`, `%APPDATA%\npm`, and Node's directory. Managed `pi-launcher.js` and npm `pi.cmd` shims launch their JS entry directly under Node without `cmd.exe`.
|
|
@@ -4,16 +4,10 @@
|
|
|
4
4
|
},
|
|
5
5
|
"roles": {
|
|
6
6
|
"executor": {
|
|
7
|
-
"provider": "zai-coding-cn",
|
|
8
|
-
"model": "glm-5.3-flash",
|
|
9
|
-
"thinking": "high",
|
|
10
7
|
"prompt": "Complete the delegated task and report changes, exact verification commands/results, and any remaining blockers concisely."
|
|
11
8
|
},
|
|
12
9
|
"reviewer": {
|
|
13
10
|
"enabled": true,
|
|
14
|
-
"provider": "zai-coding-cn",
|
|
15
|
-
"model": "glm-5.4",
|
|
16
|
-
"thinking": "high",
|
|
17
11
|
"prompt": "Review the changes against the stated intent. Separate Blockers from Nits with file/line evidence, and note any unverified areas."
|
|
18
12
|
}
|
|
19
13
|
}
|
|
@@ -19741,12 +19741,14 @@ function date4(params) {
|
|
|
19741
19741
|
// src/config.ts
|
|
19742
19742
|
var appName = "pi-for-antigravity";
|
|
19743
19743
|
var thinkingSchema = external_exports.enum(["off", "minimal", "low", "medium", "high", "xhigh", "max"]);
|
|
19744
|
-
var
|
|
19745
|
-
provider: external_exports.string().trim().min(1),
|
|
19746
|
-
model: external_exports.string().trim().min(1),
|
|
19747
|
-
thinking: thinkingSchema,
|
|
19744
|
+
var roleFields = external_exports.object({
|
|
19745
|
+
provider: external_exports.string().trim().min(1).optional(),
|
|
19746
|
+
model: external_exports.string().trim().min(1).optional(),
|
|
19747
|
+
thinking: thinkingSchema.optional(),
|
|
19748
19748
|
prompt: external_exports.string().default("")
|
|
19749
19749
|
});
|
|
19750
|
+
var providerRequiresModel = { path: ["model"], message: "provider requires model (pi --provider requires --model)" };
|
|
19751
|
+
var roleSchema = roleFields.refine((v) => !v.provider || !!v.model, providerRequiresModel);
|
|
19750
19752
|
var configSchema = external_exports.object({
|
|
19751
19753
|
pi: external_exports.object({ command: external_exports.string().min(1).default("pi"), agentDir: external_exports.string().min(1).optional() }).default({ command: "pi" }),
|
|
19752
19754
|
stateDir: external_exports.string().min(1).optional(),
|
|
@@ -19754,7 +19756,7 @@ var configSchema = external_exports.object({
|
|
|
19754
19756
|
executor: roleSchema,
|
|
19755
19757
|
reviewer: external_exports.union([
|
|
19756
19758
|
external_exports.object({ enabled: external_exports.literal(false) }),
|
|
19757
|
-
|
|
19759
|
+
roleFields.extend({ enabled: external_exports.literal(true).default(true) }).refine((v) => !v.provider || !!v.model, providerRequiresModel)
|
|
19758
19760
|
]).default({ enabled: false })
|
|
19759
19761
|
})
|
|
19760
19762
|
});
|
|
@@ -19927,7 +19929,8 @@ async function installPlugin(source, target = pluginDirectory(), options = {}) {
|
|
|
19927
19929
|
}
|
|
19928
19930
|
async function reportInstallation(result) {
|
|
19929
19931
|
console.log("Installed: " + result.target);
|
|
19930
|
-
console.log("Config: " + (result.config || "PLUGIN_DATA/config.json (created on first MCP start)"));
|
|
19932
|
+
console.log("Config: " + (result.config || "PLUGIN_DATA/config.json (auto-created on first MCP start; uses your default pi model unless overridden)"));
|
|
19933
|
+
if (!result.config) console.log("Tip: edit config.json to customize per-role provider/model/thinking, or pass --config /abs/path/config.json.");
|
|
19931
19934
|
let command = "pi";
|
|
19932
19935
|
if (result.config) command = (await loadConfig(result.config)).pi.command;
|
|
19933
19936
|
try {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://antigravity.google/schemas/v1/plugin.json",
|
|
3
3
|
"name": "pi-for-antigravity",
|
|
4
4
|
"displayName": "Pi for Antigravity",
|
|
5
|
-
"version": "0.2.
|
|
5
|
+
"version": "0.2.3",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"logo": "assets/logo.png",
|
|
8
8
|
"description": "Delegate execution-heavy work and optional independent read-only code review to your local pi CLI.",
|
|
@@ -28623,12 +28623,14 @@ var import_node_os = require("node:os");
|
|
|
28623
28623
|
var import_node_path = require("node:path");
|
|
28624
28624
|
var appName = "pi-for-antigravity";
|
|
28625
28625
|
var thinkingSchema = external_exports.enum(["off", "minimal", "low", "medium", "high", "xhigh", "max"]);
|
|
28626
|
-
var
|
|
28627
|
-
provider: external_exports.string().trim().min(1),
|
|
28628
|
-
model: external_exports.string().trim().min(1),
|
|
28629
|
-
thinking: thinkingSchema,
|
|
28626
|
+
var roleFields = external_exports.object({
|
|
28627
|
+
provider: external_exports.string().trim().min(1).optional(),
|
|
28628
|
+
model: external_exports.string().trim().min(1).optional(),
|
|
28629
|
+
thinking: thinkingSchema.optional(),
|
|
28630
28630
|
prompt: external_exports.string().default("")
|
|
28631
28631
|
});
|
|
28632
|
+
var providerRequiresModel = { path: ["model"], message: "provider requires model (pi --provider requires --model)" };
|
|
28633
|
+
var roleSchema = roleFields.refine((v) => !v.provider || !!v.model, providerRequiresModel);
|
|
28632
28634
|
var configSchema = external_exports.object({
|
|
28633
28635
|
pi: external_exports.object({ command: external_exports.string().min(1).default("pi"), agentDir: external_exports.string().min(1).optional() }).default({ command: "pi" }),
|
|
28634
28636
|
stateDir: external_exports.string().min(1).optional(),
|
|
@@ -28636,7 +28638,7 @@ var configSchema = external_exports.object({
|
|
|
28636
28638
|
executor: roleSchema,
|
|
28637
28639
|
reviewer: external_exports.union([
|
|
28638
28640
|
external_exports.object({ enabled: external_exports.literal(false) }),
|
|
28639
|
-
|
|
28641
|
+
roleFields.extend({ enabled: external_exports.literal(true).default(true) }).refine((v) => !v.provider || !!v.model, providerRequiresModel)
|
|
28640
28642
|
]).default({ enabled: false })
|
|
28641
28643
|
})
|
|
28642
28644
|
});
|
|
@@ -28865,7 +28867,8 @@ async function installPlugin(source, target = pluginDirectory(), options = {}) {
|
|
|
28865
28867
|
}
|
|
28866
28868
|
async function reportInstallation(result) {
|
|
28867
28869
|
console.log("Installed: " + result.target);
|
|
28868
|
-
console.log("Config: " + (result.config || "PLUGIN_DATA/config.json (created on first MCP start)"));
|
|
28870
|
+
console.log("Config: " + (result.config || "PLUGIN_DATA/config.json (auto-created on first MCP start; uses your default pi model unless overridden)"));
|
|
28871
|
+
if (!result.config) console.log("Tip: edit config.json to customize per-role provider/model/thinking, or pass --config /abs/path/config.json.");
|
|
28869
28872
|
let command = "pi";
|
|
28870
28873
|
if (result.config) command = (await loadConfig(result.config)).pi.command;
|
|
28871
28874
|
try {
|
|
@@ -37215,14 +37218,11 @@ function piArgs(session, directory) {
|
|
|
37215
37218
|
"--session-dir",
|
|
37216
37219
|
directory,
|
|
37217
37220
|
"--session-id",
|
|
37218
|
-
session.id
|
|
37219
|
-
"--provider",
|
|
37220
|
-
session.config.provider,
|
|
37221
|
-
"--model",
|
|
37222
|
-
session.config.model,
|
|
37223
|
-
"--thinking",
|
|
37224
|
-
session.config.thinking
|
|
37221
|
+
session.id
|
|
37225
37222
|
];
|
|
37223
|
+
if (session.config.provider) args.push("--provider", session.config.provider);
|
|
37224
|
+
if (session.config.model) args.push("--model", session.config.model);
|
|
37225
|
+
if (session.config.thinking) args.push("--thinking", session.config.thinking);
|
|
37226
37226
|
if (session.role === "reviewer") {
|
|
37227
37227
|
args.push("--no-skills", "--no-prompt-templates", "--no-themes", "--no-approve", "--tools", "read,grep,find,ls");
|
|
37228
37228
|
} else {
|
|
@@ -37292,14 +37292,16 @@ var Runner = class {
|
|
|
37292
37292
|
const failed = processResult.code !== 0 || !!processResult.error || !!abnormal || !fresh || !text.trim();
|
|
37293
37293
|
const status = processResult.cancelled ? "cancelled" : failed ? "failed" : "completed";
|
|
37294
37294
|
const outputLimit = 24e3;
|
|
37295
|
+
const provider = summary.provider || session.config.provider;
|
|
37296
|
+
const model = summary.model || session.config.model;
|
|
37295
37297
|
return {
|
|
37296
37298
|
status,
|
|
37297
37299
|
role,
|
|
37298
37300
|
session_id: session.id,
|
|
37299
37301
|
config_path: this.configPath,
|
|
37300
|
-
provider
|
|
37301
|
-
model
|
|
37302
|
-
thinking_requested: session.config.thinking,
|
|
37302
|
+
...provider ? { provider } : {},
|
|
37303
|
+
...model ? { model } : {},
|
|
37304
|
+
...session.config.thinking ? { thinking_requested: session.config.thinking } : {},
|
|
37303
37305
|
...summary.thinking ? { thinking_effective: summary.thinking } : {},
|
|
37304
37306
|
result: text.slice(0, outputLimit),
|
|
37305
37307
|
...text.length > outputLimit ? { truncated: true, note: "Result shortened for context. Read output_path for the complete answer." } : {},
|
|
@@ -37308,7 +37310,8 @@ var Runner = class {
|
|
|
37308
37310
|
...summary.file ? { session_path: summary.file } : {},
|
|
37309
37311
|
...status !== "completed" ? {
|
|
37310
37312
|
error: processResult.error || fresh?.errorMessage || (abnormal ? "pi stopped with " + fresh?.stopReason : (!fresh || !text.trim()) && processResult.code === 0 ? "pi returned no new final assistant answer" : "pi exited with code " + processResult.code + (processResult.signal ? " (" + processResult.signal + ")" : "")),
|
|
37311
|
-
diagnostics: (await (0, import_promises7.readFile)(stderr, "utf8")).slice(-3e3)
|
|
37313
|
+
diagnostics: (await (0, import_promises7.readFile)(stderr, "utf8")).slice(-3e3),
|
|
37314
|
+
...status === "failed" ? { hint: "Check pi/model settings in " + this.configPath } : {}
|
|
37312
37315
|
} : {}
|
|
37313
37316
|
};
|
|
37314
37317
|
} finally {
|
|
@@ -37318,7 +37321,7 @@ var Runner = class {
|
|
|
37318
37321
|
};
|
|
37319
37322
|
|
|
37320
37323
|
// src/version.ts
|
|
37321
|
-
var VERSION = "0.2.
|
|
37324
|
+
var VERSION = "0.2.3";
|
|
37322
37325
|
|
|
37323
37326
|
// src/server.ts
|
|
37324
37327
|
async function createServer(configPath) {
|
package/build/antigravity/zh.md
CHANGED
|
@@ -53,11 +53,13 @@ node ./install.cjs
|
|
|
53
53
|
|
|
54
54
|
插件模式下,配置与状态存放在宿主提供的 `PLUGIN_DATA` 目录:
|
|
55
55
|
|
|
56
|
-
- `${PLUGIN_DATA}/config.json`:首次启动 MCP 时从 `config.example.json`
|
|
56
|
+
- `${PLUGIN_DATA}/config.json`:首次启动 MCP 时从 `config.example.json` 自动创建,开箱即用,直接使用你本机 `pi` 的默认模型。
|
|
57
57
|
- `${PLUGIN_DATA}/state/`:会话元数据与运行输出(`runs/` 不会自动清理,可按需删除旧目录)。
|
|
58
58
|
|
|
59
59
|
实际配置路径可在 MCP 初始化信息、启动 stderr 或工具返回的 `config_path` 字段查看。
|
|
60
60
|
|
|
61
|
+
每个角色的 `provider`、`model`、`thinking` 均为可选:省略(如 `config.example.json` 所示)即直接使用本机 `pi` 默认模型。下面的 JSON 是显式按角色覆盖的示例:
|
|
62
|
+
|
|
61
63
|
```json
|
|
62
64
|
{
|
|
63
65
|
"pi": { "command": "pi" },
|
|
@@ -79,7 +81,7 @@ node ./install.cjs
|
|
|
79
81
|
```
|
|
80
82
|
|
|
81
83
|
- `pi.command`:命令名、原生可执行文件或 `.js`/`.mjs`/`.cjs` 入口;`pi.agentDir` 可选覆盖 `PI_CODING_AGENT_DIR`。
|
|
82
|
-
- `roles.<name>`:`provider`、`model`、`thinking`
|
|
84
|
+
- `roles.<name>`:`provider`、`model`、`thinking`、`prompt` 均为可选的按角色覆盖。设 `"reviewer": { "enabled": false }` 并重连 MCP 可隐藏 `review`。
|
|
83
85
|
- 新调用自动重载配置;续接执行器沿用原会话配置。
|
|
84
86
|
- 配置优先级:`--config` → `PI_FOR_ANTIGRAVITY_CONFIG` → `${PLUGIN_DATA}/config.json` → 独立默认路径(Linux/macOS 为 `~/.config/pi-for-antigravity/config.json`,Windows 为 `%APPDATA%\pi-for-antigravity\config.json`,支持 XDG 环境变量)。相对路径相对于配置文件目录解析。
|
|
85
87
|
- **Windows `pi` 查找**:依次查找 `PATH`、`%USERPROFILE%\.pi\agent\bin`、`%APPDATA%\npm` 和 Node 目录;托管 `pi-launcher.js` 与 npm `pi.cmd` 会直接通过 Node 启动 JS 入口,不经 `cmd.exe`。
|
package/config.example.json
CHANGED
|
@@ -4,16 +4,10 @@
|
|
|
4
4
|
},
|
|
5
5
|
"roles": {
|
|
6
6
|
"executor": {
|
|
7
|
-
"provider": "zai-coding-cn",
|
|
8
|
-
"model": "glm-5.3-flash",
|
|
9
|
-
"thinking": "high",
|
|
10
7
|
"prompt": "Complete the delegated task and report changes, exact verification commands/results, and any remaining blockers concisely."
|
|
11
8
|
},
|
|
12
9
|
"reviewer": {
|
|
13
10
|
"enabled": true,
|
|
14
|
-
"provider": "zai-coding-cn",
|
|
15
|
-
"model": "glm-5.4",
|
|
16
|
-
"thinking": "high",
|
|
17
11
|
"prompt": "Review the changes against the stated intent. Separate Blockers from Nits with file/line evidence, and note any unverified areas."
|
|
18
12
|
}
|
|
19
13
|
}
|
package/dist/config.js
CHANGED
|
@@ -5,12 +5,14 @@ import { dirname, isAbsolute, join, posix, resolve, win32 } from "node:path";
|
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
const appName = "pi-for-antigravity";
|
|
7
7
|
export const thinkingSchema = z.enum(["off", "minimal", "low", "medium", "high", "xhigh", "max"]);
|
|
8
|
-
const
|
|
9
|
-
provider: z.string().trim().min(1),
|
|
10
|
-
model: z.string().trim().min(1),
|
|
11
|
-
thinking: thinkingSchema,
|
|
8
|
+
const roleFields = z.object({
|
|
9
|
+
provider: z.string().trim().min(1).optional(),
|
|
10
|
+
model: z.string().trim().min(1).optional(),
|
|
11
|
+
thinking: thinkingSchema.optional(),
|
|
12
12
|
prompt: z.string().default(""),
|
|
13
13
|
});
|
|
14
|
+
const providerRequiresModel = { path: ["model"], message: "provider requires model (pi --provider requires --model)" };
|
|
15
|
+
const roleSchema = roleFields.refine(v => !v.provider || !!v.model, providerRequiresModel);
|
|
14
16
|
export const configSchema = z.object({
|
|
15
17
|
pi: z.object({ command: z.string().min(1).default("pi"), agentDir: z.string().min(1).optional() }).default({ command: "pi" }),
|
|
16
18
|
stateDir: z.string().min(1).optional(),
|
|
@@ -18,7 +20,7 @@ export const configSchema = z.object({
|
|
|
18
20
|
executor: roleSchema,
|
|
19
21
|
reviewer: z.union([
|
|
20
22
|
z.object({ enabled: z.literal(false) }),
|
|
21
|
-
|
|
23
|
+
roleFields.extend({ enabled: z.literal(true).default(true) }).refine(v => !v.provider || !!v.model, providerRequiresModel),
|
|
22
24
|
]).default({ enabled: false }),
|
|
23
25
|
}),
|
|
24
26
|
});
|
package/dist/install.js
CHANGED
|
@@ -83,7 +83,9 @@ export async function installPlugin(source, target = pluginDirectory(), options
|
|
|
83
83
|
}
|
|
84
84
|
export async function reportInstallation(result) {
|
|
85
85
|
console.log("Installed: " + result.target);
|
|
86
|
-
console.log("Config: " + (result.config || "PLUGIN_DATA/config.json (created on first MCP start)"));
|
|
86
|
+
console.log("Config: " + (result.config || "PLUGIN_DATA/config.json (auto-created on first MCP start; uses your default pi model unless overridden)"));
|
|
87
|
+
if (!result.config)
|
|
88
|
+
console.log("Tip: edit config.json to customize per-role provider/model/thinking, or pass --config /abs/path/config.json.");
|
|
87
89
|
let command = "pi";
|
|
88
90
|
if (result.config)
|
|
89
91
|
command = (await loadConfig(result.config)).pi.command;
|
package/dist/runner.js
CHANGED
|
@@ -11,8 +11,13 @@ const reviewerPrompt = "You are an independent read-only code reviewer. Read the
|
|
|
11
11
|
export function piArgs(session, directory) {
|
|
12
12
|
const args = [
|
|
13
13
|
"--print", "--mode", "text", "--no-extensions", "--no-mcp", "--session-dir", directory, "--session-id", session.id,
|
|
14
|
-
"--provider", session.config.provider, "--model", session.config.model, "--thinking", session.config.thinking,
|
|
15
14
|
];
|
|
15
|
+
if (session.config.provider)
|
|
16
|
+
args.push("--provider", session.config.provider);
|
|
17
|
+
if (session.config.model)
|
|
18
|
+
args.push("--model", session.config.model);
|
|
19
|
+
if (session.config.thinking)
|
|
20
|
+
args.push("--thinking", session.config.thinking);
|
|
16
21
|
if (session.role === "reviewer") {
|
|
17
22
|
args.push("--no-skills", "--no-prompt-templates", "--no-themes", "--no-approve", "--tools", "read,grep,find,ls");
|
|
18
23
|
}
|
|
@@ -85,11 +90,13 @@ export class Runner {
|
|
|
85
90
|
const failed = processResult.code !== 0 || !!processResult.error || !!abnormal || !fresh || !text.trim();
|
|
86
91
|
const status = processResult.cancelled ? "cancelled" : failed ? "failed" : "completed";
|
|
87
92
|
const outputLimit = 24000;
|
|
93
|
+
const provider = summary.provider || session.config.provider;
|
|
94
|
+
const model = summary.model || session.config.model;
|
|
88
95
|
return {
|
|
89
96
|
status, role, session_id: session.id, config_path: this.configPath,
|
|
90
|
-
provider
|
|
91
|
-
model
|
|
92
|
-
thinking_requested: session.config.thinking,
|
|
97
|
+
...(provider ? { provider } : {}),
|
|
98
|
+
...(model ? { model } : {}),
|
|
99
|
+
...(session.config.thinking ? { thinking_requested: session.config.thinking } : {}),
|
|
93
100
|
...(summary.thinking ? { thinking_effective: summary.thinking } : {}),
|
|
94
101
|
result: text.slice(0, outputLimit),
|
|
95
102
|
...(text.length > outputLimit ? { truncated: true, note: "Result shortened for context. Read output_path for the complete answer." } : {}),
|
|
@@ -97,6 +104,7 @@ export class Runner {
|
|
|
97
104
|
...(status !== "completed" ? {
|
|
98
105
|
error: processResult.error || fresh?.errorMessage || (abnormal ? "pi stopped with " + fresh?.stopReason : (!fresh || !text.trim()) && processResult.code === 0 ? "pi returned no new final assistant answer" : "pi exited with code " + processResult.code + (processResult.signal ? " (" + processResult.signal + ")" : "")),
|
|
99
106
|
diagnostics: (await readFile(stderr, "utf8")).slice(-3000),
|
|
107
|
+
...(status === "failed" ? { hint: "Check pi/model settings in " + this.configPath } : {}),
|
|
100
108
|
} : {}),
|
|
101
109
|
};
|
|
102
110
|
}
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.2.
|
|
1
|
+
export const VERSION = "0.2.3";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-for-antigravity",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Local stdio MCP and Antigravity plugin for delegating execution and optional read-only review to your local pi CLI.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Jay Shen <https://github.com/shenjiecode>",
|
package/zh.md
CHANGED
|
@@ -53,11 +53,13 @@ node ./install.cjs
|
|
|
53
53
|
|
|
54
54
|
插件模式下,配置与状态存放在宿主提供的 `PLUGIN_DATA` 目录:
|
|
55
55
|
|
|
56
|
-
- `${PLUGIN_DATA}/config.json`:首次启动 MCP 时从 `config.example.json`
|
|
56
|
+
- `${PLUGIN_DATA}/config.json`:首次启动 MCP 时从 `config.example.json` 自动创建,开箱即用,直接使用你本机 `pi` 的默认模型。
|
|
57
57
|
- `${PLUGIN_DATA}/state/`:会话元数据与运行输出(`runs/` 不会自动清理,可按需删除旧目录)。
|
|
58
58
|
|
|
59
59
|
实际配置路径可在 MCP 初始化信息、启动 stderr 或工具返回的 `config_path` 字段查看。
|
|
60
60
|
|
|
61
|
+
每个角色的 `provider`、`model`、`thinking` 均为可选:省略(如 `config.example.json` 所示)即直接使用本机 `pi` 默认模型。下面的 JSON 是显式按角色覆盖的示例:
|
|
62
|
+
|
|
61
63
|
```json
|
|
62
64
|
{
|
|
63
65
|
"pi": { "command": "pi" },
|
|
@@ -79,7 +81,7 @@ node ./install.cjs
|
|
|
79
81
|
```
|
|
80
82
|
|
|
81
83
|
- `pi.command`:命令名、原生可执行文件或 `.js`/`.mjs`/`.cjs` 入口;`pi.agentDir` 可选覆盖 `PI_CODING_AGENT_DIR`。
|
|
82
|
-
- `roles.<name>`:`provider`、`model`、`thinking`
|
|
84
|
+
- `roles.<name>`:`provider`、`model`、`thinking`、`prompt` 均为可选的按角色覆盖。设 `"reviewer": { "enabled": false }` 并重连 MCP 可隐藏 `review`。
|
|
83
85
|
- 新调用自动重载配置;续接执行器沿用原会话配置。
|
|
84
86
|
- 配置优先级:`--config` → `PI_FOR_ANTIGRAVITY_CONFIG` → `${PLUGIN_DATA}/config.json` → 独立默认路径(Linux/macOS 为 `~/.config/pi-for-antigravity/config.json`,Windows 为 `%APPDATA%\pi-for-antigravity\config.json`,支持 XDG 环境变量)。相对路径相对于配置文件目录解析。
|
|
85
87
|
- **Windows `pi` 查找**:依次查找 `PATH`、`%USERPROFILE%\.pi\agent\bin`、`%APPDATA%\npm` 和 Node 目录;托管 `pi-launcher.js` 与 npm `pi.cmd` 会直接通过 Node 启动 JS 入口,不经 `cmd.exe`。
|