@theokit/sdk 4.15.2 → 4.15.3
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/CHANGELOG.md +7 -0
- package/dist/cron.cjs +44 -5
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.js +44 -5
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +44 -5
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +44 -5
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +44 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +44 -5
- package/dist/index.js.map +1 -1
- package/dist/internal/persistence/index.cjs +37 -4
- package/dist/internal/persistence/index.cjs.map +1 -1
- package/dist/internal/persistence/index.js +37 -4
- package/dist/internal/persistence/index.js.map +1 -1
- package/dist/persistence.cjs +37 -4
- package/dist/persistence.cjs.map +1 -1
- package/dist/persistence.js +37 -4
- package/dist/persistence.js.map +1 -1
- package/package.json +1 -1
package/dist/eval.js
CHANGED
|
@@ -16238,19 +16238,52 @@ async function openConcrete(options) {
|
|
|
16238
16238
|
await options.onOpen?.(db);
|
|
16239
16239
|
return db;
|
|
16240
16240
|
}
|
|
16241
|
+
var driverLoaderOverrides;
|
|
16242
|
+
function adaptNodeSqlite(db) {
|
|
16243
|
+
const pragma = (statement, options) => {
|
|
16244
|
+
const stmt = db.prepare(`PRAGMA ${statement}`);
|
|
16245
|
+
const row = stmt.get();
|
|
16246
|
+
if (options?.simple === true) {
|
|
16247
|
+
return row === void 0 ? void 0 : Object.values(row)[0];
|
|
16248
|
+
}
|
|
16249
|
+
return row === void 0 ? [] : [row];
|
|
16250
|
+
};
|
|
16251
|
+
return new Proxy(db, {
|
|
16252
|
+
get(target, prop, receiver) {
|
|
16253
|
+
if (prop === "pragma") return pragma;
|
|
16254
|
+
if (prop === "loadExtension" && typeof db.loadExtension !== "function") {
|
|
16255
|
+
return () => {
|
|
16256
|
+
throw new Error(
|
|
16257
|
+
"SQLite extension loading is unavailable on the node:sqlite fallback \u2014 install better-sqlite3 for sqlite-vec"
|
|
16258
|
+
);
|
|
16259
|
+
};
|
|
16260
|
+
}
|
|
16261
|
+
const value = Reflect.get(target, prop, receiver);
|
|
16262
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
16263
|
+
}
|
|
16264
|
+
});
|
|
16265
|
+
}
|
|
16241
16266
|
async function loadDriver(filePath) {
|
|
16267
|
+
let betterSqliteCause;
|
|
16242
16268
|
try {
|
|
16243
|
-
const mod = await import('better-sqlite3');
|
|
16269
|
+
const mod = await (driverLoaderOverrides?.betterSqlite3?.() ?? import('better-sqlite3'));
|
|
16244
16270
|
const Ctor = mod.default ?? mod;
|
|
16245
16271
|
if (typeof Ctor !== "function") {
|
|
16246
16272
|
throw new Error(`better-sqlite3 export is not a constructor (got ${typeof Ctor})`);
|
|
16247
16273
|
}
|
|
16248
16274
|
return new Ctor(filePath);
|
|
16249
16275
|
} catch (cause) {
|
|
16250
|
-
|
|
16276
|
+
betterSqliteCause = cause;
|
|
16277
|
+
}
|
|
16278
|
+
try {
|
|
16279
|
+
const mod = await (driverLoaderOverrides?.nodeSqlite?.() ?? import('sqlite'));
|
|
16280
|
+
return adaptNodeSqlite(new mod.DatabaseSync(filePath));
|
|
16281
|
+
} catch (nodeSqliteCause) {
|
|
16282
|
+
const b = betterSqliteCause instanceof Error ? betterSqliteCause.message : String(betterSqliteCause);
|
|
16283
|
+
const n = nodeSqliteCause instanceof Error ? nodeSqliteCause.message : String(nodeSqliteCause);
|
|
16251
16284
|
throw new ConfigurationError(
|
|
16252
|
-
`Failed to load SQLite driver. Install \`better-sqlite3\` or run on Node 22.5+ for built-in \`node:sqlite\`.
|
|
16253
|
-
{ code: "sqlite_driver_unavailable", cause }
|
|
16285
|
+
`Failed to load SQLite driver. Install \`better-sqlite3\` or run on Node 22.5+ for built-in \`node:sqlite\`. better-sqlite3: ${b}; node:sqlite: ${n}`,
|
|
16286
|
+
{ code: "sqlite_driver_unavailable", cause: nodeSqliteCause }
|
|
16254
16287
|
);
|
|
16255
16288
|
}
|
|
16256
16289
|
}
|
|
@@ -17287,8 +17320,14 @@ var LocalAgentMemory = class {
|
|
|
17287
17320
|
return this.toolsCache;
|
|
17288
17321
|
} catch (cause) {
|
|
17289
17322
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
17290
|
-
|
|
17323
|
+
const g = globalThis;
|
|
17324
|
+
const sym = /* @__PURE__ */ Symbol.for("theokit-sdk.memory.warned");
|
|
17325
|
+
const warned3 = g[sym] ??= /* @__PURE__ */ new Set();
|
|
17326
|
+
if (!warned3.has(message)) {
|
|
17327
|
+
warned3.add(message);
|
|
17328
|
+
process.stderr.write(`[theokit-sdk] memory tools unavailable: ${message}
|
|
17291
17329
|
`);
|
|
17330
|
+
}
|
|
17292
17331
|
return void 0;
|
|
17293
17332
|
}
|
|
17294
17333
|
}
|