mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-11-16 19:36:54 +00:00
The native directory picker now passes createDirectory, so macOS shows New Folder. The remote folder picker gets a New folder action that calls the existing POST /api/files/mkdir under the current path and opens the new folder, ready to select.
16 lines
673 B
TypeScript
16 lines
673 B
TypeScript
import type { OpenDialogOptions } from 'electron'
|
|
|
|
type DialogProperty = NonNullable<OpenDialogOptions['properties']>[number]
|
|
|
|
// `hermes:selectPaths` → `dialog.showOpenDialog` properties. Directory pickers
|
|
// carry `createDirectory` so macOS shows New Folder: a new project needs a
|
|
// folder, and the picker is where the user expects to make one.
|
|
export function selectPathsDialogProperties(options: { directories?: boolean; multiple?: boolean } = {}) {
|
|
const properties: DialogProperty[] = options.directories ? ['openDirectory', 'createDirectory'] : ['openFile']
|
|
|
|
if (options.multiple !== false) {
|
|
properties.push('multiSelections')
|
|
}
|
|
|
|
return properties
|
|
}
|