-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpreload.js
More file actions
71 lines (70 loc) · 5.02 KB
/
Copy pathpreload.js
File metadata and controls
71 lines (70 loc) · 5.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
const { contextBridge, ipcRenderer } = require('electron');
const AUDIO_SAMPLE_RATE = 24000;
contextBridge.exposeInMainWorld('volyxLens', {
platform: process.platform,
audioConfig: Object.freeze({ sampleRate: AUDIO_SAMPLE_RATE }),
settingsGet: () => ipcRenderer.invoke('settings:get'),
settingsSet: (patch) => ipcRenderer.invoke('settings:set', patch),
clearCredential: (provider) => ipcRenderer.invoke('credentials:clear', provider),
personalContextGet: () => ipcRenderer.invoke('personal-context:get'),
personalContextImport: (kind) => ipcRenderer.invoke('personal-context:import', kind),
personalContextRemove: (kind) => ipcRenderer.invoke('personal-context:remove', kind),
personalContextSetEnabled: (kind, enabled) => ipcRenderer.invoke('personal-context:set-enabled', kind, enabled),
ask: (payload) => ipcRenderer.send('ask', payload),
cancelResponse: () => ipcRenderer.send('llm:cancel'),
captureToggle: () => ipcRenderer.invoke('capture:toggle'),
captureStop: () => ipcRenderer.invoke('capture:stop'),
captureState: () => ipcRenderer.invoke('capture:state'),
setDisplayCaptureIntent: (active) => ipcRenderer.send('capture:display-intent', active === true),
newSession: () => ipcRenderer.invoke('session:new'),
taskContextGet: () => ipcRenderer.invoke('task-context:get'),
taskContextList: (offset = 0, limit = 50) => ipcRenderer.invoke('task-context:list', { offset, limit }),
taskContextCapture: () => ipcRenderer.invoke('task-context:capture'),
taskContextUndo: () => ipcRenderer.invoke('task-context:undo'),
taskContextRemove: (id) => ipcRenderer.invoke('task-context:remove', id),
taskContextPin: (id, pinned) => ipcRenderer.invoke('task-context:pin', { id, pinned: pinned === true }),
taskContextClear: () => ipcRenderer.invoke('task-context:clear'),
transcriptGet: () => ipcRenderer.invoke('transcript:get'),
recapPlan: () => ipcRenderer.invoke('recap:plan'),
transcriptCopy: () => ipcRenderer.invoke('transcript:copy'),
transcriptCopyTurn: (id) => ipcRenderer.invoke('transcript:copy-turn', id),
transcriptClear: () => ipcRenderer.invoke('transcript:clear'),
transcriptExport: (format) => ipcRenderer.invoke('transcript:export', format),
historyList: () => ipcRenderer.invoke('history:list'),
historyGet: (id) => ipcRenderer.invoke('history:get', id),
historyDelete: (id) => ipcRenderer.invoke('history:delete', id),
historyClear: () => ipcRenderer.invoke('history:clear'),
historyExport: (id, format) => ipcRenderer.invoke('history:export', { id, format }),
historyRecap: (id, confirmed = false) => ipcRenderer.invoke('history:recap', { id, confirmed }),
diagnosticsGet: () => ipcRenderer.invoke('diagnostics:get'),
shortcutsGet: () => ipcRenderer.invoke('shortcuts:get'),
shortcutsRetry: () => ipcRenderer.invoke('shortcuts:retry'),
updateGetState: () => ipcRenderer.invoke('update:get-state'),
updateCheck: () => ipcRenderer.invoke('update:check'),
updateDownload: () => ipcRenderer.invoke('update:download'),
updateInstall: () => ipcRenderer.invoke('update:install'),
testResponseProvider: (provider, tier) => ipcRenderer.invoke('provider:test-response', { provider, tier }),
diagnosticsCopy: () => ipcRenderer.invoke('diagnostics:copy'),
testRealtime: () => ipcRenderer.invoke('transcription:test'),
startLiveTranscriptionTest: () => ipcRenderer.invoke('transcription:live-test-start'),
finishLiveTranscriptionTest: () => ipcRenderer.invoke('transcription:live-test-finish'),
liveTranscriptionPcm: (arrayBuffer, metadata) => ipcRenderer.send('transcription:live-test-audio', arrayBuffer, metadata),
retryRealtime: () => ipcRenderer.invoke('transcription:retry'),
requestPermission: (kind) => ipcRenderer.invoke('permissions:request', kind),
permissionStatus: (kind) => ipcRenderer.invoke('permissions:status', kind),
micPcm: (arrayBuffer) => ipcRenderer.send('mic:pcm', arrayBuffer),
systemPcm: (arrayBuffer) => ipcRenderer.send('system:pcm', arrayBuffer),
setIgnoreMouse: (v) => ipcRenderer.send('mouse:ignore', v),
setWindowCollapsed: (collapsed) => ipcRenderer.send('window:set-collapsed', collapsed === true),
setModalState: (open) => ipcRenderer.send('ui:modal-state', open === true),
rendererReady: () => ipcRenderer.send('app:renderer-ready'),
openPane: (url) => ipcRenderer.send('open-pane', url),
quit: () => ipcRenderer.send('app:quit'),
relaunch: () => ipcRenderer.send('app:relaunch'),
log: (msg) => ipcRenderer.send('log', msg),
on: (channel, cb) => {
const allowed = ['audio:level', 'capture:state', 'session:cleared', 'task-context:state', 'transcript:cleared', 'transcript:update', 'transcript:remove', 'transcript:suppressed', 'question:detected', 'question:clear', 'llm:start', 'llm:provider', 'llm:token', 'llm:done', 'llm:error', 'llm:canceled', 'llm:confirm-task-context', 'status', 'transcript', 'transcript:partial', 'transcription:state', 'update:state', 'window:dock-state', 'history:changed', 'history:recap-token', 'meeting:detected', 'meeting:cleared'];
if (!allowed.includes(channel)) return;
ipcRenderer.on(channel, (_e, data) => cb(data));
}
});