c926eb381d
- Changed default evaluation backend configuration to only enable Python and JavaScript by default. - Implemented dynamic tool parameter generation to hide Ruby and Julia from the model's schema when they are disabled in settings. - Updated tool summary and field descriptions to reflect the currently enabled runtime backends.
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { $flag } from "@oh-my-pi/pi-utils";
|
|
import type { ToolSession } from ".";
|
|
|
|
export interface EvalBackendsAllowance {
|
|
python: boolean;
|
|
js: boolean;
|
|
ruby: boolean;
|
|
julia: boolean;
|
|
}
|
|
|
|
/** Read per-backend allowance from settings (py/js default on; rb/jl opt-in, default off). */
|
|
export function readEvalBackendsAllowance(session: ToolSession): EvalBackendsAllowance {
|
|
return {
|
|
python: session.settings.get("eval.py") ?? true,
|
|
js: session.settings.get("eval.js") ?? true,
|
|
ruby: session.settings.get("eval.rb") ?? false,
|
|
julia: session.settings.get("eval.jl") ?? false,
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Materialize the active eval backend allowance: PI_PY / PI_JS / PI_RB / PI_JL
|
|
* env flags override the per-key settings; otherwise settings win (py/js default
|
|
* on, rb/jl default off).
|
|
*/
|
|
export function resolveEvalBackends(session: ToolSession): EvalBackendsAllowance {
|
|
const settings = readEvalBackendsAllowance(session);
|
|
return {
|
|
python: $flag("PI_PY", settings.python),
|
|
js: $flag("PI_JS", settings.js),
|
|
ruby: $flag("PI_RB", settings.ruby),
|
|
julia: $flag("PI_JL", settings.julia),
|
|
};
|
|
}
|