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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agent_protocol_core-0.12.7.tar.gz.
File metadata
- Download URL: agent_protocol_core-0.12.7.tar.gz
- Upload date:
- Size: 19.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c75f1f933765fff4db76f936ff6f681840dde0e59cceb994c2121629878064e6
|
|
| MD5 |
ab14dac81b7921807bcc320519b156ec
|
|
| BLAKE2b-256 |
d80d9e62f8fae99fbd90585306cff3d7a9d1b544f5236374915e731b53b2db3c
|
Provenance
The following attestation bundles were made for agent_protocol_core-0.12.7.tar.gz:
Publisher:
release.yml on teleport-computer/memgarden
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_protocol_core-0.12.7.tar.gz -
Subject digest:
c75f1f933765fff4db76f936ff6f681840dde0e59cceb994c2121629878064e6 - Sigstore transparency entry: 2653204939
- Sigstore integration time:
-
Permalink:
teleport-computer/memgarden@7fd264a4d91c67d6626561bfaa279bf05fb1e750 -
Branch / Tag:
refs/tags/v0.12.7 - Owner: https://github.com/teleport-computer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7fd264a4d91c67d6626561bfaa279bf05fb1e750 -
Trigger Event:
push
-
Statement type:
File details
Details for the file agent_protocol_core-0.12.7-py3-none-any.whl.
File metadata
- Download URL: agent_protocol_core-0.12.7-py3-none-any.whl
- Upload date:
- Size: 24.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2c6a1cfaa27ea40c5fdf8410886148e661bf123acf2488d8e17a9abfdb04409
|
|
| MD5 |
0d63c5ab81c8ed84f1851d27654f1938
|
|
| BLAKE2b-256 |
103b49789ef9ec334c69f879c6fa45ca7c7421bdf41f8f2112ab426a735f57df
|
Provenance
The following attestation bundles were made for agent_protocol_core-0.12.7-py3-none-any.whl:
Publisher:
release.yml on teleport-computer/memgarden
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_protocol_core-0.12.7-py3-none-any.whl -
Subject digest:
e2c6a1cfaa27ea40c5fdf8410886148e661bf123acf2488d8e17a9abfdb04409 - Sigstore transparency entry: 2653205132
- Sigstore integration time:
-
Permalink:
teleport-computer/memgarden@7fd264a4d91c67d6626561bfaa279bf05fb1e750 -
Branch / Tag:
refs/tags/v0.12.7 - Owner: https://github.com/teleport-computer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7fd264a4d91c67d6626561bfaa279bf05fb1e750 -
Trigger Event:
push
-
Statement type: