import { type ServiceAdapterKernelStopResult, type ServiceAdapterStopResult, type ServiceAdapterReadiness, type ProcessIdentityRecord } from "@cotal-ai/workspace"; import type { ServiceAdapterPin } from "./service-adapters.js"; import { ProtectedRecordStore, type LocalRecordSnapshot } from "./protected-records.js"; export interface ServiceHost { machine: string; boot: string; name: string; uid: number; } export interface ServiceInstance { schemaVersion: 1; instanceId: string; definition: string; definitionRevision: string; space: string; host: ServiceHost; requestId: string; launchRequestId: string; state: "starting" | "running" | "stopping" | "stopped" | "failed" | "unknown"; launcher: ProcessIdentityRecord; process?: ProcessIdentityRecord; readiness: "not-checked" | "process-running" | "http-reachable" | "adapter-process-running" | "endpoint-serving" | "broker-listener-reported"; adapter?: ServiceAdapterPin; adapterReadiness?: Extract; supervisorInvocationId?: string; nativeStopRequired?: true; nativeStop?: ServiceAdapterStopResult; /** The instance can be stopped only by its exact kernel-exit policy, never a generic signal path. */ kernelStopRequired?: true; kernelStop?: ServiceAdapterKernelStopResult; /** The generic exact-PID stop's own receipt: this request signalled the pinned process and observed * that exact process exit. Never written for an instance that was already gone. */ processStop?: ServiceProcessStopReceipt; /** The maintenance attempt a controller resume launched this incarnation for. Never the * attempt's handoff path or digest. */ attempt?: { attemptId: string; }; supervisor: "none"; foreground: boolean; createdAt: string; updatedAt: string; exit?: { code: number | null; signal: string | null; }; } export type ServiceInstanceSnapshot = LocalRecordSnapshot; export interface ServiceProcessStopReceipt { kind: "process-exit"; requestId: string; process: ProcessIdentityRecord; signal: "SIGTERM" | "SIGKILL"; observedAt: string; } /** Closed reader for the generic stop receipt. */ export declare function serviceProcessStopReceipt(input: unknown): ServiceProcessStopReceipt; export declare function serviceInstanceId(value: string): string; /** This driver refuses without an OS machine/boot identity; no PID-only ownership substitute. */ export declare function processServiceHost(): ServiceHost; export declare function requireProcessIdentity(pid: number): ProcessIdentityRecord; export declare const serviceInstanceStore: (space: string) => ProtectedRecordStore; export declare function serviceInstances(space: string, definition?: string): ServiceInstanceSnapshot[]; export type ServiceProcessState = "running" | "gone" | "previous-boot" | "foreign-host" | "foreign-pid" | "unreadable" | "unresolved-launch"; export declare function observeServiceProcess(value: ServiceInstance): ServiceProcessState; export declare function instanceProjection(row: ServiceInstanceSnapshot): { instanceId: string; definition: string; definitionRevision: string; revision: string; space: string; executionHost: string; observedProcess: ServiceProcessState; recordedState: "unknown" | "failed" | "starting" | "running" | "stopping" | "stopped"; pid: number | null; readinessObservation: "not-checked" | "process-running" | "http-reachable" | "adapter-process-running" | "endpoint-serving" | "broker-listener-reported"; readinessAsOf: string; servingResponse: string; nativeEvidence: "local-process-receipt" | null; adapter: ServiceAdapterPin | null; nativeEndpoint: { readonly endpoint: string; readonly instanceId: string; readonly owner: string; readonly actor: string; readonly lifecycleUid: string; readonly epoch: number; } | null; reportedListener: import("@cotal-ai/workspace").ServiceAdapterListenerReport | null; adapterObservedAt: string | null; nativeStop: ServiceAdapterStopResult | null; kernelStop: ServiceAdapterKernelStopResult | null; processStop: ServiceProcessStopReceipt | null; stopPolicy: "native" | "kernel-exit" | "process"; supervisor: "none" | "systemd-user" | "launchd"; supervisorRecord: { mechanism: "none-recorded"; fileObservation: "not-checked"; osState: "not-checked"; autostart: "not-checked"; unit: null; unitPath: null; privateHome: null; seededGeneration: null; installedAt: null; } | { mechanism: "systemd-user" | "launchd"; fileObservation: "foreign-host"; osState: "not-checked"; autostart: "not-checked"; unit: string; unitPath: string; privateHome: string; seededGeneration: string; installedAt: string; } | { mechanism: "systemd-user" | "launchd"; fileObservation: "unreadable" | "missing" | "matches-recorded-bytes" | "modified"; osState: "not-checked"; autostart: "not-checked"; unit: string; unitPath: string; privateHome: string; seededGeneration: string; installedAt: string; }; supervisorInvocationId: string | null; supervisorObservation: "not-checked"; requestId: string; launchRequestId: string; foreground: boolean; exit: { code: number | null; signal: string | null; } | null; }; /** Called only while ext remove holds the extension writer lock. Enumerate the case-safe service * store itself, including spaces no longer present in the mesh-selection registry. No provider * is imported and an unreadable/foreign/unresolved instance never counts as stopped. */ export declare function assertExtensionServiceInstancesStopped(pkg: string): void; //# sourceMappingURL=service-instances.d.ts.map