(registry: ModelRegistry, pattern: string | undefined)
| 6 | * undefined only when no pattern is given (use pi's configured default). |
| 7 | */ |
| 8 | export function resolveModel(registry: ModelRegistry, pattern: string | undefined) { |
| 9 | if (!pattern) return undefined; |
| 10 | const slash = pattern.indexOf('/'); |
| 11 | const model = |
| 12 | slash !== -1 |
| 13 | ? registry.find(pattern.slice(0, slash), pattern.slice(slash + 1)) |
| 14 | : registry.getAll().find((m) => m.id === pattern); |
| 15 | if (!model) throw new Error(`unknown model: ${pattern}`); |
| 16 | return model; |
| 17 | } |
| 18 | |
| 19 | /** Layer an agent's persona prompt onto a user prompt. The coding-agent SDK has no |
| 20 | * append-system-prompt knob, so the persona is prepended to the first message. */ |
no outgoing calls
no test coverage detected