openpencil/apps
Fini 90d409207c feat(ai): browser-side G() image-search fetcher (relative URL)
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.
2026-04-22 10:25:00 +08:00
..
cli chore(release): bump to v0.7.4 2026-04-17 19:20:19 +08:00
desktop test(electron): unblock desktop/git tests on git 2.36 + stubbed electron 2026-04-20 01:22:28 +08:00
web feat(ai): browser-side G() image-search fetcher (relative URL) 2026-04-22 10:25:00 +08:00