Merge pull request #996 from wrapss/windows-newline-fix

fix: Stream parsing for Windows Zed integration
This commit is contained in:
pomelo
2025-11-10 09:52:47 +08:00
committed by GitHub

View File

@@ -7,7 +7,6 @@
/* ACP defines a schema for a simple (experimental) JSON-RPC protocol that allows GUI applications to interact with agents. */ /* ACP defines a schema for a simple (experimental) JSON-RPC protocol that allows GUI applications to interact with agents. */
import { z } from 'zod'; import { z } from 'zod';
import { EOL } from 'node:os';
import * as schema from './schema.js'; import * as schema from './schema.js';
export * from './schema.js'; export * from './schema.js';
@@ -173,7 +172,7 @@ class Connection {
const decoder = new TextDecoder(); const decoder = new TextDecoder();
for await (const chunk of output) { for await (const chunk of output) {
content += decoder.decode(chunk, { stream: true }); content += decoder.decode(chunk, { stream: true });
const lines = content.split(EOL); const lines = content.split('\n');
content = lines.pop() || ''; content = lines.pop() || '';
for (const line of lines) { for (const line of lines) {