mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
Merge branch 'main' into imanolmaiztegui/kilo-opencode-v1.14.34
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { describe, expect, test } from "bun:test"
|
||||
import { plain, session, supports, tui } from "../../src/kilocode/cli/logo"
|
||||
|
||||
describe("kilocode logo", () => {
|
||||
test("falls back on remote terminals", () => {
|
||||
expect(supports({ SSH_TTY: "/dev/pts/0" }, "linux")).toBe(false)
|
||||
expect(supports({ SSH_CLIENT: "127.0.0.1 12345 22" }, "linux")).toBe(false)
|
||||
expect(supports({ SSH_CONNECTION: "127.0.0.1 12345 127.0.0.1 22" }, "linux")).toBe(false)
|
||||
})
|
||||
|
||||
test("allows Windows Terminal locally", () => {
|
||||
expect(supports({}, "win32")).toBe(true)
|
||||
expect(supports({ WT_SESSION: "session" }, "linux")).toBe(true)
|
||||
})
|
||||
|
||||
test("allows an override", () => {
|
||||
expect(supports({ KILO_UNICODE_LOGO: "1", SSH_TTY: "/dev/pts/0" }, "linux")).toBe(true)
|
||||
expect(supports({ KILO_UNICODE_LOGO: "0" }, "linux")).toBe(false)
|
||||
})
|
||||
|
||||
test("uses modern and fallback logo variants", () => {
|
||||
expect(tui({ KILO_UNICODE_LOGO: "1" }, "linux").join("\n")).toContain("🬺🬏")
|
||||
expect(tui({ SSH_TTY: "/dev/pts/0" }, "linux").join("\n")).not.toContain("🬺🬏")
|
||||
expect(plain({ SSH_TTY: "/dev/pts/0" }, "linux").join("\n")).not.toContain("🬁🬬")
|
||||
})
|
||||
|
||||
test("formats child session exit logo", () => {
|
||||
const out = session("Title", "ses_test", "<dim>", "<reset>", { SSH_TTY: "/dev/pts/0" }, "linux")
|
||||
expect(out).toContain("<dim>Title<reset>")
|
||||
expect(out).not.toContain("🬺🬏")
|
||||
})
|
||||
})
|
||||
@@ -1524,6 +1524,7 @@ unix(
|
||||
30_000,
|
||||
)
|
||||
|
||||
// kilocode_change start - cancel persists aborted shell result when shell ignores TERM
|
||||
unix(
|
||||
"cancel persists aborted shell result when shell ignores TERM",
|
||||
() =>
|
||||
@@ -1531,12 +1532,32 @@ unix(
|
||||
provideTmpdirInstance(
|
||||
(_dir) =>
|
||||
Effect.gen(function* () {
|
||||
const { prompt, chat } = yield* boot()
|
||||
const { prompt, chat, sessions } = yield* boot()
|
||||
|
||||
const sh = yield* prompt
|
||||
.shell({ sessionID: chat.id, agent: "build", command: "trap '' TERM; sleep 30" })
|
||||
.shell({
|
||||
sessionID: chat.id,
|
||||
agent: "build",
|
||||
command: "trap '' TERM; printf started; sleep 10; printf not-killed",
|
||||
})
|
||||
.pipe(Effect.forkChild)
|
||||
yield* Effect.sleep(50)
|
||||
yield* waitFor(
|
||||
"shell start output",
|
||||
sessions
|
||||
.messages({ sessionID: chat.id })
|
||||
.pipe(
|
||||
Effect.map((msgs) =>
|
||||
msgs
|
||||
.flatMap((msg) => msg.parts)
|
||||
.find(
|
||||
(part) =>
|
||||
part.type === "tool" &&
|
||||
part.state.status === "running" &&
|
||||
(part.state.metadata?.output ?? "").includes("started"),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
yield* prompt.cancel(chat.id)
|
||||
|
||||
@@ -1546,7 +1567,9 @@ unix(
|
||||
expect(exit.value.info.role).toBe("assistant")
|
||||
const tool = completedTool(exit.value.parts)
|
||||
if (tool) {
|
||||
expect(tool.state.output).toContain("started")
|
||||
expect(tool.state.output).toContain("User aborted the command")
|
||||
expect(tool.state.output).not.toContain("not-killed")
|
||||
}
|
||||
}
|
||||
}),
|
||||
@@ -1555,6 +1578,7 @@ unix(
|
||||
),
|
||||
30_000,
|
||||
)
|
||||
// kilocode_change end
|
||||
|
||||
unix(
|
||||
"cancel finalizes interrupted bash tool output through normal truncation",
|
||||
|
||||
Reference in New Issue
Block a user