Discord: trim monitor test import cost

This commit is contained in:
Peter Steinberger
2026-04-07 00:32:53 +08:00
parent 67520b6abf
commit ec359f5942
4 changed files with 14 additions and 2 deletions

View File

@@ -1,9 +1,9 @@
import os from "node:os";
import path from "node:path";
import { normalizeAccountId as normalizeSharedAccountId } from "openclaw/plugin-sdk/account-id";
import { normalizeProviderId } from "openclaw/plugin-sdk/agent-runtime";
import { withFileLock } from "openclaw/plugin-sdk/file-lock";
import { readJsonFileWithFallback, writeJsonFileAtomically } from "openclaw/plugin-sdk/json-store";
import { normalizeProviderId } from "openclaw/plugin-sdk/provider-model-shared";
import { resolveStateDir } from "openclaw/plugin-sdk/state-paths";
const MODEL_PICKER_PREFERENCES_LOCK_OPTIONS = {

View File

@@ -11,9 +11,9 @@ import {
} from "@buape/carbon";
import type { APISelectMenuOption } from "discord-api-types/v10";
import { ButtonStyle } from "discord-api-types/v10";
import { normalizeProviderId } from "openclaw/plugin-sdk/agent-runtime";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import type { ModelsProviderData } from "openclaw/plugin-sdk/models-provider-runtime";
import { normalizeProviderId } from "openclaw/plugin-sdk/provider-model-shared";
export const DISCORD_MODEL_PICKER_CUSTOM_ID_KEY = "mdlpk";
export const DISCORD_CUSTOM_ID_MAX_CHARS = 100;

View File

@@ -18,6 +18,14 @@ import {
} from "./native-command.js";
import { createNoopThreadBindingManager, type ThreadBindingManager } from "./thread-bindings.js";
vi.mock("openclaw/plugin-sdk/agent-runtime", () => ({
resolveDefaultModelForAgent: () => ({
provider: "anthropic",
model: "claude-sonnet-4.5",
}),
resolveHumanDelayConfig: () => undefined,
}));
type ModelPickerContext = Parameters<typeof createDiscordModelPickerFallbackButton>[0];
type PickerButton = ReturnType<typeof createDiscordModelPickerFallbackButton>;
type PickerSelect = ReturnType<typeof createDiscordModelPickerFallbackSelect>;

View File

@@ -26,6 +26,10 @@ vi.mock("openclaw/plugin-sdk/runtime-env", async () => {
};
});
vi.mock("openclaw/plugin-sdk/agent-runtime", () => ({
resolveHumanDelayConfig: () => undefined,
}));
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;