@deepseek-ai/dsh-experimental-tool-worktree 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 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.
@@ -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/experimental/tool-worktree/README.md
5
+ /:
6
+ en: 7c7c8316f315eee0
7
+ zh: dfd3abcef256029e
8
+ /deepseek-ai-dsh-experimental-tool-worktree:
9
+ en: db61f6b6ad671f45
10
+ zh: 9f3083d7f5605cbb
11
+ /deepseek-ai-dsh-experimental-tool-worktree/summary:
12
+ en: f0df470fd16d8d29
13
+ zh: 5f2d371d844b0568
14
+ /deepseek-ai-dsh-experimental-tool-worktree/table-of-contents:
15
+ en: d152484eb41ac6b4
16
+ zh: 2f8a621b991260a1
17
+ /deepseek-ai-dsh-experimental-tool-worktree/use-this-package:
18
+ en: f69d3fdeed949ff5
19
+ zh: 05c9a85b7cdcfbad
20
+ /deepseek-ai-dsh-experimental-tool-worktree/understand-the-implementation:
21
+ en: c03f875211ab69a8
22
+ zh: 8f49b82f90a60223
23
+ /deepseek-ai-dsh-experimental-tool-worktree/further-exploration:
24
+ en: 6ec5bb0f5bfbbaa4
25
+ zh: 45009dd139621d0e
26
+ /deepseek-ai-dsh-experimental-tool-worktree/model-experience:
27
+ en: 215e7ba838619b7b
28
+ zh: a311da3843709f90
29
+ /deepseek-ai-dsh-experimental-tool-worktree/model-experience/creation-tool:
30
+ en: 4062fcaa4794bed7
31
+ zh: b56d35fc675fc430
32
+ /deepseek-ai-dsh-experimental-tool-worktree/model-experience/creation-tool/what-the-model-sees:
33
+ en: e37073be01ff5cd1
34
+ zh: 02fd0282863c708c
35
+ /deepseek-ai-dsh-experimental-tool-worktree/model-experience/creation-tool/token-effect:
36
+ en: 6c3f73ba01233a36
37
+ zh: d64d87a425db4fbd
38
+ /deepseek-ai-dsh-experimental-tool-worktree/model-experience/creation-tool/kv-cache-effect:
39
+ en: 365f8ccedfa61bbb
40
+ zh: aa328044ba2528b8
41
+ /deepseek-ai-dsh-experimental-tool-worktree/known-limitations-and-deferred-work:
42
+ en: 7cfc071dfc3f9c83
43
+ zh: f36ae822e801db12
44
+ /deepseek-ai-dsh-experimental-tool-worktree/known-limitations-and-deferred-work/dev-note:
45
+ en: e67f633dc6fe7773
46
+ zh: 3bb0c20c93f16f98
package/README.md CHANGED
@@ -1,3 +1,96 @@
1
- # Temporary Holding Version
1
+ ---
2
+ description: "Model tool that creates a new local Git worktree and changes the current Session directory."
3
+ kind: "package-bundle"
4
+ ---
2
5
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
6
+ # @deepseek-ai/dsh-experimental-tool-worktree
7
+
8
+ English | [中文](README.zh.md)
9
+
10
+ ## Summary
11
+
12
+ Add Git Worktrees from the GUI plugin manager to let a model create and enter a new Git worktree with one call. This optional bundle is installed with Harness and stays off until selected. Native tool calls and PTC programs receive the same typed result, and the existing file policy governs creation.
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
+ In the GUI, open **Plugins → Official → Git Worktrees** and turn on the switch. The bundle loads the [worktree runtime](../worktree/README.md) and this tool together; it is off in every shipped profile. Turning it off removes `create_worktree` without deleting existing checkouts or branches. The built-in `working_directory` tool remains available.
29
+
30
+ For an explicit composition, mount this function plugin after the worktree runtime and tool registry.
31
+
32
+ ```yaml
33
+ - name: '@deepseek-ai/dsh-experimental-worktree'
34
+ - name: '@deepseek-ai/dsh-experimental-tool-worktree'
35
+ ```
36
+
37
+ Call `create_worktree({ name?: string, from?: string })`. Success returns the canonical checkout `path`, new `branch`, pinned `baseCommit`, and source `repositoryRoot`, and changes the calling Session's current working directory. To leave, call `working_directory({ cd: path })`; the checkout and branch remain. The [generated tool catalog](../../../docs/tool-catalog.md#deepseek-aidsh-experimental-tool-worktree) owns the exact schema and model-facing description.
38
+
39
+ -----
40
+
41
+ <a id="understand-the-implementation"></a>
42
+ ## Understand the implementation
43
+
44
+ <details>
45
+ <summary>Implementation internals — click to expand</summary>
46
+
47
+ [`cordis.patch.yml`](cordis.patch.yml) inserts the `worktree` runtime row and the `tool-worktree` consumer row. [`src/index.ts`](src/index.ts) registers one typed tool. Runtime creation owns Git behavior, cancellation, and the working-directory change. The tool returns the runtime record as its canonical value and renders that record as JSON; its Host presentation uses the generic card. Disposal unregisters the tool.
48
+
49
+ No runtime invariant companion is published because the tool retains no state independently of the worktree runtime.
50
+
51
+ </details>
52
+
53
+ -----
54
+
55
+ <a id="further-exploration"></a>
56
+ ## Further Exploration
57
+
58
+ - [Worktree runtime](../worktree/README.md) — configuration, creation semantics, and write permissions.
59
+ - [Working directory](../../session/working-directory/README.md) — Session context and exit operation.
60
+ - [Tool authoring](../../../docs/cookbook/adding-a-tool.md) — canonical results and pure presentation.
61
+
62
+ -----
63
+
64
+ <a id="model-experience"></a>
65
+ ## Model Experience
66
+
67
+ ### Creation tool
68
+
69
+ #### What the model sees
70
+
71
+ The [tool catalog](../../../docs/tool-catalog.md#deepseek-aidsh-experimental-tool-worktree) defines `create_worktree`. Each successful result contains the created checkout's canonical path, branch, base commit, and source checkout’s top-level directory. Failed calls report the operation error.
72
+
73
+ #### Token effect
74
+
75
+ The schema has a fixed per-request cost while mounted. Each call appends its arguments and bounded creation result or error to ordinary tool history.
76
+
77
+ #### KV Cache effect
78
+
79
+ Unchanged tool schemas retain their existing prefix. Calls append after prior history; the working-directory service separately records the successful directory change for later requests.
80
+
81
+ ## Known Limitations and Deferred Work
82
+
83
+ <a id="known-limitations-and-deferred-work"></a>
84
+
85
+ - **Calling Agent required** — the tool changes a Session directory and rejects calls without an Agent.
86
+ - **Creation only** — inspection, merging, and checkout or branch removal are outside this tool; the [runtime limitations](../worktree/README.md#known-limitations-and-deferred-work) also apply.
87
+
88
+ <a id="dev-note"></a>
89
+ ### Dev Note
90
+
91
+ <details>
92
+ <summary>Working context for maintainers — click to expand</summary>
93
+
94
+ None.
95
+
96
+ </details>
package/README.zh.md ADDED
@@ -0,0 +1,96 @@
1
+ ---
2
+ description: "创建新的本地 Git 工作树并改变当前 Session 目录的模型工具。"
3
+ kind: "package-bundle"
4
+ ---
5
+
6
+ # @deepseek-ai/dsh-experimental-tool-worktree
7
+
8
+ [English](README.md) | 中文
9
+
10
+ ## 概述
11
+
12
+ 从 GUI 插件管理器添加 Git 工作树,让模型通过一次调用创建并进入新的 Git 工作树。此可选 bundle 随 Harness 安装,在选中之前保持关闭。原生工具调用与 PTC 程序获得相同的带类型结果,创建操作沿用现有文件策略。
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
+ 在 GUI 中打开**插件 → 官方 → Git 工作树**并启用开关。此 bundle 一起加载[工作树运行时](../worktree/README.zh.md)与本工具;所有随附 profile 默认关闭它。关闭后会移除 `create_worktree`,已有检出目录与分支会保留。内置 `working_directory` 工具仍然可用。
29
+
30
+ 在显式组合中,将此函数插件挂载到工作树运行时和工具注册表之后。
31
+
32
+ ```yaml
33
+ - name: '@deepseek-ai/dsh-experimental-worktree'
34
+ - name: '@deepseek-ai/dsh-experimental-tool-worktree'
35
+ ```
36
+
37
+ 调用 `create_worktree({ name?: string, from?: string })`。成功会返回规范化检出路径 `path`、新分支 `branch`、固定提交 `baseCommit` 和源仓库根目录 `repositoryRoot`,并改变调用 Session 的当前工作目录。离开时调用 `working_directory({ cd: path })`;检出目录与分支会保留。[生成的工具目录](../../../docs/tool-catalog.zh.md#deepseek-aidsh-experimental-tool-worktree)拥有准确的 schema 与面向模型的描述。
38
+
39
+ -----
40
+
41
+ <a id="understand-the-implementation"></a>
42
+ ## 了解实现
43
+
44
+ <details>
45
+ <summary>实现细节——点击展开</summary>
46
+
47
+ [`cordis.patch.yml`](cordis.patch.yml) 插入 `worktree` 运行时行与 `tool-worktree` 消费方行。[`src/index.ts`](src/index.ts) 注册一个带类型的工具。运行时创建操作拥有 Git 行为、取消处理与工作目录切换。工具将运行时记录作为规范返回值,并渲染为 JSON;Host 展示使用通用卡片。销毁插件会注销工具。
48
+
49
+ 本包不发布运行时不变量伴随入口,因为工具不保留独立于工作树运行时的状态。
50
+
51
+ </details>
52
+
53
+ -----
54
+
55
+ <a id="further-exploration"></a>
56
+ ## 深入探索
57
+
58
+ - [工作树运行时](../worktree/README.zh.md)——配置、创建语义与写权限。
59
+ - [工作目录](../../session/working-directory/README.zh.md)——Session 上下文与离开操作。
60
+ - [工具编写](../../../docs/cookbook/adding-a-tool.zh.md)——规范结果与纯展示函数。
61
+
62
+ -----
63
+
64
+ <a id="model-experience"></a>
65
+ ## 模型体验
66
+
67
+ ### 创建工具
68
+
69
+ #### 模型看到什么
70
+
71
+ [工具目录](../../../docs/tool-catalog.zh.md#deepseek-aidsh-experimental-tool-worktree)定义 `create_worktree`。每个成功结果包含已创建检出目录的规范路径、分支、基准提交与源检出目录的顶层目录。失败调用报告操作错误。
72
+
73
+ #### Token 影响
74
+
75
+ 挂载期间,schema 为每次请求带来固定成本。每次调用将参数与有界创建结果或错误追加到普通工具历史。
76
+
77
+ #### KV Cache 影响
78
+
79
+ 未改变的工具 schema 保留既有前缀。调用追加到先前历史之后;工作目录服务另行记录成功的目录切换,供后续请求使用。
80
+
81
+ ## 已知限制与待办工作
82
+
83
+ <a id="known-limitations-and-deferred-work"></a>
84
+
85
+ - **必须有调用 Agent**——工具改变 Session 目录,没有 Agent 的调用会被拒绝。
86
+ - **仅负责创建**——检查、合并、移除检出目录或删除分支不属于此工具;[运行时限制](../worktree/README.zh.md#known-limitations-and-deferred-work)同样适用。
87
+
88
+ <a id="dev-note"></a>
89
+ ### 开发备注
90
+
91
+ <details>
92
+ <summary>维护者的工作上下文——点击展开</summary>
93
+
94
+ 无。
95
+
96
+ </details>
@@ -0,0 +1,5 @@
1
+ - insert:
2
+ - id: worktree
3
+ name: '@deepseek-ai/dsh-experimental-worktree'
4
+ - id: tool-worktree
5
+ name: '@deepseek-ai/dsh-experimental-tool-worktree'
package/icon.svg ADDED
@@ -0,0 +1,18 @@
1
+ <svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g transform="translate(1.8 1.8) scale(0.9)">
3
+ <path d="M11 12V24M11 19H16C20.4 19 25 16.4 25 12" stroke="url(#worktree-branches)" stroke-width="3" />
4
+ <rect x="7.5" y="7" width="7" height="7" rx="2" fill="#86B8F5" />
5
+ <rect x="7.5" y="22" width="7" height="7" rx="2" fill="#5269E1" />
6
+ <rect x="21.5" y="7" width="7" height="7" rx="2" fill="url(#worktree-leaf)" />
7
+ </g>
8
+ <defs>
9
+ <linearGradient id="worktree-branches" x1="11" y1="12" x2="18" y2="24" gradientUnits="userSpaceOnUse">
10
+ <stop stop-color="#86B8F5" />
11
+ <stop offset="1" stop-color="#5269E1" />
12
+ </linearGradient>
13
+ <linearGradient id="worktree-leaf" x1="22" y1="7" x2="28" y2="14" gradientUnits="userSpaceOnUse">
14
+ <stop stop-color="#51CFDB" />
15
+ <stop offset="1" stop-color="#108792" />
16
+ </linearGradient>
17
+ </defs>
18
+ </svg>
package/lib/index.js ADDED
@@ -0,0 +1,66 @@
1
+ import { defineTool } from "@deepseek-ai/dsh-tools";
2
+ //#region lib/types/index.js
3
+ /** Model tool for creating and entering a new Git worktree through the shared runtime. */
4
+ /** Cordis plugin name. */
5
+ const name = "tool-worktree";
6
+ /** Services required to register and execute the worktree tool. */
7
+ const inject = ["tools", "worktrees"];
8
+ /**
9
+ * Register create_worktree for model and PTC callers.
10
+ * @param ctx - tool registry and worktree runtime.
11
+ */
12
+ function apply(ctx) {
13
+ ctx.tools.register(defineTool({
14
+ name: "create_worktree",
15
+ description: "Create a new Git branch and worktree from a local commit, branch, or tag, then change this session's working directory to it. Defaults to HEAD and a generated name. Uncommitted files stay in the source checkout. Existing names fail. Use working_directory with cd to leave; the checkout and branch remain.",
16
+ parameters: {
17
+ name: {
18
+ type: "string",
19
+ description: "New branch name, also used as the checkout directory. Omit to generate a unique name."
20
+ },
21
+ from: {
22
+ type: "string",
23
+ description: "Local commit, branch, or tag to start from. Defaults to HEAD; no fetch is performed."
24
+ }
25
+ },
26
+ output: {
27
+ schema: {
28
+ type: "object",
29
+ additionalProperties: false,
30
+ properties: {
31
+ path: {
32
+ type: "string",
33
+ required: true
34
+ },
35
+ branch: {
36
+ type: "string",
37
+ required: true
38
+ },
39
+ baseCommit: {
40
+ type: "string",
41
+ required: true
42
+ },
43
+ repositoryRoot: {
44
+ type: "string",
45
+ required: true
46
+ }
47
+ }
48
+ },
49
+ render: (_args, value) => [{
50
+ type: "text",
51
+ text: JSON.stringify(value)
52
+ }]
53
+ },
54
+ async execute(args, exec) {
55
+ if (exec.agent === void 0) throw new Error("create_worktree requires a calling agent");
56
+ return ctx.worktrees.create(exec.agent, args, exec.signal);
57
+ },
58
+ presentCall: (args) => ({
59
+ card: "generic",
60
+ title: "create_worktree",
61
+ rawInput: args
62
+ })
63
+ }));
64
+ }
65
+ //#endregion
66
+ export { apply, inject, name };
@@ -0,0 +1,12 @@
1
+ /** Model tool for creating and entering a new Git worktree through the shared runtime. */
2
+ import type { Context } from '@deepseek-ai/cordis';
3
+ /** Cordis plugin name. */
4
+ export declare const name = "tool-worktree";
5
+ /** Services required to register and execute the worktree tool. */
6
+ export declare const inject: string[];
7
+ /**
8
+ * Register create_worktree for model and PTC callers.
9
+ * @param ctx - tool registry and worktree runtime.
10
+ */
11
+ export declare function apply(ctx: Context): void;
12
+ //# sourceMappingURL=index.d.ts.map
package/locale/en.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Git Worktrees",
4
+ "description": "Let the agent create a new Git branch and worktree, then continue there."
5
+ }
6
+ }
package/locale/zh.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "meta": {
3
+ "title": "Git 工作树",
4
+ "description": "让智能体创建新的 Git 分支与工作树,并在其中继续工作。"
5
+ }
6
+ }
package/package.json CHANGED
@@ -1,6 +1,68 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-experimental-tool-worktree",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "description": "Model tool that creates and enters a new Git worktree",
4
+ "version": "0.2.1-alpha.3",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "type": "module",
9
+ "main": "lib/index.js",
10
+ "types": "lib/types/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./lib/types/index.d.ts",
14
+ "default": "./lib/index.js"
15
+ },
16
+ "./src/*": "./src/*",
17
+ "./package.json": "./package.json",
18
+ "./cordis.patch.yml": "./cordis.patch.yml",
19
+ "./locale/*.json": "./locale/*.json"
20
+ },
21
+ "files": [
22
+ "icon.svg",
23
+ "locale/*.json",
24
+ "lib/index.js",
25
+ "cordis.patch.yml",
26
+ "lib/types/**/*.d.ts"
27
+ ],
28
+ "license": "MIT",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
32
+ "directory": "packages/experimental/tool-worktree"
33
+ },
34
+ "peerDependencies": {
35
+ "@deepseek-ai/cordis": "~4.0.5-alpha.2",
36
+ "@deepseek-ai/dsh-tools": "0.2.1-alpha.3",
37
+ "@deepseek-ai/dsh-experimental-worktree": "0.2.1-alpha.3"
38
+ },
39
+ "devDependencies": {
40
+ "@deepseek-ai/cordis": "~4.0.5-alpha.2",
41
+ "@deepseek-ai/cordis-plugin-include": "~1.0.10-alpha.2",
42
+ "@deepseek-ai/cordis-plugin-loader": "~1.0.6-alpha.2",
43
+ "@deepseek-ai/dsh-agent": "0.2.1-alpha.3",
44
+ "@deepseek-ai/dsh-agent-loop-testkit": "0.2.1-alpha.3",
45
+ "@deepseek-ai/dsh-fs-local": "0.2.1-alpha.3",
46
+ "@deepseek-ai/dsh-llm": "0.2.1-alpha.3",
47
+ "@deepseek-ai/dsh-sandbox": "0.2.1-alpha.3",
48
+ "@deepseek-ai/dsh-sandbox-local": "0.2.1-alpha.3",
49
+ "@deepseek-ai/dsh-sandbox-policy": "0.2.1-alpha.3",
50
+ "@deepseek-ai/dsh-session": "0.2.1-alpha.3",
51
+ "@deepseek-ai/dsh-session-projection": "0.2.1-alpha.3",
52
+ "@deepseek-ai/dsh-subprocess-local": "0.2.1-alpha.3",
53
+ "@deepseek-ai/dsh-system-prompt": "0.2.1-alpha.3",
54
+ "@deepseek-ai/dsh-tools": "0.2.1-alpha.3",
55
+ "@deepseek-ai/dsh-working-directory": "0.2.1-alpha.3",
56
+ "@deepseek-ai/dsh-experimental-worktree": "0.2.1-alpha.3",
57
+ "@deepseek-ai/dsh-agent-loop": "0.2.1-alpha.3"
58
+ },
59
+ "icon": "./icon.svg",
60
+ "dsh": {
61
+ "bundle": {
62
+ "patch": "./cordis.patch.yml"
63
+ }
64
+ },
65
+ "dependencies": {
66
+ "@deepseek-ai/dsh-experimental-worktree": "0.2.1-alpha.3"
67
+ }
6
68
  }