Adds makeBrowserImageSearchFetcher() — a browser-safe ImageSearchFetcher that POSTs to /api/ai/image-search (relative, same-origin) for inline G() resolution in the batch_design DSL. The server-side fetcher uses absolute URL via getSyncUrl() — not applicable in the browser, where fetch resolves relative paths against window.origin. This helper mirrors the server-side shape but drops the sync-URL dependency, so any browser caller that wants inline image-search can opt in. NOT wired into the default dispatch path. The existing behavior (applyBatchDesignDsl omits the fetcher → empty src → enriched asynchronously by scanAndFillImages) stays the default because per-G() round-trips would blow up latency on batches with many images. This helper is opt-in for callers that accept that trade-off (composition smoke tests, user-opt-in preview modes). Never throws. Returns null on: empty query, network error, non-ok response, non-JSON body, missing/empty results, invalid shape. Callers can drop it in without try/catch wrappers. 16 test cases covering happy path (URL/body/headers/first-of- many) + 11 failure modes + 1 concurrency invariant. |
||
|---|---|---|
| .. | ||
| cli | ||
| desktop | ||
| web | ||