import { createRequire } from "node:module";
import { getConfig } from "../config.js";
import { getBootstrapState } from "../searxng/bootstrap.js";
import { readCacheStats } from "./tui/status-cache.js";
import { probePythonPackages } from "./tui/status-python.js";
import { readConnectedAgents } from "./tui/status-agents.js";
import { formatStatus } from "./tui/status-format.js";
const require2 = createRequire(import.meta.url);
const pkg = require2("../../package.json");
async function runStatus(_args) {
  const dataDir = getConfig().dataDir;
  const bootstrap = getBootstrapState(dataDir);
  const searxng = bootstrap === null ? "pending" : bootstrap.status === "ready" ? "ready" : bootstrap.status === "failed" ? "failed" : "pending";
  const python = probePythonPackages(dataDir);
  const cache = readCacheStats(dataDir);
  const agents = readConnectedAgents({});
  const bag = {
    version: pkg.version ?? "0.0.0",
    searxng,
    reranker: python.reranker,
    embeddings: python.embeddings,
    cache,
    agents
  };
  process.stderr.write(formatStatus(bag));
  return 0;
}
export {
  runStatus
};
//# sourceMappingURL=status.js.map