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

44 lines (43 loc) • 2.35 kB
/** * Read-only git toolset (N4.4) — six bounded tools on the hardened runner. * * A reviewing agent asks git the same handful of questions over and over: what * changed, against what base, who wrote this line, what files does the tree * hold. The tempting shape — "let it run `git ...` through the shell" — is * wrong twice. It hands the model a shell, and it hands git a free-form * argument string, which is not read-only at all: `--output=<file>` writes, * and `diff.external` runs an arbitrary program. * * So the model supplies VALUES, never flags. Each tool validates a ref, a * path, a line range or a count, assembles a fixed argv from them, and runs it * through {@link startCommandWithPolicy} with a policy of its own — a * one-executable allowlist rooted at the repository. Registering these tools * therefore widens nothing: it does not let `run_command_bg` execute git, and * it does not require a general command policy to exist. * * Output follows the same rule as every other big payload here: the COMPLETE * stdout is banked (N3) and the tool returns a bounded preview plus the * read-back call. A 40 MB diff costs a few hundred tokens and loses nothing. * * @module agent/gitTools */ import type { NeuroLink } from "../neurolink.js"; import type { GitToolResult, GitToolRuntimeSettings, GitToolsetOptions, MCPExecutableTool } from "../types/index.js"; /** Resolve and remember one host's git-toolset settings. */ export declare function configureGitTools(host: NeuroLink, options: GitToolsetOptions): GitToolRuntimeSettings; /** * Run one fixed argv against the repository and return a bounded result whose * full output is banked. * * Exported so host code can drive the same six questions without a model in * the loop; `args` is the git argument list (`["log", "--oneline"]`), assembled * by a caller that validated every value in it. */ export declare function runGitCommand(host: NeuroLink, args: string[], sessionId?: string): Promise<GitToolResult>; /** * The six read-only git tools, bound to `host`. Register them with * `host.registerTool()` (see `NeuroLink.registerGitTools()`), never on the * tool registry directly: only the "user-defined" category reaches the LLM's * tool schema. */ export declare function createGitTools(host: NeuroLink): Record<string, MCPExecutableTool>;