@juspay/neurolink 12.1.0 → 12.2.0
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.
- package/CHANGELOG.md +2 -2
- package/dist/agent/agentToolRegistrar.d.ts +30 -0
- package/dist/agent/agentToolRegistrar.js +72 -18
- package/dist/agent/backgroundCommands.d.ts +110 -0
- package/dist/agent/backgroundCommands.js +914 -0
- package/dist/agent/backgroundDelegation.d.ts +87 -0
- package/dist/agent/backgroundDelegation.js +753 -0
- package/dist/agent/gitTools.d.ts +43 -0
- package/dist/agent/gitTools.js +618 -0
- package/dist/agent/taskChecklist.d.ts +58 -0
- package/dist/agent/taskChecklist.js +322 -0
- package/dist/artifacts/artifactBanking.d.ts +57 -0
- package/dist/artifacts/artifactBanking.js +123 -0
- package/dist/artifacts/artifactStore.d.ts +36 -8
- package/dist/artifacts/artifactStore.js +164 -13
- package/dist/browser/neurolink.min.js +442 -414
- package/dist/neurolink.d.ts +294 -3
- package/dist/neurolink.js +447 -4
- package/dist/types/artifact.d.ts +54 -0
- package/dist/types/backgroundCommand.d.ts +174 -0
- package/dist/types/backgroundCommand.js +22 -0
- package/dist/types/delegation.d.ts +178 -0
- package/dist/types/delegation.js +18 -0
- package/dist/types/gitTools.d.ts +69 -0
- package/dist/types/gitTools.js +22 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.js +8 -0
- package/dist/types/pathSandbox.d.ts +23 -0
- package/dist/types/pathSandbox.js +12 -0
- package/dist/types/tasks.d.ts +85 -0
- package/dist/types/tasks.js +14 -0
- package/dist/types/tools.d.ts +11 -0
- package/dist/utils/pathSandbox.d.ts +49 -0
- package/dist/utils/pathSandbox.js +127 -0
- package/package.json +5 -1
package/dist/neurolink.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
*
|