@theokit/sdk 4.15.2 → 4.15.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/CHANGELOG.md +13 -0
- package/dist/cron.cjs +48 -5
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.js +48 -5
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +48 -5
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +48 -5
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +48 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +48 -5
- package/dist/index.js.map +1 -1
- package/dist/internal/persistence/index.cjs +41 -4
- package/dist/internal/persistence/index.cjs.map +1 -1
- package/dist/internal/persistence/index.js +41 -4
- package/dist/internal/persistence/index.js.map +1 -1
- package/dist/persistence.cjs +41 -4
- package/dist/persistence.cjs.map +1 -1
- package/dist/persistence.js +41 -4
- package/dist/persistence.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1790,19 +1790,55 @@ 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?.() ?? Promise.resolve(
|
|
1831
|
+
process.getBuiltinModule?.("node:sqlite") ?? (() => {
|
|
1832
|
+
throw new Error("node:sqlite built-in unavailable (Node < 22.3)");
|
|
1833
|
+
})()
|
|
1834
|
+
));
|
|
1835
|
+
return adaptNodeSqlite(new mod.DatabaseSync(filePath));
|
|
1836
|
+
} catch (nodeSqliteCause) {
|
|
1837
|
+
const b = betterSqliteCause instanceof Error ? betterSqliteCause.message : String(betterSqliteCause);
|
|
1838
|
+
const n = nodeSqliteCause instanceof Error ? nodeSqliteCause.message : String(nodeSqliteCause);
|
|
1803
1839
|
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 }
|
|
1840
|
+
`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}`,
|
|
1841
|
+
{ code: "sqlite_driver_unavailable", cause: nodeSqliteCause }
|
|
1806
1842
|
);
|
|
1807
1843
|
}
|
|
1808
1844
|
}
|
|
@@ -1821,6 +1857,7 @@ async function renameAside(filePath, label) {
|
|
|
1821
1857
|
`
|
|
1822
1858
|
);
|
|
1823
1859
|
}
|
|
1860
|
+
var driverLoaderOverrides;
|
|
1824
1861
|
var init_sqlite_open = __esm({
|
|
1825
1862
|
"src/internal/persistence/sqlite-open.ts"() {
|
|
1826
1863
|
init_errors();
|
|
@@ -18944,8 +18981,14 @@ var LocalAgentMemory = class {
|
|
|
18944
18981
|
return this.toolsCache;
|
|
18945
18982
|
} catch (cause) {
|
|
18946
18983
|
const message = cause instanceof Error ? cause.message : String(cause);
|
|
18947
|
-
|
|
18984
|
+
const g = globalThis;
|
|
18985
|
+
const sym = /* @__PURE__ */ Symbol.for("theokit-sdk.memory.warned");
|
|
18986
|
+
const warned3 = g[sym] ??= /* @__PURE__ */ new Set();
|
|
18987
|
+
if (!warned3.has(message)) {
|
|
18988
|
+
warned3.add(message);
|
|
18989
|
+
process.stderr.write(`[theokit-sdk] memory tools unavailable: ${message}
|
|
18948
18990
|
`);
|
|
18991
|
+
}
|
|
18949
18992
|
return void 0;
|
|
18950
18993
|
}
|
|
18951
18994
|
}
|