Skip to content

About

SoMark document parser tool (somark_parse) plugin for DeepSeek Harness

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

dsh-tool-somark

Parse PDFs, images, Word, and PowerPoint into Markdown or structured JSON with somark_parse in DeepSeek Harness.

The document read goes through ctx.fs, so any mounted filesystem policy applies to the read. Parsed content is returned as data and must never be executed.

Install

In DeepSeek Harness Desktop, open Plugins, add a plugin, and enter the repository URL https://github.com/SoMarkAI/dsh-tool-somark or the absolute path to a prebuilt .tgz file.

With the DSH CLI, install into the profile you use:

# From GitHub
dsh plugin --profile web add github:SoMarkAI/dsh-tool-somark

# From a prebuilt tarball
dsh plugin --profile web add ./dsh-tool-somark-0.1.2.tgz

The package ships compiled JavaScript and needs no installation script approval. Then boot the profile to register somark_parse. The package also exports the API client for programmatic use.

Requirements

  • DeepSeek Harness 0.2.2-rc.5 or 0.2.3-alpha.2 with the base bundle (@deepseek-ai/dsh-base), which provides ctx.tools and ctx.fs.
  • SoMark API requires an API key. Enter it in the plugin settings or set SOMARK_API_KEY in the environment. OXR Free API requires no key.

Config

Choose a service when you first enable the plugin in Desktop. Enter its API key below baseURL if needed. The plugin detail page shows whether a key is configured and lets you replace it. A key saved here belongs to the address selected when saving.

Service service baseURL
SoMark API (China) somark-cn https://somark.cn/api/v1
SoMark API (Global) somark-global https://somark.ai/api/v1
OXR Free API oxr-free https://free-oxr.somark.cn/api/v1
Private deployment private Enter your deployment's API base URL.

The public presets fill baseURL automatically. Existing profiles with only baseURL still use that address. When both fields are absent, the plugin uses SoMark API (China). An explicitly selected private deployment uses its configured apiKey if supplied.

Field Default Meaning
apiKey unset SoMark API key. Public SoMark presets fall back to SOMARK_API_KEY.
apiKeyBaseURL unset Address the configured apiKey belongs to. The plugin form fills this when saving a key.
service unset Service preset from the table above.
baseURL resolved from service API base for private or existing URL-based configurations. /parse/async and /parse/async_check append.
outputFormats ['markdown', 'json'] Formats requested when a call omits outputFormats.
elementFormats { image: 'url', formula: 'latex', table: 'html', cs: 'image' } Partial per-element rendering-format overrides.
featureConfig cross-page off, inline image / table image / image understanding on, header-footer off Partial feature-switch overrides.
pollIntervalMs 2000 Delay between status polls.
maxPollAttempts 1000 Maximum polls (≈ 33 minutes at the default interval).
maxFileBytes 209715200 Upload cap; SoMark documents a 200 MB limit.
markdownCapChars 200000 Inclusive cap on the markdown characters returned in one result.
jsonCapChars 200000 Inclusive cap on the stringified JSON characters returned in one result.

Example profile patch (cordis.patch.yml in the profile, or a --patch overlay):

- id: tool-somark
  config:
    service: oxr-free

Invalid element/feature/output-format values fail the plugin load with a CONFIG_INVALID error rather than being silently accepted.

The tool

somark_parse takes a required path (absolute path to the document) and an optional outputFormats array. It returns the parsed Markdown (capped by markdownCapChars, flagged truncated), the page/token counts, and the structured JSON when requested and within jsonCapChars (otherwise flagged jsonOmitted).

Failures carry machine-routable codes on the tool result: NO_API_KEY, DOCUMENT_NOT_FOUND, DOCUMENT_NOT_A_FILE, UNSUPPORTED_EXTENSION, FILE_TOO_LARGE, CONFIG_INVALID, SUBMIT_FAILED, TASK_FAILED, POLL_TIMEOUT, ABORTED, REQUEST_FAILED, INVALID_RESPONSE.

Development

pnpm install
pnpm test        # vitest
pnpm run build   # compile the host plugin and Desktop client into lib/
pnpm run pack    # rebuild and generate a tarball for dsh plugin add

Commit the regenerated lib/ files with source changes. A Git install uses the compiled host plugin, Desktop client, and TypeScript declarations directly.

Known Limitations and Deferred Work

  • No batch/directory parsing — one path per call; callers loop the tool.
  • Element and feature formats are deployment config, not per-call arguments.
  • No artifact persistence — the result returns content; consumers can persist via tool/result.
  • Oversized JSON is omitted (jsonOmitted), not spilled.

License

MIT

About

SoMark document parser tool (somark_parse) plugin for DeepSeek Harness

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages