























@@ -1,7 +1,6 @@
11import { resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
22import { describe, expect, it } from "vitest";
33import type { ReplyPayload } from "../../auto-reply/types.js";
4-import type { OpenClawConfig } from "../../config/types.openclaw.js";
54import { typedCases } from "../../test-utils/typed-cases.js";
65import {
76createOutboundPayloadPlan,
@@ -15,7 +14,6 @@ import {
1514projectOutboundPayloadPlanForOutbound,
1615summarizeOutboundPayloadForTransport,
1716} from "./payloads.js";
18-import { registerPendingSpawnedChildrenQuery } from "./pending-spawn-query.js";
19172018function resolveMirrorProjection(payloads: readonly ReplyPayload[]) {
2119const normalized = normalizeReplyPayloadsForDelivery(payloads);
@@ -191,45 +189,20 @@ describe("normalizeReplyPayloadsForDelivery", () => {
191189});
192190193191it("drops bare silent replies for direct conversations", () => {
194-const cfg: OpenClawConfig = {
195-agents: {
196-defaults: {
197-silentReply: {
198-group: "allow",
199-internal: "allow",
200-},
201-},
202-},
203-};
204-205-const sessionKey = "agent:main:telegram:direct:123";
206192expect(
207193projectOutboundPayloadPlanForDelivery(
208194createOutboundPayloadPlan([{ text: "NO_REPLY" }], {
209- cfg,
210- sessionKey,
195+sessionKey: "agent:main:telegram:direct:123",
211196surface: "telegram",
212197}),
213198),
214199).toStrictEqual([]);
215200});
216201217-it("drops bare silent replies for groups when policy allows silence", () => {
218-const cfg: OpenClawConfig = {
219-agents: {
220-defaults: {
221-silentReply: {
222-group: "allow",
223-internal: "allow",
224-},
225-},
226-},
227-};
228-202+it("drops bare silent replies for groups", () => {
229203expect(
230204projectOutboundPayloadPlanForDelivery(
231205createOutboundPayloadPlan([{ text: "NO_REPLY" }], {
232- cfg,
233206sessionKey: "agent:main:telegram:group:123",
234207surface: "telegram",
235208}),
@@ -238,20 +211,8 @@ describe("normalizeReplyPayloadsForDelivery", () => {
238211});
239212240213it("does not add silent-reply chatter when visible content is already being delivered", () => {
241-const cfg: OpenClawConfig = {
242-agents: {
243-defaults: {
244-silentReply: {
245-group: "allow",
246-internal: "allow",
247-},
248-},
249-},
250-};
251-252214const delivery = projectOutboundPayloadPlanForDelivery(
253215createOutboundPayloadPlan([{ text: "NO_REPLY" }, { text: "visible reply" }], {
254- cfg,
255216sessionKey: "agent:main:telegram:direct:123",
256217surface: "telegram",
257218}),
@@ -260,50 +221,6 @@ describe("normalizeReplyPayloadsForDelivery", () => {
260221expect(delivery[0]?.text).toBe("visible reply");
261222});
262223263-describe("pending spawned subagent children", () => {
264-const cfg: OpenClawConfig = {
265-agents: {
266-defaults: {
267-silentReply: { group: "allow", internal: "allow" },
268-},
269-},
270-};
271-const planSilent = (sessionKey: string, hasPendingSpawnedChildren?: boolean) =>
272-projectOutboundPayloadPlanForDelivery(
273-createOutboundPayloadPlan([{ text: "NO_REPLY" }], {
274- cfg,
275- sessionKey,
276-surface: "telegram",
277- hasPendingSpawnedChildren,
278-}),
279-);
280-281-it("drops bare silent replies when the context flag is set", () => {
282-expect(planSilent("agent:main:telegram:direct:123", true)).toStrictEqual([]);
283-});
284-285-it("drops bare silent replies via the registered runtime query", () => {
286-const sessionKey = "agent:main:telegram:direct:456";
287-const previousQuery = registerPendingSpawnedChildrenQuery((key) => key === sessionKey);
288-try {
289-expect(planSilent(sessionKey)).toStrictEqual([]);
290-} finally {
291-registerPendingSpawnedChildrenQuery(previousQuery);
292-}
293-});
294-295-it("still drops bare silent replies when the query throws", () => {
296-const previousQuery = registerPendingSpawnedChildrenQuery(() => {
297-throw new Error("registry unavailable");
298-});
299-try {
300-expect(planSilent("agent:main:telegram:direct:789")).toStrictEqual([]);
301-} finally {
302-registerPendingSpawnedChildrenQuery(previousQuery);
303-}
304-});
305-});
306-307224it("is idempotent for already-normalized delivery payloads", () => {
308225const once = normalizeReplyPayloadsForDelivery([
309226{
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。