Skip to content

The agent that grows with you

fix(desktop): /config skips empty config sections

Teknium627128747d4e
diff --git a/apps/desktop/src/app/session/hooks/use-prompt-actions/slash-desktop-commands.test.tsx b/apps/desktop/src/app/session/hooks/use-prompt-actions/slash-desktop-commands.test.tsx
index 8d90fc9c58b..b5649c157dc 100644
--- a/apps/desktop/src/app/session/hooks/use-prompt-actions/slash-desktop-commands.test.tsx
+++ b/apps/desktop/src/app/session/hooks/use-prompt-actions/slash-desktop-commands.test.tsx
@@ -191,7 +191,7 @@ describe('/agents', () => {
describe('/config', () => {
it("shows the profile's client config projection from config.get", async () => {
const requestGateway = gateway(method =>
- method === 'config.get' ? { config: { display: { skin: 'mono', timestamps: true } } } : undefined
+ method === 'config.get' ? { config: { display: { skin: 'mono', timestamps: true }, voice: {} } } : undefined
)
const handle = await mount(requestGateway)
@@ -201,6 +201,8 @@ describe('/config', () => {
expect(callsOf(requestGateway, 'config.get')).toEqual([{ session_id: RUNTIME_SESSION_ID, key: 'full' }])
const text = renderedText(handle)
expect(text).toContain('skin: mono')
+ // An empty section (the live projection always carries `voice: {}`) prints no dangling header.
+ expect(text).not.toContain('voice:')
expect(text).toContain('Settings')
})
})
diff --git a/apps/desktop/src/app/session/hooks/use-prompt-actions/slash-desktop-commands.ts b/apps/desktop/src/app/session/hooks/use-prompt-actions/slash-desktop-commands.ts
index 47ebb3acbff..29dd5a9f3ce 100644
--- a/apps/desktop/src/app/session/hooks/use-prompt-actions/slash-desktop-commands.ts
+++ b/apps/desktop/src/app/session/hooks/use-prompt-actions/slash-desktop-commands.ts
@@ -196,7 +196,9 @@ function yamlLines(value: unknown, indent = ''): string[] {
return Object.entries(value as Record<string, unknown>).flatMap(([key, child]) =>
child !== null && typeof child === 'object' && !Array.isArray(child)
- ? [`${indent}${key}:`, ...yamlLines(child, `${indent} `)]
+ ? Object.keys(child).length
+ ? [`${indent}${key}:`, ...yamlLines(child, `${indent} `)]
+ : []
: [`${indent}${key}: ${Array.isArray(child) ? JSON.stringify(child) : String(child)}`]
)
}