diff --git a/internal/backend/agent/prompt/engine.go b/internal/backend/agent/prompt/engine.go
index b2f4c40..b9c1e46 100644
--- a/internal/backend/agent/prompt/engine.go
+++ b/internal/backend/agent/prompt/engine.go
@@ -316,7 +316,7 @@ func buildRequestContextUserInfoSection(requestContext *agentv1.RequestContext)
lines = append(lines, "Shell: "+shell)
}
if workspacePaths := env.GetWorkspacePaths(); len(workspacePaths) > 0 {
- lines = append(lines, "Workspace Path: "+strings.TrimSpace(workspacePaths[0]))
+ lines = append(lines, buildWorkspacePathsSection(workspacePaths))
}
isGitRepo := "Unknown"
repositoryInfo := requestContext.GetRepositoryInfo()
@@ -338,6 +338,32 @@ func buildRequestContextUserInfoSection(requestContext *agentv1.RequestContext)
return "\n" + strings.Join(lines, "\n\n") + "\n"
}
+// buildWorkspacePathsSection 构造工作区路径片段。
+//
+// 渲染规则:
+// - 单路径:`Workspace Path: `,与历史格式保持一致;
+// - 多路径:`Workspace Paths:` 起行,后续每行以 `- ` 列出全部路径,顺序保留输入顺序。
+func buildWorkspacePathsSection(workspacePaths []string) string {
+ trimmedPaths := make([]string, 0, len(workspacePaths))
+ for _, path := range workspacePaths {
+ if path = strings.TrimSpace(path); path != "" {
+ trimmedPaths = append(trimmedPaths, path)
+ }
+ }
+ if len(trimmedPaths) == 0 {
+ return ""
+ }
+ if len(trimmedPaths) == 1 {
+ return "Workspace Path: " + trimmedPaths[0]
+ }
+ items := make([]string, 0, len(trimmedPaths)+1)
+ items = append(items, "Workspace Paths:")
+ for _, path := range trimmedPaths {
+ items = append(items, "- "+path)
+ }
+ return strings.Join(items, "\n")
+}
+
// buildRequestContextAgentTranscriptsSection 构造 片段。
func buildRequestContextAgentTranscriptsSection(requestContext *agentv1.RequestContext) string {
if requestContext == nil || requestContext.GetEnv() == nil {