@tiens.nguyen/gonext-local-worker 1.0.98 → 1.0.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -368,6 +368,16 @@ _PDF_INSTALL_HINT = (
368
368
  "then restart the worker. (See the Instructions page in the web app.)"
369
369
  )
370
370
 
371
+ # WeasyPrint IS installed, but its system libraries (pango/cairo/gobject) couldn't be
372
+ # dlopen'd — almost always because the worker process predates the build that injects
373
+ # the Homebrew library path. A worker restart fixes it.
374
+ _PDF_LIBS_HINT = (
375
+ "PDF engine is installed but its system libraries could not be loaded. "
376
+ "Please RESTART the local worker — it automatically points WeasyPrint at the "
377
+ "Homebrew libraries (/opt/homebrew/lib on Apple Silicon, /usr/local/lib on Intel). "
378
+ "If it still fails, confirm `brew install pango libffi` succeeded."
379
+ )
380
+
371
381
  # Font stack with color-emoji fallbacks last, so WeasyPrint resolves emoji/flag
372
382
  # codepoints (🏆 🇿🇦) to a color font per-glyph while text uses a clean sans-serif.
373
383
  _PDF_FONT_STACK = (
@@ -385,9 +395,16 @@ def _render_pdf_bytes(markdown_text: str, title: str = "") -> bytes:
385
395
  """
386
396
  try:
387
397
  import markdown as _md
398
+ except Exception: # noqa: BLE001 — markdown pip pkg missing
399
+ raise RuntimeError(_PDF_INSTALL_HINT)
400
+ try:
388
401
  from weasyprint import HTML as _HTML # pulls pango/cairo via cffi at import
389
- except Exception: # noqa: BLE001 — missing python pkg OR system libs (cffi OSError)
402
+ except ModuleNotFoundError:
403
+ # WeasyPrint itself isn't pip-installed.
390
404
  raise RuntimeError(_PDF_INSTALL_HINT)
405
+ except Exception as e: # noqa: BLE001 — installed but cffi can't dlopen the system libs
406
+ _log(f"weasyprint lib load failed: {type(e).__name__}: {str(e)[:200]}")
407
+ raise RuntimeError(_PDF_LIBS_HINT)
391
408
 
392
409
  body_html = _md.markdown(
393
410
  markdown_text or "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiens.nguyen/gonext-local-worker",
3
- "version": "1.0.98",
3
+ "version": "1.0.99",
4
4
  "description": "Polls GoNext cloud API for async local LLM jobs and runs them against Ollama/OpenAI-compatible servers on this Mac",
5
5
  "type": "module",
6
6
  "license": "MIT",