UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

41 lines • 2.82 kB
import type { RedirectResult } from '../../../../context/session_context.ts'; import type { DispatchFn } from '../../../../runtime/types.ts'; import { PathSpec } from '../../../../types.ts'; import type { FollowOperands, NamespaceLinks } from '../../../../view/types.ts'; export declare const logger: { debug?: (message: string) => void; }; export declare function posixRelative(target: string, startDir: string): string; export declare function followPaths(links: NamespaceLinks, items: (string | PathSpec)[], followLast?: boolean, slashFollows?: boolean): (string | PathSpec)[]; export declare function acceptsLine(name: string, args: readonly string[], items: (string | PathSpec)[], cwd: string): boolean; export declare function stripLinkOperands(name: string, dispatch: DispatchFn, links: NamespaceLinks, items: (string | PathSpec)[], args: readonly string[], cwd: string): Promise<[(string | PathSpec)[], number, string[]]>; /** * Resolve each command-line link that leads to a directory: GNU ls's default * for command-line operands (measured on coreutils 9.7). `ls dlink` lists the * directory, while `ls flink` and a dangling `ls dang` report the link itself, * and so does a loop, whose target cannot be reached. * Where a link leads takes a stat through the dispatcher to know, since the target * may live on any mount, so this runs after `followPaths` has resolved every * operand's prefix. Mirrors Python's follow_directory_links. */ export declare function followDirectoryLinks(links: NamespaceLinks, dispatch: DispatchFn, items: readonly (string | PathSpec)[]): Promise<(string | PathSpec)[]>; /** * The pathname resolution a line gives its operands, as one call. * * What the kernel does to a path before the syscall: every component but the * last resolves for every command, and the last for a command that follows * (open(2) rather than lstat(2)) or an operand typed with a trailing slash; * ls resolves a command-line link only once a stat has shown that it leads to * a directory. The router runs it over the typed operands, and a command's glob * over the names a pattern matched, which bash would have put on the line as * words, so a link a glob matched resolves as the same name typed would. * Mirrors Python's operand_follow. */ export declare function operandFollow(links: NamespaceLinks, dispatch: DispatchFn, name: string, words: readonly (string | PathSpec)[], cwd: string): FollowOperands; export interface PreparedMv { items: (string | PathSpec)[]; early: RedirectResult | null; } /** Resolve the destination directory without transferring any source. */ export declare function prepareMv(links: NamespaceLinks, dispatch: DispatchFn, items: (string | PathSpec)[], args: readonly string[], cwd: string): Promise<PreparedMv>; //# sourceMappingURL=links.d.ts.map