feat(desktop): propose typo fixes inside the suggestion popup and make suggestions snappier

While suggestions are on, typos are no longer replaced silently. The popup shows
the fix next to the candidate and applies it only when the candidate is accepted.
The per-minute request cap rises from 6 to 20 so suggestions keep appearing after
accepting one and continuing to type.
This commit is contained in:
Yun Chan 2026-10-18 07:06:55 +09:00
parent d63854db67
commit f5ae4c8c04
38 changed files with 1239 additions and 660 deletions

View file

@ -22,6 +22,7 @@ import { sql, gte, eq, desc, inArray } from 'drizzle-orm'
import {
INPUT_TELEMETRY_DEFAULTS,
SUGGESTION_CONTEXT_MAX_CHARS,
COMPOSING_IDLE_MULTIPLIER,
SUGGESTION_DEFAULTS,
calculateFrictionInsight,
classifyKeyStroke,
@ -637,9 +638,11 @@ class InputTelemetryService extends EventEmitter {
// 제안이 영원히 요청되지 않는다(실측: debounce 로그만 반복). 그래서
// 트리거 지연을 넘긴 시점에 한 번 더 스냅샷을 돌려 게이트를 연다.
if (this._settleTimer) clearTimeout(this._settleTimer)
// 조합 중(한글은 멈출 때 거의 늘 조합 중이다)에 필요한 유휴 시간을 막 넘긴 순간에 찍는다 — 예전엔
// 지연+400ms(=1초)라 멈춘 뒤 제안이 그만큼 늦게 시작됐다(실측 2026-10-17: "빠릿하지 않다").
const settleDelay = Math.max(
INPUT_TELEMETRY_DEFAULTS.textSnapshotDebounceMs + 300,
(configGet('suggestionTriggerDelayMs') || 1000) + 400
INPUT_TELEMETRY_DEFAULTS.textSnapshotDebounceMs + 50,
Math.ceil((configGet('suggestionTriggerDelayMs') || SUGGESTION_DEFAULTS.triggerDelayMs) * COMPOSING_IDLE_MULTIPLIER) + 60
)
this._settleTimer = setTimeout(() => {
this._settleTimer = null
@ -738,8 +741,9 @@ class InputTelemetryService extends EventEmitter {
context.editedSinceFocus = textForFocus !== this._textAtFocus || this._typedIntoFocus
// 보내면 비워지는 칸(채팅)의 직전 내용을 "이 창에서 조금 전에 쓴 글" 로 잠시 기억한다.
// 비밀번호·편집 불가·조합 중 칸과 터미널(명령 기록)은 보지 않는다.
if (snapshot.isEditable && !snapshot.isPassword && !snapshot.isComposing && !isTerminalApp(this._foreground.appName)) {
// 비밀번호·편집 불가 칸과 터미널(명령 기록)은 보지 않는다. 조합 중인 칸도 본다 — 한글은 보내기 직전
// 스냅샷이 거의 늘 조합 중이라, 빼면 보낸 글이 하나도 기억되지 않았다(실측 2026-10-17 에이전트 창 comp=true 연속).
if (snapshot.isEditable && !snapshot.isPassword && !isTerminalApp(this._foreground.appName)) {
this._recentWrites.observe(
focusKey,
snapshot.text,