agentlife 2.6.16 → 2.6.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +16 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1577,6 +1577,22 @@ async function provisionAgents(state, cfg, runtime, log) {
|
|
|
1577
1577
|
const workspaceDir = agent.workspaceDir ?? path4.join(home, ".openclaw", `workspace-${agent.id}`);
|
|
1578
1578
|
await fs3.mkdir(workspaceDir, { recursive: true });
|
|
1579
1579
|
await fs3.writeFile(path4.join(workspaceDir, "AGENTS.md"), agent.agentsMd, "utf-8");
|
|
1580
|
+
const stateDir = path4.join(workspaceDir, ".openclaw");
|
|
1581
|
+
await fs3.mkdir(stateDir, { recursive: true });
|
|
1582
|
+
const stateFile = path4.join(stateDir, "workspace-state.json");
|
|
1583
|
+
try {
|
|
1584
|
+
await fs3.writeFile(stateFile, JSON.stringify({ version: 1, bootstrapSeededAt: new Date().toISOString() }, null, 2) + `
|
|
1585
|
+
`, { encoding: "utf-8", flag: "wx" });
|
|
1586
|
+
} catch {
|
|
1587
|
+
try {
|
|
1588
|
+
const existing = JSON.parse(await fs3.readFile(stateFile, "utf-8"));
|
|
1589
|
+
if (!existing.bootstrapSeededAt) {
|
|
1590
|
+
existing.bootstrapSeededAt = new Date().toISOString();
|
|
1591
|
+
await fs3.writeFile(stateFile, JSON.stringify(existing, null, 2) + `
|
|
1592
|
+
`, "utf-8");
|
|
1593
|
+
}
|
|
1594
|
+
} catch {}
|
|
1595
|
+
}
|
|
1580
1596
|
if (!agent.existingAgent) {
|
|
1581
1597
|
const stubPath = path4.join(workspaceDir, "SOUL.md");
|
|
1582
1598
|
await fs3.writeFile(stubPath, "", { encoding: "utf-8", flag: "wx" }).catch(() => {});
|