(source: Buffer, objectBounds: BufferJsonValueBounds | null, field: string)
| 613 | } |
| 614 | |
| 615 | function readJsonNumberFieldBuffer(source: Buffer, objectBounds: BufferJsonValueBounds | null, field: string): number | undefined { |
| 616 | if (!objectBounds || objectBounds.kind !== 'object') return undefined |
| 617 | const bounds = findObjectFieldValueBuffer(source, objectBounds.start, objectBounds.end, field) |
| 618 | if (!bounds) return undefined |
| 619 | const value = Number(source.subarray(bounds.start, bounds.end).toString('ascii')) |
| 620 | return Number.isFinite(value) ? value : undefined |
| 621 | } |
| 622 | |
| 623 | function parseLargeUsageBuffer(source: Buffer, usageBounds: BufferJsonValueBounds | null) { |
| 624 | const usage: AssistantMessageContent['usage'] = { |
no test coverage detected