From 490933ccfe277f1560a725ca012517e70175f6e3 Mon Sep 17 00:00:00 2001 From: Yao Lu Date: Sun, 24 May 2026 22:14:33 +0800 Subject: [PATCH] refactor(msgfmt): update cursor agent readiness check - Introduce a new function `isCursorAgentReadyForInitialPrompt` to handle readiness checks specific to the Cursor agent. - Replace the generic readiness check with the new function in the `IsAgentReadyForInitialPrompt` method. - Import the `strings` package for string manipulation in the new readiness check. --- lib/msgfmt/agent_readiness.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/msgfmt/agent_readiness.go b/lib/msgfmt/agent_readiness.go index 38bfaa63..5a3d06f4 100644 --- a/lib/msgfmt/agent_readiness.go +++ b/lib/msgfmt/agent_readiness.go @@ -1,5 +1,7 @@ package msgfmt +import "strings" + func IsAgentReadyForInitialPrompt(agentType AgentType, message string) bool { switch agentType { case AgentTypeClaude: @@ -17,7 +19,7 @@ func IsAgentReadyForInitialPrompt(agentType AgentType, message string) bool { case AgentTypeAmp: return isAmpAgentReadyForInitialPrompt(message) case AgentTypeCursor: - return isGenericAgentReadyForInitialPrompt(message) + return isCursorAgentReadyForInitialPrompt(message) case AgentTypeAuggie: return isGenericAgentReadyForInitialPrompt(message) case AgentTypeAmazonQ: @@ -37,6 +39,15 @@ func isGenericAgentReadyForInitialPrompt(message string) bool { return len(messageWithoutInputBox) != len(message) } +func isCursorAgentReadyForInitialPrompt(message string) bool { + if isGenericAgentReadyForInitialPrompt(message) { + return true + } + normalized, _, _ := normalizeAndGetRuneLineMapping(message) + return strings.Contains(message, "Cursor Agent") && + strings.Contains(string(normalized), "Plan,search,buildanything") +} + func isOpencodeAgentReadyForInitialPrompt(message string) bool { message = trimEmptyLines(message) messageWithoutInputBox := removeOpencodeMessageBox(message)