@agentix-security/nextjs 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +15 -0
- package/dist/index.js +15 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -522,6 +522,21 @@ function agentixMiddleware(sdk) {
|
|
|
522
522
|
expires_in: exp - iat
|
|
523
523
|
});
|
|
524
524
|
}
|
|
525
|
+
if (req.method === "GET" && pathname === "/robots.txt") {
|
|
526
|
+
let upstream = "";
|
|
527
|
+
try {
|
|
528
|
+
const r = await fetch(`${baseUrl}/robots.txt`, { headers: { "user-agent": "agentix-sdk" } });
|
|
529
|
+
if (r.ok) upstream = await r.text();
|
|
530
|
+
} catch {
|
|
531
|
+
}
|
|
532
|
+
const directive = `
|
|
533
|
+
# Agentix agent discovery
|
|
534
|
+
Agent-Discovery: ${baseUrl}/.well-known/ai-agent.json
|
|
535
|
+
`;
|
|
536
|
+
return new server_js.NextResponse(upstream + directive, {
|
|
537
|
+
headers: { "content-type": "text/plain; charset=utf-8", "cache-control": "no-store" }
|
|
538
|
+
});
|
|
539
|
+
}
|
|
525
540
|
const res = server_js.NextResponse.next();
|
|
526
541
|
res.headers.set("link", `<${baseUrl}/.well-known/ai-agent.json>; rel="agent-discovery"`);
|
|
527
542
|
return res;
|
package/dist/index.js
CHANGED
|
@@ -520,6 +520,21 @@ function agentixMiddleware(sdk) {
|
|
|
520
520
|
expires_in: exp - iat
|
|
521
521
|
});
|
|
522
522
|
}
|
|
523
|
+
if (req.method === "GET" && pathname === "/robots.txt") {
|
|
524
|
+
let upstream = "";
|
|
525
|
+
try {
|
|
526
|
+
const r = await fetch(`${baseUrl}/robots.txt`, { headers: { "user-agent": "agentix-sdk" } });
|
|
527
|
+
if (r.ok) upstream = await r.text();
|
|
528
|
+
} catch {
|
|
529
|
+
}
|
|
530
|
+
const directive = `
|
|
531
|
+
# Agentix agent discovery
|
|
532
|
+
Agent-Discovery: ${baseUrl}/.well-known/ai-agent.json
|
|
533
|
+
`;
|
|
534
|
+
return new NextResponse(upstream + directive, {
|
|
535
|
+
headers: { "content-type": "text/plain; charset=utf-8", "cache-control": "no-store" }
|
|
536
|
+
});
|
|
537
|
+
}
|
|
523
538
|
const res = NextResponse.next();
|
|
524
539
|
res.headers.set("link", `<${baseUrl}/.well-known/ai-agent.json>; rel="agent-discovery"`);
|
|
525
540
|
return res;
|