@juspay/neurolink
Version:
The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002
75 lines (74 loc) • 2.67 kB
TypeScript
import type { RollingProxyServer } from "./proxy.js";
import type { ProxySupervisorState } from "./cli.js";
/** Supervisor state with the optional local restart capability. */
export type ProxyRestartSupervisorState = ProxySupervisorState & {
restartControl?: ProxyRestartControlIdentity;
};
export type ProxyRestartArgs = {
check: boolean;
dev: boolean;
format: "text" | "json";
};
/** Local supervisor control identity; contains no account credentials. */
export type ProxyRestartControlIdentity = {
protocol: 1;
socketPath: string;
instanceId: string;
};
/** Terminal result of a local restart check or worker activation. */
export type ProxyRestartResult = {
ok: boolean;
phase: "checked" | "refused" | "failed" | "activated" | "activated_unverified";
message: string;
supervisorPid: number;
previousWorkerPid?: number;
workerPid?: number;
version?: string;
drainingWorkers: number;
/** Observed during handoff/verification; does not attribute the cause. */
rejectedSocketsDelta?: number;
failedTransfersDelta?: number;
};
/** CLI failure before a supervisor result can be authenticated or received. */
export type CliProxyRestartError = {
ok: false;
phase: "unverified";
message: string;
};
/** JSON emitted by the restart CLI, including an unknown control outcome. */
export type CliProxyRestartOutput = ProxyRestartResult | CliProxyRestartError;
/** Supervisor-owned restart dependencies, injectable for isolated process tests. */
export type ProxyRestartControlOptions = {
stateDir: string;
server: RollingProxyServer;
getInstalledVersion: () => Promise<string | undefined>;
isUpdatePending: () => boolean;
getStatus: () => Promise<unknown>;
/** Current supervisor process evidence; never infer it from a worker/plist. */
getTelemetry?: () => ProxyProcessTelemetrySnapshot;
/** Report control-server errors without stopping the serving listener. */
log?: (message: string) => void;
};
/** Small read-only process evidence, excluding environment variables and log content. */
export type ProxyProcessTelemetrySnapshot = {
pid: number;
checkedAt: string;
configuredSink: "otel" | "file";
lifecycleSink: string;
otelInitialized: boolean;
stdio: {
stdout: "file" | "non_file" | "unavailable";
stderr: "file" | "non_file" | "unavailable";
};
exportDropped: number;
exportUnconfirmed: number;
};
export type ProxySupervisorTelemetry = {
status: "available";
process: ProxyProcessTelemetrySnapshot;
} | {
status: "unavailable";
reason: string;
} | {
status: "not_applicable";
};