Compare commits

...

2 Commits

Author SHA1 Message Date
Kit Langton 5d37d68bc4 fix(tui): move debug overlay to devtools 2026-08-07 20:33:54 +00:00
opencode-agent[bot] 0b84e24e65 fix(tui): standardize compact terminology (#41141) 2026-08-07 16:26:14 -04:00
9 changed files with 22 additions and 19 deletions
-10
View File
@@ -156,7 +156,6 @@ const appBindingCommands = [
"help.show",
"docs.open",
"diff.open",
"app.debug",
"app.console",
"terminal.suspend",
"terminal.title.toggle",
@@ -958,15 +957,6 @@ function App(props: { pair?: DialogPairCredentials }) {
run: () => exit(),
category: "System",
},
{
name: "app.debug",
title: "Toggle debug panel",
category: "System",
run: () => {
renderer.toggleDebugOverlay()
dialog.clear()
},
},
{
name: "app.console",
title: "Toggle console",
@@ -41,6 +41,7 @@ export function DevToolsBar() {
const [dumping, setDumping] = createSignal(false)
const [dumpPath, setDumpPath] = createSignal<string>()
const [dumpError, setDumpError] = createSignal<string>()
const [debugOverlay, setDebugOverlay] = createSignal(Boolean(renderer.debugOverlay.enabled))
const [frontendSamples, setFrontendSamples] = createSignal<readonly ProcessSample[]>([])
let focus: Renderable | null
const connected = createMemo(() => client.connection.status() === "connected")
@@ -391,6 +392,15 @@ export function DevToolsBar() {
>
{verboseTurnTokens() ? "[x]" : "[ ]"} Turn token usage (verbose)
</Action>
<Action
onClick={() => {
renderer.toggleDebugOverlay()
setDebugOverlay(Boolean(renderer.debugOverlay.enabled))
}}
hoverBackground
>
{debugOverlay() ? "[x]" : "[ ]"} Renderer debug overlay
</Action>
</box>
<For each={groups()}>
{(group) => (
-2
View File
@@ -46,7 +46,6 @@ export const Definitions = {
leader: keybind(LeaderDefault, "Leader key for keybind combinations"),
app_exit: keybind("ctrl+c,ctrl+d,<leader>q", "Exit the application"),
app_debug: keybind("none", "Toggle debug panel"),
app_console: keybind("none", "Toggle console"),
app_heap_snapshot: keybind("none", "Write heap snapshot"),
app_toggle_animations: keybind("none", "Toggle animations"),
@@ -251,7 +250,6 @@ export const Descriptions = Object.fromEntries(
) as Record<KeybindName, string>
export const CommandMap = {
app_exit: "app.exit",
app_debug: "app.debug",
app_console: "app.console",
app_heap_snapshot: "app.heap_snapshot",
app_toggle_animations: "app.toggle.animations",
+1 -1
View File
@@ -407,7 +407,7 @@ export function RunCommandMenuBody(props: {
name: "compact",
display: "Compact session",
footer: "/compact",
keywords: "compact summarize session context",
keywords: "compact session context",
},
{
action: "slash",
+1 -1
View File
@@ -406,7 +406,7 @@ export function createPromptState(input: PromptInput): PromptState {
kind: "slash",
name: "compact",
display: "/compact",
description: "summarize the session to reduce context usage",
description: "compact older session context to free space",
} satisfies SlashOption,
{ kind: "slash", name: "exit", display: "/exit", description: "close OpenCode" } satisfies SlashOption,
]
+1 -2
View File
@@ -54,8 +54,7 @@ export function isNewCommand(input: string): boolean {
}
export function isCompactCommand(input: string): boolean {
const text = input.trim().toLowerCase()
return text === "/compact" || text === "/summarize"
return input.trim().toLowerCase() === "/compact"
}
export function createPromptHistory(items?: RunPrompt[]): PromptHistoryState {
@@ -635,7 +635,6 @@ export function Session() {
group: "Session",
slash: {
name: "compact",
aliases: ["summarize"],
},
run: () => {
void client.api.session.compact({ sessionID: route.sessionID })
@@ -1,6 +1,7 @@
import { describe, expect, test } from "bun:test"
import {
createPromptHistory,
isCompactCommand,
isExitCommand,
isNewCommand,
movePromptHistory,
@@ -98,4 +99,10 @@ describe("run prompt shared", () => {
expect(isNewCommand(" /NEW ")).toBe(true)
expect(isNewCommand("/new now")).toBe(false)
})
test("recognizes only the compact command", () => {
expect(isCompactCommand("/compact")).toBe(true)
expect(isCompactCommand(" /COMPACT ")).toBe(true)
expect(isCompactCommand("/summarize")).toBe(false)
})
})
+2 -2
View File
@@ -80,7 +80,7 @@ describe("run runtime queue", () => {
])
})
test.each(["/compact", "/summarize"])("treats %s as a local compaction command", async (command) => {
test("treats /compact as a local compaction command", async () => {
const ui = createFooterApiFixture()
const seen: string[] = []
let compacted = 0
@@ -96,7 +96,7 @@ describe("run runtime queue", () => {
},
})
ui.submit(command)
ui.submit("/compact")
ui.submit("hello")
await task