index.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * Native backend of the directory-picker seam: registers `ctx.directoryPicker`
  3. * with the `native` capability, opening one native OS chooser on the host
  4. * display per pick (macOS `osascript`, Windows STA PowerShell
  5. * `FolderBrowserDialog`, Linux Zenity with a KDialog fallback). Only viable
  6. * when the operator sits at the host's screen; remote deployments compose the
  7. * browse backend instead.
  8. * @module @deepseek-ai/dsh-host-directory-picker-native
  9. */
  10. import { DirectoryPicker } from '@deepseek-ai/dsh-host-directory-picker'
  11. import type { DirectoryPickerCapability } from '@deepseek-ai/dsh-host-directory-picker'
  12. import { pickNativeDirectory } from './native-picker.ts'
  13. export type { DirectoryPickerInternals, DirectoryPickerRunner } from './native-picker.ts'
  14. export { pickNativeDirectory } from './native-picker.ts'
  15. /** The `ctx.directoryPicker` native implementation (stable capability object per service life). */
  16. export default class NativeDirectoryPicker extends DirectoryPicker {
  17. private readonly nativeCapability: DirectoryPickerCapability = {
  18. kind: 'native',
  19. /* v8 ignore next -- pure forward to pickNativeDirectory (its spec owns behavior); invoking here opens a real chooser. */
  20. pick: signal => pickNativeDirectory(signal),
  21. }
  22. /**
  23. * The native interaction capability.
  24. * @returns the stable `native` capability object.
  25. */
  26. capability(): DirectoryPickerCapability {
  27. return this.nativeCapability
  28. }
  29. }