mirror of
http://192.168.0.88:13333/lywsvip/openclaw-zero-token.git
synced 2026-06-09 07:52:24 +08:00
Major upgrade from e26988a38 to upstream v2026.3.28 (f9b107928).
Key changes:
- Upstream src/, ui/, extensions/ (89 bundled extensions)
- Zero-token web providers preserved in src/zero-token/
- AskOnce plugin restored and registered as CLI command
- Added missing packages: @anthropic-ai/vertex-sdk, @modelcontextprotocol/sdk
- Fixed tsconfig rootDir, skipLibCheck for plugin-sdk DTS build
- Added askonce to bundled plugin metadata and package.json exports
- Fixed AskOnce CLI command registration (missing commands metadata)
- Restored AskOnce adapter imports (correct 5-level relative paths)
- Removed stale migration artifacts from root directory
61 lines
1.9 KiB
TypeScript
61 lines
1.9 KiB
TypeScript
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import { DEFAULT_AGENTS_FILENAME } from "../agents/workspace.js";
|
|
import { shortenHomePath } from "../utils.js";
|
|
|
|
export const MEMORY_SYSTEM_PROMPT = [
|
|
"Memory system not found in workspace.",
|
|
"Paste this into your agent:",
|
|
"",
|
|
"Install the memory system by applying:",
|
|
"https://github.com/openclaw/openclaw/commit/9ffea23f31ca1df5183b25668f8f814bee0fb34e",
|
|
"https://github.com/openclaw/openclaw/commit/7d1fee70e76f2f634f1b41fca927ee663914183a",
|
|
].join("\n");
|
|
|
|
export async function shouldSuggestMemorySystem(workspaceDir: string): Promise<boolean> {
|
|
const memoryPaths = [path.join(workspaceDir, "MEMORY.md"), path.join(workspaceDir, "memory.md")];
|
|
|
|
for (const memoryPath of memoryPaths) {
|
|
try {
|
|
await fs.promises.access(memoryPath);
|
|
return false;
|
|
} catch {
|
|
// keep scanning
|
|
}
|
|
}
|
|
|
|
const agentsPath = path.join(workspaceDir, DEFAULT_AGENTS_FILENAME);
|
|
try {
|
|
const content = await fs.promises.readFile(agentsPath, "utf-8");
|
|
if (/memory\.md/i.test(content)) {
|
|
return false;
|
|
}
|
|
} catch {
|
|
// no AGENTS.md or unreadable; treat as missing memory guidance
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
export type LegacyWorkspaceDetection = {
|
|
activeWorkspace: string;
|
|
legacyDirs: string[];
|
|
};
|
|
|
|
export function detectLegacyWorkspaceDirs(params: {
|
|
workspaceDir: string;
|
|
}): LegacyWorkspaceDetection {
|
|
const activeWorkspace = path.resolve(params.workspaceDir);
|
|
const legacyDirs: string[] = [];
|
|
return { activeWorkspace, legacyDirs };
|
|
}
|
|
|
|
export function formatLegacyWorkspaceWarning(detection: LegacyWorkspaceDetection): string {
|
|
return [
|
|
"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.",
|
|
].join("\n");
|
|
}
|