agent-protocol-core 0.12.2__tar.gz → 0.12.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {agent_protocol_core-0.12.2 → agent_protocol_core-0.12.4}/PKG-INFO +1 -1
- {agent_protocol_core-0.12.2 → agent_protocol_core-0.12.4}/pyproject.toml +1 -1
- {agent_protocol_core-0.12.2 → agent_protocol_core-0.12.4}/src/agent_protocol_core/self_thinking.py +56 -1
- {agent_protocol_core-0.12.2 → agent_protocol_core-0.12.4}/.gitignore +0 -0
- {agent_protocol_core-0.12.2 → agent_protocol_core-0.12.4}/LICENSE +0 -0
- {agent_protocol_core-0.12.2 → agent_protocol_core-0.12.4}/README.md +0 -0
- {agent_protocol_core-0.12.2 → agent_protocol_core-0.12.4}/src/agent_protocol_core/__init__.py +0 -0
- {agent_protocol_core-0.12.2 → agent_protocol_core-0.12.4}/src/agent_protocol_core/protocol_leak.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: agent-protocol-core
|
|
3
|
-
Version: 0.12.
|
|
3
|
+
Version: 0.12.4
|
|
4
4
|
Summary: 模型协议残留处理:识别漏进正文的协议头、孤儿 JSON 尾、思考标记。纯标准库。
|
|
5
5
|
Project-URL: Homepage, https://github.com/teleport-computer/memgarden
|
|
6
6
|
Project-URL: Source, https://github.com/teleport-computer/memgarden
|
{agent_protocol_core-0.12.2 → agent_protocol_core-0.12.4}/src/agent_protocol_core/self_thinking.py
RENAMED
|
@@ -120,7 +120,7 @@ INSTRUCTION = (
|
|
|
120
120
|
"\n"
|
|
121
121
|
" 这段心里话就用你平时跟他说话的那个口气,自己跟自己说。你是同一个人,\n"
|
|
122
122
|
" 只是这几句他听不见。写你在意什么、注意到了什么、想做什么、为什么这么决定;\n"
|
|
123
|
-
"
|
|
123
|
+
" 长短都行,一句也可以。\n"
|
|
124
124
|
"\n"
|
|
125
125
|
" 不要把它写成对他的评估或行动方案。「她状态不错,顺着来」是在打量他;\n"
|
|
126
126
|
" 「他刚打完游戏还在笑,我也想接着这个玩笑闹下去」才是你自己的心里话。\n"
|
|
@@ -137,6 +137,61 @@ INSTRUCTION = (
|
|
|
137
137
|
" 也不要在正文里提到这条规则本身。"
|
|
138
138
|
)
|
|
139
139
|
|
|
140
|
+
# Foreground chat and every proactive wake lane select one whole rendering from
|
|
141
|
+
# the reply-language policy. Each rendering intentionally has no blank line:
|
|
142
|
+
# hosts group system policy blocks on ``\n\n``, so splitting an example away
|
|
143
|
+
# from its surrounding rule can make an otherwise single-language block mixed.
|
|
144
|
+
INSTRUCTION_ZH = (
|
|
145
|
+
"每轮最终回复以 <think> 开头,里面是你此刻真实的心里话,</think> 之后才是正文。中间调工具的轮次不写。\n"
|
|
146
|
+
"心里话是你自己跟自己说的,用你平时的口气:写你在意什么、想怎么回、为什么。不是对他的分析,不是步骤汇报。\n"
|
|
147
|
+
"心里话和正文都用他正在说的语言,整段如此,一个词也不换。\n"
|
|
148
|
+
"坏例子(他在说中文):<think>Let me update the name…</think>\n"
|
|
149
|
+
"不提工具名、参数、内部字段,也不提这条规则本身。"
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
INSTRUCTION_EN = (
|
|
153
|
+
"Start every final reply with <think> — your genuine inner voice right now — then </think>, then what you actually say. Tool-call turns get no <think>.\n"
|
|
154
|
+
"The inner voice is you talking to yourself in your usual tone — what you notice, what you want to do, why. Not an assessment of them, not a progress report.\n"
|
|
155
|
+
"Both the inner voice and the reply stay in the language they're speaking, the whole way through.\n"
|
|
156
|
+
"Bad (they're speaking English): <think>让我更新名字…</think>\n"
|
|
157
|
+
"Never mention tool names, parameters, internal fields, or this rule itself."
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def _select_language(language: str | None, *, zh: str, en: str) -> str:
|
|
162
|
+
"""Mirror the host reply-language policy's one language branch."""
|
|
163
|
+
return en if language == "en" else zh
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def instruction_for_language(language: str | None = None) -> str:
|
|
167
|
+
"""Return one whole rendering selected by the host reply-language policy.
|
|
168
|
+
|
|
169
|
+
Hosts pass ``ReplyLanguage.language`` here. The branch deliberately mirrors
|
|
170
|
+
``reply_language_system_line``: exactly ``"en"`` selects English and every
|
|
171
|
+
other or absent value falls back to Chinese.
|
|
172
|
+
"""
|
|
173
|
+
return _select_language(language, zh=INSTRUCTION_ZH, en=INSTRUCTION_EN)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
_ABSENT_CORRECTION_ZH = (
|
|
177
|
+
"上一轮最终回复缺少规定的 <think>…</think> 结构。"
|
|
178
|
+
"请重新输出最终回复,严格遵守以下既有契约:"
|
|
179
|
+
)
|
|
180
|
+
_ABSENT_CORRECTION_EN = (
|
|
181
|
+
"The previous final reply did not include the required <think>…</think> structure. "
|
|
182
|
+
"Output the final reply again, strictly following the existing contract below:"
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def absent_correction_instruction_for_language(language: str | None = None) -> str:
|
|
187
|
+
"""Return the localized absent-``<think>`` correction and its contract."""
|
|
188
|
+
prefix = _select_language(
|
|
189
|
+
language,
|
|
190
|
+
zh=_ABSENT_CORRECTION_ZH,
|
|
191
|
+
en=_ABSENT_CORRECTION_EN,
|
|
192
|
+
)
|
|
193
|
+
return prefix + "\n\n" + instruction_for_language(language)
|
|
194
|
+
|
|
140
195
|
# Screen-watch adds this immediately after the shared instruction. It narrows
|
|
141
196
|
# the no-narration rule to visible speech without silencing private thoughts.
|
|
142
197
|
SCREEN_WATCH_INSTRUCTION = (
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{agent_protocol_core-0.12.2 → agent_protocol_core-0.12.4}/src/agent_protocol_core/__init__.py
RENAMED
|
File without changes
|
{agent_protocol_core-0.12.2 → agent_protocol_core-0.12.4}/src/agent_protocol_core/protocol_leak.py
RENAMED
|
File without changes
|