-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
When using systemPrompt with a newline character (\n) on Windows, the PermissionMode does not work as expected.
Reproduction Steps
-
Initialize
ClaudeSyncClientwithPermissionMode.BYPASS_PERMISSIONS -
Case 1 (Works correctly): Do not set
systemPrompt(or set it without\n)- Code snippet:
try (ClaudeSyncClient client = ClaudeClient.sync() .workingDirectory(Path.of(".")) .model(MODEL_HAIKU) .permissionMode(PermissionMode.BYPASS_PERMISSIONS) .build()) { client.connect("hi"); Iterator<ParsedMessage> response = client.receiveResponse(); while (response.hasNext()) { ParsedMessage msg = response.next(); if (msg.isRegularMessage() && msg.asMessage() instanceof SystemMessage system) { String permissionMode = (String) system.data().get("permissionMode"); System.out.println(permissionMode); } } } catch (Exception e) { // ignore }
- Output:
bypassPermissions(expected)
- Code snippet:
-
Case 2 (Abnormal behavior): Set
systemPromptwith\n(e.g.,"You are an AI assistant.\n")- Code snippet:
public static void main(String[] args) { try (ClaudeSyncClient client = ClaudeClient.sync() .workingDirectory(Path.of(".")) .model(MODEL_HAIKU) .systemPrompt("You are an AI assistant.\n") .permissionMode(PermissionMode.BYPASS_PERMISSIONS) .build()) { client.connect("hi"); Iterator<ParsedMessage> response = client.receiveResponse(); while (response.hasNext()) { ParsedMessage msg = response.next(); if (msg.isRegularMessage() && msg.asMessage() instanceof SystemMessage system) { String permissionMode = (String) system.data().get("permissionMode"); System.out.println(permissionMode); } } } catch (Exception e) { // ignore } }
- Output:
default(unexpected, should bebypassPermissions)
- Code snippet:
Environment
- OS: Windows
- Key issue: The existence of
\ninsystemPromptcausesPermissionModeto not be applied correctly.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels