mirror of
https://github.com/MoonshotAI/kimi-code.git
synced 2026-07-10 01:39:25 +00:00
refactor(file-tools): relocate built-in file tools to node-local backend
- move Read/Write/Edit/Grep/Glob tools and line-endings helper from agent/fileTools to os/backends/node-local/tools - re-export tools from the node-local backend barrel - drop the fileTools domain barrel and its domain-layer entry - update test imports to the new paths
This commit is contained in:
parent
baf1dc304b
commit
3701cf13fa
21 changed files with 22 additions and 30 deletions
|
|
@ -147,7 +147,6 @@ const DOMAIN_LAYER = new Map([
|
|||
['microCompaction', 4],
|
||||
['loop', 4],
|
||||
['media', 4],
|
||||
['fileTools', 4],
|
||||
['shellTools', 4],
|
||||
['llmRequester', 4],
|
||||
['profile', 4],
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
/**
|
||||
* `fileTools` domain barrel — re-exports the built-in file tools (Read / Write
|
||||
* / Edit / Grep / Glob) and the shared line-ending helpers. Each tool
|
||||
* self-registers via `registerTool(...)` at module load, so importing this
|
||||
* barrel is what wires them into every Agent-scope tool registry.
|
||||
*/
|
||||
|
||||
export * from '#/agent/fileTools/tools/edit';
|
||||
export * from '#/agent/fileTools/tools/glob';
|
||||
export * from '#/agent/fileTools/tools/grep';
|
||||
export * from '#/agent/fileTools/tools/line-endings';
|
||||
export * from '#/agent/fileTools/tools/read';
|
||||
export * from '#/agent/fileTools/tools/write';
|
||||
|
|
@ -115,5 +115,4 @@ export type { ToolContribution, ToolContributionOptions } from '#/agent/toolRegi
|
|||
export * from '#/agent/toolState';
|
||||
export * from '#/agent/userTool';
|
||||
export * from '#/agent/wireRecord';
|
||||
export * from '#/agent/fileTools';
|
||||
export * from '#/agent/shellTools';
|
||||
|
|
|
|||
|
|
@ -2,3 +2,4 @@ export * from './hostEnvironmentService';
|
|||
export * from './hostFsService';
|
||||
export * from './hostProcessService';
|
||||
export * from './hostTerminalService';
|
||||
export * from './tools/index';
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import { literalRulePattern, matchesPathRuleSubject } from '#/_base/tools/suppor
|
|||
import type { WorkspaceConfig } from '#/_base/tools/support/workspace';
|
||||
import { renderPrompt } from '#/_base/utils/render-prompt';
|
||||
import { ISessionAgentFileSystem } from '#/session/agentFs';
|
||||
import { IHostEnvironment } from '#/app/hostEnvironment';
|
||||
import { IHostEnvironment } from '#/os/interface/hostEnvironment';
|
||||
import { ISessionWorkspaceContext } from '#/session/workspaceContext';
|
||||
import { ToolAccesses } from '#/agent/tool';
|
||||
import type { BuiltinTool, ExecutableToolResult, ToolExecution } from '#/agent/tool';
|
||||
|
|
@ -56,7 +56,7 @@ import {
|
|||
runRgOnce,
|
||||
shouldRetryRipgrepEagain,
|
||||
} from '#/session/agentFs/runRg';
|
||||
import { IHostEnvironment } from '#/app/hostEnvironment';
|
||||
import { IHostEnvironment } from '#/os/interface/hostEnvironment';
|
||||
import { ISessionWorkspaceContext } from '#/session/workspaceContext';
|
||||
import { ISessionProcessRunner } from '#/session/process';
|
||||
import { ITelemetryService } from '#/app/telemetry';
|
||||
|
|
@ -29,7 +29,7 @@ import { z } from 'zod';
|
|||
|
||||
import { ISessionFsService } from '#/session/agentFs';
|
||||
import { ErrorCodes, isKimiError } from '#/errors';
|
||||
import { IHostEnvironment } from '#/app/hostEnvironment';
|
||||
import { IHostEnvironment } from '#/os/interface/hostEnvironment';
|
||||
import { ISessionWorkspaceContext } from '#/session/workspaceContext';
|
||||
import { ToolAccesses } from '#/agent/tool';
|
||||
import type { BuiltinTool, ExecutableToolResult, ToolExecution } from '#/agent/tool';
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
export * from './edit';
|
||||
export * from './glob';
|
||||
export * from './grep';
|
||||
export * from './line-endings';
|
||||
export * from './read';
|
||||
export * from './write';
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
import { z } from 'zod';
|
||||
|
||||
import { ISessionAgentFileSystem } from '#/session/agentFs';
|
||||
import { IHostEnvironment } from '#/app/hostEnvironment';
|
||||
import { IHostEnvironment } from '#/os/interface/hostEnvironment';
|
||||
import { ISessionWorkspaceContext } from '#/session/workspaceContext';
|
||||
import { ToolAccesses } from '#/agent/tool';
|
||||
import type { BuiltinTool, ExecutableToolResult, ToolExecution } from '#/agent/tool';
|
||||
|
|
@ -21,7 +21,7 @@ import { z } from 'zod';
|
|||
|
||||
import { ISessionAgentFileSystem } from '#/session/agentFs';
|
||||
import type { AgentFileStat } from '#/session/agentFs';
|
||||
import { IHostEnvironment } from '#/app/hostEnvironment';
|
||||
import { IHostEnvironment } from '#/os/interface/hostEnvironment';
|
||||
import { ISessionWorkspaceContext } from '#/session/workspaceContext';
|
||||
import { ToolAccesses } from '#/agent/tool';
|
||||
import type { BuiltinTool, ExecutableToolResult, ToolExecution } from '#/agent/tool';
|
||||
|
|
@ -13,8 +13,8 @@ import { describe, expect, it, vi } from 'vitest';
|
|||
import { PathSecurityError } from '../../src/_base/tools/policies/path-access';
|
||||
import { stubWorkspaceContext } from './stub-workspace-context';
|
||||
import type { ISessionAgentFileSystem } from '#/session/agentFs';
|
||||
import { type EditInput, EditInputSchema, EditTool } from '#/agent/fileTools/tools/edit';
|
||||
import type { IHostEnvironment } from '#/app/hostEnvironment';
|
||||
import { type EditInput, EditInputSchema, EditTool } from '#/os/backends/node-local/tools/edit';
|
||||
import type { IHostEnvironment } from '#/os/interface/hostEnvironment';
|
||||
import type { ExecutableToolContext, ExecutableToolResult, ToolExecution } from '#/agent/tool';
|
||||
|
||||
const signal = new AbortController().signal;
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ import {
|
|||
GlobTool,
|
||||
MAX_MATCHES,
|
||||
splitCompletePaths,
|
||||
} from '#/agent/fileTools/tools/glob';
|
||||
import type { IHostEnvironment } from '#/app/hostEnvironment';
|
||||
} from '#/os/backends/node-local/tools/glob';
|
||||
import type { IHostEnvironment } from '#/os/interface/hostEnvironment';
|
||||
import { probeHostEnvironmentFromNode } from '#/_base/execEnv';
|
||||
import { createExecContext } from '#/session/execContext';
|
||||
import { SessionProcessRunner } from '#/session/process/processRunnerService';
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ import {
|
|||
type GrepInput,
|
||||
GrepInputSchema,
|
||||
GrepTool,
|
||||
} from '#/agent/fileTools/tools/grep';
|
||||
import type { IHostEnvironment } from '#/app/hostEnvironment';
|
||||
} from '#/os/backends/node-local/tools/grep';
|
||||
import type { IHostEnvironment } from '#/os/interface/hostEnvironment';
|
||||
import type { ExecutableToolContext, ExecutableToolResult, ToolExecution } from '#/agent/tool';
|
||||
|
||||
const signal = new AbortController().signal;
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ import {
|
|||
type ReadInput,
|
||||
ReadInputSchema,
|
||||
ReadTool,
|
||||
} from '#/agent/fileTools/tools/read';
|
||||
import type { IHostEnvironment } from '#/app/hostEnvironment';
|
||||
} from '#/os/backends/node-local/tools/read';
|
||||
import type { IHostEnvironment } from '#/os/interface/hostEnvironment';
|
||||
import type { ExecutableToolContext, ExecutableToolResult, ToolExecution } from '#/agent/tool';
|
||||
|
||||
const signal = new AbortController().signal;
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ import { describe, expect, it, vi } from 'vitest';
|
|||
import { PathSecurityError } from '../../src/_base/tools/policies/path-access';
|
||||
import type { AgentFileStat, ISessionAgentFileSystem } from '#/session/agentFs';
|
||||
import { stubWorkspaceContext } from './stub-workspace-context';
|
||||
import { type WriteInput, WriteInputSchema, WriteTool } from '#/agent/fileTools/tools/write';
|
||||
import type { IHostEnvironment } from '#/app/hostEnvironment';
|
||||
import { type WriteInput, WriteInputSchema, WriteTool } from '#/os/backends/node-local/tools/write';
|
||||
import type { IHostEnvironment } from '#/os/interface/hostEnvironment';
|
||||
import type { ExecutableToolContext, ExecutableToolResult, ToolExecution } from '#/agent/tool';
|
||||
|
||||
const signal = new AbortController().signal;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue