fix: align draft/outbound typings and tests

This commit is contained in:
Peter Steinberger
2026-02-22 08:03:05 +00:00
parent 0ae7f962f9
commit 0c1a52307c
12 changed files with 49 additions and 33 deletions

View File

@@ -4,8 +4,6 @@ import path from "node:path";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { ReplyPayload } from "../../auto-reply/types.js";
import type { OpenClawConfig } from "../../config/config.js";
import { setActivePluginRegistry } from "../../plugins/runtime.js";
import { createTestRegistry } from "../../test-utils/channel-plugins.js";
import { typedCases } from "../../test-utils/typed-cases.js";
import {
ackDelivery,

View File

@@ -160,7 +160,7 @@ export function resolveOutboundTarget(params: {
};
}
const allowFrom =
const allowFromRaw =
params.allowFrom ??
(params.cfg && plugin.config.resolveAllowFrom
? plugin.config.resolveAllowFrom({
@@ -168,6 +168,7 @@ export function resolveOutboundTarget(params: {
accountId: params.accountId ?? undefined,
})
: undefined);
const allowFrom = allowFromRaw?.map((entry) => String(entry));
// Fall back to per-channel defaultTo when no explicit target is provided.
const effectiveTo =
@@ -360,12 +361,13 @@ export function resolveHeartbeatSenderContext(params: {
const accountId =
params.delivery.accountId ??
(provider === params.delivery.lastChannel ? params.delivery.lastAccountId : undefined);
const allowFrom = provider
const allowFromRaw = provider
? (getChannelPlugin(provider)?.config.resolveAllowFrom?.({
cfg: params.cfg,
accountId,
}) ?? [])
: [];
const allowFrom = allowFromRaw.map((entry) => String(entry));
const sender = resolveHeartbeatSenderId({
allowFrom,