Files
deepseek-harness/packages
Dudu-0223 6a4ee478d7 perf(client): optimize PTC definition complexity for Chat and Trajectory (#9387)
* perf(client): 让 PTC 嵌套分发折叠保持线性

客户端折叠会话历史时,updateDispatch 对每个 tool/ptc-dispatch-start 与
tool/ptc-dispatch 事件都用 findIndex 查找子调用、复制父调用的整个子节点
数组,并把全部父子关系复制进新的 Map。单个父调用下 n 个子调用因此是
O(n²):一个约 5 万事件、最大扇出约 2 万的 PTC 会话折叠要 8.9 秒,打开
会话时主线程被同步阻塞。

ToolState 改为按 parent/child id 索引的 DispatchTree,updateDispatch 就地
写入内层 Map(替换幂等、首次挂载定序),发布时 projectBlock 再物化数组,
发布出的工具调用树仍是不共享数组的不可变值。

conversation-fold 基准新增 ptc-dispatch-fan-out 用例:2 个根调用各结算
10,000 个嵌套子调用,参考机预期 100 ms(CI 预算 250 ms)。旧实现同一形状
在编译 worker 中耗时 9,295 ms,新实现 51–81 ms。

Refs #9385

* perf(client): 让 Trajectory 的 PTC 分发折叠保持线性

默认启用的 Trajectory Tool Definition 与修复前的 Chat 实现同构:每个
tool/ptc-dispatch[-start] 事件都 indexOf 查找子调用并复制调用 Map,首次挂载
时还复制子节点 Map、父节点 Map 和兄弟列表;根 tool/result 再复制调用 Map,
每次发布重建整棵投影树。Assembler 无论目标是否激活都会更新已注册的
Definition,所以即使只打开 Chat,2 个根调用各 10,000 个子调用的窗口也要
12,228 ms。

ToolState 改为持有就地更新的 DispatchTree(调用 Map、首次挂载顺序的子调用
id 列表、父节点 Map),每个事件 O(1);projectCall 增加按存储块、中断点和
子调用引用缓存的投影,未变化子树复用已发布对象,发布值不与树共享引用。

conversation-fold 的 ptc-dispatch-fan-out 用例在 worker 中注册 Trajectory
Tool Definition 与视图,并分别断言 Chat 与 Trajectory 目标的子调用数和
250 ms 预算。回退 Trajectory 实现时该用例超过 60 秒 worker 时限;修复后
Chat 63–72 ms,Trajectory 60–64 ms。

Refs #9385

* perf(client): 收紧 PTC 分发折叠的状态更新

按评审意见收紧 Chat 与 Trajectory 的 Tool Definition:

- updateDispatch 与 Trajectory 根 result 分支原地修改后返回同一 State,
  不再浅拷贝;start() 仍新建 State。ToolState 与 DispatchTree 去掉
  readonly,JSDoc 引用 Assembler 的 update() 规则,原因链接 Agent Note。
- 删除 Trajectory 的投影缓存及其身份用例,projectCall 与 master 一致,
  每次发布新建投影树。
- 基准两个目标共用一个预算常量,去掉 trajectoryViewDefinition 的类型断言。
- Agent Note 合并修复前后表格并更新为本次实测;统一负向对照数据,
  说明两种树布局的取舍,注明返回同一 State 参考了 #9400。

编译 worker 2×10,000:master 29,176 / 22,483 ms,修复后 58–63 / 53–59 ms
(激活 Chat / Trajectory);只回退 Chat 时门禁测得 9,073 ms 并失败。

Refs #9385
2026-11-27 16:12:10 +08:00
..
2026-11-25 12:16:22 +08:00
2026-11-22 15:27:28 +08:00
2026-11-22 15:27:28 +08:00
2026-11-22 15:27:28 +08:00
2026-11-22 15:27:28 +08:00
2026-11-25 12:16:22 +08:00
2026-11-22 15:27:28 +08:00
2026-11-25 12:16:22 +08:00
2026-11-22 15:27:28 +08:00
2026-11-22 15:27:28 +08:00
…

description, kind
description kind
The DeepSeek Harness package workspace: how the npm packages under packages/ are grouped, what each group owns, and the conventions that bind them. package-group

Packages

English | 中文

Summary

The harness is assembled from npm packages under packages/, grouped by capability family: sessions and the agent loop, model-facing tools, shell and filesystem execution, web access, subagents, and the rest. Use this page as the top-level map: find the owning group, then open its README for the package list. Every package is scoped @deepseek-ai/dsh-* and lives in exactly one group; each group README is the authoritative package map for its family.

Table of Contents


Package groups

Every package lives in exactly one group; new packages join existing groups, and a new group updates its own README and this table.

Group Role
core/ Product API spine: sessions, prompts, tools, agent services, and the concrete loop
api/ Remote BFF assembly and Typert RPC gateway
typert/ Type graph generation, artifact loading, and runtime registry
goal/ Same-session goal persistence and lifecycle
schedule/ Host-owned scheduled follow-ups
feedback/ Human feedback capture and command
telemetry/ Shared Cordis OTel reporting channels
identity/ Shared anonymous identity
llm/ LLM capability family: abstract service + provider adapters
subprocess/ Subprocess capability family: Service Definition + local process-tree provider
ssh/ POSIX remote connection with paired filesystem, subprocess and sandbox providers
shell/ Bash capability family: executor seam, local impl, model-facing tools
terminal/ Persistent PTY service with owner-scoped sessions and a local shell backend
ptc-runtime/ PTC execution capability family: Service Definition + sandboxed Node provider + PTC mode Consumer
computer-use/ Exclusive named desktop-provider registration
browser-use/ Exclusive named browser-provider registration
sandbox/ Process-confinement seam; bwrap/Landlock/Seatbelt backends
deliverables/ Turn deliverables: explicit file delivery and recorded workspace changes
fs/ Filesystem capability family: seam, local impl, model-facing file tools, discovery tools
lsp/ LSP capability family: seam, generic stdio provider, and the lsp tool
skill/ Skill capability family: provider registry, local provider, model-facing catalog/loader
connector/ Plugins connecting third-party services through existing capabilities
compaction/ Compaction capability family: Service Definition + basic provider + command Consumer
context/ Model-visible request context: workspace instructions, time context, references
subagent/ Subagent capability family: provider-registry contract and model-facing delegation tools
team/ Team coordination: shared task boards and model-facing task tools
jobs/ Generic background-job runtime and model-facing job control tools
experimental/ Capabilities under evaluation; status and support policy
workflow/ Workflow seam, PTC process engine, and the model-facing workflow tool
web/ Web capability family: seam, search/fetch providers, model-facing web tools
document/ Shared Host Office rendering, conversion, and recalculation, the Office tools, and Kit engine resolution
attachment/ Durable attachment identity, validation, local content-addressed storage
spill/ Spill capability family: storage seam, local impl, tool-result spill policy
todo/ The model-facing todo_write tool
plan/ Plan collaboration state with a direct entry command and reviewed exit
preset/ Per-session agent composition from preset cordis.yml files
guard/ Loop-hygiene guards: advisory repeat-call reminders + the tools/execute deadline enforcer
bundle/ Installable dsh --profile patch layers
extensions/ Agent runtime self-modification: live plugin/service inspection and model-written mount/unmount
mcp/ External Model Context Protocol servers exposed as native tools
session/ Durable session data plane: persistence seam + backends, projection seam, log-backed titles, session reporting
session-query/ Session retrieval family: logical corpus, bounded reads, lineage, semantic filtering, SQLite full-text search
settings/ User-settings seam + file-backed provider
credentials/ Credential-reference and credential-record seam + env-over-.env provider + authorization flows that ask a human
account/ DeepSeek account sign-in and Host-only request credentials
storage/ Non-session storage hub + backends + domain form
workspace/ Workspace entity
sdk/ Out-of-process SDK: JSON-RPC protocol and TypeScript client/server
acp/ Automation-only Agent Client Protocol server
interaction/ Human-collaboration plane: approval/interaction seams, permission preset, commands, ask-user tool
boot/ Shared app-bin boot glue
shared-texture/ Abstract Host shared-texture service, Client bridge plugin, and renderer bridge types
host/ Web GUI host services, directory picking, application launch, plugin inventory, and product telemetry
client/ Web-GUI browser half: shell, wire, object services, slots, ui-* plugins
test-support/ Test infrastructure (testkits, replay, Loader smokes)
util/ Low-level utilities and data-only package lists shared across groups (Branded<B>, home/path helpers, timeout, retention, official bundle lists)

Release expectations

Product groups have maintained product roles, while their public APIs remain pre-stable. Experimental status is independent of publication, installation, and optional delivery. Nonexperimental runtime packages must have product use or an explicit package classification; SDK, build, test, and declaration infrastructure have separate classifications.


Dependencies

The dependency graph is generated: docs/module-graph.md (pnpm run gen-module-graph, freshness-gated in CI).

Extension plugins depend on Service Definitions, never concrete providers. dsh-agent-loop is swappable; UI, hook, and tool plugins use dsh-agent. Composition bundles may depend on spine plugins. Capabilities separate Service Definition / Service Provider / Consumer roles when they evolve independently; see capability seams.


Package README contracts

Every package README covers purpose, configuration, extension points, and Model Experience unless the model-agnostic omission allowlist exempts it. It also carries ## Known Limitations and Deferred Work or uses its allowlist. Package conventions — exports, service access, tests — live in packages/AGENTS.md.


Dev Note

Working context for maintainers — click to expand

None.