@deepseek-ai/dsh-session-persistence 0.1.2-alpha.2 → 0.1.2-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/README.i18n.yaml +2 -2
- package/README.md +3 -4
- package/README.zh.md +3 -4
- package/lib/types/coordinator.d.ts +2 -2
- package/lib/types/index.d.ts +6 -6
- package/package.json +11 -11
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/session/session-persistence/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 687241c604254152538e152a62d0c78b31369cf3
|
|
6
|
+
README.zh.md: 170f194c247bf680db554c4ecb2beca97184ff0b
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
|
|
|
9
9
|
|
|
10
10
|
## Summary
|
|
11
11
|
|
|
12
|
-
`dsh-session-persistence` stores a session's event log durably, reloads it on resume, and lists stored sessions through
|
|
12
|
+
`dsh-session-persistence` stores a session's event log durably, reloads it on resume, and lists stored sessions through the backend-neutral `ctx.sessionPersistence` service. The persisted unit is the existing `SessionEvent` log — there is no parallel stored message type — and non-replayable metadata (format version, working directory, lineage, seed boundary) travels separately as `SessionHeader`. A backend owns its storage, while the service owns append-only logs, contiguous sequence numbers, crash recovery that preserves an interrupted turn instead of truncating it, and durable writes that resolve only after the batch is safe. The shipped JSONL provider implements this service with one artifact per Session; third-party providers may implement the same contract without changing the loop or model.
|
|
13
13
|
|
|
14
14
|
## Table of Contents
|
|
15
15
|
|
|
@@ -29,7 +29,7 @@ Mount one persistence backend to make sessions durable. The backend registers it
|
|
|
29
29
|
|
|
30
30
|
### Choosing a backend
|
|
31
31
|
|
|
32
|
-
The seam ships
|
|
32
|
+
The seam ships the [JSONL](../session-persistence-jsonl/README.md) backend. It stores one append-only `.jsonl.zstd` artifact per Session and returns its absolute path from `locate(meta)`. A third-party backend may implement the service directly; the [backend contract](#understand-the-implementation) below is what it must honor.
|
|
33
33
|
|
|
34
34
|
### What the service provides
|
|
35
35
|
|
|
@@ -65,7 +65,7 @@ This section explains how the seam realizes durable storage and how backends plu
|
|
|
65
65
|
|
|
66
66
|
### Design concept
|
|
67
67
|
|
|
68
|
-
The package is the Service Definition of a capability seam with two halves. The abstract `SessionPersistence` service is the public contract; a `PersistenceCoordinator` provides backend-neutral orchestration for buffering, serialization, materialization, repair, adoption, and quiescent disposal.
|
|
68
|
+
The package is the Service Definition of a capability seam with two halves. The abstract `SessionPersistence` service is the public contract; a `PersistenceCoordinator` provides backend-neutral orchestration for buffering, serialization, materialization, repair, adoption, and quiescent disposal. The JSONL provider implements the small durable primitives for stored reads, append, repair, and listing; a third-party provider may reuse the same coordinator or implement the service directly.
|
|
69
69
|
|
|
70
70
|
### The invariants every backend honors
|
|
71
71
|
|
|
@@ -103,7 +103,6 @@ Read these pages when the package-level contract is not enough. They move from t
|
|
|
103
103
|
|
|
104
104
|
- [Session persistence subsystem](../../../docs/subsystems/persistence.md) — the full service contract, flush checkpoint, crash recovery, and generated Cordis API.
|
|
105
105
|
- [JSONL persistence backend](../session-persistence-jsonl/README.md) — the shipped per-session-file backend.
|
|
106
|
-
- [SQLite persistence backend](../session-persistence-sqlite/README.md) — the opt-in single-database backend.
|
|
107
106
|
- [Session checkpoint policy](../session-checkpoint-policy/README.md) — the plugin that flushes through this service at semantic boundaries.
|
|
108
107
|
- [Session package map](../README.md) — adjacent persistence, projection, title, and telemetry packages.
|
|
109
108
|
|
package/README.zh.md
CHANGED
|
@@ -9,7 +9,7 @@ kind: "package-reference"
|
|
|
9
9
|
|
|
10
10
|
## 概述
|
|
11
11
|
|
|
12
|
-
`dsh-session-persistence`
|
|
12
|
+
`dsh-session-persistence` 通过后端无关的 `ctx.sessionPersistence` 服务持久存储会话的事件日志、在恢复时重新加载并列出已存储会话。持久化单元就是现有 `SessionEvent` 日志——不存在另一套并行的存储消息类型——不可回放的元数据(格式版本、工作目录、血缘、种子边界)作为 `SessionHeader` 单独传输。后端拥有自己的存储,而服务拥有仅追加日志、连续序列号、保留中断轮次而非截断的崩溃恢复,以及只在批次安全后才返回的持久写入。随产品交付的 JSONL provider 用每个 Session 一份产物实现该服务;第三方 provider 可以实现同一约定,而不改变 loop 或模型。
|
|
13
13
|
|
|
14
14
|
## 目录
|
|
15
15
|
|
|
@@ -29,7 +29,7 @@ kind: "package-reference"
|
|
|
29
29
|
|
|
30
30
|
### 选择后端
|
|
31
31
|
|
|
32
|
-
seam
|
|
32
|
+
seam 随产品交付 [JSONL](../session-persistence-jsonl/README.zh.md) 后端。它把每个 Session 存为一份仅追加 `.jsonl.zstd` 产物,并由 `locate(meta)` 返回绝对路径。第三方后端可以直接实现该服务;必须遵守的[后端约定](#understand-the-implementation)见下文。
|
|
33
33
|
|
|
34
34
|
### 服务提供什么
|
|
35
35
|
|
|
@@ -65,7 +65,7 @@ const headers = await ctx.sessionPersistence.list() // every stored sessi
|
|
|
65
65
|
|
|
66
66
|
### 设计理念
|
|
67
67
|
|
|
68
|
-
本包是能力 seam 的 Service Definition,分两半。抽象的 `SessionPersistence` 服务是公开约定;`PersistenceCoordinator` 为缓冲、串行化、物化、修复、接管与完全停稳的 dispose
|
|
68
|
+
本包是能力 seam 的 Service Definition,分两半。抽象的 `SessionPersistence` 服务是公开约定;`PersistenceCoordinator` 为缓冲、串行化、物化、修复、接管与完全停稳的 dispose 提供后端无关编排。JSONL provider 实现存储读取、追加、修复与列出所需的小型持久原语;第三方 provider 可以复用同一 coordinator,也可以直接实现该服务。
|
|
69
69
|
|
|
70
70
|
### 每个后端必须遵守的不变量
|
|
71
71
|
|
|
@@ -103,7 +103,6 @@ const headers = await ctx.sessionPersistence.list() // every stored sessi
|
|
|
103
103
|
|
|
104
104
|
- [会话持久化子系统](../../../docs/subsystems/persistence.zh.md)——完整服务约定、flush 检查点、崩溃恢复与生成的 Cordis API。
|
|
105
105
|
- [JSONL 持久化后端](../session-persistence-jsonl/README.zh.md)——随产品交付、按会话存储文件的后端。
|
|
106
|
-
- [SQLite 持久化后端](../session-persistence-sqlite/README.zh.md)——可选启用的单数据库后端。
|
|
107
106
|
- [会话检查点策略](../session-checkpoint-policy/README.zh.md)——在语义边界上经由本服务刷新的插件。
|
|
108
107
|
- [会话包映射](../README.zh.md)——相邻的持久化、投影、标题与遥测包。
|
|
109
108
|
|
|
@@ -119,8 +119,8 @@ export interface PersistenceBackend<TornMarker = unknown> {
|
|
|
119
119
|
/**
|
|
120
120
|
* Optional seek-capable suffix read behind the service's `readFrom`: return
|
|
121
121
|
* the header plus the stored events with `seq >= fromSeq` without reading
|
|
122
|
-
* the whole log. A backend whose medium can address events by seq
|
|
123
|
-
*
|
|
122
|
+
* the whole log. A backend whose medium can address events by seq implements
|
|
123
|
+
* this so `readFrom` scales with the suffix; sequential backends
|
|
124
124
|
* omit it and the coordinator falls back to {@link loadStored} plus a
|
|
125
125
|
* forward skip. Non-mutating (no truncation, no closers). Validation of the
|
|
126
126
|
* region strictly below `fromSeq` is limited to seq contiguity — the
|
package/lib/types/index.d.ts
CHANGED
|
@@ -78,8 +78,8 @@ export declare abstract class SessionPersistence extends Service {
|
|
|
78
78
|
constructor(ctx: Context);
|
|
79
79
|
/**
|
|
80
80
|
* Resolve this backend's independent local artifact for a session without
|
|
81
|
-
* reading, creating, flushing, or otherwise materializing it.
|
|
82
|
-
*
|
|
81
|
+
* reading, creating, flushing, or otherwise materializing it. A backend
|
|
82
|
+
* that does not own one artifact per Session returns `undefined`.
|
|
83
83
|
* @param meta - the immutable session header whose artifact is requested.
|
|
84
84
|
* @returns the backend-specific absolute location, when one exists.
|
|
85
85
|
*/
|
|
@@ -189,10 +189,10 @@ export declare abstract class SessionPersistence extends Service {
|
|
|
189
189
|
* publication. Only events from the valid contiguous stored prefix are
|
|
190
190
|
* returned, so a torn fragment never reaches the caller. `fromSeq` at or
|
|
191
191
|
* beyond the stored prefix returns an empty event list (never an error).
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
192
|
+
* A backend whose medium can seek by seq may read only the suffix;
|
|
193
|
+
* sequential media such as JSONL still parse the whole artifact and skip
|
|
194
|
+
* forward. The primitive bounds what is returned and refolded, not every
|
|
195
|
+
* backend's physical read.
|
|
196
196
|
* @param id - the persisted session to read.
|
|
197
197
|
* @param fromSeq - first event seq to include; a non-negative safe integer.
|
|
198
198
|
* @param signal - optional cancellation for queued and backend read work.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-session-persistence",
|
|
3
3
|
"description": "Abstract durable session persistence seam (ctx.sessionPersistence) for the DeepSeek Harness",
|
|
4
|
-
"version": "0.1.2-alpha.
|
|
4
|
+
"version": "0.1.2-alpha.3",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -33,20 +33,20 @@
|
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
36
|
-
"@deepseek-ai/dsh-brand": "^0.1.2-alpha.
|
|
37
|
-
"@deepseek-ai/dsh-invariants": "^0.1.2-alpha.
|
|
38
|
-
"@deepseek-ai/dsh-session": "^0.1.2-alpha.
|
|
39
|
-
"@deepseek-ai/dsh-timeout": "^0.1.2-alpha.
|
|
36
|
+
"@deepseek-ai/dsh-brand": "^0.1.2-alpha.3",
|
|
37
|
+
"@deepseek-ai/dsh-invariants": "^0.1.2-alpha.3",
|
|
38
|
+
"@deepseek-ai/dsh-session": "^0.1.2-alpha.3",
|
|
39
|
+
"@deepseek-ai/dsh-timeout": "^0.1.2-alpha.3"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
43
|
-
"@deepseek-ai/dsh-
|
|
44
|
-
"@deepseek-ai/dsh-
|
|
45
|
-
"@deepseek-ai/dsh-
|
|
46
|
-
"@deepseek-ai/dsh-session": "^0.1.2-alpha.
|
|
47
|
-
"@deepseek-ai/dsh-timeout": "^0.1.2-alpha.
|
|
43
|
+
"@deepseek-ai/dsh-brand": "^0.1.2-alpha.3",
|
|
44
|
+
"@deepseek-ai/dsh-invariants": "^0.1.2-alpha.3",
|
|
45
|
+
"@deepseek-ai/dsh-scope": "^0.1.2-alpha.3",
|
|
46
|
+
"@deepseek-ai/dsh-session": "^0.1.2-alpha.3",
|
|
47
|
+
"@deepseek-ai/dsh-timeout": "^0.1.2-alpha.3"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@deepseek-ai/dsh-util-values": "^0.1.2-alpha.
|
|
50
|
+
"@deepseek-ai/dsh-util-values": "^0.1.2-alpha.3"
|
|
51
51
|
}
|
|
52
52
|
}
|