mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 01:31:08 +00:00
chore: enable no-floating-promises
This commit is contained in:
@@ -61,7 +61,6 @@
|
||||
"rules": {
|
||||
"typescript/no-base-to-string": "off",
|
||||
"typescript/no-explicit-any": "off",
|
||||
"typescript/no-floating-promises": "off",
|
||||
"typescript/no-redundant-type-constituents": "off",
|
||||
"typescript/unbound-method": "off",
|
||||
"eslint/no-unsafe-optional-chaining": "off"
|
||||
|
||||
@@ -111,7 +111,7 @@ describe("active-memory plugin", () => {
|
||||
runEmbeddedPiAgent.mockResolvedValue({
|
||||
payloads: [{ text: "- lemon pepper wings\n- blue cheese" }],
|
||||
});
|
||||
plugin.register(api as unknown as OpenClawPluginApi);
|
||||
await plugin.register(api as unknown as OpenClawPluginApi);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -406,7 +406,7 @@ describe("active-memory plugin", () => {
|
||||
agents: ["main"],
|
||||
allowedChatTypes: ["direct", "group"],
|
||||
};
|
||||
plugin.register(api as unknown as OpenClawPluginApi);
|
||||
await plugin.register(api as unknown as OpenClawPluginApi);
|
||||
|
||||
const result = await hooks.before_prompt_build(
|
||||
{ prompt: "what wings should we order?", messages: [] },
|
||||
@@ -509,7 +509,7 @@ describe("active-memory plugin", () => {
|
||||
agents: ["main"],
|
||||
queryMode: "message",
|
||||
};
|
||||
plugin.register(api as unknown as OpenClawPluginApi);
|
||||
await plugin.register(api as unknown as OpenClawPluginApi);
|
||||
|
||||
await hooks.before_prompt_build(
|
||||
{
|
||||
@@ -537,7 +537,7 @@ describe("active-memory plugin", () => {
|
||||
queryMode: "message",
|
||||
promptStyle: "preference-only",
|
||||
};
|
||||
plugin.register(api as unknown as OpenClawPluginApi);
|
||||
await plugin.register(api as unknown as OpenClawPluginApi);
|
||||
|
||||
await hooks.before_prompt_build(
|
||||
{
|
||||
@@ -582,7 +582,7 @@ describe("active-memory plugin", () => {
|
||||
agents: ["main"],
|
||||
thinking: "medium",
|
||||
};
|
||||
plugin.register(api as unknown as OpenClawPluginApi);
|
||||
await plugin.register(api as unknown as OpenClawPluginApi);
|
||||
|
||||
await hooks.before_prompt_build(
|
||||
{
|
||||
@@ -608,7 +608,7 @@ describe("active-memory plugin", () => {
|
||||
agents: ["main"],
|
||||
promptAppend: "Prefer stable long-term preferences over one-off events.",
|
||||
};
|
||||
plugin.register(api as unknown as OpenClawPluginApi);
|
||||
await plugin.register(api as unknown as OpenClawPluginApi);
|
||||
|
||||
await hooks.before_prompt_build(
|
||||
{
|
||||
@@ -637,7 +637,7 @@ describe("active-memory plugin", () => {
|
||||
promptOverride: "Custom memory prompt. Return NONE or one user fact.",
|
||||
promptAppend: "Extra custom instruction.",
|
||||
};
|
||||
plugin.register(api as unknown as OpenClawPluginApi);
|
||||
await plugin.register(api as unknown as OpenClawPluginApi);
|
||||
|
||||
await hooks.before_prompt_build(
|
||||
{
|
||||
@@ -710,7 +710,7 @@ describe("active-memory plugin", () => {
|
||||
api.pluginConfig = {
|
||||
agents: ["main"],
|
||||
};
|
||||
plugin.register(api as unknown as OpenClawPluginApi);
|
||||
await plugin.register(api as unknown as OpenClawPluginApi);
|
||||
|
||||
await hooks.before_prompt_build(
|
||||
{ prompt: "what wings should i order? temp transcript", messages: [] },
|
||||
@@ -735,7 +735,7 @@ describe("active-memory plugin", () => {
|
||||
agents: ["main"],
|
||||
modelFallbackPolicy: "resolved-only",
|
||||
};
|
||||
plugin.register(api as unknown as OpenClawPluginApi);
|
||||
await plugin.register(api as unknown as OpenClawPluginApi);
|
||||
|
||||
const result = await hooks.before_prompt_build(
|
||||
{ prompt: "what wings should i order? no fallback", messages: [] },
|
||||
@@ -872,7 +872,7 @@ describe("active-memory plugin", () => {
|
||||
timeoutMs: 250,
|
||||
logging: true,
|
||||
};
|
||||
plugin.register(api as unknown as OpenClawPluginApi);
|
||||
await plugin.register(api as unknown as OpenClawPluginApi);
|
||||
let lastAbortSignal: AbortSignal | undefined;
|
||||
runEmbeddedPiAgent.mockImplementation(async (params: { abortSignal?: AbortSignal }) => {
|
||||
lastAbortSignal = params.abortSignal;
|
||||
@@ -918,7 +918,7 @@ describe("active-memory plugin", () => {
|
||||
agents: ["main"],
|
||||
logging: true,
|
||||
};
|
||||
plugin.register(api as unknown as OpenClawPluginApi);
|
||||
await plugin.register(api as unknown as OpenClawPluginApi);
|
||||
|
||||
await hooks.before_prompt_build(
|
||||
{ prompt: "what wings should i order? session id cache", messages: [] },
|
||||
@@ -1037,7 +1037,7 @@ describe("active-memory plugin", () => {
|
||||
agents: ["main"],
|
||||
queryMode: "message",
|
||||
};
|
||||
plugin.register(api as unknown as OpenClawPluginApi);
|
||||
await plugin.register(api as unknown as OpenClawPluginApi);
|
||||
|
||||
await hooks.before_prompt_build(
|
||||
{
|
||||
@@ -1065,7 +1065,7 @@ describe("active-memory plugin", () => {
|
||||
agents: ["main"],
|
||||
queryMode: "full",
|
||||
};
|
||||
plugin.register(api as unknown as OpenClawPluginApi);
|
||||
await plugin.register(api as unknown as OpenClawPluginApi);
|
||||
|
||||
await hooks.before_prompt_build(
|
||||
{
|
||||
@@ -1096,7 +1096,7 @@ describe("active-memory plugin", () => {
|
||||
agents: ["main"],
|
||||
queryMode: "recent",
|
||||
};
|
||||
plugin.register(api as unknown as OpenClawPluginApi);
|
||||
await plugin.register(api as unknown as OpenClawPluginApi);
|
||||
|
||||
await hooks.before_prompt_build(
|
||||
{
|
||||
@@ -1174,7 +1174,7 @@ describe("active-memory plugin", () => {
|
||||
agents: ["main"],
|
||||
maxSummaryChars: 40,
|
||||
};
|
||||
plugin.register(api as unknown as OpenClawPluginApi);
|
||||
await plugin.register(api as unknown as OpenClawPluginApi);
|
||||
runEmbeddedPiAgent.mockResolvedValueOnce({
|
||||
payloads: [
|
||||
{
|
||||
@@ -1211,7 +1211,7 @@ describe("active-memory plugin", () => {
|
||||
agents: ["main"],
|
||||
maxSummaryChars: 90,
|
||||
};
|
||||
plugin.register(api as unknown as OpenClawPluginApi);
|
||||
await plugin.register(api as unknown as OpenClawPluginApi);
|
||||
|
||||
await hooks.before_prompt_build(
|
||||
{ prompt: "what wings should i order? prompt-count-check", messages: [] },
|
||||
@@ -1261,7 +1261,7 @@ describe("active-memory plugin", () => {
|
||||
transcriptDir: "active-memory-subagents",
|
||||
logging: true,
|
||||
};
|
||||
plugin.register(api as unknown as OpenClawPluginApi);
|
||||
await plugin.register(api as unknown as OpenClawPluginApi);
|
||||
const mkdirSpy = vi.spyOn(fs, "mkdir").mockResolvedValue(undefined);
|
||||
const mkdtempSpy = vi.spyOn(fs, "mkdtemp");
|
||||
const rmSpy = vi.spyOn(fs, "rm").mockResolvedValue(undefined);
|
||||
@@ -1305,7 +1305,7 @@ describe("active-memory plugin", () => {
|
||||
transcriptDir: "C:/temp/escape",
|
||||
logging: true,
|
||||
};
|
||||
plugin.register(api as unknown as OpenClawPluginApi);
|
||||
await plugin.register(api as unknown as OpenClawPluginApi);
|
||||
const mkdirSpy = vi.spyOn(fs, "mkdir").mockResolvedValue(undefined);
|
||||
|
||||
await hooks.before_prompt_build(
|
||||
@@ -1342,7 +1342,7 @@ describe("active-memory plugin", () => {
|
||||
transcriptDir: "active-memory-subagents",
|
||||
logging: true,
|
||||
};
|
||||
plugin.register(api as unknown as OpenClawPluginApi);
|
||||
await plugin.register(api as unknown as OpenClawPluginApi);
|
||||
const mkdirSpy = vi.spyOn(fs, "mkdir").mockResolvedValue(undefined);
|
||||
|
||||
await hooks.before_prompt_build(
|
||||
@@ -1409,7 +1409,7 @@ describe("active-memory plugin", () => {
|
||||
agents: ["main"],
|
||||
logging: true,
|
||||
};
|
||||
plugin.register(api as unknown as OpenClawPluginApi);
|
||||
await plugin.register(api as unknown as OpenClawPluginApi);
|
||||
|
||||
for (let index = 0; index <= 1000; index += 1) {
|
||||
await hooks.before_prompt_build(
|
||||
|
||||
@@ -18,7 +18,7 @@ function runWrapper(apiKey: string | undefined): Record<string, string> | undefi
|
||||
return {} as never;
|
||||
};
|
||||
const wrapper = createAnthropicBetaHeadersWrapper(base, [CONTEXT_1M_BETA]);
|
||||
wrapper(
|
||||
void wrapper(
|
||||
{ provider: "anthropic", id: "claude-opus-4-6" } as never,
|
||||
{} as never,
|
||||
{ apiKey } as never,
|
||||
@@ -64,7 +64,7 @@ describe("anthropic stream wrappers", () => {
|
||||
extraParams: { context1m: true, serviceTier: "auto" },
|
||||
} as never);
|
||||
|
||||
wrapped?.(
|
||||
void wrapped?.(
|
||||
{ provider: "anthropic", api: "anthropic-messages", id: "claude-sonnet-4-6" } as never,
|
||||
{} as never,
|
||||
{ apiKey: "sk-ant-oat01-oauth-token" } as never,
|
||||
@@ -91,7 +91,7 @@ describe("anthropic stream wrappers", () => {
|
||||
extraParams: { context1m: true, serviceTier: "auto" },
|
||||
} as never);
|
||||
|
||||
wrapped?.(
|
||||
void wrapped?.(
|
||||
{ provider: "anthropic", api: "anthropic-messages", id: "claude-sonnet-4-6" } as never,
|
||||
{} as never,
|
||||
{ apiKey: "sk-ant-api-123" } as never,
|
||||
@@ -121,7 +121,7 @@ describe("createAnthropicFastModeWrapper", () => {
|
||||
};
|
||||
|
||||
const wrapper = createAnthropicFastModeWrapper(base, params.enabled ?? true);
|
||||
wrapper(
|
||||
void wrapper(
|
||||
{
|
||||
provider: params.provider ?? "anthropic",
|
||||
api: params.api ?? "anthropic-messages",
|
||||
@@ -177,7 +177,7 @@ describe("createAnthropicServiceTierWrapper", () => {
|
||||
};
|
||||
|
||||
const wrapper = createAnthropicServiceTierWrapper(base, params.serviceTier ?? "auto");
|
||||
wrapper(
|
||||
void wrapper(
|
||||
{
|
||||
provider: params.provider ?? "anthropic",
|
||||
api: params.api ?? "anthropic-messages",
|
||||
|
||||
@@ -92,7 +92,7 @@ function registerPairCommand(params?: {
|
||||
pluginConfig?: Record<string, unknown>;
|
||||
}): OpenClawPluginCommandDefinition {
|
||||
let command: OpenClawPluginCommandDefinition | undefined;
|
||||
registerDevicePair.register(
|
||||
void registerDevicePair.register(
|
||||
createApi({
|
||||
...params,
|
||||
registerCommand: (nextCommand) => {
|
||||
|
||||
@@ -169,7 +169,7 @@ describe("Feishu bot menu handler", () => {
|
||||
createBotMenuEvent({ eventKey: "quick-actions", timestamp: "1700000000001" }),
|
||||
);
|
||||
let settled = false;
|
||||
pending.finally(() => {
|
||||
void pending.finally(() => {
|
||||
settled = true;
|
||||
});
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ describe("wrapCopilotAnthropicStream", () => {
|
||||
hasImages: true,
|
||||
});
|
||||
|
||||
wrapped(
|
||||
void wrapped(
|
||||
{
|
||||
provider: "github-copilot",
|
||||
api: "anthropic-messages",
|
||||
@@ -76,7 +76,7 @@ describe("wrapCopilotAnthropicStream", () => {
|
||||
const wrapped = wrapCopilotAnthropicStream(baseStreamFn);
|
||||
const options = { headers: { Existing: "1" } };
|
||||
|
||||
wrapped(
|
||||
void wrapped(
|
||||
{
|
||||
provider: "github-copilot",
|
||||
api: "openai-responses",
|
||||
@@ -96,7 +96,7 @@ describe("wrapCopilotAnthropicStream", () => {
|
||||
streamFn: baseStreamFn,
|
||||
} as never);
|
||||
|
||||
wrapped(
|
||||
void wrapped(
|
||||
{
|
||||
provider: "github-copilot",
|
||||
api: "openai-responses",
|
||||
|
||||
@@ -73,7 +73,7 @@ describe("openrouter provider hooks", () => {
|
||||
thinkingLevel: "high",
|
||||
} as never);
|
||||
|
||||
wrapped?.(
|
||||
void wrapped?.(
|
||||
{
|
||||
provider: "openrouter",
|
||||
api: "openai-completions",
|
||||
|
||||
@@ -80,7 +80,7 @@ async function withRegisteredPhoneControl(
|
||||
});
|
||||
|
||||
let command: OpenClawPluginCommandDefinition | undefined;
|
||||
registerPhoneControl.register(
|
||||
void registerPhoneControl.register(
|
||||
createApi({
|
||||
stateDir,
|
||||
getConfig: () => config,
|
||||
|
||||
@@ -20,7 +20,7 @@ function createHarness(config: Record<string, unknown>) {
|
||||
command = definition;
|
||||
}),
|
||||
};
|
||||
register.register(api as never);
|
||||
void register.register(api as never);
|
||||
if (!command) {
|
||||
throw new Error("talk-voice command not registered");
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@ describe("thread-ownership plugin", () => {
|
||||
});
|
||||
|
||||
describe("message_sending", () => {
|
||||
beforeEach(() => {
|
||||
register.register(api as unknown as OpenClawPluginApi);
|
||||
beforeEach(async () => {
|
||||
await register.register(api as unknown as OpenClawPluginApi);
|
||||
});
|
||||
|
||||
async function sendSlackThreadMessage() {
|
||||
@@ -112,8 +112,8 @@ describe("thread-ownership plugin", () => {
|
||||
});
|
||||
|
||||
describe("message_received @-mention tracking", () => {
|
||||
beforeEach(() => {
|
||||
register.register(api as unknown as OpenClawPluginApi);
|
||||
beforeEach(async () => {
|
||||
await register.register(api as unknown as OpenClawPluginApi);
|
||||
});
|
||||
|
||||
it("tracks @-mentions and skips ownership check for mentioned threads", async () => {
|
||||
|
||||
@@ -342,8 +342,8 @@ describe("runAgentTurnWithFallback", () => {
|
||||
delivered.push(payload.text ?? "");
|
||||
});
|
||||
state.runEmbeddedPiAgentMock.mockImplementationOnce(async (params: EmbeddedAgentParams) => {
|
||||
params.onToolResult?.({ text: "first", mediaUrls: [] });
|
||||
params.onToolResult?.({ text: "second", mediaUrls: [] });
|
||||
void params.onToolResult?.({ text: "first", mediaUrls: [] });
|
||||
void params.onToolResult?.({ text: "second", mediaUrls: [] });
|
||||
return { payloads: [{ text: "final" }], meta: {} };
|
||||
});
|
||||
|
||||
@@ -388,8 +388,8 @@ describe("runAgentTurnWithFallback", () => {
|
||||
deliveryOrder.push(payload.text ?? "");
|
||||
});
|
||||
state.runEmbeddedPiAgentMock.mockImplementationOnce(async (params: EmbeddedAgentParams) => {
|
||||
params.onToolResult?.({ text: "first", mediaUrls: [] });
|
||||
params.onToolResult?.({ text: "second", mediaUrls: [] });
|
||||
void params.onToolResult?.({ text: "first", mediaUrls: [] });
|
||||
void params.onToolResult?.({ text: "second", mediaUrls: [] });
|
||||
return { payloads: [{ text: "final" }], meta: {} };
|
||||
});
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ function callHandler(params: Record<string, unknown> = {}) {
|
||||
const respond = (ok: boolean, payload?: unknown, error?: unknown) => {
|
||||
result = { ok, payload, error };
|
||||
};
|
||||
commandsHandlers["commands.list"]({
|
||||
void commandsHandlers["commands.list"]({
|
||||
params,
|
||||
respond,
|
||||
req: {} as never,
|
||||
|
||||
Reference in New Issue
Block a user