Files
deepseek-harness/python/sdk-runtime/README.zh.md
Tianyi Cui b49c37f83a docs(i18n): align single-exe terminology
Add canonical Chinese bindings for build target, deploy root, peer
dependency, serving surface, wheel, wrapper, and VFS so future translations
have one source of truth. Apply the existing runtime, plugin, artifact, and
pipeline bindings throughout every Chinese counterpart touched by this PR.

Require the first Chinese use of peer dependency to retain the English term
so readers can map it back to the package-manager concept without
reintroducing mixed prose throughout the document.

Rewrite mixed-language prose where the English term is not an identifier,
while retaining package names, paths, flags, pkg, single-exe, and other
literal names exactly. Explain VFS on first use and keep technical constraints
readable without inventing compatibility terminology.

Describe single-executable worker support as implemented behavior, including
the filesystem-string entry contract and CommonJS worker artifact required by
the pkg loader, and remove the obsolete bundled-but-unsupported limitation.

Regenerate pairing fingerprints and the generated catalog reference so the
mechanical documentation gates validate the revised English and Chinese
pairs. This keeps the terminology table authoritative and prevents the two
languages from drifting as the runtime documentation evolves.
2026-07-13 22:09:41 +08:00

3.9 KiB
Raw Blame History

DeepSeek Harness 运行时 wheel 包

English | 中文

Python SDK 的运行时载体包(分发名 deepseek-harness-runtime-bin,模块名 deepseek_harness_runtime):它定位 deepseek-harness 客户端要 spawn 的内置运行时二进制,并附带支撑零配置运行的默认配置。

运行时载体

两种载体并存于 src/deepseek_harness_runtime/runtime/ 之下,均由仓库的 scripts/build-exe-for-python-sdk.ts 构建注入,且均被 git 忽略:

  • exe生产——单文件可执行程序 dsh-jsonrpc-agent-pkg-<platform>-<arch>platformlinux/macosarchx64/arm64)。目标机器无需安装 Node。这是唯一随 wheel 包分发的载体;本包不发布 sdist。
  • node(仅限开发)——runtime/node/ 下的完整部署闭包(package.json + node_modules/),在系统 Node >= 22.19 上以 node runtime/node/node_modules/@deepseek-ai/dsh-jsonrpc-agent/lib/bin.js 执行。它是当前检出的源码构建,仅用于仓库本地的开发与验证;不会被自动选中,也不进入分发物。

两种载体承载相同的内容,且只定义一次:本包根目录的 package.json 是 single-exe 流水线的部署根目录——一份零代码的纯依赖 manifest其依赖闭包既是编译进 exe 的插件集,也是物化到 runtime/node/ 的文件树。往分发物里加插件,就是在那里加一行依赖再重新构建。

载体缺失时抛出 FileNotFoundError 并写明获取途径:在 deepseek-harness 检出中经 scripts/build-exe-for-python-sdk.ts 构建,或安装 build-exe-for-python-sdk CI 工作流生成的对应平台运行时 wheel 包。该工作流只保留 wheel 包,不保留独立 exe 归档。获取策略与查找接口刻意分离,之后可以换成按需下载而不改动任何调用方。

每个 wheel 包只包含一个可执行文件。固定标签为 py3-none-manylinux_2_28_x86_64py3-none-manylinux_2_28_aarch64py3-none-macosx_11_0_arm64;构建钩子会拒绝 py3-none-any、可执行文件缺失或重复以及不支持的平台标签。仓库根目录的 package.json 为本包和 SDK 提供共同版本,python-vX.Y.Z 发布标签必须与其匹配。

解析 API

  • resolve_bundled_launch_args(mode=None) -> tuple[str, ...]——启动内置运行时的 argv 元组exe 模式下为 (exe_path,)node 模式下为 (node_path, bin_js_path)。模式选择:显式参数 > DSH_RUNTIME_MODE 环境变量(exe | node> 自动。自动解析只找生产 exe——仅限开发的 node 载体必须显式选用,从而生产部署绝不会悄悄跑在源码构建上。
  • bundled_runtime_path() -> Path——平台 exe 路径(仅 exe 载体;node 载体没有单一路径的等价物,经由上面的 argv 元组启动)。
  • bundled_default_config_path() -> Path——检入的默认配置(见下文)。
  • bundled_package_dir() -> Path——已安装包的数据根目录。

零配置设计

运行时二进制始终要求显式配置($DSH_CORDIS_CONFIG,或作为 argv 位置参数的配置路径),缺了就报错退出——这一硬语义是运行时设计的一部分,本包不软化它。bindsh-jsonrpc-agent只启动配置里列出的插件对外服务接口stdio JSON-RPC 服务器)也是其中一个条目(@deepseek-ai/dsh-jsonrpc),缺了它,启动出的 agent 就没有对外通道。本包检入 runtime/cordis.ymlJSON-RPC 服务条目、agent-core、预载的 DeepSeek 适配器、JSONL 会话持久化、本地 bash各项由 SDK 设置的 DSH_* 环境变量参数化);调用方未使用任何显式配置通道时,deepseek_harness 客户端把该文件路径注入 DSH_CORDIS_CONFIG(注入条件见 sdk README)。因此,零配置是包装层中一次显式、可见的参数传递,而不是运行时中的隐藏回退。