feat(input): upgrade graph personalization, english morphology detection, and atomic SendInput replacement

This commit is contained in:
Yun Chan 2026-10-29 08:16:26 +09:00
parent 52eef21bab
commit cd4a452148
21 changed files with 1098 additions and 110 deletions

View file

@ -141,6 +141,47 @@ describe('TypoCorrectionService', () => {
expect(fake.replaceBeforeCaret).toHaveBeenCalledWith('ㅡㅁ가둥 '.length, 'markdown ')
})
it('모델 검사 도중 사용자가 구두점·짧은 완결 어절을 덧붙이면 취소하지 않고 새 접두 위로 리베이스해 교정한다', async () => {
let release: (() => void) | null = null
const generate = vi.fn(async function* () {
await new Promise<void>((resolve) => {
release = resolve
})
yield 'ㅡㅁ가둥 => markdown'
})
const fake = deps({ warmModel: () => 'gemma4:e4b', generate })
const service = new TypoCorrectionService(fake.deps)
expect(
service.handleTypingContext(
typingContext({
prefix: 'ㅡㅁ가둥',
isComposing: false,
idleMs: 650,
appName: 'Antigravity.exe'
})
)
).toBe('checking')
// 모델이 응답하기 전에 사용자가 공백을 쳤지만 유휴(40ms) 조건을 만족한 경우 리베이스 대기 유지
fake.state.lastKeyAt = 1005
expect(
service.handleTypingContext(
typingContext({
prefix: 'ㅡㅁ가둥 ',
isComposing: false,
idleMs: 40,
appName: 'Antigravity.exe'
})
)
).toBe('checking')
release?.()
await flush()
await flush()
expect(fake.replaceBeforeCaret).toHaveBeenCalledWith('ㅡㅁ가둥 '.length, 'markdown ')
})
it('설정으로 끌 수 있다', () => {
config.typoAutoCorrectEnabled = false
const fake = deps()

View file

@ -74,4 +74,30 @@ describe('PersonalGraphService.retrieveContext', () => {
expect(context.related).not.toContain('배포 로그 확인했습니다')
expect(context.followUps).not.toContain('배포 로그 확인했습니다')
})
it('같은 앱에서 단문 메시지를 연속으로 보내도 세션 follows 사슬을 잇고 recentWrites 로 복원한다', () => {
const graph = getPersonalGraphService()
const now = Date.now()
graph.indexText('배포 모두 끝났습니다', { source: 'typed', appName: 'Slack.exe', at: now })
graph.indexText('모니터링 대시보드 확인 부탁드립니다', {
source: 'typed',
appName: 'Slack.exe',
at: now + 15_000
})
// 채팅창에서 엔터로 전송해 입력칸이 비워진 뒤 다음 메시지를 치기 시작한 상태
const context = graph.retrieveContext('지금 ', 4, {
appName: 'Slack.exe',
recentWrites: ['배포 모두 끝났습니다']
})
expect(context.followUps).toContain('모니터링 대시보드 확인 부탁드립니다')
})
it('조사가 달라 정확한 부분 문자열이 어긋나도 어간(stem) 연속 일치로 이어쓰기를 찾는다', () => {
const graph = getPersonalGraphService()
graph.indexText('회의록 정리해서 내일 오전까지 공유드리겠습니다', { source: 'typed' })
const context = graph.retrieveContext('오늘 회의록을 정리해서')
expect(context.continuations).toEqual(['내일 오전까지 공유드리겠습니다'])
})
})