src / contextInjector.ts
/**
* Lightweight status injection + prediction counter.
* Keeps the main model aware of live plugin state without polluting every turn.
*/
import { getState, getStatusSummary } from "./stateRegistry";
/**
* Append the current plugin status block to a base prompt.
* Call this near the end of preprocessing so the status is fresh.
*/
export function injectPluginStatus(basePrompt: string): string {
const summary = getStatusSummary();
if (!summary) return basePrompt;
return `${basePrompt}\n\n${summary}`;
}
/**
* Call once at the start of every prediction cycle.
*/
export function onPredictionStart(): void {
getState().totalPredictions++;
}
/**
* Keep the enabled/disabled tool lists in sync with the toolsProvider.
*/
export function updateToolStatus(
enabledCategories: string[],
disabledCategories: string[],
): void {
const state = getState();
state.enabledTools = enabledCategories;
state.disabledTools = disabledCategories;
}
src / contextInjector.ts
/**
* Lightweight status injection + prediction counter.
* Keeps the main model aware of live plugin state without polluting every turn.
*/
import { getState, getStatusSummary } from "./stateRegistry";
/**
* Append the current plugin status block to a base prompt.
* Call this near the end of preprocessing so the status is fresh.
*/
export function injectPluginStatus(basePrompt: string): string {
const summary = getStatusSummary();
if (!summary) return basePrompt;
return `${basePrompt}\n\n${summary}`;
}
/**
* Call once at the start of every prediction cycle.
*/
export function onPredictionStart(): void {
getState().totalPredictions++;
}
/**
* Keep the enabled/disabled tool lists in sync with the toolsProvider.
*/
export function updateToolStatus(
enabledCategories: string[],
disabledCategories: string[],
): void {
const state = getState();
state.enabledTools = enabledCategories;
state.disabledTools = disabledCategories;
}