agentlife 1.2.5 → 1.2.7

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 +23 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1605,6 +1605,9 @@ ${capped}`);
1605
1605
  `) };
1606
1606
  }
1607
1607
  var VISION_MIN_MEMORY_CHARS = 200;
1608
+ var BOOTSTRAP_COOLDOWN_MS = 10 * 60 * 1000;
1609
+ var lastBootstrapSentAt = 0;
1610
+ var lastWarmupSentAt = 0;
1608
1611
  async function ensureVisionPosters(state, runtime, log, options = {}) {
1609
1612
  if (!state.surfaceDb) {
1610
1613
  log("[agentlife] ensureVisionPosters: skipped — surfaceDb not initialized");
@@ -1632,9 +1635,11 @@ async function ensureVisionPosters(state, runtime, log, options = {}) {
1632
1635
  }
1633
1636
  const { totalChars, sections } = await gatherAllAgentMemory(state, finalList, SKIP_IDS);
1634
1637
  if (totalChars < VISION_MIN_MEMORY_CHARS) {
1635
- if (state.runCommand) {
1638
+ const warmupNow = Date.now();
1639
+ if (state.runCommand && warmupNow - lastWarmupSentAt >= BOOTSTRAP_COOLDOWN_MS) {
1636
1640
  const specialistId = [...state.agentRegistry.keys()].find((id) => !SKIP_IDS.has(id));
1637
1641
  if (specialistId) {
1642
+ lastWarmupSentAt = warmupNow;
1638
1643
  const warmupKey = buildAgentSessionKey(specialistId);
1639
1644
  const warmupMsg = [
1640
1645
  `[system:warmup] You were just created and have no user data yet.`,
@@ -1671,6 +1676,11 @@ async function ensureVisionPosters(state, runtime, log, options = {}) {
1671
1676
  if (content.trim())
1672
1677
  rejectedDreams = content.trim().slice(0, 4000);
1673
1678
  } catch {}
1679
+ const now = Date.now();
1680
+ if (now - lastBootstrapSentAt < BOOTSTRAP_COOLDOWN_MS) {
1681
+ log(`[agentlife] ensureVisionPosters: skipped — bootstrap cooldown (${Math.round((BOOTSTRAP_COOLDOWN_MS - (now - lastBootstrapSentAt)) / 1000)}s remaining)`);
1682
+ return { status: "skipped", reason: "thin_memory", details: `cooldown` };
1683
+ }
1674
1684
  const builderKey = buildAgentSessionKey("agentlife-builder");
1675
1685
  const bootstrapMsg = [
1676
1686
  `[system:dashboard-bootstrap] The dashboard is empty. Push 3-4 vision posters with agentlife_push.`,
@@ -1782,6 +1792,7 @@ async function ensureVisionPosters(state, runtime, log, options = {}) {
1782
1792
  message: bootstrapMsg,
1783
1793
  idempotencyKey: `dashboard-bootstrap-${Date.now()}`
1784
1794
  });
1795
+ lastBootstrapSentAt = Date.now();
1785
1796
  const delayMs = options.delayMs ?? 0;
1786
1797
  const feedbackChars = rejectedDreams.length;
1787
1798
  const runBootstrap = () => {
@@ -1866,6 +1877,17 @@ async function provisionAgents(state, cfg, runtime, log) {
1866
1877
  log(`[agentlife] backfilled subagents for ${agent.id}`);
1867
1878
  }
1868
1879
  }
1880
+ const rawCfgForTools = JSON.parse(readFileSync(path3.join(os.homedir(), ".openclaw", "openclaw.json"), "utf-8"));
1881
+ const globalAllow = rawCfgForTools?.tools?.allow ?? [];
1882
+ if (!globalAllow.includes("agentlife_push")) {
1883
+ if (!rawCfgForTools.tools)
1884
+ rawCfgForTools.tools = {};
1885
+ rawCfgForTools.tools.allow = [...globalAllow, "agentlife_push"];
1886
+ writeFileSync(path3.join(os.homedir(), ".openclaw", "openclaw.json"), JSON.stringify(rawCfgForTools, null, 2) + `
1887
+ `, "utf-8");
1888
+ configChanged = true;
1889
+ log("[agentlife] added agentlife_push to global tools.allow");
1890
+ }
1869
1891
  const rawCfgForVisibility = JSON.parse(readFileSync(path3.join(os.homedir(), ".openclaw", "openclaw.json"), "utf-8"));
1870
1892
  const currentVisibility = rawCfgForVisibility?.tools?.sessions?.visibility;
1871
1893
  if (currentVisibility !== "all") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentlife",
3
- "version": "1.2.5",
3
+ "version": "1.2.7",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "bun build index.ts --outfile dist/index.js --target node --external openclaw/plugin-sdk",