agentlife 1.3.0 → 1.3.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.
- package/dist/index.js +25 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1608,6 +1608,10 @@ var VISION_MIN_MEMORY_CHARS = 200;
|
|
|
1608
1608
|
var BOOTSTRAP_COOLDOWN_MS = 10 * 60 * 1000;
|
|
1609
1609
|
var lastBootstrapSentAt = 0;
|
|
1610
1610
|
var lastWarmupSentAt = 0;
|
|
1611
|
+
function resetBootstrapCooldown() {
|
|
1612
|
+
lastBootstrapSentAt = 0;
|
|
1613
|
+
lastWarmupSentAt = 0;
|
|
1614
|
+
}
|
|
1611
1615
|
async function ensureVisionPosters(state, runtime, log, options = {}) {
|
|
1612
1616
|
if (!state.surfaceDb) {
|
|
1613
1617
|
log("[agentlife] ensureVisionPosters: skipped — surfaceDb not initialized");
|
|
@@ -1679,7 +1683,7 @@ async function ensureVisionPosters(state, runtime, log, options = {}) {
|
|
|
1679
1683
|
const now = Date.now();
|
|
1680
1684
|
if (now - lastBootstrapSentAt < BOOTSTRAP_COOLDOWN_MS) {
|
|
1681
1685
|
log(`[agentlife] ensureVisionPosters: skipped — bootstrap cooldown (${Math.round((BOOTSTRAP_COOLDOWN_MS - (now - lastBootstrapSentAt)) / 1000)}s remaining)`);
|
|
1682
|
-
return { status: "skipped", reason: "
|
|
1686
|
+
return { status: "skipped", reason: "cooldown", details: `${Math.round((BOOTSTRAP_COOLDOWN_MS - (now - lastBootstrapSentAt)) / 1000)}s remaining` };
|
|
1683
1687
|
}
|
|
1684
1688
|
const builderKey = buildAgentSessionKey("agentlife-builder");
|
|
1685
1689
|
const bootstrapMsg = [
|
|
@@ -4290,9 +4294,10 @@ function extractCronTitle(meta) {
|
|
|
4290
4294
|
const headingLine = meta.lines.find((l) => /^\s*text\s+"[^"]+"\s+h[1-4]/.test(l));
|
|
4291
4295
|
if (headingLine)
|
|
4292
4296
|
return headingLine.match(/text\s+"([^"]+)"/)?.[1] ?? null;
|
|
4293
|
-
const goalLine = meta.lines.find((l) => /^\s*goal
|
|
4294
|
-
if (goalLine)
|
|
4295
|
-
return goalLine.match(/goal
|
|
4297
|
+
const goalLine = meta.lines.find((l) => /^\s*goal:?\s+"[^"]+"/.test(l) || /^\s*goal:\s+\S/.test(l));
|
|
4298
|
+
if (goalLine) {
|
|
4299
|
+
return goalLine.match(/goal:?\s+"([^"]+)"/)?.[1] ?? goalLine.match(/goal:\s+(.+)/)?.[1]?.trim() ?? null;
|
|
4300
|
+
}
|
|
4296
4301
|
const textLine = meta.lines.find((l) => /^\s*text\s+"[^"]+"/.test(l));
|
|
4297
4302
|
if (textLine)
|
|
4298
4303
|
return textLine.match(/text\s+"([^"]+)"/)?.[1] ?? null;
|
|
@@ -5808,9 +5813,10 @@ function extractWidgetText(meta) {
|
|
|
5808
5813
|
const headingLine = meta.lines.find((l) => /^\s*text\s+"[^"]+"\s+h[1-4]/.test(l));
|
|
5809
5814
|
if (headingLine)
|
|
5810
5815
|
return headingLine.match(/text\s+"([^"]+)"/)?.[1] ?? null;
|
|
5811
|
-
const goalLine = meta.lines.find((l) => /^\s*goal
|
|
5812
|
-
if (goalLine)
|
|
5813
|
-
return goalLine.match(/goal
|
|
5816
|
+
const goalLine = meta.lines.find((l) => /^\s*goal:?\s+"[^"]+"/.test(l) || /^\s*goal:\s+\S/.test(l));
|
|
5817
|
+
if (goalLine) {
|
|
5818
|
+
return goalLine.match(/goal:?\s+"([^"]+)"/)?.[1] ?? goalLine.match(/goal:\s+(.+)/)?.[1]?.trim() ?? null;
|
|
5819
|
+
}
|
|
5814
5820
|
const textLine = meta.lines.find((l) => /^\s*text\s+"[^"]+"/.test(l));
|
|
5815
5821
|
if (textLine)
|
|
5816
5822
|
return textLine.match(/text\s+"([^"]+)"/)?.[1] ?? null;
|
|
@@ -7274,6 +7280,18 @@ function register(api) {
|
|
|
7274
7280
|
respond(false, { code: "internal_error", message: e?.message ?? String(e) });
|
|
7275
7281
|
}
|
|
7276
7282
|
}, { scope: "operator.read" });
|
|
7283
|
+
api.registerGatewayMethod("agentlife.vision.retryWarmup", async ({ respond }) => {
|
|
7284
|
+
try {
|
|
7285
|
+
if (!currentState) {
|
|
7286
|
+
return respond(false, { error: "plugin state not initialized" });
|
|
7287
|
+
}
|
|
7288
|
+
resetBootstrapCooldown();
|
|
7289
|
+
const result = await ensureVisionPosters(currentState, api.runtime, console.log);
|
|
7290
|
+
respond(true, result);
|
|
7291
|
+
} catch (e) {
|
|
7292
|
+
respond(false, { code: "internal_error", message: e?.message ?? String(e) });
|
|
7293
|
+
}
|
|
7294
|
+
}, { scope: "operator.read" });
|
|
7277
7295
|
}
|
|
7278
7296
|
export {
|
|
7279
7297
|
register as default,
|