vercel-cli 48.0.3__py3-none-any.whl → 48.1.1__py3-none-any.whl
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.
Potentially problematic release.
This version of vercel-cli might be problematic. Click here for more details.
- vercel_cli/vendor/dist/index.js +856 -413
- vercel_cli/vendor/node_modules/.package-lock.json +10 -7
- vercel_cli/vendor/node_modules/@vercel/detect-agent/CHANGELOG.md +19 -0
- vercel_cli/vendor/node_modules/@vercel/detect-agent/README.md +123 -0
- vercel_cli/vendor/node_modules/@vercel/detect-agent/dist/index.d.ts +29 -1
- vercel_cli/vendor/node_modules/@vercel/detect-agent/dist/index.js +28 -11
- vercel_cli/vendor/node_modules/@vercel/detect-agent/package.json +33 -5
- vercel_cli/vendor/node_modules/@vercel/python/dist/index.js +188 -45
- vercel_cli/vendor/node_modules/@vercel/python/package.json +1 -1
- vercel_cli/vendor/package.json +3 -3
- {vercel_cli-48.0.3.dist-info → vercel_cli-48.1.1.dist-info}/METADATA +1 -1
- {vercel_cli-48.0.3.dist-info → vercel_cli-48.1.1.dist-info}/RECORD +14 -12
- {vercel_cli-48.0.3.dist-info → vercel_cli-48.1.1.dist-info}/WHEEL +0 -0
- {vercel_cli-48.0.3.dist-info → vercel_cli-48.1.1.dist-info}/entry_points.txt +0 -0
|
@@ -9,15 +9,18 @@
|
|
|
9
9
|
"license": "Apache-2.0"
|
|
10
10
|
},
|
|
11
11
|
"node_modules/@vercel/detect-agent": {
|
|
12
|
-
"version": "0.
|
|
13
|
-
"resolved": "https://registry.npmjs.org/@vercel/detect-agent/-/detect-agent-0.
|
|
14
|
-
"integrity": "sha512-
|
|
15
|
-
"license": "Apache-2.0"
|
|
12
|
+
"version": "1.0.0",
|
|
13
|
+
"resolved": "https://registry.npmjs.org/@vercel/detect-agent/-/detect-agent-1.0.0.tgz",
|
|
14
|
+
"integrity": "sha512-AIPgNkmtFcDgPCl+xvTT1ga90OL7OTX2RKM4zu0PMpwBthPfN2DpdHy10n3bh8K+CA22GDU0/ncjzprZsrk0sw==",
|
|
15
|
+
"license": "Apache-2.0",
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=14"
|
|
18
|
+
}
|
|
16
19
|
},
|
|
17
20
|
"node_modules/@vercel/python": {
|
|
18
|
-
"version": "5.0.
|
|
19
|
-
"resolved": "https://registry.npmjs.org/@vercel/python/-/python-5.0.
|
|
20
|
-
"integrity": "sha512-
|
|
21
|
+
"version": "5.0.5",
|
|
22
|
+
"resolved": "https://registry.npmjs.org/@vercel/python/-/python-5.0.5.tgz",
|
|
23
|
+
"integrity": "sha512-XLG/fDe2hflzNtSWuoASTo+N2c4hl6SbcufvBRYa7BnBQK9t4ZH1IEu+vJkq2AUoVczp5JEYLEXkIGm8KBtoeg==",
|
|
21
24
|
"license": "Apache-2.0"
|
|
22
25
|
}
|
|
23
26
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @vercel/detect-agent
|
|
2
|
+
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- Change return format to be an object to future proof ([#13965](https://github.com/vercel/vercel/pull/13965))
|
|
8
|
+
|
|
9
|
+
## 0.2.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- Improve agent detection ([#13762](https://github.com/vercel/vercel/pull/13762))
|
|
14
|
+
|
|
15
|
+
## 0.1.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- Initial release ([#13745](https://github.com/vercel/vercel/pull/13745))
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# @vercel/detect-agent
|
|
2
|
+
|
|
3
|
+
A lightweight utility for detecting if code is being executed by an AI agent or automated development environment.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @vercel/detect-agent
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { determineAgent } from '@vercel/detect-agent';
|
|
15
|
+
|
|
16
|
+
const { isAgent, agent } = await determineAgent();
|
|
17
|
+
|
|
18
|
+
if (isAgent) {
|
|
19
|
+
console.log(`Running in ${agent.name} environment`);
|
|
20
|
+
// Adapt behavior for AI agent context
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Supported Agents
|
|
25
|
+
|
|
26
|
+
This package can detect the following AI agents and development environments:
|
|
27
|
+
|
|
28
|
+
- **Custom agents** via `AI_AGENT` environment variable
|
|
29
|
+
- **Cursor** (cursor editor and cursor-cli)
|
|
30
|
+
- **Claude Code** (Anthropic's Claude)
|
|
31
|
+
- **Devin** (Cognition Labs)
|
|
32
|
+
- **Gemini CLI** (Google)
|
|
33
|
+
- **Codex** (OpenAI)
|
|
34
|
+
- **Replit** (online IDE)
|
|
35
|
+
|
|
36
|
+
## The AI_AGENT Standard
|
|
37
|
+
|
|
38
|
+
We're promoting `AI_AGENT` as a universal environment variable standard for AI development tools. This allows any tool or library to easily detect when it's running in an AI-driven environment.
|
|
39
|
+
|
|
40
|
+
### For AI Tool Developers
|
|
41
|
+
|
|
42
|
+
Set the `AI_AGENT` environment variable to identify your tool:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
export AI_AGENT="your-tool-name"
|
|
46
|
+
# or
|
|
47
|
+
AI_AGENT="your-tool-name" your-command
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Recommended Naming Convention
|
|
51
|
+
|
|
52
|
+
- Use lowercase with hyphens for multi-word names
|
|
53
|
+
- Include version information if needed, separated by an `@` symbol
|
|
54
|
+
- Examples: `claude-code`, `cursor-cli`, `devin@1`, `custom-agent@2.0`
|
|
55
|
+
|
|
56
|
+
## Use Cases
|
|
57
|
+
|
|
58
|
+
### Adaptive Behavior
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
import { determineAgent } from '@vercel/detect-agent';
|
|
62
|
+
|
|
63
|
+
async function setupEnvironment() {
|
|
64
|
+
const { isAgent, agent } = await determineAgent();
|
|
65
|
+
|
|
66
|
+
if (isAgent) {
|
|
67
|
+
// Running in AI environment - adjust behavior
|
|
68
|
+
process.env.LOG_LEVEL = 'verbose';
|
|
69
|
+
console.log(`🤖 Detected AI agent: ${agent.name}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Telemetry and Analytics
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import { determineAgent } from '@vercel/detect-agent';
|
|
78
|
+
|
|
79
|
+
async function trackUsage(event: string) {
|
|
80
|
+
const result = await determineAgent();
|
|
81
|
+
|
|
82
|
+
analytics.track(event, {
|
|
83
|
+
agent: result.isAgent ? result.agent.name : 'human',
|
|
84
|
+
timestamp: Date.now(),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Feature Toggles
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
import { determineAgent } from '@vercel/detect-agent';
|
|
93
|
+
|
|
94
|
+
async function shouldEnableFeature(feature: string) {
|
|
95
|
+
const result = await determineAgent();
|
|
96
|
+
|
|
97
|
+
// Enable experimental features for AI agents
|
|
98
|
+
if (result.isAgent && feature === 'experimental-ai-mode') {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Contributing
|
|
107
|
+
|
|
108
|
+
We welcome contributions! Please see our [contributing guidelines](../../CONTRIBUTING.md).
|
|
109
|
+
|
|
110
|
+
### Adding New Agent Support
|
|
111
|
+
|
|
112
|
+
To add support for a new AI agent:
|
|
113
|
+
|
|
114
|
+
1. Add detection logic to `src/index.ts`
|
|
115
|
+
2. Add comprehensive test cases in `test/unit/determine-agent.test.ts`
|
|
116
|
+
3. Update this README with the new agent information
|
|
117
|
+
4. Follow the existing priority order pattern
|
|
118
|
+
|
|
119
|
+
## Links
|
|
120
|
+
|
|
121
|
+
- [GitHub Repository](https://github.com/vercel/vercel/tree/main/packages/detect-agent)
|
|
122
|
+
- [npm Package](https://www.npmjs.com/package/@vercel/detect-agent)
|
|
123
|
+
- [Vercel Documentation](https://vercel.com/docs)
|
|
@@ -1 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
declare const CURSOR: "cursor";
|
|
2
|
+
declare const CURSOR_CLI: "cursor-cli";
|
|
3
|
+
declare const CLAUDE: "claude";
|
|
4
|
+
declare const DEVIN: "devin";
|
|
5
|
+
declare const REPLIT: "replit";
|
|
6
|
+
declare const GEMINI: "gemini";
|
|
7
|
+
declare const CODEX: "codex";
|
|
8
|
+
export type KnownAgentNames = typeof CURSOR | typeof CURSOR_CLI | typeof CLAUDE | typeof DEVIN | typeof REPLIT | typeof GEMINI | typeof CODEX;
|
|
9
|
+
export interface KnownAgentDetails {
|
|
10
|
+
name: KnownAgentNames;
|
|
11
|
+
}
|
|
12
|
+
export type AgentResult = {
|
|
13
|
+
isAgent: true;
|
|
14
|
+
agent: KnownAgentDetails;
|
|
15
|
+
} | {
|
|
16
|
+
isAgent: false;
|
|
17
|
+
agent: undefined;
|
|
18
|
+
};
|
|
19
|
+
export declare const KNOWN_AGENTS: {
|
|
20
|
+
readonly CURSOR: "cursor";
|
|
21
|
+
readonly CURSOR_CLI: "cursor-cli";
|
|
22
|
+
readonly CLAUDE: "claude";
|
|
23
|
+
readonly DEVIN: "devin";
|
|
24
|
+
readonly REPLIT: "replit";
|
|
25
|
+
readonly GEMINI: "gemini";
|
|
26
|
+
readonly CODEX: "codex";
|
|
27
|
+
};
|
|
28
|
+
export declare function determineAgent(): Promise<AgentResult>;
|
|
29
|
+
export {};
|
|
@@ -18,12 +18,13 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var src_exports = {};
|
|
20
20
|
__export(src_exports, {
|
|
21
|
+
KNOWN_AGENTS: () => KNOWN_AGENTS,
|
|
21
22
|
determineAgent: () => determineAgent
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(src_exports);
|
|
24
25
|
var import_promises = require("node:fs/promises");
|
|
25
26
|
var import_node_fs = require("node:fs");
|
|
26
|
-
const
|
|
27
|
+
const DEVIN_LOCAL_PATH = "/opt/.devin";
|
|
27
28
|
const CURSOR = "cursor";
|
|
28
29
|
const CURSOR_CLI = "cursor-cli";
|
|
29
30
|
const CLAUDE = "claude";
|
|
@@ -31,36 +32,52 @@ const DEVIN = "devin";
|
|
|
31
32
|
const REPLIT = "replit";
|
|
32
33
|
const GEMINI = "gemini";
|
|
33
34
|
const CODEX = "codex";
|
|
35
|
+
const KNOWN_AGENTS = {
|
|
36
|
+
CURSOR,
|
|
37
|
+
CURSOR_CLI,
|
|
38
|
+
CLAUDE,
|
|
39
|
+
DEVIN,
|
|
40
|
+
REPLIT,
|
|
41
|
+
GEMINI,
|
|
42
|
+
CODEX
|
|
43
|
+
};
|
|
34
44
|
async function determineAgent() {
|
|
35
45
|
if (process.env.AI_AGENT) {
|
|
36
|
-
|
|
46
|
+
const name = process.env.AI_AGENT.trim();
|
|
47
|
+
if (name) {
|
|
48
|
+
return {
|
|
49
|
+
isAgent: true,
|
|
50
|
+
agent: { name }
|
|
51
|
+
};
|
|
52
|
+
}
|
|
37
53
|
}
|
|
38
54
|
if (process.env.CURSOR_TRACE_ID) {
|
|
39
|
-
return CURSOR;
|
|
55
|
+
return { isAgent: true, agent: { name: CURSOR } };
|
|
40
56
|
}
|
|
41
57
|
if (process.env.CURSOR_AGENT) {
|
|
42
|
-
return CURSOR_CLI;
|
|
58
|
+
return { isAgent: true, agent: { name: CURSOR_CLI } };
|
|
43
59
|
}
|
|
44
60
|
if (process.env.GEMINI_CLI) {
|
|
45
|
-
return GEMINI;
|
|
61
|
+
return { isAgent: true, agent: { name: GEMINI } };
|
|
46
62
|
}
|
|
47
63
|
if (process.env.CODEX_SANDBOX) {
|
|
48
|
-
return CODEX;
|
|
64
|
+
return { isAgent: true, agent: { name: CODEX } };
|
|
49
65
|
}
|
|
50
66
|
if (process.env.CLAUDECODE || process.env.CLAUDE_CODE) {
|
|
51
|
-
return CLAUDE;
|
|
67
|
+
return { isAgent: true, agent: { name: CLAUDE } };
|
|
52
68
|
}
|
|
53
69
|
if (process.env.REPL_ID) {
|
|
54
|
-
return REPLIT;
|
|
70
|
+
return { isAgent: true, agent: { name: REPLIT } };
|
|
55
71
|
}
|
|
56
72
|
try {
|
|
57
|
-
await (0, import_promises.access)(
|
|
58
|
-
return DEVIN;
|
|
73
|
+
await (0, import_promises.access)(DEVIN_LOCAL_PATH, import_node_fs.constants.F_OK);
|
|
74
|
+
return { isAgent: true, agent: { name: DEVIN } };
|
|
59
75
|
} catch (error) {
|
|
60
|
-
return false;
|
|
61
76
|
}
|
|
77
|
+
return { isAgent: false, agent: void 0 };
|
|
62
78
|
}
|
|
63
79
|
// Annotate the CommonJS export names for ESM import in node:
|
|
64
80
|
0 && (module.exports = {
|
|
81
|
+
KNOWN_AGENTS,
|
|
65
82
|
determineAgent
|
|
66
83
|
});
|
|
@@ -1,19 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/detect-agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Detect if code is running in an AI agent or automated development environment",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ai",
|
|
7
|
+
"agent",
|
|
8
|
+
"detection",
|
|
9
|
+
"environment",
|
|
10
|
+
"cursor",
|
|
11
|
+
"claude",
|
|
12
|
+
"devin",
|
|
13
|
+
"automation",
|
|
14
|
+
"ai-agent"
|
|
15
|
+
],
|
|
4
16
|
"license": "Apache-2.0",
|
|
17
|
+
"author": "Vercel",
|
|
5
18
|
"main": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.js",
|
|
24
|
+
"require": "./dist/index.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
6
27
|
"publishConfig": {
|
|
7
28
|
"access": "public"
|
|
8
29
|
},
|
|
9
|
-
"homepage": "https://
|
|
30
|
+
"homepage": "https://github.com/vercel/vercel/tree/main/packages/detect-agent#readme",
|
|
10
31
|
"repository": {
|
|
11
32
|
"type": "git",
|
|
12
33
|
"url": "https://github.com/vercel/vercel.git",
|
|
13
34
|
"directory": "packages/detect-agent"
|
|
14
35
|
},
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/vercel/vercel/issues"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=14"
|
|
41
|
+
},
|
|
15
42
|
"files": [
|
|
16
|
-
"dist"
|
|
43
|
+
"dist",
|
|
44
|
+
"README.md",
|
|
45
|
+
"CHANGELOG.md"
|
|
17
46
|
],
|
|
18
47
|
"dependencies": {},
|
|
19
48
|
"devDependencies": {
|
|
@@ -24,8 +53,7 @@
|
|
|
24
53
|
},
|
|
25
54
|
"scripts": {
|
|
26
55
|
"build": "node ../../utils/build.mjs",
|
|
27
|
-
"
|
|
28
|
-
"vitest-unit": "glob --absolute 'test/unit/**/*.test.ts' 'test/unit/**/*.test.mts'",
|
|
56
|
+
"test": "vitest -c ../../vitest.config.mts",
|
|
29
57
|
"type-check": "tsc --noEmit"
|
|
30
58
|
}
|
|
31
59
|
}
|