@deepseek-ai/dsh-tool-lsp 0.2.0-rc.2 → 0.2.1-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
@@ -15,8 +15,8 @@
15
15
  en: d152484eb41ac6b4
16
16
  zh: 09388d293f9be9cb
17
17
  /deepseek-ai-dsh-tool-lsp/use-this-package:
18
- en: 755832ede150d487
19
- zh: 5f5058b7f6b41f8e
18
+ en: 9cc52be87b57e19a
19
+ zh: 9fa78b6fe3027c1f
20
20
  /deepseek-ai-dsh-tool-lsp/use-this-package/the-tool:
21
21
  en: 46cbff3bda30f0bc
22
22
  zh: 66e209ae78fb4683
@@ -27,8 +27,8 @@
27
27
  en: c6ca5869a35edefa
28
28
  zh: 65378aff80dfc93c
29
29
  /deepseek-ai-dsh-tool-lsp/use-this-package/failures-and-recovery:
30
- en: 0a18aa55ff17c31c
31
- zh: f7c1b9f34404d27e
30
+ en: b1f8b3bb52434cc6
31
+ zh: a8c9643a754c4768
32
32
  /deepseek-ai-dsh-tool-lsp/understand-the-implementation:
33
33
  en: 6574e484bce0e60b
34
34
  zh: 75688d1f9dde8f48
@@ -36,8 +36,8 @@
36
36
  en: 9e9f50894b853946
37
37
  zh: 7137a1894339ad5f
38
38
  /deepseek-ai-dsh-tool-lsp/understand-the-implementation/source-map:
39
- en: 6b14444729010597
40
- zh: de5b7453bb7fd3be
39
+ en: ae801d20c57b1ffb
40
+ zh: 65aa6d9c0e0488fb
41
41
  /deepseek-ai-dsh-tool-lsp/further-exploration:
42
42
  en: f4965ba5ea4f8ee3
43
43
  zh: b85ee14edf9fdef0
package/README.md CHANGED
@@ -25,6 +25,8 @@ English | [中文](README.zh.md)
25
25
  <a id="use-this-package"></a>
26
26
  ## Use this package
27
27
 
28
+ Queries use the Session's current working directory as their workspace root. Changing directory affects subsequent queries without changing an already running server's root.
29
+
28
30
  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.
29
31
 
30
32
  ### The tool
@@ -47,7 +49,7 @@ The generated [configuration catalog](../../../docs/config-catalog.md#deepseek-a
47
49
 
48
50
  ### Failures and recovery
49
51
 
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.
52
+ The tool requires an Agent Session; a non-agent call fails with `LSP_WORKSPACE_REQUIRED` before any query. The working-directory service supplies and validates its current root. 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
53
 
52
54
  -----
53
55
 
@@ -74,8 +76,6 @@ This section explains the design decisions behind the tool and where the code re
74
76
  |---|---|
75
77
  | [`src/index.ts`](src/index.ts) | Plugin entry: config schema, tool registration, system-prompt section, execution |
76
78
  | [`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
- | — | No runtime invariant companion is published; this stateless adapter contributes one tool and prompt section, while query lifecycle and result relations remain owned by the tool and LSP seams it composes. |
79
79
 
80
80
  </details>
81
81
 
package/README.zh.md CHANGED
@@ -25,6 +25,8 @@ kind: "package-reference"
25
25
  <a id="use-this-package"></a>
26
26
  ## 使用本包
27
27
 
28
+ 查询使用 Session 的当前工作目录作为工作区根目录。切换目录会影响后续查询,但不会改变已运行服务器的根目录。
29
+
28
30
  当文本匹配有歧义,或修改前需要精确的定义、实现或引用时,agent(智能体)使用 `lsp`;该工具的提示词指引会告诉它,普通导航应优先使用 `search`/`read`。
29
31
 
30
32
  ### 工具
@@ -47,7 +49,7 @@ kind: "package-reference"
47
49
 
48
50
  ### 失败与恢复
49
51
 
50
- 该工具要求会话工作区根目录(`header.cwd`),没有回退值;缺失时会在任何查询前以 `LSP_WORKSPACE_REQUIRED` 失败。当没有提供方处理该文件扩展名时,查询以 `LSP_UNAVAILABLE` 失败;格式错误的提供方载荷仍保持为结构化 `LSP_MALFORMED_RESPONSE` 错误。这些会呈现为模型可读、可路由的错误工具结果。
52
+ 该工具要求 Agent Session;非 Agent 调用会在任何查询前以 `LSP_WORKSPACE_REQUIRED` 失败。工作目录服务提供并校验当前根目录。当没有提供方处理该文件扩展名时,查询以 `LSP_UNAVAILABLE` 失败;格式错误的提供方载荷仍保持为结构化 `LSP_MALFORMED_RESPONSE` 错误。这些会呈现为模型可读、可路由的错误工具结果。
51
53
 
52
54
  -----
53
55
 
@@ -74,8 +76,6 @@ kind: "package-reference"
74
76
  |---|---|
75
77
  | [`src/index.ts`](src/index.ts) | 插件入口:配置 schema、工具注册、系统提示词区段、执行 |
76
78
  | [`src/render.ts`](src/render.ts) | 纯格式化、坐标转换、URI 解析、结果上限、UI 呈现 |
77
- | [`src/session-cwd.ts`](src/session-cwd.ts) | 从会话 `header.cwd` 取得工作区根目录 |
78
- | — | 不发布运行时不变式伴生入口;该无状态适配器提供一个工具和一个提示词区段,而查询生命周期与结果关系仍由它所组合的工具 seam 和 LSP seam 负责。 |
79
79
 
80
80
  </details>
81
81
 
package/lib/index.js CHANGED
@@ -159,22 +159,6 @@ function presentLspCall(args) {
159
159
  };
160
160
  }
161
161
  //#endregion
162
- //#region lib/types/session-cwd.js
163
- /**
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.
167
- * @module @deepseek-ai/dsh-tool-lsp/session-cwd
168
- */
169
- /**
170
- * The session workspace cwd for this call, or `undefined` when none applies.
171
- * @param exec - the tool-execution context; only its optional `agent` is read.
172
- * @returns the calling agent's session cwd, or undefined for a non-agent caller.
173
- */
174
- function sessionCwd(exec) {
175
- return exec.agent?.session.header.cwd;
176
- }
177
- //#endregion
178
162
  //#region lib/types/index.js
179
163
  /**
180
164
  * Model-facing `lsp` tool over `ctx.lsp`. One read-only tool with four operations
@@ -193,7 +177,8 @@ const name = "tool-lsp";
193
177
  const inject = [
194
178
  "tools",
195
179
  "lsp",
196
- "systemPrompt"
180
+ "systemPrompt",
181
+ "workingDirectory"
197
182
  ];
198
183
  /** Default tool-call timeout budget (ms), covering the queued open/query/close lifecycle. */
199
184
  const DEFAULT_LSP_TOOL_TIMEOUT_MS = 6e4;
@@ -349,7 +334,7 @@ function apply(ctx, config) {
349
334
  timeoutMs: resolved.timeoutMs,
350
335
  async execute(args, exec) {
351
336
  const input = parseLspArgs(args);
352
- const workspaceRoot = sessionCwd(exec);
337
+ const workspaceRoot = exec.agent === void 0 ? void 0 : await ctx.workingDirectory.ensure(exec.agent, exec.signal);
353
338
  if (workspaceRoot === void 0) throw new LspError("the lsp tool requires a session workspace cwd", "LSP_WORKSPACE_REQUIRED");
354
339
  const result = await ctx.lsp.query({
355
340
  operation: input.operation,
@@ -407,4 +392,4 @@ function assertTimer(name, value) {
407
392
  if (!Number.isInteger(value) || value < 1 || value > MAX_TIMER_DELAY_MS) throw new Error(`tool-lsp: ${name} must be a positive integer no greater than ${MAX_TIMER_DELAY_MS}`);
408
393
  }
409
394
  //#endregion
410
- export { Config, DEFAULT_LSP_TOOL_TIMEOUT_MS, DEFAULT_MAX_LOCATIONS, DEFAULT_MAX_RESULT_CHARS, LSP_OPERATIONS, LSP_PROMPT_TEXT, apply, formatHover, formatLocations, inject, name, parseLspArgs, presentLspCall, renderUri, sessionCwd };
395
+ export { Config, DEFAULT_LSP_TOOL_TIMEOUT_MS, DEFAULT_MAX_LOCATIONS, DEFAULT_MAX_RESULT_CHARS, LSP_OPERATIONS, LSP_PROMPT_TEXT, apply, formatHover, formatLocations, inject, name, parseLspArgs, presentLspCall, renderUri };
@@ -12,7 +12,6 @@
12
12
  import type { Context } from '@deepseek-ai/cordis';
13
13
  import z from '@deepseek-ai/schemastery';
14
14
  export { DEFAULT_MAX_LOCATIONS, DEFAULT_MAX_RESULT_CHARS, formatHover, formatLocations, LSP_OPERATIONS, parseLspArgs, presentLspCall, renderUri, } from './render.ts';
15
- export { sessionCwd } from './session-cwd.ts';
16
15
  /** Cordis plugin name for loader diagnostics. */
17
16
  export declare const name = "tool-lsp";
18
17
  /** Services required by this plugin. */
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.2.0-rc.2",
4
+ "version": "0.2.1-alpha.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -27,29 +27,32 @@
27
27
  ],
28
28
  "license": "MIT",
29
29
  "peerDependencies": {
30
- "@deepseek-ai/cordis": "~4.0.4",
31
- "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
32
- "@deepseek-ai/dsh-lsp": "0.2.0-rc.2",
33
- "@deepseek-ai/dsh-system-prompt": "0.2.0-rc.2",
34
- "@deepseek-ai/dsh-tools": "0.2.0-rc.2",
35
- "@deepseek-ai/dsh-timeout": "0.2.0-rc.2"
30
+ "@deepseek-ai/cordis": "~4.0.5-alpha.1",
31
+ "@deepseek-ai/dsh-llm": "0.2.1-alpha.2",
32
+ "@deepseek-ai/dsh-lsp": "0.2.1-alpha.2",
33
+ "@deepseek-ai/dsh-system-prompt": "0.2.1-alpha.2",
34
+ "@deepseek-ai/dsh-timeout": "0.2.1-alpha.2",
35
+ "@deepseek-ai/dsh-tools": "0.2.1-alpha.2",
36
+ "@deepseek-ai/dsh-working-directory": "0.2.1-alpha.2"
36
37
  },
37
38
  "dependencies": {
38
- "@deepseek-ai/dsh-util-values": "0.2.0-rc.2",
39
- "@deepseek-ai/schemastery": "~3.18.4"
39
+ "@deepseek-ai/dsh-util-values": "0.2.1-alpha.2",
40
+ "@deepseek-ai/schemastery": "~3.18.5-alpha.1"
40
41
  },
41
42
  "devDependencies": {
42
- "@deepseek-ai/cordis": "~4.0.4",
43
- "@deepseek-ai/dsh-agent": "0.2.0-rc.2",
44
- "@deepseek-ai/dsh-fs-local": "0.2.0-rc.2",
45
- "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
46
- "@deepseek-ai/dsh-lsp": "0.2.0-rc.2",
47
- "@deepseek-ai/dsh-lsp-stdio": "0.2.0-rc.2",
48
- "@deepseek-ai/dsh-subprocess-local": "0.2.0-rc.2",
49
- "@deepseek-ai/dsh-system-prompt": "0.2.0-rc.2",
50
- "@deepseek-ai/dsh-session": "0.2.0-rc.2",
51
- "@deepseek-ai/dsh-timeout": "0.2.0-rc.2",
52
- "@deepseek-ai/dsh-tool-call-timeout-policy": "0.2.0-rc.2",
53
- "@deepseek-ai/dsh-tools": "0.2.0-rc.2"
43
+ "@deepseek-ai/cordis": "~4.0.5-alpha.1",
44
+ "@deepseek-ai/dsh-agent": "0.2.1-alpha.2",
45
+ "@deepseek-ai/dsh-fs-local": "0.2.1-alpha.2",
46
+ "@deepseek-ai/dsh-llm": "0.2.1-alpha.2",
47
+ "@deepseek-ai/dsh-lsp": "0.2.1-alpha.2",
48
+ "@deepseek-ai/dsh-lsp-stdio": "0.2.1-alpha.2",
49
+ "@deepseek-ai/dsh-session": "0.2.1-alpha.2",
50
+ "@deepseek-ai/dsh-subprocess-local": "0.2.1-alpha.2",
51
+ "@deepseek-ai/dsh-system-prompt": "0.2.1-alpha.2",
52
+ "@deepseek-ai/dsh-timeout": "0.2.1-alpha.2",
53
+ "@deepseek-ai/dsh-tool-call-timeout-policy": "0.2.1-alpha.2",
54
+ "@deepseek-ai/dsh-tools": "0.2.1-alpha.2",
55
+ "@deepseek-ai/dsh-working-directory": "0.2.1-alpha.2",
56
+ "@deepseek-ai/dsh-agent-loop-testkit": "0.2.1-alpha.2"
54
57
  }
55
58
  }
@@ -1,14 +0,0 @@
1
- /**
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.
5
- * @module @deepseek-ai/dsh-tool-lsp/session-cwd
6
- */
7
- import type { ToolExecution } from '@deepseek-ai/dsh-tools';
8
- /**
9
- * The session workspace cwd for this call, or `undefined` when none applies.
10
- * @param exec - the tool-execution context; only its optional `agent` is read.
11
- * @returns the calling agent's session cwd, or undefined for a non-agent caller.
12
- */
13
- export declare function sessionCwd(exec: ToolExecution): string | undefined;
14
- //# sourceMappingURL=session-cwd.d.ts.map