Skip to content

feat: add service-backed document API - #18

Merged
privatenumber merged 22 commits into
developfrom
feat/service-document-api
Aug 10, 2026
Merged

privatenumber merged 22 commits into
developfrom
feat/service-document-api

Conversation

@privatenumber

@privatenumber privatenumber commented Aug 10, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Exposes macOS 26 structured document recognition through ocrDocument() and ocrDocument.pages()
  • Reuses the shared native service for main-thread document calls instead of spawning a new process per request
  • Preserves worker-thread one-shot behavior and the strict document result contract

Problem

The document core and CLI can recognize paragraphs, tables, and lists, but Node callers still need a typed API. A one-shot wrapper would undo the shared-service behavior that protects server workloads from spawning a native process for every concurrent request.

For example, a server can receive ordinary OCR, document-page streaming, and searchable-PDF calls together. Each must wait in one FIFO queue so Vision work remains serial, cancellation is consistent, and the process is reused.

Changes

Add document and document-pages service operations with the existing framed unary and pull-controlled stream protocol. Node validates the recursive document payload before exposing it, including malformed candidate arrays, page metadata, and the macOS-unavailable error.

Main-thread document calls now share the native service with the existing APIs; worker calls retain their existing one-shot lifecycle. The public result schema and document language rules match the CLI.

Base automatically changed from docs/vision-document-research to develop August 10, 2026 04:51
@privatenumber
privatenumber marked this pull request as ready for review August 10, 2026 04:56
@privatenumber
privatenumber merged commit 9519e8e into develop Aug 10, 2026
2 checks passed
@privatenumber
privatenumber deleted the feat/service-document-api branch August 10, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant