From 22af266b4f3b865144279c81bc77c5cb4dbe7fd6 Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Thu, 30 Jul 2026 23:42:58 -0500 Subject: [PATCH] fix(tui): stop announcing attachments outside the composer The token in the input line is the whole receipt. Drop the notices that duplicated it somewhere the user was not looking: the drag-drop and clipboard sys() lines, and the attachedImageNotice / "detected file: X" activity rows above the status bar. attachedImageNotice and imageTokenMeta have no callers left. --- ui-tui/src/app/submissionCore.ts | 12 +++++------- ui-tui/src/domain/messages.ts | 23 +---------------------- 2 files changed, 6 insertions(+), 29 deletions(-) diff --git a/ui-tui/src/app/submissionCore.ts b/ui-tui/src/app/submissionCore.ts index c99eca09f2e..aa6cd98db6c 100644 --- a/ui-tui/src/app/submissionCore.ts +++ b/ui-tui/src/app/submissionCore.ts @@ -1,4 +1,3 @@ -import { attachedImageNotice } from '../domain/messages.js' import type { GatewayClient } from '../gatewayClient.js' import type { InputDetectDropResponse, PromptSubmitResponse } from '../gatewayTypes.js' import type { Msg } from '../types.js' @@ -109,6 +108,11 @@ export function submitPrompt( // Always ask the backend whether this looks like a file drop. The backend's // _detect_file_drop handles paths with spaces, quotes, Windows drive letters, // and escaped characters correctly. + // + // No notice is emitted for a match: an image dropped into the composer already + // shows as an `[[ Image N ]]` token, and a matched non-image path is rewritten + // in place. Announcing it a second time above the status bar was the old + // out-of-band attachment UI. deps.gw .request('input.detect_drop', { session_id: sid, text }) .then(r => { @@ -116,12 +120,6 @@ export function submitPrompt( return startSubmit(text, deps.expand(text), showUserMessage) } - if (r.is_image) { - turnController.pushActivity(attachedImageNotice(r)) - } else { - turnController.pushActivity(`detected file: ${r.name}`) - } - startSubmit(r.text || text, deps.expand(r.text || text), showUserMessage) }) .catch(() => startSubmit(text, deps.expand(text), showUserMessage)) diff --git a/ui-tui/src/domain/messages.ts b/ui-tui/src/domain/messages.ts index 45fbf606c0b..b4428520d81 100644 --- a/ui-tui/src/domain/messages.ts +++ b/ui-tui/src/domain/messages.ts @@ -1,24 +1,9 @@ import { LONG_MSG } from '../config/limits.js' -import { buildToolTrailLine, fmtK } from '../lib/text.js' +import { buildToolTrailLine } from '../lib/text.js' import type { Msg, SessionInfo } from '../types.js' export const introMsg = (info: SessionInfo): Msg => ({ info, kind: 'intro', role: 'system', text: '' }) -export const imageTokenMeta = (info?: ImageMeta | null) => { - const { width, height, token_estimate: t } = info ?? {} - - return [width && height ? `${width}x${height}` : '', (t ?? 0) > 0 ? `~${fmtK(t!)} tok` : ''] - .filter(Boolean) - .join(' ยท ') -} - -export const attachedImageNotice = (info?: ({ name?: string } & ImageMeta) | null) => { - const meta = imageTokenMeta(info) - const label = info?.name ? `๐Ÿ“Ž Attached image: ${info.name}` : '๐Ÿ“Ž Attached image' - - return `${label}${meta ? ` ยท ${meta}` : ''}` -} - export const userDisplay = (text: string) => { if (text.length <= LONG_MSG) { return text @@ -112,12 +97,6 @@ export const fmtDuration = (ms: number) => { return h > 0 ? `${h}h ${m}m` : m > 0 ? `${m}m ${s}s` : `${s}s` } -interface ImageMeta { - height?: number - token_estimate?: number - width?: number -} - interface TranscriptRow { context?: string display_kind?: string