@juspay/neurolink 12.1.0 → 12.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +3 -3
  2. package/dist/agent/agentToolRegistrar.d.ts +30 -0
  3. package/dist/agent/agentToolRegistrar.js +72 -18
  4. package/dist/agent/backgroundCommands.d.ts +110 -0
  5. package/dist/agent/backgroundCommands.js +914 -0
  6. package/dist/agent/backgroundDelegation.d.ts +87 -0
  7. package/dist/agent/backgroundDelegation.js +753 -0
  8. package/dist/agent/gitTools.d.ts +43 -0
  9. package/dist/agent/gitTools.js +618 -0
  10. package/dist/agent/taskChecklist.d.ts +58 -0
  11. package/dist/agent/taskChecklist.js +322 -0
  12. package/dist/artifacts/artifactBanking.d.ts +57 -0
  13. package/dist/artifacts/artifactBanking.js +123 -0
  14. package/dist/artifacts/artifactStore.d.ts +36 -8
  15. package/dist/artifacts/artifactStore.js +164 -13
  16. package/dist/browser/neurolink.min.js +442 -414
  17. package/dist/constants/enums.d.ts +7 -11
  18. package/dist/constants/enums.js +6 -10
  19. package/dist/factories/providerDescriptors.js +1 -1
  20. package/dist/neurolink.d.ts +294 -3
  21. package/dist/neurolink.js +447 -4
  22. package/dist/providers/openaiChatCompletionsClient.js +6 -1
  23. package/dist/providers/openaiCompatCatalog.js +4 -9
  24. package/dist/types/artifact.d.ts +54 -0
  25. package/dist/types/backgroundCommand.d.ts +174 -0
  26. package/dist/types/backgroundCommand.js +22 -0
  27. package/dist/types/delegation.d.ts +178 -0
  28. package/dist/types/delegation.js +18 -0
  29. package/dist/types/gitTools.d.ts +69 -0
  30. package/dist/types/gitTools.js +22 -0
  31. package/dist/types/index.d.ts +5 -0
  32. package/dist/types/index.js +8 -0
  33. package/dist/types/pathSandbox.d.ts +23 -0
  34. package/dist/types/pathSandbox.js +12 -0
  35. package/dist/types/tasks.d.ts +85 -0
  36. package/dist/types/tasks.js +14 -0
  37. package/dist/types/tools.d.ts +11 -0
  38. package/dist/utils/modelChoices.js +4 -9
  39. package/dist/utils/pathSandbox.d.ts +49 -0
  40. package/dist/utils/pathSandbox.js +127 -0
  41. package/package.json +5 -1
@@ -756,19 +756,15 @@ export declare enum GroqModels {
756
756
  * Cerebras inference models (wafer-scale, OpenAI-compatible API).
757
757
  * @see https://inference-docs.cerebras.ai/introduction
758
758
  *
759
- * Note the vendor's inconsistent id scheme: `llama3.1-8b` has no dash
760
- * after "llama", while `llama-3.3-70b` does both are the DOCUMENTED
761
- * ids, not typos.
759
+ * Roster verified against a live authenticated `/v1/models` on 2026-08-27:
760
+ * only these two ids are served. The llama/qwen models the vendor docs
761
+ * once listed are retired and now 404.
762
762
  */
763
763
  export declare enum CerebrasModels {
764
- /** Llama 3.3 70B — production default */
765
- LLAMA_3_3_70B = "llama-3.3-70b",
766
- /** Llama 3.1 8B low-latency tier (vendor id has no dash after "llama") */
767
- LLAMA_3_1_8B = "llama3.1-8b",
768
- /** Qwen 3 32B */
769
- QWEN_3_32B = "qwen-3-32b",
770
- /** OpenAI GPT-OSS 120B (open-weight) */
771
- GPT_OSS_120B = "gpt-oss-120b"
764
+ /** OpenAI GPT-OSS 120B (open-weight) — production default */
765
+ GPT_OSS_120B = "gpt-oss-120b",
766
+ /** Google Gemma 4 31B */
767
+ GEMMA_4_31B = "gemma-4-31b"
772
768
  }
773
769
  /**
774
770
  * Cohere Command + Embed models.
@@ -1009,20 +1009,16 @@ export var GroqModels;
1009
1009
  * Cerebras inference models (wafer-scale, OpenAI-compatible API).
1010
1010
  * @see https://inference-docs.cerebras.ai/introduction
1011
1011
  *
1012
- * Note the vendor's inconsistent id scheme: `llama3.1-8b` has no dash
1013
- * after "llama", while `llama-3.3-70b` does both are the DOCUMENTED
1014
- * ids, not typos.
1012
+ * Roster verified against a live authenticated `/v1/models` on 2026-08-27:
1013
+ * only these two ids are served. The llama/qwen models the vendor docs
1014
+ * once listed are retired and now 404.
1015
1015
  */
1016
1016
  export var CerebrasModels;
1017
1017
  (function (CerebrasModels) {
1018
- /** Llama 3.3 70B — production default */
1019
- CerebrasModels["LLAMA_3_3_70B"] = "llama-3.3-70b";
1020
- /** Llama 3.1 8B — low-latency tier (vendor id has no dash after "llama") */
1021
- CerebrasModels["LLAMA_3_1_8B"] = "llama3.1-8b";
1022
- /** Qwen 3 32B */
1023
- CerebrasModels["QWEN_3_32B"] = "qwen-3-32b";
1024
- /** OpenAI GPT-OSS 120B (open-weight) */
1018
+ /** OpenAI GPT-OSS 120B (open-weight) — production default */
1025
1019
  CerebrasModels["GPT_OSS_120B"] = "gpt-oss-120b";
1020
+ /** Google Gemma 4 31B */
1021
+ CerebrasModels["GEMMA_4_31B"] = "gemma-4-31b";
1026
1022
  })(CerebrasModels || (CerebrasModels = {}));
1027
1023
  /**
1028
1024
  * Cohere Command + Embed models.
@@ -377,7 +377,7 @@ export const PROVIDER_DESCRIPTORS = [
377
377
  baseURL: "CEREBRAS_BASE_URL",
378
378
  model: "CEREBRAS_MODEL",
379
379
  },
380
- defaultModel: CerebrasModels.LLAMA_3_3_70B,
380
+ defaultModel: CerebrasModels.GPT_OSS_120B,
381
381
  toolSupport: "native",
382
382
  localRuntime: false,
383
383
  healthCheck: "env-only",
@@ -6,7 +6,7 @@
6
6
  * Uses real MCP infrastructure for tool discovery and execution.
7
7
  */
8
8
  import type { AgentDefinition, AgentNetworkConfig, AgentRunOptions, AgentRunOutcome, AgentToolRegistrationOptions, IsolatedAgentDefinition, NetworkExecutionInput, NetworkExecutionOptions, NetworkExecutionResult, NetworkStreamChunk, WorkerInstanceOptions } from "./types/index.js";
9
- import type { CompactionConfig, CompactionResult, SpanData, ObservabilityConfig, MetricsSummary, MCPToolAnnotations, TraceView, AuthenticatedContext, AuthProvider, JsonObject, NeuroLinkEvents, TypedEventEmitter, MCPEnhancementsConfig, NeuroLinkAuthConfig, NeurolinkConstructorConfig, ChatMessage, ExternalMCPOperationResult, ExternalMCPServerInstance, ExternalMCPToolInfo, GenerateOptions, GenerateResult, ProviderStatus, TextGenerationOptions, TextGenerationResult, MCPExecutableTool, MCPServerInfo, MCPStatus, StreamOptions, StreamResult, ToolExecutionContext, ToolExecutionSummary, ToolInfo, ToolRegistrationOptions, BatchOperationResult, StreamGenerationEndContext, ToolRoutingServerDescriptor, ToolDedupConfig, ToolConfig, KnowledgeEngineStatus } from "./types/index.js";
9
+ import type { CompactionConfig, CompactionResult, ArtifactStore, SpanData, ObservabilityConfig, MetricsSummary, MCPToolAnnotations, TraceView, AuthenticatedContext, AuthProvider, JsonObject, NeuroLinkEvents, TypedEventEmitter, MCPEnhancementsConfig, NeuroLinkAuthConfig, NeurolinkConstructorConfig, ChatMessage, ExternalMCPOperationResult, ExternalMCPServerInstance, ExternalMCPToolInfo, GenerateOptions, GenerateResult, ProviderStatus, TextGenerationOptions, TextGenerationResult, MCPExecutableTool, MCPServerInfo, MCPStatus, StreamOptions, StreamResult, ToolExecutionContext, ToolExecutionSummary, ToolInfo, ToolRegistrationOptions, BatchOperationResult, StreamGenerationEndContext, ToolRoutingServerDescriptor, ToolDedupConfig, ToolConfig, KnowledgeEngineStatus, ChecklistState, ArtifactPageRequest, BankArtifactOptions, BankedArtifactRef, DelegateCollectRequest, DelegateCollectResult, DelegateHandle, DelegateRegistrationOptions, DelegateSpawnOptions, BackgroundCommandHandle, BackgroundCommandOptions, BackgroundCommandOutputPage, BackgroundCommandPageRequest, BackgroundCommandPolicy, BackgroundCommandStatus, GitToolResult, GitToolsetOptions } from "./types/index.js";
10
10
  import { ConversationMemoryManager } from "./core/conversationMemoryManager.js";
11
11
  import type { RedisConversationMemoryManager } from "./core/redisConversationMemoryManager.js";
12
12
  import { ExternalServerManager } from "./mcp/externalServerManager.js";
@@ -191,6 +191,28 @@ export declare class NeuroLink {
191
191
  * tool — gates the per-turn delegation scope in generate().
192
192
  */
193
193
  private hasAgentTools;
194
+ /**
195
+ * Tools registered with `cacheable: false` — their results are never served
196
+ * from the tool-result cache. A tool whose answer depends on live state (a
197
+ * checklist, a work queue) would otherwise replay its first answer for the
198
+ * whole TTL to every caller passing the same arguments.
199
+ */
200
+ private readonly uncacheableTools;
201
+ /** Set once registerTaskTools() has registered the checklist toolset. */
202
+ private hasTaskChecklistTools;
203
+ /** Set once registerDelegationTools() has registered the delegation toolset. */
204
+ private hasBackgroundDelegationTools;
205
+ /** Set once registerBackgroundCommandTools() has registered the command toolset. */
206
+ private hasBackgroundCommandTools;
207
+ /** Set once registerGitTools() has registered the read-only git toolset. */
208
+ private hasGitTools;
209
+ /**
210
+ * Set once `retrieve_context` has been registered. The constructor skips
211
+ * registration when neither Redis nor an artifact store exists; banking can
212
+ * create a store later, and this keeps that second attempt from
213
+ * re-registering the tool on instances that already have it.
214
+ */
215
+ private retrieveContextRegistered;
194
216
  /**
195
217
  * Creates a new NeuroLink instance for AI text generation with MCP tool integration.
196
218
  *
@@ -285,11 +307,14 @@ export declare class NeuroLink {
285
307
  */
286
308
  private registerFileTools;
287
309
  /**
288
- * Register task management tools bound to a TaskManager instance.
310
+ * Register SCHEDULER task tools bound to a TaskManager instance (task_create,
311
+ * task_list, … — scheduled/self-running jobs). Distinct from the agent task
312
+ * CHECKLIST (registerTaskTools() / tasks_create): different tools, different
313
+ * state, different purpose.
289
314
  * Follows the same factory + registry pattern as registerFileTools().
290
315
  * Called when TaskManager is created (eagerly or lazily via the `tasks` getter).
291
316
  */
292
- private registerTaskTools;
317
+ private registerSchedulerTaskTools;
293
318
  /**
294
319
  * Register memory retrieval tools that allow the AI to access
295
320
  * conversation history, including full tool outputs.
@@ -2530,6 +2555,272 @@ export declare class NeuroLink {
2530
2555
  registerAgentTool(definition: IsolatedAgentDefinition, options?: AgentToolRegistrationOptions): Promise<{
2531
2556
  name: string;
2532
2557
  }>;
2558
+ /**
2559
+ * Register the task CHECKLIST toolset — `tasks_create`, `tasks_update`,
2560
+ * `tasks_list` — on this instance (TodoWrite-style planning for a
2561
+ * long-running run). Opt-in and idempotent: existing callers see no new
2562
+ * tools until they ask for them.
2563
+ *
2564
+ * The checklist is session state, not conversation state: it lives outside
2565
+ * the message list, so summarization/compaction cannot lose it, and every
2566
+ * tool result returns the whole list so the model re-anchors for free after
2567
+ * a compaction. Read the same state from host code with
2568
+ * {@link getTaskState} — that is all a completeness gate needs.
2569
+ *
2570
+ * Sessions come from the tool execution context. Call
2571
+ * `setToolContext({ sessionId })` (or run the agent through
2572
+ * `runIsolatedAgent`, which stamps one) so the checklist has a stable
2573
+ * identity; a model tool call with no session anywhere falls back to a
2574
+ * single default checklist per instance rather than one per call. A DIRECT
2575
+ * `executeTool("tasks_create", …)` call should pass
2576
+ * `authContext: { sessionId }` — the tool registry otherwise mints a fresh
2577
+ * id for that one call.
2578
+ *
2579
+ * @see {@link getTaskState} for the host-side read
2580
+ */
2581
+ registerTaskTools(): void;
2582
+ /**
2583
+ * Read a session's task checklist — synchronous, so a completeness gate is
2584
+ * one line of host code:
2585
+ * `getTaskState(id).items.filter(i => i.status === "pending")`.
2586
+ *
2587
+ * Never throws: an unknown session simply has an empty checklist. Omit
2588
+ * `sessionId` to read the session the tools would currently write to (the
2589
+ * instance's tool-context session, or its default checklist).
2590
+ */
2591
+ getTaskState(sessionId?: string): ChecklistState;
2592
+ /**
2593
+ * Drop a session's checklist. Returns whether there was one to drop.
2594
+ * Omit `sessionId` to clear the session the tools currently write to.
2595
+ */
2596
+ clearTaskState(sessionId?: string): boolean;
2597
+ /**
2598
+ * Register the background-delegation toolset — `delegate_task` and
2599
+ * `collect_results` — on this instance. Opt-in and idempotent: existing
2600
+ * callers see no new tools until they ask for them.
2601
+ *
2602
+ * Delegation through {@link registerAgentTool} is synchronous — the loop
2603
+ * blocks on each worker. These tools make it asynchronous: `delegate_task`
2604
+ * returns a `workerId` at once and the agent keeps working, then
2605
+ * `collect_results` claims whichever worker finished FIRST. Concurrency is
2606
+ * bounded by the same process-wide pool `registerAgentTool` uses (raised,
2607
+ * never lowered, by `maxConcurrent`), each worker's FULL report is banked to
2608
+ * a file via {@link bankArtifact}, and the outstanding counts ride along in
2609
+ * every `tasks_list` result so the agent learns a worker landed without
2610
+ * polling.
2611
+ *
2612
+ * @param options - Depth ceiling, pool raise, and queue wait
2613
+ * @see {@link spawnDelegate} for the host-side spawn
2614
+ * @see {@link collectDelegates} for the host-side collect
2615
+ */
2616
+ registerDelegationTools(options?: DelegateRegistrationOptions): void;
2617
+ /**
2618
+ * Start a background worker and get its handle immediately — before it has
2619
+ * run anything, and long before it finishes.
2620
+ *
2621
+ * The worker runs through {@link runIsolatedAgent}: a fresh session on a
2622
+ * worker instance sharing THIS instance's tool registry (so live MCP
2623
+ * connections are reused), waste detection, honest stop reasons. Its
2624
+ * complete report is banked when it settles; the outcome you collect carries
2625
+ * a bounded summary plus the read-back call for the rest.
2626
+ *
2627
+ * @example
2628
+ * ```typescript
2629
+ * const a = await neurolink.spawnDelegate({ task: "Audit the auth changes" });
2630
+ * const b = await neurolink.spawnDelegate({ task: "Review the migrations" });
2631
+ * // …keep working…
2632
+ * const first = await neurolink.collectDelegates({ mode: "any" });
2633
+ * ```
2634
+ *
2635
+ * @param options - Task, scope, context, tool allowlist, budgets
2636
+ * @returns The worker id, spawn time, and whether it is queued for a slot
2637
+ * @throws when the task is empty or the caller is at the depth ceiling
2638
+ */
2639
+ spawnDelegate(options: DelegateSpawnOptions): Promise<DelegateHandle>;
2640
+ /**
2641
+ * Claim finished background workers — in COMPLETION order, which has nothing
2642
+ * to do with spawn order. Each outcome is handed out exactly once.
2643
+ *
2644
+ * @param request - `{ mode: "any" | "all" }` or `{ workerId }`, plus `waitMs`
2645
+ * @returns Claimed outcomes plus what is still pending/ready
2646
+ */
2647
+ collectDelegates(request: DelegateCollectRequest): Promise<DelegateCollectResult>;
2648
+ /**
2649
+ * Cancel background workers: one by id, or every outstanding worker this
2650
+ * instance spawned. Cancelled workers still settle into a claimable outcome
2651
+ * saying so.
2652
+ *
2653
+ * @param workerId - Cancel just this worker; omit to cancel all
2654
+ * @returns How many workers were cancelled
2655
+ */
2656
+ cancelDelegates(workerId?: string): Promise<number>;
2657
+ /**
2658
+ * This instance's artifact store, created on first use.
2659
+ *
2660
+ * Until now a store existed only when `mcp.outputLimits.strategy` was set to
2661
+ * `"externalize"`, so a caller that just wanted to bank a worker report had
2662
+ * to configure MCP output limits it did not use. This creates one on demand
2663
+ * and registers `retrieve_context` alongside it, so a banked payload is
2664
+ * readable by the model, not only by host code.
2665
+ *
2666
+ * Already-configured instances get the store they already had — the MCP
2667
+ * output normalizer and banking deliberately share one store, so an
2668
+ * externalized tool output and a banked report read back the same way.
2669
+ *
2670
+ * @returns The artifact store backing {@link bankArtifact} / {@link readArtifact}
2671
+ */
2672
+ getArtifactStore(): ArtifactStore;
2673
+ /**
2674
+ * Bank a payload to a file and get back a pointer to it.
2675
+ *
2676
+ * The payload is stored WHOLE. What you put in the conversation is the
2677
+ * returned `preview` (a bounded head slice) and `readBackHint` (the literal
2678
+ * `retrieve_context` call that fetches the rest) — so a 4 MB worker report
2679
+ * costs a few hundred tokens of context and loses nothing, and compaction
2680
+ * can drop the preview without destroying evidence.
2681
+ *
2682
+ * @example
2683
+ * ```typescript
2684
+ * const ref = await neurolink.bankArtifact(fullReport, {
2685
+ * kind: "worker-report",
2686
+ * label: "delegate:auth-review",
2687
+ * sessionId: "review-1421",
2688
+ * });
2689
+ * // Hand the model ref.preview + ref.readBackHint, never fullReport.
2690
+ * ```
2691
+ *
2692
+ * @param payload Complete text or JSON. Never truncated.
2693
+ * @param options `kind` and `label` are required; see {@link BankArtifactOptions}
2694
+ * @returns Id, bounded preview, byte size, and the read-back call
2695
+ */
2696
+ bankArtifact(payload: string, options: BankArtifactOptions): Promise<BankedArtifactRef>;
2697
+ /**
2698
+ * Read a banked payload back from host code — the programmatic twin of the
2699
+ * model's `retrieve_context({ artifactId })` call.
2700
+ *
2701
+ * Omit `page` for the complete payload; pass `{ offset, limit }` to walk a
2702
+ * large one in windows. Returns null when the id is unknown or expired.
2703
+ *
2704
+ * @param id `artifactId` from a {@link BankedArtifactRef}
2705
+ * @param page Optional character window
2706
+ */
2707
+ readArtifact(id: string, page?: ArtifactPageRequest): Promise<string | null>;
2708
+ /**
2709
+ * Register the background-command toolset — `run_command_bg`,
2710
+ * `command_status`, `command_output`, `command_kill` — on this instance, and
2711
+ * declare what may be executed. Opt-in and idempotent: existing callers see
2712
+ * no new tools until they ask for them.
2713
+ *
2714
+ * A reviewing agent needs to run real commands — a build, a test suite, a
2715
+ * linter whose output is the evidence for a finding — without blocking its
2716
+ * own loop and without losing a byte of what they printed. These tools start
2717
+ * a command detached, write both streams to files as they arrive, and bank
2718
+ * the COMPLETE files as artifacts when the command settles; the conversation
2719
+ * gets a bounded tail plus the read-back call.
2720
+ *
2721
+ * The policy is not optional. `allowedExecutables` is matched exactly
2722
+ * against `argv[0]`, `cwdRoot` is a realpath-checked sandbox, there is never
2723
+ * a shell, and a command that outlives `defaultTimeoutMs` is killed.
2724
+ *
2725
+ * @param policy - What may run, where, for how long, and how loudly
2726
+ * @see {@link startBackgroundCommand} for the host-side start
2727
+ * @see {@link registerGitTools} for read-only git without a general policy
2728
+ */
2729
+ registerBackgroundCommandTools(policy: BackgroundCommandPolicy): void;
2730
+ /**
2731
+ * Declare (or replace) what this instance may execute, without registering
2732
+ * the model-facing tools. Host code that only drives
2733
+ * {@link startBackgroundCommand} itself needs nothing more than this.
2734
+ *
2735
+ * @param policy - What may run, where, for how long, and how loudly
2736
+ */
2737
+ setBackgroundCommandPolicy(policy: BackgroundCommandPolicy): void;
2738
+ /**
2739
+ * Start a command in the background and get its task id immediately.
2740
+ *
2741
+ * @example
2742
+ * ```typescript
2743
+ * const { taskId } = await neurolink.startBackgroundCommand(
2744
+ * ["pnpm", "run", "lint"],
2745
+ * { cwd: repoRoot },
2746
+ * );
2747
+ * // …keep working…
2748
+ * const status = await neurolink.awaitBackgroundCommand(taskId);
2749
+ * const full = await neurolink.readArtifact(status.stdout!.artifactId);
2750
+ * ```
2751
+ *
2752
+ * @param argv - Executable first, one entry per argument. Never a command string.
2753
+ * @param options - cwd (sandboxed), timeout, byte cap, env, label, session
2754
+ * @returns The task id, the argv that ran, and when it started
2755
+ * @throws when no policy is set, argv is malformed, the executable is not
2756
+ * allowlisted, the policy vetoes it, or the cwd escapes the sandbox
2757
+ */
2758
+ startBackgroundCommand(argv: string[], options: BackgroundCommandOptions): Promise<BackgroundCommandHandle>;
2759
+ /**
2760
+ * Everything known about one command right now — synchronous, so a
2761
+ * mid-loop monitor costs nothing.
2762
+ *
2763
+ * @param taskId - Task id from {@link startBackgroundCommand}
2764
+ * @throws when the task id is unknown to this instance
2765
+ */
2766
+ getBackgroundCommandStatus(taskId: string): BackgroundCommandStatus;
2767
+ /**
2768
+ * Wait for a command to settle. `timeoutMs` bounds the WAIT, not the
2769
+ * command: when it elapses the current status is returned rather than
2770
+ * thrown, so a caller can poll in bounded steps and never lose the job.
2771
+ *
2772
+ * @param taskId - Task id from {@link startBackgroundCommand}
2773
+ * @param opts - `timeoutMs` to bound the wait
2774
+ */
2775
+ awaitBackgroundCommand(taskId: string, opts?: {
2776
+ timeoutMs?: number;
2777
+ }): Promise<BackgroundCommandStatus>;
2778
+ /**
2779
+ * Kill a running command — SIGTERM, then SIGKILL five seconds later — and
2780
+ * resolve with its settled status. Whatever it printed first is still
2781
+ * banked: killing a command discards the process, never its output.
2782
+ *
2783
+ * @param taskId - Task id from {@link startBackgroundCommand}
2784
+ * @param signal - Signal to send first. Default SIGTERM
2785
+ */
2786
+ killBackgroundCommand(taskId: string, signal?: NodeJS.Signals): Promise<BackgroundCommandStatus>;
2787
+ /**
2788
+ * Read one character window of a command's output straight from its log
2789
+ * file — while it is still running, or long after it finished. Offsets,
2790
+ * `totalSize` and `hasMore` match `retrieve_context` exactly.
2791
+ *
2792
+ * @param taskId - Task id from {@link startBackgroundCommand}
2793
+ * @param page - Which stream, and which window of it
2794
+ */
2795
+ readBackgroundCommandOutput(taskId: string, page: BackgroundCommandPageRequest): Promise<BackgroundCommandOutputPage>;
2796
+ /**
2797
+ * Register the read-only git toolset — `git_log`, `git_show`, `git_diff`,
2798
+ * `git_blame`, `git_merge_base`, `git_ls_files` — on this instance. Opt-in
2799
+ * and idempotent.
2800
+ *
2801
+ * These are BOUNDED tools, not a shell: the model supplies values (a ref, a
2802
+ * path, a line range), never flags, and each tool assembles a fixed argv
2803
+ * from them. That is what keeps them read-only — a free-form argument string
2804
+ * would carry `--output=<file>` and `diff.external` straight through.
2805
+ *
2806
+ * Registering them widens nothing else: they run under a private
2807
+ * one-executable policy rooted at `repoRoot`, so `run_command_bg` still
2808
+ * cannot execute git, and no general command policy is required.
2809
+ *
2810
+ * @param options - Repository root, plus timeout / byte-cap / preview bounds
2811
+ */
2812
+ registerGitTools(options: GitToolsetOptions): void;
2813
+ /**
2814
+ * Run one read-only git command from host code, with the same bounding the
2815
+ * tools get: the complete stdout is banked, the result carries a preview and
2816
+ * the read-back call.
2817
+ *
2818
+ * @param args - Git arguments, e.g. `["log", "--oneline"]`. Assembled by the
2819
+ * caller, which is responsible for every value in them
2820
+ * @param sessionId - Session the command belongs to
2821
+ * @throws when {@link registerGitTools} has not been called
2822
+ */
2823
+ runGitCommand(args: string[], sessionId?: string): Promise<GitToolResult>;
2533
2824
  /**
2534
2825
  * Execute an agent network with the given input.
2535
2826
  *