@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
47 lines • 2.3 kB
TypeScript
import type { util } from 'zod';
import type { AdmissionRules, CommandRule } from '../policy/types.ts';
import type { MountMode, ProcessScope, Visibility } from '../types.ts';
import type { LinkStep } from '../utils/path.ts';
export type Wire = Record<string, util.JSONType>;
/**
* A profile's rules and visibility, compiled once by mirage-rs's `policy`
* stream and asked one request at a time. Mirrors Python's PolicyMatcher.
*/
export declare class PolicyMatcher {
private readonly stream;
constructor(config: Readonly<Wire>);
/** The answer to one request, decoded from its JSON; text travels as code points. */
ask(op: string, args?: Readonly<Wire>): unknown;
}
/** One rule in the stream's wire shape. Mirrors Python's rule_wire. */
export declare function ruleWire(rule: CommandRule): Wire;
/** A rule set in the stream's wire shape. Mirrors Python's rules_wire. */
export declare function rulesWire(rules: Partial<AdmissionRules>): Wire;
/** A session's visibility in the stream's wire shape. Mirrors Python's visibility_wire. */
export declare function visibilityWire(vis: Visibility): Wire;
/** A compiled visibility from the stream's wire shape. Mirrors Python's visibility_from. */
export declare function visibilityFrom(value: {
readonly hidden: {
readonly paths: number[][];
readonly patterns: number[][];
};
readonly shown: readonly {
readonly path: number[];
readonly mode: MountMode | null;
}[];
readonly vars: {
readonly names: number[][];
readonly patterns: number[][];
};
}, processes?: ProcessScope): Visibility;
/** A symlink walk's steps in the stream's wire shape. Mirrors Python's link_trace_wire. */
export declare function linkTraceWire(trace: readonly LinkStep[]): util.JSONType[];
/**
* The compiled matcher for a rule set, shared by every caller asking the
* same; null answers the requests no profile scopes. Mirrors Python's
* admission_matcher.
*/
export declare function admissionMatcher(rules: AdmissionRules | null): PolicyMatcher;
/** The compiled matcher for a visibility, shared by every caller asking the same. Mirrors Python's visibility_matcher. */
export declare function visibilityMatcher(vis: Visibility | null): PolicyMatcher;
//# sourceMappingURL=policy.d.ts.map