Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

816 B
Raw Blame
import { mobileDebugLog } from "@/debug/mobileDebugLog";

type Stage =
  | "connect"
  | "link-ready"
  | "capabilities"
  | "capture-started"
  | "control-ready"
  | "screenshot-presented"
  | "video-frame-ready"
  | "video-presented"
  | "stopped";
/** One sample per milestone, with no host IDs or media/credential content. */
export function connectionDiagnostics(
  attempt: number,
  now = () => performance.now(),
) {
  const started = now();
  const seen = new Set<Stage>();
  let stopped = false;
  return (stage: Stage) => {
    if (stopped || seen.has(stage)) return;
    seen.add(stage);
    if (stage === "stopped") stopped = true;
    mobileDebugLog("info", "device-link", "remote-desktop-timing", {
      attempt,
      stage,
      elapsedMs: Math.max(0, Math.round(now() - started)),
    });
  };
}