diff --git a/src/hooks/workspace.ts b/src/hooks/workspace.ts index d22c0183ce3..7b86d9d23c8 100644 --- a/src/hooks/workspace.ts +++ b/src/hooks/workspace.ts @@ -115,13 +115,20 @@ function loadHookFromDir(params: { return null; } + let baseDir = params.hookDir; + try { + baseDir = fs.realpathSync.native(params.hookDir); + } catch { + // keep the discovered path when realpath is unavailable + } + return { name, description, source: params.source, pluginId: params.pluginId, filePath: hookMdPath, - baseDir: params.hookDir, + baseDir, handlerPath, }; } catch (err) { diff --git a/src/infra/tmp-openclaw-dir.ts b/src/infra/tmp-openclaw-dir.ts index 7fc43926c5c..cbbd6c4b58d 100644 --- a/src/infra/tmp-openclaw-dir.ts +++ b/src/infra/tmp-openclaw-dir.ts @@ -1,5 +1,5 @@ import fs from "node:fs"; -import os from "node:os"; +import { tmpdir as getOsTmpDir } from "node:os"; import path from "node:path"; export const POSIX_OPENCLAW_TMP_DIR = "/tmp/openclaw"; @@ -48,7 +48,7 @@ export function resolvePreferredOpenClawTmpDir( return undefined; } }); - const tmpdir = options.tmpdir ?? os.tmpdir; + const tmpdir = typeof options.tmpdir === "function" ? options.tmpdir : getOsTmpDir; const uid = getuid(); const isSecureDirForUser = (st: { mode?: number; uid?: number }): boolean => { diff --git a/src/logging/logger.ts b/src/logging/logger.ts index d73009fc696..934cdcc28c4 100644 --- a/src/logging/logger.ts +++ b/src/logging/logger.ts @@ -35,8 +35,14 @@ function resolveDefaultLogDir(): string { return canUseNodeFs() ? resolvePreferredOpenClawTmpDir() : POSIX_OPENCLAW_TMP_DIR; } +function resolveDefaultLogFile(defaultLogDir: string): string { + return canUseNodeFs() + ? path.join(defaultLogDir, "openclaw.log") + : `${POSIX_OPENCLAW_TMP_DIR}/openclaw.log`; +} + export const DEFAULT_LOG_DIR = resolveDefaultLogDir(); -export const DEFAULT_LOG_FILE = path.join(DEFAULT_LOG_DIR, "openclaw.log"); // legacy single-file path +export const DEFAULT_LOG_FILE = resolveDefaultLogFile(DEFAULT_LOG_DIR); // legacy single-file path const LOG_PREFIX = "openclaw"; const LOG_SUFFIX = ".log"; diff --git a/src/plugin-sdk/runtime-api-guardrails.test.ts b/src/plugin-sdk/runtime-api-guardrails.test.ts index a1d0cf5970a..fc96a09b39e 100644 --- a/src/plugin-sdk/runtime-api-guardrails.test.ts +++ b/src/plugin-sdk/runtime-api-guardrails.test.ts @@ -70,6 +70,7 @@ const RUNTIME_API_EXPORT_GUARDS: Record = { 'export * from "./src/auto-reply.js";', 'export * from "./src/inbound.js";', 'export * from "./src/login.js";', + 'export * from "./src/login-qr.js";', 'export * from "./src/media.js";', 'export * from "./src/send.js";', 'export * from "./src/session.js";',