(input: string, maximumBytes: number)
| 48 | export class Service extends Context.Service<Service, Interface>()("@opencode/v2/ToolOutputStore") {} |
| 49 | |
| 50 | const takePrefix = (input: string, maximumBytes: number) => { |
| 51 | let bytes = 0 |
| 52 | let content = "" |
| 53 | for (const char of input) { |
| 54 | const size = Buffer.byteLength(char, "utf-8") |
| 55 | if (bytes + size > maximumBytes) break |
| 56 | content += char |
| 57 | bytes += size |
| 58 | } |
| 59 | return content |
| 60 | } |
| 61 | |
| 62 | const takeSuffix = (input: string, maximumBytes: number) => { |
| 63 | let bytes = 0 |
no outgoing calls
no test coverage detected