agentlife 1.5.1 → 1.5.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 +28 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2070,6 +2070,24 @@ function visionSurfaceCount(state) {
2070
2070
  n++;
2071
2071
  return n;
2072
2072
  }
2073
+ async function anySpecialistHasBaseline(state, runtime) {
2074
+ const cfg = runtime.config.loadConfig();
2075
+ const list = cfg?.agents?.list ?? [];
2076
+ for (const agent of list) {
2077
+ const id = agent?.id;
2078
+ if (!id || PROVISIONED_IDS.has(id))
2079
+ continue;
2080
+ const workspace = agent.workspace || "";
2081
+ if (!workspace)
2082
+ continue;
2083
+ try {
2084
+ const content = await fs3.readFile(path4.join(workspace, "memory", "baseline.md"), "utf-8");
2085
+ if (content.trim().length > 0)
2086
+ return true;
2087
+ } catch {}
2088
+ }
2089
+ return false;
2090
+ }
2073
2091
  function specialistHasAnySurface(state, specialistId) {
2074
2092
  if (!state.surfaceDb)
2075
2093
  return false;
@@ -2131,6 +2149,9 @@ async function computeStartingPhase(state, runtime) {
2131
2149
  if (specialists.length === 0) {
2132
2150
  return { phase: "BLANK", details: "no specialists" };
2133
2151
  }
2152
+ if (await anySpecialistHasBaseline(state, runtime)) {
2153
+ return { phase: "SYNTHESIZING", details: "baseline.md present" };
2154
+ }
2134
2155
  const { total } = await specialistMemoryTotal(state, runtime);
2135
2156
  if (total < VISION_MIN_MEMORY_CHARS) {
2136
2157
  return { phase: "AWAITING_BASELINE", details: `totalChars=${total} below ${VISION_MIN_MEMORY_CHARS}` };
@@ -2167,6 +2188,9 @@ async function transition(state, runtime, log, trigger) {
2167
2188
  case "memoryWritten": {
2168
2189
  if (cur.phase !== "AWAITING_BASELINE")
2169
2190
  return cur;
2191
+ if (await anySpecialistHasBaseline(state, runtime)) {
2192
+ return enterPhase(state, runtime, log, "SYNTHESIZING");
2193
+ }
2170
2194
  const { total } = await specialistMemoryTotal(state, runtime);
2171
2195
  if (total >= VISION_MIN_MEMORY_CHARS) {
2172
2196
  return enterPhase(state, runtime, log, "SYNTHESIZING");
@@ -2194,9 +2218,12 @@ async function transition(state, runtime, log, trigger) {
2194
2218
  return cur;
2195
2219
  }
2196
2220
  if (cur.phase === "AWAITING_BASELINE") {
2221
+ if (await anySpecialistHasBaseline(state, runtime)) {
2222
+ return enterPhase(state, runtime, log, "SYNTHESIZING");
2223
+ }
2197
2224
  const specialistId = specialistIdFromSessionKey(cur.actionSessionKey);
2198
2225
  if (specialistId && !specialistHasAnySurface(state, specialistId)) {
2199
- log(`[cold-start] ${specialistId} replied in AWAITING_BASELINE with no surface ` + `attributed — [system:start] contract violation (expected a warmup-* input surface)`);
2226
+ log(`[cold-start] ${specialistId} replied in AWAITING_BASELINE with no surface ` + `attributed and no baseline.md written — [system:start] contract violation`);
2200
2227
  return enterFailed(state, log, "agent_produced_no_surface");
2201
2228
  }
2202
2229
  return cur;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentlife",
3
- "version": "1.5.1",
3
+ "version": "1.5.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",