Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
[codex] migrate Effect.fn in apps/server/src/persistence/Layers/Sqlite.ts (#1631)
Julius Marminge9f6686a13d30
diff --git a/apps/server/src/persistence/Layers/Sqlite.ts b/apps/server/src/persistence/Layers/Sqlite.tsindex 2dddfc3bf..07cbf4479 100644--- a/apps/server/src/persistence/Layers/Sqlite.ts+++ b/apps/server/src/persistence/Layers/Sqlite.ts@@ -16,15 +16,14 @@ const defaultSqliteClientLoaders = {node: () => import("../NodeSqliteClient.ts"),} satisfies Record<string, () => Promise<Loader>>;-const makeRuntimeSqliteLayer = (+const makeRuntimeSqliteLayer = Effect.fn("makeRuntimeSqliteLayer")(function* (config: RuntimeSqliteLayerConfig,-): Layer.Layer<SqlClient.SqlClient> =>- Effect.gen(function* () {- const runtime = process.versions.bun !== undefined ? "bun" : "node";- const loader = defaultSqliteClientLoaders[runtime];- const clientModule = yield* Effect.promise<Loader>(loader);- return clientModule.layer(config);- }).pipe(Layer.unwrap);+) {+ const runtime = process.versions.bun !== undefined ? "bun" : "node";+ const loader = defaultSqliteClientLoaders[runtime];+ const clientModule = yield* Effect.promise<Loader>(loader);+ return clientModule.layer(config);+}, Layer.unwrap);const setup = Layer.effectDiscard(Effect.gen(function* () {@@ -35,14 +34,15 @@ const setup = Layer.effectDiscard(}),);-export const makeSqlitePersistenceLive = (dbPath: string) =>- Effect.gen(function* () {- const fs = yield* FileSystem.FileSystem;- const path = yield* Path.Path;- yield* fs.makeDirectory(path.dirname(dbPath), { recursive: true });+export const makeSqlitePersistenceLive = Effect.fn("makeSqlitePersistenceLive")(function* (+ dbPath: string,+) {+ const fs = yield* FileSystem.FileSystem;+ const path = yield* Path.Path;+ yield* fs.makeDirectory(path.dirname(dbPath), { recursive: true });- return Layer.provideMerge(setup, makeRuntimeSqliteLayer({ filename: dbPath }));- }).pipe(Layer.unwrap);+ return Layer.provideMerge(setup, makeRuntimeSqliteLayer({ filename: dbPath }));+}, Layer.unwrap);export const SqlitePersistenceMemory = Layer.provideMerge(setup,