mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 10:01:11 +00:00
fix(agents): harden compaction and reset safety
Co-authored-by: jaden-clovervnd <91520439+jaden-clovervnd@users.noreply.github.com> Co-authored-by: Sid <201593046+Sid-Qin@users.noreply.github.com> Co-authored-by: Marcus Widing <245375637+widingmarcus-cyber@users.noreply.github.com>
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import fsPromises from "node:fs/promises";
|
||||
import nodePath from "node:path";
|
||||
import { formatCliCommand } from "../cli/command-format.js";
|
||||
import type { OpenClawConfig } from "../config/config.js";
|
||||
import { readConfigFileSnapshot, resolveGatewayPort, writeConfigFile } from "../config/config.js";
|
||||
@@ -332,6 +334,32 @@ export async function runConfigureWizard(
|
||||
runtime,
|
||||
);
|
||||
workspaceDir = resolveUserPath(String(workspaceInput ?? "").trim() || DEFAULT_WORKSPACE);
|
||||
if (!snapshot.exists) {
|
||||
const indicators = ["MEMORY.md", "memory", ".git"].map((name) =>
|
||||
nodePath.join(workspaceDir, name),
|
||||
);
|
||||
const hasExistingContent = (
|
||||
await Promise.all(
|
||||
indicators.map(async (candidate) => {
|
||||
try {
|
||||
await fsPromises.access(candidate);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}),
|
||||
)
|
||||
).some(Boolean);
|
||||
if (hasExistingContent) {
|
||||
note(
|
||||
[
|
||||
`Existing workspace detected at ${workspaceDir}`,
|
||||
"Existing files are preserved. Missing templates may be created, never overwritten.",
|
||||
].join("\n"),
|
||||
"Existing workspace",
|
||||
);
|
||||
}
|
||||
}
|
||||
nextConfig = {
|
||||
...nextConfig,
|
||||
agents: {
|
||||
|
||||
Reference in New Issue
Block a user