@agent-inspect/studio 6.7.3 → 6.7.5
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.cjs +22 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +21 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import path8 from 'path';
|
|
|
3
3
|
import { loadSessionRunRecords, buildSessionIndex, runSuite, buildRunTimeline, extractOutcomesFromTraceEvents, resolveTraceDir, searchTraces, TraceDirectory, loadTraceMetadataList } from 'agent-inspect/advanced';
|
|
4
4
|
import { resolveWorkspaceLocation, readWorkspaceManifestFile } from 'agent-inspect/workspace';
|
|
5
5
|
import { mkdirSync } from 'fs';
|
|
6
|
-
import
|
|
6
|
+
import { createRequire } from 'module';
|
|
7
7
|
import { timingSafeEqual, createHash } from 'crypto';
|
|
8
8
|
import { createServer } from 'http';
|
|
9
9
|
import { runTraceChecks, createRunStatusRule } from 'agent-inspect/checks';
|
|
@@ -250,6 +250,22 @@ async function readStudioRegistryFile(filePath) {
|
|
|
250
250
|
function resolveRegistryProjectPath(registryDir, projectPath) {
|
|
251
251
|
return path8.isAbsolute(projectPath) ? path8.resolve(projectPath) : path8.resolve(registryDir, projectPath);
|
|
252
252
|
}
|
|
253
|
+
var cached;
|
|
254
|
+
function loadBetterSqlite3() {
|
|
255
|
+
if (cached !== void 0) return cached;
|
|
256
|
+
try {
|
|
257
|
+
const require2 = createRequire(import.meta.url);
|
|
258
|
+
cached = require2("better-sqlite3");
|
|
259
|
+
return cached;
|
|
260
|
+
} catch (error) {
|
|
261
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
262
|
+
throw new Error(
|
|
263
|
+
`better-sqlite3 native driver is unavailable (${detail}). Install a prebuild for your Node/OS (see better-sqlite3 docs) or use filesystem-only AgentInspect paths without Studio persistence. Core agent-inspect remains usable without this optional package.`
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// packages/studio/src/db.ts
|
|
253
269
|
var STUDIO_DB_SCHEMA_VERSION = "1.0";
|
|
254
270
|
var DEFAULT_STUDIO_DB_FILENAME = "studio.db";
|
|
255
271
|
var SCHEMA_SQL = `
|
|
@@ -321,7 +337,8 @@ function openStudioDb(dbPath) {
|
|
|
321
337
|
const message = error instanceof Error ? error.message : String(error);
|
|
322
338
|
throw new Error(`Failed to create studio database directory: ${message}`);
|
|
323
339
|
}
|
|
324
|
-
const
|
|
340
|
+
const Sqlite = loadBetterSqlite3();
|
|
341
|
+
const db = new Sqlite(dbPath);
|
|
325
342
|
db.pragma("journal_mode = WAL");
|
|
326
343
|
db.exec(SCHEMA_SQL);
|
|
327
344
|
const insertMeta = db.prepare(
|
|
@@ -1119,8 +1136,8 @@ var studioIndexHtml = `<!DOCTYPE html>
|
|
|
1119
1136
|
</body>
|
|
1120
1137
|
</html>`;
|
|
1121
1138
|
function getImportedProject(db, projects, projectId) {
|
|
1122
|
-
const
|
|
1123
|
-
if (
|
|
1139
|
+
const cached2 = projects.find((item) => item.id === projectId);
|
|
1140
|
+
if (cached2) return { project: cached2 };
|
|
1124
1141
|
const row = getStudioProject(db, projectId);
|
|
1125
1142
|
if (!row) return void 0;
|
|
1126
1143
|
return {
|