Compare commits

..

2 Commits

Author SHA1 Message Date
dependabot[bot]
7c86d4b5a4 chore(deps): bump actions/create-github-app-token from 3.3.0 to 3.4.0 (#1699)
Bumps
[actions/create-github-app-token](https://github.com/actions/create-github-app-token)
from 3.3.0 to 3.4.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/actions/create-github-app-token/releases">actions/create-github-app-token's
releases</a>.</em></p>
<blockquote>
<h2>v3.4.0</h2>
<h2><a
href="https://github.com/actions/create-github-app-token/compare/v3.3.0...v3.4.0">3.4.0</a>
(2026-11-18)</h2>
<h3>Features</h3>
<ul>
<li>bump actions/setup-node from 6 to 7 (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/410">#410</a>)
(<a
href="09c1ab7079">09c1ab7</a>)</li>
<li>bump actions/stale from 10 to 11 (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/409">#409</a>)
(<a
href="679345a20e">679345a</a>)</li>
<li>bump stefanzweifel/git-auto-commit-action from 7.2.0 to 7.2.1 in the
github-actions group (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/408">#408</a>)
(<a
href="660c44c8ce">660c44c</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>deps:</strong> bump undici (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/406">#406</a>)
(<a
href="18e9994c8d">18e9994</a>)</li>
</ul>
<h2>v3.4.0-beta</h2>
<h2><a
href="https://github.com/actions/create-github-app-token/compare/v3.3.0...v3.4.0-beta">3.4.0-beta</a>
(2026-11-17)</h2>
<h3>Features</h3>
<ul>
<li>support GitHub Actions OIDC authentication (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/411">#411</a>)
(<a
href="8240f10d3a">8240f10</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/actions/create-github-app-token/blob/main/CHANGELOG.md">actions/create-github-app-token's
changelog</a>.</em></p>
<blockquote>
<h1>Changelog</h1>
<h2><a
href="https://github.com/actions/create-github-app-token/compare/v3.3.0...v3.4.0">3.4.0</a>
(2026-11-18)</h2>
<h3>Features</h3>
<ul>
<li>bump actions/setup-node from 6 to 7 (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/410">#410</a>)
(<a
href="09c1ab7079">09c1ab7</a>)</li>
<li>bump actions/stale from 10 to 11 (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/409">#409</a>)
(<a
href="679345a20e">679345a</a>)</li>
<li>bump stefanzweifel/git-auto-commit-action from 7.2.0 to 7.2.1 in the
github-actions group (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/408">#408</a>)
(<a
href="660c44c8ce">660c44c</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>deps:</strong> bump undici (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/406">#406</a>)
(<a
href="18e9994c8d">18e9994</a>)</li>
</ul>
<h2><a
href="https://github.com/actions/create-github-app-token/compare/v3.2.0...v3.3.0">3.3.0</a>
(2026-10-12)</h2>
<h3>Features</h3>
<ul>
<li>update permission inputs (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/399">#399</a>)
(<a
href="a47236f79f">a47236f</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>deps:</strong> bump nested undici from 6.24.0 to 6.29.0 (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/403">#403</a>)
(<a
href="12461a3a79">12461a3</a>)</li>
<li><strong>deps:</strong> bump the production-dependencies group across
1 directory with 3 updates (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/395">#395</a>)
(<a
href="a69c19ddfd">a69c19d</a>)</li>
</ul>
<h2><a
href="https://github.com/actions/create-github-app-token/compare/v3.1.1...v3.2.0">3.2.0</a>
(2026-05-12)</h2>
<h3>Features</h3>
<ul>
<li>add support for enterprise-level GitHub Apps (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/263">#263</a>)
(<a
href="952a2a7073">952a2a7</a>)</li>
<li>support full repository names in <code>repositories</code> input (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/372">#372</a>)
(<a
href="85eb8dd414">85eb8dd</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li><strong>deps:</strong> bump <code>@​actions/core</code> from 3.0.0
to 3.0.1 in the production-dependencies group (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/364">#364</a>)
(<a
href="43e5c345bf">43e5c34</a>)</li>
<li>validate private-key input (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/376">#376</a>)
(<a
href="f24bbd8964">f24bbd8</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="f418cff399"><code>f418cff</code></a>
chore(main): release 3.4.0 (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/415">#415</a>)</li>
<li><a
href="09c1ab7079"><code>09c1ab7</code></a>
feat: bump actions/setup-node from 6 to 7 (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/410">#410</a>)</li>
<li><a
href="01b8009bd6"><code>01b8009</code></a>
test: strip ANSI escape codes from snapshot output (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/412">#412</a>)</li>
<li><a
href="e056864841"><code>e056864</code></a>
build(deps-dev): bump undici from 8.12.3 to 8.12.4 (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/416">#416</a>)</li>
<li><a
href="679345a20e"><code>679345a</code></a>
feat: bump actions/stale from 10 to 11 (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/409">#409</a>)</li>
<li><a
href="660c44c8ce"><code>660c44c</code></a>
feat: bump stefanzweifel/git-auto-commit-action from 7.2.0 to 7.2.1 in
the gi...</li>
<li><a
href="18e9994c8d"><code>18e9994</code></a>
fix(deps): bump undici (<a
href="https://redirect.github.com/actions/create-github-app-token/issues/406">#406</a>)</li>
<li>See full diff in <a
href="64ab729a62...f418cff399">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/create-github-app-token&package-manager=github_actions&previous-version=3.3.0&new-version=3.4.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-23 15:57:45 +01:00
Ben Brandt
9ca8984d55 fix: preserve existing line endings in ACP v2 terminal output (#1697)
Claude Code pipes command output, so a v2 display terminal needs a
carriage return before a bare line feed to start the next line at column
zero. Bash output can also contain CRLF and standalone carriage returns
used for progress updates. The encoder added an extra CR to existing
CRLF.

Convert only bare LF in v2 terminal chunks and snapshots. Track the
preceding CR on each running terminal so CRLF can span two chunks. A
replacement snapshot starts fresh and supplies the trailing character
for the next chunk. This also covers background output, where the
output-file reader can send a snapshot ending in CR and then append a
chunk starting with LF.

The regression test checks mixed line endings, progress updates, empty
chunks, and snapshot replacement. The corresponding Codex fix is
[codex-acp#795](https://github.com/agentclientprotocol/codex-acp/pull/795).
2026-11-23 14:06:40 +00:00
3 changed files with 52 additions and 36 deletions

View File

@@ -36,7 +36,7 @@ jobs:
# Generating a GitHub token, so that PRs and tags created by
# the release-please-action can trigger actions workflows.
- name: Generate GitHub token
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510
uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc
id: generate-token
with:
# GitHub App ID secret name
@@ -292,7 +292,7 @@ jobs:
exit 1
- name: Generate token scoped to the registry repo
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510
uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc
id: registry-token
with:
app-id: ${{ secrets.REGISTRY_UPDATER_APP_ID }}

View File

@@ -10234,30 +10234,39 @@ describe("ACP v2 session translation", () => {
expect(terminals.split("s", hook)).toEqual({ terminal: [], report: hook });
});
it("sends piped output with each line feed as CR LF, as a PTY would", () => {
it("adds CR only to bare line feeds in terminal chunks and snapshots", () => {
const terminals = new V2Terminals();
const decoded = (data: unknown) => Buffer.from(String(data), "base64").toString();
terminals.split("s", {
sessionUpdate: "tool_call",
toolCallId: "toolu_bash",
title: "Terminal",
_meta: { terminal_info: { terminal_id: "term" } },
});
const [chunk] = terminals.split("s", {
sessionUpdate: "tool_call_update",
toolCallId: "toolu_bash",
_meta: { terminal_output_delta: { terminal_id: "term", data: "a\nb\n" } },
}).terminal;
expect(chunk).toMatchObject({ sessionUpdate: "terminal_output_chunk" });
expect(decoded((chunk as { data: string }).data)).toBe("a\r\nb\r\n");
// The line discipline adds a CR before every LF, also one that a CR precedes.
const [snapshot] = terminals.split("s", {
sessionUpdate: "tool_call_update",
toolCallId: "toolu_bash",
_meta: { terminal_output: { terminal_id: "term", data: "a\nb\r\n" } },
}).terminal;
expect(snapshot).toMatchObject({ sessionUpdate: "terminal_update" });
expect(decoded((snapshot as { output: { data: string } }).output.data)).toBe("a\r\nb\r\r\n");
const emit = (key: "terminal_output" | "terminal_output_delta", data: string) =>
terminals.split("s", {
sessionUpdate: "tool_call_update",
toolCallId: "toolu_bash",
_meta: { [key]: { terminal_id: "term", data } },
}).terminal[0];
const chunk = (text: string, expected: string) =>
expect(emit("terminal_output_delta", text)).toMatchObject({
sessionUpdate: "terminal_output_chunk",
data: Buffer.from(expected).toString("base64"),
});
const snapshot = (text: string, expected: string) =>
expect(emit("terminal_output", text)).toMatchObject({
sessionUpdate: "terminal_update",
output: { data: Buffer.from(expected).toString("base64") },
});
chunk("a\nb\r\n10%\r20%\r", "a\r\nb\r\n10%\r20%\r");
chunk("", "");
chunk("\nend\r", "\nend\r");
// A snapshot replaces the preceding bytes, including their trailing CR.
snapshot("\ndone\r\n", "\r\ndone\r\n");
chunk("\n", "\r\n");
snapshot("waiting\r", "waiting\r");
chunk("\n", "\n");
});
it("leaves an exit code that the agent does not know out of the terminal's exit", () => {

View File

@@ -33,13 +33,17 @@ const TERMINAL_KEYS = [
"terminal_exit",
] as const;
interface RunningTerminal {
terminalId: string;
command?: string;
cancellable?: boolean;
endsInCR: boolean;
}
/** The terminal updates of the tool call reports of one v2 connection. */
export class V2Terminals {
/** The terminal and the last reported command of each running command, by session and tool call. */
private readonly running = new Map<
string,
{ terminalId: string; command?: string; cancellable?: boolean }
>();
/** The display terminal of each running command, by session and tool call. */
private readonly running = new Map<string, RunningTerminal>();
/**
* The terminal updates that a tool call report carries in the extension's
@@ -63,7 +67,7 @@ export class V2Terminals {
meta.terminal_info &&
this.running.get(key)?.terminalId !== meta.terminal_info.terminal_id
) {
this.running.set(key, { terminalId: meta.terminal_info.terminal_id });
this.running.set(key, { terminalId: meta.terminal_info.terminal_id, endsInCR: false });
}
const terminal: v2.SessionUpdate[] = [];
const running = this.running.get(key);
@@ -77,7 +81,7 @@ export class V2Terminals {
sessionUpdate: "terminal_update",
terminalId: running.terminalId,
...(newCommand ? { command } : {}),
...(output ? { output: { data: terminalBytes(output.data) } } : {}),
...(output ? { output: { data: terminalBytes(output.data, running, "snapshot") } } : {}),
...(exit
? {
exitStatus: {
@@ -94,7 +98,7 @@ export class V2Terminals {
terminal.push({
sessionUpdate: "terminal_output_chunk",
terminalId: running.terminalId,
data: terminalBytes(delta.data),
data: terminalBytes(delta.data, running, "chunk"),
});
}
if (exit) this.running.delete(key);
@@ -161,13 +165,16 @@ function commandOf(rawInput: unknown): string | undefined {
return typeof command === "string" && command.length > 0 ? command : undefined;
}
/**
* The output as the bytes a PTY would have delivered, base64-encoded as a v2
* terminal carries them. A v2 terminal carries the bytes a terminal emulator
* receives, but Claude Code runs a command with its output piped, so no line
* discipline turned each LF into CR LF (`ONLCR`). Without the CR, an emulator
* moves down a row and keeps the column: "a\nb" draws "b" under the end of "a".
*/
function terminalBytes(text: string): string {
return Buffer.from(text.replaceAll("\n", "\r\n"), "utf8").toString("base64");
/** Insert a carriage return before bare LF so the next line starts at column zero. */
function terminalBytes(
text: string,
terminal: RunningTerminal,
kind: "snapshot" | "chunk",
): string {
const followsCR = kind === "chunk" && terminal.endsInCR;
const normalized = text.replace(/(?<!\r)\n/g, (lf, offset) =>
offset === 0 && followsCR ? lf : "\r\n",
);
if (kind === "snapshot" || text.length > 0) terminal.endsInCR = text.endsWith("\r");
return Buffer.from(normalized, "utf8").toString("base64");
}