Resolve the artifact id from either `id` or the `name` alias some models send.
(args: { id?: string; name?: string })
| 28 | import { startLive, stopLive, stopAllLive, listLive } from '../../artifacts/live-registry.js'; |
| 29 | |
| 30 | const TYPE_VALUES = ['html', 'react', 'svg', 'markdown', 'vue', 'text'] as const; |
| 31 | |
| 32 | /** Resolve the artifact id from either `id` or the `name` alias some models send. */ |
| 33 | function resolveArtifactId(args: { id?: string; name?: string }): string { |
| 34 | const id = (args.id ?? args.name ?? '').trim(); |
| 35 | if (!id) throw new Error('Missing artifact id. Pass id="<artifact-id>" (the id returned by artifact_create).'); |
| 36 | return id; |
| 37 | } |