feat(server): turn the LiteLLM proxy off by default (P1.1)

Every sidecar start outside the desktop app looked for Python, probed
each interpreter for litellm and, when it found one, started a LiteLLM
child. The community edition must not need Python, so LiteLLM is now
opt-in: startService starts it only when config.json contains
"litellm": { "enabled": true } (WaggleConfig.isLiteLLMEnabled). Otherwise
there is no Python lookup, no LiteLLM health probe and no child process,
and the built-in provider proxy serves every request, as it already did
in the desktop app. --skip-litellm and WAGGLE_SKIP_LITELLM=1 still force
it off.

The lookup for a bundled resources/python/python.exe is removed: no
build ships one. When LiteLLM is enabled it runs on the user's own
Python from PATH.
This commit is contained in:
shumeiko.it
2026-10-24 11:55:54 +02:00
parent c25efe6c44
commit cd1ba288bb
5 changed files with 115 additions and 51 deletions

View File

@@ -50,6 +50,13 @@ interface ConfigData {
threshold?: number;
topK?: number;
};
/**
* Optional LiteLLM proxy. Off unless `enabled` is true; it needs the user's
* own Python with litellm installed. The built-in provider proxy is the default.
*/
litellm?: {
enabled?: boolean;
};
}
/** Resolved MCP tool-retrieval config (all fields present). */
@@ -213,6 +220,12 @@ export class WaggleConfig {
this.data.cli = { ...(this.data.cli ?? {}), allowlist: next };
}
// --- LiteLLM proxy (opt-in) ---
isLiteLLMEnabled(): boolean {
return this.data.litellm?.enabled === true;
}
// --- Telemetry (M2-7) ---
getTelemetryEnabled(): boolean {

View File

@@ -120,6 +120,28 @@ describe('WaggleConfig', () => {
});
});
describe('LiteLLM opt-in', () => {
it('is off by default and when not explicitly enabled', () => {
const configDir = makeTempDir();
expect(new WaggleConfig(configDir).isLiteLLMEnabled()).toBe(false);
fs.writeFileSync(
path.join(configDir, 'config.json'),
JSON.stringify({ defaultModel: 'claude-sonnet-4-6', providers: {}, litellm: {} }),
);
expect(new WaggleConfig(configDir).isLiteLLMEnabled()).toBe(false);
});
it('is on when config.json sets litellm.enabled to true', () => {
const configDir = makeTempDir();
fs.writeFileSync(
path.join(configDir, 'config.json'),
JSON.stringify({ defaultModel: 'claude-sonnet-4-6', providers: {}, litellm: { enabled: true } }),
);
expect(new WaggleConfig(configDir).isLiteLLMEnabled()).toBe(true);
});
});
describe('governed CLI config', () => {
it('normalizes, deduplicates, and persists the CLI allowlist', () => {
const configDir = makeTempDir();