(followupId: string, completionId: string)
| 30 | } |
| 31 | |
| 32 | const completionAfterAnswer = (followupId: string, completionId: string) => ({ |
| 33 | match: { |
| 34 | predicate: (req: ChatCompletionRequest) => |
| 35 | // Preferred: structured tool-result message carries the followup answer. |
| 36 | toolResultContains(req, followupId, [SUBTASK_CHILD_FOLLOWUP_ANSWER]) || |
| 37 | // Fallback 1: answer present alongside the tool-call ID but not in a role:tool message. |
| 38 | requestContains(req, [followupId, SUBTASK_CHILD_FOLLOWUP_ANSWER]) || |
| 39 | // Fallback 2: answer arrives as a bare user message after task resume (no tool-call ID context). |
| 40 | requestContains(req, [ |
| 41 | SUBTASK_CHILD_MARKER, |
| 42 | `<user_message>\\n${SUBTASK_CHILD_FOLLOWUP_ANSWER}\\n</user_message>`, |
| 43 | ]), |
| 44 | }, |
| 45 | response: { |
| 46 | toolCalls: [ |
| 47 | { |
| 48 | name: "attempt_completion", |
| 49 | arguments: JSON.stringify({ result: "9" }), |
| 50 | id: completionId, |
| 51 | }, |
| 52 | ], |
| 53 | }, |
| 54 | }) |
| 55 | |
| 56 | export function addSubtaskFixtures(mock: InstanceType<typeof LLMock>) { |
| 57 | mock.addFixture({ |
no test coverage detected