@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.cjs
CHANGED
|
@@ -5,7 +5,7 @@ var path8 = require('path');
|
|
|
5
5
|
var advanced = require('agent-inspect/advanced');
|
|
6
6
|
var workspace = require('agent-inspect/workspace');
|
|
7
7
|
var fs = require('fs');
|
|
8
|
-
var
|
|
8
|
+
var module$1 = require('module');
|
|
9
9
|
var crypto = require('crypto');
|
|
10
10
|
var http = require('http');
|
|
11
11
|
var checks = require('agent-inspect/checks');
|
|
@@ -13,10 +13,10 @@ var diff = require('agent-inspect/diff');
|
|
|
13
13
|
var persisted = require('agent-inspect/persisted');
|
|
14
14
|
var readers = require('agent-inspect/readers');
|
|
15
15
|
|
|
16
|
+
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
16
17
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
18
|
|
|
18
19
|
var path8__default = /*#__PURE__*/_interopDefault(path8);
|
|
19
|
-
var Database__default = /*#__PURE__*/_interopDefault(Database);
|
|
20
20
|
|
|
21
21
|
// packages/studio/src/registry.ts
|
|
22
22
|
function isSafeRelativePath(p) {
|
|
@@ -257,6 +257,22 @@ async function readStudioRegistryFile(filePath) {
|
|
|
257
257
|
function resolveRegistryProjectPath(registryDir, projectPath) {
|
|
258
258
|
return path8__default.default.isAbsolute(projectPath) ? path8__default.default.resolve(projectPath) : path8__default.default.resolve(registryDir, projectPath);
|
|
259
259
|
}
|
|
260
|
+
var cached;
|
|
261
|
+
function loadBetterSqlite3() {
|
|
262
|
+
if (cached !== void 0) return cached;
|
|
263
|
+
try {
|
|
264
|
+
const require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
265
|
+
cached = require2("better-sqlite3");
|
|
266
|
+
return cached;
|
|
267
|
+
} catch (error) {
|
|
268
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
269
|
+
throw new Error(
|
|
270
|
+
`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.`
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// packages/studio/src/db.ts
|
|
260
276
|
var STUDIO_DB_SCHEMA_VERSION = "1.0";
|
|
261
277
|
var DEFAULT_STUDIO_DB_FILENAME = "studio.db";
|
|
262
278
|
var SCHEMA_SQL = `
|
|
@@ -328,7 +344,8 @@ function openStudioDb(dbPath) {
|
|
|
328
344
|
const message = error instanceof Error ? error.message : String(error);
|
|
329
345
|
throw new Error(`Failed to create studio database directory: ${message}`);
|
|
330
346
|
}
|
|
331
|
-
const
|
|
347
|
+
const Sqlite = loadBetterSqlite3();
|
|
348
|
+
const db = new Sqlite(dbPath);
|
|
332
349
|
db.pragma("journal_mode = WAL");
|
|
333
350
|
db.exec(SCHEMA_SQL);
|
|
334
351
|
const insertMeta = db.prepare(
|
|
@@ -1126,8 +1143,8 @@ var studioIndexHtml = `<!DOCTYPE html>
|
|
|
1126
1143
|
</body>
|
|
1127
1144
|
</html>`;
|
|
1128
1145
|
function getImportedProject(db, projects, projectId) {
|
|
1129
|
-
const
|
|
1130
|
-
if (
|
|
1146
|
+
const cached2 = projects.find((item) => item.id === projectId);
|
|
1147
|
+
if (cached2) return { project: cached2 };
|
|
1131
1148
|
const row = getStudioProject(db, projectId);
|
|
1132
1149
|
if (!row) return void 0;
|
|
1133
1150
|
return {
|