mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 22:28:27 +00:00
chore: fix lint warnings
This commit is contained in:
committed by
Vignesh
parent
f72214725d
commit
30098b04d7
@@ -18,9 +18,13 @@ function buildSkillsSection(params: {
|
||||
isMinimal: boolean;
|
||||
readToolName: string;
|
||||
}) {
|
||||
if (params.isMinimal) return [];
|
||||
if (params.isMinimal) {
|
||||
return [];
|
||||
}
|
||||
const trimmed = params.skillsPrompt?.trim();
|
||||
if (!trimmed) return [];
|
||||
if (!trimmed) {
|
||||
return [];
|
||||
}
|
||||
return [
|
||||
"## Skills (mandatory)",
|
||||
"Before replying: scan <available_skills> <description> entries.",
|
||||
@@ -38,7 +42,9 @@ function buildMemorySection(params: {
|
||||
availableTools: Set<string>;
|
||||
citationsMode?: MemoryCitationsMode;
|
||||
}) {
|
||||
if (params.isMinimal) return [];
|
||||
if (params.isMinimal) {
|
||||
return [];
|
||||
}
|
||||
if (!params.availableTools.has("memory_search") && !params.availableTools.has("memory_get")) {
|
||||
return [];
|
||||
}
|
||||
@@ -60,17 +66,23 @@ function buildMemorySection(params: {
|
||||
}
|
||||
|
||||
function buildUserIdentitySection(ownerLine: string | undefined, isMinimal: boolean) {
|
||||
if (!ownerLine || isMinimal) return [];
|
||||
if (!ownerLine || isMinimal) {
|
||||
return [];
|
||||
}
|
||||
return ["## User Identity", ownerLine, ""];
|
||||
}
|
||||
|
||||
function buildTimeSection(params: { userTimezone?: string }) {
|
||||
if (!params.userTimezone) return [];
|
||||
if (!params.userTimezone) {
|
||||
return [];
|
||||
}
|
||||
return ["## Current Date & Time", `Time zone: ${params.userTimezone}`, ""];
|
||||
}
|
||||
|
||||
function buildReplyTagsSection(isMinimal: boolean) {
|
||||
if (isMinimal) return [];
|
||||
if (isMinimal) {
|
||||
return [];
|
||||
}
|
||||
return [
|
||||
"## Reply Tags",
|
||||
"To request a native reply/quote on supported surfaces, include one tag in your reply:",
|
||||
@@ -90,7 +102,9 @@ function buildMessagingSection(params: {
|
||||
runtimeChannel?: string;
|
||||
messageToolHints?: string[];
|
||||
}) {
|
||||
if (params.isMinimal) return [];
|
||||
if (params.isMinimal) {
|
||||
return [];
|
||||
}
|
||||
return [
|
||||
"## Messaging",
|
||||
"- Reply in current session → automatically routes to the source channel (Signal, Telegram, etc.)",
|
||||
@@ -119,15 +133,21 @@ function buildMessagingSection(params: {
|
||||
}
|
||||
|
||||
function buildVoiceSection(params: { isMinimal: boolean; ttsHint?: string }) {
|
||||
if (params.isMinimal) return [];
|
||||
if (params.isMinimal) {
|
||||
return [];
|
||||
}
|
||||
const hint = params.ttsHint?.trim();
|
||||
if (!hint) return [];
|
||||
if (!hint) {
|
||||
return [];
|
||||
}
|
||||
return ["## Voice (TTS)", hint, ""];
|
||||
}
|
||||
|
||||
function buildDocsSection(params: { docsPath?: string; isMinimal: boolean; readToolName: string }) {
|
||||
const docsPath = params.docsPath?.trim();
|
||||
if (!docsPath || params.isMinimal) return [];
|
||||
if (!docsPath || params.isMinimal) {
|
||||
return [];
|
||||
}
|
||||
return [
|
||||
"## Documentation",
|
||||
`OpenClaw docs: ${docsPath}`,
|
||||
@@ -268,7 +288,9 @@ export function buildAgentSystemPrompt(params: {
|
||||
const externalToolSummaries = new Map<string, string>();
|
||||
for (const [key, value] of Object.entries(params.toolSummaries ?? {})) {
|
||||
const normalized = key.trim().toLowerCase();
|
||||
if (!normalized || !value?.trim()) continue;
|
||||
if (!normalized || !value?.trim()) {
|
||||
continue;
|
||||
}
|
||||
externalToolSummaries.set(normalized, value.trim());
|
||||
}
|
||||
const extraTools = Array.from(
|
||||
@@ -280,7 +302,7 @@ export function buildAgentSystemPrompt(params: {
|
||||
const name = resolveToolName(tool);
|
||||
return summary ? `- ${name}: ${summary}` : `- ${name}`;
|
||||
});
|
||||
for (const tool of extraTools.sort()) {
|
||||
for (const tool of extraTools.toSorted()) {
|
||||
const summary = coreToolSummaries[tool] ?? externalToolSummaries.get(tool);
|
||||
const name = resolveToolName(tool);
|
||||
toolLines.push(summary ? `- ${name}: ${summary}` : `- ${name}`);
|
||||
|
||||
@@ -27,12 +27,16 @@ export function createMemorySearchTool(options: {
|
||||
agentSessionKey?: string;
|
||||
}): AnyAgentTool | null {
|
||||
const cfg = options.config;
|
||||
if (!cfg) return null;
|
||||
if (!cfg) {
|
||||
return null;
|
||||
}
|
||||
const agentId = resolveSessionAgentId({
|
||||
sessionKey: options.agentSessionKey,
|
||||
config: cfg,
|
||||
});
|
||||
if (!resolveMemorySearchConfig(cfg, agentId)) return null;
|
||||
if (!resolveMemorySearchConfig(cfg, agentId)) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
label: "Memory Search",
|
||||
name: "memory_search",
|
||||
@@ -88,12 +92,16 @@ export function createMemoryGetTool(options: {
|
||||
agentSessionKey?: string;
|
||||
}): AnyAgentTool | null {
|
||||
const cfg = options.config;
|
||||
if (!cfg) return null;
|
||||
if (!cfg) {
|
||||
return null;
|
||||
}
|
||||
const agentId = resolveSessionAgentId({
|
||||
sessionKey: options.agentSessionKey,
|
||||
config: cfg,
|
||||
});
|
||||
if (!resolveMemorySearchConfig(cfg, agentId)) return null;
|
||||
if (!resolveMemorySearchConfig(cfg, agentId)) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
label: "Memory Get",
|
||||
name: "memory_get",
|
||||
@@ -199,11 +207,16 @@ function deriveChatTypeFromSessionKey(sessionKey?: string): "direct" | "group" |
|
||||
if (!parsed?.rest) {
|
||||
return "direct";
|
||||
}
|
||||
const tokens = parsed.rest.toLowerCase().split(":").filter(Boolean);
|
||||
if (tokens.includes("channel")) {
|
||||
const tokens = new Set(
|
||||
parsed.rest
|
||||
.toLowerCase()
|
||||
.split(":")
|
||||
.filter(Boolean),
|
||||
);
|
||||
if (tokens.has("channel")) {
|
||||
return "channel";
|
||||
}
|
||||
if (tokens.includes("group")) {
|
||||
if (tokens.has("group")) {
|
||||
return "group";
|
||||
}
|
||||
return "direct";
|
||||
|
||||
Reference in New Issue
Block a user