@juspay/neurolink
Version:
The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002
52 lines (51 loc) • 2.68 kB
TypeScript
/**
* Gemini CLI client configurator.
*
* Gemini CLI was reachable through the proxy long before this file existed —
* `GOOGLE_GEMINI_BASE_URL` pointed at the proxy's `/v1beta` door works — but
* nothing wrote it, so every user had to know that and export it by hand. The
* proxy already serves the door (`geminiProxyRoutes`, `POST
* /v1beta/models/{model}:generateContent`); this only closes the onboarding
* gap.
*
* **Why a file and not an env script.** Copilot is configured through
* `~/.neurolink/copilot-env.sh`, which the user must source from their shell
* profile. On the machine this was developed against, nothing sourced it: the
* writer reported success, `applyAllClients` counted it applied, and Copilot
* had never once used the proxy. A file the CLI reads on its own has no such
* silent-failure mode. Gemini CLI loads `~/.gemini/.env` (its own error text
* says "set it in your environment or ~/.gemini/.env"), so that is what this
* writes.
*
* The snapshot lives in `~/.neurolink/`, following `codex.ts`, never inside
* the file being managed — see `openCode.ts` for what that cost.
*/
import type { CliProxyClientConfigurator } from "../../types/index.js";
/** Gemini CLI's config directory. Fixed; it has no XDG override. */
declare function getGeminiConfigDir(): string;
declare function getGeminiEnvPath(): string;
declare function getGeminiSnapshotPath(): string;
/**
* Rewrite the two managed variables, preserving every other line verbatim.
*
* A whole-file rewrite would be simpler and wrong: `.env` is the user's file,
* it may hold unrelated keys for other tools, and comments and ordering are
* theirs to keep.
*/
declare function upsertEnvVars(original: string, vars: Record<string, string>): string;
/** Remove the managed variables, leaving the rest of the file untouched. */
declare function removeEnvVars(original: string, keys: string[]): string;
export declare function setGeminiProxySettings(baseUrl: string, proxyKey?: string): Promise<boolean>;
export declare function clearGeminiProxySettings(expectedBaseUrl?: string): Promise<boolean>;
/** Test-only export (CLAUDE.md rule 15 determinism exception). See openCode.ts. */
export declare const __geminiTestHooks: {
getGeminiConfigDir: typeof getGeminiConfigDir;
getGeminiEnvPath: typeof getGeminiEnvPath;
getGeminiSnapshotPath: typeof getGeminiSnapshotPath;
setGeminiProxySettings: typeof setGeminiProxySettings;
clearGeminiProxySettings: typeof clearGeminiProxySettings;
upsertEnvVars: typeof upsertEnvVars;
removeEnvVars: typeof removeEnvVars;
};
export declare const geminiConfigurator: CliProxyClientConfigurator;
export {};