@vectorize-io/hindsight-coding-agents 0.0.3 → 0.0.4
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/README.md +125 -122
- package/dist/antigravity-hook.js +36 -15
- package/dist/antigravity-stop-hook.js +36 -15
- package/dist/claude-hook.js +36 -15
- package/dist/claude-sessionstart-hook.js +38 -17
- package/dist/claude-stop-hook.js +36 -15
- package/dist/codex-hook.js +36 -15
- package/dist/codex-sessionstart-hook.js +38 -17
- package/dist/codex-stop-hook.js +36 -15
- package/dist/copilot-hook.js +36 -15
- package/dist/copilot-sessionstart-hook.js +38 -17
- package/dist/copilot-stop-hook.js +36 -15
- package/dist/cursor-hook.js +36 -15
- package/dist/cursor-sessionstart-hook.js +38 -17
- package/dist/cursor-stop-hook.js +36 -15
- package/dist/devin-hook.js +36 -15
- package/dist/devin-sessionstart-hook.js +38 -17
- package/dist/devin-stop-hook.js +36 -15
- package/dist/grok-hook.js +36 -15
- package/dist/grok-sessionstart-hook.js +38 -17
- package/dist/grok-stop-hook.js +36 -15
- package/dist/installer.js +454 -132
- package/package.json +1 -1
package/dist/devin-hook.js
CHANGED
|
@@ -1283,10 +1283,13 @@ function readGrokTranscript(path) {
|
|
|
1283
1283
|
}
|
|
1284
1284
|
|
|
1285
1285
|
// src/core/transcript-devin.ts
|
|
1286
|
-
import {
|
|
1286
|
+
import { existsSync as existsSync5 } from "fs";
|
|
1287
|
+
import { createRequire } from "module";
|
|
1287
1288
|
import { homedir as homedir6 } from "os";
|
|
1288
1289
|
import { join as join9 } from "path";
|
|
1289
|
-
|
|
1290
|
+
function devinSessionDb(home = homedir6()) {
|
|
1291
|
+
return join9(home, ".local", "share", "devin", "cli", "sessions.db");
|
|
1292
|
+
}
|
|
1290
1293
|
function parseDevinMessages(nodes) {
|
|
1291
1294
|
const messages = /* @__PURE__ */ new Map();
|
|
1292
1295
|
for (const node of nodes) {
|
|
@@ -1307,23 +1310,41 @@ function parseDevinMessages(nodes) {
|
|
|
1307
1310
|
}
|
|
1308
1311
|
return [...messages.values()].sort((a, b) => a.index - b.index).map(({ role, content }) => ({ role, content }));
|
|
1309
1312
|
}
|
|
1310
|
-
|
|
1311
|
-
|
|
1313
|
+
var requireBuiltin = createRequire(import.meta.url);
|
|
1314
|
+
function loadSqlite() {
|
|
1312
1315
|
try {
|
|
1313
|
-
|
|
1314
|
-
const raw = execFileSync4(
|
|
1315
|
-
"sqlite3",
|
|
1316
|
-
[
|
|
1317
|
-
"-json",
|
|
1318
|
-
sessionDb,
|
|
1319
|
-
`SELECT node_id, chat_message FROM message_nodes WHERE session_id = '${quotedId}' ORDER BY node_id`
|
|
1320
|
-
],
|
|
1321
|
-
{ encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 2e3 }
|
|
1322
|
-
);
|
|
1323
|
-
return parseDevinMessages(JSON.parse(raw));
|
|
1316
|
+
return requireBuiltin("node:sqlite").DatabaseSync;
|
|
1324
1317
|
} catch {
|
|
1318
|
+
return void 0;
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
function readDevinTranscript(sessionId, dbPath = devinSessionDb()) {
|
|
1322
|
+
if (!sessionId) return [];
|
|
1323
|
+
const Database = loadSqlite();
|
|
1324
|
+
if (!Database) {
|
|
1325
|
+
diag("devin-cli", "sqlite_unavailable", { node: process.version, dbPath });
|
|
1325
1326
|
return [];
|
|
1326
1327
|
}
|
|
1328
|
+
if (!existsSync5(dbPath)) {
|
|
1329
|
+
diag("devin-cli", "session_db_missing", { dbPath });
|
|
1330
|
+
return [];
|
|
1331
|
+
}
|
|
1332
|
+
let db;
|
|
1333
|
+
try {
|
|
1334
|
+
db = new Database(dbPath, { readOnly: true });
|
|
1335
|
+
const rows = db.prepare(
|
|
1336
|
+
"SELECT node_id, chat_message FROM message_nodes WHERE session_id = ? ORDER BY node_id"
|
|
1337
|
+
).all(sessionId);
|
|
1338
|
+
return parseDevinMessages(rows);
|
|
1339
|
+
} catch (error) {
|
|
1340
|
+
diag("devin-cli", "session_db_read_failed", { dbPath, error: String(error) });
|
|
1341
|
+
return [];
|
|
1342
|
+
} finally {
|
|
1343
|
+
try {
|
|
1344
|
+
db?.close();
|
|
1345
|
+
} catch {
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1327
1348
|
}
|
|
1328
1349
|
|
|
1329
1350
|
// src/harness/hook-lifecycle.ts
|
|
@@ -1173,9 +1173,9 @@ async function gitSyncNote(args) {
|
|
|
1173
1173
|
const deepened = [...gitIds].filter((id) => id.startsWith("git:")).length;
|
|
1174
1174
|
let target = DEEPEN_DIFF_TARGET;
|
|
1175
1175
|
try {
|
|
1176
|
-
const { execFileSync:
|
|
1176
|
+
const { execFileSync: execFileSync4 } = await import("child_process");
|
|
1177
1177
|
const n = Number(
|
|
1178
|
-
|
|
1178
|
+
execFileSync4("git", ["-C", cwd, "rev-list", "--count", "HEAD"], { encoding: "utf8" }).trim()
|
|
1179
1179
|
);
|
|
1180
1180
|
if (n > 0) target = Math.min(DEEPEN_DIFF_TARGET, n);
|
|
1181
1181
|
} catch {
|
|
@@ -1541,10 +1541,13 @@ function readGrokTranscript(path) {
|
|
|
1541
1541
|
}
|
|
1542
1542
|
|
|
1543
1543
|
// src/core/transcript-devin.ts
|
|
1544
|
-
import {
|
|
1544
|
+
import { existsSync as existsSync5 } from "fs";
|
|
1545
|
+
import { createRequire } from "module";
|
|
1545
1546
|
import { homedir as homedir6 } from "os";
|
|
1546
1547
|
import { join as join9 } from "path";
|
|
1547
|
-
|
|
1548
|
+
function devinSessionDb(home = homedir6()) {
|
|
1549
|
+
return join9(home, ".local", "share", "devin", "cli", "sessions.db");
|
|
1550
|
+
}
|
|
1548
1551
|
function parseDevinMessages(nodes) {
|
|
1549
1552
|
const messages = /* @__PURE__ */ new Map();
|
|
1550
1553
|
for (const node of nodes) {
|
|
@@ -1565,23 +1568,41 @@ function parseDevinMessages(nodes) {
|
|
|
1565
1568
|
}
|
|
1566
1569
|
return [...messages.values()].sort((a, b) => a.index - b.index).map(({ role, content }) => ({ role, content }));
|
|
1567
1570
|
}
|
|
1568
|
-
|
|
1569
|
-
|
|
1571
|
+
var requireBuiltin = createRequire(import.meta.url);
|
|
1572
|
+
function loadSqlite() {
|
|
1570
1573
|
try {
|
|
1571
|
-
|
|
1572
|
-
const raw = execFileSync4(
|
|
1573
|
-
"sqlite3",
|
|
1574
|
-
[
|
|
1575
|
-
"-json",
|
|
1576
|
-
sessionDb,
|
|
1577
|
-
`SELECT node_id, chat_message FROM message_nodes WHERE session_id = '${quotedId}' ORDER BY node_id`
|
|
1578
|
-
],
|
|
1579
|
-
{ encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 2e3 }
|
|
1580
|
-
);
|
|
1581
|
-
return parseDevinMessages(JSON.parse(raw));
|
|
1574
|
+
return requireBuiltin("node:sqlite").DatabaseSync;
|
|
1582
1575
|
} catch {
|
|
1576
|
+
return void 0;
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
function readDevinTranscript(sessionId, dbPath = devinSessionDb()) {
|
|
1580
|
+
if (!sessionId) return [];
|
|
1581
|
+
const Database = loadSqlite();
|
|
1582
|
+
if (!Database) {
|
|
1583
|
+
diag("devin-cli", "sqlite_unavailable", { node: process.version, dbPath });
|
|
1583
1584
|
return [];
|
|
1584
1585
|
}
|
|
1586
|
+
if (!existsSync5(dbPath)) {
|
|
1587
|
+
diag("devin-cli", "session_db_missing", { dbPath });
|
|
1588
|
+
return [];
|
|
1589
|
+
}
|
|
1590
|
+
let db;
|
|
1591
|
+
try {
|
|
1592
|
+
db = new Database(dbPath, { readOnly: true });
|
|
1593
|
+
const rows = db.prepare(
|
|
1594
|
+
"SELECT node_id, chat_message FROM message_nodes WHERE session_id = ? ORDER BY node_id"
|
|
1595
|
+
).all(sessionId);
|
|
1596
|
+
return parseDevinMessages(rows);
|
|
1597
|
+
} catch (error) {
|
|
1598
|
+
diag("devin-cli", "session_db_read_failed", { dbPath, error: String(error) });
|
|
1599
|
+
return [];
|
|
1600
|
+
} finally {
|
|
1601
|
+
try {
|
|
1602
|
+
db?.close();
|
|
1603
|
+
} catch {
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1585
1606
|
}
|
|
1586
1607
|
|
|
1587
1608
|
// src/harness/hook-lifecycle.ts
|
package/dist/devin-stop-hook.js
CHANGED
|
@@ -1180,10 +1180,13 @@ function readGrokTranscript(path) {
|
|
|
1180
1180
|
}
|
|
1181
1181
|
|
|
1182
1182
|
// src/core/transcript-devin.ts
|
|
1183
|
-
import {
|
|
1183
|
+
import { existsSync as existsSync5 } from "fs";
|
|
1184
|
+
import { createRequire } from "module";
|
|
1184
1185
|
import { homedir as homedir6 } from "os";
|
|
1185
1186
|
import { join as join9 } from "path";
|
|
1186
|
-
|
|
1187
|
+
function devinSessionDb(home = homedir6()) {
|
|
1188
|
+
return join9(home, ".local", "share", "devin", "cli", "sessions.db");
|
|
1189
|
+
}
|
|
1187
1190
|
function parseDevinMessages(nodes) {
|
|
1188
1191
|
const messages = /* @__PURE__ */ new Map();
|
|
1189
1192
|
for (const node of nodes) {
|
|
@@ -1204,22 +1207,40 @@ function parseDevinMessages(nodes) {
|
|
|
1204
1207
|
}
|
|
1205
1208
|
return [...messages.values()].sort((a, b) => a.index - b.index).map(({ role, content }) => ({ role, content }));
|
|
1206
1209
|
}
|
|
1207
|
-
|
|
1208
|
-
|
|
1210
|
+
var requireBuiltin = createRequire(import.meta.url);
|
|
1211
|
+
function loadSqlite() {
|
|
1209
1212
|
try {
|
|
1210
|
-
|
|
1211
|
-
const raw = execFileSync4(
|
|
1212
|
-
"sqlite3",
|
|
1213
|
-
[
|
|
1214
|
-
"-json",
|
|
1215
|
-
sessionDb,
|
|
1216
|
-
`SELECT node_id, chat_message FROM message_nodes WHERE session_id = '${quotedId}' ORDER BY node_id`
|
|
1217
|
-
],
|
|
1218
|
-
{ encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 2e3 }
|
|
1219
|
-
);
|
|
1220
|
-
return parseDevinMessages(JSON.parse(raw));
|
|
1213
|
+
return requireBuiltin("node:sqlite").DatabaseSync;
|
|
1221
1214
|
} catch {
|
|
1215
|
+
return void 0;
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
function readDevinTranscript(sessionId, dbPath = devinSessionDb()) {
|
|
1219
|
+
if (!sessionId) return [];
|
|
1220
|
+
const Database = loadSqlite();
|
|
1221
|
+
if (!Database) {
|
|
1222
|
+
diag("devin-cli", "sqlite_unavailable", { node: process.version, dbPath });
|
|
1223
|
+
return [];
|
|
1224
|
+
}
|
|
1225
|
+
if (!existsSync5(dbPath)) {
|
|
1226
|
+
diag("devin-cli", "session_db_missing", { dbPath });
|
|
1227
|
+
return [];
|
|
1228
|
+
}
|
|
1229
|
+
let db;
|
|
1230
|
+
try {
|
|
1231
|
+
db = new Database(dbPath, { readOnly: true });
|
|
1232
|
+
const rows = db.prepare(
|
|
1233
|
+
"SELECT node_id, chat_message FROM message_nodes WHERE session_id = ? ORDER BY node_id"
|
|
1234
|
+
).all(sessionId);
|
|
1235
|
+
return parseDevinMessages(rows);
|
|
1236
|
+
} catch (error) {
|
|
1237
|
+
diag("devin-cli", "session_db_read_failed", { dbPath, error: String(error) });
|
|
1222
1238
|
return [];
|
|
1239
|
+
} finally {
|
|
1240
|
+
try {
|
|
1241
|
+
db?.close();
|
|
1242
|
+
} catch {
|
|
1243
|
+
}
|
|
1223
1244
|
}
|
|
1224
1245
|
}
|
|
1225
1246
|
|
package/dist/grok-hook.js
CHANGED
|
@@ -1283,10 +1283,13 @@ function readGrokTranscript(path) {
|
|
|
1283
1283
|
}
|
|
1284
1284
|
|
|
1285
1285
|
// src/core/transcript-devin.ts
|
|
1286
|
-
import {
|
|
1286
|
+
import { existsSync as existsSync5 } from "fs";
|
|
1287
|
+
import { createRequire } from "module";
|
|
1287
1288
|
import { homedir as homedir6 } from "os";
|
|
1288
1289
|
import { join as join9 } from "path";
|
|
1289
|
-
|
|
1290
|
+
function devinSessionDb(home = homedir6()) {
|
|
1291
|
+
return join9(home, ".local", "share", "devin", "cli", "sessions.db");
|
|
1292
|
+
}
|
|
1290
1293
|
function parseDevinMessages(nodes) {
|
|
1291
1294
|
const messages = /* @__PURE__ */ new Map();
|
|
1292
1295
|
for (const node of nodes) {
|
|
@@ -1307,23 +1310,41 @@ function parseDevinMessages(nodes) {
|
|
|
1307
1310
|
}
|
|
1308
1311
|
return [...messages.values()].sort((a, b) => a.index - b.index).map(({ role, content }) => ({ role, content }));
|
|
1309
1312
|
}
|
|
1310
|
-
|
|
1311
|
-
|
|
1313
|
+
var requireBuiltin = createRequire(import.meta.url);
|
|
1314
|
+
function loadSqlite() {
|
|
1312
1315
|
try {
|
|
1313
|
-
|
|
1314
|
-
const raw = execFileSync4(
|
|
1315
|
-
"sqlite3",
|
|
1316
|
-
[
|
|
1317
|
-
"-json",
|
|
1318
|
-
sessionDb,
|
|
1319
|
-
`SELECT node_id, chat_message FROM message_nodes WHERE session_id = '${quotedId}' ORDER BY node_id`
|
|
1320
|
-
],
|
|
1321
|
-
{ encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 2e3 }
|
|
1322
|
-
);
|
|
1323
|
-
return parseDevinMessages(JSON.parse(raw));
|
|
1316
|
+
return requireBuiltin("node:sqlite").DatabaseSync;
|
|
1324
1317
|
} catch {
|
|
1318
|
+
return void 0;
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
function readDevinTranscript(sessionId, dbPath = devinSessionDb()) {
|
|
1322
|
+
if (!sessionId) return [];
|
|
1323
|
+
const Database = loadSqlite();
|
|
1324
|
+
if (!Database) {
|
|
1325
|
+
diag("devin-cli", "sqlite_unavailable", { node: process.version, dbPath });
|
|
1325
1326
|
return [];
|
|
1326
1327
|
}
|
|
1328
|
+
if (!existsSync5(dbPath)) {
|
|
1329
|
+
diag("devin-cli", "session_db_missing", { dbPath });
|
|
1330
|
+
return [];
|
|
1331
|
+
}
|
|
1332
|
+
let db;
|
|
1333
|
+
try {
|
|
1334
|
+
db = new Database(dbPath, { readOnly: true });
|
|
1335
|
+
const rows = db.prepare(
|
|
1336
|
+
"SELECT node_id, chat_message FROM message_nodes WHERE session_id = ? ORDER BY node_id"
|
|
1337
|
+
).all(sessionId);
|
|
1338
|
+
return parseDevinMessages(rows);
|
|
1339
|
+
} catch (error) {
|
|
1340
|
+
diag("devin-cli", "session_db_read_failed", { dbPath, error: String(error) });
|
|
1341
|
+
return [];
|
|
1342
|
+
} finally {
|
|
1343
|
+
try {
|
|
1344
|
+
db?.close();
|
|
1345
|
+
} catch {
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1327
1348
|
}
|
|
1328
1349
|
|
|
1329
1350
|
// src/harness/hook-lifecycle.ts
|
|
@@ -1173,9 +1173,9 @@ async function gitSyncNote(args) {
|
|
|
1173
1173
|
const deepened = [...gitIds].filter((id) => id.startsWith("git:")).length;
|
|
1174
1174
|
let target = DEEPEN_DIFF_TARGET;
|
|
1175
1175
|
try {
|
|
1176
|
-
const { execFileSync:
|
|
1176
|
+
const { execFileSync: execFileSync4 } = await import("child_process");
|
|
1177
1177
|
const n = Number(
|
|
1178
|
-
|
|
1178
|
+
execFileSync4("git", ["-C", cwd, "rev-list", "--count", "HEAD"], { encoding: "utf8" }).trim()
|
|
1179
1179
|
);
|
|
1180
1180
|
if (n > 0) target = Math.min(DEEPEN_DIFF_TARGET, n);
|
|
1181
1181
|
} catch {
|
|
@@ -1541,10 +1541,13 @@ function readGrokTranscript(path) {
|
|
|
1541
1541
|
}
|
|
1542
1542
|
|
|
1543
1543
|
// src/core/transcript-devin.ts
|
|
1544
|
-
import {
|
|
1544
|
+
import { existsSync as existsSync5 } from "fs";
|
|
1545
|
+
import { createRequire } from "module";
|
|
1545
1546
|
import { homedir as homedir6 } from "os";
|
|
1546
1547
|
import { join as join9 } from "path";
|
|
1547
|
-
|
|
1548
|
+
function devinSessionDb(home = homedir6()) {
|
|
1549
|
+
return join9(home, ".local", "share", "devin", "cli", "sessions.db");
|
|
1550
|
+
}
|
|
1548
1551
|
function parseDevinMessages(nodes) {
|
|
1549
1552
|
const messages = /* @__PURE__ */ new Map();
|
|
1550
1553
|
for (const node of nodes) {
|
|
@@ -1565,23 +1568,41 @@ function parseDevinMessages(nodes) {
|
|
|
1565
1568
|
}
|
|
1566
1569
|
return [...messages.values()].sort((a, b) => a.index - b.index).map(({ role, content }) => ({ role, content }));
|
|
1567
1570
|
}
|
|
1568
|
-
|
|
1569
|
-
|
|
1571
|
+
var requireBuiltin = createRequire(import.meta.url);
|
|
1572
|
+
function loadSqlite() {
|
|
1570
1573
|
try {
|
|
1571
|
-
|
|
1572
|
-
const raw = execFileSync4(
|
|
1573
|
-
"sqlite3",
|
|
1574
|
-
[
|
|
1575
|
-
"-json",
|
|
1576
|
-
sessionDb,
|
|
1577
|
-
`SELECT node_id, chat_message FROM message_nodes WHERE session_id = '${quotedId}' ORDER BY node_id`
|
|
1578
|
-
],
|
|
1579
|
-
{ encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 2e3 }
|
|
1580
|
-
);
|
|
1581
|
-
return parseDevinMessages(JSON.parse(raw));
|
|
1574
|
+
return requireBuiltin("node:sqlite").DatabaseSync;
|
|
1582
1575
|
} catch {
|
|
1576
|
+
return void 0;
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
function readDevinTranscript(sessionId, dbPath = devinSessionDb()) {
|
|
1580
|
+
if (!sessionId) return [];
|
|
1581
|
+
const Database = loadSqlite();
|
|
1582
|
+
if (!Database) {
|
|
1583
|
+
diag("devin-cli", "sqlite_unavailable", { node: process.version, dbPath });
|
|
1583
1584
|
return [];
|
|
1584
1585
|
}
|
|
1586
|
+
if (!existsSync5(dbPath)) {
|
|
1587
|
+
diag("devin-cli", "session_db_missing", { dbPath });
|
|
1588
|
+
return [];
|
|
1589
|
+
}
|
|
1590
|
+
let db;
|
|
1591
|
+
try {
|
|
1592
|
+
db = new Database(dbPath, { readOnly: true });
|
|
1593
|
+
const rows = db.prepare(
|
|
1594
|
+
"SELECT node_id, chat_message FROM message_nodes WHERE session_id = ? ORDER BY node_id"
|
|
1595
|
+
).all(sessionId);
|
|
1596
|
+
return parseDevinMessages(rows);
|
|
1597
|
+
} catch (error) {
|
|
1598
|
+
diag("devin-cli", "session_db_read_failed", { dbPath, error: String(error) });
|
|
1599
|
+
return [];
|
|
1600
|
+
} finally {
|
|
1601
|
+
try {
|
|
1602
|
+
db?.close();
|
|
1603
|
+
} catch {
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1585
1606
|
}
|
|
1586
1607
|
|
|
1587
1608
|
// src/harness/hook-lifecycle.ts
|
package/dist/grok-stop-hook.js
CHANGED
|
@@ -1180,10 +1180,13 @@ function readGrokTranscript(path) {
|
|
|
1180
1180
|
}
|
|
1181
1181
|
|
|
1182
1182
|
// src/core/transcript-devin.ts
|
|
1183
|
-
import {
|
|
1183
|
+
import { existsSync as existsSync5 } from "fs";
|
|
1184
|
+
import { createRequire } from "module";
|
|
1184
1185
|
import { homedir as homedir6 } from "os";
|
|
1185
1186
|
import { join as join9 } from "path";
|
|
1186
|
-
|
|
1187
|
+
function devinSessionDb(home = homedir6()) {
|
|
1188
|
+
return join9(home, ".local", "share", "devin", "cli", "sessions.db");
|
|
1189
|
+
}
|
|
1187
1190
|
function parseDevinMessages(nodes) {
|
|
1188
1191
|
const messages = /* @__PURE__ */ new Map();
|
|
1189
1192
|
for (const node of nodes) {
|
|
@@ -1204,22 +1207,40 @@ function parseDevinMessages(nodes) {
|
|
|
1204
1207
|
}
|
|
1205
1208
|
return [...messages.values()].sort((a, b) => a.index - b.index).map(({ role, content }) => ({ role, content }));
|
|
1206
1209
|
}
|
|
1207
|
-
|
|
1208
|
-
|
|
1210
|
+
var requireBuiltin = createRequire(import.meta.url);
|
|
1211
|
+
function loadSqlite() {
|
|
1209
1212
|
try {
|
|
1210
|
-
|
|
1211
|
-
const raw = execFileSync4(
|
|
1212
|
-
"sqlite3",
|
|
1213
|
-
[
|
|
1214
|
-
"-json",
|
|
1215
|
-
sessionDb,
|
|
1216
|
-
`SELECT node_id, chat_message FROM message_nodes WHERE session_id = '${quotedId}' ORDER BY node_id`
|
|
1217
|
-
],
|
|
1218
|
-
{ encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 2e3 }
|
|
1219
|
-
);
|
|
1220
|
-
return parseDevinMessages(JSON.parse(raw));
|
|
1213
|
+
return requireBuiltin("node:sqlite").DatabaseSync;
|
|
1221
1214
|
} catch {
|
|
1215
|
+
return void 0;
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
function readDevinTranscript(sessionId, dbPath = devinSessionDb()) {
|
|
1219
|
+
if (!sessionId) return [];
|
|
1220
|
+
const Database = loadSqlite();
|
|
1221
|
+
if (!Database) {
|
|
1222
|
+
diag("devin-cli", "sqlite_unavailable", { node: process.version, dbPath });
|
|
1223
|
+
return [];
|
|
1224
|
+
}
|
|
1225
|
+
if (!existsSync5(dbPath)) {
|
|
1226
|
+
diag("devin-cli", "session_db_missing", { dbPath });
|
|
1227
|
+
return [];
|
|
1228
|
+
}
|
|
1229
|
+
let db;
|
|
1230
|
+
try {
|
|
1231
|
+
db = new Database(dbPath, { readOnly: true });
|
|
1232
|
+
const rows = db.prepare(
|
|
1233
|
+
"SELECT node_id, chat_message FROM message_nodes WHERE session_id = ? ORDER BY node_id"
|
|
1234
|
+
).all(sessionId);
|
|
1235
|
+
return parseDevinMessages(rows);
|
|
1236
|
+
} catch (error) {
|
|
1237
|
+
diag("devin-cli", "session_db_read_failed", { dbPath, error: String(error) });
|
|
1222
1238
|
return [];
|
|
1239
|
+
} finally {
|
|
1240
|
+
try {
|
|
1241
|
+
db?.close();
|
|
1242
|
+
} catch {
|
|
1243
|
+
}
|
|
1223
1244
|
}
|
|
1224
1245
|
}
|
|
1225
1246
|
|