@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/index.js
CHANGED
|
@@ -1790,19 +1790,51 @@ async function openConcrete(options) {
|
|
|
1790
1790
|
await options.onOpen?.(db);
|
|
1791
1791
|
return db;
|
|
1792
1792
|
}
|
|
1793
|
+
function adaptNodeSqlite(db) {
|
|
1794
|
+
const pragma = (statement, options) => {
|
|
1795
|
+
const stmt = db.prepare(`PRAGMA ${statement}`);
|
|
1796
|
+
const row = stmt.get();
|
|
1797
|
+
if (options?.simple === true) {
|
|
1798
|
+
return row === void 0 ? void 0 : Object.values(row)[0];
|
|
1799
|
+
}
|
|
1800
|
+
return row === void 0 ? [] : [row];
|
|
1801
|
+
};
|
|
1802
|
+
return new Proxy(db, {
|
|
1803
|
+
get(target, prop, receiver) {
|
|
1804
|
+
if (prop === "pragma") return pragma;
|
|
1805
|
+
if (prop === "loadExtension" && typeof db.loadExtension !== "function") {
|
|
1806
|
+
return () => {
|
|
1807
|
+
throw new Error(
|
|
1808
|
+
"SQLite extension loading is unavailable on the node:sqlite fallback \u2014 install better-sqlite3 for sqlite-vec"
|
|
1809
|
+
);
|
|
1810
|
+
};
|
|
1811
|
+
}
|
|
1812
|
+
const value = Reflect.get(target, prop, receiver);
|
|
1813
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
1814
|
+
}
|
|
1815
|
+
});
|
|
1816
|
+
}
|
|
1793
1817
|
async function loadDriver(filePath) {
|
|
1818
|
+
let betterSqliteCause;
|
|
1794
1819
|
try {
|
|
1795
|
-
const mod = await import('better-sqlite3');
|
|
1820
|
+
const mod = await (driverLoaderOverrides?.betterSqlite3?.() ?? import('better-sqlite3'));
|
|
1796
1821
|
const Ctor = mod.default ?? mod;
|
|
1797
1822
|
if (typeof Ctor !== "function") {
|
|
1798
1823
|
throw new Error(`better-sqlite3 export is not a constructor (got ${typeof Ctor})`);
|
|
1799
1824
|
}
|
|
1800
1825
|
return new Ctor(filePath);
|
|
1801
1826
|
} catch (cause) {
|
|
1802
|
-
|
|
1827
|
+
betterSqliteCause = cause;
|
|
1828
|
+
}
|
|
1829
|
+
try {
|
|
1830
|
+
const mod = await (driverLoaderOverrides?.nodeSqlite?.() ?? import('sqlite'));
|
|
1831
|
+
return adaptNodeSqlite(new mod.DatabaseSync(filePath));
|
|
1832
|
+
} catch (nodeSqliteCause) {
|
|
1833
|
+
const b = betterSqliteCause instanceof Error ? betterSqliteCause.message : String(betterSqliteCause);
|
|
1834
|
+
const n = nodeSqliteCause instanceof Error ? nodeSqliteCause.message : String(nodeSqliteCause);
|
|
1803
1835
|
throw new ConfigurationError(
|
|
1804
|
-
`Failed to load SQLite driver. Install \`better-sqlite3\` or run on Node 22.5+ for built-in \`node:sqlite\`.
|
|
1805
|
-
{ code: "sqlite_driver_unavailable", cause }
|
|
1836
|
+
`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}`,
|
|
1837
|
+
{ code: "sqlite_driver_unavailable", cause: nodeSqliteCause }
|
|
1806
1838
|
);
|
|
1807
1839
|
}
|
|
1808
1840
|
}
|
|
@@ -1821,6 +1853,7 @@ async function renameAside(filePath, label) {
|
|
|
1821
1853
|
`
|
|
1822
1854
|
);
|
|
1823
1855
|
}
|
|
1856
|
+
var driverLoaderOverrides;
|
|
1824
1857
|
var init_sqlite_open = __esm({
|
|
1825
1858
|
"src/internal/persistence/sqlite-open.ts"() {
|
|
1826
1859
|
init_errors();
|
|
@@ -18944,8 +18977,14 @@ var LocalAgentMemory = class {
|
|
|
18944
18977
|
return this.toolsCache;
|
|
18945
18978
|
} catch (cause) {
|
|
18946
18979
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
18947
|
-
|
|
18980
|
+
const g = globalThis;
|
|
18981
|
+
const sym = /* @__PURE__ */ Symbol.for("theokit-sdk.memory.warned");
|
|
18982
|
+
const warned3 = g[sym] ??= /* @__PURE__ */ new Set();
|
|
18983
|
+
if (!warned3.has(message)) {
|
|
18984
|
+
warned3.add(message);
|
|
18985
|
+
process.stderr.write(`[theokit-sdk] memory tools unavailable: ${message}
|
|
18948
18986
|
`);
|
|
18987
|
+
}
|
|
18949
18988
|
return void 0;
|
|
18950
18989
|
}
|
|
18951
18990
|
}
|