🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@vercel/detect-agent

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vercel/detect-agent - npm Package Compare versions

Comparing version
1.2.0-canary.20260211174907.cdd2da6
to
1.2.0
+12
-2
./dist/index.js

@@ -31,2 +31,3 @@ "use strict";

const CLAUDE = "claude";
const COWORK = "cowork";
const DEVIN = "devin";

@@ -36,2 +37,3 @@ const REPLIT = "replit";

const CODEX = "codex";
const ANTIGRAVITY = "antigravity";
const AUGMENT_CLI = "augment-cli";

@@ -43,2 +45,3 @@ const OPENCODE = "opencode";

CLAUDE,
COWORK,
DEVIN,

@@ -48,2 +51,3 @@ REPLIT,

CODEX,
ANTIGRAVITY,
AUGMENT_CLI,

@@ -71,5 +75,8 @@ OPENCODE

}
if (process.env.CODEX_SANDBOX) {
if (process.env.CODEX_SANDBOX || process.env.CODEX_CI || process.env.CODEX_THREAD_ID) {
return { isAgent: true, agent: { name: CODEX } };
}
if (process.env.ANTIGRAVITY_AGENT) {
return { isAgent: true, agent: { name: ANTIGRAVITY } };
}
if (process.env.AUGMENT_AGENT) {

@@ -82,2 +89,5 @@ return { isAgent: true, agent: { name: AUGMENT_CLI } };

if (process.env.CLAUDECODE || process.env.CLAUDE_CODE) {
if (process.env.CLAUDE_CODE_IS_COWORK) {
return { isAgent: true, agent: { name: COWORK } };
}
return { isAgent: true, agent: { name: CLAUDE } };

@@ -91,3 +101,3 @@ }

return { isAgent: true, agent: { name: DEVIN } };
} catch (error) {
} catch (_error) {
}

@@ -94,0 +104,0 @@ return { isAgent: false, agent: void 0 };

# @vercel/detect-agent
## 1.2.0
### Minor Changes
- Add `cowork` as a distinct agent name to differentiate Claude Cowork from Claude Code via the `CLAUDE_CODE_IS_COWORK` environment variable. ([#15441](https://github.com/vercel/vercel/pull/15441))
## 1.1.1
### Patch Changes
- Add Antigravity agent detection via `ANTIGRAVITY_AGENT` environment variable ([#15413](https://github.com/vercel/vercel/pull/15413))
- Detect Codex when `CODEX_CI` or `CODEX_THREAD_ID` is present. ([#15412](https://github.com/vercel/vercel/pull/15412))
## 1.1.0

@@ -4,0 +18,0 @@

declare const CURSOR: "cursor";
declare const CURSOR_CLI: "cursor-cli";
declare const CLAUDE: "claude";
declare const COWORK: "cowork";
declare const DEVIN: "devin";

@@ -8,5 +9,6 @@ declare const REPLIT: "replit";

declare const CODEX: "codex";
declare const ANTIGRAVITY: "antigravity";
declare const AUGMENT_CLI: "augment-cli";
declare const OPENCODE: "opencode";
export type KnownAgentNames = typeof CURSOR | typeof CURSOR_CLI | typeof CLAUDE | typeof DEVIN | typeof REPLIT | typeof GEMINI | typeof CODEX | typeof AUGMENT_CLI | typeof OPENCODE;
export type KnownAgentNames = typeof CURSOR | typeof CURSOR_CLI | typeof CLAUDE | typeof COWORK | typeof DEVIN | typeof REPLIT | typeof GEMINI | typeof CODEX | typeof ANTIGRAVITY | typeof AUGMENT_CLI | typeof OPENCODE;
export interface KnownAgentDetails {

@@ -26,2 +28,3 @@ name: KnownAgentNames;

readonly CLAUDE: "claude";
readonly COWORK: "cowork";
readonly DEVIN: "devin";

@@ -31,2 +34,3 @@ readonly REPLIT: "replit";

readonly CODEX: "codex";
readonly ANTIGRAVITY: "antigravity";
readonly AUGMENT_CLI: "augment-cli";

@@ -33,0 +37,0 @@ readonly OPENCODE: "opencode";

@@ -31,2 +31,3 @@ "use strict";

const CLAUDE = "claude";
const COWORK = "cowork";
const DEVIN = "devin";

@@ -36,2 +37,3 @@ const REPLIT = "replit";

const CODEX = "codex";
const ANTIGRAVITY = "antigravity";
const AUGMENT_CLI = "augment-cli";

@@ -43,2 +45,3 @@ const OPENCODE = "opencode";

CLAUDE,
COWORK,
DEVIN,

@@ -48,2 +51,3 @@ REPLIT,

CODEX,
ANTIGRAVITY,
AUGMENT_CLI,

@@ -71,5 +75,8 @@ OPENCODE

}
if (process.env.CODEX_SANDBOX) {
if (process.env.CODEX_SANDBOX || process.env.CODEX_CI || process.env.CODEX_THREAD_ID) {
return { isAgent: true, agent: { name: CODEX } };
}
if (process.env.ANTIGRAVITY_AGENT) {
return { isAgent: true, agent: { name: ANTIGRAVITY } };
}
if (process.env.AUGMENT_AGENT) {

@@ -82,2 +89,5 @@ return { isAgent: true, agent: { name: AUGMENT_CLI } };

if (process.env.CLAUDECODE || process.env.CLAUDE_CODE) {
if (process.env.CLAUDE_CODE_IS_COWORK) {
return { isAgent: true, agent: { name: COWORK } };
}
return { isAgent: true, agent: { name: CLAUDE } };

@@ -91,3 +101,3 @@ }

return { isAgent: true, agent: { name: DEVIN } };
} catch (error) {
} catch (_error) {
}

@@ -94,0 +104,0 @@ return { isAgent: false, agent: void 0 };

+1
-1
{
"name": "@vercel/detect-agent",
"version": "1.2.0-canary.20260211174907.cdd2da6",
"version": "1.2.0",
"description": "Detect if code is running in an AI agent or automated development environment",

@@ -5,0 +5,0 @@ "keywords": [

@@ -34,2 +34,3 @@ # @vercel/detect-agent

- **Codex** (OpenAI)
- **Antigravity** (Google DeepMind)
- **Replit** (online IDE)

@@ -36,0 +37,0 @@