Skip to content

armgit / pibot

Public Imported from GitHub
0

Open-source, local-first AI agent team for your desktop: multi-agent group chats, computer use, browser, MCP, routines and approvals. macOS, Windows, Linux + Android. Built on pi.

771 B
Raw Blame
import { resolve } from "node:path";
import { readSource, type SourceAccess } from "@pibot/execution/semantic";

/** Internal-only version receipt: symbols never enter a model-visible JSON tool result. */
export const diagnosticVersions = Symbol("diagnosticVersions");
export async function diagnosticsStillCurrent(
  access: SourceAccess,
  versions: ReadonlyMap<string, string>,
) {
  for (const [path, hash] of versions) {
    let source: Awaited<ReturnType<typeof readSource>>;
    try {
      source = await readSource(access, resolve(access.root, path));
    } catch (error) {
      if (!["ENOENT", "ENOTDIR"].includes((error as NodeJS.ErrnoException).code ?? "")) throw error;
    }
    if ((source?.hash ?? "missing") !== hash) return false;
  }
  return true;
}