@agentclientprotocol/claude-agent-acp 0.107.1-preview.2 → 0.107.1-preview.3

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.
@@ -40,7 +40,7 @@ export class V2Terminals {
40
40
  sessionUpdate: "terminal_update",
41
41
  terminalId: running.terminalId,
42
42
  ...(newCommand ? { command } : {}),
43
- ...(output ? { output: { data: base64(output.data) } } : {}),
43
+ ...(output ? { output: { data: terminalBytes(output.data) } } : {}),
44
44
  ...(exit
45
45
  ? {
46
46
  exitStatus: {
@@ -57,7 +57,7 @@ export class V2Terminals {
57
57
  terminal.push({
58
58
  sessionUpdate: "terminal_output_chunk",
59
59
  terminalId: running.terminalId,
60
- data: base64(delta.data),
60
+ data: terminalBytes(delta.data),
61
61
  });
62
62
  }
63
63
  if (exit)
@@ -115,7 +115,13 @@ function commandOf(rawInput) {
115
115
  const command = rawInput?.command;
116
116
  return typeof command === "string" && command.length > 0 ? command : undefined;
117
117
  }
118
- /** The output bytes, base64-encoded as a v2 terminal carries them. */
119
- function base64(text) {
120
- return Buffer.from(text, "utf8").toString("base64");
118
+ /**
119
+ * The output as the bytes a PTY would have delivered, base64-encoded as a v2
120
+ * terminal carries them. A v2 terminal carries the bytes a terminal emulator
121
+ * receives, but Claude Code runs a command with its output piped, so no line
122
+ * discipline turned each LF into CR LF (`ONLCR`). Without the CR, an emulator
123
+ * moves down a row and keeps the column: "a\nb" draws "b" under the end of "a".
124
+ */
125
+ function terminalBytes(text) {
126
+ return Buffer.from(text.replaceAll("\n", "\r\n"), "utf8").toString("base64");
121
127
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.107.1-preview.2",
6
+ "version": "0.107.1-preview.3",
7
7
  "description": "An ACP-compatible coding agent powered by the Claude Agent SDK (TypeScript)",
8
8
  "main": "dist/lib.js",
9
9
  "types": "dist/lib.d.ts",