mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-17 17:43:04 +08:00
fix(agent-manager): address terminal renderer review
This commit is contained in:
@@ -2,4 +2,4 @@
|
||||
"kilo-code": patch
|
||||
---
|
||||
|
||||
Batch Agent Manager terminal output by animation frame and pause rendering for hidden terminals
|
||||
Use the DOM renderer for Agent Manager terminals to avoid WebGL context failures, while batching output and pausing hidden-terminal rendering
|
||||
|
||||
@@ -101,6 +101,7 @@ test("fits and forces the initial PTY dimensions before socket attach", () => {
|
||||
|
||||
test("keeps terminal sockets mounted while history is open", () => {
|
||||
expect(css).toContain(".am-detail-stack-hidden")
|
||||
expect(css).toMatch(/\.am-detail-stack-hidden[^}]*top: 36px/s)
|
||||
expect(css).toMatch(/\.am-detail-stack-hidden[^}]*transform: translate\(-100vw, 0\)/s)
|
||||
})
|
||||
|
||||
|
||||
@@ -146,6 +146,22 @@ describe("Agent Manager terminal input buffer", () => {
|
||||
|
||||
expect(input.take()).toBe("bcde2345")
|
||||
})
|
||||
|
||||
it("clears buffered input after a failed replay", () => {
|
||||
const input = createInputBuffer()
|
||||
input.add("command\r")
|
||||
input.add("reply", true)
|
||||
input.clear()
|
||||
expect(input.take()).toBe("")
|
||||
})
|
||||
|
||||
it("does not flush input when replay exceeds its limit", () => {
|
||||
let flushed = 0
|
||||
const gate = createReplayGate({ write: () => undefined, flush: () => flushed++ })
|
||||
gate.attach(false)
|
||||
expect(gate.output("x".repeat(8 * 1024 * 1024 + 1))).toBe(false)
|
||||
expect(flushed).toBe(0)
|
||||
})
|
||||
})
|
||||
|
||||
describe("Agent Manager terminal replay gate", () => {
|
||||
|
||||
@@ -4911,7 +4911,10 @@ body.vscode-high-contrast-light {
|
||||
|
||||
.am-detail-stack-hidden {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
top: 36px;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transform: translate(-100vw, 0);
|
||||
|
||||
@@ -332,14 +332,22 @@ export const TerminalTab: Component<Props> = (props) => {
|
||||
if (closed || ws !== next) return
|
||||
streamed = true
|
||||
if (typeof event.data === "string") {
|
||||
replay.output(event.data)
|
||||
if (!replay.output(event.data)) {
|
||||
input.clear()
|
||||
next.close(1009, "terminal replay exceeded limit")
|
||||
return
|
||||
}
|
||||
scheduleFlush()
|
||||
return
|
||||
}
|
||||
if (event.data instanceof ArrayBuffer) {
|
||||
const bytes = new Uint8Array(event.data)
|
||||
if (replay.frame(bytes)) return
|
||||
replay.output(bytes)
|
||||
if (!replay.output(bytes)) {
|
||||
input.clear()
|
||||
next.close(1009, "terminal replay exceeded limit")
|
||||
return
|
||||
}
|
||||
scheduleFlush()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,12 @@ export function createInputBuffer(limit = 256 * 1024) {
|
||||
return data
|
||||
}
|
||||
|
||||
return { add, take }
|
||||
const clear = () => {
|
||||
replies = ""
|
||||
input = ""
|
||||
}
|
||||
|
||||
return { add, clear, take }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user