mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 08:52:43 +00:00
refactor: rename to openclaw
This commit is contained in:
@@ -1,13 +1,7 @@
|
||||
import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
import {
|
||||
DEFAULT_AGENTS_FILENAME,
|
||||
DEFAULT_IDENTITY_FILENAME,
|
||||
DEFAULT_SOUL_FILENAME,
|
||||
DEFAULT_USER_FILENAME,
|
||||
} from "../agents/workspace.js";
|
||||
import { DEFAULT_AGENTS_FILENAME } from "../agents/workspace.js";
|
||||
import { shortenHomePath } from "../utils.js";
|
||||
|
||||
export const MEMORY_SYSTEM_PROMPT = [
|
||||
@@ -15,8 +9,8 @@ export const MEMORY_SYSTEM_PROMPT = [
|
||||
"Paste this into your agent:",
|
||||
"",
|
||||
"Install the memory system by applying:",
|
||||
"https://github.com/moltbot/moltbot/commit/9ffea23f31ca1df5183b25668f8f814bee0fb34e",
|
||||
"https://github.com/moltbot/moltbot/commit/7d1fee70e76f2f634f1b41fca927ee663914183a",
|
||||
"https://github.com/openclaw/openclaw/commit/9ffea23f31ca1df5183b25668f8f814bee0fb34e",
|
||||
"https://github.com/openclaw/openclaw/commit/7d1fee70e76f2f634f1b41fca927ee663914183a",
|
||||
].join("\n");
|
||||
|
||||
export async function shouldSuggestMemorySystem(workspaceDir: string): Promise<boolean> {
|
||||
@@ -47,34 +41,11 @@ export type LegacyWorkspaceDetection = {
|
||||
legacyDirs: string[];
|
||||
};
|
||||
|
||||
function looksLikeWorkspaceDir(dir: string, exists: (value: string) => boolean) {
|
||||
const markers = [
|
||||
DEFAULT_AGENTS_FILENAME,
|
||||
DEFAULT_SOUL_FILENAME,
|
||||
DEFAULT_USER_FILENAME,
|
||||
DEFAULT_IDENTITY_FILENAME,
|
||||
];
|
||||
return markers.some((name) => exists(path.join(dir, name)));
|
||||
}
|
||||
|
||||
export function detectLegacyWorkspaceDirs(params: {
|
||||
workspaceDir: string;
|
||||
homedir?: () => string;
|
||||
exists?: (value: string) => boolean;
|
||||
}): LegacyWorkspaceDetection {
|
||||
const homedir = params.homedir ?? os.homedir;
|
||||
const exists = params.exists ?? fs.existsSync;
|
||||
const home = homedir();
|
||||
const activeWorkspace = path.resolve(params.workspaceDir);
|
||||
const candidates = [path.join(home, "moltbot")];
|
||||
const legacyDirs = candidates
|
||||
.filter((candidate) => {
|
||||
if (!exists(candidate)) return false;
|
||||
return path.resolve(candidate) !== activeWorkspace;
|
||||
})
|
||||
.filter((candidate) => {
|
||||
return looksLikeWorkspaceDir(candidate, exists);
|
||||
});
|
||||
const legacyDirs: string[] = [];
|
||||
return { activeWorkspace, legacyDirs };
|
||||
}
|
||||
|
||||
@@ -83,6 +54,6 @@ export function formatLegacyWorkspaceWarning(detection: LegacyWorkspaceDetection
|
||||
"Extra workspace directories detected (may contain old agent files):",
|
||||
...detection.legacyDirs.map((dir) => `- ${shortenHomePath(dir)}`),
|
||||
`Active workspace: ${shortenHomePath(detection.activeWorkspace)}`,
|
||||
"If unused, archive or move to Trash (e.g. trash ~/moltbot).",
|
||||
"If unused, archive or move to Trash.",
|
||||
].join("\n");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user