mirror of
https://github.com/stablyai/orca.git
synced 2026-10-01 16:02:03 +00:00
The split silently dropped jira.searchUsers and runtimeEnvironments.retryControlConnection. Neither failed typecheck: the bridge modules carried no satisfies annotation and the composed api object was unannotated, so a missing key was only a runtime TypeError in the renderer. Annotates each module against PreloadApi, the type window.api is already declared as, so the contract supplies the shape rather than a parallel copy. Deleting jira.searchUsers now fails with TS2741 naming the key. Turning this on surfaced 106 places where a bridge locally annotated Promise<unknown> or unknown[] over a contract that declares concrete types -- the bridge was erasing types the renderer relied on. Those annotations are gone. Also exposes app.awaitBeforeUnloadCheckpoint, which was declared and called but never actually on the bridge, so the lazy-chunk recovery reload optional-chained to a no-op and navigated without joining the checkpoint. The missing key was caught by the new annotation rather than by hand.
61 lines
3.0 KiB
TypeScript
61 lines
3.0 KiB
TypeScript
import { ipcRenderer } from 'electron'
|
|
import type {
|
|
PluginPanelActionOutcome,
|
|
PluginPanelEntry
|
|
} from '../../shared/plugins/plugin-panel-bridge'
|
|
import type { PluginConsentRequest } from '../../shared/plugins/plugin-consent-request'
|
|
import type { PluginChangeEvent } from '../../shared/plugins/plugin-change-event'
|
|
import type {
|
|
PluginHostInstallResult,
|
|
PluginHostInstallSource,
|
|
PluginHostListEntry,
|
|
PluginHostLogLine,
|
|
PreloadApi
|
|
} from '../api-types'
|
|
|
|
export const pluginsApi = {
|
|
list: (): Promise<PluginHostListEntry[]> => ipcRenderer.invoke('plugins:list'),
|
|
listLanguagePacks: () => ipcRenderer.invoke('plugins:listLanguagePacks'),
|
|
consent: (args: PluginConsentRequest): Promise<PluginHostListEntry[]> =>
|
|
ipcRenderer.invoke('plugins:consent', args),
|
|
setEnabled: (args: { pluginKey: string; enabled: boolean }): Promise<PluginHostListEntry[]> =>
|
|
ipcRenderer.invoke('plugins:setEnabled', args),
|
|
readPanelEntry: (args: {
|
|
pluginKey: string
|
|
panelId: string
|
|
}): Promise<PluginPanelEntry | null> => ipcRenderer.invoke('plugins:readPanelEntry', args),
|
|
invokeCommand: (args: { pluginKey: string; commandId: string; args?: unknown }) =>
|
|
ipcRenderer.invoke('plugins:invokeCommand', args),
|
|
panelAction: (args: {
|
|
sessionToken: string
|
|
action: string
|
|
params?: unknown
|
|
}): Promise<PluginPanelActionOutcome> => ipcRenderer.invoke('plugins:panelAction', args),
|
|
install: (source: PluginHostInstallSource): Promise<PluginHostInstallResult> =>
|
|
ipcRenderer.invoke('plugins:install', source),
|
|
listMarketplaces: () => ipcRenderer.invoke('plugins:listMarketplaces'),
|
|
addMarketplace: (source) => ipcRenderer.invoke('plugins:addMarketplace', source),
|
|
removeMarketplace: (args) => ipcRenderer.invoke('plugins:removeMarketplace', args),
|
|
refreshMarketplaces: (args = {}) => ipcRenderer.invoke('plugins:refreshMarketplaces', args),
|
|
listMarketplacePlugins: () => ipcRenderer.invoke('plugins:listMarketplacePlugins'),
|
|
previewMarketplacePlugin: (args) => ipcRenderer.invoke('plugins:previewMarketplacePlugin', args),
|
|
installMarketplacePlugin: (preview) =>
|
|
ipcRenderer.invoke('plugins:installMarketplacePlugin', preview),
|
|
previewMarketplaceUpdate: (args) => ipcRenderer.invoke('plugins:previewMarketplaceUpdate', args),
|
|
rollbackMarketplacePlugin: (args) =>
|
|
ipcRenderer.invoke('plugins:rollbackMarketplacePlugin', args),
|
|
remove: (args: { pluginKey: string }): Promise<PluginHostListEntry[]> =>
|
|
ipcRenderer.invoke('plugins:remove', args),
|
|
getLogs: (args: { pluginKey: string }): Promise<PluginHostLogLine[]> =>
|
|
ipcRenderer.invoke('plugins:getLogs', args),
|
|
refresh: (): Promise<PluginHostListEntry[]> => ipcRenderer.invoke('plugins:refresh'),
|
|
onChanged: (callback): (() => void) => {
|
|
const listener = (_event: Electron.IpcRendererEvent, change: PluginChangeEvent): void =>
|
|
callback(change)
|
|
ipcRenderer.on('plugins:changed', listener)
|
|
return () => {
|
|
ipcRenderer.removeListener('plugins:changed', listener)
|
|
}
|
|
}
|
|
} satisfies PreloadApi['plugins']
|