UNPKG

@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

60 lines (59 loc) • 3.46 kB
/** * Grok Build client configurator. * * Grok Build (`grok`, xAI's terminal agent) is a Codex-shaped TOML client * that speaks three wire formats. Built-in `grok-4.6` / `grok-4.5` stay on * xAI (`cli-chat-proxy.grok.com`, Responses API, 500k window). This writer * does not remap those. It adds the proxy's advertised catalog as extra * picker entries so Grok can send Claude traffic through `/v1/messages` * (passthrough) and Gemini/OpenAI traffic through `/v1/chat/completions` * (translation), each with a `context_window` that Grok's own compaction * will honour — the proxy does not truncate. * * Snapshot lives in `~/.neurolink/`, following Codex, never inside * `config.toml`. Grok's TOML parser is not a closed schema, but putting * bookkeeping keys in the user's file is how OpenCode was bricked, and new * writers do not rely on tolerance. * * Adaptive thinking: Grok's global `default_reasoning_effort = "xhigh"` * becomes Anthropic `thinking.type = "adaptive"`. Haiku 4.5 rejects that * with 400. Only Claude Opus/Sonnet 4.6 and 5.x keep reasoning enabled. * * Ownership is decided by content, never by the block markers alone. Grok * rewrites config.toml on its own saves (`/settings`, `grok mcp add`, ...) * through a serializer that drops every comment, the markers included, and * splits the inline `extra_headers` into a `[model.<id>.extra_headers]` * sub-table (measured on Grok Build 1.0.40). A marker-only writer then kept * the unmarked tables and appended a second copy of every id on the next * proxy start, and TOML rejects a table declared twice, so Grok would not * start. What marks an entry as ours is the placeholder key, a credential * only the proxy accepts, and that survives Grok's rewrite. */ import type { CliGrokProxyModelSpec, CliProxyClientApplyOptions, CliProxyClientConfigurator, ModelMapping } from "../../types/index.js"; declare function getGrokConfigDir(): string; declare function getGrokConfigPath(): string; declare function getGrokSnapshotPath(): string; declare function classifyGrokProxyModel(id: string, mapping?: ModelMapping): CliGrokProxyModelSpec; declare function loadRoutedModelIds(configPath?: string): Promise<string[]>; declare function catalogModelIds(configPath?: string): Promise<string[]>; /** * `userModelIds` are ids the user defines themselves. Writing the proxy's * entry beside theirs would declare the table twice, so theirs wins. */ declare function buildGrokManagedBlock(baseUrl: string, configPath?: string, userModelIds?: ReadonlySet<string>): Promise<string>; export declare function setGrokProxySettings(baseUrl: string, options?: CliProxyClientApplyOptions): Promise<boolean>; export declare function clearGrokProxySettings(expectedBaseUrl?: string): Promise<boolean>; export declare const grokConfigurator: CliProxyClientConfigurator; /** Test-only export (CLAUDE.md rule 15 determinism exception). See openCode.ts. */ export declare const __grokTestHooks: { getGrokConfigDir: typeof getGrokConfigDir; getGrokConfigPath: typeof getGrokConfigPath; getGrokSnapshotPath: typeof getGrokSnapshotPath; setGrokProxySettings: typeof setGrokProxySettings; clearGrokProxySettings: typeof clearGrokProxySettings; classifyGrokProxyModel: typeof classifyGrokProxyModel; loadRoutedModelIds: typeof loadRoutedModelIds; catalogModelIds: typeof catalogModelIds; buildGrokManagedBlock: typeof buildGrokManagedBlock; }; export {};