agentlife 1.2.0 → 1.2.2

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.
Files changed (2) hide show
  1. package/dist/index.js +58 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1632,7 +1632,41 @@ 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
- log(`[agentlife] ensureVisionPosters: skipped totalChars=${totalChars} below threshold ${VISION_MIN_MEMORY_CHARS} (memory too thin)`);
1635
+ const homeDir2 = options.homedirOverride ?? os.homedir();
1636
+ const warmupMarker = path3.join(homeDir2, ".openclaw", "agentlife", "warmup-sent.json");
1637
+ let warmupAlreadySent = false;
1638
+ try {
1639
+ const marker = JSON.parse(readFileSync(warmupMarker, "utf-8"));
1640
+ warmupAlreadySent = marker?.sent === true;
1641
+ } catch {}
1642
+ if (!warmupAlreadySent && state.runCommand) {
1643
+ const specialistId = [...state.agentRegistry.keys()].find((id) => !SKIP_IDS.has(id));
1644
+ if (specialistId) {
1645
+ const warmupKey = buildAgentSessionKey(specialistId);
1646
+ const warmupMsg = `[system:warmup] You were just created. The user chose your domain but you have no data yet. Push a guided input widget (input surface with action=choice buttons) asking the user for the most important baseline info for your domain. One question at a time, 2-3 questions max. After collecting the answers, push a dashboard widget (NOT input) summarizing what you learned. Use the user's language.`;
1647
+ const warmupParams = JSON.stringify({
1648
+ sessionKey: warmupKey,
1649
+ message: warmupMsg,
1650
+ idempotencyKey: `warmup-${specialistId}-${Date.now()}`
1651
+ });
1652
+ state.runCommand(["openclaw", "gateway", "call", "chat.send", "--params", warmupParams], { timeoutMs: 120000 }).then(() => {
1653
+ log(`[agentlife] ensureVisionPosters: warmup sent to ${specialistId}`);
1654
+ }).catch((e) => {
1655
+ log(`[agentlife] ensureVisionPosters: warmup failed for ${specialistId}: ${e?.message}`);
1656
+ });
1657
+ try {
1658
+ const dir = path3.dirname(warmupMarker);
1659
+ try {
1660
+ fs2.mkdir(dir, { recursive: true });
1661
+ } catch {}
1662
+ writeFileSync(warmupMarker, JSON.stringify({ sent: true, agentId: specialistId, at: Date.now() }) + `
1663
+ `, "utf-8");
1664
+ } catch {}
1665
+ log(`[agentlife] ensureVisionPosters: skipped — totalChars=${totalChars} below threshold ${VISION_MIN_MEMORY_CHARS} (warmup triggered for ${specialistId})`);
1666
+ return { status: "skipped", reason: "thin_memory", details: `totalChars=${totalChars}, warmup=${specialistId}` };
1667
+ }
1668
+ }
1669
+ log(`[agentlife] ensureVisionPosters: skipped — totalChars=${totalChars} below threshold ${VISION_MIN_MEMORY_CHARS} (memory too thin${warmupAlreadySent ? ", warmup already sent" : ""})`);
1636
1670
  return { status: "skipped", reason: "thin_memory", details: `totalChars=${totalChars}` };
1637
1671
  }
1638
1672
  const homeDir = options.homedirOverride ?? os.homedir();
@@ -1839,6 +1873,29 @@ async function provisionAgents(state, cfg, runtime, log) {
1839
1873
  log(`[agentlife] backfilled subagents for ${agent.id}`);
1840
1874
  }
1841
1875
  }
1876
+ const rawCfgForVisibility = JSON.parse(readFileSync(path3.join(os.homedir(), ".openclaw", "openclaw.json"), "utf-8"));
1877
+ const currentVisibility = rawCfgForVisibility?.tools?.sessions?.visibility;
1878
+ if (currentVisibility !== "all") {
1879
+ const backupPath = path3.join(os.homedir(), ".openclaw", "agentlife", "config-backup.json");
1880
+ try {
1881
+ let backup = {};
1882
+ try {
1883
+ backup = JSON.parse(readFileSync(backupPath, "utf-8"));
1884
+ } catch {}
1885
+ backup.sessionsVisibility = currentVisibility ?? null;
1886
+ writeFileSync(backupPath, JSON.stringify(backup, null, 2) + `
1887
+ `, "utf-8");
1888
+ } catch {}
1889
+ if (!rawCfgForVisibility.tools)
1890
+ rawCfgForVisibility.tools = {};
1891
+ if (!rawCfgForVisibility.tools.sessions)
1892
+ rawCfgForVisibility.tools.sessions = {};
1893
+ rawCfgForVisibility.tools.sessions.visibility = "all";
1894
+ writeFileSync(path3.join(os.homedir(), ".openclaw", "openclaw.json"), JSON.stringify(rawCfgForVisibility, null, 2) + `
1895
+ `, "utf-8");
1896
+ configChanged = true;
1897
+ log("[agentlife] set tools.sessions.visibility=all (cross-agent delegation)");
1898
+ }
1842
1899
  if (configChanged) {
1843
1900
  const configPath = path3.join(os.homedir(), ".openclaw", "openclaw.json");
1844
1901
  const rawCfg = JSON.parse(readFileSync(configPath, "utf-8"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentlife",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "bun build index.ts --outfile dist/index.js --target node --external openclaw/plugin-sdk",