style: lint cleanup
This commit is contained in:
@@ -73,9 +73,11 @@ describe("agents_list", () => {
|
|||||||
if (!tool) throw new Error("missing agents_list tool");
|
if (!tool) throw new Error("missing agents_list tool");
|
||||||
|
|
||||||
const result = await tool.execute("call2", {});
|
const result = await tool.execute("call2", {});
|
||||||
const agents = (result.details as {
|
const agents = (
|
||||||
agents?: Array<{ id: string }>;
|
result.details as {
|
||||||
}).agents;
|
agents?: Array<{ id: string }>;
|
||||||
|
}
|
||||||
|
).agents;
|
||||||
expect(agents?.map((agent) => agent.id)).toEqual(["main", "research"]);
|
expect(agents?.map((agent) => agent.id)).toEqual(["main", "research"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -111,9 +113,11 @@ describe("agents_list", () => {
|
|||||||
expect(result.details).toMatchObject({
|
expect(result.details).toMatchObject({
|
||||||
allowAny: true,
|
allowAny: true,
|
||||||
});
|
});
|
||||||
const agents = (result.details as {
|
const agents = (
|
||||||
agents?: Array<{ id: string }>;
|
result.details as {
|
||||||
}).agents;
|
agents?: Array<{ id: string }>;
|
||||||
|
}
|
||||||
|
).agents;
|
||||||
expect(agents?.map((agent) => agent.id)).toEqual([
|
expect(agents?.map((agent) => agent.id)).toEqual([
|
||||||
"main",
|
"main",
|
||||||
"coder",
|
"coder",
|
||||||
@@ -144,9 +148,11 @@ describe("agents_list", () => {
|
|||||||
if (!tool) throw new Error("missing agents_list tool");
|
if (!tool) throw new Error("missing agents_list tool");
|
||||||
|
|
||||||
const result = await tool.execute("call4", {});
|
const result = await tool.execute("call4", {});
|
||||||
const agents = (result.details as {
|
const agents = (
|
||||||
agents?: Array<{ id: string; configured: boolean }>;
|
result.details as {
|
||||||
}).agents;
|
agents?: Array<{ id: string; configured: boolean }>;
|
||||||
|
}
|
||||||
|
).agents;
|
||||||
expect(agents?.map((agent) => agent.id)).toEqual(["main", "research"]);
|
expect(agents?.map((agent) => agent.id)).toEqual(["main", "research"]);
|
||||||
const research = agents?.find((agent) => agent.id === "research");
|
const research = agents?.find((agent) => agent.id === "research");
|
||||||
expect(research?.configured).toBe(false);
|
expect(research?.configured).toBe(false);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { ClawdbotConfig } from "../config/config.js";
|
import type { ClawdbotConfig } from "../config/config.js";
|
||||||
|
import { createAgentsListTool } from "./tools/agents-list-tool.js";
|
||||||
import { createBrowserTool } from "./tools/browser-tool.js";
|
import { createBrowserTool } from "./tools/browser-tool.js";
|
||||||
import { createCanvasTool } from "./tools/canvas-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 type { AnyAgentTool } from "./tools/common.js";
|
||||||
import { createCronTool } from "./tools/cron-tool.js";
|
import { createCronTool } from "./tools/cron-tool.js";
|
||||||
import { createDiscordTool } from "./tools/discord-tool.js";
|
import { createDiscordTool } from "./tools/discord-tool.js";
|
||||||
|
|||||||
@@ -28,14 +28,14 @@ export async function runAgentStep(params: {
|
|||||||
const stepIdem = crypto.randomUUID();
|
const stepIdem = crypto.randomUUID();
|
||||||
const response = (await callGateway({
|
const response = (await callGateway({
|
||||||
method: "agent",
|
method: "agent",
|
||||||
params: {
|
params: {
|
||||||
message: params.message,
|
message: params.message,
|
||||||
sessionKey: params.sessionKey,
|
sessionKey: params.sessionKey,
|
||||||
idempotencyKey: stepIdem,
|
idempotencyKey: stepIdem,
|
||||||
deliver: false,
|
deliver: false,
|
||||||
lane: params.lane ?? "nested",
|
lane: params.lane ?? "nested",
|
||||||
extraSystemPrompt: params.extraSystemPrompt,
|
extraSystemPrompt: params.extraSystemPrompt,
|
||||||
},
|
},
|
||||||
timeoutMs: 10_000,
|
timeoutMs: 10_000,
|
||||||
})) as { runId?: string; acceptedAt?: number };
|
})) as { runId?: string; acceptedAt?: number };
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
import crypto from "node:crypto";
|
import crypto from "node:crypto";
|
||||||
|
import {
|
||||||
|
resolveAgentDir,
|
||||||
|
resolveAgentWorkspaceDir,
|
||||||
|
} from "../agents/agent-scope.js";
|
||||||
import { ensureAuthProfileStore } from "../agents/auth-profiles.js";
|
import { ensureAuthProfileStore } from "../agents/auth-profiles.js";
|
||||||
import { lookupContextTokens } from "../agents/context.js";
|
import { lookupContextTokens } from "../agents/context.js";
|
||||||
import {
|
import {
|
||||||
@@ -18,13 +22,7 @@ import { runEmbeddedPiAgent } from "../agents/pi-embedded.js";
|
|||||||
import { buildWorkspaceSkillSnapshot } from "../agents/skills.js";
|
import { buildWorkspaceSkillSnapshot } from "../agents/skills.js";
|
||||||
import { resolveAgentTimeoutMs } from "../agents/timeout.js";
|
import { resolveAgentTimeoutMs } from "../agents/timeout.js";
|
||||||
import { hasNonzeroUsage } from "../agents/usage.js";
|
import { hasNonzeroUsage } from "../agents/usage.js";
|
||||||
import {
|
import { ensureAgentWorkspace } from "../agents/workspace.js";
|
||||||
resolveAgentDir,
|
|
||||||
resolveAgentWorkspaceDir,
|
|
||||||
} from "../agents/agent-scope.js";
|
|
||||||
import {
|
|
||||||
ensureAgentWorkspace,
|
|
||||||
} from "../agents/workspace.js";
|
|
||||||
import type { MsgContext } from "../auto-reply/templating.js";
|
import type { MsgContext } from "../auto-reply/templating.js";
|
||||||
import {
|
import {
|
||||||
normalizeThinkLevel,
|
normalizeThinkLevel,
|
||||||
@@ -183,9 +181,7 @@ export async function agentCommand(
|
|||||||
|
|
||||||
const cfg = loadConfig();
|
const cfg = loadConfig();
|
||||||
const agentCfg = cfg.agent;
|
const agentCfg = cfg.agent;
|
||||||
const sessionAgentId = resolveAgentIdFromSessionKey(
|
const sessionAgentId = resolveAgentIdFromSessionKey(opts.sessionKey?.trim());
|
||||||
opts.sessionKey?.trim(),
|
|
||||||
);
|
|
||||||
const workspaceDirRaw = resolveAgentWorkspaceDir(cfg, sessionAgentId);
|
const workspaceDirRaw = resolveAgentWorkspaceDir(cfg, sessionAgentId);
|
||||||
const agentDir = resolveAgentDir(cfg, sessionAgentId);
|
const agentDir = resolveAgentDir(cfg, sessionAgentId);
|
||||||
const workspace = await ensureAgentWorkspace({
|
const workspace = await ensureAgentWorkspace({
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export function mergeConfigSection<T extends Record<string, unknown>>(
|
|||||||
patch: Partial<T>,
|
patch: Partial<T>,
|
||||||
options: MergeSectionOptions<T> = {},
|
options: MergeSectionOptions<T> = {},
|
||||||
): 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]][]) {
|
for (const [key, value] of Object.entries(patch) as [keyof T, T[keyof T]][]) {
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
if (options.unsetOnUndefined?.includes(key)) {
|
if (options.unsetOnUndefined?.includes(key)) {
|
||||||
|
|||||||
@@ -115,7 +115,8 @@ export async function sendMessageTelegram(
|
|||||||
const fetchImpl = resolveTelegramFetch();
|
const fetchImpl = resolveTelegramFetch();
|
||||||
const api =
|
const api =
|
||||||
opts.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();
|
const mediaUrl = opts.mediaUrl?.trim();
|
||||||
|
|
||||||
// Build optional params for forum topics and reply threading.
|
// Build optional params for forum topics and reply threading.
|
||||||
@@ -272,7 +273,8 @@ export async function reactMessageTelegram(
|
|||||||
const fetchImpl = resolveTelegramFetch();
|
const fetchImpl = resolveTelegramFetch();
|
||||||
const api =
|
const api =
|
||||||
opts.api ??
|
opts.api ??
|
||||||
new Bot(token, fetchImpl ? { client: { fetch: fetchImpl } } : undefined).api;
|
new Bot(token, fetchImpl ? { client: { fetch: fetchImpl } } : undefined)
|
||||||
|
.api;
|
||||||
const request = createTelegramRetryRunner({
|
const request = createTelegramRetryRunner({
|
||||||
retry: opts.retry,
|
retry: opts.retry,
|
||||||
configRetry: account.config.retry,
|
configRetry: account.config.retry,
|
||||||
|
|||||||
Reference in New Issue
Block a user