Fix for allowing bypassPermissions to work (#97)

It seems that unless you start the session with bypassPermissions, you
can't change to it later.

So we start with it on, and immediately change it back to default. This
allows people to change it later however.

Closes https://github.com/zed-industries/zed/issues/39392
This commit is contained in:
Ben Brandt
2025-10-15 15:23:26 +02:00
committed by GitHub
parent 6ae2c05ddb
commit 1b72ac7c8a
4 changed files with 15 additions and 5 deletions

View File

@@ -1,5 +1,9 @@
# Changelog
## 0.6.1
- Fix to allow bypassPermissions mode to be selected (it wasn't permitted previously)
## 0.6.0
- Provide a model selector. We use the "default" model by default, and the user can change it via the client.

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@zed-industries/claude-code-acp",
"version": "0.6.0",
"version": "0.6.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@zed-industries/claude-code-acp",
"version": "0.6.0",
"version": "0.6.1",
"license": "Apache-2.0",
"dependencies": {
"@agentclientprotocol/sdk": "0.4.8",

View File

@@ -6,7 +6,7 @@
"bin": {
"claude-code-acp": "./dist/index.js"
},
"version": "0.6.0",
"version": "0.6.1",
"description": "An ACP-compatible coding agent powered by the Claude Code SDK (TypeScript)",
"main": "dist/index.js",
"type": "module",

View File

@@ -193,6 +193,9 @@ export class ClaudeAcpAgent implements Agent {
mcpServers,
systemPrompt,
settingSources: ["user", "project", "local"],
// If we want bypassPermissions to be an option, we have to start the session with it on.
// We change it immediately back to default below before returning the session.
permissionMode: "bypassPermissions",
permissionPromptToolName: PERMISSION_TOOL_NAME,
stderr: (err) => console.error(err),
// note: although not documented by the types, passing an absolute path
@@ -228,11 +231,14 @@ export class ClaudeAcpAgent implements Agent {
prompt: input,
options,
});
const permissionMode = "default";
// Change it back to default
await q.setPermissionMode(permissionMode);
this.sessions[sessionId] = {
query: q,
input: input,
cancelled: false,
permissionMode: "default",
permissionMode,
};
getAvailableSlashCommands(q).then((availableCommands) => {
@@ -251,7 +257,7 @@ export class ClaudeAcpAgent implements Agent {
sessionId,
models,
modes: {
currentModeId: "default",
currentModeId: permissionMode,
availableModes: [
{
id: "default",