Skip to content

docs: add public bridge API reference#16

Merged
leehack merged 2 commits into
mainfrom
docs/public-api-reference
May 16, 2026
Merged

docs: add public bridge API reference#16
leehack merged 2 commits into
mainfrom
docs/public-api-reference

Conversation

@leehack
Copy link
Copy Markdown
Owner

@leehack leehack commented May 16, 2026

Summary

  • Add docs/api.md as the public JavaScript API reference for LlamaWebGpuBridge.
  • Link the API reference from README.md and describe the generated declaration asset.
  • Document worker/direct runtime behavior, model loading, completion streaming, tokenization, embeddings, multimodal projector APIs, state persistence, metadata, cancellation/disposal, and browser asset requirements.
  • Add static contract checks for API docs coverage and malformed Markdown table rows.
  • Fix small public API consistency gaps found while documenting: expose workerGenerationStallTimeoutMs, forward declared worker config keys, and regenerate generated JS/declaration assets.

Closes #11

Test Plan

  • python3 -m py_compile scripts/verify_state_persistence_api.py scripts/verify_ci_reliability.py scripts/state_persistence_browser_smoke.py
  • python3 scripts/verify_state_persistence_api.py
  • python3 scripts/verify_ci_reliability.py
  • npm run check:js
  • git diff --check

Review Notes

  • Pre-push independent docs accuracy review found issues around worker timeout semantics, token callback mode differences, worker config forwarding, Markdown union pipes, pre-load context size behavior, state byte transfer wording, and verifier blind spots.
  • Addressed those findings before push by correcting docs, adding the missing public config type, forwarding public config keys into worker config, and hardening the docs verifier.

Copilot AI review requested due to automatic review settings May 16, 2026 00:51
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a first-class public API reference for the browser-facing LlamaWebGpuBridge assets and introduces CI contract checks to keep the docs and generated declaration assets aligned with the actual exported surface.

Changes:

  • Added docs/api.md documenting the public JS API, including worker vs direct-runtime behavior and state persistence semantics.
  • Linked the API reference and declaration asset (js/llama_webgpu_bridge.d.ts) from README.md.
  • Hardened scripts/verify_ci_reliability.py to enforce API-doc coverage and detect malformed Markdown table rows; also exposed/forwarded a few public config keys and regenerated bundled JS / .d.ts outputs.

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
scripts/verify_ci_reliability.py Adds API-doc coverage checks and a Markdown table row validator for docs/api.md.
README.md Links the new public API reference and documents the published .d.ts asset.
js/src/llama_webgpu_bridge.js Forwards additional public config keys into worker config.
js/src/llama_webgpu_bridge.d.ts Exposes workerGenerationStallTimeoutMs on the public config type.
js/llama_webgpu_bridge.js Regenerated bundled bridge output reflecting forwarded config keys.
js/llama_webgpu_bridge.d.ts Regenerated published declaration asset.
docs/api.md New public API reference for LlamaWebGpuBridge.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/verify_ci_reliability.py
@leehack leehack merged commit 99b163f into main May 16, 2026
1 check passed
@leehack leehack deleted the docs/public-api-reference branch May 16, 2026 01:24
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.

Document the public LlamaWebGpuBridge API surface

2 participants