agentlife 1.5.1 → 1.5.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 +52 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1812,6 +1812,27 @@ async function provisionAgents(state, cfg, runtime, log) {
|
|
|
1812
1812
|
rawCfgForVisibility.tools.sessions.visibility = "all";
|
|
1813
1813
|
visibilityWritten = true;
|
|
1814
1814
|
}
|
|
1815
|
+
const currentA2A = rawCfgForVisibility?.tools?.agentToAgent?.enabled;
|
|
1816
|
+
let a2aWritten = false;
|
|
1817
|
+
if (currentA2A !== true) {
|
|
1818
|
+
try {
|
|
1819
|
+
let backup = {};
|
|
1820
|
+
try {
|
|
1821
|
+
backup = JSON.parse(readFileSync(backupPath, "utf-8"));
|
|
1822
|
+
} catch {}
|
|
1823
|
+
if (backup.agentToAgentEnabled === undefined) {
|
|
1824
|
+
backup.agentToAgentEnabled = currentA2A ?? null;
|
|
1825
|
+
writeFileSync(backupPath, JSON.stringify(backup, null, 2) + `
|
|
1826
|
+
`, "utf-8");
|
|
1827
|
+
}
|
|
1828
|
+
} catch {}
|
|
1829
|
+
if (!rawCfgForVisibility.tools)
|
|
1830
|
+
rawCfgForVisibility.tools = {};
|
|
1831
|
+
if (!rawCfgForVisibility.tools.agentToAgent)
|
|
1832
|
+
rawCfgForVisibility.tools.agentToAgent = {};
|
|
1833
|
+
rawCfgForVisibility.tools.agentToAgent.enabled = true;
|
|
1834
|
+
a2aWritten = true;
|
|
1835
|
+
}
|
|
1815
1836
|
const currentAllow = rawCfgForVisibility?.tools?.allow;
|
|
1816
1837
|
let globalAllowWritten = false;
|
|
1817
1838
|
if (Array.isArray(currentAllow) && currentAllow.length > 0 && !currentAllow.includes("*")) {
|
|
@@ -1832,12 +1853,14 @@ async function provisionAgents(state, cfg, runtime, log) {
|
|
|
1832
1853
|
globalAllowWritten = true;
|
|
1833
1854
|
}
|
|
1834
1855
|
}
|
|
1835
|
-
if (visibilityWritten || globalAllowWritten) {
|
|
1856
|
+
if (visibilityWritten || a2aWritten || globalAllowWritten) {
|
|
1836
1857
|
writeFileSync(configPath, JSON.stringify(rawCfgForVisibility, null, 2) + `
|
|
1837
1858
|
`, "utf-8");
|
|
1838
1859
|
configChanged = true;
|
|
1839
1860
|
if (visibilityWritten)
|
|
1840
1861
|
log("[agentlife] set tools.sessions.visibility=all (cross-agent delegation)");
|
|
1862
|
+
if (a2aWritten)
|
|
1863
|
+
log("[agentlife] set tools.agentToAgent.enabled=true (cross-agent sends)");
|
|
1841
1864
|
if (globalAllowWritten)
|
|
1842
1865
|
log('[agentlife] added "*" to tools.allow (unblock exec/read/write for provisioned agents)');
|
|
1843
1866
|
}
|
|
@@ -2070,6 +2093,24 @@ function visionSurfaceCount(state) {
|
|
|
2070
2093
|
n++;
|
|
2071
2094
|
return n;
|
|
2072
2095
|
}
|
|
2096
|
+
async function anySpecialistHasBaseline(state, runtime) {
|
|
2097
|
+
const cfg = runtime.config.loadConfig();
|
|
2098
|
+
const list = cfg?.agents?.list ?? [];
|
|
2099
|
+
for (const agent of list) {
|
|
2100
|
+
const id = agent?.id;
|
|
2101
|
+
if (!id || PROVISIONED_IDS.has(id))
|
|
2102
|
+
continue;
|
|
2103
|
+
const workspace = agent.workspace || "";
|
|
2104
|
+
if (!workspace)
|
|
2105
|
+
continue;
|
|
2106
|
+
try {
|
|
2107
|
+
const content = await fs3.readFile(path4.join(workspace, "memory", "baseline.md"), "utf-8");
|
|
2108
|
+
if (content.trim().length > 0)
|
|
2109
|
+
return true;
|
|
2110
|
+
} catch {}
|
|
2111
|
+
}
|
|
2112
|
+
return false;
|
|
2113
|
+
}
|
|
2073
2114
|
function specialistHasAnySurface(state, specialistId) {
|
|
2074
2115
|
if (!state.surfaceDb)
|
|
2075
2116
|
return false;
|
|
@@ -2131,6 +2172,9 @@ async function computeStartingPhase(state, runtime) {
|
|
|
2131
2172
|
if (specialists.length === 0) {
|
|
2132
2173
|
return { phase: "BLANK", details: "no specialists" };
|
|
2133
2174
|
}
|
|
2175
|
+
if (await anySpecialistHasBaseline(state, runtime)) {
|
|
2176
|
+
return { phase: "SYNTHESIZING", details: "baseline.md present" };
|
|
2177
|
+
}
|
|
2134
2178
|
const { total } = await specialistMemoryTotal(state, runtime);
|
|
2135
2179
|
if (total < VISION_MIN_MEMORY_CHARS) {
|
|
2136
2180
|
return { phase: "AWAITING_BASELINE", details: `totalChars=${total} below ${VISION_MIN_MEMORY_CHARS}` };
|
|
@@ -2167,6 +2211,9 @@ async function transition(state, runtime, log, trigger) {
|
|
|
2167
2211
|
case "memoryWritten": {
|
|
2168
2212
|
if (cur.phase !== "AWAITING_BASELINE")
|
|
2169
2213
|
return cur;
|
|
2214
|
+
if (await anySpecialistHasBaseline(state, runtime)) {
|
|
2215
|
+
return enterPhase(state, runtime, log, "SYNTHESIZING");
|
|
2216
|
+
}
|
|
2170
2217
|
const { total } = await specialistMemoryTotal(state, runtime);
|
|
2171
2218
|
if (total >= VISION_MIN_MEMORY_CHARS) {
|
|
2172
2219
|
return enterPhase(state, runtime, log, "SYNTHESIZING");
|
|
@@ -2194,9 +2241,12 @@ async function transition(state, runtime, log, trigger) {
|
|
|
2194
2241
|
return cur;
|
|
2195
2242
|
}
|
|
2196
2243
|
if (cur.phase === "AWAITING_BASELINE") {
|
|
2244
|
+
if (await anySpecialistHasBaseline(state, runtime)) {
|
|
2245
|
+
return enterPhase(state, runtime, log, "SYNTHESIZING");
|
|
2246
|
+
}
|
|
2197
2247
|
const specialistId = specialistIdFromSessionKey(cur.actionSessionKey);
|
|
2198
2248
|
if (specialistId && !specialistHasAnySurface(state, specialistId)) {
|
|
2199
|
-
log(`[cold-start] ${specialistId} replied in AWAITING_BASELINE with no surface ` + `attributed — [system:start] contract violation
|
|
2249
|
+
log(`[cold-start] ${specialistId} replied in AWAITING_BASELINE with no surface ` + `attributed and no baseline.md written — [system:start] contract violation`);
|
|
2200
2250
|
return enterFailed(state, log, "agent_produced_no_surface");
|
|
2201
2251
|
}
|
|
2202
2252
|
return cur;
|