release: ship v1.6.0 with paged suggestions and a cleaner phrase memory
Next-sentence suggestions now arrive one at a time up to twelve, shown three per page with Ctrl+Alt+Up/Down to move, Left/Right to page, Enter to accept and Esc to close; old default bindings migrate and the panel guide follows the live bindings. The overlay is redesigned, stays put while candidates stream and sits outside the input box when no caret is reported. The personal phrase memory stops learning from terminals, code editors and the coding-agent hub, ignores symbol-heavy lines and empty-field placeholders, and prunes existing entries that break those rules. Fixes suggestion keys starting dictation, installs stuck on a pre-1.5.0 speech engine without the focus endpoint, Ollama runner windows flashing while typing, the speech engine starting twice, and cold-model timeouts. Live captions can be dragged to a remembered position and show a waiting notice until the first line arrives. Bumps the product version to 1.6.0 (Android/iOS build 1060000).
This commit is contained in:
parent
856e375f3e
commit
2fe20fa7b5
71 changed files with 2469 additions and 366 deletions
|
|
@ -5,11 +5,18 @@ import { BrowserWindow, shell, screen, ipcMain, Menu, clipboard } from 'electron
|
|||
import { join } from 'path'
|
||||
import { is } from '@electron-toolkit/utils'
|
||||
import { WINDOW_SIZE } from '@d3ro/core/constants'
|
||||
import { anchorFloatingPanel } from '@d3ro/core/input-intelligence'
|
||||
import { anchorFloatingPanel, type AnchorKind } from '@d3ro/core/input-intelligence'
|
||||
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
|
||||
import {
|
||||
formatBindingSegments,
|
||||
joinBindingSegments,
|
||||
type BindingPlatform,
|
||||
type KeyBinding,
|
||||
type KeyBindingActionId
|
||||
} from '@d3ro/core/keybinding'
|
||||
import { getLogger } from '../services/LoggerService'
|
||||
import { getIsQuitting } from '../lifecycle'
|
||||
import { configGet } from '../services/ConfigService'
|
||||
import { configGet, configSet } from '../services/ConfigService'
|
||||
import { buildPopupThemeCss } from '@d3ro/ui/theme-vars'
|
||||
import { getI18n } from '@d3ro/i18n'
|
||||
|
||||
|
|
@ -60,6 +67,8 @@ function getPopupI18nStrings(): Record<string, string> {
|
|||
errorDefault: t('popup.error.default'),
|
||||
// caption-overlay
|
||||
captionLoading: t('popup.caption.loading'),
|
||||
captionWaiting: t('popup.caption.waiting'),
|
||||
captionDragHint: t('popup.caption.dragHint'),
|
||||
// suggestion-overlay
|
||||
suggestionHintAccept: t('popup.suggestion.hintAccept'),
|
||||
suggestionHintNext: t('popup.suggestion.hintNext'),
|
||||
|
|
@ -73,6 +82,86 @@ function getPopupI18nStrings(): Record<string, string> {
|
|||
suggestionRelated: t('popup.suggestion.related'),
|
||||
suggestionPhrases: t('popup.suggestion.phrases'),
|
||||
suggestionAppPhrases: t('popup.suggestion.appPhrases'),
|
||||
// 키 힌트 줄 (동작 낱말 — 실제 키는 사용자 바인딩에서 매번 계산해 붙인다)
|
||||
suggestionHintMoveLabel: t('popup.suggestion.hintMove'),
|
||||
suggestionHintPageLabel: t('popup.suggestion.hintPage'),
|
||||
suggestionHintAcceptLabel: t('popup.suggestion.hintAccept'),
|
||||
suggestionHintCloseLabel: t('popup.suggestion.hintDismiss'),
|
||||
suggestionHintGeneratingMore: t('popup.suggestion.hintGeneratingMore'),
|
||||
}
|
||||
}
|
||||
|
||||
/** win32/darwin 외 플랫폼은 linux 로 간주한다(키캡 표기 정본 — BindingPlatform). */
|
||||
function resolveBindingPlatform(): BindingPlatform {
|
||||
if (process.platform === 'darwin') return 'darwin'
|
||||
if (process.platform === 'win32') return 'win32'
|
||||
return 'linux'
|
||||
}
|
||||
|
||||
interface SplitBinding {
|
||||
modifiers: string[]
|
||||
key: string
|
||||
}
|
||||
|
||||
function splitBinding(binding: KeyBinding, platform: BindingPlatform): SplitBinding {
|
||||
const labels = formatBindingSegments(binding, platform).map((segment) => segment.label)
|
||||
return { modifiers: labels.slice(0, -1), key: labels[labels.length - 1] ?? '' }
|
||||
}
|
||||
|
||||
function sameModifiers(a: readonly string[], b: readonly string[]): boolean {
|
||||
return a.length === b.length && a.every((mod, index) => mod === b[index])
|
||||
}
|
||||
|
||||
export interface SuggestionKeyHints {
|
||||
/** 이동·페이지·수락이 모두 같은 수정자를 쓰면 그 수정자(예: "Ctrl+Alt") — 한 번만 보여준다 */
|
||||
shared: string | null
|
||||
move: string | null
|
||||
page: string | null
|
||||
accept: string | null
|
||||
close: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 제안 오버레이 키 힌트 — 사용자가 실제로 설정한 바인딩에서 매번 다시 계산한다.
|
||||
*
|
||||
* 라벨은 키바인딩 SSOT(formatBindingSegments/joinBindingSegments) 로만 만든다.
|
||||
* 수정자가 모두 같으면 앞에 한 번만 두고 각 힌트는 키만 보여준다 — 같은 "Ctrl+Alt+" 를
|
||||
* 네 번 반복하면 한 줄에 들어가지 않고 읽기도 어렵다. 바인딩 없는 액션은 생략한다.
|
||||
* 닫기는 오버레이 전용 Esc 로 고정한다(보조 바인딩은 설정 화면에서 보인다).
|
||||
*/
|
||||
function buildSuggestionKeyHints(): SuggestionKeyHints {
|
||||
const bindings = configGet('keyBindings')
|
||||
const platform = resolveBindingPlatform()
|
||||
const splitOf = (actionId: KeyBindingActionId): SplitBinding | null => {
|
||||
const binding = bindings[actionId]?.[0]
|
||||
return binding ? splitBinding(binding, platform) : null
|
||||
}
|
||||
|
||||
const prev = splitOf('suggestion-prev')
|
||||
const next = splitOf('suggestion-next')
|
||||
const pagePrev = splitOf('suggestion-page-prev')
|
||||
const pageNext = splitOf('suggestion-page-next')
|
||||
const accept = splitOf('suggestion-accept')
|
||||
|
||||
const present = [prev, next, pagePrev, pageNext, accept].filter((b): b is SplitBinding => b !== null)
|
||||
const common = present[0]?.modifiers ?? []
|
||||
const shareAll =
|
||||
present.length > 0 && common.length > 0 && present.every((b) => sameModifiers(b.modifiers, common))
|
||||
|
||||
const label = (b: SplitBinding): string =>
|
||||
shareAll ? b.key : joinBindingSegments([...b.modifiers, b.key], platform)
|
||||
const pair = (a: SplitBinding | null, b: SplitBinding | null): string | null => {
|
||||
if (!a && !b) return null
|
||||
if (a && b) return shareAll ? `${a.key}${b.key}` : `${label(a)} / ${label(b)}`
|
||||
return label((a ?? b) as SplitBinding)
|
||||
}
|
||||
|
||||
return {
|
||||
shared: shareAll ? joinBindingSegments(common, platform) : null,
|
||||
move: pair(prev, next),
|
||||
page: pair(pagePrev, pageNext),
|
||||
accept: accept ? label(accept) : null,
|
||||
close: 'Esc'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -651,17 +740,38 @@ export function isCommandPopupVisible(): boolean {
|
|||
|
||||
// ── CaptionOverlay 팝업 (Phase 10.1) ─────────────────
|
||||
|
||||
const CAPTION_OVERLAY_HEIGHT = 140
|
||||
|
||||
/** 기본 위치: 주 모니터 작업 영역 아래 가운데. */
|
||||
function defaultCaptionOverlayBounds(): Electron.Rectangle {
|
||||
const { workArea } = screen.getPrimaryDisplay()
|
||||
const width = Math.round(workArea.width * 0.8)
|
||||
return {
|
||||
x: workArea.x + Math.round((workArea.width - width) / 2),
|
||||
y: workArea.y + workArea.height - CAPTION_OVERLAY_HEIGHT - 40,
|
||||
width,
|
||||
height: CAPTION_OVERLAY_HEIGHT
|
||||
}
|
||||
}
|
||||
|
||||
/** 저장된 위치가 지금 연결된 어느 모니터 안에 들어오면 쓴다 (모니터를 뺐으면 기본 위치). */
|
||||
function initialCaptionOverlayBounds(): Electron.Rectangle {
|
||||
const fallback = defaultCaptionOverlayBounds()
|
||||
const saved = configGet('captionOverlayPosition')
|
||||
if (!saved) return fallback
|
||||
const handle = { x: saved.x + Math.round(fallback.width / 2), y: saved.y + 20 }
|
||||
const onScreen = screen.getAllDisplays().some(({ workArea }) =>
|
||||
handle.x >= workArea.x && handle.x < workArea.x + workArea.width &&
|
||||
handle.y >= workArea.y && handle.y < workArea.y + workArea.height
|
||||
)
|
||||
return onScreen ? { ...fallback, x: saved.x, y: saved.y } : fallback
|
||||
}
|
||||
|
||||
function createCaptionOverlayWindow(): BrowserWindow {
|
||||
const primaryDisplay = screen.getPrimaryDisplay()
|
||||
const { width: screenWidth, height: screenHeight } = primaryDisplay.workAreaSize
|
||||
const overlayWidth = Math.round(screenWidth * 0.8)
|
||||
const overlayHeight = 120
|
||||
const bounds = initialCaptionOverlayBounds()
|
||||
|
||||
const win = new BrowserWindow({
|
||||
width: overlayWidth,
|
||||
height: overlayHeight,
|
||||
x: Math.round((screenWidth - overlayWidth) / 2),
|
||||
y: screenHeight - overlayHeight - 40,
|
||||
...bounds,
|
||||
show: false,
|
||||
frame: false,
|
||||
transparent: true,
|
||||
|
|
@ -709,18 +819,77 @@ export function showCaptionOverlay(): void {
|
|||
}
|
||||
|
||||
export function hideCaptionOverlay(): void {
|
||||
endCaptionOverlayDrag()
|
||||
if (captionOverlayWindow && !captionOverlayWindow.isDestroyed()) {
|
||||
sendToPopupWindow(captionOverlayWindow, IPC_CHANNELS.POPUP_CAPTION.HIDE, {})
|
||||
captionOverlayWindow.setIgnoreMouseEvents(true, { forward: true })
|
||||
captionOverlayWindow.hide()
|
||||
}
|
||||
}
|
||||
|
||||
export function sendToCaptionOverlay(channel: string, data: unknown): void {
|
||||
if (captionOverlayWindow && !captionOverlayWindow.isDestroyed()) {
|
||||
sendToPopupWindow(captionOverlayWindow, channel, data)
|
||||
// 상태 이벤트에 문구를 실어 보낸다 — 빠지면 오버레이가 영어 기본 문구로 떨어진다.
|
||||
const payload =
|
||||
channel === IPC_CHANNELS.CAPTION.STATE_CHANGED && data !== null && typeof data === 'object'
|
||||
? { ...data, _i18n: getPopupI18nStrings() }
|
||||
: data
|
||||
sendToPopupWindow(captionOverlayWindow, channel, payload)
|
||||
}
|
||||
}
|
||||
|
||||
// ── 자막 창 끌어서 옮기기 ──
|
||||
// 창은 기본적으로 클릭 통과다. 렌더러의 손잡이 위에 있는 동안만 마우스를 받고,
|
||||
// 끄는 동안은 커서를 따라 창을 옮긴다(포커스를 받지 않는 창이라 OS 제목줄 끌기에 기대지 않는다).
|
||||
|
||||
let captionDragTimer: NodeJS.Timeout | null = null
|
||||
let captionDragOffset: { x: number; y: number } | null = null
|
||||
/** 버튼 뗌 신호가 유실돼도 창이 커서에 영원히 붙어 있지 않게 한다 */
|
||||
const CAPTION_DRAG_MAX_MS = 30_000
|
||||
|
||||
export function setCaptionOverlayInteractive(interactive: boolean): void {
|
||||
if (!captionOverlayWindow || captionOverlayWindow.isDestroyed()) return
|
||||
if (!interactive && captionDragTimer) return
|
||||
if (interactive) captionOverlayWindow.setIgnoreMouseEvents(false)
|
||||
else captionOverlayWindow.setIgnoreMouseEvents(true, { forward: true })
|
||||
}
|
||||
|
||||
export function startCaptionOverlayDrag(): void {
|
||||
const win = captionOverlayWindow
|
||||
if (!win || win.isDestroyed() || captionDragTimer) return
|
||||
const cursor = screen.getCursorScreenPoint()
|
||||
const [x, y] = win.getPosition()
|
||||
captionDragOffset = { x: cursor.x - x, y: cursor.y - y }
|
||||
const startedAt = Date.now()
|
||||
captionDragTimer = setInterval(() => {
|
||||
if (win.isDestroyed() || !captionDragOffset || Date.now() - startedAt > CAPTION_DRAG_MAX_MS) {
|
||||
endCaptionOverlayDrag()
|
||||
return
|
||||
}
|
||||
const point = screen.getCursorScreenPoint()
|
||||
win.setPosition(point.x - captionDragOffset.x, point.y - captionDragOffset.y)
|
||||
}, 16)
|
||||
}
|
||||
|
||||
export function endCaptionOverlayDrag(): void {
|
||||
if (!captionDragTimer) return
|
||||
clearInterval(captionDragTimer)
|
||||
captionDragTimer = null
|
||||
captionDragOffset = null
|
||||
const win = captionOverlayWindow
|
||||
if (!win || win.isDestroyed()) return
|
||||
const [x, y] = win.getPosition()
|
||||
configSet('captionOverlayPosition', { x, y })
|
||||
win.setIgnoreMouseEvents(true, { forward: true })
|
||||
}
|
||||
|
||||
export function resetCaptionOverlayPosition(): void {
|
||||
endCaptionOverlayDrag()
|
||||
configSet('captionOverlayPosition', null)
|
||||
const win = captionOverlayWindow
|
||||
if (win && !win.isDestroyed()) win.setBounds(defaultCaptionOverlayBounds())
|
||||
}
|
||||
|
||||
// ── SuggestionOverlay 업 (입력 인텔리전스) ──────────
|
||||
|
||||
/**
|
||||
|
|
@ -731,8 +900,11 @@ export function sendToCaptionOverlay(channel: string, data: unknown): void {
|
|||
* (KeyType.Windows 의 WS_EX_TRANSPARENT|WS_EX_NOACTIVATE 오버레이와 동일한 전략)
|
||||
*/
|
||||
const SUGGESTION_OVERLAY_WIDTH = 460
|
||||
/** 후보 5개 + 스크롤을 담을 높이 (목록은 내부 스크롤) */
|
||||
const SUGGESTION_OVERLAY_HEIGHT = 258
|
||||
/**
|
||||
* 한 페이지(3개 × 고정 44px) + 진행률 줄 + 키 안내 줄이 스크롤 없이 들어가는 높이.
|
||||
* style.css 고정 치수로 렌더링해 잰 값(패널 하단 204 + root 패딩 4) — CSS 를 바꾸면 다시 잰다.
|
||||
*/
|
||||
const SUGGESTION_OVERLAY_HEIGHT = 208
|
||||
|
||||
function applySuggestionOverlayMouseMode(win: BrowserWindow): void {
|
||||
const interactive = configGet('suggestionOverlayInteractive') !== false
|
||||
|
|
@ -795,26 +967,36 @@ export function getSuggestionOverlayWindow(): BrowserWindow {
|
|||
return suggestionOverlayWindow
|
||||
}
|
||||
|
||||
/** 제안 오버레이 표시 — 커(케어 → 요소 → 커서) 기준 배치. */
|
||||
export function showSuggestionOverlay(payload: {
|
||||
interface SuggestionOverlayProvenance {
|
||||
mode: 'local-model' | 'local-memory'
|
||||
continuationCount: number
|
||||
relatedCount: number
|
||||
phraseCount: number
|
||||
appPhraseCount: number
|
||||
}
|
||||
|
||||
interface SuggestionOverlayContent {
|
||||
candidates: Array<{ text: string; rank: number }>
|
||||
activeIndex: number
|
||||
/** 후보 도착 전(생성 중) — 팝업이 로딩 행을 보여준다 */
|
||||
/** 이 세션이 채우려는 후보 총량 — 페이지/진행률 표시의 분모 */
|
||||
targetTotal?: number
|
||||
/** 후보 도착 전(생성 중) 이거나, 후보가 있어도 채우기 루프가 더 만드는 중 */
|
||||
generating?: boolean
|
||||
/** 모델 적재 중 — 팝업이 "준비 중" 을 보여준다 */
|
||||
warmingUp?: boolean
|
||||
/** 스트리밍 중 부분 텍스트 */
|
||||
partialText?: string | null
|
||||
provenance?: {
|
||||
mode: 'local-model' | 'local-memory'
|
||||
continuationCount: number
|
||||
relatedCount: number
|
||||
phraseCount: number
|
||||
appPhraseCount: number
|
||||
} | null
|
||||
anchor: { x: number; y: number; width: number; height: number } | null
|
||||
appName: string | null
|
||||
}): void {
|
||||
provenance?: SuggestionOverlayProvenance | null
|
||||
}
|
||||
|
||||
/** 제안 오버레이 표시 — 커(케어 → 요소 → 커서) 기준 배치. */
|
||||
export function showSuggestionOverlay(
|
||||
payload: SuggestionOverlayContent & {
|
||||
anchor: { x: number; y: number; width: number; height: number } | null
|
||||
anchorKind?: AnchorKind
|
||||
appName: string | null
|
||||
}
|
||||
): void {
|
||||
const win = getSuggestionOverlayWindow()
|
||||
const cursor = screen.getCursorScreenPoint()
|
||||
const anchorPoint = payload.anchor
|
||||
|
|
@ -824,6 +1006,7 @@ export function showSuggestionOverlay(payload: {
|
|||
|
||||
const position = anchorFloatingPanel(
|
||||
payload.anchor,
|
||||
payload.anchorKind ?? null,
|
||||
cursor,
|
||||
{ width: SUGGESTION_OVERLAY_WIDTH, height: SUGGESTION_OVERLAY_HEIGHT },
|
||||
display.workArea
|
||||
|
|
@ -839,33 +1022,26 @@ export function showSuggestionOverlay(payload: {
|
|||
sendToPopupWindow(win, IPC_CHANNELS.POPUP_SUGGESTION.SHOW, {
|
||||
candidates: payload.candidates,
|
||||
activeIndex: payload.activeIndex,
|
||||
targetTotal: payload.targetTotal ?? payload.candidates.length,
|
||||
generating: payload.generating === true,
|
||||
warmingUp: payload.warmingUp === true,
|
||||
partialText: payload.partialText ?? null,
|
||||
appName: payload.appName,
|
||||
provenance: payload.provenance ?? null,
|
||||
_i18n: getPopupI18nStrings()
|
||||
_i18n: getPopupI18nStrings(),
|
||||
_keyHints: buildSuggestionKeyHints()
|
||||
})
|
||||
|
||||
presentPopup(win, 'screen-saver')
|
||||
}
|
||||
|
||||
export function updateSuggestionOverlay(payload: {
|
||||
candidates: Array<{ text: string; rank: number }>
|
||||
activeIndex: number
|
||||
generating?: boolean
|
||||
warmingUp?: boolean
|
||||
partialText?: string | null
|
||||
provenance?: {
|
||||
mode: 'local-model' | 'local-memory'
|
||||
continuationCount: number
|
||||
relatedCount: number
|
||||
phraseCount: number
|
||||
appPhraseCount: number
|
||||
} | null
|
||||
}): void {
|
||||
export function updateSuggestionOverlay(payload: SuggestionOverlayContent): void {
|
||||
if (suggestionOverlayWindow && !suggestionOverlayWindow.isDestroyed()) {
|
||||
sendToPopupWindow(suggestionOverlayWindow, IPC_CHANNELS.POPUP_SUGGESTION.UPDATE, payload)
|
||||
sendToPopupWindow(suggestionOverlayWindow, IPC_CHANNELS.POPUP_SUGGESTION.UPDATE, {
|
||||
...payload,
|
||||
targetTotal: payload.targetTotal ?? payload.candidates.length,
|
||||
_keyHints: buildSuggestionKeyHints()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue