Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/buddy/electron/main/local-chat/spaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { LocalChatIpcContext } from './registrar'
import { shell } from 'electron'
import { validationRequestSchemas } from '../../../shared/runtime/apiValidation'
import { spacesRequestSchemas, spacesRpc } from '../../../shared/spaces/spaceApi'
import { spaceDirectoryRequestSchema, spaceFilesRpc, spaceFileTargetSchema, spaceSaveDocumentSchema } from '../../../shared/spaces/spaceFileApi'
import { spaceDirectoryRequestSchema, spaceFileMutationSchema, spaceFilesRpc, spaceFileTargetSchema, spaceSaveDocumentSchema } from '../../../shared/spaces/spaceFileApi'
import { LOCAL_CHAT_IPC_CHANNELS } from '../../shared/localChatApi'
import { translateDesktopNative } from '../desktopNativeI18n'
import { SpaceDirectorySelectionLedger } from '../spaceDirectorySelections'
Expand All @@ -11,6 +11,8 @@ import { selectPaths } from './nativeSelection'
export function registerSpacesIpc(context: LocalChatIpcContext): void {
const { handle, request, options } = context
const spaceDirectorySelections = new SpaceDirectorySelectionLedger()
handle(LOCAL_CHAT_IPC_CHANNELS.spaceFilesMutate, (_event, input) => request(spaceFilesRpc.mutate, spaceFileMutationSchema.parse(input), 125_000))
handle(LOCAL_CHAT_IPC_CHANNELS.spaceFilesLocate, (_event, input) => request(spaceFilesRpc.locate, spaceFileTargetSchema.parse(input)))
handle(LOCAL_CHAT_IPC_CHANNELS.spaceDocumentRead, (_event, input) => request(spaceFilesRpc.readDocument, spaceFileTargetSchema.parse(input)))
handle(LOCAL_CHAT_IPC_CHANNELS.spaceDocumentSave, (_event, input) => request(spaceFilesRpc.saveDocument, spaceSaveDocumentSchema.parse(input)))
handle(LOCAL_CHAT_IPC_CHANNELS.spaceFilesList, (_event, input) => request(spaceFilesRpc.list, spaceDirectoryRequestSchema.parse(input)))
Expand Down
2 changes: 2 additions & 0 deletions apps/buddy/electron/preload/local-chat/spaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export function createSpacesApi(): Pick<LocalChatApi, 'spaces'> {
onChanged: listener => subscribe<SpaceChangeNotice>(LOCAL_CHAT_IPC_CHANNELS.spacesChanged, listener),
readDocument: input => ipcRenderer.invoke(LOCAL_CHAT_IPC_CHANNELS.spaceDocumentRead, { ...input }),
saveDocument: input => ipcRenderer.invoke(LOCAL_CHAT_IPC_CHANNELS.spaceDocumentSave, { ...input }),
mutateEntry: input => ipcRenderer.invoke(LOCAL_CHAT_IPC_CHANNELS.spaceFilesMutate, { ...input }),
locateEntry: input => ipcRenderer.invoke(LOCAL_CHAT_IPC_CHANNELS.spaceFilesLocate, { ...input }),
listDirectory: input => ipcRenderer.invoke(LOCAL_CHAT_IPC_CHANNELS.spaceFilesList, { ...input }),
readFile: input => ipcRenderer.invoke(LOCAL_CHAT_IPC_CHANNELS.spaceFilesRead, { ...input }),
revealFile: input => ipcRenderer.invoke(LOCAL_CHAT_IPC_CHANNELS.spaceFilesReveal, { ...input }),
Expand Down
4 changes: 4 additions & 0 deletions apps/buddy/electron/shared/localChatApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ export const LOCAL_CHAT_IPC_CHANNELS = {
taskMarksSetRead: 'lexora:buddy:task-marks:set-read',
taskMarksClear: 'lexora:buddy:task-marks:clear',
changesOverview: 'lexora:buddy:changes:overview',
spaceFilesMutate: 'lexora:buddy:space-files:mutate',
spaceFilesLocate: 'lexora:buddy:space-files:locate',
spaceFilesList: 'lexora:buddy:space-files:list',
spaceFilesRead: 'lexora:buddy:space-files:read',
spaceFilesReveal: 'lexora:buddy:space-files:reveal',
Expand Down Expand Up @@ -320,6 +322,8 @@ export interface LocalChatApi {
onChanged: (listener: (event: SpaceChangeNotice) => void) => () => void
readDocument: (input: SpaceFileTarget) => Promise<import('../../shared/spaces/spaceFileApi').SpaceTextDocument>
saveDocument: (input: import('../../shared/spaces/spaceFileApi').SpaceSaveDocument) => Promise<import('../../shared/spaces/spaceFileApi').SpaceSaveResult>
mutateEntry: (input: import('../../shared/spaces/spaceFileApi').SpaceFileMutation) => Promise<import('../../shared/spaces/spaceFileApi').SpaceFileMutationResult>
locateEntry: (input: SpaceFileTarget) => Promise<{ path: string, kind: 'directory' | 'file' }>
listDirectory: (input: SpaceDirectoryRequest) => Promise<LocalSpaceDirectoryPage>
readFile: (input: SpaceFileTarget) => Promise<LocalSpaceFilePreview>
revealFile: (input: SpaceFileTarget) => Promise<void>
Expand Down
Loading
Loading