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
5 changes: 5 additions & 0 deletions .changeset/bright-orcas-render.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@moonshot-ai/pi-tui": patch
---

Recognize Orca terminals that advertise Kitty inline-image support.
5 changes: 5 additions & 0 deletions .changeset/calm-images-display.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": patch
---

Display inline images when Orca explicitly advertises Kitty graphics support.
6 changes: 6 additions & 0 deletions packages/pi-tui/src/terminal-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ function detectCapabilitiesFromEnvironment(tmuxForwardsHyperlink: () => boolean)
return { images: "kitty", trueColor: true, hyperlinks: true };
}

// Orca advertises Kitty graphics support through ORCA_IMAGE_PROTOCOL. Check it before
// outer-terminal detection because variables like KITTY_WINDOW_ID can leak into its panes.
if (termProgram === "orca" && process.env['ORCA_IMAGE_PROTOCOL'] === "kitty") {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add an upstream intent card for Orca detection

This adds a new local capability-detection behavior to the vendored fork, but the commit leaves packages/pi-tui/UPSTREAM.md unchanged and none of its existing intent cards covers Orca image detection. The next upstream reconstruction therefore has no decision/why-not-in-app record telling maintainers to preserve this branch; add the mandatory intent card alongside the test before landing.

AGENTS.md reference: packages/pi-tui/AGENTS.md:L11-L17

Useful? React with 👍 / 👎.

return { images: "kitty", trueColor: true, hyperlinks: true };
}

if (process.env['KITTY_WINDOW_ID'] || termProgram === "kitty") {
return { images: "kitty", trueColor: true, hyperlinks: true };
}
Expand Down
16 changes: 16 additions & 0 deletions packages/pi-tui/test/terminal-image.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { visibleWidth } from "../src/utils.ts";
const ENV_KEYS = [
"TERM",
"TERM_PROGRAM",
"ORCA_IMAGE_PROTOCOL",
"TERMINAL_EMULATOR",
"COLORTERM",
"TMUX",
Expand Down Expand Up @@ -343,6 +344,21 @@ describe("detectCapabilities", () => {
});
});

it("keeps images disabled for Orca without an image capability signal", () => {
withEnv({ TERM_PROGRAM: "Orca" }, () => {
assert.strictEqual(detectCapabilities().images, null);
});
});

it("enables images and hyperlinks for Orca advertising Kitty support", () => {
withEnv({ TERM_PROGRAM: "Orca", ORCA_IMAGE_PROTOCOL: "kitty" }, () => {
const caps = detectCapabilities();
assert.strictEqual(caps.images, "kitty");
assert.strictEqual(caps.trueColor, true);
assert.strictEqual(caps.hyperlinks, true);
});
});

it("enables hyperlinks for Ghostty", () => {
withEnv({ TERM_PROGRAM: "ghostty" }, () => {
const caps = detectCapabilities();
Expand Down