@deepseek-ai/dsh-tool-lsp 0.1.1-rc.2 → 0.1.2-alpha.2

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/README.i18n.yaml CHANGED
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # pnpm run verify-translation-pairing --write packages/lsp/tool-lsp/README.md
5
- README.md: e0fd5738cf114314a8483125d20142d5f1ffac40
6
- README.zh.md: 71d6a4b5479b2da187b78a388d617afe7214e78c
5
+ README.md: 528ae82aa5aad8286b8571a7b70e017b971717d6
6
+ README.zh.md: 0eaa50129708e39ec9011052f249e9f7badf4df4
package/README.md CHANGED
@@ -1,32 +1,107 @@
1
+ ---
2
+ description: "The model-facing lsp tool: four read-only code-navigation operations with one-based UTF-16 cursor coordinates, bounded results, and hover text, for users and maintainers composing model code navigation."
3
+ kind: "package-reference"
4
+ ---
5
+
1
6
  # @deepseek-ai/dsh-tool-lsp
2
7
 
3
8
  English | [中文](README.zh.md)
4
9
 
5
- The model-facing **`lsp` tool** over `ctx.lsp`: one read-only tool with four operations for precise code navigation. It owns the model schema, prompt guidance, coordinate conversion, result limits and formatting, and UI presentation; it imports no provider.
10
+ ## Summary
11
+
12
+ `dsh-tool-lsp` gives the model a single read-only `lsp` tool for precise code navigation over the LSP seam: go to a symbol's definition, find its references, jump to its implementations, or read hover documentation. The tool owns everything the model sees — name, schema, prompt guidance, result formatting, and UI presentation — and never depends on which language server backs a query. Positions are one-based UTF-16 cursor coordinates, which the tool converts to the seam's zero-based convention. Results are bounded location lists or normalized hover text with explicit no-result and truncation markers. Compose it with a provider such as `dsh-lsp-stdio` and the `dsh-lsp` seam to activate navigation.
13
+
14
+ ## Table of Contents
15
+
16
+ - [Use this package](#use-this-package)
17
+ - [Understand the implementation](#understand-the-implementation)
18
+ - [Further Exploration](#further-exploration)
19
+ - [Model Experience](#model-experience)
20
+ - [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
21
+ - [Dev Note](#dev-note)
6
22
 
7
- Namespace plugin (`name` / `inject` / `Config` / `apply`, no default export). Injects `tools`, `lsp`, and `systemPrompt`.
23
+ -----
8
24
 
9
- ## The tool
25
+ <a id="use-this-package"></a>
26
+ ## Use this package
10
27
 
11
- `lsp` accepts `operation` (`goToDefinition` | `findReferences` | `goToImplementation` | `hover`), `file_path`, `line`, and `character`. `line` and `character` are positive, one-based UTF-16 cursor coordinates; the tool converts them to the seam's zero-based positions and converts rendered locations back. `findReferences` includes declarations so impact analysis does not omit the defining site. Provider, language id, workspace root, limits, timeout, initialization, and executable stay outside model input.
28
+ An agent uses `lsp` when textual matches are ambiguous or before a change that needs precise definitions, implementations, or references; the tool's prompt guidance tells it to prefer `search`/`read` for ordinary navigation.
12
29
 
13
- The tool requires the workspace root from the session `header.cwd`, with no fallback: absence fails as `LSP_WORKSPACE_REQUIRED` before querying. Its canonical result is the complete normalized Service Definition union: `{ kind: "locations", locations, resolvedWorkspaceUri }` or `{ kind: "hover", hover }`; Code Mode can inspect every acquired location and zero-based range directly. Native rendering projects stable, file-grouped `path:line:character` entries against the provider's canonical workspace URI rather than applying host-platform path rules to the session cwd. A `file:` URI becomes a workspace-relative path inside that URI or a URI-derived absolute path outside it; malformed and non-`file:` URIs stay verbatim. Empty locations and `null` hover are successful no-result responses; malformed provider payloads remain structured errors.
30
+ ### The tool
14
31
 
15
- ## Configuration
32
+ `lsp` takes `operation` (`goToDefinition`, `findReferences`, `goToImplementation`, or `hover`), `file_path`, `line`, and `character`. `line` and `character` are positive one-based UTF-16 cursor coordinates; an off-symbol position may return no results. `findReferences` always includes the declaration, so impact analysis never misses the defining site. Provider choice, language id, workspace root, limits, timeout, and executable stay outside model input.
33
+
34
+ ### What the model gets back
35
+
36
+ Navigation returns `path:line:character` locations grouped by file (one-based); hover returns normalized text or a no-hover notice. Empty locations and no hover are successful no-result responses. Results are capped first by `maxLocations` and then by `maxResultChars`, with omission and truncation markers inside the complete cap; the caps affect only presentation, not the canonical result value.
37
+
38
+ ### Configuration
16
39
 
17
40
  | Key | Default | Meaning |
18
41
  |---|---|---|
19
- | `maxLocations` | `100` | Largest number of rendered locations before an omission marker. |
20
- | `maxResultChars` | `16000` | Largest complete rendered result, including truncation metadata. |
21
- | `timeoutMs` | `60000` | Tool-call timeout budget, enforced by `dsh-tool-call-timeout-policy`; covers the complete queued open/query/close lifecycle and is not model-configurable. |
42
+ | `maxLocations` | `100` | Largest number of rendered locations before an omission marker |
43
+ | `maxResultChars` | `16000` | Largest complete rendered result, including truncation metadata |
44
+ | `timeoutMs` | `60000` | Tool-call timeout budget enforced by `dsh-tool-call-timeout-policy`; covers the complete queued open/query/close lifecycle and is not model-configurable |
45
+
46
+ The generated [configuration catalog](../../../docs/config-catalog.md#deepseek-aidsh-tool-lsp) is the exhaustive source for every accepted field.
47
+
48
+ ### Failures and recovery
49
+
50
+ The tool requires a session workspace root (`header.cwd`) with no fallback; absence fails with `LSP_WORKSPACE_REQUIRED` before any query. When no provider handles the file's extension, the query fails with `LSP_UNAVAILABLE`; malformed provider payloads remain structured `LSP_MALFORMED_RESPONSE` errors. These surface to the model as error tool results it can read and route on.
51
+
52
+ -----
53
+
54
+ <a id="understand-the-implementation"></a>
55
+ ## Understand the implementation
56
+
57
+ <details>
58
+ <summary>Implementation internals — click to expand</summary>
59
+
60
+ This section explains the design decisions behind the tool and where the code realizes them; observable behavior is covered in [Use this package](#use-this-package).
61
+
62
+ ### Design notes
63
+
64
+ - **Consumer-only.** The tool runtime-injects only `tools`, `lsp`, and `systemPrompt`, imports no provider, and passes only `exec.signal` to the seam.
65
+ - **Coordinate conversion.** `parseLspArgs` validates that `line` and `character` are positive integers and converts them to the seam's zero-based positions; rendered locations convert back to one-based form.
66
+ - **Canonical result passthrough.** The tool returns the seam's closed union (`{ kind: 'locations', locations, resolvedWorkspaceUri }` or `{ kind: 'hover', hover }`) so native renderers can inspect every acquired location and zero-based range directly.
67
+ - **Execution-world URI rendering.** `renderUri` resolves a `file:` URI against the provider's canonical workspace URI — workspace-relative inside it, URI-derived absolute outside it, verbatim when malformed or not `file:` — never applying host-platform path rules to the session cwd.
68
+ - **Caps after rendering.** `maxLocations` bounds the item count first, then `maxResultChars` bounds the complete rendered text including its omission or truncation marker.
69
+ - **Generic search-card presentation.** `presentLspCall` renders a `{ card: 'generic', kind: 'search', title, locations: [{ path, line }] }` view; the args-derived title carries the operation and one-based cursor, and follow-along focuses the queried line while the title preserves the column.
22
70
 
71
+ ### Source map
72
+
73
+ | File | Role |
74
+ |---|---|
75
+ | [`src/index.ts`](src/index.ts) | Plugin entry: config schema, tool registration, system-prompt section, execution |
76
+ | [`src/render.ts`](src/render.ts) | Pure formatting, coordinate conversion, URI resolution, result caps, UI presentation |
77
+ | [`src/session-cwd.ts`](src/session-cwd.ts) | Workspace root from the session `header.cwd` |
78
+ | [`src/invariant.ts`](src/invariant.ts) | Invariant companion (no runtime invariant; stateless adapter) |
79
+
80
+ </details>
81
+
82
+ -----
83
+
84
+ <a id="further-exploration"></a>
85
+ ## Further Exploration
86
+
87
+ Read these pages when the package-level contract is not enough. They move from the model-facing surface to the seam, the provider, and the decision evidence.
88
+
89
+ - [LSP navigation subsystem](../../../docs/subsystems/lsp.md) — operations, coordinates, requests and results, and `LspError` codes.
90
+ - [LSP capability seam Agent Note](../../../.agents/notes/implemented/architecture/2026-07-15-lsp-capability-seam.md) — design rationale, alternatives, and deliberately deferred API.
91
+ - [dsh-lsp](../lsp/README.md) — the seam this tool queries.
92
+ - [dsh-lsp-stdio](../lsp-stdio/README.md) — the stdio provider that answers these queries.
93
+ - [lsp group map](../README.md) — the three-package family and its related documentation.
94
+
95
+ -----
96
+
97
+ <a id="model-experience"></a>
23
98
  ## Model Experience
24
99
 
25
100
  ### System prompt
26
101
 
27
102
  #### What the model sees
28
103
 
29
- One system-prompt section (order 112) positions LSP as a precision aid with the following text:
104
+ One system-prompt section (first-party order 2200) positions LSP as a precision aid with the following text:
30
105
 
31
106
  ##### Verbatim guidance
32
107
 
@@ -86,5 +161,20 @@ None; UI presentation is outside the model request.
86
161
 
87
162
  ## Known Limitations and Deferred Work
88
163
 
164
+ <a id="known-limitations-and-deferred-work"></a>
165
+
166
+
167
+ These limits define when the tool is a poor fit. They are current package constraints, not a task backlog.
168
+
89
169
  - **UTF-16 cursor coordinates** — columns are exact for the protocol but hard for a model to count around non-BMP characters; an off-symbol position may return empty results, so the prompt explains the convention without encouraging broad LSP use ([seam Agent Note](../../../.agents/notes/implemented/architecture/2026-07-15-lsp-capability-seam.md)).
90
170
  - **No cross-server completeness promise** — supported servers may return empty or partial results depending on indexing readiness; the tool promises no completeness across languages or servers.
171
+
172
+ <a id="dev-note"></a>
173
+ ### Dev Note
174
+
175
+ <details>
176
+ <summary>Working context for maintainers — click to expand</summary>
177
+
178
+ None.
179
+
180
+ </details>
package/README.zh.md CHANGED
@@ -1,32 +1,107 @@
1
+ ---
2
+ description: "面向模型的 lsp 工具:四种只读代码导航操作、从 1 开始的 UTF-16 光标坐标、有边界的结果与悬停文本,供组合模型代码导航的用户与维护者阅读。"
3
+ kind: "package-reference"
4
+ ---
5
+
1
6
  # @deepseek-ai/dsh-tool-lsp
2
7
 
3
8
  [English](README.md) | 中文
4
9
 
5
- 面向模型的 **`lsp` 工具**,基于 `ctx.lsp`:一个只读工具,通过四种操作执行精确代码导航。它拥有模型 schema、提示词指引、坐标转换、结果限制与格式化,以及 UI 呈现;不导入任何提供方。
10
+ ## 概述
11
+
12
+ `dsh-tool-lsp` 通过 LSP seam 为模型提供单一的只读 `lsp` 工具,用于精确代码导航:转到符号的定义、查找其引用、跳转到其实现,或阅读悬停文档。该工具拥有模型看到的一切——名称、schema、提示词指引、结果格式化与 UI 呈现——并且绝不依赖哪个语言服务器应答查询。位置是从 1 开始的 UTF-16 光标坐标,工具会将其转换为 seam 从零开始的约定。结果是有边界的位置列表或规范化悬停文本,带有明确的空结果与截断标记。与 `dsh-lsp-stdio` 之类的提供方及 `dsh-lsp` seam 组合,即可启用导航。
13
+
14
+ ## 目录
15
+
16
+ - [使用本包](#use-this-package)
17
+ - [理解实现](#understand-the-implementation)
18
+ - [进一步探索](#further-exploration)
19
+ - [模型体验](#model-experience)
20
+ - [已知限制与延期工作](#known-limitations-and-deferred-work)
21
+ - [开发备注](#dev-note)
6
22
 
7
- Namespace 插件(`name`/`inject`/`Config`/`apply`,无默认导出)。注入 `tools`、`lsp` 和 `systemPrompt`。
23
+ -----
8
24
 
9
- ## 工具
25
+ <a id="use-this-package"></a>
26
+ ## 使用本包
10
27
 
11
- `lsp` 接受 `operation`(`goToDefinition` | `findReferences` | `goToImplementation` | `hover`)、`file_path`、`line` 和 `character`。`line` 与 `character` 是正的、从 1 开始的 UTF-16 光标坐标;工具将其转换为 seam 从零开始的位置,并把渲染位置转换回来。`findReferences` 包含声明,因此影响分析不会遗漏定义位置。提供方、language id、工作区根目录、限制、超时、初始化和可执行文件均不进入模型输入。
28
+ 当文本匹配有歧义,或修改前需要精确的定义、实现或引用时,agent 使用 `lsp`;该工具的提示词指引会告诉它,普通导航应优先使用 `search`/`read`。
12
29
 
13
- 该工具要求从会话 `header.cwd` 取得工作区根目录,没有回退值:缺失时会在查询前以 `LSP_WORKSPACE_REQUIRED` 失败。其规范结果是完整的已规范化 Service Definition 联合类型:`{ kind: "locations", locations, resolvedWorkspaceUri }` 或 `{ kind: "hover", hover }`;Code Mode 可以直接检查每个已取得的位置和从零开始的范围。原生渲染以提供方的规范工作区 URI 为基准,投影按文件稳定分组的 `path:line:character` 条目,而不对会话 cwd 应用宿主平台路径规则。`file:` URI 落在该工作区 URI 内时成为工作区相对路径,位于其外时成为从 URI 派生的绝对路径;格式错误的 URI 与非 `file:` URI 保持原样。空位置和 `null` hover 都是成功的无结果响应;格式错误的提供方载荷仍是结构化错误。
30
+ ### 工具
14
31
 
15
- ## 配置
32
+ `lsp` 接受 `operation`(`goToDefinition`、`findReferences`、`goToImplementation` 或 `hover`)、`file_path`、`line` 与 `character`。`line` 与 `character` 是正的、从 1 开始的 UTF-16 光标坐标;未落在符号上的位置可能返回空结果。`findReferences` 始终包含声明,因此影响分析绝不会遗漏定义位置。提供方、language id、工作区根目录、限制、超时与可执行文件均不进入模型输入。
16
33
 
17
- | Key | 默认值 | 含义 |
34
+ ### 模型得到什么
35
+
36
+ 导航返回按文件分组的 `path:line:character` 位置行(从 1 开始);悬停返回规范化文本或无可悬停提示。空位置与无悬停都是成功的无结果响应。结果先由 `maxLocations` 限制,再由 `maxResultChars` 限制,省略与截断标记计入完整上限;这些上限只影响呈现,不影响规范结果值。
37
+
38
+ ### 配置
39
+
40
+ | 键 | 默认值 | 含义 |
18
41
  |---|---|---|
19
- | `maxLocations` | `100` | 出现省略标记前可渲染位置的最大数量。 |
20
- | `maxResultChars` | `16000` | 完整渲染结果的最大长度,包括截断元数据。 |
21
- | `timeoutMs` | `60000` | 由 `dsh-tool-call-timeout-policy` 强制执行的工具调用超时预算;覆盖完整的排队打开/查询/关闭生命周期,且模型不可配置。 |
42
+ | `maxLocations` | `100` | 出现省略标记前可渲染位置的最大数量 |
43
+ | `maxResultChars` | `16000` | 完整渲染结果的最大长度,包括截断元数据 |
44
+ | `timeoutMs` | `60000` | 由 `dsh-tool-call-timeout-policy` 强制执行的工具调用超时预算;覆盖完整的排队打开/查询/关闭生命周期,且模型不可配置 |
45
+
46
+ 生成的[配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-tool-lsp)是每个受支持字段的穷尽式真源。
47
+
48
+ ### 失败与恢复
49
+
50
+ 该工具要求会话工作区根目录(`header.cwd`),没有回退值;缺失时会在任何查询前以 `LSP_WORKSPACE_REQUIRED` 失败。当没有提供方处理该文件扩展名时,查询以 `LSP_UNAVAILABLE` 失败;格式错误的提供方载荷仍保持为结构化 `LSP_MALFORMED_RESPONSE` 错误。这些会呈现为模型可读、可路由的错误工具结果。
51
+
52
+ -----
53
+
54
+ <a id="understand-the-implementation"></a>
55
+ ## 理解实现
56
+
57
+ <details>
58
+ <summary>实现细节——点击展开</summary>
59
+
60
+ 本节解释工具背后的设计决策并指出实现它们的代码位置;可观察行为已在[使用本包](#use-this-package)中完整说明。
61
+
62
+ ### 设计说明
63
+
64
+ - **只做消费方。** 工具运行时只注入 `tools`、`lsp` 与 `systemPrompt`,不导入任何提供方,并且只把 `exec.signal` 传给 seam。
65
+ - **坐标转换。** `parseLspArgs` 验证 `line` 与 `character` 是正整数,并转换为 seam 从零开始的位置;渲染出的位置再转回从 1 开始的形式。
66
+ - **规范结果透传。** 工具返回 seam 的封闭联合(`{ kind: 'locations', locations, resolvedWorkspaceUri }` 或 `{ kind: 'hover', hover }`),原生渲染器可以直接检查每个已取得的位置与从零开始的范围。
67
+ - **执行世界 URI 渲染。** `renderUri` 以提供方的规范工作区 URI 为基准解析 `file:` URI——在其内为工作区相对路径,在其外为从 URI 派生的绝对路径,格式错误或非 `file:` 时原样保留——绝不把宿主平台路径规则应用到会话 cwd。
68
+ - **渲染后再设限。** `maxLocations` 先限制条目数量,`maxResultChars` 再限制包含省略或截断标记在内的完整渲染文本。
69
+ - **通用搜索卡片呈现。** `presentLspCall` 渲染 `{ card: 'generic', kind: 'search', title, locations: [{ path, line }] }` 视图;从 args 派生的标题携带操作与从 1 开始的光标,跟随焦点对准查询行,标题则保留列号。
22
70
 
71
+ ### 源码地图
72
+
73
+ | 文件 | 职责 |
74
+ |---|---|
75
+ | [`src/index.ts`](src/index.ts) | 插件入口:config schema、工具注册、系统提示词区段、执行 |
76
+ | [`src/render.ts`](src/render.ts) | 纯格式化、坐标转换、URI 解析、结果上限、UI 呈现 |
77
+ | [`src/session-cwd.ts`](src/session-cwd.ts) | 从会话 `header.cwd` 取得工作区根目录 |
78
+ | [`src/invariant.ts`](src/invariant.ts) | 不变式伴生插件(无运行时不变式;无状态适配器) |
79
+
80
+ </details>
81
+
82
+ -----
83
+
84
+ <a id="further-exploration"></a>
85
+ ## 进一步探索
86
+
87
+ 当包级约定不够用时阅读以下页面。它们从面向模型的表层逐步进入 seam、提供方与决策证据。
88
+
89
+ - [LSP 导航子系统](../../../docs/subsystems/lsp.zh.md)——操作、坐标、请求与结果,以及 `LspError` code。
90
+ - [LSP 能力 seam Agent Note](../../../.agents/notes/implemented/architecture/2026-07-15-lsp-capability-seam.zh.md)——设计原理、备选方案与刻意推迟的 API。
91
+ - [dsh-lsp](../lsp/README.zh.md)——本工具查询的 seam。
92
+ - [dsh-lsp-stdio](../lsp-stdio/README.zh.md)——应答这些查询的 stdio 提供方。
93
+ - [lsp 组地图](../README.zh.md)——三个包的家族及其相关文档。
94
+
95
+ -----
96
+
97
+ <a id="model-experience"></a>
23
98
  ## 模型体验
24
99
 
25
100
  ### 系统提示词
26
101
 
27
- #### 模型看到的内容
102
+ #### 模型看到什么
28
103
 
29
- 一个系统提示词区段(顺序 112)将 LSP 定位为精确辅助工具,文本如下:
104
+ 一个系统提示词区段(first-party 顺序 2200)将 LSP 定位为精确辅助工具,文本如下:
30
105
 
31
106
  ##### 逐字指引
32
107
 
@@ -40,11 +115,11 @@ Use search/read for ordinary navigation. Use lsp when textual matches are ambigu
40
115
 
41
116
  #### KV Cache 影响
42
117
 
43
- 只要插件 scope 与指引文本不变,前缀就保持稳定;激活或 dispose(资源释放)可能使从该区段起的复用失效。
118
+ 只要插件 scope 与指引文本不变,前缀就保持稳定;激活或释放可能使从该区段起的复用失效。
44
119
 
45
120
  ### 工具 schema
46
121
 
47
- #### 模型看到的内容
122
+ #### 模型看到什么
48
123
 
49
124
  模型会看到生成的 [`lsp` schema](../../../docs/tool-catalog.zh.md#deepseek-aidsh-tool-lsp)。
50
125
 
@@ -58,9 +133,9 @@ Use search/read for ordinary navigation. Use lsp when textual matches are ambigu
58
133
 
59
134
  ### 结果
60
135
 
61
- #### 模型看到的内容
136
+ #### 模型看到什么
62
137
 
63
- 按文件分组的 `path:line:character` 位置行或规范化 hover 文本,先由 `maxLocations` 限制,再由 `maxResultChars` 限制;省略与截断标记计入完整字符上限。这些上限只影响原生/模型呈现,不影响规范值。空结果使用不同的 `No results.`/`No hover information.` 行。
138
+ 按文件分组的 `path:line:character` 位置行或规范化悬停文本,先由 `maxLocations` 限制,再由 `maxResultChars` 限制;省略与截断标记计入完整字符上限。这些上限只影响原生/模型呈现,不影响规范值。空结果使用不同的 `No results.`/`No hover information.` 行。
64
139
 
65
140
  #### Token 影响
66
141
 
@@ -72,9 +147,9 @@ Use search/read for ordinary navigation. Use lsp when textual matches are ambigu
72
147
 
73
148
  ### UI 呈现
74
149
 
75
- #### 模型看到的内容
150
+ #### 模型看到什么
76
151
 
77
- 无。客户端渲染通用搜索卡片:`{ card: 'generic', kind: 'search', title, locations: [{ path, line }] }`;从 args 派生的标题携带操作与从 1 开始的光标,跟随焦点对准查询行,标题则保留列号。
152
+ 无。客户端渲染通用搜索卡片——`{ card: 'generic', kind: 'search', title, locations: [{ path, line }] }`——从 args 派生的标题携带操作与从 1 开始的光标;跟随焦点对准查询行,标题则保留列号。
78
153
 
79
154
  #### Token 影响
80
155
 
@@ -84,7 +159,22 @@ Use search/read for ordinary navigation. Use lsp when textual matches are ambigu
84
159
 
85
160
  无;UI 呈现位于模型请求之外。
86
161
 
87
- ## 已知限制与暂缓事项
162
+ ## 已知限制与延期工作
163
+
164
+ <a id="known-limitations-and-deferred-work"></a>
165
+
166
+
167
+ 这些限制说明该工具何时不太合适。它们是当前包约束,不是任务积压。
168
+
169
+ - **UTF-16 光标坐标**——列坐标与协议精确一致,但模型难以在非 BMP 字符周围计数;未落在符号上的位置可能返回空结果,因此提示词解释了该约定,但不鼓励广泛使用 LSP(见 [seam Agent Note](../../../.agents/notes/implemented/architecture/2026-07-15-lsp-capability-seam.zh.md))。
170
+ - **不承诺跨服务器完整性**——受支持的服务器仍可能根据索引就绪情况返回空或部分结果;该工具不承诺跨语言或服务器的完整性。
171
+
172
+ <a id="dev-note"></a>
173
+ ### 开发备注
174
+
175
+ <details>
176
+ <summary>维护者的工作上下文——点击展开</summary>
177
+
178
+ 无。
88
179
 
89
- - **UTF-16 光标坐标**:列坐标与协议精确一致,但模型难以在非 BMP 字符周围计数;未落在符号上的位置可能返回空结果,因此提示词解释了该约定,但不鼓励广泛使用 LSP(见 [seam Agent Note](../../../.agents/notes/implemented/architecture/2026-07-15-lsp-capability-seam.zh.md))。
90
- - **不承诺跨服务器完整性**:受支持的服务器仍可能根据索引就绪情况返回空或部分结果;该工具不承诺跨语言或服务器的完整性。
180
+ </details>
package/lib/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import z from "@deepseek-ai/schemastery";
2
2
  import { defineTool } from "@deepseek-ai/dsh-tools";
3
- import { assertNever } from "@deepseek-ai/dsh-llm";
4
3
  import { LspError } from "@deepseek-ai/dsh-lsp";
5
4
  import { MAX_TIMER_DELAY_MS } from "@deepseek-ai/dsh-timeout";
5
+ import { assertNever } from "@deepseek-ai/dsh-util-values";
6
6
  import { posix, win32 } from "node:path";
7
7
  import { fileURLToPath } from "node:url";
8
8
  //#region lib/types/render.js
@@ -161,11 +161,9 @@ function presentLspCall(args) {
161
161
  //#endregion
162
162
  //#region lib/types/session-cwd.js
163
163
  /**
164
- * Derive the workspace root an `lsp` call resolves against: the calling agent's per-session
165
- * workspace (`exec.agent.session.header.cwd`), mirroring how the filesystem tools resolve paths.
166
- * Unlike those tools, LSP has NO provider fallback a missing cwd fails the call as
167
- * `LSP_WORKSPACE_REQUIRED`, because the local provider must canonicalize a real workspace before it
168
- * can start a server.
164
+ * Derive the workspace root an `lsp` call resolves against from the calling
165
+ * agent's session. A missing cwd fails as `LSP_WORKSPACE_REQUIRED` because the
166
+ * local provider must canonicalize a real workspace before starting a server.
169
167
  * @module @deepseek-ai/dsh-tool-lsp/session-cwd
170
168
  */
171
169
  /**
@@ -246,7 +244,7 @@ function apply(ctx, config) {
246
244
  assertTimer("timeoutMs", resolved.timeoutMs);
247
245
  ctx.systemPrompt.section({
248
246
  name: "tool:lsp",
249
- order: 112,
247
+ order: ctx.systemPrompt.getSectionOrder("TOOL_LSP"),
250
248
  text: LSP_PROMPT_TEXT
251
249
  });
252
250
  ctx.tools.register(defineTool({
@@ -1,9 +1,7 @@
1
1
  /**
2
- * Derive the workspace root an `lsp` call resolves against: the calling agent's per-session
3
- * workspace (`exec.agent.session.header.cwd`), mirroring how the filesystem tools resolve paths.
4
- * Unlike those tools, LSP has NO provider fallback a missing cwd fails the call as
5
- * `LSP_WORKSPACE_REQUIRED`, because the local provider must canonicalize a real workspace before it
6
- * can start a server.
2
+ * Derive the workspace root an `lsp` call resolves against from the calling
3
+ * agent's session. A missing cwd fails as `LSP_WORKSPACE_REQUIRED` because the
4
+ * local provider must canonicalize a real workspace before starting a server.
7
5
  * @module @deepseek-ai/dsh-tool-lsp/session-cwd
8
6
  */
9
7
  import type { ToolExecution } from '@deepseek-ai/dsh-tools';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-tool-lsp",
3
3
  "description": "Model-facing lsp tool over the DeepSeek Harness LSP capability seam (ctx.lsp) — one read-only tool with goToDefinition/findReferences/goToImplementation/hover operations, one-based UTF-16 cursor coordinates, bounded location rendering, and hover normalization",
4
- "version": "0.1.1-rc.2",
4
+ "version": "0.1.2-alpha.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -32,30 +32,31 @@
32
32
  ],
33
33
  "license": "MIT",
34
34
  "peerDependencies": {
35
- "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
36
- "@deepseek-ai/dsh-llm": "^0.1.1-rc.2",
37
- "@deepseek-ai/dsh-lsp": "^0.1.1-rc.2",
38
- "@deepseek-ai/dsh-timeout": "^0.1.1-rc.2",
39
- "@deepseek-ai/dsh-system-prompt": "^0.1.1-rc.2",
40
- "@deepseek-ai/dsh-tools": "^0.1.1-rc.2",
41
- "@deepseek-ai/cordis": "^4.0.1"
35
+ "@deepseek-ai/cordis": "^4.0.2",
36
+ "@deepseek-ai/dsh-invariants": "^0.1.2-alpha.2",
37
+ "@deepseek-ai/dsh-lsp": "^0.1.2-alpha.2",
38
+ "@deepseek-ai/dsh-system-prompt": "^0.1.2-alpha.2",
39
+ "@deepseek-ai/dsh-timeout": "^0.1.2-alpha.2",
40
+ "@deepseek-ai/dsh-tools": "^0.1.2-alpha.2",
41
+ "@deepseek-ai/dsh-llm": "^0.1.2-alpha.2"
42
42
  },
43
43
  "dependencies": {
44
- "@deepseek-ai/schemastery": "^3.18.1"
44
+ "@deepseek-ai/dsh-util-values": "^0.1.2-alpha.2",
45
+ "@deepseek-ai/schemastery": "^3.18.2"
45
46
  },
46
47
  "devDependencies": {
47
- "@deepseek-ai/dsh-agent": "^0.1.1-rc.2",
48
- "@deepseek-ai/dsh-fs-local": "^0.1.1-rc.2",
49
- "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
50
- "@deepseek-ai/dsh-lsp": "^0.1.1-rc.2",
51
- "@deepseek-ai/dsh-llm": "^0.1.1-rc.2",
52
- "@deepseek-ai/dsh-lsp-stdio": "^0.1.1-rc.2",
53
- "@deepseek-ai/dsh-session": "^0.1.1-rc.2",
54
- "@deepseek-ai/dsh-subprocess-local": "^0.1.1-rc.2",
55
- "@deepseek-ai/dsh-system-prompt": "^0.1.1-rc.2",
56
- "@deepseek-ai/dsh-timeout": "^0.1.1-rc.2",
57
- "@deepseek-ai/dsh-tool-call-timeout-policy": "^0.1.1-rc.2",
58
- "@deepseek-ai/cordis": "^4.0.1",
59
- "@deepseek-ai/dsh-tools": "^0.1.1-rc.2"
48
+ "@deepseek-ai/cordis": "^4.0.2",
49
+ "@deepseek-ai/dsh-agent": "^0.1.2-alpha.2",
50
+ "@deepseek-ai/dsh-fs-local": "^0.1.2-alpha.2",
51
+ "@deepseek-ai/dsh-invariants": "^0.1.2-alpha.2",
52
+ "@deepseek-ai/dsh-lsp": "^0.1.2-alpha.2",
53
+ "@deepseek-ai/dsh-subprocess-local": "^0.1.2-alpha.2",
54
+ "@deepseek-ai/dsh-llm": "^0.1.2-alpha.2",
55
+ "@deepseek-ai/dsh-system-prompt": "^0.1.2-alpha.2",
56
+ "@deepseek-ai/dsh-timeout": "^0.1.2-alpha.2",
57
+ "@deepseek-ai/dsh-session": "^0.1.2-alpha.2",
58
+ "@deepseek-ai/dsh-tool-call-timeout-policy": "^0.1.2-alpha.2",
59
+ "@deepseek-ai/dsh-lsp-stdio": "^0.1.2-alpha.2",
60
+ "@deepseek-ai/dsh-tools": "^0.1.2-alpha.2"
60
61
  }
61
62
  }