Skip to content

Commit e9a68ca

Browse files
committed
Generate title for attachment-only messages
1 parent 7d2e4f2 commit e9a68ca

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

apps/code/src/renderer/utils/session.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,16 @@ export function extractUserPromptsFromEvents(events: AcpMessage[]): string[] {
182182
if (isJsonRpcRequest(msg) && msg.method === "session/prompt") {
183183
const params = msg.params as { prompt?: ContentBlock[] };
184184
if (params?.prompt?.length) {
185-
// Find first visible text block (skip hidden context blocks)
186-
const textBlock = params.prompt.find((b) => {
187-
if (b.type !== "text") return false;
188-
const meta = (b as { _meta?: { ui?: { hidden?: boolean } } })._meta;
189-
return !meta?.ui?.hidden;
190-
});
191-
if (textBlock && textBlock.type === "text") {
192-
prompts.push(textBlock.text);
185+
const { text, attachments } = extractPromptDisplayContent(
186+
params.prompt,
187+
{ filterHidden: true },
188+
);
189+
190+
if (text) {
191+
prompts.push(text);
192+
} else if (attachments.length > 0) {
193+
const labels = attachments.map((a) => a.label).join(", ");
194+
prompts.push(`[Attached files: ${labels}]`);
193195
}
194196
}
195197
}

0 commit comments

Comments
 (0)