Ennew Harness Python SDK
适用于 Python 3.9 及以上版本,安装包名为 ennew-harness-sdk,导入名称为 ennew_harness。
从 0.1.1 起,导入名称由 harness 改为 ennew_harness,避免与 Worker 自身的同名包冲突。升级后请同步修改业务脚本中的导入语句;不保留旧名称别名。
python3 -m pip install --upgrade ennew-harness-sdk
本 SDK 依赖 Ennew Harness 运行环境,并非独立运行的公共网关客户端。运行时必须提供 CODEX_THREAD_ID;读取上下文还需设置 ENV,并能访问对应业务网关。发送前端消息需要本机 Worker 服务。
安装到运行业务脚本的 Python 环境后,可直接使用:
from ennew_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 定义在 ennew_harness/context.py,请求不内置 Token。环境名称区分大小写;安装 SDK 不会自动授予业务网关访问权限。
源码仓库中可运行上下文示例脚本:python3 fat_context.py。该脚本不随安装包提供。
Metadata
Release files for ennew-harness-sdk 0.1.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 | |
|---|---|---|---|---|
| ennew_harness_sdk-0.1.1.tar.gz | 4.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ennew_harness_sdk-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.7 kB
Release files / ennew_harness_sdk-0.1.1.tar.gz
| Download URL | ennew_harness_sdk-0.1.1.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7cb09497681cc89a2fed7e12d62534fbb997ebd84970534d326c4a5d81468286
|
|
BLAKE2b-256 checksum How to use checksums |
6bee5babc357c90e973b48a16b7b802e31e4e9cf5418dc35dd2dd9e74bef28cd
|
| 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.1-py3-none-any.whl
| Download URL | ennew_harness_sdk-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c0ecbb10eb786dc06df5205663ab410a9a9bf537d69d14dfefcd51f20b960167
|
|
BLAKE2b-256 checksum How to use checksums |
fdad069946c5a8819ccb5052e572f84a38910dc6223b1e8f2786010c7f1e666b
|
| 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.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.