@knownagents/sdk 2.3.0 → 2.4.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 +25 -10
- package/dist/KnownAgents.d.ts.map +1 -1
- package/dist/KnownAgents.js +1 -0
- package/dist/types.d.ts +22 -11
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/KnownAgents.ts +1 -0
- package/src/types.ts +28 -11
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
|
-
|
|
140
|
+
request_id: "request-1",
|
|
141
141
|
request_headers: request1.headers,
|
|
142
142
|
request_path: request1.url
|
|
143
143
|
},
|
|
144
144
|
{
|
|
145
|
-
|
|
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
|
-
- `
|
|
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
|
|
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
|
|
167
|
-
- `asn_operator`: The operator of the recognized autonomous system associated with the request's
|
|
168
|
-
- `asn_type`: The type of the recognized autonomous system associated with the request's
|
|
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,oBAAoB,EACpB,kBAAkB,EAClB,8BAA8B,EAC9B,YAAY,EACf,MAAM,SAAS,CAAA;AAKhB;;GAEG;AACH,qBAAa,WAAW;IACpB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAQ;IACpC,OAAO,CAAC,QAAQ,CAAC,2BAA2B,CAAQ;IACpD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAQ;IACvC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAqB;IAChD,OAAO,CAAC,YAAY,CAA4B;IAChD,OAAO,CAAC,mBAAmB,CAAmC;IAE9D;;;;;OAKG;gBACS,WAAW,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB;IAMjE;;;;;;;;OAQG;IACH,uBAAuB,CAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,8BAA8B,GAAG,IAAI;IAoC3H;;;;;;;;;OASG;IACH,YAAY,CAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,6BAA6B,GAAG,IAA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E,cAAc,EAAE,SAAS,EAAE,6BAA6B,GAAG,IAAI;IAoEhH;;;;;;OAMG;IACH,WAAW,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,IAAI;IA2B3C;;;;;OAKG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAmBtB;;;;;;;;;OASG;IACG,iBAAiB,CAAC,UAAU,EAAE,SAAS,EAAE,EAAE,QAAQ,GAAE,MAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IAoBzF;;;;;;;OAOG;IACG,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAqB5E;;;;;;;OAOG;IACG,cAAc,CAAC,QAAQ,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAsBxF,OAAO,CAAC,aAAa;YAaP,UAAU;CAmB3B"}
|
package/dist/KnownAgents.js
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -60,10 +60,12 @@ export interface VisitRequest {
|
|
|
60
60
|
* Used for batch agent identification with `identifyAgents()`.
|
|
61
61
|
*/
|
|
62
62
|
export interface IdentificationRequest {
|
|
63
|
-
/**
|
|
64
|
-
|
|
65
|
-
/**
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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.
|
package/dist/types.d.ts.map
CHANGED
|
@@ -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,MAAM,CAAA;IACpC,sFAAsF;IACtF,cAAc,CAAC,EAAE,MAAM,CAAA;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC3C,6BAA6B;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACzC,6BAA6B;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC5C;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IACzB,2EAA2E;IAC3E,YAAY,EAAE,MAAM,CAAA;IACpB,2CAA2C;IAC3C,cAAc,EAAE,MAAM,CAAA;IACtB,8EAA8E;IAC9E,eAAe,EAAE,mBAAmB,CAAA;IACpC,oDAA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AC7C,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
|
+
"version": "2.4.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"
|
package/src/KnownAgents.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -64,10 +64,12 @@ export interface VisitRequest {
|
|
|
64
64
|
* Used for batch agent identification with `identifyAgents()`.
|
|
65
65
|
*/
|
|
66
66
|
export interface IdentificationRequest {
|
|
67
|
-
/**
|
|
68
|
-
|
|
69
|
-
/**
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
/**
|