mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-17 13:13:35 +08:00
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
This commit is contained in:
parent
3ce7b02fc2
commit
c6bc51a9fd
@ -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, unknown>): string {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user