Commit a45713e
refactor(local-inference): rewrite vision shim against mtmd ABI
Upstream llama.cpp removed `examples/llava/` and consolidated multimodal
under `tools/mtmd/`. Rewrite the desktop dylib build, shim wrappers, and
TS adapter bindings against the mtmd surface.
- Build script: drop `LLAMA_BUILD_EXAMPLES=ON` for vision; enable
`LLAMA_BUILD_MTMD=ON` instead. Replace the cmake target probe loop
(`llava_static`/`llava`/`mtmd`) with a single `--target mtmd` build.
Drop static-lib find for `libllava*.a`/`libclip*.a`; stage shared
`libmtmd.<ext>` next to libllama and link the shim with `-lmtmd`.
Drop `examples/llava` include path; add `tools/mtmd`.
- Shim .h/.c: replace the llava/clip wrappers (eliza_clip_load /
_free, eliza_llava_image_embed_load / _free / _eval) with the mtmd
pointer-style surface (eliza_mtmd_init / _free, _bitmap_init_rgb /
_bitmap_free, _input_chunks_init / _free / _size / _get,
_input_chunk_type / _n_tokens, _tokenize, _encode_chunk,
_output_embd). All gated behind #ifdef ELIZA_ENABLE_VISION.
- Desktop adapter: replace VisionShimSymbols + bindVision with the
mtmd bindings. Rename clip ctx state to mtmd ctx. Stub
describeImage with an actionable error citing the two missing
pieces (JS-side RGB decode via `sharp` — already in app-core but
not this plugin — and an embeddings-batch wrapper for llama_batch).
Add u64 to the FFITypeEnum for the size_t mtmd args.
- FFI_BACKEND_WIREUP_PLAN.md: document mtmd ABI status, remaining
gaps, and runtime smoke-test gate before defaulting on.
Non-vision builds are unchanged: ELIZA_ENABLE_VISION defaults off, no
mtmd target is built, bindVision returns null, and describeImage
throws the existing "vision build flag not set" error.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 8c72568 commit a45713e
5 files changed
Lines changed: 364 additions & 362 deletions
File tree
- packages/app-core/scripts
- desktop-llama-shim
- plugins/plugin-local-inference
- src/services
Lines changed: 76 additions & 89 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
206 | 210 | | |
207 | 211 | | |
208 | 212 | | |
209 | 213 | | |
210 | 214 | | |
211 | 215 | | |
212 | 216 | | |
213 | | - | |
| 217 | + | |
214 | 218 | | |
215 | 219 | | |
| 220 | + | |
216 | 221 | | |
217 | 222 | | |
218 | 223 | | |
| |||
233 | 238 | | |
234 | 239 | | |
235 | 240 | | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
241 | 246 | | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
276 | 262 | | |
277 | 263 | | |
278 | 264 | | |
| |||
304 | 290 | | |
305 | 291 | | |
306 | 292 | | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
307 | 321 | | |
308 | 322 | | |
309 | 323 | | |
| |||
320 | 334 | | |
321 | 335 | | |
322 | 336 | | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
323 | 346 | | |
324 | 347 | | |
325 | 348 | | |
| |||
340 | 363 | | |
341 | 364 | | |
342 | 365 | | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
347 | 369 | | |
348 | 370 | | |
349 | | - | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
389 | 376 | | |
390 | 377 | | |
391 | 378 | | |
| |||
Lines changed: 43 additions & 46 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
607 | 607 | | |
608 | 608 | | |
609 | 609 | | |
610 | | - | |
| 610 | + | |
611 | 611 | | |
612 | 612 | | |
613 | 613 | | |
614 | | - | |
615 | | - | |
| 614 | + | |
616 | 615 | | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
622 | 620 | | |
623 | 621 | | |
| 622 | + | |
624 | 623 | | |
625 | | - | |
626 | | - | |
627 | | - | |
628 | | - | |
629 | | - | |
630 | | - | |
631 | | - | |
632 | | - | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
633 | 631 | | |
| 632 | + | |
634 | 633 | | |
635 | | - | |
636 | | - | |
| 634 | + | |
| 635 | + | |
637 | 636 | | |
| 637 | + | |
638 | 638 | | |
639 | | - | |
640 | | - | |
641 | | - | |
642 | | - | |
643 | | - | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | | - | |
648 | | - | |
649 | | - | |
650 | | - | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
651 | 649 | | |
652 | 650 | | |
653 | | - | |
654 | | - | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
655 | 660 | | |
656 | 661 | | |
657 | | - | |
658 | | - | |
659 | | - | |
660 | | - | |
661 | | - | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | | - | |
667 | | - | |
668 | | - | |
669 | | - | |
670 | | - | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
671 | 665 | | |
672 | 666 | | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
673 | 670 | | |
0 commit comments