diff --git a/packages/host/directory-picker/package.json b/packages/host/directory-picker/package.json index 5be5940ecd..6fb6652bdc 100644 --- a/packages/host/directory-picker/package.json +++ b/packages/host/directory-picker/package.json @@ -22,12 +22,17 @@ "types": "./lib/types/invariant.d.ts", "default": "./lib/invariant.js" }, + "./types": { + "types": "./lib/types/types.d.ts", + "default": "./lib/types/types.js" + }, "./src/*": "./src/*", "./package.json": "./package.json" }, "files": [ "lib/index.js", "lib/invariant.js", + "lib/types/**/*.js", "lib/types/**/*.d.ts" ], "license": "MIT", diff --git a/packages/host/directory-picker/src/index.ts b/packages/host/directory-picker/src/index.ts index 5e8eb64f87..f4eb0674a2 100644 --- a/packages/host/directory-picker/src/index.ts +++ b/packages/host/directory-picker/src/index.ts @@ -12,6 +12,9 @@ */ import { Context, Service } from '@deepseek-ai/cordis' +import type { DirectoryListing } from './types.ts' + +export type { DirectoryEntry, DirectoryListing } from './types.ts' /** The native interaction: one OS directory chooser on the host display. */ export interface DirectoryPickerNativeCapability { @@ -24,37 +27,6 @@ export interface DirectoryPickerNativeCapability { pick(signal: AbortSignal): Promise } -/** One directory row: a listing child or a breadcrumb ancestor. */ -export interface DirectoryEntry { - /** Base name shown in a browser row (a root crumb carries its full path). */ - name: string - /** Absolute host path — clients never join path segments themselves. */ - path: string - /** Hidden by the host platform's convention (dot-prefixed on POSIX); the client owns whether to show it. */ - hidden: boolean -} - -/** One directory level plus its ancestry, as a browse backend reports it. */ -export interface DirectoryListing { - /** Absolute path of the listed directory. */ - path: string - /** The host account's home directory (breadcrumb "Home" rooting). */ - home: string - /** - * Ancestor chain from the filesystem root to the listed directory - * inclusive; every crumb is a jump target (crumb `hidden` is always false). - */ - crumbs: DirectoryEntry[] - /** Direct child directories, name-sorted; symlinks to directories included. */ - entries: DirectoryEntry[] - /** - * True when the backend cut `entries` at its complete-result bound: the - * level has more child directories than reported, and the missing rows are - * the name-sorted tail (hidden rows count toward the bound). - */ - truncated: boolean -} - /** * The browse interaction: listing/creation primitives an in-app browser * drives one level at a time. Works for remote clients — nothing renders on diff --git a/packages/host/directory-picker/src/types.ts b/packages/host/directory-picker/src/types.ts new file mode 100644 index 0000000000..db1dda57db --- /dev/null +++ b/packages/host/directory-picker/src/types.ts @@ -0,0 +1,39 @@ +/** + * Client-safe type surface of the directory-picking seam: what one browse level + * looks like to a caller. Types only — no runtime code, and nothing here reaches + * a Host-only symbol, so a Client compilation face reads exactly the signatures + * the Host emits. + * + * @module @deepseek-ai/dsh-host-directory-picker/types + */ + +/** One directory row: a listing child or a breadcrumb ancestor. */ +export interface DirectoryEntry { + /** Base name shown in a browser row (a root crumb carries its full path). */ + name: string + /** Absolute host path — clients never join path segments themselves. */ + path: string + /** Hidden by the host platform's convention (dot-prefixed on POSIX); the client owns whether to show it. */ + hidden: boolean +} + +/** One directory level plus its ancestry, as a browse backend reports it. */ +export interface DirectoryListing { + /** Absolute path of the listed directory. */ + path: string + /** The host account's home directory (breadcrumb "Home" rooting). */ + home: string + /** + * Ancestor chain from the filesystem root to the listed directory + * inclusive; every crumb is a jump target (crumb `hidden` is always false). + */ + crumbs: DirectoryEntry[] + /** Direct child directories, name-sorted; symlinks to directories included. */ + entries: DirectoryEntry[] + /** + * True when the backend cut `entries` at its complete-result bound: the + * level has more child directories than reported, and the missing rows are + * the name-sorted tail (hidden rows count toward the bound). + */ + truncated: boolean +}