Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat(codex): identify agent-browser commands (#17165)

Arvin Xudfbcf44815bc
diff --git a/locales/en-US/plugin.json b/locales/en-US/plugin.json
index 0d03e2bb8ba..a9e8a3124f1 100644
--- a/locales/en-US/plugin.json
+++ b/locales/en-US/plugin.json
@@ -16,6 +16,7 @@
"builtins.codex.collabTool.sendInput": "Message subagent",
"builtins.codex.collabTool.spawnAgent": "Spawn subagent",
"builtins.codex.collabTool.wait": "Wait for subagents",
+ "builtins.codex.commandExecution.agentBrowser": "Operate browser",
"builtins.codex.commandExecution.gitOperation": "Git operation",
"builtins.codex.commandExecution.grep": "Search",
"builtins.codex.commandExecution.noResults": "No results",
diff --git a/locales/zh-CN/plugin.json b/locales/zh-CN/plugin.json
index f3c216acfc8..aab4e85260a 100644
--- a/locales/zh-CN/plugin.json
+++ b/locales/zh-CN/plugin.json
@@ -16,6 +16,7 @@
"builtins.codex.collabTool.sendInput": "发送消息给子代理",
"builtins.codex.collabTool.spawnAgent": "启动子代理",
"builtins.codex.collabTool.wait": "等待子代理",
+ "builtins.codex.commandExecution.agentBrowser": "操作浏览器",
"builtins.codex.commandExecution.gitOperation": "git 操作",
"builtins.codex.commandExecution.grep": "搜索",
"builtins.codex.commandExecution.noResults": "没有结果",
diff --git a/packages/builtin-tools/src/codex/CommandExecutionInspector.tsx b/packages/builtin-tools/src/codex/CommandExecutionInspector.tsx
index 58881deac65..c9d945fb53f 100644
--- a/packages/builtin-tools/src/codex/CommandExecutionInspector.tsx
+++ b/packages/builtin-tools/src/codex/CommandExecutionInspector.tsx
@@ -1,6 +1,6 @@
'use client';
-import { SiGit, SiNodedotjs, SiPython } from '@icons-pack/react-simple-icons';
+import { SiGit, SiGooglechrome, SiNodedotjs, SiPython } from '@icons-pack/react-simple-icons';
import {
createGrepContentInspector,
createReadLocalFileInspector,
@@ -28,9 +28,13 @@ const PROGRAM_DISPLAY: Record<
CodexCommandProgram,
{ icon: ComponentType<{ className?: string; size?: number }>; translationKey: string }
> = {
- git: { icon: SiGit, translationKey: 'builtins.codex.commandExecution.gitOperation' },
- node: { icon: SiNodedotjs, translationKey: 'builtins.codex.commandExecution.runNode' },
- python: { icon: SiPython, translationKey: 'builtins.codex.commandExecution.runPython' },
+ 'agent-browser': {
+ icon: SiGooglechrome,
+ translationKey: 'builtins.codex.commandExecution.agentBrowser',
+ },
+ 'git': { icon: SiGit, translationKey: 'builtins.codex.commandExecution.gitOperation' },
+ 'node': { icon: SiNodedotjs, translationKey: 'builtins.codex.commandExecution.runNode' },
+ 'python': { icon: SiPython, translationKey: 'builtins.codex.commandExecution.runPython' },
};
const SharedGrepInspector = createGrepContentInspector({
noResultsKey: GREP_NO_RESULTS_KEY,
diff --git a/packages/builtin-tools/src/codex/commandExecutionUtils.test.ts b/packages/builtin-tools/src/codex/commandExecutionUtils.test.ts
index bc7f0389b6e..e9272975868 100644
--- a/packages/builtin-tools/src/codex/commandExecutionUtils.test.ts
+++ b/packages/builtin-tools/src/codex/commandExecutionUtils.test.ts
@@ -101,6 +101,15 @@ describe('getCodexGrepCommandDisplay', () => {
});
describe('getCodexCommandProgram', () => {
+ it('classifies agent-browser commands', () => {
+ expect(
+ getCodexCommandProgram('agent-browser --session host9253 --cdp 9253 snapshot -i -C'),
+ ).toBe('agent-browser');
+ expect(getCodexCommandProgram('/usr/local/bin/agent-browser open example.com')).toBe(
+ 'agent-browser',
+ );
+ });
+
it('classifies node commands', () => {
expect(getCodexCommandProgram('node packages/cli/dist/index.js message-gateway stats')).toBe(
'node',
@@ -122,6 +131,9 @@ describe('getCodexCommandProgram', () => {
it('unwraps shell wrappers and skips env assignments', () => {
expect(getCodexCommandProgram('bash -lc "git log --oneline"')).toBe('git');
expect(getCodexCommandProgram('NODE_ENV=production node app.js')).toBe('node');
+ expect(
+ getCodexCommandProgram('AB_TARGET="--session host9253 --cdp 9253" agent-browser snapshot -i'),
+ ).toBe('agent-browser');
});
it('returns undefined for unknown or empty programs', () => {
diff --git a/packages/builtin-tools/src/codex/commandExecutionUtils.ts b/packages/builtin-tools/src/codex/commandExecutionUtils.ts
index 65159e7e640..b802e9e2c64 100644
--- a/packages/builtin-tools/src/codex/commandExecutionUtils.ts
+++ b/packages/builtin-tools/src/codex/commandExecutionUtils.ts
@@ -283,13 +283,14 @@ export const getCodexGrepCommandDisplay = (
};
/** Program families we give a dedicated label + brand icon instead of the generic terminal chip. */
-export type CodexCommandProgram = 'git' | 'node' | 'python';
+export type CodexCommandProgram = 'agent-browser' | 'git' | 'node' | 'python';
const PROGRAM_BY_BASENAME: Record<string, CodexCommandProgram> = {
- git: 'git',
- node: 'node',
- python: 'python',
- python3: 'python',
+ 'agent-browser': 'agent-browser',
+ 'git': 'git',
+ 'node': 'node',
+ 'python': 'python',
+ 'python3': 'python',
};
const ENV_ASSIGNMENT_PATTERN = /^[A-Z_]\w*=/i;
diff --git a/packages/locales/src/default/plugin.ts b/packages/locales/src/default/plugin.ts
index 5eb9f71d9a3..4aae032fbe2 100644
--- a/packages/locales/src/default/plugin.ts
+++ b/packages/locales/src/default/plugin.ts
@@ -116,6 +116,7 @@ export default {
'builtins.codex.collabTool.sendInput': 'Message subagent',
'builtins.codex.collabTool.spawnAgent': 'Spawn subagent',
'builtins.codex.collabTool.wait': 'Wait for subagents',
+ 'builtins.codex.commandExecution.agentBrowser': 'Operate browser',
'builtins.codex.commandExecution.gitOperation': 'Git operation',
'builtins.codex.commandExecution.grep': 'Search',
'builtins.codex.commandExecution.noResults': 'No results',