import { z } from 'zod'; import { A as AppSource } from './app-registry-DtUAlxkN.js'; import '@agentproto/app'; /** * App catalog — a static, hand-curated `~/.agentproto/app-catalog.json` * listing apps a user could `app_install`, independent of whether any are * installed yet, plus optional remote catalog `sources` (each an HTTP URL * returning `{ entries: AppCatalogEntry[] }`). Read-only from the daemon's * side; `app_catalog` (app-tools.ts) merges local entries, remote entries and * `AppRegistry.listApps()` to report installed/hasUi status. * * Sources (see `resolveCatalogSources`): the default public catalog * (`DEFAULT_CATALOG_SOURCE_URL`, config `catalog.defaultSource`) comes * first, then config `catalog.sources` — which win over (replace) `sources` * in the catalog file when set. Extra sources ADD to the default one. Remote * catalogs follow the `app-catalog/v1` format; the last good copy of each is * cached on disk so `app_catalog` keeps working offline. */ type AppPlacement = "local" | "box" | "any" | "split"; type AppCatalogTier = "git" | "bundle" | "hosted"; interface AppCatalogLicense { kind: "free" | "paid" | "private"; url?: string; } /** A store-page screenshot (`app-catalog/v1` listing fields). */ interface AppCatalogScreenshot { url: string; alt: string; width?: number; height?: number; } interface AppCatalogRequires { browser?: boolean; fs?: boolean; secrets?: string[]; } /** Remote catalog entry (`app-catalog/v1`). `source` lets a store call * `app_install {url, ref, subdir, sha}` (git) or `app_install {url, sha256}` * (`.agentapp`). Every field but `appId` + `source` is optional, so * pre-v1 catalogs (`{ entries }` only) keep validating. */ interface AppCatalogEntry { appId: string; name?: string; description?: string; category?: string; source: AppSource; placement?: AppPlacement; icon?: string; version?: string; tier?: AppCatalogTier; publisher?: string; /** https URL of the publisher (their site), rendered as the publisher link. */ publisherUrl?: string; license?: AppCatalogLicense; minAgentprotoVersion?: string; requires?: AppCatalogRequires; featured?: boolean; /** Listing fields for a store page (agentproto.sh/apps/, the * daemon's /store). Shapes only here; `agentproto app pack --entry` and * `agentproto catalog verify` enforce the limits (CATALOG_LISTING_LIMITS). */ tagline?: string; /** Markdown (CommonMark + GFM); raw HTML is not rendered by consumers. */ longDescription?: string; screenshots?: AppCatalogScreenshot[]; /** Multi-valued successor of `category` (both are read). */ categories?: string[]; homepage?: string; repository?: string; } /** Limits on the listing fields, enforced when an entry is produced * (`app pack --entry`) and checked before it is published (`catalog * verify`). The runtime schema stays shape-only so an older daemon never * drops an entry over a limit change. */ declare const CATALOG_LISTING_LIMITS: { readonly taglineMaxChars: 120; readonly longDescriptionMaxChars: 20000; readonly screenshotsMax: 8; readonly screenshotMaxBytes: 1000000; readonly iconMaxBytes: 256000; readonly altMaxChars: 200; readonly categoriesMax: 5; readonly categoryPattern: RegExp; }; /** Entry of the local `app-catalog.json` `apps` array: a directory on disk. */ interface AppCatalogFileEntry { readonly appId: string; readonly name?: string; readonly description?: string; readonly dir: string; readonly category?: string; } interface AppCatalogSource { readonly url: string; } interface AppCatalogFile { readonly apps: readonly AppCatalogFileEntry[]; readonly sources?: readonly AppCatalogSource[]; } declare const AppCatalogEntrySchema: z.ZodType; /** `schema` tag of a v1 catalog document. */ declare const CATALOG_SCHEMA_V1 = "app-catalog/v1"; /** * Default public catalog, queried by `app_catalog` unless config * `catalog.defaultSource` is `false` (a URL string replaces it). The file is * a static `apps.json` served by the agentproto/site repo * (`public/catalog/v1/apps.json`). Bundles it references are GitHub Release * assets of the public `agentproto/apps` repo. A failing default source is * never fatal: `app_catalog` falls back to the last good copy cached on * disk, then to the embedded first-party list (`first-party-catalog.ts`). */ declare const DEFAULT_CATALOG_SOURCE_URL = "https://agentproto.sh/catalog/v1/apps.json"; declare function defaultAppCatalogPath(): string; /** * Read + parse the catalog file at `path` (default `~/.agentproto/app-catalog.json`). * Tolerates a missing file (returns an empty catalog) and a malformed one * (unreadable JSON, non-array `apps`, entries missing `appId`/`dir`, and * `sources` without a string `url` are dropped) — never throws. */ declare function loadAppCatalogFile(path?: string): Promise; type CatalogSourceOrigin = "default" | "config" | "file"; interface ResolvedCatalogSource extends AppCatalogSource { readonly origin: CatalogSourceOrigin; } /** * Remote sources `app_catalog` queries, in precedence order (first wins on * an `appId` collision): the default source (unless `defaultSource: false`; * a non-empty string replaces its URL), then config `catalog.sources` when * set (even empty), else the catalog file's `sources`. Config/file sources * ADD to the default one, they never replace it. Duplicate URLs are dropped. */ declare function resolveCatalogSources(fileSources: readonly AppCatalogSource[] | undefined, config: { sources?: unknown; defaultSource?: unknown; } | undefined): ResolvedCatalogSource[]; /** One source's outcome, in the order sources were passed. */ interface CatalogSourceResult { url: string; entries: AppCatalogEntry[]; /** True when `entries` come from the disk cache because the live fetch failed. */ stale: boolean; /** When the entries were fetched (live or cached), ISO-8601. */ fetchedAt?: string; /** False when the source yielded nothing at all (fetch failed, no cache). */ ok: boolean; } interface RemoteCatalogResult { entries: AppCatalogEntry[]; warnings: string[]; bySource: CatalogSourceResult[]; } interface RemoteCatalogClientOptions { /** Default 5 minutes. */ ttlMs?: number; /** Per-source request timeout. Default 5000. */ timeoutMs?: number; fetchImpl?: typeof fetch; now?: () => number; /** Directory for the last-good copy of each source (`.json`). * Absent = no disk cache (in-memory TTL cache only). */ cacheDir?: string; } interface RemoteCatalogClient { /** Fetch + validate every source (in order, in parallel). A failing source * never throws: it yields a `warnings` line and either its last cached * copy (`stale`) or no entries. Live results are cached per URL in memory * for `ttlMs` and on disk (when `cacheDir` is set); `refresh` bypasses the * in-memory cache. */ fetchSources(sources: readonly AppCatalogSource[], opts?: { refresh?: boolean; }): Promise; } declare const DEFAULT_REMOTE_CATALOG_TTL_MS: number; declare const DEFAULT_REMOTE_CATALOG_TIMEOUT_MS = 5000; /** Disk-cache file for `url` under `cacheDir`. */ declare function catalogCachePath(cacheDir: string, url: string): string; declare function createRemoteCatalogClient(options?: RemoteCatalogClientOptions): RemoteCatalogClient; /** * Compare dotted numeric versions (`1.2.10` > `1.2.9`); a pre-release suffix * (`1.2.0-beta`) ranks below the same core. Returns -1 | 0 | 1, or * `undefined` when either side isn't `N.N.N`-shaped. */ declare function compareCatalogVersions(a: string, b: string): number | undefined; /** * Is catalog `entry` an update for an installed app (recorded `source`, * APP.md `version`)? Only for the same source kind, only when the pin * differs (bundle sha256 / git commit), and never when the entry's version * is LOWER than the installed one — a catalog listing an older release is * not an update. */ declare function isCatalogUpdate(installed: { readonly source?: AppSource; readonly version?: string; }, entry: AppCatalogEntry): boolean; export { type AppCatalogEntry, AppCatalogEntrySchema, type AppCatalogFile, type AppCatalogFileEntry, type AppCatalogLicense, type AppCatalogRequires, type AppCatalogScreenshot, type AppCatalogSource, type AppCatalogTier, type AppPlacement, AppSource, CATALOG_LISTING_LIMITS, CATALOG_SCHEMA_V1, type CatalogSourceOrigin, type CatalogSourceResult, DEFAULT_CATALOG_SOURCE_URL, DEFAULT_REMOTE_CATALOG_TIMEOUT_MS, DEFAULT_REMOTE_CATALOG_TTL_MS, type RemoteCatalogClient, type RemoteCatalogClientOptions, type RemoteCatalogResult, type ResolvedCatalogSource, catalogCachePath, compareCatalogVersions, createRemoteCatalogClient, defaultAppCatalogPath, isCatalogUpdate, loadAppCatalogFile, resolveCatalogSources };