(value: string, maxChars: number)
| 221 | } |
| 222 | |
| 223 | function truncateString(value: string, maxChars: number): { value: string; truncated: boolean } { |
| 224 | if (value.length <= maxChars) { |
| 225 | return { value, truncated: false } |
| 226 | } |
| 227 | return { |
| 228 | value: `${value.slice(0, maxChars)}... [truncated ${value.length - maxChars} chars]`, |
| 229 | truncated: true, |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | function normalizeFetchOptions(options?: IsolatedFetchOptions): SecureFetchOptions { |
| 234 | if (!options) return { maxResponseBytes: MAX_FETCH_RESPONSE_BYTES } |