@agentix-security/nextjs 0.1.8 → 0.1.10

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 CHANGED
@@ -423,7 +423,7 @@ function agentScore(req) {
423
423
  const ua = (req.headers.get("user-agent") ?? "").toLowerCase();
424
424
  if (/bot|crawler|spider|python-requests|curl\/|node-fetch|axios|go-http-client|claude-web|gptbot|chatgpt|google-extended|oai-searchbot|anthropic|llm/i.test(ua)) score += 0.8;
425
425
  if (!ua) score += 0.6;
426
- if (!req.headers.get("sec-fetch-site") && !req.headers.get("sec-ch-ua")) score += 0.3;
426
+ if (!req.headers.get("sec-fetch-site") && !req.headers.get("sec-ch-ua")) score += 0.5;
427
427
  if (!req.headers.get("accept-language")) score += 0.15;
428
428
  const accept = req.headers.get("accept") ?? "";
429
429
  if (req.method === "GET" && !accept.includes("text/html")) score += 0.2;
@@ -534,7 +534,8 @@ function agentixMiddleware(sdk) {
534
534
  });
535
535
  }
536
536
  const isHumanPage = !pathname.startsWith("/api/") && !pathname.startsWith("/agent/") && !pathname.startsWith("/_next/") && !pathname.startsWith("/favicon");
537
- if (isHumanPage && agentScore(req) >= 0.5) {
537
+ const score = agentScore(req);
538
+ if (isHumanPage && score >= 0.5) {
538
539
  const registry = sdk.getIntentRegistry();
539
540
  const tools = Object.fromEntries(
540
541
  [...registry.entries()].map(([intent, entry]) => [intent, { routes: [...entry.routes] }])
@@ -545,7 +546,14 @@ function agentixMiddleware(sdk) {
545
546
  token_id: null,
546
547
  decision: "allow",
547
548
  decision_reason: "agent_redirected_to_lane",
548
- policy_id: "agent-detection"
549
+ policy_id: "agent-detection",
550
+ metadata: {
551
+ user_agent: req.headers.get("user-agent") ?? "",
552
+ agent_score: score,
553
+ has_sec_fetch: !!req.headers.get("sec-fetch-site"),
554
+ has_sec_ch_ua: !!req.headers.get("sec-ch-ua"),
555
+ accept: req.headers.get("accept") ?? ""
556
+ }
549
557
  }));
550
558
  return server_js.NextResponse.json({
551
559
  service: "agentix-intent-sdk",
package/dist/index.js CHANGED
@@ -421,7 +421,7 @@ function agentScore(req) {
421
421
  const ua = (req.headers.get("user-agent") ?? "").toLowerCase();
422
422
  if (/bot|crawler|spider|python-requests|curl\/|node-fetch|axios|go-http-client|claude-web|gptbot|chatgpt|google-extended|oai-searchbot|anthropic|llm/i.test(ua)) score += 0.8;
423
423
  if (!ua) score += 0.6;
424
- if (!req.headers.get("sec-fetch-site") && !req.headers.get("sec-ch-ua")) score += 0.3;
424
+ if (!req.headers.get("sec-fetch-site") && !req.headers.get("sec-ch-ua")) score += 0.5;
425
425
  if (!req.headers.get("accept-language")) score += 0.15;
426
426
  const accept = req.headers.get("accept") ?? "";
427
427
  if (req.method === "GET" && !accept.includes("text/html")) score += 0.2;
@@ -532,7 +532,8 @@ function agentixMiddleware(sdk) {
532
532
  });
533
533
  }
534
534
  const isHumanPage = !pathname.startsWith("/api/") && !pathname.startsWith("/agent/") && !pathname.startsWith("/_next/") && !pathname.startsWith("/favicon");
535
- if (isHumanPage && agentScore(req) >= 0.5) {
535
+ const score = agentScore(req);
536
+ if (isHumanPage && score >= 0.5) {
536
537
  const registry = sdk.getIntentRegistry();
537
538
  const tools = Object.fromEntries(
538
539
  [...registry.entries()].map(([intent, entry]) => [intent, { routes: [...entry.routes] }])
@@ -543,7 +544,14 @@ function agentixMiddleware(sdk) {
543
544
  token_id: null,
544
545
  decision: "allow",
545
546
  decision_reason: "agent_redirected_to_lane",
546
- policy_id: "agent-detection"
547
+ policy_id: "agent-detection",
548
+ metadata: {
549
+ user_agent: req.headers.get("user-agent") ?? "",
550
+ agent_score: score,
551
+ has_sec_fetch: !!req.headers.get("sec-fetch-site"),
552
+ has_sec_ch_ua: !!req.headers.get("sec-ch-ua"),
553
+ accept: req.headers.get("accept") ?? ""
554
+ }
547
555
  }));
548
556
  return NextResponse.json({
549
557
  service: "agentix-intent-sdk",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentix-security/nextjs",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "Agentix Next.js adapter — AI agent intent-based authorization for Next.js apps",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",