@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
52 lines • 2.33 kB
TypeScript
import type { LinkChildrenSource, PrefixSource } from './types.ts';
/**
* The name-plane questions a runtime asks about the workspace.
*
* What a runtime holds instead of a flat prefix listing: the questions
* routing and listing ever ask (what mounts exist, which one owns a
* path, which names in a directory are links), answered by whoever
* owns the tables so a consumer never re-implements the longest-prefix
* rule or reaches for a link table it cannot import. Answers use the
* table's own prefix spelling; a surface with a spelling convention of
* its own (`RuntimeFiles`) re-spells on its side of the seam.
*/
export interface MountResolver {
/** The live mount prefixes, in the table's own spelling. */
prefixes(): string[];
/** The prefix owning `path` by longest match, or null. */
ownerOf(path: string): string | null;
/**
* The names of the symlinks in the directory `directory` names.
*
* Per directory, not per path, because a listing is where the answer
* is needed and one table read serves every entry in it; asked per
* entry it would be a readlink apiece for a fact the name plane can
* hand over whole. Answers for the directory the path *names*,
* resolving a link the way the listing itself is resolved, so a
* listing through an alias is marked from the directory it actually
* read.
*/
linkChildren(directory: string): Set<string>;
}
/**
* A MountResolver over a live prefix listing.
*
* The one concrete resolver: the workspace wraps whatever view it
* wants a consumer to have (a sandbox-filtered list for the runtimes)
* and the matching rule stays `ownerPrefix`'s. Reads its sources per
* call, so mounts and links added or removed after construction are
* always picked up.
*
* The link source is optional and answers nothing when absent, which
* is right for a resolver built outside a workspace: there is no node
* table, so no name can be a link.
*/
export declare class PrefixResolver implements MountResolver {
private readonly source;
private readonly links;
constructor(source: PrefixSource, links?: LinkChildrenSource | null);
prefixes(): string[];
ownerOf(path: string): string | null;
linkChildren(directory: string): Set<string>;
}
//# sourceMappingURL=resolver.d.ts.map