refactor(working-directory): move the workspace only through Host operations

Remove the model-facing working_directory tool and the cwd parameter of the
subagent tools, so only Host operations move a Session's directory. Every
change the service records carries `workspace: true`, and the workspace root
is the directory of the last marked change, or the original project. The
anchor field, the anchor list, relocate, inherit, and anchorsOf are gone;
get, ensure, set, and rootOf remain.

A change without the marker, recorded while the model could move the
directory, moves only the current directory, so stored Sessions keep the
root they had.

- worktree: create enters the checkout through set; exit returns the Session
  to the source checkout of the recorded worktree that contains its directory,
  and exit_worktree exposes it to the model.
- subagent: a child starts in the parent's workspace root or a Host-chosen
  directory through set.
- SDK: the working-directory methods return { cwd } again and
  getWorkspaceRoot / get_workspace_root are removed.
- Recorded sessions: the worktree scenario leaves through exit_worktree and
  covers recovery from a removed worktree; the two scenarios that only drove
  the removed tool are deleted; three compaction scenarios lower their tuned
  context window by the removed tool-schema tokens.
This commit is contained in:
LegGasai committed 2026-11-11 20:10:17 +08:00
1 parent 5db7347a83
commit ed30d274f1
308 files changed
+1062 -4371

No files matched your search

+2 -2
View File
@@ -6,8 +6,8 @@
en: c97ffc5ce0f7db05
zh: bdd91202075498a3
/python-sdk-example/run-the-minimal-agent:
en: ac09bb6bc3ab76a0
zh: e69d1e2bd796f3bf
en: 9807fc909be30878
zh: 9cef470f85212250
/python-sdk-example/compact-a-full-sdk-session:
en: 6325ac9aaf9b9b67
zh: 004a0ba5c2ff341b
-1
View File
@@ -23,7 +23,6 @@ The shipped [`@deepseek-ai/dsh-sdk-minimal` bundle](../../../packages/bundle/sdk
- owner-scoped persistent `bash` on Linux/macOS or `pwsh` on Windows
- `read_image` for PNG/JPEG/WebP/GIF files, with an image-capable model
- `working_directory` to inspect or change the Session directory
The bundle does not include `dsh-base`, so every additional row is an explicit profile change. Runtime context, text file tools, local instruction discovery, settings, managed credentials, telemetry, Web tools, subagents, and the full default tool roster are absent. The tree retains SDK startup and JSON-RPC serving, one environment-configured DeepSeek adapter, local execution, and JSONL persistence. [Automatic context compaction](../../../packages/bundle/sdk-minimal/README.md#model-experience) summarizes older history through an additional model request while preserving the complete log. This minimal composition leaves unsupported slash input on the ordinary prompt path.
-1
View File
@@ -23,7 +23,6 @@ python python/sdk/examples/minimal.py \
- Linux/macOS 上所有者作用域内的持久 `bash`,或 Windows 上的 `pwsh`
- 配合支持图片输入的模型读取 PNG/JPEG/WebP/GIF 文件的 `read_image`
- 查询或修改 Session 目录的 `working_directory`
该组合包不包含 `dsh-base`,因此每一个新增配置项都是显式 profile 变更。运行时上下文、文本文件工具、本地指令发现、设置、托管凭据、遥测、Web 工具、subagent 与完整默认工具清单均不存在。配置树保留 SDK 启动与 JSON-RPC 服务、一个由环境配置的 DeepSeek 适配器、本地执行和 JSONL 持久化。[自动上下文压缩](../../../packages/bundle/sdk-minimal/README.zh.md#model-experience)通过额外模型请求生成较早历史的摘要,同时保留完整日志。这个最小组合将不支持的斜杠输入保留在普通提示词路径上。