UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

139 lines • 5.24 kB
import { z } from 'zod'; import type { FileStat } from '../../types.ts'; import type { ConfigOf } from '../../vfs/secrets.ts'; export declare const LookupStatus: Readonly<{ readonly EXPIRED: "expired"; readonly NOT_FOUND: "not_found"; }>; export type LookupStatus = (typeof LookupStatus)[keyof typeof LookupStatus]; export declare const IndexType: Readonly<{ readonly RAM: "ram"; readonly REDIS: "redis"; }>; export type IndexType = (typeof IndexType)[keyof typeof IndexType]; /** * The wire form of a stat row: what pydantic writes for the Python * `FileStat`, which `JSON.stringify` of a `FileStat` already matches field * for field and in order. */ export declare const FileStatWireSchema: z.ZodObject<{ name: z.ZodString; size: z.ZodDefault<z.ZodNullable<z.ZodNumber>>; modified: z.ZodDefault<z.ZodNullable<z.ZodString>>; fingerprint: z.ZodDefault<z.ZodNullable<z.ZodString>>; revision: z.ZodDefault<z.ZodNullable<z.ZodString>>; type: z.ZodEnum<{ file: "file"; directory: "directory"; symlink: "symlink"; char_device: "char_device"; block_device: "block_device"; fifo: "fifo"; socket: "socket"; }>; content: z.ZodDefault<z.ZodNullable<z.ZodEnum<{ text: "text"; binary: "binary"; json: "json"; csv: "csv"; "image/png": "image/png"; "image/jpeg": "image/jpeg"; "image/gif": "image/gif"; "application/zip": "application/zip"; "application/gzip": "application/gzip"; "application/pdf": "application/pdf"; }>>>; mode: z.ZodDefault<z.ZodNullable<z.ZodNumber>>; uid: z.ZodDefault<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>; gid: z.ZodDefault<z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>; atime: z.ZodDefault<z.ZodNullable<z.ZodString>>; ctime: z.ZodDefault<z.ZodNullable<z.ZodString>>; birthtime: z.ZodDefault<z.ZodNullable<z.ZodString>>; dev: z.ZodDefault<z.ZodNullable<z.ZodNumber>>; extra: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>; }, z.core.$strip>; /** * A child a complete re-list no longer names. `folder` says whether it held * a listing or was typed a folder, so cleanup takes everything beneath it. */ export interface Evicted { readonly path: string; readonly folder: boolean; } /** How a complete listing is written. */ export interface SetDirOptions { /** * The entries are a capped window (the newest N messages, the last N * days): served as the listing, but they prove nothing absent. */ readonly window?: boolean; /** Nested mount roots whose rows and descendants must survive. */ readonly excluded?: readonly string[]; /** * The backend version the listing was read at. It replaces the stored * one, and null or unset clears it. */ readonly version?: string | null; } /** Entry rows and directory children from one refill. */ export interface IndexSnapshot { readonly entries: ReadonlyMap<string, FileStat>; readonly children: ReadonlyMap<string, readonly string[]>; /** The backend version the rows were read at, or null. */ readonly version?: string | null; } export interface LookupResult { /** The row at the path. */ entry?: FileStat | null; status?: LookupStatus | null; } export interface ListResult { entries?: string[] | null; partialEntries?: string[] | null; status?: LookupStatus | null; version?: string | null; window?: boolean; } /** The directory row, the twin of the pydantic `IndexDirectory`. */ export declare const IndexDirectory: z.ZodObject<{ entries: z.ZodArray<z.ZodString>; folders: z.ZodArray<z.ZodNumber>; expires_at: z.ZodNumber; generation: z.ZodString; partial: z.ZodDefault<z.ZodBoolean>; version: z.ZodDefault<z.ZodNullable<z.ZodString>>; window: z.ZodDefault<z.ZodBoolean>; }, z.core.$strip>; export type IndexDirectory = z.output<typeof IndexDirectory>; declare const IndexConfig: z.ZodObject<{ type: z.ZodOptional<z.ZodEnum<Readonly<{ readonly RAM: "ram"; readonly REDIS: "redis"; }>>>; ttl: z.ZodOptional<z.ZodNumber>; }, z.core.$strip>; declare const RedisIndexConfig: z.ZodObject<{ type: z.ZodOptional<z.ZodEnum<Readonly<{ readonly RAM: "ram"; readonly REDIS: "redis"; }>>>; ttl: z.ZodOptional<z.ZodNumber>; url: z.ZodOptional<z.ZodString>; keyPrefix: z.ZodOptional<z.ZodString>; }, z.core.$strip>; export type IndexConfig = ConfigOf<typeof IndexConfig>; export type RedisIndexConfig = ConfigOf<typeof RedisIndexConfig>; /** * Check an index config the way python's `IndexConfig` checks one on * construction, and camelize its keys. * * The fields are picked by `type`, where python picks them by class, since * a TS config has no class to pick by. One field named in both spellings is * refused, as python refuses the camelCase one. * * @param config the index config as the caller passed it. * @returns the checked config with every key in its camelCase spelling. */ export declare function normalizeIndexConfig(config: IndexConfig): IndexConfig; export {}; //# sourceMappingURL=config.d.ts.map