( turnId: number | undefined, req: ApprovalRequest, )
| 254 | * diff card and matches the wording used by the Python reference. |
| 255 | */ |
| 256 | export function buildPermissionToolCallUpdate( |
| 257 | turnId: number | undefined, |
| 258 | req: ApprovalRequest, |
| 259 | ): ToolCallUpdate { |
| 260 | const toolCallId = |
| 261 | turnId !== undefined ? acpToolCallId(turnId, req.toolCallId) : req.toolCallId; |
| 262 | const content: ToolCallContent[] = []; |
| 263 | // Diff entry first — diffs and file-io previews carry the most |
| 264 | // context and should land at the top of the approval card. Phase 13.2 |
| 265 | // adds plan_review to the same path so plan markdown surfaces in the |
| 266 | // headline too. |
| 267 | const headlineEntry = displayBlockToAcpContent(req.display); |
| 268 | if (headlineEntry !== null) { |
| 269 | content.push(headlineEntry); |
| 270 | } |
| 271 | // Always include the action summary so the prompt is never empty. |
| 272 | content.push({ |
| 273 | type: 'content', |
| 274 | content: { type: 'text', text: `Requesting approval to ${req.action}` }, |
| 275 | }); |
| 276 | return { |
| 277 | toolCallId, |
| 278 | title: req.toolName, |
| 279 | content, |
| 280 | }; |
| 281 | } |
| 282 | |
| 283 | /** |
| 284 | * Look up the matched {@link PermissionOption}'s display name for the |
no test coverage detected