import { type ServerSettingsService } from '../settings/settings.service.js'; import type { ServerInfo, ServicesRestartResponse } from '../../shared/server-info.js'; import { type ProviderAvailability, type ProviderKind } from '../../shared/provider-catalog.js'; export interface PreparedServicesRestart { response: ServicesRestartResponse; spawn: () => Promise; } export interface SystemServiceOptions { animactlScript?: string; commandPresent?: (command: string, args: string[]) => Promise; commit?: Promise | string; now?: () => Date; providerModels?: (command: string, kind: ProviderKind) => Promise; packageVersion?: () => Promise; projectRoot?: string; restartDelayMs?: number; settings?: ServerSettingsService; startedAt?: string; } export interface ProviderModelCatalog { defaultModel: string; modelReasoningEfforts?: Record; models: string[]; } export declare class SystemServiceError extends Error { } export declare class SystemService { private readonly animactlScript; private readonly commandPresent; private readonly commit; private readonly now; private readonly providerModels; private readonly packageVersion; private readonly projectRoot; private readonly restartDelayMs; private readonly settings; private readonly startedAt; constructor(options?: SystemServiceOptions); providerAvailability(): Promise<{ providers: ProviderAvailability[]; }>; serverInfo(): Promise; serverStartedAt(): string; prepareServicesRestart(): PreparedServicesRestart; } export declare const defaultSystemService: SystemService; export declare function parseGrokModelsOutput(output: string): ProviderModelCatalog; /** * Parse ACP initialize/session modelState into model ids + per-model effort menus. * Live Grok Build exposes `supportsReasoningEffort` and `reasoningEfforts` here; * models without that flag (e.g. composer) get an empty effort list. */ export declare function parseGrokAcpModelState(modelState: unknown): ProviderModelCatalog | undefined; export declare const PI_NO_CREDENTIAL_MESSAGE = "pi has no provider credential. Run `pi` and `/login`, add a key to `~/.pi/agent/auth.json`, or export the provider API key in the Anima service environment."; export declare function parsePiModelCatalog(available: unknown, state: unknown): ProviderModelCatalog; export interface ServicesRestartDetachedSpawnPlan { args: string[]; command: string; cwd: string; detached: boolean; env: NodeJS.ProcessEnv; stdio: 'ignore' | 'log'; waitForExit: boolean; } export interface ServicesRestartDetachedSpawnPlanInput { animaHome: string; animactlScript: string; env?: NodeJS.ProcessEnv; logPath: string; nodePath?: string; nowMs?: number; platform?: NodeJS.Platform; projectRoot: string; resultPath: string; } /** * Build the spawn plan for a web-requested services restart. * * On Linux systemd hosts a plain detached child stays in the web unit's * cgroup, so `systemctl --user stop` of the web unit SIGKILLs the restarter * mid-restart (#693). Prefer a transient `systemd-run --user` unit — same * shape as runtime-upgrade workers. Darwin/other keep detached node. * * Linux hosts without a reachable user systemd (pid-file mode, no linger, * containers) fall back to the detached-node plan when systemd-run fails — * that fallback is only unsafe where systemd-run would have succeeded. */ export declare function servicesRestartDetachedSpawnPlan(input: ServicesRestartDetachedSpawnPlanInput): ServicesRestartDetachedSpawnPlan; /** Detached node spawn used on non-Linux and as Linux systemd-run fallback. */ export declare function servicesRestartDetachedNodePlan(input: ServicesRestartDetachedSpawnPlanInput): ServicesRestartDetachedSpawnPlan; export declare function servicesRestartDetachedSystemdRunPlan(input: ServicesRestartDetachedSpawnPlanInput): ServicesRestartDetachedSpawnPlan; /** When systemd-run cannot launch, fall back to detached node (Linux only). */ export declare function servicesRestartDetachedFallbackPlan(failedPlan: ServicesRestartDetachedSpawnPlan, input: ServicesRestartDetachedSpawnPlanInput): ServicesRestartDetachedSpawnPlan | undefined; export declare function docsUrl(track: 'dev' | 'canary' | 'stable'): string; //# sourceMappingURL=system.service.d.ts.map