/** * @file Generic "venv-install tier" for external-tools resolvers. Parallel to * `from-download.ts` — that one handles single-binary tools downloaded as * GitHub release assets; this one handles Python packages installed into a * single-purpose venv. Per-tool resolvers such as skillspector and future * Python CLIs compose their fourth tier on top of these helpers. Two helpers: * * - `createPipVenv` — `python -m venv ` + `pip install `. * Idempotent: hits the existing venv when its entry-point already exists. * Stops at "venv created, entry-point present." * - `findPython` — locates `python3` (or `python` on Windows) on PATH. Returns * the absolute path or `undefined` when no Python is available. What this * does NOT do: * - Decide where the venv lives. The caller picks the cache dir (typically * under `getSocketDlxDir()`); we just create the venv there. * - Verify package integrity beyond pip's own wheel-hash mechanism. Pinning is * the caller's responsibility: pass exact-version `==` or git-SHA * `git+...@`. * - Re-resolve when the cache is stale. The cache key is derived by the caller * from the install spec; a re-pin produces a new dir. */ export interface CreatePipVenvOptions { /** * Absolute path to the venv directory. Created if missing; reused if the * entry-point already exists inside it. */ readonly cacheDir: string; /** * Name of the entry-point executable. Matches the package's * `[project.scripts]` key, which is often the package name itself. */ readonly entryPoint: string; /** * Pip-install argument — either a PyPI exact pin `==` or a * git-SHA pin `git+@`. Anything else is rejected. */ readonly installSpec: string; /** * Optional override for the Python interpreter. Defaults to * {@link findPython}. */ readonly python?: string | undefined; } export interface CreatePipVenvResult { /** * Absolute path to the entry-point binary inside the venv. Always set when * `created` or the cache was already populated. */ readonly entryPointPath: string; /** * `true` when this call created the venv and ran pip install; `false` when * the existing cache was reused. */ readonly created: boolean; } /** * Create or reuse a venv at `cacheDir` and pip-install `installSpec` into it. * Returns the entry-point path + a `created` flag. Throws when: * * - No Python interpreter is on PATH (and none was passed via `python`). * - `python -m venv` fails. * - `pip install` fails. * - The install succeeded but the entry-point was not created (caller passed a * wrong `entryPoint` name, or the package has no console script). */ export declare function createPipVenv(options: CreatePipVenvOptions): Promise; /** * Locate a Python interpreter. Prefer `python3` on macOS/Linux, fall back to * `python`, the Windows convention. Returns `undefined` when neither is on * PATH. */ export declare function findPython(): Promise; export declare function pipVenvEntryPointPath(venvDir: string, entryPoint: string): string;