@yeaft/webchat-agent 0.1.1043 → 0.1.1046
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/package.json +1 -1
- package/yeaft/debug-trace.js +7 -3
- package/yeaft/web-bridge.js +4 -0
package/package.json
CHANGED
package/yeaft/debug-trace.js
CHANGED
|
@@ -436,8 +436,12 @@ export class DebugTrace {
|
|
|
436
436
|
ORDER BY started_at DESC
|
|
437
437
|
LIMIT ?
|
|
438
438
|
`;
|
|
439
|
-
|
|
440
|
-
|
|
439
|
+
// Fetch one extra row so the UI can tell whether older history exists
|
|
440
|
+
// without issuing a second COUNT(*) against the hot debug trace table.
|
|
441
|
+
args.push(lim + 1);
|
|
442
|
+
const fetchedRows = this.#db.prepare(sql).all(...args);
|
|
443
|
+
const hasMore = fetchedRows.length > lim;
|
|
444
|
+
const rows = hasMore ? fetchedRows.slice(0, lim) : fetchedRows;
|
|
441
445
|
const turnIds = rows.map(r => r.id);
|
|
442
446
|
const tools = turnIds.length > 0
|
|
443
447
|
? this.#db.prepare(
|
|
@@ -572,7 +576,7 @@ export class DebugTrace {
|
|
|
572
576
|
// Reverse to oldest-first so the panel's existing append-driven UI
|
|
573
577
|
// renders in chronological order on hydration.
|
|
574
578
|
loops.reverse();
|
|
575
|
-
return { loops, turns: Array.from(turnsById.values()), dreamEvents };
|
|
579
|
+
return { loops, turns: Array.from(turnsById.values()), dreamEvents, hasMore, limit: lim };
|
|
576
580
|
}
|
|
577
581
|
|
|
578
582
|
/**
|
package/yeaft/web-bridge.js
CHANGED
|
@@ -4017,12 +4017,14 @@ export async function handleYeaftFetchDebugHistory(msg = {}) {
|
|
|
4017
4017
|
let loops = [];
|
|
4018
4018
|
let turns = [];
|
|
4019
4019
|
let dreamEvents = [];
|
|
4020
|
+
let hasMore = false;
|
|
4020
4021
|
try {
|
|
4021
4022
|
if (session?.trace && typeof session.trace.fetchRecentDebugHistory === 'function') {
|
|
4022
4023
|
const out = session.trace.fetchRecentDebugHistory({ limit, dreamLimit, sessionId, threadId });
|
|
4023
4024
|
loops = Array.isArray(out?.loops) ? out.loops : [];
|
|
4024
4025
|
turns = Array.isArray(out?.turns) ? out.turns : [];
|
|
4025
4026
|
dreamEvents = Array.isArray(out?.dreamEvents) ? out.dreamEvents : [];
|
|
4027
|
+
hasMore = !!out?.hasMore;
|
|
4026
4028
|
}
|
|
4027
4029
|
} catch (err) {
|
|
4028
4030
|
sendToServer({
|
|
@@ -4041,6 +4043,8 @@ export async function handleYeaftFetchDebugHistory(msg = {}) {
|
|
|
4041
4043
|
dreamEvents,
|
|
4042
4044
|
sessionId,
|
|
4043
4045
|
threadId,
|
|
4046
|
+
hasMore,
|
|
4047
|
+
limit,
|
|
4044
4048
|
});
|
|
4045
4049
|
}
|
|
4046
4050
|
|