refactor(tool-fs): drop per-tool subpath plugins; adopt single-tsconfig build

Adapt the four fs packages to master's single-tsconfig build convention
(lib/types outDir + types path + files allowlist), brought in by the merge.

While doing so, drop dsh-tool-fs's /read//write//edit subpath plugins. They
were the only subpath-export package in the tree and forced bespoke tsdown,
tsconfig path, package.json files, and workspace-constraint handling that no
sibling tool package (e.g. dsh-tool-bash) carries, for a focused-deployment
use case no consumer needed. dsh-tool-fs is now a single root plugin that
registers read/write/edit, mirroring dsh-tool-bash; the per-tool registration
helpers stay internal modules the root composes. The file-context event-gate
RFC is amended to record the narrowed scope.
This commit is contained in:
Dudu-0223
2026-06-28 17:43:29 +08:00
parent 89b27ad442
commit 4a1177093a
16 changed files with 34 additions and 189 deletions

View File

@@ -10,7 +10,7 @@
* tool stats ZERO times either way; a missing target is reported by the provider
* as `FS_STALE_VERSION`.
*
* @module @deepseek-ai/dsh-tool-fs/edit
* @module @deepseek-ai/dsh-tool-fs/src/edit
*/
import type { Context } from 'cordis'
@@ -50,7 +50,7 @@ export function formatEditOutput(displayPath: string, outcome: FsEditOutcome): s
}
/** Register the `edit` tool and its system-prompt guidance. */
export function apply(ctx: Context): void {
export function applyEditTool(ctx: Context): void {
ctx.systemPrompt.section({
name: 'tool:edit',
order: 102,
@@ -84,12 +84,3 @@ export function apply(ctx: Context): void {
},
}))
}
/** Cordis plugin name used by loader diagnostics. */
export const name = 'fs-edit'
/** Services required by the `edit` tool plugin. */
export const inject = ['tools', 'fs', 'systemPrompt']
/** Named helper for direct registration in the root plugin and tests. */
export const applyEditTool = apply

View File

@@ -1,9 +1,6 @@
/**
* The model-facing filesystem tool suite (`read`, `write`, `edit`) over the
* `ctx.fs` provider seam. This root plugin registers all three tools by
* composing the per-tool registration helpers; each tool is also exposed as a
* subpath plugin (`@deepseek-ai/dsh-tool-fs/read`, `/write`, `/edit`) for focused
* deployments.
* `ctx.fs` provider seam. This single plugin registers all three tools.
*
* ## The tool is the executor; policy is an event gate
*

View File

@@ -8,7 +8,7 @@
* the model-facing schema, argument validation, read windowing, and result
* formatting; the freshness/observation policy is not its concern.
*
* @module @deepseek-ai/dsh-tool-fs/read
* @module @deepseek-ai/dsh-tool-fs/src/read
*/
import type { Context } from 'cordis'
@@ -72,7 +72,7 @@ ${body}
}
/** Register the `read` tool and its system-prompt guidance. */
export function apply(ctx: Context): void {
export function applyReadTool(ctx: Context): void {
ctx.systemPrompt.section({
name: 'tool:read',
order: 100,
@@ -119,12 +119,3 @@ export function apply(ctx: Context): void {
},
}))
}
/** Cordis plugin name used by loader diagnostics. */
export const name = 'fs-read'
/** Services required by the `read` tool plugin. */
export const inject = ['tools', 'fs', 'systemPrompt']
/** Named helper for direct registration in the root plugin and tests. */
export const applyReadTool = apply

View File

@@ -8,7 +8,7 @@
* returns `createIfAbsent`/`replaceIfVersion` instead. The tool stats ZERO
* times either way.
*
* @module @deepseek-ai/dsh-tool-fs/write
* @module @deepseek-ai/dsh-tool-fs/src/write
*/
import type { Context } from 'cordis'
@@ -36,7 +36,7 @@ ${verb} file
}
/** Register the `write` tool and its system-prompt guidance. */
export function apply(ctx: Context): void {
export function applyWriteTool(ctx: Context): void {
ctx.systemPrompt.section({
name: 'tool:write',
order: 101,
@@ -62,12 +62,3 @@ export function apply(ctx: Context): void {
},
}))
}
/** Cordis plugin name used by loader diagnostics. */
export const name = 'fs-write'
/** Services required by the `write` tool plugin. */
export const inject = ['tools', 'fs', 'systemPrompt']
/** Named helper for direct registration in the root plugin and tests. */
export const applyWriteTool = apply