agent-protocol-core
识别「模型协议残片漏进了正文」。纯标准库,零依赖。
模型的原始输出里带着协议层的东西 —— 通道标记、工具路由、思考标签、 被截断的 JSON 尾巴。这些不该出现在给人看的文本里:用户会在聊天窗口 或记忆卡里看到一串乱码,而系统那边一切正常,没有任何报错。
这个包只做识别,不做处置 —— 怎么处置(打回重问、就地清洗、直接丢弃) 是调用方的决定,不同场景代价不同。
from agent_protocol_core import protocol_leak, self_thinking
protocol_leak.is_orphan_json_tail(text) # 闭括号比开括号多,且带 JSON 记号
self_thinking.strip_thinking(text) # 思考标记
为什么单独一个包
聊天和记忆两条路都要这个判断。放在任何一边,另一边就得跨模块引用; 各写一份则会漂 —— 改了一边忘了另一边,同一段脏文本在两条路上待遇不同。
跟 memgarden 同仓库、锁步发版。
Apache-2.0
Metadata
Release files for agent-protocol-core 0.12.10
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 | |
|---|---|---|---|---|
| agent_protocol_core-0.12.10.tar.gz | 19.6 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agent_protocol_core-0.12.10-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.9 kB
Release files / agent_protocol_core-0.12.10.tar.gz
| Download URL | agent_protocol_core-0.12.10.tar.gz |
|---|---|
| Size | 19.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
85c376c7f9c4ce9c8c497af2b1a3575c795ec9ed9c9dc85c7a5e123418bd6377
|
|
BLAKE2b-256 checksum How to use checksums |
0030a3d7d327230cbe788ff1b2f72749aa2e1238c581e03dceaca56ab9dba10d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logRelease files / agent_protocol_core-0.12.10-py3-none-any.whl
| Download URL | agent_protocol_core-0.12.10-py3-none-any.whl |
|---|---|
| Size | 24.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
55a14918b956a3cb02fcccda3b6f235a98279ce21c42cf3b0483584dfc64622b
|
|
BLAKE2b-256 checksum How to use checksums |
2b6b9195ad7f6aceae522254dcb466f6b64dabdc85b57c9e5efa78aacf1c9d5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logSecurity for agent-protocol-core 0.12.10
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for agent_protocol_core-0.12.10.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 1, 2026.
Transparency logA 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.