Project Files
src / index.ts
import { type PluginContext } from "@lmstudio/sdk";
import { configSchematics } from "./config";
import { preprocess } from "./promptPreprocessor";
import { buildExcelQueryTool } from "./tools/excel/buildExcelQueryTool";
import { buildDocQueryTool } from "./tools/docs/buildDocQueryTool";
export async function main(context: PluginContext) {
context.withConfigSchematics(configSchematics);
// Preprocessor now only registers files + announces their existence via
// a short tag — no eager content injection, no consumeFiles, no history
// dependency. Both excel and doc data retrieval are fully tool-driven.
context.withPromptPreprocessor(preprocess);
// Both excel and doc querying are tools the main model decides whether
// to call — not forced every turn. Registered unconditionally; each
// tool's implementation looks up its own registry (keyed by working
// directory) to find files, independent of history/consumeFiles state.
context.withToolsProvider(async (ctl: any) => {
const excelTool = buildExcelQueryTool(ctl);
const docTool = buildDocQueryTool(ctl);
return [excelTool, docTool].filter(Boolean);
});
}