I figured it out. When returning a result together with a value the return definition of the perform() function needs to include IntentResult like so:
// Works as described ✅
func perform() async throws -> some IntentResult & ReturnsValue<String> {
return .result(value: "Some text")
}
Including just ReturnsValue<String> will result in the exception above and modified version of the intent will nob be picked up by the compiler.
// Incorrect function annotation ❌
func perform() async throws -> some ReturnsValue<String> {
return .result(value: "Some text")
}