(input: PtyCreateBody | PtyResizeBody)
| 202 | `commit-co-author: failed to configure git hook: ${error instanceof Error ? error.message : String(error)}` |
| 203 | ); |
| 204 | return errorResponse('SEND_ERROR', 'Failed to configure git commit attribution', 500); |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | async function readJsonBody<T>(req: Request, defaultValue: T): Promise<T> { |
| 209 | const text = await req.text(); |
| 210 | if (!text.trim()) return defaultValue; |
| 211 | return JSON.parse(text) as T; |
| 212 | } |
| 213 | |
| 214 | function validatePtyId(ptyId: string | undefined): string | null { |
| 215 | if (!ptyId || !PTY_ID_RE.test(ptyId)) return null; |
| 216 | return ptyId; |
| 217 | } |
| 218 | |
| 219 | function parsePtySize(input: PtyCreateBody | PtyResizeBody): WrapperPtySize | null { |
| 220 | const rows = 'size' in input && input.size ? input.size.rows : input.rows; |
| 221 | const cols = 'size' in input && input.size ? input.size.cols : input.cols; |
| 222 | |
| 223 | if (rows === undefined && cols === undefined) return null; |
| 224 | |
| 225 | if ( |
| 226 | typeof rows !== 'number' || |
| 227 | typeof cols !== 'number' || |
| 228 | !Number.isInteger(rows) || |
| 229 | !Number.isInteger(cols) || |
no outgoing calls
no test coverage detected