refactor(agents): use silent token constant in prompts

This commit is contained in:
sebslight
2026-02-16 08:19:15 -05:00
parent e3e8046a93
commit 553d17f8af
7 changed files with 65 additions and 7 deletions

View File

@@ -138,6 +138,45 @@ describe("dispatchReplyFromConfig", () => {
);
});
it("routes media-only tool results when summaries are suppressed", async () => {
mocks.tryFastAbortFromMessage.mockResolvedValue({
handled: false,
aborted: false,
});
mocks.routeReply.mockClear();
const cfg = {} as OpenClawConfig;
const dispatcher = createDispatcher();
const ctx = buildTestCtx({
Provider: "slack",
ChatType: "group",
AccountId: "acc-1",
OriginatingChannel: "telegram",
OriginatingTo: "telegram:999",
});
const replyResolver = async (
_ctx: MsgContext,
opts: GetReplyOptions | undefined,
_cfg: OpenClawConfig,
) => {
expect(opts?.onToolResult).toBeDefined();
await opts?.onToolResult?.({
text: "NO_REPLY",
mediaUrls: ["https://example.com/tts-routed.opus"],
});
return undefined;
};
await dispatchReplyFromConfig({ ctx, cfg, dispatcher, replyResolver });
expect(dispatcher.sendToolResult).not.toHaveBeenCalled();
expect(dispatcher.sendFinalReply).not.toHaveBeenCalled();
expect(mocks.routeReply).toHaveBeenCalledTimes(1);
const routed = mocks.routeReply.mock.calls[0]?.[0] as { payload?: ReplyPayload } | undefined;
expect(routed?.payload?.mediaUrls).toEqual(["https://example.com/tts-routed.opus"]);
expect(routed?.payload?.text).toBeUndefined();
});
it("provides onToolResult in DM sessions", async () => {
mocks.tryFastAbortFromMessage.mockResolvedValue({
handled: false,