Ennew Harness Python SDK
适用于 Python 3.9 及以上版本,安装包名为 ennew-harness-sdk,导入名称仍为 harness。
python3 -m pip install ennew-harness-sdk
本 SDK 依赖 Ennew Harness 运行环境,并非独立运行的公共网关客户端。运行时必须提供 CODEX_THREAD_ID;读取上下文还需设置 ENV,并能访问对应业务网关。发送前端消息需要本机 Worker 服务。
安装到运行业务脚本的 Python 环境后,可直接使用:
from harness import context, gui
current = context.get_current_context()
gui.send("file_changed", {"file": "report.md"})
两个方法都从运行时的 CODEX_THREAD_ID 获取当前线程身份。gui.send 要求传入非空的 type 和字典 payload,把 type 同时写入 params.type 与 params.message 中的业务 JSON,经 Worker 本机 127.0.0.1:18080/internal/events 发到当前线程的前端连接。只有线程正在执行且前端连接仍在时才能发送;接口返回成功表示消息已写入 WebSocket,不保证前端已处理。
context.get_current_context() 根据运行环境变量 ENV 选择 FAT、UAT 或 PROD 的网关配置,只返回允许业务脚本读取的身份与业务字段。三套网关 URL 定义在 harness/context.py,请求不内置 Token。环境名称区分大小写;安装 SDK 不会自动授予业务网关访问权限。
源码仓库中可运行上下文示例脚本:python3 fat_context.py。该脚本不随安装包提供。
Metadata
Release files for ennew-harness-sdk 0.1.0
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 | |
|---|---|---|---|---|
| ennew_harness_sdk-0.1.0.tar.gz | 4.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ennew_harness_sdk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.1 kB
Release files / ennew_harness_sdk-0.1.0.tar.gz
| Download URL | ennew_harness_sdk-0.1.0.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2bf000328a54deda577fa94fa3c07924a78d7480a47e965864edff445e7d8a28
|
|
BLAKE2b-256 checksum How to use checksums |
cd0937d19416f1039b77b8643ace468942e9adfb3d5c1eccd398208f22d186cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / ennew_harness_sdk-0.1.0-py3-none-any.whl
| Download URL | ennew_harness_sdk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b43b641d81659776e63efbb3ae22c3b937d6baa3bdbff6d8bfd7ca42e165bc9d
|
|
BLAKE2b-256 checksum How to use checksums |
3a9cadf426d1541b104a5c019853f75ec02b15186486f2bbac10a02689afeb4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Security for ennew-harness-sdk 0.1.0
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.