feat(desktop): information architecture overhaul — home, records, meetings first

Wave 2 of the 2026-09-28 design overhaul ("records are the main
character, a quiet instrument"). Decisions: design.md.

- Shell: sidebar with primary Home / Records / Meetings (Ctrl+1..3) and a
  secondary "Tools" group; every item is a button with aria-current.
  The status bar is removed — its "100% LOCAL PRIVACY · ZERO CLOUD SYNC"
  claim contradicted device sync; the sidebar shows only queried state.
- Navigation context (routes, params, back, useRouteRequest) so Home can
  open a specific meeting or record.
- Home replaces the dashboard: dictation key, start actions, only real
  problems, one-line summary, recent records and meetings, file
  transcription, free-tier limits.
- Settings become a full-screen route with vertical tabs (tabs no longer
  clip) and a shared row grammar; long-standing bugs fixed: team and
  enterprise tiers crashed the license tab (currentTier undefined),
  first-run onboarding could not be left, Pro+ saw "upgrade to Pro+".
- Records: date-grouped single list with in-place expansion, search and
  tags together, mode/favorite filters, load more past 50, undoable
  delete. Meetings: list with search/rename/delete, summary-first detail
  (summary | transcript | documents | my notes), notes persisted locally
  instead of being lost. Tools pages cleaned up; stale-closure example
  chips and a 1550x mouse-distance bug fixed.
- Shared pieces: PageHeader, EmptyStateCard, SearchInput ("/" works),
  ConfirmDialog, notify with undo; display-labels maps domain values to
  typed i18n keys so missing keys fail to compile.
- Mono font stack falls back to Pretendard for Hangul (Korean labels no
  longer render spaced out).
- i18n: new ko/en keys via scripts/i18n-add-keys.mjs (one read-merge-
  write so parallel editors cannot clobber locale files).

Some renderer files also carried pre-existing in-flight changes (error
recovery deep links, meeting document hooks); they are included as-is.
This commit is contained in:
Yun Chan 2026-09-28 20:46:08 +09:00
parent ba9ef9741e
commit f064c93197
96 changed files with 12886 additions and 8924 deletions

View file

@ -0,0 +1,157 @@
// src/renderer/pages/tools/tools-model.ts
// 2급 "도구" 화면(AI 대화·명령어·사전·지식 베이스)이 함께 쓰는 순수 판단 — React·IPC 의존 없음.
// 화면이 말하는 상태는 여기서 한 번만 정한다: 조회한 설정에서 나온 사실만 쓰고, 추측을 '정상'으로 쓰지 않는다.
import type { TranslationKey } from '@d3ro/i18n'
import type { ConversationState, LLMAction, LLMActionSelection, LLMProcessParams } from '@d3ro/core/types'
/** 지연 삭제 중인 항목을 목록에서 뺀다 */
export function withoutHidden<T extends { id: string }>(items: readonly T[], hidden: ReadonlySet<string>): T[] {
if (hidden.size === 0) return [...items]
return items.filter((item) => !hidden.has(item.id))
}
// ── 명령어: 받아쓰기 후처리 경로 ─────────────────────────────
/** 명령어 목록의 "사용 안 함" 선택 값 (지시문 id 와 겹치지 않는다) */
export const COMMAND_NONE = '__none__'
interface InstructionLike {
id: string
name: string
prompt: string
}
/**
* 지금 받아쓰기에 실제로 적용되는 후처리 — main 의 resolveVoiceLlmRoute 와 같은 규칙:
* 지시문은 기본 액션이 'custom' 일 때만 쓰인다(활성 지시문이 있어도 refine 등을 덮지 않는다).
*/
export type CommandPipeline<T extends InstructionLike> =
| { kind: 'raw' }
| { kind: 'instruction'; instruction: T }
/** 'custom' 인데 활성 지시문이 없거나 지워졌다 */
| { kind: 'instruction-missing' }
| { kind: 'action'; action: Exclude<LLMAction, 'custom'> }
export function resolveCommandPipeline<T extends InstructionLike>(
config: { defaultLLMAction: LLMActionSelection; activeInstructionId: string | null },
instructions: readonly T[],
): CommandPipeline<T> {
const action = config.defaultLLMAction
if (action === 'none') return { kind: 'raw' }
if (action === 'custom') {
const instruction = config.activeInstructionId
? instructions.find((item) => item.id === config.activeInstructionId)
: undefined
return instruction ? { kind: 'instruction', instruction } : { kind: 'instruction-missing' }
}
return { kind: 'action', action }
}
/** 목록 라디오의 선택 값 — 일반 액션(다듬기 등)이 기본이면 아무것도 고르지 않은 상태다 */
export function commandSelection<T extends InstructionLike>(pipeline: CommandPipeline<T>): string {
if (pipeline.kind === 'raw') return COMMAND_NONE
if (pipeline.kind === 'instruction') return pipeline.instruction.id
return ''
}
/** 일반 후처리 액션 이름 */
export function llmActionLabelKey(action: Exclude<LLMAction, 'custom'>): TranslationKey {
switch (action) {
case 'refine':
return 'settings.action.refine'
case 'translate':
return 'settings.action.translate'
case 'summarize':
return 'settings.action.summarize'
case 'grammar':
return 'settings.action.grammar'
case 'expand':
return 'tools.commands.action.expand'
case 'chain':
return 'tools.commands.action.chain'
}
}
/**
* 테스트 실행 요청 — 실제 받아쓰기와 같은 경로를 탄다. 실행할 수 없으면 이유를 돌려준다.
* (예전엔 활성 명령이 없으면 무조건 'refine' 을 돌려, 원문을 그대로 넣는 설정에서도 다듬은 결과를 보여 줬다.)
*/
export function commandTestRequest<T extends InstructionLike>(
pipeline: CommandPipeline<T>,
text: string,
): { ok: true; params: LLMProcessParams } | { ok: false; reason: 'raw' | 'chain' | 'missing' | 'empty' } {
const trimmed = text.trim()
if (!trimmed) return { ok: false, reason: 'empty' }
switch (pipeline.kind) {
case 'raw':
return { ok: false, reason: 'raw' }
case 'instruction-missing':
return { ok: false, reason: 'missing' }
case 'instruction':
return { ok: true, params: { text: trimmed, action: 'custom', customPrompt: pipeline.instruction.prompt } }
case 'action':
// 체인은 여러 단계를 main 의 ChainService 가 실행한다 — 한 번의 LLM 호출로 흉내 내지 않는다
if (pipeline.action === 'chain') return { ok: false, reason: 'chain' }
return { ok: true, params: { text: trimmed, action: pipeline.action } }
}
}
// ── AI 대화: 상태 표지 ─────────────────────────────────────
export interface ConversationBadge {
labelKey: TranslationKey
tone: 'default' | 'accent'
pulse: boolean
}
/**
* 머리의 상태 표지. 세션이 꺼져 있으면 아무것도 보이지 않는다 — 켜지지 않은 대화를 '대기'로 쓰지 않는다.
* 강조색은 듣는 중(녹음)일 때만.
*/
export function conversationBadge(input: {
active: boolean
state: ConversationState
connecting: boolean
}): ConversationBadge | null {
if (input.connecting) return { labelKey: 'conversation.realtime.connecting', tone: 'default', pulse: true }
if (!input.active) return null
switch (input.state) {
case 'listening':
return { labelKey: 'conversation.listening', tone: 'accent', pulse: true }
case 'thinking':
return { labelKey: 'conversation.thinking', tone: 'default', pulse: true }
case 'speaking':
return { labelKey: 'conversation.speaking', tone: 'default', pulse: true }
case 'idle':
return { labelKey: 'conversation.idle', tone: 'default', pulse: false }
}
}
// ── 지식 베이스 ────────────────────────────────────────────
/** 질문 예시 — 누르면 그 문장으로 바로 질문한다 */
export const KNOWLEDGE_EXAMPLE_KEYS: readonly TranslationKey[] = [
'tools.knowledge.example.summary',
'tools.knowledge.example.schedule',
'tools.knowledge.example.policy',
]
/** 문서 색인 상태 — 진행 중인 문서만 '색인 중', 끝났는데 색인이 없으면 '색인 안 됨'(대기 중이라 쓰지 않는다) */
export function documentIndexLabelKey(doc: { id: string; indexed: boolean }, indexingId: string | null): TranslationKey {
if (doc.id === indexingId) return 'rag.indexing'
return doc.indexed ? 'rag.indexed' : 'tools.knowledge.notIndexed'
}
// ── 사전 ──────────────────────────────────────────────────
export function dictionaryCategoryLabelKey(category: 'user' | 'auto' | 'technical'): TranslationKey {
switch (category) {
case 'user':
return 'mobile.dictionary.category.user'
case 'auto':
return 'mobile.dictionary.category.auto'
case 'technical':
return 'mobile.dictionary.category.technical'
}
}