/** * Agent package installer — materializes the registry's install manifest into * a local cache directory and loads package worker modules. * * Used by PilotSwarmWorker at startup and on every registry-epoch refresh * (and by the portal for its catalog/workspace needs). Per-package failures * quarantine that package only — a corrupted tarball or a broken * worker-module must never take the worker down or block other packages. * * Cache layout: /@./ with a * .pilotswarm-meta.json sidecar carrying the verified sha256. A directory * whose sidecar matches the registry sha is reused without downloading — * this is the "never re-pull the same package" guarantee. */ import type { ArtifactStore } from "./session-store.js"; import type { SessionCatalog } from "./cms.js"; export interface InstalledAgentPackage { /** Registry row identity — stable across versions, unique across scopes/owners. */ packageId: string; name: string; semver: string; sha256: string; scope: "shared" | "user"; owner: { provider: string; subject: string; } | null; manifest: Record; /** Absolute unpacked directory (loadable as a plugin dir). */ dir: string; /** Absolute path to tools/worker-module.js when the package ships tools. */ workerModulePath: string | null; status: "ok" | "error"; error?: string; } export interface AgentPackageInstallResult { epoch: number; packages: InstalledAgentPackage[]; /** Plugin dirs of every OK package, install-manifest order. */ pluginDirs: string[]; } /** * Materialize every enabled package's active version into cacheDir. * Reads the epoch FIRST so a mutation that lands mid-install makes the next * poll see a newer epoch and re-converge (never lost, at worst one interval * late). */ export declare function installAgentPackages(opts: { catalog: SessionCatalog; artifactStore: ArtifactStore; cacheDir: string; }): Promise; /** * Import a package worker-module and return its tools. * * The import URL is cache-busted by the package sha, so a refreshed package * version gets a genuinely fresh module while an unchanged one reuses the * ESM cache. Module contract (same as the CLI --worker module): * export default { createTools({ workerNodeId }) => Tool[] } // or * export default { tools: Tool[] } // or * export const tools = [...] */ export declare function loadAgentPackageTools(pkg: InstalledAgentPackage, context: { workerNodeId?: string; }): Promise; //# sourceMappingURL=agent-package-installer.d.ts.map