@kangyishuai/dsh-casefile 0.0.0-stage → 0.1.0
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/DISCLAIMER.md +24 -0
- package/LICENSE +21 -0
- package/README.md +158 -2
- package/README.zh-CN.md +159 -0
- package/cordis.patch.yml +3 -0
- package/lib/actions.js +1269 -0
- package/lib/client.js +1275 -0
- package/lib/core/attestation.js +95 -0
- package/lib/core/brief.js +253 -0
- package/lib/core/checks.js +436 -0
- package/lib/core/digest.js +122 -0
- package/lib/core/manifest.js +117 -0
- package/lib/core/model.js +390 -0
- package/lib/core/overview.js +80 -0
- package/lib/core/png.js +154 -0
- package/lib/core/report.js +316 -0
- package/lib/core/runs.js +211 -0
- package/lib/core/store.js +382 -0
- package/lib/index.js +5 -0
- package/lib/service.js +675 -0
- package/lib/tool-schema.js +38 -0
- package/lib/tools.js +658 -0
- package/locale/en.json +30 -0
- package/locale/zh.json +30 -0
- package/package.json +55 -4
package/DISCLAIMER.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Disclaimer / 免责声明
|
|
2
|
+
|
|
3
|
+
This plugin is an **adapter** for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) that organizes evidence produced by [REA](https://github.com/morluto/rea). It contains none of REA's code, ships no analysis engine, and is not affiliated with DeepSeek or the REA authors.
|
|
4
|
+
|
|
5
|
+
本插件是 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 的**适配层**,用来整理 [REA](https://github.com/morluto/rea) 产出的证据。它不包含 REA 的代码、不带分析引擎,与 DeepSeek 及 REA 作者均无关联。
|
|
6
|
+
|
|
7
|
+
## Intended use / 使用范围
|
|
8
|
+
|
|
9
|
+
- **Research and learning**, and analysis of software you **own** or are **authorized** to analyze. 研究与学习,以及分析**你拥有**或**已获授权**分析的软件。
|
|
10
|
+
- You are responsible for having the right to analyze the target, and for complying with the licenses, terms of service, and laws that apply to it. 你有责任确认自己有权分析目标,并遵守适用的许可、服务条款与法律。
|
|
11
|
+
- The plugin records an authorization tier (`owned` / `authorized` / `research`) with each project. That label records **your** attestation; it is not a legal determination and does not grant any right. 插件让每个项目记录授权档;该字段记录的是**你的**声明,不构成法律判断,也不授予任何权利。
|
|
12
|
+
|
|
13
|
+
## What this plugin deliberately does not do / 刻意不提供
|
|
14
|
+
|
|
15
|
+
- **No circumvention.** It provides no way to bypass DRM, license checks, anti-debugging, integrity checks, or authentication. It observes and records; it does not defeat protections. **不提供绕过** DRM、许可校验、反调试、完整性校验或认证的能力:它只观察与记录,不破解保护。
|
|
16
|
+
- **No asset reuse.** It ships no third-party assets (logos, fonts, media, binaries) and offers no mechanism to reuse them. 不捆绑、也不提供复用第三方资产(logo、字体、素材、二进制)的机制。
|
|
17
|
+
- **No third-party engines.** It bundles no commercial reverse-engineering engines (IDA Pro, Hopper, JEB, …). If you use them, you must hold a valid license yourself. 不捆绑商业逆向引擎;若你使用它们,请自行持有有效授权。
|
|
18
|
+
- **No target disclosure.** The repository and its examples contain no record of any specific third-party target. 仓库与示例中不包含任何具体第三方目标的信息。
|
|
19
|
+
|
|
20
|
+
## No warranty / 无担保
|
|
21
|
+
|
|
22
|
+
Provided "as is", without warranty of any kind. Evidence storage, redaction, and capability detection are best-effort: **review any exported spec pack before sharing it**, and verify conclusions before acting on them. 按「现状」提供,不附带任何担保。证据落盘、脱敏与能力探测都是尽力而为:**分享规格包前请自行复核**,依据结论行动前请自行验证。
|
|
23
|
+
|
|
24
|
+
Non-commercial, research-only use does not by itself exempt you from copyright, contract, or anti-circumvention rules. If you are unsure whether your use is permitted, consult a qualified professional in your jurisdiction. 非商业、仅研究用途本身并不当然免除著作权、合同或反规避规则的约束;如不确定是否可用,请咨询你所在司法辖区的专业人士。
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 kangyishuai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,159 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @kangyishuai/dsh-casefile
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Evidence-first workbench for REA inside DeepSeek Harness: turn observations into citable evidence, handoff-ready spec packs, and recomputable acceptance — instead of conclusions that die with the session.
|
|
4
|
+
|
|
5
|
+
[中文](./README.zh-CN.md)
|
|
6
|
+
|
|
7
|
+
Unofficial plugin for [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness). Not affiliated with DeepSeek. It is an adapter on top of [REA](https://github.com/morluto/rea) (MIT); it ships none of REA's code and no analysis engine.
|
|
8
|
+
|
|
9
|
+
> **Status: M3 complete (five checkers + one-call cycle + near-miss + coverage gate + report).** Persists projects, evidence, claims, features, unknowns, obligations and check records; exports a redacted spec pack; ships a workbench page (evidence / obligations / runs), a sidebar entry and a settings section. A **builder session** can be started from a project: casefile creates a child session, feeds it only the spec pack (never the original target), and returns the session id; `awaitBuilder` reports why it stopped. The build/check loop runs real commands: `case_build start` records a `BuildRun` with an implementation digest, `case_check run` records a result bound to that digest, and a later build whose digest differs automatically **reopens** the obligations it had closed. Verified by 70 unit tests, a 30-assertion web end-to-end smoke on a throwaway DSH home (including the stale-reopen path), and a manual GUI pass in a real browser; the desktop read-only suite is written but still needs the plugin installed in the desktop profile before it can run. Treat it as young software.
|
|
10
|
+
|
|
11
|
+
## What it does
|
|
12
|
+
|
|
13
|
+
REA is very good at producing evidence-backed observations. What it does not do is keep them: the evidence lives inside the tool results of one session and is gone when the session ends.
|
|
14
|
+
|
|
15
|
+
Casefile is the missing layer:
|
|
16
|
+
|
|
17
|
+
- **Projects as first-class objects.** One target = one project directory under the plugin's data root, with its authorization tier (`owned` / `authorized` / `research`), scope (`all` / `selected`), and recorded REA version and capability hash.
|
|
18
|
+
- **Evidence ledger.** Each observation is stored as an `Evidence` record that keeps REA's own `confidence` (observed / derived / inferred) and `authority` (shipped-artifact / controlled-replay / live-observation / external), plus a `limitations` list and optional integrity value. Casefile never re-derives those judgments.
|
|
19
|
+
- **Claims you can cite and select.** A `Claim` is the unit you quote in a handoff: it references evidence ids, carries its own limitations, and can be selected (`case_claim select`) for export.
|
|
20
|
+
- **Feature grouping for scoped work.** Group selected claims into a `Feature` with boundaries and non-goals — the unit later used by "rebuild only these features".
|
|
21
|
+
- **Unknowns are shipped, not hidden.** Open unknowns are part of the spec pack; a pack that silently drops them is a lie.
|
|
22
|
+
- **Spec pack export.** `case_brief export` writes `spec/<timestamp>/spec.json` + `brief.md`: selected claims, their evidence, features, open unknowns, a coverage summary, and a content hash. Redaction is on by default (home directory, absolute paths, common token shapes).
|
|
23
|
+
- **Capability detection.** `case_project` and `diagnose()` report whether `mcp__rea__*` tools are visible and which casefile-required tools are missing, instead of silently degrading.
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
dsh plugin --profile desktop add @kangyishuai/dsh-casefile
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
To run the working tree instead of a published version, pack it first — `link:` installs do not work (the host's `@deepseek-ai/*` resolution only covers packages whose real path is inside the profile):
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
cd packages/casefile
|
|
35
|
+
pnpm pack --pack-destination /tmp
|
|
36
|
+
dsh plugin --profile desktop add /tmp/kangyishuai-dsh-casefile-*.tgz
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Re-run `pnpm pack` + `add` after changing the code. Restart the DSH desktop app afterwards (this plugin is a host half).
|
|
40
|
+
|
|
41
|
+
## Requirements
|
|
42
|
+
|
|
43
|
+
- A REA MCP server registered in DSH, exposing tools named `mcp__rea__*` (REA's own `rea setup`, or any community bridge). Casefile **does not** register that row itself — it would collide with REA's `rea-mcp` entry.
|
|
44
|
+
- Casefile works without REA for manual evidence entry, but capability detection will report `missing` and later milestones' checks will degrade.
|
|
45
|
+
|
|
46
|
+
## Workbench
|
|
47
|
+
|
|
48
|
+
The plugin adds a **Casefile** entry to the sidebar. The page lists projects on the left and shows the selected project on the right with three tabs:
|
|
49
|
+
|
|
50
|
+
- **Evidence** — claims (with confidence, limits and evidence count) and the evidence records they cite;
|
|
51
|
+
- **Obligations** — obligations, their status, and open unknowns. Closing an obligation needs a _fresh PASS check_; until checkers land in M2 the button explains what is missing instead of pretending;
|
|
52
|
+
The list view opens with an **overview strip**: project count, breakdown by target kind and state, obligation pass/total, and unresolved unknowns across every project. `case_project overview` returns the same data as JSON.
|
|
53
|
+
- **Runs** — build rounds (status, implementation digest, command) and check verdicts bound to each digest.
|
|
54
|
+
|
|
55
|
+
A settings section shows the data root, project count and REA capability status, so "is REA actually connected" is answerable without reading logs.
|
|
56
|
+
|
|
57
|
+
## Tools
|
|
58
|
+
|
|
59
|
+
| Tool | Actions | Purpose |
|
|
60
|
+
| --------------- | --------------------------------- | ------------------------------------------------------------------------------- |
|
|
61
|
+
| `case_project` | `open`, `list`, `get`, `update` | Create/open a project, list, inspect, change authorization tier / scope / state |
|
|
62
|
+
| `case_evidence` | `add`, `list`, `show` | Store an REA observation as evidence; filter; read one |
|
|
63
|
+
| `case_claim` | `add`, `list`, `search`, `select` | Store a citable conclusion; search; select it for export |
|
|
64
|
+
| `case_feature` | `add`, `list` | Group claims into a feature with boundaries and non-goals |
|
|
65
|
+
| `case_unknown` | `add`, `list`, `resolve` | Record unknowns; mark one resolved with a note |
|
|
66
|
+
| `case_brief` | `export` | Write the redacted spec pack (`spec.json` + `brief.md`) |
|
|
67
|
+
|
|
68
|
+
Every tool returns `{ ok, data?, error?{code,message,hint}, summary }`; errors carry a stable code, so the model can correct itself instead of guessing.
|
|
69
|
+
|
|
70
|
+
Obligations may carry `featureIds`, so a **scoped replica** can report coverage per feature: an obligation tagged with a feature only counts toward that feature's ratio; untagged ones count only globally.
|
|
71
|
+
|
|
72
|
+
## Checkers
|
|
73
|
+
|
|
74
|
+
| Checker | What it judges | Verdicts |
|
|
75
|
+
| ------- | ------------------------------------------------------------------------------ | --------------------------------------------- |
|
|
76
|
+
| `build` | a shell build command: exit code + configured output paths | pass / fail / unknown(timeout) |
|
|
77
|
+
| `cli` | a command against `{ exitCode, stdoutIncludes, stdoutEquals, stderrIncludes }` | pass / fail / unknown(timeout) |
|
|
78
|
+
| `web` | two PNG screenshots: similarity = 1 − mean-abs-diff/255, plus a size check | pass / fail / unknown(missing or invalid PNG) |
|
|
79
|
+
|
|
80
|
+
Screenshots are captured elsewhere (REA's browser tools or any tool the user prefers); the `web` checker only judges. The PNG decoder is in-repo (`lib/core/png.js`, no third-party dependency) and supports 8-bit RGB/RGBA, non-interlaced.
|
|
81
|
+
|
|
82
|
+
## Authorization tiers
|
|
83
|
+
|
|
84
|
+
A project carries `authTier`: `owned`, `authorized`, or `research`. Starting a **replica build** (`case_build agent` / `cycle`) is refused when the tier is `research` unless the caller passes `allowResearchTier: true` with a `reason` — the override is written to the project audit log as `auth/research-override`. This keeps the tier from being decorative: a research-only project can be investigated and specified, but not quietly reconstructed.
|
|
85
|
+
|
|
86
|
+
## Closing a project
|
|
87
|
+
|
|
88
|
+
`case_project close` refuses until the project is actually done. The gate checks, in order: at least one obligation; no `open`/`fail`/`blocked` obligations; coverage ≥ `minCoverage` (default 100%); no unresolved unknowns; a fresh check whose implementation digest matches the current build. Each blocker is reported by name, so you know what to fix.
|
|
89
|
+
|
|
90
|
+
`case_project report` writes `reports/<timestamp>/report.md` + `report.json`: coverage (global and per feature), obligation table, check table with implementation digests, unknowns, loop state, and a declaration that `unknown` never means pass.
|
|
91
|
+
|
|
92
|
+
## Clean-room attestation
|
|
93
|
+
|
|
94
|
+
Every builder session writes an **attestation** (`attestations.jsonl`): the prompt digest, the spec digest, how many claims/evidence items were fed, the auth tier and any research override, and whether the "do not read the original target" clause was actually in the prompt. The report renders it as a `## 净室 attestation` section.
|
|
95
|
+
|
|
96
|
+
The attestation is deliberately honest about its limits: DSH has no per-agent tool whitelist (see `docs/runtime/0.2.2-rc.3.md` §12.7), so isolation is **information-flow only**. The statement says so instead of claiming clean-room certification.
|
|
97
|
+
|
|
98
|
+
## Anti-false-green
|
|
99
|
+
|
|
100
|
+
The suite includes **near-miss injection** tests: an obligation is closed against a correct implementation, then one character of the output is changed, and the next round must fail that obligation and reopen it. A failed build also skips checks entirely instead of producing a misleading pass. See `packages/casefile/test/near-miss.test.js`.
|
|
101
|
+
|
|
102
|
+
## Data layout
|
|
103
|
+
|
|
104
|
+
Everything lives under the plugin's data root (default `<DSH_HOME>/casefile`, override with `dataRoot`):
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
casefile/
|
|
108
|
+
└── projects/<project-id>/
|
|
109
|
+
├── project.json # version + target + authTier + scope + REA version
|
|
110
|
+
├── evidence.jsonl # append-only; same id later wins
|
|
111
|
+
├── claims.jsonl
|
|
112
|
+
├── features.jsonl
|
|
113
|
+
├── unknowns.jsonl
|
|
114
|
+
├── audit.jsonl # who did what, append-only
|
|
115
|
+
└── spec/<timestamp>/ # exported spec.json + brief.md
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Rules: JSON files carry a `version`; a file written by a newer casefile is reported as read-only instead of silently rewritten. Corrupt JSON is renamed `.broken` and kept. Records are append-only, so a project directory can be reviewed and diffed.
|
|
119
|
+
|
|
120
|
+
## Config
|
|
121
|
+
|
|
122
|
+
| Key | Default | Meaning |
|
|
123
|
+
| ------------------ | --------------------- | ------------------------------------------------------------------- |
|
|
124
|
+
| `dataRoot` | `<DSH_HOME>/casefile` | Where project data lives; injectable for tests |
|
|
125
|
+
| `defaultAuthTier` | `research` | Default authorization tier for new projects |
|
|
126
|
+
| `cleanRoomDefault` | `true` | Reserved for the builder milestone: builder cannot see the original |
|
|
127
|
+
| `checkers` | `["cli","web"]` | Reserved for the verification milestone |
|
|
128
|
+
| `maxRounds` | `5` | Reserved for the verification loop |
|
|
129
|
+
| `redactOnExport` | `true` | Force redaction on spec pack export |
|
|
130
|
+
|
|
131
|
+
Config is read from the `casefile` row in `cordis.patch.yml`. Do not edit the profile by hand — change the row's `config:`.
|
|
132
|
+
|
|
133
|
+
## Compatibility
|
|
134
|
+
|
|
135
|
+
| Plugin | Verified on DSH | What was run |
|
|
136
|
+
| ------ | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
137
|
+
| 0.1.x | 0.2.2-rc.3 (macOS, desktop + web) | 138 unit tests; 52-assertion web end-to-end smoke on a throwaway DSH home; **14-assertion desktop read-only regression on a real Electron renderer (CDP)**; `pnpm gate casefile` 4/4 steps green. |
|
|
138
|
+
|
|
139
|
+
Host APIs used here were verified by runtime inspection; the findings are recorded in `docs/runtime/0.2.2-rc.3.md` §10 (including two pitfalls: a missed `declareRemote` silently 404s only that endpoint, and `agentPresets` cannot be composed from bundle names).
|
|
140
|
+
|
|
141
|
+
## Side effects & risks
|
|
142
|
+
|
|
143
|
+
- **Files it writes:** only under the data root above. It never writes into the investigated project, never modifies the REA binary, and never edits the profile.
|
|
144
|
+
- **Destructive actions:** none in M0. Future milestones (project deletion, artifact cleanup) follow the repo's [ADR 0002](https://github.com/kangyishuai/dsh-plugins/blob/main/docs/adr/0002-destructive-operations.md): trash by default, confirmation with a one-line impact, dry-run, audit log.
|
|
145
|
+
- **Privacy:** project data stays on this machine. Spec packs are redacted by default (`HOME`, absolute paths, common token shapes) but **you should still review a pack before sharing it** — redaction is a safety net, not a guarantee.
|
|
146
|
+
- **Evidence quality:** casefile stores what you tell it. It does not verify an observation, and it never upgrades a claim's confidence or authority.
|
|
147
|
+
- **Legal:** intended for research and for software you own or are authorized to analyze. It deliberately ships **no** DRM/anti-debugging bypass and no way to reuse third-party assets. Read [DISCLAIMER.md](./DISCLAIMER.md) before use.
|
|
148
|
+
|
|
149
|
+
## Development
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
pnpm verify # lint + typecheck + plugin checks + tests
|
|
153
|
+
pnpm check # plugin conventions + index metadata
|
|
154
|
+
pnpm test # package unit tests
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## License
|
|
158
|
+
|
|
159
|
+
MIT. See [LICENSE](./LICENSE) and [DISCLAIMER.md](./DISCLAIMER.md).
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# @kangyishuai/dsh-casefile
|
|
2
|
+
|
|
3
|
+
> DeepSeek Harness 里的 REA 循证工作台:把观察变成可引用的证据、可交接的规格包、可复算的验收,而不是随会话消失的结论。
|
|
4
|
+
|
|
5
|
+
[English](./README.md)
|
|
6
|
+
|
|
7
|
+
[DeepSeek Harness (DSH)](https://github.com/deepseek-ai/deepseek-harness) 的非官方插件,与 DeepSeek 无关。它是 [REA](https://github.com/morluto/rea)(MIT)之上的适配层:不包含 REA 的代码,也不带分析引擎。
|
|
8
|
+
|
|
9
|
+
> **状态:M3 完成(五类 checker + 一次调用闭环 + near-miss + 覆盖率硬门 + 报告)。** 落盘「项目 / 证据 / 结论 / 功能 / 未知项 / 义务 / 检查记录」,能导出去原始化的规格包,并提供工作台页(证据 / 义务 / 运行)、侧栏入口与设置分节。现在可以从项目里起一个 **builder 会话**:casefile 建子会话、只投喂规格包(不投原件),返回 sessionId;`awaitBuilder` 报它为什么停下。`case_build loop` 一次跑完一轮:构建 → 按义务自带的检查配方逐个检查 → 通过的关闭 → 命中停止条件就停。构建/检查循环真的跑命令:`case_build start` 落 `BuildRun` 并算实现 digest,`case_check run` 记录绑定该 digest 的检查结果;之后再构建若 digest 变了,**自动重开**已被它关闭的义务。已通过 70 项单元测试、临时 DSH_HOME 上的 30 项 web 端到端冒烟(含 stale 重开路径),以及真实浏览器里的一轮手工 GUI 检查;桌面只读回归脚本已写好,但仍需先把插件装进桌面 profile 才能跑。请按早期软件对待。
|
|
10
|
+
|
|
11
|
+
## 它解决什么
|
|
12
|
+
|
|
13
|
+
REA 很擅长产出「有证据支撑的观察」。它不做的是**留住这些观察**:证据只活在一次会话的工具结果里,会话一结束就没了。
|
|
14
|
+
|
|
15
|
+
casefile 补的就是这一层:
|
|
16
|
+
|
|
17
|
+
- **项目是一等对象。** 一个目标 = 一个项目目录,记录授权档(`owned` / `authorized` / `research`)、范围(`all` / `selected`)、REA 版本与能力哈希。
|
|
18
|
+
- **证据账本。** 每条观察落成一条 `Evidence`,**原样保留** REA 自己的 `confidence`(observed / derived / inferred)与 `authority`(shipped-artifact / controlled-replay / live-observation / external),加 `limitations` 与可选的 integrity。casefile 不重新判定这些。
|
|
19
|
+
- **可引用、可选中的结论。** `Claim` 是交接时被引用的单位:引用证据 id、带自己的局限、可被勾选(`case_claim select`)进入规格包。
|
|
20
|
+
- **功能分组。** 把选中的结论归到 `Feature`,写清边界与非目标——后续「只复刻这些功能」的范围单位。
|
|
21
|
+
- **未知项必须随包交付。** 未解决的未知项会进规格包;悄悄丢掉的包等于说谎。
|
|
22
|
+
- **规格包导出。** `case_brief export` 写出 `spec/<时间戳>/spec.json` + `brief.md`:选中的结论、证据、功能、未知项、覆盖度摘要与内容哈希。默认脱敏(home、绝对路径、常见 token 形态)。
|
|
23
|
+
- **能力探测。** `case_project` 与 `diagnose()` 报告 `mcp__rea__*` 是否可见、casefile 依赖的工具缺哪些,而不是静默降级。
|
|
24
|
+
|
|
25
|
+
## 安装
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
dsh plugin --profile desktop add @kangyishuai/dsh-casefile
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
想跑工作树而不是发布版,先打包——`link:` 安装激活不了(宿主的 `@deepseek-ai/*` 解析只覆盖 realpath 在 profile 内的包):
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
cd packages/casefile
|
|
35
|
+
pnpm pack --pack-destination /tmp
|
|
36
|
+
dsh plugin --profile desktop add /tmp/kangyishuai-dsh-casefile-*.tgz
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
改代码后要重新 `pnpm pack` + `add`;装完**重启** DSH 桌面版(这是 host 半)。
|
|
40
|
+
|
|
41
|
+
## 前置条件
|
|
42
|
+
|
|
43
|
+
- DSH 里已注册一个 REA MCP server,工具名为 `mcp__rea__*`(REA 官方 `rea setup` 或任意社区桥)。casefile **不会**自己插那一行——会和 REA 官方的 `rea-mcp` 行撞名。
|
|
44
|
+
- 没有 REA 也能手动记证据,但能力探测会报 `missing`,后续里程碑的检查会降级。
|
|
45
|
+
|
|
46
|
+
## 工作台
|
|
47
|
+
|
|
48
|
+
插件在侧栏加一个「案卷」入口。页面左侧是项目列表,右侧是选中项目的三个页签:
|
|
49
|
+
|
|
50
|
+
- **证据** —— 结论(带可信度、局限、证据数)与它们引用的证据记录;
|
|
51
|
+
- **义务** —— 义务、状态与未解决未知项。关闭义务需要**新鲜的 PASS 检查**;在 M2 的 checker 落地前,按钮会说明缺什么,而不是假装能关;
|
|
52
|
+
列表页顶部有一条**总览**:项目数、按目标类型与状态的分布、义务通过数/总数、跨项目的未解决未知项。`case_project overview` 以 JSON 返回同一份数据。
|
|
53
|
+
- **运行** —— 构建轮次(状态、实现 digest、命令)与绑定到该 digest 的检查结论。
|
|
54
|
+
|
|
55
|
+
设置分节显示数据根、项目数与 REA 能力状态,「REA 到底接没接上」不用翻日志就能回答。
|
|
56
|
+
|
|
57
|
+
## 工具
|
|
58
|
+
|
|
59
|
+
| 工具 | 动作 | 用途 |
|
|
60
|
+
| --------------- | ------------------------------------ | --------------------------------------------- |
|
|
61
|
+
| `case_project` | `open` / `list` / `get` / `update` | 新建/打开项目、列表、详情、改授权档/范围/状态 |
|
|
62
|
+
| `case_evidence` | `add` / `list` / `show` | 把 REA 观察写成证据;过滤;看单条 |
|
|
63
|
+
| `case_claim` | `add` / `list` / `search` / `select` | 写可引用结论;搜索;勾选进入规格包 |
|
|
64
|
+
| `case_feature` | `add` / `list` | 把结论归到功能,写边界与非目标 |
|
|
65
|
+
| `case_unknown` | `add` / `list` / `resolve` | 记录未知项;带备注标记已解决 |
|
|
66
|
+
| `case_brief` | `export` | 写出脱敏的规格包(`spec.json` + `brief.md`) |
|
|
67
|
+
|
|
68
|
+
所有工具统一返回 `{ ok, data?, error?{code,message,hint}, summary }`;错误带稳定 code,模型能自行纠正而不是猜。
|
|
69
|
+
|
|
70
|
+
义务可以带 `featureIds`,这样**只复刻选定功能**时能报出每个功能的覆盖率:挂在某功能上的义务只计入该功能,未挂的只计入全局。
|
|
71
|
+
|
|
72
|
+
## Checker
|
|
73
|
+
|
|
74
|
+
| Checker | 判什么 | 三态 |
|
|
75
|
+
| ------- | --------------------------------------------------------------------- | -------------------------------- |
|
|
76
|
+
| `build` | shell 构建命令:退出码 + 产物 | pass / fail / unknown(超时) |
|
|
77
|
+
| `cli` | 命令对照 `{ exitCode, stdoutIncludes, stdoutEquals, stderrIncludes }` | pass / fail / unknown(超时) |
|
|
78
|
+
| `web` | 两张 PNG 截图:相似度 = 1 − 平均绝对差/255,外加尺寸检查 | pass / fail / unknown(缺图/坏图) |
|
|
79
|
+
|
|
80
|
+
截图采集由别处完成(REA 的 browser 工具或用户自己的工具),`web` checker 只负责判定。PNG 解码器在仓库内(`lib/core/png.js`,无第三方依赖),支持 8-bit RGB/RGBA、非隔行。
|
|
81
|
+
|
|
82
|
+
## 授权档
|
|
83
|
+
|
|
84
|
+
项目带 `authTier`:`owned` / `authorized` / `research`。**起复刻构建**(`case_build agent` / `cycle`)时,`research` 档默认被拒绝;要放行必须显式传 `allowResearchTier: true` 并给 `reason`,放行会以 `auth/research-override` 写进项目审计。这样授权档不是装饰:research 档的项目可以调查、可以出规格,但不能悄悄被复刻。
|
|
85
|
+
|
|
86
|
+
## 关闭项目
|
|
87
|
+
|
|
88
|
+
`case_project close` 在项目真的做完之前会一直拒绝。闸门按顺序检查:至少一条义务;没有 `open`/`fail`/`blocked` 义务;覆盖率 ≥ `minCoverage`(默认 100%);没有未解决未知项;存在一条新鲜的、实现 digest 与当前构建一致的检查。每个卡点都按名字报出来,知道该修什么。
|
|
89
|
+
|
|
90
|
+
`case_project report` 写出 `reports/<时间戳>/report.md` + `report.json`:全局覆盖率、**按功能覆盖率**、义务表、带实现 digest 的检查表、未知项、循环状态,以及「`unknown` 不等于通过」的声明。
|
|
91
|
+
|
|
92
|
+
## 净室 attestation
|
|
93
|
+
|
|
94
|
+
每次 builder 会话都会写一条 **attestation**(`attestations.jsonl`):prompt 摘要、规格包摘要、投喂了多少条结论/证据、授权档与是否 research 覆盖,以及「不要读取原始目标」这条指令**是否真的**在 prompt 里。报告里渲染成 `## 净室 attestation` 小节。
|
|
95
|
+
|
|
96
|
+
这条声明刻意写清边界:DSH 没有按 agent 的工具白名单(见 `docs/runtime/0.2.2-rc.3.md` §12.7),所以隔离是**信息流层面**的。声明里明说这一点,而不是声称「净室认证」。
|
|
97
|
+
|
|
98
|
+
## 防假绿灯
|
|
99
|
+
|
|
100
|
+
测试里有 **near-miss 注入**:同一个义务在正确实现上关闭后,只改一个字符,下一轮必须判定失败并把义务重开;构建失败时直接跳过检查,不产生误导性的 pass。见 `packages/casefile/test/near-miss.test.js`。
|
|
101
|
+
|
|
102
|
+
## 数据布局
|
|
103
|
+
|
|
104
|
+
全部在插件数据根下(默认 `<DSH_HOME>/casefile`,可用 `dataRoot` 覆盖):
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
casefile/
|
|
108
|
+
└── projects/<project-id>/
|
|
109
|
+
├── project.json # version + 目标 + 授权档 + 范围 + REA 版本
|
|
110
|
+
├── evidence.jsonl # append-only;同 id 后者胜
|
|
111
|
+
├── claims.jsonl
|
|
112
|
+
├── features.jsonl
|
|
113
|
+
├── unknowns.jsonl
|
|
114
|
+
├── audit.jsonl # 谁做了什么,append-only
|
|
115
|
+
└── spec/<时间戳>/ # 导出的 spec.json + brief.md
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
规则:JSON 文件带 `version`;被更新版 casefile 写过的文件会报「只读」而不是被静默改写。坏 JSON 改名 `.broken` 保留。记录 append-only,项目目录可以 review、可以 diff。
|
|
119
|
+
|
|
120
|
+
## 配置
|
|
121
|
+
|
|
122
|
+
| 键 | 默认 | 含义 |
|
|
123
|
+
| ------------------ | --------------------- | ----------------------------------------- |
|
|
124
|
+
| `dataRoot` | `<DSH_HOME>/casefile` | 项目数据位置;测试可注入 |
|
|
125
|
+
| `defaultAuthTier` | `research` | 新项目默认授权档 |
|
|
126
|
+
| `cleanRoomDefault` | `true` | 预留给 builder 里程碑:builder 看不到原件 |
|
|
127
|
+
| `checkers` | `["cli","web"]` | 预留给验收里程碑 |
|
|
128
|
+
| `maxRounds` | `5` | 预留给循环 |
|
|
129
|
+
| `redactOnExport` | `true` | 导出强制脱敏 |
|
|
130
|
+
|
|
131
|
+
配置写在 `cordis.patch.yml` 里 `casefile` 那一行的 `config:`,不要手改 profile。
|
|
132
|
+
|
|
133
|
+
## 兼容性
|
|
134
|
+
|
|
135
|
+
| 插件 | 已在哪个 DSH 上验证 | 跑了什么 |
|
|
136
|
+
| ----- | --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
137
|
+
| 0.1.x | 0.2.2-rc.3(macOS,桌面版 + web) | 138 项单元测试;临时 DSH_HOME 上 52 项 web 端到端冒烟;**真实 Electron 渲染进程上 14 项桌面只读回归(CDP)**;`pnpm gate casefile` 4/4 步全绿。 |
|
|
138
|
+
|
|
139
|
+
本插件用到的宿主 API 都经过运行时勘察,结论记在 `docs/runtime/0.2.2-rc.3.md` §10(含两个坑:漏一条 `declareRemote` 只会让那一个端点静默 404;`agentPresets` 不能用 bundle 名组合)。
|
|
140
|
+
|
|
141
|
+
## 副作用与风险
|
|
142
|
+
|
|
143
|
+
- **写哪些文件:** 只写上面的数据根。不写被调查的项目、不改 REA 二进制、不编辑 profile。
|
|
144
|
+
- **破坏性操作:** M0 没有。后续里程碑(删项目、清 artifacts)遵循仓库 [ADR 0002](https://github.com/kangyishuai/dsh-plugins/blob/main/docs/adr/0002-destructive-operations.md):默认移入回收站、确认框给一行影响面、支持 dry-run、写审计。
|
|
145
|
+
- **隐私:** 项目数据只在本机。规格包默认脱敏(`HOME`、绝对路径、常见 token 形态),但**分享前仍应自己过一遍**——脱敏是安全网,不是保证。
|
|
146
|
+
- **证据质量:** casefile 只存你告诉它的东西。它不验证观察,也从不提升结论的可信度或权威性。
|
|
147
|
+
- **法务:** 面向研究与「你拥有或已获授权分析」的软件。刻意**不提供** DRM/反调试绕过,也不提供复用第三方资产的途径。使用前读 [DISCLAIMER.md](./DISCLAIMER.md)。
|
|
148
|
+
|
|
149
|
+
## 开发
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
pnpm verify # lint + 类型检查 + 插件规范 + 测试
|
|
153
|
+
pnpm check # 插件规范 + 索引元数据
|
|
154
|
+
pnpm test # 单包单测
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## 许可
|
|
158
|
+
|
|
159
|
+
MIT。见 [LICENSE](./LICENSE) 与 [DISCLAIMER.md](./DISCLAIMER.md)。
|
package/cordis.patch.yml
ADDED