UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

56 lines • 2.81 kB
import { Effect, Target, type VfsCall } from './types.ts'; /** The method that answers the dispatcher's `name`. */ export declare function methodName(name: string): string; /** * Make a VFS method callable by name through the dispatcher. * * `ws.dispatch('search_abc', path)` reaches a method marked here through * every check the dispatcher runs: hidden paths, path rules, the mount's mode and * admission policies. The effect tells the dispatcher what the call does to the * mount, so a read-only mount refuses a write and a policy judges it as one. * A subclass overriding a marked method keeps the mark, so a backend writes * its `read` without repeating it. * * The built-in functions' marks are where the dispatcher's op classes come from: * which ops follow a link, create a name, run one at a time per path or stamp * an mtime is read off what they declare here. REMOVE belongs to `unlink`, * `rmdir` and `rm_r`, RENAME to `rename` and COPY to `copy` and `dir_copy`: * what the dispatcher does around them (a link removed rather than followed, a * rename refused when it would bring hidden entries into view, the links and * cache below a moved, removed or copied directory) is keyed on those names, * so another function declaring one is refused. A VFS that deletes, moves or * copies defines those functions. `target` is the kind of entry the path names * (any when omitted), `creates` marks a WRITE that makes a missing file, as * open(2) with O_CREAT, and `subtree` a call that reaches everything below its * paths. Mirrors Python's `vfs_call`. */ export declare function vfsCall(options: { effect: Effect; target?: Target; creates?: boolean; subtree?: boolean; }): (method: (...args: never[]) => unknown, context: ClassMethodDecoratorContext) => void; /** * What `cls` declares for `name`, null when not dispatchable. The first class * up the prototype chain that marks `name` answers, so an unmarked override * inherits its base's mark. Mirrors Python's `declared`. */ export declare function declared(cls: { readonly prototype: unknown; }, name: string): VfsCall | null; /** Every name `cls` marks dispatchable, to what it declares. Mirrors Python's `declared_calls`. */ export declare function declaredCalls(cls: { readonly prototype: unknown; }): Map<string, VfsCall>; /** * The names in `calls` whose declaration matches every filter: the effects * and targets to keep (all when omitted), and `creates` to keep only * creating (true) or only non-creating (false) calls. Mirrors Python's * `call_names`. */ export declare function callNames(calls: ReadonlyMap<string, VfsCall>, filter?: { effects?: readonly Effect[]; targets?: readonly Target[]; creates?: boolean; }): ReadonlySet<string>; //# sourceMappingURL=call.d.ts.map