src / configSchematics.ts
import { createConfigSchematics } from "@lmstudio/sdk";
export const configSchematics = createConfigSchematics()
.field(
"alwaysRedact",
"stringArray",
{
displayName: "Always-redact terms",
hint: "Strings that should be redacted in every call (e.g. your name, your address, an employer name, project codenames). Each term is matched literally and replaced with [CUSTOM_N].",
},
[],
)
.field(
"piiServiceNodePath",
"string",
{
displayName: "Path to system `node` binary (for PII model service)",
hint: "When the ML PII layer is enabled, the plugin auto-spawns a small Node service that runs the model. It needs a SYSTEM node (not LM Studio's bundled node, which has strict library validation). Leave empty to auto-detect (Homebrew, nvm, /usr/bin). Set explicitly if auto-detect fails.",
},
"",
)
.field(
"detectInternationalPhones",
"boolean",
{
displayName: "Detect international phone numbers",
hint: "When enabled, also redact +CC… style international phone numbers (any country, not just France). Off by default — French-only detection is more precise.",
},
false,
)
.field(
"detectPiiWithModel",
"select",
{
displayName: "ML detection (names, dates, addresses)",
hint: "On = run an auxiliary multilingual XLM-RoBERTa NER model alongside the regex detectors. The model runs in a small auto-spawned local Node service (~1 GB download on first run, then cached). Requires a system `node` binary outside LM Studio's signed runtime — auto-detected from PATH/Homebrew/nvm. If detection fails, the tool returns the regex result with an explicit `ml_error` field.",
options: [
{ value: "off", displayName: "Off — regex + checksums only" },
{ value: "on", displayName: "On — regex + ML model" },
],
},
"off",
)
.field(
"modelDetectNames",
"boolean",
{
displayName: " · Names → [NOM_N]",
hint: "Detect GIVENNAME/SURNAME from the model. Complements names passed by the host LLM via the `names` argument.",
},
true,
)
.field(
"modelDetectAddresses",
"boolean",
{
displayName: " · Addresses → [ADDRESS_N]",
hint: "Detect STREET, CITY, STATE, COUNTRY, BUILDINGNUM, ZIPCODE from the model. Introduces a new ADDRESS pseudonym type.",
},
false,
)
.field(
"modelDetectDates",
"boolean",
{
displayName: " · Dates → [DATE_N]",
hint: "Detect DATE and TIME from the model. Introduces a new DATE pseudonym type. Risk of over-redaction (any date in the text gets caught).",
},
false,
)
.field(
"modelDetectIdDocs",
"boolean",
{
displayName: " · ID documents → [IDDOC_N]",
hint: "Detect PASSPORTNUM, DRIVERLICENSENUM, IDCARDNUM from the model. Introduces a new IDDOC pseudonym type.",
},
false,
)
.build();
src / configSchematics.ts
import { createConfigSchematics } from "@lmstudio/sdk";
export const configSchematics = createConfigSchematics()
.field(
"alwaysRedact",
"stringArray",
{
displayName: "Always-redact terms",
hint: "Strings that should be redacted in every call (e.g. your name, your address, an employer name, project codenames). Each term is matched literally and replaced with [CUSTOM_N].",
},
[],
)
.field(
"piiServiceNodePath",
"string",
{
displayName: "Path to system `node` binary (for PII model service)",
hint: "When the ML PII layer is enabled, the plugin auto-spawns a small Node service that runs the model. It needs a SYSTEM node (not LM Studio's bundled node, which has strict library validation). Leave empty to auto-detect (Homebrew, nvm, /usr/bin). Set explicitly if auto-detect fails.",
},
"",
)
.field(
"detectInternationalPhones",
"boolean",
{
displayName: "Detect international phone numbers",
hint: "When enabled, also redact +CC… style international phone numbers (any country, not just France). Off by default — French-only detection is more precise.",
},
false,
)
.field(
"detectPiiWithModel",
"select",
{
displayName: "ML detection (names, dates, addresses)",
hint: "On = run an auxiliary multilingual XLM-RoBERTa NER model alongside the regex detectors. The model runs in a small auto-spawned local Node service (~1 GB download on first run, then cached). Requires a system `node` binary outside LM Studio's signed runtime — auto-detected from PATH/Homebrew/nvm. If detection fails, the tool returns the regex result with an explicit `ml_error` field.",
options: [
{ value: "off", displayName: "Off — regex + checksums only" },
{ value: "on", displayName: "On — regex + ML model" },
],
},
"off",
)
.field(
"modelDetectNames",
"boolean",
{
displayName: " · Names → [NOM_N]",
hint: "Detect GIVENNAME/SURNAME from the model. Complements names passed by the host LLM via the `names` argument.",
},
true,
)
.field(
"modelDetectAddresses",
"boolean",
{
displayName: " · Addresses → [ADDRESS_N]",
hint: "Detect STREET, CITY, STATE, COUNTRY, BUILDINGNUM, ZIPCODE from the model. Introduces a new ADDRESS pseudonym type.",
},
false,
)
.field(
"modelDetectDates",
"boolean",
{
displayName: " · Dates → [DATE_N]",
hint: "Detect DATE and TIME from the model. Introduces a new DATE pseudonym type. Risk of over-redaction (any date in the text gets caught).",
},
false,
)
.field(
"modelDetectIdDocs",
"boolean",
{
displayName: " · ID documents → [IDDOC_N]",
hint: "Detect PASSPORTNUM, DRIVERLICENSENUM, IDCARDNUM from the model. Introduces a new IDDOC pseudonym type.",
},
false,
)
.build();