style: lint cleanup

This commit is contained in:
Peter Steinberger
2026-01-08 08:40:02 +01:00
parent 9a11325cc9
commit 1b2957d050
6 changed files with 35 additions and 31 deletions

View File

@@ -73,9 +73,11 @@ describe("agents_list", () => {
if (!tool) throw new Error("missing agents_list tool");
const result = await tool.execute("call2", {});
const agents = (result.details as {
agents?: Array<{ id: string }>;
}).agents;
const agents = (
result.details as {
agents?: Array<{ id: string }>;
}
).agents;
expect(agents?.map((agent) => agent.id)).toEqual(["main", "research"]);
});
@@ -111,9 +113,11 @@ describe("agents_list", () => {
expect(result.details).toMatchObject({
allowAny: true,
});
const agents = (result.details as {
agents?: Array<{ id: string }>;
}).agents;
const agents = (
result.details as {
agents?: Array<{ id: string }>;
}
).agents;
expect(agents?.map((agent) => agent.id)).toEqual([
"main",
"coder",
@@ -144,9 +148,11 @@ describe("agents_list", () => {
if (!tool) throw new Error("missing agents_list tool");
const result = await tool.execute("call4", {});
const agents = (result.details as {
agents?: Array<{ id: string; configured: boolean }>;
}).agents;
const agents = (
result.details as {
agents?: Array<{ id: string; configured: boolean }>;
}
).agents;
expect(agents?.map((agent) => agent.id)).toEqual(["main", "research"]);
const research = agents?.find((agent) => agent.id === "research");
expect(research?.configured).toBe(false);

View File

@@ -1,7 +1,7 @@
import type { ClawdbotConfig } from "../config/config.js";
import { createAgentsListTool } from "./tools/agents-list-tool.js";
import { createBrowserTool } from "./tools/browser-tool.js";
import { createCanvasTool } from "./tools/canvas-tool.js";
import { createAgentsListTool } from "./tools/agents-list-tool.js";
import type { AnyAgentTool } from "./tools/common.js";
import { createCronTool } from "./tools/cron-tool.js";
import { createDiscordTool } from "./tools/discord-tool.js";

View File

@@ -28,14 +28,14 @@ export async function runAgentStep(params: {
const stepIdem = crypto.randomUUID();
const response = (await callGateway({
method: "agent",
params: {
message: params.message,
sessionKey: params.sessionKey,
idempotencyKey: stepIdem,
deliver: false,
lane: params.lane ?? "nested",
extraSystemPrompt: params.extraSystemPrompt,
},
params: {
message: params.message,
sessionKey: params.sessionKey,
idempotencyKey: stepIdem,
deliver: false,
lane: params.lane ?? "nested",
extraSystemPrompt: params.extraSystemPrompt,
},
timeoutMs: 10_000,
})) as { runId?: string; acceptedAt?: number };

View File

@@ -1,4 +1,8 @@
import crypto from "node:crypto";
import {
resolveAgentDir,
resolveAgentWorkspaceDir,
} from "../agents/agent-scope.js";
import { ensureAuthProfileStore } from "../agents/auth-profiles.js";
import { lookupContextTokens } from "../agents/context.js";
import {
@@ -18,13 +22,7 @@ import { runEmbeddedPiAgent } from "../agents/pi-embedded.js";
import { buildWorkspaceSkillSnapshot } from "../agents/skills.js";
import { resolveAgentTimeoutMs } from "../agents/timeout.js";
import { hasNonzeroUsage } from "../agents/usage.js";
import {
resolveAgentDir,
resolveAgentWorkspaceDir,
} from "../agents/agent-scope.js";
import {
ensureAgentWorkspace,
} from "../agents/workspace.js";
import { ensureAgentWorkspace } from "../agents/workspace.js";
import type { MsgContext } from "../auto-reply/templating.js";
import {
normalizeThinkLevel,
@@ -183,9 +181,7 @@ export async function agentCommand(
const cfg = loadConfig();
const agentCfg = cfg.agent;
const sessionAgentId = resolveAgentIdFromSessionKey(
opts.sessionKey?.trim(),
);
const sessionAgentId = resolveAgentIdFromSessionKey(opts.sessionKey?.trim());
const workspaceDirRaw = resolveAgentWorkspaceDir(cfg, sessionAgentId);
const agentDir = resolveAgentDir(cfg, sessionAgentId);
const workspace = await ensureAgentWorkspace({

View File

@@ -10,7 +10,7 @@ export function mergeConfigSection<T extends Record<string, unknown>>(
patch: Partial<T>,
options: MergeSectionOptions<T> = {},
): T {
const next: Record<string, unknown> = { ...(base ?? {}) };
const next: Record<string, unknown> = { ...(base ?? undefined) };
for (const [key, value] of Object.entries(patch) as [keyof T, T[keyof T]][]) {
if (value === undefined) {
if (options.unsetOnUndefined?.includes(key)) {

View File

@@ -115,7 +115,8 @@ export async function sendMessageTelegram(
const fetchImpl = resolveTelegramFetch();
const api =
opts.api ??
new Bot(token, fetchImpl ? { client: { fetch: fetchImpl } } : undefined).api;
new Bot(token, fetchImpl ? { client: { fetch: fetchImpl } } : undefined)
.api;
const mediaUrl = opts.mediaUrl?.trim();
// Build optional params for forum topics and reply threading.
@@ -272,7 +273,8 @@ export async function reactMessageTelegram(
const fetchImpl = resolveTelegramFetch();
const api =
opts.api ??
new Bot(token, fetchImpl ? { client: { fetch: fetchImpl } } : undefined).api;
new Bot(token, fetchImpl ? { client: { fetch: fetchImpl } } : undefined)
.api;
const request = createTelegramRetryRunner({
retry: opts.retry,
configRetry: account.config.retry,