@agentix-security/nextjs 0.1.5 → 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 +16 -1
- package/dist/index.js +16 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -272,7 +272,7 @@ var AgentixSDK = class {
|
|
|
272
272
|
this._tenantId = body.tenant_id;
|
|
273
273
|
this._domain = body.domain;
|
|
274
274
|
this._tokenSecret = body.token_secret;
|
|
275
|
-
this._proxyUrl =
|
|
275
|
+
this._proxyUrl = cp;
|
|
276
276
|
} else {
|
|
277
277
|
console.warn(`[agentix] Registration failed (${res.status}) \u2014 operating in degraded mode`);
|
|
278
278
|
this._tokenSecret = deriveTokenSecret(this.config.licenseKey);
|
|
@@ -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
|
@@ -270,7 +270,7 @@ var AgentixSDK = class {
|
|
|
270
270
|
this._tenantId = body.tenant_id;
|
|
271
271
|
this._domain = body.domain;
|
|
272
272
|
this._tokenSecret = body.token_secret;
|
|
273
|
-
this._proxyUrl =
|
|
273
|
+
this._proxyUrl = cp;
|
|
274
274
|
} else {
|
|
275
275
|
console.warn(`[agentix] Registration failed (${res.status}) \u2014 operating in degraded mode`);
|
|
276
276
|
this._tokenSecret = deriveTokenSecret(this.config.licenseKey);
|
|
@@ -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;
|