From c6bc51a9fdea61428f60215215abd604a4252e24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E9=98=BF=E6=B1=9F=28Relakkes?= =?UTF-8?q?=29?= Date: Tue, 19 May 2026 04:10:44 +0800 Subject: [PATCH] fix: Keep agent group label formatting type-safe The structured Agent fallback formatter used indexed string access to capitalize grouped result labels, which fails under the desktop TypeScript build because the first character may be undefined. Use charAt so the formatter remains equivalent while satisfying noUncheckedIndexedAccess. Constraint: desktop build runs tsc with strict indexed access checks Rejected: Non-null assertion on normalized[0] | keeps the fragile indexed access pattern Confidence: high Scope-risk: narrow Directive: Prefer string helpers over indexed access in build-sensitive UI formatting code Tested: cd desktop && bun run build Not-tested: Full macOS packaging script after the frontend build failure point --- desktop/src/components/chat/ToolCallGroup.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/src/components/chat/ToolCallGroup.tsx b/desktop/src/components/chat/ToolCallGroup.tsx index d35fd613..ecdd7d56 100644 --- a/desktop/src/components/chat/ToolCallGroup.tsx +++ b/desktop/src/components/chat/ToolCallGroup.tsx @@ -989,7 +989,7 @@ function formatAgentStructuredNestedItem(item: unknown): string { function formatAgentGroupLabel(label: string): string { const normalized = label.trim() if (!normalized) return 'Grouped results' - return normalized.length > 1 ? `${normalized[0].toUpperCase()}${normalized.slice(1)}` : normalized.toUpperCase() + return `${normalized.charAt(0).toUpperCase()}${normalized.slice(1)}` } function formatAgentResultLocation(record: Record): string {