mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 10:07:41 +00:00
fix: align draft/outbound typings and tests
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { packNpmSpecToArchive, withTempDir } from "./install-source-utils.js";
|
||||
import type { NpmIntegrityDriftPayload } from "./npm-integrity.js";
|
||||
import { installFromNpmSpecArchive } from "./npm-pack-install.js";
|
||||
|
||||
vi.mock("./install-source-utils.js", async (importOriginal) => {
|
||||
@@ -37,12 +38,7 @@ describe("installFromNpmSpecArchive", () => {
|
||||
|
||||
const runInstall = async (overrides: {
|
||||
expectedIntegrity?: string;
|
||||
onIntegrityDrift?: (payload: {
|
||||
spec: string;
|
||||
expectedIntegrity: string;
|
||||
actualIntegrity: string;
|
||||
resolvedSpec: string;
|
||||
}) => boolean | Promise<boolean>;
|
||||
onIntegrityDrift?: (payload: NpmIntegrityDriftPayload) => boolean | Promise<boolean>;
|
||||
warn?: (message: string) => void;
|
||||
installFromArchive: (params: {
|
||||
archivePath: string;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user