@deepseek-ai/dsh-session-persistence-jsonl 0.2.1-rc.4 → 0.2.2-alpha.2
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 +1 -1
- package/README.zh.md +1 -1
- package/lib/index.js +12 -4
- package/lib/types/zstd.d.ts +1 -1
- package/lib/worker.cjs +111 -35
- package/locale/de.json +6 -0
- package/locale/es.json +6 -0
- package/locale/fr.json +6 -0
- package/locale/ja.json +6 -0
- package/locale/pt.json +6 -0
- package/locale/ru.json +6 -0
- package/package.json +13 -13
package/README.i18n.yaml
CHANGED
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
en: 96498792672f6d50
|
|
31
31
|
zh: d767a9c69dced889
|
|
32
32
|
/deepseek-ai-dsh-session-persistence-jsonl/use-this-package/reading-the-logs:
|
|
33
|
-
en:
|
|
34
|
-
zh:
|
|
33
|
+
en: 4cec8a6c9f6e488b
|
|
34
|
+
zh: 4757440a552db5e3
|
|
35
35
|
/deepseek-ai-dsh-session-persistence-jsonl/understand-the-implementation:
|
|
36
36
|
en: a35407bb25671e7e
|
|
37
37
|
zh: 6a00f9510c85adcb
|
package/README.md
CHANGED
|
@@ -82,7 +82,7 @@ Unloading the backend waits for the consumer unloads it triggers through `sessio
|
|
|
82
82
|
|
|
83
83
|
### Reading the logs
|
|
84
84
|
|
|
85
|
-
Materialized `stat` and `list` snapshots include the format catalog's header classification as `formatStatus`, alongside the translated logical `header`. A read-only preparation leaves the selected historical version unchanged; the status becomes `current` after publication of the successor. Unmaterialized pending Sessions omit `formatStatus`.
|
|
85
|
+
Materialized `stat` and `list` snapshots include the format catalog's header classification as `formatStatus`, alongside the translated logical `header`. They also include `location: { kind: 'jsonl', path }` for the selected physical generation. A read-only preparation leaves the selected historical version unchanged; the status becomes `current` after publication of the successor. Unmaterialized pending Sessions omit `formatStatus` and `location`.
|
|
86
86
|
|
|
87
87
|
`open(id, 'read'|'write')` selects the highest canonical generation. Current input follows the ordinary fast path. For historical input, a read open decodes and migrates the source once, validates the current logical result, and returns it without publishing a successor. A write open reuses that revision-keyed preparation when available, or performs the same preparation, then encodes a same-directory temporary file in bounded chunks, verifies it in a Worker Thread, rechecks the source revision, and publishes the current successor without overwrite before returning. The source remains byte-identical. Source drift after preparation rejects that write open without replacing the logical history already returned to readers; a later write open prepares the new revision. The backend marks decoded event graphs `shared-frozen` when it freezes them before memoization; every nested object and array is frozen, and handle reads and slices preserve that state, including empty slices. Only an unmaterialized pending log reports `detached`. `stat(id)` and `list()` select and translate only the highest generation header without reading event rows or starting migration; snapshots carry the selected file’s `sizeBytes` and a best-effort revision. Current revisions identify that file; historical revisions also fingerprint the selected files across the persistence root, so child changes invalidate cached logical events. Fingerprinting reads filesystem metadata only; unrelated changes conservatively invalidate historical revisions. One `list()` call shares a corpus fingerprint across its historical entries. With `compression: 'none'`, the log is newline-delimited text an external reader can consume directly; the compressed default must be read through the backend.
|
|
88
88
|
|
package/README.zh.md
CHANGED
|
@@ -82,7 +82,7 @@ kind: "package-reference"
|
|
|
82
82
|
|
|
83
83
|
### 读取日志
|
|
84
84
|
|
|
85
|
-
已实体化的 `stat` 与 `list` 快照在转换后的逻辑 `header` 之外,通过 `formatStatus` 保留格式 catalog
|
|
85
|
+
已实体化的 `stat` 与 `list` 快照在转换后的逻辑 `header` 之外,通过 `formatStatus` 保留格式 catalog 的头部分类。它们还包含选中物理 generation 的 `location: { kind: 'jsonl', path }`。只读准备不会改变所选历史版本;发布后继之后,状态才变为 `current`。尚未实体化的待定 Session 省略 `formatStatus` 与 `location`。
|
|
86
86
|
|
|
87
87
|
`open(id, 'read'|'write')` 选择最高规范 generation。当前格式输入走普通快速路径。对于历史输入,只读 open 会单遍解码并迁移源、校验当前逻辑结果,然后在不发布后继的情况下返回。写 open 会在可用时复用按 revision 为键的 preparation,否则执行同一套 preparation,再按有界分片编码同目录临时文件、在 Worker Thread 中校验、复查源修订,并在返回前以不覆盖方式发布当前后继。源保持逐字节不变。如果源在 preparation 后发生变化,该次写 open 会失败,已经返回给读方的逻辑历史不会被替换;后续写 open 会针对新的 revision 重新执行 preparation。后端在 memo 化前冻结已解码的 event graph,并在此时将其标记为 `shared-frozen`;每个嵌套对象和数组都会冻结,句柄读取和 slice 即使为空也保留该状态。只有尚未实体化的 pending 空日志报告 `detached`。`stat(id)` 与 `list()` 只选择并转换最高 generation 的 header,不读取事件行,也不启动迁移;快照携带所选文件的 `sizeBytes` 与尽力而为的修订号。当前格式修订号标识该文件;历史格式修订号还包含持久化根目录中所选文件的指纹,因此子日志变化会使缓存的逻辑事件失效。指纹只读取文件系统元数据;无关变化也会保守地使历史修订号失效。一次 `list()` 为其历史条目共用一个全库指纹。选择 `compression: 'none'` 后,日志是外部读取方可直接消费的换行分隔文本;压缩默认值必须经后端读取。
|
|
88
88
|
|
package/lib/index.js
CHANGED
|
@@ -1146,7 +1146,7 @@ function privateZstdStream(stream) {
|
|
|
1146
1146
|
const candidate = stream;
|
|
1147
1147
|
const handle = candidate._handle;
|
|
1148
1148
|
const errorKey = Reflect.ownKeys(stream).find((key) => typeof key === "symbol" && key.description === "kError");
|
|
1149
|
-
/* v8 ignore next -- one test runtime exposes one Node-private shape; the Node
|
|
1149
|
+
/* v8 ignore next -- one test runtime exposes one Node-private shape; the Node 24/26 matrix checks compatibility. */
|
|
1150
1150
|
if (typeof handle !== "object" || handle === null || typeof handle.writeSync !== "function" || !(candidate._writeState instanceof Uint32Array) || candidate._writeState.length < 2 || typeof candidate._defaultFlushFlag !== "number" || errorKey === void 0 || candidate[errorKey] !== null) return void 0;
|
|
1151
1151
|
return {
|
|
1152
1152
|
stream,
|
|
@@ -1383,7 +1383,7 @@ async function decompressZstdFrame(input) {
|
|
|
1383
1383
|
return zstdDecompressAsync(input);
|
|
1384
1384
|
}
|
|
1385
1385
|
/**
|
|
1386
|
-
* Select the shared private decoder when the running Node
|
|
1386
|
+
* Select the shared private decoder when the running Node 24/26 shape is
|
|
1387
1387
|
* compatible, otherwise preserve correctness with the public one-shot API.
|
|
1388
1388
|
* @returns a synchronous decoder with an implementation-independent lifecycle.
|
|
1389
1389
|
*/
|
|
@@ -2586,7 +2586,11 @@ var JsonlSessionPersistence = class extends SessionPersistence {
|
|
|
2586
2586
|
return {
|
|
2587
2587
|
...metadata,
|
|
2588
2588
|
revision: selected.sourceVersion < SESSION_FORMAT_VERSION ? SessionPersistenceRevision(`${fileRevision(identity)}:${await this.historicalCorpusRevision(options?.signal)}`) : fileRevision(identity),
|
|
2589
|
-
sizeBytes: Number(identity.size)
|
|
2589
|
+
sizeBytes: Number(identity.size),
|
|
2590
|
+
location: {
|
|
2591
|
+
kind: "jsonl",
|
|
2592
|
+
path: selected.sourcePath
|
|
2593
|
+
}
|
|
2590
2594
|
};
|
|
2591
2595
|
} catch (error) {
|
|
2592
2596
|
options?.signal?.throwIfAborted();
|
|
@@ -2630,7 +2634,11 @@ var JsonlSessionPersistence = class extends SessionPersistence {
|
|
|
2630
2634
|
header: artifact.header,
|
|
2631
2635
|
formatStatus: artifact.formatStatus,
|
|
2632
2636
|
revision: artifact.sourceVersion < SESSION_FORMAT_VERSION ? SessionPersistenceRevision(`${fileRevision(identity)}:${corpusRevision}`) : fileRevision(identity),
|
|
2633
|
-
sizeBytes: Number(identity.size)
|
|
2637
|
+
sizeBytes: Number(identity.size),
|
|
2638
|
+
location: {
|
|
2639
|
+
kind: "jsonl",
|
|
2640
|
+
path: artifact.path
|
|
2641
|
+
}
|
|
2634
2642
|
});
|
|
2635
2643
|
}
|
|
2636
2644
|
for (const [id, entry] of pending) if (!listed.has(id)) snapshots.push({
|
package/lib/types/zstd.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ export interface ZstdFrameDecoder {
|
|
|
52
52
|
close(): void;
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
|
-
* Select the shared private decoder when the running Node
|
|
55
|
+
* Select the shared private decoder when the running Node 24/26 shape is
|
|
56
56
|
* compatible, otherwise preserve correctness with the public one-shot API.
|
|
57
57
|
* @returns a synchronous decoder with an implementation-independent lifecycle.
|
|
58
58
|
*/
|
package/lib/worker.cjs
CHANGED
|
@@ -1975,9 +1975,9 @@ var Fiber = class {
|
|
|
1975
1975
|
uid;
|
|
1976
1976
|
/** The context this fiber's plugin runs in (extends the parent context). */
|
|
1977
1977
|
ctx;
|
|
1978
|
-
/** The validated plugin config (updated by `update()`). */
|
|
1978
|
+
/** The validated plugin config (updated by `update()`); read through {@link effectiveConfig}. */
|
|
1979
1979
|
config;
|
|
1980
|
-
/** The raw plugin config, re-resolved before
|
|
1980
|
+
/** The raw plugin config, re-resolved before activation; use {@link rawConfig} to read or retain it. */
|
|
1981
1981
|
_config;
|
|
1982
1982
|
/** Current lifecycle state; transitions emit `internal/status`. */
|
|
1983
1983
|
state = 0;
|
|
@@ -2304,9 +2304,33 @@ var Fiber = class {
|
|
|
2304
2304
|
}
|
|
2305
2305
|
});
|
|
2306
2306
|
}
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
return this.
|
|
2307
|
+
/** Raw input retained for the next activation, without evaluating expressions or validating it. */
|
|
2308
|
+
get rawConfig() {
|
|
2309
|
+
return this.ctx.fiber._config;
|
|
2310
|
+
}
|
|
2311
|
+
/** Retain raw input without changing the running config or triggering an update. */
|
|
2312
|
+
set rawConfig(config) {
|
|
2313
|
+
this.ctx.fiber._config = config;
|
|
2314
|
+
}
|
|
2315
|
+
/**
|
|
2316
|
+
* The config object published by the existing activation/update lifecycle, without cloning or re-parsing.
|
|
2317
|
+
* It is undefined before the first resolution and remains readable after unload; callers requiring a live instance check `state`.
|
|
2318
|
+
*/
|
|
2319
|
+
get effectiveConfig() {
|
|
2320
|
+
return this.ctx.fiber.config;
|
|
2321
|
+
}
|
|
2322
|
+
/**
|
|
2323
|
+
* Evaluate and validate a candidate using this fiber's `internal/config` hooks and runtime schema.
|
|
2324
|
+
* Does not publish the result, replace raw input, or commit running volatile references.
|
|
2325
|
+
* Required injections must be available when a hook uses them.
|
|
2326
|
+
* @param config Raw candidate input.
|
|
2327
|
+
* @returns The candidate's resolved config, retaining the schema's result identity.
|
|
2328
|
+
* @throws {ValidationError} when the runtime schema rejects the candidate; hook errors propagate.
|
|
2329
|
+
*/
|
|
2330
|
+
resolveConfig(config) {
|
|
2331
|
+
const fiber = this.ctx.fiber;
|
|
2332
|
+
config = fiber.context.waterfall(fiber, "internal/config", config, () => config);
|
|
2333
|
+
return fiber.runtime ? resolveConfig(fiber.runtime, config) : config;
|
|
2310
2334
|
}
|
|
2311
2335
|
async _reload() {
|
|
2312
2336
|
this.store = { ...this._store };
|
|
@@ -2314,7 +2338,7 @@ var Fiber = class {
|
|
|
2314
2338
|
try {
|
|
2315
2339
|
await Promise.resolve();
|
|
2316
2340
|
if (this._runner.epoch === oldEpoch) {
|
|
2317
|
-
this.config = this.
|
|
2341
|
+
this.config = this.resolveConfig(this._config);
|
|
2318
2342
|
await this._execute(this._runner);
|
|
2319
2343
|
this._error = void 0;
|
|
2320
2344
|
}
|
|
@@ -2370,10 +2394,11 @@ var Fiber = class {
|
|
|
2370
2394
|
* @throws {CordisError} `INACTIVE_EFFECT` when the fiber is already disposed.
|
|
2371
2395
|
*/
|
|
2372
2396
|
async restart() {
|
|
2373
|
-
this.
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2397
|
+
const fiber = this.ctx.fiber;
|
|
2398
|
+
fiber.assertActive();
|
|
2399
|
+
fiber._setEpoch(INACTIVE);
|
|
2400
|
+
fiber._refresh();
|
|
2401
|
+
await fiber.await();
|
|
2377
2402
|
}
|
|
2378
2403
|
/**
|
|
2379
2404
|
* Validate and apply new config, then restart the plugin.
|
|
@@ -2387,19 +2412,20 @@ var Fiber = class {
|
|
|
2387
2412
|
* @throws {ValidationError} when the new config fails validation.
|
|
2388
2413
|
*/
|
|
2389
2414
|
update(config, noSave = false) {
|
|
2390
|
-
this.
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2415
|
+
const fiber = this.ctx.fiber;
|
|
2416
|
+
fiber.assertActive();
|
|
2417
|
+
fiber._config = config;
|
|
2418
|
+
if (fiber.state !== 2) {
|
|
2419
|
+
fiber._error = void 0;
|
|
2420
|
+
fiber._setEpoch(INACTIVE);
|
|
2421
|
+
fiber._refresh();
|
|
2396
2422
|
return;
|
|
2397
2423
|
}
|
|
2398
|
-
config =
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
return
|
|
2424
|
+
config = fiber.resolveConfig(config);
|
|
2425
|
+
fiber.context.waterfall(fiber, "internal/update", config, noSave, () => {
|
|
2426
|
+
fiber.config = config;
|
|
2427
|
+
fiber._error = void 0;
|
|
2428
|
+
return fiber.restart();
|
|
2403
2429
|
});
|
|
2404
2430
|
}
|
|
2405
2431
|
};
|
|
@@ -5737,12 +5763,17 @@ var LlmError = class extends HarnessError {
|
|
|
5737
5763
|
if (typeof model.provider !== "string" || model.provider !== provider || typeof model.id !== "string" || model.id.length === 0 || typeof model.name !== "string" || model.name.length === 0 || model.description !== void 0 && typeof model.description !== "string" || seen.has(model.id)) throw new LlmError(`adapter returned invalid or duplicate model metadata for provider "${provider}"`, "INVALID_CATALOG");
|
|
5738
5764
|
seen.add(model.id);
|
|
5739
5765
|
const inputModalities = this.detachedModalities(model.inputModalities);
|
|
5766
|
+
const badge = model.badge;
|
|
5740
5767
|
return {
|
|
5741
5768
|
provider: model.provider,
|
|
5742
5769
|
id: model.id,
|
|
5743
5770
|
name: model.name,
|
|
5744
5771
|
...model.description === void 0 ? {} : { description: model.description },
|
|
5745
|
-
...inputModalities === void 0 ? {} : { inputModalities }
|
|
5772
|
+
...inputModalities === void 0 ? {} : { inputModalities },
|
|
5773
|
+
...badge === void 0 ? {} : { badge: {
|
|
5774
|
+
text: typeof badge.text === "string" ? badge.text : { ...badge.text },
|
|
5775
|
+
tone: badge.tone
|
|
5776
|
+
} }
|
|
5746
5777
|
};
|
|
5747
5778
|
});
|
|
5748
5779
|
}
|
|
@@ -6373,7 +6404,7 @@ function invokeContainedSessionObservers(ctx, name, id, args, callbacks) {
|
|
|
6373
6404
|
ctx.logger.warn(`session "${id}": ${name} listener threw: ${String(error)}`);
|
|
6374
6405
|
}
|
|
6375
6406
|
}
|
|
6376
|
-
/** Store
|
|
6407
|
+
/** Store-owned Sessions retain a null entry while unentered; absent keys are independent. */
|
|
6377
6408
|
const attachments = /* @__PURE__ */ new WeakMap();
|
|
6378
6409
|
/**
|
|
6379
6410
|
* Grammar of a {@link PluginRecordType}: `plugin:` followed by
|
|
@@ -6572,6 +6603,9 @@ var Session = class Session {
|
|
|
6572
6603
|
* the log, the append is committed: observer failures are logged and
|
|
6573
6604
|
* contained per listener, so they do not change the return value or prevent
|
|
6574
6605
|
* later listeners from observing the same accepted event.
|
|
6606
|
+
* Independent Sessions append without notifying store observers. Once a store
|
|
6607
|
+
* prepares or enters the instance, writes require a completed creation
|
|
6608
|
+
* announcement and remain disabled after removal.
|
|
6575
6609
|
*
|
|
6576
6610
|
* @param type - The event type (key of {@link SessionEventMap}).
|
|
6577
6611
|
* @param data - The event payload; must be JSON-serializable.
|
|
@@ -6587,7 +6621,9 @@ var Session = class Session {
|
|
|
6587
6621
|
* @returns the logged event — its assigned `seq`/`time` plus the SNAPSHOT of
|
|
6588
6622
|
* `data` that entered the log, so reading `event.data` back sees the logged
|
|
6589
6623
|
* value, never the caller's still-mutable input.
|
|
6590
|
-
* @throws if
|
|
6624
|
+
* @throws if a store-owned Session is unentered or its creation announcement
|
|
6625
|
+
* has not completed, or if `data` or surface
|
|
6626
|
+
* metadata is not losslessly JSON-serializable
|
|
6591
6627
|
* (BigInt, function, symbol, undefined, negative zero, non-finite number,
|
|
6592
6628
|
* circular reference, sparse array, or an exotic object such as
|
|
6593
6629
|
* Map/Set/Date/class instance), or when the candidate violates the
|
|
@@ -6603,6 +6639,7 @@ var Session = class Session {
|
|
|
6603
6639
|
* rejects before the log changes.
|
|
6604
6640
|
*/
|
|
6605
6641
|
append(type, data, ...opts) {
|
|
6642
|
+
this.publicationEntry();
|
|
6606
6643
|
const surfaceOpts = opts[0];
|
|
6607
6644
|
const surfaceMetadata = {
|
|
6608
6645
|
...surfaceOpts?.sourceEventSeqs === void 0 ? {} : { sourceEventSeqs: surfaceOpts.sourceEventSeqs },
|
|
@@ -6632,6 +6669,7 @@ var Session = class Session {
|
|
|
6632
6669
|
* @returns the record's sequence number.
|
|
6633
6670
|
*/
|
|
6634
6671
|
#appendRecord(type, data) {
|
|
6672
|
+
this.publicationEntry();
|
|
6635
6673
|
const dataSnapshot = snapshotJsonValue(data);
|
|
6636
6674
|
if (dataSnapshot === void 0) throw new Error(`plugin record "${type}" carries non-JSON-serializable data`);
|
|
6637
6675
|
const entry = this.publicationEntry();
|
|
@@ -6647,12 +6685,13 @@ var Session = class Session {
|
|
|
6647
6685
|
return record.seq;
|
|
6648
6686
|
}
|
|
6649
6687
|
/**
|
|
6650
|
-
*
|
|
6651
|
-
*
|
|
6652
|
-
* @returns the attachment, or undefined for a detached Session.
|
|
6688
|
+
* Require announced membership for store-owned Sessions and refuse reentrant publication.
|
|
6689
|
+
* @returns the current store attachment, or undefined for an independent Session.
|
|
6653
6690
|
*/
|
|
6654
6691
|
publicationEntry() {
|
|
6655
6692
|
const entry = attachments.get(this);
|
|
6693
|
+
if (entry === null) throw new Error(`session "${this.id}" cannot append outside a SessionStore`);
|
|
6694
|
+
if (entry !== void 0 && entry.announcement !== "complete") throw new Error(`session "${this.id}" cannot append before session/created completes`);
|
|
6656
6695
|
if (entry?.appending) throw new Error("session append cannot reenter while another append is being published");
|
|
6657
6696
|
return entry;
|
|
6658
6697
|
}
|
|
@@ -6666,20 +6705,19 @@ var Session = class Session {
|
|
|
6666
6705
|
this.surfaceManager.validateNext(event);
|
|
6667
6706
|
if (entry !== void 0) entry.appending = true;
|
|
6668
6707
|
try {
|
|
6669
|
-
let callbacks;
|
|
6670
6708
|
const callbackArgs = [this, event];
|
|
6671
|
-
|
|
6709
|
+
const callbacks = entry === void 0 ? void 0 : collectSessionCallbacks(entry.emitCtx, [
|
|
6672
6710
|
entry.carrier,
|
|
6673
6711
|
"session/event",
|
|
6674
6712
|
...callbackArgs
|
|
6675
6713
|
]);
|
|
6676
6714
|
this.log.push(event);
|
|
6677
6715
|
this.eventsSnapshot = void 0;
|
|
6678
|
-
if (
|
|
6716
|
+
if (entry !== void 0 && callbacks !== void 0) invokeContainedSessionObservers(entry.emitCtx, "session/event", entry.id, callbackArgs, callbacks);
|
|
6679
6717
|
} finally {
|
|
6680
6718
|
if (entry !== void 0) {
|
|
6681
6719
|
entry.appending = false;
|
|
6682
|
-
if (entry.detachRequested &&
|
|
6720
|
+
if (entry.detachRequested && entry.announcement !== "dispatching") entry.detach();
|
|
6683
6721
|
}
|
|
6684
6722
|
}
|
|
6685
6723
|
}
|
|
@@ -7606,6 +7644,44 @@ const RELEASED_V0_EVENT_DISPOSITIONS = Object.freeze({
|
|
|
7606
7644
|
});
|
|
7607
7645
|
Object.freeze(Object.keys(RELEASED_V0_EVENT_DISPOSITIONS).sort((left, right) => left.localeCompare(right, "en")));
|
|
7608
7646
|
//#endregion
|
|
7647
|
+
//#region ../../util/time/src/instant.ts
|
|
7648
|
+
/** Inclusive lower epoch-millisecond bound of a four-digit-year RFC 3339 UTC instant. */
|
|
7649
|
+
const MIN_FOUR_DIGIT_YEAR_MS = Date.parse("0001-01-01T00:00:00.000Z");
|
|
7650
|
+
/** Inclusive upper epoch-millisecond bound of a four-digit-year RFC 3339 UTC instant. */
|
|
7651
|
+
const MAX_FOUR_DIGIT_YEAR_MS = Date.parse("9999-12-31T23:59:59.999Z");
|
|
7652
|
+
/** Canonical four-digit-year RFC 3339 UTC instant with mandatory milliseconds. */
|
|
7653
|
+
const UTC_INSTANT = /^(?!0000)\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d\.\d{3}Z$/;
|
|
7654
|
+
new RegExp(String.raw`^(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})` + String.raw`T(?<hour>\d{2}):(?<minute>\d{2}):(?<second>\d{2})` + String.raw`(?:\.(?<fraction>\d{1,3}))?(?<zone>Z|(?<sign>[+-])` + String.raw`(?<offsetHour>\d{2}):(?<offsetMinute>\d{2}))$`);
|
|
7655
|
+
/** Reject with one stable reason. */
|
|
7656
|
+
function rejected(reason) {
|
|
7657
|
+
return Object.freeze({
|
|
7658
|
+
kind: "rejected",
|
|
7659
|
+
reason
|
|
7660
|
+
});
|
|
7661
|
+
}
|
|
7662
|
+
/** Whether an integral epoch is inside the four-digit-year range. */
|
|
7663
|
+
function inFourDigitYearRange(epoch) {
|
|
7664
|
+
return Number.isSafeInteger(epoch) && epoch >= MIN_FOUR_DIGIT_YEAR_MS && epoch <= MAX_FOUR_DIGIT_YEAR_MS;
|
|
7665
|
+
}
|
|
7666
|
+
/**
|
|
7667
|
+
* Validate one canonical four-digit-year RFC 3339 UTC instant.
|
|
7668
|
+
*
|
|
7669
|
+
* The accepted profile carries exactly three fractional digits and a `Z`, and
|
|
7670
|
+
* every year from 0001 through 9999 whose calendar date exists is representable.
|
|
7671
|
+
* @param value - Untrusted candidate instant.
|
|
7672
|
+
* @returns The epoch milliseconds, or the reason the text is not the canonical profile.
|
|
7673
|
+
*/
|
|
7674
|
+
function fourDigitYearEpoch(value) {
|
|
7675
|
+
if (!UTC_INSTANT.test(value)) return rejected("not_rfc3339");
|
|
7676
|
+
const epoch = Date.parse(value);
|
|
7677
|
+
if (!Number.isFinite(epoch) || !inFourDigitYearRange(epoch) || new Date(epoch).toISOString() !== value) return rejected("not_a_calendar_date");
|
|
7678
|
+
return Object.freeze({
|
|
7679
|
+
kind: "accepted",
|
|
7680
|
+
epoch
|
|
7681
|
+
});
|
|
7682
|
+
}
|
|
7683
|
+
Number.MAX_SAFE_INTEGER;
|
|
7684
|
+
//#endregion
|
|
7609
7685
|
//#region ../session-format-v0-to-v1/src/validation-helpers.ts
|
|
7610
7686
|
/**
|
|
7611
7687
|
* Require one plain JSON object.
|
|
@@ -8638,7 +8714,7 @@ function scheduleIdValue(value, label) {
|
|
|
8638
8714
|
if (value.trim() !== value) throw new SessionFormatError(`${label} must not have surrounding whitespace`);
|
|
8639
8715
|
}
|
|
8640
8716
|
function instantValue(value, label) {
|
|
8641
|
-
if (typeof value !== "string" ||
|
|
8717
|
+
if (typeof value !== "string" || fourDigitYearEpoch(value).kind !== "accepted") throw new SessionFormatError(`${label} must be a canonical UTC instant`);
|
|
8642
8718
|
}
|
|
8643
8719
|
function titleSourceValue(value, label) {
|
|
8644
8720
|
const source = releasedV0Record(value, label);
|
|
@@ -12421,7 +12497,7 @@ function assertReleasedV4Relationships(artifact, knownEventTypes) {
|
|
|
12421
12497
|
assertV4DeveloperData(event);
|
|
12422
12498
|
assertV4MessageSources(event);
|
|
12423
12499
|
const deliveryId = validateDeliveryAccepted(event, 4);
|
|
12424
|
-
if (deliveryId !== void 0 &&
|
|
12500
|
+
if (deliveryId !== void 0 && event.seq >= artifact.inheritedEventCount && deliveryId !== artifact.header.id) throw new SessionFormatError("current-generation delivery marker names the wrong Session");
|
|
12425
12501
|
if (event.type === "subagent/catalog" && event.seq >= artifact.inheritedEventCount) {
|
|
12426
12502
|
const id = catalogFact(event.data)["childId"];
|
|
12427
12503
|
if (ids.has(id)) throw new SessionFormatError(`duplicate catalog child ${id}`);
|
|
@@ -12982,7 +13058,7 @@ function privateZstdStream(stream) {
|
|
|
12982
13058
|
const candidate = stream;
|
|
12983
13059
|
const handle = candidate._handle;
|
|
12984
13060
|
const errorKey = Reflect.ownKeys(stream).find((key) => typeof key === "symbol" && key.description === "kError");
|
|
12985
|
-
/* v8 ignore next -- one test runtime exposes one Node-private shape; the Node
|
|
13061
|
+
/* v8 ignore next -- one test runtime exposes one Node-private shape; the Node 24/26 matrix checks compatibility. */
|
|
12986
13062
|
if (typeof handle !== "object" || handle === null || typeof handle.writeSync !== "function" || !(candidate._writeState instanceof Uint32Array) || candidate._writeState.length < 2 || typeof candidate._defaultFlushFlag !== "number" || errorKey === void 0 || candidate[errorKey] !== null) return void 0;
|
|
12987
13063
|
return {
|
|
12988
13064
|
stream,
|
|
@@ -13211,7 +13287,7 @@ async function compressZstdFrame(input) {
|
|
|
13211
13287
|
return zstdCompressAsync(input, CHECKSUM_OPTIONS);
|
|
13212
13288
|
}
|
|
13213
13289
|
/**
|
|
13214
|
-
* Select the shared private decoder when the running Node
|
|
13290
|
+
* Select the shared private decoder when the running Node 24/26 shape is
|
|
13215
13291
|
* compatible, otherwise preserve correctness with the public one-shot API.
|
|
13216
13292
|
* @returns a synchronous decoder with an implementation-independent lifecycle.
|
|
13217
13293
|
*/
|
package/locale/de.json
ADDED
package/locale/es.json
ADDED
package/locale/fr.json
ADDED
package/locale/ja.json
ADDED
package/locale/pt.json
ADDED
package/locale/ru.json
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-session-persistence-jsonl",
|
|
3
3
|
"description": "JSONL durable session persistence backend for the DeepSeek Harness",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2-alpha.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -30,24 +30,24 @@
|
|
|
30
30
|
],
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@deepseek-ai/dsh-session": "0.2.
|
|
34
|
-
"@deepseek-ai/dsh-session-persistence": "0.2.
|
|
35
|
-
"@deepseek-ai/cordis": "~4.0.
|
|
33
|
+
"@deepseek-ai/dsh-session": "0.2.2-alpha.2",
|
|
34
|
+
"@deepseek-ai/dsh-session-persistence": "0.2.2-alpha.2",
|
|
35
|
+
"@deepseek-ai/cordis": "~4.0.6-alpha.1"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@deepseek-ai/dsh-llm": "0.2.
|
|
39
|
-
"@deepseek-ai/dsh-session-format": "0.2.
|
|
40
|
-
"@deepseek-ai/dsh-session-format-catalog": "0.2.
|
|
41
|
-
"@deepseek-ai/dsh-session-format-v3-to-v4": "0.2.
|
|
38
|
+
"@deepseek-ai/dsh-llm": "0.2.2-alpha.2",
|
|
39
|
+
"@deepseek-ai/dsh-session-format": "0.2.2-alpha.2",
|
|
40
|
+
"@deepseek-ai/dsh-session-format-catalog": "0.2.2-alpha.2",
|
|
41
|
+
"@deepseek-ai/dsh-session-format-v3-to-v4": "0.2.2-alpha.2",
|
|
42
42
|
"@deepseek-ai/node-addon-system": "~0.1.2",
|
|
43
|
-
"@deepseek-ai/schemastery": "~3.18.
|
|
43
|
+
"@deepseek-ai/schemastery": "~3.18.6-alpha.1",
|
|
44
44
|
"koffi": "3.1.1",
|
|
45
45
|
"p-limit": "7.3.3"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@deepseek-ai/dsh-session": "0.2.
|
|
49
|
-
"@deepseek-ai/dsh-session-format-v0-to-v1": "0.2.
|
|
50
|
-
"@deepseek-ai/dsh-session-persistence": "0.2.
|
|
51
|
-
"@deepseek-ai/cordis": "~4.0.
|
|
48
|
+
"@deepseek-ai/dsh-session": "0.2.2-alpha.2",
|
|
49
|
+
"@deepseek-ai/dsh-session-format-v0-to-v1": "0.2.2-alpha.2",
|
|
50
|
+
"@deepseek-ai/dsh-session-persistence": "0.2.2-alpha.2",
|
|
51
|
+
"@deepseek-ai/cordis": "~4.0.6-alpha.1"
|
|
52
52
|
}
|
|
53
53
|
}
|