Skip to content

Commit a4c91a0

Browse files
committed
fix(task): include request text in api_req_started for tool detection in e2e tests
1 parent c92e855 commit a4c91a0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/core/task/Task.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,10 +1793,18 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
17931793
const modelId = getModelId(this.apiConfiguration)
17941794
const apiProtocol = getApiProtocol(this.apiConfiguration.apiProvider, modelId)
17951795

1796+
// Include a summary of the current user request so integration tests can detect tool execution intent.
1797+
const requestText = currentUserContent
1798+
.map((block) => (block.type === "text" ? block.text : ""))
1799+
.filter(Boolean)
1800+
.join("\n")
1801+
.trim()
1802+
17961803
await this.say(
17971804
"api_req_started",
17981805
JSON.stringify({
17991806
apiProtocol,
1807+
request: requestText,
18001808
}),
18011809
)
18021810

@@ -1834,7 +1842,9 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
18341842
// message.
18351843
const lastApiReqIndex = findLastIndex(this.clineMessages, (m) => m.say === "api_req_started")
18361844

1845+
const existingApiReqData = JSON.parse(this.clineMessages[lastApiReqIndex].text || "{}")
18371846
this.clineMessages[lastApiReqIndex].text = JSON.stringify({
1847+
...existingApiReqData,
18381848
apiProtocol,
18391849
} satisfies ClineApiReqInfo)
18401850

0 commit comments

Comments
 (0)