@ramarivera/coding-agent-langfuse 0.1.7 → 0.1.9
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/backfill.js +5 -4
- package/package.json +1 -1
package/dist/backfill.js
CHANGED
|
@@ -522,8 +522,8 @@ function opencodeEvents(homeDir, rowLimit) {
|
|
|
522
522
|
let sessions = [];
|
|
523
523
|
let messages = [];
|
|
524
524
|
try {
|
|
525
|
-
sessions = sqliteJsonByRowid(db, "session", "id, directory, time_created, time_updated, title, version, slug, project_id", undefined, rowLimit);
|
|
526
|
-
messages = sqliteJsonByRowid(db, "message", "id, session_id, time_created, time_updated, data
|
|
525
|
+
sessions = sqliteJsonByRowid(db, "session", "id, directory, time_created, time_updated, title, version, slug, project_id", undefined, rowLimit, 5_000);
|
|
526
|
+
messages = sqliteJsonByRowid(db, "message", "id, session_id, time_created, time_updated, case when length(data) <= 1000000 then data else null end as data, length(data) <= 1000000 as __include", undefined, rowLimit, 50);
|
|
527
527
|
}
|
|
528
528
|
catch (error) {
|
|
529
529
|
console.error(`Skipping OpenCode history from ${db}: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -548,6 +548,8 @@ function opencodeEvents(homeDir, rowLimit) {
|
|
|
548
548
|
});
|
|
549
549
|
}
|
|
550
550
|
for (const message of messages) {
|
|
551
|
+
if (asNumber(message.__include) === 0)
|
|
552
|
+
continue;
|
|
551
553
|
const sessionId = asString(message.session_id);
|
|
552
554
|
const session = sessionsById.get(sessionId);
|
|
553
555
|
const data = parseMaybeJson(message.data);
|
|
@@ -586,8 +588,7 @@ function sqliteJson(db, sql) {
|
|
|
586
588
|
});
|
|
587
589
|
return JSON.parse(output || "[]");
|
|
588
590
|
}
|
|
589
|
-
function sqliteJsonByRowid(db, table, columns, whereClause, rowLimit) {
|
|
590
|
-
const pageSize = 5_000;
|
|
591
|
+
function sqliteJsonByRowid(db, table, columns, whereClause, rowLimit, pageSize) {
|
|
591
592
|
const rows = [];
|
|
592
593
|
let lastRowid = 0;
|
|
593
594
|
while (rowLimit === undefined || rows.length < rowLimit) {
|