refactor(plugin-sdk): untangle extension test seams

This commit is contained in:
Peter Steinberger
2026-03-29 23:43:17 +01:00
parent c942bd798f
commit 8861cdbb6f
176 changed files with 458 additions and 350 deletions

View File

@@ -1,2 +1,3 @@
**/node_modules/
**/.runtime-deps-*/
docs/.generated/

View File

@@ -2,8 +2,8 @@ import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { pathToFileURL } from "node:url";
import { runAcpRuntimeAdapterContract } from "openclaw/plugin-sdk/testing";
import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
import { runAcpRuntimeAdapterContract } from "../../../src/acp/runtime/adapter-contract.testkit.js";
import { resolveAcpxPluginConfig } from "./config.js";
import { AcpxRuntime, decodeAcpxRuntimeHandleState } from "./runtime.js";
import {

View File

@@ -1,10 +1,10 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import { AcpRuntimeError } from "../../../src/acp/runtime/errors.js";
import { AcpRuntimeError } from "openclaw/plugin-sdk/acp-runtime";
import {
__testing,
getAcpRuntimeBackend,
requireAcpRuntimeBackend,
} from "../../../src/acp/runtime/registry.js";
} from "openclaw/plugin-sdk/acp-runtime";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { AcpRuntime, OpenClawPluginServiceContext } from "../runtime-api.js";
import { ACPX_BUNDLED_BIN, ACPX_PINNED_VERSION } from "./config.js";
import { createAcpxRuntimeService } from "./service.js";

View File

@@ -1,9 +1,9 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../../../src/config/config.js";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import {
__testing as sessionBindingTesting,
registerSessionBindingAdapter,
} from "../../../src/infra/outbound/session-binding-service.js";
} from "openclaw/plugin-sdk/conversation-runtime";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { resolveBlueBubblesConversationRoute } from "./conversation-route.js";
const baseCfg = {

View File

@@ -1,6 +1,6 @@
import { createEmptyPluginRegistry } from "openclaw/plugin-sdk/testing";
import { setActivePluginRegistry } from "openclaw/plugin-sdk/testing";
import { afterEach, describe, expect, it } from "vitest";
import { createEmptyPluginRegistry } from "../../../src/plugins/registry.js";
import { setActivePluginRegistry } from "../../../src/plugins/runtime.js";
import type { WebhookTarget } from "./monitor-shared.js";
import { registerBlueBubblesWebhookTarget } from "./monitor.js";
import type { OpenClawConfig } from "./runtime-api.js";

View File

@@ -1,6 +1,6 @@
import { adaptScopedAccountAccessor } from "openclaw/plugin-sdk/channel-config-helpers";
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/routing";
import { describe, expect, it, vi } from "vitest";
import { DEFAULT_ACCOUNT_ID } from "../../../src/routing/session-key.js";
import {
createSetupWizardAdapter,
createTestWizardPrompter,

View File

@@ -115,7 +115,7 @@ vi.mock("../../../src/agents/tools/gateway.js", () => gatewayMocks);
const configMocks = vi.hoisted(() => ({
loadConfig: vi.fn(() => ({ browser: {} })),
}));
vi.mock("../../../src/config/config.js", () => configMocks);
vi.mock("openclaw/plugin-sdk/config-runtime", () => configMocks);
const sessionTabRegistryMocks = vi.hoisted(() => ({
trackSessionBrowserTab: vi.fn(),

View File

@@ -1,7 +1,7 @@
import fs from "node:fs/promises";
import path from "node:path";
import { MEDIA_MAX_BYTES } from "openclaw/plugin-sdk/media-runtime";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { MEDIA_MAX_BYTES } from "../../../../src/media/store.js";
import { createTempHomeEnv, type TempHomeEnv } from "../../test-support.js";
import { persistBrowserProxyFiles } from "./proxy-files.js";

View File

@@ -1,5 +1,5 @@
import { Command } from "commander";
import type { GatewayRpcOpts } from "../../../../src/cli/gateway-rpc.js";
import type { GatewayRpcOpts } from "openclaw/plugin-sdk/browser-support";
import { createCliRuntimeCapture } from "../../test-support.js";
import type { CliRuntimeCapture } from "../../test-support.js";

View File

@@ -8,7 +8,7 @@ const { loadConfigMock, isNodeCommandAllowedMock, resolveNodeCommandAllowlistMoc
}),
);
vi.mock("../../../../src/config/config.js", () => ({
vi.mock("openclaw/plugin-sdk/config-runtime", () => ({
loadConfig: loadConfigMock,
}));

View File

@@ -1,10 +1,10 @@
export { isLiveTestEnabled } from "../../src/agents/live-test-helpers.js";
export {
createCliRuntimeCapture,
isLiveTestEnabled,
type CliMockOutputRuntime,
type CliRuntimeCapture,
} from "../../src/cli/test-runtime-capture.js";
export type { OpenClawConfig } from "openclaw/plugin-sdk/browser-support";
} from "openclaw/plugin-sdk/testing";
export { type OpenClawConfig } from "openclaw/plugin-sdk/browser-support";
export { expectGeneratedTokenPersistedToGatewayAuth } from "../../test/helpers/plugins/auth-token-assertions.ts";
export { withEnv, withEnvAsync } from "../../test/helpers/plugins/env.ts";
export { withFetchPreconnect, type FetchMock } from "../../test/helpers/plugins/fetch-mock.ts";

View File

@@ -1,5 +1,5 @@
import { isLiveTestEnabled } from "openclaw/plugin-sdk/testing";
import { describe, expect, it } from "vitest";
import { isLiveTestEnabled } from "../../src/agents/live-test-helpers.js";
import { transcribeDeepgramAudio } from "./audio.js";
const DEEPGRAM_KEY = process.env.DEEPGRAM_API_KEY ?? "";

View File

@@ -1,9 +1,9 @@
import { describe, expect, it } from "vitest";
import {
createAuthCaptureJsonFetch,
createRequestCaptureJsonFetch,
installPinnedHostnameTestHooks,
} from "../../src/media-understanding/audio.test-helpers.js";
} from "openclaw/plugin-sdk/testing";
import { describe, expect, it } from "vitest";
import { transcribeDeepgramAudio } from "./audio.js";
installPinnedHostnameTestHooks();

View File

@@ -1,5 +1,5 @@
import { resolveProviderPluginChoice } from "openclaw/plugin-sdk/testing";
import { describe, expect, it } from "vitest";
import { resolveProviderPluginChoice } from "../../src/plugins/provider-wizard.js";
import { registerSingleProviderPlugin } from "../../test/helpers/plugins/plugin-registration.js";
import deepseekPlugin from "./index.js";

View File

@@ -1,5 +1,5 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { describe, expect, it } from "vitest";
import type { OpenClawConfig } from "../../../src/config/config.js";
import { inspectDiscordAccount } from "./account-inspect.js";
function asConfig(value: unknown): OpenClawConfig {

View File

@@ -1,5 +1,5 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../../../../src/config/config.js";
const runtimeModule = await import("./runtime.js");
const handleDiscordActionMock = vi

View File

@@ -1,6 +1,6 @@
import { PermissionFlagsBits } from "discord-api-types/v10";
import type { DiscordActionConfig } from "openclaw/plugin-sdk/config-runtime";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { DiscordActionConfig } from "../../../../src/config/types.discord.js";
import {
discordModerationActionRuntime,
handleDiscordModerationAction,

View File

@@ -1,7 +1,7 @@
import type { GatewayPlugin } from "@buape/carbon/gateway";
import type { DiscordActionConfig } from "openclaw/plugin-sdk/config-runtime";
import type { ActionGate } from "openclaw/plugin-sdk/discord-core";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { ActionGate } from "../../../../src/agents/tools/common.js";
import type { DiscordActionConfig } from "../../../../src/config/types.discord.js";
import { clearGateways, registerGateway } from "../monitor/gateway-registry.js";
import { handleDiscordPresenceAction } from "./runtime.presence.js";

View File

@@ -1,6 +1,6 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import type { DiscordActionConfig } from "openclaw/plugin-sdk/config-runtime";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../../../../src/config/config.js";
import type { DiscordActionConfig } from "../../../../src/config/types.discord.js";
import { discordGuildActionRuntime, handleDiscordGuildAction } from "./runtime.guild.js";
import { handleDiscordAction } from "./runtime.js";
import {

View File

@@ -28,7 +28,7 @@ describe("discord audit", () => {
},
},
},
} as unknown as import("../../../src/config/config.js").OpenClawConfig;
} as unknown as import("openclaw/plugin-sdk/config-runtime").OpenClawConfig;
const collected = collectDiscordAuditChannelIds({
cfg,
@@ -74,7 +74,7 @@ describe("discord audit", () => {
},
},
},
} as unknown as import("../../../src/config/config.js").OpenClawConfig;
} as unknown as import("openclaw/plugin-sdk/config-runtime").OpenClawConfig;
const collected = collectDiscordAuditChannelIds({ cfg, accountId: "default" });
expect(collected.channelIds).toEqual(["111"]);
@@ -99,7 +99,7 @@ describe("discord audit", () => {
},
},
},
} as unknown as import("../../../src/config/config.js").OpenClawConfig;
} as unknown as import("openclaw/plugin-sdk/config-runtime").OpenClawConfig;
const collected = collectDiscordAuditChannelIds({ cfg, accountId: "default" });
expect(collected.channelIds).toEqual([]);
@@ -128,7 +128,7 @@ describe("discord audit", () => {
},
},
},
} as unknown as import("../../../src/config/config.js").OpenClawConfig;
} as unknown as import("openclaw/plugin-sdk/config-runtime").OpenClawConfig;
const collected = collectDiscordAuditChannelIds({ cfg, accountId: "default" });
expect(collected.channelIds).toEqual(["111"]);

View File

@@ -1,9 +1,9 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import type {
PluginApprovalRequest,
PluginApprovalResolved,
} from "../../../src/infra/plugin-approvals.js";
import type { PluginRuntime } from "../../../src/plugins/runtime/types.js";
} from "openclaw/plugin-sdk/infra-runtime";
import type { PluginRuntime } from "openclaw/plugin-sdk/testing";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { createStartAccountContext } from "../../../test/helpers/plugins/start-account-context.js";
import type { ResolvedDiscordAccount } from "./accounts.js";
import type { OpenClawConfig } from "./runtime-api.js";

View File

@@ -1,6 +1,6 @@
import type { RequestClient } from "@buape/carbon";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { describe, expect, it } from "vitest";
import type { OpenClawConfig } from "../../../src/config/config.js";
import { createDiscordRestClient } from "./client.js";
describe("createDiscordRestClient", () => {

View File

@@ -1,6 +1,6 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import type { DirectoryConfigParams } from "openclaw/plugin-sdk/directory-runtime";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../../../src/config/config.js";
import type { DirectoryConfigParams } from "../../../src/plugin-sdk/directory-runtime.js";
import { listDiscordDirectoryGroupsLive, listDiscordDirectoryPeersLive } from "./directory-live.js";
function makeParams(overrides: Partial<DirectoryConfigParams> = {}): DirectoryConfigParams {

View File

@@ -1,5 +1,5 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { describe, expect, it } from "vitest";
import type { OpenClawConfig } from "../../../src/config/config.js";
import {
getDiscordExecApprovalApprovers,
isDiscordExecApprovalApprover,

View File

@@ -168,7 +168,7 @@ describe("DiscordMessageListener", () => {
warn: vi.fn(),
error: vi.fn(),
} as unknown as ReturnType<
typeof import("../../../src/logging/subsystem.js").createSubsystemLogger
typeof import("openclaw/plugin-sdk/logging-core").createSubsystemLogger
>;
const handler = vi.fn(async () => {
throw new Error("boom");
@@ -191,7 +191,7 @@ describe("DiscordMessageListener", () => {
warn: vi.fn(),
error: vi.fn(),
} as unknown as ReturnType<
typeof import("../../../src/logging/subsystem.js").createSubsystemLogger
typeof import("openclaw/plugin-sdk/logging-core").createSubsystemLogger
>;
const listener = new DiscordMessageListener(handler, logger);
@@ -990,9 +990,9 @@ function makeReactionListenerParams(overrides?: {
guildEntries?: Record<string, DiscordGuildEntryResolved>;
}) {
return {
cfg: {} as ReturnType<typeof import("../../../src/config/config.js").loadConfig>,
cfg: {} as ReturnType<typeof import("openclaw/plugin-sdk/config-runtime").loadConfig>,
accountId: "acc-1",
runtime: {} as import("../../../src/runtime.js").RuntimeEnv,
runtime: {} as import("openclaw/plugin-sdk/runtime-env").RuntimeEnv,
botUserId: overrides?.botUserId ?? "bot-1",
dmEnabled: overrides?.dmEnabled ?? true,
groupDmEnabled: overrides?.groupDmEnabled ?? true,
@@ -1008,7 +1008,7 @@ function makeReactionListenerParams(overrides?: {
error: vi.fn(),
debug: vi.fn(),
} as unknown as ReturnType<
typeof import("../../../src/logging/subsystem.js").createSubsystemLogger
typeof import("openclaw/plugin-sdk/logging-core").createSubsystemLogger
>,
};
}

View File

@@ -11,19 +11,19 @@ vi.mock("openclaw/plugin-sdk/config-runtime", async (importOriginal) => {
};
});
import { __testing as acpManagerTesting } from "../../../../src/acp/control-plane/manager.js";
import { handleAcpCommand } from "../../../../src/auto-reply/reply/commands-acp.js";
import { buildCommandTestParams } from "../../../../src/auto-reply/reply/commands-spawn.test-harness.js";
import { setDefaultChannelPluginRegistryForTests } from "../../../../src/commands/channel-test-helpers.js";
import type { OpenClawConfig } from "../../../../src/config/config.js";
import * as gatewayCall from "../../../../src/gateway/call.js";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import {
__testing as sessionBindingTesting,
getSessionBindingService,
registerSessionBindingAdapter,
type SessionBindingBindInput,
type SessionBindingRecord,
} from "../../../../src/infra/outbound/session-binding-service.js";
} from "openclaw/plugin-sdk/conversation-runtime";
import { __testing as acpManagerTesting } from "openclaw/plugin-sdk/testing";
import { handleAcpCommand } from "openclaw/plugin-sdk/testing";
import { buildCommandTestParams } from "openclaw/plugin-sdk/testing";
import { setDefaultChannelPluginRegistryForTests } from "openclaw/plugin-sdk/testing";
import * as gatewayCall from "openclaw/plugin-sdk/testing";
import { preflightDiscordMessage } from "./message-handler.preflight.js";
import {
createDiscordMessage,

View File

@@ -1,5 +1,5 @@
import type { AuthProfileStore } from "openclaw/plugin-sdk/provider-auth";
import { describe, expect, it, vi } from "vitest";
import type { AuthProfileStore } from "../../../../src/agents/auth-profiles.js";
import {
createDiscordAutoPresenceController,
resolveDiscordAutoPresenceDecision,

View File

@@ -3,9 +3,9 @@ import os from "node:os";
import path from "node:path";
import type { ButtonInteraction, ComponentData } from "@buape/carbon";
import { Routes } from "discord-api-types/v10";
import { clearSessionStoreCacheForTest } from "openclaw/plugin-sdk/config-runtime";
import type { DiscordExecApprovalConfig } from "openclaw/plugin-sdk/config-runtime";
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { clearSessionStoreCacheForTest } from "../../../../src/config/sessions.js";
import type { DiscordExecApprovalConfig } from "../../../../src/config/types.discord.js";
const STORE_PATH = path.join(os.tmpdir(), "openclaw-exec-approvals-test.json");

View File

@@ -1,6 +1,6 @@
import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-runtime";
import { expectChannelInboundContextContract as expectInboundContextContract } from "openclaw/plugin-sdk/testing";
import { describe, expect, it } from "vitest";
import { finalizeInboundContext } from "../../../../src/auto-reply/reply/inbound-context.js";
import { expectChannelInboundContextContract as expectInboundContextContract } from "../../../../src/channels/plugins/contracts/suites.js";
import { buildDiscordInboundAccessContext } from "./inbound-context.js";
import { buildFinalizedDiscordDirectInboundContext } from "./inbound-context.test-helpers.js";

View File

@@ -16,7 +16,7 @@ vi.mock("../../../../src/channels/plugins/binding-routing.js", async (importOrig
);
});
import { __testing as sessionBindingTesting } from "../../../../src/infra/outbound/session-binding-service.js";
import { __testing as sessionBindingTesting } from "openclaw/plugin-sdk/conversation-runtime";
import { preflightDiscordMessage } from "./message-handler.preflight.js";
import {
createDiscordMessage,
@@ -148,7 +148,7 @@ function createBasePreflightParams(overrides?: Record<string, unknown>) {
discordConfig: {
allowBots: true,
} as NonNullable<
import("../../../../src/config/config.js").OpenClawConfig["channels"]
import("openclaw/plugin-sdk/config-runtime").OpenClawConfig["channels"]
>["discord"],
data: createGuildEvent({
channelId: CHANNEL_ID,
@@ -162,7 +162,7 @@ function createBasePreflightParams(overrides?: Record<string, unknown>) {
discordConfig: {
allowBots: true,
} as NonNullable<
import("../../../../src/config/config.js").OpenClawConfig["channels"]
import("openclaw/plugin-sdk/config-runtime").OpenClawConfig["channels"]
>["discord"],
...overrides,
} satisfies Parameters<typeof preflightDiscordMessage>[0];

View File

@@ -9,7 +9,7 @@ vi.mock("./preflight-audio.runtime.js", () => ({
import {
__testing as sessionBindingTesting,
registerSessionBindingAdapter,
} from "../../../../src/infra/outbound/session-binding-service.js";
} from "openclaw/plugin-sdk/conversation-runtime";
import {
createDiscordMessage,
createDiscordPreflightArgs,
@@ -37,9 +37,7 @@ beforeAll(async () => {
});
function createThreadBinding(
overrides?: Partial<
import("../../../../src/infra/outbound/session-binding-service.js").SessionBindingRecord
>,
overrides?: Partial<import("openclaw/plugin-sdk/conversation-runtime").SessionBindingRecord>,
) {
return {
bindingId: "default:thread-1",
@@ -60,11 +58,11 @@ function createThreadBinding(
webhookToken: "tok-1",
},
...overrides,
} satisfies import("../../../../src/infra/outbound/session-binding-service.js").SessionBindingRecord;
} satisfies import("openclaw/plugin-sdk/conversation-runtime").SessionBindingRecord;
}
function createPreflightArgs(params: {
cfg: import("../../../../src/config/config.js").OpenClawConfig;
cfg: import("openclaw/plugin-sdk/config-runtime").OpenClawConfig;
discordConfig: DiscordConfig;
data: DiscordMessageEvent;
client: DiscordClient;
@@ -114,7 +112,7 @@ async function runThreadBoundPreflight(params: {
threadId: string;
parentId: string;
message: import("@buape/carbon").Message;
threadBinding: import("../../../../src/infra/outbound/session-binding-service.js").SessionBindingRecord;
threadBinding: import("openclaw/plugin-sdk/conversation-runtime").SessionBindingRecord;
discordConfig: DiscordConfig;
registerBindingAdapter?: boolean;
}) {
@@ -156,7 +154,7 @@ async function runGuildPreflight(params: {
guildId: string;
message: import("@buape/carbon").Message;
discordConfig: DiscordConfig;
cfg?: import("../../../../src/config/config.js").OpenClawConfig;
cfg?: import("openclaw/plugin-sdk/config-runtime").OpenClawConfig;
guildEntries?: Parameters<typeof preflightDiscordMessage>[0]["guildEntries"];
includeGuildObject?: boolean;
}) {
@@ -473,7 +471,7 @@ describe("preflightDiscordMessage", () => {
createPreflightArgs({
cfg: {
...DEFAULT_PREFLIGHT_CFG,
} as import("../../../../src/config/config.js").OpenClawConfig,
} as import("openclaw/plugin-sdk/config-runtime").OpenClawConfig,
discordConfig: {
allowBots: true,
} as DiscordConfig,
@@ -732,7 +730,7 @@ describe("preflightDiscordMessage", () => {
mentionPatterns: ["openclaw"],
},
},
} as import("../../../../src/config/config.js").OpenClawConfig,
} as import("openclaw/plugin-sdk/config-runtime").OpenClawConfig,
discordConfig: {} as DiscordConfig,
data: createGuildEvent({
channelId,

View File

@@ -1,5 +1,5 @@
import { DEFAULT_EMOJIS } from "openclaw/plugin-sdk/channel-feedback";
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { DEFAULT_EMOJIS } from "../../../../src/channels/status-reactions.js";
const sendMocks = vi.hoisted(() => ({
reactMessageDiscord: vi.fn<

View File

@@ -5,19 +5,19 @@ import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
const fetchRemoteMedia = vi.fn();
const saveMediaBuffer = vi.fn();
vi.mock("../../../../src/media/fetch.js", () => ({
vi.mock("openclaw/plugin-sdk/media-runtime", () => ({
fetchRemoteMedia: (...args: unknown[]) => fetchRemoteMedia(...args),
}));
vi.mock("../../../../src/media/store.js", async (importOriginal) => {
const actual = await importOriginal<typeof import("../../../../src/media/store.js")>();
vi.mock("openclaw/plugin-sdk/media-runtime", async (importOriginal) => {
const actual = await importOriginal<typeof import("openclaw/plugin-sdk/media-runtime")>();
return {
...actual,
saveMediaBuffer: (...args: unknown[]) => saveMediaBuffer(...args),
};
});
vi.mock("../../../../src/globals.js", () => ({
vi.mock("openclaw/plugin-sdk/runtime-env", () => ({
logVerbose: () => {},
}));

View File

@@ -1,8 +1,8 @@
import { serializePayload } from "@buape/carbon";
import { ComponentType } from "discord-api-types/v10";
import * as modelsCommandModule from "openclaw/plugin-sdk/command-auth";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { describe, expect, it, vi } from "vitest";
import * as modelsCommandModule from "../../../../src/auto-reply/reply/commands-models.js";
import type { OpenClawConfig } from "../../../../src/config/config.js";
import {
DISCORD_CUSTOM_ID_MAX_CHARS,
DISCORD_MODEL_PICKER_MODEL_PAGE_SIZE,

View File

@@ -4,8 +4,8 @@ import type { DiscordAccountConfig } from "openclaw/plugin-sdk/config-runtime";
import * as conversationRuntime from "openclaw/plugin-sdk/conversation-runtime";
import { buildAgentSessionKey } from "openclaw/plugin-sdk/routing";
import * as securityRuntime from "openclaw/plugin-sdk/security-runtime";
import { peekSystemEvents, resetSystemEventsForTest } from "openclaw/plugin-sdk/testing";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { peekSystemEvents, resetSystemEventsForTest } from "../../../../src/infra/system-events.ts";
import { expectPairingReplyText } from "../../../../test/helpers/pairing-reply.js";
import {
readAllowFromStoreMock,

View File

@@ -87,11 +87,8 @@ vi.mock("openclaw/plugin-sdk/reply-runtime", async (importOriginal) => {
// agent-components.ts can bind the core dispatcher via reply-runtime re-exports,
// so keep this direct mock to avoid hitting real embedded-agent dispatch in tests.
vi.mock("../../../../src/auto-reply/reply/provider-dispatcher.js", async (importOriginal) => {
const actual =
await importOriginal<
typeof import("../../../../src/auto-reply/reply/provider-dispatcher.js")
>();
vi.mock("openclaw/plugin-sdk/reply-runtime", async (importOriginal) => {
const actual = await importOriginal<typeof import("openclaw/plugin-sdk/reply-runtime")>();
return {
...actual,
dispatchReplyWithBufferedBlockDispatcher: (...args: unknown[]) => dispatchReplyMock(...args),

View File

@@ -1,10 +1,10 @@
import { ChannelType } from "discord-api-types/v10";
import type { NativeCommandSpec } from "openclaw/plugin-sdk/command-auth";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import type { DiscordAccountConfig } from "openclaw/plugin-sdk/config-runtime";
import * as pluginCommandsModule from "openclaw/plugin-sdk/plugin-runtime";
import * as dispatcherModule from "openclaw/plugin-sdk/reply-runtime";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { NativeCommandSpec } from "../../../../src/auto-reply/commands-registry.js";
import * as dispatcherModule from "../../../../src/auto-reply/reply/provider-dispatcher.js";
import type { OpenClawConfig } from "../../../../src/config/config.js";
import type { DiscordAccountConfig } from "../../../../src/config/types.discord.js";
import * as pluginCommandsModule from "../../../../src/plugins/commands.js";
import { __testing as nativeCommandTesting, createDiscordNativeCommand } from "./native-command.js";
import {
createMockCommandInteraction,

View File

@@ -1,15 +1,12 @@
import { ChannelType } from "discord-api-types/v10";
import * as commandRegistryModule from "openclaw/plugin-sdk/command-auth";
import type { ChatCommandDefinition, CommandArgsParsing } from "openclaw/plugin-sdk/command-auth";
import type { ModelsProviderData } from "openclaw/plugin-sdk/command-auth";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import * as dispatcherModule from "openclaw/plugin-sdk/reply-runtime";
import * as globalsModule from "openclaw/plugin-sdk/runtime-env";
import * as timeoutModule from "openclaw/plugin-sdk/runtime-env";
import { beforeEach, describe, expect, it, vi } from "vitest";
import * as commandRegistryModule from "../../../../src/auto-reply/commands-registry.js";
import type {
ChatCommandDefinition,
CommandArgsParsing,
} from "../../../../src/auto-reply/commands-registry.types.js";
import type { ModelsProviderData } from "../../../../src/auto-reply/reply/commands-models.js";
import * as dispatcherModule from "../../../../src/auto-reply/reply/provider-dispatcher.js";
import type { OpenClawConfig } from "../../../../src/config/config.js";
import * as globalsModule from "../../../../src/globals.js";
import * as timeoutModule from "../../../../src/utils/with-timeout.js";
import * as modelPickerPreferencesModule from "./model-picker-preferences.js";
import * as modelPickerModule from "./model-picker.js";
import { createModelsProviderData as createBaseModelsProviderData } from "./model-picker.test-utils.js";

View File

@@ -1,6 +1,6 @@
import { ChannelType } from "discord-api-types/v10";
import type { OpenClawConfig, loadConfig } from "openclaw/plugin-sdk/config-runtime";
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig, loadConfig } from "../../../../src/config/config.js";
const { logVerboseMock } = vi.hoisted(() => ({
logVerboseMock: vi.fn(),
@@ -26,7 +26,7 @@ vi.mock("openclaw/plugin-sdk/runtime-env", async () => {
};
});
let listNativeCommandSpecs: typeof import("../../../../src/auto-reply/commands-registry.js").listNativeCommandSpecs;
let listNativeCommandSpecs: typeof import("openclaw/plugin-sdk/command-auth").listNativeCommandSpecs;
let createDiscordNativeCommand: typeof import("./native-command.js").createDiscordNativeCommand;
let createNoopThreadBindingManager: typeof import("./thread-bindings.js").createNoopThreadBindingManager;
@@ -97,7 +97,7 @@ function readChoices(option: CommandOption | undefined): unknown[] | undefined {
describe("createDiscordNativeCommand option wiring", () => {
beforeAll(async () => {
({ listNativeCommandSpecs } = await import("../../../../src/auto-reply/commands-registry.js"));
({ listNativeCommandSpecs } = await import("openclaw/plugin-sdk/command-auth"));
({ createDiscordNativeCommand } = await import("./native-command.js"));
({ createNoopThreadBindingManager } = await import("./thread-bindings.js"));
});

View File

@@ -1,9 +1,9 @@
import { ChannelType } from "discord-api-types/v10";
import type { NativeCommandSpec } from "openclaw/plugin-sdk/command-auth";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { clearPluginCommands, registerPluginCommand } from "openclaw/plugin-sdk/plugin-runtime";
import { setDefaultChannelPluginRegistryForTests } from "openclaw/plugin-sdk/testing";
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import type { NativeCommandSpec } from "../../../../src/auto-reply/commands-registry.js";
import { setDefaultChannelPluginRegistryForTests } from "../../../../src/commands/channel-test-helpers.js";
import type { OpenClawConfig } from "../../../../src/config/config.js";
import { clearPluginCommands, registerPluginCommand } from "../../../../src/plugins/commands.js";
import {
createMockCommandInteraction,
type MockCommandInteraction,

View File

@@ -2,13 +2,13 @@ import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { ChannelType, type AutocompleteInteraction } from "@buape/carbon";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import {
findCommandByNativeName,
resolveCommandArgChoices,
} from "../../../../src/auto-reply/commands-registry.js";
import type { OpenClawConfig, loadConfig } from "../../../../src/config/config.js";
import { clearSessionStoreCacheForTest } from "../../../../src/config/sessions/store.js";
} from "openclaw/plugin-sdk/command-auth";
import type { OpenClawConfig, loadConfig } from "openclaw/plugin-sdk/config-runtime";
import { clearSessionStoreCacheForTest } from "openclaw/plugin-sdk/config-runtime";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { createNoopThreadBindingManager } from "./thread-bindings.js";
const ensureConfiguredBindingRouteReadyMock = vi.hoisted(() =>

View File

@@ -1,5 +1,5 @@
import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { RuntimeEnv } from "../../../../src/runtime.js";
import { createNonExitingTypedRuntimeEnv } from "../../../../test/helpers/plugins/runtime-env.js";
import * as resolveChannelsModule from "../resolve-channels.js";
import * as resolveUsersModule from "../resolve-users.js";

View File

@@ -1,7 +1,7 @@
import { EventEmitter } from "node:events";
import type { GatewayPlugin } from "@buape/carbon/gateway";
import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env";
import { beforeEach, describe, expect, it, vi, type Mock } from "vitest";
import type { RuntimeEnv } from "../../../../src/runtime.js";
import type { WaitForDiscordGatewayStopParams } from "../monitor.gateway.js";
import type { MutableDiscordGateway } from "./gateway-handle.js";
import type { DiscordGatewayEvent } from "./gateway-supervisor.js";

View File

@@ -1,8 +1,8 @@
import { EventEmitter } from "node:events";
import { RateLimitError } from "@buape/carbon";
import { AcpRuntimeError } from "openclaw/plugin-sdk/acp-runtime";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { AcpRuntimeError } from "../../../../src/acp/runtime/errors.js";
import type { OpenClawConfig } from "../../../../src/config/config.js";
import {
baseConfig,
baseRuntime,
@@ -605,7 +605,7 @@ describe("monitorDiscordProvider", () => {
it("registers plugin commands from the real registry as native Discord commands", async () => {
const { clearPluginCommands, getPluginCommandSpecs, registerPluginCommand } =
await import("../../../../src/plugins/commands.js");
await import("openclaw/plugin-sdk/plugin-runtime");
clearPluginCommands();
listNativeCommandSpecsForConfigMock.mockReturnValue([
{ name: "status", description: "Status", acceptsArgs: false },

View File

@@ -1,6 +1,6 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../../../../src/config/config.js";
import type { RuntimeEnv } from "../../../../src/runtime.js";
import {
__testing as threadBindingTesting,
createThreadBindingManager,

View File

@@ -1,6 +1,6 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import type { ResolvedAgentRoute } from "openclaw/plugin-sdk/routing";
import { describe, expect, it } from "vitest";
import type { OpenClawConfig } from "../../../../src/config/config.js";
import type { ResolvedAgentRoute } from "../../../../src/routing/resolve-route.js";
import {
buildDiscordRoutePeer,
resolveDiscordBoundConversationRoute,

View File

@@ -1,6 +1,6 @@
import { ChannelType } from "discord-api-types/v10";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../../../../src/config/config.js";
import * as discordClientModule from "../client.js";
import * as discordSendModule from "../send.js";
import type { ThreadBindingRecord } from "./thread-bindings.types.js";

View File

@@ -2,13 +2,13 @@ import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { ChannelType } from "discord-api-types/v10";
import { beforeEach, describe, expect, it, vi } from "vitest";
import {
clearRuntimeConfigSnapshot,
setRuntimeConfigSnapshot,
type OpenClawConfig,
} from "../../../../src/config/config.js";
import { getSessionBindingService } from "../../../../src/infra/outbound/session-binding-service.js";
} from "openclaw/plugin-sdk/config-runtime";
import { getSessionBindingService } from "openclaw/plugin-sdk/conversation-runtime";
import { beforeEach, describe, expect, it, vi } from "vitest";
const hoisted = vi.hoisted(() => {
const sendMessageDiscord = vi.fn(async (_to: string, _text: string, _opts?: unknown) => ({}));

View File

@@ -1,6 +1,6 @@
import { ChannelType } from "@buape/carbon";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../../../../src/config/config.js";
type MaybeCreateDiscordAutoThreadFn = typeof import("./threading.js").maybeCreateDiscordAutoThread;
const { generateThreadTitleMock } = vi.hoisted(() => ({

View File

@@ -4,9 +4,9 @@ import { makeDiscordRest } from "./send.test-harness.js";
const loadConfigMock = vi.hoisted(() => vi.fn(() => ({ session: { dmScope: "main" } })));
vi.mock("../../../src/config/config.js", async () => {
const actual = await vi.importActual<typeof import("../../../src/config/config.js")>(
"../../../src/config/config.js",
vi.mock("openclaw/plugin-sdk/config-runtime", async () => {
const actual = await vi.importActual<typeof import("openclaw/plugin-sdk/config-runtime")>(
"openclaw/plugin-sdk/config-runtime",
);
return {
...actual,

View File

@@ -3,8 +3,8 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
const recordChannelActivityMock = vi.hoisted(() => vi.fn());
const loadConfigMock = vi.hoisted(() => vi.fn(() => ({ channels: { discord: {} } })));
vi.mock("../../../src/config/config.js", async (importOriginal) => {
const actual = await importOriginal<typeof import("../../../src/config/config.js")>();
vi.mock("openclaw/plugin-sdk/config-runtime", async (importOriginal) => {
const actual = await importOriginal<typeof import("openclaw/plugin-sdk/config-runtime")>();
return {
...actual,
loadConfig: () => loadConfigMock(),

View File

@@ -1,5 +1,5 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../../../src/config/config.js";
import * as directoryLive from "./directory-live.js";
import {
resolveDiscordGroupRequireMention,

View File

@@ -1,5 +1,5 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { afterEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../../../src/config/config.js";
import { resolveDiscordToken } from "./token.js";
describe("resolveDiscordToken", () => {

View File

@@ -1,5 +1,5 @@
import type { EnvelopeFormatOptions } from "openclaw/plugin-sdk/channel-inbound";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { EnvelopeFormatOptions } from "../../../src/auto-reply/envelope.js";
import { createPluginRuntimeMock } from "../../../test/helpers/plugins/plugin-runtime-mock.js";
import { createRuntimeEnv } from "../../../test/helpers/plugins/runtime-env.js";
import type { ClawdbotConfig, PluginRuntime } from "../runtime-api.js";

View File

@@ -1,6 +1,6 @@
import type * as ConversationRuntime from "openclaw/plugin-sdk/conversation-runtime";
import type { ResolvedAgentRoute } from "openclaw/plugin-sdk/routing";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { ResolvedAgentRoute } from "../../../src/routing/resolve-route.js";
import { createPluginRuntimeMock } from "../../../test/helpers/plugins/plugin-runtime-mock.js";
import { createRuntimeEnv } from "../../../test/helpers/plugins/runtime-env.js";
import type { ClawdbotConfig, PluginRuntime, RuntimeEnv } from "../runtime-api.js";
@@ -259,7 +259,7 @@ vi.mock("openclaw/plugin-sdk/conversation-runtime", async (importOriginal) => {
};
});
vi.mock("../../../src/infra/outbound/session-binding-service.js", () => ({
vi.mock("openclaw/plugin-sdk/conversation-runtime", () => ({
getSessionBindingService: () => ({
resolveByConversation: mockResolveBoundConversation,
touch: mockTouchBinding,

View File

@@ -1,7 +1,7 @@
import fs from "node:fs/promises";
import path from "node:path";
import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { resolvePreferredOpenClawTmpDir } from "../../../src/infra/tmp-openclaw-dir.js";
import type { ClawdbotConfig } from "../runtime-api.js";
const createFeishuClientMock = vi.hoisted(() => vi.fn());

View File

@@ -1,9 +1,9 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { hasControlCommand } from "../../../src/auto-reply/command-detection.js";
import { hasControlCommand } from "openclaw/plugin-sdk/command-auth";
import {
createInboundDebouncer,
resolveInboundDebounceMs,
} from "../../../src/auto-reply/inbound-debounce.js";
} from "openclaw/plugin-sdk/reply-runtime";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { createPluginRuntimeMock } from "../../../test/helpers/plugins/plugin-runtime-mock.js";
import type { ClawdbotConfig, RuntimeEnv } from "../runtime-api.js";
import { monitorSingleAccount } from "./monitor.account.js";

View File

@@ -1,9 +1,9 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { hasControlCommand } from "../../../src/auto-reply/command-detection.js";
import { hasControlCommand } from "openclaw/plugin-sdk/command-auth";
import {
createInboundDebouncer,
resolveInboundDebounceMs,
} from "../../../src/auto-reply/inbound-debounce.js";
} from "openclaw/plugin-sdk/reply-runtime";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { createPluginRuntimeMock } from "../../../test/helpers/plugins/plugin-runtime-mock.js";
import {
createNonExitingTypedRuntimeEnv,

View File

@@ -1,6 +1,6 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { getSessionBindingService } from "openclaw/plugin-sdk/conversation-runtime";
import { beforeEach, describe, expect, it } from "vitest";
import type { OpenClawConfig } from "../../../src/config/config.js";
import { getSessionBindingService } from "../../../src/infra/outbound/session-binding-service.js";
import { __testing, createFeishuThreadBindingManager } from "./thread-bindings.js";
const baseCfg = {

View File

@@ -1,5 +1,5 @@
import * as ssrf from "openclaw/plugin-sdk/infra-runtime";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import * as ssrf from "../../src/infra/net/ssrf.js";
import { withFetchPreconnect } from "../../test/helpers/plugins/fetch-mock.js";
import { createRequestCaptureJsonFetch } from "../../test/helpers/plugins/media-understanding.js";
import { describeGeminiVideo } from "./media-understanding-provider.js";

View File

@@ -1,8 +1,8 @@
import { EventEmitter } from "node:events";
import type { IncomingMessage } from "node:http";
import { createEmptyPluginRegistry } from "openclaw/plugin-sdk/testing";
import { setActivePluginRegistry } from "openclaw/plugin-sdk/testing";
import { afterEach, describe, expect, it, vi } from "vitest";
import { createEmptyPluginRegistry } from "../../../src/plugins/registry.js";
import { setActivePluginRegistry } from "../../../src/plugins/runtime.js";
import { createMockServerResponse } from "../../../test/helpers/plugins/mock-http-response.js";
import type { OpenClawConfig, PluginRuntime } from "../runtime-api.js";
import type { ResolvedGoogleChatAccount } from "./accounts.js";

View File

@@ -1,9 +1,9 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../../../src/config/config.js";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import {
__testing as sessionBindingTesting,
registerSessionBindingAdapter,
} from "../../../src/infra/outbound/session-binding-service.js";
} from "openclaw/plugin-sdk/conversation-runtime";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { resolveIMessageConversationRoute } from "./conversation-route.js";
const baseCfg = {

View File

@@ -1,5 +1,5 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { describe, expect, it } from "vitest";
import type { OpenClawConfig } from "../../../src/config/config.js";
import {
buildIMessageInboundContext,
resolveIMessageInboundDecision,

View File

@@ -1,5 +1,5 @@
import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { RuntimeEnv } from "../../../../src/runtime.js";
const sendMessageIMessageMock = vi.hoisted(() =>
vi.fn().mockImplementation(async (_to: string, message: string) => ({

View File

@@ -1,6 +1,6 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { sanitizeTerminalText } from "openclaw/plugin-sdk/testing";
import { describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../../../../src/config/config.js";
import { sanitizeTerminalText } from "../../../../src/terminal/safe-text.js";
import {
describeIMessageEchoDropLog,
resolveIMessageInboundDecision,

View File

@@ -1,5 +1,5 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { afterEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../../../../src/config/config.js";
import { createSentMessageCache } from "./echo-cache.js";
import { resolveIMessageInboundDecision } from "./inbound-processing.js";
import { createSelfChatCache } from "./self-chat-cache.js";

View File

@@ -1,6 +1,6 @@
import * as processRuntime from "openclaw/plugin-sdk/process-runtime";
import * as setupRuntime from "openclaw/plugin-sdk/setup";
import { beforeEach, describe, expect, it, vi } from "vitest";
import * as processRuntime from "../../../src/plugin-sdk/process-runtime.js";
import * as setupRuntime from "../../../src/plugin-sdk/setup.js";
import * as clientModule from "./client.js";
import {
resolveIMessageGroupRequireMention,

View File

@@ -1,5 +1,5 @@
import { resolveChannelGroupPolicy } from "openclaw/plugin-sdk/config-runtime";
import { describe, expect, it } from "vitest";
import { resolveChannelGroupPolicy } from "../../../src/config/group-policy.js";
import {
resolveIrcGroupAccessGate,
resolveIrcGroupMatch,

View File

@@ -1,17 +1,20 @@
import { mkdtempSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
import { resolveApiKeyForProvider, resolveEnvApiKey } from "../../src/agents/model-auth.js";
import type { OpenClawConfig } from "../../src/config/config.js";
import { resolveAgentModelPrimaryValue } from "../../src/config/model-input.js";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import {
buildKilocodeModelDefinition,
KILOCODE_DEFAULT_CONTEXT_WINDOW,
KILOCODE_DEFAULT_MAX_TOKENS,
KILOCODE_DEFAULT_COST,
KILOCODE_DEFAULT_MODEL_ID,
} from "../../src/plugin-sdk/kilocode.js";
} from "openclaw/plugin-sdk/kilocode";
import {
resolveApiKeyForProvider,
resolveEnvApiKey,
} from "openclaw/plugin-sdk/provider-auth-runtime";
import { resolveAgentModelPrimaryValue } from "openclaw/plugin-sdk/provider-onboard";
import { describe, expect, it } from "vitest";
import { captureEnv } from "../../test/helpers/plugins/env.js";
import {
applyKilocodeProviderConfig,

View File

@@ -4,9 +4,9 @@ import path from "node:path";
import type { MessageEvent, PostbackEvent } from "@line/bot-sdk";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { getSessionBindingService } from "openclaw/plugin-sdk/conversation-runtime";
import { __testing as sessionBindingTesting } from "openclaw/plugin-sdk/conversation-runtime";
import { setDefaultChannelPluginRegistryForTests } from "openclaw/plugin-sdk/testing";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { setDefaultChannelPluginRegistryForTests } from "../../../src/commands/channel-test-helpers.js";
import { __testing as sessionBindingTesting } from "../../../src/infra/outbound/session-binding-service.js";
import { buildLineMessageContext, buildLinePostbackContext } from "./bot-message-context.js";
import { linePlugin } from "./channel.js";
import type { ResolvedLineAccount } from "./types.js";

View File

@@ -2,8 +2,8 @@ import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import type { ISyncResponse } from "matrix-js-sdk";
import * as jsonFiles from "openclaw/plugin-sdk/infra-runtime";
import { afterEach, describe, expect, it, vi } from "vitest";
import * as jsonFiles from "../../../../../src/infra/json-files.js";
import { FileBackedMatrixSyncStore } from "./file-sync-store.js";
function createSyncResponse(nextBatch: string): ISyncResponse {

View File

@@ -1,8 +1,8 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import {
__testing as sessionBindingTesting,
registerSessionBindingAdapter,
} from "../../../../../src/infra/outbound/session-binding-service.js";
} from "openclaw/plugin-sdk/conversation-runtime";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { installMatrixMonitorTestRuntime } from "../../test-runtime.js";
import { createMatrixRoomMessageHandler } from "./handler.js";
import {

View File

@@ -1,11 +1,8 @@
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { getSessionBindingService, __testing } from "openclaw/plugin-sdk/conversation-runtime";
import { beforeEach, describe, expect, it, vi } from "vitest";
import {
getSessionBindingService,
__testing,
} from "../../../../src/infra/outbound/session-binding-service.js";
import type { PluginRuntime } from "../../runtime-api.js";
const sendMessageMatrixMock = vi.hoisted(() =>

View File

@@ -2,13 +2,13 @@ import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { Command } from "commander";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import {
firstWrittenJsonArg,
spyRuntimeErrors,
spyRuntimeJson,
spyRuntimeLogs,
} from "../../../src/cli/test-runtime-capture.js";
} from "openclaw/plugin-sdk/testing";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
const getMemorySearchManager = vi.hoisted(() => vi.fn());
const loadConfig = vi.hoisted(() => vi.fn(() => ({})));

View File

@@ -1,5 +1,5 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../../src/config/types.openclaw.js";
import { createTestPluginApi } from "../../test/helpers/plugins/plugin-api.js";
import { getAccessTokenResultAsync } from "./cli.js";
import plugin from "./index.js";

View File

@@ -1,6 +1,6 @@
import { writeFileSync } from "node:fs";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { afterEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../../src/config/config.js";
import {
buildMicrosoftSpeechProvider,
isCjkDominant,

View File

@@ -1,8 +1,8 @@
import { describe, expect, it } from "vitest";
import {
resolveAgentModelFallbackValues,
resolveAgentModelPrimaryValue,
} from "../../src/config/model-input.js";
} from "openclaw/plugin-sdk/provider-onboard";
import { describe, expect, it } from "vitest";
import {
createConfigWithFallbacks,
createLegacyProviderConfig,

View File

@@ -1,8 +1,8 @@
import { describe, expect, it } from "vitest";
import {
createRequestCaptureJsonFetch,
installPinnedHostnameTestHooks,
} from "../../src/media-understanding/audio.test-helpers.js";
} from "openclaw/plugin-sdk/testing";
import { describe, expect, it } from "vitest";
import { mistralMediaUnderstandingProvider } from "./media-understanding-provider.js";
installPinnedHostnameTestHooks();

View File

@@ -1,8 +1,8 @@
import { describe, expect, it } from "vitest";
import {
resolveAgentModelFallbackValues,
resolveAgentModelPrimaryValue,
} from "../../src/config/model-input.js";
} from "openclaw/plugin-sdk/provider-onboard";
import { describe, expect, it } from "vitest";
import {
createConfigWithFallbacks,
createLegacyProviderConfig,

View File

@@ -1,8 +1,8 @@
import { describe, expect, it } from "vitest";
import {
createRequestCaptureJsonFetch,
installPinnedHostnameTestHooks,
} from "../../src/media-understanding/audio.test-helpers.js";
} from "openclaw/plugin-sdk/testing";
import { describe, expect, it } from "vitest";
import { describeMoonshotVideo } from "./media-understanding-provider.js";
installPinnedHostnameTestHooks();

View File

@@ -17,7 +17,7 @@ vi.mock("./graph-upload.js", async () => {
};
});
import { resolvePreferredOpenClawTmpDir } from "../../../src/infra/tmp-openclaw-dir.js";
import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
import {
type MSTeamsAdapter,
type MSTeamsRenderedMessage,

View File

@@ -1,5 +1,5 @@
import { jsonResponse, requestBodyText, requestUrl } from "openclaw/plugin-sdk/testing";
import { afterEach, describe, expect, it, vi } from "vitest";
import { jsonResponse, requestBodyText, requestUrl } from "../../../src/test-helpers/http.js";
import {
enrichOllamaModelsWithContext,
resolveOllamaApiBase,

View File

@@ -1,7 +1,7 @@
import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env";
import type { WizardPrompter } from "openclaw/plugin-sdk/setup";
import { jsonResponse, requestBodyText, requestUrl } from "openclaw/plugin-sdk/testing";
import { afterEach, describe, expect, it, vi } from "vitest";
import type { RuntimeEnv } from "../../../src/runtime.js";
import { jsonResponse, requestBodyText, requestUrl } from "../../../src/test-helpers/http.js";
import type { WizardPrompter } from "../../../src/wizard/prompts.js";
import {
configureOllamaNonInteractive,
ensureOllamaModelPulled,

View File

@@ -4,12 +4,12 @@ import path from "node:path";
import { getModel } from "@mariozechner/pi-ai";
import { AuthStorage, ModelRegistry } from "@mariozechner/pi-coding-agent";
import OpenAI from "openai";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { loadConfig } from "openclaw/plugin-sdk/config-runtime";
import { encodePngRgba, fillPixel } from "openclaw/plugin-sdk/media-runtime";
import * as providerAuth from "openclaw/plugin-sdk/provider-auth-runtime";
import type { ResolvedTtsConfig } from "openclaw/plugin-sdk/speech-runtime";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../../src/config/config.js";
import { loadConfig } from "../../src/config/config.js";
import { encodePngRgba, fillPixel } from "../../src/media/png-encode.js";
import type { ResolvedTtsConfig } from "../../src/tts/tts.js";
import {
registerProviderPlugin,
requireRegisteredProvider,

View File

@@ -1,9 +1,9 @@
import { describe, expect, it } from "vitest";
import {
createAuthCaptureJsonFetch,
createRequestCaptureJsonFetch,
installPinnedHostnameTestHooks,
} from "../../src/media-understanding/audio.test-helpers.js";
} from "openclaw/plugin-sdk/testing";
import { describe, expect, it } from "vitest";
import { transcribeOpenAiAudio } from "./media-understanding-provider.js";
installPinnedHostnameTestHooks();

View File

@@ -1,8 +1,8 @@
import { describe, expect, it } from "vitest";
import {
resolveAgentModelFallbackValues,
resolveAgentModelPrimaryValue,
} from "../../src/config/model-input.js";
} from "openclaw/plugin-sdk/provider-onboard";
import { describe, expect, it } from "vitest";
import {
createConfigWithFallbacks,
EXPECTED_FALLBACKS,

View File

@@ -1,8 +1,8 @@
import { describe, expect, it } from "vitest";
import {
resolveAgentModelFallbackValues,
resolveAgentModelPrimaryValue,
} from "../../src/config/model-input.js";
} from "openclaw/plugin-sdk/provider-onboard";
import { describe, expect, it } from "vitest";
import {
createConfigWithFallbacks,
EXPECTED_FALLBACKS,

View File

@@ -1,8 +1,8 @@
import { describe, expect, it } from "vitest";
import {
resolveAgentModelFallbackValues,
resolveAgentModelPrimaryValue,
} from "../../src/config/model-input.js";
} from "openclaw/plugin-sdk/provider-onboard";
import { describe, expect, it } from "vitest";
import {
createConfigWithFallbacks,
EXPECTED_FALLBACKS,

View File

@@ -3,8 +3,8 @@ import fs from "node:fs/promises";
import net from "node:net";
import os from "node:os";
import path from "node:path";
import { createSandboxTestContext } from "openclaw/plugin-sdk/testing";
import { describe, expect, it } from "vitest";
import { createSandboxTestContext } from "../../../src/agents/sandbox/test-fixtures.js";
import {
createSandboxBrowserConfig,
createSandboxPruneConfig,

View File

@@ -2,8 +2,8 @@ import fsSync from "node:fs";
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { createSandboxTestContext } from "openclaw/plugin-sdk/testing";
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { createSandboxTestContext } from "../../../src/agents/sandbox/test-fixtures.js";
import type { OpenShellSandboxBackend } from "./backend.js";
import {
buildExecRemoteCommand,

View File

@@ -1,5 +1,5 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../../../src/config/config.js";
import type { SignalDaemonExitEvent } from "./daemon.js";
import {
createSignalToolResultConfig,

View File

@@ -1,7 +1,7 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { resolveAgentRoute } from "openclaw/plugin-sdk/routing";
import { normalizeE164 } from "openclaw/plugin-sdk/text-runtime";
import { describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../../../src/config/config.js";
import { expectPairingReplyText } from "../../../test/helpers/pairing-reply.js";
import {
createSignalToolResultConfig,

View File

@@ -1,6 +1,6 @@
import type { MsgContext } from "openclaw/plugin-sdk/reply-runtime";
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import type { MsgContext } from "../../../../src/auto-reply/templating.js";
let expectInboundContextContract: typeof import("../../../../src/channels/plugins/contracts/suites.js").expectChannelInboundContextContract;
let expectInboundContextContract: typeof import("openclaw/plugin-sdk/testing").expectChannelInboundContextContract;
let createBaseSignalEventHandlerDeps: typeof import("./event-handler.test-harness.js").createBaseSignalEventHandlerDeps;
let createSignalReceiveEvent: typeof import("./event-handler.test-harness.js").createSignalReceiveEvent;
@@ -53,7 +53,7 @@ describe("signal createSignalEventHandler inbound context", () => {
vi.useRealTimers();
vi.resetModules();
({ expectChannelInboundContextContract: expectInboundContextContract } =
await import("../../../../src/channels/plugins/contracts/suites.js"));
await import("openclaw/plugin-sdk/testing"));
({ createBaseSignalEventHandlerDeps, createSignalReceiveEvent } =
await import("./event-handler.test-harness.js"));
({ createSignalEventHandler } = await import("./event-handler.js"));

View File

@@ -1,7 +1,7 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import type { MsgContext } from "openclaw/plugin-sdk/reply-runtime";
import { buildDispatchInboundCaptureMock } from "openclaw/plugin-sdk/testing";
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import type { MsgContext } from "../../../../src/auto-reply/templating.js";
import { buildDispatchInboundCaptureMock } from "../../../../src/channels/plugins/contracts/inbound-testkit.js";
import type { OpenClawConfig } from "../../../../src/config/types.js";
type SignalMsgContext = Pick<MsgContext, "Body" | "WasMentioned"> & {
Body?: string;

View File

@@ -1,5 +1,5 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../../../src/config/config.js";
import { handleSlackAction, slackActionRuntime } from "./action-runtime.js";
import { parseSlackBlocksInput } from "./blocks-input.js";

View File

@@ -1,5 +1,5 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { describe, expect, it } from "vitest";
import type { OpenClawConfig } from "../../../src/config/config.js";
import { isSlackInteractiveRepliesEnabled } from "./interactive-replies.js";
describe("isSlackInteractiveRepliesEnabled", () => {

View File

@@ -1,5 +1,5 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { describe, expect, it } from "vitest";
import type { OpenClawConfig } from "../../../src/config/config.js";
import { listSlackMessageActions } from "./message-actions.js";
describe("listSlackMessageActions", () => {

View File

@@ -1,5 +1,5 @@
import { resetInboundDedupe } from "openclaw/plugin-sdk/reply-runtime";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { resetInboundDedupe } from "../../../src/auto-reply/reply/inbound-dedupe.js";
import {
flush,
getSlackClient,

View File

@@ -13,7 +13,7 @@ import {
stopSlackMonitor,
} from "./monitor.test-helpers.js";
let resetInboundDedupe: typeof import("../../../src/auto-reply/reply/inbound-dedupe.js").resetInboundDedupe;
let resetInboundDedupe: typeof import("openclaw/plugin-sdk/reply-runtime").resetInboundDedupe;
let HISTORY_CONTEXT_MARKER: typeof import("../../../src/auto-reply/reply/history.js").HISTORY_CONTEXT_MARKER;
let CURRENT_MESSAGE_MARKER: typeof import("../../../src/auto-reply/reply/mentions.js").CURRENT_MESSAGE_MARKER;
let monitorSlackProvider: typeof import("./monitor.js").monitorSlackProvider;
@@ -23,7 +23,7 @@ const { sendMock, replyMock, reactMock, upsertPairingRequestMock } = slackTestSt
beforeEach(async () => {
vi.resetModules();
({ resetInboundDedupe } = await import("../../../src/auto-reply/reply/inbound-dedupe.js"));
({ resetInboundDedupe } = await import("openclaw/plugin-sdk/reply-runtime"));
({ HISTORY_CONTEXT_MARKER } = await import("../../../src/auto-reply/reply/history.js"));
({ CURRENT_MESSAGE_MARKER } = await import("../../../src/auto-reply/reply/mentions.js"));
({ monitorSlackProvider } = await import("./monitor.js"));

View File

@@ -1,7 +1,7 @@
import type { App } from "@slack/bolt";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env";
import { describe, expect, it } from "vitest";
import type { OpenClawConfig } from "../../../../src/config/config.js";
import type { RuntimeEnv } from "../../../../src/runtime.js";
import { createSlackMonitorContext } from "./context.js";
function createTestContext() {

Some files were not shown because too many files have changed in this diff Show More