src / config.ts
import { createConfigSchematics } from "@lmstudio/sdk";
import { homedir } from "os";
import { join, isAbsolute, resolve } from "path";
export const DEFAULT_DATABASE_PATH = "~/.agents/brains/default.db";
export function expandHome(filePath: string): string {
if (filePath === "~" || filePath.startsWith("~/")) {
return join(homedir(), filePath.slice(1));
}
return filePath;
}
export function resolveDatabasePath(rawPath: string): string {
const expanded = expandHome(rawPath);
return isAbsolute(expanded) ? expanded : resolve(expanded);
}
export const configSchematics = createConfigSchematics()
.field(
"databasePath",
"string",
{
displayName: "Database Path",
subtitle:
"Path to the SQLite file for this brain, e.g. ~/.agents/brains/finance.db. Install this plugin once per brain, each pointed at a different file.",
},
DEFAULT_DATABASE_PATH,
)
.build();
src / config.ts
import { createConfigSchematics } from "@lmstudio/sdk";
import { homedir } from "os";
import { join, isAbsolute, resolve } from "path";
export const DEFAULT_DATABASE_PATH = "~/.agents/brains/default.db";
export function expandHome(filePath: string): string {
if (filePath === "~" || filePath.startsWith("~/")) {
return join(homedir(), filePath.slice(1));
}
return filePath;
}
export function resolveDatabasePath(rawPath: string): string {
const expanded = expandHome(rawPath);
return isAbsolute(expanded) ? expanded : resolve(expanded);
}
export const configSchematics = createConfigSchematics()
.field(
"databasePath",
"string",
{
displayName: "Database Path",
subtitle:
"Path to the SQLite file for this brain, e.g. ~/.agents/brains/finance.db. Install this plugin once per brain, each pointed at a different file.",
},
DEFAULT_DATABASE_PATH,
)
.build();