src / configSchematics.ts
import * as path from "node:path";
import * as os from "node:os";
import { createConfigSchematics } from "@lmstudio/sdk";
const DEFAULT_ROOT = path.join(os.homedir(), "Documents", "LMStudio");
export const configSchematics = createConfigSchematics()
.field(
"useDefaultRoot",
"boolean",
{
displayName: `Enable default root (${DEFAULT_ROOT})`,
hint: `When ON, ${DEFAULT_ROOT} is always an allowed root (auto-created if missing). Turn OFF to restrict access to the paths listed below only.`,
},
true,
)
.field(
"allowedPaths",
"stringArray",
{
displayName: "Additional allowed root paths",
hint: "Extra absolute paths the model is allowed to read/write under (e.g. /Users/me/project, ~/Documents/notes). Tilde (~) is expanded to your home directory. These add to the default root above.",
},
[],
)
.field(
"maxFileSizeKb",
"numeric",
{
displayName: "Max file size (KB)",
hint: "Files larger than this are refused by read_file (avoids stuffing huge files into the model's context).",
slider: { min: 16, max: 4096, step: 16 },
int: true,
},
512,
)
.field(
"maxGrepResults",
"numeric",
{
displayName: "Max grep matches",
hint: "Grep stops after this many matching lines.",
slider: { min: 10, max: 1000, step: 10 },
int: true,
},
200,
)
.field(
"maxGrepFiles",
"numeric",
{
displayName: "Max grep files scanned",
hint: "Grep stops after scanning this many files (defends against giant trees).",
slider: { min: 100, max: 10000, step: 100 },
int: true,
},
2000,
)
.build();
src / configSchematics.ts
import * as path from "node:path";
import * as os from "node:os";
import { createConfigSchematics } from "@lmstudio/sdk";
const DEFAULT_ROOT = path.join(os.homedir(), "Documents", "LMStudio");
export const configSchematics = createConfigSchematics()
.field(
"useDefaultRoot",
"boolean",
{
displayName: `Enable default root (${DEFAULT_ROOT})`,
hint: `When ON, ${DEFAULT_ROOT} is always an allowed root (auto-created if missing). Turn OFF to restrict access to the paths listed below only.`,
},
true,
)
.field(
"allowedPaths",
"stringArray",
{
displayName: "Additional allowed root paths",
hint: "Extra absolute paths the model is allowed to read/write under (e.g. /Users/me/project, ~/Documents/notes). Tilde (~) is expanded to your home directory. These add to the default root above.",
},
[],
)
.field(
"maxFileSizeKb",
"numeric",
{
displayName: "Max file size (KB)",
hint: "Files larger than this are refused by read_file (avoids stuffing huge files into the model's context).",
slider: { min: 16, max: 4096, step: 16 },
int: true,
},
512,
)
.field(
"maxGrepResults",
"numeric",
{
displayName: "Max grep matches",
hint: "Grep stops after this many matching lines.",
slider: { min: 10, max: 1000, step: 10 },
int: true,
},
200,
)
.field(
"maxGrepFiles",
"numeric",
{
displayName: "Max grep files scanned",
hint: "Grep stops after scanning this many files (defends against giant trees).",
slider: { min: 100, max: 10000, step: 100 },
int: true,
},
2000,
)
.build();