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。

968 B
Raw Blame
/** Phone-local instrumentation only. Never pass session bodies, request payloads or credentials. */
export type MobileDebugScope =
  | "auth"
  | "network"
  | "device-link"
  | "recovery"
  | "lifecycle"
  | "performance"
  | "scroll"
  | "keyboard"
  | "files"
  | "voice"
  | "new-session";
export type MobileDebugLevel = "debug" | "info" | "warn" | "error";
type Sink = (
  level: MobileDebugLevel,
  scope: MobileDebugScope,
  args: unknown[],
) => void;
let sink: Sink | undefined;

export function setMobileDebugSink(next: Sink | undefined): void {
  sink = next;
}
export function mobileDebugEnabled(): boolean {
  return sink !== undefined;
}

/** Disabled recording does no serialization or native I/O. Diagnostics must never break the app. */
export function mobileDebugLog(
  level: MobileDebugLevel,
  scope: MobileDebugScope,
  ...args: unknown[]
): void {
  try {
    sink?.(level, scope, args);
  } catch {
    /* best-effort instrumentation */
  }
}