import { z } from 'zod'; import { A as AppSource } from './app-registry-DtUAlxkN.js'; import '@agentproto/app'; /** * Remote sources for `app_install` / `app_resync`: git URLs and `.agentapp` * bundles (URL or local file). Pure staging + swap — no registry, no * validation: `app-tools.ts` runs `performInstall` on whatever this hands * back, so the same manifest checks apply to every source. * * Remote-installed apps live under `/` (the daemon state dir's * `apps/`), never in the user's cwd. A (re)install stages into a hidden * sibling temp dir first and swaps it in, so a failed clone / digest mismatch * / manifest error leaves the previous install untouched. */ declare const DOWNLOAD_TIMEOUT_MS = 30000; declare const DOWNLOAD_MAX_BYTES: number; /** `app_install` input: exactly one of `{dir}` | `{url, ref?, subdir?, sha?, sha256?, allowBuild?}` | `{file, sha256?}`. */ declare const appInstallInputSchema: z.ZodUnion; repoint: z.ZodOptional; }, z.core.$strict>, z.ZodObject<{ url: z.ZodString; ref: z.ZodOptional; subdir: z.ZodOptional; sha: z.ZodOptional; sha256: z.ZodOptional; allowBuild: z.ZodOptional; catalogUrl: z.ZodOptional; dataDir: z.ZodOptional; }, z.core.$strict>, z.ZodObject<{ file: z.ZodString; sha256: z.ZodOptional; catalogUrl: z.ZodOptional; dataDir: z.ZodOptional; }, z.core.$strict>]>; type AppInstallInput = z.infer; declare const APP_INSTALL_EXCLUSIVE_ERROR: string; /** A `{url}` ending in `.agentapp` (ignoring query/fragment) is a bundle, anything else is git. */ declare function isAgentappUrl(url: string): boolean; interface StagedApp { /** Directory name under `appsDir` the staged tree will be swapped into. */ readonly slug: string; /** Hidden sibling of the final dir holding the staged tree. */ readonly tmpDir: string; /** Path of the app dir inside the staged tree (`subdir` for git, `""` otherwise). */ readonly subdir: string; readonly source: AppSource; /** Remove the staged tree (idempotent) — call when the stage is not swapped in. */ discard(): Promise; } /** `[-]` — repo name is the URL's last path segment minus `.git`. */ declare function gitSlug(url: string, subdir?: string): string; /** Shallow-clone `url` into a temp sibling of `/` and pin the commit. */ declare function stageGitApp(input: { appsDir: string; url: string; ref?: string; subdir?: string; expectedSha?: string; }): Promise; /** Stream `url` (http(s):// or file://) to `destFile` under the timeout + size * cap. Exported for `agentproto catalog verify`, which applies the same * download caps as `app_install`. */ declare function downloadTo(url: string, destFile: string): Promise; /** * Fetch (or read) a `.agentapp`, verify + unpack it into a temp sibling of * `/`. A digest mismatch (or any unpack refusal) throws and * leaves nothing behind. */ declare function stageAgentApp(input: { appsDir: string; url?: string; file?: string; expectedSha256?: string; }): Promise; interface AppSwap { /** Drop the previous tree — the new one is final. */ commit(): Promise; /** Put the previous tree (and its data) back, discarding the new one. */ rollback(): Promise; } /** * Swap the staged tree in at `target`, keeping the previous tree aside until * the caller commits. When the previous install's `dataDir` lived inside the * old tree (the `/data` default), it is carried into the new tree so a * re-install never loses app data. */ declare function swapInStaged(input: { tmpDir: string; target: string; previousDataDir?: string; }): Promise; /** The commit `url`'s `ref` (default `HEAD`) currently points at, via `git ls-remote`. */ declare function remoteGitSha(url: string, ref?: string): Promise; export { APP_INSTALL_EXCLUSIVE_ERROR, type AppInstallInput, type AppSwap, DOWNLOAD_MAX_BYTES, DOWNLOAD_TIMEOUT_MS, type StagedApp, appInstallInputSchema, downloadTo, gitSlug, isAgentappUrl, remoteGitSha, stageAgentApp, stageGitApp, swapInStaged };