/**
 * Minimal server globals for Vite-native architecture
 * The server is managed by Vite (dev) or Bun.serve in the generated entry file (prod)
 *
 * These module-level variables persist across bun --hot reloads (since this
 * module is not re-evaluated unless it changes). createApp() updates them
 * via setters on each reload.
 */
import { TokenSpanProcessor } from './_tokens';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let globalRouterInstance = null;
let globalLogger = null;
let globalTracer = null;
// Initialize with built-in span processors
const spanProcessors = [new TokenSpanProcessor()];
/**
 * List of AgentContext properties that should trigger helpful error messages
 * when accessed directly on HonoContext in route handlers.
 */
export const AGENT_CONTEXT_PROPERTIES = [
    'logger',
    'tracer',
    'sessionId',
    'kv',
    'stream',
    'vector',
    'sandbox',
    'queue',
    'state',
    'thread',
    'session',
    'config',
    'app',
];
export function getRouter() {
    return globalRouterInstance;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function setGlobalRouter(router) {
    globalRouterInstance = router;
}
/**
 * Returns the global logger instance.
 * This is a singleton created during application initialization.
 */
export function createLogger() {
    return globalLogger;
}
export function getLogger() {
    return globalLogger;
}
export function setGlobalLogger(logger) {
    globalLogger = logger;
}
export function getTracer() {
    return globalTracer;
}
export function setGlobalTracer(tracer) {
    globalTracer = tracer;
}
/**
 * Add a custom span processor that will be added to the otel configuration.
 * This method must be called before the server is initialized.
 */
export function addSpanProcessor(processor) {
    spanProcessors.push(processor);
}
export function getSpanProcessors() {
    return spanProcessors;
}
/**
 * Helper to cast HonoContext to include private variables
 */
export function privateContext(c) {
    return c;
}
/**
 * No-op for Vite-native architecture (Vite manages server lifecycle)
 */
export const notifyReady = () => {
    // No-op: Vite handles server readiness
};
/**
 * No-op for Vite-native architecture (returns null)
 */
export function getServer() {
    return null;
}
//# sourceMappingURL=_server.js.map