| 2066 | } |
| 2067 | |
| 2068 | const createDenialResults = ( |
| 2069 | denials: ReadonlyArray<ApprovalResult> |
| 2070 | ): ReadonlyArray<Prompt.ToolResultPart> => { |
| 2071 | const results: Array<Prompt.ToolResultPart> = [] |
| 2072 | for (const denial of denials) { |
| 2073 | if (Predicate.isNotUndefined(denial.toolCall)) { |
| 2074 | results.push( |
| 2075 | Prompt.makePart("tool-result", { |
| 2076 | id: denial.toolCallId, |
| 2077 | name: denial.toolCall.name, |
| 2078 | isFailure: true, |
| 2079 | result: { type: "execution-denied", reason: denial.reason }, |
| 2080 | providerExecuted: false |
| 2081 | }) |
| 2082 | ) |
| 2083 | } |
| 2084 | } |
| 2085 | return results |
| 2086 | } |
| 2087 | |
| 2088 | // ============================================================================= |
| 2089 | // Tool Call Resolution |