import type { ExtensionOperationOutputs, PackageInfo, PackageResources, PackageSummary, PiStatus, ResourceField, SecuritySettings, ServiceSpecSummary, SetupApplyResult, SetupPlan, UpdateEntry, UpdateOutcome } from "./protocol.js"; /** notADaemon: the overwhelmingly common case for install() -- most Pi packages aren't daemons at all. Distinct from a real installService failure (systemctl unavailable, spec resolved but installation itself failed). */ export declare class InstallServiceError extends Error { readonly notADaemon?: boolean | undefined; constructor(message: string, notADaemon?: boolean | undefined); } export interface PackedClientPaths { token: string; handle: string; serviceDescriptor: string; } export interface PackedPathOptions { env?: Record; home?: string; platform?: NodeJS.Platform; } export interface PackedExtensionClient { search(query: string, limit: number, offline?: boolean): Promise<{ query: string; total: number; results: PackageSummary[]; }>; info(name: string): Promise; installed(): Promise; updates(): Promise; security(): Promise; setMutationApproval(value: SecuritySettings["mutationApproval"], approved?: boolean): Promise; install(source: string, approved?: boolean): Promise; installService(source: string, approved?: boolean): Promise<{ output: string; spec?: ServiceSpecSummary; }>; remove(name: string, approved?: boolean): Promise; update(source: string, approved?: boolean, target?: string): Promise; setupPlan(manifestPath: string, prune?: boolean): Promise; setupApply(manifestPath: string, approved?: boolean, prune?: boolean): Promise; listResources(projectRoot?: string): Promise<{ global: PackageResources[]; project: PackageResources[]; }>; toggleResource(source: string, field: ResourceField, path: string, enabled: boolean, projectRoot?: string, approved?: boolean): Promise; piStatus(): Promise; } export declare function resolvePackedClientPaths(options?: PackedPathOptions): PackedClientPaths; export interface PackedVehicleClientTarget { /** Base URL for the daemon's Vehicle-projected surface (see service.ts's createApp, which mounts * createVehicleHttpApp() at /vehicle/* on this same port, alongside /api/v1/ops) -- @danypops/ * vehicle-client's RemoteVehicleClient mounts its own /vehicle/manifest, /vehicle/invoke, * /vehicle/cancel routes under this. */ baseUrl: string; token: string; } /** * Narrow surface for a Vehicle-projected operation consumer -- same daemon, same handle file, same * Bearer token every other Packed RPC call already uses (connectPackedClient reads both the same * way). Returns undefined rather than throwing when the daemon has never started -- no handle/token * on disk yet -- matching resolvePushChannelTarget/resolveVehicleClientTarget's own tolerance in * @danypops/papyrus for the identical condition. */ export declare function resolveVehicleClientTarget(paths?: PackedClientPaths): PackedVehicleClientTarget | undefined; export type FetchTransport = (request: Request) => Promise; export declare class PackedClient implements PackedExtensionClient { private readonly rpc; constructor(base: string, token: string, transport?: FetchTransport); private call; health(): Promise; search(query: string, limit: number, offline?: boolean): Promise<{ query: string; total: number; results: PackageSummary[]; offline?: boolean; }>; info(name: string): Promise; installed(): Promise; updates(): Promise; security(): Promise; setMutationApproval(mutationApproval: SecuritySettings["mutationApproval"], approved?: boolean): Promise; install(source: string, approved?: boolean): Promise; installService(source: string, approved?: boolean): Promise<{ output: string; spec: ServiceSpecSummary | undefined; }>; remove(name: string, approved?: boolean): Promise; update(source: string, approved?: boolean, target?: string): Promise; setupPlan(manifestPath: string, prune?: boolean): Promise; setupApply(manifestPath: string, approved?: boolean, prune?: boolean): Promise; listResources(projectRoot?: string): Promise<{ global: PackageResources[]; project: PackageResources[]; }>; toggleResource(source: string, field: ResourceField, path: string, enabled: boolean, projectRoot?: string, approved?: boolean): Promise; piStatus(): Promise; } export declare function connectPackedClient(paths?: PackedClientPaths, transport?: FetchTransport): Promise; export interface EnsureClientDeps { connect(): Promise; /** Real OS check, not a guess -- does this machine have a supervised * service registered for this daemon (systemd --user unit / launchd * plist / Windows Run key)? */ isServiceInstalled(): boolean; /** Spawns a detached, self-contained daemon for this session only. * Never called when isServiceInstalled() is true. */ spawn(): void; sleep(ms: number): Promise; retryAttempts?: number; retryDelayMs?: number; } /** * Pure connect-or-provision decision, fully dependency-injected and * unit-testable without a real filesystem, subprocess, or network call. * * A real, confirmed hazard motivates the isServiceInstalled() branch: an * auto-spawned orphan gets vehicle-server's 30-minute idle budget (vs. a * supervised service's own, typically much shorter, policy), so it can * keep winning vehicle-server's single-instance lock race against every * subsequent supervised restart, invisibly, for up to half an hour. When a * service is installed, this never spawns a second, differently-supervised * process -- it retries the connection instead, on the assumption the * supervisor is responsible for the daemon actually being reachable, and * fails with a message pointing at the service rather than silently * creating a competing one. */ export declare function ensureClient(deps: EnsureClientDeps): Promise; /** * An auto-spawned daemon is detached and long-lived, so it keeps whatever * PATH its host process had at spawn time forever. Resolve `pi`'s absolute * path now and pin it, rather than trust a bare "pi" to keep resolving in * that frozen PATH. Leaves an explicit PI_PACKED_PI_BIN/PI_BIN untouched. */ export declare function resolvePiBinForSpawn(env?: NodeJS.ProcessEnv): string | undefined; export declare function ensurePackedClient(paths?: PackedClientPaths, transport?: FetchTransport): Promise; //# sourceMappingURL=client.d.ts.map