/**
 * Type-safe accessors for Symbol.for() global state.
 *
 * These symbols survive bun --hot reloads because globalThis persists
 * across module re-evaluations. Using Symbol.for() ensures the same
 * symbol is returned regardless of which module instance creates it.
 *
 * Each symbol key maps to a specific type — this module centralises
 * the definitions so call-sites don't need casts.
 */
// ── Symbol keys ──────────────────────────────────────────────
const keys = {
    originalProcessExit: Symbol.for('@agentuity/runtime:original-process-exit'),
    processExitProtected: Symbol.for('@agentuity/runtime:process-exit-protected'),
    otelInstance: Symbol.for('@agentuity/runtime:otel-instance'),
    originalConsole: Symbol.for('agentuity.originalConsole'),
    serverStarted: Symbol.for('@agentuity/runtime:server-started'),
    localServicesLogged: Symbol.for('@agentuity/runtime:local-services-logged'),
    shutdownHooks: Symbol.for('@agentuity/runtime:shutdown-hooks'),
    s3Patched: Symbol.for('agentuity.s3.patched'),
};
export { keys };
// ── Typed getter / setter ────────────────────────────────────
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const g = globalThis;
export function getGlobal(key) {
    return g[key];
}
export function setGlobal(key, value) {
    g[key] = value;
}
// ── Convenience accessors for commonly used globals ──────────
export const otel = {
    get: () => getGlobal(keys.otelInstance),
    set: (v) => setGlobal(keys.otelInstance, v),
};
export const originalProcessExit = {
    get: () => getGlobal(keys.originalProcessExit),
    set: (v) => setGlobal(keys.originalProcessExit, v),
};
export const processExitProtected = {
    get: () => getGlobal(keys.processExitProtected) ?? false,
    set: (v) => setGlobal(keys.processExitProtected, v),
};
export const originalConsole = {
    get: () => getGlobal(keys.originalConsole),
    set: (v) => setGlobal(keys.originalConsole, v),
};
export const serverStarted = {
    get: () => getGlobal(keys.serverStarted) ?? false,
    set: (v) => setGlobal(keys.serverStarted, v),
};
export const localServicesLogged = {
    get: () => getGlobal(keys.localServicesLogged) ?? false,
    set: (v) => setGlobal(keys.localServicesLogged, v),
};
export const shutdownHooks = {
    get: () => {
        let hooks = getGlobal(keys.shutdownHooks);
        if (!hooks) {
            hooks = [];
            setGlobal(keys.shutdownHooks, hooks);
        }
        return hooks;
    },
};
export const s3Patched = {
    get: () => getGlobal(keys.s3Patched) ?? false,
    set: (v) => setGlobal(keys.s3Patched, v),
};
//# sourceMappingURL=_globals.js.map