dsh-python-bridge
English | 中文
Python decorator library and runtime that exposes a Python module as a Cordis Service Provider, Tool Consumer, Event Listener, or capability seam Provider through the DeepSeek Harness Python Capability Bridge. Decorators are zero-side-effect at import time; the runtime is python -u -m dsh_bridge.runtime <module> and serves newline-delimited JSON-RPC 2.0 over stdio (matching @deepseek-ai/dsh-sdk-protocol JsonRpcLineTransport).
Installation
pip install dsh-python-bridge
Decorators
| Decorator | Purpose |
|---|---|
@service(name, settings_namespace=None) |
Class decorator; marks a class as a ctx.<name> Service Provider |
@provide_method(timeout_ms=None, is_concurrency_safe=None) |
Method decorator inside @service; each decorated method becomes a public TS method |
@tool(name, description, parameters, output_schema=None, timeout_ms=None) |
Function decorator; becomes ctx.tools.register(defineTool({...})) |
@on(event_name, mode='emit', prepend=False, global_=False) |
Function decorator; becomes ctx.on(...) |
@capability(seam, backend) |
Class decorator; replaces a capability seam provider |
@method(name=None) |
Method decorator inside @capability |
@system_prompt_section(order, text) |
Function decorator; registers a prompt section |
@guard() |
Function decorator; registers as a tool guard |
@restrict_tools(allow=None, deny=None) |
Method decorator; per-agent tool restriction |
Each decorator returns the original callable (or class) unchanged — Python business code is unmodified at runtime.
Runtime
python -u -m dsh_bridge.runtime <module.path> [--class <ClassName>] [--function <func>]...
The runtime walks the bridge registry and dispatches JSON-RPC requests to the matching Python callables. Errors map to the JSON-RPC error vocabulary in dsh_bridge._errors (-32001/timeout, -32003/permission, etc.).
Runtime manifest
The initialize handshake returns serverInfo plus a manifest carrying every dynamically registered surface with the metadata a host needs to build the plugin without codegen. The client sends clientInfo: { name, version }; a client whose major version differs from the runtime's serverInfo.version is rejected with a protocol-mismatch error (wire version negotiation).
tools[]—name,description,parameters(JSON Schema),outputSchemaprovideMethods[]—name,timeoutMs,concurrencySafe,parameters(PEP 484 annotation strings),returnservices[]—name,class,initFields(dataclass field name/annotation/default)listeners[]—event,mode,prepend,global,function
The full schema is documented in skill/dsh-python-plugin/references/manifest.md in the bridge repository.
Test
pip install -e .[test]
pytest
Release
Publishing is a GitHub Actions workflow (.github/workflows/publish-pypi.yml): pytest runs across supported Python versions, the wheel builds and smoke-tests, and a pushed v* tag publishes to PyPI via trusted publishing (OIDC). Until the PyPI publisher is configured, cut the first release manually from a local build:
cd python/sdk-dsl
python -m pip install build twine
python -m build --outdir dist
twine upload dist/*
License
MIT.
Metadata
Release files for dsh-python-bridge 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dsh_python_bridge-0.0.1.tar.gz | 25.7 kB | Without provenance | Details for dsh_python_bridge-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dsh_python_bridge-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for dsh_python_bridge-0.0.1-py3-none-any.whl |
Total release size: 46.0 kB
Release files / dsh_python_bridge-0.0.1.tar.gz
| Download URL | dsh_python_bridge-0.0.1.tar.gz |
|---|---|
| Size | 25.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6d617080026d824510b8d235e0e66b6ab080f8b30ac01198f2aeca192019fd2c
|
|
BLAKE2b-256 checksum How to use checksums |
90e8c9a17b608924737d69868a80e36e0514132e1d5ea509cf0dc88f05d03133
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / dsh_python_bridge-0.0.1-py3-none-any.whl
| Download URL | dsh_python_bridge-0.0.1-py3-none-any.whl |
|---|---|
| Size | 20.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b6ecaa0484538d7851e1838fd50b9fb6d1cf9ceb9e737aeb165d3d95c8030f71
|
|
BLAKE2b-256 checksum How to use checksums |
bc55639bbe75f51e38dff5ab8cb911c3e0f8e2392bf030a98ad3541d705dff1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for dsh-python-bridge 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.