From d000dcad941e355765ba44b96d0cff8b311ef75e Mon Sep 17 00:00:00 2001 From: lubolin0925 <163701194+lubolin0925@users.noreply.github.com> Date: Sat, 7 Mar 2026 11:21:36 +0800 Subject: [PATCH] fix: formatting issues in learn command files --- src/auto-reply/reply/commands-compact.ts | 6 ++++-- src/auto-reply/reply/commands-core.ts | 14 +++++++------- src/auto-reply/reply/commands-learn.ts | 9 ++++----- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/auto-reply/reply/commands-compact.ts b/src/auto-reply/reply/commands-compact.ts index 6866a994afa..648e6b889e7 100644 --- a/src/auto-reply/reply/commands-compact.ts +++ b/src/auto-reply/reply/commands-compact.ts @@ -13,10 +13,10 @@ import { import { logVerbose } from "../../globals.js"; import { enqueueSystemEvent } from "../../infra/system-events.js"; import { formatContextUsageShort, formatTokenCount } from "../status.js"; +import { runLearnForSession } from "./commands-learn.js"; import type { CommandHandler } from "./commands-types.js"; import { stripMentions, stripStructuralPrefixes } from "./mentions.js"; import { incrementCompactionCount } from "./session-updates.js"; -import { runLearnForSession } from "./commands-learn.js"; function extractCompactInstructions(params: { rawBody?: string; @@ -102,7 +102,9 @@ export const handleCompactCommand: CommandHandler = async (params) => { if (learnResult.ok) { logVerbose(`Pre-compaction learning completed for session ${params.sessionKey}`); } else { - logVerbose(`Pre-compaction learning failed for session ${params.sessionKey}: ${learnResult.message ?? "unknown error"}`); + logVerbose( + `Pre-compaction learning failed for session ${params.sessionKey}: ${learnResult.message ?? "unknown error"}`, + ); } const customInstructions = extractCompactInstructions({ diff --git a/src/auto-reply/reply/commands-core.ts b/src/auto-reply/reply/commands-core.ts index a16e7be2be6..fb2ea132e48 100644 --- a/src/auto-reply/reply/commands-core.ts +++ b/src/auto-reply/reply/commands-core.ts @@ -1,5 +1,6 @@ import fs from "node:fs/promises"; import { resetAcpSessionInPlace } from "../../acp/persistent-bindings.js"; +import { resolveSessionFilePath, resolveSessionFilePathOptions } from "../../config/sessions.js"; import { logVerbose } from "../../globals.js"; import { createInternalHookEvent, triggerInternalHook } from "../../hooks/internal-hooks.js"; import { getGlobalHookRunner } from "../../plugins/hook-runner-global.js"; @@ -13,7 +14,6 @@ import { handleApproveCommand } from "./commands-approve.js"; import { handleBashCommand } from "./commands-bash.js"; import { handleCompactCommand } from "./commands-compact.js"; import { handleConfigCommand, handleDebugCommand } from "./commands-config.js"; -import { handleLearnCommand, runLearnForSession } from "./commands-learn.js"; import { handleCommandsListCommand, handleContextCommand, @@ -22,6 +22,7 @@ import { handleStatusCommand, handleWhoamiCommand, } from "./commands-info.js"; +import { handleLearnCommand, runLearnForSession } from "./commands-learn.js"; import { handleModelsCommand } from "./commands-models.js"; import { handlePluginCommand } from "./commands-plugin.js"; import { @@ -41,10 +42,6 @@ import type { HandleCommandsParams, } from "./commands-types.js"; import { routeReply } from "./route-reply.js"; -import { - resolveSessionFilePath, - resolveSessionFilePathOptions, -} from "../../config/sessions.js"; let HANDLERS: CommandHandler[] | null = null; @@ -256,14 +253,17 @@ export async function handleCommands(params: HandleCommandsParams): Promise 0 ? params.command.ownerList : undefined, }); if (learnResult.ok) { logVerbose(`Pre-reset learning completed for session ${targetSessionKey}`); } else { - logVerbose(`Pre-reset learning failed for session ${targetSessionKey}: ${learnResult.message ?? "unknown error"}`); + logVerbose( + `Pre-reset learning failed for session ${targetSessionKey}: ${learnResult.message ?? "unknown error"}`, + ); } } if (boundAcpKey) { diff --git a/src/auto-reply/reply/commands-learn.ts b/src/auto-reply/reply/commands-learn.ts index 6ae3e9b0cd8..3d87c333ff5 100644 --- a/src/auto-reply/reply/commands-learn.ts +++ b/src/auto-reply/reply/commands-learn.ts @@ -1,9 +1,6 @@ import { runEmbeddedPiAgent } from "../../agents/pi-embedded.js"; import type { OpenClawConfig } from "../../config/config.js"; -import { - resolveSessionFilePath, - resolveSessionFilePathOptions, -} from "../../config/sessions.js"; +import { resolveSessionFilePath, resolveSessionFilePathOptions } from "../../config/sessions.js"; import { logVerbose } from "../../globals.js"; const LEARN_SYSTEM_PROMPT = [ @@ -125,7 +122,9 @@ export const handleLearnCommand = async ( } const sessionId = params.sessionEntry.sessionId; - const customFocus = extractLearnFocus(params.ctx.CommandBody ?? params.ctx.RawBody ?? params.ctx.Body); + const customFocus = extractLearnFocus( + params.ctx.CommandBody ?? params.ctx.RawBody ?? params.ctx.Body, + ); const result = await runLearnForSession({ sessionId,