(
updatedInput: Record<string, unknown>,
permissionUpdates: PermissionUpdate[],
feedback?: string,
contentBlocks?: ContentBlockParam[],
)
| 248 | resolve({ behavior: 'ask', message: SUBAGENT_REJECT_MESSAGE }) |
| 249 | }, |
| 250 | async onAllow( |
| 251 | updatedInput: Record<string, unknown>, |
| 252 | permissionUpdates: PermissionUpdate[], |
| 253 | feedback?: string, |
| 254 | contentBlocks?: ContentBlockParam[], |
| 255 | ) { |
| 256 | if (decisionMade) return |
| 257 | decisionMade = true |
| 258 | abortController.signal.removeEventListener( |
| 259 | 'abort', |
| 260 | onAbortListener, |
| 261 | ) |
| 262 | reportPermissionWait() |
| 263 | persistPermissionUpdates(permissionUpdates) |
| 264 | // Write back permission updates to the leader's shared context |
| 265 | if (permissionUpdates.length > 0) { |
| 266 | const setToolPermissionContext = |
| 267 | getLeaderSetToolPermissionContext() |
| 268 | if (setToolPermissionContext) { |
| 269 | const currentAppState = toolUseContext.getAppState() |
| 270 | const updatedContext = applyPermissionUpdates( |
| 271 | currentAppState.toolPermissionContext, |
| 272 | permissionUpdates, |
| 273 | ) |
| 274 | // Preserve the leader's mode to prevent workers' |
| 275 | // transformed 'acceptEdits' context from leaking back |
| 276 | // to the coordinator |
| 277 | setToolPermissionContext(updatedContext, { |
| 278 | preserveMode: true, |
| 279 | }) |
| 280 | } |
| 281 | } |
| 282 | const trimmedFeedback = feedback?.trim() |
| 283 | resolve({ |
| 284 | behavior: 'allow', |
| 285 | updatedInput, |
| 286 | userModified: false, |
| 287 | acceptFeedback: trimmedFeedback || undefined, |
| 288 | ...(contentBlocks && |
| 289 | contentBlocks.length > 0 && { contentBlocks }), |
| 290 | }) |
| 291 | }, |
| 292 | onReject(feedback?: string, contentBlocks?: ContentBlockParam[]) { |
| 293 | if (decisionMade) return |
| 294 | decisionMade = true |
nothing calls this directly
no test coverage detected