dsh-test-drive 0.3.9 → 0.3.11

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/CHANGELOG.md CHANGED
@@ -5,6 +5,32 @@ All notable changes to this project are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.3.11] - 2026-09-10
9
+
10
+ ### Changed
11
+
12
+ - Pin the `@deepseek-ai/dsh-*` dev/test dependencies to the published `0.1.5-rc.1` line and record `0.1.5-rc.1` in `dshWorkshop.compatibility.dshVersions`; the monthly Compat workflow now runs against `0.1.5-rc.1`. The peer range `>=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0` is unchanged, so no supported host line is dropped.
13
+
14
+ ### Docs
15
+
16
+ - Refresh the five-language README compatibility baseline to `dsh-v0.1.5-rc.1` (verified 2026-09-10).
17
+
18
+ ## [0.3.10] - 2026-09-09
19
+
20
+ ### Fixed
21
+
22
+ - Read the newest durable session log from the harness's real layout. `DshDriver.readNewestSession` scanned only `.jsonl` files directly under `$DSH_HOME/sessions`, but the harness stores one artifact per session at `sessions/<projectKey>/<sessionId>/session[.vN].jsonl[.zstd]`, so on a real profile the lookup always returned `''` and the capability stage reported `not-registered` for every tool and command — a false negative with no test coverage. The new `src/session-log.ts` drills both directory levels, accepts only canonical generation names (`session.jsonl` / `session.vN.jsonl`, N >= 1, optional `.zstd`), prefers the highest generation inside a session directory (mtime breaks ties and orders sessions), and skips root-level stray files, symlinks, and non-canonical names. The legacy flat layout is not read: the harness itself rejects it, so a stray root-level `*.jsonl` can no longer be mistaken for a session.
23
+ - Decode every frame of a compressed session artifact. The harness writes `.jsonl.zstd` as a concatenated Zstandard container (one header frame plus one frame per durable batch), and Node's whole-file `zstdDecompressSync` silently returns only the first frame — measured on this baseline (4 frames / 256 bytes → 41 bytes, header only). `src/session-log.ts` scans the frame structure and decodes frame by frame, so `tool/call`/`tool/result` lines after the header are visible again; a torn final frame still yields every earlier frame, and a corrupt container degrades to `''` instead of throwing (the pre-fix tolerant contract).
24
+
25
+ ### Changed
26
+
27
+ - Capability semantics: `stages.capability.status` now reflects what the headless task actually recorded instead of a structural false negative, so downstream `dsh-score` reads a real `observed`/`invoked`/`not-registered` verdict from new runs. Existing records and the `dsh-test-drive/v1` shape are unchanged (`DOMAIN_VERSION` stays `1`).
28
+
29
+ ### Docs
30
+
31
+ - `THIRD_PARTY_NOTICES.md` records the MIT-licensed Zstandard frame scanner mirrored from DeepSeek Harness (`packages/session/session-persistence-jsonl/src/zstd.ts`, host `dsh-v0.1.5-alpha.1`) with the full MIT notice; `AGENTS.md` documents the new module; the five READMEs refresh the structured-result sample to `pluginVersion` `0.3.10`.
32
+ - New tests: `tests/session-log.spec.ts` covers the layout and decoding contract on synthetic fixtures only (two-level drill-down, `_no-cwd`, generation preference over newer mtimes, checksummed multi-frame containers, torn-tail recovery, tail truncation, empty/missing store, corrupt artifact, ignored flat legacy layout), and `tests/driver.spec.ts` closes the decode → `analyzeSessionLog` → `observed` loop through the driver.
33
+
8
34
  ## [0.3.9] - 2026-09-09
9
35
 
10
36
  ### Fixed
package/README.es.md CHANGED
@@ -26,7 +26,7 @@
26
26
 
27
27
  | Componente | Versión |
28
28
  |---|---|
29
- | DeepSeek Harness | **`dsh-v0.1.5-alpha.1`** (etiqueta de GitHub, verificado el 2026-09-09: cadena completa de puertas + smoke de instalación de perfil). Líneas de dependencia npm `0.1.2-rc.1` y `0.1.5-alpha.1` (dependencias entre pares `>=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0`). |
29
+ | DeepSeek Harness | **`dsh-v0.1.5-rc.1`** (etiqueta de GitHub, verificado el 2026-09-10: cadena completa de puertas + smoke de instalación de perfil). Líneas de dependencia npm `0.1.2-rc.1` y `0.1.5-rc.1` (dependencias entre pares `>=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0`). |
30
30
  | Node.js | `^22.19.0 \|\| >=24.0.0` |
31
31
  | Gestor de paquetes | `pnpm@11.7.0` |
32
32
  | Plataforma | Windows / macOS / Linux (complemento solo host) |
@@ -127,7 +127,7 @@ Devuelve un registro de ejecución (`tdr_...`), una matriz (`tdm_...`) o — sin
127
127
  "schema": "dsh-test-drive/v1",
128
128
  "run": { "runId": "tdr_9f2c...", "startedAt": "2026-08-16T00:00:00.000Z",
129
129
  "finishedAt": "2026-08-16T00:00:45.120Z", "durationMs": 45120,
130
- "harnessVersion": "0.1.5-alpha.1", "pluginVersion": "0.3.9",
130
+ "harnessVersion": "0.1.5-rc.1", "pluginVersion": "0.3.10",
131
131
  "platform": "win32", "node": "v22.22.3" },
132
132
  "target": { "kind": "repo", "spec": "github:owner/dsh-click#abc123",
133
133
  "resolved": { "packageName": "dsh-click", "packageVersion": "0.1.0",
@@ -196,7 +196,7 @@ pnpm run typecheck && pnpm run typecheck:ci && pnpm test
196
196
  pnpm run build && pnpm run verify:self-contained && pnpm run verify:artifacts && pnpm pack
197
197
  ```
198
198
 
199
- - `typecheck` resuelve `@deepseek-ai/*` a través del checkout local del harness; `typecheck:ci` comprueba contra los tipos publicados `0.1.5-alpha.1`.
199
+ - `typecheck` resuelve `@deepseek-ai/*` a través del checkout local del harness; `typecheck:ci` comprueba contra los tipos publicados `0.1.5-rc.1`.
200
200
  - Las pruebas usan la pila real `Context`/`Session`/`ToolRuntime`/`LocalJobRegistry`/almacenamiento con un proveedor de subprocesos guionizado.
201
201
  - End-to-end con CLI real (requiere red + `dsh` en PATH): `DSH_TESTDRIVE_E2E=1 pnpm run test:e2e` — prueba el checkout de este propio paquete por el bucle real de instalación y arranque.
202
202
  - Lanzamiento: `node scripts/release.mjs <x.y.z>` (sube versión, sella CHANGELOG, repite la puerta, commit + tag; nunca hace push).
package/README.hi.md CHANGED
@@ -26,7 +26,7 @@
26
26
 
27
27
  | घटक | संस्करण |
28
28
  |---|---|
29
- | DeepSeek Harness | **`dsh-v0.1.5-alpha.1`** (GitHub tag, 2026-09-09 को सत्यापित: पूर्ण गेट श्रृंखला + प्रोफ़ाइल इंस्टॉल स्मोक)। npm निर्भरता लाइन `0.1.2-rc.1` और `0.1.5-alpha.1` (peer निर्भरताएँ `>=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0`)。 |
29
+ | DeepSeek Harness | **`dsh-v0.1.5-rc.1`** (GitHub tag, 2026-09-10 को सत्यापित: पूर्ण गेट श्रृंखला + प्रोफ़ाइल इंस्टॉल स्मोक)। npm निर्भरता लाइन `0.1.2-rc.1` और `0.1.5-rc.1` (peer निर्भरताएँ `>=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0`)。 |
30
30
  | Node.js | `^22.19.0 \|\| >=24.0.0` |
31
31
  | पैकेज प्रबंधक | `pnpm@11.7.0` |
32
32
  | प्लेटफ़ॉर्म | Windows / macOS / Linux (केवल host प्लगइन) |
@@ -127,7 +127,7 @@ test_drive(target: string, headlessTask?: string, background?: boolean,
127
127
  "schema": "dsh-test-drive/v1",
128
128
  "run": { "runId": "tdr_9f2c...", "startedAt": "2026-08-16T00:00:00.000Z",
129
129
  "finishedAt": "2026-08-16T00:00:45.120Z", "durationMs": 45120,
130
- "harnessVersion": "0.1.5-alpha.1", "pluginVersion": "0.3.9",
130
+ "harnessVersion": "0.1.5-rc.1", "pluginVersion": "0.3.10",
131
131
  "platform": "win32", "node": "v22.22.3" },
132
132
  "target": { "kind": "repo", "spec": "github:owner/dsh-click#abc123",
133
133
  "resolved": { "packageName": "dsh-click", "packageVersion": "0.1.0",
@@ -196,7 +196,7 @@ pnpm run typecheck && pnpm run typecheck:ci && pnpm test
196
196
  pnpm run build && pnpm run verify:self-contained && pnpm run verify:artifacts && pnpm pack
197
197
  ```
198
198
 
199
- - `typecheck` स्थानीय harness चेकआउट से `@deepseek-ai/*` हल करता है; `typecheck:ci` प्रकाशित `0.1.5-alpha.1` प्रकारों से जाँचता है।
199
+ - `typecheck` स्थानीय harness चेकआउट से `@deepseek-ai/*` हल करता है; `typecheck:ci` प्रकाशित `0.1.5-rc.1` प्रकारों से जाँचता है।
200
200
  - परीक्षण वास्तविक `Context`/`Session`/`ToolRuntime`/`LocalJobRegistry`/स्टोरेज स्टैक और एक स्क्रिप्टेड subprocess प्रदाता का उपयोग करते हैं।
201
201
  - वास्तविक-CLI एंड-टू-एंड (नेटवर्क + PATH पर `dsh` आवश्यक): `DSH_TESTDRIVE_E2E=1 pnpm run test:e2e` — इसी पैकेज के चेकआउट को वास्तविक इंस्टॉल-स्मोक लूप से परखता है।
202
202
  - रिलीज़: `node scripts/release.mjs <x.y.z>` (संस्करण बढ़ाता, CHANGELOG मुहर लगाता, द्वार फिर चलाता, commit + tag; कभी push नहीं)।
package/README.md CHANGED
@@ -27,7 +27,7 @@
27
27
 
28
28
  | Component | Version |
29
29
  |---|---|
30
- | DeepSeek Harness | **`dsh-v0.1.5-alpha.1`** (GitHub tag, verified 2026-09-09: full gate chain + profile install smoke). npm dependency lines `0.1.2-rc.1` and `0.1.5-alpha.1` (peer dependencies `>=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0`) |
30
+ | DeepSeek Harness | **`dsh-v0.1.5-rc.1`** (GitHub tag, verified 2026-09-10: full gate chain + profile install smoke). npm dependency lines `0.1.2-rc.1` and `0.1.5-rc.1` (peer dependencies `>=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0`) |
31
31
  | Node.js | `^22.19.0 \|\| >=24.0.0` |
32
32
  | Package manager | `pnpm@11.7.0` |
33
33
  | Platform | Windows / macOS / Linux (host-only plugin) |
@@ -128,7 +128,7 @@ Returns a run record (`tdr_...`), a matrix (`tdm_...`), or — with no id — th
128
128
  "schema": "dsh-test-drive/v1",
129
129
  "run": { "runId": "tdr_9f2c...", "startedAt": "2026-08-16T00:00:00.000Z",
130
130
  "finishedAt": "2026-08-16T00:00:45.120Z", "durationMs": 45120,
131
- "harnessVersion": "0.1.5-alpha.1", "pluginVersion": "0.3.9",
131
+ "harnessVersion": "0.1.5-rc.1", "pluginVersion": "0.3.10",
132
132
  "platform": "win32", "node": "v22.22.3" },
133
133
  "target": { "kind": "repo", "spec": "github:owner/dsh-click#abc123",
134
134
  "resolved": { "packageName": "dsh-click", "packageVersion": "0.1.0",
@@ -223,7 +223,7 @@ pnpm run typecheck && pnpm run typecheck:ci && pnpm test
223
223
  pnpm run build && pnpm run verify:self-contained && pnpm run verify:artifacts && pnpm pack
224
224
  ```
225
225
 
226
- - `typecheck` resolves `@deepseek-ai/*` through the local harness checkout; `typecheck:ci` checks against the published `0.1.5-alpha.1` types.
226
+ - `typecheck` resolves `@deepseek-ai/*` through the local harness checkout; `typecheck:ci` checks against the published `0.1.5-rc.1` types.
227
227
  - Tests use the real `Context`/`Session`/`ToolRuntime`/`LocalJobRegistry`/storage stack with a scripted subprocess provider.
228
228
  - Real-CLI end-to-end (requires network + `dsh` on PATH): `DSH_TESTDRIVE_E2E=1 pnpm run test:e2e` — drives this package's own checkout through the real install-smoke loop.
229
229
  - Release: `node scripts/release.mjs <x.y.z>` (bumps, stamps CHANGELOG, re-runs the gate, commits + tags; never pushes).
package/README.pt.md CHANGED
@@ -26,7 +26,7 @@
26
26
 
27
27
  | Componente | Versão |
28
28
  |---|---|
29
- | DeepSeek Harness | **`dsh-v0.1.5-alpha.1`** (tag do GitHub, verificado em 2026-09-09: cadeia completa de portas + smoke de instalação de perfil). Linhas de dependência npm `0.1.2-rc.1` e `0.1.5-alpha.1` (dependências de pares `>=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0`). |
29
+ | DeepSeek Harness | **`dsh-v0.1.5-rc.1`** (tag do GitHub, verificado em 2026-09-10: cadeia completa de portas + smoke de instalação de perfil). Linhas de dependência npm `0.1.2-rc.1` e `0.1.5-rc.1` (dependências de pares `>=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0`). |
30
30
  | Node.js | `^22.19.0 \|\| >=24.0.0` |
31
31
  | Gerenciador de pacotes | `pnpm@11.7.0` |
32
32
  | Plataforma | Windows / macOS / Linux (plugin apenas host) |
@@ -127,7 +127,7 @@ Retorna um registro de execução (`tdr_...`), uma matriz (`tdm_...`) ou — sem
127
127
  "schema": "dsh-test-drive/v1",
128
128
  "run": { "runId": "tdr_9f2c...", "startedAt": "2026-08-16T00:00:00.000Z",
129
129
  "finishedAt": "2026-08-16T00:00:45.120Z", "durationMs": 45120,
130
- "harnessVersion": "0.1.5-alpha.1", "pluginVersion": "0.3.9",
130
+ "harnessVersion": "0.1.5-rc.1", "pluginVersion": "0.3.10",
131
131
  "platform": "win32", "node": "v22.22.3" },
132
132
  "target": { "kind": "repo", "spec": "github:owner/dsh-click#abc123",
133
133
  "resolved": { "packageName": "dsh-click", "packageVersion": "0.1.0",
@@ -196,7 +196,7 @@ pnpm run typecheck && pnpm run typecheck:ci && pnpm test
196
196
  pnpm run build && pnpm run verify:self-contained && pnpm run verify:artifacts && pnpm pack
197
197
  ```
198
198
 
199
- - `typecheck` resolve `@deepseek-ai/*` pelo checkout local do harness; `typecheck:ci` verifica contra os tipos publicados `0.1.5-alpha.1`.
199
+ - `typecheck` resolve `@deepseek-ai/*` pelo checkout local do harness; `typecheck:ci` verifica contra os tipos publicados `0.1.5-rc.1`.
200
200
  - Os testes usam a pilha real `Context`/`Session`/`ToolRuntime`/`LocalJobRegistry`/armazenamento com um provedor de subprocesso roteirizado.
201
201
  - End-to-end com CLI real (requer rede + `dsh` no PATH): `DSH_TESTDRIVE_E2E=1 pnpm run test:e2e` — testa o checkout deste próprio pacote pelo loop real de instalação e inicialização.
202
202
  - Lançamento: `node scripts/release.mjs <x.y.z>` (sobe versão, carimba o CHANGELOG, repete a porta, commit + tag; nunca faz push).
package/README.zh.md CHANGED
@@ -26,7 +26,7 @@
26
26
 
27
27
  | 组件 | 版本 |
28
28
  |---|---|
29
- | DeepSeek Harness | **`dsh-v0.1.5-alpha.1`**(GitHub tag,2026-09-09 已核验:完整门禁链 + profile 安装冒烟)。npm 依赖线 `0.1.2-rc.1` 与 `0.1.5-alpha.1`(peer 依赖 `>=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0`)。 |
29
+ | DeepSeek Harness | **`dsh-v0.1.5-rc.1`**(GitHub tag,2026-09-10 已核验:完整门禁链 + profile 安装冒烟)。npm 依赖线 `0.1.2-rc.1` 与 `0.1.5-rc.1`(peer 依赖 `>=0.1.2-rc.1 <0.2.0 || >=0.1.5-alpha.1 <0.2.0`)。 |
30
30
  | Node.js | `^22.19.0 \|\| >=24.0.0` |
31
31
  | 包管理器 | `pnpm@11.7.0` |
32
32
  | 平台 | Windows / macOS / Linux(纯 host 插件) |
@@ -127,7 +127,7 @@ test_drive(target: string, headlessTask?: string, background?: boolean,
127
127
  "schema": "dsh-test-drive/v1",
128
128
  "run": { "runId": "tdr_9f2c...", "startedAt": "2026-08-16T00:00:00.000Z",
129
129
  "finishedAt": "2026-08-16T00:00:45.120Z", "durationMs": 45120,
130
- "harnessVersion": "0.1.5-alpha.1", "pluginVersion": "0.3.9",
130
+ "harnessVersion": "0.1.5-rc.1", "pluginVersion": "0.3.10",
131
131
  "platform": "win32", "node": "v22.22.3" },
132
132
  "target": { "kind": "repo", "spec": "github:owner/dsh-click#abc123",
133
133
  "resolved": { "packageName": "dsh-click", "packageVersion": "0.1.0",
@@ -196,7 +196,7 @@ pnpm run typecheck && pnpm run typecheck:ci && pnpm test
196
196
  pnpm run build && pnpm run verify:self-contained && pnpm run verify:artifacts && pnpm pack
197
197
  ```
198
198
 
199
- - `typecheck` 经本地 harness checkout 解析 `@deepseek-ai/*`;`typecheck:ci` 对照已发布的 `0.1.5-alpha.1` 类型检查。
199
+ - `typecheck` 经本地 harness checkout 解析 `@deepseek-ai/*`;`typecheck:ci` 对照已发布的 `0.1.5-rc.1` 类型检查。
200
200
  - 测试使用真实 `Context`/`Session`/`ToolRuntime`/`LocalJobRegistry`/storage 栈 + 脚本化 subprocess provider。
201
201
  - 真实 CLI 端到端(需网络 + PATH 上的 `dsh`):`DSH_TESTDRIVE_E2E=1 pnpm run test:e2e` —— 用真实安装冒烟循环实测本包自身 checkout。
202
202
  - 发布:`node scripts/release.mjs <x.y.z>`(升版本、CHANGELOG 落日期、重跑门禁、commit + tag;不 push)。
@@ -1,8 +1,9 @@
1
1
  # Third-Party Notices
2
2
 
3
3
  `dsh-test-drive` is licensed under the [Apache License 2.0](LICENSE). The
4
- runtime imports only `node:` builtins and `@deepseek-ai/*` peer packages; the
5
- dependencies below are build/runtime tooling installed alongside the package.
4
+ runtime imports only `node:` builtins, `@deepseek-ai/*` peer packages, and one
5
+ MIT-licensed helper mirrored from DeepSeek Harness (below); the dependencies
6
+ in the table are build/runtime tooling installed alongside the package.
6
7
 
7
8
  | Package | Version range | License | Purpose |
8
9
  |---|---|---|---|
@@ -10,6 +11,37 @@ dependencies below are build/runtime tooling installed alongside the package.
10
11
  | [tsdown](https://github.com/rolldown/tsdown) | `^0.22.14` | MIT | ESM bundling of `src/` into `lib/` in `scripts/prepare.mjs`. |
11
12
  | [zod](https://github.com/colinhacks/zod) | `^4.4.3` | MIT | Domain record schemas validated at the storage-domain durable boundary. |
12
13
 
14
+ ## DeepSeek Harness — Zstandard frame scanner (mirrored, MIT)
15
+
16
+ - Source: <https://github.com/deepseek-ai/deepseek-harness>
17
+ `packages/session/session-persistence-jsonl/src/zstd.ts` (`scanZstdFrames`,
18
+ lines 48–104) at host baseline `dsh-v0.1.5-alpha.1` (commit `19d2e38480`)
19
+ - License: MIT
20
+ - Copyright (c) 2026 DeepSeek
21
+ - Local use: `src/session-log.ts` mirrors the structural frame scan because
22
+ the helper is not part of the package's published surface, and a session
23
+ artifact is a concatenated-frame Zstandard container that Node's whole-file
24
+ decompression decodes only partially. The mirrored code is inlined into the
25
+ built `lib/index.js`.
26
+
27
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
28
+ > of this software and associated documentation files (the "Software"), to deal
29
+ > in the Software without restriction, including without limitation the rights
30
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
31
+ > copies of the Software, and to permit persons to whom the Software is
32
+ > furnished to do so, subject to the following conditions:
33
+ >
34
+ > The above copyright notice and this permission notice shall be included in
35
+ > all copies or substantial portions of the Software.
36
+ >
37
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
40
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
41
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
42
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
43
+ > THE SOFTWARE.
44
+
13
45
  Peer dependencies (`@deepseek-ai/cordis`, `@deepseek-ai/schemastery`, and the
14
46
  pinned `@deepseek-ai/dsh-*` packages) are provided by the DeepSeek Harness
15
47
  installation and carry their own notices.
package/lib/index.js CHANGED
@@ -2,6 +2,7 @@ import { randomBytes } from "node:crypto";
2
2
  import { z } from "zod";
3
3
  import { access, mkdir, mkdtemp, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
4
4
  import { basename, dirname, isAbsolute, join, resolve } from "node:path";
5
+ import { zstdDecompressSync } from "node:zlib";
5
6
  import z$1 from "@deepseek-ai/schemastery";
6
7
  import { defineDomain, domainTable } from "@deepseek-ai/dsh-storage-domain";
7
8
  import { defineTool } from "@deepseek-ai/dsh-tools";
@@ -156,6 +157,219 @@ function analyzeSessionLog(log, spec) {
156
157
  };
157
158
  }
158
159
  //#endregion
160
+ //#region src/session-log.ts
161
+ /**
162
+ * Session-store discovery and multi-frame Zstandard decoding for the
163
+ * capability stage.
164
+ *
165
+ * The harness stores one artifact per session at
166
+ * `$DSH_HOME/sessions/<projectKey>/<sessionId>/session[.vN].jsonl[.zstd]`
167
+ * (host `packages/session/session-persistence-jsonl/src/format.ts:253-303`
168
+ * on the `0.1.5-alpha.1` baseline), and writes the compressed form as a
169
+ * CONCATENATED Zstandard container — one frame per durable batch — so Node's
170
+ * whole-file `zstdDecompressSync` silently returns only the first frame
171
+ * (`header`). Reading a real log therefore requires both the two-level
172
+ * drill-down and per-frame decoding.
173
+ *
174
+ * Everything here is tolerant by contract: discovery degrades to `undefined`
175
+ * and reading to `''`, never throwing into the drive pipeline.
176
+ *
177
+ * @module dsh-test-drive/session-log
178
+ */
179
+ /**
180
+ * Canonical generation log basename: `session.jsonl` (generation 0) or
181
+ * `session.vN.jsonl` with N >= 1, optionally carrying the `.zstd` compression
182
+ * suffix. Temporary, uppercase, leading-zero, and `.v0` names are not
183
+ * canonical (host `session-format/src/filename.ts:5-17` plus the compression
184
+ * suffix of `session-persistence-jsonl/src/format.ts:41-47`).
185
+ */
186
+ const GENERATION_LOG_NAME = /^session(?:\.v([1-9][0-9]*))?\.jsonl(\.zstd)?$/u;
187
+ /** Zstandard frame magic, little-endian. */
188
+ const ZSTD_MAGIC = 4247762216;
189
+ /**
190
+ * Locate complete frames without decompressing their blocks. Invalid complete
191
+ * structure rejects; EOF inside the final frame returns its start so a crashed
192
+ * write still yields every earlier frame.
193
+ *
194
+ * Mirrored from DeepSeek Harness
195
+ * `packages/session/session-persistence-jsonl/src/zstd.ts:48-104` (MIT, host
196
+ * baseline `dsh-v0.1.5-alpha.1`, commit `19d2e38480`) because that helper is
197
+ * not part of the published package surface; the license notice lives in
198
+ * THIRD_PARTY_NOTICES.md.
199
+ *
200
+ * @param buffer - complete bytes currently present in the session artifact.
201
+ * @param maxFrames - optional complete-frame limit for metadata-only readers.
202
+ * @returns complete frame ranges and an optional incomplete-final-frame start.
203
+ */
204
+ function scanZstdFrames(buffer, maxFrames = Number.POSITIVE_INFINITY) {
205
+ const frames = [];
206
+ let offset = 0;
207
+ while (offset < buffer.length) {
208
+ const start = offset;
209
+ if (buffer.length - offset < 4) return {
210
+ frames,
211
+ tornStart: start
212
+ };
213
+ if (buffer.readUInt32LE(offset) !== ZSTD_MAGIC) throw new Error(`corrupt Zstandard session log: invalid frame magic at byte ${offset}`);
214
+ offset += 4;
215
+ if (offset === buffer.length) return {
216
+ frames,
217
+ tornStart: start
218
+ };
219
+ const descriptor = buffer.readUInt8(offset);
220
+ offset += 1;
221
+ if ((descriptor & 24) !== 0) throw new Error(`corrupt Zstandard session log: reserved frame-header bit at byte ${offset - 1}`);
222
+ const contentSizeFlag = descriptor >>> 6;
223
+ const singleSegment = (descriptor & 32) !== 0;
224
+ const checksum = (descriptor & 4) !== 0;
225
+ const dictionaryFlag = descriptor & 3;
226
+ const dictionaryBytes = dictionaryFlag === 3 ? 4 : dictionaryFlag;
227
+ const contentSizeBytes = contentSizeFlag === 0 ? singleSegment ? 1 : 0 : 1 << contentSizeFlag;
228
+ const remainingHeaderBytes = (singleSegment ? 0 : 1) + dictionaryBytes + contentSizeBytes;
229
+ if (buffer.length - offset < remainingHeaderBytes) return {
230
+ frames,
231
+ tornStart: start
232
+ };
233
+ offset += remainingHeaderBytes;
234
+ for (;;) {
235
+ if (buffer.length - offset < 3) return {
236
+ frames,
237
+ tornStart: start
238
+ };
239
+ const blockHeader = buffer.readUIntLE(offset, 3);
240
+ offset += 3;
241
+ const lastBlock = (blockHeader & 1) !== 0;
242
+ const blockType = blockHeader >>> 1 & 3;
243
+ const blockSize = blockHeader >>> 3;
244
+ if (blockType === 3) throw new Error(`corrupt Zstandard session log: reserved block type at byte ${offset - 3}`);
245
+ const payloadBytes = blockType === 1 ? 1 : blockSize;
246
+ if (buffer.length - offset < payloadBytes) return {
247
+ frames,
248
+ tornStart: start
249
+ };
250
+ offset += payloadBytes;
251
+ if (lastBlock) break;
252
+ }
253
+ if (checksum) {
254
+ if (buffer.length - offset < 4) return {
255
+ frames,
256
+ tornStart: start
257
+ };
258
+ offset += 4;
259
+ }
260
+ frames.push({
261
+ start,
262
+ end: offset
263
+ });
264
+ if (frames.length === maxFrames) return { frames };
265
+ }
266
+ return { frames };
267
+ }
268
+ /**
269
+ * Decode a concatenated Zstandard container frame by frame. A torn final
270
+ * frame contributes nothing, while every complete frame before it still
271
+ * decodes — Node's own whole-file API would silently return only the first.
272
+ *
273
+ * @param buffer - the artifact bytes.
274
+ * @returns the concatenated plaintext of every complete frame.
275
+ * @throws when a structurally complete frame fails validation (the caller
276
+ * applies the tolerant `''` contract).
277
+ */
278
+ function decodeZstdFrames(buffer) {
279
+ const { frames } = scanZstdFrames(buffer);
280
+ let text = "";
281
+ for (const { start, end } of frames) text += zstdDecompressSync(buffer.subarray(start, end)).toString("utf8");
282
+ return text;
283
+ }
284
+ /**
285
+ * Newest canonical artifact inside one session directory: the highest
286
+ * generation wins regardless of mtime, with mtime only breaking a tie between
287
+ * two artifacts of the same generation (host
288
+ * `resolveGenerationInDirectory`, `session-persistence-jsonl/src/index.ts:1369-1405`).
289
+ */
290
+ async function newestGenerationIn(sessionDir) {
291
+ let entries;
292
+ try {
293
+ entries = await readdir(sessionDir, { withFileTypes: true });
294
+ } catch {
295
+ return;
296
+ }
297
+ let best;
298
+ for (const entry of entries) {
299
+ const match = GENERATION_LOG_NAME.exec(entry.name);
300
+ if (match === null) continue;
301
+ const path = join(sessionDir, entry.name);
302
+ try {
303
+ const info = await stat(path);
304
+ if (!info.isFile()) continue;
305
+ const candidate = {
306
+ path,
307
+ zstd: match[2] === ".zstd",
308
+ generation: match[1] === void 0 ? 0 : Number(match[1]),
309
+ mtimeMs: info.mtimeMs
310
+ };
311
+ if (best === void 0 || candidate.generation > best.generation || candidate.generation === best.generation && candidate.mtimeMs > best.mtimeMs) best = candidate;
312
+ } catch {}
313
+ }
314
+ return best;
315
+ }
316
+ /**
317
+ * Find the newest canonical session artifact under `$DSH_HOME/sessions`.
318
+ * The store is two levels deep (`<projectKey>/<sessionId>/`), so a flat scan
319
+ * only ever sees project directories; `_no-cwd` is an ordinary project key.
320
+ * A non-directory entry (root-level stray file, symlink) is skipped, matching
321
+ * the host's `listProjectDirs`/`listSessionDirs` directory-only rule.
322
+ *
323
+ * @param home - the throwaway DSH_HOME.
324
+ * @returns the newest artifact, or undefined when the store is missing/empty.
325
+ */
326
+ async function findNewestSessionLog(home) {
327
+ const root = join(home, "sessions");
328
+ let projects;
329
+ try {
330
+ projects = await readdir(root, { withFileTypes: true });
331
+ } catch {
332
+ return;
333
+ }
334
+ let newest;
335
+ for (const project of projects) {
336
+ if (!project.isDirectory()) continue;
337
+ const projectDir = join(root, project.name);
338
+ let sessions;
339
+ try {
340
+ sessions = await readdir(projectDir, { withFileTypes: true });
341
+ } catch {
342
+ continue;
343
+ }
344
+ for (const session of sessions) {
345
+ if (!session.isDirectory()) continue;
346
+ const candidate = await newestGenerationIn(join(projectDir, session.name));
347
+ if (candidate !== void 0 && (newest === void 0 || candidate.mtimeMs > newest.mtimeMs)) newest = candidate;
348
+ }
349
+ }
350
+ return newest;
351
+ }
352
+ /**
353
+ * Read the newest session log text, decoding every Zstandard frame.
354
+ *
355
+ * Tolerant by contract: a missing store, an unreadable artifact, or a corrupt
356
+ * container yields `''` so the capability stage degrades instead of throwing.
357
+ *
358
+ * @param home - the throwaway DSH_HOME.
359
+ * @param maxBytes - cap on the returned text (tail end kept).
360
+ * @returns the newest session file's text, or '' when none exists.
361
+ */
362
+ async function readNewestSessionLog(home, maxBytes) {
363
+ const newest = await findNewestSessionLog(home);
364
+ if (newest === void 0) return "";
365
+ try {
366
+ const text = newest.zstd ? decodeZstdFrames(await readFile(newest.path)) : await readFile(newest.path, "utf8");
367
+ return text.length <= maxBytes ? text : text.slice(text.length - maxBytes);
368
+ } catch {
369
+ return "";
370
+ }
371
+ }
372
+ //#endregion
159
373
  //#region src/driver.ts
160
374
  /**
161
375
  * The `dsh` CLI driver: locates a spawnable dsh executable (config override,
@@ -422,39 +636,20 @@ var DshDriver = class {
422
636
  /**
423
637
  * Read the newest durable session log from a throwaway home's session store.
424
638
  * Used by the capability stage to observe what the headless task actually
425
- * did (tool calls, command replies). Tolerant by contract: a missing or
426
- * empty store yields '' so the stage degrades instead of throwing.
639
+ * did (tool calls, command replies). The harness layout is
640
+ * `sessions/<projectKey>/<sessionId>/session[.vN].jsonl[.zstd]`, so the
641
+ * lookup drills two levels down, prefers the highest canonical generation,
642
+ * and decodes every Zstandard frame (the artifact is a concatenated-frame
643
+ * container; Node's whole-file API silently returns only the first frame).
644
+ * Tolerant by contract: a missing or empty store yields '' so the stage
645
+ * degrades instead of throwing.
427
646
  *
428
647
  * @param home - the throwaway DSH_HOME.
429
648
  * @param maxBytes - cap on the returned text (tail end kept).
430
649
  * @returns the newest session file's text, or '' when none exists.
431
650
  */
432
651
  async readNewestSession(home, maxBytes) {
433
- let entries;
434
- try {
435
- entries = await readdir(join(home, "sessions"));
436
- } catch {
437
- return "";
438
- }
439
- let newest;
440
- for (const entry of entries) {
441
- if (!/\.jsonl$/u.test(entry)) continue;
442
- const path = join(home, "sessions", entry);
443
- try {
444
- const info = await stat(path);
445
- if (info.isFile() && (newest === void 0 || info.mtimeMs > newest.mtimeMs)) newest = {
446
- path,
447
- mtimeMs: info.mtimeMs
448
- };
449
- } catch {}
450
- }
451
- if (newest === void 0) return "";
452
- try {
453
- const text = await readFile(newest.path, "utf8");
454
- return text.length <= maxBytes ? text : text.slice(text.length - maxBytes);
455
- } catch {
456
- return "";
457
- }
652
+ return readNewestSessionLog(home, maxBytes);
458
653
  }
459
654
  /** Run the uninstall stage: `dsh plugin --profile <name> remove <pkg>`. */
460
655
  async remove(packageName, options) {
@@ -883,7 +1078,7 @@ function sanitizeOutput(text, tempRoot, maxChars) {
883
1078
  * The structured report records it as `run.pluginVersion`.
884
1079
  * @module dsh-test-drive/version
885
1080
  */
886
- const VERSION = "0.3.9";
1081
+ const VERSION = "0.3.11";
887
1082
  //#endregion
888
1083
  //#region src/drive.ts
889
1084
  /**
@@ -139,8 +139,13 @@ export declare class DshDriver {
139
139
  /**
140
140
  * Read the newest durable session log from a throwaway home's session store.
141
141
  * Used by the capability stage to observe what the headless task actually
142
- * did (tool calls, command replies). Tolerant by contract: a missing or
143
- * empty store yields '' so the stage degrades instead of throwing.
142
+ * did (tool calls, command replies). The harness layout is
143
+ * `sessions/<projectKey>/<sessionId>/session[.vN].jsonl[.zstd]`, so the
144
+ * lookup drills two levels down, prefers the highest canonical generation,
145
+ * and decodes every Zstandard frame (the artifact is a concatenated-frame
146
+ * container; Node's whole-file API silently returns only the first frame).
147
+ * Tolerant by contract: a missing or empty store yields '' so the stage
148
+ * degrades instead of throwing.
144
149
  *
145
150
  * @param home - the throwaway DSH_HOME.
146
151
  * @param maxBytes - cap on the returned text (tail end kept).
@@ -1 +1 @@
1
- {"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../src/driver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C,2DAA2D;AAC3D,eAAO,MAAM,iBAAiB,QAAY,CAAA;AAE1C,iDAAiD;AACjD,eAAO,MAAM,eAAe,QAAc,CAAA;AAE1C,6DAA6D;AAC7D,eAAO,MAAM,cAAc,OAAQ,CAAA;AAEnC,qGAAqG;AACrG,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAAuF,CAAA;AAErI,kFAAkF;AAClF,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAMjD,CAAA;AAED,4CAA4C;AAC5C,MAAM,WAAW,cAAc;IAC7B,wEAAwE;IACxE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAA;IACd,6BAA6B;IAC7B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AE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAO9E;;;OAGG;IACG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC;IAcxE,kEAAkE;IAC5D,UAAU,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;IAInE,+DAA+D;IACzD,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;IAIhF;;;;;;;;;;;;;;OAcG;IACG,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIxE,2EAA2E;IACrE,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;IAIpF,gEAAgE;IAC1D,OAAO,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAKxD;;;;;OAKG;IACG,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;CA+BtF;AAED,kFAAkF;AAClF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAExD"}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Session-store discovery and multi-frame Zstandard decoding for the
3
+ * capability stage.
4
+ *
5
+ * The harness stores one artifact per session at
6
+ * `$DSH_HOME/sessions/<projectKey>/<sessionId>/session[.vN].jsonl[.zstd]`
7
+ * (host `packages/session/session-persistence-jsonl/src/format.ts:253-303`
8
+ * on the `0.1.5-alpha.1` baseline), and writes the compressed form as a
9
+ * CONCATENATED Zstandard container — one frame per durable batch — so Node's
10
+ * whole-file `zstdDecompressSync` silently returns only the first frame
11
+ * (`header`). Reading a real log therefore requires both the two-level
12
+ * drill-down and per-frame decoding.
13
+ *
14
+ * Everything here is tolerant by contract: discovery degrades to `undefined`
15
+ * and reading to `''`, never throwing into the drive pipeline.
16
+ *
17
+ * @module dsh-test-drive/session-log
18
+ */
19
+ /**
20
+ * Canonical generation log basename: `session.jsonl` (generation 0) or
21
+ * `session.vN.jsonl` with N >= 1, optionally carrying the `.zstd` compression
22
+ * suffix. Temporary, uppercase, leading-zero, and `.v0` names are not
23
+ * canonical (host `session-format/src/filename.ts:5-17` plus the compression
24
+ * suffix of `session-persistence-jsonl/src/format.ts:41-47`).
25
+ */
26
+ export declare const GENERATION_LOG_NAME: RegExp;
27
+ /** Byte range occupied by one structurally complete Zstandard frame. */
28
+ export interface ZstdFrameRange {
29
+ /** Inclusive frame start. */
30
+ start: number;
31
+ /** Exclusive frame end. */
32
+ end: number;
33
+ }
34
+ /** Structural scan result for a concatenated Zstandard stream. */
35
+ export interface ZstdFrameScan {
36
+ /** Complete frames in file order. */
37
+ frames: ZstdFrameRange[];
38
+ /** Start of an incomplete final frame, when EOF interrupts one. */
39
+ tornStart?: number;
40
+ }
41
+ /**
42
+ * Locate complete frames without decompressing their blocks. Invalid complete
43
+ * structure rejects; EOF inside the final frame returns its start so a crashed
44
+ * write still yields every earlier frame.
45
+ *
46
+ * Mirrored from DeepSeek Harness
47
+ * `packages/session/session-persistence-jsonl/src/zstd.ts:48-104` (MIT, host
48
+ * baseline `dsh-v0.1.5-alpha.1`, commit `19d2e38480`) because that helper is
49
+ * not part of the published package surface; the license notice lives in
50
+ * THIRD_PARTY_NOTICES.md.
51
+ *
52
+ * @param buffer - complete bytes currently present in the session artifact.
53
+ * @param maxFrames - optional complete-frame limit for metadata-only readers.
54
+ * @returns complete frame ranges and an optional incomplete-final-frame start.
55
+ */
56
+ export declare function scanZstdFrames(buffer: Buffer, maxFrames?: number): ZstdFrameScan;
57
+ /**
58
+ * Decode a concatenated Zstandard container frame by frame. A torn final
59
+ * frame contributes nothing, while every complete frame before it still
60
+ * decodes — Node's own whole-file API would silently return only the first.
61
+ *
62
+ * @param buffer - the artifact bytes.
63
+ * @returns the concatenated plaintext of every complete frame.
64
+ * @throws when a structurally complete frame fails validation (the caller
65
+ * applies the tolerant `''` contract).
66
+ */
67
+ export declare function decodeZstdFrames(buffer: Buffer): string;
68
+ /** One canonical session artifact found in the store. */
69
+ export interface SessionLogFile {
70
+ /** Absolute artifact path. */
71
+ path: string;
72
+ /** True when the artifact carries the `.zstd` compression suffix. */
73
+ zstd: boolean;
74
+ /** Canonical generation number (0 for `session.jsonl`). */
75
+ generation: number;
76
+ /** Artifact modification time in milliseconds. */
77
+ mtimeMs: number;
78
+ }
79
+ /**
80
+ * Find the newest canonical session artifact under `$DSH_HOME/sessions`.
81
+ * The store is two levels deep (`<projectKey>/<sessionId>/`), so a flat scan
82
+ * only ever sees project directories; `_no-cwd` is an ordinary project key.
83
+ * A non-directory entry (root-level stray file, symlink) is skipped, matching
84
+ * the host's `listProjectDirs`/`listSessionDirs` directory-only rule.
85
+ *
86
+ * @param home - the throwaway DSH_HOME.
87
+ * @returns the newest artifact, or undefined when the store is missing/empty.
88
+ */
89
+ export declare function findNewestSessionLog(home: string): Promise<SessionLogFile | undefined>;
90
+ /**
91
+ * Read the newest session log text, decoding every Zstandard frame.
92
+ *
93
+ * Tolerant by contract: a missing store, an unreadable artifact, or a corrupt
94
+ * container yields `''` so the capability stage degrades instead of throwing.
95
+ *
96
+ * @param home - the throwaway DSH_HOME.
97
+ * @param maxBytes - cap on the returned text (tail end kept).
98
+ * @returns the newest session file's text, or '' when none exists.
99
+ */
100
+ export declare function readNewestSessionLog(home: string, maxBytes: number): Promise<string>;
101
+ //# sourceMappingURL=session-log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-log.d.ts","sourceRoot":"","sources":["../../src/session-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAOH;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,QAAoD,CAAA;AAKpF,wEAAwE;AACxE,MAAM,WAAW,cAAc;IAC7B,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,2BAA2B;IAC3B,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,kEAAkE;AAClE,MAAM,WAAW,aAAa;IAC5B,qCAAqC;IACrC,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,SAA2B,GAAG,aAAa,CAwDlG;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKvD;AAED,yDAAyD;AACzD,MAAM,WAAW,cAAc;IAC7B,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,qEAAqE;IACrE,IAAI,EAAE,OAAO,CAAA;IACb,2DAA2D;IAC3D,UAAU,EAAE,MAAM,CAAA;IAClB,kDAAkD;IAClD,OAAO,EAAE,MAAM,CAAA;CAChB;AAsCD;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAyB5F;AAED;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAW1F"}
@@ -4,5 +4,5 @@
4
4
  * The structured report records it as `run.pluginVersion`.
5
5
  * @module dsh-test-drive/version
6
6
  */
7
- export declare const VERSION = "0.3.9";
7
+ export declare const VERSION = "0.3.11";
8
8
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,OAAO,UAAU,CAAA"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,OAAO,WAAW,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-test-drive",
3
- "version": "0.3.9",
3
+ "version": "0.3.11",
4
4
  "description": "Isolated install-and-smoke test drives for DeepSeek Harness plugins: installs a repo or npm package into a throwaway DSH_HOME profile, verifies the bundle patch layer and boot logs, records a structured pass/fail result matrix (JSON/Markdown) for scoring pipelines, and quarantines every temp directory it owns",
5
5
  "repository": {
6
6
  "type": "git",
@@ -68,7 +68,7 @@
68
68
  "compatibility": {
69
69
  "dshVersions": [
70
70
  "0.1.2-rc.1",
71
- "0.1.5-alpha.1"
71
+ "0.1.5-rc.1"
72
72
  ]
73
73
  },
74
74
  "capability": {
@@ -114,22 +114,22 @@
114
114
  "zod": "^4.4.3"
115
115
  },
116
116
  "devDependencies": {
117
- "@deepseek-ai/dsh-attachment": "0.1.5-alpha.1",
117
+ "@deepseek-ai/dsh-attachment": "0.1.5-rc.1",
118
118
  "@deepseek-ai/cordis": "^4.0.2",
119
119
  "@deepseek-ai/cordis-plugin-include": "^1.0.7",
120
120
  "@deepseek-ai/cordis-plugin-loader": "^1.0.3",
121
- "@deepseek-ai/dsh-agent": "0.1.5-alpha.1",
122
- "@deepseek-ai/dsh-commands": "0.1.5-alpha.1",
123
- "@deepseek-ai/dsh-jobs": "0.1.5-alpha.1",
124
- "@deepseek-ai/dsh-jobs-local": "0.1.5-alpha.1",
125
- "@deepseek-ai/dsh-llm": "0.1.5-alpha.1",
126
- "@deepseek-ai/dsh-session": "0.1.5-alpha.1",
127
- "@deepseek-ai/dsh-storage": "0.1.5-alpha.1",
128
- "@deepseek-ai/dsh-storage-domain": "0.1.5-alpha.1",
129
- "@deepseek-ai/dsh-subprocess": "0.1.5-alpha.1",
130
- "@deepseek-ai/dsh-subprocess-local": "0.1.5-alpha.1",
131
- "@deepseek-ai/dsh-system-prompt": "0.1.5-alpha.1",
132
- "@deepseek-ai/dsh-tools": "0.1.5-alpha.1",
121
+ "@deepseek-ai/dsh-agent": "0.1.5-rc.1",
122
+ "@deepseek-ai/dsh-commands": "0.1.5-rc.1",
123
+ "@deepseek-ai/dsh-jobs": "0.1.5-rc.1",
124
+ "@deepseek-ai/dsh-jobs-local": "0.1.5-rc.1",
125
+ "@deepseek-ai/dsh-llm": "0.1.5-rc.1",
126
+ "@deepseek-ai/dsh-session": "0.1.5-rc.1",
127
+ "@deepseek-ai/dsh-storage": "0.1.5-rc.1",
128
+ "@deepseek-ai/dsh-storage-domain": "0.1.5-rc.1",
129
+ "@deepseek-ai/dsh-subprocess": "0.1.5-rc.1",
130
+ "@deepseek-ai/dsh-subprocess-local": "0.1.5-rc.1",
131
+ "@deepseek-ai/dsh-system-prompt": "0.1.5-rc.1",
132
+ "@deepseek-ai/dsh-tools": "0.1.5-rc.1",
133
133
  "@deepseek-ai/schemastery": "^3.18.2",
134
134
  "@types/node": "^22.19.0",
135
135
  "@vitest/coverage-v8": "3.2.7",