promptPreprocessor.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.promptPreprocessor = promptPreprocessor;
const peers_1 = require("./peers");
const SYSTEM_RULES = `\
[System: Document Parser Plugin]
⢠parse_document ā extract full text from PDF, DOCX, spreadsheet, or plain text files.
⢠search_document ā keyword/regex search inside a document with surrounding context lines.
⢠Output tool results directly; do not paraphrase or truncate document content unless asked.
⢠On tool_error, read the error field and correct the parameter before retrying.`;
async function promptPreprocessor(ctl, userMessage) {
const history = await ctl.pullHistory();
if (history.length !== 0)
return userMessage;
const ragTip = (0, peers_1.ragPeerStatus)() === false
? `\n\n[Tip: Install the "altra/rag" plugin to semantically index documents with embeddings. rag_ingest + rag_query enables meaning-based retrieval across all your documents ā search_document is keyword/regex only and requires re-reading the file each time.]`
: "";
return `${SYSTEM_RULES}${ragTip}\n\n${userMessage.getText()}`;
}