UNPKG

@dexwox-labs/a2a-server

Version:

TypeScript server implementation for Google's Agent-to-Agent (A2A) protocol - includes Express/WebSocket handlers, request validation and queue management

20 lines 802 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.contextMiddleware = contextMiddleware; const request_context_1 = require("./request-context"); function contextMiddleware(agentId) { return (req, res, next) => { // Create a basic task for the request const task = { id: crypto.randomUUID(), name: `${req.method} ${req.path}`, status: 'submitted', createdAt: new Date().toISOString(), updatedAt: new Date().toISOString() }; // Create and run the request in context const context = (0, request_context_1.createRequestContext)(task, agentId); (0, request_context_1.runInContext)(context, () => next()); }; } //# sourceMappingURL=context-middleware.js.map