fix: preserve interaction replies across chat recovery

This commit is contained in:
2026-10-29 17:53:33 +08:00
parent fbe273e90a
commit 52681a8451
38 changed files with 1623 additions and 314 deletions
+5 -1
View File
@@ -1,3 +1,5 @@
import ask_user from "../tools/ask_user.js";
import { registerHostQuestionPolicy } from "../host-question-policy.js";
import final_answer from "../tools/final_answer.js";
import present_answer from "../tools/present_answer.js";
import locate_features from "../tools/locate_features.js";
@@ -29,6 +31,7 @@ import send_task_message from "../tools/send_task_message.js";
import reply_agent_message from "../tools/reply_agent_message.js";
const businessTools = {
ask_user,
final_answer,
present_answer,
locate_features,
@@ -57,7 +60,7 @@ export default Plugin.define({
await ctx.tool.transform((editor) => {
for (const [name, definition] of Object.entries(businessTools)) {
const object = z.object(definition.args);
const input = (AGENT_MESSAGE_TOOLS as readonly string[]).includes(name) ? object.strict() : object;
const input = name === "ask_user" || (AGENT_MESSAGE_TOOLS as readonly string[]).includes(name) ? object.strict() : object;
editor.add({
name,
description: definition.description,
@@ -99,6 +102,7 @@ export default Plugin.define({
const mcpReport = await registerMcpPolicy(ctx);
await registerTaskAgentPolicy(ctx);
await registerAgentMessagePolicy(ctx);
await registerHostQuestionPolicy(ctx);
await ctx.rpc.register(Rpc.define({
id: "tjwater.tools",
methods: {