import type { MontyBindingBits } from './binding.ts'; import type { MontyVFS } from './vfs.ts'; /** * Monty's OS door, serving the guest's `os` and `pathlib` calls. * * This is monty's tier of the interception taxonomy: the binding calls * one host callback per operation and takes back a value (or a promise * of one) or NOT_HANDLED, which the sandbox raises as the call's * default refusal. That is the whole seam — the JS binding has no tree * of its own, unlike the python binding's `OSAccess` — so this side * carries both halves itself: a path under a mount answers through * `MontyVFS`, and a path under no mount answers from a per-run * `ScratchTree`, so `/tmp` really does behave like `/tmp` on both * hosts. Declining is reserved for what neither half can serve: an * operation this door does not implement, and `Path.stat` (see the * note at that case). * * Args: * binding: the loaded binding's door pieces (NOT_HANDLED sentinel * and the MontyFileHandle an `open` answer must be). * env: the run's environment, readable both ways python's monty * spells it (`os.getenv` and `os.environ`). * vfs: the mount view, or null when no workspace is attached. */ export declare class MirageOSAccess { private readonly notHandled; private readonly fileHandle; private readonly env; private readonly vfs; private readonly tree; private readonly bases; constructor(binding: MontyBindingBits, env: Record, vfs: MontyVFS | null); readonly handle: (name: string, args: unknown[], kwargs?: Record) => unknown; /** A path some mount serves: every answer is the workspace's. */ private mountedOp; /** A path no mount serves: the guest's scratch space, answered from the tree. */ private scratchOp; /** * Whether the workspace can list `path` even though no mount claims * it: the root of a workspace with nested mounts is the everyday * case. Python's tree answers exists/is_dir the same way, by trying * the listing. */ private remoteIsDir; /** * List a scratch directory, folding in whatever the workspace can * list under the same name — `iterdir('/')` must show the mount * roots beside the guest's own scratch entries, as python's merged * listing does. A path neither side can list raises the tree's own * FileNotFoundError. */ private scratchIterdir; private openMounted; /** * Extend a mounted file by `data`, shipping only the delta. * * Monty hands an append handler the new text alone; the running * whole rides beside it so a mount without an append op falls back * to one write instead of failing (python keeps the same running * content in its tree). The return is python's: characters for * text, bytes for bytes. */ private appendMounted; /** * Create a mounted directory, keeping pathlib's flags: `parents` * rides through to the backend op, which takes it; `exist_ok` is * answered here, since the op has no such argument and backends * differ on whether creating an existing directory raises at all. * `exist_ok` forgives an existing directory only — a file at the * target still raises, pathlib's own rule. */ private mkdirMounted; } //# sourceMappingURL=osaccess.d.ts.map