refactor: organize shared editor and feature contracts (#42832)

* refactor: group shared editor and feature contracts

* test: retain WSL phone refusal semantics without copy checks
This commit is contained in:
Neil
2026-11-15 17:13:07 -08:00
committed by GitHub
parent 868eea437e
commit aed7718884
536 changed files with 622 additions and 2154 deletions
@@ -25,7 +25,7 @@ const ANDROID_LOCALE_PLUGIN = './plugins/android-locale-config.js'
const PLURAL_POLYFILL_PATH = path.join('mobile', 'src', 'i18n', 'plural-rules-polyfill.ts')
// The runtime owns the subscription that every other caller must go through.
const I18N_RUNTIME_DIR = 'mobile/src/i18n/'
const UI_LOCALE_SOURCE_PATH = path.join('src', 'shared', 'ui-locale.ts')
const UI_LOCALE_SOURCE_PATH = path.join('src', 'shared', 'i18n', 'ui-locale.ts')
// Apple lproj and Android locale_config name these by script/region; the rest match the UI locale id.
const NATIVE_LOCALE_TAGS = { zh: 'zh-Hans', pt: 'pt-BR' }
const PLURAL_SUFFIX_RE = /^(.*)_(zero|one|two|few|many|other)$/
@@ -12,7 +12,7 @@ const jiti = createJiti(import.meta.url, {
alias: { '@': fileURLToPath(new URL('../../../../src/renderer/src', import.meta.url)) }
})
const { compareBaseSensitivityLocaleText } = await jiti.import(
'../../../../src/shared/locale-text-collators.ts'
'../../../../src/shared/i18n/locale-text-collators.ts'
)
const { sortJiraIssues } = await jiti.import(
'../../../../src/renderer/src/components/jira-issue-sorter.ts'
@@ -152,7 +152,7 @@ export const VERIFY_CHECKS = [
'mobile/web-entry/',
'mobile/app.json',
'mobile/locales/',
'src/shared/ui-locale',
'src/shared/i18n/ui-locale',
'config/scripts/verify-mobile-localization',
'config/scripts/localization/catalog-validation/verify-mobile-localization',
'config/scripts/verify-localization-',
@@ -2,7 +2,7 @@ import type { Code, Parent, PhrasingContent, RootContent } from 'mdast'
import {
isDisplayMathOpener,
markdownMathCloser
} from '../../../../../src/shared/markdown-math-rules'
} from '../../../../../src/shared/markdown/markdown-math-rules'
import type { Token } from '../blocks/mobile-markdown-code-nodes'
// The mdast nodes mobile-markdown-math's tokens become, shaped like desktop chat's math nodes.
@@ -1,6 +1,6 @@
import { BoundedMap } from '../../../../../src/shared/collections/bounded-map'
import { MARKDOWN_MATH_KATEX_SETTINGS } from '../../../../../src/shared/markdown-math-rules'
import { copyMarkdownMathSelection } from '../../../../../src/shared/markdown-math-selection'
import { MARKDOWN_MATH_KATEX_SETTINGS } from '../../../../../src/shared/markdown/markdown-math-rules'
import { copyMarkdownMathSelection } from '../../../../../src/shared/markdown/markdown-math-selection'
import { KATEX_PAGE_STYLE } from './katex-page-style.generated'
import { GITHUB_MATH_SIZE_MACROS } from './mobile-markdown-math-nodes'
import type { MobileMathTypesetter } from './mobile-markdown-math-typesetter'
@@ -8,7 +8,7 @@ import {
endsDollarAmount,
rejectsSingleDollarClose,
rejectsSingleDollarOpen
} from '../../../../../src/shared/markdown-math-rules'
} from '../../../../../src/shared/markdown/markdown-math-rules'
// Desktop chat's math grammar (src/renderer/src/components/sidebar/chat-markdown-math.ts) for markdown-it.
@@ -4,7 +4,7 @@ import { Maximize2 } from 'lucide-react-native'
import { colors, radii, spacing, typography, pressedStyle } from '../../theme/mobile-theme'
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
import { themedStyleSheet } from '../../theme/themed-styles'
import { readableMermaidFlowchartSvg } from '../../../../src/shared/mermaid-flowchart-contrast'
import { readableMermaidFlowchartSvg } from '../../../../src/shared/document-preview/mermaid-flowchart-contrast'
import {
readSvgIntrinsicSize,
svgMarkupDataUri
@@ -1,7 +1,7 @@
import {
createRawMarkdownCodeSpanScanner,
type MarkdownCodeSpanScanner
} from '../../../../../src/shared/markdown-code-span-runs'
} from '../../../../../src/shared/markdown/markdown-code-span-runs'
import {
decodeMarkdownEntities,
escapeAttr,
+1 -1
View File
@@ -1,5 +1,5 @@
import { useEffect, useMemo, useRef, useState } from 'react'
import { hashMarkdownContent } from '../../../src/shared/mobile-markdown-document'
import { hashMarkdownContent } from '../../../src/shared/editor/markdown/mobile-markdown-document'
import {
holdDocumentEditDraftOffer,
loadDocumentEditDraft,
@@ -9,7 +9,7 @@ import { SafeAreaView } from 'react-native-safe-area-context'
import { useWorkspaceRouteHandoff } from '../../navigation/workspace-route-handoff'
import { useWorkspaceClient } from '../../worktree/execution-hosts/use-workspace-client'
import { createAttachmentTextPreviewHook } from '../../../../src/shared/attachment-text/use-attachment-text-preview'
import { chatTextAttachmentName } from '../../../../src/shared/native-chat-text-attachment-references'
import { chatTextAttachmentName } from '../../../../src/shared/native-chat/attachments/native-chat-text-attachment-references'
import { MOBILE_BRIDGE_MAX_FRAME_BYTES } from '../../../../src/shared/mobile-bridge-frame-bytes'
import { useClipboardWriter } from '../../platform/clipboard/clipboard'
import { getUiIntlLocale } from '../../i18n/ui-intl-locale'
@@ -6,7 +6,7 @@ import {
type ClipboardImageDimensions
} from '../../../../src/shared/clipboard/clipboard-image'
import { base64DecodedByteLength } from '../../../../src/shared/agent-session/agent-session-attachments'
import { detectImageFileSignature } from '../../../../src/shared/image-file-signature'
import { detectImageFileSignature } from '../../../../src/shared/file-content/image-file-signature'
import { decodeBase64Bytes } from '../../transport/encryption/base64-byte-codec'
import type { PickedMobileImage } from '../../platform/media-picking/media-picker-contract'
@@ -14,7 +14,7 @@ import { colors, feedback, radii, spacing } from '../../../theme/mobile-theme'
import { themedStyleSheet } from '../../../theme/themed-styles'
import { useMobileColorScheme } from '../../../theme/use-mobile-color-scheme'
import { useMobileTranslation } from '../../../i18n/use-mobile-translation'
import type { PanZoomSize } from '../../../../../src/shared/pan-zoom-view'
import type { PanZoomSize } from '../../../../../src/shared/document-preview/pan-zoom-view'
import { MobilePanZoomImage } from './MobilePanZoomImage'
import { REDUCED_MOTION_FADE_MS, SHEET_CURVE } from '../../../components/motion/sheet-motion-values'
import { useReducedMotionEnabled } from '../../../platform/accessibility/use-reduced-motion'
@@ -1,5 +1,5 @@
import { useState, type SyntheticEvent } from 'react'
import type { PanZoomSize } from '../../../../../src/shared/pan-zoom-view'
import type { PanZoomSize } from '../../../../../src/shared/document-preview/pan-zoom-view'
import { useMobilePanZoom } from './use-mobile-pan-zoom'
type Props = {
@@ -10,7 +10,7 @@ import {
getPanZoomViewOffset,
panView,
zoomViewAt
} from '../../../../../src/shared/pan-zoom-view'
} from '../../../../../src/shared/document-preview/pan-zoom-view'
import { useBackClaim } from '../../../navigation/use-back-claim'
const DOUBLE_TAP_MS = 300
@@ -25,7 +25,7 @@ import { colors, pressedStyle } from '../../theme/mobile-theme'
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
import { useMobileTranslation } from '../../i18n/use-mobile-translation'
import { styles } from '../../session/mobile-session-styles'
import type { DiffComment } from '../../../../src/shared/diff-comment-types'
import type { DiffComment } from '../../../../src/shared/file-review/diff-comment-types'
import type {
DiffCommentActions,
DiffSyntaxState,
@@ -1,4 +1,4 @@
import { isCommittedChatAttachmentCandidate } from '../../../../src/shared/native-chat-text-attachment-references'
import { isCommittedChatAttachmentCandidate } from '../../../../src/shared/native-chat/attachments/native-chat-text-attachment-references'
import { createMobileFilePreviewHref } from '../preview/mobile-file-preview-route'
import { useCallback, useLayoutEffect, useRef, type MutableRefObject } from 'react'
import type { ParsedFileLinkLocation } from '../../../../src/shared/file-links/file-link-location'
@@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef } from 'react'
import type { RpcFailure } from '../../transport/rpc/rpc-wire-types'
import { translate } from '../../i18n/mobile-i18n'
import { resolveMobileFileTabDoc } from './mobile-file-tab-doc'
import { shouldIgnoreTrimWhitespace } from '../../../../src/shared/diff-whitespace'
import { shouldIgnoreTrimWhitespace } from '../../../../src/shared/source-control/diff/diff-whitespace'
import { useMobileSourceControlSettings } from '../../source-control/settings/mobile-source-control-settings'
import { filePreviewTextRead } from '../preview/mobile-file-preview-operations'
import { markdownTabRead } from './mobile-markdown-tab-operations'
+1 -1
View File
@@ -1,4 +1,4 @@
import type { SupportedUiLocale } from '../../../src/shared/ui-locale'
import type { SupportedUiLocale } from '../../../src/shared/i18n/ui-locale'
export type LocaleCatalog = Readonly<Record<string, unknown>>
+1 -1
View File
@@ -1,4 +1,4 @@
import type { SupportedUiLocale } from '../../../src/shared/ui-locale'
import type { SupportedUiLocale } from '../../../src/shared/i18n/ui-locale'
import type { LocaleCatalog } from './bundled-locale-catalogs'
export { importBundledLocaleCatalog as importLocaleCatalog } from './bundled-locale-catalogs'
@@ -1,4 +1,4 @@
import type { SupportedUiLocale } from '../../../src/shared/ui-locale'
import type { SupportedUiLocale } from '../../../src/shared/i18n/ui-locale'
import { importBundledLocaleCatalog, type LocaleCatalog } from './bundled-locale-catalogs'
// A shell that skips the catalog chunks has page-locale-catalog-source.ts read them from the desktop
+3 -3
View File
@@ -1,7 +1,7 @@
import i18next, { type i18n, type TOptions } from 'i18next'
import { resolvePluralFamilyKey } from '../../../src/shared/i18n-plural-family'
import { pseudoLocalizeString } from '../../../src/shared/pseudo-localization'
import { DEFAULT_UI_LOCALE, type SupportedUiLocale } from '../../../src/shared/ui-locale'
import { resolvePluralFamilyKey } from '../../../src/shared/i18n/i18n-plural-family'
import { pseudoLocalizeString } from '../../../src/shared/i18n/pseudo-localization'
import { DEFAULT_UI_LOCALE, type SupportedUiLocale } from '../../../src/shared/i18n/ui-locale'
import enRuntimeRequired from './en-runtime-required.json'
import { importLocaleCatalog, onLocaleCatalogArrival } from './locale-catalog-imports'
@@ -1,5 +1,5 @@
import * as z from 'zod'
import type { SupportedUiLocale } from '../../../src/shared/ui-locale'
import type { SupportedUiLocale } from '../../../src/shared/i18n/ui-locale'
import { SHA256_PATTERN } from '../../../src/shared/mobile-web-bundle/manifest-contract'
import {
MOBILE_WEB_BUNDLE_LOCALE_CATALOG_METHOD,
+1 -1
View File
@@ -4,7 +4,7 @@ import {
matchUiLocaleParts,
type SupportedUiLocale,
type UiLocaleParts
} from '../../../src/shared/ui-locale'
} from '../../../src/shared/i18n/ui-locale'
// Hermes has no Intl.Locale: read script (4 letters) and region (2 letters or 3 digits) subtags directly.
export function parseUiLocaleTag(tag: string): UiLocaleParts | null {
+1 -1
View File
@@ -1,4 +1,4 @@
import type { SupportedUiLocale } from '../../../src/shared/ui-locale'
import type { SupportedUiLocale } from '../../../src/shared/i18n/ui-locale'
import { getMobileUiLocale } from './mobile-i18n'
// Explicit script/region: Hermes passes tags to the platform formatter, which reads bare `zh` and `pt` differently by OS.
+2 -2
View File
@@ -1,7 +1,7 @@
import AsyncStorage from '@react-native-async-storage/async-storage'
import { useSyncExternalStore } from 'react'
import { SUPPORTED_UI_LOCALES, type SupportedUiLocale } from '../../../src/shared/ui-locale'
import { UI_LANGUAGE_SYSTEM } from '../../../src/shared/ui-language'
import { SUPPORTED_UI_LOCALES, type SupportedUiLocale } from '../../../src/shared/i18n/ui-locale'
import { UI_LANGUAGE_SYSTEM } from '../../../src/shared/i18n/ui-language'
import { activateMobileUiLocale } from './mobile-i18n'
import { readDeviceUiLocaleTags, resolveUiLocaleFromTags } from './system-ui-locale'
+1 -1
View File
@@ -1,5 +1,5 @@
import { useMemo, useSyncExternalStore } from 'react'
import type { SupportedUiLocale } from '../../../src/shared/ui-locale'
import type { SupportedUiLocale } from '../../../src/shared/i18n/ui-locale'
import {
getMobileUiLocale,
getMobileUiRevision,
@@ -1,7 +1,7 @@
import * as z from 'zod'
import { BRIDGE_APP_INACTIVE_FRAME } from '../page-lifecycle/bridge-app-inactive'
import { salvagedOptional } from '../../../../../src/shared/validation/zod-salvage'
import { SUPPORTED_UI_LOCALES } from '../../../../../src/shared/ui-locale'
import { SUPPORTED_UI_LOCALES } from '../../../../../src/shared/i18n/ui-locale'
import { NODE_PLATFORM_NAMES } from '../../../transport/connection/mobile-runtime-host-platform'
import { RpcEnvelopeFieldsSchema } from '../../../transport/rpc/rpc-envelope-fields'
import { isRpcResponse } from '../../../transport/rpc/rpc-response-shape'
@@ -1,5 +1,5 @@
import AsyncStorage from '@react-native-async-storage/async-storage'
import type { MobilePushFilter } from '../../../../src/shared/mobile-push-contract'
import type { MobilePushFilter } from '../../../../src/shared/notifications/mobile-push-contract'
const KEY = 'orca:notificationDeliveryPreferences'
export type NotificationDeliveryPreferences = {
@@ -11,7 +11,7 @@ import {
loadNotificationDeliveryPreferences,
type NotificationDeliveryPreferences
} from '../delivery-policy/notification-delivery-preferences'
import { allowsMobilePushAlertKind } from '../../../../src/shared/mobile-push-alert'
import { allowsMobilePushAlertKind } from '../../../../src/shared/notifications/mobile-push-alert'
const RECENT_FOREGROUND_PUSH_CAP = 512
const recentForegroundPushes = new Set<string>()
@@ -15,8 +15,8 @@ import { loadNotificationDeliveryPreferences } from './delivery-policy/notificat
import {
allowsMobilePushDelivery,
mobilePushAlertContent
} from '../../../src/shared/mobile-push-alert'
import { reserveNotificationCooldown } from '../../../src/shared/notification-burst-cooldown'
} from '../../../src/shared/notifications/mobile-push-alert'
import { reserveNotificationCooldown } from '../../../src/shared/notifications/notification-burst-cooldown'
import type { MobileNotificationDispatchEvent } from '../../../src/main/runtime/push/notifications/runtime-mobile-notification-controller'
export function subscribeToDesktopNotifications(client: RpcClient, hostId: string): () => void {
@@ -1,7 +1,7 @@
import type {
MobilePushFilter,
MobilePushRegisterInput
} from '../../../../src/shared/mobile-push-contract'
} from '../../../../src/shared/notifications/mobile-push-contract'
import type { UnvalidatedRpcRequestPort } from '../../transport/rpc/unvalidated-rpc-request-port'
import type { MobilePushToken } from './push-token'
import { bindDeferredRpcOperation, defineRpcOperation } from '../../transport/rpc/rpc-operation'
@@ -2,7 +2,7 @@ import { z } from 'zod'
import type {
MobilePushRegisterResult,
MobilePushTestResult
} from '../../../../src/shared/mobile-push-contract'
} from '../../../../src/shared/notifications/mobile-push-contract'
import { hostUnionArms, salvagedOptional } from '../../../../src/shared/validation/zod-salvage'
// Keep notification replies nullish/optional where callers use optional access; tightening them would replace existing fallback copy with incompatible-reply errors.
@@ -2,7 +2,7 @@ import * as Notifications from 'expo-notifications'
import type {
MobilePushApnsEnvironment,
MobilePushPlatform
} from '../../../../src/shared/mobile-push-contract'
} from '../../../../src/shared/notifications/mobile-push-contract'
// Use raw APNs/FCM tokens because Orca’s gateway talks directly to providers, not Expo’s push service.
+1 -1
View File
@@ -4,7 +4,7 @@ import {
stepCalmStatusReveal,
type CalmStatusReveal,
type CalmStatusSchedule
} from '../../../src/shared/calm-status-reveal'
} from '../../../src/shared/remote-runtime/connection-status/calm-status-reveal'
// Quick revalidations never show, and a shown hint never flashes.
const REFRESH_HINT_SCHEDULE: CalmStatusSchedule = {
@@ -24,7 +24,7 @@ import { formatPreviewByteLength } from '../../../../files/preview/mobile-file-p
import type { PendingNativeChatImage } from './mobile-native-chat-image-attachment'
import type { PendingNativeChatFile } from './mobile-native-chat-file-attachment'
import { useMobileNativeChatOpenFile } from '../../links/mobile-native-chat-open-file-context'
import { chatTextAttachmentName } from '../../../../../../src/shared/native-chat-text-attachment-references'
import { chatTextAttachmentName } from '../../../../../../src/shared/native-chat/attachments/native-chat-text-attachment-references'
const THUMB_SIZE = 58
// Items sit 12pt in from the composer box's edge (box padding plus strip padding).
@@ -1,5 +1,5 @@
import { formatNativeChatFileReference } from '../../../../../../src/shared/native-chat/input/composer/agent-image-paste'
import { chatTextAttachmentName } from '../../../../../../src/shared/native-chat-text-attachment-references'
import { chatTextAttachmentName } from '../../../../../../src/shared/native-chat/attachments/native-chat-text-attachment-references'
import {
MobileFileTooLargeError,
type PickedMobileFile
@@ -1,6 +1,6 @@
import type { AgentJournalMessageItem } from '../../../../../../src/shared/agent-session/journal/agent-session-journal-types'
import { queuedEditTextForKeptImages } from '../../../../../../src/shared/queued-message-edit'
import { appendReturnedDraftText } from '../../../../../../src/shared/returned-draft-text'
import { appendReturnedDraftText } from '../../../../../../src/shared/native-chat/input/drafts/returned-draft-text'
import { mobileDraftImageOfBlock } from '../../input/queued-messages/mobile-queued-message-edit-draft'
import {
readMobileNativeChatDraftInputs,
@@ -1,5 +1,5 @@
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'
import { appendReturnedDraftText } from '../../../../../../src/shared/returned-draft-text'
import { appendReturnedDraftText } from '../../../../../../src/shared/native-chat/input/drafts/returned-draft-text'
import type { MobileNativeChatSendIntent } from './mobile-native-chat-send'
import type { MobileNativeChatInputLockReason } from '../../MobileNativeChatView'
import { useSettledMobileNativeChatInputLock } from '../field/use-mobile-native-chat-input-lease'
@@ -1,6 +1,6 @@
import { useSyncExternalStore, type SetStateAction } from 'react'
import type { AgentJournalSkillRef } from '../../../../../../src/shared/agent-session/journal/agent-session-journal-types'
import { appendReturnedDraftText } from '../../../../../../src/shared/returned-draft-text'
import { appendReturnedDraftText } from '../../../../../../src/shared/native-chat/input/drafts/returned-draft-text'
import {
returnMobileNativeChatDraftAttachments,
closeMobileNativeChatEditInputs,
@@ -8,7 +8,7 @@ import {
type SetStateAction
} from 'react'
import type { NativeChatMessage } from '../../../../../../src/shared/native-chat/native-chat-types'
import { appendReturnedDraftText } from '../../../../../../src/shared/returned-draft-text'
import { appendReturnedDraftText } from '../../../../../../src/shared/native-chat/input/drafts/returned-draft-text'
import {
findLandedImagePreviewEchoes,
mergeSentImagePreviews,
@@ -24,7 +24,7 @@ import {
queuedEditTextForKeptImages,
type QueuedMessageImageBlock
} from '../../../../../../src/shared/queued-message-edit'
import { appendReturnedDraftText } from '../../../../../../src/shared/returned-draft-text'
import { appendReturnedDraftText } from '../../../../../../src/shared/native-chat/input/drafts/returned-draft-text'
import {
setMobileNativeChatDraftText,
type MobileComposerWriter
@@ -3,7 +3,7 @@ import { Text } from 'react-native'
import {
nativeChatTextAttachmentPaths,
chatTextAttachmentName
} from '../../../../../../src/shared/native-chat-text-attachment-references'
} from '../../../../../../src/shared/native-chat/attachments/native-chat-text-attachment-references'
import { useMobileNativeChatOpenFile } from '../../links/mobile-native-chat-open-file-context'
import { styles } from '../messages/mobile-native-chat-message-styles'
@@ -13,7 +13,7 @@ import type { CustomKey } from '../terminal/key-input/terminal-custom-keys'
import type { AppliedSnapshotMarker } from './tabs/session-tab-snapshot-gate'
import { useWorktreeSessionTabsLoaded } from '../terminal/session/creation/use-initial-session-terminal-autocreate'
import { createMobileSessionCreateWarningState } from './tabs/mobile-session-create-warning-state'
import type { DiffComment } from '../../../src/shared/diff-comment-types'
import type { DiffComment } from '../../../src/shared/file-review/diff-comment-types'
import type { DiffNotesDelivery } from '../source-control/review/review-notes/mobile-review-comment-state'
import type {
DirtyMarkdownDraft,
@@ -1,6 +1,6 @@
import { ListRow } from '../components/list/ListGroup'
import { SUPPORTED_UI_LOCALES } from '../../../src/shared/ui-locale'
import { UI_LANGUAGE_NATIVE_NAMES, UI_LANGUAGE_SYSTEM } from '../../../src/shared/ui-language'
import { SUPPORTED_UI_LOCALES } from '../../../src/shared/i18n/ui-locale'
import { UI_LANGUAGE_NATIVE_NAMES, UI_LANGUAGE_SYSTEM } from '../../../src/shared/i18n/ui-language'
import { isMobilePseudoLocalizationEnabled, setMobilePseudoLocalization } from '../i18n/mobile-i18n'
import {
resolveMobileUiLocale,
@@ -3,12 +3,12 @@ import { translate } from '../../../i18n/mobile-i18n'
import type {
DiffComment,
MobileDiffReviewState
} from '../../../../../src/shared/diff-comment-types'
} from '../../../../../src/shared/file-review/diff-comment-types'
import type { ConnectionState } from '../../../transport/connection/connection-state'
import type { RpcClient } from '../../../transport/rpc/rpc-client-contract'
import { useClipboardWriter } from '../../../platform/clipboard/clipboard'
import { triggerSuccess } from '../../../platform/haptics/haptics'
import { formatDiffComments } from '../../../../../src/shared/diff-comments-format'
import { formatDiffComments } from '../../../../../src/shared/file-review/diff-comments-format'
import {
clearSentMobileDiffComments,
markMobileDiffCommentsSent
@@ -8,7 +8,7 @@ import {
mobileReviewDiffInput,
type MobileReviewDiffInput
} from './mobile-diff-review-loaders'
import { shouldIgnoreTrimWhitespace } from '../../../../../src/shared/diff-whitespace'
import { shouldIgnoreTrimWhitespace } from '../../../../../src/shared/source-control/diff/diff-whitespace'
import { useMobileSourceControlSettings } from '../../settings/mobile-source-control-settings'
import { defineHostQuery, prefetchHostQuery, useHostQuery } from '../../../query/host-query'
import type { HostQueryTarget } from '../../../query/host-query-key'
@@ -1,5 +1,5 @@
import { FileText, ListChecks } from 'lucide-react-native'
import type { DiffComment } from '../../../../../src/shared/diff-comment-types'
import type { DiffComment } from '../../../../../src/shared/file-review/diff-comment-types'
import {
MobileLoadErrorState,
MobileOfflineState,
@@ -1,7 +1,7 @@
import { useMemo, useState } from 'react'
import { KeyboardAvoidingView, Pressable, Text, View } from 'react-native'
import { Copy, Plus, Send, Trash2, X } from 'lucide-react-native'
import type { DiffComment } from '../../../../../src/shared/diff-comment-types'
import type { DiffComment } from '../../../../../src/shared/file-review/diff-comment-types'
import { colors } from '../../../theme/mobile-theme'
import { useMobileColorScheme } from '../../../theme/use-mobile-color-scheme'
import type { Translate } from '../../../i18n/mobile-i18n'
@@ -1,6 +1,6 @@
import { Pressable, StyleSheet, Text, View } from 'react-native'
import { Check } from 'lucide-react-native'
import type { DiffComment } from '../../../../../src/shared/diff-comment-types'
import type { DiffComment } from '../../../../../src/shared/file-review/diff-comment-types'
import { colors, pressedStyle, radii, spacing, typography } from '../../../theme/mobile-theme'
import { themedStyleSheet } from '../../../theme/themed-styles'
import { useMobileColorScheme } from '../../../theme/use-mobile-color-scheme'
@@ -3,7 +3,7 @@ import { Platform, Pressable, Text, View, type ViewStyle } from 'react-native'
import { MessageSquare } from 'lucide-react-native'
import type { Translate } from '../../../i18n/mobile-i18n'
import { useMobileTranslation } from '../../../i18n/use-mobile-translation'
import type { DiffComment } from '../../../../../src/shared/diff-comment-types'
import type { DiffComment } from '../../../../../src/shared/file-review/diff-comment-types'
import type { MobileDiffLine } from '../diff-state/mobile-diff-lines'
import type { MobileHighlightedDiffLine } from '../../../files/session-documents/mobile-file-syntax'
import { mobileDiffLineNumber, mobileDiffLinePrefix } from '../diff-state/mobile-diff-format'
@@ -10,7 +10,7 @@ import {
} from 'react-native'
import { Gesture, GestureDetector } from 'react-native-gesture-handler'
import { UnfoldVertical } from 'lucide-react-native'
import type { DiffComment } from '../../../../../src/shared/diff-comment-types'
import type { DiffComment } from '../../../../../src/shared/file-review/diff-comment-types'
import { useMobileColorScheme } from '../../../theme/use-mobile-color-scheme'
import { useMobileTranslation } from '../../../i18n/use-mobile-translation'
import {
@@ -4,7 +4,7 @@ import type {
DiffComment,
DiffReviewScope,
MobileDiffReviewState
} from '../../../../../src/shared/diff-comment-types'
} from '../../../../../src/shared/file-review/diff-comment-types'
import type {
MobileGitBranchChangeEntry,
MobileGitChangedFile
@@ -1,7 +1,7 @@
import type {
DiffComment,
MobileDiffReviewState
} from '../../../../../src/shared/diff-comment-types'
} from '../../../../../src/shared/file-review/diff-comment-types'
import type {
MobileGitBranchCompareReply as MobileGitBranchCompareResult,
MobileGitChangedFile
@@ -2,7 +2,7 @@ import type {
DiffReviewScope,
MobileDiffReviewFileState,
MobileDiffReviewState
} from '../../../../../src/shared/diff-comment-types'
} from '../../../../../src/shared/file-review/diff-comment-types'
export type MobileDiffReviewFileDescriptor = {
key: string
@@ -7,7 +7,7 @@ import { colors, pressedStyle } from '../../../theme/mobile-theme'
import { useMobileColorScheme } from '../../../theme/use-mobile-color-scheme'
import { useMobileTranslation } from '../../../i18n/use-mobile-translation'
import { styles } from '../../../session/mobile-session-styles'
import type { DiffComment } from '../../../../../src/shared/diff-comment-types'
import type { DiffComment } from '../../../../../src/shared/file-review/diff-comment-types'
import type { RenderableDiffLine } from './mobile-review-comment-state'
export function DiffLineRow({
@@ -1,4 +1,4 @@
import type { DiffComment } from '../../../../../src/shared/diff-comment-types'
import type { DiffComment } from '../../../../../src/shared/file-review/diff-comment-types'
export type UpdateMobileDiffCommentInput = {
id: string
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest'
import type { DiffComment } from '../../../../../src/shared/diff-comment-types'
import type { DiffComment } from '../../../../../src/shared/file-review/diff-comment-types'
import { removeDeliveredMobileDiffComments } from './mobile-diff-comments'
function comment(overrides: Partial<DiffComment> & Pick<DiffComment, 'id'>): DiffComment {
@@ -1,4 +1,7 @@
import type { DiffComment, DiffReviewScope } from '../../../../../src/shared/diff-comment-types'
import type {
DiffComment,
DiffReviewScope
} from '../../../../../src/shared/file-review/diff-comment-types'
import {
mobileDiffReviewCommentMatchesItem,
type MobileDiffReviewQueueItem
@@ -1,4 +1,4 @@
import type { DiffComment } from '../../../../../src/shared/diff-comment-types'
import type { DiffComment } from '../../../../../src/shared/file-review/diff-comment-types'
import type { MobileDiffLine } from '../diff-state/mobile-diff-lines'
import type { MobileHighlightedDiffLine } from '../../../files/session-documents/mobile-file-syntax'
import type { ReadyFileDocState } from '../../../files/session-documents/session-document-state'
@@ -1,5 +1,5 @@
import { mergeDiffCommentMutation } from '../../../../../src/shared/diff-comment-mutation'
import type { DiffComment } from '../../../../../src/shared/diff-comment-types'
import { mergeDiffCommentMutation } from '../../../../../src/shared/file-review/diff-comment-mutation'
import type { DiffComment } from '../../../../../src/shared/file-review/diff-comment-types'
type PendingSave = { base: DiffComment[]; next: DiffComment[] }
@@ -3,7 +3,7 @@ import { translate } from '../../../i18n/mobile-i18n'
import type {
DiffComment,
MobileDiffReviewState
} from '../../../../../src/shared/diff-comment-types'
} from '../../../../../src/shared/file-review/diff-comment-types'
import { triggerError, triggerSuccess } from '../../../platform/haptics/haptics'
import type { ConnectionState } from '../../../transport/connection/connection-state'
import type { RpcClient } from '../../../transport/rpc/rpc-client-contract'
@@ -1,5 +1,5 @@
import { useCallback, useState, type SetStateAction } from 'react'
import type { DiffComment } from '../../../../../src/shared/diff-comment-types'
import type { DiffComment } from '../../../../../src/shared/file-review/diff-comment-types'
import { useDurableDraftField } from '../../../drafts/durable-draft-fields'
import type { ReviewSheet, ReviewSheetIntents } from '../diff-actions/mobile-diff-review-sheets'
@@ -2,7 +2,7 @@ import { useCallback } from 'react'
import type {
DiffComment,
MobileDiffReviewState
} from '../../../../../src/shared/diff-comment-types'
} from '../../../../../src/shared/file-review/diff-comment-types'
import { addMobileDiffComment } from './mobile-diff-comments'
import type { MobileDiffReviewQueueItem } from '../diff-state/mobile-diff-review-queue'
import type { ReviewScreenState } from '../diff-state/mobile-diff-review-screen-model'
@@ -1,5 +1,5 @@
import { useEffect, useCallback, useMemo, useRef, useState } from 'react'
import { formatDiffComments } from '../../../../../src/shared/diff-comments-format'
import { formatDiffComments } from '../../../../../src/shared/file-review/diff-comments-format'
import { translate } from '../../../i18n/mobile-i18n'
import { useClipboardWriter } from '../../../platform/clipboard/clipboard'
import { interpretOrThrowRefusalMessage } from '../../../transport/rpc/rpc-refusal-message'
@@ -14,14 +14,14 @@ import {
removeMobileDiffComments,
sendableMobileDiffComments
} from './mobile-diff-comments'
import { mergeDiffCommentMutation } from '../../../../../src/shared/diff-comment-mutation'
import { mergeDiffCommentMutation } from '../../../../../src/shared/file-review/diff-comment-mutation'
import {
createReviewNotesSync,
enqueueReviewNotesRequest,
reviewNotesView,
type ReviewNotesSync
} from './mobile-review-notes-sync'
import type { DiffComment } from '../../../../../src/shared/diff-comment-types'
import type { DiffComment } from '../../../../../src/shared/file-review/diff-comment-types'
import type { DiffNotesDelivery } from './mobile-review-comment-state'
import type { MobileSessionDocumentReadersModel } from '../../../files/session-documents/use-mobile-session-document-readers'
@@ -1,6 +1,6 @@
import { useCallback, useMemo, useReducer, useState } from 'react'
import { useMobileTranslation } from '../../i18n/use-mobile-translation'
import type { DiffComment } from '../../../../src/shared/diff-comment-types'
import type { DiffComment } from '../../../../src/shared/file-review/diff-comment-types'
import type { ConnectionState } from '../../transport/connection/connection-state'
import type { RpcClient } from '../../transport/rpc/rpc-client-contract'
import { getWorktreeLabel } from '../../worktree/row-presentation/worktree-label'
@@ -2,7 +2,7 @@ import type * as UseMobileDiffReviewInteractionsModule from '../../../../source-
import type * as MobileDiffReviewSheetsModule from '../../../../source-control/review/diff-actions/mobile-diff-review-sheets'
import { hookMount, performHookAction } from '../../react-mounting/hook-mount'
import { mountFixture } from '../../react-mounting/recorder-fixture-shape'
import type { DiffComment } from '../../../../../../src/shared/diff-comment-types'
import type { DiffComment } from '../../../../../../src/shared/file-review/diff-comment-types'
import type { MobileDiffReviewQueueItem } from '../../../../source-control/review/diff-state/mobile-diff-review-queue'
import type {
ReviewScreenState,
@@ -3,7 +3,7 @@ import {
CALM_STATUS_IDLE,
stepCalmStatusReveal,
type CalmStatusReveal
} from '../../../../src/shared/calm-status-reveal'
} from '../../../../src/shared/remote-runtime/connection-status/calm-status-reveal'
import type { ConnectionState } from './connection-state'
// Hide short drops after a successful connection; show initial connects and refused pairings immediately.
+1 -1
View File
@@ -11,7 +11,7 @@ import {
} from '../arguments/flags'
import { getEmulatorCommandTarget } from './emulator-command-target'
import { RuntimeClientError } from '../runtime/connection/types'
import { EMULATOR_ATTACH_RPC_TIMEOUT_MS } from '../../shared/emulator-attach-timeouts'
import { EMULATOR_ATTACH_RPC_TIMEOUT_MS } from '../../shared/emulator/emulator-attach-timeouts'
type EmulatorAttachResult = {
info?: {
+1 -1
View File
@@ -1,7 +1,7 @@
import { realpath, stat } from 'node:fs/promises'
import { isAbsolute, relative, resolve, sep } from 'node:path'
import { pathToFileURL } from 'node:url'
import { nativeChatTextAttachmentParts } from '../../../shared/native-chat-text-attachment-references'
import { nativeChatTextAttachmentParts } from '../../../shared/native-chat/attachments/native-chat-text-attachment-references'
import type { ContentBlock } from '../generated/acp-protocol.generated'
const TRAILING_PUNCTUATION = /[.,;:!?)\]}`"'*]+$/
@@ -1,4 +1,4 @@
import type { DeveloperPermissionStatus } from '../../../shared/developer-permissions-types'
import type { DeveloperPermissionStatus } from '../../../shared/app-lifecycle/permissions/developer-permissions-types'
import {
getCurrentDaemonAdapter,
getLegacyDaemonAdapters
@@ -12,7 +12,7 @@ import {
type HelperOrigin
} from '../../../shared/terminal/daemon/daemon-tcc-denial-capture'
import { LOCAL_BUILD_COMPATIBILITY_CONTRACT } from '../../../shared/remote-runtime/orcad-distribution/local-build-compatibility-contract'
import type { DeveloperPermissionStatus } from '../../../shared/developer-permissions-types'
import type { DeveloperPermissionStatus } from '../../../shared/app-lifecycle/permissions/developer-permissions-types'
import type { EventProps } from '../../../shared/telemetry/telemetry-event-classification'
import { msSinceWakeSignal } from '../../power/wake-signal-clock'
import { isTelemetryEnabled, track } from '../../telemetry/client'
@@ -18,7 +18,7 @@ import type { DaemonPtyAdapterOptions } from './daemon-pty-adapter-options'
import type { DaemonEvent } from '../../protocol/daemon-stream-events'
import type { DaemonEndpointIdentity } from '../../protocol/daemon-hello-protocol'
import type { IPtyProvider } from '../../../providers/pty/provider-contract'
import type { DeveloperPermissionStatus } from '../../../../shared/developer-permissions-types'
import type { DeveloperPermissionStatus } from '../../../../shared/app-lifecycle/permissions/developer-permissions-types'
import {
AUTOMATIC_WORK_RESUME_UNSUPPORTED,
type AutomaticWorkResumeOutcome,
+1 -1
View File
@@ -5,7 +5,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { runProcess } from '@orca/process-host'
import type * as ProcessHost from '@orca/process-host'
import type { Repo } from '../../shared/repository/repo-types'
import { DEFAULT_FORMATTER_INCLUDE } from '../../shared/editor-formatter'
import { DEFAULT_FORMATTER_INCLUDE } from '../../shared/editor/formatting/editor-formatter'
import { formatEditorText } from './format-editor-text'
vi.mock('@orca/process-host', async (importOriginal) => {
+1 -1
View File
@@ -5,7 +5,7 @@ import {
editorFormatterArgv,
editorFormatterSchema,
type EditorFormatResult
} from '../../shared/editor-formatter'
} from '../../shared/editor/formatting/editor-formatter'
import { getRepoExecutionHostId } from '../../shared/execution-host'
import { isPathInsideOrEqual } from '../../shared/cross-platform-path'
import type { RuntimeStore } from '../runtime/construction/runtime-store-contract'
@@ -1,7 +1,7 @@
import { spawn } from 'node:child_process'
import { createOutputSink } from '@orca/process-host/bounded-output-sink'
import { EmulatorError } from '../emulator-errors'
import { emulatorFailureText } from '../../../shared/emulator-failure-copy'
import { emulatorFailureText } from '../../../shared/emulator/emulator-failure-copy'
import type { AndroidCommandRunner } from './android-command-runner'
import type { AndroidSdkPaths } from './android-sdk-discovery'
import { bootCompletedArgs, isBootCompleted } from './adb-devices'
@@ -1,6 +1,6 @@
import { discoverAndroidSdkFromHost } from './android-sdk-host-discovery'
import { EmulatorError } from '../emulator-errors'
import { emulatorFailureText } from '../../../shared/emulator-failure-copy'
import { emulatorFailureText } from '../../../shared/emulator/emulator-failure-copy'
import type { AndroidSdkPaths } from './android-sdk-discovery'
// Rediscover host SDKs per call so installs and settings changes work without restarting.
@@ -5,7 +5,7 @@ import { pipeline } from 'node:stream/promises'
import type { IncomingMessage } from 'node:http'
import { getAppEnvironment } from '../../../shared/app-lifecycle/app-environment'
import { EmulatorError } from '../emulator-errors'
import { emulatorFailureText } from '../../../shared/emulator-failure-copy'
import { emulatorFailureText } from '../../../shared/emulator/emulator-failure-copy'
import { emulatorProbe, emulatorProbeError } from '../emulator-probe'
import { SCRCPY_SERVER_VERSION } from './scrcpy-server-deploy'
@@ -1,5 +1,8 @@
import { EmulatorError, emulatorErrorCodedMessage } from '../emulator-errors'
import { emulatorCodedMessage, emulatorFailureText } from '../../../shared/emulator-failure-copy'
import {
emulatorCodedMessage,
emulatorFailureText
} from '../../../shared/emulator/emulator-failure-copy'
import type { EmulatorSessionInfo } from '../emulator-types'
import type {
BackendAvailability,
@@ -39,7 +42,7 @@ import {
} from '../android/android-stream-session-starter'
import { AndroidStreamController } from '../android/android-stream-controller'
import { scrcpyVideoRegistry } from '../scrcpy-video-registry'
import { ANDROID_AVD_BOOT_TIMEOUT_MS } from '../../../shared/emulator-attach-timeouts'
import { ANDROID_AVD_BOOT_TIMEOUT_MS } from '../../../shared/emulator/emulator-attach-timeouts'
import type { EmulatorGesturePoint } from '../emulator-gesture-sender'
export type AndroidEmulatorBackendOptions = {
@@ -4,7 +4,7 @@ import type {
EmulatorSessionInfo,
EmulatorStreamCodec
} from '../emulator-types'
import type { EmulatorCodedMessage } from '../../../shared/emulator-failure-copy'
import type { EmulatorCodedMessage } from '../../../shared/emulator/emulator-failure-copy'
export type { EmulatorBackendKind, EmulatorStreamCodec }
@@ -1,6 +1,6 @@
import { platform } from 'node:os'
import { EmulatorError } from '../emulator-errors'
import { emulatorFailureText } from '../../../shared/emulator-failure-copy'
import { emulatorFailureText } from '../../../shared/emulator/emulator-failure-copy'
import type { EmulatorSessionInfo } from '../emulator-types'
import {
ensureSimulatorBooted,
+4 -1
View File
@@ -3,7 +3,10 @@ import type { EmulatorBridge } from './emulator-bridge'
import type { SimulatorDevice } from './simctl-simulator-devices'
import type { BackendAvailability, EmulatorDevice } from './backends/emulator-backend'
import { emulatorErrorCodedMessage } from './emulator-errors'
import { emulatorCodedMessage, type EmulatorCodedMessage } from '../../shared/emulator-failure-copy'
import {
emulatorCodedMessage,
type EmulatorCodedMessage
} from '../../shared/emulator/emulator-failure-copy'
type ToolchainCheck = { ok: boolean } & Partial<EmulatorCodedMessage>
@@ -1,7 +1,7 @@
import type { EmulatorBridge } from './emulator-bridge'
import type { EmulatorDevice } from './backends/emulator-backend'
import { EmulatorError } from './emulator-errors'
import { emulatorFailureText } from '../../shared/emulator-failure-copy'
import { emulatorFailureText } from '../../shared/emulator/emulator-failure-copy'
const isIphone = (device: EmulatorDevice): boolean =>
device.backend === 'ios' && /iPhone/i.test(device.name)
+1 -1
View File
@@ -3,7 +3,7 @@ import {
matchEmulatorErrorCopy,
type EmulatorCodedMessage,
type EmulatorFailureCode
} from '../../shared/emulator-failure-copy'
} from '../../shared/emulator/emulator-failure-copy'
// Keep error codes stable: agents and CLI callers depend on them.
export class EmulatorError extends Error {
+1 -1
View File
@@ -2,7 +2,7 @@ import WebSocket from 'ws'
import {
encodeServeSimTouchFrame,
type ServeSimTouchFrame
} from '../../shared/emulator-touch-frame'
} from '../../shared/emulator/emulator-touch-frame'
export type EmulatorGesturePoint = ServeSimTouchFrame
@@ -1,9 +1,9 @@
import { getEmulatorOpeningMode } from '../../shared/emulator-opening-preferences'
import { getEmulatorOpeningMode } from '../../shared/emulator/emulator-opening-preferences'
import type { GlobalSettings } from '../../shared/global-settings-types'
import type {
EmulatorDevicePreference,
EmulatorSelectionRequired
} from '../../shared/emulator-opening-preferences'
} from '../../shared/emulator/emulator-opening-preferences'
import type { EmulatorDevice } from './backends/emulator-backend'
import { findBootedWorkspaceDevice } from './emulator-default-attach-device'
@@ -2,7 +2,7 @@ import { existsSync, readFileSync } from 'node:fs'
import { join } from 'node:path'
import { tmpdir } from 'node:os'
import { EmulatorError } from './emulator-errors'
import { emulatorFailureText } from '../../shared/emulator-failure-copy'
import { emulatorFailureText } from '../../shared/emulator/emulator-failure-copy'
import type { EmulatorSessionInfo } from './emulator-types'
const MJPEG_STREAM_SUFFIX = '/stream.mjpeg'
@@ -2,7 +2,7 @@ import { execFile } from 'node:child_process'
import type { ExecFileException } from 'node:child_process'
import { platform } from 'node:os'
import { EmulatorError } from './emulator-errors'
import { emulatorFailureText } from '../../shared/emulator-failure-copy'
import { emulatorFailureText } from '../../shared/emulator/emulator-failure-copy'
import { execServeSimCommand, type ServeSimExecutable } from './serve-sim-execution'
export type SimulatorDevice = {
@@ -1,6 +1,6 @@
import { runProcess } from '@orca/process-host'
import { EmulatorError } from './emulator-errors'
import { emulatorFailureText } from '../../shared/emulator-failure-copy'
import { emulatorFailureText } from '../../shared/emulator/emulator-failure-copy'
// Xcode 27's Device Hub sets this in every booted simulator; while it is 1 the guest drops serve-sim's touch and keyboard HID.
const DEVICE_HUB_INPUT_KEY = 'com.apple.coredevice.dtuhidd.active'
@@ -4,7 +4,7 @@ import { spawnProcess } from '@orca/process-host'
import { existsSync } from 'node:fs'
import { posix, win32 } from 'node:path'
import { parseWslUncPath } from '../../shared/file-access/wsl-paths'
import { isVsCodeLauncherExecutable } from '../../shared/remote-ssh-editor-launcher'
import { isVsCodeLauncherExecutable } from '../../shared/editor/launch/remote-ssh-editor-launcher'
import { resolveCliCommand } from '../../shared/shell/command-resolution/node-cli-command-resolution'
import { envWithoutAppImageRuntime } from '../pty/shell-startup/appimage-terminal-env'
import {
@@ -1,4 +1,4 @@
import { getRemoteSshEditorKind } from '../../shared/remote-ssh-editor-launcher'
import { getRemoteSshEditorKind } from '../../shared/editor/launch/remote-ssh-editor-launcher'
import type { ShellOpenExternalEditorResult } from '../../shared/shell/opening/shell-open-types'
import type { SshTarget } from '../../shared/remote-runtime/ssh/ssh-types'
import { getLauncherBaseName } from './editor-launcher-name'
+1 -1
View File
@@ -1,6 +1,6 @@
import type { GlobalSettings } from '../../shared/global-settings-types'
import type { TerminalColorOverrides } from '../../shared/terminal-themes/terminal-color-overrides'
import { HEX_COLOR_RE } from '../../shared/color-validation'
import { HEX_COLOR_RE } from '../../shared/color/color-validation'
import { parsePaddingValue, parseStrictInt } from './numeric-config-values'
const PALETTE_INDEX_MAP: Record<number, keyof TerminalColorOverrides> = {
@@ -1,5 +1,5 @@
import type { GitDiffResult } from '../../../../shared/git/diff/git-diff-compare-types'
import { getLargeDiffRenderLimit } from '../../../../shared/large-diff-render-limit'
import { getLargeDiffRenderLimit } from '../../../../shared/source-control/diff/large-diff-render-limit'
import {
IMAGE_AND_PDF_PREVIEW_MIME_TYPES,
filePreviewExtension
+2 -33
View File
@@ -8,9 +8,9 @@ vi.mock('electron', () => ({
}
}))
import { UI_LANGUAGE_ENGLISH } from '../../shared/ui-language'
import { UI_LANGUAGE_ENGLISH } from '../../shared/i18n/ui-language'
import { mainI18n, setMainPluginLanguagePacks, setMainUiLanguage, translateMain } from './main-i18n'
import { pluginLanguageResourceId } from '../../shared/plugins/artifacts/plugin-language-pack-artifact'
import '../../shared/plugins/artifacts/plugin-language-pack-artifact'
describe('main-i18n lazy locale loading', () => {
afterEach(() => vi.restoreAllMocks())
@@ -37,35 +37,4 @@ describe('main-i18n lazy locale loading', () => {
expect(mainI18n.language).toBe('en')
expect(translateMain('menu.file', 'File')).toBe('File')
})
it("uses a contributed pack's plural rules and English for its empty values", async () => {
const id = 'plugin:orca-samples.russian/ru-RU' as const
setMainPluginLanguagePacks([
{
id,
resourceLanguage: pluginLanguageResourceId(id),
pluginKey: 'orca-samples.russian',
coverage: 100,
locale: 'ru-RU',
catalog: {
terminals_one: '{{count}} one',
terminals_few: '{{count}} few',
terminals_other: '{{count}} other',
empty: ''
}
}
])
await setMainUiLanguage(id)
expect(
[1, 3, 5, 21].map((count) => translateMain('terminals', '{{count}} terms', { count }))
).toEqual(['1 one', '3 few', '5 other', '21 one'])
// A key the pack omits falls back to English chosen by English rules, not Russian's (21 is ru "one").
expect(
translateMain('missing.family', '{{count}} files', {
count: 21,
defaultValue_one: '{{count}} file'
})
).toBe('21 files')
expect(translateMain('empty', '{{count}} terminals', { count: 2 })).toBe('2 terminals')
})
})
+7 -3
View File
@@ -1,9 +1,13 @@
import { getSystemLanguageDetection } from './system-language'
import type { i18n as I18nInstance } from 'i18next'
import { createOrcaI18n } from '../../shared/orca-i18n-instance'
import { DEFAULT_UI_LOCALE, resolveUiLocale, type SupportedUiLocale } from '../../shared/ui-locale'
import { UI_LANGUAGE_SYSTEM, type UiLanguage } from '../../shared/ui-language'
import { createOrcaI18n } from '../../shared/i18n/orca-i18n-instance'
import {
DEFAULT_UI_LOCALE,
resolveUiLocale,
type SupportedUiLocale
} from '../../shared/i18n/ui-locale'
import { UI_LANGUAGE_SYSTEM, type UiLanguage } from '../../shared/i18n/ui-language'
let languageGeneration = 0
+1 -1
View File
@@ -1,5 +1,5 @@
import { app } from 'electron'
import { detectUiLanguage, type UiLanguageDetection } from '../../shared/ui-locale'
import { detectUiLanguage, type UiLanguageDetection } from '../../shared/i18n/ui-locale'
let snapshot: UiLanguageDetection | null | undefined
@@ -1,5 +1,5 @@
import { createRequire } from 'node:module'
import type { EmojiShortcodeDataset } from '../../shared/emoji-shortcode-catalog'
import type { EmojiShortcodeDataset } from '../../shared/text/emoji-shortcode-catalog'
// Defer the 166KB catalog; packaged require resolves the builder-copied file in Resources/node_modules outside app.asar.
const requireFromMain = createRequire(__filename)
+1 -1
View File
@@ -9,7 +9,7 @@ import type {
DeveloperPermissionRequestResult,
DeveloperPermissionState,
DeveloperPermissionStatus
} from '../../shared/developer-permissions-types'
} from '../../shared/app-lifecycle/permissions/developer-permissions-types'
const PRIVACY_PANE_URLS: Partial<Record<DeveloperPermissionId, string>> = {
camera: 'x-apple.systempreferences:com.apple.preference.security?Privacy_Camera',
+4 -1
View File
@@ -2,7 +2,10 @@ import { BrowserWindow, dialog, ipcMain } from 'electron'
import { writeFile } from 'node:fs/promises'
import { ExportTimeoutError, htmlToPdf } from '../lib/html-to-pdf'
import { abortWhenRendererGone } from './renderer-lifetime-abort'
import { pdfExportFailure, type PdfExportResult } from '../../shared/pdf-export-failure-copy'
import {
pdfExportFailure,
type PdfExportResult
} from '../../shared/document-preview/pdf-export-failure-copy'
export type ExportHtmlToPdfArgs = {
html: string
@@ -2,7 +2,7 @@ import { lstat } from 'node:fs/promises'
import { basename, join, resolve } from 'node:path'
import { isENOENT } from './access/filesystem-path-containment'
import { classifyImportSource } from './filesystem-import-source-stat'
import { deconflictCopyName } from '../../../shared/import-copy-name'
import { deconflictCopyName } from '../../../shared/file-import/import-copy-name'
import type { ImportItemResult } from '../../../shared/file-import/filesystem-import-result'
import {
copyLocalFileNoFollow,
@@ -21,7 +21,7 @@ import { writeLocalTextFileWithDiskPrecondition } from './local-disk-write-preco
import { replaceLocalFileBytesIfUnchanged } from './local-disk-bytes-replace'
import type { FileBytesWritePrecondition } from '../../../shared/file-write/file-bytes-write'
import { windowsFsPath } from '../../wsl/filesystem/wsl-unc-drive-fs-path'
import { TRASH_DELETE_FAILED_MESSAGE } from '../../../shared/trash-delete-failure'
import { TRASH_DELETE_FAILED_MESSAGE } from '../../../shared/file-access/trash-delete-failure'
export function registerFilesystemWriteHandlers(context: FilesystemHandlerContext): void {
const { store } = context

Some files were not shown because too many files have changed in this diff Show More