import { runInRequestScope, getRequestScope } from '../core/request-scope.js';
export async function handleExplore(ctx, explorerService) {
    const body = ctx.body;
    const path = body.path || '/';
    const { toolRules } = body;
    const executeExplore = () => {
        const result = explorerService.explore(path);
        if (!result) {
            ctx.throw(404, `Path not found: ${path}`);
        }
        return result;
    };
    if (toolRules && !getRequestScope()?.toolRules) {
        return runInRequestScope({ toolRules }, executeExplore);
    }
    return executeExplore();
}
//# sourceMappingURL=explorer.handler.js.map