fix(desktop): prevent modifier key buffer resets, clipboard race on terminal accept, and redundant UIA settle snapshots
This commit is contained in:
parent
6d909dd0e5
commit
41901c1ec5
10 changed files with 198 additions and 23 deletions
15
CHANGELOG.md
15
CHANGELOG.md
|
|
@ -12,6 +12,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Additional Whisper model management UI
|
||||
- Plugin system for custom pipelines
|
||||
|
||||
## [1.15.2] - 2026-10-31
|
||||
|
||||
> Published from an annotated tag. Installer and update metadata are served by the
|
||||
> canonical Forgejo feed; no binaries are committed to this repository.
|
||||
|
||||
### Fixed
|
||||
- **Modifier key (`Ctrl` / `Alt` / `Shift` / `Win`) classification & terminal buffer preservation (`@d3ro/core/input-intelligence`, `@d3ro/core/terminal-prompt`, `InputTelemetryService`).**
|
||||
- Fixes `classifyKeyStroke` so modifier virtual keycodes (`0x10..0x12`, `0x5b..0x5c`, `0xa0..0xa5`) are classified as `'modifier'` before checking `modifiers.ctrl || modifiers.alt || modifiers.meta` (which `uiohook-napi` sets to `true` on the modifier keydown itself). Previously, pressing or holding `Ctrl` / `Alt` was misclassified as `'shortcut'` (`key=shortcut+C+A`), wiping out `TerminalKeystrokeTracker`'s active line buffer (`prefixLen=0`), clearing `_typedInCurrentFocus`, and triggering repeated UIA snapshots on every key-repeat tick.
|
||||
- Ignores standalone modifier keydowns and D3RO Voice's own `Ctrl+Alt` suggestion navigation/accept chords (`Ctrl+Alt+Up/Down/Left/Right/Enter/Space/Backspace`) in `InputTelemetryService._handleKeyDown` and `TerminalKeystrokeTracker.onKeyDown` without advancing `_inputRevision` / `_lastKeyAt` or resetting the tracked terminal line.
|
||||
- **Terminal suggestion acceptance without clipboard race (`SuggestionService._insertAccepted`).**
|
||||
- Uses direct Unicode keyboard injection (`insertMethod = 'keyboard'` via `SendInput(KEYEVENTF_UNICODE)`) instead of clipboard `Ctrl+V` when accepting a suggestion in terminal mode (`terminalMode === true`, including `xterm-helper-textarea`, `WindowsTerminal`, and `Kitedesk`), preventing delayed terminal paste processing from pasting the restored previous clipboard content (such as copied URLs) and synchronizing `TerminalKeystrokeTracker` via `applyProgrammaticReplacement`.
|
||||
- Stops the background candidate fill loop (`_fillRemainingCandidates`) immediately when `SuggestionService.accept()` is triggered so new candidates do not continue streaming while waiting for modifier release.
|
||||
- **UIA snapshot timer optimization (`InputTelemetryService._scheduleTextSnapshot`, `_readTextSnapshot`).**
|
||||
- Skips scheduling the 780 ms `_settleTimer` UIA snapshot on non-typing keys (`Enter`, `Arrow`, `Shortcut`, `Navigation`, `Function`, `Tab`) and automatically cancels any pending `_settleTimer` once the 380 ms `_textTimer` snapshot determines the field cannot trigger a suggestion (`prefixLen < minPrefixChars`, non-editable, or password), cutting redundant UIA bridge calls in half during everyday typing and navigation.
|
||||
|
||||
## [1.15.1] - 2026-10-31
|
||||
|
||||
> Published from an annotated tag. Installer and update metadata are served by the
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ import {
|
|||
isTerminalApp,
|
||||
manhattanDistance,
|
||||
mergeActivityBucket,
|
||||
normalizeRequestPrefix,
|
||||
rankFlowWindows,
|
||||
recommendAppExclusion,
|
||||
summarizeActivity,
|
||||
|
|
@ -532,8 +533,6 @@ class InputTelemetryService extends EventEmitter {
|
|||
// ── 이벤트 수집 ────────────────────────────────────────
|
||||
|
||||
private _handleKeyDown(event: UiohookKeyboardEvent): void {
|
||||
// 합성 키도 화면을 바꾼다. 통계 제외 여부와 무관하게 이전 UIA 응답은 무효다.
|
||||
this._inputRevision += 1
|
||||
this._syncModifiers(event)
|
||||
// Win32 SendInput(KEYEVENTF_UNICODE) 가 보내는 합성 유니코드 키는 uiohook 에서 keycode=0 으로 들어온다.
|
||||
// 사용자 키스트로크나 IME 입력으로 처리하면 버퍼와 타이머를 교란하므로 즉시 무시한다.
|
||||
|
|
@ -553,6 +552,7 @@ class InputTelemetryService extends EventEmitter {
|
|||
vk === 0xa2 ||
|
||||
vk === 0xa3
|
||||
if (isExpectedProgrammaticKey) {
|
||||
this._inputRevision += 1
|
||||
this._programmaticKeys -= 1
|
||||
if (this._programmaticKeys === 0) {
|
||||
this._scheduleTextSnapshot()
|
||||
|
|
@ -560,6 +560,24 @@ class InputTelemetryService extends EventEmitter {
|
|||
return
|
||||
}
|
||||
}
|
||||
// 순수 수정자 키(Ctrl/Alt/Shift/Win) 단독 눌림·키 반복은 화면 텍스트를 바꾸지 않는다.
|
||||
// 여기서 _inputRevision·_lastKeyAt·스냅샷 타이머를 건드리면 수정자 키를 쥐고 있는 동안
|
||||
// 진행 중 UIA 스냅샷이 버려지고 유휴 시간(idleMs)과 터미널 버퍼가 리셋된다.
|
||||
if (vk !== null && classifyKeyStroke(vk, this._modifiers) === 'modifier') {
|
||||
return
|
||||
}
|
||||
// D3RO Voice 전역 제안 탐색/수락 단축키(Ctrl+Alt+방향키/Enter/Space/Backspace)는
|
||||
// OS globalShortcut 이 가로채므로 대상 앱 텍스트를 바꾸지 않는다.
|
||||
const isSuggestionChord =
|
||||
this._modifiers.ctrl &&
|
||||
this._modifiers.alt &&
|
||||
!this._modifiers.meta &&
|
||||
(vk === 0x0d || vk === 0x20 || vk === 0x08 || (vk !== null && vk >= 0x25 && vk <= 0x28))
|
||||
if (isSuggestionChord) {
|
||||
return
|
||||
}
|
||||
// 실제 키 입력은 화면을 바꾼다 — 이전 UIA 응답은 무효다.
|
||||
this._inputRevision += 1
|
||||
this._registerInput(true)
|
||||
const bucket = this._bucket()
|
||||
// 한글·일본어 IME 가 켜져 있으면 Windows 는 글자 키를 VK_PROCESSKEY 로 넘기고, uiohook 은 그것을
|
||||
|
|
@ -836,22 +854,27 @@ class InputTelemetryService extends EventEmitter {
|
|||
}, INPUT_TELEMETRY_DEFAULTS.textSnapshotDebounceMs)
|
||||
this._textTimer.unref?.()
|
||||
|
||||
// 제안 트리거 지연(기본 1000ms)이 스냅샷 디바운스(700ms)보다 크다. 스냅샷이
|
||||
// 제안 트리거 지연(기본 600ms)이 스냅샷 디바운스(380ms)보다 크다. 스냅샷이
|
||||
// 디바운스에만 돌면 "타이핑을 멈춘 뒤 N ms" 조건이 결코 충족되지 않아
|
||||
// 제안이 영원히 요청되지 않는다(실측: debounce 로그만 반복). 그래서
|
||||
// 트리거 지연을 넘긴 시점에 한 번 더 스냅샷을 돌려 게이트를 연다.
|
||||
if (this._settleTimer) clearTimeout(this._settleTimer)
|
||||
// 조합 중(한글은 멈출 때 거의 늘 조합 중이다)에 필요한 유휴 시간을 막 넘긴 순간에 찍는다 — 예전엔
|
||||
// 지연+400ms(=1초)라 멈춘 뒤 제안이 그만큼 늦게 시작됐다(실측 2026-10-17: "빠릿하지 않다").
|
||||
const settleDelay = Math.max(
|
||||
INPUT_TELEMETRY_DEFAULTS.textSnapshotDebounceMs + 50,
|
||||
Math.ceil((configGet('suggestionTriggerDelayMs') || SUGGESTION_DEFAULTS.triggerDelayMs) * COMPOSING_IDLE_MULTIPLIER) + 60
|
||||
)
|
||||
this._settleTimer = setTimeout(() => {
|
||||
// 실제 글자/편집 입력이 있었고 제안이 켜져 있을 때만 트리거 지연을 넘긴 시점에 한 번 더 스냅샷을 돌린다.
|
||||
if (this._settleTimer) {
|
||||
clearTimeout(this._settleTimer)
|
||||
this._settleTimer = null
|
||||
void this._captureTextSnapshot()
|
||||
}, settleDelay)
|
||||
this._settleTimer.unref?.()
|
||||
}
|
||||
if ((!keyClass || TYPING_KEY_CLASSES.has(keyClass)) && configGet('suggestionEnabled') === true) {
|
||||
// 조합 중(한글은 멈출 때 거의 늘 조합 중이다)에 필요한 유휴 시간을 막 넘긴 순간에 찍는다 — 예전엔
|
||||
// 지연+400ms(=1초)라 멈춘 뒤 제안이 그만큼 늦게 시작됐다(실측 2026-10-17: "빠릿하지 않다").
|
||||
const settleDelay = Math.max(
|
||||
INPUT_TELEMETRY_DEFAULTS.textSnapshotDebounceMs + 50,
|
||||
Math.ceil((configGet('suggestionTriggerDelayMs') || SUGGESTION_DEFAULTS.triggerDelayMs) * COMPOSING_IDLE_MULTIPLIER) + 60
|
||||
)
|
||||
this._settleTimer = setTimeout(() => {
|
||||
this._settleTimer = null
|
||||
void this._captureTextSnapshot()
|
||||
}, settleDelay)
|
||||
this._settleTimer.unref?.()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1141,6 +1164,21 @@ class InputTelemetryService extends EventEmitter {
|
|||
}
|
||||
|
||||
this._lastContext = context
|
||||
if (this._settleTimer) {
|
||||
const minPrefixChars = configGet('suggestionMinPrefixChars') || SUGGESTION_DEFAULTS.minPrefixChars
|
||||
const canTriggerSuggestion =
|
||||
configGet('suggestionEnabled') === true &&
|
||||
context.available &&
|
||||
context.isEditable &&
|
||||
!context.isPassword &&
|
||||
context.editedSinceFocus &&
|
||||
context.typedRecently &&
|
||||
normalizeRequestPrefix(context.prefix).length + (context.isComposing ? 1 : 0) >= minPrefixChars
|
||||
if (!canTriggerSuggestion) {
|
||||
clearTimeout(this._settleTimer)
|
||||
this._settleTimer = null
|
||||
}
|
||||
}
|
||||
this.emit('typed-context', context)
|
||||
// 진단 줄이 즉시 갱신되도록 상태 변경을 알린다 (키 입력마다가 아니라 스냅샷마다).
|
||||
this._emitState()
|
||||
|
|
|
|||
|
|
@ -86,6 +86,8 @@ export interface SuggestionLearningPort {
|
|||
recordAccepted(text: string, meta: { appName: string | null; windowTitle: string | null }): void
|
||||
/** 곧 보낼 프로그램 키 수(교정 수락의 백스페이스 등) — 입력 통계에서 뺀다. */
|
||||
expectProgrammaticKeys?(count: number): void
|
||||
/** 터미널 키스트로크 버퍼에 프로그램 치환/삽입을 반영한다. */
|
||||
applyProgrammaticReplacement?(deleteCount: number, insertText: string, baseLength?: number): void
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -132,6 +134,8 @@ export function createDefaultSuggestionServiceDeps(): SuggestionServiceDeps {
|
|||
learning: {
|
||||
expectProgrammaticInsert: (text) => getInputTelemetryService().expectProgrammaticInsert(text),
|
||||
expectProgrammaticKeys: (count) => getInputTelemetryService().expectProgrammaticKeys(count),
|
||||
applyProgrammaticReplacement: (deleteCount, insertText, baseLength) =>
|
||||
getInputTelemetryService().applyProgrammaticReplacement(deleteCount, insertText, baseLength),
|
||||
recordAccepted: (text, meta) =>
|
||||
getInputTelemetryService().recordExternalText(text, { ...meta, source: 'suggestion' })
|
||||
}
|
||||
|
|
@ -2146,11 +2150,22 @@ export class SuggestionService extends EventEmitter {
|
|||
const anchorKind = this._anchorKind
|
||||
const provenance = this._provenance
|
||||
const composing = this._lastContext?.isComposing === true
|
||||
const terminalMode = this._lastContext?.terminalMode === true
|
||||
const appName = this._appName
|
||||
const windowTitle = this._windowTitle
|
||||
const targetWindow = this._windowHandle
|
||||
const sessionRecordId = this._sessionRecordId
|
||||
|
||||
// 수락이 시작된 순간 추가 후보 채우기 루프는 즉시 멈춘다 — 손을 떼길 기다리는 동안
|
||||
// 2/12, 3/12 후보가 계속 스트리밍되면 사용자가 아직 선택 중이라 오인해 Ctrl+Alt 를 계속 쥐고 있게 된다.
|
||||
if (this._filling) {
|
||||
this._filling = false
|
||||
this._fillAbort?.abort()
|
||||
this._fillAbort = null
|
||||
if (!this._inFlight) this._generating = false
|
||||
this.emit('updated', this.getState())
|
||||
}
|
||||
|
||||
// 단축키로 수락했다면 사용자가 아직 키를 쥐고 있다. 그대로 Ctrl+V 를 보내면 대상 앱에 Ctrl+Alt+V 가 들어가
|
||||
// 붙여넣기가 되지 않는다. 창을 띄워 둔 채 손을 다 뗄 때까지 기다린다(최대 5초) — 창이 먼저 사라지면 사용자는
|
||||
// "들어가는 중" 이라 여기고 계속 쥐고 있었다(2026-10-25). 클릭 수락은 기다림 없이 바로 지나간다.
|
||||
|
|
@ -2173,6 +2188,7 @@ export class SuggestionService extends EventEmitter {
|
|||
text,
|
||||
deleteCount,
|
||||
composing,
|
||||
terminalMode,
|
||||
appName,
|
||||
windowTitle,
|
||||
targetWindow,
|
||||
|
|
@ -2222,6 +2238,7 @@ export class SuggestionService extends EventEmitter {
|
|||
text: string
|
||||
deleteCount: number
|
||||
composing: boolean
|
||||
terminalMode?: boolean
|
||||
appName: string | null
|
||||
windowTitle: string | null
|
||||
targetWindow: number | null
|
||||
|
|
@ -2230,7 +2247,17 @@ export class SuggestionService extends EventEmitter {
|
|||
/** 수락한 문장을 사용자 문체 표본으로 배운다 (단어 단위 수락은 false) */
|
||||
learn?: boolean
|
||||
}): Promise<SuggestionRequestResult> {
|
||||
const { text, deleteCount, composing, appName, windowTitle, targetWindow, sessionRecordId, candidateText } = params
|
||||
const {
|
||||
text,
|
||||
deleteCount,
|
||||
composing,
|
||||
terminalMode = false,
|
||||
appName,
|
||||
windowTitle,
|
||||
targetWindow,
|
||||
sessionRecordId,
|
||||
candidateText
|
||||
} = params
|
||||
// 붙여넣기(Ctrl+V)는 그 순간의 포그라운드 창으로 간다. 오버레이는 다음 스냅샷이 와야
|
||||
// 닫히므로, 그사이 다른 앱으로 옮겨 간 뒤 수락하면 엉뚱한 창에 삽입됐다 — 세션을 만든
|
||||
// 창이 아니면 삽입하지 않는다 (창을 알 수 없으면 기존처럼 진행한다).
|
||||
|
|
@ -2247,7 +2274,10 @@ export class SuggestionService extends EventEmitter {
|
|||
// 삽입 직후의 텍스트 스냅샷 diff 가 이 텍스트를 "타이핑" 으로 다시 학습하지 않도록 알린다.
|
||||
const cancelExpectedInsert = this._learning.expectProgrammaticInsert(text)
|
||||
const method = configGet('insertMethod')
|
||||
const insertMethod = method === 'keyboard' ? 'keyboard' : 'clipboard'
|
||||
// 터미널(xterm-helper-textarea, Windows Terminal, Kitedesk 등)에서는 Ctrl+V 붙여넣기가
|
||||
// 클립보드 복원 타이밍(250ms)과 경합해 이전 클립보드(URL 등)가 대신 붙여넣어지거나 ^V 가 입력될 수 있으므로
|
||||
// 클립보드를 건드리지 않는 직접 유니코드 키보드 주입('keyboard')을 사용한다.
|
||||
const insertMethod = method === 'keyboard' || terminalMode ? 'keyboard' : 'clipboard'
|
||||
try {
|
||||
if (deleteCount > 0) {
|
||||
// 확정용 Space(+1)·백스페이스·붙여넣기(Ctrl, V) 키는 사용자 입력 통계에서 뺀다.
|
||||
|
|
@ -2266,6 +2296,9 @@ export class SuggestionService extends EventEmitter {
|
|||
logger.warn(`제안 삽입 실패 (method=${result.method}, len=${result.textLength})`)
|
||||
return { ok: false, reason: 'generation-failed' }
|
||||
}
|
||||
if (terminalMode) {
|
||||
this._learning.applyProgrammaticReplacement?.(deleteCount, text)
|
||||
}
|
||||
} catch (error) {
|
||||
cancelExpectedInsert()
|
||||
logger.warn(`제안 삽입 예외: ${error instanceof Error ? error.message : String(error)}`)
|
||||
|
|
|
|||
|
|
@ -108,10 +108,15 @@ describe('classifyKeyStroke', () => {
|
|||
expect(classifyKeyStroke(0xe5, NO_MODS)).toBe('ime')
|
||||
})
|
||||
|
||||
it('수정자 조합은 단축키로 다', () => {
|
||||
it('수정자 조합은 단축키로 분류하되, 수정자 키 자체(Ctrl/Alt/Shift/Win)는 플래그가 켜져 있어도 modifier 로 분류한다', () => {
|
||||
expect(classifyKeyStroke(0x41, { ...NO_MODS, ctrl: true })).toBe('shortcut')
|
||||
expect(classifyKeyStroke(0x41, { ...NO_MODS, alt: true })).toBe('shortcut')
|
||||
expect(classifyKeyStroke(0x41, { ...NO_MODS, meta: true })).toBe('shortcut')
|
||||
expect(classifyKeyStroke(0x11, { ...NO_MODS, ctrl: true })).toBe('modifier')
|
||||
expect(classifyKeyStroke(0xa2, { ...NO_MODS, ctrl: true })).toBe('modifier')
|
||||
expect(classifyKeyStroke(0x12, { ...NO_MODS, ctrl: true, alt: true })).toBe('modifier')
|
||||
expect(classifyKeyStroke(0xa4, { ...NO_MODS, alt: true })).toBe('modifier')
|
||||
expect(classifyKeyStroke(0x5b, { ...NO_MODS, meta: true })).toBe('modifier')
|
||||
})
|
||||
|
||||
it('알 수 없는 키는 other 이며 키 내용을 담지 않는다', () => {
|
||||
|
|
|
|||
|
|
@ -239,4 +239,29 @@ describe('제안 + 오타 교정', () => {
|
|||
expect(options).toEqual(expect.objectContaining({ raw: true }))
|
||||
}
|
||||
})
|
||||
|
||||
it('터미널 모드(terminalMode=true)에서 수락하면 클립보드(Ctrl+V)를 건드리지 않고 keyboard 방식으로 넣으며 터미널 버퍼를 동기화한다', async () => {
|
||||
const expectKeys = vi.fn()
|
||||
const applyReplacement = vi.fn()
|
||||
const customDeps = deps(expectKeys)
|
||||
customDeps.learning.applyProgrammaticReplacement = applyReplacement
|
||||
const service = new SuggestionService(customDeps)
|
||||
services.push(service)
|
||||
service.setTypoProposer(proposer)
|
||||
const context = typingContext({ terminalMode: true })
|
||||
const internal = service as unknown as Internal
|
||||
internal._lastContext = context
|
||||
await internal._generate(context.prefix, context, 3, 160)
|
||||
|
||||
const result = await service.accept()
|
||||
|
||||
expect(result).toEqual({ ok: true })
|
||||
expect(harness.replaceBeforeCaret).toHaveBeenCalledWith(
|
||||
TYPO.length,
|
||||
'안녕하세요.? 오늘 회의 자료 공유드립니다.',
|
||||
'keyboard',
|
||||
{ commitComposition: false }
|
||||
)
|
||||
expect(applyReplacement).toHaveBeenCalledWith(TYPO.length, '안녕하세요.? 오늘 회의 자료 공유드립니다.')
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -168,9 +168,9 @@ end-to-end behaviour has **not been verified by typing in a real app** (`11` GAP
|
|||
| INPUT-01 | Keyboard/mouse telemetry capture (opt-in) | [~] | [-] | [-] | [-] | `InputTelemetryService` — keystroke/click/scroll counters, mouse travel as the Manhattan sum of per-axis pixel deltas, active time, per-hour×app buckets flushed every 5 s. Key **contents** are never stored (ActivityWatch `aw-watcher-input` data-minimisation policy, adopted deliberately — see `11` §7). Hook ownership is ref-counted so `KeyBindingService` keeps working (`global-input-hook.ts`). |
|
||||
| INPUT-02 | Foreground-app attribution | [~] | [-] | [-] | [-] | `utils/win32-foreground.ts` via `koffi` FFI (title/pid/exe/bounds), sampled at most 1×/s. `get-windows` was rejected: it needs an install script this repo does not run. |
|
||||
| INPUT-03 | Weekly input insights | [~] | [-] | [-] | [-] | `INPUT_TELEMETRY.getSummary` aggregates `input_activity` into totals, daily series, top hours and top apps; rendered in Settings → Input and as a dashboard card. Daily average mouse travel is converted px → m using the display scale factor. |
|
||||
| INPUT-04 | Typed-text learning (UIA, password-excluded) | [~] | [-] | [-] | [-] | Text is read from the focused field via `GET /uia/focus` (sidecar UIA bridge) and diffed longest-common-prefix/suffix, so **IME-committed Hangul/kana is counted correctly** — keycodes cannot reconstruct CJK text. UIA sends `hasSelection` only, derived by TextPattern range Start/End comparison without calling `GetText` on the selection range or adding a selected-text payload; the existing focused-field text can still include a selection. A non-collapsed selection immediately clears suggestions as `selection-active`. `IsPassword` is checked before any read (fail-closed); IME composition suppresses both stats and suggestions. **2026-09-24:** text equal to the control name (empty-field placeholder, e.g. "메시지 입력") is treated as empty (`withoutPlaceholderText`); a suggestion requires `editedSinceFocus` + typing within `recentTypingWindowMs` (8 s), otherwise `not-typing` — clicking into a pre-filled field no longer triggers suggestions. **2026-10-29:** `_typedInCurrentFocus` and `_lastTypedHwnd` track whether a typing keystroke occurred after the latest click/focus rebase (`_rebaseFocusText`), and `_sampleForeground` forces immediate foreground sampling on that first keystroke, so typing immediately after clicking into a search box or new window sets `editedSinceFocus = true` on the very first snapshot. **2026-10-24:** typed deltas are no longer saved per snapshot (that stored mid-word fragments every 0.4–0.8 s). They are buffered per field and saved as one baseline→latest diff on 2 s idle, sentence-ending punctuation, 150-char growth, field clear (send), focus change or stop. Typed samples under 4 non-space chars, URL/query-like lines, trailing incomplete jamo and PUA/lone-surrogate chars (emoji truncated to 16 bits upstream, root cause unconfirmed) are dropped. Rows already in the DB are pruned on start by the same rule (`isLearnableTypedText` in `_pruneUnlearnableCorpus`, typed source only; dry count on the dev DB 2026-10-24: 1,235/2,664 samples, 285/1,209 phrases). Expressive jamo runs (ㅋㅋ, ㅠㅠ, ㅇㅇ) and space-less questions are kept. Mid-word fragments of 4+ chars cannot be detected and remain until the 30-day retention. **2026-10-30: UIA reads are single-flight and discarded after input/focus/lifecycle changes, stale capture times, or changed native GetLastInputInfo tokens; contexts carry inputRevision/nativeInputTick for replacement-time validation (InputTelemetryService, win32-input-activity). See GAP-INPUT-11 for load-test gate.** |
|
||||
| INPUT-04 | Typed-text learning (UIA, password-excluded) | [~] | [-] | [-] | [-] | Text is read from the focused field via `GET /uia/focus` (sidecar UIA bridge) and diffed longest-common-prefix/suffix, so **IME-committed Hangul/kana is counted correctly** — keycodes cannot reconstruct CJK text. UIA sends `hasSelection` only, derived by TextPattern range Start/End comparison without calling `GetText` on the selection range or adding a selected-text payload; the existing focused-field text can still include a selection. A non-collapsed selection immediately clears suggestions as `selection-active`. `IsPassword` is checked before any read (fail-closed); IME composition suppresses both stats and suggestions. **2026-09-24:** text equal to the control name (empty-field placeholder, e.g. "메시지 입력") is treated as empty (`withoutPlaceholderText`); a suggestion requires `editedSinceFocus` + typing within `recentTypingWindowMs` (8 s), otherwise `not-typing` — clicking into a pre-filled field no longer triggers suggestions. **2026-10-29:** `_typedInCurrentFocus` and `_lastTypedHwnd` track whether a typing keystroke occurred after the latest click/focus rebase (`_rebaseFocusText`), and `_sampleForeground` forces immediate foreground sampling on that first keystroke, so typing immediately after clicking into a search box or new window sets `editedSinceFocus = true` on the very first snapshot. **2026-10-24:** typed deltas are no longer saved per snapshot (that stored mid-word fragments every 0.4–0.8 s). They are buffered per field and saved as one baseline→latest diff on 2 s idle, sentence-ending punctuation, 150-char growth, field clear (send), focus change or stop. Typed samples under 4 non-space chars, URL/query-like lines, trailing incomplete jamo and PUA/lone-surrogate chars (emoji truncated to 16 bits upstream, root cause unconfirmed) are dropped. Rows already in the DB are pruned on start by the same rule (`isLearnableTypedText` in `_pruneUnlearnableCorpus`, typed source only; dry count on the author machine 2026-10-24: 1,235/2,664 samples, 285/1,209 phrases). Expressive jamo runs (ㅋㅋ, ㅠㅠ, ㅇㅇ) and space-less questions are kept. Mid-word fragments of 4+ chars cannot be detected and remain until the 30-day retention. **2026-10-30..31: UIA reads are single-flight and discarded after input/focus/lifecycle changes, stale capture times, or changed native GetLastInputInfo tokens; contexts carry inputRevision/nativeInputTick for replacement-time validation (`InputTelemetryService`, `win32-input-activity`). Standalone modifier keydowns/key-repeats (`Ctrl`/`Alt`/`Shift`/`Win`) and `Ctrl+Alt` suggestion navigation chords are ignored in `_handleKeyDown` without advancing `_inputRevision`/`_lastKeyAt` or scheduling UIA snapshots (`classifyKeyStroke` checks modifier VKs before modifier flags), and `_settleTimer` (780 ms) is skipped on non-typing keys and auto-cancelled when the 380 ms `_textTimer` snapshot cannot trigger a suggestion (`prefixLen < minPrefixChars`). See GAP-INPUT-11.** |
|
||||
| INPUT-05 | Personal phrase corpus (typed + voice) | [~] | [-] | [-] | [-] | Sentence-level phrases from typed text and from voice history (`HistoryService.create` feeds `recordExternalText`), ranked by frequency/recency as prompt hints; users can delete individual phrases. **2026-09-24:** typed text from `LEARNING_EXCLUDED_APPS` (terminals, code editors, Agent Switchboard) is never learned, and every phrase must pass `isLearnablePhrase` (no box/block/geometric glyphs, ≥60 % letters). `_pruneUnlearnableCorpus` re-applies both rules to existing phrases/samples/edges on start and every retention cycle (first run on the author machine removed 69 phrases / 91 samples of terminal status lines and agent chats). **2026-10-25:** Agent Switchboard moved from `LEARNING_EXCLUDED_APPS` to `APP_SCOPED_LEARNING_APPS` — its text is kept only as `typing_samples` (with app name), never in shared phrases/graph, and is used only for suggestions inside that same app (`findContinuationHints(..., { appName })` feeds `continuationHints`). It is the user's most-typed app; the 2026-09-24 exclusion was about dev instructions leaking into KakaoTalk suggestions, which scoping prevents. |
|
||||
| INPUT-06 | Next-sentence suggestion (ghost text) | [~] | [-] | [-] | [-] | `SuggestionService` + `buildSuggestionPrompt` (`llm-prompts.ts` SSOT, instruction stays in the system prompt). The 2026-09-22 guard contract is 600 ms debounce, ≥5 s between requests, 6 requests/min by default (hard-config maximum 12), 3 candidates, 64 output tokens, 12-character growth before regeneration, 8 s request timeout and `keep_alive: 2m`; boot warmup is removed. Each request has its own cancellation signal. Presentation-active includes candidates, `generating`, `warmingUp` and `partialText`; clear/dismiss aborts, invalidates the generation token, clears TTL state and emits `cleared`/hide, and a final success resets `generating=false`/`partialText=null`. Focused evidence for the lifecycle and Windows-child-process change: five test files / 80 tests passed; desktop typecheck/lint, Python `py_compile`, and `git diff --check` exited 0 (core 131-test pass was independently verified earlier). Status remains `[~]`: this is not app-restart, GUI overlay, or real automatic-typing evidence. **2026-09-24 (supersedes the numbers above):** `keep_alive: 10m`, warm-up on boot, on Ollama reconnect and whenever the model is presumed cold (cold reload measured 11.4 s > 8 s timeout); a session asks for 1 candidate, then a sequential fill loop appends one unique candidate at a time up to `maxCandidatesTotal` 12 (avoid-list in the prompt, stops after 2 empty fills); only the first request consumes rate/daily budget; stale aborts refund the budget; any further typing ends the session (`matchesSessionPrefix`, IME last-syllable tolerant); prompt forbids assistant-style questions. Terminals (`TERMINAL_APPS`) never get suggestions. **2026-10-24 accept fix:** `waitForModifiersReleased` now trusts OS `GetAsyncKeyState` (`utils/win32-key-state.ts`) over the uiohook-tracked set. A missed keyup made acceptance wait the full 1.5 s and then paste Ctrl+V while modifiers were still considered held; in the logged case the field length stayed 15 after "inserted" (6 chars). New suggestions are also suppressed while an accept is in flight, so the overlay no longer reappears during the wait. **2026-10-24~25 experiment, reverted:** an n-gram-first / confidence-gated / short-candidate rework raised offline next-word precision (3%→33%) but made suggestions rare, and the user judged the app much worse. Suggestion behaviour is back to v1.10.1. Kept: suggestions that copy on-screen text are rejected (`copiesContext`), no suggestions while typing an address/path (`isAddressInput`, skip reason `address-input`). Lessons and data: `docs/evidence/2026-10-24-suggestion-accuracy-research.md` §9; replay harness `tests/eval/`. **2026-10-25 additive upgrades (frequency unchanged):** (1) `suggestion-accept-word` (default Ctrl+Alt+Space) inserts only the first word and keeps the rest on screen (`splitFirstWord`; partial accepts are not learned as full sentences). (2) a confident personal n-gram candidate (`PersonalNgramIndex`, strict `PERSONAL_NGRAM_SETTINGS`) is shown instantly as candidate #1 while the model generates; model candidates are appended after it, and it survives an empty/failed/timed-out model run (no "no suggestions" notice then). Agent Switchboard text never enters this shared n-gram. Hotkey accept now force-releases held Ctrl/Alt/Shift after 200 ms (`prepareModifiersForPaste`). **2026-10-28 extreme personalization & n-gram upgrades (frequency unchanged):** `PersonalNgramModel` now weights repeated `personalPhrases` (`count >= 2`) and falls back to a Korean stemmed-word bigram index (`_stemBigram` via `stemTerm`, e.g. matching `"배포를 완료했습니다"` when typing `"배포가 "`), and `SuggestionService._fillOne` reranks newly generated LLM candidates by `scoreCandidatePersonalization` (overlap with personal graph `continuations`/`followUps`/`related`/`phrases` + register match) while preserving the instant n-gram slot at index 0. |
|
||||
| INPUT-06 | Next-sentence suggestion (ghost text) | [~] | [-] | [-] | [-] | `SuggestionService` + `buildSuggestionPrompt` (`llm-prompts.ts` SSOT, instruction stays in the system prompt). The 2026-09-22 guard contract is 600 ms debounce, ≥5 s between requests, 6 requests/min by default (hard-config maximum 12), 3 candidates, 64 output tokens, 12-character growth before regeneration, 8 s request timeout and `keep_alive: 2m`; boot warmup is removed. Each request has its own cancellation signal. Presentation-active includes candidates, `generating`, `warmingUp` and `partialText`; clear/dismiss aborts, invalidates the generation token, clears TTL state and emits `cleared`/hide, and a final success resets `generating=false`/`partialText=null`. Focused evidence for the lifecycle and Windows-child-process change: five test files / 80 tests passed; desktop typecheck/lint, Python `py_compile`, and `git diff --check` exited 0 (core 131-test pass was independently verified earlier). Status remains `[~]`: this is not app-restart, GUI overlay, or real automatic-typing evidence. **2026-09-24 (supersedes the numbers above):** `keep_alive: 10m`, warm-up on boot, on Ollama reconnect and whenever the model is presumed cold (cold reload measured 11.4 s > 8 s timeout); a session asks for 1 candidate, then a sequential fill loop appends one unique candidate at a time up to `maxCandidatesTotal` 12 (avoid-list in the prompt, stops after 2 empty fills); only the first request consumes rate/daily budget; stale aborts refund the budget; any further typing ends the session (`matchesSessionPrefix`, IME last-syllable tolerant); prompt forbids assistant-style questions. Terminals (`TERMINAL_APPS`) never get suggestions. **2026-10-24 accept fix:** `waitForModifiersReleased` now trusts OS `GetAsyncKeyState` (`utils/win32-key-state.ts`) over the uiohook-tracked set. A missed keyup made acceptance wait the full 1.5 s and then paste Ctrl+V while modifiers were still considered held; in the logged case the field length stayed 15 after "inserted" (6 chars). New suggestions are also suppressed while an accept is in flight, so the overlay no longer reappears during the wait. **2026-10-24~25 experiment, reverted:** an n-gram-first / confidence-gated / short-candidate rework raised offline next-word precision (3%→33%) but made suggestions rare, and the user judged the app much worse. Suggestion behaviour is back to v1.10.1. Kept: suggestions that copy on-screen text are rejected (`copiesContext`), no suggestions while typing an address/path (`isAddressInput`, skip reason `address-input`). Lessons and data: `docs/evidence/2026-10-24-suggestion-accuracy-research.md` §9; replay harness `tests/eval/`. **2026-10-25 additive upgrades (frequency unchanged):** (1) `suggestion-accept-word` (default Ctrl+Alt+Space) inserts only the first word and keeps the rest on screen (`splitFirstWord`; partial accepts are not learned as full sentences). (2) a confident personal n-gram candidate (`PersonalNgramIndex`, strict `PERSONAL_NGRAM_SETTINGS`) is shown instantly as candidate #1 while the model generates; model candidates are appended after it, and it survives an empty/failed/timed-out model run (no "no suggestions" notice then). Agent Switchboard text never enters this shared n-gram. Hotkey accept now force-releases held Ctrl/Alt/Shift after 200 ms (`prepareModifiersForPaste`). **2026-10-28 extreme personalization & n-gram upgrades (frequency unchanged):** `PersonalNgramModel` now weights repeated `personalPhrases` (`count >= 2`) and falls back to a Korean stemmed-word bigram index (`_stemBigram` via `stemTerm`, e.g. matching `"배포를 완료했습니다"` when typing `"배포가 "`), and `SuggestionService._fillOne` reranks newly generated LLM candidates by `scoreCandidatePersonalization` (overlap with personal graph `continuations`/`followUps`/`related`/`phrases` + register match) while preserving the instant n-gram slot at index 0. **2026-10-31 (`v1.15.2`) terminal accept & fill-stop fix:** when accepting a suggestion in `terminalMode === true` (`xterm-helper-textarea`, `WindowsTerminal`, `Kitedesk`, etc.), `SuggestionService._insertAccepted` uses `'keyboard'` (`sendWin32UnicodeText` / `sendWin32UnicodeReplacement` via `KEYEVENTF_UNICODE`) instead of `'clipboard'` (`Ctrl+V`) so stale OS clipboard contents (e.g., copied URLs) can never be pasted into the terminal on delayed paste processing, syncs `TerminalKeystrokeTracker` via `applyProgrammaticReplacement`, and stops `_fillRemainingCandidates` immediately when `accept()` is triggered (`suggestion-typo-correction.test.ts` 8/8 PASS). |
|
||||
| INPUT-07 | Caret-anchored suggestion overlay | [~] | [-] | [-] | [-] | `suggestion-overlay` popup placed by `anchorFloatingPanel` (caret → element → cursor fallback, flip above when the caret is near the bottom, clamped to the work area). Non-focusable; click-through unless `suggestionOverlayInteractive`. While actually visible it continues periodic UIA validation after 5 s and revalidates 120 ms after mouse-up; unavailable/non-editable focus or a non-collapsed selection aborts and hides it. X first hides the renderer panel, then main IPC directly hides `BrowserWindow` and dismisses the service, so late tokened results cannot revive it. Accept/next/prev/dismiss are four global key bindings (`suggestion-accept`/`next`/`prev`/`dismiss`, default `Ctrl+Alt+→/↓/↑/←`), and the overlay has a mouse close button. Up to three candidates are shown in a scrollable list with a warm-up/generating spinner. **2026-09-24:** one page of 3 fixed-height (2-line) numbered items, footer = range/progress + source + key guide derived from the live bindings (`buildSuggestionKeyHints`, shared modifier shown once). Keys: Ctrl+Alt+↑/↓ move (the page follows the active item; at the last item `next` waits while filling, otherwise wraps; the 1.6.0 Left/Right page actions were removed as unreachable before a page filled and colliding with Intel display rotation), Ctrl+Alt+Enter accept, plain Esc closes while visible (overlay-scoped, not a binding), Ctrl+Alt+Backspace secondary dismiss; old default bindings migrate at tuning revision 5. Streaming updates never reposition/re-present the window (`decideSuggestionOverlayAction`); placement uses `anchorKind` — caret: below the line, element: outside the element (below → above → right → left → inner bottom-right). Navigation re-arms the visible TTL. Window 460×208. |
|
||||
| INPUT-08 | Per-app exclusions & consent controls | [~] | [-] | [-] | [-] | `inputExcludedApps` (executable names, case-insensitive) blocks both collection context and suggestions; telemetry master switch, pause, text-learning toggle and "delete collected data" all live in Settings → Input. 30-day retention prune runs on start. |
|
||||
| INPUT-09 | Flow Radar | [~] | [-] | [-] | [-] | `rankFlowWindows` ranks hourly aggregate activity density, character volume and edit stability into potential-focus time windows. It is not a real-session detector or session record. |
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ Legend: `[ ]` open · `[~]` in progress · `[!]` blocked externally · `[x]` res
|
|||
| GAP-INPUT-06 | Input intelligence | `[~]` **제안 폭주 상한 및 runtime 확인.** 이전 24.7 s / 4.9 s, boot warmup, `keep_alive: 30m`, 48/96/128 tokens 및 2/5 candidates 기록은 역사적 가설/완화 이력이며 현재 정책이 아니다. 현 정책은 600 ms debounce, 5 s minimum interval, 6 requests/min default (hard max 12), 3 candidates, 64 output tokens, 12-character growth, 8 s timeout, `keep_alive: 2m` 및 boot warmup 제거다. | `apps/desktop/src/main/services/SuggestionService.ts`, `packages/core/src/input-intelligence.ts`, `LocalLLMService.ts` | 표적 자동 검증은 6 files / 69 passed / 0 failed이며 raw Ollama의 15.044 s cold timeout cleanup, 약 119.9 s residency expiry, 그리고 19:48:59 +09:00에 새 generate/unload/kill/retry 없이 확인한 `/api/ps` HTTP 200 / 45.8 ms / `{models:[]}` (`/api/version` HTTP 200 / 7.3 ms / `0.32.13`)도 확인됐다. 전체 strict typecheck는 green이 아니며, 이 raw API unload 증거는 앱 재시작·GUI·실제 자동제안 타이핑 검증이 아니다. 그 경로에서 rate limit, 8 s abort, 3-candidate/64-token 상한을 확인한다. |
|
||||
| GAP-INPUT-08 | Input intelligence | `[x]` **오타 자동 교정(INPUT-19) 일반 앱(8/8) + 터미널·Vim(6/6) 실앱 E2E 검증 및 xterm.js(`Agent Switchboard`) 재교정 루프 수정 완료 (2026-10-27); 문맥 제안(INPUT-20)은 GAP-INPUT-09 에서 추적.** 2026-10-26 에 `packages/core/src/araso-layout.ts` 및 `typo-correction.ts` 로 한영 혼합어(`githubdp`→`github에`, `PDFvkdlf`→`PDF파일`, `ㅖㅇㄹ파일`→`PDF파일`, `Reactzjavhsjsxm`→`React컴포넌트`), 쌍자음 잔여 Shift(`djEJs`→`어떤`, `qkRNjTdj`→`바꿨어`), 한→영 역변환(`ㅎ샤ㅗㅕㅠ에`→`github에`, `ㅑㄹ ㅑ 쇼ㅔㄷ ㅗ디ㅣㅐ 소두 ㅑㅅ 초뭏ㄷㄴ ㅑㅜ 10 ㄴㄷ채ㅜㅇㄴ`→`if I type hello then it changes in 10 seconds`), 문장 문맥 한영 전환(`Stay hungry, stay foolishsms wkqtmdml akfdlek.`), URL/경로 보호를 추가하고, 통계 수집 동의(`inputTelemetryEnabled`) 없이도 기본 기능으로 동작하도록 배선했다. 이어서 실제 Windows 인터랙티브 데스크톱(`WinSta0\Default`)에서 WinForms 테스트 창(`E2ETestBox.exe`)과 실행 중인 `D3RO Voice` 로 실제 `SendInput` 키 입력 E2E 를 수행해 4가지 실환경 결함을 잡고 검증했다: (1) `.bat` 래퍼(`cmd.exe` CUI)로 띄울 때 `uiohook` 이 인터랙티브 키 이벤트를 받지 못하던 문제를 `electron.exe` GUI 직접 실행으로 해결, (2) `_watchRevert` 가 새 문장에서 같은 오타(`ㅗ디ㅣㅐ`)를 다시 쳤을 때 되돌림으로 오인해 `typoIgnoredWords` 에 영구 등록하던 결함을 `prefixBefore`/`windowHandle`/낱자 차단으로 해결, (3) 한글 IME 상태에서 `ㅖㅇㄹ파일`(Shift+PDF + 파일) 입력 시 `PDF파일` 변환 추가, (4) `Ctrl+V` 클립보드 붙여넣기가 Windows `ClipboardSvcGroup`(`WM_CLIPBOARDUPDATE`)의 `OpenClipboard` 잠금과 충돌해 간헐적으로 누락되던 결함을 `SendInput(KEYEVENTF_UNICODE)` 직접 유니코드 타이핑(`apps/desktop/src/main/utils/win32-unicode-input.ts`)으로 해결. **2026-10-27 터미널·Vim·xterm.js 지원 확장 및 라이브 E2E 검증:** (5) Windows Terminal 등 모든 터미널·개발 표면에서 일반 철자/모델 교정만 막고 한영 자판 전환(`layoutOnly: true`)은 허용, (6) `uia_bridge.py` 가 터미널 스크롤백 상단 대신 `GetVisibleRanges()` 하단 뷰포트를 읽고 `ExpandToEnclosingUnit(waitTime=0)` 으로 500ms 지연을 제거, (7) `TerminalKeystrokeTracker` + `extractTerminalActiveContext` + `isForegroundKoreanIme` 로 다중 줄 Vim 버퍼(`-- INSERT --` 상단 줄 편집)·캔버스 터미널(`len=0`)·Vim 노멀 모드 교정 차단·명령줄 모드(`:ㅈㅂ`→`:wq`, `:ㅂ!`→`:q!`)·입력 모드 진입 키(`i/a/o/s`) 분리를 구현, (8) `Agent Switchboard` 등의 xterm.js `<textarea class="xterm-helper-textarea">` 가 Enter/Ctrl+C 전까지 `.value` 를 비우지 않아 `ㅗ디ㅣㅐ재깅 `→`hello재깅 ` 교정 시 400ms 마다 `'h'` 가 누적되던 문제를 `isXtermHelperControl` + `reconcileWithXtermValue` + `재깅`→`world` + 교정 성공 후 `_lastCheckedRegion` 보존 + 프로그램 키 `_lastKeyAt` 미갱신으로 해결, (9) 채팅창 Enter 전송 직후 툴바 문구(`"탭 추가 @ 기호"`)에 제안이 뜨고 `gemma4:e4b` 가 프롬프트 지시문(`"검색어입니다."`, `"키워드 몇 개로만 짧게 이어 쓰세요."`)을 되풀이하던 문제를 `clearedByEnter` 기준선 재설정 + `INSTRUCTION_ECHO_PATTERN` 확장으로 해결. | `apps/desktop/src/main/services/{TypoCorrectionService,TextInsertService,InputTelemetryService}.ts`, `apps/desktop/src/main/utils/{win32-unicode-input,win32-foreground}.ts`, `apps/desktop/sidecar/uia_bridge.py`, `packages/core/src/{araso-layout,typo-correction,terminal-prompt,suggestion-text}.ts` | `[x]` 2026-10-26 일반 앱 GUI E2E(`E2ETestBox.exe`, 8/8 시나리오 전수 통과, 91~509ms) + **2026-10-27 터미널·Vim GUI E2E(`neovide.exe` PID + `D3RO Voice` PID 90844, 6/6 시나리오 전수 통과):** Vim INSERT 모드 `dkssudgktpdy `→`안녕하세요 `(197ms), Vim 명령줄 `:ㅈㅂ`→`:wq`(215ms, `:` 보존), Vim 명령줄 `:ㅂ!`→`:q!`(90ms), 셸 프롬프트 `PS D:\workspace> 퍄ㅡ `→`vim `(106ms), 셸 프롬프트 `PS D:\workspace> ㅎ샤 채ㅜㄴㅅ `→`git const `(170ms), 캔버스 터미널(`UIA len=0`) `<Esc>idkssudgktpdy `→`안녕하세요 `(108ms). 단위 테스트: `packages/core` 3개 파일 82/82 통과(`typo-correction.test.ts` 44/44, `terminal-prompt.test.ts` 12/12, `suggestion-continuation.test.ts` 26/26), 데스크톱 `TypoCorrectionService.test.ts` 22/22 통과. |
|
||||
| GAP-INPUT-09 | Input intelligence | `[~]` **prefill 이어 쓰기·문서/대화 문맥(INPUT-21) 실앱 확인 (2026-10-03).** 실제 `gemma4:e4b` 프로브 15개 시나리오와 단위 테스트는 통과했지만, (a) 외부 앱 UIA 가 커서 앞 문서 전체를 주는지(케어렛 미상 앱은 tail 폴백), (b) 채팅 앱이 보내기 뒤 입력칸을 실제로 비우는 스냅샷을 내는지(카톡은 UIA 텍스트 길이 0 인 경우가 있었다 — GAP-INPUT-01), (c) 단어 중간 수락(`attach`)이 실제 삽입에서 공백 없이 붙는지는 GUI 로 확인하지 않았다. 후보 다양성: 마저 쓰기 모드는 prefill 분포가 뾰족해 채우기 후보가 1~2개에서 멈출 때가 많다. | `apps/desktop/src/main/services/{SuggestionService,InputTelemetryService,LocalLLMService,llm-prompts}.ts`, `packages/core/src/{chat-template,recent-writes,suggestion-text,writing-context}.ts`, `apps/desktop/tests/integration/suggestion-quality.ollama.test.ts` | `run-desktop.bat` 재시작 후: (1) 긴 메모장 문서 끝에서 앞부분의 날짜·이름을 이어 받는지, (2) 슬랙/디스코드 같은 Chromium 채팅에서 메시지를 보낸 뒤 다음 메시지 제안이 앞 메시지를 이어 받는지(로그 `제안 판단 입력` + 프롬프트 길이), (3) `내일 3시에 회의실` 같은 단어 중간에서 수락하면 `회의실에서…` 로 붙는지, (4) 지어낸 사실로 후보를 버린 로그(`제안 후보 버림 (unsupported-facts…)`)가 과하게 잦지 않은지. 모델 교체 시 `D3RO_SUGGESTION_PROBE=1 D3RO_SUGGESTION_PROBE_MODEL=<태그>` 로 같은 프로브를 다시 돌린다. **2026-10-03 19:00 "제안 창이 잘 안 뜸" 로그 분석**: 보류 1위 WindowsTerminal(Claude Code) `caret-unknown` 721회 — 입력 상자 아래 상태줄 때문에 화면 전체 기준으로 매번 "문서 중간 편집" 판정 → `SuggestionService._terminalContext` 가 입력 줄 연속성(늘거나 줄면 커서=끝)으로 판단. 2위 Chrome `not-typing` 122회 — 타이핑 중 UIA 포커스가 입력칸↔legacy 요소를 오가며 기준선을 다시 잡음 → 같은 창·클릭 없이 치는 중의 깜빡임이면 편집한 칸 유지(`input-telemetry-focus-flicker.test.ts`). 모든 앱에서 caret 오프셋을 못 얻는 것(caret=-1)과 Kitedesk/Candy/Paca 의 legacy(읽기 불가)는 별도 과제. 19:10 재시작 뒤 6분간 첫 후보 10회 생성(터미널 caret-unknown 721→4). **수락 키 전달 문제**: uiohook 은 키를 엿듣기만 해서 Ctrl+Alt+Enter 가 Claude Code 에도 전달돼 개행이 들어갔다 → 제안 창이 떠 있는 동안만 제안 단축키를 globalShortcut(noop)으로 잡아 OS 가 삼키게 하고 창이 사라지면 해제(`KeyBindingService.setSuggestionCaptureActive`, `suggestionCaptureAccelerators`). 실앱에서 수락 시 개행이 더는 안 들어가는지, 창이 없을 때 다른 앱의 Ctrl+Alt+Enter/↑↓ 가 정상인지 확인 필요. |
|
||||
| GAP-INPUT-11 | Input responsiveness | `[~]` **2026-10-30..31 사용자 보고: 모델 최초 로드/높은 CPU 부하 및 터미널(`Agent Switchboard.exe` `xterm.js` 등) 환경에서 한글 타이핑 누락 (`안녕하세요` → `안세요`, 터미널 1글자씩 씹힘).** (1) **결정적 원인 규명 및 수정:** 한국어 두벌식 입력에서 받침 뒤 다음 음절 초성을 치는 순간(`"안ㄴ"`, `"안녕ㅎ"`, `"한ㄱ"` 등) `detectJamoNoise`가 커서 끝 초성을 낱자 잡음(`from: "안ㄴ", to: "안"`, `deleteCount: 2`)으로 오판하고, 모델이 아직 콜드(`warmModel() === null`, 모델 최초 로드 시점)일 때 `TypoCorrectionService.handleTypingContext`가 650ms 모델 디바운스를 건너뛰고 즉시 `replaceBeforeCaret(2, "안")`을 실행해 방금 완성된 `"안녕"`을 `"안"`으로 덮어써 `"안녕하세요"`가 `"안세요"`가 되거나 새 어절 첫 자음(`"오늘 ㅇ"`)이 백스페이스로 지워지던 버그를 수정했다(`packages/core/src/typo-correction.ts` 커서 끝 초성 보호 + `TypoCorrectionService.ts` 커서 직전 토큰 자동 삭제 차단). (2) 코드에서 오래된 UIA 문맥·삽입 큐 대기 후 재검증 누락·부분 SendInput 성공 뒤 삭제 재실행 위험을 확인하고 보호 장치를 추가했으며, 로컬 Ollama/Whisper 작업 수도 최대 4개로 제한했다. (3) **2026-10-31 터미널·`xterm.js` 1글자씩 씹힘(`03:04:11~03:04:48` 실로그 규명) 수정:** 터미널에서 `TextInsertService`가 키를 한 번도 보내지 않았는데도 한글이 1글자씩 씹히던 직접 원인이 ① `InputTelemetryService._handleKeyDown`에서 터미널일 때만 매 키다운마다 호출하던 크로스-프로세스 `isForegroundKoreanIme`(`SendMessageTimeoutW(WM_IME_CONTROL)`)와 ② 40ms 경계 스냅샷·800ms 폴링마다 `uia_bridge.py`가 `xterm-helper-textarea`에 대해 호출하던 `GetTopLevelControl()`·`TextPattern.GetSelection()`·`ExpandToEnclosingUnit(Character)`·`TextEditPattern.GetActiveComposition()`(Chromium 렌더러 스레드 최대 1,500ms 블로킹 및 `comp=True` 고착)이었음을 확인하고, 키다운 중 `WM_IME_CONTROL` 호출 제거(유휴 스냅샷 1회 동기화 `syncKoreanIme`), `uia_bridge.py` `xterm-helper-textarea` 고속 경로(`TextPattern` 생략) 및 `_WAKE_TTL_SECONDS` 86,400초 연장, 일반 한글 단어 공백 직후 40ms 스냅샷·680ms 중복 타이머·800ms 터미널 폴링 억제, 터미널 내 공백 전 완성형 한글 음절(`[가-힣]$`) 교정 억제를 적용했다. **추가 deterministic A/B:** 3개 서비스만 HEAD `f49acf0`로 대체하고 나머지 의존성·테스트는 현재 상태를 유지한 비교에서 HEAD 1/17, 수정본 17/17 통과. | `packages/core/src/{typo-correction,terminal-prompt}.ts`, `InputTelemetryService.ts`, `TypoCorrectionService.ts`, `TextInsertService.ts`, `utils/{win32-foreground,win32-input-activity,win32-unicode-input,inference-cpu-budget}.ts`, `sidecar/{uia_bridge,cpu_budget}.py`; `scripts/verification/typing-race-proof.mjs`, `packages/core/__tests__/{typo-correction,terminal-prompt}.test.ts` (66/66), `TypoCorrectionService.test.ts` (29/29) | `typing-fixture`와 별도 로컬 프로필의 `typing-runtime` 빌드 완료, 단위·경합 A/B 테스트 전수 통과(`packages/core` 66/66, `TypoCorrectionService.test.ts` 29/29, `typing-race-proof.mjs` 17/17). 남은 것은 외부 인터랙티브 세션에서 실제 GUI 연속 타이핑 수동 확인이다. |
|
||||
| GAP-INPUT-11 | Input responsiveness | `[~]` **2026-10-30..31 사용자 보고: 모델 최초 로드/높은 CPU 부하 및 터미널(`Agent Switchboard.exe` `xterm.js` 등) 환경에서 한글 타이핑 누락 (`안녕하세요` → `안세요`, 터미널 1글자씩 씹힘) 및 후속 최적화(`v1.15.2`).** (1) **결정적 원인 규명 및 수정:** 한국어 두벌식 입력에서 받침 뒤 다음 음절 초성을 치는 순간(`"안ㄴ"`, `"안녕ㅎ"`, `"한ㄱ"` 등) `detectJamoNoise`가 커서 끝 초성을 낱자 잡음(`from: "안ㄴ", to: "안"`, `deleteCount: 2`)으로 오판하고, 모델이 아직 콜드(`warmModel() === null`, 모델 최초 로드 시점)일 때 `TypoCorrectionService.handleTypingContext`가 650ms 모델 디바운스를 건너뛰고 즉시 `replaceBeforeCaret(2, "안")`을 실행해 방금 완성된 `"안녕"`을 `"안"`으로 덮어써 `"안녕하세요"`가 `"안세요"`가 되거나 새 어절 첫 자음(`"오늘 ㅇ"`)이 백스페이스로 지워지던 버그를 수정했다(`packages/core/src/typo-correction.ts` 커서 끝 초성 보호 + `TypoCorrectionService.ts` 커서 직전 토큰 자동 삭제 차단). (2) 코드에서 오래된 UIA 문맥·삽입 큐 대기 후 재검증 누락·부분 SendInput 성공 뒤 삭제 재실행 위험을 확인하고 보호 장치를 추가했으며, 로컬 Ollama/Whisper 작업 수도 최대 4개로 제한했다. (3) **2026-10-31 터미널·`xterm.js` 1글자씩 씹힘(`03:04:11~03:04:48` 실로그 규명) 수정 (`v1.15.1`):** 터미널에서 `TextInsertService`가 키를 한 번도 보내지 않았는데도 한글이 1글자씩 씹히던 직접 원인이 ① `InputTelemetryService._handleKeyDown`에서 터미널일 때만 매 키다운마다 호출하던 크로스-프로세스 `isForegroundKoreanIme`(`SendMessageTimeoutW(WM_IME_CONTROL)`)와 ② 40ms 경계 스냅샷·800ms 폴링마다 `uia_bridge.py`가 `xterm-helper-textarea`에 대해 호출하던 `GetTopLevelControl()`·`TextPattern.GetSelection()`·`ExpandToEnclosingUnit(Character)`·`TextEditPattern.GetActiveComposition()`(Chromium 렌더러 스레드 최대 1,500ms 블로킹 및 `comp=True` 고착)이었음을 확인하고, 키다운 중 `WM_IME_CONTROL` 호출 제거(유휴 스냅샷 1회 동기화 `syncKoreanIme`), `uia_bridge.py` `xterm-helper-textarea` 고속 경로(`TextPattern` 생략) 및 `_WAKE_TTL_SECONDS` 86,400초 연장, 일반 한글 단어 공백 직후 40ms 스냅샷·680ms 중복 타이머·800ms 터미널 폴링 억제, 터미널 내 공백 전 완성형 한글 음절(`[가-힣]$`) 교정 억제를 적용했다. (4) **2026-10-31 실로그(`04:03:07~04:03:48`) 추가 규명 및 최적화 (`v1.15.2`):** ① `classifyKeyStroke`가 수정자 플래그를 수정자 VK 코드보다 먼저 검사해 `Ctrl`/`Alt` 단독 눌림·키 반복이 `'shortcut'`(`key=shortcut+C+A`)으로 분류되어 `TerminalKeystrokeTracker` 버퍼를 초기화하고 UIA 스냅샷을 반복 호출하던 버그 수정, ② `InputTelemetryService._handleKeyDown`에서 순수 수정자 키 및 `Ctrl+Alt` 제안 단축키 입력 시 `_inputRevision`/`_lastKeyAt` 갱신 및 불필요한 스냅샷 예약 차단, ③ 비타이핑 키(`Enter`/`Arrow`/`Shortcut`) 및 짧은 입력(`prefixLen < minPrefixChars`)에서 780ms 중복 `_settleTimer` UIA 스냅샷 자동 취소, ④ 터미널(`terminalMode: true`)에서 제안 수락 시 `Ctrl+V` 클립보드 복원 경합으로 이전 클립보드(OAuth URL 등)가 붙여넣어지던 문제를 막기 위해 `insertMethod = 'keyboard'`(`KEYEVENTF_UNICODE`) 직접 주입 및 `applyProgrammaticReplacement` 터미널 버퍼 동기화로 전환하고 `accept()` 즉시 백그라운드 후보 채우기 루프를 중단하도록 수정. **추가 deterministic A/B:** 3개 서비스만 HEAD `f49acf0`로 대체하고 나머지 의존성·테스트는 현재 상태를 유지한 비교에서 HEAD 1/17, 수정본 17/17 통과. | `packages/core/src/{input-intelligence,typo-correction,terminal-prompt}.ts`, `InputTelemetryService.ts`, `SuggestionService.ts`, `TypoCorrectionService.ts`, `TextInsertService.ts`, `utils/{win32-foreground,win32-input-activity,win32-unicode-input,inference-cpu-budget}.ts`, `sidecar/{uia_bridge,cpu_budget}.py`; `scripts/verification/typing-race-proof.mjs`, `packages/core/__tests__/{typo-correction,terminal-prompt}.test.ts` (67/67), `TypoCorrectionService.test.ts` (29/29), `suggestion-typo-correction.test.ts` (8/8), `input-intelligence.test.ts` (68/68) | `typing-fixture`와 별도 로컬 프로필의 `typing-runtime` 빌드 완료, 단위·경합 A/B 테스트 전수 통과(`packages/core` 67/67, `TypoCorrectionService.test.ts` 29/29, `suggestion-typo-correction.test.ts` 8/8, `input-intelligence.test.ts` 68/68, `typing-race-proof.mjs` 17/17). 남은 것은 외부 인터랙티브 세션에서 실제 GUI 연속 타이핑 수동 확인이다. |
|
||||
| GAP-INPUT-10 | Input intelligence | `[~]` **제안 창 오타 교정·반응성(INPUT-22) 실앱 확인 (2026-10-17) 및 2026-10-30 조합 백스페이스/초성 유실 수정.** 단위 테스트·실모델 프로브·팝업 렌더 스크린샷은 통과. (1) 이력 DB 접두에 반복되던 홀로 남은 `ㅇ` 및 글자 삼킴은 커서 끝 초성(`"안ㄴ"`, `"오늘 ㅇ"`)에 대한 `detectJamoNoise` 조기 개입이 원인이었음을 규명해 차단했다(GAP-INPUT-11 참조). (2) Chrome·Electron 계열에서 UIA `GetActiveComposition` 미지원으로 `snapshot.isComposing`이 항상 `false`가 되어 마지막 글자 조합 중 교정/제안 수락 시 Space 확정 없이 백스페이스가 나가 MS IME가 자모 단위로 지우던(`안ㄴ안녕…`) 문제를 해결하기 위해, `InputTelemetryService`에서 키스트로크 기반 한글 조합 상태(`_imeComposing`)를 추적해 `context.isComposing`에 반영하고, `SuggestionService.accept()`도 `/[가-힣]$/u.test(acceptPrefix)` 및 `insertMethod === 'keyboard'` 프로그램 키 계산을 정밀화했다. | `apps/desktop/src/main/services/{SuggestionService,TypoCorrectionService,TextInsertService,InputTelemetryService}.ts`, `apps/desktop/src/renderer/popups/suggestion-overlay/*`, `packages/core/src/typo-correction.ts` | 에이전트 창·카톡·크롬에서: (1) `안ㄴ뇽하세여.?` 치고 멈추면 `오타 고침` 줄과 함께 후보가 뜨는지, 수락하면 오타가 지워지고 `안녕하세요.? …` 로 바뀌는지, (2) 마지막 글자가 조합 중일 때 수락해도 글자가 남거나 더 지워지지 않는지, (3) 수락 → Space → 멈춤에서 다음 제안이 바로 뜨는지(`rate-limited` 로그 없어야 함), (4) 후보 12개가 다 차도 창이 저절로 닫히지 않는지(45초 TTL 전), (5) 낱자 없는 오타는 첫 후보 뒤 교정 줄이 늦게 붙는지 실앱 수동 확인. |
|
||||
|
||||
| GAP-SYNC-01 | Sync | Desktop↔mobile sync was one-way and lossy. (1) `pushAll` set the cursor to *now* before `pullAll` ran, so the first pull after sign-in fetched nothing — mobile-created data never reached the desktop except via Realtime while running (which never connected, GAP-SYNC-02). (2) `_inArray` used only the first meeting id, so memos/documents of every other meeting were never pushed. (3) No deletion propagation either way. (4) Pull had no `user_id` filter — team meetings of other users landed in the personal DB and a desktop re-push cleared `team_id`. (5) One global, local-clock cursor across accounts; no pagination (1,000-row cap). (6) Desktop writes did not move `history.revision`, so mobile's optimistic concurrency silently overwrote desktop edits. (7) One case-duplicate dictionary word failed the whole batch. (8) Memo tags, custom commands, templates, favorites and history titles were not synced at all; anonymous local-mode data was never uploaded after sign-in. | `apps/desktop/src/main/services/sync/*`, `CloudSyncService.ts`, `server/supabase/migrations/20260927000034_cross_device_sync_parity.sql` | `[x]` 2026-09-27: engine rewritten (outbox + per-user server-clock keyset cursors + tombstones + per-row isolation + dictionary adoption + natural-key memo tags + client-keyed template RPCs + local-mode import). Evidence: `apps/desktop/tests/main/sync/SyncEngine.test.ts` (20) + `apps/desktop/tests/integration/cross-device-sync.supabase.test.ts` (5, local Supabase stack); full desktop suite 1499/1500 (1 = known caption env timeout); SQL checks for revision bump, tombstones, account-delete cascade. |
|
||||
|
|
|
|||
|
|
@ -354,6 +354,42 @@ describe('terminal prompt extraction', () => {
|
|||
expect(tracker.hasObservedImeForHwnd(hwnd)).toBe(true)
|
||||
expect(tracker.currentPrefix()).toBe('ㅔㅊ ')
|
||||
})
|
||||
|
||||
it('Ctrl/Alt/Shift 단독 키 반복이나 Ctrl+Alt 제안 탐색 단축키는 터미널 버퍼를 초기화하지 않는다', () => {
|
||||
const tracker = new TerminalKeystrokeTracker()
|
||||
const hwnd = 9902
|
||||
for (const vk of [0x47, 0x49, 0x54, 0x20]) {
|
||||
tracker.onKeyDown({
|
||||
hwnd,
|
||||
windowTitle: 'Agent Switchboard',
|
||||
vk,
|
||||
shift: false,
|
||||
ctrl: false,
|
||||
alt: false,
|
||||
meta: false
|
||||
})
|
||||
}
|
||||
expect(tracker.currentPrefix()).toBe('git ')
|
||||
|
||||
// Ctrl 누름(uiohook 은 ctrl=true 로 전달) + Alt 누름(ctrl=true, alt=true) + Ctrl+Alt+Down/Enter
|
||||
for (const ev of [
|
||||
{ vk: 0xa2, ctrl: true, alt: false },
|
||||
{ vk: 0xa4, ctrl: true, alt: true },
|
||||
{ vk: 0x28, ctrl: true, alt: true },
|
||||
{ vk: 0x0d, ctrl: true, alt: true }
|
||||
]) {
|
||||
tracker.onKeyDown({
|
||||
hwnd,
|
||||
windowTitle: 'Agent Switchboard',
|
||||
vk: ev.vk,
|
||||
shift: false,
|
||||
ctrl: ev.ctrl,
|
||||
alt: ev.alt,
|
||||
meta: false
|
||||
})
|
||||
}
|
||||
expect(tracker.currentPrefix()).toBe('git ')
|
||||
})
|
||||
})
|
||||
|
||||
describe('a visible suggestion survives a typing pause', () => {
|
||||
|
|
|
|||
|
|
@ -119,6 +119,8 @@ export function classifyKeyStroke(
|
|||
code: number,
|
||||
modifiers: { ctrl: boolean; alt: boolean; meta: boolean }
|
||||
): KeyStrokeClass {
|
||||
if (code >= 0xa0 && code <= 0xa5) return 'modifier'
|
||||
if (code === 0x5b || code === 0x5c || code === 0x10 || code === 0x11 || code === 0x12) return 'modifier'
|
||||
if (modifiers.ctrl || modifiers.alt || modifiers.meta) return 'shortcut'
|
||||
if (code >= 0x41 && code <= 0x5a) return 'letter'
|
||||
if (code >= 0x30 && code <= 0x39) return 'digit'
|
||||
|
|
@ -131,8 +133,6 @@ export function classifyKeyStroke(
|
|||
if (code >= 0x25 && code <= 0x28) return 'arrow'
|
||||
if (code >= 0x21 && code <= 0x24) return 'navigation'
|
||||
if (code >= 0x70 && code <= 0x87) return 'function'
|
||||
if (code >= 0xa0 && code <= 0xa5) return 'modifier'
|
||||
if (code === 0x5b || code === 0x5c || code === 0x10 || code === 0x11 || code === 0x12) return 'modifier'
|
||||
if (code === 0x1b) return 'navigation'
|
||||
if (code >= 0xba && code <= 0xc0) return 'symbol'
|
||||
if (code >= 0xdb && code <= 0xde) return 'symbol'
|
||||
|
|
|
|||
|
|
@ -558,6 +558,29 @@ export class TerminalKeystrokeTracker {
|
|||
|
||||
const { vk, shift, ctrl, alt, meta } = input
|
||||
|
||||
// 순수 수정자 키(Shift/Ctrl/Alt/Win) 단독 눌림·키 반복은 버퍼나 조합 상태를 바꾸지 않는다.
|
||||
if (
|
||||
vk === 0x10 ||
|
||||
vk === 0x11 ||
|
||||
vk === 0x12 ||
|
||||
vk === 0x5b ||
|
||||
vk === 0x5c ||
|
||||
(vk !== null && vk >= 0xa0 && vk <= 0xa5)
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
// D3RO Voice 전역 제안/음성 단축키(Ctrl+Alt+방향키/Enter/Space/Backspace)는 OS globalShortcut 이 가로채므로
|
||||
// 터미널 입력 줄 버퍼를 초기화하지 않는다.
|
||||
if (
|
||||
ctrl &&
|
||||
alt &&
|
||||
!meta &&
|
||||
(vk === 0x0d || vk === 0x20 || vk === 0x08 || (vk !== null && vk >= 0x25 && vk <= 0x28))
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
// Escape 또는 Ctrl+[ / Ctrl+C → 현재 줄 초기화 (실제 Esc/Ctrl+[ 만 _afterEscape 설정)
|
||||
const isRealEscape = vk === 0x1b || (ctrl && !alt && !meta && vk === 0xdb)
|
||||
const isCtrlC = ctrl && !alt && !meta && vk === 0x43
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue