mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-30 11:21:07 +00:00
style: normalize import order and formatting
This commit is contained in:
@@ -8,6 +8,8 @@ import {
|
||||
} from "../../../test/helpers/extensions/bluebubbles-monitor.js";
|
||||
import type { ResolvedBlueBubblesAccount } from "./accounts.js";
|
||||
import { fetchBlueBubblesHistory } from "./history.js";
|
||||
import { createBlueBubblesDebounceRegistry } from "./monitor-debounce.js";
|
||||
import type { NormalizedWebhookMessage } from "./monitor-normalize.js";
|
||||
import { resetBlueBubblesSelfChatCache } from "./monitor-self-chat-cache.js";
|
||||
import { handleBlueBubblesWebhookRequest, resolveBlueBubblesMessageId } from "./monitor.js";
|
||||
import {
|
||||
@@ -27,8 +29,6 @@ import {
|
||||
resetBlueBubblesParticipantContactNameCacheForTest,
|
||||
setBlueBubblesParticipantContactDepsForTest,
|
||||
} from "./participant-contact-names.js";
|
||||
import { createBlueBubblesDebounceRegistry } from "./monitor-debounce.js";
|
||||
import type { NormalizedWebhookMessage } from "./monitor-normalize.js";
|
||||
import type { OpenClawConfig, PluginRuntime } from "./runtime-api.js";
|
||||
|
||||
// Mock dependencies
|
||||
@@ -155,7 +155,10 @@ function installTimingAwareInboundDebouncer(core: PluginRuntime) {
|
||||
core.channel.debounce.createInboundDebouncer = vi.fn((params: any) => {
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
type Item = any;
|
||||
const buckets = new Map<string, { items: Item[]; timer: ReturnType<typeof setTimeout> | null }>();
|
||||
const buckets = new Map<
|
||||
string,
|
||||
{ items: Item[]; timer: ReturnType<typeof setTimeout> | null }
|
||||
>();
|
||||
|
||||
const flush = async (key: string) => {
|
||||
const bucket = buckets.get(key);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { ModelRegistry } from "@mariozechner/pi-coding-agent";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type {
|
||||
ProviderResolveDynamicModelContext,
|
||||
ProviderRuntimeModel,
|
||||
} from "openclaw/plugin-sdk/plugin-entry";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { resolveGoogle31ForwardCompatModel } from "./provider-models.js";
|
||||
|
||||
function createTemplateModel(
|
||||
|
||||
@@ -8,9 +8,7 @@ const GEMINI_3_1_PRO_PREFIX = "gemini-3.1-pro";
|
||||
const GEMINI_3_1_FLASH_LITE_PREFIX = "gemini-3.1-flash-lite";
|
||||
const GEMINI_3_1_FLASH_PREFIX = "gemini-3.1-flash";
|
||||
const GEMINI_3_1_PRO_TEMPLATE_IDS = ["gemini-3-pro-preview"] as const;
|
||||
const GEMINI_3_1_FLASH_LITE_TEMPLATE_IDS = [
|
||||
"gemini-3.1-flash-lite-preview",
|
||||
] as const;
|
||||
const GEMINI_3_1_FLASH_LITE_TEMPLATE_IDS = ["gemini-3.1-flash-lite-preview"] as const;
|
||||
const GEMINI_3_1_FLASH_TEMPLATE_IDS = ["gemini-3-flash-preview"] as const;
|
||||
|
||||
function cloneFirstGoogleTemplateModel(params: {
|
||||
@@ -21,10 +19,7 @@ function cloneFirstGoogleTemplateModel(params: {
|
||||
ctx: ProviderResolveDynamicModelContext;
|
||||
patch?: Partial<ProviderRuntimeModel>;
|
||||
}): ProviderRuntimeModel | undefined {
|
||||
const templateProviderIds = [
|
||||
params.providerId,
|
||||
params.templateProviderId,
|
||||
]
|
||||
const templateProviderIds = [params.providerId, params.templateProviderId]
|
||||
.map((providerId) => providerId?.trim())
|
||||
.filter((providerId): providerId is string => Boolean(providerId));
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { detectLineMediaKind, resolveLineOutboundMedia, validateLineMediaUrl } from "./outbound-media.js";
|
||||
import {
|
||||
detectLineMediaKind,
|
||||
resolveLineOutboundMedia,
|
||||
validateLineMediaUrl,
|
||||
} from "./outbound-media.js";
|
||||
|
||||
describe("validateLineMediaUrl", () => {
|
||||
it("accepts HTTPS URL", () => {
|
||||
|
||||
@@ -30,9 +30,9 @@ function isLineUserTarget(target: string): boolean {
|
||||
function hasLineSpecificMediaOptions(lineData: LineChannelDataWithMedia): boolean {
|
||||
return Boolean(
|
||||
lineData.mediaKind ??
|
||||
lineData.previewImageUrl?.trim() ??
|
||||
(typeof lineData.durationMs === "number" ? lineData.durationMs : undefined) ??
|
||||
lineData.trackingId?.trim(),
|
||||
lineData.previewImageUrl?.trim() ??
|
||||
(typeof lineData.durationMs === "number" ? lineData.durationMs : undefined) ??
|
||||
lineData.trackingId?.trim(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,11 +21,7 @@ vi.mock("./conversation-route.js", async (importOriginal) => {
|
||||
|
||||
let buildTelegramMessageContextForTest: typeof import("./bot-message-context.test-harness.js").buildTelegramMessageContextForTest;
|
||||
|
||||
function createBoundRoute(params: {
|
||||
accountId: string;
|
||||
sessionKey: string;
|
||||
agentId: string;
|
||||
}) {
|
||||
function createBoundRoute(params: { accountId: string; sessionKey: string; agentId: string }) {
|
||||
return {
|
||||
configuredBinding: null,
|
||||
configuredBindingSessionKey: "",
|
||||
|
||||
@@ -153,6 +153,7 @@ import {
|
||||
stripSessionsYieldArtifacts,
|
||||
waitForSessionsYieldAbortSettle,
|
||||
} from "./attempt.sessions-yield.js";
|
||||
import { wrapStreamFnHandleSensitiveStopReason } from "./attempt.stop-reason-recovery.js";
|
||||
import {
|
||||
appendAttemptCacheTtlIfNeeded,
|
||||
composeSystemPromptWithHookContext,
|
||||
@@ -164,7 +165,6 @@ import {
|
||||
wrapStreamFnDecodeXaiToolCallArguments,
|
||||
wrapStreamFnRepairMalformedToolCallArguments,
|
||||
} from "./attempt.tool-call-argument-repair.js";
|
||||
import { wrapStreamFnHandleSensitiveStopReason } from "./attempt.stop-reason-recovery.js";
|
||||
import {
|
||||
wrapStreamFnSanitizeMalformedToolCalls,
|
||||
wrapStreamFnTrimToolCallNames,
|
||||
|
||||
@@ -8,6 +8,8 @@ import {
|
||||
type ModelRef,
|
||||
} from "../agents/model-selection.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { createSubsystemLogger } from "../logging/subsystem.js";
|
||||
import { normalizeProviderModelIdWithPlugin } from "../plugins/provider-runtime.js";
|
||||
import {
|
||||
clearGatewayModelPricingCacheState,
|
||||
getCachedGatewayModelPricing,
|
||||
@@ -15,8 +17,6 @@ import {
|
||||
replaceGatewayModelPricingCache,
|
||||
type CachedModelPricing,
|
||||
} from "./model-pricing-cache-state.js";
|
||||
import { createSubsystemLogger } from "../logging/subsystem.js";
|
||||
import { normalizeProviderModelIdWithPlugin } from "../plugins/provider-runtime.js";
|
||||
|
||||
type OpenRouterPricingEntry = {
|
||||
id: string;
|
||||
|
||||
@@ -56,16 +56,14 @@ describe("normalizeReplyPayloadsForDelivery", () => {
|
||||
expect(
|
||||
normalizeReplyPayloadsForDelivery([
|
||||
{ text: '{"action":"NO_REPLY"}' },
|
||||
{ text: "{\n \"action\": \"NO_REPLY\"\n}" },
|
||||
{ text: '{\n "action": "NO_REPLY"\n}' },
|
||||
]),
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
it("keeps JSON NO_REPLY objects that include extra fields", () => {
|
||||
expect(
|
||||
normalizeReplyPayloadsForDelivery([
|
||||
{ text: '{"action":"NO_REPLY","note":"example"}' },
|
||||
]),
|
||||
normalizeReplyPayloadsForDelivery([{ text: '{"action":"NO_REPLY","note":"example"}' }]),
|
||||
).toEqual([
|
||||
{
|
||||
text: '{"action":"NO_REPLY","note":"example"}',
|
||||
|
||||
@@ -14,7 +14,8 @@ export function hasBundledWebSearchCredential(params: {
|
||||
searchConfig?: Record<string, unknown>;
|
||||
}): boolean {
|
||||
const searchConfig =
|
||||
params.searchConfig ?? (params.config.tools?.web?.search as Record<string, unknown> | undefined);
|
||||
params.searchConfig ??
|
||||
(params.config.tools?.web?.search as Record<string, unknown> | undefined);
|
||||
return resolveBundledPluginWebSearchProviders({
|
||||
config: params.config,
|
||||
env: params.env,
|
||||
|
||||
@@ -23,8 +23,8 @@ import {
|
||||
DEFAULT_DANGEROUS_NODE_COMMANDS,
|
||||
resolveNodeCommandAllowlist,
|
||||
} from "../gateway/node-command-policy.js";
|
||||
import { hasBundledWebSearchCredential } from "../plugins/bundled-web-search-registry.js";
|
||||
import { resolveBrowserConfig } from "../plugin-sdk/browser-runtime.js";
|
||||
import { hasBundledWebSearchCredential } from "../plugins/bundled-web-search-registry.js";
|
||||
import { inferParamBFromIdOrName } from "../shared/model-param-b.js";
|
||||
import { pickSandboxToolPolicy } from "./audit-tool-policy.js";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user