mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 09:41:11 +00:00
fix: restore main verification gates
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import type { OpenClawConfig as RuntimeApiOpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
|
||||
|
||||
export {
|
||||
DEFAULT_ACCOUNT_ID,
|
||||
getChatChannelMeta,
|
||||
@@ -29,4 +31,7 @@ export type { IMessageProbe } from "./src/probe.js";
|
||||
export { sendMessageIMessage } from "./src/send.js";
|
||||
export { setIMessageRuntime } from "./src/runtime.js";
|
||||
export { chunkTextForOutbound } from "./src/channel-api.js";
|
||||
export type { IMessageAccountConfig } from "./src/account-types.js";
|
||||
export type IMessageAccountConfig = Omit<
|
||||
NonNullable<NonNullable<RuntimeApiOpenClawConfig["channels"]>["imessage"]>,
|
||||
"accounts" | "defaultAccount"
|
||||
>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { createWhatsAppOutboundBase } from "./outbound-base.js";
|
||||
import { createWhatsAppPollFixture, expectWhatsAppPollSent } from "./outbound-test-support.js";
|
||||
import { createWhatsAppPollFixture } from "./outbound-test-support.js";
|
||||
|
||||
describe("createWhatsAppOutboundBase", () => {
|
||||
it("exposes the provided chunker", () => {
|
||||
@@ -75,7 +75,11 @@ describe("createWhatsAppOutboundBase", () => {
|
||||
accountId,
|
||||
});
|
||||
|
||||
expectWhatsAppPollSent(sendPollWhatsApp, { cfg, poll, to, accountId });
|
||||
expect(sendPollWhatsApp).toHaveBeenCalledWith(to, poll, {
|
||||
verbose: false,
|
||||
accountId,
|
||||
cfg,
|
||||
});
|
||||
expect(result).toEqual({
|
||||
channel: "whatsapp",
|
||||
messageId: "wa-poll-1",
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
|
||||
import { expect, type MockInstance } from "vitest";
|
||||
|
||||
export function createWhatsAppPollFixture() {
|
||||
const cfg = { marker: "resolved-cfg" } as OpenClawConfig;
|
||||
@@ -15,19 +14,3 @@ export function createWhatsAppPollFixture() {
|
||||
accountId: "work",
|
||||
};
|
||||
}
|
||||
|
||||
export function expectWhatsAppPollSent(
|
||||
sendPollWhatsApp: MockInstance,
|
||||
params: {
|
||||
cfg: OpenClawConfig;
|
||||
poll: { question: string; options: string[]; maxSelections: number };
|
||||
to?: string;
|
||||
accountId?: string;
|
||||
},
|
||||
) {
|
||||
expect(sendPollWhatsApp).toHaveBeenCalledWith(params.to ?? "+1555", params.poll, {
|
||||
verbose: false,
|
||||
accountId: params.accountId ?? "work",
|
||||
cfg: params.cfg,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -392,6 +392,7 @@ export async function loadRunOverflowCompactionHarness(): Promise<{
|
||||
isRateLimitAssistantError: mockedIsRateLimitAssistantError,
|
||||
isTimeoutErrorMessage: mockedIsTimeoutErrorMessage,
|
||||
pickFallbackThinkingLevel: mockedPickFallbackThinkingLevel,
|
||||
sanitizeUserFacingText: vi.fn((text: unknown) => (typeof text === "string" ? text : "")),
|
||||
}));
|
||||
|
||||
vi.doMock("./run/attempt.js", () => ({
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { loadBundledProviderPlugin as loadBundledProviderPluginFromTestHelper } from "../../test/helpers/media-generation/bundled-provider-builders.js";
|
||||
import {
|
||||
registerProviderPlugin,
|
||||
requireRegisteredProvider,
|
||||
@@ -12,7 +13,6 @@ import { isTruthyEnvValue } from "../infra/env.js";
|
||||
import { getShellEnvAppliedKeys, loadShellEnvFallback } from "../infra/shell-env.js";
|
||||
import { encodePngRgba, fillPixel } from "../media/png-encode.js";
|
||||
import { getProviderEnvVars } from "../secrets/provider-env-vars.js";
|
||||
import { loadBundledPluginPublicSurfaceSync } from "../test-utils/bundled-plugin-public-surface.js";
|
||||
import {
|
||||
DEFAULT_LIVE_IMAGE_MODELS,
|
||||
parseCaseFilter,
|
||||
@@ -38,10 +38,6 @@ type LiveProviderCase = {
|
||||
providerId: string;
|
||||
};
|
||||
|
||||
type BundledProviderEntryModule = {
|
||||
default: LiveProviderCase["plugin"];
|
||||
};
|
||||
|
||||
type LiveImageCase = {
|
||||
id: string;
|
||||
providerId: string;
|
||||
@@ -53,10 +49,7 @@ type LiveImageCase = {
|
||||
};
|
||||
|
||||
function loadBundledProviderPlugin(pluginId: string): LiveProviderCase["plugin"] {
|
||||
return loadBundledPluginPublicSurfaceSync<BundledProviderEntryModule>({
|
||||
pluginId,
|
||||
artifactBasename: "index.js",
|
||||
}).default;
|
||||
return loadBundledProviderPluginFromTestHelper(pluginId);
|
||||
}
|
||||
|
||||
const PROVIDER_CASES: LiveProviderCase[] = [
|
||||
|
||||
@@ -686,17 +686,17 @@ describe("workspace .env blocklist completeness", () => {
|
||||
await withDotEnvFixture(async ({ cwdDir }) => {
|
||||
await writeEnvFile(
|
||||
path.join(cwdDir, ".env"),
|
||||
"MY_APP_KEY=user-value\nGITHUB_TOKEN=ghp_test123\nDATABASE_URL_CUSTOM=pg://localhost\n",
|
||||
"MY_APP_KEY=user-value\nAPP_GITHUB_REPO=openclaw/openclaw\nDATABASE_URL_CUSTOM=pg://localhost\n",
|
||||
);
|
||||
|
||||
delete process.env.MY_APP_KEY;
|
||||
delete process.env.GITHUB_TOKEN;
|
||||
delete process.env.APP_GITHUB_REPO;
|
||||
delete process.env.DATABASE_URL_CUSTOM;
|
||||
|
||||
loadWorkspaceDotEnvFile(path.join(cwdDir, ".env"), { quiet: true });
|
||||
|
||||
expect(process.env.MY_APP_KEY).toBe("user-value");
|
||||
expect(process.env.GITHUB_TOKEN).toBe("ghp_test123");
|
||||
expect(process.env.APP_GITHUB_REPO).toBe("openclaw/openclaw");
|
||||
expect(process.env.DATABASE_URL_CUSTOM).toBe("pg://localhost");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -113,6 +113,21 @@ export function resolveConversationDeliveryTarget(params: {
|
||||
: typeof params.parentConversationId === "string"
|
||||
? normalizeOptionalString(params.parentConversationId)
|
||||
: undefined;
|
||||
const isThreadChild =
|
||||
conversationId && parentConversationId && parentConversationId !== conversationId;
|
||||
if (channel && isThreadChild) {
|
||||
if (
|
||||
channel === "matrix" ||
|
||||
channel === "slack" ||
|
||||
channel === "mattermost" ||
|
||||
channel === "telegram"
|
||||
) {
|
||||
return {
|
||||
to: `channel:${parentConversationId}`,
|
||||
threadId: conversationId,
|
||||
};
|
||||
}
|
||||
}
|
||||
const pluginTarget =
|
||||
channel && conversationId
|
||||
? getChannelPlugin(
|
||||
@@ -128,24 +143,6 @@ export function resolveConversationDeliveryTarget(params: {
|
||||
...(pluginTarget.threadId?.trim() ? { threadId: pluginTarget.threadId.trim() } : {}),
|
||||
};
|
||||
}
|
||||
const isThreadChild =
|
||||
conversationId && parentConversationId && parentConversationId !== conversationId;
|
||||
if (channel && isThreadChild) {
|
||||
if (
|
||||
channel === "matrix" ||
|
||||
channel === "slack" ||
|
||||
channel === "mattermost" ||
|
||||
channel === "telegram"
|
||||
) {
|
||||
return {
|
||||
to: formatConversationTarget({
|
||||
channel,
|
||||
conversationId: parentConversationId,
|
||||
}),
|
||||
threadId: conversationId,
|
||||
};
|
||||
}
|
||||
}
|
||||
const to = formatConversationTarget(params);
|
||||
return { to };
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type {
|
||||
ImageGenerationProviderPlugin,
|
||||
MusicGenerationProviderPlugin,
|
||||
OpenClawPluginApi,
|
||||
VideoGenerationProviderPlugin,
|
||||
@@ -22,6 +23,11 @@ export type BundledMusicProviderEntry = {
|
||||
provider: MusicGenerationProviderPlugin;
|
||||
};
|
||||
|
||||
export type BundledImageProviderEntry = {
|
||||
pluginId: string;
|
||||
provider: ImageGenerationProviderPlugin;
|
||||
};
|
||||
|
||||
const BUNDLED_VIDEO_PROVIDER_PLUGIN_IDS = [
|
||||
"alibaba",
|
||||
"byteplus",
|
||||
@@ -46,8 +52,12 @@ function loadBundledPluginEntry(pluginId: string): BundledPluginEntryModule {
|
||||
});
|
||||
}
|
||||
|
||||
export function loadBundledProviderPlugin(pluginId: string): BundledPluginEntryModule["default"] {
|
||||
return loadBundledPluginEntry(pluginId).default;
|
||||
}
|
||||
|
||||
async function registerBundledMediaPlugin(pluginId: string) {
|
||||
const { default: plugin } = loadBundledPluginEntry(pluginId);
|
||||
const plugin = loadBundledProviderPlugin(pluginId);
|
||||
return await registerProviderPlugin({
|
||||
plugin,
|
||||
id: pluginId,
|
||||
|
||||
Reference in New Issue
Block a user