mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-16 11:41:08 +00:00
chore: enable redundant type constituent checks
This commit is contained in:
@@ -18,7 +18,7 @@ type DispatchReplyContext = Record<string, unknown> & {
|
||||
SessionKey?: string;
|
||||
};
|
||||
type DispatchReplyDispatcher = {
|
||||
sendFinalReply: (payload: { text: string }) => unknown | Promise<unknown>;
|
||||
sendFinalReply: (payload: { text: string }) => unknown;
|
||||
};
|
||||
type DispatchReplyFromConfigMock = Mock<
|
||||
(params: {
|
||||
@@ -26,9 +26,7 @@ type DispatchReplyFromConfigMock = Mock<
|
||||
dispatcher: DispatchReplyDispatcher;
|
||||
}) => Promise<{ queuedFinal: boolean; counts: DispatchReplyCounts }>
|
||||
>;
|
||||
type WithReplyDispatcherMock = Mock<
|
||||
(params: { run: () => unknown | Promise<unknown> }) => Promise<unknown>
|
||||
>;
|
||||
type WithReplyDispatcherMock = Mock<(params: { run: () => unknown }) => Promise<unknown>>;
|
||||
type FeishuLifecycleTestMocks = {
|
||||
createEventDispatcherMock: UnknownMock;
|
||||
monitorWebSocketMock: AsyncUnknownMock;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import "./lifecycle.test-support.js";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { createRuntimeEnv } from "../../../test/helpers/plugins/runtime-env.js";
|
||||
import type { ClawdbotConfig, RuntimeEnv } from "../runtime-api.js";
|
||||
import type { ClawdbotConfig } from "../runtime-api.js";
|
||||
import { getFeishuLifecycleTestMocks } from "./lifecycle.test-support.js";
|
||||
import {
|
||||
createFeishuLifecycleFixture,
|
||||
@@ -27,7 +27,7 @@ const {
|
||||
} = getFeishuLifecycleTestMocks();
|
||||
|
||||
let _handlers: Record<string, (data: unknown) => Promise<void>> = {};
|
||||
let lastRuntime: RuntimeEnv | null = null;
|
||||
let lastRuntime: ReturnType<typeof createRuntimeEnv> | null = null;
|
||||
const originalStateDir = process.env.OPENCLAW_STATE_DIR;
|
||||
const { cfg: lifecycleConfig, account: lifecycleAccount } = createFeishuLifecycleFixture({
|
||||
accountId: "acct-acp",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { createRuntimeEnv } from "../../../test/helpers/plugins/runtime-env.js";
|
||||
import type { RuntimeEnv } from "../runtime-api.js";
|
||||
import "./lifecycle.test-support.js";
|
||||
import { getFeishuLifecycleTestMocks } from "./lifecycle.test-support.js";
|
||||
import {
|
||||
@@ -30,7 +29,7 @@ const {
|
||||
} = getFeishuLifecycleTestMocks();
|
||||
|
||||
let _handlers: Record<string, (data: unknown) => Promise<void>> = {};
|
||||
let lastRuntime: RuntimeEnv | null = null;
|
||||
let lastRuntime: ReturnType<typeof createRuntimeEnv> | null = null;
|
||||
const originalStateDir = process.env.OPENCLAW_STATE_DIR;
|
||||
const lifecycleConfig = createFeishuLifecycleConfig({
|
||||
accountId: "acct-menu",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { createRuntimeEnv } from "../../../test/helpers/plugins/runtime-env.js";
|
||||
import type { RuntimeEnv } from "../runtime-api.js";
|
||||
import "./lifecycle.test-support.js";
|
||||
import { resetProcessedFeishuCardActionTokensForTests } from "./card-action.js";
|
||||
import { createFeishuCardInteractionEnvelope } from "./card-interaction.js";
|
||||
@@ -33,7 +32,7 @@ const {
|
||||
} = getFeishuLifecycleTestMocks();
|
||||
|
||||
let _handlers: Record<string, (data: unknown) => Promise<void>> = {};
|
||||
let lastRuntime: RuntimeEnv | null = null;
|
||||
let lastRuntime: ReturnType<typeof createRuntimeEnv> | null = null;
|
||||
const originalStateDir = process.env.OPENCLAW_STATE_DIR;
|
||||
const lifecycleConfig = createFeishuLifecycleConfig({
|
||||
accountId: "acct-card",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { createRuntimeEnv } from "../../../test/helpers/plugins/runtime-env.js";
|
||||
import type { RuntimeEnv } from "../runtime-api.js";
|
||||
import "./lifecycle.test-support.js";
|
||||
import { getFeishuLifecycleTestMocks } from "./lifecycle.test-support.js";
|
||||
import {
|
||||
@@ -30,7 +29,7 @@ const {
|
||||
} = getFeishuLifecycleTestMocks();
|
||||
|
||||
let _handlers: Record<string, (data: unknown) => Promise<void>> = {};
|
||||
let lastRuntime: RuntimeEnv | null = null;
|
||||
let lastRuntime: ReturnType<typeof createRuntimeEnv> | null = null;
|
||||
const originalStateDir = process.env.OPENCLAW_STATE_DIR;
|
||||
const lifecycleConfig = createFeishuLifecycleConfig({
|
||||
accountId: "acct-lifecycle",
|
||||
|
||||
@@ -20,7 +20,7 @@ type FeishuDispatchReplyContext = Record<string, unknown> & {
|
||||
SessionKey?: string;
|
||||
};
|
||||
type FeishuDispatchReplyDispatcher = {
|
||||
sendFinalReply: (payload: { text: string }) => unknown | Promise<unknown>;
|
||||
sendFinalReply: (payload: { text: string }) => unknown;
|
||||
};
|
||||
type FeishuDispatchReplyMock = Mock<
|
||||
(args: {
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import type { AnyAgentTool, OpenClawPluginApi } from "../runtime-api.js";
|
||||
import type { OpenClawPluginApi } from "../runtime-api.js";
|
||||
|
||||
type ToolContextLike = {
|
||||
agentAccountId?: string;
|
||||
};
|
||||
|
||||
type ToolFactoryLike = (ctx: ToolContextLike) => AnyAgentTool | AnyAgentTool[] | null | undefined;
|
||||
|
||||
export type ToolLike = {
|
||||
name: string;
|
||||
execute: (
|
||||
@@ -15,18 +13,18 @@ export type ToolLike = {
|
||||
};
|
||||
|
||||
type RegisteredTool = {
|
||||
tool: AnyAgentTool | ToolFactoryLike;
|
||||
tool: unknown;
|
||||
opts?: { name?: string };
|
||||
};
|
||||
|
||||
function toToolList(value: AnyAgentTool | AnyAgentTool[] | null | undefined): AnyAgentTool[] {
|
||||
function toToolList(value: unknown): unknown[] {
|
||||
if (!value) {
|
||||
return [];
|
||||
}
|
||||
return Array.isArray(value) ? value : [value];
|
||||
}
|
||||
|
||||
function asToolLike(tool: AnyAgentTool, fallbackName?: string): ToolLike {
|
||||
function asToolLike(tool: unknown, fallbackName?: string): ToolLike {
|
||||
const candidate = tool as Partial<ToolLike>;
|
||||
const name = candidate.name ?? fallbackName;
|
||||
const execute = candidate.execute;
|
||||
|
||||
Reference in New Issue
Block a user