/** * Folder navigation primitives for the tool-organization tree — shared by the tools * screen and the flows page so both explore, breadcrumb, and re-file against * one identical set of controls. * * The tree is passed FLAT (a {@link Folder} list keyed by `id`, each naming its * `parentId`); these helpers derive the current directory, the breadcrumb path, and * the indented picker options from it. Every derivation is cycle-SAFE: a malformed * parent chain (a loop, a dangling parent) is bounded by the folder count rather than * looping forever — bad data degrades to a truncated path, never a hang. * * `FolderPicker` carries inline new-folder creation, so a folder can be created from * BOTH consuming screens through this one component — never a flows-page-only * affordance. */ import { type ReactNode } from 'react'; /** A folder in the tree, in the SDK's camelCase UI shape (`parentId`, `null` = root). */ export interface Folder { readonly id: string; readonly name: string; readonly parentId: string | null; } /** The subfolders directly under `parentId` (`null` = the root directory), name-sorted. */ export declare function childFolders(folders: readonly Folder[], parentId: string | null): Folder[]; /** * The ordered ancestor path from the root down to (and including) `folderId`, for a * breadcrumb. `null` is the root (an empty path). The walk is bounded by the folder * count, so a cyclic or dangling chain truncates instead of looping. */ export declare function folderPathTo(folders: readonly Folder[], folderId: string | null): Folder[]; export interface FolderBreadcrumbProps { readonly folders: readonly Folder[]; readonly currentFolderId: string | null; readonly onNavigate: (folderId: string | null) => void; /** The root crumb's label (e.g. "All tools"). */ readonly rootLabel: string; } /** The root → … → current path; each crumb navigates to that level. */ export declare function FolderBreadcrumb({ folders, currentFolderId, onNavigate, rootLabel, }: FolderBreadcrumbProps): ReactNode; export interface FolderRowProps { readonly folder: Folder; readonly onOpen: (folderId: string) => void; } /** One subfolder in the current-directory explorer; opening it navigates inward. */ export declare function FolderRow({ folder, onOpen }: FolderRowProps): ReactNode; export interface FolderPickerProps { /** The chosen folder id, or `null` for unfiled. */ readonly value: string | null; readonly onChange: (folderId: string | null) => void; readonly folders: readonly Folder[]; /** * Create a folder under `parentId` (the current selection) and resolve with its * id; the picker selects it. Rejection is the caller's to surface — the picker * leaves the draft in place so the operator can retry. */ readonly onCreateFolder: (name: string, parentId: string | null) => Promise; readonly disabled?: boolean; /** The unfiled option's label (e.g. "No folder"). */ readonly unfiledLabel: string; } /** A folder chooser with inline new-folder creation, for the edit / move dialogs. */ export declare function FolderPicker({ value, onChange, folders, onCreateFolder, disabled, unfiledLabel, }: FolderPickerProps): ReactNode; //# sourceMappingURL=folder-nav.d.ts.map