Files
deepseek-harness/packages/session/README.zh.md
T
LegGasai 328d6204a8 refactor(working-directory): converge on one directory read
`get(session)` is the only read of a Session's directory again. `rootOf` and
the `workspaceRoot` projection are removed: the directory relative paths
resolve from is the workspace root.

The difference the second read expressed lives in the `workingDirectory` fold.
`workspace-root/change`, the event Host moves record, sets the directory. A
stored `working-directory/change`, whose directory the model could choose, sets
it only when the directory lies inside the Session's original project; a
directory outside the project returns the Session to the project, and the next
request's context reports it. The fold state gains the original project, so
its state version is 2. The forge worktree fold reads stored changes by the
same rule.

The subagent manager resolves a child's directory as on master. The compaction
snapshot fixture records its fixed directory as a Host move.
2026-11-16 21:36:30 +08:00

5.8 KiB

description, kind
description kind
持久会话数据平面的包映射:持久化 seam 及其后端、检查点策略、投影、基于日志的标题与外发会话遥测。 package-group

session/ — 持久会话数据平面

English | 中文

概述

session 组让对话持久保存,恢复已发布的日志格式,并使已提交历史在重启后仍可用。存储与检查点包保护请求、工具副作用和已完成步骤;投影包生成客户端可用的值;标题包为会话命名;遥测包上报活动。先使用随产品交付的 JSONL 存储,再添加检查点,并仅按部署需要添加投影、标题策略或遥测。每个包 README 负责各自的保证与配置,同级查询组则提供独立的读取和工具访问。

目录


包

本组分为四个家族:持久存储(持久化 seam、后端、检查点策略)、投影、标题与遥测。每个包 README 负责各自的约定与配置。

持久化

包 职责 ctx key
message-quotes/ 引用控件与 Markdown blockquote 渲染 —
session-format/ 纯相邻格式链与产物校验库 库,不使用 ctx key
session-format-v0-to-v1/ 冻结的 released-v0 解码器,以及到 released v1 的恒等迁移 库,不使用 ctx key
session-format-v1-to-v2/ 冻结的 released-v1 解码器,以及迁移到 released v2 时会改变基数的 Assistant 流迁移 库,不使用 ctx key
session-format-v2-to-v3/ 冻结的 V2 解码器,以及迁入 V3 的系统提示词、信封与 PTC 转换 库——无 ctx 键
session-format-v3-to-v4/ V3 恒等迁移与 V4 编解码器,按 generation 校验 delivery 库——无 ctx 键
session-format-catalog/ 自动生成的已交付相邻迁移静态目录 库,不使用 ctx key
session-persistence/ 定义持久会话存储服务,以及每个后端组合的共享写入协调机制 ctx.sessionPersistence
session-persistence-jsonl/ 随产品交付的后端:逐 Session 使用不可变规范 generation 文件名并排他发布后继;可选 Zstandard 压缩 注册到 ctx.sessionPersistence
session-checkpoint-policy/ 让模型请求、顶层工具副作用与已完成步骤在下一步动作前持久化 包装 ctx.llm 与 ctx.tools
session-log-deepseek/ 把增量规范日志作为可选的官方 DeepSeek 请求元数据上传 贡献 dsh_session_log

投影

包 职责 ctx key
session-projection/ 定义并驱动把已提交事件折叠为完整当前值的投影单元 ctx.sessionProjections
working-directory/ 拥有每个 Session 的有效执行目录和用户上下文变更 ctx.workingDirectory
session-projection-cache/ 持久化投影检查点,使冷读跳过全量日志加载 ctx.sessionProjectionCache
session-stats/ 通过 sessionStats 单元提供全日志会话计数与墙钟时间 注册到 ctx.sessionProjections
session-turn-outline/ 通过 turnOutline 单元提供全日志轮次大纲(轮次、turn/start seq、提示词预览) 注册到 ctx.sessionProjections

标题

包 职责 ctx key
session-title/ 基于日志的会话标题,带确定性回退与一个可选提供方 ctx.sessionTitle
session-title-llm/ 为提供方自有的标题策略提供的共享有界执行 库,不使用 ctx key
session-title-first-prompt-llm/ 根据第一条合格的人类消息为会话生成标题 注册到 ctx.sessionTitle

遥测

包 职责 ctx key
session-telemetry/ 捕获会话活动并把记录交给配置的上报后端 ctx.sessionTelemetry
session-telemetry-otel/ 通过 OpenTelemetry 日志以 FEEDBACK_ONLY 或 DISABLED 模式投递遥测 注册到 ctx.sessionTelemetry

同一时间只允许一个标题提供方注册;未注册时,标题服务保留其确定性回退。下面的子系统页面是各家族后端无关的参考资料。


相关文档

实验性可选能力见 session-title-all-prompts-llm。

开发备注

无。