fix: drop tool-web subpath exports, align with tool-bash single-entry shape
The web tool package exposed ./search and ./fetch as standalone subpath
plugins, but nothing consumed them, the RFC never called for them, and the
sibling dsh-tool-bash (also a multi-tool consumer) ships a single entry and
selects tools via config. The extra entries also tripped the workspace
constraints gate, whose expected `files` list covers single-entry and bin
packages but not a non-bin multi-entry one.
Collapse to a single `.` entry: drop the ./search|./fetch exports and their
lib/*.js from package.json files, delete the per-package tsdown override (the
root config's lib/types/index.js entry now suffices), and remove the
plugin-shaped name/inject exports from search.ts/fetch.ts (renaming each
apply to its applyWeb{Search,Fetch}Tool helper, still composed by the root
plugin and re-exported from the index). Selective enablement stays via the
existing { search?, fetch? } config. Docs updated to match.
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
The model-facing web tool suite — `web_search` and `web_fetch` — over the [web capability seam](../web/README.md) (`ctx.web`). It owns model-facing concerns only: tool names, JSON schemas, snake_case argument names, prompt sections, the result-count bound, result formatting, HTML→markdown presentation, and `presentCall`. All web access goes through `ctx.web`; this package never imports a concrete provider.
|
The model-facing web tool suite — `web_search` and `web_fetch` — over the [web capability seam](../web/README.md) (`ctx.web`). It owns model-facing concerns only: tool names, JSON schemas, snake_case argument names, prompt sections, the result-count bound, result formatting, HTML→markdown presentation, and `presentCall`. All web access goes through `ctx.web`; this package never imports a concrete provider.
|
||||||
|
|
||||||
Each tool is also a subpath plugin (`@deepseek-ai/dsh-tool-web/search`, `/fetch`) for focused deployments.
|
Each tool is registered independently; a product that wants only one disables the other via config (`{ search: false }` / `{ fetch: false }`).
|
||||||
|
|
||||||
## Tools
|
## Tools
|
||||||
|
|
||||||
|
|||||||
@@ -11,21 +11,11 @@
|
|||||||
"types": "./lib/types/index.d.ts",
|
"types": "./lib/types/index.d.ts",
|
||||||
"default": "./lib/index.js"
|
"default": "./lib/index.js"
|
||||||
},
|
},
|
||||||
"./search": {
|
|
||||||
"types": "./lib/types/search.d.ts",
|
|
||||||
"default": "./lib/search.js"
|
|
||||||
},
|
|
||||||
"./fetch": {
|
|
||||||
"types": "./lib/types/fetch.d.ts",
|
|
||||||
"default": "./lib/fetch.js"
|
|
||||||
},
|
|
||||||
"./src/*": "./src/*",
|
"./src/*": "./src/*",
|
||||||
"./package.json": "./package.json"
|
"./package.json": "./package.json"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"lib/index.js",
|
"lib/index.js",
|
||||||
"lib/search.js",
|
|
||||||
"lib/fetch.js",
|
|
||||||
"lib/types/**/*.d.ts",
|
"lib/types/**/*.d.ts",
|
||||||
"lib/types/**/*.d.ts.map",
|
"lib/types/**/*.d.ts.map",
|
||||||
"src"
|
"src"
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Execution goes through `ctx.web` — this module owns the model-facing schema,
|
* Execution goes through `ctx.web` — this module owns the model-facing schema,
|
||||||
* argument validation, and PRESENTATION (HTML→markdown, truncation formatting),
|
* argument validation, and PRESENTATION (HTML→markdown, truncation formatting),
|
||||||
* while the fetch provider owns safe retrieval (transport, redirects, caps).
|
* while the fetch provider owns safe retrieval (transport, redirects, caps).
|
||||||
*
|
|
||||||
* @module @deepseek-ai/dsh-tool-web/fetch
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { Context } from 'cordis'
|
import type { Context } from 'cordis'
|
||||||
@@ -51,7 +49,7 @@ export function presentFetchCall(args: { url: string; timeout_ms?: number }): To
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Register the `web_fetch` tool and its system-prompt guidance. */
|
/** Register the `web_fetch` tool and its system-prompt guidance. */
|
||||||
export function apply(ctx: Context): void {
|
export function applyWebFetchTool(ctx: Context): void {
|
||||||
ctx.systemPrompt.section({
|
ctx.systemPrompt.section({
|
||||||
name: 'tool:web_fetch',
|
name: 'tool:web_fetch',
|
||||||
order: 111,
|
order: 111,
|
||||||
@@ -76,12 +74,3 @@ export function apply(ctx: Context): void {
|
|||||||
presentCall: presentFetchCall,
|
presentCall: presentFetchCall,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Cordis plugin name used by loader diagnostics. */
|
|
||||||
export const name = 'web-fetch'
|
|
||||||
|
|
||||||
/** Services required by the `web_fetch` tool plugin. */
|
|
||||||
export const inject = ['tools', 'web', 'systemPrompt']
|
|
||||||
|
|
||||||
/** Named helper for direct registration in the root plugin and tests. */
|
|
||||||
export const applyWebFetchTool = apply
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* The model-facing web tool suite (`web_search`, `web_fetch`) over the `ctx.web`
|
* The model-facing web tool suite (`web_search`, `web_fetch`) over the `ctx.web`
|
||||||
* seam. This root plugin registers the tools the product has ENABLED, composing
|
* seam. This root plugin registers the tools the product has ENABLED, composing
|
||||||
* the per-tool registration helpers; each tool is also exposed as a subpath
|
* the per-tool registration helpers (`applyWebSearchTool`, `applyWebFetchTool`).
|
||||||
* plugin (`@deepseek-ai/dsh-tool-web/search`, `/fetch`) for focused deployments.
|
|
||||||
*
|
*
|
||||||
* The package owns model-facing concerns only — tool names, JSON schemas,
|
* The package owns model-facing concerns only — tool names, JSON schemas,
|
||||||
* argument validation, prompt sections, result-cap constants, result formatting,
|
* argument validation, prompt sections, result-cap constants, result formatting,
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Execution goes through `ctx.web` — this module owns only the model-facing
|
* Execution goes through `ctx.web` — this module owns only the model-facing
|
||||||
* schema, argument validation, the result-count bound, and result formatting,
|
* schema, argument validation, the result-count bound, and result formatting,
|
||||||
* never provider selection or network access.
|
* never provider selection or network access.
|
||||||
*
|
|
||||||
* @module @deepseek-ai/dsh-tool-web/search
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { Context } from 'cordis'
|
import type { Context } from 'cordis'
|
||||||
@@ -70,7 +68,7 @@ export function presentSearchCall(args: { query: string }): ToolCallPresentation
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Register the `web_search` tool and its system-prompt guidance. */
|
/** Register the `web_search` tool and its system-prompt guidance. */
|
||||||
export function apply(ctx: Context): void {
|
export function applyWebSearchTool(ctx: Context): void {
|
||||||
ctx.systemPrompt.section({
|
ctx.systemPrompt.section({
|
||||||
name: 'tool:web_search',
|
name: 'tool:web_search',
|
||||||
order: 110,
|
order: 110,
|
||||||
@@ -94,12 +92,3 @@ export function apply(ctx: Context): void {
|
|||||||
presentCall: presentSearchCall,
|
presentCall: presentSearchCall,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Cordis plugin name used by loader diagnostics. */
|
|
||||||
export const name = 'web-search'
|
|
||||||
|
|
||||||
/** Services required by the `web_search` tool plugin. */
|
|
||||||
export const inject = ['tools', 'web', 'systemPrompt']
|
|
||||||
|
|
||||||
/** Named helper for direct registration in the root plugin and tests. */
|
|
||||||
export const applyWebSearchTool = apply
|
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
import { defineConfig } from 'tsdown'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* tool-web exposes one package root plus one entry per tool plugin, so each tool
|
|
||||||
* can be loaded or replaced independently as a subpath plugin
|
|
||||||
* (`@deepseek-ai/dsh-tool-web/search`, `/fetch`). The root tsdown builds only
|
|
||||||
* `lib/types/index.js`, so this override adds the subpath entries. Declarations
|
|
||||||
* come from `tsc -b` (dts: false), matching every package.
|
|
||||||
*/
|
|
||||||
export default defineConfig({
|
|
||||||
entry: ['lib/types/index.js', 'lib/types/search.js', 'lib/types/fetch.js'],
|
|
||||||
outDir: 'lib',
|
|
||||||
format: ['esm'],
|
|
||||||
platform: 'node',
|
|
||||||
target: 'es2024',
|
|
||||||
fixedExtension: false,
|
|
||||||
dts: false,
|
|
||||||
clean: false,
|
|
||||||
})
|
|
||||||
Reference in New Issue
Block a user