@deepseek-ai/dsh-tool-working-directory 0.0.0-stage → 0.2.1-alpha.3
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/LICENSE +21 -0
- package/README.i18n.yaml +46 -0
- package/README.md +89 -2
- package/README.zh.md +90 -0
- package/lib/index.js +45 -0
- package/lib/types/index.d.ts +15 -0
- package/package.json +43 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DeepSeek
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.i18n.yaml
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
|
|
2
|
+
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
|
|
3
|
+
# After editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write packages/session/tool-working-directory/README.md
|
|
5
|
+
/:
|
|
6
|
+
en: 98cfd91158449dab
|
|
7
|
+
zh: 5235a85797dc16a6
|
|
8
|
+
/deepseek-ai-dsh-tool-working-directory:
|
|
9
|
+
en: 1cbdc6d915999dbc
|
|
10
|
+
zh: 0c6cc71c43276a63
|
|
11
|
+
/deepseek-ai-dsh-tool-working-directory/summary:
|
|
12
|
+
en: 9a02398f19196e04
|
|
13
|
+
zh: 490c400f5c7c23cd
|
|
14
|
+
/deepseek-ai-dsh-tool-working-directory/table-of-contents:
|
|
15
|
+
en: d152484eb41ac6b4
|
|
16
|
+
zh: 87d7d2dbd7777429
|
|
17
|
+
/deepseek-ai-dsh-tool-working-directory/use-this-package:
|
|
18
|
+
en: bb750522dbdb3fef
|
|
19
|
+
zh: 85586a5c2137afa9
|
|
20
|
+
/deepseek-ai-dsh-tool-working-directory/understand-the-implementation:
|
|
21
|
+
en: f361fe510916fce8
|
|
22
|
+
zh: a2127f768ef9ac95
|
|
23
|
+
/deepseek-ai-dsh-tool-working-directory/further-exploration:
|
|
24
|
+
en: eabff683146786c8
|
|
25
|
+
zh: 7997dec17802ef64
|
|
26
|
+
/deepseek-ai-dsh-tool-working-directory/model-experience:
|
|
27
|
+
en: 215e7ba838619b7b
|
|
28
|
+
zh: a311da3843709f90
|
|
29
|
+
/deepseek-ai-dsh-tool-working-directory/model-experience/tool-schema-and-result:
|
|
30
|
+
en: bc924247b1806144
|
|
31
|
+
zh: af4cc374d7d16917
|
|
32
|
+
/deepseek-ai-dsh-tool-working-directory/model-experience/tool-schema-and-result/what-the-model-sees:
|
|
33
|
+
en: e69a26e66bc5e3c4
|
|
34
|
+
zh: 9a7515def45d139c
|
|
35
|
+
/deepseek-ai-dsh-tool-working-directory/model-experience/tool-schema-and-result/token-effect:
|
|
36
|
+
en: a8379dea8db4e2a2
|
|
37
|
+
zh: 5b8c86352564ba68
|
|
38
|
+
/deepseek-ai-dsh-tool-working-directory/model-experience/tool-schema-and-result/kv-cache-effect:
|
|
39
|
+
en: ae50eb17ba3b6545
|
|
40
|
+
zh: 6f5eed7bb30209e4
|
|
41
|
+
/deepseek-ai-dsh-tool-working-directory/known-limitations-and-deferred-work:
|
|
42
|
+
en: 58cd03e27224e8b8
|
|
43
|
+
zh: 4bd8752b74d1b05f
|
|
44
|
+
/deepseek-ai-dsh-tool-working-directory/known-limitations-and-deferred-work/dev-note:
|
|
45
|
+
en: e67f633dc6fe7773
|
|
46
|
+
zh: a4b126f9a4eaca6f
|
package/README.md
CHANGED
|
@@ -1,3 +1,90 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
description: "Read the Session’s current directory or enter an existing directory with the same tool. Relative changes use the current directory. The returned absolute path can be passed to other tools."
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
# @deepseek-ai/dsh-tool-working-directory
|
|
7
|
+
|
|
8
|
+
English | [中文](README.zh.md)
|
|
9
|
+
|
|
10
|
+
## Summary
|
|
11
|
+
|
|
12
|
+
Read the Session’s current directory or enter an existing directory with the same tool. Relative changes use the current directory. The returned absolute path can be passed to other tools.
|
|
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)
|
|
22
|
+
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## Use this package
|
|
27
|
+
|
|
28
|
+
Mount alongside `tools` and `workingDirectory`. Call `working_directory({})` to read or `working_directory({ cd: "src" })` to change directory. The tool has no configuration fields.
|
|
29
|
+
|
|
30
|
+
```yaml
|
|
31
|
+
- name: '@deepseek-ai/dsh-tool-working-directory'
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
-----
|
|
35
|
+
|
|
36
|
+
<a id="understand-the-implementation"></a>
|
|
37
|
+
## Understand the implementation
|
|
38
|
+
|
|
39
|
+
<details>
|
|
40
|
+
<summary>Implementation internals — click to expand</summary>
|
|
41
|
+
|
|
42
|
+
The tool delegates validation, recovery, persistence, and context notices to the directory owner. Its canonical result contains `cwd`; native rendering returns that path. The generic tool card displays the arguments and result without a separate GUI renderer.
|
|
43
|
+
|
|
44
|
+
No runtime invariant companion is published because the tool delegates all directory state and mutations to `workingDirectory`.
|
|
45
|
+
|
|
46
|
+
</details>
|
|
47
|
+
|
|
48
|
+
-----
|
|
49
|
+
|
|
50
|
+
<a id="further-exploration"></a>
|
|
51
|
+
## Further Exploration
|
|
52
|
+
|
|
53
|
+
- [Working directories](../../../docs/subsystems/working-directory.md) — shared runtime behavior.
|
|
54
|
+
- [Session group](../README.md) — durable Session services.
|
|
55
|
+
- [Testing](../../../docs/testing.md) — composition and replay verification.
|
|
56
|
+
|
|
57
|
+
-----
|
|
58
|
+
|
|
59
|
+
<a id="model-experience"></a>
|
|
60
|
+
## Model Experience
|
|
61
|
+
|
|
62
|
+
### Tool schema and result
|
|
63
|
+
|
|
64
|
+
#### What the model sees
|
|
65
|
+
|
|
66
|
+
The [tool catalog](../../../docs/tool-catalog.md#deepseek-aidsh-tool-working-directory) defines the optional `cd` argument and canonical `cwd` result. Directory notices are owned by `dsh-working-directory`.
|
|
67
|
+
|
|
68
|
+
#### Token effect
|
|
69
|
+
|
|
70
|
+
The registered schema and returned path contribute tokens when the tool is available and invoked.
|
|
71
|
+
|
|
72
|
+
#### KV Cache effect
|
|
73
|
+
|
|
74
|
+
Changing tool availability changes its schema context. A tool call appends ordinary call and result history without replacing prior messages.
|
|
75
|
+
|
|
76
|
+
## Known Limitations and Deferred Work
|
|
77
|
+
|
|
78
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
79
|
+
|
|
80
|
+
- **Calling Session required** — the tool requires an Agent and changes neither existing processes nor write permissions.
|
|
81
|
+
|
|
82
|
+
<a id="dev-note"></a>
|
|
83
|
+
### Dev Note
|
|
84
|
+
|
|
85
|
+
<details>
|
|
86
|
+
<summary>Working context for maintainers — click to expand</summary>
|
|
87
|
+
|
|
88
|
+
None.
|
|
89
|
+
|
|
90
|
+
</details>
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "使用同一工具读取 Session 的当前目录,或进入一个现有目录。相对路径变更基于当前目录解析。返回的绝对路径可传给其他工具。"
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @deepseek-ai/dsh-tool-working-directory
|
|
7
|
+
|
|
8
|
+
[English](README.md) | 中文
|
|
9
|
+
|
|
10
|
+
## 概述
|
|
11
|
+
|
|
12
|
+
使用同一工具读取 Session 的当前目录,或进入一个现有目录。相对路径变更基于当前目录解析。返回的绝对路径可传给其他工具。
|
|
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)
|
|
22
|
+
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## 使用此包
|
|
27
|
+
|
|
28
|
+
与 `tools` 和 `workingDirectory` 一起挂载。调用 `working_directory({})` 读取目录,或调用 `working_directory({ cd: "src" })` 改变目录。此工具没有配置字段。
|
|
29
|
+
|
|
30
|
+
```yaml
|
|
31
|
+
- name: '@deepseek-ai/dsh-tool-working-directory'
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
-----
|
|
35
|
+
|
|
36
|
+
<a id="understand-the-implementation"></a>
|
|
37
|
+
## 理解实现
|
|
38
|
+
|
|
39
|
+
<details>
|
|
40
|
+
<summary>实现细节 — 点击展开</summary>
|
|
41
|
+
|
|
42
|
+
此工具将验证、恢复、持久化和上下文通知委托给目录服务。规范结果包含 `cwd`;原生渲染返回该路径。通用工具卡展示参数和结果,无需独立 GUI 渲染器。
|
|
43
|
+
|
|
44
|
+
不发布 `./invariant` 伴生模块,因为工具将全部目录状态和变更委托给 `workingDirectory`。
|
|
45
|
+
|
|
46
|
+
</details>
|
|
47
|
+
|
|
48
|
+
-----
|
|
49
|
+
|
|
50
|
+
<a id="further-exploration"></a>
|
|
51
|
+
## 进一步阅读
|
|
52
|
+
|
|
53
|
+
- [工作目录](../../../docs/subsystems/working-directory.zh.md) — 共享运行时行为。
|
|
54
|
+
- [Session 包组](../README.zh.md) — 持久化 Session 服务。
|
|
55
|
+
- [测试](../../../docs/testing.zh.md) — 组合与回放验证。
|
|
56
|
+
|
|
57
|
+
-----
|
|
58
|
+
|
|
59
|
+
<a id="model-experience"></a>
|
|
60
|
+
## 模型体验
|
|
61
|
+
|
|
62
|
+
### 工具 schema 与结果
|
|
63
|
+
|
|
64
|
+
#### 模型可见内容
|
|
65
|
+
|
|
66
|
+
[工具目录](../../../docs/tool-catalog.zh.md#deepseek-aidsh-tool-working-directory) 定义可选的 `cd` 参数与规范 `cwd` 结果。目录通知由 `dsh-working-directory` 拥有。
|
|
67
|
+
|
|
68
|
+
#### Token 影响
|
|
69
|
+
|
|
70
|
+
工具可用及被调用时,注册的 schema 和返回路径贡献 token。
|
|
71
|
+
|
|
72
|
+
#### KV Cache 影响
|
|
73
|
+
|
|
74
|
+
改变工具可用性会改变其 schema 上下文。工具调用追加普通调用和结果历史,不替换已有消息。
|
|
75
|
+
|
|
76
|
+
## 已知限制与后续工作
|
|
77
|
+
|
|
78
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
79
|
+
|
|
80
|
+
- **需要调用方 Session** — 此工具需要 Agent,不改变已有进程或写权限。
|
|
81
|
+
|
|
82
|
+
<a id="dev-note"></a>
|
|
83
|
+
### 开发备注
|
|
84
|
+
|
|
85
|
+
<details>
|
|
86
|
+
<summary>维护工作上下文 — 点击展开</summary>
|
|
87
|
+
|
|
88
|
+
无。
|
|
89
|
+
|
|
90
|
+
</details>
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
2
|
+
//#region lib/types/index.js
|
|
3
|
+
/**
|
|
4
|
+
* Read or change the calling Session's working directory.
|
|
5
|
+
* @module @deepseek-ai/dsh-tool-working-directory
|
|
6
|
+
*/
|
|
7
|
+
/** Cordis plugin name. */
|
|
8
|
+
const name = "tool-working-directory";
|
|
9
|
+
/** Services used by the tool. */
|
|
10
|
+
const inject = ["tools", "workingDirectory"];
|
|
11
|
+
/**
|
|
12
|
+
* Register the working-directory tool for this composition.
|
|
13
|
+
* @param ctx - context providing the tool registry and directory owner.
|
|
14
|
+
*/
|
|
15
|
+
function apply(ctx) {
|
|
16
|
+
ctx.tools.register(defineTool({
|
|
17
|
+
name: "working_directory",
|
|
18
|
+
description: "Read the current working directory, or change it with cd. Relative paths use the current directory. Existing shells and running processes keep their own directories.",
|
|
19
|
+
parameters: { cd: {
|
|
20
|
+
type: "string",
|
|
21
|
+
description: "Existing directory to enter. Omit to read the current directory."
|
|
22
|
+
} },
|
|
23
|
+
output: {
|
|
24
|
+
schema: {
|
|
25
|
+
type: "object",
|
|
26
|
+
additionalProperties: false,
|
|
27
|
+
properties: { cwd: {
|
|
28
|
+
type: "string",
|
|
29
|
+
required: true,
|
|
30
|
+
description: "Current absolute working directory."
|
|
31
|
+
} }
|
|
32
|
+
},
|
|
33
|
+
render: (_args, value) => [{
|
|
34
|
+
type: "text",
|
|
35
|
+
text: value.cwd
|
|
36
|
+
}]
|
|
37
|
+
},
|
|
38
|
+
async execute(args, exec) {
|
|
39
|
+
if (exec.agent === void 0) throw new Error("working_directory requires an agent Session");
|
|
40
|
+
return { cwd: args.cd === void 0 ? await ctx.workingDirectory.ensure(exec.agent, exec.signal) : await ctx.workingDirectory.set(exec.agent, args.cd, exec.signal) };
|
|
41
|
+
}
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { apply, inject, name };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read or change the calling Session's working directory.
|
|
3
|
+
* @module @deepseek-ai/dsh-tool-working-directory
|
|
4
|
+
*/
|
|
5
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
6
|
+
/** Cordis plugin name. */
|
|
7
|
+
export declare const name = "tool-working-directory";
|
|
8
|
+
/** Services used by the tool. */
|
|
9
|
+
export declare const inject: string[];
|
|
10
|
+
/**
|
|
11
|
+
* Register the working-directory tool for this composition.
|
|
12
|
+
* @param ctx - context providing the tool registry and directory owner.
|
|
13
|
+
*/
|
|
14
|
+
export declare function apply(ctx: Context): void;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-tool-working-directory",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"description": "Read and change the active Session working directory",
|
|
4
|
+
"version": "0.2.1-alpha.3",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
|
|
11
|
+
"directory": "packages/session/tool-working-directory"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"types": "lib/types/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./src/*": "./src/*",
|
|
22
|
+
"./package.json": "./package.json"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"lib/index.js",
|
|
26
|
+
"lib/types/**/*.d.ts"
|
|
27
|
+
],
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.2",
|
|
31
|
+
"@deepseek-ai/dsh-tools": "0.2.1-alpha.3",
|
|
32
|
+
"@deepseek-ai/dsh-working-directory": "0.2.1-alpha.3"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.2",
|
|
36
|
+
"@deepseek-ai/dsh-tools": "0.2.1-alpha.3",
|
|
37
|
+
"@deepseek-ai/dsh-working-directory": "0.2.1-alpha.3",
|
|
38
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "0.2.1-alpha.3",
|
|
39
|
+
"@deepseek-ai/dsh-fs-local": "0.2.1-alpha.3",
|
|
40
|
+
"@deepseek-ai/dsh-agent-loop": "0.2.1-alpha.3",
|
|
41
|
+
"@deepseek-ai/dsh-llm": "0.2.1-alpha.3",
|
|
42
|
+
"@deepseek-ai/dsh-session": "0.2.1-alpha.3",
|
|
43
|
+
"@deepseek-ai/dsh-session-projection": "0.2.1-alpha.3",
|
|
44
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.1-alpha.3"
|
|
45
|
+
}
|
|
6
46
|
}
|