agentlife 1.2.1 → 1.2.3
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 +37 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1632,6 +1632,33 @@ async function ensureVisionPosters(state, runtime, log, options = {}) {
|
|
|
1632
1632
|
}
|
|
1633
1633
|
const { totalChars, sections } = await gatherAllAgentMemory(state, finalList, SKIP_IDS);
|
|
1634
1634
|
if (totalChars < VISION_MIN_MEMORY_CHARS) {
|
|
1635
|
+
if (state.runCommand) {
|
|
1636
|
+
const specialistId = [...state.agentRegistry.keys()].find((id) => !SKIP_IDS.has(id));
|
|
1637
|
+
if (specialistId) {
|
|
1638
|
+
const warmupKey = buildAgentSessionKey(specialistId);
|
|
1639
|
+
const warmupMsg = [
|
|
1640
|
+
`[system:warmup] You were just created and have no user data yet.`,
|
|
1641
|
+
``,
|
|
1642
|
+
`1. Push a guided input widget (input surface, action=choice buttons) asking the user for the most important baseline info for your domain. One question at a time, 2-3 questions max.`,
|
|
1643
|
+
`2. After each answer, WRITE the data to your memory directory: exec mkdir -p ~/.openclaw/workspace-${specialistId}/memory && write the answer to a file there (e.g., memory/baseline.md). This is critical — your memory directory is what the platform reads to generate the user's vision dashboard. If you only store data in widget context, it's lost when the widget is dismissed.`,
|
|
1644
|
+
`3. After collecting all answers, push a DASHBOARD widget (NOT input) summarizing what you learned. This widget must NOT have the "input" keyword — it renders on the main dashboard, not the input bar.`,
|
|
1645
|
+
`4. Use the user's language.`,
|
|
1646
|
+
``,
|
|
1647
|
+
`If you already collected baseline data in a previous session, check your memory directory. If it has content, push a dashboard summary widget and respond "done". Do NOT re-ask questions you already have answers for.`
|
|
1648
|
+
].join(`
|
|
1649
|
+
`);
|
|
1650
|
+
const warmupParams = JSON.stringify({
|
|
1651
|
+
sessionKey: warmupKey,
|
|
1652
|
+
message: warmupMsg,
|
|
1653
|
+
idempotencyKey: `warmup-${specialistId}-${Date.now()}`
|
|
1654
|
+
});
|
|
1655
|
+
state.runCommand(["openclaw", "gateway", "call", "chat.send", "--params", warmupParams], { timeoutMs: 120000 }).then(() => {
|
|
1656
|
+
log(`[agentlife] ensureVisionPosters: warmup sent to ${specialistId}`);
|
|
1657
|
+
}).catch((e) => {
|
|
1658
|
+
log(`[agentlife] ensureVisionPosters: warmup failed for ${specialistId}: ${e?.message}`);
|
|
1659
|
+
});
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1635
1662
|
log(`[agentlife] ensureVisionPosters: skipped — totalChars=${totalChars} below threshold ${VISION_MIN_MEMORY_CHARS} (memory too thin)`);
|
|
1636
1663
|
return { status: "skipped", reason: "thin_memory", details: `totalChars=${totalChars}` };
|
|
1637
1664
|
}
|
|
@@ -1842,6 +1869,16 @@ async function provisionAgents(state, cfg, runtime, log) {
|
|
|
1842
1869
|
const rawCfgForVisibility = JSON.parse(readFileSync(path3.join(os.homedir(), ".openclaw", "openclaw.json"), "utf-8"));
|
|
1843
1870
|
const currentVisibility = rawCfgForVisibility?.tools?.sessions?.visibility;
|
|
1844
1871
|
if (currentVisibility !== "all") {
|
|
1872
|
+
const backupPath = path3.join(os.homedir(), ".openclaw", "agentlife", "config-backup.json");
|
|
1873
|
+
try {
|
|
1874
|
+
let backup = {};
|
|
1875
|
+
try {
|
|
1876
|
+
backup = JSON.parse(readFileSync(backupPath, "utf-8"));
|
|
1877
|
+
} catch {}
|
|
1878
|
+
backup.sessionsVisibility = currentVisibility ?? null;
|
|
1879
|
+
writeFileSync(backupPath, JSON.stringify(backup, null, 2) + `
|
|
1880
|
+
`, "utf-8");
|
|
1881
|
+
} catch {}
|
|
1845
1882
|
if (!rawCfgForVisibility.tools)
|
|
1846
1883
|
rawCfgForVisibility.tools = {};
|
|
1847
1884
|
if (!rawCfgForVisibility.tools.sessions)
|