🤯 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(hetero): run Claude Code under the lobehub entrypoint (#22573)
Mocha3bdbad730ee2
diff --git a/packages/heterogeneous-agents/src/spawn/presetEnv.ts b/packages/heterogeneous-agents/src/spawn/presetEnv.tsindex e19145e566d..cb3a16fae75 100644--- a/packages/heterogeneous-agents/src/spawn/presetEnv.ts+++ b/packages/heterogeneous-agents/src/spawn/presetEnv.ts@@ -12,8 +12,19 @@ const HETEROGENEOUS_AGENT_PRESET_ENV: Partial<Record<string, Readonly<Record<str* Our runs send the prompt at spawn and usually exit after one turn, so those* tools never reach the model. Waiting costs about 1.5s per turn and is* capped by `MCP_CONNECT_TIMEOUT_MS` (5s by default) when a server hangs.+ *+ * `claude -p` reports the `sdk-cli` entrypoint (the Agent SDK `sdk-ts`), and+ * that entrypoint's usage weighs about twice as much against a subscription's+ * 5-hour window. Report our own entrypoint instead (`cli` would be rewritten+ * to `sdk-cli` in print mode). Any entrypoint other than `sdk-cli` also makes+ * Claude Code spend an extra model request naming the terminal title, so+ * turn that off.*/- 'claude-code': { MCP_CONNECTION_NONBLOCKING: 'false' },+ 'claude-code': {+ CLAUDE_CODE_DISABLE_TERMINAL_TITLE: '1',+ CLAUDE_CODE_ENTRYPOINT: 'lobehub',+ MCP_CONNECTION_NONBLOCKING: 'false',+ },/** A one-shot print-mode process cannot reliably service background tasks. */'codebuddy': { CODEBUDDY_CODE_DISABLE_BACKGROUND_TASKS: '1' },};diff --git a/packages/heterogeneous-agents/src/spawn/spawnAgent.presetEnv.test.ts b/packages/heterogeneous-agents/src/spawn/spawnAgent.presetEnv.test.tsindex 4c50e74bb07..147d87f4619 100644--- a/packages/heterogeneous-agents/src/spawn/spawnAgent.presetEnv.test.ts+++ b/packages/heterogeneous-agents/src/spawn/spawnAgent.presetEnv.test.ts@@ -60,6 +60,19 @@ describe('spawnAgent preset env', () => {expect(env.MCP_CONNECTION_NONBLOCKING).toBe('false');});+ // `claude -p` defaults to the `sdk-cli` entrypoint, whose usage weighs about+ // twice as much against the subscription's 5-hour window.+ it('runs Claude Code under the lobehub entrypoint', async () => {+ vi.stubEnv('CLAUDE_CODE_ENTRYPOINT', 'cli');+ vi.stubEnv('CLAUDE_CODE_DISABLE_TERMINAL_TITLE', undefined);++ const env = await spawnClaudeCode();++ expect(env.CLAUDE_CODE_ENTRYPOINT).toBe('lobehub');+ // A non-`sdk-cli` entrypoint otherwise spends an extra request naming the session.+ expect(env.CLAUDE_CODE_DISABLE_TERMINAL_TITLE).toBe('1');+ });+it('lets an agent-configured env override the preset', async () => {const env = await spawnClaudeCode({ MCP_CONNECTION_NONBLOCKING: 'true' });