import type { Runtime } from '../../runtime/base.ts'; import type { VFSRuntime } from '../../runtime/table.ts'; import type { FileCache } from '../../cache/file/mixin.ts'; import { type Resource } from '../../resource/base.ts'; import { Decisions, Policies } from '../../policy/index.ts'; import { type Limit, ConsistencyPolicy, MountMode, PathSpec } from '../../types.ts'; import { CLIRegistry } from '../cli/registry.ts'; import { MountEntry } from './mount.ts'; interface ReadReconciler { reconcileRead(mount: MountEntry, path: string): Promise; } export declare const DEV_PREFIX = "/dev/"; export declare class MountCommandUnsupported extends Error { readonly cmdName: string; readonly backend: string; readonly operand: string; constructor(cmdName: string, backend: string, operand: string); } export interface OpsMountInfo { prefix: string; resourceType: string; mode: MountMode; } export declare class MountRegistry { private readonly mountList; private rootRef; private consistency; private readonly defaultMode; private cacheStore; private reconciler; vfsRuntime: VFSRuntime | null; runtimeEntries: readonly Runtime[]; readonly policies: Policies; decisions: Decisions; readonly clis: CLIRegistry; setReconciler(reconciler: ReadReconciler): void; /** * Attach the workspace file cache and build per-mount CacheManagers. * Called once by Workspace after the cache store exists; mounts * added later get their manager in `mount()`. The cache is a hidden * store, never a mount. */ attachFileCache(cache: FileCache | null): void; private attachManager; constructor(resources: Record, defaultMode: MountMode, modeOverrides?: Record); setConsistency(consistency: ConsistencyPolicy): void; getConsistency(): ConsistencyPolicy; /** * Add a mount dynamically. Mirrors Python's `registry.mount(...)`. * Registers the resource's commands and ops on the new mount and * re-sorts mounts by prefix length (longest first). */ mount(prefix: string, resource: Resource, mode?: MountMode, consistency?: ConsistencyPolicy): MountEntry; /** * Remove a mount by exact prefix. Mirrors Python's `registry.unmount(...)`. * Per-mount commands and ops live on the Mount instance and die with it. * The /dev/ mount is reserved and cannot be removed. */ unmount(prefix: string): MountEntry; /** * The mount at exactly this prefix; throws noMount for none. Callers * that expect the miss branch on `tryMountForPrefix` returning null. */ mountForPrefix(prefix: string): MountEntry; /** The mount at exactly this prefix, or null when none matches. */ tryMountForPrefix(prefix: string): MountEntry | null; /** * One mount's configured cap for a command or op name. The lookup * OutputCapPolicy is seeded with; tolerant of a prefix that matches * no mount (unmounted between stamp and boundary) by answering null. */ limitOverride(prefix: string, name: string): Limit | null; isMountRoot(path: string): boolean; descendantMounts(path: string): MountEntry[]; mountPrefixes(): string[]; opsMounts(): OpsMountInfo[]; findResourceByName(resourceName: string | null): Resource | null; getResourceType(path: string | null): string | null; groupByMount(paths: readonly string[]): [MountEntry, string[]][]; get rootMount(): MountEntry | null; get fileCache(): FileCache | null; resolve(path: string): [Resource, PathSpec, MountMode]; /** * The mount that handles this path; throws noMount for none. * * The lookup contract pair: `mountFor` is for callers whose path must * be mounted (a miss is a broken invariant and propagates as a typed * noMount error), `tryMountFor` is for callers with a real fallback * for the miss. Never catch around this method — call the try variant * instead. */ mountFor(path: string): MountEntry; /** The mount that handles this path, or null when none does. */ tryMountFor(path: string): MountEntry | null; allMounts(): readonly MountEntry[]; isExecAllowed(): boolean; /** * Whether code may be loaded from this path: the per-script form of * `isExecAllowed`, read by an interpreter running a file operand * (`python3 path.py`, `bash script.sh`). */ execAllowedAt: (virtual: string) => boolean; mountForCommand(cmdName: string): MountEntry | null; /** * How many leading words form a registered command name. Command names * may span several words ("gws docs documents get"), git-style. A nested * name resolves from anywhere its owning mount is reachable, so this * scans every mount (mirroring mountForCommand) and returns the longest * prefix any mount recognises, or 1 (bare first token) when none does. */ matchCommandPrefix(words: string[]): number; resolveMount(cmdName: string, pathScopes: readonly PathSpec[], cwd: string): Promise; } export {}; //# sourceMappingURL=registry.d.ts.map