@knownagents/sdk 2.3.0 → 2.5.0

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/README.md CHANGED
@@ -137,41 +137,56 @@ Call `identifyAgents` to identify multiple requests at once:
137
137
  ```ts
138
138
  const identifications = await knownAgents.identifyAgents([
139
139
  {
140
- id: "request-1",
140
+ request_id: "request-1",
141
141
  request_headers: request1.headers,
142
142
  request_path: request1.url
143
143
  },
144
144
  {
145
- id: "request-2",
145
+ request_id: "request-2",
146
146
  request_headers: request2.headers,
147
147
  request_path: request2.url
148
148
  }
149
149
  ])
150
150
  ```
151
151
 
152
+ Identification requests accept the following fields:
153
+
154
+ - `request_id`: A string identifier that will be echoed back in the response. Include this when sending an array to match each result to its request.
155
+ - `request_headers` (required): An object containing all available HTTP request headers, including `user-agent` when present, any IP-related headers like `x-forwarded-for` or `x-real-ip`, and HTTP message signature headers like `signature-input`, `signature`, and `signature-agent`.
156
+ - `request_ip`: The transport-level IP address of the incoming request. Used as a fallback when a valid client IP address cannot be derived from `request_headers`.
157
+ - `request_path`: The path of the incoming request (e.g. `"/products/123"`).
158
+
152
159
  These methods return an object (or array of objects) with the following fields:
153
160
 
154
- - `id`: The identifier from the request (if provided).
161
+ - `request_id`: The identifier from the request (if provided).
155
162
  - `result`: The identification result:
156
- - `"verified"`: A known agent was identified and verified
157
- - `"verification_failed"`: A known agent was identified, but failed verification
158
- - `"not_verifiable"`: A known agent was identified, but no verification method was available
159
- - `"not_identified"`: No known agent was identified
163
+ - `"verified"`: A known agent was identified and verified (its identity was confirmed as authentic)
164
+ - `"verification_failed"`: A known agent was identified, but failed verification (its identity may have been spoofed)
165
+ - `"not_verifiable"`: A known agent was identified, but its operator does not provide a known verification method
166
+ - `"not_identified"`: No known agent was identified (the request may have come from a human)
160
167
  - `agent_id`: The unique ID of the identified agent.
161
168
  - `agent_token`: The name of the agent (e.g. `"Claude-User"`) (if identified).
162
169
  - `agent_url`: The documentation URL of the agent (if identified).
163
170
  - `agent_type_name`: The type of agent (e.g. `"AI Assistant"`) (if identified).
164
171
  - `operator_name`: The company operating the agent (e.g. `"Anthropic"`) (if identified).
165
172
  - `is_disallowed_by_robots_txt`: Whether the identified agent is disallowed by robots.txt from accessing the `request_path`.
166
- - `asn`: The autonomous system number associated with the request's IPv4 address.
167
- - `asn_operator`: The operator of the recognized autonomous system associated with the request's IPv4 address.
168
- - `asn_type`: The type of the recognized autonomous system associated with the request's IPv4 address:
173
+ - `asn`: The autonomous system number associated with the request's IP address.
174
+ - `asn_operator`: The operator of the recognized autonomous system associated with the request's IP address.
175
+ - `asn_type`: The type of the recognized autonomous system associated with the request's IP address:
169
176
  - `"isp"`
170
177
  - `"hosting"`
171
178
  - `"business"`
172
179
  - `"education"`
173
180
  - `"government"`
174
181
  - `automation_score`: An integer from `0` to `99` indicating the strength of heuristic evidence that the request was made by an automated client. Higher scores indicate stronger detected automation signals. A score of `0` means that no automation signals were detected, not that the client is certainly human.
182
+ - `automation_signals`: Specific automation signals detected for the request. Available to Enterprise plans upon request:
183
+ - `"known_agent_ip"`: The request came from an IP address associated with a known agent, although no specific agent was identified
184
+ - `"inconsistency"`: The request contained inconsistent client or browser attributes
185
+ - `"non_browser"`: The request appears to have been made by a non-browser HTTP client
186
+ - `"automated_browser"`: The request contains indicators of browser automation
187
+ - `"cloud_service_provider"`: The request came from cloud or hosting infrastructure
188
+
189
+ See the [Agent Identification REST API documentation](https://knownagents.com/docs/identification/rest-api) for the canonical API reference.
175
190
 
176
191
  ## Requirements
177
192
 
@@ -1 +1 @@
1
- {"version":3,"file":"KnownAgents.d.ts","sourceRoot":"","sources":["../src/KnownAgents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,MAAM,CAAA;AAC3D,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAA;AAGvG,OAAO,KAAK,EACR,SAAS,EACT,qBAAqB,EACrB,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cAAc,CAAC,QAAQ,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAsBxF,OAAO,CAAC,aAAa;YAaP,UAAU;CAmB3B"}
@@ -108,14 +108,14 @@ class KnownAgents {
108
108
  response_headers: response.getHeaders(),
109
109
  response_duration_in_milliseconds: responseDurationInMilliseconds,
110
110
  mcp_request_method: mcpRequestBody.method,
111
- mcp_request_tool_name: mcpRequestBody.params?.name,
111
+ mcp_request_name: mcpRequestBody.params?.name,
112
112
  mcp_request_client_info_name: mcpRequestBody.params?.clientInfo?.name,
113
113
  mcp_request_client_info_version: mcpRequestBody.params?.clientInfo?.version,
114
114
  mcp_response_result_is_error: mcpResponseBody.result?.isError,
115
115
  mcp_response_error_code: mcpResponseBody.error?.code,
116
116
  mcp_response_error_message: mcpResponseBody.error?.message,
117
- acp_response_body: (0, headers_1.getIsACPCall)(request.headers) ? mcpResponseBody.result?.structuredContent ?? mcpResponseBody.result : undefined,
118
- ucp_response_body: (0, headers_1.getIsUCPCall)(request.headers) ? mcpResponseBody.result?.structuredContent ?? mcpResponseBody.result : undefined,
117
+ acp_response_body: (0, headers_1.getIsACPCall)(request.headers) ? mcpResponseBody.result : undefined,
118
+ ucp_response_body: (0, headers_1.getIsUCPCall)(request.headers) ? mcpResponseBody.result : undefined,
119
119
  created: created.toISOString()
120
120
  };
121
121
  this.trackVisits([visitRequest]);
@@ -222,6 +222,7 @@ class KnownAgents {
222
222
  },
223
223
  body: JSON.stringify({
224
224
  request_headers: (0, headers_1.getFilteredHeaders)(request.headers),
225
+ request_ip: request.socket.remoteAddress,
225
226
  request_path: request.url
226
227
  })
227
228
  });
package/dist/headers.js CHANGED
@@ -48,7 +48,7 @@ function getIsUCPCall(headers) {
48
48
  });
49
49
  }
50
50
  function getIsACPCall(headers) {
51
- return !getIsUCPCall(headers) && Object.keys(headers).some((key) => {
51
+ return Object.keys(headers).some((key) => {
52
52
  return key.toLowerCase() === "api-version";
53
53
  });
54
54
  }
package/dist/types.d.ts CHANGED
@@ -37,7 +37,7 @@ export interface VisitRequest {
37
37
  /** The MCP JSON-RPC request method */
38
38
  mcp_request_method?: string;
39
39
  /** The MCP request tool name */
40
- mcp_request_tool_name?: string;
40
+ mcp_request_name?: string;
41
41
  /** The MCP request client name */
42
42
  mcp_request_client_info_name?: string;
43
43
  /** The MCP request client version */
@@ -60,10 +60,12 @@ export interface VisitRequest {
60
60
  * Used for batch agent identification with `identifyAgents()`.
61
61
  */
62
62
  export interface IdentificationRequest {
63
- /** An identifier that will be echoed back in the response to match requests with results */
64
- id?: string;
65
- /** The HTTP request headers. Sensitive headers are removed before sending. */
63
+ /** A string identifier that will be echoed back in the response. Include this when sending an array to match each result to its request. */
64
+ request_id?: string;
65
+ /** An object containing all available HTTP request headers, including `user-agent` when present, any IP-related headers like `x-forwarded-for` or `x-real-ip`, and HTTP message signature headers like `signature-input`, `signature`, and `signature-agent`. */
66
66
  request_headers: IncomingHttpHeaders;
67
+ /** The transport-level IP address of the incoming request. Used as a fallback when a valid client IP address cannot be derived from `request_headers`. */
68
+ request_ip?: string;
67
69
  /** The path of the incoming request (e.g. `"/products/123"`). */
68
70
  request_path?: string;
69
71
  }
@@ -72,13 +74,13 @@ export interface IdentificationRequest {
72
74
  */
73
75
  export interface IdentificationResult {
74
76
  /** The identifier from the request (if provided). */
75
- id?: string;
77
+ request_id?: string;
76
78
  /**
77
79
  * The identification result:
78
- * - "verified": A known agent was identified and verified
79
- * - "verification_failed": A known agent was identified, but failed verification
80
- * - "not_verifiable": A known agent was identified, but no verification method was available
81
- * - "not_identified": No known agent was identified
80
+ * - "verified": A known agent was identified and verified (its identity was confirmed as authentic)
81
+ * - "verification_failed": A known agent was identified, but failed verification (its identity may have been spoofed)
82
+ * - "not_verifiable": A known agent was identified, but its operator does not provide a known verification method
83
+ * - "not_identified": No known agent was identified (the request may have come from a human)
82
84
  */
83
85
  result: "verified" | "verification_failed" | "not_verifiable" | "not_identified";
84
86
  /** The unique ID of the identified agent. */
@@ -93,12 +95,12 @@ export interface IdentificationResult {
93
95
  operator_name?: string;
94
96
  /** Whether the identified agent is disallowed by robots.txt from accessing the `request_path`. */
95
97
  is_disallowed_by_robots_txt?: boolean;
96
- /** The autonomous system number associated with the request's IPv4 address. */
98
+ /** The autonomous system number associated with the request's IP address. */
97
99
  asn?: number;
98
- /** The operator of the recognized autonomous system associated with the request's IPv4 address. */
100
+ /** The operator of the recognized autonomous system associated with the request's IP address. */
99
101
  asn_operator?: string;
100
102
  /**
101
- * The type of the recognized autonomous system associated with the request's IPv4 address:
103
+ * The type of the recognized autonomous system associated with the request's IP address:
102
104
  * - "isp"
103
105
  * - "hosting"
104
106
  * - "business"
@@ -108,6 +110,15 @@ export interface IdentificationResult {
108
110
  asn_type?: "isp" | "hosting" | "business" | "education" | "government";
109
111
  /** An integer from `0` to `99` indicating the strength of heuristic evidence that the request was made by an automated client. Higher scores indicate stronger detected automation signals. A score of `0` means that no automation signals were detected, not that the client is certainly human. */
110
112
  automation_score?: number;
113
+ /**
114
+ * Specific automation signals detected for the request. Available to Enterprise plans upon request:
115
+ * - "known_agent_ip": The request came from an IP address associated with a known agent, although no specific agent was identified
116
+ * - "inconsistency": The request contained inconsistent client or browser attributes
117
+ * - "non_browser": The request appears to have been made by a non-browser HTTP client
118
+ * - "automated_browser": The request contains indicators of browser automation
119
+ * - "cloud_service_provider": The request came from cloud or hosting infrastructure
120
+ */
121
+ automation_signals?: Array<"known_agent_ip" | "inconsistency" | "non_browser" | "automated_browser" | "cloud_service_provider">;
111
122
  }
112
123
  /**
113
124
  * Agent types that can be controlled with robots.txt rules.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAA;AAEpE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,yGAAyG;IACzG,2BAA2B,CAAC,EAAE,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AAsS;IACtS,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,KAAK,CACtB,gBAAgB,GACd,eAAe,GACf,aAAa,GACb,mBAAmB,GACnB,wBAAwB,CAC7B,CAAA;CACJ;AAED;;GAEG;AACH,oBAAY,SAAS;IACjB,OAAO,aAAa;IACpB,WAAW,iBAAiB;IAC5B,aAAa,oBAAoB;IACjC,cAAc,qBAAqB;IACnC,aAAa,oBAAoB;IACjC,eAAe,sBAAsB;IACrC,QAAQ,aAAa;IACrB,cAAc,oBAAoB;IAClC,eAAe,qBAAqB;IACpC,OAAO,YAAY;IACnB,oBAAoB,0BAA0B;IAC9C,OAAO,YAAY;IACnB,UAAU,gBAAgB;IAC1B,mBAAmB,0BAA0B;IAC7C,eAAe,qBAAqB;IACpC,mBAAmB,0BAA0B;CAChD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knownagents/sdk",
3
- "version": "2.3.0",
3
+ "version": "2.5.0",
4
4
  "description": "The official Node.js SDK for Known Agents: AI agent analytics (bot traffic), LLM referral tracking, automatic robots.txt, agent identification",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -139,14 +139,14 @@ export class KnownAgents {
139
139
  response_headers: response.getHeaders(),
140
140
  response_duration_in_milliseconds: responseDurationInMilliseconds,
141
141
  mcp_request_method: mcpRequestBody.method,
142
- mcp_request_tool_name: mcpRequestBody.params?.name,
142
+ mcp_request_name: mcpRequestBody.params?.name,
143
143
  mcp_request_client_info_name: mcpRequestBody.params?.clientInfo?.name,
144
144
  mcp_request_client_info_version: mcpRequestBody.params?.clientInfo?.version,
145
145
  mcp_response_result_is_error: mcpResponseBody.result?.isError,
146
146
  mcp_response_error_code: mcpResponseBody.error?.code,
147
147
  mcp_response_error_message: mcpResponseBody.error?.message,
148
- acp_response_body: getIsACPCall(request.headers) ? mcpResponseBody.result?.structuredContent ?? mcpResponseBody.result : undefined,
149
- ucp_response_body: getIsUCPCall(request.headers) ? mcpResponseBody.result?.structuredContent ?? mcpResponseBody.result : undefined,
148
+ acp_response_body: getIsACPCall(request.headers) ? mcpResponseBody.result : undefined,
149
+ ucp_response_body: getIsUCPCall(request.headers) ? mcpResponseBody.result : undefined,
150
150
  created: created.toISOString()
151
151
  }
152
152
 
@@ -266,6 +266,7 @@ export class KnownAgents {
266
266
  },
267
267
  body: JSON.stringify({
268
268
  request_headers: getFilteredHeaders(request.headers),
269
+ request_ip: request.socket.remoteAddress,
269
270
  request_path: request.url
270
271
  })
271
272
  })
package/src/headers.ts CHANGED
@@ -50,7 +50,7 @@ export function getIsUCPCall(headers: IncomingHttpHeaders): boolean {
50
50
  }
51
51
 
52
52
  export function getIsACPCall(headers: IncomingHttpHeaders): boolean {
53
- return !getIsUCPCall(headers) && Object.keys(headers).some((key) => {
53
+ return Object.keys(headers).some((key) => {
54
54
  return key.toLowerCase() === "api-version"
55
55
  })
56
56
  }
package/src/types.ts CHANGED
@@ -40,7 +40,7 @@ export interface VisitRequest {
40
40
  /** The MCP JSON-RPC request method */
41
41
  mcp_request_method?: string
42
42
  /** The MCP request tool name */
43
- mcp_request_tool_name?: string
43
+ mcp_request_name?: string
44
44
  /** The MCP request client name */
45
45
  mcp_request_client_info_name?: string
46
46
  /** The MCP request client version */
@@ -64,10 +64,12 @@ export interface VisitRequest {
64
64
  * Used for batch agent identification with `identifyAgents()`.
65
65
  */
66
66
  export interface IdentificationRequest {
67
- /** An identifier that will be echoed back in the response to match requests with results */
68
- id?: string
69
- /** The HTTP request headers. Sensitive headers are removed before sending. */
67
+ /** A string identifier that will be echoed back in the response. Include this when sending an array to match each result to its request. */
68
+ request_id?: string
69
+ /** An object containing all available HTTP request headers, including `user-agent` when present, any IP-related headers like `x-forwarded-for` or `x-real-ip`, and HTTP message signature headers like `signature-input`, `signature`, and `signature-agent`. */
70
70
  request_headers: IncomingHttpHeaders
71
+ /** The transport-level IP address of the incoming request. Used as a fallback when a valid client IP address cannot be derived from `request_headers`. */
72
+ request_ip?: string
71
73
  /** The path of the incoming request (e.g. `"/products/123"`). */
72
74
  request_path?: string
73
75
  }
@@ -77,13 +79,13 @@ export interface IdentificationRequest {
77
79
  */
78
80
  export interface IdentificationResult {
79
81
  /** The identifier from the request (if provided). */
80
- id?: string
82
+ request_id?: string
81
83
  /**
82
84
  * The identification result:
83
- * - "verified": A known agent was identified and verified
84
- * - "verification_failed": A known agent was identified, but failed verification
85
- * - "not_verifiable": A known agent was identified, but no verification method was available
86
- * - "not_identified": No known agent was identified
85
+ * - "verified": A known agent was identified and verified (its identity was confirmed as authentic)
86
+ * - "verification_failed": A known agent was identified, but failed verification (its identity may have been spoofed)
87
+ * - "not_verifiable": A known agent was identified, but its operator does not provide a known verification method
88
+ * - "not_identified": No known agent was identified (the request may have come from a human)
87
89
  */
88
90
  result: "verified" | "verification_failed" | "not_verifiable" | "not_identified"
89
91
  /** The unique ID of the identified agent. */
@@ -98,12 +100,12 @@ export interface IdentificationResult {
98
100
  operator_name?: string
99
101
  /** Whether the identified agent is disallowed by robots.txt from accessing the `request_path`. */
100
102
  is_disallowed_by_robots_txt?: boolean
101
- /** The autonomous system number associated with the request's IPv4 address. */
103
+ /** The autonomous system number associated with the request's IP address. */
102
104
  asn?: number
103
- /** The operator of the recognized autonomous system associated with the request's IPv4 address. */
105
+ /** The operator of the recognized autonomous system associated with the request's IP address. */
104
106
  asn_operator?: string
105
107
  /**
106
- * The type of the recognized autonomous system associated with the request's IPv4 address:
108
+ * The type of the recognized autonomous system associated with the request's IP address:
107
109
  * - "isp"
108
110
  * - "hosting"
109
111
  * - "business"
@@ -113,6 +115,21 @@ export interface IdentificationResult {
113
115
  asn_type?: "isp" | "hosting" | "business" | "education" | "government"
114
116
  /** An integer from `0` to `99` indicating the strength of heuristic evidence that the request was made by an automated client. Higher scores indicate stronger detected automation signals. A score of `0` means that no automation signals were detected, not that the client is certainly human. */
115
117
  automation_score?: number
118
+ /**
119
+ * Specific automation signals detected for the request. Available to Enterprise plans upon request:
120
+ * - "known_agent_ip": The request came from an IP address associated with a known agent, although no specific agent was identified
121
+ * - "inconsistency": The request contained inconsistent client or browser attributes
122
+ * - "non_browser": The request appears to have been made by a non-browser HTTP client
123
+ * - "automated_browser": The request contains indicators of browser automation
124
+ * - "cloud_service_provider": The request came from cloud or hosting infrastructure
125
+ */
126
+ automation_signals?: Array<
127
+ "known_agent_ip"
128
+ | "inconsistency"
129
+ | "non_browser"
130
+ | "automated_browser"
131
+ | "cloud_service_provider"
132
+ >
116
133
  }
117
134
 
118
135
  /**