(params: {
request_id: string
subtype: 'success' | 'error'
error?: string
updated_input?: Record<string, unknown>
permission_updates?: unknown[]
})
| 510 | * Creates a permission response message to send back to a worker |
| 511 | */ |
| 512 | export function createPermissionResponseMessage(params: { |
| 513 | request_id: string |
| 514 | subtype: 'success' | 'error' |
| 515 | error?: string |
| 516 | updated_input?: Record<string, unknown> |
| 517 | permission_updates?: unknown[] |
| 518 | }): PermissionResponseMessage { |
| 519 | if (params.subtype === 'error') { |
| 520 | return { |
| 521 | type: 'permission_response', |
| 522 | request_id: params.request_id, |
| 523 | subtype: 'error', |
| 524 | error: params.error || 'Permission denied', |
| 525 | } |
| 526 | } |
| 527 | return { |
| 528 | type: 'permission_response', |
| 529 | request_id: params.request_id, |
| 530 | subtype: 'success', |
| 531 | response: { |
| 532 | updated_input: params.updated_input, |
| 533 | permission_updates: params.permission_updates, |
| 534 | }, |
| 535 | } |
| 536 | } |
| 537 | |
| 538 | /** |
| 539 | * Checks if a message text contains a permission request |
no outgoing calls
no test coverage detected