mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-08-29 04:26:38 +00:00
feat(python-runtime): package the dsh CLI and profile assets
Make the zero-code dsh-python-runtime-closure depend on the real @deepseek-ai/dsh application and every required profile peer, then package apps/cli's built bin instead of the deleted Python carrier. Rename executables to deepseek-harness-sdk-runtime-<platform>-<arch>, update wheel/platform/build workflow discovery, and install a Python dsh console command that requires explicit DSH_HOME before exec. Include profile, bundle, preset, native addon, and shared-library assets needed by the full CLI. Remove the checked-in default cordis.yml and preserve the existing wheel distribution names, Python module names, sidecar validation, and wire identity. Runtime resolution and release tests pin the new artifacts and dev Node carrier.
This commit is contained in:
@@ -235,7 +235,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
platform="${TARGET#node24-}"
|
platform="${TARGET#node24-}"
|
||||||
exe="$PWD/dist-exe/dsh-jsonrpc-agent-pkg-$platform"
|
exe="$PWD/dist-exe/deepseek-harness-sdk-runtime-$platform"
|
||||||
[ -x "$exe" ] || { echo "::error::$exe missing or not executable"; exit 1; }
|
[ -x "$exe" ] || { echo "::error::$exe missing or not executable"; exit 1; }
|
||||||
case "$platform" in
|
case "$platform" in
|
||||||
linux-x64) wheel=deepseek_harness_runtime_bin-$VERSION-py3-none-manylinux_2_28_x86_64.whl ;;
|
linux-x64) wheel=deepseek_harness_runtime_bin-$VERSION-py3-none-manylinux_2_28_x86_64.whl ;;
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ tmp/
|
|||||||
.idea
|
.idea
|
||||||
mise.toml
|
mise.toml
|
||||||
dist-exe/
|
dist-exe/
|
||||||
python/sdk-runtime/src/deepseek_harness_runtime/runtime/dsh-jsonrpc-agent-*
|
python/sdk-runtime/src/deepseek_harness_runtime/runtime/deepseek-harness-sdk-runtime-*
|
||||||
python/sdk-runtime/src/deepseek_harness_runtime/runtime/node/
|
python/sdk-runtime/src/deepseek_harness_runtime/runtime/node/
|
||||||
python/**/__pycache__/
|
python/**/__pycache__/
|
||||||
python/**/.pytest_cache/
|
python/**/.pytest_cache/
|
||||||
|
|||||||
+1
-1
@@ -38,7 +38,7 @@ sdk-wheel:
|
|||||||
- pnpm install --frozen-lockfile
|
- pnpm install --frozen-lockfile
|
||||||
- pnpm run verify-runtime-closure
|
- pnpm run verify-runtime-closure
|
||||||
- pnpm exec tsx scripts/build-exe-for-python-sdk.ts --targets="$PKG_TARGET"
|
- pnpm exec tsx scripts/build-exe-for-python-sdk.ts --targets="$PKG_TARGET"
|
||||||
- EXE="$PWD/dist-exe/dsh-jsonrpc-agent-pkg-$PLATFORM"
|
- EXE="$PWD/dist-exe/deepseek-harness-sdk-runtime-$PLATFORM"
|
||||||
- test -x "$EXE"
|
- test -x "$EXE"
|
||||||
- uv run --python 3.10 --group test --project python/sdk python scripts/smoke-python-runtime.py --scenario all --exe "$EXE"
|
- uv run --python 3.10 --group test --project python/sdk python scripts/smoke-python-runtime.py --scenario all --exe "$EXE"
|
||||||
- python scripts/build-python-release.py --package runtime --tag "$CI_COMMIT_TAG" --platform "$PLATFORM" --runtime-exe "$EXE" --output-dir "release/$PLATFORM"
|
- python scripts/build-python-release.py --package runtime --tag "$CI_COMMIT_TAG" --platform "$PLATFORM" --runtime-exe "$EXE" --output-dir "release/$PLATFORM"
|
||||||
|
|||||||
Generated
+6
-16
@@ -6826,19 +6826,6 @@ importers:
|
|||||||
specifier: workspace:^
|
specifier: workspace:^
|
||||||
version: link:../../subagent/subagent
|
version: link:../../subagent/subagent
|
||||||
|
|
||||||
packages/sdk/python-runtime:
|
|
||||||
dependencies:
|
|
||||||
'@deepseek-ai/dsh-app-boot':
|
|
||||||
specifier: workspace:^
|
|
||||||
version: link:../../boot/app-boot
|
|
||||||
devDependencies:
|
|
||||||
'@deepseek-ai/cordis':
|
|
||||||
specifier: workspace:^
|
|
||||||
version: link:../../../vendor/cordis
|
|
||||||
'@deepseek-ai/dsh-invariants':
|
|
||||||
specifier: workspace:^
|
|
||||||
version: link:../../runtime-diagnostics/invariants
|
|
||||||
|
|
||||||
packages/sdk/server:
|
packages/sdk/server:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@deepseek-ai/schemastery':
|
'@deepseek-ai/schemastery':
|
||||||
@@ -9618,6 +9605,9 @@ importers:
|
|||||||
'@deepseek-ai/cosmokit':
|
'@deepseek-ai/cosmokit':
|
||||||
specifier: link:../../vendor/cosmokit
|
specifier: link:../../vendor/cosmokit
|
||||||
version: link:../../vendor/cosmokit
|
version: link:../../vendor/cosmokit
|
||||||
|
'@deepseek-ai/dsh':
|
||||||
|
specifier: workspace:^
|
||||||
|
version: link:../../apps/cli
|
||||||
'@deepseek-ai/dsh-acp':
|
'@deepseek-ai/dsh-acp':
|
||||||
specifier: workspace:^
|
specifier: workspace:^
|
||||||
version: link:../../packages/acp/acp
|
version: link:../../packages/acp/acp
|
||||||
@@ -9786,9 +9776,6 @@ importers:
|
|||||||
'@deepseek-ai/dsh-sdk-protocol':
|
'@deepseek-ai/dsh-sdk-protocol':
|
||||||
specifier: workspace:^
|
specifier: workspace:^
|
||||||
version: link:../../packages/sdk/protocol
|
version: link:../../packages/sdk/protocol
|
||||||
'@deepseek-ai/dsh-sdk-python-runtime':
|
|
||||||
specifier: workspace:^
|
|
||||||
version: link:../../packages/sdk/python-runtime
|
|
||||||
'@deepseek-ai/dsh-session':
|
'@deepseek-ai/dsh-session':
|
||||||
specifier: workspace:^
|
specifier: workspace:^
|
||||||
version: link:../../packages/core/session
|
version: link:../../packages/core/session
|
||||||
@@ -9819,6 +9806,9 @@ importers:
|
|||||||
'@deepseek-ai/dsh-session-reference':
|
'@deepseek-ai/dsh-session-reference':
|
||||||
specifier: workspace:^
|
specifier: workspace:^
|
||||||
version: link:../../packages/context/session-reference
|
version: link:../../packages/context/session-reference
|
||||||
|
'@deepseek-ai/dsh-session-telemetry':
|
||||||
|
specifier: workspace:^
|
||||||
|
version: link:../../packages/session/session-telemetry
|
||||||
'@deepseek-ai/dsh-session-title':
|
'@deepseek-ai/dsh-session-title':
|
||||||
specifier: workspace:^
|
specifier: workspace:^
|
||||||
version: link:../../packages/session/session-title
|
version: link:../../packages/session/session-title
|
||||||
|
|||||||
@@ -66,7 +66,9 @@ class RuntimeBuildHook(BuildHookInterface):
|
|||||||
)
|
)
|
||||||
expected_executable = matches[0][1]
|
expected_executable = matches[0][1]
|
||||||
runtime_dir = Path(self.root) / "src" / "deepseek_harness_runtime" / "runtime"
|
runtime_dir = Path(self.root) / "src" / "deepseek_harness_runtime" / "runtime"
|
||||||
runtime_files = sorted(runtime_dir.glob("dsh-jsonrpc-agent-pkg-*") if runtime_dir.is_dir() else [])
|
runtime_files = sorted(
|
||||||
|
runtime_dir.glob("deepseek-harness-sdk-runtime-*") if runtime_dir.is_dir() else []
|
||||||
|
)
|
||||||
expected_files = [expected_executable, f"{expected_executable}-rg"]
|
expected_files = [expected_executable, f"{expected_executable}-rg"]
|
||||||
if "-macos-" in expected_executable:
|
if "-macos-" in expected_executable:
|
||||||
expected_files.append(f"{expected_executable}-spawn-helper")
|
expected_files.append(f"{expected_executable}-spawn-helper")
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "dsh-sdk-python-runtime-closure",
|
"name": "dsh-python-runtime-closure",
|
||||||
"description": "Dependency-only deploy root defining the executable and Python runtime closure; pnpm deploy materializes this manifest and node_modules.",
|
"description": "Dependency-only deploy root defining the dsh executable shipped by the Python runtime wheel.",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
"@deepseek-ai/cordis-plugin-loader": "workspace:^",
|
"@deepseek-ai/cordis-plugin-loader": "workspace:^",
|
||||||
"@deepseek-ai/cordis-plugin-timer": "workspace:^",
|
"@deepseek-ai/cordis-plugin-timer": "workspace:^",
|
||||||
"@deepseek-ai/cosmokit": "workspace:^",
|
"@deepseek-ai/cosmokit": "workspace:^",
|
||||||
|
"@deepseek-ai/dsh": "workspace:^",
|
||||||
"@deepseek-ai/dsh-acp": "workspace:^",
|
"@deepseek-ai/dsh-acp": "workspace:^",
|
||||||
"@deepseek-ai/dsh-agent": "workspace:^",
|
"@deepseek-ai/dsh-agent": "workspace:^",
|
||||||
"@deepseek-ai/dsh-agent-loop": "workspace:^",
|
"@deepseek-ai/dsh-agent-loop": "workspace:^",
|
||||||
@@ -45,7 +46,6 @@
|
|||||||
"@deepseek-ai/dsh-hooks-codex": "workspace:^",
|
"@deepseek-ai/dsh-hooks-codex": "workspace:^",
|
||||||
"@deepseek-ai/dsh-invariants": "workspace:^",
|
"@deepseek-ai/dsh-invariants": "workspace:^",
|
||||||
"@deepseek-ai/dsh-sdk-jsonrpc-server": "workspace:^",
|
"@deepseek-ai/dsh-sdk-jsonrpc-server": "workspace:^",
|
||||||
"@deepseek-ai/dsh-sdk-python-runtime": "workspace:^",
|
|
||||||
"@deepseek-ai/dsh-llm": "workspace:^",
|
"@deepseek-ai/dsh-llm": "workspace:^",
|
||||||
"@deepseek-ai/dsh-llm-deepseek": "workspace:^",
|
"@deepseek-ai/dsh-llm-deepseek": "workspace:^",
|
||||||
"@deepseek-ai/dsh-deepseek-llm-api-extensions": "workspace:^",
|
"@deepseek-ai/dsh-deepseek-llm-api-extensions": "workspace:^",
|
||||||
@@ -77,6 +77,7 @@
|
|||||||
"@deepseek-ai/dsh-session-query": "workspace:^",
|
"@deepseek-ai/dsh-session-query": "workspace:^",
|
||||||
"@deepseek-ai/dsh-session-query-sqlite": "workspace:^",
|
"@deepseek-ai/dsh-session-query-sqlite": "workspace:^",
|
||||||
"@deepseek-ai/dsh-session-reference": "workspace:^",
|
"@deepseek-ai/dsh-session-reference": "workspace:^",
|
||||||
|
"@deepseek-ai/dsh-session-telemetry": "workspace:^",
|
||||||
"@deepseek-ai/dsh-session-title": "workspace:^",
|
"@deepseek-ai/dsh-session-title": "workspace:^",
|
||||||
"@deepseek-ai/dsh-settings": "workspace:^",
|
"@deepseek-ai/dsh-settings": "workspace:^",
|
||||||
"@deepseek-ai/dsh-skill": "workspace:^",
|
"@deepseek-ai/dsh-skill": "workspace:^",
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
{
|
{
|
||||||
"linux-x64": {
|
"linux-x64": {
|
||||||
"tag": "manylinux_2_28_x86_64",
|
"tag": "manylinux_2_28_x86_64",
|
||||||
"executable": "dsh-jsonrpc-agent-pkg-linux-x64"
|
"executable": "deepseek-harness-sdk-runtime-linux-x64"
|
||||||
},
|
},
|
||||||
"linux-arm64": {
|
"linux-arm64": {
|
||||||
"tag": "manylinux_2_28_aarch64",
|
"tag": "manylinux_2_28_aarch64",
|
||||||
"executable": "dsh-jsonrpc-agent-pkg-linux-arm64"
|
"executable": "deepseek-harness-sdk-runtime-linux-arm64"
|
||||||
},
|
},
|
||||||
"macos-arm64": {
|
"macos-arm64": {
|
||||||
"tag": "macosx_14_0_arm64",
|
"tag": "macosx_14_0_arm64",
|
||||||
"executable": "dsh-jsonrpc-agent-pkg-macos-arm64"
|
"executable": "deepseek-harness-sdk-runtime-macos-arm64"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
|
|||||||
[project]
|
[project]
|
||||||
name = "deepseek-harness-runtime-bin"
|
name = "deepseek-harness-runtime-bin"
|
||||||
version = "0.0.0.dev0"
|
version = "0.0.0.dev0"
|
||||||
description = "Pinned DeepSeek Harness runtime for the Python SDK"
|
description = "Bundled dsh CLI runtime for the DeepSeek Harness Python SDK"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
@@ -17,10 +17,12 @@ Documentation = "https://github.com/deepseek-ai/deepseek-harness/blob/master/pyt
|
|||||||
Issues = "https://github.com/deepseek-ai/deepseek-harness/issues"
|
Issues = "https://github.com/deepseek-ai/deepseek-harness/issues"
|
||||||
Source = "https://github.com/deepseek-ai/deepseek-harness"
|
Source = "https://github.com/deepseek-ai/deepseek-harness"
|
||||||
|
|
||||||
# Include the injected executable and default config; exclude the dev-only node
|
[project.scripts]
|
||||||
# closure from wheels and sdists.
|
dsh = "deepseek_harness_runtime:main"
|
||||||
|
|
||||||
|
# Include the injected dsh executable and sidecars; exclude the dev-only node closure.
|
||||||
[tool.hatch.build]
|
[tool.hatch.build]
|
||||||
artifacts = ["src/deepseek_harness_runtime/runtime/dsh-jsonrpc-agent-*"]
|
artifacts = ["src/deepseek_harness_runtime/runtime/deepseek-harness-sdk-runtime-*"]
|
||||||
exclude = ["src/deepseek_harness_runtime/runtime/node"]
|
exclude = ["src/deepseek_harness_runtime/runtime/node"]
|
||||||
|
|
||||||
[tool.hatch.build.targets.wheel]
|
[tool.hatch.build.targets.wheel]
|
||||||
|
|||||||
@@ -1,22 +1,21 @@
|
|||||||
"""Locate the bundled DeepSeek Harness SDK runtime shipped with this package.
|
"""Locate and execute the bundled dsh CLI shipped with the Python SDK runtime.
|
||||||
|
|
||||||
Two runtime carriers coexist under ``runtime/``, both injected by the repo's
|
Two runtime carriers coexist under ``runtime/``, both injected by the repo's
|
||||||
``scripts/build-exe-for-python-sdk.ts`` build (neither is checked into git):
|
``scripts/build-exe-for-python-sdk.ts`` build (neither is checked into git):
|
||||||
|
|
||||||
- **exe (production)**: single-file Node executables named
|
- **exe (production)**: single-file Node executables named
|
||||||
``dsh-jsonrpc-agent-pkg-<platform>-<arch>`` (platform in {linux, macos}, arch in
|
``deepseek-harness-sdk-runtime-<platform>-<arch>`` (platform in {linux, macos}, arch in
|
||||||
{x64, arm64}) with a sibling ``-rg`` executable; macOS also uses a sibling
|
{x64, arm64}) with a sibling ``-rg`` executable; macOS also uses a sibling
|
||||||
``-spawn-helper``. The target machine needs no Node installation.
|
``-spawn-helper``. The target machine needs no Node installation.
|
||||||
- **node (dev-only)**: the full deploy closure under ``runtime/node/``
|
- **node (dev-only)**: the full deploy closure under ``runtime/node/``
|
||||||
(``package.json`` + ``node_modules/``), executed as ``node
|
(``package.json`` + ``node_modules/``), executed as ``node
|
||||||
runtime/node/node_modules/@deepseek-ai/dsh-sdk-python-runtime/lib/packaged-bin.js`` on a
|
runtime/node/node_modules/@deepseek-ai/dsh/lib/bin.js`` on a
|
||||||
system Node >= 22.19. It is the current checkout's source build, never
|
system Node >= 22.19. It is the current checkout's source build, never
|
||||||
selected automatically, and excluded from wheel/sdist distributions.
|
selected automatically, and excluded from wheel/sdist distributions.
|
||||||
|
|
||||||
``runtime/cordis.yml`` IS checked in: it is the default agent configuration
|
Both carriers execute the same dsh command grammar. The Python SDK selects the
|
||||||
the client SDK injects via ``$DSH_CORDIS_CONFIG`` for zero-config runs — the
|
``sdk`` profile and requires an explicit Harness home; the installed ``dsh``
|
||||||
runtime itself always requires an explicit config and has no built-in
|
console command requires ``DSH_HOME`` for the same reason.
|
||||||
fallback.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
@@ -52,21 +51,6 @@ def bundled_package_dir() -> Path:
|
|||||||
return root
|
return root
|
||||||
|
|
||||||
|
|
||||||
def bundled_default_config_path() -> Path:
|
|
||||||
"""Path of the checked-in default runtime configuration (``runtime/cordis.yml``).
|
|
||||||
|
|
||||||
The client SDK injects this path via ``$DSH_CORDIS_CONFIG`` when the caller
|
|
||||||
supplies no config and the launch resolves to the bundled runtime — the
|
|
||||||
runtime binary itself always demands an explicit config.
|
|
||||||
"""
|
|
||||||
path = bundled_package_dir() / "runtime" / "cordis.yml"
|
|
||||||
if not path.is_file():
|
|
||||||
raise FileNotFoundError(
|
|
||||||
f"deepseek-harness-runtime-bin is missing the default runtime config at {path}"
|
|
||||||
)
|
|
||||||
return path
|
|
||||||
|
|
||||||
|
|
||||||
def bundled_runtime_path() -> Path:
|
def bundled_runtime_path() -> Path:
|
||||||
"""Absolute path of the bundled single-file runtime executable for the current platform.
|
"""Absolute path of the bundled single-file runtime executable for the current platform.
|
||||||
|
|
||||||
@@ -78,7 +62,7 @@ def bundled_runtime_path() -> Path:
|
|||||||
touching callers).
|
touching callers).
|
||||||
"""
|
"""
|
||||||
tag = _current_platform_tag()
|
tag = _current_platform_tag()
|
||||||
path = bundled_package_dir() / "runtime" / f"dsh-jsonrpc-agent-pkg-{tag}"
|
path = bundled_package_dir() / "runtime" / f"deepseek-harness-sdk-runtime-{tag}"
|
||||||
if not path.is_file():
|
if not path.is_file():
|
||||||
raise FileNotFoundError(
|
raise FileNotFoundError(
|
||||||
f"deepseek-harness-runtime-bin is missing the runtime executable at {path}. "
|
f"deepseek-harness-runtime-bin is missing the runtime executable at {path}. "
|
||||||
@@ -128,7 +112,7 @@ def _current_platform_tag() -> str:
|
|||||||
arch = _ARCH_TAGS.get(platform.machine().lower())
|
arch = _ARCH_TAGS.get(platform.machine().lower())
|
||||||
if plat is None or arch is None:
|
if plat is None or arch is None:
|
||||||
raise FileNotFoundError(
|
raise FileNotFoundError(
|
||||||
"no bundled dsh-jsonrpc-agent executable exists for this platform "
|
"no bundled DeepSeek Harness SDK runtime exists for this platform "
|
||||||
f"(sys.platform={sys.platform!r}, machine={platform.machine()!r}); supported: "
|
f"(sys.platform={sys.platform!r}, machine={platform.machine()!r}); supported: "
|
||||||
"linux/macos on x64/arm64. " + _EXE_ACQUISITION_HINT
|
"linux/macos on x64/arm64. " + _EXE_ACQUISITION_HINT
|
||||||
)
|
)
|
||||||
@@ -141,9 +125,9 @@ def _node_launch_args() -> tuple[str, str]:
|
|||||||
node_root
|
node_root
|
||||||
/ "node_modules"
|
/ "node_modules"
|
||||||
/ "@deepseek-ai"
|
/ "@deepseek-ai"
|
||||||
/ "dsh-sdk-python-runtime"
|
/ "dsh"
|
||||||
/ "lib"
|
/ "lib"
|
||||||
/ "packaged-bin.js"
|
/ "bin.js"
|
||||||
)
|
)
|
||||||
if not bin_js.is_file():
|
if not bin_js.is_file():
|
||||||
raise FileNotFoundError(
|
raise FileNotFoundError(
|
||||||
@@ -161,11 +145,24 @@ def _node_launch_args() -> tuple[str, str]:
|
|||||||
return (node, str(bin_js))
|
return (node, str(bin_js))
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
"""Execute the bundled dsh CLI with an explicitly selected Harness home."""
|
||||||
|
if not os.environ.get("DSH_HOME", "").strip():
|
||||||
|
print(
|
||||||
|
"dsh: the Python runtime command requires an explicit DSH_HOME; "
|
||||||
|
"it never uses ~/.dsh implicitly",
|
||||||
|
file=sys.stderr,
|
||||||
|
)
|
||||||
|
raise SystemExit(2)
|
||||||
|
argv = (*resolve_bundled_launch_args(), *sys.argv[1:])
|
||||||
|
os.execvpe(argv[0], argv, os.environ)
|
||||||
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"PACKAGE_METADATA_FILENAME",
|
"PACKAGE_METADATA_FILENAME",
|
||||||
"RUNTIME_MODE_ENV_VAR",
|
"RUNTIME_MODE_ENV_VAR",
|
||||||
"bundled_default_config_path",
|
|
||||||
"bundled_package_dir",
|
"bundled_package_dir",
|
||||||
"bundled_runtime_path",
|
"bundled_runtime_path",
|
||||||
|
"main",
|
||||||
"resolve_bundled_launch_args",
|
"resolve_bundled_launch_args",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
# Bundled default config. The runtime still requires an explicit
|
|
||||||
# $DSH_CORDIS_CONFIG or argv path; the SDK injects this path for bundled
|
|
||||||
# zero-config launches. SDK-set session-root and cwd variables have manual-run fallbacks.
|
|
||||||
|
|
||||||
# Stdio JSON-RPC server entry; without it the agent has no SDK client.
|
|
||||||
- id: sdk-jsonrpc-server
|
|
||||||
name: '@deepseek-ai/dsh-sdk-jsonrpc-server'
|
|
||||||
|
|
||||||
# Agent spine; the SDK server creates agents per sessionId.
|
|
||||||
- id: agent-core
|
|
||||||
name: '@deepseek-ai/dsh-agent-spine-demo'
|
|
||||||
config:
|
|
||||||
workspaceContext:
|
|
||||||
maxBytes: 65536
|
|
||||||
|
|
||||||
# Stock DeepSeek adapters. The adapter resolves DEEPSEEK_API_KEY through the
|
|
||||||
# credential seam and, with no provider mounted here, from the launching
|
|
||||||
# environment; DEEPSEEK_BASE_URL follows the same environment ladder. Neither
|
|
||||||
# is inlined, so this file names no secret and no route.
|
|
||||||
- id: deepseek-llm-api-extensions
|
|
||||||
name: '@deepseek-ai/dsh-deepseek-llm-api-extensions'
|
|
||||||
|
|
||||||
- id: session-log-deepseek
|
|
||||||
name: '@deepseek-ai/dsh-session-log-deepseek'
|
|
||||||
|
|
||||||
- id: plugin-package-inventory-deepseek
|
|
||||||
name: '@deepseek-ai/dsh-plugin-package-inventory-deepseek'
|
|
||||||
|
|
||||||
- id: llm-deepseek
|
|
||||||
name: '@deepseek-ai/dsh-llm-deepseek'
|
|
||||||
|
|
||||||
# JSONL persistence; $DSH_SESSION_ROOT wins over ./.sessions in the process cwd.
|
|
||||||
- id: sessions
|
|
||||||
name: '@deepseek-ai/dsh-session-persistence-jsonl'
|
|
||||||
config:
|
|
||||||
root: !!js process.env.DSH_SESSION_ROOT ?? './.sessions'
|
|
||||||
|
|
||||||
# Persistence owns durable storage; this separate policy explicitly selects
|
|
||||||
# the request, tool-dispatch, and completed-step durability checkpoints.
|
|
||||||
- id: session-checkpoints
|
|
||||||
name: '@deepseek-ai/dsh-session-checkpoint-policy'
|
|
||||||
|
|
||||||
# Local bash executor; $DSH_CWD wins over the process cwd.
|
|
||||||
# Managed child-process groups for the bash executor (spawn/kill/output plumbing).
|
|
||||||
- id: subprocess
|
|
||||||
name: '@deepseek-ai/dsh-subprocess-local'
|
|
||||||
|
|
||||||
- id: bash
|
|
||||||
name: '@deepseek-ai/dsh-bash-local'
|
|
||||||
config:
|
|
||||||
cwd: !!js process.env.DSH_CWD ?? process.cwd()
|
|
||||||
|
|
||||||
# Local filesystem provider for workspace instruction loading. This does not
|
|
||||||
# expose model-facing file tools by itself.
|
|
||||||
- id: fs-local
|
|
||||||
name: '@deepseek-ai/dsh-fs-local'
|
|
||||||
config:
|
|
||||||
cwd: !!js process.env.DSH_CWD ?? process.cwd()
|
|
||||||
@@ -59,6 +59,7 @@ def test_pep440_version_spells_a_prerelease_the_python_way() -> None:
|
|||||||
|
|
||||||
def test_macos_wheel_tag_does_not_claim_unsupported_node_platforms() -> None:
|
def test_macos_wheel_tag_does_not_claim_unsupported_node_platforms() -> None:
|
||||||
assert build_python_release.PLATFORMS["macos-arm64"][0] == "macosx_14_0_arm64"
|
assert build_python_release.PLATFORMS["macos-arm64"][0] == "macosx_14_0_arm64"
|
||||||
|
assert build_python_release.PLATFORMS["macos-arm64"][1] == "deepseek-harness-sdk-runtime-macos-arm64"
|
||||||
|
|
||||||
|
|
||||||
def test_platform_manifest_rejects_incomplete_entries(tmp_path: Path) -> None:
|
def test_platform_manifest_rejects_incomplete_entries(tmp_path: Path) -> None:
|
||||||
@@ -88,7 +89,7 @@ def test_stage_sdk_keeps_distribution_module_and_runtime_pin_distinct(tmp_path:
|
|||||||
def test_stage_runtime_copies_platform_payload(
|
def test_stage_runtime_copies_platform_payload(
|
||||||
tmp_path: Path, target: str, with_helper: bool
|
tmp_path: Path, target: str, with_helper: bool
|
||||||
) -> None:
|
) -> None:
|
||||||
executable = tmp_path / f"dsh-jsonrpc-agent-pkg-{target}"
|
executable = tmp_path / f"deepseek-harness-sdk-runtime-{target}"
|
||||||
executable.write_bytes(b"runtime")
|
executable.write_bytes(b"runtime")
|
||||||
executable.chmod(0o755)
|
executable.chmod(0o755)
|
||||||
expected = {executable.name: b"runtime"}
|
expected = {executable.name: b"runtime"}
|
||||||
@@ -106,10 +107,14 @@ def test_stage_runtime_copies_platform_payload(
|
|||||||
build_python_release.stage_runtime(destination, "1.2.3", executable, executable.name)
|
build_python_release.stage_runtime(destination, "1.2.3", executable, executable.name)
|
||||||
|
|
||||||
runtime_dir = destination / "src" / "deepseek_harness_runtime" / "runtime"
|
runtime_dir = destination / "src" / "deepseek_harness_runtime" / "runtime"
|
||||||
assert {path.name: path.read_bytes() for path in runtime_dir.glob("dsh-jsonrpc-agent-pkg-*")} == expected
|
assert {
|
||||||
|
path.name: path.read_bytes()
|
||||||
|
for path in runtime_dir.glob("deepseek-harness-sdk-runtime-*")
|
||||||
|
} == expected
|
||||||
pyproject = (destination / "pyproject.toml").read_text()
|
pyproject = (destination / "pyproject.toml").read_text()
|
||||||
assert 'license = "MIT"' in pyproject
|
assert 'license = "MIT"' in pyproject
|
||||||
assert 'license-files = ["LICENSE", "THIRD_PARTY_NOTICES.md"]' in pyproject
|
assert 'license-files = ["LICENSE", "THIRD_PARTY_NOTICES.md"]' in pyproject
|
||||||
|
assert 'dsh = "deepseek_harness_runtime:main"' in pyproject
|
||||||
assert (destination / "platforms.json").read_bytes() == (
|
assert (destination / "platforms.json").read_bytes() == (
|
||||||
ROOT / "python" / "sdk-runtime" / "platforms.json"
|
ROOT / "python" / "sdk-runtime" / "platforms.json"
|
||||||
).read_bytes()
|
).read_bytes()
|
||||||
|
|||||||
@@ -9,21 +9,12 @@ import pytest
|
|||||||
|
|
||||||
from deepseek_harness_runtime import (
|
from deepseek_harness_runtime import (
|
||||||
RUNTIME_MODE_ENV_VAR,
|
RUNTIME_MODE_ENV_VAR,
|
||||||
bundled_default_config_path,
|
|
||||||
bundled_package_dir,
|
bundled_package_dir,
|
||||||
|
main,
|
||||||
resolve_bundled_launch_args,
|
resolve_bundled_launch_args,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_default_config_is_shipped_with_the_package() -> None:
|
|
||||||
path = bundled_default_config_path()
|
|
||||||
assert path == bundled_package_dir() / "runtime" / "cordis.yml"
|
|
||||||
config = path.read_text()
|
|
||||||
assert "@deepseek-ai/dsh-agent-spine-demo" in config
|
|
||||||
assert "@deepseek-ai/dsh-session-persistence-jsonl" in config
|
|
||||||
assert "@deepseek-ai/dsh-session-checkpoint-policy" in config
|
|
||||||
|
|
||||||
|
|
||||||
def test_unknown_explicit_mode_fails_loud() -> None:
|
def test_unknown_explicit_mode_fails_loud() -> None:
|
||||||
with pytest.raises(ValueError, match="expected 'exe' or 'node'"):
|
with pytest.raises(ValueError, match="expected 'exe' or 'node'"):
|
||||||
resolve_bundled_launch_args("bogus")
|
resolve_bundled_launch_args("bogus")
|
||||||
@@ -49,10 +40,10 @@ def test_runtime_requires_spawn_helper_only_on_macos(
|
|||||||
) -> None:
|
) -> None:
|
||||||
runtime_dir = tmp_path / "runtime"
|
runtime_dir = tmp_path / "runtime"
|
||||||
runtime_dir.mkdir()
|
runtime_dir.mkdir()
|
||||||
linux = runtime_dir / "dsh-jsonrpc-agent-pkg-linux-x64"
|
linux = runtime_dir / "deepseek-harness-sdk-runtime-linux-x64"
|
||||||
linux.touch()
|
linux.touch()
|
||||||
Path(f"{linux}-rg").touch()
|
Path(f"{linux}-rg").touch()
|
||||||
macos = runtime_dir / "dsh-jsonrpc-agent-pkg-macos-arm64"
|
macos = runtime_dir / "deepseek-harness-sdk-runtime-macos-arm64"
|
||||||
macos.touch()
|
macos.touch()
|
||||||
Path(f"{macos}-rg").touch()
|
Path(f"{macos}-rg").touch()
|
||||||
monkeypatch.setattr(runtime, "bundled_package_dir", lambda: tmp_path)
|
monkeypatch.setattr(runtime, "bundled_package_dir", lambda: tmp_path)
|
||||||
@@ -69,9 +60,55 @@ def test_runtime_requires_ripgrep_sidecar(
|
|||||||
) -> None:
|
) -> None:
|
||||||
runtime_dir = tmp_path / "runtime"
|
runtime_dir = tmp_path / "runtime"
|
||||||
runtime_dir.mkdir()
|
runtime_dir.mkdir()
|
||||||
(runtime_dir / "dsh-jsonrpc-agent-pkg-linux-x64").touch()
|
(runtime_dir / "deepseek-harness-sdk-runtime-linux-x64").touch()
|
||||||
monkeypatch.setattr(runtime, "bundled_package_dir", lambda: tmp_path)
|
monkeypatch.setattr(runtime, "bundled_package_dir", lambda: tmp_path)
|
||||||
monkeypatch.setattr(runtime, "_current_platform_tag", lambda: "linux-x64")
|
monkeypatch.setattr(runtime, "_current_platform_tag", lambda: "linux-x64")
|
||||||
|
|
||||||
with pytest.raises(FileNotFoundError, match="ripgrep sidecar"):
|
with pytest.raises(FileNotFoundError, match="ripgrep sidecar"):
|
||||||
runtime.bundled_runtime_path()
|
runtime.bundled_runtime_path()
|
||||||
|
|
||||||
|
|
||||||
|
def test_node_mode_runs_the_deployed_dsh_cli(
|
||||||
|
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
||||||
|
) -> None:
|
||||||
|
bin_js = tmp_path / "runtime" / "node" / "node_modules" / "@deepseek-ai" / "dsh" / "lib" / "bin.js"
|
||||||
|
bin_js.parent.mkdir(parents=True)
|
||||||
|
bin_js.touch()
|
||||||
|
monkeypatch.setattr(runtime, "bundled_package_dir", lambda: tmp_path)
|
||||||
|
monkeypatch.setattr(runtime.shutil, "which", lambda _name: "/node")
|
||||||
|
|
||||||
|
assert resolve_bundled_launch_args("node") == ("/node", str(bin_js))
|
||||||
|
|
||||||
|
|
||||||
|
def test_python_dsh_command_requires_explicit_home(
|
||||||
|
monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str]
|
||||||
|
) -> None:
|
||||||
|
monkeypatch.delenv("DSH_HOME", raising=False)
|
||||||
|
|
||||||
|
with pytest.raises(SystemExit) as excinfo:
|
||||||
|
main()
|
||||||
|
|
||||||
|
assert excinfo.value.code == 2
|
||||||
|
assert "explicit DSH_HOME" in capsys.readouterr().err
|
||||||
|
|
||||||
|
|
||||||
|
def test_python_dsh_command_executes_the_bundled_cli(
|
||||||
|
monkeypatch: pytest.MonkeyPatch
|
||||||
|
) -> None:
|
||||||
|
called: dict[str, object] = {}
|
||||||
|
monkeypatch.setenv("DSH_HOME", "/explicit/home")
|
||||||
|
monkeypatch.setattr(runtime, "resolve_bundled_launch_args", lambda: ("/runtime",))
|
||||||
|
monkeypatch.setattr(runtime.sys, "argv", ["dsh", "plugin", "--profile", "sdk", "list"])
|
||||||
|
|
||||||
|
def execvpe(file: str, args: tuple[str, ...], env: dict[str, str]) -> None:
|
||||||
|
called.update(file=file, args=args, home=env.get("DSH_HOME"))
|
||||||
|
|
||||||
|
monkeypatch.setattr(runtime.os, "execvpe", execvpe)
|
||||||
|
|
||||||
|
main()
|
||||||
|
|
||||||
|
assert called == {
|
||||||
|
"file": "/runtime",
|
||||||
|
"args": ("/runtime", "plugin", "--profile", "sdk", "list"),
|
||||||
|
"home": "/explicit/home",
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Build the SDK runtime executables and Python node carrier. The fixed
|
* Build the dsh executables and development Node carrier for the Python runtime wheel. The fixed
|
||||||
* `@yao-pkg/pkg --sea` route, deploy flags, and artifact layout are owned by
|
* `@yao-pkg/pkg --sea` route, deploy flags, and artifact layout are owned by
|
||||||
* .agents/notes/implemented/architecture/2026-07-10-single-file-executable-sdk-runtime-distribution.md.
|
* .agents/notes/implemented/architecture/2026-07-10-single-file-executable-sdk-runtime-distribution.md.
|
||||||
* The staged closure is symlink-free, and whole-tree assets cover Cordis's
|
* The staged closure is symlink-free, and whole-tree assets cover Cordis's
|
||||||
@@ -16,11 +16,11 @@ import { resolveLinuxNodePtyAddon } from './build-exe-for-python-sdk-native-pty.
|
|||||||
const root = resolve(import.meta.dirname, '..')
|
const root = resolve(import.meta.dirname, '..')
|
||||||
|
|
||||||
/** The closure manifest whose dependencies define the executable. */
|
/** The closure manifest whose dependencies define the executable. */
|
||||||
const DEPLOY_ROOT_PACKAGE = 'dsh-sdk-python-runtime-closure'
|
const DEPLOY_ROOT_PACKAGE = 'dsh-python-runtime-closure'
|
||||||
/** The closed-runtime app entry inside the deployed closure. */
|
/** The sole application launcher inside the deployed closure. */
|
||||||
const ENTRY_BIN = 'node_modules/@deepseek-ai/dsh-sdk-python-runtime/lib/packaged-bin.js'
|
const ENTRY_BIN = 'node_modules/@deepseek-ai/dsh/lib/bin.js'
|
||||||
/** Stable Python-visible executable basename; rename with the later Python runtime migration. */
|
/** Python-visible executable basename. */
|
||||||
const OUTPUT_BASENAME = 'dsh-jsonrpc-agent-pkg'
|
const OUTPUT_BASENAME = 'deepseek-harness-sdk-runtime'
|
||||||
/** Default Node major; SEA mode requires at least Node 22. */
|
/** Default Node major; SEA mode requires at least Node 22. */
|
||||||
const DEFAULT_NODE_RANGE = 'node24'
|
const DEFAULT_NODE_RANGE = 'node24'
|
||||||
/** Pinned for reproducible builds. */
|
/** Pinned for reproducible builds. */
|
||||||
@@ -47,8 +47,15 @@ const ASSET_GLOBS = [
|
|||||||
'node_modules/**/*.mjs',
|
'node_modules/**/*.mjs',
|
||||||
'node_modules/**/package.json',
|
'node_modules/**/package.json',
|
||||||
'node_modules/**/*.json',
|
'node_modules/**/*.json',
|
||||||
|
'node_modules/**/*.md',
|
||||||
|
'node_modules/**/*.dylib',
|
||||||
|
'node_modules/**/*.dll',
|
||||||
'node_modules/**/*.node',
|
'node_modules/**/*.node',
|
||||||
|
'node_modules/**/*.so',
|
||||||
|
'node_modules/**/*.so.*',
|
||||||
'node_modules/**/*.wasm',
|
'node_modules/**/*.wasm',
|
||||||
|
'node_modules/**/*.yaml',
|
||||||
|
'node_modules/**/*.yml',
|
||||||
]
|
]
|
||||||
|
|
||||||
const PLATFORMS = ['linux', 'macos'] as const
|
const PLATFORMS = ['linux', 'macos'] as const
|
||||||
@@ -220,8 +227,7 @@ function formatCommand(command: string, args: string[]): string {
|
|||||||
*/
|
*/
|
||||||
class SingleExeBuild {
|
class SingleExeBuild {
|
||||||
/**
|
/**
|
||||||
* The cleared deploy target, pkg input, and Python node-mode carrier. The
|
* The cleared deploy target, pkg input, and Python node-mode carrier.
|
||||||
* checked-in default `cordis.yml` remains in its parent directory.
|
|
||||||
*/
|
*/
|
||||||
readonly staging = resolve(root, PYTHON_RUNTIME_DIR, PYTHON_NODE_SUBDIR)
|
readonly staging = resolve(root, PYTHON_RUNTIME_DIR, PYTHON_NODE_SUBDIR)
|
||||||
private readonly outDir = resolve(root, OUT_DIR)
|
private readonly outDir = resolve(root, OUT_DIR)
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ def copy_package(source: Path, destination: Path) -> None:
|
|||||||
"*.pyc",
|
"*.pyc",
|
||||||
"dist",
|
"dist",
|
||||||
"node_modules",
|
"node_modules",
|
||||||
"dsh-jsonrpc-agent-pkg-*",
|
"deepseek-harness-sdk-runtime-*",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -246,7 +246,7 @@ def verify_wheel(
|
|||||||
f"{wheel} has license files {license_files}, expected {expected_license_files}"
|
f"{wheel} has license files {license_files}, expected {expected_license_files}"
|
||||||
)
|
)
|
||||||
runtime_files = [
|
runtime_files = [
|
||||||
name for name in archive.namelist() if "/runtime/dsh-jsonrpc-agent-pkg-" in name
|
name for name in archive.namelist() if "/runtime/deepseek-harness-sdk-runtime-" in name
|
||||||
]
|
]
|
||||||
if package == "runtime":
|
if package == "runtime":
|
||||||
assert platform is not None
|
assert platform is not None
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ describe('translation scope discovery', () => {
|
|||||||
'packages/example/node_modules/dependency/README.md',
|
'packages/example/node_modules/dependency/README.md',
|
||||||
'packages/example/lib/README.md',
|
'packages/example/lib/README.md',
|
||||||
'coverage/report/README.md',
|
'coverage/report/README.md',
|
||||||
'python/sdk-runtime/src/deepseek_harness_runtime/runtime/dsh-jsonrpc-agent-macos-arm64/README.md',
|
'python/sdk-runtime/src/deepseek_harness_runtime/runtime/deepseek-harness-sdk-runtime-macos-arm64/README.md',
|
||||||
'python/sdk-runtime/src/deepseek_harness_runtime/runtime/node/README.md',
|
'python/sdk-runtime/src/deepseek_harness_runtime/runtime/node/README.md',
|
||||||
])('excludes non-source or non-README path %s', (file) => {
|
])('excludes non-source or non-README path %s', (file) => {
|
||||||
expect(isTranslationScopeFile(file)).toBe(false)
|
expect(isTranslationScopeFile(file)).toBe(false)
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ export const TRANSLATION_SCOPE_GLOB_EXCLUDES = [
|
|||||||
'**/.pytest_cache/**',
|
'**/.pytest_cache/**',
|
||||||
'apps/web/dist/**',
|
'apps/web/dist/**',
|
||||||
'.artifacts/**',
|
'.artifacts/**',
|
||||||
'python/sdk-runtime/src/deepseek_harness_runtime/runtime/dsh-jsonrpc-agent-*/**',
|
'python/sdk-runtime/src/deepseek_harness_runtime/runtime/deepseek-harness-sdk-runtime-*/**',
|
||||||
'python/sdk-runtime/src/deepseek_harness_runtime/runtime/node/**',
|
'python/sdk-runtime/src/deepseek_harness_runtime/runtime/node/**',
|
||||||
'vendor/**',
|
'vendor/**',
|
||||||
]
|
]
|
||||||
@@ -177,7 +177,7 @@ function isTranslationSourceExcluded(file: string): boolean {
|
|||||||
|| segment.startsWith('.doc-typecheck-')
|
|| segment.startsWith('.doc-typecheck-')
|
||||||
|| segment.startsWith('.node-next-types-'))
|
|| segment.startsWith('.node-next-types-'))
|
||||||
|| file.startsWith('apps/web/dist/')
|
|| file.startsWith('apps/web/dist/')
|
||||||
|| file.startsWith('python/sdk-runtime/src/deepseek_harness_runtime/runtime/dsh-jsonrpc-agent-')
|
|| file.startsWith('python/sdk-runtime/src/deepseek_harness_runtime/runtime/deepseek-harness-sdk-runtime-')
|
||||||
|| file.startsWith('python/sdk-runtime/src/deepseek_harness_runtime/runtime/node/')
|
|| file.startsWith('python/sdk-runtime/src/deepseek_harness_runtime/runtime/node/')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user