agentlife 1.5.0 → 1.5.1
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 +23 -0
- 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
|
+
function specialistHasAnySurface(state, specialistId) {
|
|
2074
|
+
if (!state.surfaceDb)
|
|
2075
|
+
return false;
|
|
2076
|
+
for (const id of state.surfaceDb.keys()) {
|
|
2077
|
+
if (state.surfaceDb.getAgentId(id) === specialistId)
|
|
2078
|
+
return true;
|
|
2079
|
+
}
|
|
2080
|
+
return false;
|
|
2081
|
+
}
|
|
2082
|
+
function specialistIdFromSessionKey(sessionKey) {
|
|
2083
|
+
if (!sessionKey)
|
|
2084
|
+
return null;
|
|
2085
|
+
const parts = sessionKey.split(":");
|
|
2086
|
+
if (parts.length < 2 || parts[0] !== "agent")
|
|
2087
|
+
return null;
|
|
2088
|
+
const id = parts[1];
|
|
2089
|
+
return id && id.length > 0 ? id : null;
|
|
2090
|
+
}
|
|
2073
2091
|
async function sendSystemMessage(state, agentId, message, idempotencyKey, log) {
|
|
2074
2092
|
if (!state.runCommand) {
|
|
2075
2093
|
log(`[cold-start] sendSystemMessage ${idempotencyKey}: skipped — runCommand not available`);
|
|
@@ -2176,6 +2194,11 @@ async function transition(state, runtime, log, trigger) {
|
|
|
2176
2194
|
return cur;
|
|
2177
2195
|
}
|
|
2178
2196
|
if (cur.phase === "AWAITING_BASELINE") {
|
|
2197
|
+
const specialistId = specialistIdFromSessionKey(cur.actionSessionKey);
|
|
2198
|
+
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)`);
|
|
2200
|
+
return enterFailed(state, log, "agent_produced_no_surface");
|
|
2201
|
+
}
|
|
2179
2202
|
return cur;
|
|
2180
2203
|
}
|
|
2181
2204
|
return cur;
|