prts-terrarchive 0.2.0 → 0.2.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.
Files changed (56) hide show
  1. package/README.en.md +84 -18
  2. package/README.md +64 -15
  3. package/THIRD_PARTY_NOTICES.md +10 -0
  4. package/bin/build-runtime.mjs +32 -0
  5. package/bin/check-runtime.mjs +56 -0
  6. package/bin/install.js +24 -5
  7. package/contracts/corpus_i18n_v1.schema.json +10 -10
  8. package/cordis.patch.yml +4 -4
  9. package/docs/web-access.md +24 -0
  10. package/lib/client.js +84 -23
  11. package/lib/rhine/rhine.css +1 -1
  12. package/lib/rhine/rhine.js +208 -208
  13. package/lib/runtime/licenses/js-yaml-MIT.txt +21 -0
  14. package/lib/runtime/licenses/zod-MIT.txt +21 -0
  15. package/lib/runtime/versions.json +4 -0
  16. package/lib/runtime/yaml.js +3062 -0
  17. package/lib/runtime/zod.js +14356 -0
  18. package/lib/skins/common.css +59 -0
  19. package/lib/skins/endfield-aic.css +22 -9
  20. package/lib/skins/prts-agent.css +15 -5
  21. package/lib/skins/rhine-lab.css +9 -0
  22. package/package.json +15 -8
  23. package/presets/composition.js +53 -0
  24. package/presets/definition.js +2 -2
  25. package/presets/prts/agent.cordis.yml +1 -1
  26. package/presets/prts/preset.yml +1 -1
  27. package/presets/register.js +23 -10
  28. package/resources/runtime/yaml.js +1 -0
  29. package/resources/runtime/zod.js +1 -0
  30. package/skills/prts-composition/SKILL.md +60 -0
  31. package/skills/prts-investigation/SKILL.md +19 -102
  32. package/skills/prts-investigation/references/board-guide.md +131 -0
  33. package/skills/prts-retrieval/SKILL.md +5 -3
  34. package/src/composition-skill.js +19 -0
  35. package/src/i18n.js +11 -17
  36. package/src/index.js +63 -81
  37. package/src/investigation-review.js +14 -6
  38. package/src/investigation-store.js +97 -25
  39. package/src/investigation-tools.js +67 -30
  40. package/src/investigation-validation.js +33 -0
  41. package/src/manual-search.js +1 -1
  42. package/src/skill.js +25 -16
  43. package/src/skin-capabilities.js +28 -0
  44. package/src/tools.js +13 -0
  45. package/src/web-guidance.js +44 -0
  46. package/ui/rhine/archive-rack.ts +10 -8
  47. package/ui/rhine/catalogue.ts +16 -4
  48. package/ui/rhine/evidence-board-panel.ts +15 -0
  49. package/ui/rhine/investigation-board.css +3 -0
  50. package/ui/rhine/investigation-board.ts +71 -24
  51. package/ui/rhine/investigation-history.ts +15 -0
  52. package/ui/rhine/reading-room.css +14 -3
  53. package/ui/rhine/scene.ts +44 -24
  54. package/ui/rhine/tool-activity.ts +13 -6
  55. package/ui/rhine/types.ts +6 -0
  56. package/ui/rhine/workbench.ts +82 -40
package/README.en.md CHANGED
@@ -4,7 +4,7 @@ The optional **Rhine Lab Archive** skin combines a continuous 3D retrieval array
4
4
  persistent investigation boards, a per-board evidence inbox, and a two-level archive rack
5
5
  with 24 sources per page. The Agent adds clues and relationships and publishes versioned
6
6
  reports; it decides whether a follow-up continues an investigation or starts a new one.
7
- Candidates stay in the array, while actually read or manually saved sources enter the rack.
7
+ Browsing candidates stay in the array. Sources delivered to the Agent and manual bookmarks enter the rack; original-reading and citation states remain separate.
8
8
  Users can stage important material in a chosen board's inbox, edit matching paper cards,
9
9
  and connect clues with red strings.
10
10
 
@@ -18,8 +18,12 @@ browser reads and unrelated pages do not acknowledge them.
18
18
  Enable it in Settings → Plugins → PRTS Corpus → Skin, then open the archive from
19
19
  a session header. Local and cloud search, Markdown reading, excerpts and tool activity
20
20
  share the workspace. Returning from a source restores the previous view and position.
21
- Manual browsing pauses automatic Agent following until explicitly resumed. Visible room
22
- models also navigate between stations. A text reader remains available without WebGL.
21
+ Investigation tools and their skill are enabled only with the Rhine Lab skin. Other skins
22
+ use ordinary retrieval and reply directly in the conversation. Switching skins updates the
23
+ tools in the same PRTS session; no new session is required. Saved clues, reports and archives
24
+ remain available when you return to Rhine Lab.
25
+ Manual browsing holds the current source until the next Agent read. Explicitly pausing
26
+ following keeps it paused until resumed. Visible room models also navigate between stations. A text reader remains available without WebGL.
23
27
 
24
28
  For local development, use Node.js 22.19 or newer, then run `npm ci`,
25
29
  `npm run build:rhine`, and `npm run preview:rhine`. See the
@@ -36,8 +40,8 @@ allowance of 1,000 calls per user per day for DSH clients; this policy may
36
40
  change as service capacity evolves.
37
41
 
38
42
  - Registers DSH `ToolDefinition`s through the host plugin interface.
39
- - Host-resident instance (settings UI + data manager) + per-session "PRTS
40
- mode" preset that mounts the tools only for sessions that select it.
43
+ - Host-resident settings UI and data manager, with Agent tools composed into
44
+ PRTS mode or user-defined presets. PRTS mode inherits the full standard toolset.
41
45
  - The fixed `https://prts.chat` origin is the trust source for latest-release
42
46
  resolution and manifests; ModelScope and the configurable fallback only serve
43
47
  bytes for that fixed release and cannot select or attest a version.
@@ -52,20 +56,68 @@ change as service capacity evolves.
52
56
  ## Install
53
57
 
54
58
  Web requires Node.js >= 22.19 and DSH >= 0.1.2-alpha.2. The current compatibility
55
- target is DSH 0.1.7-rc.2. An official Electron Desktop installation supplies
59
+ target is DSH 0.2.0-rc.1. An official Electron Desktop installation supplies
56
60
  its own runtime. Corpus disk usage is shown in Settings before download.
57
61
 
62
+ ### Official Electron Desktop (recommended)
63
+
64
+ Recent DSH Desktop builds let you install from the UI without a terminal:
65
+
66
+ 1. Open **Plugins** in the sidebar, then click **+ Add plugin**.
67
+ 2. Paste the npm package name into **Package name or address**. Enter only the name, **not an `npm install` or `dsh plugin add` command**:
68
+
69
+ ```text
70
+ prts-terrarchive
71
+ ```
72
+
73
+ Without a version, this installs npm's `latest`. To pin this release, enter `prts-terrarchive@0.2.2`.
74
+ 3. Choose the official npm registry or the mainland China mirror under **Registry**, then click **Install**.
75
+ 4. Click **Enable now** after installation. If you close the dialog instead, turn on the plugin in the installed list.
76
+ 5. Open **Settings → Plugins → PRTS Corpus** to download the corpus and choose a skin, then start a new session in **PRTS mode**.
77
+
78
+ The same dialog accepts these alternatives. Choose one; you do not need to install each source:
79
+
80
+ | Source | Text to enter | Use |
81
+ | --- | --- | --- |
82
+ | npm (recommended) | `prts-terrarchive` | Install a published release |
83
+ | GitHub | `https://github.com/HTian-qwq/prts-terrarchive.git` | Install repository source; requires access to GitHub |
84
+ | Local directory | `D:\ds\prts-terrarchive` | Install a complete downloaded checkout; replace this with its actual absolute path |
85
+
86
+ An absolute path to a local `.tgz` package is also supported. The checkout and npm package
87
+ include the built UI and JavaScript runtime dependencies. Installing or updating the plugin
88
+ does not require a separate `js-yaml` / `zod` installation or `npm ci`.
89
+
90
+ **Registry selection affects npm packages and dependencies, not GitHub downloads or direct tarball URLs.**
91
+ If GitHub is unreachable, enter the npm package name and choose a mirror instead. If a mirror
92
+ does not yet have a newly published version, try the official npm registry.
93
+
94
+ **Upgrades:** the current Desktop installation UI does not provide automatic updates.
95
+ For npm or GitHub installs, uninstall from the plugin details, then add and enable the plugin
96
+ again; change any pinned version to your target release. For a local checkout, run `git pull`
97
+ in the original directory, then fully quit and restart Desktop. Plugin and corpus updates
98
+ are separate; manage corpus versions in **PRTS Corpus**.
99
+
100
+ Older Desktop releases may accept only npm package names; use `prts-terrarchive` and follow
101
+ their activation prompts. Electron manages the `desktop` profile: do not run
102
+ `node bin/install.js desktop` or `dsh plugin --profile desktop`.
103
+
58
104
  ### Local Web installation
59
105
 
60
106
  Install from a local checkout, or use PRTS Portable with the plugin already included:
61
107
 
62
108
  ```bash
63
- npm install --global @deepseek-ai/dsh@0.1.7-rc.2
109
+ npm install --global @deepseek-ai/dsh@0.2.0-rc.1
64
110
  git clone https://github.com/HTian-qwq/prts-terrarchive.git
65
111
  cd prts-terrarchive
66
112
  node bin/install.js web
67
113
  ```
68
114
 
115
+ The checkout and npm package include their built JavaScript runtime dependencies. Installing
116
+ the plugin or updating with `git pull` requires no separate `js-yaml` or `zod` installation.
117
+ Run `npm ci` when developing and rebuilding, and `npm run build:runtime` when updating these dependencies.
118
+ `npm pack` and `npm publish` verify bundled versions and load every Host entry in an isolated
119
+ directory without `node_modules` before allowing the package to be created.
120
+
69
121
  The local installer adds the package to the selected profile. DSH 0.1.7 and
70
122
  later register PRTS mode directly; older DSH versions still create or migrate
71
123
  the compatibility preset in `$DSH_HOME/.agent-presets/prts`. With no
@@ -82,7 +134,7 @@ Install the bundle directly from npm; no additional installer command
82
134
  or npm lifecycle hook is needed:
83
135
 
84
136
  ```bash
85
- dsh plugin --profile web add prts-terrarchive@0.2.0
137
+ dsh plugin --profile web add prts-terrarchive@0.2.2
86
138
  ```
87
139
 
88
140
  Restart `dsh web`. On DSH 0.1.7 and later the plugin registers PRTS mode
@@ -97,14 +149,15 @@ run `postinstall`.
97
149
  dsh plugin --profile web remove prts-terrarchive
98
150
  ```
99
151
 
100
- ### Official Electron Desktop
152
+ ### Tools and custom modes
101
153
 
102
- For Electron Desktop builds compatible with the DSH 0.1.7 plugin interface, enter
103
- `prts-terrarchive@0.2.0` in the **desktop application's plugin manager**.
104
- The manager accepts npm registry package names and versions, not GitHub URLs,
105
- local directories, or tarballs. Electron exclusively manages the `desktop`
106
- profile: do not run `node bin/install.js desktop` or
107
- `dsh plugin --profile desktop`.
154
+ PRTS mode inherits the current host's complete standard composition when the plugin activates, including shell, file operations, background jobs, skills, goals, planning, delegation and workflows, then adds PRTS retrieval and investigation tools. Platform conditions, service isolation, disabled optional tools and host permissions are preserved. Restart after changing standard mode and verify in a new session.
155
+
156
+ In Creative mode, ask the Agent to keep standard capabilities and add PRTS tools to a custom research mode. The globally discoverable `prts-composition` skill explains how to compose `prts-terrarchive/tools` (Agent tools only) and `prts-terrarchive/skill` (retrieval and investigation guidance), or replace PRTS mode's complete tool list. See the [composition guide](skills/prts-composition/SKILL.md).
157
+
158
+ Legacy hosts seed their own standard composition into unchanged generated presets at startup. Edited or unmarked existing presets remain user-owned and require manual composition. Ordinary standard mode receives no PRTS tools automatically.
159
+
160
+ ### Corpus downloads and Portable
108
161
 
109
162
  Web and official Desktop share the default `$DSH_HOME` product data while
110
163
  installing their plugins separately. The plugin package includes its UI,
@@ -149,6 +202,11 @@ After the retrieval Skill loads, matched entities and relationships enter DSH's
149
202
  dynamic context for the current question. Each new snapshot supersedes the
150
203
  previous one. Tool titles identify local/cloud retrieval and the game scope.
151
204
 
205
+ The retrieval Skill loads its core strategy and enabled game modules. Detailed tool guidance,
206
+ procedures, recipes and diagnostics are linked for reading as needed. The investigation Skill
207
+ loads its core workflow; recall, collaboration, quotation validation and recovery examples are
208
+ in the [board guide](skills/prts-investigation/references/board-guide.md).
209
+
152
210
  ## Skins and assets
153
211
 
154
212
  - **Harness default** keeps the native DSH interface.
@@ -225,9 +283,17 @@ DSH 0.1.2-alpha.1 and 0.1.2-alpha.2 have completed historical real-host tests
225
283
  with the web profile. Alpha.1 was built from the official tag and passed
226
284
  installation, preset resolution, host startup, settings-route, and
227
285
  client-bundle checks. The current plugin compatibility target is DSH
228
- 0.1.7-rc.2. The shared Connection Fetch transport supports Web and the official
286
+ 0.2.0-rc.1. The shared Connection Fetch transport supports Web and the official
229
287
  Electron source implementation; Web also retains HTTP routes. Declarative
230
- registration and legacy file seeding pass this project's unit tests. A full
288
+ registration and legacy file seeding pass this project's unit tests. Tests against
289
+ 0.1.7-rc.2 (`477b4f420553`) also exercise real Cordis, Tools, SystemPrompt,
290
+ Storage Domain and official web tools for scoped events, tool receipts, cold
291
+ investigation recovery and disposal. Browser regressions cover all four skins
292
+ with official plugin/settings components and current/legacy conversation layouts.
293
+ Web receipts retain only text delivered to the model; URL matching merges live
294
+ and restored archive entries. Model selection handles both modern `RemoteResult`
295
+ and legacy `void` results, keeping the original session on failure. These tests
296
+ use a local web-provider fixture without credentials or API calls. A full
231
297
  0.1.7-rc.2 Host launch and Windows Electron end-to-end test remain to be run.
232
298
  The default Electron portable builder pins the official 0.1.7-rc.2 tag; the legacy
233
299
  Electron entry pins 0.1.5-alpha.1 and the original WebView2 builder pins
@@ -236,7 +302,7 @@ Electron entry pins 0.1.5-alpha.1 and the original WebView2 builder pins
236
302
  Older custom deployments with `includeUserRoot: false` and no other preset root with
237
303
  `trust: user` receive no generated preset or root changes; their operator must
238
304
  first enable user preset authoring. The plugin relies on internal host surfaces
239
- (`ctx.tools`, `agent/pre-step`, Connection Fetch, agent presets, client
305
+ (`ctx.tools`, `system-prompt/assemble`, Connection Fetch, agent presets, client
240
306
  slots/theme); after a DSH major upgrade, re-run the smoke checklist below.
241
307
 
242
308
  ## Development
package/README.md CHANGED
@@ -33,7 +33,7 @@ Agent 可以离线检索并按原文行号阅读材料;可选的 PRTS.chat 云
33
33
 
34
34
  | 特性 | 说明 |
35
35
  | --- | --- |
36
- | 按需加载 | 工具只挂在「PRTS 模式」预设下,标准/极简等模式不受污染 |
36
+ | 自由组合 | PRTS 模式继承标准模式的完整能力;创造模式可将 PRTS 工具加入任意自定义模式 |
37
37
  | 双游戏资料 | 明日方舟与终末地原文、档案、审校 Wiki、实体与时间线使用统一工具检索 |
38
38
  | 读取去重 | 会话级证据状态跟踪已进入模型上下文的原文,重复/重叠读取自动回放或只补读新行 |
39
39
  | 自带皮肤 | Harness 默认 / PRTS Agent / Endfield AIC / 莱茵生命资料馆 |
@@ -44,12 +44,14 @@ Agent 可以离线检索并按原文行号阅读材料;可选的 PRTS.chat 云
44
44
  「资料馆」。检索阵列、调查板、重点证据盒和双层档案架位于同一个三维场景。
45
45
  可用底部导航、边缘入口或点击可见模型切换,镜头连续移动。
46
46
 
47
- - **检索阵列**保留候选资料;**档案架**收录 Agent 实际读过或用户主动收藏的资料,每页上下两层、每层十二份。
47
+ 调查板工具与调查技能仅在「莱茵生命资料馆」皮肤下启用。其他皮肤直接在对话中检索和回答,不会要求建板或把回答只存入板内报告。同一 PRTS 会话切换皮肤后会更新工具,无需新建对话;切出莱茵不会删除已保存的线索、报告或档案,切回后可继续查看。
48
+
49
+ - **检索阵列**保留候选资料;**档案架**收录已交付给 Agent 的资料或用户主动收藏的资料,分别保留已读和引用状态,每页上下两层、每层十二份。
48
50
  - **重点证据盒**属于指定调查板,用于暂存待核对、待整理的材料;放入盒子不会自动标成已读,也不必先收藏。
49
51
  - **调查板**由 Agent 持续添加线索与关系,中央保留带版本的报告。新建还是延续调查由 LLM 通过调查工具决定,追问不会机械地创建新板。
50
52
  - 纸片支持拖动、缩放、红绳连线与手动编辑。编辑沿用同款纸色和编号,自动保存并支持撤销;板面数据由 Host 持久化。
51
53
  - 手动检索支持本地与云端模式及高级设置。阅读器支持 Markdown、来源版本、命中位置与实际已读范围;返回时恢复原入口、筛选和阅读位置。
52
- - 手动浏览会暂停 Agent 自动跟随,点击「恢复跟随」后继续。用户查看的板、Agent 工作板和证据盒目标分别管理。
54
+ - 手动浏览暂时停留在当前资料,Agent 下一次查阅时恢复跟随;点击「暂停跟随」才会持续暂停,直到点击「恢复跟随」。用户查看的板、Agent 工作板和证据盒目标分别管理。
53
55
 
54
56
  长文分页、档案架分页、减少动态效果和无 WebGL 时的文字阅读模式均可用。
55
57
  操作细节见 [资料馆说明](docs/rhine-lab.md) 与 [交互与资料分层](docs/rhine-interaction-flow.md)。
@@ -69,23 +71,57 @@ npm run preview:rhine
69
71
 
70
72
  ## 环境要求
71
73
 
72
- - Web:Node.js **≥ 22.19**,DSH 运行时 **≥ 0.1.2-alpha.2**;当前适配目标为 **0.1.7-rc.2**
74
+ - Web:Node.js **≥ 22.19**,DSH 运行时 **≥ 0.1.2-alpha.2**;当前适配目标为 **0.2.0-rc.1**
73
75
  - 官方 Electron Desktop:使用与插件兼容的 DSH 桌面版本;桌面自带运行时
74
76
  - 磁盘空间:语料大小以设置页与 release 清单为准,下载前不会自动占用完整语料空间
75
77
 
76
78
  ## 安装
77
79
 
80
+ ### 官方 Electron Desktop(推荐)
81
+
82
+ 在新版 DSH 桌面端,无需打开终端:
83
+
84
+ 1. 打开左侧 **插件**,点击右上角 **+ 添加插件**。
85
+ 2. 在「包名或地址」输入框中粘贴下面的 npm 包名;**只填包名,不要填 `npm install` 或 `dsh plugin add` 命令**:
86
+
87
+ ```text
88
+ prts-terrarchive
89
+ ```
90
+
91
+ 不带版本号时安装 npm 的 `latest`;需要固定本次发布版本时,填 `prts-terrarchive@0.2.2`。
92
+ 3. 在 **安装源** 中按网络情况选择「npm 官方源」或「中国大陆镜像源」,点击 **安装**。
93
+ 4. 安装完成后点击 **立即启用**;如果直接关闭了对话框,请在已安装列表中打开插件开关。
94
+ 5. 打开 **设置 → 插件 → PRTS 语料** 下载资料并选择皮肤,然后新建会话,选择 **PRTS 模式**。
95
+
96
+ 「添加插件」也接受以下来源,任选一种即可,不需要重复安装:
97
+
98
+ | 来源 | 输入框中填写的内容 | 适用情况 |
99
+ | --- | --- | --- |
100
+ | npm(推荐) | `prts-terrarchive` | 安装已发布版本 |
101
+ | GitHub | `https://github.com/HTian-qwq/prts-terrarchive.git` | 安装仓库源码,需要本机能访问 GitHub |
102
+ | 本地目录 | `D:\ds\prts-terrarchive` | 安装已下载的完整插件目录;替换为本机实际绝对路径 |
103
+
104
+ 也支持本地 `.tgz` 插件包的绝对路径。仓库和 npm 包均已包含构建好的界面与 JavaScript 运行时依赖,仅安装或更新插件无需另装 `js-yaml`、`zod` 或运行 `npm ci`。
105
+
106
+ **安装源只影响 npm 包及依赖下载,不能代理 GitHub 仓库或压缩包直链。** 如果 GitHub 无法连接,可以改填 npm 包名并选择镜像源。新发布版本在镜像中尚未可用时,可切换「npm 官方源」重试。
107
+
108
+ **升级插件:** 当前桌面安装界面不提供自动更新。需要升级 npm 或 GitHub 安装的插件时,在插件详情中卸载,再通过「添加插件」重新安装并启用;指定版本号时记得换成目标版本。本地源码安装先在原目录执行 `git pull`,再完全退出并重启桌面端。插件更新与语料更新分别进行,资料版本在「PRTS 语料」中管理。
109
+
110
+ 旧版桌面如只支持 npm 包名,请使用 `prts-terrarchive` 并按其界面提示启用。Electron 的 `desktop` profile 由应用管理,不要运行 `node bin/install.js desktop` 或 `dsh plugin --profile desktop`。
111
+
78
112
  ### Web 本地安装
79
113
 
80
114
  可以从本地源码安装,或使用已内置插件的 PRTS Portable:
81
115
 
82
116
  ```bash
83
- npm install --global @deepseek-ai/dsh@0.1.7-rc.2
117
+ npm install --global @deepseek-ai/dsh@0.2.0-rc.1
84
118
  git clone https://github.com/HTian-qwq/prts-terrarchive.git
85
119
  cd prts-terrarchive
86
120
  node bin/install.js web
87
121
  ```
88
122
 
123
+ 仓库和 npm 包已包含构建好的 JavaScript 运行时依赖。仅安装插件或执行 `git pull` 更新源码时,无需另装 `js-yaml`、`zod`;修改代码、重新构建时才需要 `npm ci`。
124
+
89
125
  本地安装器把插件加入指定 profile。DSH `0.1.7` 起由插件直接注册「PRTS 模式」;
90
126
  旧版 DSH 仍创建或迁移 `$DSH_HOME/.agent-presets/prts` 中的兼容预设。省略第二个参数时使用当前插件目录,也可以传入另一个本地目录或压缩包:
91
127
 
@@ -98,7 +134,7 @@ node bin/install.js web /path/to/prts-terrarchive
98
134
  可直接从 npm 安装插件 bundle,无需额外运行安装脚本:
99
135
 
100
136
  ```bash
101
- dsh plugin --profile web add prts-terrarchive@0.2.0
137
+ dsh plugin --profile web add prts-terrarchive@0.2.2
102
138
  ```
103
139
 
104
140
  重启 `dsh web` 后,DSH `0.1.7` 起由插件注册「PRTS 模式」,禁用或卸载插件时
@@ -110,12 +146,15 @@ dsh plugin --profile web add prts-terrarchive@0.2.0
110
146
  dsh plugin --profile web remove prts-terrarchive
111
147
  ```
112
148
 
113
- ### 官方 Electron Desktop
149
+ ### 工具与自定义模式
114
150
 
115
- 适用于兼容 DSH `0.1.7` 插件接口的 Electron Desktop。在 **桌面应用的插件管理窗口** 输入
116
- `prts-terrarchive@0.2.0` 安装,随后选用「PRTS 模式」。官方桌面只接受 npm registry
117
- 包名和版本,不接受 GitHub 地址、本地目录或 tarball;其 `desktop` profile 由应用管理,
118
- 不要运行 `node bin/install.js desktop` 或 `dsh plugin --profile desktop`。
151
+ 「PRTS 模式」在插件启用时继承**当前宿主的标准模式**,包含其终端、文件读写与搜索、后台任务、技能、目标、计划、子 Agent、工作流等能力,再添加 PRTS 检索和调查工具。平台条件、服务隔离及标准模式中停用的可选工具保持原配置,权限仍由 DSH 管理。修改标准模式后重启宿主,并在新会话验证。
152
+
153
+ 在**创造模式**可以直接要求:“保留标准模式全部能力,再加上 PRTS 检索和调查工具,创建我的研究模式。” Agent 可发现 `prts-composition` 技能,按宿主流程安装用户自己的组合。可复用入口为 `prts-terrarchive/tools`(仅 Agent 工具)和 `prts-terrarchive/skill`(检索与调查指导);已有 skill loader 不需重复添加。示例和自定义 PRTS 完整工具清单的方法见[组合说明](skills/prts-composition/SKILL.md)。
154
+
155
+ 旧版 DSH 在启动时将自己版本的 standard 组合写入未修改的自动生成预设。用户修改过或没有生成标记的旧文件不会被覆盖;这类预设可按组合说明手动扩展。普通标准模式不会被自动添加 PRTS 工具。
156
+
157
+ ### 语料下载与 Portable
119
158
 
120
159
  Web 与官方桌面共享默认的 `$DSH_HOME` 用户资料,但各自安装插件。插件包包含界面、地图
121
160
  模型、贴图、技能和预设,**不包含语料、Node/DSH 运行库或用户数据**。首次使用请在
@@ -160,6 +199,8 @@ Web 本地安装需要可用的 `dsh.cmd`。安装器经 cmd.exe 调用它,插
160
199
  | `@deepseek-ai/dsh-tool-skill` | skill 加载器 | 按需加载检索策略技能 |
161
200
  | 本插件 | `prts-retrieval` 技能 | 检索配方与字段语义(按需注入,不占 system prompt) |
162
201
 
202
+ 检索 Skill 默认加载核心策略与当前启用游戏的模块说明;工具契约、详细流程、配方和诊断文档通过技能中的链接按需读取。调查 Skill 默认加载核心工作流,分页回看、协作提醒、引文验证和恢复示例见[调查板操作细则](skills/prts-investigation/references/board-guide.md)。
203
+
163
204
  ## 工具详解
164
205
 
165
206
  ### corpus_i18n — 终末地官方多语言查询
@@ -351,6 +392,8 @@ Endfield AIC 的插件代码、UI 集成与地图渲染实现采用 MIT License
351
392
  ## 开发
352
393
 
353
394
  ```bash
395
+ npm run build:runtime # 更新随包交付的 YAML / Zod,依赖或构建入口修改后运行
396
+ npm run check:runtime # 隔离环境加载所有 Host 入口,不使用 node_modules
354
397
  npm run check # 全部源码语法检查
355
398
  npm test # node --test 全量测试;语料集成用例需本地 data/releases,否则自动跳过
356
399
  git diff --check # 检查待提交文本
@@ -397,15 +440,21 @@ presets/ PRTS 模式声明及旧版用户预设初始化
397
440
 
398
441
  DSH `0.1.2-alpha.1` 与 `0.1.2-alpha.2`(web profile)已完成历史真机验证;其中
399
442
  `alpha.1` 通过官方 tag 构建并完成安装、预设解析、宿主启动、设置路由和客户端 bundle
400
- 加载检查。当前插件适配目标为 DSH `0.1.7-rc.2`,共享 Connection Fetch 通道支持
443
+ 加载检查。当前插件适配目标为 DSH `0.2.0-rc.1`,共享 Connection Fetch 通道支持
401
444
  Web 与官方 Electron 源码实现;Web 同时保留 HTTP 路由。新版声明式预设与
402
- 旧版文件预设均通过本项目单元测试;`0.1.7-rc.2` 的完整 Host 启动及 Windows Electron 实机端到端验证仍待完成。
403
- Electron 便携版默认固定 `0.1.7-rc.2` 官方 tag;旧 Electron 构建入口仍固定
445
+ 旧版文件预设均通过本项目单元测试。针对 `0.1.7-rc.2`(`477b4f420553`),另以真实
446
+ Cordis、Tools、SystemPrompt、Storage Domain 与官方网页工具验证作用域、工具回执、
447
+ 冷启动调查恢复和服务释放;四种皮肤也在官方插件管理页、设置组件及新旧会话布局下
448
+ 通过浏览器回归。网页正文仅保存实际交付给模型的文本;恢复档案按网页 URL 合并,
449
+ 避免实时结果与持久化 ID 不同造成重复入架。模型切换兼容新版 `RemoteResult` 和旧版
450
+ `void` 接口,并在失败时保留原会话。`npm pack` / `npm publish` 还会自动检查随包运行时版本,并在无 `node_modules` 的临时目录中加载所有 Host 入口,阻止缺少运行时依赖的包发布。上述测试使用本地模拟网页提供方,无需账号或 API Key;
451
+ 当前版本的完整 Host 启动及 Windows Electron 实机端到端验证仍待完成。
452
+ Electron 便携版默认固定 `0.2.0-rc.1` 官方 tag;旧 Electron 构建入口仍固定
404
453
  `0.1.5-alpha.1`,原 WebView2 构建固定 `0.1.3-alpha.1`。发行版仍需通过 Windows 上的真实 Host 冒烟。
405
454
 
406
455
  旧版自定义部署若关闭 `includeUserRoot` 且没有其它 `trust: user` 的预设目录,插件不会写入
407
456
  预设或更改 roots;部署者需先启用用户预设功能。插件依赖宿主内部接口(`ctx.tools`、
408
- `agent/pre-step`、Connection Fetch、agent 预设、客户端 slots/theme);DSH 大版本升级后
457
+ `system-prompt/assemble`、Connection Fetch、agent 预设、客户端 slots/theme);DSH 大版本升级后
409
458
  请按「安装 → 重启 → 设置页 → PRTS 模式 → 语料工具 → 网页工具 → 皮肤 → 版本热切换」
410
459
  过一遍冒烟。
411
460
 
@@ -59,3 +59,13 @@ Research report formatting uses [markdown-it](https://github.com/markdown-it/mar
59
59
  15.0.1 and its bundled dependencies. Their MIT and BSD notices are preserved in
60
60
  `lib/rhine/licenses/markdown-it-MIT.txt`, `entities-BSD-2-Clause.txt`, `linkify-it-MIT.txt`,
61
61
  `mdurl-MIT.txt`, `punycode.js-MIT.txt`, and `uc.micro-MIT.txt` in that directory.
62
+
63
+ ## Bundled plugin runtime libraries
64
+
65
+ The plugin includes prebuilt JavaScript runtime libraries so local checkout, npm, and
66
+ portable installations do not need to resolve them from a user's `node_modules`.
67
+ `lib/runtime/yaml.js` bundles js-yaml 4.3.1, MIT, Copyright (C) 2011–2015 Vitaly Puzrin;
68
+ `lib/runtime/zod.js` bundles Zod 4.4.3, MIT, Copyright (c) 2025 Colin McDonnell.
69
+ The complete upstream notices are included in `lib/runtime/licenses/js-yaml-MIT.txt`
70
+ and `lib/runtime/licenses/zod-MIT.txt`. These bundles are generated from the versions
71
+ locked in `package-lock.json` by `npm run build:runtime`.
@@ -0,0 +1,32 @@
1
+ /** Rebuild the committed pure-JavaScript runtime dependencies; no consumer install hook. */
2
+ import { copyFileSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
3
+ import { createRequire } from 'node:module'
4
+ import { dirname, join } from 'node:path'
5
+ import { fileURLToPath } from 'node:url'
6
+ import { build } from 'vite'
7
+
8
+ const root = fileURLToPath(new URL('../', import.meta.url))
9
+ const require = createRequire(import.meta.url)
10
+ const manifest = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'))
11
+ const dependencies = { 'js-yaml': manifest.devDependencies['js-yaml'], zod: manifest.devDependencies.zod }
12
+ const packages = Object.fromEntries(Object.entries(dependencies).map(([name, version]) => {
13
+ const path = require.resolve(name + '/package.json')
14
+ if (JSON.parse(readFileSync(path, 'utf8')).version !== version) throw new Error(`Run npm ci to install ${name}@${version}`)
15
+ return [name, dirname(path)]
16
+ }))
17
+ await build({
18
+ root, configFile: false, publicDir: false,
19
+ build: {
20
+ outDir: 'lib/runtime', emptyOutDir: true, target: 'node22', minify: false,
21
+ lib: {
22
+ entry: { yaml: join(root, 'resources/runtime/yaml.js'), zod: join(root, 'resources/runtime/zod.js') },
23
+ formats: ['es'], fileName: (_format, name) => `${name}.js`,
24
+ },
25
+ rollupOptions: { output: { banner: '// Generated by npm run build:runtime. See ./licenses/ for upstream notices.' } },
26
+ },
27
+ })
28
+ mkdirSync(join(root, 'lib/runtime/licenses'), { recursive: true })
29
+ for (const [name, path] of Object.entries(packages)) {
30
+ copyFileSync(join(path, 'LICENSE'), join(root, 'lib/runtime/licenses', `${name}-MIT.txt`))
31
+ }
32
+ writeFileSync(join(root, 'lib/runtime/versions.json'), JSON.stringify(dependencies, null, 2) + '\n')
@@ -0,0 +1,56 @@
1
+ /** Verify all Host entry points using only shipped code, outside the checkout's dependency tree. */
2
+ import { cpSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
3
+ import { tmpdir } from 'node:os'
4
+ import { join, relative, resolve } from 'node:path'
5
+ import { fileURLToPath } from 'node:url'
6
+ import { spawnSync } from 'node:child_process'
7
+ import { parseArgs } from 'node:util'
8
+
9
+ export function checkRuntime(packageRoot) {
10
+ const manifest = JSON.parse(readFileSync(join(packageRoot, 'package.json'), 'utf8'))
11
+ if (Object.keys(manifest.dependencies || {}).length) throw new Error('Bundle runtime dependencies before shipping the plugin')
12
+ const versions = JSON.parse(readFileSync(join(packageRoot, 'lib/runtime/versions.json'), 'utf8'))
13
+ for (const name of ['js-yaml', 'zod']) {
14
+ if (versions[name] !== manifest.devDependencies[name]) throw new Error(`Stale bundled ${name}; run npm run build:runtime`)
15
+ readFileSync(join(packageRoot, 'lib/runtime/licenses', `${name}-MIT.txt`))
16
+ }
17
+ const entries = Object.entries(manifest.exports).filter(([name, path]) =>
18
+ name !== './client' && typeof path === 'string' && /\.[cm]?js$/.test(path))
19
+ const temporary = mkdtempSync(join(tmpdir(), 'prts-runtime-'))
20
+ try {
21
+ const staged = join(temporary, 'plugin')
22
+ mkdirSync(staged)
23
+ // Include assets too: Host UI discovers packaged map files during import.
24
+ // These paths must also be selected for the actual npm package.
25
+ for (const path of ['package.json', 'src', 'presets', 'contracts', 'resources', 'lib']) {
26
+ if (path !== 'package.json' && !manifest.files.some(item => path === item || path.startsWith(item + '/'))) {
27
+ throw new Error(`Runtime tree is excluded from the npm package: ${path}`)
28
+ }
29
+ cpSync(join(packageRoot, path), join(staged, path), { recursive: true,
30
+ filter: file => !relative(packageRoot, file).split(/[\\/]/).includes('node_modules') })
31
+ }
32
+ const probe = join(staged, '__prts_runtime_check__.mjs')
33
+ writeFileSync(probe, `
34
+ for (const name of ${JSON.stringify(entries.map(([name]) => name === '.' ? manifest.name : manifest.name + name.slice(1)))}) {
35
+ await import(name)
36
+ }
37
+ const { readPlugins, writePlugins } = await import('./presets/composition.js')
38
+ const plugins = readPlugins('- id: probe\\n name: test/probe\\n disabled: !!js process.platform === "win32"\\n')
39
+ if (readPlugins(writePlugins(plugins))[0].disabled.__jsExpr !== 'process.platform === "win32"') {
40
+ throw new Error('Bundled preset parser lost the Cordis expression')
41
+ }
42
+ `)
43
+ const result = spawnSync(process.execPath, [probe], {
44
+ cwd: staged, encoding: 'utf8', timeout: 30000,
45
+ env: { ...process.env, NODE_PATH: '', NODE_OPTIONS: '' },
46
+ })
47
+ if (result.status !== 0) throw new Error(`Isolated plugin load failed:\n${result.error || result.stderr || result.stdout}`)
48
+ return { entries: entries.map(([name]) => name), dependencies: versions }
49
+ } finally { rmSync(temporary, { recursive: true, force: true }) }
50
+ }
51
+
52
+ if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
53
+ const { values } = parseArgs({ options: { package: { type: 'string' } } })
54
+ const result = checkRuntime(resolve(values.package || fileURLToPath(new URL('../', import.meta.url))))
55
+ console.error(`PRTS runtime: ${result.entries.length} Host entries loaded without node_modules`)
56
+ }
package/bin/install.js CHANGED
@@ -14,13 +14,14 @@
14
14
  * 做什么:
15
15
  * 1) 把插件加入 profile(dsh plugin add)
16
16
  * 2) DSH 0.1.7 起由插件注册「PRTS 模式」;旧版创建用户预设
17
- * ($DSH_HOME/.agent-presets/prts/*),且只有选中该模式才加载语料工具
17
+ * ($DSH_HOME/.agent-presets/prts/*),启动时继承该版本的标准模式
18
18
  * 3) 打印后续指引(如何设为默认模式)
19
19
  *
20
- * 说明:资料管理(设置页 /api + UI)由插件 host 常驻提供;语料三工具由
21
- * PRTS 预设加载——标准/极简等其它模式不加载 PRTS 工具。
20
+ * 说明:资料管理(设置页 /api + UI)由插件 host 常驻提供;
21
+ * PRTS 或用户自定义预设加载检索和调查工具。
22
22
  */
23
23
  import { execFileSync } from 'node:child_process'
24
+ import { createHash } from 'node:crypto'
24
25
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
25
26
  import { homedir } from 'node:os'
26
27
  import { dirname, join, resolve } from 'node:path'
@@ -221,6 +222,17 @@ if (usesDeclarativePresets(dshVersion)) {
221
222
  } else {
222
223
  console.log('\n[2/2] 创建 PRTS 用户预设…')
223
224
  mkdirSync(presetDir, { recursive: true })
225
+ const markerPath = join(presetDir, '.prts-terrarchive.json')
226
+ const generatedFiles = ['agent.cordis.yml', 'preset.yml']
227
+ const digest = (content) => createHash('sha256').update(content).digest('hex')
228
+ let packageOwned = !existsSync(compositionPath) && !existsSync(metadataPath)
229
+ try {
230
+ const marker = JSON.parse(readFileSync(markerPath, 'utf8'))
231
+ packageOwned = marker.format === 1 && marker.package === packageMetadata.name
232
+ && generatedFiles.every(file => existsSync(join(presetDir, file))
233
+ && digest(readFileSync(join(presetDir, file), 'utf8')) === marker.files?.[file])
234
+ } catch { /* Existing unmarked or edited presets belong to the user. */ }
235
+
224
236
  // 各文件独立修复;已存在的组合只迁移本插件旧 guidance,并补齐网页工具和 Skill loader,
225
237
  // 不覆盖其它用户改动。
226
238
  if (!existsSync(compositionPath)) {
@@ -261,12 +273,19 @@ if (usesDeclarativePresets(dshVersion)) {
261
273
  if (migrated !== existing) writeFileSync(compositionPath, migrated)
262
274
  }
263
275
  if (!existsSync(metadataPath)) writeFileSync(metadataPath, PRESET_METADATA)
276
+ // The running legacy Host can now extend its own standard preset on startup.
277
+ if (packageOwned) {
278
+ writeFileSync(markerPath, JSON.stringify({
279
+ format: 1, package: packageMetadata.name, version: packageMetadata.version,
280
+ files: Object.fromEntries(generatedFiles.map(file => [file, digest(readFileSync(join(presetDir, file), 'utf8'))])),
281
+ }, null, 2) + '\n')
282
+ }
264
283
  console.log(` 已确保预设文件存在(仅自动迁移本插件旧检索指导):${presetDir}`)
265
284
 
266
285
  console.log('\n完成。重启 dsh 后:')
267
286
  console.log(' · 设置 → 插件 →「PRTS 语料」= 资料管理(host 常驻,始终可进)')
268
- console.log(' · 新建会话顶部的模式下拉选「PRTS 模式」→ 加载语料三工具')
269
- console.log(' · 标准/极简等其它模式不加载 PRTS 工具')
287
+ console.log(' · 新建会话选择「PRTS 模式」→ 标准模式全部能力 + PRTS 检索与调查工具')
288
+ console.log(' · 创造模式可加载 prts-composition 技能,将 PRTS 工具加入自定义模式')
270
289
  console.log(` · 以后执行 dsh plugin update 后,可运行本命令加 --preset-only 同步预设迁移`)
271
290
  console.log(` · 卸载:${dshCmd} plugin --profile ${profile} remove ${packageMetadata.name}`)
272
291
  console.log(` · 想让新会话默认就用 PRTS 模式:设置 → Agent 预设 → 设为默认`)
@@ -19,30 +19,30 @@
19
19
  },
20
20
  "query": {
21
21
  "type": "string",
22
- "description": "名称或原句;仅有片段时使用 match_mode=literal"
22
+ "description": "名称或原句"
23
23
  },
24
24
  "title": {
25
25
  "type": "string",
26
- "description": "已有检索结果的完整篇章标题,与 query/document_uid/text_ids 四选一"
26
+ "description": "已有结果的完整篇章标题"
27
27
  },
28
28
  "document_uid": {
29
29
  "type": "string",
30
- "description": "已有检索结果的文档定位,替代 title"
30
+ "description": "已有结果的文档定位"
31
31
  },
32
32
  "line": {
33
33
  "type": "integer",
34
- "description": "已有中文结果中的行号,只用于定位对应文本/记录"
34
+ "description": "已有中文结果中的行号"
35
35
  },
36
36
  "text_ids": {
37
37
  "type": "array",
38
38
  "items": {
39
39
  "type": "string"
40
40
  },
41
- "description": "显式请求 ID 后可用于精确复查;普通查询不需要"
41
+ "description": "返回的文本 ID 字符串,用于精确复查"
42
42
  },
43
43
  "source_language": {
44
44
  "type": "string",
45
- "description": "原句的语言,默认 CN;也接受 en/ja/ko/zh-CN 等标准代码"
45
+ "description": "原句语言,默认 CN;支持 en/ja/ko/zh-CN 等代码"
46
46
  },
47
47
  "languages": {
48
48
  "type": "array",
@@ -57,11 +57,11 @@
57
57
  "exact",
58
58
  "literal"
59
59
  ],
60
- "description": "原句精确匹配或字面量片段搜索,默认 exact"
60
+ "description": "默认 exact 精确匹配;片段用 literal"
61
61
  },
62
62
  "include_ids": {
63
63
  "type": "boolean",
64
- "description": "默认 false;仅调试、核验或精确复查时返回内部文本 ID 与来源字段"
64
+ "description": "核验时返回内部 ID,默认 false"
65
65
  },
66
66
  "max_matches": {
67
67
  "type": "integer",
@@ -73,7 +73,7 @@
73
73
  },
74
74
  "data_version": {
75
75
  "type": "string",
76
- "description": "绑定已有结果的资料版本,避免混用版本"
76
+ "description": "已有结果的资料版本"
77
77
  },
78
78
  "after": {
79
79
  "type": "object",
@@ -98,7 +98,7 @@
98
98
  "type": "integer"
99
99
  }
100
100
  },
101
- "description": "仅原样提交工具返回的续页位置;长记录会明确分块返回"
101
+ "description": "原样复制 page.continuation.after"
102
102
  }
103
103
  }
104
104
  },
package/cordis.patch.yml CHANGED
@@ -1,15 +1,15 @@
1
- # PRTS.chat 本地语料插件层(工具层,随 bundle 默认加载)。
2
- # 插件零 npm 依赖;宿主只需提供 ctx.tools 注册表。
3
- # 五工具:corpus_search / corpus_read / timeline_search +(配置 cloud.baseUrl 时)cloud_search / cloud_inspect。
1
+ # PRTS.chat 资料管理、模式注册与组合说明。Agent 工具按预设装配。
4
2
  # releasesDir 支持绝对路径或相对进程 cwd 的路径;默认 $DSH_HOME/prts-corpus/releases。
5
3
  - insert:
6
4
  - id: prts-preset-seed
7
5
  name: prts-terrarchive/presets
6
+ - id: prts-composition-skill
7
+ name: prts-terrarchive/composition
8
8
  - id: prts-corpus
9
9
  name: prts-terrarchive
10
10
  config:
11
11
  # host 常驻只做资料管理(/api + 设置 UI),不注册语料工具;
12
- # 语料工具由 PRTS 预设(模式)的 agent.cordis.yml 加载时才注册。
12
+ # 语料工具由 PRTS 或用户自定义预设加载时注册。
13
13
  registerTools: false
14
14
  # releasesDir 省略时默认 $DSH_HOME/prts-corpus/releases;
15
15
  # 如资料放在别处再填绝对路径(Windows 亦可用正斜杠)。
@@ -0,0 +1,24 @@
1
+ # PRTS 模式的网页搜索与抓取
2
+
3
+ PRTS 模式使用宿主 DSH 的 `web_search` / `web_fetch`。PRTS 本地语料检索和 `cloud_search` 不使用这两套网页接口。
4
+
5
+ ## 桌面账号登录后,搜索仍提示缺少 API Key
6
+
7
+ 目前核对的 DSH 0.1.7-rc.2 中,聊天的 `deepseek-account` 与默认网页搜索 `deepseek-official` 是两条独立通路。
8
+ 网页登录成功不代表已配置 DeepSeek 开放平台 API Key。账号登录 token、npm token 都不能代替这个 Key。
9
+
10
+ 在 DSH 的**插件 → 网页搜索**配置页面填写自己的 DeepSeek 开放平台 API Key 并保存;旧版可在**设置 → 模型**中配置相同的 `DEEPSEEK_API_KEY` 凭据。
11
+ 凭据存入宿主的凭据服务,不应写入 PRTS 插件、发行包或会话消息。已有第三方搜索提供方的用户按该提供方配置,不要为修复缺 Key 随意改写搜索端点。
12
+
13
+ 没有独立 Key 时,当前官方实现无法仅靠桌面账号完成默认网页搜索。PRTS 会提示这个条件,并继续可用的本地检索;这不代表现实资料已经联网核实。
14
+
15
+ ## `web_fetch failed: TypeError: fetch failed`
16
+
17
+ 网页抓取不依赖搜索的 API Key。这个错误只说明那次页面请求没有成功,日志若未记录底层原因,就无法进一步区分 DNS、连接、代理和 TLS 问题。
18
+ 两个同域名页面失败也不能推导出其他网站全部不可访问。
19
+
20
+ 先确认目标页面在本机网络中是否可访问,再确认 **DSH 进程**使用的网络配置。浏览器代理设置未必会传给 DSH 的 Node Host。
21
+ 当前官方源码从启动环境读取标准代理变量(如 `HTTPS_PROXY`);如果确实需要代理,应使用本机实际的 HTTP 代理地址,在启动 DSH 前设置,然后彻底退出并重新启动 DSH。
22
+ 不要复制不属于自己机器的端口,不要用关闭证书校验来绕过 TLS 故障。旧宿主对代理的具体支持以它自己的版本为准。
23
+
24
+ 插件不会代填密钥、修改系统代理或替换宿主网络实现。新增故障指引会按会话及失败域名记录,成功后移除;不保存凭据、URL 查询参数或请求头。