Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

2.1 KB
Raw Blame
import type { RuntimeDiagnostic } from "@linger/wire-contracts/runner-gateway/types";

const checkedAt = "2026-07-29T00:00:00.000Z";

export const runtimeDiagnostics = (options?: {
  readonly authenticationRequired?: readonly RuntimeDiagnostic["type"][];
  readonly ready?: readonly RuntimeDiagnostic["type"][];
  /** How every model is reached; subscription runs several units at once. */
  readonly link?: "api" | "subscription";
}): [
  RuntimeDiagnostic,
  RuntimeDiagnostic,
  RuntimeDiagnostic,
  RuntimeDiagnostic,
] => {
  const ready = new Set(options?.ready ?? ["codex"]);
  const authenticationRequired = new Set(options?.authenticationRequired ?? []);
  return (["codex", "claude", "pi", "antigravity"] as const).map((type) => {
    const protocol =
      type === "codex"
        ? ("app-server" as const)
        : type === "claude"
          ? ("stream-json" as const)
          : type === "pi"
            ? ("rpc" as const)
            : ("acp" as const);
    // A current Computer reports each ready Runtime's model catalog.
    const models: NonNullable<RuntimeDiagnostic["models"]> = [
      {
        id: `${type}-default`,
        label: `${type[0]!.toUpperCase()}${type.slice(1)} default`,
        allowed_reasoning_effort: [],
        link: options?.link ?? "subscription",
      },
    ];
    if (ready.has(type)) {
      return {
        type,
        status: "ready" as const,
        protocol,
        checked_at: checkedAt,
        models,
      };
    }
    if (authenticationRequired.has(type)) {
      return {
        type,
        status: "authentication_required" as const,
        protocol,
        checked_at: checkedAt,
        models,
        error: {
          code: "RUNTIME_AUTHENTICATION_REQUIRED" as const,
          message: `${type} authentication is required`,
        },
      };
    }
    return {
      type,
      status: "not_installed" as const,
      protocol,
      checked_at: checkedAt,
      models: [],
      error: {
        code: "RUNTIME_NOT_INSTALLED" as const,
        message: `${type} is not installed`,
      },
    };
  }) as [
    RuntimeDiagnostic,
    RuntimeDiagnostic,
    RuntimeDiagnostic,
    RuntimeDiagnostic,
  ];
};