( messages: Message[], state: ContentReplacementState | undefined, writeToTranscript?: (records: ToolResultReplacementRecord[]) => void, skipToolNames?: ReadonlySet<string>, )
| 922 | * when the feature is off or no replacement occurred. |
| 923 | */ |
| 924 | export async function applyToolResultBudget( |
| 925 | messages: Message[], |
| 926 | state: ContentReplacementState | undefined, |
| 927 | writeToTranscript?: (records: ToolResultReplacementRecord[]) => void, |
| 928 | skipToolNames?: ReadonlySet<string>, |
| 929 | ): Promise<Message[]> { |
| 930 | if (!state) return messages |
| 931 | const result = await enforceToolResultBudget(messages, state, skipToolNames) |
| 932 | if (result.newlyReplaced.length > 0) { |
| 933 | writeToTranscript?.(result.newlyReplaced) |
| 934 | } |
| 935 | return result.messages |
| 936 | } |
| 937 | |
| 938 | /** |
| 939 | * Reconstruct replacement state from content-replacement records loaded from |
no test coverage detected