the claude code sourcemaps leaked march 31
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 72 lines 2.8 kB view raw
1import { feature } from 'bun:bundle' 2import { getIsNonInteractiveSession } from '../../bootstrap/state.js' 3import { getFeatureValue_CACHED_MAY_BE_STALE } from '../../services/analytics/growthbook.js' 4import { isEnvTruthy } from '../../utils/envUtils.js' 5import { CLAUDE_CODE_GUIDE_AGENT } from './built-in/claudeCodeGuideAgent.js' 6import { EXPLORE_AGENT } from './built-in/exploreAgent.js' 7import { GENERAL_PURPOSE_AGENT } from './built-in/generalPurposeAgent.js' 8import { PLAN_AGENT } from './built-in/planAgent.js' 9import { STATUSLINE_SETUP_AGENT } from './built-in/statuslineSetup.js' 10import { VERIFICATION_AGENT } from './built-in/verificationAgent.js' 11import type { AgentDefinition } from './loadAgentsDir.js' 12 13export function areExplorePlanAgentsEnabled(): boolean { 14 if (feature('BUILTIN_EXPLORE_PLAN_AGENTS')) { 15 // 3P default: true — Bedrock/Vertex keep agents enabled (matches pre-experiment 16 // external behavior). A/B test treatment sets false to measure impact of removal. 17 return getFeatureValue_CACHED_MAY_BE_STALE('tengu_amber_stoat', true) 18 } 19 return false 20} 21 22export function getBuiltInAgents(): AgentDefinition[] { 23 // Allow disabling all built-in agents via env var (useful for SDK users who want a blank slate) 24 // Only applies in noninteractive mode (SDK/API usage) 25 if ( 26 isEnvTruthy(process.env.CLAUDE_AGENT_SDK_DISABLE_BUILTIN_AGENTS) && 27 getIsNonInteractiveSession() 28 ) { 29 return [] 30 } 31 32 // Use lazy require inside the function body to avoid circular dependency 33 // issues at module init time. The coordinatorMode module depends on tools 34 // which depend on AgentTool which imports this file. 35 if (feature('COORDINATOR_MODE')) { 36 if (isEnvTruthy(process.env.CLAUDE_CODE_COORDINATOR_MODE)) { 37 /* eslint-disable @typescript-eslint/no-require-imports */ 38 const { getCoordinatorAgents } = 39 require('../../coordinator/workerAgent.js') as typeof import('../../coordinator/workerAgent.js') 40 /* eslint-enable @typescript-eslint/no-require-imports */ 41 return getCoordinatorAgents() 42 } 43 } 44 45 const agents: AgentDefinition[] = [ 46 GENERAL_PURPOSE_AGENT, 47 STATUSLINE_SETUP_AGENT, 48 ] 49 50 if (areExplorePlanAgentsEnabled()) { 51 agents.push(EXPLORE_AGENT, PLAN_AGENT) 52 } 53 54 // Include Code Guide agent for non-SDK entrypoints 55 const isNonSdkEntrypoint = 56 process.env.CLAUDE_CODE_ENTRYPOINT !== 'sdk-ts' && 57 process.env.CLAUDE_CODE_ENTRYPOINT !== 'sdk-py' && 58 process.env.CLAUDE_CODE_ENTRYPOINT !== 'sdk-cli' 59 60 if (isNonSdkEntrypoint) { 61 agents.push(CLAUDE_CODE_GUIDE_AGENT) 62 } 63 64 if ( 65 feature('VERIFICATION_AGENT') && 66 getFeatureValue_CACHED_MAY_BE_STALE('tengu_hive_evidence', false) 67 ) { 68 agents.push(VERIFICATION_AGENT) 69 } 70 71 return agents 72}