(formats: unknown)
| 311 | * addition, that mode is dropped (markdown is already requested elsewhere). |
| 312 | */ |
| 313 | export function normalizeMonitorFormats(formats: unknown): unknown[] { |
| 314 | if (!Array.isArray(formats)) return []; |
| 315 | const out: unknown[] = []; |
| 316 | for (const entry of formats) { |
| 317 | if ( |
| 318 | entry && |
| 319 | typeof entry === "object" && |
| 320 | (entry as { type?: unknown }).type === "changeTracking" |
| 321 | ) { |
| 322 | const obj = entry as { |
| 323 | type: "changeTracking"; |
| 324 | modes?: unknown; |
| 325 | schema?: unknown; |
| 326 | prompt?: unknown; |
| 327 | tag?: unknown; |
| 328 | }; |
| 329 | const modes = Array.isArray(obj.modes) ? obj.modes : []; |
| 330 | if (modes.includes("json")) { |
| 331 | out.push({ |
| 332 | type: "json", |
| 333 | ...(typeof obj.prompt === "string" ? { prompt: obj.prompt } : {}), |
| 334 | ...(obj.schema && typeof obj.schema === "object" |
| 335 | ? { schema: obj.schema } |
| 336 | : {}), |
| 337 | }); |
| 338 | } |
| 339 | // git-diff mode is implicit via the markdown format already added. |
| 340 | continue; |
| 341 | } |
| 342 | out.push(entry); |
| 343 | } |
| 344 | return out; |
| 345 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…