mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 13:47:19 +08:00
feat: store plan.md file in appropriate configuration folders (#12713)
This commit is contained in:
@@ -569,6 +569,28 @@ class LiveStatusAppConversationService(AppConversationServiceBase):
|
||||
if not request.llm_model and parent_info.llm_model:
|
||||
request.llm_model = parent_info.llm_model
|
||||
|
||||
def _compute_plan_path(
|
||||
self,
|
||||
working_dir: str,
|
||||
git_provider: ProviderType | None,
|
||||
) -> str:
|
||||
"""Compute the PLAN.md path based on provider type.
|
||||
|
||||
Args:
|
||||
working_dir: The workspace working directory
|
||||
git_provider: The git provider type (GitHub, GitLab, Azure DevOps, etc.)
|
||||
|
||||
Returns:
|
||||
Absolute path to PLAN.md file in the appropriate config directory
|
||||
"""
|
||||
# GitLab and Azure DevOps use agents-tmp-config (since .agents_tmp is invalid)
|
||||
if git_provider in (ProviderType.GITLAB, ProviderType.AZURE_DEVOPS):
|
||||
config_dir = 'agents-tmp-config'
|
||||
else:
|
||||
config_dir = '.agents_tmp'
|
||||
|
||||
return f'{working_dir}/{config_dir}/PLAN.md'
|
||||
|
||||
async def _setup_secrets_for_git_providers(self, user: UserInfo) -> dict:
|
||||
"""Set up secrets for all git provider authentication.
|
||||
|
||||
@@ -855,6 +877,8 @@ class LiveStatusAppConversationService(AppConversationServiceBase):
|
||||
mcp_config: dict,
|
||||
condenser_max_size: int | None,
|
||||
secrets: dict[str, SecretValue] | None = None,
|
||||
git_provider: ProviderType | None = None,
|
||||
working_dir: str | None = None,
|
||||
) -> Agent:
|
||||
"""Create an agent with appropriate tools and context based on agent type.
|
||||
|
||||
@@ -865,6 +889,8 @@ class LiveStatusAppConversationService(AppConversationServiceBase):
|
||||
mcp_config: MCP configuration dictionary
|
||||
condenser_max_size: condenser_max_size setting
|
||||
secrets: Optional dictionary of secrets for authentication
|
||||
git_provider: Optional git provider type for computing plan path
|
||||
working_dir: Optional working directory for computing plan path
|
||||
|
||||
Returns:
|
||||
Configured Agent instance with context
|
||||
@@ -874,9 +900,14 @@ class LiveStatusAppConversationService(AppConversationServiceBase):
|
||||
|
||||
# Create agent based on type
|
||||
if agent_type == AgentType.PLAN:
|
||||
# Compute plan path if working_dir is provided
|
||||
plan_path = None
|
||||
if working_dir:
|
||||
plan_path = self._compute_plan_path(working_dir, git_provider)
|
||||
|
||||
agent = Agent(
|
||||
llm=llm,
|
||||
tools=get_planning_tools(),
|
||||
tools=get_planning_tools(plan_path=plan_path),
|
||||
system_prompt_filename='system_prompt_planning.j2',
|
||||
system_prompt_kwargs={'plan_structure': format_plan_structure()},
|
||||
condenser=condenser,
|
||||
@@ -1153,6 +1184,8 @@ class LiveStatusAppConversationService(AppConversationServiceBase):
|
||||
mcp_config,
|
||||
user.condenser_max_size,
|
||||
secrets=secrets,
|
||||
git_provider=git_provider,
|
||||
working_dir=working_dir,
|
||||
)
|
||||
|
||||
# Finalize and return the conversation request
|
||||
|
||||
Reference in New Issue
Block a user