docs: document outbound message policy · openclaw/openclaw@ba72fb5
steipete
·
2026-06-05
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Verifies outbound text/media send-unit planning, chunking, captions, and |
| 2 | +// single-use implicit reply consumption. |
1 | 3 | import { describe, expect, it } from "vitest"; |
2 | 4 | import { planOutboundMediaMessageUnits, planOutboundTextMessageUnits } from "./message-plan.js"; |
3 | 5 | import { createReplyToDeliveryPolicy } from "./reply-policy.js"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Message planning expands normalized payloads into ordered text/media send |
| 2 | +// units while preserving reply-to consumption rules. |
1 | 3 | import { |
2 | 4 | chunkByParagraph, |
3 | 5 | chunkMarkdownTextWithMode, |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Covers outbound message send/poll orchestration, target resolution, durable |
| 2 | +// capability checks, gateway fallback, dry runs, and payload planning. |
1 | 3 | import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; |
2 | 4 | |
3 | 5 | const mocks = vi.hoisted(() => ({ |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Outbound message entrypoint resolves channel/target, durable capability |
| 2 | +// requirements, payload plans, gateway fallback, and optional mirroring. |
1 | 3 | import type { ReplyPayload } from "../../auto-reply/reply-payload.js"; |
2 | 4 | import { deriveDurableFinalDeliveryRequirements } from "../../channels/message/capabilities.js"; |
3 | 5 | import { sendDurableMessageBatch } from "../../channels/message/runtime.js"; |
@@ -33,6 +35,8 @@ let messageGatewayRuntimePromise: Promise<typeof import("./message.gateway.runti
|
33 | 35 | null; |
34 | 36 | |
35 | 37 | function loadMessageConfigRuntime() { |
| 38 | +// Keep config/runtime loading lazy so importing message helpers does not |
| 39 | +// bootstrap plugin registries or gateway clients. |
36 | 40 | messageConfigRuntimePromise ??= import("./message.config.runtime.js"); |
37 | 41 | return messageConfigRuntimePromise; |
38 | 42 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Covers message action allowlists plus cross-context marker/decorator policy |
| 2 | +// for same-provider and cross-provider sends. |
1 | 3 | import { beforeAll, beforeEach, describe, expect, it } from "vitest"; |
2 | 4 | import { vi } from "vitest"; |
3 | 5 | import type { ChannelMessageActionName } from "../../channels/plugins/types.js"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Outbound policy enforces message-tool allowlists and cross-context delivery |
| 2 | +// markers/decorations before channel dispatch. |
1 | 3 | import { normalizeUniqueStringEntries } from "@openclaw/normalization-core/string-normalization"; |
2 | 4 | import { getChannelPlugin } from "../../channels/plugins/index.js"; |
3 | 5 | import type { |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Reply-payload normalization projects loose tool/agent objects onto the |
| 2 | +// outbound-supported reply payload fields. |
1 | 3 | import { readStringValue } from "@openclaw/normalization-core/string-coerce"; |
2 | 4 | import type { ReplyPayload as InternalReplyPayload } from "../../auto-reply/reply-payload.js"; |
3 | 5 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Covers reply-to fanout and delivery policy consumption for explicit, |
| 2 | +// implicit, single-use, and disabled reply modes. |
1 | 3 | import { describe, expect, it } from "vitest"; |
2 | 4 | import { createReplyToFanout } from "./reply-policy.js"; |
3 | 5 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Reply policy coordinates explicit and implicit reply-to ids across chunked or |
| 2 | +// multi-payload outbound delivery. |
1 | 3 | import { isSingleUseReplyToMode } from "../../auto-reply/reply/reply-reference.js"; |
2 | 4 | import type { ReplyPayload } from "../../auto-reply/types.js"; |
3 | 5 | import type { ReplyToMode } from "../../config/types.js"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +// Covers source-delivery target matching, message-tool ownership plans, and |
| 2 | +// fallback satisfaction outcomes. |
1 | 3 | import { describe, expect, it, vi } from "vitest"; |
2 | 4 | |
3 | 5 | vi.mock("./target-normalization.js", () => ({ |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。