@devness/useai 0.8.11 → 0.8.12
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 +10 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -218,7 +218,7 @@ var VERSION;
|
|
|
218
218
|
var init_version = __esm({
|
|
219
219
|
"../shared/dist/constants/version.js"() {
|
|
220
220
|
"use strict";
|
|
221
|
-
VERSION = "0.8.
|
|
221
|
+
VERSION = "0.8.12";
|
|
222
222
|
}
|
|
223
223
|
});
|
|
224
224
|
|
|
@@ -33538,14 +33538,14 @@ var init_session_state = __esm({
|
|
|
33538
33538
|
this.touchActivity();
|
|
33539
33539
|
}
|
|
33540
33540
|
getSessionDuration() {
|
|
33541
|
-
return Math.round((Date.now() - this.sessionStartTime - this.childPausedMs) / 1e3);
|
|
33541
|
+
return Math.max(0, Math.round((Date.now() - this.sessionStartTime - this.childPausedMs) / 1e3));
|
|
33542
33542
|
}
|
|
33543
33543
|
/**
|
|
33544
33544
|
* Duration based on the last meaningful activity, not the current wall-clock time.
|
|
33545
33545
|
* Used by auto-seal to avoid counting idle timeout as active time.
|
|
33546
33546
|
*/
|
|
33547
33547
|
getActiveDuration() {
|
|
33548
|
-
return Math.round((this.lastActivityTime - this.sessionStartTime - this.childPausedMs) / 1e3);
|
|
33548
|
+
return Math.max(0, Math.round((this.lastActivityTime - this.sessionStartTime - this.childPausedMs) / 1e3));
|
|
33549
33549
|
}
|
|
33550
33550
|
/** Backward-compatible getter: returns the top of the parent stack (most recent parent), or null. */
|
|
33551
33551
|
get parentState() {
|
|
@@ -33594,7 +33594,9 @@ var init_session_state = __esm({
|
|
|
33594
33594
|
this.sessionId = p.sessionId;
|
|
33595
33595
|
this.sessionStartTime = p.sessionStartTime;
|
|
33596
33596
|
this.lastActivityTime = p.lastActivityTime;
|
|
33597
|
-
|
|
33597
|
+
const rawPausedMs = p.childPausedMs + (Date.now() - p.pausedAt);
|
|
33598
|
+
const maxPausedMs = Date.now() - p.sessionStartTime;
|
|
33599
|
+
this.childPausedMs = Math.min(rawPausedMs, maxPausedMs);
|
|
33598
33600
|
this.heartbeatCount = p.heartbeatCount;
|
|
33599
33601
|
this.sessionRecordCount = p.sessionRecordCount;
|
|
33600
33602
|
this.chainTipHash = p.chainTipHash;
|
|
@@ -34444,9 +34446,12 @@ function reconcileSession(indexEntry) {
|
|
|
34444
34446
|
let corrected = false;
|
|
34445
34447
|
const fixed = { ...indexEntry };
|
|
34446
34448
|
for (const field of RECONCILE_FIELDS) {
|
|
34447
|
-
|
|
34449
|
+
let chainValue = chainSeal[field];
|
|
34448
34450
|
const indexValue = indexEntry[field];
|
|
34449
34451
|
if (chainValue === void 0 || chainValue === null) continue;
|
|
34452
|
+
if (field === "duration_seconds" && typeof chainValue === "number" && chainValue < 0) {
|
|
34453
|
+
chainValue = 0;
|
|
34454
|
+
}
|
|
34450
34455
|
if (chainValue !== indexValue) {
|
|
34451
34456
|
fixed[field] = chainValue;
|
|
34452
34457
|
corrected = true;
|