jetbrains-pi-acp 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/README.zh-CN.md +4 -3
- package/extensions/acp.ts +5 -1
- package/package.json +1 -1
- package/src/terminal-input.js +7 -6
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ Requires **Node.js 22.19.0+** and a JetBrains IDE with ACP support, such as Inte
|
|
|
11
11
|
1. Sign in to your model provider from a terminal:
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
npx --yes jetbrains-pi-acp@0.1.
|
|
14
|
+
npx --yes jetbrains-pi-acp@0.1.4 --setup
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
In pi, run `/login`, complete sign-in, then exit pi and return to the IDE. Credentials are managed by pi.
|
|
@@ -23,7 +23,7 @@ Requires **Node.js 22.19.0+** and a JetBrains IDE with ACP support, such as Inte
|
|
|
23
23
|
"agent_servers": {
|
|
24
24
|
"pi": {
|
|
25
25
|
"command": "npx",
|
|
26
|
-
"args": ["--yes", "jetbrains-pi-acp@0.1.
|
|
26
|
+
"args": ["--yes", "jetbrains-pi-acp@0.1.4"],
|
|
27
27
|
"use_idea_mcp": true,
|
|
28
28
|
"use_custom_mcp": true
|
|
29
29
|
}
|
|
@@ -52,7 +52,7 @@ The IDE must be able to find `npx`; use its absolute path if needed. Menu locati
|
|
|
52
52
|
Append pi options after `--` in the agent's `args`, for example:
|
|
53
53
|
|
|
54
54
|
```json
|
|
55
|
-
["--yes", "jetbrains-pi-acp@0.1.
|
|
55
|
+
["--yes", "jetbrains-pi-acp@0.1.4", "--", "--model", "provider/model-id", "--thinking", "medium"]
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
Use configuration options here, not initial prompts, interactive mode, or session-selection arguments. The adapter manages RPC mode and sessions.
|
|
@@ -67,6 +67,7 @@ Restart the agent connection after updating the adapter or changing startup opti
|
|
|
67
67
|
|
|
68
68
|
- Tools execute locally through pi; ACP client-side `fs/*` and `terminal/*` execution is not implemented. Save editor buffers before asking the agent to read or change files.
|
|
69
69
|
- Terminal input uses stdin pipes, not a PTY. Full-screen apps and TTY password prompts are unsupported; background tasks have no stdin input.
|
|
70
|
+
- Only commands the model runs with `interactive: true` accept input. Other commands get an empty stdin (`/dev/null`) like native pi, so commands that read stdin by mistake exit instead of hanging.
|
|
70
71
|
- Diffs have size limits and may be unavailable for binary files or older history. File reports scan at most 20,000 entries or two seconds per snapshot and cannot reliably attribute concurrent external changes.
|
|
71
72
|
- MCP SSE, audio, and binary embedded resources are unsupported. Image support depends on the model.
|
|
72
73
|
- ACP v2 follows a draft schema. Client UI behavior, real provider sign-in, and Windows hardware still need verification.
|
package/README.zh-CN.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
1. 在终端中登录模型提供商:
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
npx --yes jetbrains-pi-acp@0.1.
|
|
14
|
+
npx --yes jetbrains-pi-acp@0.1.4 --setup
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
在 pi 中运行 `/login`,完成登录后退出 pi 并返回 IDE。凭据由 pi 管理。
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"agent_servers": {
|
|
24
24
|
"pi": {
|
|
25
25
|
"command": "npx",
|
|
26
|
-
"args": ["--yes", "jetbrains-pi-acp@0.1.
|
|
26
|
+
"args": ["--yes", "jetbrains-pi-acp@0.1.4"],
|
|
27
27
|
"use_idea_mcp": true,
|
|
28
28
|
"use_custom_mcp": true
|
|
29
29
|
}
|
|
@@ -53,7 +53,7 @@ IDE 必须能找到 `npx`,必要时使用其绝对路径。菜单位置随 IDE
|
|
|
53
53
|
在 Agent 的 `args` 末尾添加 `--`,随后传递 pi 参数,例如:
|
|
54
54
|
|
|
55
55
|
```json
|
|
56
|
-
["--yes", "jetbrains-pi-acp@0.1.
|
|
56
|
+
["--yes", "jetbrains-pi-acp@0.1.4", "--", "--model", "provider/model-id", "--thinking", "medium"]
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
这里只传配置选项,不传初始提示、交互模式或会话选择参数。RPC 模式和会话由适配器管理。
|
|
@@ -68,6 +68,7 @@ IDE 必须能找到 `npx`,必要时使用其绝对路径。菜单位置随 IDE
|
|
|
68
68
|
|
|
69
69
|
- 工具由本机 pi 执行,尚未接入客户端 `fs/*` 和 `terminal/*` 执行接口。让 Agent 读取或修改文件前,请保存编辑器内容。
|
|
70
70
|
- 终端输入使用 stdin 管道,不提供 PTY,不支持全屏终端应用和 TTY 密码提示;后台任务不支持 stdin 输入。
|
|
71
|
+
- 只有模型以 `interactive: true` 调用的命令可以接收输入;其他命令与 pi 原生一致,stdin 为空(`/dev/null`),误读 stdin 的命令会直接结束,不会卡住。
|
|
71
72
|
- diff 有大小限制,二进制文件或旧历史可能无法展示。每轮文件报告的单次快照最多扫描 20,000 项或两秒,无法准确区分外部并发修改。
|
|
72
73
|
- 不支持 MCP SSE、音频和二进制内嵌资源,图片支持取决于模型。
|
|
73
74
|
- ACP v2 仍为草案,客户端界面展示、真实提供商账号登录及 Windows 实机仍需验证。
|
package/extensions/acp.ts
CHANGED
|
@@ -79,13 +79,17 @@ export default function (pi: any) {
|
|
|
79
79
|
const createTool = name === 'bash' ? createBashToolDefinition : createPowerShellToolDefinition;
|
|
80
80
|
const definition = createTool(process.cwd());
|
|
81
81
|
pi.registerTool({ ...definition,
|
|
82
|
+
parameters: Type.Object({ ...definition.parameters.properties,
|
|
83
|
+
interactive: Type.Optional(Type.Boolean({ description: 'Set true only when the command must read input typed by the user on stdin. ' +
|
|
84
|
+
'Default false: stdin is empty (/dev/null) and no input can be sent while it runs.' })) }),
|
|
82
85
|
execute: async (id: string, args: any, signal: AbortSignal, update: any, ctx: any) => {
|
|
86
|
+
const interactive = args.interactive === true;
|
|
83
87
|
const settings = SettingsManager.create(ctx.cwd);
|
|
84
88
|
const tool = createTool(ctx.cwd, {
|
|
85
89
|
commandPrefix: settings.getShellCommandPrefix(),
|
|
86
90
|
operations: { exec: (command: string, cwd: string, options: any) => terminals.exec(id,
|
|
87
91
|
name === 'bash' ? getShellConfig(settings.getShellPath()) : getPowerShellConfig(),
|
|
88
|
-
command, cwd, options, () => ctx.ui.notify(`PI_ACP_TERMINAL_READY:${id}`, 'info')) },
|
|
92
|
+
command, cwd, { ...options, interactive }, () => ctx.ui.notify(`PI_ACP_TERMINAL_READY:${id}`, 'info')) },
|
|
89
93
|
});
|
|
90
94
|
return tool.execute(id, args, signal, update, ctx);
|
|
91
95
|
},
|
package/package.json
CHANGED
package/src/terminal-input.js
CHANGED
|
@@ -17,7 +17,7 @@ export class TerminalProcesses {
|
|
|
17
17
|
async input(params) {
|
|
18
18
|
validateTerminalInput(params);
|
|
19
19
|
const child = this.processes.get(params.terminalId);
|
|
20
|
-
if (!child || child.exitCode !== null || child.signalCode !== null || !child.stdin
|
|
20
|
+
if (!child || child.exitCode !== null || child.signalCode !== null || !child.stdin?.writable) {
|
|
21
21
|
throw new Error(t('terminalUnavailable'));
|
|
22
22
|
}
|
|
23
23
|
await new Promise((resolve, reject) => {
|
|
@@ -43,18 +43,19 @@ export class TerminalProcesses {
|
|
|
43
43
|
for (const child of this.processes.values()) this.kill(child);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
async exec(terminalId, shell, command, cwd, { onData, signal, timeout, env }, ready) {
|
|
46
|
+
async exec(terminalId, shell, command, cwd, { onData, signal, timeout, env, interactive }, ready) {
|
|
47
47
|
if (signal?.aborted) throw new Error('aborted');
|
|
48
48
|
if (timeout !== undefined && (!Number.isFinite(timeout) || timeout <= 0 || timeout * 1000 > 2147483647)) {
|
|
49
49
|
throw new Error('Invalid timeout');
|
|
50
50
|
}
|
|
51
51
|
// shortcut: stdin 管道不提供 PTY;需要全屏程序、终端尺寸或 tty 密码提示时再接入 PTY。
|
|
52
52
|
if (shell.commandTransport === 'stdin') throw new Error(t('shellStdinTransport'));
|
|
53
|
+
// 非交互命令的 stdin 用 /dev/null,与 pi 原生一致,避免误读 stdin 的命令一直卡住。
|
|
53
54
|
const child = spawn(shell.shell, [...shell.args, command], {
|
|
54
|
-
cwd, env, stdio: ['pipe', 'pipe', 'pipe'], detached: process.platform !== 'win32', windowsHide: true,
|
|
55
|
+
cwd, env, stdio: [interactive ? 'pipe' : 'ignore', 'pipe', 'pipe'], detached: process.platform !== 'win32', windowsHide: true,
|
|
55
56
|
});
|
|
56
57
|
this.processes.set(terminalId, child);
|
|
57
|
-
child.stdin
|
|
58
|
+
child.stdin?.on('error', () => {});
|
|
58
59
|
child.stdout.on('data', data => onData(data, 'stdout'));
|
|
59
60
|
child.stderr.on('data', data => onData(data, 'stderr'));
|
|
60
61
|
let timedOut = false;
|
|
@@ -70,7 +71,7 @@ export class TerminalProcesses {
|
|
|
70
71
|
clearTimeout(idleTimer);
|
|
71
72
|
child.stdout.destroy();
|
|
72
73
|
child.stderr.destroy();
|
|
73
|
-
child.stdin
|
|
74
|
+
child.stdin?.destroy();
|
|
74
75
|
resolve(code ?? 128 + (constants.signals[child.signalCode] ?? 0));
|
|
75
76
|
};
|
|
76
77
|
const drain = () => {
|
|
@@ -81,7 +82,7 @@ export class TerminalProcesses {
|
|
|
81
82
|
child.stdout.on('data', drain);
|
|
82
83
|
child.stderr.on('data', drain);
|
|
83
84
|
child.once('error', reject);
|
|
84
|
-
child.once('spawn', ready);
|
|
85
|
+
if (interactive) child.once('spawn', ready);
|
|
85
86
|
child.once('close', finish);
|
|
86
87
|
child.once('exit', () => { exited = true; drain(); });
|
|
87
88
|
});
|