UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

42 lines • 2.51 kB
import type { NamespaceLinks, SessionAccess } from '../../view/types.ts'; import type { DispatchFn } from '../../runtime/types.ts'; import { PathSpec } from '../../types.ts'; import type { MountEntry } from '../mount/mount.ts'; import type { MountRegistry } from '../mount/registry.ts'; import type { SessionState } from '../session/session.ts'; export interface GlobOptions { access?: SessionAccess; nullglob: boolean; failglob: boolean; globstar: boolean; extglob: boolean; } /** Whether a mount command's glob must expand here rather than push * down: the backend knows none of these. */ export declare function globNeedsShell(opts: GlobOptions): boolean; export declare function globOptions(session: SessionState): GlobOptions; /** * Expand pattern specs on one mount, one at a time, through the dispatcher's * listing and stat, refused past `limit` matches (-1 for any). A mount that * lists nothing, or no dispatcher (a registry no workspace wired one into), * leaves every word as typed. Each word is keyed below the mount before the * walk reads it. Mirrors Python's expand_glob. */ export declare function expandGlob(dispatch: DispatchFn | null, mount: MountEntry, paths: readonly PathSpec[], limit: number, access?: SessionAccess): Promise<PathSpec[]>; export declare function resolveGlobs(classified: readonly (string | PathSpec)[], registry: MountRegistry, noglob?: boolean, links?: NamespaceLinks | null, options?: GlobOptions | null): Promise<(string | PathSpec)[]>; /** * Expand glob words that could match across a mount boundary. * * A glob operand is normally left for the owning backend to resolve, * which is how a prefix store pushes the listing down. That only holds * while every match belongs to that backend: a nested mount's root is a * child of the directory but its keys live in another VFS, so the * backend answers "no such file" for a name its own listing shows. When * the glob's fixed head holds a child mount, the word is expanded here * instead, before routing, so the matches route per mount exactly as the * same paths typed by hand already do. Every other glob is left * untouched, so pushdown is unaffected, and so is a word the shell already * resolved: a glob that matched nothing stays as typed. */ export declare function expandBoundaryGlobs(parts: readonly (string | PathSpec)[], registry: MountRegistry, links: NamespaceLinks | null, access?: SessionAccess): Promise<(string | PathSpec)[]>; //# sourceMappingURL=globs.d.ts.map