HEL-833: restore runtime factory and verify R3 memory contracts

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
白栖知
2026-10-24 13:07:43 +08:00
co-authored by multica-agent
parent 78cab0456c
commit 89d53b6c53
23 changed files with 1772 additions and 19 deletions
+9
View File
@@ -34,6 +34,7 @@ class R2LLM(ControlledLLM):
self.reply = "我今天给一段旋律换了个结尾,停在了喜欢的那个音上。"
self.background_calls = []
self.background_messages = []
self.memory_calls = []
self.block = False
self.entered = None
self.release = None
@@ -51,6 +52,14 @@ class R2LLM(ControlledLLM):
yield LLMDelta(done=True, finish_reason="length" if self.mode == "length" else "stop")
return
prompt = messages[0].content
# R2 counters measure life/persona/sharing work. R3 has its own contract
# and call ledger; keep the old assertions and injected factory intact.
if "压缩这条已经成功保存的聊天" in prompt:
self.memory_calls.append(messages)
raw = json.loads(messages[1].content)["raw"]
yield LLMDelta(text=json.dumps({"gist": raw[:120], "affect": {"v": 0.0, "a": 0.0, "d": 0.0}}))
yield LLMDelta(done=True, finish_reason="stop")
return
self.background_calls.append(prompt)
self.background_messages.append(messages)
if self.entered: