mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 04:41:25 +00:00
fix: don't auto-create HEARTBEAT.md on workspace init (openclaw#12027) thanks @shadril238
Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test Co-authored-by: shadril238 <63901551+shadril238@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
0a724127dc
commit
386bb0c618
@@ -173,7 +173,6 @@ export async function ensureAgentWorkspace(params?: {
|
||||
toolsPath?: string;
|
||||
identityPath?: string;
|
||||
userPath?: string;
|
||||
heartbeatPath?: string;
|
||||
bootstrapPath?: string;
|
||||
}> {
|
||||
const rawDir = params?.dir?.trim() ? params.dir.trim() : DEFAULT_AGENT_WORKSPACE_DIR;
|
||||
@@ -189,11 +188,13 @@ export async function ensureAgentWorkspace(params?: {
|
||||
const toolsPath = path.join(dir, DEFAULT_TOOLS_FILENAME);
|
||||
const identityPath = path.join(dir, DEFAULT_IDENTITY_FILENAME);
|
||||
const userPath = path.join(dir, DEFAULT_USER_FILENAME);
|
||||
const heartbeatPath = path.join(dir, DEFAULT_HEARTBEAT_FILENAME);
|
||||
// HEARTBEAT.md is intentionally NOT created from template.
|
||||
// Per docs: "If the file is missing, the heartbeat still runs and the model decides what to do."
|
||||
// Creating it from template (which is effectively empty) would cause heartbeat to be skipped.
|
||||
const bootstrapPath = path.join(dir, DEFAULT_BOOTSTRAP_FILENAME);
|
||||
|
||||
const isBrandNewWorkspace = await (async () => {
|
||||
const paths = [agentsPath, soulPath, toolsPath, identityPath, userPath, heartbeatPath];
|
||||
const paths = [agentsPath, soulPath, toolsPath, identityPath, userPath];
|
||||
const existing = await Promise.all(
|
||||
paths.map(async (p) => {
|
||||
try {
|
||||
@@ -212,7 +213,6 @@ export async function ensureAgentWorkspace(params?: {
|
||||
const toolsTemplate = await loadTemplate(DEFAULT_TOOLS_FILENAME);
|
||||
const identityTemplate = await loadTemplate(DEFAULT_IDENTITY_FILENAME);
|
||||
const userTemplate = await loadTemplate(DEFAULT_USER_FILENAME);
|
||||
const heartbeatTemplate = await loadTemplate(DEFAULT_HEARTBEAT_FILENAME);
|
||||
const bootstrapTemplate = await loadTemplate(DEFAULT_BOOTSTRAP_FILENAME);
|
||||
|
||||
await writeFileIfMissing(agentsPath, agentsTemplate);
|
||||
@@ -220,7 +220,6 @@ export async function ensureAgentWorkspace(params?: {
|
||||
await writeFileIfMissing(toolsPath, toolsTemplate);
|
||||
await writeFileIfMissing(identityPath, identityTemplate);
|
||||
await writeFileIfMissing(userPath, userTemplate);
|
||||
await writeFileIfMissing(heartbeatPath, heartbeatTemplate);
|
||||
if (isBrandNewWorkspace) {
|
||||
await writeFileIfMissing(bootstrapPath, bootstrapTemplate);
|
||||
}
|
||||
@@ -233,7 +232,6 @@ export async function ensureAgentWorkspace(params?: {
|
||||
toolsPath,
|
||||
identityPath,
|
||||
userPath,
|
||||
heartbeatPath,
|
||||
bootstrapPath,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user