mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 16:02:32 +00:00
refactor(preload): name bridge modules for what they expose
The split named these -part-N, which says nothing. Renames each for the group of bridge methods it actually exposes and folds the single-method window-reveal module into the window-controls module it belongs with. Verified by walking the composed contextBridge surface before and after: 1060 keys, identical nesting and value types, zero delta. The bridge modules carry no satisfies annotation, so a dropped key here is a runtime error in the renderer rather than a typecheck failure.
This commit is contained in:
@@ -88,8 +88,8 @@ describe('GitHub IPC channel parity', () => {
|
||||
// The preload facade now composes the two GitHub bridge owners; inspect
|
||||
// both owners so the channel census remains tied to the actual invokes.
|
||||
const preloadSource = [
|
||||
'../../preload/api/gh-bridge-part-1.ts',
|
||||
'../../preload/api/gh-bridge-part-2.ts'
|
||||
'../../preload/api/gh-bridge-pull-requests-and-work-items.ts',
|
||||
'../../preload/api/gh-bridge-mutations-and-projects.ts'
|
||||
]
|
||||
.map((relativePath) => readFileSync(new URL(relativePath, import.meta.url), 'utf8'))
|
||||
.join('\n')
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import type {
|
||||
import { readBrowserClientHostIdArgument } from '../../shared/browser-client-host-id-argument'
|
||||
import { browserClientPageRendererRequests } from '../preload-runtime-support'
|
||||
|
||||
export const browserApiPart1 = {
|
||||
export const browserGuestRegistrationAndDownloadsApi = {
|
||||
onClientPageRendererRequest: browserClientPageRendererRequests.subscribe,
|
||||
readClientHostId: (): string | null => readBrowserClientHostIdArgument(process.argv),
|
||||
registerGuest: (args: {
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { ipcRenderer } from 'electron'
|
||||
|
||||
export const browserApiPart2 = {
|
||||
export const browserPageInteractionAndSessionsApi = {
|
||||
onContextMenuRequested: (
|
||||
callback: (event: {
|
||||
browserPageId: string
|
||||
@@ -1,4 +1,7 @@
|
||||
import { browserApiPart1 } from './browser-bridge-part-1'
|
||||
import { browserApiPart2 } from './browser-bridge-part-2'
|
||||
import { browserGuestRegistrationAndDownloadsApi } from './browser-bridge-guest-registration-and-downloads'
|
||||
import { browserPageInteractionAndSessionsApi } from './browser-bridge-page-interaction-and-sessions'
|
||||
|
||||
export const browserApi = { ...browserApiPart1, ...browserApiPart2 }
|
||||
export const browserApi = {
|
||||
...browserGuestRegistrationAndDownloadsApi,
|
||||
...browserPageInteractionAndSessionsApi
|
||||
}
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ import type {
|
||||
} from '../../shared/github/project-request-types'
|
||||
import type { AppStarSource } from '../../shared/gh-star-source'
|
||||
|
||||
export const ghApiPart2 = {
|
||||
export const ghMutationsAndProjectsApi = {
|
||||
setPRAutoMerge: (args: {
|
||||
repoPath: string
|
||||
repoId?: string
|
||||
+1
-1
@@ -10,7 +10,7 @@ import type { GitHubWorkItem, ListWorkItemsResult } from '../../shared/github/wo
|
||||
import type { GitHubCreateIssueResult } from '../../shared/issue-mutation-types'
|
||||
import type { TaskSourceContext } from '../../shared/task-source-context'
|
||||
|
||||
export const ghApiPart1 = {
|
||||
export const ghPullRequestsAndWorkItemsApi = {
|
||||
viewer: (): Promise<unknown> => ipcRenderer.invoke('gh:viewer'),
|
||||
repoSlug: (args: { repoPath: string; repoId?: string }): Promise<unknown> =>
|
||||
ipcRenderer.invoke('gh:repoSlug', args),
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ghApiPart1 } from './gh-bridge-part-1'
|
||||
import { ghApiPart2 } from './gh-bridge-part-2'
|
||||
import { ghPullRequestsAndWorkItemsApi } from './gh-bridge-pull-requests-and-work-items'
|
||||
import { ghMutationsAndProjectsApi } from './gh-bridge-mutations-and-projects'
|
||||
|
||||
export const ghApi = { ...ghApiPart1, ...ghApiPart2 }
|
||||
export const ghApi = { ...ghPullRequestsAndWorkItemsApi, ...ghMutationsAndProjectsApi }
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ import type { TerminalViewAttributes } from '../../shared/terminal-view-attribut
|
||||
import type { PtyMainDeliveryDiagnostics } from '../../shared/pty-delivery-diagnostics'
|
||||
import type { AgentKind, LaunchSource, RequestKind } from '../../shared/telemetry-events'
|
||||
|
||||
export const ptyApiPart1 = {
|
||||
export const ptySessionControlApi = {
|
||||
spawn: (opts: {
|
||||
cols: number
|
||||
rows: number
|
||||
+1
-1
@@ -2,7 +2,7 @@ import { ipcRenderer } from 'electron'
|
||||
import type { PtyModelRestoreNeededEvent } from '../../shared/pty-model-restore-marker'
|
||||
import type { TerminalSideEffectBatch } from '../../shared/terminal-side-effect-facts'
|
||||
|
||||
export const ptyApiPart2 = {
|
||||
export const ptyStreamAndSerializationApi = {
|
||||
inspectProcess: (
|
||||
id: string
|
||||
): Promise<{
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ptyApiPart1 } from './pty-bridge-part-1'
|
||||
import { ptyApiPart2 } from './pty-bridge-part-2'
|
||||
import { ptySessionControlApi } from './pty-bridge-session-control'
|
||||
import { ptyStreamAndSerializationApi } from './pty-bridge-stream-and-serialization'
|
||||
|
||||
export const ptyApi = { ...ptyApiPart1, ...ptyApiPart2 }
|
||||
export const ptyApi = { ...ptySessionControlApi, ...ptyStreamAndSerializationApi }
|
||||
|
||||
+4
-1
@@ -13,7 +13,7 @@ import type { NativeFileDropPayload } from '../../shared/native-file-drop'
|
||||
import type { ReadClipboardTextOptions } from '../../shared/clipboard-text'
|
||||
import { subscribeNativeFileDrop } from '../preload-runtime-support'
|
||||
|
||||
export const uiApiPart4 = {
|
||||
export const uiClipboardAndWindowControlsApi = {
|
||||
onOpenDiffFromMobile: (
|
||||
callback: (data: {
|
||||
worktreeId: string
|
||||
@@ -191,5 +191,8 @@ export const uiApiPart4 = {
|
||||
},
|
||||
confirmWindowClose: (): void => {
|
||||
ipcRenderer.send('window:confirm-close')
|
||||
},
|
||||
notifyWindowRevealed: (): void => {
|
||||
ipcRenderer.send('ui:window-revealed')
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import { ipcRenderer } from 'electron'
|
||||
|
||||
export const uiApiPart5 = {
|
||||
notifyWindowRevealed: (): void => {
|
||||
ipcRenderer.send('ui:window-revealed')
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -2,7 +2,7 @@ import { ipcRenderer } from 'electron'
|
||||
import type { PersistedUIState } from '../../shared/persisted-ui-state-types'
|
||||
import type { KeybindingActionId } from '../../shared/keybindings'
|
||||
|
||||
export const uiApiPart1 = {
|
||||
export const uiStateAndMenuCommandsApi = {
|
||||
get: () => ipcRenderer.invoke('ui:get'),
|
||||
set: (args) => ipcRenderer.invoke('ui:set', args),
|
||||
setWithAck: (args) => ipcRenderer.invoke('ui:set', args),
|
||||
+1
-1
@@ -7,7 +7,7 @@ import type {
|
||||
} from '../../shared/worktree/launch-types'
|
||||
import { browserFindSubscriptions } from '../preload-runtime-support'
|
||||
|
||||
export const uiApiPart2 = {
|
||||
export const uiTabAndBrowserCommandsApi = {
|
||||
onRequestTabSetProfile: (
|
||||
callback: (data: {
|
||||
requestId: string
|
||||
+1
-1
@@ -12,7 +12,7 @@ import type {
|
||||
RuntimeTerminalPresentation
|
||||
} from '../../shared/runtime-types'
|
||||
|
||||
export const uiApiPart3 = {
|
||||
export const uiTerminalAndSessionTabsApi = {
|
||||
onCreateTerminal: (
|
||||
callback: (data: {
|
||||
requestId?: string
|
||||
@@ -1,14 +1,12 @@
|
||||
import type { PreloadApi } from '../api-types'
|
||||
import { uiApiPart1 } from './ui-bridge-part-1'
|
||||
import { uiApiPart2 } from './ui-bridge-part-2'
|
||||
import { uiApiPart3 } from './ui-bridge-part-3'
|
||||
import { uiApiPart4 } from './ui-bridge-part-4'
|
||||
import { uiApiPart5 } from './ui-bridge-part-5'
|
||||
import { uiStateAndMenuCommandsApi } from './ui-bridge-state-and-menu-commands'
|
||||
import { uiTabAndBrowserCommandsApi } from './ui-bridge-tab-and-browser-commands'
|
||||
import { uiTerminalAndSessionTabsApi } from './ui-bridge-terminal-and-session-tabs'
|
||||
import { uiClipboardAndWindowControlsApi } from './ui-bridge-clipboard-and-window-controls'
|
||||
|
||||
export const uiApi = {
|
||||
...uiApiPart1,
|
||||
...uiApiPart2,
|
||||
...uiApiPart3,
|
||||
...uiApiPart4,
|
||||
...uiApiPart5
|
||||
...uiStateAndMenuCommandsApi,
|
||||
...uiTabAndBrowserCommandsApi,
|
||||
...uiTerminalAndSessionTabsApi,
|
||||
...uiClipboardAndWindowControlsApi
|
||||
} satisfies PreloadApi['ui']
|
||||
|
||||
Reference in New Issue
Block a user