Local Testing

September 1, 2026 · View on GitHub

English | 中文

Prerequisites

  • Node.js >= 20

  • Chrome or Edge (for WebGPU support and SharedArrayBuffer)

Install

npm install
npm run build

This plugin has both a Host entry (lib/index.js) and a Client bundle (lib/client.js, declared via dsh.client in package.json). The overlay approach only loads the Host — the Client is discovered through node_modules, so the package must be linked first.

Windows (Git Bash / MINGW):

PROJECT="$(cygpath -m ~/Downloads/dsh-math-input)"   # ← your path
npx @deepseek-ai/dsh plugin --profile web add "file:$PROJECT"

macOS / Linux:

PROJECT="$(pwd)"          # ← run from the repo root
npx @deepseek-ai/dsh plugin --profile web add "file:$PROJECT"

This installs the package into the profile's node_modules via a persistent link. After npm run build, the rebuilt lib/ is immediately available — no reinstall needed.

Iterate: rebuild + restart

npm run build
npx @deepseek-ai/dsh web --no-open

Open http://127.0.0.1:3080.

npx @deepseek-ai/dsh plugin --profile web remove dsh-math-input

Overlay alternative (Host-only)

If you only need to test Host-side code (settings service, typert manifest, etc.) and don't need the Client UI, use an overlay patch instead of linking:

Create overlay.yml in the project root:

- insert:
    - id: dsh-math-input
      name: '/your/absolute/path/dsh-math-input/lib/index.js'

Or generate it with a command (from the project root):

Windows (Git Bash / MINGW):

cat > overlay.yml <<EOF
- insert:
    - id: dsh-math-input
      name: '/$(pwd -W)/lib/index.js'
EOF

pwd -W outputs a Windows-style path (e.g. C:/Users/xxx/dsh-math-input). You must prefix it with /, resulting in /C:/Users/xxx/dsh-math-input/lib/index.js. Node.js ESM loader doesn't accept bare C:/... paths on Windows (treats C: as a protocol) — it must be /C:/... or file:///C:/.... Do not use pwd (outputs /c/Users/... which the loader resolves as C:\c\Users\...).

macOS / Linux:

cat > overlay.yml <<EOF
- insert:
    - id: dsh-math-input
      name: '$(pwd)/lib/index.js'
EOF

pwd outputs a Unix-style path (e.g. /Users/xxx/dsh-math-input), which already starts with / — no extra prefix needed.

Launch the DSH web client with the overlay patch:

npx @deepseek-ai/dsh web --patch overlay.yml

Note: the overlay only loads the Host entry. The Client UI (handwriting pad, screenshot OCR, LaTeX editor, settings page) will not appear because dsh.client is discovered through node_modules, which the overlay bypasses. For full UI testing, use the link-based approach above.

Verification Checklist

Applies to the link-based approach (overlay only covers Host loading):

  1. "+" button appears to the left of the input row
  2. Menu opens on click with three items: Handwriting, Screenshot, LaTeX Editor
  3. Handwriting pad modal renders, canvas accepts pointer drawing
  4. Settings section appears in Settings with five controls (mode, beam, provider, debounce, language)
  5. Changing a setting persists across page reload
  6. Preview strip renders \[x^2\] typed in the composer as a KaTeX chip
  7. LaTeX editor dock toggles from the menu, palette inserts snippets, Insert writes \[...\]

Troubleshooting

  • Absolute path required: the name field in overlay.yml must be an absolute path to lib/index.js

  • SharedArrayBuffer fallback: if the server does not send Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy headers, ONNX Runtime falls back to single-threaded WASM — recognition still works but is slower

  • Model download: first recognition triggers a ~7.2 MB download (encoder + decoder + vocab); subsequent loads use IndexedDB cache

  • WebGPU: provider: 'webgpu' auto-detects and falls back to wasm on unsupported browsers