@vfarcic/dot-ai
Version:
AI-powered development productivity platform that enhances software development workflows through intelligent automation and AI-driven assistance
21 lines (20 loc) • 763 B
JavaScript
;
/**
* Request-scoped context using AsyncLocalStorage (PRD #380 Task 2.4).
*
* Propagates UserIdentity from the auth check in mcp.ts through to
* tool handlers without changing any handler signatures. Works across
* both REST API and MCP protocol paths.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.requestContext = void 0;
exports.getCurrentIdentity = getCurrentIdentity;
const node_async_hooks_1 = require("node:async_hooks");
exports.requestContext = new node_async_hooks_1.AsyncLocalStorage();
/**
* Get the current user identity from the request context.
* Returns undefined when called outside a request context.
*/
function getCurrentIdentity() {
return exports.requestContext.getStore()?.identity;
}