@zapier/zapier-sdk 0.76.0 → 0.76.2

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.
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Detects which AI coding agent is executing the current process by inspecting
3
+ * well-known environment variables set by each agent's runtime.
4
+ *
5
+ * Claude Code
6
+ * CLAUDECODE — set to "1" in all subprocesses spawned by Claude Code
7
+ * https://code.claude.com/docs/en/env-vars
8
+ *
9
+ * GitHub Copilot
10
+ * COPILOT_AGENT — set to "1" in VS Code agent terminal sessions
11
+ * https://github.com/microsoft/vscode/pull/316267
12
+ *
13
+ * Cursor
14
+ * CURSOR_AGENT — set to "1" by Cursor when executing terminal commands
15
+ * https://cursor.com/docs/agent/tools/terminal
16
+ *
17
+ * Codex CLI
18
+ * CODEX_SANDBOX — set to "seatbelt" (macOS) or a non-empty string (Linux/Windows)
19
+ * https://github.com/openai/codex/blob/main/codex-rs/core/src/spawn.rs
20
+ *
21
+ * Gemini CLI
22
+ * GEMINI_CLI — set to "1" in subprocesses spawned by Gemini CLI's shell tool
23
+ * https://github.com/google-gemini/gemini-cli/blob/main/packages/core/src/services/shellExecutionService.ts
24
+ *
25
+ * Augment
26
+ * AUGMENT_AGENT — set to "1" when Auggie executes shell commands via its launch-process tool
27
+ * https://docs.augmentcode.com/cli/reference
28
+ *
29
+ * Cline
30
+ * CLINE_ACTIVE — set to "true" when Cline is executing terminal commands
31
+ * https://github.com/cline/cline/pull/5367
32
+ *
33
+ * OpenCode
34
+ * OPENCODE_CLIENT — client identifier set by OpenCode (defaults to "cli")
35
+ * https://anomalyco-opencode.mintlify.app/cli/overview#environment-variables
36
+ *
37
+ * Returns null if no known agent is detected or process is unavailable.
38
+ *
39
+ * Never throws: try/catch guards against exotic environments (e.g. a Proxy on
40
+ * globalThis.process) where property access could unexpectedly fail. Event
41
+ * emission must never cascade into a thrown exception.
42
+ */
43
+ export declare function getAgent(): string | null;
44
+ //# sourceMappingURL=agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/utils/agent.ts"],"names":[],"mappings":"AA0BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,QAAQ,IAAI,MAAM,GAAG,IAAI,CAgBxC"}
@@ -0,0 +1,76 @@
1
+ // Matches "1" or "true" (case-insensitive).
2
+ const isTruthy = (value) => {
3
+ const lower = value.toLowerCase();
4
+ return lower === "1" || lower === "true";
5
+ };
6
+ // Any non-empty string — for vars whose value is meaningful rather than boolean.
7
+ const isNonEmpty = (value) => value !== "";
8
+ const agentDetectors = [
9
+ { name: "claude-code", key: "CLAUDECODE", predicate: isTruthy },
10
+ { name: "github-copilot", key: "COPILOT_AGENT", predicate: isTruthy },
11
+ { name: "cursor", key: "CURSOR_AGENT", predicate: isTruthy },
12
+ { name: "codex", key: "CODEX_SANDBOX", predicate: isNonEmpty },
13
+ { name: "gemini-cli", key: "GEMINI_CLI", predicate: isTruthy },
14
+ { name: "augment", key: "AUGMENT_AGENT", predicate: isTruthy },
15
+ { name: "cline", key: "CLINE_ACTIVE", predicate: isTruthy },
16
+ { name: "opencode", key: "OPENCODE_CLIENT", predicate: isNonEmpty },
17
+ ];
18
+ /**
19
+ * Detects which AI coding agent is executing the current process by inspecting
20
+ * well-known environment variables set by each agent's runtime.
21
+ *
22
+ * Claude Code
23
+ * CLAUDECODE — set to "1" in all subprocesses spawned by Claude Code
24
+ * https://code.claude.com/docs/en/env-vars
25
+ *
26
+ * GitHub Copilot
27
+ * COPILOT_AGENT — set to "1" in VS Code agent terminal sessions
28
+ * https://github.com/microsoft/vscode/pull/316267
29
+ *
30
+ * Cursor
31
+ * CURSOR_AGENT — set to "1" by Cursor when executing terminal commands
32
+ * https://cursor.com/docs/agent/tools/terminal
33
+ *
34
+ * Codex CLI
35
+ * CODEX_SANDBOX — set to "seatbelt" (macOS) or a non-empty string (Linux/Windows)
36
+ * https://github.com/openai/codex/blob/main/codex-rs/core/src/spawn.rs
37
+ *
38
+ * Gemini CLI
39
+ * GEMINI_CLI — set to "1" in subprocesses spawned by Gemini CLI's shell tool
40
+ * https://github.com/google-gemini/gemini-cli/blob/main/packages/core/src/services/shellExecutionService.ts
41
+ *
42
+ * Augment
43
+ * AUGMENT_AGENT — set to "1" when Auggie executes shell commands via its launch-process tool
44
+ * https://docs.augmentcode.com/cli/reference
45
+ *
46
+ * Cline
47
+ * CLINE_ACTIVE — set to "true" when Cline is executing terminal commands
48
+ * https://github.com/cline/cline/pull/5367
49
+ *
50
+ * OpenCode
51
+ * OPENCODE_CLIENT — client identifier set by OpenCode (defaults to "cli")
52
+ * https://anomalyco-opencode.mintlify.app/cli/overview#environment-variables
53
+ *
54
+ * Returns null if no known agent is detected or process is unavailable.
55
+ *
56
+ * Never throws: try/catch guards against exotic environments (e.g. a Proxy on
57
+ * globalThis.process) where property access could unexpectedly fail. Event
58
+ * emission must never cascade into a thrown exception.
59
+ */
60
+ export function getAgent() {
61
+ try {
62
+ const env = globalThis.process?.env;
63
+ if (!env)
64
+ return null;
65
+ for (const detector of agentDetectors) {
66
+ const value = env[detector.key];
67
+ if (value !== undefined && detector.predicate(value)) {
68
+ return detector.name;
69
+ }
70
+ }
71
+ return null;
72
+ }
73
+ catch {
74
+ return null;
75
+ }
76
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk",
3
- "version": "0.76.0",
3
+ "version": "0.76.2",
4
4
  "description": "Complete Zapier SDK - combines all Zapier SDK packages",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",