@tiens.nguyen/gonext-local-worker 1.0.95 → 1.0.96

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.
@@ -407,6 +407,21 @@ def _render_pdf_bytes(markdown_text: str, title: str = "") -> bytes:
407
407
  return out.getvalue()
408
408
 
409
409
 
410
+ def _ssl_context():
411
+ """SSL context backed by certifi's CA bundle.
412
+
413
+ macOS Python (python.org / Homebrew) doesn't use the system keychain, so urllib's
414
+ default verification fails with CERTIFICATE_VERIFY_FAILED. certifi ships with the
415
+ openai/httpx stack the worker already depends on.
416
+ """
417
+ import ssl
418
+ try:
419
+ import certifi
420
+ return ssl.create_default_context(cafile=certifi.where())
421
+ except Exception: # noqa: BLE001 — fall back to system defaults
422
+ return ssl.create_default_context()
423
+
424
+
410
425
  def _pdf_upload_via_api(api_base: str, worker_key: str, file_name: str,
411
426
  pdf_bytes: bytes) -> str:
412
427
  """Ask the API to presign an S3 upload, PUT the PDF bytes, return the download URL.
@@ -416,6 +431,7 @@ def _pdf_upload_via_api(api_base: str, worker_key: str, file_name: str,
416
431
  import urllib.request as _u
417
432
  import urllib.error as _ue
418
433
 
434
+ ctx = _ssl_context()
419
435
  base = (api_base or "").rstrip("/")
420
436
  if not base or not worker_key:
421
437
  raise RuntimeError("PDF upload is not available: worker API base/key missing.")
@@ -431,7 +447,7 @@ def _pdf_upload_via_api(api_base: str, worker_key: str, file_name: str,
431
447
  method="POST",
432
448
  )
433
449
  try:
434
- with _u.urlopen(req, timeout=30) as resp:
450
+ with _u.urlopen(req, timeout=30, context=ctx) as resp:
435
451
  ref = json.loads(resp.read().decode("utf-8"))
436
452
  except _ue.HTTPError as e: # noqa: PERF203
437
453
  detail = e.read().decode("utf-8", "replace")[:300]
@@ -453,7 +469,7 @@ def _pdf_upload_via_api(api_base: str, worker_key: str, file_name: str,
453
469
  method="PUT",
454
470
  )
455
471
  try:
456
- with _u.urlopen(put_req, timeout=60) as up:
472
+ with _u.urlopen(put_req, timeout=60, context=ctx) as up:
457
473
  if up.status not in (200, 201, 204):
458
474
  raise RuntimeError(f"S3 upload failed (HTTP {up.status}).")
459
475
  except _ue.HTTPError as e: # noqa: PERF203
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiens.nguyen/gonext-local-worker",
3
- "version": "1.0.95",
3
+ "version": "1.0.96",
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",