@deepseek-ai/dsh-session-projection-cache 0.1.2-alpha.3 → 0.1.2-alpha.4
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 -3
- package/README.zh.md +3 -3
- package/lib/index.js +36 -19
- package/lib/types/index.d.ts +7 -4
- package/lib/types/spec.d.ts +10 -3
- package/package.json +11 -18
- package/lib/invariant.js +0 -28
- package/lib/types/invariant.d.ts +0 -16
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-projection-cache/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 51b9d86724af96304cf09a5c7c1b61b7394d336a
|
|
6
|
+
README.zh.md: bb84b67bdde678884fd4f2be1b14b2161da8c2a0
|
package/README.md
CHANGED
|
@@ -58,11 +58,11 @@ Three mandatory points always write: session creation persists the seed-derived
|
|
|
58
58
|
|
|
59
59
|
### Reading cached values
|
|
60
60
|
|
|
61
|
-
`cachedSnapshot(meta)` synchronously serves client values from the storage domain's in-memory tables with zero I/O. It accepts only an identity-matching record and version- and schema-matching keys, then returns a `{ asOfSeq, values }` cut at the lowest served-row watermark.
|
|
61
|
+
`cachedSnapshot(meta, inheritedEventCount)` synchronously serves client values from the storage domain's in-memory tables with zero I/O. It accepts only an identity-matching record and version- and schema-matching keys, then returns a `{ asOfSeq, values }` cut at the lowest served-row watermark. An unseeded listing knows that its cut is zero; a seeded header-only listing does not know the numeric cut and must skip this fast path until an authoritative body read supplies it. `coldSnapshot(meta, inheritedEventCount, events)` accepts the exact cut with a complete ordered log, skips the checkpointed prefix while folding, and refreshes the record without reading persistence itself.
|
|
62
62
|
|
|
63
63
|
### What the cache guarantees
|
|
64
64
|
|
|
65
|
-
The log leads and the cache follows: a live checkpoint flushes the session's buffered events durably before the cache row lands, so a crash can leave the cache behind the log but never ahead of it. Reads and writes share the storage domain's coherent in-memory state; the per-unit write chain mutates memory only after durability. Each version-stamped record must match the live unit schema and
|
|
65
|
+
The log leads and the cache follows: a live checkpoint flushes the session's buffered events durably before the cache row lands, so a crash can leave the cache behind the log but never ahead of it. Reads and writes share the storage domain's coherent in-memory state; the per-unit write chain mutates memory only after durability. Each version-stamped record must match the live unit schema and complete lifecycle identity (`createdAt`, `cwd`, `isSeeded`, and `inheritedEventCount`), so a row initialized under one fork cut cannot seed another. The JSON backend stores each record at `<root>/session_projcache/sessions/<id>.json` in an owner-only directory tree.
|
|
66
66
|
|
|
67
67
|
-----
|
|
68
68
|
|
|
@@ -88,7 +88,7 @@ The cache stores one version-stamped document per session in the `session_projca
|
|
|
88
88
|
|---|---|
|
|
89
89
|
| [`src/index.ts`](src/index.ts) | Plugin entry: `SessionProjectionCache` service, write-behind listeners, cache reads |
|
|
90
90
|
| [`src/spec.ts`](src/spec.ts) | The `session_projcache` domain spec and record identity types |
|
|
91
|
-
|
|
|
91
|
+
| — | No runtime invariant companion is published; the cache's correctness relation (a stored row equals the registry fold at its `seq` watermark) is only checkable by re-running the fold over the persisted log — duplicating the implementation rather than detecting drift — and its staleness is by design (fail-soft writes). The durable boundary is schema-validated by the cache's own zod parse on every read, and the read ladder's version/watermark guards are proven by the package spec. |
|
|
92
92
|
|
|
93
93
|
</details>
|
|
94
94
|
|
package/README.zh.md
CHANGED
|
@@ -58,11 +58,11 @@ kind: "package-reference"
|
|
|
58
58
|
|
|
59
59
|
### 读取缓存值
|
|
60
60
|
|
|
61
|
-
`cachedSnapshot(meta)` 以零 I/O 从存储域的内存表同步提供客户端值。它只接受身份匹配的记录以及版本和 schema 均匹配的 key,再按所服务行的最低水位返回 `{ asOfSeq, values }`
|
|
61
|
+
`cachedSnapshot(meta, inheritedEventCount)` 以零 I/O 从存储域的内存表同步提供客户端值。它只接受身份匹配的记录以及版本和 schema 均匹配的 key,再按所服务行的最低水位返回 `{ asOfSeq, values }` 切面。未 seeded 的列表知道切点为零;仅 header 的 seeded 列表不知道数字切点,必须跳过该快速路径,直到权威正文读取提供它。`coldSnapshot(meta, inheritedEventCount, events)` 接受精确切点与完整有序日志,在折叠时跳过已检查点化的前缀,并在自身不读取持久化层的情况下刷新记录。
|
|
62
62
|
|
|
63
63
|
### 缓存保证什么
|
|
64
64
|
|
|
65
|
-
日志领先,缓存跟随:实时检查点先把会话的缓冲事件持久化,然后才保存缓存记录。因此崩溃可能让缓存落后于日志,但绝不会让缓存领先。读取和写入共享存储域内一致的内存状态;逐单元写入链只在持久化成功后修改内存。每个带版本戳的记录必须匹配实时单元 schema
|
|
65
|
+
日志领先,缓存跟随:实时检查点先把会话的缓冲事件持久化,然后才保存缓存记录。因此崩溃可能让缓存落后于日志,但绝不会让缓存领先。读取和写入共享存储域内一致的内存状态;逐单元写入链只在持久化成功后修改内存。每个带版本戳的记录必须匹配实时单元 schema 与完整生命周期身份(`createdAt`、`cwd`、`isSeeded` 和 `inheritedEventCount`),因此在一个 fork 切点下初始化的行不能播种另一个切点。JSON 后端把每条记录存于仅所有者可访问的 `<root>/session_projcache/sessions/<id>.json` 目录树中。
|
|
66
66
|
|
|
67
67
|
-----
|
|
68
68
|
|
|
@@ -88,7 +88,7 @@ kind: "package-reference"
|
|
|
88
88
|
|---|---|
|
|
89
89
|
| [`src/index.ts`](src/index.ts) | 插件入口:`SessionProjectionCache` 服务、写后监听器、缓存读取 |
|
|
90
90
|
| [`src/spec.ts`](src/spec.ts) | `session_projcache` 域 spec 与记录身份类型 |
|
|
91
|
-
|
|
|
91
|
+
| — | 不发布运行时不变式伴生入口;正确性在写入与读取路径强制。 |
|
|
92
92
|
|
|
93
93
|
</details>
|
|
94
94
|
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Service } from "@deepseek-ai/cordis";
|
|
2
2
|
import z from "@deepseek-ai/schemastery";
|
|
3
3
|
import { snapshotJsonValue } from "@deepseek-ai/dsh-util-values";
|
|
4
|
+
import { SessionLogOffset, SessionSeq } from "@deepseek-ai/dsh-session";
|
|
4
5
|
import { z as z$1 } from "zod";
|
|
5
6
|
import { defineDomain, domainTable } from "@deepseek-ai/dsh-storage-domain";
|
|
6
7
|
//#region lib/types/spec.js
|
|
@@ -25,7 +26,7 @@ import { defineDomain, domainTable } from "@deepseek-ai/dsh-storage-domain";
|
|
|
25
26
|
*/
|
|
26
27
|
const checkpointRow = z$1.object({
|
|
27
28
|
ver: z$1.number().int().nonnegative(),
|
|
28
|
-
seq: z$1.number().int().gte(-1),
|
|
29
|
+
seq: z$1.number().int().gte(-1).transform((value) => value === -1 ? -1 : SessionSeq(value)),
|
|
29
30
|
val: z$1.json()
|
|
30
31
|
});
|
|
31
32
|
/**
|
|
@@ -39,7 +40,9 @@ const checkpointRow = z$1.object({
|
|
|
39
40
|
*/
|
|
40
41
|
const checkpointIdentity = z$1.object({
|
|
41
42
|
createdAt: z$1.number().int().nonnegative(),
|
|
42
|
-
cwd: z$1.string().optional()
|
|
43
|
+
cwd: z$1.string().optional(),
|
|
44
|
+
isSeeded: z$1.boolean(),
|
|
45
|
+
inheritedEventCount: z$1.number().int().nonnegative().transform(SessionLogOffset)
|
|
43
46
|
});
|
|
44
47
|
/**
|
|
45
48
|
* One session's stored record: the log identity it was folded from plus its
|
|
@@ -60,7 +63,7 @@ const checkpointRecord = z$1.object({
|
|
|
60
63
|
*/
|
|
61
64
|
const projectionCacheDomainSpec = defineDomain({
|
|
62
65
|
name: "session_projcache",
|
|
63
|
-
version:
|
|
66
|
+
version: 5,
|
|
64
67
|
layout: "per-record",
|
|
65
68
|
tables: { sessions: domainTable(checkpointRecord) }
|
|
66
69
|
});
|
|
@@ -143,18 +146,27 @@ var SessionProjectionCache = class extends Service {
|
|
|
143
146
|
* paths (the history tail baseline) supersede these values whenever a
|
|
144
147
|
* session is actually opened.
|
|
145
148
|
* @param meta - the listed session's header (identity witness; no log read).
|
|
149
|
+
* @param inheritedEventCount - exact inherited prefix length that completes
|
|
150
|
+
* the checkpoint identity.
|
|
146
151
|
* @param keys - optional projection keys required by the caller's audience.
|
|
147
152
|
* @returns the cut (`asOfSeq` = lowest served-row watermark), or
|
|
148
153
|
* `undefined` when no usable row exists for this lifecycle.
|
|
149
154
|
*/
|
|
150
|
-
cachedSnapshot(meta, keys) {
|
|
151
|
-
const record = this.recordFor(meta.id, identityOf(meta));
|
|
155
|
+
cachedSnapshot(meta, inheritedEventCount, keys) {
|
|
156
|
+
const record = this.recordFor(meta.id, identityOf(meta, inheritedEventCount));
|
|
152
157
|
if (record === void 0) return void 0;
|
|
153
158
|
const values = this.ctx.sessionProjections.viewCheckpoint(record.rows, keys);
|
|
154
159
|
const servedKeys = Object.keys(values);
|
|
155
160
|
if (servedKeys.length === 0) return void 0;
|
|
161
|
+
let asOfSeq;
|
|
162
|
+
for (const key of servedKeys) {
|
|
163
|
+
const row = record.rows[key];
|
|
164
|
+
if (row !== void 0 && (asOfSeq === void 0 || row.seq < asOfSeq)) asOfSeq = row.seq;
|
|
165
|
+
}
|
|
166
|
+
/* v8 ignore next -- A nonempty checkpoint view contains a stored row for every returned key. */
|
|
167
|
+
if (asOfSeq === void 0) return void 0;
|
|
156
168
|
return {
|
|
157
|
-
asOfSeq
|
|
169
|
+
asOfSeq,
|
|
158
170
|
values
|
|
159
171
|
};
|
|
160
172
|
}
|
|
@@ -164,17 +176,16 @@ var SessionProjectionCache = class extends Service {
|
|
|
164
176
|
* advances every unit to the observation cut. No checkpoint is written
|
|
165
177
|
* because the logical observation may contain recovery events not yet durable.
|
|
166
178
|
* @param session - exact unpublished Session retained by persistence.
|
|
167
|
-
* @param meta - observed lifecycle header.
|
|
168
179
|
* @param events - exact logical event prefix represented by the observation.
|
|
169
180
|
* @returns all projection values at the event cut.
|
|
170
181
|
*/
|
|
171
|
-
hydratePrepared(session,
|
|
172
|
-
const record = this.recordFor(
|
|
173
|
-
if (record === void 0) return this.ctx.sessionProjections.hydrate(session, {}, events, 0);
|
|
182
|
+
hydratePrepared(session, events) {
|
|
183
|
+
const record = this.recordFor(session.id, identityOf(session.header, session.inheritedEventCount));
|
|
184
|
+
if (record === void 0) return this.ctx.sessionProjections.hydrate(session, {}, events, SessionLogOffset(0));
|
|
174
185
|
try {
|
|
175
|
-
return this.ctx.sessionProjections.hydrate(session, record.rows, events, 0);
|
|
186
|
+
return this.ctx.sessionProjections.hydrate(session, record.rows, events, SessionLogOffset(0));
|
|
176
187
|
} catch {
|
|
177
|
-
return this.ctx.sessionProjections.hydrate(session, {}, events, 0);
|
|
188
|
+
return this.ctx.sessionProjections.hydrate(session, {}, events, SessionLogOffset(0));
|
|
178
189
|
}
|
|
179
190
|
}
|
|
180
191
|
/**
|
|
@@ -190,7 +201,7 @@ var SessionProjectionCache = class extends Service {
|
|
|
190
201
|
const rows = this.ctx.sessionProjections.checkpoint(session);
|
|
191
202
|
this.markClean(session);
|
|
192
203
|
if (this.ctx.sessions.get(session.id) === session) await this.ctx.sessions.flush(session);
|
|
193
|
-
await this.put(session.id, identityOf(session.header), rows);
|
|
204
|
+
await this.put(session.id, identityOf(session.header, session.inheritedEventCount), rows);
|
|
194
205
|
}
|
|
195
206
|
/**
|
|
196
207
|
* Cold-read one session's projections from its complete log. Each unit is
|
|
@@ -201,12 +212,14 @@ var SessionProjectionCache = class extends Service {
|
|
|
201
212
|
* The caller supplies the complete log in seq order: this service never
|
|
202
213
|
* consults the persistence layer.
|
|
203
214
|
* @param meta - the stored session header (identity witness).
|
|
215
|
+
* @param inheritedEventCount - exact inherited prefix length for projection initialization and identity.
|
|
204
216
|
* @param events - the session's complete log, in seq order.
|
|
205
217
|
* @returns the projection cut at the log end.
|
|
206
218
|
*/
|
|
207
|
-
coldSnapshot(meta, events) {
|
|
208
|
-
const
|
|
209
|
-
this.
|
|
219
|
+
coldSnapshot(meta, inheritedEventCount, events) {
|
|
220
|
+
const identity = identityOf(meta, inheritedEventCount);
|
|
221
|
+
const restored = this.ctx.sessionProjections.restore(this.recordFor(meta.id, identity)?.rows ?? {}, events, SessionLogOffset(0), meta, inheritedEventCount);
|
|
222
|
+
this.put(meta.id, identity, restored.checkpoint).catch((error) => {
|
|
210
223
|
this.ctx.logger.warn(`session projection cache: cold-read write-back for "${meta.id}" failed (cache stays stale): ${String(error)}`);
|
|
211
224
|
});
|
|
212
225
|
return restored.snapshot;
|
|
@@ -282,15 +295,19 @@ var SessionProjectionCache = class extends Service {
|
|
|
282
295
|
}
|
|
283
296
|
};
|
|
284
297
|
/** Project a header onto the identity fields a record is bound to. */
|
|
285
|
-
function identityOf(header) {
|
|
298
|
+
function identityOf(header, inheritedEventCount) {
|
|
299
|
+
const cut = SessionLogOffset(inheritedEventCount);
|
|
300
|
+
if (!header.isSeeded && cut !== 0) throw new Error("unseeded projection-cache identity inherited event count must be 0");
|
|
286
301
|
return {
|
|
287
302
|
createdAt: header.createdAt,
|
|
288
|
-
...header.cwd === void 0 ? {} : { cwd: header.cwd }
|
|
303
|
+
...header.cwd === void 0 ? {} : { cwd: header.cwd },
|
|
304
|
+
isSeeded: header.isSeeded,
|
|
305
|
+
inheritedEventCount: cut
|
|
289
306
|
};
|
|
290
307
|
}
|
|
291
308
|
/** Whether a stored record's bound identity names the caller's lifecycle. */
|
|
292
309
|
function identityMatches(stored, expected) {
|
|
293
|
-
return stored.createdAt === expected.createdAt && stored.cwd === expected.cwd;
|
|
310
|
+
return stored.createdAt === expected.createdAt && stored.cwd === expected.cwd && stored.isSeeded === expected.isSeeded && stored.inheritedEventCount === expected.inheritedEventCount;
|
|
294
311
|
}
|
|
295
312
|
//#endregion
|
|
296
313
|
export { Config, SessionProjectionCache, SessionProjectionCache as default, checkpointIdentity, checkpointRecord, checkpointRow, projectionCacheDomainSpec };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { Context, Service } from '@deepseek-ai/cordis';
|
|
19
19
|
import z from '@deepseek-ai/schemastery';
|
|
20
|
+
import { SessionLogOffset } from '@deepseek-ai/dsh-session';
|
|
20
21
|
import type { Session, SessionEvent, SessionHeader } from '@deepseek-ai/dsh-session';
|
|
21
22
|
import type { ProjectionSnapshot, SessionProjectionMap } from '@deepseek-ai/dsh-session-projection';
|
|
22
23
|
export { checkpointIdentity, checkpointRecord, checkpointRow, projectionCacheDomainSpec } from './spec.ts';
|
|
@@ -80,22 +81,23 @@ export declare class SessionProjectionCache extends Service {
|
|
|
80
81
|
* paths (the history tail baseline) supersede these values whenever a
|
|
81
82
|
* session is actually opened.
|
|
82
83
|
* @param meta - the listed session's header (identity witness; no log read).
|
|
84
|
+
* @param inheritedEventCount - exact inherited prefix length that completes
|
|
85
|
+
* the checkpoint identity.
|
|
83
86
|
* @param keys - optional projection keys required by the caller's audience.
|
|
84
87
|
* @returns the cut (`asOfSeq` = lowest served-row watermark), or
|
|
85
88
|
* `undefined` when no usable row exists for this lifecycle.
|
|
86
89
|
*/
|
|
87
|
-
cachedSnapshot(meta: SessionHeader, keys?: readonly Extract<keyof SessionProjectionMap, string>[]): ProjectionSnapshot | undefined;
|
|
90
|
+
cachedSnapshot(meta: SessionHeader, inheritedEventCount: SessionLogOffset, keys?: readonly Extract<keyof SessionProjectionMap, string>[]): ProjectionSnapshot | undefined;
|
|
88
91
|
/**
|
|
89
92
|
* Hydrate projection cells for an already-prepared Session without another
|
|
90
93
|
* persistence read. The cache seeds matching rows; the supplied exact log
|
|
91
94
|
* advances every unit to the observation cut. No checkpoint is written
|
|
92
95
|
* because the logical observation may contain recovery events not yet durable.
|
|
93
96
|
* @param session - exact unpublished Session retained by persistence.
|
|
94
|
-
* @param meta - observed lifecycle header.
|
|
95
97
|
* @param events - exact logical event prefix represented by the observation.
|
|
96
98
|
* @returns all projection values at the event cut.
|
|
97
99
|
*/
|
|
98
|
-
hydratePrepared(session: Session,
|
|
100
|
+
hydratePrepared(session: Session, events: readonly SessionEvent[]): ProjectionSnapshot;
|
|
99
101
|
/**
|
|
100
102
|
* Durably checkpoint one live session NOW (all mandatory points call
|
|
101
103
|
* this; tests and carriers may too). The registry cut is snapshotted at
|
|
@@ -115,10 +117,11 @@ export declare class SessionProjectionCache extends Service {
|
|
|
115
117
|
* The caller supplies the complete log in seq order: this service never
|
|
116
118
|
* consults the persistence layer.
|
|
117
119
|
* @param meta - the stored session header (identity witness).
|
|
120
|
+
* @param inheritedEventCount - exact inherited prefix length for projection initialization and identity.
|
|
118
121
|
* @param events - the session's complete log, in seq order.
|
|
119
122
|
* @returns the projection cut at the log end.
|
|
120
123
|
*/
|
|
121
|
-
coldSnapshot(meta: SessionHeader, events: readonly SessionEvent[]): ProjectionSnapshot;
|
|
124
|
+
coldSnapshot(meta: SessionHeader, inheritedEventCount: SessionLogOffset, events: readonly SessionEvent[]): ProjectionSnapshot;
|
|
122
125
|
private installWritePath;
|
|
123
126
|
/**
|
|
124
127
|
* One fail-soft durable checkpoint. Every caller has work by construction:
|
package/lib/types/spec.d.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* @module @deepseek-ai/dsh-session-projection-cache/src/spec
|
|
11
11
|
*/
|
|
12
12
|
import { z } from 'zod';
|
|
13
|
+
import { SessionLogOffset, SessionSeq } from '@deepseek-ai/dsh-session';
|
|
13
14
|
import type { SessionId } from '@deepseek-ai/dsh-session';
|
|
14
15
|
/**
|
|
15
16
|
* One persisted checkpoint row (the RFC's `(sessionId, key, ver, seq, val)`
|
|
@@ -21,7 +22,7 @@ import type { SessionId } from '@deepseek-ai/dsh-session';
|
|
|
21
22
|
*/
|
|
22
23
|
export declare const checkpointRow: z.ZodObject<{
|
|
23
24
|
ver: z.ZodNumber;
|
|
24
|
-
seq: z.ZodNumber
|
|
25
|
+
seq: z.ZodPipe<z.ZodNumber, z.ZodTransform<-1 | SessionSeq, number>>;
|
|
25
26
|
val: z.ZodJSONSchema;
|
|
26
27
|
}, z.core.$strip>;
|
|
27
28
|
/**
|
|
@@ -36,6 +37,8 @@ export declare const checkpointRow: z.ZodObject<{
|
|
|
36
37
|
export declare const checkpointIdentity: z.ZodObject<{
|
|
37
38
|
createdAt: z.ZodNumber;
|
|
38
39
|
cwd: z.ZodOptional<z.ZodString>;
|
|
40
|
+
isSeeded: z.ZodBoolean;
|
|
41
|
+
inheritedEventCount: z.ZodPipe<z.ZodNumber, z.ZodTransform<SessionLogOffset, number>>;
|
|
39
42
|
}, z.core.$strip>;
|
|
40
43
|
/** The identity fields a record is bound to, inferred from {@link checkpointIdentity}. */
|
|
41
44
|
export type CheckpointIdentity = z.infer<typeof checkpointIdentity>;
|
|
@@ -49,10 +52,12 @@ export declare const checkpointRecord: z.ZodObject<{
|
|
|
49
52
|
identity: z.ZodObject<{
|
|
50
53
|
createdAt: z.ZodNumber;
|
|
51
54
|
cwd: z.ZodOptional<z.ZodString>;
|
|
55
|
+
isSeeded: z.ZodBoolean;
|
|
56
|
+
inheritedEventCount: z.ZodPipe<z.ZodNumber, z.ZodTransform<SessionLogOffset, number>>;
|
|
52
57
|
}, z.core.$strip>;
|
|
53
58
|
rows: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
54
59
|
ver: z.ZodNumber;
|
|
55
|
-
seq: z.ZodNumber
|
|
60
|
+
seq: z.ZodPipe<z.ZodNumber, z.ZodTransform<-1 | SessionSeq, number>>;
|
|
56
61
|
val: z.ZodJSONSchema;
|
|
57
62
|
}, z.core.$strip>>;
|
|
58
63
|
}, z.core.$strip>;
|
|
@@ -73,11 +78,13 @@ export declare const projectionCacheDomainSpec: {
|
|
|
73
78
|
sessions: import("@deepseek-ai/dsh-storage-domain").DomainTableSpec<SessionId, {
|
|
74
79
|
identity: {
|
|
75
80
|
createdAt: number;
|
|
81
|
+
isSeeded: boolean;
|
|
82
|
+
inheritedEventCount: SessionLogOffset;
|
|
76
83
|
cwd?: string | undefined;
|
|
77
84
|
};
|
|
78
85
|
rows: Record<string, {
|
|
79
86
|
ver: number;
|
|
80
|
-
seq:
|
|
87
|
+
seq: -1 | SessionSeq;
|
|
81
88
|
val: z.core.util.JSONType;
|
|
82
89
|
}>;
|
|
83
90
|
}>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-session-projection-cache",
|
|
3
3
|
"description": "Persisted projection cache (ctx.sessionProjectionCache): durable per-session checkpoint records on the session_projcache storage domain (per-record layout), throttled write-behind, and the cached listing read",
|
|
4
|
-
"version": "0.1.2-alpha.
|
|
4
|
+
"version": "0.1.2-alpha.4",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -18,38 +18,31 @@
|
|
|
18
18
|
"types": "./lib/types/index.d.ts",
|
|
19
19
|
"default": "./lib/index.js"
|
|
20
20
|
},
|
|
21
|
-
"./invariant": {
|
|
22
|
-
"types": "./lib/types/invariant.d.ts",
|
|
23
|
-
"default": "./lib/invariant.js"
|
|
24
|
-
},
|
|
25
21
|
"./src/*": "./src/*",
|
|
26
22
|
"./package.json": "./package.json"
|
|
27
23
|
},
|
|
28
24
|
"files": [
|
|
29
25
|
"lib/index.js",
|
|
30
|
-
"lib/invariant.js",
|
|
31
26
|
"lib/types/**/*.d.ts"
|
|
32
27
|
],
|
|
33
28
|
"license": "MIT",
|
|
34
29
|
"dependencies": {
|
|
35
30
|
"zod": "^4.4.3",
|
|
36
|
-
"@deepseek-ai/
|
|
37
|
-
"@deepseek-ai/
|
|
31
|
+
"@deepseek-ai/dsh-util-values": "^0.1.2-alpha.4",
|
|
32
|
+
"@deepseek-ai/schemastery": "^3.18.2"
|
|
38
33
|
},
|
|
39
34
|
"peerDependencies": {
|
|
40
35
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
41
|
-
"@deepseek-ai/dsh-
|
|
42
|
-
"@deepseek-ai/dsh-session": "^0.1.2-alpha.
|
|
43
|
-
"@deepseek-ai/dsh-
|
|
44
|
-
"@deepseek-ai/dsh-storage-domain": "^0.1.2-alpha.3"
|
|
36
|
+
"@deepseek-ai/dsh-session": "^0.1.2-alpha.4",
|
|
37
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.2-alpha.4",
|
|
38
|
+
"@deepseek-ai/dsh-storage-domain": "^0.1.2-alpha.4"
|
|
45
39
|
},
|
|
46
40
|
"devDependencies": {
|
|
47
41
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
48
|
-
"@deepseek-ai/dsh-
|
|
49
|
-
"@deepseek-ai/dsh-session": "^0.1.2-alpha.
|
|
50
|
-
"@deepseek-ai/dsh-
|
|
51
|
-
"@deepseek-ai/dsh-storage": "^0.1.2-alpha.
|
|
52
|
-
"@deepseek-ai/dsh-storage-
|
|
53
|
-
"@deepseek-ai/dsh-storage-json": "^0.1.2-alpha.3"
|
|
42
|
+
"@deepseek-ai/dsh-session": "^0.1.2-alpha.4",
|
|
43
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.2-alpha.4",
|
|
44
|
+
"@deepseek-ai/dsh-storage": "^0.1.2-alpha.4",
|
|
45
|
+
"@deepseek-ai/dsh-storage-domain": "^0.1.2-alpha.4",
|
|
46
|
+
"@deepseek-ai/dsh-storage-json": "^0.1.2-alpha.4"
|
|
54
47
|
}
|
|
55
48
|
}
|
package/lib/invariant.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
//#region lib/types/invariant.js
|
|
2
|
-
/**
|
|
3
|
-
* Package-owned invariant companion for `@deepseek-ai/dsh-session-projection-cache`.
|
|
4
|
-
* @module @deepseek-ai/dsh-session-projection-cache/invariant
|
|
5
|
-
*/
|
|
6
|
-
const PACKAGE_NAME = "@deepseek-ai/dsh-session-projection-cache";
|
|
7
|
-
/** Cordis companion plugin name. */
|
|
8
|
-
const name = "session-projection-cache-invariant";
|
|
9
|
-
/** Service required before the companion can reserve package ownership. */
|
|
10
|
-
const inject = ["invariants"];
|
|
11
|
-
/**
|
|
12
|
-
* No runtime invariant: the cache's correctness relation (a stored row equals
|
|
13
|
-
* the registry fold at its `seq` watermark) is only checkable by re-running the
|
|
14
|
-
* fold over the persisted log — duplicating the implementation rather than
|
|
15
|
-
* detecting drift — and its staleness is by design (fail-soft writes). The
|
|
16
|
-
* durable boundary is schema-validated by the cache's own zod parse on every
|
|
17
|
-
* read, and the read ladder's version/watermark guards are proven
|
|
18
|
-
* by the package spec.
|
|
19
|
-
*/
|
|
20
|
-
const install = () => {};
|
|
21
|
-
/**
|
|
22
|
-
* Register this package's invariant companion.
|
|
23
|
-
* @param ctx - Cordis context carrying the invariant service.
|
|
24
|
-
* @returns the installed registration's disposer after setup succeeds.
|
|
25
|
-
*/
|
|
26
|
-
const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
27
|
-
//#endregion
|
|
28
|
-
export { apply, inject, name };
|
package/lib/types/invariant.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Package-owned invariant companion for `@deepseek-ai/dsh-session-projection-cache`.
|
|
3
|
-
* @module @deepseek-ai/dsh-session-projection-cache/invariant
|
|
4
|
-
*/
|
|
5
|
-
import type { Context } from '@deepseek-ai/cordis';
|
|
6
|
-
/** Cordis companion plugin name. */
|
|
7
|
-
export declare const name = "session-projection-cache-invariant";
|
|
8
|
-
/** Service required before the companion can reserve package ownership. */
|
|
9
|
-
export declare const inject: string[];
|
|
10
|
-
/**
|
|
11
|
-
* Register this package's invariant companion.
|
|
12
|
-
* @param ctx - Cordis context carrying the invariant service.
|
|
13
|
-
* @returns the installed registration's disposer after setup succeeds.
|
|
14
|
-
*/
|
|
15
|
-
export declare const apply: (ctx: Context) => Promise<() => void>;
|
|
16
|
-
//# sourceMappingURL=invariant.d.ts.map
|