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