@standardagents/code 0.11.1 → 0.11.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 +9 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3293,8 +3293,16 @@ var BUSY_TAIL_STALE_MS = 30 * 6e4;
|
|
|
3293
3293
|
function toMs(raw) {
|
|
3294
3294
|
return raw > 1e14 ? raw / 1e3 : raw < 1e12 ? raw * 1e3 : raw;
|
|
3295
3295
|
}
|
|
3296
|
+
var EXECUTION_STOPPED_MARKER = "Execution stopped by user";
|
|
3296
3297
|
function deriveSessionActivity(messages, nowMs = Date.now()) {
|
|
3297
|
-
const
|
|
3298
|
+
const all = messages.filter((message) => message.silent !== true && message.metadata?.silent !== true).sort((a, b) => createdAt(a) - createdAt(b));
|
|
3299
|
+
let stopMs = 0;
|
|
3300
|
+
for (const message of all) {
|
|
3301
|
+
if (message.role === "system" && messageText(message.content).startsWith(EXECUTION_STOPPED_MARKER)) {
|
|
3302
|
+
stopMs = Math.max(stopMs, toMs(createdAt(message)));
|
|
3303
|
+
}
|
|
3304
|
+
}
|
|
3305
|
+
const visible = stopMs > 0 ? all.filter((message) => toMs(createdAt(message)) > stopMs) : all;
|
|
3298
3306
|
if (visible.some((message) => message.status === "pending")) {
|
|
3299
3307
|
const lastPending = [...visible].reverse().find((m) => m.status === "pending");
|
|
3300
3308
|
const pendingMs = lastPending ? toMs(createdAt(lastPending)) : 0;
|