Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ public class StreamingTransport implements AutoCloseable {
// State Machine Constants
// ============================================================

private static boolean isWindows;
static {
isWindows = System.getProperty("os.name").toLowerCase().contains("win");
}

/** Transport is created but not connected */
public static final int STATE_DISCONNECTED = 0;

Expand Down Expand Up @@ -418,7 +423,7 @@ List<String> buildStreamingCommand(CLIOptions options) {
// Note: --append-system-prompt adds to the default, --system-prompt replaces it
if (options.getSystemPrompt() != null) {
command.add("--system-prompt");
command.add(options.getSystemPrompt());
command.add(this.normalizeNewline(options.getSystemPrompt()));
}

// Handle --tools option (base set of tools) - added in Python SDK v0.1.10
Expand Down Expand Up @@ -539,7 +544,7 @@ List<String> buildStreamingCommand(CLIOptions options) {
// Add append system prompt (uses preset mode with append)
if (options.getAppendSystemPrompt() != null && !options.getAppendSystemPrompt().isEmpty()) {
command.add("--append-system-prompt");
command.add(options.getAppendSystemPrompt());
command.add(this.normalizeNewline(options.getAppendSystemPrompt()));
}

// ============================================================
Expand Down Expand Up @@ -608,6 +613,18 @@ List<String> buildStreamingCommand(CLIOptions options) {
return command;
}

private String normalizeNewline(String command) {
if (command == null || command.isEmpty()) {
return "";
}

if(isWindows){
return command.replaceAll("\r\n?", "\n").replaceAll("\n", " ");
}else{
return command;
}
}

/**
* Builds the MCP config map for CLI serialization. SDK servers have their instances
* stripped (not serializable); only type and name are passed.
Expand Down
Loading